@yeaft/webchat-agent 1.0.288 → 1.0.290

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.
@@ -1,17 +1,17 @@
1
- var H=(e,t,s)=>()=>{if(s)throw s[0];try{return e&&(t=e(e=0)),t}catch(n){throw s=[n],n}};var kg=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(s){throw t=0,s}};function Va(e,t){let s=nacl.randomBytes(24),n=JSON.stringify(e),i,r=!1;n.length>512?(i=pako.gzip(n),r=!0):i=nacl.util.decodeUTF8(n);let o=nacl.secretbox(i,s,t),a={n:nacl.util.encodeBase64(s),c:nacl.util.encodeBase64(o)};return r&&(a.z=!0),a}function Fa(e,t){try{let s=nacl.util.decodeBase64(e.n),n=nacl.util.decodeBase64(e.c),i=nacl.secretbox.open(n,s,t);if(!i)return null;if(e.z){let r=pako.ungzip(i,{to:"string"});return JSON.parse(r)}else return JSON.parse(nacl.util.encodeUTF8(i))}catch{return null}}function Ha(e){return e&&typeof e=="object"&&typeof e.n=="string"&&typeof e.c=="string"}function lt(e){return nacl.util.decodeBase64(e)}var Yn=H(()=>{});var Sg,Cg,Me,ct=H(()=>{Yn();({defineStore:Sg}=Pinia),Cg=1800*1e3,Me=Sg("auth",{state:()=>({skipAuth:!1,emailVerification:!1,passwordResetEnabled:!1,totpEnabled:!1,registrationEnabled:!1,aadEnabled:!1,aadClientId:null,aadTenantId:null,ssoProviders:{github:!1,google:!1,wechat:!1,alipay:!1},linkedIdentities:[],hasPassword:!1,identitiesLoading:!1,identitiesError:null,initialized:!1,authGeneration:0,isAuthenticated:!1,token:null,sessionKey:null,role:null,loginStep:"credentials",tempToken:null,emailHint:null,setupToken:null,totpSecret:null,qrCode:null,error:null,loading:!1,qrPanel:null,_qrPollTimer:null,_sessionRefreshTimer:null,_sessionRefreshVisibilityHandler:null}),actions:{async initialize(){if(this.initialized)return this.isAuthenticated;try{if(await this.checkAuthMode(),this.skipAuth&&this.isAuthenticated)return!0;let e=!1;return typeof window<"u"&&typeof this.consumeSsoRedirect=="function"&&(e=this.consumeSsoRedirect()),!this.isAuthenticated&&!e&&await this.restoreSession(),this.isAuthenticated}finally{this.initialized=!0}},async checkAuthMode(){try{let t=await(await fetch("/api/auth/mode")).json();this.skipAuth=t.skipAuth,this.emailVerification=t.emailVerification,this.passwordResetEnabled=!!t.passwordResetEnabled,this.totpEnabled=t.totpEnabled,this.registrationEnabled=t.registrationEnabled||!1,this.aadEnabled=t.aadEnabled||!1,this.aadClientId=t.aadClientId||null,this.aadTenantId=t.aadTenantId||null,this.ssoProviders=Object.assign({github:!1,google:!1,wechat:!1,alipay:!1},t.ssoProviders||{}),this.skipAuth&&(this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated")}catch{}},async login(e,t){this.loading=!0,this.error=null;try{let n=await(await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})})).json();return n.success?n.needTotpSetup?(this.setupToken=n.setupToken,this.totpSecret=n.totpSecret,this.qrCode=n.qrCode,this.loginStep="totp-setup",!0):n.needTotpCode?(this.tempToken=n.tempToken,this.loginStep="totp",!0):n.needEmailCode?(this.tempToken=n.tempToken,this.emailHint=n.emailHint,this.loginStep="verification",!0):(this.token=n.token,this.sessionKey=n.sessionKey?lt(n.sessionKey):null,this.role=n.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",localStorage.setItem("authToken",n.token),this.startSessionRefresh(),!0):(this.error=n.error||"Login failed",!1)}catch(s){return this.error=s.message||"Network error",!1}finally{this.loading=!1}},async loginWithMicrosoft(){if(!this.aadEnabled||!this.aadClientId||!this.aadTenantId)return this.error="Microsoft login is not configured",!1;if(typeof msal>"u"||!msal.PublicClientApplication)return this.error="Microsoft authentication library not loaded",!1;this.loading=!0,this.error=null;try{let e={auth:{clientId:this.aadClientId,authority:`https://login.microsoftonline.com/${this.aadTenantId}`,redirectUri:window.location.origin+"/auth/callback"},cache:{cacheLocation:"sessionStorage",storeAuthStateInCookie:!1}},t=new msal.PublicClientApplication(e);await t.initialize();let s=await t.loginPopup({scopes:["openid","profile","email"]});if(!s||!s.idToken)return this.error="Microsoft login failed: no token received",!1;let i=await(await fetch("/api/auth/aad",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:s.idToken})})).json();return i.success?(this.token=i.token,this.sessionKey=i.sessionKey?lt(i.sessionKey):null,this.role=i.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",localStorage.setItem("authToken",i.token),this.startSessionRefresh(),!0):(this.error=i.error||"Microsoft login failed",!1)}catch(e){return e.errorCode==="user_cancelled"||e.name==="BrowserAuthError"?(this.error=null,!1):(this.error=e.message||"Microsoft login failed",!1)}finally{this.loading=!1}},async verifyTotpCode(e){this.loading=!0,this.error=null;try{let s=await(await fetch("/api/auth/verify-totp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tempToken:this.tempToken,totpCode:e})})).json();return s.success?s.needEmailCode?(this.tempToken=s.tempToken,this.emailHint=s.emailHint,this.loginStep="verification",!0):(this.token=s.token,this.sessionKey=s.sessionKey?lt(s.sessionKey):null,this.role=s.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",this.tempToken=null,localStorage.setItem("authToken",s.token),this.startSessionRefresh(),!0):(this.error=s.error||"TOTP verification failed",!1)}catch(t){return this.error=t.message||"Network error",!1}finally{this.loading=!1}},async completeTotpSetup(e){this.loading=!0,this.error=null;try{let s=await(await fetch("/api/auth/setup-totp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({setupToken:this.setupToken,totpCode:e})})).json();return s.success?(this.setupToken=null,this.totpSecret=null,this.qrCode=null,s.needEmailCode?(this.tempToken=s.tempToken,this.emailHint=s.emailHint,this.loginStep="verification",!0):(this.token=s.token,this.sessionKey=s.sessionKey?lt(s.sessionKey):null,this.role=s.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",localStorage.setItem("authToken",s.token),this.startSessionRefresh(),!0)):(this.error=s.error||"TOTP setup failed",!1)}catch(t){return this.error=t.message||"Network error",!1}finally{this.loading=!1}},async verifyCode(e){this.loading=!0,this.error=null;try{let s=await(await fetch("/api/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tempToken:this.tempToken,code:e})})).json();return s.success?(this.token=s.token,this.sessionKey=s.sessionKey?lt(s.sessionKey):null,this.role=s.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",this.tempToken=null,this.emailHint=null,localStorage.setItem("authToken",s.token),this.startSessionRefresh(),!0):(this.error=s.error||"Verification failed",!1)}catch(t){return this.error=t.message||"Network error",!1}finally{this.loading=!1}},async register(e,t,s,n){this.loading=!0,this.error=null;try{let r=await(await fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t,email:s||void 0,invitationCode:n})})).json();return r.success?!0:(this.error=r.error||"Registration failed",!1)}catch(i){return this.error=i.message||"Network error",!1}finally{this.loading=!1}},showRegister(){this.loginStep="register",this.error=null},loginWithSso(e){window.location.href=`/api/auth/sso/${encodeURIComponent(e)}/start`},async loginWithAlipayMobile({intent:e="login"}={}){if(!await this.startSsoQr("alipay",{intent:e}))return!1;let s=this.qrPanel?.authorizeUrl;if(!s)return!1;let n=`alipays://platformapi/startapp?appId=20000067&url=${encodeURIComponent(s)}`;return this.qrPanel={...this.qrPanel,mobileDeepLink:!0},window.location.href=n,!0},async startSsoQr(e,{intent:t="login"}={}){this.cancelSsoQr(),this.error=null;try{let s=new URLSearchParams;if(t==="bind"){if(!this.isAuthenticated)return this.error="You must be logged in to bind an identity",!1;s.set("intent","bind")}let n=s.toString(),i=`/api/auth/sso/${encodeURIComponent(e)}/start-qr${n?"?"+n:""}`,r=await fetch(i),o=await r.json();return!r.ok||!o.success?(this.error=o.error||"Failed to start QR login",!1):(this.qrPanel={provider:e,intent:t,authorizeUrl:o.authorizeUrl,state:o.state,status:"pending",error:null},this._startQrPoll(),!0)}catch(s){return this.error=s.message||"Network error",!1}},_startQrPoll(){this._stopQrPollTimer();let e=async()=>{if(!this.qrPanel)return;let t=this.qrPanel.state;try{let n=await(await fetch(`/api/auth/sso/poll/${encodeURIComponent(t)}`)).json();if(!this.qrPanel||this.qrPanel.state!==t||n.status==="pending")return;if(n.status==="login"){this.token=n.token,this.sessionKey=n.sessionKey?lt(n.sessionKey):null,this.role=n.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",localStorage.setItem("authToken",n.token),this.startSessionRefresh(),this.cancelSsoQr();return}if(n.status==="bind"){this.qrPanel={...this.qrPanel,status:"bound"},this._stopQrPollTimer();return}this.qrPanel={...this.qrPanel,status:"error",error:n.error||"SSO failed"},this._stopQrPollTimer()}catch{}};this._qrPollTick=e,this._qrPollTimer=setInterval(e,2e3),typeof document<"u"&&!this._qrVisHandler&&(this._qrVisHandler=()=>{typeof document<"u"&&document.visibilityState&&document.visibilityState!=="visible"||!this.qrPanel||!this._qrPollTick||(this._qrPollTick(),this._qrPollTimer&&clearInterval(this._qrPollTimer),this._qrPollTimer=setInterval(this._qrPollTick,2e3))},document.addEventListener("visibilitychange",this._qrVisHandler),typeof window<"u"&&window.addEventListener("pageshow",this._qrVisHandler))},_stopQrPollTimer(){this._qrPollTimer&&(clearInterval(this._qrPollTimer),this._qrPollTimer=null),this._qrVisHandler&&(typeof document<"u"&&document.removeEventListener("visibilitychange",this._qrVisHandler),typeof window<"u"&&window.removeEventListener("pageshow",this._qrVisHandler),this._qrVisHandler=null),this._qrPollTick=null},cancelSsoQr(){this._stopQrPollTimer(),this.qrPanel=null},bindSso(e){if(!this.isAuthenticated){this.error="You must be logged in to bind an identity";return}let t=new URLSearchParams({intent:"bind"});window.location.href=`/api/auth/sso/${encodeURIComponent(e)}/start?${t.toString()}`},consumeSsoRedirect(){let e=window.location.hash||"",t=e.indexOf("?");if(!e.startsWith("#/sso-complete")||t<0)return!1;let s=new URLSearchParams(e.slice(t+1)),n=s.get("token"),i=s.get("sessionKey"),r=s.get("role");if(!n)return!1;this.token=n,this.sessionKey=i?lt(i):null,this.role=r||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",localStorage.setItem("authToken",n),this.startSessionRefresh();try{history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}return!0},async loadIdentities(){if(this.isAuthenticated){this.identitiesLoading=!0,this.identitiesError=null;try{let e=await fetch("/api/auth/identities"),t=await e.json();if(!e.ok||!t.success){this.identitiesError=t.error||"Failed to load identities";return}this.linkedIdentities=t.identities||[],this.hasPassword=!!t.hasPassword}catch(e){this.identitiesError=e.message||"Network error"}finally{this.identitiesLoading=!1}}},async unbindIdentity(e){if(!this.isAuthenticated)return!1;this.identitiesError=null;try{let t=await fetch(`/api/auth/identities/${encodeURIComponent(e)}`,{method:"DELETE"}),s=await t.json();return!t.ok||!s.success?(this.identitiesError=s.error||"Failed to unbind",!1):(this.linkedIdentities=this.linkedIdentities.filter(n=>n.provider!==e),!0)}catch(t){return this.identitiesError=t.message||"Network error",!1}},async refreshSession(){let e=this.token,t=this.authGeneration,s=this.isAuthenticated;try{let n=await fetch("/api/user/profile",{headers:e?{Authorization:`Bearer ${e}`}:{}});if(this.handleAuthResponse(n,e,t,s)||!n.ok)return!1;let i=await n.json().catch(()=>({})),r=n.headers?.get?.("X-New-Token"),o=localStorage.getItem("authToken");return r&&this.token===e&&(!o||o===e)&&(this.token=r,localStorage.setItem("authToken",r)),i?.role&&(this.role=i.role),!0}catch{return!1}},startSessionRefresh(){if(this.stopSessionRefresh(),!this.isAuthenticated||this.skipAuth)return;let e=()=>{typeof document<"u"&&document.visibilityState&&document.visibilityState!=="visible"||this.refreshSession()};this._sessionRefreshTimer=setInterval(e,Cg),this._sessionRefreshVisibilityHandler=e,typeof document<"u"&&document.addEventListener("visibilitychange",e),typeof window<"u"&&window.addEventListener("pageshow",e)},stopSessionRefresh(){this._sessionRefreshTimer&&(clearInterval(this._sessionRefreshTimer),this._sessionRefreshTimer=null),this._sessionRefreshVisibilityHandler&&(typeof document<"u"&&document.removeEventListener("visibilitychange",this._sessionRefreshVisibilityHandler),typeof window<"u"&&window.removeEventListener("pageshow",this._sessionRefreshVisibilityHandler),this._sessionRefreshVisibilityHandler=null)},async logout(){try{let e={"Content-Type":"application/json"};this.token&&(e.Authorization=`Bearer ${this.token}`),await fetch("/api/auth/logout",{method:"POST",headers:e})}catch{}this.clearStoredSession()},clearStoredSession(e=null){this.reset(),localStorage.removeItem("authToken"),e&&(this.error=e)},getActiveToken(){if(this.token)return this.token;let e=localStorage.getItem("authToken");return e&&(this.token=e),this.token},handleAuthResponse(e,t=null,s=this.authGeneration,n=this.isAuthenticated,i=void 0){if(!e||e.status!==401||!n||s!==this.authGeneration)return!1;let r=this.token||localStorage.getItem("authToken")||null;return t!==r?!1:(this.handleAuthFailure(i,t,s),!0)},handleAuthFailure(e="Session expired. Please log in again.",t=null,s=this.authGeneration){if(s!==this.authGeneration)return!1;let n=this.token||localStorage.getItem("authToken")||null;return t!==n||this.clearStoredSession(e),!1},async restoreSession(){let e=localStorage.getItem("authToken"),t=this.authGeneration,s=this.isAuthenticated||!!e;try{let n=await fetch("/api/user/profile",{headers:e?{Authorization:`Bearer ${e}`}:{}});if(this.handleAuthResponse(n,e,t,s))return!1;if(!n.ok)return this.error="Failed to restore session",!1;let i=await n.json();if(t!==this.authGeneration)return this.isAuthenticated;let r=n.headers?.get?.("X-New-Token"),o=this.getActiveToken(),a=r&&(!o||o===e)?r:o||e;return this.token=a,a&&a!==e&&localStorage.setItem("authToken",a),this.role=i?.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",this.startSessionRefresh(),!0}catch(n){return this.error=n.message||"Failed to restore session",!1}},setSessionKey(e){e&&(this.sessionKey=lt(e))},backToCredentials(){this.loginStep="credentials",this.tempToken=null,this.emailHint=null,this.setupToken=null,this.totpSecret=null,this.qrCode=null,this.error=null},async requestPasswordReset(e){this.error=null;try{let s=await(await fetch("/api/auth/password-reset/request",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})})).json();return s.success?s.resetToken||null:(this.error=s.error||"Failed to request password reset",null)}catch(t){return this.error=t.message||"Network error",null}},async verifyPasswordReset(e,t,s){this.error=null;try{let i=await(await fetch("/api/auth/password-reset/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resetToken:e,code:t,newPassword:s})})).json();return i.success?!0:(this.error=i.error||"Failed to reset password",!1)}catch(n){return this.error=n.message||"Network error",!1}},async deleteAccount({currentPassword:e,confirm:t}={}){if(!this.isAuthenticated)return{success:!1,error:"Not authenticated"};try{let s=await fetch("/api/user/me",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:e,confirm:t})}),n=await s.json();return!s.ok||!n.success?{success:!1,error:n.error||"Failed to delete account"}:(this.clearStoredSession(),{success:!0})}catch(s){return{success:!1,error:s.message||"Network error"}}},reset(){this.authGeneration+=1,this.stopSessionRefresh(),this.isAuthenticated=!1,this.token=null,this.sessionKey=null,this.role=null,this.loginStep="credentials",this.tempToken=null,this.emailHint=null,this.setupToken=null,this.totpSecret=null,this.qrCode=null,this.error=null,this.loading=!1}}})});function Pe(e,t){let s=kt?.value||"zh-CN",i=(bs[s]||bs["zh-CN"]||{})[e];if(i===void 0&&s!=="zh-CN"&&(i=(bs["zh-CN"]||{})[e]),i===void 0)return e;if(t)for(let[r,o]of Object.entries(t))i=i.replace(new RegExp(`\\{${r}\\}`,"g"),o);return i}function Ig(){return kt?.value||"zh-CN"}function Zs(e){bs[e]&&(kt&&(kt.value=e),localStorage.setItem("locale",e),document.documentElement.setAttribute("lang",e))}function Ag(){let e=localStorage.getItem("locale");return e&&bs[e]?e:(navigator.language||navigator.userLanguage||"").startsWith("en")?"en":"zh-CN"}function Oa(e,t){return bs=t,kt=Vue.ref(Ag()),document.documentElement.setAttribute("lang",kt.value),e.config.globalProperties.$t=Pe,e.config.globalProperties.$locale=kt,e.provide("t",Pe),e.provide("locale",kt),{t:Pe,setLocale:Zs,getLocale:Ig,locale:kt}}var kt,bs,St=H(()=>{kt=null,bs={}});function jn(e){if(e==null||e==="")return"claude-code";if(xg.has(e))return e;throw new Error(`Unknown Chat runtime provider: ${e}`)}function ws(e){if(typeof e!="string"||!e)throw new Error("Chat catalog key requires conversationId");return`chat:${e}`}function Gn(e,t){if(typeof e!="string"||!e||typeof t!="string"||!t)throw new Error("Yeaft catalog key requires agentId and sessionId");return`yeaft:${e}:${t}`}function Dr(e,t){let s=e.sessionCatalog.map(n=>({...n}));return e.sessionCatalogMutationRequests[t]={previousCatalog:s},s}function qa(e,t){let s=t?.requestId?e.sessionCatalogMutationRequests[t.requestId]:null;return s?(delete e.sessionCatalogMutationRequests[t.requestId],t.ok!==!0&&(e.sessionCatalog=s.previousCatalog),!0):!1}function Na(e,t,s="recent",n=null){let i=ws(t),r=e.chatHistoryRequests[i]||{},o=Number(r.generation||0)+1,a=`chat_history_${o}_${crypto.randomUUID()}`;return e.chatHistoryRequests[i]={requestId:a,catalogKey:i,generation:o,mode:s,cursor:n,connectionGeneration:Number(e.chatHistoryConnectionGeneration||0),loading:!0,cancelled:!1,error:null},a}function Ba(e,t,s,n){let i=e.chatHistoryRequests[t];return i?.requestId!==s?!1:(e.chatHistoryRequests[t]={...i,loading:!1,cancelled:!0,error:n},!0)}var xg,Er=H(()=>{xg=new Set(["claude-code","copilot"])});function ks(e,t,s=""){Js&&(clearTimeout(Js),Js=null),e.sessionLoading=t,e.sessionLoadingText=s,t&&(Js=setTimeout(()=>{e.sessionLoading&&(e.sessionLoading=!1,e.sessionLoadingText=""),Js=null},Tg))}function gt(e){ks(e,!1)}function Wa(e){if(e.currentConversation){e.pendingRecovery=null;return}let t=e.lastUsedSession,s=e.lastUsedAgent;if(t&&t.sessionId&&s){let n=e.agents.find(i=>i.id===s&&i.online);n&&(e.pendingRecovery={agentId:s,agentName:n.name,sessionId:t.sessionId,workDir:t.workDir,provider:jn(t.provider),catalogKey:t.catalogKey||null},e.recoveryDismissed=!1)}}function Ua(e){if(!e.pendingRecovery)return;let{agentId:t,sessionId:s,workDir:n,provider:i}=e.pendingRecovery;e.selectAgent(t),setTimeout(()=>{e.resumeConversation(s,n,t,{provider:jn(i)}),e.pendingRecovery=null,e.recoveryDismissed=!1},500)}function za(e){e.recoveryDismissed=!0,e.pendingRecovery=null}function Ka(e,t){let s=e.conversations.find(n=>n.id===t);s&&(e.activeConversations=[t],e.currentWorkDir=s.workDir,e.messagesMap[t]?.length>0||(s.claudeSessionId?(e.messagesMap[t]=[],ks(e,!0,Pe("chat.session.loadingHistory")),e.sendWsMessage({type:"resume_conversation",agentId:s.agentId||e.currentAgent,claudeSessionId:s.claudeSessionId,workDir:s.workDir,conversationId:t})):(e.messagesMap[t]=[],e.requestChatHistory?.(t,{mode:"recent",turns:5}))),e.sendWsMessage({type:"select_conversation",conversationId:t}))}function Ya(e){if(e.panels.length>0)return;let t=localStorage.getItem("panels");if(!t)return;let s;try{s=JSON.parse(t)}catch{localStorage.removeItem("panels");return}if(!Array.isArray(s)||s.length<2){localStorage.removeItem("panels");return}let n=new Set(e.conversations.map(r=>r.id)),i=s.filter(r=>r&&typeof r.id=="string").map(r=>({id:r.id,conversationId:r.conversationId&&n.has(r.conversationId)?r.conversationId:null,activeRightPanel:r.activeRightPanel||null}));if(i.length<2){localStorage.removeItem("panels");return}e.panels=i,e.activePanelId=i[0]?.id||null;for(let r of i)r.conversationId&&(e.activeConversations.includes(r.conversationId)||e.activeConversations.push(r.conversationId),e.messagesMap[r.conversationId]||(e.messagesMap[r.conversationId]=[]),e.messagesMap[r.conversationId].length||e.requestChatHistory?.(r.conversationId,{mode:"recent",turns:5}))}function Ss(e){if(e.currentAgent){if(localStorage.setItem("lastUsedAgent",e.currentAgent),localStorage.setItem("lastViewedConversation",e.currentConversation||""),e.lastViewedConversation=e.currentConversation,e.currentConversation){let t=e.conversations.find(s=>s.id===e.currentConversation);if(t?.claudeSessionId&&t?.workDir){let s=jn(t.provider),n={sessionId:t.claudeSessionId,workDir:t.workDir,agentId:t.agentId||e.currentAgent,provider:s,catalogKey:ws(t.id),version:2};localStorage.setItem("lastUsedSession",JSON.stringify(n)),localStorage.setItem("lastViewedSessionRef",JSON.stringify(n)),e.lastUsedSession=n}}e.lastUsedAgent=e.currentAgent,e.panels.length>0?localStorage.setItem("panels",JSON.stringify(e.panels)):localStorage.removeItem("panels")}}function ja(e){return e.lastUsedSession}function Ga(e){localStorage.removeItem("lastUsedAgent"),localStorage.removeItem("lastUsedSession"),localStorage.removeItem("lastViewedSessionRef"),localStorage.removeItem("lastViewedConversation"),localStorage.removeItem("panels"),localStorage.removeItem("splitPanesSaved"),e.lastUsedAgent=null,e.lastUsedSession=null,e.lastViewedConversation=null}function Qa(e,t,s){if(!e.currentAgent){e.historySessionsLoading=!1;return}if(!t){e.historySessions=[],e.historySessionsLoading=!1;return}let n=Date.now().toString();e._historySessionsRequestId=n,e.historySessionsLoading=!0,e.historySessions=[],e.sendWsMessage({type:"list_history_sessions",workDir:t,provider:s||"claude-code",requestId:n})}function Xa(e,t){if(!e.currentAgent)return e.foldersLoading=!1,Promise.resolve();e.foldersLoading=!0,e.folders=[];let s=Date.now().toString();return e._foldersRequestId=s,new Promise(n=>{e._foldersResolve&&e._foldersResolve(),e._foldersResolve=n,e.sendWsMessage({type:"list_folders",provider:t||"claude-code",requestId:s}),setTimeout(()=>{e._foldersResolve===n&&(e._foldersResolve(),e._foldersResolve=null,e.foldersLoading=!1)},1e4)})}function Za(e,t,s){if(!t)return e.foldersLoading=!1,Promise.resolve();e.foldersLoading=!0,e.folders=[];let n=Date.now().toString();return e._foldersRequestId=n,new Promise(i=>{e._foldersResolve&&e._foldersResolve(),e._foldersResolve=i,e.sendWsMessage({type:"list_folders",agentId:t,provider:s||"claude-code",requestId:n}),setTimeout(()=>{e._foldersResolve===i&&(e._foldersResolve(),e._foldersResolve=null,e.foldersLoading=!1)},1e4)})}function Ja(e,t,s){if(!t)return Promise.resolve([]);let n=`models-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return e._modelsRequestId=n,e.providerModelsLoading=!0,new Promise(i=>{e._modelsResolve&&e._modelsResolve([]),e._modelsTimeout&&clearTimeout(e._modelsTimeout),e._modelsResolve=i,e.sendWsMessage({type:"list_models",agentId:t,provider:s||"claude-code",requestId:n}),e._modelsTimeout=setTimeout(()=>{e._modelsResolve===i&&(e._modelsResolve([]),e._modelsResolve=null,e.providerModelsLoading=!1),e._modelsTimeout=null},1e4)})}function el(e,t,s,n){if(!t){e.historySessionsLoading=!1;return}if(!s){e.historySessions=[],e.historySessionsLoading=!1;return}let i=Date.now().toString();e._historySessionsRequestId=i,e.historySessionsLoading=!0,e.historySessions=[],e.sendWsMessage({type:"list_history_sessions",agentId:t,workDir:s,provider:n||"claude-code",requestId:i})}async function tl(e,t=20){if(Me().isAuthenticated){e.globalSessionsLoading=!0;try{let n=await fetch(`/api/sessions?limit=${t}`);if(n.ok){let i=await n.json();e.globalSessions=i.sessions||[]}}catch{}finally{e.globalSessionsLoading=!1}}}async function sl(e,t){if(!Me().isAuthenticated)return!1;try{if((await fetch(`/api/sessions/${t}`,{method:"DELETE"})).ok)return e.globalSessions=e.globalSessions.filter(i=>i.id!==t),!0}catch{}return!1}function Lr(e,t){return t.agentId?e.agents.find(s=>s.id===t.agentId):t.agentName?e.agents.find(s=>s.name===t.agentName):null}function nl(e,t){let s=Lr(e,t);return s&&s.online}var Tg,Js,Kt=H(()=>{ct();St();Er();Tg=3e4,Js=null});function il(e){return e?.code===1008&&String(e.reason||"").toLowerCase().includes("authentication")}function rl(e){let t=en;en=[];for(let{resolve:s,reject:n,timer:i}of t)clearTimeout(i),e?s():n(new Error("WebSocket reconnect failed"))}function ol(e,t){if(!e.ws||e.ws.readyState!==WebSocket.OPEN)return!1;if(e.currentView==="yeaft"&&Pg.has(t.type)){let s=t.conversationId;if(!s||typeof s=="string"&&s.startsWith("yeaft-")||s===e.yeaftConversationId)return!1}try{if(e.serverEncryptionRequired&&e.sessionKey){let s=Va(t,e.sessionKey);e.ws.send(JSON.stringify(s))}else e.ws.send(JSON.stringify(t));return!0}catch{return!1}}function tn(e,t=1e4){return e.ws&&e.ws.readyState===WebSocket.OPEN?Promise.resolve():new Promise((s,n)=>{let i=setTimeout(()=>{en=en.filter(r=>r.resolve!==s),n(new Error("WebSocket reconnect timeout"))},t);en.push({resolve:s,reject:n,timer:i}),(!e.ws||e.ws.readyState!==WebSocket.CONNECTING)&&(e.reconnectAttempts=0,e.connect())})}function al(e,t){try{let s=JSON.parse(t);return e.sessionKey&&Ha(s)?Fa(s,e.sessionKey):s}catch{return null}}function ll(e){let t=Me(),s=location.protocol==="https:"?"wss:":"ws:";e.reconnectTimer&&(clearTimeout(e.reconnectTimer),e.reconnectTimer=null);let n=t.getActiveToken?.()||t.token||null,i=t.authGeneration;if(e.ws&&e.ws.readyState===WebSocket.CONNECTING&&e._wsAuthToken===n&&e._wsAuthGeneration===i)return;clearTimeout(e._legacyYeaftSessionHydrateTimer),e._legacyYeaftSessionHydrateTimer=null,e._hasHandledAgentList=!1,e._hasHandledYeaftSessionHydrate=!1,e.yeaftSessionInventoryCompleteSupported=null,e.yeaftSessionHydrateRequestId=null,e.yeaftSessionHydrateSlices=[],e.yeaftSessionHydrateError=null,e._yeaftSessionInventorySocketQuarantined=!1,e.pendingAgentSelection=null,e.agentSwitching=!1,e.ws&&(e.ws.onopen=null,e.ws.onmessage=null,e.ws.onclose=null,e.ws.close(),e.ws=null),e.connectionState=e.reconnectAttempts>0?"reconnecting":"connecting",e.serverEncryptionRequired=!0,e.chatHistoryRequestIdSupported=null,e.chatHistoryConnectionGeneration=Number(e.chatHistoryConnectionGeneration||0)+1;for(let[l,c]of Object.entries(e.chatHistoryRequests||{}))c?.loading&&(e.chatHistoryRequests[l]={...c,loading:!1,cancelled:!0,error:"connection_changed"});let r=Object.values(e.sessionCatalogMutationRequests||{});r.length>0&&(e.sessionCatalog=r[0].previousCatalog,e.sessionCatalogMutationRequests={}),e.sessionCatalogLoaded=!1,e.sessionCatalog=[],e.activeCatalogKey=null,e._wsAuthToken=n,e._wsAuthGeneration=i;let o=`${s}//${location.host}?type=web`;n&&(o+=`&token=${encodeURIComponent(n)}`);let a=new WebSocket(o);e.ws=a,a.onopen=()=>{if(a===e.ws){e.connectionState="connected",e.reconnectAttempts=0,e.startHeartbeat();try{a.send(JSON.stringify({type:"client_hello",plaintextOk:!0}))}catch{}rl(!0)}},a.onmessage=l=>{if(a!==e.ws)return;let c=e.parseWsMessage(l.data);c&&(c.type,e.handleMessage({...c,_wsAuthToken:n,_wsAuthGeneration:i}))},a.onclose=l=>{if(a!==e.ws){il(l)&&t.handleAuthFailure?.(void 0,n,i);return}e.authenticated=!1,clearTimeout(e._legacyYeaftSessionHydrateTimer),e._legacyYeaftSessionHydrateTimer=null,e._hasHandledAgentList=!1,e._hasHandledYeaftSessionHydrate=!1,e.yeaftSessionInventoryCompleteSupported=null,e.yeaftSessionHydrateRequestId=null,e.yeaftSessionHydrateSlices=[],e.yeaftSessionHydrateError=null,e.pendingAgentSelection=null,e.agentSwitching=!1;let c=e.connectionState==="updating";if(e.connectionState=c?"updating":"disconnected",e.stopHeartbeat(),gt(e),il(l)){t.handleAuthFailure?.(void 0,n,i),e.reconnectAttempts=0,rl(!1);return}if(e._yeaftReconnectCatchUpPending=!0,c){e.reconnectAttempts=0,e.reconnectTimer=setTimeout(()=>{e.connect()},2e3);return}e.scheduleReconnect()},e.ws.onerror=l=>{}}function cl(e){if(e.reconnectAttempts>=e.maxReconnectAttempts){e.connectionState="disconnected";return}let t=Math.min(1e3*Math.pow(2,e.reconnectAttempts),3e4);e.reconnectAttempts++,e.connectionState="reconnecting",e.reconnectTimer=setTimeout(()=>{e.connect()},t)}function dl(e){e.reconnectAttempts=0,e.connect()}function ul(e){e.stopHeartbeat(),e._lastPongAt=Date.now(),e.heartbeatTimer=setInterval(()=>{if(e.ws&&e.ws.readyState===WebSocket.OPEN){if(Date.now()-e._lastPongAt>45e3){e.ws.close(4e3,"Heartbeat timeout");return}try{e.sendWsMessage({type:"ping"})}catch{}}},25e3)}function pl(e){e.heartbeatTimer&&(clearInterval(e.heartbeatTimer),e.heartbeatTimer=null)}function fl(e){e._visibilityHandlerInstalled||(e._visibilityHandlerInstalled=!0,document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible")if(!e.ws||e.ws.readyState!==WebSocket.OPEN)e.reconnectAttempts=0,e.connect();else try{e.sendWsMessage({type:"ping"});let t=e._lastPongAt;setTimeout(()=>{e._lastPongAt===t&&e.ws&&e.ws.close(4001,"Visibility resume timeout")},3e3)}catch{e.reconnectAttempts=0,e.connect()}}))}var en,Pg,$r=H(()=>{ct();Yn();Kt();en=[];Pg=new Set(["sync_messages","refresh_conversation","select_conversation","cancel_execution","update_conversation_settings","ask_user_answer"])});function Dg(e){return e?.type==="tool-use"}function Vr(e){return e?.type==="tool-summary"}function Fr(e){return Dg(e)&&!Rg.has(e.toolName)}function hl(e,t,s,n=s){let i=t==="history"&&(n?.dbMessageId||n?.id)||null;return{...i?{id:`tool_summary_${t}_${i}`,dbMessageId:n?.dbMessageId||null}:{},type:"tool-summary",count:e,omittedCount:e,source:t,isHistory:t!=="live",timestamp:s?.timestamp||s?.startTime||n?.timestamp||n?.startTime||null,sessionId:s?.sessionId??s?.groupId??null,turnId:s?.turnId||null,vpId:s?.vpId||null,speakerVpId:s?.speakerVpId||null}}function Eg(e,t){return!Vr(e)||!Vr(t)?!1:(e.turnId||null)===(t.turnId||null)&&(e.sessionId||null)===(t.sessionId||null)&&(e.speakerVpId||e.vpId||null)===(t.speakerVpId||t.vpId||null)&&(e.source||null)===(t.source||null)}function Lg(e,t){let s=(Number(e.count)||0)+(Number(t.count)||0);return e.count=s,e.omittedCount=s,!e.timestamp&&t.timestamp&&(e.timestamp=t.timestamp),Number(t.dbMessageId||0)>Number(e.dbMessageId||0)&&(e.dbMessageId=t.dbMessageId,t.id&&(e.id=t.id)),e}function gl(e){return[e?.sessionId||"",e?.turnId||"",e?.speakerVpId||e?.vpId||""].join("")}function ml(e,t,s,n,i=n){if(!t)return;let r=hl(t,s,n,i),o=e[e.length-1];Eg(o,r)?Lg(o,r):e.push(r)}function Hr(e=[]){let t=[],s=0,n=null,i=null;for(let r of e){if(Fr(r)&&r.isHistory){s+=1,n||(n=r),i=r;continue}ml(t,s,"history",n,i),s=0,n=null,i=null,t.push(r)}return ml(t,s,"history",n,i),t}function vl(e=[],t={}){let s=Number.isFinite(t.maxDetailed)?Math.max(1,t.maxDetailed):100;if(!Array.isArray(e)||e.length<=s)return e;let n=e.length;for(let f=e.length-1;f>=0;f-=1){let g=e[f];if(g?.type==="user"||g?.type==="system"||g?.type==="error")break;n=f}let i=e.slice(n),r=new Map;for(let f of i){if(!Fr(f)||f.isHistory)continue;let g=gl(f);r.set(g,(r.get(g)||0)+1)}let o=new Map;for(let[f,g]of r)g>s&&o.set(f,g-s);if(o.size===0)return e;let a=new Map,l=new Map,c=new Set,d=[],u=(f,g,v)=>{a.set(f,(a.get(f)||0)+g),!l.has(f)&&v&&l.set(f,v)},p=(f,g)=>{if(c.has(f))return;let v=a.get(f)||0;v<=0||(d.push(hl(v,"live",l.get(f)||g)),c.add(f))};for(let f of i){let g=gl(f);if(Vr(f)&&f.source==="live"&&o.has(g)){u(g,Number(f.count)||0,f);continue}if(Fr(f)&&!f.isHistory&&o.has(g)){let v=o.get(g)||0;if(v>0){o.set(g,v-1),u(g,1,f);continue}}p(g,f),d.push(f)}for(let f of a.keys())p(f,l.get(f));return e.splice(n,e.length-n,...d),e}var Rg,Or=H(()=>{Rg=new Set(["TodoWrite","AskUserQuestion"])});function qr(e,t){return t?t===e.yeaftConversationId?!0:Object.values(e.yeaftConversationIdsByAgent||{}).includes(t):!1}function sn(e,t,s){s&&(s.type!=="assistant"&&s.type!=="tool-use"||qr(e,t)&&(!s.vpId&&e._currentYeaftVpId&&(s.vpId=e._currentYeaftVpId),!s.turnId&&e._currentYeaftTurnId&&(s.turnId=e._currentYeaftTurnId),!s.speakerVpId&&s.vpId&&(s.speakerVpId=s.vpId)))}function Vg(e){let t=[e?.timestamp,e?.createdAt,e?.ts,e?.time,e?.created_at];for(let s of t){if(typeof s=="number"&&Number.isFinite(s)&&s>0)return s;if(typeof s=="string"&&s.trim()){let n=Date.parse(s);if(Number.isFinite(n))return n;let i=Number(s);if(Number.isFinite(i)&&i>0)return i}}return Date.now()}function Qn(e){let t=e?.messageId??e?.dbMessageId??e?.id;return t==null||t===""?null:String(t)}function Nr(e,t){if(!e||!t)return e;let s=e.type==="user"&&typeof e.id=="string"&&e.id===e.clientMessageId;for(let[n,i]of Object.entries(t))if(i!=null){if(n==="isStreaming"){e.isStreaming&&i===!1&&(e.isStreaming=!1);continue}if(n==="id"||n==="messageId"){if(s&&t.clientMessageId===e.clientMessageId&&t.messageId&&t.messageId!==e.clientMessageId)continue;(e[n]===void 0||e[n]===null||e[n]==="")&&(e[n]=i);continue}if(!(n==="turnId"&&s&&e.turnId===e.clientMessageId)){if(n==="content"&&typeof i=="string"){e.content||(e.content=i);continue}if(n==="responseKind"&&(i==="progress"||i==="result")){e.responseKind=i;continue}if(n==="attachments"&&Array.isArray(i)){(!Array.isArray(e.attachments)||e.attachments.length===0)&&(e.attachments=i);continue}(e[n]===void 0||e[n]===null||e[n]==="")&&(e[n]=i)}}return e}function nn(e=[],t=[]){let s=[],n=new Map,i=new Map;for(let r of[...e,...t]){if(!r)continue;let o=Qn(r),a=r.type==="user"&&r.clientMessageId?String(r.clientMessageId):null;if(o&&n.has(o)){Nr(n.get(o),r);continue}if(a&&i.has(a)){let l=i.get(a);Nr(l,r),o&&!n.has(o)&&n.set(o,l);continue}s.push(r),o&&n.set(o,r),a&&i.set(a,r)}return s}function yl(e,t,s){return!e||e!==t?!1:!s?.loaded&&!s?.loading}function bl(e,t){return!!t&&!!e?.loaded&&!e?.loading&&Number.isFinite(e?.latestSeq)}function Br({sessionState:e,hasCachedSessionRows:t,force:s=!1}={}){return e?.loading?!1:s?!e?.loaded:e?.loaded?!1:!t}function Fg(e,t,s,n){let i=s?.id?String(s.id):null;if(!i)return!1;let o=(e.messagesMap[t]||[]).find(a=>a?.type==="assistant"&&Qn(a)===i);return o?(o.id||(o.id=i),o.messageId||(o.messageId=i),s.ts&&!o.ts&&(o.ts=s.ts),s.timestamp&&!o.timestamp&&(o.timestamp=s.timestamp),s.sessionId&&!o.sessionId&&(o.sessionId=s.sessionId),s.vpId&&!o.vpId&&(o.vpId=s.vpId),s.turnId&&!o.turnId&&(o.turnId=s.turnId),s.threadId&&!o.threadId&&(o.threadId=s.threadId),o.content?typeof o.content=="string"&&(n.startsWith(o.content)?o.content=n:o.content.endsWith(n)||(o.content+=n)):o.content=n,sn(e,t,o),!0):!1}function Xn(e,t,s){if(!t)return;let n={...s,id:s.dbMessageId||s.id||Date.now().toString()+Math.random().toString(36).substr(2,9),timestamp:Vg(s)};qr(e,t)&&!n.sessionId&&(n.sessionId=e._currentYeaftSessionId||e.yeaftActiveSessionFilter||$g),qr(e,t)&&(!n.vpId&&e._currentYeaftVpId&&(n.vpId=e._currentYeaftVpId),!n.turnId&&e._currentYeaftTurnId&&(n.turnId=e._currentYeaftTurnId),sn(e,t,n)),e.messagesMap[t]||(e.messagesMap[t]=[]);let i=Qn(s);if(i){let r=e.messagesMap[t].find(o=>Qn(o)===i);if(r)return Nr(r,n),t===e.yeaftConversationId&&e.messagesMap[t].sort((o,a)=>o.timestamp-a.timestamp),r}return e.messagesMap[t].push(n),vl(e.messagesMap[t]),t===e.yeaftConversationId&&e.messagesMap[t].sort((r,o)=>r.timestamp-o.timestamp),n}function wl(e,t,s,n={}){if(!t||!s)return;e.messagesMap[t]||(e.messagesMap[t]=[]);let i=e.messagesMap[t];if(Fg(e,t,n,s))return;let r=e._currentYeaftTurnId;if(r){for(let a=i.length-1;a>=0;a--)if(i[a].turnId===r&&i[a].type==="assistant"&&i[a].isStreaming){if(sn(e,t,i[a]),n.id&&!i[a].id&&(i[a].id=n.id),n.id&&!i[a].messageId&&(i[a].messageId=n.id),i[a].content.endsWith(s))return;i[a].content+=s;return}Xn(e,t,{...n.id?{id:n.id,messageId:n.id}:{},...n.ts?{ts:n.ts}:{},...n.timestamp?{timestamp:n.timestamp}:{},...n.sessionId?{sessionId:n.sessionId}:{},...n.vpId?{vpId:n.vpId}:{},...n.turnId?{turnId:n.turnId}:{},...n.threadId?{threadId:n.threadId}:{},type:"assistant",content:s,isStreaming:!0,status:"pending",turnStartAt:n.timestamp||Date.now()});return}let o=i[i.length-1];if(o&&o.type==="assistant"&&o.isStreaming){if(sn(e,t,o),n.id&&!o.id&&(o.id=n.id),n.id&&!o.messageId&&(o.messageId=n.id),o.content.endsWith(s))return;o.content+=s}else Xn(e,t,{...n.id?{id:n.id,messageId:n.id}:{},...n.ts?{ts:n.ts}:{},...n.timestamp?{timestamp:n.timestamp}:{},...n.sessionId?{sessionId:n.sessionId}:{},...n.vpId?{vpId:n.vpId}:{},...n.turnId?{turnId:n.turnId}:{},...n.threadId?{threadId:n.threadId}:{},type:"assistant",content:s,isStreaming:!0,status:"pending",turnStartAt:n.timestamp||Date.now()})}function kl(e,t,{completeLifecycle:s=!0}={}){if(!t)return;let n=e.messagesMap[t];if(!n||n.length===0)return;let i=e._currentYeaftTurnId||null;for(let r=n.length-1;r>=0;r--){let o=n[r];if(i&&o.turnId&&o.turnId!==i){if(o.type==="user")break;continue}if(o.isStreaming&&(o.isStreaming=!1,s&&o.status==="pending"&&(o.status="completed",o.turnEndAt=Date.now())),sn(e,t,o),o.type==="user")break}}function Sl(e,t){if(!t||e.processingConversations&&e.processingConversations[t]||e.activeVpTurns&&Object.keys(e.activeVpTurns).length>0)return;let s=e.messagesMap&&e.messagesMap[t];if(!(!s||s.length===0))for(let n of s)n&&n.isStreaming&&(n.isStreaming=!1)}function Cl(e,t){let s=e.currentConversation;if(!s)return;e.messagesMap[s]||(e.messagesMap[s]=[]);let n=e.messagesMap[s],i=null;for(let r of t)if(r.type==="user"){let o=r.message?.content;if(o){let a=typeof o=="string"?o:Array.isArray(o)?o.map(l=>l.text||"").join(""):"";a&&(i=a,e.addMessage({type:"user",content:a,isHistory:!0}))}}else if(r.type==="assistant"){let o=r.message?.content;if(o&&Array.isArray(o)){for(let a of o)if(a.type==="text"&&a.text)e.addMessage({type:"assistant",content:a.text,isHistory:!0});else if(a.type==="tool_use")e.addMessage({type:"tool-use",toolName:a.name,toolInput:a.input,isHistory:!0});else if(a.type==="tool_result"){for(let l=n.length-1;l>=0;l--)if(n[l].type==="tool-use"&&!n[l].hasResult){n[l].hasResult=!0,n[l].toolResult=a.content;break}}}}if(i&&s&&!e.conversationTitles[s]){let r=i.trim().substring(0,100);e.conversationTitles[s]=r}}function Yt(e){if(!Array.isArray(e))return null;let t=null;for(let s of e)typeof s?.dbMessageId=="number"&&s.dbMessageId>0&&(t===null||s.dbMessageId>t)&&(t=s.dbMessageId);return t}function Il(e){return{id:e.id,dbMessageId:e.id,timestamp:e.created_at}}function Al(e){return e?e.message_type==="tool_use"&&!Hg.has(e.tool_name)?{...Il(e),type:"tool-use",toolName:e.tool_name||"unknown",hasResult:!0,isHistory:!0,startTime:e.created_at||0}:Wr(e):null}function Wr(e){if(!e)return null;let t=Il(e);if(e.message_type==="tool_use"){let n={...t,type:"tool-use",toolName:e.tool_name||"unknown",toolInput:(()=>{try{return JSON.parse(e.tool_input||e.content||"{}")}catch{return{}}})(),hasResult:!0,isHistory:!0,startTime:e.created_at||0};if(e.metadata)try{let i=JSON.parse(e.metadata);i.askRequestId&&(n.askRequestId=i.askRequestId,n.askQuestions=i.askQuestions,n.askAnswered=!!i.askAnswered,n.selectedAnswers=i.selectedAnswers||null,i.askAnswered||(n.isHistory=!1))}catch{}return n}let s=n=>{if(!n)return"";if(typeof n!="string")return String(n);if(n.startsWith("["))try{let i=JSON.parse(n);if(Array.isArray(i))return i.filter(r=>r.type==="text"&&r.text).map(r=>r.text).join("")}catch{}return n};if(e.role==="user"){let n=null;if(e.metadata)try{let i=JSON.parse(e.metadata);i&&typeof i.clientMessageId=="string"&&(n=i.clientMessageId)}catch{}return{...t,type:"user",content:typeof e.content=="string"?e.content:String(e.content||""),...n?{clientMessageId:n}:{}}}else if(e.role==="assistant"){let n=s(e.content),i=(()=>{if(!e.content||typeof e.content!="string"||!e.content.startsWith("["))return[];try{let r=JSON.parse(e.content);return Array.isArray(r)?r.filter(o=>o.type==="tool_use"&&o.name):[]}catch{return[]}})();if(!n&&i.length===0)return null;if(i.length>0){let r=[];n&&r.push({...t,type:"assistant",content:n});for(let o=0;o<i.length;o++){let a=i[o];r.push({id:e.id+"_tool_"+o,dbMessageId:e.id,timestamp:e.created_at,type:"tool-use",toolName:a.name,toolInput:a.input||{},hasResult:!0,isHistory:!0,startTime:e.created_at||0})}return r}return{...t,type:"assistant",content:n}}else if(e.role==="tool"||e.message_type==="tool_result")return{...t,type:"tool_result",tool:e.tool_name||"unknown",content:typeof e.content=="string"?e.content:String(e.content||"")};return null}var $g,Hg,rn=H(()=>{Or();$g="grp_default";Hg=new Set(["TodoWrite","AskUserQuestion"])});function jt(e,t){return e._closedAt?.[t]?Date.now()-e._closedAt[t]<3e4:!1}function Cs(e,t){Ae(e,t),e._processingWatchdogs||(e._processingWatchdogs={});let s=()=>{if(!e.processingConversations[t])return;let i=e.conversations.find(o=>o.id===t);e.sendWsMessage({type:"ping_session",conversationId:t,agentId:i?.agentId});let r=setTimeout(()=>{e.processingConversations[t]&&(e.sessionHealth||(e.sessionHealth={}),e.sessionHealth[t]={status:"agent-offline"})},1e4);e._pongTimeouts||(e._pongTimeouts={}),e._pongTimeouts[t]=r},n=setTimeout(()=>{e.processingConversations[t]&&(s(),e._processingWatchdogs[t]=setInterval(()=>{if(!e.processingConversations[t]){Ae(e,t);return}s()},3e4))},45e3);e._processingWatchdogs[t]=n}function Zn(e,t){e.processingConversations[t]&&e._processingWatchdogs?.[t]&&(e._pongTimeouts?.[t]&&(clearTimeout(e._pongTimeouts[t]),delete e._pongTimeouts[t]),e.sessionHealth?.[t]&&delete e.sessionHealth[t],e._yeaftWatchdogConvs?.has(t)?Jn(e,t):Cs(e,t))}function Ae(e,t){e._processingWatchdogs?.[t]&&(clearTimeout(e._processingWatchdogs[t]),clearInterval(e._processingWatchdogs[t]),delete e._processingWatchdogs[t]),e._pongTimeouts?.[t]&&(clearTimeout(e._pongTimeouts[t]),delete e._pongTimeouts[t]),e.sessionHealth?.[t]&&delete e.sessionHealth[t],e._autoRefreshed?.[t]&&delete e._autoRefreshed[t],e._yeaftWatchdogConvs?.delete(t)}function xl(e,t){Ae(e,t),e._processingWatchdogs||(e._processingWatchdogs={}),e._processingWatchdogs[t]=setTimeout(()=>{if(e.processingConversations[t]){let s=e.conversations.find(n=>n.id===t);e.sendWsMessage({type:"refresh_conversation",conversationId:t,agentId:s?.agentId}),e._processingWatchdogs[t]=setTimeout(()=>{if(e.processingConversations[t]){delete e.processingConversations[t];let n=e.executionStatusMap[t];n&&(n.currentTool=null),e.finishStreamingForConversation(t)}delete e._processingWatchdogs[t]},1e4)}},9e4)}function Jn(e,t){Ae(e,t),e._processingWatchdogs||(e._processingWatchdogs={}),e._yeaftWatchdogConvs||(e._yeaftWatchdogConvs=new Set),e._yeaftWatchdogConvs.add(t),e._processingWatchdogs[t]=setTimeout(()=>{if(e.processingConversations[t]){delete e.processingConversations[t];let s=e.executionStatusMap[t];s&&(s.currentTool=null),e.finishStreamingForConversation(t)}delete e._processingWatchdogs[t]},15e4)}var Gt=H(()=>{});function ei(e,t){return!e||!t||e.type!=="user"||t.type!=="user"?!1:e.clientMessageId&&t.clientMessageId?e.clientMessageId===t.clientMessageId:e.clientMessageId||t.clientMessageId?!1:e.content===t.content}var Ur=H(()=>{});function zr(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Ng(){return Date.now()}function Bg(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`pt_${crypto.randomUUID()}`:`pt_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`}function Wg(e,t=160){return typeof e!="string"?e:e.length>t?`${e.slice(0,t)}...[truncated]`:e}function Ug(e){if(!e||typeof e!="object")return e||null;let t={};for(let[s,n]of Object.entries(e))s==="text"||s==="prompt"||s==="content"||s==="data"||(t[s]=typeof n=="string"?Wg(n):n);return t}function on(){return Bg()}function Xe(e,t={}){!e||!t.traceId||(Array.isArray(e._perfTraceQueue)||(e._perfTraceQueue=[]),e._perfTraceQueue.push({traceId:t.traceId,source:"web",phase:t.phase||"unknown",at:Ng(),monotonicMs:zr(),durationMs:Number.isFinite(t.durationMs)?t.durationMs:null,agentId:t.agentId||null,sessionId:t.sessionId||null,vpId:t.vpId||null,turnId:t.turnId||null,threadId:t.threadId||null,messageType:t.messageType||null,bytes:Number.isFinite(t.bytes)?t.bytes:null,ok:typeof t.ok=="boolean"?t.ok:null,detail:Ug(t.detail)}),e._perfTraceQueue.length>200&&e._perfTraceQueue.splice(0,e._perfTraceQueue.length-200),zg(e))}function zg(e){!e||e._perfTraceFlushTimer||(e._perfTraceFlushTimer=setTimeout(()=>Kg(e),250))}function Kg(e){if(!e||!Array.isArray(e._perfTraceQueue)||e._perfTraceQueue.length===0){e&&(e._perfTraceFlushTimer=null);return}let t=e._perfTraceQueue.splice(0,e._perfTraceQueue.length);e._perfTraceFlushTimer=null,typeof e.sendWsMessage=="function"&&e.sendWsMessage({type:"perf_trace_events",events:t})}function ti(e,t={}){if(typeof requestAnimationFrame!="function")return;let s=zr();requestAnimationFrame(()=>{requestAnimationFrame(()=>{Xe(e,{...t,phase:t.phase||"render.next_paint",durationMs:zr()-s})})})}var Kr=H(()=>{});function Le(e,t){let s=t==null?"__all__":String(t);return e?`${e}${s}`:s}var si=H(()=>{});function Tl(e){return typeof e=="string"&&e?e:null}function Is(e,t){return e?.yeaftSessionHistoryState?.[t]||null}function an(e){let t=e?.yeaftActiveSessionFilter||null;if(!t)try{t=(typeof window<"u"&&window.Pinia?.useSessionsStore?.())?.activeSessionId||null}catch{}if(!t)return{agentId:e?.currentAgent||null,sessionId:null,sessionKey:""};let s=typeof e?.resolveYeaftSessionAgentId=="function"?e.resolveYeaftSessionAgentId(t):e?.currentAgent||null;return{agentId:s,sessionId:t,sessionKey:Le(s,t)}}function Pl(e,{agentId:t,sessionId:s,mode:n="recent",preserveLoaded:i=!1,latestSeq:r=null}={}){if(!t||!s)return null;let o=Le(t,s),a=Is(e,o)||{},l=Number(a.generation||0)+1,c=`yeaft_history_${l}_${crypto.randomUUID()}`,d={...a,loaded:i?!!a.loaded:!1,loading:!0,error:null,requestId:c,generation:l,mode:n,requestedAt:Date.now(),latestSeq:Number.isFinite(r)?r:a.latestSeq??null};return i||(d.hasMore=!1,d.oldestSeq=null,d.count=0,d.syncingAfterSeq=null),e.yeaftSessionHistoryState={...e.yeaftSessionHistoryState||{},[o]:d},ln(e),{sessionKey:o,requestId:c,generation:l,state:d}}function Yr(e,t={}){let s=t.sessionId??t.groupId??null;if(!s)return!1;let n=t.agentId||e?.yeaftSessionAgentById?.[s]||null,i=Le(n,s),r=Is(e,i),o=Tl(t.requestId);if(!r)return o===null;let a=Tl(r.requestId);return o?o===a:a===null}function _l(e,t={},s={}){if(!Yr(e,t))return null;let n=t.sessionId??t.groupId??null,i=t.agentId||e?.yeaftSessionAgentById?.[n]||null,r=Le(i,n),a={...Is(e,r)||{},...s,loading:!1,error:null,requestId:null,completedAt:Date.now()};return e.yeaftSessionHistoryState={...e.yeaftSessionHistoryState||{},[r]:a},ln(e),a}function Rl(e,{agentId:t,sessionId:s,requestId:n,error:i="history_load_failed"}={}){if(!t||!s||!n)return!1;let r=Le(t,s),o=Is(e,r);return!o||o.requestId!==n||!o.loading?!1:(e.yeaftSessionHistoryState={...e.yeaftSessionHistoryState||{},[r]:{...o,loading:!1,error:i,requestId:null,completedAt:Date.now()}},ln(e),!0)}function ln(e){let{sessionKey:t}=an(e),s=t?Is(e,t):null;return e.yeaftLoadingMoreHistory=!!s?.loading,e.yeaftHistoryLoadError=s?.error||null,e.yeaftHasMoreHistory=!!s?.hasMore,e.yeaftOldestLoadedSeq=Number.isFinite(s?.oldestSeq)?s.oldestSeq:null,s}function jr(e){let{sessionKey:t}=an(e);return t?Is(e,t):null}var Ml,Gr=H(()=>{si();Ml=15e3});function $l(e){return e.filter(t=>!(t.type==="user"&&(!t.content||!t.content.trim())))}function Dl(e){let t=[e?.timestamp,e?.createdAt,e?.ts,e?.time,e?.created_at];for(let s of t){if(typeof s=="number"&&Number.isFinite(s)&&s>0)return s;if(typeof s=="string"&&s.trim()){let n=Date.parse(s);if(Number.isFinite(n))return n;let i=Number(s);if(Number.isFinite(i)&&i>0)return i}}return null}function Yg(e){if(!Array.isArray(e))return null;for(let t=e.length-1;t>=0;t-=1){let s=e[t];if(s?.name==="TodoWrite"&&Array.isArray(s?.input?.todos))return s.input.todos}return null}function jg(e){return Array.isArray(e?.toolCalls)?e.toolCalls.filter(t=>t?.name!=="TodoWrite").length:Number(e?.toolSummaryCount||0)||0}function Gg(e){if(!e||typeof window>"u")return null;try{let t=window.Pinia||null,s=t&&typeof t.useSessionsStore=="function"?t.useSessionsStore():null;if(!s)return null;let n=typeof t.useChatStore=="function"?t.useChatStore():null,i=typeof s.sessionById=="function"?s.sessionById(e,n?.currentAgent||null):s.sessions&&s.sessions[e];return(i&&typeof i.defaultVpId=="string"?i.defaultVpId.trim():"")||null}catch{return null}}function Qg(e,t){return e.speakerVpId||e.vpId||e.vp_id||e.authorVpId||e.authorVP||Gg(t)}function ni(e){return e&&(e.messageId||e.id)?e.messageId||e.id:null}function Vl(e){e.sort((t,s)=>(t.timestamp||0)-(s.timestamp||0))}function Xg(e,t){if(!e||!t||e.type!=="assistant"||t.type!=="assistant"||(e.sessionId??null)!==(t.sessionId??null))return!1;let s=e.speakerVpId||e.vpId||"",n=t.speakerVpId||t.vpId||"";if(s&&n&&s!==n)return!1;let i=e.threadId||"",r=t.threadId||"";if(i&&r&&i!==r||!(e.isStreaming||e.isHistory!==!0)||t._hasPersistedTurnId!==!0)return!1;let a=e.turnId||"",l=t.turnId||"";if(!a||!l||a!==l)return!1;let c=typeof e.content=="string"?e.content:"",d=typeof t.content=="string"?t.content:"";return!!c&&!!d&&(d.startsWith(c)||c.startsWith(d))}function Qr(e,t){let s=new Map,n=new Map;e.forEach((r,o)=>{let a=ni(r);a&&s.set(a,o),r?.type==="user"&&r.clientMessageId&&n.set(r.clientMessageId,o)});let i=0;for(let r of t){let o=ni(r),a=o&&s.has(o)?s.get(o):null;if(a===null&&r?.type==="user"&&r.clientMessageId&&n.has(r.clientMessageId)&&(a=n.get(r.clientMessageId)),a===null&&r?.type==="assistant"&&(a=e.findIndex(l=>Xg(l,r))),a!==null&&a>=0){let l=ni(e[a]);e[a]={...e[a],...r},o&&s.set(o,a),l&&l!==o&&s.get(l)===a&&s.delete(l),r?.type==="user"&&r.clientMessageId&&n.set(r.clientMessageId,a)}else o&&s.set(o,e.length),r?.type==="user"&&r.clientMessageId&&n.set(r.clientMessageId,e.length),e.push(r),i+=1}return Vl(e),i}function Xr(e){return e?e.sessionId??e.groupId??null:null}function Zg(e){return!e||e.type!=="user"||!e.clientMessageId?!1:ni(e)===e.clientMessageId}function Jg(e,t,s){let n=t.reduce((r,o)=>Math.max(r,o?.timestamp||0),0),i=e.filter(r=>r?s!=null&&Xr(r)!==s||r.isStreaming||r.type==="tool-use"&&r.toolName==="AskUserQuestion"&&(r.askAnswered||r.askPending||r.askExpired)||Zg(r)?!0:n>0&&(r.timestamp||0)>n:!1);return e.splice(0,e.length,...i),Qr(e,t),t.length}function em(e){if(typeof e!="string")return!1;let t=e.trimStart();return t.startsWith("<task-result ")||/^\[system note\] You have called \S+ with the same arguments \d+ times\./.test(t)}function tm(e,t){let s=typeof e.yeaftConversationId=="string"?e.yeaftConversationId:"";return s.startsWith(`yeaft-local-${t}-`)||/^yeaft-local-\d/.test(s)?s:null}function sm(e,t,s,n){let i=t.agentId||s&&e.yeaftSessionAgentById?.[s]||null;if(!i||!n||e.currentView!=="yeaft")return;let r=an(e);if(r.sessionId!==(s||null)||r.agentId&&r.agentId!==i)return;if((e.yeaftConversationId||null)===n){e.messagesMap[n]||(e.messagesMap[n]=[]),e.yeaftConversationIdsByAgent={...e.yeaftConversationIdsByAgent||{},[i]:n},e.activeConversations=[n];return}let a=tm(e,i);if(!a)return;let l=e.messagesMap[a]||[],c=e.messagesMap[n]||[];e.messagesMap[n]=nn(c,l),Vl(e.messagesMap[n]),delete e.messagesMap[a],e.processingConversations?.[a]&&(e.processingConversations[n]=!0,delete e.processingConversations[a]),e.executionStatusMap?.[a]&&(e.executionStatusMap[n]=e.executionStatusMap[a],delete e.executionStatusMap[a]),e.yeaftConversationIdsByAgent={...e.yeaftConversationIdsByAgent||{},[i]:n},e.yeaftConversationId=n,e.activeConversations=[n]}function Ft(e,t){let s=e.messagesMap[t]||[];for(let n of s)n.type==="tool-use"&&!n.hasResult&&(n.hasResult=!0,n.toolName==="AskUserQuestion"&&!n.askAnswered&&!n.selectedAnswers&&(n.isHistory=!0,n.askRequestId=null))}function Fl(e,t){gt(e);let s=e.agents.find(i=>i.id===t.agentId);e.conversations=e.conversations.filter(i=>i.id!==t.conversationId);let n=t.provider||"claude-code";if(e.conversations.push({id:t.conversationId,agentId:t.agentId,agentName:s?.name||t.agentId,workDir:t.workDir,claudeSessionId:null,createdAt:Date.now(),processing:!1,connecting:n!=="claude-code",type:"chat",provider:n,capabilities:t.capabilities||null,disallowedTools:t.disallowedTools??null}),e.currentAgent=t.agentId,e.currentAgentInfo=s,e.panels.length>1){let i=e._pendingPaneId;if(e._pendingPaneId=null,i){let r=e.panels.find(o=>o.id===i);r&&(r.conversationId=t.conversationId)}else{let r=e.panels.find(o=>!o.conversationId);r&&(r.conversationId=t.conversationId)}e.activeConversations.includes(t.conversationId)||e.activeConversations.push(t.conversationId)}else e.activeConversations=[t.conversationId];e.currentWorkDir=t.workDir,e.messagesMap[t.conversationId]=[],e.sendWsMessage({type:"select_conversation",conversationId:t.conversationId}),e.addMessage({type:"system",content:Pe("store.convCreated",{agent:s?.name||t.agentId,workDir:t.workDir})}),e.saveOpenSessions()}function Hl(e,t){gt(e);let s=e.agents.find(n=>n.id===t.agentId);if(e.conversations=e.conversations.filter(n=>n.id!==t.conversationId&&!(n.claudeSessionId&&n.claudeSessionId===t.claudeSessionId)),e.conversations.push({id:t.conversationId,agentId:t.agentId,agentName:s?.name||t.agentId,workDir:t.workDir,claudeSessionId:t.claudeSessionId,createdAt:Date.now(),processing:!1,connecting:(t.provider||"claude-code")!=="claude-code",type:"chat",provider:t.provider||"claude-code",capabilities:t.capabilities||null,disallowedTools:t.disallowedTools??null}),e.currentAgent=t.agentId,e.currentAgentInfo=s,e.panels.length>1){let n=e._pendingPaneId;if(e._pendingPaneId=null,n){let i=e.panels.find(r=>r.id===n);i&&(i.conversationId=t.conversationId)}else{let i=e.panels.find(r=>!r.conversationId);i&&(i.conversationId=t.conversationId)}e.activeConversations.includes(t.conversationId)||e.activeConversations.push(t.conversationId)}else e.activeConversations=[t.conversationId];if(e.currentWorkDir=t.workDir,e.messagesMap[t.conversationId]=[],e._pendingSessionTitle&&(e.conversationTitles[t.conversationId]=e._pendingSessionTitle,e._pendingSessionTitle=null),e.sendWsMessage({type:"select_conversation",conversationId:t.conversationId}),e.addMessage({type:"system",content:Pe("store.convResumed",{agent:s?.name||t.agentId,sessionId:t.claudeSessionId?t.claudeSessionId.slice(0,8)+"...":""})}),t.dbMessages&&t.dbMessages.length>0){let n=$l(t.dbMessages.map(o=>e.formatDbMessageForHistoryHydration(o)).flat().filter(Boolean)),i=Hr(n),r=e.messagesMap[t.conversationId]||[];for(let o of i)r.push(o)}e.hasMoreMessages=!!t.hasMoreMessages,e.chatSessionState[t.conversationId]={lastSeenDbId:Yt(e.messagesMap[t.conversationId]),hasMoreOlder:!!t.hasMoreMessages},e.saveOpenSessions()}function Zr(e,t){e.conversations=e.conversations.filter(n=>n.id!==t.conversationId),delete e.messagesMap[t.conversationId],delete e.chatSessionState[t.conversationId],delete e.conversationTitles[t.conversationId],delete e.customConversationTitles[t.conversationId],delete e.processingConversations[t.conversationId],e._closedAt&&delete e._closedAt[t.conversationId],Ae(e,t.conversationId),delete e.executionStatusMap[t.conversationId],delete e.subagents[t.conversationId],window.dispatchEvent(new CustomEvent("conversation-deleted",{detail:{conversationId:t.conversationId}}));let s=e.activeConversations.indexOf(t.conversationId);s>=0&&(e.activeConversations.splice(s,1),e.activeConversations.length===0&&e.addMessage({type:"system",content:Pe("chat.session.closed")}));for(let n of e.panels)n.conversationId===t.conversationId&&(n.conversationId=null);e.saveOpenSessions()}function Ol(e,t){let s=t.conversationId;if(s){delete e.processingConversations[s],Ae(e,s),e._closedAt||(e._closedAt={}),e._closedAt[s]=Date.now(),e._turnCompletedConvs||(e._turnCompletedConvs=new Set),e._turnCompletedConvs.add(s);let n=e.executionStatusMap[s];n&&(n.currentTool=null),e.finishStreamingForConversation(s),Ft(e,s);let i=e.conversations.find(r=>r.id===s);i&&(t.claudeSessionId&&(i.claudeSessionId=t.claudeSessionId),t.workDir&&(i.workDir=t.workDir)),e.clearStatus?.conversationId===s&&e.clearStatus?.status==="clearing"&&(e.clearStatus={conversationId:s,status:"completed"},setTimeout(()=>{e.clearStatus?.conversationId===s&&e.clearStatus?.status==="completed"&&(e.clearStatus=null)},3e3)),e.saveOpenSessions()}}function ql(e,t){let s=t.conversationId;if(s){delete e.processingConversations[s],Ae(e,s),e._closedAt||(e._closedAt={}),e._closedAt[s]=Date.now(),e._turnCompletedConvs||(e._turnCompletedConvs=new Set),e._turnCompletedConvs.add(s);let n=e.executionStatusMap[s];n&&(n.currentTool=null),e.finishStreamingForConversation(s),Ft(e,s);let i=e.conversations.find(r=>r.id===s);i&&(t.claudeSessionId&&(i.claudeSessionId=t.claudeSessionId),t.workDir&&(i.workDir=t.workDir)),e.saveOpenSessions()}}function Nl(e,t){if(t.conversationId){if(t.isProcessing&&!jt(e,t.conversationId)&&!e._turnCompletedConvs?.has(t.conversationId))e.processingConversations[t.conversationId]=!0;else if(e.processingConversations[t.conversationId]){delete e.processingConversations[t.conversationId],Ae(e,t.conversationId);let s=e.executionStatusMap[t.conversationId];s&&(s.currentTool=null),e.finishStreamingForConversation(t.conversationId)}}}function Bl(e,t){let s=t.conversationId||e.currentConversation;if(s){delete e.processingConversations[s],Ae(e,s),e._closedAt||(e._closedAt={}),e._closedAt[s]=Date.now(),e._turnCompletedConvs||(e._turnCompletedConvs=new Set),e._turnCompletedConvs.add(s);let n=e.executionStatusMap[s];n&&(n.currentTool=null),e.finishStreamingForConversation(s),Ft(e,s)}}function Wl(e,t){if(!!t.requestId){if(e.chatHistoryRequestIdSupported=!0,!e.isCurrentChatHistoryResponse?.(t))return!1}else{let r=`chat:${t.conversationId}`,o=e.chatHistoryRequests?.[r];if(e.chatHistoryRequestIdSupported===!0||!o?.loading)return!1;t={...t,requestId:o.requestId,catalogKey:r,mode:o.mode||t.mode,...o.mode==="delta"?{afterMessageId:o.cursor}:{}}}e.messagesMap[t.conversationId]||(e.messagesMap[t.conversationId]=[]);let n=e.messagesMap[t.conversationId],i=t.mode==="delta"||typeof t.afterMessageId=="number"&&t.afterMessageId>0;if(t.conversationId&&e.activeConversations.includes(t.conversationId)){let r=Hr($l((t.messages||[]).map(a=>e.formatDbMessageForHistoryHydration(a)).flat().filter(Boolean)));if(r.length>0){let a=n.find(l=>l.dbMessageId);if(a&&r[0].dbMessageId&&r[r.length-1].dbMessageId<a.dbMessageId){let l=n.indexOf(a);e.debug,n.splice(l,0,...r)}else{e.debug;for(let l of r)if(!(l.dbMessageId&&n.some(c=>c.dbMessageId===l.dbMessageId))){if(l.dbMessageId&&(l.type==="assistant"||l.type==="user")){let c=null;if(l.type==="user"?c=n.find(d=>!d.dbMessageId&&!d.isStreaming&&ei(d,l)):c=n.find(d=>!d.dbMessageId&&!d.isStreaming&&d.type==="assistant"&&d.content===l.content),c){c.dbMessageId=l.dbMessageId,c.id=l.id,l.timestamp&&(c.timestamp=l.timestamp),l.clientMessageId&&!c.clientMessageId&&(c.clientMessageId=l.clientMessageId);continue}}n.push(l)}}}i||(e.hasMoreMessages=t.hasMore??!1),gt(e);let o=e.chatSessionState[t.conversationId]?.hasMoreOlder;e.chatSessionState[t.conversationId]={lastSeenDbId:Yt(e.messagesMap[t.conversationId]),hasMoreOlder:i?!!o:!!t.hasMore}}return e.finishChatHistoryRequest?.(t)&&(e.currentConversation===t.conversationId&&(e.loadingMoreMessages=!1),e.setRefreshingSession(t.conversationId,!1)),!0}function Ul(e,t){let s=t.sessionId??null,n=t.agentId||s&&e.yeaftSessionAgentById?.[s]||null,i=t.conversationId||n&&e.yeaftConversationIdsByAgent?.[n]||e.yeaftConversationId;if(!i||!s||!Array.isArray(t.messages))return null;e.messagesMap[i]||(e.messagesMap[i]=[]);let{formatted:r}=zl(t.messages,s,"window",e.messagesMap[i]);return Qr(e.messagesMap[i],r),i}function El(e){return e?.toolId?[Xr(e)??"",e.vpId||e.speakerVpId||"",e.turnId||"",e.threadId||"main",e.toolId].join("\0"):null}function Ll(e,t,s){return e.toolName="AskUserQuestion",e.toolId=t.toolCallId,e.toolInput={questions:s},e.askQuestions=s,e.askRequestId=null,e.askPending=!1,e.pendingAnswers=null,e.askSubmitGeneration=null,e.hasResult=!0,e.isHistory=!0,t.status==="answered"?(e.askAnswered=!0,e.selectedAnswers=t.answers,e.askExpired=!1):(e.askAnswered=!1,e.selectedAnswers=null,e.askExpired=!0),e}function nm(e,t){return(e||[]).find(s=>s?.type==="tool-use"&&(s.toolName==="AskUser"||s.toolName==="AskUserQuestion")&&s.toolId===t.toolCallId&&Xr(s)===t.sessionId&&(s.vpId||s.speakerVpId||"")===(t.vpId||"")&&(s.turnId||"")===(t.turnId||"")&&(s.threadId||"main")===(t.threadId||"main"))||null}function zl(e,t,s,n){let i=new Set((n||[]).map(l=>l&&(l.messageId||l.id)).filter(Boolean)),r=new Set,o=[],a=0;for(let l of e){if(!l||l._reflection||l.internal||l.systemOnly||l.systemOnlyMessage||em(l.content))continue;let c=l.id||l.messageId||null,d=l.clientMessageId||null;if(!(c&&r.has(c))&&!(c&&s!=="recent"&&i.has(c))){if(c&&r.add(c),l.role==="user"){a+=1;let u=c||l.messageId||l.turnId||null,p=l.sessionId??l.groupId??t??null;o.push({...c?{id:c,messageId:c}:{},type:"user",content:l.content,timestamp:Dl(l),sessionId:p,turnId:l.turnId||u,...d?{clientMessageId:d}:{},...Array.isArray(l.attachments)&&l.attachments.length>0?{attachments:l.attachments}:{},...l.quote?{quote:l.quote}:{},isStreaming:!1})}else if(l.role==="assistant"){a+=1;let u=c||l.messageId||l.turnId||null,p=l.sessionId??l.groupId??t??null,f=Qg(l,p),g=Dl(l),v=!!l.turnId,m=l.turnId||u,A=typeof l.content=="string"?l.content:l.content||"",w=Array.isArray(l.todos)?l.todos:Yg(l.toolCalls);(typeof A!="string"||A.trim())&&o.push({...c?{id:c,messageId:c}:{},type:"assistant",content:A,timestamp:g,sessionId:p,turnId:m,_hasPersistedTurnId:v,...f?{vpId:f,speakerVpId:f}:{},...l.responseKind==="progress"||l.responseKind==="result"?{responseKind:l.responseKind}:{},...l.incomplete===!0?{incomplete:!0}:{},...typeof l.stopReason=="string"&&l.stopReason?{stopReason:l.stopReason}:{},isStreaming:!1,isHistory:!0}),Array.isArray(w)&&w.length>0&&o.push({...c?{id:`${c}:todos`,messageId:`${c}:todos`}:{},type:"tool-use",toolName:"TodoWrite",toolInput:{todos:w},timestamp:g,sessionId:p,turnId:m,...f?{vpId:f,speakerVpId:f}:{},isStreaming:!1,isHistory:!0,hasResult:!0});for(let y of Array.isArray(l.images)?l.images:[])y?.assetId&&o.push({id:`${c||u||m}:image:${y.assetId}`,messageId:`${c||u||m}:image:${y.assetId}`,type:"chat-image",...y,timestamp:g,sessionId:p,turnId:m,...f?{vpId:f,speakerVpId:f}:{},isStreaming:!1,isHistory:!0});for(let y of Array.isArray(l.askUserResults)?l.askUserResults:[]){if(!y?.toolCallId||y.status!=="answered"&&y.status!=="expired")continue;let h=[{question:typeof y.question=="string"?y.question:"",options:(Array.isArray(y.options)?y.options:[]).filter($=>typeof $=="string").map($=>({label:$,description:""})),multiSelect:!1}],b={toolCallId:y.toolCallId,sessionId:p,vpId:f||"",turnId:m||"",threadId:l.threadId||"main"},_=nm(n,b);if(_){Ll(_,y,h);continue}let L=Ll({id:`${c||u||m}:ask:${y.toolCallId}`,messageId:`${c||u||m}:ask:${y.toolCallId}`,type:"tool-use",timestamp:g,sessionId:p,turnId:m,threadId:b.threadId,...f?{vpId:f,speakerVpId:f}:{},isStreaming:!1},y,h),U=El(L);(!U||!o.some($=>El($)===U))&&o.push(L)}let k=jg(l);k>0&&o.push({...c?{id:`${c}:tool-summary`,messageId:`${c}:tool-summary`,persistedMessageId:c}:{},type:"tool-summary",count:k,omittedCount:k,source:"history",timestamp:g,sessionId:p,turnId:m,...f?{vpId:f,speakerVpId:f}:{},isStreaming:!1,isHistory:!0})}}}return{formatted:o,acceptedHistoryMessages:a}}function Kl(e,t){let s=t.sessionId!=null?t.sessionId:t.groupId;if(t.requestId&&typeof e.isCurrentYeaftHistoryResponse=="function"&&!e.isCurrentYeaftHistoryResponse(t))return;let n=t.mode==="recent"||t.mode==="delta"?t.mode:"older",i=Array.isArray(t.messages)?t.messages:[];t.perfTraceId&&Xe(e,{traceId:t.perfTraceId,phase:"history.chunk_received",agentId:t.agentId||null,sessionId:s||null,messageType:t.type,bytes:(()=>{try{return JSON.stringify(t).length}catch{return null}})(),detail:{mode:n,rawCount:i.length}});let r=t.agentId||(s&&e.yeaftSessionAgentById?e.yeaftSessionAgentById[s]:null),o=r&&e.yeaftConversationIdsByAgent?e.yeaftConversationIdsByAgent[r]:null,a=t.conversationId||o||e.yeaftConversationId;if(!a){e.yeaftLoadingMoreHistory=!1;return}sm(e,t,s,a),e.messagesMap[a]||(e.messagesMap[a]=[]);let{formatted:l,acceptedHistoryMessages:c}=zl(i,s,n,e.messagesMap[a]),d=0;if(n==="recent")d=Jg(e.messagesMap[a],l,s??null);else if(l.length>0)if(n==="older"){if(e.messagesMap[a].splice(0,0,...l),d=l.length,typeof e.expandYeaftMessageWindow=="function"){let y=e.yeaftActiveSessionFilter?s??null:null;e.expandYeaftMessageWindow(y,t.turns||10)}}else d=Qr(e.messagesMap[a],l);let u=Le(t.agentId||null,s),p=e.yeaftSessionHistoryState?.[u]||{},f=typeof t.latestSeq=="number"?t.latestSeq:p.latestSeq??null,g=n==="delta"?{...p,loaded:!0,loading:!1,latestSeq:f,syncingAfterSeq:null,count:(p.count||0)+d}:{loaded:!0,loading:!1,hasMore:!!t.hasMore,oldestSeq:typeof t.oldestSeq=="number"?t.oldestSeq:e.yeaftOldestLoadedSeq,count:n==="older"?(p.count||0)+d:c,latestSeq:f,syncingAfterSeq:null};t.requestId&&typeof e.finishYeaftHistoryLoad=="function"?e.finishYeaftHistoryLoad(t,g):e.yeaftSessionHistoryState&&(e.yeaftSessionHistoryState={...e.yeaftSessionHistoryState,[u]:g});let v=an(e),m=v.sessionId===(s||null),A=!t.agentId||!v.agentId||t.agentId===v.agentId,w=m&&A,k=Le(null,v.sessionId);if(t.perfTraceId&&(Xe(e,{traceId:t.perfTraceId,phase:"history.chunk_applied",agentId:t.agentId||null,sessionId:s||null,messageType:t.type,detail:{mode:n,formattedCount:l.length,insertedRows:d,acceptedHistoryMessages:c}}),ti(e,{traceId:t.perfTraceId,phase:"history.next_paint",agentId:t.agentId||null,sessionId:s||null,messageType:t.type,detail:{mode:n,insertedRows:d}})),w)e.yeaftHasMoreHistory=g.hasMore,typeof t.oldestSeq=="number"&&(e.yeaftOldestLoadedSeq=t.oldestSeq),e.yeaftLoadingMoreHistory=!1;else if(e.yeaftLoadingMoreHistory){let y=e.yeaftSessionHistoryState?.[v.sessionKey]||e.yeaftSessionHistoryState?.[k]||null;e.yeaftLoadingMoreHistory=!!y?.loading}}var ii=H(()=>{Gt();Kt();Ur();rn();Or();St();Kr();Gr();si()});function Yl(e,t){if(e.promoteYeaftHistoryOutlineRow?.(t))return;let s=t?.sessionId??t?.groupId??e._currentYeaftSessionId??null;s&&e.invalidateYeaftHistoryOutline?.(s)}function im(e){let t=e;if(typeof t=="string"){let s=t.trim();if(s.startsWith("[")&&s.endsWith("]")||s.startsWith("{")&&s.endsWith("}"))try{t=JSON.parse(s)}catch{t=e}}return Array.isArray(t)?t.map(s=>typeof s=="string"?s:!s||typeof s!="object"?"":s.type==="text"&&typeof s.text=="string"||s.type==="input_text"&&typeof s.text=="string"?s.text:"").join("").replace(/\n\n\[Uploaded files\][\s\S]*$/m,"").trim():t&&typeof t=="object"?typeof t.text=="string"?t.text.trim():typeof t.content=="string"?t.content.trim():"":typeof t=="string"?t.replace(/\n\n\[Uploaded files\][\s\S]*$/m,"").trim():""}function Jr(e,t){return e.executionStatusMap[t]||(e.executionStatusMap[t]={currentTool:null,toolHistory:[],lastActivity:null}),e.executionStatusMap[t]}function jl(e,t,s){if(!t)return;let n=Jr(e,t);if(n.lastActivity=Date.now(),Zn(e,t),s.type==="system"){if(s.subtype==="init"){let i=e.conversations.find(r=>r.id===t);i&&i.connecting&&(i.connecting=!1);return}s.message&&e.addMessageToConversation(t,{type:"system",content:typeof s.message=="string"?s.message:JSON.stringify(s.message,null,2)});return}if(s.type==="assistant"){let i=s.message?.content;if(!i)return;let r=e.messagesMap[t]||[];for(let o of r)o.type==="tool-use"&&!o.hasResult&&(o.hasResult=!0);for(let o of n.toolHistory)o.status==="running"&&(o.status="done");if(n.currentTool=null,typeof i=="string"){e.appendToAssistantMessageForConversation(t,i,{id:s.message?.id||s.message?.messageId||null,ts:s.ts||s.message?.ts||s.message?.time||null,sessionId:e._currentYeaftSessionId||null,vpId:e._currentYeaftVpId||null,turnId:e._currentYeaftTurnId||null,threadId:e._currentYeaftThreadId||null});return}if(!Array.isArray(i))return;if(i.length===0){e.finishStreamingForConversation(t);return}for(let o of i)o.type==="text"?e.appendToAssistantMessageForConversation(t,o.text,{id:s.message?.id||s.message?.messageId||null,ts:s.ts||s.message?.ts||s.message?.time||null,sessionId:e._currentYeaftSessionId||null,vpId:e._currentYeaftVpId||null,turnId:e._currentYeaftTurnId||null,threadId:e._currentYeaftThreadId||null}):o.type==="image_asset"&&o.image?e.addMessageToConversation(t,{type:"chat-image",...o.image,sessionId:e._currentYeaftSessionId||null,vpId:e._currentYeaftVpId||null,speakerVpId:e._currentYeaftVpId||null,turnId:e._currentYeaftTurnId||null,threadId:e._currentYeaftThreadId||null}):o.type==="tool_summary"?e.addMessageToConversation(t,{type:"tool-summary",count:Number(o.count||o.omittedCount||0)||0,omittedCount:Number(o.omittedCount||o.count||0)||0,source:o.source||"history",isHistory:o.source!=="live",sessionId:e._currentYeaftSessionId||null,vpId:e._currentYeaftVpId||null,turnId:e._currentYeaftTurnId||null,threadId:e._currentYeaftThreadId||null}):o.type==="tool_use"&&(e.finishStreamingForConversation(t,{completeLifecycle:!1}),n.currentTool={name:o.name,input:o.input,startTime:Date.now()},n.toolHistory.unshift({name:o.name,input:o.input,timestamp:Date.now(),status:"running"}),n.toolHistory.length>20&&n.toolHistory.pop(),e.addMessageToConversation(t,{type:"tool-use",toolId:o.id||o.tool_use_id||null,toolName:o.name,toolInput:o.input,startTime:Date.now(),sessionId:e._currentYeaftSessionId||null,vpId:e._currentYeaftVpId||null,turnId:e._currentYeaftTurnId||null,threadId:e._currentYeaftThreadId||null}))}else if(s.type==="user"){let i=s.internal===!0||s.message?.internal===!0||s.userAuthored===!1||s.message?.userAuthored===!1,r=s.message?.content,o=im(r);if(typeof o=="string"&&(o.includes("<local-command-caveat>")||o.includes("<command-name>")))return;if(typeof o=="string"&&o.includes("<local-command-stdout>")){let l=o.match(/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/);if(l){e.appendToAssistantMessageForConversation(t,l[1].trim()),e.finishStreamingForConversation(t);return}}let a=[];if(s.tool_use_result)a=Array.isArray(s.tool_use_result)?s.tool_use_result:[s.tool_use_result];else if(s.message?.content){let l=s.message.content;a=(Array.isArray(l)?l:[]).filter(d=>d.type==="tool_result")}if(a.length>0){let l=e.messagesMap[t]||[];for(let c of a){if(n.toolHistory.length>0){let f=n.toolHistory.findIndex(g=>g.status==="running");f>=0&&(n.toolHistory[f].status="done")}let d=c.tool_use_id||c.toolUseId||c.tool_call_id||c.toolCallId||null,u=c.content||c,p=!1;if(d){for(let f=l.length-1;f>=0;f--)if(l[f].type==="tool-use"&&l[f].toolId===d){l[f].hasResult=!0,l[f].toolResult=c.is_update&&l[f].toolResult?`${l[f].toolResult}
1
+ var H=(e,t,s)=>()=>{if(s)throw s[0];try{return e&&(t=e(e=0)),t}catch(n){throw s=[n],n}};var kg=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(s){throw t=0,s}};function Va(e,t){let s=nacl.randomBytes(24),n=JSON.stringify(e),i,r=!1;n.length>512?(i=pako.gzip(n),r=!0):i=nacl.util.decodeUTF8(n);let o=nacl.secretbox(i,s,t),a={n:nacl.util.encodeBase64(s),c:nacl.util.encodeBase64(o)};return r&&(a.z=!0),a}function Fa(e,t){try{let s=nacl.util.decodeBase64(e.n),n=nacl.util.decodeBase64(e.c),i=nacl.secretbox.open(n,s,t);if(!i)return null;if(e.z){let r=pako.ungzip(i,{to:"string"});return JSON.parse(r)}else return JSON.parse(nacl.util.encodeUTF8(i))}catch{return null}}function Ha(e){return e&&typeof e=="object"&&typeof e.n=="string"&&typeof e.c=="string"}function lt(e){return nacl.util.decodeBase64(e)}var Yn=H(()=>{});var Sg,Cg,Me,ct=H(()=>{Yn();({defineStore:Sg}=Pinia),Cg=1800*1e3,Me=Sg("auth",{state:()=>({skipAuth:!1,emailVerification:!1,passwordResetEnabled:!1,totpEnabled:!1,registrationEnabled:!1,aadEnabled:!1,aadClientId:null,aadTenantId:null,ssoProviders:{github:!1,google:!1,wechat:!1,alipay:!1},linkedIdentities:[],hasPassword:!1,identitiesLoading:!1,identitiesError:null,initialized:!1,authGeneration:0,isAuthenticated:!1,token:null,sessionKey:null,role:null,loginStep:"credentials",tempToken:null,emailHint:null,setupToken:null,totpSecret:null,qrCode:null,error:null,loading:!1,qrPanel:null,_qrPollTimer:null,_sessionRefreshTimer:null,_sessionRefreshVisibilityHandler:null}),actions:{async initialize(){if(this.initialized)return this.isAuthenticated;try{if(await this.checkAuthMode(),this.skipAuth&&this.isAuthenticated)return!0;let e=!1;return typeof window<"u"&&typeof this.consumeSsoRedirect=="function"&&(e=this.consumeSsoRedirect()),!this.isAuthenticated&&!e&&await this.restoreSession(),this.isAuthenticated}finally{this.initialized=!0}},async checkAuthMode(){try{let t=await(await fetch("/api/auth/mode")).json();this.skipAuth=t.skipAuth,this.emailVerification=t.emailVerification,this.passwordResetEnabled=!!t.passwordResetEnabled,this.totpEnabled=t.totpEnabled,this.registrationEnabled=t.registrationEnabled||!1,this.aadEnabled=t.aadEnabled||!1,this.aadClientId=t.aadClientId||null,this.aadTenantId=t.aadTenantId||null,this.ssoProviders=Object.assign({github:!1,google:!1,wechat:!1,alipay:!1},t.ssoProviders||{}),this.skipAuth&&(this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated")}catch{}},async login(e,t){this.loading=!0,this.error=null;try{let n=await(await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})})).json();return n.success?n.needTotpSetup?(this.setupToken=n.setupToken,this.totpSecret=n.totpSecret,this.qrCode=n.qrCode,this.loginStep="totp-setup",!0):n.needTotpCode?(this.tempToken=n.tempToken,this.loginStep="totp",!0):n.needEmailCode?(this.tempToken=n.tempToken,this.emailHint=n.emailHint,this.loginStep="verification",!0):(this.token=n.token,this.sessionKey=n.sessionKey?lt(n.sessionKey):null,this.role=n.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",localStorage.setItem("authToken",n.token),this.startSessionRefresh(),!0):(this.error=n.error||"Login failed",!1)}catch(s){return this.error=s.message||"Network error",!1}finally{this.loading=!1}},async loginWithMicrosoft(){if(!this.aadEnabled||!this.aadClientId||!this.aadTenantId)return this.error="Microsoft login is not configured",!1;if(typeof msal>"u"||!msal.PublicClientApplication)return this.error="Microsoft authentication library not loaded",!1;this.loading=!0,this.error=null;try{let e={auth:{clientId:this.aadClientId,authority:`https://login.microsoftonline.com/${this.aadTenantId}`,redirectUri:window.location.origin+"/auth/callback"},cache:{cacheLocation:"sessionStorage",storeAuthStateInCookie:!1}},t=new msal.PublicClientApplication(e);await t.initialize();let s=await t.loginPopup({scopes:["openid","profile","email"]});if(!s||!s.idToken)return this.error="Microsoft login failed: no token received",!1;let i=await(await fetch("/api/auth/aad",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:s.idToken})})).json();return i.success?(this.token=i.token,this.sessionKey=i.sessionKey?lt(i.sessionKey):null,this.role=i.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",localStorage.setItem("authToken",i.token),this.startSessionRefresh(),!0):(this.error=i.error||"Microsoft login failed",!1)}catch(e){return e.errorCode==="user_cancelled"||e.name==="BrowserAuthError"?(this.error=null,!1):(this.error=e.message||"Microsoft login failed",!1)}finally{this.loading=!1}},async verifyTotpCode(e){this.loading=!0,this.error=null;try{let s=await(await fetch("/api/auth/verify-totp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tempToken:this.tempToken,totpCode:e})})).json();return s.success?s.needEmailCode?(this.tempToken=s.tempToken,this.emailHint=s.emailHint,this.loginStep="verification",!0):(this.token=s.token,this.sessionKey=s.sessionKey?lt(s.sessionKey):null,this.role=s.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",this.tempToken=null,localStorage.setItem("authToken",s.token),this.startSessionRefresh(),!0):(this.error=s.error||"TOTP verification failed",!1)}catch(t){return this.error=t.message||"Network error",!1}finally{this.loading=!1}},async completeTotpSetup(e){this.loading=!0,this.error=null;try{let s=await(await fetch("/api/auth/setup-totp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({setupToken:this.setupToken,totpCode:e})})).json();return s.success?(this.setupToken=null,this.totpSecret=null,this.qrCode=null,s.needEmailCode?(this.tempToken=s.tempToken,this.emailHint=s.emailHint,this.loginStep="verification",!0):(this.token=s.token,this.sessionKey=s.sessionKey?lt(s.sessionKey):null,this.role=s.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",localStorage.setItem("authToken",s.token),this.startSessionRefresh(),!0)):(this.error=s.error||"TOTP setup failed",!1)}catch(t){return this.error=t.message||"Network error",!1}finally{this.loading=!1}},async verifyCode(e){this.loading=!0,this.error=null;try{let s=await(await fetch("/api/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tempToken:this.tempToken,code:e})})).json();return s.success?(this.token=s.token,this.sessionKey=s.sessionKey?lt(s.sessionKey):null,this.role=s.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",this.tempToken=null,this.emailHint=null,localStorage.setItem("authToken",s.token),this.startSessionRefresh(),!0):(this.error=s.error||"Verification failed",!1)}catch(t){return this.error=t.message||"Network error",!1}finally{this.loading=!1}},async register(e,t,s,n){this.loading=!0,this.error=null;try{let r=await(await fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t,email:s||void 0,invitationCode:n})})).json();return r.success?!0:(this.error=r.error||"Registration failed",!1)}catch(i){return this.error=i.message||"Network error",!1}finally{this.loading=!1}},showRegister(){this.loginStep="register",this.error=null},loginWithSso(e){window.location.href=`/api/auth/sso/${encodeURIComponent(e)}/start`},async loginWithAlipayMobile({intent:e="login"}={}){if(!await this.startSsoQr("alipay",{intent:e}))return!1;let s=this.qrPanel?.authorizeUrl;if(!s)return!1;let n=`alipays://platformapi/startapp?appId=20000067&url=${encodeURIComponent(s)}`;return this.qrPanel={...this.qrPanel,mobileDeepLink:!0},window.location.href=n,!0},async startSsoQr(e,{intent:t="login"}={}){this.cancelSsoQr(),this.error=null;try{let s=new URLSearchParams;if(t==="bind"){if(!this.isAuthenticated)return this.error="You must be logged in to bind an identity",!1;s.set("intent","bind")}let n=s.toString(),i=`/api/auth/sso/${encodeURIComponent(e)}/start-qr${n?"?"+n:""}`,r=await fetch(i),o=await r.json();return!r.ok||!o.success?(this.error=o.error||"Failed to start QR login",!1):(this.qrPanel={provider:e,intent:t,authorizeUrl:o.authorizeUrl,state:o.state,status:"pending",error:null},this._startQrPoll(),!0)}catch(s){return this.error=s.message||"Network error",!1}},_startQrPoll(){this._stopQrPollTimer();let e=async()=>{if(!this.qrPanel)return;let t=this.qrPanel.state;try{let n=await(await fetch(`/api/auth/sso/poll/${encodeURIComponent(t)}`)).json();if(!this.qrPanel||this.qrPanel.state!==t||n.status==="pending")return;if(n.status==="login"){this.token=n.token,this.sessionKey=n.sessionKey?lt(n.sessionKey):null,this.role=n.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",localStorage.setItem("authToken",n.token),this.startSessionRefresh(),this.cancelSsoQr();return}if(n.status==="bind"){this.qrPanel={...this.qrPanel,status:"bound"},this._stopQrPollTimer();return}this.qrPanel={...this.qrPanel,status:"error",error:n.error||"SSO failed"},this._stopQrPollTimer()}catch{}};this._qrPollTick=e,this._qrPollTimer=setInterval(e,2e3),typeof document<"u"&&!this._qrVisHandler&&(this._qrVisHandler=()=>{typeof document<"u"&&document.visibilityState&&document.visibilityState!=="visible"||!this.qrPanel||!this._qrPollTick||(this._qrPollTick(),this._qrPollTimer&&clearInterval(this._qrPollTimer),this._qrPollTimer=setInterval(this._qrPollTick,2e3))},document.addEventListener("visibilitychange",this._qrVisHandler),typeof window<"u"&&window.addEventListener("pageshow",this._qrVisHandler))},_stopQrPollTimer(){this._qrPollTimer&&(clearInterval(this._qrPollTimer),this._qrPollTimer=null),this._qrVisHandler&&(typeof document<"u"&&document.removeEventListener("visibilitychange",this._qrVisHandler),typeof window<"u"&&window.removeEventListener("pageshow",this._qrVisHandler),this._qrVisHandler=null),this._qrPollTick=null},cancelSsoQr(){this._stopQrPollTimer(),this.qrPanel=null},bindSso(e){if(!this.isAuthenticated){this.error="You must be logged in to bind an identity";return}let t=new URLSearchParams({intent:"bind"});window.location.href=`/api/auth/sso/${encodeURIComponent(e)}/start?${t.toString()}`},consumeSsoRedirect(){let e=window.location.hash||"",t=e.indexOf("?");if(!e.startsWith("#/sso-complete")||t<0)return!1;let s=new URLSearchParams(e.slice(t+1)),n=s.get("token"),i=s.get("sessionKey"),r=s.get("role");if(!n)return!1;this.token=n,this.sessionKey=i?lt(i):null,this.role=r||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",localStorage.setItem("authToken",n),this.startSessionRefresh();try{history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}return!0},async loadIdentities(){if(this.isAuthenticated){this.identitiesLoading=!0,this.identitiesError=null;try{let e=await fetch("/api/auth/identities"),t=await e.json();if(!e.ok||!t.success){this.identitiesError=t.error||"Failed to load identities";return}this.linkedIdentities=t.identities||[],this.hasPassword=!!t.hasPassword}catch(e){this.identitiesError=e.message||"Network error"}finally{this.identitiesLoading=!1}}},async unbindIdentity(e){if(!this.isAuthenticated)return!1;this.identitiesError=null;try{let t=await fetch(`/api/auth/identities/${encodeURIComponent(e)}`,{method:"DELETE"}),s=await t.json();return!t.ok||!s.success?(this.identitiesError=s.error||"Failed to unbind",!1):(this.linkedIdentities=this.linkedIdentities.filter(n=>n.provider!==e),!0)}catch(t){return this.identitiesError=t.message||"Network error",!1}},async refreshSession(){let e=this.token,t=this.authGeneration,s=this.isAuthenticated;try{let n=await fetch("/api/user/profile",{headers:e?{Authorization:`Bearer ${e}`}:{}});if(this.handleAuthResponse(n,e,t,s)||!n.ok)return!1;let i=await n.json().catch(()=>({})),r=n.headers?.get?.("X-New-Token"),o=localStorage.getItem("authToken");return r&&this.token===e&&(!o||o===e)&&(this.token=r,localStorage.setItem("authToken",r)),i?.role&&(this.role=i.role),!0}catch{return!1}},startSessionRefresh(){if(this.stopSessionRefresh(),!this.isAuthenticated||this.skipAuth)return;let e=()=>{typeof document<"u"&&document.visibilityState&&document.visibilityState!=="visible"||this.refreshSession()};this._sessionRefreshTimer=setInterval(e,Cg),this._sessionRefreshVisibilityHandler=e,typeof document<"u"&&document.addEventListener("visibilitychange",e),typeof window<"u"&&window.addEventListener("pageshow",e)},stopSessionRefresh(){this._sessionRefreshTimer&&(clearInterval(this._sessionRefreshTimer),this._sessionRefreshTimer=null),this._sessionRefreshVisibilityHandler&&(typeof document<"u"&&document.removeEventListener("visibilitychange",this._sessionRefreshVisibilityHandler),typeof window<"u"&&window.removeEventListener("pageshow",this._sessionRefreshVisibilityHandler),this._sessionRefreshVisibilityHandler=null)},async logout(){try{let e={"Content-Type":"application/json"};this.token&&(e.Authorization=`Bearer ${this.token}`),await fetch("/api/auth/logout",{method:"POST",headers:e})}catch{}this.clearStoredSession()},clearStoredSession(e=null){this.reset(),localStorage.removeItem("authToken"),e&&(this.error=e)},getActiveToken(){if(this.token)return this.token;let e=localStorage.getItem("authToken");return e&&(this.token=e),this.token},handleAuthResponse(e,t=null,s=this.authGeneration,n=this.isAuthenticated,i=void 0){if(!e||e.status!==401||!n||s!==this.authGeneration)return!1;let r=this.token||localStorage.getItem("authToken")||null;return t!==r?!1:(this.handleAuthFailure(i,t,s),!0)},handleAuthFailure(e="Session expired. Please log in again.",t=null,s=this.authGeneration){if(s!==this.authGeneration)return!1;let n=this.token||localStorage.getItem("authToken")||null;return t!==n||this.clearStoredSession(e),!1},async restoreSession(){let e=localStorage.getItem("authToken"),t=this.authGeneration,s=this.isAuthenticated||!!e;try{let n=await fetch("/api/user/profile",{headers:e?{Authorization:`Bearer ${e}`}:{}});if(this.handleAuthResponse(n,e,t,s))return!1;if(!n.ok)return this.error="Failed to restore session",!1;let i=await n.json();if(t!==this.authGeneration)return this.isAuthenticated;let r=n.headers?.get?.("X-New-Token"),o=this.getActiveToken(),a=r&&(!o||o===e)?r:o||e;return this.token=a,a&&a!==e&&localStorage.setItem("authToken",a),this.role=i?.role||"pro",this.authGeneration+=1,this.isAuthenticated=!0,this.loginStep="authenticated",this.startSessionRefresh(),!0}catch(n){return this.error=n.message||"Failed to restore session",!1}},setSessionKey(e){e&&(this.sessionKey=lt(e))},backToCredentials(){this.loginStep="credentials",this.tempToken=null,this.emailHint=null,this.setupToken=null,this.totpSecret=null,this.qrCode=null,this.error=null},async requestPasswordReset(e){this.error=null;try{let s=await(await fetch("/api/auth/password-reset/request",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})})).json();return s.success?s.resetToken||null:(this.error=s.error||"Failed to request password reset",null)}catch(t){return this.error=t.message||"Network error",null}},async verifyPasswordReset(e,t,s){this.error=null;try{let i=await(await fetch("/api/auth/password-reset/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resetToken:e,code:t,newPassword:s})})).json();return i.success?!0:(this.error=i.error||"Failed to reset password",!1)}catch(n){return this.error=n.message||"Network error",!1}},async deleteAccount({currentPassword:e,confirm:t}={}){if(!this.isAuthenticated)return{success:!1,error:"Not authenticated"};try{let s=await fetch("/api/user/me",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:e,confirm:t})}),n=await s.json();return!s.ok||!n.success?{success:!1,error:n.error||"Failed to delete account"}:(this.clearStoredSession(),{success:!0})}catch(s){return{success:!1,error:s.message||"Network error"}}},reset(){this.authGeneration+=1,this.stopSessionRefresh(),this.isAuthenticated=!1,this.token=null,this.sessionKey=null,this.role=null,this.loginStep="credentials",this.tempToken=null,this.emailHint=null,this.setupToken=null,this.totpSecret=null,this.qrCode=null,this.error=null,this.loading=!1}}})});function Pe(e,t){let s=kt?.value||"zh-CN",i=(bs[s]||bs["zh-CN"]||{})[e];if(i===void 0&&s!=="zh-CN"&&(i=(bs["zh-CN"]||{})[e]),i===void 0)return e;if(t)for(let[r,o]of Object.entries(t))i=i.replace(new RegExp(`\\{${r}\\}`,"g"),o);return i}function Ig(){return kt?.value||"zh-CN"}function Zs(e){bs[e]&&(kt&&(kt.value=e),localStorage.setItem("locale",e),document.documentElement.setAttribute("lang",e))}function Ag(){let e=localStorage.getItem("locale");return e&&bs[e]?e:(navigator.language||navigator.userLanguage||"").startsWith("en")?"en":"zh-CN"}function Oa(e,t){return bs=t,kt=Vue.ref(Ag()),document.documentElement.setAttribute("lang",kt.value),e.config.globalProperties.$t=Pe,e.config.globalProperties.$locale=kt,e.provide("t",Pe),e.provide("locale",kt),{t:Pe,setLocale:Zs,getLocale:Ig,locale:kt}}var kt,bs,St=H(()=>{kt=null,bs={}});function jn(e){if(e==null||e==="")return"claude-code";if(xg.has(e))return e;throw new Error(`Unknown Chat runtime provider: ${e}`)}function ws(e){if(typeof e!="string"||!e)throw new Error("Chat catalog key requires conversationId");return`chat:${e}`}function Gn(e,t){if(typeof e!="string"||!e||typeof t!="string"||!t)throw new Error("Yeaft catalog key requires agentId and sessionId");return`yeaft:${e}:${t}`}function Dr(e,t){let s=e.sessionCatalog.map(n=>({...n}));return e.sessionCatalogMutationRequests[t]={previousCatalog:s},s}function qa(e,t){let s=t?.requestId?e.sessionCatalogMutationRequests[t.requestId]:null;return s?(delete e.sessionCatalogMutationRequests[t.requestId],t.ok!==!0&&(e.sessionCatalog=s.previousCatalog),!0):!1}function Na(e,t,s="recent",n=null){let i=ws(t),r=e.chatHistoryRequests[i]||{},o=Number(r.generation||0)+1,a=`chat_history_${o}_${crypto.randomUUID()}`;return e.chatHistoryRequests[i]={requestId:a,catalogKey:i,generation:o,mode:s,cursor:n,connectionGeneration:Number(e.chatHistoryConnectionGeneration||0),loading:!0,cancelled:!1,error:null},a}function Ba(e,t,s,n){let i=e.chatHistoryRequests[t];return i?.requestId!==s?!1:(e.chatHistoryRequests[t]={...i,loading:!1,cancelled:!0,error:n},!0)}var xg,Er=H(()=>{xg=new Set(["claude-code","copilot"])});function ks(e,t,s=""){Js&&(clearTimeout(Js),Js=null),e.sessionLoading=t,e.sessionLoadingText=s,t&&(Js=setTimeout(()=>{e.sessionLoading&&(e.sessionLoading=!1,e.sessionLoadingText=""),Js=null},Tg))}function gt(e){ks(e,!1)}function Wa(e){if(e.currentConversation){e.pendingRecovery=null;return}let t=e.lastUsedSession,s=e.lastUsedAgent;if(t&&t.sessionId&&s){let n=e.agents.find(i=>i.id===s&&i.online);n&&(e.pendingRecovery={agentId:s,agentName:n.name,sessionId:t.sessionId,workDir:t.workDir,provider:jn(t.provider),catalogKey:t.catalogKey||null},e.recoveryDismissed=!1)}}function Ua(e){if(!e.pendingRecovery)return;let{agentId:t,sessionId:s,workDir:n,provider:i}=e.pendingRecovery;e.selectAgent(t),setTimeout(()=>{e.resumeConversation(s,n,t,{provider:jn(i)}),e.pendingRecovery=null,e.recoveryDismissed=!1},500)}function za(e){e.recoveryDismissed=!0,e.pendingRecovery=null}function Ka(e,t){let s=e.conversations.find(n=>n.id===t);s&&(e.activeConversations=[t],e.currentWorkDir=s.workDir,e.messagesMap[t]?.length>0||(s.claudeSessionId?(e.messagesMap[t]=[],ks(e,!0,Pe("chat.session.loadingHistory")),e.sendWsMessage({type:"resume_conversation",agentId:s.agentId||e.currentAgent,claudeSessionId:s.claudeSessionId,workDir:s.workDir,conversationId:t})):(e.messagesMap[t]=[],e.requestChatHistory?.(t,{mode:"recent",turns:5}))),e.sendWsMessage({type:"select_conversation",conversationId:t}))}function Ya(e){if(e.panels.length>0)return;let t=localStorage.getItem("panels");if(!t)return;let s;try{s=JSON.parse(t)}catch{localStorage.removeItem("panels");return}if(!Array.isArray(s)||s.length<2){localStorage.removeItem("panels");return}let n=new Set(e.conversations.map(r=>r.id)),i=s.filter(r=>r&&typeof r.id=="string").map(r=>({id:r.id,conversationId:r.conversationId&&n.has(r.conversationId)?r.conversationId:null,activeRightPanel:r.activeRightPanel||null}));if(i.length<2){localStorage.removeItem("panels");return}e.panels=i,e.activePanelId=i[0]?.id||null;for(let r of i)r.conversationId&&(e.activeConversations.includes(r.conversationId)||e.activeConversations.push(r.conversationId),e.messagesMap[r.conversationId]||(e.messagesMap[r.conversationId]=[]),e.messagesMap[r.conversationId].length||e.requestChatHistory?.(r.conversationId,{mode:"recent",turns:5}))}function Ss(e){if(e.currentAgent){if(localStorage.setItem("lastUsedAgent",e.currentAgent),localStorage.setItem("lastViewedConversation",e.currentConversation||""),e.lastViewedConversation=e.currentConversation,e.currentConversation){let t=e.conversations.find(s=>s.id===e.currentConversation);if(t?.claudeSessionId&&t?.workDir){let s=jn(t.provider),n={sessionId:t.claudeSessionId,workDir:t.workDir,agentId:t.agentId||e.currentAgent,provider:s,catalogKey:ws(t.id),version:2};localStorage.setItem("lastUsedSession",JSON.stringify(n)),localStorage.setItem("lastViewedSessionRef",JSON.stringify(n)),e.lastUsedSession=n}}e.lastUsedAgent=e.currentAgent,e.panels.length>0?localStorage.setItem("panels",JSON.stringify(e.panels)):localStorage.removeItem("panels")}}function ja(e){return e.lastUsedSession}function Ga(e){localStorage.removeItem("lastUsedAgent"),localStorage.removeItem("lastUsedSession"),localStorage.removeItem("lastViewedSessionRef"),localStorage.removeItem("lastViewedConversation"),localStorage.removeItem("panels"),localStorage.removeItem("splitPanesSaved"),e.lastUsedAgent=null,e.lastUsedSession=null,e.lastViewedConversation=null}function Qa(e,t,s){if(!e.currentAgent){e.historySessionsLoading=!1;return}if(!t){e.historySessions=[],e.historySessionsLoading=!1;return}let n=Date.now().toString();e._historySessionsRequestId=n,e.historySessionsLoading=!0,e.historySessions=[],e.sendWsMessage({type:"list_history_sessions",workDir:t,provider:s||"claude-code",requestId:n})}function Xa(e,t){if(!e.currentAgent)return e.foldersLoading=!1,Promise.resolve();e.foldersLoading=!0,e.folders=[];let s=Date.now().toString();return e._foldersRequestId=s,new Promise(n=>{e._foldersResolve&&e._foldersResolve(),e._foldersResolve=n,e.sendWsMessage({type:"list_folders",provider:t||"claude-code",requestId:s}),setTimeout(()=>{e._foldersResolve===n&&(e._foldersResolve(),e._foldersResolve=null,e.foldersLoading=!1)},1e4)})}function Za(e,t,s){if(!t)return e.foldersLoading=!1,Promise.resolve();e.foldersLoading=!0,e.folders=[];let n=Date.now().toString();return e._foldersRequestId=n,new Promise(i=>{e._foldersResolve&&e._foldersResolve(),e._foldersResolve=i,e.sendWsMessage({type:"list_folders",agentId:t,provider:s||"claude-code",requestId:n}),setTimeout(()=>{e._foldersResolve===i&&(e._foldersResolve(),e._foldersResolve=null,e.foldersLoading=!1)},1e4)})}function Ja(e,t,s){if(!t)return Promise.resolve([]);let n=`models-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return e._modelsRequestId=n,e.providerModelsLoading=!0,new Promise(i=>{e._modelsResolve&&e._modelsResolve([]),e._modelsTimeout&&clearTimeout(e._modelsTimeout),e._modelsResolve=i,e.sendWsMessage({type:"list_models",agentId:t,provider:s||"claude-code",requestId:n}),e._modelsTimeout=setTimeout(()=>{e._modelsResolve===i&&(e._modelsResolve([]),e._modelsResolve=null,e.providerModelsLoading=!1),e._modelsTimeout=null},1e4)})}function el(e,t,s,n){if(!t){e.historySessionsLoading=!1;return}if(!s){e.historySessions=[],e.historySessionsLoading=!1;return}let i=Date.now().toString();e._historySessionsRequestId=i,e.historySessionsLoading=!0,e.historySessions=[],e.sendWsMessage({type:"list_history_sessions",agentId:t,workDir:s,provider:n||"claude-code",requestId:i})}async function tl(e,t=20){if(Me().isAuthenticated){e.globalSessionsLoading=!0;try{let n=await fetch(`/api/sessions?limit=${t}`);if(n.ok){let i=await n.json();e.globalSessions=i.sessions||[]}}catch{}finally{e.globalSessionsLoading=!1}}}async function sl(e,t){if(!Me().isAuthenticated)return!1;try{if((await fetch(`/api/sessions/${t}`,{method:"DELETE"})).ok)return e.globalSessions=e.globalSessions.filter(i=>i.id!==t),!0}catch{}return!1}function Lr(e,t){return t.agentId?e.agents.find(s=>s.id===t.agentId):t.agentName?e.agents.find(s=>s.name===t.agentName):null}function nl(e,t){let s=Lr(e,t);return s&&s.online}var Tg,Js,Kt=H(()=>{ct();St();Er();Tg=3e4,Js=null});function il(e){return e?.code===1008&&String(e.reason||"").toLowerCase().includes("authentication")}function rl(e){let t=en;en=[];for(let{resolve:s,reject:n,timer:i}of t)clearTimeout(i),e?s():n(new Error("WebSocket reconnect failed"))}function ol(e,t){if(!e.ws||e.ws.readyState!==WebSocket.OPEN)return!1;if(e.currentView==="yeaft"&&Pg.has(t.type)){let s=t.conversationId;if(!s||typeof s=="string"&&s.startsWith("yeaft-")||s===e.yeaftConversationId)return!1}try{if(e.serverEncryptionRequired&&e.sessionKey){let s=Va(t,e.sessionKey);e.ws.send(JSON.stringify(s))}else e.ws.send(JSON.stringify(t));return!0}catch{return!1}}function tn(e,t=1e4){return e.ws&&e.ws.readyState===WebSocket.OPEN?Promise.resolve():new Promise((s,n)=>{let i=setTimeout(()=>{en=en.filter(r=>r.resolve!==s),n(new Error("WebSocket reconnect timeout"))},t);en.push({resolve:s,reject:n,timer:i}),(!e.ws||e.ws.readyState!==WebSocket.CONNECTING)&&(e.reconnectAttempts=0,e.connect())})}function al(e,t){try{let s=JSON.parse(t);return e.sessionKey&&Ha(s)?Fa(s,e.sessionKey):s}catch{return null}}function ll(e){let t=Me(),s=location.protocol==="https:"?"wss:":"ws:";e.reconnectTimer&&(clearTimeout(e.reconnectTimer),e.reconnectTimer=null);let n=t.getActiveToken?.()||t.token||null,i=t.authGeneration;if(e.ws&&e.ws.readyState===WebSocket.CONNECTING&&e._wsAuthToken===n&&e._wsAuthGeneration===i)return;clearTimeout(e._legacyYeaftSessionHydrateTimer),e._legacyYeaftSessionHydrateTimer=null,e._hasHandledAgentList=!1,e._hasHandledYeaftSessionHydrate=!1,e.yeaftSessionInventoryCompleteSupported=null,e.yeaftSessionHydrateRequestId=null,e.yeaftSessionHydrateSlices=[],e.yeaftSessionHydrateError=null,e._yeaftSessionInventorySocketQuarantined=!1,e.pendingAgentSelection=null,e.agentSwitching=!1,e.ws&&(e.ws.onopen=null,e.ws.onmessage=null,e.ws.onclose=null,e.ws.close(),e.ws=null),e.connectionState=e.reconnectAttempts>0?"reconnecting":"connecting",e.serverEncryptionRequired=!0,e.chatHistoryRequestIdSupported=null,e.chatHistoryConnectionGeneration=Number(e.chatHistoryConnectionGeneration||0)+1;for(let[l,c]of Object.entries(e.chatHistoryRequests||{}))c?.loading&&(e.chatHistoryRequests[l]={...c,loading:!1,cancelled:!0,error:"connection_changed"});let r=Object.values(e.sessionCatalogMutationRequests||{});r.length>0&&(e.sessionCatalog=r[0].previousCatalog,e.sessionCatalogMutationRequests={}),e.sessionCatalogLoaded=!1,e.sessionCatalog=[],e.activeCatalogKey=null,e._wsAuthToken=n,e._wsAuthGeneration=i;let o=`${s}//${location.host}?type=web`;n&&(o+=`&token=${encodeURIComponent(n)}`);let a=new WebSocket(o);e.ws=a,a.onopen=()=>{if(a===e.ws){e.connectionState="connected",e.reconnectAttempts=0,e.startHeartbeat();try{a.send(JSON.stringify({type:"client_hello",plaintextOk:!0}))}catch{}rl(!0)}},a.onmessage=l=>{if(a!==e.ws)return;let c=e.parseWsMessage(l.data);c&&(c.type,e.handleMessage({...c,_wsAuthToken:n,_wsAuthGeneration:i}))},a.onclose=l=>{if(a!==e.ws){il(l)&&t.handleAuthFailure?.(void 0,n,i);return}e.authenticated=!1,clearTimeout(e._legacyYeaftSessionHydrateTimer),e._legacyYeaftSessionHydrateTimer=null,e._hasHandledAgentList=!1,e._hasHandledYeaftSessionHydrate=!1,e.yeaftSessionInventoryCompleteSupported=null,e.yeaftSessionHydrateRequestId=null,e.yeaftSessionHydrateSlices=[],e.yeaftSessionHydrateError=null,e.pendingAgentSelection=null,e.agentSwitching=!1;let c=e.connectionState==="updating";if(e.connectionState=c?"updating":"disconnected",e.stopHeartbeat(),gt(e),il(l)){t.handleAuthFailure?.(void 0,n,i),e.reconnectAttempts=0,rl(!1);return}if(e._yeaftReconnectCatchUpPending=!0,c){e.reconnectAttempts=0,e.reconnectTimer=setTimeout(()=>{e.connect()},2e3);return}e.scheduleReconnect()},e.ws.onerror=l=>{}}function cl(e){if(e.reconnectAttempts>=e.maxReconnectAttempts){e.connectionState="disconnected";return}let t=Math.min(1e3*Math.pow(2,e.reconnectAttempts),3e4);e.reconnectAttempts++,e.connectionState="reconnecting",e.reconnectTimer=setTimeout(()=>{e.connect()},t)}function dl(e){e.reconnectAttempts=0,e.connect()}function ul(e){e.stopHeartbeat(),e._lastPongAt=Date.now(),e.heartbeatTimer=setInterval(()=>{if(e.ws&&e.ws.readyState===WebSocket.OPEN){if(Date.now()-e._lastPongAt>45e3){e.ws.close(4e3,"Heartbeat timeout");return}try{e.sendWsMessage({type:"ping"})}catch{}}},25e3)}function pl(e){e.heartbeatTimer&&(clearInterval(e.heartbeatTimer),e.heartbeatTimer=null)}function fl(e){e._visibilityHandlerInstalled||(e._visibilityHandlerInstalled=!0,document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible")if(!e.ws||e.ws.readyState!==WebSocket.OPEN)e.reconnectAttempts=0,e.connect();else try{e.sendWsMessage({type:"ping"});let t=e._lastPongAt;setTimeout(()=>{e._lastPongAt===t&&e.ws&&e.ws.close(4001,"Visibility resume timeout")},3e3)}catch{e.reconnectAttempts=0,e.connect()}}))}var en,Pg,$r=H(()=>{ct();Yn();Kt();en=[];Pg=new Set(["sync_messages","refresh_conversation","select_conversation","cancel_execution","update_conversation_settings","ask_user_answer"])});function Dg(e){return e?.type==="tool-use"}function Vr(e){return e?.type==="tool-summary"}function Fr(e){return Dg(e)&&!_g.has(e.toolName)}function hl(e,t,s,n=s){let i=t==="history"&&(n?.dbMessageId||n?.id)||null;return{...i?{id:`tool_summary_${t}_${i}`,dbMessageId:n?.dbMessageId||null}:{},type:"tool-summary",count:e,omittedCount:e,source:t,isHistory:t!=="live",timestamp:s?.timestamp||s?.startTime||n?.timestamp||n?.startTime||null,sessionId:s?.sessionId??s?.groupId??null,turnId:s?.turnId||null,vpId:s?.vpId||null,speakerVpId:s?.speakerVpId||null}}function Eg(e,t){return!Vr(e)||!Vr(t)?!1:(e.turnId||null)===(t.turnId||null)&&(e.sessionId||null)===(t.sessionId||null)&&(e.speakerVpId||e.vpId||null)===(t.speakerVpId||t.vpId||null)&&(e.source||null)===(t.source||null)}function Lg(e,t){let s=(Number(e.count)||0)+(Number(t.count)||0);return e.count=s,e.omittedCount=s,!e.timestamp&&t.timestamp&&(e.timestamp=t.timestamp),Number(t.dbMessageId||0)>Number(e.dbMessageId||0)&&(e.dbMessageId=t.dbMessageId,t.id&&(e.id=t.id)),e}function gl(e){return[e?.sessionId||"",e?.turnId||"",e?.speakerVpId||e?.vpId||""].join("")}function ml(e,t,s,n,i=n){if(!t)return;let r=hl(t,s,n,i),o=e[e.length-1];Eg(o,r)?Lg(o,r):e.push(r)}function Hr(e=[]){let t=[],s=0,n=null,i=null;for(let r of e){if(Fr(r)&&r.isHistory){s+=1,n||(n=r),i=r;continue}ml(t,s,"history",n,i),s=0,n=null,i=null,t.push(r)}return ml(t,s,"history",n,i),t}function vl(e=[],t={}){let s=Number.isFinite(t.maxDetailed)?Math.max(1,t.maxDetailed):100;if(!Array.isArray(e)||e.length<=s)return e;let n=e.length;for(let f=e.length-1;f>=0;f-=1){let g=e[f];if(g?.type==="user"||g?.type==="system"||g?.type==="error")break;n=f}let i=e.slice(n),r=new Map;for(let f of i){if(!Fr(f)||f.isHistory)continue;let g=gl(f);r.set(g,(r.get(g)||0)+1)}let o=new Map;for(let[f,g]of r)g>s&&o.set(f,g-s);if(o.size===0)return e;let a=new Map,l=new Map,c=new Set,d=[],u=(f,g,v)=>{a.set(f,(a.get(f)||0)+g),!l.has(f)&&v&&l.set(f,v)},p=(f,g)=>{if(c.has(f))return;let v=a.get(f)||0;v<=0||(d.push(hl(v,"live",l.get(f)||g)),c.add(f))};for(let f of i){let g=gl(f);if(Vr(f)&&f.source==="live"&&o.has(g)){u(g,Number(f.count)||0,f);continue}if(Fr(f)&&!f.isHistory&&o.has(g)){let v=o.get(g)||0;if(v>0){o.set(g,v-1),u(g,1,f);continue}}p(g,f),d.push(f)}for(let f of a.keys())p(f,l.get(f));return e.splice(n,e.length-n,...d),e}var _g,Or=H(()=>{_g=new Set(["TodoWrite","AskUserQuestion"])});function qr(e,t){return t?t===e.yeaftConversationId?!0:Object.values(e.yeaftConversationIdsByAgent||{}).includes(t):!1}function sn(e,t,s){s&&(s.type!=="assistant"&&s.type!=="tool-use"||qr(e,t)&&(!s.vpId&&e._currentYeaftVpId&&(s.vpId=e._currentYeaftVpId),!s.turnId&&e._currentYeaftTurnId&&(s.turnId=e._currentYeaftTurnId),!s.speakerVpId&&s.vpId&&(s.speakerVpId=s.vpId)))}function Vg(e){let t=[e?.timestamp,e?.createdAt,e?.ts,e?.time,e?.created_at];for(let s of t){if(typeof s=="number"&&Number.isFinite(s)&&s>0)return s;if(typeof s=="string"&&s.trim()){let n=Date.parse(s);if(Number.isFinite(n))return n;let i=Number(s);if(Number.isFinite(i)&&i>0)return i}}return Date.now()}function Qn(e){let t=e?.messageId??e?.dbMessageId??e?.id;return t==null||t===""?null:String(t)}function Nr(e,t){if(!e||!t)return e;let s=e.type==="user"&&typeof e.id=="string"&&e.id===e.clientMessageId;for(let[n,i]of Object.entries(t))if(i!=null){if(n==="isStreaming"){e.isStreaming&&i===!1&&(e.isStreaming=!1);continue}if(n==="id"||n==="messageId"){if(s&&t.clientMessageId===e.clientMessageId&&t.messageId&&t.messageId!==e.clientMessageId)continue;(e[n]===void 0||e[n]===null||e[n]==="")&&(e[n]=i);continue}if(!(n==="turnId"&&s&&e.turnId===e.clientMessageId)){if(n==="content"&&typeof i=="string"){e.content||(e.content=i);continue}if(n==="responseKind"&&(i==="progress"||i==="result")){e.responseKind=i;continue}if(n==="attachments"&&Array.isArray(i)){(!Array.isArray(e.attachments)||e.attachments.length===0)&&(e.attachments=i);continue}(e[n]===void 0||e[n]===null||e[n]==="")&&(e[n]=i)}}return e}function nn(e=[],t=[]){let s=[],n=new Map,i=new Map;for(let r of[...e,...t]){if(!r)continue;let o=Qn(r),a=r.type==="user"&&r.clientMessageId?String(r.clientMessageId):null;if(o&&n.has(o)){Nr(n.get(o),r);continue}if(a&&i.has(a)){let l=i.get(a);Nr(l,r),o&&!n.has(o)&&n.set(o,l);continue}s.push(r),o&&n.set(o,r),a&&i.set(a,r)}return s}function yl(e,t,s){return!e||e!==t?!1:!s?.loaded&&!s?.loading}function bl(e,t){return!!t&&!!e?.loaded&&!e?.loading&&Number.isFinite(e?.latestSeq)}function Br({sessionState:e,hasCachedSessionRows:t,force:s=!1}={}){return e?.loading?!1:s?!e?.loaded:e?.loaded?!1:!t}function Fg(e,t,s,n){let i=s?.id?String(s.id):null;if(!i)return!1;let o=(e.messagesMap[t]||[]).find(a=>a?.type==="assistant"&&Qn(a)===i);return o?(o.id||(o.id=i),o.messageId||(o.messageId=i),s.ts&&!o.ts&&(o.ts=s.ts),s.timestamp&&!o.timestamp&&(o.timestamp=s.timestamp),s.sessionId&&!o.sessionId&&(o.sessionId=s.sessionId),s.vpId&&!o.vpId&&(o.vpId=s.vpId),s.turnId&&!o.turnId&&(o.turnId=s.turnId),s.threadId&&!o.threadId&&(o.threadId=s.threadId),o.content?typeof o.content=="string"&&(n.startsWith(o.content)?o.content=n:o.content.endsWith(n)||(o.content+=n)):o.content=n,sn(e,t,o),!0):!1}function Xn(e,t,s){if(!t)return;let n={...s,id:s.dbMessageId||s.id||Date.now().toString()+Math.random().toString(36).substr(2,9),timestamp:Vg(s)};qr(e,t)&&!n.sessionId&&(n.sessionId=e._currentYeaftSessionId||e.yeaftActiveSessionFilter||$g),qr(e,t)&&(!n.vpId&&e._currentYeaftVpId&&(n.vpId=e._currentYeaftVpId),!n.turnId&&e._currentYeaftTurnId&&(n.turnId=e._currentYeaftTurnId),sn(e,t,n)),e.messagesMap[t]||(e.messagesMap[t]=[]);let i=Qn(s);if(i){let r=e.messagesMap[t].find(o=>Qn(o)===i);if(r)return Nr(r,n),t===e.yeaftConversationId&&e.messagesMap[t].sort((o,a)=>o.timestamp-a.timestamp),r}return e.messagesMap[t].push(n),vl(e.messagesMap[t]),t===e.yeaftConversationId&&e.messagesMap[t].sort((r,o)=>r.timestamp-o.timestamp),n}function wl(e,t,s,n={}){if(!t||!s)return;e.messagesMap[t]||(e.messagesMap[t]=[]);let i=e.messagesMap[t];if(Fg(e,t,n,s))return;let r=e._currentYeaftTurnId;if(r){for(let a=i.length-1;a>=0;a--)if(i[a].turnId===r&&i[a].type==="assistant"&&i[a].isStreaming){if(sn(e,t,i[a]),n.id&&!i[a].id&&(i[a].id=n.id),n.id&&!i[a].messageId&&(i[a].messageId=n.id),i[a].content.endsWith(s))return;i[a].content+=s;return}Xn(e,t,{...n.id?{id:n.id,messageId:n.id}:{},...n.ts?{ts:n.ts}:{},...n.timestamp?{timestamp:n.timestamp}:{},...n.sessionId?{sessionId:n.sessionId}:{},...n.vpId?{vpId:n.vpId}:{},...n.turnId?{turnId:n.turnId}:{},...n.threadId?{threadId:n.threadId}:{},type:"assistant",content:s,isStreaming:!0,status:"pending",turnStartAt:n.timestamp||Date.now()});return}let o=i[i.length-1];if(o&&o.type==="assistant"&&o.isStreaming){if(sn(e,t,o),n.id&&!o.id&&(o.id=n.id),n.id&&!o.messageId&&(o.messageId=n.id),o.content.endsWith(s))return;o.content+=s}else Xn(e,t,{...n.id?{id:n.id,messageId:n.id}:{},...n.ts?{ts:n.ts}:{},...n.timestamp?{timestamp:n.timestamp}:{},...n.sessionId?{sessionId:n.sessionId}:{},...n.vpId?{vpId:n.vpId}:{},...n.turnId?{turnId:n.turnId}:{},...n.threadId?{threadId:n.threadId}:{},type:"assistant",content:s,isStreaming:!0,status:"pending",turnStartAt:n.timestamp||Date.now()})}function kl(e,t,{completeLifecycle:s=!0}={}){if(!t)return;let n=e.messagesMap[t];if(!n||n.length===0)return;let i=e._currentYeaftTurnId||null;for(let r=n.length-1;r>=0;r--){let o=n[r];if(i&&o.turnId&&o.turnId!==i){if(o.type==="user")break;continue}if(o.isStreaming&&(o.isStreaming=!1,s&&o.status==="pending"&&(o.status="completed",o.turnEndAt=Date.now())),sn(e,t,o),o.type==="user")break}}function Sl(e,t){if(!t||e.processingConversations&&e.processingConversations[t]||e.activeVpTurns&&Object.keys(e.activeVpTurns).length>0)return;let s=e.messagesMap&&e.messagesMap[t];if(!(!s||s.length===0))for(let n of s)n&&n.isStreaming&&(n.isStreaming=!1)}function Cl(e,t){let s=e.currentConversation;if(!s)return;e.messagesMap[s]||(e.messagesMap[s]=[]);let n=e.messagesMap[s],i=null;for(let r of t)if(r.type==="user"){let o=r.message?.content;if(o){let a=typeof o=="string"?o:Array.isArray(o)?o.map(l=>l.text||"").join(""):"";a&&(i=a,e.addMessage({type:"user",content:a,isHistory:!0}))}}else if(r.type==="assistant"){let o=r.message?.content;if(o&&Array.isArray(o)){for(let a of o)if(a.type==="text"&&a.text)e.addMessage({type:"assistant",content:a.text,isHistory:!0});else if(a.type==="tool_use")e.addMessage({type:"tool-use",toolName:a.name,toolInput:a.input,isHistory:!0});else if(a.type==="tool_result"){for(let l=n.length-1;l>=0;l--)if(n[l].type==="tool-use"&&!n[l].hasResult){n[l].hasResult=!0,n[l].toolResult=a.content;break}}}}if(i&&s&&!e.conversationTitles[s]){let r=i.trim().substring(0,100);e.conversationTitles[s]=r}}function Yt(e){if(!Array.isArray(e))return null;let t=null;for(let s of e)typeof s?.dbMessageId=="number"&&s.dbMessageId>0&&(t===null||s.dbMessageId>t)&&(t=s.dbMessageId);return t}function Il(e){return{id:e.id,dbMessageId:e.id,timestamp:e.created_at}}function Al(e){return e?e.message_type==="tool_use"&&!Hg.has(e.tool_name)?{...Il(e),type:"tool-use",toolName:e.tool_name||"unknown",hasResult:!0,isHistory:!0,startTime:e.created_at||0}:Wr(e):null}function Wr(e){if(!e)return null;let t=Il(e);if(e.message_type==="tool_use"){let n={...t,type:"tool-use",toolName:e.tool_name||"unknown",toolInput:(()=>{try{return JSON.parse(e.tool_input||e.content||"{}")}catch{return{}}})(),hasResult:!0,isHistory:!0,startTime:e.created_at||0};if(e.metadata)try{let i=JSON.parse(e.metadata);i.askRequestId&&(n.askRequestId=i.askRequestId,n.askQuestions=i.askQuestions,n.askAnswered=!!i.askAnswered,n.selectedAnswers=i.selectedAnswers||null,i.askAnswered||(n.isHistory=!1))}catch{}return n}let s=n=>{if(!n)return"";if(typeof n!="string")return String(n);if(n.startsWith("["))try{let i=JSON.parse(n);if(Array.isArray(i))return i.filter(r=>r.type==="text"&&r.text).map(r=>r.text).join("")}catch{}return n};if(e.role==="user"){let n=null;if(e.metadata)try{let i=JSON.parse(e.metadata);i&&typeof i.clientMessageId=="string"&&(n=i.clientMessageId)}catch{}return{...t,type:"user",content:typeof e.content=="string"?e.content:String(e.content||""),...n?{clientMessageId:n}:{}}}else if(e.role==="assistant"){let n=s(e.content),i=(()=>{if(!e.content||typeof e.content!="string"||!e.content.startsWith("["))return[];try{let r=JSON.parse(e.content);return Array.isArray(r)?r.filter(o=>o.type==="tool_use"&&o.name):[]}catch{return[]}})();if(!n&&i.length===0)return null;if(i.length>0){let r=[];n&&r.push({...t,type:"assistant",content:n});for(let o=0;o<i.length;o++){let a=i[o];r.push({id:e.id+"_tool_"+o,dbMessageId:e.id,timestamp:e.created_at,type:"tool-use",toolName:a.name,toolInput:a.input||{},hasResult:!0,isHistory:!0,startTime:e.created_at||0})}return r}return{...t,type:"assistant",content:n}}else if(e.role==="tool"||e.message_type==="tool_result")return{...t,type:"tool_result",tool:e.tool_name||"unknown",content:typeof e.content=="string"?e.content:String(e.content||"")};return null}var $g,Hg,rn=H(()=>{Or();$g="grp_default";Hg=new Set(["TodoWrite","AskUserQuestion"])});function jt(e,t){return e._closedAt?.[t]?Date.now()-e._closedAt[t]<3e4:!1}function Cs(e,t){Ae(e,t),e._processingWatchdogs||(e._processingWatchdogs={});let s=()=>{if(!e.processingConversations[t])return;let i=e.conversations.find(o=>o.id===t);e.sendWsMessage({type:"ping_session",conversationId:t,agentId:i?.agentId});let r=setTimeout(()=>{e.processingConversations[t]&&(e.sessionHealth||(e.sessionHealth={}),e.sessionHealth[t]={status:"agent-offline"})},1e4);e._pongTimeouts||(e._pongTimeouts={}),e._pongTimeouts[t]=r},n=setTimeout(()=>{e.processingConversations[t]&&(s(),e._processingWatchdogs[t]=setInterval(()=>{if(!e.processingConversations[t]){Ae(e,t);return}s()},3e4))},45e3);e._processingWatchdogs[t]=n}function Zn(e,t){e.processingConversations[t]&&e._processingWatchdogs?.[t]&&(e._pongTimeouts?.[t]&&(clearTimeout(e._pongTimeouts[t]),delete e._pongTimeouts[t]),e.sessionHealth?.[t]&&delete e.sessionHealth[t],e._yeaftWatchdogConvs?.has(t)?Jn(e,t):Cs(e,t))}function Ae(e,t){e._processingWatchdogs?.[t]&&(clearTimeout(e._processingWatchdogs[t]),clearInterval(e._processingWatchdogs[t]),delete e._processingWatchdogs[t]),e._pongTimeouts?.[t]&&(clearTimeout(e._pongTimeouts[t]),delete e._pongTimeouts[t]),e.sessionHealth?.[t]&&delete e.sessionHealth[t],e._autoRefreshed?.[t]&&delete e._autoRefreshed[t],e._yeaftWatchdogConvs?.delete(t)}function xl(e,t){Ae(e,t),e._processingWatchdogs||(e._processingWatchdogs={}),e._processingWatchdogs[t]=setTimeout(()=>{if(e.processingConversations[t]){let s=e.conversations.find(n=>n.id===t);e.sendWsMessage({type:"refresh_conversation",conversationId:t,agentId:s?.agentId}),e._processingWatchdogs[t]=setTimeout(()=>{if(e.processingConversations[t]){delete e.processingConversations[t];let n=e.executionStatusMap[t];n&&(n.currentTool=null),e.finishStreamingForConversation(t)}delete e._processingWatchdogs[t]},1e4)}},9e4)}function Jn(e,t){Ae(e,t),e._processingWatchdogs||(e._processingWatchdogs={}),e._yeaftWatchdogConvs||(e._yeaftWatchdogConvs=new Set),e._yeaftWatchdogConvs.add(t),e._processingWatchdogs[t]=setTimeout(()=>{if(e.processingConversations[t]){delete e.processingConversations[t];let s=e.executionStatusMap[t];s&&(s.currentTool=null),e.finishStreamingForConversation(t)}delete e._processingWatchdogs[t]},15e4)}var Gt=H(()=>{});function ei(e,t){return!e||!t||e.type!=="user"||t.type!=="user"?!1:e.clientMessageId&&t.clientMessageId?e.clientMessageId===t.clientMessageId:e.clientMessageId||t.clientMessageId?!1:e.content===t.content}var Ur=H(()=>{});function zr(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Ng(){return Date.now()}function Bg(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`pt_${crypto.randomUUID()}`:`pt_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`}function Wg(e,t=160){return typeof e!="string"?e:e.length>t?`${e.slice(0,t)}...[truncated]`:e}function Ug(e){if(!e||typeof e!="object")return e||null;let t={};for(let[s,n]of Object.entries(e))s==="text"||s==="prompt"||s==="content"||s==="data"||(t[s]=typeof n=="string"?Wg(n):n);return t}function on(){return Bg()}function Xe(e,t={}){!e||!t.traceId||(Array.isArray(e._perfTraceQueue)||(e._perfTraceQueue=[]),e._perfTraceQueue.push({traceId:t.traceId,source:"web",phase:t.phase||"unknown",at:Ng(),monotonicMs:zr(),durationMs:Number.isFinite(t.durationMs)?t.durationMs:null,agentId:t.agentId||null,sessionId:t.sessionId||null,vpId:t.vpId||null,turnId:t.turnId||null,threadId:t.threadId||null,messageType:t.messageType||null,bytes:Number.isFinite(t.bytes)?t.bytes:null,ok:typeof t.ok=="boolean"?t.ok:null,detail:Ug(t.detail)}),e._perfTraceQueue.length>200&&e._perfTraceQueue.splice(0,e._perfTraceQueue.length-200),zg(e))}function zg(e){!e||e._perfTraceFlushTimer||(e._perfTraceFlushTimer=setTimeout(()=>Kg(e),250))}function Kg(e){if(!e||!Array.isArray(e._perfTraceQueue)||e._perfTraceQueue.length===0){e&&(e._perfTraceFlushTimer=null);return}let t=e._perfTraceQueue.splice(0,e._perfTraceQueue.length);e._perfTraceFlushTimer=null,typeof e.sendWsMessage=="function"&&e.sendWsMessage({type:"perf_trace_events",events:t})}function ti(e,t={}){if(typeof requestAnimationFrame!="function")return;let s=zr();requestAnimationFrame(()=>{requestAnimationFrame(()=>{Xe(e,{...t,phase:t.phase||"render.next_paint",durationMs:zr()-s})})})}var Kr=H(()=>{});function Le(e,t){let s=t==null?"__all__":String(t);return e?`${e}${s}`:s}var si=H(()=>{});function Tl(e){return typeof e=="string"&&e?e:null}function Is(e,t){return e?.yeaftSessionHistoryState?.[t]||null}function an(e){let t=e?.yeaftActiveSessionFilter||null;if(!t)try{t=(typeof window<"u"&&window.Pinia?.useSessionsStore?.())?.activeSessionId||null}catch{}if(!t)return{agentId:e?.currentAgent||null,sessionId:null,sessionKey:""};let s=typeof e?.resolveYeaftSessionAgentId=="function"?e.resolveYeaftSessionAgentId(t):e?.currentAgent||null;return{agentId:s,sessionId:t,sessionKey:Le(s,t)}}function Pl(e,{agentId:t,sessionId:s,mode:n="recent",preserveLoaded:i=!1,latestSeq:r=null}={}){if(!t||!s)return null;let o=Le(t,s),a=Is(e,o)||{},l=Number(a.generation||0)+1,c=`yeaft_history_${l}_${crypto.randomUUID()}`,d={...a,loaded:i?!!a.loaded:!1,loading:!0,error:null,requestId:c,generation:l,mode:n,requestedAt:Date.now(),latestSeq:Number.isFinite(r)?r:a.latestSeq??null};return i||(d.hasMore=!1,d.oldestSeq=null,d.count=0,d.syncingAfterSeq=null),e.yeaftSessionHistoryState={...e.yeaftSessionHistoryState||{},[o]:d},ln(e),{sessionKey:o,requestId:c,generation:l,state:d}}function Yr(e,t={}){let s=t.sessionId??t.groupId??null;if(!s)return!1;let n=t.agentId||e?.yeaftSessionAgentById?.[s]||null,i=Le(n,s),r=Is(e,i),o=Tl(t.requestId);if(!r)return o===null;let a=Tl(r.requestId);return o?o===a:a===null}function Rl(e,t={},s={}){if(!Yr(e,t))return null;let n=t.sessionId??t.groupId??null,i=t.agentId||e?.yeaftSessionAgentById?.[n]||null,r=Le(i,n),a={...Is(e,r)||{},...s,loading:!1,error:null,requestId:null,completedAt:Date.now()};return e.yeaftSessionHistoryState={...e.yeaftSessionHistoryState||{},[r]:a},ln(e),a}function _l(e,{agentId:t,sessionId:s,requestId:n,error:i="history_load_failed"}={}){if(!t||!s||!n)return!1;let r=Le(t,s),o=Is(e,r);return!o||o.requestId!==n||!o.loading?!1:(e.yeaftSessionHistoryState={...e.yeaftSessionHistoryState||{},[r]:{...o,loading:!1,error:i,requestId:null,completedAt:Date.now()}},ln(e),!0)}function ln(e){let{sessionKey:t}=an(e),s=t?Is(e,t):null;return e.yeaftLoadingMoreHistory=!!s?.loading,e.yeaftHistoryLoadError=s?.error||null,e.yeaftHasMoreHistory=!!s?.hasMore,e.yeaftOldestLoadedSeq=Number.isFinite(s?.oldestSeq)?s.oldestSeq:null,s}function jr(e){let{sessionKey:t}=an(e);return t?Is(e,t):null}var Ml,Gr=H(()=>{si();Ml=15e3});function $l(e){return e.filter(t=>!(t.type==="user"&&(!t.content||!t.content.trim())))}function Dl(e){let t=[e?.timestamp,e?.createdAt,e?.ts,e?.time,e?.created_at];for(let s of t){if(typeof s=="number"&&Number.isFinite(s)&&s>0)return s;if(typeof s=="string"&&s.trim()){let n=Date.parse(s);if(Number.isFinite(n))return n;let i=Number(s);if(Number.isFinite(i)&&i>0)return i}}return null}function Yg(e){if(!Array.isArray(e))return null;for(let t=e.length-1;t>=0;t-=1){let s=e[t];if(s?.name==="TodoWrite"&&Array.isArray(s?.input?.todos))return s.input.todos}return null}function jg(e){return Array.isArray(e?.toolCalls)?e.toolCalls.filter(t=>t?.name!=="TodoWrite").length:Number(e?.toolSummaryCount||0)||0}function Gg(e){if(!e||typeof window>"u")return null;try{let t=window.Pinia||null,s=t&&typeof t.useSessionsStore=="function"?t.useSessionsStore():null;if(!s)return null;let n=typeof t.useChatStore=="function"?t.useChatStore():null,i=typeof s.sessionById=="function"?s.sessionById(e,n?.currentAgent||null):s.sessions&&s.sessions[e];return(i&&typeof i.defaultVpId=="string"?i.defaultVpId.trim():"")||null}catch{return null}}function Qg(e,t){return e.speakerVpId||e.vpId||e.vp_id||e.authorVpId||e.authorVP||Gg(t)}function ni(e){return e&&(e.messageId||e.id)?e.messageId||e.id:null}function Vl(e){e.sort((t,s)=>(t.timestamp||0)-(s.timestamp||0))}function Xg(e,t){if(!e||!t||e.type!=="assistant"||t.type!=="assistant"||(e.sessionId??null)!==(t.sessionId??null))return!1;let s=e.speakerVpId||e.vpId||"",n=t.speakerVpId||t.vpId||"";if(s&&n&&s!==n)return!1;let i=e.threadId||"",r=t.threadId||"";if(i&&r&&i!==r||!(e.isStreaming||e.isHistory!==!0)||t._hasPersistedTurnId!==!0)return!1;let a=e.turnId||"",l=t.turnId||"";if(!a||!l||a!==l)return!1;let c=typeof e.content=="string"?e.content:"",d=typeof t.content=="string"?t.content:"";return!!c&&!!d&&(d.startsWith(c)||c.startsWith(d))}function Qr(e,t){let s=new Map,n=new Map;e.forEach((r,o)=>{let a=ni(r);a&&s.set(a,o),r?.type==="user"&&r.clientMessageId&&n.set(r.clientMessageId,o)});let i=0;for(let r of t){let o=ni(r),a=o&&s.has(o)?s.get(o):null;if(a===null&&r?.type==="user"&&r.clientMessageId&&n.has(r.clientMessageId)&&(a=n.get(r.clientMessageId)),a===null&&r?.type==="assistant"&&(a=e.findIndex(l=>Xg(l,r))),a!==null&&a>=0){let l=ni(e[a]);e[a]={...e[a],...r},o&&s.set(o,a),l&&l!==o&&s.get(l)===a&&s.delete(l),r?.type==="user"&&r.clientMessageId&&n.set(r.clientMessageId,a)}else o&&s.set(o,e.length),r?.type==="user"&&r.clientMessageId&&n.set(r.clientMessageId,e.length),e.push(r),i+=1}return Vl(e),i}function Xr(e){return e?e.sessionId??e.groupId??null:null}function Zg(e){return!e||e.type!=="user"||!e.clientMessageId?!1:ni(e)===e.clientMessageId}function Jg(e,t,s){let n=t.reduce((r,o)=>Math.max(r,o?.timestamp||0),0),i=e.filter(r=>r?s!=null&&Xr(r)!==s||r.isStreaming||r.type==="tool-use"&&r.toolName==="AskUserQuestion"&&(r.askAnswered||r.askPending||r.askExpired)||Zg(r)?!0:n>0&&(r.timestamp||0)>n:!1);return e.splice(0,e.length,...i),Qr(e,t),t.length}function em(e){if(typeof e!="string")return!1;let t=e.trimStart();return t.startsWith("<task-result ")||/^\[system note\] You have called \S+ with the same arguments \d+ times\./.test(t)}function tm(e,t){let s=typeof e.yeaftConversationId=="string"?e.yeaftConversationId:"";return s.startsWith(`yeaft-local-${t}-`)||/^yeaft-local-\d/.test(s)?s:null}function sm(e,t,s,n){let i=t.agentId||s&&e.yeaftSessionAgentById?.[s]||null;if(!i||!n||e.currentView!=="yeaft")return;let r=an(e);if(r.sessionId!==(s||null)||r.agentId&&r.agentId!==i)return;if((e.yeaftConversationId||null)===n){e.messagesMap[n]||(e.messagesMap[n]=[]),e.yeaftConversationIdsByAgent={...e.yeaftConversationIdsByAgent||{},[i]:n},e.activeConversations=[n];return}let a=tm(e,i);if(!a)return;let l=e.messagesMap[a]||[],c=e.messagesMap[n]||[];e.messagesMap[n]=nn(c,l),Vl(e.messagesMap[n]),delete e.messagesMap[a],e.processingConversations?.[a]&&(e.processingConversations[n]=!0,delete e.processingConversations[a]),e.executionStatusMap?.[a]&&(e.executionStatusMap[n]=e.executionStatusMap[a],delete e.executionStatusMap[a]),e.yeaftConversationIdsByAgent={...e.yeaftConversationIdsByAgent||{},[i]:n},e.yeaftConversationId=n,e.activeConversations=[n]}function Ft(e,t){let s=e.messagesMap[t]||[];for(let n of s)n.type==="tool-use"&&!n.hasResult&&(n.hasResult=!0,n.toolName==="AskUserQuestion"&&!n.askAnswered&&!n.selectedAnswers&&(n.isHistory=!0,n.askRequestId=null))}function Fl(e,t){gt(e);let s=e.agents.find(i=>i.id===t.agentId);e.conversations=e.conversations.filter(i=>i.id!==t.conversationId);let n=t.provider||"claude-code";if(e.conversations.push({id:t.conversationId,agentId:t.agentId,agentName:s?.name||t.agentId,workDir:t.workDir,claudeSessionId:null,createdAt:Date.now(),processing:!1,connecting:n!=="claude-code",type:"chat",provider:n,capabilities:t.capabilities||null,disallowedTools:t.disallowedTools??null}),e.currentAgent=t.agentId,e.currentAgentInfo=s,e.panels.length>1){let i=e._pendingPaneId;if(e._pendingPaneId=null,i){let r=e.panels.find(o=>o.id===i);r&&(r.conversationId=t.conversationId)}else{let r=e.panels.find(o=>!o.conversationId);r&&(r.conversationId=t.conversationId)}e.activeConversations.includes(t.conversationId)||e.activeConversations.push(t.conversationId)}else e.activeConversations=[t.conversationId];e.currentWorkDir=t.workDir,e.messagesMap[t.conversationId]=[],e.sendWsMessage({type:"select_conversation",conversationId:t.conversationId}),e.addMessage({type:"system",content:Pe("store.convCreated",{agent:s?.name||t.agentId,workDir:t.workDir})}),e.saveOpenSessions()}function Hl(e,t){gt(e);let s=e.agents.find(n=>n.id===t.agentId);if(e.conversations=e.conversations.filter(n=>n.id!==t.conversationId&&!(n.claudeSessionId&&n.claudeSessionId===t.claudeSessionId)),e.conversations.push({id:t.conversationId,agentId:t.agentId,agentName:s?.name||t.agentId,workDir:t.workDir,claudeSessionId:t.claudeSessionId,createdAt:Date.now(),processing:!1,connecting:(t.provider||"claude-code")!=="claude-code",type:"chat",provider:t.provider||"claude-code",capabilities:t.capabilities||null,disallowedTools:t.disallowedTools??null}),e.currentAgent=t.agentId,e.currentAgentInfo=s,e.panels.length>1){let n=e._pendingPaneId;if(e._pendingPaneId=null,n){let i=e.panels.find(r=>r.id===n);i&&(i.conversationId=t.conversationId)}else{let i=e.panels.find(r=>!r.conversationId);i&&(i.conversationId=t.conversationId)}e.activeConversations.includes(t.conversationId)||e.activeConversations.push(t.conversationId)}else e.activeConversations=[t.conversationId];if(e.currentWorkDir=t.workDir,e.messagesMap[t.conversationId]=[],e._pendingSessionTitle&&(e.conversationTitles[t.conversationId]=e._pendingSessionTitle,e._pendingSessionTitle=null),e.sendWsMessage({type:"select_conversation",conversationId:t.conversationId}),e.addMessage({type:"system",content:Pe("store.convResumed",{agent:s?.name||t.agentId,sessionId:t.claudeSessionId?t.claudeSessionId.slice(0,8)+"...":""})}),t.dbMessages&&t.dbMessages.length>0){let n=$l(t.dbMessages.map(o=>e.formatDbMessageForHistoryHydration(o)).flat().filter(Boolean)),i=Hr(n),r=e.messagesMap[t.conversationId]||[];for(let o of i)r.push(o)}e.hasMoreMessages=!!t.hasMoreMessages,e.chatSessionState[t.conversationId]={lastSeenDbId:Yt(e.messagesMap[t.conversationId]),hasMoreOlder:!!t.hasMoreMessages},e.saveOpenSessions()}function Zr(e,t){e.conversations=e.conversations.filter(n=>n.id!==t.conversationId),delete e.messagesMap[t.conversationId],delete e.chatSessionState[t.conversationId],delete e.conversationTitles[t.conversationId],delete e.customConversationTitles[t.conversationId],delete e.processingConversations[t.conversationId],e._closedAt&&delete e._closedAt[t.conversationId],Ae(e,t.conversationId),delete e.executionStatusMap[t.conversationId],delete e.subagents[t.conversationId],window.dispatchEvent(new CustomEvent("conversation-deleted",{detail:{conversationId:t.conversationId}}));let s=e.activeConversations.indexOf(t.conversationId);s>=0&&(e.activeConversations.splice(s,1),e.activeConversations.length===0&&e.addMessage({type:"system",content:Pe("chat.session.closed")}));for(let n of e.panels)n.conversationId===t.conversationId&&(n.conversationId=null);e.saveOpenSessions()}function Ol(e,t){let s=t.conversationId;if(s){delete e.processingConversations[s],Ae(e,s),e._closedAt||(e._closedAt={}),e._closedAt[s]=Date.now(),e._turnCompletedConvs||(e._turnCompletedConvs=new Set),e._turnCompletedConvs.add(s);let n=e.executionStatusMap[s];n&&(n.currentTool=null),e.finishStreamingForConversation(s),Ft(e,s);let i=e.conversations.find(r=>r.id===s);i&&(t.claudeSessionId&&(i.claudeSessionId=t.claudeSessionId),t.workDir&&(i.workDir=t.workDir)),e.clearStatus?.conversationId===s&&e.clearStatus?.status==="clearing"&&(e.clearStatus={conversationId:s,status:"completed"},setTimeout(()=>{e.clearStatus?.conversationId===s&&e.clearStatus?.status==="completed"&&(e.clearStatus=null)},3e3)),e.saveOpenSessions()}}function ql(e,t){let s=t.conversationId;if(s){delete e.processingConversations[s],Ae(e,s),e._closedAt||(e._closedAt={}),e._closedAt[s]=Date.now(),e._turnCompletedConvs||(e._turnCompletedConvs=new Set),e._turnCompletedConvs.add(s);let n=e.executionStatusMap[s];n&&(n.currentTool=null),e.finishStreamingForConversation(s),Ft(e,s);let i=e.conversations.find(r=>r.id===s);i&&(t.claudeSessionId&&(i.claudeSessionId=t.claudeSessionId),t.workDir&&(i.workDir=t.workDir)),e.saveOpenSessions()}}function Nl(e,t){if(t.conversationId){if(t.isProcessing&&!jt(e,t.conversationId)&&!e._turnCompletedConvs?.has(t.conversationId))e.processingConversations[t.conversationId]=!0;else if(e.processingConversations[t.conversationId]){delete e.processingConversations[t.conversationId],Ae(e,t.conversationId);let s=e.executionStatusMap[t.conversationId];s&&(s.currentTool=null),e.finishStreamingForConversation(t.conversationId)}}}function Bl(e,t){let s=t.conversationId||e.currentConversation;if(s){delete e.processingConversations[s],Ae(e,s),e._closedAt||(e._closedAt={}),e._closedAt[s]=Date.now(),e._turnCompletedConvs||(e._turnCompletedConvs=new Set),e._turnCompletedConvs.add(s);let n=e.executionStatusMap[s];n&&(n.currentTool=null),e.finishStreamingForConversation(s),Ft(e,s)}}function Wl(e,t){if(!!t.requestId){if(e.chatHistoryRequestIdSupported=!0,!e.isCurrentChatHistoryResponse?.(t))return!1}else{let r=`chat:${t.conversationId}`,o=e.chatHistoryRequests?.[r];if(e.chatHistoryRequestIdSupported===!0||!o?.loading)return!1;t={...t,requestId:o.requestId,catalogKey:r,mode:o.mode||t.mode,...o.mode==="delta"?{afterMessageId:o.cursor}:{}}}e.messagesMap[t.conversationId]||(e.messagesMap[t.conversationId]=[]);let n=e.messagesMap[t.conversationId],i=t.mode==="delta"||typeof t.afterMessageId=="number"&&t.afterMessageId>0;if(t.conversationId&&e.activeConversations.includes(t.conversationId)){let r=Hr($l((t.messages||[]).map(a=>e.formatDbMessageForHistoryHydration(a)).flat().filter(Boolean)));if(r.length>0){let a=n.find(l=>l.dbMessageId);if(a&&r[0].dbMessageId&&r[r.length-1].dbMessageId<a.dbMessageId){let l=n.indexOf(a);e.debug,n.splice(l,0,...r)}else{e.debug;for(let l of r)if(!(l.dbMessageId&&n.some(c=>c.dbMessageId===l.dbMessageId))){if(l.dbMessageId&&(l.type==="assistant"||l.type==="user")){let c=null;if(l.type==="user"?c=n.find(d=>!d.dbMessageId&&!d.isStreaming&&ei(d,l)):c=n.find(d=>!d.dbMessageId&&!d.isStreaming&&d.type==="assistant"&&d.content===l.content),c){c.dbMessageId=l.dbMessageId,c.id=l.id,l.timestamp&&(c.timestamp=l.timestamp),l.clientMessageId&&!c.clientMessageId&&(c.clientMessageId=l.clientMessageId);continue}}n.push(l)}}}i||(e.hasMoreMessages=t.hasMore??!1),gt(e);let o=e.chatSessionState[t.conversationId]?.hasMoreOlder;e.chatSessionState[t.conversationId]={lastSeenDbId:Yt(e.messagesMap[t.conversationId]),hasMoreOlder:i?!!o:!!t.hasMore}}return e.finishChatHistoryRequest?.(t)&&(e.currentConversation===t.conversationId&&(e.loadingMoreMessages=!1),e.setRefreshingSession(t.conversationId,!1)),!0}function Ul(e,t){let s=t.sessionId??null,n=t.agentId||s&&e.yeaftSessionAgentById?.[s]||null,i=t.conversationId||n&&e.yeaftConversationIdsByAgent?.[n]||e.yeaftConversationId;if(!i||!s||!Array.isArray(t.messages))return null;e.messagesMap[i]||(e.messagesMap[i]=[]);let{formatted:r}=zl(t.messages,s,"window",e.messagesMap[i]);return Qr(e.messagesMap[i],r),i}function El(e){return e?.toolId?[Xr(e)??"",e.vpId||e.speakerVpId||"",e.turnId||"",e.threadId||"main",e.toolId].join("\0"):null}function Ll(e,t,s){return e.toolName="AskUserQuestion",e.toolId=t.toolCallId,e.toolInput={questions:s},e.askQuestions=s,e.askRequestId=null,e.askPending=!1,e.pendingAnswers=null,e.askSubmitGeneration=null,e.hasResult=!0,e.isHistory=!0,t.status==="answered"?(e.askAnswered=!0,e.selectedAnswers=t.answers,e.askExpired=!1):(e.askAnswered=!1,e.selectedAnswers=null,e.askExpired=!0),e}function nm(e,t){return(e||[]).find(s=>s?.type==="tool-use"&&(s.toolName==="AskUser"||s.toolName==="AskUserQuestion")&&s.toolId===t.toolCallId&&Xr(s)===t.sessionId&&(s.vpId||s.speakerVpId||"")===(t.vpId||"")&&(s.turnId||"")===(t.turnId||"")&&(s.threadId||"main")===(t.threadId||"main"))||null}function zl(e,t,s,n){let i=new Set((n||[]).map(l=>l&&(l.messageId||l.id)).filter(Boolean)),r=new Set,o=[],a=0;for(let l of e){if(!l||l._reflection||l.internal||l.systemOnly||l.systemOnlyMessage||em(l.content))continue;let c=l.id||l.messageId||null,d=l.clientMessageId||null;if(!(c&&r.has(c))&&!(c&&s!=="recent"&&i.has(c))){if(c&&r.add(c),l.role==="user"){a+=1;let u=c||l.messageId||l.turnId||null,p=l.sessionId??l.groupId??t??null;o.push({...c?{id:c,messageId:c}:{},type:"user",content:l.content,timestamp:Dl(l),sessionId:p,turnId:l.turnId||u,...d?{clientMessageId:d}:{},...Array.isArray(l.attachments)&&l.attachments.length>0?{attachments:l.attachments}:{},...l.quote?{quote:l.quote}:{},isStreaming:!1})}else if(l.role==="assistant"){a+=1;let u=c||l.messageId||l.turnId||null,p=l.sessionId??l.groupId??t??null,f=Qg(l,p),g=Dl(l),v=!!l.turnId,m=l.turnId||u,A=typeof l.content=="string"?l.content:l.content||"",w=Array.isArray(l.todos)?l.todos:Yg(l.toolCalls);(typeof A!="string"||A.trim())&&o.push({...c?{id:c,messageId:c}:{},type:"assistant",content:A,timestamp:g,sessionId:p,turnId:m,_hasPersistedTurnId:v,...f?{vpId:f,speakerVpId:f}:{},...l.responseKind==="progress"||l.responseKind==="result"?{responseKind:l.responseKind}:{},...l.incomplete===!0?{incomplete:!0}:{},...typeof l.stopReason=="string"&&l.stopReason?{stopReason:l.stopReason}:{},isStreaming:!1,isHistory:!0}),Array.isArray(w)&&w.length>0&&o.push({...c?{id:`${c}:todos`,messageId:`${c}:todos`}:{},type:"tool-use",toolName:"TodoWrite",toolInput:{todos:w},timestamp:g,sessionId:p,turnId:m,...f?{vpId:f,speakerVpId:f}:{},isStreaming:!1,isHistory:!0,hasResult:!0});for(let y of Array.isArray(l.images)?l.images:[])y?.assetId&&o.push({id:`${c||u||m}:image:${y.assetId}`,messageId:`${c||u||m}:image:${y.assetId}`,type:"chat-image",...y,timestamp:g,sessionId:p,turnId:m,...f?{vpId:f,speakerVpId:f}:{},isStreaming:!1,isHistory:!0});for(let y of Array.isArray(l.askUserResults)?l.askUserResults:[]){if(!y?.toolCallId||y.status!=="answered"&&y.status!=="expired")continue;let h=[{question:typeof y.question=="string"?y.question:"",options:(Array.isArray(y.options)?y.options:[]).filter($=>typeof $=="string").map($=>({label:$,description:""})),multiSelect:!1}],b={toolCallId:y.toolCallId,sessionId:p,vpId:f||"",turnId:m||"",threadId:l.threadId||"main"},R=nm(n,b);if(R){Ll(R,y,h);continue}let L=Ll({id:`${c||u||m}:ask:${y.toolCallId}`,messageId:`${c||u||m}:ask:${y.toolCallId}`,type:"tool-use",timestamp:g,sessionId:p,turnId:m,threadId:b.threadId,...f?{vpId:f,speakerVpId:f}:{},isStreaming:!1},y,h),U=El(L);(!U||!o.some($=>El($)===U))&&o.push(L)}let k=jg(l);k>0&&o.push({...c?{id:`${c}:tool-summary`,messageId:`${c}:tool-summary`,persistedMessageId:c}:{},type:"tool-summary",count:k,omittedCount:k,source:"history",timestamp:g,sessionId:p,turnId:m,...f?{vpId:f,speakerVpId:f}:{},isStreaming:!1,isHistory:!0})}}}return{formatted:o,acceptedHistoryMessages:a}}function Kl(e,t){let s=t.sessionId!=null?t.sessionId:t.groupId;if(t.requestId&&typeof e.isCurrentYeaftHistoryResponse=="function"&&!e.isCurrentYeaftHistoryResponse(t))return;let n=t.mode==="recent"||t.mode==="delta"?t.mode:"older",i=Array.isArray(t.messages)?t.messages:[];t.perfTraceId&&Xe(e,{traceId:t.perfTraceId,phase:"history.chunk_received",agentId:t.agentId||null,sessionId:s||null,messageType:t.type,bytes:(()=>{try{return JSON.stringify(t).length}catch{return null}})(),detail:{mode:n,rawCount:i.length}});let r=t.agentId||(s&&e.yeaftSessionAgentById?e.yeaftSessionAgentById[s]:null),o=r&&e.yeaftConversationIdsByAgent?e.yeaftConversationIdsByAgent[r]:null,a=t.conversationId||o||e.yeaftConversationId;if(!a){e.yeaftLoadingMoreHistory=!1;return}sm(e,t,s,a),e.messagesMap[a]||(e.messagesMap[a]=[]);let{formatted:l,acceptedHistoryMessages:c}=zl(i,s,n,e.messagesMap[a]),d=0;if(n==="recent")d=Jg(e.messagesMap[a],l,s??null);else if(l.length>0)if(n==="older"){if(e.messagesMap[a].splice(0,0,...l),d=l.length,typeof e.expandYeaftMessageWindow=="function"){let y=e.yeaftActiveSessionFilter?s??null:null;e.expandYeaftMessageWindow(y,t.turns||10)}}else d=Qr(e.messagesMap[a],l);let u=Le(t.agentId||null,s),p=e.yeaftSessionHistoryState?.[u]||{},f=typeof t.latestSeq=="number"?t.latestSeq:p.latestSeq??null,g=n==="delta"?{...p,loaded:!0,loading:!1,latestSeq:f,syncingAfterSeq:null,count:(p.count||0)+d}:{loaded:!0,loading:!1,hasMore:!!t.hasMore,oldestSeq:typeof t.oldestSeq=="number"?t.oldestSeq:e.yeaftOldestLoadedSeq,count:n==="older"?(p.count||0)+d:c,latestSeq:f,syncingAfterSeq:null};t.requestId&&typeof e.finishYeaftHistoryLoad=="function"?e.finishYeaftHistoryLoad(t,g):e.yeaftSessionHistoryState&&(e.yeaftSessionHistoryState={...e.yeaftSessionHistoryState,[u]:g});let v=an(e),m=v.sessionId===(s||null),A=!t.agentId||!v.agentId||t.agentId===v.agentId,w=m&&A,k=Le(null,v.sessionId);if(t.perfTraceId&&(Xe(e,{traceId:t.perfTraceId,phase:"history.chunk_applied",agentId:t.agentId||null,sessionId:s||null,messageType:t.type,detail:{mode:n,formattedCount:l.length,insertedRows:d,acceptedHistoryMessages:c}}),ti(e,{traceId:t.perfTraceId,phase:"history.next_paint",agentId:t.agentId||null,sessionId:s||null,messageType:t.type,detail:{mode:n,insertedRows:d}})),w)e.yeaftHasMoreHistory=g.hasMore,typeof t.oldestSeq=="number"&&(e.yeaftOldestLoadedSeq=t.oldestSeq),e.yeaftLoadingMoreHistory=!1;else if(e.yeaftLoadingMoreHistory){let y=e.yeaftSessionHistoryState?.[v.sessionKey]||e.yeaftSessionHistoryState?.[k]||null;e.yeaftLoadingMoreHistory=!!y?.loading}}var ii=H(()=>{Gt();Kt();Ur();rn();Or();St();Kr();Gr();si()});function Yl(e,t){if(e.promoteYeaftHistoryOutlineRow?.(t))return;let s=t?.sessionId??t?.groupId??e._currentYeaftSessionId??null;s&&e.invalidateYeaftHistoryOutline?.(s)}function im(e){let t=e;if(typeof t=="string"){let s=t.trim();if(s.startsWith("[")&&s.endsWith("]")||s.startsWith("{")&&s.endsWith("}"))try{t=JSON.parse(s)}catch{t=e}}return Array.isArray(t)?t.map(s=>typeof s=="string"?s:!s||typeof s!="object"?"":s.type==="text"&&typeof s.text=="string"||s.type==="input_text"&&typeof s.text=="string"?s.text:"").join("").replace(/\n\n\[Uploaded files\][\s\S]*$/m,"").trim():t&&typeof t=="object"?typeof t.text=="string"?t.text.trim():typeof t.content=="string"?t.content.trim():"":typeof t=="string"?t.replace(/\n\n\[Uploaded files\][\s\S]*$/m,"").trim():""}function Jr(e,t){return e.executionStatusMap[t]||(e.executionStatusMap[t]={currentTool:null,toolHistory:[],lastActivity:null}),e.executionStatusMap[t]}function jl(e,t,s){if(!t)return;let n=Jr(e,t);if(n.lastActivity=Date.now(),Zn(e,t),s.type==="system"){if(s.subtype==="init"){let i=e.conversations.find(r=>r.id===t);i&&i.connecting&&(i.connecting=!1);return}s.message&&e.addMessageToConversation(t,{type:"system",content:typeof s.message=="string"?s.message:JSON.stringify(s.message,null,2)});return}if(s.type==="assistant"){let i=s.message?.content;if(!i)return;let r=e.messagesMap[t]||[];for(let o of r)o.type==="tool-use"&&!o.hasResult&&(o.hasResult=!0);for(let o of n.toolHistory)o.status==="running"&&(o.status="done");if(n.currentTool=null,typeof i=="string"){e.appendToAssistantMessageForConversation(t,i,{id:s.message?.id||s.message?.messageId||null,ts:s.ts||s.message?.ts||s.message?.time||null,sessionId:e._currentYeaftSessionId||null,vpId:e._currentYeaftVpId||null,turnId:e._currentYeaftTurnId||null,threadId:e._currentYeaftThreadId||null});return}if(!Array.isArray(i))return;if(i.length===0){e.finishStreamingForConversation(t);return}for(let o of i)o.type==="text"?e.appendToAssistantMessageForConversation(t,o.text,{id:s.message?.id||s.message?.messageId||null,ts:s.ts||s.message?.ts||s.message?.time||null,sessionId:e._currentYeaftSessionId||null,vpId:e._currentYeaftVpId||null,turnId:e._currentYeaftTurnId||null,threadId:e._currentYeaftThreadId||null}):o.type==="image_asset"&&o.image?e.addMessageToConversation(t,{type:"chat-image",...o.image,sessionId:e._currentYeaftSessionId||null,vpId:e._currentYeaftVpId||null,speakerVpId:e._currentYeaftVpId||null,turnId:e._currentYeaftTurnId||null,threadId:e._currentYeaftThreadId||null}):o.type==="tool_summary"?e.addMessageToConversation(t,{type:"tool-summary",count:Number(o.count||o.omittedCount||0)||0,omittedCount:Number(o.omittedCount||o.count||0)||0,source:o.source||"history",isHistory:o.source!=="live",sessionId:e._currentYeaftSessionId||null,vpId:e._currentYeaftVpId||null,turnId:e._currentYeaftTurnId||null,threadId:e._currentYeaftThreadId||null}):o.type==="tool_use"&&(e.finishStreamingForConversation(t,{completeLifecycle:!1}),n.currentTool={name:o.name,input:o.input,startTime:Date.now()},n.toolHistory.unshift({name:o.name,input:o.input,timestamp:Date.now(),status:"running"}),n.toolHistory.length>20&&n.toolHistory.pop(),e.addMessageToConversation(t,{type:"tool-use",toolId:o.id||o.tool_use_id||null,toolName:o.name,toolInput:o.input,startTime:Date.now(),sessionId:e._currentYeaftSessionId||null,vpId:e._currentYeaftVpId||null,turnId:e._currentYeaftTurnId||null,threadId:e._currentYeaftThreadId||null}))}else if(s.type==="user"){let i=s.internal===!0||s.message?.internal===!0||s.userAuthored===!1||s.message?.userAuthored===!1,r=s.message?.content,o=im(r);if(typeof o=="string"&&(o.includes("<local-command-caveat>")||o.includes("<command-name>")))return;if(typeof o=="string"&&o.includes("<local-command-stdout>")){let l=o.match(/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/);if(l){e.appendToAssistantMessageForConversation(t,l[1].trim()),e.finishStreamingForConversation(t);return}}let a=[];if(s.tool_use_result)a=Array.isArray(s.tool_use_result)?s.tool_use_result:[s.tool_use_result];else if(s.message?.content){let l=s.message.content;a=(Array.isArray(l)?l:[]).filter(d=>d.type==="tool_result")}if(a.length>0){let l=e.messagesMap[t]||[];for(let c of a){if(n.toolHistory.length>0){let f=n.toolHistory.findIndex(g=>g.status==="running");f>=0&&(n.toolHistory[f].status="done")}let d=c.tool_use_id||c.toolUseId||c.tool_call_id||c.toolCallId||null,u=c.content||c,p=!1;if(d){for(let f=l.length-1;f>=0;f--)if(l[f].type==="tool-use"&&l[f].toolId===d){l[f].hasResult=!0,l[f].toolResult=c.is_update&&l[f].toolResult?`${l[f].toolResult}
2
2
 
3
- ${u}`:u,p=!0;break}}if(!p){for(let f=l.length-1;f>=0;f--)if(l[f].type==="tool-use"&&!l[f].hasResult){l[f].hasResult=!0,l[f].toolResult=u;break}}}n.currentTool=null}else if(!i&&(typeof o=="string"&&o.trim()||Array.isArray(s.message?.attachments)&&s.message.attachments.length>0)){let l=s.message?.clientMessageId||s.clientMessageId||null,c={type:"user",content:o,clientMessageId:l},d=e.messagesMap[t]||[];if(d.some(p=>ei(p,c))){if(l){for(let p=d.length-1;p>=0;p--)if(d[p].type==="user"&&d[p].clientMessageId===l){s.dbMessageId&&!d[p].dbMessageId&&(d[p].dbMessageId=s.dbMessageId),s.message?.id&&!d[p].messageId&&(d[p].id=s.message.id,d[p].messageId=s.message.id),s.ts&&!d[p].ts&&(d[p].ts=s.ts),Yl(e,d[p]);break}}}else{let p=e.addMessageToConversation(t,{...s.message?.id?{id:s.message.id,messageId:s.message.id}:{},...s.ts?{ts:s.ts}:{},type:"user",content:o,...s.message?.attachments?{attachments:s.message.attachments}:{},...s.message?.quote?{quote:s.message.quote}:{},...l?{clientMessageId:l}:{}});Yl(e,p)}}}else if(s.type==="result"){delete e.processingConversations[t],Ae(e,t);let i=e.conversations.find(c=>c.id===t);i&&i.connecting&&(i.connecting=!1);let r=e._currentYeaftSessionId||null;if(e._currentYeaftTurnId){let c=Object.entries(e.activeVpTurns||{}).find(([,d])=>(d?.turnId===e._currentYeaftTurnId||!d?.turnId&&d===e.activeVpTurns[e._currentYeaftTurnId])&&(!e._currentYeaftAgentId||!d?.agentId||d.agentId===e._currentYeaftAgentId));if(c){let[d,u]=c,{[d]:p,...f}=e.activeVpTurns;!r&&u?.sessionId&&(r=u.sessionId),e.activeVpTurns=f}}if(r&&e._currentYeaftVpId&&e.vpStatuses){let c=e._currentYeaftTurnId||null,d={...e.vpStatuses||{}},u=!1;for(let[p,f]of Object.entries(d))!f||f.vpId!==e._currentYeaftVpId||e._currentYeaftAgentId&&f.agentId&&f.agentId!==e._currentYeaftAgentId||(f.sessionId||f.groupId||null)!==r||c&&f.turnId&&f.turnId!==c||(d[p]={...f,state:"idle",turnId:null,since:Date.now()},u=!0);u&&(e.vpStatuses=d)}r&&typeof e.clearYeaftSessionProcessingIfIdle=="function"&&e.clearYeaftSessionProcessingIfIdle(r,{agentId:e._currentYeaftAgentId||null}),e._closedAt||(e._closedAt={}),e._closedAt[t]=Date.now(),e._turnCompletedConvs||(e._turnCompletedConvs=new Set),e._turnCompletedConvs.add(t),n.currentTool=null,Ft(e,t);let o=e.messagesMap[t]||[],a=s.result_text||"";if(typeof a=="string"&&a.trim()){let c=!1;for(let d=o.length-1;d>=0;d--){if(o[d].type==="assistant"){c=!0;break}if(o[d].type==="user")break}c||e.appendToAssistantMessageForConversation(t,a.trim())}e.finishStreamingForConversation(t),!e.promoteCompletedYeaftHistoryOutline?.(t,e._currentYeaftTurnId||null)&&r&&e.invalidateYeaftHistoryOutline?.(r),e.sweepStaleStreamingForConversation(t)}}var Gl=H(()=>{Gt();ii();Ur()});function Qt(e){if(e==null)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function ri(e,t){if(!t)return e??null;if(Object.prototype.hasOwnProperty.call(t,"base"))return Qt(t.base)??null;if(Object.prototype.hasOwnProperty.call(t,"replacement"))return Qt(t.replacement)??null;let s=e&&typeof e=="object"&&!Array.isArray(e)?Qt(e):{};if(t.set&&typeof t.set=="object")for(let[n,i]of Object.entries(t.set))s[n]=Qt(i);if(t.body&&typeof t.body=="object"){let n=s.body&&typeof s.body=="object"&&!Array.isArray(s.body)?{...s.body}:{};for(let[r,o]of Object.entries(t.body))r==="messages"||r==="messagesFrom"||r==="messagesAppend"||r==="messagesKey"||(n[r]=Qt(o));let i=t.body.messagesKey==="messages"||t.body.messagesKey==="input"?t.body.messagesKey:Array.isArray(n.messages)||Object.prototype.hasOwnProperty.call(t.body,"messages")?"messages":"input";if(Array.isArray(t.body.messages))n[i]=Qt(t.body.messages)||[];else if(Array.isArray(t.body.messagesAppend)){let r=Array.isArray(n[i])?n[i]:[],o=Number.isFinite(Number(t.body.messagesFrom))?Number(t.body.messagesFrom):r.length;n[i]=r.slice(0,o).concat(Qt(t.body.messagesAppend)||[])}s.body=n}return s}function Ql(e,t){return!t||!Object.prototype.hasOwnProperty.call(t,"rawRequestDelta")?e??null:ri(e??null,t.rawRequestDelta)}function cn(e){if(!e)return 0;let t=typeof e=="string"?e:String(e),s=0,n=0;for(let i of t){let r=i.codePointAt(0)||0;r>=19968&&r<=40959||r>=12352&&r<=12447||r>=12448&&r<=12543||r>=44032&&r<=55215?s+=1:n+=1}return Math.ceil(s+n/4)}function om(e){let t=[],s=[];if(!e)return{messageText:t,toolText:s};let n=e.content;if(typeof n=="string")e.role==="tool"?s.push(n):t.push(n);else if(Array.isArray(n))for(let i of n){if(!i||typeof i!="object")continue;let r=i.type;if(r==="text"&&typeof i.text=="string")t.push(i.text);else if(r==="tool_use"){if(s.push(String(i.name||"")),i.input!==void 0)try{s.push(JSON.stringify(i.input))}catch{}}else if(r==="tool_result"){let o=i.content;if(typeof o=="string")s.push(o);else if(Array.isArray(o)){for(let a of o)if(a)if(typeof a=="string")s.push(a);else if(typeof a=="object"&&typeof a.text=="string")s.push(a.text);else try{s.push(JSON.stringify(a))}catch{}}else if(o!==void 0)try{s.push(JSON.stringify(o))}catch{}}else try{t.push(JSON.stringify(i))}catch{}}if(Array.isArray(e.toolCalls)){for(let i of e.toolCalls)if(i&&(s.push(String(i.name||"")),i.input!==void 0))try{s.push(JSON.stringify(i.input))}catch{}}return{messageText:t,toolText:s}}function Xl(e){let t=0,s=0;if(e&&Array.isArray(e.messages))for(let r of e.messages){let{messageText:o,toolText:a}=om(r);for(let l of o)t+=cn(l);for(let l of a)s+=cn(l)}let n=0,i=0;if(e&&typeof e.response=="string"&&(n+=cn(e.response)),e&&Array.isArray(e.toolCalls)){for(let r of e.toolCalls)if(r&&(i+=cn(String(r.name||"")),r.input!==void 0))try{i+=cn(JSON.stringify(r.input))}catch{}}return{inputMessageTokens:t,inputToolTokens:s,outputMessageTokens:n,outputToolTokens:i,inputTotalEstimated:t+s,outputTotalEstimated:n+i}}function eo(e,t,s){let n=Math.max(0,Math.floor(Number(e)||0)),i=Math.max(0,Number(t)||0),r=Math.max(0,Number(s)||0),o=i+r;if(n===0)return{message:0,tool:0};if(o===0)return{message:n,tool:0};let a=Math.round(i/o*n),l=Math.min(n,Math.max(0,a));return{message:l,tool:n-l}}function Zl(e){if(e==null||e==="")return"";let t;if(typeof e=="number")t=e;else if(typeof e=="string"){let o=Date.parse(e);if(Number.isNaN(o)){let a=Number(e);if(!Number.isFinite(a))return"";t=a}else t=o}else return"";if(!Number.isFinite(t))return"";let s=new Date(t),n=String(s.getHours()).padStart(2,"0"),i=String(s.getMinutes()).padStart(2,"0"),r=String(s.getSeconds()).padStart(2,"0");return`${n}:${i}:${r}`}var to=H(()=>{});function am(e,t){if(!e||!!!t?.online)return!1;let n=!e.online,i=e.online&&e.version!=null&&t.version!=null&&e.version!==t.version;return n||i}function Jl(e,t){let s=e.lastViewedConversation||localStorage.getItem("lastViewedConversation");if(!s)return!1;let n=e.conversations.find(r=>r.id===s);if(!n)return!1;let i=t?.agentId||e.currentAgent;return t&&(e.currentAgent=t.agentId,e.currentAgentInfo=t.agentInfo,e.sendWsMessage({type:"select_agent",agentId:t.agentId,silent:!0})),e.activeConversations=[s],e.currentWorkDir=n.workDir,e.messagesMap[s]=[],e.sendWsMessage({type:"select_conversation",conversationId:s}),e.requestChatHistory?.(s,{mode:"recent",turns:5}),e.sendWsMessage({type:"refresh_conversation",conversationId:s}),!0}function ec(e,t){let s=Array.isArray(e.agents)?e.agents:[],n=e._hasHandledAgentList===!0,i=e.currentAgent||null,r=!!(i&&s.some(a=>a&&a.id===i&&a.online));e.agents=t.agents,e._hasHandledAgentList=!0;let o=e.currentAgent||null;if(o){let a=e._yeaftAgentSeen&&e._yeaftAgentSeen.id===o?e._yeaftAgentSeen:null,l=t.agents.find(c=>c.id===o)||null;e.currentView==="yeaft"&&am(a,l)&&(e._yeaftReconnectCatchUpPending=!0),l?e._yeaftAgentSeen={id:o,online:!!l.online,version:l.version!=null?l.version:null}:a?a.online&&(e._yeaftAgentSeen={id:o,online:!1,version:a.version}):e._yeaftAgentSeen={id:o,online:!1,version:null}}{let a=new Set(t.agents.map(l=>l.id));for(let l of t.agents)e.proxyPorts[l.id]=l.proxyPorts||[],l.yeaftStatus&&typeof e.cacheYeaftAgentStatus=="function"&&e.cacheYeaftAgentStatus(l.id,l.yeaftStatus);for(let l of Object.keys(e.proxyPorts))a.has(l)||delete e.proxyPorts[l]}if(e.currentAgent){let a=t.agents.find(l=>l.id===e.currentAgent);a&&(e.currentAgentInfo=a)}if(e.currentView==="yeaft"&&!e.currentAgent){let a=t.agents.find(l=>l.online);a&&(e.currentAgent=a.id,e.currentAgentInfo=a)}if(e.currentView==="yeaft"&&typeof e.loadOpenedYeaftSessionsForConnectedAgents=="function"){let a=t.agents.filter(l=>l&&l.online&&l.id).map(l=>l.id);e.loadOpenedYeaftSessionsForConnectedAgents(a)}{let a=[],l=new Set;for(let d of t.agents)for(let u of d.conversations||[])l.has(u.id)||(l.add(u.id),a.push({...u,type:u.type,agentId:d.id,agentName:d.name}),u.title&&(u.customTitle&&(e.customConversationTitles[u.id]=u.title),e.conversationTitles[u.id]||(e.conversationTitles[u.id]=u.title)));for(let d of a){d.agentOnline=!0;let u=e.conversations.find(p=>p.id===d.id);if(u)u.claudeSessionId=d.claudeSessionId||u.claudeSessionId,u.processing=d.processing,u.userId=d.userId,u.username=d.username,u.agentId=d.agentId,u.agentName=d.agentName,u.agentOnline=!0,d.type&&(u.type=d.type),d.name!==void 0&&(u.name=d.name);else{let p=e._recentlyDeletedSessions?.[d.id];if(p&&Date.now()-p<15e3)continue;e.conversations.push(d)}d.pinned&&!e.pinnedSessions.includes(d.id)&&e.pinnedSessions.push(d.id)}let c=new Set(t.agents.map(d=>d.id));e.conversations=e.conversations.filter(d=>{if(l.has(d.id)||e.activeConversations.includes(d.id))return!0;if(d.agentId&&c.has(d.agentId)){let u=e._recentlyDeletedSessions?.[d.id];return u&&Date.now()-u<15e3||(delete e.messagesMap[d.id],delete e.processingConversations[d.id],Ae(e,d.id),delete e.executionStatusMap[d.id]),!1}return d.agentId&&!c.has(d.agentId)&&(d.agentOnline=!1),!0});for(let d of a)if(d.processing&&!jt(e,d.id)&&!e._turnCompletedConvs?.has(d.id))e.processingConversations[d.id]=!0;else if(e.processingConversations[d.id]){delete e.processingConversations[d.id],Ae(e,d.id);let u=e.executionStatusMap[d.id];u&&(u.currentTool=null),e.finishStreamingForConversation(d.id)}for(let d of Object.keys(e.processingConversations))if(!l.has(d)){if(d.startsWith("yeaft-"))continue;delete e.processingConversations[d],Ae(e,d);let u=e.executionStatusMap[d];u&&(u.currentTool=null),e.finishStreamingForConversation(d)}}if(localStorage.setItem("pinned-sessions",JSON.stringify(e.pinnedSessions)),e._closedAt){let a=Date.now();for(let l of Object.keys(e._closedAt))a-e._closedAt[l]>3e4&&(delete e._closedAt[l],e._turnCompletedConvs?.delete(l))}if(e.currentAgent){let a=t.agents.find(l=>l.id===e.currentAgent&&l.online);if(a){let l=!!e._yeaftReconnectCatchUpPending,d=l||n&&!r;if(e.currentAgentInfo=a,d&&(e._offlineConversationRestoreKey=null,e.sendWsMessage({type:"select_agent",agentId:e.currentAgent,silent:!0})),e.currentView==="yeaft"&&typeof e.requestYeaftSessionBootstrap=="function"){e._yeaftReconnectCatchUpPending=!1;let u=l||!e.yeaftSessionReady||!e.yeaftModel||!e.yeaftStatus;(u||l)&&e.requestYeaftSessionBootstrap({forceSessionReady:u,catchUpHistory:l})}if(!d)return;if(e.currentConversation){let u=e.conversations.find(g=>g.id===e.currentConversation);e.sendWsMessage({type:"select_conversation",conversationId:e.currentConversation});let p=e.messagesMap[e.currentConversation]||[],f=Yt(p);f!=null?e.requestChatHistory?.(e.currentConversation,{mode:"delta",afterMessageId:f}):e.requestChatHistory?.(e.currentConversation,{mode:"recent",turns:5}),e.sendWsMessage({type:"refresh_conversation",conversationId:e.currentConversation})}else e.recoveryDismissed||Jl(e);return}else{let l=`${e.currentAgent||""}:${e.currentConversation||""}`;e.currentConversation&&(!n||r||e._offlineConversationRestoreKey!==l)&&(e._offlineConversationRestoreKey=l,e.sendWsMessage({type:"select_conversation",conversationId:e.currentConversation}));return}}if(!e.currentConversation&&!e.currentAgent&&!e.recoveryDismissed){let a=e.lastViewedConversation||localStorage.getItem("lastViewedConversation"),l=e.lastUsedAgent;if(a){let c=e.conversations.find(d=>d.id===a);if(c){let d=t.agents.find(u=>u.id===c.agentId&&u.online);if(d){Jl(e,{agentId:c.agentId,agentInfo:d});return}}}l&&(e.agents.find(d=>d.id===l&&d.online)?e.selectAgent(l):e.checkPendingRecovery())}}function tc(e,t){let s=e.pendingAgentSelection||null;if(s){if(!(typeof t.requestId=="string"&&t.requestId?t.requestId===s.requestId:t.agentId===s.agentId))return!1;if(e.pendingAgentSelection=null,t.ok===!1)return e.agentSwitching=!1,!1}else{if(t.requestId)return!1;if(e.currentAgent&&t.agentId!==e.currentAgent)return!1}e.agentSwitching=!1;let n=e.currentAgent===t.agentId,i={id:t.agentId,name:t.agentName,workDir:t.workDir,capabilities:t.capabilities||["terminal","file_editor","background_tasks"],version:t.version||null};if(typeof e.activateYeaftAgent=="function"?e.activateYeaftAgent(t.agentId,i):(e.currentAgent=t.agentId,e.currentAgentInfo=i),Array.isArray(t.slashCommands)){let u=[...new Set(t.slashCommands)];e.slashCommandsMap[`agent:${t.agentId}`]=u}t.slashCommandDescriptions&&(e.slashCommandDescriptions={...e.slashCommandDescriptions,...t.slashCommandDescriptions});let r=t.conversations||[],o=new Set,a=r.filter(u=>o.has(u.id)?!1:(o.add(u.id),!0)).map(u=>({...u,agentId:t.agentId,agentName:t.agentName}));if(n&&e.currentConversation){let u=r.find(p=>p.id===e.currentConversation);u&&!a.find(p=>p.id===u.id)&&a.push({...u,agentId:t.agentId,agentName:t.agentName})}let l=new Set(a.map(u=>u.id)),c=e.conversations.filter(u=>!l.has(u.id));e.conversations=[...c,...a];for(let u of r)u.title&&(u.customTitle&&(e.customConversationTitles[u.id]=u.title),e.conversationTitles[u.id]||(e.conversationTitles[u.id]=u.title));let d=new Set(r.map(u=>u.id));for(let u of r)if(u.processing&&!jt(e,u.id)&&!e._turnCompletedConvs?.has(u.id))e.processingConversations[u.id]=!0;else if(e.processingConversations[u.id]){delete e.processingConversations[u.id],Ae(e,u.id);let p=e.executionStatusMap[u.id];p&&(p.currentTool=null),e.finishStreamingForConversation(u.id)}for(let u of Object.keys(e.processingConversations))if(!d.has(u)){if(u.startsWith("yeaft-"))continue;if(!c.some(f=>f.id===u)){delete e.processingConversations[u],Ae(e,u);let f=e.executionStatusMap[u];f&&(f.currentTool=null),e.finishStreamingForConversation(u)}}if(n&&e.currentConversation){let u=e.conversations.find(p=>p.id===e.currentConversation);e.currentWorkDir=u?.workDir||e.currentWorkDir||t.workDir,gt(e),e.sendWsMessage({type:"select_conversation",conversationId:e.currentConversation})}else{e.activeConversations=[],e.currentWorkDir=t.workDir;let u=e.lastViewedConversation||localStorage.getItem("lastViewedConversation");u&&e.conversations.find(p=>p.id===u)&&(e.autoRestoreConversation(u),e.pendingRecovery=null)}return Ya(e),!0}var sc=H(()=>{Gt();Kt();rn()});function lm(e={}){return{providers:e.providers||[],primaryModel:e.primaryModel||null,fastModel:e.fastModel||null,language:e.language||"en"}}function pm(){return window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore()}function fm(e,t){let s=t.agentId||null,n=Array.isArray(e.yeaftSessionHydrateSlices)?e.yeaftSessionHydrateSlices.filter(i=>i.agentId!==s):[];e.yeaftSessionHydrateSlices=[...n,{agentId:s,sessions:Array.isArray(t.sessions)?t.sessions:[]}]}function gm(e){let t=e.yeaftActiveSessionFilter||null;if(!t)try{t=localStorage.getItem("lastViewedYeaftSession")||null}catch{}let s=t&&typeof e.resolveYeaftSessionAgentId=="function"?e.resolveYeaftSessionAgentId(t):e.currentAgent||null;return{sessionId:t,agentId:s}}function nc(e){let t=pm(),s=gm(e);typeof t?.beginInventoryCommit=="function"?t.beginInventoryCommit(s.sessionId,s.agentId):typeof t?.resetInventory=="function"&&t.resetInventory();let n=Array.isArray(e.yeaftSessionHydrateSlices)?e.yeaftSessionHydrateSlices:[],i=s.agentId?[...n.filter(r=>r.agentId===s.agentId),...n.filter(r=>r.agentId!==s.agentId)]:n;i.length===0&&t?.applySnapshot?.([],null);for(let r of i)t?.applySnapshot?.(r.sessions||[],r.agentId||null);e.yeaftSessionHydrateSlices=[]}function mm(e){let t=e.yeaftSessionHydrateRequestId||null;e.yeaftSessionInventoryCompleteSupported!==!1||!t||(clearTimeout(e._legacyYeaftSessionHydrateTimer),e._legacyYeaftSessionHydrateTimer=setTimeout(()=>{e.yeaftSessionHydrateRequestId===t&&(e._legacyYeaftSessionHydrateTimer=null,nc(e),e._hasHandledYeaftSessionHydrate=!0,e.yeaftSessionHydrateRequestId=null,e.yeaftSessionHydrateError=null,e._yeaftSessionInventorySocketQuarantined=!0)},um))}function hm(e,t={}){let s=e||{systemPrompt:"",messages:[],rawRequest:null},n={systemPrompt:s.systemPrompt||"",messages:Array.isArray(s.messages)?[...s.messages]:[],rawRequest:s.rawRequest??null};if(t?.base){let i={systemPrompt:t.systemPrompt||"",messages:Array.isArray(t.messages)?t.messages:[],rawRequest:null};return Object.prototype.hasOwnProperty.call(t,"rawRequestDelta")&&(i.rawRequest=ri(null,t.rawRequestDelta)),i}if(typeof t?.systemPrompt=="string"&&(n.systemPrompt=t.systemPrompt),Array.isArray(t?.messages))n.messages=t.messages;else if(Array.isArray(t?.messagesAppend)){let i=Number.isFinite(Number(t.messagesFrom))?Number(t.messagesFrom):n.messages.length;n.messages=n.messages.slice(0,i).concat(t.messagesAppend)}return Object.prototype.hasOwnProperty.call(t||{},"rawRequestDelta")&&(n.rawRequest=ri(n.rawRequest,t.rawRequestDelta)),n}function vm(e=[]){let t=new Map;return e.map(s=>{if(!s||!s.requestDelta)return s;let n=s.turnId||"__unknown__",i=t.get(n)||s.requestBase||null,r=i?.rawRequest??null,o=hm(i,s.requestDelta);return t.set(n,o),{...s,systemPrompt:typeof s.systemPrompt=="string"&&s.systemPrompt?s.systemPrompt:o.systemPrompt,messages:Array.isArray(s.messages)&&s.messages.length>0?s.messages:o.messages,rawRequest:s.rawRequest??null,rawRequestBase:r}})}function ic(e,t){let s=Me();switch(e._lastPongAt=Date.now(),t.type){case"work_center_response":{let n=t.requestId?e.workCenterPending[t.requestId]:null;if(!n)break;clearTimeout(n.timer),delete e.workCenterPending[t.requestId],t.ok?n.resolve(t.data):n.reject(new Error(t.error||"Work Center request failed"));break}case"work_center_event":e.applyWorkCenterEvent(t.agentId,t.event);break;case"auth_result":if(t.success){if(e.authenticated=!0,t.sessionKey&&(e.sessionKey=lt(t.sessionKey),s.setSessionKey(t.sessionKey)),t.acceptPlaintext===!0&&(e.serverEncryptionRequired=!1),e.yeaftSessionInventoryCompleteSupported=t.yeaftSessionInventoryComplete===!0,e.yeaftSessionHydrateSlices=[],e._hasHandledYeaftSessionHydrate=!1,e.yeaftSessionHydrateError=null,t.role&&(s.role=t.role),typeof e.requestYeaftSessionInventory=="function")e.requestYeaftSessionInventory();else{let n=e.conversations.map(i=>i.id).filter(Boolean);e.sendWsMessage({type:"get_agents",conversationIds:n.length>0?n:void 0})}e.checkPendingRecovery()}else e.addMessage({type:"error",content:t.error||Pe("login.error.loginFailed")}),s.handleAuthFailure?.(void 0,t._wsAuthToken,t._wsAuthGeneration);break;case"agent_list":ec(e,t),e.workCenterOpen&&e.workCenterAgentId&&e.listWorkItems(e.workCenterAgentId).catch(()=>{});break;case"yeaft_session_hydrate":{if(e.yeaftSessionInventoryCompleteSupported===!0&&(!t.requestId||t.requestId!==e.yeaftSessionHydrateRequestId)||e.yeaftSessionInventoryCompleteSupported!==!0&&!e.yeaftSessionHydrateRequestId||t.requestId&&e.yeaftSessionHydrateRequestId&&t.requestId!==e.yeaftSessionHydrateRequestId)break;fm(e,t),e.yeaftSessionInventoryCompleteSupported!==!0&&mm(e);break}case"yeaft_session_hydrate_complete":if(e.yeaftSessionInventoryCompleteSupported===!0&&(!t.requestId||t.requestId!==e.yeaftSessionHydrateRequestId)||e.yeaftSessionHydrateRequestId&&!t.requestId||t.requestId&&e.yeaftSessionHydrateRequestId&&t.requestId!==e.yeaftSessionHydrateRequestId)break;clearTimeout(e._legacyYeaftSessionHydrateTimer),e._legacyYeaftSessionHydrateTimer=null,t.ok!==!1?nc(e):e.yeaftSessionHydrateSlices=[],e.yeaftSessionHydrateRequestId=null,e._hasHandledYeaftSessionHydrate=t.ok!==!1,e.yeaftSessionHydrateError=t.ok===!1?t.error||"session_inventory_failed":null;break;case"session_catalog_snapshot":e.applySessionCatalogSnapshot(t.catalog);break;case"session_ui_metadata_updated":{if(!e.finishSessionCatalogMutation?.(t)||t.ok!==!0)break;let n=e.sessionCatalog.find(i=>i.catalogKey===t.catalogKey);n&&(n.pinned=t.pinned===!0,n.sortRank=Number.isFinite(t.sortRank)?t.sortRank:null);break}case"session_catalog_reorder_result":e.finishSessionCatalogMutation?.(t);break;case"agent_selected":if(!tc(e,t))break;e.workCenterOpen&&e.workCenterAgentId&&e.listWorkItems(e.workCenterAgentId).catch(()=>{});break;case"conversation_created":Fl(e,t);break;case"conversation_resumed":Hl(e,t);break;case"conversation_selected":if(e.currentConversation===t.conversationId)return;e.activeConversations=[t.conversationId];{let n=e.conversations.find(i=>i.id===t.conversationId);n&&(e.currentWorkDir=n.workDir)}e.messagesMap[t.conversationId]=[],e.saveOpenSessions();break;case"conversation_settings_updated":{let n=e.conversations.find(r=>r.id===t.conversationId);n&&t.disallowedTools!==void 0&&(n.disallowedTools=t.disallowedTools);let i=e.conversationMcpServers[t.conversationId];if(i&&t.disallowedTools){let r=new Set(t.disallowedTools),o=e.conversationMcpServerTools[t.conversationId]||{};for(let a of i){let l=o[a.name];l&&l.length>0?a.enabled=!l.some(c=>r.has(c)):a.enabled=!r.has(`mcp__${a.name}`)}}t.needRestart&&n&&(n.needRestart=!0);break}case"sync_messages_result":Wl(e,t);break;case"conversation_deleted":Zr(e,t);break;case"conversation_delete_result":t.ok&&Zr(e,t);break;case"turn_completed":Ol(e,t);break;case"conversation_closed":ql(e,t);break;case"claude_output":e.handleAssistantOutputFrame(t.conversationId,t.data);break;case"yeaft_output":case"yeaft_session_output":case"session_output":e.handleYeaftOutput(t);break;case"yeaft_asset_ready":{let n=t.conversationId||e.yeaftConversationId;if(!n||!t.image)break;e.messagesMap[n]||(e.messagesMap[n]=[]),e.messagesMap[n].some(r=>r?.type==="chat-image"&&r.assetId===t.image.assetId&&r.sessionId===t.sessionId&&r.turnId===t.turnId)||e.addMessageToConversation(n,{type:"chat-image",...t.image,sessionId:t.sessionId||null,vpId:t.vpId||null,speakerVpId:t.vpId||null,turnId:t.turnId||null,threadId:t.threadId||null});break}case"yeaft_history_chunk":Kl(e,t);break;case"yeaft_history_outline":e.handleYeaftHistoryOutline(t);break;case"yeaft_history_search_result":e.handleYeaftHistorySearchResult(t);break;case"yeaft_history_window":{let n=Ul(e,t);e.handleYeaftHistoryWindow(t,n);break}case"yeaft_tool_stats":{e._fetchYeaftToolStatsTimer&&(clearTimeout(e._fetchYeaftToolStatsTimer),e._fetchYeaftToolStatsTimer=null);let n=t?.snapshot,i=n&&typeof n=="object"&&!Array.isArray(n)?n:{};e.yeaftToolStats={snapshot:i,registered:Array.isArray(t?.registered)?t.registered:[],unused:Array.isArray(t?.unused)?t.unused:[],error:typeof t?.error=="string"?t.error:null,notice:typeof t?.notice=="string"?t.notice:null,fetchedAt:Date.now()},e.yeaftToolStatsLoading=!1;break}case"yeaft_debug_history":{let n=typeof t?.requestId=="string"?t.requestId:"",i=typeof t?.detailTurnId=="string"&&t.detailTurnId;if(n&&!i&&n!==e._yeaftDebugHistoryLatestListRequestId)break;e._fetchYeaftDebugHistoryTimer&&(clearTimeout(e._fetchYeaftDebugHistoryTimer),e._fetchYeaftDebugHistoryTimer=null),e._yeaftDebugHistoryInFlightKey=null;let r=Array.isArray(t?.turns)?t.turns:[],o=t?.search?dm:cm,a=i?r:r.slice(-o),l=new Set(a.map(h=>h?.turnId).filter(Boolean)),c=vm(Array.isArray(t?.loops)?t.loops:[]),d=i?c:c.filter(h=>!h?.turnId||l.has(h.turnId)),u=Array.isArray(t?.dreamEvents)?t.dreamEvents:[];e.yeaftDebugHistoryHasMore=!!t?.hasMore||!i&&r.length>a.length,!t?.detailTurnId&&Number.isFinite(t?.limit)&&t.limit>0&&(e.yeaftDebugHistoryLimit=Math.min(o,t.limit)),(!e.yeaftDebugTurnsById||typeof e.yeaftDebugTurnsById!="object")&&(e.yeaftDebugTurnsById={}),Array.isArray(e.yeaftDebugLoops)||(e.yeaftDebugLoops=[]),Array.isArray(e.yeaftDebugTurnOrder)||(e.yeaftDebugTurnOrder=[]);let p=i?{...e.yeaftDebugTurnsById}:{};for(let h of a){let b=h?.turnId;if(!b)continue;let _=p[b];if(_){let L=h?.detailsLoaded?{..._,...h}:{...h,..._};L.memoryLoaded==null&&_.memoryLoaded!=null&&(L.memoryLoaded=_.memoryLoaded),L.memoryAdjust==null&&_.memoryAdjust!=null&&(L.memoryAdjust=_.memoryAdjust),p[b]=L}else p[b]=h}e.yeaftDebugTurnsById=p;let f=h=>h?.loopInstanceId||`${h?.turnId||""}#${h?.loopNumber||0}`,g=e.yeaftDebugLoops,v=new Map;for(let h of g)h&&v.set(f(h),h);let m=new Set,A=[];for(let h of d){if(!h)continue;let b=f(h);m.add(b),A.push(v.get(b)||h)}if(i)for(let h of g)!h||m.has(f(h))||A.push(h);e.yeaftDebugLoops=A;let w=new Set,k=[],y=h=>{!h||w.has(h)||(w.add(h),k.push(h))};if(i){for(let h of e.yeaftDebugTurnOrder)y(h);for(let h of a)y(h?.turnId)}else for(let h of a)y(h?.turnId);e.yeaftDebugTurnOrder=i?k:k.slice(-o);for(let h of u){if(!h)continue;let b=null,_=h.sessionId||h.groupId;typeof h.target=="string"&&h.target.includes("/")?b=h.target:typeof _=="string"&&_?b=`group/${_}`:b="*",typeof e._appendDreamEvent=="function"&&e._appendDreamEvent(b,h),h.type==="dream_progress"&&typeof e.handleYeaftOutput=="function"&&e.handleYeaftOutput({event:h})}e.yeaftDebugHistoryLoading=!1,e.yeaftDebugHistoryError=typeof t?.error=="string"?t.error:null,e.yeaftDebugHistoryFetchedAt=Date.now();break}case"chat_image":t.conversationId&&t.fileId&&e.addMessageToConversation(t.conversationId,{type:"chat-image",fileId:t.fileId,previewToken:t.previewToken,mimeType:t.mimeType});break;case"error":{let n=t.conversationId||e.currentConversation,i=["Permission denied","Agent not found","No conversation selected","Agent is still syncing","No agent available","Agent access denied"].some(c=>t.message?.includes(c));if((t.message?.includes("Agent is still syncing")||t.message?.includes("Agent not found"))&&gt(e),["No conversation selected","Agent is still syncing","No agent available"].some(c=>t.message?.includes(c))&&n&&(delete e.processingConversations[n],Ae(e,n),e.finishStreamingForConversation(n)),i&&n){let c=e.messagesMap[n];if(c&&c.length>0)for(let d=c.length-1;d>=0&&d>=c.length-5;d--){let u=c[d];if(u&&u.type==="error"&&u._sysErrBaseContent!==void 0){if(u._sysErrBaseContent===t.message&&Date.now()-(u._sysErrFirstAt||0)<=3e3){u._sysErrCount=(u._sysErrCount||1)+1,u.content=`${u._sysErrBaseContent} (\xD7${u._sysErrCount})`,u._sysErrRemoveTimer&&(clearTimeout(u._sysErrRemoveTimer),u._sysErrRemoveTimer=setTimeout(()=>{let p=e.messagesMap[n];if(p){let f=p.findIndex(g=>g.id===u.id);f>=0&&p.splice(f,1)}},5e3));return}break}}}let o=Date.now().toString()+Math.random().toString(36).substr(2,9),a={type:"error",content:t.message,transient:i,dbMessageId:i?"err_"+o:void 0};i&&(a._sysErrBaseContent=t.message,a._sysErrCount=1,a._sysErrFirstAt=Date.now()),e.addMessageToConversation(n,a);let l=null;if(i&&n){let c=e.messagesMap[n];c&&c.length>0&&(l=c[c.length-1])}if(i&&n&&l){let c=n,d="err_"+o;l._sysErrRemoveTimer=setTimeout(()=>{let u=e.messagesMap[c];if(u){let p=u.findIndex(f=>f.id===d);p>=0&&u.splice(p,1)}},5e3)}!i&&n&&(delete e.processingConversations[n],Ae(e,n),e.finishStreamingForConversation(n));break}case"history_sessions_list":if(t.requestId&&e._historySessionsRequestId&&t.requestId!==e._historySessionsRequestId)break;e.historySessions=t.sessions||[],e.historySessionsLoading=!1;break;case"folders_list":if(t.requestId&&e._foldersRequestId&&t.requestId!==e._foldersRequestId)break;e.folders=t.folders||[],e.foldersLoading=!1,e._foldersResolve&&(e._foldersResolve(),e._foldersResolve=null);break;case"models_list":if(t.requestId&&e._modelsRequestId&&t.requestId!==e._modelsRequestId)break;e.providerModels=t.models||[],e.providerModelsLoading=!1,e._modelsTimeout&&(clearTimeout(e._modelsTimeout),e._modelsTimeout=null),e._modelsResolve&&(e._modelsResolve(e.providerModels),e._modelsResolve=null);break;case"conversation_refresh":Nl(e,t);break;case"session_pinned":if(t.conversationId){let n=t.agentId?{agentId:t.agentId}:{};if(typeof e.setSessionPinned=="function")e.setSessionPinned(t.conversationId,!!t.pinned,n);else try{let i=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();i&&typeof i.applyPinState=="function"&&i.applyPinState(t.conversationId,!!t.pinned,t.agentId||e.yeaftSessionAgentById?.[t.conversationId]||e.currentAgent||null)}catch{}}break;case"execution_cancelled":Bl(e,t);break;case"slash_commands_update":if(Array.isArray(t.slashCommands)){let n=[...new Set(t.slashCommands)];if(t.commandSet==="yeaft"){let i=t.conversationId&&t.conversationId!=="__preload__"?t.conversationId:null,r=t.agentId&&e.yeaftConversationIdsByAgent?.[t.agentId]||null,o=i||r;o&&(e.slashCommandsMap[o]=n);let a=e.yeaftConversationId||null,l=t.agentId?e.currentAgent===t.agentId&&(r===a||i===a):i===a;a&&l&&(e.slashCommandsMap[a]=n)}else t.conversationId&&(e.slashCommandsMap[t.conversationId]=n),t.agentId&&(e.slashCommandsMap[`agent:${t.agentId}`]=n)}t.slashCommandDescriptions&&(e.slashCommandDescriptions={...e.slashCommandDescriptions,...t.slashCommandDescriptions});break;case"compact_status":{let n=t.conversationId;e.compactStatus={conversationId:n,status:t.status,message:t.message},t.status==="completed"?setTimeout(()=>{e.compactStatus?.conversationId===n&&e.compactStatus?.status==="completed"&&(e.compactStatus=null)},3e3):t.status==="compacting"&&setTimeout(()=>{e.compactStatus?.conversationId===n&&e.compactStatus?.status==="compacting"&&(e.compactStatus=null)},3e4)}break;case"pong_session":{let n=t.conversationId;if(!n)break;if(e._pongTimeouts?.[n]&&(clearTimeout(e._pongTimeouts[n]),delete e._pongTimeouts[n]),t.status==="unsupported"){Ae(e,n),xl(e,n);break}if(t.status==="ok")e.sessionHealth?.[n]&&delete e.sessionHealth[n],!t.isProcessing&&e.processingConversations[n]&&(delete e.processingConversations[n],Ae(e,n),e.finishStreamingForConversation(n));else if(e.sessionHealth||(e.sessionHealth={}),e.sessionHealth[n]={status:t.status},t.status==="session-lost"||t.status==="cli-exited"){if(e._autoRefreshed||(e._autoRefreshed={}),!e._autoRefreshed[n]){e._autoRefreshed[n]=!0;let i=e.conversations.find(r=>r.id===n);e.sendWsMessage({type:"refresh_conversation",conversationId:n,agentId:i?.agentId})}delete e.processingConversations[n],Ae(e,n),e.finishStreamingForConversation(n)}break}case"ask_user_question":if(t.conversationId){let n=()=>{let i=e.messagesMap[t.conversationId]||[];for(let r=i.length-1;r>=0;r--)if(i[r].type==="tool-use"&&i[r].toolName==="AskUserQuestion"&&!i[r].askRequestId)return i[r].askRequestId=t.requestId,i[r].askQuestions=t.questions,!0;return!1};if(!n()){let i=0,r=setInterval(()=>{i++,(n()||i>=10)&&clearInterval(r)},200)}}break;case"restart_agent_ack":window.dispatchEvent(new CustomEvent("agent-restart-ack",{detail:{agentId:t.agentId}}));break;case"upgrade_agent_ack":window.dispatchEvent(new CustomEvent("agent-upgrade-ack",{detail:{agentId:t.agentId,success:t.success,error:t.error,alreadyLatest:t.alreadyLatest,version:t.version,reason:t.reason,currentNode:t.currentNode,requiredNode:t.requiredNode}}));break;case"terminal_created":case"terminal_output":case"terminal_closed":case"terminal_error":case"file_content":case"file_saved":case"directory_listing":case"git_status_result":case"git_diff_result":case"git_op_result":case"file_op_result":case"file_search_result":t.type,t.type,window.dispatchEvent(new CustomEvent("workbench-message",{detail:t}));break;case"server_updating":e.connectionState="updating";break;case"context_usage":e.contextUsage={inputTokens:t.inputTokens,maxTokens:t.maxTokens,percentage:t.percentage,conversationId:t.conversationId};break;case"mcp_servers_list":case"mcp_config_updated":t.agentId&&t.servers&&(e.mcpServers[t.agentId]=t.servers);break;case"expert_roles_list":t.roles&&(e.expertRoleDefinitions=t.roles);break;case"llm_models_discovered":t.agentId&&(e.llmModelDiscovery=e.llmModelDiscovery||{},e.llmModelDiscovery[t.agentId]=t);break;case"llm_config":case"llm_config_updated":if(t.agentId){let n=t.agentConfig||lm(t),i=t.effectiveConfig||n;e.llmConfig[t.agentId]={providers:t.providers||i.providers||[],primaryModel:t.primaryModel||i.primaryModel||null,fastModel:t.fastModel||i.fastModel||null,language:t.language||n.language||i.language||"en",needsSetup:t.needsSetup??i.needsSetup??!1,agentConfig:n,effectiveConfig:i,requestId:t.requestId||null,statusRefreshError:t.statusRefreshError||null,error:t.error||null,loaded:!0}}break;case"models_dev_registry":if(e.modelsDevRegistry={registry:t.registry||{},fetchedAt:t.fetchedAt||Date.now(),error:t.error||null,loaded:!0},e._modelsDevPending){let n=e._modelsDevPending;e._modelsDevPending=null,n.timer&&clearTimeout(n.timer);for(let i of n.resolvers)i(e.modelsDevRegistry)}break;case"yeaft_settings":case"yeaft_settings_updated":t.agentId&&(e.yeaftSettings[t.agentId]={maxConcurrentThreads:t.maxConcurrentThreads??6,autoArchiveIdleDays:t.autoArchiveIdleDays??30,error:t.error||null,loaded:!0,at:Date.now()});break;case"search_settings":case"search_settings_updated":{let n={backend:t.backend||"tavily",tavilyKeyConfigured:!!t.tavilyKeyConfigured,tavilyKeyMasked:t.tavilyKeyMasked||null,disableHtmlFallback:!!t.disableHtmlFallback,error:t.error||null,loaded:!0,at:Date.now()};e.searchSettings=n;let i=e._searchPending,r=t.type==="search_settings"?"load":"update";i&&i[r]&&(i[r](n),delete i[r]);break}case"tavily_usage":{let n=t.error?{error:t.error}:{plan:t.plan,used:t.used,limit:t.limit,paygoUsed:t.paygoUsed,paygoLimit:t.paygoLimit};e.tavilyUsage=n,e.tavilyUsageLoading=!1;let i=e._searchPending;i&&i.usage&&(i.usage(n),delete i.usage);break}case"yeaft_mcp_list_result":case"yeaft_mcp_add_result":case"yeaft_mcp_remove_result":case"yeaft_mcp_reload_result":case"yeaft_mcp_updated":{if(Array.isArray(t.servers)&&(e.yeaftMcpServers=t.servers),t.runtime&&typeof t.runtime=="object"&&(e.yeaftMcpRuntime={connected:!!t.runtime.connected,toolCount:t.runtime.toolCount||0,perServer:Array.isArray(t.runtime.perServer)?t.runtime.perServer:[]}),e.yeaftMcpLoading=!1,e.yeaftMcpError=t.error||null,t.requestId){let n=e._mcpPending;n&&n[t.requestId]&&(n[t.requestId](t),delete n[t.requestId])}break}case"conversation_mcp_update":t.conversationId&&t.servers&&(e.conversationMcpServers[t.conversationId]=t.servers),t.conversationId&&t.serverTools&&(e.conversationMcpServerTools[t.conversationId]=t.serverTools);break;case"btw_stream":e.appendBtwDelta(t.delta);break;case"btw_done":e.btwLoading=!1,t.btwSessionId&&(e.btwSessionId=t.btwSessionId);break;case"btw_error":{let n=e.btwMessages[e.btwMessages.length-1];n&&n.role==="assistant"&&(n.content="Error: "+t.error),e.btwLoading=!1;break}case"background_task_started":case"background_task_output":break;case"subagent_started":t.conversationId&&t.subagentId&&e.addSubagent(t.conversationId,{id:t.subagentId,slug:t.slug,type:t.subagentType,description:t.description,parentToolUseId:t.parentToolUseId});break;case"subagent_message":t.conversationId&&t.subagentId&&t.message&&e.appendSubagentMessage(t.conversationId,t.subagentId,t.message);break;case"subagent_completed":t.conversationId&&t.subagentId&&e.completeSubagent(t.conversationId,t.subagentId);break}}var cm,dm,um,rc=H(()=>{ct();Yn();St();Gt();Kt();to();sc();ii();cm=1,dm=5,um=500});function ac(){return Object.values(oc).sort((t,s)=>t.order-s.order).map(t=>({teamId:t.id,team:t,roles:Object.values(dt).filter(s=>s.group===t.id)}))}function lc(e){let t=[];for(let s of Object.values(dt)){t.push({roleId:s.id,roleName:s.name,roleTitle:s.title,actionId:null,actionName:null,searchText:`${s.name} ${s.fullName} ${s.title} ${s.titleEn}`.toLowerCase(),displayText:s.name,group:s.group});for(let n of s.actions)t.push({roleId:s.id,roleName:s.name,roleTitle:s.title,actionId:n.id,actionName:n.name,searchText:`${s.name} ${s.fullName} ${s.title} ${n.name} ${n.nameEn}`.toLowerCase(),displayText:`${s.name}\xB7${n.name}`,group:s.group})}if(e&&e.length>0){for(let s of e)if(t.push({roleId:s.id,roleName:s.name,roleTitle:s.title,actionId:null,actionName:null,searchText:`${s.name} ${s.fullName||""} ${s.title} ${s.titleEn||""}`.toLowerCase(),displayText:s.name,group:"custom"}),s.actions)for(let n of s.actions)t.push({roleId:s.id,roleName:s.name,roleTitle:s.title,actionId:n.id,actionName:n.name,searchText:`${s.name} ${s.fullName||""} ${s.title} ${n.name} ${n.nameEn||""}`.toLowerCase(),displayText:`${s.name}\xB7${n.name}`,group:"custom"})}return t}function Xt(e,t){let s=dt[e.role];if(s){if(e.action){let n=s.actions.find(i=>i.id===e.action);return n?`${s.name}\xB7${n.name}`:s.name}return s.name}if(t){let n=t.find(i=>i.id===e.role);if(n){if(e.action){let i=n.actions?.find(r=>r.id===e.action);return i?`${n.name}\xB7${i.name}`:n.name}return n.name}}return e.role}function so(e,t,s,n="zh-CN"){if(!e||e.length===0||!t||t.length===0)return null;let i=n==="zh-CN";if(!e.some(l=>!dt[l.role]&&t.some(c=>c.id===l.role)))return null;if(e.length===1){let{role:l,action:c}=e[0],d=t.find(p=>p.id===l);if(!d)return null;let u;if(c&&d.actions){let p=d.actions.find(f=>f.id===c);p?s?(u=(i?p.messageTemplate:p.messageTemplateEn)||"",u+=s):u=(i?p.defaultMessage:p.defaultMessageEn)||"":u=((i?d.messagePrefix:d.messagePrefixEn)||"")+(s||"")}else u=((i?d.messagePrefix:d.messagePrefixEn)||"")+(s||"");return{effectivePrompt:u}}let o=[];for(let{role:l,action:c}of e){let d=t.find(p=>p.id===l),u=dt[l];if(d)if(c){let p=d.actions?.find(f=>f.id===c);p&&o.push((i?p.messageTemplate:p.messageTemplateEn)||"")}else o.push((i?d.messagePrefix:d.messagePrefixEn)||"");else if(u)return null}return o.length===0?null:{effectivePrompt:o.join(`
3
+ ${u}`:u,p=!0;break}}if(!p){for(let f=l.length-1;f>=0;f--)if(l[f].type==="tool-use"&&!l[f].hasResult){l[f].hasResult=!0,l[f].toolResult=u;break}}}n.currentTool=null}else if(!i&&(typeof o=="string"&&o.trim()||Array.isArray(s.message?.attachments)&&s.message.attachments.length>0)){let l=s.message?.clientMessageId||s.clientMessageId||null,c={type:"user",content:o,clientMessageId:l},d=e.messagesMap[t]||[];if(d.some(p=>ei(p,c))){if(l){for(let p=d.length-1;p>=0;p--)if(d[p].type==="user"&&d[p].clientMessageId===l){s.dbMessageId&&!d[p].dbMessageId&&(d[p].dbMessageId=s.dbMessageId),s.message?.id&&!d[p].messageId&&(d[p].id=s.message.id,d[p].messageId=s.message.id),s.ts&&!d[p].ts&&(d[p].ts=s.ts),Yl(e,d[p]);break}}}else{let p=e.addMessageToConversation(t,{...s.message?.id?{id:s.message.id,messageId:s.message.id}:{},...s.ts?{ts:s.ts}:{},type:"user",content:o,...s.message?.attachments?{attachments:s.message.attachments}:{},...s.message?.quote?{quote:s.message.quote}:{},...l?{clientMessageId:l}:{}});Yl(e,p)}}}else if(s.type==="result"){delete e.processingConversations[t],Ae(e,t);let i=e.conversations.find(c=>c.id===t);i&&i.connecting&&(i.connecting=!1);let r=e._currentYeaftSessionId||null;if(e._currentYeaftTurnId){let c=Object.entries(e.activeVpTurns||{}).find(([,d])=>(d?.turnId===e._currentYeaftTurnId||!d?.turnId&&d===e.activeVpTurns[e._currentYeaftTurnId])&&(!e._currentYeaftAgentId||!d?.agentId||d.agentId===e._currentYeaftAgentId));if(c){let[d,u]=c,{[d]:p,...f}=e.activeVpTurns;!r&&u?.sessionId&&(r=u.sessionId),e.activeVpTurns=f}}if(r&&e._currentYeaftVpId&&e.vpStatuses){let c=e._currentYeaftTurnId||null,d={...e.vpStatuses||{}},u=!1;for(let[p,f]of Object.entries(d))!f||f.vpId!==e._currentYeaftVpId||e._currentYeaftAgentId&&f.agentId&&f.agentId!==e._currentYeaftAgentId||(f.sessionId||f.groupId||null)!==r||c&&f.turnId&&f.turnId!==c||(d[p]={...f,state:"idle",turnId:null,since:Date.now()},u=!0);u&&(e.vpStatuses=d)}r&&typeof e.clearYeaftSessionProcessingIfIdle=="function"&&e.clearYeaftSessionProcessingIfIdle(r,{agentId:e._currentYeaftAgentId||null}),e._closedAt||(e._closedAt={}),e._closedAt[t]=Date.now(),e._turnCompletedConvs||(e._turnCompletedConvs=new Set),e._turnCompletedConvs.add(t),n.currentTool=null,Ft(e,t);let o=e.messagesMap[t]||[],a=s.result_text||"";if(typeof a=="string"&&a.trim()){let c=!1;for(let d=o.length-1;d>=0;d--){if(o[d].type==="assistant"){c=!0;break}if(o[d].type==="user")break}c||e.appendToAssistantMessageForConversation(t,a.trim())}e.finishStreamingForConversation(t),!e.promoteCompletedYeaftHistoryOutline?.(t,e._currentYeaftTurnId||null)&&r&&e.invalidateYeaftHistoryOutline?.(r),e.sweepStaleStreamingForConversation(t)}}var Gl=H(()=>{Gt();ii();Ur()});function Qt(e){if(e==null)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function ri(e,t){if(!t)return e??null;if(Object.prototype.hasOwnProperty.call(t,"base"))return Qt(t.base)??null;if(Object.prototype.hasOwnProperty.call(t,"replacement"))return Qt(t.replacement)??null;let s=e&&typeof e=="object"&&!Array.isArray(e)?Qt(e):{};if(t.set&&typeof t.set=="object")for(let[n,i]of Object.entries(t.set))s[n]=Qt(i);if(t.body&&typeof t.body=="object"){let n=s.body&&typeof s.body=="object"&&!Array.isArray(s.body)?{...s.body}:{};for(let[r,o]of Object.entries(t.body))r==="messages"||r==="messagesFrom"||r==="messagesAppend"||r==="messagesKey"||(n[r]=Qt(o));let i=t.body.messagesKey==="messages"||t.body.messagesKey==="input"?t.body.messagesKey:Array.isArray(n.messages)||Object.prototype.hasOwnProperty.call(t.body,"messages")?"messages":"input";if(Array.isArray(t.body.messages))n[i]=Qt(t.body.messages)||[];else if(Array.isArray(t.body.messagesAppend)){let r=Array.isArray(n[i])?n[i]:[],o=Number.isFinite(Number(t.body.messagesFrom))?Number(t.body.messagesFrom):r.length;n[i]=r.slice(0,o).concat(Qt(t.body.messagesAppend)||[])}s.body=n}return s}function Ql(e,t){return!t||!Object.prototype.hasOwnProperty.call(t,"rawRequestDelta")?e??null:ri(e??null,t.rawRequestDelta)}function cn(e){if(!e)return 0;let t=typeof e=="string"?e:String(e),s=0,n=0;for(let i of t){let r=i.codePointAt(0)||0;r>=19968&&r<=40959||r>=12352&&r<=12447||r>=12448&&r<=12543||r>=44032&&r<=55215?s+=1:n+=1}return Math.ceil(s+n/4)}function om(e){let t=[],s=[];if(!e)return{messageText:t,toolText:s};let n=e.content;if(typeof n=="string")e.role==="tool"?s.push(n):t.push(n);else if(Array.isArray(n))for(let i of n){if(!i||typeof i!="object")continue;let r=i.type;if(r==="text"&&typeof i.text=="string")t.push(i.text);else if(r==="tool_use"){if(s.push(String(i.name||"")),i.input!==void 0)try{s.push(JSON.stringify(i.input))}catch{}}else if(r==="tool_result"){let o=i.content;if(typeof o=="string")s.push(o);else if(Array.isArray(o)){for(let a of o)if(a)if(typeof a=="string")s.push(a);else if(typeof a=="object"&&typeof a.text=="string")s.push(a.text);else try{s.push(JSON.stringify(a))}catch{}}else if(o!==void 0)try{s.push(JSON.stringify(o))}catch{}}else try{t.push(JSON.stringify(i))}catch{}}if(Array.isArray(e.toolCalls)){for(let i of e.toolCalls)if(i&&(s.push(String(i.name||"")),i.input!==void 0))try{s.push(JSON.stringify(i.input))}catch{}}return{messageText:t,toolText:s}}function Xl(e){let t=0,s=0;if(e&&Array.isArray(e.messages))for(let r of e.messages){let{messageText:o,toolText:a}=om(r);for(let l of o)t+=cn(l);for(let l of a)s+=cn(l)}let n=0,i=0;if(e&&typeof e.response=="string"&&(n+=cn(e.response)),e&&Array.isArray(e.toolCalls)){for(let r of e.toolCalls)if(r&&(i+=cn(String(r.name||"")),r.input!==void 0))try{i+=cn(JSON.stringify(r.input))}catch{}}return{inputMessageTokens:t,inputToolTokens:s,outputMessageTokens:n,outputToolTokens:i,inputTotalEstimated:t+s,outputTotalEstimated:n+i}}function eo(e,t,s){let n=Math.max(0,Math.floor(Number(e)||0)),i=Math.max(0,Number(t)||0),r=Math.max(0,Number(s)||0),o=i+r;if(n===0)return{message:0,tool:0};if(o===0)return{message:n,tool:0};let a=Math.round(i/o*n),l=Math.min(n,Math.max(0,a));return{message:l,tool:n-l}}function Zl(e){if(e==null||e==="")return"";let t;if(typeof e=="number")t=e;else if(typeof e=="string"){let o=Date.parse(e);if(Number.isNaN(o)){let a=Number(e);if(!Number.isFinite(a))return"";t=a}else t=o}else return"";if(!Number.isFinite(t))return"";let s=new Date(t),n=String(s.getHours()).padStart(2,"0"),i=String(s.getMinutes()).padStart(2,"0"),r=String(s.getSeconds()).padStart(2,"0");return`${n}:${i}:${r}`}var to=H(()=>{});function am(e,t){if(!e||!!!t?.online)return!1;let n=!e.online,i=e.online&&e.version!=null&&t.version!=null&&e.version!==t.version;return n||i}function Jl(e,t){let s=e.lastViewedConversation||localStorage.getItem("lastViewedConversation");if(!s)return!1;let n=e.conversations.find(r=>r.id===s);if(!n)return!1;let i=t?.agentId||e.currentAgent;return t&&(e.currentAgent=t.agentId,e.currentAgentInfo=t.agentInfo,e.sendWsMessage({type:"select_agent",agentId:t.agentId,silent:!0})),e.activeConversations=[s],e.currentWorkDir=n.workDir,e.messagesMap[s]=[],e.sendWsMessage({type:"select_conversation",conversationId:s}),e.requestChatHistory?.(s,{mode:"recent",turns:5}),e.sendWsMessage({type:"refresh_conversation",conversationId:s}),!0}function ec(e,t){let s=Array.isArray(e.agents)?e.agents:[],n=e._hasHandledAgentList===!0,i=e.currentAgent||null,r=!!(i&&s.some(a=>a&&a.id===i&&a.online));e.agents=t.agents,e._hasHandledAgentList=!0;let o=e.currentAgent||null;if(o){let a=e._yeaftAgentSeen&&e._yeaftAgentSeen.id===o?e._yeaftAgentSeen:null,l=t.agents.find(c=>c.id===o)||null;e.currentView==="yeaft"&&am(a,l)&&(e._yeaftReconnectCatchUpPending=!0),l?e._yeaftAgentSeen={id:o,online:!!l.online,version:l.version!=null?l.version:null}:a?a.online&&(e._yeaftAgentSeen={id:o,online:!1,version:a.version}):e._yeaftAgentSeen={id:o,online:!1,version:null}}{let a=new Set(t.agents.map(l=>l.id));for(let l of t.agents)e.proxyPorts[l.id]=l.proxyPorts||[],l.yeaftStatus&&typeof e.cacheYeaftAgentStatus=="function"&&e.cacheYeaftAgentStatus(l.id,l.yeaftStatus);for(let l of Object.keys(e.proxyPorts))a.has(l)||delete e.proxyPorts[l]}if(e.currentAgent){let a=t.agents.find(l=>l.id===e.currentAgent);a&&(e.currentAgentInfo=a)}if(e.currentView==="yeaft"&&!e.currentAgent){let a=t.agents.find(l=>l.online);a&&(e.currentAgent=a.id,e.currentAgentInfo=a)}if(e.currentView==="yeaft"&&typeof e.loadOpenedYeaftSessionsForConnectedAgents=="function"){let a=t.agents.filter(l=>l&&l.online&&l.id).map(l=>l.id);e.loadOpenedYeaftSessionsForConnectedAgents(a)}{let a=[],l=new Set;for(let d of t.agents)for(let u of d.conversations||[])l.has(u.id)||(l.add(u.id),a.push({...u,type:u.type,agentId:d.id,agentName:d.name}),u.title&&(u.customTitle&&(e.customConversationTitles[u.id]=u.title),e.conversationTitles[u.id]||(e.conversationTitles[u.id]=u.title)));for(let d of a){d.agentOnline=!0;let u=e.conversations.find(p=>p.id===d.id);if(u)u.claudeSessionId=d.claudeSessionId||u.claudeSessionId,u.processing=d.processing,u.userId=d.userId,u.username=d.username,u.agentId=d.agentId,u.agentName=d.agentName,u.agentOnline=!0,d.type&&(u.type=d.type),d.name!==void 0&&(u.name=d.name);else{let p=e._recentlyDeletedSessions?.[d.id];if(p&&Date.now()-p<15e3)continue;e.conversations.push(d)}d.pinned&&!e.pinnedSessions.includes(d.id)&&e.pinnedSessions.push(d.id)}let c=new Set(t.agents.map(d=>d.id));e.conversations=e.conversations.filter(d=>{if(l.has(d.id)||e.activeConversations.includes(d.id))return!0;if(d.agentId&&c.has(d.agentId)){let u=e._recentlyDeletedSessions?.[d.id];return u&&Date.now()-u<15e3||(delete e.messagesMap[d.id],delete e.processingConversations[d.id],Ae(e,d.id),delete e.executionStatusMap[d.id]),!1}return d.agentId&&!c.has(d.agentId)&&(d.agentOnline=!1),!0});for(let d of a)if(d.processing&&!jt(e,d.id)&&!e._turnCompletedConvs?.has(d.id))e.processingConversations[d.id]=!0;else if(e.processingConversations[d.id]){delete e.processingConversations[d.id],Ae(e,d.id);let u=e.executionStatusMap[d.id];u&&(u.currentTool=null),e.finishStreamingForConversation(d.id)}for(let d of Object.keys(e.processingConversations))if(!l.has(d)){if(d.startsWith("yeaft-"))continue;delete e.processingConversations[d],Ae(e,d);let u=e.executionStatusMap[d];u&&(u.currentTool=null),e.finishStreamingForConversation(d)}}if(localStorage.setItem("pinned-sessions",JSON.stringify(e.pinnedSessions)),e._closedAt){let a=Date.now();for(let l of Object.keys(e._closedAt))a-e._closedAt[l]>3e4&&(delete e._closedAt[l],e._turnCompletedConvs?.delete(l))}if(e.currentAgent){let a=t.agents.find(l=>l.id===e.currentAgent&&l.online);if(a){let l=!!e._yeaftReconnectCatchUpPending,d=l||n&&!r;if(e.currentAgentInfo=a,d&&(e._offlineConversationRestoreKey=null,e.sendWsMessage({type:"select_agent",agentId:e.currentAgent,silent:!0})),e.currentView==="yeaft"&&typeof e.requestYeaftSessionBootstrap=="function"){e._yeaftReconnectCatchUpPending=!1;let u=l||!e.yeaftSessionReady||!e.yeaftModel||!e.yeaftStatus;(u||l)&&e.requestYeaftSessionBootstrap({forceSessionReady:u,catchUpHistory:l})}if(!d)return;if(e.currentConversation){let u=e.conversations.find(g=>g.id===e.currentConversation);e.sendWsMessage({type:"select_conversation",conversationId:e.currentConversation});let p=e.messagesMap[e.currentConversation]||[],f=Yt(p);f!=null?e.requestChatHistory?.(e.currentConversation,{mode:"delta",afterMessageId:f}):e.requestChatHistory?.(e.currentConversation,{mode:"recent",turns:5}),e.sendWsMessage({type:"refresh_conversation",conversationId:e.currentConversation})}else e.recoveryDismissed||Jl(e);return}else{let l=`${e.currentAgent||""}:${e.currentConversation||""}`;e.currentConversation&&(!n||r||e._offlineConversationRestoreKey!==l)&&(e._offlineConversationRestoreKey=l,e.sendWsMessage({type:"select_conversation",conversationId:e.currentConversation}));return}}if(!e.currentConversation&&!e.currentAgent&&!e.recoveryDismissed){let a=e.lastViewedConversation||localStorage.getItem("lastViewedConversation"),l=e.lastUsedAgent;if(a){let c=e.conversations.find(d=>d.id===a);if(c){let d=t.agents.find(u=>u.id===c.agentId&&u.online);if(d){Jl(e,{agentId:c.agentId,agentInfo:d});return}}}l&&(e.agents.find(d=>d.id===l&&d.online)?e.selectAgent(l):e.checkPendingRecovery())}}function tc(e,t){let s=e.pendingAgentSelection||null;if(s){if(!(typeof t.requestId=="string"&&t.requestId?t.requestId===s.requestId:t.agentId===s.agentId))return!1;if(e.pendingAgentSelection=null,t.ok===!1)return e.agentSwitching=!1,!1}else{if(t.requestId)return!1;if(e.currentAgent&&t.agentId!==e.currentAgent)return!1}e.agentSwitching=!1;let n=e.currentAgent===t.agentId,i={id:t.agentId,name:t.agentName,workDir:t.workDir,capabilities:t.capabilities||["terminal","file_editor","background_tasks"],version:t.version||null};if(typeof e.activateYeaftAgent=="function"?e.activateYeaftAgent(t.agentId,i):(e.currentAgent=t.agentId,e.currentAgentInfo=i),Array.isArray(t.slashCommands)){let u=[...new Set(t.slashCommands)];e.slashCommandsMap[`agent:${t.agentId}`]=u}t.slashCommandDescriptions&&(e.slashCommandDescriptions={...e.slashCommandDescriptions,...t.slashCommandDescriptions});let r=t.conversations||[],o=new Set,a=r.filter(u=>o.has(u.id)?!1:(o.add(u.id),!0)).map(u=>({...u,agentId:t.agentId,agentName:t.agentName}));if(n&&e.currentConversation){let u=r.find(p=>p.id===e.currentConversation);u&&!a.find(p=>p.id===u.id)&&a.push({...u,agentId:t.agentId,agentName:t.agentName})}let l=new Set(a.map(u=>u.id)),c=e.conversations.filter(u=>!l.has(u.id));e.conversations=[...c,...a];for(let u of r)u.title&&(u.customTitle&&(e.customConversationTitles[u.id]=u.title),e.conversationTitles[u.id]||(e.conversationTitles[u.id]=u.title));let d=new Set(r.map(u=>u.id));for(let u of r)if(u.processing&&!jt(e,u.id)&&!e._turnCompletedConvs?.has(u.id))e.processingConversations[u.id]=!0;else if(e.processingConversations[u.id]){delete e.processingConversations[u.id],Ae(e,u.id);let p=e.executionStatusMap[u.id];p&&(p.currentTool=null),e.finishStreamingForConversation(u.id)}for(let u of Object.keys(e.processingConversations))if(!d.has(u)){if(u.startsWith("yeaft-"))continue;if(!c.some(f=>f.id===u)){delete e.processingConversations[u],Ae(e,u);let f=e.executionStatusMap[u];f&&(f.currentTool=null),e.finishStreamingForConversation(u)}}if(n&&e.currentConversation){let u=e.conversations.find(p=>p.id===e.currentConversation);e.currentWorkDir=u?.workDir||e.currentWorkDir||t.workDir,gt(e),e.sendWsMessage({type:"select_conversation",conversationId:e.currentConversation})}else{e.activeConversations=[],e.currentWorkDir=t.workDir;let u=e.lastViewedConversation||localStorage.getItem("lastViewedConversation");u&&e.conversations.find(p=>p.id===u)&&(e.autoRestoreConversation(u),e.pendingRecovery=null)}return Ya(e),!0}var sc=H(()=>{Gt();Kt();rn()});function lm(e={}){return{providers:e.providers||[],primaryModel:e.primaryModel||null,fastModel:e.fastModel||null,language:e.language||"en"}}function pm(){return window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore()}function fm(e,t){let s=t.agentId||null,n=Array.isArray(e.yeaftSessionHydrateSlices)?e.yeaftSessionHydrateSlices.filter(i=>i.agentId!==s):[];e.yeaftSessionHydrateSlices=[...n,{agentId:s,sessions:Array.isArray(t.sessions)?t.sessions:[]}]}function gm(e){let t=e.yeaftActiveSessionFilter||null;if(!t)try{t=localStorage.getItem("lastViewedYeaftSession")||null}catch{}let s=t&&typeof e.resolveYeaftSessionAgentId=="function"?e.resolveYeaftSessionAgentId(t):e.currentAgent||null;return{sessionId:t,agentId:s}}function nc(e){let t=pm(),s=gm(e);typeof t?.beginInventoryCommit=="function"?t.beginInventoryCommit(s.sessionId,s.agentId):typeof t?.resetInventory=="function"&&t.resetInventory();let n=Array.isArray(e.yeaftSessionHydrateSlices)?e.yeaftSessionHydrateSlices:[],i=s.agentId?[...n.filter(r=>r.agentId===s.agentId),...n.filter(r=>r.agentId!==s.agentId)]:n;i.length===0&&t?.applySnapshot?.([],null);for(let r of i)t?.applySnapshot?.(r.sessions||[],r.agentId||null);e.yeaftSessionHydrateSlices=[]}function mm(e){let t=e.yeaftSessionHydrateRequestId||null;e.yeaftSessionInventoryCompleteSupported!==!1||!t||(clearTimeout(e._legacyYeaftSessionHydrateTimer),e._legacyYeaftSessionHydrateTimer=setTimeout(()=>{e.yeaftSessionHydrateRequestId===t&&(e._legacyYeaftSessionHydrateTimer=null,nc(e),e._hasHandledYeaftSessionHydrate=!0,e.yeaftSessionHydrateRequestId=null,e.yeaftSessionHydrateError=null,e._yeaftSessionInventorySocketQuarantined=!0)},um))}function hm(e,t={}){let s=e||{systemPrompt:"",messages:[],rawRequest:null},n={systemPrompt:s.systemPrompt||"",messages:Array.isArray(s.messages)?[...s.messages]:[],rawRequest:s.rawRequest??null};if(t?.base){let i={systemPrompt:t.systemPrompt||"",messages:Array.isArray(t.messages)?t.messages:[],rawRequest:null};return Object.prototype.hasOwnProperty.call(t,"rawRequestDelta")&&(i.rawRequest=ri(null,t.rawRequestDelta)),i}if(typeof t?.systemPrompt=="string"&&(n.systemPrompt=t.systemPrompt),Array.isArray(t?.messages))n.messages=t.messages;else if(Array.isArray(t?.messagesAppend)){let i=Number.isFinite(Number(t.messagesFrom))?Number(t.messagesFrom):n.messages.length;n.messages=n.messages.slice(0,i).concat(t.messagesAppend)}return Object.prototype.hasOwnProperty.call(t||{},"rawRequestDelta")&&(n.rawRequest=ri(n.rawRequest,t.rawRequestDelta)),n}function vm(e=[]){let t=new Map;return e.map(s=>{if(!s||!s.requestDelta)return s;let n=s.turnId||"__unknown__",i=t.get(n)||s.requestBase||null,r=i?.rawRequest??null,o=hm(i,s.requestDelta);return t.set(n,o),{...s,systemPrompt:typeof s.systemPrompt=="string"&&s.systemPrompt?s.systemPrompt:o.systemPrompt,messages:Array.isArray(s.messages)&&s.messages.length>0?s.messages:o.messages,rawRequest:s.rawRequest??null,rawRequestBase:r}})}function ic(e,t){let s=Me();switch(e._lastPongAt=Date.now(),t.type){case"work_center_response":{let n=t.requestId?e.workCenterPending[t.requestId]:null;if(!n)break;clearTimeout(n.timer),delete e.workCenterPending[t.requestId],t.ok?n.resolve(t.data):n.reject(new Error(t.error||"Work Center request failed"));break}case"work_center_event":e.applyWorkCenterEvent(t.agentId,t.event);break;case"auth_result":if(t.success){if(e.authenticated=!0,t.sessionKey&&(e.sessionKey=lt(t.sessionKey),s.setSessionKey(t.sessionKey)),t.acceptPlaintext===!0&&(e.serverEncryptionRequired=!1),e.yeaftSessionInventoryCompleteSupported=t.yeaftSessionInventoryComplete===!0,e.yeaftSessionHydrateSlices=[],e._hasHandledYeaftSessionHydrate=!1,e.yeaftSessionHydrateError=null,t.role&&(s.role=t.role),typeof e.requestYeaftSessionInventory=="function")e.requestYeaftSessionInventory();else{let n=e.conversations.map(i=>i.id).filter(Boolean);e.sendWsMessage({type:"get_agents",conversationIds:n.length>0?n:void 0})}e.checkPendingRecovery()}else e.addMessage({type:"error",content:t.error||Pe("login.error.loginFailed")}),s.handleAuthFailure?.(void 0,t._wsAuthToken,t._wsAuthGeneration);break;case"agent_list":ec(e,t),e.workCenterOpen&&e.workCenterAgentId&&e.listWorkItems(e.workCenterAgentId).catch(()=>{});break;case"yeaft_session_hydrate":{if(e.yeaftSessionInventoryCompleteSupported===!0&&(!t.requestId||t.requestId!==e.yeaftSessionHydrateRequestId)||e.yeaftSessionInventoryCompleteSupported!==!0&&!e.yeaftSessionHydrateRequestId||t.requestId&&e.yeaftSessionHydrateRequestId&&t.requestId!==e.yeaftSessionHydrateRequestId)break;fm(e,t),e.yeaftSessionInventoryCompleteSupported!==!0&&mm(e);break}case"yeaft_session_hydrate_complete":if(e.yeaftSessionInventoryCompleteSupported===!0&&(!t.requestId||t.requestId!==e.yeaftSessionHydrateRequestId)||e.yeaftSessionHydrateRequestId&&!t.requestId||t.requestId&&e.yeaftSessionHydrateRequestId&&t.requestId!==e.yeaftSessionHydrateRequestId)break;clearTimeout(e._legacyYeaftSessionHydrateTimer),e._legacyYeaftSessionHydrateTimer=null,t.ok!==!1?nc(e):e.yeaftSessionHydrateSlices=[],e.yeaftSessionHydrateRequestId=null,e._hasHandledYeaftSessionHydrate=t.ok!==!1,e.yeaftSessionHydrateError=t.ok===!1?t.error||"session_inventory_failed":null;break;case"session_catalog_snapshot":e.applySessionCatalogSnapshot(t.catalog);break;case"session_ui_metadata_updated":{if(!e.finishSessionCatalogMutation?.(t)||t.ok!==!0)break;let n=e.sessionCatalog.find(i=>i.catalogKey===t.catalogKey);n&&(n.pinned=t.pinned===!0,n.sortRank=Number.isFinite(t.sortRank)?t.sortRank:null);break}case"session_catalog_reorder_result":e.finishSessionCatalogMutation?.(t);break;case"agent_selected":if(!tc(e,t))break;e.workCenterOpen&&e.workCenterAgentId&&e.listWorkItems(e.workCenterAgentId).catch(()=>{});break;case"conversation_created":Fl(e,t);break;case"conversation_resumed":Hl(e,t);break;case"conversation_selected":if(e.currentConversation===t.conversationId)return;e.activeConversations=[t.conversationId];{let n=e.conversations.find(i=>i.id===t.conversationId);n&&(e.currentWorkDir=n.workDir)}e.messagesMap[t.conversationId]=[],e.saveOpenSessions();break;case"conversation_settings_updated":{let n=e.conversations.find(r=>r.id===t.conversationId);n&&t.disallowedTools!==void 0&&(n.disallowedTools=t.disallowedTools);let i=e.conversationMcpServers[t.conversationId];if(i&&t.disallowedTools){let r=new Set(t.disallowedTools),o=e.conversationMcpServerTools[t.conversationId]||{};for(let a of i){let l=o[a.name];l&&l.length>0?a.enabled=!l.some(c=>r.has(c)):a.enabled=!r.has(`mcp__${a.name}`)}}t.needRestart&&n&&(n.needRestart=!0);break}case"sync_messages_result":Wl(e,t);break;case"conversation_deleted":Zr(e,t);break;case"conversation_delete_result":t.ok&&Zr(e,t);break;case"turn_completed":Ol(e,t);break;case"conversation_closed":ql(e,t);break;case"claude_output":e.handleAssistantOutputFrame(t.conversationId,t.data);break;case"yeaft_output":case"yeaft_session_output":case"session_output":e.handleYeaftOutput(t);break;case"yeaft_asset_ready":{let n=t.conversationId||e.yeaftConversationId;if(!n||!t.image)break;e.messagesMap[n]||(e.messagesMap[n]=[]),e.messagesMap[n].some(r=>r?.type==="chat-image"&&r.assetId===t.image.assetId&&r.sessionId===t.sessionId&&r.turnId===t.turnId)||e.addMessageToConversation(n,{type:"chat-image",...t.image,sessionId:t.sessionId||null,vpId:t.vpId||null,speakerVpId:t.vpId||null,turnId:t.turnId||null,threadId:t.threadId||null});break}case"yeaft_history_chunk":Kl(e,t);break;case"yeaft_history_outline":e.handleYeaftHistoryOutline(t);break;case"yeaft_history_search_result":e.handleYeaftHistorySearchResult(t);break;case"yeaft_history_window":{let n=Ul(e,t);e.handleYeaftHistoryWindow(t,n);break}case"yeaft_tool_stats":{e._fetchYeaftToolStatsTimer&&(clearTimeout(e._fetchYeaftToolStatsTimer),e._fetchYeaftToolStatsTimer=null);let n=t?.snapshot,i=n&&typeof n=="object"&&!Array.isArray(n)?n:{};e.yeaftToolStats={snapshot:i,registered:Array.isArray(t?.registered)?t.registered:[],unused:Array.isArray(t?.unused)?t.unused:[],error:typeof t?.error=="string"?t.error:null,notice:typeof t?.notice=="string"?t.notice:null,fetchedAt:Date.now()},e.yeaftToolStatsLoading=!1;break}case"yeaft_debug_history":{let n=typeof t?.requestId=="string"?t.requestId:"",i=typeof t?.detailTurnId=="string"&&t.detailTurnId;if(n&&!i&&n!==e._yeaftDebugHistoryLatestListRequestId)break;e._fetchYeaftDebugHistoryTimer&&(clearTimeout(e._fetchYeaftDebugHistoryTimer),e._fetchYeaftDebugHistoryTimer=null),e._yeaftDebugHistoryInFlightKey=null;let r=Array.isArray(t?.turns)?t.turns:[],o=t?.search?dm:cm,a=i?r:r.slice(-o),l=new Set(a.map(h=>h?.turnId).filter(Boolean)),c=vm(Array.isArray(t?.loops)?t.loops:[]),d=i?c:c.filter(h=>!h?.turnId||l.has(h.turnId)),u=Array.isArray(t?.dreamEvents)?t.dreamEvents:[];e.yeaftDebugHistoryHasMore=!!t?.hasMore||!i&&r.length>a.length,!t?.detailTurnId&&Number.isFinite(t?.limit)&&t.limit>0&&(e.yeaftDebugHistoryLimit=Math.min(o,t.limit)),(!e.yeaftDebugTurnsById||typeof e.yeaftDebugTurnsById!="object")&&(e.yeaftDebugTurnsById={}),Array.isArray(e.yeaftDebugLoops)||(e.yeaftDebugLoops=[]),Array.isArray(e.yeaftDebugTurnOrder)||(e.yeaftDebugTurnOrder=[]);let p=i?{...e.yeaftDebugTurnsById}:{};for(let h of a){let b=h?.turnId;if(!b)continue;let R=p[b];if(R){let L=h?.detailsLoaded?{...R,...h}:{...h,...R};L.memoryLoaded==null&&R.memoryLoaded!=null&&(L.memoryLoaded=R.memoryLoaded),L.memoryAdjust==null&&R.memoryAdjust!=null&&(L.memoryAdjust=R.memoryAdjust),p[b]=L}else p[b]=h}e.yeaftDebugTurnsById=p;let f=h=>h?.loopInstanceId||`${h?.turnId||""}#${h?.loopNumber||0}`,g=e.yeaftDebugLoops,v=new Map;for(let h of g)h&&v.set(f(h),h);let m=new Set,A=[];for(let h of d){if(!h)continue;let b=f(h);m.add(b),A.push(v.get(b)||h)}if(i)for(let h of g)!h||m.has(f(h))||A.push(h);e.yeaftDebugLoops=A;let w=new Set,k=[],y=h=>{!h||w.has(h)||(w.add(h),k.push(h))};if(i){for(let h of e.yeaftDebugTurnOrder)y(h);for(let h of a)y(h?.turnId)}else for(let h of a)y(h?.turnId);e.yeaftDebugTurnOrder=i?k:k.slice(-o);for(let h of u){if(!h)continue;let b=null,R=h.sessionId||h.groupId;typeof h.target=="string"&&h.target.includes("/")?b=h.target:typeof R=="string"&&R?b=`group/${R}`:b="*",typeof e._appendDreamEvent=="function"&&e._appendDreamEvent(b,h),h.type==="dream_progress"&&typeof e.handleYeaftOutput=="function"&&e.handleYeaftOutput({event:h})}e.yeaftDebugHistoryLoading=!1,e.yeaftDebugHistoryError=typeof t?.error=="string"?t.error:null,e.yeaftDebugHistoryFetchedAt=Date.now();break}case"chat_image":t.conversationId&&t.fileId&&e.addMessageToConversation(t.conversationId,{type:"chat-image",fileId:t.fileId,previewToken:t.previewToken,mimeType:t.mimeType});break;case"error":{let n=t.conversationId||e.currentConversation,i=["Permission denied","Agent not found","No conversation selected","Agent is still syncing","No agent available","Agent access denied"].some(c=>t.message?.includes(c));if((t.message?.includes("Agent is still syncing")||t.message?.includes("Agent not found"))&&gt(e),["No conversation selected","Agent is still syncing","No agent available"].some(c=>t.message?.includes(c))&&n&&(delete e.processingConversations[n],Ae(e,n),e.finishStreamingForConversation(n)),i&&n){let c=e.messagesMap[n];if(c&&c.length>0)for(let d=c.length-1;d>=0&&d>=c.length-5;d--){let u=c[d];if(u&&u.type==="error"&&u._sysErrBaseContent!==void 0){if(u._sysErrBaseContent===t.message&&Date.now()-(u._sysErrFirstAt||0)<=3e3){u._sysErrCount=(u._sysErrCount||1)+1,u.content=`${u._sysErrBaseContent} (\xD7${u._sysErrCount})`,u._sysErrRemoveTimer&&(clearTimeout(u._sysErrRemoveTimer),u._sysErrRemoveTimer=setTimeout(()=>{let p=e.messagesMap[n];if(p){let f=p.findIndex(g=>g.id===u.id);f>=0&&p.splice(f,1)}},5e3));return}break}}}let o=Date.now().toString()+Math.random().toString(36).substr(2,9),a={type:"error",content:t.message,transient:i,dbMessageId:i?"err_"+o:void 0};i&&(a._sysErrBaseContent=t.message,a._sysErrCount=1,a._sysErrFirstAt=Date.now()),e.addMessageToConversation(n,a);let l=null;if(i&&n){let c=e.messagesMap[n];c&&c.length>0&&(l=c[c.length-1])}if(i&&n&&l){let c=n,d="err_"+o;l._sysErrRemoveTimer=setTimeout(()=>{let u=e.messagesMap[c];if(u){let p=u.findIndex(f=>f.id===d);p>=0&&u.splice(p,1)}},5e3)}!i&&n&&(delete e.processingConversations[n],Ae(e,n),e.finishStreamingForConversation(n));break}case"history_sessions_list":if(t.requestId&&e._historySessionsRequestId&&t.requestId!==e._historySessionsRequestId)break;e.historySessions=t.sessions||[],e.historySessionsLoading=!1;break;case"folders_list":if(t.requestId&&e._foldersRequestId&&t.requestId!==e._foldersRequestId)break;e.folders=t.folders||[],e.foldersLoading=!1,e._foldersResolve&&(e._foldersResolve(),e._foldersResolve=null);break;case"models_list":if(t.requestId&&e._modelsRequestId&&t.requestId!==e._modelsRequestId)break;e.providerModels=t.models||[],e.providerModelsLoading=!1,e._modelsTimeout&&(clearTimeout(e._modelsTimeout),e._modelsTimeout=null),e._modelsResolve&&(e._modelsResolve(e.providerModels),e._modelsResolve=null);break;case"conversation_refresh":Nl(e,t);break;case"session_pinned":if(t.conversationId){let n=t.agentId?{agentId:t.agentId}:{};if(typeof e.setSessionPinned=="function")e.setSessionPinned(t.conversationId,!!t.pinned,n);else try{let i=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();i&&typeof i.applyPinState=="function"&&i.applyPinState(t.conversationId,!!t.pinned,t.agentId||e.yeaftSessionAgentById?.[t.conversationId]||e.currentAgent||null)}catch{}}break;case"execution_cancelled":Bl(e,t);break;case"slash_commands_update":if(Array.isArray(t.slashCommands)){let n=[...new Set(t.slashCommands)];if(t.commandSet==="yeaft"){let i=t.conversationId&&t.conversationId!=="__preload__"?t.conversationId:null,r=t.agentId&&e.yeaftConversationIdsByAgent?.[t.agentId]||null,o=i||r;o&&(e.slashCommandsMap[o]=n);let a=e.yeaftConversationId||null,l=t.agentId?e.currentAgent===t.agentId&&(r===a||i===a):i===a;a&&l&&(e.slashCommandsMap[a]=n)}else t.conversationId&&(e.slashCommandsMap[t.conversationId]=n),t.agentId&&(e.slashCommandsMap[`agent:${t.agentId}`]=n)}t.slashCommandDescriptions&&(e.slashCommandDescriptions={...e.slashCommandDescriptions,...t.slashCommandDescriptions});break;case"compact_status":{let n=t.conversationId;e.compactStatus={conversationId:n,status:t.status,message:t.message},t.status==="completed"?setTimeout(()=>{e.compactStatus?.conversationId===n&&e.compactStatus?.status==="completed"&&(e.compactStatus=null)},3e3):t.status==="compacting"&&setTimeout(()=>{e.compactStatus?.conversationId===n&&e.compactStatus?.status==="compacting"&&(e.compactStatus=null)},3e4)}break;case"pong_session":{let n=t.conversationId;if(!n)break;if(e._pongTimeouts?.[n]&&(clearTimeout(e._pongTimeouts[n]),delete e._pongTimeouts[n]),t.status==="unsupported"){Ae(e,n),xl(e,n);break}if(t.status==="ok")e.sessionHealth?.[n]&&delete e.sessionHealth[n],!t.isProcessing&&e.processingConversations[n]&&(delete e.processingConversations[n],Ae(e,n),e.finishStreamingForConversation(n));else if(e.sessionHealth||(e.sessionHealth={}),e.sessionHealth[n]={status:t.status},t.status==="session-lost"||t.status==="cli-exited"){if(e._autoRefreshed||(e._autoRefreshed={}),!e._autoRefreshed[n]){e._autoRefreshed[n]=!0;let i=e.conversations.find(r=>r.id===n);e.sendWsMessage({type:"refresh_conversation",conversationId:n,agentId:i?.agentId})}delete e.processingConversations[n],Ae(e,n),e.finishStreamingForConversation(n)}break}case"ask_user_question":if(t.conversationId){let n=()=>{let i=e.messagesMap[t.conversationId]||[];for(let r=i.length-1;r>=0;r--)if(i[r].type==="tool-use"&&i[r].toolName==="AskUserQuestion"&&!i[r].askRequestId)return i[r].askRequestId=t.requestId,i[r].askQuestions=t.questions,!0;return!1};if(!n()){let i=0,r=setInterval(()=>{i++,(n()||i>=10)&&clearInterval(r)},200)}}break;case"restart_agent_ack":window.dispatchEvent(new CustomEvent("agent-restart-ack",{detail:{agentId:t.agentId}}));break;case"upgrade_agent_ack":window.dispatchEvent(new CustomEvent("agent-upgrade-ack",{detail:{agentId:t.agentId,success:t.success,error:t.error,alreadyLatest:t.alreadyLatest,version:t.version,reason:t.reason,currentNode:t.currentNode,requiredNode:t.requiredNode}}));break;case"terminal_created":case"terminal_output":case"terminal_closed":case"terminal_error":case"file_content":case"file_saved":case"directory_listing":case"git_status_result":case"git_diff_result":case"git_op_result":case"file_op_result":case"file_search_result":t.type,t.type,window.dispatchEvent(new CustomEvent("workbench-message",{detail:t}));break;case"server_updating":e.connectionState="updating";break;case"context_usage":e.contextUsage={inputTokens:t.inputTokens,maxTokens:t.maxTokens,percentage:t.percentage,conversationId:t.conversationId};break;case"mcp_servers_list":case"mcp_config_updated":t.agentId&&t.servers&&(e.mcpServers[t.agentId]=t.servers);break;case"expert_roles_list":t.roles&&(e.expertRoleDefinitions=t.roles);break;case"llm_models_discovered":t.agentId&&(e.llmModelDiscovery=e.llmModelDiscovery||{},e.llmModelDiscovery[t.agentId]=t);break;case"llm_config":case"llm_config_updated":if(t.agentId){let n=t.agentConfig||lm(t),i=t.effectiveConfig||n;e.llmConfig[t.agentId]={providers:t.providers||i.providers||[],primaryModel:t.primaryModel||i.primaryModel||null,fastModel:t.fastModel||i.fastModel||null,language:t.language||n.language||i.language||"en",needsSetup:t.needsSetup??i.needsSetup??!1,agentConfig:n,effectiveConfig:i,requestId:t.requestId||null,statusRefreshError:t.statusRefreshError||null,error:t.error||null,loaded:!0}}break;case"models_dev_registry":if(e.modelsDevRegistry={registry:t.registry||{},fetchedAt:t.fetchedAt||Date.now(),error:t.error||null,loaded:!0},e._modelsDevPending){let n=e._modelsDevPending;e._modelsDevPending=null,n.timer&&clearTimeout(n.timer);for(let i of n.resolvers)i(e.modelsDevRegistry)}break;case"yeaft_settings":case"yeaft_settings_updated":t.agentId&&(e.yeaftSettings[t.agentId]={maxConcurrentThreads:t.maxConcurrentThreads??6,autoArchiveIdleDays:t.autoArchiveIdleDays??30,error:t.error||null,loaded:!0,at:Date.now()});break;case"search_settings":case"search_settings_updated":{let n={backend:t.backend||"tavily",tavilyKeyConfigured:!!t.tavilyKeyConfigured,tavilyKeyMasked:t.tavilyKeyMasked||null,disableHtmlFallback:!!t.disableHtmlFallback,error:t.error||null,loaded:!0,at:Date.now()};e.searchSettings=n;let i=e._searchPending,r=t.type==="search_settings"?"load":"update";i&&i[r]&&(i[r](n),delete i[r]);break}case"tavily_usage":{let n=t.error?{error:t.error}:{plan:t.plan,used:t.used,limit:t.limit,paygoUsed:t.paygoUsed,paygoLimit:t.paygoLimit};e.tavilyUsage=n,e.tavilyUsageLoading=!1;let i=e._searchPending;i&&i.usage&&(i.usage(n),delete i.usage);break}case"yeaft_mcp_list_result":case"yeaft_mcp_add_result":case"yeaft_mcp_remove_result":case"yeaft_mcp_reload_result":case"yeaft_mcp_updated":{if(Array.isArray(t.servers)&&(e.yeaftMcpServers=t.servers),t.runtime&&typeof t.runtime=="object"&&(e.yeaftMcpRuntime={connected:!!t.runtime.connected,toolCount:t.runtime.toolCount||0,perServer:Array.isArray(t.runtime.perServer)?t.runtime.perServer:[]}),e.yeaftMcpLoading=!1,e.yeaftMcpError=t.error||null,t.requestId){let n=e._mcpPending;n&&n[t.requestId]&&(n[t.requestId](t),delete n[t.requestId])}break}case"conversation_mcp_update":t.conversationId&&t.servers&&(e.conversationMcpServers[t.conversationId]=t.servers),t.conversationId&&t.serverTools&&(e.conversationMcpServerTools[t.conversationId]=t.serverTools);break;case"btw_stream":e.appendBtwDelta(t.delta);break;case"btw_done":e.btwLoading=!1,t.btwSessionId&&(e.btwSessionId=t.btwSessionId);break;case"btw_error":{let n=e.btwMessages[e.btwMessages.length-1];n&&n.role==="assistant"&&(n.content="Error: "+t.error),e.btwLoading=!1;break}case"background_task_started":case"background_task_output":break;case"subagent_started":t.conversationId&&t.subagentId&&e.addSubagent(t.conversationId,{id:t.subagentId,slug:t.slug,type:t.subagentType,description:t.description,parentToolUseId:t.parentToolUseId});break;case"subagent_message":t.conversationId&&t.subagentId&&t.message&&e.appendSubagentMessage(t.conversationId,t.subagentId,t.message);break;case"subagent_completed":t.conversationId&&t.subagentId&&e.completeSubagent(t.conversationId,t.subagentId);break}}var cm,dm,um,rc=H(()=>{ct();Yn();St();Gt();Kt();to();sc();ii();cm=1,dm=5,um=500});function ac(){return Object.values(oc).sort((t,s)=>t.order-s.order).map(t=>({teamId:t.id,team:t,roles:Object.values(dt).filter(s=>s.group===t.id)}))}function lc(e){let t=[];for(let s of Object.values(dt)){t.push({roleId:s.id,roleName:s.name,roleTitle:s.title,actionId:null,actionName:null,searchText:`${s.name} ${s.fullName} ${s.title} ${s.titleEn}`.toLowerCase(),displayText:s.name,group:s.group});for(let n of s.actions)t.push({roleId:s.id,roleName:s.name,roleTitle:s.title,actionId:n.id,actionName:n.name,searchText:`${s.name} ${s.fullName} ${s.title} ${n.name} ${n.nameEn}`.toLowerCase(),displayText:`${s.name}\xB7${n.name}`,group:s.group})}if(e&&e.length>0){for(let s of e)if(t.push({roleId:s.id,roleName:s.name,roleTitle:s.title,actionId:null,actionName:null,searchText:`${s.name} ${s.fullName||""} ${s.title} ${s.titleEn||""}`.toLowerCase(),displayText:s.name,group:"custom"}),s.actions)for(let n of s.actions)t.push({roleId:s.id,roleName:s.name,roleTitle:s.title,actionId:n.id,actionName:n.name,searchText:`${s.name} ${s.fullName||""} ${s.title} ${n.name} ${n.nameEn||""}`.toLowerCase(),displayText:`${s.name}\xB7${n.name}`,group:"custom"})}return t}function Xt(e,t){let s=dt[e.role];if(s){if(e.action){let n=s.actions.find(i=>i.id===e.action);return n?`${s.name}\xB7${n.name}`:s.name}return s.name}if(t){let n=t.find(i=>i.id===e.role);if(n){if(e.action){let i=n.actions?.find(r=>r.id===e.action);return i?`${n.name}\xB7${i.name}`:n.name}return n.name}}return e.role}function so(e,t,s,n="zh-CN"){if(!e||e.length===0||!t||t.length===0)return null;let i=n==="zh-CN";if(!e.some(l=>!dt[l.role]&&t.some(c=>c.id===l.role)))return null;if(e.length===1){let{role:l,action:c}=e[0],d=t.find(p=>p.id===l);if(!d)return null;let u;if(c&&d.actions){let p=d.actions.find(f=>f.id===c);p?s?(u=(i?p.messageTemplate:p.messageTemplateEn)||"",u+=s):u=(i?p.defaultMessage:p.defaultMessageEn)||"":u=((i?d.messagePrefix:d.messagePrefixEn)||"")+(s||"")}else u=((i?d.messagePrefix:d.messagePrefixEn)||"")+(s||"");return{effectivePrompt:u}}let o=[];for(let{role:l,action:c}of e){let d=t.find(p=>p.id===l),u=dt[l];if(d)if(c){let p=d.actions?.find(f=>f.id===c);p&&o.push((i?p.messageTemplate:p.messageTemplateEn)||"")}else o.push((i?d.messagePrefix:d.messagePrefixEn)||"");else if(u)return null}return o.length===0?null:{effectivePrompt:o.join(`
4
4
  ---
5
5
 
6
- `)+(s||"")}}function dc(e){return Object.values(oc).filter(t=>e||!t.adminOnly).sort((t,s)=>t.order-s.order)}var oc,dt,cc,Zt,dn=H(()=>{oc={dev:{id:"dev",name:"\u8F6F\u4EF6\u5F00\u53D1",nameEn:"Software Dev",icon:"\u{1F5A5}\uFE0F",order:0},trading:{id:"trading",name:"\u4EA4\u6613",nameEn:"Trading",icon:"\u{1F4C8}",order:1,adminOnly:!0},writing:{id:"writing",name:"\u5199\u4F5C",nameEn:"Writing",icon:"\u270D\uFE0F",order:2,adminOnly:!0},video:{id:"video",name:"\u89C6\u9891",nameEn:"Video",icon:"\u{1F3AC}",order:3,adminOnly:!0}},dt={jobs:{id:"jobs",name:"Jobs",fullName:"Steve Jobs",title:"\u4EA7\u54C1\u7ECF\u7406",titleEn:"Product Manager",group:"dev",actions:[{id:"product-analysis",name:"\u4EA7\u54C1\u5206\u6790",nameEn:"Product Analysis"},{id:"design-review",name:"\u8BBE\u8BA1\u5BA1\u67E5",nameEn:"Design Review"},{id:"requirements",name:"\u9700\u6C42\u62C6\u89E3",nameEn:"Requirements"}]},fowler:{id:"fowler",name:"Fowler",fullName:"Martin Fowler",title:"\u8F6F\u4EF6\u67B6\u6784\u5E08",titleEn:"Software Architect",group:"dev",actions:[{id:"architecture",name:"\u67B6\u6784\u5BA1\u67E5",nameEn:"Architecture Review"},{id:"refactoring",name:"\u91CD\u6784\u5206\u6790",nameEn:"Refactoring"},{id:"code-review",name:"\u4EE3\u7801\u5BA1\u67E5",nameEn:"Code Review"}]},torvalds:{id:"torvalds",name:"Torvalds",fullName:"Linus Torvalds",title:"\u7CFB\u7EDF\u5F00\u53D1\u5DE5\u7A0B\u5E08",titleEn:"Systems Engineer",group:"dev",actions:[{id:"system-design",name:"\u7CFB\u7EDF\u8BBE\u8BA1",nameEn:"System Design"},{id:"performance",name:"\u6027\u80FD\u4F18\u5316",nameEn:"Performance"},{id:"code-style",name:"\u4EE3\u7801\u98CE\u683C",nameEn:"Code Style"},{id:"implementation",name:"\u4EE3\u7801\u5B9E\u73B0",nameEn:"Implementation"}]},beck:{id:"beck",name:"Beck",fullName:"Kent Beck",title:"\u6D4B\u8BD5\u5DE5\u7A0B\u5E08",titleEn:"Test Engineer",group:"dev",actions:[{id:"test-strategy",name:"\u6D4B\u8BD5\u7B56\u7565",nameEn:"Test Strategy"},{id:"tdd-guide",name:"TDD \u6307\u5BFC",nameEn:"TDD Guide"},{id:"quality-check",name:"\u8D28\u91CF\u8BC4\u4F30",nameEn:"Quality Check"}]},schneier:{id:"schneier",name:"Schneier",fullName:"Bruce Schneier",title:"\u5B89\u5168\u5DE5\u7A0B\u5E08",titleEn:"Security Engineer",group:"dev",actions:[{id:"security-audit",name:"\u5B89\u5168\u5BA1\u8BA1",nameEn:"Security Audit"},{id:"threat-model",name:"\u5A01\u80C1\u5EFA\u6A21",nameEn:"Threat Model"},{id:"auth-review",name:"\u8BA4\u8BC1\u5BA1\u67E5",nameEn:"Auth Review"}]},rams:{id:"rams",name:"Rams",fullName:"Dieter Rams",title:"UI/UX \u8BBE\u8BA1\u5E08",titleEn:"UI/UX Designer",group:"dev",actions:[{id:"ui-review",name:"\u754C\u9762\u5BA1\u67E5",nameEn:"UI Review"},{id:"interaction",name:"\u4EA4\u4E92\u8BBE\u8BA1",nameEn:"Interaction Design"},{id:"layout",name:"\u5E03\u5C40\u4F18\u5316",nameEn:"Layout Optimization"}]},graham:{id:"graham",name:"Graham",fullName:"Paul Graham",title:"\u6280\u672F\u5199\u4F5C / \u65B9\u6848\u8BC4\u4F30\u5E08",titleEn:"Tech Writer / Evaluator",group:"dev",actions:[{id:"writing",name:"\u6280\u672F\u5199\u4F5C",nameEn:"Tech Writing"},{id:"proposal-review",name:"\u65B9\u6848\u8BC4\u4F30",nameEn:"Proposal Review"},{id:"explain",name:"\u6982\u5FF5\u89E3\u91CA",nameEn:"Explain"}]},hightower:{id:"hightower",name:"Hightower",fullName:"Kelsey Hightower",title:"DevOps / \u8FD0\u7EF4\u5DE5\u7A0B\u5E08",titleEn:"DevOps Engineer",group:"dev",actions:[{id:"deployment",name:"\u90E8\u7F72\u5BA1\u67E5",nameEn:"Deployment Review"},{id:"cicd",name:"CI/CD \u8BC4\u4F30",nameEn:"CI/CD Review"},{id:"infra",name:"\u57FA\u7840\u8BBE\u65BD",nameEn:"Infrastructure"}]},gregg:{id:"gregg",name:"Gregg",fullName:"Brendan Gregg",title:"\u6027\u80FD\u5DE5\u7A0B\u5E08",titleEn:"Performance Engineer",group:"dev",actions:[{id:"perf-analysis",name:"\u6027\u80FD\u5206\u6790",nameEn:"Perf Analysis"},{id:"tuning",name:"\u7CFB\u7EDF\u8C03\u4F18",nameEn:"Tuning"},{id:"benchmark",name:"\u57FA\u51C6\u6D4B\u8BD5",nameEn:"Benchmark"}]},codd:{id:"codd",name:"Codd",fullName:"Edgar Codd",title:"\u6570\u636E\u5E93 / SQL \u4E13\u5BB6",titleEn:"Database / SQL Expert",group:"dev",actions:[{id:"sql-optimization",name:"SQL \u4F18\u5316",nameEn:"SQL Optimization"},{id:"schema-design",name:"Schema \u8BBE\u8BA1",nameEn:"Schema Design"},{id:"data-modeling",name:"\u6570\u636E\u5EFA\u6A21",nameEn:"Data Modeling"}]},knuth:{id:"knuth",name:"Knuth",fullName:"Donald Knuth",title:"\u7B97\u6CD5 / \u6570\u636E\u5904\u7406\u4E13\u5BB6",titleEn:"Algorithm Expert",group:"dev",actions:[{id:"algorithm-design",name:"\u7B97\u6CD5\u8BBE\u8BA1",nameEn:"Algorithm Design"},{id:"data-processing",name:"\u6570\u636E\u5904\u7406",nameEn:"Data Processing"},{id:"optimization",name:"\u4F18\u5316",nameEn:"Optimization"}]},thomas:{id:"thomas",name:"Thomas",fullName:"Dave Thomas",title:"\u6280\u672F\u6587\u6863\u5DE5\u7A0B\u5E08",titleEn:"Tech Doc Engineer",group:"dev",actions:[{id:"api-docs",name:"API \u6587\u6863",nameEn:"API Docs"},{id:"readme",name:"README",nameEn:"README"},{id:"comment-review",name:"\u6CE8\u91CA\u5BA1\u67E5",nameEn:"Comment Review"}]},soros:{id:"soros",name:"Soros",fullName:"George Soros",title:"\u5B8F\u89C2\u7B56\u7565\u5E08",titleEn:"Macro Strategist",group:"trading",actions:[{id:"macro-analysis",name:"\u5B8F\u89C2\u5206\u6790",nameEn:"Macro Analysis"},{id:"risk-assessment",name:"\u98CE\u9669\u8BC4\u4F30",nameEn:"Risk Assessment"},{id:"thesis-review",name:"\u8BBA\u70B9\u5BA1\u67E5",nameEn:"Thesis Review"}]},livermore:{id:"livermore",name:"Livermore",fullName:"Jesse Livermore",title:"\u6280\u672F\u5206\u6790\u5E08",titleEn:"Technical Analyst",group:"trading",actions:[{id:"price-action",name:"\u4EF7\u683C\u884C\u4E3A",nameEn:"Price Action"},{id:"pattern-recognition",name:"\u56FE\u5F62\u8BC6\u522B",nameEn:"Pattern Recognition"},{id:"trade-plan",name:"\u4EA4\u6613\u8BA1\u5212",nameEn:"Trade Plan"}]},dalio:{id:"dalio",name:"Dalio",fullName:"Ray Dalio",title:"\u7814\u7A76\u5458 / \u7ECF\u6D4E\u5206\u6790\u5E08",titleEn:"Research / Economist",group:"trading",actions:[{id:"economic-analysis",name:"\u7ECF\u6D4E\u5206\u6790",nameEn:"Economic Analysis"},{id:"portfolio-review",name:"\u7EC4\u5408\u5BA1\u67E5",nameEn:"Portfolio Review"},{id:"research-report",name:"\u7814\u7A76\u62A5\u544A",nameEn:"Research Report"}]},taleb:{id:"taleb",name:"Taleb",fullName:"Nassim Taleb",title:"\u98CE\u63A7\u5B98",titleEn:"Risk Manager",group:"trading",actions:[{id:"risk-audit",name:"\u98CE\u9669\u5BA1\u8BA1",nameEn:"Risk Audit"},{id:"antifragile",name:"\u53CD\u8106\u5F31\u8BC4\u4F30",nameEn:"Antifragile Assessment"},{id:"stress-test",name:"\u538B\u529B\u6D4B\u8BD5",nameEn:"Stress Test"}]},jones:{id:"jones",name:"Jones",fullName:"Paul Tudor Jones",title:"\u4EA4\u6613\u6267\u884C\u5458",titleEn:"Trade Executor",group:"trading",actions:[{id:"execution",name:"\u6267\u884C\u8BA1\u5212",nameEn:"Execution Plan"},{id:"position-sizing",name:"\u4ED3\u4F4D\u8BA1\u7B97",nameEn:"Position Sizing"},{id:"trade-review",name:"\u4EA4\u6613\u590D\u76D8",nameEn:"Trade Review"}]},simons:{id:"simons",name:"Simons",fullName:"Jim Simons",title:"\u91CF\u5316\u5206\u6790\u5E08",titleEn:"Quant Analyst",group:"trading",actions:[{id:"quant-signal",name:"\u91CF\u5316\u4FE1\u53F7",nameEn:"Quant Signal"},{id:"backtest-review",name:"\u56DE\u6D4B\u5BA1\u67E5",nameEn:"Backtest Review"},{id:"model-design",name:"\u6A21\u578B\u8BBE\u8BA1",nameEn:"Model Design"}]},jinyong:{id:"jinyong",name:"\u91D1\u5EB8",fullName:"\u91D1\u5EB8\uFF08Louis Cha\uFF09",title:"\u6B66\u4FA0\u5927\u5E08",titleEn:"Wuxia Master",group:"writing",actions:[{id:"world-building",name:"\u6B66\u4FA0\u4E16\u754C\u89C2",nameEn:"Wuxia World Building"},{id:"character-design",name:"\u4EBA\u7269\u5851\u9020",nameEn:"Character Design"},{id:"plot-design",name:"\u60C5\u8282\u7F16\u6392",nameEn:"Plot Design"}]},zhouzi:{id:"zhouzi",name:"\u8098\u5B50",fullName:"\u4F1A\u8BF4\u8BDD\u7684\u8098\u5B50",title:"\u7F51\u6587\u5929\u738B",titleEn:"Web Novel King",group:"writing",actions:[{id:"cool-factor",name:"\u723D\u611F\u8BBE\u8BA1",nameEn:"Cool Factor Design"},{id:"pacing",name:"\u8282\u594F\u628A\u63A7",nameEn:"Pacing Control"},{id:"cheat-design",name:"\u91D1\u624B\u6307\u8BBE\u8BA1",nameEn:"Cheat System Design"}]},qiongyao:{id:"qiongyao",name:"\u743C\u7476",fullName:"\u743C\u7476\uFF08Chiung Yao\uFF09",title:"\u8A00\u60C5\u5B97\u5E08",titleEn:"Romance Master",group:"writing",actions:[{id:"emotion-writing",name:"\u60C5\u611F\u63CF\u5199",nameEn:"Emotion Writing"},{id:"dialogue-design",name:"\u5BF9\u8BDD\u8BBE\u8BA1",nameEn:"Dialogue Design"},{id:"romance-arc",name:"\u8650\u604B\u67B6\u6784",nameEn:"Romance Arc"}]},luxun:{id:"luxun",name:"\u9C81\u8FC5",fullName:"\u9C81\u8FC5\uFF08Lu Xun\uFF09",title:"\u6587\u5B66\u5DE8\u5320",titleEn:"Literary Giant",group:"writing",actions:[{id:"satire",name:"\u8BBD\u523A\u5199\u4F5C",nameEn:"Satirical Writing"},{id:"character-sketch",name:"\u4EBA\u7269\u523B\u753B",nameEn:"Character Sketch"},{id:"prose-craft",name:"\u6587\u7B14\u9524\u70BC",nameEn:"Prose Craft"}]},kubrick:{id:"kubrick",name:"Kubrick",fullName:"Stanley Kubrick",title:"\u5BFC\u6F14 / \u89C6\u89C9\u603B\u76D1",titleEn:"Director / Visual Director",group:"video",actions:[{id:"narrative-pacing",name:"\u53D9\u4E8B\u8282\u594F",nameEn:"Narrative Pacing"},{id:"visual-concept",name:"\u89C6\u89C9\u6982\u5FF5",nameEn:"Visual Concept"},{id:"scene-breakdown",name:"\u573A\u666F\u62C6\u89E3",nameEn:"Scene Breakdown"}]},kaufman:{id:"kaufman",name:"Kaufman",fullName:"Charlie Kaufman",title:"\u7F16\u5267",titleEn:"Screenwriter",group:"video",actions:[{id:"script-writing",name:"\u811A\u672C\u5199\u4F5C",nameEn:"Script Writing"},{id:"character-design",name:"\u89D2\u8272\u8BBE\u8BA1",nameEn:"Character Design"},{id:"narrative-structure",name:"\u53D9\u4E8B\u7ED3\u6784",nameEn:"Narrative Structure"}]},spielberg:{id:"spielberg",name:"Spielberg",fullName:"Steven Spielberg",title:"\u5206\u955C / \u89C6\u89C9\u53D9\u4E8B\u5E08",titleEn:"Storyboard / Visual Storyteller",group:"video",actions:[{id:"storyboard",name:"\u5206\u955C\u8BBE\u8BA1",nameEn:"Storyboard"},{id:"shot-design",name:"\u955C\u5934\u65B9\u6848",nameEn:"Shot Design"},{id:"visual-storytelling",name:"\u89C6\u89C9\u53D9\u4E8B",nameEn:"Visual Storytelling"}]},schoonmaker:{id:"schoonmaker",name:"Schoonmaker",fullName:"Thelma Schoonmaker",title:"\u526A\u8F91\u5E08",titleEn:"Editor",group:"video",actions:[{id:"editing-rhythm",name:"\u526A\u8F91\u8282\u594F",nameEn:"Editing Rhythm"},{id:"sequence-design",name:"\u5E8F\u5217\u8BBE\u8BA1",nameEn:"Sequence Design"},{id:"final-cut",name:"\u6700\u7EC8\u5BA1\u7247",nameEn:"Final Cut"}]}};cc="dev",Zt=3});function km(e,t){return!t||!e?.yeaftConversationIdsByAgent?[]:Object.entries(e.yeaftConversationIdsByAgent).filter(([,s])=>s===t).map(([s])=>s).filter(Boolean)}function uc(){return`cm_${crypto.randomUUID()}`}function pc(e,t){if(t===e.currentAgent&&!e.pendingAgentSelection)return;let s=`agent_select_${crypto.randomUUID()}`;return e.agentSwitching=!0,e.pendingAgentSelection={agentId:t,requestId:s},e.sendWsMessage({type:"select_agent",agentId:t,requestId:s})===!1?(e.pendingAgentSelection=null,e.agentSwitching=!1,null):s}function fc(e,t,s=null,n=null,i={}){let r=s||e.currentAgent;if(!r){e.addMessage({type:"error",content:Pe("chat.agent.selectFirst")});return}ks(e,!0,Pe("chat.session.creating"));let o={type:"create_conversation",agentId:r,workDir:t||e.currentAgentWorkDir};n!==null&&(o.disallowedTools=n),i&&typeof i.provider=="string"&&(o.provider=i.provider),i&&i.providerOptions&&typeof i.providerOptions=="object"&&(o.providerOptions=i.providerOptions),e.sendWsMessage(o)}function gc(e,t,s,n=null,i=null,r=null){let o=n||e.currentAgent;if(!o){e.addMessage({type:"error",content:Pe("chat.agent.selectFirst")});return}let a=null,l={};i&&typeof i=="object"&&!Array.isArray(i)?l=i:(a=i,r&&typeof r=="object"&&(l=r)),ks(e,!0,Pe("chat.session.loadingHistory"));let c={type:"resume_conversation",agentId:o,claudeSessionId:t,workDir:s||e.currentAgentWorkDir};a!==null&&(c.disallowedTools=a),typeof l.provider=="string"&&(c.provider=l.provider),l.providerOptions&&typeof l.providerOptions=="object"&&(c.providerOptions=l.providerOptions),e.sendWsMessage(c)}function mc(e,t,s){if(e.panels.length>1){let a=e.activePanelId||e.panels[0]?.id;a&&e.setPanelConversation(a,t);return}if(t===e.currentConversation)return;let n=e.conversations.find(a=>a.id===t&&a.type!=="yeaft");if(n&&n.agentId&&n.agentId!==e.currentAgent){let a=e.agents.find(l=>l.id===n.agentId);a&&(e.currentAgent=n.agentId,e.currentAgentInfo=a,e.sendWsMessage({type:"select_agent",agentId:n.agentId,silent:!0}))}e.sendWsMessage({type:"select_conversation",conversationId:t}),e.panels.length>1?e.activeConversations.includes(t)||e.activeConversations.push(t):e.activeConversations=[t],n&&(e.currentWorkDir=n.workDir);let i=e.messagesMap[t],r=Yt(i);r!==null?e.requestChatHistory?.(t,{mode:"delta",afterMessageId:r}):((!i||i.length===0)&&(e.messagesMap[t]=[],ks(e,!0,Pe("chat.session.loadingHistory"))),e.requestChatHistory?.(t,{mode:"recent",turns:5})),e.loadingMoreMessages=!1;let o=e.chatSessionState[t];e.hasMoreMessages=!!o?.hasMoreOlder,Ss(e)}function no(e,t,s){t&&e.sendWsMessage({type:"update_conversation_settings",conversationId:t,...s})}function hc(e,t,s){let n=e.currentConversation;if(!n)return;let i=e.conversationMcpServers[n];if(i){let p=i.find(f=>f.name===t);p&&(p.enabled=s)}let r=e.conversationMcpServers[n]||[],o=e.conversationMcpServerTools[n]||{},a=[];for(let p of r)if(!p.enabled){let f=o[p.name];f&&f.length>0?a.push(...f):a.push(`mcp__${p.name}`)}let u=[...(e.conversations.find(p=>p.id===n)?.disallowedTools||[]).filter(p=>!p.startsWith("mcp__")),...a];no(e,n,{disallowedTools:u})}function vc(e,t,s){return t?e.sendWsMessage({type:"delete_conversation",requestId:`delete_${crypto.randomUUID()}`,conversationId:t,...s?{agentId:s}:{}}):!1}function yc(e,t,s){e._recentlyDeletedSessions||(e._recentlyDeletedSessions={}),e._recentlyDeletedSessions[t]=Date.now(),e.conversations=e.conversations.filter(r=>r.id!==t);let n=e.activeConversations.indexOf(t);n>=0&&(e.activeConversations.splice(n,1),e.activeConversations.length===0&&(localStorage.removeItem("lastViewedConversation"),e.lastViewedConversation=null));for(let r of e.panels)r.conversationId===t&&(r.conversationId=null);let i=e.pinnedSessions.indexOf(t);i>=0&&(e.pinnedSessions.splice(i,1),localStorage.setItem("pinned-sessions",JSON.stringify(e.pinnedSessions))),e.sendWsMessage({type:"delete_conversation",requestId:`delete_${crypto.randomUUID()}`,conversationId:t,...s?{agentId:s}:{}})}function bc(e,t,s=[],n={}){let i=n.expertSelections&&n.expertSelections.length>0;if(!t.trim()&&s.length===0&&!i||!e.currentAgent||!e.currentConversation)return;let r=uc();if(e.addMessage({type:"user",content:t,clientMessageId:r,attachments:s.length>0?s:void 0,expertSelections:i?n.expertSelections:void 0}),t.trim()){let c=t.trim().substring(0,100);e.conversationTitles[e.currentConversation]=c}else if(i){let c=n.expertSelections[0],d=`@${c.role}${c.action?"\xB7"+c.action:""}`;e.conversationTitles[e.currentConversation]=d}let o=e.conversations.find(c=>c.id===e.currentConversation);o&&(o.lastMessageAt=Date.now()),e.processingConversations[e.currentConversation]||(e.processingConversations[e.currentConversation]=!0,e._closedAt?.[e.currentConversation]&&delete e._closedAt[e.currentConversation],e._turnCompletedConvs?.delete(e.currentConversation),e.getOrCreateExecutionStatus(e.currentConversation),Cs(e,e.currentConversation));let a=s.map(c=>c.fileId),l={type:"chat",conversationId:e.currentConversation,prompt:t,fileIds:a,workDir:e.currentWorkDir,clientMessageId:r};if(n.targetRole&&(l.targetRole=n.targetRole),i){l.expertSelections=n.expertSelections;let c=so(n.expertSelections,e.customExpertRoles,t,e.language||"zh-CN");c&&(l.expertMessage=c.effectivePrompt)}e.sendWsMessage(l)||tn(e).then(()=>{e.sendWsMessage(l)}).catch(()=>{e.addMessage({type:"system",content:Pe("chat.connection.reconnectFailed")}),delete e.processingConversations[e.currentConversation],Ae(e,e.currentConversation)})}function wc(e){if(!e.currentConversation||!e.processingConversations[e.currentConversation])return;let t=e.currentConversation;e.sendWsMessage({type:"cancel_execution",conversationId:t}),delete e.processingConversations[t],Ae(e,t),e._closedAt||(e._closedAt={}),e._closedAt[t]=Date.now();let s=e.executionStatusMap[t];s&&(s.currentTool=null),e.finishStreamingForConversation(t),Ft(e,t),e.addMessage({type:"system",content:Pe("chat.execution.cancelled")})}function kc(e,t,s,n){let i=n||e.currentConversation,o=(e.messagesMap[i]||[]).find(g=>g.type==="tool-use"&&g.toolName==="AskUserQuestion"&&g.askRequestId===t),a=e.currentView==="yeaft"||!!o?.sessionId;if(a&&o?.askPending)return;let l=o?.sessionId||e.yeaftActiveSessionFilter||null,c=typeof o?.agentId=="string"&&o.agentId?o.agentId:null,d=a?km(e,i):[],u=d.length===1?d[0]:null;if(c&&u&&c!==u)return!1;let p=a&&!c&&!u&&typeof e.agentIdForSession=="function"?e.agentIdForSession(l):null,f=e.sendWsMessage(a?{type:"yeaft_ask_user_answer",agentId:c||u||p||e.yeaftAgentId||e.currentAgent||null,conversationId:i,requestId:t,toolCallId:o?.toolId||null,answers:s,sessionId:l,vpId:o?.vpId||o?.speakerVpId||null,turnId:o?.turnId||null,threadId:o?.threadId||"main"}:{type:"ask_user_answer",conversationId:i,requestId:t,answers:s});if(o&&!a)o.askAnswered=!0,o.selectedAnswers=s;else if(o&&f!==!1){let g=++wm;o.askPending=!0,o.pendingAnswers=s,o.askSubmitGeneration=g;let v=setTimeout(()=>{o.askSubmitGeneration!==g||o.askPending!==!0||(o.askPending=!1,o.pendingAnswers=null,o.askSubmitGeneration=null)},bm);typeof v?.unref=="function"&&v.unref()}f!==!1&&i&&!e.processingConversations[i]&&(e.processingConversations[i]=!0,e._closedAt?.[i]&&delete e._closedAt[i],e.getOrCreateExecutionStatus(i))}function Sc(e,t){t&&(e.activeConversations.includes(t)||e.activeConversations.length>=3||(e.activeConversations.push(t),e.messagesMap[t]||(e.messagesMap[t]=[],e.requestChatHistory?.(t,{mode:"recent",turns:5})),Ss(e)))}function Cc(e,t){let s=e.activeConversations.indexOf(t);s<0||(e.activeConversations.splice(s,1),e.activeConversations.length===0&&(localStorage.removeItem("lastViewedConversation"),e.lastViewedConversation=null),Ss(e))}function Ic(e,t,s,n=[],i={}){let r=i.expertSelections&&i.expertSelections.length>0;if(!s.trim()&&n.length===0&&!r||!e.currentAgent||!t)return;let o=uc();if(e.addMessageToConversation(t,{type:"user",content:s,clientMessageId:o,attachments:n.length>0?n:void 0,expertSelections:r?i.expertSelections:void 0}),s.trim()){let d=s.trim().substring(0,100);e.conversationTitles[t]=d}else if(r){let d=i.expertSelections[0],u=`@${d.role}${d.action?"\xB7"+d.action:""}`;e.conversationTitles[t]=u}let a=e.conversations.find(d=>d.id===t);a&&(a.lastMessageAt=Date.now()),e.processingConversations[t]||(e.processingConversations[t]=!0,e._closedAt?.[t]&&delete e._closedAt[t],e._turnCompletedConvs?.delete(t),e.getOrCreateExecutionStatus(t),Cs(e,t));let l=n.map(d=>d.fileId),c={type:"chat",conversationId:t,prompt:s,fileIds:l,workDir:a?.workDir||e.currentWorkDir,clientMessageId:o};if(i.targetRole&&(c.targetRole=i.targetRole),r){c.expertSelections=i.expertSelections;let d=so(i.expertSelections,e.customExpertRoles,s,e.language||"zh-CN");d&&(c.expertMessage=d.effectivePrompt)}e.sendWsMessage(c)||tn(e).then(()=>{e.sendWsMessage(c)}).catch(()=>{e.addMessageToConversation(t,{type:"system",content:Pe("chat.connection.reconnectFailed")}),delete e.processingConversations[t],Ae(e,t)})}function Ac(e,t){if(!t||!e.processingConversations[t])return;e.sendWsMessage({type:"cancel_execution",conversationId:t}),delete e.processingConversations[t],Ae(e,t),e._closedAt||(e._closedAt={}),e._closedAt[t]=Date.now();let s=e.executionStatusMap[t];s&&(s.currentTool=null),e.finishStreamingForConversation(t),Ft(e,t),e.addMessageToConversation(t,{type:"system",content:Pe("chat.execution.cancelled")})}function xc(e){e.ws&&e.ws.readyState===WebSocket.OPEN&&(typeof e.requestYeaftSessionInventory=="function"?e.requestYeaftSessionInventory():e.sendWsMessage({type:"get_agents"}))}function Tc(e){!e.currentAgent||!e.currentConversation||e.sendWsMessage({type:"refresh_conversation",conversationId:e.currentConversation})}function Mc(e,t){t&&e.sendWsMessage({type:"restart_agent",agentId:t})}function Pc(e,t){t&&e.sendWsMessage({type:"upgrade_agent",agentId:t})}var bm,wm,_c=H(()=>{Gt();Kt();$r();ii();rn();St();dn();bm=1e4,wm=0});function Cm(e=globalThis.localStorage){try{return e?.getItem(Dc)==="yeaft"?"yeaft":Rc}catch{return Rc}}function io(e,t=globalThis.localStorage){if(e!=="chat"&&e!=="yeaft")return!1;try{return t?.setItem(Dc,e),!!t}catch{return!1}}function Ec(e=globalThis.localStorage){let t=Cm(e);if(t!=="yeaft")return{currentView:t,_yeaftTransitionActive:!1,_savedActiveConversations:null,_pendingChatRestoreConversationId:null};let s=null;try{s=e?.getItem("lastViewedConversation")||null}catch{}let n=s&&!s.startsWith("yeaft-")?s:null;return{currentView:t,_yeaftTransitionActive:!0,_savedActiveConversations:null,_pendingChatRestoreConversationId:n}}function Lc(e){let t=!e._yeaftTransitionActive;return t&&(e._savedActiveConversations=[...e.activeConversations],e._yeaftTransitionActive=!0),e.activeConversations=[e.yeaftConversationId],t}function $c(e){e._yeaftTransitionActive&&(e.activeConversations=e._savedActiveConversations||[],e._savedActiveConversations=null,e._yeaftTransitionActive=!1)}var Dc,Rc,Vc=H(()=>{Dc="yeaft-preferred-conversation-view",Rc="chat"});function Fc(e,t,s){let n={...e||{}},i={...n[t]||{}};return i[s]=(i[s]||0)+1,n[t]=i,n}function Hc(e,t,s){let n={...e||{}},i={...n[t]||{}},r=(i[s]||0)-1;return r<=0?delete i[s]:i[s]=r,Object.keys(i).length===0?delete n[t]:n[t]=i,n}var Oc=H(()=>{});function ro(e){return e.currentView==="yeaft"?e.yeaftConversationId||null:e.activeConversations[0]||null}var qc=H(()=>{});function Nc({loops:e,turnsById:t,turnOrder:s,maxLoops:n}){if(!Array.isArray(e)||e.length<=n)return{loops:e,turnsById:t,turnOrder:s};let i=e.length-n,r=e.slice(i),o=new Set;for(let c of r)c&&c.turnId&&o.add(c.turnId);for(let c of s){let d=t[c];d&&d.closedAt==null&&o.add(c)}let a={};for(let c of Object.keys(t))o.has(c)&&(a[c]=t[c]);let l=s.filter(c=>o.has(c));return{loops:r,turnsById:a,turnOrder:l}}var Bc=H(()=>{});function Te(e){let t=Number(e);return Number.isFinite(t)?t:null}function xs(e){let t=Te(e);return Number.isInteger(t)&&t>0?t:null}function oo(e){let t=Te(e);return Number.isInteger(t)&&t>=0?t:null}function Wc(e){return xm.has(e)?1:0}function Tm(e,t){if(!e)return t||null;if(!t)return e;let s=Te(e.progressRevision),n=Te(t.progressRevision);if(s!=null||n!=null){if(s==null)return t;if(n==null)return e;if(s!==n)return n>s?t:e}let i=Wc(e.status),r=Wc(t.status);if(i!==r)return r>i?t:e;let o=Te(e.updatedAt)??Te(e.createdAt)??0;return(Te(t.updatedAt)??Te(t.createdAt)??0)>o?t:e}function As(e){return Math.max(0,Number(e)||0)}function Uc(e){return typeof e?.id=="string"&&e.id.startsWith("event:")?e.id.slice(6):null}function Mm(e,t){if(/^\d+$/.test(e)&&/^\d+$/.test(t)){let s=BigInt(e),n=BigInt(t);return s<n?-1:s>n?1:0}return e.localeCompare(t)}function Pm(e,t){let s=As(e?.createdAt)-As(t?.createdAt);if(s)return s;let n=Uc(e),i=Uc(t);if(n!=null&&i!=null)return Mm(n,i);let r=e?.role==="user"?0:1,o=t?.role==="user"?0:1;if(r!==o)return r-o;let a=As(e?.generation)-As(t?.generation);return a||As(e?.attempt)-As(t?.attempt)||String(e?.id||"").localeCompare(String(t?.id||""))}function un(...e){let t=new Map;for(let s of e){let n=Array.isArray(s)?s:[s];for(let i of n)i?.id&&t.set(i.id,Tm(t.get(i.id),i))}return[...t.values()].sort(Pm)}function nt(e){let t=Number(e);return Number.isInteger(t)&&t>0?t:1}function Ts(e,t,s,n){return`${e}:${t}:${s}:${nt(n)}`}function pn(e,t,s,n){return`${e}:${t}:${s}:${nt(n)}`}function Ms(e,t){if(!e||!t||e.id!==t.id)return!1;let s=Te(e.revision),n=Te(t.revision);if(s!=null&&n!=null&&s!==n)return s<n;let i=Te(e.coordinatorRevision),r=Te(t.coordinatorRevision);if(i!=null&&r!=null&&i!==r)return i<r;let o=Te(e.updatedAt),a=Te(t.updatedAt);return o!=null&&a!=null&&o<a}function zc(e,t){if(Ms(e,t))return!0;if(!e||!t||e.id!==t.id)return!1;let s=Te(e.revision),n=Te(t.revision);return e.currentActionId!==t.currentActionId&&s!=null&&n!=null&&s<=n}function ao(e,t){let s=xs(e?.generation),n=xs(t?.generation);if(s!=null&&n!=null&&s!==n)return n<s;let i=oo(e?.attempt),r=oo(t?.attempt);if(i!=null&&r!=null&&i!==r)return r<i;let o=Te(e?.progressRevision),a=Te(t?.progressRevision);return o!=null&&a!=null&&a<o}function lo(e,t){if(!e||e.id!==t?.id||Ms(t,e))return null;let s=Array.isArray(e.actions)?e.actions:[],n=Array.isArray(t.actionStats)?t.actionStats:[],i=e.currentActionId||null,r=Object.prototype.hasOwnProperty.call(t,"currentActionId")?t.currentActionId||null:i,o=typeof t.eventActionId=="string"&&n.some(g=>g?.id===t.eventActionId)?t.eventActionId:null,a=o||i!==r&&i||r;if(!a)return null;let l=s.find(g=>g?.id===a)||null,c=n.find(g=>g?.id===a)||(t.currentAction?.id===a?t.currentAction:null);if(l&&c&&ao(l,c))return null;let d=xs(l?.generation),u=xs(c?.generation),p=oo(c?.attempt),f={actionId:a,generation:u||d||1,...p==null?{}:{attempt:p}};return o||i!==r||!l||d!=null&&u!=null&&u>d||l?.status==="running"&&c?.status&&c.status!=="running"?f:null}function Kc(e,t){if(!e||e.id!==t?.id||Ms(t,e))return!1;let s=Te(t.coordinatorRevision),n=Te(e.coordinatorRevision)??0;return s!=null&&s>n?!0:lo(e,t)!=null}function Yc(e,t){if(!e||e.id!==t?.id||Ms(t,e))return e;let s={...e},n=!Array.isArray(e.actions)||!Array.isArray(t.actionStats);if(Array.isArray(e.actions)&&Array.isArray(t.actionStats)){let i=new Map(t.actionStats.map(o=>[o?.id,o])),r=!1;n=!0,s.actions=e.actions.map(o=>{let a=i.get(o?.id);if(!a)return o;if(r=!0,ao(o,a))return n=!1,o;if(Te(a?.progressRevision)==null){let{response:u,messages:p,...f}=a;return{...o,...f}}let c=xs(o?.generation),d=xs(a?.generation);if(c!=null&&d!=null&&d>c){let{messages:u,thread:p,liveMessage:f,response:g,failure:v,messageCursor:m,messageCount:A,failureReason:w,...k}=o;return{...k,...a}}return{...o,...a}}),r||(n=!1)}for(let i of Am)!n&&_m.has(i)||Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i]);return s}function jc(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;let s=new Map(e.map(n=>[n?.id,n]));return t.some(n=>{let i=s.get(n?.id);return i?ao(i,n):!1})}function Gc(e,t){return Te(e?.revision)===Te(t?.revision)&&Te(e?.coordinatorRevision)===Te(t?.coordinatorRevision)&&Te(e?.updatedAt)===Te(t?.updatedAt)}function Qc(e,t){return!e||!t||e.id!==t.id?!1:Ms(e,t)?!0:Gc(t,e)&&jc(t.actions,e.actions)}function oi(e,t){let s=Array.isArray(e)?e:[],n=s.find(r=>r.id===t?.id)||null,i=n&&Ms(t,n)?n:t;return n&&i===t&&Gc(n,t)&&jc(n.actionStats,t.actionStats)&&(i=n),i?.id?[i,...s.filter(r=>r.id!==i.id)].sort((r,o)=>Number(o.updatedAt||0)-Number(r.updatedAt||0)):s}var Am,xm,_m,co=H(()=>{Am=Object.freeze(["revision","planRevision","ledgerRevision","coordinatorRevision","title","goal","workItemType","planningMode","status","lifecycle","attentionState","activeActionIds","attentionActionIds","currentActionId","currentAction","executionStats","failureReason","origin","linkedSessionIds","createdAt","updatedAt"]);xm=new Set(["completed","failed","cancelled","superseded","interrupted"]);_m=new Set(["status","lifecycle","attentionState","activeActionIds","attentionActionIds","currentActionId","currentAction","executionStats","failureReason"])});function Jt(e){return typeof e=="string"?e.trim():""}function Xc(e){if(typeof e=="number"&&Number.isFinite(e)&&e>0)return e;if(typeof e=="string"&&e.trim()){let t=Date.parse(e);if(Number.isFinite(t))return t}return null}function mt(e){let t=Xc(e);if(!t)return"";try{return new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(t))}catch{return""}}function Rm(e){return Array.isArray(e)?e.slice(0,100).map(t=>({content:Jt(t?.content).slice(0,2e3),status:["pending","in_progress","completed"].includes(t?.status)?t.status:"pending",...Jt(t?.activeForm)?{activeForm:Jt(t.activeForm).slice(0,2e3)}:{}})).filter(t=>t.content):[]}function ai(e){if(!e||typeof e!="object")return null;let t=Jt(e.content).slice(0,1e5),s=Rm(e.todos);if(!t&&s.length===0)return null;let n=e.role==="assistant"?"assistant":"user",i=Xc(e.timestamp);return{id:Jt(e.id).slice(0,256)||null,role:n,author:Jt(e.author).slice(0,256)||(n==="assistant"?"Assistant":"User"),content:t,...i?{timestamp:i}:{},...s.length>0?{todos:s}:{}}}function Zc(e,t){return ai({id:e?.messageId||e?.id||null,role:"user",author:t,content:e?.content||"",timestamp:e?.timestamp||e?.createdAt||e?.ts||e?.time||null})}function Jc(e,t){let s=e?.todoMsg?.toolInput?.todos,n=Array.isArray(e?.toolMsgs)?e.toolMsgs.map(o=>Jt(o?.toolName)).filter(Boolean):[],i=Number(e?.toolSummaryCount||0)||0,r=n.length>0?`Tool actions: ${n.join(", ")}`:i>0?`Tool actions: ${i}`:"";return ai({id:e?.atMessageId||e?.messageId||e?.id||e?.turnId||null,role:"assistant",author:t,content:e?.textContent||r,timestamp:e?.timestamp||e?.createdAt||e?.speakerTimestamp||null,todos:s})}var es=H(()=>{});function ed(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>typeof t=="string"?t:t?.type==="text"&&typeof t.text=="string"?t.text:"").join(""):e==null?"":String(e)}function Dm(e,t){if(!e||e.type!=="assistant")return!1;let s=e.sessionId??e.groupId??null,n=e.speakerVpId||e.vpId||null;return!(t.sessionId&&s!==t.sessionId||t.vpId&&n!==t.vpId||t.turnId&&e.turnId!==t.turnId)}function td(e,t={}){if(!Array.isArray(e)||!t.turnId)return!1;let s=e.filter(n=>Dm(n,t));if(s.length===0)return!1;for(let n of s)n.responseKind="progress";if(t.reason==="end_turn"){for(let n=s.length-1;n>=0;n-=1)if(ed(s[n].content).trim()){s[n].responseKind="result";break}}return!0}function li(e,t){if(!e||!t)return;let s=ed(t.content);s&&(Array.isArray(e.textSegments)||(e.textSegments=[]),e.textSegments.push({key:t.messageId||t.id||`response-${e.textSegments.length}`,content:s,kind:t.responseKind==="result"?"result":"progress",explicitKind:t.responseKind==="progress"||t.responseKind==="result",isStreaming:t.isStreaming===!0}),e.textContent=e.textSegments.map(n=>n.content).join(`
6
+ `)+(s||"")}}function dc(e){return Object.values(oc).filter(t=>e||!t.adminOnly).sort((t,s)=>t.order-s.order)}var oc,dt,cc,Zt,dn=H(()=>{oc={dev:{id:"dev",name:"\u8F6F\u4EF6\u5F00\u53D1",nameEn:"Software Dev",icon:"\u{1F5A5}\uFE0F",order:0},trading:{id:"trading",name:"\u4EA4\u6613",nameEn:"Trading",icon:"\u{1F4C8}",order:1,adminOnly:!0},writing:{id:"writing",name:"\u5199\u4F5C",nameEn:"Writing",icon:"\u270D\uFE0F",order:2,adminOnly:!0},video:{id:"video",name:"\u89C6\u9891",nameEn:"Video",icon:"\u{1F3AC}",order:3,adminOnly:!0}},dt={jobs:{id:"jobs",name:"Jobs",fullName:"Steve Jobs",title:"\u4EA7\u54C1\u7ECF\u7406",titleEn:"Product Manager",group:"dev",actions:[{id:"product-analysis",name:"\u4EA7\u54C1\u5206\u6790",nameEn:"Product Analysis"},{id:"design-review",name:"\u8BBE\u8BA1\u5BA1\u67E5",nameEn:"Design Review"},{id:"requirements",name:"\u9700\u6C42\u62C6\u89E3",nameEn:"Requirements"}]},fowler:{id:"fowler",name:"Fowler",fullName:"Martin Fowler",title:"\u8F6F\u4EF6\u67B6\u6784\u5E08",titleEn:"Software Architect",group:"dev",actions:[{id:"architecture",name:"\u67B6\u6784\u5BA1\u67E5",nameEn:"Architecture Review"},{id:"refactoring",name:"\u91CD\u6784\u5206\u6790",nameEn:"Refactoring"},{id:"code-review",name:"\u4EE3\u7801\u5BA1\u67E5",nameEn:"Code Review"}]},torvalds:{id:"torvalds",name:"Torvalds",fullName:"Linus Torvalds",title:"\u7CFB\u7EDF\u5F00\u53D1\u5DE5\u7A0B\u5E08",titleEn:"Systems Engineer",group:"dev",actions:[{id:"system-design",name:"\u7CFB\u7EDF\u8BBE\u8BA1",nameEn:"System Design"},{id:"performance",name:"\u6027\u80FD\u4F18\u5316",nameEn:"Performance"},{id:"code-style",name:"\u4EE3\u7801\u98CE\u683C",nameEn:"Code Style"},{id:"implementation",name:"\u4EE3\u7801\u5B9E\u73B0",nameEn:"Implementation"}]},beck:{id:"beck",name:"Beck",fullName:"Kent Beck",title:"\u6D4B\u8BD5\u5DE5\u7A0B\u5E08",titleEn:"Test Engineer",group:"dev",actions:[{id:"test-strategy",name:"\u6D4B\u8BD5\u7B56\u7565",nameEn:"Test Strategy"},{id:"tdd-guide",name:"TDD \u6307\u5BFC",nameEn:"TDD Guide"},{id:"quality-check",name:"\u8D28\u91CF\u8BC4\u4F30",nameEn:"Quality Check"}]},schneier:{id:"schneier",name:"Schneier",fullName:"Bruce Schneier",title:"\u5B89\u5168\u5DE5\u7A0B\u5E08",titleEn:"Security Engineer",group:"dev",actions:[{id:"security-audit",name:"\u5B89\u5168\u5BA1\u8BA1",nameEn:"Security Audit"},{id:"threat-model",name:"\u5A01\u80C1\u5EFA\u6A21",nameEn:"Threat Model"},{id:"auth-review",name:"\u8BA4\u8BC1\u5BA1\u67E5",nameEn:"Auth Review"}]},rams:{id:"rams",name:"Rams",fullName:"Dieter Rams",title:"UI/UX \u8BBE\u8BA1\u5E08",titleEn:"UI/UX Designer",group:"dev",actions:[{id:"ui-review",name:"\u754C\u9762\u5BA1\u67E5",nameEn:"UI Review"},{id:"interaction",name:"\u4EA4\u4E92\u8BBE\u8BA1",nameEn:"Interaction Design"},{id:"layout",name:"\u5E03\u5C40\u4F18\u5316",nameEn:"Layout Optimization"}]},graham:{id:"graham",name:"Graham",fullName:"Paul Graham",title:"\u6280\u672F\u5199\u4F5C / \u65B9\u6848\u8BC4\u4F30\u5E08",titleEn:"Tech Writer / Evaluator",group:"dev",actions:[{id:"writing",name:"\u6280\u672F\u5199\u4F5C",nameEn:"Tech Writing"},{id:"proposal-review",name:"\u65B9\u6848\u8BC4\u4F30",nameEn:"Proposal Review"},{id:"explain",name:"\u6982\u5FF5\u89E3\u91CA",nameEn:"Explain"}]},hightower:{id:"hightower",name:"Hightower",fullName:"Kelsey Hightower",title:"DevOps / \u8FD0\u7EF4\u5DE5\u7A0B\u5E08",titleEn:"DevOps Engineer",group:"dev",actions:[{id:"deployment",name:"\u90E8\u7F72\u5BA1\u67E5",nameEn:"Deployment Review"},{id:"cicd",name:"CI/CD \u8BC4\u4F30",nameEn:"CI/CD Review"},{id:"infra",name:"\u57FA\u7840\u8BBE\u65BD",nameEn:"Infrastructure"}]},gregg:{id:"gregg",name:"Gregg",fullName:"Brendan Gregg",title:"\u6027\u80FD\u5DE5\u7A0B\u5E08",titleEn:"Performance Engineer",group:"dev",actions:[{id:"perf-analysis",name:"\u6027\u80FD\u5206\u6790",nameEn:"Perf Analysis"},{id:"tuning",name:"\u7CFB\u7EDF\u8C03\u4F18",nameEn:"Tuning"},{id:"benchmark",name:"\u57FA\u51C6\u6D4B\u8BD5",nameEn:"Benchmark"}]},codd:{id:"codd",name:"Codd",fullName:"Edgar Codd",title:"\u6570\u636E\u5E93 / SQL \u4E13\u5BB6",titleEn:"Database / SQL Expert",group:"dev",actions:[{id:"sql-optimization",name:"SQL \u4F18\u5316",nameEn:"SQL Optimization"},{id:"schema-design",name:"Schema \u8BBE\u8BA1",nameEn:"Schema Design"},{id:"data-modeling",name:"\u6570\u636E\u5EFA\u6A21",nameEn:"Data Modeling"}]},knuth:{id:"knuth",name:"Knuth",fullName:"Donald Knuth",title:"\u7B97\u6CD5 / \u6570\u636E\u5904\u7406\u4E13\u5BB6",titleEn:"Algorithm Expert",group:"dev",actions:[{id:"algorithm-design",name:"\u7B97\u6CD5\u8BBE\u8BA1",nameEn:"Algorithm Design"},{id:"data-processing",name:"\u6570\u636E\u5904\u7406",nameEn:"Data Processing"},{id:"optimization",name:"\u4F18\u5316",nameEn:"Optimization"}]},thomas:{id:"thomas",name:"Thomas",fullName:"Dave Thomas",title:"\u6280\u672F\u6587\u6863\u5DE5\u7A0B\u5E08",titleEn:"Tech Doc Engineer",group:"dev",actions:[{id:"api-docs",name:"API \u6587\u6863",nameEn:"API Docs"},{id:"readme",name:"README",nameEn:"README"},{id:"comment-review",name:"\u6CE8\u91CA\u5BA1\u67E5",nameEn:"Comment Review"}]},soros:{id:"soros",name:"Soros",fullName:"George Soros",title:"\u5B8F\u89C2\u7B56\u7565\u5E08",titleEn:"Macro Strategist",group:"trading",actions:[{id:"macro-analysis",name:"\u5B8F\u89C2\u5206\u6790",nameEn:"Macro Analysis"},{id:"risk-assessment",name:"\u98CE\u9669\u8BC4\u4F30",nameEn:"Risk Assessment"},{id:"thesis-review",name:"\u8BBA\u70B9\u5BA1\u67E5",nameEn:"Thesis Review"}]},livermore:{id:"livermore",name:"Livermore",fullName:"Jesse Livermore",title:"\u6280\u672F\u5206\u6790\u5E08",titleEn:"Technical Analyst",group:"trading",actions:[{id:"price-action",name:"\u4EF7\u683C\u884C\u4E3A",nameEn:"Price Action"},{id:"pattern-recognition",name:"\u56FE\u5F62\u8BC6\u522B",nameEn:"Pattern Recognition"},{id:"trade-plan",name:"\u4EA4\u6613\u8BA1\u5212",nameEn:"Trade Plan"}]},dalio:{id:"dalio",name:"Dalio",fullName:"Ray Dalio",title:"\u7814\u7A76\u5458 / \u7ECF\u6D4E\u5206\u6790\u5E08",titleEn:"Research / Economist",group:"trading",actions:[{id:"economic-analysis",name:"\u7ECF\u6D4E\u5206\u6790",nameEn:"Economic Analysis"},{id:"portfolio-review",name:"\u7EC4\u5408\u5BA1\u67E5",nameEn:"Portfolio Review"},{id:"research-report",name:"\u7814\u7A76\u62A5\u544A",nameEn:"Research Report"}]},taleb:{id:"taleb",name:"Taleb",fullName:"Nassim Taleb",title:"\u98CE\u63A7\u5B98",titleEn:"Risk Manager",group:"trading",actions:[{id:"risk-audit",name:"\u98CE\u9669\u5BA1\u8BA1",nameEn:"Risk Audit"},{id:"antifragile",name:"\u53CD\u8106\u5F31\u8BC4\u4F30",nameEn:"Antifragile Assessment"},{id:"stress-test",name:"\u538B\u529B\u6D4B\u8BD5",nameEn:"Stress Test"}]},jones:{id:"jones",name:"Jones",fullName:"Paul Tudor Jones",title:"\u4EA4\u6613\u6267\u884C\u5458",titleEn:"Trade Executor",group:"trading",actions:[{id:"execution",name:"\u6267\u884C\u8BA1\u5212",nameEn:"Execution Plan"},{id:"position-sizing",name:"\u4ED3\u4F4D\u8BA1\u7B97",nameEn:"Position Sizing"},{id:"trade-review",name:"\u4EA4\u6613\u590D\u76D8",nameEn:"Trade Review"}]},simons:{id:"simons",name:"Simons",fullName:"Jim Simons",title:"\u91CF\u5316\u5206\u6790\u5E08",titleEn:"Quant Analyst",group:"trading",actions:[{id:"quant-signal",name:"\u91CF\u5316\u4FE1\u53F7",nameEn:"Quant Signal"},{id:"backtest-review",name:"\u56DE\u6D4B\u5BA1\u67E5",nameEn:"Backtest Review"},{id:"model-design",name:"\u6A21\u578B\u8BBE\u8BA1",nameEn:"Model Design"}]},jinyong:{id:"jinyong",name:"\u91D1\u5EB8",fullName:"\u91D1\u5EB8\uFF08Louis Cha\uFF09",title:"\u6B66\u4FA0\u5927\u5E08",titleEn:"Wuxia Master",group:"writing",actions:[{id:"world-building",name:"\u6B66\u4FA0\u4E16\u754C\u89C2",nameEn:"Wuxia World Building"},{id:"character-design",name:"\u4EBA\u7269\u5851\u9020",nameEn:"Character Design"},{id:"plot-design",name:"\u60C5\u8282\u7F16\u6392",nameEn:"Plot Design"}]},zhouzi:{id:"zhouzi",name:"\u8098\u5B50",fullName:"\u4F1A\u8BF4\u8BDD\u7684\u8098\u5B50",title:"\u7F51\u6587\u5929\u738B",titleEn:"Web Novel King",group:"writing",actions:[{id:"cool-factor",name:"\u723D\u611F\u8BBE\u8BA1",nameEn:"Cool Factor Design"},{id:"pacing",name:"\u8282\u594F\u628A\u63A7",nameEn:"Pacing Control"},{id:"cheat-design",name:"\u91D1\u624B\u6307\u8BBE\u8BA1",nameEn:"Cheat System Design"}]},qiongyao:{id:"qiongyao",name:"\u743C\u7476",fullName:"\u743C\u7476\uFF08Chiung Yao\uFF09",title:"\u8A00\u60C5\u5B97\u5E08",titleEn:"Romance Master",group:"writing",actions:[{id:"emotion-writing",name:"\u60C5\u611F\u63CF\u5199",nameEn:"Emotion Writing"},{id:"dialogue-design",name:"\u5BF9\u8BDD\u8BBE\u8BA1",nameEn:"Dialogue Design"},{id:"romance-arc",name:"\u8650\u604B\u67B6\u6784",nameEn:"Romance Arc"}]},luxun:{id:"luxun",name:"\u9C81\u8FC5",fullName:"\u9C81\u8FC5\uFF08Lu Xun\uFF09",title:"\u6587\u5B66\u5DE8\u5320",titleEn:"Literary Giant",group:"writing",actions:[{id:"satire",name:"\u8BBD\u523A\u5199\u4F5C",nameEn:"Satirical Writing"},{id:"character-sketch",name:"\u4EBA\u7269\u523B\u753B",nameEn:"Character Sketch"},{id:"prose-craft",name:"\u6587\u7B14\u9524\u70BC",nameEn:"Prose Craft"}]},kubrick:{id:"kubrick",name:"Kubrick",fullName:"Stanley Kubrick",title:"\u5BFC\u6F14 / \u89C6\u89C9\u603B\u76D1",titleEn:"Director / Visual Director",group:"video",actions:[{id:"narrative-pacing",name:"\u53D9\u4E8B\u8282\u594F",nameEn:"Narrative Pacing"},{id:"visual-concept",name:"\u89C6\u89C9\u6982\u5FF5",nameEn:"Visual Concept"},{id:"scene-breakdown",name:"\u573A\u666F\u62C6\u89E3",nameEn:"Scene Breakdown"}]},kaufman:{id:"kaufman",name:"Kaufman",fullName:"Charlie Kaufman",title:"\u7F16\u5267",titleEn:"Screenwriter",group:"video",actions:[{id:"script-writing",name:"\u811A\u672C\u5199\u4F5C",nameEn:"Script Writing"},{id:"character-design",name:"\u89D2\u8272\u8BBE\u8BA1",nameEn:"Character Design"},{id:"narrative-structure",name:"\u53D9\u4E8B\u7ED3\u6784",nameEn:"Narrative Structure"}]},spielberg:{id:"spielberg",name:"Spielberg",fullName:"Steven Spielberg",title:"\u5206\u955C / \u89C6\u89C9\u53D9\u4E8B\u5E08",titleEn:"Storyboard / Visual Storyteller",group:"video",actions:[{id:"storyboard",name:"\u5206\u955C\u8BBE\u8BA1",nameEn:"Storyboard"},{id:"shot-design",name:"\u955C\u5934\u65B9\u6848",nameEn:"Shot Design"},{id:"visual-storytelling",name:"\u89C6\u89C9\u53D9\u4E8B",nameEn:"Visual Storytelling"}]},schoonmaker:{id:"schoonmaker",name:"Schoonmaker",fullName:"Thelma Schoonmaker",title:"\u526A\u8F91\u5E08",titleEn:"Editor",group:"video",actions:[{id:"editing-rhythm",name:"\u526A\u8F91\u8282\u594F",nameEn:"Editing Rhythm"},{id:"sequence-design",name:"\u5E8F\u5217\u8BBE\u8BA1",nameEn:"Sequence Design"},{id:"final-cut",name:"\u6700\u7EC8\u5BA1\u7247",nameEn:"Final Cut"}]}};cc="dev",Zt=3});function km(e,t){return!t||!e?.yeaftConversationIdsByAgent?[]:Object.entries(e.yeaftConversationIdsByAgent).filter(([,s])=>s===t).map(([s])=>s).filter(Boolean)}function uc(){return`cm_${crypto.randomUUID()}`}function pc(e,t){if(t===e.currentAgent&&!e.pendingAgentSelection)return;let s=`agent_select_${crypto.randomUUID()}`;return e.agentSwitching=!0,e.pendingAgentSelection={agentId:t,requestId:s},e.sendWsMessage({type:"select_agent",agentId:t,requestId:s})===!1?(e.pendingAgentSelection=null,e.agentSwitching=!1,null):s}function fc(e,t,s=null,n=null,i={}){let r=s||e.currentAgent;if(!r){e.addMessage({type:"error",content:Pe("chat.agent.selectFirst")});return}ks(e,!0,Pe("chat.session.creating"));let o={type:"create_conversation",agentId:r,workDir:t||e.currentAgentWorkDir};n!==null&&(o.disallowedTools=n),i&&typeof i.provider=="string"&&(o.provider=i.provider),i&&i.providerOptions&&typeof i.providerOptions=="object"&&(o.providerOptions=i.providerOptions),e.sendWsMessage(o)}function gc(e,t,s,n=null,i=null,r=null){let o=n||e.currentAgent;if(!o){e.addMessage({type:"error",content:Pe("chat.agent.selectFirst")});return}let a=null,l={};i&&typeof i=="object"&&!Array.isArray(i)?l=i:(a=i,r&&typeof r=="object"&&(l=r)),ks(e,!0,Pe("chat.session.loadingHistory"));let c={type:"resume_conversation",agentId:o,claudeSessionId:t,workDir:s||e.currentAgentWorkDir};a!==null&&(c.disallowedTools=a),typeof l.provider=="string"&&(c.provider=l.provider),l.providerOptions&&typeof l.providerOptions=="object"&&(c.providerOptions=l.providerOptions),e.sendWsMessage(c)}function mc(e,t,s){if(e.panels.length>1){let a=e.activePanelId||e.panels[0]?.id;a&&e.setPanelConversation(a,t);return}if(t===e.currentConversation)return;let n=e.conversations.find(a=>a.id===t&&a.type!=="yeaft");if(n&&n.agentId&&n.agentId!==e.currentAgent){let a=e.agents.find(l=>l.id===n.agentId);a&&(e.currentAgent=n.agentId,e.currentAgentInfo=a,e.sendWsMessage({type:"select_agent",agentId:n.agentId,silent:!0}))}e.sendWsMessage({type:"select_conversation",conversationId:t}),e.panels.length>1?e.activeConversations.includes(t)||e.activeConversations.push(t):e.activeConversations=[t],n&&(e.currentWorkDir=n.workDir);let i=e.messagesMap[t],r=Yt(i);r!==null?e.requestChatHistory?.(t,{mode:"delta",afterMessageId:r}):((!i||i.length===0)&&(e.messagesMap[t]=[],ks(e,!0,Pe("chat.session.loadingHistory"))),e.requestChatHistory?.(t,{mode:"recent",turns:5})),e.loadingMoreMessages=!1;let o=e.chatSessionState[t];e.hasMoreMessages=!!o?.hasMoreOlder,Ss(e)}function no(e,t,s){t&&e.sendWsMessage({type:"update_conversation_settings",conversationId:t,...s})}function hc(e,t,s){let n=e.currentConversation;if(!n)return;let i=e.conversationMcpServers[n];if(i){let p=i.find(f=>f.name===t);p&&(p.enabled=s)}let r=e.conversationMcpServers[n]||[],o=e.conversationMcpServerTools[n]||{},a=[];for(let p of r)if(!p.enabled){let f=o[p.name];f&&f.length>0?a.push(...f):a.push(`mcp__${p.name}`)}let u=[...(e.conversations.find(p=>p.id===n)?.disallowedTools||[]).filter(p=>!p.startsWith("mcp__")),...a];no(e,n,{disallowedTools:u})}function vc(e,t,s){return t?e.sendWsMessage({type:"delete_conversation",requestId:`delete_${crypto.randomUUID()}`,conversationId:t,...s?{agentId:s}:{}}):!1}function yc(e,t,s){e._recentlyDeletedSessions||(e._recentlyDeletedSessions={}),e._recentlyDeletedSessions[t]=Date.now(),e.conversations=e.conversations.filter(r=>r.id!==t);let n=e.activeConversations.indexOf(t);n>=0&&(e.activeConversations.splice(n,1),e.activeConversations.length===0&&(localStorage.removeItem("lastViewedConversation"),e.lastViewedConversation=null));for(let r of e.panels)r.conversationId===t&&(r.conversationId=null);let i=e.pinnedSessions.indexOf(t);i>=0&&(e.pinnedSessions.splice(i,1),localStorage.setItem("pinned-sessions",JSON.stringify(e.pinnedSessions))),e.sendWsMessage({type:"delete_conversation",requestId:`delete_${crypto.randomUUID()}`,conversationId:t,...s?{agentId:s}:{}})}function bc(e,t,s=[],n={}){let i=n.expertSelections&&n.expertSelections.length>0;if(!t.trim()&&s.length===0&&!i||!e.currentAgent||!e.currentConversation)return;let r=uc();if(e.addMessage({type:"user",content:t,clientMessageId:r,attachments:s.length>0?s:void 0,expertSelections:i?n.expertSelections:void 0}),t.trim()){let c=t.trim().substring(0,100);e.conversationTitles[e.currentConversation]=c}else if(i){let c=n.expertSelections[0],d=`@${c.role}${c.action?"\xB7"+c.action:""}`;e.conversationTitles[e.currentConversation]=d}let o=e.conversations.find(c=>c.id===e.currentConversation);o&&(o.lastMessageAt=Date.now()),e.processingConversations[e.currentConversation]||(e.processingConversations[e.currentConversation]=!0,e._closedAt?.[e.currentConversation]&&delete e._closedAt[e.currentConversation],e._turnCompletedConvs?.delete(e.currentConversation),e.getOrCreateExecutionStatus(e.currentConversation),Cs(e,e.currentConversation));let a=s.map(c=>c.fileId),l={type:"chat",conversationId:e.currentConversation,prompt:t,fileIds:a,workDir:e.currentWorkDir,clientMessageId:r};if(n.targetRole&&(l.targetRole=n.targetRole),i){l.expertSelections=n.expertSelections;let c=so(n.expertSelections,e.customExpertRoles,t,e.language||"zh-CN");c&&(l.expertMessage=c.effectivePrompt)}e.sendWsMessage(l)||tn(e).then(()=>{e.sendWsMessage(l)}).catch(()=>{e.addMessage({type:"system",content:Pe("chat.connection.reconnectFailed")}),delete e.processingConversations[e.currentConversation],Ae(e,e.currentConversation)})}function wc(e){if(!e.currentConversation||!e.processingConversations[e.currentConversation])return;let t=e.currentConversation;e.sendWsMessage({type:"cancel_execution",conversationId:t}),delete e.processingConversations[t],Ae(e,t),e._closedAt||(e._closedAt={}),e._closedAt[t]=Date.now();let s=e.executionStatusMap[t];s&&(s.currentTool=null),e.finishStreamingForConversation(t),Ft(e,t),e.addMessage({type:"system",content:Pe("chat.execution.cancelled")})}function kc(e,t,s,n){let i=n||e.currentConversation,o=(e.messagesMap[i]||[]).find(g=>g.type==="tool-use"&&g.toolName==="AskUserQuestion"&&g.askRequestId===t),a=e.currentView==="yeaft"||!!o?.sessionId;if(a&&o?.askPending)return;let l=o?.sessionId||e.yeaftActiveSessionFilter||null,c=typeof o?.agentId=="string"&&o.agentId?o.agentId:null,d=a?km(e,i):[],u=d.length===1?d[0]:null;if(c&&u&&c!==u)return!1;let p=a&&!c&&!u&&typeof e.agentIdForSession=="function"?e.agentIdForSession(l):null,f=e.sendWsMessage(a?{type:"yeaft_ask_user_answer",agentId:c||u||p||e.yeaftAgentId||e.currentAgent||null,conversationId:i,requestId:t,toolCallId:o?.toolId||null,answers:s,sessionId:l,vpId:o?.vpId||o?.speakerVpId||null,turnId:o?.turnId||null,threadId:o?.threadId||"main"}:{type:"ask_user_answer",conversationId:i,requestId:t,answers:s});if(o&&!a)o.askAnswered=!0,o.selectedAnswers=s;else if(o&&f!==!1){let g=++wm;o.askPending=!0,o.pendingAnswers=s,o.askSubmitGeneration=g;let v=setTimeout(()=>{o.askSubmitGeneration!==g||o.askPending!==!0||(o.askPending=!1,o.pendingAnswers=null,o.askSubmitGeneration=null)},bm);typeof v?.unref=="function"&&v.unref()}f!==!1&&i&&!e.processingConversations[i]&&(e.processingConversations[i]=!0,e._closedAt?.[i]&&delete e._closedAt[i],e.getOrCreateExecutionStatus(i))}function Sc(e,t){t&&(e.activeConversations.includes(t)||e.activeConversations.length>=3||(e.activeConversations.push(t),e.messagesMap[t]||(e.messagesMap[t]=[],e.requestChatHistory?.(t,{mode:"recent",turns:5})),Ss(e)))}function Cc(e,t){let s=e.activeConversations.indexOf(t);s<0||(e.activeConversations.splice(s,1),e.activeConversations.length===0&&(localStorage.removeItem("lastViewedConversation"),e.lastViewedConversation=null),Ss(e))}function Ic(e,t,s,n=[],i={}){let r=i.expertSelections&&i.expertSelections.length>0;if(!s.trim()&&n.length===0&&!r||!e.currentAgent||!t)return;let o=uc();if(e.addMessageToConversation(t,{type:"user",content:s,clientMessageId:o,attachments:n.length>0?n:void 0,expertSelections:r?i.expertSelections:void 0}),s.trim()){let d=s.trim().substring(0,100);e.conversationTitles[t]=d}else if(r){let d=i.expertSelections[0],u=`@${d.role}${d.action?"\xB7"+d.action:""}`;e.conversationTitles[t]=u}let a=e.conversations.find(d=>d.id===t);a&&(a.lastMessageAt=Date.now()),e.processingConversations[t]||(e.processingConversations[t]=!0,e._closedAt?.[t]&&delete e._closedAt[t],e._turnCompletedConvs?.delete(t),e.getOrCreateExecutionStatus(t),Cs(e,t));let l=n.map(d=>d.fileId),c={type:"chat",conversationId:t,prompt:s,fileIds:l,workDir:a?.workDir||e.currentWorkDir,clientMessageId:o};if(i.targetRole&&(c.targetRole=i.targetRole),r){c.expertSelections=i.expertSelections;let d=so(i.expertSelections,e.customExpertRoles,s,e.language||"zh-CN");d&&(c.expertMessage=d.effectivePrompt)}e.sendWsMessage(c)||tn(e).then(()=>{e.sendWsMessage(c)}).catch(()=>{e.addMessageToConversation(t,{type:"system",content:Pe("chat.connection.reconnectFailed")}),delete e.processingConversations[t],Ae(e,t)})}function Ac(e,t){if(!t||!e.processingConversations[t])return;e.sendWsMessage({type:"cancel_execution",conversationId:t}),delete e.processingConversations[t],Ae(e,t),e._closedAt||(e._closedAt={}),e._closedAt[t]=Date.now();let s=e.executionStatusMap[t];s&&(s.currentTool=null),e.finishStreamingForConversation(t),Ft(e,t),e.addMessageToConversation(t,{type:"system",content:Pe("chat.execution.cancelled")})}function xc(e){e.ws&&e.ws.readyState===WebSocket.OPEN&&(typeof e.requestYeaftSessionInventory=="function"?e.requestYeaftSessionInventory():e.sendWsMessage({type:"get_agents"}))}function Tc(e){!e.currentAgent||!e.currentConversation||e.sendWsMessage({type:"refresh_conversation",conversationId:e.currentConversation})}function Mc(e,t){t&&e.sendWsMessage({type:"restart_agent",agentId:t})}function Pc(e,t){t&&e.sendWsMessage({type:"upgrade_agent",agentId:t})}var bm,wm,Rc=H(()=>{Gt();Kt();$r();ii();rn();St();dn();bm=1e4,wm=0});function Cm(e=globalThis.localStorage){try{return e?.getItem(Dc)==="yeaft"?"yeaft":_c}catch{return _c}}function io(e,t=globalThis.localStorage){if(e!=="chat"&&e!=="yeaft")return!1;try{return t?.setItem(Dc,e),!!t}catch{return!1}}function Ec(e=globalThis.localStorage){let t=Cm(e);if(t!=="yeaft")return{currentView:t,_yeaftTransitionActive:!1,_savedActiveConversations:null,_pendingChatRestoreConversationId:null};let s=null;try{s=e?.getItem("lastViewedConversation")||null}catch{}let n=s&&!s.startsWith("yeaft-")?s:null;return{currentView:t,_yeaftTransitionActive:!0,_savedActiveConversations:null,_pendingChatRestoreConversationId:n}}function Lc(e){let t=!e._yeaftTransitionActive;return t&&(e._savedActiveConversations=[...e.activeConversations],e._yeaftTransitionActive=!0),e.activeConversations=[e.yeaftConversationId],t}function $c(e){e._yeaftTransitionActive&&(e.activeConversations=e._savedActiveConversations||[],e._savedActiveConversations=null,e._yeaftTransitionActive=!1)}var Dc,_c,Vc=H(()=>{Dc="yeaft-preferred-conversation-view",_c="chat"});function Fc(e,t,s){let n={...e||{}},i={...n[t]||{}};return i[s]=(i[s]||0)+1,n[t]=i,n}function Hc(e,t,s){let n={...e||{}},i={...n[t]||{}},r=(i[s]||0)-1;return r<=0?delete i[s]:i[s]=r,Object.keys(i).length===0?delete n[t]:n[t]=i,n}var Oc=H(()=>{});function ro(e){return e.currentView==="yeaft"?e.yeaftConversationId||null:e.activeConversations[0]||null}var qc=H(()=>{});function Nc({loops:e,turnsById:t,turnOrder:s,maxLoops:n}){if(!Array.isArray(e)||e.length<=n)return{loops:e,turnsById:t,turnOrder:s};let i=e.length-n,r=e.slice(i),o=new Set;for(let c of r)c&&c.turnId&&o.add(c.turnId);for(let c of s){let d=t[c];d&&d.closedAt==null&&o.add(c)}let a={};for(let c of Object.keys(t))o.has(c)&&(a[c]=t[c]);let l=s.filter(c=>o.has(c));return{loops:r,turnsById:a,turnOrder:l}}var Bc=H(()=>{});function Te(e){let t=Number(e);return Number.isFinite(t)?t:null}function xs(e){let t=Te(e);return Number.isInteger(t)&&t>0?t:null}function oo(e){let t=Te(e);return Number.isInteger(t)&&t>=0?t:null}function Wc(e){return xm.has(e)?1:0}function Tm(e,t){if(!e)return t||null;if(!t)return e;let s=Te(e.progressRevision),n=Te(t.progressRevision);if(s!=null||n!=null){if(s==null)return t;if(n==null)return e;if(s!==n)return n>s?t:e}let i=Wc(e.status),r=Wc(t.status);if(i!==r)return r>i?t:e;let o=Te(e.updatedAt)??Te(e.createdAt)??0;return(Te(t.updatedAt)??Te(t.createdAt)??0)>o?t:e}function As(e){return Math.max(0,Number(e)||0)}function Uc(e){return typeof e?.id=="string"&&e.id.startsWith("event:")?e.id.slice(6):null}function Mm(e,t){if(/^\d+$/.test(e)&&/^\d+$/.test(t)){let s=BigInt(e),n=BigInt(t);return s<n?-1:s>n?1:0}return e.localeCompare(t)}function Pm(e,t){let s=As(e?.createdAt)-As(t?.createdAt);if(s)return s;let n=Uc(e),i=Uc(t);if(n!=null&&i!=null)return Mm(n,i);let r=e?.role==="user"?0:1,o=t?.role==="user"?0:1;if(r!==o)return r-o;let a=As(e?.generation)-As(t?.generation);return a||As(e?.attempt)-As(t?.attempt)||String(e?.id||"").localeCompare(String(t?.id||""))}function un(...e){let t=new Map;for(let s of e){let n=Array.isArray(s)?s:[s];for(let i of n)i?.id&&t.set(i.id,Tm(t.get(i.id),i))}return[...t.values()].sort(Pm)}function nt(e){let t=Number(e);return Number.isInteger(t)&&t>0?t:1}function Ts(e,t,s,n){return`${e}:${t}:${s}:${nt(n)}`}function pn(e,t,s,n){return`${e}:${t}:${s}:${nt(n)}`}function Ms(e,t){if(!e||!t||e.id!==t.id)return!1;let s=Te(e.revision),n=Te(t.revision);if(s!=null&&n!=null&&s!==n)return s<n;let i=Te(e.coordinatorRevision),r=Te(t.coordinatorRevision);if(i!=null&&r!=null&&i!==r)return i<r;let o=Te(e.updatedAt),a=Te(t.updatedAt);return o!=null&&a!=null&&o<a}function zc(e,t){if(Ms(e,t))return!0;if(!e||!t||e.id!==t.id)return!1;let s=Te(e.revision),n=Te(t.revision);return e.currentActionId!==t.currentActionId&&s!=null&&n!=null&&s<=n}function ao(e,t){let s=xs(e?.generation),n=xs(t?.generation);if(s!=null&&n!=null&&s!==n)return n<s;let i=oo(e?.attempt),r=oo(t?.attempt);if(i!=null&&r!=null&&i!==r)return r<i;let o=Te(e?.progressRevision),a=Te(t?.progressRevision);return o!=null&&a!=null&&a<o}function lo(e,t){if(!e||e.id!==t?.id||Ms(t,e))return null;let s=Array.isArray(e.actions)?e.actions:[],n=Array.isArray(t.actionStats)?t.actionStats:[],i=e.currentActionId||null,r=Object.prototype.hasOwnProperty.call(t,"currentActionId")?t.currentActionId||null:i,o=typeof t.eventActionId=="string"&&n.some(g=>g?.id===t.eventActionId)?t.eventActionId:null,a=o||i!==r&&i||r;if(!a)return null;let l=s.find(g=>g?.id===a)||null,c=n.find(g=>g?.id===a)||(t.currentAction?.id===a?t.currentAction:null);if(l&&c&&ao(l,c))return null;let d=xs(l?.generation),u=xs(c?.generation),p=oo(c?.attempt),f={actionId:a,generation:u||d||1,...p==null?{}:{attempt:p}};return o||i!==r||!l||d!=null&&u!=null&&u>d||l?.status==="running"&&c?.status&&c.status!=="running"?f:null}function Kc(e,t){if(!e||e.id!==t?.id||Ms(t,e))return!1;let s=Te(t.coordinatorRevision),n=Te(e.coordinatorRevision)??0;return s!=null&&s>n?!0:lo(e,t)!=null}function Yc(e,t){if(!e||e.id!==t?.id||Ms(t,e))return e;let s={...e},n=!Array.isArray(e.actions)||!Array.isArray(t.actionStats);if(Array.isArray(e.actions)&&Array.isArray(t.actionStats)){let i=new Map(t.actionStats.map(o=>[o?.id,o])),r=!1;n=!0,s.actions=e.actions.map(o=>{let a=i.get(o?.id);if(!a)return o;if(r=!0,ao(o,a))return n=!1,o;if(Te(a?.progressRevision)==null){let{response:u,messages:p,...f}=a;return{...o,...f}}let c=xs(o?.generation),d=xs(a?.generation);if(c!=null&&d!=null&&d>c){let{messages:u,thread:p,liveMessage:f,response:g,failure:v,messageCursor:m,messageCount:A,failureReason:w,...k}=o;return{...k,...a}}return{...o,...a}}),r||(n=!1)}for(let i of Am)!n&&Rm.has(i)||Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i]);return s}function jc(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;let s=new Map(e.map(n=>[n?.id,n]));return t.some(n=>{let i=s.get(n?.id);return i?ao(i,n):!1})}function Gc(e,t){return Te(e?.revision)===Te(t?.revision)&&Te(e?.coordinatorRevision)===Te(t?.coordinatorRevision)&&Te(e?.updatedAt)===Te(t?.updatedAt)}function Qc(e,t){return!e||!t||e.id!==t.id?!1:Ms(e,t)?!0:Gc(t,e)&&jc(t.actions,e.actions)}function oi(e,t){let s=Array.isArray(e)?e:[],n=s.find(r=>r.id===t?.id)||null,i=n&&Ms(t,n)?n:t;return n&&i===t&&Gc(n,t)&&jc(n.actionStats,t.actionStats)&&(i=n),i?.id?[i,...s.filter(r=>r.id!==i.id)].sort((r,o)=>Number(o.updatedAt||0)-Number(r.updatedAt||0)):s}var Am,xm,Rm,co=H(()=>{Am=Object.freeze(["revision","planRevision","ledgerRevision","coordinatorRevision","title","goal","workItemType","planningMode","status","lifecycle","attentionState","activeActionIds","attentionActionIds","currentActionId","currentAction","executionStats","failureReason","origin","linkedSessionIds","createdAt","updatedAt"]);xm=new Set(["completed","failed","cancelled","superseded","interrupted"]);Rm=new Set(["status","lifecycle","attentionState","activeActionIds","attentionActionIds","currentActionId","currentAction","executionStats","failureReason"])});function Jt(e){return typeof e=="string"?e.trim():""}function Xc(e){if(typeof e=="number"&&Number.isFinite(e)&&e>0)return e;if(typeof e=="string"&&e.trim()){let t=Date.parse(e);if(Number.isFinite(t))return t}return null}function mt(e){let t=Xc(e);if(!t)return"";try{return new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(t))}catch{return""}}function _m(e){return Array.isArray(e)?e.slice(0,100).map(t=>({content:Jt(t?.content).slice(0,2e3),status:["pending","in_progress","completed"].includes(t?.status)?t.status:"pending",...Jt(t?.activeForm)?{activeForm:Jt(t.activeForm).slice(0,2e3)}:{}})).filter(t=>t.content):[]}function ai(e){if(!e||typeof e!="object")return null;let t=Jt(e.content).slice(0,1e5),s=_m(e.todos);if(!t&&s.length===0)return null;let n=e.role==="assistant"?"assistant":"user",i=Xc(e.timestamp);return{id:Jt(e.id).slice(0,256)||null,role:n,author:Jt(e.author).slice(0,256)||(n==="assistant"?"Assistant":"User"),content:t,...i?{timestamp:i}:{},...s.length>0?{todos:s}:{}}}function Zc(e,t){return ai({id:e?.messageId||e?.id||null,role:"user",author:t,content:e?.content||"",timestamp:e?.timestamp||e?.createdAt||e?.ts||e?.time||null})}function Jc(e,t){let s=e?.todoMsg?.toolInput?.todos,n=Array.isArray(e?.toolMsgs)?e.toolMsgs.map(o=>Jt(o?.toolName)).filter(Boolean):[],i=Number(e?.toolSummaryCount||0)||0,r=n.length>0?`Tool actions: ${n.join(", ")}`:i>0?`Tool actions: ${i}`:"";return ai({id:e?.atMessageId||e?.messageId||e?.id||e?.turnId||null,role:"assistant",author:t,content:e?.textContent||r,timestamp:e?.timestamp||e?.createdAt||e?.speakerTimestamp||null,todos:s})}var es=H(()=>{});function ed(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>typeof t=="string"?t:t?.type==="text"&&typeof t.text=="string"?t.text:"").join(""):e==null?"":String(e)}function Dm(e,t){if(!e||e.type!=="assistant")return!1;let s=e.sessionId??e.groupId??null,n=e.speakerVpId||e.vpId||null;return!(t.sessionId&&s!==t.sessionId||t.vpId&&n!==t.vpId||t.turnId&&e.turnId!==t.turnId)}function td(e,t={}){if(!Array.isArray(e)||!t.turnId)return!1;let s=e.filter(n=>Dm(n,t));if(s.length===0)return!1;for(let n of s)n.responseKind="progress";if(t.reason==="end_turn"){for(let n=s.length-1;n>=0;n-=1)if(ed(s[n].content).trim()){s[n].responseKind="result";break}}return!0}function li(e,t){if(!e||!t)return;let s=ed(t.content);s&&(Array.isArray(e.textSegments)||(e.textSegments=[]),e.textSegments.push({key:t.messageId||t.id||`response-${e.textSegments.length}`,content:s,kind:t.responseKind==="result"?"result":"progress",explicitKind:t.responseKind==="progress"||t.responseKind==="result",isStreaming:t.isStreaming===!0}),e.textContent=e.textSegments.map(n=>n.content).join(`
7
7
 
8
- `))}function ci(e){let t=Array.isArray(e?.textSegments)?e.textSegments:[];if(t.length===0)return;let s=Array.isArray(e?.messages)?e.messages:[],n=e?.isActive===!0||e?.isStreaming===!0||t.some(l=>l.isStreaming===!0)||s.some(l=>l?.isStreaming===!0||l?.status==="pending"),i=s.some(l=>l?.incomplete===!0||uo.has(l?.status)||uo.has(l?.turnEndReason)||uo.has(l?.stopReason));if(n||i){for(let l of t)l.kind="progress";return}if(t.some(l=>l.kind==="result"))return;let r=s.some(l=>l?.turnEndReason==="end_turn"),o=t.some(l=>l.explicitKind),a=t.length===1&&!o;(r||a||e.isHistory&&!o)&&(t[t.length-1].kind="result")}var uo,di=H(()=>{uo=new Set(["aborted","errored","error","cancelled","canceled"])});function Ht(e,t){return!e||!t?"":`${e}${t}`}function po(e){return e?`${e}`:""}function fo(e,t){return!e||!t?"":`${e}${t}`}var sd=H(()=>{});function go(e){return e?.type==="user"&&typeof e.content=="string"&&e.content.trim()}function mo(e){return e?.type==="assistant"||e?.type==="thinking"||e?.type==="tool_use"||e?.type==="tool-use"||e?.type==="tool_result"||e?.type==="tool-result"}function ho(e,t){if(!e||e.kind!=="assistant")return!0;let s=e.turnId||e.lastTurnId||"",n=t?.turnId||"";if(s&&n&&s!==n)return!0;let i=e.speakerVpId||"",r=t?.speakerVpId||t?.vpId||"";return!!(i&&r&&i!==r)}function nd(e=[]){let t=[],s=null,n=i=>{s&&(t.push({start:s.start,end:i,kind:s.kind}),s=null)};for(let i=0;i<e.length;i++){let r=e[i];if(r){if(go(r)||r.type==="system"||r.type==="error"){n(i),s={start:i,kind:r.type};continue}if(!mo(r)){s||(s={start:i,kind:"other"});continue}(!s||s.kind==="assistant"&&ho(s,r))&&(n(i),s={start:i,kind:"assistant",turnId:r.turnId||"",speakerVpId:r.speakerVpId||r.vpId||""}),s.lastTurnId=r.turnId||s.lastTurnId||"",s.speakerVpId=s.speakerVpId||r.speakerVpId||r.vpId||""}}return n(e.length),t}function id(e,t){return t?e&&(e.sessionId??e.groupId)===t:!0}function vo(e=[],t=null,s=5){let n=Math.max(1,Number.isFinite(s)?Math.floor(s):5),i=[],r=[],o=null,a=c=>{o&&(r.push({start:o.start,end:c,kind:o.kind}),o=null)};for(let c of e){if(!id(c,t))continue;let d=i.length;if(i.push(c),go(c)||c.type==="system"||c.type==="error"){a(d),o={start:d,kind:c.type};continue}if(!mo(c)){o||(o={start:d,kind:"other"});continue}(!o||o.kind==="assistant"&&ho(o,c))&&(a(d),o={start:d,kind:"assistant",turnId:c.turnId||"",speakerVpId:c.speakerVpId||c.vpId||""}),o.lastTurnId=c.turnId||o.lastTurnId||"",o.speakerVpId=o.speakerVpId||c.speakerVpId||c.vpId||""}if(a(i.length),r.length<=n)return i;let l=r[r.length-n];return i.slice(l.start)}function rd(e=[],t=null,s=5){let n=Math.max(1,s||5),i=0,r=null,o=()=>r?(r=null,i+=1,i>n):!1;for(let a of e)if(id(a,t)){if(go(a)||a.type==="system"||a.type==="error"){if(o())return!0;r={kind:a.type};continue}if(!mo(a)){r||(r={kind:"other"});continue}if(!r||r.kind==="assistant"&&ho(r,a)){if(o())return!0;r={kind:"assistant",turnId:a.turnId||"",speakerVpId:a.speakerVpId||a.vpId||""}}r.lastTurnId=a.turnId||r.lastTurnId||"",r.speakerVpId=r.speakerVpId||a.speakerVpId||a.vpId||""}return o(),i>n}function ts(){return 5}function fn(){return 20}var od=H(()=>{});function Lm(e,t){let s=new Set;if(!t)return s;for(let n of e?.sessionCatalog||[])n?.runtimeProvider!=="yeaft"||n?.routeRef?.sessionId!==t||n.routeRef.agentId&&s.add(n.routeRef.agentId);if(s.size===0){let n=ss();for(let i of n?.sessionList||[])i?.id===t&&i?.agentId&&s.add(i.agentId)}return s}function wd(e,t){let s=Lm(e,t);return s.size===1?s.values().next().value:null}function gi(e,t,s){return!!s&&wd(e,t)===s}function ut(e,t,s){return!e||e.sessionId!==t?!1:s?e.agentId===s:!e.agentId}function ad(e,t,s=null){if(!t)return!1;let n=s||Ie(e,t),i=Ht(n,t);if(i&&e.yeaftProcessingSessions?.[i]||e.yeaftProcessingSessions?.[t]&&gi(e,t,n))return!0;for(let r of Object.values(e.activeVpTurns||{}))if(ut(r,t,n))return!0;for(let r of Object.values(e.vpStatuses||{}))if(ut(r,t,n)&&mi.has(r?.state))return!0;return!1}function $m(e,t,s,n=null){let i={...e.yeaftProcessingSessions||{}};if(t){let r=po(t);if(i=Object.fromEntries(Object.entries(i).filter(([o])=>n?o!==Ht(t,n):!o.startsWith(r))),n)gi(e,n,t)&&delete i[n];else for(let o of Object.keys(i))gi(e,o,t)&&delete i[o]}else n?delete i[n]:i={};for(let r of s||[]){let o=r?.sessionId||r?.groupId||null;if(!o||!mi.has(r?.state))continue;let a=Ht(t,o)||o;i[a]=!0}return i}function gn(e,t,s){let n=fo(t,s);return n&&e?.activeVpTurns?.[n]?n:e?.activeVpTurns?.[s]&&(!t||!e.activeVpTurns[s]?.agentId||e.activeVpTurns[s].agentId===t)?s:n||s||""}function ld(e,t){if(!t){e.activeVpTurns={},e.stoppingVpTurnIds={},e.vpStatuses={},e.yeaftProcessingSessions={};return}e.activeVpTurns=Object.fromEntries(Object.entries(e.activeVpTurns||{}).filter(([,n])=>n?.agentId&&n.agentId!==t)),e.stoppingVpTurnIds=Object.fromEntries(Object.entries(e.stoppingVpTurnIds||{}).filter(([n])=>e.activeVpTurns?.[n])),e.vpStatuses=Object.fromEntries(Object.entries(e.vpStatuses||{}).filter(([,n])=>n?.agentId&&n.agentId!==t));let s=po(t);e.yeaftProcessingSessions=Object.fromEntries(Object.entries(e.yeaftProcessingSessions||{}).filter(([n])=>!n.startsWith(s)))}function dd(e,t,s){return{conversationId:s||null,agentId:e?.agentId||t?.agentId||null,requestId:t?.requestId||null,toolCallId:t?.toolCallId||null,sessionId:e?.sessionId||t?.sessionId||null,vpId:e?.vpId||t?.vpId||null,turnId:e?.turnId||t?.turnId||null,threadId:e?.threadId||t?.threadId||null}}function ud(e,t){return{conversationId:t||null,agentId:e?.agentId||null,requestId:e?.askRequestId||null,toolCallId:e?.toolId||null,sessionId:e?.sessionId||e?.groupId||null,vpId:e?.vpId||e?.speakerVpId||null,turnId:e?.turnId||null,threadId:e?.threadId||null}}function qm(e,t){return Co.every(s=>!t[s]||e[s]===t[s])}function kd(e,t){return Co.every(s=>!e[s]||!t[s]||e[s]===t[s])}function pd(e,t,s){let n=(e||[]).filter(o=>o?.type==="tool-use"&&(o.toolName==="AskUser"||o.toolName==="AskUserQuestion")&&(!t.requestId||!o.askRequestId||o.askRequestId===t.requestId)&&(!t.toolCallId||!o.toolId||o.toolId===t.toolCallId)),i=n.filter(o=>qm(ud(o,s),t));if(i.length===1)return i[0];let r=n.filter(o=>kd(ud(o,s),t));return r.length===1?r[0]:null}function Sd(e){return Co.map(t=>e[t]||"").join("\0")}function Nm(e,t,s){let n=Sd(t),i={...e._yeaftAskTerminalEvents||{},[n]:{identity:t,event:s,receivedAt:Date.now()}},r=Object.keys(i);if(r.length>cd){r.sort((o,a)=>i[o].receivedAt-i[a].receivedAt);for(let o of r.slice(0,r.length-cd))delete i[o]}e._yeaftAskTerminalEvents=i}function fd(e,t){let s=e._yeaftAskTerminalEvents||{},n=Sd(t),i=s[n]?n:null;if(!i){let l=Object.entries(s).filter(([,c])=>kd(c.identity||{},t));l.length===1&&(i=l[0][0])}if(!i)return null;let r=s[i],{[i]:o,...a}=s;return e._yeaftAskTerminalEvents=a,r?.event||null}function Bm(e,t,s){return(e.messagesMap?.[t]||[]).some(n=>n?.type==="tool-use"&&n.sessionId===s&&n.hasResult===!1)}function yo(e,t){t.type==="ask_user_answered"?(e.askAnswered=!0,e.selectedAnswers=t.answers||{},e.askExpired=!1):(e.isHistory=!0,e.askExpired=!0,e.askAnswered=!1,e.selectedAnswers=null),e.askPending=!1,e.pendingAnswers=null,e.askSubmitGeneration=null,e.askRequestId=null}function Wm(e){if(!e||typeof e!="string")return null;let t=e.match(/^(\d+)/);if(!t)return null;let s=Number(t[1]);return Number.isFinite(s)?s:null}function Um(e){if(!e||typeof e!="string")return null;let t=e.match(/^m(\d+)$/);if(!t)return null;let s=Number(t[1]);return Number.isFinite(s)?s:null}function mn(e){return e?.role==="assistant"&&e?.turnId?`response:${e.turnId}:${e.speakerVpId||e.vpId||""}`:e?.clientMessageId?`client:${e.clientMessageId}`:`message:${e?.messageId||""}`}function gd(e){let t=e?.updatedAt||e?.endedAt||e?.createdAt,s=t?Date.parse(t):NaN;return Number.isFinite(s)?s:0}function bo(e,t){return`${e||""}::${t||""}`}function wo(e){let t=Object.entries(e||{}),s=t.filter(([,i])=>i?.status==="running"),n=t.filter(([,i])=>i&&i.status!=="running"&&So.has(i.status)).sort((i,r)=>gd(r[1])-gd(i[1])).slice(0,Fm);return Object.fromEntries([...s,...n])}function ss(){try{return typeof window>"u"?null:window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore()||null}catch{return null}}function Ie(e,t,s=null){if(s)return s;if(t){let n=ss(),i=n&&typeof n.sessionById=="function"?n.sessionById(t,e?.currentAgent||null):null;if(i&&i.agentId)return i.agentId;let r=e?.yeaftSessionAgentById?e.yeaftSessionAgentById[t]:null;if(r)return r}return e?.currentAgent||null}function zm(e,t){let s=r=>String(r||"").replace(/^v/,"").split(".").slice(0,3).map(o=>Number.parseInt(o,10)),n=s(e),i=s(t);if(n.length<3||i.length<3||[...n,...i].some(r=>!Number.isFinite(r)))return!1;for(let r=0;r<3;r+=1)if(n[r]!==i[r])return n[r]>i[r];return!0}function md(e,t,s){if(!t||!s)return!1;let n=Array.isArray(e?.agents)?e.agents.find(o=>o?.id===t):null,i=e?.currentAgentInfo?.id===t?e.currentAgentInfo:null;return(n?.capabilities||i?.capabilities||[]).includes(s)?!0:s==="session_history_search"&&zm(n?.version||i?.version,"1.0.166")}function Ps(e,{fallbackDefault:t=!1}={}){if(e?.yeaftActiveSessionFilter)return e.yeaftActiveSessionFilter;let s=ss();return s?.activeSessionId?s.activeSessionId:t?"grp_default":null}function fi(e){let t=e.yeaftDebugSessionFilter;if(t==="__all__")return null;if(t)return t;let s=Ps(e);return s||(ss()?.sessions?.grp_default?"grp_default":null)}function Ct(e,t=null){let s=t||e?.yeaftActiveSessionFilter||null,n=Ie(e,s);return(n&&e?.yeaftConversationIdsByAgent?e.yeaftConversationIdsByAgent[n]:null)||e?.yeaftConversationId||null}function hd(e,t,s){if(e?.currentView!=="yeaft")return!1;let n=e?.yeaftActiveSessionFilter||null;if(n&&t!==n)return!1;let i=Ie(e,n);return!i||!s||i===s}var Em,$e,ui,pi,Vm,Fm,So,mi,Hm,Om,cd,Co,vd,ko,yd,bd,ns,hi=H(()=>{ct();St();$r();rn();Gl();rc();_c();Kt();Gt();Vc();Oc();qc();Bc();Er();co();Kr();es();di();si();Gr();sd();od();({defineStore:Em}=Pinia),$e=Object.freeze([]),ui=(e,t,s)=>`${e||""}::${t||""}::${s}`;pi=5,Vm=15e3,Fm=8,So=new Set(["succeeded","failed","cancelled","orphaned"]),mi=new Set(["typing","thinking","retrying","streaming","tool"]),Hm=Object.freeze(["model","availableModels","refreshedAt","catalogRefreshedAt","catalogEpoch","catalogRevision","catalogDigest","refreshStartedAt","refreshReason","refreshError","refreshing"]),Om=8,cd=64;Co=Object.freeze(["conversationId","agentId","requestId","toolCallId","sessionId","vpId","turnId","threadId"]);vd=1e3,ko=1,yd=5,bd=200,ns=Em("chat",{state:()=>({ws:null,authenticated:!1,_hasHandledAgentList:!1,_hasHandledYeaftSessionHydrate:!1,yeaftSessionInventoryCompleteSupported:null,yeaftSessionHydrateRequestId:null,yeaftSessionHydrateSlices:[],yeaftSessionHydrateError:null,_yeaftSessionInventorySocketQuarantined:!1,sessionKey:null,serverEncryptionRequired:!0,connectionState:"disconnected",reconnectAttempts:0,maxReconnectAttempts:10,reconnectTimer:null,agents:[],currentAgent:null,currentAgentInfo:null,conversations:[],activeConversations:[],currentWorkDir:null,messagesMap:{},chatSessionState:{},panels:[],activePanelId:null,_pendingPaneId:null,conversationTitles:{},customConversationTitles:{},processingConversations:{},yeaftProcessingSessions:{},yeaftUnreadSessionKeys:{},theme:localStorage.getItem("theme")||(typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),themeFollowSystem:!localStorage.getItem("theme"),locale:localStorage.getItem("locale")||"zh-CN",executionStatusMap:{},sessionHealth:{},historySessions:[],historySessionsLoading:!1,folders:[],foldersLoading:!1,providerModels:[],providerModelsLoading:!1,contextUsage:null,lastUsedAgent:localStorage.getItem("lastUsedAgent")||null,lastUsedSession:JSON.parse(localStorage.getItem("lastUsedSession")||"null"),lastViewedConversation:localStorage.getItem("lastViewedConversation")||null,pendingRecovery:null,recoveryDismissed:!1,sessionLoading:!1,sessionLoadingText:"",agentSwitching:!1,pendingAgentSelection:null,_pendingSessionTitle:null,workbenchExpanded:!1,workbenchMaximized:!1,sidebarCollapsed:!1,sessionSidebarOpen:!1,compactStatus:null,clearStatus:null,refreshingSession:!1,refreshingSessionMap:{},proxyPorts:{},hasMoreMessages:!1,loadingMoreMessages:!1,chatHistoryRequests:{},chatHistoryRequestIdSupported:null,chatHistoryConnectionGeneration:0,sessionCatalog:[],sessionCatalogLoaded:!1,sessionCatalogMutationRequests:{},activeCatalogKey:null,openUnifiedSessionCreate:!1,openUnifiedChatCreate:!1,pendingUnifiedSessionSettings:null,yeaftHasMoreHistory:!1,yeaftLoadingMoreHistory:!1,yeaftOldestLoadedSeq:null,yeaftHistoryLoadError:null,yeaftSessionHistoryState:{},yeaftMessageWindowState:{},yeaftBootstrapMetaLoadingKey:null,yeaftHistoryPerfTraceBySession:{},yeaftHistorySearchState:{requestId:null,agentId:null,sessionId:null,query:"",senderKey:"",loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:null},yeaftHistoryOutlineBySession:{},_yeaftHistoryOutlineTimeouts:{},_yeaftHistorySearchTimeout:null,_yeaftHistoryWindowPendingByKey:{},_yeaftReconnectCatchUpPending:!1,_yeaftOpenedSessionsLoadedAgents:{},_yeaftAgentSeen:null,slashCommandsMap:{},slashCommandDescriptions:{},inputDrafts:{},mcpServers:{},expertRoleDefinitions:null,llmConfig:{},llmModelDiscovery:{},llmGithubDevice:null,modelsDevRegistry:{registry:{},fetchedAt:0,error:null,loaded:!1},_modelsDevPending:null,yeaftSettings:{},searchSettings:null,tavilyUsage:null,tavilyUsageLoading:!1,_perfTraceQueue:[],_perfTraceFlushTimer:null,yeaftPerfTraceByMessageId:{},yeaftPerfTraceByTurnId:{},yeaftMcpServers:[],yeaftMcpRuntime:{connected:!1,toolCount:0,perServer:[]},yeaftMcpLoading:!1,yeaftMcpError:null,btwMode:!1,btwMessages:[],btwLoading:!1,btwSessionId:null,conversationMcpServers:{},conversationMcpServerTools:{},mcpPanelOpen:!1,expertSelections:[],customExpertRoles:[],subagents:{},activeSubagentId:null,activeRightPanel:null,pinnedSessions:JSON.parse(localStorage.getItem("pinned-sessions")||"[]"),...Ec(),workCenterOpen:!1,workCenterAgentId:null,workCenterItemsByAgent:{},workCenterListPageByAgent:{},workCenterListMoreLoadingByAgent:{},_workCenterListGenerationByAgent:{},_workCenterListQueryByAgent:{},_workCenterListFiltersByAgent:{},_workCenterListMoreRequestsByAgent:{},_workCenterListEventGenerationByAgent:{},_workCenterListEventsByAgent:{},_workCenterDeletedIdsByAgent:{},workCenterDetailByAgent:{},workCenterActionMessages:{},workCenterActionMessagesLoading:{},workCenterActionMessagesError:{},workCenterActionRequests:{},workCenterActionRequestDetails:{},workCenterActionRequestsLoading:{},workCenterActionRequestsError:{},workCenterActionRequestDetailsLoading:{},workCenterActionRequestDetailsError:{},workCenterLoadedByAgent:{},workCenterLoadingByAgent:{},workCenterErrorByAgent:{},workCenterWatcherByAgent:{},workCenterSettingsByAgent:{},workCenterRuntimeByAgent:{},workCenterSettingsLoadingByAgent:{},workCenterSettingsErrorByAgent:{},_workCenterSettingsGenerationByAgent:{},_workCenterDetailRequestGenerationByAgent:{},_workCenterDetailEventRefreshByAgent:{},_workCenterActionInputGenerationByAgent:{},_workCenterActionMessageRequests:{},_workCenterActionMessageGenerationByKey:{},_workCenterActionRequestsGeneration:{},_workCenterActionRequestDetailsGeneration:{},workCenterPending:{},workCenterCreateDraft:null,yeaftConversationId:null,yeaftConversationIdsByAgent:{},yeaftSessionAgentById:{},yeaftModel:null,yeaftModelEffort:null,yeaftSessionReady:!1,yeaftStatus:null,yeaftAvailableModels:[],yeaftStatusByAgent:{},_yeaftRetiredCatalogEpochsByAgent:{},yeaftModelsRefreshing:!1,yeaftModelRefreshError:null,yeaftYeaftDir:null,yeaftActiveTasksBySession:{},yeaftStoppingTasksById:{},yeaftToolStats:null,yeaftToolStatsLoading:!1,yeaftDebugLoops:[],yeaftDebugTurnsById:{},yeaftDebugTurnOrder:[],yeaftDebugHistoryLoading:!1,yeaftDebugHistoryError:null,yeaftDebugHistoryFetchedAt:0,yeaftDebugHistoryLimit:ko,yeaftDebugHistoryHasMore:!1,yeaftDebugSearch:"",yeaftDebugSessionFilter:null,yeaftDreamLatest:{},yeaftDreamSnapshots:{},yeaftDreamPromptLoads:{},yeaftDreamEvents:{},yeaftReflectionCards:{},yeaftSubAgentCards:{},yeaftSidebarV2Enabled:!0,yeaftActiveSessionFilter:null,_currentYeaftSessionId:null,_currentYeaftVpId:null,_currentYeaftTurnId:null,_currentYeaftThreadId:null,_yeaftAskTerminalEvents:{},activeVpTurns:{},vpStatuses:{},stoppingVpTurnIds:{},yeaftVpTyping:{},_vpCrudPending:null}),getters:{currentConversation:e=>e.activeConversations[0]||null,activeConversationId:e=>ro(e),activeSessionRoute(e){if(e.currentView==="yeaft"){let n=Ps(e);return n?{runtimeProvider:"yeaft",agentId:Ie(e,n),sessionId:n}:null}let t=ro(e);if(!t)return null;let s=e.conversations.find(n=>n?.id===t&&n.type!=="yeaft");return s?{runtimeProvider:s.provider==="copilot"?"copilot":"claude-code",agentId:s.agentId||e.currentAgent||null,sessionId:t}:null},messages(e){let t=this.activeConversationId,s=t&&e.messagesMap[t]||$e;if(e.currentView==="yeaft"){let n=e.yeaftActiveSessionFilter||"__all__",i=e.yeaftMessageWindowState[n]?.visibleTurns||ts();return vo(s,e.yeaftActiveSessionFilter||null,i)}return s},yeaftAllMessages:e=>{let t=Ct(e);return t&&e.messagesMap[t]||$e},yeaftVisibleMessages(e){let t=Ct(e),s=t&&e.messagesMap[t]||$e,n=e.yeaftActiveSessionFilter||"__all__",i=e.yeaftMessageWindowState[n]?.visibleTurns||ts();return vo(s,e.yeaftActiveSessionFilter||null,i)},hasHiddenYeaftMessages(e){if(e.currentView!=="yeaft")return!1;let t=Ct(e),s=t&&e.messagesMap[t]||$e,n=e.yeaftActiveSessionFilter||"__all__",i=e.yeaftMessageWindowState[n]?.visibleTurns||ts();return rd(s,e.yeaftActiveSessionFilter||null,i)},activeYeaftHistoryState(e){return jr(e)},yeaftInitialHistoryLoading(e){let t=jr(e);return e.currentView==="yeaft"&&!!e.yeaftActiveSessionFilter&&!!t?.loading&&!t?.loaded&&this.yeaftVisibleMessages.length===0},vpsTypingInCurrentConv(e){let t=this.activeConversationId;if(!t)return $e;let s=(e.yeaftVpTyping||{})[t];if(!s)return $e;let n=Object.keys(s).filter(i=>(s[i]||0)>0);return n.length===0?$e:n},isVpTypingInCurrentConv(e){return t=>{if(!t)return!1;let s=this.activeConversationId;if(!s)return!1;let n=(e.yeaftVpTyping||{})[s];return n?(n[t]||0)>0:!1}},yeaftDreamLatestForActiveSession(e){let t=fi(e);if(!t)return null;let s=`sessions/${t}`;return e.yeaftDreamLatest?.[s]||null},yeaftDreamSnapshotForActiveSession(e){let t=fi(e);if(!t)return null;let s=`sessions/${t}`;return e.yeaftDreamSnapshots?.[s]||null},yeaftDreamPromptLoadForActiveSession(e){let t=fi(e);if(!t)return null;let s=`sessions/${t}`;return e.yeaftDreamPromptLoads?.[s]||null},yeaftDreamEventsForActiveSession(e){let t=fi(e);if(!t)return[];let s=`sessions/${t}`,n=Array.isArray(e.yeaftDreamEvents?.[s])?e.yeaftDreamEvents[s]:[],i=Array.isArray(e.yeaftDreamEvents?.["*"])?e.yeaftDreamEvents["*"]:[];return i.length===0?n:n.length===0?i:[...n,...i].sort((r,o)=>(r.at||0)-(o.at||0))},yeaftDebugTurnsForActiveSession:e=>{let t=e.yeaftDebugTurnOrder||$e,s=e.yeaftDebugTurnsById||{},n=e.yeaftDebugLoops||$e,i=e.yeaftReflectionCards||{},r=e.yeaftDebugSessionFilter,o;r==="__all__"?o=null:r?o=r:o=null;let a={};for(let d of n)!d||!d.turnId||(a[d.turnId]||(a[d.turnId]=[]),a[d.turnId].push(d));let l={};for(let d of Object.keys(i)){let u=i[d];!u||!u.turnId||(l[u.turnId]||(l[u.turnId]=[]),l[u.turnId].push(u))}let c=[];for(let d=t.length-1;d>=0;d--){let u=t[d],p=s[u];if(!p||o&&p.sessionId&&p.sessionId!==o)continue;let f=a[u]||$e,g=l[u]||$e,v=f.length,m=0,A=0;for(let y of f){let h=y&&y.usage;h&&Number.isFinite(h.totalTokens)?m+=h.totalTokens:h&&(m+=(h.totalInputTokens||(h.inputTokens||0)+(h.cacheReadTokens||0)+(h.cacheWriteTokens||0))+(h.outputTokens||0)),y&&Number.isFinite(y.latencyMs)&&(A+=y.latencyMs)}let w=!p.closedAt,k={...p,loopCount:w||!p.loopCount?v:p.loopCount,totalTokens:w||!p.totalTokens?m:p.totalTokens,totalMs:w||!p.totalMs?A:p.totalMs,loops:f,reflections:g};c.push(k)}return c},yeaftDebugAvailableSessions:e=>{let t=new Set;for(let s of e.yeaftDebugTurnOrder||$e){let n=e.yeaftDebugTurnsById[s];n&&n.sessionId&&t.add(n.sessionId)}return Array.from(t).sort()},yeaftDebugTurnTotal:e=>(e.yeaftDebugTurnOrder||$e).length,messagesCache:e=>e.messagesMap,isMultiColumn:e=>e.activeConversations.length>1,isSplitMode:e=>e.panels.length>1,isProcessing:e=>{if(e.currentView==="yeaft"){let t=Ps(e);return t?ad(e,t,Ie(e,t)):!1}return e.currentConversation?!!e.processingConversations[e.currentConversation]:!1},canSend:e=>!(!e.currentAgent||!e.currentConversation),currentAgentName:e=>e.currentAgentInfo?.name||"\u9009\u62E9 Agent",currentAgentWorkDir:e=>e.currentAgentInfo?.workDir||"",effectiveWorkDir:e=>e.currentView==="yeaft"?ss()?.activeSession?.workDir||e.yeaftYeaftDir||e.currentAgentInfo?.workDir||"":e.currentWorkDir||e.currentAgentInfo?.workDir||"",currentAgentCapabilities:e=>e.currentAgentInfo?.capabilities||["terminal","file_editor","background_tasks"],hasCapability:e=>t=>(e.currentAgentInfo?.capabilities||["terminal","file_editor","background_tasks"]).includes(t),getConversationTitle:e=>t=>e.customConversationTitles[t]||e.conversationTitles[t]||null,executionStatus:e=>e.currentConversation?e.executionStatusMap[e.currentConversation]||{currentTool:null,toolHistory:[],lastActivity:null}:{currentTool:null,toolHistory:[],lastActivity:null},isConversationProcessing:e=>t=>!!e.processingConversations[t],isConversationConnecting:e=>t=>t?!!e.conversations.find(n=>n.id===t)?.connecting:!1,isConversationCompacting:e=>t=>t?e.compactStatus?.conversationId===t&&e.compactStatus?.status==="compacting":!1,isYeaftSessionProcessing:e=>(t,s=null)=>ad(e,t,s),isYeaftSessionUnread:e=>(t,s=null)=>{if(!t)return!1;let n=Ie(e,t,s);return n?!!e.yeaftUnreadSessionKeys?.[Gn(n,t)]:!1},showRecoveryBanner:e=>e.pendingRecovery&&!e.recoveryDismissed&&!e.currentConversation,currentSubagents:e=>{if(!e.currentConversation)return $e;let t=e.subagents[e.currentConversation];return t?Object.values(t):$e},hasRunningSubagents:e=>{if(!e.currentConversation)return!1;let t=e.subagents[e.currentConversation];return t?Object.values(t).some(s=>s.status==="running"):!1},runningSubagentCount:e=>{if(!e.currentConversation)return 0;let t=e.subagents[e.currentConversation];return t?Object.values(t).filter(s=>s.status==="running").length:0},activeSubagentMessages:e=>{if(!e.currentConversation||!e.activeSubagentId)return $e;let t=e.subagents[e.currentConversation];if(!t)return $e;let s=t[e.activeSubagentId];return(Array.isArray(s?.messages)?s.messages:$e).filter(i=>i?.type==="text")},selectedTaskInfo:()=>null,currentMcpServers:e=>e.currentConversation&&e.conversationMcpServers[e.currentConversation]||$e},actions:{activateChatView({persistPreference:e=!1}={}){let t=this._pendingChatRestoreConversationId;this._pendingChatRestoreConversationId=null,this.currentView="chat",e&&io("chat"),$c(this),t&&this.conversations.some(s=>s.id===t)&&(this.autoRestoreConversation(t),this.sendWsMessage({type:"refresh_conversation",conversationId:t}))},enterWorkCenter(e=null){let t=this.agents.filter(n=>n?.online&&Array.isArray(n.capabilities)&&n.capabilities.includes("work_center")),s=t.some(n=>n.id===e)?e:t[0]?.id||null;if(!s)return this.workCenterOpen=!1,this.workCenterAgentId=null,!1;if(this.currentAgent!==s){this.selectAgent(s),this.currentAgent=s;let n=this.agents.find(i=>i.id===s);n&&(this.currentAgentInfo=n)}return this.workCenterAgentId=s,this.workCenterOpen=!0,this.listWorkItems(s).catch(()=>{}),!0},leaveWorkCenter(){this.workCenterOpen=!1},enterWorkCenterFromSession(e,t=""){if(!e?.id)return;let s=e.agentId||Ie(this,e.id),n=String(t||e.title||e.name||"").trim();this.workCenterCreateDraft={sourceAgentId:s,requirement:n,workDir:String(e.workDir||"").trim(),origin:{sessionId:e.id,messageId:null,createdBy:"user"},linkedSessionIds:[e.id]},this.enterWorkCenter(s)},workCenterRequest(e,t={},s=null){let n=s||this.workCenterAgentId||this.currentAgent;if(!n)return Promise.reject(new Error("No Agent selected"));let i=`work-center-${Date.now()}-${Math.random().toString(36).slice(2)}`;return new Promise((r,o)=>{let a=setTimeout(()=>{delete this.workCenterPending[i],o(new Error("Work Center request timed out"))},3e4);this.workCenterPending[i]={resolve:r,reject:o,timer:a,agentId:n,op:e},this.sendWsMessage({type:"work_center_request",agentId:n,requestId:i,op:e,payload:t})})},workItemMatchesBoardQuery(e,t={}){if(!e||t.lane&&e.boardLane!==t.lane||t.vpId&&!(e.executors||[]).some(n=>n?.id===t.vpId)||t.workItemType&&e.workItemType!==t.workItemType||t.updatedFrom&&Number(e.updatedAt)<Number(t.updatedFrom)||t.updatedTo&&Number(e.updatedAt)>Number(t.updatedTo))return!1;let s=String(t.keyword||"").trim().toLowerCase();return!s||String(e.title||"").toLowerCase().includes(s)||String(e.goal||"").toLowerCase().includes(s)},applyWorkItemBoardSummary(e,t,s={}){let n=oi(e,t),i=n.find(r=>r?.id===t?.id)||null;return!i||this.workItemMatchesBoardQuery(i,s)?n:n.filter(r=>r.id!==i.id)},async listWorkItems(e=null,t={}){let s=e||this.workCenterAgentId||this.currentAgent;if(!s)return[];let n={lane:["needs_attention","active","closed"].includes(t.lane)?t.lane:null,keyword:String(t.keyword||t.search||"").trim(),vpId:String(t.vpId||"").trim(),workItemType:String(t.workItemType||"").trim(),createdFrom:Number(t.createdFrom)||null,createdTo:Number(t.createdTo)||null,updatedFrom:Number(t.updatedFrom)||null,updatedTo:Number(t.updatedTo)||null,limit:Math.min(Math.max(Number(t.limit)||100,1),200)},i=JSON.stringify(n),r=Number(this._workCenterListGenerationByAgent[s]||0)+1,o=Number(this._workCenterListEventGenerationByAgent[s]||0);this._workCenterListGenerationByAgent={...this._workCenterListGenerationByAgent,[s]:r},this._workCenterListQueryByAgent={...this._workCenterListQueryByAgent,[s]:i},this._workCenterListFiltersByAgent={...this._workCenterListFiltersByAgent,[s]:n},this.workCenterLoadingByAgent={...this.workCenterLoadingByAgent,[s]:!0},this.workCenterErrorByAgent={...this.workCenterErrorByAgent,[s]:null};try{let a=await this.workCenterRequest("list",n,s),l=(Array.isArray(a?.items)?a.items:[]).filter(d=>!this.workItemDeleted(s,d?.id));if(this._workCenterListGenerationByAgent[s]===r&&this._workCenterListQueryByAgent[s]===i&&this.workCenterAgentId===s){let d=l,u=this._workCenterListEventsByAgent[s]||{};for(let p of Object.values(u))Number(p?.generation)<=o||p?.queryKey!==i||(d=this.applyWorkItemBoardSummary(d,p.summary,n));this.workCenterItemsByAgent={...this.workCenterItemsByAgent,[s]:d},this.workCenterListPageByAgent={...this.workCenterListPageByAgent,[s]:{nextCursor:a?.nextCursor||null,queryKey:i}},this.workCenterWatcherByAgent={...this.workCenterWatcherByAgent,[s]:a?.watcher||null},this.workCenterLoadedByAgent={...this.workCenterLoadedByAgent,[s]:!0}}return l}catch(a){throw this._workCenterListGenerationByAgent[s]===r&&this._workCenterListQueryByAgent[s]===i&&(this.workCenterErrorByAgent={...this.workCenterErrorByAgent,[s]:a?.message||String(a)}),a}finally{this._workCenterListGenerationByAgent[s]===r&&this._workCenterListQueryByAgent[s]===i&&(this.workCenterLoadingByAgent={...this.workCenterLoadingByAgent,[s]:!1})}},async loadMoreWorkItems(e=null){let t=e||this.workCenterAgentId||this.currentAgent,s=this.workCenterListPageByAgent[t],n=this._workCenterListFiltersByAgent[t];if(!t||!s?.nextCursor||!n)return[];let i=s.queryKey,r=this._workCenterListGenerationByAgent[t],o=Number(this._workCenterListEventGenerationByAgent[t]||0),a=s.nextCursor,l=`${r}:${i}:${a}`;if(this._workCenterListMoreRequestsByAgent[t]?.key===l)return this._workCenterListMoreRequestsByAgent[t].request;this.workCenterListMoreLoadingByAgent={...this.workCenterListMoreLoadingByAgent,[t]:!0};let c=(async()=>{try{let d=await this.workCenterRequest("list",{...n,cursor:a},t),u=this.workCenterListPageByAgent[t];if(this._workCenterListGenerationByAgent[t]!==r||this._workCenterListQueryByAgent[t]!==i||u?.queryKey!==i||u?.nextCursor!==a||this.workCenterAgentId!==t)return[];let p=[...this.workCenterItemsByAgent[t]||[]];for(let g of Array.isArray(d?.items)?d.items:[]){if(this.workItemDeleted(t,g?.id))continue;let v=p.findIndex(m=>m.id===g.id);v<0?p.push(g):p[v]=oi([p[v]],g)[0]}let f=this._workCenterListEventsByAgent[t]||{};for(let g of Object.values(f))Number(g?.generation)<=o||g?.queryKey!==i||(p=this.applyWorkItemBoardSummary(p,g.summary,n));return this.workCenterItemsByAgent={...this.workCenterItemsByAgent,[t]:p},this.workCenterListPageByAgent={...this.workCenterListPageByAgent,[t]:{nextCursor:d?.nextCursor||null,queryKey:i}},d?.items||[]}finally{if(this._workCenterListMoreRequestsByAgent[t]?.key===l){let d={...this._workCenterListMoreRequestsByAgent};delete d[t],this._workCenterListMoreRequestsByAgent=d,this.workCenterListMoreLoadingByAgent={...this.workCenterListMoreLoadingByAgent,[t]:!1}}}})();return this._workCenterListMoreRequestsByAgent={...this._workCenterListMoreRequestsByAgent,[t]:{key:l,request:c}},c},workItemDeleted(e,t){return!!this._workCenterDeletedIdsByAgent[e]?.[t]},removeWorkItemState(e,t){this._workCenterDeletedIdsByAgent={...this._workCenterDeletedIdsByAgent,[e]:{...this._workCenterDeletedIdsByAgent[e]||{},[t]:!0}},this.beginWorkCenterDetailWrite(e),this.workCenterItemsByAgent={...this.workCenterItemsByAgent,[e]:(this.workCenterItemsByAgent[e]||[]).filter(n=>n.id!==t)},this.workCenterDetailByAgent[e]?.id===t&&(this.workCenterDetailByAgent={...this.workCenterDetailByAgent,[e]:null});let s=`${e}:${t}:`;for(let n of["workCenterActionMessages","workCenterActionMessagesLoading","workCenterActionMessagesError","workCenterActionRequests","workCenterActionRequestsLoading","workCenterActionRequestsError","workCenterActionRequestDetails","workCenterActionRequestDetailsLoading","workCenterActionRequestDetailsError","_workCenterActionMessageRequests","_workCenterActionMessageGenerationByKey","_workCenterActionRequestsGeneration","_workCenterActionRequestDetailsGeneration"]){let i={};for(let[r,o]of Object.entries(this[n]||{}))r.startsWith(s)||(i[r]=o);this[n]=i}},beginWorkCenterDetailWrite(e){let t=Number(this._workCenterDetailRequestGenerationByAgent[e]||0)+1;return this._workCenterDetailRequestGenerationByAgent={...this._workCenterDetailRequestGenerationByAgent,[e]:t},t},commitWorkCenterDetail(e,t,s){if(t?.id&&this.workItemDeleted(e,t.id)||s!=null&&Number(this._workCenterDetailRequestGenerationByAgent[e]||0)!==s)return!1;let n=this.workCenterDetailByAgent[e];return n?.id===t?.id&&Qc(t,n)?!1:(this.workCenterDetailByAgent={...this.workCenterDetailByAgent,[e]:t},!0)},async getWorkItem(e,t=null){let s=t||this.workCenterAgentId||this.currentAgent,n=this.beginWorkCenterDetailWrite(s),i=await this.workCenterRequest("get",{id:e},s);return this.commitWorkCenterDetail(s,i,n),this.workCenterDetailByAgent[s]||i},invalidateWorkItemActionMessages(e,t,s,n){if(!e||!t||!s)return null;let i=nt(n),r=Ts(e,t,s,i);this._workCenterActionMessageGenerationByKey={...this._workCenterActionMessageGenerationByKey,[r]:Number(this._workCenterActionMessageGenerationByKey[r]||0)+1};for(let a of["workCenterActionMessages","workCenterActionMessagesLoading","workCenterActionMessagesError"]){let l={...this[a]};delete l[r],this[a]=l}let o={...this._workCenterActionMessageRequests};for(let a of Object.keys(o))a.startsWith(`${r}:`)&&delete o[a];return this._workCenterActionMessageRequests=o,r},async loadWorkItemActionMessages(e,t,s,n,i=null){let r=i||this.workCenterAgentId||this.currentAgent,o=nt(s),a=Ts(r,e,t,o),l=Number(this._workCenterActionMessageGenerationByKey[a]||0),c=`${a}:${n==null?"latest":String(n)}`;if(this._workCenterActionMessageRequests[c])return this._workCenterActionMessageRequests[c];this.workCenterActionMessagesLoading={...this.workCenterActionMessagesLoading,[a]:!0},this.workCenterActionMessagesError={...this.workCenterActionMessagesError,[a]:null};let d=(async()=>{try{let u=await this.workCenterRequest("get_action_messages",{id:e,actionId:t,generation:o,cursor:n,limit:20},r);if(this.workItemDeleted(r,e)||nt(u?.generation)!==o||Number(this._workCenterActionMessageGenerationByKey[a]||0)!==l)return u;let p=this.workCenterActionMessages[a]?.messages||[],f=un(p,u?.messages||[]),g=this.workCenterActionMessages[a],v=g?.nextCursor,m=n==null?null:Number(n),A=v==null?null:Number(v),w=!g||m==null||A!=null&&m===A;return this.workCenterActionMessages={...this.workCenterActionMessages,[a]:{generation:o,messages:f,nextCursor:w?u?.nextCursor??null:v,total:Math.max(Number(u?.total)||0,Number(g?.total)||0,f.length)}},u}catch(u){throw Number(this._workCenterActionMessageGenerationByKey[a]||0)===l&&(this.workCenterActionMessagesError={...this.workCenterActionMessagesError,[a]:u?.message||String(u)}),u}finally{if(this._workCenterActionMessageRequests[c]===d){let u={...this._workCenterActionMessageRequests};delete u[c],this._workCenterActionMessageRequests=u;let p=Object.keys(u).some(f=>f.startsWith(`${a}:`));this.workCenterActionMessagesLoading={...this.workCenterActionMessagesLoading,[a]:p}}}})();return this._workCenterActionMessageRequests={...this._workCenterActionMessageRequests,[c]:d},d},async loadWorkItemActionRequests(e,t,s,n=null){let i=n||this.workCenterAgentId||this.currentAgent,r=nt(s),o=pn(i,e,t,r),a=Number(this._workCenterActionRequestsGeneration[o]||0)+1;this._workCenterActionRequestsGeneration={...this._workCenterActionRequestsGeneration,[o]:a},this.workCenterActionRequestsLoading={...this.workCenterActionRequestsLoading,[o]:!0},this.workCenterActionRequestsError={...this.workCenterActionRequestsError,[o]:null};try{let l=await this.workCenterRequest("get_action_requests",{id:e,actionId:t,generation:r},i),c=!this.workItemDeleted(i,e)&&nt(l?.generation)===r&&this._workCenterActionRequestsGeneration[o]===a;return c&&(this.workCenterActionRequests={...this.workCenterActionRequests,[o]:l?.requests||[]}),c?l?.requests||[]:this.workCenterActionRequests[o]||[]}catch(l){throw this._workCenterActionRequestsGeneration[o]===a&&(this.workCenterActionRequestsError={...this.workCenterActionRequestsError,[o]:l?.message||String(l)}),l}finally{this._workCenterActionRequestsGeneration[o]===a&&(this.workCenterActionRequestsLoading={...this.workCenterActionRequestsLoading,[o]:!1})}},async loadWorkItemActionRequest(e,t,s,n,i,r=null){let o=r||this.workCenterAgentId||this.currentAgent,a=nt(s),c=`${pn(o,e,t,a)}:${n}:${i}`,d=Number(this._workCenterActionRequestDetailsGeneration[c]||0)+1;this._workCenterActionRequestDetailsGeneration={...this._workCenterActionRequestDetailsGeneration,[c]:d},this.workCenterActionRequestDetailsLoading={...this.workCenterActionRequestDetailsLoading,[c]:!0},this.workCenterActionRequestDetailsError={...this.workCenterActionRequestDetailsError,[c]:null};try{let u=await this.workCenterRequest("get_action_request",{id:e,actionId:t,generation:a,runId:n,requestId:i},o),p=!this.workItemDeleted(o,e)&&nt(u?.generation)===a&&this._workCenterActionRequestDetailsGeneration[c]===d;return p&&(this.workCenterActionRequestDetails={...this.workCenterActionRequestDetails,[c]:u?.request||null}),p?u?.request||null:this.workCenterActionRequestDetails[c]||null}catch(u){throw this._workCenterActionRequestDetailsGeneration[c]===d&&(this.workCenterActionRequestDetailsError={...this.workCenterActionRequestDetailsError,[c]:u?.message||String(u)}),u}finally{this._workCenterActionRequestDetailsGeneration[c]===d&&(this.workCenterActionRequestDetailsLoading={...this.workCenterActionRequestDetailsLoading,[c]:!1})}},async loadWorkCenterSettings(e=null){let t=e||this.workCenterAgentId||this.currentAgent;if(!t)throw new Error("No Agent selected");let s=Number(this._workCenterSettingsGenerationByAgent[t]||0)+1;this._workCenterSettingsGenerationByAgent={...this._workCenterSettingsGenerationByAgent,[t]:s},this.workCenterSettingsLoadingByAgent={...this.workCenterSettingsLoadingByAgent,[t]:!0},this.workCenterSettingsErrorByAgent={...this.workCenterSettingsErrorByAgent,[t]:null};try{let n=await this.workCenterRequest("get_settings",{},t);return this._workCenterSettingsGenerationByAgent[t]===s&&(this.workCenterSettingsByAgent={...this.workCenterSettingsByAgent,[t]:n?.settings||null},this.workCenterRuntimeByAgent={...this.workCenterRuntimeByAgent,[t]:n?.runtime||null}),n}catch(n){throw this._workCenterSettingsGenerationByAgent[t]===s&&(this.workCenterSettingsErrorByAgent={...this.workCenterSettingsErrorByAgent,[t]:n?.message||String(n)}),n}finally{this._workCenterSettingsGenerationByAgent[t]===s&&(this.workCenterSettingsLoadingByAgent={...this.workCenterSettingsLoadingByAgent,[t]:!1})}},async refreshWorkCenterRuntime(e=null){let t=e||this.workCenterAgentId||this.currentAgent;if(!t)throw new Error("No Agent selected");let s=Number(this._workCenterSettingsGenerationByAgent[t]||0)+1;this._workCenterSettingsGenerationByAgent={...this._workCenterSettingsGenerationByAgent,[t]:s},this.workCenterSettingsLoadingByAgent={...this.workCenterSettingsLoadingByAgent,[t]:!0},this.workCenterSettingsErrorByAgent={...this.workCenterSettingsErrorByAgent,[t]:null};try{let n=await this.workCenterRequest("refresh_runtime",{},t);return this._workCenterSettingsGenerationByAgent[t]===s&&(this.workCenterSettingsByAgent={...this.workCenterSettingsByAgent,[t]:n?.settings||null},this.workCenterRuntimeByAgent={...this.workCenterRuntimeByAgent,[t]:n?.runtime||null}),n}catch(n){throw this._workCenterSettingsGenerationByAgent[t]===s&&(this.workCenterSettingsErrorByAgent={...this.workCenterSettingsErrorByAgent,[t]:n?.message||String(n)}),n}finally{this._workCenterSettingsGenerationByAgent[t]===s&&(this.workCenterSettingsLoadingByAgent={...this.workCenterSettingsLoadingByAgent,[t]:!1})}},async saveWorkCenterSettings(e,t=null){let s=t||this.workCenterAgentId||this.currentAgent;if(!s)throw new Error("No Agent selected");let n=Number(this._workCenterSettingsGenerationByAgent[s]||0)+1;this._workCenterSettingsGenerationByAgent={...this._workCenterSettingsGenerationByAgent,[s]:n};let i=await this.workCenterRequest("update_settings",{settings:e},s);return this._workCenterSettingsGenerationByAgent[s]===n&&(this.workCenterSettingsByAgent={...this.workCenterSettingsByAgent,[s]:i?.settings||null},this.workCenterRuntimeByAgent={...this.workCenterRuntimeByAgent,[s]:i?.runtime||null},this.workCenterSettingsErrorByAgent={...this.workCenterSettingsErrorByAgent,[s]:null}),i},previewWorkCenterPlan(e={},t=null){let s=t||this.workCenterAgentId||this.currentAgent;return this.workCenterRequest("preview",e,s)},async createWorkItem(e,t=null){let s=t||this.workCenterAgentId||this.currentAgent,n=this.beginWorkCenterDetailWrite(s),i=await this.workCenterRequest("create",e,s);return await this.listWorkItems(s,this._workCenterListFiltersByAgent[s]||{}),this.commitWorkCenterDetail(s,i,n),i},async updateWorkItem(e,t,s=null){let n=s||this.workCenterAgentId||this.currentAgent,i=this.beginWorkCenterDetailWrite(n),r=await this.workCenterRequest("update",{id:e,patch:t},n);return await this.listWorkItems(n,this._workCenterListFiltersByAgent[n]||{}),this.commitWorkCenterDetail(n,r,i),r},async startWorkItem(e,t=null){let s=t||this.workCenterAgentId||this.currentAgent,n=this.beginWorkCenterDetailWrite(s),i=await this.workCenterRequest("start",{id:e},s);return await this.listWorkItems(s,this._workCenterListFiltersByAgent[s]||{}),this.commitWorkCenterDetail(s,i,n),i},async cancelWorkItem(e,t=null){let s=t||this.workCenterAgentId||this.currentAgent,n=this.beginWorkCenterDetailWrite(s),i=await this.workCenterRequest("cancel",{id:e},s);return await this.listWorkItems(s,this._workCenterListFiltersByAgent[s]||{}),this.commitWorkCenterDetail(s,i,n),i},async resumeWorkItem(e,t,s=null){let n=s||this.workCenterAgentId||this.currentAgent,i=this.beginWorkCenterDetailWrite(n),r=await this.workCenterRequest("resume",{id:e,revision:t},n);return await this.listWorkItems(n,this._workCenterListFiltersByAgent[n]||{}),this.commitWorkCenterDetail(n,r,i),r},async deleteWorkItem(e,t,s=null){let n=s||this.workCenterAgentId||this.currentAgent,i=await this.workCenterRequest("delete",{id:e,revision:t},n);return this.removeWorkItemState(n,e),i},async sendWorkItemMessage(e,t,s,n=[],i=null,r={}){let o=i||this.workCenterAgentId||this.currentAgent,a=this.workCenterDetailByAgent[o]?.id===e?this.workCenterDetailByAgent[o]:null,l=await this.workCenterRequest("work_item_message",{id:e,text:t,revision:s,planRevision:Number.isInteger(Number(r.planRevision))?Number(r.planRevision):Number(a?.planRevision)||0,ledgerRevision:Number.isInteger(Number(r.ledgerRevision))?Number(r.ledgerRevision):Number(a?.ledgerRevision)||0,coordinatorRevision:Number.isInteger(Number(r.coordinatorRevision))?Number(r.coordinatorRevision):Number(a?.coordinatorRevision)||0,attachments:Array.isArray(n)?n:[]},o);if(!l?.accepted)throw new Error("Work Center Coordinator did not accept the message");return l},async retryWorkItemAction(e,t,s,n,i=null){let r=i||this.workCenterAgentId||this.currentAgent,o=this.beginWorkCenterDetailWrite(r),a=await this.workCenterRequest("retry_action",{id:e,actionId:t,revision:s,generation:n},r);return await this.listWorkItems(r,this._workCenterListFiltersByAgent[r]||{}),this.commitWorkCenterDetail(r,a,o),a},async sendWorkItemActionInput(e,t,s,n,i,r=[],o=null){let a=o||this.workCenterAgentId||this.currentAgent,l=Number(this._workCenterActionInputGenerationByAgent[a]||0)+1;this._workCenterActionInputGenerationByAgent={...this._workCenterActionInputGenerationByAgent,[a]:l};let c=await this.workCenterRequest("action_input",{id:e,text:t,actionId:s,revision:n,generation:i,attachments:r},a);await this.listWorkItems(a,this._workCenterListFiltersByAgent[a]||{});let d=this.workCenterDetailByAgent[a],u=d?.actions?.find(f=>f?.id===s),p=d?.id===e&&Number(d.revision)===Number(n)&&u&&Number(u.generation)===Number(i);return this._workCenterActionInputGenerationByAgent[a]===l&&p&&!zc(c,d)?(this.workCenterDetailByAgent={...this.workCenterDetailByAgent,[a]:c},c):d?.id===e?d:c},async guideWorkItemAction(e,t,s,n,i,r=[],o=null){let a=o||this.workCenterAgentId||this.currentAgent,l=this.beginWorkCenterDetailWrite(a),c=await this.workCenterRequest("guide",{id:e,guidance:t,actionId:s,revision:n,generation:i,attachments:r},a);return await this.listWorkItems(a,this._workCenterListFiltersByAgent[a]||{}),this.commitWorkCenterDetail(a,c,l),c},previewWorkItemAttachment(e,t,s=null){let n=s||this.workCenterAgentId||this.currentAgent;return this.workCenterRequest("preview_attachment",{id:e,attachmentId:t},n)},applyWorkCenterEvent(e,t){if(!e||!t?.workItem)return;let s=t.workItem,n=this.workCenterItemsByAgent[e]||[];if(t.type==="work_item.deleted"){this.removeWorkItemState(e,s.id);return}if(this.workItemDeleted(e,s.id))return;let i=this._workCenterListFiltersByAgent[e]||{},r=this._workCenterListEventsByAgent[e]?.[s.id]?.summary||null,o=n.some(u=>u?.id===s.id)?n:r?[r]:[],a=oi(o,s).find(u=>u?.id===s.id)||s,l=Number(this._workCenterListEventGenerationByAgent[e]||0)+1;this._workCenterListEventGenerationByAgent={...this._workCenterListEventGenerationByAgent,[e]:l},this._workCenterListEventsByAgent={...this._workCenterListEventsByAgent,[e]:{...this._workCenterListEventsByAgent[e]||{},[s.id]:{generation:l,queryKey:this._workCenterListQueryByAgent[e]||null,summary:a}}};let c=this.applyWorkItemBoardSummary(n,a,i);this.workCenterItemsByAgent={...this.workCenterItemsByAgent,[e]:c};let d=this.workCenterDetailByAgent[e];if(d?.id===s.id){let u=t.type==="run.finished"&&t.actionId&&Array.isArray(s.actionStats)&&s.actionStats.some(A=>A?.id===t.actionId)?{...s,eventActionId:t.actionId}:s,p=lo(d,u),f=Number(s.coordinatorRevision),g=Number(d.coordinatorRevision)||0,v=Number.isInteger(f)&&f>g,m=Kc(d,u);this.workCenterDetailByAgent={...this.workCenterDetailByAgent,[e]:Yc(d,s)},m&&this.refreshWorkItemDetailAfterActionChange(e,s,v?null:p)}},async refreshWorkItemDetailAfterActionChange(e,t,s=null){let n=s?(Array.isArray(t.actionStats)?t.actionStats:[]).find(v=>v?.id===s.actionId):(Array.isArray(t.actionStats)?t.actionStats:[]).find(v=>v?.id===t.currentActionId)||t.currentAction,i=s?.actionId||t.currentActionId||null,r=Number(s?.generation??n?.generation),o=Number.isInteger(r)&&r>0?r:null,a=Number(t.coordinatorRevision),l=!s&&Number.isInteger(a)&&a>=0?a:null,c=Number(s?.attempt),d=Number.isInteger(c)&&c>=0?c:null,u=l!=null?`${t.id}:coordinator:${l}`:`${t.id}:${i}${o==null?"":`:${o}`}${d==null?"":`:${d}`}`;if(this._workCenterDetailEventRefreshByAgent[e]?.key===u)return;let p=this.beginWorkCenterDetailWrite(e),f={key:u,generation:p};this._workCenterDetailEventRefreshByAgent={...this._workCenterDetailEventRefreshByAgent,[e]:f},s&&this.invalidateWorkItemActionMessages(e,t.id,s.actionId,s.generation);let g=i&&o!=null?this.loadWorkItemActionMessages(t.id,i,o,null,e).catch(()=>null):null;try{let v=await this.workCenterRequest("get",{id:t.id},e),m=this.workCenterDetailByAgent[e],A=m?.actions?.find(_=>_?.id===i),w=v?.actions?.find(_=>_?.id===i),k=o==null||nt(A?.generation)===o,y=o==null||nt(w?.generation)>=o,h=l==null||Number(v?.coordinatorRevision)===l,b=l!=null||k&&y&&(t.currentActionId==null?v?.currentActionId==null:m?.currentActionId===t.currentActionId&&v?.currentActionId===t.currentActionId);m?.id===t.id&&h&&b&&this.commitWorkCenterDetail(e,v,p)&&g&&await g}catch{}finally{if(this._workCenterDetailEventRefreshByAgent[e]===f){let v={...this._workCenterDetailEventRefreshByAgent};delete v[e],this._workCenterDetailEventRefreshByAgent=v}}},cacheYeaftAgentStatus(e,t,{allowBootstrapCatalog:s=!1}={}){if(!e||!t)return;let n=this.yeaftStatusByAgent[e]||{},i=Number(n.catalogRevision)||0,r=Number(t.catalogRevision)||0,o=typeof n.catalogEpoch=="string"?n.catalogEpoch:"",a=typeof t.catalogEpoch=="string"?t.catalogEpoch:"",l=Number(n.catalogRefreshedAt)||0,c=Number(t.catalogRefreshedAt)||0,d=Array.isArray(t.availableModels),u=t.type==="yeaft_status"&&d&&(r>0||c>0),p=Array.isArray(this._yeaftRetiredCatalogEpochsByAgent?.[e])?this._yeaftRetiredCatalogEpochsByAgent[e]:[],f=!!a&&p.includes(a),g=!!a&&a===o,v=r>0?g&&r===i:c>0&&c===l,m=r>0?!!a&&(a!==o||r>i):i===0&&c>l,A=r>0?!!t.catalogDigest&&!!n.catalogDigest&&t.catalogDigest===n.catalogDigest:t.catalogDigest===n.catalogDigest,w=u&&!f&&(m||v&&A),y=w||s&&i===0&&l===0&&!u&&d,h={...t};if(!y)for(let _ of Hm)delete h[_];let b={...n,...h};if(y){if(w&&o&&a&&o!==a){let _=[...p.filter(L=>L!==o),o].slice(-Om);this._yeaftRetiredCatalogEpochsByAgent={...this._yeaftRetiredCatalogEpochsByAgent||{},[e]:_}}b.availableModels=t.availableModels,b.catalogRefreshedAt=w?c:null,b.catalogEpoch=w&&a||null,b.catalogRevision=w&&r||null,b.catalogDigest=w&&t.catalogDigest||null}this.yeaftStatusByAgent={...this.yeaftStatusByAgent,[e]:b},this.currentAgent===e&&this.applyCachedYeaftStatus(e)},applyCachedYeaftStatus(e=this.currentAgent){let t=e?this.yeaftStatusByAgent[e]:null;return t?(this.yeaftModel=t.model||null,this.yeaftModelEffort=t.modelEffort||null,this.yeaftAvailableModels=Array.isArray(t.availableModels)?t.availableModels:[],this.yeaftModelsRefreshing=!!t.refreshing,this.yeaftModelRefreshError=t.refreshError||null,this.yeaftYeaftDir=t.yeaftDir||null,this.yeaftStatus={skills:t.skills,mcpServers:t.mcpServers,tools:t.tools,multiVp:!!t.multiVp},!0):!1},activateYeaftAgentCatalog(e,t=this.currentAgent){let s=e?this.yeaftStatusByAgent[e]:null;return s&&this.applyCachedYeaftStatus(e),Array.isArray(s?.availableModels)?!0:(this.yeaftModel=null,this.yeaftModelEffort=null,this.yeaftAvailableModels=[],s||(this.yeaftStatus=null),this.yeaftModelsRefreshing=!!e&&!s?.refreshError,this.yeaftModelRefreshError=s?.refreshError||null,t!==e&&(this.yeaftYeaftDir=null),!1)},activateYeaftAgent(e,t=null){if(!e)return!1;let s=this.currentAgent;return this.currentAgent=e,t&&(this.currentAgentInfo=t),this.activateYeaftAgentCatalog(e,s)},resolveYeaftSessionAgentId(e){return Ie(this,e)},requestYeaftSessionInventory(){if(this.yeaftSessionInventoryCompleteSupported===!1&&this.yeaftSessionHydrateRequestId)return this.yeaftSessionHydrateRequestId;if(this._yeaftSessionInventorySocketQuarantined)return this.manualReconnect(),null;clearTimeout(this._legacyYeaftSessionHydrateTimer),this._legacyYeaftSessionHydrateTimer=null;let e=`session_inventory_${crypto.randomUUID()}`;this.yeaftSessionHydrateRequestId=e,this.yeaftSessionHydrateSlices=[],this._hasHandledAgentList=!1,this._hasHandledYeaftSessionHydrate=!1,this.yeaftSessionHydrateError=null;let t=this.conversations.map(n=>n.id).filter(Boolean);return this.sendWsMessage({type:"get_agents",requestId:e,conversationIds:t.length>0?t:void 0})?(setTimeout(()=>{this.yeaftSessionHydrateRequestId===e&&(this.yeaftSessionHydrateRequestId=null,this.yeaftSessionHydrateSlices=[],this.yeaftSessionHydrateError="session_inventory_timeout",this.yeaftSessionInventoryCompleteSupported!==!0&&(this._yeaftSessionInventorySocketQuarantined=!0))},Vm),e):(this.yeaftSessionHydrateRequestId=null,this.yeaftSessionHydrateSlices=[],this.yeaftSessionHydrateError="session_inventory_send_failed",null)},beginYeaftHistoryLoad(e){let t=Pl(this,e);if(!t)return null;let{agentId:s,sessionId:n}=e||{};return setTimeout(()=>{Rl(this,{agentId:s,sessionId:n,requestId:t.requestId,error:"history_load_timeout"})},Ml),t},finishYeaftHistoryLoad(e,t={}){return _l(this,e,t)},isCurrentYeaftHistoryResponse(e){return Yr(this,e)},syncActiveYeaftHistoryLoad(){return ln(this)},enterYeaft(e=null){let t=this.currentAgent,s=e||this.currentAgent||null;if(!s){let i=this.agents.find(r=>r.online);i&&(s=i.id)}if(s&&this.currentAgent!==s){this.selectAgent(s),this.currentAgent=s;let i=this.agents.find(r=>r.id===s);i&&(this.currentAgentInfo=i)}if(!this.applyCachedYeaftStatus(s)&&t&&t!==s&&(this.yeaftAvailableModels=[],this.yeaftStatus=null,this.yeaftModelsRefreshing=!0,this.yeaftModelRefreshError=null),s){let i=this.yeaftConversationIdsByAgent?.[s]||null;i||(i=`yeaft-local-${s}-${Date.now()}`,this.yeaftConversationIdsByAgent={...this.yeaftConversationIdsByAgent||{},[s]:i}),this.yeaftConversationId=i}else this.yeaftConversationId||(this.yeaftConversationId=`yeaft-local-${Date.now()}`);this.messagesMap[this.yeaftConversationId]||(this.messagesMap[this.yeaftConversationId]=[]),Lc(this),this.currentView="yeaft",io("yeaft"),this.hasMoreMessages=!1,this.loadingMoreMessages=!1,this.yeaftHasMoreHistory=!1,this.yeaftLoadingMoreHistory=!1,this.yeaftOldestLoadedSeq=null,this._yeaftReconnectCatchUpPending=!1,this.loadOpenedYeaftSessionsForConnectedAgents(null,{force:!0}),this.requestYeaftSessionBootstrap({forceSessionReady:!0,catchUpHistory:!0,forceHistoryReplay:!0})},loadOpenedYeaftSessionsForConnectedAgents(e=null,{force:t=!1}={}){let s=Array.isArray(e)?e.filter(Boolean):Array.isArray(this.agents)?this.agents.filter(r=>r&&r.online&&r.id).map(r=>r.id):[],n=[...new Set(s)];(!this._yeaftOpenedSessionsLoadedAgents||typeof this._yeaftOpenedSessionsLoadedAgents!="object")&&(this._yeaftOpenedSessionsLoadedAgents={});let i=[];for(let r of n)!t&&this._yeaftOpenedSessionsLoadedAgents[r]||(this._yeaftOpenedSessionsLoadedAgents[r]=Date.now(),i.push(r),this.sessionCrudRequest("list",{},{agentId:r}).catch(o=>{delete this._yeaftOpenedSessionsLoadedAgents[r]}));return i},requestYeaftSessionBootstrap({forceSessionReady:e=!1,catchUpHistory:t=!1,forceHistoryReplay:s=!1}={}){if(!this.currentAgent)return;let n=Ps(this),i=n?Ie(this,n):this.currentAgent,r=Le(i,n),o=n?this.yeaftSessionHistoryState[r]:null,a=e||!this.yeaftSessionReady||!this.yeaftModel||!this.yeaftStatus,l=Number.isFinite(o?.latestSeq)?o.latestSeq:null,c=!!n&&!!this.yeaftConversationId&&Array.isArray(this.messagesMap?.[this.yeaftConversationId])&&this.messagesMap[this.yeaftConversationId].some(w=>w&&(w.sessionId??w.groupId??null)===n),d=!!n&&Br({sessionState:o,hasCachedSessionRows:c,force:!!s}),u=!!n&&!d&&bl(o,t);if(!a&&!d&&!u)return!1;let p=`${i}:${n||"__none__"}`,f=a&&!d&&!u;if(f&&this.yeaftBootstrapMetaLoadingKey===p)return!1;f&&(this.yeaftBootstrapMetaLoadingKey=p);let g=null;n&&d?g=this.beginYeaftHistoryLoad({agentId:i,sessionId:n,mode:"recent",preserveLoaded:!1}):n&&c&&!o?.loaded?(this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[r]:{...o||{},loaded:!0,loading:!1,hasMore:!!o?.hasMore,oldestSeq:Number.isFinite(o?.oldestSeq)?o.oldestSeq:null,count:o?.count||0,latestSeq:l}},this.yeaftLoadingMoreHistory=!1):n&&u&&(g=this.beginYeaftHistoryLoad({agentId:i,sessionId:n,mode:"delta",preserveLoaded:!0,latestSeq:l}));let v={type:"yeaft_load_history",agentId:i,sessionId:n,...g?{requestId:g.requestId}:{}};u?v.afterSeq=l:v.limit=d?pi:0;let m=on();v.perfTraceId=m;let A=u?"delta":d?"recent":"metadata";return n&&(this.yeaftHistoryPerfTraceBySession={...this.yeaftHistoryPerfTraceBySession||{},[r]:m}),Xe(this,{traceId:m,phase:"history.request_send",agentId:i,sessionId:n,messageType:v.type,bytes:JSON.stringify(v).length,detail:{mode:A,limit:v.limit??null,afterSeq:v.afterSeq??null,hasCachedSessionRows:c,needSessionReady:a}}),this.sendWsMessage(v),!0},leaveYeaft(){this.activateChatView({persistPreference:!0})},fetchYeaftToolStats(){this.currentAgent&&(this.yeaftToolStatsLoading=!0,this.sendWsMessage({type:"yeaft_fetch_tool_stats",agentId:this.currentAgent}),this._fetchYeaftToolStatsTimer&&clearTimeout(this._fetchYeaftToolStatsTimer),this._fetchYeaftToolStatsTimer=setTimeout(()=>{this.yeaftToolStatsLoading&&(this.yeaftToolStatsLoading=!1,this.yeaftToolStats={...this.yeaftToolStats||{snapshot:{},registered:[],unused:[]},error:null,notice:"Tool stats are unavailable right now. Try again after the agent reconnects.",fetchedAt:Date.now()}),this._fetchYeaftToolStatsTimer=null},1e4))},loadYeaftDebugHistory({groupId:e,limit:t,dreamLimit:s,indexOnly:n=!1,detailTurnId:i=null,search:r=void 0}={}){if(!this.currentAgent)return;let o=typeof r=="string"?r.trim():(this.yeaftDebugSearch||"").trim(),a=typeof i=="string"&&i,l=o&&!a?yd:ko,c=Number.isFinite(t)&&t>0?t:this.yeaftDebugHistoryLimit||l,d=Math.max(1,Math.min(l,c)),u=a?"detail":"list",p=`dbg_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`,f=JSON.stringify({agentId:this.currentAgent,groupId:e||null,limit:d,dreamLimit:Number.isFinite(s)&&s>0?s:5,indexOnly:!!n,detailTurnId:i||null,search:a?"":o});if(this._yeaftDebugHistoryInFlightKey===f)return;this._yeaftDebugHistoryInFlightKey=f,a||(this._yeaftDebugHistoryLatestListRequestId=p),this.yeaftDebugHistoryLimit=d,this.yeaftDebugHistoryLoading=!0,this.yeaftDebugHistoryError=null;let g={type:"yeaft_fetch_debug_history",agentId:this.currentAgent,requestId:p,requestKind:u,limit:d,dreamLimit:Number.isFinite(s)&&s>0?s:5};n&&(g.indexOnly=!0),typeof i=="string"&&i?g.detailTurnId=i:o&&(g.search=o),typeof e=="string"&&e&&(g.sessionId=e),this.sendWsMessage(g),this._fetchYeaftDebugHistoryTimer&&clearTimeout(this._fetchYeaftDebugHistoryTimer),this._fetchYeaftDebugHistoryTimer=setTimeout(()=>{this.yeaftDebugHistoryLoading&&(this.yeaftDebugHistoryLoading=!1,this.yeaftDebugHistoryError="Debug history is unavailable right now. Try again after the agent reconnects."),this._yeaftDebugHistoryInFlightKey=null,this._fetchYeaftDebugHistoryTimer=null},1e4)},agentIdForSession(e){return Ie(this,e)},sendYeaftSessionMessage({groupId:e,text:t,mentions:s,attachments:n,quote:i}){let r=Ie(this,e);if(!e||!r)return;let o=Array.isArray(n)?n.filter(g=>g&&g.fileId):[],a=ai(i),l=o.length>0;if(!t?.trim()&&!l)return;let c=t?.trim()?t:"(attached files)",d=`u_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`,u=on();this.yeaftPerfTraceByMessageId={...this.yeaftPerfTraceByMessageId||{},[d]:u},Xe(this,{traceId:u,phase:"send.prepare",agentId:r,sessionId:e,turnId:d,messageType:"yeaft_session_send",detail:{mentionCount:Array.isArray(s)?s.length:0,attachmentCount:o.length,quoted:!!a}});let p=Ct(this,e);if(p){let g={id:d,messageId:d,clientMessageId:d,type:"user",content:c,sessionId:e,turnId:d,...a?{quote:a}:{}};if(o.length>0&&(g.attachments=o.map(v=>({fileId:v.fileId,name:v.name,preview:v.preview,isImage:!!v.isImage,mimeType:v.mimeType||""}))),this.addMessageToConversation(p,g),this.processingConversations[p]=!0,e){let v=Ht(r,e);this.yeaftProcessingSessions={...this.yeaftProcessingSessions,...v?{[v]:!0}:{}}}this._turnCompletedConvs?.delete(p),this._closedAt?.[p]&&delete this._closedAt[p],this.getOrCreateExecutionStatus(p),Jn(this,p)}let f={type:"yeaft_session_send",agentId:r,id:d,sessionId:e,text:c,mentions:Array.isArray(s)?s:[],perfTraceId:u,...a?{quote:a}:{}};o.length>0&&(f.attachments=o.map(g=>({fileId:g.fileId,isImage:!!g.isImage}))),Xe(this,{traceId:u,phase:"send.websocket_send",agentId:r,sessionId:e,turnId:d,messageType:f.type,bytes:JSON.stringify(f).length}),this.sendWsMessage(f)},cancelYeaftTask({sessionId:e,taskId:t}){let s=typeof e=="string"?e.trim():"",n=typeof t=="string"?t.trim():"",i=Ie(this,s);return!i||!s||!n?!1:(this.yeaftStoppingTasksById={...this.yeaftStoppingTasksById,[bo(s,n)]:!0},this.sendWsMessage({type:"yeaft_task_cancel",agentId:i,sessionId:s,taskId:n,clientRequestId:`task_cancel_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}),!0)},getYeaftMessageWindowKey(e=null){return e||this.yeaftActiveSessionFilter||"__all__"},pruneYeaftMessageWindow(e=null){if(this.currentView!=="yeaft")return;let t=this.getYeaftMessageWindowKey(e);this.yeaftMessageWindowState={...this.yeaftMessageWindowState,[t]:{visibleTurns:ts()}}},expandYeaftMessageWindow(e=null,t=fn()){if(this.currentView!=="yeaft")return;let s=this.getYeaftMessageWindowKey(e),i=(this.yeaftMessageWindowState[s]?.visibleTurns||ts())+Math.max(1,Number.isFinite(t)?Math.floor(t):fn());this.yeaftMessageWindowState={...this.yeaftMessageWindowState,[s]:{visibleTurns:i}}},isYeaftMessageCached(e,t,s=null){let n=e||this.yeaftActiveSessionFilter||null,i=s||Ct(this,n);return!i||!t?!1:(this.messagesMap[i]||[]).some(r=>(!n||(r?.sessionId??r?.groupId??null)===n)&&((r?.id||r?.messageId)===t||r?.persistedMessageId===t))},revealYeaftMessage(e,t,s=null){let n=e||this.yeaftActiveSessionFilter||null,i=s||Ct(this,n);if(!i||!t)return!1;let r=(this.messagesMap[i]||[]).filter(u=>n?(u?.sessionId??u?.groupId??null)===n:!0),o=r.findIndex(u=>(u?.id||u?.messageId)===t||u?.persistedMessageId===t);if(o<0)return!1;let a=nd(r),l=a.findIndex(u=>o>=u.start&&o<u.end);if(l<0)return!1;let c=Math.max(ts(),a.length-l),d=this.getYeaftMessageWindowKey(n);return this.yeaftMessageWindowState={...this.yeaftMessageWindowState,[d]:{visibleTurns:c}},!0},getYeaftHistoryOutlineState(e=null,t=null){let s=e||this.yeaftActiveSessionFilter||null,n=Ie(this,s,t),i=Le(n,s),r=this.yeaftHistoryOutlineBySession[i]||{requestId:null,agentId:n,sessionId:s,loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,totalCount:null,loaded:!1,error:null},o=Ct(this,s),a=o?this.messagesMap[o]||[]:[],l=new Map((r.results||[]).map(p=>[mn(p),p])),c=0;for(let p of a){if((p?.sessionId??p?.groupId??null)!==s)continue;let f=p.messageId||p.id;if(!f)continue;let g=p.type==="user"&&!!p.clientMessageId&&f===p.clientMessageId,v=p.type==="assistant"&&p.isStreaming===!0;if(!g&&!v)continue;let m=p.type,A=p.turnId||p.threadId||f,w=p.speakerVpId||p.vpId||null,k=mn({role:m,messageId:f,clientMessageId:p.clientMessageId,turnId:A,speakerVpId:w}),y=l.get(k),b=(typeof p.content=="string"?p.content:"").replace(/\s+/g," ").trim();l.set(k,{...y,messageId:Number.isFinite(y?.seq)?y.messageId:f,...p.clientMessageId?{clientMessageId:p.clientMessageId}:{},turnId:A,role:m,speakerVpId:w||y?.speakerVpId||null,timestamp:p.timestamp||p.ts||y?.timestamp||null,snippet:b.length>180?`${b.slice(0,180).trimEnd()}\u2026`:b||y?.snippet||""}),y||(c+=1)}let d=p=>{let f=typeof p=="number"?p:Date.parse(p||"");return Number.isFinite(f)?f:0},u=Array.from(l.values()).sort((p,f)=>Number.isFinite(p.seq)&&Number.isFinite(f.seq)?p.seq-f.seq:d(p.timestamp)-d(f.timestamp));return{...r,results:u,totalCount:Number.isFinite(r.totalCount)?r.totalCount+c:r.totalCount}},promoteYeaftHistoryOutlineRow(e){let t=e?.sessionId??e?.groupId??null,s=Ie(this,t),n=Le(s,t),i=this.yeaftHistoryOutlineBySession[n];if(!t||!s||!i?.loaded||i.loading)return!1;let r=e?.type;if(r!=="user"&&r!=="assistant")return!1;let o=e.dbMessageId||e.messageId||e.id||null,a=Um(o);if(!o||!Number.isFinite(a))return!1;let l=e.turnId||e.threadId||o,c=e.speakerVpId||e.vpId||null,u=(typeof e.content=="string"?e.content:"").replace(/\s+/g," ").trim(),p=mn({role:r,messageId:o,clientMessageId:e.clientMessageId,turnId:l,speakerVpId:c}),f=new Map((i.results||[]).map(k=>[mn(k),k])),g=f.get(p);f.set(p,{...g,messageId:o,...e.clientMessageId?{clientMessageId:e.clientMessageId}:{},turnId:l,seq:a,role:r,speakerVpId:c,timestamp:e.timestamp||e.ts||g?.timestamp||null,snippet:u.length>180?`${u.slice(0,180).trimEnd()}\u2026`:u||g?.snippet||""});let v=50,m=Array.from(f.values()).sort((k,y)=>(k.seq||0)-(y.seq||0)),A=m.length>v,w=m.slice(-v);return this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[n]:{...i,results:w,hasMore:i.hasMore||A,nextBeforeSeq:A&&Number.isFinite(w[0]?.seq)?w[0].seq:i.nextBeforeSeq,totalCount:Number.isFinite(i.totalCount)&&!g?i.totalCount+1:i.totalCount}},!0},promoteCompletedYeaftHistoryOutline(e,t=null){let s=this.messagesMap[e]||[],n=null,i=[];for(let r=s.length-1;r>=0;r--){let o=s[r];if(o?.type==="user")break;if(t&&o?.turnId&&o.turnId!==t||o?.type!=="assistant")continue;let a=typeof o.content=="string"?o.content.replace(/\s+/g," ").trim():"";n?!String(n.content||"").trim()&&a&&(n=o):n=o,a&&i.unshift(a)}return n?this.promoteYeaftHistoryOutlineRow({...n,content:i.join(" ")}):!1},invalidateYeaftHistoryOutline(e){let t=Ie(this,e),s=Le(t,e),n=this.yeaftHistoryOutlineBySession[s];return!e||!t||!n?!1:n.loading?(this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[s]:{...n,refreshPending:!0}},!0):(this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[s]:{...n,loaded:!1,refreshPending:!1}},this.currentView==="yeaft"&&this.yeaftActiveSessionFilter===e?this.loadYeaftHistoryOutline({force:!0}):!0)},loadYeaftHistoryOutline({append:e=!1,force:t=!1,targetSessionId:s=null,targetAgentId:n=null}={}){if(this.currentView!=="yeaft"&&!s)return!1;let i=s||this.yeaftActiveSessionFilter||null,r=n||Ie(this,i);if(!i||!r)return!1;let o=Le(r,i),a=this.getYeaftHistoryOutlineState(i,r);if(!e&&a.loaded&&!t)return!0;if(e&&(!a.hasMore||!Number.isFinite(a.nextBeforeSeq))||a.loading)return!1;if(!md(this,r,"session_history_outline"))return this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[o]:{...a,error:"unsupported",loading:!1}},!1;let l=`history_outline_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,c={...a,requestId:l,agentId:r,sessionId:i,loading:!0,requestAppend:e,refreshPending:!1,error:null};this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[o]:c};let d=this._yeaftHistoryOutlineTimeouts[o];d&&clearTimeout(d);let u=setTimeout(()=>{let p=this.yeaftHistoryOutlineBySession[o];if(p?.requestId!==l)return;let f={...this._yeaftHistoryOutlineTimeouts};delete f[o],this._yeaftHistoryOutlineTimeouts=f;let g=p.refreshPending===!0;this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[o]:{...p,requestId:null,loading:!1,requestAppend:!1,loaded:g?!1:p.loaded,refreshPending:!1,error:g?null:"timeout"}},g&&this.loadYeaftHistoryOutline({force:!0,targetSessionId:i,targetAgentId:r})},1e4);return this._yeaftHistoryOutlineTimeouts={...this._yeaftHistoryOutlineTimeouts,[o]:u},this.sendWsMessage({type:"yeaft_load_history_outline",agentId:r,sessionId:i,requestId:l,limit:50,...e&&Number.isFinite(a.nextBeforeSeq)?{beforeSeq:a.nextBeforeSeq}:{},includeTotal:!a.loaded}),!0},handleYeaftHistoryOutline(e){if(!e?.agentId||!e?.sessionId)return!1;let t=Le(e.agentId,e.sessionId),s=this.yeaftHistoryOutlineBySession[t];if(!s||e.requestId!==s.requestId)return!1;let n=this._yeaftHistoryOutlineTimeouts[t];n&&clearTimeout(n);let i={...this._yeaftHistoryOutlineTimeouts};delete i[t],this._yeaftHistoryOutlineTimeouts=i;let r=Array.isArray(e.results)?e.results:[],o=s.requestAppend?[...s.results||[],...r]:r,a=new Map(o.filter(d=>d?.messageId).map(d=>[mn(d),d])),l=Array.from(a.values()).sort((d,u)=>(d.seq||0)-(u.seq||0)),c=s.refreshPending===!0;return this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[t]:{...s,requestId:null,loading:!1,requestAppend:!1,refreshPending:!1,loaded:c?!1:!e.error,results:l,hasMore:!!e.hasMore,nextBeforeSeq:Number.isFinite(e.nextBeforeSeq)?e.nextBeforeSeq:null,totalCount:Number.isFinite(e.totalCount)?e.totalCount:s.totalCount,error:c?null:e.error||null}},c&&this.loadYeaftHistoryOutline({force:!0,targetSessionId:e.sessionId,targetAgentId:e.agentId}),!0},searchYeaftHistory(e,{append:t=!1,senderKey:s=""}={}){if(this.currentView!=="yeaft")return!1;let n=typeof e=="string"?e.trim():"",i=typeof s=="string"&&(s==="user"||s.startsWith("vp:"))?s.slice(0,103):"",r=this.yeaftActiveSessionFilter||null,o=Ie(this,r);if(this._yeaftHistorySearchTimeout&&(clearTimeout(this._yeaftHistorySearchTimeout),this._yeaftHistorySearchTimeout=null),!r||!o||n.length<2&&!i)return this.yeaftHistorySearchState={requestId:null,agentId:o,sessionId:r,query:n,senderKey:i,loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:null},!1;let a=this.yeaftHistorySearchState||{};if(!md(this,o,"session_history_search"))return this.yeaftHistorySearchState={requestId:null,agentId:o,sessionId:r,query:n,senderKey:i,loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:"unsupported"},!1;let l=`history_search_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return this.yeaftHistorySearchState={requestId:l,agentId:o,sessionId:r,query:n,senderKey:i,loading:!0,results:t&&a.query===n&&a.senderKey===i?a.results:[],hasMore:!1,nextBeforeSeq:t&&a.query===n&&a.senderKey===i?a.nextBeforeSeq:null,error:null},this._yeaftHistorySearchTimeout=setTimeout(()=>{this.yeaftHistorySearchState?.requestId===l&&(this._yeaftHistorySearchTimeout=null,this.yeaftHistorySearchState={...this.yeaftHistorySearchState,loading:!1,error:"timeout"})},1e4),this.sendWsMessage({type:"yeaft_search_history",agentId:o,sessionId:r,requestId:l,query:n,senderKey:i,limit:20,...t&&a.query===n&&a.senderKey===i&&Number.isFinite(a.nextBeforeSeq)?{beforeSeq:a.nextBeforeSeq}:{}}),!0},handleYeaftHistorySearchResult(e){let t=this.yeaftHistorySearchState||{};if(!e||e.requestId!==t.requestId||e.agentId!==t.agentId||e.sessionId!==t.sessionId||e.query!==t.query||(e.senderKey||"")!==t.senderKey)return!1;this._yeaftHistorySearchTimeout&&(clearTimeout(this._yeaftHistorySearchTimeout),this._yeaftHistorySearchTimeout=null);let s=Array.isArray(e.results)?e.results:[],n=new Map((t.results||[]).map(i=>[i.messageId,i]));for(let i of s)i?.messageId&&n.set(i.messageId,i);return this.yeaftHistorySearchState={...t,loading:!1,results:Array.from(n.values()),hasMore:!!e.hasMore,nextBeforeSeq:Number.isFinite(e.nextBeforeSeq)?e.nextBeforeSeq:null,error:e.error||null},!0},loadYeaftHistoryWindow(e){let t=this.yeaftActiveSessionFilter||null,s=Ie(this,t);if(!t||!s||!e?.messageId||!Number.isFinite(e.seq))return Promise.resolve(!1);if(this.isYeaftMessageCached(t,e.messageId))return Promise.resolve(!0);let n=Le(s,`${t}:${e.messageId}`),i=this._yeaftHistoryWindowPendingByKey||{};if(i[n]?.promise)return i[n].promise;let r=`history_window_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,o=null,a=new Promise(c=>{o=c}),l=setTimeout(()=>{if(this._yeaftHistoryWindowPendingByKey?.[n]?.requestId!==r)return;let{[n]:d,...u}=this._yeaftHistoryWindowPendingByKey;this._yeaftHistoryWindowPendingByKey=u,o(!1)},1e4);return this._yeaftHistoryWindowPendingByKey={...i,[n]:{requestId:r,agentId:s,sessionId:t,messageId:e.messageId,resolve:o,timeout:l,promise:a}},this.sendWsMessage({type:"yeaft_load_history_window",agentId:s,sessionId:t,requestId:r,anchorMessageId:e.messageId,anchorSeq:e.seq,beforeTurns:5,afterTurns:5}),a},async revealYeaftHistoryResult(e){let t=this.yeaftActiveSessionFilter||null,s=Ie(this,t),n=Ct(this,t);return!t||!s||!n||!e?.messageId||!await this.loadYeaftHistoryWindow(e)||this.currentView!=="yeaft"||this.yeaftActiveSessionFilter!==t||Ie(this,t)!==s||Ct(this,t)!==n?!1:this.revealYeaftMessage(t,e.messageId,n)},handleYeaftHistoryWindow(e,t=null){let n=Object.entries(this._yeaftHistoryWindowPendingByKey||{}).find(([,c])=>c?.requestId===e?.requestId);if(!n)return!1;let[i,r]=n;if(e.agentId!==r.agentId||e.sessionId!==r.sessionId)return!1;clearTimeout(r.timeout);let{[i]:o,...a}=this._yeaftHistoryWindowPendingByKey;this._yeaftHistoryWindowPendingByKey=a;let l=!e.error&&!!t&&this.isYeaftMessageCached(r.sessionId,r.messageId,t);return r.resolve(!!l),!!l},createYeaftSession({displayName:e,vpIds:t,defaultVpId:s,workDir:n,agentId:i}={}){let r=Array.isArray(t)?t.slice():[],o=s&&r.includes(s)?s:r[0]||null,a=(e||"").trim(),l=(n||"").trim(),c={roster:r,defaultVpId:o};return a&&(c.name=a),l&&(c.workDir=l),this.sessionCrudRequest("create",c,{agentId:i})},handleYeaftOutput(e){if(!e)return;if(e.perfTraceId&&(Xe(this,{traceId:e.perfTraceId,phase:"receive.yeaft_output",agentId:e.agentId||null,sessionId:e.sessionId||null,vpId:e.vpId||null,turnId:e.turnId||null,threadId:e.threadId||null,messageType:e.data?.type||e.event?.type||e.type}),e.turnId&&(this.yeaftPerfTraceByTurnId={...this.yeaftPerfTraceByTurnId||{},[e.turnId]:e.perfTraceId})),e.data){let s=e.turnId?gn(this,e.agentId||null,e.turnId):"";if(s&&this.activeVpTurns?.[s]?.retryAttempt){let{retryAttempt:i,retryMax:r,retryDelayMs:o,retryReason:a,retryRecoveryMode:l,...c}=this.activeVpTurns[s];this.activeVpTurns={...this.activeVpTurns,[s]:c}}let n=e.conversationId||this.yeaftConversationId;if(n){let i=e.agentId||this.yeaftAgentId||this.currentAgent||null,r=e.sessionId??e.groupId??null,o=hd(this,r,i),a=i&&this.yeaftConversationIdsByAgent?this.yeaftConversationIdsByAgent[i]:null,l=!o&&a===this.yeaftConversationId;if(this.currentView==="yeaft"&&i&&a&&a!==n){let g=this.messagesMap[a]||[],v=this.messagesMap[n]||[];this.messagesMap[n]=nn(v,g).sort((m,A)=>(m.timestamp||0)-(A.timestamp||0)),!l&&String(a).startsWith("yeaft-local-")&&delete this.messagesMap[a]}i&&(this.yeaftConversationIdsByAgent={...this.yeaftConversationIdsByAgent||{},[i]:n}),(o||!this.yeaftConversationId)&&(this.yeaftConversationId=n),o&&(this.activeConversations=[n]),this.messagesMap[n]||(this.messagesMap[n]=[]),this.currentView==="yeaft"&&(e.data?.type==="user"||e.data?.type==="text_delta")&&this.pruneYeaftMessageWindow(this.yeaftActiveSessionFilter&&e.sessionId||null);let c=this._currentYeaftAgentId,d=this._currentYeaftSessionId,u=this._currentYeaftVpId,p=this._currentYeaftTurnId,f=this._currentYeaftThreadId;i&&(this._currentYeaftAgentId=i),r!=null&&(this._currentYeaftSessionId=r),e.vpId&&(this._currentYeaftVpId=e.vpId),e.turnId&&(this._currentYeaftTurnId=e.turnId),e.threadId&&(this._currentYeaftThreadId=e.threadId);try{this.currentView==="yeaft"&&r&&(!this.yeaftActiveSessionFilter||r===this.yeaftActiveSessionFilter)&&this.pruneYeaftMessageWindow(this.yeaftActiveSessionFilter?r:null);let v=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now();if(this.handleAssistantOutputFrame(n,e.data),e.perfTraceId){let b=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now();Xe(this,{traceId:e.perfTraceId,phase:"store.apply_output",agentId:e.agentId||null,sessionId:r||null,vpId:e.vpId||null,turnId:e.turnId||null,threadId:e.threadId||null,messageType:e.data?.type||null,durationMs:b-v}),ti(this,{traceId:e.perfTraceId,agentId:e.agentId||null,sessionId:r||null,vpId:e.vpId||null,turnId:e.turnId||null,threadId:e.threadId||null,messageType:e.data?.type||null})}let m=e.data,A=m?.message?.id||m?.id||null,w=Wm(A),k=Array.isArray(m?.message?.content)?m.message.content:[],y=k.some(b=>b?.type==="tool_use"),h=!!m?.tool_use_result||k.some(b=>b?.type==="tool_result");if(r){let b=!h&&!Bm(this,n,r)&&(m?.type==="user"||m?.type==="assistant"&&!y)?w:null,_=Le(e.agentId||null,r),L=this.yeaftSessionHistoryState[_]||{},U=Number.isFinite(L.latestSeq)?L.latestSeq:-1;b!==null&&b>U&&(this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[_]:{...L,latestSeq:b}})}}finally{this._currentYeaftAgentId=c,this._currentYeaftSessionId=d,this._currentYeaftVpId=u,this._currentYeaftTurnId=p,this._currentYeaftThreadId=f}}return}let t=e.event;if(t)switch(t.type){case"ask_user_question":{let s=e.conversationId||this.yeaftConversationId;if(!s||!t.requestId)break;let n=dd(e,t,s),i=()=>{let r=this.messagesMap[s]||[],o=pd(r,n,s);if(o){if(o.askAnswered||o.askExpired)return!0;o.toolName="AskUserQuestion",t.toolCallId&&!o.toolId&&(o.toolId=t.toolCallId),o.agentId=n.agentId||o.agentId||null,o.askRequestId=t.requestId,o.askQuestions=t.questions||[],o.askCreatedAt=t.createdAt||null,o.askExpiresAt=t.expiresAt||null,t.replay&&(o.askPending=!1,o.pendingAnswers=null,o.askSubmitGeneration=null),o.isHistory=!1;let c=fd(this,n);return c&&yo(o,c),this.messagesMap={...this.messagesMap,[s]:r.slice()},!0}if(!t.replay)return!1;let a={id:`ask-card-${t.requestId}`,type:"tool-use",toolName:"AskUserQuestion",toolId:t.toolCallId||null,toolInput:{questions:t.questions||[]},askRequestId:t.requestId,askQuestions:t.questions||[],askCreatedAt:t.createdAt||null,askExpiresAt:t.expiresAt||null,agentId:n.agentId,sessionId:n.sessionId,vpId:n.vpId,speakerVpId:n.vpId,turnId:n.turnId,threadId:n.threadId||"main",hasResult:!1,isHistory:!1,timestamp:t.createdAt||Date.now()},l=fd(this,n);return l&&yo(a,l),r.push(a),this.messagesMap={...this.messagesMap,[s]:r.slice()},!0};if(!i()){let r=0,o=setInterval(()=>{r+=1,(i()||r>=10)&&clearInterval(o)},200)}break}case"ask_user_answered":case"ask_user_expired":{let s=e.conversationId||this.yeaftConversationId;if(!s||!t.requestId)break;let n=this.messagesMap[s]||[],i=dd(e,t,s),r=pd(n,i,s);if(!r){Nm(this,i,t);break}yo(r,t),this.messagesMap={...this.messagesMap,[s]:n.slice()};break}case"session_ready":{let s=t.conversationId,n=e.agentId||this.currentAgent,i=n&&this.yeaftConversationIdsByAgent?this.yeaftConversationIdsByAgent[n]:null,r=this.yeaftConversationId?String(this.yeaftConversationId):"",o=r.startsWith("yeaft-local-")&&(!n||r.startsWith(`yeaft-local-${n}-`)||/^yeaft-local-\d/.test(r))?this.yeaftConversationId:null,a=i||o,l=t.sessionId||e.sessionId||null,c=hd(this,l,n),d=!c&&a===this.yeaftConversationId;if(a&&a!==s){let v=!d&&!!this._processingWatchdogs?.[a],m=this.messagesMap[a]||[],A=this.messagesMap[s]||[];this.messagesMap[s]=nn(A,m).sort((w,k)=>(w.timestamp||0)-(k.timestamp||0)),!d&&a.startsWith("yeaft-local-")&&delete this.messagesMap[a],this.processingConversations[a]&&(this.processingConversations[s]=!0,d||delete this.processingConversations[a]),this.executionStatusMap[a]&&(this.executionStatusMap[s]=this.executionStatusMap[a],d||delete this.executionStatusMap[a]),v&&(Ae(this,a),this.processingConversations[s]&&Jn(this,s))}else this.messagesMap[s]||(this.messagesMap[s]=[]);n&&(this.yeaftConversationIdsByAgent={...this.yeaftConversationIdsByAgent||{},[n]:s},this.cacheYeaftAgentStatus(n,t,{allowBootstrapCatalog:c})),c&&(this.yeaftModel=t.model,this.yeaftModelEffort=t.modelEffort||null,this.yeaftSessionReady=!0,this.yeaftBootstrapMetaLoadingKey=null,n?this.applyCachedYeaftStatus(n):this.yeaftAvailableModels=t.availableModels||[]);let u=Array.isArray(t.tasks)?t.tasks:[],p={};for(let[v,m]of Object.entries(this.yeaftActiveTasksBySession||{})){let A=Object.fromEntries(Object.entries(m||{}).filter(([,k])=>k?.id&&So.has(k.status))),w=wo(A);Object.keys(w).length>0&&(p[v]=w)}for(let v of u)!v?.id||!v.sessionId||v.status!=="running"||(p[v.sessionId]={...p[v.sessionId]||{},[v.id]:v});this.yeaftActiveTasksBySession=p,c&&(t.yeaftDir&&(this.yeaftYeaftDir=t.yeaftDir),this.yeaftStatus={skills:t.skills,mcpServers:t.mcpServers,tools:t.tools,multiVp:!!t.multiVp}),(c||!this.yeaftConversationId)&&(this.yeaftConversationId=s),c&&(this.activeConversations=[s]);let f=e.agentId||this.currentAgent||null,g=f||"__current__";this._yeaftVpSubscribedAgentKey!==g&&(this._yeaftVpSubscribedAgentKey=g,this.sendWsMessage(f?{type:"yeaft_vp_subscribe",agentId:f}:{type:"yeaft_vp_subscribe"}));break}case"yeaft_status":{let s=e.agentId||this.currentAgent;s&&this.cacheYeaftAgentStatus(s,t);break}case"context_usage":break;case"turn_open":{if(!t.turnId)break;let s={turnId:t.turnId,userPrompt:t.userPrompt||"",vpId:t.vpId||e.vpId||null,sessionId:t.sessionId||e.sessionId||null,openedAt:t.at||Date.now(),closedAt:null,totalMs:0,totalTokens:0,loopCount:0,memoryLoaded:null,memoryAdjust:null,tools:[],detailsLoaded:!0};this.yeaftDebugTurnsById={...this.yeaftDebugTurnsById,[t.turnId]:s},this.yeaftDebugTurnOrder.includes(t.turnId)||(this.yeaftDebugTurnOrder=[...this.yeaftDebugTurnOrder,t.turnId]);break}case"turn_close":{if(!t.turnId)break;let s=this.yeaftDebugTurnsById[t.turnId];if(!s)break;this.yeaftDebugTurnsById={...this.yeaftDebugTurnsById,[t.turnId]:{...s,closedAt:Date.now(),totalMs:t.totalMs||0,totalTokens:t.totalTokens||0,loopCount:t.loopCount||s.loopCount||0}};break}case"memory_used":{if(!t.turnId)break;let s=this.yeaftDebugTurnsById[t.turnId];if(!s)break;this.yeaftDebugTurnsById={...this.yeaftDebugTurnsById,[t.turnId]:{...s,memoryLoaded:Array.isArray(t.loaded)?t.loaded:[]}};break}case"dream_memory_loaded":{let s=Array.isArray(t.resident)?t.resident:[];if(t.turnId){let i=this.yeaftDebugTurnsById[t.turnId];i&&(this.yeaftDebugTurnsById={...this.yeaftDebugTurnsById,[t.turnId]:{...i,dreamMemoryLoaded:s,dreamMemoryLoadedInto:t.loadedInto||"system_prompt.memory"}})}let n={};for(let i of s){let r=i&&typeof i.scope=="string"?i.scope:null,o=r&&/^sessions\/[^/]+$/.test(r)?r:r&&/^group\/[^/]+$/.test(r)?`sessions/${r.slice(6)}`:null;o&&(n[o]={scope:o,sourceScope:r,sessionId:o.slice(9),turnId:t.turnId||null,vpId:t.vpId||null,loadedInto:t.loadedInto||"system_prompt.memory",summary:i.summary||"",truncated:!!i.truncated,receivedAt:Date.now()})}Object.keys(n).length>0&&(this.yeaftDreamPromptLoads={...this.yeaftDreamPromptLoads,...n});break}case"memory_adjust":{if(!t.turnId)break;let s=this.yeaftDebugTurnsById[t.turnId];if(!s)break;this.yeaftDebugTurnsById={...this.yeaftDebugTurnsById,[t.turnId]:{...s,memoryAdjust:{sessionKey:t.sessionKey||null,added:t.added||0,evicted:t.evicted||0,skipped:t.skipped||0,reason:t.reason||""}}};break}case"tool_exec":{if(!t.turnId)break;let s=this.yeaftDebugTurnsById[t.turnId];if(!s)break;let n=[...s.tools||[],{loopNumber:t.loopNumber||0,callId:t.callId||null,name:t.name||"?",durationMs:t.durationMs||0,isError:!!t.isError,toolOutput:t.toolOutput==null?null:String(t.toolOutput)}];this.yeaftDebugTurnsById={...this.yeaftDebugTurnsById,[t.turnId]:{...s,tools:n}};break}case"loop":{if(this.yeaftDebugLoops.push({turnId:t.turnId||null,loopNumber:t.loopNumber||0,model:t.model,systemPrompt:t.systemPrompt,messages:t.messages,response:t.response,toolCalls:t.toolCalls,usage:t.usage||{inputTokens:0,outputTokens:0,totalTokens:0},latencyMs:t.latencyMs,ttfbMs:t.ttfbMs,stopReason:t.stopReason,at:typeof t.at=="number"?t.at:null,rawRequest:t.rawRequest||null,rawResponse:t.rawResponse||null,sessionId:e.sessionId||null,vpId:e.vpId||t.vpId||null}),this.yeaftDebugLoops.length>vd){let s=Nc({loops:this.yeaftDebugLoops,turnsById:this.yeaftDebugTurnsById,turnOrder:this.yeaftDebugTurnOrder,maxLoops:Math.max(vd,this.yeaftDebugHistoryLimit||0)});this.yeaftDebugLoops=s.loops,this.yeaftDebugTurnsById=s.turnsById,this.yeaftDebugTurnOrder=s.turnOrder}break}case"llm_retry":{if(!e.turnId)break;let s=gn(this,e.agentId||null,e.turnId),n=this.activeVpTurns?.[s];if(!n)break;let i=t.reason==="stream_idle_timeout"?"stream_idle_timeout":"transient_error";this.activeVpTurns={...this.activeVpTurns,[s]:{...n,retryAttempt:t.attempt||0,retryMax:t.maxRetries||0,retryDelayMs:t.delayMs||0,retryReason:i,retryRecoveryMode:t.recoveryMode||"restart"}};break}case"recall":case"consolidate":case"fallback":case"thinking_delta":break;case"reflection":{let s=e.conversationId||this.yeaftConversationId||"unknown",n=Array.isArray(t.loopRange)?t.loopRange:[0,0],i=`${s}:${t.trigger}:${n[0]}-${n[1]}`,r=this.yeaftReflectionCards[i],o=this.messagesMap[s]||[],a=r?r.anchorMsgId:o.length>0&&o[o.length-1].id||null,l=r?r.anchorOrder:o.length;this.yeaftReflectionCards={...this.yeaftReflectionCards,[i]:{key:i,conversationId:s,turnId:t.turnId||r&&r.turnId||null,loopNumber:t.loopNumber||r&&r.loopNumber||null,trigger:t.trigger,status:t.status,loopRange:n,toolCount:t.toolCount||0,content:t.content||"",durationMs:t.durationMs||0,error:t.error||null,sessionId:e.sessionId||null,anchorMsgId:a,anchorOrder:l,updatedAt:Date.now()}};break}case"model_switched":this.yeaftModel=t.model,this.yeaftModelEffort=t.modelEffort||null;break;case"yeaft_task_event":{let s=t.task;if(!s?.id||!s.sessionId)break;let n={...this.yeaftActiveTasksBySession},i={...n[s.sessionId]||{}};s.status==="running"||So.has(s.status)?i[s.id]=s:delete i[s.id];let r=wo(i);if(Object.keys(r).length>0?n[s.sessionId]=r:delete n[s.sessionId],this.yeaftActiveTasksBySession=n,s.status!=="running"){let{[bo(s.sessionId,s.id)]:o,...a}=this.yeaftStoppingTasksById||{};this.yeaftStoppingTasksById=a}break}case"yeaft_task_cancel_result":{let s=t.taskId||t.task?.id||null,n=t.task?.sessionId||t.sessionId||e.sessionId||null;if(s&&n&&t.success===!1){let{[bo(n,s)]:r,...o}=this.yeaftStoppingTasksById||{};this.yeaftStoppingTasksById=o}let i=t.task;if(i?.id&&i.sessionId){let r={...this.yeaftActiveTasksBySession},o={...r[i.sessionId]||{}};o[i.id]=i;let a=wo(o);Object.keys(a).length>0?r[i.sessionId]=a:delete r[i.sessionId],this.yeaftActiveTasksBySession=r}break}case"sub_agent_event":{let s=e.conversationId||this.yeaftConversationId||"unknown",n=t.agentId;if(!n)break;let i=t.payload||{},r=`${s}:${n}`,o=this.yeaftSubAgentCards[r],a=this.messagesMap[s]||[],l=o?o.anchorMsgId:a.length>0&&a[a.length-1].id||null,c=o?o.anchorOrder:a.length,d=o?{...o}:{key:r,conversationId:s,agentId:n,agentName:i.agentName||"sub-agent",status:"running",text:"",toolCallCount:0,turns:0,error:null,expanded:!1,anchorMsgId:l,anchorOrder:c,updatedAt:Date.now(),sessionId:e.sessionId||null};switch(i.agentName&&!d.agentName&&(d.agentName=i.agentName),i.type){case"sub_agent_status":d.status=i.status||d.status,i.error&&(d.error=i.error);break;case"text_delta":break;case"tool_use":case"tool_call":d.toolCallCount=Number(d.toolCallCount||0)+1;break;case"tool_start":break;case"tool_result":case"tool_end":break;case"sub_agent_turn_end":{d.turns+=1;let u=typeof i.content=="string"?i.content.trim():"";u&&(d.text=d.text?`${d.text}
8
+ `))}function ci(e){let t=Array.isArray(e?.textSegments)?e.textSegments:[];if(t.length===0)return;let s=Array.isArray(e?.messages)?e.messages:[],n=e?.isActive===!0||e?.isStreaming===!0||t.some(l=>l.isStreaming===!0)||s.some(l=>l?.isStreaming===!0||l?.status==="pending"),i=s.some(l=>l?.incomplete===!0||uo.has(l?.status)||uo.has(l?.turnEndReason)||uo.has(l?.stopReason));if(n||i){for(let l of t)l.kind="progress";return}if(t.some(l=>l.kind==="result"))return;let r=s.some(l=>l?.turnEndReason==="end_turn"),o=t.some(l=>l.explicitKind),a=t.length===1&&!o;(r||a||e.isHistory&&!o)&&(t[t.length-1].kind="result")}var uo,di=H(()=>{uo=new Set(["aborted","errored","error","cancelled","canceled"])});function Ht(e,t){return!e||!t?"":`${e}${t}`}function po(e){return e?`${e}`:""}function fo(e,t){return!e||!t?"":`${e}${t}`}var sd=H(()=>{});function go(e){return e?.type==="user"&&typeof e.content=="string"&&e.content.trim()}function mo(e){return e?.type==="assistant"||e?.type==="thinking"||e?.type==="tool_use"||e?.type==="tool-use"||e?.type==="tool_result"||e?.type==="tool-result"}function ho(e,t){if(!e||e.kind!=="assistant")return!0;let s=e.turnId||e.lastTurnId||"",n=t?.turnId||"";if(s&&n&&s!==n)return!0;let i=e.speakerVpId||"",r=t?.speakerVpId||t?.vpId||"";return!!(i&&r&&i!==r)}function nd(e=[]){let t=[],s=null,n=i=>{s&&(t.push({start:s.start,end:i,kind:s.kind}),s=null)};for(let i=0;i<e.length;i++){let r=e[i];if(r){if(go(r)||r.type==="system"||r.type==="error"){n(i),s={start:i,kind:r.type};continue}if(!mo(r)){s||(s={start:i,kind:"other"});continue}(!s||s.kind==="assistant"&&ho(s,r))&&(n(i),s={start:i,kind:"assistant",turnId:r.turnId||"",speakerVpId:r.speakerVpId||r.vpId||""}),s.lastTurnId=r.turnId||s.lastTurnId||"",s.speakerVpId=s.speakerVpId||r.speakerVpId||r.vpId||""}}return n(e.length),t}function id(e,t){return t?e&&(e.sessionId??e.groupId)===t:!0}function vo(e=[],t=null,s=5){let n=Math.max(1,Number.isFinite(s)?Math.floor(s):5),i=[],r=[],o=null,a=c=>{o&&(r.push({start:o.start,end:c,kind:o.kind}),o=null)};for(let c of e){if(!id(c,t))continue;let d=i.length;if(i.push(c),go(c)||c.type==="system"||c.type==="error"){a(d),o={start:d,kind:c.type};continue}if(!mo(c)){o||(o={start:d,kind:"other"});continue}(!o||o.kind==="assistant"&&ho(o,c))&&(a(d),o={start:d,kind:"assistant",turnId:c.turnId||"",speakerVpId:c.speakerVpId||c.vpId||""}),o.lastTurnId=c.turnId||o.lastTurnId||"",o.speakerVpId=o.speakerVpId||c.speakerVpId||c.vpId||""}if(a(i.length),r.length<=n)return i;let l=r[r.length-n];return i.slice(l.start)}function rd(e=[],t=null,s=5){let n=Math.max(1,s||5),i=0,r=null,o=()=>r?(r=null,i+=1,i>n):!1;for(let a of e)if(id(a,t)){if(go(a)||a.type==="system"||a.type==="error"){if(o())return!0;r={kind:a.type};continue}if(!mo(a)){r||(r={kind:"other"});continue}if(!r||r.kind==="assistant"&&ho(r,a)){if(o())return!0;r={kind:"assistant",turnId:a.turnId||"",speakerVpId:a.speakerVpId||a.vpId||""}}r.lastTurnId=a.turnId||r.lastTurnId||"",r.speakerVpId=r.speakerVpId||a.speakerVpId||a.vpId||""}return o(),i>n}function ts(){return 5}function fn(){return 20}var od=H(()=>{});function Lm(e,t){let s=new Set;if(!t)return s;for(let n of e?.sessionCatalog||[])n?.runtimeProvider!=="yeaft"||n?.routeRef?.sessionId!==t||n.routeRef.agentId&&s.add(n.routeRef.agentId);if(s.size===0){let n=ss();for(let i of n?.sessionList||[])i?.id===t&&i?.agentId&&s.add(i.agentId)}return s}function wd(e,t){let s=Lm(e,t);return s.size===1?s.values().next().value:null}function gi(e,t,s){return!!s&&wd(e,t)===s}function ut(e,t,s){return!e||e.sessionId!==t?!1:s?e.agentId===s:!e.agentId}function ad(e,t,s=null){if(!t)return!1;let n=s||Ie(e,t),i=Ht(n,t);if(i&&e.yeaftProcessingSessions?.[i]||e.yeaftProcessingSessions?.[t]&&gi(e,t,n))return!0;for(let r of Object.values(e.activeVpTurns||{}))if(ut(r,t,n))return!0;for(let r of Object.values(e.vpStatuses||{}))if(ut(r,t,n)&&mi.has(r?.state))return!0;return!1}function $m(e,t,s,n=null){let i={...e.yeaftProcessingSessions||{}};if(t){let r=po(t);if(i=Object.fromEntries(Object.entries(i).filter(([o])=>n?o!==Ht(t,n):!o.startsWith(r))),n)gi(e,n,t)&&delete i[n];else for(let o of Object.keys(i))gi(e,o,t)&&delete i[o]}else n?delete i[n]:i={};for(let r of s||[]){let o=r?.sessionId||r?.groupId||null;if(!o||!mi.has(r?.state))continue;let a=Ht(t,o)||o;i[a]=!0}return i}function gn(e,t,s){let n=fo(t,s);return n&&e?.activeVpTurns?.[n]?n:e?.activeVpTurns?.[s]&&(!t||!e.activeVpTurns[s]?.agentId||e.activeVpTurns[s].agentId===t)?s:n||s||""}function ld(e,t){if(!t){e.activeVpTurns={},e.stoppingVpTurnIds={},e.vpStatuses={},e.yeaftProcessingSessions={};return}e.activeVpTurns=Object.fromEntries(Object.entries(e.activeVpTurns||{}).filter(([,n])=>n?.agentId&&n.agentId!==t)),e.stoppingVpTurnIds=Object.fromEntries(Object.entries(e.stoppingVpTurnIds||{}).filter(([n])=>e.activeVpTurns?.[n])),e.vpStatuses=Object.fromEntries(Object.entries(e.vpStatuses||{}).filter(([,n])=>n?.agentId&&n.agentId!==t));let s=po(t);e.yeaftProcessingSessions=Object.fromEntries(Object.entries(e.yeaftProcessingSessions||{}).filter(([n])=>!n.startsWith(s)))}function dd(e,t,s){return{conversationId:s||null,agentId:e?.agentId||t?.agentId||null,requestId:t?.requestId||null,toolCallId:t?.toolCallId||null,sessionId:e?.sessionId||t?.sessionId||null,vpId:e?.vpId||t?.vpId||null,turnId:e?.turnId||t?.turnId||null,threadId:e?.threadId||t?.threadId||null}}function ud(e,t){return{conversationId:t||null,agentId:e?.agentId||null,requestId:e?.askRequestId||null,toolCallId:e?.toolId||null,sessionId:e?.sessionId||e?.groupId||null,vpId:e?.vpId||e?.speakerVpId||null,turnId:e?.turnId||null,threadId:e?.threadId||null}}function qm(e,t){return Co.every(s=>!t[s]||e[s]===t[s])}function kd(e,t){return Co.every(s=>!e[s]||!t[s]||e[s]===t[s])}function pd(e,t,s){let n=(e||[]).filter(o=>o?.type==="tool-use"&&(o.toolName==="AskUser"||o.toolName==="AskUserQuestion")&&(!t.requestId||!o.askRequestId||o.askRequestId===t.requestId)&&(!t.toolCallId||!o.toolId||o.toolId===t.toolCallId)),i=n.filter(o=>qm(ud(o,s),t));if(i.length===1)return i[0];let r=n.filter(o=>kd(ud(o,s),t));return r.length===1?r[0]:null}function Sd(e){return Co.map(t=>e[t]||"").join("\0")}function Nm(e,t,s){let n=Sd(t),i={...e._yeaftAskTerminalEvents||{},[n]:{identity:t,event:s,receivedAt:Date.now()}},r=Object.keys(i);if(r.length>cd){r.sort((o,a)=>i[o].receivedAt-i[a].receivedAt);for(let o of r.slice(0,r.length-cd))delete i[o]}e._yeaftAskTerminalEvents=i}function fd(e,t){let s=e._yeaftAskTerminalEvents||{},n=Sd(t),i=s[n]?n:null;if(!i){let l=Object.entries(s).filter(([,c])=>kd(c.identity||{},t));l.length===1&&(i=l[0][0])}if(!i)return null;let r=s[i],{[i]:o,...a}=s;return e._yeaftAskTerminalEvents=a,r?.event||null}function Bm(e,t,s){return(e.messagesMap?.[t]||[]).some(n=>n?.type==="tool-use"&&n.sessionId===s&&n.hasResult===!1)}function yo(e,t){t.type==="ask_user_answered"?(e.askAnswered=!0,e.selectedAnswers=t.answers||{},e.askExpired=!1):(e.isHistory=!0,e.askExpired=!0,e.askAnswered=!1,e.selectedAnswers=null),e.askPending=!1,e.pendingAnswers=null,e.askSubmitGeneration=null,e.askRequestId=null}function Wm(e){if(!e||typeof e!="string")return null;let t=e.match(/^(\d+)/);if(!t)return null;let s=Number(t[1]);return Number.isFinite(s)?s:null}function Um(e){if(!e||typeof e!="string")return null;let t=e.match(/^m(\d+)$/);if(!t)return null;let s=Number(t[1]);return Number.isFinite(s)?s:null}function mn(e){return e?.role==="assistant"&&e?.turnId?`response:${e.turnId}:${e.speakerVpId||e.vpId||""}`:e?.clientMessageId?`client:${e.clientMessageId}`:`message:${e?.messageId||""}`}function gd(e){let t=e?.updatedAt||e?.endedAt||e?.createdAt,s=t?Date.parse(t):NaN;return Number.isFinite(s)?s:0}function bo(e,t){return`${e||""}::${t||""}`}function wo(e){let t=Object.entries(e||{}),s=t.filter(([,i])=>i?.status==="running"),n=t.filter(([,i])=>i&&i.status!=="running"&&So.has(i.status)).sort((i,r)=>gd(r[1])-gd(i[1])).slice(0,Fm);return Object.fromEntries([...s,...n])}function ss(){try{return typeof window>"u"?null:window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore()||null}catch{return null}}function Ie(e,t,s=null){if(s)return s;if(t){let n=ss(),i=n&&typeof n.sessionById=="function"?n.sessionById(t,e?.currentAgent||null):null;if(i&&i.agentId)return i.agentId;let r=e?.yeaftSessionAgentById?e.yeaftSessionAgentById[t]:null;if(r)return r}return e?.currentAgent||null}function zm(e,t){let s=r=>String(r||"").replace(/^v/,"").split(".").slice(0,3).map(o=>Number.parseInt(o,10)),n=s(e),i=s(t);if(n.length<3||i.length<3||[...n,...i].some(r=>!Number.isFinite(r)))return!1;for(let r=0;r<3;r+=1)if(n[r]!==i[r])return n[r]>i[r];return!0}function md(e,t,s){if(!t||!s)return!1;let n=Array.isArray(e?.agents)?e.agents.find(o=>o?.id===t):null,i=e?.currentAgentInfo?.id===t?e.currentAgentInfo:null;return(n?.capabilities||i?.capabilities||[]).includes(s)?!0:s==="session_history_search"&&zm(n?.version||i?.version,"1.0.166")}function Ps(e,{fallbackDefault:t=!1}={}){if(e?.yeaftActiveSessionFilter)return e.yeaftActiveSessionFilter;let s=ss();return s?.activeSessionId?s.activeSessionId:t?"grp_default":null}function fi(e){let t=e.yeaftDebugSessionFilter;if(t==="__all__")return null;if(t)return t;let s=Ps(e);return s||(ss()?.sessions?.grp_default?"grp_default":null)}function Ct(e,t=null){let s=t||e?.yeaftActiveSessionFilter||null,n=Ie(e,s);return(n&&e?.yeaftConversationIdsByAgent?e.yeaftConversationIdsByAgent[n]:null)||e?.yeaftConversationId||null}function hd(e,t,s){if(e?.currentView!=="yeaft")return!1;let n=e?.yeaftActiveSessionFilter||null;if(n&&t!==n)return!1;let i=Ie(e,n);return!i||!s||i===s}var Em,$e,ui,pi,Vm,Fm,So,mi,Hm,Om,cd,Co,vd,ko,yd,bd,ns,hi=H(()=>{ct();St();$r();rn();Gl();rc();Rc();Kt();Gt();Vc();Oc();qc();Bc();Er();co();Kr();es();di();si();Gr();sd();od();({defineStore:Em}=Pinia),$e=Object.freeze([]),ui=(e,t,s)=>`${e||""}::${t||""}::${s}`;pi=5,Vm=15e3,Fm=8,So=new Set(["succeeded","failed","cancelled","orphaned"]),mi=new Set(["typing","thinking","retrying","streaming","tool"]),Hm=Object.freeze(["model","availableModels","refreshedAt","catalogRefreshedAt","catalogEpoch","catalogRevision","catalogDigest","refreshStartedAt","refreshReason","refreshError","refreshing"]),Om=8,cd=64;Co=Object.freeze(["conversationId","agentId","requestId","toolCallId","sessionId","vpId","turnId","threadId"]);vd=1e3,ko=1,yd=5,bd=200,ns=Em("chat",{state:()=>({ws:null,authenticated:!1,_hasHandledAgentList:!1,_hasHandledYeaftSessionHydrate:!1,yeaftSessionInventoryCompleteSupported:null,yeaftSessionHydrateRequestId:null,yeaftSessionHydrateSlices:[],yeaftSessionHydrateError:null,_yeaftSessionInventorySocketQuarantined:!1,sessionKey:null,serverEncryptionRequired:!0,connectionState:"disconnected",reconnectAttempts:0,maxReconnectAttempts:10,reconnectTimer:null,agents:[],currentAgent:null,currentAgentInfo:null,conversations:[],activeConversations:[],currentWorkDir:null,messagesMap:{},chatSessionState:{},panels:[],activePanelId:null,_pendingPaneId:null,conversationTitles:{},customConversationTitles:{},processingConversations:{},yeaftProcessingSessions:{},yeaftUnreadSessionKeys:{},theme:localStorage.getItem("theme")||(typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),themeFollowSystem:!localStorage.getItem("theme"),locale:localStorage.getItem("locale")||"zh-CN",executionStatusMap:{},sessionHealth:{},historySessions:[],historySessionsLoading:!1,folders:[],foldersLoading:!1,providerModels:[],providerModelsLoading:!1,contextUsage:null,lastUsedAgent:localStorage.getItem("lastUsedAgent")||null,lastUsedSession:JSON.parse(localStorage.getItem("lastUsedSession")||"null"),lastViewedConversation:localStorage.getItem("lastViewedConversation")||null,pendingRecovery:null,recoveryDismissed:!1,sessionLoading:!1,sessionLoadingText:"",agentSwitching:!1,pendingAgentSelection:null,_pendingSessionTitle:null,workbenchExpanded:!1,workbenchMaximized:!1,sidebarCollapsed:!1,sessionSidebarOpen:!1,compactStatus:null,clearStatus:null,refreshingSession:!1,refreshingSessionMap:{},proxyPorts:{},hasMoreMessages:!1,loadingMoreMessages:!1,chatHistoryRequests:{},chatHistoryRequestIdSupported:null,chatHistoryConnectionGeneration:0,sessionCatalog:[],sessionCatalogLoaded:!1,sessionCatalogMutationRequests:{},activeCatalogKey:null,openUnifiedSessionCreate:!1,openUnifiedChatCreate:!1,pendingUnifiedSessionSettings:null,yeaftHasMoreHistory:!1,yeaftLoadingMoreHistory:!1,yeaftOldestLoadedSeq:null,yeaftHistoryLoadError:null,yeaftSessionHistoryState:{},yeaftMessageWindowState:{},yeaftBootstrapMetaLoadingKey:null,yeaftHistoryPerfTraceBySession:{},yeaftHistorySearchState:{requestId:null,agentId:null,sessionId:null,query:"",senderKey:"",loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:null},yeaftHistoryOutlineBySession:{},_yeaftHistoryOutlineTimeouts:{},_yeaftHistorySearchTimeout:null,_yeaftHistoryWindowPendingByKey:{},_yeaftReconnectCatchUpPending:!1,_yeaftOpenedSessionsLoadedAgents:{},_yeaftAgentSeen:null,slashCommandsMap:{},slashCommandDescriptions:{},inputDrafts:{},mcpServers:{},expertRoleDefinitions:null,llmConfig:{},llmModelDiscovery:{},llmGithubDevice:null,modelsDevRegistry:{registry:{},fetchedAt:0,error:null,loaded:!1},_modelsDevPending:null,yeaftSettings:{},searchSettings:null,tavilyUsage:null,tavilyUsageLoading:!1,_perfTraceQueue:[],_perfTraceFlushTimer:null,yeaftPerfTraceByMessageId:{},yeaftPerfTraceByTurnId:{},yeaftMcpServers:[],yeaftMcpRuntime:{connected:!1,toolCount:0,perServer:[]},yeaftMcpLoading:!1,yeaftMcpError:null,btwMode:!1,btwMessages:[],btwLoading:!1,btwSessionId:null,conversationMcpServers:{},conversationMcpServerTools:{},mcpPanelOpen:!1,expertSelections:[],customExpertRoles:[],subagents:{},activeSubagentId:null,activeRightPanel:null,pinnedSessions:JSON.parse(localStorage.getItem("pinned-sessions")||"[]"),...Ec(),workCenterOpen:!1,workCenterAgentId:null,workCenterItemsByAgent:{},workCenterListPageByAgent:{},workCenterListMoreLoadingByAgent:{},_workCenterListGenerationByAgent:{},_workCenterListQueryByAgent:{},_workCenterListFiltersByAgent:{},_workCenterListMoreRequestsByAgent:{},_workCenterListEventGenerationByAgent:{},_workCenterListEventsByAgent:{},_workCenterDeletedIdsByAgent:{},workCenterDetailByAgent:{},workCenterActionMessages:{},workCenterActionMessagesLoading:{},workCenterActionMessagesError:{},workCenterActionRequests:{},workCenterActionRequestDetails:{},workCenterActionRequestsLoading:{},workCenterActionRequestsError:{},workCenterActionRequestDetailsLoading:{},workCenterActionRequestDetailsError:{},workCenterLoadedByAgent:{},workCenterLoadingByAgent:{},workCenterErrorByAgent:{},workCenterWatcherByAgent:{},workCenterSettingsByAgent:{},workCenterRuntimeByAgent:{},workCenterSettingsLoadingByAgent:{},workCenterSettingsErrorByAgent:{},_workCenterSettingsGenerationByAgent:{},_workCenterDetailRequestGenerationByAgent:{},_workCenterDetailEventRefreshByAgent:{},_workCenterActionInputGenerationByAgent:{},_workCenterActionMessageRequests:{},_workCenterActionMessageGenerationByKey:{},_workCenterActionRequestsGeneration:{},_workCenterActionRequestDetailsGeneration:{},workCenterPending:{},workCenterCreateDraft:null,yeaftConversationId:null,yeaftConversationIdsByAgent:{},yeaftSessionAgentById:{},yeaftModel:null,yeaftModelEffort:null,yeaftSessionReady:!1,yeaftStatus:null,yeaftAvailableModels:[],yeaftStatusByAgent:{},_yeaftRetiredCatalogEpochsByAgent:{},yeaftModelsRefreshing:!1,yeaftModelRefreshError:null,yeaftYeaftDir:null,yeaftActiveTasksBySession:{},yeaftStoppingTasksById:{},yeaftToolStats:null,yeaftToolStatsLoading:!1,yeaftDebugLoops:[],yeaftDebugTurnsById:{},yeaftDebugTurnOrder:[],yeaftDebugHistoryLoading:!1,yeaftDebugHistoryError:null,yeaftDebugHistoryFetchedAt:0,yeaftDebugHistoryLimit:ko,yeaftDebugHistoryHasMore:!1,yeaftDebugSearch:"",yeaftDebugSessionFilter:null,yeaftDreamLatest:{},yeaftDreamSnapshots:{},yeaftDreamPromptLoads:{},yeaftDreamEvents:{},yeaftReflectionCards:{},yeaftSubAgentCards:{},yeaftSidebarV2Enabled:!0,yeaftActiveSessionFilter:null,_currentYeaftSessionId:null,_currentYeaftVpId:null,_currentYeaftTurnId:null,_currentYeaftThreadId:null,_yeaftAskTerminalEvents:{},activeVpTurns:{},vpStatuses:{},stoppingVpTurnIds:{},yeaftVpTyping:{},_vpCrudPending:null}),getters:{currentConversation:e=>e.activeConversations[0]||null,activeConversationId:e=>ro(e),activeSessionRoute(e){if(e.currentView==="yeaft"){let n=Ps(e);return n?{runtimeProvider:"yeaft",agentId:Ie(e,n),sessionId:n}:null}let t=ro(e);if(!t)return null;let s=e.conversations.find(n=>n?.id===t&&n.type!=="yeaft");return s?{runtimeProvider:s.provider==="copilot"?"copilot":"claude-code",agentId:s.agentId||e.currentAgent||null,sessionId:t}:null},messages(e){let t=this.activeConversationId,s=t&&e.messagesMap[t]||$e;if(e.currentView==="yeaft"){let n=e.yeaftActiveSessionFilter||"__all__",i=e.yeaftMessageWindowState[n]?.visibleTurns||ts();return vo(s,e.yeaftActiveSessionFilter||null,i)}return s},yeaftAllMessages:e=>{let t=Ct(e);return t&&e.messagesMap[t]||$e},yeaftVisibleMessages(e){let t=Ct(e),s=t&&e.messagesMap[t]||$e,n=e.yeaftActiveSessionFilter||"__all__",i=e.yeaftMessageWindowState[n]?.visibleTurns||ts();return vo(s,e.yeaftActiveSessionFilter||null,i)},hasHiddenYeaftMessages(e){if(e.currentView!=="yeaft")return!1;let t=Ct(e),s=t&&e.messagesMap[t]||$e,n=e.yeaftActiveSessionFilter||"__all__",i=e.yeaftMessageWindowState[n]?.visibleTurns||ts();return rd(s,e.yeaftActiveSessionFilter||null,i)},activeYeaftHistoryState(e){return jr(e)},yeaftInitialHistoryLoading(e){let t=jr(e);return e.currentView==="yeaft"&&!!e.yeaftActiveSessionFilter&&!!t?.loading&&!t?.loaded&&this.yeaftVisibleMessages.length===0},vpsTypingInCurrentConv(e){let t=this.activeConversationId;if(!t)return $e;let s=(e.yeaftVpTyping||{})[t];if(!s)return $e;let n=Object.keys(s).filter(i=>(s[i]||0)>0);return n.length===0?$e:n},isVpTypingInCurrentConv(e){return t=>{if(!t)return!1;let s=this.activeConversationId;if(!s)return!1;let n=(e.yeaftVpTyping||{})[s];return n?(n[t]||0)>0:!1}},yeaftDreamLatestForActiveSession(e){let t=fi(e);if(!t)return null;let s=`sessions/${t}`;return e.yeaftDreamLatest?.[s]||null},yeaftDreamSnapshotForActiveSession(e){let t=fi(e);if(!t)return null;let s=`sessions/${t}`;return e.yeaftDreamSnapshots?.[s]||null},yeaftDreamPromptLoadForActiveSession(e){let t=fi(e);if(!t)return null;let s=`sessions/${t}`;return e.yeaftDreamPromptLoads?.[s]||null},yeaftDreamEventsForActiveSession(e){let t=fi(e);if(!t)return[];let s=`sessions/${t}`,n=Array.isArray(e.yeaftDreamEvents?.[s])?e.yeaftDreamEvents[s]:[],i=Array.isArray(e.yeaftDreamEvents?.["*"])?e.yeaftDreamEvents["*"]:[];return i.length===0?n:n.length===0?i:[...n,...i].sort((r,o)=>(r.at||0)-(o.at||0))},yeaftDebugTurnsForActiveSession:e=>{let t=e.yeaftDebugTurnOrder||$e,s=e.yeaftDebugTurnsById||{},n=e.yeaftDebugLoops||$e,i=e.yeaftReflectionCards||{},r=e.yeaftDebugSessionFilter,o;r==="__all__"?o=null:r?o=r:o=null;let a={};for(let d of n)!d||!d.turnId||(a[d.turnId]||(a[d.turnId]=[]),a[d.turnId].push(d));let l={};for(let d of Object.keys(i)){let u=i[d];!u||!u.turnId||(l[u.turnId]||(l[u.turnId]=[]),l[u.turnId].push(u))}let c=[];for(let d=t.length-1;d>=0;d--){let u=t[d],p=s[u];if(!p||o&&p.sessionId&&p.sessionId!==o)continue;let f=a[u]||$e,g=l[u]||$e,v=f.length,m=0,A=0;for(let y of f){let h=y&&y.usage;h&&Number.isFinite(h.totalTokens)?m+=h.totalTokens:h&&(m+=(h.totalInputTokens||(h.inputTokens||0)+(h.cacheReadTokens||0)+(h.cacheWriteTokens||0))+(h.outputTokens||0)),y&&Number.isFinite(y.latencyMs)&&(A+=y.latencyMs)}let w=!p.closedAt,k={...p,loopCount:w||!p.loopCount?v:p.loopCount,totalTokens:w||!p.totalTokens?m:p.totalTokens,totalMs:w||!p.totalMs?A:p.totalMs,loops:f,reflections:g};c.push(k)}return c},yeaftDebugAvailableSessions:e=>{let t=new Set;for(let s of e.yeaftDebugTurnOrder||$e){let n=e.yeaftDebugTurnsById[s];n&&n.sessionId&&t.add(n.sessionId)}return Array.from(t).sort()},yeaftDebugTurnTotal:e=>(e.yeaftDebugTurnOrder||$e).length,messagesCache:e=>e.messagesMap,isMultiColumn:e=>e.activeConversations.length>1,isSplitMode:e=>e.panels.length>1,isProcessing:e=>{if(e.currentView==="yeaft"){let t=Ps(e);return t?ad(e,t,Ie(e,t)):!1}return e.currentConversation?!!e.processingConversations[e.currentConversation]:!1},canSend:e=>!(!e.currentAgent||!e.currentConversation),currentAgentName:e=>e.currentAgentInfo?.name||"\u9009\u62E9 Agent",currentAgentWorkDir:e=>e.currentAgentInfo?.workDir||"",effectiveWorkDir:e=>e.currentView==="yeaft"?ss()?.activeSession?.workDir||e.yeaftYeaftDir||e.currentAgentInfo?.workDir||"":e.currentWorkDir||e.currentAgentInfo?.workDir||"",currentAgentCapabilities:e=>e.currentAgentInfo?.capabilities||["terminal","file_editor","background_tasks"],hasCapability:e=>t=>(e.currentAgentInfo?.capabilities||["terminal","file_editor","background_tasks"]).includes(t),getConversationTitle:e=>t=>e.customConversationTitles[t]||e.conversationTitles[t]||null,executionStatus:e=>e.currentConversation?e.executionStatusMap[e.currentConversation]||{currentTool:null,toolHistory:[],lastActivity:null}:{currentTool:null,toolHistory:[],lastActivity:null},isConversationProcessing:e=>t=>!!e.processingConversations[t],isConversationConnecting:e=>t=>t?!!e.conversations.find(n=>n.id===t)?.connecting:!1,isConversationCompacting:e=>t=>t?e.compactStatus?.conversationId===t&&e.compactStatus?.status==="compacting":!1,isYeaftSessionProcessing:e=>(t,s=null)=>ad(e,t,s),isYeaftSessionUnread:e=>(t,s=null)=>{if(!t)return!1;let n=Ie(e,t,s);return n?!!e.yeaftUnreadSessionKeys?.[Gn(n,t)]:!1},showRecoveryBanner:e=>e.pendingRecovery&&!e.recoveryDismissed&&!e.currentConversation,currentSubagents:e=>{if(!e.currentConversation)return $e;let t=e.subagents[e.currentConversation];return t?Object.values(t):$e},hasRunningSubagents:e=>{if(!e.currentConversation)return!1;let t=e.subagents[e.currentConversation];return t?Object.values(t).some(s=>s.status==="running"):!1},runningSubagentCount:e=>{if(!e.currentConversation)return 0;let t=e.subagents[e.currentConversation];return t?Object.values(t).filter(s=>s.status==="running").length:0},activeSubagentMessages:e=>{if(!e.currentConversation||!e.activeSubagentId)return $e;let t=e.subagents[e.currentConversation];if(!t)return $e;let s=t[e.activeSubagentId];return(Array.isArray(s?.messages)?s.messages:$e).filter(i=>i?.type==="text")},selectedTaskInfo:()=>null,currentMcpServers:e=>e.currentConversation&&e.conversationMcpServers[e.currentConversation]||$e},actions:{activateChatView({persistPreference:e=!1}={}){let t=this._pendingChatRestoreConversationId;this._pendingChatRestoreConversationId=null,this.currentView="chat",e&&io("chat"),$c(this),t&&this.conversations.some(s=>s.id===t)&&(this.autoRestoreConversation(t),this.sendWsMessage({type:"refresh_conversation",conversationId:t}))},enterWorkCenter(e=null){let t=this.agents.filter(n=>n?.online&&Array.isArray(n.capabilities)&&n.capabilities.includes("work_center")),s=t.some(n=>n.id===e)?e:t[0]?.id||null;if(!s)return this.workCenterOpen=!1,this.workCenterAgentId=null,!1;if(this.currentAgent!==s){this.selectAgent(s),this.currentAgent=s;let n=this.agents.find(i=>i.id===s);n&&(this.currentAgentInfo=n)}return this.workCenterAgentId=s,this.workCenterOpen=!0,this.listWorkItems(s).catch(()=>{}),!0},leaveWorkCenter(){this.workCenterOpen=!1},enterWorkCenterFromSession(e,t=""){if(!e?.id)return;let s=e.agentId||Ie(this,e.id),n=String(t||e.title||e.name||"").trim();this.workCenterCreateDraft={sourceAgentId:s,requirement:n,workDir:String(e.workDir||"").trim(),origin:{sessionId:e.id,messageId:null,createdBy:"user"},linkedSessionIds:[e.id]},this.enterWorkCenter(s)},workCenterRequest(e,t={},s=null){let n=s||this.workCenterAgentId||this.currentAgent;if(!n)return Promise.reject(new Error("No Agent selected"));let i=`work-center-${Date.now()}-${Math.random().toString(36).slice(2)}`;return new Promise((r,o)=>{let a=setTimeout(()=>{delete this.workCenterPending[i],o(new Error("Work Center request timed out"))},3e4);this.workCenterPending[i]={resolve:r,reject:o,timer:a,agentId:n,op:e},this.sendWsMessage({type:"work_center_request",agentId:n,requestId:i,op:e,payload:t})})},workItemMatchesBoardQuery(e,t={}){if(!e||t.lane&&e.boardLane!==t.lane||t.vpId&&!(e.executors||[]).some(n=>n?.id===t.vpId)||t.workItemType&&e.workItemType!==t.workItemType||t.updatedFrom&&Number(e.updatedAt)<Number(t.updatedFrom)||t.updatedTo&&Number(e.updatedAt)>Number(t.updatedTo))return!1;let s=String(t.keyword||"").trim().toLowerCase();return!s||String(e.title||"").toLowerCase().includes(s)||String(e.goal||"").toLowerCase().includes(s)},applyWorkItemBoardSummary(e,t,s={}){let n=oi(e,t),i=n.find(r=>r?.id===t?.id)||null;return!i||this.workItemMatchesBoardQuery(i,s)?n:n.filter(r=>r.id!==i.id)},async listWorkItems(e=null,t={}){let s=e||this.workCenterAgentId||this.currentAgent;if(!s)return[];let n={lane:["needs_attention","active","closed"].includes(t.lane)?t.lane:null,keyword:String(t.keyword||t.search||"").trim(),vpId:String(t.vpId||"").trim(),workItemType:String(t.workItemType||"").trim(),createdFrom:Number(t.createdFrom)||null,createdTo:Number(t.createdTo)||null,updatedFrom:Number(t.updatedFrom)||null,updatedTo:Number(t.updatedTo)||null,limit:Math.min(Math.max(Number(t.limit)||100,1),200)},i=JSON.stringify(n),r=Number(this._workCenterListGenerationByAgent[s]||0)+1,o=Number(this._workCenterListEventGenerationByAgent[s]||0);this._workCenterListGenerationByAgent={...this._workCenterListGenerationByAgent,[s]:r},this._workCenterListQueryByAgent={...this._workCenterListQueryByAgent,[s]:i},this._workCenterListFiltersByAgent={...this._workCenterListFiltersByAgent,[s]:n},this.workCenterLoadingByAgent={...this.workCenterLoadingByAgent,[s]:!0},this.workCenterErrorByAgent={...this.workCenterErrorByAgent,[s]:null};try{let a=await this.workCenterRequest("list",n,s),l=(Array.isArray(a?.items)?a.items:[]).filter(d=>!this.workItemDeleted(s,d?.id));if(this._workCenterListGenerationByAgent[s]===r&&this._workCenterListQueryByAgent[s]===i&&this.workCenterAgentId===s){let d=l,u=this._workCenterListEventsByAgent[s]||{};for(let p of Object.values(u))Number(p?.generation)<=o||p?.queryKey!==i||(d=this.applyWorkItemBoardSummary(d,p.summary,n));this.workCenterItemsByAgent={...this.workCenterItemsByAgent,[s]:d},this.workCenterListPageByAgent={...this.workCenterListPageByAgent,[s]:{nextCursor:a?.nextCursor||null,queryKey:i}},this.workCenterWatcherByAgent={...this.workCenterWatcherByAgent,[s]:a?.watcher||null},this.workCenterLoadedByAgent={...this.workCenterLoadedByAgent,[s]:!0}}return l}catch(a){throw this._workCenterListGenerationByAgent[s]===r&&this._workCenterListQueryByAgent[s]===i&&(this.workCenterErrorByAgent={...this.workCenterErrorByAgent,[s]:a?.message||String(a)}),a}finally{this._workCenterListGenerationByAgent[s]===r&&this._workCenterListQueryByAgent[s]===i&&(this.workCenterLoadingByAgent={...this.workCenterLoadingByAgent,[s]:!1})}},async loadMoreWorkItems(e=null){let t=e||this.workCenterAgentId||this.currentAgent,s=this.workCenterListPageByAgent[t],n=this._workCenterListFiltersByAgent[t];if(!t||!s?.nextCursor||!n)return[];let i=s.queryKey,r=this._workCenterListGenerationByAgent[t],o=Number(this._workCenterListEventGenerationByAgent[t]||0),a=s.nextCursor,l=`${r}:${i}:${a}`;if(this._workCenterListMoreRequestsByAgent[t]?.key===l)return this._workCenterListMoreRequestsByAgent[t].request;this.workCenterListMoreLoadingByAgent={...this.workCenterListMoreLoadingByAgent,[t]:!0};let c=(async()=>{try{let d=await this.workCenterRequest("list",{...n,cursor:a},t),u=this.workCenterListPageByAgent[t];if(this._workCenterListGenerationByAgent[t]!==r||this._workCenterListQueryByAgent[t]!==i||u?.queryKey!==i||u?.nextCursor!==a||this.workCenterAgentId!==t)return[];let p=[...this.workCenterItemsByAgent[t]||[]];for(let g of Array.isArray(d?.items)?d.items:[]){if(this.workItemDeleted(t,g?.id))continue;let v=p.findIndex(m=>m.id===g.id);v<0?p.push(g):p[v]=oi([p[v]],g)[0]}let f=this._workCenterListEventsByAgent[t]||{};for(let g of Object.values(f))Number(g?.generation)<=o||g?.queryKey!==i||(p=this.applyWorkItemBoardSummary(p,g.summary,n));return this.workCenterItemsByAgent={...this.workCenterItemsByAgent,[t]:p},this.workCenterListPageByAgent={...this.workCenterListPageByAgent,[t]:{nextCursor:d?.nextCursor||null,queryKey:i}},d?.items||[]}finally{if(this._workCenterListMoreRequestsByAgent[t]?.key===l){let d={...this._workCenterListMoreRequestsByAgent};delete d[t],this._workCenterListMoreRequestsByAgent=d,this.workCenterListMoreLoadingByAgent={...this.workCenterListMoreLoadingByAgent,[t]:!1}}}})();return this._workCenterListMoreRequestsByAgent={...this._workCenterListMoreRequestsByAgent,[t]:{key:l,request:c}},c},workItemDeleted(e,t){return!!this._workCenterDeletedIdsByAgent[e]?.[t]},removeWorkItemState(e,t){this._workCenterDeletedIdsByAgent={...this._workCenterDeletedIdsByAgent,[e]:{...this._workCenterDeletedIdsByAgent[e]||{},[t]:!0}},this.beginWorkCenterDetailWrite(e),this.workCenterItemsByAgent={...this.workCenterItemsByAgent,[e]:(this.workCenterItemsByAgent[e]||[]).filter(n=>n.id!==t)},this.workCenterDetailByAgent[e]?.id===t&&(this.workCenterDetailByAgent={...this.workCenterDetailByAgent,[e]:null});let s=`${e}:${t}:`;for(let n of["workCenterActionMessages","workCenterActionMessagesLoading","workCenterActionMessagesError","workCenterActionRequests","workCenterActionRequestsLoading","workCenterActionRequestsError","workCenterActionRequestDetails","workCenterActionRequestDetailsLoading","workCenterActionRequestDetailsError","_workCenterActionMessageRequests","_workCenterActionMessageGenerationByKey","_workCenterActionRequestsGeneration","_workCenterActionRequestDetailsGeneration"]){let i={};for(let[r,o]of Object.entries(this[n]||{}))r.startsWith(s)||(i[r]=o);this[n]=i}},beginWorkCenterDetailWrite(e){let t=Number(this._workCenterDetailRequestGenerationByAgent[e]||0)+1;return this._workCenterDetailRequestGenerationByAgent={...this._workCenterDetailRequestGenerationByAgent,[e]:t},t},commitWorkCenterDetail(e,t,s){if(t?.id&&this.workItemDeleted(e,t.id)||s!=null&&Number(this._workCenterDetailRequestGenerationByAgent[e]||0)!==s)return!1;let n=this.workCenterDetailByAgent[e];return n?.id===t?.id&&Qc(t,n)?!1:(this.workCenterDetailByAgent={...this.workCenterDetailByAgent,[e]:t},!0)},async getWorkItem(e,t=null){let s=t||this.workCenterAgentId||this.currentAgent,n=this.beginWorkCenterDetailWrite(s),i=await this.workCenterRequest("get",{id:e},s);return this.commitWorkCenterDetail(s,i,n),this.workCenterDetailByAgent[s]||i},invalidateWorkItemActionMessages(e,t,s,n){if(!e||!t||!s)return null;let i=nt(n),r=Ts(e,t,s,i);this._workCenterActionMessageGenerationByKey={...this._workCenterActionMessageGenerationByKey,[r]:Number(this._workCenterActionMessageGenerationByKey[r]||0)+1};for(let a of["workCenterActionMessages","workCenterActionMessagesLoading","workCenterActionMessagesError"]){let l={...this[a]};delete l[r],this[a]=l}let o={...this._workCenterActionMessageRequests};for(let a of Object.keys(o))a.startsWith(`${r}:`)&&delete o[a];return this._workCenterActionMessageRequests=o,r},async loadWorkItemActionMessages(e,t,s,n,i=null){let r=i||this.workCenterAgentId||this.currentAgent,o=nt(s),a=Ts(r,e,t,o),l=Number(this._workCenterActionMessageGenerationByKey[a]||0),c=`${a}:${n==null?"latest":String(n)}`;if(this._workCenterActionMessageRequests[c])return this._workCenterActionMessageRequests[c];this.workCenterActionMessagesLoading={...this.workCenterActionMessagesLoading,[a]:!0},this.workCenterActionMessagesError={...this.workCenterActionMessagesError,[a]:null};let d=(async()=>{try{let u=await this.workCenterRequest("get_action_messages",{id:e,actionId:t,generation:o,cursor:n,limit:20},r);if(this.workItemDeleted(r,e)||nt(u?.generation)!==o||Number(this._workCenterActionMessageGenerationByKey[a]||0)!==l)return u;let p=this.workCenterActionMessages[a]?.messages||[],f=un(p,u?.messages||[]),g=this.workCenterActionMessages[a],v=g?.nextCursor,m=n==null?null:Number(n),A=v==null?null:Number(v),w=!g||m==null||A!=null&&m===A;return this.workCenterActionMessages={...this.workCenterActionMessages,[a]:{generation:o,messages:f,nextCursor:w?u?.nextCursor??null:v,total:Math.max(Number(u?.total)||0,Number(g?.total)||0,f.length)}},u}catch(u){throw Number(this._workCenterActionMessageGenerationByKey[a]||0)===l&&(this.workCenterActionMessagesError={...this.workCenterActionMessagesError,[a]:u?.message||String(u)}),u}finally{if(this._workCenterActionMessageRequests[c]===d){let u={...this._workCenterActionMessageRequests};delete u[c],this._workCenterActionMessageRequests=u;let p=Object.keys(u).some(f=>f.startsWith(`${a}:`));this.workCenterActionMessagesLoading={...this.workCenterActionMessagesLoading,[a]:p}}}})();return this._workCenterActionMessageRequests={...this._workCenterActionMessageRequests,[c]:d},d},async loadWorkItemActionRequests(e,t,s,n=null){let i=n||this.workCenterAgentId||this.currentAgent,r=nt(s),o=pn(i,e,t,r),a=Number(this._workCenterActionRequestsGeneration[o]||0)+1;this._workCenterActionRequestsGeneration={...this._workCenterActionRequestsGeneration,[o]:a},this.workCenterActionRequestsLoading={...this.workCenterActionRequestsLoading,[o]:!0},this.workCenterActionRequestsError={...this.workCenterActionRequestsError,[o]:null};try{let l=await this.workCenterRequest("get_action_requests",{id:e,actionId:t,generation:r},i),c=!this.workItemDeleted(i,e)&&nt(l?.generation)===r&&this._workCenterActionRequestsGeneration[o]===a;return c&&(this.workCenterActionRequests={...this.workCenterActionRequests,[o]:l?.requests||[]}),c?l?.requests||[]:this.workCenterActionRequests[o]||[]}catch(l){throw this._workCenterActionRequestsGeneration[o]===a&&(this.workCenterActionRequestsError={...this.workCenterActionRequestsError,[o]:l?.message||String(l)}),l}finally{this._workCenterActionRequestsGeneration[o]===a&&(this.workCenterActionRequestsLoading={...this.workCenterActionRequestsLoading,[o]:!1})}},async loadWorkItemActionRequest(e,t,s,n,i,r=null){let o=r||this.workCenterAgentId||this.currentAgent,a=nt(s),c=`${pn(o,e,t,a)}:${n}:${i}`,d=Number(this._workCenterActionRequestDetailsGeneration[c]||0)+1;this._workCenterActionRequestDetailsGeneration={...this._workCenterActionRequestDetailsGeneration,[c]:d},this.workCenterActionRequestDetailsLoading={...this.workCenterActionRequestDetailsLoading,[c]:!0},this.workCenterActionRequestDetailsError={...this.workCenterActionRequestDetailsError,[c]:null};try{let u=await this.workCenterRequest("get_action_request",{id:e,actionId:t,generation:a,runId:n,requestId:i},o),p=!this.workItemDeleted(o,e)&&nt(u?.generation)===a&&this._workCenterActionRequestDetailsGeneration[c]===d;return p&&(this.workCenterActionRequestDetails={...this.workCenterActionRequestDetails,[c]:u?.request||null}),p?u?.request||null:this.workCenterActionRequestDetails[c]||null}catch(u){throw this._workCenterActionRequestDetailsGeneration[c]===d&&(this.workCenterActionRequestDetailsError={...this.workCenterActionRequestDetailsError,[c]:u?.message||String(u)}),u}finally{this._workCenterActionRequestDetailsGeneration[c]===d&&(this.workCenterActionRequestDetailsLoading={...this.workCenterActionRequestDetailsLoading,[c]:!1})}},async loadWorkCenterSettings(e=null){let t=e||this.workCenterAgentId||this.currentAgent;if(!t)throw new Error("No Agent selected");let s=Number(this._workCenterSettingsGenerationByAgent[t]||0)+1;this._workCenterSettingsGenerationByAgent={...this._workCenterSettingsGenerationByAgent,[t]:s},this.workCenterSettingsLoadingByAgent={...this.workCenterSettingsLoadingByAgent,[t]:!0},this.workCenterSettingsErrorByAgent={...this.workCenterSettingsErrorByAgent,[t]:null};try{let n=await this.workCenterRequest("get_settings",{},t);return this._workCenterSettingsGenerationByAgent[t]===s&&(this.workCenterSettingsByAgent={...this.workCenterSettingsByAgent,[t]:n?.settings||null},this.workCenterRuntimeByAgent={...this.workCenterRuntimeByAgent,[t]:n?.runtime||null}),n}catch(n){throw this._workCenterSettingsGenerationByAgent[t]===s&&(this.workCenterSettingsErrorByAgent={...this.workCenterSettingsErrorByAgent,[t]:n?.message||String(n)}),n}finally{this._workCenterSettingsGenerationByAgent[t]===s&&(this.workCenterSettingsLoadingByAgent={...this.workCenterSettingsLoadingByAgent,[t]:!1})}},async refreshWorkCenterRuntime(e=null){let t=e||this.workCenterAgentId||this.currentAgent;if(!t)throw new Error("No Agent selected");let s=Number(this._workCenterSettingsGenerationByAgent[t]||0)+1;this._workCenterSettingsGenerationByAgent={...this._workCenterSettingsGenerationByAgent,[t]:s},this.workCenterSettingsLoadingByAgent={...this.workCenterSettingsLoadingByAgent,[t]:!0},this.workCenterSettingsErrorByAgent={...this.workCenterSettingsErrorByAgent,[t]:null};try{let n=await this.workCenterRequest("refresh_runtime",{},t);return this._workCenterSettingsGenerationByAgent[t]===s&&(this.workCenterSettingsByAgent={...this.workCenterSettingsByAgent,[t]:n?.settings||null},this.workCenterRuntimeByAgent={...this.workCenterRuntimeByAgent,[t]:n?.runtime||null}),n}catch(n){throw this._workCenterSettingsGenerationByAgent[t]===s&&(this.workCenterSettingsErrorByAgent={...this.workCenterSettingsErrorByAgent,[t]:n?.message||String(n)}),n}finally{this._workCenterSettingsGenerationByAgent[t]===s&&(this.workCenterSettingsLoadingByAgent={...this.workCenterSettingsLoadingByAgent,[t]:!1})}},async saveWorkCenterSettings(e,t=null){let s=t||this.workCenterAgentId||this.currentAgent;if(!s)throw new Error("No Agent selected");let n=Number(this._workCenterSettingsGenerationByAgent[s]||0)+1;this._workCenterSettingsGenerationByAgent={...this._workCenterSettingsGenerationByAgent,[s]:n};let i=await this.workCenterRequest("update_settings",{settings:e},s);return this._workCenterSettingsGenerationByAgent[s]===n&&(this.workCenterSettingsByAgent={...this.workCenterSettingsByAgent,[s]:i?.settings||null},this.workCenterRuntimeByAgent={...this.workCenterRuntimeByAgent,[s]:i?.runtime||null},this.workCenterSettingsErrorByAgent={...this.workCenterSettingsErrorByAgent,[s]:null}),i},previewWorkCenterPlan(e={},t=null){let s=t||this.workCenterAgentId||this.currentAgent;return this.workCenterRequest("preview",e,s)},async createWorkItem(e,t=null){let s=t||this.workCenterAgentId||this.currentAgent,n=this.beginWorkCenterDetailWrite(s),i=await this.workCenterRequest("create",e,s);return await this.listWorkItems(s,this._workCenterListFiltersByAgent[s]||{}),this.commitWorkCenterDetail(s,i,n),i},async updateWorkItem(e,t,s=null){let n=s||this.workCenterAgentId||this.currentAgent,i=this.beginWorkCenterDetailWrite(n),r=await this.workCenterRequest("update",{id:e,patch:t},n);return await this.listWorkItems(n,this._workCenterListFiltersByAgent[n]||{}),this.commitWorkCenterDetail(n,r,i),r},async startWorkItem(e,t=null){let s=t||this.workCenterAgentId||this.currentAgent,n=this.beginWorkCenterDetailWrite(s),i=await this.workCenterRequest("start",{id:e},s);return await this.listWorkItems(s,this._workCenterListFiltersByAgent[s]||{}),this.commitWorkCenterDetail(s,i,n),i},async cancelWorkItem(e,t=null){let s=t||this.workCenterAgentId||this.currentAgent,n=this.beginWorkCenterDetailWrite(s),i=await this.workCenterRequest("cancel",{id:e},s);return await this.listWorkItems(s,this._workCenterListFiltersByAgent[s]||{}),this.commitWorkCenterDetail(s,i,n),i},async resumeWorkItem(e,t,s=null){let n=s||this.workCenterAgentId||this.currentAgent,i=this.beginWorkCenterDetailWrite(n),r=await this.workCenterRequest("resume",{id:e,revision:t},n);return await this.listWorkItems(n,this._workCenterListFiltersByAgent[n]||{}),this.commitWorkCenterDetail(n,r,i),r},async deleteWorkItem(e,t,s=null){let n=s||this.workCenterAgentId||this.currentAgent,i=await this.workCenterRequest("delete",{id:e,revision:t},n);return this.removeWorkItemState(n,e),i},async sendWorkItemMessage(e,t,s,n=[],i=null,r={}){let o=i||this.workCenterAgentId||this.currentAgent,a=this.workCenterDetailByAgent[o]?.id===e?this.workCenterDetailByAgent[o]:null,l=await this.workCenterRequest("work_item_message",{id:e,text:t,revision:s,planRevision:Number.isInteger(Number(r.planRevision))?Number(r.planRevision):Number(a?.planRevision)||0,ledgerRevision:Number.isInteger(Number(r.ledgerRevision))?Number(r.ledgerRevision):Number(a?.ledgerRevision)||0,coordinatorRevision:Number.isInteger(Number(r.coordinatorRevision))?Number(r.coordinatorRevision):Number(a?.coordinatorRevision)||0,attachments:Array.isArray(n)?n:[]},o);if(!l?.accepted)throw new Error("Work Center Coordinator did not accept the message");return l},async retryWorkItemAction(e,t,s,n,i=null){let r=i||this.workCenterAgentId||this.currentAgent,o=this.beginWorkCenterDetailWrite(r),a=await this.workCenterRequest("retry_action",{id:e,actionId:t,revision:s,generation:n},r);return await this.listWorkItems(r,this._workCenterListFiltersByAgent[r]||{}),this.commitWorkCenterDetail(r,a,o),a},async sendWorkItemActionInput(e,t,s,n,i,r=[],o=null){let a=o||this.workCenterAgentId||this.currentAgent,l=Number(this._workCenterActionInputGenerationByAgent[a]||0)+1;this._workCenterActionInputGenerationByAgent={...this._workCenterActionInputGenerationByAgent,[a]:l};let c=await this.workCenterRequest("action_input",{id:e,text:t,actionId:s,revision:n,generation:i,attachments:r},a);await this.listWorkItems(a,this._workCenterListFiltersByAgent[a]||{});let d=this.workCenterDetailByAgent[a],u=d?.actions?.find(f=>f?.id===s),p=d?.id===e&&Number(d.revision)===Number(n)&&u&&Number(u.generation)===Number(i);return this._workCenterActionInputGenerationByAgent[a]===l&&p&&!zc(c,d)?(this.workCenterDetailByAgent={...this.workCenterDetailByAgent,[a]:c},c):d?.id===e?d:c},async guideWorkItemAction(e,t,s,n,i,r=[],o=null){let a=o||this.workCenterAgentId||this.currentAgent,l=this.beginWorkCenterDetailWrite(a),c=await this.workCenterRequest("guide",{id:e,guidance:t,actionId:s,revision:n,generation:i,attachments:r},a);return await this.listWorkItems(a,this._workCenterListFiltersByAgent[a]||{}),this.commitWorkCenterDetail(a,c,l),c},previewWorkItemAttachment(e,t,s=null){let n=s||this.workCenterAgentId||this.currentAgent;return this.workCenterRequest("preview_attachment",{id:e,attachmentId:t},n)},applyWorkCenterEvent(e,t){if(!e||!t?.workItem)return;let s=t.workItem,n=this.workCenterItemsByAgent[e]||[];if(t.type==="work_item.deleted"){this.removeWorkItemState(e,s.id);return}if(this.workItemDeleted(e,s.id))return;let i=this._workCenterListFiltersByAgent[e]||{},r=this._workCenterListEventsByAgent[e]?.[s.id]?.summary||null,o=n.some(u=>u?.id===s.id)?n:r?[r]:[],a=oi(o,s).find(u=>u?.id===s.id)||s,l=Number(this._workCenterListEventGenerationByAgent[e]||0)+1;this._workCenterListEventGenerationByAgent={...this._workCenterListEventGenerationByAgent,[e]:l},this._workCenterListEventsByAgent={...this._workCenterListEventsByAgent,[e]:{...this._workCenterListEventsByAgent[e]||{},[s.id]:{generation:l,queryKey:this._workCenterListQueryByAgent[e]||null,summary:a}}};let c=this.applyWorkItemBoardSummary(n,a,i);this.workCenterItemsByAgent={...this.workCenterItemsByAgent,[e]:c};let d=this.workCenterDetailByAgent[e];if(d?.id===s.id){let u=t.type==="run.finished"&&t.actionId&&Array.isArray(s.actionStats)&&s.actionStats.some(A=>A?.id===t.actionId)?{...s,eventActionId:t.actionId}:s,p=lo(d,u),f=Number(s.coordinatorRevision),g=Number(d.coordinatorRevision)||0,v=Number.isInteger(f)&&f>g,m=Kc(d,u);this.workCenterDetailByAgent={...this.workCenterDetailByAgent,[e]:Yc(d,s)},m&&this.refreshWorkItemDetailAfterActionChange(e,s,v?null:p)}},async refreshWorkItemDetailAfterActionChange(e,t,s=null){let n=s?(Array.isArray(t.actionStats)?t.actionStats:[]).find(v=>v?.id===s.actionId):(Array.isArray(t.actionStats)?t.actionStats:[]).find(v=>v?.id===t.currentActionId)||t.currentAction,i=s?.actionId||t.currentActionId||null,r=Number(s?.generation??n?.generation),o=Number.isInteger(r)&&r>0?r:null,a=Number(t.coordinatorRevision),l=!s&&Number.isInteger(a)&&a>=0?a:null,c=Number(s?.attempt),d=Number.isInteger(c)&&c>=0?c:null,u=l!=null?`${t.id}:coordinator:${l}`:`${t.id}:${i}${o==null?"":`:${o}`}${d==null?"":`:${d}`}`;if(this._workCenterDetailEventRefreshByAgent[e]?.key===u)return;let p=this.beginWorkCenterDetailWrite(e),f={key:u,generation:p};this._workCenterDetailEventRefreshByAgent={...this._workCenterDetailEventRefreshByAgent,[e]:f},s&&this.invalidateWorkItemActionMessages(e,t.id,s.actionId,s.generation);let g=i&&o!=null?this.loadWorkItemActionMessages(t.id,i,o,null,e).catch(()=>null):null;try{let v=await this.workCenterRequest("get",{id:t.id},e),m=this.workCenterDetailByAgent[e],A=m?.actions?.find(R=>R?.id===i),w=v?.actions?.find(R=>R?.id===i),k=o==null||nt(A?.generation)===o,y=o==null||nt(w?.generation)>=o,h=l==null||Number(v?.coordinatorRevision)===l,b=l!=null||k&&y&&(t.currentActionId==null?v?.currentActionId==null:m?.currentActionId===t.currentActionId&&v?.currentActionId===t.currentActionId);m?.id===t.id&&h&&b&&this.commitWorkCenterDetail(e,v,p)&&g&&await g}catch{}finally{if(this._workCenterDetailEventRefreshByAgent[e]===f){let v={...this._workCenterDetailEventRefreshByAgent};delete v[e],this._workCenterDetailEventRefreshByAgent=v}}},cacheYeaftAgentStatus(e,t,{allowBootstrapCatalog:s=!1}={}){if(!e||!t)return;let n=this.yeaftStatusByAgent[e]||{},i=Number(n.catalogRevision)||0,r=Number(t.catalogRevision)||0,o=typeof n.catalogEpoch=="string"?n.catalogEpoch:"",a=typeof t.catalogEpoch=="string"?t.catalogEpoch:"",l=Number(n.catalogRefreshedAt)||0,c=Number(t.catalogRefreshedAt)||0,d=Array.isArray(t.availableModels),u=t.type==="yeaft_status"&&d&&(r>0||c>0),p=Array.isArray(this._yeaftRetiredCatalogEpochsByAgent?.[e])?this._yeaftRetiredCatalogEpochsByAgent[e]:[],f=!!a&&p.includes(a),g=!!a&&a===o,v=r>0?g&&r===i:c>0&&c===l,m=r>0?!!a&&(a!==o||r>i):i===0&&c>l,A=r>0?!!t.catalogDigest&&!!n.catalogDigest&&t.catalogDigest===n.catalogDigest:t.catalogDigest===n.catalogDigest,w=u&&!f&&(m||v&&A),y=w||s&&i===0&&l===0&&!u&&d,h={...t};if(!y)for(let R of Hm)delete h[R];let b={...n,...h};if(y){if(w&&o&&a&&o!==a){let R=[...p.filter(L=>L!==o),o].slice(-Om);this._yeaftRetiredCatalogEpochsByAgent={...this._yeaftRetiredCatalogEpochsByAgent||{},[e]:R}}b.availableModels=t.availableModels,b.catalogRefreshedAt=w?c:null,b.catalogEpoch=w&&a||null,b.catalogRevision=w&&r||null,b.catalogDigest=w&&t.catalogDigest||null}this.yeaftStatusByAgent={...this.yeaftStatusByAgent,[e]:b},this.currentAgent===e&&this.applyCachedYeaftStatus(e)},applyCachedYeaftStatus(e=this.currentAgent){let t=e?this.yeaftStatusByAgent[e]:null;return t?(this.yeaftModel=t.model||null,this.yeaftModelEffort=t.modelEffort||null,this.yeaftAvailableModels=Array.isArray(t.availableModels)?t.availableModels:[],this.yeaftModelsRefreshing=!!t.refreshing,this.yeaftModelRefreshError=t.refreshError||null,this.yeaftYeaftDir=t.yeaftDir||null,this.yeaftStatus={skills:t.skills,mcpServers:t.mcpServers,tools:t.tools,multiVp:!!t.multiVp},!0):!1},activateYeaftAgentCatalog(e,t=this.currentAgent){let s=e?this.yeaftStatusByAgent[e]:null;return s&&this.applyCachedYeaftStatus(e),Array.isArray(s?.availableModels)?!0:(this.yeaftModel=null,this.yeaftModelEffort=null,this.yeaftAvailableModels=[],s||(this.yeaftStatus=null),this.yeaftModelsRefreshing=!!e&&!s?.refreshError,this.yeaftModelRefreshError=s?.refreshError||null,t!==e&&(this.yeaftYeaftDir=null),!1)},activateYeaftAgent(e,t=null){if(!e)return!1;let s=this.currentAgent;return this.currentAgent=e,t&&(this.currentAgentInfo=t),this.activateYeaftAgentCatalog(e,s)},resolveYeaftSessionAgentId(e){return Ie(this,e)},requestYeaftSessionInventory(){if(this.yeaftSessionInventoryCompleteSupported===!1&&this.yeaftSessionHydrateRequestId)return this.yeaftSessionHydrateRequestId;if(this._yeaftSessionInventorySocketQuarantined)return this.manualReconnect(),null;clearTimeout(this._legacyYeaftSessionHydrateTimer),this._legacyYeaftSessionHydrateTimer=null;let e=`session_inventory_${crypto.randomUUID()}`;this.yeaftSessionHydrateRequestId=e,this.yeaftSessionHydrateSlices=[],this._hasHandledAgentList=!1,this._hasHandledYeaftSessionHydrate=!1,this.yeaftSessionHydrateError=null;let t=this.conversations.map(n=>n.id).filter(Boolean);return this.sendWsMessage({type:"get_agents",requestId:e,conversationIds:t.length>0?t:void 0})?(setTimeout(()=>{this.yeaftSessionHydrateRequestId===e&&(this.yeaftSessionHydrateRequestId=null,this.yeaftSessionHydrateSlices=[],this.yeaftSessionHydrateError="session_inventory_timeout",this.yeaftSessionInventoryCompleteSupported!==!0&&(this._yeaftSessionInventorySocketQuarantined=!0))},Vm),e):(this.yeaftSessionHydrateRequestId=null,this.yeaftSessionHydrateSlices=[],this.yeaftSessionHydrateError="session_inventory_send_failed",null)},beginYeaftHistoryLoad(e){let t=Pl(this,e);if(!t)return null;let{agentId:s,sessionId:n}=e||{};return setTimeout(()=>{_l(this,{agentId:s,sessionId:n,requestId:t.requestId,error:"history_load_timeout"})},Ml),t},finishYeaftHistoryLoad(e,t={}){return Rl(this,e,t)},isCurrentYeaftHistoryResponse(e){return Yr(this,e)},syncActiveYeaftHistoryLoad(){return ln(this)},enterYeaft(e=null){let t=this.currentAgent,s=e||this.currentAgent||null;if(!s){let i=this.agents.find(r=>r.online);i&&(s=i.id)}if(s&&this.currentAgent!==s){this.selectAgent(s),this.currentAgent=s;let i=this.agents.find(r=>r.id===s);i&&(this.currentAgentInfo=i)}if(!this.applyCachedYeaftStatus(s)&&t&&t!==s&&(this.yeaftAvailableModels=[],this.yeaftStatus=null,this.yeaftModelsRefreshing=!0,this.yeaftModelRefreshError=null),s){let i=this.yeaftConversationIdsByAgent?.[s]||null;i||(i=`yeaft-local-${s}-${Date.now()}`,this.yeaftConversationIdsByAgent={...this.yeaftConversationIdsByAgent||{},[s]:i}),this.yeaftConversationId=i}else this.yeaftConversationId||(this.yeaftConversationId=`yeaft-local-${Date.now()}`);this.messagesMap[this.yeaftConversationId]||(this.messagesMap[this.yeaftConversationId]=[]),Lc(this),this.currentView="yeaft",io("yeaft"),this.hasMoreMessages=!1,this.loadingMoreMessages=!1,this.yeaftHasMoreHistory=!1,this.yeaftLoadingMoreHistory=!1,this.yeaftOldestLoadedSeq=null,this._yeaftReconnectCatchUpPending=!1,this.loadOpenedYeaftSessionsForConnectedAgents(null,{force:!0}),this.requestYeaftSessionBootstrap({forceSessionReady:!0,catchUpHistory:!0,forceHistoryReplay:!0})},loadOpenedYeaftSessionsForConnectedAgents(e=null,{force:t=!1}={}){let s=Array.isArray(e)?e.filter(Boolean):Array.isArray(this.agents)?this.agents.filter(r=>r&&r.online&&r.id).map(r=>r.id):[],n=[...new Set(s)];(!this._yeaftOpenedSessionsLoadedAgents||typeof this._yeaftOpenedSessionsLoadedAgents!="object")&&(this._yeaftOpenedSessionsLoadedAgents={});let i=[];for(let r of n)!t&&this._yeaftOpenedSessionsLoadedAgents[r]||(this._yeaftOpenedSessionsLoadedAgents[r]=Date.now(),i.push(r),this.sessionCrudRequest("list",{},{agentId:r}).catch(o=>{delete this._yeaftOpenedSessionsLoadedAgents[r]}));return i},requestYeaftSessionBootstrap({forceSessionReady:e=!1,catchUpHistory:t=!1,forceHistoryReplay:s=!1}={}){if(!this.currentAgent)return;let n=Ps(this),i=n?Ie(this,n):this.currentAgent,r=Le(i,n),o=n?this.yeaftSessionHistoryState[r]:null,a=e||!this.yeaftSessionReady||!this.yeaftModel||!this.yeaftStatus,l=Number.isFinite(o?.latestSeq)?o.latestSeq:null,c=!!n&&!!this.yeaftConversationId&&Array.isArray(this.messagesMap?.[this.yeaftConversationId])&&this.messagesMap[this.yeaftConversationId].some(w=>w&&(w.sessionId??w.groupId??null)===n),d=!!n&&Br({sessionState:o,hasCachedSessionRows:c,force:!!s}),u=!!n&&!d&&bl(o,t);if(!a&&!d&&!u)return!1;let p=`${i}:${n||"__none__"}`,f=a&&!d&&!u;if(f&&this.yeaftBootstrapMetaLoadingKey===p)return!1;f&&(this.yeaftBootstrapMetaLoadingKey=p);let g=null;n&&d?g=this.beginYeaftHistoryLoad({agentId:i,sessionId:n,mode:"recent",preserveLoaded:!1}):n&&c&&!o?.loaded?(this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[r]:{...o||{},loaded:!0,loading:!1,hasMore:!!o?.hasMore,oldestSeq:Number.isFinite(o?.oldestSeq)?o.oldestSeq:null,count:o?.count||0,latestSeq:l}},this.yeaftLoadingMoreHistory=!1):n&&u&&(g=this.beginYeaftHistoryLoad({agentId:i,sessionId:n,mode:"delta",preserveLoaded:!0,latestSeq:l}));let v={type:"yeaft_load_history",agentId:i,sessionId:n,...g?{requestId:g.requestId}:{}};u?v.afterSeq=l:v.limit=d?pi:0;let m=on();v.perfTraceId=m;let A=u?"delta":d?"recent":"metadata";return n&&(this.yeaftHistoryPerfTraceBySession={...this.yeaftHistoryPerfTraceBySession||{},[r]:m}),Xe(this,{traceId:m,phase:"history.request_send",agentId:i,sessionId:n,messageType:v.type,bytes:JSON.stringify(v).length,detail:{mode:A,limit:v.limit??null,afterSeq:v.afterSeq??null,hasCachedSessionRows:c,needSessionReady:a}}),this.sendWsMessage(v),!0},leaveYeaft(){this.activateChatView({persistPreference:!0})},fetchYeaftToolStats(){this.currentAgent&&(this.yeaftToolStatsLoading=!0,this.sendWsMessage({type:"yeaft_fetch_tool_stats",agentId:this.currentAgent}),this._fetchYeaftToolStatsTimer&&clearTimeout(this._fetchYeaftToolStatsTimer),this._fetchYeaftToolStatsTimer=setTimeout(()=>{this.yeaftToolStatsLoading&&(this.yeaftToolStatsLoading=!1,this.yeaftToolStats={...this.yeaftToolStats||{snapshot:{},registered:[],unused:[]},error:null,notice:"Tool stats are unavailable right now. Try again after the agent reconnects.",fetchedAt:Date.now()}),this._fetchYeaftToolStatsTimer=null},1e4))},loadYeaftDebugHistory({groupId:e,limit:t,dreamLimit:s,indexOnly:n=!1,detailTurnId:i=null,search:r=void 0}={}){if(!this.currentAgent)return;let o=typeof r=="string"?r.trim():(this.yeaftDebugSearch||"").trim(),a=typeof i=="string"&&i,l=o&&!a?yd:ko,c=Number.isFinite(t)&&t>0?t:this.yeaftDebugHistoryLimit||l,d=Math.max(1,Math.min(l,c)),u=a?"detail":"list",p=`dbg_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`,f=JSON.stringify({agentId:this.currentAgent,groupId:e||null,limit:d,dreamLimit:Number.isFinite(s)&&s>0?s:5,indexOnly:!!n,detailTurnId:i||null,search:a?"":o});if(this._yeaftDebugHistoryInFlightKey===f)return;this._yeaftDebugHistoryInFlightKey=f,a||(this._yeaftDebugHistoryLatestListRequestId=p),this.yeaftDebugHistoryLimit=d,this.yeaftDebugHistoryLoading=!0,this.yeaftDebugHistoryError=null;let g={type:"yeaft_fetch_debug_history",agentId:this.currentAgent,requestId:p,requestKind:u,limit:d,dreamLimit:Number.isFinite(s)&&s>0?s:5};n&&(g.indexOnly=!0),typeof i=="string"&&i?g.detailTurnId=i:o&&(g.search=o),typeof e=="string"&&e&&(g.sessionId=e),this.sendWsMessage(g),this._fetchYeaftDebugHistoryTimer&&clearTimeout(this._fetchYeaftDebugHistoryTimer),this._fetchYeaftDebugHistoryTimer=setTimeout(()=>{this.yeaftDebugHistoryLoading&&(this.yeaftDebugHistoryLoading=!1,this.yeaftDebugHistoryError="Debug history is unavailable right now. Try again after the agent reconnects."),this._yeaftDebugHistoryInFlightKey=null,this._fetchYeaftDebugHistoryTimer=null},1e4)},agentIdForSession(e){return Ie(this,e)},sendYeaftSessionMessage({groupId:e,text:t,mentions:s,attachments:n,quote:i}){let r=Ie(this,e);if(!e||!r)return;let o=Array.isArray(n)?n.filter(g=>g&&g.fileId):[],a=ai(i),l=o.length>0;if(!t?.trim()&&!l)return;let c=t?.trim()?t:"(attached files)",d=`u_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`,u=on();this.yeaftPerfTraceByMessageId={...this.yeaftPerfTraceByMessageId||{},[d]:u},Xe(this,{traceId:u,phase:"send.prepare",agentId:r,sessionId:e,turnId:d,messageType:"yeaft_session_send",detail:{mentionCount:Array.isArray(s)?s.length:0,attachmentCount:o.length,quoted:!!a}});let p=Ct(this,e);if(p){let g={id:d,messageId:d,clientMessageId:d,type:"user",content:c,sessionId:e,turnId:d,...a?{quote:a}:{}};if(o.length>0&&(g.attachments=o.map(v=>({fileId:v.fileId,name:v.name,preview:v.preview,isImage:!!v.isImage,mimeType:v.mimeType||""}))),this.addMessageToConversation(p,g),this.processingConversations[p]=!0,e){let v=Ht(r,e);this.yeaftProcessingSessions={...this.yeaftProcessingSessions,...v?{[v]:!0}:{}}}this._turnCompletedConvs?.delete(p),this._closedAt?.[p]&&delete this._closedAt[p],this.getOrCreateExecutionStatus(p),Jn(this,p)}let f={type:"yeaft_session_send",agentId:r,id:d,sessionId:e,text:c,mentions:Array.isArray(s)?s:[],perfTraceId:u,...a?{quote:a}:{}};o.length>0&&(f.attachments=o.map(g=>({fileId:g.fileId,isImage:!!g.isImage}))),Xe(this,{traceId:u,phase:"send.websocket_send",agentId:r,sessionId:e,turnId:d,messageType:f.type,bytes:JSON.stringify(f).length}),this.sendWsMessage(f)},cancelYeaftTask({sessionId:e,taskId:t}){let s=typeof e=="string"?e.trim():"",n=typeof t=="string"?t.trim():"",i=Ie(this,s);return!i||!s||!n?!1:(this.yeaftStoppingTasksById={...this.yeaftStoppingTasksById,[bo(s,n)]:!0},this.sendWsMessage({type:"yeaft_task_cancel",agentId:i,sessionId:s,taskId:n,clientRequestId:`task_cancel_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}),!0)},getYeaftMessageWindowKey(e=null){return e||this.yeaftActiveSessionFilter||"__all__"},pruneYeaftMessageWindow(e=null){if(this.currentView!=="yeaft")return;let t=this.getYeaftMessageWindowKey(e);this.yeaftMessageWindowState={...this.yeaftMessageWindowState,[t]:{visibleTurns:ts()}}},expandYeaftMessageWindow(e=null,t=fn()){if(this.currentView!=="yeaft")return;let s=this.getYeaftMessageWindowKey(e),i=(this.yeaftMessageWindowState[s]?.visibleTurns||ts())+Math.max(1,Number.isFinite(t)?Math.floor(t):fn());this.yeaftMessageWindowState={...this.yeaftMessageWindowState,[s]:{visibleTurns:i}}},isYeaftMessageCached(e,t,s=null){let n=e||this.yeaftActiveSessionFilter||null,i=s||Ct(this,n);return!i||!t?!1:(this.messagesMap[i]||[]).some(r=>(!n||(r?.sessionId??r?.groupId??null)===n)&&((r?.id||r?.messageId)===t||r?.persistedMessageId===t))},revealYeaftMessage(e,t,s=null){let n=e||this.yeaftActiveSessionFilter||null,i=s||Ct(this,n);if(!i||!t)return!1;let r=(this.messagesMap[i]||[]).filter(u=>n?(u?.sessionId??u?.groupId??null)===n:!0),o=r.findIndex(u=>(u?.id||u?.messageId)===t||u?.persistedMessageId===t);if(o<0)return!1;let a=nd(r),l=a.findIndex(u=>o>=u.start&&o<u.end);if(l<0)return!1;let c=Math.max(ts(),a.length-l),d=this.getYeaftMessageWindowKey(n);return this.yeaftMessageWindowState={...this.yeaftMessageWindowState,[d]:{visibleTurns:c}},!0},getYeaftHistoryOutlineState(e=null,t=null){let s=e||this.yeaftActiveSessionFilter||null,n=Ie(this,s,t),i=Le(n,s),r=this.yeaftHistoryOutlineBySession[i]||{requestId:null,agentId:n,sessionId:s,loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,totalCount:null,loaded:!1,error:null},o=Ct(this,s),a=o?this.messagesMap[o]||[]:[],l=new Map((r.results||[]).map(p=>[mn(p),p])),c=0;for(let p of a){if((p?.sessionId??p?.groupId??null)!==s)continue;let f=p.messageId||p.id;if(!f)continue;let g=p.type==="user"&&!!p.clientMessageId&&f===p.clientMessageId,v=p.type==="assistant"&&p.isStreaming===!0;if(!g&&!v)continue;let m=p.type,A=p.turnId||p.threadId||f,w=p.speakerVpId||p.vpId||null,k=mn({role:m,messageId:f,clientMessageId:p.clientMessageId,turnId:A,speakerVpId:w}),y=l.get(k),b=(typeof p.content=="string"?p.content:"").replace(/\s+/g," ").trim();l.set(k,{...y,messageId:Number.isFinite(y?.seq)?y.messageId:f,...p.clientMessageId?{clientMessageId:p.clientMessageId}:{},turnId:A,role:m,speakerVpId:w||y?.speakerVpId||null,timestamp:p.timestamp||p.ts||y?.timestamp||null,snippet:b.length>180?`${b.slice(0,180).trimEnd()}\u2026`:b||y?.snippet||""}),y||(c+=1)}let d=p=>{let f=typeof p=="number"?p:Date.parse(p||"");return Number.isFinite(f)?f:0},u=Array.from(l.values()).sort((p,f)=>Number.isFinite(p.seq)&&Number.isFinite(f.seq)?p.seq-f.seq:d(p.timestamp)-d(f.timestamp));return{...r,results:u,totalCount:Number.isFinite(r.totalCount)?r.totalCount+c:r.totalCount}},promoteYeaftHistoryOutlineRow(e){let t=e?.sessionId??e?.groupId??null,s=Ie(this,t),n=Le(s,t),i=this.yeaftHistoryOutlineBySession[n];if(!t||!s||!i?.loaded||i.loading)return!1;let r=e?.type;if(r!=="user"&&r!=="assistant")return!1;let o=e.dbMessageId||e.messageId||e.id||null,a=Um(o);if(!o||!Number.isFinite(a))return!1;let l=e.turnId||e.threadId||o,c=e.speakerVpId||e.vpId||null,u=(typeof e.content=="string"?e.content:"").replace(/\s+/g," ").trim(),p=mn({role:r,messageId:o,clientMessageId:e.clientMessageId,turnId:l,speakerVpId:c}),f=new Map((i.results||[]).map(k=>[mn(k),k])),g=f.get(p);f.set(p,{...g,messageId:o,...e.clientMessageId?{clientMessageId:e.clientMessageId}:{},turnId:l,seq:a,role:r,speakerVpId:c,timestamp:e.timestamp||e.ts||g?.timestamp||null,snippet:u.length>180?`${u.slice(0,180).trimEnd()}\u2026`:u||g?.snippet||""});let v=50,m=Array.from(f.values()).sort((k,y)=>(k.seq||0)-(y.seq||0)),A=m.length>v,w=m.slice(-v);return this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[n]:{...i,results:w,hasMore:i.hasMore||A,nextBeforeSeq:A&&Number.isFinite(w[0]?.seq)?w[0].seq:i.nextBeforeSeq,totalCount:Number.isFinite(i.totalCount)&&!g?i.totalCount+1:i.totalCount}},!0},promoteCompletedYeaftHistoryOutline(e,t=null){let s=this.messagesMap[e]||[],n=null,i=[];for(let r=s.length-1;r>=0;r--){let o=s[r];if(o?.type==="user")break;if(t&&o?.turnId&&o.turnId!==t||o?.type!=="assistant")continue;let a=typeof o.content=="string"?o.content.replace(/\s+/g," ").trim():"";n?!String(n.content||"").trim()&&a&&(n=o):n=o,a&&i.unshift(a)}return n?this.promoteYeaftHistoryOutlineRow({...n,content:i.join(" ")}):!1},invalidateYeaftHistoryOutline(e){let t=Ie(this,e),s=Le(t,e),n=this.yeaftHistoryOutlineBySession[s];return!e||!t||!n?!1:n.loading?(this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[s]:{...n,refreshPending:!0}},!0):(this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[s]:{...n,loaded:!1,refreshPending:!1}},this.currentView==="yeaft"&&this.yeaftActiveSessionFilter===e?this.loadYeaftHistoryOutline({force:!0}):!0)},loadYeaftHistoryOutline({append:e=!1,force:t=!1,targetSessionId:s=null,targetAgentId:n=null}={}){if(this.currentView!=="yeaft"&&!s)return!1;let i=s||this.yeaftActiveSessionFilter||null,r=n||Ie(this,i);if(!i||!r)return!1;let o=Le(r,i),a=this.getYeaftHistoryOutlineState(i,r);if(!e&&a.loaded&&!t)return!0;if(e&&(!a.hasMore||!Number.isFinite(a.nextBeforeSeq))||a.loading)return!1;if(!md(this,r,"session_history_outline"))return this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[o]:{...a,error:"unsupported",loading:!1}},!1;let l=`history_outline_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,c={...a,requestId:l,agentId:r,sessionId:i,loading:!0,requestAppend:e,refreshPending:!1,error:null};this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[o]:c};let d=this._yeaftHistoryOutlineTimeouts[o];d&&clearTimeout(d);let u=setTimeout(()=>{let p=this.yeaftHistoryOutlineBySession[o];if(p?.requestId!==l)return;let f={...this._yeaftHistoryOutlineTimeouts};delete f[o],this._yeaftHistoryOutlineTimeouts=f;let g=p.refreshPending===!0;this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[o]:{...p,requestId:null,loading:!1,requestAppend:!1,loaded:g?!1:p.loaded,refreshPending:!1,error:g?null:"timeout"}},g&&this.loadYeaftHistoryOutline({force:!0,targetSessionId:i,targetAgentId:r})},1e4);return this._yeaftHistoryOutlineTimeouts={...this._yeaftHistoryOutlineTimeouts,[o]:u},this.sendWsMessage({type:"yeaft_load_history_outline",agentId:r,sessionId:i,requestId:l,limit:50,...e&&Number.isFinite(a.nextBeforeSeq)?{beforeSeq:a.nextBeforeSeq}:{},includeTotal:!a.loaded}),!0},handleYeaftHistoryOutline(e){if(!e?.agentId||!e?.sessionId)return!1;let t=Le(e.agentId,e.sessionId),s=this.yeaftHistoryOutlineBySession[t];if(!s||e.requestId!==s.requestId)return!1;let n=this._yeaftHistoryOutlineTimeouts[t];n&&clearTimeout(n);let i={...this._yeaftHistoryOutlineTimeouts};delete i[t],this._yeaftHistoryOutlineTimeouts=i;let r=Array.isArray(e.results)?e.results:[],o=s.requestAppend?[...s.results||[],...r]:r,a=new Map(o.filter(d=>d?.messageId).map(d=>[mn(d),d])),l=Array.from(a.values()).sort((d,u)=>(d.seq||0)-(u.seq||0)),c=s.refreshPending===!0;return this.yeaftHistoryOutlineBySession={...this.yeaftHistoryOutlineBySession,[t]:{...s,requestId:null,loading:!1,requestAppend:!1,refreshPending:!1,loaded:c?!1:!e.error,results:l,hasMore:!!e.hasMore,nextBeforeSeq:Number.isFinite(e.nextBeforeSeq)?e.nextBeforeSeq:null,totalCount:Number.isFinite(e.totalCount)?e.totalCount:s.totalCount,error:c?null:e.error||null}},c&&this.loadYeaftHistoryOutline({force:!0,targetSessionId:e.sessionId,targetAgentId:e.agentId}),!0},searchYeaftHistory(e,{append:t=!1,senderKey:s=""}={}){if(this.currentView!=="yeaft")return!1;let n=typeof e=="string"?e.trim():"",i=typeof s=="string"&&(s==="user"||s.startsWith("vp:"))?s.slice(0,103):"",r=this.yeaftActiveSessionFilter||null,o=Ie(this,r);if(this._yeaftHistorySearchTimeout&&(clearTimeout(this._yeaftHistorySearchTimeout),this._yeaftHistorySearchTimeout=null),!r||!o||n.length<2&&!i)return this.yeaftHistorySearchState={requestId:null,agentId:o,sessionId:r,query:n,senderKey:i,loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:null},!1;let a=this.yeaftHistorySearchState||{};if(!md(this,o,"session_history_search"))return this.yeaftHistorySearchState={requestId:null,agentId:o,sessionId:r,query:n,senderKey:i,loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:"unsupported"},!1;let l=`history_search_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return this.yeaftHistorySearchState={requestId:l,agentId:o,sessionId:r,query:n,senderKey:i,loading:!0,results:t&&a.query===n&&a.senderKey===i?a.results:[],hasMore:!1,nextBeforeSeq:t&&a.query===n&&a.senderKey===i?a.nextBeforeSeq:null,error:null},this._yeaftHistorySearchTimeout=setTimeout(()=>{this.yeaftHistorySearchState?.requestId===l&&(this._yeaftHistorySearchTimeout=null,this.yeaftHistorySearchState={...this.yeaftHistorySearchState,loading:!1,error:"timeout"})},1e4),this.sendWsMessage({type:"yeaft_search_history",agentId:o,sessionId:r,requestId:l,query:n,senderKey:i,limit:20,...t&&a.query===n&&a.senderKey===i&&Number.isFinite(a.nextBeforeSeq)?{beforeSeq:a.nextBeforeSeq}:{}}),!0},handleYeaftHistorySearchResult(e){let t=this.yeaftHistorySearchState||{};if(!e||e.requestId!==t.requestId||e.agentId!==t.agentId||e.sessionId!==t.sessionId||e.query!==t.query||(e.senderKey||"")!==t.senderKey)return!1;this._yeaftHistorySearchTimeout&&(clearTimeout(this._yeaftHistorySearchTimeout),this._yeaftHistorySearchTimeout=null);let s=Array.isArray(e.results)?e.results:[],n=new Map((t.results||[]).map(i=>[i.messageId,i]));for(let i of s)i?.messageId&&n.set(i.messageId,i);return this.yeaftHistorySearchState={...t,loading:!1,results:Array.from(n.values()),hasMore:!!e.hasMore,nextBeforeSeq:Number.isFinite(e.nextBeforeSeq)?e.nextBeforeSeq:null,error:e.error||null},!0},loadYeaftHistoryWindow(e){let t=this.yeaftActiveSessionFilter||null,s=Ie(this,t);if(!t||!s||!e?.messageId||!Number.isFinite(e.seq))return Promise.resolve(!1);if(this.isYeaftMessageCached(t,e.messageId))return Promise.resolve(!0);let n=Le(s,`${t}:${e.messageId}`),i=this._yeaftHistoryWindowPendingByKey||{};if(i[n]?.promise)return i[n].promise;let r=`history_window_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,o=null,a=new Promise(c=>{o=c}),l=setTimeout(()=>{if(this._yeaftHistoryWindowPendingByKey?.[n]?.requestId!==r)return;let{[n]:d,...u}=this._yeaftHistoryWindowPendingByKey;this._yeaftHistoryWindowPendingByKey=u,o(!1)},1e4);return this._yeaftHistoryWindowPendingByKey={...i,[n]:{requestId:r,agentId:s,sessionId:t,messageId:e.messageId,resolve:o,timeout:l,promise:a}},this.sendWsMessage({type:"yeaft_load_history_window",agentId:s,sessionId:t,requestId:r,anchorMessageId:e.messageId,anchorSeq:e.seq,beforeTurns:5,afterTurns:5}),a},async revealYeaftHistoryResult(e){let t=this.yeaftActiveSessionFilter||null,s=Ie(this,t),n=Ct(this,t);return!t||!s||!n||!e?.messageId||!await this.loadYeaftHistoryWindow(e)||this.currentView!=="yeaft"||this.yeaftActiveSessionFilter!==t||Ie(this,t)!==s||Ct(this,t)!==n?!1:this.revealYeaftMessage(t,e.messageId,n)},handleYeaftHistoryWindow(e,t=null){let n=Object.entries(this._yeaftHistoryWindowPendingByKey||{}).find(([,c])=>c?.requestId===e?.requestId);if(!n)return!1;let[i,r]=n;if(e.agentId!==r.agentId||e.sessionId!==r.sessionId)return!1;clearTimeout(r.timeout);let{[i]:o,...a}=this._yeaftHistoryWindowPendingByKey;this._yeaftHistoryWindowPendingByKey=a;let l=!e.error&&!!t&&this.isYeaftMessageCached(r.sessionId,r.messageId,t);return r.resolve(!!l),!!l},createYeaftSession({displayName:e,vpIds:t,defaultVpId:s,workDir:n,agentId:i}={}){let r=Array.isArray(t)?t.slice():[],o=s&&r.includes(s)?s:r[0]||null,a=(e||"").trim(),l=(n||"").trim(),c={roster:r,defaultVpId:o};return a&&(c.name=a),l&&(c.workDir=l),this.sessionCrudRequest("create",c,{agentId:i})},handleYeaftOutput(e){if(!e)return;if(e.perfTraceId&&(Xe(this,{traceId:e.perfTraceId,phase:"receive.yeaft_output",agentId:e.agentId||null,sessionId:e.sessionId||null,vpId:e.vpId||null,turnId:e.turnId||null,threadId:e.threadId||null,messageType:e.data?.type||e.event?.type||e.type}),e.turnId&&(this.yeaftPerfTraceByTurnId={...this.yeaftPerfTraceByTurnId||{},[e.turnId]:e.perfTraceId})),e.data){let s=e.turnId?gn(this,e.agentId||null,e.turnId):"";if(s&&this.activeVpTurns?.[s]?.retryAttempt){let{retryAttempt:i,retryMax:r,retryDelayMs:o,retryReason:a,retryRecoveryMode:l,...c}=this.activeVpTurns[s];this.activeVpTurns={...this.activeVpTurns,[s]:c}}let n=e.conversationId||this.yeaftConversationId;if(n){let i=e.agentId||this.yeaftAgentId||this.currentAgent||null,r=e.sessionId??e.groupId??null,o=hd(this,r,i),a=i&&this.yeaftConversationIdsByAgent?this.yeaftConversationIdsByAgent[i]:null,l=!o&&a===this.yeaftConversationId;if(this.currentView==="yeaft"&&i&&a&&a!==n){let g=this.messagesMap[a]||[],v=this.messagesMap[n]||[];this.messagesMap[n]=nn(v,g).sort((m,A)=>(m.timestamp||0)-(A.timestamp||0)),!l&&String(a).startsWith("yeaft-local-")&&delete this.messagesMap[a]}i&&(this.yeaftConversationIdsByAgent={...this.yeaftConversationIdsByAgent||{},[i]:n}),(o||!this.yeaftConversationId)&&(this.yeaftConversationId=n),o&&(this.activeConversations=[n]),this.messagesMap[n]||(this.messagesMap[n]=[]),this.currentView==="yeaft"&&(e.data?.type==="user"||e.data?.type==="text_delta")&&this.pruneYeaftMessageWindow(this.yeaftActiveSessionFilter&&e.sessionId||null);let c=this._currentYeaftAgentId,d=this._currentYeaftSessionId,u=this._currentYeaftVpId,p=this._currentYeaftTurnId,f=this._currentYeaftThreadId;i&&(this._currentYeaftAgentId=i),r!=null&&(this._currentYeaftSessionId=r),e.vpId&&(this._currentYeaftVpId=e.vpId),e.turnId&&(this._currentYeaftTurnId=e.turnId),e.threadId&&(this._currentYeaftThreadId=e.threadId);try{this.currentView==="yeaft"&&r&&(!this.yeaftActiveSessionFilter||r===this.yeaftActiveSessionFilter)&&this.pruneYeaftMessageWindow(this.yeaftActiveSessionFilter?r:null);let v=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now();if(this.handleAssistantOutputFrame(n,e.data),e.perfTraceId){let b=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now();Xe(this,{traceId:e.perfTraceId,phase:"store.apply_output",agentId:e.agentId||null,sessionId:r||null,vpId:e.vpId||null,turnId:e.turnId||null,threadId:e.threadId||null,messageType:e.data?.type||null,durationMs:b-v}),ti(this,{traceId:e.perfTraceId,agentId:e.agentId||null,sessionId:r||null,vpId:e.vpId||null,turnId:e.turnId||null,threadId:e.threadId||null,messageType:e.data?.type||null})}let m=e.data,A=m?.message?.id||m?.id||null,w=Wm(A),k=Array.isArray(m?.message?.content)?m.message.content:[],y=k.some(b=>b?.type==="tool_use"),h=!!m?.tool_use_result||k.some(b=>b?.type==="tool_result");if(r){let b=!h&&!Bm(this,n,r)&&(m?.type==="user"||m?.type==="assistant"&&!y)?w:null,R=Le(e.agentId||null,r),L=this.yeaftSessionHistoryState[R]||{},U=Number.isFinite(L.latestSeq)?L.latestSeq:-1;b!==null&&b>U&&(this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[R]:{...L,latestSeq:b}})}}finally{this._currentYeaftAgentId=c,this._currentYeaftSessionId=d,this._currentYeaftVpId=u,this._currentYeaftTurnId=p,this._currentYeaftThreadId=f}}return}let t=e.event;if(t)switch(t.type){case"ask_user_question":{let s=e.conversationId||this.yeaftConversationId;if(!s||!t.requestId)break;let n=dd(e,t,s),i=()=>{let r=this.messagesMap[s]||[],o=pd(r,n,s);if(o){if(o.askAnswered||o.askExpired)return!0;o.toolName="AskUserQuestion",t.toolCallId&&!o.toolId&&(o.toolId=t.toolCallId),o.agentId=n.agentId||o.agentId||null,o.askRequestId=t.requestId,o.askQuestions=t.questions||[],o.askCreatedAt=t.createdAt||null,o.askExpiresAt=t.expiresAt||null,t.replay&&(o.askPending=!1,o.pendingAnswers=null,o.askSubmitGeneration=null),o.isHistory=!1;let c=fd(this,n);return c&&yo(o,c),this.messagesMap={...this.messagesMap,[s]:r.slice()},!0}if(!t.replay)return!1;let a={id:`ask-card-${t.requestId}`,type:"tool-use",toolName:"AskUserQuestion",toolId:t.toolCallId||null,toolInput:{questions:t.questions||[]},askRequestId:t.requestId,askQuestions:t.questions||[],askCreatedAt:t.createdAt||null,askExpiresAt:t.expiresAt||null,agentId:n.agentId,sessionId:n.sessionId,vpId:n.vpId,speakerVpId:n.vpId,turnId:n.turnId,threadId:n.threadId||"main",hasResult:!1,isHistory:!1,timestamp:t.createdAt||Date.now()},l=fd(this,n);return l&&yo(a,l),r.push(a),this.messagesMap={...this.messagesMap,[s]:r.slice()},!0};if(!i()){let r=0,o=setInterval(()=>{r+=1,(i()||r>=10)&&clearInterval(o)},200)}break}case"ask_user_answered":case"ask_user_expired":{let s=e.conversationId||this.yeaftConversationId;if(!s||!t.requestId)break;let n=this.messagesMap[s]||[],i=dd(e,t,s),r=pd(n,i,s);if(!r){Nm(this,i,t);break}yo(r,t),this.messagesMap={...this.messagesMap,[s]:n.slice()};break}case"session_ready":{let s=t.conversationId,n=e.agentId||this.currentAgent,i=n&&this.yeaftConversationIdsByAgent?this.yeaftConversationIdsByAgent[n]:null,r=this.yeaftConversationId?String(this.yeaftConversationId):"",o=r.startsWith("yeaft-local-")&&(!n||r.startsWith(`yeaft-local-${n}-`)||/^yeaft-local-\d/.test(r))?this.yeaftConversationId:null,a=i||o,l=t.sessionId||e.sessionId||null,c=hd(this,l,n),d=!c&&a===this.yeaftConversationId;if(a&&a!==s){let v=!d&&!!this._processingWatchdogs?.[a],m=this.messagesMap[a]||[],A=this.messagesMap[s]||[];this.messagesMap[s]=nn(A,m).sort((w,k)=>(w.timestamp||0)-(k.timestamp||0)),!d&&a.startsWith("yeaft-local-")&&delete this.messagesMap[a],this.processingConversations[a]&&(this.processingConversations[s]=!0,d||delete this.processingConversations[a]),this.executionStatusMap[a]&&(this.executionStatusMap[s]=this.executionStatusMap[a],d||delete this.executionStatusMap[a]),v&&(Ae(this,a),this.processingConversations[s]&&Jn(this,s))}else this.messagesMap[s]||(this.messagesMap[s]=[]);n&&(this.yeaftConversationIdsByAgent={...this.yeaftConversationIdsByAgent||{},[n]:s},this.cacheYeaftAgentStatus(n,t,{allowBootstrapCatalog:c})),c&&(this.yeaftModel=t.model,this.yeaftModelEffort=t.modelEffort||null,this.yeaftSessionReady=!0,this.yeaftBootstrapMetaLoadingKey=null,n?this.applyCachedYeaftStatus(n):this.yeaftAvailableModels=t.availableModels||[]);let u=Array.isArray(t.tasks)?t.tasks:[],p={};for(let[v,m]of Object.entries(this.yeaftActiveTasksBySession||{})){let A=Object.fromEntries(Object.entries(m||{}).filter(([,k])=>k?.id&&So.has(k.status))),w=wo(A);Object.keys(w).length>0&&(p[v]=w)}for(let v of u)!v?.id||!v.sessionId||v.status!=="running"||(p[v.sessionId]={...p[v.sessionId]||{},[v.id]:v});this.yeaftActiveTasksBySession=p,c&&(t.yeaftDir&&(this.yeaftYeaftDir=t.yeaftDir),this.yeaftStatus={skills:t.skills,mcpServers:t.mcpServers,tools:t.tools,multiVp:!!t.multiVp}),(c||!this.yeaftConversationId)&&(this.yeaftConversationId=s),c&&(this.activeConversations=[s]);let f=e.agentId||this.currentAgent||null,g=f||"__current__";this._yeaftVpSubscribedAgentKey!==g&&(this._yeaftVpSubscribedAgentKey=g,this.sendWsMessage(f?{type:"yeaft_vp_subscribe",agentId:f}:{type:"yeaft_vp_subscribe"}));break}case"yeaft_status":{let s=e.agentId||this.currentAgent;s&&this.cacheYeaftAgentStatus(s,t);break}case"context_usage":break;case"turn_open":{if(!t.turnId)break;let s={turnId:t.turnId,userPrompt:t.userPrompt||"",vpId:t.vpId||e.vpId||null,sessionId:t.sessionId||e.sessionId||null,openedAt:t.at||Date.now(),closedAt:null,totalMs:0,totalTokens:0,loopCount:0,memoryLoaded:null,memoryAdjust:null,tools:[],detailsLoaded:!0};this.yeaftDebugTurnsById={...this.yeaftDebugTurnsById,[t.turnId]:s},this.yeaftDebugTurnOrder.includes(t.turnId)||(this.yeaftDebugTurnOrder=[...this.yeaftDebugTurnOrder,t.turnId]);break}case"turn_close":{if(!t.turnId)break;let s=this.yeaftDebugTurnsById[t.turnId];if(!s)break;this.yeaftDebugTurnsById={...this.yeaftDebugTurnsById,[t.turnId]:{...s,closedAt:Date.now(),totalMs:t.totalMs||0,totalTokens:t.totalTokens||0,loopCount:t.loopCount||s.loopCount||0}};break}case"memory_used":{if(!t.turnId)break;let s=this.yeaftDebugTurnsById[t.turnId];if(!s)break;this.yeaftDebugTurnsById={...this.yeaftDebugTurnsById,[t.turnId]:{...s,memoryLoaded:Array.isArray(t.loaded)?t.loaded:[]}};break}case"dream_memory_loaded":{let s=Array.isArray(t.resident)?t.resident:[];if(t.turnId){let i=this.yeaftDebugTurnsById[t.turnId];i&&(this.yeaftDebugTurnsById={...this.yeaftDebugTurnsById,[t.turnId]:{...i,dreamMemoryLoaded:s,dreamMemoryLoadedInto:t.loadedInto||"system_prompt.memory"}})}let n={};for(let i of s){let r=i&&typeof i.scope=="string"?i.scope:null,o=r&&/^sessions\/[^/]+$/.test(r)?r:r&&/^group\/[^/]+$/.test(r)?`sessions/${r.slice(6)}`:null;o&&(n[o]={scope:o,sourceScope:r,sessionId:o.slice(9),turnId:t.turnId||null,vpId:t.vpId||null,loadedInto:t.loadedInto||"system_prompt.memory",summary:i.summary||"",truncated:!!i.truncated,receivedAt:Date.now()})}Object.keys(n).length>0&&(this.yeaftDreamPromptLoads={...this.yeaftDreamPromptLoads,...n});break}case"memory_adjust":{if(!t.turnId)break;let s=this.yeaftDebugTurnsById[t.turnId];if(!s)break;this.yeaftDebugTurnsById={...this.yeaftDebugTurnsById,[t.turnId]:{...s,memoryAdjust:{sessionKey:t.sessionKey||null,added:t.added||0,evicted:t.evicted||0,skipped:t.skipped||0,reason:t.reason||""}}};break}case"tool_exec":{if(!t.turnId)break;let s=this.yeaftDebugTurnsById[t.turnId];if(!s)break;let n=[...s.tools||[],{loopNumber:t.loopNumber||0,callId:t.callId||null,name:t.name||"?",durationMs:t.durationMs||0,isError:!!t.isError,toolOutput:t.toolOutput==null?null:String(t.toolOutput)}];this.yeaftDebugTurnsById={...this.yeaftDebugTurnsById,[t.turnId]:{...s,tools:n}};break}case"loop":{if(this.yeaftDebugLoops.push({turnId:t.turnId||null,loopNumber:t.loopNumber||0,model:t.model,systemPrompt:t.systemPrompt,messages:t.messages,response:t.response,toolCalls:t.toolCalls,usage:t.usage||{inputTokens:0,outputTokens:0,totalTokens:0},latencyMs:t.latencyMs,ttfbMs:t.ttfbMs,stopReason:t.stopReason,at:typeof t.at=="number"?t.at:null,rawRequest:t.rawRequest||null,rawResponse:t.rawResponse||null,sessionId:e.sessionId||null,vpId:e.vpId||t.vpId||null}),this.yeaftDebugLoops.length>vd){let s=Nc({loops:this.yeaftDebugLoops,turnsById:this.yeaftDebugTurnsById,turnOrder:this.yeaftDebugTurnOrder,maxLoops:Math.max(vd,this.yeaftDebugHistoryLimit||0)});this.yeaftDebugLoops=s.loops,this.yeaftDebugTurnsById=s.turnsById,this.yeaftDebugTurnOrder=s.turnOrder}break}case"llm_retry":{if(!e.turnId)break;let s=gn(this,e.agentId||null,e.turnId),n=this.activeVpTurns?.[s];if(!n)break;let i=t.reason==="stream_idle_timeout"?"stream_idle_timeout":"transient_error";this.activeVpTurns={...this.activeVpTurns,[s]:{...n,retryAttempt:t.attempt||0,retryMax:t.maxRetries||0,retryDelayMs:t.delayMs||0,retryReason:i,retryRecoveryMode:t.recoveryMode||"restart"}};break}case"recall":case"consolidate":case"fallback":case"thinking_delta":break;case"reflection":{let s=e.conversationId||this.yeaftConversationId||"unknown",n=Array.isArray(t.loopRange)?t.loopRange:[0,0],i=`${s}:${t.trigger}:${n[0]}-${n[1]}`,r=this.yeaftReflectionCards[i],o=this.messagesMap[s]||[],a=r?r.anchorMsgId:o.length>0&&o[o.length-1].id||null,l=r?r.anchorOrder:o.length;this.yeaftReflectionCards={...this.yeaftReflectionCards,[i]:{key:i,conversationId:s,turnId:t.turnId||r&&r.turnId||null,loopNumber:t.loopNumber||r&&r.loopNumber||null,trigger:t.trigger,status:t.status,loopRange:n,toolCount:t.toolCount||0,content:t.content||"",durationMs:t.durationMs||0,error:t.error||null,sessionId:e.sessionId||null,anchorMsgId:a,anchorOrder:l,updatedAt:Date.now()}};break}case"model_switched":this.yeaftModel=t.model,this.yeaftModelEffort=t.modelEffort||null;break;case"yeaft_task_event":{let s=t.task;if(!s?.id||!s.sessionId)break;let n={...this.yeaftActiveTasksBySession},i={...n[s.sessionId]||{}};s.status==="running"||So.has(s.status)?i[s.id]=s:delete i[s.id];let r=wo(i);if(Object.keys(r).length>0?n[s.sessionId]=r:delete n[s.sessionId],this.yeaftActiveTasksBySession=n,s.status!=="running"){let{[bo(s.sessionId,s.id)]:o,...a}=this.yeaftStoppingTasksById||{};this.yeaftStoppingTasksById=a}break}case"yeaft_task_cancel_result":{let s=t.taskId||t.task?.id||null,n=t.task?.sessionId||t.sessionId||e.sessionId||null;if(s&&n&&t.success===!1){let{[bo(n,s)]:r,...o}=this.yeaftStoppingTasksById||{};this.yeaftStoppingTasksById=o}let i=t.task;if(i?.id&&i.sessionId){let r={...this.yeaftActiveTasksBySession},o={...r[i.sessionId]||{}};o[i.id]=i;let a=wo(o);Object.keys(a).length>0?r[i.sessionId]=a:delete r[i.sessionId],this.yeaftActiveTasksBySession=r}break}case"sub_agent_event":{let s=e.conversationId||this.yeaftConversationId||"unknown",n=t.agentId;if(!n)break;let i=t.payload||{},r=`${s}:${n}`,o=this.yeaftSubAgentCards[r],a=this.messagesMap[s]||[],l=o?o.anchorMsgId:a.length>0&&a[a.length-1].id||null,c=o?o.anchorOrder:a.length,d=o?{...o}:{key:r,conversationId:s,agentId:n,agentName:i.agentName||"sub-agent",status:"running",text:"",toolCallCount:0,turns:0,error:null,expanded:!1,anchorMsgId:l,anchorOrder:c,updatedAt:Date.now(),sessionId:e.sessionId||null};switch(i.agentName&&!d.agentName&&(d.agentName=i.agentName),i.type){case"sub_agent_status":d.status=i.status||d.status,i.error&&(d.error=i.error);break;case"text_delta":break;case"tool_use":case"tool_call":d.toolCallCount=Number(d.toolCallCount||0)+1;break;case"tool_start":break;case"tool_result":case"tool_end":break;case"sub_agent_turn_end":{d.turns+=1;let u=typeof i.content=="string"?i.content.trim():"";u&&(d.text=d.text?`${d.text}
9
9
 
10
- ${u}`:u),d.status!=="failed"&&d.status!=="closed"&&(d.status=i.status||"idle");break}case"error":i.error&&(d.error=i.error.message||String(i.error));break;default:break}d.updatedAt=Date.now(),this.yeaftSubAgentCards={...this.yeaftSubAgentCards,[r]:d};break}case"history_loaded":{let s={...t,agentId:e.agentId||null,requestId:t.requestId||e.requestId||null};if(s.requestId&&!this.isCurrentYeaftHistoryResponse(s))break;let n=e.agentId||null,i=t.sessionId??null,r=Le(n,i),o=e.perfTraceId||this.yeaftHistoryPerfTraceBySession?.[r];o&&Xe(this,{traceId:o,phase:"history.loaded_event",agentId:e.agentId||null,sessionId:t.sessionId||null,messageType:t.type,detail:{mode:t.mode||"recent",count:t.count||0,hasMore:!!t.hasMore}});let a=t.mode==="delta"?"delta":"recent",l=this.yeaftSessionHistoryState[r]||{},c=Number.isFinite(t.latestSeq)?t.latestSeq:Number.isFinite(l.latestSeq)?l.latestSeq:null,d=a==="delta"?{...l,loaded:!0,loading:!1,latestSeq:c,syncingAfterSeq:null,count:(l.count||0)+(t.count||0)}:{loaded:!0,loading:!1,hasMore:!!t.hasMore,oldestSeq:typeof t.oldestSeq=="number"?t.oldestSeq:null,count:typeof t.count=="number"?t.count:0,latestSeq:c,syncingAfterSeq:null};s.requestId&&this.finishYeaftHistoryLoad(s,d)||(this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[r]:d});let p=Le(n?this.currentAgent:null,this.yeaftActiveSessionFilter??null);if(r===p)a==="recent"&&(this.yeaftHasMoreHistory=d.hasMore,this.yeaftOldestLoadedSeq=d.oldestSeq),this.yeaftLoadingMoreHistory=!1;else if(this.yeaftLoadingMoreHistory){let f=this.yeaftSessionHistoryState[p]||null;this.yeaftLoadingMoreHistory=!!f?.loading}}break;case"vp_snapshot":{let s=window.Pinia?.useVpStore?.()||window.__useVpStore&&window.__useVpStore();s&&s.applySnapshot(t,e.agentId||null);break}case"vp_updated":{let s=window.Pinia?.useVpStore?.()||window.__useVpStore&&window.__useVpStore();s&&t.vp&&s.upsert(t.vp,t.reason);break}case"vp_removed":{let s=window.Pinia?.useVpStore?.()||window.__useVpStore&&window.__useVpStore();s&&t.vpId&&s.remove(t.vpId,t.reason);break}case"vp_crud_result":{let s=this._vpCrudPending&&this._vpCrudPending.get(t.requestId);s&&(this._vpCrudPending.delete(t.requestId),s.resolve({ok:!!t.ok,op:t.op,vpId:t.vpId,vp:t.vp,error:t.error||null}));break}case"group_list_updated":case"session_list_updated":case"yeaft_session_hydrate":{let s=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore(),n=t.sessions||[];if(t.type!=="yeaft_session_hydrate"&&this.yeaftSessionHydrateRequestId&&this.yeaftSessionInventoryCompleteSupported===!0){let o=Array.isArray(this.yeaftSessionHydrateSlices)?this.yeaftSessionHydrateSlices.filter(a=>a.agentId!==(e.agentId||null)):[];this.yeaftSessionHydrateSlices=[...o,{agentId:e.agentId||null,sessions:n}];break}let i=s&&s.activeSessionId||null;s&&(s.applySnapshot(n,e.agentId||null),this._hasHandledYeaftSessionHydrate=!0,this.yeaftSessionHydrateError=null);let r=s&&s.activeSessionId||null;if(this.currentView==="yeaft"&&r){let o=Ie(this,r,e.agentId||null),a=Le(o,r),l=this.yeaftSessionHistoryState[a]||null;this.setActiveSessionFilter(r,{agentId:o,force:yl(r,i,l)})}break}case"group_roster_changed":case"session_roster_changed":{let s=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();s&&s.applyRosterChange(t);break}case"group_crud_result":case"session_crud_result":{let s=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();s&&s.applyCrudResult(t,e.agentId||null);let n=this._sessionCrudPending&&this._sessionCrudPending.get(t.requestId);if(n){this._sessionCrudPending.delete(t.requestId);let i=t.session||t.group||null,r=i&&e.agentId&&!i.agentId?{...i,agentId:e.agentId}:i,o=t.sessionId||null,a=t.sessions||null;n.resolve({ok:!!t.ok,op:t.op,session:r,sessionId:o,sessions:a,config:t.config||null,error:t.error||null})}break}case"vp_turn_start":{if(!t.turnId||!t.vpId)break;let s=fo(e.agentId||null,t.turnId)||t.turnId;if(this.activeVpTurns={...this.activeVpTurns,[s]:{agentId:e.agentId||null,turnId:t.turnId,vpId:t.vpId,sessionId:t.sessionId||null,threadId:t.threadId||null,isStreaming:!0,startedAt:t.ts||Date.now()}},t.sessionId){let n=Ht(e.agentId||null,t.sessionId);this.yeaftProcessingSessions={...this.yeaftProcessingSessions,...n?{[n]:!0}:{[t.sessionId]:!0}}}break}case"vp_turn_end":{if(!t.turnId)break;let s=gn(this,e.agentId||null,t.turnId),n=t.sessionId||this.activeVpTurns?.[s]?.sessionId||null;t.reason==="end_turn"&&n&&this.markYeaftSessionUnread(n,e.agentId||null);let{[s]:i,...r}=this.activeVpTurns;this.activeVpTurns=r;let{[s]:o,...a}=this.stoppingVpTurnIds;this.stoppingVpTurnIds=a,this.clearYeaftSessionProcessingIfIdle(t.sessionId||i?.sessionId||null,{agentId:e.agentId||i?.agentId||null});let c={end_turn:"completed",route_forward:"completed",aborted:"aborted",errored:"errored",error:"errored",cancelled:"cancelled",canceled:"cancelled"}[t.reason]||"completed",d=Date.now(),u=e.conversationId||this.yeaftConversationId;if(u&&Array.isArray(this.messagesMap[u])){let p=this.messagesMap[u],f=td(p,t);for(let g=0;g<p.length;g++){let v=p[g];if(!v||v.type!=="assistant")continue;let m=v.sessionId??v.groupId;t.sessionId&&m&&m!==t.sessionId||t.vpId&&v.speakerVpId&&v.speakerVpId!==t.vpId||t.turnId&&v.turnId&&v.turnId!==t.turnId||v.status&&v.status!=="pending"||(v.status=c,v.turnEndAt=d,v.turnEndReason=t.reason||null,t.detail&&(v.turnEndDetail=t.detail),Number.isFinite(t.durationMs)&&(v.turnDurationMs=t.durationMs),f=!0)}f&&(this.messagesMap={...this.messagesMap,[u]:p.slice()})}break}case"yeaft_turn_aborted":{let s=Array.isArray(t.turnIds)?t.turnIds.filter(Boolean):[];t.turnId&&s.push(t.turnId);let n=t.sessionId||null,i=t.vpId||null,r=new Set;for(let c of s){let d=gn(this,e.agentId||null,c),u=this.activeVpTurns?.[d]||null;(!u||ut(u,u.sessionId,e.agentId||null))&&r.add(d)}if(i)for(let[c,d]of Object.entries(this.activeVpTurns||{}))!d||d.vpId!==i||ut(d,n,e.agentId||null)&&r.add(c);if(r.size===0)break;let o=n,a={...this.activeVpTurns||{}},l={...this.stoppingVpTurnIds||{}};for(let c of r){let d=a[c];!o&&d?.sessionId&&(o=d.sessionId),delete a[c],delete l[c]}this.activeVpTurns=a,this.stoppingVpTurnIds=l,this.clearYeaftSessionProcessingIfIdle(o||null,{agentId:e.agentId||null});break}case"yeaft_aborted":{let s=t.sessionId||e.sessionId||null;s?(this.activeVpTurns=Object.fromEntries(Object.entries(this.activeVpTurns||{}).filter(([,n])=>!ut(n,s,e.agentId||null))),this.stoppingVpTurnIds=Object.fromEntries(Object.entries(this.stoppingVpTurnIds||{}).filter(([n])=>this.activeVpTurns?.[n])),this.vpStatuses=Object.fromEntries(Object.entries(this.vpStatuses||{}).filter(([,n])=>!ut(n,s,e.agentId||null))),this.clearYeaftSessionProcessingIfIdle(s,{agentId:e.agentId||null,ignoreStatuses:!0})):t.all&&ld(this,e.agentId||null);break}case"vp_typing_start":{if(!t.vpId)break;let s=e.conversationId||this.yeaftConversationId;if(!s)break;this.yeaftVpTyping=Fc(this.yeaftVpTyping,s,t.vpId);break}case"vp_typing_end":{if(!t.vpId)break;let s=e.conversationId||this.yeaftConversationId;if(!s)break;this.yeaftVpTyping=Hc(this.yeaftVpTyping,s,t.vpId);break}case"vp_status_changed":{if(!t.vpId||!t.state)break;let s=t.sessionId||null,n=e.agentId||null,i=ui(n,s,t.vpId),r={agentId:n,state:t.state,since:t.since||Date.now(),turnId:t.turnId||null,title:t.title||"",sessionId:s,vpId:t.vpId};if(this.vpStatuses={...this.vpStatuses,[i]:r},s&&mi.has(t.state)){let o=Ht(n,s);this.yeaftProcessingSessions={...this.yeaftProcessingSessions,...o?{[o]:!0}:{[s]:!0}}}else s&&this.clearYeaftSessionProcessingIfIdle(s,{agentId:n});this.restoreActiveYeaftSessionFromStatuses([r],n);break}case"vp_status_snapshot":{let s=Array.isArray(t.statuses)?t.statuses:[],n=t.sessionId;if(n==null){let i={...this.vpStatuses||{}};if(e.agentId)for(let[r,o]of Object.entries(i))(!o?.agentId||o.agentId===e.agentId)&&delete i[r];else for(let r of Object.keys(i))delete i[r];for(let r of s){if(!r||!r.vpId)continue;let o=r.sessionId||r.groupId||null,a=ui(e.agentId||null,o,r.vpId);i[a]={agentId:e.agentId||null,state:r.state,since:r.since||Date.now(),turnId:r.turnId||null,title:r.title||"",sessionId:o,vpId:r.vpId}}this.vpStatuses=i}else{let i={...this.vpStatuses};for(let[r,o]of Object.entries(i))o&&o.sessionId===n&&(!e.agentId||!o.agentId||o.agentId===e.agentId)&&delete i[r];for(let r of s){if(!r||!r.vpId)continue;let o=r.sessionId||r.groupId||null,a=ui(e.agentId||null,o,r.vpId);i[a]={agentId:e.agentId||null,state:r.state,since:r.since||Date.now(),turnId:r.turnId||null,title:r.title||"",sessionId:o,vpId:r.vpId}}this.vpStatuses=i}this.yeaftProcessingSessions=$m(this,e.agentId||null,s,n??null),this.restoreActiveYeaftSessionFromStatuses(s,e.agentId||null);break}case"yeaft_dream_snapshot":{let s=t&&t.snapshot,n=s&&typeof s.scope=="string"?s.scope:null;n&&(this.yeaftDreamSnapshots={...this.yeaftDreamSnapshots,[n]:{...s,receivedAt:Date.now()}});break}case"yeaft_dream_status":{let s=window.Pinia?.useVpStore?.()||window.__useVpStore&&window.__useVpStore();s&&s.applyDreamStatus(t);break}case"yeaft_dream_result":{let s=window.Pinia?.useVpStore?.()||window.__useVpStore&&window.__useVpStore();s&&s.applyDreamResult(t),t?.snapshot?.scope&&(this.yeaftDreamSnapshots={...this.yeaftDreamSnapshots,[t.snapshot.scope]:{...t.snapshot,receivedAt:Date.now()}});{let n=typeof t?.snapshot?.scope=="string"&&t.snapshot.scope?t.snapshot.scope:typeof t?.sessionId=="string"&&t.sessionId?`sessions/${t.sessionId}`:null;if(!n)break;let i=this.yeaftDreamLatest[n]||null;this.yeaftDreamLatest={...this.yeaftDreamLatest,[n]:{scope:n,phase:"result",status:t.skipped?"skipped":t.success?"success":"error",startedAt:i?.startedAt??null,finishedAt:Date.now(),mergedCount:typeof t.entriesCreated=="number"?t.entriesCreated:i?.mergedCount??null,error:t.skipped||t.success?null:t.error||"unknown",manual:typeof t?.manual=="boolean"?t.manual:i?.manual??null,durationMs:typeof t.durationMs=="number"?t.durationMs:i?.durationMs??null,llmCallCount:typeof t.llmCallCount=="number"?t.llmCallCount:i?.llmCallCount??0,inputTokens:typeof t.inputTokens=="number"?t.inputTokens:i?.inputTokens??0,outputTokens:typeof t.outputTokens=="number"?t.outputTokens:i?.outputTokens??0,totalTokens:typeof t.totalTokens=="number"?t.totalTokens:i?.totalTokens??0,metrics:t.metrics||i?.metrics||null,passBreakdown:t.passBreakdown||t.metrics?.passBreakdown||i?.passBreakdown||null,isRunning:!1}},this._appendDreamEvent(n,{type:"dream_progress",phase:"result",sessionId:t.sessionId,status:t.skipped?"skipped":t.success?"success":"error",success:!!t.success,entriesCreated:typeof t.entriesCreated=="number"?t.entriesCreated:null,trigger:t.trigger||null,error:t.skipped||t.success?null:t.error||null,skipped:!!t.skipped,skippedReason:t.skippedReason||null,durationMs:typeof t.durationMs=="number"?t.durationMs:null,llmCallCount:typeof t.llmCallCount=="number"?t.llmCallCount:0,inputTokens:typeof t.inputTokens=="number"?t.inputTokens:0,outputTokens:typeof t.outputTokens=="number"?t.outputTokens:0,totalTokens:typeof t.totalTokens=="number"?t.totalTokens:0,metrics:t.metrics||null,passBreakdown:t.passBreakdown||t.metrics?.passBreakdown||null,ts:Date.now()})}break}case"dream_progress":{let s=t?.phase||"unknown",n=null;typeof t?.target=="string"&&t.target.includes("/")?n=t.target:typeof t?.sessionId=="string"&&t.sessionId?n=`sessions/${t.sessionId}`:n="*";let i=s==="done",r=s==="error"||t?.status==="error",o=!i&&!r,a=l=>{let c=this.yeaftDreamLatest[l]||null;return{scope:l,phase:s,status:r?"error":i?"success":"running",startedAt:c?.startedAt&&o?c.startedAt:t?.ts||c?.startedAt||Date.now(),finishedAt:i||r?t?.ts||Date.now():null,mergedCount:typeof t?.mergedCount=="number"?t.mergedCount:typeof t?.targets=="number"?t.targets:c?.mergedCount??null,error:r?t?.error||"unknown":null,manual:typeof t?.manual=="boolean"?t.manual:c?.manual??!1,durationMs:typeof t?.duration=="number"?t.duration:typeof t?.durationMs=="number"?t.durationMs:c?.durationMs??null,llmCallCount:typeof t?.llmCallCount=="number"?t.llmCallCount:c?.llmCallCount??0,inputTokens:typeof t?.inputTokens=="number"?t.inputTokens:c?.inputTokens??0,outputTokens:typeof t?.outputTokens=="number"?t.outputTokens:c?.outputTokens??0,totalTokens:typeof t?.totalTokens=="number"?t.totalTokens:c?.totalTokens??0,metrics:t?.metrics||c?.metrics||null,passBreakdown:t?.passBreakdown||t?.metrics?.passBreakdown||c?.passBreakdown||null,isRunning:o}};if(n==="*"){let l={...this.yeaftDreamLatest,"*":a("*")};for(let c of Object.keys(this.yeaftDreamLatest))c!=="*"&&(l[c]=a(c));this.yeaftDreamLatest=l}else this.yeaftDreamLatest={...this.yeaftDreamLatest,[n]:a(n)};this._appendDreamEvent(n,t);break}}},_appendDreamEvent(e,t){if(!e||!t)return;let s=Date.now(),n={...t,at:s},i=Array.isArray(this.yeaftDreamEvents?.[e])?this.yeaftDreamEvents[e]:[],r=l=>[l?.type||"",l?.phase||"",(l?.sessionId??l?.groupId)||"",l?.target||"",l?.ts||l?.at||""].join("|"),o=r(n);if(i.some(l=>r(l)===o))return;let a=[...i,n];a.length>bd&&a.splice(0,a.length-bd),this.yeaftDreamEvents={...this.yeaftDreamEvents,[e]:a}},fetchExpertRoleDefinitions(){if(this.expertRoleDefinitions)return;let e=this.currentAgent;e&&this.sendWsMessage({type:"get_expert_roles",agentId:e})},setYeaftSidebarEnabled(e){try{typeof localStorage<"u"&&localStorage.removeItem("yeaft-sidebar-enabled")}catch{}},vpCrudRequest(e,t){(!this._vpCrudPending||typeof this._vpCrudPending.get!="function")&&(this._vpCrudPending=new Map);let s="vpc_"+Date.now().toString(36)+"_"+Math.random().toString(36).slice(2,8),i={create:"yeaft_vp_create",update:"yeaft_vp_update",delete:"yeaft_vp_delete",read:"yeaft_vp_read"}[e];if(!i)return Promise.resolve({ok:!1,op:e,error:{code:"bad_op",message:"unknown op: "+e}});let r={type:i,requestId:s};return e==="create"||e==="update"?r.payload=t||{}:r.vpId=t,new Promise(o=>{let a=setTimeout(()=>{this._vpCrudPending&&this._vpCrudPending.has(s)&&(this._vpCrudPending.delete(s),o({ok:!1,op:e,error:{code:"timeout",message:"vp_crud timeout"}}))},1e4);this._vpCrudPending.set(s,{resolve:l=>{clearTimeout(a),o(l)}}),this.sendWsMessage(r)})},sessionCrudRequest(e,t,s={}){(!this._sessionCrudPending||typeof this._sessionCrudPending.get!="function")&&(this._sessionCrudPending=new Map);let n="grc_"+Date.now().toString(36)+"_"+Math.random().toString(36).slice(2,8),r={list:"yeaft_list_sessions",create:"yeaft_create_session",rename:"yeaft_rename_session",update:"yeaft_update_session",update_config:"yeaft_update_session_config",archive:"yeaft_archive_session",delete:"yeaft_delete_session",add_member:"yeaft_session_add_member",remove_member:"yeaft_session_remove_member",set_default_vp:"yeaft_session_set_default_vp",reorder:"reorder_yeaft_sessions",scan_workdir:"yeaft_scan_workdir_sessions",restore:"yeaft_restore_session"}[e];if(!r)return Promise.resolve({ok:!1,op:e,error:{code:"bad_op",message:"unknown op: "+e}});let o={type:r,requestId:n};e==="create"?o.payload=t||{}:t&&typeof t=="object"&&Object.assign(o,t);let a=s&&s.agentId?s.agentId:null;a&&(o.agentId=a);let l=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();return l&&l.markPending(n,e),new Promise(c=>{let d=setTimeout(()=>{this._sessionCrudPending&&this._sessionCrudPending.has(n)&&(this._sessionCrudPending.delete(n),c({ok:!1,op:e,error:{code:"timeout",message:"group_crud timeout"}}))},1e4);this._sessionCrudPending.set(n,{resolve:u=>{clearTimeout(d),c(u)}}),this.sendWsMessage(o)})},markYeaftSessionUnread(e,t=null){if(!e)return!1;let s=Ie(this,e,t);if(!s)return!1;let n=Gn(s,e);return this.currentView==="yeaft"&&this.yeaftActiveSessionFilter===e&&Ie(this,e)===s||this.yeaftUnreadSessionKeys?.[n]?!1:(this.yeaftUnreadSessionKeys={...this.yeaftUnreadSessionKeys,[n]:!0},!0)},markYeaftSessionRead(e,t=null){if(!e)return!1;let s=Ie(this,e,t);if(!s)return!1;let n=Gn(s,e);if(!this.yeaftUnreadSessionKeys?.[n])return!1;let{[n]:i,...r}=this.yeaftUnreadSessionKeys;return this.yeaftUnreadSessionKeys=r,!0},restoreActiveYeaftSessionFromStatuses(e=[],t=null){if(this.yeaftActiveSessionFilter)return null;let n=(Array.isArray(e)?e:[]).filter(o=>o&&(o.sessionId||o.groupId)&&!["idle","offline","completed","failed","aborted"].includes(o.state)).sort((o,a)=>(a.updatedAt||a.since||0)-(o.updatedAt||o.since||0)),i=n[0]?.sessionId||n[0]?.groupId||null;if(!i)return null;let r=t||n[0]?.agentId||wd(this,i);if(!r)return null;this.setActiveSessionFilter(i,{agentId:r,force:!0});try{let o=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();o&&typeof o.setActive=="function"&&o.setActive(i,r)}catch{}return i},setActiveSessionFilter(e,t={}){let s=this.yeaftActiveSessionFilter||null,n=e||null,i=n?Ie(this,n,t.agentId||null):this.currentAgent,r=!!n&&n===s&&!!i&&!!this.currentAgent&&i!==this.currentAgent,o=!!t.force||r;this.yeaftActiveSessionFilter=n;try{n?localStorage.setItem("lastViewedYeaftSession",n):localStorage.removeItem("lastViewedYeaftSession")}catch{}if(i&&n&&this.currentAgent!==i){this.selectAgent(i);let c=this.agents.find(d=>d.id===i);this.activateYeaftAgent(i,c||null)}else i&&n&&this.activateYeaftAgent(i);if(i&&n&&this.markYeaftSessionRead(n,i),!o&&n===s)return;let a=Le(i,n),l=this.yeaftSessionHistoryState[a]||null;if(this.pruneYeaftMessageWindow(n),i&&n){this.yeaftSessionAgentById={...this.yeaftSessionAgentById||{},[n]:i};let c=this.yeaftConversationIdsByAgent?.[i]||null;c||(c=`yeaft-local-${i}-${Date.now()}`,this.yeaftConversationIdsByAgent={...this.yeaftConversationIdsByAgent||{},[i]:c}),this.yeaftConversationId=c,this.messagesMap[c]||(this.messagesMap[c]=[]),this.currentView==="yeaft"&&(this.activeConversations=[c])}try{let c=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();c&&typeof c.setActive=="function"&&c.setActive(n,i||null)}catch{}if(this.syncActiveYeaftHistoryLoad(),!l?.loading&&i&&n){let c=Number.isFinite(l?.latestSeq)?l.latestSeq:null,d={type:"yeaft_load_history",agentId:i,sessionId:n},u=!!l?.loaded,p=Br({sessionState:l,hasCachedSessionRows:!1,force:o});if(!p&&c!==null?d.afterSeq=c:d.limit=pi,!p&&u&&c===null){this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[a]:{...l||{hasMore:!1,oldestSeq:null,count:0},loaded:!0,loading:!1,syncingAfterSeq:null}},this.syncActiveYeaftHistoryLoad();return}let f=null;if(!p&&u){if(l?.syncingAfterSeq===c)return;f=this.beginYeaftHistoryLoad({agentId:i,sessionId:n,mode:"delta",preserveLoaded:!0,latestSeq:c}),this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[a]:{...this.yeaftSessionHistoryState[a],syncingAfterSeq:c}}}else f=this.beginYeaftHistoryLoad({agentId:i,sessionId:n,mode:"recent",preserveLoaded:!1,latestSeq:p?null:c});f&&(d.requestId=f.requestId),this.sendWsMessage(d)}},async switchYeaftModel(e,t=null,s=void 0){if(!e||!this.currentAgent)return;let n=t||null;if(n){let i={model:e};return s!==void 0&&(i.modelEffort=s||null),await this.sessionCrudRequest("update_config",{sessionId:n,config:i},{agentId:Ie(this,n)})}return this.sendWsMessage({type:"yeaft_model_switch",model:e,modelEffort:s||null,agentId:this.currentAgent}),null},setYeaftDebugSearch(e){this.yeaftDebugSearch=typeof e=="string"?e:"",this._yeaftDebugSearchTimer&&clearTimeout(this._yeaftDebugSearchTimer),this._yeaftDebugSearchTimer=setTimeout(()=>{this._yeaftDebugSearchTimer=null,this.yeaftDebugLoops=[],this.yeaftDebugTurnsById={},this.yeaftDebugTurnOrder=[],this.loadYeaftDebugHistory({limit:this.yeaftDebugSearch.trim()?yd:ko,dreamLimit:5,indexOnly:!0,search:this.yeaftDebugSearch})},250)},setYeaftDebugSessionFilter(e){e==null?this.yeaftDebugSessionFilter=null:this.yeaftDebugSessionFilter=String(e)},toggleSubAgentCardExpand(e){let t=this.yeaftSubAgentCards?.[e];t&&(this.yeaftSubAgentCards={...this.yeaftSubAgentCards,[e]:{...t,expanded:!t.expanded}})},loadSearchSettings(){return this.currentAgent?new Promise(e=>{this._searchPending||(this._searchPending={}),this._searchPending.load=e,this.sendWsMessage({type:"get_search_settings",agentId:this.currentAgent})}):(this.searchSettings={backend:"tavily",tavilyKeyConfigured:!1,tavilyKeyMasked:null,disableHtmlFallback:!1,loaded:!0},Promise.resolve(this.searchSettings))},updateSearchSettings(e){return this.currentAgent?new Promise(t=>{this._searchPending||(this._searchPending={}),this._searchPending.update=t,this.sendWsMessage({type:"update_search_settings",agentId:this.currentAgent,settings:e||{}})}):Promise.resolve({error:"no agent"})},loadTavilyUsage(){return this.currentAgent?(this.tavilyUsageLoading=!0,new Promise(e=>{this._searchPending||(this._searchPending={}),this._searchPending.usage=e,this.sendWsMessage({type:"get_tavily_usage",agentId:this.currentAgent})})):Promise.resolve(null)},loadYeaftMcpServers(){if(!this.currentAgent)return this.yeaftMcpServers=[],this.yeaftMcpRuntime={connected:!1,toolCount:0,perServer:[]},Promise.resolve({servers:[],runtime:this.yeaftMcpRuntime});this.yeaftMcpLoading=!0;let e=`mcp-list-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise(t=>{this._mcpPending||(this._mcpPending={}),this._mcpPending[e]=t,this.sendWsMessage({type:"yeaft_mcp_list",agentId:this.currentAgent,requestId:e})})},addYeaftMcpServer(e){if(!this.currentAgent)return Promise.resolve({error:"no agent"});this.yeaftMcpLoading=!0;let t=`mcp-add-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise(s=>{this._mcpPending||(this._mcpPending={}),this._mcpPending[t]=s,this.sendWsMessage({type:"yeaft_mcp_add",agentId:this.currentAgent,requestId:t,server:e||{}})})},removeYeaftMcpServer(e){if(!this.currentAgent)return Promise.resolve({error:"no agent"});this.yeaftMcpLoading=!0;let t=`mcp-rem-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise(s=>{this._mcpPending||(this._mcpPending={}),this._mcpPending[t]=s,this.sendWsMessage({type:"yeaft_mcp_remove",agentId:this.currentAgent,requestId:t,name:e})})},reloadYeaftMcpServer(e){if(!this.currentAgent)return Promise.resolve({error:"no agent"});this.yeaftMcpLoading=!0;let t=`mcp-rel-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise(s=>{this._mcpPending||(this._mcpPending={}),this._mcpPending[t]=s,this.sendWsMessage({type:"yeaft_mcp_reload",agentId:this.currentAgent,requestId:t,name:e||null})})},clearYeaftMessages(){let e=this.yeaftConversationId;e&&(delete this.messagesMap[e],delete this.processingConversations[e],delete this.executionStatusMap[e]),this.yeaftConversationId=this.currentAgent?`yeaft-local-${this.currentAgent}-${Date.now()}`:`yeaft-local-${Date.now()}`,this.currentAgent&&(this.yeaftConversationIdsByAgent={...this.yeaftConversationIdsByAgent||{},[this.currentAgent]:this.yeaftConversationId}),this.messagesMap[this.yeaftConversationId]=[],this.activeConversations=[this.yeaftConversationId],this.yeaftSessionReady=!1,this.yeaftModel=null,this.yeaftAvailableModels=[],this.yeaftStatus=null,this._yeaftAskTerminalEvents={},this.yeaftDebugLoops=[],this.yeaftDebugTurnsById={},this.yeaftDebugTurnOrder=[],this.yeaftDebugHistoryLoading=!1,this.yeaftDebugHistoryError=null,this.yeaftDebugHistoryFetchedAt=0,this.yeaftDebugSearch="",this.yeaftDebugSessionFilter=null,this._yeaftDebugSearchTimer&&(clearTimeout(this._yeaftDebugSearchTimer),this._yeaftDebugSearchTimer=null),this._fetchYeaftDebugHistoryTimer&&(clearTimeout(this._fetchYeaftDebugHistoryTimer),this._fetchYeaftDebugHistoryTimer=null),this._yeaftDebugHistoryInFlightKey=null,this._yeaftDebugHistoryLatestListRequestId=null,this.yeaftReflectionCards={},this.yeaftSubAgentCards={},this.yeaftDreamLatest={},this.yeaftDreamEvents={},this.vpStatuses={},this.currentAgent&&this.sendWsMessage({type:"yeaft_reset",agentId:this.currentAgent})},togglePaneRightPanel(e,t=null){if(t&&this.isSplitMode){let s=this.panels.find(n=>n.id===t);if(s){s.activeRightPanel=s.activeRightPanel===e?null:e;return}}this.activeRightPanel=this.activeRightPanel===e?null:e},getPaneRightPanel(e){if(e&&this.isSplitMode){let t=this.panels.find(s=>s.id===e);if(t)return t.activeRightPanel}return this.activeRightPanel},setPaneRightPanel(e,t){if(e&&this.isSplitMode){let s=this.panels.find(n=>n.id===e);if(s){s.activeRightPanel=t;return}}this.activeRightPanel=t},applySessionCatalogSnapshot(e){let t=new Set;this.sessionCatalog=(Array.isArray(e)?e:[]).filter(s=>!s?.catalogKey||t.has(s.catalogKey)?!1:(t.add(s.catalogKey),!0)),this.sessionCatalogLoaded=!0},toggleCatalogSessionPin(e){if(!e?.catalogKey||!e?.routeRef||Object.keys(this.sessionCatalogMutationRequests).length>0)return!1;let t=`session_ui_${crypto.randomUUID()}`,s=Dr(this,t),n=!e.pinned;return e.pinned=n,this.sendWsMessage({type:"set_session_ui_metadata",requestId:t,catalogKey:e.catalogKey,routeRef:e.routeRef,pinned:n,sortRank:Number.isFinite(e.sortRank)?e.sortRank:null})?!0:(this.sessionCatalog=s,delete this.sessionCatalogMutationRequests[t],!1)},renameCatalogSession({row:e,title:t}={}){if(!e?.routeRef||!t)return!1;let{runtimeProvider:s,agentId:n,sessionId:i}=e.routeRef;if(s==="yeaft")this.sessionCrudRequest("rename",{sessionId:i,name:t},{agentId:n});else if(s==="claude-code"||s==="copilot")this.renameChatSession(i,t,n);else return!1;return!0},reorderCatalogSessions(e){if(!Array.isArray(e)||e.length===0||Object.keys(this.sessionCatalogMutationRequests).length>0)return!1;let t=`session_order_${crypto.randomUUID()}`,s=Dr(this,t);return this.sessionCatalog=e.map((i,r)=>({...i,sortRank:r})),this.sendWsMessage({type:"reorder_session_catalog",requestId:t,sessions:this.sessionCatalog.map((i,r)=>({catalogKey:i.catalogKey,routeRef:i.routeRef,pinned:!!i.pinned,sortRank:r}))})?!0:(this.sessionCatalog=s,delete this.sessionCatalogMutationRequests[t],!1)},finishSessionCatalogMutation(e){return qa(this,e)},openCatalogSession(e){if(!e?.catalogKey||!e.routeRef)return!1;let{runtimeProvider:t,agentId:s,sessionId:n}=e.routeRef;if(this.activeCatalogKey=e.catalogKey,t==="yeaft"){this.enterYeaft(s),this.setActiveSessionFilter(n,{agentId:s,force:!0});try{window.Pinia?.useSessionsStore?.()?.setActive?.(n,s)}catch{}return!0}return t!=="claude-code"&&t!=="copilot"?!1:(this.currentView==="yeaft"&&this.leaveYeaft(),this.selectConversation(n,s),!0)},requestChatHistory(e,{mode:t="recent",turns:s=null,beforeId:n=null,afterMessageId:i=null}={}){if(!e)return null;let r=ws(e);if(this.chatHistoryRequestIdSupported!==!0&&this.chatHistoryRequests[r]?.loading)return null;let o=n??i??null,a=this.beginChatHistoryRequest(e,t,o);return this.sendWsMessage({type:"sync_messages",conversationId:e,...s!=null?{turns:s}:{},...n!=null?{beforeId:n}:{},...i!=null?{afterMessageId:i}:{},requestId:a})?a:(Ba(this,r,a,"send_failed"),null)},beginChatHistoryRequest(e,t="recent",s=null){return Na(this,e,t,s)},isCurrentChatHistoryResponse(e){if(!e?.conversationId||!e?.requestId||!e?.catalogKey)return!1;let t=ws(e.conversationId);if(e.catalogKey!==t)return!1;let s=this.chatHistoryRequests[t];return!!s&&s.loading===!0&&s.requestId===e.requestId&&Number(s.connectionGeneration||0)===Number(this.chatHistoryConnectionGeneration||0)},finishChatHistoryRequest(e){if(!this.isCurrentChatHistoryResponse(e))return!1;let t=this.chatHistoryRequests[e.catalogKey];return this.chatHistoryRequests[e.catalogKey]={...t,loading:!1},!0},isRefreshingSession(e){return e?!!this.refreshingSessionMap[e]:this.refreshingSession},setRefreshingSession(e,t){e&&(this.refreshingSessionMap[e]=t),this.refreshingSession=t},enterBtwMode(){this.btwMode=!0,this.btwMessages=[],this.btwLoading=!1,this.btwSessionId=null},sendBtwQuestion(e){this.currentConversation&&(this.btwMessages.push({role:"user",content:e}),this.btwMessages.push({role:"assistant",content:""}),this.btwLoading=!0,this.sendWsMessage({type:"btw_question",conversationId:this.currentConversation,question:e,btwSessionId:this.btwSessionId}))},closeBtw(){this.btwMode=!1,this.btwMessages=[],this.btwLoading=!1,this.btwSessionId=null},appendBtwDelta(e){let t=this.btwMessages[this.btwMessages.length-1];t&&t.role==="assistant"&&(t.content+=e)},addSubagent(e,t){this.subagents[e]||(this.subagents[e]={}),this.subagents[e][t.id]={id:t.id,slug:t.slug||t.id,type:t.type||"Task",description:t.description||"",parentToolUseId:t.parentToolUseId||null,status:"running",startTime:Date.now(),messages:[],toolCallCount:0},e===this.currentConversation&&this.activeRightPanel!=="subagents"&&(this.activeRightPanel="subagents")},appendSubagentMessage(e,t,s){let n=this.subagents[e];if(!n||!n[t])return;let i=n[t];if(s?.type==="tool"){i.toolCallCount=Number(i.toolCallCount||0)+1;return}s?.type==="text"&&i.messages.push(s)},completeSubagent(e,t){let s=this.subagents[e];!s||!s[t]||(s[t].status="completed")},sendWsMessage(e){return ol(this,e)},parseWsMessage(e){return al(this,e)},connect(){ll(this)},ensureConnected(){return tn(this)},scheduleReconnect(){cl(this)},manualReconnect(){dl(this)},startHeartbeat(){ul(this)},stopHeartbeat(){pl(this)},setupVisibilityHandler(){fl(this)},handleMessage(e){ic(this,e)},getOrCreateExecutionStatus(e){return Jr(this,e)},handleAssistantOutputFrame(e,t){jl(this,e,t)},handleClaudeOutput(e,t){this.handleAssistantOutputFrame(e,t)},addMessageToConversation(e,t){Xn(this,e,t)},appendToAssistantMessageForConversation(e,t,s){wl(this,e,t,s)},finishStreamingForConversation(e,t){kl(this,e,t)},sweepStaleStreamingForConversation(e){Sl(this,e)},appendToAssistantMessage(e){this.appendToAssistantMessageForConversation(this.currentConversation,e)},finishStreaming(){this.finishStreamingForConversation(this.currentConversation)},addMessage(e){this.addMessageToConversation(this.currentConversation,e)},loadHistoryMessages(e){Cl(this,e)},formatDbMessage(e){return Wr(e)},formatDbMessageForHistoryHydration(e){return Al(e)},selectAgent(e){return pc(this,e)},createConversation(e,t=null,s=null,n=void 0){fc(this,e,t,s,n)},resumeConversation(e,t,s=null,n=null,i=null){gc(this,e,t,s,n,i)},selectConversation(e,t){mc(this,e,t)},updateConversationSettings(e,t){no(this,e,t)},toggleConversationMcp(e,t){hc(this,e,t)},deleteConversation(e,t){yc(this,e,t)},closeSession(e,t){vc(this,e,t)},appendColumn(e){Sc(this,e)},removeColumn(e){Cc(this,e)},sendMessageToConversation(e,t,s=[],n={}){Ic(this,e,t,s,n)},cancelExecutionForConversation(e){Ac(this,e)},addPanel(){if(this.panels.length>=3)return;let e=(t,s)=>({id:t,conversationId:s,activeRightPanel:null});if(this.panels.length===0){let t=localStorage.getItem("splitPanesSaved");if(t){try{let s=JSON.parse(t);if(Array.isArray(s)&&s.length>=2){let n=new Set(this.conversations.map(r=>r.id)),i=s.filter(r=>r&&typeof r.id=="string").map(r=>({...e(r.id,null),conversationId:r.conversationId&&n.has(r.conversationId)?r.conversationId:null}));if(i.length>=2){this.panels=i,this.activePanelId=i[0].id;for(let r of i)r.conversationId&&!this.activeConversations.includes(r.conversationId)&&this.activeConversations.push(r.conversationId),r.conversationId&&!this.messagesMap[r.conversationId]&&(this.messagesMap[r.conversationId]=[],this.requestChatHistory(r.conversationId,{mode:"recent",turns:5}));localStorage.removeItem("splitPanesSaved"),this.saveOpenSessions();return}}}catch{}localStorage.removeItem("splitPanesSaved")}this.panels=[e("panel-0",this.currentConversation),e("panel-1",null)],this.activePanelId="panel-0"}else{let t="panel-"+Date.now();this.panels.push(e(t,null))}this.saveOpenSessions()},removePanel(e){let t=this.panels.findIndex(s=>s.id===e);if(!(t<0)){if(this.panels.splice(t,1),this.panels.length<=1){let s=this.panels[0];s?.conversationId&&(this.activeConversations=[s.conversationId]),this.panels=[],this.activePanelId=null}else this.activePanelId===e&&(this.activePanelId=this.panels[0]?.id||null);this.saveOpenSessions()}},setPanelConversation(e,t){let s=this.panels.find(n=>n.id===e);s&&(s.conversationId=t,t&&!this.activeConversations.includes(t)&&this.activeConversations.push(t),t&&!this.messagesMap[t]&&(this.messagesMap[t]=[],this.requestChatHistory(t,{mode:"recent",turns:5})),this.saveOpenSessions())},setActivePanel(e){this.activePanelId=e},splitToPanel(e){if(!e)return;let t=(s,n)=>({id:s,conversationId:n,activeRightPanel:null});if(this.panels.length===0)this.panels=[t("panel-0",this.currentConversation),t("panel-"+Date.now(),e)],this.activePanelId=this.panels[1].id;else if(this.panels.length>=3)this.panels[this.panels.length-1].conversationId=e,this.activePanelId=this.panels[this.panels.length-1].id;else{let s="panel-"+Date.now();this.panels.push(t(s,e)),this.activePanelId=s}this.activeConversations.includes(e)||this.activeConversations.push(e),this.messagesMap[e]||(this.messagesMap[e]=[],this.requestChatHistory(e,{mode:"recent",turns:5})),this.saveOpenSessions()},isInAnyPanel(e){return this.panels.some(t=>t.conversationId===e)},setSessionPinned(e,t,s={}){if(!e)return;let n=s&&s.agentId?s.agentId:null,i=n?!!ss()?.sessionById?.(e,n)?.pinned:this.pinnedSessions.includes(e);if(t&&!i)this.pinnedSessions.unshift(e);else if(!t&&i){let r=this.pinnedSessions.indexOf(e);r>=0&&this.pinnedSessions.splice(r,1)}try{localStorage.setItem("pinned-sessions",JSON.stringify(this.pinnedSessions))}catch{}try{let r=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore(),o=Ie(this,e,n);r&&typeof r.applyPinState=="function"&&r.applyPinState(e,!!t,o)}catch{}},togglePin(e,t={}){let s=t&&t.agentId?t.agentId:null,n=s?ss()?.sessionById?.(e,s):null,i=t&&Object.prototype.hasOwnProperty.call(t,"pinned"),o=!(n?!!n.pinned:i?!!t.pinned:this.pinnedSessions.includes(e));this.setSessionPinned(e,o,{agentId:s});let a={type:o?"pin_session":"unpin_session",conversationId:e};t&&t.sessionKind==="yeaft"&&(a.sessionKind="yeaft",t.agentId&&(a.agentId=t.agentId),t.sessionName&&(a.sessionName=t.sessionName),t.workDir&&(a.workDir=t.workDir)),this.sendWsMessage(a)},isSessionPinned(e){return this.pinnedSessions.includes(e)},applyServerPinSnapshot(e,t,s){if(!Array.isArray(this.pinnedSessions))return;let n=new Set(this.pinnedSessions),i=[];for(let r of t)n.has(r)||i.push(r);if(i.length>0&&(this.pinnedSessions=[...i,...this.pinnedSessions]),e){let r=this.pinnedSessions.filter(o=>s(o)?t.has(o):!0);r.length!==this.pinnedSessions.length&&(this.pinnedSessions=r)}try{localStorage.setItem("pinned-sessions",JSON.stringify(this.pinnedSessions))}catch{}},clearYeaftSessionProcessingIfIdle(e,{agentId:t=null,ignoreStatuses:s=!1}={}){if(!e)return;let n=t||Ie(this,e);if(Object.values(this.activeVpTurns||{}).some(a=>ut(a,e,n))||!s&&Object.values(this.vpStatuses||{}).some(l=>ut(l,e,n)&&mi.has(l?.state)))return;let r=Ht(n,e),o={...this.yeaftProcessingSessions||{}};r&&delete o[r],gi(this,e,n)&&delete o[e],this.yeaftProcessingSessions=o},sendMessage(e,t=[],s={}){bc(this,e,t,s)},cancelExecution(){wc(this)},cancelYeaft(){if(!this.currentAgent)return;this.sendWsMessage({type:"yeaft_abort_all",agentId:this.currentAgent});let e=this.yeaftConversationIdsByAgent?.[this.currentAgent]||this.yeaftConversationId;e&&delete this.processingConversations[e],ld(this,this.currentAgent)},cancelYeaftSession(e){let t=Ie(this,e);!t||!e||(this.sendWsMessage({type:"yeaft_abort_all",agentId:t,sessionId:e}),this.activeVpTurns=Object.fromEntries(Object.entries(this.activeVpTurns||{}).filter(([,s])=>!ut(s,e,t))),this.stoppingVpTurnIds=Object.fromEntries(Object.entries(this.stoppingVpTurnIds||{}).filter(([s])=>this.activeVpTurns?.[s])),this.vpStatuses=Object.fromEntries(Object.entries(this.vpStatuses||{}).filter(([,s])=>!ut(s,e,t))),this.clearYeaftSessionProcessingIfIdle(e,{agentId:t,ignoreStatuses:!0}))},cancelVpTurn(e,{sessionId:t=null,vpId:s=null}={}){let n=Ie(this,t);if(!n||!e)return;let i=gn(this,n,e);this.stoppingVpTurnIds={...this.stoppingVpTurnIds,[i]:Date.now()};let r={type:"yeaft_abort_turn",agentId:n,turnId:e};t&&(r.sessionId=t),s&&(r.vpId=s),this.sendWsMessage(r)},cancelVpTurnForSession(e,t=null){if(!e)return!1;let s=t||this.yeaftActiveSessionFilter||null;if(!s)return!1;let n=Ie(this,s);if(!n)return!1;let i=this.activeVpTurns||{},r=null,o=-1/0;for(let[a,l]of Object.entries(i)){if(!l||l.vpId!==e||!ut(l,s,n))continue;let c=typeof l.startedAt=="number"?l.startedAt:0;c>=o&&(o=c,r=a)}if(!r){let a=this.vpStatuses?.[ui(n,s,e)]||null;a?.turnId&&!["idle","offline"].includes(a.state)&&(r=a.turnId)}if(r){let a=i[r]?.turnId||r;return this.cancelVpTurn(a,{sessionId:s,vpId:e}),!0}return this.sendWsMessage({type:"yeaft_abort_turn",agentId:n,sessionId:s,vpId:e}),!0},answerUserQuestion(e,t,s){kc(this,e,t,s)},refreshAgents(){xc(this)},refreshConversation(){Tc(this)},restartAgent(e){Mc(this,e)},upgradeAgent(e){Pc(this,e)},loadMoreMessages(){if(this.currentView==="yeaft"||this.loadingMoreMessages||!this.hasMoreMessages||!this.currentConversation)return;this.loadingMoreMessages=!0;let e=this._loadMoreGeneration=(this._loadMoreGeneration||0)+1,s=(this.messagesMap[this.currentConversation]||[]).find(r=>r.dbMessageId),n=this.currentConversation,i=s?.dbMessageId??null;this.requestChatHistory(n,{mode:"older",turns:5,beforeId:i}),setTimeout(()=>{this._loadMoreGeneration===e&&this.loadingMoreMessages&&this.currentConversation===n&&(this.loadingMoreMessages=!1)},1e4)},reloadYeaftMessages(){if(this.currentView!=="yeaft")return!1;let e=Ps(this),t=Ie(this,e);if(!t)return!1;let s=Le(t,e),n=this.yeaftConversationId,i=this.beginYeaftHistoryLoad({agentId:t,sessionId:e,mode:"recent",preserveLoaded:!1});if(!i)return!1;let r=on();this.yeaftHistoryPerfTraceBySession={...this.yeaftHistoryPerfTraceBySession||{},[s]:r};let o={type:"yeaft_load_history",agentId:t,limit:pi,sessionId:e,requestId:i.requestId,perfTraceId:r};return Xe(this,{traceId:r,phase:"history.request_send",agentId:t,sessionId:e,messageType:o.type,bytes:JSON.stringify(o).length,detail:{mode:"manual-reload",limit:pi}}),this.sendWsMessage(o),!0},loadMoreYeaftHistory(e=fn()){if(this.currentView!=="yeaft"||this.yeaftLoadingMoreHistory||!this.yeaftHasMoreHistory||this.yeaftOldestLoadedSeq==null)return;let t=Ps(this),s=Ie(this,t);if(!s)return;let n=Math.min(50,Math.max(1,Number.isFinite(e)?Math.floor(e):fn())),i=Le(s,t),r=this.beginYeaftHistoryLoad({agentId:s,sessionId:t,mode:"older",preserveLoaded:!0,latestSeq:this.yeaftSessionHistoryState[i]?.latestSeq??null});if(!r)return;let o=on();this.yeaftHistoryPerfTraceBySession={...this.yeaftHistoryPerfTraceBySession||{},[i]:o};let a={type:"yeaft_load_more_history",agentId:s,sessionId:t,requestId:r.requestId,beforeSeq:this.yeaftOldestLoadedSeq,turns:n,perfTraceId:o};Xe(this,{traceId:o,phase:"history_more.request_send",agentId:s,sessionId:t,messageType:a.type,bytes:JSON.stringify(a).length,detail:{beforeSeq:a.beforeSeq,turns:a.turns}}),this.sendWsMessage(a)},checkPendingRecovery(){Wa(this)},performRecovery(){Ua(this)},dismissRecovery(){za(this)},autoRestoreConversation(e){Ka(this,e)},saveOpenSessions(){Ss(this)},getLastSession(){return ja(this)},clearLastSession(){Ga(this)},listHistorySessions(e){Qa(this,e)},listFolders(){return Xa(this)},listFoldersForAgent(e,t){return Za(this,e,t)},listModelsForAgent(e,t){return Ja(this,e,t)},listHistorySessionsForAgent(e,t,s){el(this,e,t,s)},async loadGlobalSessions(e=20){return tl(this,e)},async deleteGlobalSession(e){return sl(this,e)},findAgentForSession(e){return Lr(this,e)},isSessionResumable(e){return nl(this,e)},_isRecentlyClosed(e){return jt(this,e)},_startProcessingWatchdog(e){Cs(this,e)},_resetProcessingWatchdog(e){Zn(this,e)},_stopProcessingWatchdog(e){Ae(this,e)},startRefreshTimeout(e){let t=e||this.currentConversation;t&&(this._refreshTimeouts||(this._refreshTimeouts={}),this._refreshTimeouts[t]&&clearTimeout(this._refreshTimeouts[t]),this._refreshTimeouts[t]=setTimeout(()=>{this.setRefreshingSession(t,!1),delete this._refreshTimeouts[t]},1e4))},toggleTheme(){this.theme=this.theme==="dark"?"light":"dark",this.themeFollowSystem=!1,localStorage.setItem("theme",this.theme),document.documentElement.setAttribute("data-theme",this.theme),document.documentElement.classList.toggle("light",this.theme==="light")},initTheme(){if(document.documentElement.setAttribute("data-theme",this.theme),document.documentElement.classList.toggle("light",this.theme==="light"),this.themeFollowSystem&&typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),t=s=>{this.themeFollowSystem&&(this.theme=s.matches?"dark":"light",document.documentElement.setAttribute("data-theme",this.theme),document.documentElement.classList.toggle("light",this.theme==="light"))};e.addEventListener?e.addEventListener("change",t):e.addListener&&e.addListener(t)}},loadModelsDevRegistry({forceRefresh:e=!1}={}){let t=this.modelsDevRegistry.loaded&&!this.modelsDevRegistry.error&&Date.now()-this.modelsDevRegistry.fetchedAt<36e5;if(!e&&t)return Promise.resolve(this.modelsDevRegistry);let s=this.currentAgent;if(!s)return Promise.resolve(this.modelsDevRegistry);if(this._modelsDevPending&&(!e||this._modelsDevPending.force))return new Promise(n=>this._modelsDevPending.resolvers.push(n));if(this._modelsDevPending){let n=this._modelsDevPending;this._modelsDevPending=null,n.timer&&clearTimeout(n.timer);for(let i of n.resolvers)i(this.modelsDevRegistry)}return new Promise(n=>{let i={resolvers:[n],force:e,timer:null};this._modelsDevPending=i;try{this.sendWsMessage({type:"get_models_dev_registry",agentId:s,forceRefresh:e})}catch{this._modelsDevPending===i&&(this._modelsDevPending=null),n(this.modelsDevRegistry);return}i.timer=setTimeout(()=>{if(this._modelsDevPending===i){this._modelsDevPending=null;for(let r of i.resolvers)r(this.modelsDevRegistry)}},2e4)})},changeLocale(e){if(this.locale=e,Zs(e),this.currentAgent)try{this.sendWsMessage({type:"update_llm_config",agentId:this.currentAgent,config:{language:e}})}catch{}},async fetchCustomExpertRoles(){let e=Me();try{let t={};e.token&&(t.Authorization=`Bearer ${e.token}`);let s=await fetch("/api/expert-roles/custom",{headers:t});if(s.ok){let n=await s.json();this.customExpertRoles=n.roles||[]}}catch{}},async createCustomExpertRole(e){let t=Me();try{let s={"Content-Type":"application/json"};t.token&&(s.Authorization=`Bearer ${t.token}`);let n=await fetch("/api/expert-roles/custom",{method:"POST",headers:s,body:JSON.stringify(e)});if(n.ok){let i=await n.json();return this.customExpertRoles.push(i.role),i.role}else{let i=await n.json().catch(()=>({}));throw new Error(i.error||"Failed to create custom expert role")}}catch(s){throw s}},async updateCustomExpertRole(e,t){let s=Me();try{let n={"Content-Type":"application/json"};s.token&&(n.Authorization=`Bearer ${s.token}`);let i=await fetch(`/api/expert-roles/custom/${e}`,{method:"PUT",headers:n,body:JSON.stringify(t)});if(i.ok){let r=await i.json(),o=this.customExpertRoles.findIndex(a=>a.id===e);return o!==-1&&(this.customExpertRoles[o]=r.role),r.role}else{let r=await i.json().catch(()=>({}));throw new Error(r.error||"Failed to update custom expert role")}}catch(n){throw n}},async deleteCustomExpertRole(e){let t=Me();try{let s={};t.token&&(s.Authorization=`Bearer ${t.token}`);let n=await fetch(`/api/expert-roles/custom/${e}`,{method:"DELETE",headers:s});if(n.ok)return this.customExpertRoles=this.customExpertRoles.filter(i=>i.id!==e),!0;{let i=await n.json().catch(()=>({}));throw new Error(i.error||"Failed to delete custom expert role")}}catch(s){throw s}},toggleWorkbench(){this.workbenchExpanded=!this.workbenchExpanded,this.workbenchExpanded||(this.workbenchMaximized=!1)},toggleSidebar(){this.sidebarCollapsed=!this.sidebarCollapsed},toggleSessionSidebar(){this.sessionSidebarOpen=!this.sessionSidebarOpen},closeSessionSidebar(){this.sessionSidebarOpen=!1},toggleWorkbenchMaximized(){this.workbenchMaximized=!this.workbenchMaximized},renameChatSession(e,t,s=null){let n=t&&t.trim()?t.trim():"";n?this.customConversationTitles[e]=n:delete this.customConversationTitles[e],this.sendWsMessage({type:"update_conversation_settings",conversationId:e,...s?{agentId:s}:{},title:n})},openFileInExplorer(e){this.currentConversation&&(this.workbenchExpanded=!0,window.dispatchEvent(new CustomEvent("open-file-in-explorer",{detail:{filePath:e,conversationId:this.currentConversation}})))},logout(){Me().logout(),this.authenticated=!1,this.sessionKey=null,this.agents=[],this.currentAgent=null,this.currentAgentInfo=null,this.yeaftStatusByAgent={},this._yeaftRetiredCatalogEpochsByAgent={},this.conversations=[],this.activeConversations=[],this.messagesMap={},this.conversationTitles={},this.customConversationTitles={},this.processingConversations={},this.executionStatusMap={},this.workbenchExpanded=!1,this.subagents={},this.activeSubagentId=null,this.activeRightPanel=null,this.pinnedSessions=[],this.ws&&this.ws.close()}}})});function Io(e,t){!e||typeof e.handleYeaftOutput!="function"||!t||e.handleYeaftOutput({event:t})}function jm(e){let t=String(e||""),s=2166136261;for(let n=0;n<t.length;n++)s^=t.charCodeAt(n),s=Math.imul(s,16777619)>>>0;return s>>>0}function xo(e){if(!e)return Ot[0];let t=String(e).toLowerCase();return Ym[t]||Ot[jm(t)%Ot.length]}function Gm(e){return xo(e).background}function Qm(e){return xo(e).foreground}function Ao(){let e=typeof window<"u"&&window.Pinia&&window.Pinia.useChatStore?window.Pinia.useChatStore():null;return e&&typeof e.locale=="string"?e.locale:typeof localStorage<"u"&&localStorage.getItem("locale")||""}function Xm(e,t=""){return e?String(t||"").startsWith("zh")?e.descriptionZh||e.roleZh||e.description||e.role||"":e.description||e.role||e.descriptionZh||e.roleZh||"":""}var Km,Ot,Ym,bb,ht,_s=H(()=>{({defineStore:Km}=Pinia);Ot=[{key:"rat",label:"Rat",glyph:"R",background:"var(--vp-avatar-rat-bg)",foreground:"var(--vp-avatar-rat-fg)"},{key:"ox",label:"Ox",glyph:"O",background:"var(--vp-avatar-ox-bg)",foreground:"var(--vp-avatar-ox-fg)"},{key:"tiger",label:"Tiger",glyph:"T",background:"var(--vp-avatar-tiger-bg)",foreground:"var(--vp-avatar-tiger-fg)"},{key:"rabbit",label:"Rabbit",glyph:"B",background:"var(--vp-avatar-rabbit-bg)",foreground:"var(--vp-avatar-rabbit-fg)"},{key:"dragon",label:"Dragon",glyph:"D",background:"var(--vp-avatar-dragon-bg)",foreground:"var(--vp-avatar-dragon-fg)"},{key:"snake",label:"Snake",glyph:"S",background:"var(--vp-avatar-snake-bg)",foreground:"var(--vp-avatar-snake-fg)"},{key:"horse",label:"Horse",glyph:"H",background:"var(--vp-avatar-horse-bg)",foreground:"var(--vp-avatar-horse-fg)"},{key:"goat",label:"Goat",glyph:"G",background:"var(--vp-avatar-goat-bg)",foreground:"var(--vp-avatar-goat-fg)"},{key:"monkey",label:"Monkey",glyph:"M",background:"var(--vp-avatar-monkey-bg)",foreground:"var(--vp-avatar-monkey-fg)"},{key:"rooster",label:"Rooster",glyph:"K",background:"var(--vp-avatar-rooster-bg)",foreground:"var(--vp-avatar-rooster-fg)"},{key:"dog",label:"Dog",glyph:"D",background:"var(--vp-avatar-dog-bg)",foreground:"var(--vp-avatar-dog-fg)"},{key:"pig",label:"Pig",glyph:"P",background:"var(--vp-avatar-pig-bg)",foreground:"var(--vp-avatar-pig-fg)"}],Ym=Object.freeze({steve:Ot[8],ada:Ot[3],linus:Ot[0],martin:Ot[4]}),bb=Ot.map(e=>e.background);ht=Km("vp",{state:()=>({vps:{},vpOrder:[],emptyLibrary:!1,lastSnapshotAt:0,lastVpSnapshotAgentId:null,lastChange:null,dreamStatus:{},groupDreamStatus:{}}),getters:{vpList(e){return e.vpOrder.map(t=>e.vps[t]).filter(Boolean)},vpCount(e){return e.vpOrder.length},vpById:e=>t=>e.vps[t]||null,vpLabel:e=>t=>{let s=e.vps[t];return s?Ao().startsWith("zh")&&s.displayNameZh?s.displayNameZh:s.displayName||s.vpId||t:t},vpDescription:e=>t=>Xm(e.vps[t],Ao()),vpInitial:e=>t=>{let s=e.vps[t],n=Ao().startsWith("zh"),i=s&&(s.avatar||n&&s.displayNameZh||s.displayName||s.vpId)||t||"?";return String(i).charAt(0).toUpperCase()||"?"},vpColor:e=>t=>{let s=e.vps[t];return s&&s.color?s.color:Gm(t)},vpTextColor:()=>e=>Qm(e),vpAvatarMotif:()=>e=>xo(e),dreamStatusFor:e=>t=>e.dreamStatus[t]||{status:"idle",lastRunAt:null,lastResult:null,lastError:null},groupDreamStatusFor:e=>t=>e.groupDreamStatus[t]||{status:"idle",lastRunAt:null,lastResult:null,lastError:null}},actions:{applySnapshot(e,t=null){this.vps={},this.vpOrder=[];let s=e&&Array.isArray(e.vps)?e.vps:[];for(let n of s)this._upsertInternal(n);this.emptyLibrary=!!(e&&e.emptyLibrary),this.lastSnapshotAt=Date.now(),this.lastVpSnapshotAgentId=t||null},upsert(e,t=null){this._upsertInternal(e),e&&e.vpId&&(this.lastChange={vpId:e.vpId,kind:"updated",reason:t||null,at:Date.now()})},remove(e,t=null){e&&(delete this.vps[e],this.vpOrder=this.vpOrder.filter(s=>s!==e),this.lastChange={vpId:e,kind:"removed",reason:t||"file.removed",at:Date.now()})},_upsertInternal(e){if(!e||!e.vpId)return;let t=!!this.vps[e.vpId];this.vps[e.vpId]={...this.vps[e.vpId]||{},...e},t||this.vpOrder.push(e.vpId),this.emptyLibrary&&(this.emptyLibrary=!1)},triggerDream(e){if(!e)return;this.dreamStatus={...this.dreamStatus,[e]:{...this.dreamStatus[e]||{},status:"running",lastError:null}};let t=window.Pinia&&window.Pinia.useChatStore?window.Pinia.useChatStore():null;t&&typeof t.sendWsMessage=="function"&&t.sendWsMessage({type:"yeaft_dream_trigger",vpId:e})},triggerGroupDream(e,t={}){if(!e)return;this.groupDreamStatus={...this.groupDreamStatus,[e]:{...this.groupDreamStatus[e]||{},status:"running",lastError:null}};let s=window.Pinia&&window.Pinia.useChatStore?window.Pinia.useChatStore():null,n=Date.now();if(Io(s,{type:"dream_progress",phase:"start",groupId:e,manual:!0,trigger:"manual",source:"header-button",ts:n}),!s||typeof s.sendWsMessage!="function"){Io(s,{type:"yeaft_dream_result",groupId:e,success:!1,skipped:!0,skippedReason:"chat-store-unavailable",trigger:"manual",error:null});return}let i={type:"yeaft_dream_trigger",sessionId:e},r=t&&t.agentId?t.agentId:typeof s.agentIdForSession=="function"?s.agentIdForSession(e):s.currentAgent;r&&(i.agentId=r),s.sendWsMessage(i)===!1&&Io(s,{type:"yeaft_dream_result",groupId:e,success:!1,skipped:!0,skippedReason:"websocket-not-open",trigger:"manual",error:null})},applyDreamStatus(e){if(!e)return;let t=e.sessionId;if(t){this.groupDreamStatus={...this.groupDreamStatus,[t]:{...this.groupDreamStatus[t]||{},status:e.status==="running"?"running":e.status||"idle"}};return}if(!e.vpId)return;let s=e.vpId;this.dreamStatus={...this.dreamStatus,[s]:{...this.dreamStatus[s]||{},status:e.status==="running"?"running":e.status||"idle"}}},applyDreamResult(e){if(!e)return;let t=!!e.success,s=!!e.skipped,n={mergedCount:e.mergedCount??null,extractedCount:e.extractedCount??null,entriesCreated:typeof e.entriesCreated=="number"?e.entriesCreated:e.mergedCount??e.extractedCount??0,skipped:s,skippedReason:e.skippedReason||null,sessionsProcessed:typeof e.sessionsProcessed=="number"?e.sessionsProcessed:null,sessionsSkipped:typeof e.sessionsSkipped=="number"?e.sessionsSkipped:null,targetsApplied:typeof e.targetsApplied=="number"?e.targetsApplied:null,durationMs:typeof e.durationMs=="number"?e.durationMs:null,llmCallCount:typeof e.llmCallCount=="number"?e.llmCallCount:0,inputTokens:typeof e.inputTokens=="number"?e.inputTokens:0,outputTokens:typeof e.outputTokens=="number"?e.outputTokens:0,totalTokens:typeof e.totalTokens=="number"?e.totalTokens:0,metrics:e.metrics||null,passBreakdown:e.passBreakdown||e.metrics?.passBreakdown||null,targetErrors:Array.isArray(e.targetErrors)?e.targetErrors:[]},i=t||s?null:e.error||null,r=s?"skipped":t?"success":"error",o=e.sessionId;if(o){this.groupDreamStatus={...this.groupDreamStatus,[o]:{status:r,lastRunAt:Date.now(),lastResult:n,lastError:i}};return}if(!e.vpId)return;let a=e.vpId;this.dreamStatus={...this.dreamStatus,[a]:{status:r,lastRunAt:Date.now(),lastResult:n,lastError:i}}}}})});function To(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e){let t=Date.parse(e);if(Number.isFinite(t))return t}return 0}function vi(e){return!e||typeof e!="object"?0:To(e.lastMessageAt)||To(e.updatedAt)||To(e.createdAt)||0}function Mo(e,t){let s=vi(t)-vi(e);return s!==0?s:String(e?.id||"").localeCompare(String(t?.id||""))}function Cd(e){return[...Array.isArray(e)?e:[]].sort(Mo)}var yi=H(()=>{});function Id(){try{if(typeof localStorage>"u")return{};let e=JSON.parse(localStorage.getItem(Md)||"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function Zm(e){try{typeof localStorage<"u"&&localStorage.setItem(Md,JSON.stringify(e&&typeof e=="object"?e:{}))}catch{}}function Ad(){try{return typeof localStorage>"u"?[]:hn(JSON.parse(localStorage.getItem(Pd)||"[]"))}catch{return[]}}function Jm(e){try{typeof localStorage<"u"&&localStorage.setItem(Pd,JSON.stringify(hn(e)))}catch{}}function _d(e,t){return`${e||""}${t||""}`}function It(e){return e&&e.agentId&&e.id?_d(e.agentId,e.id):""}function vt(e,t){return t?e?_d(e,t):String(t):""}function eh(e){return typeof e=="string"?e:String(e||"")}function it(e,t,s=null){let n=eh(t);if(!n)return"";let i=vt(s,n);if(i&&e.sessions[i])return i;if(e.sessions[n])return n;if(e.activeSessionKey&&e.sessions[e.activeSessionKey]?.id===n)return e.activeSessionKey;let r=e.sessionOrder.filter(a=>e.sessions[a]?.id===n);if(s){let a=r.find(l=>e.sessions[l]?.agentId===s);if(a)return a}let o=Ro();if(o?.currentAgent){let a=r.find(l=>e.sessions[l]?.agentId===o.currentAgent);if(a)return a}return r[0]||""}function Po(e,t,s=null){return it(e,t,s)||""}function hn(e){let t=[],s=new Set;for(let n of Array.isArray(e)?e:[]){let i=typeof n=="string"?n:String(n||"");!i||s.has(i)||(s.add(i),t.push(i))}return t}function _o(e,t){let s=hn(e),n=new Set(s),i=hn(t).filter(o=>n.has(o)),r=new Set(i);return[...i,...s.filter(o=>!r.has(o))]}function bi(e,t=!1){return!e||typeof e!="object"?!!t:Object.prototype.hasOwnProperty.call(e,"pinned")?e.pinned===!0:Object.prototype.hasOwnProperty.call(e,"isPinned")?e.isPinned===!0:!!t}function xd(e){return!e||typeof e!="object"?!1:e.running===!0||e.active===!0||e.isActive===!0||e.isRunning===!0}function Td(e){if(!e||typeof e!="object")return 0;let t=e.latestActivityAt||e.lastActivityAt||e.lastMessageAt||e.updatedAt||0;if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"&&t){let s=Date.parse(t);return Number.isFinite(s)?s:0}return 0}function Ro(){try{if(typeof window<"u"&&window.Pinia&&typeof window.Pinia.useChatStore=="function")return window.Pinia.useChatStore()}catch{}return null}var Md,Pd,th,Rd,Dd=H(()=>{yi();Md="yeaft-session-order-by-agent",Pd="yeaft-session-order-global";({defineStore:th}=Pinia);Rd=th("sessions",{state:()=>({sessions:{},sessionOrder:[],activeSessionId:null,activeSessionKey:null,lastSnapshotAt:0,lastCrudResult:null,pending:{}}),getters:{sessionList(e){let t=e.sessionOrder.map(d=>e.sessions[d]).filter(Boolean),s=Ro(),n=s&&Array.isArray(s.pinnedSessions)?new Set(s.pinnedSessions):new Set;for(let d of t)d&&d.id&&d.pinned&&n.add(d.id);let i=[],r=[];for(let d of t)d.pinned||!d.agentId&&n.has(d.id)?i.push(d):r.push(d);let o=d=>[...d].sort((u,p)=>{let f=Number.isFinite(u?.sortOrder)?u.sortOrder:Number.MAX_SAFE_INTEGER,g=Number.isFinite(p?.sortOrder)?p.sortOrder:Number.MAX_SAFE_INTEGER;return f!==g?f-g:Mo(u,p)}),a=[...o(i),...o(r)],l=Ad();if(l.length===0)return a;let c=new Map(l.map((d,u)=>[d,u]));return a.sort((d,u)=>{let p=c.has(It(d))?c.get(It(d)):Number.MAX_SAFE_INTEGER,f=c.has(It(u))?c.get(It(u)):Number.MAX_SAFE_INTEGER;return p!==f?p-f:0})},sessionCount(e){return e.sessionOrder.length},sessionById:e=>(t,s=null)=>{let n=it(e,t,s);return n&&e.sessions[n]||null},activeSession(e){return e.activeSessionKey&&e.sessions[e.activeSessionKey]||null},hasLoadedSnapshot(e){return e.lastSnapshotAt>0},isEmpty(e){return e.sessionOrder.length===0},activeNeedsInvite(e){let t=e.activeSessionKey?e.sessions[e.activeSessionKey]:null;return t?!t.defaultVpId&&(!Array.isArray(t.roster)||t.roster.length===0):!1}},actions:{applySnapshot(e,t=null){let s=Array.isArray(e)?e:[];if(t){let m={...this.sessions},A=new Set;for(let _ of s){if(!_||!_.id)continue;let L=vt(t,_.id);A.add(L),m[L]=this._normalize(_,t,bi(this.sessions[L]))}for(let _ of this.sessionOrder){let L=this.sessions[_];L&&L.agentId===t&&!A.has(_)&&delete m[_]}let w=this.sessionOrder.filter(_=>m[_]),k=new Set(w),y=[];for(let _ of s){if(!_||!_.id)continue;let L=vt(t,_.id);m[L]&&!k.has(L)&&y.push(L)}this.sessions=m;let h=[...w,...y],b=Ad();if(b.length>0){let _=new Map(h.map(R=>[It(m[R]),R]).filter(([R])=>R)),L=b.map(R=>_.get(R)).filter(Boolean),U=new Set(L);h=[...L,...h.filter(R=>!U.has(R))];let $=new Map(b.map((R,P)=>[R,P]));for(let R of h){let P=It(m[R]);P&&$.has(P)&&(m[R]={...m[R],sortOrder:$.get(P)})}}if(t&&b.length===0){let _=Id(),L=hn(_[t]);if(L.length>0){let U=L.map(M=>vt(t,M)),$=new Set(U),R=_o(h.filter(M=>m[M]?.agentId===t),U),P=this.sessionOrder.some(M=>m[M]?.agentId===t),T=0;P?h=this.sessionOrder.filter(M=>m[M]).map(M=>m[M]?.agentId===t?R[T++]:M).concat(R.slice(T)):h=h.map(M=>m[M]?.agentId===t?R[T++]:M);let I=new Map(U.map((M,B)=>[M,B]));for(let M of R)m[M]&&$.has(M)&&(m[M]={...m[M],sortOrder:I.get(M)})}}this.sessionOrder=h}else{if(Object.values(this.sessions).some(k=>k&&k.agentId))return;let A={},w=[];for(let k of s){if(!k||!k.id)continue;let y=vt(null,k.id);A[y]=this._normalize(k,null,bi(this.sessions[y])),w.push(y)}this.sessions=A,this.sessionOrder=w}this.lastSnapshotAt=Date.now();let n=null;try{n=localStorage.getItem("lastViewedYeaftSession")||null}catch{}let i=n?it(this,n,t):"",r=i?this.sessions[i]:null,o=r&&(!t||r.agentId===t),a=this.sessionOrder.filter(m=>this.sessions[m]&&(!t||this.sessions[m].agentId===t)&&this.sessions[m].running).sort((m,A)=>Td(this.sessions[A])-Td(this.sessions[m]))[0]||null,l=a?this.sessions[a]?.id:null,c=this.sessionList[0]||null,d=c?.id||null,u=d?it(this,d,c?.raw?.agentId||null):"",p=l||(o?n:null)||d,f=a||(o?i:"")||u||Po(this,p,t),g=this.activeSessionKey?this.sessions[this.activeSessionKey]?.agentId:null;this.activeSessionId&&!it(this,this.activeSessionId,g)?(this.activeSessionId=p,this.activeSessionKey=f||null):!this.activeSessionId&&this.sessionOrder.length>0?(this.activeSessionId=p,this.activeSessionKey=f||null):this.activeSessionId&&(this.activeSessionKey=Po(this,this.activeSessionId,g)||this.activeSessionKey);let v=Ro();if(v){if(t){let w={...v.yeaftSessionAgentById||{}};for(let k of s)k&&k.id&&!w[k.id]&&(w[k.id]=t);v.yeaftSessionAgentById=w}let m=this.activeSessionId||p,A=null;(v.yeaftActiveSessionFilter&&!it(this,v.yeaftActiveSessionFilter)||!v.yeaftActiveSessionFilter&&m)&&(A=m),A&&(v.currentView==="yeaft"&&typeof v.setActiveSessionFilter=="function"?v.setActiveSessionFilter(A,{force:!0}):v.yeaftActiveSessionFilter=A,this.activeSessionKey=Po(this,A)||this.activeSessionKey)}if(v&&typeof v.applyServerPinSnapshot=="function"){let m=new Set;for(let w of s){if(!w||!w.id)continue;let k=vt(t,w.id),y=this.sessions[k];y&&y.pinned&&m.add(w.id)}let A=w=>{let k=it(this,w,t),y=k?this.sessions[k]:null;return y?y.agentId===t:!1};v.applyServerPinSnapshot(t,m,A)}},applyRosterChange(e){if(!e)return;let t=e.sessionId||e.groupId;if(!t)return;let s=e.agentId||null,n=it(this,t,s)||vt(s,t),i=this.sessions[n];if(!i){let r=this._normalize({id:t,name:e.name||t,roster:Array.isArray(e.roster)?e.roster:[],defaultVpId:e.defaultVpId||null},s);this.sessions[n]=r,this.sessionOrder.push(n);return}this.sessions[n]={...i,name:e.name||i.name,roster:Array.isArray(e.roster)?e.roster.slice():i.roster,defaultVpId:e.defaultVpId!=null?e.defaultVpId:i.defaultVpId,announcement:typeof e.announcement=="string"?e.announcement:i.announcement}},applyCrudResult(e,t=null){if(!e)return;this.lastCrudResult={...e,at:Date.now()},e.requestId&&this.pending[e.requestId]&&delete this.pending[e.requestId],e.ok&&e.op==="list"&&Array.isArray(e.sessions)&&this.applySnapshot(e.sessions,t);let s=e.session||e.group||null;e.ok&&e.op==="create"&&s&&s.id&&(this.applySnapshotUpsert(s,t),this.setActive(s.id,t));let n=e.sessionId||e.groupId,i=n?it(this,n,t):"";if(e.ok&&(e.op==="archive"||e.op==="delete")&&n&&(i&&delete this.sessions[i],this.sessionOrder=this.sessionOrder.filter(r=>r!==i),(this.activeSessionKey===i||this.activeSessionId===n)&&(this.activeSessionKey=this.sessionOrder[0]||null,this.activeSessionId=this.activeSessionKey&&this.sessions[this.activeSessionKey]?.id||null)),e.ok&&e.op==="update_config"&&n){let r=i?this.sessions[i]:null;r&&(this.sessions[i]={...r,config:e.config&&typeof e.config=="object"?{...e.config}:{}})}},applySnapshotUpsert(e,t=null){if(!e||!e.id)return;let s=t||e.agentId||null,n=it(this,e.id,s)||vt(s,e.id),i=!!this.sessions[n],r=this.sessions[n]||{};this.sessions[n]={...r,...this._normalize(e,s,bi(r))},i||this.sessionOrder.push(n)},setActive(e,t=null){let s=it(this,e,t);e&&s&&this.sessions[s]?(this.activeSessionId=e,this.activeSessionKey=s):(this.activeSessionId=null,this.activeSessionKey=null)},reorderSessionsForAgent(e,t){if(!e)return[];let s=this.sessionOrder.filter(l=>this.sessions[l]?.agentId===e),n=_o(s,t.map(l=>vt(e,l)));if(n.length===0)return[];let i=new Map(n.map((l,c)=>[l,c])),r=0;this.sessionOrder=this.sessionOrder.map(l=>this.sessions[l]?.agentId===e?n[r++]:l);for(let l of n)this.sessions[l]={...this.sessions[l],sortOrder:i.get(l)};let o=Id(),a=n.map(l=>this.sessions[l]?.id).filter(Boolean);return o[e]=a,Zm(o),a},reorderSessionsGlobally(e){let t=this.sessionOrder.map(a=>It(this.sessions[a])).filter(Boolean),s=_o(t,e);if(s.length===0)return[];let n=new Map(this.sessionOrder.map(a=>[It(this.sessions[a]),a]).filter(([a])=>a)),i=s.map(a=>n.get(a)).filter(Boolean),r=new Set(i);this.sessionOrder=[...i,...this.sessionOrder.filter(a=>!r.has(a))];let o=new Map(s.map((a,l)=>[a,l]));for(let a of this.sessionOrder){let l=It(this.sessions[a]);l&&o.has(l)&&(this.sessions[a]={...this.sessions[a],sortOrder:o.get(l)})}return Jm(s),s.map(a=>{let l=n.get(a),c=l?this.sessions[l]:null;return c?{agentId:c.agentId,sessionId:c.id}:null}).filter(Boolean)},applyPinState(e,t,s=null){let n=it(this,e,s);!e||!n||!this.sessions[n]||(this.sessions[n]={...this.sessions[n],pinned:!!t})},markPending(e,t){e&&(this.pending[e]=t)},clearLastResult(){this.lastCrudResult=null},resetInventory(){this.sessions={},this.sessionOrder=[],this.activeSessionId=null,this.activeSessionKey=null,this.lastSnapshotAt=0},beginInventoryCommit(e=null,t=null){this.resetInventory(),e&&(this.activeSessionId=e,this.activeSessionKey=vt(t,e)||e)},_normalize(e,t=null,s=!1){return{id:e.id,name:e.name||e.id,roster:Array.isArray(e.roster)?e.roster.slice():[],defaultVpId:e.defaultVpId||null,announcement:typeof e.announcement=="string"?e.announcement:"",config:e.config&&typeof e.config=="object"?{...e.config}:{},workDir:typeof e.workDir=="string"?e.workDir:"",createdAt:e.createdAt||null,updatedAt:e.updatedAt||null,lastMessageAt:e.lastMessageAt||null,running:xd(e),active:xd(e),runningVpCount:Number.isFinite(Number(e.runningVpCount))?Number(e.runningVpCount):0,latestActivityAt:e.latestActivityAt||e.lastActivityAt||e.lastMessageAt||null,agentId:t||e.agentId||null,pinned:bi(e,s),sortOrder:Number.isFinite(e.sortOrder)?e.sortOrder:null}}}})});function wi(){try{if(window.Pinia&&typeof window.Pinia.useAuthStore=="function")return window.Pinia.useAuthStore()}catch{}return null}function Do(){try{return localStorage.getItem("authToken")||null}catch{return null}}function $d(){let e=wi();if(e)try{return e.getActiveToken?.()||e.token||Do()}catch{return e.token||Do()}return Do()}function nh(e,t){if(!e)return!1;let s=$d();if(s&&s!==t)return!1;try{localStorage.setItem("authToken",e)}catch{}let n=wi();return n&&(n.token=e),!0}function ih(e){try{let t=typeof e=="string"?e:e?.url;return!t||typeof window>"u"||!window.location?null:new URL(t,window.location.href)}catch{return null}}function Ld(e){return!e||typeof window>"u"||!window.location?!1:e.origin===window.location.origin&&e.pathname.startsWith("/api/")}function rh(e){if(!e)return!1;let t=e.pathname;return!!(sh.has(t)||t.startsWith("/api/auth/sso/poll/")||/^\/api\/auth\/sso\/[^/]+\/start(?:-qr)?$/.test(t))}function oh(e,t){return t?.headers?new Headers(t.headers):e&&typeof e=="object"&&e.headers?new Headers(e.headers):new Headers}function ah(e){let t=e.get("Authorization");return!t||!t.startsWith("Bearer ")?null:t.slice(7)}function lh(e,t){return{...e||{},headers:t}}function ch(e,t,s,n){let i=wi();i&&typeof i.handleAuthResponse=="function"?i.handleAuthResponse(e,t,s,n):i&&typeof i.handleAuthFailure=="function"&&n&&i.handleAuthFailure(void 0,t,s)}function Vd(){if(Ed||typeof window>"u"||!window.fetch)return;Ed=!0;let e=window.fetch.bind(window);window.fetch=async function(s,n){let i=ih(s),r=Ld(i)&&!rh(i),o=Ld(i)?{...n||{},credentials:"same-origin"}:n,a=null,l=r?wi():null,c=l?.authGeneration,d=!!l?.isAuthenticated;if(r){let p=oh(s,n);a=ah(p),a||(a=$d(),a&&(p.set("Authorization",`Bearer ${a}`),o=lh(o,p)))}let u=await e(s,o);try{let p=u.headers&&u.headers.get&&u.headers.get("X-New-Token");p&&nh(p,a),r&&u.status===401&&ch(u,a,c,d)}catch{}return u}}var Ed,sh,Fd=H(()=>{Ed=!1,sh=new Set(["/api/auth/mode","/api/auth/login","/api/auth/aad","/api/auth/verify","/api/auth/verify-totp","/api/auth/setup-totp","/api/auth/register","/api/auth/password-reset/request","/api/auth/password-reset/verify"])});var Hd,Od=H(()=>{Hd={"common.loading":"\u52A0\u8F7D\u4E2D...","common.confirm":"\u786E\u5B9A","common.apply":"\u5E94\u7528","common.cancel":"\u53D6\u6D88","common.delete":"\u5220\u9664","common.copy":"\u590D\u5236","common.copied":"\u5DF2\u590D\u5236","common.close":"\u5173\u95ED","common.refresh":"\u5237\u65B0","common.open":"\u6253\u5F00","common.save":"\u4FDD\u5B58","common.search":"\u641C\u7D22","common.back":"\u8FD4\u56DE","common.noSubdirectories":"\u65E0\u5B50\u76EE\u5F55","common.drives":"\u9A71\u52A8\u5668","common.rootDir":"\u6839\u76EE\u5F55","common.comma":"\uFF0C","common.select":"\u9009\u62E9","mermaid.export":"\u5BFC\u51FA","mermaid.exportMd":"\u5BFC\u51FA MD","mermaid.exportPng":"\u5BFC\u51FA PNG","mermaid.exportJpg":"\u5BFC\u51FA JPG","chat.toolActionsOmitted":"\u5DF2\u7701\u7565 {count} \u4E2A\u5386\u53F2\u5DE5\u5177\u52A8\u4F5C","login.subtitle":"Yeaft Web Code Agent","login.username":"\u7528\u6237\u540D","login.password":"\u5BC6\u7801","login.login":"\u767B\u5F55","login.loggingIn":"\u767B\u5F55\u4E2D...","login.enterUsername":"\u8BF7\u8F93\u5165\u7528\u6237\u540D","login.enterPassword":"\u8BF7\u8F93\u5165\u5BC6\u7801","login.noAccount":"\u6CA1\u6709\u8D26\u53F7\uFF1F","login.registerWithCode":"\u6CE8\u518C\u65B0\u8D26\u53F7","login.or":"\u6216","login.usePassword":"\u4F7F\u7528\u8D26\u53F7\u5BC6\u7801\u767B\u5F55","login.useSso":"\u8FD4\u56DE\u5355\u70B9\u767B\u5F55","login.noProviders":"\u7BA1\u7406\u5458\u5C1A\u672A\u542F\u7528\u4EFB\u4F55\u7B2C\u4E09\u65B9\u767B\u5F55\u3002","login.microsoft":"\u4F7F\u7528 Microsoft \u8D26\u53F7\u767B\u5F55","login.github":"\u4F7F\u7528 GitHub \u8D26\u53F7\u767B\u5F55","login.google":"\u4F7F\u7528 Google \u8D26\u53F7\u767B\u5F55","login.wechat":"\u4F7F\u7528\u5FAE\u4FE1\u626B\u7801\u767B\u5F55","login.alipay":"\u4F7F\u7528\u652F\u4ED8\u5B9D\u8D26\u53F7\u767B\u5F55","login.wechat.mobileUnsupported":"\u5FAE\u4FE1\u767B\u5F55\u6682\u4EC5\u652F\u6301\u7535\u8111\u7AEF\uFF0C\u8BF7\u5728\u7535\u8111\u6D4F\u89C8\u5668\u4E2D\u626B\u7801\u767B\u5F55\u3002","login.alipay.mobileWaiting":"\u6B63\u5728\u7B49\u5F85\u4F60\u5728\u652F\u4ED8\u5B9D\u4E2D\u786E\u8BA4\u2026 \u5B8C\u6210\u540E\u8FD4\u56DE\u672C\u9875\u9762\u5C06\u81EA\u52A8\u767B\u5F55\u3002","login.alipay.relaunch":"\u91CD\u65B0\u6253\u5F00\u652F\u4ED8\u5B9D","login.qr.title":"\u626B\u7801\u767B\u5F55","login.qr.titleAlipay":"\u652F\u4ED8\u5B9D\u626B\u7801\u767B\u5F55","login.qr.titleWechat":"\u5FAE\u4FE1\u626B\u7801\u767B\u5F55","login.qr.hint":"\u8BF7\u4F7F\u7528\u624B\u673A\u626B\u63CF\u4E8C\u7EF4\u7801\u5B8C\u6210\u6388\u6743","login.error.enterUsername":"\u8BF7\u8F93\u5165\u7528\u6237\u540D","login.error.enterPassword":"\u8BF7\u8F93\u5165\u5BC6\u7801","login.error.enter6Digit":"\u8BF7\u8F93\u51656\u4F4D\u9A8C\u8BC1\u7801","login.error.enterInviteCode":"\u8BF7\u8F93\u5165\u9080\u8BF7\u7801","login.error.usernameMinLen":"\u7528\u6237\u540D\u81F3\u5C112\u4E2A\u5B57\u7B26","login.error.passwordMinLen":"\u5BC6\u7801\u81F3\u5C116\u4F4D","login.error.passwordMismatch":"\u4E24\u6B21\u5BC6\u7801\u4E0D\u4E00\u81F4","login.error.enterVerifyCode":"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801","login.error.loginFailed":"\u767B\u5F55\u5931\u8D25","login.forgot.link":"\u5FD8\u8BB0\u5BC6\u7801\uFF1F","login.forgot.title":"\u91CD\u7F6E\u5BC6\u7801","login.forgot.emailHint":"\u8F93\u5165\u8D26\u6237\u7ED1\u5B9A\u7684\u90AE\u7BB1\uFF0C\u6211\u4EEC\u5C06\u53D1\u9001 6 \u4F4D\u91CD\u7F6E\u9A8C\u8BC1\u7801\u3002","login.forgot.sendCode":"\u53D1\u9001\u91CD\u7F6E\u9A8C\u8BC1\u7801","login.forgot.sending":"\u53D1\u9001\u4E2D...","login.forgot.codeSent":"\u5982\u679C\u90AE\u7BB1\u5DF2\u6CE8\u518C\uFF0C\u91CD\u7F6E\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\u3002\u8BF7\u5728\u4E0B\u65B9\u8F93\u5165\u9A8C\u8BC1\u7801\u4E0E\u65B0\u5BC6\u7801\u3002","login.forgot.resetBtn":"\u91CD\u7F6E\u5BC6\u7801","login.forgot.resetting":"\u91CD\u7F6E\u4E2D...","login.forgot.success":"\u5BC6\u7801\u5DF2\u91CD\u7F6E\uFF0C\u53EF\u4EE5\u4F7F\u7528\u65B0\u5BC6\u7801\u767B\u5F55\u3002","login.forgot.emailInvalid":"\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1","login.register.title":"\u65B0\u7528\u6237\u6CE8\u518C","login.register.inviteCode":"\u9080\u8BF7\u7801","login.register.username":"\u7528\u6237\u540D","login.register.password":"\u5BC6\u7801\uFF08\u81F3\u5C116\u4F4D\uFF09","login.register.confirmPassword":"\u786E\u8BA4\u5BC6\u7801","login.register.email":"\u90AE\u7BB1\uFF08\u53EF\u9009\uFF09","login.register.submit":"\u6CE8\u518C","login.register.submitting":"\u6CE8\u518C\u4E2D...","login.register.back":"\u8FD4\u56DE\u767B\u5F55","login.register.success":"\u6CE8\u518C\u6210\u529F\uFF0C\u8BF7\u767B\u5F55","login.register.enterCode":"\u8BF7\u8F93\u5165\u9080\u8BF7\u7801","login.register.usernameMin":"\u7528\u6237\u540D\u81F3\u5C112\u4E2A\u5B57\u7B26","login.register.passwordMin":"\u5BC6\u7801\u81F3\u5C116\u4F4D","login.register.passwordMismatch":"\u4E24\u6B21\u5BC6\u7801\u4E0D\u4E00\u81F4","login.totp.setupTitle":"\u8BBE\u7F6E\u53CC\u56E0\u7D20\u8BA4\u8BC1","login.totp.setupHint":"\u4F7F\u7528 Microsoft Authenticator \u6216 Google Authenticator \u626B\u63CF\u4E0B\u65B9\u4E8C\u7EF4\u7801","login.totp.manualKey":"\u6216\u624B\u52A8\u8F93\u5165\u5BC6\u94A5\uFF1A","login.totp.enterCode":"\u8F93\u51656\u4F4D\u9A8C\u8BC1\u7801","login.totp.complete":"\u5B8C\u6210\u8BBE\u7F6E","login.totp.verifying":"\u9A8C\u8BC1\u4E2D...","login.totp.verify":"\u9A8C\u8BC1","login.totp.prompt":"\u8BF7\u8F93\u5165 Authenticator \u5E94\u7528\u4E2D\u7684\u9A8C\u8BC1\u7801","login.totp.invalidCode":"\u8BF7\u8F93\u51656\u4F4D\u9A8C\u8BC1\u7801","login.email.codeSent":"\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\u81F3 {email}","login.email.enterCode":"\u8F93\u5165\u9A8C\u8BC1\u7801","login.email.verify":"\u9A8C\u8BC1","login.email.verifying":"\u9A8C\u8BC1\u4E2D...","login.email.enterCodeError":"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801","chat.agent.select":"\u9009\u62E9 Agent","chat.agent.manage":"\u7BA1\u7406 Agent","chat.agent.none":"\u6682\u65E0 Agent","chat.agent.restarting":"\u91CD\u542F\u4E2D","chat.agent.restart":"\u91CD\u542F","chat.agent.restartConfirm":`\u786E\u5B9A\u8981\u91CD\u542F Agent "{name}" \u5417\uFF1F
10
+ ${u}`:u),d.status!=="failed"&&d.status!=="closed"&&(d.status=i.status||"idle");break}case"error":i.error&&(d.error=i.error.message||String(i.error));break;default:break}d.updatedAt=Date.now(),this.yeaftSubAgentCards={...this.yeaftSubAgentCards,[r]:d};break}case"history_loaded":{let s={...t,agentId:e.agentId||null,requestId:t.requestId||e.requestId||null};if(s.requestId&&!this.isCurrentYeaftHistoryResponse(s))break;let n=e.agentId||null,i=t.sessionId??null,r=Le(n,i),o=e.perfTraceId||this.yeaftHistoryPerfTraceBySession?.[r];o&&Xe(this,{traceId:o,phase:"history.loaded_event",agentId:e.agentId||null,sessionId:t.sessionId||null,messageType:t.type,detail:{mode:t.mode||"recent",count:t.count||0,hasMore:!!t.hasMore}});let a=t.mode==="delta"?"delta":"recent",l=this.yeaftSessionHistoryState[r]||{},c=Number.isFinite(t.latestSeq)?t.latestSeq:Number.isFinite(l.latestSeq)?l.latestSeq:null,d=a==="delta"?{...l,loaded:!0,loading:!1,latestSeq:c,syncingAfterSeq:null,count:(l.count||0)+(t.count||0)}:{loaded:!0,loading:!1,hasMore:!!t.hasMore,oldestSeq:typeof t.oldestSeq=="number"?t.oldestSeq:null,count:typeof t.count=="number"?t.count:0,latestSeq:c,syncingAfterSeq:null};s.requestId&&this.finishYeaftHistoryLoad(s,d)||(this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[r]:d});let p=Le(n?this.currentAgent:null,this.yeaftActiveSessionFilter??null);if(r===p)a==="recent"&&(this.yeaftHasMoreHistory=d.hasMore,this.yeaftOldestLoadedSeq=d.oldestSeq),this.yeaftLoadingMoreHistory=!1;else if(this.yeaftLoadingMoreHistory){let f=this.yeaftSessionHistoryState[p]||null;this.yeaftLoadingMoreHistory=!!f?.loading}}break;case"vp_snapshot":{let s=window.Pinia?.useVpStore?.()||window.__useVpStore&&window.__useVpStore();s&&s.applySnapshot(t,e.agentId||null,e.requestId||null);break}case"vp_snapshot_error":{let s=window.Pinia?.useVpStore?.()||window.__useVpStore&&window.__useVpStore();s&&s.failSnapshot(e.agentId||null,e.requestId||null,t.error||t.message||"VP library request failed");break}case"vp_updated":{let s=window.Pinia?.useVpStore?.()||window.__useVpStore&&window.__useVpStore();s&&t.vp&&s.upsert(t.vp,t.reason,e.agentId||null);break}case"vp_removed":{let s=window.Pinia?.useVpStore?.()||window.__useVpStore&&window.__useVpStore();s&&t.vpId&&s.remove(t.vpId,t.reason,e.agentId||null);break}case"vp_crud_result":{let s=this._vpCrudPending&&this._vpCrudPending.get(t.requestId);s&&(this._vpCrudPending.delete(t.requestId),s.resolve({ok:!!t.ok,op:t.op,vpId:t.vpId,vp:t.vp,error:t.error||null}));break}case"group_list_updated":case"session_list_updated":case"yeaft_session_hydrate":{let s=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore(),n=t.sessions||[];if(t.type!=="yeaft_session_hydrate"&&this.yeaftSessionHydrateRequestId&&this.yeaftSessionInventoryCompleteSupported===!0){let o=Array.isArray(this.yeaftSessionHydrateSlices)?this.yeaftSessionHydrateSlices.filter(a=>a.agentId!==(e.agentId||null)):[];this.yeaftSessionHydrateSlices=[...o,{agentId:e.agentId||null,sessions:n}];break}let i=s&&s.activeSessionId||null;s&&(s.applySnapshot(n,e.agentId||null),this._hasHandledYeaftSessionHydrate=!0,this.yeaftSessionHydrateError=null);let r=s&&s.activeSessionId||null;if(this.currentView==="yeaft"&&r){let o=Ie(this,r,e.agentId||null),a=Le(o,r),l=this.yeaftSessionHistoryState[a]||null;this.setActiveSessionFilter(r,{agentId:o,force:yl(r,i,l)})}break}case"group_roster_changed":case"session_roster_changed":{let s=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();s&&s.applyRosterChange(t);break}case"group_crud_result":case"session_crud_result":{let s=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();s&&s.applyCrudResult(t,e.agentId||null);let n=this._sessionCrudPending&&this._sessionCrudPending.get(t.requestId);if(n){this._sessionCrudPending.delete(t.requestId);let i=t.session||t.group||null,r=i&&e.agentId&&!i.agentId?{...i,agentId:e.agentId}:i,o=t.sessionId||null,a=t.sessions||null;n.resolve({ok:!!t.ok,op:t.op,session:r,sessionId:o,sessions:a,config:t.config||null,error:t.error||null})}break}case"vp_turn_start":{if(!t.turnId||!t.vpId)break;let s=fo(e.agentId||null,t.turnId)||t.turnId;if(this.activeVpTurns={...this.activeVpTurns,[s]:{agentId:e.agentId||null,turnId:t.turnId,vpId:t.vpId,sessionId:t.sessionId||null,threadId:t.threadId||null,isStreaming:!0,startedAt:t.ts||Date.now()}},t.sessionId){let n=Ht(e.agentId||null,t.sessionId);this.yeaftProcessingSessions={...this.yeaftProcessingSessions,...n?{[n]:!0}:{[t.sessionId]:!0}}}break}case"vp_turn_end":{if(!t.turnId)break;let s=gn(this,e.agentId||null,t.turnId),n=t.sessionId||this.activeVpTurns?.[s]?.sessionId||null;t.reason==="end_turn"&&n&&this.markYeaftSessionUnread(n,e.agentId||null);let{[s]:i,...r}=this.activeVpTurns;this.activeVpTurns=r;let{[s]:o,...a}=this.stoppingVpTurnIds;this.stoppingVpTurnIds=a,this.clearYeaftSessionProcessingIfIdle(t.sessionId||i?.sessionId||null,{agentId:e.agentId||i?.agentId||null});let c={end_turn:"completed",route_forward:"completed",aborted:"aborted",errored:"errored",error:"errored",cancelled:"cancelled",canceled:"cancelled"}[t.reason]||"completed",d=Date.now(),u=e.conversationId||this.yeaftConversationId;if(u&&Array.isArray(this.messagesMap[u])){let p=this.messagesMap[u],f=td(p,t);for(let g=0;g<p.length;g++){let v=p[g];if(!v||v.type!=="assistant")continue;let m=v.sessionId??v.groupId;t.sessionId&&m&&m!==t.sessionId||t.vpId&&v.speakerVpId&&v.speakerVpId!==t.vpId||t.turnId&&v.turnId&&v.turnId!==t.turnId||v.status&&v.status!=="pending"||(v.status=c,v.turnEndAt=d,v.turnEndReason=t.reason||null,t.detail&&(v.turnEndDetail=t.detail),Number.isFinite(t.durationMs)&&(v.turnDurationMs=t.durationMs),f=!0)}f&&(this.messagesMap={...this.messagesMap,[u]:p.slice()})}break}case"yeaft_turn_aborted":{let s=Array.isArray(t.turnIds)?t.turnIds.filter(Boolean):[];t.turnId&&s.push(t.turnId);let n=t.sessionId||null,i=t.vpId||null,r=new Set;for(let c of s){let d=gn(this,e.agentId||null,c),u=this.activeVpTurns?.[d]||null;(!u||ut(u,u.sessionId,e.agentId||null))&&r.add(d)}if(i)for(let[c,d]of Object.entries(this.activeVpTurns||{}))!d||d.vpId!==i||ut(d,n,e.agentId||null)&&r.add(c);if(r.size===0)break;let o=n,a={...this.activeVpTurns||{}},l={...this.stoppingVpTurnIds||{}};for(let c of r){let d=a[c];!o&&d?.sessionId&&(o=d.sessionId),delete a[c],delete l[c]}this.activeVpTurns=a,this.stoppingVpTurnIds=l,this.clearYeaftSessionProcessingIfIdle(o||null,{agentId:e.agentId||null});break}case"yeaft_aborted":{let s=t.sessionId||e.sessionId||null;s?(this.activeVpTurns=Object.fromEntries(Object.entries(this.activeVpTurns||{}).filter(([,n])=>!ut(n,s,e.agentId||null))),this.stoppingVpTurnIds=Object.fromEntries(Object.entries(this.stoppingVpTurnIds||{}).filter(([n])=>this.activeVpTurns?.[n])),this.vpStatuses=Object.fromEntries(Object.entries(this.vpStatuses||{}).filter(([,n])=>!ut(n,s,e.agentId||null))),this.clearYeaftSessionProcessingIfIdle(s,{agentId:e.agentId||null,ignoreStatuses:!0})):t.all&&ld(this,e.agentId||null);break}case"vp_typing_start":{if(!t.vpId)break;let s=e.conversationId||this.yeaftConversationId;if(!s)break;this.yeaftVpTyping=Fc(this.yeaftVpTyping,s,t.vpId);break}case"vp_typing_end":{if(!t.vpId)break;let s=e.conversationId||this.yeaftConversationId;if(!s)break;this.yeaftVpTyping=Hc(this.yeaftVpTyping,s,t.vpId);break}case"vp_status_changed":{if(!t.vpId||!t.state)break;let s=t.sessionId||null,n=e.agentId||null,i=ui(n,s,t.vpId),r={agentId:n,state:t.state,since:t.since||Date.now(),turnId:t.turnId||null,title:t.title||"",sessionId:s,vpId:t.vpId};if(this.vpStatuses={...this.vpStatuses,[i]:r},s&&mi.has(t.state)){let o=Ht(n,s);this.yeaftProcessingSessions={...this.yeaftProcessingSessions,...o?{[o]:!0}:{[s]:!0}}}else s&&this.clearYeaftSessionProcessingIfIdle(s,{agentId:n});this.restoreActiveYeaftSessionFromStatuses([r],n);break}case"vp_status_snapshot":{let s=Array.isArray(t.statuses)?t.statuses:[],n=t.sessionId;if(n==null){let i={...this.vpStatuses||{}};if(e.agentId)for(let[r,o]of Object.entries(i))(!o?.agentId||o.agentId===e.agentId)&&delete i[r];else for(let r of Object.keys(i))delete i[r];for(let r of s){if(!r||!r.vpId)continue;let o=r.sessionId||r.groupId||null,a=ui(e.agentId||null,o,r.vpId);i[a]={agentId:e.agentId||null,state:r.state,since:r.since||Date.now(),turnId:r.turnId||null,title:r.title||"",sessionId:o,vpId:r.vpId}}this.vpStatuses=i}else{let i={...this.vpStatuses};for(let[r,o]of Object.entries(i))o&&o.sessionId===n&&(!e.agentId||!o.agentId||o.agentId===e.agentId)&&delete i[r];for(let r of s){if(!r||!r.vpId)continue;let o=r.sessionId||r.groupId||null,a=ui(e.agentId||null,o,r.vpId);i[a]={agentId:e.agentId||null,state:r.state,since:r.since||Date.now(),turnId:r.turnId||null,title:r.title||"",sessionId:o,vpId:r.vpId}}this.vpStatuses=i}this.yeaftProcessingSessions=$m(this,e.agentId||null,s,n??null),this.restoreActiveYeaftSessionFromStatuses(s,e.agentId||null);break}case"yeaft_dream_snapshot":{let s=t&&t.snapshot,n=s&&typeof s.scope=="string"?s.scope:null;n&&(this.yeaftDreamSnapshots={...this.yeaftDreamSnapshots,[n]:{...s,receivedAt:Date.now()}});break}case"yeaft_dream_status":{let s=window.Pinia?.useVpStore?.()||window.__useVpStore&&window.__useVpStore();s&&s.applyDreamStatus(t);break}case"yeaft_dream_result":{let s=window.Pinia?.useVpStore?.()||window.__useVpStore&&window.__useVpStore();s&&s.applyDreamResult(t),t?.snapshot?.scope&&(this.yeaftDreamSnapshots={...this.yeaftDreamSnapshots,[t.snapshot.scope]:{...t.snapshot,receivedAt:Date.now()}});{let n=typeof t?.snapshot?.scope=="string"&&t.snapshot.scope?t.snapshot.scope:typeof t?.sessionId=="string"&&t.sessionId?`sessions/${t.sessionId}`:null;if(!n)break;let i=this.yeaftDreamLatest[n]||null;this.yeaftDreamLatest={...this.yeaftDreamLatest,[n]:{scope:n,phase:"result",status:t.skipped?"skipped":t.success?"success":"error",startedAt:i?.startedAt??null,finishedAt:Date.now(),mergedCount:typeof t.entriesCreated=="number"?t.entriesCreated:i?.mergedCount??null,error:t.skipped||t.success?null:t.error||"unknown",manual:typeof t?.manual=="boolean"?t.manual:i?.manual??null,durationMs:typeof t.durationMs=="number"?t.durationMs:i?.durationMs??null,llmCallCount:typeof t.llmCallCount=="number"?t.llmCallCount:i?.llmCallCount??0,inputTokens:typeof t.inputTokens=="number"?t.inputTokens:i?.inputTokens??0,outputTokens:typeof t.outputTokens=="number"?t.outputTokens:i?.outputTokens??0,totalTokens:typeof t.totalTokens=="number"?t.totalTokens:i?.totalTokens??0,metrics:t.metrics||i?.metrics||null,passBreakdown:t.passBreakdown||t.metrics?.passBreakdown||i?.passBreakdown||null,isRunning:!1}},this._appendDreamEvent(n,{type:"dream_progress",phase:"result",sessionId:t.sessionId,status:t.skipped?"skipped":t.success?"success":"error",success:!!t.success,entriesCreated:typeof t.entriesCreated=="number"?t.entriesCreated:null,trigger:t.trigger||null,error:t.skipped||t.success?null:t.error||null,skipped:!!t.skipped,skippedReason:t.skippedReason||null,durationMs:typeof t.durationMs=="number"?t.durationMs:null,llmCallCount:typeof t.llmCallCount=="number"?t.llmCallCount:0,inputTokens:typeof t.inputTokens=="number"?t.inputTokens:0,outputTokens:typeof t.outputTokens=="number"?t.outputTokens:0,totalTokens:typeof t.totalTokens=="number"?t.totalTokens:0,metrics:t.metrics||null,passBreakdown:t.passBreakdown||t.metrics?.passBreakdown||null,ts:Date.now()})}break}case"dream_progress":{let s=t?.phase||"unknown",n=null;typeof t?.target=="string"&&t.target.includes("/")?n=t.target:typeof t?.sessionId=="string"&&t.sessionId?n=`sessions/${t.sessionId}`:n="*";let i=s==="done",r=s==="error"||t?.status==="error",o=!i&&!r,a=l=>{let c=this.yeaftDreamLatest[l]||null;return{scope:l,phase:s,status:r?"error":i?"success":"running",startedAt:c?.startedAt&&o?c.startedAt:t?.ts||c?.startedAt||Date.now(),finishedAt:i||r?t?.ts||Date.now():null,mergedCount:typeof t?.mergedCount=="number"?t.mergedCount:typeof t?.targets=="number"?t.targets:c?.mergedCount??null,error:r?t?.error||"unknown":null,manual:typeof t?.manual=="boolean"?t.manual:c?.manual??!1,durationMs:typeof t?.duration=="number"?t.duration:typeof t?.durationMs=="number"?t.durationMs:c?.durationMs??null,llmCallCount:typeof t?.llmCallCount=="number"?t.llmCallCount:c?.llmCallCount??0,inputTokens:typeof t?.inputTokens=="number"?t.inputTokens:c?.inputTokens??0,outputTokens:typeof t?.outputTokens=="number"?t.outputTokens:c?.outputTokens??0,totalTokens:typeof t?.totalTokens=="number"?t.totalTokens:c?.totalTokens??0,metrics:t?.metrics||c?.metrics||null,passBreakdown:t?.passBreakdown||t?.metrics?.passBreakdown||c?.passBreakdown||null,isRunning:o}};if(n==="*"){let l={...this.yeaftDreamLatest,"*":a("*")};for(let c of Object.keys(this.yeaftDreamLatest))c!=="*"&&(l[c]=a(c));this.yeaftDreamLatest=l}else this.yeaftDreamLatest={...this.yeaftDreamLatest,[n]:a(n)};this._appendDreamEvent(n,t);break}}},_appendDreamEvent(e,t){if(!e||!t)return;let s=Date.now(),n={...t,at:s},i=Array.isArray(this.yeaftDreamEvents?.[e])?this.yeaftDreamEvents[e]:[],r=l=>[l?.type||"",l?.phase||"",(l?.sessionId??l?.groupId)||"",l?.target||"",l?.ts||l?.at||""].join("|"),o=r(n);if(i.some(l=>r(l)===o))return;let a=[...i,n];a.length>bd&&a.splice(0,a.length-bd),this.yeaftDreamEvents={...this.yeaftDreamEvents,[e]:a}},fetchExpertRoleDefinitions(){if(this.expertRoleDefinitions)return;let e=this.currentAgent;e&&this.sendWsMessage({type:"get_expert_roles",agentId:e})},setYeaftSidebarEnabled(e){try{typeof localStorage<"u"&&localStorage.removeItem("yeaft-sidebar-enabled")}catch{}},vpCrudRequest(e,t){(!this._vpCrudPending||typeof this._vpCrudPending.get!="function")&&(this._vpCrudPending=new Map);let s="vpc_"+Date.now().toString(36)+"_"+Math.random().toString(36).slice(2,8),i={create:"yeaft_vp_create",update:"yeaft_vp_update",delete:"yeaft_vp_delete",read:"yeaft_vp_read"}[e];if(!i)return Promise.resolve({ok:!1,op:e,error:{code:"bad_op",message:"unknown op: "+e}});let r={type:i,requestId:s};return e==="create"||e==="update"?r.payload=t||{}:r.vpId=t,new Promise(o=>{let a=setTimeout(()=>{this._vpCrudPending&&this._vpCrudPending.has(s)&&(this._vpCrudPending.delete(s),o({ok:!1,op:e,error:{code:"timeout",message:"vp_crud timeout"}}))},1e4);this._vpCrudPending.set(s,{resolve:l=>{clearTimeout(a),o(l)}}),this.sendWsMessage(r)})},sessionCrudRequest(e,t,s={}){(!this._sessionCrudPending||typeof this._sessionCrudPending.get!="function")&&(this._sessionCrudPending=new Map);let n="grc_"+Date.now().toString(36)+"_"+Math.random().toString(36).slice(2,8),r={list:"yeaft_list_sessions",create:"yeaft_create_session",rename:"yeaft_rename_session",update:"yeaft_update_session",update_config:"yeaft_update_session_config",archive:"yeaft_archive_session",delete:"yeaft_delete_session",add_member:"yeaft_session_add_member",remove_member:"yeaft_session_remove_member",set_default_vp:"yeaft_session_set_default_vp",reorder:"reorder_yeaft_sessions",scan_workdir:"yeaft_scan_workdir_sessions",restore:"yeaft_restore_session"}[e];if(!r)return Promise.resolve({ok:!1,op:e,error:{code:"bad_op",message:"unknown op: "+e}});let o={type:r,requestId:n};e==="create"?o.payload=t||{}:t&&typeof t=="object"&&Object.assign(o,t);let a=s&&s.agentId?s.agentId:null;a&&(o.agentId=a);let l=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();return l&&l.markPending(n,e),new Promise(c=>{let d=setTimeout(()=>{this._sessionCrudPending&&this._sessionCrudPending.has(n)&&(this._sessionCrudPending.delete(n),c({ok:!1,op:e,error:{code:"timeout",message:"group_crud timeout"}}))},1e4);this._sessionCrudPending.set(n,{resolve:u=>{clearTimeout(d),c(u)}}),this.sendWsMessage(o)})},markYeaftSessionUnread(e,t=null){if(!e)return!1;let s=Ie(this,e,t);if(!s)return!1;let n=Gn(s,e);return this.currentView==="yeaft"&&this.yeaftActiveSessionFilter===e&&Ie(this,e)===s||this.yeaftUnreadSessionKeys?.[n]?!1:(this.yeaftUnreadSessionKeys={...this.yeaftUnreadSessionKeys,[n]:!0},!0)},markYeaftSessionRead(e,t=null){if(!e)return!1;let s=Ie(this,e,t);if(!s)return!1;let n=Gn(s,e);if(!this.yeaftUnreadSessionKeys?.[n])return!1;let{[n]:i,...r}=this.yeaftUnreadSessionKeys;return this.yeaftUnreadSessionKeys=r,!0},restoreActiveYeaftSessionFromStatuses(e=[],t=null){if(this.yeaftActiveSessionFilter)return null;let n=(Array.isArray(e)?e:[]).filter(o=>o&&(o.sessionId||o.groupId)&&!["idle","offline","completed","failed","aborted"].includes(o.state)).sort((o,a)=>(a.updatedAt||a.since||0)-(o.updatedAt||o.since||0)),i=n[0]?.sessionId||n[0]?.groupId||null;if(!i)return null;let r=t||n[0]?.agentId||wd(this,i);if(!r)return null;this.setActiveSessionFilter(i,{agentId:r,force:!0});try{let o=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();o&&typeof o.setActive=="function"&&o.setActive(i,r)}catch{}return i},setActiveSessionFilter(e,t={}){let s=this.yeaftActiveSessionFilter||null,n=e||null,i=n?Ie(this,n,t.agentId||null):this.currentAgent,r=!!n&&n===s&&!!i&&!!this.currentAgent&&i!==this.currentAgent,o=!!t.force||r;this.yeaftActiveSessionFilter=n;try{n?localStorage.setItem("lastViewedYeaftSession",n):localStorage.removeItem("lastViewedYeaftSession")}catch{}if(i&&n&&this.currentAgent!==i){this.selectAgent(i);let c=this.agents.find(d=>d.id===i);this.activateYeaftAgent(i,c||null)}else i&&n&&this.activateYeaftAgent(i);if(i&&n&&this.markYeaftSessionRead(n,i),!o&&n===s)return;let a=Le(i,n),l=this.yeaftSessionHistoryState[a]||null;if(this.pruneYeaftMessageWindow(n),i&&n){this.yeaftSessionAgentById={...this.yeaftSessionAgentById||{},[n]:i};let c=this.yeaftConversationIdsByAgent?.[i]||null;c||(c=`yeaft-local-${i}-${Date.now()}`,this.yeaftConversationIdsByAgent={...this.yeaftConversationIdsByAgent||{},[i]:c}),this.yeaftConversationId=c,this.messagesMap[c]||(this.messagesMap[c]=[]),this.currentView==="yeaft"&&(this.activeConversations=[c])}try{let c=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();c&&typeof c.setActive=="function"&&c.setActive(n,i||null)}catch{}if(this.syncActiveYeaftHistoryLoad(),!l?.loading&&i&&n){let c=Number.isFinite(l?.latestSeq)?l.latestSeq:null,d={type:"yeaft_load_history",agentId:i,sessionId:n},u=!!l?.loaded,p=Br({sessionState:l,hasCachedSessionRows:!1,force:o});if(!p&&c!==null?d.afterSeq=c:d.limit=pi,!p&&u&&c===null){this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[a]:{...l||{hasMore:!1,oldestSeq:null,count:0},loaded:!0,loading:!1,syncingAfterSeq:null}},this.syncActiveYeaftHistoryLoad();return}let f=null;if(!p&&u){if(l?.syncingAfterSeq===c)return;f=this.beginYeaftHistoryLoad({agentId:i,sessionId:n,mode:"delta",preserveLoaded:!0,latestSeq:c}),this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[a]:{...this.yeaftSessionHistoryState[a],syncingAfterSeq:c}}}else f=this.beginYeaftHistoryLoad({agentId:i,sessionId:n,mode:"recent",preserveLoaded:!1,latestSeq:p?null:c});f&&(d.requestId=f.requestId),this.sendWsMessage(d)}},async switchYeaftModel(e,t=null,s=void 0){if(!e||!this.currentAgent)return;let n=t||null;if(n){let i={model:e};return s!==void 0&&(i.modelEffort=s||null),await this.sessionCrudRequest("update_config",{sessionId:n,config:i},{agentId:Ie(this,n)})}return this.sendWsMessage({type:"yeaft_model_switch",model:e,modelEffort:s||null,agentId:this.currentAgent}),null},setYeaftDebugSearch(e){this.yeaftDebugSearch=typeof e=="string"?e:"",this._yeaftDebugSearchTimer&&clearTimeout(this._yeaftDebugSearchTimer),this._yeaftDebugSearchTimer=setTimeout(()=>{this._yeaftDebugSearchTimer=null,this.yeaftDebugLoops=[],this.yeaftDebugTurnsById={},this.yeaftDebugTurnOrder=[],this.loadYeaftDebugHistory({limit:this.yeaftDebugSearch.trim()?yd:ko,dreamLimit:5,indexOnly:!0,search:this.yeaftDebugSearch})},250)},setYeaftDebugSessionFilter(e){e==null?this.yeaftDebugSessionFilter=null:this.yeaftDebugSessionFilter=String(e)},toggleSubAgentCardExpand(e){let t=this.yeaftSubAgentCards?.[e];t&&(this.yeaftSubAgentCards={...this.yeaftSubAgentCards,[e]:{...t,expanded:!t.expanded}})},loadSearchSettings(){return this.currentAgent?new Promise(e=>{this._searchPending||(this._searchPending={}),this._searchPending.load=e,this.sendWsMessage({type:"get_search_settings",agentId:this.currentAgent})}):(this.searchSettings={backend:"tavily",tavilyKeyConfigured:!1,tavilyKeyMasked:null,disableHtmlFallback:!1,loaded:!0},Promise.resolve(this.searchSettings))},updateSearchSettings(e){return this.currentAgent?new Promise(t=>{this._searchPending||(this._searchPending={}),this._searchPending.update=t,this.sendWsMessage({type:"update_search_settings",agentId:this.currentAgent,settings:e||{}})}):Promise.resolve({error:"no agent"})},loadTavilyUsage(){return this.currentAgent?(this.tavilyUsageLoading=!0,new Promise(e=>{this._searchPending||(this._searchPending={}),this._searchPending.usage=e,this.sendWsMessage({type:"get_tavily_usage",agentId:this.currentAgent})})):Promise.resolve(null)},loadYeaftMcpServers(){if(!this.currentAgent)return this.yeaftMcpServers=[],this.yeaftMcpRuntime={connected:!1,toolCount:0,perServer:[]},Promise.resolve({servers:[],runtime:this.yeaftMcpRuntime});this.yeaftMcpLoading=!0;let e=`mcp-list-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise(t=>{this._mcpPending||(this._mcpPending={}),this._mcpPending[e]=t,this.sendWsMessage({type:"yeaft_mcp_list",agentId:this.currentAgent,requestId:e})})},addYeaftMcpServer(e){if(!this.currentAgent)return Promise.resolve({error:"no agent"});this.yeaftMcpLoading=!0;let t=`mcp-add-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise(s=>{this._mcpPending||(this._mcpPending={}),this._mcpPending[t]=s,this.sendWsMessage({type:"yeaft_mcp_add",agentId:this.currentAgent,requestId:t,server:e||{}})})},removeYeaftMcpServer(e){if(!this.currentAgent)return Promise.resolve({error:"no agent"});this.yeaftMcpLoading=!0;let t=`mcp-rem-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise(s=>{this._mcpPending||(this._mcpPending={}),this._mcpPending[t]=s,this.sendWsMessage({type:"yeaft_mcp_remove",agentId:this.currentAgent,requestId:t,name:e})})},reloadYeaftMcpServer(e){if(!this.currentAgent)return Promise.resolve({error:"no agent"});this.yeaftMcpLoading=!0;let t=`mcp-rel-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise(s=>{this._mcpPending||(this._mcpPending={}),this._mcpPending[t]=s,this.sendWsMessage({type:"yeaft_mcp_reload",agentId:this.currentAgent,requestId:t,name:e||null})})},clearYeaftMessages(){let e=this.yeaftConversationId;e&&(delete this.messagesMap[e],delete this.processingConversations[e],delete this.executionStatusMap[e]),this.yeaftConversationId=this.currentAgent?`yeaft-local-${this.currentAgent}-${Date.now()}`:`yeaft-local-${Date.now()}`,this.currentAgent&&(this.yeaftConversationIdsByAgent={...this.yeaftConversationIdsByAgent||{},[this.currentAgent]:this.yeaftConversationId}),this.messagesMap[this.yeaftConversationId]=[],this.activeConversations=[this.yeaftConversationId],this.yeaftSessionReady=!1,this.yeaftModel=null,this.yeaftAvailableModels=[],this.yeaftStatus=null,this._yeaftAskTerminalEvents={},this.yeaftDebugLoops=[],this.yeaftDebugTurnsById={},this.yeaftDebugTurnOrder=[],this.yeaftDebugHistoryLoading=!1,this.yeaftDebugHistoryError=null,this.yeaftDebugHistoryFetchedAt=0,this.yeaftDebugSearch="",this.yeaftDebugSessionFilter=null,this._yeaftDebugSearchTimer&&(clearTimeout(this._yeaftDebugSearchTimer),this._yeaftDebugSearchTimer=null),this._fetchYeaftDebugHistoryTimer&&(clearTimeout(this._fetchYeaftDebugHistoryTimer),this._fetchYeaftDebugHistoryTimer=null),this._yeaftDebugHistoryInFlightKey=null,this._yeaftDebugHistoryLatestListRequestId=null,this.yeaftReflectionCards={},this.yeaftSubAgentCards={},this.yeaftDreamLatest={},this.yeaftDreamEvents={},this.vpStatuses={},this.currentAgent&&this.sendWsMessage({type:"yeaft_reset",agentId:this.currentAgent})},togglePaneRightPanel(e,t=null){if(t&&this.isSplitMode){let s=this.panels.find(n=>n.id===t);if(s){s.activeRightPanel=s.activeRightPanel===e?null:e;return}}this.activeRightPanel=this.activeRightPanel===e?null:e},getPaneRightPanel(e){if(e&&this.isSplitMode){let t=this.panels.find(s=>s.id===e);if(t)return t.activeRightPanel}return this.activeRightPanel},setPaneRightPanel(e,t){if(e&&this.isSplitMode){let s=this.panels.find(n=>n.id===e);if(s){s.activeRightPanel=t;return}}this.activeRightPanel=t},applySessionCatalogSnapshot(e){let t=new Set;this.sessionCatalog=(Array.isArray(e)?e:[]).filter(s=>!s?.catalogKey||t.has(s.catalogKey)?!1:(t.add(s.catalogKey),!0)),this.sessionCatalogLoaded=!0},toggleCatalogSessionPin(e){if(!e?.catalogKey||!e?.routeRef||Object.keys(this.sessionCatalogMutationRequests).length>0)return!1;let t=`session_ui_${crypto.randomUUID()}`,s=Dr(this,t),n=!e.pinned;return e.pinned=n,this.sendWsMessage({type:"set_session_ui_metadata",requestId:t,catalogKey:e.catalogKey,routeRef:e.routeRef,pinned:n,sortRank:Number.isFinite(e.sortRank)?e.sortRank:null})?!0:(this.sessionCatalog=s,delete this.sessionCatalogMutationRequests[t],!1)},renameCatalogSession({row:e,title:t}={}){if(!e?.routeRef||!t)return!1;let{runtimeProvider:s,agentId:n,sessionId:i}=e.routeRef;if(s==="yeaft")this.sessionCrudRequest("rename",{sessionId:i,name:t},{agentId:n});else if(s==="claude-code"||s==="copilot")this.renameChatSession(i,t,n);else return!1;return!0},reorderCatalogSessions(e){if(!Array.isArray(e)||e.length===0||Object.keys(this.sessionCatalogMutationRequests).length>0)return!1;let t=`session_order_${crypto.randomUUID()}`,s=Dr(this,t);return this.sessionCatalog=e.map((i,r)=>({...i,sortRank:r})),this.sendWsMessage({type:"reorder_session_catalog",requestId:t,sessions:this.sessionCatalog.map((i,r)=>({catalogKey:i.catalogKey,routeRef:i.routeRef,pinned:!!i.pinned,sortRank:r}))})?!0:(this.sessionCatalog=s,delete this.sessionCatalogMutationRequests[t],!1)},finishSessionCatalogMutation(e){return qa(this,e)},openCatalogSession(e){if(!e?.catalogKey||!e.routeRef)return!1;let{runtimeProvider:t,agentId:s,sessionId:n}=e.routeRef;if(this.activeCatalogKey=e.catalogKey,t==="yeaft"){this.enterYeaft(s),this.setActiveSessionFilter(n,{agentId:s,force:!0});try{window.Pinia?.useSessionsStore?.()?.setActive?.(n,s)}catch{}return!0}return t!=="claude-code"&&t!=="copilot"?!1:(this.currentView==="yeaft"&&this.leaveYeaft(),this.selectConversation(n,s),!0)},requestChatHistory(e,{mode:t="recent",turns:s=null,beforeId:n=null,afterMessageId:i=null}={}){if(!e)return null;let r=ws(e);if(this.chatHistoryRequestIdSupported!==!0&&this.chatHistoryRequests[r]?.loading)return null;let o=n??i??null,a=this.beginChatHistoryRequest(e,t,o);return this.sendWsMessage({type:"sync_messages",conversationId:e,...s!=null?{turns:s}:{},...n!=null?{beforeId:n}:{},...i!=null?{afterMessageId:i}:{},requestId:a})?a:(Ba(this,r,a,"send_failed"),null)},beginChatHistoryRequest(e,t="recent",s=null){return Na(this,e,t,s)},isCurrentChatHistoryResponse(e){if(!e?.conversationId||!e?.requestId||!e?.catalogKey)return!1;let t=ws(e.conversationId);if(e.catalogKey!==t)return!1;let s=this.chatHistoryRequests[t];return!!s&&s.loading===!0&&s.requestId===e.requestId&&Number(s.connectionGeneration||0)===Number(this.chatHistoryConnectionGeneration||0)},finishChatHistoryRequest(e){if(!this.isCurrentChatHistoryResponse(e))return!1;let t=this.chatHistoryRequests[e.catalogKey];return this.chatHistoryRequests[e.catalogKey]={...t,loading:!1},!0},isRefreshingSession(e){return e?!!this.refreshingSessionMap[e]:this.refreshingSession},setRefreshingSession(e,t){e&&(this.refreshingSessionMap[e]=t),this.refreshingSession=t},enterBtwMode(){this.btwMode=!0,this.btwMessages=[],this.btwLoading=!1,this.btwSessionId=null},sendBtwQuestion(e){this.currentConversation&&(this.btwMessages.push({role:"user",content:e}),this.btwMessages.push({role:"assistant",content:""}),this.btwLoading=!0,this.sendWsMessage({type:"btw_question",conversationId:this.currentConversation,question:e,btwSessionId:this.btwSessionId}))},closeBtw(){this.btwMode=!1,this.btwMessages=[],this.btwLoading=!1,this.btwSessionId=null},appendBtwDelta(e){let t=this.btwMessages[this.btwMessages.length-1];t&&t.role==="assistant"&&(t.content+=e)},addSubagent(e,t){this.subagents[e]||(this.subagents[e]={}),this.subagents[e][t.id]={id:t.id,slug:t.slug||t.id,type:t.type||"Task",description:t.description||"",parentToolUseId:t.parentToolUseId||null,status:"running",startTime:Date.now(),messages:[],toolCallCount:0},e===this.currentConversation&&this.activeRightPanel!=="subagents"&&(this.activeRightPanel="subagents")},appendSubagentMessage(e,t,s){let n=this.subagents[e];if(!n||!n[t])return;let i=n[t];if(s?.type==="tool"){i.toolCallCount=Number(i.toolCallCount||0)+1;return}s?.type==="text"&&i.messages.push(s)},completeSubagent(e,t){let s=this.subagents[e];!s||!s[t]||(s[t].status="completed")},sendWsMessage(e){return ol(this,e)},parseWsMessage(e){return al(this,e)},connect(){ll(this)},ensureConnected(){return tn(this)},scheduleReconnect(){cl(this)},manualReconnect(){dl(this)},startHeartbeat(){ul(this)},stopHeartbeat(){pl(this)},setupVisibilityHandler(){fl(this)},handleMessage(e){ic(this,e)},getOrCreateExecutionStatus(e){return Jr(this,e)},handleAssistantOutputFrame(e,t){jl(this,e,t)},handleClaudeOutput(e,t){this.handleAssistantOutputFrame(e,t)},addMessageToConversation(e,t){Xn(this,e,t)},appendToAssistantMessageForConversation(e,t,s){wl(this,e,t,s)},finishStreamingForConversation(e,t){kl(this,e,t)},sweepStaleStreamingForConversation(e){Sl(this,e)},appendToAssistantMessage(e){this.appendToAssistantMessageForConversation(this.currentConversation,e)},finishStreaming(){this.finishStreamingForConversation(this.currentConversation)},addMessage(e){this.addMessageToConversation(this.currentConversation,e)},loadHistoryMessages(e){Cl(this,e)},formatDbMessage(e){return Wr(e)},formatDbMessageForHistoryHydration(e){return Al(e)},selectAgent(e){return pc(this,e)},createConversation(e,t=null,s=null,n=void 0){fc(this,e,t,s,n)},resumeConversation(e,t,s=null,n=null,i=null){gc(this,e,t,s,n,i)},selectConversation(e,t){mc(this,e,t)},updateConversationSettings(e,t){no(this,e,t)},toggleConversationMcp(e,t){hc(this,e,t)},deleteConversation(e,t){yc(this,e,t)},closeSession(e,t){vc(this,e,t)},appendColumn(e){Sc(this,e)},removeColumn(e){Cc(this,e)},sendMessageToConversation(e,t,s=[],n={}){Ic(this,e,t,s,n)},cancelExecutionForConversation(e){Ac(this,e)},addPanel(){if(this.panels.length>=3)return;let e=(t,s)=>({id:t,conversationId:s,activeRightPanel:null});if(this.panels.length===0){let t=localStorage.getItem("splitPanesSaved");if(t){try{let s=JSON.parse(t);if(Array.isArray(s)&&s.length>=2){let n=new Set(this.conversations.map(r=>r.id)),i=s.filter(r=>r&&typeof r.id=="string").map(r=>({...e(r.id,null),conversationId:r.conversationId&&n.has(r.conversationId)?r.conversationId:null}));if(i.length>=2){this.panels=i,this.activePanelId=i[0].id;for(let r of i)r.conversationId&&!this.activeConversations.includes(r.conversationId)&&this.activeConversations.push(r.conversationId),r.conversationId&&!this.messagesMap[r.conversationId]&&(this.messagesMap[r.conversationId]=[],this.requestChatHistory(r.conversationId,{mode:"recent",turns:5}));localStorage.removeItem("splitPanesSaved"),this.saveOpenSessions();return}}}catch{}localStorage.removeItem("splitPanesSaved")}this.panels=[e("panel-0",this.currentConversation),e("panel-1",null)],this.activePanelId="panel-0"}else{let t="panel-"+Date.now();this.panels.push(e(t,null))}this.saveOpenSessions()},removePanel(e){let t=this.panels.findIndex(s=>s.id===e);if(!(t<0)){if(this.panels.splice(t,1),this.panels.length<=1){let s=this.panels[0];s?.conversationId&&(this.activeConversations=[s.conversationId]),this.panels=[],this.activePanelId=null}else this.activePanelId===e&&(this.activePanelId=this.panels[0]?.id||null);this.saveOpenSessions()}},setPanelConversation(e,t){let s=this.panels.find(n=>n.id===e);s&&(s.conversationId=t,t&&!this.activeConversations.includes(t)&&this.activeConversations.push(t),t&&!this.messagesMap[t]&&(this.messagesMap[t]=[],this.requestChatHistory(t,{mode:"recent",turns:5})),this.saveOpenSessions())},setActivePanel(e){this.activePanelId=e},splitToPanel(e){if(!e)return;let t=(s,n)=>({id:s,conversationId:n,activeRightPanel:null});if(this.panels.length===0)this.panels=[t("panel-0",this.currentConversation),t("panel-"+Date.now(),e)],this.activePanelId=this.panels[1].id;else if(this.panels.length>=3)this.panels[this.panels.length-1].conversationId=e,this.activePanelId=this.panels[this.panels.length-1].id;else{let s="panel-"+Date.now();this.panels.push(t(s,e)),this.activePanelId=s}this.activeConversations.includes(e)||this.activeConversations.push(e),this.messagesMap[e]||(this.messagesMap[e]=[],this.requestChatHistory(e,{mode:"recent",turns:5})),this.saveOpenSessions()},isInAnyPanel(e){return this.panels.some(t=>t.conversationId===e)},setSessionPinned(e,t,s={}){if(!e)return;let n=s&&s.agentId?s.agentId:null,i=n?!!ss()?.sessionById?.(e,n)?.pinned:this.pinnedSessions.includes(e);if(t&&!i)this.pinnedSessions.unshift(e);else if(!t&&i){let r=this.pinnedSessions.indexOf(e);r>=0&&this.pinnedSessions.splice(r,1)}try{localStorage.setItem("pinned-sessions",JSON.stringify(this.pinnedSessions))}catch{}try{let r=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore(),o=Ie(this,e,n);r&&typeof r.applyPinState=="function"&&r.applyPinState(e,!!t,o)}catch{}},togglePin(e,t={}){let s=t&&t.agentId?t.agentId:null,n=s?ss()?.sessionById?.(e,s):null,i=t&&Object.prototype.hasOwnProperty.call(t,"pinned"),o=!(n?!!n.pinned:i?!!t.pinned:this.pinnedSessions.includes(e));this.setSessionPinned(e,o,{agentId:s});let a={type:o?"pin_session":"unpin_session",conversationId:e};t&&t.sessionKind==="yeaft"&&(a.sessionKind="yeaft",t.agentId&&(a.agentId=t.agentId),t.sessionName&&(a.sessionName=t.sessionName),t.workDir&&(a.workDir=t.workDir)),this.sendWsMessage(a)},isSessionPinned(e){return this.pinnedSessions.includes(e)},applyServerPinSnapshot(e,t,s){if(!Array.isArray(this.pinnedSessions))return;let n=new Set(this.pinnedSessions),i=[];for(let r of t)n.has(r)||i.push(r);if(i.length>0&&(this.pinnedSessions=[...i,...this.pinnedSessions]),e){let r=this.pinnedSessions.filter(o=>s(o)?t.has(o):!0);r.length!==this.pinnedSessions.length&&(this.pinnedSessions=r)}try{localStorage.setItem("pinned-sessions",JSON.stringify(this.pinnedSessions))}catch{}},clearYeaftSessionProcessingIfIdle(e,{agentId:t=null,ignoreStatuses:s=!1}={}){if(!e)return;let n=t||Ie(this,e);if(Object.values(this.activeVpTurns||{}).some(a=>ut(a,e,n))||!s&&Object.values(this.vpStatuses||{}).some(l=>ut(l,e,n)&&mi.has(l?.state)))return;let r=Ht(n,e),o={...this.yeaftProcessingSessions||{}};r&&delete o[r],gi(this,e,n)&&delete o[e],this.yeaftProcessingSessions=o},sendMessage(e,t=[],s={}){bc(this,e,t,s)},cancelExecution(){wc(this)},cancelYeaft(){if(!this.currentAgent)return;this.sendWsMessage({type:"yeaft_abort_all",agentId:this.currentAgent});let e=this.yeaftConversationIdsByAgent?.[this.currentAgent]||this.yeaftConversationId;e&&delete this.processingConversations[e],ld(this,this.currentAgent)},cancelYeaftSession(e){let t=Ie(this,e);!t||!e||(this.sendWsMessage({type:"yeaft_abort_all",agentId:t,sessionId:e}),this.activeVpTurns=Object.fromEntries(Object.entries(this.activeVpTurns||{}).filter(([,s])=>!ut(s,e,t))),this.stoppingVpTurnIds=Object.fromEntries(Object.entries(this.stoppingVpTurnIds||{}).filter(([s])=>this.activeVpTurns?.[s])),this.vpStatuses=Object.fromEntries(Object.entries(this.vpStatuses||{}).filter(([,s])=>!ut(s,e,t))),this.clearYeaftSessionProcessingIfIdle(e,{agentId:t,ignoreStatuses:!0}))},cancelVpTurn(e,{sessionId:t=null,vpId:s=null}={}){let n=Ie(this,t);if(!n||!e)return;let i=gn(this,n,e);this.stoppingVpTurnIds={...this.stoppingVpTurnIds,[i]:Date.now()};let r={type:"yeaft_abort_turn",agentId:n,turnId:e};t&&(r.sessionId=t),s&&(r.vpId=s),this.sendWsMessage(r)},cancelVpTurnForSession(e,t=null){if(!e)return!1;let s=t||this.yeaftActiveSessionFilter||null;if(!s)return!1;let n=Ie(this,s);if(!n)return!1;let i=this.activeVpTurns||{},r=null,o=-1/0;for(let[a,l]of Object.entries(i)){if(!l||l.vpId!==e||!ut(l,s,n))continue;let c=typeof l.startedAt=="number"?l.startedAt:0;c>=o&&(o=c,r=a)}if(!r){let a=this.vpStatuses?.[ui(n,s,e)]||null;a?.turnId&&!["idle","offline"].includes(a.state)&&(r=a.turnId)}if(r){let a=i[r]?.turnId||r;return this.cancelVpTurn(a,{sessionId:s,vpId:e}),!0}return this.sendWsMessage({type:"yeaft_abort_turn",agentId:n,sessionId:s,vpId:e}),!0},answerUserQuestion(e,t,s){kc(this,e,t,s)},refreshAgents(){xc(this)},refreshConversation(){Tc(this)},restartAgent(e){Mc(this,e)},upgradeAgent(e){Pc(this,e)},loadMoreMessages(){if(this.currentView==="yeaft"||this.loadingMoreMessages||!this.hasMoreMessages||!this.currentConversation)return;this.loadingMoreMessages=!0;let e=this._loadMoreGeneration=(this._loadMoreGeneration||0)+1,s=(this.messagesMap[this.currentConversation]||[]).find(r=>r.dbMessageId),n=this.currentConversation,i=s?.dbMessageId??null;this.requestChatHistory(n,{mode:"older",turns:5,beforeId:i}),setTimeout(()=>{this._loadMoreGeneration===e&&this.loadingMoreMessages&&this.currentConversation===n&&(this.loadingMoreMessages=!1)},1e4)},reloadYeaftMessages(){if(this.currentView!=="yeaft")return!1;let e=Ps(this),t=Ie(this,e);if(!t)return!1;let s=Le(t,e),n=this.yeaftConversationId,i=this.beginYeaftHistoryLoad({agentId:t,sessionId:e,mode:"recent",preserveLoaded:!1});if(!i)return!1;let r=on();this.yeaftHistoryPerfTraceBySession={...this.yeaftHistoryPerfTraceBySession||{},[s]:r};let o={type:"yeaft_load_history",agentId:t,limit:pi,sessionId:e,requestId:i.requestId,perfTraceId:r};return Xe(this,{traceId:r,phase:"history.request_send",agentId:t,sessionId:e,messageType:o.type,bytes:JSON.stringify(o).length,detail:{mode:"manual-reload",limit:pi}}),this.sendWsMessage(o),!0},loadMoreYeaftHistory(e=fn()){if(this.currentView!=="yeaft"||this.yeaftLoadingMoreHistory||!this.yeaftHasMoreHistory||this.yeaftOldestLoadedSeq==null)return;let t=Ps(this),s=Ie(this,t);if(!s)return;let n=Math.min(50,Math.max(1,Number.isFinite(e)?Math.floor(e):fn())),i=Le(s,t),r=this.beginYeaftHistoryLoad({agentId:s,sessionId:t,mode:"older",preserveLoaded:!0,latestSeq:this.yeaftSessionHistoryState[i]?.latestSeq??null});if(!r)return;let o=on();this.yeaftHistoryPerfTraceBySession={...this.yeaftHistoryPerfTraceBySession||{},[i]:o};let a={type:"yeaft_load_more_history",agentId:s,sessionId:t,requestId:r.requestId,beforeSeq:this.yeaftOldestLoadedSeq,turns:n,perfTraceId:o};Xe(this,{traceId:o,phase:"history_more.request_send",agentId:s,sessionId:t,messageType:a.type,bytes:JSON.stringify(a).length,detail:{beforeSeq:a.beforeSeq,turns:a.turns}}),this.sendWsMessage(a)},checkPendingRecovery(){Wa(this)},performRecovery(){Ua(this)},dismissRecovery(){za(this)},autoRestoreConversation(e){Ka(this,e)},saveOpenSessions(){Ss(this)},getLastSession(){return ja(this)},clearLastSession(){Ga(this)},listHistorySessions(e){Qa(this,e)},listFolders(){return Xa(this)},listFoldersForAgent(e,t){return Za(this,e,t)},listModelsForAgent(e,t){return Ja(this,e,t)},listHistorySessionsForAgent(e,t,s){el(this,e,t,s)},async loadGlobalSessions(e=20){return tl(this,e)},async deleteGlobalSession(e){return sl(this,e)},findAgentForSession(e){return Lr(this,e)},isSessionResumable(e){return nl(this,e)},_isRecentlyClosed(e){return jt(this,e)},_startProcessingWatchdog(e){Cs(this,e)},_resetProcessingWatchdog(e){Zn(this,e)},_stopProcessingWatchdog(e){Ae(this,e)},startRefreshTimeout(e){let t=e||this.currentConversation;t&&(this._refreshTimeouts||(this._refreshTimeouts={}),this._refreshTimeouts[t]&&clearTimeout(this._refreshTimeouts[t]),this._refreshTimeouts[t]=setTimeout(()=>{this.setRefreshingSession(t,!1),delete this._refreshTimeouts[t]},1e4))},toggleTheme(){this.theme=this.theme==="dark"?"light":"dark",this.themeFollowSystem=!1,localStorage.setItem("theme",this.theme),document.documentElement.setAttribute("data-theme",this.theme),document.documentElement.classList.toggle("light",this.theme==="light")},initTheme(){if(document.documentElement.setAttribute("data-theme",this.theme),document.documentElement.classList.toggle("light",this.theme==="light"),this.themeFollowSystem&&typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),t=s=>{this.themeFollowSystem&&(this.theme=s.matches?"dark":"light",document.documentElement.setAttribute("data-theme",this.theme),document.documentElement.classList.toggle("light",this.theme==="light"))};e.addEventListener?e.addEventListener("change",t):e.addListener&&e.addListener(t)}},loadModelsDevRegistry({forceRefresh:e=!1}={}){let t=this.modelsDevRegistry.loaded&&!this.modelsDevRegistry.error&&Date.now()-this.modelsDevRegistry.fetchedAt<36e5;if(!e&&t)return Promise.resolve(this.modelsDevRegistry);let s=this.currentAgent;if(!s)return Promise.resolve(this.modelsDevRegistry);if(this._modelsDevPending&&(!e||this._modelsDevPending.force))return new Promise(n=>this._modelsDevPending.resolvers.push(n));if(this._modelsDevPending){let n=this._modelsDevPending;this._modelsDevPending=null,n.timer&&clearTimeout(n.timer);for(let i of n.resolvers)i(this.modelsDevRegistry)}return new Promise(n=>{let i={resolvers:[n],force:e,timer:null};this._modelsDevPending=i;try{this.sendWsMessage({type:"get_models_dev_registry",agentId:s,forceRefresh:e})}catch{this._modelsDevPending===i&&(this._modelsDevPending=null),n(this.modelsDevRegistry);return}i.timer=setTimeout(()=>{if(this._modelsDevPending===i){this._modelsDevPending=null;for(let r of i.resolvers)r(this.modelsDevRegistry)}},2e4)})},changeLocale(e){if(this.locale=e,Zs(e),this.currentAgent)try{this.sendWsMessage({type:"update_llm_config",agentId:this.currentAgent,config:{language:e}})}catch{}},async fetchCustomExpertRoles(){let e=Me();try{let t={};e.token&&(t.Authorization=`Bearer ${e.token}`);let s=await fetch("/api/expert-roles/custom",{headers:t});if(s.ok){let n=await s.json();this.customExpertRoles=n.roles||[]}}catch{}},async createCustomExpertRole(e){let t=Me();try{let s={"Content-Type":"application/json"};t.token&&(s.Authorization=`Bearer ${t.token}`);let n=await fetch("/api/expert-roles/custom",{method:"POST",headers:s,body:JSON.stringify(e)});if(n.ok){let i=await n.json();return this.customExpertRoles.push(i.role),i.role}else{let i=await n.json().catch(()=>({}));throw new Error(i.error||"Failed to create custom expert role")}}catch(s){throw s}},async updateCustomExpertRole(e,t){let s=Me();try{let n={"Content-Type":"application/json"};s.token&&(n.Authorization=`Bearer ${s.token}`);let i=await fetch(`/api/expert-roles/custom/${e}`,{method:"PUT",headers:n,body:JSON.stringify(t)});if(i.ok){let r=await i.json(),o=this.customExpertRoles.findIndex(a=>a.id===e);return o!==-1&&(this.customExpertRoles[o]=r.role),r.role}else{let r=await i.json().catch(()=>({}));throw new Error(r.error||"Failed to update custom expert role")}}catch(n){throw n}},async deleteCustomExpertRole(e){let t=Me();try{let s={};t.token&&(s.Authorization=`Bearer ${t.token}`);let n=await fetch(`/api/expert-roles/custom/${e}`,{method:"DELETE",headers:s});if(n.ok)return this.customExpertRoles=this.customExpertRoles.filter(i=>i.id!==e),!0;{let i=await n.json().catch(()=>({}));throw new Error(i.error||"Failed to delete custom expert role")}}catch(s){throw s}},toggleWorkbench(){this.workbenchExpanded=!this.workbenchExpanded,this.workbenchExpanded||(this.workbenchMaximized=!1)},toggleSidebar(){this.sidebarCollapsed=!this.sidebarCollapsed},toggleSessionSidebar(){this.sessionSidebarOpen=!this.sessionSidebarOpen},closeSessionSidebar(){this.sessionSidebarOpen=!1},toggleWorkbenchMaximized(){this.workbenchMaximized=!this.workbenchMaximized},renameChatSession(e,t,s=null){let n=t&&t.trim()?t.trim():"";n?this.customConversationTitles[e]=n:delete this.customConversationTitles[e],this.sendWsMessage({type:"update_conversation_settings",conversationId:e,...s?{agentId:s}:{},title:n})},openFileInExplorer(e){this.currentConversation&&(this.workbenchExpanded=!0,window.dispatchEvent(new CustomEvent("open-file-in-explorer",{detail:{filePath:e,conversationId:this.currentConversation}})))},logout(){Me().logout(),this.authenticated=!1,this.sessionKey=null,this.agents=[],this.currentAgent=null,this.currentAgentInfo=null,this.yeaftStatusByAgent={},this._yeaftRetiredCatalogEpochsByAgent={},this.conversations=[],this.activeConversations=[],this.messagesMap={},this.conversationTitles={},this.customConversationTitles={},this.processingConversations={},this.executionStatusMap={},this.workbenchExpanded=!1,this.subagents={},this.activeSubagentId=null,this.activeRightPanel=null,this.pinnedSessions=[],this.ws&&this.ws.close()}}})});function Io(e,t){!e||typeof e.handleYeaftOutput!="function"||!t||e.handleYeaftOutput({event:t})}function jm(e){let t=String(e||""),s=2166136261;for(let n=0;n<t.length;n++)s^=t.charCodeAt(n),s=Math.imul(s,16777619)>>>0;return s>>>0}function xo(e){if(!e)return Ot[0];let t=String(e).toLowerCase();return Ym[t]||Ot[jm(t)%Ot.length]}function Gm(e){return xo(e).background}function Qm(e){return xo(e).foreground}function Ao(){let e=typeof window<"u"&&window.Pinia&&window.Pinia.useChatStore?window.Pinia.useChatStore():null;return e&&typeof e.locale=="string"?e.locale:typeof localStorage<"u"&&localStorage.getItem("locale")||""}function Xm(e,t=""){return e?String(t||"").startsWith("zh")?e.descriptionZh||e.roleZh||e.description||e.role||"":e.description||e.role||e.descriptionZh||e.roleZh||"":""}var Km,Ot,Ym,yb,ht,Rs=H(()=>{({defineStore:Km}=Pinia);Ot=[{key:"rat",label:"Rat",glyph:"R",background:"var(--vp-avatar-rat-bg)",foreground:"var(--vp-avatar-rat-fg)"},{key:"ox",label:"Ox",glyph:"O",background:"var(--vp-avatar-ox-bg)",foreground:"var(--vp-avatar-ox-fg)"},{key:"tiger",label:"Tiger",glyph:"T",background:"var(--vp-avatar-tiger-bg)",foreground:"var(--vp-avatar-tiger-fg)"},{key:"rabbit",label:"Rabbit",glyph:"B",background:"var(--vp-avatar-rabbit-bg)",foreground:"var(--vp-avatar-rabbit-fg)"},{key:"dragon",label:"Dragon",glyph:"D",background:"var(--vp-avatar-dragon-bg)",foreground:"var(--vp-avatar-dragon-fg)"},{key:"snake",label:"Snake",glyph:"S",background:"var(--vp-avatar-snake-bg)",foreground:"var(--vp-avatar-snake-fg)"},{key:"horse",label:"Horse",glyph:"H",background:"var(--vp-avatar-horse-bg)",foreground:"var(--vp-avatar-horse-fg)"},{key:"goat",label:"Goat",glyph:"G",background:"var(--vp-avatar-goat-bg)",foreground:"var(--vp-avatar-goat-fg)"},{key:"monkey",label:"Monkey",glyph:"M",background:"var(--vp-avatar-monkey-bg)",foreground:"var(--vp-avatar-monkey-fg)"},{key:"rooster",label:"Rooster",glyph:"K",background:"var(--vp-avatar-rooster-bg)",foreground:"var(--vp-avatar-rooster-fg)"},{key:"dog",label:"Dog",glyph:"D",background:"var(--vp-avatar-dog-bg)",foreground:"var(--vp-avatar-dog-fg)"},{key:"pig",label:"Pig",glyph:"P",background:"var(--vp-avatar-pig-bg)",foreground:"var(--vp-avatar-pig-fg)"}],Ym=Object.freeze({steve:Ot[8],ada:Ot[3],linus:Ot[0],martin:Ot[4]}),yb=Ot.map(e=>e.background);ht=Km("vp",{state:()=>({vps:{},vpOrder:[],emptyLibrary:!1,lastSnapshotAt:0,snapshotStatus:"idle",snapshotAgentId:null,snapshotRequestId:null,snapshotError:"",lastVpSnapshotAgentId:null,lastChange:null,dreamStatus:{},groupDreamStatus:{}}),getters:{vpList(e){return e.vpOrder.map(t=>e.vps[t]).filter(Boolean)},vpCount(e){return e.vpOrder.length},vpById:e=>t=>e.vps[t]||null,vpLabel:e=>t=>{let s=e.vps[t];return s?Ao().startsWith("zh")&&s.displayNameZh?s.displayNameZh:s.displayName||s.vpId||t:t},vpDescription:e=>t=>Xm(e.vps[t],Ao()),vpInitial:e=>t=>{let s=e.vps[t],n=Ao().startsWith("zh"),i=s&&(s.avatar||n&&s.displayNameZh||s.displayName||s.vpId)||t||"?";return String(i).charAt(0).toUpperCase()||"?"},vpColor:e=>t=>{let s=e.vps[t];return s&&s.color?s.color:Gm(t)},vpTextColor:()=>e=>Qm(e),vpAvatarMotif:()=>e=>xo(e),dreamStatusFor:e=>t=>e.dreamStatus[t]||{status:"idle",lastRunAt:null,lastResult:null,lastError:null},groupDreamStatusFor:e=>t=>e.groupDreamStatus[t]||{status:"idle",lastRunAt:null,lastResult:null,lastError:null}},actions:{applySnapshot(e,t=null,s=null){let n=this.snapshotAgentId||null;if(n&&t&&t!==n||s&&this.snapshotRequestId&&s!==this.snapshotRequestId)return!1;let i=e&&Array.isArray(e.vps)?e.vps:[];return this._setActiveSnapshot({vps:i,emptyLibrary:!!(e&&e.emptyLibrary),agentId:t||n||null,requestId:s||this.snapshotRequestId||null,receivedAt:Date.now()}),!0},beginSnapshot(e,t){this.vps={},this.vpOrder=[],this.emptyLibrary=!1,this.lastVpSnapshotAgentId=null,this.snapshotStatus="loading",this.snapshotAgentId=e||null,this.snapshotRequestId=t||null,this.snapshotError=""},failSnapshot(e,t,s=""){return!this.snapshotRequestId||!t||t!==this.snapshotRequestId||e&&this.snapshotAgentId&&e!==this.snapshotAgentId?!1:(this.snapshotStatus="error",this.snapshotAgentId=e||this.snapshotAgentId||null,this.snapshotRequestId=t||this.snapshotRequestId||null,this.snapshotError=String(s||"VP library request failed"),!0)},_setActiveSnapshot({vps:e,emptyLibrary:t,agentId:s,requestId:n,receivedAt:i}){this.vps={},this.vpOrder=[];for(let r of e||[])this._upsertInternal(r);this.emptyLibrary=!!t,this.lastSnapshotAt=i||Date.now(),this.lastVpSnapshotAgentId=s||null,this.snapshotStatus="ready",this.snapshotAgentId=s||null,this.snapshotRequestId=n||null,this.snapshotError=""},upsert(e,t=null,s=null){return s&&this.snapshotAgentId&&s!==this.snapshotAgentId?!1:(this._upsertInternal(e),e&&e.vpId&&(this.lastChange={vpId:e.vpId,kind:"updated",reason:t||null,at:Date.now()}),!0)},remove(e,t=null,s=null){return s&&this.snapshotAgentId&&s!==this.snapshotAgentId||!e?!1:(delete this.vps[e],this.vpOrder=this.vpOrder.filter(n=>n!==e),this.lastChange={vpId:e,kind:"removed",reason:t||"file.removed",at:Date.now()},!0)},_upsertInternal(e){if(!e||!e.vpId)return;let t=!!this.vps[e.vpId];this.vps[e.vpId]={...this.vps[e.vpId]||{},...e},t||this.vpOrder.push(e.vpId),this.emptyLibrary&&(this.emptyLibrary=!1)},triggerDream(e){if(!e)return;this.dreamStatus={...this.dreamStatus,[e]:{...this.dreamStatus[e]||{},status:"running",lastError:null}};let t=window.Pinia&&window.Pinia.useChatStore?window.Pinia.useChatStore():null;t&&typeof t.sendWsMessage=="function"&&t.sendWsMessage({type:"yeaft_dream_trigger",vpId:e})},triggerGroupDream(e,t={}){if(!e)return;this.groupDreamStatus={...this.groupDreamStatus,[e]:{...this.groupDreamStatus[e]||{},status:"running",lastError:null}};let s=window.Pinia&&window.Pinia.useChatStore?window.Pinia.useChatStore():null,n=Date.now();if(Io(s,{type:"dream_progress",phase:"start",groupId:e,manual:!0,trigger:"manual",source:"header-button",ts:n}),!s||typeof s.sendWsMessage!="function"){Io(s,{type:"yeaft_dream_result",groupId:e,success:!1,skipped:!0,skippedReason:"chat-store-unavailable",trigger:"manual",error:null});return}let i={type:"yeaft_dream_trigger",sessionId:e},r=t&&t.agentId?t.agentId:typeof s.agentIdForSession=="function"?s.agentIdForSession(e):s.currentAgent;r&&(i.agentId=r),s.sendWsMessage(i)===!1&&Io(s,{type:"yeaft_dream_result",groupId:e,success:!1,skipped:!0,skippedReason:"websocket-not-open",trigger:"manual",error:null})},applyDreamStatus(e){if(!e)return;let t=e.sessionId;if(t){this.groupDreamStatus={...this.groupDreamStatus,[t]:{...this.groupDreamStatus[t]||{},status:e.status==="running"?"running":e.status||"idle"}};return}if(!e.vpId)return;let s=e.vpId;this.dreamStatus={...this.dreamStatus,[s]:{...this.dreamStatus[s]||{},status:e.status==="running"?"running":e.status||"idle"}}},applyDreamResult(e){if(!e)return;let t=!!e.success,s=!!e.skipped,n={mergedCount:e.mergedCount??null,extractedCount:e.extractedCount??null,entriesCreated:typeof e.entriesCreated=="number"?e.entriesCreated:e.mergedCount??e.extractedCount??0,skipped:s,skippedReason:e.skippedReason||null,sessionsProcessed:typeof e.sessionsProcessed=="number"?e.sessionsProcessed:null,sessionsSkipped:typeof e.sessionsSkipped=="number"?e.sessionsSkipped:null,targetsApplied:typeof e.targetsApplied=="number"?e.targetsApplied:null,durationMs:typeof e.durationMs=="number"?e.durationMs:null,llmCallCount:typeof e.llmCallCount=="number"?e.llmCallCount:0,inputTokens:typeof e.inputTokens=="number"?e.inputTokens:0,outputTokens:typeof e.outputTokens=="number"?e.outputTokens:0,totalTokens:typeof e.totalTokens=="number"?e.totalTokens:0,metrics:e.metrics||null,passBreakdown:e.passBreakdown||e.metrics?.passBreakdown||null,targetErrors:Array.isArray(e.targetErrors)?e.targetErrors:[]},i=t||s?null:e.error||null,r=s?"skipped":t?"success":"error",o=e.sessionId;if(o){this.groupDreamStatus={...this.groupDreamStatus,[o]:{status:r,lastRunAt:Date.now(),lastResult:n,lastError:i}};return}if(!e.vpId)return;let a=e.vpId;this.dreamStatus={...this.dreamStatus,[a]:{status:r,lastRunAt:Date.now(),lastResult:n,lastError:i}}}}})});function To(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e){let t=Date.parse(e);if(Number.isFinite(t))return t}return 0}function vi(e){return!e||typeof e!="object"?0:To(e.lastMessageAt)||To(e.updatedAt)||To(e.createdAt)||0}function Mo(e,t){let s=vi(t)-vi(e);return s!==0?s:String(e?.id||"").localeCompare(String(t?.id||""))}function Cd(e){return[...Array.isArray(e)?e:[]].sort(Mo)}var yi=H(()=>{});function Id(){try{if(typeof localStorage>"u")return{};let e=JSON.parse(localStorage.getItem(Md)||"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function Zm(e){try{typeof localStorage<"u"&&localStorage.setItem(Md,JSON.stringify(e&&typeof e=="object"?e:{}))}catch{}}function Ad(){try{return typeof localStorage>"u"?[]:hn(JSON.parse(localStorage.getItem(Pd)||"[]"))}catch{return[]}}function Jm(e){try{typeof localStorage<"u"&&localStorage.setItem(Pd,JSON.stringify(hn(e)))}catch{}}function Rd(e,t){return`${e||""}${t||""}`}function It(e){return e&&e.agentId&&e.id?Rd(e.agentId,e.id):""}function vt(e,t){return t?e?Rd(e,t):String(t):""}function eh(e){return typeof e=="string"?e:String(e||"")}function it(e,t,s=null){let n=eh(t);if(!n)return"";let i=vt(s,n);if(i&&e.sessions[i])return i;if(e.sessions[n])return n;if(e.activeSessionKey&&e.sessions[e.activeSessionKey]?.id===n)return e.activeSessionKey;let r=e.sessionOrder.filter(a=>e.sessions[a]?.id===n);if(s){let a=r.find(l=>e.sessions[l]?.agentId===s);if(a)return a}let o=_o();if(o?.currentAgent){let a=r.find(l=>e.sessions[l]?.agentId===o.currentAgent);if(a)return a}return r[0]||""}function Po(e,t,s=null){return it(e,t,s)||""}function hn(e){let t=[],s=new Set;for(let n of Array.isArray(e)?e:[]){let i=typeof n=="string"?n:String(n||"");!i||s.has(i)||(s.add(i),t.push(i))}return t}function Ro(e,t){let s=hn(e),n=new Set(s),i=hn(t).filter(o=>n.has(o)),r=new Set(i);return[...i,...s.filter(o=>!r.has(o))]}function bi(e,t=!1){return!e||typeof e!="object"?!!t:Object.prototype.hasOwnProperty.call(e,"pinned")?e.pinned===!0:Object.prototype.hasOwnProperty.call(e,"isPinned")?e.isPinned===!0:!!t}function xd(e){return!e||typeof e!="object"?!1:e.running===!0||e.active===!0||e.isActive===!0||e.isRunning===!0}function Td(e){if(!e||typeof e!="object")return 0;let t=e.latestActivityAt||e.lastActivityAt||e.lastMessageAt||e.updatedAt||0;if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"&&t){let s=Date.parse(t);return Number.isFinite(s)?s:0}return 0}function _o(){try{if(typeof window<"u"&&window.Pinia&&typeof window.Pinia.useChatStore=="function")return window.Pinia.useChatStore()}catch{}return null}var Md,Pd,th,_d,Dd=H(()=>{yi();Md="yeaft-session-order-by-agent",Pd="yeaft-session-order-global";({defineStore:th}=Pinia);_d=th("sessions",{state:()=>({sessions:{},sessionOrder:[],activeSessionId:null,activeSessionKey:null,lastSnapshotAt:0,lastCrudResult:null,pending:{}}),getters:{sessionList(e){let t=e.sessionOrder.map(d=>e.sessions[d]).filter(Boolean),s=_o(),n=s&&Array.isArray(s.pinnedSessions)?new Set(s.pinnedSessions):new Set;for(let d of t)d&&d.id&&d.pinned&&n.add(d.id);let i=[],r=[];for(let d of t)d.pinned||!d.agentId&&n.has(d.id)?i.push(d):r.push(d);let o=d=>[...d].sort((u,p)=>{let f=Number.isFinite(u?.sortOrder)?u.sortOrder:Number.MAX_SAFE_INTEGER,g=Number.isFinite(p?.sortOrder)?p.sortOrder:Number.MAX_SAFE_INTEGER;return f!==g?f-g:Mo(u,p)}),a=[...o(i),...o(r)],l=Ad();if(l.length===0)return a;let c=new Map(l.map((d,u)=>[d,u]));return a.sort((d,u)=>{let p=c.has(It(d))?c.get(It(d)):Number.MAX_SAFE_INTEGER,f=c.has(It(u))?c.get(It(u)):Number.MAX_SAFE_INTEGER;return p!==f?p-f:0})},sessionCount(e){return e.sessionOrder.length},sessionById:e=>(t,s=null)=>{let n=it(e,t,s);return n&&e.sessions[n]||null},activeSession(e){return e.activeSessionKey&&e.sessions[e.activeSessionKey]||null},hasLoadedSnapshot(e){return e.lastSnapshotAt>0},isEmpty(e){return e.sessionOrder.length===0},activeNeedsInvite(e){let t=e.activeSessionKey?e.sessions[e.activeSessionKey]:null;return t?!t.defaultVpId&&(!Array.isArray(t.roster)||t.roster.length===0):!1}},actions:{applySnapshot(e,t=null){let s=Array.isArray(e)?e:[];if(t){let m={...this.sessions},A=new Set;for(let R of s){if(!R||!R.id)continue;let L=vt(t,R.id);A.add(L),m[L]=this._normalize(R,t,bi(this.sessions[L]))}for(let R of this.sessionOrder){let L=this.sessions[R];L&&L.agentId===t&&!A.has(R)&&delete m[R]}let w=this.sessionOrder.filter(R=>m[R]),k=new Set(w),y=[];for(let R of s){if(!R||!R.id)continue;let L=vt(t,R.id);m[L]&&!k.has(L)&&y.push(L)}this.sessions=m;let h=[...w,...y],b=Ad();if(b.length>0){let R=new Map(h.map(_=>[It(m[_]),_]).filter(([_])=>_)),L=b.map(_=>R.get(_)).filter(Boolean),U=new Set(L);h=[...L,...h.filter(_=>!U.has(_))];let $=new Map(b.map((_,P)=>[_,P]));for(let _ of h){let P=It(m[_]);P&&$.has(P)&&(m[_]={...m[_],sortOrder:$.get(P)})}}if(t&&b.length===0){let R=Id(),L=hn(R[t]);if(L.length>0){let U=L.map(M=>vt(t,M)),$=new Set(U),_=Ro(h.filter(M=>m[M]?.agentId===t),U),P=this.sessionOrder.some(M=>m[M]?.agentId===t),T=0;P?h=this.sessionOrder.filter(M=>m[M]).map(M=>m[M]?.agentId===t?_[T++]:M).concat(_.slice(T)):h=h.map(M=>m[M]?.agentId===t?_[T++]:M);let I=new Map(U.map((M,B)=>[M,B]));for(let M of _)m[M]&&$.has(M)&&(m[M]={...m[M],sortOrder:I.get(M)})}}this.sessionOrder=h}else{if(Object.values(this.sessions).some(k=>k&&k.agentId))return;let A={},w=[];for(let k of s){if(!k||!k.id)continue;let y=vt(null,k.id);A[y]=this._normalize(k,null,bi(this.sessions[y])),w.push(y)}this.sessions=A,this.sessionOrder=w}this.lastSnapshotAt=Date.now();let n=null;try{n=localStorage.getItem("lastViewedYeaftSession")||null}catch{}let i=n?it(this,n,t):"",r=i?this.sessions[i]:null,o=r&&(!t||r.agentId===t),a=this.sessionOrder.filter(m=>this.sessions[m]&&(!t||this.sessions[m].agentId===t)&&this.sessions[m].running).sort((m,A)=>Td(this.sessions[A])-Td(this.sessions[m]))[0]||null,l=a?this.sessions[a]?.id:null,c=this.sessionList[0]||null,d=c?.id||null,u=d?it(this,d,c?.raw?.agentId||null):"",p=l||(o?n:null)||d,f=a||(o?i:"")||u||Po(this,p,t),g=this.activeSessionKey?this.sessions[this.activeSessionKey]?.agentId:null;this.activeSessionId&&!it(this,this.activeSessionId,g)?(this.activeSessionId=p,this.activeSessionKey=f||null):!this.activeSessionId&&this.sessionOrder.length>0?(this.activeSessionId=p,this.activeSessionKey=f||null):this.activeSessionId&&(this.activeSessionKey=Po(this,this.activeSessionId,g)||this.activeSessionKey);let v=_o();if(v){if(t){let w={...v.yeaftSessionAgentById||{}};for(let k of s)k&&k.id&&!w[k.id]&&(w[k.id]=t);v.yeaftSessionAgentById=w}let m=this.activeSessionId||p,A=null;(v.yeaftActiveSessionFilter&&!it(this,v.yeaftActiveSessionFilter)||!v.yeaftActiveSessionFilter&&m)&&(A=m),A&&(v.currentView==="yeaft"&&typeof v.setActiveSessionFilter=="function"?v.setActiveSessionFilter(A,{force:!0}):v.yeaftActiveSessionFilter=A,this.activeSessionKey=Po(this,A)||this.activeSessionKey)}if(v&&typeof v.applyServerPinSnapshot=="function"){let m=new Set;for(let w of s){if(!w||!w.id)continue;let k=vt(t,w.id),y=this.sessions[k];y&&y.pinned&&m.add(w.id)}let A=w=>{let k=it(this,w,t),y=k?this.sessions[k]:null;return y?y.agentId===t:!1};v.applyServerPinSnapshot(t,m,A)}},applyRosterChange(e){if(!e)return;let t=e.sessionId||e.groupId;if(!t)return;let s=e.agentId||null,n=it(this,t,s)||vt(s,t),i=this.sessions[n];if(!i){let r=this._normalize({id:t,name:e.name||t,roster:Array.isArray(e.roster)?e.roster:[],defaultVpId:e.defaultVpId||null},s);this.sessions[n]=r,this.sessionOrder.push(n);return}this.sessions[n]={...i,name:e.name||i.name,roster:Array.isArray(e.roster)?e.roster.slice():i.roster,defaultVpId:e.defaultVpId!=null?e.defaultVpId:i.defaultVpId,announcement:typeof e.announcement=="string"?e.announcement:i.announcement}},applyCrudResult(e,t=null){if(!e)return;this.lastCrudResult={...e,at:Date.now()},e.requestId&&this.pending[e.requestId]&&delete this.pending[e.requestId],e.ok&&e.op==="list"&&Array.isArray(e.sessions)&&this.applySnapshot(e.sessions,t);let s=e.session||e.group||null;e.ok&&e.op==="create"&&s&&s.id&&(this.applySnapshotUpsert(s,t),this.setActive(s.id,t));let n=e.sessionId||e.groupId,i=n?it(this,n,t):"";if(e.ok&&(e.op==="archive"||e.op==="delete")&&n&&(i&&delete this.sessions[i],this.sessionOrder=this.sessionOrder.filter(r=>r!==i),(this.activeSessionKey===i||this.activeSessionId===n)&&(this.activeSessionKey=this.sessionOrder[0]||null,this.activeSessionId=this.activeSessionKey&&this.sessions[this.activeSessionKey]?.id||null)),e.ok&&e.op==="update_config"&&n){let r=i?this.sessions[i]:null;r&&(this.sessions[i]={...r,config:e.config&&typeof e.config=="object"?{...e.config}:{}})}},applySnapshotUpsert(e,t=null){if(!e||!e.id)return;let s=t||e.agentId||null,n=it(this,e.id,s)||vt(s,e.id),i=!!this.sessions[n],r=this.sessions[n]||{};this.sessions[n]={...r,...this._normalize(e,s,bi(r))},i||this.sessionOrder.push(n)},setActive(e,t=null){let s=it(this,e,t);e&&s&&this.sessions[s]?(this.activeSessionId=e,this.activeSessionKey=s):(this.activeSessionId=null,this.activeSessionKey=null)},reorderSessionsForAgent(e,t){if(!e)return[];let s=this.sessionOrder.filter(l=>this.sessions[l]?.agentId===e),n=Ro(s,t.map(l=>vt(e,l)));if(n.length===0)return[];let i=new Map(n.map((l,c)=>[l,c])),r=0;this.sessionOrder=this.sessionOrder.map(l=>this.sessions[l]?.agentId===e?n[r++]:l);for(let l of n)this.sessions[l]={...this.sessions[l],sortOrder:i.get(l)};let o=Id(),a=n.map(l=>this.sessions[l]?.id).filter(Boolean);return o[e]=a,Zm(o),a},reorderSessionsGlobally(e){let t=this.sessionOrder.map(a=>It(this.sessions[a])).filter(Boolean),s=Ro(t,e);if(s.length===0)return[];let n=new Map(this.sessionOrder.map(a=>[It(this.sessions[a]),a]).filter(([a])=>a)),i=s.map(a=>n.get(a)).filter(Boolean),r=new Set(i);this.sessionOrder=[...i,...this.sessionOrder.filter(a=>!r.has(a))];let o=new Map(s.map((a,l)=>[a,l]));for(let a of this.sessionOrder){let l=It(this.sessions[a]);l&&o.has(l)&&(this.sessions[a]={...this.sessions[a],sortOrder:o.get(l)})}return Jm(s),s.map(a=>{let l=n.get(a),c=l?this.sessions[l]:null;return c?{agentId:c.agentId,sessionId:c.id}:null}).filter(Boolean)},applyPinState(e,t,s=null){let n=it(this,e,s);!e||!n||!this.sessions[n]||(this.sessions[n]={...this.sessions[n],pinned:!!t})},markPending(e,t){e&&(this.pending[e]=t)},clearLastResult(){this.lastCrudResult=null},resetInventory(){this.sessions={},this.sessionOrder=[],this.activeSessionId=null,this.activeSessionKey=null,this.lastSnapshotAt=0},beginInventoryCommit(e=null,t=null){this.resetInventory(),e&&(this.activeSessionId=e,this.activeSessionKey=vt(t,e)||e)},_normalize(e,t=null,s=!1){return{id:e.id,name:e.name||e.id,roster:Array.isArray(e.roster)?e.roster.slice():[],defaultVpId:e.defaultVpId||null,announcement:typeof e.announcement=="string"?e.announcement:"",config:e.config&&typeof e.config=="object"?{...e.config}:{},workDir:typeof e.workDir=="string"?e.workDir:"",createdAt:e.createdAt||null,updatedAt:e.updatedAt||null,lastMessageAt:e.lastMessageAt||null,running:xd(e),active:xd(e),runningVpCount:Number.isFinite(Number(e.runningVpCount))?Number(e.runningVpCount):0,latestActivityAt:e.latestActivityAt||e.lastActivityAt||e.lastMessageAt||null,agentId:t||e.agentId||null,pinned:bi(e,s),sortOrder:Number.isFinite(e.sortOrder)?e.sortOrder:null}}}})});function wi(){try{if(window.Pinia&&typeof window.Pinia.useAuthStore=="function")return window.Pinia.useAuthStore()}catch{}return null}function Do(){try{return localStorage.getItem("authToken")||null}catch{return null}}function $d(){let e=wi();if(e)try{return e.getActiveToken?.()||e.token||Do()}catch{return e.token||Do()}return Do()}function nh(e,t){if(!e)return!1;let s=$d();if(s&&s!==t)return!1;try{localStorage.setItem("authToken",e)}catch{}let n=wi();return n&&(n.token=e),!0}function ih(e){try{let t=typeof e=="string"?e:e?.url;return!t||typeof window>"u"||!window.location?null:new URL(t,window.location.href)}catch{return null}}function Ld(e){return!e||typeof window>"u"||!window.location?!1:e.origin===window.location.origin&&e.pathname.startsWith("/api/")}function rh(e){if(!e)return!1;let t=e.pathname;return!!(sh.has(t)||t.startsWith("/api/auth/sso/poll/")||/^\/api\/auth\/sso\/[^/]+\/start(?:-qr)?$/.test(t))}function oh(e,t){return t?.headers?new Headers(t.headers):e&&typeof e=="object"&&e.headers?new Headers(e.headers):new Headers}function ah(e){let t=e.get("Authorization");return!t||!t.startsWith("Bearer ")?null:t.slice(7)}function lh(e,t){return{...e||{},headers:t}}function ch(e,t,s,n){let i=wi();i&&typeof i.handleAuthResponse=="function"?i.handleAuthResponse(e,t,s,n):i&&typeof i.handleAuthFailure=="function"&&n&&i.handleAuthFailure(void 0,t,s)}function Vd(){if(Ed||typeof window>"u"||!window.fetch)return;Ed=!0;let e=window.fetch.bind(window);window.fetch=async function(s,n){let i=ih(s),r=Ld(i)&&!rh(i),o=Ld(i)?{...n||{},credentials:"same-origin"}:n,a=null,l=r?wi():null,c=l?.authGeneration,d=!!l?.isAuthenticated;if(r){let p=oh(s,n);a=ah(p),a||(a=$d(),a&&(p.set("Authorization",`Bearer ${a}`),o=lh(o,p)))}let u=await e(s,o);try{let p=u.headers&&u.headers.get&&u.headers.get("X-New-Token");p&&nh(p,a),r&&u.status===401&&ch(u,a,c,d)}catch{}return u}}var Ed,sh,Fd=H(()=>{Ed=!1,sh=new Set(["/api/auth/mode","/api/auth/login","/api/auth/aad","/api/auth/verify","/api/auth/verify-totp","/api/auth/setup-totp","/api/auth/register","/api/auth/password-reset/request","/api/auth/password-reset/verify"])});var Hd,Od=H(()=>{Hd={"common.loading":"\u52A0\u8F7D\u4E2D...","common.confirm":"\u786E\u5B9A","common.apply":"\u5E94\u7528","common.cancel":"\u53D6\u6D88","common.delete":"\u5220\u9664","common.copy":"\u590D\u5236","common.copied":"\u5DF2\u590D\u5236","common.close":"\u5173\u95ED","common.refresh":"\u5237\u65B0","common.open":"\u6253\u5F00","common.save":"\u4FDD\u5B58","common.search":"\u641C\u7D22","common.back":"\u8FD4\u56DE","common.noSubdirectories":"\u65E0\u5B50\u76EE\u5F55","common.drives":"\u9A71\u52A8\u5668","common.rootDir":"\u6839\u76EE\u5F55","common.comma":"\uFF0C","common.select":"\u9009\u62E9","mermaid.export":"\u5BFC\u51FA","mermaid.exportMd":"\u5BFC\u51FA MD","mermaid.exportPng":"\u5BFC\u51FA PNG","mermaid.exportJpg":"\u5BFC\u51FA JPG","chat.toolActionsOmitted":"\u5DF2\u7701\u7565 {count} \u4E2A\u5386\u53F2\u5DE5\u5177\u52A8\u4F5C","login.subtitle":"Yeaft Web Code Agent","login.username":"\u7528\u6237\u540D","login.password":"\u5BC6\u7801","login.login":"\u767B\u5F55","login.loggingIn":"\u767B\u5F55\u4E2D...","login.enterUsername":"\u8BF7\u8F93\u5165\u7528\u6237\u540D","login.enterPassword":"\u8BF7\u8F93\u5165\u5BC6\u7801","login.noAccount":"\u6CA1\u6709\u8D26\u53F7\uFF1F","login.registerWithCode":"\u6CE8\u518C\u65B0\u8D26\u53F7","login.or":"\u6216","login.usePassword":"\u4F7F\u7528\u8D26\u53F7\u5BC6\u7801\u767B\u5F55","login.useSso":"\u8FD4\u56DE\u5355\u70B9\u767B\u5F55","login.noProviders":"\u7BA1\u7406\u5458\u5C1A\u672A\u542F\u7528\u4EFB\u4F55\u7B2C\u4E09\u65B9\u767B\u5F55\u3002","login.microsoft":"\u4F7F\u7528 Microsoft \u8D26\u53F7\u767B\u5F55","login.github":"\u4F7F\u7528 GitHub \u8D26\u53F7\u767B\u5F55","login.google":"\u4F7F\u7528 Google \u8D26\u53F7\u767B\u5F55","login.wechat":"\u4F7F\u7528\u5FAE\u4FE1\u626B\u7801\u767B\u5F55","login.alipay":"\u4F7F\u7528\u652F\u4ED8\u5B9D\u8D26\u53F7\u767B\u5F55","login.wechat.mobileUnsupported":"\u5FAE\u4FE1\u767B\u5F55\u6682\u4EC5\u652F\u6301\u7535\u8111\u7AEF\uFF0C\u8BF7\u5728\u7535\u8111\u6D4F\u89C8\u5668\u4E2D\u626B\u7801\u767B\u5F55\u3002","login.alipay.mobileWaiting":"\u6B63\u5728\u7B49\u5F85\u4F60\u5728\u652F\u4ED8\u5B9D\u4E2D\u786E\u8BA4\u2026 \u5B8C\u6210\u540E\u8FD4\u56DE\u672C\u9875\u9762\u5C06\u81EA\u52A8\u767B\u5F55\u3002","login.alipay.relaunch":"\u91CD\u65B0\u6253\u5F00\u652F\u4ED8\u5B9D","login.qr.title":"\u626B\u7801\u767B\u5F55","login.qr.titleAlipay":"\u652F\u4ED8\u5B9D\u626B\u7801\u767B\u5F55","login.qr.titleWechat":"\u5FAE\u4FE1\u626B\u7801\u767B\u5F55","login.qr.hint":"\u8BF7\u4F7F\u7528\u624B\u673A\u626B\u63CF\u4E8C\u7EF4\u7801\u5B8C\u6210\u6388\u6743","login.error.enterUsername":"\u8BF7\u8F93\u5165\u7528\u6237\u540D","login.error.enterPassword":"\u8BF7\u8F93\u5165\u5BC6\u7801","login.error.enter6Digit":"\u8BF7\u8F93\u51656\u4F4D\u9A8C\u8BC1\u7801","login.error.enterInviteCode":"\u8BF7\u8F93\u5165\u9080\u8BF7\u7801","login.error.usernameMinLen":"\u7528\u6237\u540D\u81F3\u5C112\u4E2A\u5B57\u7B26","login.error.passwordMinLen":"\u5BC6\u7801\u81F3\u5C116\u4F4D","login.error.passwordMismatch":"\u4E24\u6B21\u5BC6\u7801\u4E0D\u4E00\u81F4","login.error.enterVerifyCode":"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801","login.error.loginFailed":"\u767B\u5F55\u5931\u8D25","login.forgot.link":"\u5FD8\u8BB0\u5BC6\u7801\uFF1F","login.forgot.title":"\u91CD\u7F6E\u5BC6\u7801","login.forgot.emailHint":"\u8F93\u5165\u8D26\u6237\u7ED1\u5B9A\u7684\u90AE\u7BB1\uFF0C\u6211\u4EEC\u5C06\u53D1\u9001 6 \u4F4D\u91CD\u7F6E\u9A8C\u8BC1\u7801\u3002","login.forgot.sendCode":"\u53D1\u9001\u91CD\u7F6E\u9A8C\u8BC1\u7801","login.forgot.sending":"\u53D1\u9001\u4E2D...","login.forgot.codeSent":"\u5982\u679C\u90AE\u7BB1\u5DF2\u6CE8\u518C\uFF0C\u91CD\u7F6E\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\u3002\u8BF7\u5728\u4E0B\u65B9\u8F93\u5165\u9A8C\u8BC1\u7801\u4E0E\u65B0\u5BC6\u7801\u3002","login.forgot.resetBtn":"\u91CD\u7F6E\u5BC6\u7801","login.forgot.resetting":"\u91CD\u7F6E\u4E2D...","login.forgot.success":"\u5BC6\u7801\u5DF2\u91CD\u7F6E\uFF0C\u53EF\u4EE5\u4F7F\u7528\u65B0\u5BC6\u7801\u767B\u5F55\u3002","login.forgot.emailInvalid":"\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1","login.register.title":"\u65B0\u7528\u6237\u6CE8\u518C","login.register.inviteCode":"\u9080\u8BF7\u7801","login.register.username":"\u7528\u6237\u540D","login.register.password":"\u5BC6\u7801\uFF08\u81F3\u5C116\u4F4D\uFF09","login.register.confirmPassword":"\u786E\u8BA4\u5BC6\u7801","login.register.email":"\u90AE\u7BB1\uFF08\u53EF\u9009\uFF09","login.register.submit":"\u6CE8\u518C","login.register.submitting":"\u6CE8\u518C\u4E2D...","login.register.back":"\u8FD4\u56DE\u767B\u5F55","login.register.success":"\u6CE8\u518C\u6210\u529F\uFF0C\u8BF7\u767B\u5F55","login.register.enterCode":"\u8BF7\u8F93\u5165\u9080\u8BF7\u7801","login.register.usernameMin":"\u7528\u6237\u540D\u81F3\u5C112\u4E2A\u5B57\u7B26","login.register.passwordMin":"\u5BC6\u7801\u81F3\u5C116\u4F4D","login.register.passwordMismatch":"\u4E24\u6B21\u5BC6\u7801\u4E0D\u4E00\u81F4","login.totp.setupTitle":"\u8BBE\u7F6E\u53CC\u56E0\u7D20\u8BA4\u8BC1","login.totp.setupHint":"\u4F7F\u7528 Microsoft Authenticator \u6216 Google Authenticator \u626B\u63CF\u4E0B\u65B9\u4E8C\u7EF4\u7801","login.totp.manualKey":"\u6216\u624B\u52A8\u8F93\u5165\u5BC6\u94A5\uFF1A","login.totp.enterCode":"\u8F93\u51656\u4F4D\u9A8C\u8BC1\u7801","login.totp.complete":"\u5B8C\u6210\u8BBE\u7F6E","login.totp.verifying":"\u9A8C\u8BC1\u4E2D...","login.totp.verify":"\u9A8C\u8BC1","login.totp.prompt":"\u8BF7\u8F93\u5165 Authenticator \u5E94\u7528\u4E2D\u7684\u9A8C\u8BC1\u7801","login.totp.invalidCode":"\u8BF7\u8F93\u51656\u4F4D\u9A8C\u8BC1\u7801","login.email.codeSent":"\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\u81F3 {email}","login.email.enterCode":"\u8F93\u5165\u9A8C\u8BC1\u7801","login.email.verify":"\u9A8C\u8BC1","login.email.verifying":"\u9A8C\u8BC1\u4E2D...","login.email.enterCodeError":"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801","chat.agent.select":"\u9009\u62E9 Agent","chat.agent.manage":"\u7BA1\u7406 Agent","chat.agent.none":"\u6682\u65E0 Agent","chat.agent.restarting":"\u91CD\u542F\u4E2D","chat.agent.restart":"\u91CD\u542F","chat.agent.restartConfirm":`\u786E\u5B9A\u8981\u91CD\u542F Agent "{name}" \u5417\uFF1F
11
11
  \u6240\u6709\u6D3B\u8DC3\u7684\u4F1A\u8BDD\u5C06\u88AB\u4E2D\u65AD\u3002`,"chat.agent.upgrade":"\u5347\u7EA7","chat.agent.upgrading":"\u5347\u7EA7\u4E2D","chat.agent.upgradeConfirm":`\u5347\u7EA7 Agent "{name}" \u5230\u6700\u65B0\u7248\u672C\uFF1F
12
- \u5347\u7EA7\u5B8C\u6210\u540E Agent \u4F1A\u81EA\u52A8\u91CD\u542F\u3002`,"chat.agent.alreadyLatest":"Agent \u5DF2\u662F\u6700\u65B0\u7248\u672C (v{version})\uFF0C\u65E0\u9700\u5347\u7EA7\u3002","chat.agent.nodeIncompatible":"Agent \u5347\u7EA7\u4E2D\u6B62\uFF1A\u76EE\u6807\u7248\u672C v{version} \u9700\u8981 Node {required}\uFF0C\u4F46\u5F53\u524D\u673A\u5668\u8FD0\u884C\u7684\u662F Node {current}\u3002\u8BF7\u5148\u5347\u7EA7 Node.js \u518D\u91CD\u8BD5\u3002","chat.agent.online":"{count} \u4E2A Agent \u5728\u7EBF","chat.agent.selectFirst":"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A Agent","chat.agent.yeaft":"Yeaft \u5BF9\u8BDD","sidebar.toggle.chat":"\u5207\u6362\u5230 Chat","sidebar.toggle.yeaft":"\u5207\u6362\u5230 Yeaft","sidebar.surface.label":"\u4FA7\u680F\u89C6\u56FE","sidebar.surface.sessions":"\u4F1A\u8BDD","sidebar.provider.label":"\u4F1A\u8BDD Provider","sidebar.provider.claude":"Claude","sidebar.sessions.new":"\u65B0\u5EFA\u4F1A\u8BDD","sidebar.sessions.emptyProvider":"\u6B64 Provider \u6682\u65E0\u4F1A\u8BDD","yeaft.back":"\u8FD4\u56DE","yeaft.session.people":"\u6210\u5458","yeaft.session.peopleEmpty":"\u6682\u65E0\u6210\u5458","yeaft.session.runningTasks":"\u8FD0\u884C\u4E2D\u7684\u4EFB\u52A1","yeaft.session.tasksEmpty":"\u6682\u65E0\u8FD0\u884C\u4EFB\u52A1","yeaft.session.owner":"\u8D1F\u8D23\u4EBA","yeaft.session.started":"\u5F00\u59CB\u65F6\u95F4","yeaft.breadcrumb.label":"Thread \u8FC7\u6EE4","yeaft.breadcrumb.mainStream":"\u4E3B\u6D41","yeaft.breadcrumb.backHint":"\u8FD4\u56DE\u5168\u6D41 (Esc)","yeaft.featureDetail.ariaLabel":"Task \u8BE6\u60C5","yeaft.featureDetail.replyTo":"\u56DE\u590D\u5230:","yeaft.featureDetail.forkHint":"\u8BE5 task \u6682\u65E0\u6D3B\u8DC3 thread \u2014 \u8BF7 fork \u65B0 thread \u540E\u56DE\u590D\u3002","yeaft.featureDetail.empty":"\u8BE5 task \u6682\u65E0\u6D88\u606F\u3002","yeaft.featureDetail.threadPillHint":"\u6253\u5F00 thread","yeaft.featureDetail.summary.aria":"\u4EFB\u52A1\u6458\u8981\u65F6\u95F4\u7EBF","yeaft.featureDetail.summary.title":"\u6458\u8981\u65F6\u95F4\u7EBF","yeaft.featureDetail.summary.loading":"\u6B63\u5728\u52A0\u8F7D\u6458\u8981\u5386\u53F2\u2026","yeaft.featureDetail.summary.empty":"\u6682\u65E0\u6458\u8981\u3002","yeaft.featureDetail.summary.error":"\u6458\u8981\u52A0\u8F7D\u5931\u8D25\uFF1A{error}","yeaft.featureDetail.summary.showArchived":"\u663E\u793A\u5DF2\u5F52\u6863","yeaft.featureDetail.related.aria":"\u5173\u8054\u4EFB\u52A1","yeaft.featureDetail.related.title":"\u5173\u8054\u4EFB\u52A1","yeaft.featureDetail.related.unlink":"\u53D6\u6D88\u5173\u8054","yeaft.featureDetail.members.aria":"\u4EFB\u52A1\u6210\u5458","yeaft.featureDetail.members.title":"\u6210\u5458","yeaft.featureDetail.members.abort":"\u4E2D\u6B62","yeaft.featureDetail.members.kick":"\u8E22\u51FA","yeaft.model":"\u6A21\u578B","yeaft.placeholder":"\u95EE\u6211\u4EFB\u4F55\u95EE\u9898...","yeaft.inbox":"\u6536\u4EF6\u7BB1","yeaft.inbox.tooltip":"\u4F60\u7684\u9ED8\u8BA4\u5BF9\u8BDD\u7EBF\u7A0B \u2014\u2014 \u4E0E Yeaft \u7684\u4E00\u5BF9\u4E00\u804A\u5929\u3002\u53EF\u4EE5\u4E3A\u5177\u4F53\u8BDD\u9898\u6216\u4EFB\u52A1\u521B\u5EFA\u65B0\u7EBF\u7A0B\u3002","yeaft.sidebar.activeThreads":"\u6D3B\u8DC3","yeaft.sidebar.idleThreads":"\u9759\u9ED8","yeaft.sidebar.archivedThreads":"\u5DF2\u5F52\u6863","yeaft.sidebar.tasks":"\u4EFB\u52A1","yeaft.sidebar.emptyActive":"\u6682\u65E0\u6D3B\u8DC3 thread","yeaft.sidebar.emptyIdle":"\u6682\u65E0\u9759\u9ED8 thread","yeaft.sidebar.emptyArchived":"\u6682\u65E0\u5F52\u6863 thread","yeaft.sidebar.emptyTasks":"\u65E0\u5339\u914D\u4EFB\u52A1","yeaft.sidebar.results":"\u641C\u7D22\u7ED3\u679C","yeaft.sidebar.resultsThreads":"Threads","yeaft.sidebar.kindThread":"thread","yeaft.sidebar.cancel":"\u53D6\u6D88","yeaft.sidebar.mergeInto":"\u5408\u5E76\u5230\u2026","yeaft.sidebar.mergeNoCandidates":"\u6CA1\u6709\u53EF\u5408\u5E76\u7684\u5176\u4ED6\u7EBF\u7A0B","yeaft.sidebar.mergeConfirmTitle":"\u5408\u5E76\u8FD9\u4E2A\u7EBF\u7A0B\uFF1F","yeaft.sidebar.mergeIrreversible":"\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\uFF0C\u6E90\u7EBF\u7A0B\u5C06\u88AB\u5F52\u6863\uFF0C\u5176\u6D88\u606F\u4F1A\u88AB\u79FB\u52A8\u5230\u76EE\u6807\u7EBF\u7A0B\u3002","yeaft.sidebar.mergeConfirm":"\u5408\u5E76","yeaft.settings.sidebarV2":"\u5B9E\u9A8C\u529F\u80FD\uFF1A\u4FA7\u8FB9\u680F V2","yeaft.settings.sidebarV2Hint":"Thread \u5217\u8868 + \u4EFB\u52A1\u6811\uFF08\u9884\u89C8\uFF09\u3002","yeaft.clearConfirm":"\u6E05\u7A7A\u6240\u6709\u6D88\u606F\uFF1F","yeaft.mode":"\u6A21\u5F0F","yeaft.agent":"\u667A\u80FD\u4F53","yeaft.connecting":"\u8FDE\u63A5\u4E2D...","yeaft.ready":"\u5C31\u7EEA","yeaft.tools":"\u4E2A\u5DE5\u5177","yeaft.skills":"\u4E2A\u6280\u80FD","yeaft.mcp":"\u4E2A MCP","yeaft.showSidebar":"\u663E\u793A\u4FA7\u680F","yeaft.hideSidebar":"\u9690\u85CF\u4FA7\u680F","yeaft.debug":"\u8C03\u8BD5","yeaft.debugClose":"\u5173\u95ED\u8C03\u8BD5\u9762\u677F","yeaft.debugTurns":"\u8F6E","yeaft.debugTabToolStats":"\u5DE5\u5177\u7EDF\u8BA1","yeaft.debugTabDream":"Dream","yeaft.debugTabRequestLog":"\u8BF7\u6C42\u65E5\u5FD7","yeaft.debugHistoryLoad":"\u52A0\u8F7D\u8BF7\u6C42\u5386\u53F2","yeaft.debugHistoryLoading":"\u52A0\u8F7D\u4E2D...","yeaft.debugHistoryLoaded":"\u5DF2\u52A0\u8F7D {count} \u6761","yeaft.debugSearchPlaceholder":"\u6B63\u5219\u641C\u7D22\u8BF7\u6C42\u65E5\u5FD7","yeaft.debugSearchHint":"\u9ED8\u8BA4\u663E\u793A\u5168\u5C40\u6700\u8FD1 10 \u6761\uFF1B\u641C\u7D22\u4F1A\u8DE8 Session \u5339\u914D\u8BF7\u6C42\u6458\u8981\u3002","yeaft.dreamDebug.title":"Dream \u751F\u547D\u5468\u671F","yeaft.dreamDebug.trigger":"\u89E6\u53D1","yeaft.dreamDebug.status":"\u72B6\u6001","yeaft.dreamDebug.started":"\u5F00\u59CB","yeaft.dreamDebug.finished":"\u7ED3\u675F","yeaft.dreamDebug.time":"\u65F6\u95F4","yeaft.dreamDebug.phase":"\u9636\u6BB5","yeaft.dreamDebug.call":"\u8C03\u7528","yeaft.dreamDebug.location":"\u751F\u6210\u4F4D\u7F6E","yeaft.dreamDebug.result":"\u7ED3\u679C","yeaft.dreamDebug.noLatest":"\u8FD9\u4E2A\u4F1A\u8BDD\u8FD8\u6CA1\u6709\u8BB0\u5F55\u5230 Dream \u68C0\u67E5\u3002","yeaft.dreamDebug.noEvents":"\u8FD9\u4E2A\u4F1A\u8BDD\u8FD8\u6CA1\u6709 Dream \u4E8B\u4EF6\u3002","yeaft.dreamDebug.outputTitle":"\u672C session \u5DF2\u52A0\u8F7D\u7684 Dream \u8F93\u51FA","yeaft.dreamDebug.scope":"Scope","yeaft.dreamDebug.lastDream":"\u4E0A\u6B21 Dream","yeaft.dreamDebug.messagesCovered":"\u5DF2\u8986\u76D6\u6D88\u606F\u6570","yeaft.dreamDebug.noOutput":"\u8FD9\u4E2A session \u8FD8\u6CA1\u6709\u5199\u5165 Dream \u8F93\u51FA\u3002","yeaft.dreamDebug.promptLoadTitle":"\u5DF2\u52A0\u8F7D\u8FDB system prompt \u7684 Dream \u8BB0\u5FC6","yeaft.dreamDebug.loadedInto":"\u52A0\u8F7D\u4F4D\u7F6E","yeaft.dreamDebug.vp":"VP","yeaft.dreamDebug.summaryToPrompt":"summary.md -> system prompt","yeaft.dreamDebug.itemList":"Dream \u8FD0\u884C\u548C Scope","yeaft.dreamDebug.searchPlaceholder":"\u6309\u6807\u9898\u3001ID \u6216\u6458\u8981\u641C\u7D22 Dream Session...","yeaft.dreamDebug.noSearchResults":"\u6CA1\u6709\u5339\u914D\u7684 Dream Session\u3002","yeaft.dreamDebug.noSummary":"\u6682\u65E0\u6458\u8981","yeaft.dreamDebug.segments":"\u6BB5","yeaft.dreamDebug.lastError":"\u6700\u8FD1\u9519\u8BEF","yeaft.dreamDebug.overview":"\u6982\u89C8","yeaft.dreamDebug.sessionId":"Session ID","yeaft.dreamDebug.loadedAt":"\u52A0\u8F7D\u65F6\u95F4","yeaft.dreamDebug.layers":"\u5C42\u7EA7","yeaft.dreamDebug.summaryLayer":"Resident summary","yeaft.dreamDebug.noPromptLoad":"\u8FD9\u4E2A scope \u6682\u65E0 prompt-load \u8BB0\u5F55\u3002","yeaft.dreamDebug.segmentTitle":"Segments","yeaft.dreamDebug.sourceMessages":"\u6765\u6E90\u6D88\u606F","yeaft.dreamDebug.createdAt":"\u521B\u5EFA\u65F6\u95F4","yeaft.dreamDebug.updatedAt":"\u66F4\u65B0\u65F6\u95F4","yeaft.dreamDebug.noSegments":"\u8FD9\u4E2A scope \u6682\u65E0 memory segments\u3002","yeaft.dreamDebug.requestResponse":"Request / Response","yeaft.dreamDebug.noRequestResponse":"\u8FD9\u4E2A scope \u8FD8\u6CA1\u6709\u6301\u4E45\u5316\u7684 Dream request/response \u65E5\u5FD7\u3002","yeaft.dreamDebug.empty":"\u6682\u65E0 Dream debug \u6570\u636E\u3002","yeaft.debugGroupFollowMain":"\u8DDF\u968F\u4E3B\u9762\u677F","yeaft.debugGroupAll":"\u5168\u90E8\u4F1A\u8BDD","yeaft.debugAssistantResponse":"Assistant \u56DE\u590D","yeaft.debugViewAssistantResponse":"\u67E5\u770B\u56DE\u590D","yeaft.debugToolInput":"\u8F93\u5165","yeaft.debugToolResult":"\u7ED3\u679C","yeaft.debugToolRunning":"\u6267\u884C\u4E2D","yeaft.debugToolRunningNoResult":"\u6267\u884C\u4E2D\uFF0C\u6682\u65E0\u7ED3\u679C","yeaft.debugShowDetails":"\u5C55\u5F00","yeaft.debugHideDetails":"\u6536\u8D77","yeaft.debugTurnStartedAt":"\u56DE\u5408\u5F00\u59CB\u65F6\u95F4","yeaft.debugRequestAt":"\u8BF7\u6C42\u65F6\u95F4","yeaft.debugRequestAtDerived":"\u7531\u56DE\u5408\u5F00\u59CB\u65F6\u95F4\u63A8\u7B97\uFF08\u65E7 loop\uFF09","yeaft.turn":"\u7B2C {n} \u8F6E","yeaft.systemPrompt":"\u7CFB\u7EDF\u63D0\u793A","yeaft.messagesLabel":"\u6D88\u606F","yeaft.response":"\u56DE\u590D","yeaft.toolCalls":"\u5DE5\u5177\u8C03\u7528","yeaft.functionCalls":"\u51FD\u6570\u8C03\u7528","yeaft.request":"\u8BF7\u6C42","yeaft.pending":"(\u7B49\u5F85\u4E2D)","yeaft.inputTokens":"\u8F93\u5165","yeaft.outputTokens":"\u8F93\u51FA","yeaft.duration":"\u8017\u65F6","yeaft.noDebugData":"\u6682\u65E0\u8C03\u8BD5\u6570\u636E","yeaft.showDebug":"\u663E\u793A\u8C03\u8BD5\u9762\u677F","yeaft.hideDebug":"\u9690\u85CF\u8C03\u8BD5\u9762\u677F","yeaft.reloadPage":"\u5237\u65B0\u9875\u9762","yeaft.reloadMessages":"\u91CD\u65B0\u52A0\u8F7D\u6D88\u606F","yeaft.historySearch.label":"\u641C\u7D22 Session \u5386\u53F2\u6D88\u606F","yeaft.historySearch.button":"\u641C\u7D22\u6D88\u606F","yeaft.historySearch.placeholder":"\u641C\u7D22\u5F53\u524D Session \u7684\u6D88\u606F","yeaft.historySearch.searching":"\u6B63\u5728\u641C\u7D22\u2026","yeaft.historySearch.minChars":"\u81F3\u5C11\u8F93\u5165 2 \u4E2A\u5B57\u7B26","yeaft.historySearch.empty":"\u6CA1\u6709\u5339\u914D\u7684\u6D88\u606F","yeaft.historySearch.error":"\u641C\u7D22\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5","yeaft.historySearch.unsupported":"\u8BF7\u5347\u7EA7\u5F53\u524D Agent \u540E\u518D\u641C\u7D22 Session \u5386\u53F2\u6D88\u606F","yeaft.historySearch.more":"\u52A0\u8F7D\u66F4\u591A\u7ED3\u679C","yeaft.historySearch.you":"\u4F60","yeaft.historySearch.assistant":"\u52A9\u624B","yeaft.outline.label":"\u5386\u53F2\u6D88\u606F","yeaft.outline.sender":"\u53D1\u9001\u8005","yeaft.outline.allSenders":"\u5168\u90E8\u53D1\u9001\u8005","yeaft.outline.title":"\u5386\u53F2\u6D88\u606F","yeaft.outline.placeholder":"\u641C\u7D22\u5F53\u524D\u5BF9\u8BDD","yeaft.outline.searching":"\u6B63\u5728\u641C\u7D22\u2026","yeaft.outline.loading":"\u6B63\u5728\u52A0\u8F7D\u2026","yeaft.outline.older":"\u52A0\u8F7D\u66F4\u65E9\u6D88\u606F","yeaft.outline.moreMatches":"\u52A0\u8F7D\u66F4\u591A\u5339\u914D\u9879","yeaft.outline.minChars":"\u81F3\u5C11\u8F93\u5165 2 \u4E2A\u5B57\u7B26","yeaft.outline.empty":"\u6682\u65E0\u6D88\u606F","yeaft.outline.noMatches":"\u6CA1\u6709\u5339\u914D\u7684\u6D88\u606F","yeaft.outline.error":"\u5927\u7EB2\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5","yeaft.outline.unsupported":"\u8BF7\u5347\u7EA7\u5F53\u524D Agent \u540E\u518D\u4F7F\u7528\u5BF9\u8BDD\u5927\u7EB2","yeaft.outline.you":"\u4F60","yeaft.outline.assistant":"\u52A9\u624B","yeaft.outline.nonText":"\u975E\u6587\u672C\u56DE\u590D","yeaft.switchModel":"\u5207\u6362\u6A21\u578B","yeaft.modelMenu.title":"\u6A21\u578B\u548C LLM \u8BBE\u7F6E","yeaft.modelMenu.label":"\u6A21\u578B","yeaft.modelMenu.effort":"\u63A8\u7406\u5F3A\u5EA6","yeaft.modelMenu.effort.openaiReasoning":"\u63A8\u7406\u5F3A\u5EA6","yeaft.modelMenu.effort.anthropicBudget":"\u601D\u8003\u9884\u7B97","yeaft.modelMenu.effort.anthropicAdaptive":"\u81EA\u9002\u5E94\u601D\u8003\u5F3A\u5EA6","yeaft.modelMenu.effort.minimal":"\u6700\u5C0F","yeaft.modelMenu.effort.low":"\u4F4E","yeaft.modelMenu.effort.medium":"\u4E2D","yeaft.modelMenu.effort.high":"\u9AD8","yeaft.modelMenu.effort.xhigh":"\u8D85\u9AD8","yeaft.modelMenu.effort.max":"\u6700\u9AD8","yeaft.modelMenu.noEffort":"\u5F53\u524D\u6A21\u578B\u6CA1\u6709\u53EF\u517C\u5BB9\u6620\u5C04\u7684\u63A8\u7406\u5F3A\u5EA6\u63A7\u5236\u3002","yeaft.modelMenu.configureHint":"Provider\u3001\u5BC6\u94A5\u3001\u6A21\u578B\u5217\u8868","yeaft.settings.title":"\u8BBE\u7F6E","yeaft.settings.tabs.vp":"VP \u5E93","yeaft.settings.tabs.search":"\u641C\u7D22","search.settings.backendTitle":"\u641C\u7D22\u540E\u7AEF","search.settings.backendDesc":"\u9009\u62E9 WebSearch \u5DE5\u5177\u9ED8\u8BA4\u4F7F\u7528\u7684\u540E\u7AEF\u3002\u4E3B\u540E\u7AEF\u5931\u8D25\u65F6,\u5F15\u64CE\u4F1A\u81EA\u52A8\u964D\u7EA7\u5230 HTML \u6293\u53D6\u3002","search.settings.backend.tavily":"Tavily","search.settings.backend.tavilyHint":"\u6258\u7BA1\u641C\u7D22 API\u3002\u514D\u8D39\u989D\u5EA6 1000 \u6B21/\u6708\u3002\u63A8\u8350\u3002","search.settings.backend.playwright":"Playwright \u670D\u52A1","search.settings.backend.playwrightHint":"\u81EA\u5EFA\u7684\u6D4F\u89C8\u5668\u5F0F\u641C\u7D22/\u6293\u53D6\u670D\u52A1,\u9002\u5408 IP \u4FE1\u8A89\u5DEE\u88AB bot \u68C0\u6D4B\u7684\u73AF\u5883\u3002\u5C1A\u672A\u4E0A\u7EBF\u3002","search.settings.comingSoon":"\u5373\u5C06\u63A8\u51FA","search.settings.tavilyKeyTitle":"Tavily API key","search.settings.tavilyKeyDesc":"\u4FDD\u5B58\u5728 agent \u7684 ~/.yeaft/config.json \u4E2D\u3002\u514D\u8D39\u7533\u8BF7:","search.settings.tavilyKeyUnchanged":"\u4FDD\u6301\u4E0D\u53D8","search.settings.clearKey":"\u6E05\u9664","search.settings.usageTitle":"\u672C\u6708\u7528\u91CF","search.settings.usageRefresh":"\u5237\u65B0","search.settings.usageLoading":"\u52A0\u8F7D\u4E2D\u2026","search.settings.usagePlan":"\u8BA1\u5212","search.settings.usageUsed":"\u5DF2\u7528","search.settings.usagePaygo":"\u6309\u91CF\u4ED8\u8D39","search.settings.usageError":"\u52A0\u8F7D\u7528\u91CF\u5931\u8D25","search.settings.save":"\u4FDD\u5B58","search.settings.saving":"\u4FDD\u5B58\u4E2D\u2026","search.settings.saveSuccess":"\u5DF2\u4FDD\u5B58","search.settings.cancel":"\u91CD\u7F6E","yeaft.settings.yeaftTitle":"\u7EBF\u7A0B\u5E76\u53D1\u4E0E\u5F52\u6863","yeaft.settings.yeaftDesc":"\u8C03\u6574\u53EF\u540C\u65F6\u8FD0\u884C\u7684\u7EBF\u7A0B\u6570\u91CF\uFF0C\u4EE5\u53CA\u95F2\u7F6E\u7EBF\u7A0B\u7684\u81EA\u52A8\u5F52\u6863\u65F6\u957F\u3002","yeaft.settings.maxConcurrentLabel":"\u6700\u5927\u5E76\u53D1\u7EBF\u7A0B\u6570","yeaft.settings.maxConcurrentHint":"\u540C\u65F6\u5728\u7EBF\u7684\u7EBF\u7A0B\u603B\u6570\u4E0A\u9650\uFF08\u542B\u59CB\u7EC8\u5B58\u5728\u7684 main \u4E3B\u7EBF\u7A0B\uFF09\u3002\u8D85\u8FC7\u6B64\u4E0A\u9650\u7684\u65B0\u7EBF\u7A0B\u5C06\u88AB\u62D2\u7EDD\uFF0C\u76F4\u81F3\u5DF2\u6709\u7EBF\u7A0B\u88AB\u5F52\u6863\u6216\u7EC8\u6B62\u3002\u8303\u56F4\uFF1A1-50\u3002","yeaft.settings.archiveIdleDaysLabel":"\u95F2\u7F6E\u591A\u4E45\u540E\u81EA\u52A8\u5F52\u6863\u7EBF\u7A0B\uFF08\u5929\uFF09","yeaft.settings.archiveIdleDaysHint":"\u65E0\u6D3B\u52A8\u8D85\u8FC7\u6B64\u5929\u6570\u7684\u7EBF\u7A0B\u5C06\u88AB\u5F52\u6863\u3002\u8303\u56F4\uFF1A1-3650\u3002","yeaft.settings.yeaftSaveBtn":"\u4FDD\u5B58","yeaft.settings.yeaftSaving":"\u4FDD\u5B58\u4E2D...","yeaft.settings.yeaftSaved":"\u5DF2\u4FDD\u5B58","yeaft.settings.yeaftLoading":"\u52A0\u8F7D\u4E2D...","yeaft.settings.yeaftLoadError":"\u52A0\u8F7D Yeaft \u8BBE\u7F6E\u5931\u8D25","yeaft.settings.yeaftSaveError":"\u4FDD\u5B58 Yeaft \u8BBE\u7F6E\u5931\u8D25","yeaft.settings.rangeErrorConcurrent":"\u5FC5\u987B\u5728 1 \u5230 50 \u4E4B\u95F4","yeaft.settings.rangeErrorArchive":"\u5FC5\u987B\u5728 1 \u5230 3650 \u4E4B\u95F4","chat.session.creating":"\u6B63\u5728\u521B\u5EFA\u4F1A\u8BDD...","chat.session.loadingHistory":"\u6B63\u5728\u52A0\u8F7D\u4F1A\u8BDD\u5386\u53F2...","yeaft.historyLoad.error":"\u4F1A\u8BDD\u5386\u53F2\u6682\u65F6\u65E0\u6CD5\u52A0\u8F7D\uFF0C\u6D88\u606F\u4ECD\u5B89\u5168\u4FDD\u5B58\u5728 Agent \u4E2D\u3002","yeaft.historyLoad.retry":"\u91CD\u65B0\u52A0\u8F7D","yeaft.sessionInventory.error":"\u6682\u65F6\u65E0\u6CD5\u52A0\u8F7D Session\uFF0C\u4F1A\u8BDD\u4ECD\u5B89\u5168\u4FDD\u5B58\u5728 Agent \u4E2D\u3002","yeaft.sessionInventory.retry":"\u91CD\u65B0\u52A0\u8F7D Session","chat.session.closed":"\u4F1A\u8BDD\u5DF2\u5173\u95ED","chat.session.agentOffline":"Agent \u5DF2\u79BB\u7EBF\uFF0C\u8BE5\u4F1A\u8BDD\u5C06\u5728 Agent \u91CD\u65B0\u4E0A\u7EBF\u540E\u6062\u590D\u3002","chat.execution.cancelled":"\u6267\u884C\u5DF2\u53D6\u6D88","chat.sidebar.expand":"\u5C55\u5F00\u83DC\u5355","chat.sidebar.collapse":"\u6536\u8D77\u4FA7\u8FB9\u680F","chat.sidebar.workbench":"\u5DE5\u5177\u9762\u677F","chat.sidebar.newConv":"\u4F1A\u8BDD","chat.sidebar.recentChats":"\u6700\u8FD1\u4F1A\u8BDD","chat.sidebar.resumeConv":"\u6062\u590D\u4F1A\u8BDD","chat.sidebar.lightMode":"\u6D45\u8272\u6A21\u5F0F","chat.sidebar.darkMode":"\u6DF1\u8272\u6A21\u5F0F","chat.sidebar.settings":"\u8BBE\u7F6E","chat.sidebar.emptyHint":"\u70B9\u51FB\u4E0A\u65B9\u6309\u94AE\u521B\u5EFA\u65B0\u4F1A\u8BDD","chat.sidebar.closeConv":"\u5173\u95ED\u4F1A\u8BDD","chat.sidebar.renameConv":"\u91CD\u547D\u540D","chat.sidebar.pin":"\u7F6E\u9876","chat.sidebar.unpin":"\u53D6\u6D88\u7F6E\u9876","chat.connection.connecting":"\u8FDE\u63A5\u4E2D...","chat.connection.reconnecting":"\u91CD\u8FDE\u4E2D ({current}/{max})...","chat.connection.updating":"\u670D\u52A1\u6B63\u5728\u66F4\u65B0\uFF0C\u8BF7\u7A0D\u5019...","chat.connection.disconnected":"\u8FDE\u63A5\u65AD\u5F00","chat.connection.reconnect":"\u91CD\u8FDE","chat.connection.reconnectFailed":"\u8FDE\u63A5\u65AD\u5F00\uFF0C\u8BF7\u70B9\u51FB\u91CD\u8FDE\u6309\u94AE\u91CD\u8BD5\u3002","chat.time.justNow":"\u521A\u521A","chat.time.minutesAgo":"{count}\u5206\u949F\u524D","chat.time.daysAgo":"{count}\u5929\u524D","chat.time.today":"\u4ECA\u5929","chat.time.yesterday":"\u6628\u5929","chat.delete.confirm":"\u786E\u5B9A\u8981\u5173\u95ED\u8FD9\u4E2A\u4F1A\u8BDD\u5417\uFF1F\u8FD9\u5C06\u7EC8\u6B62\u5BF9\u5E94\u7684 Claude \u8FDB\u7A0B\u3002","chat.delete.enterWorkDir":"\u8BF7\u8F93\u5165\u5DE5\u4F5C\u76EE\u5F55\u8DEF\u5F84","modal.newConv.workDir":"\u5DE5\u4F5C\u76EE\u5F55","modal.newConv.inputOrSelect":"\u8F93\u5165\u6216\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55","modal.newConv.browse":"\u6D4F\u89C8\u76EE\u5F55","modal.newConv.noWorkDirs":"\u6682\u65E0\u5DE5\u4F5C\u76EE\u5F55","modal.newConv.selectAgent":"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A\u5728\u7EBF\u7684 Agent","modal.newConv.create":"\u521B\u5EFA\u4F1A\u8BDD","modal.newConv.folderLabel":"\u{1F4C1} \u5DE5\u4F5C\u76EE\u5F55","modal.newConv.provider":"\u63D0\u4F9B\u65B9","modal.newConv.model":"\u6A21\u578B","provider.claudeCode":"Claude Code","provider.copilot":"Copilot","modal.resume.workDir":"\u5DE5\u4F5C\u76EE\u5F55","modal.resume.inputOrSelect":"\u8F93\u5165\u6216\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55","modal.resume.browse":"\u6D4F\u89C8\u76EE\u5F55","modal.resume.tabFolders":"\u5DE5\u4F5C\u76EE\u5F55","modal.resume.tabSessions":"\u5386\u53F2\u4F1A\u8BDD","modal.resume.noWorkDirs":"\u6682\u65E0\u5DE5\u4F5C\u76EE\u5F55","modal.resume.selectWorkDir":"\u8BF7\u5148\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55","modal.resume.noSessions":"\u8BE5\u76EE\u5F55\u4E0B\u6CA1\u6709\u5386\u53F2\u4F1A\u8BDD","modal.resume.untitled":"\u672A\u547D\u540D\u4F1A\u8BDD","modal.resume.folderLabel":"\u{1F4C1} \u5DE5\u4F5C\u76EE\u5F55","modal.resume.sessionLabel":"\u{1F4AC} \u5386\u53F2\u4F1A\u8BDD","modal.resume.selectAgent":"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A\u5728\u7EBF\u7684 Agent","modal.folderPicker.title":"\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55","modal.folderPicker.parentDir":"\u4E0A\u7EA7\u76EE\u5F55","welcome.subtitle":"\u9762\u5411 Session\u3001\u5DE5\u5177\u548C VP \u534F\u4F5C\u7684 Web Code Agent","welcome.agentOnline":"{count} \u4E2A Agent \u5728\u7EBF","welcome.noAgents":"\u6682\u65E0\u5728\u7EBF Agent","welcome.noAgentsHint":"\u8BF7\u5148\u542F\u52A8 Agent \u7A0B\u5E8F\u8FDE\u63A5\u5230\u670D\u52A1\u5668","welcome.noAgent":"\u6682\u65E0\u5728\u7EBF Agent","welcome.noAgentHint":"\u8BF7\u5148\u542F\u52A8 Agent \u7A0B\u5E8F\u8FDE\u63A5\u5230\u670D\u52A1\u5668","welcome.setupAgent":"\u8BBE\u7F6E Agent","welcome.setupKicker":"Agent \u63A5\u5165","welcome.setupTitle":"\u8FDE\u63A5\u4F60\u7684\u7B2C\u4E00\u4E2A Yeaft Agent","welcome.setupDesc":"\u590D\u5236\u4E24\u6761\u547D\u4EE4\u5373\u53EF\u8FDE\u63A5\u672C\u673A Agent\u3002\u6A21\u578B\u53EF\u7528 GitHub Copilot \u81EA\u52A8\u914D\u7F6E\u3002","welcome.setupInstallTitle":"\u5B89\u88C5 CLI","welcome.setupCopilotTitle":"\u914D\u7F6E\u6A21\u578B","welcome.setupRunTitle":"\u542F\u52A8 Agent","welcome.setupSecretLoading":"\u6B63\u5728\u51C6\u5907 Agent secret...","welcome.setupSecretError":"\u65E0\u6CD5\u51C6\u5907 Agent secret\uFF0C\u8BF7\u6253\u5F00\u5B89\u5168\u8BBE\u7F6E\u91CD\u8BD5\u3002","welcome.openSecuritySettings":"\u6253\u5F00\u5B89\u5168\u8BBE\u7F6E","welcome.newConv":"\u4F1A\u8BDD","welcome.resumeHistory":"\u6062\u590D\u5386\u53F2","messages.loadingMore":"\u52A0\u8F7D\u66F4\u591A\u6D88\u606F...","messages.loadMore":"\u2191 \u70B9\u51FB\u6216\u5411\u4E0A\u6EDA\u52A8\u52A0\u8F7D\u66F4\u591A","message.loadingMore":"\u52A0\u8F7D\u66F4\u591A\u6D88\u606F...","message.loadMore":"\u2191 \u70B9\u51FB\u6216\u5411\u4E0A\u6EDA\u52A8\u52A0\u8F7D\u66F4\u591A","message.scrollToLatest":"\u2193 \u6700\u65B0","message.showResponses":"\u5C55\u5F00 {count} \u6761\u56DE\u590D","message.hideResponses":"\u6298\u53E0\u56DE\u590D","message.assistant":"\u52A9\u624B","chat.waiting.disconnected":"\u8FDE\u63A5\u5DF2\u65AD\u5F00","chat.connecting":"\u6B63\u5728\u8FDE\u63A5 provider \u4F1A\u8BDD...","chat.waiting.compacting":"\u6B63\u5728\u538B\u7F29\u4E0A\u4E0B\u6587...","chat.waiting.agentOffline":"Agent \u5DF2\u79BB\u7EBF","chat.waiting.sessionLost":"Session \u5DF2\u4E22\u5931\uFF0C\u5DF2\u5237\u65B0\uFF0C\u7B49\u5F85\u6700\u65B0\u4FE1\u606F...","chat.waiting.cliExited":"Claude \u8FDB\u7A0B\u5DF2\u9000\u51FA\uFF0C\u5DF2\u5237\u65B0\uFF0C\u7B49\u5F85\u6700\u65B0\u4FE1\u606F...","chat.waiting.refresh":"\u5237\u65B0","chat.waiting.thinking":"AI \u6B63\u5728\u601D\u8003\u4E2D\uFF0C\u8BF7\u7A0D\u5019...","btw.hint":"esc \u9000\u51FA","btw.placeholder":"\u95EE\u4E2A\u987A\u4FBF\u7684\u95EE\u9898...","btw.close":"\u9000\u51FA BTW \u6A21\u5F0F","message.copyContent":"\u590D\u5236\u5185\u5BB9","message.copy":"\u590D\u5236\u5185\u5BB9","message.copied":"\u5DF2\u590D\u5236","message.copyCode":"\u590D\u5236\u4EE3\u7801","message.copyAll":"\u590D\u5236\u5168\u90E8","message.screenshot":"\u622A\u56FE","message.screenshotting":"\u6B63\u5728\u622A\u56FE...","message.exportMd":"\u5BFC\u51FA MD","message.askInput":"\u9700\u8981\u4F60\u7684\u8F93\u5165","message.askAnswered":"\u2713 \u5DF2\u56DE\u7B54","message.askCustom":"\u6216\u8F93\u5165\u81EA\u5B9A\u4E49\u56DE\u7B54...","message.askCustomPlaceholder":"\u6216\u8F93\u5165\u81EA\u5B9A\u4E49\u56DE\u7B54...","message.askSubmit":"\u63D0\u4EA4\u56DE\u7B54","message.askWaiting":"\u7B49\u5F85\u95EE\u9898\u52A0\u8F7D...","message.askExpired":"\u6B64\u95EE\u9898\u5DF2\u5931\u6548\uFF0C\u8BF7\u8BA9\u89D2\u8272\u91CD\u65B0\u63D0\u95EE","message.openInEditor":"\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00","message.resultDone":"\u5B8C\u6210","message.done":"\u5B8C\u6210","message.resultRead":"\u8BFB\u53D6 {file}","message.readFile":"\u8BFB\u53D6 {name}","message.file":"\u6587\u4EF6","message.attachImages":"{count} \u5F20\u56FE\u7247","message.imageCount":"{count} \u5F20\u56FE\u7247","message.imagePreview":"\u56FE\u7247\u9884\u89C8","message.imageUnavailable":"\u56FE\u7247\u65E0\u6CD5\u52A0\u8F7D","message.attachFiles":"{count} \u4E2A\u6587\u4EF6","message.fileCount":"{count} \u4E2A\u6587\u4EF6","message.quote":"\u5F15\u7528","message.removeQuote":"\u5220\u9664\u5F15\u7528","message.replyingTo":"\u6B63\u5728\u56DE\u590D {author}","message.quotedFrom":"\u5F15\u7528\u81EA {author}","message.editAsNew":"\u7F16\u8F91","message.you":"\u4F60","input.upload":"\u4E0A\u4F20\u6587\u4EF6","input.placeholder":"\u8F93\u5165\u6D88\u606F...","input.send":"\u53D1\u9001","input.stopExecution":"\u505C\u6B62\u6267\u884C","chatInput.upload":"\u4E0A\u4F20\u6587\u4EF6","chatInput.uploading":"\u6B63\u5728\u4E0A\u4F20\u2026","chatInput.uploadFailed":"\u4E0A\u4F20\u5931\u8D25","chatInput.retryUpload":"\u91CD\u8BD5","chatInput.removeAttachment":"\u79FB\u9664\u9644\u4EF6","chatInput.placeholder":"\u8F93\u5165\u6D88\u606F...","chatInput.send":"\u53D1\u9001","chatInput.stop":"\u505C\u6B62\u6267\u884C","tools.thinking":"\u601D\u8003\u4E2D...","tools.read":"\u6B63\u5728\u8BFB\u53D6\u6587\u4EF6","tools.write":"\u6B63\u5728\u5199\u5165\u6587\u4EF6","tools.edit":"\u6B63\u5728\u7F16\u8F91\u6587\u4EF6","tools.bash":"\u6B63\u5728\u6267\u884C\u547D\u4EE4","tools.glob":"\u6B63\u5728\u641C\u7D22\u6587\u4EF6","tools.grep":"\u6B63\u5728\u641C\u7D22\u5185\u5BB9","tools.task":"\u6B63\u5728\u6267\u884C\u4EFB\u52A1","tools.webFetch":"\u6B63\u5728\u83B7\u53D6\u7F51\u9875","tools.webSearch":"\u6B63\u5728\u641C\u7D22\u7F51\u7EDC","tools.todoWrite":"\u6B63\u5728\u66F4\u65B0\u4EFB\u52A1","tools.executing":"\u6B63\u5728\u6267\u884C {name}","status.thinking":"\u601D\u8003\u4E2D...","status.reading":"\u6B63\u5728\u8BFB\u53D6\u6587\u4EF6","status.writing":"\u6B63\u5728\u5199\u5165\u6587\u4EF6","status.editing":"\u6B63\u5728\u7F16\u8F91\u6587\u4EF6","status.executing":"\u6B63\u5728\u6267\u884C\u547D\u4EE4","status.searchingFiles":"\u6B63\u5728\u641C\u7D22\u6587\u4EF6","status.searchingContent":"\u6B63\u5728\u641C\u7D22\u5185\u5BB9","status.executingTask":"\u6B63\u5728\u6267\u884C\u4EFB\u52A1","status.fetching":"\u6B63\u5728\u83B7\u53D6\u7F51\u9875","status.searching":"\u6B63\u5728\u641C\u7D22\u7F51\u7EDC","status.updatingTasks":"\u6B63\u5728\u66F4\u65B0\u4EFB\u52A1","status.executingTool":"\u6B63\u5728\u6267\u884C {name}","header.compacting":"\u6B63\u5728\u538B\u7F29\u4E0A\u4E0B\u6587...","header.compacted":"\u4E0A\u4E0B\u6587\u538B\u7F29\u5B8C\u6210","chatHeader.newConv":"\u4F1A\u8BDD","chatHeader.compacting":"\u6B63\u5728\u538B\u7F29\u4E0A\u4E0B\u6587...","chatHeader.compactDone":"\u4E0A\u4E0B\u6587\u538B\u7F29\u5B8C\u6210","chatHeader.compact":"\u538B\u7F29\u4E0A\u4E0B\u6587","chatHeader.resume":"\u6062\u590D\u4F1A\u8BDD","chatHeader.refresh":"\u5237\u65B0\u6D88\u606F","chatHeader.reloadPage":"\u5237\u65B0\u9875\u9762","chatHeader.clear":"\u6E05\u7A7A\u6D88\u606F","chatHeader.clearing":"\u6B63\u5728\u6E05\u7A7A\u4E0A\u4E0B\u6587...","chatHeader.clearDone":"\u4E0A\u4E0B\u6587\u5DF2\u6E05\u7A7A","chatHeader.confirmClear":"\u786E\u5B9A\u8981\u6E05\u7A7A\u5F53\u524D\u4F1A\u8BDD\u7684\u6240\u6709\u6D88\u606F\u5417\uFF1F","chatHeader.mcpConfig":"MCP \u670D\u52A1\u5668\u914D\u7F6E","chatHeader.mcpNeedRestart":"\u66F4\u6539\u5C06\u5728\u91CD\u542F\u4F1A\u8BDD\u540E\u751F\u6548\u3002","chatHeader.expertPanel":"\u5E2E\u5E2E\u56E2","chatHeader.subAgentPanel":"\u5B50\u4EE3\u7406","settings.close":"\u5173\u95ED\u8BBE\u7F6E","settings.tabs.account":"\u8D26\u53F7","settings.tabs.security":"\u5B89\u5168","settings.tabs.general":"\u901A\u7528","settings.tabs.invitations":"\u9080\u8BF7","auth.sessionExpired":"\u767B\u5F55\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u3002","settings.account.username":"\u7528\u6237\u540D","settings.account.role":"\u89D2\u8272","settings.account.email":"\u90AE\u7BB1","settings.account.emailNotSet":"\u672A\u8BBE\u7F6E","settings.account.profileLoadFailed":"\u8D26\u53F7\u8D44\u6599\u52A0\u8F7D\u5931\u8D25","settings.account.logout":"\u9000\u51FA\u767B\u5F55","settings.account.roleAdmin":"\u7BA1\u7406\u5458","settings.account.rolePro":"Pro","settings.account.linkedAccounts":"\u5DF2\u5173\u8054\u8D26\u6237","settings.account.linkedDesc":"\u5173\u8054\u7B2C\u4E09\u65B9\u767B\u5F55\u540E\uFF0C\u4F7F\u7528\u4EFB\u610F\u4E00\u79CD\u65B9\u5F0F\u90FD\u80FD\u767B\u5F55\u6B64\u8D26\u53F7\u3002","settings.account.bind":"\u7ED1\u5B9A","settings.account.unbind":"\u89E3\u7ED1","settings.account.linked":"\u5DF2\u7ED1\u5B9A","settings.account.providerDisabled":"\u672A\u914D\u7F6E","settings.account.cantUnbindLast":"\u4E0D\u80FD\u89E3\u7ED1\u552F\u4E00\u7684\u767B\u5F55\u65B9\u5F0F","settings.account.unbindFailed":"\u89E3\u7ED1\u5931\u8D25\uFF1A{error}","settings.account.bindFailed":"\u7ED1\u5B9A\u5931\u8D25","settings.account.ssoBoundMsg":"\u5DF2\u6210\u529F\u7ED1\u5B9A {provider}\u3002","settings.account.ssoConflictMsg":"\u8BE5 {provider} \u8D26\u53F7\u5DF2\u88AB\u5176\u4ED6\u7528\u6237\u7ED1\u5B9A\u3002","settings.account.providerMicrosoft":"Microsoft","settings.account.providerGithub":"GitHub","settings.account.providerGoogle":"Google","settings.account.providerWechat":"\u5FAE\u4FE1","settings.account.providerAlipay":"\u652F\u4ED8\u5B9D","settings.security.agentKey":"Agent \u5BC6\u94A5","settings.security.agentKeyDesc":"\u7528\u4E8E Agent \u8FDE\u63A5\u8BA4\u8BC1\u7684\u5171\u4EAB\u5BC6\u94A5","settings.security.agentSetupCommands":"Agent \u63A5\u5165\u547D\u4EE4","settings.security.agentCmdInstall":"\u5B89\u88C5 Agent","settings.security.agentCmdService":"\u8FD0\u884C Agent server","settings.security.agentCmdNeedsSecret":"\u8BF7\u5148\u751F\u6210 Agent \u5BC6\u94A5\uFF0C\u4EE5\u521B\u5EFA\u5305\u542B server \u5730\u5740\u548C\u5BC6\u94A5\u7684\u547D\u4EE4\u3002","settings.security.agentCmdLlm":"Copilot \u624B\u52A8\u515C\u5E95","settings.security.agentCmdLlmDesc":"\u5148\u8FD0\u884C\u5B89\u88C5\u547D\u4EE4\uFF1B\u5982\u679C\u672C\u673A\u5DF2\u6709 GitHub Copilot token\uFF0CYeaft \u4F1A\u81EA\u52A8\u914D\u7F6E github-copilot/gpt-5.5\u3002Copilot \u547D\u4EE4\u53EA\u4F5C\u4E3A\u515C\u5E95\u4F7F\u7528\u3002","settings.security.none":"\u65E0","settings.security.show":"\u663E\u793A","settings.security.hide":"\u9690\u85CF","settings.security.generateKey":"\u751F\u6210\u5BC6\u94A5","settings.security.resetKey":"\u91CD\u7F6E\u5BC6\u94A5","settings.security.resetting":"\u91CD\u7F6E\u4E2D...","settings.security.resetWarning":"\u91CD\u7F6E\u540E\u6240\u6709 Agent \u9700\u91CD\u65B0\u914D\u7F6E","settings.security.changePassword":"\u4FEE\u6539\u5BC6\u7801","settings.security.currentPassword":"\u5F53\u524D\u5BC6\u7801","settings.security.newPassword":"\u65B0\u5BC6\u7801\uFF08\u81F3\u5C116\u4F4D\uFF09","settings.security.confirmPassword":"\u786E\u8BA4\u65B0\u5BC6\u7801","settings.security.changeBtn":"\u4FEE\u6539\u5BC6\u7801","settings.security.changing":"\u4FEE\u6539\u4E2D...","settings.security.enterCurrentPwd":"\u8BF7\u8F93\u5165\u5F53\u524D\u5BC6\u7801","settings.security.newPwdMin":"\u65B0\u5BC6\u7801\u81F3\u5C116\u4F4D","settings.security.pwdMismatch":"\u4E24\u6B21\u5BC6\u7801\u4E0D\u4E00\u81F4","settings.security.pwdChanged":"\u5BC6\u7801\u4FEE\u6539\u6210\u529F","settings.security.setPassword":"\u8BBE\u7F6E\u5BC6\u7801","settings.security.setPasswordDesc":"\u4F60\u76EE\u524D\u901A\u8FC7 SSO \u767B\u5F55\uFF0C\u5C1A\u672A\u8BBE\u7F6E\u5BC6\u7801\u3002\u8BBE\u7F6E\u540E\u5373\u53EF\u4F7F\u7528\u7528\u6237\u540D + \u5BC6\u7801\u767B\u5F55\u3002","settings.security.setBtn":"\u8BBE\u7F6E\u5BC6\u7801","settings.security.pwdSet":"\u5BC6\u7801\u8BBE\u7F6E\u6210\u529F","settings.security.deleteAccount":"\u6CE8\u9500\u8D26\u6237","settings.security.deleteAccountDesc":"\u6C38\u4E45\u5220\u9664\u4F60\u7684\u8D26\u6237\u548C\u6240\u6709\u76F8\u5173\u6570\u636E\u3002\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002","settings.security.deleteBtn":"\u6CE8\u9500\u8D26\u6237","settings.security.deleteConfirmBtn":"\u786E\u8BA4\u5220\u9664","settings.security.deleteConfirmPlaceholder":"\u8F93\u5165 DELETE \u4EE5\u786E\u8BA4","settings.security.deleteConfirmRequired":"\u8BF7\u8F93\u5165 DELETE \u4EE5\u786E\u8BA4\u6CE8\u9500\u8D26\u6237","settings.security.deleteFailed":"\u6CE8\u9500\u8D26\u6237\u5931\u8D25","settings.security.deleting":"\u6CE8\u9500\u4E2D...","settings.general.theme":"\u4E3B\u9898","settings.general.lightTheme":"\u6D45\u8272","settings.general.darkTheme":"\u6DF1\u8272","settings.general.language":"\u8BED\u8A00","settings.invite.create":"\u521B\u5EFA\u9080\u8BF7\u7801","settings.invite.normalUser":"\u666E\u901A\u7528\u6237","settings.invite.proUser":"Pro \u7528\u6237","settings.invite.createBtn":"\u521B\u5EFA\u9080\u8BF7\u7801","settings.invite.creating":"\u521B\u5EFA\u4E2D...","settings.invite.list":"\u9080\u8BF7\u7801\u5217\u8868","settings.invite.used":"\u5DF2\u4F7F\u7528","settings.invite.expired":"\u5DF2\u8FC7\u671F","settings.invite.available":"\u53EF\u7528","settings.invite.usedBy":"\u4F7F\u7528\u8005: {user}","settings.invite.expiredAt":"\u8FC7\u671F\u4E8E: {time}","settings.invite.expiresAt":"\u6709\u6548\u81F3: {time}","settings.invite.noInvites":"\u6682\u65E0\u9080\u8BF7\u7801","settings.msg.copiedClipboard":"\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F","settings.msg.copyFailed":"\u590D\u5236\u5931\u8D25","settings.msg.keyReset":"\u5BC6\u94A5\u5DF2\u91CD\u7F6E","settings.msg.resetFailed":"\u91CD\u7F6E\u5931\u8D25","settings.msg.changeFailed":"\u4FEE\u6539\u5931\u8D25","settings.msg.inviteCreated":"\u9080\u8BF7\u7801\u5DF2\u521B\u5EFA","settings.msg.createFailed":"\u521B\u5EFA\u5931\u8D25","settings.msg.inviteCopied":"\u9080\u8BF7\u7801\u5DF2\u590D\u5236","settings.msg.inviteDeleted":"\u9080\u8BF7\u7801\u5DF2\u5220\u9664","settings.msg.deleteFailed":"\u5220\u9664\u5931\u8D25","settings.tabs.llm":"LLM","settings.tabs.yeaft":"Yeaft","settings.yeaft.tabs.vp":"VP \u5E93","settings.yeaft.tabs.search":"\u641C\u7D22","settings.yeaft.tabs.mcp":"MCP","settings.mcp.title":"MCP \u670D\u52A1\u5668","settings.mcp.description":"\u901A\u8FC7 Model Context Protocol \u7ED9 Yeaft \u63A5\u5165\u66F4\u591A\u5DE5\u5177\u3002\u914D\u7F6E\u5199\u5165 agent \u4E0A\u7684 ~/.yeaft/config.json\uFF0C\u5DE5\u5177\u4F1A\u4EE5 mcp__<server>__<tool> \u7684\u5F62\u5F0F\u51FA\u73B0\u5728 LLM \u5DE5\u5177\u5217\u8868\u91CC\u3002","settings.mcp.reloadAll":"\u5168\u90E8\u91CD\u8FDE","settings.mcp.reloadOne":"\u91CD\u65B0\u8FDE\u63A5\u6B64\u670D\u52A1\u5668","settings.mcp.loading":"\u5904\u7406\u4E2D\u2026","settings.mcp.connected":"\u5DF2\u8FDE\u63A5","settings.mcp.disconnected":"\u672A\u8FDE\u63A5","settings.mcp.tools":"\u4E2A\u5DE5\u5177","settings.mcp.remove":"\u79FB\u9664","settings.mcp.empty":"\u8FD8\u6CA1\u6709\u914D\u7F6E MCP \u670D\u52A1\u5668\uFF0C\u53EF\u4EE5\u5728\u4E0B\u65B9\u6DFB\u52A0\u4E00\u4E2A\u3002","settings.mcp.addServer":"\u6DFB\u52A0\u670D\u52A1\u5668","settings.mcp.addServerDesc":"\u5927\u90E8\u5206 MCP \u670D\u52A1\u5668\u662F\u672C\u5730\u547D\u4EE4 \u2014 Yeaft \u4F1A\u901A\u8FC7 stdio \u542F\u52A8\u5B83\u5E76\u81EA\u52A8\u53D1\u73B0\u53EF\u7528\u5DE5\u5177\u3002","settings.mcp.serverName":"\u540D\u79F0","settings.mcp.command":"\u547D\u4EE4","settings.mcp.args":"\u53C2\u6570","settings.mcp.argsPlaceholder":"\u4F8B\u5982\uFF1A-y @modelcontextprotocol/server-filesystem /tmp","settings.mcp.env":"\u73AF\u5883\u53D8\u91CF","settings.mcp.envPlaceholder":"\u6BCF\u884C\u4E00\u4E2A KEY=value\uFF0C# \u5F00\u5934\u7684\u884C\u4F1A\u88AB\u5FFD\u7565\u3002","settings.mcp.saving":"\u4FDD\u5B58\u4E2D\u2026","settings.mcp.add":"\u6DFB\u52A0","settings.mcp.cancel":"\u6E05\u7A7A","settings.mcp.connectFailed":"\u5DF2\u4FDD\u5B58\u4F46\u8FDE\u63A5\u5931\u8D25","settings.mcp.addSuccess":"\u670D\u52A1\u5668\u5DF2\u6DFB\u52A0","settings.mcp.removeSuccess":"\u670D\u52A1\u5668\u5DF2\u79FB\u9664","settings.mcp.reloadSuccess":"\u5DF2\u8BF7\u6C42\u91CD\u8FDE","settings.mcp.confirmRemove":'\u79FB\u9664 MCP \u670D\u52A1\u5668 "{name}"\uFF1F\u4E0B\u4E00\u4E2A LLM turn \u8D77\u5B83\u7684\u5DE5\u5177\u5C06\u4E0D\u518D\u53EF\u89C1\u3002',"settings.mcp.errors.nameRequired":"\u8BF7\u586B\u5199\u540D\u79F0","settings.mcp.errors.nameFormat":"\u540D\u79F0\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u77ED\u6A2A\u7EBF\u548C\u4E0B\u5212\u7EBF","settings.mcp.errors.commandRequired":"\u8BF7\u586B\u5199\u547D\u4EE4","settings.mcp.errors.argsParse":"\u53C2\u6570\u89E3\u6790\u5931\u8D25","settings.mcp.errors.envParse":"\u73AF\u5883\u53D8\u91CF\u89E3\u6790\u5931\u8D25","yeaft.session.title":"\u4F1A\u8BDD","yeaft.session.new":"+ \u65B0\u5EFA\u4F1A\u8BDD","yeaft.session.create.title":"\u65B0\u5EFA\u4F1A\u8BDD","yeaft.session.create.subtitle":"\u9009\u62E9\u8FD0\u884C\u4F4D\u7F6E\u548C\u5904\u7406\u4F1A\u8BDD\u7684 Provider\u3002","yeaft.session.create.close":"\u5173\u95ED","yeaft.session.create.nameLabel":"\u540D\u79F0","yeaft.session.create.namePlaceholder":"\u4F1A\u8BDD\u540D\u79F0\uFF08\u53EF\u9009\uFF09","yeaft.session.create.workDirLabel":"\u5DE5\u4F5C\u76EE\u5F55","yeaft.session.create.agentLabel":"Agent","yeaft.session.create.vpPicker":"\u9009\u62E9 VP","yeaft.session.create.vpNone":"\u672A\u9009\u62E9 VP","yeaft.session.create.vpCount":"\u5DF2\u9009 {n} \u4E2A VP","yeaft.session.create.untitled":"\u672A\u547D\u540D\u4F1A\u8BDD","yeaft.session.create.rosterEmpty":"\u6682\u65E0\u53EF\u7528 VP \u2014 \u8BF7\u5148\u5230\u89D2\u8272\u5E93\u521B\u5EFA\u3002","yeaft.session.create.rosterLoading":"VP \u52A0\u8F7D\u4E2D\u2026","yeaft.vp.domain.general":"\u901A\u7528\u4E0E\u534F\u4F5C","yeaft.vp.domain.productDesign":"\u4EA7\u54C1\u4E0E\u4F53\u9A8C\u8BBE\u8BA1","yeaft.vp.domain.softwareSystems":"\u8F6F\u4EF6\u4E0E\u7CFB\u7EDF","yeaft.vp.domain.securityReliability":"\u5B89\u5168\u4E0E\u53EF\u9760\u6027","yeaft.vp.domain.scienceAnalysis":"\u79D1\u5B66\u4E0E\u5206\u6790","yeaft.vp.domain.philosophyPsychology":"\u54F2\u5B66\u4E0E\u5FC3\u7406","yeaft.vp.domain.strategyHistory":"\u6218\u7565\u4E0E\u5386\u53F2","yeaft.vp.domain.businessManagement":"\u5546\u4E1A\u4E0E\u7BA1\u7406","yeaft.vp.domain.artsCulture":"\u827A\u672F\u4E0E\u6587\u5316","yeaft.vp.domain.other":"\u5176\u4ED6\u9886\u57DF","yeaft.vp.domain.custom":"\u81EA\u5B9A\u4E49 VP","yeaft.session.create.defaultVpHint":"\u5F53\u6CA1\u6709 @ \u63D0\u53CA\u65F6\u9ED8\u8BA4\u56DE\u7B54\u7684 VP\u3002","yeaft.session.create.folderLabel":"\u{1F4C1} \u5DE5\u4F5C\u76EE\u5F55","yeaft.session.create.sessionLabel":"\u{1F4AC} \u6B64\u76EE\u5F55\u4E0B\u7684 session","yeaft.session.create.noWorkDirs":"\u8FD8\u6CA1\u6709\u4EFB\u4F55\u4F1A\u8BDD \u2014 \u5728\u4E0A\u65B9\u9009\u62E9\u6216\u8F93\u5165\u5DE5\u4F5C\u76EE\u5F55\u5F00\u59CB\u3002","yeaft.session.create.back":"\u8FD4\u56DE","yeaft.session.create.creating":"\u521B\u5EFA\u4E2D\u2026","yeaft.session.create.submit":"\u521B\u5EFA","yeaft.onboarding.ariaLabel":"Yeaft \u4E0A\u624B\u8BF4\u660E","yeaft.onboarding.topbarTitle":"\u5F00\u59CB\u4F7F\u7528 Yeaft","yeaft.onboarding.eyebrow":"Yeaft \u4E0A\u624B\u6307\u5357","yeaft.onboarding.title":"\u5148\u8FDE\u63A5 Agent\uFF0C\u518D\u5F00\u59CB\u4F1A\u8BDD","yeaft.onboarding.subtitle":"\u5728\u8D1F\u8D23\u6267\u884C\u5DE5\u5177\u7684\u673A\u5668\u4E0A\u76F4\u63A5\u8FD0\u884C\u4E0B\u9762\u7684\u547D\u4EE4\u3002agent secret \u5982\u679C\u4E0D\u5B58\u5728\uFF0C\u4F1A\u81EA\u52A8\u4E3A\u5F53\u524D\u8D26\u53F7\u751F\u6210\u3002","yeaft.onboarding.createSession":"\u521B\u5EFA\u6216\u6062\u590D Session","yeaft.onboarding.configureLlm":"\u6253\u5F00 LLM \u8BBE\u7F6E","yeaft.onboarding.secretLoading":"\u6B63\u5728\u751F\u6210 agent secret\u2026","yeaft.onboarding.secretError":"\u52A0\u8F7D agent secret \u5931\u8D25\u3002","yeaft.onboarding.secretPending":"<\u6B63\u5728\u52A0\u8F7D-agent-secret>","yeaft.onboarding.installTitle":"\u5B89\u88C5 yeaft-agent","yeaft.onboarding.installDesc":"\u5B89\u88C5\u547D\u4EE4\u884C Agent \u5305\u3002","yeaft.onboarding.connectTitle":"\u8FDE\u63A5\u8FD9\u4E2A Agent","yeaft.onboarding.connectDesc":"\u4E0B\u9762\u7684\u547D\u4EE4\u5DF2\u7ECF\u5E26\u4E0A\u5F53\u524D server URL \u548C\u81EA\u52A8\u751F\u6210\u7684 secret\u3002","yeaft.onboarding.llmTitle":"\u4F7F\u7528 GitHub Copilot","yeaft.onboarding.llmDesc":"\u5148\u767B\u5F55 GitHub CLI\uFF0C\u7136\u540E\u628A gpt-5.5 \u8BBE\u4E3A Yeaft \u9ED8\u8BA4\u6A21\u578B\u3002","yeaft.restore.modal.empty":"\u6B64\u76EE\u5F55\u4E0B\u6CA1\u6709 yeaft session","yeaft.restore.modal.scanError":"\u626B\u63CF\u5931\u8D25: {message}","yeaft.restore.modal.restoreError":"\u6062\u590D\u5931\u8D25: {message}","settings.llm.noAgent":"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A Agent \u4EE5\u7BA1\u7406 LLM \u914D\u7F6E\u3002","settings.llm.agentOffline":"Agent \u5F53\u524D\u79BB\u7EBF\uFF0C\u65E0\u6CD5\u52A0\u8F7D LLM \u914D\u7F6E\u3002\u8BF7\u7B49\u5F85 Agent \u4E0A\u7EBF\u540E\u91CD\u8BD5\u3002","settings.llm.loading":"\u6B63\u5728\u52A0\u8F7D\u914D\u7F6E...","settings.llm.loadError":"\u52A0\u8F7D\u914D\u7F6E\u5931\u8D25","settings.llm.configureAgent":"\u914D\u7F6E\u5F53\u524D Agent \u7684 LLM","settings.llm.configureMenu":"\u8BBE\u7F6E LLM","settings.llm.simpleCopilotTitle":"\u63A8\u8350\uFF1AGitHub Copilot","settings.llm.useGitHubCopilot":"\u4F7F\u7528 GitHub Copilot","settings.llm.refreshingModels":"\u6B63\u5728\u5237\u65B0\u6A21\u578B...","settings.llm.managedCopilotTitle":"\u6258\u7BA1\u7684 GitHub Copilot","settings.llm.managedCopilotDesc":"Base URL\u3001\u8BA4\u8BC1\u3001\u6A21\u578B\u76EE\u5F55\u548C\u6BCF\u4E2A\u6A21\u578B\u7684 API \u534F\u8BAE\u90FD\u81EA\u52A8\u7BA1\u7406\u3002Claude \u6A21\u578B\u8D70 Anthropic Messages\uFF1BGPT/o \u6A21\u578B\u8D70 OpenAI Responses\u3002","settings.llm.providersTitle":"\u670D\u52A1\u5546","settings.llm.testFailed":"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25","settings.llm.saveSuccess":"LLM \u8BBE\u7F6E\u5DF2\u4FDD\u5B58","settings.llm.saveFailed":"\u4FDD\u5B58 LLM \u8BBE\u7F6E\u5931\u8D25","settings.llm.presets.title":"\u5FEB\u901F\u914D\u7F6E","settings.llm.providersDesc":"\u9009\u62E9\u4E00\u4E2A\u670D\u52A1\u5546\uFF0C\u4FDD\u5B58\u540E\u5373\u53EF\u5728 Session \u4E2D\u4F7F\u7528\u3002","settings.llm.agentProviders":"\u5F53\u524D agent providers","settings.llm.agentBadge":"\u5F53\u524D agent","settings.llm.addProvider":"\u6DFB\u52A0\u670D\u52A1\u5546","settings.llm.addFromPreset":"\u4ECE\u76EE\u5F55\u6DFB\u52A0","settings.llm.preset.title":"\u670D\u52A1\u5546\u76EE\u5F55\uFF08models.dev\uFF09","settings.llm.preset.refresh":"\u5237\u65B0\u76EE\u5F55","settings.llm.preset.loading":"\u52A0\u8F7D\u76EE\u5F55\u2026","settings.llm.preset.empty":"\u76EE\u5F55\u4E3A\u7A7A\u3002","settings.llm.preset.pickProvider":"\u5728\u5DE6\u4FA7\u9009\u62E9\u4E00\u4E2A\u670D\u52A1\u5546\u4EE5\u67E5\u770B\u6A21\u578B\u3002","settings.llm.preset.filterProviders":"\u8FC7\u6EE4\u670D\u52A1\u5546\u2026","settings.llm.preset.filterModels":"\u8FC7\u6EE4\u6A21\u578B\u2026","settings.llm.preset.selectAll":"\u5168\u9009","settings.llm.preset.selectNone":"\u6E05\u7A7A","settings.llm.preset.cancel":"\u53D6\u6D88","settings.llm.preset.add":"\u6DFB\u52A0\u5230\u670D\u52A1\u5546\u5217\u8868","settings.llm.preset.fetchedAt":"\u76EE\u5F55\u5DF2\u66F4\u65B0 {minutes} \u5206\u949F","settings.llm.addModel":"\u6DFB\u52A0\u6A21\u578B","settings.llm.removeModel":"\u79FB\u9664\u6A21\u578B","settings.llm.providerName":"\u540D\u79F0","settings.llm.providerNamePlaceholder":"\u4F8B\u5982 my-proxy","settings.llm.baseUrl":"Base URL","settings.llm.baseUrlPlaceholder":"\u4F8B\u5982 http://localhost:6628/v1","settings.llm.apiKey":"API Key","settings.llm.apiKeyPlaceholder":"\u8F93\u5165 API Key","settings.llm.protocol":"\u534F\u8BAE","settings.llm.protocolOpenAI":"OpenAI \u517C\u5BB9","settings.llm.protocolOpenAIResponses":"OpenAI Responses (GPT-5)","settings.llm.protocolAnthropic":"Anthropic \u539F\u751F","settings.llm.protocolHint.anthropic":"Claude \u539F\u751F Messages API\u3002","settings.llm.protocolHint.openai":"Chat Completions /v1/chat/completions \u2014 GPT-4 \u53CA\u5927\u591A\u6570\u517C\u5BB9\u4EE3\u7406\u3002","settings.llm.protocolHint.openaiResponses":"Responses API /v1/responses \u2014 GPT-5 \u7CFB\u5217\u5FC5\u987B\u3002","settings.llm.modelCtxPlaceholder":"\u4E0A\u4E0B\u6587","settings.llm.modelMaxPlaceholder":"\u8F93\u51FA","settings.llm.models":"\u5019\u9009\u6A21\u578B ID","settings.llm.modelsPlaceholder":"\u6A21\u578B ID\uFF0C\u9017\u53F7\u6216\u6362\u884C\u5206\u9694\uFF0C\u4F8B\u5982 claude-sonnet-4-20250514, gpt-5","settings.llm.modelsHint":"\u9017\u53F7\u6216\u6362\u884C\u5206\u9694\u3002","settings.llm.removeProvider":"\u79FB\u9664","settings.llm.modelSelectionTitle":"\u6A21\u578B\u9009\u62E9","settings.llm.modelSelectionDesc":"\u9009\u62E9\u9ED8\u8BA4\u6A21\u578B\u3002","settings.llm.primaryModel":"\u4E3B\u6A21\u578B","settings.llm.primaryModelDesc":"\u7528\u4E8E\u7528\u6237\u5BF9\u8BDD","settings.llm.fastModel":"\u5FEB\u901F\u6A21\u578B","settings.llm.fastModelDesc":"\u7528\u4E8E\u5185\u90E8\u4EFB\u52A1\uFF08\u8BB0\u5FC6\u3001\u603B\u7ED3\uFF09","settings.llm.noModels":"\u6682\u65E0\u53EF\u7528\u6A21\u578B\u3002\u8BF7\u5148\u6DFB\u52A0\u670D\u52A1\u5546\u3002","settings.llm.selectModel":"\u9009\u62E9\u6A21\u578B...","settings.llm.save":"\u4FDD\u5B58\u66F4\u6539","settings.llm.saving":"\u4FDD\u5B58\u4E2D...","settings.llm.saved":"\u914D\u7F6E\u5DF2\u4FDD\u5B58","settings.llm.savedRefreshWarning":"\u914D\u7F6E\u5DF2\u4FDD\u5B58\uFF0C\u4F46\u5B9E\u65F6\u6A21\u578B\u76EE\u5F55\u5237\u65B0\u5931\u8D25\uFF1A{error}","settings.llm.unsavedChanges":"\u6709\u672A\u4FDD\u5B58\u7684\u66F4\u6539","settings.llm.confirmRemoveProvider":"\u786E\u5B9A\u79FB\u9664\u6B64\u670D\u52A1\u5546\uFF1F","settings.llm.setupTitle":"\u8FDE\u63A5\u6A21\u578B","settings.llm.setupDesc":"\u63A8\u8350\u4F7F\u7528 GitHub Copilot\uFF1B\u4E5F\u53EF\u4EE5\u6DFB\u52A0\u81EA\u5DF1\u7684 API \u670D\u52A1\u5546\u3002","settings.llm.providerSectionHint":"\u53EA\u4FDD\u7559\u8FDE\u63A5\u6A21\u578B\u5FC5\u9700\u7684\u4FE1\u606F\u3002","settings.tabs.dashboard":"\u4EEA\u8868\u677F","settings.dashboard.totalUsers":"\u603B\u7528\u6237\u6570","settings.dashboard.onlineUsers":"\u5728\u7EBF\u7528\u6237","settings.dashboard.onlineAgents":"\u5728\u7EBFAgent","settings.dashboard.totalSessions":"\u603B\u4F1A\u8BDD\u6570","settings.dashboard.todayActive":"\u4ECA\u65E5\u6D3B\u8DC3","settings.dashboard.todayMessages":"\u4ECA\u65E5\u6D88\u606F","settings.dashboard.todayUserTurns":"\u4ECA\u65E5\u7528\u6237 Turn","settings.dashboard.totalTokens":"\u603B Token","settings.dashboard.tokenAccuracy":"\u6765\u81EA\u6A21\u578B\u670D\u52A1\u5546\u8FD4\u56DE\u7684\u5B9E\u9645\u7528\u91CF\uFF1B\u4ECE\u542F\u7528\u6309\u7528\u6237 Token \u7EDF\u8BA1\u7684\u7248\u672C\u5F00\u59CB\u7D2F\u8BA1\uFF0C\u4E14\u4E0D\u5305\u542B\u5FC3\u8DF3\u3002","settings.dashboard.agentTurns":"Agent Turn","settings.dashboard.agentSessions":"Agent Session","settings.dashboard.turns":"Turn","settings.dashboard.tokens":"Token","settings.dashboard.inputTokens":"\u8F93\u5165","settings.dashboard.outputTokens":"\u8F93\u51FA","settings.dashboard.cacheTokens":"\u7F13\u5B58","settings.dashboard.today":"\u4ECA\u5929","settings.dashboard.thisWeek":"\u672C\u5468","settings.dashboard.thisMonth":"\u672C\u6708","settings.dashboard.all":"\u5168\u90E8","settings.dashboard.userUsage":"\u7528\u6237\u7528\u91CF","settings.dashboard.agentList":"Agent \u5217\u8868","settings.dashboard.onlineUserList":"\u5728\u7EBF\u7528\u6237","settings.dashboard.refresh":"\u5237\u65B0","settings.dashboard.name":"\u540D\u79F0","settings.dashboard.messages":"\u6D88\u606F\u6570","settings.dashboard.userTurns":"\u7528\u6237 Turn \u6570","settings.dashboard.sessions":"\u4F1A\u8BDD\u6570","settings.dashboard.requests":"\u8BF7\u6C42\u6570","settings.dashboard.traffic":"\u6D41\u91CF","settings.dashboard.lastLogin":"\u6700\u540E\u767B\u5F55","settings.dashboard.status":"\u72B6\u6001","settings.dashboard.latency":"\u5EF6\u8FDF","settings.dashboard.version":"\u7248\u672C","settings.dashboard.owner":"\u6240\u6709\u8005","settings.dashboard.role":"\u89D2\u8272","settings.dashboard.agent":"Agent","settings.dashboard.online":"\u5728\u7EBF","settings.dashboard.offline":"\u79BB\u7EBF","settings.dashboard.noAgents":"\u6682\u65E0\u6CE8\u518C Agent","settings.dashboard.noUserData":"\u6682\u65E0\u7528\u6237\u6570\u636E","settings.dashboard.noOnlineUsers":"\u6682\u65E0\u5728\u7EBF\u7528\u6237","settings.dashboard.loading":"\u52A0\u8F7D\u4E2D...","settings.dashboard.error":"\u6570\u636E\u52A0\u8F7D\u5931\u8D25","settings.dashboard.ago":"{time}\u524D","settings.dashboard.loadMore":"\u52A0\u8F7D\u66F4\u591A\uFF08\u5269\u4F59 {remaining} \u6761\uFF09","workbench.maximize":"\u6700\u5927\u5316\u9762\u677F","workbench.restore":"\u8FD8\u539F\u9762\u677F","workbench.collapse":"\u6536\u8D77\u9762\u677F","theme.switchToLight":"\u5207\u6362\u5230\u6D45\u8272\u4E3B\u9898","theme.switchToDark":"\u5207\u6362\u5230\u6DF1\u8272\u4E3B\u9898","theme.toLight":"\u5207\u6362\u5230\u6D45\u8272\u4E3B\u9898","theme.toDark":"\u5207\u6362\u5230\u6DF1\u8272\u4E3B\u9898","terminal.splitH":"\u6C34\u5E73\u5206\u5C4F\uFF08\u5DE6\u53F3\uFF09","terminal.splitV":"\u5782\u76F4\u5206\u5C4F\uFF08\u4E0A\u4E0B\uFF09","terminal.close":"\u5173\u95ED\u5F53\u524D\u7EC8\u7AEF","terminal.autoCreate":"\u5207\u6362\u5230 Terminal \u6807\u7B7E\u65F6\u5C06\u81EA\u52A8\u521B\u5EFA\u7EC8\u7AEF","terminal.xtermError":"xterm.js \u672A\u52A0\u8F7D\uFF0C\u8BF7\u5237\u65B0\u9875\u9762","terminal.xtermNotLoaded":"xterm.js \u672A\u52A0\u8F7D\uFF0C\u8BF7\u5237\u65B0\u9875\u9762","terminal.mountError":"\u7EC8\u7AEF\u5BB9\u5668\u6302\u8F7D\u5931\u8D25","terminal.mountFailed":"\u7EC8\u7AEF\u5BB9\u5668\u6302\u8F7D\u5931\u8D25","terminal.createError":"\u7EC8\u7AEF\u521B\u5EFA\u5931\u8D25","terminal.createFailed":"\u7EC8\u7AEF\u521B\u5EFA\u5931\u8D25","terminal.error":"\u7EC8\u7AEF\u9519\u8BEF","git.selectFolder":"\u9009\u62E9\u6587\u4EF6\u5939","git.repoPath":"\u8F93\u5165 Git \u4ED3\u5E93\u8DEF\u5F84...","git.repoPathPlaceholder":"\u8F93\u5165 Git \u4ED3\u5E93\u8DEF\u5F84...","git.workDir":"Git \u5DE5\u4F5C\u76EE\u5F55","git.loadStatus":"\u52A0\u8F7D Git \u72B6\u6001","git.loading":"\u52A0\u8F7D Git \u72B6\u6001...","git.loadingStatus":"\u52A0\u8F7D Git \u72B6\u6001...","git.clean":"\u5DE5\u4F5C\u533A\u5E72\u51C0\uFF0C\u65E0\u53D8\u66F4","git.cleanWorkDir":"\u5DE5\u4F5C\u533A\u5E72\u51C0\uFF0C\u65E0\u53D8\u66F4","git.selectAgent":"\u9009\u62E9 Agent \u540E\u52A0\u8F7D Git \u72B6\u6001","git.selectAgentFirst":"\u9009\u62E9 Agent \u540E\u52A0\u8F7D Git \u72B6\u6001","git.diffOnly":"\u53EA\u770B\u5DEE\u5F02","git.fullFile":"\u770B\u5168\u6587","git.zoomIn":"\u653E\u5927\u5B57\u4F53","git.zoomOut":"\u7F29\u5C0F\u5B57\u4F53","git.loadingDiff":"\u52A0\u8F7D Diff...","git.clickToView":"\u70B9\u51FB\u6587\u4EF6\u67E5\u770B\u5DEE\u5F02","git.clickFileToView":"\u70B9\u51FB\u6587\u4EF6\u67E5\u770B\u5DEE\u5F02","git.selectRepo":"\u9009\u62E9 Git \u4ED3\u5E93","git.noDiff":"(\u65E0\u5DEE\u5F02)","git.binaryFile":"(\u4E8C\u8FDB\u5236\u6587\u4EF6)","files.notLoaded":"\u672A\u52A0\u8F7D","files.newFile":"\u65B0\u5EFA\u6587\u4EF6","files.newFolder":"\u65B0\u5EFA\u6587\u4EF6\u5939","files.collapseAll":"\u6298\u53E0\u6240\u6709","files.openFolder":"\u6253\u5F00\u6587\u4EF6\u5939","files.deleteSelected":"\u5220\u9664\u9009\u4E2D","files.moveSelected":"\u79FB\u52A8\u9009\u4E2D","files.enterPath":"\u8F93\u5165\u8DEF\u5F84...","files.searchFiles":"\u641C\u7D22\u6587\u4EF6... (Ctrl+P)","files.noMatch":"\u65E0\u5339\u914D\u7ED3\u679C","files.searching":"\u641C\u7D22\u4E2D...","files.loadingTree":"\u52A0\u8F7D\u4E2D...","files.emptyDir":"\u7A7A\u76EE\u5F55","files.loadingFile":"\u52A0\u8F7D\u6587\u4EF6...","files.searchPlaceholder":"\u641C\u7D22...","files.replacePlaceholder":"\u66FF\u6362...","files.replace":"\u66FF\u6362","files.replaceAll":"\u5168\u90E8","files.replaceCurrent":"\u66FF\u6362\u5F53\u524D","files.replaceAllTitle":"\u5168\u90E8\u66FF\u6362","files.clickToView":"\u70B9\u51FB\u6587\u4EF6\u67E5\u770B\u5185\u5BB9","files.selectFolder":"\u9009\u62E9\u6587\u4EF6\u5939","files.enterFolderName":"\u8F93\u5165\u6587\u4EF6\u5939\u540D...","files.enterFileName":"\u8F93\u5165\u6587\u4EF6\u540D...","files.moveTarget":"\u8F93\u5165\u76EE\u6807\u76EE\u5F55\u8DEF\u5F84...","files.moveItems":"\u5C06 {count} \u4E2A\u9879\u76EE\u79FB\u52A8\u5230\u6307\u5B9A\u76EE\u5F55","files.workDir":"\u5DE5\u4F5C\u76EE\u5F55: {dir}","files.enterDirPath":"\u8F93\u5165\u76EE\u5F55\u8DEF\u5F84...","files.unsavedConfirm":'"{name}" \u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539\uFF0C\u786E\u5B9A\u5173\u95ED\uFF1F',"files.deleteConfirm":'\u786E\u5B9A\u8981\u5220\u9664 "{name}" \u5417\uFF1F',"files.deleteDirHint":"\uFF08\u5C06\u5220\u9664\u6587\u4EF6\u5939\u53CA\u5176\u6240\u6709\u5185\u5BB9\uFF09","files.deleteSelectedConfirm":"\u786E\u5B9A\u8981\u5220\u9664\u9009\u4E2D\u7684 {count} \u4E2A\u9879\u76EE\u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002","files.findPrev":"\u4E0A\u4E00\u4E2A (Shift+Enter)","files.findNext":"\u4E0B\u4E00\u4E2A (Enter)","files.caseSensitive":"\u533A\u5206\u5927\u5C0F\u5199","files.regex":"\u6B63\u5219\u8868\u8FBE\u5F0F","files.unsaved":"\u672A\u4FDD\u5B58","files.clearSelection":"\u6E05\u9664\u9009\u62E9","files.rename":"\u91CD\u547D\u540D","files.copyHere":"\u590D\u5236","files.moveTo":"\u79FB\u52A8\u5230...","files.download":"\u4E0B\u8F7D","files.enterNewName":"\u8F93\u5165\u65B0\u540D\u79F0...","files.loadingPreview":"\u52A0\u8F7D\u9884\u89C8\u4E2D...","files.preview":"\u9884\u89C8","files.edit":"\u7F16\u8F91","files.pptxNotSupported":"PPTX \u672C\u5730\u9884\u89C8\u6682\u4E0D\u652F\u6301\uFF0C\u8BF7\u5728\u8BBE\u7F6E\u4E2D\u5207\u6362\u4E3A Office Online \u6A21\u5F0F\u3002","files.officePreviewMode":"Office \u9884\u89C8\u6A21\u5F0F","files.officeOnline":"Office Online","files.localRender":"\u672C\u5730\u6E32\u67D3","proxy.port":"\u7AEF\u53E3","proxy.label":"\u6807\u7B7E","proxy.add":"\u6DFB\u52A0\u7AEF\u53E3\u6620\u5C04","proxy.addPort":"\u6DFB\u52A0\u7AEF\u53E3\u6620\u5C04","proxy.enable":"\u70B9\u51FB\u542F\u7528","proxy.clickEnable":"\u70B9\u51FB\u542F\u7528","proxy.disable":"\u70B9\u51FB\u7981\u7528","proxy.clickDisable":"\u70B9\u51FB\u7981\u7528","proxy.openNewTab":"\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00","proxy.openInBrowser":"\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00","proxy.noMappings":"\u6682\u65E0\u7AEF\u53E3\u6620\u5C04","proxy.noPorts":"\u6682\u65E0\u7AEF\u53E3\u6620\u5C04","proxy.hint":"\u6DFB\u52A0\u7AEF\u53E3\u540E\uFF0C\u53EF\u901A\u8FC7\u4EE3\u7406 URL \u8BBF\u95EE agent \u673A\u5668\u4E0A\u7684\u672C\u5730\u670D\u52A1","proxy.noPortsHint":"\u6DFB\u52A0\u7AEF\u53E3\u540E\uFF0C\u53EF\u901A\u8FC7\u4EE3\u7406 URL \u8BBF\u95EE agent \u673A\u5668\u4E0A\u7684\u672C\u5730\u670D\u52A1","proxy.selectAgent":"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A Agent","store.selectAgent":"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A Agent","store.creatingConv":"\u6B63\u5728\u521B\u5EFA\u4F1A\u8BDD...","store.loadingHistory":"\u6B63\u5728\u52A0\u8F7D\u4F1A\u8BDD\u5386\u53F2...","store.executionCancelled":"\u6267\u884C\u5DF2\u53D6\u6D88","store.loginFailed":"\u767B\u5F55\u5931\u8D25","store.convClosed":"\u4F1A\u8BDD\u5DF2\u5173\u95ED","store.convCreated":"\u65B0\u4F1A\u8BDD\u5DF2\u521B\u5EFA [{agent}]\uFF0C\u5DE5\u4F5C\u76EE\u5F55: {workDir}","store.convResumed":"\u5DF2\u6062\u590D\u4F1A\u8BDD [{agent}]: {sessionId}","roleplay.creating":"\u6B63\u5728\u521B\u5EFA \u89D2\u8272\u626E\u6F14 \u4F1A\u8BDD...","roleplay.working":"\u5DE5\u4F5C\u4E2D","roleplay.selectTeam":"\u9009\u62E9\u56E2\u961F\u6A21\u677F","roleplay.teamDev":"\u8F6F\u4EF6\u5F00\u53D1","roleplay.teamCustom":"\u81EA\u5B9A\u4E49","roleplay.editRoles":"\u7F16\u8F91\u89D2\u8272","roleplay.roleName":"\u89D2\u8272\u6807\u8BC6","roleplay.roleDisplayName":"\u663E\u793A\u540D\u79F0","roleplay.roleIcon":"\u56FE\u6807","roleplay.roleDesc":"\u89D2\u8272\u63CF\u8FF0","roleplay.rolePrompt":"\u89D2\u8272 Prompt","roleplay.removeRole":"\u79FB\u9664\u89D2\u8272","roleplay.addRole":"\u6DFB\u52A0\u89D2\u8272","roleplay.start":"\u542F\u52A8 \u89D2\u8272\u626E\u6F14","roleplay.sidebarTitle":"\u89D2\u8272\u626E\u6F14","roleplay.configTitle":"\u89D2\u8272\u626E\u6F14","roleplay.newSession":"\u65B0\u5EFA \u89D2\u8272\u626E\u6F14","roleplay.emptyHint":"\u53D1\u9001\u6D88\u606F\u5F00\u59CB\u591A\u89D2\u8272\u534F\u4F5C","roleplay.askingYou":"\u6B63\u5728\u63D0\u95EE","roleplay.language":"\u8BED\u8A00","roleplay.rolePreview":"\u89D2\u8272\u914D\u7F6E","roleplay.noAgents":"\u6CA1\u6709\u5728\u7EBF\u7684 Agent","roleplay.inputPlaceholder":"\u8F93\u5165\u6D88\u606F\u2026 \u4F7F\u7528 @ \u63D0\u53CA\u89D2\u8272","roleplay.existingSessions":"\u5DF2\u6709\u56E2\u961F","roleplay.restore":"\u6062\u590D","roleplay.restoring":"\u6B63\u5728\u6062\u590D \u89D2\u8272\u626E\u6F14 \u4F1A\u8BDD...","roleplay.createNew":"\u521B\u5EFA\u65B0\u56E2\u961F","expertPanel.title":"\u5E2E\u5E2E\u56E2","expertPanel.search":"\u641C\u7D22\u89D2\u8272\u6216 Action...","expertPanel.noResults":"\u6CA1\u6709\u5339\u914D\u7ED3\u679C","expertPanel.clearAll":"\u6E05\u7A7A","expertPanel.persona":"\u89D2\u8272\u4EBA\u8BBE","expertPanel.template":"\u6709\u8F93\u5165\u65F6 \xB7 \u6D88\u606F\u524D\u7F00","expertPanel.templateHint":"\u7528\u6237\u5199\u4E86\u6587\u5B57\u65F6\uFF1A\u6B64\u524D\u7F00 + \u7528\u6237\u6587\u5B57 = \u6700\u7EC8\u53D1\u9001\u5185\u5BB9","expertPanel.defaultMsg":"\u65E0\u8F93\u5165\u65F6 \xB7 \u5B8C\u6574 Prompt","expertPanel.defaultMsgHint":"\u7528\u6237\u4E0D\u5199\u6587\u5B57\u76F4\u63A5\u53D1\u9001\u65F6\uFF0C\u4F7F\u7528\u6B64\u5B8C\u6574 prompt","expertPanel.loading":"\u6B63\u5728\u52A0\u8F7D\u89D2\u8272\u5B9A\u4E49...","expertPanel.viewPrompt":"\u67E5\u770B\u63D0\u793A\u8BCD","expertPanel.customRoles":"\u81EA\u5B9A\u4E49\u89D2\u8272","expertPanel.addRole":"\u6DFB\u52A0\u89D2\u8272","expertPanel.editRole":"\u7F16\u8F91\u89D2\u8272","expertPanel.deleteRole":"\u5220\u9664\u89D2\u8272","expertPanel.noCustomRoles":"\u6682\u65E0\u81EA\u5B9A\u4E49\u89D2\u8272","expertPanel.createFirst":"\u521B\u5EFA\u7B2C\u4E00\u4E2A\u81EA\u5B9A\u4E49\u89D2\u8272","expertPanel.noActions":"\u6682\u65E0 Action","expertPanel.deleteConfirm":'\u786E\u5B9A\u8981\u5220\u9664\u89D2\u8272 "{name}" \u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002',"expertPanel.deleteConfirmBtn":"\u5220\u9664","expertEditor.createTitle":"\u521B\u5EFA\u81EA\u5B9A\u4E49\u89D2\u8272","expertEditor.editTitle":"\u7F16\u8F91\u81EA\u5B9A\u4E49\u89D2\u8272","expertEditor.basicInfo":"\u57FA\u672C\u4FE1\u606F","expertEditor.roleName":"\u89D2\u8272\u540D\u79F0","expertEditor.roleNamePlaceholder":"\u5982\uFF1A\u6570\u636E\u5206\u6790\u5E08","expertEditor.roleTitle":"\u804C\u79F0","expertEditor.roleTitlePlaceholder":"\u5982\uFF1A\u9AD8\u7EA7\u6570\u636E\u5206\u6790\u5E08","expertEditor.fullName":"\u5168\u540D","expertEditor.fullNamePlaceholder":"\u53EF\u9009","expertEditor.titleEn":"\u82F1\u6587\u804C\u79F0","expertEditor.titleEnPlaceholder":"\u53EF\u9009","expertEditor.rolePrompt":"\u89D2\u8272 Prompt","expertEditor.messagePrefix":"\u6D88\u606F\u524D\u7F00\uFF08\u4E2D\u6587\uFF09","expertEditor.messagePrefixPlaceholder":"\u5982\uFF1A\u4F5C\u4E3A\u4E00\u540D\u8D44\u6DF1\u6570\u636E\u5206\u6790\u5E08\uFF0C","expertEditor.messagePrefixEn":"\u6D88\u606F\u524D\u7F00\uFF08\u82F1\u6587\uFF09","expertEditor.messagePrefixEnPlaceholder":"As a senior data analyst, ","expertEditor.actions":"Actions","expertEditor.addAction":"\u6DFB\u52A0 Action","expertEditor.removeAction":"\u79FB\u9664","expertEditor.actionName":"Action \u540D\u79F0","expertEditor.actionNamePlaceholder":"\u5982\uFF1A\u6570\u636E\u5206\u6790","expertEditor.actionNameEn":"\u82F1\u6587\u540D\u79F0","expertEditor.actionNameEnPlaceholder":"\u53EF\u9009","expertEditor.messageTemplate":"\u6709\u8F93\u5165\u65F6 \xB7 \u6D88\u606F\u524D\u7F00\uFF08\u4E2D\u6587\uFF09","expertEditor.messageTemplatePlaceholder":"\u7528\u6237\u5199\u4E86\u6587\u5B57\u65F6\uFF0C\u62FC\u5728\u7528\u6237\u6587\u5B57\u524D\u9762\u53D1\u9001","expertEditor.messageTemplateEn":"\u6709\u8F93\u5165\u65F6 \xB7 \u6D88\u606F\u524D\u7F00\uFF08\u82F1\u6587\uFF09","expertEditor.messageTemplateEnPlaceholder":"Prepended to user text when user types something","expertEditor.defaultMessage":"\u65E0\u8F93\u5165\u65F6 \xB7 \u5B8C\u6574 Prompt\uFF08\u4E2D\u6587\uFF09","expertEditor.defaultMessagePlaceholder":"\u7528\u6237\u4E0D\u5199\u6587\u5B57\u76F4\u63A5\u53D1\u9001\u65F6\uFF0C\u4F7F\u7528\u6B64\u5B8C\u6574\u5185\u5BB9","expertEditor.defaultMessageEn":"\u65E0\u8F93\u5165\u65F6 \xB7 \u5B8C\u6574 Prompt\uFF08\u82F1\u6587\uFF09","expertEditor.defaultMessageEnPlaceholder":"Used as-is when user sends without typing","expertEditor.cancel":"\u53D6\u6D88","expertEditor.save":"\u4FDD\u5B58","expertEditor.saving":"\u4FDD\u5B58\u4E2D...","subAgentPanel.title":"\u5B50\u4EE3\u7406","subAgentPanel.back":"\u8FD4\u56DE\u5217\u8868","subAgentPanel.running":"\u8FD0\u884C\u4E2D","subAgentPanel.completed":"\u5DF2\u5B8C\u6210","subAgentPanel.waitingMessages":"\u7B49\u5F85\u6D88\u606F...","subAgentPanel.toolCount":"{count} \u4E2A\u5DE5\u5177","subAgentPanel.toolSummary":"\u5DF2\u5B8C\u6210 {count} \u6B21\u5DE5\u5177\u8C03\u7528","subAgentPanel.empty":"\u6682\u65E0\u5B50\u4EE3\u7406","subAgentPanel.emptyHint":"\u5F53 Claude \u59D4\u6D3E\u4EFB\u52A1\u65F6\uFF0C\u5B50\u4EE3\u7406\u4F1A\u5728\u8FD9\u91CC\u663E\u793A","splitScreen.split":"\u5206\u5C4F","splitScreen.closePane":"\u5173\u95ED\u6B64\u9762\u677F","splitScreen.newChat":"\u65B0\u5EFA Chat","splitScreen.noSessions":"\u6682\u65E0\u4F1A\u8BDD","splitScreen.splitToPanel":"\u5728\u65B0\u9762\u677F\u4E2D\u6253\u5F00","splitScreen.selectFromSidebar":"\u4ECE\u5DE6\u4FA7\u9009\u62E9\u5BF9\u8BDD","yeaft.vp.library":"\u89D2\u8272\u5E93","yeaft.vp.createFirst":"+ \u521B\u5EFA\u4F60\u7684\u7B2C\u4E00\u4E2A\u89D2\u8272","yeaft.vp.empty.aria":"\u5C1A\u65E0\u89D2\u8272","yeaft.vp.avatar.aria":"{name} \u5934\u50CF","yeaft.vp.speaker.stateCauseAria":"\u72B6\u6001\u53D8\u66F4\uFF1A{cause}","yeaft.vp.status.thinking":"\u6B63\u5728\u601D\u8003\u2026","yeaft.vp.status.tool":"\u6B63\u5728\u4F7F\u7528 {name}","yeaft.vp.status.done":"\u5B8C\u6210 \xB7 {count} \u4E2A\u5DE5\u5177","yeaft.vp.status.aborted":"\u5DF2\u4E2D\u6B62","yeaft.vp.crud.title":"\u89D2\u8272\u5E93","yeaft.vp.crud.close":"\u5173\u95ED","yeaft.vp.crud.addNew":"+ \u65B0\u5EFA\u89D2\u8272","yeaft.vp.crud.empty":"\u8FD8\u6CA1\u6709\u89D2\u8272\u3002\u521B\u5EFA\u7B2C\u4E00\u4E2A\u89D2\u8272\u5F00\u59CB\u534F\u4F5C\u5427\u3002","yeaft.vp.crud.edit":"\u7F16\u8F91","yeaft.vp.crud.delete":"\u5220\u9664","yeaft.vp.crud.deleteConfirm":'\u5220\u9664 "{name}"\uFF1F\u4F1A\u4E00\u5E76\u5220\u9664\u78C1\u76D8\u4E0A\u7684 role.md \u6587\u4EF6\u3002',"yeaft.vp.crud.form.create":"\u521B\u5EFA\u89D2\u8272","yeaft.vp.crud.form.update":"\u7F16\u8F91\u89D2\u8272","yeaft.vp.crud.form.vpId":"\u89D2\u8272 ID","yeaft.vp.crud.form.vpId.tooltip":"\u53EA\u80FD\u7528\u5B57\u6BCD\u3001\u6570\u5B57\u3001- \u548C _\uFF0C\u4E0D\u80FD\u4EE5 _ \u5F00\u5934\uFF0C\u4E0D\u80FD\u662F\u7EAF\u6570\u5B57\uFF0C\u4E0D\u80FD\u7528\u4FDD\u7559\u540D\uFF1Aall / user / system / everyone\u3002","yeaft.vp.crud.form.displayName":"\u663E\u793A\u540D\uFF08\u82F1\u6587\uFF09","yeaft.vp.crud.form.displayNameZh":"\u663E\u793A\u540D\uFF08\u4E2D\u6587\uFF09","yeaft.vp.crud.form.description":"\u80FD\u529B\u63CF\u8FF0\uFF08\u82F1\u6587\uFF09","yeaft.vp.crud.form.descriptionZh":"\u80FD\u529B\u63CF\u8FF0\uFF08\u4E2D\u6587\uFF09","yeaft.vp.crud.form.descriptionPlaceholder":"\u4F8B\u5982\uFF1AAPI design, migration planning, and compatibility reviews","yeaft.vp.crud.form.descriptionZhPlaceholder":"\u4F8B\u5982\uFF1AAPI \u8BBE\u8BA1\u3001\u8FC1\u79FB\u89C4\u5212\u4E0E\u517C\u5BB9\u6027\u8BC4\u5BA1","yeaft.vp.crud.form.role":"\u804C\u4F4D","yeaft.vp.crud.form.rolePlaceholder":"\u4F8B\u5982\uFF1A\u4EA7\u54C1\u7ECF\u7406","yeaft.vp.crud.form.traits":"\u7279\u8D28\u6807\u7B7E","yeaft.vp.crud.form.traitsHint":"\u7528\u82F1\u6587\u9017\u53F7\u5206\u9694\u7684\u77ED\u6807\u7B7E\uFF08\u4F8B\u5982\uFF1A\u597D\u5947, \u52A1\u5B9E\uFF09\u3002","yeaft.vp.crud.form.modelHint":"\u6A21\u578B\u504F\u597D","yeaft.vp.crud.form.modelHint.none":"\u2014 \u9ED8\u8BA4 \u2014","yeaft.vp.crud.form.modelHint.primary":"\u4E3B\u6A21\u578B","yeaft.vp.crud.form.modelHint.fast":"\u5FEB\u6A21\u578B","yeaft.vp.crud.form.persona":"\u4EBA\u8BBE\uFF08Markdown\uFF09","yeaft.vp.crud.form.personaPlaceholder":"\u63CF\u8FF0\u8FD9\u4E2A\u89D2\u8272\u5982\u4F55\u601D\u8003\u3001\u8868\u8FBE\u3001\u505A\u51B3\u7B56\u2026\u2026","yeaft.vp.crud.form.submit":"\u4FDD\u5B58","yeaft.vp.crud.form.cancel":"\u53D6\u6D88","yeaft.vp.crud.form.ok":"\u683C\u5F0F\u6B63\u786E","yeaft.vp.crud.form.idLocked":"\u521B\u5EFA\u540E\u89D2\u8272 ID \u4E0D\u53EF\u4FEE\u6539\u3002","yeaft.vp.crud.saving":"\u4FDD\u5B58\u4E2D\u2026\u2026","yeaft.vp.crud.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}","yeaft.vp.crud.deleteFailed":"\u5220\u9664\u5931\u8D25\uFF1A{error}","yeaft.vp.crud.viewPrompt":"\u67E5\u770B prompt","yeaft.vp.crud.view.title":"VP \u63D0\u793A\u8BCD","yeaft.vp.crud.view.personaEmpty":"\uFF08\u672A\u5B9A\u4E49 persona \u6B63\u6587\uFF0C\u53EA\u6709\u57FA\u7840\u5143\u6570\u636E\uFF09","yeaft.vp.crud.view.back":"\u8FD4\u56DE","yeaft.vp.crud.view.editFromHere":"\u7F16\u8F91\u8BE5 VP","yeaft.vp.crud.view.removed":"\u8BE5 VP \u5DF2\u5728\u522B\u5904\u88AB\u5220\u9664\uFF0C\u8FD4\u56DE\u5217\u8868\u3002","yeaft.vp.crud.stockBadge":"\u9884\u88C5","yeaft.vp.crud.stockReadOnly":"\u9884\u88C5 VP \u968F agent \u51FA\u5382\uFF0C\u4E0D\u80FD\u7F16\u8F91\u6216\u5220\u9664\u3002","yeaft.vp.idError.empty_or_non_string":"\u89D2\u8272 ID \u4E0D\u80FD\u4E3A\u7A7A\u3002","yeaft.vp.idError.too_long":"\u89D2\u8272 ID \u592A\u957F\uFF08\u6700\u591A 40 \u5B57\u7B26\uFF09\u3002","yeaft.vp.idError.illegal_character":'\u53EA\u80FD\u4F7F\u7528\u5B57\u6BCD\u3001\u6570\u5B57\u3001"-" \u548C "_"\u3002',"yeaft.vp.idError.underscore_prefix_reserved":'\u89D2\u8272 ID \u4E0D\u80FD\u4EE5 "_" \u5F00\u5934\uFF08\u9884\u7559\u7ED9\u7CFB\u7EDF\u89D2\u8272\uFF09\u3002',"yeaft.vp.idError.pure_digits":"\u89D2\u8272 ID \u4E0D\u80FD\u662F\u7EAF\u6570\u5B57\u3002","yeaft.vp.idError.reserved":"\u89D2\u8272 ID \u4E0D\u80FD\u7528\u4FDD\u7559\u540D\uFF08all / user / system / everyone\uFF09\u3002","yeaft.vp.idError.duplicate":"\u5DF2\u7ECF\u5B58\u5728\u540C ID \u7684\u89D2\u8272\u3002","yeaft.vp.idError.not_found":"\u8BE5 VP \u4E0D\u5B58\u5728\uFF0C\u53EF\u80FD\u5DF2\u88AB\u5220\u9664\u3002","yeaft.vp.idError.stock_readonly":"\u9884\u88C5 VP \u4E0D\u80FD\u7F16\u8F91\u6216\u5220\u9664\u3002","yeaft.vp.idError.unknown":"\u53D1\u751F\u672A\u77E5\u9519\u8BEF\uFF0C\u8BF7\u91CD\u8BD5\u3002","yeaft.vp.reason.personaEdit":"\u4EBA\u8BBE\u5DF2\u66F4\u65B0","yeaft.vp.reason.traitsEdit":"\u7279\u5F81\u5DF2\u66F4\u65B0","yeaft.vp.reason.manualReload":"\u5DF2\u91CD\u65B0\u8F7D\u5165","yeaft.vp.reason.fileRemoved":"\u5DF2\u79FB\u9664","yeaft.vp.reason.toast.updated":"{name}\uFF1A{reason}","yeaft.vp.reason.toast.removed":"{name} \u5DF2\u88AB\u79FB\u9664","yeaft.message.timeAria":"\u53D1\u9001\u4E8E {time}","yeaft.user.youLabel":"\u6211","yeaft.session.sidebarTitle":"\u4F1A\u8BDD","yeaft.session.sidebarAria":"\u4F1A\u8BDD\u5217\u8868","yeaft.session.newButton":"+ \u65B0\u5EFA\u4F1A\u8BDD","yeaft.session.newButtonAria":"\u521B\u5EFA\u65B0\u4F1A\u8BDD","yeaft.session.empty":"\u6682\u65E0\u4F1A\u8BDD\u3002","yeaft.session.membersCount":"{count} \u4F4D\u6210\u5458","yeaft.session.oneMember":"1 \u4F4D\u6210\u5458","yeaft.session.noMembers":"\u7A7A\u4F1A\u8BDD \u2014 \u8BF7\u9080\u8BF7 VP","yeaft.session.defaultBadge":"\u9ED8\u8BA4","yeaft.session.defaultName":"\u9ED8\u8BA4\u4F1A\u8BDD","yeaft.session.moreActions":"\u66F4\u591A\u64CD\u4F5C","yeaft.session.archive":"\u5F52\u6863","yeaft.session.archiveConfirm":"\u5F52\u6863\u300C{name}\u300D\uFF1F\u7A0D\u540E\u53EF\u4ECE\u78C1\u76D8\u6062\u590D\u3002","yeaft.session.archivingEllipsis":"\u5F52\u6863\u4E2D\u2026","yeaft.session.delete":"\u5220\u9664","yeaft.session.deleteConfirm":"\u5220\u9664\u300C{name}\u300D\uFF1F\u5C06\u6C38\u4E45\u5220\u9664\u8BE5\u4F1A\u8BDD\u53CA\u5176\u6240\u6709\u6570\u636E\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002","yeaft.session.deletingEllipsis":"\u5220\u9664\u4E2D\u2026","yeaft.session.rename":"\u91CD\u547D\u540D","yeaft.session.openSettings":"\u8BBE\u7F6E","yeaft.session.removeFromList":"\u79FB\u9664","yeaft.session.manageMembers":"\u7BA1\u7406\u6210\u5458","yeaft.session.memberCount.one":"1 \u4F4D\u6210\u5458","yeaft.session.memberCount.other":"{count} \u4F4D\u6210\u5458","yeaft.session.renamePrompt":"\u4E3A\u300C{name}\u300D\u8F93\u5165\u65B0\u540D\u79F0\uFF1A","yeaft.session.renamingEllipsis":"\u91CD\u547D\u540D\u4E2D\u2026","yeaft.session.editModal.renameTitle":"\u91CD\u547D\u540D\u4F1A\u8BDD","yeaft.session.editModal.renameBody":"\u4E3A\u300C{name}\u300D\u9009\u62E9\u4E00\u4E2A\u65B0\u540D\u79F0\u3002","yeaft.session.editModal.renameSubmit":"\u4FDD\u5B58","yeaft.session.editModal.archiveTitle":"\u5F52\u6863\u4F1A\u8BDD","yeaft.session.editModal.archiveBody":"\u5F52\u6863\u300C{name}\u300D\uFF1F\u7A0D\u540E\u53EF\u4ECE\u78C1\u76D8\u6062\u590D\u3002","yeaft.session.editModal.archiveSubmit":"\u5F52\u6863","yeaft.session.editModal.deleteTitle":"\u5220\u9664\u4F1A\u8BDD","yeaft.session.editModal.deleteBody":"\u5220\u9664\u300C{name}\u300D\uFF1F\u5C06\u6C38\u4E45\u5220\u9664\u8BE5\u4F1A\u8BDD\u53CA\u5176\u6240\u6709\u6570\u636E\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002","yeaft.session.editModal.deleteSubmit":"\u5220\u9664","yeaft.session.editModal.newNameLabel":"\u65B0\u540D\u79F0","yeaft.session.editModal.cancel":"\u53D6\u6D88","yeaft.session.editModal.close":"\u5173\u95ED","yeaft.session.error.invalid_name":"\u4F1A\u8BDD\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A\u3002","yeaft.session.error.duplicate":"\u8BE5\u4F1A\u8BDD id \u5DF2\u5B58\u5728\u3002","yeaft.session.error.not_found":"\u672A\u627E\u5230\u8BE5\u4F1A\u8BDD\u3002","yeaft.session.error.default_not_in_roster":"\u9ED8\u8BA4 VP \u5FC5\u987B\u5728\u6210\u5458\u5217\u8868\u4E2D\u3002","yeaft.session.error.no_default_vp":"\u8BE5\u4F1A\u8BDD\u6CA1\u6709\u6210\u5458\uFF0C\u8BF7\u4ECE\u89D2\u8272\u5E93\u6DFB\u52A0 VP \u4EE5\u5F00\u59CB\u5BF9\u8BDD\u3002","yeaft.session.error.reserved":"\u6240\u9009 id \u4E2D\u5305\u542B\u4FDD\u7559\u540D\uFF08all / user / system / everyone\uFF09\u3002","yeaft.session.error.unknown":"\u4F1A\u8BDD\u64CD\u4F5C\u5931\u8D25\uFF1A{message}","yeaft.session.error.timeout":"\u4F1A\u8BDD\u64CD\u4F5C\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5\u3002","yeaft.session.invite.title":"\u9080\u8BF7 VP","yeaft.session.invite.body":"\u300C{name}\u300D\u5F53\u524D\u4E3A\u7A7A\uFF0C\u8BF7\u4ECE\u89D2\u8272\u5E93\u6DFB\u52A0\u4E00\u4F4D VP \u4EE5\u5F00\u59CB\u5BF9\u8BDD\u3002","yeaft.session.invite.openLibrary":"\u6253\u5F00\u89D2\u8272\u5E93","yeaft.session.invite.dismiss":"\u6682\u4E0D","yeaft.session.empty.title":"\u7A7A\u4F1A\u8BDD","yeaft.session.empty.hint":"\u300C{name}\u300D\u8FD8\u6CA1\u6709\u6210\u5458\u3002\u6DFB\u52A0\u4E00\u4F4D VP \u5373\u53EF\u5F00\u59CB\u5BF9\u8BDD\u3002","yeaft.session.empty.cta":"\u7BA1\u7406\u6210\u5458","yeaft.session.members.title":"\u7BA1\u7406\u300C{name}\u300D\u7684\u6210\u5458","yeaft.session.members.aria":"\u6210\u5458\u7BA1\u7406","yeaft.session.members.close":"\u5173\u95ED","yeaft.session.members.done":"\u5B8C\u6210","yeaft.session.members.empty":"\u6682\u65E0\u53EF\u7528 VP \u2014 \u8BF7\u5148\u5230\u89D2\u8272\u5E93\u521B\u5EFA\u3002","yeaft.session.members.loading":"VP \u52A0\u8F7D\u4E2D\u2026","yeaft.session.members.defaultHint":"\u9ED8\u8BA4 VP\uFF08@\u63D0\u53CA\u7F3A\u7701\u65F6\u7531\u8BE5 VP \u5E94\u7B54\uFF09","yeaft.session.members.memberCount":"\u5DF2\u9009 {count} \u4F4D","yeaft.session.members.actionFailed":"\u64CD\u4F5C\u5931\u8D25\uFF1A{error}","yeaft.session.members.openLibrary":"\u6253\u5F00 VP \u5E93","yeaft.session.members.openLibraryHint":"\u5728 VP \u5E93\u53EF\u521B\u5EFA\u65B0 VP \u6216\u67E5\u770B VP \u7684 prompt\u3002","yeaft.session.announcement.label":"\u4F1A\u8BDD\u516C\u544A","yeaft.session.announcement.hintEmpty":"\u6682\u65E0\u516C\u544A \u2014 \u70B9\u51FB \u270F\uFE0F \u6DFB\u52A0\u3002","yeaft.session.announcement.emptyBody":"\u672A\u8BBE\u7F6E\u4F1A\u8BDD\u516C\u544A\u3002\u53EF\u4EE5\u5728\u8FD9\u91CC\u5199\u4E00\u6BB5\u7B80\u4ECB\uFF0C\u4F1A\u8BDD\u5185\u6240\u6709 VP \u5728\u6536\u5230\u6D88\u606F\u65F6\u90FD\u4F1A\u5728 system prompt \u9876\u90E8\u770B\u5230 \u2014 \u9002\u5408\u5199\u5171\u540C\u80CC\u666F\u3001\u89C4\u5219\u3001\u6216 CLAUDE.md \u5F0F\u7684\u6307\u5F15\u3002","yeaft.session.announcement.placeholder":"\u4E3A\u8FD9\u4E2A\u4F1A\u8BDD\u91CC\u7684\u6240\u6709 VP \u5199\u4E00\u6BB5\u5171\u4EAB\u7684\u7B80\u4ECB\u2026","yeaft.session.announcement.edit":"\u7F16\u8F91\u516C\u544A","yeaft.session.announcement.editTitle":"\u7F16\u8F91\u4F1A\u8BDD\u516C\u544A","yeaft.session.announcement.saving":"\u4FDD\u5B58\u4E2D\u2026","yeaft.session.announcement.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}","yeaft.session.announcement.openSettings":"\u6253\u5F00\u4F1A\u8BDD\u8BBE\u7F6E","yeaft.session.settings.title":"{name} \u2014 \u4F1A\u8BDD\u8BBE\u7F6E","yeaft.session.settings.short":"\u4F1A\u8BDD","yeaft.session.settings.close":"\u5173\u95ED","yeaft.session.settings.nav.session":"\u4F1A\u8BDD","yeaft.session.settings.nav.members":"\u6210\u5458","yeaft.session.settings.nav.memory":"\u4F1A\u8BDD\u8BB0\u5FC6","yeaft.session.settings.announcement.heading":"\u4F1A\u8BDD\u516C\u544A","yeaft.session.settings.announcement.help":"\u6CE8\u5165\u5230\u4F1A\u8BDD\u5185\u6BCF\u4E2A VP \u7684 system prompt \u9876\u90E8 \u2014 \u7C7B\u4F3C\u56E2\u961F\u5171\u4EAB\u7684 CLAUDE.md\u3002","yeaft.session.settings.members.heading":"\u6210\u5458","yeaft.session.settings.rename.heading":"\u91CD\u547D\u540D\u4F1A\u8BDD","yeaft.session.settings.rename.label":"\u65B0\u540D\u79F0","yeaft.session.settings.rename.save":"\u4FDD\u5B58\u540D\u79F0","yeaft.session.settings.rename.saving":"\u4FDD\u5B58\u4E2D\u2026","yeaft.session.settings.memory.heading":"\u4F1A\u8BDD\u8BB0\u5FC6","yeaft.session.settings.memory.help":"\u7ACB\u5373\u8FD0\u884C dream \u6574\u7406\uFF1A\u8BFB\u53D6\u4E0A\u6B21\u4EE5\u6765\u7684\u65B0\u6D88\u606F\uFF0C\u63D0\u53D6\u8981\u70B9\u5E76\u5408\u5E76\u8FDB\u4F1A\u8BDD\u7684 summary\uFF0C\u8BA9 Resident \u5C42\u80FD\u53CD\u6620\u6700\u65B0\u7684\u5BF9\u8BDD\u3002","yeaft.session.settings.memory.runNow":"\u7ACB\u5373\u8FD0\u884C dream","yeaft.session.settings.memory.running":"\u8FD0\u884C\u4E2D\u2026","yeaft.session.settings.memory.lastSuccess":"\u4E0A\u6B21\u6210\u529F\uFF1A{time} \u2014 \u66F4\u65B0\u4E86 {count} \u4E2A\u76EE\u6807\u3002","yeaft.session.settings.memory.lastError":"\u4E0A\u6B21\u8FD0\u884C\u5931\u8D25\uFF1A{error}","yeaft.session.settings.danger.heading":"\u5220\u9664\u4F1A\u8BDD","yeaft.session.settings.danger.deleteHelp":"\u8FD9\u4F1A\u6C38\u4E45\u5220\u9664\u8BE5\u4F1A\u8BDD\uFF0C\u79FB\u9664\u78C1\u76D8\u4E0A\u7684 session.json \u548C\u5168\u90E8\u6D88\u606F\u5386\u53F2\uFF0C\u4E0D\u53EF\u6062\u590D\u3002","yeaft.session.settings.danger.deleteBtn":"\u5220\u9664\u4F1A\u8BDD","yeaft.vp.mention.placeholder":"\u6309 id \u6216\u540D\u79F0\u641C\u7D22\u89D2\u8272\u2026","yeaft.vp.mention.noMatch":"\u6CA1\u6709\u5339\u914D\u7684\u89D2\u8272","yeaft.vp.mention.count":"\u5DF2 @{count} \u4EBA","yeaft.feature.reject.missing_group_id":"\u53D1\u9001\u5931\u8D25\uFF1A\u672A\u6307\u5B9A\u4F1A\u8BDD\u3002","yeaft.feature.reject.missing_feature_id":"\u53D1\u9001\u5931\u8D25\uFF1A\u4EFB\u52A1\u4E0A\u4E0B\u6587\u4E22\u5931\u3002","yeaft.feature.reject.missing_vp_id":"\u53D1\u9001\u5931\u8D25\uFF1A\u672A\u8BBE\u7F6E\u53D1\u8A00\u8005\u3002","yeaft.feature.reject.invalid_vp_id":"\u53D1\u9001\u5931\u8D25\uFF1A\u53D1\u8A00\u8005 id \u975E\u6CD5\u3002","yeaft.feature.reject.empty_text":"\u53D1\u9001\u5931\u8D25\uFF1A\u5185\u5BB9\u4E3A\u7A7A\u3002","yeaft.feature.reject.text_too_long":"\u53D1\u9001\u5931\u8D25\uFF1A\u5185\u5BB9\u8FC7\u957F\uFF08\u4E0A\u9650 16 KiB\uFF09\u3002","yeaft.feature.reject.unknown":"\u53D1\u9001\u5931\u8D25\u3002","yeaft.feature.pill.label":"\u4EFB\u52A1","yeaft.feature.messageTime.aria":"\u53D1\u9001\u4E8E {time}","yeaft.vp.turnBlock.elapsedTitle":"\u672C\u8F6E turn \u5F00\u59CB\u81F3\u4ECA\u7684\u65F6\u95F4","yeaft.vp.turnBlock.retryingRequest":"\u54CD\u5E94\u505C\u6EDE\uFF0C\u6B63\u5728\u53D1\u8D77\u5168\u65B0\u8BF7\u6C42\uFF08{attempt}/{max}\uFF09","yeaft.vp.turnBlock.retryingContinue":"\u54CD\u5E94\u505C\u6EDE\uFF0C\u6B63\u5728\u7528\u5168\u65B0\u8BF7\u6C42\u7EED\u5199\uFF08{attempt}/{max}\uFF09","yeaft.sessionStatus.aria":"Session \u72B6\u6001","yeaft.sessionStatus.title":"Session \u72B6\u6001","yeaft.sessionStatus.announcement":"\u516C\u544A","yeaft.sessionStatus.announcementEmpty":"\u6682\u65E0\u516C\u544A","yeaft.sessionStatus.announcementAdd":"\u6DFB\u52A0\u516C\u544A","yeaft.sessionStatus.announcementEdit":"\u7F16\u8F91\u516C\u544A","yeaft.sessionStatus.vps":"VP","yeaft.sessionStatus.backgroundTasks":"\u540E\u53F0\u4EFB\u52A1","yeaft.sessionStatus.noLogPreview":"\u6682\u65E0\u65E5\u5FD7\u8F93\u51FA\u3002","yeaft.sessionStatus.task.subAgentStarted":"{name} \u5DF2\u542F\u52A8","yeaft.sessionStatus.task.subAgentStartedWithMission":"{name} \u5DF2\u542F\u52A8\uFF1A{mission}","yeaft.sessionStatus.task.subAgentStatus":"{name} \u72B6\u6001\uFF1A{status}","yeaft.sessionStatus.task.subAgentStatusUpdated":"{name} \u72B6\u6001\u5DF2\u66F4\u65B0","yeaft.sessionStatus.task.subAgentResult":"{name} \u7ED3\u679C\uFF1A{text}","yeaft.sessionStatus.task.subAgentProducedResult":"{name} \u5DF2\u4EA7\u751F\u7ED3\u679C","yeaft.sessionStatus.task.subAgentUsedTool":"{name} \u8C03\u7528\u4E86 {tool}","yeaft.sessionStatus.task.subAgentFinishedTool":"{name} \u5B8C\u6210\u4E86 {tool}","yeaft.sessionStatus.task.subAgentUsage":"{name} \u4F7F\u7528\u4E86 {tokens} tokens","yeaft.sessionStatus.task.subAgentEvent":"{name}\uFF1A{text}","yeaft.sessionStatus.task.subAgentUserPrompt":"\u4F60\uFF1A{text}","yeaft.sessionStatus.task.subAgentToolSummary":"\u5DF2\u5B8C\u6210 {count} \u6B21\u5DE5\u5177\u8C03\u7528","yeaft.sessionStatus.task.subAgentError":"{name} \u9519\u8BEF\uFF1A{error}","yeaft.sessionStatus.task.subAgentHitError":"{name} \u9047\u5230\u9519\u8BEF","yeaft.sessionStatus.task.subAgentNoReadableEvents":"\u6682\u65E0\u53EF\u8BFB\u7684 sub-agent \u6D3B\u52A8\u3002","yeaft.sessionStatus.task.promptPlaceholder":"\u7ED9\u8FD9\u4E2A sub-agent \u8FFD\u52A0\u60F3\u6CD5\u2026","yeaft.sessionStatus.task.promptSend":"\u53D1\u9001","yeaft.sessionStatus.task.promptSending":"\u53D1\u9001\u4E2D\u2026","yeaft.sessionStatus.task.promptFailed":"\u53D1\u9001\u5931\u8D25\u3002","yeaft.sessionStatus.task.title":"\u4EFB\u52A1","yeaft.sessionStatus.task.command":"\u547D\u4EE4","yeaft.sessionStatus.task.stop":"\u505C\u6B62\u4EFB\u52A1","yeaft.sessionStatus.task.stopping":"\u505C\u6B62\u4E2D\u2026","yeaft.sessionStatus.task.kind.subAgent":"sub-agent","yeaft.sessionStatus.task.kind.shell":"shell","yeaft.sessionStatus.show":"\u663E\u793A Session \u72B6\u6001","yeaft.sessionStatus.hide":"\u9690\u85CF Session \u72B6\u6001","yeaft.sessionStatus.close":"\u5173\u95ED Session \u72B6\u6001","yeaft.vpTimeline.empty":"\u672C Session \u8FD8\u6CA1\u6709 VP\u3002","yeaft.vpTimeline.resizeTitle":"\u62D6\u52A8\u8C03\u6574\u5BBD\u5EA6","yeaft.vpTimeline.status.idle":"\u7A7A\u95F2","yeaft.vpTimeline.status.typing":"\u8F93\u5165\u4E2D\u2026","yeaft.vpTimeline.status.thinking":"\u601D\u8003\u4E2D\u2026","yeaft.vpTimeline.status.retrying":"\u6B63\u5728\u91CD\u8BD5\u8BF7\u6C42\u2026","yeaft.vpTimeline.status.streaming":"\u751F\u6210\u4E2D","yeaft.vpTimeline.status.tool":"\u8C03\u7528\u5DE5\u5177\u4E2D\u2026","yeaft.vpTimeline.status.error":"\u51FA\u9519","yeaft.vpTimeline.status.offline":"\u79BB\u7EBF","yeaft.vpTimeline.abort":"\u4E2D\u6B62","yeaft.vpTimeline.edit":"\u7F16\u8F91 VP","yeaft.vpTimeline.mention":"\u70B9\u51FB @ \u8BE5 VP","yeaft.vpTimeline.expand":"\u5C55\u5F00\u4EFB\u52A1\u8BE6\u60C5","yeaft.toolStats.title":"\u5DE5\u5177\u4F7F\u7528\u7EDF\u8BA1","yeaft.toolStats.refresh":"\u5237\u65B0","yeaft.toolStats.close":"\u5173\u95ED","yeaft.toolStats.tabAll":"\u5168\u90E8\u5DE5\u5177","yeaft.toolStats.tabUnused":"\u672A\u4F7F\u7528","yeaft.toolStats.loading":"\u52A0\u8F7D\u4E2D\u2026","yeaft.toolStats.notLoaded":"\u6682\u65E0\u6570\u636E \u2014 \u70B9\u51FB\u5237\u65B0\u3002","yeaft.toolStats.empty":"\uFF08\u6682\u65E0\u5DE5\u5177\u8C03\u7528\u8BB0\u5F55\uFF09","yeaft.toolStats.noneUnused":"\uFF08\u6BCF\u4E2A\u5DF2\u6CE8\u518C\u5DE5\u5177\u90FD\u81F3\u5C11\u88AB\u8C03\u7528\u8FC7\u4E00\u6B21\uFF09","yeaft.toolStats.fetchedAt":"\u83B7\u53D6\u65F6\u95F4","yeaft.toolStats.col.name":"\u5DE5\u5177","yeaft.toolStats.col.calls":"\u8C03\u7528","yeaft.toolStats.col.errors":"\u9519\u8BEF","yeaft.toolStats.col.errRate":"\u9519\u8BEF\u7387","yeaft.toolStats.col.p50":"p50","yeaft.toolStats.col.p95":"p95","yeaft.toolStats.col.avg":"\u5E73\u5747","yeaft.toolStats.col.last":"\u6700\u8FD1","yeaft.toolStats.buttonLabel":"\u5DE5\u5177\u7EDF\u8BA1","workCenter.title":"\u5DE5\u4F5C\u4E2D\u5FC3","workCenter.subtitle":"\u7531\u5F53\u524D Agent \u6301\u7EED\u63A8\u8FDB\u7684\u6301\u4E45\u5DE5\u4F5C","workCenter.agent":"Agent","workCenter.selectAgent":"\u9009\u62E9 Agent","workCenter.noOnlineAgents":"\u6CA1\u6709\u5728\u7EBF Agent","workCenter.noAvailableAgents":"\u6CA1\u6709\u517C\u5BB9\u5DE5\u4F5C\u4E2D\u5FC3\u7684\u5728\u7EBF Agent","workCenter.new":"\u65B0\u5EFA","workCenter.newWorkItem":"\u65B0\u5EFA\u5DE5\u4F5C\u9879","workCenter.workItem":"\u5DE5\u4F5C\u9879","workCenter.createFirst":"\u521B\u5EFA\u7B2C\u4E00\u4E2A\u5DE5\u4F5C\u9879","workCenter.backToChat":"\u8FD4\u56DE\u5BF9\u8BDD","workCenter.refresh":"\u5237\u65B0","workCenter.search":"\u641C\u7D22\u5DE5\u4F5C\u9879","workCenter.filter":"\u7B5B\u9009","workCenter.filterAttention":"\u9700\u8981\u5904\u7406","workCenter.filterActive":"\u6267\u884C\u4E2D","workCenter.filterAll":"\u5168\u90E8","workCenter.filterDone":"\u5DF2\u5B8C\u6210","workCenter.attentionItems":"\u9700\u8981\u5904\u7406","workCenter.board.active":"\u8FDB\u884C\u4E2D","workCenter.board.needsAttention":"\u9700\u8981\u5904\u7406","workCenter.board.closed":"\u5DF2\u5173\u95ED","workCenter.board.emptyLane":"\u6682\u65E0\u5DE5\u4F5C\u9879","workCenter.board.lanes":"\u5DE5\u4F5C\u9879\u5206\u680F","workCenter.filterVp":"\u6309 VP \u7B5B\u9009","workCenter.filterType":"\u6309\u7C7B\u578B\u7B5B\u9009","workCenter.filterUpdated":"\u6309\u66F4\u65B0\u65F6\u95F4\u7B5B\u9009","workCenter.allVps":"\u5168\u90E8 VP","workCenter.allTypes":"\u5168\u90E8\u7C7B\u578B","workCenter.anyTime":"\u4E0D\u9650\u65F6\u95F4","workCenter.lastDay":"\u6700\u8FD1 24 \u5C0F\u65F6","workCenter.lastWeek":"\u6700\u8FD1 7 \u5929","workCenter.deleteWorkItem":"\u5220\u9664 Work Item","workCenter.deleteConfirm":"\u6C38\u4E45\u5220\u9664\u8FD9\u4E2A Work Item\u3001\u6267\u884C\u5386\u53F2\u548C\u9644\u4EF6\uFF1F","workCenter.deleteRequiresStop":"\u8BF7\u5148\u505C\u6B62\u8FD9\u4E2A Work Item \u518D\u5220\u9664","workCenter.lastMonth":"\u6700\u8FD1 30 \u5929","workCenter.assignment.planned":"\u8BA1\u5212\u5206\u914D","workCenter.created":"\u521B\u5EFA\u4E8E","workCenter.files":"\u4E2A\u6587\u4EF6","workCenter.loadMore":"\u52A0\u8F7D\u66F4\u591A","workCenter.activeItems":"\u6267\u884C\u4E2D\u7684\u5DE5\u4F5C","workCenter.allItems":"\u5168\u90E8\u5DE5\u4F5C\u9879","workCenter.completedItems":"\u5DF2\u5B8C\u6210","workCenter.watcherActive":"Watcher \u8FD0\u884C\u4E2D","workCenter.loading":"\u6B63\u5728\u52A0\u8F7D\u5DE5\u4F5C\u9879\u2026","workCenter.noTimestamp":"\u65E0\u65F6\u95F4\u6233","workCenter.updated":"\u66F4\u65B0\u65F6\u95F4","workCenter.emptyTitle":"\u8FD8\u6CA1\u6709\u5DE5\u4F5C\u9879","workCenter.emptyBody":"\u5F53\u5DE5\u4F5C\u9700\u8981\u8DE8\u8D8A\u4E00\u6B21\u5BF9\u8BDD\u3001\u7B49\u5F85\u6216\u89D2\u8272\u63A5\u529B\u65F6\uFF0C\u628A\u5B83\u521B\u5EFA\u4E3A\u6301\u4E45\u5DE5\u4F5C\u9879\u3002","workCenter.noAttentionTitle":"\u5F53\u524D\u6CA1\u6709\u9700\u8981\u5904\u7406\u7684\u5DE5\u4F5C\u9879","workCenter.noAttentionBody":"\u7B49\u5F85\u4F60\u56DE\u7B54\u6216\u9700\u8981\u6062\u590D\u7684\u5DE5\u4F5C\u9879\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002","workCenter.noActiveTitle":"\u5F53\u524D\u6CA1\u6709\u6267\u884C\u4E2D\u7684\u5DE5\u4F5C\u9879","workCenter.noActiveBody":"\u8349\u7A3F\u3001\u5C31\u7EEA\u548C\u6267\u884C\u4E2D\u7684\u5DE5\u4F5C\u9879\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002","workCenter.noCompletedTitle":"\u8FD8\u6CA1\u6709\u5DF2\u5B8C\u6210\u7684\u5DE5\u4F5C\u9879","workCenter.noCompletedBody":"\u5B8C\u6210\u540E\u7684\u5DE5\u4F5C\u9879\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002","workCenter.noMatchesTitle":"\u6CA1\u6709\u5339\u914D\u7684\u5DE5\u4F5C\u9879","workCenter.noMatchesBody":"\u5C1D\u8BD5\u8C03\u6574\u641C\u7D22\u5185\u5BB9\u6216\u7B5B\u9009\u6761\u4EF6\u3002","workCenter.selectTitle":"\u5DE5\u4F5C\u9879\u8BE6\u60C5","workCenter.detailLoading":"\u6B63\u5728\u52A0\u8F7D\u5B8C\u6574\u8BE6\u60C5\u2026","workCenter.detailLoadFailed":"\u65E0\u6CD5\u52A0\u8F7D\u5B8C\u6574\u8BE6\u60C5","workCenter.start":"\u5F00\u59CB","workCenter.retry":"\u91CD\u8BD5","workCenter.cancel":"\u53D6\u6D88","workCenter.closeWorkItem":"\u5173\u95ED\u8BE6\u60C5","workCenter.cancelWorkItem":"\u505C\u6B62\u5DE5\u4F5C\u9879","workCenter.cancelWorkItemHint":"\u505C\u6B62\u8FD9\u4E2A\u5DE5\u4F5C\u9879\u53CA\u6240\u6709\u5C1A\u672A\u5B8C\u6210\u7684 Actions\u3002","workCenter.cancelConfirm":"\u505C\u6B62\u8FD9\u4E2A\u5DE5\u4F5C\u9879\u53CA\u5176\u5C1A\u672A\u5B8C\u6210\u7684 Actions\uFF1F","workCenter.stopWorkItem":"\u505C\u6B62\u5DE5\u4F5C\u9879","workCenter.resumeWorkItem":"\u6062\u590D\u5DE5\u4F5C\u9879","workCenter.breadcrumbs":"Work Center \u5BFC\u822A","workCenter.actionNumber":"Action {number}","workCenter.actionBreadcrumb":"Action {number}\uFF1A{description}","workCenter.untitledAction":"\u672A\u547D\u540D Action","workCenter.workItems":"\u5DE5\u4F5C\u9879","workCenter.description":"\u9700\u6C42\u63CF\u8FF0","workCenter.goal":"\u76EE\u6807","workCenter.acceptanceCriteria":"\u9A8C\u6536\u6761\u4EF6","workCenter.noCriteria":"\u672A\u63D0\u4F9B\u9A8C\u6536\u6761\u4EF6","workCenter.failureReason":"\u5931\u8D25\u539F\u56E0","workCenter.workflow":"\u4EFB\u52A1\u6D41","workCenter.actionFlow":"Action \u6D41\u7A0B","workCenter.actionCount":"{count} \u4E2A Action","workCenter.noActionSummary":"\u6682\u65E0\u6458\u8981","workCenter.actionProgress":"{completed} / {total} \u4E2A Action","workCenter.currentAction":"\u5F53\u524D Action","workCenter.expandActions":"\u5C55\u5F00 Action","workCenter.collapseActions":"\u6536\u8D77","workCenter.actionObjective":"\u8FD9\u6B21\u8981\u505A\u4EC0\u4E48","workCenter.actionApproach":"\u51C6\u5907\u600E\u4E48\u505A","workCenter.actionExpectedOutcome":"\u671F\u5F85\u7684\u7ED3\u679C","workCenter.dependencies":"\u4F9D\u8D56\u9879","workCenter.actionResult":"\u6700\u65B0\u7ED3\u679C","workCenter.currentProgress":"\u5F53\u524D\u8FDB\u5EA6","workCenter.actionMessages":"\u6D88\u606F","workCenter.loops":"\u4E2A Loop","workCenter.tools":"\u6B21\u5DE5\u5177\u8C03\u7528","workCenter.noActionMessages":"\u8FD8\u6CA1\u6709\u6D88\u606F\u3002","workCenter.actionDetails":"Action \u8BE6\u60C5","workCenter.selectAction":"\u9009\u62E9\u4E00\u4E2A Action \u67E5\u770B\u5B9E\u9645\u6267\u884C","workCenter.backToWorkItems":"\u5DE5\u4F5C\u9879","workCenter.backToActions":"Actions","workCenter.you":"\u4F60","workCenter.noRequestDetails":"\u8FD9\u4E2A Action \u6682\u65F6\u6CA1\u6709\u53EF\u7528\u7684\u6267\u884C\u8BB0\u5F55\u3002","workCenter.loadingRequests":"\u6B63\u5728\u52A0\u8F7D\u6267\u884C\u8BB0\u5F55\u2026","workCenter.loadingRequestDetail":"\u6B63\u5728\u52A0\u8F7D\u5DE5\u5177\u8BC1\u636E\u2026","workCenter.requestDetailUnavailable":"\u5DE5\u5177\u8BC1\u636E\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u8BD5\u3002","workCenter.noRequestLoops":"\u8FD9\u6B21\u6267\u884C\u6CA1\u6709\u4FDD\u7559\u4E0B\u53EF\u5C55\u793A\u7684 Loop\u3002","workCenter.requestDetailTruncated":"\u6267\u884C\u5185\u5BB9\u8F83\u5927\uFF1A{summarized} \u4E2A Loop \u663E\u793A\u6458\u8981\uFF0C\u53E6\u6709 {omitted} \u4E2A\u8F83\u65E9 Loop \u672A\u663E\u793A\u3002","workCenter.loopDetailTruncated":"\u8FD9\u4E2A Loop \u5185\u5BB9\u8F83\u5927\uFF0C\u5F53\u524D\u663E\u793A\u4FDD\u7559\u4E0B\u6765\u7684\u5DE5\u5177\u8BC1\u636E\u3002","workCenter.loadEarlierMessages":"\u52A0\u8F7D\u66F4\u65E9\u6D88\u606F","workCenter.loadingEarlierMessages":"\u6B63\u5728\u52A0\u8F7D\u66F4\u65E9\u6D88\u606F\u2026","workCenter.unknownModel":"\u672A\u77E5\u6A21\u578B","workCenter.loop":"Loop","workCenter.actionBrief":"\u4EFB\u52A1\u8BF4\u660E","workCenter.executionSummary":"\u6267\u884C\u6458\u8981","workCenter.toolParameters":"\u8C03\u7528\u53C2\u6570","workCenter.toolResult":"\u6267\u884C\u7ED3\u679C","workCenter.noToolCalls":"\u8FD9\u4E2A Loop \u6CA1\u6709\u5DE5\u5177\u8C03\u7528\u3002","workCenter.actionInputPlaceholder":"\u8865\u5145\u4E0A\u4E0B\u6587\u3001\u56DE\u7B54\u95EE\u9898\u6216\u8C03\u6574\u8FD9\u4E2A Action","workCenter.actionInputResumeHint":"\u4F60\u7684\u8F93\u5165\u4F1A\u5E26\u7740\u65B0\u589E\u4E0A\u4E0B\u6587\u7EE7\u7EED\u8FD9\u4E2A Action\u3002","workCenter.waitingQuestionTitle":"\u9700\u8981\u4F60\u7684\u56DE\u7B54","workCenter.actionInputRetryHint":"\u8865\u5145\u4FEE\u6B63\u8BF4\u660E\u6216\u6587\u4EF6\u540E\uFF0C\u4F7F\u7528\u65B0\u4E0A\u4E0B\u6587\u91CD\u65B0\u6267\u884C\u8FD9\u4E2A Action\u3002","workCenter.actionInputContinueHint":"\u8FD9\u91CC\u53EA\u76F4\u63A5\u5E72\u9884\u5F53\u524D Action\u3002","workCenter.actionFailedTitle":"\u8FD9\u4E2A Action \u4E3A\u4EC0\u4E48\u5931\u8D25","workCenter.failedAt":"\u5931\u8D25\u65F6\u95F4","workCenter.actionFailureRecovery":"\u5728\u4E0B\u65B9\u8865\u5145\u4FEE\u6B63\u8BF4\u660E\u6216\u6587\u4EF6\u5373\u53EF\u91CD\u65B0\u6267\u884C\uFF1B\u6267\u884C\u9875\u4F1A\u5C55\u793A\u4FDD\u7559\u4E0B\u6765\u7684\u5DE5\u5177\u8BC1\u636E\u3002","workCenter.sendInput":"\u53D1\u9001\u7ED9 Action","workCenter.sendingInput":"\u6B63\u5728\u53D1\u9001\u2026","workCenter.retryAction":"\u91CD\u8BD5 Action","workCenter.sendAndRetryAction":"\u53D1\u9001\u5E76\u91CD\u8BD5 Action","workCenter.coordinatorDecision.guide_actions":"\u5DF2\u66F4\u65B0 Action \u6307\u4EE4","workCenter.coordinatorDecision.replan":"\u5DF2\u66F4\u65B0\u76EE\u6807\u6216\u8BA1\u5212","workCenter.coordinatorDecision.request_human":"\u9700\u8981\u4EBA\u5DE5\u8865\u5145\u4FE1\u606F","workCenter.conversation":"\u5BF9\u8BDD","workCenter.conversationThinking":"\u5904\u7406\u4E2D\u2026","workCenter.conversationReadOnly":"\u8FD9\u4E2A\u5DE5\u4F5C\u9879\u5DF2\u5173\u95ED\uFF0C\u5BF9\u8BDD\u8BB0\u5F55\u4ECD\u53EF\u67E5\u770B\u3002","workCenter.conversationPlaceholder":"\u7EE7\u7EED\u8BA8\u8BBA\u8FD9\u4E2A\u5DE5\u4F5C\u9879","workCenter.sendMessage":"\u53D1\u9001\u6D88\u606F","workCenter.assistant":"Yeaft","workCenter.originalRequest":"\u539F\u59CB\u9700\u6C42","workCenter.actionMessageScopeTitle":"\u7ED9\u8FD9\u4E2A Action \u53D1\u6D88\u606F","workCenter.actionMessageScope":"\u6D88\u606F\u53EA\u53D1\u9001\u7ED9\u5F53\u524D Action\u3002","workCenter.actionConversation":"\u5BF9\u8BDD","workCenter.actionConversationWith":"Action \u6267\u884C\u8005","workCenter.actionViews":"Action \u89C6\u56FE","workCenter.actionExecutor":"\u6267\u884C\u8005","workCenter.actionExecutorPending":"\u7B49\u5F85\u5206\u914D\u6267\u884C\u8005","workCenter.actionInformation":"Action \u4FE1\u606F","workCenter.messageExecutor":"\u7ED9 {name} \u53D1\u6D88\u606F","workCenter.actionChatPlaceholder":"\u548C {name} \u8BA8\u8BBA\u8FD9\u4E2A Action","workCenter.statusLabel":"\u72B6\u6001","workCenter.llmRequestsLabel":"LLM \u8BF7\u6C42","workCenter.loopsLabel":"Loops","workCenter.toolsLabel":"\u5DE5\u5177","workCenter.tokensLabel":"Tokens","workCenter.workItemMessagePlaceholder":"\u8865\u5145\u6574\u4E2A Work Item \u7684\u65B9\u5411\u6216\u7EA6\u675F","workCenter.sendWorkItemMessage":"\u53D1\u9001\u7ED9 Work Item","workCenter.fromSession":"\u4ECE\u5F53\u524D Session \u521B\u5EFA\u5DE5\u4F5C\u9879","workCenter.llmRequestCount":"{count} \u6B21 LLM \u8BF7\u6C42","workCenter.loopCount":"{count} \u6B21 Loop","workCenter.toolCount":"{count} \u4E2A\u5DE5\u5177","workCenter.tokenCount":"{count} tokens","workCenter.tokenBreakdown":"\u8F93\u5165 {input} / \u8F93\u51FA {output} / \u7F13\u5B58 {cache}","workCenter.guidance":"\u7ED9\u5F53\u524D Action \u8865\u5145\u63D0\u793A","workCenter.guidanceHint":"\u8865\u5145\u7EA6\u675F\uFF0C\u6216\u8C03\u6574\u5F53\u524D Action \u7684\u6267\u884C\u65B9\u5411","workCenter.guidanceRestartHint":"\u53D1\u9001\u540E\u4F1A\u4F7F\u7528\u65B0\u63D0\u793A\u91CD\u542F\u5F53\u524D Action\u3002","workCenter.sendGuidance":"\u53D1\u9001\u63D0\u793A","workCenter.reuseMemory":"\u4F7F\u7528\u76F8\u5173 Agent memory \u548C\u6B64\u9879\u76EE\u7684\u5DF2\u5B8C\u6210\u5DE5\u4F5C","workCenter.reuseMemoryHelp":"\u5305\u62EC\u53D7 scope \u7EA6\u675F\u7684 Agent memory\uFF0C\u4EE5\u53CA canonical \u9879\u76EE\u76EE\u5F55\u76F8\u540C\u7684\u5DF2\u5B8C\u6210 Work Item \u7ED3\u6784\u5316\u6458\u8981\u548C\u8BC1\u636E\uFF1B\u4E0D\u4F1A\u590D\u7528\u539F\u59CB\u5DE5\u5177\u8F93\u51FA\u3002","workCenter.resumeAnswer":"\u56DE\u7B54\u7B49\u5F85\u4E2D\u7684\u95EE\u9898","workCenter.resumeAnswerHint":"\u63D0\u4F9B\u7EE7\u7EED\u6267\u884C\u6240\u9700\u7684\u4FE1\u606F","workCenter.answerInActionDetail":"\u6253\u5F00\u5F53\u524D Action\uFF0C\u5728\u4E0B\u65B9\u8F93\u5165\u6846\u4E2D\u56DE\u590D\u3002","workCenter.selectPrompt":"\u9009\u62E9\u4E00\u4E2A\u5DE5\u4F5C\u9879\uFF0C\u67E5\u770B\u5B83\u7684\u6D41\u7A0B\u3002","workCenter.createHint":"\u63CF\u8FF0\u4F60\u9700\u8981\u4EC0\u4E48\uFF0CTriage \u4F1A\u751F\u6210\u76EE\u6807\u3001\u9A8C\u6536\u6761\u4EF6\u548C Actions\u3002","workCenter.requirement":"\u9700\u6C42","workCenter.requirementHint":"\u7528\u81EA\u7136\u8BED\u8A00\u63CF\u8FF0\u95EE\u9898\u3001\u671F\u671B\u7ED3\u679C\u548C\u5FC5\u8981\u7EA6\u675F","workCenter.requirementHelp":"Triage \u4F1A\u751F\u6210\u6807\u9898\u3001\u76EE\u6807\u3001\u9A8C\u6536\u6761\u4EF6\u3001\u7C7B\u578B\u548C\u6267\u884C\u8BA1\u5212\u3002","workCenter.titleField":"\u6807\u9898","workCenter.titleHint":"\u7B80\u77ED\u3001\u660E\u786E\u5730\u63CF\u8FF0\u9884\u671F\u7ED3\u679C","workCenter.goalHint":"\u8BF4\u660E Agent \u5FC5\u987B\u4EA4\u4ED8\u7684\u6700\u7EC8\u7ED3\u679C","workCenter.criteriaHint":"\u6BCF\u884C\u4E00\u6761\u9A8C\u6536\u6761\u4EF6","workCenter.attachments":"\u9644\u4EF6","workCenter.attachmentsHelp":"\u56FE\u7247\u3001PDF \u548C\u6587\u672C\u6587\u4EF6\u4F1A\u6301\u7EED\u7ED1\u5B9A\u5230\u6B64 Work Item\uFF0C\u5E76\u63D0\u4F9B\u7ED9\u6BCF\u4E2A Action\u3002","workCenter.attachmentsUnsupported":"\u6240\u9009 Agent \u4E0D\u652F\u6301 Work Item \u9644\u4EF6\u3002","workCenter.addAttachments":"\u6DFB\u52A0\u6587\u4EF6","workCenter.attachmentsUploading":"\u4E0A\u4F20\u4E2D\u2026","workCenter.attachmentsUploadFailed":"\u9644\u4EF6\u4E0A\u4F20\u5931\u8D25","workCenter.removeAttachment":"\u4ECE\u8349\u7A3F\u4E2D\u79FB\u9664","workCenter.previewAttachment":"\u6253\u5F00\u9644\u4EF6","workCenter.openAttachmentNamed":"\u6253\u5F00\u9644\u4EF6 {name}","workCenter.openingAttachment":"\u6B63\u5728\u6253\u5F00\u9644\u4EF6\u2026","workCenter.attachmentPreviewFailed":"\u65E0\u6CD5\u6253\u5F00\u9644\u4EF6\uFF0C\u8BF7\u91CD\u8BD5\u3002","workCenter.attachmentOpenBlocked":"\u6D4F\u89C8\u5668\u963B\u6B62\u4E86\u9644\u4EF6\u7A97\u53E3\uFF0C\u8BF7\u5141\u8BB8\u5F39\u51FA\u7A97\u53E3\u540E\u91CD\u8BD5\u3002","workCenter.execution":"\u6267\u884C\u65B9\u5F0F","workCenter.executionHint":"\u9009\u62E9\u5DE5\u4F5C\u9879\u5728\u54EA\u91CC\u6267\u884C\uFF0C\u4EE5\u53CA\u521B\u5EFA\u540E\u662F\u5426\u7ACB\u5373\u5F00\u59CB\u3002","workCenter.workDir":"\u5DE5\u4F5C\u76EE\u5F55","workCenter.workDirHint":"\u9009\u62E9\u4E00\u4E2A\u5DF2\u5B58\u5728\u7684\u9879\u76EE\u76EE\u5F55","workCenter.chooseFolder":"\u9009\u62E9\u6587\u4EF6\u5939","workCenter.workDirPickerHelp":"\u4ECE\u5F53\u524D Agent \u7684\u771F\u5B9E\u76EE\u5F55\u4E2D\u9009\u62E9\u5DF2\u5B58\u5728\u7684\u6587\u4EF6\u5939\u3002","workCenter.folderPickerHint":"\u9009\u62E9\u8FD9\u4E2A\u5DE5\u4F5C\u9879\u53EF\u4EE5\u8BFB\u53D6\u548C\u4FEE\u6539\u7684\u9879\u76EE\u76EE\u5F55\u3002","workCenter.folderPickerSelectionHint":"\u53CC\u51FB\u8FDB\u5165\u76EE\u5F55\uFF0C\u6216\u9009\u4E2D\u76EE\u5F55\u540E\u786E\u8BA4\u3002","workCenter.startImmediately":"\u7ACB\u5373\u5F00\u59CB","workCenter.startImmediatelyHint":"\u5173\u95ED\u540E\u5C06\u521B\u5EFA\u4E3A\u8349\u7A3F\uFF0C\u786E\u8BA4\u65E0\u8BEF\u540E\u518D\u5F00\u59CB\u3002","workCenter.creating":"\u521B\u5EFA\u4E2D\u2026","workCenter.create":"\u521B\u5EFA","workCenter.status.draft":"\u8349\u7A3F","workCenter.status.ready":"\u5F85\u6267\u884C","workCenter.status.running":"\u6267\u884C\u4E2D","workCenter.status.waiting":"\u7B49\u5F85\u4E2D","workCenter.status.needs_attention":"\u9700\u8981\u5904\u7406","workCenter.status.done":"\u5DF2\u5B8C\u6210","workCenter.status.cancelled":"\u5DF2\u53D6\u6D88","workCenter.status.completed":"\u5DF2\u5B8C\u6210","workCenter.status.failed":"\u5931\u8D25","workCenter.status.superseded":"\u5DF2\u66FF\u4EE3","workCenter.action.triage":"\u5206\u6790","workCenter.action.implement":"\u5B9E\u73B0","workCenter.action.review":"\u8BC4\u5BA1","workCenter.action.integrate":"\u96C6\u6210","workCenter.action.deliver":"\u4EA4\u4ED8","workCenter.action.test":"\u6D4B\u8BD5","workCenter.action.research":"\u7814\u7A76","workCenter.action.design":"\u8BBE\u8BA1","workCenter.action.diagnose":"\u8BCA\u65AD","workCenter.action.migrate":"\u8FC1\u79FB","workCenter.action.document":"\u6587\u6863","workCenter.action.operate":"\u8FD0\u7EF4","workCenter.action.write":"\u5199\u4F5C","workCenter.action.custom":"\u81EA\u5B9A\u4E49","workCenter.assignment.auto":"\u4F7F\u7528\u4EFB\u52A1\u6D41\u7B56\u7565","workCenter.model.inherit":"\u4F7F\u7528\u4EFB\u52A1\u6D41\u6A21\u578B","workCenter.model.defaultProvider":"\u9ED8\u8BA4 Provider","workCenter.planPreview":"\u6267\u884C\u8BA1\u5212","workCenter.planPreviewHelp":"\u6839\u636E\u5F53\u524D Agent \u7684 VP \u6C60\u548C\u6A21\u578B\u8BBE\u7F6E\u5B9E\u65F6\u89E3\u6790\u3002","workCenter.settings.title":"\u5DE5\u4F5C\u4E2D\u5FC3\u8BBE\u7F6E","workCenter.settings.subtitle":"\u914D\u7F6E Coordinator\uFF0C\u4EE5\u53CA AI \u52A8\u6001\u89C4\u5212\u4F7F\u7528\u7684 Action \u63D0\u793A\u8BCD\u3001\u6A21\u578B\u548C effort\u3002","workCenter.settings.workflow":"\u4EFB\u52A1\u6D41","workCenter.settings.workflowHelp":"Triage \u4F1A\u9488\u5BF9\u4EFB\u52A1\u52A8\u6001\u9009\u62E9 Action \u548C\u6267\u884C\u8005\u3002","workCenter.settings.aiWorkflowHelp":"Triage \u4F1A\u4E3A\u6BCF\u4E2A Work Item \u5206\u7C7B\u5E76\u751F\u6210\u7ECF\u8FC7\u6821\u9A8C\u7684 1\u20138 \u4E2A\u4EFB\u52A1\u4E13\u5C5E Action\u3002\u5185\u7F6E Action \u7B56\u7565\u53EA\u662F\u53EF\u590D\u7528\u9ED8\u8BA4\u503C\uFF1B\u9700\u8981\u65F6 triage \u53EF\u4EE5\u521B\u5EFA\u7CBE\u786E\u7684\u9886\u57DF\u7C7B\u578B\u3002","workCenter.settings.globalInstructions":"Agent \u5168\u5C40\u6307\u4EE4","workCenter.settings.globalInstructionsHint":"\u4F8B\u5982\uFF1A\u9075\u5FAA\u4ED3\u5E93\u53D1\u5E03\u6D41\u7A0B\u3001\u5FC5\u987B\u72EC\u7ACB\u8BC4\u5BA1\uFF0C\u672A\u7ECF\u660E\u786E\u6279\u51C6\u4E0D\u5F97\u521B\u5EFA\u90E8\u7F72 tag\u3002","workCenter.settings.globalInstructionsHelp":"\u4FDD\u5B58\u5728 Agent \u7EA7\uFF0C\u5E76\u51BB\u7ED3\u8FDB\u6BCF\u4E2A\u65B0 Work Item\uFF1B\u5BF9 triage \u548C\u6240\u6709\u751F\u6210\u7684 Action \u751F\u6548\uFF0C\u4F18\u5148\u7EA7\u4F4E\u4E8E Work Item \u5951\u7EA6\u53CA\u7CFB\u7EDF/\u5DE5\u5177\u5B89\u5168\u89C4\u5219\u3002\u5DF2\u6709 Work Item \u4FDD\u7559\u539F\u5FEB\u7167\u3002","workCenter.settings.actionPolicies":"\u5185\u7F6E Action \u7B56\u7565","workCenter.settings.actionPoliciesHelp":"\u8FD9\u4E9B\u662F\u53EF\u590D\u7528\u7684\u6267\u884C\u57FA\u7EBF\uFF0C\u4E0D\u662F\u56FA\u5B9A\u5DE5\u4F5C\u6D41\u3002\u672A\u77E5\u7684\u9886\u57DF Action \u7C7B\u578B\u4F1A\u4F7F\u7528\u201C\u81EA\u5B9A\u4E49\u201D\u7B56\u7565\uFF0C\u5E76\u4FDD\u7559 triage \u751F\u6210\u7684\u7C7B\u578B\u548C\u4EFB\u52A1\u76EE\u6807\u3002","workCenter.settings.dynamicInstructionHelp":"AI \u4F1A\u52A0\u5165 Work Item \u5951\u7EA6\u3001\u5168\u5C40\u6307\u4EE4\u3001\u524D\u5E8F Action \u4E0A\u4E0B\u6587\u3001memory \u548C\u4EFB\u52A1\u4E13\u5C5E\u76EE\u6807\uFF1B\u8FD9\u91CC\u5B9A\u4E49\u8BE5 Action \u7C7B\u578B\u7684\u53EF\u590D\u7528\u884C\u4E3A\u3002","workCenter.settings.models":"\u6A21\u578B","workCenter.settings.modelsHelp":"Provider \u548C\u51ED\u8BC1\u4ECD\u7531 Agent LLM \u8BBE\u7F6E\u7BA1\u7406\uFF1B\u5DE5\u4F5C\u4E2D\u5FC3\u53EA\u9009\u62E9\u53EF\u7528\u6A21\u578B\u3002","workCenter.settings.dynamicModelsHelp":"Coordinator \u4E0E\u5B9E\u9645\u6267\u884C Action \u7684\u6A21\u578B\u53EF\u4EE5\u5206\u522B\u914D\u7F6E\u3002","workCenter.settings.coordinatorModel":"Coordinator","workCenter.settings.coordinatorModelHelp":"\u7528\u4E8E Work Item \u5BF9\u8BDD\u3001\u4FEE\u6539\u76EE\u6807\u548C\u91CD\u65B0\u89C4\u5212\uFF1B\u4E0D\u4F1A\u6267\u884C\u9879\u76EE\u5DE5\u5177\u3002","workCenter.settings.allActions":"\u6240\u6709 Action \u7684\u515C\u5E95\u7B56\u7565","workCenter.settings.maxConcurrentActions":"\u6700\u5927\u5E76\u53D1 Action \u6570","workCenter.settings.maxConcurrentActionsHelp":"\u9ED8\u8BA4 3\u3002\u975E Git\u3001\u810F\u5DE5\u4F5C\u533A\u3001\u5171\u4EAB\u526F\u4F5C\u7528\u548C\u96C6\u6210 Action \u4ECD\u4F1A\u4E32\u884C\u6267\u884C\u3002","workCenter.workItemType":"\u7C7B\u578B","workCenter.typeAuto":"Auto \u2014 \u7531 LLM \u63A8\u65AD","workCenter.typeHelp":"\u53EF\u9009\u62E9\u4EFB\u52A1\u7C7B\u522B\uFF0C\u4E5F\u53EF\u8BA9 AI \u81EA\u52A8\u63A8\u65AD\uFF1B\u5177\u4F53 Actions \u59CB\u7EC8\u7531 AI \u89C4\u5212\u3002","workCenter.planning":"\u89C4\u5212\u4E2D","workCenter.aiPlan":"AI \u52A8\u6001\u89C4\u5212\u6267\u884C","workCenter.aiPlanHelp":"Triage \u4F1A\u9009\u62E9\u4EFB\u52A1\u7C7B\u578B\u3001Action\u3001\u6267\u884C\u8005\u548C\u6700\u5C0F\u53EF\u9760\u6D41\u7A0B\uFF1B\u6A21\u578B\u4E0E effort \u7531 Work Center \u8BBE\u7F6E\u63A7\u5236\u3002","workCenter.settings.manageProviders":"\u7BA1\u7406 Agent \u6A21\u578B","workCenter.settings.assignment":"VP \u9009\u62E9","workCenter.settings.assignment.auto":"\u4ECE\u5168\u90E8 VP \u81EA\u52A8\u9009\u62E9","workCenter.settings.assignment.pool":"\u5019\u9009\u6C60","workCenter.settings.assignment.fixed":"\u56FA\u5B9A VP","workCenter.settings.capability":"\u6240\u9700\u80FD\u529B","workCenter.settings.vp":"Virtual Person","workCenter.settings.poolMembers":"\u5019\u9009 VP","workCenter.settings.modelPolicy":"\u6A21\u578B\u7B56\u7565","workCenter.settings.model.inherit":"\u7EE7\u627F VP \u504F\u597D","workCenter.settings.model.primary":"Agent \u4E3B\u6A21\u578B","workCenter.settings.model.fast":"Agent \u5FEB\u6A21\u578B","workCenter.settings.model.specific":"\u6307\u5B9A\u6A21\u578B","workCenter.settings.model":"\u6A21\u578B","workCenter.settings.effort":"\u63A8\u7406\u5F3A\u5EA6","workCenter.settings.effortDefault":"\u6A21\u578B\u9ED8\u8BA4\u503C","workCenter.settings.effortHelp":"\u8986\u76D6\u6240\u9009\u6A21\u578B\u7684\u9ED8\u8BA4\u63A8\u7406\u5F3A\u5EA6\uFF0C\u5E76\u7528\u4E8E\u6240\u6709 Work Center Action\u3002","workCenter.settings.effortChooseModelHelp":"\u9009\u62E9 Agent \u4E3B\u6A21\u578B\u3001\u5FEB\u6A21\u578B\u6216\u6307\u5B9A\u6A21\u578B\u540E\u53EF\u914D\u7F6E\u63A8\u7406\u5F3A\u5EA6\uFF1B\u7EE7\u627F VP \u504F\u597D\u65F6\u4F7F\u7528\u5404 VP \u6A21\u578B\u7684\u9ED8\u8BA4\u503C\u3002","workCenter.settings.effortUnsupportedHelp":"\u6240\u9009\u6A21\u578B\u4E0D\u63D0\u4F9B\u53EF\u914D\u7F6E\u7684\u63A8\u7406\u5F3A\u5EA6\uFF0C\u56E0\u6B64\u4F7F\u7528\u6A21\u578B\u9ED8\u8BA4\u503C\u3002","workCenter.settings.saving":"\u4FDD\u5B58\u4E2D\u2026","workCenter.settings.reload":"\u91CD\u65B0\u52A0\u8F7D\u8BBE\u7F6E","workCenter.settings.conflict":"\u8BBE\u7F6E\u5DF2\u5728\u5176\u4ED6\u4F4D\u7F6E\u66F4\u65B0\uFF0C\u8BF7\u91CD\u65B0\u52A0\u8F7D\u540E\u518D\u4FDD\u5B58\u3002","workCenter.settings.upgradeRequired":"\u5F53\u524D Agent \u7248\u672C\u65E0\u6CD5\u4FDD\u5B58\u5DE5\u4F5C\u4E2D\u5FC3\u8BBE\u7F6E\u3002\u8FD9\u91CC\u4EE5\u53EA\u8BFB\u65B9\u5F0F\u663E\u793A\u5F53\u524D\u503C\uFF1B\u5347\u7EA7 Agent \u540E\u5373\u53EF\u7F16\u8F91\u5E76\u4FDD\u5B58\u3002","workCenter.settings.saveNotConfirmed":"Agent \u672A\u786E\u8BA4\u672C\u6B21\u63D0\u4EA4\u7684\u63D0\u793A\u8BCD\u548C\u6A21\u578B\u7B56\u7565\u3002\u8BBE\u7F6E\u7A97\u53E3\u4E0D\u4F1A\u5173\u95ED\uFF1B\u8BF7\u91CD\u65B0\u52A0\u8F7D\u6216\u5347\u7EA7 Agent \u540E\u518D\u8BD5\u3002","workCenter.settings.addWorkflow":"\u590D\u5236\u4EFB\u52A1\u6D41","workCenter.settings.removeWorkflow":"\u5220\u9664","workCenter.settings.newWorkflow":"\u4EFB\u52A1\u6D41 {index}","workCenter.settings.workflowName":"\u4EFB\u52A1\u6D41\u540D\u79F0","workCenter.settings.newStage":"\u65B0\u9636\u6BB5","workCenter.settings.addStage":"\u6DFB\u52A0\u9636\u6BB5","workCenter.settings.removeStage":"\u5220\u9664\u9636\u6BB5","workCenter.settings.moveUp":"\u4E0A\u79FB\u9636\u6BB5","workCenter.settings.moveDown":"\u4E0B\u79FB\u9636\u6BB5","workCenter.settings.stageType":"\u9636\u6BB5\u7C7B\u578B","workCenter.settings.reviewReturnStage":"\u8981\u6C42\u4FEE\u6539\u65F6\u9000\u56DE\u9636\u6BB5","workCenter.settings.instruction":"\u9636\u6BB5 Prompt","workCenter.settings.instructionHint":"\u5B9A\u4E49\u8FD9\u4E2A\u9636\u6BB5\u5177\u4F53\u8981\u505A\u4EC0\u4E48\u3002","workCenter.settings.instructionHelp":"\u8FD0\u884C\u65F6\u4F1A\u81EA\u52A8\u52A0\u5165 Work Item \u7684\u76EE\u6807\u3001\u9A8C\u6536\u6807\u51C6\u548C\u53EF\u590D\u7528\u4E0A\u4E0B\u6587\u3002","workCenter.settings.instructionReset":"\u6062\u590D\u9ED8\u8BA4\u503C"}});var qd,Nd=H(()=>{qd={"common.loading":"Loading...","common.confirm":"OK","common.apply":"Apply","common.cancel":"Cancel","common.delete":"Delete","common.copy":"Copy","common.copied":"Copied","common.close":"Close","common.refresh":"Refresh","common.open":"Open","common.save":"Save","common.search":"Search","common.back":"Back","common.noSubdirectories":"No subdirectories","common.drives":"Drives","common.rootDir":"Root","common.comma":", ","common.select":"Select","mermaid.export":"Export","mermaid.exportMd":"Export MD","mermaid.exportPng":"Export PNG","mermaid.exportJpg":"Export JPG","chat.toolActionsOmitted":"{count} older tool actions omitted","login.subtitle":"Yeaft Web Code Agent","login.username":"Username","login.password":"Password","login.login":"Login","login.loggingIn":"Logging in...","login.enterUsername":"Please enter your username","login.enterPassword":"Please enter your password","login.noAccount":"Don't have an account?","login.registerWithCode":"Register","login.or":"or","login.usePassword":"Sign in with username & password","login.useSso":"Back to single sign-on","login.noProviders":"No third-party sign-in providers are enabled.","login.microsoft":"Sign in with Microsoft","login.github":"Sign in with GitHub","login.google":"Sign in with Google","login.wechat":"Sign in with WeChat","login.alipay":"Sign in with Alipay","login.wechat.mobileUnsupported":"Sign in with WeChat is only available on PC. Please scan the QR code from a desktop browser.","login.alipay.mobileWaiting":"Waiting for you to confirm in the Alipay app\u2026 Once you finish, return to this page and you will be signed in automatically.","login.alipay.relaunch":"Open Alipay again","login.qr.title":"Scan to sign in","login.qr.titleAlipay":"Sign in with Alipay","login.qr.titleWechat":"Sign in with WeChat","login.qr.hint":"Scan the QR code with your phone to authorize.","login.error.enterUsername":"Please enter your username","login.error.enterPassword":"Please enter your password","login.error.enter6Digit":"Please enter a 6-digit code","login.error.enterInviteCode":"Please enter the invite code","login.error.usernameMinLen":"Username must be at least 2 characters","login.error.passwordMinLen":"Password must be at least 6 characters","login.error.passwordMismatch":"Passwords do not match","login.error.enterVerifyCode":"Please enter the verification code","login.error.loginFailed":"Login failed","login.forgot.link":"Forgot password?","login.forgot.title":"Reset your password","login.forgot.emailHint":"Enter the email address on your account. We will send a 6-digit reset code.","login.forgot.sendCode":"Send Reset Code","login.forgot.sending":"Sending...","login.forgot.codeSent":"If the email is on file, a 6-digit reset code has been sent. Enter it below along with your new password.","login.forgot.resetBtn":"Reset Password","login.forgot.resetting":"Resetting...","login.forgot.success":"Password reset. You can now sign in with your new password.","login.forgot.emailInvalid":"Please enter a valid email","login.register.title":"New User Registration","login.register.inviteCode":"Invite Code","login.register.username":"Username","login.register.password":"Password (min 6 characters)","login.register.confirmPassword":"Confirm Password","login.register.email":"Email (optional)","login.register.submit":"Register","login.register.submitting":"Registering...","login.register.back":"Back to Login","login.register.success":"Registration successful, please login","login.register.enterCode":"Please enter the invite code","login.register.usernameMin":"Username must be at least 2 characters","login.register.passwordMin":"Password must be at least 6 characters","login.register.passwordMismatch":"Passwords do not match","login.totp.setupTitle":"Set Up Two-Factor Authentication","login.totp.setupHint":"Scan the QR code below with Microsoft Authenticator or Google Authenticator","login.totp.manualKey":"Or enter the key manually:","login.totp.enterCode":"Enter 6-digit code","login.totp.complete":"Complete Setup","login.totp.verifying":"Verifying...","login.totp.verify":"Verify","login.totp.prompt":"Enter the code from your Authenticator app","login.totp.invalidCode":"Please enter a 6-digit code","login.email.codeSent":"Verification code sent to {email}","login.email.enterCode":"Enter verification code","login.email.verify":"Verify","login.email.verifying":"Verifying...","login.email.enterCodeError":"Please enter the verification code","chat.agent.select":"Select Agent","chat.agent.manage":"Manage Agents","chat.agent.none":"No Agents","chat.agent.restarting":"Restarting","chat.agent.restart":"Restart","chat.agent.restartConfirm":`Are you sure you want to restart Agent "{name}"?
12
+ \u5347\u7EA7\u5B8C\u6210\u540E Agent \u4F1A\u81EA\u52A8\u91CD\u542F\u3002`,"chat.agent.alreadyLatest":"Agent \u5DF2\u662F\u6700\u65B0\u7248\u672C (v{version})\uFF0C\u65E0\u9700\u5347\u7EA7\u3002","chat.agent.nodeIncompatible":"Agent \u5347\u7EA7\u4E2D\u6B62\uFF1A\u76EE\u6807\u7248\u672C v{version} \u9700\u8981 Node {required}\uFF0C\u4F46\u5F53\u524D\u673A\u5668\u8FD0\u884C\u7684\u662F Node {current}\u3002\u8BF7\u5148\u5347\u7EA7 Node.js \u518D\u91CD\u8BD5\u3002","chat.agent.online":"{count} \u4E2A Agent \u5728\u7EBF","chat.agent.selectFirst":"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A Agent","chat.agent.yeaft":"Yeaft \u5BF9\u8BDD","sidebar.toggle.chat":"\u5207\u6362\u5230 Chat","sidebar.toggle.yeaft":"\u5207\u6362\u5230 Yeaft","sidebar.surface.label":"\u4FA7\u680F\u89C6\u56FE","sidebar.surface.sessions":"\u4F1A\u8BDD","sidebar.provider.label":"\u4F1A\u8BDD Provider","sidebar.provider.claude":"Claude","sidebar.sessions.new":"\u65B0\u5EFA\u4F1A\u8BDD","sidebar.sessions.emptyProvider":"\u6B64 Provider \u6682\u65E0\u4F1A\u8BDD","yeaft.back":"\u8FD4\u56DE","yeaft.session.people":"\u6210\u5458","yeaft.session.peopleEmpty":"\u6682\u65E0\u6210\u5458","yeaft.session.runningTasks":"\u8FD0\u884C\u4E2D\u7684\u4EFB\u52A1","yeaft.session.tasksEmpty":"\u6682\u65E0\u8FD0\u884C\u4EFB\u52A1","yeaft.session.owner":"\u8D1F\u8D23\u4EBA","yeaft.session.started":"\u5F00\u59CB\u65F6\u95F4","yeaft.breadcrumb.label":"Thread \u8FC7\u6EE4","yeaft.breadcrumb.mainStream":"\u4E3B\u6D41","yeaft.breadcrumb.backHint":"\u8FD4\u56DE\u5168\u6D41 (Esc)","yeaft.featureDetail.ariaLabel":"Task \u8BE6\u60C5","yeaft.featureDetail.replyTo":"\u56DE\u590D\u5230:","yeaft.featureDetail.forkHint":"\u8BE5 task \u6682\u65E0\u6D3B\u8DC3 thread \u2014 \u8BF7 fork \u65B0 thread \u540E\u56DE\u590D\u3002","yeaft.featureDetail.empty":"\u8BE5 task \u6682\u65E0\u6D88\u606F\u3002","yeaft.featureDetail.threadPillHint":"\u6253\u5F00 thread","yeaft.featureDetail.summary.aria":"\u4EFB\u52A1\u6458\u8981\u65F6\u95F4\u7EBF","yeaft.featureDetail.summary.title":"\u6458\u8981\u65F6\u95F4\u7EBF","yeaft.featureDetail.summary.loading":"\u6B63\u5728\u52A0\u8F7D\u6458\u8981\u5386\u53F2\u2026","yeaft.featureDetail.summary.empty":"\u6682\u65E0\u6458\u8981\u3002","yeaft.featureDetail.summary.error":"\u6458\u8981\u52A0\u8F7D\u5931\u8D25\uFF1A{error}","yeaft.featureDetail.summary.showArchived":"\u663E\u793A\u5DF2\u5F52\u6863","yeaft.featureDetail.related.aria":"\u5173\u8054\u4EFB\u52A1","yeaft.featureDetail.related.title":"\u5173\u8054\u4EFB\u52A1","yeaft.featureDetail.related.unlink":"\u53D6\u6D88\u5173\u8054","yeaft.featureDetail.members.aria":"\u4EFB\u52A1\u6210\u5458","yeaft.featureDetail.members.title":"\u6210\u5458","yeaft.featureDetail.members.abort":"\u4E2D\u6B62","yeaft.featureDetail.members.kick":"\u8E22\u51FA","yeaft.model":"\u6A21\u578B","yeaft.placeholder":"\u95EE\u6211\u4EFB\u4F55\u95EE\u9898...","yeaft.inbox":"\u6536\u4EF6\u7BB1","yeaft.inbox.tooltip":"\u4F60\u7684\u9ED8\u8BA4\u5BF9\u8BDD\u7EBF\u7A0B \u2014\u2014 \u4E0E Yeaft \u7684\u4E00\u5BF9\u4E00\u804A\u5929\u3002\u53EF\u4EE5\u4E3A\u5177\u4F53\u8BDD\u9898\u6216\u4EFB\u52A1\u521B\u5EFA\u65B0\u7EBF\u7A0B\u3002","yeaft.sidebar.activeThreads":"\u6D3B\u8DC3","yeaft.sidebar.idleThreads":"\u9759\u9ED8","yeaft.sidebar.archivedThreads":"\u5DF2\u5F52\u6863","yeaft.sidebar.tasks":"\u4EFB\u52A1","yeaft.sidebar.emptyActive":"\u6682\u65E0\u6D3B\u8DC3 thread","yeaft.sidebar.emptyIdle":"\u6682\u65E0\u9759\u9ED8 thread","yeaft.sidebar.emptyArchived":"\u6682\u65E0\u5F52\u6863 thread","yeaft.sidebar.emptyTasks":"\u65E0\u5339\u914D\u4EFB\u52A1","yeaft.sidebar.results":"\u641C\u7D22\u7ED3\u679C","yeaft.sidebar.resultsThreads":"Threads","yeaft.sidebar.kindThread":"thread","yeaft.sidebar.cancel":"\u53D6\u6D88","yeaft.sidebar.mergeInto":"\u5408\u5E76\u5230\u2026","yeaft.sidebar.mergeNoCandidates":"\u6CA1\u6709\u53EF\u5408\u5E76\u7684\u5176\u4ED6\u7EBF\u7A0B","yeaft.sidebar.mergeConfirmTitle":"\u5408\u5E76\u8FD9\u4E2A\u7EBF\u7A0B\uFF1F","yeaft.sidebar.mergeIrreversible":"\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\uFF0C\u6E90\u7EBF\u7A0B\u5C06\u88AB\u5F52\u6863\uFF0C\u5176\u6D88\u606F\u4F1A\u88AB\u79FB\u52A8\u5230\u76EE\u6807\u7EBF\u7A0B\u3002","yeaft.sidebar.mergeConfirm":"\u5408\u5E76","yeaft.settings.sidebarV2":"\u5B9E\u9A8C\u529F\u80FD\uFF1A\u4FA7\u8FB9\u680F V2","yeaft.settings.sidebarV2Hint":"Thread \u5217\u8868 + \u4EFB\u52A1\u6811\uFF08\u9884\u89C8\uFF09\u3002","yeaft.clearConfirm":"\u6E05\u7A7A\u6240\u6709\u6D88\u606F\uFF1F","yeaft.mode":"\u6A21\u5F0F","yeaft.agent":"\u667A\u80FD\u4F53","yeaft.connecting":"\u8FDE\u63A5\u4E2D...","yeaft.ready":"\u5C31\u7EEA","yeaft.tools":"\u4E2A\u5DE5\u5177","yeaft.skills":"\u4E2A\u6280\u80FD","yeaft.mcp":"\u4E2A MCP","yeaft.showSidebar":"\u663E\u793A\u4FA7\u680F","yeaft.hideSidebar":"\u9690\u85CF\u4FA7\u680F","yeaft.debug":"\u8C03\u8BD5","yeaft.debugClose":"\u5173\u95ED\u8C03\u8BD5\u9762\u677F","yeaft.debugTurns":"\u8F6E","yeaft.debugTabToolStats":"\u5DE5\u5177\u7EDF\u8BA1","yeaft.debugTabDream":"Dream","yeaft.debugTabRequestLog":"\u8BF7\u6C42\u65E5\u5FD7","yeaft.debugHistoryLoad":"\u52A0\u8F7D\u8BF7\u6C42\u5386\u53F2","yeaft.debugHistoryLoading":"\u52A0\u8F7D\u4E2D...","yeaft.debugHistoryLoaded":"\u5DF2\u52A0\u8F7D {count} \u6761","yeaft.debugSearchPlaceholder":"\u6B63\u5219\u641C\u7D22\u8BF7\u6C42\u65E5\u5FD7","yeaft.debugSearchHint":"\u9ED8\u8BA4\u663E\u793A\u5168\u5C40\u6700\u8FD1 10 \u6761\uFF1B\u641C\u7D22\u4F1A\u8DE8 Session \u5339\u914D\u8BF7\u6C42\u6458\u8981\u3002","yeaft.dreamDebug.title":"Dream \u751F\u547D\u5468\u671F","yeaft.dreamDebug.trigger":"\u89E6\u53D1","yeaft.dreamDebug.status":"\u72B6\u6001","yeaft.dreamDebug.started":"\u5F00\u59CB","yeaft.dreamDebug.finished":"\u7ED3\u675F","yeaft.dreamDebug.time":"\u65F6\u95F4","yeaft.dreamDebug.phase":"\u9636\u6BB5","yeaft.dreamDebug.call":"\u8C03\u7528","yeaft.dreamDebug.location":"\u751F\u6210\u4F4D\u7F6E","yeaft.dreamDebug.result":"\u7ED3\u679C","yeaft.dreamDebug.noLatest":"\u8FD9\u4E2A\u4F1A\u8BDD\u8FD8\u6CA1\u6709\u8BB0\u5F55\u5230 Dream \u68C0\u67E5\u3002","yeaft.dreamDebug.noEvents":"\u8FD9\u4E2A\u4F1A\u8BDD\u8FD8\u6CA1\u6709 Dream \u4E8B\u4EF6\u3002","yeaft.dreamDebug.outputTitle":"\u672C session \u5DF2\u52A0\u8F7D\u7684 Dream \u8F93\u51FA","yeaft.dreamDebug.scope":"Scope","yeaft.dreamDebug.lastDream":"\u4E0A\u6B21 Dream","yeaft.dreamDebug.messagesCovered":"\u5DF2\u8986\u76D6\u6D88\u606F\u6570","yeaft.dreamDebug.noOutput":"\u8FD9\u4E2A session \u8FD8\u6CA1\u6709\u5199\u5165 Dream \u8F93\u51FA\u3002","yeaft.dreamDebug.promptLoadTitle":"\u5DF2\u52A0\u8F7D\u8FDB system prompt \u7684 Dream \u8BB0\u5FC6","yeaft.dreamDebug.loadedInto":"\u52A0\u8F7D\u4F4D\u7F6E","yeaft.dreamDebug.vp":"VP","yeaft.dreamDebug.summaryToPrompt":"summary.md -> system prompt","yeaft.dreamDebug.itemList":"Dream \u8FD0\u884C\u548C Scope","yeaft.dreamDebug.searchPlaceholder":"\u6309\u6807\u9898\u3001ID \u6216\u6458\u8981\u641C\u7D22 Dream Session...","yeaft.dreamDebug.noSearchResults":"\u6CA1\u6709\u5339\u914D\u7684 Dream Session\u3002","yeaft.dreamDebug.noSummary":"\u6682\u65E0\u6458\u8981","yeaft.dreamDebug.segments":"\u6BB5","yeaft.dreamDebug.lastError":"\u6700\u8FD1\u9519\u8BEF","yeaft.dreamDebug.overview":"\u6982\u89C8","yeaft.dreamDebug.sessionId":"Session ID","yeaft.dreamDebug.loadedAt":"\u52A0\u8F7D\u65F6\u95F4","yeaft.dreamDebug.layers":"\u5C42\u7EA7","yeaft.dreamDebug.summaryLayer":"Resident summary","yeaft.dreamDebug.noPromptLoad":"\u8FD9\u4E2A scope \u6682\u65E0 prompt-load \u8BB0\u5F55\u3002","yeaft.dreamDebug.segmentTitle":"Segments","yeaft.dreamDebug.sourceMessages":"\u6765\u6E90\u6D88\u606F","yeaft.dreamDebug.createdAt":"\u521B\u5EFA\u65F6\u95F4","yeaft.dreamDebug.updatedAt":"\u66F4\u65B0\u65F6\u95F4","yeaft.dreamDebug.noSegments":"\u8FD9\u4E2A scope \u6682\u65E0 memory segments\u3002","yeaft.dreamDebug.requestResponse":"Request / Response","yeaft.dreamDebug.noRequestResponse":"\u8FD9\u4E2A scope \u8FD8\u6CA1\u6709\u6301\u4E45\u5316\u7684 Dream request/response \u65E5\u5FD7\u3002","yeaft.dreamDebug.empty":"\u6682\u65E0 Dream debug \u6570\u636E\u3002","yeaft.debugGroupFollowMain":"\u8DDF\u968F\u4E3B\u9762\u677F","yeaft.debugGroupAll":"\u5168\u90E8\u4F1A\u8BDD","yeaft.debugAssistantResponse":"Assistant \u56DE\u590D","yeaft.debugViewAssistantResponse":"\u67E5\u770B\u56DE\u590D","yeaft.debugToolInput":"\u8F93\u5165","yeaft.debugToolResult":"\u7ED3\u679C","yeaft.debugToolRunning":"\u6267\u884C\u4E2D","yeaft.debugToolRunningNoResult":"\u6267\u884C\u4E2D\uFF0C\u6682\u65E0\u7ED3\u679C","yeaft.debugShowDetails":"\u5C55\u5F00","yeaft.debugHideDetails":"\u6536\u8D77","yeaft.debugTurnStartedAt":"\u56DE\u5408\u5F00\u59CB\u65F6\u95F4","yeaft.debugRequestAt":"\u8BF7\u6C42\u65F6\u95F4","yeaft.debugRequestAtDerived":"\u7531\u56DE\u5408\u5F00\u59CB\u65F6\u95F4\u63A8\u7B97\uFF08\u65E7 loop\uFF09","yeaft.turn":"\u7B2C {n} \u8F6E","yeaft.systemPrompt":"\u7CFB\u7EDF\u63D0\u793A","yeaft.messagesLabel":"\u6D88\u606F","yeaft.response":"\u56DE\u590D","yeaft.toolCalls":"\u5DE5\u5177\u8C03\u7528","yeaft.functionCalls":"\u51FD\u6570\u8C03\u7528","yeaft.request":"\u8BF7\u6C42","yeaft.pending":"(\u7B49\u5F85\u4E2D)","yeaft.inputTokens":"\u8F93\u5165","yeaft.outputTokens":"\u8F93\u51FA","yeaft.duration":"\u8017\u65F6","yeaft.noDebugData":"\u6682\u65E0\u8C03\u8BD5\u6570\u636E","yeaft.showDebug":"\u663E\u793A\u8C03\u8BD5\u9762\u677F","yeaft.hideDebug":"\u9690\u85CF\u8C03\u8BD5\u9762\u677F","yeaft.reloadPage":"\u5237\u65B0\u9875\u9762","yeaft.reloadMessages":"\u91CD\u65B0\u52A0\u8F7D\u6D88\u606F","yeaft.historySearch.label":"\u641C\u7D22 Session \u5386\u53F2\u6D88\u606F","yeaft.historySearch.button":"\u641C\u7D22\u6D88\u606F","yeaft.historySearch.placeholder":"\u641C\u7D22\u5F53\u524D Session \u7684\u6D88\u606F","yeaft.historySearch.searching":"\u6B63\u5728\u641C\u7D22\u2026","yeaft.historySearch.minChars":"\u81F3\u5C11\u8F93\u5165 2 \u4E2A\u5B57\u7B26","yeaft.historySearch.empty":"\u6CA1\u6709\u5339\u914D\u7684\u6D88\u606F","yeaft.historySearch.error":"\u641C\u7D22\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5","yeaft.historySearch.unsupported":"\u8BF7\u5347\u7EA7\u5F53\u524D Agent \u540E\u518D\u641C\u7D22 Session \u5386\u53F2\u6D88\u606F","yeaft.historySearch.more":"\u52A0\u8F7D\u66F4\u591A\u7ED3\u679C","yeaft.historySearch.you":"\u4F60","yeaft.historySearch.assistant":"\u52A9\u624B","yeaft.outline.label":"\u5386\u53F2\u6D88\u606F","yeaft.outline.sender":"\u53D1\u9001\u8005","yeaft.outline.allSenders":"\u5168\u90E8\u53D1\u9001\u8005","yeaft.outline.title":"\u5386\u53F2\u6D88\u606F","yeaft.outline.placeholder":"\u641C\u7D22\u5F53\u524D\u5BF9\u8BDD","yeaft.outline.searching":"\u6B63\u5728\u641C\u7D22\u2026","yeaft.outline.loading":"\u6B63\u5728\u52A0\u8F7D\u2026","yeaft.outline.older":"\u52A0\u8F7D\u66F4\u65E9\u6D88\u606F","yeaft.outline.moreMatches":"\u52A0\u8F7D\u66F4\u591A\u5339\u914D\u9879","yeaft.outline.minChars":"\u81F3\u5C11\u8F93\u5165 2 \u4E2A\u5B57\u7B26","yeaft.outline.empty":"\u6682\u65E0\u6D88\u606F","yeaft.outline.noMatches":"\u6CA1\u6709\u5339\u914D\u7684\u6D88\u606F","yeaft.outline.error":"\u5927\u7EB2\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5","yeaft.outline.unsupported":"\u8BF7\u5347\u7EA7\u5F53\u524D Agent \u540E\u518D\u4F7F\u7528\u5BF9\u8BDD\u5927\u7EB2","yeaft.outline.you":"\u4F60","yeaft.outline.assistant":"\u52A9\u624B","yeaft.outline.nonText":"\u975E\u6587\u672C\u56DE\u590D","yeaft.switchModel":"\u5207\u6362\u6A21\u578B","yeaft.modelMenu.title":"\u6A21\u578B\u548C LLM \u8BBE\u7F6E","yeaft.modelMenu.label":"\u6A21\u578B","yeaft.modelMenu.effort":"\u63A8\u7406\u5F3A\u5EA6","yeaft.modelMenu.effort.openaiReasoning":"\u63A8\u7406\u5F3A\u5EA6","yeaft.modelMenu.effort.anthropicBudget":"\u601D\u8003\u9884\u7B97","yeaft.modelMenu.effort.anthropicAdaptive":"\u81EA\u9002\u5E94\u601D\u8003\u5F3A\u5EA6","yeaft.modelMenu.effort.minimal":"\u6700\u5C0F","yeaft.modelMenu.effort.low":"\u4F4E","yeaft.modelMenu.effort.medium":"\u4E2D","yeaft.modelMenu.effort.high":"\u9AD8","yeaft.modelMenu.effort.xhigh":"\u8D85\u9AD8","yeaft.modelMenu.effort.max":"\u6700\u9AD8","yeaft.modelMenu.noEffort":"\u5F53\u524D\u6A21\u578B\u6CA1\u6709\u53EF\u517C\u5BB9\u6620\u5C04\u7684\u63A8\u7406\u5F3A\u5EA6\u63A7\u5236\u3002","yeaft.modelMenu.configureHint":"Provider\u3001\u5BC6\u94A5\u3001\u6A21\u578B\u5217\u8868","yeaft.settings.title":"\u8BBE\u7F6E","yeaft.settings.tabs.vp":"VP \u5E93","yeaft.settings.tabs.search":"\u641C\u7D22","search.settings.backendTitle":"\u641C\u7D22\u540E\u7AEF","search.settings.backendDesc":"\u9009\u62E9 WebSearch \u5DE5\u5177\u9ED8\u8BA4\u4F7F\u7528\u7684\u540E\u7AEF\u3002\u4E3B\u540E\u7AEF\u5931\u8D25\u65F6,\u5F15\u64CE\u4F1A\u81EA\u52A8\u964D\u7EA7\u5230 HTML \u6293\u53D6\u3002","search.settings.backend.tavily":"Tavily","search.settings.backend.tavilyHint":"\u6258\u7BA1\u641C\u7D22 API\u3002\u514D\u8D39\u989D\u5EA6 1000 \u6B21/\u6708\u3002\u63A8\u8350\u3002","search.settings.backend.playwright":"Playwright \u670D\u52A1","search.settings.backend.playwrightHint":"\u81EA\u5EFA\u7684\u6D4F\u89C8\u5668\u5F0F\u641C\u7D22/\u6293\u53D6\u670D\u52A1,\u9002\u5408 IP \u4FE1\u8A89\u5DEE\u88AB bot \u68C0\u6D4B\u7684\u73AF\u5883\u3002\u5C1A\u672A\u4E0A\u7EBF\u3002","search.settings.comingSoon":"\u5373\u5C06\u63A8\u51FA","search.settings.tavilyKeyTitle":"Tavily API key","search.settings.tavilyKeyDesc":"\u4FDD\u5B58\u5728 agent \u7684 ~/.yeaft/config.json \u4E2D\u3002\u514D\u8D39\u7533\u8BF7:","search.settings.tavilyKeyUnchanged":"\u4FDD\u6301\u4E0D\u53D8","search.settings.clearKey":"\u6E05\u9664","search.settings.usageTitle":"\u672C\u6708\u7528\u91CF","search.settings.usageRefresh":"\u5237\u65B0","search.settings.usageLoading":"\u52A0\u8F7D\u4E2D\u2026","search.settings.usagePlan":"\u8BA1\u5212","search.settings.usageUsed":"\u5DF2\u7528","search.settings.usagePaygo":"\u6309\u91CF\u4ED8\u8D39","search.settings.usageError":"\u52A0\u8F7D\u7528\u91CF\u5931\u8D25","search.settings.save":"\u4FDD\u5B58","search.settings.saving":"\u4FDD\u5B58\u4E2D\u2026","search.settings.saveSuccess":"\u5DF2\u4FDD\u5B58","search.settings.cancel":"\u91CD\u7F6E","yeaft.settings.yeaftTitle":"\u7EBF\u7A0B\u5E76\u53D1\u4E0E\u5F52\u6863","yeaft.settings.yeaftDesc":"\u8C03\u6574\u53EF\u540C\u65F6\u8FD0\u884C\u7684\u7EBF\u7A0B\u6570\u91CF\uFF0C\u4EE5\u53CA\u95F2\u7F6E\u7EBF\u7A0B\u7684\u81EA\u52A8\u5F52\u6863\u65F6\u957F\u3002","yeaft.settings.maxConcurrentLabel":"\u6700\u5927\u5E76\u53D1\u7EBF\u7A0B\u6570","yeaft.settings.maxConcurrentHint":"\u540C\u65F6\u5728\u7EBF\u7684\u7EBF\u7A0B\u603B\u6570\u4E0A\u9650\uFF08\u542B\u59CB\u7EC8\u5B58\u5728\u7684 main \u4E3B\u7EBF\u7A0B\uFF09\u3002\u8D85\u8FC7\u6B64\u4E0A\u9650\u7684\u65B0\u7EBF\u7A0B\u5C06\u88AB\u62D2\u7EDD\uFF0C\u76F4\u81F3\u5DF2\u6709\u7EBF\u7A0B\u88AB\u5F52\u6863\u6216\u7EC8\u6B62\u3002\u8303\u56F4\uFF1A1-50\u3002","yeaft.settings.archiveIdleDaysLabel":"\u95F2\u7F6E\u591A\u4E45\u540E\u81EA\u52A8\u5F52\u6863\u7EBF\u7A0B\uFF08\u5929\uFF09","yeaft.settings.archiveIdleDaysHint":"\u65E0\u6D3B\u52A8\u8D85\u8FC7\u6B64\u5929\u6570\u7684\u7EBF\u7A0B\u5C06\u88AB\u5F52\u6863\u3002\u8303\u56F4\uFF1A1-3650\u3002","yeaft.settings.yeaftSaveBtn":"\u4FDD\u5B58","yeaft.settings.yeaftSaving":"\u4FDD\u5B58\u4E2D...","yeaft.settings.yeaftSaved":"\u5DF2\u4FDD\u5B58","yeaft.settings.yeaftLoading":"\u52A0\u8F7D\u4E2D...","yeaft.settings.yeaftLoadError":"\u52A0\u8F7D Yeaft \u8BBE\u7F6E\u5931\u8D25","yeaft.settings.yeaftSaveError":"\u4FDD\u5B58 Yeaft \u8BBE\u7F6E\u5931\u8D25","yeaft.settings.rangeErrorConcurrent":"\u5FC5\u987B\u5728 1 \u5230 50 \u4E4B\u95F4","yeaft.settings.rangeErrorArchive":"\u5FC5\u987B\u5728 1 \u5230 3650 \u4E4B\u95F4","chat.session.creating":"\u6B63\u5728\u521B\u5EFA\u4F1A\u8BDD...","chat.session.loadingHistory":"\u6B63\u5728\u52A0\u8F7D\u4F1A\u8BDD\u5386\u53F2...","yeaft.historyLoad.error":"\u4F1A\u8BDD\u5386\u53F2\u6682\u65F6\u65E0\u6CD5\u52A0\u8F7D\uFF0C\u6D88\u606F\u4ECD\u5B89\u5168\u4FDD\u5B58\u5728 Agent \u4E2D\u3002","yeaft.historyLoad.retry":"\u91CD\u65B0\u52A0\u8F7D","yeaft.sessionInventory.error":"\u6682\u65F6\u65E0\u6CD5\u52A0\u8F7D Session\uFF0C\u4F1A\u8BDD\u4ECD\u5B89\u5168\u4FDD\u5B58\u5728 Agent \u4E2D\u3002","yeaft.sessionInventory.retry":"\u91CD\u65B0\u52A0\u8F7D Session","chat.session.closed":"\u4F1A\u8BDD\u5DF2\u5173\u95ED","chat.session.agentOffline":"Agent \u5DF2\u79BB\u7EBF\uFF0C\u8BE5\u4F1A\u8BDD\u5C06\u5728 Agent \u91CD\u65B0\u4E0A\u7EBF\u540E\u6062\u590D\u3002","chat.execution.cancelled":"\u6267\u884C\u5DF2\u53D6\u6D88","chat.sidebar.expand":"\u5C55\u5F00\u83DC\u5355","chat.sidebar.collapse":"\u6536\u8D77\u4FA7\u8FB9\u680F","chat.sidebar.workbench":"\u5DE5\u5177\u9762\u677F","chat.sidebar.newConv":"\u4F1A\u8BDD","chat.sidebar.recentChats":"\u6700\u8FD1\u4F1A\u8BDD","chat.sidebar.resumeConv":"\u6062\u590D\u4F1A\u8BDD","chat.sidebar.lightMode":"\u6D45\u8272\u6A21\u5F0F","chat.sidebar.darkMode":"\u6DF1\u8272\u6A21\u5F0F","chat.sidebar.settings":"\u8BBE\u7F6E","chat.sidebar.emptyHint":"\u70B9\u51FB\u4E0A\u65B9\u6309\u94AE\u521B\u5EFA\u65B0\u4F1A\u8BDD","chat.sidebar.closeConv":"\u5173\u95ED\u4F1A\u8BDD","chat.sidebar.renameConv":"\u91CD\u547D\u540D","chat.sidebar.pin":"\u7F6E\u9876","chat.sidebar.unpin":"\u53D6\u6D88\u7F6E\u9876","chat.connection.connecting":"\u8FDE\u63A5\u4E2D...","chat.connection.reconnecting":"\u91CD\u8FDE\u4E2D ({current}/{max})...","chat.connection.updating":"\u670D\u52A1\u6B63\u5728\u66F4\u65B0\uFF0C\u8BF7\u7A0D\u5019...","chat.connection.disconnected":"\u8FDE\u63A5\u65AD\u5F00","chat.connection.reconnect":"\u91CD\u8FDE","chat.connection.reconnectFailed":"\u8FDE\u63A5\u65AD\u5F00\uFF0C\u8BF7\u70B9\u51FB\u91CD\u8FDE\u6309\u94AE\u91CD\u8BD5\u3002","chat.time.justNow":"\u521A\u521A","chat.time.minutesAgo":"{count}\u5206\u949F\u524D","chat.time.daysAgo":"{count}\u5929\u524D","chat.time.today":"\u4ECA\u5929","chat.time.yesterday":"\u6628\u5929","chat.delete.confirm":"\u786E\u5B9A\u8981\u5173\u95ED\u8FD9\u4E2A\u4F1A\u8BDD\u5417\uFF1F\u8FD9\u5C06\u7EC8\u6B62\u5BF9\u5E94\u7684 Claude \u8FDB\u7A0B\u3002","chat.delete.enterWorkDir":"\u8BF7\u8F93\u5165\u5DE5\u4F5C\u76EE\u5F55\u8DEF\u5F84","modal.newConv.workDir":"\u5DE5\u4F5C\u76EE\u5F55","modal.newConv.inputOrSelect":"\u8F93\u5165\u6216\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55","modal.newConv.browse":"\u6D4F\u89C8\u76EE\u5F55","modal.newConv.noWorkDirs":"\u6682\u65E0\u5DE5\u4F5C\u76EE\u5F55","modal.newConv.selectAgent":"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A\u5728\u7EBF\u7684 Agent","modal.newConv.create":"\u521B\u5EFA\u4F1A\u8BDD","modal.newConv.folderLabel":"\u{1F4C1} \u5DE5\u4F5C\u76EE\u5F55","modal.newConv.provider":"\u63D0\u4F9B\u65B9","modal.newConv.model":"\u6A21\u578B","provider.claudeCode":"Claude Code","provider.copilot":"Copilot","modal.resume.workDir":"\u5DE5\u4F5C\u76EE\u5F55","modal.resume.inputOrSelect":"\u8F93\u5165\u6216\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55","modal.resume.browse":"\u6D4F\u89C8\u76EE\u5F55","modal.resume.tabFolders":"\u5DE5\u4F5C\u76EE\u5F55","modal.resume.tabSessions":"\u5386\u53F2\u4F1A\u8BDD","modal.resume.noWorkDirs":"\u6682\u65E0\u5DE5\u4F5C\u76EE\u5F55","modal.resume.selectWorkDir":"\u8BF7\u5148\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55","modal.resume.noSessions":"\u8BE5\u76EE\u5F55\u4E0B\u6CA1\u6709\u5386\u53F2\u4F1A\u8BDD","modal.resume.untitled":"\u672A\u547D\u540D\u4F1A\u8BDD","modal.resume.folderLabel":"\u{1F4C1} \u5DE5\u4F5C\u76EE\u5F55","modal.resume.sessionLabel":"\u{1F4AC} \u5386\u53F2\u4F1A\u8BDD","modal.resume.selectAgent":"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A\u5728\u7EBF\u7684 Agent","modal.folderPicker.title":"\u9009\u62E9\u5DE5\u4F5C\u76EE\u5F55","modal.folderPicker.parentDir":"\u4E0A\u7EA7\u76EE\u5F55","welcome.subtitle":"\u9762\u5411 Session\u3001\u5DE5\u5177\u548C VP \u534F\u4F5C\u7684 Web Code Agent","welcome.agentOnline":"{count} \u4E2A Agent \u5728\u7EBF","welcome.noAgents":"\u6682\u65E0\u5728\u7EBF Agent","welcome.noAgentsHint":"\u8BF7\u5148\u542F\u52A8 Agent \u7A0B\u5E8F\u8FDE\u63A5\u5230\u670D\u52A1\u5668","welcome.noAgent":"\u6682\u65E0\u5728\u7EBF Agent","welcome.noAgentHint":"\u8BF7\u5148\u542F\u52A8 Agent \u7A0B\u5E8F\u8FDE\u63A5\u5230\u670D\u52A1\u5668","welcome.setupAgent":"\u8BBE\u7F6E Agent","welcome.setupKicker":"Agent \u63A5\u5165","welcome.setupTitle":"\u8FDE\u63A5\u4F60\u7684\u7B2C\u4E00\u4E2A Yeaft Agent","welcome.setupDesc":"\u590D\u5236\u4E24\u6761\u547D\u4EE4\u5373\u53EF\u8FDE\u63A5\u672C\u673A Agent\u3002\u6A21\u578B\u53EF\u7528 GitHub Copilot \u81EA\u52A8\u914D\u7F6E\u3002","welcome.setupInstallTitle":"\u5B89\u88C5 CLI","welcome.setupCopilotTitle":"\u914D\u7F6E\u6A21\u578B","welcome.setupRunTitle":"\u542F\u52A8 Agent","welcome.setupSecretLoading":"\u6B63\u5728\u51C6\u5907 Agent secret...","welcome.setupSecretError":"\u65E0\u6CD5\u51C6\u5907 Agent secret\uFF0C\u8BF7\u6253\u5F00\u5B89\u5168\u8BBE\u7F6E\u91CD\u8BD5\u3002","welcome.openSecuritySettings":"\u6253\u5F00\u5B89\u5168\u8BBE\u7F6E","welcome.newConv":"\u4F1A\u8BDD","welcome.resumeHistory":"\u6062\u590D\u5386\u53F2","messages.loadingMore":"\u52A0\u8F7D\u66F4\u591A\u6D88\u606F...","messages.loadMore":"\u2191 \u70B9\u51FB\u6216\u5411\u4E0A\u6EDA\u52A8\u52A0\u8F7D\u66F4\u591A","message.loadingMore":"\u52A0\u8F7D\u66F4\u591A\u6D88\u606F...","message.loadMore":"\u2191 \u70B9\u51FB\u6216\u5411\u4E0A\u6EDA\u52A8\u52A0\u8F7D\u66F4\u591A","message.scrollToLatest":"\u2193 \u6700\u65B0","message.showResponses":"\u5C55\u5F00 {count} \u6761\u56DE\u590D","message.hideResponses":"\u6298\u53E0\u56DE\u590D","message.assistant":"\u52A9\u624B","chat.waiting.disconnected":"\u8FDE\u63A5\u5DF2\u65AD\u5F00","chat.connecting":"\u6B63\u5728\u8FDE\u63A5 provider \u4F1A\u8BDD...","chat.waiting.compacting":"\u6B63\u5728\u538B\u7F29\u4E0A\u4E0B\u6587...","chat.waiting.agentOffline":"Agent \u5DF2\u79BB\u7EBF","chat.waiting.sessionLost":"Session \u5DF2\u4E22\u5931\uFF0C\u5DF2\u5237\u65B0\uFF0C\u7B49\u5F85\u6700\u65B0\u4FE1\u606F...","chat.waiting.cliExited":"Claude \u8FDB\u7A0B\u5DF2\u9000\u51FA\uFF0C\u5DF2\u5237\u65B0\uFF0C\u7B49\u5F85\u6700\u65B0\u4FE1\u606F...","chat.waiting.refresh":"\u5237\u65B0","chat.waiting.thinking":"AI \u6B63\u5728\u601D\u8003\u4E2D\uFF0C\u8BF7\u7A0D\u5019...","btw.hint":"esc \u9000\u51FA","btw.placeholder":"\u95EE\u4E2A\u987A\u4FBF\u7684\u95EE\u9898...","btw.close":"\u9000\u51FA BTW \u6A21\u5F0F","message.copyContent":"\u590D\u5236\u5185\u5BB9","message.copy":"\u590D\u5236\u5185\u5BB9","message.copied":"\u5DF2\u590D\u5236","message.copyCode":"\u590D\u5236\u4EE3\u7801","message.copyAll":"\u590D\u5236\u5168\u90E8","message.screenshot":"\u622A\u56FE","message.screenshotting":"\u6B63\u5728\u622A\u56FE...","message.exportMd":"\u5BFC\u51FA MD","message.askInput":"\u9700\u8981\u4F60\u7684\u8F93\u5165","message.askAnswered":"\u2713 \u5DF2\u56DE\u7B54","message.askCustom":"\u6216\u8F93\u5165\u81EA\u5B9A\u4E49\u56DE\u7B54...","message.askCustomPlaceholder":"\u6216\u8F93\u5165\u81EA\u5B9A\u4E49\u56DE\u7B54...","message.askSubmit":"\u63D0\u4EA4\u56DE\u7B54","message.askWaiting":"\u7B49\u5F85\u95EE\u9898\u52A0\u8F7D...","message.askExpired":"\u6B64\u95EE\u9898\u5DF2\u5931\u6548\uFF0C\u8BF7\u8BA9\u89D2\u8272\u91CD\u65B0\u63D0\u95EE","message.openInEditor":"\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00","message.resultDone":"\u5B8C\u6210","message.done":"\u5B8C\u6210","message.resultRead":"\u8BFB\u53D6 {file}","message.readFile":"\u8BFB\u53D6 {name}","message.file":"\u6587\u4EF6","message.attachImages":"{count} \u5F20\u56FE\u7247","message.imageCount":"{count} \u5F20\u56FE\u7247","message.imagePreview":"\u56FE\u7247\u9884\u89C8","message.imageUnavailable":"\u56FE\u7247\u65E0\u6CD5\u52A0\u8F7D","message.attachFiles":"{count} \u4E2A\u6587\u4EF6","message.fileCount":"{count} \u4E2A\u6587\u4EF6","message.quote":"\u5F15\u7528","message.removeQuote":"\u5220\u9664\u5F15\u7528","message.replyingTo":"\u6B63\u5728\u56DE\u590D {author}","message.quotedFrom":"\u5F15\u7528\u81EA {author}","message.editAsNew":"\u7F16\u8F91","message.you":"\u4F60","input.upload":"\u4E0A\u4F20\u6587\u4EF6","input.placeholder":"\u8F93\u5165\u6D88\u606F...","input.send":"\u53D1\u9001","input.stopExecution":"\u505C\u6B62\u6267\u884C","chatInput.upload":"\u4E0A\u4F20\u6587\u4EF6","chatInput.uploading":"\u6B63\u5728\u4E0A\u4F20\u2026","chatInput.uploadFailed":"\u4E0A\u4F20\u5931\u8D25","chatInput.retryUpload":"\u91CD\u8BD5","chatInput.removeAttachment":"\u79FB\u9664\u9644\u4EF6","chatInput.placeholder":"\u8F93\u5165\u6D88\u606F...","chatInput.send":"\u53D1\u9001","chatInput.stop":"\u505C\u6B62\u6267\u884C","tools.thinking":"\u601D\u8003\u4E2D...","tools.read":"\u6B63\u5728\u8BFB\u53D6\u6587\u4EF6","tools.write":"\u6B63\u5728\u5199\u5165\u6587\u4EF6","tools.edit":"\u6B63\u5728\u7F16\u8F91\u6587\u4EF6","tools.bash":"\u6B63\u5728\u6267\u884C\u547D\u4EE4","tools.glob":"\u6B63\u5728\u641C\u7D22\u6587\u4EF6","tools.grep":"\u6B63\u5728\u641C\u7D22\u5185\u5BB9","tools.task":"\u6B63\u5728\u6267\u884C\u4EFB\u52A1","tools.webFetch":"\u6B63\u5728\u83B7\u53D6\u7F51\u9875","tools.webSearch":"\u6B63\u5728\u641C\u7D22\u7F51\u7EDC","tools.todoWrite":"\u6B63\u5728\u66F4\u65B0\u4EFB\u52A1","tools.executing":"\u6B63\u5728\u6267\u884C {name}","status.thinking":"\u601D\u8003\u4E2D...","status.reading":"\u6B63\u5728\u8BFB\u53D6\u6587\u4EF6","status.writing":"\u6B63\u5728\u5199\u5165\u6587\u4EF6","status.editing":"\u6B63\u5728\u7F16\u8F91\u6587\u4EF6","status.executing":"\u6B63\u5728\u6267\u884C\u547D\u4EE4","status.searchingFiles":"\u6B63\u5728\u641C\u7D22\u6587\u4EF6","status.searchingContent":"\u6B63\u5728\u641C\u7D22\u5185\u5BB9","status.executingTask":"\u6B63\u5728\u6267\u884C\u4EFB\u52A1","status.fetching":"\u6B63\u5728\u83B7\u53D6\u7F51\u9875","status.searching":"\u6B63\u5728\u641C\u7D22\u7F51\u7EDC","status.updatingTasks":"\u6B63\u5728\u66F4\u65B0\u4EFB\u52A1","status.executingTool":"\u6B63\u5728\u6267\u884C {name}","header.compacting":"\u6B63\u5728\u538B\u7F29\u4E0A\u4E0B\u6587...","header.compacted":"\u4E0A\u4E0B\u6587\u538B\u7F29\u5B8C\u6210","chatHeader.newConv":"\u4F1A\u8BDD","chatHeader.compacting":"\u6B63\u5728\u538B\u7F29\u4E0A\u4E0B\u6587...","chatHeader.compactDone":"\u4E0A\u4E0B\u6587\u538B\u7F29\u5B8C\u6210","chatHeader.compact":"\u538B\u7F29\u4E0A\u4E0B\u6587","chatHeader.resume":"\u6062\u590D\u4F1A\u8BDD","chatHeader.refresh":"\u5237\u65B0\u6D88\u606F","chatHeader.reloadPage":"\u5237\u65B0\u9875\u9762","chatHeader.clear":"\u6E05\u7A7A\u6D88\u606F","chatHeader.clearing":"\u6B63\u5728\u6E05\u7A7A\u4E0A\u4E0B\u6587...","chatHeader.clearDone":"\u4E0A\u4E0B\u6587\u5DF2\u6E05\u7A7A","chatHeader.confirmClear":"\u786E\u5B9A\u8981\u6E05\u7A7A\u5F53\u524D\u4F1A\u8BDD\u7684\u6240\u6709\u6D88\u606F\u5417\uFF1F","chatHeader.mcpConfig":"MCP \u670D\u52A1\u5668\u914D\u7F6E","chatHeader.mcpNeedRestart":"\u66F4\u6539\u5C06\u5728\u91CD\u542F\u4F1A\u8BDD\u540E\u751F\u6548\u3002","chatHeader.expertPanel":"\u5E2E\u5E2E\u56E2","chatHeader.subAgentPanel":"\u5B50\u4EE3\u7406","settings.close":"\u5173\u95ED\u8BBE\u7F6E","settings.tabs.account":"\u8D26\u53F7","settings.tabs.security":"\u5B89\u5168","settings.tabs.general":"\u901A\u7528","settings.tabs.invitations":"\u9080\u8BF7","auth.sessionExpired":"\u767B\u5F55\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u3002","settings.account.username":"\u7528\u6237\u540D","settings.account.role":"\u89D2\u8272","settings.account.email":"\u90AE\u7BB1","settings.account.emailNotSet":"\u672A\u8BBE\u7F6E","settings.account.profileLoadFailed":"\u8D26\u53F7\u8D44\u6599\u52A0\u8F7D\u5931\u8D25","settings.account.logout":"\u9000\u51FA\u767B\u5F55","settings.account.roleAdmin":"\u7BA1\u7406\u5458","settings.account.rolePro":"Pro","settings.account.linkedAccounts":"\u5DF2\u5173\u8054\u8D26\u6237","settings.account.linkedDesc":"\u5173\u8054\u7B2C\u4E09\u65B9\u767B\u5F55\u540E\uFF0C\u4F7F\u7528\u4EFB\u610F\u4E00\u79CD\u65B9\u5F0F\u90FD\u80FD\u767B\u5F55\u6B64\u8D26\u53F7\u3002","settings.account.bind":"\u7ED1\u5B9A","settings.account.unbind":"\u89E3\u7ED1","settings.account.linked":"\u5DF2\u7ED1\u5B9A","settings.account.providerDisabled":"\u672A\u914D\u7F6E","settings.account.cantUnbindLast":"\u4E0D\u80FD\u89E3\u7ED1\u552F\u4E00\u7684\u767B\u5F55\u65B9\u5F0F","settings.account.unbindFailed":"\u89E3\u7ED1\u5931\u8D25\uFF1A{error}","settings.account.bindFailed":"\u7ED1\u5B9A\u5931\u8D25","settings.account.ssoBoundMsg":"\u5DF2\u6210\u529F\u7ED1\u5B9A {provider}\u3002","settings.account.ssoConflictMsg":"\u8BE5 {provider} \u8D26\u53F7\u5DF2\u88AB\u5176\u4ED6\u7528\u6237\u7ED1\u5B9A\u3002","settings.account.providerMicrosoft":"Microsoft","settings.account.providerGithub":"GitHub","settings.account.providerGoogle":"Google","settings.account.providerWechat":"\u5FAE\u4FE1","settings.account.providerAlipay":"\u652F\u4ED8\u5B9D","settings.security.agentKey":"Agent \u5BC6\u94A5","settings.security.agentKeyDesc":"\u7528\u4E8E Agent \u8FDE\u63A5\u8BA4\u8BC1\u7684\u5171\u4EAB\u5BC6\u94A5","settings.security.agentSetupCommands":"Agent \u63A5\u5165\u547D\u4EE4","settings.security.agentCmdInstall":"\u5B89\u88C5 Agent","settings.security.agentCmdService":"\u8FD0\u884C Agent server","settings.security.agentCmdNeedsSecret":"\u8BF7\u5148\u751F\u6210 Agent \u5BC6\u94A5\uFF0C\u4EE5\u521B\u5EFA\u5305\u542B server \u5730\u5740\u548C\u5BC6\u94A5\u7684\u547D\u4EE4\u3002","settings.security.agentCmdLlm":"Copilot \u624B\u52A8\u515C\u5E95","settings.security.agentCmdLlmDesc":"\u5148\u8FD0\u884C\u5B89\u88C5\u547D\u4EE4\uFF1B\u5982\u679C\u672C\u673A\u5DF2\u6709 GitHub Copilot token\uFF0CYeaft \u4F1A\u81EA\u52A8\u914D\u7F6E github-copilot/gpt-5.5\u3002Copilot \u547D\u4EE4\u53EA\u4F5C\u4E3A\u515C\u5E95\u4F7F\u7528\u3002","settings.security.none":"\u65E0","settings.security.show":"\u663E\u793A","settings.security.hide":"\u9690\u85CF","settings.security.generateKey":"\u751F\u6210\u5BC6\u94A5","settings.security.resetKey":"\u91CD\u7F6E\u5BC6\u94A5","settings.security.resetting":"\u91CD\u7F6E\u4E2D...","settings.security.resetWarning":"\u91CD\u7F6E\u540E\u6240\u6709 Agent \u9700\u91CD\u65B0\u914D\u7F6E","settings.security.changePassword":"\u4FEE\u6539\u5BC6\u7801","settings.security.currentPassword":"\u5F53\u524D\u5BC6\u7801","settings.security.newPassword":"\u65B0\u5BC6\u7801\uFF08\u81F3\u5C116\u4F4D\uFF09","settings.security.confirmPassword":"\u786E\u8BA4\u65B0\u5BC6\u7801","settings.security.changeBtn":"\u4FEE\u6539\u5BC6\u7801","settings.security.changing":"\u4FEE\u6539\u4E2D...","settings.security.enterCurrentPwd":"\u8BF7\u8F93\u5165\u5F53\u524D\u5BC6\u7801","settings.security.newPwdMin":"\u65B0\u5BC6\u7801\u81F3\u5C116\u4F4D","settings.security.pwdMismatch":"\u4E24\u6B21\u5BC6\u7801\u4E0D\u4E00\u81F4","settings.security.pwdChanged":"\u5BC6\u7801\u4FEE\u6539\u6210\u529F","settings.security.setPassword":"\u8BBE\u7F6E\u5BC6\u7801","settings.security.setPasswordDesc":"\u4F60\u76EE\u524D\u901A\u8FC7 SSO \u767B\u5F55\uFF0C\u5C1A\u672A\u8BBE\u7F6E\u5BC6\u7801\u3002\u8BBE\u7F6E\u540E\u5373\u53EF\u4F7F\u7528\u7528\u6237\u540D + \u5BC6\u7801\u767B\u5F55\u3002","settings.security.setBtn":"\u8BBE\u7F6E\u5BC6\u7801","settings.security.pwdSet":"\u5BC6\u7801\u8BBE\u7F6E\u6210\u529F","settings.security.deleteAccount":"\u6CE8\u9500\u8D26\u6237","settings.security.deleteAccountDesc":"\u6C38\u4E45\u5220\u9664\u4F60\u7684\u8D26\u6237\u548C\u6240\u6709\u76F8\u5173\u6570\u636E\u3002\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002","settings.security.deleteBtn":"\u6CE8\u9500\u8D26\u6237","settings.security.deleteConfirmBtn":"\u786E\u8BA4\u5220\u9664","settings.security.deleteConfirmPlaceholder":"\u8F93\u5165 DELETE \u4EE5\u786E\u8BA4","settings.security.deleteConfirmRequired":"\u8BF7\u8F93\u5165 DELETE \u4EE5\u786E\u8BA4\u6CE8\u9500\u8D26\u6237","settings.security.deleteFailed":"\u6CE8\u9500\u8D26\u6237\u5931\u8D25","settings.security.deleting":"\u6CE8\u9500\u4E2D...","settings.general.theme":"\u4E3B\u9898","settings.general.lightTheme":"\u6D45\u8272","settings.general.darkTheme":"\u6DF1\u8272","settings.general.language":"\u8BED\u8A00","settings.invite.create":"\u521B\u5EFA\u9080\u8BF7\u7801","settings.invite.normalUser":"\u666E\u901A\u7528\u6237","settings.invite.proUser":"Pro \u7528\u6237","settings.invite.createBtn":"\u521B\u5EFA\u9080\u8BF7\u7801","settings.invite.creating":"\u521B\u5EFA\u4E2D...","settings.invite.list":"\u9080\u8BF7\u7801\u5217\u8868","settings.invite.used":"\u5DF2\u4F7F\u7528","settings.invite.expired":"\u5DF2\u8FC7\u671F","settings.invite.available":"\u53EF\u7528","settings.invite.usedBy":"\u4F7F\u7528\u8005: {user}","settings.invite.expiredAt":"\u8FC7\u671F\u4E8E: {time}","settings.invite.expiresAt":"\u6709\u6548\u81F3: {time}","settings.invite.noInvites":"\u6682\u65E0\u9080\u8BF7\u7801","settings.msg.copiedClipboard":"\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F","settings.msg.copyFailed":"\u590D\u5236\u5931\u8D25","settings.msg.keyReset":"\u5BC6\u94A5\u5DF2\u91CD\u7F6E","settings.msg.resetFailed":"\u91CD\u7F6E\u5931\u8D25","settings.msg.changeFailed":"\u4FEE\u6539\u5931\u8D25","settings.msg.inviteCreated":"\u9080\u8BF7\u7801\u5DF2\u521B\u5EFA","settings.msg.createFailed":"\u521B\u5EFA\u5931\u8D25","settings.msg.inviteCopied":"\u9080\u8BF7\u7801\u5DF2\u590D\u5236","settings.msg.inviteDeleted":"\u9080\u8BF7\u7801\u5DF2\u5220\u9664","settings.msg.deleteFailed":"\u5220\u9664\u5931\u8D25","settings.tabs.llm":"LLM","settings.tabs.yeaft":"Yeaft","settings.yeaft.tabs.vp":"VP \u5E93","settings.yeaft.tabs.search":"\u641C\u7D22","settings.yeaft.tabs.mcp":"MCP","settings.mcp.title":"MCP \u670D\u52A1\u5668","settings.mcp.description":"\u901A\u8FC7 Model Context Protocol \u7ED9 Yeaft \u63A5\u5165\u66F4\u591A\u5DE5\u5177\u3002\u914D\u7F6E\u5199\u5165 agent \u4E0A\u7684 ~/.yeaft/config.json\uFF0C\u5DE5\u5177\u4F1A\u4EE5 mcp__<server>__<tool> \u7684\u5F62\u5F0F\u51FA\u73B0\u5728 LLM \u5DE5\u5177\u5217\u8868\u91CC\u3002","settings.mcp.reloadAll":"\u5168\u90E8\u91CD\u8FDE","settings.mcp.reloadOne":"\u91CD\u65B0\u8FDE\u63A5\u6B64\u670D\u52A1\u5668","settings.mcp.loading":"\u5904\u7406\u4E2D\u2026","settings.mcp.connected":"\u5DF2\u8FDE\u63A5","settings.mcp.disconnected":"\u672A\u8FDE\u63A5","settings.mcp.tools":"\u4E2A\u5DE5\u5177","settings.mcp.remove":"\u79FB\u9664","settings.mcp.empty":"\u8FD8\u6CA1\u6709\u914D\u7F6E MCP \u670D\u52A1\u5668\uFF0C\u53EF\u4EE5\u5728\u4E0B\u65B9\u6DFB\u52A0\u4E00\u4E2A\u3002","settings.mcp.addServer":"\u6DFB\u52A0\u670D\u52A1\u5668","settings.mcp.addServerDesc":"\u5927\u90E8\u5206 MCP \u670D\u52A1\u5668\u662F\u672C\u5730\u547D\u4EE4 \u2014 Yeaft \u4F1A\u901A\u8FC7 stdio \u542F\u52A8\u5B83\u5E76\u81EA\u52A8\u53D1\u73B0\u53EF\u7528\u5DE5\u5177\u3002","settings.mcp.serverName":"\u540D\u79F0","settings.mcp.command":"\u547D\u4EE4","settings.mcp.args":"\u53C2\u6570","settings.mcp.argsPlaceholder":"\u4F8B\u5982\uFF1A-y @modelcontextprotocol/server-filesystem /tmp","settings.mcp.env":"\u73AF\u5883\u53D8\u91CF","settings.mcp.envPlaceholder":"\u6BCF\u884C\u4E00\u4E2A KEY=value\uFF0C# \u5F00\u5934\u7684\u884C\u4F1A\u88AB\u5FFD\u7565\u3002","settings.mcp.saving":"\u4FDD\u5B58\u4E2D\u2026","settings.mcp.add":"\u6DFB\u52A0","settings.mcp.cancel":"\u6E05\u7A7A","settings.mcp.connectFailed":"\u5DF2\u4FDD\u5B58\u4F46\u8FDE\u63A5\u5931\u8D25","settings.mcp.addSuccess":"\u670D\u52A1\u5668\u5DF2\u6DFB\u52A0","settings.mcp.removeSuccess":"\u670D\u52A1\u5668\u5DF2\u79FB\u9664","settings.mcp.reloadSuccess":"\u5DF2\u8BF7\u6C42\u91CD\u8FDE","settings.mcp.confirmRemove":'\u79FB\u9664 MCP \u670D\u52A1\u5668 "{name}"\uFF1F\u4E0B\u4E00\u4E2A LLM turn \u8D77\u5B83\u7684\u5DE5\u5177\u5C06\u4E0D\u518D\u53EF\u89C1\u3002',"settings.mcp.errors.nameRequired":"\u8BF7\u586B\u5199\u540D\u79F0","settings.mcp.errors.nameFormat":"\u540D\u79F0\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u77ED\u6A2A\u7EBF\u548C\u4E0B\u5212\u7EBF","settings.mcp.errors.commandRequired":"\u8BF7\u586B\u5199\u547D\u4EE4","settings.mcp.errors.argsParse":"\u53C2\u6570\u89E3\u6790\u5931\u8D25","settings.mcp.errors.envParse":"\u73AF\u5883\u53D8\u91CF\u89E3\u6790\u5931\u8D25","yeaft.session.title":"\u4F1A\u8BDD","yeaft.session.new":"+ \u65B0\u5EFA\u4F1A\u8BDD","yeaft.session.create.title":"\u65B0\u5EFA\u4F1A\u8BDD","yeaft.session.create.subtitle":"\u9009\u62E9\u8FD0\u884C\u4F4D\u7F6E\u548C\u5904\u7406\u4F1A\u8BDD\u7684 Provider\u3002","yeaft.session.create.close":"\u5173\u95ED","yeaft.session.create.nameLabel":"\u540D\u79F0","yeaft.session.create.namePlaceholder":"\u4F1A\u8BDD\u540D\u79F0\uFF08\u53EF\u9009\uFF09","yeaft.session.create.workDirLabel":"\u5DE5\u4F5C\u76EE\u5F55","yeaft.session.create.agentLabel":"Agent","yeaft.session.create.vpPicker":"\u9009\u62E9 VP","yeaft.session.create.vpNone":"\u672A\u9009\u62E9 VP","yeaft.session.create.vpCount":"\u5DF2\u9009 {n} \u4E2A VP","yeaft.session.create.untitled":"\u672A\u547D\u540D\u4F1A\u8BDD","yeaft.session.create.rosterEmpty":"\u6682\u65E0\u53EF\u7528 VP \u2014 \u8BF7\u5148\u5230\u89D2\u8272\u5E93\u521B\u5EFA\u3002","yeaft.session.create.rosterLoading":"VP \u52A0\u8F7D\u4E2D\u2026","yeaft.session.create.rosterError":"\u65E0\u6CD5\u4ECE\u5F53\u524D Agent \u52A0\u8F7D VP\u3002","yeaft.session.create.rosterRetry":"\u91CD\u8BD5","yeaft.vp.domain.general":"\u901A\u7528\u4E0E\u534F\u4F5C","yeaft.vp.domain.productDesign":"\u4EA7\u54C1\u4E0E\u4F53\u9A8C\u8BBE\u8BA1","yeaft.vp.domain.softwareSystems":"\u8F6F\u4EF6\u4E0E\u7CFB\u7EDF","yeaft.vp.domain.securityReliability":"\u5B89\u5168\u4E0E\u53EF\u9760\u6027","yeaft.vp.domain.scienceAnalysis":"\u79D1\u5B66\u4E0E\u5206\u6790","yeaft.vp.domain.philosophyPsychology":"\u54F2\u5B66\u4E0E\u5FC3\u7406","yeaft.vp.domain.strategyHistory":"\u6218\u7565\u4E0E\u5386\u53F2","yeaft.vp.domain.businessManagement":"\u5546\u4E1A\u4E0E\u7BA1\u7406","yeaft.vp.domain.artsCulture":"\u827A\u672F\u4E0E\u6587\u5316","yeaft.vp.domain.other":"\u5176\u4ED6\u9886\u57DF","yeaft.vp.domain.custom":"\u81EA\u5B9A\u4E49 VP","yeaft.session.create.defaultVpHint":"\u5F53\u6CA1\u6709 @ \u63D0\u53CA\u65F6\u9ED8\u8BA4\u56DE\u7B54\u7684 VP\u3002","yeaft.session.create.folderLabel":"\u{1F4C1} \u5DE5\u4F5C\u76EE\u5F55","yeaft.session.create.sessionLabel":"\u{1F4AC} \u6B64\u76EE\u5F55\u4E0B\u7684 session","yeaft.session.create.noWorkDirs":"\u8FD8\u6CA1\u6709\u4EFB\u4F55\u4F1A\u8BDD \u2014 \u5728\u4E0A\u65B9\u9009\u62E9\u6216\u8F93\u5165\u5DE5\u4F5C\u76EE\u5F55\u5F00\u59CB\u3002","yeaft.session.create.back":"\u8FD4\u56DE","yeaft.session.create.creating":"\u521B\u5EFA\u4E2D\u2026","yeaft.session.create.submit":"\u521B\u5EFA","yeaft.onboarding.ariaLabel":"Yeaft \u4E0A\u624B\u8BF4\u660E","yeaft.onboarding.topbarTitle":"\u5F00\u59CB\u4F7F\u7528 Yeaft","yeaft.onboarding.eyebrow":"Yeaft \u4E0A\u624B\u6307\u5357","yeaft.onboarding.title":"\u5148\u8FDE\u63A5 Agent\uFF0C\u518D\u5F00\u59CB\u4F1A\u8BDD","yeaft.onboarding.subtitle":"\u5728\u8D1F\u8D23\u6267\u884C\u5DE5\u5177\u7684\u673A\u5668\u4E0A\u76F4\u63A5\u8FD0\u884C\u4E0B\u9762\u7684\u547D\u4EE4\u3002agent secret \u5982\u679C\u4E0D\u5B58\u5728\uFF0C\u4F1A\u81EA\u52A8\u4E3A\u5F53\u524D\u8D26\u53F7\u751F\u6210\u3002","yeaft.onboarding.createSession":"\u521B\u5EFA\u6216\u6062\u590D Session","yeaft.onboarding.configureLlm":"\u6253\u5F00 LLM \u8BBE\u7F6E","yeaft.onboarding.secretLoading":"\u6B63\u5728\u751F\u6210 agent secret\u2026","yeaft.onboarding.secretError":"\u52A0\u8F7D agent secret \u5931\u8D25\u3002","yeaft.onboarding.secretPending":"<\u6B63\u5728\u52A0\u8F7D-agent-secret>","yeaft.onboarding.installTitle":"\u5B89\u88C5 yeaft-agent","yeaft.onboarding.installDesc":"\u5B89\u88C5\u547D\u4EE4\u884C Agent \u5305\u3002","yeaft.onboarding.connectTitle":"\u8FDE\u63A5\u8FD9\u4E2A Agent","yeaft.onboarding.connectDesc":"\u4E0B\u9762\u7684\u547D\u4EE4\u5DF2\u7ECF\u5E26\u4E0A\u5F53\u524D server URL \u548C\u81EA\u52A8\u751F\u6210\u7684 secret\u3002","yeaft.onboarding.llmTitle":"\u4F7F\u7528 GitHub Copilot","yeaft.onboarding.llmDesc":"\u5148\u767B\u5F55 GitHub CLI\uFF0C\u7136\u540E\u628A gpt-5.5 \u8BBE\u4E3A Yeaft \u9ED8\u8BA4\u6A21\u578B\u3002","yeaft.restore.modal.empty":"\u6B64\u76EE\u5F55\u4E0B\u6CA1\u6709 yeaft session","yeaft.restore.modal.scanError":"\u626B\u63CF\u5931\u8D25: {message}","yeaft.restore.modal.restoreError":"\u6062\u590D\u5931\u8D25: {message}","settings.llm.noAgent":"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A Agent \u4EE5\u7BA1\u7406 LLM \u914D\u7F6E\u3002","settings.llm.agentOffline":"Agent \u5F53\u524D\u79BB\u7EBF\uFF0C\u65E0\u6CD5\u52A0\u8F7D LLM \u914D\u7F6E\u3002\u8BF7\u7B49\u5F85 Agent \u4E0A\u7EBF\u540E\u91CD\u8BD5\u3002","settings.llm.loading":"\u6B63\u5728\u52A0\u8F7D\u914D\u7F6E...","settings.llm.loadError":"\u52A0\u8F7D\u914D\u7F6E\u5931\u8D25","settings.llm.configureAgent":"\u914D\u7F6E\u5F53\u524D Agent \u7684 LLM","settings.llm.configureMenu":"\u8BBE\u7F6E LLM","settings.llm.simpleCopilotTitle":"\u63A8\u8350\uFF1AGitHub Copilot","settings.llm.useGitHubCopilot":"\u4F7F\u7528 GitHub Copilot","settings.llm.refreshingModels":"\u6B63\u5728\u5237\u65B0\u6A21\u578B...","settings.llm.managedCopilotTitle":"\u6258\u7BA1\u7684 GitHub Copilot","settings.llm.managedCopilotDesc":"Base URL\u3001\u8BA4\u8BC1\u3001\u6A21\u578B\u76EE\u5F55\u548C\u6BCF\u4E2A\u6A21\u578B\u7684 API \u534F\u8BAE\u90FD\u81EA\u52A8\u7BA1\u7406\u3002Claude \u6A21\u578B\u8D70 Anthropic Messages\uFF1BGPT/o \u6A21\u578B\u8D70 OpenAI Responses\u3002","settings.llm.providersTitle":"\u670D\u52A1\u5546","settings.llm.testFailed":"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25","settings.llm.saveSuccess":"LLM \u8BBE\u7F6E\u5DF2\u4FDD\u5B58","settings.llm.saveFailed":"\u4FDD\u5B58 LLM \u8BBE\u7F6E\u5931\u8D25","settings.llm.presets.title":"\u5FEB\u901F\u914D\u7F6E","settings.llm.providersDesc":"\u9009\u62E9\u4E00\u4E2A\u670D\u52A1\u5546\uFF0C\u4FDD\u5B58\u540E\u5373\u53EF\u5728 Session \u4E2D\u4F7F\u7528\u3002","settings.llm.agentProviders":"\u5F53\u524D agent providers","settings.llm.agentBadge":"\u5F53\u524D agent","settings.llm.addProvider":"\u6DFB\u52A0\u670D\u52A1\u5546","settings.llm.addFromPreset":"\u4ECE\u76EE\u5F55\u6DFB\u52A0","settings.llm.preset.title":"\u670D\u52A1\u5546\u76EE\u5F55\uFF08models.dev\uFF09","settings.llm.preset.refresh":"\u5237\u65B0\u76EE\u5F55","settings.llm.preset.loading":"\u52A0\u8F7D\u76EE\u5F55\u2026","settings.llm.preset.empty":"\u76EE\u5F55\u4E3A\u7A7A\u3002","settings.llm.preset.pickProvider":"\u5728\u5DE6\u4FA7\u9009\u62E9\u4E00\u4E2A\u670D\u52A1\u5546\u4EE5\u67E5\u770B\u6A21\u578B\u3002","settings.llm.preset.filterProviders":"\u8FC7\u6EE4\u670D\u52A1\u5546\u2026","settings.llm.preset.filterModels":"\u8FC7\u6EE4\u6A21\u578B\u2026","settings.llm.preset.selectAll":"\u5168\u9009","settings.llm.preset.selectNone":"\u6E05\u7A7A","settings.llm.preset.cancel":"\u53D6\u6D88","settings.llm.preset.add":"\u6DFB\u52A0\u5230\u670D\u52A1\u5546\u5217\u8868","settings.llm.preset.fetchedAt":"\u76EE\u5F55\u5DF2\u66F4\u65B0 {minutes} \u5206\u949F","settings.llm.addModel":"\u6DFB\u52A0\u6A21\u578B","settings.llm.removeModel":"\u79FB\u9664\u6A21\u578B","settings.llm.providerName":"\u540D\u79F0","settings.llm.providerNamePlaceholder":"\u4F8B\u5982 my-proxy","settings.llm.baseUrl":"Base URL","settings.llm.baseUrlPlaceholder":"\u4F8B\u5982 http://localhost:6628/v1","settings.llm.apiKey":"API Key","settings.llm.apiKeyPlaceholder":"\u8F93\u5165 API Key","settings.llm.protocol":"\u534F\u8BAE","settings.llm.protocolOpenAI":"OpenAI \u517C\u5BB9","settings.llm.protocolOpenAIResponses":"OpenAI Responses (GPT-5)","settings.llm.protocolAnthropic":"Anthropic \u539F\u751F","settings.llm.protocolHint.anthropic":"Claude \u539F\u751F Messages API\u3002","settings.llm.protocolHint.openai":"Chat Completions /v1/chat/completions \u2014 GPT-4 \u53CA\u5927\u591A\u6570\u517C\u5BB9\u4EE3\u7406\u3002","settings.llm.protocolHint.openaiResponses":"Responses API /v1/responses \u2014 GPT-5 \u7CFB\u5217\u5FC5\u987B\u3002","settings.llm.modelCtxPlaceholder":"\u4E0A\u4E0B\u6587","settings.llm.modelMaxPlaceholder":"\u8F93\u51FA","settings.llm.models":"\u5019\u9009\u6A21\u578B ID","settings.llm.modelsPlaceholder":"\u6A21\u578B ID\uFF0C\u9017\u53F7\u6216\u6362\u884C\u5206\u9694\uFF0C\u4F8B\u5982 claude-sonnet-4-20250514, gpt-5","settings.llm.modelsHint":"\u9017\u53F7\u6216\u6362\u884C\u5206\u9694\u3002","settings.llm.removeProvider":"\u79FB\u9664","settings.llm.modelSelectionTitle":"\u6A21\u578B\u9009\u62E9","settings.llm.modelSelectionDesc":"\u9009\u62E9\u9ED8\u8BA4\u6A21\u578B\u3002","settings.llm.primaryModel":"\u4E3B\u6A21\u578B","settings.llm.primaryModelDesc":"\u7528\u4E8E\u7528\u6237\u5BF9\u8BDD","settings.llm.fastModel":"\u5FEB\u901F\u6A21\u578B","settings.llm.fastModelDesc":"\u7528\u4E8E\u5185\u90E8\u4EFB\u52A1\uFF08\u8BB0\u5FC6\u3001\u603B\u7ED3\uFF09","settings.llm.noModels":"\u6682\u65E0\u53EF\u7528\u6A21\u578B\u3002\u8BF7\u5148\u6DFB\u52A0\u670D\u52A1\u5546\u3002","settings.llm.selectModel":"\u9009\u62E9\u6A21\u578B...","settings.llm.save":"\u4FDD\u5B58\u66F4\u6539","settings.llm.saving":"\u4FDD\u5B58\u4E2D...","settings.llm.saved":"\u914D\u7F6E\u5DF2\u4FDD\u5B58","settings.llm.savedRefreshWarning":"\u914D\u7F6E\u5DF2\u4FDD\u5B58\uFF0C\u4F46\u5B9E\u65F6\u6A21\u578B\u76EE\u5F55\u5237\u65B0\u5931\u8D25\uFF1A{error}","settings.llm.unsavedChanges":"\u6709\u672A\u4FDD\u5B58\u7684\u66F4\u6539","settings.llm.confirmRemoveProvider":"\u786E\u5B9A\u79FB\u9664\u6B64\u670D\u52A1\u5546\uFF1F","settings.llm.setupTitle":"\u8FDE\u63A5\u6A21\u578B","settings.llm.setupDesc":"\u63A8\u8350\u4F7F\u7528 GitHub Copilot\uFF1B\u4E5F\u53EF\u4EE5\u6DFB\u52A0\u81EA\u5DF1\u7684 API \u670D\u52A1\u5546\u3002","settings.llm.providerSectionHint":"\u53EA\u4FDD\u7559\u8FDE\u63A5\u6A21\u578B\u5FC5\u9700\u7684\u4FE1\u606F\u3002","settings.tabs.dashboard":"\u4EEA\u8868\u677F","settings.dashboard.totalUsers":"\u603B\u7528\u6237\u6570","settings.dashboard.onlineUsers":"\u5728\u7EBF\u7528\u6237","settings.dashboard.onlineAgents":"\u5728\u7EBFAgent","settings.dashboard.totalSessions":"\u603B\u4F1A\u8BDD\u6570","settings.dashboard.todayActive":"\u4ECA\u65E5\u6D3B\u8DC3","settings.dashboard.todayMessages":"\u4ECA\u65E5\u6D88\u606F","settings.dashboard.todayUserTurns":"\u4ECA\u65E5\u7528\u6237 Turn","settings.dashboard.totalTokens":"\u603B Token","settings.dashboard.tokenAccuracy":"\u6765\u81EA\u6A21\u578B\u670D\u52A1\u5546\u8FD4\u56DE\u7684\u5B9E\u9645\u7528\u91CF\uFF1B\u4ECE\u542F\u7528\u6309\u7528\u6237 Token \u7EDF\u8BA1\u7684\u7248\u672C\u5F00\u59CB\u7D2F\u8BA1\uFF0C\u4E14\u4E0D\u5305\u542B\u5FC3\u8DF3\u3002","settings.dashboard.agentTurns":"Agent Turn","settings.dashboard.agentSessions":"Agent Session","settings.dashboard.turns":"Turn","settings.dashboard.tokens":"Token","settings.dashboard.inputTokens":"\u8F93\u5165","settings.dashboard.outputTokens":"\u8F93\u51FA","settings.dashboard.cacheTokens":"\u7F13\u5B58","settings.dashboard.today":"\u4ECA\u5929","settings.dashboard.thisWeek":"\u672C\u5468","settings.dashboard.thisMonth":"\u672C\u6708","settings.dashboard.all":"\u5168\u90E8","settings.dashboard.userUsage":"\u7528\u6237\u7528\u91CF","settings.dashboard.agentList":"Agent \u5217\u8868","settings.dashboard.onlineUserList":"\u5728\u7EBF\u7528\u6237","settings.dashboard.refresh":"\u5237\u65B0","settings.dashboard.name":"\u540D\u79F0","settings.dashboard.messages":"\u6D88\u606F\u6570","settings.dashboard.userTurns":"\u7528\u6237 Turn \u6570","settings.dashboard.sessions":"\u4F1A\u8BDD\u6570","settings.dashboard.requests":"\u8BF7\u6C42\u6570","settings.dashboard.traffic":"\u6D41\u91CF","settings.dashboard.lastLogin":"\u6700\u540E\u767B\u5F55","settings.dashboard.status":"\u72B6\u6001","settings.dashboard.latency":"\u5EF6\u8FDF","settings.dashboard.version":"\u7248\u672C","settings.dashboard.owner":"\u6240\u6709\u8005","settings.dashboard.role":"\u89D2\u8272","settings.dashboard.agent":"Agent","settings.dashboard.online":"\u5728\u7EBF","settings.dashboard.offline":"\u79BB\u7EBF","settings.dashboard.noAgents":"\u6682\u65E0\u6CE8\u518C Agent","settings.dashboard.noUserData":"\u6682\u65E0\u7528\u6237\u6570\u636E","settings.dashboard.noOnlineUsers":"\u6682\u65E0\u5728\u7EBF\u7528\u6237","settings.dashboard.loading":"\u52A0\u8F7D\u4E2D...","settings.dashboard.error":"\u6570\u636E\u52A0\u8F7D\u5931\u8D25","settings.dashboard.ago":"{time}\u524D","settings.dashboard.loadMore":"\u52A0\u8F7D\u66F4\u591A\uFF08\u5269\u4F59 {remaining} \u6761\uFF09","workbench.maximize":"\u6700\u5927\u5316\u9762\u677F","workbench.restore":"\u8FD8\u539F\u9762\u677F","workbench.collapse":"\u6536\u8D77\u9762\u677F","theme.switchToLight":"\u5207\u6362\u5230\u6D45\u8272\u4E3B\u9898","theme.switchToDark":"\u5207\u6362\u5230\u6DF1\u8272\u4E3B\u9898","theme.toLight":"\u5207\u6362\u5230\u6D45\u8272\u4E3B\u9898","theme.toDark":"\u5207\u6362\u5230\u6DF1\u8272\u4E3B\u9898","terminal.splitH":"\u6C34\u5E73\u5206\u5C4F\uFF08\u5DE6\u53F3\uFF09","terminal.splitV":"\u5782\u76F4\u5206\u5C4F\uFF08\u4E0A\u4E0B\uFF09","terminal.close":"\u5173\u95ED\u5F53\u524D\u7EC8\u7AEF","terminal.autoCreate":"\u5207\u6362\u5230 Terminal \u6807\u7B7E\u65F6\u5C06\u81EA\u52A8\u521B\u5EFA\u7EC8\u7AEF","terminal.xtermError":"xterm.js \u672A\u52A0\u8F7D\uFF0C\u8BF7\u5237\u65B0\u9875\u9762","terminal.xtermNotLoaded":"xterm.js \u672A\u52A0\u8F7D\uFF0C\u8BF7\u5237\u65B0\u9875\u9762","terminal.mountError":"\u7EC8\u7AEF\u5BB9\u5668\u6302\u8F7D\u5931\u8D25","terminal.mountFailed":"\u7EC8\u7AEF\u5BB9\u5668\u6302\u8F7D\u5931\u8D25","terminal.createError":"\u7EC8\u7AEF\u521B\u5EFA\u5931\u8D25","terminal.createFailed":"\u7EC8\u7AEF\u521B\u5EFA\u5931\u8D25","terminal.error":"\u7EC8\u7AEF\u9519\u8BEF","git.selectFolder":"\u9009\u62E9\u6587\u4EF6\u5939","git.repoPath":"\u8F93\u5165 Git \u4ED3\u5E93\u8DEF\u5F84...","git.repoPathPlaceholder":"\u8F93\u5165 Git \u4ED3\u5E93\u8DEF\u5F84...","git.workDir":"Git \u5DE5\u4F5C\u76EE\u5F55","git.loadStatus":"\u52A0\u8F7D Git \u72B6\u6001","git.loading":"\u52A0\u8F7D Git \u72B6\u6001...","git.loadingStatus":"\u52A0\u8F7D Git \u72B6\u6001...","git.clean":"\u5DE5\u4F5C\u533A\u5E72\u51C0\uFF0C\u65E0\u53D8\u66F4","git.cleanWorkDir":"\u5DE5\u4F5C\u533A\u5E72\u51C0\uFF0C\u65E0\u53D8\u66F4","git.selectAgent":"\u9009\u62E9 Agent \u540E\u52A0\u8F7D Git \u72B6\u6001","git.selectAgentFirst":"\u9009\u62E9 Agent \u540E\u52A0\u8F7D Git \u72B6\u6001","git.diffOnly":"\u53EA\u770B\u5DEE\u5F02","git.fullFile":"\u770B\u5168\u6587","git.zoomIn":"\u653E\u5927\u5B57\u4F53","git.zoomOut":"\u7F29\u5C0F\u5B57\u4F53","git.loadingDiff":"\u52A0\u8F7D Diff...","git.clickToView":"\u70B9\u51FB\u6587\u4EF6\u67E5\u770B\u5DEE\u5F02","git.clickFileToView":"\u70B9\u51FB\u6587\u4EF6\u67E5\u770B\u5DEE\u5F02","git.selectRepo":"\u9009\u62E9 Git \u4ED3\u5E93","git.noDiff":"(\u65E0\u5DEE\u5F02)","git.binaryFile":"(\u4E8C\u8FDB\u5236\u6587\u4EF6)","files.notLoaded":"\u672A\u52A0\u8F7D","files.newFile":"\u65B0\u5EFA\u6587\u4EF6","files.newFolder":"\u65B0\u5EFA\u6587\u4EF6\u5939","files.collapseAll":"\u6298\u53E0\u6240\u6709","files.openFolder":"\u6253\u5F00\u6587\u4EF6\u5939","files.deleteSelected":"\u5220\u9664\u9009\u4E2D","files.moveSelected":"\u79FB\u52A8\u9009\u4E2D","files.enterPath":"\u8F93\u5165\u8DEF\u5F84...","files.searchFiles":"\u641C\u7D22\u6587\u4EF6... (Ctrl+P)","files.noMatch":"\u65E0\u5339\u914D\u7ED3\u679C","files.searching":"\u641C\u7D22\u4E2D...","files.loadingTree":"\u52A0\u8F7D\u4E2D...","files.emptyDir":"\u7A7A\u76EE\u5F55","files.loadingFile":"\u52A0\u8F7D\u6587\u4EF6...","files.searchPlaceholder":"\u641C\u7D22...","files.replacePlaceholder":"\u66FF\u6362...","files.replace":"\u66FF\u6362","files.replaceAll":"\u5168\u90E8","files.replaceCurrent":"\u66FF\u6362\u5F53\u524D","files.replaceAllTitle":"\u5168\u90E8\u66FF\u6362","files.clickToView":"\u70B9\u51FB\u6587\u4EF6\u67E5\u770B\u5185\u5BB9","files.selectFolder":"\u9009\u62E9\u6587\u4EF6\u5939","files.enterFolderName":"\u8F93\u5165\u6587\u4EF6\u5939\u540D...","files.enterFileName":"\u8F93\u5165\u6587\u4EF6\u540D...","files.moveTarget":"\u8F93\u5165\u76EE\u6807\u76EE\u5F55\u8DEF\u5F84...","files.moveItems":"\u5C06 {count} \u4E2A\u9879\u76EE\u79FB\u52A8\u5230\u6307\u5B9A\u76EE\u5F55","files.workDir":"\u5DE5\u4F5C\u76EE\u5F55: {dir}","files.enterDirPath":"\u8F93\u5165\u76EE\u5F55\u8DEF\u5F84...","files.unsavedConfirm":'"{name}" \u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539\uFF0C\u786E\u5B9A\u5173\u95ED\uFF1F',"files.deleteConfirm":'\u786E\u5B9A\u8981\u5220\u9664 "{name}" \u5417\uFF1F',"files.deleteDirHint":"\uFF08\u5C06\u5220\u9664\u6587\u4EF6\u5939\u53CA\u5176\u6240\u6709\u5185\u5BB9\uFF09","files.deleteSelectedConfirm":"\u786E\u5B9A\u8981\u5220\u9664\u9009\u4E2D\u7684 {count} \u4E2A\u9879\u76EE\u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002","files.findPrev":"\u4E0A\u4E00\u4E2A (Shift+Enter)","files.findNext":"\u4E0B\u4E00\u4E2A (Enter)","files.caseSensitive":"\u533A\u5206\u5927\u5C0F\u5199","files.regex":"\u6B63\u5219\u8868\u8FBE\u5F0F","files.unsaved":"\u672A\u4FDD\u5B58","files.clearSelection":"\u6E05\u9664\u9009\u62E9","files.rename":"\u91CD\u547D\u540D","files.copyHere":"\u590D\u5236","files.moveTo":"\u79FB\u52A8\u5230...","files.download":"\u4E0B\u8F7D","files.enterNewName":"\u8F93\u5165\u65B0\u540D\u79F0...","files.loadingPreview":"\u52A0\u8F7D\u9884\u89C8\u4E2D...","files.preview":"\u9884\u89C8","files.edit":"\u7F16\u8F91","files.pptxNotSupported":"PPTX \u672C\u5730\u9884\u89C8\u6682\u4E0D\u652F\u6301\uFF0C\u8BF7\u5728\u8BBE\u7F6E\u4E2D\u5207\u6362\u4E3A Office Online \u6A21\u5F0F\u3002","files.officePreviewMode":"Office \u9884\u89C8\u6A21\u5F0F","files.officeOnline":"Office Online","files.localRender":"\u672C\u5730\u6E32\u67D3","proxy.port":"\u7AEF\u53E3","proxy.label":"\u6807\u7B7E","proxy.add":"\u6DFB\u52A0\u7AEF\u53E3\u6620\u5C04","proxy.addPort":"\u6DFB\u52A0\u7AEF\u53E3\u6620\u5C04","proxy.enable":"\u70B9\u51FB\u542F\u7528","proxy.clickEnable":"\u70B9\u51FB\u542F\u7528","proxy.disable":"\u70B9\u51FB\u7981\u7528","proxy.clickDisable":"\u70B9\u51FB\u7981\u7528","proxy.openNewTab":"\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00","proxy.openInBrowser":"\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00","proxy.noMappings":"\u6682\u65E0\u7AEF\u53E3\u6620\u5C04","proxy.noPorts":"\u6682\u65E0\u7AEF\u53E3\u6620\u5C04","proxy.hint":"\u6DFB\u52A0\u7AEF\u53E3\u540E\uFF0C\u53EF\u901A\u8FC7\u4EE3\u7406 URL \u8BBF\u95EE agent \u673A\u5668\u4E0A\u7684\u672C\u5730\u670D\u52A1","proxy.noPortsHint":"\u6DFB\u52A0\u7AEF\u53E3\u540E\uFF0C\u53EF\u901A\u8FC7\u4EE3\u7406 URL \u8BBF\u95EE agent \u673A\u5668\u4E0A\u7684\u672C\u5730\u670D\u52A1","proxy.selectAgent":"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A Agent","store.selectAgent":"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A Agent","store.creatingConv":"\u6B63\u5728\u521B\u5EFA\u4F1A\u8BDD...","store.loadingHistory":"\u6B63\u5728\u52A0\u8F7D\u4F1A\u8BDD\u5386\u53F2...","store.executionCancelled":"\u6267\u884C\u5DF2\u53D6\u6D88","store.loginFailed":"\u767B\u5F55\u5931\u8D25","store.convClosed":"\u4F1A\u8BDD\u5DF2\u5173\u95ED","store.convCreated":"\u65B0\u4F1A\u8BDD\u5DF2\u521B\u5EFA [{agent}]\uFF0C\u5DE5\u4F5C\u76EE\u5F55: {workDir}","store.convResumed":"\u5DF2\u6062\u590D\u4F1A\u8BDD [{agent}]: {sessionId}","roleplay.creating":"\u6B63\u5728\u521B\u5EFA \u89D2\u8272\u626E\u6F14 \u4F1A\u8BDD...","roleplay.working":"\u5DE5\u4F5C\u4E2D","roleplay.selectTeam":"\u9009\u62E9\u56E2\u961F\u6A21\u677F","roleplay.teamDev":"\u8F6F\u4EF6\u5F00\u53D1","roleplay.teamCustom":"\u81EA\u5B9A\u4E49","roleplay.editRoles":"\u7F16\u8F91\u89D2\u8272","roleplay.roleName":"\u89D2\u8272\u6807\u8BC6","roleplay.roleDisplayName":"\u663E\u793A\u540D\u79F0","roleplay.roleIcon":"\u56FE\u6807","roleplay.roleDesc":"\u89D2\u8272\u63CF\u8FF0","roleplay.rolePrompt":"\u89D2\u8272 Prompt","roleplay.removeRole":"\u79FB\u9664\u89D2\u8272","roleplay.addRole":"\u6DFB\u52A0\u89D2\u8272","roleplay.start":"\u542F\u52A8 \u89D2\u8272\u626E\u6F14","roleplay.sidebarTitle":"\u89D2\u8272\u626E\u6F14","roleplay.configTitle":"\u89D2\u8272\u626E\u6F14","roleplay.newSession":"\u65B0\u5EFA \u89D2\u8272\u626E\u6F14","roleplay.emptyHint":"\u53D1\u9001\u6D88\u606F\u5F00\u59CB\u591A\u89D2\u8272\u534F\u4F5C","roleplay.askingYou":"\u6B63\u5728\u63D0\u95EE","roleplay.language":"\u8BED\u8A00","roleplay.rolePreview":"\u89D2\u8272\u914D\u7F6E","roleplay.noAgents":"\u6CA1\u6709\u5728\u7EBF\u7684 Agent","roleplay.inputPlaceholder":"\u8F93\u5165\u6D88\u606F\u2026 \u4F7F\u7528 @ \u63D0\u53CA\u89D2\u8272","roleplay.existingSessions":"\u5DF2\u6709\u56E2\u961F","roleplay.restore":"\u6062\u590D","roleplay.restoring":"\u6B63\u5728\u6062\u590D \u89D2\u8272\u626E\u6F14 \u4F1A\u8BDD...","roleplay.createNew":"\u521B\u5EFA\u65B0\u56E2\u961F","expertPanel.title":"\u5E2E\u5E2E\u56E2","expertPanel.search":"\u641C\u7D22\u89D2\u8272\u6216 Action...","expertPanel.noResults":"\u6CA1\u6709\u5339\u914D\u7ED3\u679C","expertPanel.clearAll":"\u6E05\u7A7A","expertPanel.persona":"\u89D2\u8272\u4EBA\u8BBE","expertPanel.template":"\u6709\u8F93\u5165\u65F6 \xB7 \u6D88\u606F\u524D\u7F00","expertPanel.templateHint":"\u7528\u6237\u5199\u4E86\u6587\u5B57\u65F6\uFF1A\u6B64\u524D\u7F00 + \u7528\u6237\u6587\u5B57 = \u6700\u7EC8\u53D1\u9001\u5185\u5BB9","expertPanel.defaultMsg":"\u65E0\u8F93\u5165\u65F6 \xB7 \u5B8C\u6574 Prompt","expertPanel.defaultMsgHint":"\u7528\u6237\u4E0D\u5199\u6587\u5B57\u76F4\u63A5\u53D1\u9001\u65F6\uFF0C\u4F7F\u7528\u6B64\u5B8C\u6574 prompt","expertPanel.loading":"\u6B63\u5728\u52A0\u8F7D\u89D2\u8272\u5B9A\u4E49...","expertPanel.viewPrompt":"\u67E5\u770B\u63D0\u793A\u8BCD","expertPanel.customRoles":"\u81EA\u5B9A\u4E49\u89D2\u8272","expertPanel.addRole":"\u6DFB\u52A0\u89D2\u8272","expertPanel.editRole":"\u7F16\u8F91\u89D2\u8272","expertPanel.deleteRole":"\u5220\u9664\u89D2\u8272","expertPanel.noCustomRoles":"\u6682\u65E0\u81EA\u5B9A\u4E49\u89D2\u8272","expertPanel.createFirst":"\u521B\u5EFA\u7B2C\u4E00\u4E2A\u81EA\u5B9A\u4E49\u89D2\u8272","expertPanel.noActions":"\u6682\u65E0 Action","expertPanel.deleteConfirm":'\u786E\u5B9A\u8981\u5220\u9664\u89D2\u8272 "{name}" \u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002',"expertPanel.deleteConfirmBtn":"\u5220\u9664","expertEditor.createTitle":"\u521B\u5EFA\u81EA\u5B9A\u4E49\u89D2\u8272","expertEditor.editTitle":"\u7F16\u8F91\u81EA\u5B9A\u4E49\u89D2\u8272","expertEditor.basicInfo":"\u57FA\u672C\u4FE1\u606F","expertEditor.roleName":"\u89D2\u8272\u540D\u79F0","expertEditor.roleNamePlaceholder":"\u5982\uFF1A\u6570\u636E\u5206\u6790\u5E08","expertEditor.roleTitle":"\u804C\u79F0","expertEditor.roleTitlePlaceholder":"\u5982\uFF1A\u9AD8\u7EA7\u6570\u636E\u5206\u6790\u5E08","expertEditor.fullName":"\u5168\u540D","expertEditor.fullNamePlaceholder":"\u53EF\u9009","expertEditor.titleEn":"\u82F1\u6587\u804C\u79F0","expertEditor.titleEnPlaceholder":"\u53EF\u9009","expertEditor.rolePrompt":"\u89D2\u8272 Prompt","expertEditor.messagePrefix":"\u6D88\u606F\u524D\u7F00\uFF08\u4E2D\u6587\uFF09","expertEditor.messagePrefixPlaceholder":"\u5982\uFF1A\u4F5C\u4E3A\u4E00\u540D\u8D44\u6DF1\u6570\u636E\u5206\u6790\u5E08\uFF0C","expertEditor.messagePrefixEn":"\u6D88\u606F\u524D\u7F00\uFF08\u82F1\u6587\uFF09","expertEditor.messagePrefixEnPlaceholder":"As a senior data analyst, ","expertEditor.actions":"Actions","expertEditor.addAction":"\u6DFB\u52A0 Action","expertEditor.removeAction":"\u79FB\u9664","expertEditor.actionName":"Action \u540D\u79F0","expertEditor.actionNamePlaceholder":"\u5982\uFF1A\u6570\u636E\u5206\u6790","expertEditor.actionNameEn":"\u82F1\u6587\u540D\u79F0","expertEditor.actionNameEnPlaceholder":"\u53EF\u9009","expertEditor.messageTemplate":"\u6709\u8F93\u5165\u65F6 \xB7 \u6D88\u606F\u524D\u7F00\uFF08\u4E2D\u6587\uFF09","expertEditor.messageTemplatePlaceholder":"\u7528\u6237\u5199\u4E86\u6587\u5B57\u65F6\uFF0C\u62FC\u5728\u7528\u6237\u6587\u5B57\u524D\u9762\u53D1\u9001","expertEditor.messageTemplateEn":"\u6709\u8F93\u5165\u65F6 \xB7 \u6D88\u606F\u524D\u7F00\uFF08\u82F1\u6587\uFF09","expertEditor.messageTemplateEnPlaceholder":"Prepended to user text when user types something","expertEditor.defaultMessage":"\u65E0\u8F93\u5165\u65F6 \xB7 \u5B8C\u6574 Prompt\uFF08\u4E2D\u6587\uFF09","expertEditor.defaultMessagePlaceholder":"\u7528\u6237\u4E0D\u5199\u6587\u5B57\u76F4\u63A5\u53D1\u9001\u65F6\uFF0C\u4F7F\u7528\u6B64\u5B8C\u6574\u5185\u5BB9","expertEditor.defaultMessageEn":"\u65E0\u8F93\u5165\u65F6 \xB7 \u5B8C\u6574 Prompt\uFF08\u82F1\u6587\uFF09","expertEditor.defaultMessageEnPlaceholder":"Used as-is when user sends without typing","expertEditor.cancel":"\u53D6\u6D88","expertEditor.save":"\u4FDD\u5B58","expertEditor.saving":"\u4FDD\u5B58\u4E2D...","subAgentPanel.title":"\u5B50\u4EE3\u7406","subAgentPanel.back":"\u8FD4\u56DE\u5217\u8868","subAgentPanel.running":"\u8FD0\u884C\u4E2D","subAgentPanel.completed":"\u5DF2\u5B8C\u6210","subAgentPanel.waitingMessages":"\u7B49\u5F85\u6D88\u606F...","subAgentPanel.toolCount":"{count} \u4E2A\u5DE5\u5177","subAgentPanel.toolSummary":"\u5DF2\u5B8C\u6210 {count} \u6B21\u5DE5\u5177\u8C03\u7528","subAgentPanel.empty":"\u6682\u65E0\u5B50\u4EE3\u7406","subAgentPanel.emptyHint":"\u5F53 Claude \u59D4\u6D3E\u4EFB\u52A1\u65F6\uFF0C\u5B50\u4EE3\u7406\u4F1A\u5728\u8FD9\u91CC\u663E\u793A","splitScreen.split":"\u5206\u5C4F","splitScreen.closePane":"\u5173\u95ED\u6B64\u9762\u677F","splitScreen.newChat":"\u65B0\u5EFA Chat","splitScreen.noSessions":"\u6682\u65E0\u4F1A\u8BDD","splitScreen.splitToPanel":"\u5728\u65B0\u9762\u677F\u4E2D\u6253\u5F00","splitScreen.selectFromSidebar":"\u4ECE\u5DE6\u4FA7\u9009\u62E9\u5BF9\u8BDD","yeaft.vp.library":"\u89D2\u8272\u5E93","yeaft.vp.createFirst":"+ \u521B\u5EFA\u4F60\u7684\u7B2C\u4E00\u4E2A\u89D2\u8272","yeaft.vp.empty.aria":"\u5C1A\u65E0\u89D2\u8272","yeaft.vp.avatar.aria":"{name} \u5934\u50CF","yeaft.vp.speaker.stateCauseAria":"\u72B6\u6001\u53D8\u66F4\uFF1A{cause}","yeaft.vp.status.thinking":"\u6B63\u5728\u601D\u8003\u2026","yeaft.vp.status.tool":"\u6B63\u5728\u4F7F\u7528 {name}","yeaft.vp.status.done":"\u5B8C\u6210 \xB7 {count} \u4E2A\u5DE5\u5177","yeaft.vp.status.aborted":"\u5DF2\u4E2D\u6B62","yeaft.vp.crud.title":"\u89D2\u8272\u5E93","yeaft.vp.crud.close":"\u5173\u95ED","yeaft.vp.crud.addNew":"+ \u65B0\u5EFA\u89D2\u8272","yeaft.vp.crud.empty":"\u8FD8\u6CA1\u6709\u89D2\u8272\u3002\u521B\u5EFA\u7B2C\u4E00\u4E2A\u89D2\u8272\u5F00\u59CB\u534F\u4F5C\u5427\u3002","yeaft.vp.crud.edit":"\u7F16\u8F91","yeaft.vp.crud.delete":"\u5220\u9664","yeaft.vp.crud.deleteConfirm":'\u5220\u9664 "{name}"\uFF1F\u4F1A\u4E00\u5E76\u5220\u9664\u78C1\u76D8\u4E0A\u7684 role.md \u6587\u4EF6\u3002',"yeaft.vp.crud.form.create":"\u521B\u5EFA\u89D2\u8272","yeaft.vp.crud.form.update":"\u7F16\u8F91\u89D2\u8272","yeaft.vp.crud.form.vpId":"\u89D2\u8272 ID","yeaft.vp.crud.form.vpId.tooltip":"\u53EA\u80FD\u7528\u5B57\u6BCD\u3001\u6570\u5B57\u3001- \u548C _\uFF0C\u4E0D\u80FD\u4EE5 _ \u5F00\u5934\uFF0C\u4E0D\u80FD\u662F\u7EAF\u6570\u5B57\uFF0C\u4E0D\u80FD\u7528\u4FDD\u7559\u540D\uFF1Aall / user / system / everyone\u3002","yeaft.vp.crud.form.displayName":"\u663E\u793A\u540D\uFF08\u82F1\u6587\uFF09","yeaft.vp.crud.form.displayNameZh":"\u663E\u793A\u540D\uFF08\u4E2D\u6587\uFF09","yeaft.vp.crud.form.description":"\u80FD\u529B\u63CF\u8FF0\uFF08\u82F1\u6587\uFF09","yeaft.vp.crud.form.descriptionZh":"\u80FD\u529B\u63CF\u8FF0\uFF08\u4E2D\u6587\uFF09","yeaft.vp.crud.form.descriptionPlaceholder":"\u4F8B\u5982\uFF1AAPI design, migration planning, and compatibility reviews","yeaft.vp.crud.form.descriptionZhPlaceholder":"\u4F8B\u5982\uFF1AAPI \u8BBE\u8BA1\u3001\u8FC1\u79FB\u89C4\u5212\u4E0E\u517C\u5BB9\u6027\u8BC4\u5BA1","yeaft.vp.crud.form.role":"\u804C\u4F4D","yeaft.vp.crud.form.rolePlaceholder":"\u4F8B\u5982\uFF1A\u4EA7\u54C1\u7ECF\u7406","yeaft.vp.crud.form.traits":"\u7279\u8D28\u6807\u7B7E","yeaft.vp.crud.form.traitsHint":"\u7528\u82F1\u6587\u9017\u53F7\u5206\u9694\u7684\u77ED\u6807\u7B7E\uFF08\u4F8B\u5982\uFF1A\u597D\u5947, \u52A1\u5B9E\uFF09\u3002","yeaft.vp.crud.form.modelHint":"\u6A21\u578B\u504F\u597D","yeaft.vp.crud.form.modelHint.none":"\u2014 \u9ED8\u8BA4 \u2014","yeaft.vp.crud.form.modelHint.primary":"\u4E3B\u6A21\u578B","yeaft.vp.crud.form.modelHint.fast":"\u5FEB\u6A21\u578B","yeaft.vp.crud.form.persona":"\u4EBA\u8BBE\uFF08Markdown\uFF09","yeaft.vp.crud.form.personaPlaceholder":"\u63CF\u8FF0\u8FD9\u4E2A\u89D2\u8272\u5982\u4F55\u601D\u8003\u3001\u8868\u8FBE\u3001\u505A\u51B3\u7B56\u2026\u2026","yeaft.vp.crud.form.submit":"\u4FDD\u5B58","yeaft.vp.crud.form.cancel":"\u53D6\u6D88","yeaft.vp.crud.form.ok":"\u683C\u5F0F\u6B63\u786E","yeaft.vp.crud.form.idLocked":"\u521B\u5EFA\u540E\u89D2\u8272 ID \u4E0D\u53EF\u4FEE\u6539\u3002","yeaft.vp.crud.saving":"\u4FDD\u5B58\u4E2D\u2026\u2026","yeaft.vp.crud.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}","yeaft.vp.crud.deleteFailed":"\u5220\u9664\u5931\u8D25\uFF1A{error}","yeaft.vp.crud.viewPrompt":"\u67E5\u770B prompt","yeaft.vp.crud.view.title":"VP \u63D0\u793A\u8BCD","yeaft.vp.crud.view.personaEmpty":"\uFF08\u672A\u5B9A\u4E49 persona \u6B63\u6587\uFF0C\u53EA\u6709\u57FA\u7840\u5143\u6570\u636E\uFF09","yeaft.vp.crud.view.back":"\u8FD4\u56DE","yeaft.vp.crud.view.editFromHere":"\u7F16\u8F91\u8BE5 VP","yeaft.vp.crud.view.removed":"\u8BE5 VP \u5DF2\u5728\u522B\u5904\u88AB\u5220\u9664\uFF0C\u8FD4\u56DE\u5217\u8868\u3002","yeaft.vp.crud.stockBadge":"\u9884\u88C5","yeaft.vp.crud.stockReadOnly":"\u9884\u88C5 VP \u968F agent \u51FA\u5382\uFF0C\u4E0D\u80FD\u7F16\u8F91\u6216\u5220\u9664\u3002","yeaft.vp.idError.empty_or_non_string":"\u89D2\u8272 ID \u4E0D\u80FD\u4E3A\u7A7A\u3002","yeaft.vp.idError.too_long":"\u89D2\u8272 ID \u592A\u957F\uFF08\u6700\u591A 40 \u5B57\u7B26\uFF09\u3002","yeaft.vp.idError.illegal_character":'\u53EA\u80FD\u4F7F\u7528\u5B57\u6BCD\u3001\u6570\u5B57\u3001"-" \u548C "_"\u3002',"yeaft.vp.idError.underscore_prefix_reserved":'\u89D2\u8272 ID \u4E0D\u80FD\u4EE5 "_" \u5F00\u5934\uFF08\u9884\u7559\u7ED9\u7CFB\u7EDF\u89D2\u8272\uFF09\u3002',"yeaft.vp.idError.pure_digits":"\u89D2\u8272 ID \u4E0D\u80FD\u662F\u7EAF\u6570\u5B57\u3002","yeaft.vp.idError.reserved":"\u89D2\u8272 ID \u4E0D\u80FD\u7528\u4FDD\u7559\u540D\uFF08all / user / system / everyone\uFF09\u3002","yeaft.vp.idError.duplicate":"\u5DF2\u7ECF\u5B58\u5728\u540C ID \u7684\u89D2\u8272\u3002","yeaft.vp.idError.not_found":"\u8BE5 VP \u4E0D\u5B58\u5728\uFF0C\u53EF\u80FD\u5DF2\u88AB\u5220\u9664\u3002","yeaft.vp.idError.stock_readonly":"\u9884\u88C5 VP \u4E0D\u80FD\u7F16\u8F91\u6216\u5220\u9664\u3002","yeaft.vp.idError.unknown":"\u53D1\u751F\u672A\u77E5\u9519\u8BEF\uFF0C\u8BF7\u91CD\u8BD5\u3002","yeaft.vp.reason.personaEdit":"\u4EBA\u8BBE\u5DF2\u66F4\u65B0","yeaft.vp.reason.traitsEdit":"\u7279\u5F81\u5DF2\u66F4\u65B0","yeaft.vp.reason.manualReload":"\u5DF2\u91CD\u65B0\u8F7D\u5165","yeaft.vp.reason.fileRemoved":"\u5DF2\u79FB\u9664","yeaft.vp.reason.toast.updated":"{name}\uFF1A{reason}","yeaft.vp.reason.toast.removed":"{name} \u5DF2\u88AB\u79FB\u9664","yeaft.message.timeAria":"\u53D1\u9001\u4E8E {time}","yeaft.user.youLabel":"\u6211","yeaft.session.sidebarTitle":"\u4F1A\u8BDD","yeaft.session.sidebarAria":"\u4F1A\u8BDD\u5217\u8868","yeaft.session.newButton":"+ \u65B0\u5EFA\u4F1A\u8BDD","yeaft.session.newButtonAria":"\u521B\u5EFA\u65B0\u4F1A\u8BDD","yeaft.session.empty":"\u6682\u65E0\u4F1A\u8BDD\u3002","yeaft.session.membersCount":"{count} \u4F4D\u6210\u5458","yeaft.session.oneMember":"1 \u4F4D\u6210\u5458","yeaft.session.noMembers":"\u7A7A\u4F1A\u8BDD \u2014 \u8BF7\u9080\u8BF7 VP","yeaft.session.defaultBadge":"\u9ED8\u8BA4","yeaft.session.defaultName":"\u9ED8\u8BA4\u4F1A\u8BDD","yeaft.session.moreActions":"\u66F4\u591A\u64CD\u4F5C","yeaft.session.archive":"\u5F52\u6863","yeaft.session.archiveConfirm":"\u5F52\u6863\u300C{name}\u300D\uFF1F\u7A0D\u540E\u53EF\u4ECE\u78C1\u76D8\u6062\u590D\u3002","yeaft.session.archivingEllipsis":"\u5F52\u6863\u4E2D\u2026","yeaft.session.delete":"\u5220\u9664","yeaft.session.deleteConfirm":"\u5220\u9664\u300C{name}\u300D\uFF1F\u5C06\u6C38\u4E45\u5220\u9664\u8BE5\u4F1A\u8BDD\u53CA\u5176\u6240\u6709\u6570\u636E\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002","yeaft.session.deletingEllipsis":"\u5220\u9664\u4E2D\u2026","yeaft.session.rename":"\u91CD\u547D\u540D","yeaft.session.openSettings":"\u8BBE\u7F6E","yeaft.session.removeFromList":"\u79FB\u9664","yeaft.session.manageMembers":"\u7BA1\u7406\u6210\u5458","yeaft.session.memberCount.one":"1 \u4F4D\u6210\u5458","yeaft.session.memberCount.other":"{count} \u4F4D\u6210\u5458","yeaft.session.renamePrompt":"\u4E3A\u300C{name}\u300D\u8F93\u5165\u65B0\u540D\u79F0\uFF1A","yeaft.session.renamingEllipsis":"\u91CD\u547D\u540D\u4E2D\u2026","yeaft.session.editModal.renameTitle":"\u91CD\u547D\u540D\u4F1A\u8BDD","yeaft.session.editModal.renameBody":"\u4E3A\u300C{name}\u300D\u9009\u62E9\u4E00\u4E2A\u65B0\u540D\u79F0\u3002","yeaft.session.editModal.renameSubmit":"\u4FDD\u5B58","yeaft.session.editModal.archiveTitle":"\u5F52\u6863\u4F1A\u8BDD","yeaft.session.editModal.archiveBody":"\u5F52\u6863\u300C{name}\u300D\uFF1F\u7A0D\u540E\u53EF\u4ECE\u78C1\u76D8\u6062\u590D\u3002","yeaft.session.editModal.archiveSubmit":"\u5F52\u6863","yeaft.session.editModal.deleteTitle":"\u5220\u9664\u4F1A\u8BDD","yeaft.session.editModal.deleteBody":"\u5220\u9664\u300C{name}\u300D\uFF1F\u5C06\u6C38\u4E45\u5220\u9664\u8BE5\u4F1A\u8BDD\u53CA\u5176\u6240\u6709\u6570\u636E\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002","yeaft.session.editModal.deleteSubmit":"\u5220\u9664","yeaft.session.editModal.newNameLabel":"\u65B0\u540D\u79F0","yeaft.session.editModal.cancel":"\u53D6\u6D88","yeaft.session.editModal.close":"\u5173\u95ED","yeaft.session.error.invalid_name":"\u4F1A\u8BDD\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A\u3002","yeaft.session.error.duplicate":"\u8BE5\u4F1A\u8BDD id \u5DF2\u5B58\u5728\u3002","yeaft.session.error.not_found":"\u672A\u627E\u5230\u8BE5\u4F1A\u8BDD\u3002","yeaft.session.error.default_not_in_roster":"\u9ED8\u8BA4 VP \u5FC5\u987B\u5728\u6210\u5458\u5217\u8868\u4E2D\u3002","yeaft.session.error.no_default_vp":"\u8BE5\u4F1A\u8BDD\u6CA1\u6709\u6210\u5458\uFF0C\u8BF7\u4ECE\u89D2\u8272\u5E93\u6DFB\u52A0 VP \u4EE5\u5F00\u59CB\u5BF9\u8BDD\u3002","yeaft.session.error.reserved":"\u6240\u9009 id \u4E2D\u5305\u542B\u4FDD\u7559\u540D\uFF08all / user / system / everyone\uFF09\u3002","yeaft.session.error.unknown":"\u4F1A\u8BDD\u64CD\u4F5C\u5931\u8D25\uFF1A{message}","yeaft.session.error.timeout":"\u4F1A\u8BDD\u64CD\u4F5C\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5\u3002","yeaft.session.invite.title":"\u9080\u8BF7 VP","yeaft.session.invite.body":"\u300C{name}\u300D\u5F53\u524D\u4E3A\u7A7A\uFF0C\u8BF7\u4ECE\u89D2\u8272\u5E93\u6DFB\u52A0\u4E00\u4F4D VP \u4EE5\u5F00\u59CB\u5BF9\u8BDD\u3002","yeaft.session.invite.openLibrary":"\u6253\u5F00\u89D2\u8272\u5E93","yeaft.session.invite.dismiss":"\u6682\u4E0D","yeaft.session.empty.title":"\u7A7A\u4F1A\u8BDD","yeaft.session.empty.hint":"\u300C{name}\u300D\u8FD8\u6CA1\u6709\u6210\u5458\u3002\u6DFB\u52A0\u4E00\u4F4D VP \u5373\u53EF\u5F00\u59CB\u5BF9\u8BDD\u3002","yeaft.session.empty.cta":"\u7BA1\u7406\u6210\u5458","yeaft.session.members.title":"\u7BA1\u7406\u300C{name}\u300D\u7684\u6210\u5458","yeaft.session.members.aria":"\u6210\u5458\u7BA1\u7406","yeaft.session.members.close":"\u5173\u95ED","yeaft.session.members.done":"\u5B8C\u6210","yeaft.session.members.empty":"\u6682\u65E0\u53EF\u7528 VP \u2014 \u8BF7\u5148\u5230\u89D2\u8272\u5E93\u521B\u5EFA\u3002","yeaft.session.members.loading":"VP \u52A0\u8F7D\u4E2D\u2026","yeaft.session.members.defaultHint":"\u9ED8\u8BA4 VP\uFF08@\u63D0\u53CA\u7F3A\u7701\u65F6\u7531\u8BE5 VP \u5E94\u7B54\uFF09","yeaft.session.members.memberCount":"\u5DF2\u9009 {count} \u4F4D","yeaft.session.members.actionFailed":"\u64CD\u4F5C\u5931\u8D25\uFF1A{error}","yeaft.session.members.openLibrary":"\u6253\u5F00 VP \u5E93","yeaft.session.members.openLibraryHint":"\u5728 VP \u5E93\u53EF\u521B\u5EFA\u65B0 VP \u6216\u67E5\u770B VP \u7684 prompt\u3002","yeaft.session.announcement.label":"\u4F1A\u8BDD\u516C\u544A","yeaft.session.announcement.hintEmpty":"\u6682\u65E0\u516C\u544A \u2014 \u70B9\u51FB \u270F\uFE0F \u6DFB\u52A0\u3002","yeaft.session.announcement.emptyBody":"\u672A\u8BBE\u7F6E\u4F1A\u8BDD\u516C\u544A\u3002\u53EF\u4EE5\u5728\u8FD9\u91CC\u5199\u4E00\u6BB5\u7B80\u4ECB\uFF0C\u4F1A\u8BDD\u5185\u6240\u6709 VP \u5728\u6536\u5230\u6D88\u606F\u65F6\u90FD\u4F1A\u5728 system prompt \u9876\u90E8\u770B\u5230 \u2014 \u9002\u5408\u5199\u5171\u540C\u80CC\u666F\u3001\u89C4\u5219\u3001\u6216 CLAUDE.md \u5F0F\u7684\u6307\u5F15\u3002","yeaft.session.announcement.placeholder":"\u4E3A\u8FD9\u4E2A\u4F1A\u8BDD\u91CC\u7684\u6240\u6709 VP \u5199\u4E00\u6BB5\u5171\u4EAB\u7684\u7B80\u4ECB\u2026","yeaft.session.announcement.edit":"\u7F16\u8F91\u516C\u544A","yeaft.session.announcement.editTitle":"\u7F16\u8F91\u4F1A\u8BDD\u516C\u544A","yeaft.session.announcement.saving":"\u4FDD\u5B58\u4E2D\u2026","yeaft.session.announcement.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}","yeaft.session.announcement.openSettings":"\u6253\u5F00\u4F1A\u8BDD\u8BBE\u7F6E","yeaft.session.settings.title":"{name} \u2014 \u4F1A\u8BDD\u8BBE\u7F6E","yeaft.session.settings.short":"\u4F1A\u8BDD","yeaft.session.settings.close":"\u5173\u95ED","yeaft.session.settings.nav.session":"\u4F1A\u8BDD","yeaft.session.settings.nav.members":"\u6210\u5458","yeaft.session.settings.nav.memory":"\u4F1A\u8BDD\u8BB0\u5FC6","yeaft.session.settings.announcement.heading":"\u4F1A\u8BDD\u516C\u544A","yeaft.session.settings.announcement.help":"\u6CE8\u5165\u5230\u4F1A\u8BDD\u5185\u6BCF\u4E2A VP \u7684 system prompt \u9876\u90E8 \u2014 \u7C7B\u4F3C\u56E2\u961F\u5171\u4EAB\u7684 CLAUDE.md\u3002","yeaft.session.settings.members.heading":"\u6210\u5458","yeaft.session.settings.rename.heading":"\u91CD\u547D\u540D\u4F1A\u8BDD","yeaft.session.settings.rename.label":"\u65B0\u540D\u79F0","yeaft.session.settings.rename.save":"\u4FDD\u5B58\u540D\u79F0","yeaft.session.settings.rename.saving":"\u4FDD\u5B58\u4E2D\u2026","yeaft.session.settings.memory.heading":"\u4F1A\u8BDD\u8BB0\u5FC6","yeaft.session.settings.memory.help":"\u7ACB\u5373\u8FD0\u884C dream \u6574\u7406\uFF1A\u8BFB\u53D6\u4E0A\u6B21\u4EE5\u6765\u7684\u65B0\u6D88\u606F\uFF0C\u63D0\u53D6\u8981\u70B9\u5E76\u5408\u5E76\u8FDB\u4F1A\u8BDD\u7684 summary\uFF0C\u8BA9 Resident \u5C42\u80FD\u53CD\u6620\u6700\u65B0\u7684\u5BF9\u8BDD\u3002","yeaft.session.settings.memory.runNow":"\u7ACB\u5373\u8FD0\u884C dream","yeaft.session.settings.memory.running":"\u8FD0\u884C\u4E2D\u2026","yeaft.session.settings.memory.lastSuccess":"\u4E0A\u6B21\u6210\u529F\uFF1A{time} \u2014 \u66F4\u65B0\u4E86 {count} \u4E2A\u76EE\u6807\u3002","yeaft.session.settings.memory.lastError":"\u4E0A\u6B21\u8FD0\u884C\u5931\u8D25\uFF1A{error}","yeaft.session.settings.danger.heading":"\u5220\u9664\u4F1A\u8BDD","yeaft.session.settings.danger.deleteHelp":"\u8FD9\u4F1A\u6C38\u4E45\u5220\u9664\u8BE5\u4F1A\u8BDD\uFF0C\u79FB\u9664\u78C1\u76D8\u4E0A\u7684 session.json \u548C\u5168\u90E8\u6D88\u606F\u5386\u53F2\uFF0C\u4E0D\u53EF\u6062\u590D\u3002","yeaft.session.settings.danger.deleteBtn":"\u5220\u9664\u4F1A\u8BDD","yeaft.vp.mention.placeholder":"\u6309 id \u6216\u540D\u79F0\u641C\u7D22\u89D2\u8272\u2026","yeaft.vp.mention.noMatch":"\u6CA1\u6709\u5339\u914D\u7684\u89D2\u8272","yeaft.vp.mention.count":"\u5DF2 @{count} \u4EBA","yeaft.feature.reject.missing_group_id":"\u53D1\u9001\u5931\u8D25\uFF1A\u672A\u6307\u5B9A\u4F1A\u8BDD\u3002","yeaft.feature.reject.missing_feature_id":"\u53D1\u9001\u5931\u8D25\uFF1A\u4EFB\u52A1\u4E0A\u4E0B\u6587\u4E22\u5931\u3002","yeaft.feature.reject.missing_vp_id":"\u53D1\u9001\u5931\u8D25\uFF1A\u672A\u8BBE\u7F6E\u53D1\u8A00\u8005\u3002","yeaft.feature.reject.invalid_vp_id":"\u53D1\u9001\u5931\u8D25\uFF1A\u53D1\u8A00\u8005 id \u975E\u6CD5\u3002","yeaft.feature.reject.empty_text":"\u53D1\u9001\u5931\u8D25\uFF1A\u5185\u5BB9\u4E3A\u7A7A\u3002","yeaft.feature.reject.text_too_long":"\u53D1\u9001\u5931\u8D25\uFF1A\u5185\u5BB9\u8FC7\u957F\uFF08\u4E0A\u9650 16 KiB\uFF09\u3002","yeaft.feature.reject.unknown":"\u53D1\u9001\u5931\u8D25\u3002","yeaft.feature.pill.label":"\u4EFB\u52A1","yeaft.feature.messageTime.aria":"\u53D1\u9001\u4E8E {time}","yeaft.vp.turnBlock.elapsedTitle":"\u672C\u8F6E turn \u5F00\u59CB\u81F3\u4ECA\u7684\u65F6\u95F4","yeaft.vp.turnBlock.retryingRequest":"\u54CD\u5E94\u505C\u6EDE\uFF0C\u6B63\u5728\u53D1\u8D77\u5168\u65B0\u8BF7\u6C42\uFF08{attempt}/{max}\uFF09","yeaft.vp.turnBlock.retryingContinue":"\u54CD\u5E94\u505C\u6EDE\uFF0C\u6B63\u5728\u7528\u5168\u65B0\u8BF7\u6C42\u7EED\u5199\uFF08{attempt}/{max}\uFF09","yeaft.sessionStatus.aria":"Session \u72B6\u6001","yeaft.sessionStatus.title":"Session \u72B6\u6001","yeaft.sessionStatus.announcement":"\u516C\u544A","yeaft.sessionStatus.announcementEmpty":"\u6682\u65E0\u516C\u544A","yeaft.sessionStatus.announcementAdd":"\u6DFB\u52A0\u516C\u544A","yeaft.sessionStatus.announcementEdit":"\u7F16\u8F91\u516C\u544A","yeaft.sessionStatus.vps":"VP","yeaft.sessionStatus.backgroundTasks":"\u540E\u53F0\u4EFB\u52A1","yeaft.sessionStatus.noLogPreview":"\u6682\u65E0\u65E5\u5FD7\u8F93\u51FA\u3002","yeaft.sessionStatus.task.subAgentStarted":"{name} \u5DF2\u542F\u52A8","yeaft.sessionStatus.task.subAgentStartedWithMission":"{name} \u5DF2\u542F\u52A8\uFF1A{mission}","yeaft.sessionStatus.task.subAgentStatus":"{name} \u72B6\u6001\uFF1A{status}","yeaft.sessionStatus.task.subAgentStatusUpdated":"{name} \u72B6\u6001\u5DF2\u66F4\u65B0","yeaft.sessionStatus.task.subAgentResult":"{name} \u7ED3\u679C\uFF1A{text}","yeaft.sessionStatus.task.subAgentProducedResult":"{name} \u5DF2\u4EA7\u751F\u7ED3\u679C","yeaft.sessionStatus.task.subAgentUsedTool":"{name} \u8C03\u7528\u4E86 {tool}","yeaft.sessionStatus.task.subAgentFinishedTool":"{name} \u5B8C\u6210\u4E86 {tool}","yeaft.sessionStatus.task.subAgentUsage":"{name} \u4F7F\u7528\u4E86 {tokens} tokens","yeaft.sessionStatus.task.subAgentEvent":"{name}\uFF1A{text}","yeaft.sessionStatus.task.subAgentUserPrompt":"\u4F60\uFF1A{text}","yeaft.sessionStatus.task.subAgentToolSummary":"\u5DF2\u5B8C\u6210 {count} \u6B21\u5DE5\u5177\u8C03\u7528","yeaft.sessionStatus.task.subAgentError":"{name} \u9519\u8BEF\uFF1A{error}","yeaft.sessionStatus.task.subAgentHitError":"{name} \u9047\u5230\u9519\u8BEF","yeaft.sessionStatus.task.subAgentNoReadableEvents":"\u6682\u65E0\u53EF\u8BFB\u7684 sub-agent \u6D3B\u52A8\u3002","yeaft.sessionStatus.task.promptPlaceholder":"\u7ED9\u8FD9\u4E2A sub-agent \u8FFD\u52A0\u60F3\u6CD5\u2026","yeaft.sessionStatus.task.promptSend":"\u53D1\u9001","yeaft.sessionStatus.task.promptSending":"\u53D1\u9001\u4E2D\u2026","yeaft.sessionStatus.task.promptFailed":"\u53D1\u9001\u5931\u8D25\u3002","yeaft.sessionStatus.task.title":"\u4EFB\u52A1","yeaft.sessionStatus.task.command":"\u547D\u4EE4","yeaft.sessionStatus.task.stop":"\u505C\u6B62\u4EFB\u52A1","yeaft.sessionStatus.task.stopping":"\u505C\u6B62\u4E2D\u2026","yeaft.sessionStatus.task.kind.subAgent":"sub-agent","yeaft.sessionStatus.task.kind.shell":"shell","yeaft.sessionStatus.show":"\u663E\u793A Session \u72B6\u6001","yeaft.sessionStatus.hide":"\u9690\u85CF Session \u72B6\u6001","yeaft.sessionStatus.close":"\u5173\u95ED Session \u72B6\u6001","yeaft.vpTimeline.empty":"\u672C Session \u8FD8\u6CA1\u6709 VP\u3002","yeaft.vpTimeline.resizeTitle":"\u62D6\u52A8\u8C03\u6574\u5BBD\u5EA6","yeaft.vpTimeline.status.idle":"\u7A7A\u95F2","yeaft.vpTimeline.status.typing":"\u8F93\u5165\u4E2D\u2026","yeaft.vpTimeline.status.thinking":"\u601D\u8003\u4E2D\u2026","yeaft.vpTimeline.status.retrying":"\u6B63\u5728\u91CD\u8BD5\u8BF7\u6C42\u2026","yeaft.vpTimeline.status.streaming":"\u751F\u6210\u4E2D","yeaft.vpTimeline.status.tool":"\u8C03\u7528\u5DE5\u5177\u4E2D\u2026","yeaft.vpTimeline.status.error":"\u51FA\u9519","yeaft.vpTimeline.status.offline":"\u79BB\u7EBF","yeaft.vpTimeline.abort":"\u4E2D\u6B62","yeaft.vpTimeline.edit":"\u7F16\u8F91 VP","yeaft.vpTimeline.mention":"\u70B9\u51FB @ \u8BE5 VP","yeaft.vpTimeline.expand":"\u5C55\u5F00\u4EFB\u52A1\u8BE6\u60C5","yeaft.toolStats.title":"\u5DE5\u5177\u4F7F\u7528\u7EDF\u8BA1","yeaft.toolStats.refresh":"\u5237\u65B0","yeaft.toolStats.close":"\u5173\u95ED","yeaft.toolStats.tabAll":"\u5168\u90E8\u5DE5\u5177","yeaft.toolStats.tabUnused":"\u672A\u4F7F\u7528","yeaft.toolStats.loading":"\u52A0\u8F7D\u4E2D\u2026","yeaft.toolStats.notLoaded":"\u6682\u65E0\u6570\u636E \u2014 \u70B9\u51FB\u5237\u65B0\u3002","yeaft.toolStats.empty":"\uFF08\u6682\u65E0\u5DE5\u5177\u8C03\u7528\u8BB0\u5F55\uFF09","yeaft.toolStats.noneUnused":"\uFF08\u6BCF\u4E2A\u5DF2\u6CE8\u518C\u5DE5\u5177\u90FD\u81F3\u5C11\u88AB\u8C03\u7528\u8FC7\u4E00\u6B21\uFF09","yeaft.toolStats.fetchedAt":"\u83B7\u53D6\u65F6\u95F4","yeaft.toolStats.col.name":"\u5DE5\u5177","yeaft.toolStats.col.calls":"\u8C03\u7528","yeaft.toolStats.col.errors":"\u9519\u8BEF","yeaft.toolStats.col.errRate":"\u9519\u8BEF\u7387","yeaft.toolStats.col.p50":"p50","yeaft.toolStats.col.p95":"p95","yeaft.toolStats.col.avg":"\u5E73\u5747","yeaft.toolStats.col.last":"\u6700\u8FD1","yeaft.toolStats.buttonLabel":"\u5DE5\u5177\u7EDF\u8BA1","workCenter.title":"\u5DE5\u4F5C\u4E2D\u5FC3","workCenter.subtitle":"\u7531\u5F53\u524D Agent \u6301\u7EED\u63A8\u8FDB\u7684\u6301\u4E45\u5DE5\u4F5C","workCenter.agent":"Agent","workCenter.selectAgent":"\u9009\u62E9 Agent","workCenter.noOnlineAgents":"\u6CA1\u6709\u5728\u7EBF Agent","workCenter.noAvailableAgents":"\u6CA1\u6709\u517C\u5BB9\u5DE5\u4F5C\u4E2D\u5FC3\u7684\u5728\u7EBF Agent","workCenter.new":"\u65B0\u5EFA","workCenter.newWorkItem":"\u65B0\u5EFA\u5DE5\u4F5C\u9879","workCenter.workItem":"\u5DE5\u4F5C\u9879","workCenter.createFirst":"\u521B\u5EFA\u7B2C\u4E00\u4E2A\u5DE5\u4F5C\u9879","workCenter.backToChat":"\u8FD4\u56DE\u5BF9\u8BDD","workCenter.refresh":"\u5237\u65B0","workCenter.search":"\u641C\u7D22\u5DE5\u4F5C\u9879","workCenter.filter":"\u7B5B\u9009","workCenter.filterAttention":"\u9700\u8981\u5904\u7406","workCenter.filterActive":"\u6267\u884C\u4E2D","workCenter.filterAll":"\u5168\u90E8","workCenter.filterDone":"\u5DF2\u5B8C\u6210","workCenter.attentionItems":"\u9700\u8981\u5904\u7406","workCenter.board.active":"\u8FDB\u884C\u4E2D","workCenter.board.needsAttention":"\u9700\u8981\u5904\u7406","workCenter.board.closed":"\u5DF2\u5173\u95ED","workCenter.board.emptyLane":"\u6682\u65E0\u5DE5\u4F5C\u9879","workCenter.board.lanes":"\u5DE5\u4F5C\u9879\u5206\u680F","workCenter.filterVp":"\u6309 VP \u7B5B\u9009","workCenter.filterType":"\u6309\u7C7B\u578B\u7B5B\u9009","workCenter.filterUpdated":"\u6309\u66F4\u65B0\u65F6\u95F4\u7B5B\u9009","workCenter.allVps":"\u5168\u90E8 VP","workCenter.allTypes":"\u5168\u90E8\u7C7B\u578B","workCenter.anyTime":"\u4E0D\u9650\u65F6\u95F4","workCenter.lastDay":"\u6700\u8FD1 24 \u5C0F\u65F6","workCenter.lastWeek":"\u6700\u8FD1 7 \u5929","workCenter.deleteWorkItem":"\u5220\u9664 Work Item","workCenter.deleteConfirm":"\u6C38\u4E45\u5220\u9664\u8FD9\u4E2A Work Item\u3001\u6267\u884C\u5386\u53F2\u548C\u9644\u4EF6\uFF1F","workCenter.deleteRequiresStop":"\u8BF7\u5148\u505C\u6B62\u8FD9\u4E2A Work Item \u518D\u5220\u9664","workCenter.lastMonth":"\u6700\u8FD1 30 \u5929","workCenter.assignment.planned":"\u8BA1\u5212\u5206\u914D","workCenter.created":"\u521B\u5EFA\u4E8E","workCenter.files":"\u4E2A\u6587\u4EF6","workCenter.loadMore":"\u52A0\u8F7D\u66F4\u591A","workCenter.activeItems":"\u6267\u884C\u4E2D\u7684\u5DE5\u4F5C","workCenter.allItems":"\u5168\u90E8\u5DE5\u4F5C\u9879","workCenter.completedItems":"\u5DF2\u5B8C\u6210","workCenter.watcherActive":"Watcher \u8FD0\u884C\u4E2D","workCenter.loading":"\u6B63\u5728\u52A0\u8F7D\u5DE5\u4F5C\u9879\u2026","workCenter.noTimestamp":"\u65E0\u65F6\u95F4\u6233","workCenter.updated":"\u66F4\u65B0\u65F6\u95F4","workCenter.emptyTitle":"\u8FD8\u6CA1\u6709\u5DE5\u4F5C\u9879","workCenter.emptyBody":"\u5F53\u5DE5\u4F5C\u9700\u8981\u8DE8\u8D8A\u4E00\u6B21\u5BF9\u8BDD\u3001\u7B49\u5F85\u6216\u89D2\u8272\u63A5\u529B\u65F6\uFF0C\u628A\u5B83\u521B\u5EFA\u4E3A\u6301\u4E45\u5DE5\u4F5C\u9879\u3002","workCenter.noAttentionTitle":"\u5F53\u524D\u6CA1\u6709\u9700\u8981\u5904\u7406\u7684\u5DE5\u4F5C\u9879","workCenter.noAttentionBody":"\u7B49\u5F85\u4F60\u56DE\u7B54\u6216\u9700\u8981\u6062\u590D\u7684\u5DE5\u4F5C\u9879\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002","workCenter.noActiveTitle":"\u5F53\u524D\u6CA1\u6709\u6267\u884C\u4E2D\u7684\u5DE5\u4F5C\u9879","workCenter.noActiveBody":"\u8349\u7A3F\u3001\u5C31\u7EEA\u548C\u6267\u884C\u4E2D\u7684\u5DE5\u4F5C\u9879\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002","workCenter.noCompletedTitle":"\u8FD8\u6CA1\u6709\u5DF2\u5B8C\u6210\u7684\u5DE5\u4F5C\u9879","workCenter.noCompletedBody":"\u5B8C\u6210\u540E\u7684\u5DE5\u4F5C\u9879\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002","workCenter.noMatchesTitle":"\u6CA1\u6709\u5339\u914D\u7684\u5DE5\u4F5C\u9879","workCenter.noMatchesBody":"\u5C1D\u8BD5\u8C03\u6574\u641C\u7D22\u5185\u5BB9\u6216\u7B5B\u9009\u6761\u4EF6\u3002","workCenter.selectTitle":"\u5DE5\u4F5C\u9879\u8BE6\u60C5","workCenter.detailLoading":"\u6B63\u5728\u52A0\u8F7D\u5B8C\u6574\u8BE6\u60C5\u2026","workCenter.detailLoadFailed":"\u65E0\u6CD5\u52A0\u8F7D\u5B8C\u6574\u8BE6\u60C5","workCenter.start":"\u5F00\u59CB","workCenter.retry":"\u91CD\u8BD5","workCenter.cancel":"\u53D6\u6D88","workCenter.closeWorkItem":"\u5173\u95ED\u8BE6\u60C5","workCenter.cancelWorkItem":"\u505C\u6B62\u5DE5\u4F5C\u9879","workCenter.cancelWorkItemHint":"\u505C\u6B62\u8FD9\u4E2A\u5DE5\u4F5C\u9879\u53CA\u6240\u6709\u5C1A\u672A\u5B8C\u6210\u7684 Actions\u3002","workCenter.cancelConfirm":"\u505C\u6B62\u8FD9\u4E2A\u5DE5\u4F5C\u9879\u53CA\u5176\u5C1A\u672A\u5B8C\u6210\u7684 Actions\uFF1F","workCenter.stopWorkItem":"\u505C\u6B62\u5DE5\u4F5C\u9879","workCenter.resumeWorkItem":"\u6062\u590D\u5DE5\u4F5C\u9879","workCenter.breadcrumbs":"Work Center \u5BFC\u822A","workCenter.actionNumber":"Action {number}","workCenter.actionBreadcrumb":"Action {number}\uFF1A{description}","workCenter.untitledAction":"\u672A\u547D\u540D Action","workCenter.workItems":"\u5DE5\u4F5C\u9879","workCenter.description":"\u9700\u6C42\u63CF\u8FF0","workCenter.goal":"\u76EE\u6807","workCenter.acceptanceCriteria":"\u9A8C\u6536\u6761\u4EF6","workCenter.noCriteria":"\u672A\u63D0\u4F9B\u9A8C\u6536\u6761\u4EF6","workCenter.failureReason":"\u5931\u8D25\u539F\u56E0","workCenter.workflow":"\u4EFB\u52A1\u6D41","workCenter.actionFlow":"Action \u6D41\u7A0B","workCenter.actionCount":"{count} \u4E2A Action","workCenter.noActionSummary":"\u6682\u65E0\u6458\u8981","workCenter.actionProgress":"{completed} / {total} \u4E2A Action","workCenter.currentAction":"\u5F53\u524D Action","workCenter.expandActions":"\u5C55\u5F00 Action","workCenter.collapseActions":"\u6536\u8D77","workCenter.actionObjective":"\u8FD9\u6B21\u8981\u505A\u4EC0\u4E48","workCenter.actionApproach":"\u51C6\u5907\u600E\u4E48\u505A","workCenter.actionExpectedOutcome":"\u671F\u5F85\u7684\u7ED3\u679C","workCenter.dependencies":"\u4F9D\u8D56\u9879","workCenter.actionResult":"\u6700\u65B0\u7ED3\u679C","workCenter.currentProgress":"\u5F53\u524D\u8FDB\u5EA6","workCenter.actionMessages":"\u6D88\u606F","workCenter.loops":"\u4E2A Loop","workCenter.tools":"\u6B21\u5DE5\u5177\u8C03\u7528","workCenter.noActionMessages":"\u8FD8\u6CA1\u6709\u6D88\u606F\u3002","workCenter.actionDetails":"Action \u8BE6\u60C5","workCenter.selectAction":"\u9009\u62E9\u4E00\u4E2A Action \u67E5\u770B\u5B9E\u9645\u6267\u884C","workCenter.backToWorkItems":"\u5DE5\u4F5C\u9879","workCenter.backToActions":"Actions","workCenter.you":"\u4F60","workCenter.noRequestDetails":"\u8FD9\u4E2A Action \u6682\u65F6\u6CA1\u6709\u53EF\u7528\u7684\u6267\u884C\u8BB0\u5F55\u3002","workCenter.loadingRequests":"\u6B63\u5728\u52A0\u8F7D\u6267\u884C\u8BB0\u5F55\u2026","workCenter.loadingRequestDetail":"\u6B63\u5728\u52A0\u8F7D\u5DE5\u5177\u8BC1\u636E\u2026","workCenter.requestDetailUnavailable":"\u5DE5\u5177\u8BC1\u636E\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u8BD5\u3002","workCenter.noRequestLoops":"\u8FD9\u6B21\u6267\u884C\u6CA1\u6709\u4FDD\u7559\u4E0B\u53EF\u5C55\u793A\u7684 Loop\u3002","workCenter.requestDetailTruncated":"\u6267\u884C\u5185\u5BB9\u8F83\u5927\uFF1A{summarized} \u4E2A Loop \u663E\u793A\u6458\u8981\uFF0C\u53E6\u6709 {omitted} \u4E2A\u8F83\u65E9 Loop \u672A\u663E\u793A\u3002","workCenter.loopDetailTruncated":"\u8FD9\u4E2A Loop \u5185\u5BB9\u8F83\u5927\uFF0C\u5F53\u524D\u663E\u793A\u4FDD\u7559\u4E0B\u6765\u7684\u5DE5\u5177\u8BC1\u636E\u3002","workCenter.loadEarlierMessages":"\u52A0\u8F7D\u66F4\u65E9\u6D88\u606F","workCenter.loadingEarlierMessages":"\u6B63\u5728\u52A0\u8F7D\u66F4\u65E9\u6D88\u606F\u2026","workCenter.unknownModel":"\u672A\u77E5\u6A21\u578B","workCenter.loop":"Loop","workCenter.actionBrief":"\u4EFB\u52A1\u8BF4\u660E","workCenter.executionSummary":"\u6267\u884C\u6458\u8981","workCenter.toolParameters":"\u8C03\u7528\u53C2\u6570","workCenter.toolResult":"\u6267\u884C\u7ED3\u679C","workCenter.noToolCalls":"\u8FD9\u4E2A Loop \u6CA1\u6709\u5DE5\u5177\u8C03\u7528\u3002","workCenter.actionInputPlaceholder":"\u8865\u5145\u4E0A\u4E0B\u6587\u3001\u56DE\u7B54\u95EE\u9898\u6216\u8C03\u6574\u8FD9\u4E2A Action","workCenter.actionInputResumeHint":"\u4F60\u7684\u8F93\u5165\u4F1A\u5E26\u7740\u65B0\u589E\u4E0A\u4E0B\u6587\u7EE7\u7EED\u8FD9\u4E2A Action\u3002","workCenter.waitingQuestionTitle":"\u9700\u8981\u4F60\u7684\u56DE\u7B54","workCenter.actionInputRetryHint":"\u8865\u5145\u4FEE\u6B63\u8BF4\u660E\u6216\u6587\u4EF6\u540E\uFF0C\u4F7F\u7528\u65B0\u4E0A\u4E0B\u6587\u91CD\u65B0\u6267\u884C\u8FD9\u4E2A Action\u3002","workCenter.actionInputContinueHint":"\u8FD9\u91CC\u53EA\u76F4\u63A5\u5E72\u9884\u5F53\u524D Action\u3002","workCenter.actionFailedTitle":"\u8FD9\u4E2A Action \u4E3A\u4EC0\u4E48\u5931\u8D25","workCenter.failedAt":"\u5931\u8D25\u65F6\u95F4","workCenter.actionFailureRecovery":"\u5728\u4E0B\u65B9\u8865\u5145\u4FEE\u6B63\u8BF4\u660E\u6216\u6587\u4EF6\u5373\u53EF\u91CD\u65B0\u6267\u884C\uFF1B\u6267\u884C\u9875\u4F1A\u5C55\u793A\u4FDD\u7559\u4E0B\u6765\u7684\u5DE5\u5177\u8BC1\u636E\u3002","workCenter.sendInput":"\u53D1\u9001\u7ED9 Action","workCenter.sendingInput":"\u6B63\u5728\u53D1\u9001\u2026","workCenter.retryAction":"\u91CD\u8BD5 Action","workCenter.sendAndRetryAction":"\u53D1\u9001\u5E76\u91CD\u8BD5 Action","workCenter.coordinatorDecision.guide_actions":"\u5DF2\u66F4\u65B0 Action \u6307\u4EE4","workCenter.coordinatorDecision.replan":"\u5DF2\u66F4\u65B0\u76EE\u6807\u6216\u8BA1\u5212","workCenter.coordinatorDecision.request_human":"\u9700\u8981\u4EBA\u5DE5\u8865\u5145\u4FE1\u606F","workCenter.conversation":"\u5BF9\u8BDD","workCenter.conversationThinking":"\u5904\u7406\u4E2D\u2026","workCenter.conversationReadOnly":"\u8FD9\u4E2A\u5DE5\u4F5C\u9879\u5DF2\u5173\u95ED\uFF0C\u5BF9\u8BDD\u8BB0\u5F55\u4ECD\u53EF\u67E5\u770B\u3002","workCenter.conversationPlaceholder":"\u7EE7\u7EED\u8BA8\u8BBA\u8FD9\u4E2A\u5DE5\u4F5C\u9879","workCenter.sendMessage":"\u53D1\u9001\u6D88\u606F","workCenter.assistant":"Yeaft","workCenter.originalRequest":"\u539F\u59CB\u9700\u6C42","workCenter.actionMessageScopeTitle":"\u7ED9\u8FD9\u4E2A Action \u53D1\u6D88\u606F","workCenter.actionMessageScope":"\u6D88\u606F\u53EA\u53D1\u9001\u7ED9\u5F53\u524D Action\u3002","workCenter.actionConversation":"\u5BF9\u8BDD","workCenter.actionConversationWith":"Action \u6267\u884C\u8005","workCenter.actionViews":"Action \u89C6\u56FE","workCenter.actionExecutor":"\u6267\u884C\u8005","workCenter.actionExecutorPending":"\u7B49\u5F85\u5206\u914D\u6267\u884C\u8005","workCenter.actionInformation":"Action \u4FE1\u606F","workCenter.messageExecutor":"\u7ED9 {name} \u53D1\u6D88\u606F","workCenter.actionChatPlaceholder":"\u548C {name} \u8BA8\u8BBA\u8FD9\u4E2A Action","workCenter.statusLabel":"\u72B6\u6001","workCenter.llmRequestsLabel":"LLM \u8BF7\u6C42","workCenter.loopsLabel":"Loops","workCenter.toolsLabel":"\u5DE5\u5177","workCenter.tokensLabel":"Tokens","workCenter.workItemMessagePlaceholder":"\u8865\u5145\u6574\u4E2A Work Item \u7684\u65B9\u5411\u6216\u7EA6\u675F","workCenter.sendWorkItemMessage":"\u53D1\u9001\u7ED9 Work Item","workCenter.fromSession":"\u4ECE\u5F53\u524D Session \u521B\u5EFA\u5DE5\u4F5C\u9879","workCenter.llmRequestCount":"{count} \u6B21 LLM \u8BF7\u6C42","workCenter.loopCount":"{count} \u6B21 Loop","workCenter.toolCount":"{count} \u4E2A\u5DE5\u5177","workCenter.tokenCount":"{count} tokens","workCenter.tokenBreakdown":"\u8F93\u5165 {input} / \u8F93\u51FA {output} / \u7F13\u5B58 {cache}","workCenter.guidance":"\u7ED9\u5F53\u524D Action \u8865\u5145\u63D0\u793A","workCenter.guidanceHint":"\u8865\u5145\u7EA6\u675F\uFF0C\u6216\u8C03\u6574\u5F53\u524D Action \u7684\u6267\u884C\u65B9\u5411","workCenter.guidanceRestartHint":"\u53D1\u9001\u540E\u4F1A\u4F7F\u7528\u65B0\u63D0\u793A\u91CD\u542F\u5F53\u524D Action\u3002","workCenter.sendGuidance":"\u53D1\u9001\u63D0\u793A","workCenter.reuseMemory":"\u4F7F\u7528\u76F8\u5173 Agent memory \u548C\u6B64\u9879\u76EE\u7684\u5DF2\u5B8C\u6210\u5DE5\u4F5C","workCenter.reuseMemoryHelp":"\u5305\u62EC\u53D7 scope \u7EA6\u675F\u7684 Agent memory\uFF0C\u4EE5\u53CA canonical \u9879\u76EE\u76EE\u5F55\u76F8\u540C\u7684\u5DF2\u5B8C\u6210 Work Item \u7ED3\u6784\u5316\u6458\u8981\u548C\u8BC1\u636E\uFF1B\u4E0D\u4F1A\u590D\u7528\u539F\u59CB\u5DE5\u5177\u8F93\u51FA\u3002","workCenter.resumeAnswer":"\u56DE\u7B54\u7B49\u5F85\u4E2D\u7684\u95EE\u9898","workCenter.resumeAnswerHint":"\u63D0\u4F9B\u7EE7\u7EED\u6267\u884C\u6240\u9700\u7684\u4FE1\u606F","workCenter.answerInActionDetail":"\u6253\u5F00\u5F53\u524D Action\uFF0C\u5728\u4E0B\u65B9\u8F93\u5165\u6846\u4E2D\u56DE\u590D\u3002","workCenter.selectPrompt":"\u9009\u62E9\u4E00\u4E2A\u5DE5\u4F5C\u9879\uFF0C\u67E5\u770B\u5B83\u7684\u6D41\u7A0B\u3002","workCenter.createHint":"\u63CF\u8FF0\u4F60\u9700\u8981\u4EC0\u4E48\uFF0CTriage \u4F1A\u751F\u6210\u76EE\u6807\u3001\u9A8C\u6536\u6761\u4EF6\u548C Actions\u3002","workCenter.requirement":"\u9700\u6C42","workCenter.requirementHint":"\u7528\u81EA\u7136\u8BED\u8A00\u63CF\u8FF0\u95EE\u9898\u3001\u671F\u671B\u7ED3\u679C\u548C\u5FC5\u8981\u7EA6\u675F","workCenter.requirementHelp":"Triage \u4F1A\u751F\u6210\u6807\u9898\u3001\u76EE\u6807\u3001\u9A8C\u6536\u6761\u4EF6\u3001\u7C7B\u578B\u548C\u6267\u884C\u8BA1\u5212\u3002","workCenter.titleField":"\u6807\u9898","workCenter.titleHint":"\u7B80\u77ED\u3001\u660E\u786E\u5730\u63CF\u8FF0\u9884\u671F\u7ED3\u679C","workCenter.goalHint":"\u8BF4\u660E Agent \u5FC5\u987B\u4EA4\u4ED8\u7684\u6700\u7EC8\u7ED3\u679C","workCenter.criteriaHint":"\u6BCF\u884C\u4E00\u6761\u9A8C\u6536\u6761\u4EF6","workCenter.attachments":"\u9644\u4EF6","workCenter.attachmentsHelp":"\u56FE\u7247\u3001PDF \u548C\u6587\u672C\u6587\u4EF6\u4F1A\u6301\u7EED\u7ED1\u5B9A\u5230\u6B64 Work Item\uFF0C\u5E76\u63D0\u4F9B\u7ED9\u6BCF\u4E2A Action\u3002","workCenter.attachmentsUnsupported":"\u6240\u9009 Agent \u4E0D\u652F\u6301 Work Item \u9644\u4EF6\u3002","workCenter.addAttachments":"\u6DFB\u52A0\u6587\u4EF6","workCenter.attachmentsUploading":"\u4E0A\u4F20\u4E2D\u2026","workCenter.attachmentsUploadFailed":"\u9644\u4EF6\u4E0A\u4F20\u5931\u8D25","workCenter.removeAttachment":"\u4ECE\u8349\u7A3F\u4E2D\u79FB\u9664","workCenter.previewAttachment":"\u6253\u5F00\u9644\u4EF6","workCenter.openAttachmentNamed":"\u6253\u5F00\u9644\u4EF6 {name}","workCenter.openingAttachment":"\u6B63\u5728\u6253\u5F00\u9644\u4EF6\u2026","workCenter.attachmentPreviewFailed":"\u65E0\u6CD5\u6253\u5F00\u9644\u4EF6\uFF0C\u8BF7\u91CD\u8BD5\u3002","workCenter.attachmentOpenBlocked":"\u6D4F\u89C8\u5668\u963B\u6B62\u4E86\u9644\u4EF6\u7A97\u53E3\uFF0C\u8BF7\u5141\u8BB8\u5F39\u51FA\u7A97\u53E3\u540E\u91CD\u8BD5\u3002","workCenter.execution":"\u6267\u884C\u65B9\u5F0F","workCenter.executionHint":"\u9009\u62E9\u5DE5\u4F5C\u9879\u5728\u54EA\u91CC\u6267\u884C\uFF0C\u4EE5\u53CA\u521B\u5EFA\u540E\u662F\u5426\u7ACB\u5373\u5F00\u59CB\u3002","workCenter.workDir":"\u5DE5\u4F5C\u76EE\u5F55","workCenter.workDirHint":"\u9009\u62E9\u4E00\u4E2A\u5DF2\u5B58\u5728\u7684\u9879\u76EE\u76EE\u5F55","workCenter.chooseFolder":"\u9009\u62E9\u6587\u4EF6\u5939","workCenter.workDirPickerHelp":"\u4ECE\u5F53\u524D Agent \u7684\u771F\u5B9E\u76EE\u5F55\u4E2D\u9009\u62E9\u5DF2\u5B58\u5728\u7684\u6587\u4EF6\u5939\u3002","workCenter.folderPickerHint":"\u9009\u62E9\u8FD9\u4E2A\u5DE5\u4F5C\u9879\u53EF\u4EE5\u8BFB\u53D6\u548C\u4FEE\u6539\u7684\u9879\u76EE\u76EE\u5F55\u3002","workCenter.folderPickerSelectionHint":"\u53CC\u51FB\u8FDB\u5165\u76EE\u5F55\uFF0C\u6216\u9009\u4E2D\u76EE\u5F55\u540E\u786E\u8BA4\u3002","workCenter.startImmediately":"\u7ACB\u5373\u5F00\u59CB","workCenter.startImmediatelyHint":"\u5173\u95ED\u540E\u5C06\u521B\u5EFA\u4E3A\u8349\u7A3F\uFF0C\u786E\u8BA4\u65E0\u8BEF\u540E\u518D\u5F00\u59CB\u3002","workCenter.creating":"\u521B\u5EFA\u4E2D\u2026","workCenter.create":"\u521B\u5EFA","workCenter.status.draft":"\u8349\u7A3F","workCenter.status.ready":"\u5F85\u6267\u884C","workCenter.status.running":"\u6267\u884C\u4E2D","workCenter.status.waiting":"\u7B49\u5F85\u4E2D","workCenter.status.needs_attention":"\u9700\u8981\u5904\u7406","workCenter.status.done":"\u5DF2\u5B8C\u6210","workCenter.status.cancelled":"\u5DF2\u53D6\u6D88","workCenter.status.completed":"\u5DF2\u5B8C\u6210","workCenter.status.failed":"\u5931\u8D25","workCenter.status.superseded":"\u5DF2\u66FF\u4EE3","workCenter.action.triage":"\u5206\u6790","workCenter.action.implement":"\u5B9E\u73B0","workCenter.action.review":"\u8BC4\u5BA1","workCenter.action.integrate":"\u96C6\u6210","workCenter.action.deliver":"\u4EA4\u4ED8","workCenter.action.test":"\u6D4B\u8BD5","workCenter.action.research":"\u7814\u7A76","workCenter.action.design":"\u8BBE\u8BA1","workCenter.action.diagnose":"\u8BCA\u65AD","workCenter.action.migrate":"\u8FC1\u79FB","workCenter.action.document":"\u6587\u6863","workCenter.action.operate":"\u8FD0\u7EF4","workCenter.action.write":"\u5199\u4F5C","workCenter.action.custom":"\u81EA\u5B9A\u4E49","workCenter.assignment.auto":"\u4F7F\u7528\u4EFB\u52A1\u6D41\u7B56\u7565","workCenter.model.inherit":"\u4F7F\u7528\u4EFB\u52A1\u6D41\u6A21\u578B","workCenter.model.defaultProvider":"\u9ED8\u8BA4 Provider","workCenter.planPreview":"\u6267\u884C\u8BA1\u5212","workCenter.planPreviewHelp":"\u6839\u636E\u5F53\u524D Agent \u7684 VP \u6C60\u548C\u6A21\u578B\u8BBE\u7F6E\u5B9E\u65F6\u89E3\u6790\u3002","workCenter.settings.title":"\u5DE5\u4F5C\u4E2D\u5FC3\u8BBE\u7F6E","workCenter.settings.subtitle":"\u914D\u7F6E Coordinator\uFF0C\u4EE5\u53CA AI \u52A8\u6001\u89C4\u5212\u4F7F\u7528\u7684 Action \u63D0\u793A\u8BCD\u3001\u6A21\u578B\u548C effort\u3002","workCenter.settings.workflow":"\u4EFB\u52A1\u6D41","workCenter.settings.workflowHelp":"Triage \u4F1A\u9488\u5BF9\u4EFB\u52A1\u52A8\u6001\u9009\u62E9 Action \u548C\u6267\u884C\u8005\u3002","workCenter.settings.aiWorkflowHelp":"Triage \u4F1A\u4E3A\u6BCF\u4E2A Work Item \u5206\u7C7B\u5E76\u751F\u6210\u7ECF\u8FC7\u6821\u9A8C\u7684 1\u20138 \u4E2A\u4EFB\u52A1\u4E13\u5C5E Action\u3002\u5185\u7F6E Action \u7B56\u7565\u53EA\u662F\u53EF\u590D\u7528\u9ED8\u8BA4\u503C\uFF1B\u9700\u8981\u65F6 triage \u53EF\u4EE5\u521B\u5EFA\u7CBE\u786E\u7684\u9886\u57DF\u7C7B\u578B\u3002","workCenter.settings.globalInstructions":"Agent \u5168\u5C40\u6307\u4EE4","workCenter.settings.globalInstructionsHint":"\u4F8B\u5982\uFF1A\u9075\u5FAA\u4ED3\u5E93\u53D1\u5E03\u6D41\u7A0B\u3001\u5FC5\u987B\u72EC\u7ACB\u8BC4\u5BA1\uFF0C\u672A\u7ECF\u660E\u786E\u6279\u51C6\u4E0D\u5F97\u521B\u5EFA\u90E8\u7F72 tag\u3002","workCenter.settings.globalInstructionsHelp":"\u4FDD\u5B58\u5728 Agent \u7EA7\uFF0C\u5E76\u51BB\u7ED3\u8FDB\u6BCF\u4E2A\u65B0 Work Item\uFF1B\u5BF9 triage \u548C\u6240\u6709\u751F\u6210\u7684 Action \u751F\u6548\uFF0C\u4F18\u5148\u7EA7\u4F4E\u4E8E Work Item \u5951\u7EA6\u53CA\u7CFB\u7EDF/\u5DE5\u5177\u5B89\u5168\u89C4\u5219\u3002\u5DF2\u6709 Work Item \u4FDD\u7559\u539F\u5FEB\u7167\u3002","workCenter.settings.actionPolicies":"\u5185\u7F6E Action \u7B56\u7565","workCenter.settings.actionPoliciesHelp":"\u8FD9\u4E9B\u662F\u53EF\u590D\u7528\u7684\u6267\u884C\u57FA\u7EBF\uFF0C\u4E0D\u662F\u56FA\u5B9A\u5DE5\u4F5C\u6D41\u3002\u672A\u77E5\u7684\u9886\u57DF Action \u7C7B\u578B\u4F1A\u4F7F\u7528\u201C\u81EA\u5B9A\u4E49\u201D\u7B56\u7565\uFF0C\u5E76\u4FDD\u7559 triage \u751F\u6210\u7684\u7C7B\u578B\u548C\u4EFB\u52A1\u76EE\u6807\u3002","workCenter.settings.dynamicInstructionHelp":"AI \u4F1A\u52A0\u5165 Work Item \u5951\u7EA6\u3001\u5168\u5C40\u6307\u4EE4\u3001\u524D\u5E8F Action \u4E0A\u4E0B\u6587\u3001memory \u548C\u4EFB\u52A1\u4E13\u5C5E\u76EE\u6807\uFF1B\u8FD9\u91CC\u5B9A\u4E49\u8BE5 Action \u7C7B\u578B\u7684\u53EF\u590D\u7528\u884C\u4E3A\u3002","workCenter.settings.models":"\u6A21\u578B","workCenter.settings.modelsHelp":"Provider \u548C\u51ED\u8BC1\u4ECD\u7531 Agent LLM \u8BBE\u7F6E\u7BA1\u7406\uFF1B\u5DE5\u4F5C\u4E2D\u5FC3\u53EA\u9009\u62E9\u53EF\u7528\u6A21\u578B\u3002","workCenter.settings.dynamicModelsHelp":"Coordinator \u4E0E\u5B9E\u9645\u6267\u884C Action \u7684\u6A21\u578B\u53EF\u4EE5\u5206\u522B\u914D\u7F6E\u3002","workCenter.settings.coordinatorModel":"Coordinator","workCenter.settings.coordinatorModelHelp":"\u7528\u4E8E Work Item \u5BF9\u8BDD\u3001\u4FEE\u6539\u76EE\u6807\u548C\u91CD\u65B0\u89C4\u5212\uFF1B\u4E0D\u4F1A\u6267\u884C\u9879\u76EE\u5DE5\u5177\u3002","workCenter.settings.allActions":"\u6240\u6709 Action \u7684\u515C\u5E95\u7B56\u7565","workCenter.settings.maxConcurrentActions":"\u6700\u5927\u5E76\u53D1 Action \u6570","workCenter.settings.maxConcurrentActionsHelp":"\u9ED8\u8BA4 3\u3002\u975E Git\u3001\u810F\u5DE5\u4F5C\u533A\u3001\u5171\u4EAB\u526F\u4F5C\u7528\u548C\u96C6\u6210 Action \u4ECD\u4F1A\u4E32\u884C\u6267\u884C\u3002","workCenter.workItemType":"\u7C7B\u578B","workCenter.typeAuto":"Auto \u2014 \u7531 LLM \u63A8\u65AD","workCenter.typeHelp":"\u53EF\u9009\u62E9\u4EFB\u52A1\u7C7B\u522B\uFF0C\u4E5F\u53EF\u8BA9 AI \u81EA\u52A8\u63A8\u65AD\uFF1B\u5177\u4F53 Actions \u59CB\u7EC8\u7531 AI \u89C4\u5212\u3002","workCenter.planning":"\u89C4\u5212\u4E2D","workCenter.aiPlan":"AI \u52A8\u6001\u89C4\u5212\u6267\u884C","workCenter.aiPlanHelp":"Triage \u4F1A\u9009\u62E9\u4EFB\u52A1\u7C7B\u578B\u3001Action\u3001\u6267\u884C\u8005\u548C\u6700\u5C0F\u53EF\u9760\u6D41\u7A0B\uFF1B\u6A21\u578B\u4E0E effort \u7531 Work Center \u8BBE\u7F6E\u63A7\u5236\u3002","workCenter.settings.manageProviders":"\u7BA1\u7406 Agent \u6A21\u578B","workCenter.settings.assignment":"VP \u9009\u62E9","workCenter.settings.assignment.auto":"\u4ECE\u5168\u90E8 VP \u81EA\u52A8\u9009\u62E9","workCenter.settings.assignment.pool":"\u5019\u9009\u6C60","workCenter.settings.assignment.fixed":"\u56FA\u5B9A VP","workCenter.settings.capability":"\u6240\u9700\u80FD\u529B","workCenter.settings.vp":"Virtual Person","workCenter.settings.poolMembers":"\u5019\u9009 VP","workCenter.settings.modelPolicy":"\u6A21\u578B\u7B56\u7565","workCenter.settings.model.inherit":"\u7EE7\u627F VP \u504F\u597D","workCenter.settings.model.primary":"Agent \u4E3B\u6A21\u578B","workCenter.settings.model.fast":"Agent \u5FEB\u6A21\u578B","workCenter.settings.model.specific":"\u6307\u5B9A\u6A21\u578B","workCenter.settings.model":"\u6A21\u578B","workCenter.settings.effort":"\u63A8\u7406\u5F3A\u5EA6","workCenter.settings.effortDefault":"\u6A21\u578B\u9ED8\u8BA4\u503C","workCenter.settings.effortHelp":"\u8986\u76D6\u6240\u9009\u6A21\u578B\u7684\u9ED8\u8BA4\u63A8\u7406\u5F3A\u5EA6\uFF0C\u5E76\u7528\u4E8E\u6240\u6709 Work Center Action\u3002","workCenter.settings.effortChooseModelHelp":"\u9009\u62E9 Agent \u4E3B\u6A21\u578B\u3001\u5FEB\u6A21\u578B\u6216\u6307\u5B9A\u6A21\u578B\u540E\u53EF\u914D\u7F6E\u63A8\u7406\u5F3A\u5EA6\uFF1B\u7EE7\u627F VP \u504F\u597D\u65F6\u4F7F\u7528\u5404 VP \u6A21\u578B\u7684\u9ED8\u8BA4\u503C\u3002","workCenter.settings.effortUnsupportedHelp":"\u6240\u9009\u6A21\u578B\u4E0D\u63D0\u4F9B\u53EF\u914D\u7F6E\u7684\u63A8\u7406\u5F3A\u5EA6\uFF0C\u56E0\u6B64\u4F7F\u7528\u6A21\u578B\u9ED8\u8BA4\u503C\u3002","workCenter.settings.saving":"\u4FDD\u5B58\u4E2D\u2026","workCenter.settings.reload":"\u91CD\u65B0\u52A0\u8F7D\u8BBE\u7F6E","workCenter.settings.conflict":"\u8BBE\u7F6E\u5DF2\u5728\u5176\u4ED6\u4F4D\u7F6E\u66F4\u65B0\uFF0C\u8BF7\u91CD\u65B0\u52A0\u8F7D\u540E\u518D\u4FDD\u5B58\u3002","workCenter.settings.upgradeRequired":"\u5F53\u524D Agent \u7248\u672C\u65E0\u6CD5\u4FDD\u5B58\u5DE5\u4F5C\u4E2D\u5FC3\u8BBE\u7F6E\u3002\u8FD9\u91CC\u4EE5\u53EA\u8BFB\u65B9\u5F0F\u663E\u793A\u5F53\u524D\u503C\uFF1B\u5347\u7EA7 Agent \u540E\u5373\u53EF\u7F16\u8F91\u5E76\u4FDD\u5B58\u3002","workCenter.settings.saveNotConfirmed":"Agent \u672A\u786E\u8BA4\u672C\u6B21\u63D0\u4EA4\u7684\u63D0\u793A\u8BCD\u548C\u6A21\u578B\u7B56\u7565\u3002\u8BBE\u7F6E\u7A97\u53E3\u4E0D\u4F1A\u5173\u95ED\uFF1B\u8BF7\u91CD\u65B0\u52A0\u8F7D\u6216\u5347\u7EA7 Agent \u540E\u518D\u8BD5\u3002","workCenter.settings.addWorkflow":"\u590D\u5236\u4EFB\u52A1\u6D41","workCenter.settings.removeWorkflow":"\u5220\u9664","workCenter.settings.newWorkflow":"\u4EFB\u52A1\u6D41 {index}","workCenter.settings.workflowName":"\u4EFB\u52A1\u6D41\u540D\u79F0","workCenter.settings.newStage":"\u65B0\u9636\u6BB5","workCenter.settings.addStage":"\u6DFB\u52A0\u9636\u6BB5","workCenter.settings.removeStage":"\u5220\u9664\u9636\u6BB5","workCenter.settings.moveUp":"\u4E0A\u79FB\u9636\u6BB5","workCenter.settings.moveDown":"\u4E0B\u79FB\u9636\u6BB5","workCenter.settings.stageType":"\u9636\u6BB5\u7C7B\u578B","workCenter.settings.reviewReturnStage":"\u8981\u6C42\u4FEE\u6539\u65F6\u9000\u56DE\u9636\u6BB5","workCenter.settings.instruction":"\u9636\u6BB5 Prompt","workCenter.settings.instructionHint":"\u5B9A\u4E49\u8FD9\u4E2A\u9636\u6BB5\u5177\u4F53\u8981\u505A\u4EC0\u4E48\u3002","workCenter.settings.instructionHelp":"\u8FD0\u884C\u65F6\u4F1A\u81EA\u52A8\u52A0\u5165 Work Item \u7684\u76EE\u6807\u3001\u9A8C\u6536\u6807\u51C6\u548C\u53EF\u590D\u7528\u4E0A\u4E0B\u6587\u3002","workCenter.settings.instructionReset":"\u6062\u590D\u9ED8\u8BA4\u503C"}});var qd,Nd=H(()=>{qd={"common.loading":"Loading...","common.confirm":"OK","common.apply":"Apply","common.cancel":"Cancel","common.delete":"Delete","common.copy":"Copy","common.copied":"Copied","common.close":"Close","common.refresh":"Refresh","common.open":"Open","common.save":"Save","common.search":"Search","common.back":"Back","common.noSubdirectories":"No subdirectories","common.drives":"Drives","common.rootDir":"Root","common.comma":", ","common.select":"Select","mermaid.export":"Export","mermaid.exportMd":"Export MD","mermaid.exportPng":"Export PNG","mermaid.exportJpg":"Export JPG","chat.toolActionsOmitted":"{count} older tool actions omitted","login.subtitle":"Yeaft Web Code Agent","login.username":"Username","login.password":"Password","login.login":"Login","login.loggingIn":"Logging in...","login.enterUsername":"Please enter your username","login.enterPassword":"Please enter your password","login.noAccount":"Don't have an account?","login.registerWithCode":"Register","login.or":"or","login.usePassword":"Sign in with username & password","login.useSso":"Back to single sign-on","login.noProviders":"No third-party sign-in providers are enabled.","login.microsoft":"Sign in with Microsoft","login.github":"Sign in with GitHub","login.google":"Sign in with Google","login.wechat":"Sign in with WeChat","login.alipay":"Sign in with Alipay","login.wechat.mobileUnsupported":"Sign in with WeChat is only available on PC. Please scan the QR code from a desktop browser.","login.alipay.mobileWaiting":"Waiting for you to confirm in the Alipay app\u2026 Once you finish, return to this page and you will be signed in automatically.","login.alipay.relaunch":"Open Alipay again","login.qr.title":"Scan to sign in","login.qr.titleAlipay":"Sign in with Alipay","login.qr.titleWechat":"Sign in with WeChat","login.qr.hint":"Scan the QR code with your phone to authorize.","login.error.enterUsername":"Please enter your username","login.error.enterPassword":"Please enter your password","login.error.enter6Digit":"Please enter a 6-digit code","login.error.enterInviteCode":"Please enter the invite code","login.error.usernameMinLen":"Username must be at least 2 characters","login.error.passwordMinLen":"Password must be at least 6 characters","login.error.passwordMismatch":"Passwords do not match","login.error.enterVerifyCode":"Please enter the verification code","login.error.loginFailed":"Login failed","login.forgot.link":"Forgot password?","login.forgot.title":"Reset your password","login.forgot.emailHint":"Enter the email address on your account. We will send a 6-digit reset code.","login.forgot.sendCode":"Send Reset Code","login.forgot.sending":"Sending...","login.forgot.codeSent":"If the email is on file, a 6-digit reset code has been sent. Enter it below along with your new password.","login.forgot.resetBtn":"Reset Password","login.forgot.resetting":"Resetting...","login.forgot.success":"Password reset. You can now sign in with your new password.","login.forgot.emailInvalid":"Please enter a valid email","login.register.title":"New User Registration","login.register.inviteCode":"Invite Code","login.register.username":"Username","login.register.password":"Password (min 6 characters)","login.register.confirmPassword":"Confirm Password","login.register.email":"Email (optional)","login.register.submit":"Register","login.register.submitting":"Registering...","login.register.back":"Back to Login","login.register.success":"Registration successful, please login","login.register.enterCode":"Please enter the invite code","login.register.usernameMin":"Username must be at least 2 characters","login.register.passwordMin":"Password must be at least 6 characters","login.register.passwordMismatch":"Passwords do not match","login.totp.setupTitle":"Set Up Two-Factor Authentication","login.totp.setupHint":"Scan the QR code below with Microsoft Authenticator or Google Authenticator","login.totp.manualKey":"Or enter the key manually:","login.totp.enterCode":"Enter 6-digit code","login.totp.complete":"Complete Setup","login.totp.verifying":"Verifying...","login.totp.verify":"Verify","login.totp.prompt":"Enter the code from your Authenticator app","login.totp.invalidCode":"Please enter a 6-digit code","login.email.codeSent":"Verification code sent to {email}","login.email.enterCode":"Enter verification code","login.email.verify":"Verify","login.email.verifying":"Verifying...","login.email.enterCodeError":"Please enter the verification code","chat.agent.select":"Select Agent","chat.agent.manage":"Manage Agents","chat.agent.none":"No Agents","chat.agent.restarting":"Restarting","chat.agent.restart":"Restart","chat.agent.restartConfirm":`Are you sure you want to restart Agent "{name}"?
13
13
  All active conversations will be interrupted.`,"chat.agent.upgrade":"Upgrade","chat.agent.upgrading":"Upgrading","chat.agent.upgradeConfirm":`Upgrade Agent "{name}" to the latest version?
14
- The agent will restart after upgrading.`,"chat.agent.alreadyLatest":"Agent is already at the latest version (v{version}), no upgrade needed.","chat.agent.nodeIncompatible":"Agent upgrade aborted: target version v{version} requires Node {required}, but this machine is running Node {current}. Please upgrade Node.js first, then retry.","chat.agent.online":"{count} Agent(s) online","chat.agent.selectFirst":"Please select an Agent first","chat.agent.yeaft":"Yeaft Chat","sidebar.toggle.chat":"Switch to Chat","sidebar.toggle.yeaft":"Switch to Yeaft","sidebar.surface.label":"Sidebar view","sidebar.surface.sessions":"Sessions","sidebar.provider.label":"Session provider","sidebar.provider.claude":"Claude","sidebar.sessions.new":"New session","sidebar.sessions.emptyProvider":"No sessions for this provider","yeaft.back":"Back","yeaft.session.people":"People","yeaft.session.peopleEmpty":"No people","yeaft.session.runningTasks":"Running tasks","yeaft.session.tasksEmpty":"No running tasks","yeaft.session.owner":"Owner","yeaft.session.started":"Started","yeaft.breadcrumb.label":"Thread filter","yeaft.breadcrumb.mainStream":"Main stream","yeaft.breadcrumb.backHint":"Return to full stream (Esc)","yeaft.featureDetail.ariaLabel":"Task detail","yeaft.featureDetail.replyTo":"Reply in:","yeaft.featureDetail.forkHint":"No active thread \u2014 fork a new one to reply.","yeaft.featureDetail.empty":"No messages for this task yet.","yeaft.featureDetail.threadPillHint":"Open thread","yeaft.featureDetail.summary.aria":"Task summary timeline","yeaft.featureDetail.summary.title":"Summary timeline","yeaft.featureDetail.summary.loading":"Loading summary history\u2026","yeaft.featureDetail.summary.empty":"No summaries yet.","yeaft.featureDetail.summary.error":"Summary history failed: {error}","yeaft.featureDetail.summary.showArchived":"Show archived","yeaft.featureDetail.related.aria":"Related tasks","yeaft.featureDetail.related.title":"Related tasks","yeaft.featureDetail.related.unlink":"Unlink","yeaft.featureDetail.members.aria":"Task members","yeaft.featureDetail.members.title":"Members","yeaft.featureDetail.members.abort":"Abort","yeaft.featureDetail.members.kick":"Kick","yeaft.model":"Model","yeaft.placeholder":"Ask anything...","yeaft.inbox":"Inbox","yeaft.inbox.tooltip":"Your default thread \u2014 one-on-one chat with Yeaft. New threads can be created for specific topics or tasks.","yeaft.sidebar.activeThreads":"Active","yeaft.sidebar.idleThreads":"Idle","yeaft.sidebar.archivedThreads":"Archived","yeaft.sidebar.tasks":"Tasks","yeaft.sidebar.emptyActive":"No active threads","yeaft.sidebar.emptyIdle":"No idle threads","yeaft.sidebar.emptyArchived":"No archived threads","yeaft.sidebar.emptyTasks":"No tasks match","yeaft.sidebar.results":"Results","yeaft.sidebar.resultsThreads":"Threads","yeaft.sidebar.kindThread":"thread","yeaft.sidebar.cancel":"Cancel","yeaft.sidebar.mergeInto":"Merge into\u2026","yeaft.sidebar.mergeNoCandidates":"No other threads to merge into","yeaft.sidebar.mergeConfirmTitle":"Merge this thread?","yeaft.sidebar.mergeIrreversible":"This cannot be undone. The source thread will be archived and its messages moved to the target.","yeaft.sidebar.mergeConfirm":"Merge","yeaft.settings.sidebarV2":"Experimental: Sidebar V2","yeaft.settings.sidebarV2Hint":"Thread list + task tree (preview).","yeaft.clearConfirm":"Clear all messages?","yeaft.mode":"Mode","yeaft.agent":"Agent","yeaft.connecting":"Connecting...","yeaft.ready":"Ready","yeaft.tools":"tools","yeaft.skills":"skills","yeaft.mcp":"MCP","yeaft.showSidebar":"Show sidebar","yeaft.hideSidebar":"Hide sidebar","yeaft.debug":"Debug","yeaft.debugClose":"Close debug panel","yeaft.debugTurns":"turns","yeaft.debugTabToolStats":"Tool Stats","yeaft.debugTabDream":"Dream","yeaft.debugTabRequestLog":"Request Log","yeaft.debugHistoryLoad":"Load request history","yeaft.debugHistoryLoading":"Loading...","yeaft.debugHistoryLoaded":"{count} loaded","yeaft.debugSearchPlaceholder":"Regex search request logs","yeaft.debugSearchHint":"Shows the latest 10 globally by default; search matches request summaries across Sessions.","yeaft.dreamDebug.title":"Dream lifecycle","yeaft.dreamDebug.trigger":"Trigger","yeaft.dreamDebug.status":"Status","yeaft.dreamDebug.started":"Started","yeaft.dreamDebug.finished":"Finished","yeaft.dreamDebug.time":"Time","yeaft.dreamDebug.phase":"Phase","yeaft.dreamDebug.call":"Call","yeaft.dreamDebug.location":"Location","yeaft.dreamDebug.result":"Result","yeaft.dreamDebug.noLatest":"No dream check has been recorded for this session yet.","yeaft.dreamDebug.noEvents":"No dream events yet for this session.","yeaft.dreamDebug.outputTitle":"Dream output loaded for this session","yeaft.dreamDebug.scope":"Scope","yeaft.dreamDebug.lastDream":"Last dream","yeaft.dreamDebug.messagesCovered":"Messages covered","yeaft.dreamDebug.noOutput":"No dream output has been written for this session yet.","yeaft.dreamDebug.promptLoadTitle":"Dream memory loaded into system prompt","yeaft.dreamDebug.loadedInto":"Loaded into","yeaft.dreamDebug.vp":"VP","yeaft.dreamDebug.summaryToPrompt":"summary.md -> system prompt","yeaft.dreamDebug.itemList":"Dream runs and scopes","yeaft.dreamDebug.searchPlaceholder":"Search Dream sessions by title, id, or summary...","yeaft.dreamDebug.noSearchResults":"No Dream sessions match this search.","yeaft.dreamDebug.noSummary":"No summary available","yeaft.dreamDebug.segments":"segments","yeaft.dreamDebug.lastError":"Last error","yeaft.dreamDebug.overview":"Overview","yeaft.dreamDebug.sessionId":"Session ID","yeaft.dreamDebug.loadedAt":"Loaded at","yeaft.dreamDebug.layers":"Layers","yeaft.dreamDebug.summaryLayer":"Resident summary","yeaft.dreamDebug.noPromptLoad":"No prompt-load record is available for this scope.","yeaft.dreamDebug.segmentTitle":"Segments","yeaft.dreamDebug.sourceMessages":"Source messages","yeaft.dreamDebug.createdAt":"Created","yeaft.dreamDebug.updatedAt":"Updated","yeaft.dreamDebug.noSegments":"No memory segments are available for this scope.","yeaft.dreamDebug.requestResponse":"Request / Response","yeaft.dreamDebug.noRequestResponse":"No Dream request/response log has been persisted for this scope yet.","yeaft.dreamDebug.empty":"No Dream debug data has been recorded yet.","yeaft.debugGroupFollowMain":"Follow main pane","yeaft.debugGroupAll":"All sessions","yeaft.debugAssistantResponse":"Assistant response","yeaft.debugViewAssistantResponse":"View response","yeaft.debugToolInput":"Input","yeaft.debugToolResult":"Result","yeaft.debugToolRunning":"running","yeaft.debugToolRunningNoResult":"Running; no result yet","yeaft.debugShowDetails":"show","yeaft.debugHideDetails":"hide","yeaft.debugTurnStartedAt":"turn started at","yeaft.debugRequestAt":"request time","yeaft.debugRequestAtDerived":"derived from turn start (legacy loop)","yeaft.turn":"Turn {n}","yeaft.systemPrompt":"System Prompt","yeaft.messagesLabel":"Messages","yeaft.response":"Response","yeaft.toolCalls":"Tool Calls","yeaft.functionCalls":"Function Calls","yeaft.request":"Request","yeaft.pending":"(pending)","yeaft.inputTokens":"Input","yeaft.outputTokens":"Output","yeaft.duration":"Duration","yeaft.noDebugData":"No debug data yet","yeaft.showDebug":"Show debug panel","yeaft.hideDebug":"Hide debug panel","yeaft.reloadPage":"Reload page","yeaft.reloadMessages":"Reload messages","yeaft.historySearch.label":"Search Session history","yeaft.historySearch.button":"Search messages","yeaft.historySearch.placeholder":"Search messages in this Session","yeaft.historySearch.searching":"Searching\u2026","yeaft.historySearch.minChars":"Type at least 2 characters","yeaft.historySearch.empty":"No matching messages","yeaft.historySearch.error":"Search failed. Try again.","yeaft.historySearch.unsupported":"Upgrade this Agent to search Session history.","yeaft.historySearch.more":"Load more results","yeaft.historySearch.you":"You","yeaft.historySearch.assistant":"Assistant","yeaft.outline.label":"Message history","yeaft.outline.sender":"Sender","yeaft.outline.allSenders":"All senders","yeaft.outline.title":"Message history","yeaft.outline.placeholder":"Search this conversation","yeaft.outline.searching":"Searching\u2026","yeaft.outline.loading":"Loading\u2026","yeaft.outline.older":"Load older messages","yeaft.outline.moreMatches":"Load more matches","yeaft.outline.minChars":"Type at least 2 characters","yeaft.outline.empty":"No messages yet","yeaft.outline.noMatches":"No matching messages","yeaft.outline.error":"Could not load the outline. Try again.","yeaft.outline.unsupported":"Upgrade this Agent to use the conversation outline.","yeaft.outline.you":"You","yeaft.outline.assistant":"Assistant","yeaft.outline.nonText":"Non-text response","yeaft.switchModel":"Switch model","yeaft.modelMenu.title":"Model and LLM settings","yeaft.modelMenu.label":"Model","yeaft.modelMenu.effort":"Effort","yeaft.modelMenu.effort.openaiReasoning":"Reasoning effort","yeaft.modelMenu.effort.anthropicBudget":"Thinking budget","yeaft.modelMenu.effort.anthropicAdaptive":"Adaptive thinking effort","yeaft.modelMenu.effort.minimal":"Minimal","yeaft.modelMenu.effort.low":"Low","yeaft.modelMenu.effort.medium":"Medium","yeaft.modelMenu.effort.high":"High","yeaft.modelMenu.effort.xhigh":"X-High","yeaft.modelMenu.effort.max":"Max","yeaft.modelMenu.noEffort":"This model does not expose a compatible effort control.","yeaft.modelMenu.configureHint":"Providers, keys, model list","yeaft.settings.title":"Settings","settings.yeaft.tabs.vp":"VP Library","settings.yeaft.tabs.search":"Search","settings.yeaft.tabs.mcp":"MCP","yeaft.settings.tabs.vp":"VP Library","yeaft.settings.tabs.search":"Search","yeaft.settings.tabs.mcp":"MCP","settings.mcp.title":"MCP servers","settings.mcp.description":"Connect Model Context Protocol servers to extend Yeaft with extra tools. Servers are stored in ~/.yeaft/config.json on the agent; tools appear in the LLM's catalogue as mcp__<server>__<tool>.","settings.mcp.reloadAll":"Reload all","settings.mcp.reloadOne":"Reconnect this server","settings.mcp.loading":"Working\u2026","settings.mcp.connected":"connected","settings.mcp.disconnected":"disconnected","settings.mcp.tools":"tools","settings.mcp.remove":"Remove","settings.mcp.empty":"No MCP servers configured yet. Add one below.","settings.mcp.addServer":"Add server","settings.mcp.addServerDesc":"Most MCP servers run as a local command \u2014 Yeaft launches it via stdio and discovers its tools.","settings.mcp.serverName":"Name","settings.mcp.command":"Command","settings.mcp.args":"Arguments","settings.mcp.argsPlaceholder":"e.g. -y @modelcontextprotocol/server-filesystem /tmp","settings.mcp.env":"Environment","settings.mcp.envPlaceholder":"KEY=value per line. Lines starting with # are ignored.","settings.mcp.saving":"Saving\u2026","settings.mcp.add":"Add","settings.mcp.cancel":"Clear","settings.mcp.connectFailed":"Saved but failed to connect","settings.mcp.addSuccess":"Server added","settings.mcp.removeSuccess":"Server removed","settings.mcp.reloadSuccess":"Reload requested","settings.mcp.confirmRemove":'Remove MCP server "{name}"? Its tools will disappear from the next LLM turn.',"settings.mcp.errors.nameRequired":"Name is required","settings.mcp.errors.nameFormat":"Name must be lowercase letters, digits, dashes or underscores only","settings.mcp.errors.commandRequired":"Command is required","settings.mcp.errors.argsParse":"Could not parse arguments","settings.mcp.errors.envParse":"Could not parse environment","search.settings.backendTitle":"Search backend","search.settings.backendDesc":"Choose the primary backend for the WebSearch tool. If the primary fails, the engine automatically falls back to HTML scraping.","search.settings.backend.tavily":"Tavily","search.settings.backend.tavilyHint":"Hosted search API. Free tier: 1000 queries/month. Recommended.","search.settings.backend.playwright":"Playwright service","search.settings.backend.playwrightHint":"Self-hosted browser-based search/fetch. Best for cloud IPs that get bot-blocked. Service not yet shipped.","search.settings.comingSoon":"Coming soon","search.settings.tavilyKeyTitle":"Tavily API key","search.settings.tavilyKeyDesc":"Stored on the agent in ~/.yeaft/config.json. Get a free key at","search.settings.tavilyKeyUnchanged":"(unchanged)","search.settings.clearKey":"Clear","search.settings.usageTitle":"Usage this month","search.settings.usageRefresh":"Refresh","search.settings.usageLoading":"Loading\u2026","search.settings.usagePlan":"Plan","search.settings.usageUsed":"Used","search.settings.usagePaygo":"Pay-as-you-go","search.settings.usageError":"Failed to load usage","search.settings.save":"Save","search.settings.saving":"Saving\u2026","search.settings.saveSuccess":"Saved","search.settings.cancel":"Reset","yeaft.settings.yeaftTitle":"Thread Concurrency & Archive","yeaft.settings.yeaftDesc":"Tune how many threads can run at once and when idle threads are auto-archived.","yeaft.settings.maxConcurrentLabel":"Max concurrent threads","yeaft.settings.maxConcurrentHint":"Maximum number of live threads at once (includes the always-on main thread). New threads beyond this cap are refused until an existing thread is archived or terminated. Range: 1-50.","yeaft.settings.archiveIdleDaysLabel":"Auto-archive idle threads after (days)","yeaft.settings.archiveIdleDaysHint":"Threads with no activity for this many days will be archived. Range: 1-3650.","yeaft.settings.yeaftSaveBtn":"Save","yeaft.settings.yeaftSaving":"Saving...","yeaft.settings.yeaftSaved":"Saved","yeaft.settings.yeaftLoading":"Loading...","yeaft.settings.yeaftLoadError":"Failed to load Yeaft settings","yeaft.settings.yeaftSaveError":"Failed to save Yeaft settings","yeaft.settings.rangeErrorConcurrent":"Must be between 1 and 50","yeaft.settings.rangeErrorArchive":"Must be between 1 and 3650","chat.session.creating":"Creating conversation...","chat.session.loadingHistory":"Loading conversation history...","yeaft.historyLoad.error":"Conversation history could not be loaded. Your messages are still stored on the Agent.","yeaft.historyLoad.retry":"Retry loading","yeaft.sessionInventory.error":"Sessions could not be loaded. Your conversations are still stored on the Agent.","yeaft.sessionInventory.retry":"Retry Sessions","chat.session.closed":"Conversation closed","chat.session.agentOffline":"Agent is offline. This session will be available when the agent reconnects.","chat.execution.cancelled":"Execution cancelled","chat.sidebar.expand":"Expand menu","chat.sidebar.collapse":"Collapse sidebar","chat.sidebar.workbench":"Workbench","chat.sidebar.newConv":"Conversation","chat.sidebar.recentChats":"Recent Chats","chat.sidebar.resumeConv":"Resume Conversation","chat.sidebar.lightMode":"Light Mode","chat.sidebar.darkMode":"Dark Mode","chat.sidebar.settings":"Settings","chat.sidebar.emptyHint":"Click the button above to create a new conversation","chat.sidebar.closeConv":"Close Conversation","chat.sidebar.renameConv":"Rename","chat.sidebar.pin":"Pin to top","chat.sidebar.unpin":"Unpin","chat.connection.connecting":"Connecting...","chat.connection.reconnecting":"Reconnecting ({current}/{max})...","chat.connection.updating":"Server is updating, please wait...","chat.connection.disconnected":"Disconnected","chat.connection.reconnect":"Reconnect","chat.connection.reconnectFailed":"Connection lost. Please click reconnect to retry.","chat.time.justNow":"Just now","chat.time.minutesAgo":"{count}m ago","chat.time.daysAgo":"{count}d ago","chat.time.today":"Today","chat.time.yesterday":"Yesterday","chat.delete.confirm":"Are you sure you want to close this conversation? This will terminate the corresponding Claude process.","chat.delete.enterWorkDir":"Please enter the working directory path","modal.newConv.workDir":"Work Directory","modal.newConv.inputOrSelect":"Enter or select a work directory","modal.newConv.browse":"Browse","modal.newConv.noWorkDirs":"No work directories","modal.newConv.selectAgent":"Please select an online Agent first","modal.newConv.create":"Create Conversation","modal.newConv.folderLabel":"\u{1F4C1} Work Directories","modal.newConv.provider":"Provider","modal.newConv.model":"Model","provider.claudeCode":"Claude Code","provider.copilot":"Copilot","modal.resume.workDir":"Work Directory","modal.resume.inputOrSelect":"Enter or select a work directory","modal.resume.browse":"Browse","modal.resume.tabFolders":"Directories","modal.resume.tabSessions":"History","modal.resume.noWorkDirs":"No work directories","modal.resume.selectWorkDir":"Please select a work directory first","modal.resume.noSessions":"No history sessions in this directory","modal.resume.untitled":"Untitled Session","modal.resume.folderLabel":"\u{1F4C1} Work Directories","modal.resume.sessionLabel":"\u{1F4AC} History Sessions","modal.resume.selectAgent":"Please select an online Agent first","modal.folderPicker.title":"Select Work Directory","modal.folderPicker.parentDir":"Parent Directory","welcome.subtitle":"Web Code Agent for sessions, tools, and VP collaboration","welcome.agentOnline":"{count} Agent(s) online","welcome.noAgents":"No Agents Online","welcome.noAgentsHint":"Please start an Agent and connect it to the server","welcome.noAgent":"No Agents Online","welcome.noAgentHint":"Please start an Agent and connect it to the server","welcome.setupAgent":"Set Up Agent","welcome.setupKicker":"Agent setup","welcome.setupTitle":"Connect your first Yeaft Agent","welcome.setupDesc":"Copy two commands to connect a local Agent. GitHub Copilot can configure models automatically.","welcome.setupInstallTitle":"Install CLI","welcome.setupCopilotTitle":"Configure models","welcome.setupRunTitle":"Start Agent","welcome.setupSecretLoading":"Preparing your Agent secret...","welcome.setupSecretError":"Could not prepare the Agent secret. Open Security settings to retry.","welcome.openSecuritySettings":"Open Security Settings","welcome.newConv":"Conversation","welcome.resumeHistory":"Resume History","messages.loadingMore":"Loading more messages...","messages.loadMore":"\u2191 Click or scroll up to load more","message.loadingMore":"Loading more messages...","message.loadMore":"\u2191 Click or scroll up to load more","message.scrollToLatest":"\u2193 Latest","message.showResponses":"Show {count} response(s)","message.hideResponses":"Hide response(s)","message.assistant":"Assistant","chat.waiting.disconnected":"Connection lost","chat.connecting":"Connecting to provider session...","chat.waiting.compacting":"Compacting context...","chat.waiting.agentOffline":"Agent offline","chat.waiting.sessionLost":"Session lost, refreshed, waiting for update...","chat.waiting.cliExited":"Claude process exited, refreshed, waiting for update...","chat.waiting.refresh":"Refresh","chat.waiting.thinking":"AI is thinking, please wait...","btw.hint":"esc to exit","btw.placeholder":"Ask a side question...","btw.close":"Exit BTW mode","message.copyContent":"Copy content","message.copy":"Copy content","message.copied":"Copied","message.copyCode":"Copy code","message.copyAll":"Copy all","message.screenshot":"Screenshot","message.screenshotting":"Taking screenshot...","message.exportMd":"Export MD","message.askInput":"Your input needed","message.askAnswered":"\u2713 Answered","message.askCustom":"Or type a custom answer...","message.askCustomPlaceholder":"Or type a custom answer...","message.askSubmit":"Submit Answer","message.askWaiting":"Waiting for question...","message.askExpired":"This question has expired. Ask the role to re-ask.","message.openInEditor":"Open in editor","message.resultDone":"Done","message.done":"Done","message.resultRead":"Read {file}","message.readFile":"Read {name}","message.file":"file","message.attachImages":"{count} image(s)","message.imageCount":"{count} image(s)","message.imagePreview":"Image preview","message.imageUnavailable":"Image unavailable","message.attachFiles":"{count} file(s)","message.fileCount":"{count} file(s)","message.quote":"Quote","message.removeQuote":"Remove quote","message.replyingTo":"Replying to {author}","message.quotedFrom":"Quoted from {author}","message.editAsNew":"Edit","message.you":"You","input.upload":"Upload file","input.placeholder":"Type a message...","input.send":"Send","input.stopExecution":"Stop execution","chatInput.upload":"Upload file","chatInput.uploading":"Uploading...","chatInput.uploadFailed":"Upload failed","chatInput.retryUpload":"Retry","chatInput.removeAttachment":"Remove attachment","chatInput.placeholder":"Type a message...","chatInput.send":"Send","chatInput.stop":"Stop execution","tools.thinking":"Thinking...","tools.read":"Reading file","tools.write":"Writing file","tools.edit":"Editing file","tools.bash":"Running command","tools.glob":"Searching files","tools.grep":"Searching content","tools.task":"Running task","tools.webFetch":"Fetching web page","tools.webSearch":"Searching the web","tools.todoWrite":"Updating tasks","tools.executing":"Running {name}","status.thinking":"Thinking...","status.reading":"Reading file","status.writing":"Writing file","status.editing":"Editing file","status.executing":"Running command","status.searchingFiles":"Searching files","status.searchingContent":"Searching content","status.executingTask":"Running task","status.fetching":"Fetching web page","status.searching":"Searching the web","status.updatingTasks":"Updating tasks","status.executingTool":"Running {name}","header.compacting":"Compressing context...","header.compacted":"Context compression complete","chatHeader.newConv":"Conversation","chatHeader.compacting":"Compressing context...","chatHeader.compactDone":"Context compression complete","chatHeader.compact":"Compact context","chatHeader.resume":"Resume session","chatHeader.refresh":"Refresh messages","chatHeader.reloadPage":"Reload page","chatHeader.clear":"Clear messages","chatHeader.clearing":"Clearing context...","chatHeader.clearDone":"Context cleared","chatHeader.confirmClear":"Are you sure you want to clear all messages in this conversation?","chatHeader.mcpConfig":"MCP Servers","chatHeader.mcpNeedRestart":"Changes will take effect after restarting the session.","chatHeader.expertPanel":"Expert Panel","chatHeader.subAgentPanel":"Sub-Agents","settings.close":"Close settings","settings.tabs.account":"Account","settings.tabs.security":"Security","settings.tabs.general":"General","settings.tabs.invitations":"Invitations","auth.sessionExpired":"Session expired. Please log in again.","settings.account.username":"Username","settings.account.role":"Role","settings.account.email":"Email","settings.account.emailNotSet":"Not set","settings.account.profileLoadFailed":"Failed to load account profile","settings.account.logout":"Log Out","settings.account.roleAdmin":"Admin","settings.account.rolePro":"Pro","settings.account.linkedAccounts":"Linked Accounts","settings.account.linkedDesc":"Link external sign-in providers so you can log in with any of them.","settings.account.bind":"Link","settings.account.unbind":"Unlink","settings.account.linked":"Linked","settings.account.providerDisabled":"Not configured","settings.account.cantUnbindLast":"Cannot unlink the only login method","settings.account.unbindFailed":"Failed to unlink: {error}","settings.account.bindFailed":"Failed to link account","settings.account.ssoBoundMsg":"Successfully linked {provider}.","settings.account.ssoConflictMsg":"This {provider} account is already linked to another user.","settings.account.providerMicrosoft":"Microsoft","settings.account.providerGithub":"GitHub","settings.account.providerGoogle":"Google","settings.account.providerWechat":"WeChat","settings.account.providerAlipay":"Alipay","settings.security.agentKey":"Agent Secret","settings.security.agentKeyDesc":"Shared secret for Agent connection authentication","settings.security.agentSetupCommands":"Agent setup commands","settings.security.agentCmdInstall":"Install Agent","settings.security.agentCmdService":"Run Agent server","settings.security.agentCmdNeedsSecret":"Generate an Agent Secret first to create the server command.","settings.security.agentCmdLlm":"Manual Copilot fallback","settings.security.agentCmdLlmDesc":"Run the install command first. If an existing GitHub Copilot token is available, Yeaft configures github-copilot/gpt-5.5 automatically; use the Copilot command only as a fallback.","settings.security.none":"None","settings.security.show":"Show","settings.security.hide":"Hide","settings.security.generateKey":"Generate Secret","settings.security.resetKey":"Reset Secret","settings.security.resetting":"Resetting...","settings.security.resetWarning":"All Agents need to be reconfigured after reset","settings.security.changePassword":"Change Password","settings.security.currentPassword":"Current password","settings.security.newPassword":"New password (min 6 characters)","settings.security.confirmPassword":"Confirm new password","settings.security.changeBtn":"Change Password","settings.security.changing":"Changing...","settings.security.enterCurrentPwd":"Please enter your current password","settings.security.newPwdMin":"New password must be at least 6 characters","settings.security.pwdMismatch":"Passwords do not match","settings.security.pwdChanged":"Password changed successfully","settings.security.setPassword":"Set a Password","settings.security.setPasswordDesc":"You signed in via SSO and have no password yet. Set one so you can also log in with username + password.","settings.security.setBtn":"Set Password","settings.security.pwdSet":"Password set successfully","settings.security.deleteAccount":"Delete Account","settings.security.deleteAccountDesc":"Permanently delete your account and all associated data. This cannot be undone.","settings.security.deleteBtn":"Delete Account","settings.security.deleteConfirmBtn":"Confirm Delete","settings.security.deleteConfirmPlaceholder":"Type DELETE to confirm","settings.security.deleteConfirmRequired":"Type DELETE to confirm account removal","settings.security.deleteFailed":"Failed to delete account","settings.security.deleting":"Deleting...","settings.general.theme":"Theme","settings.general.lightTheme":"Light","settings.general.darkTheme":"Dark","settings.general.language":"Language","settings.invite.create":"Create Invite Code","settings.invite.normalUser":"Regular User","settings.invite.proUser":"Pro User","settings.invite.createBtn":"Create Invite","settings.invite.creating":"Creating...","settings.invite.list":"Invite Codes","settings.invite.used":"Used","settings.invite.expired":"Expired","settings.invite.available":"Available","settings.invite.usedBy":"Used by: {user}","settings.invite.expiredAt":"Expired at: {time}","settings.invite.expiresAt":"Expires at: {time}","settings.invite.noInvites":"No invite codes","settings.msg.copiedClipboard":"Copied to clipboard","settings.msg.copyFailed":"Copy failed","settings.msg.keyReset":"Secret has been reset","settings.msg.resetFailed":"Reset failed","settings.msg.changeFailed":"Change failed","settings.msg.inviteCreated":"Invite code created","settings.msg.createFailed":"Create failed","settings.msg.inviteCopied":"Invite code copied","settings.msg.inviteDeleted":"Invite code deleted","settings.msg.deleteFailed":"Delete failed","settings.tabs.llm":"LLM","settings.tabs.yeaft":"Yeaft","yeaft.session.title":"Sessions","yeaft.session.new":"+ New session","yeaft.session.create.title":"New session","yeaft.session.create.subtitle":"Choose where it runs and which provider should handle it.","yeaft.session.create.close":"Close","yeaft.session.create.nameLabel":"Name","yeaft.session.create.namePlaceholder":"Session name (optional)","yeaft.session.create.workDirLabel":"Work Directory","yeaft.session.create.agentLabel":"Agent","yeaft.session.create.vpPicker":"Pick VPs","yeaft.session.create.vpNone":"No VPs selected","yeaft.session.create.vpCount":"{n} VPs selected","yeaft.session.create.untitled":"Untitled session","yeaft.session.create.rosterEmpty":"No VPs available \u2014 create one from the VP Library first.","yeaft.session.create.rosterLoading":"Loading VPs\u2026","yeaft.vp.domain.general":"General & coordination","yeaft.vp.domain.productDesign":"Product & experience design","yeaft.vp.domain.softwareSystems":"Software & systems","yeaft.vp.domain.securityReliability":"Security & reliability","yeaft.vp.domain.scienceAnalysis":"Science & analysis","yeaft.vp.domain.philosophyPsychology":"Philosophy & psychology","yeaft.vp.domain.strategyHistory":"Strategy & history","yeaft.vp.domain.businessManagement":"Business & management","yeaft.vp.domain.artsCulture":"Arts & culture","yeaft.vp.domain.other":"Other specialties","yeaft.vp.domain.custom":"Custom VPs","yeaft.session.create.defaultVpHint":"The VP that answers when no one is @-mentioned.","yeaft.session.create.folderLabel":"\u{1F4C1} Work directories","yeaft.session.create.sessionLabel":"\u{1F4AC} Sessions in this directory","yeaft.session.create.noWorkDirs":"No prior sessions yet \u2014 pick or type a work directory above.","yeaft.session.create.back":"Back","yeaft.session.create.creating":"Creating\u2026","yeaft.session.create.submit":"Create","yeaft.onboarding.ariaLabel":"Yeaft getting started guide","yeaft.onboarding.topbarTitle":"Get started with Yeaft","yeaft.onboarding.eyebrow":"Yeaft setup guide","yeaft.onboarding.title":"Connect an Agent before chatting","yeaft.onboarding.subtitle":"Run these commands on the machine that should execute tools. The agent secret is generated automatically for your account if it does not exist yet.","yeaft.onboarding.createSession":"Create or restore Session","yeaft.onboarding.configureLlm":"Open LLM settings","yeaft.onboarding.secretLoading":"Generating agent secret\u2026","yeaft.onboarding.secretError":"Failed to load agent secret.","yeaft.onboarding.secretPending":"<loading-agent-secret>","yeaft.onboarding.installTitle":"Install yeaft-agent","yeaft.onboarding.installDesc":"Install the command-line Agent package.","yeaft.onboarding.connectTitle":"Connect this Agent","yeaft.onboarding.connectDesc":"The command below uses this server URL and your generated secret.","yeaft.onboarding.llmTitle":"Use GitHub Copilot","yeaft.onboarding.llmDesc":"Authenticate GitHub CLI, then select gpt-5.5 as the default Yeaft model.","yeaft.restore.modal.empty":"No yeaft sessions found in this directory","yeaft.restore.modal.scanError":"Failed to scan: {message}","yeaft.restore.modal.restoreError":"Failed to restore: {message}","settings.llm.noAgent":"Please select an Agent first to manage LLM configuration.","settings.llm.agentOffline":"Agent is currently offline. LLM configuration will load when the agent comes online.","settings.llm.loading":"Loading configuration...","settings.llm.loadError":"Failed to load configuration","settings.llm.configureAgent":"Configure this agent LLM","settings.llm.configureMenu":"LLM Settings","settings.llm.simpleCopilotTitle":"Recommended: GitHub Copilot","settings.llm.useGitHubCopilot":"Use GitHub Copilot","settings.llm.refreshingModels":"Refreshing models...","settings.llm.managedCopilotTitle":"Managed GitHub Copilot","settings.llm.managedCopilotDesc":"Base URL, authentication, model catalog, and per-model API protocol are managed automatically. Claude models use Anthropic Messages; GPT/o models use OpenAI Responses.","settings.llm.providersTitle":"Providers","settings.llm.testFailed":"Connection test failed","settings.llm.saveSuccess":"LLM settings saved","settings.llm.saveFailed":"Failed to save LLM settings","settings.llm.presets.title":"Quick setup","settings.llm.providersDesc":"Choose a provider, save it, and use it in Sessions.","settings.llm.agentProviders":"This agent providers","settings.llm.agentBadge":"This agent","settings.llm.addProvider":"Add Provider","settings.llm.addFromPreset":"Add from Catalog","settings.llm.preset.title":"Provider Catalog (models.dev)","settings.llm.preset.refresh":"Refresh catalog","settings.llm.preset.loading":"Loading catalog\u2026","settings.llm.preset.empty":"No providers available.","settings.llm.preset.pickProvider":"Pick a provider on the left to see its models.","settings.llm.preset.filterProviders":"Filter providers\u2026","settings.llm.preset.filterModels":"Filter models\u2026","settings.llm.preset.selectAll":"Select all","settings.llm.preset.selectNone":"Clear","settings.llm.preset.cancel":"Cancel","settings.llm.preset.add":"Add to providers","settings.llm.preset.fetchedAt":"Catalog updated {minutes}m ago","settings.llm.addModel":"Add Model","settings.llm.removeModel":"Remove Model","settings.llm.providerName":"Name","settings.llm.providerNamePlaceholder":"e.g. my-proxy","settings.llm.baseUrl":"Base URL","settings.llm.baseUrlPlaceholder":"e.g. http://localhost:6628/v1","settings.llm.apiKey":"API Key","settings.llm.apiKeyPlaceholder":"Enter API key","settings.llm.protocol":"Protocol","settings.llm.protocolOpenAI":"OpenAI Compatible","settings.llm.protocolOpenAIResponses":"OpenAI Responses (GPT-5)","settings.llm.protocolAnthropic":"Anthropic Native","settings.llm.protocolHint.anthropic":"Claude native Messages API.","settings.llm.protocolHint.openai":"Chat Completions /v1/chat/completions \u2014 GPT-4 and most compatible proxies.","settings.llm.protocolHint.openaiResponses":"Responses API /v1/responses \u2014 required for GPT-5 series.","settings.llm.modelCtxPlaceholder":"ctx","settings.llm.modelMaxPlaceholder":"max","settings.llm.models":"Candidate Model IDs","settings.llm.modelsPlaceholder":"Model IDs, comma or newline separated, e.g. claude-sonnet-4-20250514, gpt-5","settings.llm.modelsHint":"Comma or newline separated.","settings.llm.removeProvider":"Remove","settings.llm.modelSelectionTitle":"Model Selection","settings.llm.modelSelectionDesc":"Choose the default models.","settings.llm.primaryModel":"Primary Model","settings.llm.primaryModelDesc":"Used for user-facing conversations","settings.llm.fastModel":"Fast Model","settings.llm.fastModelDesc":"Used for internal tasks (memory, consolidation)","settings.llm.noModels":"No models available. Add a provider first.","settings.llm.selectModel":"Select a model...","settings.llm.save":"Save Changes","settings.llm.saving":"Saving...","settings.llm.saved":"Configuration saved","settings.llm.savedRefreshWarning":"Configuration was saved, but the live model catalog could not refresh: {error}","settings.llm.unsavedChanges":"You have unsaved changes","settings.llm.confirmRemoveProvider":"Remove this provider?","settings.llm.setupTitle":"Connect a model","settings.llm.setupDesc":"GitHub Copilot is recommended. You can also add your own API provider.","settings.llm.providerSectionHint":"Only the fields required to connect a model.","settings.tabs.dashboard":"Dashboard","settings.dashboard.totalUsers":"Total Users","settings.dashboard.onlineUsers":"Online Users","settings.dashboard.onlineAgents":"Online Agents","settings.dashboard.totalSessions":"Total Sessions","settings.dashboard.todayActive":"Today Active","settings.dashboard.todayMessages":"Today Messages","settings.dashboard.todayUserTurns":"Today User Turns","settings.dashboard.totalTokens":"Total Tokens","settings.dashboard.tokenAccuracy":"Provider-reported usage, accumulated from the version that enabled per-user token tracking. Heartbeats are excluded.","settings.dashboard.agentTurns":"Agent Turns","settings.dashboard.agentSessions":"Agent Sessions","settings.dashboard.turns":"Turns","settings.dashboard.tokens":"Tokens","settings.dashboard.inputTokens":"Input","settings.dashboard.outputTokens":"Output","settings.dashboard.cacheTokens":"Cache","settings.dashboard.today":"Today","settings.dashboard.thisWeek":"This Week","settings.dashboard.thisMonth":"This Month","settings.dashboard.all":"All","settings.dashboard.userUsage":"User Usage","settings.dashboard.agentList":"Agent List","settings.dashboard.onlineUserList":"Online Users","settings.dashboard.refresh":"Refresh","settings.dashboard.name":"Name","settings.dashboard.messages":"Messages","settings.dashboard.userTurns":"User Turns","settings.dashboard.sessions":"Sessions","settings.dashboard.requests":"Requests","settings.dashboard.traffic":"Traffic","settings.dashboard.lastLogin":"Last Login","settings.dashboard.status":"Status","settings.dashboard.latency":"Latency","settings.dashboard.version":"Version","settings.dashboard.owner":"Owner","settings.dashboard.role":"Role","settings.dashboard.agent":"Agent","settings.dashboard.online":"Online","settings.dashboard.offline":"Offline","settings.dashboard.noAgents":"No agents registered","settings.dashboard.noUserData":"No user data","settings.dashboard.noOnlineUsers":"No users online","settings.dashboard.loading":"Loading...","settings.dashboard.error":"Failed to load data","settings.dashboard.ago":"{time} ago","settings.dashboard.loadMore":"Load more ({remaining} remaining)","workbench.maximize":"Maximize panel","workbench.restore":"Restore panel","workbench.collapse":"Collapse panel","theme.switchToLight":"Switch to light theme","theme.switchToDark":"Switch to dark theme","theme.toLight":"Switch to light theme","theme.toDark":"Switch to dark theme","terminal.splitH":"Split horizontally (left-right)","terminal.splitV":"Split vertically (top-bottom)","terminal.close":"Close current terminal","terminal.autoCreate":"A terminal will be created when you switch to the Terminal tab","terminal.xtermError":"xterm.js not loaded, please refresh the page","terminal.xtermNotLoaded":"xterm.js not loaded, please refresh the page","terminal.mountError":"Terminal container mount failed","terminal.mountFailed":"Terminal container mount failed","terminal.createError":"Terminal creation failed","terminal.createFailed":"Terminal creation failed","terminal.error":"Terminal error","git.selectFolder":"Select folder","git.repoPath":"Enter Git repository path...","git.repoPathPlaceholder":"Enter Git repository path...","git.workDir":"Git working directory","git.loadStatus":"Load Git status","git.loading":"Loading Git status...","git.loadingStatus":"Loading Git status...","git.clean":"Working directory clean, no changes","git.cleanWorkDir":"Working directory clean, no changes","git.selectAgent":"Select an Agent to load Git status","git.selectAgentFirst":"Select an Agent to load Git status","git.diffOnly":"Diff only","git.fullFile":"Full file","git.zoomIn":"Zoom in","git.zoomOut":"Zoom out","git.loadingDiff":"Loading Diff...","git.clickToView":"Click a file to view diff","git.clickFileToView":"Click a file to view diff","git.selectRepo":"Select Git Repository","git.noDiff":"(No differences)","git.binaryFile":"(Binary file)","files.notLoaded":"Not loaded","files.newFile":"New File","files.newFolder":"New Folder","files.collapseAll":"Collapse All","files.openFolder":"Open Folder","files.deleteSelected":"Delete selected","files.moveSelected":"Move selected","files.enterPath":"Enter path...","files.searchFiles":"Search files... (Ctrl+P)","files.noMatch":"No matches found","files.searching":"Searching...","files.loadingTree":"Loading...","files.emptyDir":"Empty directory","files.loadingFile":"Loading file...","files.searchPlaceholder":"Search...","files.replacePlaceholder":"Replace...","files.replace":"Replace","files.replaceAll":"All","files.replaceCurrent":"Replace current","files.replaceAllTitle":"Replace all","files.clickToView":"Click a file to view content","files.selectFolder":"Select Folder","files.enterFolderName":"Enter folder name...","files.enterFileName":"Enter file name...","files.moveTarget":"Enter target directory path...","files.moveItems":"Move {count} item(s) to the specified directory","files.workDir":"Work directory: {dir}","files.enterDirPath":"Enter directory path...","files.unsavedConfirm":'"{name}" has unsaved changes. Close anyway?',"files.deleteConfirm":'Are you sure you want to delete "{name}"?',"files.deleteDirHint":" (this will delete the folder and all its contents)","files.deleteSelectedConfirm":"Are you sure you want to delete {count} selected item(s)? This action cannot be undone.","files.findPrev":"Previous (Shift+Enter)","files.findNext":"Next (Enter)","files.caseSensitive":"Case sensitive","files.regex":"Regular expression","files.unsaved":"Unsaved","files.clearSelection":"Clear selection","files.rename":"Rename","files.copyHere":"Copy","files.moveTo":"Move to...","files.download":"Download","files.enterNewName":"Enter new name...","files.loadingPreview":"Loading preview...","files.preview":"Preview","files.edit":"Edit","files.pptxNotSupported":"PPTX local preview is not supported. Please switch to Office Online mode in Settings.","files.officePreviewMode":"Office Preview Mode","files.officeOnline":"Office Online","files.localRender":"Local Rendering","proxy.port":"Port","proxy.label":"Label","proxy.add":"Add port mapping","proxy.addPort":"Add port mapping","proxy.enable":"Click to enable","proxy.clickEnable":"Click to enable","proxy.disable":"Click to disable","proxy.clickDisable":"Click to disable","proxy.openNewTab":"Open in new tab","proxy.openInBrowser":"Open in new tab","proxy.noMappings":"No port mappings","proxy.noPorts":"No port mappings","proxy.hint":"After adding ports, you can access local services on the agent machine through proxy URLs","proxy.noPortsHint":"After adding ports, you can access local services on the agent machine through proxy URLs","proxy.selectAgent":"Please select an Agent first","store.selectAgent":"Please select an Agent first","store.creatingConv":"Creating conversation...","store.loadingHistory":"Loading conversation history...","store.executionCancelled":"Execution cancelled","store.loginFailed":"Login failed","store.convClosed":"Conversation closed","store.convCreated":"New conversation created [{agent}], work directory: {workDir}","store.convResumed":"Conversation resumed [{agent}]: {sessionId}","roleplay.creating":"Creating Role Play session...","roleplay.working":"Working","roleplay.selectTeam":"Select team template","roleplay.teamDev":"Software Dev","roleplay.teamCustom":"Custom","roleplay.editRoles":"Edit Roles","roleplay.roleName":"Role ID","roleplay.roleDisplayName":"Display Name","roleplay.roleIcon":"Icon","roleplay.roleDesc":"Role Description","roleplay.rolePrompt":"Role Prompt","roleplay.removeRole":"Remove Role","roleplay.addRole":"Add Role","roleplay.start":"Start Role Play","roleplay.sidebarTitle":"Role Play","roleplay.configTitle":"Role Play","roleplay.newSession":"New Role Play","roleplay.emptyHint":"Send a message to start multi-role collaboration","roleplay.askingYou":"is asking you","roleplay.language":"Language","roleplay.rolePreview":"Role Configuration","roleplay.noAgents":"No online agents available","roleplay.inputPlaceholder":"Type a message\u2026 Use @ to mention a role","roleplay.existingSessions":"Existing Teams","roleplay.restore":"Restore","roleplay.restoring":"Restoring Role Play session...","roleplay.createNew":"Create New Team","expertPanel.title":"Expert Panel","expertPanel.search":"Search roles or actions...","expertPanel.noResults":"No results","expertPanel.clearAll":"Clear","expertPanel.persona":"Persona Prompt","expertPanel.template":"With Input \xB7 Prefix","expertPanel.templateHint":"When user types text: this prefix + user text = final prompt","expertPanel.defaultMsg":"No Input \xB7 Full Prompt","expertPanel.defaultMsgHint":"When user sends without typing: this full prompt is used as-is","expertPanel.loading":"Loading role definitions...","expertPanel.viewPrompt":"View prompt","expertPanel.customRoles":"Custom Roles","expertPanel.addRole":"Add role","expertPanel.editRole":"Edit role","expertPanel.deleteRole":"Delete role","expertPanel.noCustomRoles":"No custom roles yet","expertPanel.createFirst":"Create your first custom role","expertPanel.noActions":"No actions defined","expertPanel.deleteConfirm":'Delete role "{name}"? This cannot be undone.',"expertPanel.deleteConfirmBtn":"Delete","expertEditor.createTitle":"Create Custom Role","expertEditor.editTitle":"Edit Custom Role","expertEditor.basicInfo":"Basic Info","expertEditor.roleName":"Role Name","expertEditor.roleNamePlaceholder":"e.g. Data Analyst","expertEditor.roleTitle":"Title","expertEditor.roleTitlePlaceholder":"e.g. Senior Data Analyst","expertEditor.fullName":"Full Name","expertEditor.fullNamePlaceholder":"Optional","expertEditor.titleEn":"English Title","expertEditor.titleEnPlaceholder":"Optional","expertEditor.rolePrompt":"Role Prompt","expertEditor.messagePrefix":"Message Prefix (Chinese)","expertEditor.messagePrefixPlaceholder":"e.g. As a senior data analyst, ","expertEditor.messagePrefixEn":"Message Prefix (English)","expertEditor.messagePrefixEnPlaceholder":"As a senior data analyst, ","expertEditor.actions":"Actions","expertEditor.addAction":"Add Action","expertEditor.removeAction":"Remove","expertEditor.actionName":"Action Name","expertEditor.actionNamePlaceholder":"e.g. Data Analysis","expertEditor.actionNameEn":"English Name","expertEditor.actionNameEnPlaceholder":"Optional","expertEditor.messageTemplate":"With Input \xB7 Prefix (Chinese)","expertEditor.messageTemplatePlaceholder":"Prepended to user text when user types something","expertEditor.messageTemplateEn":"With Input \xB7 Prefix (English)","expertEditor.messageTemplateEnPlaceholder":"Prepended to user text when user types something","expertEditor.defaultMessage":"No Input \xB7 Full Prompt (Chinese)","expertEditor.defaultMessagePlaceholder":"Used as-is when user sends without typing","expertEditor.defaultMessageEn":"No Input \xB7 Full Prompt (English)","expertEditor.defaultMessageEnPlaceholder":"Used as-is when user sends without typing","expertEditor.cancel":"Cancel","expertEditor.save":"Save","expertEditor.saving":"Saving...","subAgentPanel.title":"Sub-Agents","subAgentPanel.back":"Back to list","subAgentPanel.running":"Running","subAgentPanel.completed":"Completed","subAgentPanel.waitingMessages":"Waiting for messages...","subAgentPanel.toolCount":"{count} tools","subAgentPanel.toolSummary":"{count} tool calls completed","subAgentPanel.empty":"No sub-agents","subAgentPanel.emptyHint":"Sub-agents will appear here when Claude delegates tasks","splitScreen.split":"Split screen","splitScreen.closePane":"Close pane","splitScreen.newChat":"New Chat","splitScreen.noSessions":"No sessions","splitScreen.splitToPanel":"Open in new panel","splitScreen.selectFromSidebar":"Select a conversation from the sidebar","yeaft.vp.library":"VP Library","yeaft.vp.createFirst":"+ Create your first role","yeaft.vp.empty.aria":"No virtual persons yet","yeaft.vp.avatar.aria":"{name} avatar","yeaft.vp.speaker.stateCauseAria":"State change: {cause}","yeaft.vp.status.thinking":"thinking\u2026","yeaft.vp.status.tool":"using {name}","yeaft.vp.status.done":"done \xB7 {count} tools","yeaft.vp.status.aborted":"aborted","yeaft.vp.crud.title":"VP Library","yeaft.vp.crud.close":"Close","yeaft.vp.crud.addNew":"+ New role","yeaft.vp.crud.empty":"No virtual persons yet. Create your first role to start collaborating.","yeaft.vp.crud.edit":"Edit","yeaft.vp.crud.delete":"Delete","yeaft.vp.crud.deleteConfirm":'Delete "{name}"? This removes the role.md file on disk.',"yeaft.vp.crud.form.create":"Create role","yeaft.vp.crud.form.update":"Edit role","yeaft.vp.crud.form.vpId":"VP id","yeaft.vp.crud.form.vpId.tooltip":'Letters / digits / - / _ only. Cannot start with "_", cannot be all digits, cannot be one of: all, user, system, everyone.',"yeaft.vp.crud.form.displayName":"Display name (English)","yeaft.vp.crud.form.displayNameZh":"Display name (Chinese)","yeaft.vp.crud.form.description":"Capability description (English)","yeaft.vp.crud.form.descriptionZh":"Capability description (Chinese)","yeaft.vp.crud.form.descriptionPlaceholder":"e.g. API design, migration planning, and compatibility reviews","yeaft.vp.crud.form.descriptionZhPlaceholder":"\u4F8B\u5982\uFF1AAPI \u8BBE\u8BA1\u3001\u8FC1\u79FB\u89C4\u5212\u4E0E\u517C\u5BB9\u6027\u8BC4\u5BA1","yeaft.vp.crud.form.role":"Role","yeaft.vp.crud.form.rolePlaceholder":"e.g. Product Manager","yeaft.vp.crud.form.traits":"Traits","yeaft.vp.crud.form.traitsHint":"Comma-separated short tags (e.g. curious, pragmatic).","yeaft.vp.crud.form.modelHint":"Model hint","yeaft.vp.crud.form.modelHint.none":"\u2014 default \u2014","yeaft.vp.crud.form.modelHint.primary":"primary","yeaft.vp.crud.form.modelHint.fast":"fast","yeaft.vp.crud.form.persona":"Persona (markdown)","yeaft.vp.crud.form.personaPlaceholder":"Describe how this role should think, speak, and decide...","yeaft.vp.crud.form.submit":"Save","yeaft.vp.crud.form.cancel":"Cancel","yeaft.vp.crud.form.ok":"Looks good","yeaft.vp.crud.form.idLocked":"VP id cannot be changed after creation.","yeaft.vp.crud.saving":"Saving\u2026","yeaft.vp.crud.saveFailed":"Save failed: {error}","yeaft.vp.crud.deleteFailed":"Delete failed: {error}","yeaft.vp.crud.viewPrompt":"View prompt","yeaft.vp.crud.view.title":"VP prompt","yeaft.vp.crud.view.personaEmpty":"(no persona body \u2014 only metadata is defined)","yeaft.vp.crud.view.back":"Back","yeaft.vp.crud.view.editFromHere":"Edit this VP","yeaft.vp.crud.view.removed":"This VP was removed elsewhere \u2014 returning to the list.","yeaft.vp.crud.stockBadge":"Stock","yeaft.vp.crud.stockReadOnly":"Stock VPs ship with the agent and cannot be edited or deleted.","yeaft.vp.idError.empty_or_non_string":"VP id is required.","yeaft.vp.idError.too_long":"VP id is too long (max 40 characters).","yeaft.vp.idError.illegal_character":'Only letters, digits, "-" and "_" are allowed.',"yeaft.vp.idError.underscore_prefix_reserved":'VP id cannot start with "_" (reserved for system roles).',"yeaft.vp.idError.pure_digits":"VP id cannot be all digits.","yeaft.vp.idError.reserved":"VP id cannot be one of the reserved names (all, user, system, everyone).","yeaft.vp.idError.duplicate":"A role with this VP id already exists.","yeaft.vp.idError.not_found":"This VP does not exist \u2014 it may have been deleted.","yeaft.vp.idError.stock_readonly":"Stock VPs cannot be edited or deleted.","yeaft.vp.idError.unknown":"An unexpected error occurred. Please try again.","yeaft.vp.reason.personaEdit":"Persona updated","yeaft.vp.reason.traitsEdit":"Traits updated","yeaft.vp.reason.manualReload":"Reloaded","yeaft.vp.reason.fileRemoved":"Removed","yeaft.vp.reason.toast.updated":"{name}: {reason}","yeaft.vp.reason.toast.removed":"{name} was removed","yeaft.message.timeAria":"Sent at {time}","yeaft.user.youLabel":"You","yeaft.session.sidebarTitle":"Sessions","yeaft.session.sidebarAria":"Sessions section","yeaft.session.newButton":"+ New session","yeaft.session.newButtonAria":"Create a new session","yeaft.session.defaultName":"Default","yeaft.session.moreActions":"More actions","yeaft.session.archivingEllipsis":"Archiving\u2026","yeaft.session.deletingEllipsis":"Deleting\u2026","yeaft.session.renamingEllipsis":"Renaming\u2026","yeaft.session.empty":"No sessions yet.","yeaft.session.membersCount":"{count} members","yeaft.session.oneMember":"1 member","yeaft.session.noMembers":"Empty \u2014 invite a VP","yeaft.session.defaultBadge":"default","yeaft.session.archive":"Archive","yeaft.session.archiveConfirm":'Archive "{name}"? You can recover it from disk later.',"yeaft.session.delete":"Delete","yeaft.session.deleteConfirm":'Delete "{name}"? This permanently removes the session and all its data \u2014 this cannot be undone.',"yeaft.session.rename":"Rename","yeaft.session.openSettings":"Settings","yeaft.session.removeFromList":"Remove","yeaft.session.manageMembers":"Manage members","yeaft.session.memberCount.one":"1 member","yeaft.session.memberCount.other":"{count} members","yeaft.session.renamePrompt":'New name for "{name}":',"yeaft.session.editModal.renameTitle":"Rename session","yeaft.session.editModal.renameBody":'Choose a new name for "{name}".',"yeaft.session.editModal.renameSubmit":"Save","yeaft.session.editModal.archiveTitle":"Archive session","yeaft.session.editModal.archiveBody":'Archive "{name}"? You can recover it from disk later.',"yeaft.session.editModal.archiveSubmit":"Archive","yeaft.session.editModal.deleteTitle":"Delete session","yeaft.session.editModal.deleteBody":'Delete "{name}"? This permanently removes the session and all its data \u2014 this cannot be undone.',"yeaft.session.editModal.deleteSubmit":"Delete","yeaft.session.editModal.newNameLabel":"New name","yeaft.session.editModal.cancel":"Cancel","yeaft.session.editModal.close":"Close","yeaft.session.error.invalid_name":"Session name cannot be empty.","yeaft.session.error.duplicate":"A session with this id already exists.","yeaft.session.error.not_found":"Session not found.","yeaft.session.error.default_not_in_roster":"The default VP must be in the roster.","yeaft.session.error.no_default_vp":"This session has no members. Add a VP from the library to start chatting.","yeaft.session.error.reserved":"One of the selected ids is reserved (all, user, system, everyone).","yeaft.session.error.unknown":"Session operation failed: {message}","yeaft.session.error.timeout":"Session operation timed out \u2014 try again.","yeaft.session.invite.title":"Invite a VP","yeaft.session.invite.body":'"{name}" has no members yet. Add a VP from your library to start chatting.',"yeaft.session.invite.openLibrary":"Open VP Library","yeaft.session.invite.dismiss":"Not now","yeaft.session.empty.title":"Empty session","yeaft.session.empty.hint":'"{name}" has no members yet. Add a VP to start chatting.',"yeaft.session.empty.cta":"Manage members","yeaft.session.members.title":'Manage members of "{name}"',"yeaft.session.members.aria":"Session members manager","yeaft.session.members.close":"Close","yeaft.session.members.done":"Done","yeaft.session.members.empty":"No VPs available \u2014 create one in the VP Library first.","yeaft.session.members.loading":"Loading VPs\u2026","yeaft.session.members.defaultHint":"Default VP (replies when no @mention is given)","yeaft.session.members.memberCount":"{count} selected","yeaft.session.members.actionFailed":"Action failed: {error}","yeaft.session.members.openLibrary":"Open VP Library","yeaft.session.members.openLibraryHint":"Create a new VP or view a VP's prompt.","yeaft.session.announcement.label":"Announcement","yeaft.session.announcement.hintEmpty":"No announcement \u2014 click \u270F\uFE0F to add one.","yeaft.session.announcement.emptyBody":"No announcement set. Add a message that every VP in this session will see at the top of its system prompt \u2014 useful for shared context, ground rules, or a CLAUDE.md-style brief.","yeaft.session.announcement.placeholder":"Write a shared briefing for all VPs in this session\u2026","yeaft.session.announcement.edit":"Edit announcement","yeaft.session.announcement.editTitle":"Edit session announcement","yeaft.session.announcement.saving":"Saving\u2026","yeaft.session.announcement.saveFailed":"Save failed: {error}","yeaft.session.announcement.openSettings":"Open session settings","yeaft.session.settings.title":"{name} \u2014 session settings","yeaft.session.settings.short":"Session","yeaft.session.settings.close":"Close","yeaft.session.settings.nav.session":"Session","yeaft.session.settings.nav.members":"Members","yeaft.session.settings.nav.memory":"Memory","yeaft.session.settings.announcement.heading":"Session announcement","yeaft.session.settings.announcement.help":"Shared at the top of every VP's system prompt while in this session. Like a CLAUDE.md for the team.","yeaft.session.settings.members.heading":"Members","yeaft.session.settings.rename.heading":"Rename session","yeaft.session.settings.rename.label":"New name","yeaft.session.settings.rename.save":"Save name","yeaft.session.settings.rename.saving":"Saving\u2026","yeaft.session.settings.memory.heading":"Session memory","yeaft.session.settings.memory.help":"Run the dream consolidation now. Reads new messages since the last run, extracts facts, and merges them into the session's summary so the Resident layer reflects the latest conversation.","yeaft.session.settings.memory.runNow":"Run dream now","yeaft.session.settings.memory.running":"Running\u2026","yeaft.session.settings.memory.lastSuccess":"Last run {time} \u2014 {count} target(s) updated.","yeaft.session.settings.memory.lastError":"Last run failed: {error}","yeaft.session.settings.danger.heading":"Delete session","yeaft.session.settings.danger.deleteHelp":"This permanently deletes the session, removing session.json and all message history on disk. It cannot be undone.","yeaft.session.settings.danger.deleteBtn":"Delete session","yeaft.vp.mention.placeholder":"Search role by id or name\u2026","yeaft.vp.mention.noMatch":"No matching role","yeaft.vp.mention.count":"{count} mentions","yeaft.feature.reject.missing_group_id":"Message send failed: session not specified.","yeaft.feature.reject.missing_feature_id":"Message send failed: task context lost.","yeaft.feature.reject.missing_vp_id":"Message send failed: speaker not set.","yeaft.feature.reject.invalid_vp_id":"Message send failed: invalid speaker id.","yeaft.feature.reject.empty_text":"Message send failed: empty message.","yeaft.feature.reject.text_too_long":"Message send failed: text too long (max 16 KiB).","yeaft.feature.reject.unknown":"Message send failed.","yeaft.feature.pill.label":"task","yeaft.feature.messageTime.aria":"Sent at {time}","yeaft.vp.turnBlock.elapsedTitle":"Time elapsed since this turn started","yeaft.vp.turnBlock.retryingRequest":"Response stalled; retrying with a fresh request ({attempt}/{max})","yeaft.vp.turnBlock.retryingContinue":"Response stalled; continuing with a fresh request ({attempt}/{max})","yeaft.sessionStatus.aria":"Session status","yeaft.sessionStatus.title":"Session status","yeaft.sessionStatus.announcement":"Announcement","yeaft.sessionStatus.announcementEmpty":"No announcement","yeaft.sessionStatus.announcementAdd":"Add announcement","yeaft.sessionStatus.announcementEdit":"Edit announcement","yeaft.sessionStatus.vps":"VPs","yeaft.sessionStatus.backgroundTasks":"Background tasks","yeaft.sessionStatus.noLogPreview":"No log output yet.","yeaft.sessionStatus.task.subAgentStarted":"{name} started","yeaft.sessionStatus.task.subAgentStartedWithMission":"{name} started: {mission}","yeaft.sessionStatus.task.subAgentStatus":"{name} is {status}","yeaft.sessionStatus.task.subAgentStatusUpdated":"{name} status updated","yeaft.sessionStatus.task.subAgentResult":"{name} result: {text}","yeaft.sessionStatus.task.subAgentProducedResult":"{name} produced a result","yeaft.sessionStatus.task.subAgentUsedTool":"{name} used {tool}","yeaft.sessionStatus.task.subAgentFinishedTool":"{name} finished {tool}","yeaft.sessionStatus.task.subAgentUsage":"{name} used {tokens} tokens","yeaft.sessionStatus.task.subAgentEvent":"{name}: {text}","yeaft.sessionStatus.task.subAgentUserPrompt":"You: {text}","yeaft.sessionStatus.task.subAgentToolSummary":"{count} tool calls completed","yeaft.sessionStatus.task.subAgentError":"{name} error: {error}","yeaft.sessionStatus.task.subAgentHitError":"{name} hit an error","yeaft.sessionStatus.task.subAgentNoReadableEvents":"No readable sub-agent activity yet.","yeaft.sessionStatus.task.promptPlaceholder":"Add guidance for this sub-agent\u2026","yeaft.sessionStatus.task.promptSend":"Send","yeaft.sessionStatus.task.promptSending":"Sending\u2026","yeaft.sessionStatus.task.promptFailed":"Failed to send prompt.","yeaft.sessionStatus.task.title":"Task","yeaft.sessionStatus.task.command":"Command","yeaft.sessionStatus.task.stop":"Stop task","yeaft.sessionStatus.task.stopping":"Stopping\u2026","yeaft.sessionStatus.task.kind.subAgent":"sub-agent","yeaft.sessionStatus.task.kind.shell":"shell","yeaft.sessionStatus.show":"Show Session status","yeaft.sessionStatus.hide":"Hide Session status","yeaft.sessionStatus.close":"Close Session status","yeaft.vpTimeline.empty":"No VPs in this Session yet.","yeaft.vpTimeline.resizeTitle":"Drag to resize","yeaft.vpTimeline.status.idle":"idle","yeaft.vpTimeline.status.typing":"typing\u2026","yeaft.vpTimeline.status.thinking":"thinking\u2026","yeaft.vpTimeline.status.retrying":"retrying request\u2026","yeaft.vpTimeline.status.streaming":"streaming","yeaft.vpTimeline.status.tool":"using tool\u2026","yeaft.vpTimeline.status.error":"error","yeaft.vpTimeline.status.offline":"offline","yeaft.vpTimeline.abort":"Abort","yeaft.vpTimeline.edit":"Edit VP","yeaft.vpTimeline.mention":"Click to @-mention this VP","yeaft.vpTimeline.expand":"Toggle task details","yeaft.toolStats.title":"Tool Usage Stats","yeaft.toolStats.refresh":"Refresh","yeaft.toolStats.close":"Close","yeaft.toolStats.tabAll":"All tools","yeaft.toolStats.tabUnused":"Unused","yeaft.toolStats.loading":"Loading\u2026","yeaft.toolStats.notLoaded":"No data yet \u2014 click refresh.","yeaft.toolStats.empty":"(no tool calls recorded yet)","yeaft.toolStats.noneUnused":"(every registered tool has been called at least once)","yeaft.toolStats.fetchedAt":"Fetched at","yeaft.toolStats.col.name":"Tool","yeaft.toolStats.col.calls":"Calls","yeaft.toolStats.col.errors":"Errors","yeaft.toolStats.col.errRate":"Err%","yeaft.toolStats.col.p50":"p50","yeaft.toolStats.col.p95":"p95","yeaft.toolStats.col.avg":"Avg","yeaft.toolStats.col.last":"Last","yeaft.toolStats.buttonLabel":"Tool Stats","workCenter.title":"Work Center","workCenter.subtitle":"Persistent work owned by this Agent","workCenter.agent":"Agent","workCenter.selectAgent":"Select Agent","workCenter.noOnlineAgents":"No online agents","workCenter.noAvailableAgents":"No compatible online Agents","workCenter.new":"New","workCenter.newWorkItem":"New work item","workCenter.workItem":"Work item","workCenter.createFirst":"Create first work item","workCenter.backToChat":"Back to chat","workCenter.refresh":"Refresh","workCenter.search":"Search work items","workCenter.filter":"Filter","workCenter.filterAttention":"Needs attention","workCenter.filterActive":"Active","workCenter.filterAll":"All","workCenter.filterDone":"Done","workCenter.attentionItems":"Needs attention","workCenter.board.active":"Active","workCenter.board.needsAttention":"Needs attention","workCenter.board.closed":"Closed","workCenter.board.emptyLane":"No work items","workCenter.board.lanes":"Work item lanes","workCenter.filterVp":"Filter by VP","workCenter.filterType":"Filter by type","workCenter.filterUpdated":"Filter by update time","workCenter.allVps":"All VPs","workCenter.allTypes":"All types","workCenter.anyTime":"Any time","workCenter.lastDay":"Last 24 hours","workCenter.lastWeek":"Last 7 days","workCenter.deleteWorkItem":"Delete Work Item","workCenter.deleteConfirm":"Permanently delete this Work Item, its execution history, and attachments?","workCenter.deleteRequiresStop":"Stop this Work Item before deleting it","workCenter.lastMonth":"Last 30 days","workCenter.assignment.planned":"Planned assignment","workCenter.created":"Created","workCenter.files":"files","workCenter.loadMore":"Load more","workCenter.activeItems":"Active work","workCenter.allItems":"All work items","workCenter.completedItems":"Completed","workCenter.watcherActive":"Watcher active","workCenter.loading":"Loading work items\u2026","workCenter.noTimestamp":"No timestamp","workCenter.updated":"Updated","workCenter.emptyTitle":"No work items yet","workCenter.emptyBody":"Create a persistent task when work must continue beyond one conversation turn.","workCenter.noAttentionTitle":"Nothing needs attention","workCenter.noAttentionBody":"Work Items waiting for you or needing recovery will appear here.","workCenter.noActiveTitle":"No active work items","workCenter.noActiveBody":"Draft, ready, and running Work Items will appear here.","workCenter.noCompletedTitle":"No completed work items","workCenter.noCompletedBody":"Completed work items will appear here.","workCenter.noMatchesTitle":"No matching work items","workCenter.noMatchesBody":"Try a different search or filter.","workCenter.selectTitle":"Work item details","workCenter.detailLoading":"Loading full details\u2026","workCenter.detailLoadFailed":"Could not load full details","workCenter.start":"Start","workCenter.retry":"Retry","workCenter.cancel":"Cancel","workCenter.closeWorkItem":"Close details","workCenter.cancelWorkItem":"Stop work item","workCenter.cancelWorkItemHint":"Stop this Work Item and all unfinished Actions.","workCenter.cancelConfirm":"Stop this work item and its unfinished Actions?","workCenter.stopWorkItem":"Stop work item","workCenter.resumeWorkItem":"Resume work item","workCenter.breadcrumbs":"Work Center navigation","workCenter.actionNumber":"Action {number}","workCenter.actionBreadcrumb":"Action {number}: {description}","workCenter.untitledAction":"Untitled Action","workCenter.workItems":"Work items","workCenter.description":"Description","workCenter.goal":"Goal","workCenter.acceptanceCriteria":"Acceptance criteria","workCenter.noCriteria":"No criteria provided","workCenter.failureReason":"Failure reason","workCenter.workflow":"Workflow","workCenter.actionFlow":"Action flow","workCenter.actionCount":"{count} Actions","workCenter.noActionSummary":"No summary yet","workCenter.actionProgress":"{completed} / {total} Actions","workCenter.currentAction":"Current Action","workCenter.expandActions":"Show Actions","workCenter.collapseActions":"Collapse","workCenter.actionObjective":"What to do","workCenter.actionApproach":"How to do it","workCenter.actionExpectedOutcome":"Expected result","workCenter.dependencies":"Dependencies","workCenter.actionResult":"Latest result","workCenter.currentProgress":"Current progress","workCenter.actionMessages":"Messages","workCenter.loops":"loops","workCenter.tools":"tools","workCenter.noActionMessages":"No messages yet.","workCenter.actionDetails":"Action details","workCenter.selectAction":"Select an Action to inspect its execution","workCenter.backToWorkItems":"Work items","workCenter.backToActions":"Actions","workCenter.you":"You","workCenter.noRequestDetails":"No execution records are available for this Action yet.","workCenter.loadingRequests":"Loading execution records\u2026","workCenter.loadingRequestDetail":"Loading tool evidence\u2026","workCenter.requestDetailUnavailable":"Tool evidence is unavailable. Try again.","workCenter.noRequestLoops":"This execution has no retained Loop details.","workCenter.requestDetailTruncated":"Large execution: {summarized} Loops are summarized and {omitted} older Loops are omitted.","workCenter.loopDetailTruncated":"Large Loop: showing retained tool evidence.","workCenter.loadEarlierMessages":"Load earlier messages","workCenter.loadingEarlierMessages":"Loading earlier messages\u2026","workCenter.unknownModel":"Unknown model","workCenter.loop":"Loop","workCenter.actionBrief":"Task brief","workCenter.executionSummary":"Execution summary","workCenter.toolParameters":"Parameters","workCenter.toolResult":"Result","workCenter.noToolCalls":"No tool calls in this Loop.","workCenter.actionInputPlaceholder":"Add context, answer a question, or redirect this Action","workCenter.actionInputResumeHint":"Your input resumes this Action with the additional context.","workCenter.waitingQuestionTitle":"Input required","workCenter.actionInputRetryHint":"Add instructions or files, then rerun this Action with the new context.","workCenter.actionInputContinueHint":"Direct intervention for this Action only.","workCenter.actionFailedTitle":"Why this Action failed","workCenter.failedAt":"Failed at","workCenter.actionFailureRecovery":"Add corrected instructions or files below to rerun this Action. The Execution view shows retained tool evidence.","workCenter.sendInput":"Send to Action","workCenter.sendingInput":"Sending\u2026","workCenter.retryAction":"Retry Action","workCenter.sendAndRetryAction":"Send and retry Action","workCenter.coordinatorDecision.guide_actions":"Action instructions updated","workCenter.coordinatorDecision.replan":"Goal or plan updated","workCenter.coordinatorDecision.request_human":"Human input requested","workCenter.conversation":"Conversation","workCenter.conversationThinking":"Working\u2026","workCenter.conversationReadOnly":"This work item is closed. The conversation remains available.","workCenter.conversationPlaceholder":"Message about this work item","workCenter.sendMessage":"Send message","workCenter.assistant":"Yeaft","workCenter.originalRequest":"Original request","workCenter.actionMessageScopeTitle":"Message this Action","workCenter.actionMessageScope":"Only this Action receives the message.","workCenter.actionConversation":"Conversation","workCenter.actionConversationWith":"Action executor","workCenter.actionViews":"Action views","workCenter.actionExecutor":"Executor","workCenter.actionExecutorPending":"Executor pending","workCenter.actionInformation":"Action information","workCenter.messageExecutor":"Message {name}","workCenter.actionChatPlaceholder":"Message {name} about this Action","workCenter.statusLabel":"Status","workCenter.llmRequestsLabel":"LLM requests","workCenter.loopsLabel":"Loops","workCenter.toolsLabel":"Tools","workCenter.tokensLabel":"Tokens","workCenter.workItemMessagePlaceholder":"Add direction for the whole Work Item","workCenter.sendWorkItemMessage":"Send to Work Item","workCenter.fromSession":"Create a work item from this Session","workCenter.llmRequestCount":"{count} LLM requests","workCenter.loopCount":"{count} loops","workCenter.toolCount":"{count} tools","workCenter.tokenCount":"{count} tokens","workCenter.tokenBreakdown":"{input} input / {output} output / {cache} cached","workCenter.guidance":"Add guidance to the current Action","workCenter.guidanceHint":"Clarify constraints or redirect the current Action","workCenter.guidanceRestartHint":"This restarts the current Action with the new guidance.","workCenter.sendGuidance":"Send guidance","workCenter.reuseMemory":"Use relevant Agent memory and completed work from this project","workCenter.reuseMemoryHelp":"Includes scope-bounded Agent memory plus structured summaries and evidence from completed WorkItems with the same canonical project directory. Raw tool output is not reused.","workCenter.resumeAnswer":"Answer the waiting question","workCenter.resumeAnswerHint":"Provide the information required to continue","workCenter.answerInActionDetail":"Open the current Action and respond in the input below.","workCenter.selectPrompt":"Select a work item to inspect its workflow.","workCenter.createHint":"Describe what you need. Triage will turn it into a goal, acceptance criteria, and Actions.","workCenter.requirement":"Requirement","workCenter.requirementHint":"Describe the problem, desired outcome, and any constraints in your own words","workCenter.requirementHelp":"Triage will generate the title, goal, acceptance criteria, type, and execution plan.","workCenter.titleField":"Title","workCenter.titleHint":"A short, specific outcome","workCenter.goalHint":"Describe the result the Agent must deliver","workCenter.criteriaHint":"One criterion per line","workCenter.attachments":"Attachments","workCenter.attachmentsHelp":"Images, PDFs, and text files stay bound to this Work Item and are available to every Action.","workCenter.attachmentsUnsupported":"The selected Agent does not support Work Item attachments.","workCenter.addAttachments":"Add files","workCenter.attachmentsUploading":"Uploading\u2026","workCenter.attachmentsUploadFailed":"Attachment upload failed","workCenter.removeAttachment":"Remove from draft","workCenter.previewAttachment":"Open attachment","workCenter.openAttachmentNamed":"Open attachment {name}","workCenter.openingAttachment":"Opening attachment\u2026","workCenter.attachmentPreviewFailed":"Could not open the attachment. Try again.","workCenter.attachmentOpenBlocked":"The browser blocked the attachment window. Allow pop-ups and try again.","workCenter.execution":"Execution","workCenter.executionHint":"Choose where and how this work item starts.","workCenter.workDir":"Working directory","workCenter.workDirHint":"Choose an existing project directory","workCenter.chooseFolder":"Choose folder","workCenter.workDirPickerHelp":"Select an existing folder on the chosen Agent.","workCenter.folderPickerHint":"Choose the project folder this Work Item can read and modify.","workCenter.folderPickerSelectionHint":"Double-click to open a folder, or select it and confirm.","workCenter.startImmediately":"Start immediately","workCenter.startImmediatelyHint":"Turn this off to create a draft you can review first.","workCenter.creating":"Creating\u2026","workCenter.create":"Create","workCenter.status.draft":"draft","workCenter.status.ready":"ready","workCenter.status.running":"running","workCenter.status.waiting":"waiting","workCenter.status.needs_attention":"needs attention","workCenter.status.done":"done","workCenter.status.cancelled":"cancelled","workCenter.status.completed":"completed","workCenter.status.failed":"failed","workCenter.status.superseded":"superseded","workCenter.action.triage":"Triage","workCenter.action.implement":"Implement","workCenter.action.review":"Review","workCenter.action.integrate":"Integrate","workCenter.action.deliver":"Deliver","workCenter.action.test":"Test","workCenter.action.research":"Research","workCenter.action.design":"Design","workCenter.action.diagnose":"Diagnose","workCenter.action.migrate":"Migrate","workCenter.action.document":"Document","workCenter.action.operate":"Operate","workCenter.action.write":"Write","workCenter.action.custom":"Custom","workCenter.assignment.auto":"Use workflow policy","workCenter.model.inherit":"Use workflow model","workCenter.model.defaultProvider":"default provider","workCenter.planPreview":"Execution plan","workCenter.planPreviewHelp":"Resolved from this Agent\u2019s VP pool and model settings.","workCenter.settings.title":"Work Center settings","workCenter.settings.subtitle":"Configure the Coordinator plus reusable Action prompts, models, and effort for AI-planned work.","workCenter.settings.workflow":"Workflow","workCenter.settings.workflowHelp":"Triage chooses the task-specific Actions and executors dynamically.","workCenter.settings.aiWorkflowHelp":"Triage classifies each WorkItem and creates a validated flow of 1\u20138 task-specific Actions. Built-in Action policies are reusable defaults; triage may create a precise domain type when needed.","workCenter.settings.globalInstructions":"Global Agent instructions","workCenter.settings.globalInstructionsHint":"Example: Follow the repository release policy, require independent review, and never create deployment tags without explicit approval.","workCenter.settings.globalInstructionsHelp":"Stored at Agent level and frozen into every new WorkItem. Applied to triage and every generated Action, below the WorkItem contract and system/tool safety rules. Existing WorkItems keep their original snapshot.","workCenter.settings.actionPolicies":"Built-in Action policies","workCenter.settings.actionPoliciesHelp":"These are reusable execution baselines, not a fixed workflow. Unknown domain-specific Action types use the Custom policy plus their triage-generated type and objective.","workCenter.settings.dynamicInstructionHelp":"The AI adds the WorkItem contract, global instructions, prior Action context, memory, and a task-specific objective. This prompt defines the reusable behavior for this Action type.","workCenter.settings.models":"Models","workCenter.settings.modelsHelp":"Providers and credentials stay in Agent LLM settings. Work Center only selects available models.","workCenter.settings.dynamicModelsHelp":"Choose the Coordinator model separately from the models that execute Actions.","workCenter.settings.coordinatorModel":"Coordinator","workCenter.settings.coordinatorModelHelp":"Used for Work Item conversation, goal changes, and replanning. It never executes repository tools.","workCenter.settings.allActions":"Fallback for all Actions","workCenter.settings.maxConcurrentActions":"Maximum concurrent Actions","workCenter.settings.maxConcurrentActionsHelp":"Defaults to 3. Non-Git, dirty, shared, and integration work remains serial.","workCenter.workItemType":"Type","workCenter.typeAuto":"Auto \u2014 let the LLM infer","workCenter.typeHelp":"Choose a task category, or use Auto for AI inference. AI still plans the concrete Actions.","workCenter.planning":"Planning","workCenter.aiPlan":"AI-planned execution","workCenter.aiPlanHelp":"Triage chooses the task type, Actions, executors, and the smallest reliable flow. Work Center settings control model and effort.","workCenter.settings.manageProviders":"Manage Agent models","workCenter.settings.assignment":"VP selection","workCenter.settings.assignment.auto":"Auto from all VPs","workCenter.settings.assignment.pool":"Candidate pool","workCenter.settings.assignment.fixed":"Fixed VP","workCenter.settings.capability":"Required capability","workCenter.settings.vp":"Virtual Person","workCenter.settings.poolMembers":"Candidate VPs","workCenter.settings.modelPolicy":"Model policy","workCenter.settings.model.inherit":"Inherit from VP","workCenter.settings.model.primary":"Agent primary model","workCenter.settings.model.fast":"Agent fast model","workCenter.settings.model.specific":"Specific model","workCenter.settings.model":"Model","workCenter.settings.effort":"Reasoning effort","workCenter.settings.effortDefault":"Model default","workCenter.settings.effortHelp":"Overrides the selected model\u2019s default reasoning effort for every Work Center Action.","workCenter.settings.effortChooseModelHelp":"Select the Agent primary model, fast model, or a specific model to configure effort. Inherit from VP uses each VP\u2019s model default.","workCenter.settings.effortUnsupportedHelp":"The selected model does not expose configurable effort, so its model default is used.","workCenter.settings.saving":"Saving\u2026","workCenter.settings.reload":"Reload settings","workCenter.settings.conflict":"Settings changed elsewhere. Reload before saving again.","workCenter.settings.upgradeRequired":"This Agent version cannot save Work Center settings. The current values are shown read-only; upgrade the Agent to edit and save them.","workCenter.settings.saveNotConfirmed":"The Agent did not confirm the submitted prompts and model policy. Settings were not closed; reload or upgrade the Agent before trying again.","workCenter.settings.addWorkflow":"Duplicate workflow","workCenter.settings.removeWorkflow":"Remove","workCenter.settings.newWorkflow":"Workflow {index}","workCenter.settings.workflowName":"Workflow name","workCenter.settings.newStage":"New stage","workCenter.settings.addStage":"Add stage","workCenter.settings.removeStage":"Remove stage","workCenter.settings.moveUp":"Move stage up","workCenter.settings.moveDown":"Move stage down","workCenter.settings.stageType":"Stage type","workCenter.settings.reviewReturnStage":"Return to stage when changes are requested","workCenter.settings.instruction":"Stage prompt","workCenter.settings.instructionHint":"Define what this stage must do.","workCenter.settings.instructionHelp":"The WorkItem goal, acceptance criteria, and reusable context are added automatically at run time.","workCenter.settings.instructionReset":"Restore default"}});function Eo(){return typeof navigator>"u"||!navigator?"":navigator.userAgent||""}function Rs(){let e=Eo();return/Android|iPhone|iPad|iPod|Windows Phone|IEMobile|BlackBerry|Opera Mini/i.test(e)}function ki(){return/MicroMessenger/i.test(Eo())}function Si(){return/AlipayClient/i.test(Eo())}var Lo=H(()=>{});var Bd,Wd=H(()=>{ct();St();Lo();Bd={name:"LoginPage",template:`
14
+ The agent will restart after upgrading.`,"chat.agent.alreadyLatest":"Agent is already at the latest version (v{version}), no upgrade needed.","chat.agent.nodeIncompatible":"Agent upgrade aborted: target version v{version} requires Node {required}, but this machine is running Node {current}. Please upgrade Node.js first, then retry.","chat.agent.online":"{count} Agent(s) online","chat.agent.selectFirst":"Please select an Agent first","chat.agent.yeaft":"Yeaft Chat","sidebar.toggle.chat":"Switch to Chat","sidebar.toggle.yeaft":"Switch to Yeaft","sidebar.surface.label":"Sidebar view","sidebar.surface.sessions":"Sessions","sidebar.provider.label":"Session provider","sidebar.provider.claude":"Claude","sidebar.sessions.new":"New session","sidebar.sessions.emptyProvider":"No sessions for this provider","yeaft.back":"Back","yeaft.session.people":"People","yeaft.session.peopleEmpty":"No people","yeaft.session.runningTasks":"Running tasks","yeaft.session.tasksEmpty":"No running tasks","yeaft.session.owner":"Owner","yeaft.session.started":"Started","yeaft.breadcrumb.label":"Thread filter","yeaft.breadcrumb.mainStream":"Main stream","yeaft.breadcrumb.backHint":"Return to full stream (Esc)","yeaft.featureDetail.ariaLabel":"Task detail","yeaft.featureDetail.replyTo":"Reply in:","yeaft.featureDetail.forkHint":"No active thread \u2014 fork a new one to reply.","yeaft.featureDetail.empty":"No messages for this task yet.","yeaft.featureDetail.threadPillHint":"Open thread","yeaft.featureDetail.summary.aria":"Task summary timeline","yeaft.featureDetail.summary.title":"Summary timeline","yeaft.featureDetail.summary.loading":"Loading summary history\u2026","yeaft.featureDetail.summary.empty":"No summaries yet.","yeaft.featureDetail.summary.error":"Summary history failed: {error}","yeaft.featureDetail.summary.showArchived":"Show archived","yeaft.featureDetail.related.aria":"Related tasks","yeaft.featureDetail.related.title":"Related tasks","yeaft.featureDetail.related.unlink":"Unlink","yeaft.featureDetail.members.aria":"Task members","yeaft.featureDetail.members.title":"Members","yeaft.featureDetail.members.abort":"Abort","yeaft.featureDetail.members.kick":"Kick","yeaft.model":"Model","yeaft.placeholder":"Ask anything...","yeaft.inbox":"Inbox","yeaft.inbox.tooltip":"Your default thread \u2014 one-on-one chat with Yeaft. New threads can be created for specific topics or tasks.","yeaft.sidebar.activeThreads":"Active","yeaft.sidebar.idleThreads":"Idle","yeaft.sidebar.archivedThreads":"Archived","yeaft.sidebar.tasks":"Tasks","yeaft.sidebar.emptyActive":"No active threads","yeaft.sidebar.emptyIdle":"No idle threads","yeaft.sidebar.emptyArchived":"No archived threads","yeaft.sidebar.emptyTasks":"No tasks match","yeaft.sidebar.results":"Results","yeaft.sidebar.resultsThreads":"Threads","yeaft.sidebar.kindThread":"thread","yeaft.sidebar.cancel":"Cancel","yeaft.sidebar.mergeInto":"Merge into\u2026","yeaft.sidebar.mergeNoCandidates":"No other threads to merge into","yeaft.sidebar.mergeConfirmTitle":"Merge this thread?","yeaft.sidebar.mergeIrreversible":"This cannot be undone. The source thread will be archived and its messages moved to the target.","yeaft.sidebar.mergeConfirm":"Merge","yeaft.settings.sidebarV2":"Experimental: Sidebar V2","yeaft.settings.sidebarV2Hint":"Thread list + task tree (preview).","yeaft.clearConfirm":"Clear all messages?","yeaft.mode":"Mode","yeaft.agent":"Agent","yeaft.connecting":"Connecting...","yeaft.ready":"Ready","yeaft.tools":"tools","yeaft.skills":"skills","yeaft.mcp":"MCP","yeaft.showSidebar":"Show sidebar","yeaft.hideSidebar":"Hide sidebar","yeaft.debug":"Debug","yeaft.debugClose":"Close debug panel","yeaft.debugTurns":"turns","yeaft.debugTabToolStats":"Tool Stats","yeaft.debugTabDream":"Dream","yeaft.debugTabRequestLog":"Request Log","yeaft.debugHistoryLoad":"Load request history","yeaft.debugHistoryLoading":"Loading...","yeaft.debugHistoryLoaded":"{count} loaded","yeaft.debugSearchPlaceholder":"Regex search request logs","yeaft.debugSearchHint":"Shows the latest 10 globally by default; search matches request summaries across Sessions.","yeaft.dreamDebug.title":"Dream lifecycle","yeaft.dreamDebug.trigger":"Trigger","yeaft.dreamDebug.status":"Status","yeaft.dreamDebug.started":"Started","yeaft.dreamDebug.finished":"Finished","yeaft.dreamDebug.time":"Time","yeaft.dreamDebug.phase":"Phase","yeaft.dreamDebug.call":"Call","yeaft.dreamDebug.location":"Location","yeaft.dreamDebug.result":"Result","yeaft.dreamDebug.noLatest":"No dream check has been recorded for this session yet.","yeaft.dreamDebug.noEvents":"No dream events yet for this session.","yeaft.dreamDebug.outputTitle":"Dream output loaded for this session","yeaft.dreamDebug.scope":"Scope","yeaft.dreamDebug.lastDream":"Last dream","yeaft.dreamDebug.messagesCovered":"Messages covered","yeaft.dreamDebug.noOutput":"No dream output has been written for this session yet.","yeaft.dreamDebug.promptLoadTitle":"Dream memory loaded into system prompt","yeaft.dreamDebug.loadedInto":"Loaded into","yeaft.dreamDebug.vp":"VP","yeaft.dreamDebug.summaryToPrompt":"summary.md -> system prompt","yeaft.dreamDebug.itemList":"Dream runs and scopes","yeaft.dreamDebug.searchPlaceholder":"Search Dream sessions by title, id, or summary...","yeaft.dreamDebug.noSearchResults":"No Dream sessions match this search.","yeaft.dreamDebug.noSummary":"No summary available","yeaft.dreamDebug.segments":"segments","yeaft.dreamDebug.lastError":"Last error","yeaft.dreamDebug.overview":"Overview","yeaft.dreamDebug.sessionId":"Session ID","yeaft.dreamDebug.loadedAt":"Loaded at","yeaft.dreamDebug.layers":"Layers","yeaft.dreamDebug.summaryLayer":"Resident summary","yeaft.dreamDebug.noPromptLoad":"No prompt-load record is available for this scope.","yeaft.dreamDebug.segmentTitle":"Segments","yeaft.dreamDebug.sourceMessages":"Source messages","yeaft.dreamDebug.createdAt":"Created","yeaft.dreamDebug.updatedAt":"Updated","yeaft.dreamDebug.noSegments":"No memory segments are available for this scope.","yeaft.dreamDebug.requestResponse":"Request / Response","yeaft.dreamDebug.noRequestResponse":"No Dream request/response log has been persisted for this scope yet.","yeaft.dreamDebug.empty":"No Dream debug data has been recorded yet.","yeaft.debugGroupFollowMain":"Follow main pane","yeaft.debugGroupAll":"All sessions","yeaft.debugAssistantResponse":"Assistant response","yeaft.debugViewAssistantResponse":"View response","yeaft.debugToolInput":"Input","yeaft.debugToolResult":"Result","yeaft.debugToolRunning":"running","yeaft.debugToolRunningNoResult":"Running; no result yet","yeaft.debugShowDetails":"show","yeaft.debugHideDetails":"hide","yeaft.debugTurnStartedAt":"turn started at","yeaft.debugRequestAt":"request time","yeaft.debugRequestAtDerived":"derived from turn start (legacy loop)","yeaft.turn":"Turn {n}","yeaft.systemPrompt":"System Prompt","yeaft.messagesLabel":"Messages","yeaft.response":"Response","yeaft.toolCalls":"Tool Calls","yeaft.functionCalls":"Function Calls","yeaft.request":"Request","yeaft.pending":"(pending)","yeaft.inputTokens":"Input","yeaft.outputTokens":"Output","yeaft.duration":"Duration","yeaft.noDebugData":"No debug data yet","yeaft.showDebug":"Show debug panel","yeaft.hideDebug":"Hide debug panel","yeaft.reloadPage":"Reload page","yeaft.reloadMessages":"Reload messages","yeaft.historySearch.label":"Search Session history","yeaft.historySearch.button":"Search messages","yeaft.historySearch.placeholder":"Search messages in this Session","yeaft.historySearch.searching":"Searching\u2026","yeaft.historySearch.minChars":"Type at least 2 characters","yeaft.historySearch.empty":"No matching messages","yeaft.historySearch.error":"Search failed. Try again.","yeaft.historySearch.unsupported":"Upgrade this Agent to search Session history.","yeaft.historySearch.more":"Load more results","yeaft.historySearch.you":"You","yeaft.historySearch.assistant":"Assistant","yeaft.outline.label":"Message history","yeaft.outline.sender":"Sender","yeaft.outline.allSenders":"All senders","yeaft.outline.title":"Message history","yeaft.outline.placeholder":"Search this conversation","yeaft.outline.searching":"Searching\u2026","yeaft.outline.loading":"Loading\u2026","yeaft.outline.older":"Load older messages","yeaft.outline.moreMatches":"Load more matches","yeaft.outline.minChars":"Type at least 2 characters","yeaft.outline.empty":"No messages yet","yeaft.outline.noMatches":"No matching messages","yeaft.outline.error":"Could not load the outline. Try again.","yeaft.outline.unsupported":"Upgrade this Agent to use the conversation outline.","yeaft.outline.you":"You","yeaft.outline.assistant":"Assistant","yeaft.outline.nonText":"Non-text response","yeaft.switchModel":"Switch model","yeaft.modelMenu.title":"Model and LLM settings","yeaft.modelMenu.label":"Model","yeaft.modelMenu.effort":"Effort","yeaft.modelMenu.effort.openaiReasoning":"Reasoning effort","yeaft.modelMenu.effort.anthropicBudget":"Thinking budget","yeaft.modelMenu.effort.anthropicAdaptive":"Adaptive thinking effort","yeaft.modelMenu.effort.minimal":"Minimal","yeaft.modelMenu.effort.low":"Low","yeaft.modelMenu.effort.medium":"Medium","yeaft.modelMenu.effort.high":"High","yeaft.modelMenu.effort.xhigh":"X-High","yeaft.modelMenu.effort.max":"Max","yeaft.modelMenu.noEffort":"This model does not expose a compatible effort control.","yeaft.modelMenu.configureHint":"Providers, keys, model list","yeaft.settings.title":"Settings","settings.yeaft.tabs.vp":"VP Library","settings.yeaft.tabs.search":"Search","settings.yeaft.tabs.mcp":"MCP","yeaft.settings.tabs.vp":"VP Library","yeaft.settings.tabs.search":"Search","yeaft.settings.tabs.mcp":"MCP","settings.mcp.title":"MCP servers","settings.mcp.description":"Connect Model Context Protocol servers to extend Yeaft with extra tools. Servers are stored in ~/.yeaft/config.json on the agent; tools appear in the LLM's catalogue as mcp__<server>__<tool>.","settings.mcp.reloadAll":"Reload all","settings.mcp.reloadOne":"Reconnect this server","settings.mcp.loading":"Working\u2026","settings.mcp.connected":"connected","settings.mcp.disconnected":"disconnected","settings.mcp.tools":"tools","settings.mcp.remove":"Remove","settings.mcp.empty":"No MCP servers configured yet. Add one below.","settings.mcp.addServer":"Add server","settings.mcp.addServerDesc":"Most MCP servers run as a local command \u2014 Yeaft launches it via stdio and discovers its tools.","settings.mcp.serverName":"Name","settings.mcp.command":"Command","settings.mcp.args":"Arguments","settings.mcp.argsPlaceholder":"e.g. -y @modelcontextprotocol/server-filesystem /tmp","settings.mcp.env":"Environment","settings.mcp.envPlaceholder":"KEY=value per line. Lines starting with # are ignored.","settings.mcp.saving":"Saving\u2026","settings.mcp.add":"Add","settings.mcp.cancel":"Clear","settings.mcp.connectFailed":"Saved but failed to connect","settings.mcp.addSuccess":"Server added","settings.mcp.removeSuccess":"Server removed","settings.mcp.reloadSuccess":"Reload requested","settings.mcp.confirmRemove":'Remove MCP server "{name}"? Its tools will disappear from the next LLM turn.',"settings.mcp.errors.nameRequired":"Name is required","settings.mcp.errors.nameFormat":"Name must be lowercase letters, digits, dashes or underscores only","settings.mcp.errors.commandRequired":"Command is required","settings.mcp.errors.argsParse":"Could not parse arguments","settings.mcp.errors.envParse":"Could not parse environment","search.settings.backendTitle":"Search backend","search.settings.backendDesc":"Choose the primary backend for the WebSearch tool. If the primary fails, the engine automatically falls back to HTML scraping.","search.settings.backend.tavily":"Tavily","search.settings.backend.tavilyHint":"Hosted search API. Free tier: 1000 queries/month. Recommended.","search.settings.backend.playwright":"Playwright service","search.settings.backend.playwrightHint":"Self-hosted browser-based search/fetch. Best for cloud IPs that get bot-blocked. Service not yet shipped.","search.settings.comingSoon":"Coming soon","search.settings.tavilyKeyTitle":"Tavily API key","search.settings.tavilyKeyDesc":"Stored on the agent in ~/.yeaft/config.json. Get a free key at","search.settings.tavilyKeyUnchanged":"(unchanged)","search.settings.clearKey":"Clear","search.settings.usageTitle":"Usage this month","search.settings.usageRefresh":"Refresh","search.settings.usageLoading":"Loading\u2026","search.settings.usagePlan":"Plan","search.settings.usageUsed":"Used","search.settings.usagePaygo":"Pay-as-you-go","search.settings.usageError":"Failed to load usage","search.settings.save":"Save","search.settings.saving":"Saving\u2026","search.settings.saveSuccess":"Saved","search.settings.cancel":"Reset","yeaft.settings.yeaftTitle":"Thread Concurrency & Archive","yeaft.settings.yeaftDesc":"Tune how many threads can run at once and when idle threads are auto-archived.","yeaft.settings.maxConcurrentLabel":"Max concurrent threads","yeaft.settings.maxConcurrentHint":"Maximum number of live threads at once (includes the always-on main thread). New threads beyond this cap are refused until an existing thread is archived or terminated. Range: 1-50.","yeaft.settings.archiveIdleDaysLabel":"Auto-archive idle threads after (days)","yeaft.settings.archiveIdleDaysHint":"Threads with no activity for this many days will be archived. Range: 1-3650.","yeaft.settings.yeaftSaveBtn":"Save","yeaft.settings.yeaftSaving":"Saving...","yeaft.settings.yeaftSaved":"Saved","yeaft.settings.yeaftLoading":"Loading...","yeaft.settings.yeaftLoadError":"Failed to load Yeaft settings","yeaft.settings.yeaftSaveError":"Failed to save Yeaft settings","yeaft.settings.rangeErrorConcurrent":"Must be between 1 and 50","yeaft.settings.rangeErrorArchive":"Must be between 1 and 3650","chat.session.creating":"Creating conversation...","chat.session.loadingHistory":"Loading conversation history...","yeaft.historyLoad.error":"Conversation history could not be loaded. Your messages are still stored on the Agent.","yeaft.historyLoad.retry":"Retry loading","yeaft.sessionInventory.error":"Sessions could not be loaded. Your conversations are still stored on the Agent.","yeaft.sessionInventory.retry":"Retry Sessions","chat.session.closed":"Conversation closed","chat.session.agentOffline":"Agent is offline. This session will be available when the agent reconnects.","chat.execution.cancelled":"Execution cancelled","chat.sidebar.expand":"Expand menu","chat.sidebar.collapse":"Collapse sidebar","chat.sidebar.workbench":"Workbench","chat.sidebar.newConv":"Conversation","chat.sidebar.recentChats":"Recent Chats","chat.sidebar.resumeConv":"Resume Conversation","chat.sidebar.lightMode":"Light Mode","chat.sidebar.darkMode":"Dark Mode","chat.sidebar.settings":"Settings","chat.sidebar.emptyHint":"Click the button above to create a new conversation","chat.sidebar.closeConv":"Close Conversation","chat.sidebar.renameConv":"Rename","chat.sidebar.pin":"Pin to top","chat.sidebar.unpin":"Unpin","chat.connection.connecting":"Connecting...","chat.connection.reconnecting":"Reconnecting ({current}/{max})...","chat.connection.updating":"Server is updating, please wait...","chat.connection.disconnected":"Disconnected","chat.connection.reconnect":"Reconnect","chat.connection.reconnectFailed":"Connection lost. Please click reconnect to retry.","chat.time.justNow":"Just now","chat.time.minutesAgo":"{count}m ago","chat.time.daysAgo":"{count}d ago","chat.time.today":"Today","chat.time.yesterday":"Yesterday","chat.delete.confirm":"Are you sure you want to close this conversation? This will terminate the corresponding Claude process.","chat.delete.enterWorkDir":"Please enter the working directory path","modal.newConv.workDir":"Work Directory","modal.newConv.inputOrSelect":"Enter or select a work directory","modal.newConv.browse":"Browse","modal.newConv.noWorkDirs":"No work directories","modal.newConv.selectAgent":"Please select an online Agent first","modal.newConv.create":"Create Conversation","modal.newConv.folderLabel":"\u{1F4C1} Work Directories","modal.newConv.provider":"Provider","modal.newConv.model":"Model","provider.claudeCode":"Claude Code","provider.copilot":"Copilot","modal.resume.workDir":"Work Directory","modal.resume.inputOrSelect":"Enter or select a work directory","modal.resume.browse":"Browse","modal.resume.tabFolders":"Directories","modal.resume.tabSessions":"History","modal.resume.noWorkDirs":"No work directories","modal.resume.selectWorkDir":"Please select a work directory first","modal.resume.noSessions":"No history sessions in this directory","modal.resume.untitled":"Untitled Session","modal.resume.folderLabel":"\u{1F4C1} Work Directories","modal.resume.sessionLabel":"\u{1F4AC} History Sessions","modal.resume.selectAgent":"Please select an online Agent first","modal.folderPicker.title":"Select Work Directory","modal.folderPicker.parentDir":"Parent Directory","welcome.subtitle":"Web Code Agent for sessions, tools, and VP collaboration","welcome.agentOnline":"{count} Agent(s) online","welcome.noAgents":"No Agents Online","welcome.noAgentsHint":"Please start an Agent and connect it to the server","welcome.noAgent":"No Agents Online","welcome.noAgentHint":"Please start an Agent and connect it to the server","welcome.setupAgent":"Set Up Agent","welcome.setupKicker":"Agent setup","welcome.setupTitle":"Connect your first Yeaft Agent","welcome.setupDesc":"Copy two commands to connect a local Agent. GitHub Copilot can configure models automatically.","welcome.setupInstallTitle":"Install CLI","welcome.setupCopilotTitle":"Configure models","welcome.setupRunTitle":"Start Agent","welcome.setupSecretLoading":"Preparing your Agent secret...","welcome.setupSecretError":"Could not prepare the Agent secret. Open Security settings to retry.","welcome.openSecuritySettings":"Open Security Settings","welcome.newConv":"Conversation","welcome.resumeHistory":"Resume History","messages.loadingMore":"Loading more messages...","messages.loadMore":"\u2191 Click or scroll up to load more","message.loadingMore":"Loading more messages...","message.loadMore":"\u2191 Click or scroll up to load more","message.scrollToLatest":"\u2193 Latest","message.showResponses":"Show {count} response(s)","message.hideResponses":"Hide response(s)","message.assistant":"Assistant","chat.waiting.disconnected":"Connection lost","chat.connecting":"Connecting to provider session...","chat.waiting.compacting":"Compacting context...","chat.waiting.agentOffline":"Agent offline","chat.waiting.sessionLost":"Session lost, refreshed, waiting for update...","chat.waiting.cliExited":"Claude process exited, refreshed, waiting for update...","chat.waiting.refresh":"Refresh","chat.waiting.thinking":"AI is thinking, please wait...","btw.hint":"esc to exit","btw.placeholder":"Ask a side question...","btw.close":"Exit BTW mode","message.copyContent":"Copy content","message.copy":"Copy content","message.copied":"Copied","message.copyCode":"Copy code","message.copyAll":"Copy all","message.screenshot":"Screenshot","message.screenshotting":"Taking screenshot...","message.exportMd":"Export MD","message.askInput":"Your input needed","message.askAnswered":"\u2713 Answered","message.askCustom":"Or type a custom answer...","message.askCustomPlaceholder":"Or type a custom answer...","message.askSubmit":"Submit Answer","message.askWaiting":"Waiting for question...","message.askExpired":"This question has expired. Ask the role to re-ask.","message.openInEditor":"Open in editor","message.resultDone":"Done","message.done":"Done","message.resultRead":"Read {file}","message.readFile":"Read {name}","message.file":"file","message.attachImages":"{count} image(s)","message.imageCount":"{count} image(s)","message.imagePreview":"Image preview","message.imageUnavailable":"Image unavailable","message.attachFiles":"{count} file(s)","message.fileCount":"{count} file(s)","message.quote":"Quote","message.removeQuote":"Remove quote","message.replyingTo":"Replying to {author}","message.quotedFrom":"Quoted from {author}","message.editAsNew":"Edit","message.you":"You","input.upload":"Upload file","input.placeholder":"Type a message...","input.send":"Send","input.stopExecution":"Stop execution","chatInput.upload":"Upload file","chatInput.uploading":"Uploading...","chatInput.uploadFailed":"Upload failed","chatInput.retryUpload":"Retry","chatInput.removeAttachment":"Remove attachment","chatInput.placeholder":"Type a message...","chatInput.send":"Send","chatInput.stop":"Stop execution","tools.thinking":"Thinking...","tools.read":"Reading file","tools.write":"Writing file","tools.edit":"Editing file","tools.bash":"Running command","tools.glob":"Searching files","tools.grep":"Searching content","tools.task":"Running task","tools.webFetch":"Fetching web page","tools.webSearch":"Searching the web","tools.todoWrite":"Updating tasks","tools.executing":"Running {name}","status.thinking":"Thinking...","status.reading":"Reading file","status.writing":"Writing file","status.editing":"Editing file","status.executing":"Running command","status.searchingFiles":"Searching files","status.searchingContent":"Searching content","status.executingTask":"Running task","status.fetching":"Fetching web page","status.searching":"Searching the web","status.updatingTasks":"Updating tasks","status.executingTool":"Running {name}","header.compacting":"Compressing context...","header.compacted":"Context compression complete","chatHeader.newConv":"Conversation","chatHeader.compacting":"Compressing context...","chatHeader.compactDone":"Context compression complete","chatHeader.compact":"Compact context","chatHeader.resume":"Resume session","chatHeader.refresh":"Refresh messages","chatHeader.reloadPage":"Reload page","chatHeader.clear":"Clear messages","chatHeader.clearing":"Clearing context...","chatHeader.clearDone":"Context cleared","chatHeader.confirmClear":"Are you sure you want to clear all messages in this conversation?","chatHeader.mcpConfig":"MCP Servers","chatHeader.mcpNeedRestart":"Changes will take effect after restarting the session.","chatHeader.expertPanel":"Expert Panel","chatHeader.subAgentPanel":"Sub-Agents","settings.close":"Close settings","settings.tabs.account":"Account","settings.tabs.security":"Security","settings.tabs.general":"General","settings.tabs.invitations":"Invitations","auth.sessionExpired":"Session expired. Please log in again.","settings.account.username":"Username","settings.account.role":"Role","settings.account.email":"Email","settings.account.emailNotSet":"Not set","settings.account.profileLoadFailed":"Failed to load account profile","settings.account.logout":"Log Out","settings.account.roleAdmin":"Admin","settings.account.rolePro":"Pro","settings.account.linkedAccounts":"Linked Accounts","settings.account.linkedDesc":"Link external sign-in providers so you can log in with any of them.","settings.account.bind":"Link","settings.account.unbind":"Unlink","settings.account.linked":"Linked","settings.account.providerDisabled":"Not configured","settings.account.cantUnbindLast":"Cannot unlink the only login method","settings.account.unbindFailed":"Failed to unlink: {error}","settings.account.bindFailed":"Failed to link account","settings.account.ssoBoundMsg":"Successfully linked {provider}.","settings.account.ssoConflictMsg":"This {provider} account is already linked to another user.","settings.account.providerMicrosoft":"Microsoft","settings.account.providerGithub":"GitHub","settings.account.providerGoogle":"Google","settings.account.providerWechat":"WeChat","settings.account.providerAlipay":"Alipay","settings.security.agentKey":"Agent Secret","settings.security.agentKeyDesc":"Shared secret for Agent connection authentication","settings.security.agentSetupCommands":"Agent setup commands","settings.security.agentCmdInstall":"Install Agent","settings.security.agentCmdService":"Run Agent server","settings.security.agentCmdNeedsSecret":"Generate an Agent Secret first to create the server command.","settings.security.agentCmdLlm":"Manual Copilot fallback","settings.security.agentCmdLlmDesc":"Run the install command first. If an existing GitHub Copilot token is available, Yeaft configures github-copilot/gpt-5.5 automatically; use the Copilot command only as a fallback.","settings.security.none":"None","settings.security.show":"Show","settings.security.hide":"Hide","settings.security.generateKey":"Generate Secret","settings.security.resetKey":"Reset Secret","settings.security.resetting":"Resetting...","settings.security.resetWarning":"All Agents need to be reconfigured after reset","settings.security.changePassword":"Change Password","settings.security.currentPassword":"Current password","settings.security.newPassword":"New password (min 6 characters)","settings.security.confirmPassword":"Confirm new password","settings.security.changeBtn":"Change Password","settings.security.changing":"Changing...","settings.security.enterCurrentPwd":"Please enter your current password","settings.security.newPwdMin":"New password must be at least 6 characters","settings.security.pwdMismatch":"Passwords do not match","settings.security.pwdChanged":"Password changed successfully","settings.security.setPassword":"Set a Password","settings.security.setPasswordDesc":"You signed in via SSO and have no password yet. Set one so you can also log in with username + password.","settings.security.setBtn":"Set Password","settings.security.pwdSet":"Password set successfully","settings.security.deleteAccount":"Delete Account","settings.security.deleteAccountDesc":"Permanently delete your account and all associated data. This cannot be undone.","settings.security.deleteBtn":"Delete Account","settings.security.deleteConfirmBtn":"Confirm Delete","settings.security.deleteConfirmPlaceholder":"Type DELETE to confirm","settings.security.deleteConfirmRequired":"Type DELETE to confirm account removal","settings.security.deleteFailed":"Failed to delete account","settings.security.deleting":"Deleting...","settings.general.theme":"Theme","settings.general.lightTheme":"Light","settings.general.darkTheme":"Dark","settings.general.language":"Language","settings.invite.create":"Create Invite Code","settings.invite.normalUser":"Regular User","settings.invite.proUser":"Pro User","settings.invite.createBtn":"Create Invite","settings.invite.creating":"Creating...","settings.invite.list":"Invite Codes","settings.invite.used":"Used","settings.invite.expired":"Expired","settings.invite.available":"Available","settings.invite.usedBy":"Used by: {user}","settings.invite.expiredAt":"Expired at: {time}","settings.invite.expiresAt":"Expires at: {time}","settings.invite.noInvites":"No invite codes","settings.msg.copiedClipboard":"Copied to clipboard","settings.msg.copyFailed":"Copy failed","settings.msg.keyReset":"Secret has been reset","settings.msg.resetFailed":"Reset failed","settings.msg.changeFailed":"Change failed","settings.msg.inviteCreated":"Invite code created","settings.msg.createFailed":"Create failed","settings.msg.inviteCopied":"Invite code copied","settings.msg.inviteDeleted":"Invite code deleted","settings.msg.deleteFailed":"Delete failed","settings.tabs.llm":"LLM","settings.tabs.yeaft":"Yeaft","yeaft.session.title":"Sessions","yeaft.session.new":"+ New session","yeaft.session.create.title":"New session","yeaft.session.create.subtitle":"Choose where it runs and which provider should handle it.","yeaft.session.create.close":"Close","yeaft.session.create.nameLabel":"Name","yeaft.session.create.namePlaceholder":"Session name (optional)","yeaft.session.create.workDirLabel":"Work Directory","yeaft.session.create.agentLabel":"Agent","yeaft.session.create.vpPicker":"Pick VPs","yeaft.session.create.vpNone":"No VPs selected","yeaft.session.create.vpCount":"{n} VPs selected","yeaft.session.create.untitled":"Untitled session","yeaft.session.create.rosterEmpty":"No VPs available \u2014 create one from the VP Library first.","yeaft.session.create.rosterLoading":"Loading VPs\u2026","yeaft.session.create.rosterError":"VPs could not be loaded from this Agent.","yeaft.session.create.rosterRetry":"Retry","yeaft.vp.domain.general":"General & coordination","yeaft.vp.domain.productDesign":"Product & experience design","yeaft.vp.domain.softwareSystems":"Software & systems","yeaft.vp.domain.securityReliability":"Security & reliability","yeaft.vp.domain.scienceAnalysis":"Science & analysis","yeaft.vp.domain.philosophyPsychology":"Philosophy & psychology","yeaft.vp.domain.strategyHistory":"Strategy & history","yeaft.vp.domain.businessManagement":"Business & management","yeaft.vp.domain.artsCulture":"Arts & culture","yeaft.vp.domain.other":"Other specialties","yeaft.vp.domain.custom":"Custom VPs","yeaft.session.create.defaultVpHint":"The VP that answers when no one is @-mentioned.","yeaft.session.create.folderLabel":"\u{1F4C1} Work directories","yeaft.session.create.sessionLabel":"\u{1F4AC} Sessions in this directory","yeaft.session.create.noWorkDirs":"No prior sessions yet \u2014 pick or type a work directory above.","yeaft.session.create.back":"Back","yeaft.session.create.creating":"Creating\u2026","yeaft.session.create.submit":"Create","yeaft.onboarding.ariaLabel":"Yeaft getting started guide","yeaft.onboarding.topbarTitle":"Get started with Yeaft","yeaft.onboarding.eyebrow":"Yeaft setup guide","yeaft.onboarding.title":"Connect an Agent before chatting","yeaft.onboarding.subtitle":"Run these commands on the machine that should execute tools. The agent secret is generated automatically for your account if it does not exist yet.","yeaft.onboarding.createSession":"Create or restore Session","yeaft.onboarding.configureLlm":"Open LLM settings","yeaft.onboarding.secretLoading":"Generating agent secret\u2026","yeaft.onboarding.secretError":"Failed to load agent secret.","yeaft.onboarding.secretPending":"<loading-agent-secret>","yeaft.onboarding.installTitle":"Install yeaft-agent","yeaft.onboarding.installDesc":"Install the command-line Agent package.","yeaft.onboarding.connectTitle":"Connect this Agent","yeaft.onboarding.connectDesc":"The command below uses this server URL and your generated secret.","yeaft.onboarding.llmTitle":"Use GitHub Copilot","yeaft.onboarding.llmDesc":"Authenticate GitHub CLI, then select gpt-5.5 as the default Yeaft model.","yeaft.restore.modal.empty":"No yeaft sessions found in this directory","yeaft.restore.modal.scanError":"Failed to scan: {message}","yeaft.restore.modal.restoreError":"Failed to restore: {message}","settings.llm.noAgent":"Please select an Agent first to manage LLM configuration.","settings.llm.agentOffline":"Agent is currently offline. LLM configuration will load when the agent comes online.","settings.llm.loading":"Loading configuration...","settings.llm.loadError":"Failed to load configuration","settings.llm.configureAgent":"Configure this agent LLM","settings.llm.configureMenu":"LLM Settings","settings.llm.simpleCopilotTitle":"Recommended: GitHub Copilot","settings.llm.useGitHubCopilot":"Use GitHub Copilot","settings.llm.refreshingModels":"Refreshing models...","settings.llm.managedCopilotTitle":"Managed GitHub Copilot","settings.llm.managedCopilotDesc":"Base URL, authentication, model catalog, and per-model API protocol are managed automatically. Claude models use Anthropic Messages; GPT/o models use OpenAI Responses.","settings.llm.providersTitle":"Providers","settings.llm.testFailed":"Connection test failed","settings.llm.saveSuccess":"LLM settings saved","settings.llm.saveFailed":"Failed to save LLM settings","settings.llm.presets.title":"Quick setup","settings.llm.providersDesc":"Choose a provider, save it, and use it in Sessions.","settings.llm.agentProviders":"This agent providers","settings.llm.agentBadge":"This agent","settings.llm.addProvider":"Add Provider","settings.llm.addFromPreset":"Add from Catalog","settings.llm.preset.title":"Provider Catalog (models.dev)","settings.llm.preset.refresh":"Refresh catalog","settings.llm.preset.loading":"Loading catalog\u2026","settings.llm.preset.empty":"No providers available.","settings.llm.preset.pickProvider":"Pick a provider on the left to see its models.","settings.llm.preset.filterProviders":"Filter providers\u2026","settings.llm.preset.filterModels":"Filter models\u2026","settings.llm.preset.selectAll":"Select all","settings.llm.preset.selectNone":"Clear","settings.llm.preset.cancel":"Cancel","settings.llm.preset.add":"Add to providers","settings.llm.preset.fetchedAt":"Catalog updated {minutes}m ago","settings.llm.addModel":"Add Model","settings.llm.removeModel":"Remove Model","settings.llm.providerName":"Name","settings.llm.providerNamePlaceholder":"e.g. my-proxy","settings.llm.baseUrl":"Base URL","settings.llm.baseUrlPlaceholder":"e.g. http://localhost:6628/v1","settings.llm.apiKey":"API Key","settings.llm.apiKeyPlaceholder":"Enter API key","settings.llm.protocol":"Protocol","settings.llm.protocolOpenAI":"OpenAI Compatible","settings.llm.protocolOpenAIResponses":"OpenAI Responses (GPT-5)","settings.llm.protocolAnthropic":"Anthropic Native","settings.llm.protocolHint.anthropic":"Claude native Messages API.","settings.llm.protocolHint.openai":"Chat Completions /v1/chat/completions \u2014 GPT-4 and most compatible proxies.","settings.llm.protocolHint.openaiResponses":"Responses API /v1/responses \u2014 required for GPT-5 series.","settings.llm.modelCtxPlaceholder":"ctx","settings.llm.modelMaxPlaceholder":"max","settings.llm.models":"Candidate Model IDs","settings.llm.modelsPlaceholder":"Model IDs, comma or newline separated, e.g. claude-sonnet-4-20250514, gpt-5","settings.llm.modelsHint":"Comma or newline separated.","settings.llm.removeProvider":"Remove","settings.llm.modelSelectionTitle":"Model Selection","settings.llm.modelSelectionDesc":"Choose the default models.","settings.llm.primaryModel":"Primary Model","settings.llm.primaryModelDesc":"Used for user-facing conversations","settings.llm.fastModel":"Fast Model","settings.llm.fastModelDesc":"Used for internal tasks (memory, consolidation)","settings.llm.noModels":"No models available. Add a provider first.","settings.llm.selectModel":"Select a model...","settings.llm.save":"Save Changes","settings.llm.saving":"Saving...","settings.llm.saved":"Configuration saved","settings.llm.savedRefreshWarning":"Configuration was saved, but the live model catalog could not refresh: {error}","settings.llm.unsavedChanges":"You have unsaved changes","settings.llm.confirmRemoveProvider":"Remove this provider?","settings.llm.setupTitle":"Connect a model","settings.llm.setupDesc":"GitHub Copilot is recommended. You can also add your own API provider.","settings.llm.providerSectionHint":"Only the fields required to connect a model.","settings.tabs.dashboard":"Dashboard","settings.dashboard.totalUsers":"Total Users","settings.dashboard.onlineUsers":"Online Users","settings.dashboard.onlineAgents":"Online Agents","settings.dashboard.totalSessions":"Total Sessions","settings.dashboard.todayActive":"Today Active","settings.dashboard.todayMessages":"Today Messages","settings.dashboard.todayUserTurns":"Today User Turns","settings.dashboard.totalTokens":"Total Tokens","settings.dashboard.tokenAccuracy":"Provider-reported usage, accumulated from the version that enabled per-user token tracking. Heartbeats are excluded.","settings.dashboard.agentTurns":"Agent Turns","settings.dashboard.agentSessions":"Agent Sessions","settings.dashboard.turns":"Turns","settings.dashboard.tokens":"Tokens","settings.dashboard.inputTokens":"Input","settings.dashboard.outputTokens":"Output","settings.dashboard.cacheTokens":"Cache","settings.dashboard.today":"Today","settings.dashboard.thisWeek":"This Week","settings.dashboard.thisMonth":"This Month","settings.dashboard.all":"All","settings.dashboard.userUsage":"User Usage","settings.dashboard.agentList":"Agent List","settings.dashboard.onlineUserList":"Online Users","settings.dashboard.refresh":"Refresh","settings.dashboard.name":"Name","settings.dashboard.messages":"Messages","settings.dashboard.userTurns":"User Turns","settings.dashboard.sessions":"Sessions","settings.dashboard.requests":"Requests","settings.dashboard.traffic":"Traffic","settings.dashboard.lastLogin":"Last Login","settings.dashboard.status":"Status","settings.dashboard.latency":"Latency","settings.dashboard.version":"Version","settings.dashboard.owner":"Owner","settings.dashboard.role":"Role","settings.dashboard.agent":"Agent","settings.dashboard.online":"Online","settings.dashboard.offline":"Offline","settings.dashboard.noAgents":"No agents registered","settings.dashboard.noUserData":"No user data","settings.dashboard.noOnlineUsers":"No users online","settings.dashboard.loading":"Loading...","settings.dashboard.error":"Failed to load data","settings.dashboard.ago":"{time} ago","settings.dashboard.loadMore":"Load more ({remaining} remaining)","workbench.maximize":"Maximize panel","workbench.restore":"Restore panel","workbench.collapse":"Collapse panel","theme.switchToLight":"Switch to light theme","theme.switchToDark":"Switch to dark theme","theme.toLight":"Switch to light theme","theme.toDark":"Switch to dark theme","terminal.splitH":"Split horizontally (left-right)","terminal.splitV":"Split vertically (top-bottom)","terminal.close":"Close current terminal","terminal.autoCreate":"A terminal will be created when you switch to the Terminal tab","terminal.xtermError":"xterm.js not loaded, please refresh the page","terminal.xtermNotLoaded":"xterm.js not loaded, please refresh the page","terminal.mountError":"Terminal container mount failed","terminal.mountFailed":"Terminal container mount failed","terminal.createError":"Terminal creation failed","terminal.createFailed":"Terminal creation failed","terminal.error":"Terminal error","git.selectFolder":"Select folder","git.repoPath":"Enter Git repository path...","git.repoPathPlaceholder":"Enter Git repository path...","git.workDir":"Git working directory","git.loadStatus":"Load Git status","git.loading":"Loading Git status...","git.loadingStatus":"Loading Git status...","git.clean":"Working directory clean, no changes","git.cleanWorkDir":"Working directory clean, no changes","git.selectAgent":"Select an Agent to load Git status","git.selectAgentFirst":"Select an Agent to load Git status","git.diffOnly":"Diff only","git.fullFile":"Full file","git.zoomIn":"Zoom in","git.zoomOut":"Zoom out","git.loadingDiff":"Loading Diff...","git.clickToView":"Click a file to view diff","git.clickFileToView":"Click a file to view diff","git.selectRepo":"Select Git Repository","git.noDiff":"(No differences)","git.binaryFile":"(Binary file)","files.notLoaded":"Not loaded","files.newFile":"New File","files.newFolder":"New Folder","files.collapseAll":"Collapse All","files.openFolder":"Open Folder","files.deleteSelected":"Delete selected","files.moveSelected":"Move selected","files.enterPath":"Enter path...","files.searchFiles":"Search files... (Ctrl+P)","files.noMatch":"No matches found","files.searching":"Searching...","files.loadingTree":"Loading...","files.emptyDir":"Empty directory","files.loadingFile":"Loading file...","files.searchPlaceholder":"Search...","files.replacePlaceholder":"Replace...","files.replace":"Replace","files.replaceAll":"All","files.replaceCurrent":"Replace current","files.replaceAllTitle":"Replace all","files.clickToView":"Click a file to view content","files.selectFolder":"Select Folder","files.enterFolderName":"Enter folder name...","files.enterFileName":"Enter file name...","files.moveTarget":"Enter target directory path...","files.moveItems":"Move {count} item(s) to the specified directory","files.workDir":"Work directory: {dir}","files.enterDirPath":"Enter directory path...","files.unsavedConfirm":'"{name}" has unsaved changes. Close anyway?',"files.deleteConfirm":'Are you sure you want to delete "{name}"?',"files.deleteDirHint":" (this will delete the folder and all its contents)","files.deleteSelectedConfirm":"Are you sure you want to delete {count} selected item(s)? This action cannot be undone.","files.findPrev":"Previous (Shift+Enter)","files.findNext":"Next (Enter)","files.caseSensitive":"Case sensitive","files.regex":"Regular expression","files.unsaved":"Unsaved","files.clearSelection":"Clear selection","files.rename":"Rename","files.copyHere":"Copy","files.moveTo":"Move to...","files.download":"Download","files.enterNewName":"Enter new name...","files.loadingPreview":"Loading preview...","files.preview":"Preview","files.edit":"Edit","files.pptxNotSupported":"PPTX local preview is not supported. Please switch to Office Online mode in Settings.","files.officePreviewMode":"Office Preview Mode","files.officeOnline":"Office Online","files.localRender":"Local Rendering","proxy.port":"Port","proxy.label":"Label","proxy.add":"Add port mapping","proxy.addPort":"Add port mapping","proxy.enable":"Click to enable","proxy.clickEnable":"Click to enable","proxy.disable":"Click to disable","proxy.clickDisable":"Click to disable","proxy.openNewTab":"Open in new tab","proxy.openInBrowser":"Open in new tab","proxy.noMappings":"No port mappings","proxy.noPorts":"No port mappings","proxy.hint":"After adding ports, you can access local services on the agent machine through proxy URLs","proxy.noPortsHint":"After adding ports, you can access local services on the agent machine through proxy URLs","proxy.selectAgent":"Please select an Agent first","store.selectAgent":"Please select an Agent first","store.creatingConv":"Creating conversation...","store.loadingHistory":"Loading conversation history...","store.executionCancelled":"Execution cancelled","store.loginFailed":"Login failed","store.convClosed":"Conversation closed","store.convCreated":"New conversation created [{agent}], work directory: {workDir}","store.convResumed":"Conversation resumed [{agent}]: {sessionId}","roleplay.creating":"Creating Role Play session...","roleplay.working":"Working","roleplay.selectTeam":"Select team template","roleplay.teamDev":"Software Dev","roleplay.teamCustom":"Custom","roleplay.editRoles":"Edit Roles","roleplay.roleName":"Role ID","roleplay.roleDisplayName":"Display Name","roleplay.roleIcon":"Icon","roleplay.roleDesc":"Role Description","roleplay.rolePrompt":"Role Prompt","roleplay.removeRole":"Remove Role","roleplay.addRole":"Add Role","roleplay.start":"Start Role Play","roleplay.sidebarTitle":"Role Play","roleplay.configTitle":"Role Play","roleplay.newSession":"New Role Play","roleplay.emptyHint":"Send a message to start multi-role collaboration","roleplay.askingYou":"is asking you","roleplay.language":"Language","roleplay.rolePreview":"Role Configuration","roleplay.noAgents":"No online agents available","roleplay.inputPlaceholder":"Type a message\u2026 Use @ to mention a role","roleplay.existingSessions":"Existing Teams","roleplay.restore":"Restore","roleplay.restoring":"Restoring Role Play session...","roleplay.createNew":"Create New Team","expertPanel.title":"Expert Panel","expertPanel.search":"Search roles or actions...","expertPanel.noResults":"No results","expertPanel.clearAll":"Clear","expertPanel.persona":"Persona Prompt","expertPanel.template":"With Input \xB7 Prefix","expertPanel.templateHint":"When user types text: this prefix + user text = final prompt","expertPanel.defaultMsg":"No Input \xB7 Full Prompt","expertPanel.defaultMsgHint":"When user sends without typing: this full prompt is used as-is","expertPanel.loading":"Loading role definitions...","expertPanel.viewPrompt":"View prompt","expertPanel.customRoles":"Custom Roles","expertPanel.addRole":"Add role","expertPanel.editRole":"Edit role","expertPanel.deleteRole":"Delete role","expertPanel.noCustomRoles":"No custom roles yet","expertPanel.createFirst":"Create your first custom role","expertPanel.noActions":"No actions defined","expertPanel.deleteConfirm":'Delete role "{name}"? This cannot be undone.',"expertPanel.deleteConfirmBtn":"Delete","expertEditor.createTitle":"Create Custom Role","expertEditor.editTitle":"Edit Custom Role","expertEditor.basicInfo":"Basic Info","expertEditor.roleName":"Role Name","expertEditor.roleNamePlaceholder":"e.g. Data Analyst","expertEditor.roleTitle":"Title","expertEditor.roleTitlePlaceholder":"e.g. Senior Data Analyst","expertEditor.fullName":"Full Name","expertEditor.fullNamePlaceholder":"Optional","expertEditor.titleEn":"English Title","expertEditor.titleEnPlaceholder":"Optional","expertEditor.rolePrompt":"Role Prompt","expertEditor.messagePrefix":"Message Prefix (Chinese)","expertEditor.messagePrefixPlaceholder":"e.g. As a senior data analyst, ","expertEditor.messagePrefixEn":"Message Prefix (English)","expertEditor.messagePrefixEnPlaceholder":"As a senior data analyst, ","expertEditor.actions":"Actions","expertEditor.addAction":"Add Action","expertEditor.removeAction":"Remove","expertEditor.actionName":"Action Name","expertEditor.actionNamePlaceholder":"e.g. Data Analysis","expertEditor.actionNameEn":"English Name","expertEditor.actionNameEnPlaceholder":"Optional","expertEditor.messageTemplate":"With Input \xB7 Prefix (Chinese)","expertEditor.messageTemplatePlaceholder":"Prepended to user text when user types something","expertEditor.messageTemplateEn":"With Input \xB7 Prefix (English)","expertEditor.messageTemplateEnPlaceholder":"Prepended to user text when user types something","expertEditor.defaultMessage":"No Input \xB7 Full Prompt (Chinese)","expertEditor.defaultMessagePlaceholder":"Used as-is when user sends without typing","expertEditor.defaultMessageEn":"No Input \xB7 Full Prompt (English)","expertEditor.defaultMessageEnPlaceholder":"Used as-is when user sends without typing","expertEditor.cancel":"Cancel","expertEditor.save":"Save","expertEditor.saving":"Saving...","subAgentPanel.title":"Sub-Agents","subAgentPanel.back":"Back to list","subAgentPanel.running":"Running","subAgentPanel.completed":"Completed","subAgentPanel.waitingMessages":"Waiting for messages...","subAgentPanel.toolCount":"{count} tools","subAgentPanel.toolSummary":"{count} tool calls completed","subAgentPanel.empty":"No sub-agents","subAgentPanel.emptyHint":"Sub-agents will appear here when Claude delegates tasks","splitScreen.split":"Split screen","splitScreen.closePane":"Close pane","splitScreen.newChat":"New Chat","splitScreen.noSessions":"No sessions","splitScreen.splitToPanel":"Open in new panel","splitScreen.selectFromSidebar":"Select a conversation from the sidebar","yeaft.vp.library":"VP Library","yeaft.vp.createFirst":"+ Create your first role","yeaft.vp.empty.aria":"No virtual persons yet","yeaft.vp.avatar.aria":"{name} avatar","yeaft.vp.speaker.stateCauseAria":"State change: {cause}","yeaft.vp.status.thinking":"thinking\u2026","yeaft.vp.status.tool":"using {name}","yeaft.vp.status.done":"done \xB7 {count} tools","yeaft.vp.status.aborted":"aborted","yeaft.vp.crud.title":"VP Library","yeaft.vp.crud.close":"Close","yeaft.vp.crud.addNew":"+ New role","yeaft.vp.crud.empty":"No virtual persons yet. Create your first role to start collaborating.","yeaft.vp.crud.edit":"Edit","yeaft.vp.crud.delete":"Delete","yeaft.vp.crud.deleteConfirm":'Delete "{name}"? This removes the role.md file on disk.',"yeaft.vp.crud.form.create":"Create role","yeaft.vp.crud.form.update":"Edit role","yeaft.vp.crud.form.vpId":"VP id","yeaft.vp.crud.form.vpId.tooltip":'Letters / digits / - / _ only. Cannot start with "_", cannot be all digits, cannot be one of: all, user, system, everyone.',"yeaft.vp.crud.form.displayName":"Display name (English)","yeaft.vp.crud.form.displayNameZh":"Display name (Chinese)","yeaft.vp.crud.form.description":"Capability description (English)","yeaft.vp.crud.form.descriptionZh":"Capability description (Chinese)","yeaft.vp.crud.form.descriptionPlaceholder":"e.g. API design, migration planning, and compatibility reviews","yeaft.vp.crud.form.descriptionZhPlaceholder":"\u4F8B\u5982\uFF1AAPI \u8BBE\u8BA1\u3001\u8FC1\u79FB\u89C4\u5212\u4E0E\u517C\u5BB9\u6027\u8BC4\u5BA1","yeaft.vp.crud.form.role":"Role","yeaft.vp.crud.form.rolePlaceholder":"e.g. Product Manager","yeaft.vp.crud.form.traits":"Traits","yeaft.vp.crud.form.traitsHint":"Comma-separated short tags (e.g. curious, pragmatic).","yeaft.vp.crud.form.modelHint":"Model hint","yeaft.vp.crud.form.modelHint.none":"\u2014 default \u2014","yeaft.vp.crud.form.modelHint.primary":"primary","yeaft.vp.crud.form.modelHint.fast":"fast","yeaft.vp.crud.form.persona":"Persona (markdown)","yeaft.vp.crud.form.personaPlaceholder":"Describe how this role should think, speak, and decide...","yeaft.vp.crud.form.submit":"Save","yeaft.vp.crud.form.cancel":"Cancel","yeaft.vp.crud.form.ok":"Looks good","yeaft.vp.crud.form.idLocked":"VP id cannot be changed after creation.","yeaft.vp.crud.saving":"Saving\u2026","yeaft.vp.crud.saveFailed":"Save failed: {error}","yeaft.vp.crud.deleteFailed":"Delete failed: {error}","yeaft.vp.crud.viewPrompt":"View prompt","yeaft.vp.crud.view.title":"VP prompt","yeaft.vp.crud.view.personaEmpty":"(no persona body \u2014 only metadata is defined)","yeaft.vp.crud.view.back":"Back","yeaft.vp.crud.view.editFromHere":"Edit this VP","yeaft.vp.crud.view.removed":"This VP was removed elsewhere \u2014 returning to the list.","yeaft.vp.crud.stockBadge":"Stock","yeaft.vp.crud.stockReadOnly":"Stock VPs ship with the agent and cannot be edited or deleted.","yeaft.vp.idError.empty_or_non_string":"VP id is required.","yeaft.vp.idError.too_long":"VP id is too long (max 40 characters).","yeaft.vp.idError.illegal_character":'Only letters, digits, "-" and "_" are allowed.',"yeaft.vp.idError.underscore_prefix_reserved":'VP id cannot start with "_" (reserved for system roles).',"yeaft.vp.idError.pure_digits":"VP id cannot be all digits.","yeaft.vp.idError.reserved":"VP id cannot be one of the reserved names (all, user, system, everyone).","yeaft.vp.idError.duplicate":"A role with this VP id already exists.","yeaft.vp.idError.not_found":"This VP does not exist \u2014 it may have been deleted.","yeaft.vp.idError.stock_readonly":"Stock VPs cannot be edited or deleted.","yeaft.vp.idError.unknown":"An unexpected error occurred. Please try again.","yeaft.vp.reason.personaEdit":"Persona updated","yeaft.vp.reason.traitsEdit":"Traits updated","yeaft.vp.reason.manualReload":"Reloaded","yeaft.vp.reason.fileRemoved":"Removed","yeaft.vp.reason.toast.updated":"{name}: {reason}","yeaft.vp.reason.toast.removed":"{name} was removed","yeaft.message.timeAria":"Sent at {time}","yeaft.user.youLabel":"You","yeaft.session.sidebarTitle":"Sessions","yeaft.session.sidebarAria":"Sessions section","yeaft.session.newButton":"+ New session","yeaft.session.newButtonAria":"Create a new session","yeaft.session.defaultName":"Default","yeaft.session.moreActions":"More actions","yeaft.session.archivingEllipsis":"Archiving\u2026","yeaft.session.deletingEllipsis":"Deleting\u2026","yeaft.session.renamingEllipsis":"Renaming\u2026","yeaft.session.empty":"No sessions yet.","yeaft.session.membersCount":"{count} members","yeaft.session.oneMember":"1 member","yeaft.session.noMembers":"Empty \u2014 invite a VP","yeaft.session.defaultBadge":"default","yeaft.session.archive":"Archive","yeaft.session.archiveConfirm":'Archive "{name}"? You can recover it from disk later.',"yeaft.session.delete":"Delete","yeaft.session.deleteConfirm":'Delete "{name}"? This permanently removes the session and all its data \u2014 this cannot be undone.',"yeaft.session.rename":"Rename","yeaft.session.openSettings":"Settings","yeaft.session.removeFromList":"Remove","yeaft.session.manageMembers":"Manage members","yeaft.session.memberCount.one":"1 member","yeaft.session.memberCount.other":"{count} members","yeaft.session.renamePrompt":'New name for "{name}":',"yeaft.session.editModal.renameTitle":"Rename session","yeaft.session.editModal.renameBody":'Choose a new name for "{name}".',"yeaft.session.editModal.renameSubmit":"Save","yeaft.session.editModal.archiveTitle":"Archive session","yeaft.session.editModal.archiveBody":'Archive "{name}"? You can recover it from disk later.',"yeaft.session.editModal.archiveSubmit":"Archive","yeaft.session.editModal.deleteTitle":"Delete session","yeaft.session.editModal.deleteBody":'Delete "{name}"? This permanently removes the session and all its data \u2014 this cannot be undone.',"yeaft.session.editModal.deleteSubmit":"Delete","yeaft.session.editModal.newNameLabel":"New name","yeaft.session.editModal.cancel":"Cancel","yeaft.session.editModal.close":"Close","yeaft.session.error.invalid_name":"Session name cannot be empty.","yeaft.session.error.duplicate":"A session with this id already exists.","yeaft.session.error.not_found":"Session not found.","yeaft.session.error.default_not_in_roster":"The default VP must be in the roster.","yeaft.session.error.no_default_vp":"This session has no members. Add a VP from the library to start chatting.","yeaft.session.error.reserved":"One of the selected ids is reserved (all, user, system, everyone).","yeaft.session.error.unknown":"Session operation failed: {message}","yeaft.session.error.timeout":"Session operation timed out \u2014 try again.","yeaft.session.invite.title":"Invite a VP","yeaft.session.invite.body":'"{name}" has no members yet. Add a VP from your library to start chatting.',"yeaft.session.invite.openLibrary":"Open VP Library","yeaft.session.invite.dismiss":"Not now","yeaft.session.empty.title":"Empty session","yeaft.session.empty.hint":'"{name}" has no members yet. Add a VP to start chatting.',"yeaft.session.empty.cta":"Manage members","yeaft.session.members.title":'Manage members of "{name}"',"yeaft.session.members.aria":"Session members manager","yeaft.session.members.close":"Close","yeaft.session.members.done":"Done","yeaft.session.members.empty":"No VPs available \u2014 create one in the VP Library first.","yeaft.session.members.loading":"Loading VPs\u2026","yeaft.session.members.defaultHint":"Default VP (replies when no @mention is given)","yeaft.session.members.memberCount":"{count} selected","yeaft.session.members.actionFailed":"Action failed: {error}","yeaft.session.members.openLibrary":"Open VP Library","yeaft.session.members.openLibraryHint":"Create a new VP or view a VP's prompt.","yeaft.session.announcement.label":"Announcement","yeaft.session.announcement.hintEmpty":"No announcement \u2014 click \u270F\uFE0F to add one.","yeaft.session.announcement.emptyBody":"No announcement set. Add a message that every VP in this session will see at the top of its system prompt \u2014 useful for shared context, ground rules, or a CLAUDE.md-style brief.","yeaft.session.announcement.placeholder":"Write a shared briefing for all VPs in this session\u2026","yeaft.session.announcement.edit":"Edit announcement","yeaft.session.announcement.editTitle":"Edit session announcement","yeaft.session.announcement.saving":"Saving\u2026","yeaft.session.announcement.saveFailed":"Save failed: {error}","yeaft.session.announcement.openSettings":"Open session settings","yeaft.session.settings.title":"{name} \u2014 session settings","yeaft.session.settings.short":"Session","yeaft.session.settings.close":"Close","yeaft.session.settings.nav.session":"Session","yeaft.session.settings.nav.members":"Members","yeaft.session.settings.nav.memory":"Memory","yeaft.session.settings.announcement.heading":"Session announcement","yeaft.session.settings.announcement.help":"Shared at the top of every VP's system prompt while in this session. Like a CLAUDE.md for the team.","yeaft.session.settings.members.heading":"Members","yeaft.session.settings.rename.heading":"Rename session","yeaft.session.settings.rename.label":"New name","yeaft.session.settings.rename.save":"Save name","yeaft.session.settings.rename.saving":"Saving\u2026","yeaft.session.settings.memory.heading":"Session memory","yeaft.session.settings.memory.help":"Run the dream consolidation now. Reads new messages since the last run, extracts facts, and merges them into the session's summary so the Resident layer reflects the latest conversation.","yeaft.session.settings.memory.runNow":"Run dream now","yeaft.session.settings.memory.running":"Running\u2026","yeaft.session.settings.memory.lastSuccess":"Last run {time} \u2014 {count} target(s) updated.","yeaft.session.settings.memory.lastError":"Last run failed: {error}","yeaft.session.settings.danger.heading":"Delete session","yeaft.session.settings.danger.deleteHelp":"This permanently deletes the session, removing session.json and all message history on disk. It cannot be undone.","yeaft.session.settings.danger.deleteBtn":"Delete session","yeaft.vp.mention.placeholder":"Search role by id or name\u2026","yeaft.vp.mention.noMatch":"No matching role","yeaft.vp.mention.count":"{count} mentions","yeaft.feature.reject.missing_group_id":"Message send failed: session not specified.","yeaft.feature.reject.missing_feature_id":"Message send failed: task context lost.","yeaft.feature.reject.missing_vp_id":"Message send failed: speaker not set.","yeaft.feature.reject.invalid_vp_id":"Message send failed: invalid speaker id.","yeaft.feature.reject.empty_text":"Message send failed: empty message.","yeaft.feature.reject.text_too_long":"Message send failed: text too long (max 16 KiB).","yeaft.feature.reject.unknown":"Message send failed.","yeaft.feature.pill.label":"task","yeaft.feature.messageTime.aria":"Sent at {time}","yeaft.vp.turnBlock.elapsedTitle":"Time elapsed since this turn started","yeaft.vp.turnBlock.retryingRequest":"Response stalled; retrying with a fresh request ({attempt}/{max})","yeaft.vp.turnBlock.retryingContinue":"Response stalled; continuing with a fresh request ({attempt}/{max})","yeaft.sessionStatus.aria":"Session status","yeaft.sessionStatus.title":"Session status","yeaft.sessionStatus.announcement":"Announcement","yeaft.sessionStatus.announcementEmpty":"No announcement","yeaft.sessionStatus.announcementAdd":"Add announcement","yeaft.sessionStatus.announcementEdit":"Edit announcement","yeaft.sessionStatus.vps":"VPs","yeaft.sessionStatus.backgroundTasks":"Background tasks","yeaft.sessionStatus.noLogPreview":"No log output yet.","yeaft.sessionStatus.task.subAgentStarted":"{name} started","yeaft.sessionStatus.task.subAgentStartedWithMission":"{name} started: {mission}","yeaft.sessionStatus.task.subAgentStatus":"{name} is {status}","yeaft.sessionStatus.task.subAgentStatusUpdated":"{name} status updated","yeaft.sessionStatus.task.subAgentResult":"{name} result: {text}","yeaft.sessionStatus.task.subAgentProducedResult":"{name} produced a result","yeaft.sessionStatus.task.subAgentUsedTool":"{name} used {tool}","yeaft.sessionStatus.task.subAgentFinishedTool":"{name} finished {tool}","yeaft.sessionStatus.task.subAgentUsage":"{name} used {tokens} tokens","yeaft.sessionStatus.task.subAgentEvent":"{name}: {text}","yeaft.sessionStatus.task.subAgentUserPrompt":"You: {text}","yeaft.sessionStatus.task.subAgentToolSummary":"{count} tool calls completed","yeaft.sessionStatus.task.subAgentError":"{name} error: {error}","yeaft.sessionStatus.task.subAgentHitError":"{name} hit an error","yeaft.sessionStatus.task.subAgentNoReadableEvents":"No readable sub-agent activity yet.","yeaft.sessionStatus.task.promptPlaceholder":"Add guidance for this sub-agent\u2026","yeaft.sessionStatus.task.promptSend":"Send","yeaft.sessionStatus.task.promptSending":"Sending\u2026","yeaft.sessionStatus.task.promptFailed":"Failed to send prompt.","yeaft.sessionStatus.task.title":"Task","yeaft.sessionStatus.task.command":"Command","yeaft.sessionStatus.task.stop":"Stop task","yeaft.sessionStatus.task.stopping":"Stopping\u2026","yeaft.sessionStatus.task.kind.subAgent":"sub-agent","yeaft.sessionStatus.task.kind.shell":"shell","yeaft.sessionStatus.show":"Show Session status","yeaft.sessionStatus.hide":"Hide Session status","yeaft.sessionStatus.close":"Close Session status","yeaft.vpTimeline.empty":"No VPs in this Session yet.","yeaft.vpTimeline.resizeTitle":"Drag to resize","yeaft.vpTimeline.status.idle":"idle","yeaft.vpTimeline.status.typing":"typing\u2026","yeaft.vpTimeline.status.thinking":"thinking\u2026","yeaft.vpTimeline.status.retrying":"retrying request\u2026","yeaft.vpTimeline.status.streaming":"streaming","yeaft.vpTimeline.status.tool":"using tool\u2026","yeaft.vpTimeline.status.error":"error","yeaft.vpTimeline.status.offline":"offline","yeaft.vpTimeline.abort":"Abort","yeaft.vpTimeline.edit":"Edit VP","yeaft.vpTimeline.mention":"Click to @-mention this VP","yeaft.vpTimeline.expand":"Toggle task details","yeaft.toolStats.title":"Tool Usage Stats","yeaft.toolStats.refresh":"Refresh","yeaft.toolStats.close":"Close","yeaft.toolStats.tabAll":"All tools","yeaft.toolStats.tabUnused":"Unused","yeaft.toolStats.loading":"Loading\u2026","yeaft.toolStats.notLoaded":"No data yet \u2014 click refresh.","yeaft.toolStats.empty":"(no tool calls recorded yet)","yeaft.toolStats.noneUnused":"(every registered tool has been called at least once)","yeaft.toolStats.fetchedAt":"Fetched at","yeaft.toolStats.col.name":"Tool","yeaft.toolStats.col.calls":"Calls","yeaft.toolStats.col.errors":"Errors","yeaft.toolStats.col.errRate":"Err%","yeaft.toolStats.col.p50":"p50","yeaft.toolStats.col.p95":"p95","yeaft.toolStats.col.avg":"Avg","yeaft.toolStats.col.last":"Last","yeaft.toolStats.buttonLabel":"Tool Stats","workCenter.title":"Work Center","workCenter.subtitle":"Persistent work owned by this Agent","workCenter.agent":"Agent","workCenter.selectAgent":"Select Agent","workCenter.noOnlineAgents":"No online agents","workCenter.noAvailableAgents":"No compatible online Agents","workCenter.new":"New","workCenter.newWorkItem":"New work item","workCenter.workItem":"Work item","workCenter.createFirst":"Create first work item","workCenter.backToChat":"Back to chat","workCenter.refresh":"Refresh","workCenter.search":"Search work items","workCenter.filter":"Filter","workCenter.filterAttention":"Needs attention","workCenter.filterActive":"Active","workCenter.filterAll":"All","workCenter.filterDone":"Done","workCenter.attentionItems":"Needs attention","workCenter.board.active":"Active","workCenter.board.needsAttention":"Needs attention","workCenter.board.closed":"Closed","workCenter.board.emptyLane":"No work items","workCenter.board.lanes":"Work item lanes","workCenter.filterVp":"Filter by VP","workCenter.filterType":"Filter by type","workCenter.filterUpdated":"Filter by update time","workCenter.allVps":"All VPs","workCenter.allTypes":"All types","workCenter.anyTime":"Any time","workCenter.lastDay":"Last 24 hours","workCenter.lastWeek":"Last 7 days","workCenter.deleteWorkItem":"Delete Work Item","workCenter.deleteConfirm":"Permanently delete this Work Item, its execution history, and attachments?","workCenter.deleteRequiresStop":"Stop this Work Item before deleting it","workCenter.lastMonth":"Last 30 days","workCenter.assignment.planned":"Planned assignment","workCenter.created":"Created","workCenter.files":"files","workCenter.loadMore":"Load more","workCenter.activeItems":"Active work","workCenter.allItems":"All work items","workCenter.completedItems":"Completed","workCenter.watcherActive":"Watcher active","workCenter.loading":"Loading work items\u2026","workCenter.noTimestamp":"No timestamp","workCenter.updated":"Updated","workCenter.emptyTitle":"No work items yet","workCenter.emptyBody":"Create a persistent task when work must continue beyond one conversation turn.","workCenter.noAttentionTitle":"Nothing needs attention","workCenter.noAttentionBody":"Work Items waiting for you or needing recovery will appear here.","workCenter.noActiveTitle":"No active work items","workCenter.noActiveBody":"Draft, ready, and running Work Items will appear here.","workCenter.noCompletedTitle":"No completed work items","workCenter.noCompletedBody":"Completed work items will appear here.","workCenter.noMatchesTitle":"No matching work items","workCenter.noMatchesBody":"Try a different search or filter.","workCenter.selectTitle":"Work item details","workCenter.detailLoading":"Loading full details\u2026","workCenter.detailLoadFailed":"Could not load full details","workCenter.start":"Start","workCenter.retry":"Retry","workCenter.cancel":"Cancel","workCenter.closeWorkItem":"Close details","workCenter.cancelWorkItem":"Stop work item","workCenter.cancelWorkItemHint":"Stop this Work Item and all unfinished Actions.","workCenter.cancelConfirm":"Stop this work item and its unfinished Actions?","workCenter.stopWorkItem":"Stop work item","workCenter.resumeWorkItem":"Resume work item","workCenter.breadcrumbs":"Work Center navigation","workCenter.actionNumber":"Action {number}","workCenter.actionBreadcrumb":"Action {number}: {description}","workCenter.untitledAction":"Untitled Action","workCenter.workItems":"Work items","workCenter.description":"Description","workCenter.goal":"Goal","workCenter.acceptanceCriteria":"Acceptance criteria","workCenter.noCriteria":"No criteria provided","workCenter.failureReason":"Failure reason","workCenter.workflow":"Workflow","workCenter.actionFlow":"Action flow","workCenter.actionCount":"{count} Actions","workCenter.noActionSummary":"No summary yet","workCenter.actionProgress":"{completed} / {total} Actions","workCenter.currentAction":"Current Action","workCenter.expandActions":"Show Actions","workCenter.collapseActions":"Collapse","workCenter.actionObjective":"What to do","workCenter.actionApproach":"How to do it","workCenter.actionExpectedOutcome":"Expected result","workCenter.dependencies":"Dependencies","workCenter.actionResult":"Latest result","workCenter.currentProgress":"Current progress","workCenter.actionMessages":"Messages","workCenter.loops":"loops","workCenter.tools":"tools","workCenter.noActionMessages":"No messages yet.","workCenter.actionDetails":"Action details","workCenter.selectAction":"Select an Action to inspect its execution","workCenter.backToWorkItems":"Work items","workCenter.backToActions":"Actions","workCenter.you":"You","workCenter.noRequestDetails":"No execution records are available for this Action yet.","workCenter.loadingRequests":"Loading execution records\u2026","workCenter.loadingRequestDetail":"Loading tool evidence\u2026","workCenter.requestDetailUnavailable":"Tool evidence is unavailable. Try again.","workCenter.noRequestLoops":"This execution has no retained Loop details.","workCenter.requestDetailTruncated":"Large execution: {summarized} Loops are summarized and {omitted} older Loops are omitted.","workCenter.loopDetailTruncated":"Large Loop: showing retained tool evidence.","workCenter.loadEarlierMessages":"Load earlier messages","workCenter.loadingEarlierMessages":"Loading earlier messages\u2026","workCenter.unknownModel":"Unknown model","workCenter.loop":"Loop","workCenter.actionBrief":"Task brief","workCenter.executionSummary":"Execution summary","workCenter.toolParameters":"Parameters","workCenter.toolResult":"Result","workCenter.noToolCalls":"No tool calls in this Loop.","workCenter.actionInputPlaceholder":"Add context, answer a question, or redirect this Action","workCenter.actionInputResumeHint":"Your input resumes this Action with the additional context.","workCenter.waitingQuestionTitle":"Input required","workCenter.actionInputRetryHint":"Add instructions or files, then rerun this Action with the new context.","workCenter.actionInputContinueHint":"Direct intervention for this Action only.","workCenter.actionFailedTitle":"Why this Action failed","workCenter.failedAt":"Failed at","workCenter.actionFailureRecovery":"Add corrected instructions or files below to rerun this Action. The Execution view shows retained tool evidence.","workCenter.sendInput":"Send to Action","workCenter.sendingInput":"Sending\u2026","workCenter.retryAction":"Retry Action","workCenter.sendAndRetryAction":"Send and retry Action","workCenter.coordinatorDecision.guide_actions":"Action instructions updated","workCenter.coordinatorDecision.replan":"Goal or plan updated","workCenter.coordinatorDecision.request_human":"Human input requested","workCenter.conversation":"Conversation","workCenter.conversationThinking":"Working\u2026","workCenter.conversationReadOnly":"This work item is closed. The conversation remains available.","workCenter.conversationPlaceholder":"Message about this work item","workCenter.sendMessage":"Send message","workCenter.assistant":"Yeaft","workCenter.originalRequest":"Original request","workCenter.actionMessageScopeTitle":"Message this Action","workCenter.actionMessageScope":"Only this Action receives the message.","workCenter.actionConversation":"Conversation","workCenter.actionConversationWith":"Action executor","workCenter.actionViews":"Action views","workCenter.actionExecutor":"Executor","workCenter.actionExecutorPending":"Executor pending","workCenter.actionInformation":"Action information","workCenter.messageExecutor":"Message {name}","workCenter.actionChatPlaceholder":"Message {name} about this Action","workCenter.statusLabel":"Status","workCenter.llmRequestsLabel":"LLM requests","workCenter.loopsLabel":"Loops","workCenter.toolsLabel":"Tools","workCenter.tokensLabel":"Tokens","workCenter.workItemMessagePlaceholder":"Add direction for the whole Work Item","workCenter.sendWorkItemMessage":"Send to Work Item","workCenter.fromSession":"Create a work item from this Session","workCenter.llmRequestCount":"{count} LLM requests","workCenter.loopCount":"{count} loops","workCenter.toolCount":"{count} tools","workCenter.tokenCount":"{count} tokens","workCenter.tokenBreakdown":"{input} input / {output} output / {cache} cached","workCenter.guidance":"Add guidance to the current Action","workCenter.guidanceHint":"Clarify constraints or redirect the current Action","workCenter.guidanceRestartHint":"This restarts the current Action with the new guidance.","workCenter.sendGuidance":"Send guidance","workCenter.reuseMemory":"Use relevant Agent memory and completed work from this project","workCenter.reuseMemoryHelp":"Includes scope-bounded Agent memory plus structured summaries and evidence from completed WorkItems with the same canonical project directory. Raw tool output is not reused.","workCenter.resumeAnswer":"Answer the waiting question","workCenter.resumeAnswerHint":"Provide the information required to continue","workCenter.answerInActionDetail":"Open the current Action and respond in the input below.","workCenter.selectPrompt":"Select a work item to inspect its workflow.","workCenter.createHint":"Describe what you need. Triage will turn it into a goal, acceptance criteria, and Actions.","workCenter.requirement":"Requirement","workCenter.requirementHint":"Describe the problem, desired outcome, and any constraints in your own words","workCenter.requirementHelp":"Triage will generate the title, goal, acceptance criteria, type, and execution plan.","workCenter.titleField":"Title","workCenter.titleHint":"A short, specific outcome","workCenter.goalHint":"Describe the result the Agent must deliver","workCenter.criteriaHint":"One criterion per line","workCenter.attachments":"Attachments","workCenter.attachmentsHelp":"Images, PDFs, and text files stay bound to this Work Item and are available to every Action.","workCenter.attachmentsUnsupported":"The selected Agent does not support Work Item attachments.","workCenter.addAttachments":"Add files","workCenter.attachmentsUploading":"Uploading\u2026","workCenter.attachmentsUploadFailed":"Attachment upload failed","workCenter.removeAttachment":"Remove from draft","workCenter.previewAttachment":"Open attachment","workCenter.openAttachmentNamed":"Open attachment {name}","workCenter.openingAttachment":"Opening attachment\u2026","workCenter.attachmentPreviewFailed":"Could not open the attachment. Try again.","workCenter.attachmentOpenBlocked":"The browser blocked the attachment window. Allow pop-ups and try again.","workCenter.execution":"Execution","workCenter.executionHint":"Choose where and how this work item starts.","workCenter.workDir":"Working directory","workCenter.workDirHint":"Choose an existing project directory","workCenter.chooseFolder":"Choose folder","workCenter.workDirPickerHelp":"Select an existing folder on the chosen Agent.","workCenter.folderPickerHint":"Choose the project folder this Work Item can read and modify.","workCenter.folderPickerSelectionHint":"Double-click to open a folder, or select it and confirm.","workCenter.startImmediately":"Start immediately","workCenter.startImmediatelyHint":"Turn this off to create a draft you can review first.","workCenter.creating":"Creating\u2026","workCenter.create":"Create","workCenter.status.draft":"draft","workCenter.status.ready":"ready","workCenter.status.running":"running","workCenter.status.waiting":"waiting","workCenter.status.needs_attention":"needs attention","workCenter.status.done":"done","workCenter.status.cancelled":"cancelled","workCenter.status.completed":"completed","workCenter.status.failed":"failed","workCenter.status.superseded":"superseded","workCenter.action.triage":"Triage","workCenter.action.implement":"Implement","workCenter.action.review":"Review","workCenter.action.integrate":"Integrate","workCenter.action.deliver":"Deliver","workCenter.action.test":"Test","workCenter.action.research":"Research","workCenter.action.design":"Design","workCenter.action.diagnose":"Diagnose","workCenter.action.migrate":"Migrate","workCenter.action.document":"Document","workCenter.action.operate":"Operate","workCenter.action.write":"Write","workCenter.action.custom":"Custom","workCenter.assignment.auto":"Use workflow policy","workCenter.model.inherit":"Use workflow model","workCenter.model.defaultProvider":"default provider","workCenter.planPreview":"Execution plan","workCenter.planPreviewHelp":"Resolved from this Agent\u2019s VP pool and model settings.","workCenter.settings.title":"Work Center settings","workCenter.settings.subtitle":"Configure the Coordinator plus reusable Action prompts, models, and effort for AI-planned work.","workCenter.settings.workflow":"Workflow","workCenter.settings.workflowHelp":"Triage chooses the task-specific Actions and executors dynamically.","workCenter.settings.aiWorkflowHelp":"Triage classifies each WorkItem and creates a validated flow of 1\u20138 task-specific Actions. Built-in Action policies are reusable defaults; triage may create a precise domain type when needed.","workCenter.settings.globalInstructions":"Global Agent instructions","workCenter.settings.globalInstructionsHint":"Example: Follow the repository release policy, require independent review, and never create deployment tags without explicit approval.","workCenter.settings.globalInstructionsHelp":"Stored at Agent level and frozen into every new WorkItem. Applied to triage and every generated Action, below the WorkItem contract and system/tool safety rules. Existing WorkItems keep their original snapshot.","workCenter.settings.actionPolicies":"Built-in Action policies","workCenter.settings.actionPoliciesHelp":"These are reusable execution baselines, not a fixed workflow. Unknown domain-specific Action types use the Custom policy plus their triage-generated type and objective.","workCenter.settings.dynamicInstructionHelp":"The AI adds the WorkItem contract, global instructions, prior Action context, memory, and a task-specific objective. This prompt defines the reusable behavior for this Action type.","workCenter.settings.models":"Models","workCenter.settings.modelsHelp":"Providers and credentials stay in Agent LLM settings. Work Center only selects available models.","workCenter.settings.dynamicModelsHelp":"Choose the Coordinator model separately from the models that execute Actions.","workCenter.settings.coordinatorModel":"Coordinator","workCenter.settings.coordinatorModelHelp":"Used for Work Item conversation, goal changes, and replanning. It never executes repository tools.","workCenter.settings.allActions":"Fallback for all Actions","workCenter.settings.maxConcurrentActions":"Maximum concurrent Actions","workCenter.settings.maxConcurrentActionsHelp":"Defaults to 3. Non-Git, dirty, shared, and integration work remains serial.","workCenter.workItemType":"Type","workCenter.typeAuto":"Auto \u2014 let the LLM infer","workCenter.typeHelp":"Choose a task category, or use Auto for AI inference. AI still plans the concrete Actions.","workCenter.planning":"Planning","workCenter.aiPlan":"AI-planned execution","workCenter.aiPlanHelp":"Triage chooses the task type, Actions, executors, and the smallest reliable flow. Work Center settings control model and effort.","workCenter.settings.manageProviders":"Manage Agent models","workCenter.settings.assignment":"VP selection","workCenter.settings.assignment.auto":"Auto from all VPs","workCenter.settings.assignment.pool":"Candidate pool","workCenter.settings.assignment.fixed":"Fixed VP","workCenter.settings.capability":"Required capability","workCenter.settings.vp":"Virtual Person","workCenter.settings.poolMembers":"Candidate VPs","workCenter.settings.modelPolicy":"Model policy","workCenter.settings.model.inherit":"Inherit from VP","workCenter.settings.model.primary":"Agent primary model","workCenter.settings.model.fast":"Agent fast model","workCenter.settings.model.specific":"Specific model","workCenter.settings.model":"Model","workCenter.settings.effort":"Reasoning effort","workCenter.settings.effortDefault":"Model default","workCenter.settings.effortHelp":"Overrides the selected model\u2019s default reasoning effort for every Work Center Action.","workCenter.settings.effortChooseModelHelp":"Select the Agent primary model, fast model, or a specific model to configure effort. Inherit from VP uses each VP\u2019s model default.","workCenter.settings.effortUnsupportedHelp":"The selected model does not expose configurable effort, so its model default is used.","workCenter.settings.saving":"Saving\u2026","workCenter.settings.reload":"Reload settings","workCenter.settings.conflict":"Settings changed elsewhere. Reload before saving again.","workCenter.settings.upgradeRequired":"This Agent version cannot save Work Center settings. The current values are shown read-only; upgrade the Agent to edit and save them.","workCenter.settings.saveNotConfirmed":"The Agent did not confirm the submitted prompts and model policy. Settings were not closed; reload or upgrade the Agent before trying again.","workCenter.settings.addWorkflow":"Duplicate workflow","workCenter.settings.removeWorkflow":"Remove","workCenter.settings.newWorkflow":"Workflow {index}","workCenter.settings.workflowName":"Workflow name","workCenter.settings.newStage":"New stage","workCenter.settings.addStage":"Add stage","workCenter.settings.removeStage":"Remove stage","workCenter.settings.moveUp":"Move stage up","workCenter.settings.moveDown":"Move stage down","workCenter.settings.stageType":"Stage type","workCenter.settings.reviewReturnStage":"Return to stage when changes are requested","workCenter.settings.instruction":"Stage prompt","workCenter.settings.instructionHint":"Define what this stage must do.","workCenter.settings.instructionHelp":"The WorkItem goal, acceptance criteria, and reusable context are added automatically at run time.","workCenter.settings.instructionReset":"Restore default"}});function Eo(){return typeof navigator>"u"||!navigator?"":navigator.userAgent||""}function _s(){let e=Eo();return/Android|iPhone|iPad|iPod|Windows Phone|IEMobile|BlackBerry|Opera Mini/i.test(e)}function ki(){return/MicroMessenger/i.test(Eo())}function Si(){return/AlipayClient/i.test(Eo())}var Lo=H(()=>{});var Bd,Wd=H(()=>{ct();St();Lo();Bd={name:"LoginPage",template:`
15
15
  <div class="login-page">
16
16
  <button class="login-lang-toggle" @click="toggleLang">
17
17
  {{ currentLocale === 'zh-CN' ? 'EN' : '\u4E2D\u6587' }}
@@ -303,7 +303,7 @@ The agent will restart after upgrading.`,"chat.agent.alreadyLatest":"Agent is al
303
303
  </template>
304
304
  </div>
305
305
  </div>
306
- `,setup(){let e=Me(),t=Vue.inject("t"),s=Vue.inject("locale"),n=Vue.ref(""),i=Vue.ref(""),r=Vue.ref(""),o=Vue.ref(""),a=Vue.ref(""),l=Vue.ref(null),c=Vue.ref(null),d=Vue.ref(null),u=Vue.ref(null),p=Vue.ref(null),f=Vue.ref(null),g=Vue.ref(""),v=Vue.ref(localStorage.getItem("loginMode")==="credentials"?"credentials":"oauth");Vue.watch(v,N=>localStorage.setItem("loginMode",N));let m=Vue.ref(""),A=Vue.ref(""),w=Vue.ref(""),k=Vue.ref(""),y=Vue.ref(""),h=Vue.ref(!1),b=Vue.ref(""),_=Vue.ref(""),L=Vue.ref(""),U=Vue.ref(""),$=Vue.ref(""),R=Vue.ref(""),P=Vue.ref(!1),T=Vue.ref(!1),I=()=>{a.value="",e.error=null,b.value="email",_.value="",U.value="",$.value="",R.value="",L.value="",T.value=!1},M=()=>{b.value="",L.value="",T.value=!1},B=async()=>{if(a.value="",!_.value||!/.+@.+\..+/.test(_.value)){a.value=t("login.forgot.emailInvalid");return}P.value=!0;try{let N=await e.requestPasswordReset(_.value.trim());if(!N)return;L.value=N,b.value="verify"}finally{P.value=!1}},F=async()=>{if(a.value="",!U.value){a.value=t("login.error.enterVerifyCode");return}if(!$.value||$.value.length<6){a.value=t("login.error.passwordMinLen");return}if($.value!==R.value){a.value=t("login.error.passwordMismatch");return}P.value=!0;try{await e.verifyPasswordReset(L.value,U.value,$.value)&&(T.value=!0,setTimeout(()=>{M(),v.value="credentials"},1500))}finally{P.value=!1}},z={alipay:'<svg viewBox="0 0 32 32" width="22" height="22" aria-hidden="true"><rect width="32" height="32" rx="6" fill="#1677FF"/><path fill="#fff" d="M25 18.6c-1.5-.5-3-1-4.6-1.7.4-.8.8-1.6 1.1-2.5h-2.9v-1h3.4v-.5h-3.4v-1.6h-1.4c-.3 0-.3.3-.3.3v1.3h-3.6v.5h3.6v1H11v.5h5.7c-.2.6-.4 1.2-.7 1.7-1.7-.5-3.4-.8-4.7-.8-2.2 0-3.7 1-3.8 2.5-.1 1.4.9 3 3.4 3 1.8 0 3.4-.9 4.7-2.5 2.2 1 4.2 2 6.6 2.9.3-.4.5-.8.7-1.2.2-.4.1-.9-.1-1.3zM11 19.7c-1.8 0-2.3-1.3-2.1-2 .1-.4.6-.9 1.4-1.1.4-.1 1.4-.1 2.4.2.9.2 1.8.5 2.7.8-.7 1.4-2.1 2.1-4.4 2.1z"/></svg>',microsoft:'<svg viewBox="0 0 21 21" width="20" height="20" aria-hidden="true"><rect x="1" y="1" width="9" height="9" fill="#f25022"/><rect x="1" y="11" width="9" height="9" fill="#00a4ef"/><rect x="11" y="1" width="9" height="9" fill="#7fba00"/><rect x="11" y="11" width="9" height="9" fill="#ffb900"/></svg>',github:'<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><path fill="currentColor" d="M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2c-3.3.7-4-1.6-4-1.6-.5-1.4-1.3-1.7-1.3-1.7-1.1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1.1 1.8 2.8 1.3 3.4 1 .1-.8.4-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.3.5-2.3 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2A11.5 11.5 0 0 1 12 5.8c1 0 2 .1 3 .4 2.3-1.5 3.3-1.2 3.3-1.2.6 1.7.2 2.9.1 3.2.7.9 1.2 1.9 1.2 3.2 0 4.6-2.8 5.7-5.5 6 .4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3"/></svg>',google:'<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/><path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84A11 11 0 0 0 12 23z"/><path fill="#FBBC05" d="M5.84 14.1A6.6 6.6 0 0 1 5.5 12c0-.73.13-1.44.34-2.1V7.07H2.18A11 11 0 0 0 1 12c0 1.77.42 3.45 1.18 4.93l3.66-2.83z"/><path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1A11 11 0 0 0 2.18 7.07l3.66 2.83C6.71 7.31 9.14 5.38 12 5.38z"/></svg>',wechat:'<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><path fill="#07C160" d="M9.5 4C5.36 4 2 6.91 2 10.5c0 2.07 1.13 3.91 2.86 5.09L4 18l2.7-1.41c.85.22 1.76.34 2.7.34h.51c-.13-.42-.21-.86-.21-1.32 0-3 2.91-5.43 6.5-5.43.32 0 .64.02.95.06C16.63 7.32 13.4 4 9.5 4zM7 8.5a1 1 0 110 2 1 1 0 010-2zm5 0a1 1 0 110 2 1 1 0 010-2zm4.21 3.66c-3.04 0-5.5 1.92-5.5 4.29 0 1.39.91 2.65 2.34 3.46l-.46 1.5 1.93-.95c.55.13 1.13.2 1.69.2 3.04 0 5.5-1.92 5.5-4.21 0-2.37-2.46-4.29-5.5-4.29zm-1.71 2.21a.75.75 0 110 1.5.75.75 0 010-1.5zm3.42 0a.75.75 0 110 1.5.75.75 0 010-1.5z"/></svg>'},ne=Vue.computed(()=>["alipay","microsoft","github","google","wechat"].filter(O=>O==="microsoft"?e.aadEnabled:!!e.ssoProviders[O]).map(O=>({key:O,label:t(`login.${O}`),icon:z[O]}))),ve=()=>{c.value&&c.value.focus()},ue=()=>{v.value="credentials",Vue.nextTick(()=>{l.value&&l.value.focus()})},be=()=>{let N=e.qrPanel;if(!N||!N.authorizeUrl)return;let O=`alipays://platformapi/startapp?appId=20000067&url=${encodeURIComponent(N.authorizeUrl)}`;window.location.href=O},oe=N=>{if(a.value="",N==="microsoft"){e.loginWithMicrosoft();return}if(N==="alipay"){Si()?e.loginWithSso(N):Rs()?e.loginWithAlipayMobile():e.startSsoQr(N).then(O=>{O&&x()});return}if(N==="wechat"){if(Rs()||ki()){a.value=t("login.wechat.mobileUnsupported");return}e.startSsoQr(N).then(O=>{O&&x()});return}e.loginWithSso(N)},Ce=async()=>{if(!n.value){a.value=t("login.error.enterUsername");return}if(!i.value){a.value=t("login.error.enterPassword");return}a.value="",await e.login(n.value,i.value),Vue.nextTick(()=>{(e.loginStep==="totp"||e.loginStep==="totp-setup")&&u.value?u.value.focus():e.loginStep==="verification"&&d.value&&d.value.focus()})},x=()=>{if(e.qrPanel&&typeof qrcode=="function")try{let N=qrcode(0,"M");N.addData(e.qrPanel.authorizeUrl,"Byte"),N.make(),g.value=N.createDataURL(6,4)}catch{}},j=Vue.computed(()=>{let N=e.qrPanel?.provider;return t(N==="alipay"?"login.qr.titleAlipay":N==="wechat"?"login.qr.titleWechat":"login.qr.title")});Vue.watch(()=>e.qrPanel?.authorizeUrl,N=>{N?x():g.value=""});let ae=async()=>{if(!o.value||o.value.length!==6){a.value=t("login.error.enter6Digit");return}a.value="",await e.verifyTotpCode(o.value)&&e.loginStep==="verification"&&(o.value="",Vue.nextTick(()=>{d.value&&d.value.focus()}))},he=async()=>{if(!o.value||o.value.length!==6){a.value=t("login.error.enter6Digit");return}a.value="",await e.completeTotpSetup(o.value)&&e.loginStep==="verification"&&(o.value="",Vue.nextTick(()=>{d.value&&d.value.focus()}))},W=async()=>{if(a.value="",h.value=!1,!A.value||A.value.length<2){a.value=t("login.error.usernameMinLen");return}if(!w.value||w.value.length<6){a.value=t("login.error.passwordMinLen");return}if(w.value!==k.value){a.value=t("login.error.passwordMismatch");return}await e.register(A.value,w.value,y.value||void 0,m.value)&&(h.value=!0,n.value=A.value,m.value="",A.value="",w.value="",k.value="",y.value="",setTimeout(()=>e.backToCredentials(),1500))},te=async()=>{if(!r.value){a.value=t("login.error.enterVerifyCode");return}a.value="",await e.verifyCode(r.value)};return Vue.onMounted(async()=>{await e.checkAuthMode(),ne.value.length===0&&v.value==="oauth"&&(v.value="credentials"),e.loginStep==="credentials"&&v.value==="credentials"&&l.value&&l.value.focus()}),Vue.watch(()=>e.loginStep,N=>{Vue.nextTick(()=>{N==="credentials"&&v.value==="credentials"&&l.value?l.value.focus():(N==="totp"||N==="totp-setup")&&u.value?u.value.focus():N==="verification"&&d.value?d.value.focus():N==="register"&&p.value&&p.value.focus()})}),{authStore:e,currentLocale:s,toggleLang:()=>{Zs(s.value==="zh-CN"?"en":"zh-CN")},loginMode:v,switchToCredentials:ue,enabledProviders:ne,handleProviderClick:oe,relaunchAlipayMobile:be,qrCanvas:f,qrDataUrl:g,qrPanelTitle:j,username:n,password:i,verificationCode:r,totpCode:o,localError:a,usernameInput:l,passwordInput:c,codeInput:d,totpInput:u,regCodeInput:p,regInvitationCode:m,regUsername:A,regPassword:w,regPasswordConfirm:k,regEmail:y,registerSuccess:h,focusPassword:ve,login:Ce,verify:te,verifyTotp:ae,setupTotp:he,doRegister:W,forgotStep:b,forgotEmail:_,forgotResetToken:L,forgotCode:U,forgotNewPassword:$,forgotConfirm:R,forgotLoading:P,forgotSuccess:T,enterForgotMode:I,exitForgotMode:M,submitForgotEmail:B,submitForgotReset:F}}}});var Ci,$o=H(()=>{Ci={name:"ChatHeader",emits:["toggle-sidebar","close-pane"],props:{conversationId:{type:String,default:null},paneId:{type:String,default:null},showClosePane:{type:Boolean,default:!1}},template:`
306
+ `,setup(){let e=Me(),t=Vue.inject("t"),s=Vue.inject("locale"),n=Vue.ref(""),i=Vue.ref(""),r=Vue.ref(""),o=Vue.ref(""),a=Vue.ref(""),l=Vue.ref(null),c=Vue.ref(null),d=Vue.ref(null),u=Vue.ref(null),p=Vue.ref(null),f=Vue.ref(null),g=Vue.ref(""),v=Vue.ref(localStorage.getItem("loginMode")==="credentials"?"credentials":"oauth");Vue.watch(v,N=>localStorage.setItem("loginMode",N));let m=Vue.ref(""),A=Vue.ref(""),w=Vue.ref(""),k=Vue.ref(""),y=Vue.ref(""),h=Vue.ref(!1),b=Vue.ref(""),R=Vue.ref(""),L=Vue.ref(""),U=Vue.ref(""),$=Vue.ref(""),_=Vue.ref(""),P=Vue.ref(!1),T=Vue.ref(!1),I=()=>{a.value="",e.error=null,b.value="email",R.value="",U.value="",$.value="",_.value="",L.value="",T.value=!1},M=()=>{b.value="",L.value="",T.value=!1},B=async()=>{if(a.value="",!R.value||!/.+@.+\..+/.test(R.value)){a.value=t("login.forgot.emailInvalid");return}P.value=!0;try{let N=await e.requestPasswordReset(R.value.trim());if(!N)return;L.value=N,b.value="verify"}finally{P.value=!1}},F=async()=>{if(a.value="",!U.value){a.value=t("login.error.enterVerifyCode");return}if(!$.value||$.value.length<6){a.value=t("login.error.passwordMinLen");return}if($.value!==_.value){a.value=t("login.error.passwordMismatch");return}P.value=!0;try{await e.verifyPasswordReset(L.value,U.value,$.value)&&(T.value=!0,setTimeout(()=>{M(),v.value="credentials"},1500))}finally{P.value=!1}},z={alipay:'<svg viewBox="0 0 32 32" width="22" height="22" aria-hidden="true"><rect width="32" height="32" rx="6" fill="#1677FF"/><path fill="#fff" d="M25 18.6c-1.5-.5-3-1-4.6-1.7.4-.8.8-1.6 1.1-2.5h-2.9v-1h3.4v-.5h-3.4v-1.6h-1.4c-.3 0-.3.3-.3.3v1.3h-3.6v.5h3.6v1H11v.5h5.7c-.2.6-.4 1.2-.7 1.7-1.7-.5-3.4-.8-4.7-.8-2.2 0-3.7 1-3.8 2.5-.1 1.4.9 3 3.4 3 1.8 0 3.4-.9 4.7-2.5 2.2 1 4.2 2 6.6 2.9.3-.4.5-.8.7-1.2.2-.4.1-.9-.1-1.3zM11 19.7c-1.8 0-2.3-1.3-2.1-2 .1-.4.6-.9 1.4-1.1.4-.1 1.4-.1 2.4.2.9.2 1.8.5 2.7.8-.7 1.4-2.1 2.1-4.4 2.1z"/></svg>',microsoft:'<svg viewBox="0 0 21 21" width="20" height="20" aria-hidden="true"><rect x="1" y="1" width="9" height="9" fill="#f25022"/><rect x="1" y="11" width="9" height="9" fill="#00a4ef"/><rect x="11" y="1" width="9" height="9" fill="#7fba00"/><rect x="11" y="11" width="9" height="9" fill="#ffb900"/></svg>',github:'<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><path fill="currentColor" d="M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2c-3.3.7-4-1.6-4-1.6-.5-1.4-1.3-1.7-1.3-1.7-1.1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1.1 1.8 2.8 1.3 3.4 1 .1-.8.4-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.3.5-2.3 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2A11.5 11.5 0 0 1 12 5.8c1 0 2 .1 3 .4 2.3-1.5 3.3-1.2 3.3-1.2.6 1.7.2 2.9.1 3.2.7.9 1.2 1.9 1.2 3.2 0 4.6-2.8 5.7-5.5 6 .4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3"/></svg>',google:'<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/><path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84A11 11 0 0 0 12 23z"/><path fill="#FBBC05" d="M5.84 14.1A6.6 6.6 0 0 1 5.5 12c0-.73.13-1.44.34-2.1V7.07H2.18A11 11 0 0 0 1 12c0 1.77.42 3.45 1.18 4.93l3.66-2.83z"/><path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1A11 11 0 0 0 2.18 7.07l3.66 2.83C6.71 7.31 9.14 5.38 12 5.38z"/></svg>',wechat:'<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><path fill="#07C160" d="M9.5 4C5.36 4 2 6.91 2 10.5c0 2.07 1.13 3.91 2.86 5.09L4 18l2.7-1.41c.85.22 1.76.34 2.7.34h.51c-.13-.42-.21-.86-.21-1.32 0-3 2.91-5.43 6.5-5.43.32 0 .64.02.95.06C16.63 7.32 13.4 4 9.5 4zM7 8.5a1 1 0 110 2 1 1 0 010-2zm5 0a1 1 0 110 2 1 1 0 010-2zm4.21 3.66c-3.04 0-5.5 1.92-5.5 4.29 0 1.39.91 2.65 2.34 3.46l-.46 1.5 1.93-.95c.55.13 1.13.2 1.69.2 3.04 0 5.5-1.92 5.5-4.21 0-2.37-2.46-4.29-5.5-4.29zm-1.71 2.21a.75.75 0 110 1.5.75.75 0 010-1.5zm3.42 0a.75.75 0 110 1.5.75.75 0 010-1.5z"/></svg>'},ne=Vue.computed(()=>["alipay","microsoft","github","google","wechat"].filter(O=>O==="microsoft"?e.aadEnabled:!!e.ssoProviders[O]).map(O=>({key:O,label:t(`login.${O}`),icon:z[O]}))),ve=()=>{c.value&&c.value.focus()},ue=()=>{v.value="credentials",Vue.nextTick(()=>{l.value&&l.value.focus()})},be=()=>{let N=e.qrPanel;if(!N||!N.authorizeUrl)return;let O=`alipays://platformapi/startapp?appId=20000067&url=${encodeURIComponent(N.authorizeUrl)}`;window.location.href=O},oe=N=>{if(a.value="",N==="microsoft"){e.loginWithMicrosoft();return}if(N==="alipay"){Si()?e.loginWithSso(N):_s()?e.loginWithAlipayMobile():e.startSsoQr(N).then(O=>{O&&x()});return}if(N==="wechat"){if(_s()||ki()){a.value=t("login.wechat.mobileUnsupported");return}e.startSsoQr(N).then(O=>{O&&x()});return}e.loginWithSso(N)},Ce=async()=>{if(!n.value){a.value=t("login.error.enterUsername");return}if(!i.value){a.value=t("login.error.enterPassword");return}a.value="",await e.login(n.value,i.value),Vue.nextTick(()=>{(e.loginStep==="totp"||e.loginStep==="totp-setup")&&u.value?u.value.focus():e.loginStep==="verification"&&d.value&&d.value.focus()})},x=()=>{if(e.qrPanel&&typeof qrcode=="function")try{let N=qrcode(0,"M");N.addData(e.qrPanel.authorizeUrl,"Byte"),N.make(),g.value=N.createDataURL(6,4)}catch{}},j=Vue.computed(()=>{let N=e.qrPanel?.provider;return t(N==="alipay"?"login.qr.titleAlipay":N==="wechat"?"login.qr.titleWechat":"login.qr.title")});Vue.watch(()=>e.qrPanel?.authorizeUrl,N=>{N?x():g.value=""});let ae=async()=>{if(!o.value||o.value.length!==6){a.value=t("login.error.enter6Digit");return}a.value="",await e.verifyTotpCode(o.value)&&e.loginStep==="verification"&&(o.value="",Vue.nextTick(()=>{d.value&&d.value.focus()}))},he=async()=>{if(!o.value||o.value.length!==6){a.value=t("login.error.enter6Digit");return}a.value="",await e.completeTotpSetup(o.value)&&e.loginStep==="verification"&&(o.value="",Vue.nextTick(()=>{d.value&&d.value.focus()}))},W=async()=>{if(a.value="",h.value=!1,!A.value||A.value.length<2){a.value=t("login.error.usernameMinLen");return}if(!w.value||w.value.length<6){a.value=t("login.error.passwordMinLen");return}if(w.value!==k.value){a.value=t("login.error.passwordMismatch");return}await e.register(A.value,w.value,y.value||void 0,m.value)&&(h.value=!0,n.value=A.value,m.value="",A.value="",w.value="",k.value="",y.value="",setTimeout(()=>e.backToCredentials(),1500))},te=async()=>{if(!r.value){a.value=t("login.error.enterVerifyCode");return}a.value="",await e.verifyCode(r.value)};return Vue.onMounted(async()=>{await e.checkAuthMode(),ne.value.length===0&&v.value==="oauth"&&(v.value="credentials"),e.loginStep==="credentials"&&v.value==="credentials"&&l.value&&l.value.focus()}),Vue.watch(()=>e.loginStep,N=>{Vue.nextTick(()=>{N==="credentials"&&v.value==="credentials"&&l.value?l.value.focus():(N==="totp"||N==="totp-setup")&&u.value?u.value.focus():N==="verification"&&d.value?d.value.focus():N==="register"&&p.value&&p.value.focus()})}),{authStore:e,currentLocale:s,toggleLang:()=>{Zs(s.value==="zh-CN"?"en":"zh-CN")},loginMode:v,switchToCredentials:ue,enabledProviders:ne,handleProviderClick:oe,relaunchAlipayMobile:be,qrCanvas:f,qrDataUrl:g,qrPanelTitle:j,username:n,password:i,verificationCode:r,totpCode:o,localError:a,usernameInput:l,passwordInput:c,codeInput:d,totpInput:u,regCodeInput:p,regInvitationCode:m,regUsername:A,regPassword:w,regPasswordConfirm:k,regEmail:y,registerSuccess:h,focusPassword:ve,login:Ce,verify:te,verifyTotp:ae,setupTotp:he,doRegister:W,forgotStep:b,forgotEmail:R,forgotResetToken:L,forgotCode:U,forgotNewPassword:$,forgotConfirm:_,forgotLoading:P,forgotSuccess:T,enterForgotMode:I,exitForgotMode:M,submitForgotEmail:B,submitForgotReset:F}}}});var Ci,$o=H(()=>{Ci={name:"ChatHeader",emits:["toggle-sidebar","close-pane"],props:{conversationId:{type:String,default:null},paneId:{type:String,default:null},showClosePane:{type:Boolean,default:!1}},template:`
307
307
  <header class="chat-header">
308
308
  <!-- Mobile sidebar toggle \u2014 hidden on desktop and in split mode -->
309
309
  <button class="header-sidebar-toggle" v-if="!store.isSplitMode"
@@ -405,7 +405,7 @@ The agent will restart after upgrading.`,"chat.agent.alreadyLatest":"Agent is al
405
405
  </button>
406
406
  </div>
407
407
  </header>
408
- `,setup(e){let t=Pinia.useChatStore(),s=Vue.inject("t"),n=Vue.computed(()=>e.conversationId||t.currentConversation),i=Vue.computed(()=>n.value&&t.conversations.find(x=>x.id===n.value)||null),r=Vue.computed(()=>i.value?.capabilities||null),o=Vue.computed(()=>n.value?(i.value?.provider||"claude-code")==="claude-code":!0),a=(x,j=!0)=>{let ae=r.value;return ae?!!ae[x]:o.value?j:!1},l=Vue.computed(()=>a("compact")),c=Vue.computed(()=>a("clear")),d=Vue.computed(()=>a("expert")),u=Vue.computed(()=>a("mcp")),p=Vue.computed(()=>{if(!n.value)return"Yeaft";let x=t.getConversationTitle(n.value);if(x)return x;let ae=t.conversations.find(he=>he.id===n.value)?.workDir||t.currentWorkDir;if(ae){let he=ae.split(/[/\\]/);return he[he.length-1]||he[he.length-2]||ae}return s("chatHeader.newConv")}),f=Vue.computed(()=>{if(!n.value)return"";let j=t.conversations.find(he=>he.id===n.value)?.agentId;return j&&t.agents.find(he=>he.id===j)?.name||""}),g=Vue.computed(()=>t.clearStatus?.conversationId===n.value?!0:t.compactStatus?t.compactStatus.conversationId===n.value:!1),v=Vue.computed(()=>t.clearStatus?.conversationId===n.value?t.clearStatus.status==="clearing"?"compacting":"completed":t.compactStatus?t.compactStatus.status==="compacting"?"compacting":"completed":""),m=Vue.computed(()=>t.clearStatus?.conversationId===n.value?t.clearStatus.status==="clearing":t.compactStatus?.status==="compacting"),A=Vue.computed(()=>t.clearStatus?.conversationId===n.value?t.clearStatus.status==="clearing"?s("chatHeader.clearing"):s("chatHeader.clearDone"):t.compactStatus?t.compactStatus.status==="compacting"?t.compactStatus.message||s("chatHeader.compacting"):t.compactStatus.message||s("chatHeader.compactDone"):""),w=Vue.computed(()=>n.value&&(t.conversations.find(j=>j.id===n.value)?.workDir||t.currentWorkDir)||""),k=Vue.computed(()=>!t.contextUsage||t.contextUsage.conversationId!==n.value?null:t.contextUsage),y=Vue.computed(()=>{let x=k.value?.percentage||0;return x>=80?"context-danger":x>=50?"context-warn":"context-ok"}),h=Vue.computed(()=>{if(!k.value)return"";let x=(k.value.inputTokens/1e3).toFixed(0),j=(k.value.maxTokens/1e3).toFixed(0);return`Context: ${x}k / ${j}k`}),b=Vue.computed(()=>t.isRefreshingSession(n.value)),_=Vue.computed(()=>t.compactStatus?.status==="compacting"&&t.compactStatus?.conversationId===n.value),L=Vue.computed(()=>t.clearStatus?.status==="clearing"&&t.clearStatus?.conversationId===n.value),U=Vue.computed(()=>n.value?!t.isRefreshingSession(n.value):!1),$=()=>{t.isRefreshingSession(n.value)||!n.value||(t.setRefreshingSession(n.value,!0),t.startRefreshTimeout(n.value),t.processingConversations[n.value]||(t.messagesMap[n.value]=[]),t.requestChatHistory(n.value,{mode:"recent",turns:5}))},R=()=>{_.value||t.sendMessage("/compact")},P=()=>{window.location.reload()},T=()=>{L.value||confirm(s("chatHeader.confirmClear"))&&(t.clearStatus={conversationId:n.value,status:"clearing"},t.sendMessage("/clear"))},I=Vue.computed(()=>t.getPaneRightPanel(e.paneId)),M=Vue.ref(null),B=Vue.computed(()=>{if(!t.mcpPanelOpen||!M.value)return null;let x=M.value.getBoundingClientRect();return{top:`${x.bottom+6}px`,right:`${window.innerWidth-x.right}px`}}),F=Vue.computed(()=>t.currentMcpServers.filter(x=>x.enabled).length),z=Vue.computed(()=>!!t.conversations.find(j=>j.id===n.value)?.needRestart),ne=()=>{t.mcpPanelOpen=!t.mcpPanelOpen},ve=()=>{t.togglePaneRightPanel("experts",e.paneId)},ue=()=>{t.togglePaneRightPanel("subagents",e.paneId)},be=Vue.computed(()=>t.runningSubagentCount),oe=(x,j)=>{t.toggleConversationMcp(x,j)},Ce=x=>{t.mcpPanelOpen&&!x.target.closest(".mcp-dropdown")&&!x.target.closest(".mcp-config-wrapper")&&(t.mcpPanelOpen=!1)};return Vue.onMounted(()=>{document.addEventListener("click",Ce)}),Vue.onUnmounted(()=>{document.removeEventListener("click",Ce)}),{store:t,effectiveConvId:n,effectiveRightPanel:I,isClaudeCode:o,canCompact:l,canClear:c,canExpert:d,canMcp:u,headerTitle:p,showStatusBanner:g,statusBannerClass:v,statusBannerSpinner:m,statusBannerMessage:A,contextUsage:k,contextColorClass:y,contextLabel:h,isRefreshing:b,isCompacting:_,isClearing:L,canRefresh:U,refreshSession:$,reloadPage:P,compactContext:R,clearMessages:T,mcpBtnRef:M,mcpDropdownStyle:B,mcpEnabledCount:F,currentConvNeedRestart:z,toggleMcpPanel:ne,toggleMcpServer:oe,toggleExpertPanel:ve,toggleSubAgentPanel:ue,runningSubagentCount:be}}}});function vn(e=globalThis.location){let t=e?.protocol==="https:"?"wss:":"ws:",s=e?.host||"localhost";return`${t}//${s}`}function Ii(){return"npm install -g @yeaft/webchat-agent"}function Ai(){return"yeaft-agent llm use github-copilot --model gpt-5.5"}function Vo(e=null){let t=e&&(e.username||e.displayName)||"agent",s=2166136261;for(let r=0;r<t.length;r++)s^=t.charCodeAt(r),s=s+((s<<1)+(s<<4)+(s<<7)+(s<<8)+(s<<24))>>>0;let n=s.toString(16).padStart(8,"0").slice(0,6);return`${String(t).replace(/[^A-Za-z0-9_-]/g,"-").replace(/^-+|-+$/g,"")||"agent"}-${n}`}function xi({profile:e=null,agentSecret:t="",serverWsUrl:s=vn()}={}){if(!t)return"";let n=Vo(e);return`yeaft-agent install --server ${s} --secret ${t} --name ${n}`}var Fo=H(()=>{});function Ds(e,{alt:t="Preview",closeLabel:s="Close",trigger:n=null}={}){if(!e)return;let i=document.createElement("div");i.className="image-preview-overlay",i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-label",t);let r=document.createElement("img");r.className="image-preview-img",r.src=e,r.alt=t;let o=document.createElement("button");o.type="button",o.className="image-preview-close",o.setAttribute("aria-label",s),o.textContent="\xD7",i.append(r,o),document.body.appendChild(i),i.offsetHeight,i.classList.add("visible"),o.focus();let a=!1,l=()=>i.remove(),c=()=>{a||(a=!0,i.classList.remove("visible"),i.addEventListener("transitionend",l,{once:!0}),setTimeout(l,250),document.removeEventListener("keydown",d),n?.isConnected&&typeof n.focus=="function"&&n.focus())},d=u=>{u.key==="Escape"&&c(),u.key==="Tab"&&(u.preventDefault(),o.focus())};o.addEventListener("click",c),i.addEventListener("click",u=>{u.target===i&&c()}),document.addEventListener("keydown",d)}var Ti=H(()=>{});function ph(e){let t=[];for(let s of e)s==="\b"?t.pop():t.push(s);return t.join("")}function fh(e){let t=e.split("\r"),s=t[t.length-1]||"";return ph(s)}function jd(e){return e.replace(/\r\n/g,`
408
+ `,setup(e){let t=Pinia.useChatStore(),s=Vue.inject("t"),n=Vue.computed(()=>e.conversationId||t.currentConversation),i=Vue.computed(()=>n.value&&t.conversations.find(x=>x.id===n.value)||null),r=Vue.computed(()=>i.value?.capabilities||null),o=Vue.computed(()=>n.value?(i.value?.provider||"claude-code")==="claude-code":!0),a=(x,j=!0)=>{let ae=r.value;return ae?!!ae[x]:o.value?j:!1},l=Vue.computed(()=>a("compact")),c=Vue.computed(()=>a("clear")),d=Vue.computed(()=>a("expert")),u=Vue.computed(()=>a("mcp")),p=Vue.computed(()=>{if(!n.value)return"Yeaft";let x=t.getConversationTitle(n.value);if(x)return x;let ae=t.conversations.find(he=>he.id===n.value)?.workDir||t.currentWorkDir;if(ae){let he=ae.split(/[/\\]/);return he[he.length-1]||he[he.length-2]||ae}return s("chatHeader.newConv")}),f=Vue.computed(()=>{if(!n.value)return"";let j=t.conversations.find(he=>he.id===n.value)?.agentId;return j&&t.agents.find(he=>he.id===j)?.name||""}),g=Vue.computed(()=>t.clearStatus?.conversationId===n.value?!0:t.compactStatus?t.compactStatus.conversationId===n.value:!1),v=Vue.computed(()=>t.clearStatus?.conversationId===n.value?t.clearStatus.status==="clearing"?"compacting":"completed":t.compactStatus?t.compactStatus.status==="compacting"?"compacting":"completed":""),m=Vue.computed(()=>t.clearStatus?.conversationId===n.value?t.clearStatus.status==="clearing":t.compactStatus?.status==="compacting"),A=Vue.computed(()=>t.clearStatus?.conversationId===n.value?t.clearStatus.status==="clearing"?s("chatHeader.clearing"):s("chatHeader.clearDone"):t.compactStatus?t.compactStatus.status==="compacting"?t.compactStatus.message||s("chatHeader.compacting"):t.compactStatus.message||s("chatHeader.compactDone"):""),w=Vue.computed(()=>n.value&&(t.conversations.find(j=>j.id===n.value)?.workDir||t.currentWorkDir)||""),k=Vue.computed(()=>!t.contextUsage||t.contextUsage.conversationId!==n.value?null:t.contextUsage),y=Vue.computed(()=>{let x=k.value?.percentage||0;return x>=80?"context-danger":x>=50?"context-warn":"context-ok"}),h=Vue.computed(()=>{if(!k.value)return"";let x=(k.value.inputTokens/1e3).toFixed(0),j=(k.value.maxTokens/1e3).toFixed(0);return`Context: ${x}k / ${j}k`}),b=Vue.computed(()=>t.isRefreshingSession(n.value)),R=Vue.computed(()=>t.compactStatus?.status==="compacting"&&t.compactStatus?.conversationId===n.value),L=Vue.computed(()=>t.clearStatus?.status==="clearing"&&t.clearStatus?.conversationId===n.value),U=Vue.computed(()=>n.value?!t.isRefreshingSession(n.value):!1),$=()=>{t.isRefreshingSession(n.value)||!n.value||(t.setRefreshingSession(n.value,!0),t.startRefreshTimeout(n.value),t.processingConversations[n.value]||(t.messagesMap[n.value]=[]),t.requestChatHistory(n.value,{mode:"recent",turns:5}))},_=()=>{R.value||t.sendMessage("/compact")},P=()=>{window.location.reload()},T=()=>{L.value||confirm(s("chatHeader.confirmClear"))&&(t.clearStatus={conversationId:n.value,status:"clearing"},t.sendMessage("/clear"))},I=Vue.computed(()=>t.getPaneRightPanel(e.paneId)),M=Vue.ref(null),B=Vue.computed(()=>{if(!t.mcpPanelOpen||!M.value)return null;let x=M.value.getBoundingClientRect();return{top:`${x.bottom+6}px`,right:`${window.innerWidth-x.right}px`}}),F=Vue.computed(()=>t.currentMcpServers.filter(x=>x.enabled).length),z=Vue.computed(()=>!!t.conversations.find(j=>j.id===n.value)?.needRestart),ne=()=>{t.mcpPanelOpen=!t.mcpPanelOpen},ve=()=>{t.togglePaneRightPanel("experts",e.paneId)},ue=()=>{t.togglePaneRightPanel("subagents",e.paneId)},be=Vue.computed(()=>t.runningSubagentCount),oe=(x,j)=>{t.toggleConversationMcp(x,j)},Ce=x=>{t.mcpPanelOpen&&!x.target.closest(".mcp-dropdown")&&!x.target.closest(".mcp-config-wrapper")&&(t.mcpPanelOpen=!1)};return Vue.onMounted(()=>{document.addEventListener("click",Ce)}),Vue.onUnmounted(()=>{document.removeEventListener("click",Ce)}),{store:t,effectiveConvId:n,effectiveRightPanel:I,isClaudeCode:o,canCompact:l,canClear:c,canExpert:d,canMcp:u,headerTitle:p,showStatusBanner:g,statusBannerClass:v,statusBannerSpinner:m,statusBannerMessage:A,contextUsage:k,contextColorClass:y,contextLabel:h,isRefreshing:b,isCompacting:R,isClearing:L,canRefresh:U,refreshSession:$,reloadPage:P,compactContext:_,clearMessages:T,mcpBtnRef:M,mcpDropdownStyle:B,mcpEnabledCount:F,currentConvNeedRestart:z,toggleMcpPanel:ne,toggleMcpServer:oe,toggleExpertPanel:ve,toggleSubAgentPanel:ue,runningSubagentCount:be}}}});function vn(e=globalThis.location){let t=e?.protocol==="https:"?"wss:":"ws:",s=e?.host||"localhost";return`${t}//${s}`}function Ii(){return"npm install -g @yeaft/webchat-agent"}function Ai(){return"yeaft-agent llm use github-copilot --model gpt-5.5"}function Vo(e=null){let t=e&&(e.username||e.displayName)||"agent",s=2166136261;for(let r=0;r<t.length;r++)s^=t.charCodeAt(r),s=s+((s<<1)+(s<<4)+(s<<7)+(s<<8)+(s<<24))>>>0;let n=s.toString(16).padStart(8,"0").slice(0,6);return`${String(t).replace(/[^A-Za-z0-9_-]/g,"-").replace(/^-+|-+$/g,"")||"agent"}-${n}`}function xi({profile:e=null,agentSecret:t="",serverWsUrl:s=vn()}={}){if(!t)return"";let n=Vo(e);return`yeaft-agent install --server ${s} --secret ${t} --name ${n}`}var Fo=H(()=>{});function Ds(e,{alt:t="Preview",closeLabel:s="Close",trigger:n=null}={}){if(!e)return;let i=document.createElement("div");i.className="image-preview-overlay",i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-label",t);let r=document.createElement("img");r.className="image-preview-img",r.src=e,r.alt=t;let o=document.createElement("button");o.type="button",o.className="image-preview-close",o.setAttribute("aria-label",s),o.textContent="\xD7",i.append(r,o),document.body.appendChild(i),i.offsetHeight,i.classList.add("visible"),o.focus();let a=!1,l=()=>i.remove(),c=()=>{a||(a=!0,i.classList.remove("visible"),i.addEventListener("transitionend",l,{once:!0}),setTimeout(l,250),document.removeEventListener("keydown",d),n?.isConnected&&typeof n.focus=="function"&&n.focus())},d=u=>{u.key==="Escape"&&c(),u.key==="Tab"&&(u.preventDefault(),o.focus())};o.addEventListener("click",c),i.addEventListener("click",u=>{u.target===i&&c()}),document.addEventListener("keydown",d)}var Ti=H(()=>{});function ph(e){let t=[];for(let s of e)s==="\b"?t.pop():t.push(s);return t.join("")}function fh(e){let t=e.split("\r"),s=t[t.length-1]||"";return ph(s)}function jd(e){return e.replace(/\r\n/g,`
409
409
  `).split(`
410
410
  `).map(t=>fh(t)).join(`
411
411
  `)}function Gd(e){return e.replace(dh,"").replace(uh,"")}function gh(e){return e?e.split(";").filter(t=>t!=="").map(t=>Number(t)).filter(Number.isFinite):[0]}function Ud(e,t){let s=t==="bg"&&e>=30&&e<=37||t==="bg"&&e>=90&&e<=97?e+10:e;return t==="bg"?No.get(s):qo.get(s)}function zd(e,t,s){let n=Bo[0],i=1/0;for(let r of Bo){let o=(r.r-e)**2+(r.g-t)**2+(r.b-s)**2;o<i&&(n=r,i=o)}return n.code}function mh(e){if(e<0||e>255)return null;if(e<16){let s=Bo[e];return{r:s.r,g:s.g,b:s.b}}if(e>=232){let s=8+(e-232)*10;return{r:s,g:s,b:s}}let t=e-16;return{r:Oo[Math.floor(t/36)],g:Oo[Math.floor(t%36/6)],b:Oo[t%6]}}function Kd(e,t,s,n){let i=s[n+1];if(i===5){let r=s[n+2];if(Number.isFinite(r)){let o=mh(r);o&&(e[t]=Ud(zd(o.r,o.g,o.b),t)||"")}return n+3}if(i===2){let r=s[n+2],o=s[n+3],a=s[n+4];return Number.isFinite(r)&&Number.isFinite(o)&&Number.isFinite(a)&&(e[t]=Ud(zd(r,o,a),t)||""),n+5}return n+2}function hh(e,t){let s={...e},n=t.length?t:[0];for(let i=0;i<n.length;){let r=n[i];if(r===0)s.fg="",s.bg="",s.bold=!1,s.dim=!1,s.italic=!1,s.underline=!1;else if(r===1)s.bold=!0,s.dim=!1;else if(r===2)s.dim=!0,s.bold=!1;else if(r===3)s.italic=!0;else if(r===4)s.underline=!0;else if(r===22)s.bold=!1,s.dim=!1;else if(r===23)s.italic=!1;else if(r===24)s.underline=!1;else if(r===39)s.fg="";else if(r===49)s.bg="";else if(qo.has(r))s.fg=qo.get(r);else if(No.has(r))s.bg=No.get(r);else if(r===38){i=Kd(s,"fg",n,i);continue}else if(r===48){i=Kd(s,"bg",n,i);continue}i+=1}return s}function vh(e){return[e.fg,e.bg,e.bold&&"terminal-bold",e.dim&&"terminal-dim",e.italic&&"terminal-italic",e.underline&&"terminal-underline"].filter(Boolean).join(" ")}function Yd(e,t,s){let n=Gd(t);if(!n)return;let i=vh(s),r=e[e.length-1];r&&r.className===i?r.text+=n:e.push({text:n,className:i})}function At(e){if(e==null)return"";let t=typeof e=="string"?e:String(e);return t?Gd(jd(t)):""}function Qd(e){if(e==null)return[];let t=typeof e=="string"?e:String(e);if(!t)return[];let s=jd(t),n=[],i={fg:"",bg:"",bold:!1,dim:!1,italic:!1,underline:!1},r=0;Ho.lastIndex=0;for(let o=Ho.exec(s);o;o=Ho.exec(s))Yd(n,s.slice(r,o.index),i),i=hh(i,gh(o[1])),r=o.index+o[0].length;return Yd(n,s.slice(r),i),n}var dh,Ho,uh,qo,No,Bo,Oo,yn=H(()=>{dh=/[\u001b\u009b](?:[\[\]()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><~]|\][^\u0007]*(?:\u0007|\u001b\\)|[PX^_][\s\S]*?\u001b\\)/g,Ho=/(?:\u001b\[|\u009b)([0-9;]*)m/g,uh=/[\u0000-\u0008\u000b\u000c\u000e-\u001a\u001c-\u001f\u007f-\u009f]/g,qo=new Map([[30,"terminal-fg-black"],[31,"terminal-fg-red"],[32,"terminal-fg-green"],[33,"terminal-fg-yellow"],[34,"terminal-fg-blue"],[35,"terminal-fg-magenta"],[36,"terminal-fg-cyan"],[37,"terminal-fg-white"],[90,"terminal-fg-bright-black"],[91,"terminal-fg-bright-red"],[92,"terminal-fg-bright-green"],[93,"terminal-fg-bright-yellow"],[94,"terminal-fg-bright-blue"],[95,"terminal-fg-bright-magenta"],[96,"terminal-fg-bright-cyan"],[97,"terminal-fg-bright-white"]]),No=new Map([[40,"terminal-bg-black"],[41,"terminal-bg-red"],[42,"terminal-bg-green"],[43,"terminal-bg-yellow"],[44,"terminal-bg-blue"],[45,"terminal-bg-magenta"],[46,"terminal-bg-cyan"],[47,"terminal-bg-white"],[100,"terminal-bg-bright-black"],[101,"terminal-bg-bright-red"],[102,"terminal-bg-bright-green"],[103,"terminal-bg-bright-yellow"],[104,"terminal-bg-bright-blue"],[105,"terminal-bg-bright-magenta"],[106,"terminal-bg-bright-cyan"],[107,"terminal-bg-bright-white"]]),Bo=[{code:30,r:0,g:0,b:0},{code:31,r:170,g:0,b:0},{code:32,r:0,g:170,b:0},{code:33,r:170,g:85,b:0},{code:34,r:0,g:0,b:170},{code:35,r:170,g:0,b:170},{code:36,r:0,g:170,b:170},{code:37,r:170,g:170,b:170},{code:90,r:85,g:85,b:85},{code:91,r:255,g:85,b:85},{code:92,r:85,g:255,b:85},{code:93,r:255,g:255,b:85},{code:94,r:85,g:85,b:255},{code:95,r:255,g:85,b:255},{code:96,r:85,g:255,b:255},{code:97,r:255,g:255,b:255}],Oo=[0,95,135,175,215,255]});var Es,Mi=H(()=>{Ti();dn();yn();es();Es={name:"MessageItem",props:{message:{type:Object,required:!0},sessionActions:{type:Boolean,default:!1}},emits:["quote","edit-as-new"],template:`
@@ -496,7 +496,7 @@ The agent will restart after upgrading.`,"chat.agent.alreadyLatest":"Agent is al
496
496
  </div>
497
497
  `,setup(e){let t=Pinia.useChatStore(),s=Vue.ref(!1),n=Vue.inject("t"),i=Vue.computed(()=>["message",e.message.type]),r=()=>{let m=e.message;return typeof m.timestamp=="number"&&m.timestamp>0?m.timestamp:typeof m.createdAt=="number"&&m.createdAt>0?m.createdAt:null},o=Vue.computed(()=>mt(r())),a=Vue.computed(()=>{let m=r();if(!m)return"";try{return new Date(m).toLocaleString()}catch{return""}}),l=Vue.computed(()=>At(e.message.content||"")),c=Vue.computed(()=>Zc(e.message,n("message.you")));return{messageClass:i,messageTime:o,messageTimeFull:a,displayContent:l,userQuote:c,showAttachments:s,toggleAttachments:()=>{s.value=!s.value},previewAttachment:(m,A)=>{m?.preview&&Ds(m.preview,{alt:m.name||n("message.imagePreview"),closeLabel:n("common.close"),trigger:A})},t:n,formatExpertLabel:m=>Xt(m,t.customExpertRoles),getAttachmentsText:m=>{if(!m||m.length===0)return"";let A=m.filter(y=>y.isImage).length,w=m.length-A,k=[];return A>0&&k.push(n("message.imageCount",{count:A})),w>0&&k.push(n("message.fileCount",{count:w})),k.join(n("common.comma"))},todoStatusSymbol:m=>m==="completed"?"\u2713":m==="in_progress"?"\u2192":"\u25CB",getFileIcon:m=>m?m.startsWith("image/")?"\u{1F5BC}\uFE0F":m.startsWith("video/")?"\u{1F3AC}":m.startsWith("audio/")?"\u{1F3B5}":m.includes("pdf")?"\u{1F4D5}":m.includes("word")||m.includes("document")?"\u{1F4DD}":m.includes("sheet")||m.includes("excel")?"\u{1F4CA}":m.includes("presentation")||m.includes("powerpoint")?"\u{1F4FD}\uFE0F":m.includes("zip")||m.includes("compressed")||m.includes("archive")?"\u{1F4E6}":m.includes("text")||m.includes("json")||m.includes("xml")?"\u{1F4C3}":"\u{1F4C4}":"\u{1F4C4}"}}}});function Wo(e){let t=e&&typeof e.to=="string"&&e.to.trim()?e.to.trim():"?",s=t==="all"?"@all":`@${t}`,n=typeof e?.text=="string"?e.text.trim():"",i=typeof e?.reason=="string"?e.reason.trim():"";return{to:t,target:s,text:n,reason:i}}function Xd(e,t=s=>s){let s=Wo(e);return s.text?`Route ${s.target}: ${t(s.text,70)}`:`Route ${s.target}`}var Uo=H(()=>{});var Pi,zo=H(()=>{yn();Pi={name:"TerminalOutput",props:{content:{default:""}},template:`
498
498
  <pre class="terminal-output"><code><template v-for="(token, index) in tokens" :key="index"><span v-if="token.className" :class="token.className">{{ token.text }}</span><template v-else>{{ token.text }}</template></template></code></pre>
499
- `,setup(e){return{tokens:Vue.computed(()=>Qd(e.content))}}}});var _i,Ko=H(()=>{Uo();yn();zo();_i={name:"ToolLine",components:{TerminalOutput:Pi},props:{toolName:{type:String,required:!0},toolInput:{type:Object,default:null},toolResult:{default:null},hasResult:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},startTime:{type:Number,default:0},expanded:{type:Boolean,default:null}},emits:["update:expanded"],template:`
499
+ `,setup(e){return{tokens:Vue.computed(()=>Qd(e.content))}}}});var Ri,Ko=H(()=>{Uo();yn();zo();Ri={name:"ToolLine",components:{TerminalOutput:Pi},props:{toolName:{type:String,required:!0},toolInput:{type:Object,default:null},toolResult:{default:null},hasResult:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},startTime:{type:Number,default:0},expanded:{type:Boolean,default:null}},emits:["update:expanded"],template:`
500
500
  <div>
501
501
  <div class="tool-line" :class="{ expandable: hasExpandableContent, expanded: isExpanded, completed: hasResult, running: !hasResult }" @click="toggle">
502
502
  <span class="tool-line-icon">{{ getToolIcon(toolName) }}</span>
@@ -531,11 +531,11 @@ The agent will restart after upgrading.`,"chat.agent.alreadyLatest":"Agent is al
531
531
  </div>
532
532
  </div>
533
533
  </div>
534
- `,setup(e,{emit:t}){let s=Vue.ref(e.toolName==="Edit"),n=Vue.computed(()=>e.expanded===null?s.value:!!e.expanded),i=h=>{s.value=!!h,t("update:expanded",!!h)},r=Vue.computed(()=>{if(!e.startTime)return"";let h=new Date(e.startTime),b=h.getHours().toString().padStart(2,"0"),_=h.getMinutes().toString().padStart(2,"0"),L=h.getSeconds().toString().padStart(2,"0");return`${b}:${_}:${L}`}),o=Vue.computed(()=>e.toolName==="Edit"),a=Vue.computed(()=>{let h=e.toolInput;return h&&h.old_string!==void 0&&h.new_string!==void 0}),l=Vue.computed(()=>{let h=e.toolInput;return h?e.toolName==="Edit"?a.value:e.toolName==="Bash"?!!(h.command?.length>60||e.hasResult):e.toolName==="Read"?!!h.file_path:e.toolName==="Write"?!!h.content:Object.keys(h).length>0:!1}),c=h=>{if(!h)return"";if(typeof h=="string")return h;if(Array.isArray(h))return h.map(b=>typeof b=="string"?b:b?.type==="text"?b.text:"").filter(Boolean).join(`
534
+ `,setup(e,{emit:t}){let s=Vue.ref(e.toolName==="Edit"),n=Vue.computed(()=>e.expanded===null?s.value:!!e.expanded),i=h=>{s.value=!!h,t("update:expanded",!!h)},r=Vue.computed(()=>{if(!e.startTime)return"";let h=new Date(e.startTime),b=h.getHours().toString().padStart(2,"0"),R=h.getMinutes().toString().padStart(2,"0"),L=h.getSeconds().toString().padStart(2,"0");return`${b}:${R}:${L}`}),o=Vue.computed(()=>e.toolName==="Edit"),a=Vue.computed(()=>{let h=e.toolInput;return h&&h.old_string!==void 0&&h.new_string!==void 0}),l=Vue.computed(()=>{let h=e.toolInput;return h?e.toolName==="Edit"?a.value:e.toolName==="Bash"?!!(h.command?.length>60||e.hasResult):e.toolName==="Read"?!!h.file_path:e.toolName==="Write"?!!h.content:Object.keys(h).length>0:!1}),c=h=>{if(!h)return"";if(typeof h=="string")return h;if(Array.isArray(h))return h.map(b=>typeof b=="string"?b:b?.type==="text"?b.text:"").filter(Boolean).join(`
535
535
  `);if(h?.type==="text"&&h?.text)return h.text;if(h?.content){if(typeof h.content=="string")return h.content;if(Array.isArray(h.content))return h.content.map(b=>typeof b=="string"?b:b?.type==="text"?b.text:"").filter(Boolean).join(`
536
- `)}return""},d=Vue.computed(()=>e.toolName!=="Bash"?"":c(e.toolResult)),u=Vue.computed(()=>e.toolName!=="__SubagentResult"?"":At(e.toolInput?.result||e.toolInput?.summary||y(e.toolInput))),p=Vue.computed(()=>e.toolName!=="__CompactSummary"?"":At(e.toolInput?.summary||y(e.toolInput))),f=()=>{l.value&&i(!n.value)},g=(h,b=80)=>{if(!h||h.length<=b)return h||"";let _=Math.ceil(b*.6),L=b-_-3;return h.slice(0,_)+"..."+h.slice(-L)},v=h=>({Read:"\u{1F4D6}",Edit:"\u270F\uFE0F",Write:"\u{1F4DD}",Bash:"\u26A1",Glob:"\u{1F50D}",Grep:"\u{1F50E}",Task:"\u{1F4CB}",WebFetch:"\u{1F310}",WebSearch:"\u{1F50D}",TodoWrite:"\u2705",RouteForward:"@",__SubagentResult:"\u{1F916}",__CompactSummary:"\u{1F4DA}"})[h]||"\u2699\uFE0F",m=h=>At(h).replace(/\s+/g," ").trim(),A=(h,b)=>{if(!b)return h;if(h==="Read"&&b.file_path){let _=`Read ${b.file_path}`;if(b.offset||b.limit){let L=(b.offset||0)+1,U=b.limit?L+b.limit-1:"\u221E";_+=`:${L}-${U}`}return _}if(h==="Edit"&&b.file_path)return`Edit ${b.file_path}`;if(h==="Write"&&b.file_path)return`Write ${b.file_path}`;if(h==="Bash"&&b.command){let _=b.command;return g(_,80)}if(h==="Glob"&&b.pattern)return`Glob ${b.pattern}`+(b.path?` in ${b.path}`:"");if(h==="Grep"&&b.pattern){let _=`Grep "${b.pattern}"`;return b.path&&(_+=` in ${b.path}`),b.glob&&(_+=` (${b.glob})`),_}if(h==="Task"){let _=b.subagent_type||"agent",L=b.description||g(b.prompt||"",40);return`Task [${_}]: ${L}`}if(h==="WebFetch"&&b.url)try{let _=new URL(b.url);return`Fetch ${_.hostname}${_.pathname.length>20?g(_.pathname,20):_.pathname}`}catch{return`Fetch ${b.url.slice(0,50)}`}if(h==="WebSearch"&&b.query)return`Search "${b.query}"`;if(h==="TodoWrite"&&b.todos)return`Todo: ${b.todos.filter(L=>L.status==="completed").length}/${b.todos.length} done`;if(h==="RouteForward")return Xd(b,g);if(h==="__SubagentResult"){let _=m(b.summary||b.status||"completed");return`Sub-agent: ${g(_,80)}`}return h==="__CompactSummary"?`Context summarized (${At(b.summary||"").length} chars)`:h},w=h=>{let b=document.createElement("div");return b.textContent=h,b.innerHTML},k=h=>{if(!h||h.old_string===void 0||h.new_string===void 0)return"";let b='<div class="diff-compact">';return h.old_string.split(`
537
- `).forEach(_=>{b+=`<div class="diff-line del">- ${w(_)}</div>`}),h.new_string.split(`
538
- `).forEach(_=>{b+=`<div class="diff-line add">+ ${w(_)}</div>`}),b+="</div>",b},y=h=>{try{return JSON.stringify(h,null,2)}catch{return String(h)}};return{isExpanded:n,isEditTool:o,hasDiff:a,hasExpandableContent:l,bashOutput:d,syntheticResultOutput:u,compactSummaryOutput:p,formattedTime:r,toggle:f,getToolIcon:v,getToolOneLine:A,renderDiff:k,formatInput:y}}}});var Zd,Jd=H(()=>{Zd={name:"AskCard",props:{askMsg:{type:Object,required:!0},compact:{type:Boolean,default:!1}},emits:["submit"],template:`
536
+ `)}return""},d=Vue.computed(()=>e.toolName!=="Bash"?"":c(e.toolResult)),u=Vue.computed(()=>e.toolName!=="__SubagentResult"?"":At(e.toolInput?.result||e.toolInput?.summary||y(e.toolInput))),p=Vue.computed(()=>e.toolName!=="__CompactSummary"?"":At(e.toolInput?.summary||y(e.toolInput))),f=()=>{l.value&&i(!n.value)},g=(h,b=80)=>{if(!h||h.length<=b)return h||"";let R=Math.ceil(b*.6),L=b-R-3;return h.slice(0,R)+"..."+h.slice(-L)},v=h=>({Read:"\u{1F4D6}",Edit:"\u270F\uFE0F",Write:"\u{1F4DD}",Bash:"\u26A1",Glob:"\u{1F50D}",Grep:"\u{1F50E}",Task:"\u{1F4CB}",WebFetch:"\u{1F310}",WebSearch:"\u{1F50D}",TodoWrite:"\u2705",RouteForward:"@",__SubagentResult:"\u{1F916}",__CompactSummary:"\u{1F4DA}"})[h]||"\u2699\uFE0F",m=h=>At(h).replace(/\s+/g," ").trim(),A=(h,b)=>{if(!b)return h;if(h==="Read"&&b.file_path){let R=`Read ${b.file_path}`;if(b.offset||b.limit){let L=(b.offset||0)+1,U=b.limit?L+b.limit-1:"\u221E";R+=`:${L}-${U}`}return R}if(h==="Edit"&&b.file_path)return`Edit ${b.file_path}`;if(h==="Write"&&b.file_path)return`Write ${b.file_path}`;if(h==="Bash"&&b.command){let R=b.command;return g(R,80)}if(h==="Glob"&&b.pattern)return`Glob ${b.pattern}`+(b.path?` in ${b.path}`:"");if(h==="Grep"&&b.pattern){let R=`Grep "${b.pattern}"`;return b.path&&(R+=` in ${b.path}`),b.glob&&(R+=` (${b.glob})`),R}if(h==="Task"){let R=b.subagent_type||"agent",L=b.description||g(b.prompt||"",40);return`Task [${R}]: ${L}`}if(h==="WebFetch"&&b.url)try{let R=new URL(b.url);return`Fetch ${R.hostname}${R.pathname.length>20?g(R.pathname,20):R.pathname}`}catch{return`Fetch ${b.url.slice(0,50)}`}if(h==="WebSearch"&&b.query)return`Search "${b.query}"`;if(h==="TodoWrite"&&b.todos)return`Todo: ${b.todos.filter(L=>L.status==="completed").length}/${b.todos.length} done`;if(h==="RouteForward")return Xd(b,g);if(h==="__SubagentResult"){let R=m(b.summary||b.status||"completed");return`Sub-agent: ${g(R,80)}`}return h==="__CompactSummary"?`Context summarized (${At(b.summary||"").length} chars)`:h},w=h=>{let b=document.createElement("div");return b.textContent=h,b.innerHTML},k=h=>{if(!h||h.old_string===void 0||h.new_string===void 0)return"";let b='<div class="diff-compact">';return h.old_string.split(`
537
+ `).forEach(R=>{b+=`<div class="diff-line del">- ${w(R)}</div>`}),h.new_string.split(`
538
+ `).forEach(R=>{b+=`<div class="diff-line add">+ ${w(R)}</div>`}),b+="</div>",b},y=h=>{try{return JSON.stringify(h,null,2)}catch{return String(h)}};return{isExpanded:n,isEditTool:o,hasDiff:a,hasExpandableContent:l,bashOutput:d,syntheticResultOutput:u,compactSummaryOutput:p,formattedTime:r,toggle:f,getToolIcon:v,getToolOneLine:A,renderDiff:k,formatInput:y}}}});var Zd,Jd=H(()=>{Zd={name:"AskCard",props:{askMsg:{type:Object,required:!0},compact:{type:Boolean,default:!1}},emits:["submit"],template:`
539
539
  <div class="ask-card-wrapper">
540
540
  <!-- Collapsed summary after submission; history later confirms the answer. -->
541
541
  <div v-if="isAnswered" class="ask-summary">
@@ -618,7 +618,7 @@ The agent will restart after upgrading.`,"chat.agent.alreadyLatest":"Agent is al
618
618
  </div>
619
619
  </div>
620
620
  </div>
621
- `,setup(e,{emit:t}){let s=Vue.reactive({}),n=Vue.reactive({}),i=Vue.computed(()=>{let f=e.askMsg;return f&&(!!f.askAnswered||!!f.selectedAnswers||!!f.askPending)}),r=Vue.computed(()=>{let f=e.askMsg;return f?!!f.askExpired||!f.askRequestId&&!f.askAnswered&&!f.selectedAnswers&&!!f.isHistory:!1}),o=Vue.computed(()=>{let f=e.askMsg;return f?.askQuestions||f?.toolInput?.questions||[]}),a=(f,g)=>{let v=s[f];return Array.isArray(v)?v.includes(g):v===g},l=(f,g)=>{if(!i.value)if(n[f.question]="",f.multiSelect){let v=s[f.question]||[],m=Array.isArray(v)?[...v]:[],A=m.indexOf(g.label);A>=0?m.splice(A,1):m.push(g.label),s[f.question]=m}else s[f.question]=g.label},c=(f,g)=>{n[f]=g,g&&delete s[f]},d=Vue.computed(()=>{let f=o.value;return!f||f.length===0?!1:f.some(g=>{let v=s[g.question];return n[g.question]?!0:Array.isArray(v)?v.length>0:!!v})}),u=()=>{if(i.value||e.askMsg.askPending||!d.value)return;let f=o.value,g={};for(let m of f){let A=n[m.question];if(A)g[m.question]=A;else{let w=s[m.question];Array.isArray(w)&&w.length>0?g[m.question]=w.join(", "):w&&(g[m.question]=w)}}let v=e.askMsg.askRequestId;v&&t("submit",v,g)},p=Vue.computed(()=>{let f=e.askMsg?.selectedAnswers||e.askMsg?.pendingAnswers;return f?Object.values(f).filter(v=>v&&v!=="-").join(", "):""});return{isAnswered:i,isExpired:r,questions:o,isOptionSelected:a,selectOption:l,setCustomAnswer:c,customAnswers:n,hasAnySelection:d,submitAnswers:u,summaryText:p}}}});var eu,tu=H(()=>{_s();eu={name:"VpBadge",props:{vpId:{type:String,required:!0},size:{type:Number,default:20},showSubtitle:{type:Boolean,default:!1},status:{type:String,default:null},typing:{type:Boolean,default:!1},compact:{type:Boolean,default:!1}},template:`
621
+ `,setup(e,{emit:t}){let s=Vue.reactive({}),n=Vue.reactive({}),i=Vue.computed(()=>{let f=e.askMsg;return f&&(!!f.askAnswered||!!f.selectedAnswers||!!f.askPending)}),r=Vue.computed(()=>{let f=e.askMsg;return f?!!f.askExpired||!f.askRequestId&&!f.askAnswered&&!f.selectedAnswers&&!!f.isHistory:!1}),o=Vue.computed(()=>{let f=e.askMsg;return f?.askQuestions||f?.toolInput?.questions||[]}),a=(f,g)=>{let v=s[f];return Array.isArray(v)?v.includes(g):v===g},l=(f,g)=>{if(!i.value)if(n[f.question]="",f.multiSelect){let v=s[f.question]||[],m=Array.isArray(v)?[...v]:[],A=m.indexOf(g.label);A>=0?m.splice(A,1):m.push(g.label),s[f.question]=m}else s[f.question]=g.label},c=(f,g)=>{n[f]=g,g&&delete s[f]},d=Vue.computed(()=>{let f=o.value;return!f||f.length===0?!1:f.some(g=>{let v=s[g.question];return n[g.question]?!0:Array.isArray(v)?v.length>0:!!v})}),u=()=>{if(i.value||e.askMsg.askPending||!d.value)return;let f=o.value,g={};for(let m of f){let A=n[m.question];if(A)g[m.question]=A;else{let w=s[m.question];Array.isArray(w)&&w.length>0?g[m.question]=w.join(", "):w&&(g[m.question]=w)}}let v=e.askMsg.askRequestId;v&&t("submit",v,g)},p=Vue.computed(()=>{let f=e.askMsg?.selectedAnswers||e.askMsg?.pendingAnswers;return f?Object.values(f).filter(v=>v&&v!=="-").join(", "):""});return{isAnswered:i,isExpired:r,questions:o,isOptionSelected:a,selectOption:l,setCustomAnswer:c,customAnswers:n,hasAnySelection:d,submitAnswers:u,summaryText:p}}}});var eu,tu=H(()=>{Rs();eu={name:"VpBadge",props:{vpId:{type:String,required:!0},size:{type:Number,default:20},showSubtitle:{type:Boolean,default:!1},status:{type:String,default:null},typing:{type:Boolean,default:!1},compact:{type:Boolean,default:!1}},template:`
622
622
  <span class="vp-badge" :class="{ compact }">
623
623
  <span class="vp-badge-text">
624
624
  <span class="vp-badge-name" :style="nameStyle">{{ displayName }}</span>
@@ -628,7 +628,7 @@ The agent will restart after upgrading.`,"chat.agent.alreadyLatest":"Agent is al
628
628
  >{{ subtitle }}</span>
629
629
  </span>
630
630
  </span>
631
- `,setup(e){let t=ht(),s=Vue.computed(()=>t.vpLabel(e.vpId)),n=Vue.computed(()=>{let r=t.vpById(e.vpId);return r&&(r.subtitle||r.role)||""}),i=Vue.computed(()=>({color:t.vpTextColor(e.vpId)}));return{displayName:s,subtitle:n,nameStyle:i}}}});var Ri,Yo=H(()=>{tu();hi();es();Ri={name:"VpSpeakerHeader",components:{VpBadge:eu},emits:["stop-turn"],props:{vpId:{type:String,required:!0},timestamp:{type:Number,default:0},stateCause:{type:String,default:""},turnId:{type:String,default:""},showStop:{type:Boolean,default:!1}},template:`
631
+ `,setup(e){let t=ht(),s=Vue.computed(()=>t.vpLabel(e.vpId)),n=Vue.computed(()=>{let r=t.vpById(e.vpId);return r&&(r.subtitle||r.role)||""}),i=Vue.computed(()=>({color:t.vpTextColor(e.vpId)}));return{displayName:s,subtitle:n,nameStyle:i}}}});var _i,Yo=H(()=>{tu();hi();es();_i={name:"VpSpeakerHeader",components:{VpBadge:eu},emits:["stop-turn"],props:{vpId:{type:String,required:!0},timestamp:{type:Number,default:0},stateCause:{type:String,default:""},turnId:{type:String,default:""},showStop:{type:Boolean,default:!1}},template:`
632
632
  <div class="vp-speaker-header" :data-vp-id="vpId">
633
633
  <VpBadge
634
634
  :vp-id="vpId"
@@ -668,7 +668,7 @@ ${String(e||"").trim()}
668
668
  </button>
669
669
  </div>
670
670
  <pre><code${s}${o}>${n}</code></pre>
671
- </div>`})}function Ph(e){return e.replace(/<table>([\s\S]*?)<\/table>/g,t=>`<div class="table-scroll-wrapper">${t}</div>`)}function _h(){if(typeof mermaid>"u")return!1;let e=document.documentElement.getAttribute("data-theme")==="dark"?"dark":"default";if(ru===e)return!0;try{return mermaid.initialize({startOnLoad:!1,theme:e,securityLevel:"strict"}),ru=e,!0}catch{return!1}}async function Ye(e){if(!e||!_h())return;let t=e.querySelectorAll("pre code.language-mermaid:not([data-mermaid-error])");for(let s of t){let n=s.closest("pre");if(!n||n.dataset.mermaidRendered==="true")continue;let i=n.closest(".code-block-wrapper"),r=kh(s)||s.textContent||"";if(r.trim()){n.dataset.mermaidRendered="true";try{let o=`mermaid-${Date.now()}-${yh++}`,{svg:a}=await mermaid.render(o,r),l=document.createElement("div");l.className="mermaid-rendered",l.innerHTML=a,l.dataset.mermaidSource=r,l.appendChild(xh(l,r)),(i||n).replaceWith(l)}catch{n.dataset.mermaidRendered="false",s.dataset.mermaidError="true"}}}}function Rh(e){if(!e||typeof e!="string")return"";let t=s=>{let n=document.createElement("div");return n.textContent=s,n.innerHTML};return e.replace(/```(\w*)\n([\s\S]*?)```/g,(s,n,i)=>{let r=i.trim(),o=n==="mermaid"?` data-mermaid-source="${encodeURIComponent(r)}"`:"";return`<div class="code-block-wrapper"><pre><code class="language-${n}"${o}>${t(r)}</code></pre></div>`}).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/\*([^*]+)\*/g,"<em>$1</em>").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/^# (.+)$/gm,"<h1>$1</h1>").replace(/\n/g,"<br>")}function Dh(e){if(!e||typeof e!="string")return"";let t=e;return t=t.replace(/---\s*ROUTE\s*---[\s\S]*?---\s*(?:END[_ \-]?ROUTE|ENDROUTE|END)\s*:?\s*---/gi,"").trim(),t=t.replace(/---\s*TASKS\s*---[\s\S]*?---\s*(?:END[_ \-]?TASKS|ENDTASKS|END)\s*:?\s*---/gi,"").trim(),t=t.replace(/---\s*ROUTE\s*---[\s\S]*?(?=\n[ \t]*\n+(?:---(?!\s*ROUTE)|<(?:kanban|recent-routes|task-context)\b)|$)/gi,"").trim(),t=t.replace(/---\s*TASKS\s*---[\s\S]*?(?=\n[ \t]*\n+(?:---(?!\s*TASKS)|<(?:kanban|recent-routes|task-context)\b)|$)/gi,"").trim(),t}function Di(e){if(!e||typeof e!="string"||(e=Dh(e),!e))return"";let t=bn.get(e);if(t!==void 0)return t;Th();let s;if(typeof marked<"u")try{s=Ph(Mh(marked.parse(e)))}catch{}if(s||(s=Rh(e)),bn.size>=Eh){let n=bn.keys().next().value;bn.delete(n)}return bn.set(e,s),s}var iu,ru,yh,bn,Eh,wn=H(()=>{St();iu=!1,ru=null,yh=0;bn=new Map,Eh=2e3});var Ls,Ei=H(()=>{Ko();Jd();Yo();yn();Uo();nu();wn();Ti();es();Ls={name:"AssistantTurn",components:{ToolLine:_i,AskCard:Zd,VpSpeakerHeader:Ri},props:{turn:{type:Object,required:!0},conversationId:{type:String,default:null},hideSpeakerHeader:{type:Boolean,default:!1},actionsExpanded:{type:Boolean,default:null},toolExpandStates:{type:Object,default:null},toolStatePrefix:{type:String,default:""},responseCollapsible:{type:Boolean,default:!1},responseCollapsed:{type:Boolean,default:!1},responseToggleLabel:{type:String,default:""},sessionActions:{type:Boolean,default:!1},quoteAuthor:{type:String,default:""}},emits:["update-actions-expanded","update-tool-expanded","toggle-response-collapse","quote"],template:`
671
+ </div>`})}function Ph(e){return e.replace(/<table>([\s\S]*?)<\/table>/g,t=>`<div class="table-scroll-wrapper">${t}</div>`)}function Rh(){if(typeof mermaid>"u")return!1;let e=document.documentElement.getAttribute("data-theme")==="dark"?"dark":"default";if(ru===e)return!0;try{return mermaid.initialize({startOnLoad:!1,theme:e,securityLevel:"strict"}),ru=e,!0}catch{return!1}}async function Ye(e){if(!e||!Rh())return;let t=e.querySelectorAll("pre code.language-mermaid:not([data-mermaid-error])");for(let s of t){let n=s.closest("pre");if(!n||n.dataset.mermaidRendered==="true")continue;let i=n.closest(".code-block-wrapper"),r=kh(s)||s.textContent||"";if(r.trim()){n.dataset.mermaidRendered="true";try{let o=`mermaid-${Date.now()}-${yh++}`,{svg:a}=await mermaid.render(o,r),l=document.createElement("div");l.className="mermaid-rendered",l.innerHTML=a,l.dataset.mermaidSource=r,l.appendChild(xh(l,r)),(i||n).replaceWith(l)}catch{n.dataset.mermaidRendered="false",s.dataset.mermaidError="true"}}}}function _h(e){if(!e||typeof e!="string")return"";let t=s=>{let n=document.createElement("div");return n.textContent=s,n.innerHTML};return e.replace(/```(\w*)\n([\s\S]*?)```/g,(s,n,i)=>{let r=i.trim(),o=n==="mermaid"?` data-mermaid-source="${encodeURIComponent(r)}"`:"";return`<div class="code-block-wrapper"><pre><code class="language-${n}"${o}>${t(r)}</code></pre></div>`}).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/\*([^*]+)\*/g,"<em>$1</em>").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/^# (.+)$/gm,"<h1>$1</h1>").replace(/\n/g,"<br>")}function Dh(e){if(!e||typeof e!="string")return"";let t=e;return t=t.replace(/---\s*ROUTE\s*---[\s\S]*?---\s*(?:END[_ \-]?ROUTE|ENDROUTE|END)\s*:?\s*---/gi,"").trim(),t=t.replace(/---\s*TASKS\s*---[\s\S]*?---\s*(?:END[_ \-]?TASKS|ENDTASKS|END)\s*:?\s*---/gi,"").trim(),t=t.replace(/---\s*ROUTE\s*---[\s\S]*?(?=\n[ \t]*\n+(?:---(?!\s*ROUTE)|<(?:kanban|recent-routes|task-context)\b)|$)/gi,"").trim(),t=t.replace(/---\s*TASKS\s*---[\s\S]*?(?=\n[ \t]*\n+(?:---(?!\s*TASKS)|<(?:kanban|recent-routes|task-context)\b)|$)/gi,"").trim(),t}function Di(e){if(!e||typeof e!="string"||(e=Dh(e),!e))return"";let t=bn.get(e);if(t!==void 0)return t;Th();let s;if(typeof marked<"u")try{s=Ph(Mh(marked.parse(e)))}catch{}if(s||(s=_h(e)),bn.size>=Eh){let n=bn.keys().next().value;bn.delete(n)}return bn.set(e,s),s}var iu,ru,yh,bn,Eh,wn=H(()=>{St();iu=!1,ru=null,yh=0;bn=new Map,Eh=2e3});var Ls,Ei=H(()=>{Ko();Jd();Yo();yn();Uo();nu();wn();Ti();es();Ls={name:"AssistantTurn",components:{ToolLine:Ri,AskCard:Zd,VpSpeakerHeader:_i},props:{turn:{type:Object,required:!0},conversationId:{type:String,default:null},hideSpeakerHeader:{type:Boolean,default:!1},actionsExpanded:{type:Boolean,default:null},toolExpandStates:{type:Object,default:null},toolStatePrefix:{type:String,default:""},responseCollapsible:{type:Boolean,default:!1},responseCollapsed:{type:Boolean,default:!1},responseToggleLabel:{type:String,default:""},sessionActions:{type:Boolean,default:!1},quoteAuthor:{type:String,default:""}},emits:["update-actions-expanded","update-tool-expanded","toggle-response-collapse","quote"],template:`
672
672
  <div class="assistant-turn" ref="turnRef" :class="{ streaming: turn.isStreaming, 'has-vp-speaker': !!turn.speakerVpId }">
673
673
  <!-- 0. task-334-ui-b: VP speaker header \u2014 only when a speakerVpId is
674
674
  bound AND the upstream consecutive-collapse decided this turn
@@ -857,7 +857,7 @@ ${String(e||"").trim()}
857
857
  <!-- H2.f.6: Fork-from-here button removed (single-conversation model). -->
858
858
  </div>
859
859
  </div>
860
- `,setup(e,{emit:t}){let s=Pinia.useChatStore(),n=Vue.ref(!1),i=Vue.ref(!1),r=Vue.ref(!1),o=Vue.computed(()=>e.actionsExpanded===null?r.value:!!e.actionsExpanded),a=W=>{r.value=!!W,t("update-actions-expanded",!!W)},l=Vue.ref(!1),c=Vue.ref(null),d=Vue.reactive(new Set),u=Vue.inject("t"),p=(W,te)=>{s.answerUserQuestion(W,te,e.conversationId||void 0)},f=Vue.computed(()=>(Array.isArray(e.turn?.toolMsgs)?e.turn.toolMsgs:[]).filter(te=>te?.toolName==="RouteForward").map((te,Y)=>({...Wo(te.toolInput||{}),key:te.toolId||`${te.startTime||0}:${Y}`}))),g=Vue.computed(()=>(Array.isArray(e.turn?.toolMsgs)?e.turn.toolMsgs:[]).filter(te=>te?.toolName!=="RouteForward")),v=Vue.computed(()=>g.value.length>0||Number(e.turn.toolSummaryCount||0)>0),m=Vue.computed(()=>{let W=g.value;return W[W.length-1]}),A=Vue.computed(()=>g.value.slice(0,-1)),w=Vue.computed(()=>Math.max(0,g.value.length-1)),k=Vue.computed(()=>{let W=Number(e.turn.toolSummaryCount||0);return W?typeof u=="function"?u("chat.toolActionsOmitted",{count:W}):`${W} older tool actions omitted`:""}),y=Vue.computed(()=>{let W=e.turn?.todoMsg?.toolInput?.todos;return Array.isArray(W)?W.map(te=>su(e.turn,te)):[]}),h=()=>{a(!o.value)},b=(W,te,Y)=>{let N=e.toolStatePrefix||e.turn.id||e.turn.turnId||"assistant-turn",O=W?.toolName||"tool",E=W?.startTime||te;return`${N}:tool:${Y}:${te}:${O}:${E}`},_=(W,te,Y)=>{let N=b(W,te,Y);return e.toolExpandStates&&Object.prototype.hasOwnProperty.call(e.toolExpandStates,N)?!!e.toolExpandStates[N]:null},L=(W,te,Y,N)=>{t("update-tool-expanded",{key:b(W,te,Y),value:!!N})};typeof marked<"u"&&marked.setOptions({highlight:function(W,te){if(typeof hljs<"u"&&te&&hljs.getLanguage(te))try{return hljs.highlight(W,{language:te}).value}catch{}return W},breaks:!0,gfm:!0});let $=W=>{let te=W;if(typeof te!="string"&&(Array.isArray(te)?te=te.map(Y=>typeof Y=="string"?Y:Y&&Y.type==="text"&&Y.text||"").join(""):te=String(te)),te=At(te),!te)return"";try{if(typeof marked<"u"){let Y=marked.parse(te);return M(I(Y))}}catch{}return B(te)},R=Vue.computed(()=>Array.isArray(e.turn?.textSegments)&&e.turn.textSegments.length>0?e.turn.textSegments:e.turn?.textContent?[{key:"legacy-result",content:e.turn.textContent,kind:"result",isStreaming:e.turn.isStreaming===!0}]:[]),P=Vue.computed(()=>R.value.filter(W=>W.kind!=="result")),T=Vue.computed(()=>R.value.filter(W=>W.kind==="result")),I=W=>W.replace(/<pre><code([^>]*)>([\s\S]*?)<\/code><\/pre>/g,(te,Y,N)=>{let O=Y.match(/class="language-(\w+)"/);return`<div class="code-block-wrapper">
860
+ `,setup(e,{emit:t}){let s=Pinia.useChatStore(),n=Vue.ref(!1),i=Vue.ref(!1),r=Vue.ref(!1),o=Vue.computed(()=>e.actionsExpanded===null?r.value:!!e.actionsExpanded),a=W=>{r.value=!!W,t("update-actions-expanded",!!W)},l=Vue.ref(!1),c=Vue.ref(null),d=Vue.reactive(new Set),u=Vue.inject("t"),p=(W,te)=>{s.answerUserQuestion(W,te,e.conversationId||void 0)},f=Vue.computed(()=>(Array.isArray(e.turn?.toolMsgs)?e.turn.toolMsgs:[]).filter(te=>te?.toolName==="RouteForward").map((te,Y)=>({...Wo(te.toolInput||{}),key:te.toolId||`${te.startTime||0}:${Y}`}))),g=Vue.computed(()=>(Array.isArray(e.turn?.toolMsgs)?e.turn.toolMsgs:[]).filter(te=>te?.toolName!=="RouteForward")),v=Vue.computed(()=>g.value.length>0||Number(e.turn.toolSummaryCount||0)>0),m=Vue.computed(()=>{let W=g.value;return W[W.length-1]}),A=Vue.computed(()=>g.value.slice(0,-1)),w=Vue.computed(()=>Math.max(0,g.value.length-1)),k=Vue.computed(()=>{let W=Number(e.turn.toolSummaryCount||0);return W?typeof u=="function"?u("chat.toolActionsOmitted",{count:W}):`${W} older tool actions omitted`:""}),y=Vue.computed(()=>{let W=e.turn?.todoMsg?.toolInput?.todos;return Array.isArray(W)?W.map(te=>su(e.turn,te)):[]}),h=()=>{a(!o.value)},b=(W,te,Y)=>{let N=e.toolStatePrefix||e.turn.id||e.turn.turnId||"assistant-turn",O=W?.toolName||"tool",E=W?.startTime||te;return`${N}:tool:${Y}:${te}:${O}:${E}`},R=(W,te,Y)=>{let N=b(W,te,Y);return e.toolExpandStates&&Object.prototype.hasOwnProperty.call(e.toolExpandStates,N)?!!e.toolExpandStates[N]:null},L=(W,te,Y,N)=>{t("update-tool-expanded",{key:b(W,te,Y),value:!!N})};typeof marked<"u"&&marked.setOptions({highlight:function(W,te){if(typeof hljs<"u"&&te&&hljs.getLanguage(te))try{return hljs.highlight(W,{language:te}).value}catch{}return W},breaks:!0,gfm:!0});let $=W=>{let te=W;if(typeof te!="string"&&(Array.isArray(te)?te=te.map(Y=>typeof Y=="string"?Y:Y&&Y.type==="text"&&Y.text||"").join(""):te=String(te)),te=At(te),!te)return"";try{if(typeof marked<"u"){let Y=marked.parse(te);return M(I(Y))}}catch{}return B(te)},_=Vue.computed(()=>Array.isArray(e.turn?.textSegments)&&e.turn.textSegments.length>0?e.turn.textSegments:e.turn?.textContent?[{key:"legacy-result",content:e.turn.textContent,kind:"result",isStreaming:e.turn.isStreaming===!0}]:[]),P=Vue.computed(()=>_.value.filter(W=>W.kind!=="result")),T=Vue.computed(()=>_.value.filter(W=>W.kind==="result")),I=W=>W.replace(/<pre><code([^>]*)>([\s\S]*?)<\/code><\/pre>/g,(te,Y,N)=>{let O=Y.match(/class="language-(\w+)"/);return`<div class="code-block-wrapper">
861
861
  <div class="code-block-header">
862
862
  <span class="code-lang">${O?O[1]:""}</span>
863
863
  <button class="code-copy-btn" onclick="window.copyCodeBlock(this)" title="Copy">
@@ -867,7 +867,7 @@ ${String(e||"").trim()}
867
867
  </button>
868
868
  </div>
869
869
  <pre><code${Y}>${N}</code></pre>
870
- </div>`}),M=W=>W.replace(/<table>([\s\S]*?)<\/table>/g,te=>`<div class="table-scroll-wrapper">${te}</div>`),B=W=>{if(!W)return"";typeof W!="string"&&(W=String(W));let te=Y=>{let N=document.createElement("div");return N.textContent=Y,N.innerHTML};return W.replace(/```(\w*)\n([\s\S]*?)```/g,(Y,N,O)=>`<div class="code-block-wrapper"><pre><code class="language-${N}">${te(O.trim())}</code></pre></div>`).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/\*([^*]+)\*/g,"<em>$1</em>").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/^# (.+)$/gm,"<h1>$1</h1>").replace(/\n/g,"<br>")},F=async()=>{try{await navigator.clipboard.writeText(e.turn.textContent||""),n.value=!0,setTimeout(()=>{n.value=!1},2e3)}catch{}},z=async()=>{try{await navigator.clipboard.writeText(e.turn.textContent||""),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch{}},ne=()=>{let W=e.turn.textContent||"";if(!W)return;let te=new Blob([W],{type:"text/markdown;charset=utf-8"}),Y=URL.createObjectURL(te),N=document.createElement("a");N.download=`response-${Date.now()}.md`,N.href=Y,N.click(),URL.revokeObjectURL(Y)},ve=async()=>{if(!(l.value||!window.htmlToImage)){l.value=!0;try{let W=c.value;if(!W)return;let te=W.querySelector(".turn-content");if(!te)return;let Y=getComputedStyle(document.body).getPropertyValue("--bg-main").trim()||"#ffffff";te.classList.add("screenshot-mode");try{let O=te.getBoundingClientRect(),E=await window.htmlToImage.toPng(te,{backgroundColor:Y,pixelRatio:3,width:O.width+64,height:O.height+64,style:{padding:"32px"},filter:se=>!(se.classList&&(se.classList.contains("turn-header")||se.classList.contains("screenshot-btn")))}),J=document.createElement("a");J.download=`response-${Date.now()}.png`,J.href=E,J.click()}finally{te.classList.remove("screenshot-mode")}}catch{}finally{l.value=!1}}};Vue.onMounted(()=>{window.copyCodeBlock||(window.copyCodeBlock=async function(W){let Y=W.closest(".code-block-wrapper").querySelector("code");if(Y)try{await navigator.clipboard.writeText(Y.textContent),W.innerHTML='<svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>',setTimeout(()=>{W.innerHTML='<svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>'},2e3)}catch{}}),Vue.nextTick(()=>{typeof hljs<"u"&&document.querySelectorAll("pre code:not([data-highlighted])").forEach(W=>{hljs.highlightElement(W),W.dataset.highlighted="true"}),Ye(c.value)})}),Vue.watch(()=>e.turn.textContent,()=>{Vue.nextTick(()=>{typeof hljs<"u"&&document.querySelectorAll("pre code:not([data-highlighted])").forEach(W=>{hljs.highlightElement(W),W.dataset.highlighted="true"}),Ye(c.value)})});let ue=W=>{if(W?.src)return W.src;if(!W?.fileId)return"";let te=W.previewToken||"";return`/api/preview/${W.fileId}?token=${te}`},be=W=>{d.add(W?.assetId||W?.id)},oe=(W,te)=>{let Y=ue(W);Y&&Ds(Y,{alt:W?.filename||u("message.imagePreview"),closeLabel:u("common.close"),trigger:te})},Ce=W=>{if(W)try{typeof s.cancelVpTurn=="function"&&s.cancelVpTurn(W)}catch{}},x=()=>{let W=e.turn;return W?typeof W.timestamp=="number"&&W.timestamp>0?W.timestamp:typeof W.createdAt=="number"&&W.createdAt>0?W.createdAt:typeof W.speakerTimestamp=="number"&&W.speakerTimestamp>0?W.speakerTimestamp:null:null},j=Vue.computed(()=>mt(x())),ae=Vue.computed(()=>{let W=x();if(!W)return"";try{return new Date(W).toLocaleString()}catch{return""}}),he=Vue.computed(()=>Jc(e.turn,e.quoteAuthor||u("message.assistant")));return{onStopTurn:Ce,turnTime:j,turnTimeFull:ae,assistantQuote:he,copied:n,fullCopied:i,expanded:o,screenshotting:l,turnRef:c,showToolActions:v,latestTool:m,historyTools:A,latestToolIndex:w,actionTools:g,routeMessages:f,toolSummaryLabel:k,toggleExpand:h,toolExpandedValue:_,updateToolExpanded:L,textSegments:R,progressSegments:P,resultSegments:T,renderSegment:$,copyContent:F,copyFullResponse:z,exportMarkdown:ne,screenshotContent:ve,onAskSubmit:p,imageSrc:ue,failedImages:d,handleImageError:be,previewImage:oe,displayedTodos:y}}}});function du(e){if(!Number.isFinite(e)||e<0)return"";let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let s=Math.floor(t/60),n=t%60,i=String(n).padStart(2,"0");if(s<60)return`${s}:${i}`;let r=Math.floor(s/60),o=s%60;return`${r}:${String(o).padStart(2,"0")}:${i}`}var uu=H(()=>{});var pu,fu=H(()=>{Ei();hi();_s();uu();es();pu={name:"VpTurnBlock",components:{AssistantTurn:Ls},props:{turn:{type:Object,required:!0},conversationId:{type:String,default:null},nowMs:{type:Number,default:0},responseCollapsible:{type:Boolean,default:!1},responseCollapsed:{type:Boolean,default:!1},responseToggleLabel:{type:String,default:""}},emits:["toggle-response-collapse","quote"],template:`
870
+ </div>`}),M=W=>W.replace(/<table>([\s\S]*?)<\/table>/g,te=>`<div class="table-scroll-wrapper">${te}</div>`),B=W=>{if(!W)return"";typeof W!="string"&&(W=String(W));let te=Y=>{let N=document.createElement("div");return N.textContent=Y,N.innerHTML};return W.replace(/```(\w*)\n([\s\S]*?)```/g,(Y,N,O)=>`<div class="code-block-wrapper"><pre><code class="language-${N}">${te(O.trim())}</code></pre></div>`).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/\*([^*]+)\*/g,"<em>$1</em>").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/^# (.+)$/gm,"<h1>$1</h1>").replace(/\n/g,"<br>")},F=async()=>{try{await navigator.clipboard.writeText(e.turn.textContent||""),n.value=!0,setTimeout(()=>{n.value=!1},2e3)}catch{}},z=async()=>{try{await navigator.clipboard.writeText(e.turn.textContent||""),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch{}},ne=()=>{let W=e.turn.textContent||"";if(!W)return;let te=new Blob([W],{type:"text/markdown;charset=utf-8"}),Y=URL.createObjectURL(te),N=document.createElement("a");N.download=`response-${Date.now()}.md`,N.href=Y,N.click(),URL.revokeObjectURL(Y)},ve=async()=>{if(!(l.value||!window.htmlToImage)){l.value=!0;try{let W=c.value;if(!W)return;let te=W.querySelector(".turn-content");if(!te)return;let Y=getComputedStyle(document.body).getPropertyValue("--bg-main").trim()||"#ffffff";te.classList.add("screenshot-mode");try{let O=te.getBoundingClientRect(),E=await window.htmlToImage.toPng(te,{backgroundColor:Y,pixelRatio:3,width:O.width+64,height:O.height+64,style:{padding:"32px"},filter:se=>!(se.classList&&(se.classList.contains("turn-header")||se.classList.contains("screenshot-btn")))}),J=document.createElement("a");J.download=`response-${Date.now()}.png`,J.href=E,J.click()}finally{te.classList.remove("screenshot-mode")}}catch{}finally{l.value=!1}}};Vue.onMounted(()=>{window.copyCodeBlock||(window.copyCodeBlock=async function(W){let Y=W.closest(".code-block-wrapper").querySelector("code");if(Y)try{await navigator.clipboard.writeText(Y.textContent),W.innerHTML='<svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>',setTimeout(()=>{W.innerHTML='<svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>'},2e3)}catch{}}),Vue.nextTick(()=>{typeof hljs<"u"&&document.querySelectorAll("pre code:not([data-highlighted])").forEach(W=>{hljs.highlightElement(W),W.dataset.highlighted="true"}),Ye(c.value)})}),Vue.watch(()=>e.turn.textContent,()=>{Vue.nextTick(()=>{typeof hljs<"u"&&document.querySelectorAll("pre code:not([data-highlighted])").forEach(W=>{hljs.highlightElement(W),W.dataset.highlighted="true"}),Ye(c.value)})});let ue=W=>{if(W?.src)return W.src;if(!W?.fileId)return"";let te=W.previewToken||"";return`/api/preview/${W.fileId}?token=${te}`},be=W=>{d.add(W?.assetId||W?.id)},oe=(W,te)=>{let Y=ue(W);Y&&Ds(Y,{alt:W?.filename||u("message.imagePreview"),closeLabel:u("common.close"),trigger:te})},Ce=W=>{if(W)try{typeof s.cancelVpTurn=="function"&&s.cancelVpTurn(W)}catch{}},x=()=>{let W=e.turn;return W?typeof W.timestamp=="number"&&W.timestamp>0?W.timestamp:typeof W.createdAt=="number"&&W.createdAt>0?W.createdAt:typeof W.speakerTimestamp=="number"&&W.speakerTimestamp>0?W.speakerTimestamp:null:null},j=Vue.computed(()=>mt(x())),ae=Vue.computed(()=>{let W=x();if(!W)return"";try{return new Date(W).toLocaleString()}catch{return""}}),he=Vue.computed(()=>Jc(e.turn,e.quoteAuthor||u("message.assistant")));return{onStopTurn:Ce,turnTime:j,turnTimeFull:ae,assistantQuote:he,copied:n,fullCopied:i,expanded:o,screenshotting:l,turnRef:c,showToolActions:v,latestTool:m,historyTools:A,latestToolIndex:w,actionTools:g,routeMessages:f,toolSummaryLabel:k,toggleExpand:h,toolExpandedValue:R,updateToolExpanded:L,textSegments:_,progressSegments:P,resultSegments:T,renderSegment:$,copyContent:F,copyFullResponse:z,exportMarkdown:ne,screenshotContent:ve,onAskSubmit:p,imageSrc:ue,failedImages:d,handleImageError:be,previewImage:oe,displayedTodos:y}}}});function du(e){if(!Number.isFinite(e)||e<0)return"";let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let s=Math.floor(t/60),n=t%60,i=String(n).padStart(2,"0");if(s<60)return`${s}:${i}`;let r=Math.floor(s/60),o=s%60;return`${r}:${String(o).padStart(2,"0")}:${i}`}var uu=H(()=>{});var pu,fu=H(()=>{Ei();hi();Rs();uu();es();pu={name:"VpTurnBlock",components:{AssistantTurn:Ls},props:{turn:{type:Object,required:!0},conversationId:{type:String,default:null},nowMs:{type:Number,default:0},responseCollapsible:{type:Boolean,default:!1},responseCollapsed:{type:Boolean,default:!1},responseToggleLabel:{type:String,default:""}},emits:["toggle-response-collapse","quote"],template:`
871
871
  <div class="vp-turn-block"
872
872
  :class="{ 'vp-turn-block-streaming': turn.isStreaming }"
873
873
  :data-turn-id="turn.turnId || ''"
@@ -1015,7 +1015,7 @@ ${String(e||"").trim()}
1015
1015
  />
1016
1016
  </div>
1017
1017
  </div>
1018
- `}});function kn(e,t,s){return Math.min(Math.max(e,t),s)}function Li(e){return e?typeof e=="string"?e.length:Array.isArray(e)?e.reduce((t,s)=>t+Li(s),0):typeof e=="object"?Object.values(e).reduce((t,s)=>t+Li(s),0):String(e).length:0}function wu(e){if(!e)return 260;let t=Li(e.content||e.text||e.message||""),s=Array.isArray(e.attachments)?e.attachments.length:0;return kn(110+Math.ceil(t/90)*18+s*120,120,1400)}function $h(e){if(!e)return 260;let t=Li(e.text||e.content||""),s=Array.isArray(e.toolMsgs)?e.toolMsgs.length:0,n=Array.isArray(e.images)?e.images.length:0,i=Array.isArray(e.askRequests)?e.askRequests.length:0;return kn(160+Math.ceil(t/95)*18+s*56+n*140+i*96,160,1400)}function qt(e){if(!e)return 260;if(e.type==="message-block"){let t=Array.isArray(e.items)?e.items:[];return t.length?t.reduce((s,n)=>s+qt(n),0)+Math.max(0,t.length-1)*18:260}return e.type==="assistant-turn"?$h(e):e.message?wu(e.message):wu(e)}function $s(e,t=0){return String(e?.id||e?.messageId||e?.turnId||`virtual_${t}`)}function Vh(e,t,s,n){let i=$s(e,t),r=s instanceof Map?s.get(i):s?.[i];if(Number.isFinite(r)&&r>0)return r;let o=n?n(e,t):qt(e);return Number.isFinite(o)&&o>0?o:260}function Go(e,t={},s={}){let n=Array.isArray(e)?e:[],i=Math.max(0,Number(s.itemGap??18)),r=s.estimateHeight||qt,o=[0],a=[];for(let l=0;l<n.length;l+=1){let c=Vh(n[l],l,t,r);a.push(c),o.push(o[l]+c+(l<n.length-1?i:0))}return{offsets:o,heights:a,totalHeight:o[o.length-1]||0,itemGap:i}}function ku(e,t){let s=0,n=Math.max(0,e.length-2),i=0;for(;s<=n;){let r=Math.floor((s+n)/2);e[r+1]<=t?(i=r+1,s=r+1):n=r-1}return i}function Fh(e,t,s){let n=ku(e,t);for(;n<s&&e[n]<t;)n+=1;return kn(n,0,s)}function Su(e,t,s={}){let n=Array.isArray(e)?e:[],i=n.length;if(!i)return{start:0,end:0,visibleStart:0,visibleEnd:0,topSpacerHeight:0,bottomSpacerHeight:0,totalHeight:0,items:[]};let r=Math.max(0,Number(s.scrollTop||0)),o=Math.max(1,Number(s.viewportHeight||720)),a=Math.max(0,Number(s.overscan??1)),l=Array.isArray(t?.offsets)?t.offsets:[0],c=Number.isFinite(t?.totalHeight)?t.totalHeight:0,d=r+o,u=kn(ku(l,r),0,i-1),p=kn(Fh(l,d,i),u+1,i),f=Math.max(0,u-a),g=Math.min(i,p+a);return{start:f,end:g,visibleStart:u,visibleEnd:p,topSpacerHeight:l[f]||0,bottomSpacerHeight:Math.max(0,c-(l[g]||c)),totalHeight:c,items:n.slice(f,g).map((v,m)=>{let A=f+m;return{item:v,index:A,key:$s(v,A),top:l[A]||0}})}}function Cu(e,t,s={},n={}){let i=Array.isArray(e)?e:[],r=Math.max(0,Math.min(i.length-1,Number.isFinite(t)?Math.floor(t):0));if(i.length===0)return 0;let{offsets:o,heights:a,totalHeight:l}=Go(i,s,n),c=Math.max(1,Number(n.viewportHeight||720)),d=n.align==="start"||n.align==="end"?n.align:"center",u=o[r]||0,p=a[r]||260;return d==="start"?Math.max(0,Math.min(u,l-c)):d==="end"?Math.max(0,Math.min(u+p-c,l-c)):Math.max(0,Math.min(u-(c-p)/2,l-c))}function is({scrollTop:e=0,scrollHeight:t=0,clientHeight:s=0,threshold:n=80}={}){return Math.max(0,Number(t)-Number(e)-Number(s))<=Math.max(0,Number(n))}function Iu(e=0,{viewports:t=2,minPx:s=600}={}){let n=Math.max(0,Number(e)||0),i=Math.max(0,Number(t)||0);return Math.max(0,Number(s)||0,n*i)}function Au({following:e=!0,atBottom:t=!1,userScroll:s=!1}={}){return(s||!!e)&&!!t}function xu({following:e=!0,atBottom:t=!1,resumeBoundaryReached:s=!1,direction:n=0}={}){let i=Number(n)||0;return i<0?!1:e?!!t:i>0&&!!s}function qh(e){return Hh.has(String(e||""))}function Tu(e,t){if(!e||!t||e.button!==0)return!1;let s=t.getBoundingClientRect?.(),n=Math.max(0,Number(t.offsetWidth||0)-Number(t.clientWidth||0));return!s||n<=0?!1:Number(e.clientX)>=Number(s.right)-n&&Number(e.clientX)<=Number(s.right)&&Number(e.clientY)>=Number(s.top)&&Number(e.clientY)<=Number(s.bottom)}function Mu(e,t,s=globalThis.document){if(!e||e.defaultPrevented||!t||!qh(e.key))return!1;let n=e.target;return!n||n.closest?.(Oh)?!1:n===t||n===s?.body||n===s?.documentElement}var Hh,Oh,xt,Qo=H(()=>{Hh=new Set(["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "]),Oh='input, textarea, select, button, a, [contenteditable], [role="button"], [role="link"]';xt=Object.freeze({itemHeight:260,viewportHeight:720,overscan:1,itemGap:18,bottomThreshold:80,resumeBottomThreshold:2,historyPrefetchViewports:2,historyPrefetchMinPx:600})});var Sn,Pu,_u=H(()=>{Qo();Sn=2,Pu={name:"VirtualTranscript",props:{items:{type:Array,default:()=>[]},overscan:{type:Number,default:xt.overscan},itemGap:{type:Number,default:xt.itemGap},estimateHeight:{type:Function,default:qt},initialAlign:{type:String,default:"start"}},emits:["scroll-state"],template:`
1018
+ `}});function kn(e,t,s){return Math.min(Math.max(e,t),s)}function Li(e){return e?typeof e=="string"?e.length:Array.isArray(e)?e.reduce((t,s)=>t+Li(s),0):typeof e=="object"?Object.values(e).reduce((t,s)=>t+Li(s),0):String(e).length:0}function wu(e){if(!e)return 260;let t=Li(e.content||e.text||e.message||""),s=Array.isArray(e.attachments)?e.attachments.length:0;return kn(110+Math.ceil(t/90)*18+s*120,120,1400)}function $h(e){if(!e)return 260;let t=Li(e.text||e.content||""),s=Array.isArray(e.toolMsgs)?e.toolMsgs.length:0,n=Array.isArray(e.images)?e.images.length:0,i=Array.isArray(e.askRequests)?e.askRequests.length:0;return kn(160+Math.ceil(t/95)*18+s*56+n*140+i*96,160,1400)}function qt(e){if(!e)return 260;if(e.type==="message-block"){let t=Array.isArray(e.items)?e.items:[];return t.length?t.reduce((s,n)=>s+qt(n),0)+Math.max(0,t.length-1)*18:260}return e.type==="assistant-turn"?$h(e):e.message?wu(e.message):wu(e)}function $s(e,t=0){return String(e?.id||e?.messageId||e?.turnId||`virtual_${t}`)}function Vh(e,t,s,n){let i=$s(e,t),r=s instanceof Map?s.get(i):s?.[i];if(Number.isFinite(r)&&r>0)return r;let o=n?n(e,t):qt(e);return Number.isFinite(o)&&o>0?o:260}function Go(e,t={},s={}){let n=Array.isArray(e)?e:[],i=Math.max(0,Number(s.itemGap??18)),r=s.estimateHeight||qt,o=[0],a=[];for(let l=0;l<n.length;l+=1){let c=Vh(n[l],l,t,r);a.push(c),o.push(o[l]+c+(l<n.length-1?i:0))}return{offsets:o,heights:a,totalHeight:o[o.length-1]||0,itemGap:i}}function ku(e,t){let s=0,n=Math.max(0,e.length-2),i=0;for(;s<=n;){let r=Math.floor((s+n)/2);e[r+1]<=t?(i=r+1,s=r+1):n=r-1}return i}function Fh(e,t,s){let n=ku(e,t);for(;n<s&&e[n]<t;)n+=1;return kn(n,0,s)}function Su(e,t,s={}){let n=Array.isArray(e)?e:[],i=n.length;if(!i)return{start:0,end:0,visibleStart:0,visibleEnd:0,topSpacerHeight:0,bottomSpacerHeight:0,totalHeight:0,items:[]};let r=Math.max(0,Number(s.scrollTop||0)),o=Math.max(1,Number(s.viewportHeight||720)),a=Math.max(0,Number(s.overscan??1)),l=Array.isArray(t?.offsets)?t.offsets:[0],c=Number.isFinite(t?.totalHeight)?t.totalHeight:0,d=r+o,u=kn(ku(l,r),0,i-1),p=kn(Fh(l,d,i),u+1,i),f=Math.max(0,u-a),g=Math.min(i,p+a);return{start:f,end:g,visibleStart:u,visibleEnd:p,topSpacerHeight:l[f]||0,bottomSpacerHeight:Math.max(0,c-(l[g]||c)),totalHeight:c,items:n.slice(f,g).map((v,m)=>{let A=f+m;return{item:v,index:A,key:$s(v,A),top:l[A]||0}})}}function Cu(e,t,s={},n={}){let i=Array.isArray(e)?e:[],r=Math.max(0,Math.min(i.length-1,Number.isFinite(t)?Math.floor(t):0));if(i.length===0)return 0;let{offsets:o,heights:a,totalHeight:l}=Go(i,s,n),c=Math.max(1,Number(n.viewportHeight||720)),d=n.align==="start"||n.align==="end"?n.align:"center",u=o[r]||0,p=a[r]||260;return d==="start"?Math.max(0,Math.min(u,l-c)):d==="end"?Math.max(0,Math.min(u+p-c,l-c)):Math.max(0,Math.min(u-(c-p)/2,l-c))}function is({scrollTop:e=0,scrollHeight:t=0,clientHeight:s=0,threshold:n=80}={}){return Math.max(0,Number(t)-Number(e)-Number(s))<=Math.max(0,Number(n))}function Iu(e=0,{viewports:t=2,minPx:s=600}={}){let n=Math.max(0,Number(e)||0),i=Math.max(0,Number(t)||0);return Math.max(0,Number(s)||0,n*i)}function Au({following:e=!0,atBottom:t=!1,userScroll:s=!1}={}){return(s||!!e)&&!!t}function xu({following:e=!0,atBottom:t=!1,resumeBoundaryReached:s=!1,direction:n=0}={}){let i=Number(n)||0;return i<0?!1:e?!!t:i>0&&!!s}function qh(e){return Hh.has(String(e||""))}function Tu(e,t){if(!e||!t||e.button!==0)return!1;let s=t.getBoundingClientRect?.(),n=Math.max(0,Number(t.offsetWidth||0)-Number(t.clientWidth||0));return!s||n<=0?!1:Number(e.clientX)>=Number(s.right)-n&&Number(e.clientX)<=Number(s.right)&&Number(e.clientY)>=Number(s.top)&&Number(e.clientY)<=Number(s.bottom)}function Mu(e,t,s=globalThis.document){if(!e||e.defaultPrevented||!t||!qh(e.key))return!1;let n=e.target;return!n||n.closest?.(Oh)?!1:n===t||n===s?.body||n===s?.documentElement}var Hh,Oh,xt,Qo=H(()=>{Hh=new Set(["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "]),Oh='input, textarea, select, button, a, [contenteditable], [role="button"], [role="link"]';xt=Object.freeze({itemHeight:260,viewportHeight:720,overscan:1,itemGap:18,bottomThreshold:80,resumeBottomThreshold:2,historyPrefetchViewports:2,historyPrefetchMinPx:600})});var Sn,Pu,Ru=H(()=>{Qo();Sn=2,Pu={name:"VirtualTranscript",props:{items:{type:Array,default:()=>[]},overscan:{type:Number,default:xt.overscan},itemGap:{type:Number,default:xt.itemGap},estimateHeight:{type:Function,default:qt},initialAlign:{type:String,default:"start"}},emits:["scroll-state"],template:`
1019
1019
  <div class="virtual-transcript" ref="rootRef">
1020
1020
  <div
1021
1021
  v-if="topSpacerHeight > 0"
@@ -1042,8 +1042,8 @@ ${String(e||"").trim()}
1042
1042
  aria-hidden="true"
1043
1043
  ></div>
1044
1044
  </div>
1045
- `,setup(e,{emit:t,expose:s}){let n=Vue.ref(null),i=Vue.ref(null),r=e.initialAlign==="end",o=Vue.ref(r?Number.MAX_SAFE_INTEGER:0),a=Vue.ref(xt.viewportHeight),l=Vue.reactive({}),c=new Map,d=new Map,u=new Map,p=null,f=null,g=null,v=null,m=0,A=!1,w=0,k=!0,y=null,h="start",b=null,_=Vue.computed(()=>Go(e.items,l,{itemGap:e.itemGap,estimateHeight:e.estimateHeight})),L=Vue.computed(()=>Su(e.items,_.value,{scrollTop:o.value,viewportHeight:a.value,overscan:e.overscan})),U=Vue.computed(()=>L.value.items),$=Vue.computed(()=>L.value.topSpacerHeight),R=Vue.computed(()=>L.value.bottomSpacerHeight);function P(Y){Y&&t("scroll-state",{scrollTop:Y.scrollTop||0,scrollHeight:Y.scrollHeight||0,clientHeight:Y.clientHeight||0})}function T(){let Y=i.value;Y&&(a.value=Math.max(1,Y.clientHeight||xt.viewportHeight),r&&e.items.length===0||(o.value=Math.max(0,Y.scrollTop||0)),P(Y))}function I(){let Y=i.value;return!r||e.initialAlign!=="end"||e.items.length===0||!Y?!1:(ne(),Y.scrollTop=Y.scrollHeight,r=!1,T(),!0)}function M(){I()||T()}function B(){f||(f=requestAnimationFrame(()=>{f=null,T()}))}function F(Y){return Y?is({scrollTop:Y.scrollTop,scrollHeight:Y.scrollHeight,clientHeight:Y.clientHeight,threshold:xt.bottomThreshold}):!0}function z({delta:Y=0,toBottom:N=!1}={},O=w){if(O!==w||(Math.abs(Y)>=Sn&&(m+=Y),N&&(A=!0),v))return;let E=O;v=requestAnimationFrame(()=>{if(v=null,E!==w)return;let J=i.value;if(!J){m=0,A=!1;return}A?J.scrollTop=J.scrollHeight:Math.abs(m)>=Sn&&(J.scrollTop+=m),m=0,A=!1,T()})}function ne(){y=null,b=null}function ve({preserveTarget:Y=!1}={}){w+=1,A=!1,m=0,Y||ne(),v&&cancelAnimationFrame(v),v=null}function ue(Y,N,O){!Y||!O||(u.set(Y,{index:N,el:O}),!g&&(g=requestAnimationFrame(()=>{g=null;let E=Array.from(u.entries());u.clear(),be(E)})))}function be(Y){let N=[];for(let[fe,le]of Y){let _e=le?.el;if(!_e)continue;let De=Math.ceil(_e.getBoundingClientRect?.().height||_e.offsetHeight||0);if(!Number.isFinite(De)||De<=0)continue;let Ve=l[fe];if(Ve===De)continue;let We=c.get(fe);N.push({key:fe,nextHeight:De,previousHeight:Ve,itemIndex:Number.isFinite(We)?We:le.index})}if(!N.length)return;let O=i.value,E=k&&F(O),J=L.value.visibleStart,se=!!y&&N.some(fe=>fe.key===y),me=0,K=!1;for(let fe of N){let{key:le,nextHeight:_e,previousHeight:De,itemIndex:Ve}=fe;if(l[le]=_e,!O||!Number.isFinite(De))continue;let We=_e-De;Math.abs(We)<Sn||(Number.isFinite(Ve)&&Ve<J?me+=We:E&&(K=!0))}if(se){ve({preserveTarget:!0}),Ce(y,h);return}if(Math.abs(me)>=Sn||K){let fe={delta:me,toBottom:K},le=w;K?Vue.nextTick(()=>z(fe,le)):z(fe,le)}}function oe(Y,N="start"){let O=i.value,E=b||d.get(String(Y));if(!O||!E)return!1;let J=O.getBoundingClientRect?.(),se=E.getBoundingClientRect?.();if(!J||!se)return!1;let me=Number(J.top),K=Number(O.clientHeight||a.value),ee=Number(se.height||0),fe=N==="center"&&ee<=K?me+(K-ee)/2:N==="end"&&ee<=K?Number(J.bottom)-ee:me,le=Number(se.top)-fe;return Math.abs(le)>=Sn&&(O.scrollTop+=le),T(),!0}function Ce(Y,N="start",O){let E=String(Y);y=E,h=N,O!==void 0&&(b=O);let J=()=>{y===E&&oe(E,h)};Vue.nextTick(J)}function x(Y){let N=!!Y;N&&ne(),k!==N&&(k=N,k||ve())}function j(Y,N,O){c.set(Y,N),O&&(d.set(Y,O),p&&p.observe(O),Vue.nextTick(()=>ue(Y,N,O)))}function ae(Y,N,O){if(!Y)return;let E=d.get(Y);if(E&&E!==O&&p&&p.unobserve(E),!O){d.delete(Y);return}j(Y,N,O)}async function he(Y,{align:N="center"}={}){let O=Number.isFinite(Y)?Math.floor(Y):-1,E=i.value;if(!E||O<0||O>=e.items.length)return!1;ve({preserveTarget:!0});let J=$s(e.items[O],O);return y=J,h=N,b=null,E.scrollTop=Cu(e.items,O,l,{itemGap:e.itemGap,estimateHeight:e.estimateHeight,viewportHeight:E.clientHeight||a.value,align:N}),T(),await Vue.nextTick(),d.get(J)?(Ce(J,N),!0):!1}function W(Y,N={}){let O=c.get(String(Y));return Number.isFinite(O)?he(O,N):Promise.resolve(!1)}function te(Y,N,{align:O="start"}={}){let E=String(Y||"");return!E||!N?!1:(y=E,h=O,b=N,oe(E,O),!0)}return s({scrollToKey:W,scrollToIndex:he,anchorTarget:te,clearTargetAnchor:ne,cancelPendingBottomFollow:ve,setBottomFollowEnabled:x}),Vue.watch(()=>e.items.map((Y,N)=>$s(Y,N)).join(`
1046
- `),()=>{c.clear(),e.items.forEach((Y,N)=>c.set($s(Y,N),N)),y&&!c.has(y)&&ne(),Vue.nextTick(M)},{immediate:!0}),Vue.onMounted(()=>{if(i.value=n.value?.closest?.(".chat-container")||n.value?.parentElement||null,M(),i.value?.addEventListener("scroll",B,{passive:!0}),window.addEventListener("resize",B),typeof ResizeObserver<"u"){p=new ResizeObserver(Y=>{for(let N of Y){let O=N.target?.dataset?.virtualId,E=Number(N.target?.dataset?.virtualIndex);O&&ue(O,E,N.target)}});for(let[Y,N]of d.entries()){let O=c.get(Y)??Number(N.dataset?.virtualIndex||0);j(Y,O,N)}}}),Vue.onBeforeUnmount(()=>{i.value?.removeEventListener("scroll",B),window.removeEventListener("resize",B),p&&p.disconnect(),f&&cancelAnimationFrame(f),g&&cancelAnimationFrame(g),v&&cancelAnimationFrame(v),u.clear(),m=0,A=!1}),{rootRef:n,visibleEntries:U,topSpacerHeight:$,bottomSpacerHeight:R,setItemRef:ae}}}});function Cn(e){return typeof e=="string"&&e.trim()?e.trim():""}function Nh(e){return Cn(e?.speakerVpId)||Cn(e?.vpId)}function Ru(e,t){if(!e||!t)return!1;let s=Cn(e.speakerVpId),n=Nh(t);if(s&&n&&s!==n)return!0;if(e.isHistory&&t.isHistory)return!1;let i=Cn(e.turnId),r=Cn(t.turnId);return!!(i&&r&&i!==r)}var Du=H(()=>{});function In(e){return e?e.type!=="user"&&e.type!=="system"&&e.type!=="error":!1}function $i(e){let t=Array.isArray(e?.items)?e.items:[];return e?.responseCollapsed?t.filter(s=>!In(s)):t}function Bh(e){return(Array.isArray(e?.items)?e.items:[]).filter(In)}function Eu(e){let t=Bh(e);return t.length?t[0]:null}function Wh(e){let t=e?.textContent??e?.text??e?.content??e?.message?.content??"";return typeof t=="string"?t:Array.isArray(t)?t.map(s=>typeof s=="string"?s:s&&s.type==="text"&&s.text||"").join(""):t==null?"":String(t)}function Lu(e){if(!e?.responseCollapsed)return[];let t=Eu(e);return Wh(t).replace(/```[\s\S]*?```/g," ").replace(/`([^`]+)`/g,"$1").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[[^\]]*\]\(([^)]*)\)/g,"").replace(/[#>*_~\-]+/g," ").split(/\r?\n/).map(n=>n.trim()).filter(Boolean).slice(0,2)}function $u(e,t){if(!e?.responseCollapsed||typeof t!="function")return null;let s=$i(e),n=Eu(e)?74:0,i=s.length+(n?1:0);if(!s.length)return n;let r=s.reduce((a,l)=>a+t(l),0),o=Math.max(0,i-1)*18;return r+o+n}var Vu=H(()=>{});function rs(e,t){typeof t!="string"||!/^m\d+$/.test(t)||e.includes(t)||e.push(t)}function Uh(e){if(!e)return[];let t=[];for(let s of Array.isArray(e.messages)?e.messages:[])rs(t,s?.id),rs(t,s?.messageId),rs(t,s?.persistedMessageId);return rs(t,e.message?.id),rs(t,e.messageId),rs(t,e.atMessageId),e.type!=="assistant-turn"&&rs(t,e.id),t}function Fu(e){return!e?.closest?.(".yeaft-conversation-outline, .yeaft-conversation-outline-sender-menu, .yeaft-search-btn")}async function Hu({result:e,revealWindow:t,nextTick:s,revealMessage:n,isMobile:i,closeOutline:r}){if(!e||!await t?.(e))return!1;await s?.();let a=await n?.(e.messageId);return a&&i&&r?.(),!!a}function zh(e,t){if(!t)return null;for(let s of Array.isArray(e)?e:[]){if(!s)continue;let n=Array.isArray(s.items)?s.items:[s];for(let i of n){if(!Uh(i).includes(t))continue;let r=i?.id,o=s?.id;return!r||!o?null:{blockId:o,rowId:r,collapseKey:s.responseCollapseKey||null,requiresExpansion:!!(s.responseCollapsed&&i.type==="assistant-turn")}}}return null}async function Ou({blocks:e,messageId:t,collapseStates:s,scrollToBlock:n,findRow:i,anchorRow:r,flashRow:o,nextTick:a,align:l="start"}){let c=zh(e,t);if(!c||typeof n!="function"||typeof i!="function")return!1;if(c.requiresExpansion){if(!c.collapseKey||!s)return!1;s[c.collapseKey]=!1,await a?.()}if(!await n(c.blockId,{align:l}))return!1;await a?.();let u=i(c.rowId);return u?(typeof r=="function"?r(c.blockId,c.rowId,u,{align:l}):u.scrollIntoView?.({block:l,inline:"nearest"}),o?.(c.rowId),!0):!1}var Xo=H(()=>{});var Vi,Zo=H(()=>{ct();Fo();Mi();Ei();fu();Yo();mu();vu();bu();_u();Du();Qo();Vu();Xo();es();di();Vi={name:"MessageList",components:{MessageItem:Es,AssistantTurn:Ls,VpTurnBlock:pu,VpSpeakerHeader:Ri,ReflectionCard:gu,SubAgentCard:hu,UserTurnBlock:yu,VirtualTranscript:Pu},template:`
1045
+ `,setup(e,{emit:t,expose:s}){let n=Vue.ref(null),i=Vue.ref(null),r=e.initialAlign==="end",o=Vue.ref(r?Number.MAX_SAFE_INTEGER:0),a=Vue.ref(xt.viewportHeight),l=Vue.reactive({}),c=new Map,d=new Map,u=new Map,p=null,f=null,g=null,v=null,m=0,A=!1,w=0,k=!0,y=null,h="start",b=null,R=Vue.computed(()=>Go(e.items,l,{itemGap:e.itemGap,estimateHeight:e.estimateHeight})),L=Vue.computed(()=>Su(e.items,R.value,{scrollTop:o.value,viewportHeight:a.value,overscan:e.overscan})),U=Vue.computed(()=>L.value.items),$=Vue.computed(()=>L.value.topSpacerHeight),_=Vue.computed(()=>L.value.bottomSpacerHeight);function P(Y){Y&&t("scroll-state",{scrollTop:Y.scrollTop||0,scrollHeight:Y.scrollHeight||0,clientHeight:Y.clientHeight||0})}function T(){let Y=i.value;Y&&(a.value=Math.max(1,Y.clientHeight||xt.viewportHeight),r&&e.items.length===0||(o.value=Math.max(0,Y.scrollTop||0)),P(Y))}function I(){let Y=i.value;return!r||e.initialAlign!=="end"||e.items.length===0||!Y?!1:(ne(),Y.scrollTop=Y.scrollHeight,r=!1,T(),!0)}function M(){I()||T()}function B(){f||(f=requestAnimationFrame(()=>{f=null,T()}))}function F(Y){return Y?is({scrollTop:Y.scrollTop,scrollHeight:Y.scrollHeight,clientHeight:Y.clientHeight,threshold:xt.bottomThreshold}):!0}function z({delta:Y=0,toBottom:N=!1}={},O=w){if(O!==w||(Math.abs(Y)>=Sn&&(m+=Y),N&&(A=!0),v))return;let E=O;v=requestAnimationFrame(()=>{if(v=null,E!==w)return;let J=i.value;if(!J){m=0,A=!1;return}A?J.scrollTop=J.scrollHeight:Math.abs(m)>=Sn&&(J.scrollTop+=m),m=0,A=!1,T()})}function ne(){y=null,b=null}function ve({preserveTarget:Y=!1}={}){w+=1,A=!1,m=0,Y||ne(),v&&cancelAnimationFrame(v),v=null}function ue(Y,N,O){!Y||!O||(u.set(Y,{index:N,el:O}),!g&&(g=requestAnimationFrame(()=>{g=null;let E=Array.from(u.entries());u.clear(),be(E)})))}function be(Y){let N=[];for(let[fe,le]of Y){let Re=le?.el;if(!Re)continue;let De=Math.ceil(Re.getBoundingClientRect?.().height||Re.offsetHeight||0);if(!Number.isFinite(De)||De<=0)continue;let Ve=l[fe];if(Ve===De)continue;let We=c.get(fe);N.push({key:fe,nextHeight:De,previousHeight:Ve,itemIndex:Number.isFinite(We)?We:le.index})}if(!N.length)return;let O=i.value,E=k&&F(O),J=L.value.visibleStart,se=!!y&&N.some(fe=>fe.key===y),me=0,K=!1;for(let fe of N){let{key:le,nextHeight:Re,previousHeight:De,itemIndex:Ve}=fe;if(l[le]=Re,!O||!Number.isFinite(De))continue;let We=Re-De;Math.abs(We)<Sn||(Number.isFinite(Ve)&&Ve<J?me+=We:E&&(K=!0))}if(se){ve({preserveTarget:!0}),Ce(y,h);return}if(Math.abs(me)>=Sn||K){let fe={delta:me,toBottom:K},le=w;K?Vue.nextTick(()=>z(fe,le)):z(fe,le)}}function oe(Y,N="start"){let O=i.value,E=b||d.get(String(Y));if(!O||!E)return!1;let J=O.getBoundingClientRect?.(),se=E.getBoundingClientRect?.();if(!J||!se)return!1;let me=Number(J.top),K=Number(O.clientHeight||a.value),ee=Number(se.height||0),fe=N==="center"&&ee<=K?me+(K-ee)/2:N==="end"&&ee<=K?Number(J.bottom)-ee:me,le=Number(se.top)-fe;return Math.abs(le)>=Sn&&(O.scrollTop+=le),T(),!0}function Ce(Y,N="start",O){let E=String(Y);y=E,h=N,O!==void 0&&(b=O);let J=()=>{y===E&&oe(E,h)};Vue.nextTick(J)}function x(Y){let N=!!Y;N&&ne(),k!==N&&(k=N,k||ve())}function j(Y,N,O){c.set(Y,N),O&&(d.set(Y,O),p&&p.observe(O),Vue.nextTick(()=>ue(Y,N,O)))}function ae(Y,N,O){if(!Y)return;let E=d.get(Y);if(E&&E!==O&&p&&p.unobserve(E),!O){d.delete(Y);return}j(Y,N,O)}async function he(Y,{align:N="center"}={}){let O=Number.isFinite(Y)?Math.floor(Y):-1,E=i.value;if(!E||O<0||O>=e.items.length)return!1;ve({preserveTarget:!0});let J=$s(e.items[O],O);return y=J,h=N,b=null,E.scrollTop=Cu(e.items,O,l,{itemGap:e.itemGap,estimateHeight:e.estimateHeight,viewportHeight:E.clientHeight||a.value,align:N}),T(),await Vue.nextTick(),d.get(J)?(Ce(J,N),!0):!1}function W(Y,N={}){let O=c.get(String(Y));return Number.isFinite(O)?he(O,N):Promise.resolve(!1)}function te(Y,N,{align:O="start"}={}){let E=String(Y||"");return!E||!N?!1:(y=E,h=O,b=N,oe(E,O),!0)}return s({scrollToKey:W,scrollToIndex:he,anchorTarget:te,clearTargetAnchor:ne,cancelPendingBottomFollow:ve,setBottomFollowEnabled:x}),Vue.watch(()=>e.items.map((Y,N)=>$s(Y,N)).join(`
1046
+ `),()=>{c.clear(),e.items.forEach((Y,N)=>c.set($s(Y,N),N)),y&&!c.has(y)&&ne(),Vue.nextTick(M)},{immediate:!0}),Vue.onMounted(()=>{if(i.value=n.value?.closest?.(".chat-container")||n.value?.parentElement||null,M(),i.value?.addEventListener("scroll",B,{passive:!0}),window.addEventListener("resize",B),typeof ResizeObserver<"u"){p=new ResizeObserver(Y=>{for(let N of Y){let O=N.target?.dataset?.virtualId,E=Number(N.target?.dataset?.virtualIndex);O&&ue(O,E,N.target)}});for(let[Y,N]of d.entries()){let O=c.get(Y)??Number(N.dataset?.virtualIndex||0);j(Y,O,N)}}}),Vue.onBeforeUnmount(()=>{i.value?.removeEventListener("scroll",B),window.removeEventListener("resize",B),p&&p.disconnect(),f&&cancelAnimationFrame(f),g&&cancelAnimationFrame(g),v&&cancelAnimationFrame(v),u.clear(),m=0,A=!1}),{rootRef:n,visibleEntries:U,topSpacerHeight:$,bottomSpacerHeight:_,setItemRef:ae}}}});function Cn(e){return typeof e=="string"&&e.trim()?e.trim():""}function Nh(e){return Cn(e?.speakerVpId)||Cn(e?.vpId)}function _u(e,t){if(!e||!t)return!1;let s=Cn(e.speakerVpId),n=Nh(t);if(s&&n&&s!==n)return!0;if(e.isHistory&&t.isHistory)return!1;let i=Cn(e.turnId),r=Cn(t.turnId);return!!(i&&r&&i!==r)}var Du=H(()=>{});function In(e){return e?e.type!=="user"&&e.type!=="system"&&e.type!=="error":!1}function $i(e){let t=Array.isArray(e?.items)?e.items:[];return e?.responseCollapsed?t.filter(s=>!In(s)):t}function Bh(e){return(Array.isArray(e?.items)?e.items:[]).filter(In)}function Eu(e){let t=Bh(e);return t.length?t[0]:null}function Wh(e){let t=e?.textContent??e?.text??e?.content??e?.message?.content??"";return typeof t=="string"?t:Array.isArray(t)?t.map(s=>typeof s=="string"?s:s&&s.type==="text"&&s.text||"").join(""):t==null?"":String(t)}function Lu(e){if(!e?.responseCollapsed)return[];let t=Eu(e);return Wh(t).replace(/```[\s\S]*?```/g," ").replace(/`([^`]+)`/g,"$1").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[[^\]]*\]\(([^)]*)\)/g,"").replace(/[#>*_~\-]+/g," ").split(/\r?\n/).map(n=>n.trim()).filter(Boolean).slice(0,2)}function $u(e,t){if(!e?.responseCollapsed||typeof t!="function")return null;let s=$i(e),n=Eu(e)?74:0,i=s.length+(n?1:0);if(!s.length)return n;let r=s.reduce((a,l)=>a+t(l),0),o=Math.max(0,i-1)*18;return r+o+n}var Vu=H(()=>{});function rs(e,t){typeof t!="string"||!/^m\d+$/.test(t)||e.includes(t)||e.push(t)}function Uh(e){if(!e)return[];let t=[];for(let s of Array.isArray(e.messages)?e.messages:[])rs(t,s?.id),rs(t,s?.messageId),rs(t,s?.persistedMessageId);return rs(t,e.message?.id),rs(t,e.messageId),rs(t,e.atMessageId),e.type!=="assistant-turn"&&rs(t,e.id),t}function Fu(e){return!e?.closest?.(".yeaft-conversation-outline, .yeaft-conversation-outline-sender-menu, .yeaft-search-btn")}async function Hu({result:e,revealWindow:t,nextTick:s,revealMessage:n,isMobile:i,closeOutline:r}){if(!e||!await t?.(e))return!1;await s?.();let a=await n?.(e.messageId);return a&&i&&r?.(),!!a}function zh(e,t){if(!t)return null;for(let s of Array.isArray(e)?e:[]){if(!s)continue;let n=Array.isArray(s.items)?s.items:[s];for(let i of n){if(!Uh(i).includes(t))continue;let r=i?.id,o=s?.id;return!r||!o?null:{blockId:o,rowId:r,collapseKey:s.responseCollapseKey||null,requiresExpansion:!!(s.responseCollapsed&&i.type==="assistant-turn")}}}return null}async function Ou({blocks:e,messageId:t,collapseStates:s,scrollToBlock:n,findRow:i,anchorRow:r,flashRow:o,nextTick:a,align:l="start"}){let c=zh(e,t);if(!c||typeof n!="function"||typeof i!="function")return!1;if(c.requiresExpansion){if(!c.collapseKey||!s)return!1;s[c.collapseKey]=!1,await a?.()}if(!await n(c.blockId,{align:l}))return!1;await a?.();let u=i(c.rowId);return u?(typeof r=="function"?r(c.blockId,c.rowId,u,{align:l}):u.scrollIntoView?.({block:l,inline:"nearest"}),o?.(c.rowId),!0):!1}var Xo=H(()=>{});var Vi,Zo=H(()=>{ct();Fo();Mi();Ei();fu();Yo();mu();vu();bu();Ru();Du();Qo();Vu();Xo();es();di();Vi={name:"MessageList",components:{MessageItem:Es,AssistantTurn:Ls,VpTurnBlock:pu,VpSpeakerHeader:_i,ReflectionCard:gu,SubAgentCard:hu,UserTurnBlock:yu,VirtualTranscript:Pu},template:`
1047
1047
  <main class="chat-container" ref="containerRef">
1048
1048
  <!-- Session Loading Overlay - only covers message area -->
1049
1049
  <div class="session-loading-overlay" v-if="showSessionLoadingOverlay">
@@ -1665,7 +1665,7 @@ ${String(e||"").trim()}
1665
1665
  {{ $t('message.scrollToLatest') }}
1666
1666
  </button>
1667
1667
  </main>
1668
- `,emits:["new-conversation","resume-conversation","open-settings","quote-message","edit-message-as-new"],setup(e,{expose:t}){let s=Pinia.useChatStore(),n=Me(),i=typeof window<"u"&&window.Pinia?.useVpStore?window.Pinia.useVpStore():null,r=Vue.inject("t",null),o=Vue.ref(null),a=Vue.ref(null),l=Vue.reactive({}),c=Vue.reactive({}),d=Vue.reactive({}),u=S=>String(S?.id||S?.turnId||S?.messageId||S?.atMessageId||S?.message?.id||"turn_unknown"),p=S=>{let V=u(S);return Object.prototype.hasOwnProperty.call(l,V)?!!l[V]:!1},f=(S,V)=>{l[u(S)]=!!V},g=({key:S,value:V}={})=>{S&&(c[S]=!!V)},v=S=>{let V=$u(S,qt);return Number.isFinite(V)?V:qt(S)},m=S=>$i(S),A=S=>{let V=Array.isArray(S?.collapsedResponsePreview)?S.collapsedResponsePreview:Lu(S);return Array.isArray(V)?V:V?[String(V)]:[]},w=S=>{let V=Array.isArray(S?.items)?S.items.find(we=>In(we)):null,q=V?.speakerVpId||V?.vpId||V?.message?.speakerVpId||V?.message?.vpId||S?.vpId||"",pe=q&&i&&typeof i.vpLabel=="function"?i.vpLabel(q)||q:q||(typeof r=="function"?r("message.assistant"):"Assistant"),Se=q&&i&&typeof i.vpTextColor=="function"?{color:i.vpTextColor(q)}:{},re=V?.speakerTimestamp||V?.timestamp||V?.createdAt||V?.message?.timestamp||V?.message?.createdAt||0,Fe="",Be="";if(re)try{let we=new Date(re);Number.isNaN(we.getTime())||(Fe=mt(re),Be=we.toLocaleString())}catch{}return{name:pe,style:Se,timeText:Fe,fullTimeText:Be}},k=S=>{let V=Array.isArray(S?.items)?S.items:[];for(let q=V.length-1;q>=0;q-=1)if(In(V[q]))return V[q];return null},y=(S,V)=>!S?.responseCollapsible||!V?!1:k(S)===V,h=S=>!!(S?.responseCollapsible&&!$i(S).some(V=>y(S,V))),b=S=>{let V=S?.responseCollapseKey;V&&(d[V]=!S.responseCollapsed)},_=S=>{let V=Number(S?.responseCount||0),q=S?.responseCollapsed?"message.showResponses":"message.hideResponses",pe=(typeof r=="function"?r(q):"")||(S?.responseCollapsed?"Show {count} response(s)":"Hide response(s)");return String(pe).replace("{count}",String(V))},L=(()=>{try{return window.Pinia?.useSessionsStore?.()||null}catch{return null}}),U=Vue.computed(()=>{if(s.currentView!=="yeaft")return null;let S=L();if(!S)return null;let V=s.yeaftActiveSessionFilter||null;return V&&typeof S.sessionById=="function"&&S.sessionById(V,s.currentAgent||null)?V:S.activeSessionId&&typeof S.sessionById=="function"&&S.sessionById(S.activeSessionId,s.currentAgent||null)?S.activeSessionId:null}),$=Vue.computed(()=>[s.activeConversationId||"",s.currentView||"",s.currentAgent||"",s.currentView==="yeaft"?s.yeaftActiveSessionFilter||U.value||"__all__":""].join("")),R=Vue.computed(()=>U.value!==null),P=Vue.computed(()=>s.agents.filter(S=>S.online)),T=Vue.ref(null),I=Vue.ref(null),M=Vue.ref(!1),B=Vue.ref(""),F=null,z=0,ne=n.token||"",ve=()=>{T.value=null,I.value=null,B.value="",F=null,z+=1},ue=Ii(),be=Ai(),oe=Vue.computed(()=>xi({profile:T.value,agentSecret:I.value,serverWsUrl:vn(location)})),Ce=()=>{let S={"Content-Type":"application/json"};return n.token&&(S.Authorization=`Bearer ${n.token}`),S},x=async()=>{if(P.value.length>0||s.currentConversation)return;if(I.value||F)return F;M.value=!0,B.value="";let S=++z;return F=(async()=>{let V=n.token||"",q=Ce(),[pe,Se]=await Promise.all([fetch("/api/user/profile",{headers:q}),fetch("/api/user/agent-secret",{headers:q})]),re=pe.ok?await pe.json():null;if(S!==z||V!==(n.token||""))return;if(re&&(T.value=re),!Se.ok){let we="";try{we=(await Se.json())?.error||""}catch{}throw new Error(we||"Failed to load Agent secret")}let Fe=await Se.json();if(S!==z||V!==(n.token||""))return;let Be=Fe?.agentSecret||Fe?.agent_secret||null;I.value=Be&&String(Be).trim()?String(Be):null})().catch(V=>{S===z&&(B.value=V?.message||"Failed to load Agent secret")}).finally(()=>{S===z&&(M.value=!1,F=null)}),F},j=async S=>{if(S)try{await navigator.clipboard.writeText(S)}catch{}},ae=(S,V)=>{let q=S?.message||null,pe=S?.id||S?.atMessageId||q?.id||q?.messageId||`legacy_${V}`,Se=S?.speakerVpId||S?.vpId||q?.speakerVpId||q?.vpId||"";return{id:`message_${Se||"user"}_${pe}_${V}`,vpId:Se,messageId:pe}},he=Vue.computed(()=>{let S=s.messages,V=[],q=null,pe=0,Se=()=>{if(q){q.isActive=!!(q.turnId&&Object.values(s.activeVpTurns||{}).some(st=>((st?.turnId||null)===q.turnId||!st?.turnId&&s.activeVpTurns?.[q.turnId]===st)&&(!s.currentAgent||!st?.agentId||st.agentId===s.currentAgent))),ci(q);let we=!!(q.textContent||q.todoMsg||q.askMsg||q.imageMsgs.length>0),de=q.toolMsgs.length>0||q.toolSummaryCount>0;(we||de)&&(q.showSpeakerHeader=!!q.speakerVpId,V.push(q)),q=null}},re=we=>{if(q){if(!q.speakerVpId){let de=we.speakerVpId||we.vpId;de&&(q.speakerVpId=de,q.speakerTimestamp=typeof we.timestamp=="number"&&we.timestamp>0?we.timestamp:typeof we.createdAt=="number"?we.createdAt:0,typeof we.lastStateChangeCause=="string"&&!q.speakerStateCause&&(q.speakerStateCause=we.lastStateChangeCause))}!q.turnId&&we.turnId&&(q.turnId=we.turnId)}},Fe=()=>{pe++,q={type:"assistant-turn",id:"turn_"+pe,textContent:"",textSegments:[],isStreaming:!1,isActive:!1,isHistory:!1,todoMsg:null,toolMsgs:[],toolSummaryCount:0,imageMsgs:[],askMsg:null,messages:[],atMessageId:null,speakerVpId:null,speakerTimestamp:0,speakerStateCause:"",showSpeakerHeader:!1,turnId:null}},Be=we=>{Ru(q,we)&&Se()};for(let we=0;we<S.length;we++){let de=S[we];if(de.type==="user"){if(!de.content||!de.content.trim())continue;Se(),V.push({type:"user",id:de.id||"u_"+we,message:de});continue}if(de.type==="system"||de.type==="error"){Se(),V.push({type:de.type,id:de.id||"s_"+we,message:de});continue}if(!(de.type==="tool-result"||de.type==="tool_result")){if(de.type==="tool-summary"){Be(de),q||Fe(),re(de),de.isHistory&&(q.isHistory=!0),q.toolSummaryCount+=Number(de.count||de.omittedCount||0)||0,q.messages.push(de);continue}if(de.type==="assistant"){Be(de),q||Fe(),li(q,de),de.isStreaming&&(q.isStreaming=!0),de.isHistory&&(q.isHistory=!0),de.id&&/^m\d+$/.test(de.id)&&(q.atMessageId=de.id),re(de),q.messages.push(de);continue}if(de.type==="tool-use"){Be(de),q||Fe(),re(de);let st=S[we+1],Xs=st&&(st.type==="tool-result"||st.type==="tool_result"),Lt={...de,hasResult:Xs||de.hasResult||!1,toolResult:de.toolResult||null};de.isHistory&&(q.isHistory=!0),de.toolName==="TodoWrite"?q.todoMsg=Lt:de.toolName==="AskUserQuestion"?q.askMsg=Lt:q.toolMsgs.push(Lt),q.messages.push(de);continue}if(de.type==="chat-image"){Be(de),q||Fe(),re(de),de.isHistory&&(q.isHistory=!0),q.imageMsgs.push(de),q.messages.push(de);continue}Se(),V.push({type:de.type||"unknown",id:de.id||"x_"+we,message:de})}}return Se(),V}),W=Vue.computed(()=>{let S=[],V=null,q=()=>{V&&S.push(V),V=null};return he.value.forEach((pe,Se)=>{if(!pe||pe.type==="system"||pe.type==="error"){q(),S.push(pe);return}let re=ae(pe,Se);if(pe.type==="user"||!V){q(),V={type:"message-block",id:`turn_${re.messageId}_${Se}`,vpId:re.vpId,messageId:re.messageId,items:[pe]};return}V.items.push(pe),!V.vpId&&re.vpId&&(V.vpId=re.vpId)}),q(),S}),te=Vue.computed(()=>{let S=s.yeaftReflectionCards||{},V=s.yeaftConversationId,q={__orphans:[]},pe=Object.values(S).filter(re=>re&&re.conversationId===V).sort((re,Fe)=>(re.anchorOrder||0)-(Fe.anchorOrder||0)||(re.updatedAt||0)-(Fe.updatedAt||0)),Se=new Set;for(let re of s.messages||[])re&&re.id&&Se.add(re.id);for(let re of pe)re.anchorMsgId&&Se.has(re.anchorMsgId)?(q[re.anchorMsgId]||(q[re.anchorMsgId]=[]),q[re.anchorMsgId].push(re)):q.__orphans.push(re);return q}),Y=S=>S?S.type==="assistant-turn"?S.atMessageId||null:S.message&&S.message.id||null:null,N=S=>{let V=Y(S);return V?(te.value||{})[V]||[]:[]},O=Vue.computed(()=>(te.value||{}).__orphans||[]),E=Vue.computed(()=>{let S=s.yeaftSubAgentCards||{},V=s.yeaftConversationId,q={__orphans:[]},pe=Object.values(S).filter(re=>re&&re.conversationId===V).sort((re,Fe)=>(re.anchorOrder||0)-(Fe.anchorOrder||0)||(re.updatedAt||0)-(Fe.updatedAt||0)),Se=new Set;for(let re of s.messages||[])re&&re.id&&Se.add(re.id);for(let re of pe)re.anchorMsgId&&Se.has(re.anchorMsgId)?(q[re.anchorMsgId]||(q[re.anchorMsgId]=[]),q[re.anchorMsgId].push(re)):q.__orphans.push(re);return q}),J=S=>{let V=Y(S);return V?(E.value||{})[V]||[]:[]},se=Vue.computed(()=>(E.value||{}).__orphans||[]),me=Vue.ref(!0),K=Vue.ref(!1),ee=xt.bottomThreshold,fe=xt.resumeBottomThreshold,le=!0,_e=Vue.computed(()=>s.messages.some(S=>S.isStreaming)),De=Vue.computed(()=>!s.activeConversationId||W.value.length>0?!1:s.currentView==="yeaft"?!!s.yeaftInitialHistoryLoading:!!s.sessionLoading),Ve=Vue.computed(()=>s.currentView==="yeaft"?"":s.sessionLoadingText||""),We=Vue.computed(()=>!!s.sessionLoading&&!De.value),Mt=Vue.computed(()=>s.isProcessing&&!_e.value),pt=Vue.ref(Date.now()),ft=null,Us=()=>{ft||(ft=setInterval(()=>{pt.value=Date.now()},1e3))},bt=()=>{ft&&(clearInterval(ft),ft=null)};Vue.watch(_e,S=>{S?(pt.value=Date.now(),Us()):bt()},{immediate:!0}),Vue.onBeforeUnmount(()=>bt());let He=Vue.ref(0),Ue=Vue.ref(Date.now()),je=null,Ke=null,Je=Vue.ref("cat"),D=new URLSearchParams(window.location.search).get("preview"),Q=Vue.ref(0),ge=Vue.ref(1),ie=Vue.ref(5),ye=Vue.ref(95),ke=Vue.ref("bark-both"),Oe=Vue.ref(1),qe=Vue.ref(-1),ze=null;function Pt(){if(!He.value)return;Ue.value=Date.now();let S=(Ue.value-He.value)%19e3;if(S<4e3)Q.value=0,ge.value=1;else if(S<11500){let V=S-4e3,q;V<2500?q=V/2500*16:V<5e3?q=16+(V-2500)/2500*29:q=45+(V-5e3)/2500*55,Q.value=q,ge.value=1}else S<14e3?(Q.value=(1-(S-11500)/2500)*100,ge.value=-1):(Q.value=0,ge.value=1);Ke=requestAnimationFrame(Pt)}function _t(){if(!He.value||Je.value!=="dog")return;Ue.value=Date.now();let S=(Ue.value-He.value)%18e3;if(S<2e3)ie.value=5,ye.value=95,ke.value="bark-both",Oe.value=1,qe.value=-1;else if(S<5e3){let V=(S-2e3)/3e3;ie.value=5+V*25,ye.value=95,ke.value="left-approach",Oe.value=1,qe.value=-1}else if(S<8e3){let V=(S-5e3)/3e3;ie.value=30,ye.value=95-V*25,ke.value="right-approach",Oe.value=1,qe.value=-1}else if(S<1e4){let V=(S-8e3)/2e3;ie.value=30+V*13,ye.value=70-V*13,ke.value="both-approach",Oe.value=1,qe.value=-1}else if(S<11e3)ie.value=43,ye.value=57,ke.value="snap",Oe.value=1,qe.value=-1;else if(S<12500)ie.value=43,ye.value=57,ke.value="stunned",Oe.value=1,qe.value=-1;else if(S<15e3){let V=(S-12500)/2500;ie.value=43-V*38,ye.value=57+V*38,ke.value="retreat",Oe.value=-1,qe.value=1}else S<17e3?(ie.value=5,ye.value=95,ke.value="rehang",Oe.value=-1,qe.value=1):(ie.value=5,ye.value=95,ke.value="reset",Oe.value=1,qe.value=-1);ze=requestAnimationFrame(_t)}let gr=Vue.computed(()=>{let S=ie.value*1.2;return Oe.value<0?`translate(${S+13.5}, 0) scale(-1, 1)`:`translate(${S-13.5}, 0)`}),mr=Vue.computed(()=>{let S=ye.value*1.2;return qe.value>0?`translate(${S-10.5}, 2)`:`translate(${S+10.5}, 2) scale(-1, 1)`}),En=Vue.computed(()=>{let S=ke.value;return S==="bark-both"||S==="left-approach"||S==="right-approach"||S==="both-approach"||S==="reset"}),hr=Vue.computed(()=>{let S=ie.value*1.2,V=10;if(En.value){let Se=Math.max(0,(S-3)*.12);return`M3,18 Q${(3+S)/2},${18+Se} ${S},${V}`}if(ke.value==="rehang")return`M${S},${V} Q${S-3},20 3,18`;let q=Oe.value<0?1:-1,pe=S+q*8;return`M${S},${V} Q${S},18 ${pe},22`}),Ln=Vue.computed(()=>{let S=ye.value*1.2,V=10;if(En.value){let Se=Math.max(0,(118-S)*.12);return`M118,18 Q${(118+S)/2},${18+Se} ${S},${V}`}if(ke.value==="rehang")return`M${S},${V} Q${S+3},20 118,18`;let q=qe.value>0?-1:1,pe=S+q*8;return`M${S},${V} Q${S},18 ${pe},22`}),vr=Vue.computed(()=>ke.value==="snap"?.2:.4),yr=Vue.computed(()=>ke.value==="snap"?.2:.4),br=Vue.computed(()=>ie.value*1.2),wr=Vue.computed(()=>ye.value*1.2),zs=D==="cat"||D==="dog"||D==="animation",$n=600,Ks=Vue.ref(!1),et=null,Vn=Vue.computed(()=>zs?!0:Ks.value);Vue.watch(Mt,S=>{if(S)et&&(clearTimeout(et),et=null),Ks.value=!0,He.value=Date.now(),Ue.value=Date.now(),Je.value="cat",Q.value=0,ge.value=1,ie.value=5,ye.value=95,ke.value="bark-both",Oe.value=1,qe.value=-1,Je.value==="cat"?Ke=requestAnimationFrame(Pt):ze=requestAnimationFrame(_t);else{let V=He.value?Date.now()-He.value:$n,q=Math.max(0,$n-V),pe=()=>{et=null,Ks.value=!1,He.value=0,Q.value=0,ge.value=1,Ke&&(cancelAnimationFrame(Ke),Ke=null),ze&&(cancelAnimationFrame(ze),ze=null)};q===0?pe():(et&&clearTimeout(et),et=setTimeout(pe,q))}},{immediate:!0}),zs&&(He.value=Date.now(),Ue.value=Date.now(),D==="dog"?Je.value="dog":Je.value="cat",Je.value==="cat"?Ke=requestAnimationFrame(Pt):(ie.value=5,ye.value=95,ke.value="bark-both",Oe.value=1,qe.value=-1,ze=requestAnimationFrame(_t)));let kr=Vue.computed(()=>{if(!s.isProcessing)return null;if(s.connectionState!=="connected")return"disconnected";let S=s.currentConversation;if(s.compactStatus?.conversationId===S&&s.compactStatus?.status==="compacting")return"compacting";let V=s.sessionHealth?.[S];return V?V.status:He.value&&Ue.value-He.value>8e3?"thinking":null}),Sr=Vue.computed(()=>{if(!He.value)return"speed-napping";let S=(Ue.value-He.value)%19e3;return S>=16e3?"speed-petted":S>=14e3?"speed-tired":S>=11500?"speed-crazy":S>=9e3?"speed-turbo":S>=6500?"speed-fast":S>=4e3?"speed-normal":"speed-napping"}),Cr=Vue.computed(()=>{let S=Q.value,V=ge.value,pe={left:`calc(40px + (100% - 80px) * ${S/100})`};return V<0&&(pe.transform="scaleX(-1)"),pe});function Ir(){let S=s.currentConversation;if(!S)return;let V=s.conversations.find(q=>q.id===S);s.sendWsMessage({type:"refresh_conversation",conversationId:S,agentId:V?.agentId})}let tt=()=>{if(!o.value)return!0;let{scrollTop:S,scrollHeight:V,clientHeight:q}=o.value;return is({scrollTop:S,scrollHeight:V,clientHeight:q,threshold:ee})},ps=(S,V=0,{allowContinuation:q=!1}={})=>{if(S>Iu(V)){le=!0;return}q&&(le=!0),!(!le||!Hn())&&(le=!1,Wt())},Ar=S=>{if(!S)return"";let q=(Array.isArray(S.items)?S.items:[])[0]||null;return[S.type||"",S.messageId||"",S.turnId||"",S.vpId||"",q?.id||"",q?.turnId||"",q?.messageId||""].join(":")},Fn=()=>{let S=W.value||[];return{blockCount:S.length,firstBlockIdentity:Ar(S[0])}},fs=(S,V)=>!S||!V?!1:V.blockCount>S.blockCount||V.firstBlockIdentity!==S.firstBlockIdentity,Ys=S=>{Vue.nextTick(()=>{if(!o.value)return;let V=Fn();fs(S,V)&&ps(o.value.scrollTop||0,o.value.clientHeight||0,{allowContinuation:!0})})},xr=({scrollTop:S,scrollHeight:V,clientHeight:q})=>{let pe=is({scrollTop:S,scrollHeight:V,clientHeight:q,threshold:ee});return me.value=pe,K.value=!pe,pe},gs=()=>{K.value=!1,me.value=!0,a.value?.setBottomFollowEnabled?.(!0)},Rt=()=>{K.value=!0,me.value=!1,a.value?.setBottomFollowEnabled?.(!1),a.value?.cancelPendingBottomFollow?.()},Tr=({scrollTop:S,scrollHeight:V,clientHeight:q})=>{let pe=is({scrollTop:S||0,scrollHeight:V||0,clientHeight:q||0,threshold:ee});me.value=Au({following:!K.value,atBottom:pe}),K.value=!me.value,a.value?.setBottomFollowEnabled?.(me.value),wt||(Ut=Number(S||0)),ps(S||0,q||0)},Mr=(S,V)=>{let q=Fn();if(!o.value){S(),Ys(q);return}let pe=o.value.scrollHeight,Se=o.value.scrollTop,re=!1,Fe=null,Be=()=>{re||(re=!0,Fe&&Fe(),Vue.nextTick(()=>{if(!o.value)return;let we=o.value.scrollHeight;o.value.scrollTop=we-pe+Se,Ys(q)}))};V&&(Fe=Vue.watch(V,we=>{we||Be()})),S(),Vue.nextTick(()=>{(!V||!V())&&Be()})},Pr=()=>{if(s.hasHiddenYeaftMessages){s.expandYeaftMessageWindow();return}s.loadMoreYeaftHistory()},Hn=()=>s.currentView==="yeaft"?s.hasHiddenYeaftMessages||s.yeaftHasMoreHistory&&!s.yeaftLoadingMoreHistory&&s.yeaftOldestLoadedSeq!=null:!!s.currentConversation&&s.hasMoreMessages&&!s.loadingMoreMessages,Wt=()=>{if(!Hn())return;let S=s.currentView==="yeaft";Mr(S?Pr:()=>s.loadMoreMessages(),S?()=>s.yeaftLoadingMoreHistory:()=>s.loadingMoreMessages)},wt=!1,js=!1,Ge=null,Ut=0,On=250,qn=()=>{wt=!1,Ge&&(clearTimeout(Ge),Ge=null)},zt=()=>{js||(Ge&&clearTimeout(Ge),Ge=setTimeout(qn,On))},ms=S=>{wt=!0,a.value?.clearTargetAnchor?.(),Ut=Number(o.value?.scrollTop||0),Number(S?.deltaY)<0&&Rt(),zt()},Nn=S=>{Tu(S,o.value)&&(js=!0,wt=!0,a.value?.clearTargetAnchor?.(),Ut=Number(o.value?.scrollTop||0),Ge&&(clearTimeout(Ge),Ge=null))},hs=()=>{js=!1,zt()},Bn=S=>{Mu(S,o.value)&&((S.key==="ArrowUp"||S.key==="PageUp"||S.key==="Home")&&Rt(),wt=!0,a.value?.clearTargetAnchor?.(),zt())},Wn=()=>{let S=Number(o.value?.scrollTop||0),V=wt?S-Ut:0,q=!K.value;Ut=S;let pe=tt(),Se=is({scrollTop:S,scrollHeight:o.value?.scrollHeight||0,clientHeight:o.value?.clientHeight||0,threshold:fe});me.value=xu({following:q,atBottom:pe,resumeBoundaryReached:Se,direction:V}),K.value=!me.value,a.value?.setBottomFollowEnabled?.(me.value),me.value&&Gs(),wt&&zt(),o.value&&ps(o.value.scrollTop||0,o.value.clientHeight||0)},Gs=()=>{s.currentView==="yeaft"&&s.pruneYeaftMessageWindow()},vs=()=>{o.value&&(o.value.scrollTop=o.value.scrollHeight,gs(),Gs())},_r=()=>{gs(),Vue.nextTick(vs)},Dt=()=>{!K.value&&me.value&&(Gs(),Vue.nextTick(vs))},Et=S=>{if(!S)return"";if(Array.isArray(S.items))return S.items.map(Et).join(",");let V=S.message||{};return[S.type||"",S.id||"",S.atMessageId||"",S.turnId||"",S.messageId||"",S.speakerVpId||"",V.id||"",V.content?String(V.content).length:0,S.textContent?String(S.textContent).length:0,S.isStreaming||V.isStreaming?"streaming":"done"].join(":")},Rr=Vue.computed(()=>{let S=W.value||[];return[s.activeConversationId||"",U.value||"",Et(S[S.length-1])].join("|")});Vue.watch(()=>[s.currentConversation,P.value.length,n.token],()=>{let S=n.token||"";S!==ne&&(ne=S,ve()),x()},{immediate:!0}),Vue.watch(Rr,Dt),Vue.watch(Vn,S=>{S&&Dt()}),Vue.watch(()=>[s.activeConversationId,U.value],()=>{for(let S of Object.keys(l))delete l[S];for(let S of Object.keys(c))delete c[S];for(let S of Object.keys(d))delete d[S];gs(),Vue.nextTick(vs)});let Qs=Vue.ref(null),Un=0;return t({revealMessage:async S=>S?(Rt(),await Ou({blocks:W.value,messageId:S,collapseStates:d,nextTick:Vue.nextTick,scrollToBlock:(q,pe)=>(Rt(),a.value?.scrollToKey?.(q,pe)),findRow:q=>{let pe=o.value?.querySelectorAll?.("[data-msg-id]")||[];return Array.from(pe).find(Se=>Se?.dataset?.msgId===q)||null},anchorRow:(q,pe,Se,re)=>a.value?.anchorTarget?.(q,Se,re),flashRow:q=>{let pe=++Un;Qs.value=q,setTimeout(()=>{pe===Un&&(Qs.value=null)},1800)}})):!1}),Vue.onMounted(()=>{vs(),o.value&&(o.value.addEventListener("wheel",ms,{passive:!0}),o.value.addEventListener("touchmove",ms,{passive:!0}),o.value.addEventListener("pointerdown",Nn,{passive:!0}),o.value.addEventListener("scroll",Wn)),window.addEventListener("pointerup",hs,{passive:!0}),window.addEventListener("pointercancel",hs,{passive:!0}),window.addEventListener("keydown",Bn)}),Vue.onUnmounted(()=>{o.value&&(o.value.removeEventListener("wheel",ms),o.value.removeEventListener("touchmove",ms),o.value.removeEventListener("pointerdown",Nn),o.value.removeEventListener("scroll",Wn)),window.removeEventListener("pointerup",hs),window.removeEventListener("pointercancel",hs),window.removeEventListener("keydown",Bn),qn(),je&&(clearInterval(je),je=null),et&&(clearTimeout(et),et=null),Ke&&(cancelAnimationFrame(Ke),Ke=null),ze&&(cancelAnimationFrame(ze),ze=null)}),{store:s,containerRef:o,virtualTranscriptRef:a,flashMsgId:Qs,hasStreamingMessage:_e,nowMs:pt,showTypingDots:Mt,showInitialMessagesLoading:De,showSessionLoadingOverlay:We,initialMessagesLoadingText:Ve,previewShowTypingDots:Vn,isPreviewMode:zs,waitingStatus:kr,animationType:Je,catSpeed:Sr,catStyle:Cr,dogPhase:ke,spikeTransform:gr,teddyTransform:mr,leashPathL:hr,leashPathR:Ln,leashOpacityL:vr,leashOpacityR:yr,questionLX:br,questionRX:wr,refreshSession:Ir,onlineAgents:P,welcomeInstallCommand:ue,welcomeLlmCommand:be,welcomeServiceCommand:oe,welcomeSetupLoading:M,welcomeSetupError:B,copyWelcomeCommand:j,turnGroups:he,messageBlocks:W,virtualTranscriptIdentity:$,estimateMessageBlockHeight:v,visibleItemsForBlock:m,collapsedResponsePreviewLines:A,collapsedResponsePreviewSpeaker:w,responseToggleBelongsToItem:y,showBlockResponseToggle:h,toggleMessageTurnResponse:b,responseCollapseLabel:_,turnUiKey:u,assistantTurnActionsExpandedFor:p,setAssistantTurnActionsExpanded:f,toolExpandStates:c,setToolExpanded:g,cardsForRow:N,orphanCards:O,subAgentCardsForRow:J,orphanSubAgentCards:se,useImStyleForUser:R,onClickLoadMore:Wt,onVirtualTranscriptScrollState:Tr,isAtBottom:me,scrollToLatest:_r}}}});function Oi(...e){let t=[];for(let s of e)if(Array.isArray(s))for(let n of s)typeof n!="string"||!n||t.includes(n)||t.push(n);return t}function Wu(e,t,s){let n=t?e?.slashCommandsMap?.[t]:null;return e?.currentView==="yeaft"?Oi(n):Oi(n,s?e?.slashCommandsMap?.[`agent:${s}`]:null,e?.slashCommandsMap?.__preload__)}function Yh(e,t={},s=new Set){if(Kh.has(e)||Object.prototype.hasOwnProperty.call(Hi,e))return"builtin";let n=e.startsWith("/")?e.slice(1):e;return n.startsWith("skill:")||n.startsWith("yeaft-skills:")||s.has(n)&&Object.prototype.hasOwnProperty.call(t||{},n)?"skill":"project"}function Uu(e,t={}){if(Fi[e])return Fi[e];if(Hi[e])return Hi[e];let s=e.startsWith("/")?e.slice(1):e;return t[s]?t[s]:jh(s)}function jh(e){return(e.includes(":")?e.split(":").pop():e).replace(/-/g," ").replace(/^\w/,s=>s.toUpperCase())}function zu(e,t={},s=[]){if(e.length===0)return[];let n=new Set(s.filter(o=>typeof o=="string").map(o=>o.startsWith("/")?o.slice(1):o)),i={};e.forEach((o,a)=>{let l=Yh(o.cmd,o.descriptions||o.dynamicDescriptions||t,n);i[l]||(i[l]=[]),i[l].push({...o,flatIndex:a})});let r=Object.keys(i).sort((o,a)=>(qu[o]??99)-(qu[a]??99));return r.map((o,a)=>({label:Gh[o]||o,items:i[o],isLast:a===r.length-1}))}var Fi,Kh,Nu,Hi,Bu,Gh,qu,Ku=H(()=>{Fi={"/compact":"Compact context","/context":"Show context usage","/cost":"Show token costs","/init":"Reinitialize session","/doctor":"Check health status","/memory":"View/edit memory","/model":"View/switch model","/review":"Code review","/mcp":"MCP server status","/skills":"List available skills","/btw":"Side question (no history)","/insights":"Session insights","/pr-comments":"PR comment review","/release-notes":"Generate release notes","/security-review":"Security review"},Kh=new Set(Object.keys(Fi)),Nu=Object.keys(Fi),Hi={"/low":"Use low reasoning effort for this turn","/medium":"Use medium reasoning effort for this turn","/high":"Use high reasoning effort for this turn","/xhigh":"Use extra-high reasoning effort for this turn","/max":"Use maximum reasoning effort for this turn"},Bu=Object.keys(Hi);Gh={skill:"Skills",builtin:"Built-in",project:"Commands"},qu={skill:0,project:1,builtin:2}});function Jh(e){return!(!e||typeof e!="string"||e.length<1||e.length>40||e.startsWith("_")||Xh.test(e)||Qh.has(e.toLowerCase()))}function qi(e){if(!e||typeof e!="string")return{text:e||"",mentions:[]};let t=new Set;Yu.lastIndex=0;let s;for(;(s=Yu.exec(e))!==null;){let n=s[2];if(Jh(n)&&!t.has(n)&&(t.add(n),t.size>=Zh))break}return{text:e,mentions:Array.from(t)}}var Qh,Yu,Xh,Zh,Jo=H(()=>{Qh=new Set(["all","user","system","everyone"]),Yu=/(^|[\s\p{P}])@([A-Za-z0-9_-]{1,40})(?=$|[\s\p{P}])/gu,Xh=/^[0-9]+$/,Zh=32});function ju(e){let t=typeof e?.vpId=="string"?e.vpId:"";return ea.has(t)?ea.get(t):e?.isStock===!0?"other":"custom"}function os(e){let t=new Map(Ni.map(s=>[s.id,[]]));for(let s of Array.isArray(e)?e:[])!s||typeof s.vpId!="string"||!s.vpId||t.get(ju(s)).push(s);return Ni.map(s=>({id:s.id,labelKey:s.labelKey,vps:t.get(s.id)})).filter(s=>s.vps.length>0)}function An(e){return os(e).flatMap(t=>t.vps)}function Gu(e){let t=new Map(Ni.map(i=>[i.id,i])),s=new Map,n=[];for(let i of Array.isArray(e)?e:[]){if(!i||typeof i.vpId!="string"||!i.vpId)continue;let r=ju(i),o=n[n.length-1];if(o&&o.id===r){o.vps.push(i);continue}let a=(s.get(r)||0)+1;s.set(r,a),n.push({id:r,key:`${r}-${a}`,labelKey:t.get(r).labelKey,vps:[i]})}return n}var ev,Ni,ea,xn=H(()=>{ev=[{id:"general",labelKey:"yeaft.vp.domain.general",vpIds:["omni"]},{id:"productDesign",labelKey:"yeaft.vp.domain.productDesign",vpIds:["steve","dieter","norman"]},{id:"softwareSystems",labelKey:"yeaft.vp.domain.softwareSystems",vpIds:["linus","martin","anders","ada","grace","ken","alan"]},{id:"securityReliability",labelKey:"yeaft.vp.domain.securityReliability",vpIds:["alice","margaret"]},{id:"scienceAnalysis",labelKey:"yeaft.vp.domain.scienceAnalysis",vpIds:["shannon","einstein"]},{id:"philosophyPsychology",labelKey:"yeaft.vp.domain.philosophyPsychology",vpIds:["kongzi","socrates","nietzsche","kahneman","jung"]},{id:"strategyHistory",labelKey:"yeaft.vp.domain.strategyHistory",vpIds:["sunzi","clausewitz","simaqian","harari"]},{id:"businessManagement",labelKey:"yeaft.vp.domain.businessManagement",vpIds:["buffett","munger","dalio","bezos","drucker"]},{id:"artsCulture",labelKey:"yeaft.vp.domain.artsCulture",vpIds:["luxun","sudongpo","borges","kubrick","miyazaki"]},{id:"other",labelKey:"yeaft.vp.domain.other",vpIds:[]},{id:"custom",labelKey:"yeaft.vp.domain.custom",vpIds:[]}],Ni=Object.freeze(ev.map(e=>Object.freeze({id:e.id,labelKey:e.labelKey,vpIds:Object.freeze([...e.vpIds])}))),ea=new Map;for(let e of Ni)for(let t of e.vpIds)ea.set(t,e.id)});function ta(e,t){let s=Array.isArray(e)?e:[],n=typeof t=="string"?t.toLowerCase():"";if(!n){let c=s.filter(d=>d&&d.vpId&&d.vpId!=="user");return An(c).slice(0,Qu)}let i=[],r=[],o=[],a=new Set,l=(c,d)=>{a.has(c.vpId)||(a.add(c.vpId),d.push(c))};for(let c of s){if(!c||!c.vpId||c.vpId==="user")continue;if(String(c.vpId).toLowerCase().startsWith(n)){l(c,i);continue}let u=Array.isArray(c.aliases)?c.aliases:[],p=!1;for(let k of u){let y=String(k||"").toLowerCase();if(y&&y.startsWith(n)){p=!0;break}}if(p){l(c,r);continue}let f=String(c.displayName||"").toLowerCase(),g=String(c.displayNameZh||""),v=[c.description,c.descriptionZh,c.role,c.roleZh].map(k=>String(k||"").toLowerCase()),m=typeof t=="string"?t:"",A=f.includes(n)||m&&g.includes(m),w=n&&v.some(k=>k.includes(n));(A||w)&&l(c,o)}return[...An(i),...An(r),...An(o)].slice(0,Qu)}function sa(e="chat-input"){return`${e}-vp-mention-listbox`}function na(e,t){let s=String(t||"").replace(/[^A-Za-z0-9_.:-]/g,"-");return`${e}-vp-mention-option-${s}`}function tv(e){let t=0;return Gu(e).map(s=>({...s,items:s.vps.map(n=>({vp:n,flatIndex:t++}))}))}function Xu(e,t){let s=Array.isArray(e)?e:[];if(!t)return s;let n=Array.isArray(t.roster)?t.roster:[];if(n.length===0)return[];let i=new Set(n);return s.filter(r=>r&&r.vpId&&i.has(r.vpId))}function Zu(e,t){if(typeof e!="string"||!t)return e;let s=e.lastIndexOf("@");if(s<0)return e;let n=s+1;for(;n<e.length&&!/[\s]/.test(e[n]);)n++;return e.slice(0,s)+"@"+t+" "+e.slice(n)}var Qu,Ju,ep=H(()=>{xn();Qu=12;Ju={name:"VpMentionAutocomplete",emits:["select","hover-index"],props:{vps:{type:Array,default:()=>[]},query:{type:String,default:""},selectedIndex:{type:Number,default:0},inputId:{type:String,required:!0}},template:`
1668
+ `,emits:["new-conversation","resume-conversation","open-settings","quote-message","edit-message-as-new"],setup(e,{expose:t}){let s=Pinia.useChatStore(),n=Me(),i=typeof window<"u"&&window.Pinia?.useVpStore?window.Pinia.useVpStore():null,r=Vue.inject("t",null),o=Vue.ref(null),a=Vue.ref(null),l=Vue.reactive({}),c=Vue.reactive({}),d=Vue.reactive({}),u=S=>String(S?.id||S?.turnId||S?.messageId||S?.atMessageId||S?.message?.id||"turn_unknown"),p=S=>{let V=u(S);return Object.prototype.hasOwnProperty.call(l,V)?!!l[V]:!1},f=(S,V)=>{l[u(S)]=!!V},g=({key:S,value:V}={})=>{S&&(c[S]=!!V)},v=S=>{let V=$u(S,qt);return Number.isFinite(V)?V:qt(S)},m=S=>$i(S),A=S=>{let V=Array.isArray(S?.collapsedResponsePreview)?S.collapsedResponsePreview:Lu(S);return Array.isArray(V)?V:V?[String(V)]:[]},w=S=>{let V=Array.isArray(S?.items)?S.items.find(we=>In(we)):null,q=V?.speakerVpId||V?.vpId||V?.message?.speakerVpId||V?.message?.vpId||S?.vpId||"",pe=q&&i&&typeof i.vpLabel=="function"?i.vpLabel(q)||q:q||(typeof r=="function"?r("message.assistant"):"Assistant"),Se=q&&i&&typeof i.vpTextColor=="function"?{color:i.vpTextColor(q)}:{},re=V?.speakerTimestamp||V?.timestamp||V?.createdAt||V?.message?.timestamp||V?.message?.createdAt||0,Fe="",Be="";if(re)try{let we=new Date(re);Number.isNaN(we.getTime())||(Fe=mt(re),Be=we.toLocaleString())}catch{}return{name:pe,style:Se,timeText:Fe,fullTimeText:Be}},k=S=>{let V=Array.isArray(S?.items)?S.items:[];for(let q=V.length-1;q>=0;q-=1)if(In(V[q]))return V[q];return null},y=(S,V)=>!S?.responseCollapsible||!V?!1:k(S)===V,h=S=>!!(S?.responseCollapsible&&!$i(S).some(V=>y(S,V))),b=S=>{let V=S?.responseCollapseKey;V&&(d[V]=!S.responseCollapsed)},R=S=>{let V=Number(S?.responseCount||0),q=S?.responseCollapsed?"message.showResponses":"message.hideResponses",pe=(typeof r=="function"?r(q):"")||(S?.responseCollapsed?"Show {count} response(s)":"Hide response(s)");return String(pe).replace("{count}",String(V))},L=(()=>{try{return window.Pinia?.useSessionsStore?.()||null}catch{return null}}),U=Vue.computed(()=>{if(s.currentView!=="yeaft")return null;let S=L();if(!S)return null;let V=s.yeaftActiveSessionFilter||null;return V&&typeof S.sessionById=="function"&&S.sessionById(V,s.currentAgent||null)?V:S.activeSessionId&&typeof S.sessionById=="function"&&S.sessionById(S.activeSessionId,s.currentAgent||null)?S.activeSessionId:null}),$=Vue.computed(()=>[s.activeConversationId||"",s.currentView||"",s.currentAgent||"",s.currentView==="yeaft"?s.yeaftActiveSessionFilter||U.value||"__all__":""].join("")),_=Vue.computed(()=>U.value!==null),P=Vue.computed(()=>s.agents.filter(S=>S.online)),T=Vue.ref(null),I=Vue.ref(null),M=Vue.ref(!1),B=Vue.ref(""),F=null,z=0,ne=n.token||"",ve=()=>{T.value=null,I.value=null,B.value="",F=null,z+=1},ue=Ii(),be=Ai(),oe=Vue.computed(()=>xi({profile:T.value,agentSecret:I.value,serverWsUrl:vn(location)})),Ce=()=>{let S={"Content-Type":"application/json"};return n.token&&(S.Authorization=`Bearer ${n.token}`),S},x=async()=>{if(P.value.length>0||s.currentConversation)return;if(I.value||F)return F;M.value=!0,B.value="";let S=++z;return F=(async()=>{let V=n.token||"",q=Ce(),[pe,Se]=await Promise.all([fetch("/api/user/profile",{headers:q}),fetch("/api/user/agent-secret",{headers:q})]),re=pe.ok?await pe.json():null;if(S!==z||V!==(n.token||""))return;if(re&&(T.value=re),!Se.ok){let we="";try{we=(await Se.json())?.error||""}catch{}throw new Error(we||"Failed to load Agent secret")}let Fe=await Se.json();if(S!==z||V!==(n.token||""))return;let Be=Fe?.agentSecret||Fe?.agent_secret||null;I.value=Be&&String(Be).trim()?String(Be):null})().catch(V=>{S===z&&(B.value=V?.message||"Failed to load Agent secret")}).finally(()=>{S===z&&(M.value=!1,F=null)}),F},j=async S=>{if(S)try{await navigator.clipboard.writeText(S)}catch{}},ae=(S,V)=>{let q=S?.message||null,pe=S?.id||S?.atMessageId||q?.id||q?.messageId||`legacy_${V}`,Se=S?.speakerVpId||S?.vpId||q?.speakerVpId||q?.vpId||"";return{id:`message_${Se||"user"}_${pe}_${V}`,vpId:Se,messageId:pe}},he=Vue.computed(()=>{let S=s.messages,V=[],q=null,pe=0,Se=()=>{if(q){q.isActive=!!(q.turnId&&Object.values(s.activeVpTurns||{}).some(st=>((st?.turnId||null)===q.turnId||!st?.turnId&&s.activeVpTurns?.[q.turnId]===st)&&(!s.currentAgent||!st?.agentId||st.agentId===s.currentAgent))),ci(q);let we=!!(q.textContent||q.todoMsg||q.askMsg||q.imageMsgs.length>0),de=q.toolMsgs.length>0||q.toolSummaryCount>0;(we||de)&&(q.showSpeakerHeader=!!q.speakerVpId,V.push(q)),q=null}},re=we=>{if(q){if(!q.speakerVpId){let de=we.speakerVpId||we.vpId;de&&(q.speakerVpId=de,q.speakerTimestamp=typeof we.timestamp=="number"&&we.timestamp>0?we.timestamp:typeof we.createdAt=="number"?we.createdAt:0,typeof we.lastStateChangeCause=="string"&&!q.speakerStateCause&&(q.speakerStateCause=we.lastStateChangeCause))}!q.turnId&&we.turnId&&(q.turnId=we.turnId)}},Fe=()=>{pe++,q={type:"assistant-turn",id:"turn_"+pe,textContent:"",textSegments:[],isStreaming:!1,isActive:!1,isHistory:!1,todoMsg:null,toolMsgs:[],toolSummaryCount:0,imageMsgs:[],askMsg:null,messages:[],atMessageId:null,speakerVpId:null,speakerTimestamp:0,speakerStateCause:"",showSpeakerHeader:!1,turnId:null}},Be=we=>{_u(q,we)&&Se()};for(let we=0;we<S.length;we++){let de=S[we];if(de.type==="user"){if(!de.content||!de.content.trim())continue;Se(),V.push({type:"user",id:de.id||"u_"+we,message:de});continue}if(de.type==="system"||de.type==="error"){Se(),V.push({type:de.type,id:de.id||"s_"+we,message:de});continue}if(!(de.type==="tool-result"||de.type==="tool_result")){if(de.type==="tool-summary"){Be(de),q||Fe(),re(de),de.isHistory&&(q.isHistory=!0),q.toolSummaryCount+=Number(de.count||de.omittedCount||0)||0,q.messages.push(de);continue}if(de.type==="assistant"){Be(de),q||Fe(),li(q,de),de.isStreaming&&(q.isStreaming=!0),de.isHistory&&(q.isHistory=!0),de.id&&/^m\d+$/.test(de.id)&&(q.atMessageId=de.id),re(de),q.messages.push(de);continue}if(de.type==="tool-use"){Be(de),q||Fe(),re(de);let st=S[we+1],Xs=st&&(st.type==="tool-result"||st.type==="tool_result"),Lt={...de,hasResult:Xs||de.hasResult||!1,toolResult:de.toolResult||null};de.isHistory&&(q.isHistory=!0),de.toolName==="TodoWrite"?q.todoMsg=Lt:de.toolName==="AskUserQuestion"?q.askMsg=Lt:q.toolMsgs.push(Lt),q.messages.push(de);continue}if(de.type==="chat-image"){Be(de),q||Fe(),re(de),de.isHistory&&(q.isHistory=!0),q.imageMsgs.push(de),q.messages.push(de);continue}Se(),V.push({type:de.type||"unknown",id:de.id||"x_"+we,message:de})}}return Se(),V}),W=Vue.computed(()=>{let S=[],V=null,q=()=>{V&&S.push(V),V=null};return he.value.forEach((pe,Se)=>{if(!pe||pe.type==="system"||pe.type==="error"){q(),S.push(pe);return}let re=ae(pe,Se);if(pe.type==="user"||!V){q(),V={type:"message-block",id:`turn_${re.messageId}_${Se}`,vpId:re.vpId,messageId:re.messageId,items:[pe]};return}V.items.push(pe),!V.vpId&&re.vpId&&(V.vpId=re.vpId)}),q(),S}),te=Vue.computed(()=>{let S=s.yeaftReflectionCards||{},V=s.yeaftConversationId,q={__orphans:[]},pe=Object.values(S).filter(re=>re&&re.conversationId===V).sort((re,Fe)=>(re.anchorOrder||0)-(Fe.anchorOrder||0)||(re.updatedAt||0)-(Fe.updatedAt||0)),Se=new Set;for(let re of s.messages||[])re&&re.id&&Se.add(re.id);for(let re of pe)re.anchorMsgId&&Se.has(re.anchorMsgId)?(q[re.anchorMsgId]||(q[re.anchorMsgId]=[]),q[re.anchorMsgId].push(re)):q.__orphans.push(re);return q}),Y=S=>S?S.type==="assistant-turn"?S.atMessageId||null:S.message&&S.message.id||null:null,N=S=>{let V=Y(S);return V?(te.value||{})[V]||[]:[]},O=Vue.computed(()=>(te.value||{}).__orphans||[]),E=Vue.computed(()=>{let S=s.yeaftSubAgentCards||{},V=s.yeaftConversationId,q={__orphans:[]},pe=Object.values(S).filter(re=>re&&re.conversationId===V).sort((re,Fe)=>(re.anchorOrder||0)-(Fe.anchorOrder||0)||(re.updatedAt||0)-(Fe.updatedAt||0)),Se=new Set;for(let re of s.messages||[])re&&re.id&&Se.add(re.id);for(let re of pe)re.anchorMsgId&&Se.has(re.anchorMsgId)?(q[re.anchorMsgId]||(q[re.anchorMsgId]=[]),q[re.anchorMsgId].push(re)):q.__orphans.push(re);return q}),J=S=>{let V=Y(S);return V?(E.value||{})[V]||[]:[]},se=Vue.computed(()=>(E.value||{}).__orphans||[]),me=Vue.ref(!0),K=Vue.ref(!1),ee=xt.bottomThreshold,fe=xt.resumeBottomThreshold,le=!0,Re=Vue.computed(()=>s.messages.some(S=>S.isStreaming)),De=Vue.computed(()=>!s.activeConversationId||W.value.length>0?!1:s.currentView==="yeaft"?!!s.yeaftInitialHistoryLoading:!!s.sessionLoading),Ve=Vue.computed(()=>s.currentView==="yeaft"?"":s.sessionLoadingText||""),We=Vue.computed(()=>!!s.sessionLoading&&!De.value),Mt=Vue.computed(()=>s.isProcessing&&!Re.value),pt=Vue.ref(Date.now()),ft=null,Us=()=>{ft||(ft=setInterval(()=>{pt.value=Date.now()},1e3))},bt=()=>{ft&&(clearInterval(ft),ft=null)};Vue.watch(Re,S=>{S?(pt.value=Date.now(),Us()):bt()},{immediate:!0}),Vue.onBeforeUnmount(()=>bt());let He=Vue.ref(0),Ue=Vue.ref(Date.now()),je=null,Ke=null,Je=Vue.ref("cat"),D=new URLSearchParams(window.location.search).get("preview"),Q=Vue.ref(0),ge=Vue.ref(1),ie=Vue.ref(5),ye=Vue.ref(95),ke=Vue.ref("bark-both"),Oe=Vue.ref(1),qe=Vue.ref(-1),ze=null;function Pt(){if(!He.value)return;Ue.value=Date.now();let S=(Ue.value-He.value)%19e3;if(S<4e3)Q.value=0,ge.value=1;else if(S<11500){let V=S-4e3,q;V<2500?q=V/2500*16:V<5e3?q=16+(V-2500)/2500*29:q=45+(V-5e3)/2500*55,Q.value=q,ge.value=1}else S<14e3?(Q.value=(1-(S-11500)/2500)*100,ge.value=-1):(Q.value=0,ge.value=1);Ke=requestAnimationFrame(Pt)}function Rt(){if(!He.value||Je.value!=="dog")return;Ue.value=Date.now();let S=(Ue.value-He.value)%18e3;if(S<2e3)ie.value=5,ye.value=95,ke.value="bark-both",Oe.value=1,qe.value=-1;else if(S<5e3){let V=(S-2e3)/3e3;ie.value=5+V*25,ye.value=95,ke.value="left-approach",Oe.value=1,qe.value=-1}else if(S<8e3){let V=(S-5e3)/3e3;ie.value=30,ye.value=95-V*25,ke.value="right-approach",Oe.value=1,qe.value=-1}else if(S<1e4){let V=(S-8e3)/2e3;ie.value=30+V*13,ye.value=70-V*13,ke.value="both-approach",Oe.value=1,qe.value=-1}else if(S<11e3)ie.value=43,ye.value=57,ke.value="snap",Oe.value=1,qe.value=-1;else if(S<12500)ie.value=43,ye.value=57,ke.value="stunned",Oe.value=1,qe.value=-1;else if(S<15e3){let V=(S-12500)/2500;ie.value=43-V*38,ye.value=57+V*38,ke.value="retreat",Oe.value=-1,qe.value=1}else S<17e3?(ie.value=5,ye.value=95,ke.value="rehang",Oe.value=-1,qe.value=1):(ie.value=5,ye.value=95,ke.value="reset",Oe.value=1,qe.value=-1);ze=requestAnimationFrame(Rt)}let gr=Vue.computed(()=>{let S=ie.value*1.2;return Oe.value<0?`translate(${S+13.5}, 0) scale(-1, 1)`:`translate(${S-13.5}, 0)`}),mr=Vue.computed(()=>{let S=ye.value*1.2;return qe.value>0?`translate(${S-10.5}, 2)`:`translate(${S+10.5}, 2) scale(-1, 1)`}),En=Vue.computed(()=>{let S=ke.value;return S==="bark-both"||S==="left-approach"||S==="right-approach"||S==="both-approach"||S==="reset"}),hr=Vue.computed(()=>{let S=ie.value*1.2,V=10;if(En.value){let Se=Math.max(0,(S-3)*.12);return`M3,18 Q${(3+S)/2},${18+Se} ${S},${V}`}if(ke.value==="rehang")return`M${S},${V} Q${S-3},20 3,18`;let q=Oe.value<0?1:-1,pe=S+q*8;return`M${S},${V} Q${S},18 ${pe},22`}),Ln=Vue.computed(()=>{let S=ye.value*1.2,V=10;if(En.value){let Se=Math.max(0,(118-S)*.12);return`M118,18 Q${(118+S)/2},${18+Se} ${S},${V}`}if(ke.value==="rehang")return`M${S},${V} Q${S+3},20 118,18`;let q=qe.value>0?-1:1,pe=S+q*8;return`M${S},${V} Q${S},18 ${pe},22`}),vr=Vue.computed(()=>ke.value==="snap"?.2:.4),yr=Vue.computed(()=>ke.value==="snap"?.2:.4),br=Vue.computed(()=>ie.value*1.2),wr=Vue.computed(()=>ye.value*1.2),zs=D==="cat"||D==="dog"||D==="animation",$n=600,Ks=Vue.ref(!1),et=null,Vn=Vue.computed(()=>zs?!0:Ks.value);Vue.watch(Mt,S=>{if(S)et&&(clearTimeout(et),et=null),Ks.value=!0,He.value=Date.now(),Ue.value=Date.now(),Je.value="cat",Q.value=0,ge.value=1,ie.value=5,ye.value=95,ke.value="bark-both",Oe.value=1,qe.value=-1,Je.value==="cat"?Ke=requestAnimationFrame(Pt):ze=requestAnimationFrame(Rt);else{let V=He.value?Date.now()-He.value:$n,q=Math.max(0,$n-V),pe=()=>{et=null,Ks.value=!1,He.value=0,Q.value=0,ge.value=1,Ke&&(cancelAnimationFrame(Ke),Ke=null),ze&&(cancelAnimationFrame(ze),ze=null)};q===0?pe():(et&&clearTimeout(et),et=setTimeout(pe,q))}},{immediate:!0}),zs&&(He.value=Date.now(),Ue.value=Date.now(),D==="dog"?Je.value="dog":Je.value="cat",Je.value==="cat"?Ke=requestAnimationFrame(Pt):(ie.value=5,ye.value=95,ke.value="bark-both",Oe.value=1,qe.value=-1,ze=requestAnimationFrame(Rt)));let kr=Vue.computed(()=>{if(!s.isProcessing)return null;if(s.connectionState!=="connected")return"disconnected";let S=s.currentConversation;if(s.compactStatus?.conversationId===S&&s.compactStatus?.status==="compacting")return"compacting";let V=s.sessionHealth?.[S];return V?V.status:He.value&&Ue.value-He.value>8e3?"thinking":null}),Sr=Vue.computed(()=>{if(!He.value)return"speed-napping";let S=(Ue.value-He.value)%19e3;return S>=16e3?"speed-petted":S>=14e3?"speed-tired":S>=11500?"speed-crazy":S>=9e3?"speed-turbo":S>=6500?"speed-fast":S>=4e3?"speed-normal":"speed-napping"}),Cr=Vue.computed(()=>{let S=Q.value,V=ge.value,pe={left:`calc(40px + (100% - 80px) * ${S/100})`};return V<0&&(pe.transform="scaleX(-1)"),pe});function Ir(){let S=s.currentConversation;if(!S)return;let V=s.conversations.find(q=>q.id===S);s.sendWsMessage({type:"refresh_conversation",conversationId:S,agentId:V?.agentId})}let tt=()=>{if(!o.value)return!0;let{scrollTop:S,scrollHeight:V,clientHeight:q}=o.value;return is({scrollTop:S,scrollHeight:V,clientHeight:q,threshold:ee})},ps=(S,V=0,{allowContinuation:q=!1}={})=>{if(S>Iu(V)){le=!0;return}q&&(le=!0),!(!le||!Hn())&&(le=!1,Wt())},Ar=S=>{if(!S)return"";let q=(Array.isArray(S.items)?S.items:[])[0]||null;return[S.type||"",S.messageId||"",S.turnId||"",S.vpId||"",q?.id||"",q?.turnId||"",q?.messageId||""].join(":")},Fn=()=>{let S=W.value||[];return{blockCount:S.length,firstBlockIdentity:Ar(S[0])}},fs=(S,V)=>!S||!V?!1:V.blockCount>S.blockCount||V.firstBlockIdentity!==S.firstBlockIdentity,Ys=S=>{Vue.nextTick(()=>{if(!o.value)return;let V=Fn();fs(S,V)&&ps(o.value.scrollTop||0,o.value.clientHeight||0,{allowContinuation:!0})})},xr=({scrollTop:S,scrollHeight:V,clientHeight:q})=>{let pe=is({scrollTop:S,scrollHeight:V,clientHeight:q,threshold:ee});return me.value=pe,K.value=!pe,pe},gs=()=>{K.value=!1,me.value=!0,a.value?.setBottomFollowEnabled?.(!0)},_t=()=>{K.value=!0,me.value=!1,a.value?.setBottomFollowEnabled?.(!1),a.value?.cancelPendingBottomFollow?.()},Tr=({scrollTop:S,scrollHeight:V,clientHeight:q})=>{let pe=is({scrollTop:S||0,scrollHeight:V||0,clientHeight:q||0,threshold:ee});me.value=Au({following:!K.value,atBottom:pe}),K.value=!me.value,a.value?.setBottomFollowEnabled?.(me.value),wt||(Ut=Number(S||0)),ps(S||0,q||0)},Mr=(S,V)=>{let q=Fn();if(!o.value){S(),Ys(q);return}let pe=o.value.scrollHeight,Se=o.value.scrollTop,re=!1,Fe=null,Be=()=>{re||(re=!0,Fe&&Fe(),Vue.nextTick(()=>{if(!o.value)return;let we=o.value.scrollHeight;o.value.scrollTop=we-pe+Se,Ys(q)}))};V&&(Fe=Vue.watch(V,we=>{we||Be()})),S(),Vue.nextTick(()=>{(!V||!V())&&Be()})},Pr=()=>{if(s.hasHiddenYeaftMessages){s.expandYeaftMessageWindow();return}s.loadMoreYeaftHistory()},Hn=()=>s.currentView==="yeaft"?s.hasHiddenYeaftMessages||s.yeaftHasMoreHistory&&!s.yeaftLoadingMoreHistory&&s.yeaftOldestLoadedSeq!=null:!!s.currentConversation&&s.hasMoreMessages&&!s.loadingMoreMessages,Wt=()=>{if(!Hn())return;let S=s.currentView==="yeaft";Mr(S?Pr:()=>s.loadMoreMessages(),S?()=>s.yeaftLoadingMoreHistory:()=>s.loadingMoreMessages)},wt=!1,js=!1,Ge=null,Ut=0,On=250,qn=()=>{wt=!1,Ge&&(clearTimeout(Ge),Ge=null)},zt=()=>{js||(Ge&&clearTimeout(Ge),Ge=setTimeout(qn,On))},ms=S=>{wt=!0,a.value?.clearTargetAnchor?.(),Ut=Number(o.value?.scrollTop||0),Number(S?.deltaY)<0&&_t(),zt()},Nn=S=>{Tu(S,o.value)&&(js=!0,wt=!0,a.value?.clearTargetAnchor?.(),Ut=Number(o.value?.scrollTop||0),Ge&&(clearTimeout(Ge),Ge=null))},hs=()=>{js=!1,zt()},Bn=S=>{Mu(S,o.value)&&((S.key==="ArrowUp"||S.key==="PageUp"||S.key==="Home")&&_t(),wt=!0,a.value?.clearTargetAnchor?.(),zt())},Wn=()=>{let S=Number(o.value?.scrollTop||0),V=wt?S-Ut:0,q=!K.value;Ut=S;let pe=tt(),Se=is({scrollTop:S,scrollHeight:o.value?.scrollHeight||0,clientHeight:o.value?.clientHeight||0,threshold:fe});me.value=xu({following:q,atBottom:pe,resumeBoundaryReached:Se,direction:V}),K.value=!me.value,a.value?.setBottomFollowEnabled?.(me.value),me.value&&Gs(),wt&&zt(),o.value&&ps(o.value.scrollTop||0,o.value.clientHeight||0)},Gs=()=>{s.currentView==="yeaft"&&s.pruneYeaftMessageWindow()},vs=()=>{o.value&&(o.value.scrollTop=o.value.scrollHeight,gs(),Gs())},Rr=()=>{gs(),Vue.nextTick(vs)},Dt=()=>{!K.value&&me.value&&(Gs(),Vue.nextTick(vs))},Et=S=>{if(!S)return"";if(Array.isArray(S.items))return S.items.map(Et).join(",");let V=S.message||{};return[S.type||"",S.id||"",S.atMessageId||"",S.turnId||"",S.messageId||"",S.speakerVpId||"",V.id||"",V.content?String(V.content).length:0,S.textContent?String(S.textContent).length:0,S.isStreaming||V.isStreaming?"streaming":"done"].join(":")},_r=Vue.computed(()=>{let S=W.value||[];return[s.activeConversationId||"",U.value||"",Et(S[S.length-1])].join("|")});Vue.watch(()=>[s.currentConversation,P.value.length,n.token],()=>{let S=n.token||"";S!==ne&&(ne=S,ve()),x()},{immediate:!0}),Vue.watch(_r,Dt),Vue.watch(Vn,S=>{S&&Dt()}),Vue.watch(()=>[s.activeConversationId,U.value],()=>{for(let S of Object.keys(l))delete l[S];for(let S of Object.keys(c))delete c[S];for(let S of Object.keys(d))delete d[S];gs(),Vue.nextTick(vs)});let Qs=Vue.ref(null),Un=0;return t({revealMessage:async S=>S?(_t(),await Ou({blocks:W.value,messageId:S,collapseStates:d,nextTick:Vue.nextTick,scrollToBlock:(q,pe)=>(_t(),a.value?.scrollToKey?.(q,pe)),findRow:q=>{let pe=o.value?.querySelectorAll?.("[data-msg-id]")||[];return Array.from(pe).find(Se=>Se?.dataset?.msgId===q)||null},anchorRow:(q,pe,Se,re)=>a.value?.anchorTarget?.(q,Se,re),flashRow:q=>{let pe=++Un;Qs.value=q,setTimeout(()=>{pe===Un&&(Qs.value=null)},1800)}})):!1}),Vue.onMounted(()=>{vs(),o.value&&(o.value.addEventListener("wheel",ms,{passive:!0}),o.value.addEventListener("touchmove",ms,{passive:!0}),o.value.addEventListener("pointerdown",Nn,{passive:!0}),o.value.addEventListener("scroll",Wn)),window.addEventListener("pointerup",hs,{passive:!0}),window.addEventListener("pointercancel",hs,{passive:!0}),window.addEventListener("keydown",Bn)}),Vue.onUnmounted(()=>{o.value&&(o.value.removeEventListener("wheel",ms),o.value.removeEventListener("touchmove",ms),o.value.removeEventListener("pointerdown",Nn),o.value.removeEventListener("scroll",Wn)),window.removeEventListener("pointerup",hs),window.removeEventListener("pointercancel",hs),window.removeEventListener("keydown",Bn),qn(),je&&(clearInterval(je),je=null),et&&(clearTimeout(et),et=null),Ke&&(cancelAnimationFrame(Ke),Ke=null),ze&&(cancelAnimationFrame(ze),ze=null)}),{store:s,containerRef:o,virtualTranscriptRef:a,flashMsgId:Qs,hasStreamingMessage:Re,nowMs:pt,showTypingDots:Mt,showInitialMessagesLoading:De,showSessionLoadingOverlay:We,initialMessagesLoadingText:Ve,previewShowTypingDots:Vn,isPreviewMode:zs,waitingStatus:kr,animationType:Je,catSpeed:Sr,catStyle:Cr,dogPhase:ke,spikeTransform:gr,teddyTransform:mr,leashPathL:hr,leashPathR:Ln,leashOpacityL:vr,leashOpacityR:yr,questionLX:br,questionRX:wr,refreshSession:Ir,onlineAgents:P,welcomeInstallCommand:ue,welcomeLlmCommand:be,welcomeServiceCommand:oe,welcomeSetupLoading:M,welcomeSetupError:B,copyWelcomeCommand:j,turnGroups:he,messageBlocks:W,virtualTranscriptIdentity:$,estimateMessageBlockHeight:v,visibleItemsForBlock:m,collapsedResponsePreviewLines:A,collapsedResponsePreviewSpeaker:w,responseToggleBelongsToItem:y,showBlockResponseToggle:h,toggleMessageTurnResponse:b,responseCollapseLabel:R,turnUiKey:u,assistantTurnActionsExpandedFor:p,setAssistantTurnActionsExpanded:f,toolExpandStates:c,setToolExpanded:g,cardsForRow:N,orphanCards:O,subAgentCardsForRow:J,orphanSubAgentCards:se,useImStyleForUser:_,onClickLoadMore:Wt,onVirtualTranscriptScrollState:Tr,isAtBottom:me,scrollToLatest:Rr}}}});function Oi(...e){let t=[];for(let s of e)if(Array.isArray(s))for(let n of s)typeof n!="string"||!n||t.includes(n)||t.push(n);return t}function Wu(e,t,s){let n=t?e?.slashCommandsMap?.[t]:null;return e?.currentView==="yeaft"?Oi(n):Oi(n,s?e?.slashCommandsMap?.[`agent:${s}`]:null,e?.slashCommandsMap?.__preload__)}function Yh(e,t={},s=new Set){if(Kh.has(e)||Object.prototype.hasOwnProperty.call(Hi,e))return"builtin";let n=e.startsWith("/")?e.slice(1):e;return n.startsWith("skill:")||n.startsWith("yeaft-skills:")||s.has(n)&&Object.prototype.hasOwnProperty.call(t||{},n)?"skill":"project"}function Uu(e,t={}){if(Fi[e])return Fi[e];if(Hi[e])return Hi[e];let s=e.startsWith("/")?e.slice(1):e;return t[s]?t[s]:jh(s)}function jh(e){return(e.includes(":")?e.split(":").pop():e).replace(/-/g," ").replace(/^\w/,s=>s.toUpperCase())}function zu(e,t={},s=[]){if(e.length===0)return[];let n=new Set(s.filter(o=>typeof o=="string").map(o=>o.startsWith("/")?o.slice(1):o)),i={};e.forEach((o,a)=>{let l=Yh(o.cmd,o.descriptions||o.dynamicDescriptions||t,n);i[l]||(i[l]=[]),i[l].push({...o,flatIndex:a})});let r=Object.keys(i).sort((o,a)=>(qu[o]??99)-(qu[a]??99));return r.map((o,a)=>({label:Gh[o]||o,items:i[o],isLast:a===r.length-1}))}var Fi,Kh,Nu,Hi,Bu,Gh,qu,Ku=H(()=>{Fi={"/compact":"Compact context","/context":"Show context usage","/cost":"Show token costs","/init":"Reinitialize session","/doctor":"Check health status","/memory":"View/edit memory","/model":"View/switch model","/review":"Code review","/mcp":"MCP server status","/skills":"List available skills","/btw":"Side question (no history)","/insights":"Session insights","/pr-comments":"PR comment review","/release-notes":"Generate release notes","/security-review":"Security review"},Kh=new Set(Object.keys(Fi)),Nu=Object.keys(Fi),Hi={"/low":"Use low reasoning effort for this turn","/medium":"Use medium reasoning effort for this turn","/high":"Use high reasoning effort for this turn","/xhigh":"Use extra-high reasoning effort for this turn","/max":"Use maximum reasoning effort for this turn"},Bu=Object.keys(Hi);Gh={skill:"Skills",builtin:"Built-in",project:"Commands"},qu={skill:0,project:1,builtin:2}});function Jh(e){return!(!e||typeof e!="string"||e.length<1||e.length>40||e.startsWith("_")||Xh.test(e)||Qh.has(e.toLowerCase()))}function qi(e){if(!e||typeof e!="string")return{text:e||"",mentions:[]};let t=new Set;Yu.lastIndex=0;let s;for(;(s=Yu.exec(e))!==null;){let n=s[2];if(Jh(n)&&!t.has(n)&&(t.add(n),t.size>=Zh))break}return{text:e,mentions:Array.from(t)}}var Qh,Yu,Xh,Zh,Jo=H(()=>{Qh=new Set(["all","user","system","everyone"]),Yu=/(^|[\s\p{P}])@([A-Za-z0-9_-]{1,40})(?=$|[\s\p{P}])/gu,Xh=/^[0-9]+$/,Zh=32});function ju(e){let t=typeof e?.vpId=="string"?e.vpId:"";return ea.has(t)?ea.get(t):e?.isStock===!0?"other":"custom"}function os(e){let t=new Map(Ni.map(s=>[s.id,[]]));for(let s of Array.isArray(e)?e:[])!s||typeof s.vpId!="string"||!s.vpId||t.get(ju(s)).push(s);return Ni.map(s=>({id:s.id,labelKey:s.labelKey,vps:t.get(s.id)})).filter(s=>s.vps.length>0)}function An(e){return os(e).flatMap(t=>t.vps)}function Gu(e){let t=new Map(Ni.map(i=>[i.id,i])),s=new Map,n=[];for(let i of Array.isArray(e)?e:[]){if(!i||typeof i.vpId!="string"||!i.vpId)continue;let r=ju(i),o=n[n.length-1];if(o&&o.id===r){o.vps.push(i);continue}let a=(s.get(r)||0)+1;s.set(r,a),n.push({id:r,key:`${r}-${a}`,labelKey:t.get(r).labelKey,vps:[i]})}return n}var ev,Ni,ea,xn=H(()=>{ev=[{id:"general",labelKey:"yeaft.vp.domain.general",vpIds:["omni"]},{id:"productDesign",labelKey:"yeaft.vp.domain.productDesign",vpIds:["steve","dieter","norman"]},{id:"softwareSystems",labelKey:"yeaft.vp.domain.softwareSystems",vpIds:["linus","martin","anders","ada","grace","ken","alan"]},{id:"securityReliability",labelKey:"yeaft.vp.domain.securityReliability",vpIds:["alice","margaret"]},{id:"scienceAnalysis",labelKey:"yeaft.vp.domain.scienceAnalysis",vpIds:["shannon","einstein"]},{id:"philosophyPsychology",labelKey:"yeaft.vp.domain.philosophyPsychology",vpIds:["kongzi","socrates","nietzsche","kahneman","jung"]},{id:"strategyHistory",labelKey:"yeaft.vp.domain.strategyHistory",vpIds:["sunzi","clausewitz","simaqian","harari"]},{id:"businessManagement",labelKey:"yeaft.vp.domain.businessManagement",vpIds:["buffett","munger","dalio","bezos","drucker"]},{id:"artsCulture",labelKey:"yeaft.vp.domain.artsCulture",vpIds:["luxun","sudongpo","borges","kubrick","miyazaki"]},{id:"other",labelKey:"yeaft.vp.domain.other",vpIds:[]},{id:"custom",labelKey:"yeaft.vp.domain.custom",vpIds:[]}],Ni=Object.freeze(ev.map(e=>Object.freeze({id:e.id,labelKey:e.labelKey,vpIds:Object.freeze([...e.vpIds])}))),ea=new Map;for(let e of Ni)for(let t of e.vpIds)ea.set(t,e.id)});function ta(e,t){let s=Array.isArray(e)?e:[],n=typeof t=="string"?t.toLowerCase():"";if(!n){let c=s.filter(d=>d&&d.vpId&&d.vpId!=="user");return An(c).slice(0,Qu)}let i=[],r=[],o=[],a=new Set,l=(c,d)=>{a.has(c.vpId)||(a.add(c.vpId),d.push(c))};for(let c of s){if(!c||!c.vpId||c.vpId==="user")continue;if(String(c.vpId).toLowerCase().startsWith(n)){l(c,i);continue}let u=Array.isArray(c.aliases)?c.aliases:[],p=!1;for(let k of u){let y=String(k||"").toLowerCase();if(y&&y.startsWith(n)){p=!0;break}}if(p){l(c,r);continue}let f=String(c.displayName||"").toLowerCase(),g=String(c.displayNameZh||""),v=[c.description,c.descriptionZh,c.role,c.roleZh].map(k=>String(k||"").toLowerCase()),m=typeof t=="string"?t:"",A=f.includes(n)||m&&g.includes(m),w=n&&v.some(k=>k.includes(n));(A||w)&&l(c,o)}return[...An(i),...An(r),...An(o)].slice(0,Qu)}function sa(e="chat-input"){return`${e}-vp-mention-listbox`}function na(e,t){let s=String(t||"").replace(/[^A-Za-z0-9_.:-]/g,"-");return`${e}-vp-mention-option-${s}`}function tv(e){let t=0;return Gu(e).map(s=>({...s,items:s.vps.map(n=>({vp:n,flatIndex:t++}))}))}function Xu(e,t){let s=Array.isArray(e)?e:[];if(!t)return s;let n=Array.isArray(t.roster)?t.roster:[];if(n.length===0)return[];let i=new Set(n);return s.filter(r=>r&&r.vpId&&i.has(r.vpId))}function Zu(e,t){if(typeof e!="string"||!t)return e;let s=e.lastIndexOf("@");if(s<0)return e;let n=s+1;for(;n<e.length&&!/[\s]/.test(e[n]);)n++;return e.slice(0,s)+"@"+t+" "+e.slice(n)}var Qu,Ju,ep=H(()=>{xn();Qu=12;Ju={name:"VpMentionAutocomplete",emits:["select","hover-index"],props:{vps:{type:Array,default:()=>[]},query:{type:String,default:""},selectedIndex:{type:Number,default:0},inputId:{type:String,required:!0}},template:`
1669
1669
  <div
1670
1670
  class="slash-autocomplete vp-mention-autocomplete"
1671
1671
  v-if="filteredList.length > 0"
@@ -1874,8 +1874,8 @@ ${String(e||"").trim()}
1874
1874
  </button>
1875
1875
  </div>
1876
1876
  </footer>
1877
- `,setup(e,{emit:t}){let s=Pinia.useChatStore(),n=Pinia.useAuthStore(),i=Pinia.useVpStore(),r=Pinia.useSessionsStore?Pinia.useSessionsStore():null,o=Vue.ref(""),a=Vue.ref(null),c=`chat-input-${Vue.getCurrentInstance()?.uid??0}`,d=Vue.ref(null),u=Vue.ref([]),p=Vue.computed(()=>u.value.some(D=>D.uploading)),f=Vue.ref(null),g=Vue.ref(null),v=Vue.ref(null),m=Vue.computed(()=>!!e.sendFn),A=Vue.computed(()=>!s.btwMode),w=Vue.computed(()=>e.placeholderKey||"chatInput.placeholder"),k=Vue.computed(()=>e.showStop||!m.value&&s.isProcessing),y=Vue.computed({get:()=>s.expertSelections||[],set:D=>{s.expertSelections=D}}),h=Vue.ref(!1),b=Vue.ref(0),_=Vue.computed(()=>lc(s.customExpertRoles)),L=Vue.computed(()=>{let D=o.value,Q=D.lastIndexOf("@");if(Q===-1||!h.value)return[];let ge=D.slice(Q+1).toLowerCase();return _.value.filter(ie=>ge?ie.searchText.includes(ge):!0).filter(ie=>!y.value.some(ye=>ye.role===ie.roleId)).slice(0,12)}),U=D=>{if(y.value.length>=Zt)return;let Q={role:D.roleId,action:D.actionId};s.expertSelections=[...y.value,Q];let ge=o.value,ie=ge.lastIndexOf("@");ie!==-1&&(o.value=ge.slice(0,ie).trimEnd()),h.value=!1,Vue.nextTick(()=>a.value?.focus())},$=D=>{let Q=[...y.value];Q.splice(D,1),s.expertSelections=Q},R=D=>Xt(D,s.customExpertRoles),P=D=>D==="completed"?"\u2713":D==="in_progress"?"\u2192":"\u25CB",T=Vue.ref(!1),I=Vue.ref(0),M=()=>s.currentView==="yeaft"&&!!s.currentAgent,B=Vue.computed(()=>{let D=o.value,Q=D.lastIndexOf("@");return Q<0||!T.value?"":D.slice(Q+1)}),F=Vue.computed(()=>{if(!r)return i.vpList||[];let D=s.yeaftActiveSessionFilter||r.activeSessionId||null,Q=typeof r.sessionById=="function"?r.sessionById(D,s.currentAgent||null):r.sessions?.[D];return Xu(i.vpList,Q)}),z=Vue.computed(()=>ta(F.value,B.value)),ne=Vue.computed(()=>!s.btwMode&&T.value&&!h.value&&z.value.length>0),ve=sa(c),ue=Vue.computed(()=>{if(!ne.value)return null;let D=z.value[I.value];return D?na(c,D.vpId):null}),be=D=>{!D||!D.vpId||(o.value=Zu(o.value,D.vpId),T.value=!1,I.value=0,Vue.nextTick(()=>a.value?.focus()))},oe=Vue.computed(()=>e.draftKey||e.conversationId||s.currentConversation||null);oe.value&&s.inputDrafts[oe.value]&&(o.value=s.inputDrafts[oe.value]),Vue.watch(o,D=>{let Q=oe.value;Q&&(D?s.inputDrafts[Q]=D:delete s.inputDrafts[Q])}),Vue.watch(z,D=>{if(D.length===0){I.value=0;return}I.value>=D.length&&(I.value=D.length-1)}),Vue.watch(oe,(D,Q)=>{Q&&o.value&&(s.inputDrafts[Q]=o.value),o.value=D&&s.inputDrafts[D]||""});let Ce=D=>{if(!D||typeof D!="string")return;let Q=o.value||"",ge=Q.length>0&&!/\s$/.test(Q),ie=Q+(ge?" ":"")+"@"+D+" ";o.value=ie,Vue.nextTick(()=>{let ye=a.value;ye&&(ye.focus(),ye.setSelectionRange(ie.length,ie.length),se())})},x=Vue.ref(!1),j=Vue.ref(0),ae=Vue.computed(()=>{let D=e.conversationId||s.activeConversationId||s.currentConversation,Q=s.currentAgent,ge=Wu(s,D,Q),ie=s.currentView==="yeaft"?Bu:Nu;return Oi(ie,ge).map(ke=>ke.startsWith("/")?ke:"/"+ke)}),he=Vue.computed(()=>{let D=o.value.trim();if(!D.startsWith("/"))return[];let Q=D.toLowerCase();return ae.value.filter(ge=>ge.toLowerCase().startsWith(Q)&&ge.toLowerCase()!==Q).map(ge=>({cmd:ge,desc:Uu(ge,s.slashCommandDescriptions)}))}),W=Vue.computed(()=>zu(he.value,s.slashCommandDescriptions,ae.value)),te=Vue.computed(()=>he.value.map(D=>D.cmd)),Y=Vue.computed(()=>e.conversationId||s.activeConversationId||s.currentConversation||null),N=Vue.computed(()=>s.compactStatus?.status==="compacting"&&s.compactStatus?.conversationId===Y.value),O=D=>typeof D?.fileId=="string"&&D.fileId.trim().length>0,E=Vue.computed(()=>{if(N.value)return!1;let D=!!o.value.trim(),Q=u.value.length>0;if(m.value){let Oe=!p.value&&u.value.every(O);return(D||Q)&&Oe}let ge=y.value.length>0,ie=y.value.some(Oe=>Oe.action),ye=D||Q||ge&&(D||ie),ke=!p.value&&u.value.every(O);return ye&&s.currentAgent&&s.currentConversation&&ke}),J=120,se=()=>{let D=a.value;if(!D)return;D.style.height="auto";let Q=Math.min(D.scrollHeight,J);D.style.height=Q+"px",D.style.overflowY=D.scrollHeight>J?"auto":"hidden"},me=()=>{let D=a.value;D&&(D.style.height="auto",D.style.overflowY="hidden")},K=()=>{se();let D=o.value.trim();D.startsWith("/")&&!D.includes(" ")?(x.value=!0,j.value=0,h.value=!1):x.value=!1;let Q=o.value,ge=Q.lastIndexOf("@");if(ge!==-1&&!x.value){let ie=ge>0?Q[ge-1]:" ";ie===" "||ie===`
1878
- `||ge===0?M()?(T.value=!0,I.value=0,h.value=!1):(h.value=!0,b.value=0,T.value=!1):(h.value=!1,T.value=!1)}else ge===-1&&(h.value=!1,T.value=!1)},ee=D=>{o.value=D+" ",x.value=!1,Vue.nextTick(()=>{a.value?.focus()})},fe=()=>{setTimeout(()=>{x.value=!1,h.value=!1,T.value=!1},150)},le=async D=>{let Q=Array.from(D.target.files||[]);Q.length>0&&await ft(Q),D.target.value="",Vue.nextTick(()=>{a.value?.focus()})},_e=async D=>{let Q=D.clipboardData?.items;if(!Q)return;let ge=[];for(let ie of Q)if(ie.kind==="file"){let ye=ie.getAsFile();ye&&ge.push(ye)}ge.length>0&&(D.preventDefault(),await ft(ge))},De=D=>{let Q=String(D||"").toLowerCase();return Q==="image/png"?".png":Q==="image/jpeg"?".jpg":Q==="image/gif"?".gif":Q==="image/webp"?".webp":Q==="image/svg+xml"?".svg":Q==="text/plain"?".txt":Q==="application/json"?".json":""},Ve=(D,Q)=>{let ge=typeof D?.name=="string"?D.name.trim():"";return ge||`${String(D?.type||"").startsWith("image/")?"pasted-image":"pasted-file"}-${Date.now()}-${Q+1}${De(D?.type)}`},We=1,Mt=D=>{let Q=Number(D);return!Number.isFinite(Q)||Q<=0?"":Q<1024?`${Q} B`:Q<1024*1024?`${Math.round(Q/1024)} KB`:`${(Q/(1024*1024)).toFixed(Q<10*1024*1024?1:0)} MB`},pt=async D=>{for(let Q of D)Q.uploading=!0,Q.uploadError=!1;try{let Q=new FormData;for(let qe of D)Q.append("files",qe.file,qe.uploadName);let ge={},ie=n.getActiveToken?.()||n.token||null;ie&&(ge.Authorization=`Bearer ${ie}`);let ye=await fetch("/api/upload",{method:"POST",headers:ge,body:Q});if(!ye.ok)throw new Error("Upload failed");let ke=await ye.json(),Oe=Array.isArray(ke.files)?ke.files:[];for(let[qe,ze]of D.entries()){let Pt=Oe[qe],_t=typeof Pt?.fileId=="string"?Pt.fileId.trim():"";if(!_t)throw new Error("Upload response is incomplete");ze.fileId=_t,ze.uploading=!1,delete ze.uploadName}}catch{for(let ge of D)ge.fileId||(ge.uploading=!1,ge.uploadError=!0)}finally{Vue.nextTick(()=>a.value?.focus())}},ft=async D=>{let Q=[];for(let[ge,ie]of D.entries()){let ye=Ve(ie,ge),ke=Vue.reactive({localId:`attachment-${We++}`,file:ie,name:ye,size:ie.size,uploadName:ye,preview:null,uploading:!1,uploadError:!1,fileId:null});ie.type.startsWith("image/")&&(ke.preview=URL.createObjectURL(ie)),u.value.push(ke),Q.push(ke)}await pt(Q)},Us=async D=>{!D||D.uploading||D.fileId||(D.uploadName=D.name,await pt([D]))},bt=D=>{let Q=u.value[D];Q.preview&&URL.revokeObjectURL(Q.preview),u.value.splice(D,1),Vue.nextTick(()=>{a.value?.focus()})},He=()=>{if(!E.value)return;x.value=!1,h.value=!1,T.value=!1;let D=o.value.trim();if(e.sendFn){let ie=u.value.filter(O).map(ke=>({fileId:ke.fileId,name:ke.name,preview:ke.preview,isImage:ke.file?.type?.startsWith("image/")||!1,mimeType:ke.file?.type||""})),ye=ie.length>0?ie:void 0;e.quote?e.sendFn(D,ye,e.quote):e.sendFn(D,ye),u.value=[],e.quote&&t("quote-consumed"),o.value="",oe.value&&delete s.inputDrafts[oe.value],me();return}if(D==="/btw"||D.startsWith("/btw ")){let ie=D.substring(4).trim();s.enterBtwMode(),ie&&s.sendBtwQuestion(ie),o.value="",oe.value&&delete s.inputDrafts[oe.value],me();return}if(s.btwMode){s.sendBtwQuestion(D),o.value="",oe.value&&delete s.inputDrafts[oe.value],me();return}let Q=u.value.filter(O).map(ie=>({fileId:ie.fileId,name:ie.name,preview:ie.preview,isImage:ie.file?.type?.startsWith("image/")||!1,mimeType:ie.file?.type||""}));if(s.currentView==="yeaft"&&(D||Q.length>0)){let ie=qi(D).mentions,ye=s.yeaftActiveSessionFilter||r?.activeSessionId||"grp_default";s.sendYeaftSessionMessage({groupId:ye,text:D,mentions:ie,attachments:Q}),u.value=[],o.value="",oe.value&&delete s.inputDrafts[oe.value],me();return}let ge=[...y.value];s.sendMessage(o.value.trim(),Q,{expertSelections:ge}),u.value=[],o.value="",s.expertSelections=[],oe.value&&delete s.inputDrafts[oe.value],me()},Ue=D=>{if(!(D.isComposing||D.keyCode===229)){if(D.key==="Escape"&&s.btwMode){D.preventDefault(),s.closeBtw();return}if(T.value){let Q=z.value;if(Q.length>0){if(D.key==="ArrowDown"){D.preventDefault(),I.value=(I.value+1)%Q.length;return}if(D.key==="ArrowUp"){D.preventDefault(),I.value=(I.value-1+Q.length)%Q.length;return}if(D.key==="Tab"||D.key==="Enter"&&!D.shiftKey){D.preventDefault(),be(Q[I.value]);return}}if(D.key==="Escape"){D.preventDefault(),T.value=!1;return}}if(h.value&&L.value.length>0){if(D.key==="ArrowDown"){D.preventDefault(),b.value=(b.value+1)%L.value.length;return}if(D.key==="ArrowUp"){D.preventDefault(),b.value=(b.value-1+L.value.length)%L.value.length;return}if(D.key==="Tab"||D.key==="Enter"&&!D.shiftKey){D.preventDefault(),U(L.value[b.value]);return}if(D.key==="Escape"){D.preventDefault(),h.value=!1;return}}if(x.value&&te.value.length>0){if(D.key==="ArrowDown"){D.preventDefault(),j.value=(j.value+1)%te.value.length;return}if(D.key==="ArrowUp"){D.preventDefault(),j.value=(j.value-1+te.value.length)%te.value.length;return}if(D.key==="Tab"||D.key==="Enter"&&!D.shiftKey){D.preventDefault(),ee(te.value[j.value]);return}if(D.key==="Escape"){D.preventDefault(),x.value=!1;return}}D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),He())}},je=()=>{e.cancelFn?e.cancelFn():s.cancelExecution()},Ke=D=>{o.value=typeof D=="string"?D:"",Vue.nextTick(()=>{se(),a.value?.focus();let Q=o.value.length;a.value?.setSelectionRange(Q,Q)})},Je=()=>Vue.nextTick(()=>a.value?.focus());return{store:s,inputText:o,inputRef:a,inputAreaRef:f,fileInput:d,attachments:u,uploading:p,canSend:E,isCompacting:N,isStopVisible:k,effectivePlaceholderKey:w,attachmentsAllowed:A,showAutocomplete:x,selectedIndex:j,filteredCommands:te,flatItems:he,groupedCommands:W,autocompleteRef:g,sendFn:Vue.toRef(e,"sendFn"),expertSelections:y,showExpertAutocomplete:h,expertSelectedIndex:b,expertAutocompleteFiltered:L,expertAutocompleteRef:v,selectExpertItem:U,removeExpertSelection:$,getExpertLabel:R,todoStatusSymbol:P,autoResize:se,handleInput:K,selectCommand:ee,onBlur:fe,handleFileSelect:le,handlePaste:_e,formatFileSize:Mt,retryAttachment:Us,removeAttachment:bt,send:He,handleKeydown:Ue,cancelExecution:je,vpStore:i,inputElementId:c,showVpAutocomplete:T,vpMentionPopupOpen:ne,vpMentionPopupId:ve,vpMentionActiveOptionId:ue,vpSelectedIndex:I,vpMentionQuery:B,mentionVpCandidates:F,selectVpMention:be,appendMention:Ce,replaceDraft:Ke,focusInput:Je}}}});function ia(e){return new Promise((t,s)=>{if(document.querySelector(`script[src="${e}"]`))return t();let n=document.createElement("script");n.src=e,n.onload=t,n.onerror=s,document.head.appendChild(n)})}function tp(e){return e+":"+Math.random().toString(36).slice(2,8)}function Tn(e){return e?e.type==="pane"?[e.terminalId]:[...Tn(e.first),...Tn(e.second)]:[]}function Ui(e){return e?e.type==="pane"?e.terminalId:Ui(e.first):null}function Wi(e,t,s){return e&&(e.type==="pane"?e.terminalId===t?s:e:{...e,first:Wi(e.first,t,s),second:Wi(e.second,t,s)})}function Nt(e,t){if(!e)return null;if(e.type==="pane")return e.terminalId===t?null:e;if(e.first?.type==="pane"&&e.first.terminalId===t)return e.second;if(e.second?.type==="pane"&&e.second.terminalId===t)return e.first;let s=Nt(e.first,t),n=Nt(e.second,t);return s?n?{...e,first:s,second:n}:s:n}var sp=H(()=>{});var np,ip=H(()=>{np={name:"PaneTree",props:{node:Object,terminals:Object,activePane:String,onActivate:Function,onClosePane:Function,setMountRef:Function},template:`
1877
+ `,setup(e,{emit:t}){let s=Pinia.useChatStore(),n=Pinia.useAuthStore(),i=Pinia.useVpStore(),r=Pinia.useSessionsStore?Pinia.useSessionsStore():null,o=Vue.ref(""),a=Vue.ref(null),c=`chat-input-${Vue.getCurrentInstance()?.uid??0}`,d=Vue.ref(null),u=Vue.ref([]),p=Vue.computed(()=>u.value.some(D=>D.uploading)),f=Vue.ref(null),g=Vue.ref(null),v=Vue.ref(null),m=Vue.computed(()=>!!e.sendFn),A=Vue.computed(()=>!s.btwMode),w=Vue.computed(()=>e.placeholderKey||"chatInput.placeholder"),k=Vue.computed(()=>e.showStop||!m.value&&s.isProcessing),y=Vue.computed({get:()=>s.expertSelections||[],set:D=>{s.expertSelections=D}}),h=Vue.ref(!1),b=Vue.ref(0),R=Vue.computed(()=>lc(s.customExpertRoles)),L=Vue.computed(()=>{let D=o.value,Q=D.lastIndexOf("@");if(Q===-1||!h.value)return[];let ge=D.slice(Q+1).toLowerCase();return R.value.filter(ie=>ge?ie.searchText.includes(ge):!0).filter(ie=>!y.value.some(ye=>ye.role===ie.roleId)).slice(0,12)}),U=D=>{if(y.value.length>=Zt)return;let Q={role:D.roleId,action:D.actionId};s.expertSelections=[...y.value,Q];let ge=o.value,ie=ge.lastIndexOf("@");ie!==-1&&(o.value=ge.slice(0,ie).trimEnd()),h.value=!1,Vue.nextTick(()=>a.value?.focus())},$=D=>{let Q=[...y.value];Q.splice(D,1),s.expertSelections=Q},_=D=>Xt(D,s.customExpertRoles),P=D=>D==="completed"?"\u2713":D==="in_progress"?"\u2192":"\u25CB",T=Vue.ref(!1),I=Vue.ref(0),M=()=>s.currentView==="yeaft"&&!!s.currentAgent,B=Vue.computed(()=>{let D=o.value,Q=D.lastIndexOf("@");return Q<0||!T.value?"":D.slice(Q+1)}),F=Vue.computed(()=>{if(!r)return i.vpList||[];let D=s.yeaftActiveSessionFilter||r.activeSessionId||null,Q=typeof r.sessionById=="function"?r.sessionById(D,s.currentAgent||null):r.sessions?.[D];return Xu(i.vpList,Q)}),z=Vue.computed(()=>ta(F.value,B.value)),ne=Vue.computed(()=>!s.btwMode&&T.value&&!h.value&&z.value.length>0),ve=sa(c),ue=Vue.computed(()=>{if(!ne.value)return null;let D=z.value[I.value];return D?na(c,D.vpId):null}),be=D=>{!D||!D.vpId||(o.value=Zu(o.value,D.vpId),T.value=!1,I.value=0,Vue.nextTick(()=>a.value?.focus()))},oe=Vue.computed(()=>e.draftKey||e.conversationId||s.currentConversation||null);oe.value&&s.inputDrafts[oe.value]&&(o.value=s.inputDrafts[oe.value]),Vue.watch(o,D=>{let Q=oe.value;Q&&(D?s.inputDrafts[Q]=D:delete s.inputDrafts[Q])}),Vue.watch(z,D=>{if(D.length===0){I.value=0;return}I.value>=D.length&&(I.value=D.length-1)}),Vue.watch(oe,(D,Q)=>{Q&&o.value&&(s.inputDrafts[Q]=o.value),o.value=D&&s.inputDrafts[D]||""});let Ce=D=>{if(!D||typeof D!="string")return;let Q=o.value||"",ge=Q.length>0&&!/\s$/.test(Q),ie=Q+(ge?" ":"")+"@"+D+" ";o.value=ie,Vue.nextTick(()=>{let ye=a.value;ye&&(ye.focus(),ye.setSelectionRange(ie.length,ie.length),se())})},x=Vue.ref(!1),j=Vue.ref(0),ae=Vue.computed(()=>{let D=e.conversationId||s.activeConversationId||s.currentConversation,Q=s.currentAgent,ge=Wu(s,D,Q),ie=s.currentView==="yeaft"?Bu:Nu;return Oi(ie,ge).map(ke=>ke.startsWith("/")?ke:"/"+ke)}),he=Vue.computed(()=>{let D=o.value.trim();if(!D.startsWith("/"))return[];let Q=D.toLowerCase();return ae.value.filter(ge=>ge.toLowerCase().startsWith(Q)&&ge.toLowerCase()!==Q).map(ge=>({cmd:ge,desc:Uu(ge,s.slashCommandDescriptions)}))}),W=Vue.computed(()=>zu(he.value,s.slashCommandDescriptions,ae.value)),te=Vue.computed(()=>he.value.map(D=>D.cmd)),Y=Vue.computed(()=>e.conversationId||s.activeConversationId||s.currentConversation||null),N=Vue.computed(()=>s.compactStatus?.status==="compacting"&&s.compactStatus?.conversationId===Y.value),O=D=>typeof D?.fileId=="string"&&D.fileId.trim().length>0,E=Vue.computed(()=>{if(N.value)return!1;let D=!!o.value.trim(),Q=u.value.length>0;if(m.value){let Oe=!p.value&&u.value.every(O);return(D||Q)&&Oe}let ge=y.value.length>0,ie=y.value.some(Oe=>Oe.action),ye=D||Q||ge&&(D||ie),ke=!p.value&&u.value.every(O);return ye&&s.currentAgent&&s.currentConversation&&ke}),J=120,se=()=>{let D=a.value;if(!D)return;D.style.height="auto";let Q=Math.min(D.scrollHeight,J);D.style.height=Q+"px",D.style.overflowY=D.scrollHeight>J?"auto":"hidden"},me=()=>{let D=a.value;D&&(D.style.height="auto",D.style.overflowY="hidden")},K=()=>{se();let D=o.value.trim();D.startsWith("/")&&!D.includes(" ")?(x.value=!0,j.value=0,h.value=!1):x.value=!1;let Q=o.value,ge=Q.lastIndexOf("@");if(ge!==-1&&!x.value){let ie=ge>0?Q[ge-1]:" ";ie===" "||ie===`
1878
+ `||ge===0?M()?(T.value=!0,I.value=0,h.value=!1):(h.value=!0,b.value=0,T.value=!1):(h.value=!1,T.value=!1)}else ge===-1&&(h.value=!1,T.value=!1)},ee=D=>{o.value=D+" ",x.value=!1,Vue.nextTick(()=>{a.value?.focus()})},fe=()=>{setTimeout(()=>{x.value=!1,h.value=!1,T.value=!1},150)},le=async D=>{let Q=Array.from(D.target.files||[]);Q.length>0&&await ft(Q),D.target.value="",Vue.nextTick(()=>{a.value?.focus()})},Re=async D=>{let Q=D.clipboardData?.items;if(!Q)return;let ge=[];for(let ie of Q)if(ie.kind==="file"){let ye=ie.getAsFile();ye&&ge.push(ye)}ge.length>0&&(D.preventDefault(),await ft(ge))},De=D=>{let Q=String(D||"").toLowerCase();return Q==="image/png"?".png":Q==="image/jpeg"?".jpg":Q==="image/gif"?".gif":Q==="image/webp"?".webp":Q==="image/svg+xml"?".svg":Q==="text/plain"?".txt":Q==="application/json"?".json":""},Ve=(D,Q)=>{let ge=typeof D?.name=="string"?D.name.trim():"";return ge||`${String(D?.type||"").startsWith("image/")?"pasted-image":"pasted-file"}-${Date.now()}-${Q+1}${De(D?.type)}`},We=1,Mt=D=>{let Q=Number(D);return!Number.isFinite(Q)||Q<=0?"":Q<1024?`${Q} B`:Q<1024*1024?`${Math.round(Q/1024)} KB`:`${(Q/(1024*1024)).toFixed(Q<10*1024*1024?1:0)} MB`},pt=async D=>{for(let Q of D)Q.uploading=!0,Q.uploadError=!1;try{let Q=new FormData;for(let qe of D)Q.append("files",qe.file,qe.uploadName);let ge={},ie=n.getActiveToken?.()||n.token||null;ie&&(ge.Authorization=`Bearer ${ie}`);let ye=await fetch("/api/upload",{method:"POST",headers:ge,body:Q});if(!ye.ok)throw new Error("Upload failed");let ke=await ye.json(),Oe=Array.isArray(ke.files)?ke.files:[];for(let[qe,ze]of D.entries()){let Pt=Oe[qe],Rt=typeof Pt?.fileId=="string"?Pt.fileId.trim():"";if(!Rt)throw new Error("Upload response is incomplete");ze.fileId=Rt,ze.uploading=!1,delete ze.uploadName}}catch{for(let ge of D)ge.fileId||(ge.uploading=!1,ge.uploadError=!0)}finally{Vue.nextTick(()=>a.value?.focus())}},ft=async D=>{let Q=[];for(let[ge,ie]of D.entries()){let ye=Ve(ie,ge),ke=Vue.reactive({localId:`attachment-${We++}`,file:ie,name:ye,size:ie.size,uploadName:ye,preview:null,uploading:!1,uploadError:!1,fileId:null});ie.type.startsWith("image/")&&(ke.preview=URL.createObjectURL(ie)),u.value.push(ke),Q.push(ke)}await pt(Q)},Us=async D=>{!D||D.uploading||D.fileId||(D.uploadName=D.name,await pt([D]))},bt=D=>{let Q=u.value[D];Q.preview&&URL.revokeObjectURL(Q.preview),u.value.splice(D,1),Vue.nextTick(()=>{a.value?.focus()})},He=()=>{if(!E.value)return;x.value=!1,h.value=!1,T.value=!1;let D=o.value.trim();if(e.sendFn){let ie=u.value.filter(O).map(ke=>({fileId:ke.fileId,name:ke.name,preview:ke.preview,isImage:ke.file?.type?.startsWith("image/")||!1,mimeType:ke.file?.type||""})),ye=ie.length>0?ie:void 0;e.quote?e.sendFn(D,ye,e.quote):e.sendFn(D,ye),u.value=[],e.quote&&t("quote-consumed"),o.value="",oe.value&&delete s.inputDrafts[oe.value],me();return}if(D==="/btw"||D.startsWith("/btw ")){let ie=D.substring(4).trim();s.enterBtwMode(),ie&&s.sendBtwQuestion(ie),o.value="",oe.value&&delete s.inputDrafts[oe.value],me();return}if(s.btwMode){s.sendBtwQuestion(D),o.value="",oe.value&&delete s.inputDrafts[oe.value],me();return}let Q=u.value.filter(O).map(ie=>({fileId:ie.fileId,name:ie.name,preview:ie.preview,isImage:ie.file?.type?.startsWith("image/")||!1,mimeType:ie.file?.type||""}));if(s.currentView==="yeaft"&&(D||Q.length>0)){let ie=qi(D).mentions,ye=s.yeaftActiveSessionFilter||r?.activeSessionId||"grp_default";s.sendYeaftSessionMessage({groupId:ye,text:D,mentions:ie,attachments:Q}),u.value=[],o.value="",oe.value&&delete s.inputDrafts[oe.value],me();return}let ge=[...y.value];s.sendMessage(o.value.trim(),Q,{expertSelections:ge}),u.value=[],o.value="",s.expertSelections=[],oe.value&&delete s.inputDrafts[oe.value],me()},Ue=D=>{if(!(D.isComposing||D.keyCode===229)){if(D.key==="Escape"&&s.btwMode){D.preventDefault(),s.closeBtw();return}if(T.value){let Q=z.value;if(Q.length>0){if(D.key==="ArrowDown"){D.preventDefault(),I.value=(I.value+1)%Q.length;return}if(D.key==="ArrowUp"){D.preventDefault(),I.value=(I.value-1+Q.length)%Q.length;return}if(D.key==="Tab"||D.key==="Enter"&&!D.shiftKey){D.preventDefault(),be(Q[I.value]);return}}if(D.key==="Escape"){D.preventDefault(),T.value=!1;return}}if(h.value&&L.value.length>0){if(D.key==="ArrowDown"){D.preventDefault(),b.value=(b.value+1)%L.value.length;return}if(D.key==="ArrowUp"){D.preventDefault(),b.value=(b.value-1+L.value.length)%L.value.length;return}if(D.key==="Tab"||D.key==="Enter"&&!D.shiftKey){D.preventDefault(),U(L.value[b.value]);return}if(D.key==="Escape"){D.preventDefault(),h.value=!1;return}}if(x.value&&te.value.length>0){if(D.key==="ArrowDown"){D.preventDefault(),j.value=(j.value+1)%te.value.length;return}if(D.key==="ArrowUp"){D.preventDefault(),j.value=(j.value-1+te.value.length)%te.value.length;return}if(D.key==="Tab"||D.key==="Enter"&&!D.shiftKey){D.preventDefault(),ee(te.value[j.value]);return}if(D.key==="Escape"){D.preventDefault(),x.value=!1;return}}D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),He())}},je=()=>{e.cancelFn?e.cancelFn():s.cancelExecution()},Ke=D=>{o.value=typeof D=="string"?D:"",Vue.nextTick(()=>{se(),a.value?.focus();let Q=o.value.length;a.value?.setSelectionRange(Q,Q)})},Je=()=>Vue.nextTick(()=>a.value?.focus());return{store:s,inputText:o,inputRef:a,inputAreaRef:f,fileInput:d,attachments:u,uploading:p,canSend:E,isCompacting:N,isStopVisible:k,effectivePlaceholderKey:w,attachmentsAllowed:A,showAutocomplete:x,selectedIndex:j,filteredCommands:te,flatItems:he,groupedCommands:W,autocompleteRef:g,sendFn:Vue.toRef(e,"sendFn"),expertSelections:y,showExpertAutocomplete:h,expertSelectedIndex:b,expertAutocompleteFiltered:L,expertAutocompleteRef:v,selectExpertItem:U,removeExpertSelection:$,getExpertLabel:_,todoStatusSymbol:P,autoResize:se,handleInput:K,selectCommand:ee,onBlur:fe,handleFileSelect:le,handlePaste:Re,formatFileSize:Mt,retryAttachment:Us,removeAttachment:bt,send:He,handleKeydown:Ue,cancelExecution:je,vpStore:i,inputElementId:c,showVpAutocomplete:T,vpMentionPopupOpen:ne,vpMentionPopupId:ve,vpMentionActiveOptionId:ue,vpSelectedIndex:I,vpMentionQuery:B,mentionVpCandidates:F,selectVpMention:be,appendMention:Ce,replaceDraft:Ke,focusInput:Je}}}});function ia(e){return new Promise((t,s)=>{if(document.querySelector(`script[src="${e}"]`))return t();let n=document.createElement("script");n.src=e,n.onload=t,n.onerror=s,document.head.appendChild(n)})}function tp(e){return e+":"+Math.random().toString(36).slice(2,8)}function Tn(e){return e?e.type==="pane"?[e.terminalId]:[...Tn(e.first),...Tn(e.second)]:[]}function Ui(e){return e?e.type==="pane"?e.terminalId:Ui(e.first):null}function Wi(e,t,s){return e&&(e.type==="pane"?e.terminalId===t?s:e:{...e,first:Wi(e.first,t,s),second:Wi(e.second,t,s)})}function Nt(e,t){if(!e)return null;if(e.type==="pane")return e.terminalId===t?null:e;if(e.first?.type==="pane"&&e.first.terminalId===t)return e.second;if(e.second?.type==="pane"&&e.second.terminalId===t)return e.first;let s=Nt(e.first,t),n=Nt(e.second,t);return s?n?{...e,first:s,second:n}:s:n}var sp=H(()=>{});var np,ip=H(()=>{np={name:"PaneTree",props:{node:Object,terminals:Object,activePane:String,onActivate:Function,onClosePane:Function,setMountRef:Function},template:`
1879
1879
  <div v-if="node.type === 'pane'"
1880
1880
  class="terminal-pane"
1881
1881
  :class="{ active: node.terminalId === activePane }"
@@ -1948,7 +1948,7 @@ ${String(e||"").trim()}
1948
1948
  <div class="placeholder-text">{{ $t('terminal.autoCreate') }}</div>
1949
1949
  </div>
1950
1950
  </div>
1951
- `,setup(){let e=Pinia.useChatStore(),t=Vue.inject("t"),s=Vue.reactive({}),n=Vue.reactive({}),i=Vue.reactive({}),r=Vue.ref(""),o={},a=!1,l=Vue.computed(()=>{let T=e.currentConversation;return T&&n[T]||null}),c=Vue.computed(()=>{let T=e.currentConversation;return T&&i[T]||""}),d=Vue.computed(()=>!!c.value),u=(T,I)=>{if(I){let M=o[T];if(o[T]=I,M&&M!==I){let B=s[T];B?.terminal?.element&&(I.innerHTML="",I.appendChild(B.terminal.element),Vue.nextTick(()=>{try{B.fitAddon?.fit()}catch{}}))}}},p=T=>{let I=e.currentConversation;I&&(i[I]=T)};async function f(){if(a)return!0;let T=typeof Terminal<"u"?Terminal.Terminal||Terminal:null,I=typeof FitAddon<"u"?FitAddon.FitAddon||FitAddon:null;if(!T||!I)try{await ia("vendor/xterm.min.js"),await ia("vendor/xterm-addon-fit.min.js"),T=typeof Terminal<"u"?Terminal.Terminal||Terminal:null,I=typeof FitAddon<"u"?FitAddon.FitAddon||FitAddon:null}catch{}return!T||!I?(r.value=t("terminal.xtermNotLoaded"),!1):(a=!0,!0)}function g(){let T=document.documentElement.getAttribute("data-theme")==="dark",M=getComputedStyle(document.documentElement).getPropertyValue("--bg-main").trim()||(T?"#212121":"#ffffff");return T?{background:M,foreground:"#d4d4d4",cursor:"#a0a0a0",selectionBackground:"rgba(255,255,255,0.12)",black:"#3a3a3a",red:"#f48771",green:"#89d185",yellow:"#e5c07b",blue:"#6cb6ff",magenta:"#d670d6",cyan:"#56d4dd",white:"#cccccc",brightBlack:"#555555",brightRed:"#f48771",brightGreen:"#89d185",brightYellow:"#e5c07b",brightBlue:"#6cb6ff",brightMagenta:"#d670d6",brightCyan:"#56d4dd",brightWhite:"#e8e8e8"}:{background:M,foreground:"#383a42",cursor:"#526fff",selectionBackground:"rgba(0,0,0,0.07)",black:"#383a42",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a1a7",brightBlack:"#4f525e",brightRed:"#e45649",brightGreen:"#50a14f",brightYellow:"#c18401",brightBlue:"#4078f2",brightMagenta:"#a626a4",brightCyan:"#0184bc",brightWhite:"#fafafa"}}async function v(T){if(!T||!e.currentAgent||!await f())return null;let I=tp(T),M=Terminal.Terminal||Terminal,B=FitAddon.FitAddon||FitAddon,F=new M({cursorBlink:!0,fontSize:13,fontFamily:"'SF Mono', 'Fira Code', 'Consolas', monospace, 'Symbols Nerd Font Mono', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'",theme:g(),allowProposedApi:!0}),z=new B;return F.loadAddon(z),F.attachCustomKeyEventHandler(ne=>!((ne.ctrlKey||ne.metaKey)&&ne.key==="v"||(ne.ctrlKey||ne.metaKey)&&ne.key==="c"&&F.hasSelection())),s[I]={created:!0,connected:!1,terminal:F,fitAddon:z},F.onData(ne=>{e.sendWsMessage({type:"terminal_input",agentId:e.currentAgent,conversationId:T,terminalId:I,data:ne,_clientId:e.clientId})}),I}async function m(T,I){let M=s[I];if(!M)return!1;let B=null;for(let F=0;F<10&&(await Vue.nextTick(),B=o[I],!(B||F>=2&&(await new Promise(z=>setTimeout(z,50)),B=o[I],B)));F++);return B?(M.terminal.open(B),M.fitAddon.fit(),e.sendWsMessage({type:"terminal_create",agentId:e.currentAgent,conversationId:T,terminalId:I,cols:M.terminal.cols,rows:M.terminal.rows,_clientId:e.clientId}),!0):(r.value=t("terminal.mountFailed"),M.terminal.dispose(),delete s[I],!1)}let A=!1;async function w(){let T=e.currentConversation;if(!T||!e.currentAgent||n[T]||A)return;A=!0,r.value="";let I=await v(T);if(!I){A=!1;return}n[T]=Vue.reactive({type:"pane",terminalId:I}),i[T]=I,await m(T,I)||(delete n[T],delete i[T]),A=!1}async function k(T){let I=e.currentConversation;if(!I||!i[I])return;let M=i[I],B=await v(I);if(!B)return;let F=Vue.reactive({type:"split",direction:T,ratio:.5,first:{type:"pane",terminalId:M},second:{type:"pane",terminalId:B}}),z=Wi(n[I],M,F);if(n[I]=Vue.reactive(z),i[I]=B,!await m(I,B)){let ve=Nt(n[I],B);ve&&(n[I]=Vue.reactive(ve)),i[I]=M;return}await Vue.nextTick(),b(I)}function y(T){let I=e.currentConversation;if(!I)return;let M=s[T];M&&(e.sendWsMessage({type:"terminal_close",agentId:e.currentAgent,conversationId:I,terminalId:T,_clientId:e.clientId}),M.terminal?.dispose(),delete s[T],delete o[T]);let B=Nt(n[I],T);B?(n[I]=Vue.reactive(B),i[I]===T&&(i[I]=Ui(n[I])||""),Vue.nextTick(()=>b(I))):(delete n[I],delete i[I],Vue.nextTick(()=>w()))}function h(){let T=e.currentConversation;!T||!i[T]||y(i[T])}function b(T){if(T||(T=e.currentConversation),!T||!n[T])return;let I=Tn(n[T]);for(let M of I){let B=s[M];if(B?.fitAddon&&B.connected)try{B.fitAddon.fit(),e.sendWsMessage({type:"terminal_resize",agentId:e.currentAgent,conversationId:T,terminalId:M,cols:B.terminal.cols,rows:B.terminal.rows,_clientId:e.clientId})}catch{}}}function _(T){let I=T.detail;if(I)switch(I.type){case"terminal_created":{let M=I.terminalId||I.conversationId,B=s[M];if(B)if(I.success)B.connected=!0,r.value="";else{r.value=I.error||t("terminal.createFailed"),B.terminal?.dispose(),delete s[M];let F=I.conversationId;if(F&&n[F]){let z=Nt(n[F],M);z?n[F]=Vue.reactive(z):(delete n[F],delete i[F])}}break}case"terminal_output":{let M=I.terminalId||I.conversationId,B=s[M];B?.terminal&&B.terminal.write(I.data);break}case"terminal_closed":{let M=I.terminalId||I.conversationId,B=s[M];if(B){B.terminal?.dispose(),delete s[M],delete o[M];let F=I.conversationId;if(F&&n[F]){let z=Nt(n[F],M);z?(n[F]=Vue.reactive(z),i[F]===M&&(i[F]=Ui(n[F])||"")):(delete n[F],delete i[F])}}break}case"terminal_error":{r.value=I.message||t("terminal.error");let M=I.terminalId;if(M&&s[M]&&!s[M].connected){s[M].terminal?.dispose(),delete s[M];let B=I.conversationId;if(B&&n[B]){let F=Nt(n[B],M);F?n[B]=Vue.reactive(F):(delete n[B],delete i[B])}}break}}}let L=null;function U(){clearTimeout(L),L=setTimeout(()=>b(),100)}function $(){b()}function R(T){let{conversationId:I}=T.detail;if(I&&n[I]){let M=Tn(n[I]);for(let B of M){let F=s[B];F&&(F.terminal?.dispose(),delete s[B],delete o[B])}delete n[I],delete i[I]}}Vue.onMounted(()=>{window.addEventListener("workbench-message",_),window.addEventListener("resize",U),window.addEventListener("terminal-fit-all",$),window.addEventListener("conversation-deleted",R)}),Vue.onUnmounted(()=>{window.removeEventListener("workbench-message",_),window.removeEventListener("resize",U),window.removeEventListener("terminal-fit-all",$),window.removeEventListener("conversation-deleted",R),clearTimeout(L);for(let T of Object.keys(s))s[T]?.terminal?.dispose()}),Vue.watch(()=>[e.currentConversation,e.workbenchExpanded],()=>{Vue.nextTick(()=>{if(!e.currentConversation||!e.workbenchExpanded)return;let I=document.querySelector(".terminal-tab");I&&I.offsetParent!==null&&w()})},{immediate:!0}),Vue.watch(()=>e.connectionState,(T,I)=>{if(T==="connected"&&I&&I!=="connected"){for(let M of Object.keys(s))s[M]?.terminal?.dispose(),delete s[M],delete o[M];for(let M of Object.keys(n))delete n[M],delete i[M];Vue.nextTick(()=>w())}}),Vue.watch(()=>e.currentConversation,()=>{Vue.nextTick(()=>b())});let P=null;return Vue.onMounted(()=>{let T=()=>{let M=document.querySelector(".terminal-tab");M&&M.offsetParent!==null&&(w(),b())};P=new MutationObserver(()=>{setTimeout(T,50)});let I=document.querySelector(".workbench-tab-content");I&&P.observe(I,{attributes:!0,subtree:!0,attributeFilter:["style"]})}),Vue.onUnmounted(()=>{P&&P.disconnect()}),{store:e,terminals:s,currentTree:l,currentActivePane:c,hasActivePane:d,terminalError:r,setMountRef:u,activatePane:p,splitPane:k,closeActivePane:h,closePane:y}}}});function zi(e){if(!e)return Mn(Z.default);let t=e.toLowerCase();if(ra[t])return ra[t]();let s=t.lastIndexOf(".");if(s>=0){let n=t.slice(s+1);if(ap[n])return ap[n]();let i=t;for(let[r,o]of Object.entries(ra))if(i===r||i.endsWith("/"+r))return o()}return Mn(Z.default)}function Ki(e=!1){return sv(Z.folder,e)}var Z,Mn,sv,X,ap,ra,oa=H(()=>{Z={js:"#F1C40F",ts:"#3178C6",jsx:"#61DAFB",tsx:"#3178C6",py:"#3776AB",rb:"#CC342D",go:"#00ADD8",rs:"#DEA584",java:"#E76F00",cs:"#68217A",cpp:"#00599C",c:"#A8B9CC",html:"#E44D26",css:"#1572B6",scss:"#CF649A",less:"#1D365D",json:"#F1C40F",yaml:"#CB171E",xml:"#E44D26",md:"#519ABA",txt:"#8E8E8E",log:"#8E8E8E",sh:"#4EAA25",ps1:"#012456",sql:"#E38C00",svg:"#FFB13B",img:"#26A69A",git:"#F05032",docker:"#2496ED",config:"#6D8086",lock:"#8E8E8E",env:"#ECD53F",vue:"#41B883",react:"#61DAFB",angular:"#DD0031",svelte:"#FF3E00",php:"#777BB4",swift:"#FA7343",kt:"#7F52FF",lua:"#000080",r:"#276DC3",dart:"#00B4AB",liquid:"#67B6E4",folder:"#90A4AE",folderOpen:"#90A4AE",default:"#8E8E8E"},Mn=e=>`<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M14 2H6C4.9 2 4 2.9 4 4v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6z" fill="${e}" opacity="0.85"/><path d="M14 2v6h6" fill="${e}" opacity="0.5"/></svg>`,sv=(e,t)=>t?`<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z" fill="${e}" opacity="0.9"/></svg>`:`<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z" fill="${e}" opacity="0.9"/></svg>`,X=(e,t)=>`<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M14 2H6C4.9 2 4 2.9 4 4v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6z" fill="${e}" opacity="0.2"/><path d="M14 2v6h6" fill="${e}" opacity="0.15"/><path d="M14 2H6C4.9 2 4 2.9 4 4v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6z" stroke="${e}" stroke-width="1.2" fill="none"/><text x="12" y="17" text-anchor="middle" font-size="7" font-weight="700" font-family="system-ui,sans-serif" fill="${e}">${t}</text></svg>`,ap={js:()=>X(Z.js,"JS"),mjs:()=>X(Z.js,"JS"),cjs:()=>X(Z.js,"JS"),ts:()=>X(Z.ts,"TS"),mts:()=>X(Z.ts,"TS"),jsx:()=>X(Z.jsx,"JSX"),tsx:()=>X(Z.tsx,"TSX"),html:()=>X(Z.html,"</>"),htm:()=>X(Z.html,"</>"),css:()=>X(Z.css,"CSS"),scss:()=>X(Z.scss,"SC"),sass:()=>X(Z.scss,"SA"),less:()=>X(Z.less,"LS"),vue:()=>X(Z.vue,"V"),svelte:()=>X(Z.svelte,"SV"),json:()=>X(Z.json,"{ }"),yaml:()=>X(Z.yaml,"YML"),yml:()=>X(Z.yaml,"YML"),toml:()=>X(Z.config,"TML"),xml:()=>X(Z.xml,"</>"),csv:()=>X(Z.config,"CSV"),md:()=>X(Z.md,"MD"),markdown:()=>X(Z.md,"MD"),txt:()=>Mn(Z.txt),log:()=>Mn(Z.log),pdf:()=>X("#E53935","PDF"),py:()=>X(Z.py,"PY"),rb:()=>X(Z.rb,"RB"),go:()=>X(Z.go,"GO"),rs:()=>X(Z.rs,"RS"),java:()=>X(Z.java,"JA"),cs:()=>X(Z.cs,"C#"),cpp:()=>X(Z.cpp,"C+"),cc:()=>X(Z.cpp,"C+"),c:()=>X(Z.c,"C"),h:()=>X(Z.c,"H"),hpp:()=>X(Z.cpp,"H+"),swift:()=>X(Z.swift,"SW"),kt:()=>X(Z.kt,"KT"),php:()=>X(Z.php,"PHP"),lua:()=>X(Z.lua,"LUA"),r:()=>X(Z.r,"R"),dart:()=>X(Z.dart,"DA"),sh:()=>X(Z.sh,">_"),bash:()=>X(Z.sh,">_"),zsh:()=>X(Z.sh,">_"),fish:()=>X(Z.sh,">_"),ps1:()=>X(Z.ps1,"PS"),bat:()=>X(Z.ps1,"BAT"),cmd:()=>X(Z.ps1,"CMD"),sql:()=>X(Z.sql,"SQL"),db:()=>X(Z.sql,"DB"),sqlite:()=>X(Z.sql,"DB"),svg:()=>X(Z.svg,"SVG"),png:()=>X(Z.img,"PNG"),jpg:()=>X(Z.img,"JPG"),jpeg:()=>X(Z.img,"JPG"),gif:()=>X(Z.img,"GIF"),ico:()=>X(Z.img,"ICO"),webp:()=>X(Z.img,"WP"),lock:()=>Mn(Z.lock),env:()=>X(Z.env,"ENV"),ini:()=>X(Z.config,"INI"),cfg:()=>X(Z.config,"CFG"),conf:()=>X(Z.config,"CNF"),liquid:()=>X(Z.liquid,"LQ"),ejs:()=>X(Z.html,"EJS"),hbs:()=>X(Z.html,"HBS"),pug:()=>X(Z.html,"PUG"),wasm:()=>X("#654FF0","WA"),proto:()=>X(Z.config,"PB"),graphql:()=>X("#E535AB","GQL"),gql:()=>X("#E535AB","GQL")},ra={dockerfile:()=>X(Z.docker,"DK"),"docker-compose.yml":()=>X(Z.docker,"DC"),"docker-compose.yaml":()=>X(Z.docker,"DC"),".gitignore":()=>X(Z.git,"GI"),".gitattributes":()=>X(Z.git,"GA"),".gitmodules":()=>X(Z.git,"GM"),".env":()=>X(Z.env,"ENV"),".env.local":()=>X(Z.env,"ENV"),".env.development":()=>X(Z.env,"ENV"),".env.production":()=>X(Z.env,"ENV"),"package.json":()=>X("#CB3837","NPM"),"package-lock.json":()=>X("#CB3837","NPM"),"tsconfig.json":()=>X(Z.ts,"TSC"),eslintrc:()=>X("#4B32C3","ESL"),".eslintrc.js":()=>X("#4B32C3","ESL"),".eslintrc.json":()=>X("#4B32C3","ESL"),".prettierrc":()=>X("#F7B93E","PR"),makefile:()=>X(Z.config,"MK"),"cmakelists.txt":()=>X("#064F8C","CM"),"readme.md":()=>X(Z.md,"RM"),license:()=>X("#F5C518","LIC"),"license.md":()=>X("#F5C518","LIC"),"cargo.toml":()=>X(Z.rs,"CG"),"go.mod":()=>X(Z.go,"MOD"),"go.sum":()=>X(Z.go,"SUM"),gemfile:()=>X(Z.rb,"GEM"),rakefile:()=>X(Z.rb,"RK"),"requirements.txt":()=>X(Z.py,"REQ"),pipfile:()=>X(Z.py,"PIP"),csproj:()=>X(Z.cs,"CSP"),".sln":()=>X(Z.cs,"SLN"),slnx:()=>X(Z.cs,"SLN")}});function as(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function nv(e,t){if(!e||!t)return as(e);let s=[],n=(a,l)=>{if(!a)return;let c=new RegExp(a.source,a.flags),d;for(;(d=c.exec(e))!==null;){let u=d[1]!==void 0?d[1]:d[0],p=d.index+(d[1]!==void 0?d[0].indexOf(d[1]):0);if(s.push({start:p,end:p+u.length,cls:l}),!c.global)break}},i=t.commentType||"slash";if((i==="slash"||i==="both")&&(n(Fs.comment1,xe.comment),n(Fs.commentBlock,xe.comment)),(i==="hash"||i==="both")&&n(Fs.commentHash,xe.comment),i==="html"&&n(t.commentHtml,xe.comment),t.commentLine&&n(t.commentLine,xe.comment),t.commentBlock&&n(t.commentBlock,xe.comment),n(Fs.string,xe.string),n(Fs.number,xe.number),t.keywords&&n(t.keywords,xe.keyword),t.builtins&&n(t.builtins,xe.builtin),t.operators&&n(t.operators,xe.operator),t.decorators&&n(t.decorators,xe.decorator),t.macros&&n(t.macros,xe.macro),t.preprocessor&&n(t.preprocessor,xe.preprocessor),t.attributes&&n(t.attributes,xe.attribute),t.tags&&n(t.tags,xe.tag),t.properties&&n(t.properties,xe.property),t.variables&&n(t.variables,xe.variable),t.headings&&n(t.headings,xe.heading),t.bold&&n(t.bold,xe.bold),t.links&&n(t.links,xe.link),t.keys&&n(t.keys,xe.key),t.sections&&n(t.sections,xe.section),t.selectors&&n(t.selectors,xe.keyword),t.values&&n(t.values,xe.number),t.code&&n(t.code,xe.string),t.italic&&n(t.italic,xe.builtin),t.attrs&&n(t.attrs,xe.attribute),s.length===0)return as(e);s.sort((a,l)=>a.start-l.start||l.end-l.start-(a.end-a.start));let r="",o=0;for(let a of s)a.start<o||(a.start>o&&(r+=as(e.slice(o,a.start))),r+=`<span class="${a.cls}">${as(e.slice(a.start,a.end))}</span>`,o=a.end);return o<e.length&&(r+=as(e.slice(o))),r}function iv(e){if(!e)return null;let t=e.split(".").pop()?.toLowerCase();if(!t)return null;let s=lp[t];return typeof s=="string"&&(s=lp[s]),s||null}function cp(e,t){if(!e)return as(e||"");let s=iv(t);return s?nv(e,s):as(e)}var Fs,lp,xe,dp=H(()=>{Fs={string:/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')|(`(?:[^`\\]|\\.)*`)/g,number:/\b(\d+\.?\d*(?:[eE][+-]?\d+)?|0x[\da-fA-F]+|0b[01]+|0o[0-7]+)\b/g,comment1:/(\/\/.*$)/gm,commentHash:/(#.*$)/gm,commentBlock:/(\/\*.*?\*\/)/g},lp={js:{keywords:/\b(const|let|var|function|class|extends|return|if|else|for|while|do|switch|case|break|continue|new|this|super|import|export|from|default|async|await|yield|try|catch|finally|throw|typeof|instanceof|in|of|delete|void|null|undefined|true|false|NaN|Infinity)\b/g,builtins:/\b(console|window|document|Math|JSON|Array|Object|String|Number|Boolean|Promise|Map|Set|WeakMap|WeakSet|Symbol|Proxy|Reflect|RegExp|Error|Date|parseInt|parseFloat|setTimeout|setInterval|clearTimeout|clearInterval|fetch|require|module|exports|process)\b/g,operators:/(=>|\.\.\.|\?\.|&&|\|\||===|!==|==|!=|>=|<=|>>>=|>>>|>>=|<<=|\+\+|--|[+\-*/%&|^~!<>]=?|\?|:)/g},ts:"js",jsx:"js",tsx:"js",mjs:"js",cjs:"js",vue:"js",py:{keywords:/\b(def|class|return|if|elif|else|for|while|break|continue|pass|import|from|as|with|try|except|finally|raise|yield|lambda|and|or|not|is|in|True|False|None|global|nonlocal|del|assert|async|await)\b/g,builtins:/\b(print|len|range|int|float|str|bool|list|dict|set|tuple|type|isinstance|super|property|staticmethod|classmethod|enumerate|zip|map|filter|sorted|reversed|open|input|hasattr|getattr|setattr|id|hex|oct|bin|abs|max|min|sum|all|any|iter|next)\b/g,decorators:/(@\w+)/g,commentType:"hash"},rb:{keywords:/\b(def|class|module|end|return|if|elsif|else|unless|for|while|until|do|break|next|case|when|begin|rescue|ensure|raise|yield|require|include|extend|attr_accessor|attr_reader|attr_writer|self|super|nil|true|false|and|or|not|then|puts|print)\b/g,commentType:"hash"},go:{keywords:/\b(func|package|import|var|const|type|struct|interface|map|chan|go|select|switch|case|default|if|else|for|range|break|continue|return|defer|fallthrough|nil|true|false|iota)\b/g,builtins:/\b(fmt|make|len|cap|append|copy|delete|close|panic|recover|new|error|string|int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|float32|float64|bool|byte|rune|complex64|complex128)\b/g},rs:{keywords:/\b(fn|let|mut|const|pub|mod|use|struct|enum|impl|trait|where|for|loop|while|if|else|match|return|break|continue|move|ref|self|Self|super|crate|as|in|unsafe|async|await|dyn|true|false|Some|None|Ok|Err)\b/g,builtins:/\b(String|Vec|Box|Rc|Arc|Option|Result|HashMap|HashSet|println|eprintln|format|panic|todo|unimplemented|assert|assert_eq|assert_ne|dbg|cfg|derive|macro_rules)\b/g,macros:/(\w+!)/g},java:{keywords:/\b(class|interface|extends|implements|public|private|protected|static|final|abstract|synchronized|volatile|transient|native|new|return|if|else|for|while|do|switch|case|default|break|continue|try|catch|finally|throw|throws|import|package|this|super|void|null|true|false|instanceof)\b/g,builtins:/\b(System|String|Integer|Long|Double|Float|Boolean|List|ArrayList|Map|HashMap|Set|HashSet|Optional|Stream|Object|Exception|RuntimeException|Thread|Runnable|Override|Deprecated)\b/g},cs:{keywords:/\b(class|struct|interface|enum|record|delegate|event|namespace|using|public|private|protected|internal|static|readonly|const|sealed|abstract|virtual|override|new|return|if|else|for|foreach|while|do|switch|case|default|break|continue|try|catch|finally|throw|async|await|yield|var|dynamic|is|as|in|out|ref|params|this|base|null|true|false|void|get|set|init|required|partial|where|select|from|orderby|group|join|let|into)\b/g,builtins:/\b(Console|String|Int32|Int64|Double|Boolean|List|Dictionary|HashSet|Task|IEnumerable|ILogger|IOptions|IFeatures|Exception|Guid|DateTime|TimeSpan|CancellationToken|Action|Func|Span|Memory|ReadOnlySpan)\b/g,attributes:/(\[[\w]+(?:\(.*?\))?\])/g},cpp:{keywords:/\b(class|struct|enum|union|namespace|using|template|typename|public|private|protected|static|const|constexpr|volatile|virtual|override|final|explicit|inline|extern|auto|decltype|new|delete|return|if|else|for|while|do|switch|case|default|break|continue|try|catch|throw|sizeof|alignof|typeid|static_cast|dynamic_cast|reinterpret_cast|const_cast|nullptr|true|false|void|this|operator|friend|noexcept|co_await|co_yield|co_return|concept|requires)\b/g,builtins:/\b(std|string|vector|map|unordered_map|set|array|pair|tuple|shared_ptr|unique_ptr|weak_ptr|optional|variant|any|cout|cin|endl|printf|scanf|malloc|free|sizeof|size_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t)\b/g,preprocessor:/(#\s*(?:include|define|undef|if|ifdef|ifndef|else|elif|endif|pragma|error|warning).*$)/gm},c:"cpp",h:"cpp",hpp:"cpp",html:{tags:/(<\/?[\w-]+|>|\/>)/g,attrs:/\b([\w-]+)(?==)/g,commentType:"html",commentHtml:/(<!--[\s\S]*?-->)/g},xml:"html",svg:"html",css:{selectors:/([\w.#\[\]:,>+~*-]+)\s*\{/g,properties:/\b([\w-]+)(?=\s*:)/g,values:/:\s*([^;{}]+)/g,commentType:"block"},scss:"css",less:"css",json:{keys:/("[\w.-]+")\s*:/g,commentType:"none"},yaml:{keys:/([\w.-]+)\s*:/g,commentType:"hash"},yml:"yaml",md:{headings:/^(#{1,6}\s.*)$/gm,bold:/(\*\*[^*]+\*\*|__[^_]+__)/g,italic:/(\*[^*]+\*|_[^_]+_)/g,code:/(`[^`]+`)/g,links:/(\[[^\]]+\]\([^)]+\))/g,commentType:"none"},sh:{keywords:/\b(if|then|else|elif|fi|for|while|do|done|case|esac|function|return|exit|echo|export|local|readonly|unset|set|shift|eval|exec|trap|source|alias|cd|pwd|ls|mkdir|rm|cp|mv|cat|grep|sed|awk|find|xargs|sort|uniq|wc|head|tail|tee|cut|tr|test)\b/g,variables:/(\$\{?\w+\}?|\$\(|\$\{)/g,commentType:"hash"},bash:"sh",zsh:"sh",sql:{keywords:/\b(SELECT|FROM|WHERE|AND|OR|NOT|IN|LIKE|BETWEEN|JOIN|LEFT|RIGHT|INNER|OUTER|FULL|ON|AS|GROUP|BY|ORDER|HAVING|LIMIT|OFFSET|INSERT|INTO|VALUES|UPDATE|SET|DELETE|CREATE|ALTER|DROP|TABLE|INDEX|VIEW|TRIGGER|FUNCTION|PROCEDURE|BEGIN|END|IF|ELSE|THEN|CASE|WHEN|DECLARE|EXEC|UNION|ALL|DISTINCT|TOP|EXISTS|NULL|IS|ASC|DESC|PRIMARY|KEY|FOREIGN|REFERENCES|CONSTRAINT|DEFAULT|CHECK|UNIQUE|CASCADE|TRUNCATE|COMMIT|ROLLBACK|GRANT|REVOKE)\b/gi,commentType:"both"},lua:{keywords:/\b(and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/g,builtins:/\b(print|type|tostring|tonumber|pairs|ipairs|next|select|unpack|error|pcall|xpcall|assert|require|table|string|math|io|os|coroutine|setmetatable|getmetatable|rawget|rawset)\b/g,commentLine:/(--(?!\[).*$)/gm,commentBlock:/(--\[\[[\s\S]*?\]\])/g},php:{keywords:/\b(function|class|interface|trait|extends|implements|public|private|protected|static|final|abstract|const|var|new|return|if|else|elseif|for|foreach|while|do|switch|case|default|break|continue|try|catch|finally|throw|use|namespace|require|include|require_once|include_once|echo|print|die|exit|null|true|false|array|list|match|fn|yield|from)\b/g,variables:/(\$\w+)/g},swift:{keywords:/\b(func|class|struct|enum|protocol|extension|let|var|guard|if|else|for|while|repeat|switch|case|default|break|continue|return|throw|try|catch|defer|import|typealias|associatedtype|init|deinit|subscript|operator|precedencegroup|self|Self|super|nil|true|false|is|as|in|inout|throws|rethrows|where|some|any|weak|unowned|lazy|mutating|nonmutating|override|final|required|convenience|optional|dynamic|async|await|actor|nonisolated|isolated|sending|consuming|borrowing)\b/g},kt:{keywords:/\b(fun|class|object|interface|val|var|if|else|when|for|while|do|return|break|continue|throw|try|catch|finally|import|package|as|is|in|out|by|init|constructor|companion|data|sealed|enum|abstract|open|override|private|protected|internal|public|inline|reified|suspend|coroutine|null|true|false|this|super|it|typealias|annotation|lateinit|lazy|get|set)\b/g},dart:{keywords:/\b(class|extends|implements|with|mixin|abstract|sealed|base|interface|final|const|var|late|required|dynamic|void|static|return|if|else|for|while|do|switch|case|default|break|continue|try|catch|finally|throw|rethrow|assert|new|this|super|null|true|false|is|as|in|async|await|yield|import|export|library|part|show|hide|deferred|typedef|enum|extension|on)\b/g},r:{keywords:/\b(if|else|for|while|repeat|function|return|break|next|in|TRUE|FALSE|NULL|NA|Inf|NaN|library|require|source|print|cat|paste|paste0|sprintf|stop|warning|message)\b/g,commentType:"hash"},toml:{keys:/([\w.-]+)\s*=/g,sections:/(\[[\w.]+\])/g,commentType:"hash"},proto:{keywords:/\b(syntax|package|import|option|message|enum|service|rpc|returns|repeated|optional|required|map|oneof|reserved|extensions|extend|group|default|packed|deprecated|java_package|java_outer_classname|optimize_for|cc_enable_arenas|objc_class_prefix|csharp_namespace|swift_prefix|php_class_prefix|php_namespace|ruby_package|string|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|float|double|bool|bytes)\b/g}},xe={keyword:"hl-kw",builtin:"hl-bi",string:"hl-st",number:"hl-nm",comment:"hl-cm",operator:"hl-op",decorator:"hl-dc",macro:"hl-mc",preprocessor:"hl-pp",attribute:"hl-at",tag:"hl-tg",property:"hl-pr",variable:"hl-vr",heading:"hl-hd",bold:"hl-bd",link:"hl-lk",key:"hl-ky",section:"hl-sc"}});function up(e,t,s){let n=[],i=0,r=0;if(t!=null){let f=t.split(`
1951
+ `,setup(){let e=Pinia.useChatStore(),t=Vue.inject("t"),s=Vue.reactive({}),n=Vue.reactive({}),i=Vue.reactive({}),r=Vue.ref(""),o={},a=!1,l=Vue.computed(()=>{let T=e.currentConversation;return T&&n[T]||null}),c=Vue.computed(()=>{let T=e.currentConversation;return T&&i[T]||""}),d=Vue.computed(()=>!!c.value),u=(T,I)=>{if(I){let M=o[T];if(o[T]=I,M&&M!==I){let B=s[T];B?.terminal?.element&&(I.innerHTML="",I.appendChild(B.terminal.element),Vue.nextTick(()=>{try{B.fitAddon?.fit()}catch{}}))}}},p=T=>{let I=e.currentConversation;I&&(i[I]=T)};async function f(){if(a)return!0;let T=typeof Terminal<"u"?Terminal.Terminal||Terminal:null,I=typeof FitAddon<"u"?FitAddon.FitAddon||FitAddon:null;if(!T||!I)try{await ia("vendor/xterm.min.js"),await ia("vendor/xterm-addon-fit.min.js"),T=typeof Terminal<"u"?Terminal.Terminal||Terminal:null,I=typeof FitAddon<"u"?FitAddon.FitAddon||FitAddon:null}catch{}return!T||!I?(r.value=t("terminal.xtermNotLoaded"),!1):(a=!0,!0)}function g(){let T=document.documentElement.getAttribute("data-theme")==="dark",M=getComputedStyle(document.documentElement).getPropertyValue("--bg-main").trim()||(T?"#212121":"#ffffff");return T?{background:M,foreground:"#d4d4d4",cursor:"#a0a0a0",selectionBackground:"rgba(255,255,255,0.12)",black:"#3a3a3a",red:"#f48771",green:"#89d185",yellow:"#e5c07b",blue:"#6cb6ff",magenta:"#d670d6",cyan:"#56d4dd",white:"#cccccc",brightBlack:"#555555",brightRed:"#f48771",brightGreen:"#89d185",brightYellow:"#e5c07b",brightBlue:"#6cb6ff",brightMagenta:"#d670d6",brightCyan:"#56d4dd",brightWhite:"#e8e8e8"}:{background:M,foreground:"#383a42",cursor:"#526fff",selectionBackground:"rgba(0,0,0,0.07)",black:"#383a42",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a1a7",brightBlack:"#4f525e",brightRed:"#e45649",brightGreen:"#50a14f",brightYellow:"#c18401",brightBlue:"#4078f2",brightMagenta:"#a626a4",brightCyan:"#0184bc",brightWhite:"#fafafa"}}async function v(T){if(!T||!e.currentAgent||!await f())return null;let I=tp(T),M=Terminal.Terminal||Terminal,B=FitAddon.FitAddon||FitAddon,F=new M({cursorBlink:!0,fontSize:13,fontFamily:"'SF Mono', 'Fira Code', 'Consolas', monospace, 'Symbols Nerd Font Mono', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'",theme:g(),allowProposedApi:!0}),z=new B;return F.loadAddon(z),F.attachCustomKeyEventHandler(ne=>!((ne.ctrlKey||ne.metaKey)&&ne.key==="v"||(ne.ctrlKey||ne.metaKey)&&ne.key==="c"&&F.hasSelection())),s[I]={created:!0,connected:!1,terminal:F,fitAddon:z},F.onData(ne=>{e.sendWsMessage({type:"terminal_input",agentId:e.currentAgent,conversationId:T,terminalId:I,data:ne,_clientId:e.clientId})}),I}async function m(T,I){let M=s[I];if(!M)return!1;let B=null;for(let F=0;F<10&&(await Vue.nextTick(),B=o[I],!(B||F>=2&&(await new Promise(z=>setTimeout(z,50)),B=o[I],B)));F++);return B?(M.terminal.open(B),M.fitAddon.fit(),e.sendWsMessage({type:"terminal_create",agentId:e.currentAgent,conversationId:T,terminalId:I,cols:M.terminal.cols,rows:M.terminal.rows,_clientId:e.clientId}),!0):(r.value=t("terminal.mountFailed"),M.terminal.dispose(),delete s[I],!1)}let A=!1;async function w(){let T=e.currentConversation;if(!T||!e.currentAgent||n[T]||A)return;A=!0,r.value="";let I=await v(T);if(!I){A=!1;return}n[T]=Vue.reactive({type:"pane",terminalId:I}),i[T]=I,await m(T,I)||(delete n[T],delete i[T]),A=!1}async function k(T){let I=e.currentConversation;if(!I||!i[I])return;let M=i[I],B=await v(I);if(!B)return;let F=Vue.reactive({type:"split",direction:T,ratio:.5,first:{type:"pane",terminalId:M},second:{type:"pane",terminalId:B}}),z=Wi(n[I],M,F);if(n[I]=Vue.reactive(z),i[I]=B,!await m(I,B)){let ve=Nt(n[I],B);ve&&(n[I]=Vue.reactive(ve)),i[I]=M;return}await Vue.nextTick(),b(I)}function y(T){let I=e.currentConversation;if(!I)return;let M=s[T];M&&(e.sendWsMessage({type:"terminal_close",agentId:e.currentAgent,conversationId:I,terminalId:T,_clientId:e.clientId}),M.terminal?.dispose(),delete s[T],delete o[T]);let B=Nt(n[I],T);B?(n[I]=Vue.reactive(B),i[I]===T&&(i[I]=Ui(n[I])||""),Vue.nextTick(()=>b(I))):(delete n[I],delete i[I],Vue.nextTick(()=>w()))}function h(){let T=e.currentConversation;!T||!i[T]||y(i[T])}function b(T){if(T||(T=e.currentConversation),!T||!n[T])return;let I=Tn(n[T]);for(let M of I){let B=s[M];if(B?.fitAddon&&B.connected)try{B.fitAddon.fit(),e.sendWsMessage({type:"terminal_resize",agentId:e.currentAgent,conversationId:T,terminalId:M,cols:B.terminal.cols,rows:B.terminal.rows,_clientId:e.clientId})}catch{}}}function R(T){let I=T.detail;if(I)switch(I.type){case"terminal_created":{let M=I.terminalId||I.conversationId,B=s[M];if(B)if(I.success)B.connected=!0,r.value="";else{r.value=I.error||t("terminal.createFailed"),B.terminal?.dispose(),delete s[M];let F=I.conversationId;if(F&&n[F]){let z=Nt(n[F],M);z?n[F]=Vue.reactive(z):(delete n[F],delete i[F])}}break}case"terminal_output":{let M=I.terminalId||I.conversationId,B=s[M];B?.terminal&&B.terminal.write(I.data);break}case"terminal_closed":{let M=I.terminalId||I.conversationId,B=s[M];if(B){B.terminal?.dispose(),delete s[M],delete o[M];let F=I.conversationId;if(F&&n[F]){let z=Nt(n[F],M);z?(n[F]=Vue.reactive(z),i[F]===M&&(i[F]=Ui(n[F])||"")):(delete n[F],delete i[F])}}break}case"terminal_error":{r.value=I.message||t("terminal.error");let M=I.terminalId;if(M&&s[M]&&!s[M].connected){s[M].terminal?.dispose(),delete s[M];let B=I.conversationId;if(B&&n[B]){let F=Nt(n[B],M);F?n[B]=Vue.reactive(F):(delete n[B],delete i[B])}}break}}}let L=null;function U(){clearTimeout(L),L=setTimeout(()=>b(),100)}function $(){b()}function _(T){let{conversationId:I}=T.detail;if(I&&n[I]){let M=Tn(n[I]);for(let B of M){let F=s[B];F&&(F.terminal?.dispose(),delete s[B],delete o[B])}delete n[I],delete i[I]}}Vue.onMounted(()=>{window.addEventListener("workbench-message",R),window.addEventListener("resize",U),window.addEventListener("terminal-fit-all",$),window.addEventListener("conversation-deleted",_)}),Vue.onUnmounted(()=>{window.removeEventListener("workbench-message",R),window.removeEventListener("resize",U),window.removeEventListener("terminal-fit-all",$),window.removeEventListener("conversation-deleted",_),clearTimeout(L);for(let T of Object.keys(s))s[T]?.terminal?.dispose()}),Vue.watch(()=>[e.currentConversation,e.workbenchExpanded],()=>{Vue.nextTick(()=>{if(!e.currentConversation||!e.workbenchExpanded)return;let I=document.querySelector(".terminal-tab");I&&I.offsetParent!==null&&w()})},{immediate:!0}),Vue.watch(()=>e.connectionState,(T,I)=>{if(T==="connected"&&I&&I!=="connected"){for(let M of Object.keys(s))s[M]?.terminal?.dispose(),delete s[M],delete o[M];for(let M of Object.keys(n))delete n[M],delete i[M];Vue.nextTick(()=>w())}}),Vue.watch(()=>e.currentConversation,()=>{Vue.nextTick(()=>b())});let P=null;return Vue.onMounted(()=>{let T=()=>{let M=document.querySelector(".terminal-tab");M&&M.offsetParent!==null&&(w(),b())};P=new MutationObserver(()=>{setTimeout(T,50)});let I=document.querySelector(".workbench-tab-content");I&&P.observe(I,{attributes:!0,subtree:!0,attributeFilter:["style"]})}),Vue.onUnmounted(()=>{P&&P.disconnect()}),{store:e,terminals:s,currentTree:l,currentActivePane:c,hasActivePane:d,terminalError:r,setMountRef:u,activatePane:p,splitPane:k,closeActivePane:h,closePane:y}}}});function zi(e){if(!e)return Mn(Z.default);let t=e.toLowerCase();if(ra[t])return ra[t]();let s=t.lastIndexOf(".");if(s>=0){let n=t.slice(s+1);if(ap[n])return ap[n]();let i=t;for(let[r,o]of Object.entries(ra))if(i===r||i.endsWith("/"+r))return o()}return Mn(Z.default)}function Ki(e=!1){return sv(Z.folder,e)}var Z,Mn,sv,X,ap,ra,oa=H(()=>{Z={js:"#F1C40F",ts:"#3178C6",jsx:"#61DAFB",tsx:"#3178C6",py:"#3776AB",rb:"#CC342D",go:"#00ADD8",rs:"#DEA584",java:"#E76F00",cs:"#68217A",cpp:"#00599C",c:"#A8B9CC",html:"#E44D26",css:"#1572B6",scss:"#CF649A",less:"#1D365D",json:"#F1C40F",yaml:"#CB171E",xml:"#E44D26",md:"#519ABA",txt:"#8E8E8E",log:"#8E8E8E",sh:"#4EAA25",ps1:"#012456",sql:"#E38C00",svg:"#FFB13B",img:"#26A69A",git:"#F05032",docker:"#2496ED",config:"#6D8086",lock:"#8E8E8E",env:"#ECD53F",vue:"#41B883",react:"#61DAFB",angular:"#DD0031",svelte:"#FF3E00",php:"#777BB4",swift:"#FA7343",kt:"#7F52FF",lua:"#000080",r:"#276DC3",dart:"#00B4AB",liquid:"#67B6E4",folder:"#90A4AE",folderOpen:"#90A4AE",default:"#8E8E8E"},Mn=e=>`<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M14 2H6C4.9 2 4 2.9 4 4v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6z" fill="${e}" opacity="0.85"/><path d="M14 2v6h6" fill="${e}" opacity="0.5"/></svg>`,sv=(e,t)=>t?`<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z" fill="${e}" opacity="0.9"/></svg>`:`<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z" fill="${e}" opacity="0.9"/></svg>`,X=(e,t)=>`<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M14 2H6C4.9 2 4 2.9 4 4v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6z" fill="${e}" opacity="0.2"/><path d="M14 2v6h6" fill="${e}" opacity="0.15"/><path d="M14 2H6C4.9 2 4 2.9 4 4v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6z" stroke="${e}" stroke-width="1.2" fill="none"/><text x="12" y="17" text-anchor="middle" font-size="7" font-weight="700" font-family="system-ui,sans-serif" fill="${e}">${t}</text></svg>`,ap={js:()=>X(Z.js,"JS"),mjs:()=>X(Z.js,"JS"),cjs:()=>X(Z.js,"JS"),ts:()=>X(Z.ts,"TS"),mts:()=>X(Z.ts,"TS"),jsx:()=>X(Z.jsx,"JSX"),tsx:()=>X(Z.tsx,"TSX"),html:()=>X(Z.html,"</>"),htm:()=>X(Z.html,"</>"),css:()=>X(Z.css,"CSS"),scss:()=>X(Z.scss,"SC"),sass:()=>X(Z.scss,"SA"),less:()=>X(Z.less,"LS"),vue:()=>X(Z.vue,"V"),svelte:()=>X(Z.svelte,"SV"),json:()=>X(Z.json,"{ }"),yaml:()=>X(Z.yaml,"YML"),yml:()=>X(Z.yaml,"YML"),toml:()=>X(Z.config,"TML"),xml:()=>X(Z.xml,"</>"),csv:()=>X(Z.config,"CSV"),md:()=>X(Z.md,"MD"),markdown:()=>X(Z.md,"MD"),txt:()=>Mn(Z.txt),log:()=>Mn(Z.log),pdf:()=>X("#E53935","PDF"),py:()=>X(Z.py,"PY"),rb:()=>X(Z.rb,"RB"),go:()=>X(Z.go,"GO"),rs:()=>X(Z.rs,"RS"),java:()=>X(Z.java,"JA"),cs:()=>X(Z.cs,"C#"),cpp:()=>X(Z.cpp,"C+"),cc:()=>X(Z.cpp,"C+"),c:()=>X(Z.c,"C"),h:()=>X(Z.c,"H"),hpp:()=>X(Z.cpp,"H+"),swift:()=>X(Z.swift,"SW"),kt:()=>X(Z.kt,"KT"),php:()=>X(Z.php,"PHP"),lua:()=>X(Z.lua,"LUA"),r:()=>X(Z.r,"R"),dart:()=>X(Z.dart,"DA"),sh:()=>X(Z.sh,">_"),bash:()=>X(Z.sh,">_"),zsh:()=>X(Z.sh,">_"),fish:()=>X(Z.sh,">_"),ps1:()=>X(Z.ps1,"PS"),bat:()=>X(Z.ps1,"BAT"),cmd:()=>X(Z.ps1,"CMD"),sql:()=>X(Z.sql,"SQL"),db:()=>X(Z.sql,"DB"),sqlite:()=>X(Z.sql,"DB"),svg:()=>X(Z.svg,"SVG"),png:()=>X(Z.img,"PNG"),jpg:()=>X(Z.img,"JPG"),jpeg:()=>X(Z.img,"JPG"),gif:()=>X(Z.img,"GIF"),ico:()=>X(Z.img,"ICO"),webp:()=>X(Z.img,"WP"),lock:()=>Mn(Z.lock),env:()=>X(Z.env,"ENV"),ini:()=>X(Z.config,"INI"),cfg:()=>X(Z.config,"CFG"),conf:()=>X(Z.config,"CNF"),liquid:()=>X(Z.liquid,"LQ"),ejs:()=>X(Z.html,"EJS"),hbs:()=>X(Z.html,"HBS"),pug:()=>X(Z.html,"PUG"),wasm:()=>X("#654FF0","WA"),proto:()=>X(Z.config,"PB"),graphql:()=>X("#E535AB","GQL"),gql:()=>X("#E535AB","GQL")},ra={dockerfile:()=>X(Z.docker,"DK"),"docker-compose.yml":()=>X(Z.docker,"DC"),"docker-compose.yaml":()=>X(Z.docker,"DC"),".gitignore":()=>X(Z.git,"GI"),".gitattributes":()=>X(Z.git,"GA"),".gitmodules":()=>X(Z.git,"GM"),".env":()=>X(Z.env,"ENV"),".env.local":()=>X(Z.env,"ENV"),".env.development":()=>X(Z.env,"ENV"),".env.production":()=>X(Z.env,"ENV"),"package.json":()=>X("#CB3837","NPM"),"package-lock.json":()=>X("#CB3837","NPM"),"tsconfig.json":()=>X(Z.ts,"TSC"),eslintrc:()=>X("#4B32C3","ESL"),".eslintrc.js":()=>X("#4B32C3","ESL"),".eslintrc.json":()=>X("#4B32C3","ESL"),".prettierrc":()=>X("#F7B93E","PR"),makefile:()=>X(Z.config,"MK"),"cmakelists.txt":()=>X("#064F8C","CM"),"readme.md":()=>X(Z.md,"RM"),license:()=>X("#F5C518","LIC"),"license.md":()=>X("#F5C518","LIC"),"cargo.toml":()=>X(Z.rs,"CG"),"go.mod":()=>X(Z.go,"MOD"),"go.sum":()=>X(Z.go,"SUM"),gemfile:()=>X(Z.rb,"GEM"),rakefile:()=>X(Z.rb,"RK"),"requirements.txt":()=>X(Z.py,"REQ"),pipfile:()=>X(Z.py,"PIP"),csproj:()=>X(Z.cs,"CSP"),".sln":()=>X(Z.cs,"SLN"),slnx:()=>X(Z.cs,"SLN")}});function as(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function nv(e,t){if(!e||!t)return as(e);let s=[],n=(a,l)=>{if(!a)return;let c=new RegExp(a.source,a.flags),d;for(;(d=c.exec(e))!==null;){let u=d[1]!==void 0?d[1]:d[0],p=d.index+(d[1]!==void 0?d[0].indexOf(d[1]):0);if(s.push({start:p,end:p+u.length,cls:l}),!c.global)break}},i=t.commentType||"slash";if((i==="slash"||i==="both")&&(n(Fs.comment1,xe.comment),n(Fs.commentBlock,xe.comment)),(i==="hash"||i==="both")&&n(Fs.commentHash,xe.comment),i==="html"&&n(t.commentHtml,xe.comment),t.commentLine&&n(t.commentLine,xe.comment),t.commentBlock&&n(t.commentBlock,xe.comment),n(Fs.string,xe.string),n(Fs.number,xe.number),t.keywords&&n(t.keywords,xe.keyword),t.builtins&&n(t.builtins,xe.builtin),t.operators&&n(t.operators,xe.operator),t.decorators&&n(t.decorators,xe.decorator),t.macros&&n(t.macros,xe.macro),t.preprocessor&&n(t.preprocessor,xe.preprocessor),t.attributes&&n(t.attributes,xe.attribute),t.tags&&n(t.tags,xe.tag),t.properties&&n(t.properties,xe.property),t.variables&&n(t.variables,xe.variable),t.headings&&n(t.headings,xe.heading),t.bold&&n(t.bold,xe.bold),t.links&&n(t.links,xe.link),t.keys&&n(t.keys,xe.key),t.sections&&n(t.sections,xe.section),t.selectors&&n(t.selectors,xe.keyword),t.values&&n(t.values,xe.number),t.code&&n(t.code,xe.string),t.italic&&n(t.italic,xe.builtin),t.attrs&&n(t.attrs,xe.attribute),s.length===0)return as(e);s.sort((a,l)=>a.start-l.start||l.end-l.start-(a.end-a.start));let r="",o=0;for(let a of s)a.start<o||(a.start>o&&(r+=as(e.slice(o,a.start))),r+=`<span class="${a.cls}">${as(e.slice(a.start,a.end))}</span>`,o=a.end);return o<e.length&&(r+=as(e.slice(o))),r}function iv(e){if(!e)return null;let t=e.split(".").pop()?.toLowerCase();if(!t)return null;let s=lp[t];return typeof s=="string"&&(s=lp[s]),s||null}function cp(e,t){if(!e)return as(e||"");let s=iv(t);return s?nv(e,s):as(e)}var Fs,lp,xe,dp=H(()=>{Fs={string:/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')|(`(?:[^`\\]|\\.)*`)/g,number:/\b(\d+\.?\d*(?:[eE][+-]?\d+)?|0x[\da-fA-F]+|0b[01]+|0o[0-7]+)\b/g,comment1:/(\/\/.*$)/gm,commentHash:/(#.*$)/gm,commentBlock:/(\/\*.*?\*\/)/g},lp={js:{keywords:/\b(const|let|var|function|class|extends|return|if|else|for|while|do|switch|case|break|continue|new|this|super|import|export|from|default|async|await|yield|try|catch|finally|throw|typeof|instanceof|in|of|delete|void|null|undefined|true|false|NaN|Infinity)\b/g,builtins:/\b(console|window|document|Math|JSON|Array|Object|String|Number|Boolean|Promise|Map|Set|WeakMap|WeakSet|Symbol|Proxy|Reflect|RegExp|Error|Date|parseInt|parseFloat|setTimeout|setInterval|clearTimeout|clearInterval|fetch|require|module|exports|process)\b/g,operators:/(=>|\.\.\.|\?\.|&&|\|\||===|!==|==|!=|>=|<=|>>>=|>>>|>>=|<<=|\+\+|--|[+\-*/%&|^~!<>]=?|\?|:)/g},ts:"js",jsx:"js",tsx:"js",mjs:"js",cjs:"js",vue:"js",py:{keywords:/\b(def|class|return|if|elif|else|for|while|break|continue|pass|import|from|as|with|try|except|finally|raise|yield|lambda|and|or|not|is|in|True|False|None|global|nonlocal|del|assert|async|await)\b/g,builtins:/\b(print|len|range|int|float|str|bool|list|dict|set|tuple|type|isinstance|super|property|staticmethod|classmethod|enumerate|zip|map|filter|sorted|reversed|open|input|hasattr|getattr|setattr|id|hex|oct|bin|abs|max|min|sum|all|any|iter|next)\b/g,decorators:/(@\w+)/g,commentType:"hash"},rb:{keywords:/\b(def|class|module|end|return|if|elsif|else|unless|for|while|until|do|break|next|case|when|begin|rescue|ensure|raise|yield|require|include|extend|attr_accessor|attr_reader|attr_writer|self|super|nil|true|false|and|or|not|then|puts|print)\b/g,commentType:"hash"},go:{keywords:/\b(func|package|import|var|const|type|struct|interface|map|chan|go|select|switch|case|default|if|else|for|range|break|continue|return|defer|fallthrough|nil|true|false|iota)\b/g,builtins:/\b(fmt|make|len|cap|append|copy|delete|close|panic|recover|new|error|string|int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|float32|float64|bool|byte|rune|complex64|complex128)\b/g},rs:{keywords:/\b(fn|let|mut|const|pub|mod|use|struct|enum|impl|trait|where|for|loop|while|if|else|match|return|break|continue|move|ref|self|Self|super|crate|as|in|unsafe|async|await|dyn|true|false|Some|None|Ok|Err)\b/g,builtins:/\b(String|Vec|Box|Rc|Arc|Option|Result|HashMap|HashSet|println|eprintln|format|panic|todo|unimplemented|assert|assert_eq|assert_ne|dbg|cfg|derive|macro_rules)\b/g,macros:/(\w+!)/g},java:{keywords:/\b(class|interface|extends|implements|public|private|protected|static|final|abstract|synchronized|volatile|transient|native|new|return|if|else|for|while|do|switch|case|default|break|continue|try|catch|finally|throw|throws|import|package|this|super|void|null|true|false|instanceof)\b/g,builtins:/\b(System|String|Integer|Long|Double|Float|Boolean|List|ArrayList|Map|HashMap|Set|HashSet|Optional|Stream|Object|Exception|RuntimeException|Thread|Runnable|Override|Deprecated)\b/g},cs:{keywords:/\b(class|struct|interface|enum|record|delegate|event|namespace|using|public|private|protected|internal|static|readonly|const|sealed|abstract|virtual|override|new|return|if|else|for|foreach|while|do|switch|case|default|break|continue|try|catch|finally|throw|async|await|yield|var|dynamic|is|as|in|out|ref|params|this|base|null|true|false|void|get|set|init|required|partial|where|select|from|orderby|group|join|let|into)\b/g,builtins:/\b(Console|String|Int32|Int64|Double|Boolean|List|Dictionary|HashSet|Task|IEnumerable|ILogger|IOptions|IFeatures|Exception|Guid|DateTime|TimeSpan|CancellationToken|Action|Func|Span|Memory|ReadOnlySpan)\b/g,attributes:/(\[[\w]+(?:\(.*?\))?\])/g},cpp:{keywords:/\b(class|struct|enum|union|namespace|using|template|typename|public|private|protected|static|const|constexpr|volatile|virtual|override|final|explicit|inline|extern|auto|decltype|new|delete|return|if|else|for|while|do|switch|case|default|break|continue|try|catch|throw|sizeof|alignof|typeid|static_cast|dynamic_cast|reinterpret_cast|const_cast|nullptr|true|false|void|this|operator|friend|noexcept|co_await|co_yield|co_return|concept|requires)\b/g,builtins:/\b(std|string|vector|map|unordered_map|set|array|pair|tuple|shared_ptr|unique_ptr|weak_ptr|optional|variant|any|cout|cin|endl|printf|scanf|malloc|free|sizeof|size_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t)\b/g,preprocessor:/(#\s*(?:include|define|undef|if|ifdef|ifndef|else|elif|endif|pragma|error|warning).*$)/gm},c:"cpp",h:"cpp",hpp:"cpp",html:{tags:/(<\/?[\w-]+|>|\/>)/g,attrs:/\b([\w-]+)(?==)/g,commentType:"html",commentHtml:/(<!--[\s\S]*?-->)/g},xml:"html",svg:"html",css:{selectors:/([\w.#\[\]:,>+~*-]+)\s*\{/g,properties:/\b([\w-]+)(?=\s*:)/g,values:/:\s*([^;{}]+)/g,commentType:"block"},scss:"css",less:"css",json:{keys:/("[\w.-]+")\s*:/g,commentType:"none"},yaml:{keys:/([\w.-]+)\s*:/g,commentType:"hash"},yml:"yaml",md:{headings:/^(#{1,6}\s.*)$/gm,bold:/(\*\*[^*]+\*\*|__[^_]+__)/g,italic:/(\*[^*]+\*|_[^_]+_)/g,code:/(`[^`]+`)/g,links:/(\[[^\]]+\]\([^)]+\))/g,commentType:"none"},sh:{keywords:/\b(if|then|else|elif|fi|for|while|do|done|case|esac|function|return|exit|echo|export|local|readonly|unset|set|shift|eval|exec|trap|source|alias|cd|pwd|ls|mkdir|rm|cp|mv|cat|grep|sed|awk|find|xargs|sort|uniq|wc|head|tail|tee|cut|tr|test)\b/g,variables:/(\$\{?\w+\}?|\$\(|\$\{)/g,commentType:"hash"},bash:"sh",zsh:"sh",sql:{keywords:/\b(SELECT|FROM|WHERE|AND|OR|NOT|IN|LIKE|BETWEEN|JOIN|LEFT|RIGHT|INNER|OUTER|FULL|ON|AS|GROUP|BY|ORDER|HAVING|LIMIT|OFFSET|INSERT|INTO|VALUES|UPDATE|SET|DELETE|CREATE|ALTER|DROP|TABLE|INDEX|VIEW|TRIGGER|FUNCTION|PROCEDURE|BEGIN|END|IF|ELSE|THEN|CASE|WHEN|DECLARE|EXEC|UNION|ALL|DISTINCT|TOP|EXISTS|NULL|IS|ASC|DESC|PRIMARY|KEY|FOREIGN|REFERENCES|CONSTRAINT|DEFAULT|CHECK|UNIQUE|CASCADE|TRUNCATE|COMMIT|ROLLBACK|GRANT|REVOKE)\b/gi,commentType:"both"},lua:{keywords:/\b(and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/g,builtins:/\b(print|type|tostring|tonumber|pairs|ipairs|next|select|unpack|error|pcall|xpcall|assert|require|table|string|math|io|os|coroutine|setmetatable|getmetatable|rawget|rawset)\b/g,commentLine:/(--(?!\[).*$)/gm,commentBlock:/(--\[\[[\s\S]*?\]\])/g},php:{keywords:/\b(function|class|interface|trait|extends|implements|public|private|protected|static|final|abstract|const|var|new|return|if|else|elseif|for|foreach|while|do|switch|case|default|break|continue|try|catch|finally|throw|use|namespace|require|include|require_once|include_once|echo|print|die|exit|null|true|false|array|list|match|fn|yield|from)\b/g,variables:/(\$\w+)/g},swift:{keywords:/\b(func|class|struct|enum|protocol|extension|let|var|guard|if|else|for|while|repeat|switch|case|default|break|continue|return|throw|try|catch|defer|import|typealias|associatedtype|init|deinit|subscript|operator|precedencegroup|self|Self|super|nil|true|false|is|as|in|inout|throws|rethrows|where|some|any|weak|unowned|lazy|mutating|nonmutating|override|final|required|convenience|optional|dynamic|async|await|actor|nonisolated|isolated|sending|consuming|borrowing)\b/g},kt:{keywords:/\b(fun|class|object|interface|val|var|if|else|when|for|while|do|return|break|continue|throw|try|catch|finally|import|package|as|is|in|out|by|init|constructor|companion|data|sealed|enum|abstract|open|override|private|protected|internal|public|inline|reified|suspend|coroutine|null|true|false|this|super|it|typealias|annotation|lateinit|lazy|get|set)\b/g},dart:{keywords:/\b(class|extends|implements|with|mixin|abstract|sealed|base|interface|final|const|var|late|required|dynamic|void|static|return|if|else|for|while|do|switch|case|default|break|continue|try|catch|finally|throw|rethrow|assert|new|this|super|null|true|false|is|as|in|async|await|yield|import|export|library|part|show|hide|deferred|typedef|enum|extension|on)\b/g},r:{keywords:/\b(if|else|for|while|repeat|function|return|break|next|in|TRUE|FALSE|NULL|NA|Inf|NaN|library|require|source|print|cat|paste|paste0|sprintf|stop|warning|message)\b/g,commentType:"hash"},toml:{keys:/([\w.-]+)\s*=/g,sections:/(\[[\w.]+\])/g,commentType:"hash"},proto:{keywords:/\b(syntax|package|import|option|message|enum|service|rpc|returns|repeated|optional|required|map|oneof|reserved|extensions|extend|group|default|packed|deprecated|java_package|java_outer_classname|optimize_for|cc_enable_arenas|objc_class_prefix|csharp_namespace|swift_prefix|php_class_prefix|php_namespace|ruby_package|string|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|float|double|bool|bytes)\b/g}},xe={keyword:"hl-kw",builtin:"hl-bi",string:"hl-st",number:"hl-nm",comment:"hl-cm",operator:"hl-op",decorator:"hl-dc",macro:"hl-mc",preprocessor:"hl-pp",attribute:"hl-at",tag:"hl-tg",property:"hl-pr",variable:"hl-vr",heading:"hl-hd",bold:"hl-bd",link:"hl-lk",key:"hl-ky",section:"hl-sc"}});function up(e,t,s){let n=[],i=0,r=0;if(t!=null){let f=t.split(`
1952
1952
  `);for(let g=0;g<f.length;g++)n.push({type:"addition",oldNum:"",oldText:"",newNum:g+1,newText:f[g]}),i++;return{lines:n,stats:{additions:i,deletions:0},content:t}}if(!e||e.trim()==="")return{lines:[{type:"context",oldNum:"",oldText:s("git.noDiff"),newNum:"",newText:s("git.noDiff")}],stats:{additions:0,deletions:0},content:""};if(e.includes("Binary files")&&e.includes("differ"))return{lines:[{type:"context",oldNum:"",oldText:s("git.binaryFile"),newNum:"",newText:s("git.binaryFile")}],stats:{additions:0,deletions:0},content:e};let o=e.split(`
1953
1953
  `),a=0,l=0,c=!1,d=[],u=[],p=()=>{let f=Math.max(d.length,u.length);for(let g=0;g<f;g++){let v=d[g],m=u[g];v&&m?n.push({type:"modification",oldNum:v.num,oldText:v.text,newNum:m.num,newText:m.text}):v?n.push({type:"deletion",oldNum:v.num,oldText:v.text,newNum:"",newText:""}):m&&n.push({type:"addition",oldNum:"",oldText:"",newNum:m.num,newText:m.text})}d=[],u=[]};for(let f of o){if(f.startsWith("diff --git")||f.startsWith("index ")||f.startsWith("---")||f.startsWith("+++")||f.startsWith("\\"))continue;let g=f.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(g){p(),a=parseInt(g[1]),l=parseInt(g[2]),c=!0,n.push({type:"hunk",oldNum:"\xB7\xB7\xB7",oldText:f,newNum:"\xB7\xB7\xB7",newText:f});continue}if(c)if(f.startsWith("-"))u.length>0&&d.length===0&&p(),d.push({num:a++,text:f.substring(1)}),r++;else if(f.startsWith("+"))u.push({num:l++,text:f.substring(1)}),i++;else{p();let v=f.startsWith(" ")?f.substring(1):f;n.push({type:"context",oldNum:a++,oldText:v,newNum:l++,newText:v})}}return p(),{lines:n,stats:{additions:i,deletions:r},content:e}}var pp=H(()=>{});function fp(e,t){let{effectiveGitWorkDir:s,gitOperating:n,gitOpFeedback:i,commitMessage:r}=t,o=null,a=null,l=(y,h)=>{o&&clearTimeout(o),i.value={ok:y,message:h},o=setTimeout(()=>{i.value=null},4e3)},c=(y,h)=>{e.currentAgent&&(y.value=!0,h.value="",e.sendWsMessage({type:"git_status",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,workDir:s.value,_clientId:e.clientId}))},d=(y,h={})=>{e.currentAgent&&(n.value=!0,a&&clearTimeout(a),a=setTimeout(()=>{n.value&&(n.value=!1,l(!1,"Operation timed out"))},15e3),e.sendWsMessage({type:y,conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,workDir:s.value,_clientId:e.clientId,...h}))};return{showFeedback:l,loadGitStatus:c,gitOp:d,stageFile:y=>d("git_add",{filePath:y}),unstageFile:y=>d("git_reset",{filePath:y}),discardFile:y=>{confirm("Discard changes to "+y+"?")&&d("git_restore",{filePath:y})},stageAll:()=>d("git_add",{addAll:!0}),unstageAll:()=>d("git_reset",{resetAll:!0}),commitChanges:()=>{let y=r.value.trim();y&&d("git_commit",{commitMessage:y})},pushChanges:()=>d("git_push"),handleGitOpResult:(y,h)=>{n.value=!1,a&&(clearTimeout(a),a=null),y.success?(l(!0,y.message||y.operation+" succeeded"),y.operation==="commit"&&(r.value=""),h()):l(!1,y.error||y.operation+" failed")},cleanup:()=>{o&&clearTimeout(o),a&&clearTimeout(a)}}}var gp=H(()=>{});function mp(e,t){let s=Vue.ref(!1),n=Vue.ref(""),i=Vue.ref([]),r=Vue.ref(!1),o=Vue.ref(""),a=g=>{r.value=!0,o.value="",e.sendWsMessage({type:"list_directory",conversationId:"_git_folder_picker",agentId:e.currentAgent,dirPath:g,workDir:t.value,_clientId:e.clientId})};return{folderPickerOpen:s,folderPickerPath:n,folderPickerEntries:i,folderPickerLoading:r,folderPickerSelected:o,openFolderPicker:()=>{s.value=!0,o.value="",r.value=!0;let g=t.value||"";n.value=g,i.value=[],e.sendWsMessage({type:"list_directory",conversationId:"_git_folder_picker",agentId:e.currentAgent,dirPath:g,workDir:t.value,_clientId:e.clientId})},folderPickerNavigateUp:()=>{if(!n.value)return;let g=n.value.includes("\\"),v=g?"\\":"/",m=n.value.replace(/[/\\]$/,"").split(/[/\\]/);if(m.pop(),m.length===0)n.value="",a("");else if(g&&m.length===1&&/^[A-Za-z]:$/.test(m[0]))n.value=m[0]+"\\",a(m[0]+"\\");else{let A=m.join(v);n.value=A,a(A)}},folderPickerSelectItem:g=>{o.value=g.name},folderPickerEnter:g=>{let v=n.value.includes("\\")||/^[A-Z]:/.test(g.name)?"\\":"/",m;n.value?m=n.value.replace(/[/\\]$/,"")+v+g.name:m=g.name+(g.name.endsWith("\\")?"":"\\"),n.value=m,a(m)},confirmFolderPicker:(g,v)=>{let m=n.value;if(m){if(o.value){let A=m.includes("\\")?"\\":"/";m=m.replace(/[/\\]$/,"")+A+o.value}g.value=m,s.value=!1,v()}},handleDirectoryListing:g=>g.conversationId!=="_git_folder_picker"?!1:(r.value=!1,i.value=(g.entries||[]).filter(v=>v.type==="directory").sort((v,m)=>v.name.localeCompare(m.name)),g.dirPath!=null&&(n.value=g.dirPath),!0)}}var hp=H(()=>{});var vp,yp=H(()=>{oa();dp();pp();gp();hp();vp={name:"GitStatusTab",template:`
1954
1954
  <div class="git-status-tab git-three-col">
@@ -2194,7 +2194,7 @@ ${String(e||"").trim()}
2194
2194
  </div>
2195
2195
  </div>
2196
2196
  </div>
2197
- `,setup(){let e=Pinia.useChatStore(),t=Vue.inject("t"),s=O=>O.split(/[/\\]/).pop()||O,n=O=>{let E=O.split(/[/\\]/);return E.pop(),E.join("/")},i=O=>zi(s(O)),r=Vue.ref(null),o=Vue.reactive({staged:!1,modified:!1,untracked:!1}),a=O=>{o[O]=!o[O]},l=Vue.ref(!1),c=Vue.ref(""),d=Vue.ref(null),u=Vue.ref([]),p=Vue.computed(()=>e.effectiveWorkDir||""),f=Vue.ref(""),g=Vue.computed(()=>f.value.trim()||p.value),v=Vue.ref(null),m=Vue.ref(!1),A=Vue.ref(!1),w=Vue.ref(""),k=Vue.ref(null),y=Vue.ref([]),h=Vue.ref(null),b=Vue.ref(!0),_=Vue.ref(!1),L=Vue.ref(""),U=Vue.ref(null),$=Vue.ref(0),R=Vue.ref(0),P=O=>O==null||O===""?"":cp(O,v.value||""),T=Vue.ref(parseInt(localStorage.getItem("gitDiffFontSize"))||12),I=O=>{T.value=Math.max(8,Math.min(24,O)),localStorage.setItem("gitDiffFontSize",T.value.toString())},M=()=>I(T.value+1),B=()=>I(T.value-1),F=O=>{O.deltaY<0?M():O.deltaY>0&&B()},z=Vue.computed(()=>{let O=y.value;if(!O||O.length===0)return[];let E=O.length,J=[],se=0;for(;se<E;){let me=O[se];if(me.type==="addition"||me.type==="deletion"||me.type==="modification"){let K=me.type==="modification"?"modification":me.type,ee=se;for(;se<E&&(O[se].type===K||O[se].type==="modification"&&K!=="modification");)se++;let fe=se-ee;J.push({type:K,top:ee/E*100,height:Math.max(fe/E*100,.5)})}else se++}return J}),ne=O=>{let E=r.value;if(!E)return;let J=O.currentTarget.getBoundingClientRect(),se=(O.clientY-J.top)/J.height;E.scrollTop=se*(E.scrollHeight-E.clientHeight)},ve=Vue.computed(()=>u.value.filter(O=>O.indexStatus!==" "&&O.indexStatus!=="?")),ue=Vue.computed(()=>u.value.filter(O=>O.workTreeStatus==="M"||O.workTreeStatus==="D")),be=Vue.computed(()=>u.value.filter(O=>O.indexStatus==="?"&&O.workTreeStatus==="?")),oe=fp(e,{effectiveGitWorkDir:g,gitOperating:_,gitOpFeedback:U,commitMessage:L}),Ce=()=>oe.loadGitStatus(l,c),x=()=>{Ce()},j=mp(e,g),ae=O=>Ki(O),he=()=>j.confirmFolderPicker(f,Ce),W=(O,E)=>{v.value=O.path,m.value=E,A.value=!0,w.value="",k.value=null,y.value=[],h.value=null;let J=O.indexStatus==="?"&&O.workTreeStatus==="?";e.sendWsMessage({type:"git_diff",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,workDir:g.value,filePath:O.path,staged:E,untracked:J,fullFile:b.value,_clientId:e.clientId})},te=()=>{if(b.value=!b.value,v.value){let O=u.value.find(E=>E.path===v.value);O&&W(O,m.value)}},Y=O=>{let E=O.detail;if(E)switch(E.type){case"directory_listing":{if(j.handleDirectoryListing(E))return;break}case"git_status_result":{if(l.value=!1,E.error){c.value=E.error,d.value=null,u.value=[];return}if(c.value="",d.value=E.branch||"HEAD",u.value=E.files||[],$.value=E.ahead||0,R.value=E.behind||0,v.value){let J=u.value.find(se=>se.path===v.value);if(J){let se=J.indexStatus!==" "&&J.indexStatus!=="?";m.value=se}else v.value=null,k.value=null,y.value=[],h.value=null}break}case"git_diff_result":{if(A.value=!1,E.error){w.value=E.error;return}w.value="";let J=up(E.diff,E.newFileContent,t);h.value=J.stats,y.value=J.lines,k.value=J.content;break}case"git_op_result":{oe.handleGitOpResult(E,Ce);break}}};Vue.watch(()=>e.currentAgent,()=>{d.value=null,u.value=[],c.value="",v.value=null,k.value=null,e.currentAgent&&Vue.nextTick(()=>Ce())}),Vue.watch(()=>e.currentConversation,()=>{e.currentAgent&&(v.value=null,k.value=null,y.value=[],h.value=null,Vue.nextTick(()=>Ce()))});let N=()=>Ce();return Vue.onMounted(()=>{window.addEventListener("workbench-message",Y),e.currentAgent&&Ce()}),Vue.onUnmounted(()=>{window.removeEventListener("workbench-message",Y),oe.cleanup()}),{store:e,getFileName:s,getDirName:n,getFileIconHtml:i,hlLine:P,collapsedGroups:o,toggleGroup:a,gitLoading:l,gitError:c,gitBranch:d,gitFiles:u,gitWorkDir:f,defaultWorkDir:p,changeGitWorkDir:x,stagedFiles:ve,modifiedFiles:ue,untrackedFiles:be,selectedGitFile:v,selectedStaged:m,diffLoading:A,diffError:w,diffContent:k,diffLines:y,diffStats:h,diffFullFile:b,toggleDiffMode:te,scrollMarkers:z,diffScrollContainer:r,onMarkerClick:ne,fontSize:T,zoomIn:M,zoomOut:B,onWheel:F,gitOperating:_,commitMessage:L,gitOpFeedback:U,gitAhead:$,gitBehind:R,stageFile:oe.stageFile,unstageFile:oe.unstageFile,discardFile:oe.discardFile,stageAll:oe.stageAll,unstageAll:oe.unstageAll,commitChanges:oe.commitChanges,pushChanges:oe.pushChanges,selectGitFile:W,refresh:N,folderPickerOpen:j.folderPickerOpen,folderPickerPath:j.folderPickerPath,folderPickerEntries:j.folderPickerEntries,folderPickerLoading:j.folderPickerLoading,folderPickerSelected:j.folderPickerSelected,getFolderIcon:ae,openFolderPicker:j.openFolderPicker,folderPickerNavigateUp:j.folderPickerNavigateUp,folderPickerSelectItem:j.folderPickerSelectItem,folderPickerEnter:j.folderPickerEnter,confirmFolderPicker:he}}}});function bp(e){let t=Vue.ref(!1),s=Vue.ref(!1),n=Vue.ref(""),i=Vue.ref(""),r=Vue.ref(!1),o=Vue.ref(!1),a=Vue.ref(0),l=Vue.ref(-1),c=Vue.ref(null),d=Vue.ref(null),u=[],p=[],f=()=>{let $=e.value?.cmInstance;if(!$)return;let P=$.getWrapperElement().querySelector(".cm-find-scrollbar-annotations");P&&P.remove()},g=()=>{let $=e.value?.cmInstance;if(!$||p.length===0)return;f();let R=$.getWrapperElement();if(!R.querySelector(".CodeMirror-vscrollbar"))return;let T=$.lineCount();if(T===0)return;let I=document.createElement("div");I.className="cm-find-scrollbar-annotations";for(let M of p){let B=M.from.line/T*100,F=document.createElement("div");F.className="cm-find-scrollbar-tick",F.style.top=B+"%",I.appendChild(F)}R.appendChild(I)},v=()=>{for(let $ of u)try{$.clear()}catch{}u=[],p=[],a.value=0,l.value=-1,f()},m=$=>{let R=e.value?.cmInstance;if(!R||!p[$])return;for(let T=0;T<u.length;T++){if(!u[T])continue;let I=u[T].find();I&&(u[T].clear(),u[T]=R.markText(I.from,I.to,{className:"cm-find-highlight"}))}let P=p[$];if(u[$]){let T=u[$].find();T&&(u[$].clear(),u[$]=R.markText(T.from,T.to,{className:"cm-find-highlight cm-find-current"}))}setTimeout(()=>{R.scrollIntoView({from:P.from,to:P.to},100)},0)},A=()=>{v();let $=e.value?.cmInstance;if(!$||!n.value)return;let R=n.value;if(R.length<3)return;let P=$.getValue(),T=r.value,I=o.value,M=[];try{if(I){let B=T?"g":"gi",F=new RegExp(R,B),z;for(;(z=F.exec(P))!==null;){if(z[0].length===0){F.lastIndex++;continue}let ne=$.posFromIndex(z.index),ve=$.posFromIndex(z.index+z[0].length);if(M.push({from:ne,to:ve}),M.length>1e4)break}}else{let B=T?R:R.toLowerCase(),F=T?P:P.toLowerCase(),z=0;for(;(z=F.indexOf(B,z))!==-1;){let ne=$.posFromIndex(z),ve=$.posFromIndex(z+R.length);if(M.push({from:ne,to:ve}),z+=R.length,M.length>1e4)break}}}catch{return}p=M,a.value=M.length;for(let B of M)u.push($.markText(B.from,B.to,{className:"cm-find-highlight"}));if(M.length>0){let B=$.getCursor(),F=0;for(let z=0;z<M.length;z++){if(CodeMirror.cmpPos(M[z].from,B)>=0){F=z;break}z===M.length-1&&(F=0)}l.value=F,m(F)}g()};return{findBarVisible:t,replaceBarVisible:s,findQuery:n,replaceQuery:i,findCaseSensitive:r,findUseRegex:o,findMatchCount:a,findMatchIndex:l,findInputRef:c,replaceInputRef:d,clearFindMarkers:v,performFind:A,onFindInput:()=>{A()},findNext:()=>{if(p.length===0)return;let $=(l.value+1)%p.length;l.value=$,m($)},findPrev:()=>{if(p.length===0)return;let $=(l.value-1+p.length)%p.length;l.value=$,m($)},openFindBar:($=!1)=>{t.value=!0,s.value=$;let R=e.value?.cmInstance;if(R){let P=R.getSelection();P&&(n.value=P)}Vue.nextTick(()=>{c.value?.focus(),c.value?.select(),n.value&&A()})},closeFindBar:()=>{v(),t.value=!1,s.value=!1;let $=e.value?.cmInstance;$&&$.focus()},toggleReplaceBar:()=>{s.value=!s.value,s.value&&Vue.nextTick(()=>d.value?.focus())},replaceOne:()=>{let $=e.value?.cmInstance;if(!$||p.length===0||l.value<0)return;let R=p[l.value];$.replaceRange(i.value,R.from,R.to),A()},replaceAll:()=>{let $=e.value?.cmInstance;!$||p.length===0||($.operation(()=>{for(let R=p.length-1;R>=0;R--)$.replaceRange(i.value,p[R].from,p[R].to)}),A())}}}var wp=H(()=>{});function kp(e,t){let{getEffectiveWorkDir:s,treePath:n}=t,i=Vue.reactive(new Set),r=Vue.ref(-1),o=Vue.ref(!1),a=Vue.ref(null),l=null,c=null,d=Vue.ref(!1),u=Vue.ref(""),p=Vue.ref("file"),f=Vue.ref(null),g=Vue.ref(!1),v=Vue.ref(""),m=Vue.ref(null),A=Vue.reactive({visible:!1,x:0,y:0,entry:null}),w=Vue.ref(!1),k=Vue.ref(""),y=Vue.ref(null),h=null,b=Vue.reactive({dragging:null,dropTarget:null}),_=Vue.ref(!1),L=(K,ee)=>{l&&clearTimeout(l),a.value={ok:K,message:ee},l=setTimeout(()=>{a.value=null},4e3)},U=()=>{o.value=!0,c&&clearTimeout(c),c=setTimeout(()=>{o.value&&(o.value=!1,L(!1,"Operation timed out"))},15e3)},$=K=>{i.has(K)?i.delete(K):i.add(K)},R=()=>{i.clear(),r.value=-1},P=K=>{p.value=K,u.value="",d.value=!0,Vue.nextTick(()=>f.value?.focus())},T=()=>{let K=u.value.trim();if(!K)return;d.value=!1;let ee=n.value||s();if(!ee)return;let fe=ee.includes("\\")?"\\":"/",le=ee.replace(/[/\\]$/,"")+fe+K;U(),e.sendWsMessage({type:"create_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:le,isDirectory:p.value==="directory",workDir:s(),_clientId:e.clientId})},I=(K,ee)=>{let fe=K.path.split("/").pop();confirm(ee("files.deleteConfirm",{name:fe})+(K.type==="directory"?ee("files.deleteDirHint"):""))&&(U(),e.sendWsMessage({type:"delete_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[K.path],workDir:s(),_clientId:e.clientId}))},M=K=>{let ee=i.size;ee!==0&&confirm(K("files.deleteSelectedConfirm",{count:ee}))&&(U(),e.sendWsMessage({type:"delete_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[...i],workDir:s(),_clientId:e.clientId}))},B=()=>{v.value=n.value||s()||"",g.value=!0,Vue.nextTick(()=>m.value?.focus())},F=()=>{let K=v.value.trim();!K||i.size===0||(g.value=!1,U(),e.sendWsMessage({type:"move_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[...i],destination:K,workDir:s(),_clientId:e.clientId}))},z=(K,ee)=>{let _e=K.clientX,De=K.clientY;_e+180>window.innerWidth&&(_e=window.innerWidth-180),De+240>window.innerHeight&&(De=window.innerHeight-240),A.entry=ee,A.x=_e,A.y=De,A.visible=!0},ne=()=>{A.visible=!1};return{selectedPaths:i,lastClickedIndex:r,fileOperating:o,fileOpFeedback:a,newFileDialogVisible:d,newFileName:u,newFileType:p,newFileInput:f,moveDialogVisible:g,moveDestination:v,moveDestInput:m,contextMenu:A,renameDialogVisible:w,renameNewName:k,renameInput:y,dragState:b,externalDropActive:_,showFileOpFeedback:L,toggleSelection:$,clearSelection:R,showNewFileDialog:P,confirmNewFile:T,deleteSingleFile:I,deleteSelected:M,openMoveDialog:B,confirmMove:F,showContextMenu:z,hideContextMenu:ne,ctxRename:()=>{let K=A.entry;ne(),K&&(k.value=K.name,w.value=!0,Vue.nextTick(()=>{let ee=y.value;if(ee)if(ee.focus(),K.type==="file"){let fe=K.name.lastIndexOf(".");fe>0?ee.setSelectionRange(0,fe):ee.select()}else ee.select()}))},confirmRename:()=>{let K=A.entry,ee=k.value.trim();if(!ee||!K||ee===K.name){w.value=!1;return}w.value=!1;let fe=K.path.replace(/\/$/,"").split("/");fe.pop();let le=fe.join("/")||"/";U(),e.sendWsMessage({type:"move_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[K.path],destination:le,newName:ee,workDir:s(),_clientId:e.clientId})},ctxCopy:()=>{let K=A.entry;if(ne(),!K)return;let ee=K.path.replace(/\/$/,"").split("/");ee.pop();let fe=ee.join("/")||"/";U(),e.sendWsMessage({type:"copy_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[K.path],destination:fe,workDir:s(),_clientId:e.clientId})},ctxMoveTo:()=>{let K=A.entry;ne(),K&&(i.clear(),i.add(K.path),B())},ctxDelete:K=>{let ee=A.entry;ne(),ee&&I(ee,K)},ctxDownload:()=>{let K=A.entry;ne(),!(!K||K.type!=="file")&&(h=K.path,e.sendWsMessage({type:"read_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:K.path,workDir:s(),_clientId:e.clientId}))},onDragStart:(K,ee)=>{b.dragging=ee,K.dataTransfer.setData("text/plain",ee.path),K.dataTransfer.effectAllowed="move"},onDragOver:(K,ee)=>{if(!b.dragging&&K.dataTransfer.types.includes("Files")){ee.type==="directory"&&(K.dataTransfer.dropEffect="copy",b.dropTarget=ee.path);return}!b.dragging||ee.type!=="directory"||ee.path!==b.dragging.path&&(ee.path.startsWith(b.dragging.path+"/")||(K.dataTransfer.dropEffect="move",b.dropTarget=ee.path))},onDragLeave:K=>{let ee=K.relatedTarget;ee&&K.currentTarget.contains(ee)||(b.dropTarget=null)},onDrop:(K,ee,fe)=>{if(b.dropTarget=null,!b.dragging&&K.dataTransfer.files.length>0&&ee.type==="directory"){fe(K.dataTransfer.files,ee.path);return}if(!b.dragging||ee.type!=="directory"){b.dragging=null;return}if(ee.path===b.dragging.path){b.dragging=null;return}U(),e.sendWsMessage({type:"move_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[b.dragging.path],destination:ee.path,workDir:s(),_clientId:e.clientId}),b.dragging=null},onTreeDragOver:K=>{b.dragging||K.dataTransfer.types.includes("Files")&&(K.dataTransfer.dropEffect="copy",_.value=!0)},onTreeDragLeave:K=>{let ee=K.relatedTarget;ee&&K.currentTarget.contains(ee)||(_.value=!1)},onTreeDrop:(K,ee,fe)=>{if(_.value=!1,!b.dragging&&K.dataTransfer.files.length>0){let le=n.value||ee||s();fe(K.dataTransfer.files,le)}},handleExternalFileDrop:async(K,ee)=>{if(!ee)return;let fe=[],le=[];for(let _e of K)le.push(new Promise(De=>{let Ve=new FileReader;Ve.onload=()=>{let We=btoa(new Uint8Array(Ve.result).reduce((Mt,pt)=>Mt+String.fromCharCode(pt),""));fe.push({name:_e.name,data:We}),De()},Ve.onerror=()=>De(),Ve.readAsArrayBuffer(_e)}));await Promise.all(le),fe.length!==0&&(o.value=!0,c&&clearTimeout(c),c=setTimeout(()=>{o.value&&(o.value=!1,L(!1,"Upload timed out"))},3e4),e.sendWsMessage({type:"upload_to_dir",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,files:fe,dirPath:ee,workDir:s(),_clientId:e.clientId}))},handleFileOpResult:(K,ee,fe)=>{o.value=!1,c&&(clearTimeout(c),c=null),L(K.success,K.success?K.message:K.error||"Operation failed"),K.success&&(fe&&ee(fe),(K.operation==="delete"||K.operation==="move")&&(i.clear(),r.value=-1))},getPendingDownload:()=>h,clearPendingDownload:()=>{h=null},cleanup:()=>{l&&clearTimeout(l),c&&clearTimeout(c)}}}var Sp=H(()=>{});function Cp(e,{getEffectiveWorkDir:t,normalizePath:s,selectedPaths:n,lastClickedIndex:i,openFileInTab:r,clearSelection:o}){let a=Vue.ref(""),l=Vue.ref(""),c=Vue.reactive({}),d=Vue.ref(!1),u=Vue.ref(null),p=Vue.computed(()=>{if(!l.value)return"EXPLORER";let P=l.value.replace(/[\\/]+$/,"").split(/[\\/]/);return(P[P.length-1]||l.value).toUpperCase()}),f=Vue.computed(()=>l.value?!!c[l.value]?.expanded:!1),g=()=>{if(!l.value)return;let P=c[l.value];P&&(P.expanded=!P.expanded)},v=()=>{for(let P of Object.keys(c))c[P]&&(c[P].expanded=!1)},m=()=>{d.value=!0,Vue.nextTick(()=>u.value?.focus())},A=()=>{d.value=!1,h()},w=()=>{d.value=!1},k=Vue.computed(()=>{let P=[],T=(I,M)=>{let B=c[I];if(!(!B||!B.entries))for(let F of B.entries)P.push({...F,depth:M}),F.type==="directory"&&c[F.path]?.expanded&&T(F.path,M+1)};return l.value&&c[l.value]?.expanded&&T(l.value,0),P}),y=P=>{let T=s(P);c[T]?c[T].loading=!0:c[T]={entries:[],expanded:!0,loaded:!1,loading:!0},e.sendWsMessage({type:"list_directory",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,dirPath:P,workDir:t(),_clientId:e.clientId})},h=()=>{let P=a.value.trim();if(!P)return;let T=s(P);l.value=T,Object.keys(c).forEach(I=>delete c[I]),c[T]={entries:[],expanded:!0,loaded:!1,loading:!0},e.sendWsMessage({type:"list_directory",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,dirPath:P,workDir:t(),_clientId:e.clientId})},b=P=>{let T=s(P),I=c[T];I?I.loaded?I.expanded=!I.expanded:(I.expanded=!0,y(P)):(c[T]={entries:[],expanded:!0,loaded:!1,loading:!1},y(P))},_=(P,T)=>{let I=k.value,M=I.findIndex(B=>B.path===P.path);if(T&&(T.shiftKey||T.ctrlKey||T.metaKey)){if(T.shiftKey&&i.value>=0&&M>=0){let B=Math.min(i.value,M),F=Math.max(i.value,M);!T.ctrlKey&&!T.metaKey&&n.clear();for(let z=B;z<=F;z++)n.add(I[z].path)}else n.has(P.path)?n.delete(P.path):n.add(P.path);i.value=M;return}n.size>0&&(n.clear(),i.value=-1),P.type==="directory"?b(P.path):r(P.path,P.name),i.value=M},L=P=>{let T=s(P.dirPath);if(P.error){c[T]&&(c[T].loading=!1);return}let I=(P.entries||[]).sort((F,z)=>F.type===z.type?F.name.localeCompare(z.name):F.type==="directory"?-1:1),M=T.replace(/\/$/,""),B=I.map(F=>({...F,path:M+"/"+F.name}));c[T]?(c[T].entries=B,c[T].loaded=!0,c[T].loading=!1):c[T]={entries:B,expanded:!0,loaded:!0,loading:!1},T===l.value&&(a.value=P.dirPath)},U=()=>{Object.keys(c).forEach(P=>delete c[P])};return{treePath:a,treeRootPath:l,treeNodes:c,flattenedTree:k,editingTreePath:d,treePathInputRef:u,rootFolderName:p,rootExpanded:f,toggleRootExpand:g,collapseAll:v,startTreePathEdit:m,confirmTreePath:A,cancelTreePathEdit:w,loadTreeDirectory:y,loadRootDirectory:h,toggleDirectory:b,onTreeItemClick:_,handleDirectoryListing:L,clearTreeNodes:U,initFileBrowser:()=>{let P=t();if(P){let T=s(P);a.value=P,l.value=T,U(),y(P)}},refresh:()=>{l.value&&y(l.value)}}}var Ip=H(()=>{});function Hs(e){let t=e.lastIndexOf(".");if(t<0)return"text";let s=e.substring(t).toLowerCase();return rv.has(s)?"office":ov.has(s)?"pdf":av.has(s)?"image":"text"}function Tt(e){let t=e.lastIndexOf(".");return t<0?!1:lv.has(e.substring(t).toLowerCase())}function cv(e){let t=e.split(".").pop()?.toLowerCase();return{js:"javascript",mjs:"javascript",jsx:"javascript",ts:{name:"javascript",typescript:!0},tsx:{name:"javascript",typescript:!0},json:{name:"javascript",json:!0},py:"python",html:"htmlmixed",htm:"htmlmixed",vue:"htmlmixed",xml:"xml",svg:"xml",css:"css",scss:"css",less:"css",sh:"shell",bash:"shell",zsh:"shell",c:"text/x-csrc",h:"text/x-csrc",cpp:"text/x-c++src",hpp:"text/x-c++src",cs:"text/x-csharp",java:"text/x-java",md:"markdown",markdown:"markdown"}[t]||"text/plain"}function Ap(e,{activeFile:t,editorContainer:s,fontSize:n,clearFindMarkers:i,openFindBar:r,saveFile:o}){let a=Vue.ref(""),l=Vue.reactive({}),c=()=>{},d=()=>{},u=({openQuickOpen:w,openGoToLine:k})=>{c=w,d=k},p=(w,k=0)=>{if(!s.value){k<20&&setTimeout(()=>p(w,k+1),100);return}if(!w)return;if(s.value.innerHTML="",typeof CodeMirror>"u"){let b=document.createElement("textarea");b.value=w.content||"",b.style.cssText="width:100%;height:100%;border:none;outline:none;resize:none;padding:12px;font-family:monospace;font-size:12px;background:var(--bg-main);color:var(--text-main);white-space:pre;tab-size:4;",b.spellcheck=!1,b.addEventListener("input",()=>{w.content=b.value,w.isDirty=b.value!==w.originalContent}),b.addEventListener("keydown",_=>{(_.ctrlKey||_.metaKey)&&_.key==="s"&&(_.preventDefault(),o())}),s.value.appendChild(b),a.value="";return}let h=document.documentElement.getAttribute("data-theme")==="dark"?"material-darker":"default";try{let b=CodeMirror(s.value,{value:w.content||"",mode:cv(w.name),theme:h,lineNumbers:!0,tabSize:4,indentWithTabs:!1,lineWrapping:!1,readOnly:!1,extraKeys:{"Ctrl-S":()=>o(),"Cmd-S":()=>o(),"Ctrl-P":()=>c(),"Cmd-P":()=>c(),"Ctrl-G":()=>d(),"Cmd-G":()=>d(),"Ctrl-F":()=>r(!1),"Cmd-F":()=>r(!1),"Ctrl-R":()=>r(!0),"Cmd-R":()=>r(!0),"Ctrl-H":()=>r(!0),"Cmd-H":()=>r(!0)}});b.on("change",()=>{let L=b.getValue();w.content=L,w.isDirty=L!==w.originalContent}),w.cmInstance=b,b.getWrapperElement().style.fontSize=n.value+"px";let _=e.currentConversation;_&&l[_]?.[w.path]&&b.setHistory(l[_][w.path]),Vue.nextTick(()=>{b.refresh(),setTimeout(()=>b.refresh(),200)}),a.value=""}catch(b){a.value=`Editor error: ${b.message}`}};return{debugStatus:a,undoHistoryMap:l,createEditor:p,destroyEditor:()=>{i();let w=t.value;w?.cmInstance&&(w.cmInstance.toTextArea&&w.cmInstance.toTextArea(),w.cmInstance=null),s.value&&(s.value.innerHTML="")},setKeyBindings:u,saveCurrentUndoHistory:()=>{let w=e.currentConversation;if(!w)return;let k=t.value;k?.cmInstance&&(l[w]||(l[w]={}),l[w][k.path]=k.cmInstance.getHistory())},saveAllUndoHistory:w=>{if(!w)return;let k=t.value;k?.cmInstance&&(l[w]||(l[w]={}),l[w][k.path]=k.cmInstance.getHistory())},cleanupUndoHistory:(w,k)=>{w&&l[w]&&delete l[w][k]},deleteConversationHistory:w=>{delete l[w]}}}var rv,ov,av,lv,Pn=H(()=>{rv=new Set([".docx",".xlsx",".xls",".pptx",".ppt"]),ov=new Set([".pdf"]),av=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico"]),lv=new Set([".md",".markdown",".mdx"])});function xp(e,{editorContainer:t,createEditor:s,t:n}){let i=Vue.ref(!0),r=Vue.ref(null),o=Vue.ref(null),a=Vue.computed(()=>{let f=e.value;return!!(f&&Tt(f.name))}),l=Vue.computed(()=>{let f=e.value;if(!f||!Tt(f.name)||f.content==null)return"";try{if(typeof marked<"u")return marked.parse(f.content)}catch{}return"<pre>"+(f.content||"")+"</pre>"});function c(){Ye(r.value)}async function d(){await Ye(r.value)}function u(){i.value=!1,Vue.nextTick(()=>{let f=e.value;f&&t.value&&s(f)})}return{mdPreviewMode:i,mdPreviewRef:r,officePreviewContainer:o,isActiveMarkdown:a,mdRenderedHtml:l,initMermaid:c,renderMermaidBlocks:d,switchToMdEdit:u,renderOfficeLocal:f=>{let g=o.value;if(!g||!f._arrayBuffer)return;g.innerHTML="";let v=("."+f.name.split(".").pop()).toLowerCase();if(v===".docx"&&window.docx)window.docx.renderAsync(f._arrayBuffer,g,null,{className:"docx-preview-content",inWrapper:!0,ignoreWidth:!1,ignoreHeight:!0}).catch(m=>{f.previewError=m.message});else if(v===".xlsx"||v===".xls")try{let m=XLSX.read(f._arrayBuffer,{type:"array"}),A=m.SheetNames[0],w=XLSX.utils.sheet_to_html(m.Sheets[A],{editable:!1});g.innerHTML='<div class="xlsx-sheet-tabs">'+m.SheetNames.map((k,y)=>`<button class="xlsx-sheet-tab${y===0?" active":""}" data-idx="${y}">${k}</button>`).join("")+'</div><div class="xlsx-table-wrap">'+w+"</div>",g.querySelectorAll(".xlsx-sheet-tab").forEach(k=>{k.addEventListener("click",()=>{let y=parseInt(k.dataset.idx),h=m.SheetNames[y],b=XLSX.utils.sheet_to_html(m.Sheets[h],{editable:!1});g.querySelector(".xlsx-table-wrap").innerHTML=b,g.querySelectorAll(".xlsx-sheet-tab").forEach(_=>_.classList.remove("active")),k.classList.add("active")})})}catch(m){f.previewError=m.message}else(v===".pptx"||v===".ppt")&&(g.innerHTML='<div class="preview-unsupported">'+(n?n("files.pptxNotSupported"):"PowerPoint preview not supported")+"</div>")}}}var Tp=H(()=>{wn();Pn()});function Mp(e,{getEffectiveWorkDir:t,treePath:s,openFileInTab:n,normalizePath:i,treeRootPath:r,treeNodes:o,loadTreeDirectory:a}){let l=Vue.ref(""),c=Vue.ref([]),d=Vue.ref(!1),u=null,p=Vue.ref(!1),f=Vue.ref(""),g=Vue.ref([]),v=Vue.ref(0),m=Vue.ref(!1),A=Vue.ref(null),w=null,k=Vue.ref(!1),y=Vue.ref(""),h=Vue.ref(null),b=ue=>{!e.currentAgent||!ue.trim()||e.sendWsMessage({type:"file_search",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,query:ue.trim(),dirPath:s.value||t()||"",_clientId:e.clientId})},_=()=>{if(u&&clearTimeout(u),!l.value.trim()){c.value=[],d.value=!1;return}d.value=!0,u=setTimeout(()=>{b(l.value)},300)},L=()=>{l.value="",c.value=[],d.value=!1},U=ue=>{if(ue.type==="directory"){let be=i(ue.fullPath);r.value=be,s.value=ue.fullPath,Object.keys(o).forEach(oe=>delete o[oe]),a(ue.fullPath),L()}else n(ue.fullPath,ue.name),L()},$=()=>{p.value=!0,f.value="",g.value=[],v.value=0,m.value=!1,Vue.nextTick(()=>A.value?.focus())},R=()=>{p.value=!1,f.value="",g.value=[]},P=()=>{if(w&&clearTimeout(w),!f.value.trim()){g.value=[],m.value=!1;return}m.value=!0,v.value=0,w=setTimeout(()=>{b(f.value)},200)},T=()=>{g.value.length>0&&(v.value=(v.value+1)%g.value.length)},I=()=>{g.value.length>0&&(v.value=(v.value-1+g.value.length)%g.value.length)},M=ue=>{ue.type!=="directory"&&n(ue.fullPath,ue.name),R()},B=()=>{let ue=g.value[v.value];ue&&M(ue)},F=()=>{k.value=!0,y.value="",Vue.nextTick(()=>h.value?.focus())},z=()=>{k.value=!1,y.value=""};return{searchQuery:l,searchResults:c,searchLoading:d,onSearchInput:_,clearSearch:L,onSearchResultClick:U,quickOpenVisible:p,quickOpenQuery:f,quickOpenResults:g,quickOpenSelectedIndex:v,quickOpenLoading:m,quickOpenInput:A,openQuickOpen:$,closeQuickOpen:R,onQuickOpenInput:P,quickOpenSelectNext:T,quickOpenSelectPrev:I,quickOpenConfirm:B,quickOpenOpenFile:M,goToLineVisible:k,goToLineValue:y,goToLineInput:h,openGoToLine:F,closeGoToLine:z,goToLineConfirm:ue=>{let be=parseInt(y.value);if(isNaN(be)||be<1)return;let oe=ue.value;if(oe?.cmInstance){let Ce=oe.cmInstance,x=Math.min(be-1,Ce.lineCount()-1);Ce.setCursor({line:x,ch:0}),Ce.scrollIntoView({line:x,ch:0},100),Ce.focus()}z()},handleFileSearchResult:ue=>{let be=ue.results||[];p.value?ue.query&&ue.query.trim()===f.value.trim()&&(g.value=be,m.value=!1,v.value=0):ue.query&&ue.query.trim()===l.value.trim()&&(c.value=be,d.value=!1)}}}var Pp=H(()=>{});function _p(e,{getEffectiveWorkDir:t,treePath:s,treeRootPath:n,treeNodes:i,normalizePath:r,loadTreeDirectory:o}){let a=Vue.ref(!1),l=Vue.ref(""),c=Vue.ref([]),d=Vue.ref(!1),u=Vue.ref(""),p=()=>{a.value=!0,u.value="",d.value=!0;let k=s.value||t()||"";l.value=k,c.value=[],e.sendWsMessage({type:"list_directory",conversationId:"_folder_picker",agentId:e.currentAgent,dirPath:k,workDir:t(),_clientId:e.clientId})},f=k=>{d.value=!0,u.value="",e.sendWsMessage({type:"list_directory",conversationId:"_folder_picker",agentId:e.currentAgent,dirPath:k,workDir:t(),_clientId:e.clientId})};return{folderPickerOpen:a,folderPickerPath:l,folderPickerEntries:c,folderPickerLoading:d,folderPickerSelected:u,openFolderPicker:p,folderPickerNavigateUp:()=>{if(!l.value)return;let k=l.value.includes("\\"),y=k?"\\":"/",h=l.value.replace(/[/\\]$/,"").split(/[/\\]/);if(h.pop(),h.length===0)l.value="",f("");else if(k&&h.length===1&&/^[A-Za-z]:$/.test(h[0]))l.value=h[0]+"\\",f(h[0]+"\\");else{let b=h.join(y);l.value=b,f(b)}},folderPickerSelectItem:k=>{u.value=k.name},folderPickerEnter:k=>{let y;if(!l.value)y=k.name+(k.name.endsWith("\\")?"":"\\");else{let h=l.value.includes("\\")||/^[A-Z]:/.test(k.name)?"\\":"/";y=l.value.replace(/[/\\]$/,"")+h+k.name}l.value=y,f(y)},confirmFolderPicker:()=>{let k=l.value;if(!k)return;if(u.value){let h=k.includes("\\")?"\\":"/";k=k.replace(/[/\\]$/,"")+h+u.value}s.value=k,a.value=!1;let y=r(k);n.value=y,Object.keys(i).forEach(h=>delete i[h]),i[y]={entries:[],expanded:!0,loaded:!1,loading:!0},e.sendWsMessage({type:"list_directory",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,dirPath:k,workDir:t(),_clientId:e.clientId})},handleFolderPickerListing:k=>{d.value=!1,c.value=(k.entries||[]).filter(y=>y.type==="directory").sort((y,h)=>y.name.localeCompare(h.name)),k.dirPath!=null&&(l.value=k.dirPath)}}}var Rp=H(()=>{});function Dp(e,{normalizePath:t,getEffectiveWorkDir:s,editorContainer:n,createEditor:i,destroyEditor:r,clearFindMarkers:o,saveCurrentUndoHistory:a,saveAllUndoHistory:l,cleanupUndoHistory:c,deleteConversationHistory:d,debugStatus:u,mdPreviewMode:p,renderOfficeLocal:f,performFind:g,findBarVisible:v,findQuery:m,t:A}){let w=Vue.reactive({}),k=Vue.ref([]),y=Vue.ref(-1),h=Vue.ref(!1),b=Vue.ref(!1),_=Vue.computed(()=>y.value>=0&&y.value<k.value.length?k.value[y.value]:null),L=null,U=()=>{L&&clearTimeout(L),L=setTimeout(()=>{e.sendWsMessage({type:"update_file_tabs",openFiles:k.value.map(F=>({path:F.path})),activeIndex:y.value})},500)},$=F=>{F&&(l(F),k.value.length>0?w[F]={files:k.value.map(z=>({path:z.path,name:z.name,content:z.content,originalContent:z.originalContent,isDirty:z.isDirty,fileType:z.fileType})),activeIndex:y.value}:delete w[F],U())},R=F=>{if(r(),!F||!w[F]){k.value=[],y.value=-1;return}let z=w[F];k.value=z.files.map(ne=>({...ne,isDirty:ne.isDirty||!1,originalContent:ne.originalContent||ne.content,cmInstance:null,fileType:ne.fileType||Hs(ne.name||""),blobUrl:null,previewUrl:null,previewLoading:!1,localPreviewReady:!1,previewError:null})),y.value=z.activeIndex,Vue.nextTick(()=>{let ne=_.value;ne&&(!ne.fileType||ne.fileType==="text")&&n.value&&i(ne)})};function P(F,z){let ne=t(F),ve=k.value.findIndex(oe=>oe.path===ne);if(ve>=0){y.value!==ve&&(o(),a(),y.value=ve,Vue.nextTick(()=>{let oe=k.value[ve];oe&&oe.content!=null&&(!oe.fileType||oe.fileType==="text")&&i(oe)})),$(e.currentConversation);return}a();let ue=z||ne.split(/[/\\]/).pop(),be=Hs(ue);k.value.push({path:ne,name:ue,content:null,originalContent:null,isDirty:!1,cmInstance:null,fileType:be,blobUrl:null,previewUrl:null,previewLoading:be!=="text",localPreviewReady:!1,previewError:null}),y.value=k.value.length-1,h.value=!0,be==="text"&&r(),$(e.currentConversation),u.value=`Loading: ${F}`,e.sendWsMessage({type:"read_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:F,workDir:s(),_clientId:e.clientId})}let T=F=>{F!==y.value&&(o(),a(),y.value=F,$(e.currentConversation),Vue.nextTick(()=>{let z=k.value[F];z&&(!z.fileType||z.fileType==="text"?Tt(z.name)?p.value=!0:z.content!=null&&n.value&&(i(z),v.value&&m.value&&Vue.nextTick(()=>g())):z.fileType==="office"&&z.localPreviewReady&&Vue.nextTick(()=>f(z)))}))},I=F=>{let z=k.value[F];if(z?.isDirty&&!confirm(A("files.unsavedConfirm",{name:z.name})))return;c(e.currentConversation,z.path),z.blobUrl&&URL.revokeObjectURL(z.blobUrl);let ne=F===y.value;k.value.splice(F,1),k.value.length===0?(y.value=-1,r()):y.value>=k.value.length?y.value=k.value.length-1:y.value>F?y.value--:ne&&y.value>=k.value.length&&(y.value=k.value.length-1),$(e.currentConversation),k.value.length>0&&ne&&Vue.nextTick(()=>{let ve=k.value[y.value];ve&&(!ve.fileType||ve.fileType==="text")&&ve.content!=null&&n.value&&i(ve)})};function M(){let F=_.value;!F||!F.isDirty||(b.value=!0,e.sendWsMessage({type:"write_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:F.path,content:F.content,workDir:s(),_clientId:e.clientId}))}return{fileTabsMap:w,openFiles:k,activeFileIndex:y,activeFile:_,fileLoading:h,fileSaving:b,saveTabsState:$,restoreTabsState:R,openFileInTab:P,switchToTab:T,closeFileTab:I,saveFile:M,handleConversationDeleted:F=>{let{conversationId:z}=F.detail;z&&(delete w[z],d(z))}}}var Ep=H(()=>{Pn()});function Lp({store:e,normalizePath:t,getEffectiveWorkDir:s,openFiles:n,activeFileIndex:i,activeFile:r,fileLoading:o,fileSaving:a,saveTabsState:l,createEditor:c,openFileInTab:d,tree:u,fp:p,qo:f,ops:g,mdPreviewMode:v,renderOfficeLocal:m,editorContainer:A,debugStatus:w}){return{handleWorkbenchMessage:h=>{let b=h.detail;if(b)switch(b.type){case"directory_listing":{if(b.conversationId==="_folder_picker"){p.handleFolderPickerListing(b);return}u.handleDirectoryListing(b);break}case"file_content":{if(o.value=!1,b.error){w.value=`Error: ${b.error}`,g.clearPendingDownload();let U=t(b.filePath),$=n.value.find(R=>R.path===U);$&&($.previewLoading=!1,$.previewError=b.error);return}let _=t(b.filePath);if(g.getPendingDownload()&&t(g.getPendingDownload())===_){g.clearPendingDownload();try{if(b.binary){let U=`${location.protocol}//${location.host}/api/preview/${b.fileId}?token=${b.previewToken}`,$=document.createElement("a");$.href=U,$.download=_.split("/").pop()||"download",document.body.appendChild($),$.click(),document.body.removeChild($)}else{let U=new Blob([b.content||""],{type:"application/octet-stream"}),$=URL.createObjectURL(U),R=document.createElement("a");R.href=$,R.download=_.split("/").pop()||"download",document.body.appendChild(R),R.click(),document.body.removeChild(R),URL.revokeObjectURL($)}}catch{}return}let L=n.value.findIndex(U=>U.path===_);if(L>=0){let U=n.value[L];if(b.binary){U.previewLoading=!1;let $=`${location.protocol}//${location.host}/api/preview/${b.fileId}?token=${b.previewToken}`,R=U.fileType||Hs(U.name);U.fileType=R,R==="pdf"||R==="image"?fetch($).then(P=>P.blob()).then(P=>{U.blobUrl=URL.createObjectURL(P)}).catch(P=>{U.previewError=P.message}):R==="office"&&((localStorage.getItem("officePreviewMode")||"local")==="online"?U.previewUrl="https://view.officeapps.live.com/op/embed.aspx?src="+encodeURIComponent($):fetch($).then(T=>T.arrayBuffer()).then(T=>{U._arrayBuffer=T,U.localPreviewReady=!0,L===i.value&&Vue.nextTick(()=>m(U))}).catch(T=>{U.previewError=T.message})),l(e.currentConversation);return}U.content=b.content||"",U.originalContent=b.content||"",U.isDirty=!1,l(e.currentConversation),L===i.value&&(Tt(U.name)&&v.value||Vue.nextTick(()=>{setTimeout(()=>c(U),100)}))}break}case"file_saved":{if(a.value=!1,b.error)return;let _=t(b.filePath),L=n.value.find(U=>U.path===_);L&&(L.originalContent=L.content,L.isDirty=!1,l(e.currentConversation));break}case"file_search_result":{f.handleFileSearchResult(b);break}case"file_op_result":{g.handleFileOpResult(b,u.loadTreeDirectory,u.treeRootPath.value);break}case"file_tabs_restored":{if(b.openFiles?.length>0&&n.value.length===0){let _=b.activeIndex||0,L=b.openFiles.length;for(let U of b.openFiles){let $=t(U.path),R=$.split("/").pop(),P=Hs(R);n.value.push({path:$,name:R,content:null,originalContent:null,isDirty:!1,cmInstance:null,fileType:P,blobUrl:null,previewUrl:null,previewLoading:P!=="text",localPreviewReady:!1,previewError:null}),e.sendWsMessage({type:"read_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:U.path})}i.value=_>=0&&_<L?_:0}break}}},handleOpenFile:h=>{let{filePath:b}=h.detail,_=t(b);d(_,_.split("/").pop())}}}var $p=H(()=>{Pn()});var Vp,Fp=H(()=>{oa();wp();Sp();Ip();Pn();Tp();Pp();Rp();Ep();$p();Vp={name:"FilesTab",template:`
2197
+ `,setup(){let e=Pinia.useChatStore(),t=Vue.inject("t"),s=O=>O.split(/[/\\]/).pop()||O,n=O=>{let E=O.split(/[/\\]/);return E.pop(),E.join("/")},i=O=>zi(s(O)),r=Vue.ref(null),o=Vue.reactive({staged:!1,modified:!1,untracked:!1}),a=O=>{o[O]=!o[O]},l=Vue.ref(!1),c=Vue.ref(""),d=Vue.ref(null),u=Vue.ref([]),p=Vue.computed(()=>e.effectiveWorkDir||""),f=Vue.ref(""),g=Vue.computed(()=>f.value.trim()||p.value),v=Vue.ref(null),m=Vue.ref(!1),A=Vue.ref(!1),w=Vue.ref(""),k=Vue.ref(null),y=Vue.ref([]),h=Vue.ref(null),b=Vue.ref(!0),R=Vue.ref(!1),L=Vue.ref(""),U=Vue.ref(null),$=Vue.ref(0),_=Vue.ref(0),P=O=>O==null||O===""?"":cp(O,v.value||""),T=Vue.ref(parseInt(localStorage.getItem("gitDiffFontSize"))||12),I=O=>{T.value=Math.max(8,Math.min(24,O)),localStorage.setItem("gitDiffFontSize",T.value.toString())},M=()=>I(T.value+1),B=()=>I(T.value-1),F=O=>{O.deltaY<0?M():O.deltaY>0&&B()},z=Vue.computed(()=>{let O=y.value;if(!O||O.length===0)return[];let E=O.length,J=[],se=0;for(;se<E;){let me=O[se];if(me.type==="addition"||me.type==="deletion"||me.type==="modification"){let K=me.type==="modification"?"modification":me.type,ee=se;for(;se<E&&(O[se].type===K||O[se].type==="modification"&&K!=="modification");)se++;let fe=se-ee;J.push({type:K,top:ee/E*100,height:Math.max(fe/E*100,.5)})}else se++}return J}),ne=O=>{let E=r.value;if(!E)return;let J=O.currentTarget.getBoundingClientRect(),se=(O.clientY-J.top)/J.height;E.scrollTop=se*(E.scrollHeight-E.clientHeight)},ve=Vue.computed(()=>u.value.filter(O=>O.indexStatus!==" "&&O.indexStatus!=="?")),ue=Vue.computed(()=>u.value.filter(O=>O.workTreeStatus==="M"||O.workTreeStatus==="D")),be=Vue.computed(()=>u.value.filter(O=>O.indexStatus==="?"&&O.workTreeStatus==="?")),oe=fp(e,{effectiveGitWorkDir:g,gitOperating:R,gitOpFeedback:U,commitMessage:L}),Ce=()=>oe.loadGitStatus(l,c),x=()=>{Ce()},j=mp(e,g),ae=O=>Ki(O),he=()=>j.confirmFolderPicker(f,Ce),W=(O,E)=>{v.value=O.path,m.value=E,A.value=!0,w.value="",k.value=null,y.value=[],h.value=null;let J=O.indexStatus==="?"&&O.workTreeStatus==="?";e.sendWsMessage({type:"git_diff",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,workDir:g.value,filePath:O.path,staged:E,untracked:J,fullFile:b.value,_clientId:e.clientId})},te=()=>{if(b.value=!b.value,v.value){let O=u.value.find(E=>E.path===v.value);O&&W(O,m.value)}},Y=O=>{let E=O.detail;if(E)switch(E.type){case"directory_listing":{if(j.handleDirectoryListing(E))return;break}case"git_status_result":{if(l.value=!1,E.error){c.value=E.error,d.value=null,u.value=[];return}if(c.value="",d.value=E.branch||"HEAD",u.value=E.files||[],$.value=E.ahead||0,_.value=E.behind||0,v.value){let J=u.value.find(se=>se.path===v.value);if(J){let se=J.indexStatus!==" "&&J.indexStatus!=="?";m.value=se}else v.value=null,k.value=null,y.value=[],h.value=null}break}case"git_diff_result":{if(A.value=!1,E.error){w.value=E.error;return}w.value="";let J=up(E.diff,E.newFileContent,t);h.value=J.stats,y.value=J.lines,k.value=J.content;break}case"git_op_result":{oe.handleGitOpResult(E,Ce);break}}};Vue.watch(()=>e.currentAgent,()=>{d.value=null,u.value=[],c.value="",v.value=null,k.value=null,e.currentAgent&&Vue.nextTick(()=>Ce())}),Vue.watch(()=>e.currentConversation,()=>{e.currentAgent&&(v.value=null,k.value=null,y.value=[],h.value=null,Vue.nextTick(()=>Ce()))});let N=()=>Ce();return Vue.onMounted(()=>{window.addEventListener("workbench-message",Y),e.currentAgent&&Ce()}),Vue.onUnmounted(()=>{window.removeEventListener("workbench-message",Y),oe.cleanup()}),{store:e,getFileName:s,getDirName:n,getFileIconHtml:i,hlLine:P,collapsedGroups:o,toggleGroup:a,gitLoading:l,gitError:c,gitBranch:d,gitFiles:u,gitWorkDir:f,defaultWorkDir:p,changeGitWorkDir:x,stagedFiles:ve,modifiedFiles:ue,untrackedFiles:be,selectedGitFile:v,selectedStaged:m,diffLoading:A,diffError:w,diffContent:k,diffLines:y,diffStats:h,diffFullFile:b,toggleDiffMode:te,scrollMarkers:z,diffScrollContainer:r,onMarkerClick:ne,fontSize:T,zoomIn:M,zoomOut:B,onWheel:F,gitOperating:R,commitMessage:L,gitOpFeedback:U,gitAhead:$,gitBehind:_,stageFile:oe.stageFile,unstageFile:oe.unstageFile,discardFile:oe.discardFile,stageAll:oe.stageAll,unstageAll:oe.unstageAll,commitChanges:oe.commitChanges,pushChanges:oe.pushChanges,selectGitFile:W,refresh:N,folderPickerOpen:j.folderPickerOpen,folderPickerPath:j.folderPickerPath,folderPickerEntries:j.folderPickerEntries,folderPickerLoading:j.folderPickerLoading,folderPickerSelected:j.folderPickerSelected,getFolderIcon:ae,openFolderPicker:j.openFolderPicker,folderPickerNavigateUp:j.folderPickerNavigateUp,folderPickerSelectItem:j.folderPickerSelectItem,folderPickerEnter:j.folderPickerEnter,confirmFolderPicker:he}}}});function bp(e){let t=Vue.ref(!1),s=Vue.ref(!1),n=Vue.ref(""),i=Vue.ref(""),r=Vue.ref(!1),o=Vue.ref(!1),a=Vue.ref(0),l=Vue.ref(-1),c=Vue.ref(null),d=Vue.ref(null),u=[],p=[],f=()=>{let $=e.value?.cmInstance;if(!$)return;let P=$.getWrapperElement().querySelector(".cm-find-scrollbar-annotations");P&&P.remove()},g=()=>{let $=e.value?.cmInstance;if(!$||p.length===0)return;f();let _=$.getWrapperElement();if(!_.querySelector(".CodeMirror-vscrollbar"))return;let T=$.lineCount();if(T===0)return;let I=document.createElement("div");I.className="cm-find-scrollbar-annotations";for(let M of p){let B=M.from.line/T*100,F=document.createElement("div");F.className="cm-find-scrollbar-tick",F.style.top=B+"%",I.appendChild(F)}_.appendChild(I)},v=()=>{for(let $ of u)try{$.clear()}catch{}u=[],p=[],a.value=0,l.value=-1,f()},m=$=>{let _=e.value?.cmInstance;if(!_||!p[$])return;for(let T=0;T<u.length;T++){if(!u[T])continue;let I=u[T].find();I&&(u[T].clear(),u[T]=_.markText(I.from,I.to,{className:"cm-find-highlight"}))}let P=p[$];if(u[$]){let T=u[$].find();T&&(u[$].clear(),u[$]=_.markText(T.from,T.to,{className:"cm-find-highlight cm-find-current"}))}setTimeout(()=>{_.scrollIntoView({from:P.from,to:P.to},100)},0)},A=()=>{v();let $=e.value?.cmInstance;if(!$||!n.value)return;let _=n.value;if(_.length<3)return;let P=$.getValue(),T=r.value,I=o.value,M=[];try{if(I){let B=T?"g":"gi",F=new RegExp(_,B),z;for(;(z=F.exec(P))!==null;){if(z[0].length===0){F.lastIndex++;continue}let ne=$.posFromIndex(z.index),ve=$.posFromIndex(z.index+z[0].length);if(M.push({from:ne,to:ve}),M.length>1e4)break}}else{let B=T?_:_.toLowerCase(),F=T?P:P.toLowerCase(),z=0;for(;(z=F.indexOf(B,z))!==-1;){let ne=$.posFromIndex(z),ve=$.posFromIndex(z+_.length);if(M.push({from:ne,to:ve}),z+=_.length,M.length>1e4)break}}}catch{return}p=M,a.value=M.length;for(let B of M)u.push($.markText(B.from,B.to,{className:"cm-find-highlight"}));if(M.length>0){let B=$.getCursor(),F=0;for(let z=0;z<M.length;z++){if(CodeMirror.cmpPos(M[z].from,B)>=0){F=z;break}z===M.length-1&&(F=0)}l.value=F,m(F)}g()};return{findBarVisible:t,replaceBarVisible:s,findQuery:n,replaceQuery:i,findCaseSensitive:r,findUseRegex:o,findMatchCount:a,findMatchIndex:l,findInputRef:c,replaceInputRef:d,clearFindMarkers:v,performFind:A,onFindInput:()=>{A()},findNext:()=>{if(p.length===0)return;let $=(l.value+1)%p.length;l.value=$,m($)},findPrev:()=>{if(p.length===0)return;let $=(l.value-1+p.length)%p.length;l.value=$,m($)},openFindBar:($=!1)=>{t.value=!0,s.value=$;let _=e.value?.cmInstance;if(_){let P=_.getSelection();P&&(n.value=P)}Vue.nextTick(()=>{c.value?.focus(),c.value?.select(),n.value&&A()})},closeFindBar:()=>{v(),t.value=!1,s.value=!1;let $=e.value?.cmInstance;$&&$.focus()},toggleReplaceBar:()=>{s.value=!s.value,s.value&&Vue.nextTick(()=>d.value?.focus())},replaceOne:()=>{let $=e.value?.cmInstance;if(!$||p.length===0||l.value<0)return;let _=p[l.value];$.replaceRange(i.value,_.from,_.to),A()},replaceAll:()=>{let $=e.value?.cmInstance;!$||p.length===0||($.operation(()=>{for(let _=p.length-1;_>=0;_--)$.replaceRange(i.value,p[_].from,p[_].to)}),A())}}}var wp=H(()=>{});function kp(e,t){let{getEffectiveWorkDir:s,treePath:n}=t,i=Vue.reactive(new Set),r=Vue.ref(-1),o=Vue.ref(!1),a=Vue.ref(null),l=null,c=null,d=Vue.ref(!1),u=Vue.ref(""),p=Vue.ref("file"),f=Vue.ref(null),g=Vue.ref(!1),v=Vue.ref(""),m=Vue.ref(null),A=Vue.reactive({visible:!1,x:0,y:0,entry:null}),w=Vue.ref(!1),k=Vue.ref(""),y=Vue.ref(null),h=null,b=Vue.reactive({dragging:null,dropTarget:null}),R=Vue.ref(!1),L=(K,ee)=>{l&&clearTimeout(l),a.value={ok:K,message:ee},l=setTimeout(()=>{a.value=null},4e3)},U=()=>{o.value=!0,c&&clearTimeout(c),c=setTimeout(()=>{o.value&&(o.value=!1,L(!1,"Operation timed out"))},15e3)},$=K=>{i.has(K)?i.delete(K):i.add(K)},_=()=>{i.clear(),r.value=-1},P=K=>{p.value=K,u.value="",d.value=!0,Vue.nextTick(()=>f.value?.focus())},T=()=>{let K=u.value.trim();if(!K)return;d.value=!1;let ee=n.value||s();if(!ee)return;let fe=ee.includes("\\")?"\\":"/",le=ee.replace(/[/\\]$/,"")+fe+K;U(),e.sendWsMessage({type:"create_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:le,isDirectory:p.value==="directory",workDir:s(),_clientId:e.clientId})},I=(K,ee)=>{let fe=K.path.split("/").pop();confirm(ee("files.deleteConfirm",{name:fe})+(K.type==="directory"?ee("files.deleteDirHint"):""))&&(U(),e.sendWsMessage({type:"delete_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[K.path],workDir:s(),_clientId:e.clientId}))},M=K=>{let ee=i.size;ee!==0&&confirm(K("files.deleteSelectedConfirm",{count:ee}))&&(U(),e.sendWsMessage({type:"delete_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[...i],workDir:s(),_clientId:e.clientId}))},B=()=>{v.value=n.value||s()||"",g.value=!0,Vue.nextTick(()=>m.value?.focus())},F=()=>{let K=v.value.trim();!K||i.size===0||(g.value=!1,U(),e.sendWsMessage({type:"move_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[...i],destination:K,workDir:s(),_clientId:e.clientId}))},z=(K,ee)=>{let Re=K.clientX,De=K.clientY;Re+180>window.innerWidth&&(Re=window.innerWidth-180),De+240>window.innerHeight&&(De=window.innerHeight-240),A.entry=ee,A.x=Re,A.y=De,A.visible=!0},ne=()=>{A.visible=!1};return{selectedPaths:i,lastClickedIndex:r,fileOperating:o,fileOpFeedback:a,newFileDialogVisible:d,newFileName:u,newFileType:p,newFileInput:f,moveDialogVisible:g,moveDestination:v,moveDestInput:m,contextMenu:A,renameDialogVisible:w,renameNewName:k,renameInput:y,dragState:b,externalDropActive:R,showFileOpFeedback:L,toggleSelection:$,clearSelection:_,showNewFileDialog:P,confirmNewFile:T,deleteSingleFile:I,deleteSelected:M,openMoveDialog:B,confirmMove:F,showContextMenu:z,hideContextMenu:ne,ctxRename:()=>{let K=A.entry;ne(),K&&(k.value=K.name,w.value=!0,Vue.nextTick(()=>{let ee=y.value;if(ee)if(ee.focus(),K.type==="file"){let fe=K.name.lastIndexOf(".");fe>0?ee.setSelectionRange(0,fe):ee.select()}else ee.select()}))},confirmRename:()=>{let K=A.entry,ee=k.value.trim();if(!ee||!K||ee===K.name){w.value=!1;return}w.value=!1;let fe=K.path.replace(/\/$/,"").split("/");fe.pop();let le=fe.join("/")||"/";U(),e.sendWsMessage({type:"move_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[K.path],destination:le,newName:ee,workDir:s(),_clientId:e.clientId})},ctxCopy:()=>{let K=A.entry;if(ne(),!K)return;let ee=K.path.replace(/\/$/,"").split("/");ee.pop();let fe=ee.join("/")||"/";U(),e.sendWsMessage({type:"copy_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[K.path],destination:fe,workDir:s(),_clientId:e.clientId})},ctxMoveTo:()=>{let K=A.entry;ne(),K&&(i.clear(),i.add(K.path),B())},ctxDelete:K=>{let ee=A.entry;ne(),ee&&I(ee,K)},ctxDownload:()=>{let K=A.entry;ne(),!(!K||K.type!=="file")&&(h=K.path,e.sendWsMessage({type:"read_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:K.path,workDir:s(),_clientId:e.clientId}))},onDragStart:(K,ee)=>{b.dragging=ee,K.dataTransfer.setData("text/plain",ee.path),K.dataTransfer.effectAllowed="move"},onDragOver:(K,ee)=>{if(!b.dragging&&K.dataTransfer.types.includes("Files")){ee.type==="directory"&&(K.dataTransfer.dropEffect="copy",b.dropTarget=ee.path);return}!b.dragging||ee.type!=="directory"||ee.path!==b.dragging.path&&(ee.path.startsWith(b.dragging.path+"/")||(K.dataTransfer.dropEffect="move",b.dropTarget=ee.path))},onDragLeave:K=>{let ee=K.relatedTarget;ee&&K.currentTarget.contains(ee)||(b.dropTarget=null)},onDrop:(K,ee,fe)=>{if(b.dropTarget=null,!b.dragging&&K.dataTransfer.files.length>0&&ee.type==="directory"){fe(K.dataTransfer.files,ee.path);return}if(!b.dragging||ee.type!=="directory"){b.dragging=null;return}if(ee.path===b.dragging.path){b.dragging=null;return}U(),e.sendWsMessage({type:"move_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[b.dragging.path],destination:ee.path,workDir:s(),_clientId:e.clientId}),b.dragging=null},onTreeDragOver:K=>{b.dragging||K.dataTransfer.types.includes("Files")&&(K.dataTransfer.dropEffect="copy",R.value=!0)},onTreeDragLeave:K=>{let ee=K.relatedTarget;ee&&K.currentTarget.contains(ee)||(R.value=!1)},onTreeDrop:(K,ee,fe)=>{if(R.value=!1,!b.dragging&&K.dataTransfer.files.length>0){let le=n.value||ee||s();fe(K.dataTransfer.files,le)}},handleExternalFileDrop:async(K,ee)=>{if(!ee)return;let fe=[],le=[];for(let Re of K)le.push(new Promise(De=>{let Ve=new FileReader;Ve.onload=()=>{let We=btoa(new Uint8Array(Ve.result).reduce((Mt,pt)=>Mt+String.fromCharCode(pt),""));fe.push({name:Re.name,data:We}),De()},Ve.onerror=()=>De(),Ve.readAsArrayBuffer(Re)}));await Promise.all(le),fe.length!==0&&(o.value=!0,c&&clearTimeout(c),c=setTimeout(()=>{o.value&&(o.value=!1,L(!1,"Upload timed out"))},3e4),e.sendWsMessage({type:"upload_to_dir",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,files:fe,dirPath:ee,workDir:s(),_clientId:e.clientId}))},handleFileOpResult:(K,ee,fe)=>{o.value=!1,c&&(clearTimeout(c),c=null),L(K.success,K.success?K.message:K.error||"Operation failed"),K.success&&(fe&&ee(fe),(K.operation==="delete"||K.operation==="move")&&(i.clear(),r.value=-1))},getPendingDownload:()=>h,clearPendingDownload:()=>{h=null},cleanup:()=>{l&&clearTimeout(l),c&&clearTimeout(c)}}}var Sp=H(()=>{});function Cp(e,{getEffectiveWorkDir:t,normalizePath:s,selectedPaths:n,lastClickedIndex:i,openFileInTab:r,clearSelection:o}){let a=Vue.ref(""),l=Vue.ref(""),c=Vue.reactive({}),d=Vue.ref(!1),u=Vue.ref(null),p=Vue.computed(()=>{if(!l.value)return"EXPLORER";let P=l.value.replace(/[\\/]+$/,"").split(/[\\/]/);return(P[P.length-1]||l.value).toUpperCase()}),f=Vue.computed(()=>l.value?!!c[l.value]?.expanded:!1),g=()=>{if(!l.value)return;let P=c[l.value];P&&(P.expanded=!P.expanded)},v=()=>{for(let P of Object.keys(c))c[P]&&(c[P].expanded=!1)},m=()=>{d.value=!0,Vue.nextTick(()=>u.value?.focus())},A=()=>{d.value=!1,h()},w=()=>{d.value=!1},k=Vue.computed(()=>{let P=[],T=(I,M)=>{let B=c[I];if(!(!B||!B.entries))for(let F of B.entries)P.push({...F,depth:M}),F.type==="directory"&&c[F.path]?.expanded&&T(F.path,M+1)};return l.value&&c[l.value]?.expanded&&T(l.value,0),P}),y=P=>{let T=s(P);c[T]?c[T].loading=!0:c[T]={entries:[],expanded:!0,loaded:!1,loading:!0},e.sendWsMessage({type:"list_directory",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,dirPath:P,workDir:t(),_clientId:e.clientId})},h=()=>{let P=a.value.trim();if(!P)return;let T=s(P);l.value=T,Object.keys(c).forEach(I=>delete c[I]),c[T]={entries:[],expanded:!0,loaded:!1,loading:!0},e.sendWsMessage({type:"list_directory",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,dirPath:P,workDir:t(),_clientId:e.clientId})},b=P=>{let T=s(P),I=c[T];I?I.loaded?I.expanded=!I.expanded:(I.expanded=!0,y(P)):(c[T]={entries:[],expanded:!0,loaded:!1,loading:!1},y(P))},R=(P,T)=>{let I=k.value,M=I.findIndex(B=>B.path===P.path);if(T&&(T.shiftKey||T.ctrlKey||T.metaKey)){if(T.shiftKey&&i.value>=0&&M>=0){let B=Math.min(i.value,M),F=Math.max(i.value,M);!T.ctrlKey&&!T.metaKey&&n.clear();for(let z=B;z<=F;z++)n.add(I[z].path)}else n.has(P.path)?n.delete(P.path):n.add(P.path);i.value=M;return}n.size>0&&(n.clear(),i.value=-1),P.type==="directory"?b(P.path):r(P.path,P.name),i.value=M},L=P=>{let T=s(P.dirPath);if(P.error){c[T]&&(c[T].loading=!1);return}let I=(P.entries||[]).sort((F,z)=>F.type===z.type?F.name.localeCompare(z.name):F.type==="directory"?-1:1),M=T.replace(/\/$/,""),B=I.map(F=>({...F,path:M+"/"+F.name}));c[T]?(c[T].entries=B,c[T].loaded=!0,c[T].loading=!1):c[T]={entries:B,expanded:!0,loaded:!0,loading:!1},T===l.value&&(a.value=P.dirPath)},U=()=>{Object.keys(c).forEach(P=>delete c[P])};return{treePath:a,treeRootPath:l,treeNodes:c,flattenedTree:k,editingTreePath:d,treePathInputRef:u,rootFolderName:p,rootExpanded:f,toggleRootExpand:g,collapseAll:v,startTreePathEdit:m,confirmTreePath:A,cancelTreePathEdit:w,loadTreeDirectory:y,loadRootDirectory:h,toggleDirectory:b,onTreeItemClick:R,handleDirectoryListing:L,clearTreeNodes:U,initFileBrowser:()=>{let P=t();if(P){let T=s(P);a.value=P,l.value=T,U(),y(P)}},refresh:()=>{l.value&&y(l.value)}}}var Ip=H(()=>{});function Hs(e){let t=e.lastIndexOf(".");if(t<0)return"text";let s=e.substring(t).toLowerCase();return rv.has(s)?"office":ov.has(s)?"pdf":av.has(s)?"image":"text"}function Tt(e){let t=e.lastIndexOf(".");return t<0?!1:lv.has(e.substring(t).toLowerCase())}function cv(e){let t=e.split(".").pop()?.toLowerCase();return{js:"javascript",mjs:"javascript",jsx:"javascript",ts:{name:"javascript",typescript:!0},tsx:{name:"javascript",typescript:!0},json:{name:"javascript",json:!0},py:"python",html:"htmlmixed",htm:"htmlmixed",vue:"htmlmixed",xml:"xml",svg:"xml",css:"css",scss:"css",less:"css",sh:"shell",bash:"shell",zsh:"shell",c:"text/x-csrc",h:"text/x-csrc",cpp:"text/x-c++src",hpp:"text/x-c++src",cs:"text/x-csharp",java:"text/x-java",md:"markdown",markdown:"markdown"}[t]||"text/plain"}function Ap(e,{activeFile:t,editorContainer:s,fontSize:n,clearFindMarkers:i,openFindBar:r,saveFile:o}){let a=Vue.ref(""),l=Vue.reactive({}),c=()=>{},d=()=>{},u=({openQuickOpen:w,openGoToLine:k})=>{c=w,d=k},p=(w,k=0)=>{if(!s.value){k<20&&setTimeout(()=>p(w,k+1),100);return}if(!w)return;if(s.value.innerHTML="",typeof CodeMirror>"u"){let b=document.createElement("textarea");b.value=w.content||"",b.style.cssText="width:100%;height:100%;border:none;outline:none;resize:none;padding:12px;font-family:monospace;font-size:12px;background:var(--bg-main);color:var(--text-main);white-space:pre;tab-size:4;",b.spellcheck=!1,b.addEventListener("input",()=>{w.content=b.value,w.isDirty=b.value!==w.originalContent}),b.addEventListener("keydown",R=>{(R.ctrlKey||R.metaKey)&&R.key==="s"&&(R.preventDefault(),o())}),s.value.appendChild(b),a.value="";return}let h=document.documentElement.getAttribute("data-theme")==="dark"?"material-darker":"default";try{let b=CodeMirror(s.value,{value:w.content||"",mode:cv(w.name),theme:h,lineNumbers:!0,tabSize:4,indentWithTabs:!1,lineWrapping:!1,readOnly:!1,extraKeys:{"Ctrl-S":()=>o(),"Cmd-S":()=>o(),"Ctrl-P":()=>c(),"Cmd-P":()=>c(),"Ctrl-G":()=>d(),"Cmd-G":()=>d(),"Ctrl-F":()=>r(!1),"Cmd-F":()=>r(!1),"Ctrl-R":()=>r(!0),"Cmd-R":()=>r(!0),"Ctrl-H":()=>r(!0),"Cmd-H":()=>r(!0)}});b.on("change",()=>{let L=b.getValue();w.content=L,w.isDirty=L!==w.originalContent}),w.cmInstance=b,b.getWrapperElement().style.fontSize=n.value+"px";let R=e.currentConversation;R&&l[R]?.[w.path]&&b.setHistory(l[R][w.path]),Vue.nextTick(()=>{b.refresh(),setTimeout(()=>b.refresh(),200)}),a.value=""}catch(b){a.value=`Editor error: ${b.message}`}};return{debugStatus:a,undoHistoryMap:l,createEditor:p,destroyEditor:()=>{i();let w=t.value;w?.cmInstance&&(w.cmInstance.toTextArea&&w.cmInstance.toTextArea(),w.cmInstance=null),s.value&&(s.value.innerHTML="")},setKeyBindings:u,saveCurrentUndoHistory:()=>{let w=e.currentConversation;if(!w)return;let k=t.value;k?.cmInstance&&(l[w]||(l[w]={}),l[w][k.path]=k.cmInstance.getHistory())},saveAllUndoHistory:w=>{if(!w)return;let k=t.value;k?.cmInstance&&(l[w]||(l[w]={}),l[w][k.path]=k.cmInstance.getHistory())},cleanupUndoHistory:(w,k)=>{w&&l[w]&&delete l[w][k]},deleteConversationHistory:w=>{delete l[w]}}}var rv,ov,av,lv,Pn=H(()=>{rv=new Set([".docx",".xlsx",".xls",".pptx",".ppt"]),ov=new Set([".pdf"]),av=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico"]),lv=new Set([".md",".markdown",".mdx"])});function xp(e,{editorContainer:t,createEditor:s,t:n}){let i=Vue.ref(!0),r=Vue.ref(null),o=Vue.ref(null),a=Vue.computed(()=>{let f=e.value;return!!(f&&Tt(f.name))}),l=Vue.computed(()=>{let f=e.value;if(!f||!Tt(f.name)||f.content==null)return"";try{if(typeof marked<"u")return marked.parse(f.content)}catch{}return"<pre>"+(f.content||"")+"</pre>"});function c(){Ye(r.value)}async function d(){await Ye(r.value)}function u(){i.value=!1,Vue.nextTick(()=>{let f=e.value;f&&t.value&&s(f)})}return{mdPreviewMode:i,mdPreviewRef:r,officePreviewContainer:o,isActiveMarkdown:a,mdRenderedHtml:l,initMermaid:c,renderMermaidBlocks:d,switchToMdEdit:u,renderOfficeLocal:f=>{let g=o.value;if(!g||!f._arrayBuffer)return;g.innerHTML="";let v=("."+f.name.split(".").pop()).toLowerCase();if(v===".docx"&&window.docx)window.docx.renderAsync(f._arrayBuffer,g,null,{className:"docx-preview-content",inWrapper:!0,ignoreWidth:!1,ignoreHeight:!0}).catch(m=>{f.previewError=m.message});else if(v===".xlsx"||v===".xls")try{let m=XLSX.read(f._arrayBuffer,{type:"array"}),A=m.SheetNames[0],w=XLSX.utils.sheet_to_html(m.Sheets[A],{editable:!1});g.innerHTML='<div class="xlsx-sheet-tabs">'+m.SheetNames.map((k,y)=>`<button class="xlsx-sheet-tab${y===0?" active":""}" data-idx="${y}">${k}</button>`).join("")+'</div><div class="xlsx-table-wrap">'+w+"</div>",g.querySelectorAll(".xlsx-sheet-tab").forEach(k=>{k.addEventListener("click",()=>{let y=parseInt(k.dataset.idx),h=m.SheetNames[y],b=XLSX.utils.sheet_to_html(m.Sheets[h],{editable:!1});g.querySelector(".xlsx-table-wrap").innerHTML=b,g.querySelectorAll(".xlsx-sheet-tab").forEach(R=>R.classList.remove("active")),k.classList.add("active")})})}catch(m){f.previewError=m.message}else(v===".pptx"||v===".ppt")&&(g.innerHTML='<div class="preview-unsupported">'+(n?n("files.pptxNotSupported"):"PowerPoint preview not supported")+"</div>")}}}var Tp=H(()=>{wn();Pn()});function Mp(e,{getEffectiveWorkDir:t,treePath:s,openFileInTab:n,normalizePath:i,treeRootPath:r,treeNodes:o,loadTreeDirectory:a}){let l=Vue.ref(""),c=Vue.ref([]),d=Vue.ref(!1),u=null,p=Vue.ref(!1),f=Vue.ref(""),g=Vue.ref([]),v=Vue.ref(0),m=Vue.ref(!1),A=Vue.ref(null),w=null,k=Vue.ref(!1),y=Vue.ref(""),h=Vue.ref(null),b=ue=>{!e.currentAgent||!ue.trim()||e.sendWsMessage({type:"file_search",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,query:ue.trim(),dirPath:s.value||t()||"",_clientId:e.clientId})},R=()=>{if(u&&clearTimeout(u),!l.value.trim()){c.value=[],d.value=!1;return}d.value=!0,u=setTimeout(()=>{b(l.value)},300)},L=()=>{l.value="",c.value=[],d.value=!1},U=ue=>{if(ue.type==="directory"){let be=i(ue.fullPath);r.value=be,s.value=ue.fullPath,Object.keys(o).forEach(oe=>delete o[oe]),a(ue.fullPath),L()}else n(ue.fullPath,ue.name),L()},$=()=>{p.value=!0,f.value="",g.value=[],v.value=0,m.value=!1,Vue.nextTick(()=>A.value?.focus())},_=()=>{p.value=!1,f.value="",g.value=[]},P=()=>{if(w&&clearTimeout(w),!f.value.trim()){g.value=[],m.value=!1;return}m.value=!0,v.value=0,w=setTimeout(()=>{b(f.value)},200)},T=()=>{g.value.length>0&&(v.value=(v.value+1)%g.value.length)},I=()=>{g.value.length>0&&(v.value=(v.value-1+g.value.length)%g.value.length)},M=ue=>{ue.type!=="directory"&&n(ue.fullPath,ue.name),_()},B=()=>{let ue=g.value[v.value];ue&&M(ue)},F=()=>{k.value=!0,y.value="",Vue.nextTick(()=>h.value?.focus())},z=()=>{k.value=!1,y.value=""};return{searchQuery:l,searchResults:c,searchLoading:d,onSearchInput:R,clearSearch:L,onSearchResultClick:U,quickOpenVisible:p,quickOpenQuery:f,quickOpenResults:g,quickOpenSelectedIndex:v,quickOpenLoading:m,quickOpenInput:A,openQuickOpen:$,closeQuickOpen:_,onQuickOpenInput:P,quickOpenSelectNext:T,quickOpenSelectPrev:I,quickOpenConfirm:B,quickOpenOpenFile:M,goToLineVisible:k,goToLineValue:y,goToLineInput:h,openGoToLine:F,closeGoToLine:z,goToLineConfirm:ue=>{let be=parseInt(y.value);if(isNaN(be)||be<1)return;let oe=ue.value;if(oe?.cmInstance){let Ce=oe.cmInstance,x=Math.min(be-1,Ce.lineCount()-1);Ce.setCursor({line:x,ch:0}),Ce.scrollIntoView({line:x,ch:0},100),Ce.focus()}z()},handleFileSearchResult:ue=>{let be=ue.results||[];p.value?ue.query&&ue.query.trim()===f.value.trim()&&(g.value=be,m.value=!1,v.value=0):ue.query&&ue.query.trim()===l.value.trim()&&(c.value=be,d.value=!1)}}}var Pp=H(()=>{});function Rp(e,{getEffectiveWorkDir:t,treePath:s,treeRootPath:n,treeNodes:i,normalizePath:r,loadTreeDirectory:o}){let a=Vue.ref(!1),l=Vue.ref(""),c=Vue.ref([]),d=Vue.ref(!1),u=Vue.ref(""),p=()=>{a.value=!0,u.value="",d.value=!0;let k=s.value||t()||"";l.value=k,c.value=[],e.sendWsMessage({type:"list_directory",conversationId:"_folder_picker",agentId:e.currentAgent,dirPath:k,workDir:t(),_clientId:e.clientId})},f=k=>{d.value=!0,u.value="",e.sendWsMessage({type:"list_directory",conversationId:"_folder_picker",agentId:e.currentAgent,dirPath:k,workDir:t(),_clientId:e.clientId})};return{folderPickerOpen:a,folderPickerPath:l,folderPickerEntries:c,folderPickerLoading:d,folderPickerSelected:u,openFolderPicker:p,folderPickerNavigateUp:()=>{if(!l.value)return;let k=l.value.includes("\\"),y=k?"\\":"/",h=l.value.replace(/[/\\]$/,"").split(/[/\\]/);if(h.pop(),h.length===0)l.value="",f("");else if(k&&h.length===1&&/^[A-Za-z]:$/.test(h[0]))l.value=h[0]+"\\",f(h[0]+"\\");else{let b=h.join(y);l.value=b,f(b)}},folderPickerSelectItem:k=>{u.value=k.name},folderPickerEnter:k=>{let y;if(!l.value)y=k.name+(k.name.endsWith("\\")?"":"\\");else{let h=l.value.includes("\\")||/^[A-Z]:/.test(k.name)?"\\":"/";y=l.value.replace(/[/\\]$/,"")+h+k.name}l.value=y,f(y)},confirmFolderPicker:()=>{let k=l.value;if(!k)return;if(u.value){let h=k.includes("\\")?"\\":"/";k=k.replace(/[/\\]$/,"")+h+u.value}s.value=k,a.value=!1;let y=r(k);n.value=y,Object.keys(i).forEach(h=>delete i[h]),i[y]={entries:[],expanded:!0,loaded:!1,loading:!0},e.sendWsMessage({type:"list_directory",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,dirPath:k,workDir:t(),_clientId:e.clientId})},handleFolderPickerListing:k=>{d.value=!1,c.value=(k.entries||[]).filter(y=>y.type==="directory").sort((y,h)=>y.name.localeCompare(h.name)),k.dirPath!=null&&(l.value=k.dirPath)}}}var _p=H(()=>{});function Dp(e,{normalizePath:t,getEffectiveWorkDir:s,editorContainer:n,createEditor:i,destroyEditor:r,clearFindMarkers:o,saveCurrentUndoHistory:a,saveAllUndoHistory:l,cleanupUndoHistory:c,deleteConversationHistory:d,debugStatus:u,mdPreviewMode:p,renderOfficeLocal:f,performFind:g,findBarVisible:v,findQuery:m,t:A}){let w=Vue.reactive({}),k=Vue.ref([]),y=Vue.ref(-1),h=Vue.ref(!1),b=Vue.ref(!1),R=Vue.computed(()=>y.value>=0&&y.value<k.value.length?k.value[y.value]:null),L=null,U=()=>{L&&clearTimeout(L),L=setTimeout(()=>{e.sendWsMessage({type:"update_file_tabs",openFiles:k.value.map(F=>({path:F.path})),activeIndex:y.value})},500)},$=F=>{F&&(l(F),k.value.length>0?w[F]={files:k.value.map(z=>({path:z.path,name:z.name,content:z.content,originalContent:z.originalContent,isDirty:z.isDirty,fileType:z.fileType})),activeIndex:y.value}:delete w[F],U())},_=F=>{if(r(),!F||!w[F]){k.value=[],y.value=-1;return}let z=w[F];k.value=z.files.map(ne=>({...ne,isDirty:ne.isDirty||!1,originalContent:ne.originalContent||ne.content,cmInstance:null,fileType:ne.fileType||Hs(ne.name||""),blobUrl:null,previewUrl:null,previewLoading:!1,localPreviewReady:!1,previewError:null})),y.value=z.activeIndex,Vue.nextTick(()=>{let ne=R.value;ne&&(!ne.fileType||ne.fileType==="text")&&n.value&&i(ne)})};function P(F,z){let ne=t(F),ve=k.value.findIndex(oe=>oe.path===ne);if(ve>=0){y.value!==ve&&(o(),a(),y.value=ve,Vue.nextTick(()=>{let oe=k.value[ve];oe&&oe.content!=null&&(!oe.fileType||oe.fileType==="text")&&i(oe)})),$(e.currentConversation);return}a();let ue=z||ne.split(/[/\\]/).pop(),be=Hs(ue);k.value.push({path:ne,name:ue,content:null,originalContent:null,isDirty:!1,cmInstance:null,fileType:be,blobUrl:null,previewUrl:null,previewLoading:be!=="text",localPreviewReady:!1,previewError:null}),y.value=k.value.length-1,h.value=!0,be==="text"&&r(),$(e.currentConversation),u.value=`Loading: ${F}`,e.sendWsMessage({type:"read_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:F,workDir:s(),_clientId:e.clientId})}let T=F=>{F!==y.value&&(o(),a(),y.value=F,$(e.currentConversation),Vue.nextTick(()=>{let z=k.value[F];z&&(!z.fileType||z.fileType==="text"?Tt(z.name)?p.value=!0:z.content!=null&&n.value&&(i(z),v.value&&m.value&&Vue.nextTick(()=>g())):z.fileType==="office"&&z.localPreviewReady&&Vue.nextTick(()=>f(z)))}))},I=F=>{let z=k.value[F];if(z?.isDirty&&!confirm(A("files.unsavedConfirm",{name:z.name})))return;c(e.currentConversation,z.path),z.blobUrl&&URL.revokeObjectURL(z.blobUrl);let ne=F===y.value;k.value.splice(F,1),k.value.length===0?(y.value=-1,r()):y.value>=k.value.length?y.value=k.value.length-1:y.value>F?y.value--:ne&&y.value>=k.value.length&&(y.value=k.value.length-1),$(e.currentConversation),k.value.length>0&&ne&&Vue.nextTick(()=>{let ve=k.value[y.value];ve&&(!ve.fileType||ve.fileType==="text")&&ve.content!=null&&n.value&&i(ve)})};function M(){let F=R.value;!F||!F.isDirty||(b.value=!0,e.sendWsMessage({type:"write_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:F.path,content:F.content,workDir:s(),_clientId:e.clientId}))}return{fileTabsMap:w,openFiles:k,activeFileIndex:y,activeFile:R,fileLoading:h,fileSaving:b,saveTabsState:$,restoreTabsState:_,openFileInTab:P,switchToTab:T,closeFileTab:I,saveFile:M,handleConversationDeleted:F=>{let{conversationId:z}=F.detail;z&&(delete w[z],d(z))}}}var Ep=H(()=>{Pn()});function Lp({store:e,normalizePath:t,getEffectiveWorkDir:s,openFiles:n,activeFileIndex:i,activeFile:r,fileLoading:o,fileSaving:a,saveTabsState:l,createEditor:c,openFileInTab:d,tree:u,fp:p,qo:f,ops:g,mdPreviewMode:v,renderOfficeLocal:m,editorContainer:A,debugStatus:w}){return{handleWorkbenchMessage:h=>{let b=h.detail;if(b)switch(b.type){case"directory_listing":{if(b.conversationId==="_folder_picker"){p.handleFolderPickerListing(b);return}u.handleDirectoryListing(b);break}case"file_content":{if(o.value=!1,b.error){w.value=`Error: ${b.error}`,g.clearPendingDownload();let U=t(b.filePath),$=n.value.find(_=>_.path===U);$&&($.previewLoading=!1,$.previewError=b.error);return}let R=t(b.filePath);if(g.getPendingDownload()&&t(g.getPendingDownload())===R){g.clearPendingDownload();try{if(b.binary){let U=`${location.protocol}//${location.host}/api/preview/${b.fileId}?token=${b.previewToken}`,$=document.createElement("a");$.href=U,$.download=R.split("/").pop()||"download",document.body.appendChild($),$.click(),document.body.removeChild($)}else{let U=new Blob([b.content||""],{type:"application/octet-stream"}),$=URL.createObjectURL(U),_=document.createElement("a");_.href=$,_.download=R.split("/").pop()||"download",document.body.appendChild(_),_.click(),document.body.removeChild(_),URL.revokeObjectURL($)}}catch{}return}let L=n.value.findIndex(U=>U.path===R);if(L>=0){let U=n.value[L];if(b.binary){U.previewLoading=!1;let $=`${location.protocol}//${location.host}/api/preview/${b.fileId}?token=${b.previewToken}`,_=U.fileType||Hs(U.name);U.fileType=_,_==="pdf"||_==="image"?fetch($).then(P=>P.blob()).then(P=>{U.blobUrl=URL.createObjectURL(P)}).catch(P=>{U.previewError=P.message}):_==="office"&&((localStorage.getItem("officePreviewMode")||"local")==="online"?U.previewUrl="https://view.officeapps.live.com/op/embed.aspx?src="+encodeURIComponent($):fetch($).then(T=>T.arrayBuffer()).then(T=>{U._arrayBuffer=T,U.localPreviewReady=!0,L===i.value&&Vue.nextTick(()=>m(U))}).catch(T=>{U.previewError=T.message})),l(e.currentConversation);return}U.content=b.content||"",U.originalContent=b.content||"",U.isDirty=!1,l(e.currentConversation),L===i.value&&(Tt(U.name)&&v.value||Vue.nextTick(()=>{setTimeout(()=>c(U),100)}))}break}case"file_saved":{if(a.value=!1,b.error)return;let R=t(b.filePath),L=n.value.find(U=>U.path===R);L&&(L.originalContent=L.content,L.isDirty=!1,l(e.currentConversation));break}case"file_search_result":{f.handleFileSearchResult(b);break}case"file_op_result":{g.handleFileOpResult(b,u.loadTreeDirectory,u.treeRootPath.value);break}case"file_tabs_restored":{if(b.openFiles?.length>0&&n.value.length===0){let R=b.activeIndex||0,L=b.openFiles.length;for(let U of b.openFiles){let $=t(U.path),_=$.split("/").pop(),P=Hs(_);n.value.push({path:$,name:_,content:null,originalContent:null,isDirty:!1,cmInstance:null,fileType:P,blobUrl:null,previewUrl:null,previewLoading:P!=="text",localPreviewReady:!1,previewError:null}),e.sendWsMessage({type:"read_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:U.path})}i.value=R>=0&&R<L?R:0}break}}},handleOpenFile:h=>{let{filePath:b}=h.detail,R=t(b);d(R,R.split("/").pop())}}}var $p=H(()=>{Pn()});var Vp,Fp=H(()=>{oa();wp();Sp();Ip();Pn();Tp();Pp();_p();Ep();$p();Vp={name:"FilesTab",template:`
2198
2198
  <div class="files-tab file-two-col" :class="{ 'mobile-editor-view': isMobile && mobileView === 'editor' }" ref="rootEl">
2199
2199
  <!-- \u5DE6\u680F: \u5C42\u7EA7\u76EE\u5F55\u6811 -->
2200
2200
  <div class="file-col-tree" :class="{ 'drop-active': externalDropActive }" :style="{ flex: '0 0 ' + treePanelWidth + 'px', transition: isTreeResizing ? 'none' : undefined, fontSize: fontSize + 'px' }" @wheel.ctrl.prevent="onWheel"
@@ -2621,7 +2621,7 @@ ${String(e||"").trim()}
2621
2621
  </template>
2622
2622
  </div>
2623
2623
  </div>
2624
- `,setup(){let e=Pinia.useChatStore(),t=Vue.inject("t"),s=()=>e.effectiveWorkDir||"",n=x=>x?x.replace(/\\/g,"/"):"",i=x=>zi(x),r=x=>Ki(x),o=x=>x==null?"":x<1024?x+" B":x<1024*1024?(x/1024).toFixed(1)+" KB":(x/(1024*1024)).toFixed(1)+" MB",a=Vue.ref(null),l=Vue.ref(null),c=Vue.ref(window.innerWidth<=768),d=Vue.ref("tree"),u=()=>{d.value="tree"},p=Vue.ref(parseInt(localStorage.getItem("filesFontSize"))||15),f=x=>{p.value=Math.max(8,Math.min(24,x)),localStorage.setItem("filesFontSize",p.value.toString());let j=y.activeFile.value;j?.cmInstance&&(j.cmInstance.getWrapperElement().style.fontSize=p.value+"px",j.cmInstance.refresh())},g=()=>f(p.value+1),v=()=>f(p.value-1),m=x=>{x.deltaY<0?g():v()},A=Vue.ref(parseInt(localStorage.getItem("filePanelWidth"))||220),w=Vue.ref(!1),k=x=>{x.preventDefault();let j=x.type==="touchstart";w.value=!0;let ae=j?x.touches[0].clientX:x.clientX,he=A.value;document.body.style.cursor="col-resize",document.body.style.userSelect="none";let W=x.target.closest(".file-two-col"),te=W?W.offsetWidth*.5:400,Y=O=>{let E=j?O.touches[0].clientX:O.clientX;A.value=Math.max(120,Math.min(te,he+(E-ae)))},N=()=>{w.value=!1,document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("filePanelWidth",A.value.toString()),document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",N),document.removeEventListener("touchmove",Y),document.removeEventListener("touchend",N)};document.addEventListener(j?"touchmove":"mousemove",Y),document.addEventListener(j?"touchend":"mouseup",N)},y,h,b=Vue.computed(()=>y?y.activeFile.value:null),_=Vue.computed(()=>h?h.treePath.value:""),L=bp(b),U=Ap(e,{activeFile:b,editorContainer:l,fontSize:p,clearFindMarkers:L.clearFindMarkers,openFindBar:L.openFindBar,saveFile:()=>y.saveFile()}),$=xp(b,{editorContainer:l,createEditor:U.createEditor,t}),R=kp(e,{getEffectiveWorkDir:s,treePath:_});y=Dp(e,{normalizePath:n,getEffectiveWorkDir:s,editorContainer:l,createEditor:U.createEditor,destroyEditor:U.destroyEditor,clearFindMarkers:L.clearFindMarkers,saveCurrentUndoHistory:U.saveCurrentUndoHistory,saveAllUndoHistory:U.saveAllUndoHistory,cleanupUndoHistory:U.cleanupUndoHistory,deleteConversationHistory:U.deleteConversationHistory,debugStatus:U.debugStatus,mdPreviewMode:$.mdPreviewMode,renderOfficeLocal:$.renderOfficeLocal,performFind:L.performFind,findBarVisible:L.findBarVisible,findQuery:L.findQuery,t}),h=Cp(e,{getEffectiveWorkDir:s,normalizePath:n,selectedPaths:R.selectedPaths,lastClickedIndex:R.lastClickedIndex,openFileInTab:(...x)=>y.openFileInTab(...x),clearSelection:R.clearSelection});let P=Mp(e,{getEffectiveWorkDir:s,treePath:h.treePath,openFileInTab:(...x)=>y.openFileInTab(...x),normalizePath:n,treeRootPath:h.treeRootPath,treeNodes:h.treeNodes,loadTreeDirectory:h.loadTreeDirectory});U.setKeyBindings({openQuickOpen:P.openQuickOpen,openGoToLine:P.openGoToLine});let T=_p(e,{getEffectiveWorkDir:s,treePath:h.treePath,treeRootPath:h.treeRootPath,treeNodes:h.treeNodes,normalizePath:n,loadTreeDirectory:h.loadTreeDirectory}),I=Lp({store:e,normalizePath:n,getEffectiveWorkDir:s,openFiles:y.openFiles,activeFileIndex:y.activeFileIndex,activeFile:y.activeFile,fileLoading:y.fileLoading,fileSaving:y.fileSaving,saveTabsState:y.saveTabsState,createEditor:U.createEditor,openFileInTab:y.openFileInTab,tree:h,fp:T,qo:P,ops:R,mdPreviewMode:$.mdPreviewMode,renderOfficeLocal:$.renderOfficeLocal,editorContainer:l,debugStatus:U.debugStatus}),M=x=>R.deleteSingleFile(x,t),B=()=>R.deleteSelected(t),F=()=>R.ctxDelete(t),z=(x,j)=>R.onDrop(x,j,R.handleExternalFileDrop),ne=x=>R.onTreeDrop(x,h.treeRootPath.value,R.handleExternalFileDrop),ve=()=>P.goToLineConfirm(y.activeFile);Vue.watch(()=>e.currentAgent,()=>{y.saveTabsState(e.currentConversation),U.destroyEditor(),h.clearTreeNodes(),y.openFiles.value=[],y.activeFileIndex.value=-1,y.fileLoading.value=!1,e.currentAgent&&Vue.nextTick(()=>h.initFileBrowser())});let ue=e.currentConversation;Vue.watch(()=>e.currentConversation,x=>{y.saveTabsState(ue),ue=x,y.restoreTabsState(x);let j=s(),ae=n(j);j&&ae!==h.treeRootPath.value&&(h.treePath.value=j,h.treeRootPath.value=ae,h.clearTreeNodes(),h.loadTreeDirectory(j))}),Vue.watch(()=>e.theme,x=>{let j=y.activeFile.value;j?.cmInstance&&j.cmInstance.setOption("theme",x==="dark"?"material-darker":"default")}),Vue.watch(()=>s(),x=>{if(x&&!h.treeRootPath.value){let j=n(x);h.treePath.value=x,h.treeRootPath.value=j,h.clearTreeNodes(),h.loadTreeDirectory(x)}}),Vue.watch(()=>y.activeFile.value?.content,(x,j)=>{let ae=y.activeFile.value;if(ae&&x!=null&&j==null&&!ae.cmInstance&&(!ae.fileType||ae.fileType==="text")){if(Tt(ae.name)&&$.mdPreviewMode.value)return;Vue.nextTick(()=>{setTimeout(()=>{ae.cmInstance||U.createEditor(ae)},150)})}}),Vue.watch([$.mdRenderedHtml,$.mdPreviewMode],([x,j])=>{x&&j&&Vue.nextTick(()=>{setTimeout(()=>$.renderMermaidBlocks(),50)})});let be=x=>{!(a.value&&a.value.offsetParent!==null)&&!P.quickOpenVisible.value&&!P.goToLineVisible.value&&!L.findBarVisible.value||((x.ctrlKey||x.metaKey)&&x.key==="p"?(x.preventDefault(),P.quickOpenVisible.value?P.closeQuickOpen():P.openQuickOpen()):(x.ctrlKey||x.metaKey)&&x.key==="g"?(x.preventDefault(),P.goToLineVisible.value?P.closeGoToLine():P.openGoToLine()):(x.ctrlKey||x.metaKey)&&x.key==="f"?y.activeFile.value&&(x.preventDefault(),L.openFindBar(!1)):(x.ctrlKey||x.metaKey)&&(x.key==="r"||x.key==="h")?y.activeFile.value&&(x.preventDefault(),L.openFindBar(!0)):x.key==="Escape"&&(L.findBarVisible.value&&L.closeFindBar(),R.selectedPaths.size>0&&R.clearSelection(),P.quickOpenVisible.value&&P.closeQuickOpen(),P.goToLineVisible.value&&P.closeGoToLine()))},oe=()=>{R.hideContextMenu()},Ce=()=>{c.value=window.innerWidth<=768};return Vue.watch(()=>y.activeFileIndex.value,(x,j)=>{c.value&&x>=0&&x!==j&&(d.value="editor")}),Vue.watch(()=>y.openFiles.value.length,x=>{c.value&&x===0&&(d.value="tree")}),Vue.onMounted(()=>{window.addEventListener("workbench-message",I.handleWorkbenchMessage),window.addEventListener("open-file-in-explorer",I.handleOpenFile),window.addEventListener("conversation-deleted",y.handleConversationDeleted),window.addEventListener("keydown",be),document.addEventListener("click",oe),window.addEventListener("resize",Ce),$.initMermaid(),e.currentAgent&&(h.initFileBrowser(),e.sendWsMessage({type:"restore_file_tabs"}))}),Vue.onUnmounted(()=>{window.removeEventListener("workbench-message",I.handleWorkbenchMessage),window.removeEventListener("open-file-in-explorer",I.handleOpenFile),window.removeEventListener("conversation-deleted",y.handleConversationDeleted),window.removeEventListener("keydown",be),document.removeEventListener("click",oe),window.removeEventListener("resize",Ce),U.destroyEditor(),R.cleanup()}),{store:e,debugStatus:U.debugStatus,rootEl:a,isMobile:c,mobileView:d,mobileGoBack:u,fontSize:p,zoomIn:g,zoomOut:v,onWheel:m,treePath:h.treePath,treeRootPath:h.treeRootPath,treeNodes:h.treeNodes,flattenedTree:h.flattenedTree,editingTreePath:h.editingTreePath,treePathInputRef:h.treePathInputRef,rootFolderName:h.rootFolderName,rootExpanded:h.rootExpanded,toggleRootExpand:h.toggleRootExpand,collapseAll:h.collapseAll,startTreePathEdit:h.startTreePathEdit,confirmTreePath:h.confirmTreePath,cancelTreePathEdit:h.cancelTreePathEdit,treePanelWidth:A,isTreeResizing:w,startTreeResize:k,openFiles:y.openFiles,activeFileIndex:y.activeFileIndex,activeFile:y.activeFile,fileLoading:y.fileLoading,fileSaving:y.fileSaving,editorContainer:l,officePreviewContainer:$.officePreviewContainer,mdPreviewRef:$.mdPreviewRef,isActiveMarkdown:$.isActiveMarkdown,mdPreviewMode:$.mdPreviewMode,mdRenderedHtml:$.mdRenderedHtml,switchToMdEdit:$.switchToMdEdit,folderPickerOpen:T.folderPickerOpen,folderPickerPath:T.folderPickerPath,folderPickerEntries:T.folderPickerEntries,folderPickerLoading:T.folderPickerLoading,folderPickerSelected:T.folderPickerSelected,searchQuery:P.searchQuery,searchResults:P.searchResults,searchLoading:P.searchLoading,onSearchInput:P.onSearchInput,clearSearch:P.clearSearch,onSearchResultClick:P.onSearchResultClick,quickOpenVisible:P.quickOpenVisible,quickOpenQuery:P.quickOpenQuery,quickOpenResults:P.quickOpenResults,quickOpenSelectedIndex:P.quickOpenSelectedIndex,quickOpenLoading:P.quickOpenLoading,quickOpenInput:P.quickOpenInput,openQuickOpen:P.openQuickOpen,closeQuickOpen:P.closeQuickOpen,onQuickOpenInput:P.onQuickOpenInput,quickOpenSelectNext:P.quickOpenSelectNext,quickOpenSelectPrev:P.quickOpenSelectPrev,quickOpenConfirm:P.quickOpenConfirm,quickOpenOpenFile:P.quickOpenOpenFile,goToLineVisible:P.goToLineVisible,goToLineValue:P.goToLineValue,goToLineInput:P.goToLineInput,openGoToLine:P.openGoToLine,closeGoToLine:P.closeGoToLine,goToLineConfirm:ve,findBarVisible:L.findBarVisible,replaceBarVisible:L.replaceBarVisible,findQuery:L.findQuery,replaceQuery:L.replaceQuery,findCaseSensitive:L.findCaseSensitive,findUseRegex:L.findUseRegex,findMatchCount:L.findMatchCount,findMatchIndex:L.findMatchIndex,findInputRef:L.findInputRef,replaceInputRef:L.replaceInputRef,onFindInput:L.onFindInput,findNext:L.findNext,findPrev:L.findPrev,openFindBar:L.openFindBar,closeFindBar:L.closeFindBar,toggleReplaceBar:L.toggleReplaceBar,replaceOne:L.replaceOne,replaceAll:L.replaceAll,selectedPaths:R.selectedPaths,fileOperating:R.fileOperating,fileOpFeedback:R.fileOpFeedback,newFileDialogVisible:R.newFileDialogVisible,newFileName:R.newFileName,newFileType:R.newFileType,newFileInput:R.newFileInput,moveDialogVisible:R.moveDialogVisible,moveDestination:R.moveDestination,moveDestInput:R.moveDestInput,toggleSelection:R.toggleSelection,clearSelection:R.clearSelection,showNewFileDialog:R.showNewFileDialog,confirmNewFile:R.confirmNewFile,deleteSingleFile:M,deleteSelected:B,openMoveDialog:R.openMoveDialog,confirmMove:R.confirmMove,contextMenu:R.contextMenu,showContextMenu:R.showContextMenu,hideContextMenu:R.hideContextMenu,ctxRename:R.ctxRename,ctxCopy:R.ctxCopy,ctxMoveTo:R.ctxMoveTo,ctxDelete:F,ctxDownload:R.ctxDownload,renameDialogVisible:R.renameDialogVisible,renameNewName:R.renameNewName,renameInput:R.renameInput,confirmRename:R.confirmRename,dragState:R.dragState,externalDropActive:R.externalDropActive,onDragStart:R.onDragStart,onDragOver:R.onDragOver,onDragLeave:R.onDragLeave,onDrop:z,onTreeDragOver:R.onTreeDragOver,onTreeDragLeave:R.onTreeDragLeave,onTreeDrop:ne,loadRootDirectory:h.loadRootDirectory,onTreeItemClick:h.onTreeItemClick,openFileInTab:y.openFileInTab,switchToTab:y.switchToTab,closeFileTab:y.closeFileTab,saveFile:y.saveFile,openFolderPicker:T.openFolderPicker,folderPickerNavigateUp:T.folderPickerNavigateUp,folderPickerSelectItem:T.folderPickerSelectItem,folderPickerEnter:T.folderPickerEnter,confirmFolderPicker:T.confirmFolderPicker,getFileIcon:()=>"",getFileIconHtml:i,getFolderIcon:r,formatSize:o,refresh:h.refresh,placeholderPath:Vue.computed(()=>{let x=s();return x?t("files.workDir",{dir:x}):t("files.enterDirPath")})}}}});var Yi,aa=H(()=>{op();yp();Fp();Yi={name:"WorkbenchPanel",components:{TerminalTab:rp,GitStatusTab:vp,FilesTab:Vp},template:`
2624
+ `,setup(){let e=Pinia.useChatStore(),t=Vue.inject("t"),s=()=>e.effectiveWorkDir||"",n=x=>x?x.replace(/\\/g,"/"):"",i=x=>zi(x),r=x=>Ki(x),o=x=>x==null?"":x<1024?x+" B":x<1024*1024?(x/1024).toFixed(1)+" KB":(x/(1024*1024)).toFixed(1)+" MB",a=Vue.ref(null),l=Vue.ref(null),c=Vue.ref(window.innerWidth<=768),d=Vue.ref("tree"),u=()=>{d.value="tree"},p=Vue.ref(parseInt(localStorage.getItem("filesFontSize"))||15),f=x=>{p.value=Math.max(8,Math.min(24,x)),localStorage.setItem("filesFontSize",p.value.toString());let j=y.activeFile.value;j?.cmInstance&&(j.cmInstance.getWrapperElement().style.fontSize=p.value+"px",j.cmInstance.refresh())},g=()=>f(p.value+1),v=()=>f(p.value-1),m=x=>{x.deltaY<0?g():v()},A=Vue.ref(parseInt(localStorage.getItem("filePanelWidth"))||220),w=Vue.ref(!1),k=x=>{x.preventDefault();let j=x.type==="touchstart";w.value=!0;let ae=j?x.touches[0].clientX:x.clientX,he=A.value;document.body.style.cursor="col-resize",document.body.style.userSelect="none";let W=x.target.closest(".file-two-col"),te=W?W.offsetWidth*.5:400,Y=O=>{let E=j?O.touches[0].clientX:O.clientX;A.value=Math.max(120,Math.min(te,he+(E-ae)))},N=()=>{w.value=!1,document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("filePanelWidth",A.value.toString()),document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",N),document.removeEventListener("touchmove",Y),document.removeEventListener("touchend",N)};document.addEventListener(j?"touchmove":"mousemove",Y),document.addEventListener(j?"touchend":"mouseup",N)},y,h,b=Vue.computed(()=>y?y.activeFile.value:null),R=Vue.computed(()=>h?h.treePath.value:""),L=bp(b),U=Ap(e,{activeFile:b,editorContainer:l,fontSize:p,clearFindMarkers:L.clearFindMarkers,openFindBar:L.openFindBar,saveFile:()=>y.saveFile()}),$=xp(b,{editorContainer:l,createEditor:U.createEditor,t}),_=kp(e,{getEffectiveWorkDir:s,treePath:R});y=Dp(e,{normalizePath:n,getEffectiveWorkDir:s,editorContainer:l,createEditor:U.createEditor,destroyEditor:U.destroyEditor,clearFindMarkers:L.clearFindMarkers,saveCurrentUndoHistory:U.saveCurrentUndoHistory,saveAllUndoHistory:U.saveAllUndoHistory,cleanupUndoHistory:U.cleanupUndoHistory,deleteConversationHistory:U.deleteConversationHistory,debugStatus:U.debugStatus,mdPreviewMode:$.mdPreviewMode,renderOfficeLocal:$.renderOfficeLocal,performFind:L.performFind,findBarVisible:L.findBarVisible,findQuery:L.findQuery,t}),h=Cp(e,{getEffectiveWorkDir:s,normalizePath:n,selectedPaths:_.selectedPaths,lastClickedIndex:_.lastClickedIndex,openFileInTab:(...x)=>y.openFileInTab(...x),clearSelection:_.clearSelection});let P=Mp(e,{getEffectiveWorkDir:s,treePath:h.treePath,openFileInTab:(...x)=>y.openFileInTab(...x),normalizePath:n,treeRootPath:h.treeRootPath,treeNodes:h.treeNodes,loadTreeDirectory:h.loadTreeDirectory});U.setKeyBindings({openQuickOpen:P.openQuickOpen,openGoToLine:P.openGoToLine});let T=Rp(e,{getEffectiveWorkDir:s,treePath:h.treePath,treeRootPath:h.treeRootPath,treeNodes:h.treeNodes,normalizePath:n,loadTreeDirectory:h.loadTreeDirectory}),I=Lp({store:e,normalizePath:n,getEffectiveWorkDir:s,openFiles:y.openFiles,activeFileIndex:y.activeFileIndex,activeFile:y.activeFile,fileLoading:y.fileLoading,fileSaving:y.fileSaving,saveTabsState:y.saveTabsState,createEditor:U.createEditor,openFileInTab:y.openFileInTab,tree:h,fp:T,qo:P,ops:_,mdPreviewMode:$.mdPreviewMode,renderOfficeLocal:$.renderOfficeLocal,editorContainer:l,debugStatus:U.debugStatus}),M=x=>_.deleteSingleFile(x,t),B=()=>_.deleteSelected(t),F=()=>_.ctxDelete(t),z=(x,j)=>_.onDrop(x,j,_.handleExternalFileDrop),ne=x=>_.onTreeDrop(x,h.treeRootPath.value,_.handleExternalFileDrop),ve=()=>P.goToLineConfirm(y.activeFile);Vue.watch(()=>e.currentAgent,()=>{y.saveTabsState(e.currentConversation),U.destroyEditor(),h.clearTreeNodes(),y.openFiles.value=[],y.activeFileIndex.value=-1,y.fileLoading.value=!1,e.currentAgent&&Vue.nextTick(()=>h.initFileBrowser())});let ue=e.currentConversation;Vue.watch(()=>e.currentConversation,x=>{y.saveTabsState(ue),ue=x,y.restoreTabsState(x);let j=s(),ae=n(j);j&&ae!==h.treeRootPath.value&&(h.treePath.value=j,h.treeRootPath.value=ae,h.clearTreeNodes(),h.loadTreeDirectory(j))}),Vue.watch(()=>e.theme,x=>{let j=y.activeFile.value;j?.cmInstance&&j.cmInstance.setOption("theme",x==="dark"?"material-darker":"default")}),Vue.watch(()=>s(),x=>{if(x&&!h.treeRootPath.value){let j=n(x);h.treePath.value=x,h.treeRootPath.value=j,h.clearTreeNodes(),h.loadTreeDirectory(x)}}),Vue.watch(()=>y.activeFile.value?.content,(x,j)=>{let ae=y.activeFile.value;if(ae&&x!=null&&j==null&&!ae.cmInstance&&(!ae.fileType||ae.fileType==="text")){if(Tt(ae.name)&&$.mdPreviewMode.value)return;Vue.nextTick(()=>{setTimeout(()=>{ae.cmInstance||U.createEditor(ae)},150)})}}),Vue.watch([$.mdRenderedHtml,$.mdPreviewMode],([x,j])=>{x&&j&&Vue.nextTick(()=>{setTimeout(()=>$.renderMermaidBlocks(),50)})});let be=x=>{!(a.value&&a.value.offsetParent!==null)&&!P.quickOpenVisible.value&&!P.goToLineVisible.value&&!L.findBarVisible.value||((x.ctrlKey||x.metaKey)&&x.key==="p"?(x.preventDefault(),P.quickOpenVisible.value?P.closeQuickOpen():P.openQuickOpen()):(x.ctrlKey||x.metaKey)&&x.key==="g"?(x.preventDefault(),P.goToLineVisible.value?P.closeGoToLine():P.openGoToLine()):(x.ctrlKey||x.metaKey)&&x.key==="f"?y.activeFile.value&&(x.preventDefault(),L.openFindBar(!1)):(x.ctrlKey||x.metaKey)&&(x.key==="r"||x.key==="h")?y.activeFile.value&&(x.preventDefault(),L.openFindBar(!0)):x.key==="Escape"&&(L.findBarVisible.value&&L.closeFindBar(),_.selectedPaths.size>0&&_.clearSelection(),P.quickOpenVisible.value&&P.closeQuickOpen(),P.goToLineVisible.value&&P.closeGoToLine()))},oe=()=>{_.hideContextMenu()},Ce=()=>{c.value=window.innerWidth<=768};return Vue.watch(()=>y.activeFileIndex.value,(x,j)=>{c.value&&x>=0&&x!==j&&(d.value="editor")}),Vue.watch(()=>y.openFiles.value.length,x=>{c.value&&x===0&&(d.value="tree")}),Vue.onMounted(()=>{window.addEventListener("workbench-message",I.handleWorkbenchMessage),window.addEventListener("open-file-in-explorer",I.handleOpenFile),window.addEventListener("conversation-deleted",y.handleConversationDeleted),window.addEventListener("keydown",be),document.addEventListener("click",oe),window.addEventListener("resize",Ce),$.initMermaid(),e.currentAgent&&(h.initFileBrowser(),e.sendWsMessage({type:"restore_file_tabs"}))}),Vue.onUnmounted(()=>{window.removeEventListener("workbench-message",I.handleWorkbenchMessage),window.removeEventListener("open-file-in-explorer",I.handleOpenFile),window.removeEventListener("conversation-deleted",y.handleConversationDeleted),window.removeEventListener("keydown",be),document.removeEventListener("click",oe),window.removeEventListener("resize",Ce),U.destroyEditor(),_.cleanup()}),{store:e,debugStatus:U.debugStatus,rootEl:a,isMobile:c,mobileView:d,mobileGoBack:u,fontSize:p,zoomIn:g,zoomOut:v,onWheel:m,treePath:h.treePath,treeRootPath:h.treeRootPath,treeNodes:h.treeNodes,flattenedTree:h.flattenedTree,editingTreePath:h.editingTreePath,treePathInputRef:h.treePathInputRef,rootFolderName:h.rootFolderName,rootExpanded:h.rootExpanded,toggleRootExpand:h.toggleRootExpand,collapseAll:h.collapseAll,startTreePathEdit:h.startTreePathEdit,confirmTreePath:h.confirmTreePath,cancelTreePathEdit:h.cancelTreePathEdit,treePanelWidth:A,isTreeResizing:w,startTreeResize:k,openFiles:y.openFiles,activeFileIndex:y.activeFileIndex,activeFile:y.activeFile,fileLoading:y.fileLoading,fileSaving:y.fileSaving,editorContainer:l,officePreviewContainer:$.officePreviewContainer,mdPreviewRef:$.mdPreviewRef,isActiveMarkdown:$.isActiveMarkdown,mdPreviewMode:$.mdPreviewMode,mdRenderedHtml:$.mdRenderedHtml,switchToMdEdit:$.switchToMdEdit,folderPickerOpen:T.folderPickerOpen,folderPickerPath:T.folderPickerPath,folderPickerEntries:T.folderPickerEntries,folderPickerLoading:T.folderPickerLoading,folderPickerSelected:T.folderPickerSelected,searchQuery:P.searchQuery,searchResults:P.searchResults,searchLoading:P.searchLoading,onSearchInput:P.onSearchInput,clearSearch:P.clearSearch,onSearchResultClick:P.onSearchResultClick,quickOpenVisible:P.quickOpenVisible,quickOpenQuery:P.quickOpenQuery,quickOpenResults:P.quickOpenResults,quickOpenSelectedIndex:P.quickOpenSelectedIndex,quickOpenLoading:P.quickOpenLoading,quickOpenInput:P.quickOpenInput,openQuickOpen:P.openQuickOpen,closeQuickOpen:P.closeQuickOpen,onQuickOpenInput:P.onQuickOpenInput,quickOpenSelectNext:P.quickOpenSelectNext,quickOpenSelectPrev:P.quickOpenSelectPrev,quickOpenConfirm:P.quickOpenConfirm,quickOpenOpenFile:P.quickOpenOpenFile,goToLineVisible:P.goToLineVisible,goToLineValue:P.goToLineValue,goToLineInput:P.goToLineInput,openGoToLine:P.openGoToLine,closeGoToLine:P.closeGoToLine,goToLineConfirm:ve,findBarVisible:L.findBarVisible,replaceBarVisible:L.replaceBarVisible,findQuery:L.findQuery,replaceQuery:L.replaceQuery,findCaseSensitive:L.findCaseSensitive,findUseRegex:L.findUseRegex,findMatchCount:L.findMatchCount,findMatchIndex:L.findMatchIndex,findInputRef:L.findInputRef,replaceInputRef:L.replaceInputRef,onFindInput:L.onFindInput,findNext:L.findNext,findPrev:L.findPrev,openFindBar:L.openFindBar,closeFindBar:L.closeFindBar,toggleReplaceBar:L.toggleReplaceBar,replaceOne:L.replaceOne,replaceAll:L.replaceAll,selectedPaths:_.selectedPaths,fileOperating:_.fileOperating,fileOpFeedback:_.fileOpFeedback,newFileDialogVisible:_.newFileDialogVisible,newFileName:_.newFileName,newFileType:_.newFileType,newFileInput:_.newFileInput,moveDialogVisible:_.moveDialogVisible,moveDestination:_.moveDestination,moveDestInput:_.moveDestInput,toggleSelection:_.toggleSelection,clearSelection:_.clearSelection,showNewFileDialog:_.showNewFileDialog,confirmNewFile:_.confirmNewFile,deleteSingleFile:M,deleteSelected:B,openMoveDialog:_.openMoveDialog,confirmMove:_.confirmMove,contextMenu:_.contextMenu,showContextMenu:_.showContextMenu,hideContextMenu:_.hideContextMenu,ctxRename:_.ctxRename,ctxCopy:_.ctxCopy,ctxMoveTo:_.ctxMoveTo,ctxDelete:F,ctxDownload:_.ctxDownload,renameDialogVisible:_.renameDialogVisible,renameNewName:_.renameNewName,renameInput:_.renameInput,confirmRename:_.confirmRename,dragState:_.dragState,externalDropActive:_.externalDropActive,onDragStart:_.onDragStart,onDragOver:_.onDragOver,onDragLeave:_.onDragLeave,onDrop:z,onTreeDragOver:_.onTreeDragOver,onTreeDragLeave:_.onTreeDragLeave,onTreeDrop:ne,loadRootDirectory:h.loadRootDirectory,onTreeItemClick:h.onTreeItemClick,openFileInTab:y.openFileInTab,switchToTab:y.switchToTab,closeFileTab:y.closeFileTab,saveFile:y.saveFile,openFolderPicker:T.openFolderPicker,folderPickerNavigateUp:T.folderPickerNavigateUp,folderPickerSelectItem:T.folderPickerSelectItem,folderPickerEnter:T.folderPickerEnter,confirmFolderPicker:T.confirmFolderPicker,getFileIcon:()=>"",getFileIconHtml:i,getFolderIcon:r,formatSize:o,refresh:h.refresh,placeholderPath:Vue.computed(()=>{let x=s();return x?t("files.workDir",{dir:x}):t("files.enterDirPath")})}}}});var Yi,aa=H(()=>{op();yp();Fp();Yi={name:"WorkbenchPanel",components:{TerminalTab:rp,GitStatusTab:vp,FilesTab:Vp},template:`
2625
2625
  <div class="workbench-panel" :class="{ expanded: store.workbenchExpanded, maximized: store.workbenchMaximized }" :style="panelStyle">
2626
2626
  <!-- \u5C55\u5F00\u65F6\u7684\u5B8C\u6574\u9762\u677F -->
2627
2627
  <div class="workbench-content" v-if="store.workbenchExpanded">
@@ -2675,7 +2675,7 @@ ${String(e||"").trim()}
2675
2675
  <!-- \u62D6\u62FD\u8C03\u6574\u5BBD\u5EA6\u624B\u67C4 -->
2676
2676
  <div class="resize-handle" @mousedown="startResize" @touchstart.prevent="startResize" v-if="store.workbenchExpanded"></div>
2677
2677
  </div>
2678
- `,setup(){let e=Pinia.useChatStore(),t=Vue.computed(()=>e.hasCapability("terminal")),s=Vue.computed(()=>e.hasCapability("file_editor")),n=Vue.computed(()=>!1),i=Vue.reactive({}),r=()=>s.value?"files":t.value?"terminal":"files",o=Vue.computed(()=>{let v=e.currentConversation,m=v&&i[v]||"files";return m==="terminal"&&!t.value||(m==="git"||m==="files"||m==="explorer")&&!s.value?r():m==="explorer"?"git":m}),a=v=>{let m=e.currentConversation;m&&(i[m]=v)},l=Vue.ref(0),c=Vue.ref(!1),d=Vue.ref(!1),u=Vue.computed(()=>{if(!e.workbenchExpanded)return{};if(e.workbenchMaximized)return{};if(window.innerWidth<=768)return{};if(!d.value)return c.value?{transition:"none"}:{};let v={width:l.value+"px"};return c.value&&(v.transition="none"),v}),p=v=>{v.preventDefault();let m=v.type==="touchstart",A=m?v.touches[0].clientX:v.clientX;if(c.value=!0,!d.value){let h=v.target.closest(".workbench-panel");h&&(l.value=h.offsetWidth),d.value=!0}let w=l.value;document.body.style.cursor="col-resize",document.body.style.userSelect="none";let k=h=>{let _=(m?h.touches[0].clientX:h.clientX)-A,L=Math.max(900,window.innerWidth-100);l.value=Math.max(280,Math.min(L,w+_))},y=()=>{c.value=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",y),document.removeEventListener("touchmove",k),document.removeEventListener("touchend",y)};document.addEventListener(m?"touchmove":"mousemove",k),document.addEventListener(m?"touchend":"mouseup",y)},f=()=>{let v=e.currentConversation;v&&s.value&&(i[v]="files")},g=v=>{let{conversationId:m}=v.detail;m&&delete i[m]};return Vue.onMounted(()=>{window.addEventListener("open-file-in-explorer",f),window.addEventListener("conversation-deleted",g)}),Vue.onUnmounted(()=>{window.removeEventListener("open-file-in-explorer",f),window.removeEventListener("conversation-deleted",g)}),{store:e,activeTab:o,setTab:a,hasTerminal:t,hasExplorer:s,hasTasks:n,panelStyle:u,startResize:p}}}});function rt(e){let t=e?.currentTarget;t&&_n.set(t,{startedOnOverlay:e.target===t,endedOnOverlay:!1})}function ot(e){let t=e?.currentTarget,s=t&&_n.get(t);s&&(s.endedOnOverlay=e.target===t)}function at(e){let t=e?.currentTarget;t&&_n.delete(t)}function Ze(e){let t=e?.currentTarget;if(!t)return!1;let s=_n.get(t),n=e.target===t&&s?.startedOnOverlay===!0&&s.endedOnOverlay===!0;return _n.delete(t),n}var _n,ls=H(()=>{_n=new WeakMap});var yt,Hp,Op=H(()=>{ct();yt=20,Hp={name:"DashboardTab",template:`
2678
+ `,setup(){let e=Pinia.useChatStore(),t=Vue.computed(()=>e.hasCapability("terminal")),s=Vue.computed(()=>e.hasCapability("file_editor")),n=Vue.computed(()=>!1),i=Vue.reactive({}),r=()=>s.value?"files":t.value?"terminal":"files",o=Vue.computed(()=>{let v=e.currentConversation,m=v&&i[v]||"files";return m==="terminal"&&!t.value||(m==="git"||m==="files"||m==="explorer")&&!s.value?r():m==="explorer"?"git":m}),a=v=>{let m=e.currentConversation;m&&(i[m]=v)},l=Vue.ref(0),c=Vue.ref(!1),d=Vue.ref(!1),u=Vue.computed(()=>{if(!e.workbenchExpanded)return{};if(e.workbenchMaximized)return{};if(window.innerWidth<=768)return{};if(!d.value)return c.value?{transition:"none"}:{};let v={width:l.value+"px"};return c.value&&(v.transition="none"),v}),p=v=>{v.preventDefault();let m=v.type==="touchstart",A=m?v.touches[0].clientX:v.clientX;if(c.value=!0,!d.value){let h=v.target.closest(".workbench-panel");h&&(l.value=h.offsetWidth),d.value=!0}let w=l.value;document.body.style.cursor="col-resize",document.body.style.userSelect="none";let k=h=>{let R=(m?h.touches[0].clientX:h.clientX)-A,L=Math.max(900,window.innerWidth-100);l.value=Math.max(280,Math.min(L,w+R))},y=()=>{c.value=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",y),document.removeEventListener("touchmove",k),document.removeEventListener("touchend",y)};document.addEventListener(m?"touchmove":"mousemove",k),document.addEventListener(m?"touchend":"mouseup",y)},f=()=>{let v=e.currentConversation;v&&s.value&&(i[v]="files")},g=v=>{let{conversationId:m}=v.detail;m&&delete i[m]};return Vue.onMounted(()=>{window.addEventListener("open-file-in-explorer",f),window.addEventListener("conversation-deleted",g)}),Vue.onUnmounted(()=>{window.removeEventListener("open-file-in-explorer",f),window.removeEventListener("conversation-deleted",g)}),{store:e,activeTab:o,setTab:a,hasTerminal:t,hasExplorer:s,hasTasks:n,panelStyle:u,startResize:p}}}});function rt(e){let t=e?.currentTarget;t&&Rn.set(t,{startedOnOverlay:e.target===t,endedOnOverlay:!1})}function ot(e){let t=e?.currentTarget,s=t&&Rn.get(t);s&&(s.endedOnOverlay=e.target===t)}function at(e){let t=e?.currentTarget;t&&Rn.delete(t)}function Ze(e){let t=e?.currentTarget;if(!t)return!1;let s=Rn.get(t),n=e.target===t&&s?.startedOnOverlay===!0&&s.endedOnOverlay===!0;return Rn.delete(t),n}var Rn,ls=H(()=>{Rn=new WeakMap});var yt,Hp,Op=H(()=>{ct();yt=20,Hp={name:"DashboardTab",template:`
2679
2679
  <div class="db-container">
2680
2680
  <!-- Loading state -->
2681
2681
  <div v-if="loading && !loaded" class="db-loading">{{ $t('settings.dashboard.loading') }}</div>
@@ -2963,7 +2963,7 @@ ${String(e||"").trim()}
2963
2963
  </div>
2964
2964
  </template>
2965
2965
  </div>
2966
- `,data(){return{loading:!1,loaded:!1,error:!1,overview:{totalUsers:0,todayActiveUsers:0,onlineAgents:0,todayMessages:0,totalTokens:0,agentMetrics:null},statsPeriod:"all",userStats:[],agents:[],onlineUsers:[],userSort:{field:null,order:"asc"},agentSort:{field:null,order:"asc"},onlineSort:{field:null,order:"asc"},userVisibleCount:yt,agentVisibleCount:yt,onlineVisibleCount:yt}},mounted(){this.fetchAll()},computed:{periods(){return[{value:"today",label:this.$t("settings.dashboard.today")},{value:"week",label:this.$t("settings.dashboard.thisWeek")},{value:"month",label:this.$t("settings.dashboard.thisMonth")},{value:"all",label:this.$t("settings.dashboard.all")}]},sortedUserStats(){return this.userSort.field?this.sortArray(this.userStats,this.userSort.field,this.userSort.order,"user"):this.userStats},pagedUserStats(){return this.sortedUserStats.slice(0,this.userVisibleCount)},agentMetricTotals(){return this.normalizeMetrics(this.overview.agentMetrics||{})},sortedAgents(){return this.agentSort.field?this.sortArray(this.agents,this.agentSort.field,this.agentSort.order,"agent"):this.agents},pagedAgents(){return this.sortedAgents.slice(0,this.agentVisibleCount)},sortedOnlineUsers(){return this.onlineSort.field?this.sortArray(this.onlineUsers,this.onlineSort.field,this.onlineSort.order,"online"):this.onlineUsers},pagedOnlineUsers(){return this.sortedOnlineUsers.slice(0,this.onlineVisibleCount)}},methods:{getHeaders(){let e=Me(),t={"Content-Type":"application/json"};return e.token&&(t.Authorization=`Bearer ${e.token}`),t},toggleSort(e,t){let s=e+"Sort";this[s].field===t?this[s].order=this[s].order==="asc"?"desc":"asc":(this[s].field=t,this[s].order="asc")},sortArray(e,t,s,n){let i=[...e];return i.sort((r,o)=>{let a,l;if(n==="user"&&t==="traffic"?(a=(r.bytesSent||0)+(r.bytesReceived||0),l=(o.bytesSent||0)+(o.bytesReceived||0)):n==="agent"&&t==="online"?(a=r.online?1:0,l=o.online?1:0):n==="agent"&&(t==="totalTokens"||t==="totalTurns")?(a=r.metrics?.[t]||0,l=o.metrics?.[t]||0):(a=r[t],l=o[t]),a==null&&l==null)return 0;if(a==null)return 1;if(l==null)return-1;let c;return typeof a=="string"?c=a.localeCompare(l,void 0,{sensitivity:"base"}):typeof a=="boolean"?c=a===l?0:a?-1:1:c=a-l,s==="desc"?-c:c}),i},async fetchAll(){this.loading=!0,this.error=!1;try{let e=this.getHeaders(),[t,s,n,i]=await Promise.all([fetch("/api/admin/dashboard",{headers:e}),fetch(`/api/admin/user-stats?period=${this.statsPeriod}`,{headers:e}),fetch("/api/admin/agents",{headers:e}),fetch("/api/admin/online-users",{headers:e})]);if(!t.ok||!s.ok||!n.ok||!i.ok){this.error=!0;return}let[r,o,a,l]=await Promise.all([t.json(),s.json(),n.json(),i.json()]);this.overview={totalUsers:r.totalUsers??0,todayActiveUsers:r.todayActiveUsers??0,onlineAgents:r.onlineAgents??0,todayMessages:r.todayMessages??0,totalTokens:r.totalTokens??0,agentMetrics:this.normalizeMetrics(r.agentMetrics||{})},this.userStats=Array.isArray(o)?o:[],this.agents=Array.isArray(a)?a.map(c=>({...c,metrics:this.normalizeMetrics(c.metrics||{})})):[],this.onlineUsers=Array.isArray(l)?l:[],this.loaded=!0}catch{this.error=!0}finally{this.loading=!1}},async refreshAll(){await this.fetchAll()},async switchPeriod(e){e!==this.statsPeriod&&(this.statsPeriod=e,this.userVisibleCount=yt,await this.fetchUserStats())},async fetchUserStats(){try{let e=this.getHeaders(),t=await fetch(`/api/admin/user-stats?period=${this.statsPeriod}`,{headers:e});if(!t.ok)return;let s=await t.json();this.userStats=Array.isArray(s)?s:[]}catch{}},latencyClass(e){return e<100?"db-latency-good":e<=500?"db-latency-warn":"db-latency-bad"},normalizeMetrics(e={}){let t=l=>{let c=Number(l);return Number.isFinite(c)&&c>0?c:0},s=t(e.chatTurns),n=t(e.yeaftTurns),i=t(e.inputTokens),r=t(e.outputTokens),o=t(e.cacheReadTokens),a=t(e.cacheWriteTokens);return{chatTurns:s,yeaftTurns:n,totalTurns:t(e.totalTurns)||s+n,sessionsCreated:t(e.sessionsCreated),inputTokens:i,outputTokens:r,cacheReadTokens:o,cacheWriteTokens:a,totalTokens:t(e.totalTokens)||i+r+o+a,lastUpdatedAt:e.lastUpdatedAt||null}},agentTokenTitle(e){let t=this.normalizeMetrics(e?.metrics||{});return this.tokenTitle(t)},userTokenTitle(e){return this.tokenTitle(e||{})},tokenTitle(e){return[`${this.$t("settings.dashboard.inputTokens")}: ${this.formatNumber(Number(e.inputTokens)||0)}`,`${this.$t("settings.dashboard.outputTokens")}: ${this.formatNumber(Number(e.outputTokens)||0)}`,`${this.$t("settings.dashboard.cacheTokens")}: ${this.formatNumber((Number(e.cacheReadTokens)||0)+(Number(e.cacheWriteTokens)||0))}`].join(" \xB7 ")},formatNumber(e){return e==null?"0":e.toLocaleString()},formatCompactNumber(e){let t=Number(e)||0;return t<1e3?this.formatNumber(t):t<1e6?`${(t/1e3).toFixed(t<1e4?1:0)}K`:t<1e9?`${(t/1e6).toFixed(t<1e7?1:0)}M`:`${(t/1e9).toFixed(1)}B`},formatBytes(e){if(!e||e===0)return"0 B";let t=["B","KB","MB","GB"],s=0,n=e;for(;n>=1024&&s<t.length-1;)n/=1024,s++;return`${n<10&&s>0?n.toFixed(1):Math.round(n)} ${t[s]}`},formatRelativeTime(e){if(!e)return"\u2014";let s=Date.now()-new Date(e).getTime();if(s<0)return"\u2014";let n=Math.floor(s/1e3);if(n<60)return this.$t("settings.dashboard.ago",{time:`${n}s`});let i=Math.floor(n/60);if(i<60)return this.$t("settings.dashboard.ago",{time:`${i}m`});let r=Math.floor(i/60);if(r<24)return this.$t("settings.dashboard.ago",{time:`${r}h`});let o=Math.floor(r/24);return this.$t("settings.dashboard.ago",{time:`${o}d`})}}}});function qp(e){return!e||typeof e!="string"?{ok:!1,reason:"empty_or_non_string"}:e.length>40?{ok:!1,reason:"too_long"}:dv.test(e)?e.startsWith("_")?{ok:!1,reason:"underscore_prefix_reserved"}:uv.test(e)?{ok:!1,reason:"pure_digits"}:pv.includes(e.toLowerCase())?{ok:!1,reason:"reserved"}:{ok:!0}:{ok:!1,reason:"illegal_character"}}function Np(e){return typeof e=="string"&&gv.has(e)}function Os(e){return fv[e]||e}var dv,uv,pv,fv,gv,Bp=H(()=>{dv=/^[A-Za-z0-9_-]+$/,uv=/^[0-9]+$/,pv=["all","user","system","everyone"];fv=Object.freeze({empty_or_non_string:"yeaft.vp.idError.empty_or_non_string",too_long:"yeaft.vp.idError.too_long",illegal_character:"yeaft.vp.idError.illegal_character",underscore_prefix_reserved:"yeaft.vp.idError.underscore_prefix_reserved",pure_digits:"yeaft.vp.idError.pure_digits",reserved:"yeaft.vp.idError.reserved",duplicate:"yeaft.vp.idError.duplicate",not_found:"yeaft.vp.idError.not_found",stock_readonly:"yeaft.vp.idError.stock_readonly",unknown:"yeaft.vp.idError.unknown"}),gv=Object.freeze(new Set(["empty_or_non_string","too_long","illegal_character","underscore_prefix_reserved","pure_digits","reserved","duplicate"]))});var Wp,Up=H(()=>{_s();xn();Bp();Wp={name:"VpCrudPanel",props:{initialEditVpId:{type:String,default:""}},template:`
2966
+ `,data(){return{loading:!1,loaded:!1,error:!1,overview:{totalUsers:0,todayActiveUsers:0,onlineAgents:0,todayMessages:0,totalTokens:0,agentMetrics:null},statsPeriod:"all",userStats:[],agents:[],onlineUsers:[],userSort:{field:null,order:"asc"},agentSort:{field:null,order:"asc"},onlineSort:{field:null,order:"asc"},userVisibleCount:yt,agentVisibleCount:yt,onlineVisibleCount:yt}},mounted(){this.fetchAll()},computed:{periods(){return[{value:"today",label:this.$t("settings.dashboard.today")},{value:"week",label:this.$t("settings.dashboard.thisWeek")},{value:"month",label:this.$t("settings.dashboard.thisMonth")},{value:"all",label:this.$t("settings.dashboard.all")}]},sortedUserStats(){return this.userSort.field?this.sortArray(this.userStats,this.userSort.field,this.userSort.order,"user"):this.userStats},pagedUserStats(){return this.sortedUserStats.slice(0,this.userVisibleCount)},agentMetricTotals(){return this.normalizeMetrics(this.overview.agentMetrics||{})},sortedAgents(){return this.agentSort.field?this.sortArray(this.agents,this.agentSort.field,this.agentSort.order,"agent"):this.agents},pagedAgents(){return this.sortedAgents.slice(0,this.agentVisibleCount)},sortedOnlineUsers(){return this.onlineSort.field?this.sortArray(this.onlineUsers,this.onlineSort.field,this.onlineSort.order,"online"):this.onlineUsers},pagedOnlineUsers(){return this.sortedOnlineUsers.slice(0,this.onlineVisibleCount)}},methods:{getHeaders(){let e=Me(),t={"Content-Type":"application/json"};return e.token&&(t.Authorization=`Bearer ${e.token}`),t},toggleSort(e,t){let s=e+"Sort";this[s].field===t?this[s].order=this[s].order==="asc"?"desc":"asc":(this[s].field=t,this[s].order="asc")},sortArray(e,t,s,n){let i=[...e];return i.sort((r,o)=>{let a,l;if(n==="user"&&t==="traffic"?(a=(r.bytesSent||0)+(r.bytesReceived||0),l=(o.bytesSent||0)+(o.bytesReceived||0)):n==="agent"&&t==="online"?(a=r.online?1:0,l=o.online?1:0):n==="agent"&&(t==="totalTokens"||t==="totalTurns")?(a=r.metrics?.[t]||0,l=o.metrics?.[t]||0):(a=r[t],l=o[t]),a==null&&l==null)return 0;if(a==null)return 1;if(l==null)return-1;let c;return typeof a=="string"?c=a.localeCompare(l,void 0,{sensitivity:"base"}):typeof a=="boolean"?c=a===l?0:a?-1:1:c=a-l,s==="desc"?-c:c}),i},async fetchAll(){this.loading=!0,this.error=!1;try{let e=this.getHeaders(),[t,s,n,i]=await Promise.all([fetch("/api/admin/dashboard",{headers:e}),fetch(`/api/admin/user-stats?period=${this.statsPeriod}`,{headers:e}),fetch("/api/admin/agents",{headers:e}),fetch("/api/admin/online-users",{headers:e})]);if(!t.ok||!s.ok||!n.ok||!i.ok){this.error=!0;return}let[r,o,a,l]=await Promise.all([t.json(),s.json(),n.json(),i.json()]);this.overview={totalUsers:r.totalUsers??0,todayActiveUsers:r.todayActiveUsers??0,onlineAgents:r.onlineAgents??0,todayMessages:r.todayMessages??0,totalTokens:r.totalTokens??0,agentMetrics:this.normalizeMetrics(r.agentMetrics||{})},this.userStats=Array.isArray(o)?o:[],this.agents=Array.isArray(a)?a.map(c=>({...c,metrics:this.normalizeMetrics(c.metrics||{})})):[],this.onlineUsers=Array.isArray(l)?l:[],this.loaded=!0}catch{this.error=!0}finally{this.loading=!1}},async refreshAll(){await this.fetchAll()},async switchPeriod(e){e!==this.statsPeriod&&(this.statsPeriod=e,this.userVisibleCount=yt,await this.fetchUserStats())},async fetchUserStats(){try{let e=this.getHeaders(),t=await fetch(`/api/admin/user-stats?period=${this.statsPeriod}`,{headers:e});if(!t.ok)return;let s=await t.json();this.userStats=Array.isArray(s)?s:[]}catch{}},latencyClass(e){return e<100?"db-latency-good":e<=500?"db-latency-warn":"db-latency-bad"},normalizeMetrics(e={}){let t=l=>{let c=Number(l);return Number.isFinite(c)&&c>0?c:0},s=t(e.chatTurns),n=t(e.yeaftTurns),i=t(e.inputTokens),r=t(e.outputTokens),o=t(e.cacheReadTokens),a=t(e.cacheWriteTokens);return{chatTurns:s,yeaftTurns:n,totalTurns:t(e.totalTurns)||s+n,sessionsCreated:t(e.sessionsCreated),inputTokens:i,outputTokens:r,cacheReadTokens:o,cacheWriteTokens:a,totalTokens:t(e.totalTokens)||i+r+o+a,lastUpdatedAt:e.lastUpdatedAt||null}},agentTokenTitle(e){let t=this.normalizeMetrics(e?.metrics||{});return this.tokenTitle(t)},userTokenTitle(e){return this.tokenTitle(e||{})},tokenTitle(e){return[`${this.$t("settings.dashboard.inputTokens")}: ${this.formatNumber(Number(e.inputTokens)||0)}`,`${this.$t("settings.dashboard.outputTokens")}: ${this.formatNumber(Number(e.outputTokens)||0)}`,`${this.$t("settings.dashboard.cacheTokens")}: ${this.formatNumber((Number(e.cacheReadTokens)||0)+(Number(e.cacheWriteTokens)||0))}`].join(" \xB7 ")},formatNumber(e){return e==null?"0":e.toLocaleString()},formatCompactNumber(e){let t=Number(e)||0;return t<1e3?this.formatNumber(t):t<1e6?`${(t/1e3).toFixed(t<1e4?1:0)}K`:t<1e9?`${(t/1e6).toFixed(t<1e7?1:0)}M`:`${(t/1e9).toFixed(1)}B`},formatBytes(e){if(!e||e===0)return"0 B";let t=["B","KB","MB","GB"],s=0,n=e;for(;n>=1024&&s<t.length-1;)n/=1024,s++;return`${n<10&&s>0?n.toFixed(1):Math.round(n)} ${t[s]}`},formatRelativeTime(e){if(!e)return"\u2014";let s=Date.now()-new Date(e).getTime();if(s<0)return"\u2014";let n=Math.floor(s/1e3);if(n<60)return this.$t("settings.dashboard.ago",{time:`${n}s`});let i=Math.floor(n/60);if(i<60)return this.$t("settings.dashboard.ago",{time:`${i}m`});let r=Math.floor(i/60);if(r<24)return this.$t("settings.dashboard.ago",{time:`${r}h`});let o=Math.floor(r/24);return this.$t("settings.dashboard.ago",{time:`${o}d`})}}}});function qp(e){return!e||typeof e!="string"?{ok:!1,reason:"empty_or_non_string"}:e.length>40?{ok:!1,reason:"too_long"}:dv.test(e)?e.startsWith("_")?{ok:!1,reason:"underscore_prefix_reserved"}:uv.test(e)?{ok:!1,reason:"pure_digits"}:pv.includes(e.toLowerCase())?{ok:!1,reason:"reserved"}:{ok:!0}:{ok:!1,reason:"illegal_character"}}function Np(e){return typeof e=="string"&&gv.has(e)}function Os(e){return fv[e]||e}var dv,uv,pv,fv,gv,Bp=H(()=>{dv=/^[A-Za-z0-9_-]+$/,uv=/^[0-9]+$/,pv=["all","user","system","everyone"];fv=Object.freeze({empty_or_non_string:"yeaft.vp.idError.empty_or_non_string",too_long:"yeaft.vp.idError.too_long",illegal_character:"yeaft.vp.idError.illegal_character",underscore_prefix_reserved:"yeaft.vp.idError.underscore_prefix_reserved",pure_digits:"yeaft.vp.idError.pure_digits",reserved:"yeaft.vp.idError.reserved",duplicate:"yeaft.vp.idError.duplicate",not_found:"yeaft.vp.idError.not_found",stock_readonly:"yeaft.vp.idError.stock_readonly",unknown:"yeaft.vp.idError.unknown"}),gv=Object.freeze(new Set(["empty_or_non_string","too_long","illegal_character","underscore_prefix_reserved","pure_digits","reserved","duplicate"]))});var Wp,Up=H(()=>{Rs();xn();Bp();Wp={name:"VpCrudPanel",props:{initialEditVpId:{type:String,default:""}},template:`
2967
2967
  <div class="vp-crud-panel">
2968
2968
  <!-- LIST VIEW -->
2969
2969
  <div v-if="view === 'list'" class="vp-crud-body vp-crud-list">
@@ -3422,7 +3422,7 @@ ${String(e||"").trim()}
3422
3422
  </div>
3423
3423
  </div>
3424
3424
  </div>
3425
- `,setup(e,{emit:t}){let s=Pinia.useChatStore(),n=Vue.getCurrentInstance(),i=k=>n?.proxy?.$t?.(k)??k,r=Vue.computed(()=>s.yeaftMcpServers||[]),o=Vue.computed(()=>s.yeaftMcpRuntime||{connected:!1,toolCount:0,perServer:[]}),a=Vue.computed(()=>!!s.yeaftMcpLoading),l=Vue.computed(()=>{let k=new Map((o.value.perServer||[]).map(y=>[y.name,y]));return r.value.map(y=>{let h=k.get(y.name);return{...y,ready:!!(h&&h.ready),toolCount:h?h.toolCount:0}})}),c=Vue.reactive({name:"",command:"",argsRaw:"",envRaw:""}),d=Vue.ref("");function u(){c.name="",c.command="",c.argsRaw="",c.envRaw="",d.value=""}function p(k){if(!k)return[];let y=[],h=/"([^"]*)"|'([^']*)'|(\S+)/g,b;for(;(b=h.exec(k))!==null;)y.push(b[1]??b[2]??b[3]);return y}function f(k){if(!k)return{};let y={},h=k.split(/\r?\n/);for(let b of h){let _=b.trim();if(!_||_.startsWith("#"))continue;let L=_.indexOf("=");if(L<0)continue;let U=_.slice(0,L).trim(),$=_.slice(L+1);U&&(y[U]=$)}return y}function g(){d.value="";let k=(c.name||"").trim(),y=(c.command||"").trim();if(!k)return d.value=i("settings.mcp.errors.nameRequired"),null;if(!/^[a-z0-9_-]+$/.test(k))return d.value=i("settings.mcp.errors.nameFormat"),null;if(!y)return d.value=i("settings.mcp.errors.commandRequired"),null;let h=[],b={};try{h=p(c.argsRaw)}catch{return d.value=i("settings.mcp.errors.argsParse"),null}try{b=f(c.envRaw)}catch{return d.value=i("settings.mcp.errors.envParse"),null}return{name:k,command:y,args:h,env:b}}async function v(){let k=g();if(!k)return;let y=await s.addYeaftMcpServer(k);if(y?.error){t("message",y.error,!0);return}y?.connectError?t("message",i("settings.mcp.connectFailed")+": "+y.connectError,!0):t("message",i("settings.mcp.addSuccess"),!1),u()}async function m(k){if(!k||!confirm(i("settings.mcp.confirmRemove").replace("{name}",k)))return;let y=await s.removeYeaftMcpServer(k);y?.error?t("message",y.error,!0):t("message",i("settings.mcp.removeSuccess"),!1)}async function A(k){let y=await s.reloadYeaftMcpServer(k);y?.error?t("message",y.error,!0):t("message",i("settings.mcp.reloadSuccess"),!1)}async function w(){let k=await s.reloadYeaftMcpServer(null);k?.error?t("message",k.error,!0):t("message",i("settings.mcp.reloadSuccess"),!1)}return Vue.onMounted(()=>{s.loadYeaftMcpServers()}),{servers:r,runtime:o,loading:a,serversWithStatus:l,form:c,formError:d,resetForm:u,addServer:v,removeOne:m,reloadOne:A,reloadAll:w}}}});var ji,la=H(()=>{ct();Lo();Fo();ls();Op();Up();Kp();jp();ji={name:"SettingsPanel",components:{DashboardTab:Hp,VpCrudPanel:Wp,SearchSettingsTab:zp,McpTab:Yp},props:{visible:Boolean,initialTab:{type:String,default:""},initialSubTab:{type:String,default:""},initialEditVpId:{type:String,default:""}},emits:["close"],template:`
3425
+ `,setup(e,{emit:t}){let s=Pinia.useChatStore(),n=Vue.getCurrentInstance(),i=k=>n?.proxy?.$t?.(k)??k,r=Vue.computed(()=>s.yeaftMcpServers||[]),o=Vue.computed(()=>s.yeaftMcpRuntime||{connected:!1,toolCount:0,perServer:[]}),a=Vue.computed(()=>!!s.yeaftMcpLoading),l=Vue.computed(()=>{let k=new Map((o.value.perServer||[]).map(y=>[y.name,y]));return r.value.map(y=>{let h=k.get(y.name);return{...y,ready:!!(h&&h.ready),toolCount:h?h.toolCount:0}})}),c=Vue.reactive({name:"",command:"",argsRaw:"",envRaw:""}),d=Vue.ref("");function u(){c.name="",c.command="",c.argsRaw="",c.envRaw="",d.value=""}function p(k){if(!k)return[];let y=[],h=/"([^"]*)"|'([^']*)'|(\S+)/g,b;for(;(b=h.exec(k))!==null;)y.push(b[1]??b[2]??b[3]);return y}function f(k){if(!k)return{};let y={},h=k.split(/\r?\n/);for(let b of h){let R=b.trim();if(!R||R.startsWith("#"))continue;let L=R.indexOf("=");if(L<0)continue;let U=R.slice(0,L).trim(),$=R.slice(L+1);U&&(y[U]=$)}return y}function g(){d.value="";let k=(c.name||"").trim(),y=(c.command||"").trim();if(!k)return d.value=i("settings.mcp.errors.nameRequired"),null;if(!/^[a-z0-9_-]+$/.test(k))return d.value=i("settings.mcp.errors.nameFormat"),null;if(!y)return d.value=i("settings.mcp.errors.commandRequired"),null;let h=[],b={};try{h=p(c.argsRaw)}catch{return d.value=i("settings.mcp.errors.argsParse"),null}try{b=f(c.envRaw)}catch{return d.value=i("settings.mcp.errors.envParse"),null}return{name:k,command:y,args:h,env:b}}async function v(){let k=g();if(!k)return;let y=await s.addYeaftMcpServer(k);if(y?.error){t("message",y.error,!0);return}y?.connectError?t("message",i("settings.mcp.connectFailed")+": "+y.connectError,!0):t("message",i("settings.mcp.addSuccess"),!1),u()}async function m(k){if(!k||!confirm(i("settings.mcp.confirmRemove").replace("{name}",k)))return;let y=await s.removeYeaftMcpServer(k);y?.error?t("message",y.error,!0):t("message",i("settings.mcp.removeSuccess"),!1)}async function A(k){let y=await s.reloadYeaftMcpServer(k);y?.error?t("message",y.error,!0):t("message",i("settings.mcp.reloadSuccess"),!1)}async function w(){let k=await s.reloadYeaftMcpServer(null);k?.error?t("message",k.error,!0):t("message",i("settings.mcp.reloadSuccess"),!1)}return Vue.onMounted(()=>{s.loadYeaftMcpServers()}),{servers:r,runtime:o,loading:a,serversWithStatus:l,form:c,formError:d,resetForm:u,addServer:v,removeOne:m,reloadOne:A,reloadAll:w}}}});var ji,la=H(()=>{ct();Lo();Fo();ls();Op();Up();Kp();jp();ji={name:"SettingsPanel",components:{DashboardTab:Hp,VpCrudPanel:Wp,SearchSettingsTab:zp,McpTab:Yp},props:{visible:Boolean,initialTab:{type:String,default:""},initialSubTab:{type:String,default:""},initialEditVpId:{type:String,default:""}},emits:["close"],template:`
3426
3426
  <div
3427
3427
  class="settings-overlay"
3428
3428
  v-if="visible"
@@ -3821,7 +3821,7 @@ ${String(e||"").trim()}
3821
3821
  </div>
3822
3822
  </div>
3823
3823
  </div>
3824
- `,directives:{"click-outside":{mounted(e,t){e._clickOutside=s=>{e.contains(s.target)||t.value()},document.addEventListener("click",e._clickOutside)},unmounted(e){document.removeEventListener("click",e._clickOutside)}}},data(){let e=Pinia.useChatStore();return{activeTab:"general",yeaftSubTab:"vp",profile:null,agentSecret:null,showSecret:!1,resettingSecret:!1,resetConfirm:!1,currentPassword:"",newPassword:"",confirmPassword:"",changingPassword:!1,deletePassword:"",deleteConfirm:!1,deleteConfirmText:"",deletingAccount:!1,invitations:[],inviteRole:"pro",creatingInvite:!1,message:"",isError:!1,selectedLocale:e.locale,openDropdown:null,officePreviewMode:localStorage.getItem("officePreviewMode")||"local",ssoBoundMessage:"",ssoConflictMessage:"",qrDataUrl:""}},computed:{authStore(){return Me()},chatStore(){return Pinia.useChatStore()},roleLabel(){return{admin:this.$t("settings.account.roleAdmin"),pro:this.$t("settings.account.rolePro")}[this.profile?.role]||this.$t("settings.account.rolePro")},accountDisplayName(){let e=this.profile;return e?e.displayName&&e.displayName!==e.username?e.displayName:e.username||"-":"-"},visibleTabs(){let e=[{key:"general",label:this.$t("settings.tabs.general")},{key:"account",label:this.$t("settings.tabs.account")},{key:"security",label:this.$t("settings.tabs.security")}];return(this.authStore.role==="admin"||this.authStore.role==="pro")&&e.push({key:"yeaft",label:this.$t("settings.tabs.yeaft")}),this.authStore.role==="admin"&&(e.push({key:"invitations",label:this.$t("settings.tabs.invitations")}),e.push({key:"dashboard",label:this.$t("settings.tabs.dashboard")})),e},currentTabLabel(){return this.visibleTabs.find(t=>t.key===this.activeTab)?.label||""},themeOptions(){return[{value:"light",label:this.$t("settings.general.lightTheme")},{value:"dark",label:this.$t("settings.general.darkTheme")}]},yeaftSubTabs(){return[{key:"vp",label:this.$t("settings.yeaft.tabs.vp")},{key:"search",label:this.$t("settings.yeaft.tabs.search")},{key:"mcp",label:this.$t("settings.yeaft.tabs.mcp")}]},languageOptions(){return[{value:"zh-CN",label:"\u4E2D\u6587"},{value:"en",label:"English"}]},officePreviewOptions(){return[{value:"local",label:this.$t("files.localRender")},{value:"online",label:this.$t("files.officeOnline")}]},roleOptions(){return[{value:"pro",label:this.$t("settings.invite.proUser")}]},agentSecretActionLabel(){return this.agentSecret?this.$t("settings.security.resetKey"):this.$t("settings.security.generateKey")},agentName(){return Vo(this.profile)},agentInstanceId(){return this.agentName},serverWsUrl(){return vn(location)},agentInstallCommand(){return Ii()},agentServiceCommand(){return xi({profile:this.profile,agentSecret:this.agentSecret,serverWsUrl:this.serverWsUrl})},agentLlmCommand(){return Ai()},ssoProviderRows(){let e=this.authStore,t=new Map((e.linkedIdentities||[]).map(n=>[n.provider,n]));return[{key:"alipay",label:this.$t("login.alipay"),enabled:!!e.ssoProviders.alipay},{key:"microsoft",label:this.$t("login.microsoft"),enabled:!!e.aadEnabled},{key:"github",label:this.$t("login.github"),enabled:!!e.ssoProviders.github},{key:"google",label:this.$t("login.google"),enabled:!!e.ssoProviders.google},{key:"wechat",label:this.$t("login.wechat"),enabled:!!e.ssoProviders.wechat}].filter(n=>n.enabled||t.has(n.key)).map(n=>({...n,linked:t.has(n.key),identity:t.get(n.key)||null}))},qrModalTitle(){let e=this.authStore.qrPanel?.provider;return e==="alipay"?this.$t("login.qr.titleAlipay"):e==="wechat"?this.$t("login.qr.titleWechat"):this.$t("login.qr.title")}},mounted(){if(this.visible)return this.applyInitialEntryPoint(),this.loadData()},watch:{visible(e){e?(this.applyInitialEntryPoint(),this.loadData()):this.authStore.qrPanel&&this.cancelQrBind()},activeTab(e){e==="invitations"&&this.authStore.role==="admin"&&this.loadInvitations()},"authStore.qrPanel.status"(e){if(e==="bound"){let t=this.authStore.qrPanel?.provider;this.authStore.cancelSsoQr(),this.qrDataUrl="",this.authStore.loadIdentities(),this.ssoBoundMessage=this.$t("settings.account.ssoBoundMsg",{provider:t?this.$t("login."+t):""})}},"authStore.qrPanel.authorizeUrl"(e){e&&this.authStore.qrPanel?.intent==="bind"&&this.renderQrCode()}},methods:{trackOverlayPointerDown:rt,trackOverlayPointerUp:ot,clearOverlayPointerGesture:at,onSettingsOverlayClick(e){Ze(e)&&this.$emit("close")},onQrOverlayClick(e){Ze(e)&&this.cancelQrBind()},changeLanguage(){this.chatStore.changeLocale(this.selectedLocale)},selectLanguage(e){this.selectedLocale=e,this.chatStore.changeLocale(e)},toggleDropdown(e){this.openDropdown=this.openDropdown===e?null:e},closeDropdown(e){this.openDropdown===e&&(this.openDropdown=null)},setTheme(e){this.chatStore.theme!==e&&this.chatStore.toggleTheme()},setOfficePreviewMode(e){this.officePreviewMode=e,localStorage.setItem("officePreviewMode",e)},applyInitialEntryPoint(){this.initialTab&&this.visibleTabs.some(e=>e.key===this.initialTab)&&(this.activeTab=this.initialTab),this.initialSubTab&&this.activeTab==="yeaft"&&(this.yeaftSubTab=this.yeaftSubTabs.some(e=>e.key===this.initialSubTab)?this.initialSubTab:"vp"),this.initialEditVpId&&this.activeTab==="yeaft"&&(this.yeaftSubTab="vp")},async loadData(){this.message="",this._consumeSsoQueryFlags();try{let e=this.getHeaders(),[t,s]=await Promise.all([fetch("/api/user/profile",{headers:e}),fetch("/api/user/agent-secret",{headers:e})]);if(t.ok)this.profile=await t.json();else{let n=await t.json().catch(()=>({}));this.showMessage(n.error||this.$t("settings.account.profileLoadFailed"),!0)}if(s.ok){let n=await s.json();this.applyAgentSecretResponse(n)}this.authStore.role==="admin"&&this.activeTab==="invitations"&&await this.loadInvitations();try{await this.authStore.loadIdentities()}catch{}}catch{}},_consumeSsoQueryFlags(){let e=window.location.hash||"",t=e.indexOf("?");if(t<0)return;let s=new URLSearchParams(e.slice(t+1)),n=s.get("ssoBound"),i=s.get("ssoError"),r=s.get("provider");if(n&&(this.ssoBoundMessage=this.$t("settings.account.ssoBoundMsg",{provider:n}),this.activeTab="account"),i==="conflict"&&(this.ssoConflictMessage=this.$t("settings.account.ssoConflictMsg",{provider:r||""}),this.activeTab="account"),n||i)try{history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}},bindSso(e){if(this.ssoBoundMessage="",this.ssoConflictMessage="",e==="alipay"&&Si()){this.authStore.bindSso(e);return}if(e==="alipay"&&Rs()){this.authStore.loginWithAlipayMobile({intent:"bind"});return}if(e==="wechat"&&(Rs()||ki())){this.ssoConflictMessage=this.$t("login.wechat.mobileUnsupported");return}e==="alipay"||e==="wechat"?this.startQrBind(e):this.authStore.bindSso(e)},async startQrBind(e){if(this.qrDataUrl="",!await this.authStore.startSsoQr(e,{intent:"bind"})){this.ssoConflictMessage=this.authStore.error||this.$t("settings.account.bindFailed");return}this.renderQrCode()},cancelQrBind(){this.authStore.cancelSsoQr(),this.qrDataUrl=""},relaunchAlipayMobile(){let e=this.authStore.qrPanel;if(!e||!e.authorizeUrl)return;let t=`alipays://platformapi/startapp?appId=20000067&url=${encodeURIComponent(e.authorizeUrl)}`;window.location.href=t},renderQrCode(){let e=this.authStore.qrPanel;if(!(!e||!e.authorizeUrl)&&typeof qrcode=="function")try{let t=qrcode(0,"M");t.addData(e.authorizeUrl,"Byte"),t.make(),this.qrDataUrl=t.createDataURL(6,4)}catch{}},async unbindSso(e){this.ssoBoundMessage="",this.ssoConflictMessage="",await this.authStore.unbindIdentity(e)||(this.ssoConflictMessage=this.authStore.identitiesError||this.$t("settings.account.unbindFailed"))},canUnbind(e){let t=this.authStore.linkedIdentities||[];return t.some(n=>n.provider===e)?this.authStore.hasPassword?!0:t.length>1:!1},async loadInvitations(){try{let e=await fetch("/api/invitations",{headers:this.getHeaders()});if(e.ok){let t=await e.json();this.invitations=t.invitations.map(s=>({...s,code:s.id,expiresAt:s.expires_at,usedByUsername:s.used_by_username||null}))}}catch{}},getHeaders(){let e={"Content-Type":"application/json"},t=this.authStore.getActiveToken?.()||this.authStore.token;return t&&(e.Authorization=`Bearer ${t}`),e},applyAgentSecretResponse(e){let t=e?.agentSecret||e?.agent_secret||null;this.agentSecret=t&&String(t).trim()?String(t):null},async copySecret(){this.agentSecret&&await this.copyText(this.agentSecret)},async copyText(e){try{await navigator.clipboard.writeText(e),this.showMessage(this.$t("settings.msg.copiedClipboard"))}catch{this.showMessage(this.$t("settings.msg.copyFailed"),!0)}},async resetSecret(){if(this.agentSecret&&!this.resetConfirm){this.resetConfirm=!0;return}this.resettingSecret=!0;try{let e=await fetch("/api/user/agent-secret/reset",{method:"POST",headers:this.getHeaders()});if(e.ok){let t=await e.json();this.applyAgentSecretResponse(t),this.showSecret=!0,this.showMessage(this.$t("settings.msg.keyReset"))}else{let t=await e.json();this.showMessage(t.error||this.$t("settings.msg.resetFailed"),!0)}}catch(e){this.showMessage(this.$t("settings.msg.resetFailed")+": "+e.message,!0)}finally{this.resettingSecret=!1,this.resetConfirm=!1}},async changePassword(){let e=this.profile&&this.profile.hasPassword===!1;if(!e&&!this.currentPassword){this.showMessage(this.$t("settings.security.enterCurrentPwd"),!0);return}if(!this.newPassword||this.newPassword.length<6){this.showMessage(this.$t("settings.security.newPwdMin"),!0);return}if(this.newPassword!==this.confirmPassword){this.showMessage(this.$t("settings.security.pwdMismatch"),!0);return}this.changingPassword=!0;try{let t={newPassword:this.newPassword};e||(t.currentPassword=this.currentPassword);let s=await fetch("/api/user/profile",{method:"PUT",headers:this.getHeaders(),body:JSON.stringify(t)}),n=await s.json();if(s.ok&&n.success){this.showMessage(e?this.$t("settings.security.pwdSet"):this.$t("settings.security.pwdChanged")),this.currentPassword="",this.newPassword="",this.confirmPassword="";try{let i=await fetch("/api/user/profile",{headers:this.getHeaders()});i.ok&&(this.profile=await i.json())}catch{}}else this.showMessage(n.error||this.$t("settings.msg.changeFailed"),!0)}catch(t){this.showMessage(this.$t("settings.msg.changeFailed")+": "+t.message,!0)}finally{this.changingPassword=!1}},cancelDeleteAccount(){this.deleteConfirm=!1,this.deletePassword="",this.deleteConfirmText=""},async deleteAccount(){if(!this.deleteConfirm){this.deleteConfirm=!0;return}let e=this.profile&&this.profile.hasPassword!==!1;if(e&&!this.deletePassword){this.showMessage(this.$t("settings.security.enterCurrentPwd"),!0);return}if(!e&&this.deleteConfirmText!=="DELETE"){this.showMessage(this.$t("settings.security.deleteConfirmRequired"),!0);return}this.deletingAccount=!0;try{let t=await this.authStore.deleteAccount(e?{currentPassword:this.deletePassword}:{confirm:"DELETE"});if(!t.success){this.showMessage(t.error||this.$t("settings.security.deleteFailed"),!0);return}window.location.reload()}finally{this.deletingAccount=!1}},async createInvitation(){this.creatingInvite=!0;try{let e=await fetch("/api/invitations",{method:"POST",headers:this.getHeaders(),body:JSON.stringify({role:this.inviteRole})});if(e.ok)await this.loadInvitations(),this.showMessage(this.$t("settings.msg.inviteCreated"));else{let t=await e.json();this.showMessage(t.error||this.$t("settings.msg.createFailed"),!0)}}catch(e){this.showMessage(this.$t("settings.msg.createFailed")+": "+e.message,!0)}finally{this.creatingInvite=!1}},async copyInviteCode(e){try{await navigator.clipboard.writeText(e),this.showMessage(this.$t("settings.msg.inviteCopied"))}catch{this.showMessage(this.$t("settings.msg.copyFailed"),!0)}},async deleteInvitation(e){try{let t=await fetch(`/api/invitations/${e}`,{method:"DELETE",headers:this.getHeaders()});if(t.ok)await this.loadInvitations(),this.showMessage(this.$t("settings.msg.inviteDeleted"));else{let s=await t.json();this.showMessage(s.error||this.$t("settings.msg.deleteFailed"),!0)}}catch(t){this.showMessage(this.$t("settings.msg.deleteFailed")+": "+t.message,!0)}},inviteStatusClass(e){return e.used_by?"used":e.expiresAt<Date.now()?"expired":""},inviteStatusText(e){return e.used_by?this.$t("settings.invite.used"):e.expiresAt<Date.now()?this.$t("settings.invite.expired"):this.$t("settings.invite.available")},formatTime(e){return new Date(e).toLocaleString()},async doLogout(){await this.authStore.logout(),window.location.reload()},showMessage(e,t=!1){this.message=e,this.isError=t,setTimeout(()=>{this.message=""},3e3)},onLlmMessage(e,t){this.showMessage(e,t)},onYeaftLlmSaved(){let e=this.chatStore?.currentAgent;e&&this.chatStore.sendWsMessage({type:"yeaft_reset",agentId:e})}}}});var Gp,Qp=H(()=>{Gp={name:"ExpertRoleEditor",template:`
3824
+ `,directives:{"click-outside":{mounted(e,t){e._clickOutside=s=>{e.contains(s.target)||t.value()},document.addEventListener("click",e._clickOutside)},unmounted(e){document.removeEventListener("click",e._clickOutside)}}},data(){let e=Pinia.useChatStore();return{activeTab:"general",yeaftSubTab:"vp",profile:null,agentSecret:null,showSecret:!1,resettingSecret:!1,resetConfirm:!1,currentPassword:"",newPassword:"",confirmPassword:"",changingPassword:!1,deletePassword:"",deleteConfirm:!1,deleteConfirmText:"",deletingAccount:!1,invitations:[],inviteRole:"pro",creatingInvite:!1,message:"",isError:!1,selectedLocale:e.locale,openDropdown:null,officePreviewMode:localStorage.getItem("officePreviewMode")||"local",ssoBoundMessage:"",ssoConflictMessage:"",qrDataUrl:""}},computed:{authStore(){return Me()},chatStore(){return Pinia.useChatStore()},roleLabel(){return{admin:this.$t("settings.account.roleAdmin"),pro:this.$t("settings.account.rolePro")}[this.profile?.role]||this.$t("settings.account.rolePro")},accountDisplayName(){let e=this.profile;return e?e.displayName&&e.displayName!==e.username?e.displayName:e.username||"-":"-"},visibleTabs(){let e=[{key:"general",label:this.$t("settings.tabs.general")},{key:"account",label:this.$t("settings.tabs.account")},{key:"security",label:this.$t("settings.tabs.security")}];return(this.authStore.role==="admin"||this.authStore.role==="pro")&&e.push({key:"yeaft",label:this.$t("settings.tabs.yeaft")}),this.authStore.role==="admin"&&(e.push({key:"invitations",label:this.$t("settings.tabs.invitations")}),e.push({key:"dashboard",label:this.$t("settings.tabs.dashboard")})),e},currentTabLabel(){return this.visibleTabs.find(t=>t.key===this.activeTab)?.label||""},themeOptions(){return[{value:"light",label:this.$t("settings.general.lightTheme")},{value:"dark",label:this.$t("settings.general.darkTheme")}]},yeaftSubTabs(){return[{key:"vp",label:this.$t("settings.yeaft.tabs.vp")},{key:"search",label:this.$t("settings.yeaft.tabs.search")},{key:"mcp",label:this.$t("settings.yeaft.tabs.mcp")}]},languageOptions(){return[{value:"zh-CN",label:"\u4E2D\u6587"},{value:"en",label:"English"}]},officePreviewOptions(){return[{value:"local",label:this.$t("files.localRender")},{value:"online",label:this.$t("files.officeOnline")}]},roleOptions(){return[{value:"pro",label:this.$t("settings.invite.proUser")}]},agentSecretActionLabel(){return this.agentSecret?this.$t("settings.security.resetKey"):this.$t("settings.security.generateKey")},agentName(){return Vo(this.profile)},agentInstanceId(){return this.agentName},serverWsUrl(){return vn(location)},agentInstallCommand(){return Ii()},agentServiceCommand(){return xi({profile:this.profile,agentSecret:this.agentSecret,serverWsUrl:this.serverWsUrl})},agentLlmCommand(){return Ai()},ssoProviderRows(){let e=this.authStore,t=new Map((e.linkedIdentities||[]).map(n=>[n.provider,n]));return[{key:"alipay",label:this.$t("login.alipay"),enabled:!!e.ssoProviders.alipay},{key:"microsoft",label:this.$t("login.microsoft"),enabled:!!e.aadEnabled},{key:"github",label:this.$t("login.github"),enabled:!!e.ssoProviders.github},{key:"google",label:this.$t("login.google"),enabled:!!e.ssoProviders.google},{key:"wechat",label:this.$t("login.wechat"),enabled:!!e.ssoProviders.wechat}].filter(n=>n.enabled||t.has(n.key)).map(n=>({...n,linked:t.has(n.key),identity:t.get(n.key)||null}))},qrModalTitle(){let e=this.authStore.qrPanel?.provider;return e==="alipay"?this.$t("login.qr.titleAlipay"):e==="wechat"?this.$t("login.qr.titleWechat"):this.$t("login.qr.title")}},mounted(){if(this.visible)return this.applyInitialEntryPoint(),this.loadData()},watch:{visible(e){e?(this.applyInitialEntryPoint(),this.loadData()):this.authStore.qrPanel&&this.cancelQrBind()},activeTab(e){e==="invitations"&&this.authStore.role==="admin"&&this.loadInvitations()},"authStore.qrPanel.status"(e){if(e==="bound"){let t=this.authStore.qrPanel?.provider;this.authStore.cancelSsoQr(),this.qrDataUrl="",this.authStore.loadIdentities(),this.ssoBoundMessage=this.$t("settings.account.ssoBoundMsg",{provider:t?this.$t("login."+t):""})}},"authStore.qrPanel.authorizeUrl"(e){e&&this.authStore.qrPanel?.intent==="bind"&&this.renderQrCode()}},methods:{trackOverlayPointerDown:rt,trackOverlayPointerUp:ot,clearOverlayPointerGesture:at,onSettingsOverlayClick(e){Ze(e)&&this.$emit("close")},onQrOverlayClick(e){Ze(e)&&this.cancelQrBind()},changeLanguage(){this.chatStore.changeLocale(this.selectedLocale)},selectLanguage(e){this.selectedLocale=e,this.chatStore.changeLocale(e)},toggleDropdown(e){this.openDropdown=this.openDropdown===e?null:e},closeDropdown(e){this.openDropdown===e&&(this.openDropdown=null)},setTheme(e){this.chatStore.theme!==e&&this.chatStore.toggleTheme()},setOfficePreviewMode(e){this.officePreviewMode=e,localStorage.setItem("officePreviewMode",e)},applyInitialEntryPoint(){this.initialTab&&this.visibleTabs.some(e=>e.key===this.initialTab)&&(this.activeTab=this.initialTab),this.initialSubTab&&this.activeTab==="yeaft"&&(this.yeaftSubTab=this.yeaftSubTabs.some(e=>e.key===this.initialSubTab)?this.initialSubTab:"vp"),this.initialEditVpId&&this.activeTab==="yeaft"&&(this.yeaftSubTab="vp")},async loadData(){this.message="",this._consumeSsoQueryFlags();try{let e=this.getHeaders(),[t,s]=await Promise.all([fetch("/api/user/profile",{headers:e}),fetch("/api/user/agent-secret",{headers:e})]);if(t.ok)this.profile=await t.json();else{let n=await t.json().catch(()=>({}));this.showMessage(n.error||this.$t("settings.account.profileLoadFailed"),!0)}if(s.ok){let n=await s.json();this.applyAgentSecretResponse(n)}this.authStore.role==="admin"&&this.activeTab==="invitations"&&await this.loadInvitations();try{await this.authStore.loadIdentities()}catch{}}catch{}},_consumeSsoQueryFlags(){let e=window.location.hash||"",t=e.indexOf("?");if(t<0)return;let s=new URLSearchParams(e.slice(t+1)),n=s.get("ssoBound"),i=s.get("ssoError"),r=s.get("provider");if(n&&(this.ssoBoundMessage=this.$t("settings.account.ssoBoundMsg",{provider:n}),this.activeTab="account"),i==="conflict"&&(this.ssoConflictMessage=this.$t("settings.account.ssoConflictMsg",{provider:r||""}),this.activeTab="account"),n||i)try{history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}},bindSso(e){if(this.ssoBoundMessage="",this.ssoConflictMessage="",e==="alipay"&&Si()){this.authStore.bindSso(e);return}if(e==="alipay"&&_s()){this.authStore.loginWithAlipayMobile({intent:"bind"});return}if(e==="wechat"&&(_s()||ki())){this.ssoConflictMessage=this.$t("login.wechat.mobileUnsupported");return}e==="alipay"||e==="wechat"?this.startQrBind(e):this.authStore.bindSso(e)},async startQrBind(e){if(this.qrDataUrl="",!await this.authStore.startSsoQr(e,{intent:"bind"})){this.ssoConflictMessage=this.authStore.error||this.$t("settings.account.bindFailed");return}this.renderQrCode()},cancelQrBind(){this.authStore.cancelSsoQr(),this.qrDataUrl=""},relaunchAlipayMobile(){let e=this.authStore.qrPanel;if(!e||!e.authorizeUrl)return;let t=`alipays://platformapi/startapp?appId=20000067&url=${encodeURIComponent(e.authorizeUrl)}`;window.location.href=t},renderQrCode(){let e=this.authStore.qrPanel;if(!(!e||!e.authorizeUrl)&&typeof qrcode=="function")try{let t=qrcode(0,"M");t.addData(e.authorizeUrl,"Byte"),t.make(),this.qrDataUrl=t.createDataURL(6,4)}catch{}},async unbindSso(e){this.ssoBoundMessage="",this.ssoConflictMessage="",await this.authStore.unbindIdentity(e)||(this.ssoConflictMessage=this.authStore.identitiesError||this.$t("settings.account.unbindFailed"))},canUnbind(e){let t=this.authStore.linkedIdentities||[];return t.some(n=>n.provider===e)?this.authStore.hasPassword?!0:t.length>1:!1},async loadInvitations(){try{let e=await fetch("/api/invitations",{headers:this.getHeaders()});if(e.ok){let t=await e.json();this.invitations=t.invitations.map(s=>({...s,code:s.id,expiresAt:s.expires_at,usedByUsername:s.used_by_username||null}))}}catch{}},getHeaders(){let e={"Content-Type":"application/json"},t=this.authStore.getActiveToken?.()||this.authStore.token;return t&&(e.Authorization=`Bearer ${t}`),e},applyAgentSecretResponse(e){let t=e?.agentSecret||e?.agent_secret||null;this.agentSecret=t&&String(t).trim()?String(t):null},async copySecret(){this.agentSecret&&await this.copyText(this.agentSecret)},async copyText(e){try{await navigator.clipboard.writeText(e),this.showMessage(this.$t("settings.msg.copiedClipboard"))}catch{this.showMessage(this.$t("settings.msg.copyFailed"),!0)}},async resetSecret(){if(this.agentSecret&&!this.resetConfirm){this.resetConfirm=!0;return}this.resettingSecret=!0;try{let e=await fetch("/api/user/agent-secret/reset",{method:"POST",headers:this.getHeaders()});if(e.ok){let t=await e.json();this.applyAgentSecretResponse(t),this.showSecret=!0,this.showMessage(this.$t("settings.msg.keyReset"))}else{let t=await e.json();this.showMessage(t.error||this.$t("settings.msg.resetFailed"),!0)}}catch(e){this.showMessage(this.$t("settings.msg.resetFailed")+": "+e.message,!0)}finally{this.resettingSecret=!1,this.resetConfirm=!1}},async changePassword(){let e=this.profile&&this.profile.hasPassword===!1;if(!e&&!this.currentPassword){this.showMessage(this.$t("settings.security.enterCurrentPwd"),!0);return}if(!this.newPassword||this.newPassword.length<6){this.showMessage(this.$t("settings.security.newPwdMin"),!0);return}if(this.newPassword!==this.confirmPassword){this.showMessage(this.$t("settings.security.pwdMismatch"),!0);return}this.changingPassword=!0;try{let t={newPassword:this.newPassword};e||(t.currentPassword=this.currentPassword);let s=await fetch("/api/user/profile",{method:"PUT",headers:this.getHeaders(),body:JSON.stringify(t)}),n=await s.json();if(s.ok&&n.success){this.showMessage(e?this.$t("settings.security.pwdSet"):this.$t("settings.security.pwdChanged")),this.currentPassword="",this.newPassword="",this.confirmPassword="";try{let i=await fetch("/api/user/profile",{headers:this.getHeaders()});i.ok&&(this.profile=await i.json())}catch{}}else this.showMessage(n.error||this.$t("settings.msg.changeFailed"),!0)}catch(t){this.showMessage(this.$t("settings.msg.changeFailed")+": "+t.message,!0)}finally{this.changingPassword=!1}},cancelDeleteAccount(){this.deleteConfirm=!1,this.deletePassword="",this.deleteConfirmText=""},async deleteAccount(){if(!this.deleteConfirm){this.deleteConfirm=!0;return}let e=this.profile&&this.profile.hasPassword!==!1;if(e&&!this.deletePassword){this.showMessage(this.$t("settings.security.enterCurrentPwd"),!0);return}if(!e&&this.deleteConfirmText!=="DELETE"){this.showMessage(this.$t("settings.security.deleteConfirmRequired"),!0);return}this.deletingAccount=!0;try{let t=await this.authStore.deleteAccount(e?{currentPassword:this.deletePassword}:{confirm:"DELETE"});if(!t.success){this.showMessage(t.error||this.$t("settings.security.deleteFailed"),!0);return}window.location.reload()}finally{this.deletingAccount=!1}},async createInvitation(){this.creatingInvite=!0;try{let e=await fetch("/api/invitations",{method:"POST",headers:this.getHeaders(),body:JSON.stringify({role:this.inviteRole})});if(e.ok)await this.loadInvitations(),this.showMessage(this.$t("settings.msg.inviteCreated"));else{let t=await e.json();this.showMessage(t.error||this.$t("settings.msg.createFailed"),!0)}}catch(e){this.showMessage(this.$t("settings.msg.createFailed")+": "+e.message,!0)}finally{this.creatingInvite=!1}},async copyInviteCode(e){try{await navigator.clipboard.writeText(e),this.showMessage(this.$t("settings.msg.inviteCopied"))}catch{this.showMessage(this.$t("settings.msg.copyFailed"),!0)}},async deleteInvitation(e){try{let t=await fetch(`/api/invitations/${e}`,{method:"DELETE",headers:this.getHeaders()});if(t.ok)await this.loadInvitations(),this.showMessage(this.$t("settings.msg.inviteDeleted"));else{let s=await t.json();this.showMessage(s.error||this.$t("settings.msg.deleteFailed"),!0)}}catch(t){this.showMessage(this.$t("settings.msg.deleteFailed")+": "+t.message,!0)}},inviteStatusClass(e){return e.used_by?"used":e.expiresAt<Date.now()?"expired":""},inviteStatusText(e){return e.used_by?this.$t("settings.invite.used"):e.expiresAt<Date.now()?this.$t("settings.invite.expired"):this.$t("settings.invite.available")},formatTime(e){return new Date(e).toLocaleString()},async doLogout(){await this.authStore.logout(),window.location.reload()},showMessage(e,t=!1){this.message=e,this.isError=t,setTimeout(()=>{this.message=""},3e3)},onLlmMessage(e,t){this.showMessage(e,t)},onYeaftLlmSaved(){let e=this.chatStore?.currentAgent;e&&this.chatStore.sendWsMessage({type:"yeaft_reset",agentId:e})}}}});var Gp,Qp=H(()=>{Gp={name:"ExpertRoleEditor",template:`
3825
3825
  <div class="expert-editor-overlay" @click.self="$emit('close')">
3826
3826
  <div class="expert-editor-modal">
3827
3827
  <div class="expert-editor-header">
@@ -4131,7 +4131,7 @@ ${String(e||"").trim()}
4131
4131
  </div>
4132
4132
  </div>
4133
4133
  </div>
4134
- `,props:{visible:{type:Boolean,default:!1},modelValue:{type:Array,default:()=>[]}},emits:["close","update:modelValue"],setup(e,{emit:t}){let s=Pinia.useChatStore(),n=Pinia.useAuthStore(),i=Vue.ref(null),r=Vue.computed(()=>n.role==="admin"),o=Vue.computed(()=>(s.locale||"zh-CN")==="zh-CN"),a=Vue.ref(null),l=Vue.ref(!1),c=Vue.ref(null),d=Vue.ref(null),u={id:"custom",name:o.value?"\u81EA\u5B9A\u4E49":"Custom",nameEn:"Custom",icon:"\u2728",order:99},p=Vue.computed(()=>{if(!a.value)return null;let x=dt[a.value];return x||s.customExpertRoles.find(j=>j.id===a.value)||null}),f=Vue.computed(()=>{let x=p.value;return x?`${x.title}\xB7${x.name}`:""}),g=Vue.computed(()=>!a.value||!s.expertRoleDefinitions?null:s.expertRoleDefinitions[a.value]||null),v=Vue.computed(()=>!a.value||dt[a.value]?null:s.customExpertRoles.find(x=>x.id===a.value)||null),m=Vue.ref(new Set([cc])),A=Vue.computed(()=>e.modelValue),w=Vue.computed(()=>dc(r.value)),k=Vue.computed(()=>{let x=[...w.value];return x.push({id:"custom",name:o.value?"\u81EA\u5B9A\u4E49":"Custom",icon:"\u2728",order:99}),x}),y=Vue.computed(()=>m.value.has("custom")),h=Vue.computed(()=>new Set(w.value.map(x=>x.id))),b=Vue.computed(()=>ac().filter(x=>h.value.has(x.teamId)&&m.value.has(x.teamId)));Vue.watch(()=>e.visible,x=>{x&&(s.fetchExpertRoleDefinitions(),s.fetchCustomExpertRoles())});let _=x=>{a.value=x,dt[x]&&s.fetchExpertRoleDefinitions()},L=x=>{c.value=x,l.value=!0},U=()=>{s.fetchCustomExpertRoles()},$=x=>{d.value=x},R=async()=>{if(d.value){try{let x=d.value.id,j=A.value.filter(ae=>ae.role!==x);j.length!==A.value.length&&t("update:modelValue",j),await s.deleteCustomExpertRole(x)}catch{}d.value=null}},P=x=>{if(!(m.value.size===1&&m.value.has(x)))if(m.value=new Set([x]),x==="custom"){let j=new Set(s.customExpertRoles.map(he=>he.id)),ae=A.value.filter(he=>j.has(he.role));ae.length!==A.value.length&&t("update:modelValue",ae)}else{let j=A.value.filter(ae=>{let he=dt[ae.role];return he&&he.group===x});j.length!==A.value.length&&t("update:modelValue",j)}},T=(x,j)=>A.value.some(ae=>ae.role===x&&ae.action===(j||null)),I=x=>A.value.some(j=>j.role===x&&!j.action),M=x=>A.value.some(j=>j.role===x),B=x=>A.value.length>=Zt&&!M(x),F=(x,j)=>T(x,j)?!1:!!(M(x)||A.value.length>=Zt),z=x=>{if(I(x.id)){t("update:modelValue",A.value.filter(j=>!(j.role===x.id&&!j.action)));return}if(M(x.id)){t("update:modelValue",[...A.value.filter(j=>j.role!==x.id),{role:x.id,action:null}]);return}A.value.length>=Zt||t("update:modelValue",[...A.value,{role:x.id,action:null}])},ne=(x,j)=>{if(T(x.id,j.id)){t("update:modelValue",A.value.filter(ae=>!(ae.role===x.id&&ae.action===j.id)));return}if(M(x.id)){t("update:modelValue",[...A.value.filter(ae=>ae.role!==x.id),{role:x.id,action:j.id}]);return}A.value.length>=Zt||t("update:modelValue",[...A.value,{role:x.id,action:j.id}])};return{store:s,roleListRef:i,enabledTeams:m,selections:A,availableTeams:w,allTeamTabs:k,filteredGroups:b,isZh:o,isCustomTabActive:y,viewingRoleId:a,viewingRoleMeta:p,viewingRoleTitle:f,viewingRoleDef:g,viewingCustomRole:v,viewRole:_,editorOpen:l,editingRole:c,openEditor:L,onEditorSaved:U,deletingRole:d,confirmDeleteRole:$,executeDelete:R,toggleTeam:P,isSelected:T,isRoleOnlySelected:I,hasRoleSelection:M,isRoleDisabled:B,isDisabled:F,toggleRoleOnly:z,toggleAction:ne,toggleCustomRoleOnly:x=>{z(x)},toggleCustomAction:(x,j)=>{ne(x,j)},getSelectionLabelFull:x=>{if(dt[x.role])return Xt(x);let ae=s.customExpertRoles.find(he=>he.id===x.role);if(!ae)return x.role;if(x.action){let he=ae.actions?.find(W=>W.id===x.action);return he?`${ae.name}\xB7${he.name}`:ae.name}return ae.name},removeSelection:x=>{let j=[...A.value];j.splice(x,1),t("update:modelValue",j)},clearAll:()=>{t("update:modelValue",[])},getSelectionLabel:Xt}}}});var Qi,da=H(()=>{wn();Qi={name:"SubAgentPanel",props:{visible:{type:Boolean,default:!1}},emits:["close"],template:`
4134
+ `,props:{visible:{type:Boolean,default:!1},modelValue:{type:Array,default:()=>[]}},emits:["close","update:modelValue"],setup(e,{emit:t}){let s=Pinia.useChatStore(),n=Pinia.useAuthStore(),i=Vue.ref(null),r=Vue.computed(()=>n.role==="admin"),o=Vue.computed(()=>(s.locale||"zh-CN")==="zh-CN"),a=Vue.ref(null),l=Vue.ref(!1),c=Vue.ref(null),d=Vue.ref(null),u={id:"custom",name:o.value?"\u81EA\u5B9A\u4E49":"Custom",nameEn:"Custom",icon:"\u2728",order:99},p=Vue.computed(()=>{if(!a.value)return null;let x=dt[a.value];return x||s.customExpertRoles.find(j=>j.id===a.value)||null}),f=Vue.computed(()=>{let x=p.value;return x?`${x.title}\xB7${x.name}`:""}),g=Vue.computed(()=>!a.value||!s.expertRoleDefinitions?null:s.expertRoleDefinitions[a.value]||null),v=Vue.computed(()=>!a.value||dt[a.value]?null:s.customExpertRoles.find(x=>x.id===a.value)||null),m=Vue.ref(new Set([cc])),A=Vue.computed(()=>e.modelValue),w=Vue.computed(()=>dc(r.value)),k=Vue.computed(()=>{let x=[...w.value];return x.push({id:"custom",name:o.value?"\u81EA\u5B9A\u4E49":"Custom",icon:"\u2728",order:99}),x}),y=Vue.computed(()=>m.value.has("custom")),h=Vue.computed(()=>new Set(w.value.map(x=>x.id))),b=Vue.computed(()=>ac().filter(x=>h.value.has(x.teamId)&&m.value.has(x.teamId)));Vue.watch(()=>e.visible,x=>{x&&(s.fetchExpertRoleDefinitions(),s.fetchCustomExpertRoles())});let R=x=>{a.value=x,dt[x]&&s.fetchExpertRoleDefinitions()},L=x=>{c.value=x,l.value=!0},U=()=>{s.fetchCustomExpertRoles()},$=x=>{d.value=x},_=async()=>{if(d.value){try{let x=d.value.id,j=A.value.filter(ae=>ae.role!==x);j.length!==A.value.length&&t("update:modelValue",j),await s.deleteCustomExpertRole(x)}catch{}d.value=null}},P=x=>{if(!(m.value.size===1&&m.value.has(x)))if(m.value=new Set([x]),x==="custom"){let j=new Set(s.customExpertRoles.map(he=>he.id)),ae=A.value.filter(he=>j.has(he.role));ae.length!==A.value.length&&t("update:modelValue",ae)}else{let j=A.value.filter(ae=>{let he=dt[ae.role];return he&&he.group===x});j.length!==A.value.length&&t("update:modelValue",j)}},T=(x,j)=>A.value.some(ae=>ae.role===x&&ae.action===(j||null)),I=x=>A.value.some(j=>j.role===x&&!j.action),M=x=>A.value.some(j=>j.role===x),B=x=>A.value.length>=Zt&&!M(x),F=(x,j)=>T(x,j)?!1:!!(M(x)||A.value.length>=Zt),z=x=>{if(I(x.id)){t("update:modelValue",A.value.filter(j=>!(j.role===x.id&&!j.action)));return}if(M(x.id)){t("update:modelValue",[...A.value.filter(j=>j.role!==x.id),{role:x.id,action:null}]);return}A.value.length>=Zt||t("update:modelValue",[...A.value,{role:x.id,action:null}])},ne=(x,j)=>{if(T(x.id,j.id)){t("update:modelValue",A.value.filter(ae=>!(ae.role===x.id&&ae.action===j.id)));return}if(M(x.id)){t("update:modelValue",[...A.value.filter(ae=>ae.role!==x.id),{role:x.id,action:j.id}]);return}A.value.length>=Zt||t("update:modelValue",[...A.value,{role:x.id,action:j.id}])};return{store:s,roleListRef:i,enabledTeams:m,selections:A,availableTeams:w,allTeamTabs:k,filteredGroups:b,isZh:o,isCustomTabActive:y,viewingRoleId:a,viewingRoleMeta:p,viewingRoleTitle:f,viewingRoleDef:g,viewingCustomRole:v,viewRole:R,editorOpen:l,editingRole:c,openEditor:L,onEditorSaved:U,deletingRole:d,confirmDeleteRole:$,executeDelete:_,toggleTeam:P,isSelected:T,isRoleOnlySelected:I,hasRoleSelection:M,isRoleDisabled:B,isDisabled:F,toggleRoleOnly:z,toggleAction:ne,toggleCustomRoleOnly:x=>{z(x)},toggleCustomAction:(x,j)=>{ne(x,j)},getSelectionLabelFull:x=>{if(dt[x.role])return Xt(x);let ae=s.customExpertRoles.find(he=>he.id===x.role);if(!ae)return x.role;if(x.action){let he=ae.actions?.find(W=>W.id===x.action);return he?`${ae.name}\xB7${he.name}`:ae.name}return ae.name},removeSelection:x=>{let j=[...A.value];j.splice(x,1),t("update:modelValue",j)},clearAll:()=>{t("update:modelValue",[])},getSelectionLabel:Xt}}}});var Qi,da=H(()=>{wn();Qi={name:"SubAgentPanel",props:{visible:{type:Boolean,default:!1}},emits:["close"],template:`
4135
4135
  <div class="subagent-panel" :class="{ open: visible, expanded: store.activeSubagentId }" role="complementary" aria-label="Sub-Agents">
4136
4136
  <!-- Expanded Mode: Full message thread for a subagent -->
4137
4137
  <template v-if="store.activeSubagentId && activeAgent">
@@ -4443,7 +4443,7 @@ ${String(e||"").trim()}
4443
4443
  <p class="pane-empty-text">{{ $t('splitScreen.selectFromSidebar') }}</p>
4444
4444
  </div>
4445
4445
  </div>
4446
- `,setup(e){let t=Pinia.useChatStore(),s=Vue.ref(null),n=Vue.computed(()=>t.activePanelId===e.paneId),i=Vue.computed(()=>t.panels.find(J=>J.id===e.paneId)?.conversationId||null),r=Vue.computed(()=>i.value?t.messagesMap[i.value]||[]:[]),o=Vue.computed(()=>i.value?!!t.processingConversations[i.value]:!1),a=Vue.computed(()=>r.value.some(E=>E.isStreaming)),l=Vue.computed(()=>o.value&&!a.value),c=Vue.ref(0),d=Vue.ref(Date.now()),u=null,p=Vue.ref("cat"),f=new URLSearchParams(window.location.search).get("preview"),g=Vue.ref(0),v=Vue.ref(1),m=Vue.ref(5),A=Vue.ref(95),w=Vue.ref("bark-both"),k=Vue.ref(1),y=Vue.ref(-1),h=null;function b(){if(!c.value)return;d.value=Date.now();let E=(d.value-c.value)%19e3;if(E<4e3)g.value=0,v.value=1;else if(E<11500){let J=E-4e3,se;J<2500?se=J/2500*16:J<5e3?se=16+(J-2500)/2500*29:se=45+(J-5e3)/2500*55,g.value=se,v.value=1}else E<14e3?(g.value=(1-(E-11500)/2500)*100,v.value=-1):(g.value=0,v.value=1);u=requestAnimationFrame(b)}function _(){if(!c.value||p.value!=="dog")return;d.value=Date.now();let E=(d.value-c.value)%18e3;if(E<2e3)m.value=5,A.value=95,w.value="bark-both",k.value=1,y.value=-1;else if(E<5e3){let J=(E-2e3)/3e3;m.value=5+J*25,A.value=95,w.value="left-approach",k.value=1,y.value=-1}else if(E<8e3){let J=(E-5e3)/3e3;m.value=30,A.value=95-J*25,w.value="right-approach",k.value=1,y.value=-1}else if(E<1e4){let J=(E-8e3)/2e3;m.value=30+J*13,A.value=70-J*13,w.value="both-approach",k.value=1,y.value=-1}else if(E<11e3)m.value=43,A.value=57,w.value="snap",k.value=1,y.value=-1;else if(E<12500)m.value=43,A.value=57,w.value="stunned",k.value=1,y.value=-1;else if(E<15e3){let J=(E-12500)/2500;m.value=43-J*38,A.value=57+J*38,w.value="retreat",k.value=-1,y.value=1}else E<17e3?(m.value=5,A.value=95,w.value="rehang",k.value=-1,y.value=1):(m.value=5,A.value=95,w.value="reset",k.value=1,y.value=-1);h=requestAnimationFrame(_)}let L=Vue.computed(()=>{let E=m.value*1.2;return k.value<0?`translate(${E+13.5}, 0) scale(-1, 1)`:`translate(${E-13.5}, 0)`}),U=Vue.computed(()=>{let E=A.value*1.2;return y.value>0?`translate(${E-10.5}, 2)`:`translate(${E+10.5}, 2) scale(-1, 1)`}),$=Vue.computed(()=>{let E=w.value;return E==="bark-both"||E==="left-approach"||E==="right-approach"||E==="both-approach"||E==="reset"}),R=Vue.computed(()=>{let E=m.value*1.2,J=10;if($.value){let K=Math.max(0,(E-3)*.12);return`M3,18 Q${(3+E)/2},${18+K} ${E},${J}`}if(w.value==="rehang")return`M${E},${J} Q${E-3},20 3,18`;let se=k.value<0?1:-1,me=E+se*8;return`M${E},${J} Q${E},18 ${me},22`}),P=Vue.computed(()=>{let E=A.value*1.2,J=10;if($.value){let K=Math.max(0,(118-E)*.12);return`M118,18 Q${(118+E)/2},${18+K} ${E},${J}`}if(w.value==="rehang")return`M${E},${J} Q${E+3},20 118,18`;let se=y.value>0?-1:1,me=E+se*8;return`M${E},${J} Q${E},18 ${me},22`}),T=Vue.computed(()=>w.value==="snap"?.2:.4),I=Vue.computed(()=>w.value==="snap"?.2:.4),M=Vue.computed(()=>m.value*1.2),B=Vue.computed(()=>A.value*1.2),F=Vue.computed(()=>f==="cat"||f==="dog"||f==="animation"?!0:l.value);Vue.watch(l,E=>{E?(c.value=Date.now(),d.value=Date.now(),p.value="cat",g.value=0,v.value=1,m.value=5,A.value=95,w.value="bark-both",k.value=1,y.value=-1,p.value==="cat"?u=requestAnimationFrame(b):h=requestAnimationFrame(_)):(c.value=0,g.value=0,v.value=1,u&&(cancelAnimationFrame(u),u=null),h&&(cancelAnimationFrame(h),h=null))},{immediate:!0}),(f==="cat"||f==="dog"||f==="animation")&&(c.value=Date.now(),d.value=Date.now(),f==="dog"?p.value="dog":p.value="cat",p.value==="cat"?u=requestAnimationFrame(b):(m.value=5,A.value=95,w.value="bark-both",k.value=1,y.value=-1,h=requestAnimationFrame(_))),Vue.onUnmounted(()=>{u&&(cancelAnimationFrame(u),u=null),h&&(cancelAnimationFrame(h),h=null)});let z=Vue.computed(()=>{if(!o.value)return null;if(t.connectionState!=="connected")return"disconnected";let E=i.value;if(t.compactStatus?.conversationId===E&&t.compactStatus?.status==="compacting")return"compacting";let J=t.sessionHealth?.[E];return J?J.status:c.value&&d.value-c.value>8e3?"thinking":null}),ne=Vue.computed(()=>{if(!c.value)return"speed-napping";let E=(d.value-c.value)%19e3;return E>=16e3?"speed-petted":E>=14e3?"speed-tired":E>=11500?"speed-crazy":E>=9e3?"speed-turbo":E>=6500?"speed-fast":E>=4e3?"speed-normal":"speed-napping"}),ve=Vue.computed(()=>{let E=g.value,J=v.value,me={left:`calc(40px + (100% - 80px) * ${E/100})`};return J<0&&(me.transform="scaleX(-1)"),me});function ue(){let E=i.value;if(!E)return;let J=t.conversations.find(se=>se.id===E);t.sendWsMessage({type:"refresh_conversation",conversationId:E,agentId:J?.agentId})}let be=Vue.computed(()=>{let E=r.value,J=[],se=null,me=0,K=()=>{se&&(se.isActive=se.isStreaming===!0,ci(se),(se.textContent||se.toolMsgs.length>0||se.todoMsg||se.askMsg)&&J.push(se),se=null)},ee=()=>{me++,se={type:"assistant-turn",id:"turn_"+me,textContent:"",textSegments:[],isStreaming:!1,isActive:!1,isHistory:!1,todoMsg:null,toolMsgs:[],askMsg:null,messages:[]}};for(let fe=0;fe<E.length;fe++){let le=E[fe];if(le.type==="user"){if(!le.content||!le.content.trim())continue;K(),J.push({type:"user",id:le.id||"u_"+fe,message:le});continue}if(le.type==="system"||le.type==="error"){K(),J.push({type:le.type,id:le.id||"s_"+fe,message:le});continue}if(!(le.type==="tool-result"||le.type==="tool_result")){if(le.type==="assistant"){se||ee(),li(se,le),le.isStreaming&&(se.isStreaming=!0),le.isHistory&&(se.isHistory=!0),se.messages.push(le);continue}if(le.type==="tool-use"){se||ee();let _e=E[fe+1],De=_e&&(_e.type==="tool-result"||_e.type==="tool_result"),Ve={...le,hasResult:De||le.hasResult||!1,toolResult:le.toolResult||null};le.toolName==="TodoWrite"?se.todoMsg=Ve:le.toolName==="AskUserQuestion"?se.askMsg=Ve:se.toolMsgs.push(Ve),se.messages.push(le);continue}K(),J.push({type:le.type||"unknown",id:le.id||"x_"+fe,message:le})}}return K(),J}),oe=(E,J)=>{if(!i.value)return;let se=J||[];t.sendMessageToConversation(i.value,E,se)},Ce=()=>{i.value&&t.cancelExecutionForConversation(i.value)};function x(){t.setActivePanel(e.paneId)}function j(){t.removePanel(e.paneId)}let ae=Vue.computed(()=>t.getPaneRightPanel(e.paneId));function he(){t.setPaneRightPanel(e.paneId,null)}let W=Vue.ref(!0),te=50,Y=()=>{if(!s.value)return!0;let{scrollTop:E,scrollHeight:J,clientHeight:se}=s.value;return J-E-se<=te},N=()=>{s.value&&(s.value.scrollTop=s.value.scrollHeight)},O=()=>{W.value=Y()};return Vue.watch(()=>r.value.length,()=>{W.value&&Vue.nextTick(N)}),Vue.watch(()=>{let E=r.value,J=E[E.length-1];return J?.isStreaming?J.content?.length:0},()=>{W.value&&Vue.nextTick(N)}),Vue.watch(i,()=>{s.value&&s.value.removeEventListener("scroll",O),W.value=!0,Vue.nextTick(()=>{s.value&&(s.value.addEventListener("scroll",O),N())})}),Vue.onMounted(()=>{s.value&&(s.value.addEventListener("scroll",O),N())}),Vue.onUnmounted(()=>{s.value&&s.value.removeEventListener("scroll",O)}),{store:t,containerRef:s,isActivePanel:n,conversationId:i,messages:r,isProcessing:o,showTypingDots:l,previewShowTypingDots:F,waitingStatus:z,animationType:p,catSpeed:ne,catStyle:ve,dogPhase:w,spikeTransform:L,teddyTransform:U,leashPathL:R,leashPathR:P,leashOpacityL:T,leashOpacityR:I,questionLX:M,questionRX:B,refreshSession:ue,turnGroups:be,sendFn:oe,cancelFn:Ce,setActive:x,closePane:j,paneRightPanel:ae,closePanePanel:he}}}});var mv,qs,Xi=H(()=>{mv=0,qs={name:"ModernSelect",props:{modelValue:{type:[String,Number],default:null},options:{type:Array,default:()=>[]},placeholder:{type:String,default:""},searchable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},emptyText:{type:String,default:"\u2014"},ariaLabel:{type:String,default:""},menuMinWidth:{type:Number,default:0},menuClass:{type:String,default:""}},emits:["update:modelValue","change"],setup(e,{emit:t}){let s=Vue.ref(!1),n=Vue.ref(""),i=Vue.ref(null),r=Vue.ref(null),o=Vue.ref(null),a=Vue.ref(-1),l=`modern-select-${++mv}`,c=`${l}-menu`,d=Vue.ref({}),u=Vue.computed(()=>e.options.find(b=>b.value===e.modelValue)||null),p=Vue.computed(()=>{if(!e.searchable||!n.value.trim())return e.options;let b=n.value.trim().toLowerCase();return e.options.filter(_=>String(_.label||"").toLowerCase().includes(b)||String(_.sublabel||"").toLowerCase().includes(b)||String(_.value||"").toLowerCase().includes(b))}),f=b=>`${l}-option-${b}`,g=Vue.computed(()=>s.value&&a.value>=0&&a.value<p.value.length?f(a.value):void 0);function v(){let b=i.value,_=r.value;if(!b||!_)return;let L=6,U=8,$=b.getBoundingClientRect(),R=document.documentElement.clientWidth||window.innerWidth,P=document.documentElement.clientHeight||window.innerHeight,T=Math.min(Math.max($.width,e.menuMinWidth),Math.max(0,R-U*2)),I=Math.min(_.scrollHeight,304),M=Math.max(0,P-$.bottom-L-U),B=Math.max(0,$.top-L-U),F=M<I&&B>M,z=Math.max(48,Math.min(I,F?B:M)),ne=$.right-T,ve=Math.min(Math.max(U,ne),Math.max(U,R-U-T));d.value={top:`${F?$.top-L-z:$.bottom+L}px`,left:`${ve}px`,width:`${T}px`,maxHeight:`${z}px`,"--modern-select-list-max-height":`${Math.max(36,z-(e.searchable?58:12))}px`}}function m(){e.disabled||(s.value=!s.value,s.value&&(n.value="",a.value=p.value.findIndex(b=>b.value===e.modelValue),Vue.nextTick(()=>{v(),e.searchable&&o.value?.focus&&o.value.focus();let b=r.value?.querySelector(".modern-select-option.is-active");b?.scrollIntoView&&b.scrollIntoView({block:"nearest"})})))}function A(){s.value=!1}function w(b){t("update:modelValue",b.value),t("change",b.value),A()}function k(b){if(!s.value){(b.key==="Enter"||b.key===" "||b.key==="ArrowDown")&&(b.preventDefault(),m());return}if(b.key==="Escape"){b.preventDefault(),A();return}if(b.key==="ArrowDown")b.preventDefault(),a.value=Math.min(p.value.length-1,a.value+1);else if(b.key==="ArrowUp")b.preventDefault(),a.value=Math.max(0,a.value-1);else if(b.key==="Enter"){b.preventDefault();let _=p.value[a.value];_&&w(_)}}function y(b){s.value&&(i.value?.contains(b.target)||r.value?.contains(b.target)||A())}let h=()=>{s.value&&v()};return Vue.onMounted(()=>{document.addEventListener("mousedown",y),window.addEventListener("resize",h),window.addEventListener("scroll",h,!0)}),Vue.onBeforeUnmount(()=>{document.removeEventListener("mousedown",y),window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0)}),Vue.watch(()=>e.modelValue,()=>{}),{open:s,search:n,triggerEl:i,menuEl:r,searchEl:o,activeIdx:a,selected:u,filtered:p,menuId:c,menuStyle:d,optionId:f,activeOptionId:g,toggle:m,close:A,pick:w,onKey:k}},template:`
4446
+ `,setup(e){let t=Pinia.useChatStore(),s=Vue.ref(null),n=Vue.computed(()=>t.activePanelId===e.paneId),i=Vue.computed(()=>t.panels.find(J=>J.id===e.paneId)?.conversationId||null),r=Vue.computed(()=>i.value?t.messagesMap[i.value]||[]:[]),o=Vue.computed(()=>i.value?!!t.processingConversations[i.value]:!1),a=Vue.computed(()=>r.value.some(E=>E.isStreaming)),l=Vue.computed(()=>o.value&&!a.value),c=Vue.ref(0),d=Vue.ref(Date.now()),u=null,p=Vue.ref("cat"),f=new URLSearchParams(window.location.search).get("preview"),g=Vue.ref(0),v=Vue.ref(1),m=Vue.ref(5),A=Vue.ref(95),w=Vue.ref("bark-both"),k=Vue.ref(1),y=Vue.ref(-1),h=null;function b(){if(!c.value)return;d.value=Date.now();let E=(d.value-c.value)%19e3;if(E<4e3)g.value=0,v.value=1;else if(E<11500){let J=E-4e3,se;J<2500?se=J/2500*16:J<5e3?se=16+(J-2500)/2500*29:se=45+(J-5e3)/2500*55,g.value=se,v.value=1}else E<14e3?(g.value=(1-(E-11500)/2500)*100,v.value=-1):(g.value=0,v.value=1);u=requestAnimationFrame(b)}function R(){if(!c.value||p.value!=="dog")return;d.value=Date.now();let E=(d.value-c.value)%18e3;if(E<2e3)m.value=5,A.value=95,w.value="bark-both",k.value=1,y.value=-1;else if(E<5e3){let J=(E-2e3)/3e3;m.value=5+J*25,A.value=95,w.value="left-approach",k.value=1,y.value=-1}else if(E<8e3){let J=(E-5e3)/3e3;m.value=30,A.value=95-J*25,w.value="right-approach",k.value=1,y.value=-1}else if(E<1e4){let J=(E-8e3)/2e3;m.value=30+J*13,A.value=70-J*13,w.value="both-approach",k.value=1,y.value=-1}else if(E<11e3)m.value=43,A.value=57,w.value="snap",k.value=1,y.value=-1;else if(E<12500)m.value=43,A.value=57,w.value="stunned",k.value=1,y.value=-1;else if(E<15e3){let J=(E-12500)/2500;m.value=43-J*38,A.value=57+J*38,w.value="retreat",k.value=-1,y.value=1}else E<17e3?(m.value=5,A.value=95,w.value="rehang",k.value=-1,y.value=1):(m.value=5,A.value=95,w.value="reset",k.value=1,y.value=-1);h=requestAnimationFrame(R)}let L=Vue.computed(()=>{let E=m.value*1.2;return k.value<0?`translate(${E+13.5}, 0) scale(-1, 1)`:`translate(${E-13.5}, 0)`}),U=Vue.computed(()=>{let E=A.value*1.2;return y.value>0?`translate(${E-10.5}, 2)`:`translate(${E+10.5}, 2) scale(-1, 1)`}),$=Vue.computed(()=>{let E=w.value;return E==="bark-both"||E==="left-approach"||E==="right-approach"||E==="both-approach"||E==="reset"}),_=Vue.computed(()=>{let E=m.value*1.2,J=10;if($.value){let K=Math.max(0,(E-3)*.12);return`M3,18 Q${(3+E)/2},${18+K} ${E},${J}`}if(w.value==="rehang")return`M${E},${J} Q${E-3},20 3,18`;let se=k.value<0?1:-1,me=E+se*8;return`M${E},${J} Q${E},18 ${me},22`}),P=Vue.computed(()=>{let E=A.value*1.2,J=10;if($.value){let K=Math.max(0,(118-E)*.12);return`M118,18 Q${(118+E)/2},${18+K} ${E},${J}`}if(w.value==="rehang")return`M${E},${J} Q${E+3},20 118,18`;let se=y.value>0?-1:1,me=E+se*8;return`M${E},${J} Q${E},18 ${me},22`}),T=Vue.computed(()=>w.value==="snap"?.2:.4),I=Vue.computed(()=>w.value==="snap"?.2:.4),M=Vue.computed(()=>m.value*1.2),B=Vue.computed(()=>A.value*1.2),F=Vue.computed(()=>f==="cat"||f==="dog"||f==="animation"?!0:l.value);Vue.watch(l,E=>{E?(c.value=Date.now(),d.value=Date.now(),p.value="cat",g.value=0,v.value=1,m.value=5,A.value=95,w.value="bark-both",k.value=1,y.value=-1,p.value==="cat"?u=requestAnimationFrame(b):h=requestAnimationFrame(R)):(c.value=0,g.value=0,v.value=1,u&&(cancelAnimationFrame(u),u=null),h&&(cancelAnimationFrame(h),h=null))},{immediate:!0}),(f==="cat"||f==="dog"||f==="animation")&&(c.value=Date.now(),d.value=Date.now(),f==="dog"?p.value="dog":p.value="cat",p.value==="cat"?u=requestAnimationFrame(b):(m.value=5,A.value=95,w.value="bark-both",k.value=1,y.value=-1,h=requestAnimationFrame(R))),Vue.onUnmounted(()=>{u&&(cancelAnimationFrame(u),u=null),h&&(cancelAnimationFrame(h),h=null)});let z=Vue.computed(()=>{if(!o.value)return null;if(t.connectionState!=="connected")return"disconnected";let E=i.value;if(t.compactStatus?.conversationId===E&&t.compactStatus?.status==="compacting")return"compacting";let J=t.sessionHealth?.[E];return J?J.status:c.value&&d.value-c.value>8e3?"thinking":null}),ne=Vue.computed(()=>{if(!c.value)return"speed-napping";let E=(d.value-c.value)%19e3;return E>=16e3?"speed-petted":E>=14e3?"speed-tired":E>=11500?"speed-crazy":E>=9e3?"speed-turbo":E>=6500?"speed-fast":E>=4e3?"speed-normal":"speed-napping"}),ve=Vue.computed(()=>{let E=g.value,J=v.value,me={left:`calc(40px + (100% - 80px) * ${E/100})`};return J<0&&(me.transform="scaleX(-1)"),me});function ue(){let E=i.value;if(!E)return;let J=t.conversations.find(se=>se.id===E);t.sendWsMessage({type:"refresh_conversation",conversationId:E,agentId:J?.agentId})}let be=Vue.computed(()=>{let E=r.value,J=[],se=null,me=0,K=()=>{se&&(se.isActive=se.isStreaming===!0,ci(se),(se.textContent||se.toolMsgs.length>0||se.todoMsg||se.askMsg)&&J.push(se),se=null)},ee=()=>{me++,se={type:"assistant-turn",id:"turn_"+me,textContent:"",textSegments:[],isStreaming:!1,isActive:!1,isHistory:!1,todoMsg:null,toolMsgs:[],askMsg:null,messages:[]}};for(let fe=0;fe<E.length;fe++){let le=E[fe];if(le.type==="user"){if(!le.content||!le.content.trim())continue;K(),J.push({type:"user",id:le.id||"u_"+fe,message:le});continue}if(le.type==="system"||le.type==="error"){K(),J.push({type:le.type,id:le.id||"s_"+fe,message:le});continue}if(!(le.type==="tool-result"||le.type==="tool_result")){if(le.type==="assistant"){se||ee(),li(se,le),le.isStreaming&&(se.isStreaming=!0),le.isHistory&&(se.isHistory=!0),se.messages.push(le);continue}if(le.type==="tool-use"){se||ee();let Re=E[fe+1],De=Re&&(Re.type==="tool-result"||Re.type==="tool_result"),Ve={...le,hasResult:De||le.hasResult||!1,toolResult:le.toolResult||null};le.toolName==="TodoWrite"?se.todoMsg=Ve:le.toolName==="AskUserQuestion"?se.askMsg=Ve:se.toolMsgs.push(Ve),se.messages.push(le);continue}K(),J.push({type:le.type||"unknown",id:le.id||"x_"+fe,message:le})}}return K(),J}),oe=(E,J)=>{if(!i.value)return;let se=J||[];t.sendMessageToConversation(i.value,E,se)},Ce=()=>{i.value&&t.cancelExecutionForConversation(i.value)};function x(){t.setActivePanel(e.paneId)}function j(){t.removePanel(e.paneId)}let ae=Vue.computed(()=>t.getPaneRightPanel(e.paneId));function he(){t.setPaneRightPanel(e.paneId,null)}let W=Vue.ref(!0),te=50,Y=()=>{if(!s.value)return!0;let{scrollTop:E,scrollHeight:J,clientHeight:se}=s.value;return J-E-se<=te},N=()=>{s.value&&(s.value.scrollTop=s.value.scrollHeight)},O=()=>{W.value=Y()};return Vue.watch(()=>r.value.length,()=>{W.value&&Vue.nextTick(N)}),Vue.watch(()=>{let E=r.value,J=E[E.length-1];return J?.isStreaming?J.content?.length:0},()=>{W.value&&Vue.nextTick(N)}),Vue.watch(i,()=>{s.value&&s.value.removeEventListener("scroll",O),W.value=!0,Vue.nextTick(()=>{s.value&&(s.value.addEventListener("scroll",O),N())})}),Vue.onMounted(()=>{s.value&&(s.value.addEventListener("scroll",O),N())}),Vue.onUnmounted(()=>{s.value&&s.value.removeEventListener("scroll",O)}),{store:t,containerRef:s,isActivePanel:n,conversationId:i,messages:r,isProcessing:o,showTypingDots:l,previewShowTypingDots:F,waitingStatus:z,animationType:p,catSpeed:ne,catStyle:ve,dogPhase:w,spikeTransform:L,teddyTransform:U,leashPathL:_,leashPathR:P,leashOpacityL:T,leashOpacityR:I,questionLX:M,questionRX:B,refreshSession:ue,turnGroups:be,sendFn:oe,cancelFn:Ce,setActive:x,closePane:j,paneRightPanel:ae,closePanePanel:he}}}});var mv,qs,Xi=H(()=>{mv=0,qs={name:"ModernSelect",props:{modelValue:{type:[String,Number],default:null},options:{type:Array,default:()=>[]},placeholder:{type:String,default:""},searchable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},emptyText:{type:String,default:"\u2014"},ariaLabel:{type:String,default:""},menuMinWidth:{type:Number,default:0},menuClass:{type:String,default:""}},emits:["update:modelValue","change"],setup(e,{emit:t}){let s=Vue.ref(!1),n=Vue.ref(""),i=Vue.ref(null),r=Vue.ref(null),o=Vue.ref(null),a=Vue.ref(-1),l=`modern-select-${++mv}`,c=`${l}-menu`,d=Vue.ref({}),u=Vue.computed(()=>e.options.find(b=>b.value===e.modelValue)||null),p=Vue.computed(()=>{if(!e.searchable||!n.value.trim())return e.options;let b=n.value.trim().toLowerCase();return e.options.filter(R=>String(R.label||"").toLowerCase().includes(b)||String(R.sublabel||"").toLowerCase().includes(b)||String(R.value||"").toLowerCase().includes(b))}),f=b=>`${l}-option-${b}`,g=Vue.computed(()=>s.value&&a.value>=0&&a.value<p.value.length?f(a.value):void 0);function v(){let b=i.value,R=r.value;if(!b||!R)return;let L=6,U=8,$=b.getBoundingClientRect(),_=document.documentElement.clientWidth||window.innerWidth,P=document.documentElement.clientHeight||window.innerHeight,T=Math.min(Math.max($.width,e.menuMinWidth),Math.max(0,_-U*2)),I=Math.min(R.scrollHeight,304),M=Math.max(0,P-$.bottom-L-U),B=Math.max(0,$.top-L-U),F=M<I&&B>M,z=Math.max(48,Math.min(I,F?B:M)),ne=$.right-T,ve=Math.min(Math.max(U,ne),Math.max(U,_-U-T));d.value={top:`${F?$.top-L-z:$.bottom+L}px`,left:`${ve}px`,width:`${T}px`,maxHeight:`${z}px`,"--modern-select-list-max-height":`${Math.max(36,z-(e.searchable?58:12))}px`}}function m(){e.disabled||(s.value=!s.value,s.value&&(n.value="",a.value=p.value.findIndex(b=>b.value===e.modelValue),Vue.nextTick(()=>{v(),e.searchable&&o.value?.focus&&o.value.focus();let b=r.value?.querySelector(".modern-select-option.is-active");b?.scrollIntoView&&b.scrollIntoView({block:"nearest"})})))}function A(){s.value=!1}function w(b){t("update:modelValue",b.value),t("change",b.value),A()}function k(b){if(!s.value){(b.key==="Enter"||b.key===" "||b.key==="ArrowDown")&&(b.preventDefault(),m());return}if(b.key==="Escape"){b.preventDefault(),A();return}if(b.key==="ArrowDown")b.preventDefault(),a.value=Math.min(p.value.length-1,a.value+1);else if(b.key==="ArrowUp")b.preventDefault(),a.value=Math.max(0,a.value-1);else if(b.key==="Enter"){b.preventDefault();let R=p.value[a.value];R&&w(R)}}function y(b){s.value&&(i.value?.contains(b.target)||r.value?.contains(b.target)||A())}let h=()=>{s.value&&v()};return Vue.onMounted(()=>{document.addEventListener("mousedown",y),window.addEventListener("resize",h),window.addEventListener("scroll",h,!0)}),Vue.onBeforeUnmount(()=>{document.removeEventListener("mousedown",y),window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0)}),Vue.watch(()=>e.modelValue,()=>{}),{open:s,search:n,triggerEl:i,menuEl:r,searchEl:o,activeIdx:a,selected:u,filtered:p,menuId:c,menuStyle:d,optionId:f,activeOptionId:g,toggle:m,close:A,pick:w,onKey:k}},template:`
4447
4447
  <div class="modern-select" :class="{ 'is-open': open, 'is-disabled': disabled }">
4448
4448
  <button
4449
4449
  type="button"
@@ -4689,7 +4689,7 @@ ${String(e||"").trim()}
4689
4689
  </div>
4690
4690
  </div>
4691
4691
  </div>
4692
- `}});var hv,ef,tf=H(()=>{_s();hv=new Set(["ada","alan","alice","dieter","grace","ken","linus","margaret","martin","anders","norman","shannon","steve","kongzi","socrates","nietzsche","kahneman","jung","sunzi","clausewitz","simaqian","harari","buffett","munger","dalio","bezos","drucker","luxun","sudongpo","borges","einstein","kubrick","miyazaki"]),ef={name:"VpAvatar",props:{vpId:{type:String,required:!0},size:{type:Number,default:20},status:{type:String,default:null},typing:{type:Boolean,default:!1},ariaLabel:{type:String,default:""}},template:`
4692
+ `}});var ef,tf=H(()=>{Rs();ef={name:"VpAvatar",props:{vpId:{type:String,required:!0},size:{type:Number,default:20},status:{type:String,default:null},typing:{type:Boolean,default:!1},ariaLabel:{type:String,default:""}},template:`
4693
4693
  <span
4694
4694
  class="vp-avatar"
4695
4695
  :class="{ 'is-busy': status === 'busy', 'is-online': status === 'online', 'is-typing': typing && !status }"
@@ -4697,15 +4697,7 @@ ${String(e||"").trim()}
4697
4697
  :aria-label="ariaLabel || displayName"
4698
4698
  role="img"
4699
4699
  >
4700
- <img
4701
- v-if="avatarUrl"
4702
- class="vp-avatar-img"
4703
- :src="avatarUrl"
4704
- alt=""
4705
- draggable="false"
4706
- @error="onImgError"
4707
- />
4708
- <span v-else class="vp-avatar-letter" :data-motif="motifKey" aria-hidden="true">
4700
+ <span class="vp-avatar-letter" :data-motif="motifKey" aria-hidden="true">
4709
4701
  <span class="vp-avatar-motif-glyph">{{ motifGlyph }}</span>
4710
4702
  <span class="vp-avatar-initial">{{ initial }}</span>
4711
4703
  </span>
@@ -4724,7 +4716,7 @@ ${String(e||"").trim()}
4724
4716
  <span class="vp-avatar-typing-dot"></span>
4725
4717
  </span>
4726
4718
  </span>
4727
- `,setup(e){let t=ht(),s=Vue.computed(()=>t.vpInitial(e.vpId)),n=Vue.computed(()=>t.vpLabel(e.vpId)),i=Vue.computed(()=>{let f=t.vpAvatarMotif;return typeof f=="function"?f(e.vpId):{key:"rat",glyph:"R",background:"linear-gradient(135deg, #174EA6 0%, #0B2F6B 100%)",foreground:"#FFFFFF"}}),r=Vue.computed(()=>{let f=t.vpColor;return typeof f=="function"?f(e.vpId):i.value.background}),o=Vue.computed(()=>i.value.key),a=Vue.computed(()=>i.value.glyph),l=Vue.computed(()=>i.value.foreground),c=Vue.ref(!1),d=Vue.computed(()=>{if(c.value)return null;let f=e.vpId;return!f||!hv.has(f)?null:`/assets/avatars/${f}.svg`});function u(){c.value=!0}Vue.watch(()=>e.vpId,()=>{c.value=!1});let p=Vue.computed(()=>({width:e.size+"px",height:e.size+"px",background:r.value,color:l.value,fontSize:Math.max(13,Math.round(e.size*.58))+"px"}));return{initial:s,displayName:n,avatarStyle:p,avatarUrl:d,motifKey:o,motifGlyph:a,onImgError:u}}}});function Rn(e){if(!e)return"";let t=String(e).split(/[/\\]/);return t[t.length-1]||t[t.length-2]||e}function ir(e,t){if(!e)return"";let s=new Date(e);if(isNaN(s.getTime()))return"";let i=Math.floor((new Date-s)/(1e3*60*60*24)),r=typeof t=="function"?t:((o,a)=>a&&a.count!=null?`${a.count}d`:o);return i===0?r("chat.time.today")+" "+s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):i===1?r("chat.time.yesterday")+" "+s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):i<7?r("chat.time.daysAgo",{count:i}):s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}var va=H(()=>{});function vv(){return sf+=1,`folder-picker-${Date.now()}-${sf}`}var ya,sf,ba,yv,nf,wa=H(()=>{ya=()=>({folderPickerOpen:!1,folderPickerPath:"",folderPickerEntries:[],folderPickerLoading:!1,folderPickerSelected:"",_folderPickerTimer:null,_folderPickerRequestId:null,_folderPickerRequestAgentId:null}),sf=0;ba={openFolderPicker(){if(!this.folderPickerAgentId||!this.chat||typeof this.chat.sendWsMessage!="function")return;this.folderPickerOpen=!0,this.folderPickerSelected="",this.folderPickerLoading=!0;let t=typeof this.folderPickerInitialDir=="function"?this.folderPickerInitialDir()||"":this.defaultWorkDir||"";this.folderPickerPath=t,this.folderPickerEntries=[],this.requestFolderPickerDir(t)},invalidateFolderPickerRequest(){this._folderPickerRequestId=null,this._folderPickerRequestAgentId=null,this._folderPickerTimer&&(clearTimeout(this._folderPickerTimer),this._folderPickerTimer=null)},closeFolderPicker(){this.folderPickerOpen=!1,this.invalidateFolderPickerRequest()},requestFolderPickerDir(e){let t=this.folderPickerAgentId;if(!t||!this.chat||typeof this.chat.sendWsMessage!="function")return;let s=vv();this._folderPickerRequestId=s,this._folderPickerRequestAgentId=t,this.chat.sendWsMessage({type:"list_directory",conversationId:"_workdir_picker",requestId:s,agentId:t,dirPath:e,workDir:this.defaultWorkDir||""}),this._folderPickerTimer&&clearTimeout(this._folderPickerTimer),this._folderPickerTimer=setTimeout(()=>{this.folderPickerLoading&&this.folderPickerOpen&&this._folderPickerRequestId===s&&this.folderPickerAgentId===t&&this.requestFolderPickerDir(e)},5e3)},loadFolderPickerDir(e){this.folderPickerLoading=!0,this.folderPickerSelected="",this.folderPickerEntries=[],this.requestFolderPickerDir(e)},folderPickerNavigateUp(){if(!this.folderPickerPath)return;let e=this.folderPickerPath.includes("\\"),t=e?"\\":"/",s=this.folderPickerPath.replace(/[/\\]$/,"").split(/[/\\]/);if(s.pop(),s.length===0)this.folderPickerPath="",this.loadFolderPickerDir("");else if(e&&s.length===1&&/^[A-Za-z]:$/.test(s[0]))this.folderPickerPath=s[0]+"\\",this.loadFolderPickerDir(this.folderPickerPath);else{let n=s.join(t);this.folderPickerPath=n,this.loadFolderPickerDir(n)}},folderPickerSelectItem(e){this.folderPickerSelected=e.name},folderPickerEnter(e){let s=this.folderPickerPath.includes("\\")||/^[A-Z]:/.test(e.name)?"\\":"/",n;this.folderPickerPath?n=this.folderPickerPath.replace(/[/\\]$/,"")+s+e.name:n=/^[A-Z]:$/.test(e.name)?e.name+"\\":"/"+e.name,this.folderPickerPath=n,this.loadFolderPickerDir(n)},confirmFolderPicker(){let e=this.folderPickerPath;if(e){if(this.folderPickerSelected){let t=e.includes("\\")?"\\":"/";e=e.replace(/[/\\]$/,"")+t+this.folderPickerSelected}typeof this.folderPickerSetWorkDir=="function"&&this.folderPickerSetWorkDir(e),this.closeFolderPicker()}},handleFolderPickerMessage(e){let t=e.detail;!t||t.type!=="directory_listing"||t.conversationId!=="_workdir_picker"||!this.folderPickerOpen||!this._folderPickerRequestId||t.requestId!==this._folderPickerRequestId||this.folderPickerAgentId!==this._folderPickerRequestAgentId||(this._folderPickerTimer&&(clearTimeout(this._folderPickerTimer),this._folderPickerTimer=null),this._folderPickerRequestId=null,this._folderPickerRequestAgentId=null,this.folderPickerLoading=!1,this.folderPickerEntries=(t.entries||[]).filter(s=>s.type==="directory").sort((s,n)=>s.name.localeCompare(n.name)),t.dirPath!=null&&(this.folderPickerPath=t.dirPath))}},yv={data(){return ya()},methods:{...ba},mounted(){window.addEventListener("workbench-message",this.handleFolderPickerMessage)},beforeUnmount(){window.removeEventListener("workbench-message",this.handleFolderPickerMessage),this.invalidateFolderPickerRequest()}},nf=yv});function bv(e,t,s,n=0){let i=Math.max(t.top,s.top),r=Math.min(t.bottom,s.bottom),o=Math.max(0,e.top-i-of),a=Math.max(0,r-e.bottom-of),l=Math.max(0,Number(n)||0),c="down";return(a<l&&o>=l||a<l&&o>a)&&(c="up"),{placement:c,availableHeight:Math.floor(c==="up"?o:a)}}var rf,of,Bs,rr=H(()=>{tf();va();xn();wa();rf="omni",of=4;Bs={name:"SessionCreateModal",components:{VpAvatar:ef},props:{initialProvider:{type:String,default:"yeaft"}},emits:["close","created"],template:`
4719
+ `,setup(e){let t=ht(),s=Vue.computed(()=>t.vpInitial(e.vpId)),n=Vue.computed(()=>t.vpLabel(e.vpId)),i=Vue.computed(()=>{let d=t.vpAvatarMotif;return typeof d=="function"?d(e.vpId):{key:"rat",glyph:"R",background:"linear-gradient(135deg, #174EA6 0%, #0B2F6B 100%)",foreground:"#FFFFFF"}}),r=Vue.computed(()=>{let d=t.vpColor;return typeof d=="function"?d(e.vpId):i.value.background}),o=Vue.computed(()=>i.value.key),a=Vue.computed(()=>i.value.glyph),l=Vue.computed(()=>i.value.foreground),c=Vue.computed(()=>({width:e.size+"px",height:e.size+"px",background:r.value,color:l.value,fontSize:Math.max(13,Math.round(e.size*.58))+"px"}));return{initial:s,displayName:n,avatarStyle:c,motifKey:o,motifGlyph:a}}}});function _n(e){if(!e)return"";let t=String(e).split(/[/\\]/);return t[t.length-1]||t[t.length-2]||e}function ir(e,t){if(!e)return"";let s=new Date(e);if(isNaN(s.getTime()))return"";let i=Math.floor((new Date-s)/(1e3*60*60*24)),r=typeof t=="function"?t:((o,a)=>a&&a.count!=null?`${a.count}d`:o);return i===0?r("chat.time.today")+" "+s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):i===1?r("chat.time.yesterday")+" "+s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):i<7?r("chat.time.daysAgo",{count:i}):s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}var va=H(()=>{});function hv(){return sf+=1,`folder-picker-${Date.now()}-${sf}`}var ya,sf,ba,vv,nf,wa=H(()=>{ya=()=>({folderPickerOpen:!1,folderPickerPath:"",folderPickerEntries:[],folderPickerLoading:!1,folderPickerSelected:"",_folderPickerTimer:null,_folderPickerRequestId:null,_folderPickerRequestAgentId:null}),sf=0;ba={openFolderPicker(){if(!this.folderPickerAgentId||!this.chat||typeof this.chat.sendWsMessage!="function")return;this.folderPickerOpen=!0,this.folderPickerSelected="",this.folderPickerLoading=!0;let t=typeof this.folderPickerInitialDir=="function"?this.folderPickerInitialDir()||"":this.defaultWorkDir||"";this.folderPickerPath=t,this.folderPickerEntries=[],this.requestFolderPickerDir(t)},invalidateFolderPickerRequest(){this._folderPickerRequestId=null,this._folderPickerRequestAgentId=null,this._folderPickerTimer&&(clearTimeout(this._folderPickerTimer),this._folderPickerTimer=null)},closeFolderPicker(){this.folderPickerOpen=!1,this.invalidateFolderPickerRequest()},requestFolderPickerDir(e){let t=this.folderPickerAgentId;if(!t||!this.chat||typeof this.chat.sendWsMessage!="function")return;let s=hv();this._folderPickerRequestId=s,this._folderPickerRequestAgentId=t,this.chat.sendWsMessage({type:"list_directory",conversationId:"_workdir_picker",requestId:s,agentId:t,dirPath:e,workDir:this.defaultWorkDir||""}),this._folderPickerTimer&&clearTimeout(this._folderPickerTimer),this._folderPickerTimer=setTimeout(()=>{this.folderPickerLoading&&this.folderPickerOpen&&this._folderPickerRequestId===s&&this.folderPickerAgentId===t&&this.requestFolderPickerDir(e)},5e3)},loadFolderPickerDir(e){this.folderPickerLoading=!0,this.folderPickerSelected="",this.folderPickerEntries=[],this.requestFolderPickerDir(e)},folderPickerNavigateUp(){if(!this.folderPickerPath)return;let e=this.folderPickerPath.includes("\\"),t=e?"\\":"/",s=this.folderPickerPath.replace(/[/\\]$/,"").split(/[/\\]/);if(s.pop(),s.length===0)this.folderPickerPath="",this.loadFolderPickerDir("");else if(e&&s.length===1&&/^[A-Za-z]:$/.test(s[0]))this.folderPickerPath=s[0]+"\\",this.loadFolderPickerDir(this.folderPickerPath);else{let n=s.join(t);this.folderPickerPath=n,this.loadFolderPickerDir(n)}},folderPickerSelectItem(e){this.folderPickerSelected=e.name},folderPickerEnter(e){let s=this.folderPickerPath.includes("\\")||/^[A-Z]:/.test(e.name)?"\\":"/",n;this.folderPickerPath?n=this.folderPickerPath.replace(/[/\\]$/,"")+s+e.name:n=/^[A-Z]:$/.test(e.name)?e.name+"\\":"/"+e.name,this.folderPickerPath=n,this.loadFolderPickerDir(n)},confirmFolderPicker(){let e=this.folderPickerPath;if(e){if(this.folderPickerSelected){let t=e.includes("\\")?"\\":"/";e=e.replace(/[/\\]$/,"")+t+this.folderPickerSelected}typeof this.folderPickerSetWorkDir=="function"&&this.folderPickerSetWorkDir(e),this.closeFolderPicker()}},handleFolderPickerMessage(e){let t=e.detail;!t||t.type!=="directory_listing"||t.conversationId!=="_workdir_picker"||!this.folderPickerOpen||!this._folderPickerRequestId||t.requestId!==this._folderPickerRequestId||this.folderPickerAgentId!==this._folderPickerRequestAgentId||(this._folderPickerTimer&&(clearTimeout(this._folderPickerTimer),this._folderPickerTimer=null),this._folderPickerRequestId=null,this._folderPickerRequestAgentId=null,this.folderPickerLoading=!1,this.folderPickerEntries=(t.entries||[]).filter(s=>s.type==="directory").sort((s,n)=>s.name.localeCompare(n.name)),t.dirPath!=null&&(this.folderPickerPath=t.dirPath))}},vv={data(){return ya()},methods:{...ba},mounted(){window.addEventListener("workbench-message",this.handleFolderPickerMessage)},beforeUnmount(){window.removeEventListener("workbench-message",this.handleFolderPickerMessage),this.invalidateFolderPickerRequest()}},nf=vv});function yv(e,t,s,n=0){let i=Math.max(t.top,s.top),r=Math.min(t.bottom,s.bottom),o=Math.max(0,e.top-i-of),a=Math.max(0,r-e.bottom-of),l=Math.max(0,Number(n)||0),c="down";return(a<l&&o>=l||a<l&&o>a)&&(c="up"),{placement:c,availableHeight:Math.floor(c==="up"?o:a)}}var rf,of,Bs,rr=H(()=>{tf();va();xn();wa();rf="omni",of=4;Bs={name:"SessionCreateModal",components:{VpAvatar:ef},props:{initialProvider:{type:String,default:"yeaft"}},emits:["close","created"],template:`
4728
4720
  <Teleport to="body">
4729
4721
  <div class="modal-overlay" @click.self="onOverlayClick" role="dialog" aria-modal="true" :aria-label="$t('yeaft.session.create.title')">
4730
4722
  <div class="modal resume-modal yeaft-session-create-modal">
@@ -4806,6 +4798,12 @@ ${String(e||"").trim()}
4806
4798
  <div v-if="vpList.length === 0 && vpLibraryEmpty" class="yeaft-roster-empty">
4807
4799
  {{ $t('yeaft.session.create.rosterEmpty') }}
4808
4800
  </div>
4801
+ <div v-else-if="vpList.length === 0 && vpLibraryError" class="yeaft-roster-empty yeaft-roster-error" role="alert">
4802
+ <span>{{ $t('yeaft.session.create.rosterError') }}</span>
4803
+ <button type="button" class="btn-secondary yeaft-roster-retry" @click="retryVpSnapshot">
4804
+ {{ $t('yeaft.session.create.rosterRetry') }}
4805
+ </button>
4806
+ </div>
4809
4807
  <div v-else-if="vpList.length === 0" class="yeaft-roster-empty">
4810
4808
  {{ $t('yeaft.session.create.rosterLoading') }}
4811
4809
  </div>
@@ -5015,7 +5013,7 @@ ${String(e||"").trim()}
5015
5013
  </div>
5016
5014
  </div>
5017
5015
  </Teleport>
5018
- `,data(){return{form:{provider:["yeaft","copilot","claude-code"].includes(this.initialProvider)?this.initialProvider:"yeaft",name:"",vpIds:[],defaultVpId:null,workDir:"",agentId:null},busy:!1,submitError:"",...ya(),vpPickerTouched:!1,vpRosterOpen:!1,vpRosterPlacement:"down",vpRosterAvailableHeight:null,scannedSessions:[],restoreScanning:!1,restoring:null,restoreError:""}},computed:{chat(){try{if(typeof window<"u"&&window.Pinia?.useChatStore)return window.Pinia.useChatStore()}catch{}return null},vpStore(){try{if(typeof window<"u"&&window.Pinia?.useVpStore)return window.Pinia.useVpStore()}catch{}return null},sessionsStore(){try{if(typeof window<"u"&&window.Pinia?.useSessionsStore)return window.Pinia.useSessionsStore()}catch{}return null},isYeaftProvider(){return this.form.provider==="yeaft"},vpList(){return this.vpStore?.vpList||[]},vpDomainSections(){return os(this.vpList)},vpListSignature(){return(this.vpList||[]).map(e=>e&&e.vpId).filter(Boolean).join(",")},vpLibraryEmpty(){let e=this.vpStore;return e?e.emptyLibrary===!0?!0:!!(e.lastSnapshotAt&&e.lastSnapshotAt>0&&(e.vpOrder?.length||0)===0):!1},agentOptions(){let e=this.chat;return!e||!Array.isArray(e.agents)?[]:e.agents.map(t=>({id:t.id,name:t.name,online:!!t.online,workDir:t.workDir||""}))},agentSignature(){return this.agentOptions.map(e=>`${e.id}:${e.online?1:0}`).join(",")},folderPickerAgentId(){return this.form.agentId||this.chat?.currentAgent||""},defaultWorkDir(){return this.agentOptions.find(t=>t.id===this.form.agentId)?.workDir||this.chat?.currentAgentInfo?.workDir||""},workDirPlaceholder(){return this.defaultWorkDir||this.$t("modal.newConv.inputOrSelect")},allSessions(){return this.sessionsStore?.sessionList||[]},agentSessions(){let e=this.form.agentId||null;return e?this.allSessions.filter(t=>{let s=t&&t.agentId;return!s||s===e}):this.allSessions},folderAggregates(){let e=new Map;for(let t of this.agentSessions){let s=t&&typeof t.workDir=="string"?t.workDir.trim():"";if(!s)continue;let n=e.get(s)||{path:s,count:0};n.count+=1,e.set(s,n)}return Array.from(e.values()).sort((t,s)=>t.path.localeCompare(s.path))},sessionsInDir(){let e=new Set((this.sessionsStore?.sessionList||[]).map(s=>s&&s.id).filter(Boolean));return(Array.isArray(this.scannedSessions)?this.scannedSessions:[]).filter(s=>s&&s.id).map(s=>({...s,inSidebar:e.has(s.id)}))},chatFolderRows(){return(this.chat?.folders||[]).map(e=>({path:e.path||e.name||"",count:Number(e.sessionCount)||0})).filter(e=>e.path)},createFolderRows(){return this.isYeaftProvider?this.folderAggregates:this.chatFolderRows},createSessionRows(){return this.isYeaftProvider?this.sessionsInDir:(this.chat?.historySessions||[]).map(e=>({...e,id:e.sessionId,name:e.title,createdAt:e.lastModified}))},canSubmit(){if(this.isYeaftProvider&&this.form.vpIds.length===0||!this.form.agentId)return!1;let e=this.agentOptions.find(t=>t.id===this.form.agentId);return!!(e&&e.online)},vpRosterSummary(){let e=this.form.vpIds||[];return e.length===0?this.$t("yeaft.session.create.vpNone"):e.length<=3?e.map(t=>this.vpLabelFor(t)).join(this.$t("common.comma")):this.$t("yeaft.session.create.vpCount",{n:e.length})},vpRosterPopupStyle(){return Number.isFinite(this.vpRosterAvailableHeight)?{"--vp-roster-available-height":`${this.vpRosterAvailableHeight}px`}:{}}},mounted(){window.addEventListener("keydown",this.onEsc),window.addEventListener("resize",this.scheduleVpRosterLayout),window.visualViewport?.addEventListener("resize",this.scheduleVpRosterLayout),window.visualViewport?.addEventListener("scroll",this.scheduleVpRosterLayout),window.addEventListener("workbench-message",this.handleFolderPickerMessage),document.addEventListener("click",this.handleOutsideRosterClick,!0),this.seedAgentDefault(),this.subscribeVpsFor(this.form.agentId),this.applyDefaultSelection()},watch:{vpListSignature(){this.applyDefaultSelection(),this.scheduleVpRosterLayout()},agentSignature(){this.seedAgentDefault(),this.scheduleVpRosterLayout()},"form.provider"(e,t){e!==t&&(this.form.workDir="",this.scannedSessions=[],this.restoreError="",e==="yeaft"?(this.subscribeVpsFor(this.form.agentId),this.applyDefaultSelection()):this.form.agentId&&this.chat?.listFoldersForAgent?.(this.form.agentId,e))},"form.agentId"(e,t){e!==t&&(this.isYeaftProvider&&this.subscribeVpsFor(e),this.form.vpIds=[],this.form.defaultVpId=null,this.vpPickerTouched=!1,this.isYeaftProvider&&this.applyDefaultSelection(),this.scannedSessions=[],this.restoreError="",!this.isYeaftProvider&&e&&this.chat?.listFoldersForAgent?.(e,this.form.provider),(this.form.workDir||"").trim()&&this.loadProviderSessions())},"form.workDir"(e,t){e===t||(this.restoreError="",this.scannedSessions=[],!(e||"").trim())||this.loadProviderSessions()}},beforeUnmount(){window.removeEventListener("keydown",this.onEsc),window.removeEventListener("resize",this.scheduleVpRosterLayout),window.visualViewport?.removeEventListener("resize",this.scheduleVpRosterLayout),window.visualViewport?.removeEventListener("scroll",this.scheduleVpRosterLayout),window.removeEventListener("workbench-message",this.handleFolderPickerMessage),document.removeEventListener("click",this.handleOutsideRosterClick,!0),this._vpRosterLayoutFrame&&cancelAnimationFrame(this._vpRosterLayoutFrame),this._folderPickerTimer&&clearTimeout(this._folderPickerTimer)},methods:{toggleVpRoster(){if(this.vpRosterOpen){this.closeVpRoster();return}this.vpRosterPlacement="down",this.vpRosterAvailableHeight=null,this.vpRosterOpen=!0,this.$nextTick(this.scheduleVpRosterLayout)},closeVpRoster(){this.vpRosterOpen=!1,this.vpRosterAvailableHeight=null},scheduleVpRosterLayout(){!this.vpRosterOpen||this._vpRosterLayoutFrame||(this._vpRosterLayoutFrame=requestAnimationFrame(()=>{this._vpRosterLayoutFrame=null,this.updateVpRosterLayout()}))},updateVpRosterLayout(){if(!this.vpRosterOpen)return;let e=this.$refs.vpRosterTrigger,t=this.$refs.vpRosterPopup,s=e?.closest?.(".resume-modal");if(!e||!t||!s)return;let n=t.style.maxHeight;t.style.maxHeight="none";let i=t.scrollHeight;t.style.maxHeight=n;let r=window.visualViewport,o=r?r.offsetTop:0,a=r?r.height:window.innerHeight,l={top:o,bottom:o+a},c=s.getBoundingClientRect(),d=bv(e.getBoundingClientRect(),c,l,i);this.vpRosterPlacement=d.placement,this.vpRosterAvailableHeight=d.availableHeight},seedAgentDefault(){try{let e=this.agentOptions;if(!Array.isArray(e)||e.length===0||e.find(r=>r.id===this.form.agentId&&r.online))return;let s=this.chat,n=s&&s.currentAgent||null,i=e.find(r=>r.id===n&&r.online)||e.find(r=>r.online)||null;i&&(this.form.agentId=i.id)}catch{}},subscribeVpsFor(e){let t=this.chat;if(!t||typeof t.sendWsMessage!="function")return;let s=e||t.currentAgent||null;if(!s)return;let n=this.vpStore;n&&n.lastSnapshotAt>0&&n.lastVpSnapshotAgentId===s||t.sendWsMessage({type:"yeaft_vp_subscribe",agentId:s})},loadProviderSessions(){if(this.isYeaftProvider)return this.loadRestoreCandidates();let e=(this.form.workDir||"").trim();!e||!this.form.agentId||this.chat?.listHistorySessionsForAgent?.(this.form.agentId,e,this.form.provider)},async loadRestoreCandidates(){if(this.restoreScanning)return;let e=(this.form.workDir||"").trim();if(!e){this.scannedSessions=[];return}let t=this.chat;if(!t||typeof t.sessionCrudRequest!="function"){this.restoreError=this.$t("yeaft.restore.modal.scanError",{message:"store unavailable"});return}let s=this.form.agentId||null;if(!s){this.scannedSessions=[],this.restoreError=this.$t("yeaft.restore.modal.scanError",{message:"no agent selected"});return}this.restoreScanning=!0,this.restoreError="";try{let n=await t.sessionCrudRequest("scan_workdir",{workDir:e},{agentId:s});if(n&&n.ok){let i=Array.isArray(n.sessions)?n.sessions:Array.isArray(n.groups)?n.groups:[];this.scannedSessions=i}else{this.scannedSessions=[];let i=n?.error?.message||n?.error?.code||"unknown";this.restoreError=this.$t("yeaft.restore.modal.scanError",{message:i})}}catch(n){this.scannedSessions=[],this.restoreError=this.$t("yeaft.restore.modal.scanError",{message:n?.message||String(n)})}finally{this.restoreScanning=!1}},async onRestoreClick(e){if(!e||!e.id||this.restoring)return;let t=this.chat;if(!t||typeof t.sessionCrudRequest!="function"){this.restoreError=this.$t("yeaft.restore.modal.restoreError",{message:"store unavailable"});return}let s=this.form.agentId||null;if(!s){this.restoreError=this.$t("yeaft.restore.modal.restoreError",{message:"no agent selected"});return}this.restoring=e.id,this.restoreError="";try{let n=await t.sessionCrudRequest("restore",{sessionId:e.id,workDir:(this.form.workDir||"").trim()},{agentId:s});if(n&&n.ok){let r=n.session||n.group||e,o=r&&r.agentId;o&&t.currentAgent!==o&&typeof t.selectAgent=="function"&&t.selectAgent(o),this.sessionsStore&&this.sessionsStore.setActive(r.id||e.id),typeof t.setActiveSessionFilter=="function"&&t.setActiveSessionFilter(r.id||e.id,{force:!0}),this.$emit("created",r),this.$emit("close");return}let i=n?.error?.message||n?.error?.code||"unknown";this.restoreError=this.$t("yeaft.restore.modal.restoreError",{message:i})}catch(n){this.restoreError=this.$t("yeaft.restore.modal.restoreError",{message:n?.message||String(n)})}finally{this.restoring=null}},applyDefaultSelection(){if(this.vpPickerTouched)return;let e=this.vpList||[];if(e.length===0)return;let t=e.map(o=>o&&o.vpId).filter(Boolean);if(t.length===0)return;let s=Array.isArray(this.form.vpIds)?this.form.vpIds:[],n=s.filter(o=>t.includes(o)),i=this.form.defaultVpId&&n.includes(this.form.defaultVpId);if(n.length>0&&i){n.length!==s.length&&(this.form.vpIds=n);return}let r=t.includes(rf)?rf:n[0]||t[0];this.form.vpIds=[r],this.form.defaultVpId=r},toggleVp(e,t){this.vpPickerTouched=!0,t?(this.form.vpIds.includes(e)||this.form.vpIds.push(e),this.form.defaultVpId||(this.form.defaultVpId=e)):(this.form.vpIds=this.form.vpIds.filter(s=>s!==e),this.form.defaultVpId&&!this.form.vpIds.includes(this.form.defaultVpId)&&(this.form.defaultVpId=this.form.vpIds[0]||null))},vpLabelFor(e){let t=this.vpStore?.vpLabel;return typeof t=="function"?t(e):e},vpDescriptionFor(e){let t=this.vpStore?.vpDescription;return typeof t=="function"?t(e):""},vpTextColorFor(e){let t=this.vpStore?.vpTextColor;return typeof t=="function"?t(e):"var(--text-primary)"},selectFolder(e){this.form.workDir=e},selectSession(e){if(!(!e||!e.id)){if(!this.isYeaftProvider){let t=e.workDir||(this.form.workDir||"").trim()||this.defaultWorkDir;this.chat?.selectAgent?.(this.form.agentId),this.chat._pendingSessionTitle=e.name||e.title||null,this.chat?.resumeConversation?.(e.id,t,this.form.agentId,this.chatProviderOptions()),this.$emit("close");return}e.inSidebar?this.resumeExisting(e):this.onRestoreClick(e)}},chatProviderOptions(){let e={provider:this.form.provider};return this.form.provider==="copilot"&&(e.providerOptions={allowAllTools:!0}),e},resumeExisting(e){if(!e||!e.id)return;let t=this.chat;e.agentId&&t&&t.currentAgent!==e.agentId&&typeof t.selectAgent=="function"&&t.selectAgent(e.agentId),this.sessionsStore&&this.sessionsStore.setActive(e.id),t&&typeof t.setActiveSessionFilter=="function"&&t.setActiveSessionFilter(e.id,{force:!0}),this.$emit("close")},handleOutsideRosterClick(e){if(!this.vpRosterOpen)return;let t=this.$refs.vpRosterRoot;t&&(t.contains(e.target)||this.closeVpRoster())},getLastPathSegment(e){return Rn(e)},formatDate(e){return ir(e,this.$t.bind(this))},onEsc(e){if(e.key==="Escape"&&!this.folderPickerOpen){if(this.vpRosterOpen){this.closeVpRoster();return}this.busy||this.requestClose()}},onOverlayClick(){this.busy||this.requestClose()},requestClose(){this.$emit("close")},folderPickerInitialDir(){return this.form.workDir||this.defaultWorkDir||""},folderPickerSetWorkDir(e){this.form.workDir=e},...ba,async onSubmit(){if(!(this.busy||!this.canSubmit)){this.submitError="",this.busy=!0;try{if(!this.chat){this.submitError=this.$t("yeaft.session.error.unknown",{message:"store unavailable"});return}if(!this.isYeaftProvider){let d=this.form.workDir.trim()||this.defaultWorkDir;this.chat.selectAgent?.(this.form.agentId),this.chat.createConversation?.(d,this.form.agentId,null,this.chatProviderOptions()),this.$emit("created",{provider:this.form.provider,workDir:d}),this.$emit("close");return}if(typeof this.chat.createYeaftSession!="function"){this.submitError=this.$t("yeaft.session.error.unknown",{message:"store unavailable"});return}let e=new Set((this.vpList||[]).map(d=>d&&d.vpId).filter(Boolean)),t=this.form.vpIds.filter(d=>e.has(d));if(t.length===0){this.submitError=this.$t("yeaft.session.error.unknown",{message:"no valid VP selected"});return}let s=this.form.defaultVpId&&t.includes(this.form.defaultVpId)?this.form.defaultVpId:t[0],i=this.form.name.trim()||Rn(this.form.workDir.trim())||this.$t("yeaft.session.create.untitled"),r=await this.chat.createYeaftSession({displayName:i,vpIds:t,defaultVpId:s,workDir:this.form.workDir.trim(),agentId:this.form.agentId||null});if(r&&r.ok){let d=this.chat,u=r.session||r.group||null,p=u&&u.id,f=u&&u.agentId;p&&(f&&d&&d.currentAgent!==f&&typeof d.selectAgent=="function"&&d.selectAgent(f),this.sessionsStore&&this.sessionsStore.setActive(p),d&&typeof d.setActiveSessionFilter=="function"&&d.setActiveSessionFilter(p,{force:!0})),this.$emit("created",u),this.$emit("close");return}let o=r?.error?.code||"unknown",a=r?.error?.message||"",l=`yeaft.session.error.${o}`,c=this.$t(l,{message:a});this.submitError=c===l?this.$t("yeaft.session.error.unknown",{message:a}):c}catch(e){this.submitError=this.$t("yeaft.session.error.unknown",{message:e?.message||String(e)})}finally{this.busy=!1}}}}}});function cs(e){return!e?.runId||!e?.id?"":`${e.runId}:${e.id}`}function af(e,t){let s=cs(e);return s?`${s}:${t?.id||t?.loopNumber||""}`:""}var ka=H(()=>{});var lf,cf=H(()=>{wn();ka();lf={name:"WorkCenterActionDetail",props:{action:{type:Object,default:null},selected:{type:Object,default:null},messages:{type:Array,default:()=>[]},messagesNextCursor:{type:[String,Number],default:null},messagesLoading:{type:Boolean,default:!1},messagesError:{type:String,default:""},requests:{type:Array,default:()=>[]},requestDetails:{type:Object,default:()=>({})},requestDetailsLoading:{type:Object,default:()=>({})},requestDetailsError:{type:Object,default:()=>({})},requestsLoading:{type:Boolean,default:!1},requestsError:{type:String,default:""},composerText:{type:String,default:""},composerAttachments:{type:Array,default:()=>[]},uploading:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},composerError:{type:String,default:""},attachmentsSupported:{type:Boolean,default:!1},previewingAttachmentId:{type:String,default:null},attachmentError:{type:String,default:""}},emits:["back","update:composerText","load-earlier-messages","select-request","refresh-requests","open-run","attachment-input","remove-attachment","open-attachment","send","retry"],data(){return{activeView:"conversation",conversationScrollTop:0,expandedRequestKey:null,requestSelectionTouched:!1}},computed:{executorName(){return this.action?.assignedVp?.name||this.action?.assignedVp?.id||this.action?.requiredRole||this.tr("workCenter.actionExecutorPending","Executor pending")},canCompose(){return!this.action||["done","cancelled"].includes(this.selected?.status)?!1:["ready","running","waiting","failed"].includes(this.action.status)},canRetry(){return this.action?.status==="failed"&&!this.uploading&&!this.sending},composerHint(){return this.action?.status==="waiting"?this.tr("workCenter.actionInputResumeHint","Your input resumes this Action with the additional context."):this.action?.status==="failed"?this.tr("workCenter.actionInputRetryHint","Send corrected instructions or files to rerun this Action, or retry unchanged."):this.tr("workCenter.actionInputContinueHint","Direct intervention for this Action only.")},canSend(){return!this.uploading&&!this.sending&&(!!this.composerText.trim()||this.composerAttachments.length>0)},hasMessages(){return this.messages.length>0},hasActionBrief(){return!!this.action?.brief?.approach||!!this.action?.brief?.expectedOutcome||!!this.action?.dependsOnStageIds?.length||!!this.action?.canonicalResult?.summary},waitingQuestion(){return this.action?.status!=="waiting"?"":String(this.action?.canonicalResult?.waitingReason||"").trim()},composerDescriptionIds(){return[this.waitingQuestion?"work-center-action-waiting-question":null,"work-center-action-composer-hint"].filter(Boolean).join(" ")},currentGenerationRequests(){let e=Math.max(1,Number(this.action?.generation)||1);return this.requests.filter(t=>Math.max(1,Number(t?.generation)||1)===e).slice().sort((t,s)=>(Number(s?.attempt)||0)-(Number(t?.attempt)||0)||(Number(s?.openedAt)||0)-(Number(t?.openedAt)||0)||String(s?.id||"").localeCompare(String(t?.id||"")))}},watch:{"action.id"(){this.resetActionView()},"action.generation"(e,t){let s=Math.max(1,Number(e)||1),n=Math.max(1,Number(t)||1);s!==n&&this.resetActionView()},composerText(e){e||this.$nextTick(()=>this.resizeComposerInput(this.$refs.composerInput,!0))},messages:{deep:!0,handler(){this.$nextTick(()=>Ye(this.$el))}},requests(){this.activeView!=="execution"||this.requestSelectionTouched||this.$nextTick(()=>this.syncLatestRequest())}},mounted(){this.$nextTick(()=>Ye(this.$el))},methods:{tr(e,t){let s=this.$t?this.$t(e):e;return s&&s!==e?s:t},statusLabel(e){return this.tr(`workCenter.status.${e}`,String(e||"").replace("_"," "))},messageSpeaker(e){return e?.role==="user"?this.tr("workCenter.you","You"):e?.speaker?.name||e?.speaker?.id||this.executorName},time(e){if(!e)return"";try{return new Date(Number(e)).toLocaleString()}catch{return""}},formatCount(e){return new Intl.NumberFormat().format(Math.max(0,Number(e)||0))},formatTokens(e){let t=Math.max(0,Number(e)||0);return t>=1e6?`${(t/1e6).toFixed(1)}m`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)},formatDuration(e){let t=Math.max(0,Number(e)||0);return t<1e3?`${t}ms`:`${(t/1e3).toFixed(t<1e4?1:0)}s`},formatAttachmentSize(e){let t=Math.max(0,Number(e)||0);return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`},messageHtml(e){return Di(String(e||""))},json(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}},requestKey(e){return cs(e)},requestLoopKey(e,t){return af(e,t)},requestDetail(e){let t=this.requestDetails[this.requestKey(e)]||null;return t?.request||t},resetActionView(){this.activeView="conversation",this.conversationScrollTop=0,this.expandedRequestKey=null,this.requestSelectionTouched=!1,this.$nextTick(()=>{this.$refs.conversationPanel&&(this.$refs.conversationPanel.scrollTop=0),Ye(this.$el)})},tabId(e){return`work-center-action-${e}-tab`},panelId(e){return`work-center-action-${e}-panel`},onTabKeydown(e,t){let s=["conversation","execution"],n=s.indexOf(t);if(n<0)return;let i;if(e.key==="ArrowRight")i=(n+1)%s.length;else if(e.key==="ArrowLeft")i=(n-1+s.length)%s.length;else if(e.key==="Home")i=0;else if(e.key==="End")i=s.length-1;else return;e.preventDefault();let r=s[i];this.setActiveView(r),this.$nextTick(()=>this.$refs[`${r}Tab`]?.focus())},async openRun(e){let t=this.action?.id,s=this.action?.generation,n=await new Promise(i=>this.$emit("open-run",e,i));!n||this.action?.id!==t||this.action?.generation!==s||(this.activeView="execution",this.requestSelectionTouched=!0,this.expandedRequestKey=this.requestKey(n),await this.$nextTick(),this.$refs.requestsPanel?.scrollIntoView?.({behavior:"smooth",block:"start"}))},setActiveView(e){e!==this.activeView&&(this.activeView==="conversation"&&(this.conversationScrollTop=this.$refs.conversationPanel?.scrollTop||0),this.activeView=e,e==="execution"&&(this.refreshRequests(),this.$nextTick(()=>this.syncLatestRequest())),this.$nextTick(()=>{e==="conversation"&&this.$refs.conversationPanel&&(this.$refs.conversationPanel.scrollTop=this.conversationScrollTop),Ye(this.$el)}))},async toggleRequest(e){let t=this.requestKey(e);if(this.requestSelectionTouched=!0,this.expandedRequestKey===t){this.expandedRequestKey=null;return}this.expandedRequestKey=t,this.requestDetail(e)||this.$emit("select-request",e)},syncLatestRequest(){if(this.requestSelectionTouched)return;let e=this.currentGenerationRequests[0];if(!e){this.expandedRequestKey=null;return}let t=this.requestKey(e);this.expandedRequestKey!==t&&(this.expandedRequestKey=t,this.requestDetail(e)||this.$emit("select-request",e))},toolHasDetail(e){return e?.input!=null||e?.output!=null},resizeComposerInput(e,t=!1){if(!e)return;e.style.height="auto";let s=t?24:Math.min(e.scrollHeight,144);e.style.height=`${s}px`,e.style.overflowY=e.scrollHeight>144?"auto":"hidden"},onComposerInput(e){this.$emit("update:composerText",e.target.value),this.resizeComposerInput(e.target,!e.target.value)},onComposerKeydown(e){e.key!=="Enter"||e.shiftKey||e.isComposing||(e.preventDefault(),this.canSend&&this.$emit("send"))},refreshRequests(){this.$emit("refresh-requests")}},template:`
5016
+ `,data(){return{form:{provider:["yeaft","copilot","claude-code"].includes(this.initialProvider)?this.initialProvider:"yeaft",name:"",vpIds:[],defaultVpId:null,workDir:"",agentId:null},busy:!1,submitError:"",...ya(),vpPickerTouched:!1,vpRosterOpen:!1,vpRosterPlacement:"down",vpRosterAvailableHeight:null,scannedSessions:[],restoreScanning:!1,restoring:null,restoreError:"",vpSnapshotTimer:null}},computed:{chat(){try{if(typeof window<"u"&&window.Pinia?.useChatStore)return window.Pinia.useChatStore()}catch{}return null},vpStore(){try{if(typeof window<"u"&&window.Pinia?.useVpStore)return window.Pinia.useVpStore()}catch{}return null},sessionsStore(){try{if(typeof window<"u"&&window.Pinia?.useSessionsStore)return window.Pinia.useSessionsStore()}catch{}return null},isYeaftProvider(){return this.form.provider==="yeaft"},vpLibraryReady(){let e=this.vpStore;return!!(e&&e.snapshotStatus==="ready"&&e.snapshotAgentId===this.form.agentId&&e.lastVpSnapshotAgentId===this.form.agentId)},vpList(){return this.vpLibraryReady?this.vpStore?.vpList||[]:[]},vpDomainSections(){return os(this.vpList)},vpListSignature(){return(this.vpList||[]).map(e=>e&&e.vpId).filter(Boolean).join(",")},vpLibraryEmpty(){let e=this.vpStore;return!e||!this.vpLibraryReady?!1:e.emptyLibrary===!0?!0:!!(e.lastSnapshotAt&&e.lastSnapshotAt>0&&(e.vpOrder?.length||0)===0)},vpLibraryError(){let e=this.vpStore;return!e||e.snapshotStatus!=="error"?!1:!e.snapshotAgentId||e.snapshotAgentId===this.form.agentId},agentOptions(){let e=this.chat;return!e||!Array.isArray(e.agents)?[]:e.agents.map(t=>({id:t.id,name:t.name,online:!!t.online,workDir:t.workDir||""}))},agentSignature(){return this.agentOptions.map(e=>`${e.id}:${e.online?1:0}`).join(",")},folderPickerAgentId(){return this.form.agentId||this.chat?.currentAgent||""},defaultWorkDir(){return this.agentOptions.find(t=>t.id===this.form.agentId)?.workDir||this.chat?.currentAgentInfo?.workDir||""},workDirPlaceholder(){return this.defaultWorkDir||this.$t("modal.newConv.inputOrSelect")},allSessions(){return this.sessionsStore?.sessionList||[]},agentSessions(){let e=this.form.agentId||null;return e?this.allSessions.filter(t=>{let s=t&&t.agentId;return!s||s===e}):this.allSessions},folderAggregates(){let e=new Map;for(let t of this.agentSessions){let s=t&&typeof t.workDir=="string"?t.workDir.trim():"";if(!s)continue;let n=e.get(s)||{path:s,count:0};n.count+=1,e.set(s,n)}return Array.from(e.values()).sort((t,s)=>t.path.localeCompare(s.path))},sessionsInDir(){let e=new Set((this.sessionsStore?.sessionList||[]).map(s=>s&&s.id).filter(Boolean));return(Array.isArray(this.scannedSessions)?this.scannedSessions:[]).filter(s=>s&&s.id).map(s=>({...s,inSidebar:e.has(s.id)}))},chatFolderRows(){return(this.chat?.folders||[]).map(e=>({path:e.path||e.name||"",count:Number(e.sessionCount)||0})).filter(e=>e.path)},createFolderRows(){return this.isYeaftProvider?this.folderAggregates:this.chatFolderRows},createSessionRows(){return this.isYeaftProvider?this.sessionsInDir:(this.chat?.historySessions||[]).map(e=>({...e,id:e.sessionId,name:e.title,createdAt:e.lastModified}))},canSubmit(){if(this.isYeaftProvider&&(!this.vpLibraryReady||this.form.vpIds.length===0)||!this.form.agentId)return!1;let e=this.agentOptions.find(t=>t.id===this.form.agentId);return!!(e&&e.online)},vpRosterSummary(){let e=this.form.vpIds||[];return e.length===0?this.$t("yeaft.session.create.vpNone"):e.length<=3?e.map(t=>this.vpLabelFor(t)).join(this.$t("common.comma")):this.$t("yeaft.session.create.vpCount",{n:e.length})},vpRosterPopupStyle(){return Number.isFinite(this.vpRosterAvailableHeight)?{"--vp-roster-available-height":`${this.vpRosterAvailableHeight}px`}:{}}},mounted(){window.addEventListener("keydown",this.onEsc),window.addEventListener("resize",this.scheduleVpRosterLayout),window.visualViewport?.addEventListener("resize",this.scheduleVpRosterLayout),window.visualViewport?.addEventListener("scroll",this.scheduleVpRosterLayout),window.addEventListener("workbench-message",this.handleFolderPickerMessage),document.addEventListener("click",this.handleOutsideRosterClick,!0),this.seedAgentDefault(),this.subscribeVpsFor(this.form.agentId),this.applyDefaultSelection()},watch:{vpListSignature(){this.applyDefaultSelection(),this.scheduleVpRosterLayout()},agentSignature(){this.seedAgentDefault(),this.scheduleVpRosterLayout()},"form.provider"(e,t){e!==t&&(this.form.workDir="",this.scannedSessions=[],this.restoreError="",e==="yeaft"?(this.subscribeVpsFor(this.form.agentId),this.applyDefaultSelection()):this.form.agentId&&this.chat?.listFoldersForAgent?.(this.form.agentId,e))},"form.agentId"(e,t){e!==t&&(this.isYeaftProvider&&this.subscribeVpsFor(e),this.form.vpIds=[],this.form.defaultVpId=null,this.vpPickerTouched=!1,this.isYeaftProvider&&this.applyDefaultSelection(),this.scannedSessions=[],this.restoreError="",!this.isYeaftProvider&&e&&this.chat?.listFoldersForAgent?.(e,this.form.provider),(this.form.workDir||"").trim()&&this.loadProviderSessions())},"form.workDir"(e,t){e===t||(this.restoreError="",this.scannedSessions=[],!(e||"").trim())||this.loadProviderSessions()}},beforeUnmount(){window.removeEventListener("keydown",this.onEsc),window.removeEventListener("resize",this.scheduleVpRosterLayout),window.visualViewport?.removeEventListener("resize",this.scheduleVpRosterLayout),window.visualViewport?.removeEventListener("scroll",this.scheduleVpRosterLayout),window.removeEventListener("workbench-message",this.handleFolderPickerMessage),document.removeEventListener("click",this.handleOutsideRosterClick,!0),this._vpRosterLayoutFrame&&cancelAnimationFrame(this._vpRosterLayoutFrame),this._folderPickerTimer&&clearTimeout(this._folderPickerTimer),this.vpSnapshotTimer&&clearTimeout(this.vpSnapshotTimer)},methods:{toggleVpRoster(){if(this.vpRosterOpen){this.closeVpRoster();return}this.vpRosterPlacement="down",this.vpRosterAvailableHeight=null,this.vpRosterOpen=!0,this.$nextTick(this.scheduleVpRosterLayout)},closeVpRoster(){this.vpRosterOpen=!1,this.vpRosterAvailableHeight=null},scheduleVpRosterLayout(){!this.vpRosterOpen||this._vpRosterLayoutFrame||(this._vpRosterLayoutFrame=requestAnimationFrame(()=>{this._vpRosterLayoutFrame=null,this.updateVpRosterLayout()}))},updateVpRosterLayout(){if(!this.vpRosterOpen)return;let e=this.$refs.vpRosterTrigger,t=this.$refs.vpRosterPopup,s=e?.closest?.(".resume-modal");if(!e||!t||!s)return;let n=t.style.maxHeight;t.style.maxHeight="none";let i=t.scrollHeight;t.style.maxHeight=n;let r=window.visualViewport,o=r?r.offsetTop:0,a=r?r.height:window.innerHeight,l={top:o,bottom:o+a},c=s.getBoundingClientRect(),d=yv(e.getBoundingClientRect(),c,l,i);this.vpRosterPlacement=d.placement,this.vpRosterAvailableHeight=d.availableHeight},seedAgentDefault(){try{let e=this.agentOptions;if(!Array.isArray(e)||e.length===0||e.find(r=>r.id===this.form.agentId&&r.online))return;let s=this.chat,n=s&&s.currentAgent||null,i=e.find(r=>r.id===n&&r.online)||e.find(r=>r.online)||null;i&&(this.form.agentId=i.id)}catch{}},subscribeVpsFor(e,{force:t=!1}={}){let s=this.chat,n=e||s?.currentAgent||null,i=this.vpStore;if(!s||typeof s.sendWsMessage!="function"||!n){let l=`vp_snapshot_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return i?.beginSnapshot?.(n,l),i?.failSnapshot?.(n,l,"No online Agent is available."),!1}if(!t&&i?.snapshotStatus==="ready"&&i.snapshotAgentId===n&&i.lastVpSnapshotAgentId===n)return this.vpSnapshotTimer&&clearTimeout(this.vpSnapshotTimer),this.vpSnapshotTimer=null,!0;let o=`vp_snapshot_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return i?.beginSnapshot?.(n,o),s.sendWsMessage({type:"yeaft_vp_subscribe",agentId:n,requestId:o})===!1?(i?.failSnapshot?.(n,o,"WebSocket is not connected."),!1):(this.vpSnapshotTimer&&clearTimeout(this.vpSnapshotTimer),this.vpSnapshotTimer=setTimeout(()=>{this.vpSnapshotTimer=null,i?.snapshotStatus==="loading"&&i.snapshotRequestId===o&&i.failSnapshot(n,o,"VP library request timed out.")},1e4),!0)},retryVpSnapshot(){this.subscribeVpsFor(this.form.agentId,{force:!0})},loadProviderSessions(){if(this.isYeaftProvider)return this.loadRestoreCandidates();let e=(this.form.workDir||"").trim();!e||!this.form.agentId||this.chat?.listHistorySessionsForAgent?.(this.form.agentId,e,this.form.provider)},async loadRestoreCandidates(){if(this.restoreScanning)return;let e=(this.form.workDir||"").trim();if(!e){this.scannedSessions=[];return}let t=this.chat;if(!t||typeof t.sessionCrudRequest!="function"){this.restoreError=this.$t("yeaft.restore.modal.scanError",{message:"store unavailable"});return}let s=this.form.agentId||null;if(!s){this.scannedSessions=[],this.restoreError=this.$t("yeaft.restore.modal.scanError",{message:"no agent selected"});return}this.restoreScanning=!0,this.restoreError="";try{let n=await t.sessionCrudRequest("scan_workdir",{workDir:e},{agentId:s});if(n&&n.ok){let i=Array.isArray(n.sessions)?n.sessions:Array.isArray(n.groups)?n.groups:[];this.scannedSessions=i}else{this.scannedSessions=[];let i=n?.error?.message||n?.error?.code||"unknown";this.restoreError=this.$t("yeaft.restore.modal.scanError",{message:i})}}catch(n){this.scannedSessions=[],this.restoreError=this.$t("yeaft.restore.modal.scanError",{message:n?.message||String(n)})}finally{this.restoreScanning=!1}},async onRestoreClick(e){if(!e||!e.id||this.restoring)return;let t=this.chat;if(!t||typeof t.sessionCrudRequest!="function"){this.restoreError=this.$t("yeaft.restore.modal.restoreError",{message:"store unavailable"});return}let s=this.form.agentId||null;if(!s){this.restoreError=this.$t("yeaft.restore.modal.restoreError",{message:"no agent selected"});return}this.restoring=e.id,this.restoreError="";try{let n=await t.sessionCrudRequest("restore",{sessionId:e.id,workDir:(this.form.workDir||"").trim()},{agentId:s});if(n&&n.ok){let r=n.session||n.group||e,o=r&&r.agentId;o&&t.currentAgent!==o&&typeof t.selectAgent=="function"&&t.selectAgent(o),this.sessionsStore&&this.sessionsStore.setActive(r.id||e.id),typeof t.setActiveSessionFilter=="function"&&t.setActiveSessionFilter(r.id||e.id,{force:!0}),this.$emit("created",r),this.$emit("close");return}let i=n?.error?.message||n?.error?.code||"unknown";this.restoreError=this.$t("yeaft.restore.modal.restoreError",{message:i})}catch(n){this.restoreError=this.$t("yeaft.restore.modal.restoreError",{message:n?.message||String(n)})}finally{this.restoring=null}},applyDefaultSelection(){if(this.vpPickerTouched)return;let e=this.vpList||[];if(e.length===0)return;let t=e.map(o=>o&&o.vpId).filter(Boolean);if(t.length===0)return;let s=Array.isArray(this.form.vpIds)?this.form.vpIds:[],n=s.filter(o=>t.includes(o)),i=this.form.defaultVpId&&n.includes(this.form.defaultVpId);if(n.length>0&&i){n.length!==s.length&&(this.form.vpIds=n);return}let r=t.includes(rf)?rf:n[0]||t[0];this.form.vpIds=[r],this.form.defaultVpId=r},toggleVp(e,t){this.vpPickerTouched=!0,t?(this.form.vpIds.includes(e)||this.form.vpIds.push(e),this.form.defaultVpId||(this.form.defaultVpId=e)):(this.form.vpIds=this.form.vpIds.filter(s=>s!==e),this.form.defaultVpId&&!this.form.vpIds.includes(this.form.defaultVpId)&&(this.form.defaultVpId=this.form.vpIds[0]||null))},vpLabelFor(e){let t=this.vpStore?.vpLabel;return typeof t=="function"?t(e):e},vpDescriptionFor(e){let t=this.vpStore?.vpDescription;return typeof t=="function"?t(e):""},vpTextColorFor(e){let t=this.vpStore?.vpTextColor;return typeof t=="function"?t(e):"var(--text-primary)"},selectFolder(e){this.form.workDir=e},selectSession(e){if(!(!e||!e.id)){if(!this.isYeaftProvider){let t=e.workDir||(this.form.workDir||"").trim()||this.defaultWorkDir;this.chat?.selectAgent?.(this.form.agentId),this.chat._pendingSessionTitle=e.name||e.title||null,this.chat?.resumeConversation?.(e.id,t,this.form.agentId,this.chatProviderOptions()),this.$emit("close");return}e.inSidebar?this.resumeExisting(e):this.onRestoreClick(e)}},chatProviderOptions(){let e={provider:this.form.provider};return this.form.provider==="copilot"&&(e.providerOptions={allowAllTools:!0}),e},resumeExisting(e){if(!e||!e.id)return;let t=this.chat;e.agentId&&t&&t.currentAgent!==e.agentId&&typeof t.selectAgent=="function"&&t.selectAgent(e.agentId),this.sessionsStore&&this.sessionsStore.setActive(e.id),t&&typeof t.setActiveSessionFilter=="function"&&t.setActiveSessionFilter(e.id,{force:!0}),this.$emit("close")},handleOutsideRosterClick(e){if(!this.vpRosterOpen)return;let t=this.$refs.vpRosterRoot;t&&(t.contains(e.target)||this.closeVpRoster())},getLastPathSegment(e){return _n(e)},formatDate(e){return ir(e,this.$t.bind(this))},onEsc(e){if(e.key==="Escape"&&!this.folderPickerOpen){if(this.vpRosterOpen){this.closeVpRoster();return}this.busy||this.requestClose()}},onOverlayClick(){this.busy||this.requestClose()},requestClose(){this.$emit("close")},folderPickerInitialDir(){return this.form.workDir||this.defaultWorkDir||""},folderPickerSetWorkDir(e){this.form.workDir=e},...ba,async onSubmit(){if(!(this.busy||!this.canSubmit)){this.submitError="",this.busy=!0;try{if(!this.chat){this.submitError=this.$t("yeaft.session.error.unknown",{message:"store unavailable"});return}if(!this.isYeaftProvider){let d=this.form.workDir.trim()||this.defaultWorkDir;this.chat.selectAgent?.(this.form.agentId),this.chat.createConversation?.(d,this.form.agentId,null,this.chatProviderOptions()),this.$emit("created",{provider:this.form.provider,workDir:d}),this.$emit("close");return}if(typeof this.chat.createYeaftSession!="function"){this.submitError=this.$t("yeaft.session.error.unknown",{message:"store unavailable"});return}let e=new Set((this.vpList||[]).map(d=>d&&d.vpId).filter(Boolean)),t=this.form.vpIds.filter(d=>e.has(d));if(t.length===0){this.submitError=this.$t("yeaft.session.error.unknown",{message:"no valid VP selected"});return}let s=this.form.defaultVpId&&t.includes(this.form.defaultVpId)?this.form.defaultVpId:t[0],i=this.form.name.trim()||_n(this.form.workDir.trim())||this.$t("yeaft.session.create.untitled"),r=await this.chat.createYeaftSession({displayName:i,vpIds:t,defaultVpId:s,workDir:this.form.workDir.trim(),agentId:this.form.agentId||null});if(r&&r.ok){let d=this.chat,u=r.session||r.group||null,p=u&&u.id,f=u&&u.agentId;p&&(f&&d&&d.currentAgent!==f&&typeof d.selectAgent=="function"&&d.selectAgent(f),this.sessionsStore&&this.sessionsStore.setActive(p),d&&typeof d.setActiveSessionFilter=="function"&&d.setActiveSessionFilter(p,{force:!0})),this.$emit("created",u),this.$emit("close");return}let o=r?.error?.code||"unknown",a=r?.error?.message||"",l=`yeaft.session.error.${o}`,c=this.$t(l,{message:a});this.submitError=c===l?this.$t("yeaft.session.error.unknown",{message:a}):c}catch(e){this.submitError=this.$t("yeaft.session.error.unknown",{message:e?.message||String(e)})}finally{this.busy=!1}}}}}});function cs(e){return!e?.runId||!e?.id?"":`${e.runId}:${e.id}`}function af(e,t){let s=cs(e);return s?`${s}:${t?.id||t?.loopNumber||""}`:""}var ka=H(()=>{});var lf,cf=H(()=>{wn();ka();lf={name:"WorkCenterActionDetail",props:{action:{type:Object,default:null},selected:{type:Object,default:null},messages:{type:Array,default:()=>[]},messagesNextCursor:{type:[String,Number],default:null},messagesLoading:{type:Boolean,default:!1},messagesError:{type:String,default:""},requests:{type:Array,default:()=>[]},requestDetails:{type:Object,default:()=>({})},requestDetailsLoading:{type:Object,default:()=>({})},requestDetailsError:{type:Object,default:()=>({})},requestsLoading:{type:Boolean,default:!1},requestsError:{type:String,default:""},composerText:{type:String,default:""},composerAttachments:{type:Array,default:()=>[]},uploading:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},composerError:{type:String,default:""},attachmentsSupported:{type:Boolean,default:!1},previewingAttachmentId:{type:String,default:null},attachmentError:{type:String,default:""}},emits:["back","update:composerText","load-earlier-messages","select-request","refresh-requests","open-run","attachment-input","remove-attachment","open-attachment","send","retry"],data(){return{activeView:"conversation",conversationScrollTop:0,expandedRequestKey:null,requestSelectionTouched:!1}},computed:{executorName(){return this.action?.assignedVp?.name||this.action?.assignedVp?.id||this.action?.requiredRole||this.tr("workCenter.actionExecutorPending","Executor pending")},canCompose(){return!this.action||["done","cancelled"].includes(this.selected?.status)?!1:["ready","running","waiting","failed"].includes(this.action.status)},canRetry(){return this.action?.status==="failed"&&!this.uploading&&!this.sending},composerHint(){return this.action?.status==="waiting"?this.tr("workCenter.actionInputResumeHint","Your input resumes this Action with the additional context."):this.action?.status==="failed"?this.tr("workCenter.actionInputRetryHint","Send corrected instructions or files to rerun this Action, or retry unchanged."):this.tr("workCenter.actionInputContinueHint","Direct intervention for this Action only.")},canSend(){return!this.uploading&&!this.sending&&(!!this.composerText.trim()||this.composerAttachments.length>0)},hasMessages(){return this.messages.length>0},hasActionBrief(){return!!this.action?.brief?.approach||!!this.action?.brief?.expectedOutcome||!!this.action?.dependsOnStageIds?.length||!!this.action?.canonicalResult?.summary},waitingQuestion(){return this.action?.status!=="waiting"?"":String(this.action?.canonicalResult?.waitingReason||"").trim()},composerDescriptionIds(){return[this.waitingQuestion?"work-center-action-waiting-question":null,"work-center-action-composer-hint"].filter(Boolean).join(" ")},currentGenerationRequests(){let e=Math.max(1,Number(this.action?.generation)||1);return this.requests.filter(t=>Math.max(1,Number(t?.generation)||1)===e).slice().sort((t,s)=>(Number(s?.attempt)||0)-(Number(t?.attempt)||0)||(Number(s?.openedAt)||0)-(Number(t?.openedAt)||0)||String(s?.id||"").localeCompare(String(t?.id||"")))}},watch:{"action.id"(){this.resetActionView()},"action.generation"(e,t){let s=Math.max(1,Number(e)||1),n=Math.max(1,Number(t)||1);s!==n&&this.resetActionView()},composerText(e){e||this.$nextTick(()=>this.resizeComposerInput(this.$refs.composerInput,!0))},messages:{deep:!0,handler(){this.$nextTick(()=>Ye(this.$el))}},requests(){this.activeView!=="execution"||this.requestSelectionTouched||this.$nextTick(()=>this.syncLatestRequest())}},mounted(){this.$nextTick(()=>Ye(this.$el))},methods:{tr(e,t){let s=this.$t?this.$t(e):e;return s&&s!==e?s:t},statusLabel(e){return this.tr(`workCenter.status.${e}`,String(e||"").replace("_"," "))},messageSpeaker(e){return e?.role==="user"?this.tr("workCenter.you","You"):e?.speaker?.name||e?.speaker?.id||this.executorName},time(e){if(!e)return"";try{return new Date(Number(e)).toLocaleString()}catch{return""}},formatCount(e){return new Intl.NumberFormat().format(Math.max(0,Number(e)||0))},formatTokens(e){let t=Math.max(0,Number(e)||0);return t>=1e6?`${(t/1e6).toFixed(1)}m`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)},formatDuration(e){let t=Math.max(0,Number(e)||0);return t<1e3?`${t}ms`:`${(t/1e3).toFixed(t<1e4?1:0)}s`},formatAttachmentSize(e){let t=Math.max(0,Number(e)||0);return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`},messageHtml(e){return Di(String(e||""))},json(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}},requestKey(e){return cs(e)},requestLoopKey(e,t){return af(e,t)},requestDetail(e){let t=this.requestDetails[this.requestKey(e)]||null;return t?.request||t},resetActionView(){this.activeView="conversation",this.conversationScrollTop=0,this.expandedRequestKey=null,this.requestSelectionTouched=!1,this.$nextTick(()=>{this.$refs.conversationPanel&&(this.$refs.conversationPanel.scrollTop=0),Ye(this.$el)})},tabId(e){return`work-center-action-${e}-tab`},panelId(e){return`work-center-action-${e}-panel`},onTabKeydown(e,t){let s=["conversation","execution"],n=s.indexOf(t);if(n<0)return;let i;if(e.key==="ArrowRight")i=(n+1)%s.length;else if(e.key==="ArrowLeft")i=(n-1+s.length)%s.length;else if(e.key==="Home")i=0;else if(e.key==="End")i=s.length-1;else return;e.preventDefault();let r=s[i];this.setActiveView(r),this.$nextTick(()=>this.$refs[`${r}Tab`]?.focus())},async openRun(e){let t=this.action?.id,s=this.action?.generation,n=await new Promise(i=>this.$emit("open-run",e,i));!n||this.action?.id!==t||this.action?.generation!==s||(this.activeView="execution",this.requestSelectionTouched=!0,this.expandedRequestKey=this.requestKey(n),await this.$nextTick(),this.$refs.requestsPanel?.scrollIntoView?.({behavior:"smooth",block:"start"}))},setActiveView(e){e!==this.activeView&&(this.activeView==="conversation"&&(this.conversationScrollTop=this.$refs.conversationPanel?.scrollTop||0),this.activeView=e,e==="execution"&&(this.refreshRequests(),this.$nextTick(()=>this.syncLatestRequest())),this.$nextTick(()=>{e==="conversation"&&this.$refs.conversationPanel&&(this.$refs.conversationPanel.scrollTop=this.conversationScrollTop),Ye(this.$el)}))},async toggleRequest(e){let t=this.requestKey(e);if(this.requestSelectionTouched=!0,this.expandedRequestKey===t){this.expandedRequestKey=null;return}this.expandedRequestKey=t,this.requestDetail(e)||this.$emit("select-request",e)},syncLatestRequest(){if(this.requestSelectionTouched)return;let e=this.currentGenerationRequests[0];if(!e){this.expandedRequestKey=null;return}let t=this.requestKey(e);this.expandedRequestKey!==t&&(this.expandedRequestKey=t,this.requestDetail(e)||this.$emit("select-request",e))},toolHasDetail(e){return e?.input!=null||e?.output!=null},resizeComposerInput(e,t=!1){if(!e)return;e.style.height="auto";let s=t?24:Math.min(e.scrollHeight,144);e.style.height=`${s}px`,e.style.overflowY=e.scrollHeight>144?"auto":"hidden"},onComposerInput(e){this.$emit("update:composerText",e.target.value),this.resizeComposerInput(e.target,!e.target.value)},onComposerKeydown(e){e.key!=="Enter"||e.shiftKey||e.isComposing||(e.preventDefault(),this.canSend&&this.$emit("send"))},refreshRequests(){this.$emit("refresh-requests")}},template:`
5019
5017
  <section class="work-center-action-detail-pane" v-if="action">
5020
5018
  <header class="work-center-action-detail-header">
5021
5019
  <div class="work-center-action-header-copy">
@@ -5190,7 +5188,7 @@ ${String(e||"").trim()}
5190
5188
  </footer>
5191
5189
  </section>
5192
5190
  <section v-else class="work-center-action-detail-pane work-center-detail-empty"><strong>{{ tr('workCenter.selectAction', 'Select an Action to inspect its execution') }}</strong></section>
5193
- `}});function Ca(e){return JSON.parse(JSON.stringify(e))}function wv(e,t=[]){return{mode:"auto",capability:e,candidateVpIds:[],fixedVpId:null,separateFromStageTypes:t}}function or(e,t,s,n={}){return{id:e,name:t,type:s,instruction:"",assignmentPolicy:wv(s,n.separateFromStageTypes),modelPolicy:{mode:"inherit",model:null,effort:null},maxAttempts:2,...n.changesRequestedStageId?{changesRequestedStageId:n.changesRequestedStageId}:{}}}function Sa(){return{version:1,revision:1,defaultWorkflowId:"software-change",startImmediately:!0,maxConcurrentActions:3,defaultWorkDir:"",globalInstructions:"",modelPolicy:{mode:"inherit",model:null,effort:null},coordinatorModelPolicy:{mode:"inherit",model:null,effort:"high"},actionModelPolicies:Object.fromEntries(ds.map(e=>[e,{mode:"inherit",model:null,effort:["triage","research","design","diagnose","review"].includes(e)?"high":"medium"}])),actionInstructions:Object.fromEntries(ds.map(e=>[e,""])),workflows:[{version:1,id:"software-change",name:"Software change",stages:[or("triage","Triage","triage"),or("implement","Implement","implement"),or("review","Review","review",{separateFromStageTypes:["implement"],changesRequestedStageId:"implement"}),or("deliver","Deliver","deliver")]}]}}function lr(e){return!e||typeof e!="object"||Array.isArray(e)||!e.modelPolicy||typeof e.modelPolicy!="object"||Array.isArray(e.modelPolicy)||!e.coordinatorModelPolicy||typeof e.coordinatorModelPolicy!="object"||Array.isArray(e.coordinatorModelPolicy)||typeof e.globalInstructions!="string"||!e.actionInstructions||typeof e.actionInstructions!="object"||Array.isArray(e.actionInstructions)||!e.actionModelPolicies||typeof e.actionModelPolicies!="object"||Array.isArray(e.actionModelPolicies)?!1:ds.every(t=>typeof e.actionInstructions[t]=="string")}function kv(e,t){return lr(e)&&Number.isInteger(e.revision)&&Number.isInteger(t)&&e.revision>t}function ar(e,t={}){let s=e&&typeof e=="object"&&!Array.isArray(e)?Ca(e):{},n=Array.isArray(s.workflows)&&s.workflows.length>0?s.workflows:Sa().workflows,i=n.find(c=>c?.id===s.defaultWorkflowId)||n[0]||null,r=Array.isArray(i?.stages)?i.stages:[],o=Object.fromEntries(r.filter(c=>ds.includes(c?.type)&&typeof c.instruction=="string").map(c=>[c.type,c.instruction])),a=s.actionInstructions&&typeof s.actionInstructions=="object"&&!Array.isArray(s.actionInstructions)?s.actionInstructions:{},l=r.find(c=>c?.type==="triage")?.modelPolicy||r[0]?.modelPolicy;return{...Sa(),...s,modelPolicy:{mode:"inherit",model:null,effort:null,...l||{},...s.modelPolicy||{}},coordinatorModelPolicy:{mode:"inherit",model:null,effort:"high",...s.coordinatorModelPolicy||{}},actionModelPolicies:Object.fromEntries(ds.map(c=>[c,{...Sa().actionModelPolicies[c],...s.actionModelPolicies?.[c]||{}}])),actionInstructions:Object.fromEntries(ds.map(c=>[c,typeof a[c]=="string"?a[c]:o[c]||t[c]||""])),workflows:n}}function Sv(e){let t=e?.message||String(e);return/^Unsupported Work Center operation:\s*get_settings$/i.test(t.trim())}var ds,df,uf=H(()=>{ls();ds=["triage","research","design","diagnose","implement","migrate","test","review","integrate","document","operate","deliver","write","custom"];df={name:"WorkCenterSettingsModal",emits:["close","saved","open-agent-models"],props:{agentId:{type:String,required:!0}},data(){return{section:"workflow",draft:null,loading:!0,saving:!1,error:"",conflict:!1,settingsUnsupported:!1,draftAgentId:null,loadGeneration:0}},computed:{store(){return Pinia.useChatStore()},runtime(){return this.store.workCenterRuntimeByAgent[this.agentId]||{}},vps(){return Array.isArray(this.runtime.vps)?this.runtime.vps:[]},models(){return Array.isArray(this.runtime.models)?this.runtime.models:[]},workflows(){return Array.isArray(this.draft?.workflows)?this.draft.workflows:[]},actionTypes(){return ds},defaultWorkflow(){return this.workflows.find(e=>e.id===this.draft?.defaultWorkflowId)||this.workflows[0]||null},defaultStageInstructions(){return this.runtime.defaultStageInstructions||{}},sections(){return[{id:"workflow",label:this.$t("workCenter.settings.workflow")},{id:"models",label:this.$t("workCenter.settings.models")}]}},watch:{runtime:{deep:!0,handler(){this.normalizeDraftEffort()}}},async mounted(){window.addEventListener("keydown",this.onKeydown);let e=this.store.workCenterSettingsByAgent[this.agentId];e&&(this.draft=ar(e,this.defaultStageInstructions),this.normalizeDraftEffort(),this.draftAgentId=this.agentId,this.settingsUnsupported=!lr(e),this.settingsUnsupported&&(this.error=this.$t("workCenter.settings.upgradeRequired")),this.loading=!1),await this.load()},beforeUnmount(){window.removeEventListener("keydown",this.onKeydown)},methods:{trackOverlayPointerDown:rt,trackOverlayPointerUp:ot,clearOverlayPointerGesture:at,async load(){let e=this.agentId,t=++this.loadGeneration;this.loading=!0,this.error=this.settingsUnsupported&&this.draft?this.$t("workCenter.settings.upgradeRequired"):"";try{let s=await this.store.loadWorkCenterSettings(e);if(t!==this.loadGeneration||e!==this.agentId)return;this.draft=ar(s.settings,this.defaultStageInstructions),this.normalizeDraftEffort(),this.draftAgentId=e,this.conflict=!1,this.settingsUnsupported=!lr(s.settings),this.error=this.settingsUnsupported?this.$t("workCenter.settings.upgradeRequired"):""}catch(s){if(t!==this.loadGeneration||e!==this.agentId)return;Sv(s)?(this.draft=ar(null,this.defaultStageInstructions),this.draftAgentId=e,this.settingsUnsupported=!0,this.error=this.$t("workCenter.settings.upgradeRequired")):this.error=s?.message||String(s)}finally{t===this.loadGeneration&&e===this.agentId&&(this.loading=!1)}},onKeydown(e){e.key==="Escape"&&!this.saving&&this.$emit("close")},onOverlayClick(e){Ze(e)&&this.close()},close(){this.saving||this.$emit("close")},vpLabel(e){return this.$i18n?.locale==="zh-CN"&&e.nameZh?e.nameZh:e.name||e.id},setAssignmentMode(e,t){e.assignmentPolicy.mode=t,t==="fixed"&&!e.assignmentPolicy.fixedVpId&&(e.assignmentPolicy.fixedVpId=this.vps[0]?.id||null),t==="pool"&&e.assignmentPolicy.candidateVpIds.length===0&&this.vps[0]&&(e.assignmentPolicy.candidateVpIds=[this.vps[0].id])},addWorkflow(){let e=this.workflows.length+1,t=this.defaultWorkflow||this.workflows[0],s=t?Ca(t):{version:1,stages:[]};s.id=`workflow-${Date.now()}`,s.name=this.$t("workCenter.settings.newWorkflow",{index:e}),this.draft.workflows.push(s),this.draft.defaultWorkflowId=s.id},removeWorkflow(){this.workflows.length<=1||!this.defaultWorkflow||(this.draft.workflows=this.workflows.filter(e=>e.id!==this.defaultWorkflow.id),this.draft.defaultWorkflowId=this.draft.workflows[0].id)},addStage(){if(!this.defaultWorkflow)return;let e=`stage-${Date.now()}`;this.defaultWorkflow.stages.push({id:e,name:this.$t("workCenter.settings.newStage"),type:"custom",instruction:this.defaultStageInstructions.custom||"",assignmentPolicy:{mode:"auto",capability:"custom",candidateVpIds:[],fixedVpId:null,separateFromStageTypes:[]},modelPolicy:{mode:"inherit",model:null,effort:null},maxAttempts:2})},moveStage(e,t){let s=this.defaultWorkflow?.stages,n=e+t;if(!s||n<0||n>=s.length)return;let[i]=s.splice(e,1);s.splice(n,0,i)},reviewReturnCandidates(e){let t=this.defaultWorkflow?.stages||[],s=t.findIndex(n=>n.id===e.id);return s<=0?[]:t.slice(0,s).filter(n=>n.type!=="review"&&n.type!=="deliver")},canRemoveStage(e){let t=this.defaultWorkflow?.stages;if(!t||t.length<=1)return!1;let s=t[e],n=t.filter((i,r)=>r!==e);return n.every((i,r)=>i.type!=="review"||i.changesRequestedStageId!==s.id?!0:n.slice(0,r).some(o=>o.type!=="review"&&o.type!=="deliver"))},removeStage(e){let t=this.defaultWorkflow?.stages;if(!t||!this.canRemoveStage(e))return!1;let[s]=t.splice(e,1);for(let[n,i]of t.entries()){if(i.type!=="review"||i.changesRequestedStageId!==s.id)continue;let r=t.slice(0,n).filter(o=>o.type!=="review"&&o.type!=="deliver");i.changesRequestedStageId=r.at(-1).id}return!0},toggleCandidate(e,t,s){let n=new Set(e.assignmentPolicy.candidateVpIds||[]);s?n.add(t):n.delete(t),e.assignmentPolicy.candidateVpIds=[...n]},defaultInstructionForStage(e){return this.defaultStageInstructions[e.type]||this.defaultStageInstructions.custom||""},resetStageInstruction(e){e.instruction=this.defaultInstructionForStage(e)},setStageType(e,t){let s=this.defaultInstructionForStage(e),n=!e.instruction||e.instruction===s;e.type=t,n&&this.resetStageInstruction(e)},modelRefForStage(e){return e.modelPolicy.mode==="specific"?e.modelPolicy.model:e.modelPolicy.mode==="primary"?this.runtime.primaryModel||null:e.modelPolicy.mode==="fast"&&this.runtime.fastModel||null},modelForStage(e){let t=this.modelRefForStage(e);return t&&this.models.find(s=>(s.ref||s.id)===t)||null},effortOptionsForStage(e){let t=this.modelForStage(e);return t?Array.isArray(t.effortOptions)?t.effortOptions:[]:e.modelPolicy.mode==="inherit"?[...new Set(this.models.flatMap(s=>Array.isArray(s.effortOptions)?s.effortOptions:[]))]:[]},effortHelpKeyForStage(e){return this.modelRefForStage(e)?this.effortOptionsForStage(e).length===0?"workCenter.settings.effortUnsupportedHelp":"workCenter.settings.effortHelp":"workCenter.settings.effortChooseModelHelp"},normalizeStageEffort(e){let t=this.effortOptionsForStage(e);!e.modelPolicy.effort||t.includes(e.modelPolicy.effort)||(e.modelPolicy.effort=null)},normalizeDraftEffort(){if(!(!this.draft?.modelPolicy||!Array.isArray(this.runtime?.models))){this.normalizeStageEffort({modelPolicy:this.draft.modelPolicy}),this.normalizeStageEffort({modelPolicy:this.draft.coordinatorModelPolicy});for(let e of Object.values(this.draft.actionModelPolicies||{}))this.normalizeStageEffort({modelPolicy:e})}},setModelMode(e,t){e.modelPolicy.mode=t,t==="specific"&&!e.modelPolicy.model&&(e.modelPolicy.model=this.models[0]?.ref||this.models[0]?.id||null),this.normalizeStageEffort(e)},setStageModel(e,t){e.modelPolicy.model=t||null,this.normalizeStageEffort(e)},async save(){if(!this.draft||this.saving||this.settingsUnsupported)return;let e=this.agentId;if(this.draftAgentId!==e){this.conflict=!0,this.error=this.$t("workCenter.settings.conflict");return}this.saving=!0,this.error="",this.conflict=!1;try{this.normalizeDraftEffort();let t=Ca(this.draft),s=await this.store.saveWorkCenterSettings(t,e);if(e!==this.agentId||this.draftAgentId!==e)return;if(!kv(s.settings,t.revision)){this.settingsUnsupported=!lr(s.settings),this.error=this.$t(this.settingsUnsupported?"workCenter.settings.upgradeRequired":"workCenter.settings.saveNotConfirmed");return}this.draft=ar(s.settings,this.defaultStageInstructions),this.$emit("saved",s.settings),this.$emit("close")}catch(t){if(e!==this.agentId)return;let s=t?.message||String(t);this.conflict=/changed elsewhere|reload before saving/i.test(s),this.error=this.conflict?this.$t("workCenter.settings.conflict"):s}finally{e===this.agentId&&(this.saving=!1)}}},template:`
5191
+ `}});function Ca(e){return JSON.parse(JSON.stringify(e))}function bv(e,t=[]){return{mode:"auto",capability:e,candidateVpIds:[],fixedVpId:null,separateFromStageTypes:t}}function or(e,t,s,n={}){return{id:e,name:t,type:s,instruction:"",assignmentPolicy:bv(s,n.separateFromStageTypes),modelPolicy:{mode:"inherit",model:null,effort:null},maxAttempts:2,...n.changesRequestedStageId?{changesRequestedStageId:n.changesRequestedStageId}:{}}}function Sa(){return{version:1,revision:1,defaultWorkflowId:"software-change",startImmediately:!0,maxConcurrentActions:3,defaultWorkDir:"",globalInstructions:"",modelPolicy:{mode:"inherit",model:null,effort:null},coordinatorModelPolicy:{mode:"inherit",model:null,effort:"high"},actionModelPolicies:Object.fromEntries(ds.map(e=>[e,{mode:"inherit",model:null,effort:["triage","research","design","diagnose","review"].includes(e)?"high":"medium"}])),actionInstructions:Object.fromEntries(ds.map(e=>[e,""])),workflows:[{version:1,id:"software-change",name:"Software change",stages:[or("triage","Triage","triage"),or("implement","Implement","implement"),or("review","Review","review",{separateFromStageTypes:["implement"],changesRequestedStageId:"implement"}),or("deliver","Deliver","deliver")]}]}}function lr(e){return!e||typeof e!="object"||Array.isArray(e)||!e.modelPolicy||typeof e.modelPolicy!="object"||Array.isArray(e.modelPolicy)||!e.coordinatorModelPolicy||typeof e.coordinatorModelPolicy!="object"||Array.isArray(e.coordinatorModelPolicy)||typeof e.globalInstructions!="string"||!e.actionInstructions||typeof e.actionInstructions!="object"||Array.isArray(e.actionInstructions)||!e.actionModelPolicies||typeof e.actionModelPolicies!="object"||Array.isArray(e.actionModelPolicies)?!1:ds.every(t=>typeof e.actionInstructions[t]=="string")}function wv(e,t){return lr(e)&&Number.isInteger(e.revision)&&Number.isInteger(t)&&e.revision>t}function ar(e,t={}){let s=e&&typeof e=="object"&&!Array.isArray(e)?Ca(e):{},n=Array.isArray(s.workflows)&&s.workflows.length>0?s.workflows:Sa().workflows,i=n.find(c=>c?.id===s.defaultWorkflowId)||n[0]||null,r=Array.isArray(i?.stages)?i.stages:[],o=Object.fromEntries(r.filter(c=>ds.includes(c?.type)&&typeof c.instruction=="string").map(c=>[c.type,c.instruction])),a=s.actionInstructions&&typeof s.actionInstructions=="object"&&!Array.isArray(s.actionInstructions)?s.actionInstructions:{},l=r.find(c=>c?.type==="triage")?.modelPolicy||r[0]?.modelPolicy;return{...Sa(),...s,modelPolicy:{mode:"inherit",model:null,effort:null,...l||{},...s.modelPolicy||{}},coordinatorModelPolicy:{mode:"inherit",model:null,effort:"high",...s.coordinatorModelPolicy||{}},actionModelPolicies:Object.fromEntries(ds.map(c=>[c,{...Sa().actionModelPolicies[c],...s.actionModelPolicies?.[c]||{}}])),actionInstructions:Object.fromEntries(ds.map(c=>[c,typeof a[c]=="string"?a[c]:o[c]||t[c]||""])),workflows:n}}function kv(e){let t=e?.message||String(e);return/^Unsupported Work Center operation:\s*get_settings$/i.test(t.trim())}var ds,df,uf=H(()=>{ls();ds=["triage","research","design","diagnose","implement","migrate","test","review","integrate","document","operate","deliver","write","custom"];df={name:"WorkCenterSettingsModal",emits:["close","saved","open-agent-models"],props:{agentId:{type:String,required:!0}},data(){return{section:"workflow",draft:null,loading:!0,saving:!1,error:"",conflict:!1,settingsUnsupported:!1,draftAgentId:null,loadGeneration:0}},computed:{store(){return Pinia.useChatStore()},runtime(){return this.store.workCenterRuntimeByAgent[this.agentId]||{}},vps(){return Array.isArray(this.runtime.vps)?this.runtime.vps:[]},models(){return Array.isArray(this.runtime.models)?this.runtime.models:[]},workflows(){return Array.isArray(this.draft?.workflows)?this.draft.workflows:[]},actionTypes(){return ds},defaultWorkflow(){return this.workflows.find(e=>e.id===this.draft?.defaultWorkflowId)||this.workflows[0]||null},defaultStageInstructions(){return this.runtime.defaultStageInstructions||{}},sections(){return[{id:"workflow",label:this.$t("workCenter.settings.workflow")},{id:"models",label:this.$t("workCenter.settings.models")}]}},watch:{runtime:{deep:!0,handler(){this.normalizeDraftEffort()}}},async mounted(){window.addEventListener("keydown",this.onKeydown);let e=this.store.workCenterSettingsByAgent[this.agentId];e&&(this.draft=ar(e,this.defaultStageInstructions),this.normalizeDraftEffort(),this.draftAgentId=this.agentId,this.settingsUnsupported=!lr(e),this.settingsUnsupported&&(this.error=this.$t("workCenter.settings.upgradeRequired")),this.loading=!1),await this.load()},beforeUnmount(){window.removeEventListener("keydown",this.onKeydown)},methods:{trackOverlayPointerDown:rt,trackOverlayPointerUp:ot,clearOverlayPointerGesture:at,async load(){let e=this.agentId,t=++this.loadGeneration;this.loading=!0,this.error=this.settingsUnsupported&&this.draft?this.$t("workCenter.settings.upgradeRequired"):"";try{let s=await this.store.loadWorkCenterSettings(e);if(t!==this.loadGeneration||e!==this.agentId)return;this.draft=ar(s.settings,this.defaultStageInstructions),this.normalizeDraftEffort(),this.draftAgentId=e,this.conflict=!1,this.settingsUnsupported=!lr(s.settings),this.error=this.settingsUnsupported?this.$t("workCenter.settings.upgradeRequired"):""}catch(s){if(t!==this.loadGeneration||e!==this.agentId)return;kv(s)?(this.draft=ar(null,this.defaultStageInstructions),this.draftAgentId=e,this.settingsUnsupported=!0,this.error=this.$t("workCenter.settings.upgradeRequired")):this.error=s?.message||String(s)}finally{t===this.loadGeneration&&e===this.agentId&&(this.loading=!1)}},onKeydown(e){e.key==="Escape"&&!this.saving&&this.$emit("close")},onOverlayClick(e){Ze(e)&&this.close()},close(){this.saving||this.$emit("close")},vpLabel(e){return this.$i18n?.locale==="zh-CN"&&e.nameZh?e.nameZh:e.name||e.id},setAssignmentMode(e,t){e.assignmentPolicy.mode=t,t==="fixed"&&!e.assignmentPolicy.fixedVpId&&(e.assignmentPolicy.fixedVpId=this.vps[0]?.id||null),t==="pool"&&e.assignmentPolicy.candidateVpIds.length===0&&this.vps[0]&&(e.assignmentPolicy.candidateVpIds=[this.vps[0].id])},addWorkflow(){let e=this.workflows.length+1,t=this.defaultWorkflow||this.workflows[0],s=t?Ca(t):{version:1,stages:[]};s.id=`workflow-${Date.now()}`,s.name=this.$t("workCenter.settings.newWorkflow",{index:e}),this.draft.workflows.push(s),this.draft.defaultWorkflowId=s.id},removeWorkflow(){this.workflows.length<=1||!this.defaultWorkflow||(this.draft.workflows=this.workflows.filter(e=>e.id!==this.defaultWorkflow.id),this.draft.defaultWorkflowId=this.draft.workflows[0].id)},addStage(){if(!this.defaultWorkflow)return;let e=`stage-${Date.now()}`;this.defaultWorkflow.stages.push({id:e,name:this.$t("workCenter.settings.newStage"),type:"custom",instruction:this.defaultStageInstructions.custom||"",assignmentPolicy:{mode:"auto",capability:"custom",candidateVpIds:[],fixedVpId:null,separateFromStageTypes:[]},modelPolicy:{mode:"inherit",model:null,effort:null},maxAttempts:2})},moveStage(e,t){let s=this.defaultWorkflow?.stages,n=e+t;if(!s||n<0||n>=s.length)return;let[i]=s.splice(e,1);s.splice(n,0,i)},reviewReturnCandidates(e){let t=this.defaultWorkflow?.stages||[],s=t.findIndex(n=>n.id===e.id);return s<=0?[]:t.slice(0,s).filter(n=>n.type!=="review"&&n.type!=="deliver")},canRemoveStage(e){let t=this.defaultWorkflow?.stages;if(!t||t.length<=1)return!1;let s=t[e],n=t.filter((i,r)=>r!==e);return n.every((i,r)=>i.type!=="review"||i.changesRequestedStageId!==s.id?!0:n.slice(0,r).some(o=>o.type!=="review"&&o.type!=="deliver"))},removeStage(e){let t=this.defaultWorkflow?.stages;if(!t||!this.canRemoveStage(e))return!1;let[s]=t.splice(e,1);for(let[n,i]of t.entries()){if(i.type!=="review"||i.changesRequestedStageId!==s.id)continue;let r=t.slice(0,n).filter(o=>o.type!=="review"&&o.type!=="deliver");i.changesRequestedStageId=r.at(-1).id}return!0},toggleCandidate(e,t,s){let n=new Set(e.assignmentPolicy.candidateVpIds||[]);s?n.add(t):n.delete(t),e.assignmentPolicy.candidateVpIds=[...n]},defaultInstructionForStage(e){return this.defaultStageInstructions[e.type]||this.defaultStageInstructions.custom||""},resetStageInstruction(e){e.instruction=this.defaultInstructionForStage(e)},setStageType(e,t){let s=this.defaultInstructionForStage(e),n=!e.instruction||e.instruction===s;e.type=t,n&&this.resetStageInstruction(e)},modelRefForStage(e){return e.modelPolicy.mode==="specific"?e.modelPolicy.model:e.modelPolicy.mode==="primary"?this.runtime.primaryModel||null:e.modelPolicy.mode==="fast"&&this.runtime.fastModel||null},modelForStage(e){let t=this.modelRefForStage(e);return t&&this.models.find(s=>(s.ref||s.id)===t)||null},effortOptionsForStage(e){let t=this.modelForStage(e);return t?Array.isArray(t.effortOptions)?t.effortOptions:[]:e.modelPolicy.mode==="inherit"?[...new Set(this.models.flatMap(s=>Array.isArray(s.effortOptions)?s.effortOptions:[]))]:[]},effortHelpKeyForStage(e){return this.modelRefForStage(e)?this.effortOptionsForStage(e).length===0?"workCenter.settings.effortUnsupportedHelp":"workCenter.settings.effortHelp":"workCenter.settings.effortChooseModelHelp"},normalizeStageEffort(e){let t=this.effortOptionsForStage(e);!e.modelPolicy.effort||t.includes(e.modelPolicy.effort)||(e.modelPolicy.effort=null)},normalizeDraftEffort(){if(!(!this.draft?.modelPolicy||!Array.isArray(this.runtime?.models))){this.normalizeStageEffort({modelPolicy:this.draft.modelPolicy}),this.normalizeStageEffort({modelPolicy:this.draft.coordinatorModelPolicy});for(let e of Object.values(this.draft.actionModelPolicies||{}))this.normalizeStageEffort({modelPolicy:e})}},setModelMode(e,t){e.modelPolicy.mode=t,t==="specific"&&!e.modelPolicy.model&&(e.modelPolicy.model=this.models[0]?.ref||this.models[0]?.id||null),this.normalizeStageEffort(e)},setStageModel(e,t){e.modelPolicy.model=t||null,this.normalizeStageEffort(e)},async save(){if(!this.draft||this.saving||this.settingsUnsupported)return;let e=this.agentId;if(this.draftAgentId!==e){this.conflict=!0,this.error=this.$t("workCenter.settings.conflict");return}this.saving=!0,this.error="",this.conflict=!1;try{this.normalizeDraftEffort();let t=Ca(this.draft),s=await this.store.saveWorkCenterSettings(t,e);if(e!==this.agentId||this.draftAgentId!==e)return;if(!wv(s.settings,t.revision)){this.settingsUnsupported=!lr(s.settings),this.error=this.$t(this.settingsUnsupported?"workCenter.settings.upgradeRequired":"workCenter.settings.saveNotConfirmed");return}this.draft=ar(s.settings,this.defaultStageInstructions),this.$emit("saved",s.settings),this.$emit("close")}catch(t){if(e!==this.agentId)return;let s=t?.message||String(t);this.conflict=/changed elsewhere|reload before saving/i.test(s),this.error=this.conflict?this.$t("workCenter.settings.conflict"):s}finally{e===this.agentId&&(this.saving=!1)}}},template:`
5194
5192
  <Teleport to="body">
5195
5193
  <div
5196
5194
  class="modal-overlay work-center-settings-overlay"
@@ -5344,7 +5342,7 @@ ${String(e||"").trim()}
5344
5342
  </section>
5345
5343
  </div>
5346
5344
  </Teleport>
5347
- `}});var Ia,pf=H(()=>{Ia={anthropic:["claude-opus-4-8","claude-opus-4.8","claude-sonnet-4-20250514","claude-opus-4-20250514","claude-haiku-3-20250414"],openai:["gpt-5","gpt-4.1","gpt-4.1-mini","o3","o4-mini"],"openai-responses":["gpt-5","gpt-5-mini","gpt-5-nano","gpt-5-pro"]}});function Cv(e){if(typeof e!="string"||!e)return null;let t=e.toLowerCase();return t.startsWith("claude")||t.includes("/claude")||t.includes(".claude")?"anthropic":/^(gpt-|o1|o3|o4|chatgpt-|codex-|omni-)/.test(t)?"openai-responses":null}var ff,gf=H(()=>{ls();ff={name:"ProviderPresetPicker",emits:["close","pick"],template:`
5345
+ `}});var Ia,pf=H(()=>{Ia={anthropic:["claude-opus-4-8","claude-opus-4.8","claude-sonnet-4-20250514","claude-opus-4-20250514","claude-haiku-3-20250414"],openai:["gpt-5","gpt-4.1","gpt-4.1-mini","o3","o4-mini"],"openai-responses":["gpt-5","gpt-5-mini","gpt-5-nano","gpt-5-pro"]}});function Sv(e){if(typeof e!="string"||!e)return null;let t=e.toLowerCase();return t.startsWith("claude")||t.includes("/claude")||t.includes(".claude")?"anthropic":/^(gpt-|o1|o3|o4|chatgpt-|codex-|omni-)/.test(t)?"openai-responses":null}var ff,gf=H(()=>{ls();ff={name:"ProviderPresetPicker",emits:["close","pick"],template:`
5348
5346
  <div
5349
5347
  class="llm-preset-modal-backdrop"
5350
5348
  @pointerdown="trackOverlayPointerDown"
@@ -5424,7 +5422,7 @@ ${String(e||"").trim()}
5424
5422
  </div>
5425
5423
  </div>
5426
5424
  </div>
5427
- `,data(){return{loading:!1,error:null,registry:{},fetchedAt:0,providerFilter:"",modelFilter:"",selectedProviderId:null,selectedModels:new Set}},computed:{chatStore(){return Pinia.useChatStore()},providerIds(){return Object.keys(this.registry).sort()},filteredProviderIds(){let e=this.providerFilter.trim().toLowerCase();return e?this.providerIds.filter(t=>t.toLowerCase().includes(e)||(this.providerName(t)||"").toLowerCase().includes(e)):this.providerIds},selectedProviderModels(){let e=this.registry[this.selectedProviderId];return!e||typeof e.models!="object"?[]:Object.keys(e.models).sort()},filteredModelIds(){let e=this.modelFilter.trim().toLowerCase(),t=this.selectedProviderModels;return e?t.filter(s=>s.toLowerCase().includes(e)):t},fetchedAtLabel(){if(!this.fetchedAt)return null;let e=Math.max(0,Math.floor((Date.now()-this.fetchedAt)/6e4));return this.$t("settings.llm.preset.fetchedAt",{minutes:e})}},async mounted(){await this.load(!1)},methods:{trackOverlayPointerDown:rt,trackOverlayPointerUp:ot,clearOverlayPointerGesture:at,onOverlayClick(e){Ze(e)&&this.$emit("close")},async load(e){this.loading=!0,this.error=null;try{let t=await this.chatStore.loadModelsDevRegistry({forceRefresh:e});this.registry=t?.registry||{},this.fetchedAt=t?.fetchedAt||0,t?.error&&(this.error=t.error)}catch(t){this.error=t?.message||String(t)}finally{this.loading=!1}},refresh(){this.load(!0)},providerName(e){return this.registry[e]?.name||e},providerModelCount(e){let t=this.registry[e]?.models;return t&&typeof t=="object"?Object.keys(t).length:0},selectProvider(e){this.selectedProviderId!==e&&(this.selectedProviderId=e,this.selectedModels=new Set,this.modelFilter="")},toggleModel(e){let t=new Set(this.selectedModels);t.has(e)?t.delete(e):t.add(e),this.selectedModels=t},selectAll(){this.selectedModels=new Set(this.filteredModelIds)},selectNone(){this.selectedModels=new Set},confirm(){if(!this.selectedProviderId||this.selectedModels.size===0)return;let e=this.registry[this.selectedProviderId]||{},t=Array.from(this.selectedModels).map(s=>{let n=Cv(s);return n?{id:s,protocol:n}:s});this.$emit("pick",{name:this.selectedProviderId,baseUrl:e.api||"",protocol:"",models:t})}}}});var cr,Aa=H(()=>{pf();gf();cr={name:"LlmTab",components:{ProviderPresetPicker:ff},props:{context:{type:String,default:"chat"}},emits:["message","saved"],template:`
5425
+ `,data(){return{loading:!1,error:null,registry:{},fetchedAt:0,providerFilter:"",modelFilter:"",selectedProviderId:null,selectedModels:new Set}},computed:{chatStore(){return Pinia.useChatStore()},providerIds(){return Object.keys(this.registry).sort()},filteredProviderIds(){let e=this.providerFilter.trim().toLowerCase();return e?this.providerIds.filter(t=>t.toLowerCase().includes(e)||(this.providerName(t)||"").toLowerCase().includes(e)):this.providerIds},selectedProviderModels(){let e=this.registry[this.selectedProviderId];return!e||typeof e.models!="object"?[]:Object.keys(e.models).sort()},filteredModelIds(){let e=this.modelFilter.trim().toLowerCase(),t=this.selectedProviderModels;return e?t.filter(s=>s.toLowerCase().includes(e)):t},fetchedAtLabel(){if(!this.fetchedAt)return null;let e=Math.max(0,Math.floor((Date.now()-this.fetchedAt)/6e4));return this.$t("settings.llm.preset.fetchedAt",{minutes:e})}},async mounted(){await this.load(!1)},methods:{trackOverlayPointerDown:rt,trackOverlayPointerUp:ot,clearOverlayPointerGesture:at,onOverlayClick(e){Ze(e)&&this.$emit("close")},async load(e){this.loading=!0,this.error=null;try{let t=await this.chatStore.loadModelsDevRegistry({forceRefresh:e});this.registry=t?.registry||{},this.fetchedAt=t?.fetchedAt||0,t?.error&&(this.error=t.error)}catch(t){this.error=t?.message||String(t)}finally{this.loading=!1}},refresh(){this.load(!0)},providerName(e){return this.registry[e]?.name||e},providerModelCount(e){let t=this.registry[e]?.models;return t&&typeof t=="object"?Object.keys(t).length:0},selectProvider(e){this.selectedProviderId!==e&&(this.selectedProviderId=e,this.selectedModels=new Set,this.modelFilter="")},toggleModel(e){let t=new Set(this.selectedModels);t.has(e)?t.delete(e):t.add(e),this.selectedModels=t},selectAll(){this.selectedModels=new Set(this.filteredModelIds)},selectNone(){this.selectedModels=new Set},confirm(){if(!this.selectedProviderId||this.selectedModels.size===0)return;let e=this.registry[this.selectedProviderId]||{},t=Array.from(this.selectedModels).map(s=>{let n=Sv(s);return n?{id:s,protocol:n}:s});this.$emit("pick",{name:this.selectedProviderId,baseUrl:e.api||"",protocol:"",models:t})}}}});var cr,Aa=H(()=>{pf();gf();cr={name:"LlmTab",components:{ProviderPresetPicker:ff},props:{context:{type:String,default:"chat"}},emits:["message","saved"],template:`
5428
5426
  <div class="llm-tab">
5429
5427
  <!-- No agent selected -->
5430
5428
  <div v-if="!effectiveAgentId" class="sp-desc">
@@ -6576,7 +6574,7 @@ ${String(e||"").trim()}
6576
6574
  </div>
6577
6575
  </div>
6578
6576
  </div>
6579
- `,data(){return{showAgentDropdown:!1,showSettingsPanel:!1,restartingAgents:{},upgradingAgents:{},showConversationModal:!1,unifiedSessionCreateOpen:!1,unifiedSessionCreateProvider:"yeaft",convModalAgent:"",convModalWorkDir:"",convModalProvider:"claude-code",selectedResumeSession:null,historyLoaded:!1,windowWidth:window.innerWidth,folderPickerOpen:!1,folderPickerPath:"",folderPickerEntries:[],folderPickerLoading:!1,folderPickerSelected:"",folderPickerTarget:"",serverVersion:"",chatGroupCollapsed:!1,sidebarTab:"chat",editingChatId:null,editingChatName:"",activeSessionMenu:null}},computed:{store(){return Pinia.useChatStore()},providerOptions(){return[{value:"claude-code",label:this.$t("provider.claudeCode")},{value:"copilot",label:this.$t("provider.copilot")}]},agentOptions(){return this.store.agents.filter(e=>e.online).map(e=>({value:e.id,label:`${e.name}${e.latency?` (${e.latency}ms)`:""}`}))},canUseWorkbench(){let e=Me().role;return e==="admin"||e==="pro"},selectedConvModalAgentWorkDir(){return this.convModalAgent&&this.store.agents.find(t=>t.id===this.convModalAgent)?.workDir||""},onlineAgents(){return this.store.agents.filter(e=>e.online)},onlineAgentCount(){return this.onlineAgents.length},workCenterAgents(){return this.onlineAgents.filter(e=>Array.isArray(e.capabilities)&&e.capabilities.includes("work_center"))},isMobileView(){return this.windowWidth<=768},effectiveSidebarCollapsed(){return this.isMobileView?!this.store.sessionSidebarOpen:this.store.sidebarCollapsed},normalConversations(){return this.sortByActivity(this.store.conversations.filter(e=>e.agentOnline!==!1))},pinnedChatConversations(){let e=this.store.conversations.filter(t=>t.agentOnline!==!1&&this.store.isSessionPinned(t.id));return this.sortByActivity(e)},unpinnedChatConversations(){return this.sortByActivity(this.store.conversations.filter(e=>e.agentOnline!==!1&&!this.store.isSessionPinned(e.id)))},chatSessionCount(){return this.store.conversations.filter(e=>e.agentOnline!==!1).length}},methods:{onSidebarCollapse(){mf({isMobileView:this.isMobileView,showMobileSidebar:this.store.sessionSidebarOpen,closeMobileSidebar:()=>this.store.closeSessionSidebar(),toggleSidebar:()=>this.store.toggleSidebar()})},onModeFlip(e){e==="yeaft"?this.store.enterYeaft():this.store.leaveYeaft()},sortByActivity(e){return Cd(e)},isCatalogSessionUnread(e){return e?.runtimeProvider!=="yeaft"?!1:this.store.isYeaftSessionUnread(e.routeRef?.sessionId,e.routeRef?.agentId)},onUnifiedCreate(e="yeaft"){this.unifiedSessionCreateProvider=["yeaft","copilot","claude-code"].includes(e)?e:"yeaft",this.unifiedSessionCreateOpen=!0},openWorkCenter(e=null){let t=this.workCenterAgents.find(s=>s.id===e)||this.workCenterAgents.find(s=>s.id===this.store.workCenterAgentId)||this.workCenterAgents[0];t&&this.store.enterWorkCenter(t.id)},onUnifiedSessionAction({action:e,row:t,title:s,sessions:n}={}){if(!t?.routeRef)return;let{runtimeProvider:i,agentId:r,sessionId:o}=t.routeRef;e==="rename"?this.store.renameCatalogSession({row:t,title:s}):e==="reorder"?this.store.reorderCatalogSessions(n):e==="pin"?this.store.toggleCatalogSessionPin(t):e==="remove"&&i!=="yeaft"?confirm(this.$t("chat.delete.confirm"))&&this.closeSession(o,r):i==="yeaft"&&e==="remove"?this.store.sessionCrudRequest("archive",{sessionId:o},{agentId:r}):i==="yeaft"&&e==="settings"&&(this.store.pendingUnifiedSessionSettings={sessionId:o,agentId:r,section:"session"},this.store.openCatalogSession(t))},openConversationModal({preserveProvider:e=!1}={}){this.showConversationModal=!0,e||(this.convModalProvider="claude-code"),this.convModalAgent="",this.convModalWorkDir="",this.selectedResumeSession=null,this.historyLoaded=!1,this._foldersRetried=!1;let t=this.store.agents.filter(i=>i.online),n=t.find(i=>i.id===this.store.currentAgent)||t[0];n&&(this.convModalAgent=n.id,this.store.listFoldersForAgent(this.convModalAgent,this.convModalProvider).then(()=>{this.showConversationModal&&this.store.folders.length===0&&!this._foldersRetried&&(this._foldersRetried=!0,setTimeout(()=>{this.showConversationModal&&this.convModalAgent&&this.store.listFoldersForAgent(this.convModalAgent,this.convModalProvider)},1500))}))},openConversationModalResume(){this.openConversationModal()},closeConversationModal(){this.showConversationModal=!1,this.convModalAgent="",this.convModalWorkDir="",this.selectedResumeSession=null,this.historyLoaded=!1},onConvModalAgentChange(){this.convModalAgent&&(this.convModalWorkDir="",this.selectedResumeSession=null,this.historyLoaded=!1,this.store.listFoldersForAgent(this.convModalAgent,this.convModalProvider))},onConvModalProviderChange(){this.convModalWorkDir="",this.selectedResumeSession=null,this.historyLoaded=!1,this.convModalAgent&&this.store.listFoldersForAgent(this.convModalAgent,this.convModalProvider)},onConvModalWorkDirInput(){this.historyLoaded=!1,this.selectedResumeSession=null,this._workDirInputTimer&&clearTimeout(this._workDirInputTimer),this._workDirInputTimer=setTimeout(()=>{this.convModalWorkDir.trim()&&this.convModalAgent&&(this.store.listHistorySessionsForAgent(this.convModalAgent,this.convModalWorkDir.trim(),this.convModalProvider),this.historyLoaded=!0)},500)},selectConvModalFolder(e){this.convModalWorkDir=e,this.selectedResumeSession=null,this.convModalAgent&&(this.store.listHistorySessionsForAgent(this.convModalAgent,e,this.convModalProvider),this.historyLoaded=!0)},loadConvModalFolders(){this.convModalAgent&&this.store.listFoldersForAgent(this.convModalAgent,this.convModalProvider)},loadConvModalSessions(){this.convModalAgent&&this.convModalWorkDir.trim()&&(this.store.listHistorySessionsForAgent(this.convModalAgent,this.convModalWorkDir.trim(),this.convModalProvider),this.historyLoaded=!0)},toggleAgentDropdown(){this.showAgentDropdown=!this.showAgentDropdown,this.showAgentDropdown&&this.store.refreshAgents()},selectAgent(e){this.store.selectAgent(e),this.showAgentDropdown=!1},createNewConversation(){if(!this.convModalAgent)return;this.store.selectAgent(this.convModalAgent);let e=this.convModalWorkDir.trim()||this.selectedConvModalAgentWorkDir;this.store.createConversation(e,this.convModalAgent,null,this.buildConvOpts()),this.closeConversationModal()},buildConvOpts(){let e={provider:this.convModalProvider};return this.convModalProvider==="copilot"&&(e.providerOptions={allowAllTools:!0}),e},resumeSession(e){if(!this.convModalAgent)return;this.store.selectAgent(this.convModalAgent),this.store._pendingSessionTitle=e.title;let t=e.workDir||this.convModalWorkDir.trim()||this.selectedConvModalAgentWorkDir;this.store.resumeConversation(e.sessionId,t,this.convModalAgent,this.buildConvOpts()),this.closeConversationModal()},resumeSelectedSession(){if(!this.convModalAgent||!this.selectedResumeSession)return;this.store.selectAgent(this.convModalAgent),this.store._pendingSessionTitle=this.selectedResumeSession.title;let e=this.selectedResumeSession.workDir||this.convModalWorkDir.trim()||this.selectedConvModalAgentWorkDir;this.store.resumeConversation(this.selectedResumeSession.sessionId,e,this.convModalAgent,this.buildConvOpts()),this.closeConversationModal()},formatDate(e){return ir(e,this.$t.bind(this))},selectConversation(e,t){this.store.leaveWorkCenter(),this.store.selectConversation(e,t),this.store.closeSessionSidebar()},onSessionClick(e){if(e.agentOnline===!1){this.store.addMessage({type:"system",content:this.$t("chat.session.agentOffline")});return}if(this.store.isSplitMode&&this.store.activePanelId){this.store.leaveWorkCenter(),this.store.setPanelConversation(this.store.activePanelId,e.id),this.store.closeSessionSidebar();return}this.selectConversation(e.id,e.agentId)},closeSession(e,t){this.store.closeSession(e,t)},deleteConversation(e,t){confirm(this.$t("chat.delete.confirm"))&&this.store.deleteConversation(e,t)},getConversationTitle(e){let t=this.store.getConversationTitle(e.id);return t?t.length>30?t.slice(0,30)+"...":t:e.claudeSessionId?e.claudeSessionId.slice(0,8)+"...":e.id.slice(0,8)+"..."},getConversationFullTitle(e){let t=this.store.getConversationTitle(e.id);if(t&&t.length>30)return t},startChatRename(e){this.editingChatId=e.id,this.editingChatName=this.store.customConversationTitles[e.id]||this.store.conversationTitles[e.id]||"",this.$nextTick(()=>{let t=this.$refs.chatRenameInput;if(t){let s=Array.isArray(t)?t[0]:t;s.focus(),s.select()}})},commitChatRename(){if(!this.editingChatId)return;let e=this.editingChatId,t=this.editingChatName.trim();this.editingChatId=null,this.editingChatName="",this.store.renameChatSession(e,t)},cancelChatRename(){this.editingChatId=null,this.editingChatName=""},toggleSessionMenu(e){this.activeSessionMenu=this.activeSessionMenu===e?null:e},closeSessionMenu(){this.activeSessionMenu=null},getConversationTime(e){let s=this.store.executionStatusMap[e.id]?.lastActivity||e.createdAt;if(!s)return"";let n=new Date(s),i=new Date,r=i-n;return r<6e4?this.$t("chat.time.justNow"):r<36e5?this.$t("chat.time.minutesAgo",{count:Math.floor(r/6e4)}):n.toDateString()===i.toDateString()?n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):n.toLocaleDateString(void 0,{month:"numeric",day:"numeric"})},providerLabel(e){return e==="copilot"?this.$t("provider.copilot"):e==="claude-code"?this.$t("provider.claudeCode"):e||""},shortenPath(e){return Ns(e)},formatTime(e){return e?new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}):""},getLastPathSegment(e){return Rn(e)},getParentPath(e){if(!e)return"";let t=e.split(/[/\\]/);return t.length<=2?"":t.slice(0,-1).join("/")},handleResize(){this.windowWidth=window.innerWidth},restartAgent(e){let s=this.store.agents.find(n=>n.id===e)?.name||e;confirm(this.$t("chat.agent.restartConfirm",{name:s}))&&(this.restartingAgents[e]=!0,setTimeout(()=>{delete this.restartingAgents[e]},12e4),this.store.restartAgent(e))},upgradeAgent(e){let t=this.store.agents.find(n=>n.id===e),s=t?.name||e;confirm(this.$t("chat.agent.upgradeConfirm",{name:s}))&&(this.upgradingAgents[e]={since:Date.now(),oldVersion:t?.version||null},setTimeout(()=>{delete this.upgradingAgents[e]},12e4),this.store.upgradeAgent(e))},openFolderPicker(e){let t=this.convModalAgent;if(!t)return;this.folderPickerTarget=e,this.folderPickerOpen=!0,this.folderPickerSelected="",this.folderPickerLoading=!0;let s=this.convModalWorkDir,n=this.store.agents.find(o=>o.id===t),i=s||n?.workDir||"";this.folderPickerPath=i,this.folderPickerEntries=[];let r=()=>{this.store.sendWsMessage({type:"list_directory",conversationId:"_workdir_picker",agentId:t,dirPath:i,workDir:n?.workDir||""})};r(),this._folderPickerTimer&&clearTimeout(this._folderPickerTimer),this._folderPickerTimer=setTimeout(()=>{this.folderPickerLoading&&this.folderPickerOpen&&r()},5e3)},loadFolderPickerDir(e){let t=this.convModalAgent;if(!t)return;this.folderPickerLoading=!0,this.folderPickerSelected="",this.folderPickerEntries=[];let s=this.store.agents.find(i=>i.id===t),n=()=>{this.store.sendWsMessage({type:"list_directory",conversationId:"_workdir_picker",agentId:t,dirPath:e,workDir:s?.workDir||""})};n(),this._folderPickerTimer&&clearTimeout(this._folderPickerTimer),this._folderPickerTimer=setTimeout(()=>{this.folderPickerLoading&&this.folderPickerOpen&&n()},5e3)},folderPickerNavigateUp(){if(!this.folderPickerPath)return;let e=this.folderPickerPath.includes("\\"),t=e?"\\":"/",s=this.folderPickerPath.replace(/[/\\]$/,"").split(/[/\\]/);if(s.pop(),s.length===0)this.folderPickerPath="",this.loadFolderPickerDir("");else if(e&&s.length===1&&/^[A-Za-z]:$/.test(s[0]))this.folderPickerPath=s[0]+"\\",this.loadFolderPickerDir(s[0]+"\\");else{let n=s.join(t);this.folderPickerPath=n,this.loadFolderPickerDir(n)}},folderPickerSelectItem(e){this.folderPickerSelected=e.name},folderPickerEnter(e){let s=this.folderPickerPath.includes("\\")||/^[A-Z]:/.test(e.name)?"\\":"/",n;this.folderPickerPath?n=this.folderPickerPath.replace(/[/\\]$/,"")+s+e.name:/^[A-Z]:$/.test(e.name)?n=e.name+"\\":n="/"+e.name,this.folderPickerPath=n,this.loadFolderPickerDir(n)},confirmFolderPicker(){let e=this.folderPickerPath;if(e){if(this.folderPickerSelected){let t=e.includes("\\")?"\\":"/";e=e.replace(/[/\\]$/,"")+t+this.folderPickerSelected}this.convModalWorkDir=e,this.selectedResumeSession=null,this.convModalAgent&&(this.store.listHistorySessionsForAgent(this.convModalAgent,e,this.convModalProvider),this.historyLoaded=!0),this.folderPickerOpen=!1}},handleFolderPickerMessage(e){let t=e.detail;!t||t.type!=="directory_listing"||t.conversationId!=="_workdir_picker"||(this._folderPickerTimer&&(clearTimeout(this._folderPickerTimer),this._folderPickerTimer=null),this.folderPickerLoading=!1,this.folderPickerEntries=(t.entries||[]).filter(s=>s.type==="directory").sort((s,n)=>s.name.localeCompare(n.name)),t.dirPath!=null&&(this.folderPickerPath=t.dirPath))}},mounted(){if(this.store.openUnifiedChatCreate){let e=this.store.openUnifiedChatCreate;this.store.openUnifiedChatCreate=!1,this.convModalProvider=e==="copilot"?"copilot":"claude-code",this.openConversationModal({preserveProvider:!0})}this._clickOutsideHandler=e=>{e.target.closest(".agent-selector")||(this.showAgentDropdown=!1),!e.target.closest(".session-dots-btn")&&!e.target.closest(".session-menu")&&(this.activeSessionMenu=null)},document.addEventListener("click",this._clickOutsideHandler),window.addEventListener("resize",this.handleResize),window.addEventListener("workbench-message",this.handleFolderPickerMessage),fetch("/api/version").then(e=>e.json()).then(e=>{this.serverVersion=e.version}).catch(()=>{}),this._agentRestartAckHandler=e=>{let{agentId:t}=e.detail},window.addEventListener("agent-restart-ack",this._agentRestartAckHandler),this._agentUpgradeAckHandler=e=>{let{agentId:t,success:s,error:n,alreadyLatest:i,version:r,reason:o,currentNode:a,requiredNode:l}=e.detail;s?i&&(delete this.upgradingAgents[t],alert(this.$t("chat.agent.alreadyLatest",{version:r||""}))):(delete this.upgradingAgents[t],alert(o==="node_incompatible"?this.$t("chat.agent.nodeIncompatible",{current:a||"?",required:l||"?",version:r||""}):`Agent upgrade failed: ${n||"Unknown error"}`))},window.addEventListener("agent-upgrade-ack",this._agentUpgradeAckHandler),this._checkRestartingAgents=this.$watch(()=>this.store.agents.map(e=>e.id+":"+e.online),()=>{for(let e of Object.keys(this.restartingAgents)){let t=this.store.agents.find(s=>s.id===e);(t?.online||!t)&&delete this.restartingAgents[e]}for(let e of Object.keys(this.upgradingAgents)){let t=this.store.agents.find(i=>i.id===e),s=this.upgradingAgents[e],n=Date.now()-(s?.since||0);!t||n>12e4?delete this.upgradingAgents[e]:t.online&&(n<3e3?setTimeout(()=>{this.store.agents.find(o=>o.id===e)?.online&&delete this.upgradingAgents[e]},3e3-n):delete this.upgradingAgents[e])}})},beforeUnmount(){document.removeEventListener("click",this._clickOutsideHandler),window.removeEventListener("resize",this.handleResize),window.removeEventListener("workbench-message",this.handleFolderPickerMessage),window.removeEventListener("agent-restart-ack",this._agentRestartAckHandler),window.removeEventListener("agent-upgrade-ack",this._agentUpgradeAckHandler),this._checkRestartingAgents&&this._checkRestartingAgents(),this._folderPickerTimer&&clearTimeout(this._folderPickerTimer)}}});function bf({sessions:e,activeSessionId:t,pinnedSessionIds:s,onlineAgentIds:n}={}){let i=t||null,r=Array.isArray(s)?s:[],o=Array.isArray(n)?new Set(n.filter(Boolean)):null,a=new Map;r.forEach((c,d)=>{typeof c=="string"&&c&&!a.has(c)&&a.set(c,d)});let l=[];for(let c of Array.isArray(e)?e:[]){if(!c||!c.id||o&&c.agentId&&!o.has(c.agentId))continue;let d=String(c.id);l.push({kind:"session",id:d,raw:c,pinned:!!c.pinned||!c.agentId&&a.has(d),active:d===i,processing:!!c.running||!!c.active||!!c.isRunning||!!c.isActive,_manualOrder:Number.isFinite(c.sortOrder)?c.sortOrder:Number.MAX_SAFE_INTEGER,_activityTime:vi(c)})}return l.sort((c,d)=>{if(c.pinned!==d.pinned)return c.pinned?-1:1;if(c._manualOrder!==d._manualOrder)return c._manualOrder-d._manualOrder;if(c._activityTime!==d._activityTime)return d._activityTime-c._activityTime;let u=a.has(c.id)?a.get(c.id):Number.MAX_SAFE_INTEGER,p=a.has(d.id)?a.get(d.id):Number.MAX_SAFE_INTEGER;return u!==p?u-p:c.id.localeCompare(d.id)}),l.map(({_manualOrder:c,_activityTime:d,...u})=>u)}var wf=H(()=>{yi()});var Iv,W1,kf,Sf=H(()=>{rr();pa();fa();ga();ma();ha();sr();wf();Iv=3600*1e3,W1=24*Iv,kf={name:"YeaftSidebar",components:{SessionCreateModal:Bs,SidebarModeToggle:Zi,SidebarAgentHeader:Ji,SidebarWorkCenter:er,SessionSidebarShell:tr,UnifiedSessionList:nr},emits:["select-group","select-chat","toggle-sidebar","back","open-settings","open-group-settings"],template:`
6577
+ `,data(){return{showAgentDropdown:!1,showSettingsPanel:!1,restartingAgents:{},upgradingAgents:{},showConversationModal:!1,unifiedSessionCreateOpen:!1,unifiedSessionCreateProvider:"yeaft",convModalAgent:"",convModalWorkDir:"",convModalProvider:"claude-code",selectedResumeSession:null,historyLoaded:!1,windowWidth:window.innerWidth,folderPickerOpen:!1,folderPickerPath:"",folderPickerEntries:[],folderPickerLoading:!1,folderPickerSelected:"",folderPickerTarget:"",serverVersion:"",chatGroupCollapsed:!1,sidebarTab:"chat",editingChatId:null,editingChatName:"",activeSessionMenu:null}},computed:{store(){return Pinia.useChatStore()},providerOptions(){return[{value:"claude-code",label:this.$t("provider.claudeCode")},{value:"copilot",label:this.$t("provider.copilot")}]},agentOptions(){return this.store.agents.filter(e=>e.online).map(e=>({value:e.id,label:`${e.name}${e.latency?` (${e.latency}ms)`:""}`}))},canUseWorkbench(){let e=Me().role;return e==="admin"||e==="pro"},selectedConvModalAgentWorkDir(){return this.convModalAgent&&this.store.agents.find(t=>t.id===this.convModalAgent)?.workDir||""},onlineAgents(){return this.store.agents.filter(e=>e.online)},onlineAgentCount(){return this.onlineAgents.length},workCenterAgents(){return this.onlineAgents.filter(e=>Array.isArray(e.capabilities)&&e.capabilities.includes("work_center"))},isMobileView(){return this.windowWidth<=768},effectiveSidebarCollapsed(){return this.isMobileView?!this.store.sessionSidebarOpen:this.store.sidebarCollapsed},normalConversations(){return this.sortByActivity(this.store.conversations.filter(e=>e.agentOnline!==!1))},pinnedChatConversations(){let e=this.store.conversations.filter(t=>t.agentOnline!==!1&&this.store.isSessionPinned(t.id));return this.sortByActivity(e)},unpinnedChatConversations(){return this.sortByActivity(this.store.conversations.filter(e=>e.agentOnline!==!1&&!this.store.isSessionPinned(e.id)))},chatSessionCount(){return this.store.conversations.filter(e=>e.agentOnline!==!1).length}},methods:{onSidebarCollapse(){mf({isMobileView:this.isMobileView,showMobileSidebar:this.store.sessionSidebarOpen,closeMobileSidebar:()=>this.store.closeSessionSidebar(),toggleSidebar:()=>this.store.toggleSidebar()})},onModeFlip(e){e==="yeaft"?this.store.enterYeaft():this.store.leaveYeaft()},sortByActivity(e){return Cd(e)},isCatalogSessionUnread(e){return e?.runtimeProvider!=="yeaft"?!1:this.store.isYeaftSessionUnread(e.routeRef?.sessionId,e.routeRef?.agentId)},onUnifiedCreate(e="yeaft"){this.unifiedSessionCreateProvider=["yeaft","copilot","claude-code"].includes(e)?e:"yeaft",this.unifiedSessionCreateOpen=!0},openWorkCenter(e=null){let t=this.workCenterAgents.find(s=>s.id===e)||this.workCenterAgents.find(s=>s.id===this.store.workCenterAgentId)||this.workCenterAgents[0];t&&this.store.enterWorkCenter(t.id)},onUnifiedSessionAction({action:e,row:t,title:s,sessions:n}={}){if(!t?.routeRef)return;let{runtimeProvider:i,agentId:r,sessionId:o}=t.routeRef;e==="rename"?this.store.renameCatalogSession({row:t,title:s}):e==="reorder"?this.store.reorderCatalogSessions(n):e==="pin"?this.store.toggleCatalogSessionPin(t):e==="remove"&&i!=="yeaft"?confirm(this.$t("chat.delete.confirm"))&&this.closeSession(o,r):i==="yeaft"&&e==="remove"?this.store.sessionCrudRequest("archive",{sessionId:o},{agentId:r}):i==="yeaft"&&e==="settings"&&(this.store.pendingUnifiedSessionSettings={sessionId:o,agentId:r,section:"session"},this.store.openCatalogSession(t))},openConversationModal({preserveProvider:e=!1}={}){this.showConversationModal=!0,e||(this.convModalProvider="claude-code"),this.convModalAgent="",this.convModalWorkDir="",this.selectedResumeSession=null,this.historyLoaded=!1,this._foldersRetried=!1;let t=this.store.agents.filter(i=>i.online),n=t.find(i=>i.id===this.store.currentAgent)||t[0];n&&(this.convModalAgent=n.id,this.store.listFoldersForAgent(this.convModalAgent,this.convModalProvider).then(()=>{this.showConversationModal&&this.store.folders.length===0&&!this._foldersRetried&&(this._foldersRetried=!0,setTimeout(()=>{this.showConversationModal&&this.convModalAgent&&this.store.listFoldersForAgent(this.convModalAgent,this.convModalProvider)},1500))}))},openConversationModalResume(){this.openConversationModal()},closeConversationModal(){this.showConversationModal=!1,this.convModalAgent="",this.convModalWorkDir="",this.selectedResumeSession=null,this.historyLoaded=!1},onConvModalAgentChange(){this.convModalAgent&&(this.convModalWorkDir="",this.selectedResumeSession=null,this.historyLoaded=!1,this.store.listFoldersForAgent(this.convModalAgent,this.convModalProvider))},onConvModalProviderChange(){this.convModalWorkDir="",this.selectedResumeSession=null,this.historyLoaded=!1,this.convModalAgent&&this.store.listFoldersForAgent(this.convModalAgent,this.convModalProvider)},onConvModalWorkDirInput(){this.historyLoaded=!1,this.selectedResumeSession=null,this._workDirInputTimer&&clearTimeout(this._workDirInputTimer),this._workDirInputTimer=setTimeout(()=>{this.convModalWorkDir.trim()&&this.convModalAgent&&(this.store.listHistorySessionsForAgent(this.convModalAgent,this.convModalWorkDir.trim(),this.convModalProvider),this.historyLoaded=!0)},500)},selectConvModalFolder(e){this.convModalWorkDir=e,this.selectedResumeSession=null,this.convModalAgent&&(this.store.listHistorySessionsForAgent(this.convModalAgent,e,this.convModalProvider),this.historyLoaded=!0)},loadConvModalFolders(){this.convModalAgent&&this.store.listFoldersForAgent(this.convModalAgent,this.convModalProvider)},loadConvModalSessions(){this.convModalAgent&&this.convModalWorkDir.trim()&&(this.store.listHistorySessionsForAgent(this.convModalAgent,this.convModalWorkDir.trim(),this.convModalProvider),this.historyLoaded=!0)},toggleAgentDropdown(){this.showAgentDropdown=!this.showAgentDropdown,this.showAgentDropdown&&this.store.refreshAgents()},selectAgent(e){this.store.selectAgent(e),this.showAgentDropdown=!1},createNewConversation(){if(!this.convModalAgent)return;this.store.selectAgent(this.convModalAgent);let e=this.convModalWorkDir.trim()||this.selectedConvModalAgentWorkDir;this.store.createConversation(e,this.convModalAgent,null,this.buildConvOpts()),this.closeConversationModal()},buildConvOpts(){let e={provider:this.convModalProvider};return this.convModalProvider==="copilot"&&(e.providerOptions={allowAllTools:!0}),e},resumeSession(e){if(!this.convModalAgent)return;this.store.selectAgent(this.convModalAgent),this.store._pendingSessionTitle=e.title;let t=e.workDir||this.convModalWorkDir.trim()||this.selectedConvModalAgentWorkDir;this.store.resumeConversation(e.sessionId,t,this.convModalAgent,this.buildConvOpts()),this.closeConversationModal()},resumeSelectedSession(){if(!this.convModalAgent||!this.selectedResumeSession)return;this.store.selectAgent(this.convModalAgent),this.store._pendingSessionTitle=this.selectedResumeSession.title;let e=this.selectedResumeSession.workDir||this.convModalWorkDir.trim()||this.selectedConvModalAgentWorkDir;this.store.resumeConversation(this.selectedResumeSession.sessionId,e,this.convModalAgent,this.buildConvOpts()),this.closeConversationModal()},formatDate(e){return ir(e,this.$t.bind(this))},selectConversation(e,t){this.store.leaveWorkCenter(),this.store.selectConversation(e,t),this.store.closeSessionSidebar()},onSessionClick(e){if(e.agentOnline===!1){this.store.addMessage({type:"system",content:this.$t("chat.session.agentOffline")});return}if(this.store.isSplitMode&&this.store.activePanelId){this.store.leaveWorkCenter(),this.store.setPanelConversation(this.store.activePanelId,e.id),this.store.closeSessionSidebar();return}this.selectConversation(e.id,e.agentId)},closeSession(e,t){this.store.closeSession(e,t)},deleteConversation(e,t){confirm(this.$t("chat.delete.confirm"))&&this.store.deleteConversation(e,t)},getConversationTitle(e){let t=this.store.getConversationTitle(e.id);return t?t.length>30?t.slice(0,30)+"...":t:e.claudeSessionId?e.claudeSessionId.slice(0,8)+"...":e.id.slice(0,8)+"..."},getConversationFullTitle(e){let t=this.store.getConversationTitle(e.id);if(t&&t.length>30)return t},startChatRename(e){this.editingChatId=e.id,this.editingChatName=this.store.customConversationTitles[e.id]||this.store.conversationTitles[e.id]||"",this.$nextTick(()=>{let t=this.$refs.chatRenameInput;if(t){let s=Array.isArray(t)?t[0]:t;s.focus(),s.select()}})},commitChatRename(){if(!this.editingChatId)return;let e=this.editingChatId,t=this.editingChatName.trim();this.editingChatId=null,this.editingChatName="",this.store.renameChatSession(e,t)},cancelChatRename(){this.editingChatId=null,this.editingChatName=""},toggleSessionMenu(e){this.activeSessionMenu=this.activeSessionMenu===e?null:e},closeSessionMenu(){this.activeSessionMenu=null},getConversationTime(e){let s=this.store.executionStatusMap[e.id]?.lastActivity||e.createdAt;if(!s)return"";let n=new Date(s),i=new Date,r=i-n;return r<6e4?this.$t("chat.time.justNow"):r<36e5?this.$t("chat.time.minutesAgo",{count:Math.floor(r/6e4)}):n.toDateString()===i.toDateString()?n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):n.toLocaleDateString(void 0,{month:"numeric",day:"numeric"})},providerLabel(e){return e==="copilot"?this.$t("provider.copilot"):e==="claude-code"?this.$t("provider.claudeCode"):e||""},shortenPath(e){return Ns(e)},formatTime(e){return e?new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}):""},getLastPathSegment(e){return _n(e)},getParentPath(e){if(!e)return"";let t=e.split(/[/\\]/);return t.length<=2?"":t.slice(0,-1).join("/")},handleResize(){this.windowWidth=window.innerWidth},restartAgent(e){let s=this.store.agents.find(n=>n.id===e)?.name||e;confirm(this.$t("chat.agent.restartConfirm",{name:s}))&&(this.restartingAgents[e]=!0,setTimeout(()=>{delete this.restartingAgents[e]},12e4),this.store.restartAgent(e))},upgradeAgent(e){let t=this.store.agents.find(n=>n.id===e),s=t?.name||e;confirm(this.$t("chat.agent.upgradeConfirm",{name:s}))&&(this.upgradingAgents[e]={since:Date.now(),oldVersion:t?.version||null},setTimeout(()=>{delete this.upgradingAgents[e]},12e4),this.store.upgradeAgent(e))},openFolderPicker(e){let t=this.convModalAgent;if(!t)return;this.folderPickerTarget=e,this.folderPickerOpen=!0,this.folderPickerSelected="",this.folderPickerLoading=!0;let s=this.convModalWorkDir,n=this.store.agents.find(o=>o.id===t),i=s||n?.workDir||"";this.folderPickerPath=i,this.folderPickerEntries=[];let r=()=>{this.store.sendWsMessage({type:"list_directory",conversationId:"_workdir_picker",agentId:t,dirPath:i,workDir:n?.workDir||""})};r(),this._folderPickerTimer&&clearTimeout(this._folderPickerTimer),this._folderPickerTimer=setTimeout(()=>{this.folderPickerLoading&&this.folderPickerOpen&&r()},5e3)},loadFolderPickerDir(e){let t=this.convModalAgent;if(!t)return;this.folderPickerLoading=!0,this.folderPickerSelected="",this.folderPickerEntries=[];let s=this.store.agents.find(i=>i.id===t),n=()=>{this.store.sendWsMessage({type:"list_directory",conversationId:"_workdir_picker",agentId:t,dirPath:e,workDir:s?.workDir||""})};n(),this._folderPickerTimer&&clearTimeout(this._folderPickerTimer),this._folderPickerTimer=setTimeout(()=>{this.folderPickerLoading&&this.folderPickerOpen&&n()},5e3)},folderPickerNavigateUp(){if(!this.folderPickerPath)return;let e=this.folderPickerPath.includes("\\"),t=e?"\\":"/",s=this.folderPickerPath.replace(/[/\\]$/,"").split(/[/\\]/);if(s.pop(),s.length===0)this.folderPickerPath="",this.loadFolderPickerDir("");else if(e&&s.length===1&&/^[A-Za-z]:$/.test(s[0]))this.folderPickerPath=s[0]+"\\",this.loadFolderPickerDir(s[0]+"\\");else{let n=s.join(t);this.folderPickerPath=n,this.loadFolderPickerDir(n)}},folderPickerSelectItem(e){this.folderPickerSelected=e.name},folderPickerEnter(e){let s=this.folderPickerPath.includes("\\")||/^[A-Z]:/.test(e.name)?"\\":"/",n;this.folderPickerPath?n=this.folderPickerPath.replace(/[/\\]$/,"")+s+e.name:/^[A-Z]:$/.test(e.name)?n=e.name+"\\":n="/"+e.name,this.folderPickerPath=n,this.loadFolderPickerDir(n)},confirmFolderPicker(){let e=this.folderPickerPath;if(e){if(this.folderPickerSelected){let t=e.includes("\\")?"\\":"/";e=e.replace(/[/\\]$/,"")+t+this.folderPickerSelected}this.convModalWorkDir=e,this.selectedResumeSession=null,this.convModalAgent&&(this.store.listHistorySessionsForAgent(this.convModalAgent,e,this.convModalProvider),this.historyLoaded=!0),this.folderPickerOpen=!1}},handleFolderPickerMessage(e){let t=e.detail;!t||t.type!=="directory_listing"||t.conversationId!=="_workdir_picker"||(this._folderPickerTimer&&(clearTimeout(this._folderPickerTimer),this._folderPickerTimer=null),this.folderPickerLoading=!1,this.folderPickerEntries=(t.entries||[]).filter(s=>s.type==="directory").sort((s,n)=>s.name.localeCompare(n.name)),t.dirPath!=null&&(this.folderPickerPath=t.dirPath))}},mounted(){if(this.store.openUnifiedChatCreate){let e=this.store.openUnifiedChatCreate;this.store.openUnifiedChatCreate=!1,this.convModalProvider=e==="copilot"?"copilot":"claude-code",this.openConversationModal({preserveProvider:!0})}this._clickOutsideHandler=e=>{e.target.closest(".agent-selector")||(this.showAgentDropdown=!1),!e.target.closest(".session-dots-btn")&&!e.target.closest(".session-menu")&&(this.activeSessionMenu=null)},document.addEventListener("click",this._clickOutsideHandler),window.addEventListener("resize",this.handleResize),window.addEventListener("workbench-message",this.handleFolderPickerMessage),fetch("/api/version").then(e=>e.json()).then(e=>{this.serverVersion=e.version}).catch(()=>{}),this._agentRestartAckHandler=e=>{let{agentId:t}=e.detail},window.addEventListener("agent-restart-ack",this._agentRestartAckHandler),this._agentUpgradeAckHandler=e=>{let{agentId:t,success:s,error:n,alreadyLatest:i,version:r,reason:o,currentNode:a,requiredNode:l}=e.detail;s?i&&(delete this.upgradingAgents[t],alert(this.$t("chat.agent.alreadyLatest",{version:r||""}))):(delete this.upgradingAgents[t],alert(o==="node_incompatible"?this.$t("chat.agent.nodeIncompatible",{current:a||"?",required:l||"?",version:r||""}):`Agent upgrade failed: ${n||"Unknown error"}`))},window.addEventListener("agent-upgrade-ack",this._agentUpgradeAckHandler),this._checkRestartingAgents=this.$watch(()=>this.store.agents.map(e=>e.id+":"+e.online),()=>{for(let e of Object.keys(this.restartingAgents)){let t=this.store.agents.find(s=>s.id===e);(t?.online||!t)&&delete this.restartingAgents[e]}for(let e of Object.keys(this.upgradingAgents)){let t=this.store.agents.find(i=>i.id===e),s=this.upgradingAgents[e],n=Date.now()-(s?.since||0);!t||n>12e4?delete this.upgradingAgents[e]:t.online&&(n<3e3?setTimeout(()=>{this.store.agents.find(o=>o.id===e)?.online&&delete this.upgradingAgents[e]},3e3-n):delete this.upgradingAgents[e])}})},beforeUnmount(){document.removeEventListener("click",this._clickOutsideHandler),window.removeEventListener("resize",this.handleResize),window.removeEventListener("workbench-message",this.handleFolderPickerMessage),window.removeEventListener("agent-restart-ack",this._agentRestartAckHandler),window.removeEventListener("agent-upgrade-ack",this._agentUpgradeAckHandler),this._checkRestartingAgents&&this._checkRestartingAgents(),this._folderPickerTimer&&clearTimeout(this._folderPickerTimer)}}});function bf({sessions:e,activeSessionId:t,pinnedSessionIds:s,onlineAgentIds:n}={}){let i=t||null,r=Array.isArray(s)?s:[],o=Array.isArray(n)?new Set(n.filter(Boolean)):null,a=new Map;r.forEach((c,d)=>{typeof c=="string"&&c&&!a.has(c)&&a.set(c,d)});let l=[];for(let c of Array.isArray(e)?e:[]){if(!c||!c.id||o&&c.agentId&&!o.has(c.agentId))continue;let d=String(c.id);l.push({kind:"session",id:d,raw:c,pinned:!!c.pinned||!c.agentId&&a.has(d),active:d===i,processing:!!c.running||!!c.active||!!c.isRunning||!!c.isActive,_manualOrder:Number.isFinite(c.sortOrder)?c.sortOrder:Number.MAX_SAFE_INTEGER,_activityTime:vi(c)})}return l.sort((c,d)=>{if(c.pinned!==d.pinned)return c.pinned?-1:1;if(c._manualOrder!==d._manualOrder)return c._manualOrder-d._manualOrder;if(c._activityTime!==d._activityTime)return d._activityTime-c._activityTime;let u=a.has(c.id)?a.get(c.id):Number.MAX_SAFE_INTEGER,p=a.has(d.id)?a.get(d.id):Number.MAX_SAFE_INTEGER;return u!==p?u-p:c.id.localeCompare(d.id)}),l.map(({_manualOrder:c,_activityTime:d,...u})=>u)}var wf=H(()=>{yi()});var Cv,B1,kf,Sf=H(()=>{rr();pa();fa();ga();ma();ha();sr();wf();Cv=3600*1e3,B1=24*Cv,kf={name:"YeaftSidebar",components:{SessionCreateModal:Bs,SidebarModeToggle:Zi,SidebarAgentHeader:Ji,SidebarWorkCenter:er,SessionSidebarShell:tr,UnifiedSessionList:nr},emits:["select-group","select-chat","toggle-sidebar","back","open-settings","open-group-settings"],template:`
6580
6578
  <SessionSidebarShell class="yeaft-sidebar" :collapsed="collapsed">
6581
6579
  <template #collapsed>
6582
6580
  <!-- Collapsed Icon Bar \u2014 mirrors Chat's .sidebar-collapsed-bar so the
@@ -6775,7 +6773,7 @@ ${String(e||"").trim()}
6775
6773
  </div>
6776
6774
  </div>
6777
6775
  </div>
6778
- `,mounted(){window.addEventListener("keydown",this.onEsc)},beforeUnmount(){window.removeEventListener("keydown",this.onEsc)},methods:{onEsc(e){e.key==="Escape"&&this.onDismiss()},onOpen(){this.$emit("open-library")},onDismiss(){this.$emit("dismiss")}}}});function Ta(e){return e==="members"||e==="memory"||e===Bt?e:(Av.has(e),Bt)}var Bt,Av,Af,xf=H(()=>{ls();xn();Bt="session",Av=new Set(["announcement","rename","danger"]);Af={name:"SessionSettingsModal",emits:["close","open-vp-library"],props:{groupId:{type:String,required:!0},agentId:{type:String,default:null},initialSection:{type:String,default:Bt,validator:e=>[Bt,"announcement","members","rename","memory","danger"].includes(e)},initialEditVpId:{type:String,default:""}},data(){return{section:this.initialEditVpId?"members":Ta(this.initialSection),announcementDraft:"",announcementBusy:!1,announcementError:"",renameDraft:"",renameBusy:!1,renameError:"",membersBusy:!1,membersError:"",highlightedVpId:this.initialEditVpId||"",deleteConfirmText:"",deleteBusy:!1,deleteError:""}},computed:{chat(){try{return window.Pinia?.useChatStore?.()||null}catch{return null}},vpStore(){try{return window.Pinia?.useVpStore?.()||null}catch{return null}},sessionsStore(){try{return window.Pinia?.useSessionsStore?.()||null}catch{return null}},group(){let e=this.sessionsStore,t=this.agentId||this.chat?.currentAgent||null;return e&&typeof e.sessionById=="function"?e.sessionById(this.groupId,t):null},targetAgentId(){return this.agentId||this.group?.agentId||this.chat?.currentAgent||null},groupDisplayName(){let e=this.group;return e?e.id==="grp_default"&&(e.name==="Default"||!e.name)?this.$t("yeaft.session.defaultName")||e.name||e.id:e.name||e.id:""},announcement(){return this.group&&typeof this.group.announcement=="string"?this.group.announcement:""},roster(){return this.group&&Array.isArray(this.group.roster)?this.group.roster:[]},defaultVpId(){return this.group&&this.group.defaultVpId||null},vpList(){return this.vpStore?.vpList||[]},vpDomainSections(){return os(this.vpList)},vpLibraryEmpty(){let e=this.vpStore;return e?e.emptyLibrary===!0?!0:!!(e.lastSnapshotAt&&e.lastSnapshotAt>0&&(e.vpOrder?.length||0)===0):!1},deleteConfirmReady(){return this.deleteConfirmText.trim()===this.groupDisplayName},sections(){return[{id:Bt,label:this.$t("yeaft.session.settings.nav.session")},{id:"members",label:this.$t("yeaft.session.settings.nav.members")},{id:"memory",label:this.$t("yeaft.session.settings.nav.memory")}]},groupDreamStatus(){let e=this.vpStore;return e?e.groupDreamStatusFor(this.groupId):{status:"idle",lastRunAt:null,lastResult:null,lastError:null}},dreamRunning(){return this.groupDreamStatus.status==="running"}},watch:{section(e){e===Bt&&(this.announcementDraft=this.announcement,this.renameDraft=this.groupDisplayName),this.announcementError="",this.renameError="",this.membersError="",this.deleteError="",this.deleteConfirmText=""},initialEditVpId(e){this.highlightedVpId=e||"",e&&(this.section="members")},initialSection(e){this.initialEditVpId||(this.section=Ta(e))},groupId(){this.section=this.initialEditVpId?"members":Ta(this.initialSection),this.highlightedVpId=this.initialEditVpId||"",this.announcementDraft=this.announcement,this.renameDraft=this.groupDisplayName,this.deleteConfirmText="",this.announcementError="",this.renameError="",this.membersError="",this.deleteError=""},group(e,t){t&&!e&&!this.deleteBusy&&this.requestClose()}},mounted(){window.addEventListener("keydown",this.onEsc);try{if(this.vpStore&&this.vpStore.lastSnapshotAt===0){let e=this.chat;e&&typeof e.sendWsMessage=="function"&&e.sendWsMessage({type:"yeaft_vp_subscribe"})}}catch{}this.section===Bt&&(this.announcementDraft=this.announcement,this.renameDraft=this.groupDisplayName)},beforeUnmount(){window.removeEventListener("keydown",this.onEsc)},methods:{trackOverlayPointerDown:rt,trackOverlayPointerUp:ot,clearOverlayPointerGesture:at,onEsc(e){e.key==="Escape"&&(this.announcementBusy||this.renameBusy||this.membersBusy||this.deleteBusy||this.requestClose())},onOverlayClick(e){Ze(e)&&(this.announcementBusy||this.renameBusy||this.membersBusy||this.deleteBusy||this.requestClose())},requestClose(){this.$emit("close")},selectSection(e){e!==this.section&&(this.section=e)},async saveAnnouncement(){if(!(this.announcementBusy||!this.chat)){this.announcementBusy=!0,this.announcementError="";try{let e=await this.chat.sessionCrudRequest("update",{sessionId:this.groupId,patch:{announcement:this.announcementDraft}},{agentId:this.targetAgentId});if(!e||!e.ok){let t=e&&e.error&&e.error.code||"unknown",s=e&&e.error&&e.error.message||t;this.announcementError=this.$t("yeaft.session.announcement.saveFailed",{error:s})}}finally{this.announcementBusy=!1}}},async saveRename(){let e=(this.renameDraft||"").trim();if(!(!e||this.renameBusy||!this.chat)){this.renameBusy=!0,this.renameError="";try{let t=await this.chat.sessionCrudRequest("rename",{sessionId:this.groupId,name:e},{agentId:this.targetAgentId});if(!t||!t.ok){let s=t&&t.error&&t.error.code||"unknown",n=t&&t.error&&t.error.message||s;this.renameError=this.$t("yeaft.session.error.unknown",{message:n})}}finally{this.renameBusy=!1}}},isMember(e){return this.roster.includes(e)},vpLabelFor(e){let t=this.vpStore?.vpLabel;return typeof t=="function"?t(e):e},vpDescriptionFor(e){let t=this.vpStore?.vpDescription;return typeof t=="function"?t(e):""},vpTextColorFor(e){let t=this.vpStore?.vpTextColor;return typeof t=="function"?t(e):"var(--vp-avatar-rat-fg)"},async toggleMember(e,t){if(!(this.membersBusy||!this.chat)){this.membersBusy=!0,this.membersError="";try{let s=t?"add_member":"remove_member",n=await this.chat.sessionCrudRequest(s,{sessionId:this.groupId,vpId:e},{agentId:this.targetAgentId});if(!n||!n.ok){let i=n&&n.error&&n.error.code||"unknown",r=n&&n.error&&n.error.message||i;this.membersError=this.$t("yeaft.session.members.actionFailed",{error:r})}else if(s==="add_member"&&!this.defaultVpId){let i=await this.chat.sessionCrudRequest("set_default_vp",{sessionId:this.groupId,vpId:e},{agentId:this.targetAgentId});if(i&&!i.ok){let r=i.error&&i.error.code||"unknown",o=i.error&&i.error.message||r;this.membersError=this.$t("yeaft.session.members.actionFailed",{error:o})}}}finally{this.membersBusy=!1}}},async setDefault(e){if(!(this.membersBusy||!this.chat||this.defaultVpId===e)){this.membersBusy=!0,this.membersError="";try{let t=await this.chat.sessionCrudRequest("set_default_vp",{sessionId:this.groupId,vpId:e},{agentId:this.targetAgentId});if(!t||!t.ok){let s=t&&t.error&&t.error.code||"unknown",n=t&&t.error&&t.error.message||s;this.membersError=this.$t("yeaft.session.members.actionFailed",{error:n})}}finally{this.membersBusy=!1}}},runDream(){!this.vpStore||this.dreamRunning||this.vpStore.triggerGroupDream(this.groupId,{agentId:this.targetAgentId})},formatDreamTimestamp(e){if(!e)return"";try{return new Date(e).toLocaleString()}catch{return""}},async confirmDelete(){if(!(!this.deleteConfirmReady||this.deleteBusy||!this.chat)){this.deleteBusy=!0,this.deleteError="";try{let e=await this.chat.sessionCrudRequest("delete",{sessionId:this.groupId},{agentId:this.targetAgentId});if(!e||!e.ok){let t=e&&e.error&&e.error.code||"unknown",s=e&&e.error&&e.error.message||t;this.deleteError=this.$t("yeaft.session.error.unknown",{message:s});return}this.requestClose()}finally{this.deleteBusy=!1}}}},template:`
6776
+ `,mounted(){window.addEventListener("keydown",this.onEsc)},beforeUnmount(){window.removeEventListener("keydown",this.onEsc)},methods:{onEsc(e){e.key==="Escape"&&this.onDismiss()},onOpen(){this.$emit("open-library")},onDismiss(){this.$emit("dismiss")}}}});function Ta(e){return e==="members"||e==="memory"||e===Bt?e:(Iv.has(e),Bt)}var Bt,Iv,Af,xf=H(()=>{ls();xn();Bt="session",Iv=new Set(["announcement","rename","danger"]);Af={name:"SessionSettingsModal",emits:["close","open-vp-library"],props:{groupId:{type:String,required:!0},agentId:{type:String,default:null},initialSection:{type:String,default:Bt,validator:e=>[Bt,"announcement","members","rename","memory","danger"].includes(e)},initialEditVpId:{type:String,default:""}},data(){return{section:this.initialEditVpId?"members":Ta(this.initialSection),announcementDraft:"",announcementBusy:!1,announcementError:"",renameDraft:"",renameBusy:!1,renameError:"",membersBusy:!1,membersError:"",highlightedVpId:this.initialEditVpId||"",deleteConfirmText:"",deleteBusy:!1,deleteError:""}},computed:{chat(){try{return window.Pinia?.useChatStore?.()||null}catch{return null}},vpStore(){try{return window.Pinia?.useVpStore?.()||null}catch{return null}},sessionsStore(){try{return window.Pinia?.useSessionsStore?.()||null}catch{return null}},group(){let e=this.sessionsStore,t=this.agentId||this.chat?.currentAgent||null;return e&&typeof e.sessionById=="function"?e.sessionById(this.groupId,t):null},targetAgentId(){return this.agentId||this.group?.agentId||this.chat?.currentAgent||null},groupDisplayName(){let e=this.group;return e?e.id==="grp_default"&&(e.name==="Default"||!e.name)?this.$t("yeaft.session.defaultName")||e.name||e.id:e.name||e.id:""},announcement(){return this.group&&typeof this.group.announcement=="string"?this.group.announcement:""},roster(){return this.group&&Array.isArray(this.group.roster)?this.group.roster:[]},defaultVpId(){return this.group&&this.group.defaultVpId||null},vpList(){return this.vpStore?.vpList||[]},vpDomainSections(){return os(this.vpList)},vpLibraryEmpty(){let e=this.vpStore;return e?e.emptyLibrary===!0?!0:!!(e.lastSnapshotAt&&e.lastSnapshotAt>0&&(e.vpOrder?.length||0)===0):!1},deleteConfirmReady(){return this.deleteConfirmText.trim()===this.groupDisplayName},sections(){return[{id:Bt,label:this.$t("yeaft.session.settings.nav.session")},{id:"members",label:this.$t("yeaft.session.settings.nav.members")},{id:"memory",label:this.$t("yeaft.session.settings.nav.memory")}]},groupDreamStatus(){let e=this.vpStore;return e?e.groupDreamStatusFor(this.groupId):{status:"idle",lastRunAt:null,lastResult:null,lastError:null}},dreamRunning(){return this.groupDreamStatus.status==="running"}},watch:{section(e){e===Bt&&(this.announcementDraft=this.announcement,this.renameDraft=this.groupDisplayName),this.announcementError="",this.renameError="",this.membersError="",this.deleteError="",this.deleteConfirmText=""},initialEditVpId(e){this.highlightedVpId=e||"",e&&(this.section="members")},initialSection(e){this.initialEditVpId||(this.section=Ta(e))},groupId(){this.section=this.initialEditVpId?"members":Ta(this.initialSection),this.highlightedVpId=this.initialEditVpId||"",this.announcementDraft=this.announcement,this.renameDraft=this.groupDisplayName,this.deleteConfirmText="",this.announcementError="",this.renameError="",this.membersError="",this.deleteError=""},group(e,t){t&&!e&&!this.deleteBusy&&this.requestClose()}},mounted(){window.addEventListener("keydown",this.onEsc);try{if(this.vpStore&&this.vpStore.lastSnapshotAt===0){let e=this.chat;e&&typeof e.sendWsMessage=="function"&&e.sendWsMessage({type:"yeaft_vp_subscribe"})}}catch{}this.section===Bt&&(this.announcementDraft=this.announcement,this.renameDraft=this.groupDisplayName)},beforeUnmount(){window.removeEventListener("keydown",this.onEsc)},methods:{trackOverlayPointerDown:rt,trackOverlayPointerUp:ot,clearOverlayPointerGesture:at,onEsc(e){e.key==="Escape"&&(this.announcementBusy||this.renameBusy||this.membersBusy||this.deleteBusy||this.requestClose())},onOverlayClick(e){Ze(e)&&(this.announcementBusy||this.renameBusy||this.membersBusy||this.deleteBusy||this.requestClose())},requestClose(){this.$emit("close")},selectSection(e){e!==this.section&&(this.section=e)},async saveAnnouncement(){if(!(this.announcementBusy||!this.chat)){this.announcementBusy=!0,this.announcementError="";try{let e=await this.chat.sessionCrudRequest("update",{sessionId:this.groupId,patch:{announcement:this.announcementDraft}},{agentId:this.targetAgentId});if(!e||!e.ok){let t=e&&e.error&&e.error.code||"unknown",s=e&&e.error&&e.error.message||t;this.announcementError=this.$t("yeaft.session.announcement.saveFailed",{error:s})}}finally{this.announcementBusy=!1}}},async saveRename(){let e=(this.renameDraft||"").trim();if(!(!e||this.renameBusy||!this.chat)){this.renameBusy=!0,this.renameError="";try{let t=await this.chat.sessionCrudRequest("rename",{sessionId:this.groupId,name:e},{agentId:this.targetAgentId});if(!t||!t.ok){let s=t&&t.error&&t.error.code||"unknown",n=t&&t.error&&t.error.message||s;this.renameError=this.$t("yeaft.session.error.unknown",{message:n})}}finally{this.renameBusy=!1}}},isMember(e){return this.roster.includes(e)},vpLabelFor(e){let t=this.vpStore?.vpLabel;return typeof t=="function"?t(e):e},vpDescriptionFor(e){let t=this.vpStore?.vpDescription;return typeof t=="function"?t(e):""},vpTextColorFor(e){let t=this.vpStore?.vpTextColor;return typeof t=="function"?t(e):"var(--vp-avatar-rat-fg)"},async toggleMember(e,t){if(!(this.membersBusy||!this.chat)){this.membersBusy=!0,this.membersError="";try{let s=t?"add_member":"remove_member",n=await this.chat.sessionCrudRequest(s,{sessionId:this.groupId,vpId:e},{agentId:this.targetAgentId});if(!n||!n.ok){let i=n&&n.error&&n.error.code||"unknown",r=n&&n.error&&n.error.message||i;this.membersError=this.$t("yeaft.session.members.actionFailed",{error:r})}else if(s==="add_member"&&!this.defaultVpId){let i=await this.chat.sessionCrudRequest("set_default_vp",{sessionId:this.groupId,vpId:e},{agentId:this.targetAgentId});if(i&&!i.ok){let r=i.error&&i.error.code||"unknown",o=i.error&&i.error.message||r;this.membersError=this.$t("yeaft.session.members.actionFailed",{error:o})}}}finally{this.membersBusy=!1}}},async setDefault(e){if(!(this.membersBusy||!this.chat||this.defaultVpId===e)){this.membersBusy=!0,this.membersError="";try{let t=await this.chat.sessionCrudRequest("set_default_vp",{sessionId:this.groupId,vpId:e},{agentId:this.targetAgentId});if(!t||!t.ok){let s=t&&t.error&&t.error.code||"unknown",n=t&&t.error&&t.error.message||s;this.membersError=this.$t("yeaft.session.members.actionFailed",{error:n})}}finally{this.membersBusy=!1}}},runDream(){!this.vpStore||this.dreamRunning||this.vpStore.triggerGroupDream(this.groupId,{agentId:this.targetAgentId})},formatDreamTimestamp(e){if(!e)return"";try{return new Date(e).toLocaleString()}catch{return""}},async confirmDelete(){if(!(!this.deleteConfirmReady||this.deleteBusy||!this.chat)){this.deleteBusy=!0,this.deleteError="";try{let e=await this.chat.sessionCrudRequest("delete",{sessionId:this.groupId},{agentId:this.targetAgentId});if(!e||!e.ok){let t=e&&e.error&&e.error.code||"unknown",s=e&&e.error&&e.error.message||t;this.deleteError=this.$t("yeaft.session.error.unknown",{message:s});return}this.requestClose()}finally{this.deleteBusy=!1}}}},template:`
6779
6777
  <Teleport to="body">
6780
6778
  <div
6781
6779
  class="group-settings-overlay"
@@ -6989,13 +6987,13 @@ ${String(e||"").trim()}
6989
6987
  </div>
6990
6988
  </div>
6991
6989
  </Teleport>
6992
- `}});function xv(e){let t=String(e||"").trim();return t?t.startsWith("[")&&t.endsWith("]")?Tf(t.slice(1,-1)).map(s=>s.trim().replace(/^["']|["']$/g,"")).map(s=>Mf(s)).filter(Boolean):Tf(t).map(s=>Mf(s.trim())).filter(Boolean):[]}function Tf(e){let t=[],s="",n=0,i="",r=!1;for(let o of String(e||"")){if(r){s+=o,r=!1;continue}if(o==="\\"&&i){s+=o,r=!0;continue}if(i){s+=o,o===i&&(i="");continue}if(o==='"'||o==="'"){i=o,s+=o;continue}if((o==="{"||o==="[")&&(n+=1),(o==="}"||o==="]")&&n>0&&(n-=1),o===","&&n===0){s.trim()&&t.push(s.trim()),s="";continue}s+=o}return s.trim()&&t.push(s.trim()),t}function Mf(e){let t=String(e||"").trim();if(!t||t==="[object Object]")return"";if(t.startsWith("{")&&t.endsWith("}"))try{let s=JSON.parse(t);return String(s.id||s.messageId||s.uuid||"").trim()}catch{return""}return t}function Tv(e){let t={},s=String(e||"").split(/\r?\n/);for(let n of s){let i=n.match(/^([A-Za-z][A-Za-z0-9_-]*):\s*(.*)$/);if(!i)continue;let r=i[1],o=i[2].trim();r==="tags"||r==="sourceMessages"?t[r]=xv(o):t[r]=o.replace(/^["']|["']$/g,"")}return t}function Mv(e){let t=String(e||"").trim();if(!t)return[];let s=[],n=/(?:^|\n)---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*?)(?=\n---\s*\n|$)/g;for(let i of t.matchAll(n)){let r=i[1].trim(),o=i[2].trim(),a=Tv(r);s.push({id:a.id||`segment-${s.length+1}`,scope:a.scope||"",kind:a.kind||"memory",tags:Array.isArray(a.tags)?a.tags:[],sourceMessages:Array.isArray(a.sourceMessages)?a.sourceMessages:[],createdAt:a.createdAt||"",updatedAt:a.updatedAt||"",content:o,preview:Ws(o,180)})}return s.length?s:[{id:"memory-1",scope:"",kind:"raw",tags:[],sourceMessages:[],createdAt:"",updatedAt:"",content:t,preview:Ws(t,180)}]}function Ws(e,t=160){let s=String(e||"").replace(/\s+/g," ").trim();return s.length<=t?s:`${s.slice(0,t).trim()}...`}function Pv(e){let t=String(e||"").trim();return t?(t.split(/\r?\n/).map(n=>n.trim()).find(Boolean)||"").replace(/^#+\s*/,"").replace(/^[-*]\s*/,"").trim():""}function _v(e){return String(e||"").replace(/\s+/g," ").trim()}function Pf(e,t){return t?.sessionId||String(e||"").replace(/^sessions\//,"")}function Rv(e,t,s){let n=Pf(e,t);return _v(s?.[e]||s?.[n]||t?.sessionTitle||t?.title||t?.name||Pv(t?.summaryText))||n||e}function _f(e,t){let s=String(t||"").trim().toLowerCase();return s?(Array.isArray(e)?e:[]).filter(n=>[n.title,n.scope,n.sessionId,n.status,n.summaryPreview,n.snapshot?.summaryText].map(r=>String(r||"").toLowerCase()).join(`
6993
- `).includes(s)):Array.isArray(e)?e:[]}function Rf({latest:e={},snapshots:t={},promptLoads:s={},events:n=[],sessionTitles:i={}}={}){let r=new Set([...Object.keys(e||{}),...Object.keys(t||{}),...Object.keys(s||{})]);for(let o of Array.isArray(n)?n:[])o?.scope&&r.add(o.scope);return Array.from(r).map(o=>{let a=t?.[o]||null,l=e?.[o]||null,c=a?.lastError||l?.error||null,d=l?.status||(c?"error":a?.hasOutput?"completed":"never-ran"),u=s?.[o]||null,p=(Array.isArray(n)?n:[]).filter(y=>y?.scope===o),f=p[p.length-1]||null,g=l?.finishedAt||l?.startedAt||a?.lastDreamAt||f?.at||a?.loadedAt||"",v=Mv(a?.memoryText||""),m=Pf(o,a),A=Rv(o,a,i),w=c?Ws(c.message||c.error||c.raw||"",180):"",k=Ws(w||a?.summaryText||a?.memoryText||f?.detail||"",180);return{key:o,title:A,scope:o,sessionId:m,status:d,lastAt:g,latestRun:l,snapshot:a,lastError:c,promptLoad:u,events:p,segmentCount:v.length,segments:v,summaryPreview:k,subtitle:k,hasRequestResponse:p.some(y=>y?.request||y?.response||y?.systemPrompt||y?.rawRequest||y?.rawResponse)}}).sort((o,a)=>String(a.lastAt||"").localeCompare(String(o.lastAt||"")))}var Df=H(()=>{});var ur,Dv,Ef,Lf=H(()=>{Df();to();ur=1,Dv=5,Ef={name:"YeaftDebugPanel",emits:["close"],data(){return{expandedTurns:{},expandedLoops:{},expandedSections:{},expandedToolDetails:{},copiedFlash:null,copiedFlashAt:0,_expandSnapshot:null,dreamExpanded:!1,expandedDreamEvents:{},expandedDreamSegments:{},activeDreamItemKey:null,dreamItemSearch:"",activeTab:"requests"}},watch:{searchQuery(e,t){let s=!!(t&&t.trim()),n=!!(e&&e.trim());if(!s&&n){this._expandSnapshot={turns:{...this.expandedTurns},loops:{...this.expandedLoops}};let i={},r={};for(let o of this.turns)i[o.turnId]=!0,o.loops&&o.loops.length>0&&(r[`${o.turnId}#${o.loops[0].loopNumber}`]=!0);this.expandedTurns=i,this.expandedLoops=r}else if(s&&!n&&this._expandSnapshot)this.expandedTurns=this._expandSnapshot.turns,this.expandedLoops=this._expandSnapshot.loops,this._expandSnapshot=null;else if(n){let i={...this.expandedTurns};for(let r of this.turns)i[r.turnId]===void 0&&(i[r.turnId]=!0);this.expandedTurns=i}},"store.currentAgent"(e,t){e&&e!==t&&this.store&&typeof this.store.loadYeaftDebugHistory=="function"&&this.store.loadYeaftDebugHistory({limit:ur,dreamLimit:5,indexOnly:!0})}},computed:{store(){return window.Pinia?.useChatStore?.()||null},sessionsStore(){return window.Pinia?.useSessionsStore?.()||null},turns(){return(this.store&&this.store.yeaftDebugTurnsForActiveSession||[]).map(t=>this.decorateTurnTokenBreakdowns(t))},searchQuery:{get(){return this.store&&this.store.yeaftDebugSearch||""},set(e){this.store&&this.store.setYeaftDebugSearch(e)}},sessionFilter:{get(){if(!this.store)return"";let e=this.store.yeaftDebugSessionFilter;return e??""},set(e){this.store&&(e?this.store.setYeaftDebugSessionFilter(e):this.store.setYeaftDebugSessionFilter(null))}},availableSessions(){return this.store&&this.store.yeaftDebugAvailableSessions||[]},turnTotal(){return this.store&&this.store.yeaftDebugTurnTotal||0},showingMatchedHint(){return this.turnTotal>this.turns.length},requestHistoryLoading(){return!!this.store?.yeaftDebugHistoryLoading},requestHistoryError(){return this.store?.yeaftDebugHistoryError||""},toolStats(){return this.store?.yeaftToolStats||null},toolStatsLoading(){return!!this.store?.yeaftToolStatsLoading},rankedToolRows(){let e=this.toolStats?.snapshot||{},t=Object.entries(e).map(([i,r])=>({name:i,...r})),s=new Set(t.map(i=>i.name)),n=Array.isArray(this.toolStats?.registered)?this.toolStats.registered:[];for(let i of n)typeof i!="string"||!i||s.has(i)||(t.push({name:i,callCount:0,errorCount:0,errorRate:0,avgMs:0,p50Ms:0,p95Ms:0,lastCalledAt:null,lastError:null}),s.add(i));return t.sort((i,r)=>{let o=(r.callCount||0)-(i.callCount||0);return o!==0?o:i.name.localeCompare(r.name)}),t},unusedToolRows(){return Array.isArray(this.toolStats?.unused)?this.toolStats.unused:[]},toolStatsFetchedAtLabel(){let e=this.toolStats?.fetchedAt;if(!e)return"";try{return new Date(e).toLocaleTimeString()}catch{return""}},dreamLatest(){return this.store&&this.store.yeaftDreamLatestForActiveSession||null},dreamLatestLabel(){let e=this.dreamLatest;if(!e)return"";if(e.status==="running")return`running \xB7 ${e.phase||"..."}`;if(e.status==="error")return`error \xB7 ${e.error||"unknown"}`;if(e.status==="skipped")return"skipped";let t=["done"];typeof e.mergedCount=="number"&&t.push(`merged ${e.mergedCount}`);let s=this.formatDreamMetrics(e);return s&&t.push(s),t.join(" \xB7 ")},dreamLatestKindLabel(){let e=this.dreamLatest;return e?e.manual?"manual":"auto":""},dreamSnapshot(){return this.store&&this.store.yeaftDreamSnapshotForActiveSession||null},dreamPromptLoad(){return this.store&&this.store.yeaftDreamPromptLoadForActiveSession||null},dreamPromptLoadSummary(){let e=this.dreamPromptLoad,t=e&&typeof e.summary=="string"?e.summary.trim():"";return t&&e.truncated?`${t}
6990
+ `}});function Av(e){let t=String(e||"").trim();return t?t.startsWith("[")&&t.endsWith("]")?Tf(t.slice(1,-1)).map(s=>s.trim().replace(/^["']|["']$/g,"")).map(s=>Mf(s)).filter(Boolean):Tf(t).map(s=>Mf(s.trim())).filter(Boolean):[]}function Tf(e){let t=[],s="",n=0,i="",r=!1;for(let o of String(e||"")){if(r){s+=o,r=!1;continue}if(o==="\\"&&i){s+=o,r=!0;continue}if(i){s+=o,o===i&&(i="");continue}if(o==='"'||o==="'"){i=o,s+=o;continue}if((o==="{"||o==="[")&&(n+=1),(o==="}"||o==="]")&&n>0&&(n-=1),o===","&&n===0){s.trim()&&t.push(s.trim()),s="";continue}s+=o}return s.trim()&&t.push(s.trim()),t}function Mf(e){let t=String(e||"").trim();if(!t||t==="[object Object]")return"";if(t.startsWith("{")&&t.endsWith("}"))try{let s=JSON.parse(t);return String(s.id||s.messageId||s.uuid||"").trim()}catch{return""}return t}function xv(e){let t={},s=String(e||"").split(/\r?\n/);for(let n of s){let i=n.match(/^([A-Za-z][A-Za-z0-9_-]*):\s*(.*)$/);if(!i)continue;let r=i[1],o=i[2].trim();r==="tags"||r==="sourceMessages"?t[r]=Av(o):t[r]=o.replace(/^["']|["']$/g,"")}return t}function Tv(e){let t=String(e||"").trim();if(!t)return[];let s=[],n=/(?:^|\n)---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*?)(?=\n---\s*\n|$)/g;for(let i of t.matchAll(n)){let r=i[1].trim(),o=i[2].trim(),a=xv(r);s.push({id:a.id||`segment-${s.length+1}`,scope:a.scope||"",kind:a.kind||"memory",tags:Array.isArray(a.tags)?a.tags:[],sourceMessages:Array.isArray(a.sourceMessages)?a.sourceMessages:[],createdAt:a.createdAt||"",updatedAt:a.updatedAt||"",content:o,preview:Ws(o,180)})}return s.length?s:[{id:"memory-1",scope:"",kind:"raw",tags:[],sourceMessages:[],createdAt:"",updatedAt:"",content:t,preview:Ws(t,180)}]}function Ws(e,t=160){let s=String(e||"").replace(/\s+/g," ").trim();return s.length<=t?s:`${s.slice(0,t).trim()}...`}function Mv(e){let t=String(e||"").trim();return t?(t.split(/\r?\n/).map(n=>n.trim()).find(Boolean)||"").replace(/^#+\s*/,"").replace(/^[-*]\s*/,"").trim():""}function Pv(e){return String(e||"").replace(/\s+/g," ").trim()}function Pf(e,t){return t?.sessionId||String(e||"").replace(/^sessions\//,"")}function Rv(e,t,s){let n=Pf(e,t);return Pv(s?.[e]||s?.[n]||t?.sessionTitle||t?.title||t?.name||Mv(t?.summaryText))||n||e}function Rf(e,t){let s=String(t||"").trim().toLowerCase();return s?(Array.isArray(e)?e:[]).filter(n=>[n.title,n.scope,n.sessionId,n.status,n.summaryPreview,n.snapshot?.summaryText].map(r=>String(r||"").toLowerCase()).join(`
6991
+ `).includes(s)):Array.isArray(e)?e:[]}function _f({latest:e={},snapshots:t={},promptLoads:s={},events:n=[],sessionTitles:i={}}={}){let r=new Set([...Object.keys(e||{}),...Object.keys(t||{}),...Object.keys(s||{})]);for(let o of Array.isArray(n)?n:[])o?.scope&&r.add(o.scope);return Array.from(r).map(o=>{let a=t?.[o]||null,l=e?.[o]||null,c=a?.lastError||l?.error||null,d=l?.status||(c?"error":a?.hasOutput?"completed":"never-ran"),u=s?.[o]||null,p=(Array.isArray(n)?n:[]).filter(y=>y?.scope===o),f=p[p.length-1]||null,g=l?.finishedAt||l?.startedAt||a?.lastDreamAt||f?.at||a?.loadedAt||"",v=Tv(a?.memoryText||""),m=Pf(o,a),A=Rv(o,a,i),w=c?Ws(c.message||c.error||c.raw||"",180):"",k=Ws(w||a?.summaryText||a?.memoryText||f?.detail||"",180);return{key:o,title:A,scope:o,sessionId:m,status:d,lastAt:g,latestRun:l,snapshot:a,lastError:c,promptLoad:u,events:p,segmentCount:v.length,segments:v,summaryPreview:k,subtitle:k,hasRequestResponse:p.some(y=>y?.request||y?.response||y?.systemPrompt||y?.rawRequest||y?.rawResponse)}}).sort((o,a)=>String(a.lastAt||"").localeCompare(String(o.lastAt||"")))}var Df=H(()=>{});var ur,_v,Ef,Lf=H(()=>{Df();to();ur=1,_v=5,Ef={name:"YeaftDebugPanel",emits:["close"],data(){return{expandedTurns:{},expandedLoops:{},expandedSections:{},expandedToolDetails:{},copiedFlash:null,copiedFlashAt:0,_expandSnapshot:null,dreamExpanded:!1,expandedDreamEvents:{},expandedDreamSegments:{},activeDreamItemKey:null,dreamItemSearch:"",activeTab:"requests"}},watch:{searchQuery(e,t){let s=!!(t&&t.trim()),n=!!(e&&e.trim());if(!s&&n){this._expandSnapshot={turns:{...this.expandedTurns},loops:{...this.expandedLoops}};let i={},r={};for(let o of this.turns)i[o.turnId]=!0,o.loops&&o.loops.length>0&&(r[`${o.turnId}#${o.loops[0].loopNumber}`]=!0);this.expandedTurns=i,this.expandedLoops=r}else if(s&&!n&&this._expandSnapshot)this.expandedTurns=this._expandSnapshot.turns,this.expandedLoops=this._expandSnapshot.loops,this._expandSnapshot=null;else if(n){let i={...this.expandedTurns};for(let r of this.turns)i[r.turnId]===void 0&&(i[r.turnId]=!0);this.expandedTurns=i}},"store.currentAgent"(e,t){e&&e!==t&&this.store&&typeof this.store.loadYeaftDebugHistory=="function"&&this.store.loadYeaftDebugHistory({limit:ur,dreamLimit:5,indexOnly:!0})}},computed:{store(){return window.Pinia?.useChatStore?.()||null},sessionsStore(){return window.Pinia?.useSessionsStore?.()||null},turns(){return(this.store&&this.store.yeaftDebugTurnsForActiveSession||[]).map(t=>this.decorateTurnTokenBreakdowns(t))},searchQuery:{get(){return this.store&&this.store.yeaftDebugSearch||""},set(e){this.store&&this.store.setYeaftDebugSearch(e)}},sessionFilter:{get(){if(!this.store)return"";let e=this.store.yeaftDebugSessionFilter;return e??""},set(e){this.store&&(e?this.store.setYeaftDebugSessionFilter(e):this.store.setYeaftDebugSessionFilter(null))}},availableSessions(){return this.store&&this.store.yeaftDebugAvailableSessions||[]},turnTotal(){return this.store&&this.store.yeaftDebugTurnTotal||0},showingMatchedHint(){return this.turnTotal>this.turns.length},requestHistoryLoading(){return!!this.store?.yeaftDebugHistoryLoading},requestHistoryError(){return this.store?.yeaftDebugHistoryError||""},toolStats(){return this.store?.yeaftToolStats||null},toolStatsLoading(){return!!this.store?.yeaftToolStatsLoading},rankedToolRows(){let e=this.toolStats?.snapshot||{},t=Object.entries(e).map(([i,r])=>({name:i,...r})),s=new Set(t.map(i=>i.name)),n=Array.isArray(this.toolStats?.registered)?this.toolStats.registered:[];for(let i of n)typeof i!="string"||!i||s.has(i)||(t.push({name:i,callCount:0,errorCount:0,errorRate:0,avgMs:0,p50Ms:0,p95Ms:0,lastCalledAt:null,lastError:null}),s.add(i));return t.sort((i,r)=>{let o=(r.callCount||0)-(i.callCount||0);return o!==0?o:i.name.localeCompare(r.name)}),t},unusedToolRows(){return Array.isArray(this.toolStats?.unused)?this.toolStats.unused:[]},toolStatsFetchedAtLabel(){let e=this.toolStats?.fetchedAt;if(!e)return"";try{return new Date(e).toLocaleTimeString()}catch{return""}},dreamLatest(){return this.store&&this.store.yeaftDreamLatestForActiveSession||null},dreamLatestLabel(){let e=this.dreamLatest;if(!e)return"";if(e.status==="running")return`running \xB7 ${e.phase||"..."}`;if(e.status==="error")return`error \xB7 ${e.error||"unknown"}`;if(e.status==="skipped")return"skipped";let t=["done"];typeof e.mergedCount=="number"&&t.push(`merged ${e.mergedCount}`);let s=this.formatDreamMetrics(e);return s&&t.push(s),t.join(" \xB7 ")},dreamLatestKindLabel(){let e=this.dreamLatest;return e?e.manual?"manual":"auto":""},dreamSnapshot(){return this.store&&this.store.yeaftDreamSnapshotForActiveSession||null},dreamPromptLoad(){return this.store&&this.store.yeaftDreamPromptLoadForActiveSession||null},dreamPromptLoadSummary(){let e=this.dreamPromptLoad,t=e&&typeof e.summary=="string"?e.summary.trim():"";return t&&e.truncated?`${t}
6994
6992
  ... truncated`:t},dreamSnapshotSummary(){let e=this.dreamSnapshot,t=e&&typeof e.summaryText=="string"?e.summaryText.trim():"";return t&&e.summaryTruncated?`${t}
6995
6993
  ... truncated`:t},dreamSnapshotMemory(){let e=this.dreamSnapshot,t=e&&typeof e.memoryText=="string"?e.memoryText.trim():"";return t&&e.memoryTruncated?`${t}
6996
- ... truncated`:t},dreamEvents(){let e=this.store&&this.store.yeaftDreamEventsForActiveSession||[];return Array.isArray(e)?e:[]},dreamEventCount(){return this.dreamEvents.length},dreamSessionTitles(){let e={},t=(i,r)=>{let o=String(r||"").trim();i&&o&&(e[i]=o)},s=this.sessionsStore?.sessions||{};for(let i of Object.values(s))!i||!i.id||(t(i.id,i.name||i.title),t(`sessions/${i.id}`,i.name||i.title));let n=this.store?.yeaftActiveSessionFilter;return n&&t(n,this.store?.yeaftActiveSessionName||this.store?.currentSessionTitle),e},allDreamItems(){let e=this.store||{},t=e.yeaftDreamEvents||{},s=Object.values(t).flatMap(n=>Array.isArray(n)?n:[]);return Rf({latest:e.yeaftDreamLatest||{},snapshots:e.yeaftDreamSnapshots||{},promptLoads:e.yeaftDreamPromptLoads||{},events:s,sessionTitles:this.dreamSessionTitles})},dreamItems(){return _f(this.allDreamItems,this.dreamItemSearch)},activeDreamItem(){return this.activeDreamItemKey&&this.dreamItems.find(e=>e.key===this.activeDreamItemKey)||null},activeDreamRequestEvents(){let e=this.activeDreamItem;return e?e.events.filter(t=>t&&(t.request||t.response||t.rawRequest||t.rawResponse||t.systemPrompt||this.dreamLoopUserContent(t))):[]}},mounted(){this.store&&typeof this.store.loadYeaftDebugHistory=="function"&&this.store.loadYeaftDebugHistory({limit:ur,dreamLimit:5,indexOnly:!0})},methods:{debugSessionId(e){return this.formatDebugSessionId(e&&(e.sessionId||e.groupId)||"")},debugDreamSessionId(e){return this.formatDebugSessionId(e&&(e.sessionId||e.groupId)||"")},formatDebugSessionId(e){let t=String(e||"");return t.startsWith("grp_")?t.slice(4):t},toggleTurn(e){let t=!this.expandedTurns[e];this.expandedTurns={...this.expandedTurns,[e]:t},t&&this.ensureRequestDetailLoaded(e)},debugLoopsForTurn(e){return(Array.isArray(this.store?.yeaftDebugLoops)?this.store.yeaftDebugLoops:[]).filter(s=>s&&s.turnId===e)},debugTurnNeedsDetailLoad(e){if(!e||!e.turnId)return!1;if(!e.detailsLoaded)return!0;let t=this.debugLoopsForTurn(e.turnId),s=Math.max(0,Number(e.loopCount||0)),n=new Set;for(let r of t){let o=Number(r?.loopNumber||0);Number.isFinite(o)&&o>0&&n.add(o)}if((n.size>0?Math.max(...n):0)>n.size||s>t.length)return!0;for(let r=1;r<=s;r++)if(!n.has(r))return!0;return!1},ensureRequestDetailLoaded(e){let t=this.store?.yeaftDebugTurnsById?.[e];!t||!this.store||typeof this.store.loadYeaftDebugHistory!="function"||this.debugTurnNeedsDetailLoad(t)&&this.store.loadYeaftDebugHistory({limit:ur,dreamLimit:0,detailTurnId:e,groupId:t.sessionId||null})},toggleDream(){this.dreamExpanded=!this.dreamExpanded},dreamEventDetail(e){if(!e)return"";let t=e.phase||"unknown",s=[],n=!0;if(t==="start")s.push(e.manual?"manual trigger":"auto trigger");else if(t==="load-diff")this.debugDreamSessionId(e)&&s.push(`session ${this.debugDreamSessionId(e)}`);else if(t==="triage")typeof e.segments=="number"&&s.push(`${e.segments} segs`),typeof e.actions=="number"&&s.push(`${e.actions} actions`),e.status&&s.push(e.status);else if(t==="merge")typeof e.targets=="number"&&s.push(`${e.targets} targets`);else if(t==="apply")e.target&&s.push(e.target),e.status&&s.push(e.status),typeof e.mergedCount=="number"&&s.push(`merged ${e.mergedCount}`);else if(t==="done"){let i=typeof e.sessions=="number"?e.sessions:e.groups;typeof i=="number"&&s.push(`${i} sessions`),typeof e.targets=="number"&&s.push(`${e.targets} targets`),typeof e.duration=="number"&&s.push(this.formatMs(e.duration))}else t==="result"?(s.push(e.success?"success":"error"),typeof e.entriesCreated=="number"&&s.push(`entries ${e.entriesCreated}`),this.formatDreamMetrics(e)&&s.push(this.formatDreamMetrics(e)),!e.success&&e.error&&s.push(e.error),e.skipped&&s.push(`skipped: ${e.skippedReason||"unknown"}`)):n=!1;if(!n||s.length===0){let i=new Set(["type","phase","sessionId","groupId","target","ts","at"]);for(let[r,o]of Object.entries(e))i.has(r)||o!=null&&typeof o!="object"&&s.push(`${r}=${o}`)}return e.error&&!s.includes(e.error)&&s.unshift(`error: ${e.error}`),s.join(" \xB7 ")},dreamEventStatus(e){return e?e.status==="skipped"||e.skipped?"skipped":e.status==="error"||e.phase==="error"?"error":e.status==="done"||e.status==="success"||e.phase==="done"?"success":e.phase==="result"?e.success?"success":"error":"running":"running"},dreamEventTrigger(e){return e?e.trigger?e.trigger:e.source?e.source:e.manual===!0?"manual":e.manual===!1?"auto":"-":"-"},dreamEventCall(e){if(!e)return"-";let t=e.phase||"unknown",s=e.status||"";return t==="start"?"scheduler -> runDream":t==="load-diff"?"runDream -> loadSessionDiff":t==="triage"?s?`triageSessionSegments \xB7 ${s}`:"triageSessionSegments":t==="merge"?"mergeByTarget":t==="apply"?s?`applyMergedTarget \xB7 ${s}`:"applyMergedTarget":t==="done"?"runDream completed":t==="result"?"web-bridge -> yeaft_dream_result":t},dreamEventLocation(e){return e?e.target?e.target:e.scope?e.scope:this.debugDreamSessionId(e)?`session/${this.debugDreamSessionId(e)}`:e.vpId?`vp/${e.vpId}`:"-":"-"},dreamEventResult(e){if(!e)return"-";let t=[];return e.skipped&&t.push(`skipped: ${e.skippedReason||"unknown"}`),e.reason&&t.push(`reason: ${e.reason}`),typeof e.entriesCreated=="number"&&t.push(`entries ${e.entriesCreated}`),typeof e.targetsApplied=="number"&&t.push(`applied ${e.targetsApplied}`),typeof e.sessionsProcessed=="number"&&t.push(`sessions ${e.sessionsProcessed}`),typeof e.sessionsSkipped=="number"&&t.push(`skipped sessions ${e.sessionsSkipped}`),typeof e.segments=="number"&&t.push(`segments ${e.segments}`),typeof e.actions=="number"&&t.push(`actions ${e.actions}`),typeof e.targets=="number"&&t.push(`targets ${e.targets}`),typeof e.duration=="number"&&t.push(this.formatMs(e.duration)),this.formatDreamMetrics(e)&&t.push(this.formatDreamMetrics(e)),Array.isArray(e.targetErrors)&&e.targetErrors.length>0&&t.push(`errors ${e.targetErrors.length}: ${this.truncate(e.targetErrors.map(s=>s.target?`${s.target}: ${s.error}`:s.error).join("; "),160)}`),e.error&&t.push(`error: ${e.error}`),t.length>0?t.join(" \xB7 "):this.dreamEventDetail(e)},dreamEventKind(e){if(!e)return"progress";let t=e.type;return t==="loop"?"loop":t==="turn_close"||t==="dream_turn_close"?"turn_close":t==="dream_run"&&e.phase==="result"?"result":"progress"},isDreamEventExpandable(e){let t=this.dreamEventKind(e);return t==="loop"?!!(e&&(e.systemPrompt||e.response||Array.isArray(e.messages)&&e.messages.length>0)):t==="turn_close"||t==="result"?!!(e&&(e.metrics||e.passBreakdown||e.resultSummary)):t==="progress"?!!(e&&(e.memoryMdPreview||e.summaryMdPreview)):!1},dreamEventKey(e){return e?`${e.at||0}:${e.turnId||""}:${e.phase||e.type||""}`:""},toggleDreamEvent(e){let t=this.dreamEventKey(e);if(!t)return;let s=new Set(this.dreamEvents.map(i=>this.dreamEventKey(i))),n={};for(let[i,r]of Object.entries(this.expandedDreamEvents))s.has(i)&&(n[i]=r);n[t]=!n[t],this.expandedDreamEvents=n},isDreamEventExpanded(e){return!!this.expandedDreamEvents[this.dreamEventKey(e)]},dreamLoopUserContent(e){let t=Array.isArray(e?.messages)?e.messages:[];for(let s of t)if(s&&s.role==="user"){if(typeof s.content=="string")return s.content;if(s.content!=null)return JSON.stringify(s.content,null,2)}return""},formatPassBreakdown(e){if(!e||typeof e!="object")return"";let t=[];for(let[s,n]of Object.entries(e)){if(!n)continue;let i=[s+":"];n.llmCallCount&&i.push(`${n.llmCallCount} call`),n.totalTokens&&i.push(`${this.formatTokens(n.totalTokens)} tok`),n.durationMs&&i.push(this.formatMs(n.durationMs)),t.push(i.join(" "))}return t.join(" \xB7 ")},copyDreamEventAsMarkdown(e){if(!e)return;let t=this.dreamEventKind(e),s=[`# Dream event \xB7 ${t} \xB7 ${e.phase||e.type||"?"}`];if(s.push(`- at: ${this.formatTimestamp(e.at)}`),e.turnId&&s.push(`- turnId: ${e.turnId}`),this.debugDreamSessionId(e)&&s.push(`- sessionId: ${this.debugDreamSessionId(e)}`),e.target&&s.push(`- target: ${e.target}`),t==="loop"){s.push(`- pass: ${e.pass||"-"}`),s.push(`- model: ${e.model||"-"}`),s.push(`- latency: ${this.formatMs(e.latencyMs)}`);let n=e.usage||{};s.push(`- tokens: ${this.formatUsageBreakdown(n)}`),s.push("","## System prompt","```",e.systemPrompt||"","```"),s.push("","## User message","```",this.dreamLoopUserContent(e),"```"),s.push("","## Response","```",e.response||"","```")}else if(t==="turn_close"){s.push(`- loopCount: ${e.loopCount??e.metrics?.llmCallCount??0}`),s.push(`- totalTokens: ${e.totalTokens??e.metrics?.totalTokens??0}`),s.push(`- totalMs: ${e.totalMs??e.metrics?.durationMs??0}`);let n=e.passBreakdown||e.metrics?.passBreakdown;n&&s.push("","## Pass breakdown","```json",JSON.stringify(n,null,2),"```")}else t==="result"?(s.push(`- status: ${e.status||"-"}`),e.error&&s.push(`- error: ${e.error}`),e.resultSummary&&s.push("","## Result summary","```json",JSON.stringify(e.resultSummary,null,2),"```"),e.metrics&&s.push("","## Metrics","```json",JSON.stringify(e.metrics,null,2),"```")):(e.memoryMdPreview&&s.push("","## memory.md (preview)","```",e.memoryMdPreview,"```"),e.summaryMdPreview&&s.push("","## summary.md (preview)","```",e.summaryMdPreview,"```"),!e.memoryMdPreview&&!e.summaryMdPreview&&s.push("","## Raw","```json",JSON.stringify(e,null,2),"```"));this.copyText(s.join(`
6994
+ ... truncated`:t},dreamEvents(){let e=this.store&&this.store.yeaftDreamEventsForActiveSession||[];return Array.isArray(e)?e:[]},dreamEventCount(){return this.dreamEvents.length},dreamSessionTitles(){let e={},t=(i,r)=>{let o=String(r||"").trim();i&&o&&(e[i]=o)},s=this.sessionsStore?.sessions||{};for(let i of Object.values(s))!i||!i.id||(t(i.id,i.name||i.title),t(`sessions/${i.id}`,i.name||i.title));let n=this.store?.yeaftActiveSessionFilter;return n&&t(n,this.store?.yeaftActiveSessionName||this.store?.currentSessionTitle),e},allDreamItems(){let e=this.store||{},t=e.yeaftDreamEvents||{},s=Object.values(t).flatMap(n=>Array.isArray(n)?n:[]);return _f({latest:e.yeaftDreamLatest||{},snapshots:e.yeaftDreamSnapshots||{},promptLoads:e.yeaftDreamPromptLoads||{},events:s,sessionTitles:this.dreamSessionTitles})},dreamItems(){return Rf(this.allDreamItems,this.dreamItemSearch)},activeDreamItem(){return this.activeDreamItemKey&&this.dreamItems.find(e=>e.key===this.activeDreamItemKey)||null},activeDreamRequestEvents(){let e=this.activeDreamItem;return e?e.events.filter(t=>t&&(t.request||t.response||t.rawRequest||t.rawResponse||t.systemPrompt||this.dreamLoopUserContent(t))):[]}},mounted(){this.store&&typeof this.store.loadYeaftDebugHistory=="function"&&this.store.loadYeaftDebugHistory({limit:ur,dreamLimit:5,indexOnly:!0})},methods:{debugSessionId(e){return this.formatDebugSessionId(e&&(e.sessionId||e.groupId)||"")},debugDreamSessionId(e){return this.formatDebugSessionId(e&&(e.sessionId||e.groupId)||"")},formatDebugSessionId(e){let t=String(e||"");return t.startsWith("grp_")?t.slice(4):t},toggleTurn(e){let t=!this.expandedTurns[e];this.expandedTurns={...this.expandedTurns,[e]:t},t&&this.ensureRequestDetailLoaded(e)},debugLoopsForTurn(e){return(Array.isArray(this.store?.yeaftDebugLoops)?this.store.yeaftDebugLoops:[]).filter(s=>s&&s.turnId===e)},debugTurnNeedsDetailLoad(e){if(!e||!e.turnId)return!1;if(!e.detailsLoaded)return!0;let t=this.debugLoopsForTurn(e.turnId),s=Math.max(0,Number(e.loopCount||0)),n=new Set;for(let r of t){let o=Number(r?.loopNumber||0);Number.isFinite(o)&&o>0&&n.add(o)}if((n.size>0?Math.max(...n):0)>n.size||s>t.length)return!0;for(let r=1;r<=s;r++)if(!n.has(r))return!0;return!1},ensureRequestDetailLoaded(e){let t=this.store?.yeaftDebugTurnsById?.[e];!t||!this.store||typeof this.store.loadYeaftDebugHistory!="function"||this.debugTurnNeedsDetailLoad(t)&&this.store.loadYeaftDebugHistory({limit:ur,dreamLimit:0,detailTurnId:e,groupId:t.sessionId||null})},toggleDream(){this.dreamExpanded=!this.dreamExpanded},dreamEventDetail(e){if(!e)return"";let t=e.phase||"unknown",s=[],n=!0;if(t==="start")s.push(e.manual?"manual trigger":"auto trigger");else if(t==="load-diff")this.debugDreamSessionId(e)&&s.push(`session ${this.debugDreamSessionId(e)}`);else if(t==="triage")typeof e.segments=="number"&&s.push(`${e.segments} segs`),typeof e.actions=="number"&&s.push(`${e.actions} actions`),e.status&&s.push(e.status);else if(t==="merge")typeof e.targets=="number"&&s.push(`${e.targets} targets`);else if(t==="apply")e.target&&s.push(e.target),e.status&&s.push(e.status),typeof e.mergedCount=="number"&&s.push(`merged ${e.mergedCount}`);else if(t==="done"){let i=typeof e.sessions=="number"?e.sessions:e.groups;typeof i=="number"&&s.push(`${i} sessions`),typeof e.targets=="number"&&s.push(`${e.targets} targets`),typeof e.duration=="number"&&s.push(this.formatMs(e.duration))}else t==="result"?(s.push(e.success?"success":"error"),typeof e.entriesCreated=="number"&&s.push(`entries ${e.entriesCreated}`),this.formatDreamMetrics(e)&&s.push(this.formatDreamMetrics(e)),!e.success&&e.error&&s.push(e.error),e.skipped&&s.push(`skipped: ${e.skippedReason||"unknown"}`)):n=!1;if(!n||s.length===0){let i=new Set(["type","phase","sessionId","groupId","target","ts","at"]);for(let[r,o]of Object.entries(e))i.has(r)||o!=null&&typeof o!="object"&&s.push(`${r}=${o}`)}return e.error&&!s.includes(e.error)&&s.unshift(`error: ${e.error}`),s.join(" \xB7 ")},dreamEventStatus(e){return e?e.status==="skipped"||e.skipped?"skipped":e.status==="error"||e.phase==="error"?"error":e.status==="done"||e.status==="success"||e.phase==="done"?"success":e.phase==="result"?e.success?"success":"error":"running":"running"},dreamEventTrigger(e){return e?e.trigger?e.trigger:e.source?e.source:e.manual===!0?"manual":e.manual===!1?"auto":"-":"-"},dreamEventCall(e){if(!e)return"-";let t=e.phase||"unknown",s=e.status||"";return t==="start"?"scheduler -> runDream":t==="load-diff"?"runDream -> loadSessionDiff":t==="triage"?s?`triageSessionSegments \xB7 ${s}`:"triageSessionSegments":t==="merge"?"mergeByTarget":t==="apply"?s?`applyMergedTarget \xB7 ${s}`:"applyMergedTarget":t==="done"?"runDream completed":t==="result"?"web-bridge -> yeaft_dream_result":t},dreamEventLocation(e){return e?e.target?e.target:e.scope?e.scope:this.debugDreamSessionId(e)?`session/${this.debugDreamSessionId(e)}`:e.vpId?`vp/${e.vpId}`:"-":"-"},dreamEventResult(e){if(!e)return"-";let t=[];return e.skipped&&t.push(`skipped: ${e.skippedReason||"unknown"}`),e.reason&&t.push(`reason: ${e.reason}`),typeof e.entriesCreated=="number"&&t.push(`entries ${e.entriesCreated}`),typeof e.targetsApplied=="number"&&t.push(`applied ${e.targetsApplied}`),typeof e.sessionsProcessed=="number"&&t.push(`sessions ${e.sessionsProcessed}`),typeof e.sessionsSkipped=="number"&&t.push(`skipped sessions ${e.sessionsSkipped}`),typeof e.segments=="number"&&t.push(`segments ${e.segments}`),typeof e.actions=="number"&&t.push(`actions ${e.actions}`),typeof e.targets=="number"&&t.push(`targets ${e.targets}`),typeof e.duration=="number"&&t.push(this.formatMs(e.duration)),this.formatDreamMetrics(e)&&t.push(this.formatDreamMetrics(e)),Array.isArray(e.targetErrors)&&e.targetErrors.length>0&&t.push(`errors ${e.targetErrors.length}: ${this.truncate(e.targetErrors.map(s=>s.target?`${s.target}: ${s.error}`:s.error).join("; "),160)}`),e.error&&t.push(`error: ${e.error}`),t.length>0?t.join(" \xB7 "):this.dreamEventDetail(e)},dreamEventKind(e){if(!e)return"progress";let t=e.type;return t==="loop"?"loop":t==="turn_close"||t==="dream_turn_close"?"turn_close":t==="dream_run"&&e.phase==="result"?"result":"progress"},isDreamEventExpandable(e){let t=this.dreamEventKind(e);return t==="loop"?!!(e&&(e.systemPrompt||e.response||Array.isArray(e.messages)&&e.messages.length>0)):t==="turn_close"||t==="result"?!!(e&&(e.metrics||e.passBreakdown||e.resultSummary)):t==="progress"?!!(e&&(e.memoryMdPreview||e.summaryMdPreview)):!1},dreamEventKey(e){return e?`${e.at||0}:${e.turnId||""}:${e.phase||e.type||""}`:""},toggleDreamEvent(e){let t=this.dreamEventKey(e);if(!t)return;let s=new Set(this.dreamEvents.map(i=>this.dreamEventKey(i))),n={};for(let[i,r]of Object.entries(this.expandedDreamEvents))s.has(i)&&(n[i]=r);n[t]=!n[t],this.expandedDreamEvents=n},isDreamEventExpanded(e){return!!this.expandedDreamEvents[this.dreamEventKey(e)]},dreamLoopUserContent(e){let t=Array.isArray(e?.messages)?e.messages:[];for(let s of t)if(s&&s.role==="user"){if(typeof s.content=="string")return s.content;if(s.content!=null)return JSON.stringify(s.content,null,2)}return""},formatPassBreakdown(e){if(!e||typeof e!="object")return"";let t=[];for(let[s,n]of Object.entries(e)){if(!n)continue;let i=[s+":"];n.llmCallCount&&i.push(`${n.llmCallCount} call`),n.totalTokens&&i.push(`${this.formatTokens(n.totalTokens)} tok`),n.durationMs&&i.push(this.formatMs(n.durationMs)),t.push(i.join(" "))}return t.join(" \xB7 ")},copyDreamEventAsMarkdown(e){if(!e)return;let t=this.dreamEventKind(e),s=[`# Dream event \xB7 ${t} \xB7 ${e.phase||e.type||"?"}`];if(s.push(`- at: ${this.formatTimestamp(e.at)}`),e.turnId&&s.push(`- turnId: ${e.turnId}`),this.debugDreamSessionId(e)&&s.push(`- sessionId: ${this.debugDreamSessionId(e)}`),e.target&&s.push(`- target: ${e.target}`),t==="loop"){s.push(`- pass: ${e.pass||"-"}`),s.push(`- model: ${e.model||"-"}`),s.push(`- latency: ${this.formatMs(e.latencyMs)}`);let n=e.usage||{};s.push(`- tokens: ${this.formatUsageBreakdown(n)}`),s.push("","## System prompt","```",e.systemPrompt||"","```"),s.push("","## User message","```",this.dreamLoopUserContent(e),"```"),s.push("","## Response","```",e.response||"","```")}else if(t==="turn_close"){s.push(`- loopCount: ${e.loopCount??e.metrics?.llmCallCount??0}`),s.push(`- totalTokens: ${e.totalTokens??e.metrics?.totalTokens??0}`),s.push(`- totalMs: ${e.totalMs??e.metrics?.durationMs??0}`);let n=e.passBreakdown||e.metrics?.passBreakdown;n&&s.push("","## Pass breakdown","```json",JSON.stringify(n,null,2),"```")}else t==="result"?(s.push(`- status: ${e.status||"-"}`),e.error&&s.push(`- error: ${e.error}`),e.resultSummary&&s.push("","## Result summary","```json",JSON.stringify(e.resultSummary,null,2),"```"),e.metrics&&s.push("","## Metrics","```json",JSON.stringify(e.metrics,null,2),"```")):(e.memoryMdPreview&&s.push("","## memory.md (preview)","```",e.memoryMdPreview,"```"),e.summaryMdPreview&&s.push("","## summary.md (preview)","```",e.summaryMdPreview,"```"),!e.memoryMdPreview&&!e.summaryMdPreview&&s.push("","## Raw","```json",JSON.stringify(e,null,2),"```"));this.copyText(s.join(`
6997
6995
  `),"dream event")},toggleLoop(e,t){let s=`${e}#${t}`;this.expandedLoops={...this.expandedLoops,[s]:!this.expandedLoops[s]}},toggleSection(e,t){let s=`${e}#${t}`;this.expandedSections={...this.expandedSections,[s]:!this.expandedSections[s]}},isLoopExpanded(e,t){return!!this.expandedLoops[`${e}#${t}`]},isSectionExpanded(e,t){return!!this.expandedSections[`${e}#${t}`]},formatMs(e){return e==null?"-":e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`},formatTokens(e){let t=Number(e)||0;return t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)},usageTotalInputTokens(e){let t=e||{};return Number.isFinite(Number(t.totalInputTokens))?Number(t.totalInputTokens):(Number(t.inputTokens)||0)+(Number(t.cacheReadTokens)||0)+(Number(t.cacheWriteTokens)||0)},usageTotalTokens(e){let t=e||{};return Number.isFinite(Number(t.totalTokens))?Number(t.totalTokens):this.usageTotalInputTokens(t)+(Number(t.outputTokens)||0)},formatUsageBreakdown(e){let t=e||{},s=Number(t.cacheReadTokens)||0,n=Number(t.cacheWriteTokens)||0,i=this.usageTotalInputTokens(t),r=Number(t.outputTokens)||0,o=this.usageTotalTokens(t),a=`${i} in / ${r} out / ${o} total`;return(s||n)&&(i===(Number(t.inputTokens)||0)?a+=` (input includes cache read ${s}, cache write ${n})`:a+=` (fresh ${Number(t.inputTokens)||0}, cache read ${s}, cache write ${n})`),a},formatDreamMetrics(e){if(!e)return"";let t=[];return typeof e.durationMs=="number"&&t.push(this.formatMs(e.durationMs)),typeof e.llmCallCount=="number"&&t.push(`${e.llmCallCount} LLM calls`),typeof e.totalTokens=="number"&&t.push(`${this.formatTokens(e.totalTokens)} tok`),t.join(" \xB7 ")},formatTimestamp(e){if(!e)return"";try{return new Date(e).toLocaleTimeString()}catch{return""}},formatClock(e){return Zl(e)},loopClockTime(e,t){if(t&&typeof t.at=="number")return this.formatClock(t.at);if(!e||typeof e.openedAt!="number")return"";let s=e.loops||[],n=0;for(let i of s)if(i){if(i===t||i.loopNumber===t.loopNumber)break;Number.isFinite(i.latencyMs)&&(n+=i.latencyMs)}return Number.isFinite(t.latencyMs)&&(n+=t.latencyMs),this.formatClock(e.openedAt+n)},loopTokenBreakdown(e){if(!e)return{inputMessage:0,inputTool:0,outputMessage:0,outputTool:0,inputTotal:0,outputTotal:0,total:0};let t=Xl(e),s=e.usage||{},n=Math.max(0,this.usageTotalInputTokens(s)),i=Math.max(0,Number(s.outputTokens)||0),r=Math.max(0,this.usageTotalTokens(s)||n+i),o=eo(n,t.inputMessageTokens,t.inputToolTokens),a=eo(i,t.outputMessageTokens,t.outputToolTokens);return{inputMessage:o.message,inputTool:o.tool,outputMessage:a.message,outputTool:a.tool,inputTotal:n,outputTotal:i,total:r}},decorateTurnTokenBreakdowns(e){if(!e)return e;let t={inputMessage:0,inputTool:0,outputMessage:0,outputTool:0,inputTotal:0,outputTotal:0,total:0},s=(e&&e.loops||[]).map(o=>{let a=this.loopTokenBreakdown(o);return t.inputMessage+=a.inputMessage,t.inputTool+=a.inputTool,t.outputMessage+=a.outputMessage,t.outputTool+=a.outputTool,t.inputTotal+=a.inputTotal,t.outputTotal+=a.outputTotal,t.total+=a.total,{...o,tokenBreakdown:a}});s.length===0&&(t.inputTotal=Math.max(0,Number(e.summaryInputTokens)||0),t.outputTotal=Math.max(0,Number(e.summaryOutputTokens)||0),t.total=t.inputTotal+t.outputTotal);let n=s.reduce((o,a)=>(Number(a?.tokenBreakdown?.total)||0)>(Number(o?.tokenBreakdown?.total)||0)?a:o,null),i={...t,messageTotal:t.inputMessage+t.outputMessage,toolTotal:t.inputTool+t.outputTool},r=Math.max(Number(e.totalTokens)||0,i.total||0);if(r>i.total){let o=r-i.total;i.total=r,i.inputTotal+=o,i.inputMessage+=o,i.messageTotal+=o}return{...e,loops:s,tokenBreakdown:i,maxLoopTokenBreakdown:n?.tokenBreakdown||null,maxLoopTokenTotal:Number(n?.tokenBreakdown?.total)||0,maxLoopNumber:n?.loopNumber||null}},turnTotalTokens(e){return Math.max(Number(e?.totalTokens)||0,Number(e?.tokenBreakdown?.total)||0)},loopBreakdownMessageTokens(e){return(Number(e?.inputMessage)||0)+(Number(e?.outputMessage)||0)},loopBreakdownToolTokens(e){return(Number(e?.inputTool)||0)+(Number(e?.outputTool)||0)},loopMessageTokens(e){return this.loopBreakdownMessageTokens(e?.tokenBreakdown||{})},loopToolTokens(e){return this.loopBreakdownToolTokens(e?.tokenBreakdown||{})},tokenPct(e,t){let s=Number(e)||0,n=Number(t)||0;return n<=0||s<=0?"0%":`${Math.round(s/n*100)}%`},tokenBreakdownTitle(e){let t=e||{},s=(Number(t.inputMessage)||0)+(Number(t.outputMessage)||0),n=(Number(t.inputTool)||0)+(Number(t.outputTool)||0),i=Math.max(Number(t.total)||0,s+n);return`estimated token split: message ${s} (${this.tokenPct(s,i)}), tool ${n} (${this.tokenPct(n,i)}); input ${Number(t.inputTotal)||0}, output ${Number(t.outputTotal)||0}, total ${i}`},truncate(e,t){let s=String(e||"");return s.length<=t?s:s.slice(0,t)+"\u2026"},toolsForLoop(e,t){let s=typeof t=="object"?t:(e?.loops||[]).find(l=>l&&l.loopNumber===t)||{loopNumber:t},n=s?.loopNumber||0,i=(e&&e.tools||[]).filter(l=>l&&l.loopNumber===n),r=new Set,o=Array.isArray(s?.toolCalls)?s.toolCalls:[],a=[];for(let l=0;l<o.length;l++){let c=o[l]||{},d=c.id||c.callId||c.tool_call_id||null,u=d?i.findIndex((f,g)=>!r.has(g)&&f.callId===d):-1;u<0&&(u=i.findIndex((f,g)=>!r.has(g)&&!f.callId&&f.name===c.name));let p=u>=0?i[u]:null;u>=0&&r.add(u),a.push(this.normalizeToolDebugRow(n,c,p,l))}for(let l=0;l<i.length;l++)r.has(l)||a.push(this.normalizeToolDebugRow(n,null,i[l],a.length));return a},normalizeToolDebugRow(e,t,s,n){let i=!!s,r=t&&Object.prototype.hasOwnProperty.call(t,"input")?t.input:void 0,o=t&&(t.id||t.callId||t.tool_call_id)||s?.callId||null,a=t&&t.name||s?.name||"?";return{loopNumber:e,index:n,callId:o,name:a,input:r,rawCall:t||null,rawResult:s||null,hasResult:i,isRunning:!i,isError:!!s?.isError,durationMs:s?.durationMs||0,toolOutput:s?.toolOutput==null?null:String(s.toolOutput)}},toolDetailKey(e,t,s,n=0){return`${e}#${t}#${s?.callId||s?.name||"tool"}#${n}`},isToolDetailExpanded(e,t,s,n){return!!this.expandedToolDetails[this.toolDetailKey(e,t,s,n)]},toggleToolDetail(e,t,s,n){let i=this.toolDetailKey(e,t,s,n);this.expandedToolDetails={...this.expandedToolDetails,[i]:!this.expandedToolDetails[i]}},toolStatusClass(e){return e?.isRunning?"running":e?.isError?"err":"ok"},toolStatusLabel(e){return e?.isRunning?this.$t?this.$t("yeaft.debugToolRunning"):"running":e?.isError?"\u2717":"\u2713"},toolInputText(e){return e?e.input!==void 0?JSON.stringify(e.input??null,null,2):e.rawCall?JSON.stringify(e.rawCall,null,2):JSON.stringify(e.rawResult||e,null,2):""},toolOutputText(e){return e?e.isRunning?this.$t?this.$t("yeaft.debugToolRunningNoResult"):"Running; no result yet":e.toolOutput!=null?e.toolOutput:e.rawResult?JSON.stringify(e.rawResult,null,2):"":""},reflectionsForLoop(e,t){return(e&&e.reflections||[]).filter(n=>n&&(n.loopNumber===t||n.loopNumber==null&&t===e.loopCount))},loopMetaSummary(e){let t=(e.toolCalls||[]).length;return t>0?`tools\xD7${t}`:"end_turn"},assistantResponseForLoop(e){if(!e)return"";if(e.response)return typeof e.response=="string"?e.response:JSON.stringify(e.response,null,2);let t=Array.isArray(e.messages)?e.messages:[];for(let s=t.length-1;s>=0;s--){let n=t[s];if(!(!n||n.role!=="assistant")){if(typeof n.content=="string")return n.content;if(Array.isArray(n.content)){let i=n.content.map(r=>r?typeof r=="string"?r:typeof r.text=="string"?r.text:"":"").filter(Boolean);if(i.length>0)return i.join(`
6998
- `)}if(n.content!=null)return JSON.stringify(n.content,null,2)}}return""},showAssistantResponse(e,t){let s=`${e}#${t}`,n=`${e}#asst-${t}`;this.expandedLoops={...this.expandedLoops,[s]:!0},this.expandedSections={...this.expandedSections,[n]:!0}},setActiveDreamItem(e){this.activeDreamItemKey=this.activeDreamItemKey===e?null:e||null},isDreamSegmentExpanded(e){return!!this.expandedDreamSegments[e?.id]},toggleDreamSegment(e){e?.id&&(this.expandedDreamSegments={...this.expandedDreamSegments,[e.id]:!this.expandedDreamSegments[e.id]})},dreamPreview(e,t=180){return Ws(e,t)},formatDebugValue(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2)},setActiveTab(e){this.activeTab=e==="toolStats"||e==="dream"?e:"requests",this.activeTab==="toolStats"&&!this.toolStats&&!this.toolStatsLoading&&this.refreshToolStats(),this.activeTab==="requests"&&this.turns.length===0&&!this.requestHistoryLoading&&this.loadRequestHistory()},loadRequestHistory(){if(!this.store||typeof this.store.loadYeaftDebugHistory!="function")return;let e=String(this.searchQuery||"").trim();this.store.loadYeaftDebugHistory({limit:e?Dv:ur,dreamLimit:5,indexOnly:!0,search:e})},refreshToolStats(){this.store&&typeof this.store.fetchYeaftToolStats=="function"&&this.store.fetchYeaftToolStats()},formatPct(e){return!Number.isFinite(e)||e===0?"0%":`${(e*100).toFixed(1)}%`},formatLastCalled(e){if(typeof e!="string"||!e)return"never";let t=Date.parse(e);if(Number.isNaN(t))return e;let s=Date.now()-t;return s<6e4?"just now":s<36e5?`${Math.floor(s/6e4)}m ago`:s<864e5?`${Math.floor(s/36e5)}h ago`:`${Math.floor(s/864e5)}d ago`},copyText(e,t){let s=e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2);try{if(navigator&&navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(s);else{let n=document.createElement("textarea");n.value=s,n.style.position="fixed",n.style.left="-9999px",document.body.appendChild(n),n.select();try{document.execCommand("copy")}catch{}document.body.removeChild(n)}this.copiedFlash=t||"copied",this.copiedFlashAt=Date.now(),setTimeout(()=>{Date.now()-this.copiedFlashAt>=1400&&(this.copiedFlash=null)},1500)}catch{}},copyToolInput(e,t){if(t&&(t.input!==void 0||t.rawCall||t.rawResult)){this.copyText(this.toolInputText(t),"tool input");return}for(let s of e.loops||[])for(let n of s.toolCalls||[])if(n&&n.id===t.callId){this.copyText(JSON.stringify(n.input??null,null,2),"tool input");return}this.copyText(JSON.stringify(t,null,2),"tool record")},copyRawRequest(e){this.copyText(this.rawRequestForLoop(e),"raw request")},rawRequestForLoop(e){return e?.rawRequest!=null?e.rawRequest:Ql(e?.rawRequestBase??e?.requestBase?.rawRequest??null,e?.requestDelta||null)},copyToolOutput(e,t){if(t&&(t.isRunning||t.rawResult||t.toolOutput!=null)){this.copyText(this.toolOutputText(t),"tool output");return}if(t&&t.toolOutput!=null){this.copyText(t.toolOutput,"tool output");return}for(let s of e.loops||[])for(let n of s.messages||[])if(n&&n.role==="tool"&&n.toolCallId===t.callId){this.copyText(typeof n.content=="string"?n.content:JSON.stringify(n.content,null,2),"tool output");return}this.copyText("(tool output not in snapshot)","tool output")},copyTurnAsMarkdown(e){let t=[];if(t.push(`# Turn ${e.turnId}`),t.push(""),t.push(`- VP: ${e.vpId||"-"}`),t.push(`- Session: ${this.debugSessionId(e)||"-"}`),t.push(`- Loops: ${e.loopCount||e.loops&&e.loops.length||0}`),t.push(`- Total: ${this.formatMs(e.totalMs)} / ${this.formatTokens(e.totalTokens)} tok`),t.push(""),t.push("## User prompt"),t.push(""),t.push("```"),t.push(e.userPrompt||""),t.push("```"),t.push(""),e.memoryLoaded&&e.memoryLoaded.length>0){t.push(`## Memory loaded (${e.memoryLoaded.length})`);for(let n of e.memoryLoaded)t.push(`- ${n.id||"?"} score=${n.score==null?"-":n.score.toFixed(3)} kind=${n.kind||"-"}`);t.push("")}if(e.memoryAdjust){let n=e.memoryAdjust;t.push(`## Memory adjust (reason: ${n.reason||"-"})`),t.push(`- added: ${n.added||0}`),t.push(`- evicted: ${n.evicted||0}`),t.push(`- skipped: ${n.skipped||0}`),t.push("")}let s=e.loops||[];for(let n of s){t.push(`## Loop ${n.loopNumber} ${n.model}`);let i=n.usage||{};t.push(`- in/out/total: ${this.formatUsageBreakdown(i)}`),t.push(`- latency: ${this.formatMs(n.latencyMs)} ttfb: ${this.formatMs(n.ttfbMs)}`),t.push(`- stopReason: ${n.stopReason||"-"}`);let r=this.toolsForLoop(e,n.loopNumber);if(r.length>0){t.push(""),t.push(`### Tools (${r.length})`);for(let a of r){let l=a.isRunning?"running":a.isError?"ERROR":"ok";t.push(`- ${a.name} ${l} ${a.isRunning?"-":this.formatMs(a.durationMs)}`)}}let o=this.assistantResponseForLoop(n);o&&(t.push(""),t.push("### Assistant text"),t.push("```"),t.push(o),t.push("```")),t.push("")}this.copyText(t.join(`
6996
+ `)}if(n.content!=null)return JSON.stringify(n.content,null,2)}}return""},showAssistantResponse(e,t){let s=`${e}#${t}`,n=`${e}#asst-${t}`;this.expandedLoops={...this.expandedLoops,[s]:!0},this.expandedSections={...this.expandedSections,[n]:!0}},setActiveDreamItem(e){this.activeDreamItemKey=this.activeDreamItemKey===e?null:e||null},isDreamSegmentExpanded(e){return!!this.expandedDreamSegments[e?.id]},toggleDreamSegment(e){e?.id&&(this.expandedDreamSegments={...this.expandedDreamSegments,[e.id]:!this.expandedDreamSegments[e.id]})},dreamPreview(e,t=180){return Ws(e,t)},formatDebugValue(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2)},setActiveTab(e){this.activeTab=e==="toolStats"||e==="dream"?e:"requests",this.activeTab==="toolStats"&&!this.toolStats&&!this.toolStatsLoading&&this.refreshToolStats(),this.activeTab==="requests"&&this.turns.length===0&&!this.requestHistoryLoading&&this.loadRequestHistory()},loadRequestHistory(){if(!this.store||typeof this.store.loadYeaftDebugHistory!="function")return;let e=String(this.searchQuery||"").trim();this.store.loadYeaftDebugHistory({limit:e?_v:ur,dreamLimit:5,indexOnly:!0,search:e})},refreshToolStats(){this.store&&typeof this.store.fetchYeaftToolStats=="function"&&this.store.fetchYeaftToolStats()},formatPct(e){return!Number.isFinite(e)||e===0?"0%":`${(e*100).toFixed(1)}%`},formatLastCalled(e){if(typeof e!="string"||!e)return"never";let t=Date.parse(e);if(Number.isNaN(t))return e;let s=Date.now()-t;return s<6e4?"just now":s<36e5?`${Math.floor(s/6e4)}m ago`:s<864e5?`${Math.floor(s/36e5)}h ago`:`${Math.floor(s/864e5)}d ago`},copyText(e,t){let s=e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2);try{if(navigator&&navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(s);else{let n=document.createElement("textarea");n.value=s,n.style.position="fixed",n.style.left="-9999px",document.body.appendChild(n),n.select();try{document.execCommand("copy")}catch{}document.body.removeChild(n)}this.copiedFlash=t||"copied",this.copiedFlashAt=Date.now(),setTimeout(()=>{Date.now()-this.copiedFlashAt>=1400&&(this.copiedFlash=null)},1500)}catch{}},copyToolInput(e,t){if(t&&(t.input!==void 0||t.rawCall||t.rawResult)){this.copyText(this.toolInputText(t),"tool input");return}for(let s of e.loops||[])for(let n of s.toolCalls||[])if(n&&n.id===t.callId){this.copyText(JSON.stringify(n.input??null,null,2),"tool input");return}this.copyText(JSON.stringify(t,null,2),"tool record")},copyRawRequest(e){this.copyText(this.rawRequestForLoop(e),"raw request")},rawRequestForLoop(e){return e?.rawRequest!=null?e.rawRequest:Ql(e?.rawRequestBase??e?.requestBase?.rawRequest??null,e?.requestDelta||null)},copyToolOutput(e,t){if(t&&(t.isRunning||t.rawResult||t.toolOutput!=null)){this.copyText(this.toolOutputText(t),"tool output");return}if(t&&t.toolOutput!=null){this.copyText(t.toolOutput,"tool output");return}for(let s of e.loops||[])for(let n of s.messages||[])if(n&&n.role==="tool"&&n.toolCallId===t.callId){this.copyText(typeof n.content=="string"?n.content:JSON.stringify(n.content,null,2),"tool output");return}this.copyText("(tool output not in snapshot)","tool output")},copyTurnAsMarkdown(e){let t=[];if(t.push(`# Turn ${e.turnId}`),t.push(""),t.push(`- VP: ${e.vpId||"-"}`),t.push(`- Session: ${this.debugSessionId(e)||"-"}`),t.push(`- Loops: ${e.loopCount||e.loops&&e.loops.length||0}`),t.push(`- Total: ${this.formatMs(e.totalMs)} / ${this.formatTokens(e.totalTokens)} tok`),t.push(""),t.push("## User prompt"),t.push(""),t.push("```"),t.push(e.userPrompt||""),t.push("```"),t.push(""),e.memoryLoaded&&e.memoryLoaded.length>0){t.push(`## Memory loaded (${e.memoryLoaded.length})`);for(let n of e.memoryLoaded)t.push(`- ${n.id||"?"} score=${n.score==null?"-":n.score.toFixed(3)} kind=${n.kind||"-"}`);t.push("")}if(e.memoryAdjust){let n=e.memoryAdjust;t.push(`## Memory adjust (reason: ${n.reason||"-"})`),t.push(`- added: ${n.added||0}`),t.push(`- evicted: ${n.evicted||0}`),t.push(`- skipped: ${n.skipped||0}`),t.push("")}let s=e.loops||[];for(let n of s){t.push(`## Loop ${n.loopNumber} ${n.model}`);let i=n.usage||{};t.push(`- in/out/total: ${this.formatUsageBreakdown(i)}`),t.push(`- latency: ${this.formatMs(n.latencyMs)} ttfb: ${this.formatMs(n.ttfbMs)}`),t.push(`- stopReason: ${n.stopReason||"-"}`);let r=this.toolsForLoop(e,n.loopNumber);if(r.length>0){t.push(""),t.push(`### Tools (${r.length})`);for(let a of r){let l=a.isRunning?"running":a.isError?"ERROR":"ok";t.push(`- ${a.name} ${l} ${a.isRunning?"-":this.formatMs(a.durationMs)}`)}}let o=this.assistantResponseForLoop(n);o&&(t.push(""),t.push("### Assistant text"),t.push("```"),t.push(o),t.push("```")),t.push("")}this.copyText(t.join(`
6999
6997
  `),"turn markdown")}},template:`
7000
6998
  <div class="yeaft-debug-panel">
7001
6999
  <div class="yeaft-debug-header">
@@ -7477,9 +7475,9 @@ ${String(e||"").trim()}
7477
7475
  <span v-else>{{ requestHistoryLoading ? $t('yeaft.debugHistoryLoading') : $t('yeaft.noDebugData') }}</span>
7478
7476
  </div>
7479
7477
  </div>
7480
- `}});function Ff(e,t){if(!e||e.kind!=="sub_agent")return"";let s=typeof t=="function"?t:u=>u,n=typeof e.log?.preview=="string"?e.log.preview:"",i=[],r="",o="",a=0,l=()=>{let u=Vf(o);u&&i.push(s("yeaft.sessionStatus.task.subAgentEvent",{name:r||s("yeaft.sessionStatus.task.kind.subAgent"),text:u})),r="",o=""},c=()=>{r="",o=""};for(let u of n.split(/\r?\n/)){let p=Ev(u);if(p){if(p.type==="text_delta"){r=p.agentName||p.agentId||r,o+=p.text||p.content||p.delta||"";continue}if(p.type==="tool_use"||p.type==="tool_call"){a+=1;continue}if(p.type==="sub_agent_turn_end"){c();let f=$f(p,s);f&&i.push(f);continue}if(p.type==="error"){l();let f=$f(p,s);f&&i.push(f)}}}l();let d=$v(a,s);return d&&i.push(d),i.join(`
7481
- `)}function Vv(e,t){if(!e||e.kind!=="sub_agent")return[];let s=typeof t=="function"?t:l=>l,n=Lv(e.result?.summary),i=s("yeaft.sessionStatus.task.kind.subAgent"),r=e.agentName||e.agentId||i,o=n?[s("yeaft.sessionStatus.task.subAgentResult",{name:r,text:n})]:[],a=Ff(e,t).split(`
7482
- `).filter(Boolean).filter(l=>!o.includes(l));return[...o,...a]}var Ev,Lv,Vf,$v,$f,Hf,Of=H(()=>{zo();Ev=e=>{if(typeof e!="string")return null;let t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{return JSON.parse(t)}catch{return null}},Lv=(e,t=360)=>{if(typeof e!="string")return"";let s=e.trim().replace(/\s+/g," ");return s.length>t?s.slice(0,t-1)+"\u2026":s},Vf=e=>typeof e!="string"?"":e.trim(),$v=(e,t)=>{let s=Number(e||0);return!Number.isFinite(s)||s<=0?"":(typeof t=="function"?t:i=>i)("yeaft.sessionStatus.task.subAgentToolSummary",{count:s})},$f=(e,t)=>{if(!e||typeof e!="object")return"";let s=typeof t=="function"?t:i=>i,n=e.agentName||e.agentId||s("yeaft.sessionStatus.task.kind.subAgent");if(e.type==="sub_agent_turn_end"){let i=Vf(e.content||e.text);return i?s("yeaft.sessionStatus.task.subAgentResult",{name:n,text:i}):""}if(e.type==="error"){let i=e.error&&(e.error.message||e.error);return i?s("yeaft.sessionStatus.task.subAgentError",{name:n,error:i}):s("yeaft.sessionStatus.task.subAgentHitError",{name:n})}return""};Hf={name:"VpTimelinePane",components:{TerminalOutput:Pi},emits:["mention-vp","edit-vp","start-resize","cancel-vp-turn","edit-announcement","cancel-task","close"],props:{rows:{type:Array,required:!0},tasks:{type:Array,default:()=>[]},announcementText:{type:String,default:""},stoppingTasksById:{type:Object,default:()=>({})}},template:`
7478
+ `}});function Ff(e,t){if(!e||e.kind!=="sub_agent")return"";let s=typeof t=="function"?t:u=>u,n=typeof e.log?.preview=="string"?e.log.preview:"",i=[],r="",o="",a=0,l=()=>{let u=Vf(o);u&&i.push(s("yeaft.sessionStatus.task.subAgentEvent",{name:r||s("yeaft.sessionStatus.task.kind.subAgent"),text:u})),r="",o=""},c=()=>{r="",o=""};for(let u of n.split(/\r?\n/)){let p=Dv(u);if(p){if(p.type==="text_delta"){r=p.agentName||p.agentId||r,o+=p.text||p.content||p.delta||"";continue}if(p.type==="tool_use"||p.type==="tool_call"){a+=1;continue}if(p.type==="sub_agent_turn_end"){c();let f=$f(p,s);f&&i.push(f);continue}if(p.type==="error"){l();let f=$f(p,s);f&&i.push(f)}}}l();let d=Lv(a,s);return d&&i.push(d),i.join(`
7479
+ `)}function $v(e,t){if(!e||e.kind!=="sub_agent")return[];let s=typeof t=="function"?t:l=>l,n=Ev(e.result?.summary),i=s("yeaft.sessionStatus.task.kind.subAgent"),r=e.agentName||e.agentId||i,o=n?[s("yeaft.sessionStatus.task.subAgentResult",{name:r,text:n})]:[],a=Ff(e,t).split(`
7480
+ `).filter(Boolean).filter(l=>!o.includes(l));return[...o,...a]}var Dv,Ev,Vf,Lv,$f,Hf,Of=H(()=>{zo();Dv=e=>{if(typeof e!="string")return null;let t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{return JSON.parse(t)}catch{return null}},Ev=(e,t=360)=>{if(typeof e!="string")return"";let s=e.trim().replace(/\s+/g," ");return s.length>t?s.slice(0,t-1)+"\u2026":s},Vf=e=>typeof e!="string"?"":e.trim(),Lv=(e,t)=>{let s=Number(e||0);return!Number.isFinite(s)||s<=0?"":(typeof t=="function"?t:i=>i)("yeaft.sessionStatus.task.subAgentToolSummary",{count:s})},$f=(e,t)=>{if(!e||typeof e!="object")return"";let s=typeof t=="function"?t:i=>i,n=e.agentName||e.agentId||s("yeaft.sessionStatus.task.kind.subAgent");if(e.type==="sub_agent_turn_end"){let i=Vf(e.content||e.text);return i?s("yeaft.sessionStatus.task.subAgentResult",{name:n,text:i}):""}if(e.type==="error"){let i=e.error&&(e.error.message||e.error);return i?s("yeaft.sessionStatus.task.subAgentError",{name:n,error:i}):s("yeaft.sessionStatus.task.subAgentHitError",{name:n})}return""};Hf={name:"VpTimelinePane",components:{TerminalOutput:Pi},emits:["mention-vp","edit-vp","start-resize","cancel-vp-turn","edit-announcement","cancel-task","close"],props:{rows:{type:Array,required:!0},tasks:{type:Array,default:()=>[]},announcementText:{type:String,default:""},stoppingTasksById:{type:Object,default:()=>({})}},template:`
7483
7481
  <aside class="yeaft-vp-timeline yeaft-session-status-pane" :aria-label="$t('yeaft.sessionStatus.aria')">
7484
7482
  <div
7485
7483
  class="yeaft-vp-timeline-resize-handle"
@@ -7692,8 +7690,8 @@ ${String(e||"").trim()}
7692
7690
  </section>
7693
7691
  </aside>
7694
7692
  `,setup(e,{emit:t}){let s=window.Pinia&&window.Pinia.useVpStore?window.Pinia.useVpStore():null,n=I=>s&&typeof s.vpTextColor=="function"?s.vpTextColor(I):"var(--text-primary)",i=Vue.getCurrentInstance(),r=i&&i.appContext.config.globalProperties.$t||(I=>I),o=Vue.computed(()=>(typeof e.announcementText=="string"?e.announcementText:"").trim()),a=Vue.computed(()=>!!o.value),l=Vue.computed(()=>{let I=o.value.replace(/\s+/g," ");return I.length<=96?I:I.slice(0,95)+"\u2026"}),c=Vue.ref({}),d=new Map,u=new Map,p=I=>{let M=d.get(I);M&&(M.scrollTop=M.scrollHeight,u.set(I,!0))},f=I=>{let M=!c.value[I];c.value={...c.value,[I]:M},M&&(u.set(I,!0),Vue.nextTick(()=>p(I)))},g=(I,M)=>{M?(d.set(I,M),u.has(I)||u.set(I,!0),Vue.nextTick(()=>{u.get(I)&&p(I)})):d.delete(I)},v=I=>{let M=d.get(I);if(!M)return;let B=M.scrollHeight-M.scrollTop-M.clientHeight;u.set(I,B<8)};Vue.watch(()=>JSON.stringify((Array.isArray(e.tasks)?e.tasks:[]).map(I=>[I.id,I?.log?.preview||""])),()=>Vue.nextTick(()=>{d.forEach((I,M)=>{u.get(M)&&p(M)})}));let m=I=>{let M=I?.ownerVpId||"";return M?s&&typeof s.vpLabel=="function"?s.vpLabel(M):M:"unknown"},A=I=>{if(!I)return"";try{return new Date(I).toLocaleTimeString()}catch{return String(I)}},w=I=>{switch(I?.kind){case"sub_agent":return r("yeaft.sessionStatus.task.kind.subAgent");case"shell":return r("yeaft.sessionStatus.task.kind.shell");default:return I?.kind||""}},k=I=>{let M=I?.runtime?.command;return typeof M=="string"?M.trim():""},y=I=>{let M=[],B=I?.title||I?.id||"",F=k(I);return B&&M.push(`${r("yeaft.sessionStatus.task.title")}: ${B}`),F&&M.push(`${r("yeaft.sessionStatus.task.command")}: ${F}`),M.join(`
7695
- `)},h=I=>`${I?.sessionId||""}::${I?.id||""}`,b=I=>I?.kind==="shell"&&I?.status==="running"&&!!I?.runtime?.pid,_=I=>!!(I?.id&&e.stoppingTasksById?.[h(I)]),L=I=>Vv(I,r),U=I=>Ff(I,r),$=I=>{switch(I.status){case"idle":return r("yeaft.vpTimeline.status.idle");case"typing":return r("yeaft.vpTimeline.status.typing");case"thinking":return r("yeaft.vpTimeline.status.thinking");case"retrying":return r("yeaft.vpTimeline.status.retrying");case"streaming":return r("yeaft.vpTimeline.status.streaming");case"tool":return r("yeaft.vpTimeline.status.tool");case"error":return r("yeaft.vpTimeline.status.error");case"offline":return r("yeaft.vpTimeline.status.offline");default:return I.status}},R=new Set(["typing","thinking","retrying","streaming","tool"]);return{hasAnnouncement:a,announcementPreview:l,statusLabel:$,isActiveStatus:I=>R.has(I),threadCountTitle:I=>{let M=Array.isArray(I&&I.threads)?I.threads:[];return M.length?M.slice(0,5).map(B=>`${B.title||B.threadId||"thread"}: ${B.status||"idle"}`).join(`
7696
- `):""},vpTextColorFor:n,expandedTasks:c,toggleTaskExpanded:f,taskOwnerName:m,formatTaskTime:A,taskKindLabel:w,shellTaskCommand:k,taskSummaryTitle:y,isTaskCancellable:b,isTaskStopping:_,taskDetailLines:L,subAgentTaskStreamText:U,setTaskLogRef:g,onTaskLogScroll:v}}}});var qf,Nf=H(()=>{qf={name:"YeaftSessionActions",emits:["toggle-search","reload-messages","toggle-session-status","toggle-debug","reload-page"],props:{searchOpen:{type:Boolean,default:!1},loadingMoreHistory:{type:Boolean,default:!1},sessionStatusVisible:{type:Boolean,default:!0},debugMode:{type:Boolean,default:!1},showPageReload:{type:Boolean,default:!1}},template:`
7693
+ `)},h=I=>`${I?.sessionId||""}::${I?.id||""}`,b=I=>I?.kind==="shell"&&I?.status==="running"&&!!I?.runtime?.pid,R=I=>!!(I?.id&&e.stoppingTasksById?.[h(I)]),L=I=>$v(I,r),U=I=>Ff(I,r),$=I=>{switch(I.status){case"idle":return r("yeaft.vpTimeline.status.idle");case"typing":return r("yeaft.vpTimeline.status.typing");case"thinking":return r("yeaft.vpTimeline.status.thinking");case"retrying":return r("yeaft.vpTimeline.status.retrying");case"streaming":return r("yeaft.vpTimeline.status.streaming");case"tool":return r("yeaft.vpTimeline.status.tool");case"error":return r("yeaft.vpTimeline.status.error");case"offline":return r("yeaft.vpTimeline.status.offline");default:return I.status}},_=new Set(["typing","thinking","retrying","streaming","tool"]);return{hasAnnouncement:a,announcementPreview:l,statusLabel:$,isActiveStatus:I=>_.has(I),threadCountTitle:I=>{let M=Array.isArray(I&&I.threads)?I.threads:[];return M.length?M.slice(0,5).map(B=>`${B.title||B.threadId||"thread"}: ${B.status||"idle"}`).join(`
7694
+ `):""},vpTextColorFor:n,expandedTasks:c,toggleTaskExpanded:f,taskOwnerName:m,formatTaskTime:A,taskKindLabel:w,shellTaskCommand:k,taskSummaryTitle:y,isTaskCancellable:b,isTaskStopping:R,taskDetailLines:L,subAgentTaskStreamText:U,setTaskLogRef:g,onTaskLogScroll:v}}}});var qf,Nf=H(()=>{qf={name:"YeaftSessionActions",emits:["toggle-search","reload-messages","toggle-session-status","toggle-debug","reload-page"],props:{searchOpen:{type:Boolean,default:!1},loadingMoreHistory:{type:Boolean,default:!1},sessionStatusVisible:{type:Boolean,default:!0},debugMode:{type:Boolean,default:!1},showPageReload:{type:Boolean,default:!1}},template:`
7697
7695
  <div class="yeaft-session-actions">
7698
7696
  <button
7699
7697
  ref="searchButtonRef"
@@ -7757,7 +7755,7 @@ ${String(e||"").trim()}
7757
7755
  </svg>
7758
7756
  </button>
7759
7757
  </div>
7760
- `}});function Bf(e){let t=typeof e=="number"?e:Date.parse(e||"");return Number.isFinite(t)?t:null}function Fv(e){let t=Bf(e);return t===null?"":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t))}function Hv(e){return(Array.isArray(e)?e:[]).map((t,s)=>({result:t,index:s,time:Bf(t?.timestamp),seq:Number.isFinite(t?.seq)?t.seq:null,messageId:String(t?.messageId||"")})).sort((t,s)=>t.time!==null&&s.time===null?-1:t.time===null&&s.time!==null?1:t.time!==null&&t.time!==s.time?s.time-t.time:t.seq!==null&&s.seq===null?-1:t.seq===null&&s.seq!==null?1:t.seq!==null&&t.seq!==s.seq?s.seq-t.seq:s.messageId.localeCompare(t.messageId)||t.index-s.index).map(({result:t})=>t)}var Wf,Uf=H(()=>{Xi();Wf={name:"YeaftConversationOutline",components:{ModernSelect:qs},props:{outlineState:{type:Object,required:!0},searchState:{type:Object,required:!0},senderOptions:{type:Array,default:()=>[]},activeMessageId:{type:String,default:null}},emits:["query","sender","sender-invalid","select","move","preview","load-older","load-more-search","close"],computed:{senderSelectOptions(){return[{value:"",label:this.$t("yeaft.outline.allSenders")},...this.senderOptions.map(e=>({value:e.key,label:e.label}))]}},template:`
7758
+ `}});function Bf(e){let t=typeof e=="number"?e:Date.parse(e||"");return Number.isFinite(t)?t:null}function Vv(e){let t=Bf(e);return t===null?"":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t))}function Fv(e){return(Array.isArray(e)?e:[]).map((t,s)=>({result:t,index:s,time:Bf(t?.timestamp),seq:Number.isFinite(t?.seq)?t.seq:null,messageId:String(t?.messageId||"")})).sort((t,s)=>t.time!==null&&s.time===null?-1:t.time===null&&s.time!==null?1:t.time!==null&&t.time!==s.time?s.time-t.time:t.seq!==null&&s.seq===null?-1:t.seq===null&&s.seq!==null?1:t.seq!==null&&t.seq!==s.seq?s.seq-t.seq:s.messageId.localeCompare(t.messageId)||t.index-s.index).map(({result:t})=>t)}var Wf,Uf=H(()=>{Xi();Wf={name:"YeaftConversationOutline",components:{ModernSelect:qs},props:{outlineState:{type:Object,required:!0},searchState:{type:Object,required:!0},senderOptions:{type:Array,default:()=>[]},activeMessageId:{type:String,default:null}},emits:["query","sender","sender-invalid","select","move","preview","load-older","load-more-search","close"],computed:{senderSelectOptions(){return[{value:"",label:this.$t("yeaft.outline.allSenders")},...this.senderOptions.map(e=>({value:e.key,label:e.label}))]}},template:`
7761
7759
  <section id="yeaft-conversation-outline" class="yeaft-conversation-outline" :aria-label="$t('yeaft.outline.label')">
7762
7760
  <div class="yeaft-conversation-outline-header">
7763
7761
  <div>
@@ -7833,7 +7831,7 @@ ${String(e||"").trim()}
7833
7831
  >{{ $t('yeaft.outline.moreMatches') }}</button>
7834
7832
  </div>
7835
7833
  </section>
7836
- `,setup(e,{emit:t,expose:s}){let n=Vue.ref(null),i=Vue.ref(null),r=Vue.computed(()=>String(e.searchState.query||"").trim().length>=2||!!e.searchState.senderKey);Vue.watch(()=>e.senderOptions.map(w=>w.key),w=>{let k=e.searchState.senderKey||"";k&&!w.includes(k)&&t("sender-invalid")},{flush:"sync"});let o=Vue.computed(()=>Hv(r.value?e.searchState.results:e.outlineState.results)),a=Vue.computed(()=>{let w=o.value.findIndex(k=>k?.messageId===e.activeMessageId);return w>=0?w:0}),l=Vue.computed(()=>r.value?e.searchState.loading:e.outlineState.loading),c=Vue.computed(()=>{if(r.value)return`${e.searchState.results.length}${e.searchState.hasMore?"+":""}`;let w=e.outlineState.totalCount;return Number.isFinite(w)?String(w):String(e.outlineState.results.length||"")}),d=Vue.computed(()=>{let w=r.value?e.searchState.error:e.outlineState.error;return w?w==="unsupported"?"yeaft.outline.unsupported":"yeaft.outline.error":""}),u=()=>Vue.nextTick(()=>{n.value?.focus?.(),i.value&&(i.value.scrollTop=0)}),p=()=>{let w=i.value;t("load-older",{scrollHeight:w?.scrollHeight||0,scrollTop:w?.scrollTop||0})},f=()=>{if(r.value||e.outlineState.loading||!e.outlineState.hasMore)return;let w=i.value;w&&w.scrollHeight-w.scrollTop-w.clientHeight<=40&&p()},g=w=>{t("move",w?.messageId||null),t("preview",w)},v=w=>{let k=Math.max(0,Math.min(o.value.length-1,w)),y=o.value[k];t("move",y?.messageId||null),y&&t("preview",y)},m=w=>{w.key==="Escape"?(w.preventDefault(),t("close")):w.key==="ArrowDown"&&o.value.length?(w.preventDefault(),v(a.value+1)):w.key==="ArrowUp"&&o.value.length?(w.preventDefault(),v(a.value-1)):w.key==="Enter"&&o.value.length&&(w.preventDefault(),t("select",o.value[a.value]||o.value[0]))};return Vue.watch([o,()=>e.activeMessageId],([w,k])=>{w.some(y=>y?.messageId===k)||t("move",w[0]?.messageId||null)},{immediate:!0}),s({focus:u,restoreOlderScroll:({scrollTop:w=0}={})=>Vue.nextTick(()=>{i.value&&(i.value.scrollTop=w)})}),Vue.onMounted(u),{inputRef:n,listRef:i,isSearching:r,visibleResults:o,activeIndex:a,isLoading:l,countLabel:c,errorKey:d,focus:u,loadOlder:p,onScroll:f,onKeyDown:m,previewResult:g,formatOutlineTime:Fv}}}});function Kf(e,t){if(!Array.isArray(e)||e.length===0)return[];let s=new Map;if(Array.isArray(t))for(let r of t)r&&r.vpId&&s.set(r.vpId,r);let n=new Set,i=[];for(let r of e)!r||n.has(r)||(n.add(r),i.push(s.get(r)||{vpId:r}));return i}function Ma(e,t,s=null){return!t||!e?null:typeof e.sessionById=="function"?e.sessionById(t,s||null)||null:e.sessions?.[t]||null}function Ov(e,t){if(!t)return"idle";if(t.connectionState&&t.connectionState!=="connected")return"offline";let s=t.vpStatuses&&t.vpStatuses[e];return s&&s.state?s.state:"idle"}function Yf(e){let{vpList:t,vpStatuses:s,stoppingVpTurnIds:n,connectionState:i,vpLabelOf:r,vpDescriptionOf:o}=e||{},a={vpStatuses:s||{},stoppingVpTurnIds:n||{},connectionState:i||null},l=(p,f)=>{if(typeof r=="function"){let g=r(p);if(g)return g}return f&&(f.displayName||f.displayNameZh)||p},c=(p,f)=>{if(typeof o=="function"){let g=o(p);if(g)return g}return f&&(f.description||f.role||f.descriptionZh||f.roleZh)||""},d=new Set,u=[];if(Array.isArray(t))for(let p of t)!p||!p.vpId||(d.add(p.vpId),u.push(zf(p.vpId,l(p.vpId,p),c(p.vpId,p),a)));if(s)for(let p of Object.keys(s))!p||d.has(p)||(d.add(p),u.push(zf(p,l(p,null),c(p,null),a)));return u}function zf(e,t,s,n){let i=n&&n.vpStatuses&&n.vpStatuses[e];return{vpId:e,displayName:t||e,description:s||"",status:Ov(e,n),turnId:i?.turnId||null,isStopping:!!(i?.turnId&&n?.stoppingVpTurnIds?.[i.turnId]),runningThreadCount:i&&Number.isFinite(i.runningThreadCount)?i.runningThreadCount:0,threads:i&&Array.isArray(i.threads)?i.threads:[]}}var jf=H(()=>{});function pr(e){return!e||typeof e!="object"?"":typeof e.ref=="string"&&e.ref?e.ref:typeof e.provider=="string"&&e.provider&&typeof e.id=="string"&&e.id?`${e.provider}/${e.id}`:typeof e.id=="string"?e.id:""}function Dn(e,t){return!e||!t?!1:e.id===t||pr(e)===t}function Qf(e,t=""){let s=e?.config?.model;return typeof s=="string"&&s.trim()?s.trim():typeof t=="string"&&t.trim()?t.trim():""}function Xf(e){if(!Array.isArray(e))return[];let t=[];for(let s of e){if(typeof s!="string")continue;let n=s.trim();!n||t.includes(n)||t.push(n)}return t}function Pa(e){return Xf(e).filter(t=>(Gf[t]??-1)>=Gf.medium)}function _a(e){let t=Xf(e);return t.length?t.length===1?t[0]:t[t.length-2]:""}function Zf(e,t=""){let s=e?.config?.modelEffort;return typeof s=="string"&&s.trim()?s.trim():typeof t=="string"&&t.trim()?t.trim():""}function Jf(e){let t=[];for(let s of Array.isArray(e)?e:[]){let n=pr(s);if(!n)continue;let i=s.label||s.id||n,r=Pa(s?.effortOptions);t.push({model:s,modelRef:n,label:i,efforts:r,defaultEffort:_a(r)||null})}return t}var Gf,eg=H(()=>{Gf=Object.freeze({minimal:0,low:1,medium:2,high:3,xhigh:4,max:5})});function tg({agentInventoryReady:e=!1,hasYeaftAgent:t=!1,sessionsReady:s=!1,sessionsEmpty:n=!1}={}){return!e||s&&!n?!1:t?s?n:!1:!0}var sg=H(()=>{});function ng({activeSessionFilter:e=null,sessionsStore:t=null,topbarGroup:s=null}={}){return e||t?.activeSessionId||s?.id||null}function ig(e={}){return e.currentAgentInfo?.online?!0:Array.isArray(e.agents)&&e.agents.some(t=>t&&t.online)}var rg=H(()=>{});function og(e={}){return!e?.warning}var ag=H(()=>{});function dg(e,t){return e&&t?`${e}:${t}`:""}function ug(e){if(e!==void 0)return e;try{return globalThis.localStorage}catch{return null}}function pg(e){try{let t=JSON.parse(e?.getItem(Ra)||"{}");return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function qv({agentId:e,sessionId:t,validKeys:s=[],storage:n}={}){let i=dg(e,t);if(!i)return"";let r=ug(n),o=pg(r),a=typeof o[i]=="string"?o[i]:"";if(!a||s.includes(a))return a;delete o[i];try{r?.setItem(Ra,JSON.stringify(o))}catch{}return""}function lg({agentId:e,sessionId:t,senderKey:s,storage:n}={}){let i=dg(e,t);if(!i)return!1;let r=ug(n);if(!r)return!1;let o=pg(r);s?o[i]=s:delete o[i];try{return r.setItem(Ra,JSON.stringify(o)),!0}catch{return!1}}function cg(e){let t=e?.updatedAt||e?.endedAt||e?.createdAt,s=t?Date.parse(t):NaN;return Number.isFinite(s)?s:0}function Nv(e){return Object.values(e||{}).filter(Boolean).sort((t,s)=>t.status==="running"&&s.status!=="running"?-1:t.status!=="running"&&s.status==="running"?1:cg(s)-cg(t))}var Ra,fg,gg=H(()=>{Bi();Zo();la();Sf();If();rr();xf();aa();Lf();Of();Nf();Uf();Aa();xa();Jo();jf();eg();ls();sg();rg();ag();Xo();Ra="yeaft-history-sender-preferences";fg={name:"YeaftPage",components:{ChatInput:Vs,MessageList:Vi,SettingsPanel:ji,YeaftSidebar:kf,SessionInviteModal:Cf,SessionCreateModal:Bs,SessionSettingsModal:Af,WorkbenchPanel:Yi,WorkCenterPage:dr,YeaftDebugPanel:Ef,VpTimelinePane:Hf,YeaftSessionActions:qf,YeaftConversationOutline:Wf,LlmTab:cr},template:`
7834
+ `,setup(e,{emit:t,expose:s}){let n=Vue.ref(null),i=Vue.ref(null),r=Vue.computed(()=>String(e.searchState.query||"").trim().length>=2||!!e.searchState.senderKey);Vue.watch(()=>e.senderOptions.map(w=>w.key),w=>{let k=e.searchState.senderKey||"";k&&!w.includes(k)&&t("sender-invalid")},{flush:"sync"});let o=Vue.computed(()=>Fv(r.value?e.searchState.results:e.outlineState.results)),a=Vue.computed(()=>{let w=o.value.findIndex(k=>k?.messageId===e.activeMessageId);return w>=0?w:0}),l=Vue.computed(()=>r.value?e.searchState.loading:e.outlineState.loading),c=Vue.computed(()=>{if(r.value)return`${e.searchState.results.length}${e.searchState.hasMore?"+":""}`;let w=e.outlineState.totalCount;return Number.isFinite(w)?String(w):String(e.outlineState.results.length||"")}),d=Vue.computed(()=>{let w=r.value?e.searchState.error:e.outlineState.error;return w?w==="unsupported"?"yeaft.outline.unsupported":"yeaft.outline.error":""}),u=()=>Vue.nextTick(()=>{n.value?.focus?.(),i.value&&(i.value.scrollTop=0)}),p=()=>{let w=i.value;t("load-older",{scrollHeight:w?.scrollHeight||0,scrollTop:w?.scrollTop||0})},f=()=>{if(r.value||e.outlineState.loading||!e.outlineState.hasMore)return;let w=i.value;w&&w.scrollHeight-w.scrollTop-w.clientHeight<=40&&p()},g=w=>{t("move",w?.messageId||null),t("preview",w)},v=w=>{let k=Math.max(0,Math.min(o.value.length-1,w)),y=o.value[k];t("move",y?.messageId||null),y&&t("preview",y)},m=w=>{w.key==="Escape"?(w.preventDefault(),t("close")):w.key==="ArrowDown"&&o.value.length?(w.preventDefault(),v(a.value+1)):w.key==="ArrowUp"&&o.value.length?(w.preventDefault(),v(a.value-1)):w.key==="Enter"&&o.value.length&&(w.preventDefault(),t("select",o.value[a.value]||o.value[0]))};return Vue.watch([o,()=>e.activeMessageId],([w,k])=>{w.some(y=>y?.messageId===k)||t("move",w[0]?.messageId||null)},{immediate:!0}),s({focus:u,restoreOlderScroll:({scrollTop:w=0}={})=>Vue.nextTick(()=>{i.value&&(i.value.scrollTop=w)})}),Vue.onMounted(u),{inputRef:n,listRef:i,isSearching:r,visibleResults:o,activeIndex:a,isLoading:l,countLabel:c,errorKey:d,focus:u,loadOlder:p,onScroll:f,onKeyDown:m,previewResult:g,formatOutlineTime:Vv}}}});function Kf(e,t){if(!Array.isArray(e)||e.length===0)return[];let s=new Map;if(Array.isArray(t))for(let r of t)r&&r.vpId&&s.set(r.vpId,r);let n=new Set,i=[];for(let r of e)!r||n.has(r)||(n.add(r),i.push(s.get(r)||{vpId:r}));return i}function Ma(e,t,s=null){return!t||!e?null:typeof e.sessionById=="function"?e.sessionById(t,s||null)||null:e.sessions?.[t]||null}function Hv(e,t){if(!t)return"idle";if(t.connectionState&&t.connectionState!=="connected")return"offline";let s=t.vpStatuses&&t.vpStatuses[e];return s&&s.state?s.state:"idle"}function Yf(e){let{vpList:t,vpStatuses:s,stoppingVpTurnIds:n,connectionState:i,vpLabelOf:r,vpDescriptionOf:o}=e||{},a={vpStatuses:s||{},stoppingVpTurnIds:n||{},connectionState:i||null},l=(p,f)=>{if(typeof r=="function"){let g=r(p);if(g)return g}return f&&(f.displayName||f.displayNameZh)||p},c=(p,f)=>{if(typeof o=="function"){let g=o(p);if(g)return g}return f&&(f.description||f.role||f.descriptionZh||f.roleZh)||""},d=new Set,u=[];if(Array.isArray(t))for(let p of t)!p||!p.vpId||(d.add(p.vpId),u.push(zf(p.vpId,l(p.vpId,p),c(p.vpId,p),a)));if(s)for(let p of Object.keys(s))!p||d.has(p)||(d.add(p),u.push(zf(p,l(p,null),c(p,null),a)));return u}function zf(e,t,s,n){let i=n&&n.vpStatuses&&n.vpStatuses[e];return{vpId:e,displayName:t||e,description:s||"",status:Hv(e,n),turnId:i?.turnId||null,isStopping:!!(i?.turnId&&n?.stoppingVpTurnIds?.[i.turnId]),runningThreadCount:i&&Number.isFinite(i.runningThreadCount)?i.runningThreadCount:0,threads:i&&Array.isArray(i.threads)?i.threads:[]}}var jf=H(()=>{});function pr(e){return!e||typeof e!="object"?"":typeof e.ref=="string"&&e.ref?e.ref:typeof e.provider=="string"&&e.provider&&typeof e.id=="string"&&e.id?`${e.provider}/${e.id}`:typeof e.id=="string"?e.id:""}function Dn(e,t){return!e||!t?!1:e.id===t||pr(e)===t}function Qf(e,t=""){let s=e?.config?.model;return typeof s=="string"&&s.trim()?s.trim():typeof t=="string"&&t.trim()?t.trim():""}function Xf(e){if(!Array.isArray(e))return[];let t=[];for(let s of e){if(typeof s!="string")continue;let n=s.trim();!n||t.includes(n)||t.push(n)}return t}function Pa(e){return Xf(e).filter(t=>(Gf[t]??-1)>=Gf.medium)}function Ra(e){let t=Xf(e);return t.length?t.length===1?t[0]:t[t.length-2]:""}function Zf(e,t=""){let s=e?.config?.modelEffort;return typeof s=="string"&&s.trim()?s.trim():typeof t=="string"&&t.trim()?t.trim():""}function Jf(e){let t=[];for(let s of Array.isArray(e)?e:[]){let n=pr(s);if(!n)continue;let i=s.label||s.id||n,r=Pa(s?.effortOptions);t.push({model:s,modelRef:n,label:i,efforts:r,defaultEffort:Ra(r)||null})}return t}var Gf,eg=H(()=>{Gf=Object.freeze({minimal:0,low:1,medium:2,high:3,xhigh:4,max:5})});function tg({agentInventoryReady:e=!1,hasYeaftAgent:t=!1,sessionsReady:s=!1,sessionsEmpty:n=!1}={}){return!e||s&&!n?!1:t?s?n:!1:!0}var sg=H(()=>{});function ng({activeSessionFilter:e=null,sessionsStore:t=null,topbarGroup:s=null}={}){return e||t?.activeSessionId||s?.id||null}function ig(e={}){return e.currentAgentInfo?.online?!0:Array.isArray(e.agents)&&e.agents.some(t=>t&&t.online)}var rg=H(()=>{});function og(e={}){return!e?.warning}var ag=H(()=>{});function dg(e,t){return e&&t?`${e}:${t}`:""}function ug(e){if(e!==void 0)return e;try{return globalThis.localStorage}catch{return null}}function pg(e){try{let t=JSON.parse(e?.getItem(_a)||"{}");return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Ov({agentId:e,sessionId:t,validKeys:s=[],storage:n}={}){let i=dg(e,t);if(!i)return"";let r=ug(n),o=pg(r),a=typeof o[i]=="string"?o[i]:"";if(!a||s.includes(a))return a;delete o[i];try{r?.setItem(_a,JSON.stringify(o))}catch{}return""}function lg({agentId:e,sessionId:t,senderKey:s,storage:n}={}){let i=dg(e,t);if(!i)return!1;let r=ug(n);if(!r)return!1;let o=pg(r);s?o[i]=s:delete o[i];try{return r.setItem(_a,JSON.stringify(o)),!0}catch{return!1}}function cg(e){let t=e?.updatedAt||e?.endedAt||e?.createdAt,s=t?Date.parse(t):NaN;return Number.isFinite(s)?s:0}function qv(e){return Object.values(e||{}).filter(Boolean).sort((t,s)=>t.status==="running"&&s.status!=="running"?-1:t.status!=="running"&&s.status==="running"?1:cg(s)-cg(t))}var _a,fg,gg=H(()=>{Bi();Zo();la();Sf();If();rr();xf();aa();Lf();Of();Nf();Uf();Aa();xa();Jo();jf();eg();ls();sg();rg();ag();Xo();_a="yeaft-history-sender-preferences";fg={name:"YeaftPage",components:{ChatInput:Vs,MessageList:Vi,SettingsPanel:ji,YeaftSidebar:kf,SessionInviteModal:Cf,SessionCreateModal:Bs,SessionSettingsModal:Af,WorkbenchPanel:Yi,WorkCenterPage:dr,YeaftDebugPanel:Ef,VpTimelinePane:Hf,YeaftSessionActions:qf,YeaftConversationOutline:Wf,LlmTab:cr},template:`
7837
7835
  <div class="yeaft-page" ref="pageRef">
7838
7836
  <!-- Mobile sidebar overlay -->
7839
7837
  <div class="yeaft-sidebar-overlay" v-if="store.sessionSidebarOpen && isMobile" @click="store.closeSessionSidebar()"></div>
@@ -8215,11 +8213,11 @@ ${String(e||"").trim()}
8215
8213
  @open-vp-library="openVpLibraryFromGroupSettings"
8216
8214
  />
8217
8215
  </div>
8218
- `,setup(){let e=Pinia.useChatStore(),t=Pinia.useAuthStore(),s=Pinia.useVpStore(),n=Vue.getCurrentInstance(),i=n&&n.appContext.config.globalProperties.$t||(C=>C),r=Vue.ref(!1),o=Vue.ref(!1),a=Vue.ref(!1),l=Vue.ref(!1),c=Vue.ref(!1),d=Vue.ref(""),u=Vue.ref(""),p=Vue.ref(!1),f=Vue.ref(""),g=null,v=Vue.ref("vp"),m=Vue.ref(null),A=Vue.ref(null),w=Vue.ref(null),k=Vue.ref(null),y=Vue.ref(null),h=Vue.ref(null),b=Vue.ref(!1),_=Vue.ref(null),L=Vue.computed(()=>e.getYeaftHistoryOutlineState()),U=Vue.computed(()=>{let C=P(),G=e.yeaftActiveSessionFilter||C?.activeSessionId||null,ce=G?Ma(C,G,e.currentAgent||null):null,Ee=Array.isArray(ce?.roster)?ce.roster:[];return[{key:"user",label:i("yeaft.outline.you")},...Ee.map(Re=>({key:`vp:${Re}`,label:s.vpLabel(Re)}))]}),$=Vue.ref(e.yeaftHistorySearchState?.query||""),R=null,P=()=>{try{return window.Pinia?.useSessionsStore?.()||null}catch{return null}},T=()=>{let C=P();return{agentId:e.currentAgent||null,sessionId:e.yeaftActiveSessionFilter||C?.activeSessionId||null}},I=()=>qv({...T(),validKeys:U.value.map(C=>C.key)}),M=(C="")=>{let{agentId:G,sessionId:ce}=T();e.yeaftHistorySearchState={requestId:null,agentId:G,sessionId:ce,query:"",senderKey:C,loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:null}},B=Vue.computed(()=>{let C=e.currentAgent||"agent",G=P(),ce=e.yeaftActiveSessionFilter||G?.activeSessionId||"session";return`yeaft:${C}:${ce}`});Vue.watch(B,()=>{w.value=null});let F=null,z=null,ne=C=>{if(!C)return!1;let G=String(C.tagName||"").toLowerCase();return G==="textarea"||G==="input"||C.isContentEditable===!0},ve=({recoverScroll:C=!1}={})=>{let G=k.value;if(!G)return;if(!je.value){G.style.removeProperty("--yeaft-visual-viewport-height");return}let ce=window.visualViewport,Ee=Math.max(1,Math.round(ce?.height||window.innerHeight||1));G.style.setProperty("--yeaft-visual-viewport-height",`${Ee}px`),!(!C||ce&&window.innerHeight&&ce.height<window.innerHeight*.85||ne(document.activeElement))&&window.scrollTo(0,0)},ue=(C={})=>{F!=null&&cancelAnimationFrame(F),F=requestAnimationFrame(()=>{F=null,ve(C)})},be=()=>{ue({recoverScroll:!0}),z&&clearTimeout(z),z=setTimeout(()=>{z=null,ue({recoverScroll:!0})},260)},oe=Vue.computed(()=>e.hasCapability("terminal")||e.hasCapability("file_editor")),Ce=Vue.computed(()=>!0),x=C=>{let G=C&&C.id?C.id:null;G&&(e.setActiveSessionFilter(G,{agentId:C.agentId||null}),je.value&&e.closeSessionSidebar())},j=C=>{},ae=Vue.ref(null),he=Vue.ref(!1),W=320,te=Math.max(W,Math.round(window.innerWidth*.25)),Y=localStorage.getItem("yeaft-debug-width"),N=Vue.ref(Y?parseInt(Y,10):te),O=Vue.computed(()=>({"--yeaft-detail-width":N.value+"px"})),E=C=>{he.value=!0;let G=C.clientX,ce=N.value,Ee=window.innerWidth*.6,Re=$t=>{let Vt=G-$t.clientX,ys=Math.min(Ee,Math.max(W,ce+Vt));N.value=ys},Qe=()=>{he.value=!1,document.removeEventListener("mousemove",Re),document.removeEventListener("mouseup",Qe),localStorage.setItem("yeaft-debug-width",String(N.value))};document.addEventListener("mousemove",Re),document.addEventListener("mouseup",Qe)},J="yeaft-session-status-visible",se=()=>{try{let C=localStorage.getItem(J);return!(C==="0"||C==="false")}catch{return!0}},me=Vue.ref(se()),K=C=>{me.value=!!C;try{localStorage.setItem(J,me.value?"1":"0")}catch{}},ee=()=>K(!me.value),fe=()=>K(!1),le=220,_e=280,De=(()=>{try{return localStorage.getItem("yeaft-vp-timeline-width")}catch{return null}})(),Ve=De?parseInt(De,10):NaN,We=Vue.ref(Number.isFinite(Ve)&&Ve>=le?Ve:_e),Mt=Vue.computed(()=>({"--yeaft-vp-timeline-width":We.value+"px"})),pt=C=>{let G=C.clientX,ce=We.value,Ee=Math.max(le,Math.floor(window.innerWidth*.4)),Re=$t=>{let Vt=G-$t.clientX,ys=Math.min(Ee,Math.max(le,ce+Vt));We.value=ys},Qe=()=>{document.removeEventListener("mousemove",Re),document.removeEventListener("mouseup",Qe);try{localStorage.setItem("yeaft-vp-timeline-width",String(We.value))}catch{}};document.addEventListener("mousemove",Re),document.addEventListener("mouseup",Qe)},ft="(max-width: 768px)",Us="(max-width: 1024px)",bt=typeof window.matchMedia=="function"?window.matchMedia(ft):null,He=typeof window.matchMedia=="function"?window.matchMedia(Us):null,Ue=(C,G)=>C?C.matches:window.innerWidth<=G,je=Vue.ref(Ue(bt,768)),Ke=Vue.ref(Ue(He,1024)),Je=Vue.computed(()=>je.value?!e.sessionSidebarOpen:e.sidebarCollapsed),D=()=>{je.value=Ue(bt,768),Ke.value=Ue(He,1024)},Q=()=>{D(),be()},ge=C=>{C&&(typeof C.addEventListener=="function"?C.addEventListener("change",Q):typeof C.addListener=="function"&&C.addListener(Q))},ie=C=>{C&&(typeof C.removeEventListener=="function"?C.removeEventListener("change",Q):typeof C.removeListener=="function"&&C.removeListener(Q))},ye=()=>{R&&(clearTimeout(R),R=null),$.value="",M(I()),b.value=!1,_.value=null},ke=()=>{let C=I();$.value="",M(C),b.value=!0,e.loadYeaftHistoryOutline(),C&&e.searchYeaftHistory("",{senderKey:C}),Vue.nextTick(()=>h.value?.focus?.())},Oe=()=>{b.value?ye():ke()},qe=C=>{b.value&&Fu(C.target)&&ye()},ze=C=>{$.value=C,R&&clearTimeout(R),_.value=null,R=setTimeout(()=>{R=null,e.searchYeaftHistory($.value,{senderKey:e.yeaftHistorySearchState.senderKey})},220)},Pt=C=>{R&&clearTimeout(R),R=null,_.value=null,lg({...T(),senderKey:C}),e.searchYeaftHistory($.value,{senderKey:C})},_t=()=>{lg({...T(),senderKey:""}),_.value=null,e.searchYeaftHistory($.value,{senderKey:""})},gr=C=>{if(!e.loadYeaftHistoryOutline({append:!0}))return;let G=Vue.watch(()=>L.value.loading,ce=>{ce||(G(),h.value?.restoreOlderScroll?.(C))})},mr=()=>e.searchYeaftHistory(e.yeaftHistorySearchState.query,{append:!0,senderKey:e.yeaftHistorySearchState.senderKey}),En=C=>{e.hasCapability("session_history_window_prefetch")&&e.loadYeaftHistoryWindow(C)},hr=C=>Hu({result:C,revealWindow:G=>e.revealYeaftHistoryResult(G),nextTick:()=>Vue.nextTick(),revealMessage:G=>y.value?.revealMessage?.(G),isMobile:je.value,closeOutline:ye}),Ln=C=>{if((C.metaKey||C.ctrlKey)&&String(C.key).toLowerCase()==="f"){C.preventDefault(),ke();return}if(C.key==="Escape"){if(b.value){ye();return}if(o.value){Wt();return}}};Vue.onMounted(()=>{D(),window.addEventListener("resize",Q),ge(bt),ge(He),window.visualViewport?.addEventListener("resize",be),window.visualViewport?.addEventListener("scroll",be),document.addEventListener("click",On),document.addEventListener("click",qe),document.addEventListener("keydown",Ln),ue()}),Vue.onUnmounted(()=>{window.removeEventListener("resize",Q),ie(bt),ie(He),window.visualViewport?.removeEventListener("resize",be),window.visualViewport?.removeEventListener("scroll",be),document.removeEventListener("click",On),document.removeEventListener("click",qe),document.removeEventListener("keydown",Ln),F!=null&&cancelAnimationFrame(F),z&&clearTimeout(z),R&&clearTimeout(R)}),Vue.watch(()=>e.yeaftConversationId,C=>{C&&e.activeConversations[0]!==C&&(e.activeConversations=[C])}),Vue.watch(()=>[e.currentAgent,e.yeaftActiveSessionFilter],()=>{ye(),M(I())});let vr=()=>{e.leaveYeaft()},yr=(C,G,ce)=>{let Ee=P();if(Ee&&Ee.activeNeedsInvite){let Vt=Ee.activeSession;Vt&&Dt.delete(Vt.id);return}let Re=e.yeaftActiveSessionFilter||Ee&&Ee.activeSessionId||"grp_default",Qe=qi(C).mentions,$t=Array.isArray(G)?G:void 0;e.sendYeaftSessionMessage({groupId:Re,text:C,mentions:Qe,attachments:$t,quote:ce})},br=C=>{C&&(w.value=C,A.value?.focusInput?.())},wr=C=>{w.value=null,A.value?.replaceDraft?.(C||"")},zs=()=>{let C=P(),G=e.yeaftActiveSessionFilter||C?.activeSessionId||null;G&&e.cancelYeaftSession(G)},$n=(C="")=>{let G=tt.value;G&&e.enterWorkCenterFromSession(G,C)},Ks=()=>{if(je.value){e.toggleSessionSidebar();return}e.toggleSidebar()},et=()=>{r.value=!r.value},Vn=()=>{r.value=!1},kr=()=>{e.reloadYeaftMessages()},Sr=()=>{if(typeof e.requestYeaftSessionInventory=="function"){e.requestYeaftSessionInventory();return}e._hasHandledAgentList=!1,e._hasHandledYeaftSessionHydrate=!1,e.yeaftSessionHydrateError=null,e.sendWsMessage({type:"get_agents"})},Cr=()=>{window.location.reload()},Ir=Vue.computed(()=>{let C=P(),G=e.yeaftActiveSessionFilter||C?.activeSessionId||null;return G?e.isYeaftSessionProcessing(G,e.currentAgent||null):!1}),tt=Vue.computed(()=>{let C=P();if(!C||!C.sessions)return null;let G=e.yeaftActiveSessionFilter||null;if(G&&typeof C.sessionById=="function"){let ce=C.sessionById(G,e.currentAgent||null);if(ce)return ce}if(C.activeSessionId&&typeof C.sessionById=="function"){let ce=C.sessionById(C.activeSessionId,e.currentAgent||null);if(ce)return ce}return typeof C.sessionById=="function"?C.sessionById("grp_default",e.currentAgent||null):null}),ps=()=>ng({activeSessionFilter:e.yeaftActiveSessionFilter,sessionsStore:P(),topbarGroup:tt.value}),Ar=Vue.computed(()=>{let C=tt.value||{},G=typeof C.id=="string"?C.id.trim():"",ce=[C.title,C.name,C.config?.title,C.config?.name];for(let Ee of ce){let Re=typeof Ee=="string"?Ee.trim():"";if(Re&&!(G&&Re===G)&&!/^(sessions?|groups?)\//i.test(Re)&&!/^session_[A-Za-z0-9_-]+$/.test(Re)&&!(C.workDir&&Re===C.workDir))return Re}return""}),Fn=Vue.computed(()=>tt.value&&typeof tt.value.announcement=="string"?tt.value.announcement:""),fs=Vue.computed(()=>Qf(tt.value,e.yeaftModel||"")),Ys=Vue.computed(()=>{let C=fs.value;return C&&e.yeaftAvailableModels.find(G=>Dn(G,C))||null}),xr=C=>Pa(C?.effortOptions),gs=Vue.computed(()=>Zf(tt.value,e.yeaftModelEffort||"")),Rt=Vue.computed(()=>{let C=Array.isArray(Ys.value?.effortOptions)?Ys.value.effortOptions.filter(Boolean):[];return C.length?C.includes(gs.value)?gs.value:_a(C):null}),Tr=Vue.computed(()=>Jf(e.yeaftAvailableModels)),Mr=(C,G)=>Dn(C,fs.value)?G?G===Rt.value:!xr(C).length:!1,Pr=C=>!C||!Dn(C.model,fs.value)?!1:C.efforts.length?C.efforts.includes(Rt.value):!0,Hn=()=>{o.value=!0},Wt=()=>{o.value=!1},wt=C=>{C.stopPropagation(),e.yeaftAvailableModels.length&&(o.value?Wt():Hn())},js=(C,G=null)=>{if(!C)return;let ce=tt.value?.id||null;e.switchYeaftModel(C,ce,G),Wt()},Ge=C=>!C||!Number.isFinite(C)||C<=0?"":C>=1e6?`${Math.round(C/1e5)/10}m`:C>=1e3?`${Math.round(C/1e3)}k`:String(C),Ut=C=>{let G=Ge(C?.contextWindow),ce=Ge(C?.maxOutput);return G&&ce?`${G} \xB7 ${ce} out`:G},On=C=>{if(!o.value)return;C.target.closest(".yeaft-topbar-model, .yeaft-topbar-model-dropdown")||Wt()},qn=()=>{a.value||(v.value="vp",m.value=null),a.value=!a.value},zt=({initialTab:C="vp",editVpId:G=null}={})=>{v.value=["vp","search","mcp"].includes(C)?C:"vp",m.value=v.value==="vp"&&G||null,a.value=!0},ms=()=>{o.value=!1,l.value=!0},Nn=C=>{Ze(C)&&(l.value=!1)},hs=async()=>{if(!(u.value||p.value)){p.value=!0,f.value="";try{let C={"Content-Type":"application/json"};t.token&&(C.Authorization=`Bearer ${t.token}`);let G=await fetch("/api/user/agent-secret",{headers:C});if(!G.ok){let Re=i("yeaft.onboarding.secretError");try{let Qe=await G.json();Qe?.error&&(Re=Qe.error)}catch{}throw new Error(Re)}let ce=await G.json(),Ee=ce?.agentSecret||ce?.agent_secret||"";if(u.value=String(Ee||"").trim(),!u.value)throw new Error(i("yeaft.onboarding.secretError"))}catch(C){f.value=C?.message||i("yeaft.onboarding.secretError")}finally{p.value=!1}}},Bn=()=>{c.value=!0},Wn=C=>{c.value=!1},Gs=async(C,G)=>{if(G&&!(typeof navigator>"u"||!navigator.clipboard?.writeText))try{let ce=typeof G=="string"?G:G?.value||"";if(!ce)return;await navigator.clipboard.writeText(ce),d.value=C||"",g&&clearTimeout(g),g=setTimeout(()=>{d.value="",g=null},1800)}catch{}},vs=(C,G)=>{},_r=(C={})=>{og(C)&&(l.value=!1)},Dt=Vue.reactive(new Set),Et=Vue.computed(()=>{let C=P();return C?C.activeSession:null}),Rr=C=>{if(!C)return"";if(C.id==="grp_default"&&(C.name==="Default"||!C.name))try{let G=typeof window<"u"?window.i18n:null;if(G&&G.global&&typeof G.global.t=="function")return G.global.t("yeaft.session.defaultName")}catch{}return C.name||C.id||""},Qs=Vue.computed(()=>Rr(Et.value)),Un=Vue.computed(()=>{let C=P();if(!C||!C.activeNeedsInvite)return!1;let G=C.activeSession;return G?!Dt.has(G.id):!1}),Da=Vue.computed(()=>{let C=P();return!!(C&&C.activeNeedsInvite)}),S=Vue.computed(()=>{let C=P();return e._hasHandledAgentList===!0&&e._hasHandledYeaftSessionHydrate===!0&&!!(C&&C.hasLoadedSnapshot)}),V=Vue.computed(()=>{let C=P();return tg({agentInventoryReady:e._hasHandledAgentList===!0,hasYeaftAgent:ig(e),sessionsReady:e._hasHandledYeaftSessionHydrate===!0&&!!(C&&C.hasLoadedSnapshot),sessionsEmpty:!!(C&&C.isEmpty)})});Vue.watch(V,C=>{C&&hs()},{immediate:!0});let q="npm install -g @yeaft/webchat-agent",pe=Vue.computed(()=>{let G=(typeof window<"u"&&window.location?.origin?window.location.origin:"http://localhost:3456").replace(/^http:/,"ws:").replace(/^https:/,"wss:"),ce=u.value||i("yeaft.onboarding.secretPending");return`yeaft-agent install --server ${G} --name yeaft-agent --secret ${ce}`}),Se="gh auth login && yeaft-agent llm use github-copilot --model gpt-5.5",re=()=>{let C=Et.value;C&&Dt.add(C.id),La(C?C.id:null)},Fe=()=>{let C=Et.value;C&&Dt.add(C.id)},Be=Vue.ref(!1),we=Vue.ref(null),de=Vue.ref(null),st=Vue.ref("session"),Xs=Vue.ref(""),Lt=(C={})=>{let G=C&&(C.sessionId||C.groupId)||null,ce=C&&C.editVpId||"",Ee=ce?"members":C&&C.section||"session";G&&(we.value=G,de.value=C&&C.agentId||null,st.value=Ee,Xs.value=ce,Be.value=!0)},mg=()=>{let C=ps();C&&Lt({sessionId:C,section:"session"})},Ea=()=>{Be.value=!1,we.value=null,de.value=null,Xs.value=""},hg=()=>{Ea(),zt({initialTab:"vp"})},La=C=>{C&&Lt({sessionId:C,section:"members"})};Vue.watch(()=>{let C=Et.value;return C?C.id+":"+(Array.isArray(C.roster)?C.roster.length:0)+":"+(C.defaultVpId||""):""},(C,G)=>{let ce=Et.value;ce&&C!==G&&Array.isArray(ce.roster)&&ce.roster.length>0&&Dt.delete(ce.id)}),typeof Vue.onBeforeUnmount=="function"&&Vue.onBeforeUnmount(()=>{g&&clearTimeout(g),g=null});let vg=()=>{a.value=!1},yg=Vue.computed(()=>!a.value&&!V.value&&me.value),bg=Vue.computed(()=>{let C=P(),G=e.yeaftActiveSessionFilter||C?.activeSessionId||null;if(!G)return[];let ce=e.yeaftActiveTasksBySession?.[G]||{};return Nv(ce)}),wg=Vue.computed(()=>{if(!e.yeaftConversationId)return[];let G=P(),ce=e.yeaftActiveSessionFilter||G?.activeSessionId||null;if(!ce)return[];let Ee=Ma(G,ce,e.currentAgent||null),Re=Ee&&Array.isArray(Ee.roster)?Ee.roster:[];if(Re.length===0)return[];let Qe=new Set(Re),$t=Kf(Re,s.vpList||[]),Vt=e.vpStatuses||{},ys={},zn=e.currentAgent||null;for(let Ne of Object.values(Vt)){if(!Ne||!Ne.vpId)continue;let Kn=Ne.sessionId??Ne.groupId;Kn&&Kn!==ce||zn&&Ne.agentId&&Ne.agentId!==zn||Qe.has(Ne.vpId)&&(ys[Ne.vpId]=Ne)}let $a={};for(let Ne of Object.values(e.activeVpTurns||{}))!Ne?.turnId||!Ne?.sessionId||Ne.sessionId!==ce||zn&&Ne.agentId&&Ne.agentId!==zn||Object.entries(e.stoppingVpTurnIds||{}).some(([Kn])=>e.activeVpTurns?.[Kn]===Ne)&&($a[Ne.turnId]=!0);return Yf({vpList:$t,vpStatuses:ys,stoppingVpTurnIds:$a,connectionState:e.connectionState,vpLabelOf:Ne=>s.vpLabel(Ne),vpDescriptionOf:Ne=>s.vpDescription(Ne)})});return{store:e,pageRef:k,effectiveSidebarCollapsed:Je,debugMode:r,modelDropdownOpen:o,topbarGroup:tt,topbarSessionTitle:Ar,topbarModel:fs,topbarEffort:Rt,topbarModelRows:Tr,selectableEffortsForModel:xr,isModelSelectionActive:Mr,isModelRowActive:Pr,modelOptionRef:pr,modelOptionMatchesRef:Dn,showSettings:a,showLlmConfig:l,sessionCreateOpen:c,settingsInitialTab:v,settingsInitialEditVpId:m,chatInputRef:A,messageQuote:w,messageListRef:y,historySearchRef:h,historySearchOpen:b,historySearchActiveMessageId:_,historyOutlineState:L,historySenderOptions:U,toggleHistorySearch:Oe,closeHistorySearch:ye,onHistorySearchQuery:ze,onHistorySenderChange:Pt,onHistorySenderInvalid:_t,loadOlderHistoryOutline:gr,loadMoreHistorySearchResults:mr,previewHistorySearchResult:En,selectHistorySearchResult:hr,yeaftInputDraftKey:B,openSettings:zt,isMobile:je,isNarrowDetail:Ke,detailPanel:ae,isResizingDetail:he,detailWidthStyle:O,startDetailResize:E,isProcessing:Ir,goBack:vr,sendMessage:yr,setMessageQuote:br,editMessageAsNew:wr,cancelYeaft:zs,openWorkItemDraft:$n,toggleSidebar:Ks,toggleDebug:et,closeDebug:Vn,reloadMessages:kr,retryConversationInventory:Sr,reloadPage:Cr,toggleModelDropdown:wt,selectModel:js,openLlmConfig:ms,trackOverlayPointerDown:rt,trackOverlayPointerUp:ot,clearOverlayPointerGesture:at,closeLlmConfigFromOverlay:Nn,openSessionCreate:Bn,onSessionCreated:Wn,copyOnboardingCommand:Gs,copiedOnboardingCommand:d,onLlmConfigMessage:vs,onLlmConfigSaved:_r,formatTokens:Ge,formatModelCtx:Ut,toggleSettings:qn,onSettingsSaved:vg,sidebarV2Enabled:Ce,onSelectGroupV2:x,onSelectChat:j,canUseWorkbench:oe,shouldShowInviteModal:Un,inviteGroupName:Qs,onInviteOpenLibrary:re,onInviteDismiss:Fe,isActiveGroupEmpty:Da,conversationInventoryReady:S,showOnboardingGuide:V,installAgentCommand:q,connectAgentCommand:pe,copilotCommand:Se,agentSecret:u,agentSecretLoading:p,agentSecretError:f,groupSettingsOpen:Be,groupSettingsId:we,groupSettingsAgentId:de,groupSettingsSection:st,groupSettingsEditVpId:Xs,openSessionSettings:Lt,openAnnouncementSettings:mg,closeGroupSettings:Ea,openVpLibraryFromGroupSettings:hg,openMemberEditor:La,showVpTimeline:yg,vpTimelineRows:wg,sessionStatusTasksForActiveSession:bg,sessionStatusAnnouncementText:Fn,sessionStatusVisible:me,toggleSessionStatus:ee,closeSessionStatus:fe,timelineWidthStyle:Mt,startTimelineResize:pt,onEditVpFromTimeline:C=>{if(!C)return;let G=ps();G&&Lt({sessionId:G,section:"members",editVpId:C})},onMentionVpFromTimeline:C=>{if(!C)return;let G=A.value;G&&typeof G.appendMention=="function"&&G.appendMention(C)},onCancelVpFromTimeline:C=>{if(!C)return;let G=P(),ce=e.yeaftActiveSessionFilter||G?.activeSessionId||null;ce&&typeof e.cancelVpTurnForSession=="function"&&e.cancelVpTurnForSession(C,ce)},onCancelTaskFromTimeline:C=>!C?.id||!C.sessionId||typeof e.cancelYeaftTask!="function"?!1:e.cancelYeaftTask({sessionId:C.sessionId,taskId:C.id})}}}});var Uv=kg(()=>{hi();ct();_s();Dd();St();Fd();Od();Nd();Wd();yf();gg();ua();Ko();window.Pinia={...Pinia,useChatStore:null,useAuthStore:null};var Bv={components:{LoginPage:Bd,ChatPage:vf,YeaftPage:fg},template:`
8216
+ `,setup(){let e=Pinia.useChatStore(),t=Pinia.useAuthStore(),s=Pinia.useVpStore(),n=Vue.getCurrentInstance(),i=n&&n.appContext.config.globalProperties.$t||(C=>C),r=Vue.ref(!1),o=Vue.ref(!1),a=Vue.ref(!1),l=Vue.ref(!1),c=Vue.ref(!1),d=Vue.ref(""),u=Vue.ref(""),p=Vue.ref(!1),f=Vue.ref(""),g=null,v=Vue.ref("vp"),m=Vue.ref(null),A=Vue.ref(null),w=Vue.ref(null),k=Vue.ref(null),y=Vue.ref(null),h=Vue.ref(null),b=Vue.ref(!1),R=Vue.ref(null),L=Vue.computed(()=>e.getYeaftHistoryOutlineState()),U=Vue.computed(()=>{let C=P(),G=e.yeaftActiveSessionFilter||C?.activeSessionId||null,ce=G?Ma(C,G,e.currentAgent||null):null,Ee=Array.isArray(ce?.roster)?ce.roster:[];return[{key:"user",label:i("yeaft.outline.you")},...Ee.map(_e=>({key:`vp:${_e}`,label:s.vpLabel(_e)}))]}),$=Vue.ref(e.yeaftHistorySearchState?.query||""),_=null,P=()=>{try{return window.Pinia?.useSessionsStore?.()||null}catch{return null}},T=()=>{let C=P();return{agentId:e.currentAgent||null,sessionId:e.yeaftActiveSessionFilter||C?.activeSessionId||null}},I=()=>Ov({...T(),validKeys:U.value.map(C=>C.key)}),M=(C="")=>{let{agentId:G,sessionId:ce}=T();e.yeaftHistorySearchState={requestId:null,agentId:G,sessionId:ce,query:"",senderKey:C,loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:null}},B=Vue.computed(()=>{let C=e.currentAgent||"agent",G=P(),ce=e.yeaftActiveSessionFilter||G?.activeSessionId||"session";return`yeaft:${C}:${ce}`});Vue.watch(B,()=>{w.value=null});let F=null,z=null,ne=C=>{if(!C)return!1;let G=String(C.tagName||"").toLowerCase();return G==="textarea"||G==="input"||C.isContentEditable===!0},ve=({recoverScroll:C=!1}={})=>{let G=k.value;if(!G)return;if(!je.value){G.style.removeProperty("--yeaft-visual-viewport-height");return}let ce=window.visualViewport,Ee=Math.max(1,Math.round(ce?.height||window.innerHeight||1));G.style.setProperty("--yeaft-visual-viewport-height",`${Ee}px`),!(!C||ce&&window.innerHeight&&ce.height<window.innerHeight*.85||ne(document.activeElement))&&window.scrollTo(0,0)},ue=(C={})=>{F!=null&&cancelAnimationFrame(F),F=requestAnimationFrame(()=>{F=null,ve(C)})},be=()=>{ue({recoverScroll:!0}),z&&clearTimeout(z),z=setTimeout(()=>{z=null,ue({recoverScroll:!0})},260)},oe=Vue.computed(()=>e.hasCapability("terminal")||e.hasCapability("file_editor")),Ce=Vue.computed(()=>!0),x=C=>{let G=C&&C.id?C.id:null;G&&(e.setActiveSessionFilter(G,{agentId:C.agentId||null}),je.value&&e.closeSessionSidebar())},j=C=>{},ae=Vue.ref(null),he=Vue.ref(!1),W=320,te=Math.max(W,Math.round(window.innerWidth*.25)),Y=localStorage.getItem("yeaft-debug-width"),N=Vue.ref(Y?parseInt(Y,10):te),O=Vue.computed(()=>({"--yeaft-detail-width":N.value+"px"})),E=C=>{he.value=!0;let G=C.clientX,ce=N.value,Ee=window.innerWidth*.6,_e=$t=>{let Vt=G-$t.clientX,ys=Math.min(Ee,Math.max(W,ce+Vt));N.value=ys},Qe=()=>{he.value=!1,document.removeEventListener("mousemove",_e),document.removeEventListener("mouseup",Qe),localStorage.setItem("yeaft-debug-width",String(N.value))};document.addEventListener("mousemove",_e),document.addEventListener("mouseup",Qe)},J="yeaft-session-status-visible",se=()=>{try{let C=localStorage.getItem(J);return!(C==="0"||C==="false")}catch{return!0}},me=Vue.ref(se()),K=C=>{me.value=!!C;try{localStorage.setItem(J,me.value?"1":"0")}catch{}},ee=()=>K(!me.value),fe=()=>K(!1),le=220,Re=280,De=(()=>{try{return localStorage.getItem("yeaft-vp-timeline-width")}catch{return null}})(),Ve=De?parseInt(De,10):NaN,We=Vue.ref(Number.isFinite(Ve)&&Ve>=le?Ve:Re),Mt=Vue.computed(()=>({"--yeaft-vp-timeline-width":We.value+"px"})),pt=C=>{let G=C.clientX,ce=We.value,Ee=Math.max(le,Math.floor(window.innerWidth*.4)),_e=$t=>{let Vt=G-$t.clientX,ys=Math.min(Ee,Math.max(le,ce+Vt));We.value=ys},Qe=()=>{document.removeEventListener("mousemove",_e),document.removeEventListener("mouseup",Qe);try{localStorage.setItem("yeaft-vp-timeline-width",String(We.value))}catch{}};document.addEventListener("mousemove",_e),document.addEventListener("mouseup",Qe)},ft="(max-width: 768px)",Us="(max-width: 1024px)",bt=typeof window.matchMedia=="function"?window.matchMedia(ft):null,He=typeof window.matchMedia=="function"?window.matchMedia(Us):null,Ue=(C,G)=>C?C.matches:window.innerWidth<=G,je=Vue.ref(Ue(bt,768)),Ke=Vue.ref(Ue(He,1024)),Je=Vue.computed(()=>je.value?!e.sessionSidebarOpen:e.sidebarCollapsed),D=()=>{je.value=Ue(bt,768),Ke.value=Ue(He,1024)},Q=()=>{D(),be()},ge=C=>{C&&(typeof C.addEventListener=="function"?C.addEventListener("change",Q):typeof C.addListener=="function"&&C.addListener(Q))},ie=C=>{C&&(typeof C.removeEventListener=="function"?C.removeEventListener("change",Q):typeof C.removeListener=="function"&&C.removeListener(Q))},ye=()=>{_&&(clearTimeout(_),_=null),$.value="",M(I()),b.value=!1,R.value=null},ke=()=>{let C=I();$.value="",M(C),b.value=!0,e.loadYeaftHistoryOutline(),C&&e.searchYeaftHistory("",{senderKey:C}),Vue.nextTick(()=>h.value?.focus?.())},Oe=()=>{b.value?ye():ke()},qe=C=>{b.value&&Fu(C.target)&&ye()},ze=C=>{$.value=C,_&&clearTimeout(_),R.value=null,_=setTimeout(()=>{_=null,e.searchYeaftHistory($.value,{senderKey:e.yeaftHistorySearchState.senderKey})},220)},Pt=C=>{_&&clearTimeout(_),_=null,R.value=null,lg({...T(),senderKey:C}),e.searchYeaftHistory($.value,{senderKey:C})},Rt=()=>{lg({...T(),senderKey:""}),R.value=null,e.searchYeaftHistory($.value,{senderKey:""})},gr=C=>{if(!e.loadYeaftHistoryOutline({append:!0}))return;let G=Vue.watch(()=>L.value.loading,ce=>{ce||(G(),h.value?.restoreOlderScroll?.(C))})},mr=()=>e.searchYeaftHistory(e.yeaftHistorySearchState.query,{append:!0,senderKey:e.yeaftHistorySearchState.senderKey}),En=C=>{e.hasCapability("session_history_window_prefetch")&&e.loadYeaftHistoryWindow(C)},hr=C=>Hu({result:C,revealWindow:G=>e.revealYeaftHistoryResult(G),nextTick:()=>Vue.nextTick(),revealMessage:G=>y.value?.revealMessage?.(G),isMobile:je.value,closeOutline:ye}),Ln=C=>{if((C.metaKey||C.ctrlKey)&&String(C.key).toLowerCase()==="f"){C.preventDefault(),ke();return}if(C.key==="Escape"){if(b.value){ye();return}if(o.value){Wt();return}}};Vue.onMounted(()=>{D(),window.addEventListener("resize",Q),ge(bt),ge(He),window.visualViewport?.addEventListener("resize",be),window.visualViewport?.addEventListener("scroll",be),document.addEventListener("click",On),document.addEventListener("click",qe),document.addEventListener("keydown",Ln),ue()}),Vue.onUnmounted(()=>{window.removeEventListener("resize",Q),ie(bt),ie(He),window.visualViewport?.removeEventListener("resize",be),window.visualViewport?.removeEventListener("scroll",be),document.removeEventListener("click",On),document.removeEventListener("click",qe),document.removeEventListener("keydown",Ln),F!=null&&cancelAnimationFrame(F),z&&clearTimeout(z),_&&clearTimeout(_)}),Vue.watch(()=>e.yeaftConversationId,C=>{C&&e.activeConversations[0]!==C&&(e.activeConversations=[C])}),Vue.watch(()=>[e.currentAgent,e.yeaftActiveSessionFilter],()=>{ye(),M(I())});let vr=()=>{e.leaveYeaft()},yr=(C,G,ce)=>{let Ee=P();if(Ee&&Ee.activeNeedsInvite){let Vt=Ee.activeSession;Vt&&Dt.delete(Vt.id);return}let _e=e.yeaftActiveSessionFilter||Ee&&Ee.activeSessionId||"grp_default",Qe=qi(C).mentions,$t=Array.isArray(G)?G:void 0;e.sendYeaftSessionMessage({groupId:_e,text:C,mentions:Qe,attachments:$t,quote:ce})},br=C=>{C&&(w.value=C,A.value?.focusInput?.())},wr=C=>{w.value=null,A.value?.replaceDraft?.(C||"")},zs=()=>{let C=P(),G=e.yeaftActiveSessionFilter||C?.activeSessionId||null;G&&e.cancelYeaftSession(G)},$n=(C="")=>{let G=tt.value;G&&e.enterWorkCenterFromSession(G,C)},Ks=()=>{if(je.value){e.toggleSessionSidebar();return}e.toggleSidebar()},et=()=>{r.value=!r.value},Vn=()=>{r.value=!1},kr=()=>{e.reloadYeaftMessages()},Sr=()=>{if(typeof e.requestYeaftSessionInventory=="function"){e.requestYeaftSessionInventory();return}e._hasHandledAgentList=!1,e._hasHandledYeaftSessionHydrate=!1,e.yeaftSessionHydrateError=null,e.sendWsMessage({type:"get_agents"})},Cr=()=>{window.location.reload()},Ir=Vue.computed(()=>{let C=P(),G=e.yeaftActiveSessionFilter||C?.activeSessionId||null;return G?e.isYeaftSessionProcessing(G,e.currentAgent||null):!1}),tt=Vue.computed(()=>{let C=P();if(!C||!C.sessions)return null;let G=e.yeaftActiveSessionFilter||null;if(G&&typeof C.sessionById=="function"){let ce=C.sessionById(G,e.currentAgent||null);if(ce)return ce}if(C.activeSessionId&&typeof C.sessionById=="function"){let ce=C.sessionById(C.activeSessionId,e.currentAgent||null);if(ce)return ce}return typeof C.sessionById=="function"?C.sessionById("grp_default",e.currentAgent||null):null}),ps=()=>ng({activeSessionFilter:e.yeaftActiveSessionFilter,sessionsStore:P(),topbarGroup:tt.value}),Ar=Vue.computed(()=>{let C=tt.value||{},G=typeof C.id=="string"?C.id.trim():"",ce=[C.title,C.name,C.config?.title,C.config?.name];for(let Ee of ce){let _e=typeof Ee=="string"?Ee.trim():"";if(_e&&!(G&&_e===G)&&!/^(sessions?|groups?)\//i.test(_e)&&!/^session_[A-Za-z0-9_-]+$/.test(_e)&&!(C.workDir&&_e===C.workDir))return _e}return""}),Fn=Vue.computed(()=>tt.value&&typeof tt.value.announcement=="string"?tt.value.announcement:""),fs=Vue.computed(()=>Qf(tt.value,e.yeaftModel||"")),Ys=Vue.computed(()=>{let C=fs.value;return C&&e.yeaftAvailableModels.find(G=>Dn(G,C))||null}),xr=C=>Pa(C?.effortOptions),gs=Vue.computed(()=>Zf(tt.value,e.yeaftModelEffort||"")),_t=Vue.computed(()=>{let C=Array.isArray(Ys.value?.effortOptions)?Ys.value.effortOptions.filter(Boolean):[];return C.length?C.includes(gs.value)?gs.value:Ra(C):null}),Tr=Vue.computed(()=>Jf(e.yeaftAvailableModels)),Mr=(C,G)=>Dn(C,fs.value)?G?G===_t.value:!xr(C).length:!1,Pr=C=>!C||!Dn(C.model,fs.value)?!1:C.efforts.length?C.efforts.includes(_t.value):!0,Hn=()=>{o.value=!0},Wt=()=>{o.value=!1},wt=C=>{C.stopPropagation(),e.yeaftAvailableModels.length&&(o.value?Wt():Hn())},js=(C,G=null)=>{if(!C)return;let ce=tt.value?.id||null;e.switchYeaftModel(C,ce,G),Wt()},Ge=C=>!C||!Number.isFinite(C)||C<=0?"":C>=1e6?`${Math.round(C/1e5)/10}m`:C>=1e3?`${Math.round(C/1e3)}k`:String(C),Ut=C=>{let G=Ge(C?.contextWindow),ce=Ge(C?.maxOutput);return G&&ce?`${G} \xB7 ${ce} out`:G},On=C=>{if(!o.value)return;C.target.closest(".yeaft-topbar-model, .yeaft-topbar-model-dropdown")||Wt()},qn=()=>{a.value||(v.value="vp",m.value=null),a.value=!a.value},zt=({initialTab:C="vp",editVpId:G=null}={})=>{v.value=["vp","search","mcp"].includes(C)?C:"vp",m.value=v.value==="vp"&&G||null,a.value=!0},ms=()=>{o.value=!1,l.value=!0},Nn=C=>{Ze(C)&&(l.value=!1)},hs=async()=>{if(!(u.value||p.value)){p.value=!0,f.value="";try{let C={"Content-Type":"application/json"};t.token&&(C.Authorization=`Bearer ${t.token}`);let G=await fetch("/api/user/agent-secret",{headers:C});if(!G.ok){let _e=i("yeaft.onboarding.secretError");try{let Qe=await G.json();Qe?.error&&(_e=Qe.error)}catch{}throw new Error(_e)}let ce=await G.json(),Ee=ce?.agentSecret||ce?.agent_secret||"";if(u.value=String(Ee||"").trim(),!u.value)throw new Error(i("yeaft.onboarding.secretError"))}catch(C){f.value=C?.message||i("yeaft.onboarding.secretError")}finally{p.value=!1}}},Bn=()=>{c.value=!0},Wn=C=>{c.value=!1},Gs=async(C,G)=>{if(G&&!(typeof navigator>"u"||!navigator.clipboard?.writeText))try{let ce=typeof G=="string"?G:G?.value||"";if(!ce)return;await navigator.clipboard.writeText(ce),d.value=C||"",g&&clearTimeout(g),g=setTimeout(()=>{d.value="",g=null},1800)}catch{}},vs=(C,G)=>{},Rr=(C={})=>{og(C)&&(l.value=!1)},Dt=Vue.reactive(new Set),Et=Vue.computed(()=>{let C=P();return C?C.activeSession:null}),_r=C=>{if(!C)return"";if(C.id==="grp_default"&&(C.name==="Default"||!C.name))try{let G=typeof window<"u"?window.i18n:null;if(G&&G.global&&typeof G.global.t=="function")return G.global.t("yeaft.session.defaultName")}catch{}return C.name||C.id||""},Qs=Vue.computed(()=>_r(Et.value)),Un=Vue.computed(()=>{let C=P();if(!C||!C.activeNeedsInvite)return!1;let G=C.activeSession;return G?!Dt.has(G.id):!1}),Da=Vue.computed(()=>{let C=P();return!!(C&&C.activeNeedsInvite)}),S=Vue.computed(()=>{let C=P();return e._hasHandledAgentList===!0&&e._hasHandledYeaftSessionHydrate===!0&&!!(C&&C.hasLoadedSnapshot)}),V=Vue.computed(()=>{let C=P();return tg({agentInventoryReady:e._hasHandledAgentList===!0,hasYeaftAgent:ig(e),sessionsReady:e._hasHandledYeaftSessionHydrate===!0&&!!(C&&C.hasLoadedSnapshot),sessionsEmpty:!!(C&&C.isEmpty)})});Vue.watch(V,C=>{C&&hs()},{immediate:!0});let q="npm install -g @yeaft/webchat-agent",pe=Vue.computed(()=>{let G=(typeof window<"u"&&window.location?.origin?window.location.origin:"http://localhost:3456").replace(/^http:/,"ws:").replace(/^https:/,"wss:"),ce=u.value||i("yeaft.onboarding.secretPending");return`yeaft-agent install --server ${G} --name yeaft-agent --secret ${ce}`}),Se="gh auth login && yeaft-agent llm use github-copilot --model gpt-5.5",re=()=>{let C=Et.value;C&&Dt.add(C.id),La(C?C.id:null)},Fe=()=>{let C=Et.value;C&&Dt.add(C.id)},Be=Vue.ref(!1),we=Vue.ref(null),de=Vue.ref(null),st=Vue.ref("session"),Xs=Vue.ref(""),Lt=(C={})=>{let G=C&&(C.sessionId||C.groupId)||null,ce=C&&C.editVpId||"",Ee=ce?"members":C&&C.section||"session";G&&(we.value=G,de.value=C&&C.agentId||null,st.value=Ee,Xs.value=ce,Be.value=!0)},mg=()=>{let C=ps();C&&Lt({sessionId:C,section:"session"})},Ea=()=>{Be.value=!1,we.value=null,de.value=null,Xs.value=""},hg=()=>{Ea(),zt({initialTab:"vp"})},La=C=>{C&&Lt({sessionId:C,section:"members"})};Vue.watch(()=>{let C=Et.value;return C?C.id+":"+(Array.isArray(C.roster)?C.roster.length:0)+":"+(C.defaultVpId||""):""},(C,G)=>{let ce=Et.value;ce&&C!==G&&Array.isArray(ce.roster)&&ce.roster.length>0&&Dt.delete(ce.id)}),typeof Vue.onBeforeUnmount=="function"&&Vue.onBeforeUnmount(()=>{g&&clearTimeout(g),g=null});let vg=()=>{a.value=!1},yg=Vue.computed(()=>!a.value&&!V.value&&me.value),bg=Vue.computed(()=>{let C=P(),G=e.yeaftActiveSessionFilter||C?.activeSessionId||null;if(!G)return[];let ce=e.yeaftActiveTasksBySession?.[G]||{};return qv(ce)}),wg=Vue.computed(()=>{if(!e.yeaftConversationId)return[];let G=P(),ce=e.yeaftActiveSessionFilter||G?.activeSessionId||null;if(!ce)return[];let Ee=Ma(G,ce,e.currentAgent||null),_e=Ee&&Array.isArray(Ee.roster)?Ee.roster:[];if(_e.length===0)return[];let Qe=new Set(_e),$t=Kf(_e,s.vpList||[]),Vt=e.vpStatuses||{},ys={},zn=e.currentAgent||null;for(let Ne of Object.values(Vt)){if(!Ne||!Ne.vpId)continue;let Kn=Ne.sessionId??Ne.groupId;Kn&&Kn!==ce||zn&&Ne.agentId&&Ne.agentId!==zn||Qe.has(Ne.vpId)&&(ys[Ne.vpId]=Ne)}let $a={};for(let Ne of Object.values(e.activeVpTurns||{}))!Ne?.turnId||!Ne?.sessionId||Ne.sessionId!==ce||zn&&Ne.agentId&&Ne.agentId!==zn||Object.entries(e.stoppingVpTurnIds||{}).some(([Kn])=>e.activeVpTurns?.[Kn]===Ne)&&($a[Ne.turnId]=!0);return Yf({vpList:$t,vpStatuses:ys,stoppingVpTurnIds:$a,connectionState:e.connectionState,vpLabelOf:Ne=>s.vpLabel(Ne),vpDescriptionOf:Ne=>s.vpDescription(Ne)})});return{store:e,pageRef:k,effectiveSidebarCollapsed:Je,debugMode:r,modelDropdownOpen:o,topbarGroup:tt,topbarSessionTitle:Ar,topbarModel:fs,topbarEffort:_t,topbarModelRows:Tr,selectableEffortsForModel:xr,isModelSelectionActive:Mr,isModelRowActive:Pr,modelOptionRef:pr,modelOptionMatchesRef:Dn,showSettings:a,showLlmConfig:l,sessionCreateOpen:c,settingsInitialTab:v,settingsInitialEditVpId:m,chatInputRef:A,messageQuote:w,messageListRef:y,historySearchRef:h,historySearchOpen:b,historySearchActiveMessageId:R,historyOutlineState:L,historySenderOptions:U,toggleHistorySearch:Oe,closeHistorySearch:ye,onHistorySearchQuery:ze,onHistorySenderChange:Pt,onHistorySenderInvalid:Rt,loadOlderHistoryOutline:gr,loadMoreHistorySearchResults:mr,previewHistorySearchResult:En,selectHistorySearchResult:hr,yeaftInputDraftKey:B,openSettings:zt,isMobile:je,isNarrowDetail:Ke,detailPanel:ae,isResizingDetail:he,detailWidthStyle:O,startDetailResize:E,isProcessing:Ir,goBack:vr,sendMessage:yr,setMessageQuote:br,editMessageAsNew:wr,cancelYeaft:zs,openWorkItemDraft:$n,toggleSidebar:Ks,toggleDebug:et,closeDebug:Vn,reloadMessages:kr,retryConversationInventory:Sr,reloadPage:Cr,toggleModelDropdown:wt,selectModel:js,openLlmConfig:ms,trackOverlayPointerDown:rt,trackOverlayPointerUp:ot,clearOverlayPointerGesture:at,closeLlmConfigFromOverlay:Nn,openSessionCreate:Bn,onSessionCreated:Wn,copyOnboardingCommand:Gs,copiedOnboardingCommand:d,onLlmConfigMessage:vs,onLlmConfigSaved:Rr,formatTokens:Ge,formatModelCtx:Ut,toggleSettings:qn,onSettingsSaved:vg,sidebarV2Enabled:Ce,onSelectGroupV2:x,onSelectChat:j,canUseWorkbench:oe,shouldShowInviteModal:Un,inviteGroupName:Qs,onInviteOpenLibrary:re,onInviteDismiss:Fe,isActiveGroupEmpty:Da,conversationInventoryReady:S,showOnboardingGuide:V,installAgentCommand:q,connectAgentCommand:pe,copilotCommand:Se,agentSecret:u,agentSecretLoading:p,agentSecretError:f,groupSettingsOpen:Be,groupSettingsId:we,groupSettingsAgentId:de,groupSettingsSection:st,groupSettingsEditVpId:Xs,openSessionSettings:Lt,openAnnouncementSettings:mg,closeGroupSettings:Ea,openVpLibraryFromGroupSettings:hg,openMemberEditor:La,showVpTimeline:yg,vpTimelineRows:wg,sessionStatusTasksForActiveSession:bg,sessionStatusAnnouncementText:Fn,sessionStatusVisible:me,toggleSessionStatus:ee,closeSessionStatus:fe,timelineWidthStyle:Mt,startTimelineResize:pt,onEditVpFromTimeline:C=>{if(!C)return;let G=ps();G&&Lt({sessionId:G,section:"members",editVpId:C})},onMentionVpFromTimeline:C=>{if(!C)return;let G=A.value;G&&typeof G.appendMention=="function"&&G.appendMention(C)},onCancelVpFromTimeline:C=>{if(!C)return;let G=P(),ce=e.yeaftActiveSessionFilter||G?.activeSessionId||null;ce&&typeof e.cancelVpTurnForSession=="function"&&e.cancelVpTurnForSession(C,ce)},onCancelTaskFromTimeline:C=>!C?.id||!C.sessionId||typeof e.cancelYeaftTask!="function"?!1:e.cancelYeaftTask({sessionId:C.sessionId,taskId:C.id})}}}});var Wv=kg(()=>{hi();ct();Rs();Dd();St();Fd();Od();Nd();Wd();yf();gg();ua();Ko();window.Pinia={...Pinia,useChatStore:null,useAuthStore:null};var Nv={components:{LoginPage:Bd,ChatPage:vf,YeaftPage:fg},template:`
8219
8217
  <div v-if="!authStore.initialized" class="auth-bootstrap" aria-busy="true"><span class="session-loading-spinner"></span></div>
8220
8218
  <LoginPage v-else-if="!authStore.isAuthenticated" />
8221
8219
  <template v-else>
8222
8220
  <YeaftPage v-if="chatStore.currentView === 'yeaft'" />
8223
8221
  <ChatPage v-else />
8224
8222
  </template>
8225
- `,setup(){let e=ns(),t=Me();return e.initTheme(),e.setupVisibilityHandler(),Vue.onMounted(()=>{t.initialize()}),Vue.watch(()=>t.initialized&&t.isAuthenticated,s=>{s&&e.connect()},{immediate:!0}),{authStore:t,chatStore:e}}},fr=Vue.createApp(Bv),Wv=Pinia.createPinia();fr.use(Wv);Oa(fr,{"zh-CN":Hd,en:qd});Vd();window.Pinia.useChatStore=ns;window.Pinia.useAuthStore=Me;window.Pinia.useVpStore=ht;window.Pinia.useSessionsStore=Rd;fr.component("ToolLine",_i);fr.mount("#app")});export default Uv();
8223
+ `,setup(){let e=ns(),t=Me();return e.initTheme(),e.setupVisibilityHandler(),Vue.onMounted(()=>{t.initialize()}),Vue.watch(()=>t.initialized&&t.isAuthenticated,s=>{s&&e.connect()},{immediate:!0}),{authStore:t,chatStore:e}}},fr=Vue.createApp(Nv),Bv=Pinia.createPinia();fr.use(Bv);Oa(fr,{"zh-CN":Hd,en:qd});Vd();window.Pinia.useChatStore=ns;window.Pinia.useAuthStore=Me;window.Pinia.useVpStore=ht;window.Pinia.useSessionsStore=_d;fr.component("ToolLine",Ri);fr.mount("#app")});export default Wv();