@yeaft/webchat-agent 1.0.200 → 1.0.202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/local-runtime/version.json +1 -1
- package/local-runtime/web/app.bundle.js +18 -18
- package/local-runtime/web/app.bundle.js.gz +0 -0
- package/local-runtime/web/index.html +1 -1
- package/package.json +1 -1
- package/yeaft/work-center/completion-contract.js +53 -0
- package/yeaft/work-center/controller.js +1 -54
- package/yeaft/work-center/runner.js +40 -4
- package/yeaft/work-center/workflow.js +1 -1
|
@@ -5,7 +5,7 @@ ${d}`:d,u=!0;break}}if(!u){for(let f=a.length-1;f>=0;f--)if(a[f].type==="tool-us
|
|
|
5
5
|
|
|
6
6
|
`)+(s||"")}}function el(e){return Object.values(Qa).filter(t=>e||!t.adminOnly).sort((t,s)=>t.order-s.order)}var Qa,ct,Ja,Ht,Ws=N(()=>{Qa={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}},ct={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"}]}};Ja="dev",Ht=3});function Bf(e,t){return!t||!e?.yeaftConversationIdsByAgent?[]:Object.entries(e.yeaftConversationIdsByAgent).filter(([,s])=>s===t).map(([s])=>s).filter(Boolean)}function tl(){return`cm_${crypto.randomUUID()}`}function sl(e,t){t!==e.currentAgent&&(e.agentSwitching=!0,e.sendWsMessage({type:"select_agent",agentId:t}))}function nl(e,t,s=null,n=null,i={}){let r=s||e.currentAgent;if(!r){e.addMessage({type:"error",content:Ae("chat.agent.selectFirst")});return}rs(e,!0,Ae("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 il(e,t,s,n=null,i=null,r=null){let o=n||e.currentAgent;if(!o){e.addMessage({type:"error",content:Ae("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)),rs(e,!0,Ae("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 rl(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=Ns(i);r!==null?e.sendWsMessage({type:"sync_messages",conversationId:t,afterMessageId:r}):((!i||i.length===0)&&(e.messagesMap[t]=[],rs(e,!0,Ae("chat.session.loadingHistory"))),e.sendWsMessage({type:"sync_messages",conversationId:t,turns:5})),e.loadingMoreMessages=!1;let o=e.chatSessionState[t];e.hasMoreMessages=!!o?.hasMoreOlder,os(e)}function fr(e,t,s){t&&e.sendWsMessage({type:"update_conversation_settings",conversationId:t,...s})}function ol(e,t,s){let n=e.currentConversation;if(!n)return;let i=e.conversationMcpServers[n];if(i){let f=i.find(p=>p.name===t);f&&(f.enabled=s)}let r=e.conversationMcpServers[n]||[],o=e.conversationMcpServerTools[n]||{},a=[];for(let f of r)if(!f.enabled){let p=o[f.name];p&&p.length>0?a.push(...p):a.push(`mcp__${f.name}`)}let u=[...(e.conversations.find(f=>f.id===n)?.disallowedTools||[]).filter(f=>!f.startsWith("mcp__")),...a];fr(e,n,{disallowedTools:u})}function al(e,t,s){let n=e.conversations.find(o=>o.id===t);e._recentlyDeletedSessions||(e._recentlyDeletedSessions={}),e._recentlyDeletedSessions[t]=Date.now(),e.conversations=e.conversations.filter(o=>o.id!==t),delete e.messagesMap[t],delete e.chatSessionState[t],delete e.processingConversations[t],we(e,t),delete e.executionStatusMap[t];let i=e.activeConversations.indexOf(t);i>=0&&(e.activeConversations.splice(i,1),e.activeConversations.length===0&&(localStorage.removeItem("lastViewedConversation"),e.lastViewedConversation=null));for(let o of e.panels)o.conversationId===t&&(o.conversationId=null);let r=e.pinnedSessions.indexOf(t);r>=0&&(e.pinnedSessions.splice(r,1),localStorage.setItem("pinned-sessions",JSON.stringify(e.pinnedSessions))),s&&s!==e.currentAgent?(e.sendWsMessage({type:"select_agent",agentId:s,silent:!0}),e.sendWsMessage({type:"delete_conversation",conversationId:t}),e.sendWsMessage({type:"select_agent",agentId:e.currentAgent,silent:!0})):e.sendWsMessage({type:"delete_conversation",conversationId:t}),e.saveOpenSessions()}function ll(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))),s&&s!==e.currentAgent?(e.sendWsMessage({type:"select_agent",agentId:s,silent:!0}),e.sendWsMessage({type:"delete_conversation",conversationId:t}),e.sendWsMessage({type:"select_agent",agentId:e.currentAgent,silent:!0})):e.sendWsMessage({type:"delete_conversation",conversationId:t})}function cl(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=tl();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),as(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=pr(n.expertSelections,e.customExpertRoles,t,e.language||"zh-CN");c&&(l.expertMessage=c.effectivePrompt)}e.sendWsMessage(l)||Os(e).then(()=>{e.sendWsMessage(l)}).catch(()=>{e.addMessage({type:"system",content:Ae("chat.connection.reconnectFailed")}),delete e.processingConversations[e.currentConversation],we(e,e.currentConversation)})}function dl(e){if(!e.currentConversation||!e.processingConversations[e.currentConversation])return;let t=e.currentConversation;e.sendWsMessage({type:"cancel_execution",conversationId:t}),delete e.processingConversations[t],we(e,t),e._closedAt||(e._closedAt={}),e._closedAt[t]=Date.now();let s=e.executionStatusMap[t];s&&(s.currentTool=null),e.finishStreamingForConversation(t),It(e,t),e.addMessage({type:"system",content:Ae("chat.execution.cancelled")})}function ul(e,t,s,n){let i=n||e.currentConversation,o=(e.messagesMap[i]||[]).find(m=>m.type==="tool-use"&&m.toolName==="AskUserQuestion"&&m.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?Bf(e,i):[],u=d.length===1?d[0]:null;if(c&&u&&c!==u)return!1;let f=a&&!c&&!u&&typeof e.agentIdForSession=="function"?e.agentIdForSession(l):null,p=e.sendWsMessage(a?{type:"yeaft_ask_user_answer",agentId:c||u||f||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&&p!==!1){let m=++Nf;o.askPending=!0,o.pendingAnswers=s,o.askSubmitGeneration=m;let y=setTimeout(()=>{o.askSubmitGeneration!==m||o.askPending!==!0||(o.askPending=!1,o.pendingAnswers=null,o.askSubmitGeneration=null)},Hf);typeof y?.unref=="function"&&y.unref()}p!==!1&&i&&!e.processingConversations[i]&&(e.processingConversations[i]=!0,e._closedAt?.[i]&&delete e._closedAt[i],e.getOrCreateExecutionStatus(i))}function pl(e,t){t&&(e.activeConversations.includes(t)||e.activeConversations.length>=3||(e.activeConversations.push(t),e.messagesMap[t]||(e.messagesMap[t]=[],e.sendWsMessage({type:"sync_messages",conversationId:t,turns:5})),os(e)))}function fl(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),os(e))}function gl(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=tl();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),as(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=pr(i.expertSelections,e.customExpertRoles,s,e.language||"zh-CN");d&&(c.expertMessage=d.effectivePrompt)}e.sendWsMessage(c)||Os(e).then(()=>{e.sendWsMessage(c)}).catch(()=>{e.addMessageToConversation(t,{type:"system",content:Ae("chat.connection.reconnectFailed")}),delete e.processingConversations[t],we(e,t)})}function ml(e,t){if(!t||!e.processingConversations[t])return;e.sendWsMessage({type:"cancel_execution",conversationId:t}),delete e.processingConversations[t],we(e,t),e._closedAt||(e._closedAt={}),e._closedAt[t]=Date.now();let s=e.executionStatusMap[t];s&&(s.currentTool=null),e.finishStreamingForConversation(t),It(e,t),e.addMessageToConversation(t,{type:"system",content:Ae("chat.execution.cancelled")})}function hl(e){e.ws&&e.ws.readyState===WebSocket.OPEN&&e.sendWsMessage({type:"get_agents"})}function vl(e){!e.currentAgent||!e.currentConversation||e.sendWsMessage({type:"refresh_conversation",conversationId:e.currentConversation})}function yl(e,t){t&&e.sendWsMessage({type:"restart_agent",agentId:t})}function bl(e,t){t&&e.sendWsMessage({type:"upgrade_agent",agentId:t})}var Hf,Nf,wl=N(()=>{Vt();Lt();ji();Pn();In();yt();Ws();Hf=1e4,Nf=0});function Wf(e=globalThis.localStorage){try{return e?.getItem(Sl)==="yeaft"?"yeaft":kl}catch{return kl}}function gr(e,t=globalThis.localStorage){if(e!=="chat"&&e!=="yeaft")return!1;try{return t?.setItem(Sl,e),!!t}catch{return!1}}function Cl(e=globalThis.localStorage){let t=Wf(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 Il(e){let t=!e._yeaftTransitionActive;return t&&(e._savedActiveConversations=[...e.activeConversations],e._yeaftTransitionActive=!0),e.activeConversations=[e.yeaftConversationId],t}function Al(e){e._yeaftTransitionActive&&(e.activeConversations=e._savedActiveConversations||[],e._savedActiveConversations=null,e._yeaftTransitionActive=!1)}var Sl,kl,xl=N(()=>{Sl="yeaft-preferred-conversation-view",kl="chat"});function Tl(e,t,s){let n={...e||{}},i={...n[t]||{}};return i[s]=(i[s]||0)+1,n[t]=i,n}function Ml(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 Pl=N(()=>{});function Dl(e){return e.currentView==="yeaft"?e.yeaftConversationId||null:e.activeConversations[0]||null}var El=N(()=>{});function _l({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 Rl=N(()=>{});function $e(e){let t=Number(e);return Number.isFinite(t)?t:null}function Ll(e){return jf.has(e)?1:0}function Kf(e,t){if(!e)return t||null;if(!t)return e;let s=$e(e.progressRevision),n=$e(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=Ll(e.status),r=Ll(t.status);if(i!==r)return r>i?t:e;let o=$e(e.updatedAt)??$e(e.createdAt)??0;return($e(t.updatedAt)??$e(t.createdAt)??0)>o?t:e}function En(...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,Kf(t.get(i.id),i))}return[...t.values()].sort((s,n)=>Number(s.createdAt||0)-Number(n.createdAt||0)||String(s.id||"").localeCompare(String(n.id||"")))}function _n(e,t){if(!e||!t||e.id!==t.id)return!1;let s=$e(e.revision),n=$e(t.revision);if(s!=null&&n!=null&&s!==n)return s<n;let i=$e(e.updatedAt),r=$e(t.updatedAt);return i!=null&&r!=null&&i<r}function $l(e,t){if(_n(e,t))return!0;if(!e||!t||e.id!==t.id)return!1;let s=$e(e.revision),n=$e(t.revision);return e.currentActionId!==t.currentActionId&&s!=null&&n!=null&&s<=n}function Vl(e,t){let s=$e(e?.progressRevision),n=$e(t?.progressRevision);return s!=null&&n!=null&&n<s}function Fl(e,t){return!e||e.id!==t?.id||!t.currentActionId?!1:!Array.isArray(e.actions)||!e.actions.some(s=>s?.id===t.currentActionId)}function Ol(e,t){if(!e||e.id!==t?.id||_n(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,$e(a?.progressRevision)==null){let{response:c,messages:d,...u}=a;return{...o,...u}}return Vl(o,a)?(n=!1,o):{...o,...a}}),r||(n=!1)}for(let i of zf)!n&&Yf.has(i)||Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i]);return s}function Hl(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?Vl(i,n):!1})}function Nl(e,t){return $e(e?.revision)===$e(t?.revision)&&$e(e?.updatedAt)===$e(t?.updatedAt)}function Bl(e,t){return!e||!t||e.id!==t.id?!1:_n(e,t)?!0:Nl(t,e)&&Hl(t.actions,e.actions)}function ql(e,t){let s=Array.isArray(e)?e:[],n=s.find(r=>r.id===t?.id)||null,i=n&&_n(t,n)?n:t;return n&&i===t&&Nl(n,t)&&Hl(n.actionStats,t.actionStats)&&(i={...t,status:n.status,currentActionId:n.currentActionId,currentAction:n.currentAction,executionStats:n.executionStats,failureReason:n.failureReason,actionStats:n.actionStats}),i?.id?[i,...s.filter(r=>r.id!==i.id)].sort((r,o)=>Number(o.updatedAt||0)-Number(r.updatedAt||0)):s}var zf,jf,Yf,mr=N(()=>{zf=Object.freeze(["revision","title","goal","workItemType","planningMode","status","lifecycle","attentionState","activeActionIds","attentionActionIds","currentActionId","currentAction","executionStats","failureReason","origin","linkedSessionIds","createdAt","updatedAt"]);jf=new Set(["completed","failed","cancelled","superseded","interrupted"]);Yf=new Set(["status","lifecycle","attentionState","activeActionIds","attentionActionIds","currentActionId","currentAction","executionStats","failureReason"])});function hr(e){return e?.type==="user"&&typeof e.content=="string"&&e.content.trim()}function vr(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 yr(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 Wl(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(hr(r)||r.type==="system"||r.type==="error"){n(i),s={start:i,kind:r.type};continue}if(!vr(r)){s||(s={start:i,kind:"other"});continue}(!s||s.kind==="assistant"&&yr(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 Ul(e,t){return t?e&&(e.sessionId??e.groupId)===t:!0}function br(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(!Ul(c,t))continue;let d=i.length;if(i.push(c),hr(c)||c.type==="system"||c.type==="error"){a(d),o={start:d,kind:c.type};continue}if(!vr(c)){o||(o={start:d,kind:"other"});continue}(!o||o.kind==="assistant"&&yr(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 zl(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(Ul(a,t)){if(hr(a)||a.type==="system"||a.type==="error"){if(o())return!0;r={kind:a.type};continue}if(!vr(a)){r||(r={kind:"other"});continue}if(!r||r.kind==="assistant"&&yr(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 Nt(){return 5}function wr(){return 5}var jl=N(()=>{});function Yl(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 Gl(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 Jf(e,t){return Ir.every(s=>!t[s]||e[s]===t[s])}function rc(e,t){return Ir.every(s=>!e[s]||!t[s]||e[s]===t[s])}function Ql(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=>Jf(Gl(o,s),t));if(i.length===1)return i[0];let r=n.filter(o=>rc(Gl(o,s),t));return r.length===1?r[0]:null}function oc(e){return Ir.map(t=>e[t]||"").join("\0")}function eg(e,t,s){let n=oc(t),i={...e._yeaftAskTerminalEvents||{},[n]:{identity:t,event:s,receivedAt:Date.now()}},r=Object.keys(i);if(r.length>Kl){r.sort((o,a)=>i[o].receivedAt-i[a].receivedAt);for(let o of r.slice(0,r.length-Kl))delete i[o]}e._yeaftAskTerminalEvents=i}function Xl(e,t){let s=e._yeaftAskTerminalEvents||{},n=oc(t),i=s[n]?n:null;if(!i){let l=Object.entries(s).filter(([,c])=>rc(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 tg(e,t,s){return(e.messagesMap?.[t]||[]).some(n=>n?.type==="tool-use"&&n.sessionId===s&&n.hasResult===!1)}function kr(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 sg(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 Zl(e){let t=e?.updatedAt||e?.endedAt||e?.createdAt,s=t?Date.parse(t):NaN;return Number.isFinite(s)?s:0}function Sr(e,t){return`${e||""}::${t||""}`}function Jl(e){let t=Object.entries(e||{}),s=t.filter(([,i])=>i?.status==="running"),n=t.filter(([,i])=>i&&i.status!=="running"&&ic.has(i.status)).sort((i,r)=>Zl(r[1])-Zl(i[1])).slice(0,Qf);return Object.fromEntries([...s,...n])}function ls(){try{return typeof window>"u"?null:window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore()||null}catch{return null}}function Fe(e,t,s=null){if(s)return s;if(t){let n=ls(),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 ng(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 ig(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"&&ng(n?.version||i?.version,"1.0.166")}function zs(e,{fallbackDefault:t=!1}={}){if(e?.yeaftActiveSessionFilter)return e.yeaftActiveSessionFilter;let s=ls();return s?.activeSessionId?s.activeSessionId:t?"grp_default":null}function Vn(e){let t=e.yeaftDebugSessionFilter;if(t==="__all__")return null;if(t)return t;let s=zs(e);return s||(ls()?.sessions?.grp_default?"grp_default":null)}function Us(e,t=null){let s=t||e?.yeaftActiveSessionFilter||null,n=Fe(e,s);return(n&&e?.yeaftConversationIdsByAgent?e.yeaftConversationIdsByAgent[n]:null)||e?.yeaftConversationId||null}function ec(e,t,s){if(e?.currentView!=="yeaft")return!1;let n=e?.yeaftActiveSessionFilter||null;if(n&&t!==n)return!1;let i=Fe(e,n);return!i||!s||i===s}var Gf,xe,Rn,Ln,Qf,ic,$n,Xf,Zf,Kl,Ir,tc,Cr,sc,nc,Bt,Fn=N(()=>{lt();yt();ji();In();Na();Ga();wl();Lt();Vt();xl();Pl();El();Rl();mr();rr();or();jl();({defineStore:Gf}=Pinia),xe=Object.freeze([]),Rn=(e,t)=>`${e||""}::${t}`,Ln=5,Qf=8,ic=new Set(["succeeded","failed","cancelled","orphaned"]),$n=new Set(["typing","thinking","streaming","tool"]),Xf=Object.freeze(["model","availableModels","refreshedAt","catalogRefreshedAt","catalogEpoch","catalogRevision","catalogDigest","refreshStartedAt","refreshReason","refreshError","refreshing"]),Zf=8,Kl=64;Ir=Object.freeze(["conversationId","agentId","requestId","toolCallId","sessionId","vpId","turnId","threadId"]);tc=1e3,Cr=1,sc=5,nc=200,Bt=Gf("chat",{state:()=>({ws:null,authenticated:!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:{},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,_pendingSessionTitle:null,workbenchExpanded:!1,workbenchMaximized:!1,sidebarCollapsed:!1,sessionSidebarOpen:!1,compactStatus:null,clearStatus:null,refreshingSession:!1,refreshingSessionMap:{},proxyPorts:{},hasMoreMessages:!1,loadingMoreMessages:!1,yeaftHasMoreHistory:!1,yeaftLoadingMoreHistory:!1,yeaftOldestLoadedSeq:null,yeaftSessionHistoryState:{},yeaftMessageWindowState:{},yeaftBootstrapMetaLoadingKey:null,yeaftHistoryPerfTraceBySession:{},yeaftHistorySearchState:{requestId:null,agentId:null,sessionId:null,query:"",loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:null},_yeaftHistorySearchTimeout:null,_yeaftHistoryWindowPending:null,_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")||"[]"),...Cl(),workCenterOpen:!1,workCenterAgentId:null,workCenterItemsByAgent:{},workCenterDetailByAgent:{},workCenterActionMessages:{},workCenterActionMessagesLoading:{},workCenterActionMessagesError:{},workCenterActionRequests:{},workCenterActionRequestDetails:{},workCenterActionRequestsLoading:{},workCenterActionRequestsError:{},workCenterActionRequestDetailsLoading:{},workCenterActionRequestDetailsError:{},workCenterLoadedByAgent:{},workCenterLoadingByAgent:{},workCenterErrorByAgent:{},workCenterWatcherByAgent:{},workCenterSettingsByAgent:{},workCenterRuntimeByAgent:{},workCenterSettingsLoadingByAgent:{},workCenterSettingsErrorByAgent:{},_workCenterSettingsGenerationByAgent:{},_workCenterDetailRequestGenerationByAgent:{},_workCenterDetailEventRefreshByAgent:{},_workCenterActionInputGenerationByAgent:{},_workCenterActionMessageRequests:{},_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:Cr,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=>Dl(e),messages(e){let t=this.activeConversationId,s=t&&e.messagesMap[t]||xe;if(e.currentView==="yeaft"){let n=e.yeaftActiveSessionFilter||"__all__",i=e.yeaftMessageWindowState[n]?.visibleTurns||Nt();return br(s,e.yeaftActiveSessionFilter||null,i)}return s},yeaftAllMessages:e=>{let t=Us(e);return t&&e.messagesMap[t]||xe},yeaftVisibleMessages(e){let t=Us(e),s=t&&e.messagesMap[t]||xe,n=e.yeaftActiveSessionFilter||"__all__",i=e.yeaftMessageWindowState[n]?.visibleTurns||Nt();return br(s,e.yeaftActiveSessionFilter||null,i)},hasHiddenYeaftMessages(e){if(e.currentView!=="yeaft")return!1;let t=Us(e),s=t&&e.messagesMap[t]||xe,n=e.yeaftActiveSessionFilter||"__all__",i=e.yeaftMessageWindowState[n]?.visibleTurns||Nt();return zl(s,e.yeaftActiveSessionFilter||null,i)},vpsTypingInCurrentConv(e){let t=this.activeConversationId;if(!t)return xe;let s=(e.yeaftVpTyping||{})[t];if(!s)return xe;let n=Object.keys(s).filter(i=>(s[i]||0)>0);return n.length===0?xe: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=Vn(e);if(!t)return null;let s=`sessions/${t}`;return e.yeaftDreamLatest?.[s]||null},yeaftDreamSnapshotForActiveSession(e){let t=Vn(e);if(!t)return null;let s=`sessions/${t}`;return e.yeaftDreamSnapshots?.[s]||null},yeaftDreamPromptLoadForActiveSession(e){let t=Vn(e);if(!t)return null;let s=`sessions/${t}`;return e.yeaftDreamPromptLoads?.[s]||null},yeaftDreamEventsForActiveSession(e){let t=Vn(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||xe,s=e.yeaftDebugTurnsById||{},n=e.yeaftDebugLoops||xe,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],f=s[u];if(!f||o&&f.sessionId&&f.sessionId!==o)continue;let p=a[u]||xe,m=l[u]||xe,y=p.length,h=0,A=0;for(let v of p){let g=v&&v.usage;g&&Number.isFinite(g.totalTokens)?h+=g.totalTokens:g&&(h+=(g.totalInputTokens||(g.inputTokens||0)+(g.cacheReadTokens||0)+(g.cacheWriteTokens||0))+(g.outputTokens||0)),v&&Number.isFinite(v.latencyMs)&&(A+=v.latencyMs)}let x=!f.closedAt,S={...f,loopCount:x||!f.loopCount?y:f.loopCount,totalTokens:x||!f.totalTokens?h:f.totalTokens,totalMs:x||!f.totalMs?A:f.totalMs,loops:p,reflections:m};c.push(S)}return c},yeaftDebugAvailableSessions:e=>{let t=new Set;for(let s of e.yeaftDebugTurnOrder||xe){let n=e.yeaftDebugTurnsById[s];n&&n.sessionId&&t.add(n.sessionId)}return Array.from(t).sort()},yeaftDebugTurnTotal:e=>(e.yeaftDebugTurnOrder||xe).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=zs(e);if(!t)return!1;if(e.yeaftProcessingSessions?.[t])return!0;for(let s of Object.values(e.activeVpTurns||{}))if(s?.sessionId===t)return!0;for(let s of Object.values(e.vpStatuses||{}))if((s?.sessionId||s?.groupId||null)===t&&$n.has(s?.state))return!0;return!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"?ls()?.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=>{if(!t)return!1;if(e.yeaftProcessingSessions?.[t])return!0;for(let s of Object.values(e.activeVpTurns||{}))if(s?.sessionId===t)return!0;for(let s of Object.values(e.vpStatuses||{}))if((s?.sessionId||s?.groupId||null)===t&&$n.has(s?.state))return!0;return!1},showRecoveryBanner:e=>e.pendingRecovery&&!e.recoveryDismissed&&!e.currentConversation,currentSubagents:e=>{if(!e.currentConversation)return xe;let t=e.subagents[e.currentConversation];return t?Object.values(t):xe},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 xe;let t=e.subagents[e.currentConversation];if(!t)return xe;let s=t[e.activeSubagentId];return(Array.isArray(s?.messages)?s.messages:xe).filter(i=>i?.type==="text")},selectedTaskInfo:()=>null,currentMcpServers:e=>e.currentConversation&&e.conversationMcpServers[e.currentConversation]||xe},actions:{activateChatView({persistPreference:e=!1}={}){let t=this._pendingChatRestoreConversationId;this._pendingChatRestoreConversationId=null,this.currentView="chat",e&&gr("chat"),Al(this),t&&this.conversations.some(s=>s.id===t)&&(this.autoRestoreConversation(t),this.sendWsMessage({type:"refresh_conversation",conversationId:t}))},enterWorkCenter(e=null){let t=e||this.currentAgent||this.agents.find(s=>s.online)?.id||null;if(t){if(this.currentAgent!==t){this.selectAgent(t),this.currentAgent=t;let s=this.agents.find(n=>n.id===t);s&&(this.currentAgentInfo=s)}this.workCenterAgentId=t,this.workCenterOpen=!0,this.listWorkItems(t).catch(()=>{})}},leaveWorkCenter(){this.workCenterOpen=!1},enterWorkCenterFromSession(e,t=""){if(!e?.id)return;let s=e.agentId||Fe(this,e.id);this.workCenterCreateDraft={sourceAgentId:s,title:String(e.title||e.name||"").trim(),goal:String(t||"").trim(),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})})},async listWorkItems(e=null,t={}){let s=e||this.workCenterAgentId||this.currentAgent;if(!s)return[];this.workCenterLoadingByAgent={...this.workCenterLoadingByAgent,[s]:!0},this.workCenterErrorByAgent={...this.workCenterErrorByAgent,[s]:null};try{let n=await this.workCenterRequest("list",t,s),i=Array.isArray(n?.items)?n.items:[];return this.workCenterItemsByAgent={...this.workCenterItemsByAgent,[s]:i},this.workCenterWatcherByAgent={...this.workCenterWatcherByAgent,[s]:n?.watcher||null},this.workCenterLoadedByAgent={...this.workCenterLoadedByAgent,[s]:!0},i}catch(n){throw this.workCenterErrorByAgent={...this.workCenterErrorByAgent,[s]:n?.message||String(n)},n}finally{this.workCenterLoadingByAgent={...this.workCenterLoadingByAgent,[s]:!1}}},beginWorkCenterDetailWrite(e){let t=Number(this._workCenterDetailRequestGenerationByAgent[e]||0)+1;return this._workCenterDetailRequestGenerationByAgent={...this._workCenterDetailRequestGenerationByAgent,[e]:t},t},commitWorkCenterDetail(e,t,s){if(s!=null&&Number(this._workCenterDetailRequestGenerationByAgent[e]||0)!==s)return!1;let n=this.workCenterDetailByAgent[e];return n?.id===t?.id&&Bl(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},async loadWorkItemActionMessages(e,t,s,n=null){let i=n||this.workCenterAgentId||this.currentAgent,r=`${i}:${e}:${t}`,o=`${r}:${s==null?"latest":String(s)}`;if(this._workCenterActionMessageRequests[o])return this._workCenterActionMessageRequests[o];this.workCenterActionMessagesLoading={...this.workCenterActionMessagesLoading,[r]:!0},this.workCenterActionMessagesError={...this.workCenterActionMessagesError,[r]:null};let a=(async()=>{try{let l=await this.workCenterRequest("get_action_messages",{id:e,actionId:t,cursor:s,limit:20},i),c=this.workCenterActionMessages[r]?.messages||[],d=En(c,l?.messages||[]),u=this.workCenterActionMessages[r],f=u?.nextCursor,p=s==null?null:Number(s),m=f==null?null:Number(f),y=!u||p==null||m!=null&&p===m;return this.workCenterActionMessages={...this.workCenterActionMessages,[r]:{messages:d,nextCursor:y?l?.nextCursor??null:f,total:Math.max(Number(l?.total)||0,Number(u?.total)||0,d.length)}},l}catch(l){throw this.workCenterActionMessagesError={...this.workCenterActionMessagesError,[r]:l?.message||String(l)},l}finally{let l={...this._workCenterActionMessageRequests};delete l[o],this._workCenterActionMessageRequests=l;let c=Object.keys(l).some(d=>d.startsWith(`${r}:`));this.workCenterActionMessagesLoading={...this.workCenterActionMessagesLoading,[r]:c}}})();return this._workCenterActionMessageRequests={...this._workCenterActionMessageRequests,[o]:a},a},async loadWorkItemActionRequests(e,t,s=null){let n=s||this.workCenterAgentId||this.currentAgent,i=`${n}:${e}:${t}`,r=Number(this._workCenterActionRequestsGeneration[i]||0)+1;this._workCenterActionRequestsGeneration={...this._workCenterActionRequestsGeneration,[i]:r},this.workCenterActionRequestsLoading={...this.workCenterActionRequestsLoading,[i]:!0},this.workCenterActionRequestsError={...this.workCenterActionRequestsError,[i]:null};try{let o=await this.workCenterRequest("get_action_requests",{id:e,actionId:t},n);return this._workCenterActionRequestsGeneration[i]===r&&(this.workCenterActionRequests={...this.workCenterActionRequests,[i]:o?.requests||[]}),o?.requests||[]}catch(o){throw this._workCenterActionRequestsGeneration[i]===r&&(this.workCenterActionRequestsError={...this.workCenterActionRequestsError,[i]:o?.message||String(o)}),o}finally{this._workCenterActionRequestsGeneration[i]===r&&(this.workCenterActionRequestsLoading={...this.workCenterActionRequestsLoading,[i]:!1})}},async loadWorkItemActionRequest(e,t,s,n,i=null){let r=i||this.workCenterAgentId||this.currentAgent,o=`${r}:${e}:${t}:${s}:${n}`,a=Number(this._workCenterActionRequestDetailsGeneration[o]||0)+1;this._workCenterActionRequestDetailsGeneration={...this._workCenterActionRequestDetailsGeneration,[o]:a},this.workCenterActionRequestDetailsLoading={...this.workCenterActionRequestDetailsLoading,[o]:!0},this.workCenterActionRequestDetailsError={...this.workCenterActionRequestDetailsError,[o]:null};try{let l=await this.workCenterRequest("get_action_request",{id:e,actionId:t,runId:s,requestId:n},r);return this._workCenterActionRequestDetailsGeneration[o]===a&&(this.workCenterActionRequestDetails={...this.workCenterActionRequestDetails,[o]:l?.request||null}),l?.request||null}catch(l){throw this._workCenterActionRequestDetailsGeneration[o]===a&&(this.workCenterActionRequestDetailsError={...this.workCenterActionRequestDetailsError,[o]:l?.message||String(l)}),l}finally{this._workCenterActionRequestDetailsGeneration[o]===a&&(this.workCenterActionRequestDetailsLoading={...this.workCenterActionRequestDetailsLoading,[o]:!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.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.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.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.commitWorkCenterDetail(s,i,n),i},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);let d=this.workCenterDetailByAgent[a],u=d?.id===e&&d.currentActionId===s&&Number(d.revision)===Number(n);return this._workCenterActionInputGenerationByAgent[a]===l&&u&&!$l(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.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]||[];this.workCenterItemsByAgent={...this.workCenterItemsByAgent,[e]:ql(n,s)};let i=this.workCenterDetailByAgent[e];if(i?.id===s.id){let r=Fl(i,s);this.workCenterDetailByAgent={...this.workCenterDetailByAgent,[e]:Ol(i,s)},r&&this.refreshWorkItemDetailAfterActionChange(e,s)}},async refreshWorkItemDetailAfterActionChange(e,t){let s=`${t.id}:${t.currentActionId}`;if(this._workCenterDetailEventRefreshByAgent[e]===s)return;let n=Number(this._workCenterDetailRequestGenerationByAgent[e]||0);this._workCenterDetailEventRefreshByAgent={...this._workCenterDetailEventRefreshByAgent,[e]:s};try{let i=await this.workCenterRequest("get",{id:t.id},e),r=this.workCenterDetailByAgent[e];r?.id===t.id&&r.currentActionId===t.currentActionId&&i?.currentActionId===t.currentActionId&&this.commitWorkCenterDetail(e,i,n)}catch{}finally{if(this._workCenterDetailEventRefreshByAgent[e]===s){let i={...this._workCenterDetailEventRefreshByAgent};delete i[e],this._workCenterDetailEventRefreshByAgent=i}}},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),f=Array.isArray(this._yeaftRetiredCatalogEpochsByAgent?.[e])?this._yeaftRetiredCatalogEpochsByAgent[e]:[],p=!!a&&f.includes(a),m=!!a&&a===o,y=r>0?m&&r===i:c>0&&c===l,h=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,x=u&&!p&&(h||y&&A),v=x||s&&i===0&&l===0&&!u&&d,g={...t};if(!v)for(let D of Xf)delete g[D];let b={...n,...g};if(v){if(x&&o&&a&&o!==a){let D=[...f.filter(L=>L!==o),o].slice(-Zf);this._yeaftRetiredCatalogEpochsByAgent={...this._yeaftRetiredCatalogEpochsByAgent||{},[e]:D}}b.availableModels=t.availableModels,b.catalogRefreshedAt=x?c:null,b.catalogEpoch=x&&a||null,b.catalogRevision=x&&r||null,b.catalogDigest=x&&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)},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]=[]),Il(this),this.currentView="yeaft",gr("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=zs(this),i=n?Fe(this,n):this.currentAgent,r=et(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(A=>A&&(A.sessionId??A.groupId??null)===n),d=!!n&&er({sessionState:o,hasCachedSessionRows:c,force:!!s}),u=!!n&&!d&&ha(o,t);if(!a&&!d&&!u)return!1;let f=`${i}:${n||"__none__"}`,p=a&&!d&&!u;if(p&&this.yeaftBootstrapMetaLoadingKey===f)return!1;p&&(this.yeaftBootstrapMetaLoadingKey=f),n&&d?(this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[r]:{loaded:!1,loading:!0,hasMore:!1,oldestSeq:null,count:0}},this.yeaftLoadingMoreHistory=!0):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&&(this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[r]:{...o,loaded:!0,loading:!0,latestSeq:l}},this.yeaftLoadingMoreHistory=!0);let m={type:"yeaft_load_history",agentId:i,sessionId:n};u?m.afterSeq=l:m.limit=d?Ln:0;let y=Bs();m.perfTraceId=y;let h=u?"delta":d?"recent":"metadata";return n&&(this.yeaftHistoryPerfTraceBySession={...this.yeaftHistoryPerfTraceBySession||{},[r]:y}),Qe(this,{traceId:y,phase:"history.request_send",agentId:i,sessionId:n,messageType:m.type,bytes:JSON.stringify(m).length,detail:{mode:h,limit:m.limit??null,afterSeq:m.afterSeq??null,hasCachedSessionRows:c,needSessionReady:a}}),this.sendWsMessage(m),!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?sc:Cr,c=Number.isFinite(t)&&t>0?t:this.yeaftDebugHistoryLimit||l,d=Math.max(1,Math.min(l,c)),u=a?"detail":"list",f=`dbg_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`,p=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===p)return;this._yeaftDebugHistoryInFlightKey=p,a||(this._yeaftDebugHistoryLatestListRequestId=f),this.yeaftDebugHistoryLimit=d,this.yeaftDebugHistoryLoading=!0,this.yeaftDebugHistoryError=null;let m={type:"yeaft_fetch_debug_history",agentId:this.currentAgent,requestId:f,requestKind:u,limit:d,dreamLimit:Number.isFinite(s)&&s>0?s:5};n&&(m.indexOnly=!0),typeof i=="string"&&i?m.detailTurnId=i:o&&(m.search=o),typeof e=="string"&&e&&(m.sessionId=e),this.sendWsMessage(m),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 Fe(this,e)},sendYeaftSessionMessage({groupId:e,text:t,mentions:s,attachments:n}){let i=Fe(this,e);if(!e||!i)return;let r=Array.isArray(n)?n.filter(f=>f&&f.fileId):[],o=r.length>0;if(!t?.trim()&&!o)return;let a=t?.trim()?t:"(attached files)",l=`u_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`,c=Bs();this.yeaftPerfTraceByMessageId={...this.yeaftPerfTraceByMessageId||{},[l]:c},Qe(this,{traceId:c,phase:"send.prepare",agentId:i,sessionId:e,turnId:l,messageType:"yeaft_session_send",detail:{mentionCount:Array.isArray(s)?s.length:0,attachmentCount:r.length}});let d=Us(this,e);if(d){let f={id:l,messageId:l,clientMessageId:l,type:"user",content:a,sessionId:e,turnId:l};r.length>0&&(f.attachments=r.map(p=>({fileId:p.fileId,name:p.name,preview:p.preview,isImage:!!p.isImage,mimeType:p.mimeType||""}))),this.addMessageToConversation(d,f),this.processingConversations[d]=!0,e&&(this.yeaftProcessingSessions={...this.yeaftProcessingSessions,[e]:!0}),this._turnCompletedConvs?.delete(d),this._closedAt?.[d]&&delete this._closedAt[d],this.getOrCreateExecutionStatus(d),sr(this,d)}let u={type:"yeaft_session_send",agentId:i,id:l,sessionId:e,text:a,mentions:Array.isArray(s)?s:[],perfTraceId:c};r.length>0&&(u.attachments=r.map(f=>({fileId:f.fileId,isImage:!!f.isImage}))),Qe(this,{traceId:c,phase:"send.websocket_send",agentId:i,sessionId:e,turnId:l,messageType:u.type,bytes:JSON.stringify(u).length}),this.sendWsMessage(u)},cancelYeaftTask({sessionId:e,taskId:t}){let s=typeof e=="string"?e.trim():"",n=typeof t=="string"?t.trim():"",i=Fe(this,s);return!i||!s||!n?!1:(this.yeaftStoppingTasksById={...this.yeaftStoppingTasksById,[Sr(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:Nt()}}},expandYeaftMessageWindow(e=null,t=wr()){if(this.currentView!=="yeaft")return;let s=this.getYeaftMessageWindowKey(e),i=(this.yeaftMessageWindowState[s]?.visibleTurns||Nt())+Math.max(1,Number.isFinite(t)?Math.floor(t):wr());this.yeaftMessageWindowState={...this.yeaftMessageWindowState,[s]:{visibleTurns:i}}},revealYeaftMessage(e,t){let s=e||this.yeaftActiveSessionFilter||null,n=Us(this);if(!n||!t)return!1;let i=(this.messagesMap[n]||[]).filter(d=>s?(d?.sessionId??d?.groupId??null)===s:!0),r=i.findIndex(d=>(d?.id||d?.messageId)===t);if(r<0)return!1;let o=Wl(i),a=o.findIndex(d=>r>=d.start&&r<d.end);if(a<0)return!1;let l=Math.max(Nt(),o.length-a),c=this.getYeaftMessageWindowKey(s);return this.yeaftMessageWindowState={...this.yeaftMessageWindowState,[c]:{visibleTurns:l}},!0},searchYeaftHistory(e,{append:t=!1}={}){if(this.currentView!=="yeaft")return!1;let s=typeof e=="string"?e.trim():"",n=this.yeaftActiveSessionFilter||null,i=Fe(this,n);if(this._yeaftHistorySearchTimeout&&(clearTimeout(this._yeaftHistorySearchTimeout),this._yeaftHistorySearchTimeout=null),!n||!i||s.length<2)return this.yeaftHistorySearchState={requestId:null,agentId:i,sessionId:n,query:s,loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:null},!1;let r=this.yeaftHistorySearchState||{};if(!ig(this,i,"session_history_search"))return this.yeaftHistorySearchState={requestId:null,agentId:i,sessionId:n,query:s,loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:"unsupported"},!1;let o=`history_search_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return this.yeaftHistorySearchState={requestId:o,agentId:i,sessionId:n,query:s,loading:!0,results:t&&r.query===s?r.results:[],hasMore:!1,nextBeforeSeq:t&&r.query===s?r.nextBeforeSeq:null,error:null},this._yeaftHistorySearchTimeout=setTimeout(()=>{this.yeaftHistorySearchState?.requestId===o&&(this._yeaftHistorySearchTimeout=null,this.yeaftHistorySearchState={...this.yeaftHistorySearchState,loading:!1,error:"timeout"})},1e4),this.sendWsMessage({type:"yeaft_search_history",agentId:i,sessionId:n,requestId:o,query:s,limit:20,...t&&Number.isFinite(r.nextBeforeSeq)?{beforeSeq:r.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)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=Fe(this,t);if(!t||!s||!e?.messageId||!Number.isFinite(e.seq))return Promise.resolve(!1);if(this.revealYeaftMessage(t,e.messageId))return Promise.resolve(!0);let n=`history_window_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,i=this._yeaftHistoryWindowPending;return i&&(clearTimeout(i.timeout),i.resolve(!1),this._yeaftHistoryWindowPending=null),new Promise(r=>{let o=setTimeout(()=>{this._yeaftHistoryWindowPending?.requestId===n&&(this._yeaftHistoryWindowPending=null),r(!1)},1e4);this._yeaftHistoryWindowPending={requestId:n,agentId:s,sessionId:t,messageId:e.messageId,resolve:r,timeout:o},this.sendWsMessage({type:"yeaft_load_history_window",agentId:s,sessionId:t,requestId:n,anchorMessageId:e.messageId,anchorSeq:e.seq,beforeTurns:3,afterTurns:3})})},handleYeaftHistoryWindow(e){let t=this._yeaftHistoryWindowPending;if(!t||e?.requestId!==t.requestId||e.agentId!==t.agentId||e.sessionId!==t.sessionId)return!1;clearTimeout(t.timeout),this._yeaftHistoryWindowPending=null;let s=!e.error&&this.revealYeaftMessage(t.sessionId,t.messageId);return t.resolve(!!s),!!s},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&&(Qe(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.conversationId||this.yeaftConversationId;if(s){let n=e.agentId||this.yeaftAgentId||this.currentAgent||null,i=e.sessionId??e.groupId??null,r=ec(this,i,n),o=n&&this.yeaftConversationIdsByAgent?this.yeaftConversationIdsByAgent[n]:null,a=!r&&o===this.yeaftConversationId;if(this.currentView==="yeaft"&&n&&o&&o!==s){let f=this.messagesMap[o]||[],p=this.messagesMap[s]||[];this.messagesMap[s]=Ji(p,f).sort((m,y)=>(m.timestamp||0)-(y.timestamp||0)),!a&&String(o).startsWith("yeaft-local-")&&delete this.messagesMap[o]}n&&(this.yeaftConversationIdsByAgent={...this.yeaftConversationIdsByAgent||{},[n]:s}),(r||!this.yeaftConversationId)&&(this.yeaftConversationId=s),r&&(this.activeConversations=[s]),this.messagesMap[s]||(this.messagesMap[s]=[]),this.currentView==="yeaft"&&(e.data?.type==="user"||e.data?.type==="text_delta")&&this.pruneYeaftMessageWindow(this.yeaftActiveSessionFilter&&e.sessionId||null);let l=this._currentYeaftSessionId,c=this._currentYeaftVpId,d=this._currentYeaftTurnId,u=this._currentYeaftThreadId;i!=null&&(this._currentYeaftSessionId=i),e.vpId&&(this._currentYeaftVpId=e.vpId),e.turnId&&(this._currentYeaftTurnId=e.turnId),e.threadId&&(this._currentYeaftThreadId=e.threadId);try{this.currentView==="yeaft"&&i&&(!this.yeaftActiveSessionFilter||i===this.yeaftActiveSessionFilter)&&this.pruneYeaftMessageWindow(this.yeaftActiveSessionFilter?i:null);let p=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now();if(this.handleAssistantOutputFrame(s,e.data),e.perfTraceId){let v=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now();Qe(this,{traceId:e.perfTraceId,phase:"store.apply_output",agentId:e.agentId||null,sessionId:i||null,vpId:e.vpId||null,turnId:e.turnId||null,threadId:e.threadId||null,messageType:e.data?.type||null,durationMs:v-p}),Tn(this,{traceId:e.perfTraceId,agentId:e.agentId||null,sessionId:i||null,vpId:e.vpId||null,turnId:e.turnId||null,threadId:e.threadId||null,messageType:e.data?.type||null})}let m=e.data,y=m?.message?.id||m?.id||null,h=sg(y),A=Array.isArray(m?.message?.content)?m.message.content:[],x=A.some(v=>v?.type==="tool_use"),S=!!m?.tool_use_result||A.some(v=>v?.type==="tool_result");if(i){let v=!S&&!tg(this,s,i)&&(m?.type==="user"||m?.type==="assistant"&&!x)?h:null,g=et(e.agentId||null,i),b=this.yeaftSessionHistoryState[g]||{},D=Number.isFinite(b.latestSeq)?b.latestSeq:-1;v!==null&&v>D&&(this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[g]:{...b,latestSeq:v}})}}finally{this._currentYeaftSessionId=l,this._currentYeaftVpId=c,this._currentYeaftTurnId=d,this._currentYeaftThreadId=u}}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=Yl(e,t,s),i=()=>{let r=this.messagesMap[s]||[],o=Ql(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=Xl(this,n);return c&&kr(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=Xl(this,n);return l&&kr(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=Yl(e,t,s),r=Ql(n,i,s);if(!r){eg(this,i,t);break}kr(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=ec(this,l,n),d=!c&&a===this.yeaftConversationId;if(a&&a!==s){let y=this.messagesMap[a]||[],h=this.messagesMap[s]||[];this.messagesMap[s]=Ji(h,y).sort((A,x)=>(A.timestamp||0)-(x.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])}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:[],f={};for(let y of u)!y?.id||!y.sessionId||y.status!=="running"||(f[y.sessionId]={...f[y.sessionId]||{},[y.id]:y});this.yeaftActiveTasksBySession=f,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 p=e.agentId||this.currentAgent||null,m=p||"__current__";this._yeaftVpSubscribedAgentKey!==m&&(this._yeaftVpSubscribedAgentKey=m,this.sendWsMessage(p?{type:"yeaft_vp_subscribe",agentId:p}:{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>tc){let s=_l({loops:this.yeaftDebugLoops,turnsById:this.yeaftDebugTurnsById,turnOrder:this.yeaftDebugTurnOrder,maxLoops:Math.max(tc,this.yeaftDebugHistoryLimit||0)});this.yeaftDebugLoops=s.loops,this.yeaftDebugTurnsById=s.turnsById,this.yeaftDebugTurnOrder=s.turnOrder}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"||ic.has(s.status)?i[s.id]=s:delete i[s.id];let r=Jl(i);if(Object.keys(r).length>0?n[s.sessionId]=r:delete n[s.sessionId],this.yeaftActiveTasksBySession=n,s.status!=="running"){let{[Sr(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{[Sr(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=Jl(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}
|
|
7
7
|
|
|
8
|
-
${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=e.agentId||null,n=t.sessionId??null,i=et(s,n),r=e.perfTraceId||this.yeaftHistoryPerfTraceBySession?.[i];r&&Qe(this,{traceId:r,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 o=t.mode==="delta"?"delta":"recent",a=this.yeaftSessionHistoryState[i]||{},l=Number.isFinite(t.latestSeq)?t.latestSeq:Number.isFinite(a.latestSeq)?a.latestSeq:null,c=o==="delta"?{...a,loaded:!0,loading:!1,latestSeq:l,syncingAfterSeq:null,count:(a.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:l,syncingAfterSeq:null};this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[i]:c};let d=et(s?this.currentAgent:null,this.yeaftActiveSessionFilter??null);if(i===d)o==="recent"&&(this.yeaftHasMoreHistory=c.hasMore,this.yeaftOldestLoadedSeq=c.oldestSeq),this.yeaftLoadingMoreHistory=!1;else if(this.yeaftLoadingMoreHistory){let u=this.yeaftSessionHistoryState[d]||null;this.yeaftLoadingMoreHistory=!!u?.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=s&&s.activeSessionId||null,i=t.sessions||[];s&&s.applySnapshot(i,e.agentId||null);let r=s&&s.activeSessionId||null;if(this.currentView==="yeaft"&&r){let o=Fe(this,r,e.agentId||null),a=et(o,r),l=this.yeaftSessionHistoryState[a]||null;this.setActiveSessionFilter(r,{agentId:o,force:ma(r,n,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;this.activeVpTurns={...this.activeVpTurns,[t.turnId]:{vpId:t.vpId,sessionId:t.sessionId||null,threadId:t.threadId||null,isStreaming:!0,startedAt:t.ts||Date.now()}},t.sessionId&&(this.yeaftProcessingSessions={...this.yeaftProcessingSessions,[t.sessionId]:!0});break}case"vp_turn_end":{if(!t.turnId)break;let{[t.turnId]:s,...n}=this.activeVpTurns;this.activeVpTurns=n;let{[t.turnId]:i,...r}=this.stoppingVpTurnIds;this.stoppingVpTurnIds=r,this.clearYeaftSessionProcessingIfIdle(t.sessionId||s?.sessionId||null);let a={end_turn:"completed",route_forward:"completed",aborted:"aborted",errored:"errored"}[t.reason]||"completed",l=Date.now(),c=this.yeaftConversationId;if(c&&Array.isArray(this.messagesMap[c])){let d=this.messagesMap[c],u=!1;for(let f=0;f<d.length;f++){let p=d[f];if(!p||p.type!=="assistant")continue;let m=p.sessionId??p.groupId;t.sessionId&&m&&m!==t.sessionId||t.vpId&&p.speakerVpId&&p.speakerVpId!==t.vpId||t.turnId&&p.turnId&&p.turnId!==t.turnId||p.status&&p.status!=="pending"||(p.status=a,p.turnEndAt=l,p.turnEndReason=t.reason||null,t.detail&&(p.turnEndDetail=t.detail),Number.isFinite(t.durationMs)&&(p.turnDurationMs=t.durationMs),u=!0)}u&&(this.messagesMap={...this.messagesMap,[c]:d.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(s);if(i)for(let[c,d]of Object.entries(this.activeVpTurns||{}))!d||d.vpId!==i||n&&d.sessionId!==n||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);break}case"yeaft_aborted":{let s=t.sessionId||e.sessionId||null;s?(this.activeVpTurns=Object.fromEntries(Object.entries(this.activeVpTurns||{}).filter(([,n])=>n?.sessionId!==s)),this.stoppingVpTurnIds=Object.fromEntries(Object.entries(this.stoppingVpTurnIds||{}).filter(([n])=>this.activeVpTurns?.[n])),this.clearYeaftSessionProcessingIfIdle(s)):t.all&&(this.activeVpTurns={},this.stoppingVpTurnIds={},this.yeaftProcessingSessions={});break}case"vp_typing_start":{if(!t.vpId)break;let s=e.conversationId||this.yeaftConversationId;if(!s)break;this.yeaftVpTyping=Tl(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=Ml(this.yeaftVpTyping,s,t.vpId);break}case"vp_status_changed":{if(!t.vpId||!t.state)break;let s=t.sessionId||null,n=Rn(s,t.vpId),i={state:t.state,since:t.since||Date.now(),turnId:t.turnId||null,title:t.title||"",sessionId:s,vpId:t.vpId};this.vpStatuses={...this.vpStatuses,[n]:i},s&&$n.has(t.state)?this.yeaftProcessingSessions={...this.yeaftProcessingSessions,[s]:!0}:s&&this.clearYeaftSessionProcessingIfIdle(s),this.restoreActiveYeaftSessionFromStatuses([i]);break}case"vp_status_snapshot":{let s=Array.isArray(t.statuses)?t.statuses:[],n=t.sessionId;if(n==null){let i={};for(let r of s){if(!r||!r.vpId)continue;let o=r.sessionId||r.groupId||null,a=Rn(o,r.vpId);i[a]={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&&delete i[r];for(let r of s){if(!r||!r.vpId)continue;let o=r.sessionId||r.groupId||null,a=Rn(o,r.vpId);i[a]={state:r.state,since:r.since||Date.now(),turnId:r.turnId||null,title:r.title||"",sessionId:o,vpId:r.vpId}}this.vpStatuses=i}this.restoreActiveYeaftSessionFromStatuses(s);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>nc&&a.splice(0,a.length-nc),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)})},restoreActiveYeaftSessionFromStatuses(e=[]){if(this.yeaftActiveSessionFilter)return null;let s=(Array.isArray(e)?e:[]).filter(i=>i&&(i.sessionId||i.groupId)&&!["idle","offline","completed","failed","aborted"].includes(i.state)).sort((i,r)=>(r.updatedAt||r.since||0)-(i.updatedAt||i.since||0)),n=s[0]?.sessionId||s[0]?.groupId||null;if(!n)return null;this.setActiveSessionFilter(n,{force:!0});try{let i=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();i&&typeof i.setActive=="function"&&i.setActive(n)}catch{}return n},setActiveSessionFilter(e,t={}){let s=this.yeaftActiveSessionFilter||null,n=e||null,i=n?Fe(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(!o&&n===s)return;let a=et(i,n),l=this.yeaftSessionHistoryState[a]||null;if(this.yeaftHasMoreHistory=!!l?.hasMore,this.yeaftLoadingMoreHistory=!!l?.loading,this.yeaftOldestLoadedSeq=typeof l?.oldestSeq=="number"?l.oldestSeq:null,this.pruneYeaftMessageWindow(n),!l?.loading&&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]);let d=Number.isFinite(l?.latestSeq)?l.latestSeq:null,u={type:"yeaft_load_history",agentId:i,sessionId:n},f=!!l?.loaded,p=er({sessionState:l,hasCachedSessionRows:!1,force:o});if(!p&&d!==null?u.afterSeq=d:u.limit=Ln,!p&&f&&d===null){this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[a]:{...l||{hasMore:!1,oldestSeq:null,count:0},loaded:!0,loading:!1,syncingAfterSeq:null}},this.yeaftLoadingMoreHistory=!1;return}if(!p&&f){if(l?.syncingAfterSeq===d)return;this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[a]:{...l||{hasMore:!1,oldestSeq:null,count:0},loaded:!0,loading:!1,syncingAfterSeq:d,latestSeq:d}},this.yeaftLoadingMoreHistory=!1}else this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[a]:{...l||{hasMore:!1,oldestSeq:null,count:0},loaded:!1,loading:!0,syncingAfterSeq:null,latestSeq:p?null:d}},this.yeaftLoadingMoreHistory=!0;this.sendWsMessage(u)}},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:Fe(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()?sc:Cr,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},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 na(this,e)},parseWsMessage(e){return ia(this,e)},connect(){ra(this)},ensureConnected(){return Os(this)},scheduleReconnect(){oa(this)},manualReconnect(){aa(this)},startHeartbeat(){la(this)},stopHeartbeat(){ca(this)},setupVisibilityHandler(){da(this)},handleMessage(e){Ya(this,e)},getOrCreateExecutionStatus(e){return cr(this,e)},handleAssistantOutputFrame(e,t){Ha(this,e,t)},handleClaudeOutput(e,t){this.handleAssistantOutputFrame(e,t)},addMessageToConversation(e,t){Cn(this,e,t)},appendToAssistantMessageForConversation(e,t,s){va(this,e,t,s)},finishStreamingForConversation(e){ya(this,e)},sweepStaleStreamingForConversation(e){ba(this,e)},appendToAssistantMessage(e){this.appendToAssistantMessageForConversation(this.currentConversation,e)},finishStreaming(){this.finishStreamingForConversation(this.currentConversation)},addMessage(e){this.addMessageToConversation(this.currentConversation,e)},loadHistoryMessages(e){wa(this,e)},formatDbMessage(e){return tr(e)},formatDbMessageForHistoryHydration(e){return Sa(e)},selectAgent(e){sl(this,e)},createConversation(e,t=null,s=null,n=void 0){nl(this,e,t,s,n)},resumeConversation(e,t,s=null,n=null){il(this,e,t,s,n)},selectConversation(e,t){rl(this,e,t)},updateConversationSettings(e,t){fr(this,e,t)},toggleConversationMcp(e,t){ol(this,e,t)},deleteConversation(e,t){ll(this,e,t)},closeSession(e,t){al(this,e,t)},appendColumn(e){pl(this,e)},removeColumn(e){fl(this,e)},sendMessageToConversation(e,t,s=[],n={}){gl(this,e,t,s,n)},cancelExecutionForConversation(e){ml(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.sendWsMessage({type:"sync_messages",conversationId:r.conversationId,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.sendWsMessage({type:"sync_messages",conversationId:t,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.sendWsMessage({type:"sync_messages",conversationId:e,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?!!ls()?.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=Fe(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?ls()?.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,{ignoreStatuses:t=!1}={}){if(!e||Object.values(this.activeVpTurns||{}).some(r=>r?.sessionId===e)||!t&&Object.values(this.vpStatuses||{}).some(o=>(o?.sessionId||o?.groupId||null)===e&&$n.has(o?.state)))return;let{[e]:n,...i}=this.yeaftProcessingSessions||{};this.yeaftProcessingSessions=i},sendMessage(e,t=[],s={}){cl(this,e,t,s)},cancelExecution(){dl(this)},cancelYeaft(){this.currentAgent&&(this.sendWsMessage({type:"yeaft_abort_all",agentId:this.currentAgent}),this.yeaftConversationId&&delete this.processingConversations[this.yeaftConversationId],this.activeVpTurns={},this.stoppingVpTurnIds={},this.yeaftProcessingSessions={})},cancelYeaftSession(e){let t=Fe(this,e);!t||!e||(this.sendWsMessage({type:"yeaft_abort_all",agentId:t,sessionId:e}),this.activeVpTurns=Object.fromEntries(Object.entries(this.activeVpTurns||{}).filter(([,s])=>s?.sessionId!==e)),this.stoppingVpTurnIds=Object.fromEntries(Object.entries(this.stoppingVpTurnIds||{}).filter(([s])=>this.activeVpTurns?.[s])),this.clearYeaftSessionProcessingIfIdle(e))},cancelVpTurn(e,{sessionId:t=null,vpId:s=null}={}){let n=Fe(this,t);if(!n||!e)return;this.stoppingVpTurnIds={...this.stoppingVpTurnIds,[e]:Date.now()};let i={type:"yeaft_abort_turn",agentId:n,turnId:e};t&&(i.sessionId=t),s&&(i.vpId=s),this.sendWsMessage(i)},cancelVpTurnForSession(e,t=null){if(!e)return!1;let s=t||this.yeaftActiveSessionFilter||null;if(!s)return!1;let n=Fe(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||s&&l.sessionId&&l.sessionId!==s)continue;let c=typeof l.startedAt=="number"?l.startedAt:0;c>=o&&(o=c,r=a)}if(!r){let a=this.vpStatuses?.[Rn(s,e)]||null;a?.turnId&&!["idle","offline"].includes(a.state)&&(r=a.turnId)}return r?(this.cancelVpTurn(r,{sessionId:s,vpId:e}),!0):(this.sendWsMessage({type:"yeaft_abort_turn",agentId:n,sessionId:s,vpId:e}),!0)},answerUserQuestion(e,t,s){ul(this,e,t,s)},refreshAgents(){hl(this)},refreshConversation(){vl(this)},restartAgent(e){yl(this,e)},upgradeAgent(e){bl(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(i=>i.dbMessageId),n=this.currentConversation;this.sendWsMessage({type:"sync_messages",conversationId:n,turns:5,...s?{beforeId:s.dbMessageId}:{}}),setTimeout(()=>{this._loadMoreGeneration===e&&this.loadingMoreMessages&&this.currentConversation===n&&(this.loadingMoreMessages=!1)},1e4)},reloadYeaftMessages(){if(this.currentView!=="yeaft")return!1;let e=zs(this),t=Fe(this,e);if(!t)return!1;let s=et(t,e),n=this.yeaftConversationId,{[s]:i,...r}=this.yeaftSessionHistoryState||{};this.yeaftSessionHistoryState={...r,[s]:{loaded:!1,loading:!0,hasMore:!1,oldestSeq:null,latestSeq:null,count:0}},this.yeaftHasMoreHistory=!1,this.yeaftOldestLoadedSeq=null,this.yeaftLoadingMoreHistory=!0;let o=Bs();this.yeaftHistoryPerfTraceBySession={...this.yeaftHistoryPerfTraceBySession||{},[s]:o};let a={type:"yeaft_load_history",agentId:t,limit:Ln,sessionId:e,perfTraceId:o};return Qe(this,{traceId:o,phase:"history.request_send",agentId:t,sessionId:e,messageType:a.type,bytes:JSON.stringify(a).length,detail:{mode:"manual-reload",limit:Ln}}),this.sendWsMessage(a),!0},loadMoreYeaftHistory(){if(this.currentView!=="yeaft"||this.yeaftLoadingMoreHistory||!this.yeaftHasMoreHistory||this.yeaftOldestLoadedSeq==null)return;let e=zs(this),t=Fe(this,e);if(!t)return;this.yeaftLoadingMoreHistory=!0;let s=et(t,e);this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[s]:{...this.yeaftSessionHistoryState[s]||{},loading:!0}};let n=Bs();this.yeaftHistoryPerfTraceBySession={...this.yeaftHistoryPerfTraceBySession||{},[s]:n};let i={type:"yeaft_load_more_history",agentId:t,sessionId:e,beforeSeq:this.yeaftOldestLoadedSeq,turns:10,perfTraceId:n};Qe(this,{traceId:n,phase:"history_more.request_send",agentId:t,sessionId:e,messageType:i.type,bytes:JSON.stringify(i).length,detail:{beforeSeq:i.beforeSeq,turns:i.turns}}),this.sendWsMessage(i)},checkPendingRecovery(){Bo(this)},performRecovery(){qo(this)},dismissRecovery(){Wo(this)},autoRestoreConversation(e){Uo(this,e)},saveOpenSessions(){os(this)},getLastSession(){return jo(this)},clearLastSession(){Ko(this)},listHistorySessions(e){Yo(this,e)},listFolders(){return Go(this)},listFoldersForAgent(e,t){return Qo(this,e,t)},listModelsForAgent(e,t){return Xo(this,e,t)},listHistorySessionsForAgent(e,t,s){Zo(this,e,t,s)},async loadGlobalSessions(e=20){return Jo(this,e)},async deleteGlobalSession(e){return ea(this,e)},findAgentForSession(e){return zi(this,e)},isSessionResumable(e){return ta(this,e)},_isRecentlyClosed(e){return $t(this,e)},_startProcessingWatchdog(e){as(this,e)},_resetProcessingWatchdog(e){An(this,e)},_stopProcessingWatchdog(e){we(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,$s(e),this.currentAgent)try{this.sendWsMessage({type:"update_llm_config",agentId:this.currentAgent,config:{language:e}})}catch{}},async fetchCustomExpertRoles(){let e=Ie();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=Ie();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=Ie();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=Ie();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){t&&t.trim()?(this.customConversationTitles[e]=t.trim(),this.sendWsMessage({type:"update_conversation_settings",conversationId:e,title:t.trim()})):(delete this.customConversationTitles[e],this.sendWsMessage({type:"update_conversation_settings",conversationId:e,title:""}))},openFileInExplorer(e){this.currentConversation&&(this.workbenchExpanded=!0,window.dispatchEvent(new CustomEvent("open-file-in-explorer",{detail:{filePath:e,conversationId:this.currentConversation}})))},logout(){Ie().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 Ar(e,t){!e||typeof e.handleYeaftOutput!="function"||!t||e.handleYeaftOutput({event:t})}function ag(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 Tr(e){if(!e)return At[0];let t=String(e).toLowerCase();return og[t]||At[ag(t)%At.length]}function lg(e){return Tr(e).background}function cg(e){return Tr(e).foreground}function xr(){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 dg(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 rg,At,og,bv,pt,cs=N(()=>{({defineStore:rg}=Pinia);At=[{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)"}],og=Object.freeze({steve:At[8],ada:At[3],linus:At[0],martin:At[4]}),bv=At.map(e=>e.background);pt=rg("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?xr().startsWith("zh")&&s.displayNameZh?s.displayNameZh:s.displayName||s.vpId||t:t},vpDescription:e=>t=>dg(e.vps[t],xr()),vpInitial:e=>t=>{let s=e.vps[t],n=xr().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:lg(t)},vpTextColor:()=>e=>cg(e),vpAvatarMotif:()=>e=>Tr(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(Ar(s,{type:"dream_progress",phase:"start",groupId:e,manual:!0,trigger:"manual",source:"header-button",ts:n}),!s||typeof s.sendWsMessage!="function"){Ar(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&&Ar(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 Mr(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 On(e){return!e||typeof e!="object"?0:Mr(e.lastMessageAt)||Mr(e.updatedAt)||Mr(e.createdAt)||0}function Pr(e,t){let s=On(t)-On(e);return s!==0?s:String(e?.id||"").localeCompare(String(t?.id||""))}function ac(e){return[...Array.isArray(e)?e:[]].sort(Pr)}var Hn=N(()=>{});function lc(){try{if(typeof localStorage>"u")return{};let e=JSON.parse(localStorage.getItem(pc)||"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function ug(e){try{typeof localStorage<"u"&&localStorage.setItem(pc,JSON.stringify(e&&typeof e=="object"?e:{}))}catch{}}function cc(){try{return typeof localStorage>"u"?[]:js(JSON.parse(localStorage.getItem(fc)||"[]"))}catch{return[]}}function pg(e){try{typeof localStorage<"u"&&localStorage.setItem(fc,JSON.stringify(js(e)))}catch{}}function gc(e,t){return`${e||""}${t||""}`}function bt(e){return e&&e.agentId&&e.id?gc(e.agentId,e.id):""}function wt(e,t){return t?e?gc(e,t):String(t):""}function fg(e){return typeof e=="string"?e:String(e||"")}function tt(e,t,s=null){let n=fg(t);if(!n)return"";let i=wt(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=_r();if(o?.currentAgent){let a=r.find(l=>e.sessions[l]?.agentId===o.currentAgent);if(a)return a}return r[0]||""}function Dr(e,t,s=null){return tt(e,t,s)||""}function js(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 Er(e,t){let s=js(e),n=new Set(s),i=js(t).filter(o=>n.has(o)),r=new Set(i);return[...i,...s.filter(o=>!r.has(o))]}function Nn(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 dc(e){return!e||typeof e!="object"?!1:e.running===!0||e.active===!0||e.isActive===!0||e.isRunning===!0}function uc(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 _r(){try{if(typeof window<"u"&&window.Pinia&&typeof window.Pinia.useChatStore=="function")return window.Pinia.useChatStore()}catch{}return null}var pc,fc,gg,mc,hc=N(()=>{Hn();pc="yeaft-session-order-by-agent",fc="yeaft-session-order-global";({defineStore:gg}=Pinia);mc=gg("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=_r(),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,f)=>{let p=Number.isFinite(u?.sortOrder)?u.sortOrder:Number.MAX_SAFE_INTEGER,m=Number.isFinite(f?.sortOrder)?f.sortOrder:Number.MAX_SAFE_INTEGER;return p!==m?p-m:Pr(u,f)}),a=[...o(i),...o(r)],l=cc();if(l.length===0)return a;let c=new Map(l.map((d,u)=>[d,u]));return a.sort((d,u)=>{let f=c.has(bt(d))?c.get(bt(d)):Number.MAX_SAFE_INTEGER,p=c.has(bt(u))?c.get(bt(u)):Number.MAX_SAFE_INTEGER;return f!==p?f-p:0})},sessionCount(e){return e.sessionOrder.length},sessionById:e=>(t,s=null)=>{let n=tt(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 h={...this.sessions},A=new Set;for(let D of s){if(!D||!D.id)continue;let L=wt(t,D.id);A.add(L),h[L]=this._normalize(D,t,Nn(this.sessions[L]))}for(let D of this.sessionOrder){let L=this.sessions[D];L&&L.agentId===t&&!A.has(D)&&delete h[D]}let x=this.sessionOrder.filter(D=>h[D]),S=new Set(x),v=[];for(let D of s){if(!D||!D.id)continue;let L=wt(t,D.id);h[L]&&!S.has(L)&&v.push(L)}this.sessions=h;let g=[...x,...v],b=cc();if(b.length>0){let D=new Map(g.map(_=>[bt(h[_]),_]).filter(([_])=>_)),L=b.map(_=>D.get(_)).filter(Boolean),U=new Set(L);g=[...L,...g.filter(_=>!U.has(_))];let F=new Map(b.map((_,P)=>[_,P]));for(let _ of g){let P=bt(h[_]);P&&F.has(P)&&(h[_]={...h[_],sortOrder:F.get(P)})}}if(t&&b.length===0){let D=lc(),L=js(D[t]);if(L.length>0){let U=L.map(M=>wt(t,M)),F=new Set(U),_=Er(g.filter(M=>h[M]?.agentId===t),U),P=this.sessionOrder.some(M=>h[M]?.agentId===t),T=0;P?g=this.sessionOrder.filter(M=>h[M]).map(M=>h[M]?.agentId===t?_[T++]:M).concat(_.slice(T)):g=g.map(M=>h[M]?.agentId===t?_[T++]:M);let C=new Map(U.map((M,E)=>[M,E]));for(let M of _)h[M]&&F.has(M)&&(h[M]={...h[M],sortOrder:C.get(M)})}}this.sessionOrder=g}else{if(Object.values(this.sessions).some(S=>S&&S.agentId))return;let A={},x=[];for(let S of s){if(!S||!S.id)continue;let v=wt(null,S.id);A[v]=this._normalize(S,null,Nn(this.sessions[v])),x.push(v)}this.sessions=A,this.sessionOrder=x}this.lastSnapshotAt=Date.now();let n=null;try{n=localStorage.getItem("lastViewedYeaftSession")||null}catch{}let i=n?tt(this,n,t):"",r=i?this.sessions[i]:null,o=r&&(!t||r.agentId===t),a=this.sessionOrder.filter(h=>this.sessions[h]&&(!t||this.sessions[h].agentId===t)&&this.sessions[h].running).sort((h,A)=>uc(this.sessions[A])-uc(this.sessions[h]))[0]||null,l=a?this.sessions[a]?.id:null,c=this.sessionList[0]||null,d=c?.id||null,u=d?tt(this,d,c?.raw?.agentId||null):"",f=l||(o?n:null)||d,p=a||(o?i:"")||u||Dr(this,f,t),m=this.activeSessionKey?this.sessions[this.activeSessionKey]?.agentId:null;this.activeSessionId&&!tt(this,this.activeSessionId,m)?(this.activeSessionId=f,this.activeSessionKey=p||null):!this.activeSessionId&&this.sessionOrder.length>0?(this.activeSessionId=f,this.activeSessionKey=p||null):this.activeSessionId&&(this.activeSessionKey=Dr(this,this.activeSessionId,m)||this.activeSessionKey);let y=_r();if(y){if(t){let x={...y.yeaftSessionAgentById||{}};for(let S of s)S&&S.id&&!x[S.id]&&(x[S.id]=t);y.yeaftSessionAgentById=x}let h=this.activeSessionId||f,A=null;(y.yeaftActiveSessionFilter&&!tt(this,y.yeaftActiveSessionFilter)||!y.yeaftActiveSessionFilter&&h)&&(A=h),A&&(y.currentView==="yeaft"&&typeof y.setActiveSessionFilter=="function"?y.setActiveSessionFilter(A,{force:!0}):y.yeaftActiveSessionFilter=A,this.activeSessionKey=Dr(this,A)||this.activeSessionKey)}if(y&&typeof y.applyServerPinSnapshot=="function"){let h=new Set;for(let x of s){if(!x||!x.id)continue;let S=wt(t,x.id),v=this.sessions[S];v&&v.pinned&&h.add(x.id)}let A=x=>{let S=tt(this,x,t),v=S?this.sessions[S]:null;return v?v.agentId===t:!1};y.applyServerPinSnapshot(t,h,A)}},applyRosterChange(e){if(!e)return;let t=e.sessionId||e.groupId;if(!t)return;let s=e.agentId||null,n=tt(this,t,s)||wt(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?tt(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=tt(this,e.id,s)||wt(s,e.id),i=!!this.sessions[n],r=this.sessions[n]||{};this.sessions[n]={...r,...this._normalize(e,s,Nn(r))},i||this.sessionOrder.push(n)},setActive(e,t=null){let s=tt(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=Er(s,t.map(l=>wt(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=lc(),a=n.map(l=>this.sessions[l]?.id).filter(Boolean);return o[e]=a,ug(o),a},reorderSessionsGlobally(e){let t=this.sessionOrder.map(a=>bt(this.sessions[a])).filter(Boolean),s=Er(t,e);if(s.length===0)return[];let n=new Map(this.sessionOrder.map(a=>[bt(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=bt(this.sessions[a]);l&&o.has(l)&&(this.sessions[a]={...this.sessions[a],sortOrder:o.get(l)})}return pg(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=tt(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},_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:dc(e),active:dc(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:Nn(e,s),sortOrder:Number.isFinite(e.sortOrder)?e.sortOrder:null}}}})});function Lr(){try{if(window.Pinia&&typeof window.Pinia.useAuthStore=="function")return window.Pinia.useAuthStore()}catch{}return null}function Rr(){try{return localStorage.getItem("authToken")||null}catch{return null}}function yc(){let e=Lr();if(e)try{return e.getActiveToken?.()||e.token||Rr()}catch{return e.token||Rr()}return Rr()}function hg(e,t){if(!e||!t)return!1;let s=yc();if(s&&s!==t)return!1;try{localStorage.setItem("authToken",e)}catch{}let n=Lr();return n&&(n.token=e),!0}function vg(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 yg(e){return!e||typeof window>"u"||!window.location?!1:e.origin===window.location.origin&&e.pathname.startsWith("/api/")}function bg(e){if(!e)return!1;let t=e.pathname;return!!(mg.has(t)||t.startsWith("/api/auth/sso/poll/")||/^\/api\/auth\/sso\/[^/]+\/start(?:-qr)?$/.test(t))}function wg(e,t){return t?.headers?new Headers(t.headers):e&&typeof e=="object"&&e.headers?new Headers(e.headers):new Headers}function kg(e){let t=e.get("Authorization");return!t||!t.startsWith("Bearer ")?null:t.slice(7)}function Sg(e,t){return{...e||{},headers:t}}function Cg(e){return e?.pathname==="/api/user/profile"}function Ig(e){if(!e)return;let t=Lr();t&&typeof t.handleAuthFailure=="function"&&t.handleAuthFailure(void 0,e)}function bc(){if(vc||typeof window>"u"||!window.fetch)return;vc=!0;let e=window.fetch.bind(window);window.fetch=async function(s,n){let i=vg(s),r=yg(i)&&!bg(i),o=n,a=null;if(r){let c=wg(s,n);a=kg(c),a||(a=yc(),a&&(c.set("Authorization",`Bearer ${a}`),o=Sg(n,c)))}let l=await e(s,o);try{let c=l.headers&&l.headers.get&&l.headers.get("X-New-Token");c&&hg(c,a),r&&Cg(i)&&l.status===401&&Ig(a)}catch{}return l}}var vc,mg,wc=N(()=>{vc=!1,mg=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 kc,Sc=N(()=>{kc={"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
|
|
8
|
+
${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=e.agentId||null,n=t.sessionId??null,i=et(s,n),r=e.perfTraceId||this.yeaftHistoryPerfTraceBySession?.[i];r&&Qe(this,{traceId:r,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 o=t.mode==="delta"?"delta":"recent",a=this.yeaftSessionHistoryState[i]||{},l=Number.isFinite(t.latestSeq)?t.latestSeq:Number.isFinite(a.latestSeq)?a.latestSeq:null,c=o==="delta"?{...a,loaded:!0,loading:!1,latestSeq:l,syncingAfterSeq:null,count:(a.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:l,syncingAfterSeq:null};this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[i]:c};let d=et(s?this.currentAgent:null,this.yeaftActiveSessionFilter??null);if(i===d)o==="recent"&&(this.yeaftHasMoreHistory=c.hasMore,this.yeaftOldestLoadedSeq=c.oldestSeq),this.yeaftLoadingMoreHistory=!1;else if(this.yeaftLoadingMoreHistory){let u=this.yeaftSessionHistoryState[d]||null;this.yeaftLoadingMoreHistory=!!u?.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=s&&s.activeSessionId||null,i=t.sessions||[];s&&s.applySnapshot(i,e.agentId||null);let r=s&&s.activeSessionId||null;if(this.currentView==="yeaft"&&r){let o=Fe(this,r,e.agentId||null),a=et(o,r),l=this.yeaftSessionHistoryState[a]||null;this.setActiveSessionFilter(r,{agentId:o,force:ma(r,n,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;this.activeVpTurns={...this.activeVpTurns,[t.turnId]:{vpId:t.vpId,sessionId:t.sessionId||null,threadId:t.threadId||null,isStreaming:!0,startedAt:t.ts||Date.now()}},t.sessionId&&(this.yeaftProcessingSessions={...this.yeaftProcessingSessions,[t.sessionId]:!0});break}case"vp_turn_end":{if(!t.turnId)break;let{[t.turnId]:s,...n}=this.activeVpTurns;this.activeVpTurns=n;let{[t.turnId]:i,...r}=this.stoppingVpTurnIds;this.stoppingVpTurnIds=r,this.clearYeaftSessionProcessingIfIdle(t.sessionId||s?.sessionId||null);let a={end_turn:"completed",route_forward:"completed",aborted:"aborted",errored:"errored"}[t.reason]||"completed",l=Date.now(),c=this.yeaftConversationId;if(c&&Array.isArray(this.messagesMap[c])){let d=this.messagesMap[c],u=!1;for(let f=0;f<d.length;f++){let p=d[f];if(!p||p.type!=="assistant")continue;let m=p.sessionId??p.groupId;t.sessionId&&m&&m!==t.sessionId||t.vpId&&p.speakerVpId&&p.speakerVpId!==t.vpId||t.turnId&&p.turnId&&p.turnId!==t.turnId||p.status&&p.status!=="pending"||(p.status=a,p.turnEndAt=l,p.turnEndReason=t.reason||null,t.detail&&(p.turnEndDetail=t.detail),Number.isFinite(t.durationMs)&&(p.turnDurationMs=t.durationMs),u=!0)}u&&(this.messagesMap={...this.messagesMap,[c]:d.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(s);if(i)for(let[c,d]of Object.entries(this.activeVpTurns||{}))!d||d.vpId!==i||n&&d.sessionId!==n||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);break}case"yeaft_aborted":{let s=t.sessionId||e.sessionId||null;s?(this.activeVpTurns=Object.fromEntries(Object.entries(this.activeVpTurns||{}).filter(([,n])=>n?.sessionId!==s)),this.stoppingVpTurnIds=Object.fromEntries(Object.entries(this.stoppingVpTurnIds||{}).filter(([n])=>this.activeVpTurns?.[n])),this.clearYeaftSessionProcessingIfIdle(s)):t.all&&(this.activeVpTurns={},this.stoppingVpTurnIds={},this.yeaftProcessingSessions={});break}case"vp_typing_start":{if(!t.vpId)break;let s=e.conversationId||this.yeaftConversationId;if(!s)break;this.yeaftVpTyping=Tl(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=Ml(this.yeaftVpTyping,s,t.vpId);break}case"vp_status_changed":{if(!t.vpId||!t.state)break;let s=t.sessionId||null,n=Rn(s,t.vpId),i={state:t.state,since:t.since||Date.now(),turnId:t.turnId||null,title:t.title||"",sessionId:s,vpId:t.vpId};this.vpStatuses={...this.vpStatuses,[n]:i},s&&$n.has(t.state)?this.yeaftProcessingSessions={...this.yeaftProcessingSessions,[s]:!0}:s&&this.clearYeaftSessionProcessingIfIdle(s),this.restoreActiveYeaftSessionFromStatuses([i]);break}case"vp_status_snapshot":{let s=Array.isArray(t.statuses)?t.statuses:[],n=t.sessionId;if(n==null){let i={};for(let r of s){if(!r||!r.vpId)continue;let o=r.sessionId||r.groupId||null,a=Rn(o,r.vpId);i[a]={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&&delete i[r];for(let r of s){if(!r||!r.vpId)continue;let o=r.sessionId||r.groupId||null,a=Rn(o,r.vpId);i[a]={state:r.state,since:r.since||Date.now(),turnId:r.turnId||null,title:r.title||"",sessionId:o,vpId:r.vpId}}this.vpStatuses=i}this.restoreActiveYeaftSessionFromStatuses(s);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>nc&&a.splice(0,a.length-nc),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)})},restoreActiveYeaftSessionFromStatuses(e=[]){if(this.yeaftActiveSessionFilter)return null;let s=(Array.isArray(e)?e:[]).filter(i=>i&&(i.sessionId||i.groupId)&&!["idle","offline","completed","failed","aborted"].includes(i.state)).sort((i,r)=>(r.updatedAt||r.since||0)-(i.updatedAt||i.since||0)),n=s[0]?.sessionId||s[0]?.groupId||null;if(!n)return null;this.setActiveSessionFilter(n,{force:!0});try{let i=window.Pinia?.useSessionsStore?.()||window.__useSessionsStore&&window.__useSessionsStore();i&&typeof i.setActive=="function"&&i.setActive(n)}catch{}return n},setActiveSessionFilter(e,t={}){let s=this.yeaftActiveSessionFilter||null,n=e||null,i=n?Fe(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(!o&&n===s)return;let a=et(i,n),l=this.yeaftSessionHistoryState[a]||null;if(this.yeaftHasMoreHistory=!!l?.hasMore,this.yeaftLoadingMoreHistory=!!l?.loading,this.yeaftOldestLoadedSeq=typeof l?.oldestSeq=="number"?l.oldestSeq:null,this.pruneYeaftMessageWindow(n),!l?.loading&&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]);let d=Number.isFinite(l?.latestSeq)?l.latestSeq:null,u={type:"yeaft_load_history",agentId:i,sessionId:n},f=!!l?.loaded,p=er({sessionState:l,hasCachedSessionRows:!1,force:o});if(!p&&d!==null?u.afterSeq=d:u.limit=Ln,!p&&f&&d===null){this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[a]:{...l||{hasMore:!1,oldestSeq:null,count:0},loaded:!0,loading:!1,syncingAfterSeq:null}},this.yeaftLoadingMoreHistory=!1;return}if(!p&&f){if(l?.syncingAfterSeq===d)return;this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[a]:{...l||{hasMore:!1,oldestSeq:null,count:0},loaded:!0,loading:!1,syncingAfterSeq:d,latestSeq:d}},this.yeaftLoadingMoreHistory=!1}else this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[a]:{...l||{hasMore:!1,oldestSeq:null,count:0},loaded:!1,loading:!0,syncingAfterSeq:null,latestSeq:p?null:d}},this.yeaftLoadingMoreHistory=!0;this.sendWsMessage(u)}},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:Fe(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()?sc:Cr,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},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 na(this,e)},parseWsMessage(e){return ia(this,e)},connect(){ra(this)},ensureConnected(){return Os(this)},scheduleReconnect(){oa(this)},manualReconnect(){aa(this)},startHeartbeat(){la(this)},stopHeartbeat(){ca(this)},setupVisibilityHandler(){da(this)},handleMessage(e){Ya(this,e)},getOrCreateExecutionStatus(e){return cr(this,e)},handleAssistantOutputFrame(e,t){Ha(this,e,t)},handleClaudeOutput(e,t){this.handleAssistantOutputFrame(e,t)},addMessageToConversation(e,t){Cn(this,e,t)},appendToAssistantMessageForConversation(e,t,s){va(this,e,t,s)},finishStreamingForConversation(e){ya(this,e)},sweepStaleStreamingForConversation(e){ba(this,e)},appendToAssistantMessage(e){this.appendToAssistantMessageForConversation(this.currentConversation,e)},finishStreaming(){this.finishStreamingForConversation(this.currentConversation)},addMessage(e){this.addMessageToConversation(this.currentConversation,e)},loadHistoryMessages(e){wa(this,e)},formatDbMessage(e){return tr(e)},formatDbMessageForHistoryHydration(e){return Sa(e)},selectAgent(e){sl(this,e)},createConversation(e,t=null,s=null,n=void 0){nl(this,e,t,s,n)},resumeConversation(e,t,s=null,n=null){il(this,e,t,s,n)},selectConversation(e,t){rl(this,e,t)},updateConversationSettings(e,t){fr(this,e,t)},toggleConversationMcp(e,t){ol(this,e,t)},deleteConversation(e,t){ll(this,e,t)},closeSession(e,t){al(this,e,t)},appendColumn(e){pl(this,e)},removeColumn(e){fl(this,e)},sendMessageToConversation(e,t,s=[],n={}){gl(this,e,t,s,n)},cancelExecutionForConversation(e){ml(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.sendWsMessage({type:"sync_messages",conversationId:r.conversationId,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.sendWsMessage({type:"sync_messages",conversationId:t,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.sendWsMessage({type:"sync_messages",conversationId:e,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?!!ls()?.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=Fe(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?ls()?.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,{ignoreStatuses:t=!1}={}){if(!e||Object.values(this.activeVpTurns||{}).some(r=>r?.sessionId===e)||!t&&Object.values(this.vpStatuses||{}).some(o=>(o?.sessionId||o?.groupId||null)===e&&$n.has(o?.state)))return;let{[e]:n,...i}=this.yeaftProcessingSessions||{};this.yeaftProcessingSessions=i},sendMessage(e,t=[],s={}){cl(this,e,t,s)},cancelExecution(){dl(this)},cancelYeaft(){this.currentAgent&&(this.sendWsMessage({type:"yeaft_abort_all",agentId:this.currentAgent}),this.yeaftConversationId&&delete this.processingConversations[this.yeaftConversationId],this.activeVpTurns={},this.stoppingVpTurnIds={},this.yeaftProcessingSessions={})},cancelYeaftSession(e){let t=Fe(this,e);!t||!e||(this.sendWsMessage({type:"yeaft_abort_all",agentId:t,sessionId:e}),this.activeVpTurns=Object.fromEntries(Object.entries(this.activeVpTurns||{}).filter(([,s])=>s?.sessionId!==e)),this.stoppingVpTurnIds=Object.fromEntries(Object.entries(this.stoppingVpTurnIds||{}).filter(([s])=>this.activeVpTurns?.[s])),this.clearYeaftSessionProcessingIfIdle(e))},cancelVpTurn(e,{sessionId:t=null,vpId:s=null}={}){let n=Fe(this,t);if(!n||!e)return;this.stoppingVpTurnIds={...this.stoppingVpTurnIds,[e]:Date.now()};let i={type:"yeaft_abort_turn",agentId:n,turnId:e};t&&(i.sessionId=t),s&&(i.vpId=s),this.sendWsMessage(i)},cancelVpTurnForSession(e,t=null){if(!e)return!1;let s=t||this.yeaftActiveSessionFilter||null;if(!s)return!1;let n=Fe(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||s&&l.sessionId&&l.sessionId!==s)continue;let c=typeof l.startedAt=="number"?l.startedAt:0;c>=o&&(o=c,r=a)}if(!r){let a=this.vpStatuses?.[Rn(s,e)]||null;a?.turnId&&!["idle","offline"].includes(a.state)&&(r=a.turnId)}return r?(this.cancelVpTurn(r,{sessionId:s,vpId:e}),!0):(this.sendWsMessage({type:"yeaft_abort_turn",agentId:n,sessionId:s,vpId:e}),!0)},answerUserQuestion(e,t,s){ul(this,e,t,s)},refreshAgents(){hl(this)},refreshConversation(){vl(this)},restartAgent(e){yl(this,e)},upgradeAgent(e){bl(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(i=>i.dbMessageId),n=this.currentConversation;this.sendWsMessage({type:"sync_messages",conversationId:n,turns:5,...s?{beforeId:s.dbMessageId}:{}}),setTimeout(()=>{this._loadMoreGeneration===e&&this.loadingMoreMessages&&this.currentConversation===n&&(this.loadingMoreMessages=!1)},1e4)},reloadYeaftMessages(){if(this.currentView!=="yeaft")return!1;let e=zs(this),t=Fe(this,e);if(!t)return!1;let s=et(t,e),n=this.yeaftConversationId,{[s]:i,...r}=this.yeaftSessionHistoryState||{};this.yeaftSessionHistoryState={...r,[s]:{loaded:!1,loading:!0,hasMore:!1,oldestSeq:null,latestSeq:null,count:0}},this.yeaftHasMoreHistory=!1,this.yeaftOldestLoadedSeq=null,this.yeaftLoadingMoreHistory=!0;let o=Bs();this.yeaftHistoryPerfTraceBySession={...this.yeaftHistoryPerfTraceBySession||{},[s]:o};let a={type:"yeaft_load_history",agentId:t,limit:Ln,sessionId:e,perfTraceId:o};return Qe(this,{traceId:o,phase:"history.request_send",agentId:t,sessionId:e,messageType:a.type,bytes:JSON.stringify(a).length,detail:{mode:"manual-reload",limit:Ln}}),this.sendWsMessage(a),!0},loadMoreYeaftHistory(){if(this.currentView!=="yeaft"||this.yeaftLoadingMoreHistory||!this.yeaftHasMoreHistory||this.yeaftOldestLoadedSeq==null)return;let e=zs(this),t=Fe(this,e);if(!t)return;this.yeaftLoadingMoreHistory=!0;let s=et(t,e);this.yeaftSessionHistoryState={...this.yeaftSessionHistoryState,[s]:{...this.yeaftSessionHistoryState[s]||{},loading:!0}};let n=Bs();this.yeaftHistoryPerfTraceBySession={...this.yeaftHistoryPerfTraceBySession||{},[s]:n};let i={type:"yeaft_load_more_history",agentId:t,sessionId:e,beforeSeq:this.yeaftOldestLoadedSeq,turns:10,perfTraceId:n};Qe(this,{traceId:n,phase:"history_more.request_send",agentId:t,sessionId:e,messageType:i.type,bytes:JSON.stringify(i).length,detail:{beforeSeq:i.beforeSeq,turns:i.turns}}),this.sendWsMessage(i)},checkPendingRecovery(){Bo(this)},performRecovery(){qo(this)},dismissRecovery(){Wo(this)},autoRestoreConversation(e){Uo(this,e)},saveOpenSessions(){os(this)},getLastSession(){return jo(this)},clearLastSession(){Ko(this)},listHistorySessions(e){Yo(this,e)},listFolders(){return Go(this)},listFoldersForAgent(e,t){return Qo(this,e,t)},listModelsForAgent(e,t){return Xo(this,e,t)},listHistorySessionsForAgent(e,t,s){Zo(this,e,t,s)},async loadGlobalSessions(e=20){return Jo(this,e)},async deleteGlobalSession(e){return ea(this,e)},findAgentForSession(e){return zi(this,e)},isSessionResumable(e){return ta(this,e)},_isRecentlyClosed(e){return $t(this,e)},_startProcessingWatchdog(e){as(this,e)},_resetProcessingWatchdog(e){An(this,e)},_stopProcessingWatchdog(e){we(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,$s(e),this.currentAgent)try{this.sendWsMessage({type:"update_llm_config",agentId:this.currentAgent,config:{language:e}})}catch{}},async fetchCustomExpertRoles(){let e=Ie();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=Ie();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=Ie();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=Ie();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){t&&t.trim()?(this.customConversationTitles[e]=t.trim(),this.sendWsMessage({type:"update_conversation_settings",conversationId:e,title:t.trim()})):(delete this.customConversationTitles[e],this.sendWsMessage({type:"update_conversation_settings",conversationId:e,title:""}))},openFileInExplorer(e){this.currentConversation&&(this.workbenchExpanded=!0,window.dispatchEvent(new CustomEvent("open-file-in-explorer",{detail:{filePath:e,conversationId:this.currentConversation}})))},logout(){Ie().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 Ar(e,t){!e||typeof e.handleYeaftOutput!="function"||!t||e.handleYeaftOutput({event:t})}function ag(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 Tr(e){if(!e)return At[0];let t=String(e).toLowerCase();return og[t]||At[ag(t)%At.length]}function lg(e){return Tr(e).background}function cg(e){return Tr(e).foreground}function xr(){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 dg(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 rg,At,og,bv,pt,cs=N(()=>{({defineStore:rg}=Pinia);At=[{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)"}],og=Object.freeze({steve:At[8],ada:At[3],linus:At[0],martin:At[4]}),bv=At.map(e=>e.background);pt=rg("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?xr().startsWith("zh")&&s.displayNameZh?s.displayNameZh:s.displayName||s.vpId||t:t},vpDescription:e=>t=>dg(e.vps[t],xr()),vpInitial:e=>t=>{let s=e.vps[t],n=xr().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:lg(t)},vpTextColor:()=>e=>cg(e),vpAvatarMotif:()=>e=>Tr(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(Ar(s,{type:"dream_progress",phase:"start",groupId:e,manual:!0,trigger:"manual",source:"header-button",ts:n}),!s||typeof s.sendWsMessage!="function"){Ar(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&&Ar(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 Mr(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 On(e){return!e||typeof e!="object"?0:Mr(e.lastMessageAt)||Mr(e.updatedAt)||Mr(e.createdAt)||0}function Pr(e,t){let s=On(t)-On(e);return s!==0?s:String(e?.id||"").localeCompare(String(t?.id||""))}function ac(e){return[...Array.isArray(e)?e:[]].sort(Pr)}var Hn=N(()=>{});function lc(){try{if(typeof localStorage>"u")return{};let e=JSON.parse(localStorage.getItem(pc)||"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function ug(e){try{typeof localStorage<"u"&&localStorage.setItem(pc,JSON.stringify(e&&typeof e=="object"?e:{}))}catch{}}function cc(){try{return typeof localStorage>"u"?[]:js(JSON.parse(localStorage.getItem(fc)||"[]"))}catch{return[]}}function pg(e){try{typeof localStorage<"u"&&localStorage.setItem(fc,JSON.stringify(js(e)))}catch{}}function gc(e,t){return`${e||""}${t||""}`}function bt(e){return e&&e.agentId&&e.id?gc(e.agentId,e.id):""}function wt(e,t){return t?e?gc(e,t):String(t):""}function fg(e){return typeof e=="string"?e:String(e||"")}function tt(e,t,s=null){let n=fg(t);if(!n)return"";let i=wt(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=_r();if(o?.currentAgent){let a=r.find(l=>e.sessions[l]?.agentId===o.currentAgent);if(a)return a}return r[0]||""}function Dr(e,t,s=null){return tt(e,t,s)||""}function js(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 Er(e,t){let s=js(e),n=new Set(s),i=js(t).filter(o=>n.has(o)),r=new Set(i);return[...i,...s.filter(o=>!r.has(o))]}function Nn(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 dc(e){return!e||typeof e!="object"?!1:e.running===!0||e.active===!0||e.isActive===!0||e.isRunning===!0}function uc(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 _r(){try{if(typeof window<"u"&&window.Pinia&&typeof window.Pinia.useChatStore=="function")return window.Pinia.useChatStore()}catch{}return null}var pc,fc,gg,mc,hc=N(()=>{Hn();pc="yeaft-session-order-by-agent",fc="yeaft-session-order-global";({defineStore:gg}=Pinia);mc=gg("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=_r(),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,f)=>{let p=Number.isFinite(u?.sortOrder)?u.sortOrder:Number.MAX_SAFE_INTEGER,m=Number.isFinite(f?.sortOrder)?f.sortOrder:Number.MAX_SAFE_INTEGER;return p!==m?p-m:Pr(u,f)}),a=[...o(i),...o(r)],l=cc();if(l.length===0)return a;let c=new Map(l.map((d,u)=>[d,u]));return a.sort((d,u)=>{let f=c.has(bt(d))?c.get(bt(d)):Number.MAX_SAFE_INTEGER,p=c.has(bt(u))?c.get(bt(u)):Number.MAX_SAFE_INTEGER;return f!==p?f-p:0})},sessionCount(e){return e.sessionOrder.length},sessionById:e=>(t,s=null)=>{let n=tt(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 h={...this.sessions},A=new Set;for(let D of s){if(!D||!D.id)continue;let L=wt(t,D.id);A.add(L),h[L]=this._normalize(D,t,Nn(this.sessions[L]))}for(let D of this.sessionOrder){let L=this.sessions[D];L&&L.agentId===t&&!A.has(D)&&delete h[D]}let x=this.sessionOrder.filter(D=>h[D]),S=new Set(x),v=[];for(let D of s){if(!D||!D.id)continue;let L=wt(t,D.id);h[L]&&!S.has(L)&&v.push(L)}this.sessions=h;let g=[...x,...v],b=cc();if(b.length>0){let D=new Map(g.map(_=>[bt(h[_]),_]).filter(([_])=>_)),L=b.map(_=>D.get(_)).filter(Boolean),U=new Set(L);g=[...L,...g.filter(_=>!U.has(_))];let O=new Map(b.map((_,P)=>[_,P]));for(let _ of g){let P=bt(h[_]);P&&O.has(P)&&(h[_]={...h[_],sortOrder:O.get(P)})}}if(t&&b.length===0){let D=lc(),L=js(D[t]);if(L.length>0){let U=L.map(M=>wt(t,M)),O=new Set(U),_=Er(g.filter(M=>h[M]?.agentId===t),U),P=this.sessionOrder.some(M=>h[M]?.agentId===t),T=0;P?g=this.sessionOrder.filter(M=>h[M]).map(M=>h[M]?.agentId===t?_[T++]:M).concat(_.slice(T)):g=g.map(M=>h[M]?.agentId===t?_[T++]:M);let C=new Map(U.map((M,E)=>[M,E]));for(let M of _)h[M]&&O.has(M)&&(h[M]={...h[M],sortOrder:C.get(M)})}}this.sessionOrder=g}else{if(Object.values(this.sessions).some(S=>S&&S.agentId))return;let A={},x=[];for(let S of s){if(!S||!S.id)continue;let v=wt(null,S.id);A[v]=this._normalize(S,null,Nn(this.sessions[v])),x.push(v)}this.sessions=A,this.sessionOrder=x}this.lastSnapshotAt=Date.now();let n=null;try{n=localStorage.getItem("lastViewedYeaftSession")||null}catch{}let i=n?tt(this,n,t):"",r=i?this.sessions[i]:null,o=r&&(!t||r.agentId===t),a=this.sessionOrder.filter(h=>this.sessions[h]&&(!t||this.sessions[h].agentId===t)&&this.sessions[h].running).sort((h,A)=>uc(this.sessions[A])-uc(this.sessions[h]))[0]||null,l=a?this.sessions[a]?.id:null,c=this.sessionList[0]||null,d=c?.id||null,u=d?tt(this,d,c?.raw?.agentId||null):"",f=l||(o?n:null)||d,p=a||(o?i:"")||u||Dr(this,f,t),m=this.activeSessionKey?this.sessions[this.activeSessionKey]?.agentId:null;this.activeSessionId&&!tt(this,this.activeSessionId,m)?(this.activeSessionId=f,this.activeSessionKey=p||null):!this.activeSessionId&&this.sessionOrder.length>0?(this.activeSessionId=f,this.activeSessionKey=p||null):this.activeSessionId&&(this.activeSessionKey=Dr(this,this.activeSessionId,m)||this.activeSessionKey);let y=_r();if(y){if(t){let x={...y.yeaftSessionAgentById||{}};for(let S of s)S&&S.id&&!x[S.id]&&(x[S.id]=t);y.yeaftSessionAgentById=x}let h=this.activeSessionId||f,A=null;(y.yeaftActiveSessionFilter&&!tt(this,y.yeaftActiveSessionFilter)||!y.yeaftActiveSessionFilter&&h)&&(A=h),A&&(y.currentView==="yeaft"&&typeof y.setActiveSessionFilter=="function"?y.setActiveSessionFilter(A,{force:!0}):y.yeaftActiveSessionFilter=A,this.activeSessionKey=Dr(this,A)||this.activeSessionKey)}if(y&&typeof y.applyServerPinSnapshot=="function"){let h=new Set;for(let x of s){if(!x||!x.id)continue;let S=wt(t,x.id),v=this.sessions[S];v&&v.pinned&&h.add(x.id)}let A=x=>{let S=tt(this,x,t),v=S?this.sessions[S]:null;return v?v.agentId===t:!1};y.applyServerPinSnapshot(t,h,A)}},applyRosterChange(e){if(!e)return;let t=e.sessionId||e.groupId;if(!t)return;let s=e.agentId||null,n=tt(this,t,s)||wt(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?tt(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=tt(this,e.id,s)||wt(s,e.id),i=!!this.sessions[n],r=this.sessions[n]||{};this.sessions[n]={...r,...this._normalize(e,s,Nn(r))},i||this.sessionOrder.push(n)},setActive(e,t=null){let s=tt(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=Er(s,t.map(l=>wt(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=lc(),a=n.map(l=>this.sessions[l]?.id).filter(Boolean);return o[e]=a,ug(o),a},reorderSessionsGlobally(e){let t=this.sessionOrder.map(a=>bt(this.sessions[a])).filter(Boolean),s=Er(t,e);if(s.length===0)return[];let n=new Map(this.sessionOrder.map(a=>[bt(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=bt(this.sessions[a]);l&&o.has(l)&&(this.sessions[a]={...this.sessions[a],sortOrder:o.get(l)})}return pg(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=tt(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},_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:dc(e),active:dc(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:Nn(e,s),sortOrder:Number.isFinite(e.sortOrder)?e.sortOrder:null}}}})});function Lr(){try{if(window.Pinia&&typeof window.Pinia.useAuthStore=="function")return window.Pinia.useAuthStore()}catch{}return null}function Rr(){try{return localStorage.getItem("authToken")||null}catch{return null}}function yc(){let e=Lr();if(e)try{return e.getActiveToken?.()||e.token||Rr()}catch{return e.token||Rr()}return Rr()}function hg(e,t){if(!e||!t)return!1;let s=yc();if(s&&s!==t)return!1;try{localStorage.setItem("authToken",e)}catch{}let n=Lr();return n&&(n.token=e),!0}function vg(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 yg(e){return!e||typeof window>"u"||!window.location?!1:e.origin===window.location.origin&&e.pathname.startsWith("/api/")}function bg(e){if(!e)return!1;let t=e.pathname;return!!(mg.has(t)||t.startsWith("/api/auth/sso/poll/")||/^\/api\/auth\/sso\/[^/]+\/start(?:-qr)?$/.test(t))}function wg(e,t){return t?.headers?new Headers(t.headers):e&&typeof e=="object"&&e.headers?new Headers(e.headers):new Headers}function kg(e){let t=e.get("Authorization");return!t||!t.startsWith("Bearer ")?null:t.slice(7)}function Sg(e,t){return{...e||{},headers:t}}function Cg(e){return e?.pathname==="/api/user/profile"}function Ig(e){if(!e)return;let t=Lr();t&&typeof t.handleAuthFailure=="function"&&t.handleAuthFailure(void 0,e)}function bc(){if(vc||typeof window>"u"||!window.fetch)return;vc=!0;let e=window.fetch.bind(window);window.fetch=async function(s,n){let i=vg(s),r=yg(i)&&!bg(i),o=n,a=null;if(r){let c=wg(s,n);a=kg(c),a||(a=yc(),a&&(c.set("Authorization",`Bearer ${a}`),o=Sg(n,c)))}let l=await e(s,o);try{let c=l.headers&&l.headers.get&&l.headers.get("X-New-Token");c&&hg(c,a),r&&Cg(i)&&l.status===401&&Ig(a)}catch{}return l}}var vc,mg,wc=N(()=>{vc=!1,mg=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 kc,Sc=N(()=>{kc={"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
|
|
9
9
|
\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
|
|
10
10
|
\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","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.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.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...","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","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.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.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.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.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.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.filterOpen":"\u8FDB\u884C\u4E2D","workCenter.filterAll":"\u5168\u90E8","workCenter.filterDone":"\u5DF2\u5B8C\u6210","workCenter.activeItems":"\u8FDB\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.noOpenTitle":"\u6CA1\u6709\u8FDB\u884C\u4E2D\u7684\u5DE5\u4F5C\u9879","workCenter.noOpenBody":"\u65B0\u7684\u8FDB\u884C\u4E2D\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.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.actionCount":"{count} \u4E2A 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.noActionMessages":"\u8FD8\u6CA1\u6709\u6267\u884C\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.aiResponse":"AI \u54CD\u5E94","workCenter.requestDetails":"\u8BF7\u6C42\u8BE6\u60C5","workCenter.noRequestDetails":"\u8FD9\u4E2A Action \u6682\u65F6\u6CA1\u6709\u53EF\u7528\u7684\u8BF7\u6C42\u8BE6\u60C5\u3002","workCenter.loadingRequests":"\u6B63\u5728\u52A0\u8F7D\u8BF7\u6C42\u2026","workCenter.loadingRequestDetail":"\u6B63\u5728\u52A0\u8F7D\u8BF7\u6C42\u8BE6\u60C5\u2026","workCenter.requestDetailUnavailable":"\u8BF7\u6C42\u8BE6\u60C5\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u8BD5\u3002","workCenter.noRequestLoops":"\u8FD9\u4E2A\u8BF7\u6C42\u6CA1\u6709\u4FDD\u7559\u4E0B\u53EF\u5C55\u793A\u7684 Loop \u8BE6\u60C5\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.systemPrompt":"\u7CFB\u7EDF\u63D0\u793A\u8BCD","workCenter.requestMessages":"\u8BF7\u6C42\u6D88\u606F","workCenter.toolCalls":"\u5DE5\u5177\u8C03\u7528","workCenter.rawRequest":"\u539F\u59CB\u8BF7\u6C42","workCenter.rawResponse":"\u539F\u59CB\u54CD\u5E94","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.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":"\u65B0\u8F93\u5165\u4F1A\u8FFD\u52A0\u5230\u5F53\u524D Action\uFF0C\u5E76\u5728\u4E0B\u4E00\u4E2A\u5B89\u5168\u7684\u6267\u884C Loop \u4E2D\u5E94\u7528\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\u3002\u8BF7\u6C42\u8BE6\u60C5\u4E2D\u53EF\u4EE5\u67E5\u770B\u5177\u4F53\u6A21\u578B\u548C Loop \u8F68\u8FF9\u3002","workCenter.sendInput":"\u53D1\u9001\u8F93\u5165","workCenter.sendingInput":"\u6B63\u5728\u53D1\u9001\u2026","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":"\u5148\u5B9A\u4E49\u7A33\u5B9A\u76EE\u6807\uFF0C\u518D\u8BA9 Agent \u5F00\u59CB\u6267\u884C\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":"\u79FB\u9664\u9644\u4EF6","workCenter.previewAttachment":"\u9884\u89C8\u9644\u4EF6","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 AI \u52A8\u6001\u89C4\u5212\u4F7F\u7528\u7684\u53EF\u590D\u7528 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":"\u8FD9\u91CC\u7684\u6A21\u578B\u548C effort \u7B56\u7565\u7528\u4E8E triage \u4EE5\u53CA AI \u751F\u6210\u7684\u6240\u6709 Action\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 Cc,Ic=N(()=>{Cc={"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}"?
|
|
11
11
|
All active conversations will be interrupted.`,"chat.agent.upgrade":"Upgrade","chat.agent.upgrading":"Upgrading","chat.agent.upgradeConfirm":`Upgrade Agent "{name}" to the latest version?
|
|
@@ -301,7 +301,7 @@ The agent will restart after upgrading.`,"chat.agent.alreadyLatest":"Agent is al
|
|
|
301
301
|
</template>
|
|
302
302
|
</div>
|
|
303
303
|
</div>
|
|
304
|
-
`,setup(){let e=Ie(),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),f=Vue.ref(null),p=Vue.ref(null),m=Vue.ref(""),y=Vue.ref(localStorage.getItem("loginMode")==="credentials"?"credentials":"oauth");Vue.watch(y,ne=>localStorage.setItem("loginMode",ne));let h=Vue.ref(""),A=Vue.ref(""),x=Vue.ref(""),S=Vue.ref(""),v=Vue.ref(""),g=Vue.ref(!1),b=Vue.ref(""),D=Vue.ref(""),L=Vue.ref(""),U=Vue.ref(""),
|
|
304
|
+
`,setup(){let e=Ie(),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),f=Vue.ref(null),p=Vue.ref(null),m=Vue.ref(""),y=Vue.ref(localStorage.getItem("loginMode")==="credentials"?"credentials":"oauth");Vue.watch(y,ne=>localStorage.setItem("loginMode",ne));let h=Vue.ref(""),A=Vue.ref(""),x=Vue.ref(""),S=Vue.ref(""),v=Vue.ref(""),g=Vue.ref(!1),b=Vue.ref(""),D=Vue.ref(""),L=Vue.ref(""),U=Vue.ref(""),O=Vue.ref(""),_=Vue.ref(""),P=Vue.ref(!1),T=Vue.ref(!1),C=()=>{a.value="",e.error=null,b.value="email",D.value="",U.value="",O.value="",_.value="",L.value="",T.value=!1},M=()=>{b.value="",L.value="",T.value=!1},E=async()=>{if(a.value="",!D.value||!/.+@.+\..+/.test(D.value)){a.value=t("login.forgot.emailInvalid");return}P.value=!0;try{let ne=await e.requestPasswordReset(D.value.trim());if(!ne)return;L.value=ne,b.value="verify"}finally{P.value=!1}},R=async()=>{if(a.value="",!U.value){a.value=t("login.error.enterVerifyCode");return}if(!O.value||O.value.length<6){a.value=t("login.error.passwordMinLen");return}if(O.value!==_.value){a.value=t("login.error.passwordMismatch");return}P.value=!0;try{await e.verifyPasswordReset(L.value,U.value,O.value)&&(T.value=!0,setTimeout(()=>{M(),y.value="credentials"},1500))}finally{P.value=!1}},H={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>'},G=Vue.computed(()=>["alipay","microsoft","github","google","wechat"].filter(Q=>Q==="microsoft"?e.aadEnabled:!!e.ssoProviders[Q]).map(Q=>({key:Q,label:t(`login.${Q}`),icon:H[Q]}))),ue=()=>{c.value&&c.value.focus()},J=()=>{y.value="credentials",Vue.nextTick(()=>{l.value&&l.value.focus()})},ve=()=>{let ne=e.qrPanel;if(!ne||!ne.authorizeUrl)return;let Q=`alipays://platformapi/startapp?appId=20000067&url=${encodeURIComponent(ne.authorizeUrl)}`;window.location.href=Q},ae=ne=>{if(a.value="",ne==="microsoft"){e.loginWithMicrosoft();return}if(ne==="alipay"){qn()?e.loginWithSso(ne):ds()?e.loginWithAlipayMobile():e.startSsoQr(ne).then(Q=>{Q&&w()});return}if(ne==="wechat"){if(ds()||Bn()){a.value=t("login.wechat.mobileUnsupported");return}e.startSsoQr(ne).then(Q=>{Q&&w()});return}e.loginWithSso(ne)},$=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()})},w=()=>{if(e.qrPanel&&typeof qrcode=="function")try{let ne=qrcode(0,"M");ne.addData(e.qrPanel.authorizeUrl,"Byte"),ne.make(),m.value=ne.createDataURL(6,4)}catch{}},B=Vue.computed(()=>{let ne=e.qrPanel?.provider;return t(ne==="alipay"?"login.qr.titleAlipay":ne==="wechat"?"login.qr.titleWechat":"login.qr.title")});Vue.watch(()=>e.qrPanel?.authorizeUrl,ne=>{ne?w():m.value=""});let X=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()}))},re=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()}))},ke=async()=>{if(a.value="",g.value=!1,!A.value||A.value.length<2){a.value=t("login.error.usernameMinLen");return}if(!x.value||x.value.length<6){a.value=t("login.error.passwordMinLen");return}if(x.value!==S.value){a.value=t("login.error.passwordMismatch");return}await e.register(A.value,x.value,v.value||void 0,h.value)&&(g.value=!0,n.value=A.value,h.value="",A.value="",x.value="",S.value="",v.value="",setTimeout(()=>e.backToCredentials(),1500))},Pe=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(),G.value.length===0&&y.value==="oauth"&&(y.value="credentials"),e.loginStep==="credentials"&&y.value==="credentials"&&l.value&&l.value.focus()}),Vue.watch(()=>e.loginStep,ne=>{Vue.nextTick(()=>{ne==="credentials"&&y.value==="credentials"&&l.value?l.value.focus():(ne==="totp"||ne==="totp-setup")&&u.value?u.value.focus():ne==="verification"&&d.value?d.value.focus():ne==="register"&&f.value&&f.value.focus()})}),{authStore:e,currentLocale:s,toggleLang:()=>{$s(s.value==="zh-CN"?"en":"zh-CN")},loginMode:y,switchToCredentials:J,enabledProviders:G,handleProviderClick:ae,relaunchAlipayMobile:ve,qrCanvas:p,qrDataUrl:m,qrPanelTitle:B,username:n,password:i,verificationCode:r,totpCode:o,localError:a,usernameInput:l,passwordInput:c,codeInput:d,totpInput:u,regCodeInput:f,regInvitationCode:h,regUsername:A,regPassword:x,regPasswordConfirm:S,regEmail:v,registerSuccess:g,focusPassword:ue,login:$,verify:Pe,verifyTotp:X,setupTotp:re,doRegister:ke,forgotStep:b,forgotEmail:D,forgotResetToken:L,forgotCode:U,forgotNewPassword:O,forgotConfirm:_,forgotLoading:P,forgotSuccess:T,enterForgotMode:C,exitForgotMode:M,submitForgotEmail:E,submitForgotReset:R}}}});var Wn,Fr=N(()=>{Wn={name:"ChatHeader",emits:["toggle-sidebar","close-pane"],props:{conversationId:{type:String,default:null},paneId:{type:String,default:null},showClosePane:{type:Boolean,default:!1}},template:`
|
|
305
305
|
<header class="chat-header">
|
|
306
306
|
<!-- Mobile sidebar toggle \u2014 hidden on desktop and in split mode -->
|
|
307
307
|
<button class="header-sidebar-toggle" v-if="!store.isSplitMode"
|
|
@@ -403,7 +403,7 @@ The agent will restart after upgrading.`,"chat.agent.alreadyLatest":"Agent is al
|
|
|
403
403
|
</button>
|
|
404
404
|
</div>
|
|
405
405
|
</header>
|
|
406
|
-
`,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(w=>w.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=(w,B=!0)=>{let X=r.value;return X?!!X[w]:o.value?B:!1},l=Vue.computed(()=>a("compact")),c=Vue.computed(()=>a("clear")),d=Vue.computed(()=>a("expert")),u=Vue.computed(()=>a("mcp")),f=Vue.computed(()=>{if(!n.value)return"Yeaft";let w=t.getConversationTitle(n.value);if(w)return w;let X=t.conversations.find(re=>re.id===n.value)?.workDir||t.currentWorkDir;if(X){let re=X.split(/[/\\]/);return re[re.length-1]||re[re.length-2]||X}return s("chatHeader.newConv")}),p=Vue.computed(()=>{if(!n.value)return"";let B=t.conversations.find(re=>re.id===n.value)?.agentId;return B&&t.agents.find(re=>re.id===B)?.name||""}),m=Vue.computed(()=>t.clearStatus?.conversationId===n.value?!0:t.compactStatus?t.compactStatus.conversationId===n.value:!1),y=Vue.computed(()=>t.clearStatus?.conversationId===n.value?t.clearStatus.status==="clearing"?"compacting":"completed":t.compactStatus?t.compactStatus.status==="compacting"?"compacting":"completed":""),h=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"):""),x=Vue.computed(()=>n.value&&(t.conversations.find(B=>B.id===n.value)?.workDir||t.currentWorkDir)||""),S=Vue.computed(()=>!t.contextUsage||t.contextUsage.conversationId!==n.value?null:t.contextUsage),v=Vue.computed(()=>{let w=S.value?.percentage||0;return w>=80?"context-danger":w>=50?"context-warn":"context-ok"}),g=Vue.computed(()=>{if(!S.value)return"";let w=(S.value.inputTokens/1e3).toFixed(0),B=(S.value.maxTokens/1e3).toFixed(0);return`Context: ${w}k / ${B}k`}),b=Vue.computed(()=>t.isRefreshingSession(n.value)),D=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),
|
|
406
|
+
`,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(w=>w.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=(w,B=!0)=>{let X=r.value;return X?!!X[w]:o.value?B:!1},l=Vue.computed(()=>a("compact")),c=Vue.computed(()=>a("clear")),d=Vue.computed(()=>a("expert")),u=Vue.computed(()=>a("mcp")),f=Vue.computed(()=>{if(!n.value)return"Yeaft";let w=t.getConversationTitle(n.value);if(w)return w;let X=t.conversations.find(re=>re.id===n.value)?.workDir||t.currentWorkDir;if(X){let re=X.split(/[/\\]/);return re[re.length-1]||re[re.length-2]||X}return s("chatHeader.newConv")}),p=Vue.computed(()=>{if(!n.value)return"";let B=t.conversations.find(re=>re.id===n.value)?.agentId;return B&&t.agents.find(re=>re.id===B)?.name||""}),m=Vue.computed(()=>t.clearStatus?.conversationId===n.value?!0:t.compactStatus?t.compactStatus.conversationId===n.value:!1),y=Vue.computed(()=>t.clearStatus?.conversationId===n.value?t.clearStatus.status==="clearing"?"compacting":"completed":t.compactStatus?t.compactStatus.status==="compacting"?"compacting":"completed":""),h=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"):""),x=Vue.computed(()=>n.value&&(t.conversations.find(B=>B.id===n.value)?.workDir||t.currentWorkDir)||""),S=Vue.computed(()=>!t.contextUsage||t.contextUsage.conversationId!==n.value?null:t.contextUsage),v=Vue.computed(()=>{let w=S.value?.percentage||0;return w>=80?"context-danger":w>=50?"context-warn":"context-ok"}),g=Vue.computed(()=>{if(!S.value)return"";let w=(S.value.inputTokens/1e3).toFixed(0),B=(S.value.maxTokens/1e3).toFixed(0);return`Context: ${w}k / ${B}k`}),b=Vue.computed(()=>t.isRefreshingSession(n.value)),D=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),O=()=>{t.isRefreshingSession(n.value)||!n.value||(t.setRefreshingSession(n.value,!0),t.startRefreshTimeout(n.value),t.processingConversations[n.value]||(t.messagesMap[n.value]=[]),t.sendWsMessage({type:"sync_messages",conversationId:n.value,turns:5}))},_=()=>{D.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"))},C=Vue.computed(()=>t.getPaneRightPanel(e.paneId)),M=Vue.ref(null),E=Vue.computed(()=>{if(!t.mcpPanelOpen||!M.value)return null;let w=M.value.getBoundingClientRect();return{top:`${w.bottom+6}px`,right:`${window.innerWidth-w.right}px`}}),R=Vue.computed(()=>t.currentMcpServers.filter(w=>w.enabled).length),H=Vue.computed(()=>!!t.conversations.find(B=>B.id===n.value)?.needRestart),G=()=>{t.mcpPanelOpen=!t.mcpPanelOpen},ue=()=>{t.togglePaneRightPanel("experts",e.paneId)},J=()=>{t.togglePaneRightPanel("subagents",e.paneId)},ve=Vue.computed(()=>t.runningSubagentCount),ae=(w,B)=>{t.toggleConversationMcp(w,B)},$=w=>{t.mcpPanelOpen&&!w.target.closest(".mcp-dropdown")&&!w.target.closest(".mcp-config-wrapper")&&(t.mcpPanelOpen=!1)};return Vue.onMounted(()=>{document.addEventListener("click",$)}),Vue.onUnmounted(()=>{document.removeEventListener("click",$)}),{store:t,effectiveConvId:n,effectiveRightPanel:C,isClaudeCode:o,canCompact:l,canClear:c,canExpert:d,canMcp:u,headerTitle:f,showStatusBanner:m,statusBannerClass:y,statusBannerSpinner:h,statusBannerMessage:A,contextUsage:S,contextColorClass:v,contextLabel:g,isRefreshing:b,isCompacting:D,isClearing:L,canRefresh:U,refreshSession:O,reloadPage:P,compactContext:_,clearMessages:T,mcpBtnRef:M,mcpDropdownStyle:E,mcpEnabledCount:R,currentConvNeedRestart:H,toggleMcpPanel:G,toggleMcpServer:ae,toggleExpertPanel:ue,toggleSubAgentPanel:J,runningSubagentCount:ve}}}});function Ks(e=globalThis.location){let t=e?.protocol==="https:"?"wss:":"ws:",s=e?.host||"localhost";return`${t}//${s}`}function Un(){return"npm install -g @yeaft/webchat-agent"}function zn(){return"yeaft-agent llm use github-copilot --model gpt-5.5"}function Or(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 jn({profile:e=null,agentSecret:t="",serverWsUrl:s=Ks()}={}){if(!t)return"";let n=Or(e);return`yeaft-agent install --server ${s} --secret ${t} --name ${n}`}var Hr=N(()=>{});function us(e){if(!e)return;let t=document.createElement("div");t.className="image-preview-overlay";let s=document.createElement("img");s.className="image-preview-img",s.src=e,s.alt="Preview",t.appendChild(s),document.body.appendChild(t),t.offsetHeight,t.classList.add("visible");let n=()=>{t.classList.remove("visible"),t.addEventListener("transitionend",()=>t.remove(),{once:!0}),document.removeEventListener("keydown",i)},i=r=>{r.key==="Escape"&&n()};t.addEventListener("click",r=>{r.target===t&&n()}),document.addEventListener("keydown",i)}var Kn=N(()=>{});function Tg(e){let t=[];for(let s of e)s==="\b"?t.pop():t.push(s);return t.join("")}function Mg(e){let t=e.split("\r"),s=t[t.length-1]||"";return Tg(s)}function Ec(e){return e.replace(/\r\n/g,`
|
|
407
407
|
`).split(`
|
|
408
408
|
`).map(t=>Mg(t)).join(`
|
|
409
409
|
`)}function _c(e){return e.replace(Ag,"").replace(xg,"")}function Pg(e){return e?e.split(";").filter(t=>t!=="").map(t=>Number(t)).filter(Number.isFinite):[0]}function Tc(e,t){let s=t==="bg"&&e>=30&&e<=37||t==="bg"&&e>=90&&e<=97?e+10:e;return t==="bg"?Wr.get(s):qr.get(s)}function Mc(e,t,s){let n=Ur[0],i=1/0;for(let r of Ur){let o=(r.r-e)**2+(r.g-t)**2+(r.b-s)**2;o<i&&(n=r,i=o)}return n.code}function Dg(e){if(e<0||e>255)return null;if(e<16){let s=Ur[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:Br[Math.floor(t/36)],g:Br[Math.floor(t%36/6)],b:Br[t%6]}}function Pc(e,t,s,n){let i=s[n+1];if(i===5){let r=s[n+2];if(Number.isFinite(r)){let o=Dg(r);o&&(e[t]=Tc(Mc(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]=Tc(Mc(r,o,a),t)||""),n+5}return n+2}function Eg(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(qr.has(r))s.fg=qr.get(r);else if(Wr.has(r))s.bg=Wr.get(r);else if(r===38){i=Pc(s,"fg",n,i);continue}else if(r===48){i=Pc(s,"bg",n,i);continue}i+=1}return s}function _g(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 Dc(e,t,s){let n=_c(t);if(!n)return;let i=_g(s),r=e[e.length-1];r&&r.className===i?r.text+=n:e.push({text:n,className:i})}function kt(e){if(e==null)return"";let t=typeof e=="string"?e:String(e);return t?_c(Ec(t)):""}function Rc(e){if(e==null)return[];let t=typeof e=="string"?e:String(e);if(!t)return[];let s=Ec(t),n=[],i={fg:"",bg:"",bold:!1,dim:!1,italic:!1,underline:!1},r=0;Nr.lastIndex=0;for(let o=Nr.exec(s);o;o=Nr.exec(s))Dc(n,s.slice(r,o.index),i),i=Eg(i,Pg(o[1])),r=o.index+o[0].length;return Dc(n,s.slice(r),i),n}var Ag,Nr,xg,qr,Wr,Ur,Br,Ys=N(()=>{Ag=/[\u001b\u009b](?:[\[\]()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><~]|\][^\u0007]*(?:\u0007|\u001b\\)|[PX^_][\s\S]*?\u001b\\)/g,Nr=/(?:\u001b\[|\u009b)([0-9;]*)m/g,xg=/[\u0000-\u0008\u000b\u000c\u000e-\u001a\u001c-\u001f\u007f-\u009f]/g,qr=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"]]),Wr=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"]]),Ur=[{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}],Br=[0,95,135,175,215,255]});var ps,Yn=N(()=>{Kn();Ws();Ys();ps={name:"MessageItem",props:{message:{type:Object,required:!0}},template:`
|
|
@@ -804,7 +804,7 @@ ${String(e||"").trim()}
|
|
|
804
804
|
<!-- H2.f.6: Fork-from-here button removed (single-conversation model). -->
|
|
805
805
|
</div>
|
|
806
806
|
</div>
|
|
807
|
-
`,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=$=>{r.value=!!$,t("update-actions-expanded",!!$)},l=Vue.ref(!1),c=Vue.ref(null),d=Vue.reactive(new Set),u=Vue.inject("t"),f=($,w)=>{s.answerUserQuestion($,w,e.conversationId||void 0)},p=Vue.computed(()=>(Array.isArray(e.turn?.toolMsgs)?e.turn.toolMsgs:[]).filter(w=>w?.toolName==="RouteForward").map((w,B)=>({...zr(w.toolInput||{}),key:w.toolId||`${w.startTime||0}:${B}`}))),m=Vue.computed(()=>(Array.isArray(e.turn?.toolMsgs)?e.turn.toolMsgs:[]).filter(w=>w?.toolName!=="RouteForward")),y=Vue.computed(()=>m.value.length>0||Number(e.turn.toolSummaryCount||0)>0),h=Vue.computed(()=>{let $=m.value;return $[$.length-1]}),A=Vue.computed(()=>m.value.slice(0,-1)),x=Vue.computed(()=>Math.max(0,m.value.length-1)),S=Vue.computed(()=>{let $=Number(e.turn.toolSummaryCount||0);return $?typeof u=="function"?u("chat.toolActionsOmitted",{count:$}):`${$} older tool actions omitted`:""}),v=Vue.computed(()=>{let $=e.turn?.todoMsg?.toolInput?.todos;return Array.isArray($)?$.map(w=>Hc(e.turn,w)):[]}),g=()=>{a(!o.value)},b=($,w,B)=>{let X=e.toolStatePrefix||e.turn.id||e.turn.turnId||"assistant-turn",re=$?.toolName||"tool",ke=$?.startTime||w;return`${X}:tool:${B}:${w}:${re}:${ke}`},D=($,w,B)=>{let X=b($,w,B);return e.toolExpandStates&&Object.prototype.hasOwnProperty.call(e.toolExpandStates,X)?!!e.toolExpandStates[X]:null},L=($,w,B,X)=>{t("update-tool-expanded",{key:b($,w,B),value:!!X})};typeof marked<"u"&&marked.setOptions({highlight:function($,w){if(typeof hljs<"u"&&w&&hljs.getLanguage(w))try{return hljs.highlight($,{language:w}).value}catch{}return $},breaks:!0,gfm:!0});let
|
|
807
|
+
`,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=$=>{r.value=!!$,t("update-actions-expanded",!!$)},l=Vue.ref(!1),c=Vue.ref(null),d=Vue.reactive(new Set),u=Vue.inject("t"),f=($,w)=>{s.answerUserQuestion($,w,e.conversationId||void 0)},p=Vue.computed(()=>(Array.isArray(e.turn?.toolMsgs)?e.turn.toolMsgs:[]).filter(w=>w?.toolName==="RouteForward").map((w,B)=>({...zr(w.toolInput||{}),key:w.toolId||`${w.startTime||0}:${B}`}))),m=Vue.computed(()=>(Array.isArray(e.turn?.toolMsgs)?e.turn.toolMsgs:[]).filter(w=>w?.toolName!=="RouteForward")),y=Vue.computed(()=>m.value.length>0||Number(e.turn.toolSummaryCount||0)>0),h=Vue.computed(()=>{let $=m.value;return $[$.length-1]}),A=Vue.computed(()=>m.value.slice(0,-1)),x=Vue.computed(()=>Math.max(0,m.value.length-1)),S=Vue.computed(()=>{let $=Number(e.turn.toolSummaryCount||0);return $?typeof u=="function"?u("chat.toolActionsOmitted",{count:$}):`${$} older tool actions omitted`:""}),v=Vue.computed(()=>{let $=e.turn?.todoMsg?.toolInput?.todos;return Array.isArray($)?$.map(w=>Hc(e.turn,w)):[]}),g=()=>{a(!o.value)},b=($,w,B)=>{let X=e.toolStatePrefix||e.turn.id||e.turn.turnId||"assistant-turn",re=$?.toolName||"tool",ke=$?.startTime||w;return`${X}:tool:${B}:${w}:${re}:${ke}`},D=($,w,B)=>{let X=b($,w,B);return e.toolExpandStates&&Object.prototype.hasOwnProperty.call(e.toolExpandStates,X)?!!e.toolExpandStates[X]:null},L=($,w,B,X)=>{t("update-tool-expanded",{key:b($,w,B),value:!!X})};typeof marked<"u"&&marked.setOptions({highlight:function($,w){if(typeof hljs<"u"&&w&&hljs.getLanguage(w))try{return hljs.highlight($,{language:w}).value}catch{}return $},breaks:!0,gfm:!0});let O=Vue.computed(()=>{if(!e.turn.textContent)return"";let $=e.turn.textContent;if(typeof $!="string"&&(Array.isArray($)?$=$.map(w=>typeof w=="string"?w:w&&w.type==="text"&&w.text||"").join(""):$=String($)),$=kt($),!$)return"";try{if(typeof marked<"u"){let w=marked.parse($);return P(_(w))}}catch{}return T($)}),_=$=>$.replace(/<pre><code([^>]*)>([\s\S]*?)<\/code><\/pre>/g,(w,B,X)=>{let re=B.match(/class="language-(\w+)"/);return`<div class="code-block-wrapper">
|
|
808
808
|
<div class="code-block-header">
|
|
809
809
|
<span class="code-lang">${re?re[1]:""}</span>
|
|
810
810
|
<button class="code-copy-btn" onclick="window.copyCodeBlock(this)" title="Copy">
|
|
@@ -814,7 +814,7 @@ ${String(e||"").trim()}
|
|
|
814
814
|
</button>
|
|
815
815
|
</div>
|
|
816
816
|
<pre><code${B}>${X}</code></pre>
|
|
817
|
-
</div>`}),P=$=>$.replace(/<table>([\s\S]*?)<\/table>/g,w=>`<div class="table-scroll-wrapper">${w}</div>`),T=$=>{if(!$)return"";typeof $!="string"&&($=String($));let w=B=>{let X=document.createElement("div");return X.textContent=B,X.innerHTML};return $.replace(/```(\w*)\n([\s\S]*?)```/g,(B,X,re)=>`<div class="code-block-wrapper"><pre><code class="language-${X}">${w(re.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>")},C=async()=>{try{await navigator.clipboard.writeText(e.turn.textContent||""),n.value=!0,setTimeout(()=>{n.value=!1},2e3)}catch{}},M=async()=>{try{await navigator.clipboard.writeText(e.turn.textContent||""),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch{}},E=()=>{let $=e.turn.textContent||"";if(!$)return;let w=new Blob([$],{type:"text/markdown;charset=utf-8"}),B=URL.createObjectURL(w),X=document.createElement("a");X.download=`response-${Date.now()}.md`,X.href=B,X.click(),URL.revokeObjectURL(B)},R=async()=>{if(!(l.value||!window.htmlToImage)){l.value=!0;try{let $=c.value;if(!$)return;let w=$.querySelector(".turn-content");if(!w)return;let B=getComputedStyle(document.body).getPropertyValue("--bg-main").trim()||"#ffffff";w.classList.add("screenshot-mode");try{let re=w.getBoundingClientRect(),ke=await window.htmlToImage.toPng(w,{backgroundColor:B,pixelRatio:3,width:re.width+64,height:re.height+64,style:{padding:"32px"},filter:De=>!(De.classList&&(De.classList.contains("turn-header")||De.classList.contains("screenshot-btn")))}),Pe=document.createElement("a");Pe.download=`response-${Date.now()}.png`,Pe.href=ke,Pe.click()}finally{w.classList.remove("screenshot-mode")}}catch{}finally{l.value=!1}}};Vue.onMounted(()=>{window.copyCodeBlock||(window.copyCodeBlock=async function($){let B=$.closest(".code-block-wrapper").querySelector("code");if(B)try{await navigator.clipboard.writeText(B.textContent),$.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(()=>{$.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($=>{hljs.highlightElement($),$.dataset.highlighted="true"}),Xe(c.value)})}),Vue.watch(()=>e.turn.textContent,()=>{Vue.nextTick(()=>{typeof hljs<"u"&&document.querySelectorAll("pre code:not([data-highlighted])").forEach($=>{hljs.highlightElement($),$.dataset.highlighted="true"}),Xe(c.value)})});let H=$=>{if($?.src)return $.src;if(!$?.fileId)return"";let w=$.previewToken||"";return`/api/preview/${$.fileId}?token=${w}`},G=$=>{d.add($?.assetId||$?.id)},ue=$=>{if($)try{typeof s.cancelVpTurn=="function"&&s.cancelVpTurn($)}catch{}},J=()=>{let $=e.turn;return $?typeof $.timestamp=="number"&&$.timestamp>0?$.timestamp:typeof $.createdAt=="number"&&$.createdAt>0?$.createdAt:typeof $.speakerTimestamp=="number"&&$.speakerTimestamp>0?$.speakerTimestamp:null:null},ve=Vue.computed(()=>{let $=J();if(!$)return"";try{return new Date($).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}catch{return""}}),ae=Vue.computed(()=>{let $=J();if(!$)return"";try{return new Date($).toLocaleString()}catch{return""}});return{onStopTurn:ue,turnTime:ve,turnTimeFull:ae,copied:n,fullCopied:i,expanded:o,screenshotting:l,turnRef:c,showToolActions:y,latestTool:h,historyTools:A,latestToolIndex:x,actionTools:m,routeMessages:p,toolSummaryLabel:S,toggleExpand:g,toolExpandedValue:D,updateToolExpanded:L,renderedContent:
|
|
817
|
+
</div>`}),P=$=>$.replace(/<table>([\s\S]*?)<\/table>/g,w=>`<div class="table-scroll-wrapper">${w}</div>`),T=$=>{if(!$)return"";typeof $!="string"&&($=String($));let w=B=>{let X=document.createElement("div");return X.textContent=B,X.innerHTML};return $.replace(/```(\w*)\n([\s\S]*?)```/g,(B,X,re)=>`<div class="code-block-wrapper"><pre><code class="language-${X}">${w(re.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>")},C=async()=>{try{await navigator.clipboard.writeText(e.turn.textContent||""),n.value=!0,setTimeout(()=>{n.value=!1},2e3)}catch{}},M=async()=>{try{await navigator.clipboard.writeText(e.turn.textContent||""),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch{}},E=()=>{let $=e.turn.textContent||"";if(!$)return;let w=new Blob([$],{type:"text/markdown;charset=utf-8"}),B=URL.createObjectURL(w),X=document.createElement("a");X.download=`response-${Date.now()}.md`,X.href=B,X.click(),URL.revokeObjectURL(B)},R=async()=>{if(!(l.value||!window.htmlToImage)){l.value=!0;try{let $=c.value;if(!$)return;let w=$.querySelector(".turn-content");if(!w)return;let B=getComputedStyle(document.body).getPropertyValue("--bg-main").trim()||"#ffffff";w.classList.add("screenshot-mode");try{let re=w.getBoundingClientRect(),ke=await window.htmlToImage.toPng(w,{backgroundColor:B,pixelRatio:3,width:re.width+64,height:re.height+64,style:{padding:"32px"},filter:De=>!(De.classList&&(De.classList.contains("turn-header")||De.classList.contains("screenshot-btn")))}),Pe=document.createElement("a");Pe.download=`response-${Date.now()}.png`,Pe.href=ke,Pe.click()}finally{w.classList.remove("screenshot-mode")}}catch{}finally{l.value=!1}}};Vue.onMounted(()=>{window.copyCodeBlock||(window.copyCodeBlock=async function($){let B=$.closest(".code-block-wrapper").querySelector("code");if(B)try{await navigator.clipboard.writeText(B.textContent),$.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(()=>{$.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($=>{hljs.highlightElement($),$.dataset.highlighted="true"}),Xe(c.value)})}),Vue.watch(()=>e.turn.textContent,()=>{Vue.nextTick(()=>{typeof hljs<"u"&&document.querySelectorAll("pre code:not([data-highlighted])").forEach($=>{hljs.highlightElement($),$.dataset.highlighted="true"}),Xe(c.value)})});let H=$=>{if($?.src)return $.src;if(!$?.fileId)return"";let w=$.previewToken||"";return`/api/preview/${$.fileId}?token=${w}`},G=$=>{d.add($?.assetId||$?.id)},ue=$=>{if($)try{typeof s.cancelVpTurn=="function"&&s.cancelVpTurn($)}catch{}},J=()=>{let $=e.turn;return $?typeof $.timestamp=="number"&&$.timestamp>0?$.timestamp:typeof $.createdAt=="number"&&$.createdAt>0?$.createdAt:typeof $.speakerTimestamp=="number"&&$.speakerTimestamp>0?$.speakerTimestamp:null:null},ve=Vue.computed(()=>{let $=J();if(!$)return"";try{return new Date($).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}catch{return""}}),ae=Vue.computed(()=>{let $=J();if(!$)return"";try{return new Date($).toLocaleString()}catch{return""}});return{onStopTurn:ue,turnTime:ve,turnTimeFull:ae,copied:n,fullCopied:i,expanded:o,screenshotting:l,turnRef:c,showToolActions:y,latestTool:h,historyTools:A,latestToolIndex:x,actionTools:m,routeMessages:p,toolSummaryLabel:S,toggleExpand:g,toolExpandedValue:D,updateToolExpanded:L,renderedContent:O,copyContent:C,copyFullResponse:M,exportMarkdown:E,screenshotContent:R,onAskSubmit:f,imageSrc:H,failedImages:d,handleImageError:G,openImagePreview:us,displayedTodos:v}}}});function Kc(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 Yc=N(()=>{});var Gc,Qc=N(()=>{Jn();Fn();cs();Yc();Gc={name:"VpTurnBlock",components:{AssistantTurn:fs},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"],template:`
|
|
818
818
|
<div class="vp-turn-block"
|
|
819
819
|
:class="{ 'vp-turn-block-streaming': turn.isStreaming }"
|
|
820
820
|
:data-turn-id="turn.turnId || ''"
|
|
@@ -973,8 +973,8 @@ ${String(e||"").trim()}
|
|
|
973
973
|
aria-hidden="true"
|
|
974
974
|
></div>
|
|
975
975
|
</div>
|
|
976
|
-
`,setup(e,{emit:t,expose:s}){let n=Vue.ref(null),i=Vue.ref(null),r=Vue.ref(0),o=Vue.ref(Tt.viewportHeight),a=Vue.reactive({}),l=new Map,c=new Map,d=new Map,u=null,f=null,p=null,m=null,y=0,h=!1,A=Vue.computed(()=>od(e.items,{scrollTop:r.value,viewportHeight:o.value,heightCache:a,overscan:e.overscan,itemGap:e.itemGap,estimateHeight:e.estimateHeight})),x=Vue.computed(()=>A.value.items),S=Vue.computed(()=>A.value.topSpacerHeight),v=Vue.computed(()=>A.value.bottomSpacerHeight);function g(E){E&&t("scroll-state",{scrollTop:E.scrollTop||0,scrollHeight:E.scrollHeight||0,clientHeight:E.clientHeight||0})}function b(){let E=i.value;E&&(r.value=Math.max(0,E.scrollTop||0),o.value=Math.max(1,E.clientHeight||Tt.viewportHeight),g(E))}function D(){f||(f=requestAnimationFrame(()=>{f=null,b()}))}function L(E){return E?ms({scrollTop:E.scrollTop,scrollHeight:E.scrollHeight,clientHeight:E.clientHeight,threshold:Tt.bottomThreshold}):!0}function U({delta:E=0,toBottom:R=!1}={}){Math.abs(E)>=Jr&&(y+=E),R&&(h=!0),!m&&(m=requestAnimationFrame(()=>{m=null;let H=i.value;if(!H){y=0,h=!1;return}h?H.scrollTop=H.scrollHeight:Math.abs(y)>=Jr&&(H.scrollTop+=y),y=0,h=!1,b()}))}function
|
|
977
|
-
`),()=>{l.clear(),e.items.forEach((E,R)=>l.set(gs(E,R),R)),Vue.nextTick(b)},{immediate:!0}),Vue.onMounted(()=>{if(i.value=n.value?.closest?.(".chat-container")||n.value?.parentElement||null,b(),i.value?.addEventListener("scroll",D,{passive:!0}),window.addEventListener("resize",D),typeof ResizeObserver<"u"){u=new ResizeObserver(E=>{for(let R of E){let H=R.target?.dataset?.virtualId,G=Number(R.target?.dataset?.virtualIndex);H&&
|
|
976
|
+
`,setup(e,{emit:t,expose:s}){let n=Vue.ref(null),i=Vue.ref(null),r=Vue.ref(0),o=Vue.ref(Tt.viewportHeight),a=Vue.reactive({}),l=new Map,c=new Map,d=new Map,u=null,f=null,p=null,m=null,y=0,h=!1,A=Vue.computed(()=>od(e.items,{scrollTop:r.value,viewportHeight:o.value,heightCache:a,overscan:e.overscan,itemGap:e.itemGap,estimateHeight:e.estimateHeight})),x=Vue.computed(()=>A.value.items),S=Vue.computed(()=>A.value.topSpacerHeight),v=Vue.computed(()=>A.value.bottomSpacerHeight);function g(E){E&&t("scroll-state",{scrollTop:E.scrollTop||0,scrollHeight:E.scrollHeight||0,clientHeight:E.clientHeight||0})}function b(){let E=i.value;E&&(r.value=Math.max(0,E.scrollTop||0),o.value=Math.max(1,E.clientHeight||Tt.viewportHeight),g(E))}function D(){f||(f=requestAnimationFrame(()=>{f=null,b()}))}function L(E){return E?ms({scrollTop:E.scrollTop,scrollHeight:E.scrollHeight,clientHeight:E.clientHeight,threshold:Tt.bottomThreshold}):!0}function U({delta:E=0,toBottom:R=!1}={}){Math.abs(E)>=Jr&&(y+=E),R&&(h=!0),!m&&(m=requestAnimationFrame(()=>{m=null;let H=i.value;if(!H){y=0,h=!1;return}h?H.scrollTop=H.scrollHeight:Math.abs(y)>=Jr&&(H.scrollTop+=y),y=0,h=!1,b()}))}function O(E,R,H){!E||!H||(d.set(E,{index:R,el:H}),!p&&(p=requestAnimationFrame(()=>{p=null;let G=Array.from(d.entries());d.clear();for(let[ue,J]of G)_(ue,J.index,J.el)})))}function _(E,R,H){if(!H)return;let G=Math.ceil(H.getBoundingClientRect?.().height||H.offsetHeight||0);if(!Number.isFinite(G)||G<=0)return;let ue=a[E];if(ue===G)return;let J=i.value,ve=L(J),ae=l.get(E),$=Number.isFinite(ae)&&ae<A.value.visibleStart;if(a[E]=G,J&&Number.isFinite(ue)){let w=G-ue;if(Math.abs(w)<Jr)return;$?U({delta:w}):ve&&Vue.nextTick(()=>U({toBottom:!0}))}}function P(E,R,H){l.set(E,R),H&&(c.set(E,H),u&&u.observe(H),Vue.nextTick(()=>O(E,R,H)))}function T(E,R,H){if(!E)return;let G=c.get(E);if(G&&G!==H&&u&&u.unobserve(G),!H){c.delete(E);return}P(E,R,H)}async function C(E,{align:R="center"}={}){let H=Number.isFinite(E)?Math.floor(E):-1,G=i.value;if(!G||H<0||H>=e.items.length)return!1;let ue=gs(e.items[H],H);G.scrollTop=ad(e.items,H,a,{itemGap:e.itemGap,estimateHeight:e.estimateHeight,viewportHeight:G.clientHeight||o.value,align:R}),b(),await Vue.nextTick();let J=c.get(ue);return J?.scrollIntoView&&J.scrollIntoView({block:R,inline:"nearest"}),b(),!0}function M(E,R={}){let H=l.get(String(E));return Number.isFinite(H)?C(H,R):Promise.resolve(!1)}return s({scrollToKey:M,scrollToIndex:C}),Vue.watch(()=>e.items.map((E,R)=>gs(E,R)).join(`
|
|
977
|
+
`),()=>{l.clear(),e.items.forEach((E,R)=>l.set(gs(E,R),R)),Vue.nextTick(b)},{immediate:!0}),Vue.onMounted(()=>{if(i.value=n.value?.closest?.(".chat-container")||n.value?.parentElement||null,b(),i.value?.addEventListener("scroll",D,{passive:!0}),window.addEventListener("resize",D),typeof ResizeObserver<"u"){u=new ResizeObserver(E=>{for(let R of E){let H=R.target?.dataset?.virtualId,G=Number(R.target?.dataset?.virtualIndex);H&&O(H,G,R.target)}});for(let[E,R]of c.entries()){let H=l.get(E)??Number(R.dataset?.virtualIndex||0);P(E,H,R)}}}),Vue.onBeforeUnmount(()=>{i.value?.removeEventListener("scroll",D),window.removeEventListener("resize",D),u&&u.disconnect(),f&&cancelAnimationFrame(f),p&&cancelAnimationFrame(p),m&&cancelAnimationFrame(m),d.clear(),y=0,h=!1}),{rootRef:n,visibleEntries:x,topSpacerHeight:S,bottomSpacerHeight:v,setItemRef:T}}}});function Zs(e){return typeof e=="string"&&e.trim()?e.trim():""}function sm(e){return Zs(e?.speakerVpId)||Zs(e?.vpId)}function pd(e,t){if(!e||!t)return!1;let s=Zs(e.speakerVpId),n=sm(t);if(s&&n&&s!==n)return!0;if(e.isHistory&&t.isHistory)return!1;let i=Zs(e.turnId),r=Zs(t.turnId);return!!(i&&r&&i!==r)}var fd=N(()=>{});function nm(e,t=0){return String(e?.collapseKey||e?.messageId||e?.id||`message_turn_${t}`)}function gd(e){return e?.type==="user"}function hs(e){return e?e.type!=="user"&&e.type!=="system"&&e.type!=="error":!1}function im(e){return hs(e)?!!(e.isStreaming||e.turn&&e.turn.isStreaming||e.message&&e.message.isStreaming):!1}function Js(e){let t=Array.isArray(e?.items)?e.items:[];return e?.responseCollapsed?t.filter(s=>!hs(s)):t}function md(e){return(Array.isArray(e?.items)?e.items:[]).filter(hs)}function rm(e){return md(e).length}function hd(e){let t=md(e);return t.length?t[0]:null}function om(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 eo(e){if(!e?.responseCollapsed)return[];let t=hd(e);return om(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 vd(e,t={},s={}){let n=Array.isArray(e)?e:[],i=Math.max(0,Number(s.expandedRecentUserTurns??2)),r=[];n.forEach((a,l)=>{if(a?.type!=="message-block")return;(Array.isArray(a.items)?a.items:[]).some(gd)&&r.push(l)});let o=new Set(i>0?r.slice(-i):[]);return n.map((a,l)=>{if(a?.type!=="message-block")return a;let c=Array.isArray(a.items)?a.items:[],d=c.some(gd),u=rm(a),f=c.some(im),p=d&&u>0&&!f,m=nm(a,l),y=p&&!o.has(l),h=t?.[m],A=m in(t||{}),x=p?A?!!h:y:!1;return{...a,responseCollapseKey:m,responseCollapsible:p,responseCollapsed:x,responseCount:u,collapsedResponsePreview:x?eo({...a,responseCollapsed:x}):[],visibleItemCount:Js({...a,responseCollapsed:x}).length}})}function yd(e,t){if(!e?.responseCollapsed||typeof t!="function")return null;let s=Js(e),n=hd(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 bd=N(()=>{});function vs(e,t){typeof t!="string"||!/^m\d+$/.test(t)||e.includes(t)||e.push(t)}function am(e){if(!e)return[];let t=[];for(let s of Array.isArray(e.messages)?e.messages:[])vs(t,s?.id),vs(t,s?.messageId);return vs(t,e.message?.id),vs(t,e.messageId),vs(t,e.atMessageId),e.type!=="assistant-turn"&&vs(t,e.id),t}function lm(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(!am(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 wd({blocks:e,messageId:t,collapseStates:s,scrollToBlock:n,findRow:i,flashRow:r,nextTick:o}){let a=lm(e,t);if(!a||typeof n!="function"||typeof i!="function")return!1;if(a.requiresExpansion){if(!a.collapseKey||!s)return!1;s[a.collapseKey]=!1,await o?.()}if(!await n(a.blockId))return!1;await o?.();let c=i(a.rowId);return c?(c.scrollIntoView?.({block:"center",inline:"nearest"}),r?.(a.rowId),!0):!1}var kd=N(()=>{});var ti,to=N(()=>{lt();Hr();Yn();Jn();Qc();Gr();Zc();ed();sd();ud();fd();Zr();bd();kd();ti={name:"MessageList",components:{MessageItem:ps,AssistantTurn:fs,VpTurnBlock:Gc,VpSpeakerHeader:Xn,ReflectionCard:Xc,SubAgentCard:Jc,UserTurnBlock:td,VirtualTranscript:dd},template:`
|
|
978
978
|
<main class="chat-container" ref="containerRef">
|
|
979
979
|
<!-- Session Loading Overlay - only covers message area -->
|
|
980
980
|
<div class="session-loading-overlay" v-if="showSessionLoadingOverlay">
|
|
@@ -1584,7 +1584,7 @@ ${String(e||"").trim()}
|
|
|
1584
1584
|
{{ $t('message.scrollToLatest') }}
|
|
1585
1585
|
</button>
|
|
1586
1586
|
</main>
|
|
1587
|
-
`,emits:["new-conversation","resume-conversation","open-settings"],setup(e,{expose:t}){let s=Pinia.useChatStore(),n=Ie(),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=k=>String(k?.id||k?.turnId||k?.messageId||k?.atMessageId||k?.message?.id||"turn_unknown"),f=k=>{let V=u(k);return Object.prototype.hasOwnProperty.call(l,V)?!!l[V]:!1},p=(k,V)=>{l[u(k)]=!!V},m=({key:k,value:V}={})=>{k&&(c[k]=!!V)},y=k=>{let V=yd(k,xt);return Number.isFinite(V)?V:xt(k)},h=k=>Js(k),A=k=>{let V=Array.isArray(k?.collapsedResponsePreview)?k.collapsedResponsePreview:eo(k);return Array.isArray(V)?V:V?[String(V)]:[]},x=k=>{let V=Array.isArray(k?.items)?k.items.find(he=>hs(he)):null,W=V?.speakerVpId||V?.vpId||V?.message?.speakerVpId||V?.message?.vpId||k?.vpId||"",de=W&&i&&typeof i.vpLabel=="function"?i.vpLabel(W)||W:W||(typeof r=="function"?r("message.assistant"):"Assistant"),ye=W&&i&&typeof i.vpTextColor=="function"?{color:i.vpTextColor(W)}:{},ie=V?.speakerTimestamp||V?.timestamp||V?.createdAt||V?.message?.timestamp||V?.message?.createdAt||0,Te="",We="";if(ie)try{let he=new Date(ie);Number.isNaN(he.getTime())||(Te=he.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),We=he.toLocaleString())}catch{}return{name:de,style:ye,timeText:Te,fullTimeText:We}},S=k=>{let V=Array.isArray(k?.items)?k.items:[];for(let W=V.length-1;W>=0;W-=1)if(hs(V[W]))return V[W];return null},v=(k,V)=>!k?.responseCollapsible||!V?!1:S(k)===V,g=k=>!!(k?.responseCollapsible&&!Js(k).some(V=>v(k,V))),b=k=>{let V=k?.responseCollapseKey;V&&(d[V]=!k.responseCollapsed)},D=k=>{let V=Number(k?.responseCount||0),W=k?.responseCollapsed?"message.showResponses":"message.hideResponses",de=(typeof r=="function"?r(W):"")||(k?.responseCollapsed?"Show {count} response(s)":"Hide response(s)");return String(de).replace("{count}",String(V))},L=(()=>{try{return window.Pinia?.useSessionsStore?.()||null}catch{return null}}),U=Vue.computed(()=>{if(s.currentView!=="yeaft")return null;let k=L();if(!k)return null;let V=s.yeaftActiveSessionFilter||null;return V&&typeof k.sessionById=="function"&&k.sessionById(V,s.currentAgent||null)?V:k.activeSessionId&&typeof k.sessionById=="function"&&k.sessionById(k.activeSessionId,s.currentAgent||null)?k.activeSessionId:null}),F=Vue.computed(()=>U.value!==null),_=Vue.computed(()=>s.agents.filter(k=>k.online)),P=Vue.ref(null),T=Vue.ref(null),C=Vue.ref(!1),M=Vue.ref(""),E=null,R=0,H=n.token||"",G=()=>{P.value=null,T.value=null,M.value="",E=null,R+=1},ue=Un(),J=zn(),ve=Vue.computed(()=>jn({profile:P.value,agentSecret:T.value,serverWsUrl:Ks(location)})),ae=()=>{let k={"Content-Type":"application/json"};return n.token&&(k.Authorization=`Bearer ${n.token}`),k},$=async()=>{if(_.value.length>0||s.currentConversation)return;if(T.value||E)return E;C.value=!0,M.value="";let k=++R;return E=(async()=>{let V=n.token||"",W=ae(),[de,ye]=await Promise.all([fetch("/api/user/profile",{headers:W}),fetch("/api/user/agent-secret",{headers:W})]),ie=de.ok?await de.json():null;if(k!==R||V!==(n.token||""))return;if(ie&&(P.value=ie),!ye.ok){let he="";try{he=(await ye.json())?.error||""}catch{}throw new Error(he||"Failed to load Agent secret")}let Te=await ye.json();if(k!==R||V!==(n.token||""))return;let We=Te?.agentSecret||Te?.agent_secret||null;T.value=We&&String(We).trim()?String(We):null})().catch(V=>{k===R&&(M.value=V?.message||"Failed to load Agent secret")}).finally(()=>{k===R&&(C.value=!1,E=null)}),E},w=async k=>{if(k)try{await navigator.clipboard.writeText(k)}catch{}},B=(k,V)=>{let W=k?.message||null,de=k?.id||k?.atMessageId||W?.id||W?.messageId||`legacy_${V}`,ye=k?.speakerVpId||k?.vpId||W?.speakerVpId||W?.vpId||"";return{id:`message_${ye||"user"}_${de}_${V}`,vpId:ye,messageId:de}},X=Vue.computed(()=>{let k=s.messages,V=[],W=null,de=0,ye=()=>{if(W){let he=!!(W.textContent||W.todoMsg||W.askMsg||W.imageMsgs.length>0),oe=W.toolMsgs.length>0||W.toolSummaryCount>0;(he||oe)&&(W.showSpeakerHeader=!!W.speakerVpId,V.push(W)),W=null}},ie=he=>{if(W){if(!W.speakerVpId){let oe=he.speakerVpId||he.vpId;oe&&(W.speakerVpId=oe,W.speakerTimestamp=typeof he.timestamp=="number"&&he.timestamp>0?he.timestamp:typeof he.createdAt=="number"?he.createdAt:0,typeof he.lastStateChangeCause=="string"&&!W.speakerStateCause&&(W.speakerStateCause=he.lastStateChangeCause))}!W.turnId&&he.turnId&&(W.turnId=he.turnId)}},Te=()=>{de++,W={type:"assistant-turn",id:"turn_"+de,textContent:"",isStreaming:!1,isHistory:!1,todoMsg:null,toolMsgs:[],toolSummaryCount:0,imageMsgs:[],askMsg:null,messages:[],atMessageId:null,speakerVpId:null,speakerTimestamp:0,speakerStateCause:"",showSpeakerHeader:!1,turnId:null}},We=he=>{pd(W,he)&&ye()};for(let he=0;he<k.length;he++){let oe=k[he];if(oe.type==="user"){if(!oe.content||!oe.content.trim())continue;ye(),V.push({type:"user",id:oe.id||"u_"+he,message:oe});continue}if(oe.type==="system"||oe.type==="error"){ye(),V.push({type:oe.type,id:oe.id||"s_"+he,message:oe});continue}if(!(oe.type==="tool-result"||oe.type==="tool_result")){if(oe.type==="tool-summary"){We(oe),W||Te(),ie(oe),oe.isHistory&&(W.isHistory=!0),W.toolSummaryCount+=Number(oe.count||oe.omittedCount||0)||0,W.messages.push(oe);continue}if(oe.type==="assistant"){We(oe),W||Te(),oe.content&&(W.textContent+=oe.content),oe.isStreaming&&(W.isStreaming=!0),oe.isHistory&&(W.isHistory=!0),oe.id&&/^m\d+$/.test(oe.id)&&(W.atMessageId=oe.id),ie(oe),W.messages.push(oe);continue}if(oe.type==="tool-use"){We(oe),W||Te(),ie(oe);let wn=k[he+1],$o=wn&&(wn.type==="tool-result"||wn.type==="tool_result"),I={...oe,hasResult:$o||oe.hasResult||!1,toolResult:oe.toolResult||null};oe.isHistory&&(W.isHistory=!0),oe.toolName==="TodoWrite"?W.todoMsg=I:oe.toolName==="AskUserQuestion"?W.askMsg=I:W.toolMsgs.push(I),W.messages.push(oe);continue}if(oe.type==="chat-image"){We(oe),W||Te(),ie(oe),oe.isHistory&&(W.isHistory=!0),W.imageMsgs.push(oe),W.messages.push(oe);continue}ye(),V.push({type:oe.type||"unknown",id:oe.id||"x_"+he,message:oe})}}return ye(),V}),re=Vue.computed(()=>{let k=[],V=null,W=()=>{V&&k.push(V),V=null};return X.value.forEach((de,ye)=>{if(!de||de.type==="system"||de.type==="error"){W(),k.push(de);return}let ie=B(de,ye);if(de.type==="user"||!V){W(),V={type:"message-block",id:`turn_${ie.messageId}_${ye}`,vpId:ie.vpId,messageId:ie.messageId,items:[de]};return}V.items.push(de),!V.vpId&&ie.vpId&&(V.vpId=ie.vpId)}),W(),vd(k,d)}),ke=Vue.computed(()=>{let k=s.yeaftReflectionCards||{},V=s.yeaftConversationId,W={__orphans:[]},de=Object.values(k).filter(ie=>ie&&ie.conversationId===V).sort((ie,Te)=>(ie.anchorOrder||0)-(Te.anchorOrder||0)||(ie.updatedAt||0)-(Te.updatedAt||0)),ye=new Set;for(let ie of s.messages||[])ie&&ie.id&&ye.add(ie.id);for(let ie of de)ie.anchorMsgId&&ye.has(ie.anchorMsgId)?(W[ie.anchorMsgId]||(W[ie.anchorMsgId]=[]),W[ie.anchorMsgId].push(ie)):W.__orphans.push(ie);return W}),Pe=k=>k?k.type==="assistant-turn"?k.atMessageId||null:k.message&&k.message.id||null:null,De=k=>{let V=Pe(k);return V?(ke.value||{})[V]||[]:[]},ne=Vue.computed(()=>(ke.value||{}).__orphans||[]),Q=Vue.computed(()=>{let k=s.yeaftSubAgentCards||{},V=s.yeaftConversationId,W={__orphans:[]},de=Object.values(k).filter(ie=>ie&&ie.conversationId===V).sort((ie,Te)=>(ie.anchorOrder||0)-(Te.anchorOrder||0)||(ie.updatedAt||0)-(Te.updatedAt||0)),ye=new Set;for(let ie of s.messages||[])ie&&ie.id&&ye.add(ie.id);for(let ie of de)ie.anchorMsgId&&ye.has(ie.anchorMsgId)?(W[ie.anchorMsgId]||(W[ie.anchorMsgId]=[]),W[ie.anchorMsgId].push(ie)):W.__orphans.push(ie);return W}),q=k=>{let V=Pe(k);return V?(Q.value||{})[V]||[]:[]},te=Vue.computed(()=>(Q.value||{}).__orphans||[]),se=Vue.ref(!0),be=Vue.ref(!1),j=Tt.bottomThreshold,ee=100,me=!0,ge=Vue.computed(()=>s.messages.some(k=>k.isStreaming)),Ee=Vue.computed(()=>!s.currentConversation||re.value.length>0?!1:s.currentView==="yeaft"?!!s.yeaftLoadingMoreHistory:!!s.sessionLoading),Oe=Vue.computed(()=>s.sessionLoadingText||""),He=Vue.computed(()=>!!s.sessionLoading&&!Ee.value),O=Vue.computed(()=>s.isProcessing&&!ge.value),Z=Vue.ref(Date.now()),pe=null,ce=()=>{pe||(pe=setInterval(()=>{Z.value=Date.now()},1e3))},fe=()=>{pe&&(clearInterval(pe),pe=null)};Vue.watch(ge,k=>{k?(Z.value=Date.now(),ce()):fe()},{immediate:!0}),Vue.onBeforeUnmount(()=>fe());let Se=Vue.ref(0),Re=Vue.ref(Date.now()),Ke=null,_e=null,dt=Vue.ref("cat"),Dt=new URLSearchParams(window.location.search).get("preview"),gt=Vue.ref(0),mt=Vue.ref(1),Ne=Vue.ref(5),Be=Vue.ref(95),Le=Vue.ref("bark-both"),Ue=Vue.ref(1),ze=Vue.ref(-1),rt=null;function Is(){if(!Se.value)return;Re.value=Date.now();let k=(Re.value-Se.value)%19e3;if(k<4e3)gt.value=0,mt.value=1;else if(k<11500){let V=k-4e3,W;V<2500?W=V/2500*16:V<5e3?W=16+(V-2500)/2500*29:W=45+(V-5e3)/2500*55,gt.value=W,mt.value=1}else k<14e3?(gt.value=(1-(k-11500)/2500)*100,mt.value=-1):(gt.value=0,mt.value=1);_e=requestAnimationFrame(Is)}function As(){if(!Se.value||dt.value!=="dog")return;Re.value=Date.now();let k=(Re.value-Se.value)%18e3;if(k<2e3)Ne.value=5,Be.value=95,Le.value="bark-both",Ue.value=1,ze.value=-1;else if(k<5e3){let V=(k-2e3)/3e3;Ne.value=5+V*25,Be.value=95,Le.value="left-approach",Ue.value=1,ze.value=-1}else if(k<8e3){let V=(k-5e3)/3e3;Ne.value=30,Be.value=95-V*25,Le.value="right-approach",Ue.value=1,ze.value=-1}else if(k<1e4){let V=(k-8e3)/2e3;Ne.value=30+V*13,Be.value=70-V*13,Le.value="both-approach",Ue.value=1,ze.value=-1}else if(k<11e3)Ne.value=43,Be.value=57,Le.value="snap",Ue.value=1,ze.value=-1;else if(k<12500)Ne.value=43,Be.value=57,Le.value="stunned",Ue.value=1,ze.value=-1;else if(k<15e3){let V=(k-12500)/2500;Ne.value=43-V*38,Be.value=57+V*38,Le.value="retreat",Ue.value=-1,ze.value=1}else k<17e3?(Ne.value=5,Be.value=95,Le.value="rehang",Ue.value=-1,ze.value=1):(Ne.value=5,Be.value=95,Le.value="reset",Ue.value=1,ze.value=-1);rt=requestAnimationFrame(As)}let Ei=Vue.computed(()=>{let k=Ne.value*1.2;return Ue.value<0?`translate(${k+13.5}, 0) scale(-1, 1)`:`translate(${k-13.5}, 0)`}),_i=Vue.computed(()=>{let k=Be.value*1.2;return ze.value>0?`translate(${k-10.5}, 2)`:`translate(${k+10.5}, 2) scale(-1, 1)`}),qe=Vue.computed(()=>{let k=Le.value;return k==="bark-both"||k==="left-approach"||k==="right-approach"||k==="both-approach"||k==="reset"}),Ri=Vue.computed(()=>{let k=Ne.value*1.2,V=10;if(qe.value){let ye=Math.max(0,(k-3)*.12);return`M3,18 Q${(3+k)/2},${18+ye} ${k},${V}`}if(Le.value==="rehang")return`M${k},${V} Q${k-3},20 3,18`;let W=Ue.value<0?1:-1,de=k+W*8;return`M${k},${V} Q${k},18 ${de},22`}),Je=Vue.computed(()=>{let k=Be.value*1.2,V=10;if(qe.value){let ye=Math.max(0,(118-k)*.12);return`M118,18 Q${(118+k)/2},${18+ye} ${k},${V}`}if(Le.value==="rehang")return`M${k},${V} Q${k+3},20 118,18`;let W=ze.value>0?-1:1,de=k+W*8;return`M${k},${V} Q${k},18 ${de},22`}),cn=Vue.computed(()=>Le.value==="snap"?.2:.4),Li=Vue.computed(()=>Le.value==="snap"?.2:.4),$i=Vue.computed(()=>Ne.value*1.2),Kt=Vue.computed(()=>Be.value*1.2),Yt=Dt==="cat"||Dt==="dog"||Dt==="animation",xs=600,Gt=Vue.ref(!1),Ye=null,dn=Vue.computed(()=>Yt?!0:Gt.value);Vue.watch(O,k=>{if(k)Ye&&(clearTimeout(Ye),Ye=null),Gt.value=!0,Se.value=Date.now(),Re.value=Date.now(),dt.value="cat",gt.value=0,mt.value=1,Ne.value=5,Be.value=95,Le.value="bark-both",Ue.value=1,ze.value=-1,dt.value==="cat"?_e=requestAnimationFrame(Is):rt=requestAnimationFrame(As);else{let V=Se.value?Date.now()-Se.value:xs,W=Math.max(0,xs-V),de=()=>{Ye=null,Gt.value=!1,Se.value=0,gt.value=0,mt.value=1,_e&&(cancelAnimationFrame(_e),_e=null),rt&&(cancelAnimationFrame(rt),rt=null)};W===0?de():(Ye&&clearTimeout(Ye),Ye=setTimeout(de,W))}},{immediate:!0}),Yt&&(Se.value=Date.now(),Re.value=Date.now(),Dt==="dog"?dt.value="dog":dt.value="cat",dt.value==="cat"?_e=requestAnimationFrame(Is):(Ne.value=5,Be.value=95,Le.value="bark-both",Ue.value=1,ze.value=-1,rt=requestAnimationFrame(As)));let Vi=Vue.computed(()=>{if(!s.isProcessing)return null;if(s.connectionState!=="connected")return"disconnected";let k=s.currentConversation;if(s.compactStatus?.conversationId===k&&s.compactStatus?.status==="compacting")return"compacting";let V=s.sessionHealth?.[k];return V?V.status:Se.value&&Re.value-Se.value>8e3?"thinking":null}),Fi=Vue.computed(()=>{if(!Se.value)return"speed-napping";let k=(Re.value-Se.value)%19e3;return k>=16e3?"speed-petted":k>=14e3?"speed-tired":k>=11500?"speed-crazy":k>=9e3?"speed-turbo":k>=6500?"speed-fast":k>=4e3?"speed-normal":"speed-napping"}),Oi=Vue.computed(()=>{let k=gt.value,V=mt.value,de={left:`calc(40px + (100% - 80px) * ${k/100})`};return V<0&&(de.transform="scaleX(-1)"),de});function Qt(){let k=s.currentConversation;if(!k)return;let V=s.conversations.find(W=>W.id===k);s.sendWsMessage({type:"refresh_conversation",conversationId:k,agentId:V?.agentId})}let Hi=()=>{if(!o.value)return!0;let{scrollTop:k,scrollHeight:V,clientHeight:W}=o.value;return ms({scrollTop:k,scrollHeight:V,clientHeight:W,threshold:j})},Ts=(k,{allowContinuation:V=!1}={})=>{if(k>ee){me=!0;return}V&&(me=!0),!(!me||!gn())&&(me=!1,mn())},Ms=k=>{if(!k)return"";let W=(Array.isArray(k.items)?k.items:[])[0]||null;return[k.type||"",k.messageId||"",k.turnId||"",k.vpId||"",W?.id||"",W?.turnId||"",W?.messageId||""].join(":")},un=()=>{let k=re.value||[];return{blockCount:k.length,firstBlockIdentity:Ms(k[0])}},pn=(k,V)=>!k||!V?!1:V.blockCount>k.blockCount||V.firstBlockIdentity!==k.firstBlockIdentity,fn=k=>{Vue.nextTick(()=>{if(!o.value)return;let V=un();pn(k,V)&&Ts(o.value.scrollTop||0,{allowContinuation:!0})})},Ni=({scrollTop:k,scrollHeight:V,clientHeight:W})=>{let de=ms({scrollTop:k,scrollHeight:V,clientHeight:W,threshold:j});return se.value=de,be.value=!de,de},Xt=()=>{be.value=!1,se.value=!0},Bi=({scrollTop:k,scrollHeight:V,clientHeight:W})=>{let de=ms({scrollTop:k||0,scrollHeight:V||0,clientHeight:W||0,threshold:j});se.value=Xr({following:!be.value,atBottom:de}),be.value=!se.value,Ts(k||0)},qi=(k,V)=>{let W=un();if(!o.value){k(),fn(W);return}let de=o.value.scrollHeight,ye=o.value.scrollTop,ie=!1,Te=null,We=()=>{ie||(ie=!0,Te&&Te(),Vue.nextTick(()=>{if(!o.value)return;let he=o.value.scrollHeight;o.value.scrollTop=he-de+ye,fn(W)}))};V&&(Te=Vue.watch(V,he=>{he||We()})),k(),Vue.nextTick(()=>{(!V||!V())&&We()})},Wi=()=>{if(s.hasHiddenYeaftMessages){s.expandYeaftMessageWindow();return}s.loadMoreYeaftHistory()},gn=()=>s.currentView==="yeaft"?s.hasHiddenYeaftMessages||s.yeaftHasMoreHistory&&!s.yeaftLoadingMoreHistory&&s.yeaftOldestLoadedSeq!=null:!!s.currentConversation&&s.hasMoreMessages&&!s.loadingMoreMessages,mn=()=>{if(!gn())return;let k=s.currentView==="yeaft";qi(k?Wi:()=>s.loadMoreMessages(),k?()=>s.yeaftLoadingMoreHistory:()=>s.loadingMoreMessages)},Et=!1,Ps=!1,je=null,_t=250,hn=()=>{Et=!1,je&&(clearTimeout(je),je=null)},Ds=()=>{Ps||(je&&clearTimeout(je),je=setTimeout(hn,_t))},Rt=()=>{Et=!0,Ds()},vn=k=>{ld(k,o.value)&&(Ps=!0,Et=!0,je&&(clearTimeout(je),je=null))},Ct=()=>{Ps=!1,Ds()},yn=k=>{cd(k,o.value)&&Rt()},bn=()=>{se.value=Xr({following:!be.value,atBottom:Hi(),userScroll:Et}),be.value=!se.value,se.value&&Es(),Et&&Ds(),o.value&&Ts(o.value.scrollTop||0)},Es=()=>{s.currentView==="yeaft"&&s.pruneYeaftMessageWindow()},Zt=()=>{o.value&&(o.value.scrollTop=o.value.scrollHeight,Xt(),Es())},Ui=()=>{Xt(),Vue.nextTick(Zt)},Jt=()=>{!be.value&&se.value&&(Es(),Vue.nextTick(Zt))},es=k=>{if(!k)return"";if(Array.isArray(k.items))return k.items.map(es).join(",");let V=k.message||{};return[k.type||"",k.id||"",k.atMessageId||"",k.turnId||"",k.messageId||"",k.speakerVpId||"",V.id||"",V.content?String(V.content).length:0,k.textContent?String(k.textContent).length:0,k.isStreaming||V.isStreaming?"streaming":"done"].join(":")},_s=Vue.computed(()=>{let k=re.value||[];return[s.activeConversationId||"",U.value||"",k.length,es(k[k.length-1])].join("|")});Vue.watch(()=>[s.currentConversation,_.value.length,n.token],()=>{let k=n.token||"";k!==H&&(H=k,G()),$()},{immediate:!0}),Vue.watch(_s,Jt),Vue.watch(dn,k=>{k&&Jt()}),Vue.watch(()=>[s.activeConversationId,U.value],()=>{for(let k of Object.keys(l))delete l[k];for(let k of Object.keys(c))delete c[k];for(let k of Object.keys(d))delete d[k];Xt(),Vue.nextTick(Zt)});let ts=Vue.ref(null),ss=0;return t({revealMessage:async k=>k?await wd({blocks:re.value,messageId:k,collapseStates:d,nextTick:Vue.nextTick,scrollToBlock:W=>(Xt(),be.value=!0,se.value=!1,a.value?.scrollToKey?.(W,{align:"center"})),findRow:W=>{let de=o.value?.querySelectorAll?.("[data-msg-id]")||[];return Array.from(de).find(ye=>ye?.dataset?.msgId===W)||null},flashRow:W=>{let de=++ss;ts.value=W,setTimeout(()=>{de===ss&&(ts.value=null)},1800)}}):!1}),Vue.onMounted(()=>{Zt(),o.value&&(o.value.addEventListener("wheel",Rt,{passive:!0}),o.value.addEventListener("touchmove",Rt,{passive:!0}),o.value.addEventListener("pointerdown",vn,{passive:!0}),o.value.addEventListener("scroll",bn)),window.addEventListener("pointerup",Ct,{passive:!0}),window.addEventListener("pointercancel",Ct,{passive:!0}),window.addEventListener("keydown",yn)}),Vue.onUnmounted(()=>{o.value&&(o.value.removeEventListener("wheel",Rt),o.value.removeEventListener("touchmove",Rt),o.value.removeEventListener("pointerdown",vn),o.value.removeEventListener("scroll",bn)),window.removeEventListener("pointerup",Ct),window.removeEventListener("pointercancel",Ct),window.removeEventListener("keydown",yn),hn(),Ke&&(clearInterval(Ke),Ke=null),Ye&&(clearTimeout(Ye),Ye=null),_e&&(cancelAnimationFrame(_e),_e=null),rt&&(cancelAnimationFrame(rt),rt=null)}),{store:s,containerRef:o,virtualTranscriptRef:a,flashMsgId:ts,hasStreamingMessage:ge,nowMs:Z,showTypingDots:O,showInitialMessagesLoading:Ee,showSessionLoadingOverlay:He,initialMessagesLoadingText:Oe,previewShowTypingDots:dn,isPreviewMode:Yt,waitingStatus:Vi,animationType:dt,catSpeed:Fi,catStyle:Oi,dogPhase:Le,spikeTransform:Ei,teddyTransform:_i,leashPathL:Ri,leashPathR:Je,leashOpacityL:cn,leashOpacityR:Li,questionLX:$i,questionRX:Kt,refreshSession:Qt,onlineAgents:_,welcomeInstallCommand:ue,welcomeLlmCommand:J,welcomeServiceCommand:ve,welcomeSetupLoading:C,welcomeSetupError:M,copyWelcomeCommand:w,turnGroups:X,messageBlocks:re,estimateMessageBlockHeight:y,visibleItemsForBlock:h,collapsedResponsePreviewLines:A,collapsedResponsePreviewSpeaker:x,responseToggleBelongsToItem:v,showBlockResponseToggle:g,toggleMessageTurnResponse:b,responseCollapseLabel:D,turnUiKey:u,assistantTurnActionsExpandedFor:f,setAssistantTurnActionsExpanded:p,toolExpandStates:c,setToolExpanded:m,cardsForRow:De,orphanCards:ne,subAgentCardsForRow:q,orphanSubAgentCards:te,useImStyleForUser:F,onClickLoadMore:mn,onVirtualTranscriptScrollState:Bi,isAtBottom:se,scrollToLatest:Ui}}}});function ii(...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 Ad(e,t,s){let n=t?e?.slashCommandsMap?.[t]:null;return e?.currentView==="yeaft"?ii(n):ii(n,s?e?.slashCommandsMap?.[`agent:${s}`]:null,e?.slashCommandsMap?.__preload__)}function dm(e,t={},s=new Set){if(cm.has(e)||Object.prototype.hasOwnProperty.call(ni,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 xd(e,t={}){if(si[e])return si[e];if(ni[e])return ni[e];let s=e.startsWith("/")?e.slice(1):e;return t[s]?t[s]:um(s)}function um(e){return(e.includes(":")?e.split(":").pop():e).replace(/-/g," ").replace(/^\w/,s=>s.toUpperCase())}function Td(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=dm(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)=>(Sd[o]??99)-(Sd[a]??99));return r.map((o,a)=>({label:pm[o]||o,items:i[o],isLast:a===r.length-1}))}var si,cm,Cd,ni,Id,pm,Sd,Md=N(()=>{si={"/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"},cm=new Set(Object.keys(si)),Cd=Object.keys(si),ni={"/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"},Id=Object.keys(ni);pm={skill:"Skills",builtin:"Built-in",project:"Commands"},Sd={skill:0,project:1,builtin:2}});function hm(e){return!(!e||typeof e!="string"||e.length<1||e.length>40||e.startsWith("_")||gm.test(e)||fm.has(e.toLowerCase()))}function ri(e){if(!e||typeof e!="string")return{text:e||"",mentions:[]};let t=new Set;Pd.lastIndex=0;let s;for(;(s=Pd.exec(e))!==null;){let n=s[2];if(hm(n)&&!t.has(n)&&(t.add(n),t.size>=mm))break}return{text:e,mentions:Array.from(t)}}var fm,Pd,gm,mm,so=N(()=>{fm=new Set(["all","user","system","everyone"]),Pd=/(^|[\s\p{P}])@([A-Za-z0-9_-]{1,40})(?=$|[\s\p{P}])/gu,gm=/^[0-9]+$/,mm=32});function Dd(e){let t=typeof e?.vpId=="string"?e.vpId:"";return no.has(t)?no.get(t):e?.isStock===!0?"other":"custom"}function qt(e){let t=new Map(oi.map(s=>[s.id,[]]));for(let s of Array.isArray(e)?e:[])!s||typeof s.vpId!="string"||!s.vpId||t.get(Dd(s)).push(s);return oi.map(s=>({id:s.id,labelKey:s.labelKey,vps:t.get(s.id)})).filter(s=>s.vps.length>0)}function en(e){return qt(e).flatMap(t=>t.vps)}function Ed(e){let t=new Map(oi.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=Dd(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 vm,oi,no,tn=N(()=>{vm=[{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:[]}],oi=Object.freeze(vm.map(e=>Object.freeze({id:e.id,labelKey:e.labelKey,vpIds:Object.freeze([...e.vpIds])}))),no=new Map;for(let e of oi)for(let t of e.vpIds)no.set(t,e.id)});function io(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 en(c).slice(0,_d)}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:[],f=!1;for(let S of u){let v=String(S||"").toLowerCase();if(v&&v.startsWith(n)){f=!0;break}}if(f){l(c,r);continue}let p=String(c.displayName||"").toLowerCase(),m=String(c.displayNameZh||""),y=[c.description,c.descriptionZh,c.role,c.roleZh].map(S=>String(S||"").toLowerCase()),h=typeof t=="string"?t:"",A=p.includes(n)||h&&m.includes(h),x=n&&y.some(S=>S.includes(n));(A||x)&&l(c,o)}return[...en(i),...en(r),...en(o)].slice(0,_d)}function ro(e="chat-input"){return`${e}-vp-mention-listbox`}function oo(e,t){let s=String(t||"").replace(/[^A-Za-z0-9_.:-]/g,"-");return`${e}-vp-mention-option-${s}`}function ym(e){let t=0;return Ed(e).map(s=>({...s,items:s.vps.map(n=>({vp:n,flatIndex:t++}))}))}function Rd(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 Ld(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 _d,$d,Vd=N(()=>{tn();_d=12;$d={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:`
|
|
1587
|
+
`,emits:["new-conversation","resume-conversation","open-settings"],setup(e,{expose:t}){let s=Pinia.useChatStore(),n=Ie(),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=k=>String(k?.id||k?.turnId||k?.messageId||k?.atMessageId||k?.message?.id||"turn_unknown"),f=k=>{let V=u(k);return Object.prototype.hasOwnProperty.call(l,V)?!!l[V]:!1},p=(k,V)=>{l[u(k)]=!!V},m=({key:k,value:V}={})=>{k&&(c[k]=!!V)},y=k=>{let V=yd(k,xt);return Number.isFinite(V)?V:xt(k)},h=k=>Js(k),A=k=>{let V=Array.isArray(k?.collapsedResponsePreview)?k.collapsedResponsePreview:eo(k);return Array.isArray(V)?V:V?[String(V)]:[]},x=k=>{let V=Array.isArray(k?.items)?k.items.find(he=>hs(he)):null,W=V?.speakerVpId||V?.vpId||V?.message?.speakerVpId||V?.message?.vpId||k?.vpId||"",de=W&&i&&typeof i.vpLabel=="function"?i.vpLabel(W)||W:W||(typeof r=="function"?r("message.assistant"):"Assistant"),ye=W&&i&&typeof i.vpTextColor=="function"?{color:i.vpTextColor(W)}:{},ie=V?.speakerTimestamp||V?.timestamp||V?.createdAt||V?.message?.timestamp||V?.message?.createdAt||0,Te="",We="";if(ie)try{let he=new Date(ie);Number.isNaN(he.getTime())||(Te=he.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),We=he.toLocaleString())}catch{}return{name:de,style:ye,timeText:Te,fullTimeText:We}},S=k=>{let V=Array.isArray(k?.items)?k.items:[];for(let W=V.length-1;W>=0;W-=1)if(hs(V[W]))return V[W];return null},v=(k,V)=>!k?.responseCollapsible||!V?!1:S(k)===V,g=k=>!!(k?.responseCollapsible&&!Js(k).some(V=>v(k,V))),b=k=>{let V=k?.responseCollapseKey;V&&(d[V]=!k.responseCollapsed)},D=k=>{let V=Number(k?.responseCount||0),W=k?.responseCollapsed?"message.showResponses":"message.hideResponses",de=(typeof r=="function"?r(W):"")||(k?.responseCollapsed?"Show {count} response(s)":"Hide response(s)");return String(de).replace("{count}",String(V))},L=(()=>{try{return window.Pinia?.useSessionsStore?.()||null}catch{return null}}),U=Vue.computed(()=>{if(s.currentView!=="yeaft")return null;let k=L();if(!k)return null;let V=s.yeaftActiveSessionFilter||null;return V&&typeof k.sessionById=="function"&&k.sessionById(V,s.currentAgent||null)?V:k.activeSessionId&&typeof k.sessionById=="function"&&k.sessionById(k.activeSessionId,s.currentAgent||null)?k.activeSessionId:null}),O=Vue.computed(()=>U.value!==null),_=Vue.computed(()=>s.agents.filter(k=>k.online)),P=Vue.ref(null),T=Vue.ref(null),C=Vue.ref(!1),M=Vue.ref(""),E=null,R=0,H=n.token||"",G=()=>{P.value=null,T.value=null,M.value="",E=null,R+=1},ue=Un(),J=zn(),ve=Vue.computed(()=>jn({profile:P.value,agentSecret:T.value,serverWsUrl:Ks(location)})),ae=()=>{let k={"Content-Type":"application/json"};return n.token&&(k.Authorization=`Bearer ${n.token}`),k},$=async()=>{if(_.value.length>0||s.currentConversation)return;if(T.value||E)return E;C.value=!0,M.value="";let k=++R;return E=(async()=>{let V=n.token||"",W=ae(),[de,ye]=await Promise.all([fetch("/api/user/profile",{headers:W}),fetch("/api/user/agent-secret",{headers:W})]),ie=de.ok?await de.json():null;if(k!==R||V!==(n.token||""))return;if(ie&&(P.value=ie),!ye.ok){let he="";try{he=(await ye.json())?.error||""}catch{}throw new Error(he||"Failed to load Agent secret")}let Te=await ye.json();if(k!==R||V!==(n.token||""))return;let We=Te?.agentSecret||Te?.agent_secret||null;T.value=We&&String(We).trim()?String(We):null})().catch(V=>{k===R&&(M.value=V?.message||"Failed to load Agent secret")}).finally(()=>{k===R&&(C.value=!1,E=null)}),E},w=async k=>{if(k)try{await navigator.clipboard.writeText(k)}catch{}},B=(k,V)=>{let W=k?.message||null,de=k?.id||k?.atMessageId||W?.id||W?.messageId||`legacy_${V}`,ye=k?.speakerVpId||k?.vpId||W?.speakerVpId||W?.vpId||"";return{id:`message_${ye||"user"}_${de}_${V}`,vpId:ye,messageId:de}},X=Vue.computed(()=>{let k=s.messages,V=[],W=null,de=0,ye=()=>{if(W){let he=!!(W.textContent||W.todoMsg||W.askMsg||W.imageMsgs.length>0),oe=W.toolMsgs.length>0||W.toolSummaryCount>0;(he||oe)&&(W.showSpeakerHeader=!!W.speakerVpId,V.push(W)),W=null}},ie=he=>{if(W){if(!W.speakerVpId){let oe=he.speakerVpId||he.vpId;oe&&(W.speakerVpId=oe,W.speakerTimestamp=typeof he.timestamp=="number"&&he.timestamp>0?he.timestamp:typeof he.createdAt=="number"?he.createdAt:0,typeof he.lastStateChangeCause=="string"&&!W.speakerStateCause&&(W.speakerStateCause=he.lastStateChangeCause))}!W.turnId&&he.turnId&&(W.turnId=he.turnId)}},Te=()=>{de++,W={type:"assistant-turn",id:"turn_"+de,textContent:"",isStreaming:!1,isHistory:!1,todoMsg:null,toolMsgs:[],toolSummaryCount:0,imageMsgs:[],askMsg:null,messages:[],atMessageId:null,speakerVpId:null,speakerTimestamp:0,speakerStateCause:"",showSpeakerHeader:!1,turnId:null}},We=he=>{pd(W,he)&&ye()};for(let he=0;he<k.length;he++){let oe=k[he];if(oe.type==="user"){if(!oe.content||!oe.content.trim())continue;ye(),V.push({type:"user",id:oe.id||"u_"+he,message:oe});continue}if(oe.type==="system"||oe.type==="error"){ye(),V.push({type:oe.type,id:oe.id||"s_"+he,message:oe});continue}if(!(oe.type==="tool-result"||oe.type==="tool_result")){if(oe.type==="tool-summary"){We(oe),W||Te(),ie(oe),oe.isHistory&&(W.isHistory=!0),W.toolSummaryCount+=Number(oe.count||oe.omittedCount||0)||0,W.messages.push(oe);continue}if(oe.type==="assistant"){We(oe),W||Te(),oe.content&&(W.textContent+=oe.content),oe.isStreaming&&(W.isStreaming=!0),oe.isHistory&&(W.isHistory=!0),oe.id&&/^m\d+$/.test(oe.id)&&(W.atMessageId=oe.id),ie(oe),W.messages.push(oe);continue}if(oe.type==="tool-use"){We(oe),W||Te(),ie(oe);let wn=k[he+1],$o=wn&&(wn.type==="tool-result"||wn.type==="tool_result"),I={...oe,hasResult:$o||oe.hasResult||!1,toolResult:oe.toolResult||null};oe.isHistory&&(W.isHistory=!0),oe.toolName==="TodoWrite"?W.todoMsg=I:oe.toolName==="AskUserQuestion"?W.askMsg=I:W.toolMsgs.push(I),W.messages.push(oe);continue}if(oe.type==="chat-image"){We(oe),W||Te(),ie(oe),oe.isHistory&&(W.isHistory=!0),W.imageMsgs.push(oe),W.messages.push(oe);continue}ye(),V.push({type:oe.type||"unknown",id:oe.id||"x_"+he,message:oe})}}return ye(),V}),re=Vue.computed(()=>{let k=[],V=null,W=()=>{V&&k.push(V),V=null};return X.value.forEach((de,ye)=>{if(!de||de.type==="system"||de.type==="error"){W(),k.push(de);return}let ie=B(de,ye);if(de.type==="user"||!V){W(),V={type:"message-block",id:`turn_${ie.messageId}_${ye}`,vpId:ie.vpId,messageId:ie.messageId,items:[de]};return}V.items.push(de),!V.vpId&&ie.vpId&&(V.vpId=ie.vpId)}),W(),vd(k,d)}),ke=Vue.computed(()=>{let k=s.yeaftReflectionCards||{},V=s.yeaftConversationId,W={__orphans:[]},de=Object.values(k).filter(ie=>ie&&ie.conversationId===V).sort((ie,Te)=>(ie.anchorOrder||0)-(Te.anchorOrder||0)||(ie.updatedAt||0)-(Te.updatedAt||0)),ye=new Set;for(let ie of s.messages||[])ie&&ie.id&&ye.add(ie.id);for(let ie of de)ie.anchorMsgId&&ye.has(ie.anchorMsgId)?(W[ie.anchorMsgId]||(W[ie.anchorMsgId]=[]),W[ie.anchorMsgId].push(ie)):W.__orphans.push(ie);return W}),Pe=k=>k?k.type==="assistant-turn"?k.atMessageId||null:k.message&&k.message.id||null:null,De=k=>{let V=Pe(k);return V?(ke.value||{})[V]||[]:[]},ne=Vue.computed(()=>(ke.value||{}).__orphans||[]),Q=Vue.computed(()=>{let k=s.yeaftSubAgentCards||{},V=s.yeaftConversationId,W={__orphans:[]},de=Object.values(k).filter(ie=>ie&&ie.conversationId===V).sort((ie,Te)=>(ie.anchorOrder||0)-(Te.anchorOrder||0)||(ie.updatedAt||0)-(Te.updatedAt||0)),ye=new Set;for(let ie of s.messages||[])ie&&ie.id&&ye.add(ie.id);for(let ie of de)ie.anchorMsgId&&ye.has(ie.anchorMsgId)?(W[ie.anchorMsgId]||(W[ie.anchorMsgId]=[]),W[ie.anchorMsgId].push(ie)):W.__orphans.push(ie);return W}),q=k=>{let V=Pe(k);return V?(Q.value||{})[V]||[]:[]},te=Vue.computed(()=>(Q.value||{}).__orphans||[]),se=Vue.ref(!0),be=Vue.ref(!1),j=Tt.bottomThreshold,ee=100,me=!0,ge=Vue.computed(()=>s.messages.some(k=>k.isStreaming)),Ee=Vue.computed(()=>!s.currentConversation||re.value.length>0?!1:s.currentView==="yeaft"?!!s.yeaftLoadingMoreHistory:!!s.sessionLoading),Oe=Vue.computed(()=>s.sessionLoadingText||""),He=Vue.computed(()=>!!s.sessionLoading&&!Ee.value),F=Vue.computed(()=>s.isProcessing&&!ge.value),Z=Vue.ref(Date.now()),pe=null,ce=()=>{pe||(pe=setInterval(()=>{Z.value=Date.now()},1e3))},fe=()=>{pe&&(clearInterval(pe),pe=null)};Vue.watch(ge,k=>{k?(Z.value=Date.now(),ce()):fe()},{immediate:!0}),Vue.onBeforeUnmount(()=>fe());let Se=Vue.ref(0),Re=Vue.ref(Date.now()),Ke=null,_e=null,dt=Vue.ref("cat"),Dt=new URLSearchParams(window.location.search).get("preview"),gt=Vue.ref(0),mt=Vue.ref(1),Ne=Vue.ref(5),Be=Vue.ref(95),Le=Vue.ref("bark-both"),Ue=Vue.ref(1),ze=Vue.ref(-1),rt=null;function Is(){if(!Se.value)return;Re.value=Date.now();let k=(Re.value-Se.value)%19e3;if(k<4e3)gt.value=0,mt.value=1;else if(k<11500){let V=k-4e3,W;V<2500?W=V/2500*16:V<5e3?W=16+(V-2500)/2500*29:W=45+(V-5e3)/2500*55,gt.value=W,mt.value=1}else k<14e3?(gt.value=(1-(k-11500)/2500)*100,mt.value=-1):(gt.value=0,mt.value=1);_e=requestAnimationFrame(Is)}function As(){if(!Se.value||dt.value!=="dog")return;Re.value=Date.now();let k=(Re.value-Se.value)%18e3;if(k<2e3)Ne.value=5,Be.value=95,Le.value="bark-both",Ue.value=1,ze.value=-1;else if(k<5e3){let V=(k-2e3)/3e3;Ne.value=5+V*25,Be.value=95,Le.value="left-approach",Ue.value=1,ze.value=-1}else if(k<8e3){let V=(k-5e3)/3e3;Ne.value=30,Be.value=95-V*25,Le.value="right-approach",Ue.value=1,ze.value=-1}else if(k<1e4){let V=(k-8e3)/2e3;Ne.value=30+V*13,Be.value=70-V*13,Le.value="both-approach",Ue.value=1,ze.value=-1}else if(k<11e3)Ne.value=43,Be.value=57,Le.value="snap",Ue.value=1,ze.value=-1;else if(k<12500)Ne.value=43,Be.value=57,Le.value="stunned",Ue.value=1,ze.value=-1;else if(k<15e3){let V=(k-12500)/2500;Ne.value=43-V*38,Be.value=57+V*38,Le.value="retreat",Ue.value=-1,ze.value=1}else k<17e3?(Ne.value=5,Be.value=95,Le.value="rehang",Ue.value=-1,ze.value=1):(Ne.value=5,Be.value=95,Le.value="reset",Ue.value=1,ze.value=-1);rt=requestAnimationFrame(As)}let Ei=Vue.computed(()=>{let k=Ne.value*1.2;return Ue.value<0?`translate(${k+13.5}, 0) scale(-1, 1)`:`translate(${k-13.5}, 0)`}),_i=Vue.computed(()=>{let k=Be.value*1.2;return ze.value>0?`translate(${k-10.5}, 2)`:`translate(${k+10.5}, 2) scale(-1, 1)`}),qe=Vue.computed(()=>{let k=Le.value;return k==="bark-both"||k==="left-approach"||k==="right-approach"||k==="both-approach"||k==="reset"}),Ri=Vue.computed(()=>{let k=Ne.value*1.2,V=10;if(qe.value){let ye=Math.max(0,(k-3)*.12);return`M3,18 Q${(3+k)/2},${18+ye} ${k},${V}`}if(Le.value==="rehang")return`M${k},${V} Q${k-3},20 3,18`;let W=Ue.value<0?1:-1,de=k+W*8;return`M${k},${V} Q${k},18 ${de},22`}),Je=Vue.computed(()=>{let k=Be.value*1.2,V=10;if(qe.value){let ye=Math.max(0,(118-k)*.12);return`M118,18 Q${(118+k)/2},${18+ye} ${k},${V}`}if(Le.value==="rehang")return`M${k},${V} Q${k+3},20 118,18`;let W=ze.value>0?-1:1,de=k+W*8;return`M${k},${V} Q${k},18 ${de},22`}),cn=Vue.computed(()=>Le.value==="snap"?.2:.4),Li=Vue.computed(()=>Le.value==="snap"?.2:.4),$i=Vue.computed(()=>Ne.value*1.2),Kt=Vue.computed(()=>Be.value*1.2),Yt=Dt==="cat"||Dt==="dog"||Dt==="animation",xs=600,Gt=Vue.ref(!1),Ye=null,dn=Vue.computed(()=>Yt?!0:Gt.value);Vue.watch(F,k=>{if(k)Ye&&(clearTimeout(Ye),Ye=null),Gt.value=!0,Se.value=Date.now(),Re.value=Date.now(),dt.value="cat",gt.value=0,mt.value=1,Ne.value=5,Be.value=95,Le.value="bark-both",Ue.value=1,ze.value=-1,dt.value==="cat"?_e=requestAnimationFrame(Is):rt=requestAnimationFrame(As);else{let V=Se.value?Date.now()-Se.value:xs,W=Math.max(0,xs-V),de=()=>{Ye=null,Gt.value=!1,Se.value=0,gt.value=0,mt.value=1,_e&&(cancelAnimationFrame(_e),_e=null),rt&&(cancelAnimationFrame(rt),rt=null)};W===0?de():(Ye&&clearTimeout(Ye),Ye=setTimeout(de,W))}},{immediate:!0}),Yt&&(Se.value=Date.now(),Re.value=Date.now(),Dt==="dog"?dt.value="dog":dt.value="cat",dt.value==="cat"?_e=requestAnimationFrame(Is):(Ne.value=5,Be.value=95,Le.value="bark-both",Ue.value=1,ze.value=-1,rt=requestAnimationFrame(As)));let Vi=Vue.computed(()=>{if(!s.isProcessing)return null;if(s.connectionState!=="connected")return"disconnected";let k=s.currentConversation;if(s.compactStatus?.conversationId===k&&s.compactStatus?.status==="compacting")return"compacting";let V=s.sessionHealth?.[k];return V?V.status:Se.value&&Re.value-Se.value>8e3?"thinking":null}),Fi=Vue.computed(()=>{if(!Se.value)return"speed-napping";let k=(Re.value-Se.value)%19e3;return k>=16e3?"speed-petted":k>=14e3?"speed-tired":k>=11500?"speed-crazy":k>=9e3?"speed-turbo":k>=6500?"speed-fast":k>=4e3?"speed-normal":"speed-napping"}),Oi=Vue.computed(()=>{let k=gt.value,V=mt.value,de={left:`calc(40px + (100% - 80px) * ${k/100})`};return V<0&&(de.transform="scaleX(-1)"),de});function Qt(){let k=s.currentConversation;if(!k)return;let V=s.conversations.find(W=>W.id===k);s.sendWsMessage({type:"refresh_conversation",conversationId:k,agentId:V?.agentId})}let Hi=()=>{if(!o.value)return!0;let{scrollTop:k,scrollHeight:V,clientHeight:W}=o.value;return ms({scrollTop:k,scrollHeight:V,clientHeight:W,threshold:j})},Ts=(k,{allowContinuation:V=!1}={})=>{if(k>ee){me=!0;return}V&&(me=!0),!(!me||!gn())&&(me=!1,mn())},Ms=k=>{if(!k)return"";let W=(Array.isArray(k.items)?k.items:[])[0]||null;return[k.type||"",k.messageId||"",k.turnId||"",k.vpId||"",W?.id||"",W?.turnId||"",W?.messageId||""].join(":")},un=()=>{let k=re.value||[];return{blockCount:k.length,firstBlockIdentity:Ms(k[0])}},pn=(k,V)=>!k||!V?!1:V.blockCount>k.blockCount||V.firstBlockIdentity!==k.firstBlockIdentity,fn=k=>{Vue.nextTick(()=>{if(!o.value)return;let V=un();pn(k,V)&&Ts(o.value.scrollTop||0,{allowContinuation:!0})})},Ni=({scrollTop:k,scrollHeight:V,clientHeight:W})=>{let de=ms({scrollTop:k,scrollHeight:V,clientHeight:W,threshold:j});return se.value=de,be.value=!de,de},Xt=()=>{be.value=!1,se.value=!0},Bi=({scrollTop:k,scrollHeight:V,clientHeight:W})=>{let de=ms({scrollTop:k||0,scrollHeight:V||0,clientHeight:W||0,threshold:j});se.value=Xr({following:!be.value,atBottom:de}),be.value=!se.value,Ts(k||0)},qi=(k,V)=>{let W=un();if(!o.value){k(),fn(W);return}let de=o.value.scrollHeight,ye=o.value.scrollTop,ie=!1,Te=null,We=()=>{ie||(ie=!0,Te&&Te(),Vue.nextTick(()=>{if(!o.value)return;let he=o.value.scrollHeight;o.value.scrollTop=he-de+ye,fn(W)}))};V&&(Te=Vue.watch(V,he=>{he||We()})),k(),Vue.nextTick(()=>{(!V||!V())&&We()})},Wi=()=>{if(s.hasHiddenYeaftMessages){s.expandYeaftMessageWindow();return}s.loadMoreYeaftHistory()},gn=()=>s.currentView==="yeaft"?s.hasHiddenYeaftMessages||s.yeaftHasMoreHistory&&!s.yeaftLoadingMoreHistory&&s.yeaftOldestLoadedSeq!=null:!!s.currentConversation&&s.hasMoreMessages&&!s.loadingMoreMessages,mn=()=>{if(!gn())return;let k=s.currentView==="yeaft";qi(k?Wi:()=>s.loadMoreMessages(),k?()=>s.yeaftLoadingMoreHistory:()=>s.loadingMoreMessages)},Et=!1,Ps=!1,je=null,_t=250,hn=()=>{Et=!1,je&&(clearTimeout(je),je=null)},Ds=()=>{Ps||(je&&clearTimeout(je),je=setTimeout(hn,_t))},Rt=()=>{Et=!0,Ds()},vn=k=>{ld(k,o.value)&&(Ps=!0,Et=!0,je&&(clearTimeout(je),je=null))},Ct=()=>{Ps=!1,Ds()},yn=k=>{cd(k,o.value)&&Rt()},bn=()=>{se.value=Xr({following:!be.value,atBottom:Hi(),userScroll:Et}),be.value=!se.value,se.value&&Es(),Et&&Ds(),o.value&&Ts(o.value.scrollTop||0)},Es=()=>{s.currentView==="yeaft"&&s.pruneYeaftMessageWindow()},Zt=()=>{o.value&&(o.value.scrollTop=o.value.scrollHeight,Xt(),Es())},Ui=()=>{Xt(),Vue.nextTick(Zt)},Jt=()=>{!be.value&&se.value&&(Es(),Vue.nextTick(Zt))},es=k=>{if(!k)return"";if(Array.isArray(k.items))return k.items.map(es).join(",");let V=k.message||{};return[k.type||"",k.id||"",k.atMessageId||"",k.turnId||"",k.messageId||"",k.speakerVpId||"",V.id||"",V.content?String(V.content).length:0,k.textContent?String(k.textContent).length:0,k.isStreaming||V.isStreaming?"streaming":"done"].join(":")},_s=Vue.computed(()=>{let k=re.value||[];return[s.activeConversationId||"",U.value||"",k.length,es(k[k.length-1])].join("|")});Vue.watch(()=>[s.currentConversation,_.value.length,n.token],()=>{let k=n.token||"";k!==H&&(H=k,G()),$()},{immediate:!0}),Vue.watch(_s,Jt),Vue.watch(dn,k=>{k&&Jt()}),Vue.watch(()=>[s.activeConversationId,U.value],()=>{for(let k of Object.keys(l))delete l[k];for(let k of Object.keys(c))delete c[k];for(let k of Object.keys(d))delete d[k];Xt(),Vue.nextTick(Zt)});let ts=Vue.ref(null),ss=0;return t({revealMessage:async k=>k?await wd({blocks:re.value,messageId:k,collapseStates:d,nextTick:Vue.nextTick,scrollToBlock:W=>(Xt(),be.value=!0,se.value=!1,a.value?.scrollToKey?.(W,{align:"center"})),findRow:W=>{let de=o.value?.querySelectorAll?.("[data-msg-id]")||[];return Array.from(de).find(ye=>ye?.dataset?.msgId===W)||null},flashRow:W=>{let de=++ss;ts.value=W,setTimeout(()=>{de===ss&&(ts.value=null)},1800)}}):!1}),Vue.onMounted(()=>{Zt(),o.value&&(o.value.addEventListener("wheel",Rt,{passive:!0}),o.value.addEventListener("touchmove",Rt,{passive:!0}),o.value.addEventListener("pointerdown",vn,{passive:!0}),o.value.addEventListener("scroll",bn)),window.addEventListener("pointerup",Ct,{passive:!0}),window.addEventListener("pointercancel",Ct,{passive:!0}),window.addEventListener("keydown",yn)}),Vue.onUnmounted(()=>{o.value&&(o.value.removeEventListener("wheel",Rt),o.value.removeEventListener("touchmove",Rt),o.value.removeEventListener("pointerdown",vn),o.value.removeEventListener("scroll",bn)),window.removeEventListener("pointerup",Ct),window.removeEventListener("pointercancel",Ct),window.removeEventListener("keydown",yn),hn(),Ke&&(clearInterval(Ke),Ke=null),Ye&&(clearTimeout(Ye),Ye=null),_e&&(cancelAnimationFrame(_e),_e=null),rt&&(cancelAnimationFrame(rt),rt=null)}),{store:s,containerRef:o,virtualTranscriptRef:a,flashMsgId:ts,hasStreamingMessage:ge,nowMs:Z,showTypingDots:F,showInitialMessagesLoading:Ee,showSessionLoadingOverlay:He,initialMessagesLoadingText:Oe,previewShowTypingDots:dn,isPreviewMode:Yt,waitingStatus:Vi,animationType:dt,catSpeed:Fi,catStyle:Oi,dogPhase:Le,spikeTransform:Ei,teddyTransform:_i,leashPathL:Ri,leashPathR:Je,leashOpacityL:cn,leashOpacityR:Li,questionLX:$i,questionRX:Kt,refreshSession:Qt,onlineAgents:_,welcomeInstallCommand:ue,welcomeLlmCommand:J,welcomeServiceCommand:ve,welcomeSetupLoading:C,welcomeSetupError:M,copyWelcomeCommand:w,turnGroups:X,messageBlocks:re,estimateMessageBlockHeight:y,visibleItemsForBlock:h,collapsedResponsePreviewLines:A,collapsedResponsePreviewSpeaker:x,responseToggleBelongsToItem:v,showBlockResponseToggle:g,toggleMessageTurnResponse:b,responseCollapseLabel:D,turnUiKey:u,assistantTurnActionsExpandedFor:f,setAssistantTurnActionsExpanded:p,toolExpandStates:c,setToolExpanded:m,cardsForRow:De,orphanCards:ne,subAgentCardsForRow:q,orphanSubAgentCards:te,useImStyleForUser:O,onClickLoadMore:mn,onVirtualTranscriptScrollState:Bi,isAtBottom:se,scrollToLatest:Ui}}}});function ii(...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 Ad(e,t,s){let n=t?e?.slashCommandsMap?.[t]:null;return e?.currentView==="yeaft"?ii(n):ii(n,s?e?.slashCommandsMap?.[`agent:${s}`]:null,e?.slashCommandsMap?.__preload__)}function dm(e,t={},s=new Set){if(cm.has(e)||Object.prototype.hasOwnProperty.call(ni,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 xd(e,t={}){if(si[e])return si[e];if(ni[e])return ni[e];let s=e.startsWith("/")?e.slice(1):e;return t[s]?t[s]:um(s)}function um(e){return(e.includes(":")?e.split(":").pop():e).replace(/-/g," ").replace(/^\w/,s=>s.toUpperCase())}function Td(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=dm(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)=>(Sd[o]??99)-(Sd[a]??99));return r.map((o,a)=>({label:pm[o]||o,items:i[o],isLast:a===r.length-1}))}var si,cm,Cd,ni,Id,pm,Sd,Md=N(()=>{si={"/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"},cm=new Set(Object.keys(si)),Cd=Object.keys(si),ni={"/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"},Id=Object.keys(ni);pm={skill:"Skills",builtin:"Built-in",project:"Commands"},Sd={skill:0,project:1,builtin:2}});function hm(e){return!(!e||typeof e!="string"||e.length<1||e.length>40||e.startsWith("_")||gm.test(e)||fm.has(e.toLowerCase()))}function ri(e){if(!e||typeof e!="string")return{text:e||"",mentions:[]};let t=new Set;Pd.lastIndex=0;let s;for(;(s=Pd.exec(e))!==null;){let n=s[2];if(hm(n)&&!t.has(n)&&(t.add(n),t.size>=mm))break}return{text:e,mentions:Array.from(t)}}var fm,Pd,gm,mm,so=N(()=>{fm=new Set(["all","user","system","everyone"]),Pd=/(^|[\s\p{P}])@([A-Za-z0-9_-]{1,40})(?=$|[\s\p{P}])/gu,gm=/^[0-9]+$/,mm=32});function Dd(e){let t=typeof e?.vpId=="string"?e.vpId:"";return no.has(t)?no.get(t):e?.isStock===!0?"other":"custom"}function qt(e){let t=new Map(oi.map(s=>[s.id,[]]));for(let s of Array.isArray(e)?e:[])!s||typeof s.vpId!="string"||!s.vpId||t.get(Dd(s)).push(s);return oi.map(s=>({id:s.id,labelKey:s.labelKey,vps:t.get(s.id)})).filter(s=>s.vps.length>0)}function en(e){return qt(e).flatMap(t=>t.vps)}function Ed(e){let t=new Map(oi.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=Dd(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 vm,oi,no,tn=N(()=>{vm=[{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:[]}],oi=Object.freeze(vm.map(e=>Object.freeze({id:e.id,labelKey:e.labelKey,vpIds:Object.freeze([...e.vpIds])}))),no=new Map;for(let e of oi)for(let t of e.vpIds)no.set(t,e.id)});function io(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 en(c).slice(0,_d)}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:[],f=!1;for(let S of u){let v=String(S||"").toLowerCase();if(v&&v.startsWith(n)){f=!0;break}}if(f){l(c,r);continue}let p=String(c.displayName||"").toLowerCase(),m=String(c.displayNameZh||""),y=[c.description,c.descriptionZh,c.role,c.roleZh].map(S=>String(S||"").toLowerCase()),h=typeof t=="string"?t:"",A=p.includes(n)||h&&m.includes(h),x=n&&y.some(S=>S.includes(n));(A||x)&&l(c,o)}return[...en(i),...en(r),...en(o)].slice(0,_d)}function ro(e="chat-input"){return`${e}-vp-mention-listbox`}function oo(e,t){let s=String(t||"").replace(/[^A-Za-z0-9_.:-]/g,"-");return`${e}-vp-mention-option-${s}`}function ym(e){let t=0;return Ed(e).map(s=>({...s,items:s.vps.map(n=>({vp:n,flatIndex:t++}))}))}function Rd(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 Ld(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 _d,$d,Vd=N(()=>{tn();_d=12;$d={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:`
|
|
1588
1588
|
<div
|
|
1589
1589
|
class="slash-autocomplete vp-mention-autocomplete"
|
|
1590
1590
|
v-if="filteredList.length > 0"
|
|
@@ -1748,8 +1748,8 @@ ${String(e||"").trim()}
|
|
|
1748
1748
|
</button>
|
|
1749
1749
|
</div>
|
|
1750
1750
|
</footer>
|
|
1751
|
-
`,setup(e){let t=Pinia.useChatStore(),s=Pinia.useAuthStore(),n=Pinia.useVpStore(),i=Pinia.useSessionsStore?Pinia.useSessionsStore():null,r=Vue.ref(""),o=Vue.ref(null),l=`chat-input-${Vue.getCurrentInstance()?.uid??0}`,c=Vue.ref(null),d=Vue.ref([]),u=Vue.ref(!1),f=Vue.ref(null),p=Vue.ref(null),m=Vue.ref(null),y=Vue.computed(()=>!!e.sendFn),h=Vue.computed(()=>!t.btwMode),A=Vue.computed(()=>e.placeholderKey||"chatInput.placeholder"),x=Vue.computed(()=>e.showStop||!y.value&&t.isProcessing),S=Vue.computed({get:()=>t.expertSelections||[],set:
|
|
1752
|
-
`||pe===0?T()?(_.value=!0,P.value=0,v.value=!1):(v.value=!0,g.value=0,_.value=!1):(v.value=!1,_.value=!1)}else pe===-1&&(v.value=!1,_.value=!1)},q=
|
|
1751
|
+
`,setup(e){let t=Pinia.useChatStore(),s=Pinia.useAuthStore(),n=Pinia.useVpStore(),i=Pinia.useSessionsStore?Pinia.useSessionsStore():null,r=Vue.ref(""),o=Vue.ref(null),l=`chat-input-${Vue.getCurrentInstance()?.uid??0}`,c=Vue.ref(null),d=Vue.ref([]),u=Vue.ref(!1),f=Vue.ref(null),p=Vue.ref(null),m=Vue.ref(null),y=Vue.computed(()=>!!e.sendFn),h=Vue.computed(()=>!t.btwMode),A=Vue.computed(()=>e.placeholderKey||"chatInput.placeholder"),x=Vue.computed(()=>e.showStop||!y.value&&t.isProcessing),S=Vue.computed({get:()=>t.expertSelections||[],set:F=>{t.expertSelections=F}}),v=Vue.ref(!1),g=Vue.ref(0),b=Vue.computed(()=>Za(t.customExpertRoles)),D=Vue.computed(()=>{let F=r.value,Z=F.lastIndexOf("@");if(Z===-1||!v.value)return[];let pe=F.slice(Z+1).toLowerCase();return b.value.filter(ce=>pe?ce.searchText.includes(pe):!0).filter(ce=>!S.value.some(fe=>fe.role===ce.roleId)).slice(0,12)}),L=F=>{if(S.value.length>=Ht)return;let Z={role:F.roleId,action:F.actionId};t.expertSelections=[...S.value,Z];let pe=r.value,ce=pe.lastIndexOf("@");ce!==-1&&(r.value=pe.slice(0,ce).trimEnd()),v.value=!1,Vue.nextTick(()=>o.value?.focus())},U=F=>{let Z=[...S.value];Z.splice(F,1),t.expertSelections=Z},O=F=>Ot(F,t.customExpertRoles),_=Vue.ref(!1),P=Vue.ref(0),T=()=>t.currentView==="yeaft"&&!!t.currentAgent,C=Vue.computed(()=>{let F=r.value,Z=F.lastIndexOf("@");return Z<0||!_.value?"":F.slice(Z+1)}),M=Vue.computed(()=>{if(!i)return n.vpList||[];let F=t.yeaftActiveSessionFilter||i.activeSessionId||null,Z=typeof i.sessionById=="function"?i.sessionById(F,t.currentAgent||null):i.sessions?.[F];return Rd(n.vpList,Z)}),E=Vue.computed(()=>io(M.value,C.value)),R=Vue.computed(()=>!t.btwMode&&_.value&&!v.value&&E.value.length>0),H=ro(l),G=Vue.computed(()=>{if(!R.value)return null;let F=E.value[P.value];return F?oo(l,F.vpId):null}),ue=F=>{!F||!F.vpId||(r.value=Ld(r.value,F.vpId),_.value=!1,P.value=0,Vue.nextTick(()=>o.value?.focus()))},J=Vue.computed(()=>e.draftKey||e.conversationId||t.currentConversation||null);J.value&&t.inputDrafts[J.value]&&(r.value=t.inputDrafts[J.value]),Vue.watch(r,F=>{let Z=J.value;Z&&(F?t.inputDrafts[Z]=F:delete t.inputDrafts[Z])}),Vue.watch(E,F=>{if(F.length===0){P.value=0;return}P.value>=F.length&&(P.value=F.length-1)}),Vue.watch(J,(F,Z)=>{Z&&r.value&&(t.inputDrafts[Z]=r.value),r.value=F&&t.inputDrafts[F]||""});let ve=F=>{if(!F||typeof F!="string")return;let Z=r.value||"",pe=Z.length>0&&!/\s$/.test(Z),ce=Z+(pe?" ":"")+"@"+F+" ";r.value=ce,Vue.nextTick(()=>{let fe=o.value;fe&&(fe.focus(),fe.setSelectionRange(ce.length,ce.length),ne())})},ae=Vue.ref(!1),$=Vue.ref(0),w=Vue.computed(()=>{let F=e.conversationId||t.activeConversationId||t.currentConversation,Z=t.currentAgent,pe=Ad(t,F,Z),ce=t.currentView==="yeaft"?Id:Cd;return ii(ce,pe).map(Se=>Se.startsWith("/")?Se:"/"+Se)}),B=Vue.computed(()=>{let F=r.value.trim();if(!F.startsWith("/"))return[];let Z=F.toLowerCase();return w.value.filter(pe=>pe.toLowerCase().startsWith(Z)&&pe.toLowerCase()!==Z).map(pe=>({cmd:pe,desc:xd(pe,t.slashCommandDescriptions)}))}),X=Vue.computed(()=>Td(B.value,t.slashCommandDescriptions,w.value)),re=Vue.computed(()=>B.value.map(F=>F.cmd)),ke=Vue.computed(()=>e.conversationId||t.activeConversationId||t.currentConversation||null),Pe=Vue.computed(()=>t.compactStatus?.status==="compacting"&&t.compactStatus?.conversationId===ke.value),De=Vue.computed(()=>{if(Pe.value)return!1;let F=!!r.value.trim(),Z=d.value.length>0;if(y.value){let Re=!u.value&&d.value.every(Ke=>Ke.fileId);return(F||Z)&&Re}let pe=S.value.length>0,ce=S.value.some(Re=>Re.action),fe=F||Z||pe&&(F||ce),Se=!u.value&&d.value.every(Re=>Re.fileId);return fe&&t.currentAgent&&t.currentConversation&&Se}),ne=()=>{let F=o.value;F&&(F.style.height="auto",F.style.height=Math.min(F.scrollHeight,120)+"px")},Q=()=>{ne();let F=r.value.trim();F.startsWith("/")&&!F.includes(" ")?(ae.value=!0,$.value=0,v.value=!1):ae.value=!1;let Z=r.value,pe=Z.lastIndexOf("@");if(pe!==-1&&!ae.value){let ce=pe>0?Z[pe-1]:" ";ce===" "||ce===`
|
|
1752
|
+
`||pe===0?T()?(_.value=!0,P.value=0,v.value=!1):(v.value=!0,g.value=0,_.value=!1):(v.value=!1,_.value=!1)}else pe===-1&&(v.value=!1,_.value=!1)},q=F=>{r.value=F+" ",ae.value=!1,Vue.nextTick(()=>{o.value?.focus()})},te=()=>{setTimeout(()=>{ae.value=!1,v.value=!1,_.value=!1},150)},se=async F=>{let Z=Array.from(F.target.files||[]);Z.length>0&&await me(Z),F.target.value="",Vue.nextTick(()=>{o.value?.focus()})},be=async F=>{let Z=F.clipboardData?.items;if(!Z)return;let pe=[];for(let ce of Z)if(ce.kind==="file"){let fe=ce.getAsFile();fe&&pe.push(fe)}pe.length>0&&(F.preventDefault(),await me(pe))},j=F=>{let Z=String(F||"").toLowerCase();return Z==="image/png"?".png":Z==="image/jpeg"?".jpg":Z==="image/gif"?".gif":Z==="image/webp"?".webp":Z==="image/svg+xml"?".svg":Z==="text/plain"?".txt":Z==="application/json"?".json":""},ee=(F,Z)=>{let pe=typeof F?.name=="string"?F.name.trim():"";return pe||`${String(F?.type||"").startsWith("image/")?"pasted-image":"pasted-file"}-${Date.now()}-${Z+1}${j(F?.type)}`},me=async F=>{let Z=[];for(let[pe,ce]of F.entries()){let fe=ee(ce,pe),Se={file:ce,name:fe,uploadName:fe,preview:null,uploading:!0,fileId:null};ce.type.startsWith("image/")&&(Se.preview=URL.createObjectURL(ce)),d.value.push(Se),Z.push(Se)}u.value=!0;try{let pe=new FormData;for(let _e of Z)pe.append("files",_e.file,_e.uploadName);let ce={},fe=s.getActiveToken?.()||s.token||null;fe&&(ce.Authorization=`Bearer ${fe}`);let Se=await fetch("/api/upload",{method:"POST",headers:ce,body:pe});if(Se.status===401||Se.status===403)throw s.handleAuthFailure?.(void 0,fe),new Error("Upload failed: authentication required");if(!Se.ok)throw new Error("Upload failed");let Re=await Se.json(),Ke=0;for(let _e of Z)_e.uploading&&!_e.fileId&&Ke<Re.files.length&&(_e.fileId=Re.files[Ke].fileId,_e.uploading=!1,delete _e.uploadName,Ke++)}catch{let ce=d.value.filter(fe=>!fe.fileId);for(let fe of ce)fe.preview&&URL.revokeObjectURL(fe.preview);d.value=d.value.filter(fe=>fe.fileId)}finally{u.value=!1,Vue.nextTick(()=>{o.value?.focus()})}},ge=F=>{let Z=d.value[F];Z.preview&&URL.revokeObjectURL(Z.preview),d.value.splice(F,1),Vue.nextTick(()=>{o.value?.focus()})},Ee=()=>{if(!De.value)return;ae.value=!1,v.value=!1,_.value=!1;let F=r.value.trim();if(e.sendFn){let ce=d.value.filter(fe=>fe.fileId).map(fe=>({fileId:fe.fileId,name:fe.name,preview:fe.preview,isImage:fe.file?.type?.startsWith("image/")||!1,mimeType:fe.file?.type||""}));e.sendFn(F,ce.length>0?ce:void 0),d.value=[],r.value="",J.value&&delete t.inputDrafts[J.value],o.value&&(o.value.style.height="auto");return}if(F==="/btw"||F.startsWith("/btw ")){let ce=F.substring(4).trim();t.enterBtwMode(),ce&&t.sendBtwQuestion(ce),r.value="",J.value&&delete t.inputDrafts[J.value],o.value&&(o.value.style.height="auto");return}if(t.btwMode){t.sendBtwQuestion(F),r.value="",J.value&&delete t.inputDrafts[J.value],o.value&&(o.value.style.height="auto");return}let Z=d.value.filter(ce=>ce.fileId).map(ce=>({fileId:ce.fileId,name:ce.name,preview:ce.preview,isImage:ce.file?.type?.startsWith("image/")||!1,mimeType:ce.file?.type||""}));if(t.currentView==="yeaft"&&(F||Z.length>0)){let ce=ri(F).mentions,fe=t.yeaftActiveSessionFilter||i?.activeSessionId||"grp_default";t.sendYeaftSessionMessage({groupId:fe,text:F,mentions:ce,attachments:Z}),d.value=[],r.value="",J.value&&delete t.inputDrafts[J.value],o.value&&(o.value.style.height="auto");return}let pe=[...S.value];t.sendMessage(r.value.trim(),Z,{expertSelections:pe}),d.value=[],r.value="",t.expertSelections=[],J.value&&delete t.inputDrafts[J.value],o.value&&(o.value.style.height="auto")},Oe=F=>{if(!(F.isComposing||F.keyCode===229)){if(F.key==="Escape"&&t.btwMode){F.preventDefault(),t.closeBtw();return}if(_.value){let Z=E.value;if(Z.length>0){if(F.key==="ArrowDown"){F.preventDefault(),P.value=(P.value+1)%Z.length;return}if(F.key==="ArrowUp"){F.preventDefault(),P.value=(P.value-1+Z.length)%Z.length;return}if(F.key==="Tab"||F.key==="Enter"&&!F.shiftKey){F.preventDefault(),ue(Z[P.value]);return}}if(F.key==="Escape"){F.preventDefault(),_.value=!1;return}}if(v.value&&D.value.length>0){if(F.key==="ArrowDown"){F.preventDefault(),g.value=(g.value+1)%D.value.length;return}if(F.key==="ArrowUp"){F.preventDefault(),g.value=(g.value-1+D.value.length)%D.value.length;return}if(F.key==="Tab"||F.key==="Enter"&&!F.shiftKey){F.preventDefault(),L(D.value[g.value]);return}if(F.key==="Escape"){F.preventDefault(),v.value=!1;return}}if(ae.value&&re.value.length>0){if(F.key==="ArrowDown"){F.preventDefault(),$.value=($.value+1)%re.value.length;return}if(F.key==="ArrowUp"){F.preventDefault(),$.value=($.value-1+re.value.length)%re.value.length;return}if(F.key==="Tab"||F.key==="Enter"&&!F.shiftKey){F.preventDefault(),q(re.value[$.value]);return}if(F.key==="Escape"){F.preventDefault(),ae.value=!1;return}}F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),Ee())}},He=()=>{e.cancelFn?e.cancelFn():t.cancelExecution()};return{store:t,inputText:r,inputRef:o,inputAreaRef:f,fileInput:c,attachments:d,uploading:u,canSend:De,isCompacting:Pe,isStopVisible:x,effectivePlaceholderKey:A,attachmentsAllowed:h,showAutocomplete:ae,selectedIndex:$,filteredCommands:re,flatItems:B,groupedCommands:X,autocompleteRef:p,sendFn:Vue.toRef(e,"sendFn"),expertSelections:S,showExpertAutocomplete:v,expertSelectedIndex:g,expertAutocompleteFiltered:D,expertAutocompleteRef:m,selectExpertItem:L,removeExpertSelection:U,getExpertLabel:O,autoResize:ne,handleInput:Q,selectCommand:q,onBlur:te,handleFileSelect:se,handlePaste:be,removeAttachment:ge,send:Ee,handleKeydown:Oe,cancelExecution:He,vpStore:n,inputElementId:l,showVpAutocomplete:_,vpMentionPopupOpen:R,vpMentionPopupId:H,vpMentionActiveOptionId:G,vpSelectedIndex:P,vpMentionQuery:C,mentionVpCandidates:M,selectVpMention:ue,appendMention:ve}}}});function ao(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 Fd(e){return e+":"+Math.random().toString(36).slice(2,8)}function sn(e){return e?e.type==="pane"?[e.terminalId]:[...sn(e.first),...sn(e.second)]:[]}function ci(e){return e?e.type==="pane"?e.terminalId:ci(e.first):null}function li(e,t,s){return e&&(e.type==="pane"?e.terminalId===t?s:e:{...e,first:li(e.first,t,s),second:li(e.second,t,s)})}function Mt(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=Mt(e.first,t),n=Mt(e.second,t);return s?n?{...e,first:s,second:n}:s:n}var Od=N(()=>{});var Hd,Nd=N(()=>{Hd={name:"PaneTree",props:{node:Object,terminals:Object,activePane:String,onActivate:Function,onClosePane:Function,setMountRef:Function},template:`
|
|
1753
1753
|
<div v-if="node.type === 'pane'"
|
|
1754
1754
|
class="terminal-pane"
|
|
1755
1755
|
:class="{ active: node.terminalId === activePane }"
|
|
@@ -1822,7 +1822,7 @@ ${String(e||"").trim()}
|
|
|
1822
1822
|
<div class="placeholder-text">{{ $t('terminal.autoCreate') }}</div>
|
|
1823
1823
|
</div>
|
|
1824
1824
|
</div>
|
|
1825
|
-
`,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,C)=>{if(C){let M=o[T];if(o[T]=C,M&&M!==C){let E=s[T];E?.terminal?.element&&(C.innerHTML="",C.appendChild(E.terminal.element),Vue.nextTick(()=>{try{E.fitAddon?.fit()}catch{}}))}}},f=T=>{let C=e.currentConversation;C&&(i[C]=T)};async function p(){if(a)return!0;let T=typeof Terminal<"u"?Terminal.Terminal||Terminal:null,C=typeof FitAddon<"u"?FitAddon.FitAddon||FitAddon:null;if(!T||!C)try{await ao("vendor/xterm.min.js"),await ao("vendor/xterm-addon-fit.min.js"),T=typeof Terminal<"u"?Terminal.Terminal||Terminal:null,C=typeof FitAddon<"u"?FitAddon.FitAddon||FitAddon:null}catch{}return!T||!C?(r.value=t("terminal.xtermNotLoaded"),!1):(a=!0,!0)}function m(){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 y(T){if(!T||!e.currentAgent||!await p())return null;let C=Fd(T),M=Terminal.Terminal||Terminal,E=FitAddon.FitAddon||FitAddon,R=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:m(),allowProposedApi:!0}),H=new E;return R.loadAddon(H),R.attachCustomKeyEventHandler(G=>!((G.ctrlKey||G.metaKey)&&G.key==="v"||(G.ctrlKey||G.metaKey)&&G.key==="c"&&R.hasSelection())),s[C]={created:!0,connected:!1,terminal:R,fitAddon:H},R.onData(G=>{e.sendWsMessage({type:"terminal_input",conversationId:T,terminalId:C,data:G,_clientId:e.clientId})}),C}async function h(T,C){let M=s[C];if(!M)return!1;let E=null;for(let R=0;R<10&&(await Vue.nextTick(),E=o[C],!(E||R>=2&&(await new Promise(H=>setTimeout(H,50)),E=o[C],E)));R++);return E?(M.terminal.open(E),M.fitAddon.fit(),e.sendWsMessage({type:"terminal_create",conversationId:T,terminalId:C,cols:M.terminal.cols,rows:M.terminal.rows,_clientId:e.clientId}),!0):(r.value=t("terminal.mountFailed"),M.terminal.dispose(),delete s[C],!1)}let A=!1;async function x(){let T=e.currentConversation;if(!T||!e.currentAgent||n[T]||A)return;A=!0,r.value="";let C=await y(T);if(!C){A=!1;return}n[T]=Vue.reactive({type:"pane",terminalId:C}),i[T]=C,await h(T,C)||(delete n[T],delete i[T]),A=!1}async function S(T){let C=e.currentConversation;if(!C||!i[C])return;let M=i[C],E=await y(C);if(!E)return;let R=Vue.reactive({type:"split",direction:T,ratio:.5,first:{type:"pane",terminalId:M},second:{type:"pane",terminalId:E}}),H=li(n[C],M,R);if(n[C]=Vue.reactive(H),i[C]=E,!await h(C,E)){let ue=Mt(n[C],E);ue&&(n[C]=Vue.reactive(ue)),i[C]=M;return}await Vue.nextTick(),b(C)}function v(T){let C=e.currentConversation;if(!C)return;let M=s[T];M&&(e.sendWsMessage({type:"terminal_close",conversationId:C,terminalId:T,_clientId:e.clientId}),M.terminal?.dispose(),delete s[T],delete o[T]);let E=Mt(n[C],T);E?(n[C]=Vue.reactive(E),i[C]===T&&(i[C]=ci(n[C])||""),Vue.nextTick(()=>b(C))):(delete n[C],delete i[C],Vue.nextTick(()=>x()))}function g(){let T=e.currentConversation;!T||!i[T]||v(i[T])}function b(T){if(T||(T=e.currentConversation),!T||!n[T])return;let C=sn(n[T]);for(let M of C){let E=s[M];if(E?.fitAddon&&E.connected)try{E.fitAddon.fit(),e.sendWsMessage({type:"terminal_resize",conversationId:T,terminalId:M,cols:E.terminal.cols,rows:E.terminal.rows,_clientId:e.clientId})}catch{}}}function D(T){let C=T.detail;if(C)switch(C.type){case"terminal_created":{let M=C.terminalId||C.conversationId,E=s[M];if(E)if(C.success)E.connected=!0,r.value="";else{r.value=C.error||t("terminal.createFailed"),E.terminal?.dispose(),delete s[M];let R=C.conversationId;if(R&&n[R]){let H=Mt(n[R],M);H?n[R]=Vue.reactive(H):(delete n[R],delete i[R])}}break}case"terminal_output":{let M=C.terminalId||C.conversationId,E=s[M];E?.terminal&&E.terminal.write(C.data);break}case"terminal_closed":{let M=C.terminalId||C.conversationId,E=s[M];if(E){E.terminal?.dispose(),delete s[M],delete o[M];let R=C.conversationId;if(R&&n[R]){let H=Mt(n[R],M);H?(n[R]=Vue.reactive(H),i[R]===M&&(i[R]=ci(n[R])||"")):(delete n[R],delete i[R])}}break}case"terminal_error":{r.value=C.message||t("terminal.error");let M=C.terminalId;if(M&&s[M]&&!s[M].connected){s[M].terminal?.dispose(),delete s[M];let E=C.conversationId;if(E&&n[E]){let R=Mt(n[E],M);R?n[E]=Vue.reactive(R):(delete n[E],delete i[E])}}break}}}let L=null;function U(){clearTimeout(L),L=setTimeout(()=>b(),100)}function F(){b()}function _(T){let{conversationId:C}=T.detail;if(C&&n[C]){let M=sn(n[C]);for(let E of M){let R=s[E];R&&(R.terminal?.dispose(),delete s[E],delete o[E])}delete n[C],delete i[C]}}Vue.onMounted(()=>{window.addEventListener("workbench-message",D),window.addEventListener("resize",U),window.addEventListener("terminal-fit-all",F),window.addEventListener("conversation-deleted",_)}),Vue.onUnmounted(()=>{window.removeEventListener("workbench-message",D),window.removeEventListener("resize",U),window.removeEventListener("terminal-fit-all",F),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 C=document.querySelector(".terminal-tab");C&&C.offsetParent!==null&&x()})},{immediate:!0}),Vue.watch(()=>e.connectionState,(T,C)=>{if(T==="connected"&&C&&C!=="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(()=>x())}}),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&&(x(),b())};P=new MutationObserver(()=>{setTimeout(T,50)});let C=document.querySelector(".workbench-tab-content");C&&P.observe(C,{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:f,splitPane:S,closeActivePane:g,closePane:v}}}});function di(e){if(!e)return nn(K.default);let t=e.toLowerCase();if(lo[t])return lo[t]();let s=t.lastIndexOf(".");if(s>=0){let n=t.slice(s+1);if(Wd[n])return Wd[n]();let i=t;for(let[r,o]of Object.entries(lo))if(i===r||i.endsWith("/"+r))return o()}return nn(K.default)}function ui(e=!1){return bm(K.folder,e)}var K,nn,bm,z,Wd,lo,co=N(()=>{K={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"},nn=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>`,bm=(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>`,z=(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>`,Wd={js:()=>z(K.js,"JS"),mjs:()=>z(K.js,"JS"),cjs:()=>z(K.js,"JS"),ts:()=>z(K.ts,"TS"),mts:()=>z(K.ts,"TS"),jsx:()=>z(K.jsx,"JSX"),tsx:()=>z(K.tsx,"TSX"),html:()=>z(K.html,"</>"),htm:()=>z(K.html,"</>"),css:()=>z(K.css,"CSS"),scss:()=>z(K.scss,"SC"),sass:()=>z(K.scss,"SA"),less:()=>z(K.less,"LS"),vue:()=>z(K.vue,"V"),svelte:()=>z(K.svelte,"SV"),json:()=>z(K.json,"{ }"),yaml:()=>z(K.yaml,"YML"),yml:()=>z(K.yaml,"YML"),toml:()=>z(K.config,"TML"),xml:()=>z(K.xml,"</>"),csv:()=>z(K.config,"CSV"),md:()=>z(K.md,"MD"),markdown:()=>z(K.md,"MD"),txt:()=>nn(K.txt),log:()=>nn(K.log),pdf:()=>z("#E53935","PDF"),py:()=>z(K.py,"PY"),rb:()=>z(K.rb,"RB"),go:()=>z(K.go,"GO"),rs:()=>z(K.rs,"RS"),java:()=>z(K.java,"JA"),cs:()=>z(K.cs,"C#"),cpp:()=>z(K.cpp,"C+"),cc:()=>z(K.cpp,"C+"),c:()=>z(K.c,"C"),h:()=>z(K.c,"H"),hpp:()=>z(K.cpp,"H+"),swift:()=>z(K.swift,"SW"),kt:()=>z(K.kt,"KT"),php:()=>z(K.php,"PHP"),lua:()=>z(K.lua,"LUA"),r:()=>z(K.r,"R"),dart:()=>z(K.dart,"DA"),sh:()=>z(K.sh,">_"),bash:()=>z(K.sh,">_"),zsh:()=>z(K.sh,">_"),fish:()=>z(K.sh,">_"),ps1:()=>z(K.ps1,"PS"),bat:()=>z(K.ps1,"BAT"),cmd:()=>z(K.ps1,"CMD"),sql:()=>z(K.sql,"SQL"),db:()=>z(K.sql,"DB"),sqlite:()=>z(K.sql,"DB"),svg:()=>z(K.svg,"SVG"),png:()=>z(K.img,"PNG"),jpg:()=>z(K.img,"JPG"),jpeg:()=>z(K.img,"JPG"),gif:()=>z(K.img,"GIF"),ico:()=>z(K.img,"ICO"),webp:()=>z(K.img,"WP"),lock:()=>nn(K.lock),env:()=>z(K.env,"ENV"),ini:()=>z(K.config,"INI"),cfg:()=>z(K.config,"CFG"),conf:()=>z(K.config,"CNF"),liquid:()=>z(K.liquid,"LQ"),ejs:()=>z(K.html,"EJS"),hbs:()=>z(K.html,"HBS"),pug:()=>z(K.html,"PUG"),wasm:()=>z("#654FF0","WA"),proto:()=>z(K.config,"PB"),graphql:()=>z("#E535AB","GQL"),gql:()=>z("#E535AB","GQL")},lo={dockerfile:()=>z(K.docker,"DK"),"docker-compose.yml":()=>z(K.docker,"DC"),"docker-compose.yaml":()=>z(K.docker,"DC"),".gitignore":()=>z(K.git,"GI"),".gitattributes":()=>z(K.git,"GA"),".gitmodules":()=>z(K.git,"GM"),".env":()=>z(K.env,"ENV"),".env.local":()=>z(K.env,"ENV"),".env.development":()=>z(K.env,"ENV"),".env.production":()=>z(K.env,"ENV"),"package.json":()=>z("#CB3837","NPM"),"package-lock.json":()=>z("#CB3837","NPM"),"tsconfig.json":()=>z(K.ts,"TSC"),eslintrc:()=>z("#4B32C3","ESL"),".eslintrc.js":()=>z("#4B32C3","ESL"),".eslintrc.json":()=>z("#4B32C3","ESL"),".prettierrc":()=>z("#F7B93E","PR"),makefile:()=>z(K.config,"MK"),"cmakelists.txt":()=>z("#064F8C","CM"),"readme.md":()=>z(K.md,"RM"),license:()=>z("#F5C518","LIC"),"license.md":()=>z("#F5C518","LIC"),"cargo.toml":()=>z(K.rs,"CG"),"go.mod":()=>z(K.go,"MOD"),"go.sum":()=>z(K.go,"SUM"),gemfile:()=>z(K.rb,"GEM"),rakefile:()=>z(K.rb,"RK"),"requirements.txt":()=>z(K.py,"REQ"),pipfile:()=>z(K.py,"PIP"),csproj:()=>z(K.cs,"CSP"),".sln":()=>z(K.cs,"SLN"),slnx:()=>z(K.cs,"SLN")}});function Wt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function wm(e,t){if(!e||!t)return Wt(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],f=d.index+(d[1]!==void 0?d[0].indexOf(d[1]):0);if(s.push({start:f,end:f+u.length,cls:l}),!c.global)break}},i=t.commentType||"slash";if((i==="slash"||i==="both")&&(n(bs.comment1,Ce.comment),n(bs.commentBlock,Ce.comment)),(i==="hash"||i==="both")&&n(bs.commentHash,Ce.comment),i==="html"&&n(t.commentHtml,Ce.comment),t.commentLine&&n(t.commentLine,Ce.comment),t.commentBlock&&n(t.commentBlock,Ce.comment),n(bs.string,Ce.string),n(bs.number,Ce.number),t.keywords&&n(t.keywords,Ce.keyword),t.builtins&&n(t.builtins,Ce.builtin),t.operators&&n(t.operators,Ce.operator),t.decorators&&n(t.decorators,Ce.decorator),t.macros&&n(t.macros,Ce.macro),t.preprocessor&&n(t.preprocessor,Ce.preprocessor),t.attributes&&n(t.attributes,Ce.attribute),t.tags&&n(t.tags,Ce.tag),t.properties&&n(t.properties,Ce.property),t.variables&&n(t.variables,Ce.variable),t.headings&&n(t.headings,Ce.heading),t.bold&&n(t.bold,Ce.bold),t.links&&n(t.links,Ce.link),t.keys&&n(t.keys,Ce.key),t.sections&&n(t.sections,Ce.section),t.selectors&&n(t.selectors,Ce.keyword),t.values&&n(t.values,Ce.number),t.code&&n(t.code,Ce.string),t.italic&&n(t.italic,Ce.builtin),t.attrs&&n(t.attrs,Ce.attribute),s.length===0)return Wt(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+=Wt(e.slice(o,a.start))),r+=`<span class="${a.cls}">${Wt(e.slice(a.start,a.end))}</span>`,o=a.end);return o<e.length&&(r+=Wt(e.slice(o))),r}function km(e){if(!e)return null;let t=e.split(".").pop()?.toLowerCase();if(!t)return null;let s=Ud[t];return typeof s=="string"&&(s=Ud[s]),s||null}function zd(e,t){if(!e)return Wt(e||"");let s=km(t);return s?wm(e,s):Wt(e)}var bs,Ud,Ce,jd=N(()=>{bs={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},Ud={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}},Ce={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 Kd(e,t,s){let n=[],i=0,r=0;if(t!=null){let p=t.split(`
|
|
1825
|
+
`,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,C)=>{if(C){let M=o[T];if(o[T]=C,M&&M!==C){let E=s[T];E?.terminal?.element&&(C.innerHTML="",C.appendChild(E.terminal.element),Vue.nextTick(()=>{try{E.fitAddon?.fit()}catch{}}))}}},f=T=>{let C=e.currentConversation;C&&(i[C]=T)};async function p(){if(a)return!0;let T=typeof Terminal<"u"?Terminal.Terminal||Terminal:null,C=typeof FitAddon<"u"?FitAddon.FitAddon||FitAddon:null;if(!T||!C)try{await ao("vendor/xterm.min.js"),await ao("vendor/xterm-addon-fit.min.js"),T=typeof Terminal<"u"?Terminal.Terminal||Terminal:null,C=typeof FitAddon<"u"?FitAddon.FitAddon||FitAddon:null}catch{}return!T||!C?(r.value=t("terminal.xtermNotLoaded"),!1):(a=!0,!0)}function m(){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 y(T){if(!T||!e.currentAgent||!await p())return null;let C=Fd(T),M=Terminal.Terminal||Terminal,E=FitAddon.FitAddon||FitAddon,R=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:m(),allowProposedApi:!0}),H=new E;return R.loadAddon(H),R.attachCustomKeyEventHandler(G=>!((G.ctrlKey||G.metaKey)&&G.key==="v"||(G.ctrlKey||G.metaKey)&&G.key==="c"&&R.hasSelection())),s[C]={created:!0,connected:!1,terminal:R,fitAddon:H},R.onData(G=>{e.sendWsMessage({type:"terminal_input",conversationId:T,terminalId:C,data:G,_clientId:e.clientId})}),C}async function h(T,C){let M=s[C];if(!M)return!1;let E=null;for(let R=0;R<10&&(await Vue.nextTick(),E=o[C],!(E||R>=2&&(await new Promise(H=>setTimeout(H,50)),E=o[C],E)));R++);return E?(M.terminal.open(E),M.fitAddon.fit(),e.sendWsMessage({type:"terminal_create",conversationId:T,terminalId:C,cols:M.terminal.cols,rows:M.terminal.rows,_clientId:e.clientId}),!0):(r.value=t("terminal.mountFailed"),M.terminal.dispose(),delete s[C],!1)}let A=!1;async function x(){let T=e.currentConversation;if(!T||!e.currentAgent||n[T]||A)return;A=!0,r.value="";let C=await y(T);if(!C){A=!1;return}n[T]=Vue.reactive({type:"pane",terminalId:C}),i[T]=C,await h(T,C)||(delete n[T],delete i[T]),A=!1}async function S(T){let C=e.currentConversation;if(!C||!i[C])return;let M=i[C],E=await y(C);if(!E)return;let R=Vue.reactive({type:"split",direction:T,ratio:.5,first:{type:"pane",terminalId:M},second:{type:"pane",terminalId:E}}),H=li(n[C],M,R);if(n[C]=Vue.reactive(H),i[C]=E,!await h(C,E)){let ue=Mt(n[C],E);ue&&(n[C]=Vue.reactive(ue)),i[C]=M;return}await Vue.nextTick(),b(C)}function v(T){let C=e.currentConversation;if(!C)return;let M=s[T];M&&(e.sendWsMessage({type:"terminal_close",conversationId:C,terminalId:T,_clientId:e.clientId}),M.terminal?.dispose(),delete s[T],delete o[T]);let E=Mt(n[C],T);E?(n[C]=Vue.reactive(E),i[C]===T&&(i[C]=ci(n[C])||""),Vue.nextTick(()=>b(C))):(delete n[C],delete i[C],Vue.nextTick(()=>x()))}function g(){let T=e.currentConversation;!T||!i[T]||v(i[T])}function b(T){if(T||(T=e.currentConversation),!T||!n[T])return;let C=sn(n[T]);for(let M of C){let E=s[M];if(E?.fitAddon&&E.connected)try{E.fitAddon.fit(),e.sendWsMessage({type:"terminal_resize",conversationId:T,terminalId:M,cols:E.terminal.cols,rows:E.terminal.rows,_clientId:e.clientId})}catch{}}}function D(T){let C=T.detail;if(C)switch(C.type){case"terminal_created":{let M=C.terminalId||C.conversationId,E=s[M];if(E)if(C.success)E.connected=!0,r.value="";else{r.value=C.error||t("terminal.createFailed"),E.terminal?.dispose(),delete s[M];let R=C.conversationId;if(R&&n[R]){let H=Mt(n[R],M);H?n[R]=Vue.reactive(H):(delete n[R],delete i[R])}}break}case"terminal_output":{let M=C.terminalId||C.conversationId,E=s[M];E?.terminal&&E.terminal.write(C.data);break}case"terminal_closed":{let M=C.terminalId||C.conversationId,E=s[M];if(E){E.terminal?.dispose(),delete s[M],delete o[M];let R=C.conversationId;if(R&&n[R]){let H=Mt(n[R],M);H?(n[R]=Vue.reactive(H),i[R]===M&&(i[R]=ci(n[R])||"")):(delete n[R],delete i[R])}}break}case"terminal_error":{r.value=C.message||t("terminal.error");let M=C.terminalId;if(M&&s[M]&&!s[M].connected){s[M].terminal?.dispose(),delete s[M];let E=C.conversationId;if(E&&n[E]){let R=Mt(n[E],M);R?n[E]=Vue.reactive(R):(delete n[E],delete i[E])}}break}}}let L=null;function U(){clearTimeout(L),L=setTimeout(()=>b(),100)}function O(){b()}function _(T){let{conversationId:C}=T.detail;if(C&&n[C]){let M=sn(n[C]);for(let E of M){let R=s[E];R&&(R.terminal?.dispose(),delete s[E],delete o[E])}delete n[C],delete i[C]}}Vue.onMounted(()=>{window.addEventListener("workbench-message",D),window.addEventListener("resize",U),window.addEventListener("terminal-fit-all",O),window.addEventListener("conversation-deleted",_)}),Vue.onUnmounted(()=>{window.removeEventListener("workbench-message",D),window.removeEventListener("resize",U),window.removeEventListener("terminal-fit-all",O),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 C=document.querySelector(".terminal-tab");C&&C.offsetParent!==null&&x()})},{immediate:!0}),Vue.watch(()=>e.connectionState,(T,C)=>{if(T==="connected"&&C&&C!=="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(()=>x())}}),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&&(x(),b())};P=new MutationObserver(()=>{setTimeout(T,50)});let C=document.querySelector(".workbench-tab-content");C&&P.observe(C,{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:f,splitPane:S,closeActivePane:g,closePane:v}}}});function di(e){if(!e)return nn(K.default);let t=e.toLowerCase();if(lo[t])return lo[t]();let s=t.lastIndexOf(".");if(s>=0){let n=t.slice(s+1);if(Wd[n])return Wd[n]();let i=t;for(let[r,o]of Object.entries(lo))if(i===r||i.endsWith("/"+r))return o()}return nn(K.default)}function ui(e=!1){return bm(K.folder,e)}var K,nn,bm,z,Wd,lo,co=N(()=>{K={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"},nn=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>`,bm=(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>`,z=(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>`,Wd={js:()=>z(K.js,"JS"),mjs:()=>z(K.js,"JS"),cjs:()=>z(K.js,"JS"),ts:()=>z(K.ts,"TS"),mts:()=>z(K.ts,"TS"),jsx:()=>z(K.jsx,"JSX"),tsx:()=>z(K.tsx,"TSX"),html:()=>z(K.html,"</>"),htm:()=>z(K.html,"</>"),css:()=>z(K.css,"CSS"),scss:()=>z(K.scss,"SC"),sass:()=>z(K.scss,"SA"),less:()=>z(K.less,"LS"),vue:()=>z(K.vue,"V"),svelte:()=>z(K.svelte,"SV"),json:()=>z(K.json,"{ }"),yaml:()=>z(K.yaml,"YML"),yml:()=>z(K.yaml,"YML"),toml:()=>z(K.config,"TML"),xml:()=>z(K.xml,"</>"),csv:()=>z(K.config,"CSV"),md:()=>z(K.md,"MD"),markdown:()=>z(K.md,"MD"),txt:()=>nn(K.txt),log:()=>nn(K.log),pdf:()=>z("#E53935","PDF"),py:()=>z(K.py,"PY"),rb:()=>z(K.rb,"RB"),go:()=>z(K.go,"GO"),rs:()=>z(K.rs,"RS"),java:()=>z(K.java,"JA"),cs:()=>z(K.cs,"C#"),cpp:()=>z(K.cpp,"C+"),cc:()=>z(K.cpp,"C+"),c:()=>z(K.c,"C"),h:()=>z(K.c,"H"),hpp:()=>z(K.cpp,"H+"),swift:()=>z(K.swift,"SW"),kt:()=>z(K.kt,"KT"),php:()=>z(K.php,"PHP"),lua:()=>z(K.lua,"LUA"),r:()=>z(K.r,"R"),dart:()=>z(K.dart,"DA"),sh:()=>z(K.sh,">_"),bash:()=>z(K.sh,">_"),zsh:()=>z(K.sh,">_"),fish:()=>z(K.sh,">_"),ps1:()=>z(K.ps1,"PS"),bat:()=>z(K.ps1,"BAT"),cmd:()=>z(K.ps1,"CMD"),sql:()=>z(K.sql,"SQL"),db:()=>z(K.sql,"DB"),sqlite:()=>z(K.sql,"DB"),svg:()=>z(K.svg,"SVG"),png:()=>z(K.img,"PNG"),jpg:()=>z(K.img,"JPG"),jpeg:()=>z(K.img,"JPG"),gif:()=>z(K.img,"GIF"),ico:()=>z(K.img,"ICO"),webp:()=>z(K.img,"WP"),lock:()=>nn(K.lock),env:()=>z(K.env,"ENV"),ini:()=>z(K.config,"INI"),cfg:()=>z(K.config,"CFG"),conf:()=>z(K.config,"CNF"),liquid:()=>z(K.liquid,"LQ"),ejs:()=>z(K.html,"EJS"),hbs:()=>z(K.html,"HBS"),pug:()=>z(K.html,"PUG"),wasm:()=>z("#654FF0","WA"),proto:()=>z(K.config,"PB"),graphql:()=>z("#E535AB","GQL"),gql:()=>z("#E535AB","GQL")},lo={dockerfile:()=>z(K.docker,"DK"),"docker-compose.yml":()=>z(K.docker,"DC"),"docker-compose.yaml":()=>z(K.docker,"DC"),".gitignore":()=>z(K.git,"GI"),".gitattributes":()=>z(K.git,"GA"),".gitmodules":()=>z(K.git,"GM"),".env":()=>z(K.env,"ENV"),".env.local":()=>z(K.env,"ENV"),".env.development":()=>z(K.env,"ENV"),".env.production":()=>z(K.env,"ENV"),"package.json":()=>z("#CB3837","NPM"),"package-lock.json":()=>z("#CB3837","NPM"),"tsconfig.json":()=>z(K.ts,"TSC"),eslintrc:()=>z("#4B32C3","ESL"),".eslintrc.js":()=>z("#4B32C3","ESL"),".eslintrc.json":()=>z("#4B32C3","ESL"),".prettierrc":()=>z("#F7B93E","PR"),makefile:()=>z(K.config,"MK"),"cmakelists.txt":()=>z("#064F8C","CM"),"readme.md":()=>z(K.md,"RM"),license:()=>z("#F5C518","LIC"),"license.md":()=>z("#F5C518","LIC"),"cargo.toml":()=>z(K.rs,"CG"),"go.mod":()=>z(K.go,"MOD"),"go.sum":()=>z(K.go,"SUM"),gemfile:()=>z(K.rb,"GEM"),rakefile:()=>z(K.rb,"RK"),"requirements.txt":()=>z(K.py,"REQ"),pipfile:()=>z(K.py,"PIP"),csproj:()=>z(K.cs,"CSP"),".sln":()=>z(K.cs,"SLN"),slnx:()=>z(K.cs,"SLN")}});function Wt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function wm(e,t){if(!e||!t)return Wt(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],f=d.index+(d[1]!==void 0?d[0].indexOf(d[1]):0);if(s.push({start:f,end:f+u.length,cls:l}),!c.global)break}},i=t.commentType||"slash";if((i==="slash"||i==="both")&&(n(bs.comment1,Ce.comment),n(bs.commentBlock,Ce.comment)),(i==="hash"||i==="both")&&n(bs.commentHash,Ce.comment),i==="html"&&n(t.commentHtml,Ce.comment),t.commentLine&&n(t.commentLine,Ce.comment),t.commentBlock&&n(t.commentBlock,Ce.comment),n(bs.string,Ce.string),n(bs.number,Ce.number),t.keywords&&n(t.keywords,Ce.keyword),t.builtins&&n(t.builtins,Ce.builtin),t.operators&&n(t.operators,Ce.operator),t.decorators&&n(t.decorators,Ce.decorator),t.macros&&n(t.macros,Ce.macro),t.preprocessor&&n(t.preprocessor,Ce.preprocessor),t.attributes&&n(t.attributes,Ce.attribute),t.tags&&n(t.tags,Ce.tag),t.properties&&n(t.properties,Ce.property),t.variables&&n(t.variables,Ce.variable),t.headings&&n(t.headings,Ce.heading),t.bold&&n(t.bold,Ce.bold),t.links&&n(t.links,Ce.link),t.keys&&n(t.keys,Ce.key),t.sections&&n(t.sections,Ce.section),t.selectors&&n(t.selectors,Ce.keyword),t.values&&n(t.values,Ce.number),t.code&&n(t.code,Ce.string),t.italic&&n(t.italic,Ce.builtin),t.attrs&&n(t.attrs,Ce.attribute),s.length===0)return Wt(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+=Wt(e.slice(o,a.start))),r+=`<span class="${a.cls}">${Wt(e.slice(a.start,a.end))}</span>`,o=a.end);return o<e.length&&(r+=Wt(e.slice(o))),r}function km(e){if(!e)return null;let t=e.split(".").pop()?.toLowerCase();if(!t)return null;let s=Ud[t];return typeof s=="string"&&(s=Ud[s]),s||null}function zd(e,t){if(!e)return Wt(e||"");let s=km(t);return s?wm(e,s):Wt(e)}var bs,Ud,Ce,jd=N(()=>{bs={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},Ud={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}},Ce={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 Kd(e,t,s){let n=[],i=0,r=0;if(t!=null){let p=t.split(`
|
|
1826
1826
|
`);for(let m=0;m<p.length;m++)n.push({type:"addition",oldNum:"",oldText:"",newNum:m+1,newText:p[m]}),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(`
|
|
1827
1827
|
`),a=0,l=0,c=!1,d=[],u=[],f=()=>{let p=Math.max(d.length,u.length);for(let m=0;m<p;m++){let y=d[m],h=u[m];y&&h?n.push({type:"modification",oldNum:y.num,oldText:y.text,newNum:h.num,newText:h.text}):y?n.push({type:"deletion",oldNum:y.num,oldText:y.text,newNum:"",newText:""}):h&&n.push({type:"addition",oldNum:"",oldText:"",newNum:h.num,newText:h.text})}d=[],u=[]};for(let p of o){if(p.startsWith("diff --git")||p.startsWith("index ")||p.startsWith("---")||p.startsWith("+++")||p.startsWith("\\"))continue;let m=p.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(m){f(),a=parseInt(m[1]),l=parseInt(m[2]),c=!0,n.push({type:"hunk",oldNum:"\xB7\xB7\xB7",oldText:p,newNum:"\xB7\xB7\xB7",newText:p});continue}if(c)if(p.startsWith("-"))u.length>0&&d.length===0&&f(),d.push({num:a++,text:p.substring(1)}),r++;else if(p.startsWith("+"))u.push({num:l++,text:p.substring(1)}),i++;else{f();let y=p.startsWith(" ")?p.substring(1):p;n.push({type:"context",oldNum:a++,oldText:y,newNum:l++,newText:y})}}return f(),{lines:n,stats:{additions:i,deletions:r},content:e}}var Yd=N(()=>{});function Gd(e,t){let{effectiveGitWorkDir:s,gitOperating:n,gitOpFeedback:i,commitMessage:r}=t,o=null,a=null,l=(v,g)=>{o&&clearTimeout(o),i.value={ok:v,message:g},o=setTimeout(()=>{i.value=null},4e3)},c=(v,g)=>{e.currentAgent&&(v.value=!0,g.value="",e.sendWsMessage({type:"git_status",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,workDir:s.value,_clientId:e.clientId}))},d=(v,g={})=>{e.currentAgent&&(n.value=!0,a&&clearTimeout(a),a=setTimeout(()=>{n.value&&(n.value=!1,l(!1,"Operation timed out"))},15e3),e.sendWsMessage({type:v,conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,workDir:s.value,_clientId:e.clientId,...g}))};return{showFeedback:l,loadGitStatus:c,gitOp:d,stageFile:v=>d("git_add",{filePath:v}),unstageFile:v=>d("git_reset",{filePath:v}),discardFile:v=>{confirm("Discard changes to "+v+"?")&&d("git_restore",{filePath:v})},stageAll:()=>d("git_add",{addAll:!0}),unstageAll:()=>d("git_reset",{resetAll:!0}),commitChanges:()=>{let v=r.value.trim();v&&d("git_commit",{commitMessage:v})},pushChanges:()=>d("git_push"),handleGitOpResult:(v,g)=>{n.value=!1,a&&(clearTimeout(a),a=null),v.success?(l(!0,v.message||v.operation+" succeeded"),v.operation==="commit"&&(r.value=""),g()):l(!1,v.error||v.operation+" failed")},cleanup:()=>{o&&clearTimeout(o),a&&clearTimeout(a)}}}var Qd=N(()=>{});function Xd(e,t){let s=Vue.ref(!1),n=Vue.ref(""),i=Vue.ref([]),r=Vue.ref(!1),o=Vue.ref(""),a=m=>{r.value=!0,o.value="",e.sendWsMessage({type:"list_directory",conversationId:"_git_folder_picker",agentId:e.currentAgent,dirPath:m,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 m=t.value||"";n.value=m,i.value=[],e.sendWsMessage({type:"list_directory",conversationId:"_git_folder_picker",agentId:e.currentAgent,dirPath:m,workDir:t.value,_clientId:e.clientId})},folderPickerNavigateUp:()=>{if(!n.value)return;let m=n.value.includes("\\"),y=m?"\\":"/",h=n.value.replace(/[/\\]$/,"").split(/[/\\]/);if(h.pop(),h.length===0)n.value="",a("");else if(m&&h.length===1&&/^[A-Za-z]:$/.test(h[0]))n.value=h[0]+"\\",a(h[0]+"\\");else{let A=h.join(y);n.value=A,a(A)}},folderPickerSelectItem:m=>{o.value=m.name},folderPickerEnter:m=>{let y=n.value.includes("\\")||/^[A-Z]:/.test(m.name)?"\\":"/",h;n.value?h=n.value.replace(/[/\\]$/,"")+y+m.name:h=m.name+(m.name.endsWith("\\")?"":"\\"),n.value=h,a(h)},confirmFolderPicker:(m,y)=>{let h=n.value;if(h){if(o.value){let A=h.includes("\\")?"\\":"/";h=h.replace(/[/\\]$/,"")+A+o.value}m.value=h,s.value=!1,y()}},handleDirectoryListing:m=>m.conversationId!=="_git_folder_picker"?!1:(r.value=!1,i.value=(m.entries||[]).filter(y=>y.type==="directory").sort((y,h)=>y.name.localeCompare(h.name)),m.dirPath!=null&&(n.value=m.dirPath),!0)}}var Zd=N(()=>{});var Jd,eu=N(()=>{co();jd();Yd();Qd();Zd();Jd={name:"GitStatusTab",template:`
|
|
1828
1828
|
<div class="git-status-tab git-three-col">
|
|
@@ -2068,7 +2068,7 @@ ${String(e||"").trim()}
|
|
|
2068
2068
|
</div>
|
|
2069
2069
|
</div>
|
|
2070
2070
|
</div>
|
|
2071
|
-
`,setup(){let e=Pinia.useChatStore(),t=Vue.inject("t"),s=Q=>Q.split(/[/\\]/).pop()||Q,n=Q=>{let q=Q.split(/[/\\]/);return q.pop(),q.join("/")},i=Q=>di(s(Q)),r=Vue.ref(null),o=Vue.reactive({staged:!1,modified:!1,untracked:!1}),a=Q=>{o[Q]=!o[Q]},l=Vue.ref(!1),c=Vue.ref(""),d=Vue.ref(null),u=Vue.ref([]),f=Vue.computed(()=>e.effectiveWorkDir||""),p=Vue.ref(""),m=Vue.computed(()=>p.value.trim()||f.value),y=Vue.ref(null),h=Vue.ref(!1),A=Vue.ref(!1),x=Vue.ref(""),S=Vue.ref(null),v=Vue.ref([]),g=Vue.ref(null),b=Vue.ref(!0),D=Vue.ref(!1),L=Vue.ref(""),U=Vue.ref(null),F=Vue.ref(0),_=Vue.ref(0),P=Q=>Q==null||Q===""?"":zd(Q,y.value||""),T=Vue.ref(parseInt(localStorage.getItem("gitDiffFontSize"))||12),C=Q=>{T.value=Math.max(8,Math.min(24,Q)),localStorage.setItem("gitDiffFontSize",T.value.toString())},M=()=>C(T.value+1),E=()=>C(T.value-1),R=Q=>{Q.deltaY<0?M():Q.deltaY>0&&E()},H=Vue.computed(()=>{let Q=v.value;if(!Q||Q.length===0)return[];let q=Q.length,te=[],se=0;for(;se<q;){let be=Q[se];if(be.type==="addition"||be.type==="deletion"||be.type==="modification"){let j=be.type==="modification"?"modification":be.type,ee=se;for(;se<q&&(Q[se].type===j||Q[se].type==="modification"&&j!=="modification");)se++;let me=se-ee;te.push({type:j,top:ee/q*100,height:Math.max(me/q*100,.5)})}else se++}return te}),G=Q=>{let q=r.value;if(!q)return;let te=Q.currentTarget.getBoundingClientRect(),se=(Q.clientY-te.top)/te.height;q.scrollTop=se*(q.scrollHeight-q.clientHeight)},ue=Vue.computed(()=>u.value.filter(Q=>Q.indexStatus!==" "&&Q.indexStatus!=="?")),J=Vue.computed(()=>u.value.filter(Q=>Q.workTreeStatus==="M"||Q.workTreeStatus==="D")),ve=Vue.computed(()=>u.value.filter(Q=>Q.indexStatus==="?"&&Q.workTreeStatus==="?")),ae=Gd(e,{effectiveGitWorkDir:m,gitOperating:D,gitOpFeedback:U,commitMessage:L}),$=()=>ae.loadGitStatus(l,c),w=()=>{$()},B=Xd(e,m),X=Q=>ui(Q),re=()=>B.confirmFolderPicker(p,$),ke=(Q,q)=>{y.value=Q.path,h.value=q,A.value=!0,x.value="",S.value=null,v.value=[],g.value=null;let te=Q.indexStatus==="?"&&Q.workTreeStatus==="?";e.sendWsMessage({type:"git_diff",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,workDir:m.value,filePath:Q.path,staged:q,untracked:te,fullFile:b.value,_clientId:e.clientId})},Pe=()=>{if(b.value=!b.value,y.value){let Q=u.value.find(q=>q.path===y.value);Q&&ke(Q,h.value)}},De=Q=>{let q=Q.detail;if(q)switch(q.type){case"directory_listing":{if(B.handleDirectoryListing(q))return;break}case"git_status_result":{if(l.value=!1,q.error){c.value=q.error,d.value=null,u.value=[];return}if(c.value="",d.value=q.branch||"HEAD",u.value=q.files||[],F.value=q.ahead||0,_.value=q.behind||0,y.value){let te=u.value.find(se=>se.path===y.value);if(te){let se=te.indexStatus!==" "&&te.indexStatus!=="?";h.value=se}else y.value=null,S.value=null,v.value=[],g.value=null}break}case"git_diff_result":{if(A.value=!1,q.error){x.value=q.error;return}x.value="";let te=Kd(q.diff,q.newFileContent,t);g.value=te.stats,v.value=te.lines,S.value=te.content;break}case"git_op_result":{ae.handleGitOpResult(q,$);break}}};Vue.watch(()=>e.currentAgent,()=>{d.value=null,u.value=[],c.value="",y.value=null,S.value=null,e.currentAgent&&Vue.nextTick(()=>$())}),Vue.watch(()=>e.currentConversation,()=>{e.currentAgent&&(y.value=null,S.value=null,v.value=[],g.value=null,Vue.nextTick(()=>$()))});let ne=()=>$();return Vue.onMounted(()=>{window.addEventListener("workbench-message",De),e.currentAgent&&$()}),Vue.onUnmounted(()=>{window.removeEventListener("workbench-message",De),ae.cleanup()}),{store:e,getFileName:s,getDirName:n,getFileIconHtml:i,hlLine:P,collapsedGroups:o,toggleGroup:a,gitLoading:l,gitError:c,gitBranch:d,gitFiles:u,gitWorkDir:p,defaultWorkDir:f,changeGitWorkDir:w,stagedFiles:ue,modifiedFiles:J,untrackedFiles:ve,selectedGitFile:y,selectedStaged:h,diffLoading:A,diffError:x,diffContent:S,diffLines:v,diffStats:g,diffFullFile:b,toggleDiffMode:Pe,scrollMarkers:H,diffScrollContainer:r,onMarkerClick:G,fontSize:T,zoomIn:M,zoomOut:E,onWheel:R,gitOperating:D,commitMessage:L,gitOpFeedback:U,gitAhead:F,gitBehind:_,stageFile:ae.stageFile,unstageFile:ae.unstageFile,discardFile:ae.discardFile,stageAll:ae.stageAll,unstageAll:ae.unstageAll,commitChanges:ae.commitChanges,pushChanges:ae.pushChanges,selectGitFile:ke,refresh:ne,folderPickerOpen:B.folderPickerOpen,folderPickerPath:B.folderPickerPath,folderPickerEntries:B.folderPickerEntries,folderPickerLoading:B.folderPickerLoading,folderPickerSelected:B.folderPickerSelected,getFolderIcon:X,openFolderPicker:B.openFolderPicker,folderPickerNavigateUp:B.folderPickerNavigateUp,folderPickerSelectItem:B.folderPickerSelectItem,folderPickerEnter:B.folderPickerEnter,confirmFolderPicker:re}}}});function tu(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=[],f=[],p=()=>{let F=e.value?.cmInstance;if(!F)return;let P=F.getWrapperElement().querySelector(".cm-find-scrollbar-annotations");P&&P.remove()},m=()=>{let F=e.value?.cmInstance;if(!F||f.length===0)return;p();let _=F.getWrapperElement();if(!_.querySelector(".CodeMirror-vscrollbar"))return;let T=F.lineCount();if(T===0)return;let C=document.createElement("div");C.className="cm-find-scrollbar-annotations";for(let M of f){let E=M.from.line/T*100,R=document.createElement("div");R.className="cm-find-scrollbar-tick",R.style.top=E+"%",C.appendChild(R)}_.appendChild(C)},y=()=>{for(let F of u)try{F.clear()}catch{}u=[],f=[],a.value=0,l.value=-1,p()},h=F=>{let _=e.value?.cmInstance;if(!_||!f[F])return;for(let T=0;T<u.length;T++){if(!u[T])continue;let C=u[T].find();C&&(u[T].clear(),u[T]=_.markText(C.from,C.to,{className:"cm-find-highlight"}))}let P=f[F];if(u[F]){let T=u[F].find();T&&(u[F].clear(),u[F]=_.markText(T.from,T.to,{className:"cm-find-highlight cm-find-current"}))}setTimeout(()=>{_.scrollIntoView({from:P.from,to:P.to},100)},0)},A=()=>{y();let F=e.value?.cmInstance;if(!F||!n.value)return;let _=n.value;if(_.length<3)return;let P=F.getValue(),T=r.value,C=o.value,M=[];try{if(C){let E=T?"g":"gi",R=new RegExp(_,E),H;for(;(H=R.exec(P))!==null;){if(H[0].length===0){R.lastIndex++;continue}let G=F.posFromIndex(H.index),ue=F.posFromIndex(H.index+H[0].length);if(M.push({from:G,to:ue}),M.length>1e4)break}}else{let E=T?_:_.toLowerCase(),R=T?P:P.toLowerCase(),H=0;for(;(H=R.indexOf(E,H))!==-1;){let G=F.posFromIndex(H),ue=F.posFromIndex(H+_.length);if(M.push({from:G,to:ue}),H+=_.length,M.length>1e4)break}}}catch{return}f=M,a.value=M.length;for(let E of M)u.push(F.markText(E.from,E.to,{className:"cm-find-highlight"}));if(M.length>0){let E=F.getCursor(),R=0;for(let H=0;H<M.length;H++){if(CodeMirror.cmpPos(M[H].from,E)>=0){R=H;break}H===M.length-1&&(R=0)}l.value=R,h(R)}m()};return{findBarVisible:t,replaceBarVisible:s,findQuery:n,replaceQuery:i,findCaseSensitive:r,findUseRegex:o,findMatchCount:a,findMatchIndex:l,findInputRef:c,replaceInputRef:d,clearFindMarkers:y,performFind:A,onFindInput:()=>{A()},findNext:()=>{if(f.length===0)return;let F=(l.value+1)%f.length;l.value=F,h(F)},findPrev:()=>{if(f.length===0)return;let F=(l.value-1+f.length)%f.length;l.value=F,h(F)},openFindBar:(F=!1)=>{t.value=!0,s.value=F;let _=e.value?.cmInstance;if(_){let P=_.getSelection();P&&(n.value=P)}Vue.nextTick(()=>{c.value?.focus(),c.value?.select(),n.value&&A()})},closeFindBar:()=>{y(),t.value=!1,s.value=!1;let F=e.value?.cmInstance;F&&F.focus()},toggleReplaceBar:()=>{s.value=!s.value,s.value&&Vue.nextTick(()=>d.value?.focus())},replaceOne:()=>{let F=e.value?.cmInstance;if(!F||f.length===0||l.value<0)return;let _=f[l.value];F.replaceRange(i.value,_.from,_.to),A()},replaceAll:()=>{let F=e.value?.cmInstance;!F||f.length===0||(F.operation(()=>{for(let _=f.length-1;_>=0;_--)F.replaceRange(i.value,f[_].from,f[_].to)}),A())}}}var su=N(()=>{});function nu(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(""),f=Vue.ref("file"),p=Vue.ref(null),m=Vue.ref(!1),y=Vue.ref(""),h=Vue.ref(null),A=Vue.reactive({visible:!1,x:0,y:0,entry:null}),x=Vue.ref(!1),S=Vue.ref(""),v=Vue.ref(null),g=null,b=Vue.reactive({dragging:null,dropTarget:null}),D=Vue.ref(!1),L=(j,ee)=>{l&&clearTimeout(l),a.value={ok:j,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)},F=j=>{i.has(j)?i.delete(j):i.add(j)},_=()=>{i.clear(),r.value=-1},P=j=>{f.value=j,u.value="",d.value=!0,Vue.nextTick(()=>p.value?.focus())},T=()=>{let j=u.value.trim();if(!j)return;d.value=!1;let ee=n.value||s();if(!ee)return;let me=ee.includes("\\")?"\\":"/",ge=ee.replace(/[/\\]$/,"")+me+j;U(),e.sendWsMessage({type:"create_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:ge,isDirectory:f.value==="directory",workDir:s(),_clientId:e.clientId})},C=(j,ee)=>{let me=j.path.split("/").pop();confirm(ee("files.deleteConfirm",{name:me})+(j.type==="directory"?ee("files.deleteDirHint"):""))&&(U(),e.sendWsMessage({type:"delete_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[j.path],workDir:s(),_clientId:e.clientId}))},M=j=>{let ee=i.size;ee!==0&&confirm(j("files.deleteSelectedConfirm",{count:ee}))&&(U(),e.sendWsMessage({type:"delete_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[...i],workDir:s(),_clientId:e.clientId}))},E=()=>{y.value=n.value||s()||"",m.value=!0,Vue.nextTick(()=>h.value?.focus())},R=()=>{let j=y.value.trim();!j||i.size===0||(m.value=!1,U(),e.sendWsMessage({type:"move_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[...i],destination:j,workDir:s(),_clientId:e.clientId}))},H=(j,ee)=>{let Ee=j.clientX,Oe=j.clientY;Ee+180>window.innerWidth&&(Ee=window.innerWidth-180),Oe+240>window.innerHeight&&(Oe=window.innerHeight-240),A.entry=ee,A.x=Ee,A.y=Oe,A.visible=!0},G=()=>{A.visible=!1};return{selectedPaths:i,lastClickedIndex:r,fileOperating:o,fileOpFeedback:a,newFileDialogVisible:d,newFileName:u,newFileType:f,newFileInput:p,moveDialogVisible:m,moveDestination:y,moveDestInput:h,contextMenu:A,renameDialogVisible:x,renameNewName:S,renameInput:v,dragState:b,externalDropActive:D,showFileOpFeedback:L,toggleSelection:F,clearSelection:_,showNewFileDialog:P,confirmNewFile:T,deleteSingleFile:C,deleteSelected:M,openMoveDialog:E,confirmMove:R,showContextMenu:H,hideContextMenu:G,ctxRename:()=>{let j=A.entry;G(),j&&(S.value=j.name,x.value=!0,Vue.nextTick(()=>{let ee=v.value;if(ee)if(ee.focus(),j.type==="file"){let me=j.name.lastIndexOf(".");me>0?ee.setSelectionRange(0,me):ee.select()}else ee.select()}))},confirmRename:()=>{let j=A.entry,ee=S.value.trim();if(!ee||!j||ee===j.name){x.value=!1;return}x.value=!1;let me=j.path.replace(/\/$/,"").split("/");me.pop();let ge=me.join("/")||"/";U(),e.sendWsMessage({type:"move_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[j.path],destination:ge,newName:ee,workDir:s(),_clientId:e.clientId})},ctxCopy:()=>{let j=A.entry;if(G(),!j)return;let ee=j.path.replace(/\/$/,"").split("/");ee.pop();let me=ee.join("/")||"/";U(),e.sendWsMessage({type:"copy_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[j.path],destination:me,workDir:s(),_clientId:e.clientId})},ctxMoveTo:()=>{let j=A.entry;G(),j&&(i.clear(),i.add(j.path),E())},ctxDelete:j=>{let ee=A.entry;G(),ee&&C(ee,j)},ctxDownload:()=>{let j=A.entry;G(),!(!j||j.type!=="file")&&(g=j.path,e.sendWsMessage({type:"read_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:j.path,workDir:s(),_clientId:e.clientId}))},onDragStart:(j,ee)=>{b.dragging=ee,j.dataTransfer.setData("text/plain",ee.path),j.dataTransfer.effectAllowed="move"},onDragOver:(j,ee)=>{if(!b.dragging&&j.dataTransfer.types.includes("Files")){ee.type==="directory"&&(j.dataTransfer.dropEffect="copy",b.dropTarget=ee.path);return}!b.dragging||ee.type!=="directory"||ee.path!==b.dragging.path&&(ee.path.startsWith(b.dragging.path+"/")||(j.dataTransfer.dropEffect="move",b.dropTarget=ee.path))},onDragLeave:j=>{let ee=j.relatedTarget;ee&&j.currentTarget.contains(ee)||(b.dropTarget=null)},onDrop:(j,ee,me)=>{if(b.dropTarget=null,!b.dragging&&j.dataTransfer.files.length>0&&ee.type==="directory"){me(j.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:j=>{b.dragging||j.dataTransfer.types.includes("Files")&&(j.dataTransfer.dropEffect="copy",D.value=!0)},onTreeDragLeave:j=>{let ee=j.relatedTarget;ee&&j.currentTarget.contains(ee)||(D.value=!1)},onTreeDrop:(j,ee,me)=>{if(D.value=!1,!b.dragging&&j.dataTransfer.files.length>0){let ge=n.value||ee||s();me(j.dataTransfer.files,ge)}},handleExternalFileDrop:async(j,ee)=>{if(!ee)return;let me=[],ge=[];for(let Ee of j)ge.push(new Promise(Oe=>{let He=new FileReader;He.onload=()=>{let O=btoa(new Uint8Array(He.result).reduce((Z,pe)=>Z+String.fromCharCode(pe),""));me.push({name:Ee.name,data:O}),Oe()},He.onerror=()=>Oe(),He.readAsArrayBuffer(Ee)}));await Promise.all(ge),me.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:me,dirPath:ee,workDir:s(),_clientId:e.clientId}))},handleFileOpResult:(j,ee,me)=>{o.value=!1,c&&(clearTimeout(c),c=null),L(j.success,j.success?j.message:j.error||"Operation failed"),j.success&&(me&&ee(me),(j.operation==="delete"||j.operation==="move")&&(i.clear(),r.value=-1))},getPendingDownload:()=>g,clearPendingDownload:()=>{g=null},cleanup:()=>{l&&clearTimeout(l),c&&clearTimeout(c)}}}var iu=N(()=>{});function ru(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),f=Vue.computed(()=>{if(!l.value)return"EXPLORER";let P=l.value.replace(/[\\/]+$/,"").split(/[\\/]/);return(P[P.length-1]||l.value).toUpperCase()}),p=Vue.computed(()=>l.value?!!c[l.value]?.expanded:!1),m=()=>{if(!l.value)return;let P=c[l.value];P&&(P.expanded=!P.expanded)},y=()=>{for(let P of Object.keys(c))c[P]&&(c[P].expanded=!1)},h=()=>{d.value=!0,Vue.nextTick(()=>u.value?.focus())},A=()=>{d.value=!1,g()},x=()=>{d.value=!1},S=Vue.computed(()=>{let P=[],T=(C,M)=>{let E=c[C];if(!(!E||!E.entries))for(let R of E.entries)P.push({...R,depth:M}),R.type==="directory"&&c[R.path]?.expanded&&T(R.path,M+1)};return l.value&&c[l.value]?.expanded&&T(l.value,0),P}),v=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})},g=()=>{let P=a.value.trim();if(!P)return;let T=s(P);l.value=T,Object.keys(c).forEach(C=>delete c[C]),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),C=c[T];C?C.loaded?C.expanded=!C.expanded:(C.expanded=!0,v(P)):(c[T]={entries:[],expanded:!0,loaded:!1,loading:!1},v(P))},D=(P,T)=>{let C=S.value,M=C.findIndex(E=>E.path===P.path);if(T&&(T.shiftKey||T.ctrlKey||T.metaKey)){if(T.shiftKey&&i.value>=0&&M>=0){let E=Math.min(i.value,M),R=Math.max(i.value,M);!T.ctrlKey&&!T.metaKey&&n.clear();for(let H=E;H<=R;H++)n.add(C[H].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 C=(P.entries||[]).sort((R,H)=>R.type===H.type?R.name.localeCompare(H.name):R.type==="directory"?-1:1),M=T.replace(/\/$/,""),E=C.map(R=>({...R,path:M+"/"+R.name}));c[T]?(c[T].entries=E,c[T].loaded=!0,c[T].loading=!1):c[T]={entries:E,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:S,editingTreePath:d,treePathInputRef:u,rootFolderName:f,rootExpanded:p,toggleRootExpand:m,collapseAll:y,startTreePathEdit:h,confirmTreePath:A,cancelTreePathEdit:x,loadTreeDirectory:v,loadRootDirectory:g,toggleDirectory:b,onTreeItemClick:D,handleDirectoryListing:L,clearTreeNodes:U,initFileBrowser:()=>{let P=t();if(P){let T=s(P);a.value=P,l.value=T,U(),v(P)}},refresh:()=>{l.value&&v(l.value)}}}var ou=N(()=>{});function ws(e){let t=e.lastIndexOf(".");if(t<0)return"text";let s=e.substring(t).toLowerCase();return Sm.has(s)?"office":Cm.has(s)?"pdf":Im.has(s)?"image":"text"}function St(e){let t=e.lastIndexOf(".");return t<0?!1:Am.has(e.substring(t).toLowerCase())}function xm(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 au(e,{activeFile:t,editorContainer:s,fontSize:n,clearFindMarkers:i,openFindBar:r,saveFile:o}){let a=Vue.ref(""),l=Vue.reactive({}),c=()=>{},d=()=>{},u=({openQuickOpen:x,openGoToLine:S})=>{c=x,d=S},f=(x,S=0)=>{if(!s.value){S<20&&setTimeout(()=>f(x,S+1),100);return}if(!x)return;if(s.value.innerHTML="",typeof CodeMirror>"u"){let b=document.createElement("textarea");b.value=x.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",()=>{x.content=b.value,x.isDirty=b.value!==x.originalContent}),b.addEventListener("keydown",D=>{(D.ctrlKey||D.metaKey)&&D.key==="s"&&(D.preventDefault(),o())}),s.value.appendChild(b),a.value="";return}let g=document.documentElement.getAttribute("data-theme")==="dark"?"material-darker":"default";try{let b=CodeMirror(s.value,{value:x.content||"",mode:xm(x.name),theme:g,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();x.content=L,x.isDirty=L!==x.originalContent}),x.cmInstance=b,b.getWrapperElement().style.fontSize=n.value+"px";let D=e.currentConversation;D&&l[D]?.[x.path]&&b.setHistory(l[D][x.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:f,destroyEditor:()=>{i();let x=t.value;x?.cmInstance&&(x.cmInstance.toTextArea&&x.cmInstance.toTextArea(),x.cmInstance=null),s.value&&(s.value.innerHTML="")},setKeyBindings:u,saveCurrentUndoHistory:()=>{let x=e.currentConversation;if(!x)return;let S=t.value;S?.cmInstance&&(l[x]||(l[x]={}),l[x][S.path]=S.cmInstance.getHistory())},saveAllUndoHistory:x=>{if(!x)return;let S=t.value;S?.cmInstance&&(l[x]||(l[x]={}),l[x][S.path]=S.cmInstance.getHistory())},cleanupUndoHistory:(x,S)=>{x&&l[x]&&delete l[x][S]},deleteConversationHistory:x=>{delete l[x]}}}var Sm,Cm,Im,Am,rn=N(()=>{Sm=new Set([".docx",".xlsx",".xls",".pptx",".ppt"]),Cm=new Set([".pdf"]),Im=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico"]),Am=new Set([".md",".markdown",".mdx"])});function lu(e,{editorContainer:t,createEditor:s,t:n}){let i=Vue.ref(!0),r=Vue.ref(null),o=Vue.ref(null),a=Vue.computed(()=>{let p=e.value;return!!(p&&St(p.name))}),l=Vue.computed(()=>{let p=e.value;if(!p||!St(p.name)||p.content==null)return"";try{if(typeof marked<"u")return marked.parse(p.content)}catch{}return"<pre>"+(p.content||"")+"</pre>"});function c(){Xe(r.value)}async function d(){await Xe(r.value)}function u(){i.value=!1,Vue.nextTick(()=>{let p=e.value;p&&t.value&&s(p)})}return{mdPreviewMode:i,mdPreviewRef:r,officePreviewContainer:o,isActiveMarkdown:a,mdRenderedHtml:l,initMermaid:c,renderMermaidBlocks:d,switchToMdEdit:u,renderOfficeLocal:p=>{let m=o.value;if(!m||!p._arrayBuffer)return;m.innerHTML="";let y=("."+p.name.split(".").pop()).toLowerCase();if(y===".docx"&&window.docx)window.docx.renderAsync(p._arrayBuffer,m,null,{className:"docx-preview-content",inWrapper:!0,ignoreWidth:!1,ignoreHeight:!0}).catch(h=>{p.previewError=h.message});else if(y===".xlsx"||y===".xls")try{let h=XLSX.read(p._arrayBuffer,{type:"array"}),A=h.SheetNames[0],x=XLSX.utils.sheet_to_html(h.Sheets[A],{editable:!1});m.innerHTML='<div class="xlsx-sheet-tabs">'+h.SheetNames.map((S,v)=>`<button class="xlsx-sheet-tab${v===0?" active":""}" data-idx="${v}">${S}</button>`).join("")+'</div><div class="xlsx-table-wrap">'+x+"</div>",m.querySelectorAll(".xlsx-sheet-tab").forEach(S=>{S.addEventListener("click",()=>{let v=parseInt(S.dataset.idx),g=h.SheetNames[v],b=XLSX.utils.sheet_to_html(h.Sheets[g],{editable:!1});m.querySelector(".xlsx-table-wrap").innerHTML=b,m.querySelectorAll(".xlsx-sheet-tab").forEach(D=>D.classList.remove("active")),S.classList.add("active")})})}catch(h){p.previewError=h.message}else(y===".pptx"||y===".ppt")&&(m.innerHTML='<div class="preview-unsupported">'+(n?n("files.pptxNotSupported"):"PowerPoint preview not supported")+"</div>")}}}var cu=N(()=>{Qs();rn()});function du(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,f=Vue.ref(!1),p=Vue.ref(""),m=Vue.ref([]),y=Vue.ref(0),h=Vue.ref(!1),A=Vue.ref(null),x=null,S=Vue.ref(!1),v=Vue.ref(""),g=Vue.ref(null),b=J=>{!e.currentAgent||!J.trim()||e.sendWsMessage({type:"file_search",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,query:J.trim(),dirPath:s.value||t()||"",_clientId:e.clientId})},D=()=>{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=J=>{if(J.type==="directory"){let ve=i(J.fullPath);r.value=ve,s.value=J.fullPath,Object.keys(o).forEach(ae=>delete o[ae]),a(J.fullPath),L()}else n(J.fullPath,J.name),L()},F=()=>{f.value=!0,p.value="",m.value=[],y.value=0,h.value=!1,Vue.nextTick(()=>A.value?.focus())},_=()=>{f.value=!1,p.value="",m.value=[]},P=()=>{if(x&&clearTimeout(x),!p.value.trim()){m.value=[],h.value=!1;return}h.value=!0,y.value=0,x=setTimeout(()=>{b(p.value)},200)},T=()=>{m.value.length>0&&(y.value=(y.value+1)%m.value.length)},C=()=>{m.value.length>0&&(y.value=(y.value-1+m.value.length)%m.value.length)},M=J=>{J.type!=="directory"&&n(J.fullPath,J.name),_()},E=()=>{let J=m.value[y.value];J&&M(J)},R=()=>{S.value=!0,v.value="",Vue.nextTick(()=>g.value?.focus())},H=()=>{S.value=!1,v.value=""};return{searchQuery:l,searchResults:c,searchLoading:d,onSearchInput:D,clearSearch:L,onSearchResultClick:U,quickOpenVisible:f,quickOpenQuery:p,quickOpenResults:m,quickOpenSelectedIndex:y,quickOpenLoading:h,quickOpenInput:A,openQuickOpen:F,closeQuickOpen:_,onQuickOpenInput:P,quickOpenSelectNext:T,quickOpenSelectPrev:C,quickOpenConfirm:E,quickOpenOpenFile:M,goToLineVisible:S,goToLineValue:v,goToLineInput:g,openGoToLine:R,closeGoToLine:H,goToLineConfirm:J=>{let ve=parseInt(v.value);if(isNaN(ve)||ve<1)return;let ae=J.value;if(ae?.cmInstance){let $=ae.cmInstance,w=Math.min(ve-1,$.lineCount()-1);$.setCursor({line:w,ch:0}),$.scrollIntoView({line:w,ch:0},100),$.focus()}H()},handleFileSearchResult:J=>{let ve=J.results||[];f.value?J.query&&J.query.trim()===p.value.trim()&&(m.value=ve,h.value=!1,y.value=0):J.query&&J.query.trim()===l.value.trim()&&(c.value=ve,d.value=!1)}}}var uu=N(()=>{});function pu(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(""),f=()=>{a.value=!0,u.value="",d.value=!0;let S=s.value||t()||"";l.value=S,c.value=[],e.sendWsMessage({type:"list_directory",conversationId:"_folder_picker",agentId:e.currentAgent,dirPath:S,workDir:t(),_clientId:e.clientId})},p=S=>{d.value=!0,u.value="",e.sendWsMessage({type:"list_directory",conversationId:"_folder_picker",agentId:e.currentAgent,dirPath:S,workDir:t(),_clientId:e.clientId})};return{folderPickerOpen:a,folderPickerPath:l,folderPickerEntries:c,folderPickerLoading:d,folderPickerSelected:u,openFolderPicker:f,folderPickerNavigateUp:()=>{if(!l.value)return;let S=l.value.includes("\\"),v=S?"\\":"/",g=l.value.replace(/[/\\]$/,"").split(/[/\\]/);if(g.pop(),g.length===0)l.value="",p("");else if(S&&g.length===1&&/^[A-Za-z]:$/.test(g[0]))l.value=g[0]+"\\",p(g[0]+"\\");else{let b=g.join(v);l.value=b,p(b)}},folderPickerSelectItem:S=>{u.value=S.name},folderPickerEnter:S=>{let v;if(!l.value)v=S.name+(S.name.endsWith("\\")?"":"\\");else{let g=l.value.includes("\\")||/^[A-Z]:/.test(S.name)?"\\":"/";v=l.value.replace(/[/\\]$/,"")+g+S.name}l.value=v,p(v)},confirmFolderPicker:()=>{let S=l.value;if(!S)return;if(u.value){let g=S.includes("\\")?"\\":"/";S=S.replace(/[/\\]$/,"")+g+u.value}s.value=S,a.value=!1;let v=r(S);n.value=v,Object.keys(i).forEach(g=>delete i[g]),i[v]={entries:[],expanded:!0,loaded:!1,loading:!0},e.sendWsMessage({type:"list_directory",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,dirPath:S,workDir:t(),_clientId:e.clientId})},handleFolderPickerListing:S=>{d.value=!1,c.value=(S.entries||[]).filter(v=>v.type==="directory").sort((v,g)=>v.name.localeCompare(g.name)),S.dirPath!=null&&(l.value=S.dirPath)}}}var fu=N(()=>{});function gu(e,{normalizePath:t,getEffectiveWorkDir:s,editorContainer:n,createEditor:i,destroyEditor:r,clearFindMarkers:o,saveCurrentUndoHistory:a,saveAllUndoHistory:l,cleanupUndoHistory:c,deleteConversationHistory:d,debugStatus:u,mdPreviewMode:f,renderOfficeLocal:p,performFind:m,findBarVisible:y,findQuery:h,t:A}){let x=Vue.reactive({}),S=Vue.ref([]),v=Vue.ref(-1),g=Vue.ref(!1),b=Vue.ref(!1),D=Vue.computed(()=>v.value>=0&&v.value<S.value.length?S.value[v.value]:null),L=null,U=()=>{L&&clearTimeout(L),L=setTimeout(()=>{e.sendWsMessage({type:"update_file_tabs",openFiles:S.value.map(R=>({path:R.path})),activeIndex:v.value})},500)},F=R=>{R&&(l(R),S.value.length>0?x[R]={files:S.value.map(H=>({path:H.path,name:H.name,content:H.content,originalContent:H.originalContent,isDirty:H.isDirty,fileType:H.fileType})),activeIndex:v.value}:delete x[R],U())},_=R=>{if(r(),!R||!x[R]){S.value=[],v.value=-1;return}let H=x[R];S.value=H.files.map(G=>({...G,isDirty:G.isDirty||!1,originalContent:G.originalContent||G.content,cmInstance:null,fileType:G.fileType||ws(G.name||""),blobUrl:null,previewUrl:null,previewLoading:!1,localPreviewReady:!1,previewError:null})),v.value=H.activeIndex,Vue.nextTick(()=>{let G=D.value;G&&(!G.fileType||G.fileType==="text")&&n.value&&i(G)})};function P(R,H){let G=t(R),ue=S.value.findIndex(ae=>ae.path===G);if(ue>=0){v.value!==ue&&(o(),a(),v.value=ue,Vue.nextTick(()=>{let ae=S.value[ue];ae&&ae.content!=null&&(!ae.fileType||ae.fileType==="text")&&i(ae)})),F(e.currentConversation);return}a();let J=H||G.split(/[/\\]/).pop(),ve=ws(J);S.value.push({path:G,name:J,content:null,originalContent:null,isDirty:!1,cmInstance:null,fileType:ve,blobUrl:null,previewUrl:null,previewLoading:ve!=="text",localPreviewReady:!1,previewError:null}),v.value=S.value.length-1,g.value=!0,ve==="text"&&r(),F(e.currentConversation),u.value=`Loading: ${R}`,e.sendWsMessage({type:"read_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:R,workDir:s(),_clientId:e.clientId})}let T=R=>{R!==v.value&&(o(),a(),v.value=R,F(e.currentConversation),Vue.nextTick(()=>{let H=S.value[R];H&&(!H.fileType||H.fileType==="text"?St(H.name)?f.value=!0:H.content!=null&&n.value&&(i(H),y.value&&h.value&&Vue.nextTick(()=>m())):H.fileType==="office"&&H.localPreviewReady&&Vue.nextTick(()=>p(H)))}))},C=R=>{let H=S.value[R];if(H?.isDirty&&!confirm(A("files.unsavedConfirm",{name:H.name})))return;c(e.currentConversation,H.path),H.blobUrl&&URL.revokeObjectURL(H.blobUrl);let G=R===v.value;S.value.splice(R,1),S.value.length===0?(v.value=-1,r()):v.value>=S.value.length?v.value=S.value.length-1:v.value>R?v.value--:G&&v.value>=S.value.length&&(v.value=S.value.length-1),F(e.currentConversation),S.value.length>0&&G&&Vue.nextTick(()=>{let ue=S.value[v.value];ue&&(!ue.fileType||ue.fileType==="text")&&ue.content!=null&&n.value&&i(ue)})};function M(){let R=D.value;!R||!R.isDirty||(b.value=!0,e.sendWsMessage({type:"write_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:R.path,content:R.content,workDir:s(),_clientId:e.clientId}))}return{fileTabsMap:x,openFiles:S,activeFileIndex:v,activeFile:D,fileLoading:g,fileSaving:b,saveTabsState:F,restoreTabsState:_,openFileInTab:P,switchToTab:T,closeFileTab:C,saveFile:M,handleConversationDeleted:R=>{let{conversationId:H}=R.detail;H&&(delete x[H],d(H))}}}var mu=N(()=>{rn()});function hu({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:f,qo:p,ops:m,mdPreviewMode:y,renderOfficeLocal:h,editorContainer:A,debugStatus:x}){return{handleWorkbenchMessage:g=>{let b=g.detail;if(b)switch(b.type){case"directory_listing":{if(b.conversationId==="_folder_picker"){f.handleFolderPickerListing(b);return}u.handleDirectoryListing(b);break}case"file_content":{if(o.value=!1,b.error){x.value=`Error: ${b.error}`,m.clearPendingDownload();let U=t(b.filePath),F=n.value.find(_=>_.path===U);F&&(F.previewLoading=!1,F.previewError=b.error);return}let D=t(b.filePath);if(m.getPendingDownload()&&t(m.getPendingDownload())===D){m.clearPendingDownload();try{if(b.binary){let U=`${location.protocol}//${location.host}/api/preview/${b.fileId}?token=${b.previewToken}`,F=document.createElement("a");F.href=U,F.download=D.split("/").pop()||"download",document.body.appendChild(F),F.click(),document.body.removeChild(F)}else{let U=new Blob([b.content||""],{type:"application/octet-stream"}),F=URL.createObjectURL(U),_=document.createElement("a");_.href=F,_.download=D.split("/").pop()||"download",document.body.appendChild(_),_.click(),document.body.removeChild(_),URL.revokeObjectURL(F)}}catch{}return}let L=n.value.findIndex(U=>U.path===D);if(L>=0){let U=n.value[L];if(b.binary){U.previewLoading=!1;let F=`${location.protocol}//${location.host}/api/preview/${b.fileId}?token=${b.previewToken}`,_=U.fileType||ws(U.name);U.fileType=_,_==="pdf"||_==="image"?fetch(F).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(F):fetch(F).then(T=>T.arrayBuffer()).then(T=>{U._arrayBuffer=T,U.localPreviewReady=!0,L===i.value&&Vue.nextTick(()=>h(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&&(St(U.name)&&y.value||Vue.nextTick(()=>{setTimeout(()=>c(U),100)}))}break}case"file_saved":{if(a.value=!1,b.error)return;let D=t(b.filePath),L=n.value.find(U=>U.path===D);L&&(L.originalContent=L.content,L.isDirty=!1,l(e.currentConversation));break}case"file_search_result":{p.handleFileSearchResult(b);break}case"file_op_result":{m.handleFileOpResult(b,u.loadTreeDirectory,u.treeRootPath.value);break}case"file_tabs_restored":{if(b.openFiles?.length>0&&n.value.length===0){let D=b.activeIndex||0,L=b.openFiles.length;for(let U of b.openFiles){let F=t(U.path),_=F.split("/").pop(),P=ws(_);n.value.push({path:F,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=D>=0&&D<L?D:0}break}}},handleOpenFile:g=>{let{filePath:b}=g.detail,D=t(b);d(D,D.split("/").pop())}}}var vu=N(()=>{rn()});var yu,bu=N(()=>{co();su();iu();ou();rn();cu();uu();fu();mu();vu();yu={name:"FilesTab",template:`
|
|
2071
|
+
`,setup(){let e=Pinia.useChatStore(),t=Vue.inject("t"),s=Q=>Q.split(/[/\\]/).pop()||Q,n=Q=>{let q=Q.split(/[/\\]/);return q.pop(),q.join("/")},i=Q=>di(s(Q)),r=Vue.ref(null),o=Vue.reactive({staged:!1,modified:!1,untracked:!1}),a=Q=>{o[Q]=!o[Q]},l=Vue.ref(!1),c=Vue.ref(""),d=Vue.ref(null),u=Vue.ref([]),f=Vue.computed(()=>e.effectiveWorkDir||""),p=Vue.ref(""),m=Vue.computed(()=>p.value.trim()||f.value),y=Vue.ref(null),h=Vue.ref(!1),A=Vue.ref(!1),x=Vue.ref(""),S=Vue.ref(null),v=Vue.ref([]),g=Vue.ref(null),b=Vue.ref(!0),D=Vue.ref(!1),L=Vue.ref(""),U=Vue.ref(null),O=Vue.ref(0),_=Vue.ref(0),P=Q=>Q==null||Q===""?"":zd(Q,y.value||""),T=Vue.ref(parseInt(localStorage.getItem("gitDiffFontSize"))||12),C=Q=>{T.value=Math.max(8,Math.min(24,Q)),localStorage.setItem("gitDiffFontSize",T.value.toString())},M=()=>C(T.value+1),E=()=>C(T.value-1),R=Q=>{Q.deltaY<0?M():Q.deltaY>0&&E()},H=Vue.computed(()=>{let Q=v.value;if(!Q||Q.length===0)return[];let q=Q.length,te=[],se=0;for(;se<q;){let be=Q[se];if(be.type==="addition"||be.type==="deletion"||be.type==="modification"){let j=be.type==="modification"?"modification":be.type,ee=se;for(;se<q&&(Q[se].type===j||Q[se].type==="modification"&&j!=="modification");)se++;let me=se-ee;te.push({type:j,top:ee/q*100,height:Math.max(me/q*100,.5)})}else se++}return te}),G=Q=>{let q=r.value;if(!q)return;let te=Q.currentTarget.getBoundingClientRect(),se=(Q.clientY-te.top)/te.height;q.scrollTop=se*(q.scrollHeight-q.clientHeight)},ue=Vue.computed(()=>u.value.filter(Q=>Q.indexStatus!==" "&&Q.indexStatus!=="?")),J=Vue.computed(()=>u.value.filter(Q=>Q.workTreeStatus==="M"||Q.workTreeStatus==="D")),ve=Vue.computed(()=>u.value.filter(Q=>Q.indexStatus==="?"&&Q.workTreeStatus==="?")),ae=Gd(e,{effectiveGitWorkDir:m,gitOperating:D,gitOpFeedback:U,commitMessage:L}),$=()=>ae.loadGitStatus(l,c),w=()=>{$()},B=Xd(e,m),X=Q=>ui(Q),re=()=>B.confirmFolderPicker(p,$),ke=(Q,q)=>{y.value=Q.path,h.value=q,A.value=!0,x.value="",S.value=null,v.value=[],g.value=null;let te=Q.indexStatus==="?"&&Q.workTreeStatus==="?";e.sendWsMessage({type:"git_diff",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,workDir:m.value,filePath:Q.path,staged:q,untracked:te,fullFile:b.value,_clientId:e.clientId})},Pe=()=>{if(b.value=!b.value,y.value){let Q=u.value.find(q=>q.path===y.value);Q&&ke(Q,h.value)}},De=Q=>{let q=Q.detail;if(q)switch(q.type){case"directory_listing":{if(B.handleDirectoryListing(q))return;break}case"git_status_result":{if(l.value=!1,q.error){c.value=q.error,d.value=null,u.value=[];return}if(c.value="",d.value=q.branch||"HEAD",u.value=q.files||[],O.value=q.ahead||0,_.value=q.behind||0,y.value){let te=u.value.find(se=>se.path===y.value);if(te){let se=te.indexStatus!==" "&&te.indexStatus!=="?";h.value=se}else y.value=null,S.value=null,v.value=[],g.value=null}break}case"git_diff_result":{if(A.value=!1,q.error){x.value=q.error;return}x.value="";let te=Kd(q.diff,q.newFileContent,t);g.value=te.stats,v.value=te.lines,S.value=te.content;break}case"git_op_result":{ae.handleGitOpResult(q,$);break}}};Vue.watch(()=>e.currentAgent,()=>{d.value=null,u.value=[],c.value="",y.value=null,S.value=null,e.currentAgent&&Vue.nextTick(()=>$())}),Vue.watch(()=>e.currentConversation,()=>{e.currentAgent&&(y.value=null,S.value=null,v.value=[],g.value=null,Vue.nextTick(()=>$()))});let ne=()=>$();return Vue.onMounted(()=>{window.addEventListener("workbench-message",De),e.currentAgent&&$()}),Vue.onUnmounted(()=>{window.removeEventListener("workbench-message",De),ae.cleanup()}),{store:e,getFileName:s,getDirName:n,getFileIconHtml:i,hlLine:P,collapsedGroups:o,toggleGroup:a,gitLoading:l,gitError:c,gitBranch:d,gitFiles:u,gitWorkDir:p,defaultWorkDir:f,changeGitWorkDir:w,stagedFiles:ue,modifiedFiles:J,untrackedFiles:ve,selectedGitFile:y,selectedStaged:h,diffLoading:A,diffError:x,diffContent:S,diffLines:v,diffStats:g,diffFullFile:b,toggleDiffMode:Pe,scrollMarkers:H,diffScrollContainer:r,onMarkerClick:G,fontSize:T,zoomIn:M,zoomOut:E,onWheel:R,gitOperating:D,commitMessage:L,gitOpFeedback:U,gitAhead:O,gitBehind:_,stageFile:ae.stageFile,unstageFile:ae.unstageFile,discardFile:ae.discardFile,stageAll:ae.stageAll,unstageAll:ae.unstageAll,commitChanges:ae.commitChanges,pushChanges:ae.pushChanges,selectGitFile:ke,refresh:ne,folderPickerOpen:B.folderPickerOpen,folderPickerPath:B.folderPickerPath,folderPickerEntries:B.folderPickerEntries,folderPickerLoading:B.folderPickerLoading,folderPickerSelected:B.folderPickerSelected,getFolderIcon:X,openFolderPicker:B.openFolderPicker,folderPickerNavigateUp:B.folderPickerNavigateUp,folderPickerSelectItem:B.folderPickerSelectItem,folderPickerEnter:B.folderPickerEnter,confirmFolderPicker:re}}}});function tu(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=[],f=[],p=()=>{let O=e.value?.cmInstance;if(!O)return;let P=O.getWrapperElement().querySelector(".cm-find-scrollbar-annotations");P&&P.remove()},m=()=>{let O=e.value?.cmInstance;if(!O||f.length===0)return;p();let _=O.getWrapperElement();if(!_.querySelector(".CodeMirror-vscrollbar"))return;let T=O.lineCount();if(T===0)return;let C=document.createElement("div");C.className="cm-find-scrollbar-annotations";for(let M of f){let E=M.from.line/T*100,R=document.createElement("div");R.className="cm-find-scrollbar-tick",R.style.top=E+"%",C.appendChild(R)}_.appendChild(C)},y=()=>{for(let O of u)try{O.clear()}catch{}u=[],f=[],a.value=0,l.value=-1,p()},h=O=>{let _=e.value?.cmInstance;if(!_||!f[O])return;for(let T=0;T<u.length;T++){if(!u[T])continue;let C=u[T].find();C&&(u[T].clear(),u[T]=_.markText(C.from,C.to,{className:"cm-find-highlight"}))}let P=f[O];if(u[O]){let T=u[O].find();T&&(u[O].clear(),u[O]=_.markText(T.from,T.to,{className:"cm-find-highlight cm-find-current"}))}setTimeout(()=>{_.scrollIntoView({from:P.from,to:P.to},100)},0)},A=()=>{y();let O=e.value?.cmInstance;if(!O||!n.value)return;let _=n.value;if(_.length<3)return;let P=O.getValue(),T=r.value,C=o.value,M=[];try{if(C){let E=T?"g":"gi",R=new RegExp(_,E),H;for(;(H=R.exec(P))!==null;){if(H[0].length===0){R.lastIndex++;continue}let G=O.posFromIndex(H.index),ue=O.posFromIndex(H.index+H[0].length);if(M.push({from:G,to:ue}),M.length>1e4)break}}else{let E=T?_:_.toLowerCase(),R=T?P:P.toLowerCase(),H=0;for(;(H=R.indexOf(E,H))!==-1;){let G=O.posFromIndex(H),ue=O.posFromIndex(H+_.length);if(M.push({from:G,to:ue}),H+=_.length,M.length>1e4)break}}}catch{return}f=M,a.value=M.length;for(let E of M)u.push(O.markText(E.from,E.to,{className:"cm-find-highlight"}));if(M.length>0){let E=O.getCursor(),R=0;for(let H=0;H<M.length;H++){if(CodeMirror.cmpPos(M[H].from,E)>=0){R=H;break}H===M.length-1&&(R=0)}l.value=R,h(R)}m()};return{findBarVisible:t,replaceBarVisible:s,findQuery:n,replaceQuery:i,findCaseSensitive:r,findUseRegex:o,findMatchCount:a,findMatchIndex:l,findInputRef:c,replaceInputRef:d,clearFindMarkers:y,performFind:A,onFindInput:()=>{A()},findNext:()=>{if(f.length===0)return;let O=(l.value+1)%f.length;l.value=O,h(O)},findPrev:()=>{if(f.length===0)return;let O=(l.value-1+f.length)%f.length;l.value=O,h(O)},openFindBar:(O=!1)=>{t.value=!0,s.value=O;let _=e.value?.cmInstance;if(_){let P=_.getSelection();P&&(n.value=P)}Vue.nextTick(()=>{c.value?.focus(),c.value?.select(),n.value&&A()})},closeFindBar:()=>{y(),t.value=!1,s.value=!1;let O=e.value?.cmInstance;O&&O.focus()},toggleReplaceBar:()=>{s.value=!s.value,s.value&&Vue.nextTick(()=>d.value?.focus())},replaceOne:()=>{let O=e.value?.cmInstance;if(!O||f.length===0||l.value<0)return;let _=f[l.value];O.replaceRange(i.value,_.from,_.to),A()},replaceAll:()=>{let O=e.value?.cmInstance;!O||f.length===0||(O.operation(()=>{for(let _=f.length-1;_>=0;_--)O.replaceRange(i.value,f[_].from,f[_].to)}),A())}}}var su=N(()=>{});function nu(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(""),f=Vue.ref("file"),p=Vue.ref(null),m=Vue.ref(!1),y=Vue.ref(""),h=Vue.ref(null),A=Vue.reactive({visible:!1,x:0,y:0,entry:null}),x=Vue.ref(!1),S=Vue.ref(""),v=Vue.ref(null),g=null,b=Vue.reactive({dragging:null,dropTarget:null}),D=Vue.ref(!1),L=(j,ee)=>{l&&clearTimeout(l),a.value={ok:j,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)},O=j=>{i.has(j)?i.delete(j):i.add(j)},_=()=>{i.clear(),r.value=-1},P=j=>{f.value=j,u.value="",d.value=!0,Vue.nextTick(()=>p.value?.focus())},T=()=>{let j=u.value.trim();if(!j)return;d.value=!1;let ee=n.value||s();if(!ee)return;let me=ee.includes("\\")?"\\":"/",ge=ee.replace(/[/\\]$/,"")+me+j;U(),e.sendWsMessage({type:"create_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:ge,isDirectory:f.value==="directory",workDir:s(),_clientId:e.clientId})},C=(j,ee)=>{let me=j.path.split("/").pop();confirm(ee("files.deleteConfirm",{name:me})+(j.type==="directory"?ee("files.deleteDirHint"):""))&&(U(),e.sendWsMessage({type:"delete_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[j.path],workDir:s(),_clientId:e.clientId}))},M=j=>{let ee=i.size;ee!==0&&confirm(j("files.deleteSelectedConfirm",{count:ee}))&&(U(),e.sendWsMessage({type:"delete_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[...i],workDir:s(),_clientId:e.clientId}))},E=()=>{y.value=n.value||s()||"",m.value=!0,Vue.nextTick(()=>h.value?.focus())},R=()=>{let j=y.value.trim();!j||i.size===0||(m.value=!1,U(),e.sendWsMessage({type:"move_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[...i],destination:j,workDir:s(),_clientId:e.clientId}))},H=(j,ee)=>{let Ee=j.clientX,Oe=j.clientY;Ee+180>window.innerWidth&&(Ee=window.innerWidth-180),Oe+240>window.innerHeight&&(Oe=window.innerHeight-240),A.entry=ee,A.x=Ee,A.y=Oe,A.visible=!0},G=()=>{A.visible=!1};return{selectedPaths:i,lastClickedIndex:r,fileOperating:o,fileOpFeedback:a,newFileDialogVisible:d,newFileName:u,newFileType:f,newFileInput:p,moveDialogVisible:m,moveDestination:y,moveDestInput:h,contextMenu:A,renameDialogVisible:x,renameNewName:S,renameInput:v,dragState:b,externalDropActive:D,showFileOpFeedback:L,toggleSelection:O,clearSelection:_,showNewFileDialog:P,confirmNewFile:T,deleteSingleFile:C,deleteSelected:M,openMoveDialog:E,confirmMove:R,showContextMenu:H,hideContextMenu:G,ctxRename:()=>{let j=A.entry;G(),j&&(S.value=j.name,x.value=!0,Vue.nextTick(()=>{let ee=v.value;if(ee)if(ee.focus(),j.type==="file"){let me=j.name.lastIndexOf(".");me>0?ee.setSelectionRange(0,me):ee.select()}else ee.select()}))},confirmRename:()=>{let j=A.entry,ee=S.value.trim();if(!ee||!j||ee===j.name){x.value=!1;return}x.value=!1;let me=j.path.replace(/\/$/,"").split("/");me.pop();let ge=me.join("/")||"/";U(),e.sendWsMessage({type:"move_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[j.path],destination:ge,newName:ee,workDir:s(),_clientId:e.clientId})},ctxCopy:()=>{let j=A.entry;if(G(),!j)return;let ee=j.path.replace(/\/$/,"").split("/");ee.pop();let me=ee.join("/")||"/";U(),e.sendWsMessage({type:"copy_files",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,paths:[j.path],destination:me,workDir:s(),_clientId:e.clientId})},ctxMoveTo:()=>{let j=A.entry;G(),j&&(i.clear(),i.add(j.path),E())},ctxDelete:j=>{let ee=A.entry;G(),ee&&C(ee,j)},ctxDownload:()=>{let j=A.entry;G(),!(!j||j.type!=="file")&&(g=j.path,e.sendWsMessage({type:"read_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:j.path,workDir:s(),_clientId:e.clientId}))},onDragStart:(j,ee)=>{b.dragging=ee,j.dataTransfer.setData("text/plain",ee.path),j.dataTransfer.effectAllowed="move"},onDragOver:(j,ee)=>{if(!b.dragging&&j.dataTransfer.types.includes("Files")){ee.type==="directory"&&(j.dataTransfer.dropEffect="copy",b.dropTarget=ee.path);return}!b.dragging||ee.type!=="directory"||ee.path!==b.dragging.path&&(ee.path.startsWith(b.dragging.path+"/")||(j.dataTransfer.dropEffect="move",b.dropTarget=ee.path))},onDragLeave:j=>{let ee=j.relatedTarget;ee&&j.currentTarget.contains(ee)||(b.dropTarget=null)},onDrop:(j,ee,me)=>{if(b.dropTarget=null,!b.dragging&&j.dataTransfer.files.length>0&&ee.type==="directory"){me(j.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:j=>{b.dragging||j.dataTransfer.types.includes("Files")&&(j.dataTransfer.dropEffect="copy",D.value=!0)},onTreeDragLeave:j=>{let ee=j.relatedTarget;ee&&j.currentTarget.contains(ee)||(D.value=!1)},onTreeDrop:(j,ee,me)=>{if(D.value=!1,!b.dragging&&j.dataTransfer.files.length>0){let ge=n.value||ee||s();me(j.dataTransfer.files,ge)}},handleExternalFileDrop:async(j,ee)=>{if(!ee)return;let me=[],ge=[];for(let Ee of j)ge.push(new Promise(Oe=>{let He=new FileReader;He.onload=()=>{let F=btoa(new Uint8Array(He.result).reduce((Z,pe)=>Z+String.fromCharCode(pe),""));me.push({name:Ee.name,data:F}),Oe()},He.onerror=()=>Oe(),He.readAsArrayBuffer(Ee)}));await Promise.all(ge),me.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:me,dirPath:ee,workDir:s(),_clientId:e.clientId}))},handleFileOpResult:(j,ee,me)=>{o.value=!1,c&&(clearTimeout(c),c=null),L(j.success,j.success?j.message:j.error||"Operation failed"),j.success&&(me&&ee(me),(j.operation==="delete"||j.operation==="move")&&(i.clear(),r.value=-1))},getPendingDownload:()=>g,clearPendingDownload:()=>{g=null},cleanup:()=>{l&&clearTimeout(l),c&&clearTimeout(c)}}}var iu=N(()=>{});function ru(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),f=Vue.computed(()=>{if(!l.value)return"EXPLORER";let P=l.value.replace(/[\\/]+$/,"").split(/[\\/]/);return(P[P.length-1]||l.value).toUpperCase()}),p=Vue.computed(()=>l.value?!!c[l.value]?.expanded:!1),m=()=>{if(!l.value)return;let P=c[l.value];P&&(P.expanded=!P.expanded)},y=()=>{for(let P of Object.keys(c))c[P]&&(c[P].expanded=!1)},h=()=>{d.value=!0,Vue.nextTick(()=>u.value?.focus())},A=()=>{d.value=!1,g()},x=()=>{d.value=!1},S=Vue.computed(()=>{let P=[],T=(C,M)=>{let E=c[C];if(!(!E||!E.entries))for(let R of E.entries)P.push({...R,depth:M}),R.type==="directory"&&c[R.path]?.expanded&&T(R.path,M+1)};return l.value&&c[l.value]?.expanded&&T(l.value,0),P}),v=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})},g=()=>{let P=a.value.trim();if(!P)return;let T=s(P);l.value=T,Object.keys(c).forEach(C=>delete c[C]),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),C=c[T];C?C.loaded?C.expanded=!C.expanded:(C.expanded=!0,v(P)):(c[T]={entries:[],expanded:!0,loaded:!1,loading:!1},v(P))},D=(P,T)=>{let C=S.value,M=C.findIndex(E=>E.path===P.path);if(T&&(T.shiftKey||T.ctrlKey||T.metaKey)){if(T.shiftKey&&i.value>=0&&M>=0){let E=Math.min(i.value,M),R=Math.max(i.value,M);!T.ctrlKey&&!T.metaKey&&n.clear();for(let H=E;H<=R;H++)n.add(C[H].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 C=(P.entries||[]).sort((R,H)=>R.type===H.type?R.name.localeCompare(H.name):R.type==="directory"?-1:1),M=T.replace(/\/$/,""),E=C.map(R=>({...R,path:M+"/"+R.name}));c[T]?(c[T].entries=E,c[T].loaded=!0,c[T].loading=!1):c[T]={entries:E,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:S,editingTreePath:d,treePathInputRef:u,rootFolderName:f,rootExpanded:p,toggleRootExpand:m,collapseAll:y,startTreePathEdit:h,confirmTreePath:A,cancelTreePathEdit:x,loadTreeDirectory:v,loadRootDirectory:g,toggleDirectory:b,onTreeItemClick:D,handleDirectoryListing:L,clearTreeNodes:U,initFileBrowser:()=>{let P=t();if(P){let T=s(P);a.value=P,l.value=T,U(),v(P)}},refresh:()=>{l.value&&v(l.value)}}}var ou=N(()=>{});function ws(e){let t=e.lastIndexOf(".");if(t<0)return"text";let s=e.substring(t).toLowerCase();return Sm.has(s)?"office":Cm.has(s)?"pdf":Im.has(s)?"image":"text"}function St(e){let t=e.lastIndexOf(".");return t<0?!1:Am.has(e.substring(t).toLowerCase())}function xm(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 au(e,{activeFile:t,editorContainer:s,fontSize:n,clearFindMarkers:i,openFindBar:r,saveFile:o}){let a=Vue.ref(""),l=Vue.reactive({}),c=()=>{},d=()=>{},u=({openQuickOpen:x,openGoToLine:S})=>{c=x,d=S},f=(x,S=0)=>{if(!s.value){S<20&&setTimeout(()=>f(x,S+1),100);return}if(!x)return;if(s.value.innerHTML="",typeof CodeMirror>"u"){let b=document.createElement("textarea");b.value=x.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",()=>{x.content=b.value,x.isDirty=b.value!==x.originalContent}),b.addEventListener("keydown",D=>{(D.ctrlKey||D.metaKey)&&D.key==="s"&&(D.preventDefault(),o())}),s.value.appendChild(b),a.value="";return}let g=document.documentElement.getAttribute("data-theme")==="dark"?"material-darker":"default";try{let b=CodeMirror(s.value,{value:x.content||"",mode:xm(x.name),theme:g,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();x.content=L,x.isDirty=L!==x.originalContent}),x.cmInstance=b,b.getWrapperElement().style.fontSize=n.value+"px";let D=e.currentConversation;D&&l[D]?.[x.path]&&b.setHistory(l[D][x.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:f,destroyEditor:()=>{i();let x=t.value;x?.cmInstance&&(x.cmInstance.toTextArea&&x.cmInstance.toTextArea(),x.cmInstance=null),s.value&&(s.value.innerHTML="")},setKeyBindings:u,saveCurrentUndoHistory:()=>{let x=e.currentConversation;if(!x)return;let S=t.value;S?.cmInstance&&(l[x]||(l[x]={}),l[x][S.path]=S.cmInstance.getHistory())},saveAllUndoHistory:x=>{if(!x)return;let S=t.value;S?.cmInstance&&(l[x]||(l[x]={}),l[x][S.path]=S.cmInstance.getHistory())},cleanupUndoHistory:(x,S)=>{x&&l[x]&&delete l[x][S]},deleteConversationHistory:x=>{delete l[x]}}}var Sm,Cm,Im,Am,rn=N(()=>{Sm=new Set([".docx",".xlsx",".xls",".pptx",".ppt"]),Cm=new Set([".pdf"]),Im=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico"]),Am=new Set([".md",".markdown",".mdx"])});function lu(e,{editorContainer:t,createEditor:s,t:n}){let i=Vue.ref(!0),r=Vue.ref(null),o=Vue.ref(null),a=Vue.computed(()=>{let p=e.value;return!!(p&&St(p.name))}),l=Vue.computed(()=>{let p=e.value;if(!p||!St(p.name)||p.content==null)return"";try{if(typeof marked<"u")return marked.parse(p.content)}catch{}return"<pre>"+(p.content||"")+"</pre>"});function c(){Xe(r.value)}async function d(){await Xe(r.value)}function u(){i.value=!1,Vue.nextTick(()=>{let p=e.value;p&&t.value&&s(p)})}return{mdPreviewMode:i,mdPreviewRef:r,officePreviewContainer:o,isActiveMarkdown:a,mdRenderedHtml:l,initMermaid:c,renderMermaidBlocks:d,switchToMdEdit:u,renderOfficeLocal:p=>{let m=o.value;if(!m||!p._arrayBuffer)return;m.innerHTML="";let y=("."+p.name.split(".").pop()).toLowerCase();if(y===".docx"&&window.docx)window.docx.renderAsync(p._arrayBuffer,m,null,{className:"docx-preview-content",inWrapper:!0,ignoreWidth:!1,ignoreHeight:!0}).catch(h=>{p.previewError=h.message});else if(y===".xlsx"||y===".xls")try{let h=XLSX.read(p._arrayBuffer,{type:"array"}),A=h.SheetNames[0],x=XLSX.utils.sheet_to_html(h.Sheets[A],{editable:!1});m.innerHTML='<div class="xlsx-sheet-tabs">'+h.SheetNames.map((S,v)=>`<button class="xlsx-sheet-tab${v===0?" active":""}" data-idx="${v}">${S}</button>`).join("")+'</div><div class="xlsx-table-wrap">'+x+"</div>",m.querySelectorAll(".xlsx-sheet-tab").forEach(S=>{S.addEventListener("click",()=>{let v=parseInt(S.dataset.idx),g=h.SheetNames[v],b=XLSX.utils.sheet_to_html(h.Sheets[g],{editable:!1});m.querySelector(".xlsx-table-wrap").innerHTML=b,m.querySelectorAll(".xlsx-sheet-tab").forEach(D=>D.classList.remove("active")),S.classList.add("active")})})}catch(h){p.previewError=h.message}else(y===".pptx"||y===".ppt")&&(m.innerHTML='<div class="preview-unsupported">'+(n?n("files.pptxNotSupported"):"PowerPoint preview not supported")+"</div>")}}}var cu=N(()=>{Qs();rn()});function du(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,f=Vue.ref(!1),p=Vue.ref(""),m=Vue.ref([]),y=Vue.ref(0),h=Vue.ref(!1),A=Vue.ref(null),x=null,S=Vue.ref(!1),v=Vue.ref(""),g=Vue.ref(null),b=J=>{!e.currentAgent||!J.trim()||e.sendWsMessage({type:"file_search",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,query:J.trim(),dirPath:s.value||t()||"",_clientId:e.clientId})},D=()=>{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=J=>{if(J.type==="directory"){let ve=i(J.fullPath);r.value=ve,s.value=J.fullPath,Object.keys(o).forEach(ae=>delete o[ae]),a(J.fullPath),L()}else n(J.fullPath,J.name),L()},O=()=>{f.value=!0,p.value="",m.value=[],y.value=0,h.value=!1,Vue.nextTick(()=>A.value?.focus())},_=()=>{f.value=!1,p.value="",m.value=[]},P=()=>{if(x&&clearTimeout(x),!p.value.trim()){m.value=[],h.value=!1;return}h.value=!0,y.value=0,x=setTimeout(()=>{b(p.value)},200)},T=()=>{m.value.length>0&&(y.value=(y.value+1)%m.value.length)},C=()=>{m.value.length>0&&(y.value=(y.value-1+m.value.length)%m.value.length)},M=J=>{J.type!=="directory"&&n(J.fullPath,J.name),_()},E=()=>{let J=m.value[y.value];J&&M(J)},R=()=>{S.value=!0,v.value="",Vue.nextTick(()=>g.value?.focus())},H=()=>{S.value=!1,v.value=""};return{searchQuery:l,searchResults:c,searchLoading:d,onSearchInput:D,clearSearch:L,onSearchResultClick:U,quickOpenVisible:f,quickOpenQuery:p,quickOpenResults:m,quickOpenSelectedIndex:y,quickOpenLoading:h,quickOpenInput:A,openQuickOpen:O,closeQuickOpen:_,onQuickOpenInput:P,quickOpenSelectNext:T,quickOpenSelectPrev:C,quickOpenConfirm:E,quickOpenOpenFile:M,goToLineVisible:S,goToLineValue:v,goToLineInput:g,openGoToLine:R,closeGoToLine:H,goToLineConfirm:J=>{let ve=parseInt(v.value);if(isNaN(ve)||ve<1)return;let ae=J.value;if(ae?.cmInstance){let $=ae.cmInstance,w=Math.min(ve-1,$.lineCount()-1);$.setCursor({line:w,ch:0}),$.scrollIntoView({line:w,ch:0},100),$.focus()}H()},handleFileSearchResult:J=>{let ve=J.results||[];f.value?J.query&&J.query.trim()===p.value.trim()&&(m.value=ve,h.value=!1,y.value=0):J.query&&J.query.trim()===l.value.trim()&&(c.value=ve,d.value=!1)}}}var uu=N(()=>{});function pu(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(""),f=()=>{a.value=!0,u.value="",d.value=!0;let S=s.value||t()||"";l.value=S,c.value=[],e.sendWsMessage({type:"list_directory",conversationId:"_folder_picker",agentId:e.currentAgent,dirPath:S,workDir:t(),_clientId:e.clientId})},p=S=>{d.value=!0,u.value="",e.sendWsMessage({type:"list_directory",conversationId:"_folder_picker",agentId:e.currentAgent,dirPath:S,workDir:t(),_clientId:e.clientId})};return{folderPickerOpen:a,folderPickerPath:l,folderPickerEntries:c,folderPickerLoading:d,folderPickerSelected:u,openFolderPicker:f,folderPickerNavigateUp:()=>{if(!l.value)return;let S=l.value.includes("\\"),v=S?"\\":"/",g=l.value.replace(/[/\\]$/,"").split(/[/\\]/);if(g.pop(),g.length===0)l.value="",p("");else if(S&&g.length===1&&/^[A-Za-z]:$/.test(g[0]))l.value=g[0]+"\\",p(g[0]+"\\");else{let b=g.join(v);l.value=b,p(b)}},folderPickerSelectItem:S=>{u.value=S.name},folderPickerEnter:S=>{let v;if(!l.value)v=S.name+(S.name.endsWith("\\")?"":"\\");else{let g=l.value.includes("\\")||/^[A-Z]:/.test(S.name)?"\\":"/";v=l.value.replace(/[/\\]$/,"")+g+S.name}l.value=v,p(v)},confirmFolderPicker:()=>{let S=l.value;if(!S)return;if(u.value){let g=S.includes("\\")?"\\":"/";S=S.replace(/[/\\]$/,"")+g+u.value}s.value=S,a.value=!1;let v=r(S);n.value=v,Object.keys(i).forEach(g=>delete i[g]),i[v]={entries:[],expanded:!0,loaded:!1,loading:!0},e.sendWsMessage({type:"list_directory",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,dirPath:S,workDir:t(),_clientId:e.clientId})},handleFolderPickerListing:S=>{d.value=!1,c.value=(S.entries||[]).filter(v=>v.type==="directory").sort((v,g)=>v.name.localeCompare(g.name)),S.dirPath!=null&&(l.value=S.dirPath)}}}var fu=N(()=>{});function gu(e,{normalizePath:t,getEffectiveWorkDir:s,editorContainer:n,createEditor:i,destroyEditor:r,clearFindMarkers:o,saveCurrentUndoHistory:a,saveAllUndoHistory:l,cleanupUndoHistory:c,deleteConversationHistory:d,debugStatus:u,mdPreviewMode:f,renderOfficeLocal:p,performFind:m,findBarVisible:y,findQuery:h,t:A}){let x=Vue.reactive({}),S=Vue.ref([]),v=Vue.ref(-1),g=Vue.ref(!1),b=Vue.ref(!1),D=Vue.computed(()=>v.value>=0&&v.value<S.value.length?S.value[v.value]:null),L=null,U=()=>{L&&clearTimeout(L),L=setTimeout(()=>{e.sendWsMessage({type:"update_file_tabs",openFiles:S.value.map(R=>({path:R.path})),activeIndex:v.value})},500)},O=R=>{R&&(l(R),S.value.length>0?x[R]={files:S.value.map(H=>({path:H.path,name:H.name,content:H.content,originalContent:H.originalContent,isDirty:H.isDirty,fileType:H.fileType})),activeIndex:v.value}:delete x[R],U())},_=R=>{if(r(),!R||!x[R]){S.value=[],v.value=-1;return}let H=x[R];S.value=H.files.map(G=>({...G,isDirty:G.isDirty||!1,originalContent:G.originalContent||G.content,cmInstance:null,fileType:G.fileType||ws(G.name||""),blobUrl:null,previewUrl:null,previewLoading:!1,localPreviewReady:!1,previewError:null})),v.value=H.activeIndex,Vue.nextTick(()=>{let G=D.value;G&&(!G.fileType||G.fileType==="text")&&n.value&&i(G)})};function P(R,H){let G=t(R),ue=S.value.findIndex(ae=>ae.path===G);if(ue>=0){v.value!==ue&&(o(),a(),v.value=ue,Vue.nextTick(()=>{let ae=S.value[ue];ae&&ae.content!=null&&(!ae.fileType||ae.fileType==="text")&&i(ae)})),O(e.currentConversation);return}a();let J=H||G.split(/[/\\]/).pop(),ve=ws(J);S.value.push({path:G,name:J,content:null,originalContent:null,isDirty:!1,cmInstance:null,fileType:ve,blobUrl:null,previewUrl:null,previewLoading:ve!=="text",localPreviewReady:!1,previewError:null}),v.value=S.value.length-1,g.value=!0,ve==="text"&&r(),O(e.currentConversation),u.value=`Loading: ${R}`,e.sendWsMessage({type:"read_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:R,workDir:s(),_clientId:e.clientId})}let T=R=>{R!==v.value&&(o(),a(),v.value=R,O(e.currentConversation),Vue.nextTick(()=>{let H=S.value[R];H&&(!H.fileType||H.fileType==="text"?St(H.name)?f.value=!0:H.content!=null&&n.value&&(i(H),y.value&&h.value&&Vue.nextTick(()=>m())):H.fileType==="office"&&H.localPreviewReady&&Vue.nextTick(()=>p(H)))}))},C=R=>{let H=S.value[R];if(H?.isDirty&&!confirm(A("files.unsavedConfirm",{name:H.name})))return;c(e.currentConversation,H.path),H.blobUrl&&URL.revokeObjectURL(H.blobUrl);let G=R===v.value;S.value.splice(R,1),S.value.length===0?(v.value=-1,r()):v.value>=S.value.length?v.value=S.value.length-1:v.value>R?v.value--:G&&v.value>=S.value.length&&(v.value=S.value.length-1),O(e.currentConversation),S.value.length>0&&G&&Vue.nextTick(()=>{let ue=S.value[v.value];ue&&(!ue.fileType||ue.fileType==="text")&&ue.content!=null&&n.value&&i(ue)})};function M(){let R=D.value;!R||!R.isDirty||(b.value=!0,e.sendWsMessage({type:"write_file",conversationId:e.currentConversation||"_explorer",agentId:e.currentAgent,filePath:R.path,content:R.content,workDir:s(),_clientId:e.clientId}))}return{fileTabsMap:x,openFiles:S,activeFileIndex:v,activeFile:D,fileLoading:g,fileSaving:b,saveTabsState:O,restoreTabsState:_,openFileInTab:P,switchToTab:T,closeFileTab:C,saveFile:M,handleConversationDeleted:R=>{let{conversationId:H}=R.detail;H&&(delete x[H],d(H))}}}var mu=N(()=>{rn()});function hu({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:f,qo:p,ops:m,mdPreviewMode:y,renderOfficeLocal:h,editorContainer:A,debugStatus:x}){return{handleWorkbenchMessage:g=>{let b=g.detail;if(b)switch(b.type){case"directory_listing":{if(b.conversationId==="_folder_picker"){f.handleFolderPickerListing(b);return}u.handleDirectoryListing(b);break}case"file_content":{if(o.value=!1,b.error){x.value=`Error: ${b.error}`,m.clearPendingDownload();let U=t(b.filePath),O=n.value.find(_=>_.path===U);O&&(O.previewLoading=!1,O.previewError=b.error);return}let D=t(b.filePath);if(m.getPendingDownload()&&t(m.getPendingDownload())===D){m.clearPendingDownload();try{if(b.binary){let U=`${location.protocol}//${location.host}/api/preview/${b.fileId}?token=${b.previewToken}`,O=document.createElement("a");O.href=U,O.download=D.split("/").pop()||"download",document.body.appendChild(O),O.click(),document.body.removeChild(O)}else{let U=new Blob([b.content||""],{type:"application/octet-stream"}),O=URL.createObjectURL(U),_=document.createElement("a");_.href=O,_.download=D.split("/").pop()||"download",document.body.appendChild(_),_.click(),document.body.removeChild(_),URL.revokeObjectURL(O)}}catch{}return}let L=n.value.findIndex(U=>U.path===D);if(L>=0){let U=n.value[L];if(b.binary){U.previewLoading=!1;let O=`${location.protocol}//${location.host}/api/preview/${b.fileId}?token=${b.previewToken}`,_=U.fileType||ws(U.name);U.fileType=_,_==="pdf"||_==="image"?fetch(O).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(O):fetch(O).then(T=>T.arrayBuffer()).then(T=>{U._arrayBuffer=T,U.localPreviewReady=!0,L===i.value&&Vue.nextTick(()=>h(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&&(St(U.name)&&y.value||Vue.nextTick(()=>{setTimeout(()=>c(U),100)}))}break}case"file_saved":{if(a.value=!1,b.error)return;let D=t(b.filePath),L=n.value.find(U=>U.path===D);L&&(L.originalContent=L.content,L.isDirty=!1,l(e.currentConversation));break}case"file_search_result":{p.handleFileSearchResult(b);break}case"file_op_result":{m.handleFileOpResult(b,u.loadTreeDirectory,u.treeRootPath.value);break}case"file_tabs_restored":{if(b.openFiles?.length>0&&n.value.length===0){let D=b.activeIndex||0,L=b.openFiles.length;for(let U of b.openFiles){let O=t(U.path),_=O.split("/").pop(),P=ws(_);n.value.push({path:O,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=D>=0&&D<L?D:0}break}}},handleOpenFile:g=>{let{filePath:b}=g.detail,D=t(b);d(D,D.split("/").pop())}}}var vu=N(()=>{rn()});var yu,bu=N(()=>{co();su();iu();ou();rn();cu();uu();fu();mu();vu();yu={name:"FilesTab",template:`
|
|
2072
2072
|
<div class="files-tab file-two-col" :class="{ 'mobile-editor-view': isMobile && mobileView === 'editor' }" ref="rootEl">
|
|
2073
2073
|
<!-- \u5DE6\u680F: \u5C42\u7EA7\u76EE\u5F55\u6811 -->
|
|
2074
2074
|
<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"
|
|
@@ -2495,7 +2495,7 @@ ${String(e||"").trim()}
|
|
|
2495
2495
|
</template>
|
|
2496
2496
|
</div>
|
|
2497
2497
|
</div>
|
|
2498
|
-
`,setup(){let e=Pinia.useChatStore(),t=Vue.inject("t"),s=()=>e.effectiveWorkDir||"",n=w=>w?w.replace(/\\/g,"/"):"",i=w=>di(w),r=w=>ui(w),o=w=>w==null?"":w<1024?w+" B":w<1024*1024?(w/1024).toFixed(1)+" KB":(w/(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"},f=Vue.ref(parseInt(localStorage.getItem("filesFontSize"))||15),p=w=>{f.value=Math.max(8,Math.min(24,w)),localStorage.setItem("filesFontSize",f.value.toString());let B=v.activeFile.value;B?.cmInstance&&(B.cmInstance.getWrapperElement().style.fontSize=f.value+"px",B.cmInstance.refresh())},m=()=>p(f.value+1),y=()=>p(f.value-1),h=w=>{w.deltaY<0?m():y()},A=Vue.ref(parseInt(localStorage.getItem("filePanelWidth"))||220),x=Vue.ref(!1),S=w=>{w.preventDefault();let B=w.type==="touchstart";x.value=!0;let X=B?w.touches[0].clientX:w.clientX,re=A.value;document.body.style.cursor="col-resize",document.body.style.userSelect="none";let ke=w.target.closest(".file-two-col"),Pe=ke?ke.offsetWidth*.5:400,De=Q=>{let q=B?Q.touches[0].clientX:Q.clientX;A.value=Math.max(120,Math.min(Pe,re+(q-X)))},ne=()=>{x.value=!1,document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("filePanelWidth",A.value.toString()),document.removeEventListener("mousemove",De),document.removeEventListener("mouseup",ne),document.removeEventListener("touchmove",De),document.removeEventListener("touchend",ne)};document.addEventListener(B?"touchmove":"mousemove",De),document.addEventListener(B?"touchend":"mouseup",ne)},v,g,b=Vue.computed(()=>v?v.activeFile.value:null),D=Vue.computed(()=>g?g.treePath.value:""),L=tu(b),U=au(e,{activeFile:b,editorContainer:l,fontSize:f,clearFindMarkers:L.clearFindMarkers,openFindBar:L.openFindBar,saveFile:()=>v.saveFile()}),F=lu(b,{editorContainer:l,createEditor:U.createEditor,t}),_=nu(e,{getEffectiveWorkDir:s,treePath:D});v=gu(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:F.mdPreviewMode,renderOfficeLocal:F.renderOfficeLocal,performFind:L.performFind,findBarVisible:L.findBarVisible,findQuery:L.findQuery,t}),g=ru(e,{getEffectiveWorkDir:s,normalizePath:n,selectedPaths:_.selectedPaths,lastClickedIndex:_.lastClickedIndex,openFileInTab:(...w)=>v.openFileInTab(...w),clearSelection:_.clearSelection});let P=du(e,{getEffectiveWorkDir:s,treePath:g.treePath,openFileInTab:(...w)=>v.openFileInTab(...w),normalizePath:n,treeRootPath:g.treeRootPath,treeNodes:g.treeNodes,loadTreeDirectory:g.loadTreeDirectory});U.setKeyBindings({openQuickOpen:P.openQuickOpen,openGoToLine:P.openGoToLine});let T=pu(e,{getEffectiveWorkDir:s,treePath:g.treePath,treeRootPath:g.treeRootPath,treeNodes:g.treeNodes,normalizePath:n,loadTreeDirectory:g.loadTreeDirectory}),C=hu({store:e,normalizePath:n,getEffectiveWorkDir:s,openFiles:v.openFiles,activeFileIndex:v.activeFileIndex,activeFile:v.activeFile,fileLoading:v.fileLoading,fileSaving:v.fileSaving,saveTabsState:v.saveTabsState,createEditor:U.createEditor,openFileInTab:v.openFileInTab,tree:g,fp:T,qo:P,ops:_,mdPreviewMode:F.mdPreviewMode,renderOfficeLocal:F.renderOfficeLocal,editorContainer:l,debugStatus:U.debugStatus}),M=w=>_.deleteSingleFile(w,t),E=()=>_.deleteSelected(t),R=()=>_.ctxDelete(t),H=(w,B)=>_.onDrop(w,B,_.handleExternalFileDrop),G=w=>_.onTreeDrop(w,g.treeRootPath.value,_.handleExternalFileDrop),ue=()=>P.goToLineConfirm(v.activeFile);Vue.watch(()=>e.currentAgent,()=>{v.saveTabsState(e.currentConversation),U.destroyEditor(),g.clearTreeNodes(),v.openFiles.value=[],v.activeFileIndex.value=-1,v.fileLoading.value=!1,e.currentAgent&&Vue.nextTick(()=>g.initFileBrowser())});let J=e.currentConversation;Vue.watch(()=>e.currentConversation,w=>{v.saveTabsState(J),J=w,v.restoreTabsState(w);let B=s(),X=n(B);B&&X!==g.treeRootPath.value&&(g.treePath.value=B,g.treeRootPath.value=X,g.clearTreeNodes(),g.loadTreeDirectory(B))}),Vue.watch(()=>e.theme,w=>{let B=v.activeFile.value;B?.cmInstance&&B.cmInstance.setOption("theme",w==="dark"?"material-darker":"default")}),Vue.watch(()=>s(),w=>{if(w&&!g.treeRootPath.value){let B=n(w);g.treePath.value=w,g.treeRootPath.value=B,g.clearTreeNodes(),g.loadTreeDirectory(w)}}),Vue.watch(()=>v.activeFile.value?.content,(w,B)=>{let X=v.activeFile.value;if(X&&w!=null&&B==null&&!X.cmInstance&&(!X.fileType||X.fileType==="text")){if(St(X.name)&&F.mdPreviewMode.value)return;Vue.nextTick(()=>{setTimeout(()=>{X.cmInstance||U.createEditor(X)},150)})}}),Vue.watch([F.mdRenderedHtml,F.mdPreviewMode],([w,B])=>{w&&B&&Vue.nextTick(()=>{setTimeout(()=>F.renderMermaidBlocks(),50)})});let ve=w=>{!(a.value&&a.value.offsetParent!==null)&&!P.quickOpenVisible.value&&!P.goToLineVisible.value&&!L.findBarVisible.value||((w.ctrlKey||w.metaKey)&&w.key==="p"?(w.preventDefault(),P.quickOpenVisible.value?P.closeQuickOpen():P.openQuickOpen()):(w.ctrlKey||w.metaKey)&&w.key==="g"?(w.preventDefault(),P.goToLineVisible.value?P.closeGoToLine():P.openGoToLine()):(w.ctrlKey||w.metaKey)&&w.key==="f"?v.activeFile.value&&(w.preventDefault(),L.openFindBar(!1)):(w.ctrlKey||w.metaKey)&&(w.key==="r"||w.key==="h")?v.activeFile.value&&(w.preventDefault(),L.openFindBar(!0)):w.key==="Escape"&&(L.findBarVisible.value&&L.closeFindBar(),_.selectedPaths.size>0&&_.clearSelection(),P.quickOpenVisible.value&&P.closeQuickOpen(),P.goToLineVisible.value&&P.closeGoToLine()))},ae=()=>{_.hideContextMenu()},$=()=>{c.value=window.innerWidth<=768};return Vue.watch(()=>v.activeFileIndex.value,(w,B)=>{c.value&&w>=0&&w!==B&&(d.value="editor")}),Vue.watch(()=>v.openFiles.value.length,w=>{c.value&&w===0&&(d.value="tree")}),Vue.onMounted(()=>{window.addEventListener("workbench-message",C.handleWorkbenchMessage),window.addEventListener("open-file-in-explorer",C.handleOpenFile),window.addEventListener("conversation-deleted",v.handleConversationDeleted),window.addEventListener("keydown",ve),document.addEventListener("click",ae),window.addEventListener("resize",$),F.initMermaid(),e.currentAgent&&(g.initFileBrowser(),e.sendWsMessage({type:"restore_file_tabs"}))}),Vue.onUnmounted(()=>{window.removeEventListener("workbench-message",C.handleWorkbenchMessage),window.removeEventListener("open-file-in-explorer",C.handleOpenFile),window.removeEventListener("conversation-deleted",v.handleConversationDeleted),window.removeEventListener("keydown",ve),document.removeEventListener("click",ae),window.removeEventListener("resize",$),U.destroyEditor(),_.cleanup()}),{store:e,debugStatus:U.debugStatus,rootEl:a,isMobile:c,mobileView:d,mobileGoBack:u,fontSize:f,zoomIn:m,zoomOut:y,onWheel:h,treePath:g.treePath,treeRootPath:g.treeRootPath,treeNodes:g.treeNodes,flattenedTree:g.flattenedTree,editingTreePath:g.editingTreePath,treePathInputRef:g.treePathInputRef,rootFolderName:g.rootFolderName,rootExpanded:g.rootExpanded,toggleRootExpand:g.toggleRootExpand,collapseAll:g.collapseAll,startTreePathEdit:g.startTreePathEdit,confirmTreePath:g.confirmTreePath,cancelTreePathEdit:g.cancelTreePathEdit,treePanelWidth:A,isTreeResizing:x,startTreeResize:S,openFiles:v.openFiles,activeFileIndex:v.activeFileIndex,activeFile:v.activeFile,fileLoading:v.fileLoading,fileSaving:v.fileSaving,editorContainer:l,officePreviewContainer:F.officePreviewContainer,mdPreviewRef:F.mdPreviewRef,isActiveMarkdown:F.isActiveMarkdown,mdPreviewMode:F.mdPreviewMode,mdRenderedHtml:F.mdRenderedHtml,switchToMdEdit:F.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:ue,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:E,openMoveDialog:_.openMoveDialog,confirmMove:_.confirmMove,contextMenu:_.contextMenu,showContextMenu:_.showContextMenu,hideContextMenu:_.hideContextMenu,ctxRename:_.ctxRename,ctxCopy:_.ctxCopy,ctxMoveTo:_.ctxMoveTo,ctxDelete:R,ctxDownload:_.ctxDownload,renameDialogVisible:_.renameDialogVisible,renameNewName:_.renameNewName,renameInput:_.renameInput,confirmRename:_.confirmRename,dragState:_.dragState,externalDropActive:_.externalDropActive,onDragStart:_.onDragStart,onDragOver:_.onDragOver,onDragLeave:_.onDragLeave,onDrop:H,onTreeDragOver:_.onTreeDragOver,onTreeDragLeave:_.onTreeDragLeave,onTreeDrop:G,loadRootDirectory:g.loadRootDirectory,onTreeItemClick:g.onTreeItemClick,openFileInTab:v.openFileInTab,switchToTab:v.switchToTab,closeFileTab:v.closeFileTab,saveFile:v.saveFile,openFolderPicker:T.openFolderPicker,folderPickerNavigateUp:T.folderPickerNavigateUp,folderPickerSelectItem:T.folderPickerSelectItem,folderPickerEnter:T.folderPickerEnter,confirmFolderPicker:T.confirmFolderPicker,getFileIcon:()=>"",getFileIconHtml:i,getFolderIcon:r,formatSize:o,refresh:g.refresh,placeholderPath:Vue.computed(()=>{let w=s();return w?t("files.workDir",{dir:w}):t("files.enterDirPath")})}}}});var pi,uo=N(()=>{qd();eu();bu();pi={name:"WorkbenchPanel",components:{TerminalTab:Bd,GitStatusTab:Jd,FilesTab:yu},template:`
|
|
2498
|
+
`,setup(){let e=Pinia.useChatStore(),t=Vue.inject("t"),s=()=>e.effectiveWorkDir||"",n=w=>w?w.replace(/\\/g,"/"):"",i=w=>di(w),r=w=>ui(w),o=w=>w==null?"":w<1024?w+" B":w<1024*1024?(w/1024).toFixed(1)+" KB":(w/(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"},f=Vue.ref(parseInt(localStorage.getItem("filesFontSize"))||15),p=w=>{f.value=Math.max(8,Math.min(24,w)),localStorage.setItem("filesFontSize",f.value.toString());let B=v.activeFile.value;B?.cmInstance&&(B.cmInstance.getWrapperElement().style.fontSize=f.value+"px",B.cmInstance.refresh())},m=()=>p(f.value+1),y=()=>p(f.value-1),h=w=>{w.deltaY<0?m():y()},A=Vue.ref(parseInt(localStorage.getItem("filePanelWidth"))||220),x=Vue.ref(!1),S=w=>{w.preventDefault();let B=w.type==="touchstart";x.value=!0;let X=B?w.touches[0].clientX:w.clientX,re=A.value;document.body.style.cursor="col-resize",document.body.style.userSelect="none";let ke=w.target.closest(".file-two-col"),Pe=ke?ke.offsetWidth*.5:400,De=Q=>{let q=B?Q.touches[0].clientX:Q.clientX;A.value=Math.max(120,Math.min(Pe,re+(q-X)))},ne=()=>{x.value=!1,document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("filePanelWidth",A.value.toString()),document.removeEventListener("mousemove",De),document.removeEventListener("mouseup",ne),document.removeEventListener("touchmove",De),document.removeEventListener("touchend",ne)};document.addEventListener(B?"touchmove":"mousemove",De),document.addEventListener(B?"touchend":"mouseup",ne)},v,g,b=Vue.computed(()=>v?v.activeFile.value:null),D=Vue.computed(()=>g?g.treePath.value:""),L=tu(b),U=au(e,{activeFile:b,editorContainer:l,fontSize:f,clearFindMarkers:L.clearFindMarkers,openFindBar:L.openFindBar,saveFile:()=>v.saveFile()}),O=lu(b,{editorContainer:l,createEditor:U.createEditor,t}),_=nu(e,{getEffectiveWorkDir:s,treePath:D});v=gu(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:O.mdPreviewMode,renderOfficeLocal:O.renderOfficeLocal,performFind:L.performFind,findBarVisible:L.findBarVisible,findQuery:L.findQuery,t}),g=ru(e,{getEffectiveWorkDir:s,normalizePath:n,selectedPaths:_.selectedPaths,lastClickedIndex:_.lastClickedIndex,openFileInTab:(...w)=>v.openFileInTab(...w),clearSelection:_.clearSelection});let P=du(e,{getEffectiveWorkDir:s,treePath:g.treePath,openFileInTab:(...w)=>v.openFileInTab(...w),normalizePath:n,treeRootPath:g.treeRootPath,treeNodes:g.treeNodes,loadTreeDirectory:g.loadTreeDirectory});U.setKeyBindings({openQuickOpen:P.openQuickOpen,openGoToLine:P.openGoToLine});let T=pu(e,{getEffectiveWorkDir:s,treePath:g.treePath,treeRootPath:g.treeRootPath,treeNodes:g.treeNodes,normalizePath:n,loadTreeDirectory:g.loadTreeDirectory}),C=hu({store:e,normalizePath:n,getEffectiveWorkDir:s,openFiles:v.openFiles,activeFileIndex:v.activeFileIndex,activeFile:v.activeFile,fileLoading:v.fileLoading,fileSaving:v.fileSaving,saveTabsState:v.saveTabsState,createEditor:U.createEditor,openFileInTab:v.openFileInTab,tree:g,fp:T,qo:P,ops:_,mdPreviewMode:O.mdPreviewMode,renderOfficeLocal:O.renderOfficeLocal,editorContainer:l,debugStatus:U.debugStatus}),M=w=>_.deleteSingleFile(w,t),E=()=>_.deleteSelected(t),R=()=>_.ctxDelete(t),H=(w,B)=>_.onDrop(w,B,_.handleExternalFileDrop),G=w=>_.onTreeDrop(w,g.treeRootPath.value,_.handleExternalFileDrop),ue=()=>P.goToLineConfirm(v.activeFile);Vue.watch(()=>e.currentAgent,()=>{v.saveTabsState(e.currentConversation),U.destroyEditor(),g.clearTreeNodes(),v.openFiles.value=[],v.activeFileIndex.value=-1,v.fileLoading.value=!1,e.currentAgent&&Vue.nextTick(()=>g.initFileBrowser())});let J=e.currentConversation;Vue.watch(()=>e.currentConversation,w=>{v.saveTabsState(J),J=w,v.restoreTabsState(w);let B=s(),X=n(B);B&&X!==g.treeRootPath.value&&(g.treePath.value=B,g.treeRootPath.value=X,g.clearTreeNodes(),g.loadTreeDirectory(B))}),Vue.watch(()=>e.theme,w=>{let B=v.activeFile.value;B?.cmInstance&&B.cmInstance.setOption("theme",w==="dark"?"material-darker":"default")}),Vue.watch(()=>s(),w=>{if(w&&!g.treeRootPath.value){let B=n(w);g.treePath.value=w,g.treeRootPath.value=B,g.clearTreeNodes(),g.loadTreeDirectory(w)}}),Vue.watch(()=>v.activeFile.value?.content,(w,B)=>{let X=v.activeFile.value;if(X&&w!=null&&B==null&&!X.cmInstance&&(!X.fileType||X.fileType==="text")){if(St(X.name)&&O.mdPreviewMode.value)return;Vue.nextTick(()=>{setTimeout(()=>{X.cmInstance||U.createEditor(X)},150)})}}),Vue.watch([O.mdRenderedHtml,O.mdPreviewMode],([w,B])=>{w&&B&&Vue.nextTick(()=>{setTimeout(()=>O.renderMermaidBlocks(),50)})});let ve=w=>{!(a.value&&a.value.offsetParent!==null)&&!P.quickOpenVisible.value&&!P.goToLineVisible.value&&!L.findBarVisible.value||((w.ctrlKey||w.metaKey)&&w.key==="p"?(w.preventDefault(),P.quickOpenVisible.value?P.closeQuickOpen():P.openQuickOpen()):(w.ctrlKey||w.metaKey)&&w.key==="g"?(w.preventDefault(),P.goToLineVisible.value?P.closeGoToLine():P.openGoToLine()):(w.ctrlKey||w.metaKey)&&w.key==="f"?v.activeFile.value&&(w.preventDefault(),L.openFindBar(!1)):(w.ctrlKey||w.metaKey)&&(w.key==="r"||w.key==="h")?v.activeFile.value&&(w.preventDefault(),L.openFindBar(!0)):w.key==="Escape"&&(L.findBarVisible.value&&L.closeFindBar(),_.selectedPaths.size>0&&_.clearSelection(),P.quickOpenVisible.value&&P.closeQuickOpen(),P.goToLineVisible.value&&P.closeGoToLine()))},ae=()=>{_.hideContextMenu()},$=()=>{c.value=window.innerWidth<=768};return Vue.watch(()=>v.activeFileIndex.value,(w,B)=>{c.value&&w>=0&&w!==B&&(d.value="editor")}),Vue.watch(()=>v.openFiles.value.length,w=>{c.value&&w===0&&(d.value="tree")}),Vue.onMounted(()=>{window.addEventListener("workbench-message",C.handleWorkbenchMessage),window.addEventListener("open-file-in-explorer",C.handleOpenFile),window.addEventListener("conversation-deleted",v.handleConversationDeleted),window.addEventListener("keydown",ve),document.addEventListener("click",ae),window.addEventListener("resize",$),O.initMermaid(),e.currentAgent&&(g.initFileBrowser(),e.sendWsMessage({type:"restore_file_tabs"}))}),Vue.onUnmounted(()=>{window.removeEventListener("workbench-message",C.handleWorkbenchMessage),window.removeEventListener("open-file-in-explorer",C.handleOpenFile),window.removeEventListener("conversation-deleted",v.handleConversationDeleted),window.removeEventListener("keydown",ve),document.removeEventListener("click",ae),window.removeEventListener("resize",$),U.destroyEditor(),_.cleanup()}),{store:e,debugStatus:U.debugStatus,rootEl:a,isMobile:c,mobileView:d,mobileGoBack:u,fontSize:f,zoomIn:m,zoomOut:y,onWheel:h,treePath:g.treePath,treeRootPath:g.treeRootPath,treeNodes:g.treeNodes,flattenedTree:g.flattenedTree,editingTreePath:g.editingTreePath,treePathInputRef:g.treePathInputRef,rootFolderName:g.rootFolderName,rootExpanded:g.rootExpanded,toggleRootExpand:g.toggleRootExpand,collapseAll:g.collapseAll,startTreePathEdit:g.startTreePathEdit,confirmTreePath:g.confirmTreePath,cancelTreePathEdit:g.cancelTreePathEdit,treePanelWidth:A,isTreeResizing:x,startTreeResize:S,openFiles:v.openFiles,activeFileIndex:v.activeFileIndex,activeFile:v.activeFile,fileLoading:v.fileLoading,fileSaving:v.fileSaving,editorContainer:l,officePreviewContainer:O.officePreviewContainer,mdPreviewRef:O.mdPreviewRef,isActiveMarkdown:O.isActiveMarkdown,mdPreviewMode:O.mdPreviewMode,mdRenderedHtml:O.mdRenderedHtml,switchToMdEdit:O.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:ue,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:E,openMoveDialog:_.openMoveDialog,confirmMove:_.confirmMove,contextMenu:_.contextMenu,showContextMenu:_.showContextMenu,hideContextMenu:_.hideContextMenu,ctxRename:_.ctxRename,ctxCopy:_.ctxCopy,ctxMoveTo:_.ctxMoveTo,ctxDelete:R,ctxDownload:_.ctxDownload,renameDialogVisible:_.renameDialogVisible,renameNewName:_.renameNewName,renameInput:_.renameInput,confirmRename:_.confirmRename,dragState:_.dragState,externalDropActive:_.externalDropActive,onDragStart:_.onDragStart,onDragOver:_.onDragOver,onDragLeave:_.onDragLeave,onDrop:H,onTreeDragOver:_.onTreeDragOver,onTreeDragLeave:_.onTreeDragLeave,onTreeDrop:G,loadRootDirectory:g.loadRootDirectory,onTreeItemClick:g.onTreeItemClick,openFileInTab:v.openFileInTab,switchToTab:v.switchToTab,closeFileTab:v.closeFileTab,saveFile:v.saveFile,openFolderPicker:T.openFolderPicker,folderPickerNavigateUp:T.folderPickerNavigateUp,folderPickerSelectItem:T.folderPickerSelectItem,folderPickerEnter:T.folderPickerEnter,confirmFolderPicker:T.confirmFolderPicker,getFileIcon:()=>"",getFileIconHtml:i,getFolderIcon:r,formatSize:o,refresh:g.refresh,placeholderPath:Vue.computed(()=>{let w=s();return w?t("files.workDir",{dir:w}):t("files.enterDirPath")})}}}});var pi,uo=N(()=>{qd();eu();bu();pi={name:"WorkbenchPanel",components:{TerminalTab:Bd,GitStatusTab:Jd,FilesTab:yu},template:`
|
|
2499
2499
|
<div class="workbench-panel" :class="{ expanded: store.workbenchExpanded, maximized: store.workbenchMaximized }" :style="panelStyle">
|
|
2500
2500
|
<!-- \u5C55\u5F00\u65F6\u7684\u5B8C\u6574\u9762\u677F -->
|
|
2501
2501
|
<div class="workbench-content" v-if="store.workbenchExpanded">
|
|
@@ -3296,7 +3296,7 @@ ${String(e||"").trim()}
|
|
|
3296
3296
|
</div>
|
|
3297
3297
|
</div>
|
|
3298
3298
|
</div>
|
|
3299
|
-
`,setup(e,{emit:t}){let s=Pinia.useChatStore(),n=Vue.getCurrentInstance(),i=S=>n?.proxy?.$t?.(S)??S,r=Vue.computed(()=>s.yeaftMcpServers||[]),o=Vue.computed(()=>s.yeaftMcpRuntime||{connected:!1,toolCount:0,perServer:[]}),a=Vue.computed(()=>!!s.yeaftMcpLoading),l=Vue.computed(()=>{let S=new Map((o.value.perServer||[]).map(v=>[v.name,v]));return r.value.map(v=>{let g=S.get(v.name);return{...v,ready:!!(g&&g.ready),toolCount:g?g.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 f(S){if(!S)return[];let v=[],g=/"([^"]*)"|'([^']*)'|(\S+)/g,b;for(;(b=g.exec(S))!==null;)v.push(b[1]??b[2]??b[3]);return v}function p(S){if(!S)return{};let v={},g=S.split(/\r?\n/);for(let b of g){let D=b.trim();if(!D||D.startsWith("#"))continue;let L=D.indexOf("=");if(L<0)continue;let U=D.slice(0,L).trim(),
|
|
3299
|
+
`,setup(e,{emit:t}){let s=Pinia.useChatStore(),n=Vue.getCurrentInstance(),i=S=>n?.proxy?.$t?.(S)??S,r=Vue.computed(()=>s.yeaftMcpServers||[]),o=Vue.computed(()=>s.yeaftMcpRuntime||{connected:!1,toolCount:0,perServer:[]}),a=Vue.computed(()=>!!s.yeaftMcpLoading),l=Vue.computed(()=>{let S=new Map((o.value.perServer||[]).map(v=>[v.name,v]));return r.value.map(v=>{let g=S.get(v.name);return{...v,ready:!!(g&&g.ready),toolCount:g?g.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 f(S){if(!S)return[];let v=[],g=/"([^"]*)"|'([^']*)'|(\S+)/g,b;for(;(b=g.exec(S))!==null;)v.push(b[1]??b[2]??b[3]);return v}function p(S){if(!S)return{};let v={},g=S.split(/\r?\n/);for(let b of g){let D=b.trim();if(!D||D.startsWith("#"))continue;let L=D.indexOf("=");if(L<0)continue;let U=D.slice(0,L).trim(),O=D.slice(L+1);U&&(v[U]=O)}return v}function m(){d.value="";let S=(c.name||"").trim(),v=(c.command||"").trim();if(!S)return d.value=i("settings.mcp.errors.nameRequired"),null;if(!/^[a-z0-9_-]+$/.test(S))return d.value=i("settings.mcp.errors.nameFormat"),null;if(!v)return d.value=i("settings.mcp.errors.commandRequired"),null;let g=[],b={};try{g=f(c.argsRaw)}catch{return d.value=i("settings.mcp.errors.argsParse"),null}try{b=p(c.envRaw)}catch{return d.value=i("settings.mcp.errors.envParse"),null}return{name:S,command:v,args:g,env:b}}async function y(){let S=m();if(!S)return;let v=await s.addYeaftMcpServer(S);if(v?.error){t("message",v.error,!0);return}v?.connectError?t("message",i("settings.mcp.connectFailed")+": "+v.connectError,!0):t("message",i("settings.mcp.addSuccess"),!1),u()}async function h(S){if(!S||!confirm(i("settings.mcp.confirmRemove").replace("{name}",S)))return;let v=await s.removeYeaftMcpServer(S);v?.error?t("message",v.error,!0):t("message",i("settings.mcp.removeSuccess"),!1)}async function A(S){let v=await s.reloadYeaftMcpServer(S);v?.error?t("message",v.error,!0):t("message",i("settings.mcp.reloadSuccess"),!1)}async function x(){let S=await s.reloadYeaftMcpServer(null);S?.error?t("message",S.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:y,removeOne:h,reloadOne:A,reloadAll:x}}}});var fi,po=N(()=>{lt();Vr();Hr();Ut();ku();xu();Mu();Du();fi={name:"SettingsPanel",components:{DashboardTab:wu,VpCrudPanel:Au,SearchSettingsTab:Tu,McpTab:Pu},props:{visible:Boolean,initialTab:{type:String,default:""},initialSubTab:{type:String,default:""},initialEditVpId:{type:String,default:""}},emits:["close"],template:`
|
|
3300
3300
|
<div
|
|
3301
3301
|
class="settings-overlay"
|
|
3302
3302
|
v-if="visible"
|
|
@@ -4005,7 +4005,7 @@ ${String(e||"").trim()}
|
|
|
4005
4005
|
</div>
|
|
4006
4006
|
</div>
|
|
4007
4007
|
</div>
|
|
4008
|
-
`,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},f=Vue.computed(()=>{if(!a.value)return null;let w=ct[a.value];return w||s.customExpertRoles.find(B=>B.id===a.value)||null}),p=Vue.computed(()=>{let w=f.value;return w?`${w.title}\xB7${w.name}`:""}),m=Vue.computed(()=>!a.value||!s.expertRoleDefinitions?null:s.expertRoleDefinitions[a.value]||null),y=Vue.computed(()=>!a.value||ct[a.value]?null:s.customExpertRoles.find(w=>w.id===a.value)||null),h=Vue.ref(new Set([Ja])),A=Vue.computed(()=>e.modelValue),x=Vue.computed(()=>el(r.value)),S=Vue.computed(()=>{let w=[...x.value];return w.push({id:"custom",name:o.value?"\u81EA\u5B9A\u4E49":"Custom",icon:"\u2728",order:99}),w}),v=Vue.computed(()=>h.value.has("custom")),g=Vue.computed(()=>new Set(x.value.map(w=>w.id))),b=Vue.computed(()=>Xa().filter(w=>g.value.has(w.teamId)&&h.value.has(w.teamId)));Vue.watch(()=>e.visible,w=>{w&&(s.fetchExpertRoleDefinitions(),s.fetchCustomExpertRoles())});let D=w=>{a.value=w,ct[w]&&s.fetchExpertRoleDefinitions()},L=w=>{c.value=w,l.value=!0},U=()=>{s.fetchCustomExpertRoles()},
|
|
4008
|
+
`,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},f=Vue.computed(()=>{if(!a.value)return null;let w=ct[a.value];return w||s.customExpertRoles.find(B=>B.id===a.value)||null}),p=Vue.computed(()=>{let w=f.value;return w?`${w.title}\xB7${w.name}`:""}),m=Vue.computed(()=>!a.value||!s.expertRoleDefinitions?null:s.expertRoleDefinitions[a.value]||null),y=Vue.computed(()=>!a.value||ct[a.value]?null:s.customExpertRoles.find(w=>w.id===a.value)||null),h=Vue.ref(new Set([Ja])),A=Vue.computed(()=>e.modelValue),x=Vue.computed(()=>el(r.value)),S=Vue.computed(()=>{let w=[...x.value];return w.push({id:"custom",name:o.value?"\u81EA\u5B9A\u4E49":"Custom",icon:"\u2728",order:99}),w}),v=Vue.computed(()=>h.value.has("custom")),g=Vue.computed(()=>new Set(x.value.map(w=>w.id))),b=Vue.computed(()=>Xa().filter(w=>g.value.has(w.teamId)&&h.value.has(w.teamId)));Vue.watch(()=>e.visible,w=>{w&&(s.fetchExpertRoleDefinitions(),s.fetchCustomExpertRoles())});let D=w=>{a.value=w,ct[w]&&s.fetchExpertRoleDefinitions()},L=w=>{c.value=w,l.value=!0},U=()=>{s.fetchCustomExpertRoles()},O=w=>{d.value=w},_=async()=>{if(d.value){try{let w=d.value.id,B=A.value.filter(X=>X.role!==w);B.length!==A.value.length&&t("update:modelValue",B),await s.deleteCustomExpertRole(w)}catch{}d.value=null}},P=w=>{if(!(h.value.size===1&&h.value.has(w)))if(h.value=new Set([w]),w==="custom"){let B=new Set(s.customExpertRoles.map(re=>re.id)),X=A.value.filter(re=>B.has(re.role));X.length!==A.value.length&&t("update:modelValue",X)}else{let B=A.value.filter(X=>{let re=ct[X.role];return re&&re.group===w});B.length!==A.value.length&&t("update:modelValue",B)}},T=(w,B)=>A.value.some(X=>X.role===w&&X.action===(B||null)),C=w=>A.value.some(B=>B.role===w&&!B.action),M=w=>A.value.some(B=>B.role===w),E=w=>A.value.length>=Ht&&!M(w),R=(w,B)=>T(w,B)?!1:!!(M(w)||A.value.length>=Ht),H=w=>{if(C(w.id)){t("update:modelValue",A.value.filter(B=>!(B.role===w.id&&!B.action)));return}if(M(w.id)){t("update:modelValue",[...A.value.filter(B=>B.role!==w.id),{role:w.id,action:null}]);return}A.value.length>=Ht||t("update:modelValue",[...A.value,{role:w.id,action:null}])},G=(w,B)=>{if(T(w.id,B.id)){t("update:modelValue",A.value.filter(X=>!(X.role===w.id&&X.action===B.id)));return}if(M(w.id)){t("update:modelValue",[...A.value.filter(X=>X.role!==w.id),{role:w.id,action:B.id}]);return}A.value.length>=Ht||t("update:modelValue",[...A.value,{role:w.id,action:B.id}])};return{store:s,roleListRef:i,enabledTeams:h,selections:A,availableTeams:x,allTeamTabs:S,filteredGroups:b,isZh:o,isCustomTabActive:v,viewingRoleId:a,viewingRoleMeta:f,viewingRoleTitle:p,viewingRoleDef:m,viewingCustomRole:y,viewRole:D,editorOpen:l,editingRole:c,openEditor:L,onEditorSaved:U,deletingRole:d,confirmDeleteRole:O,executeDelete:_,toggleTeam:P,isSelected:T,isRoleOnlySelected:C,hasRoleSelection:M,isRoleDisabled:E,isDisabled:R,toggleRoleOnly:H,toggleAction:G,toggleCustomRoleOnly:w=>{H(w)},toggleCustomAction:(w,B)=>{G(w,B)},getSelectionLabelFull:w=>{if(ct[w.role])return Ot(w);let X=s.customExpertRoles.find(re=>re.id===w.role);if(!X)return w.role;if(w.action){let re=X.actions?.find(ke=>ke.id===w.action);return re?`${X.name}\xB7${re.name}`:X.name}return X.name},removeSelection:w=>{let B=[...A.value];B.splice(w,1),t("update:modelValue",B)},clearAll:()=>{t("update:modelValue",[])},getSelectionLabel:Ot}}}});var mi,go=N(()=>{Qs();mi={name:"SubAgentPanel",props:{visible:{type:Boolean,default:!1}},emits:["close"],template:`
|
|
4009
4009
|
<div class="subagent-panel" :class="{ open: visible, expanded: store.activeSubagentId }" role="complementary" aria-label="Sub-Agents">
|
|
4010
4010
|
<!-- Expanded Mode: Full message thread for a subagent -->
|
|
4011
4011
|
<template v-if="store.activeSubagentId && activeAgent">
|
|
@@ -4317,7 +4317,7 @@ ${String(e||"").trim()}
|
|
|
4317
4317
|
<p class="pane-empty-text">{{ $t('splitScreen.selectFromSidebar') }}</p>
|
|
4318
4318
|
</div>
|
|
4319
4319
|
</div>
|
|
4320
|
-
`,setup(e){let t=Pinia.useChatStore(),s=Vue.ref(null),n=Vue.computed(()=>t.activePanelId===e.paneId),i=Vue.computed(()=>t.panels.find(te=>te.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(q=>q.isStreaming)),l=Vue.computed(()=>o.value&&!a.value),c=Vue.ref(0),d=Vue.ref(Date.now()),u=null,f=Vue.ref("cat"),p=new URLSearchParams(window.location.search).get("preview"),m=Vue.ref(0),y=Vue.ref(1),h=Vue.ref(5),A=Vue.ref(95),x=Vue.ref("bark-both"),S=Vue.ref(1),v=Vue.ref(-1),g=null;function b(){if(!c.value)return;d.value=Date.now();let q=(d.value-c.value)%19e3;if(q<4e3)m.value=0,y.value=1;else if(q<11500){let te=q-4e3,se;te<2500?se=te/2500*16:te<5e3?se=16+(te-2500)/2500*29:se=45+(te-5e3)/2500*55,m.value=se,y.value=1}else q<14e3?(m.value=(1-(q-11500)/2500)*100,y.value=-1):(m.value=0,y.value=1);u=requestAnimationFrame(b)}function D(){if(!c.value||f.value!=="dog")return;d.value=Date.now();let q=(d.value-c.value)%18e3;if(q<2e3)h.value=5,A.value=95,x.value="bark-both",S.value=1,v.value=-1;else if(q<5e3){let te=(q-2e3)/3e3;h.value=5+te*25,A.value=95,x.value="left-approach",S.value=1,v.value=-1}else if(q<8e3){let te=(q-5e3)/3e3;h.value=30,A.value=95-te*25,x.value="right-approach",S.value=1,v.value=-1}else if(q<1e4){let te=(q-8e3)/2e3;h.value=30+te*13,A.value=70-te*13,x.value="both-approach",S.value=1,v.value=-1}else if(q<11e3)h.value=43,A.value=57,x.value="snap",S.value=1,v.value=-1;else if(q<12500)h.value=43,A.value=57,x.value="stunned",S.value=1,v.value=-1;else if(q<15e3){let te=(q-12500)/2500;h.value=43-te*38,A.value=57+te*38,x.value="retreat",S.value=-1,v.value=1}else q<17e3?(h.value=5,A.value=95,x.value="rehang",S.value=-1,v.value=1):(h.value=5,A.value=95,x.value="reset",S.value=1,v.value=-1);g=requestAnimationFrame(D)}let L=Vue.computed(()=>{let q=h.value*1.2;return S.value<0?`translate(${q+13.5}, 0) scale(-1, 1)`:`translate(${q-13.5}, 0)`}),U=Vue.computed(()=>{let q=A.value*1.2;return v.value>0?`translate(${q-10.5}, 2)`:`translate(${q+10.5}, 2) scale(-1, 1)`}),
|
|
4320
|
+
`,setup(e){let t=Pinia.useChatStore(),s=Vue.ref(null),n=Vue.computed(()=>t.activePanelId===e.paneId),i=Vue.computed(()=>t.panels.find(te=>te.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(q=>q.isStreaming)),l=Vue.computed(()=>o.value&&!a.value),c=Vue.ref(0),d=Vue.ref(Date.now()),u=null,f=Vue.ref("cat"),p=new URLSearchParams(window.location.search).get("preview"),m=Vue.ref(0),y=Vue.ref(1),h=Vue.ref(5),A=Vue.ref(95),x=Vue.ref("bark-both"),S=Vue.ref(1),v=Vue.ref(-1),g=null;function b(){if(!c.value)return;d.value=Date.now();let q=(d.value-c.value)%19e3;if(q<4e3)m.value=0,y.value=1;else if(q<11500){let te=q-4e3,se;te<2500?se=te/2500*16:te<5e3?se=16+(te-2500)/2500*29:se=45+(te-5e3)/2500*55,m.value=se,y.value=1}else q<14e3?(m.value=(1-(q-11500)/2500)*100,y.value=-1):(m.value=0,y.value=1);u=requestAnimationFrame(b)}function D(){if(!c.value||f.value!=="dog")return;d.value=Date.now();let q=(d.value-c.value)%18e3;if(q<2e3)h.value=5,A.value=95,x.value="bark-both",S.value=1,v.value=-1;else if(q<5e3){let te=(q-2e3)/3e3;h.value=5+te*25,A.value=95,x.value="left-approach",S.value=1,v.value=-1}else if(q<8e3){let te=(q-5e3)/3e3;h.value=30,A.value=95-te*25,x.value="right-approach",S.value=1,v.value=-1}else if(q<1e4){let te=(q-8e3)/2e3;h.value=30+te*13,A.value=70-te*13,x.value="both-approach",S.value=1,v.value=-1}else if(q<11e3)h.value=43,A.value=57,x.value="snap",S.value=1,v.value=-1;else if(q<12500)h.value=43,A.value=57,x.value="stunned",S.value=1,v.value=-1;else if(q<15e3){let te=(q-12500)/2500;h.value=43-te*38,A.value=57+te*38,x.value="retreat",S.value=-1,v.value=1}else q<17e3?(h.value=5,A.value=95,x.value="rehang",S.value=-1,v.value=1):(h.value=5,A.value=95,x.value="reset",S.value=1,v.value=-1);g=requestAnimationFrame(D)}let L=Vue.computed(()=>{let q=h.value*1.2;return S.value<0?`translate(${q+13.5}, 0) scale(-1, 1)`:`translate(${q-13.5}, 0)`}),U=Vue.computed(()=>{let q=A.value*1.2;return v.value>0?`translate(${q-10.5}, 2)`:`translate(${q+10.5}, 2) scale(-1, 1)`}),O=Vue.computed(()=>{let q=x.value;return q==="bark-both"||q==="left-approach"||q==="right-approach"||q==="both-approach"||q==="reset"}),_=Vue.computed(()=>{let q=h.value*1.2,te=10;if(O.value){let j=Math.max(0,(q-3)*.12);return`M3,18 Q${(3+q)/2},${18+j} ${q},${te}`}if(x.value==="rehang")return`M${q},${te} Q${q-3},20 3,18`;let se=S.value<0?1:-1,be=q+se*8;return`M${q},${te} Q${q},18 ${be},22`}),P=Vue.computed(()=>{let q=A.value*1.2,te=10;if(O.value){let j=Math.max(0,(118-q)*.12);return`M118,18 Q${(118+q)/2},${18+j} ${q},${te}`}if(x.value==="rehang")return`M${q},${te} Q${q+3},20 118,18`;let se=v.value>0?-1:1,be=q+se*8;return`M${q},${te} Q${q},18 ${be},22`}),T=Vue.computed(()=>x.value==="snap"?.2:.4),C=Vue.computed(()=>x.value==="snap"?.2:.4),M=Vue.computed(()=>h.value*1.2),E=Vue.computed(()=>A.value*1.2),R=Vue.computed(()=>p==="cat"||p==="dog"||p==="animation"?!0:l.value);Vue.watch(l,q=>{q?(c.value=Date.now(),d.value=Date.now(),f.value="cat",m.value=0,y.value=1,h.value=5,A.value=95,x.value="bark-both",S.value=1,v.value=-1,f.value==="cat"?u=requestAnimationFrame(b):g=requestAnimationFrame(D)):(c.value=0,m.value=0,y.value=1,u&&(cancelAnimationFrame(u),u=null),g&&(cancelAnimationFrame(g),g=null))},{immediate:!0}),(p==="cat"||p==="dog"||p==="animation")&&(c.value=Date.now(),d.value=Date.now(),p==="dog"?f.value="dog":f.value="cat",f.value==="cat"?u=requestAnimationFrame(b):(h.value=5,A.value=95,x.value="bark-both",S.value=1,v.value=-1,g=requestAnimationFrame(D))),Vue.onUnmounted(()=>{u&&(cancelAnimationFrame(u),u=null),g&&(cancelAnimationFrame(g),g=null)});let H=Vue.computed(()=>{if(!o.value)return null;if(t.connectionState!=="connected")return"disconnected";let q=i.value;if(t.compactStatus?.conversationId===q&&t.compactStatus?.status==="compacting")return"compacting";let te=t.sessionHealth?.[q];return te?te.status:c.value&&d.value-c.value>8e3?"thinking":null}),G=Vue.computed(()=>{if(!c.value)return"speed-napping";let q=(d.value-c.value)%19e3;return q>=16e3?"speed-petted":q>=14e3?"speed-tired":q>=11500?"speed-crazy":q>=9e3?"speed-turbo":q>=6500?"speed-fast":q>=4e3?"speed-normal":"speed-napping"}),ue=Vue.computed(()=>{let q=m.value,te=y.value,be={left:`calc(40px + (100% - 80px) * ${q/100})`};return te<0&&(be.transform="scaleX(-1)"),be});function J(){let q=i.value;if(!q)return;let te=t.conversations.find(se=>se.id===q);t.sendWsMessage({type:"refresh_conversation",conversationId:q,agentId:te?.agentId})}let ve=Vue.computed(()=>{let q=r.value,te=[],se=null,be=0,j=()=>{se&&((se.textContent||se.toolMsgs.length>0||se.todoMsg||se.askMsg)&&te.push(se),se=null)},ee=()=>{be++,se={type:"assistant-turn",id:"turn_"+be,textContent:"",isStreaming:!1,todoMsg:null,toolMsgs:[],askMsg:null,messages:[]}};for(let me=0;me<q.length;me++){let ge=q[me];if(ge.type==="user"){if(!ge.content||!ge.content.trim())continue;j(),te.push({type:"user",id:ge.id||"u_"+me,message:ge});continue}if(ge.type==="system"||ge.type==="error"){j(),te.push({type:ge.type,id:ge.id||"s_"+me,message:ge});continue}if(!(ge.type==="tool-result"||ge.type==="tool_result")){if(ge.type==="assistant"){se||ee(),ge.content&&(se.textContent+=ge.content),ge.isStreaming&&(se.isStreaming=!0),se.messages.push(ge);continue}if(ge.type==="tool-use"){se||ee();let Ee=q[me+1],Oe=Ee&&(Ee.type==="tool-result"||Ee.type==="tool_result"),He={...ge,hasResult:Oe||ge.hasResult||!1,toolResult:ge.toolResult||null};ge.toolName==="TodoWrite"?se.todoMsg=He:ge.toolName==="AskUserQuestion"?se.askMsg=He:se.toolMsgs.push(He),se.messages.push(ge);continue}j(),te.push({type:ge.type||"unknown",id:ge.id||"x_"+me,message:ge})}}return j(),te}),ae=(q,te)=>{if(!i.value)return;let se=te||[];t.sendMessageToConversation(i.value,q,se)},$=()=>{i.value&&t.cancelExecutionForConversation(i.value)};function w(){t.setActivePanel(e.paneId)}function B(){t.removePanel(e.paneId)}let X=Vue.computed(()=>t.getPaneRightPanel(e.paneId));function re(){t.setPaneRightPanel(e.paneId,null)}let ke=Vue.ref(!0),Pe=50,De=()=>{if(!s.value)return!0;let{scrollTop:q,scrollHeight:te,clientHeight:se}=s.value;return te-q-se<=Pe},ne=()=>{s.value&&(s.value.scrollTop=s.value.scrollHeight)},Q=()=>{ke.value=De()};return Vue.watch(()=>r.value.length,()=>{ke.value&&Vue.nextTick(ne)}),Vue.watch(()=>{let q=r.value,te=q[q.length-1];return te?.isStreaming?te.content?.length:0},()=>{ke.value&&Vue.nextTick(ne)}),Vue.watch(i,()=>{s.value&&s.value.removeEventListener("scroll",Q),ke.value=!0,Vue.nextTick(()=>{s.value&&(s.value.addEventListener("scroll",Q),ne())})}),Vue.onMounted(()=>{s.value&&(s.value.addEventListener("scroll",Q),ne())}),Vue.onUnmounted(()=>{s.value&&s.value.removeEventListener("scroll",Q)}),{store:t,containerRef:s,isActivePanel:n,conversationId:i,messages:r,isProcessing:o,showTypingDots:l,previewShowTypingDots:R,waitingStatus:H,animationType:f,catSpeed:G,catStyle:ue,dogPhase:x,spikeTransform:L,teddyTransform:U,leashPathL:_,leashPathR:P,leashOpacityL:T,leashOpacityR:C,questionLX:M,questionRX:E,refreshSession:J,turnGroups:ve,sendFn:ae,cancelFn:$,setActive:w,closePane:B,paneRightPanel:X,closePanePanel:re}}}});var Ss,Vu,_m,Rm,Lm,$m,Fu,Ou=N(()=>{({ref:Ss,computed:Vu,watch:_m,onMounted:Rm,onBeforeUnmount:Lm,nextTick:$m}=Vue),Fu={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"}},emits:["update:modelValue","change"],setup(e,{emit:t}){let s=Ss(!1),n=Ss(""),i=Ss(null),r=Ss(null),o=Ss(null),a=Ss(-1),l=Vu(()=>e.options.find(y=>y.value===e.modelValue)||null),c=Vu(()=>{if(!e.searchable||!n.value.trim())return e.options;let y=n.value.trim().toLowerCase();return e.options.filter(h=>String(h.label||"").toLowerCase().includes(y)||String(h.sublabel||"").toLowerCase().includes(y)||String(h.value||"").toLowerCase().includes(y))});function d(){e.disabled||(s.value=!s.value,s.value&&(n.value="",a.value=c.value.findIndex(y=>y.value===e.modelValue),$m(()=>{if(e.searchable&&o.value&&o.value.focus&&o.value.focus(),r.value){let y=r.value.querySelector(".modern-select-option.is-active");y&&y.scrollIntoView&&y.scrollIntoView({block:"nearest"})}})))}function u(){s.value=!1}function f(y){t("update:modelValue",y.value),t("change",y.value),u()}function p(y){if(!s.value){(y.key==="Enter"||y.key===" "||y.key==="ArrowDown")&&(y.preventDefault(),d());return}if(y.key==="Escape"){y.preventDefault(),u();return}if(y.key==="ArrowDown")y.preventDefault(),a.value=Math.min(c.value.length-1,a.value+1);else if(y.key==="ArrowUp")y.preventDefault(),a.value=Math.max(0,a.value-1);else if(y.key==="Enter"){y.preventDefault();let h=c.value[a.value];h&&f(h)}}function m(y){s.value&&(i.value&&i.value.contains(y.target)||r.value&&r.value.contains(y.target)||u())}return Rm(()=>document.addEventListener("mousedown",m)),Lm(()=>document.removeEventListener("mousedown",m)),_m(()=>e.modelValue,()=>{}),{open:s,search:n,triggerEl:i,menuEl:r,searchEl:o,activeIdx:a,selected:l,filtered:c,toggle:d,close:u,pick:f,onKey:p}},template:`
|
|
4321
4321
|
<div class="modern-select" :class="{ 'is-open': open, 'is-disabled': disabled }">
|
|
4322
4322
|
<button
|
|
4323
4323
|
type="button"
|
|
@@ -7232,7 +7232,7 @@ ${String(e||"").trim()}
|
|
|
7232
7232
|
</section>
|
|
7233
7233
|
</aside>
|
|
7234
7234
|
`,setup(e,{emit:t}){let s=window.Pinia&&window.Pinia.useVpStore?window.Pinia.useVpStore():null,n=C=>s&&typeof s.vpTextColor=="function"?s.vpTextColor(C):"var(--text-primary)",i=Vue.getCurrentInstance(),r=i&&i.appContext.config.globalProperties.$t||(C=>C),o=Vue.computed(()=>(typeof e.announcementText=="string"?e.announcementText:"").trim()),a=Vue.computed(()=>!!o.value),l=Vue.computed(()=>{let C=o.value.replace(/\s+/g," ");return C.length<=96?C:C.slice(0,95)+"\u2026"}),c=Vue.ref({}),d=new Map,u=new Map,f=C=>{let M=d.get(C);M&&(M.scrollTop=M.scrollHeight,u.set(C,!0))},p=C=>{let M=!c.value[C];c.value={...c.value,[C]:M},M&&(u.set(C,!0),Vue.nextTick(()=>f(C)))},m=(C,M)=>{M?(d.set(C,M),u.has(C)||u.set(C,!0),Vue.nextTick(()=>{u.get(C)&&f(C)})):d.delete(C)},y=C=>{let M=d.get(C);if(!M)return;let E=M.scrollHeight-M.scrollTop-M.clientHeight;u.set(C,E<8)};Vue.watch(()=>JSON.stringify((Array.isArray(e.tasks)?e.tasks:[]).map(C=>[C.id,C?.log?.preview||""])),()=>Vue.nextTick(()=>{d.forEach((C,M)=>{u.get(M)&&f(M)})}));let h=C=>{let M=C?.ownerVpId||"";return M?s&&typeof s.vpLabel=="function"?s.vpLabel(M):M:"unknown"},A=C=>{if(!C)return"";try{return new Date(C).toLocaleTimeString()}catch{return String(C)}},x=C=>{switch(C?.kind){case"sub_agent":return r("yeaft.sessionStatus.task.kind.subAgent");case"shell":return r("yeaft.sessionStatus.task.kind.shell");default:return C?.kind||""}},S=C=>{let M=C?.runtime?.command;return typeof M=="string"?M.trim():""},v=C=>{let M=[],E=C?.title||C?.id||"",R=S(C);return E&&M.push(`${r("yeaft.sessionStatus.task.title")}: ${E}`),R&&M.push(`${r("yeaft.sessionStatus.task.command")}: ${R}`),M.join(`
|
|
7235
|
-
`)},g=C=>`${C?.sessionId||""}::${C?.id||""}`,b=C=>C?.kind==="shell"&&C?.status==="running"&&!!C?.runtime?.pid,D=C=>!!(C?.id&&e.stoppingTasksById?.[g(C)]),L=C=>sh(C,r),U=C=>kp(C,r),
|
|
7235
|
+
`)},g=C=>`${C?.sessionId||""}::${C?.id||""}`,b=C=>C?.kind==="shell"&&C?.status==="running"&&!!C?.runtime?.pid,D=C=>!!(C?.id&&e.stoppingTasksById?.[g(C)]),L=C=>sh(C,r),U=C=>kp(C,r),O=C=>{switch(C.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"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 C.status}},_=new Set(["typing","thinking","streaming","tool"]);return{hasAnnouncement:a,announcementPreview:l,statusLabel:O,isActiveStatus:C=>_.has(C),threadCountTitle:C=>{let M=Array.isArray(C&&C.threads)?C.threads:[];return M.length?M.slice(0,5).map(E=>`${E.title||E.threadId||"thread"}: ${E.status||"idle"}`).join(`
|
|
7236
7236
|
`):""},vpTextColorFor:n,expandedTasks:c,toggleTaskExpanded:p,taskOwnerName:h,formatTaskTime:A,taskKindLabel:x,shellTaskCommand:S,taskSummaryTitle:v,isTaskCancellable:b,isTaskStopping:D,taskDetailLines:L,subAgentTaskStreamText:U,setTaskLogRef:m,onTaskLogScroll:y}}}});var Ip,Ap=N(()=>{Ip={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:`
|
|
7237
7237
|
<div class="yeaft-session-actions">
|
|
7238
7238
|
<button
|
|
@@ -7688,7 +7688,7 @@ ${String(e||"").trim()}
|
|
|
7688
7688
|
@open-vp-library="openVpLibraryFromGroupSettings"
|
|
7689
7689
|
/>
|
|
7690
7690
|
</div>
|
|
7691
|
-
`,setup(){let e=Pinia.useChatStore(),t=Pinia.useAuthStore(),s=Pinia.useVpStore(),n=Vue.getCurrentInstance(),i=n&&n.appContext.config.globalProperties.$t||(I=>I),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(""),f=Vue.ref(!1),p=Vue.ref(""),m=null,y=Vue.ref("vp"),h=Vue.ref(null),A=Vue.ref(null),x=Vue.ref(null),S=Vue.ref(null),v=Vue.ref(null),g=Vue.ref(!1),b=Vue.ref(0),D=null,L=Vue.computed(()=>{let I=e.currentAgent||"agent",Y=qe(),le=e.yeaftActiveSessionFilter||Y?.activeSessionId||"session";return`yeaft:${I}:${le}`}),U=null,F=null,_=I=>{if(!I)return!1;let Y=String(I.tagName||"").toLowerCase();return Y==="textarea"||Y==="input"||I.isContentEditable===!0},P=({recoverScroll:I=!1}={})=>{let Y=x.value;if(!Y)return;if(!O.value){Y.style.removeProperty("--yeaft-visual-viewport-height");return}let le=window.visualViewport,Ve=Math.max(1,Math.round(le?.height||window.innerHeight||1));Y.style.setProperty("--yeaft-visual-viewport-height",`${Ve}px`),!(!I||le&&window.innerHeight&&le.height<window.innerHeight*.85||_(document.activeElement))&&window.scrollTo(0,0)},T=(I={})=>{U!=null&&cancelAnimationFrame(U),U=requestAnimationFrame(()=>{U=null,P(I)})},C=()=>{T({recoverScroll:!0}),F&&clearTimeout(F),F=setTimeout(()=>{F=null,T({recoverScroll:!0})},260)},M=Vue.computed(()=>e.hasCapability("terminal")||e.hasCapability("file_editor")),E=Vue.computed(()=>!0),R=I=>{let Y=I&&I.id?I.id:null;Y&&(e.setActiveSessionFilter(Y,{agentId:I.agentId||null}),O.value&&e.closeSessionSidebar())},H=I=>{},G=Vue.ref(null),ue=Vue.ref(!1),J=320,ve=Math.max(J,Math.round(window.innerWidth*.25)),ae=localStorage.getItem("yeaft-debug-width"),$=Vue.ref(ae?parseInt(ae,10):ve),w=Vue.computed(()=>({"--yeaft-detail-width":$.value+"px"})),B=I=>{ue.value=!0;let Y=I.clientX,le=$.value,Ve=window.innerWidth*.6,Me=ht=>{let Ls=Y-ht.clientX,ns=Math.min(Ve,Math.max(J,le+Ls));$.value=ns},Ge=()=>{ue.value=!1,document.removeEventListener("mousemove",Me),document.removeEventListener("mouseup",Ge),localStorage.setItem("yeaft-debug-width",String($.value))};document.addEventListener("mousemove",Me),document.addEventListener("mouseup",Ge)},X="yeaft-session-status-visible",re=()=>{try{let I=localStorage.getItem(X);return!(I==="0"||I==="false")}catch{return!0}},ke=Vue.ref(re()),Pe=I=>{ke.value=!!I;try{localStorage.setItem(X,ke.value?"1":"0")}catch{}},De=()=>Pe(!ke.value),ne=()=>Pe(!1),Q=220,q=280,te=(()=>{try{return localStorage.getItem("yeaft-vp-timeline-width")}catch{return null}})(),se=te?parseInt(te,10):NaN,be=Vue.ref(Number.isFinite(se)&&se>=Q?se:q),j=Vue.computed(()=>({"--yeaft-vp-timeline-width":be.value+"px"})),ee=I=>{let Y=I.clientX,le=be.value,Ve=Math.max(Q,Math.floor(window.innerWidth*.4)),Me=ht=>{let Ls=Y-ht.clientX,ns=Math.min(Ve,Math.max(Q,le+Ls));be.value=ns},Ge=()=>{document.removeEventListener("mousemove",Me),document.removeEventListener("mouseup",Ge);try{localStorage.setItem("yeaft-vp-timeline-width",String(be.value))}catch{}};document.addEventListener("mousemove",Me),document.addEventListener("mouseup",Ge)},me="(max-width: 768px)",ge="(max-width: 1024px)",Ee=typeof window.matchMedia=="function"?window.matchMedia(me):null,Oe=typeof window.matchMedia=="function"?window.matchMedia(ge):null,He=(I,Y)=>I?I.matches:window.innerWidth<=Y,O=Vue.ref(He(Ee,768)),Z=Vue.ref(He(Oe,1024)),pe=Vue.computed(()=>O.value?!e.sessionSidebarOpen:e.sidebarCollapsed),ce=()=>{O.value=He(Ee,768),Z.value=He(Oe,1024)},fe=()=>{ce(),C()},Se=I=>{I&&(typeof I.addEventListener=="function"?I.addEventListener("change",fe):typeof I.addListener=="function"&&I.addListener(fe))},Re=I=>{I&&(typeof I.removeEventListener=="function"?I.removeEventListener("change",fe):typeof I.removeListener=="function"&&I.removeListener(fe))},Ke=()=>{D&&(clearTimeout(D),D=null),e.searchYeaftHistory(""),g.value=!1,b.value=0},_e=()=>{g.value=!0,Vue.nextTick(()=>v.value?.focus?.())},dt=()=>{g.value?Ke():_e()},Dt=I=>{D&&clearTimeout(D),b.value=0,D=setTimeout(()=>e.searchYeaftHistory(I),220)},gt=()=>e.searchYeaftHistory(e.yeaftHistorySearchState.query,{append:!0}),mt=async I=>{!I||!await e.loadYeaftHistoryWindow(I)||(await Vue.nextTick(),await S.value?.revealMessage?.(I.messageId))},Ne=I=>{if((I.metaKey||I.ctrlKey)&&String(I.key).toLowerCase()==="f"){I.preventDefault(),_e();return}if(I.key==="Escape"){if(g.value){Ke();return}if(o.value){Qt();return}}};Vue.onMounted(()=>{ce(),window.addEventListener("resize",fe),Se(Ee),Se(Oe),window.visualViewport?.addEventListener("resize",C),window.visualViewport?.addEventListener("scroll",C),document.addEventListener("click",pn),document.addEventListener("keydown",Ne),T()}),Vue.onUnmounted(()=>{window.removeEventListener("resize",fe),Re(Ee),Re(Oe),window.visualViewport?.removeEventListener("resize",C),window.visualViewport?.removeEventListener("scroll",C),document.removeEventListener("click",pn),document.removeEventListener("keydown",Ne),U!=null&&cancelAnimationFrame(U),F&&clearTimeout(F),D&&clearTimeout(D)}),Vue.watch(()=>e.yeaftConversationId,I=>{I&&e.activeConversations[0]!==I&&(e.activeConversations=[I])}),Vue.watch(()=>[e.currentAgent,e.yeaftActiveSessionFilter],()=>{Ke(),e.yeaftHistorySearchState={requestId:null,agentId:null,sessionId:null,query:"",loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:null}});let Be=()=>{e.leaveYeaft()},Le=(I,Y)=>{let le=qe();if(le&&le.activeNeedsInvite){let ht=le.activeSession;ht&&je.delete(ht.id);return}let Ve=e.yeaftActiveSessionFilter||le&&le.activeSessionId||"grp_default",Me=ri(I).mentions,Ge=Array.isArray(Y)?Y:void 0;e.sendYeaftSessionMessage({groupId:Ve,text:I,mentions:Me,attachments:Ge})},Ue=()=>{let I=qe(),Y=e.yeaftActiveSessionFilter||I?.activeSessionId||null;Y&&e.cancelYeaftSession(Y)},ze=(I="")=>{let Y=Je.value;Y&&e.enterWorkCenterFromSession(Y,I)},rt=()=>{if(O.value){e.toggleSessionSidebar();return}e.toggleSidebar()},Is=()=>{r.value=!r.value},As=()=>{r.value=!1},Ei=()=>{e.reloadYeaftMessages()},_i=()=>{window.location.reload()},qe=()=>{try{return window.Pinia?.useSessionsStore?.()||null}catch{return null}},Ri=Vue.computed(()=>{let I=qe(),Y=e.yeaftActiveSessionFilter||I?.activeSessionId||null;return Y?e.isYeaftSessionProcessing(Y):!1}),Je=Vue.computed(()=>{let I=qe();if(!I||!I.sessions)return null;let Y=e.yeaftActiveSessionFilter||null;if(Y&&typeof I.sessionById=="function"){let le=I.sessionById(Y,e.currentAgent||null);if(le)return le}if(I.activeSessionId&&typeof I.sessionById=="function"){let le=I.sessionById(I.activeSessionId,e.currentAgent||null);if(le)return le}return typeof I.sessionById=="function"?I.sessionById("grp_default",e.currentAgent||null):null}),cn=()=>Bp({activeSessionFilter:e.yeaftActiveSessionFilter,sessionsStore:qe(),topbarGroup:Je.value}),Li=Vue.computed(()=>{let I=Je.value||{},Y=typeof I.id=="string"?I.id.trim():"",le=[I.title,I.name,I.config?.title,I.config?.name];for(let Ve of le){let Me=typeof Ve=="string"?Ve.trim():"";if(Me&&!(Y&&Me===Y)&&!/^(sessions?|groups?)\//i.test(Me)&&!/^session_[A-Za-z0-9_-]+$/.test(Me)&&!(I.workDir&&Me===I.workDir))return Me}return""}),$i=Vue.computed(()=>Je.value&&typeof Je.value.announcement=="string"?Je.value.announcement:""),Kt=Vue.computed(()=>Lp(Je.value,e.yeaftModel||"")),Yt=Vue.computed(()=>{let I=Kt.value;return I&&e.yeaftAvailableModels.find(Y=>ln(Y,I))||null}),xs=I=>Ro(I?.effortOptions),Gt=Vue.computed(()=>Vp(Je.value,e.yeaftModelEffort||"")),Ye=Vue.computed(()=>{let I=Array.isArray(Yt.value?.effortOptions)?Yt.value.effortOptions.filter(Boolean):[];return I.length?I.includes(Gt.value)?Gt.value:Lo(I):null}),dn=Vue.computed(()=>Fp(e.yeaftAvailableModels)),Vi=(I,Y)=>ln(I,Kt.value)?Y?Y===Ye.value:!xs(I).length:!1,Fi=I=>!I||!ln(I.model,Kt.value)?!1:I.efforts.length?I.efforts.includes(Ye.value):!0,Oi=()=>{o.value=!0},Qt=()=>{o.value=!1},Hi=I=>{I.stopPropagation(),e.yeaftAvailableModels.length&&(o.value?Qt():Oi())},Ts=(I,Y=null)=>{if(!I)return;let le=Je.value?.id||null;e.switchYeaftModel(I,le,Y),Qt()},Ms=I=>!I||!Number.isFinite(I)||I<=0?"":I>=1e6?`${Math.round(I/1e5)/10}m`:I>=1e3?`${Math.round(I/1e3)}k`:String(I),un=I=>{let Y=Ms(I?.contextWindow),le=Ms(I?.maxOutput);return Y&&le?`${Y} \xB7 ${le} out`:Y},pn=I=>{if(!o.value)return;I.target.closest(".yeaft-topbar-model, .yeaft-topbar-model-dropdown")||Qt()},fn=()=>{a.value||(y.value="vp",h.value=null),a.value=!a.value},Ni=({initialTab:I="vp",editVpId:Y=null}={})=>{y.value=["vp","search","mcp"].includes(I)?I:"vp",h.value=y.value==="vp"&&Y||null,a.value=!0},Xt=()=>{o.value=!1,l.value=!0},Bi=I=>{Ze(I)&&(l.value=!1)},qi=async()=>{if(!(u.value||f.value)){f.value=!0,p.value="";try{let I={"Content-Type":"application/json"};t.token&&(I.Authorization=`Bearer ${t.token}`);let Y=await fetch("/api/user/agent-secret",{headers:I});if(!Y.ok){let Me=i("yeaft.onboarding.secretError");try{let Ge=await Y.json();Ge?.error&&(Me=Ge.error)}catch{}throw new Error(Me)}let le=await Y.json(),Ve=le?.agentSecret||le?.agent_secret||"";if(u.value=String(Ve||"").trim(),!u.value)throw new Error(i("yeaft.onboarding.secretError"))}catch(I){p.value=I?.message||i("yeaft.onboarding.secretError")}finally{f.value=!1}}},Wi=()=>{c.value=!0},gn=I=>{c.value=!1},mn=async(I,Y)=>{if(Y&&!(typeof navigator>"u"||!navigator.clipboard?.writeText))try{let le=typeof Y=="string"?Y:Y?.value||"";if(!le)return;await navigator.clipboard.writeText(le),d.value=I||"",m&&clearTimeout(m),m=setTimeout(()=>{d.value="",m=null},1800)}catch{}},Et=(I,Y)=>{},Ps=(I={})=>{Up(I)&&(l.value=!1)},je=Vue.reactive(new Set),_t=Vue.computed(()=>{let I=qe();return I?I.activeSession:null}),hn=I=>{if(!I)return"";if(I.id==="grp_default"&&(I.name==="Default"||!I.name))try{let Y=typeof window<"u"?window.i18n:null;if(Y&&Y.global&&typeof Y.global.t=="function")return Y.global.t("yeaft.session.defaultName")}catch{}return I.name||I.id||""},Ds=Vue.computed(()=>hn(_t.value)),Rt=Vue.computed(()=>{let I=qe();if(!I||!I.activeNeedsInvite)return!1;let Y=I.activeSession;return Y?!je.has(Y.id):!1}),vn=Vue.computed(()=>{let I=qe();return!!(I&&I.activeNeedsInvite)}),Ct=Vue.computed(()=>{let I=qe();return Hp({hasYeaftAgent:qp(e),sessionsReady:!!(I&&I.hasLoadedSnapshot),sessionsEmpty:!!(I&&I.isEmpty)})});Vue.watch(Ct,I=>{I&&qi()},{immediate:!0});let yn="npm install -g @yeaft/webchat-agent",bn=Vue.computed(()=>{let Y=(typeof window<"u"&&window.location?.origin?window.location.origin:"http://localhost:3456").replace(/^http:/,"ws:").replace(/^https:/,"wss:"),le=u.value||i("yeaft.onboarding.secretPending");return`yeaft-agent install --server ${Y} --name yeaft-agent --secret ${le}`}),Es="gh auth login && yeaft-agent llm use github-copilot --model gpt-5.5",Zt=()=>{let I=_t.value;I&&je.add(I.id),de(I?I.id:null)},Ui=()=>{let I=_t.value;I&&je.add(I.id)},Jt=Vue.ref(!1),es=Vue.ref(null),_s=Vue.ref(null),ts=Vue.ref("session"),ss=Vue.ref(""),Rs=(I={})=>{let Y=I&&(I.sessionId||I.groupId)||null,le=I&&I.editVpId||"",Ve=le?"members":I&&I.section||"session";Y&&(es.value=Y,_s.value=I&&I.agentId||null,ts.value=Ve,ss.value=le,Jt.value=!0)},k=()=>{let I=cn();I&&Rs({sessionId:I,section:"session"})},V=()=>{Jt.value=!1,es.value=null,_s.value=null,ss.value=""},W=()=>{V(),Ni({initialTab:"vp"})},de=I=>{I&&Rs({sessionId:I,section:"members"})};Vue.watch(()=>{let I=_t.value;return I?I.id+":"+(Array.isArray(I.roster)?I.roster.length:0)+":"+(I.defaultVpId||""):""},(I,Y)=>{let le=_t.value;le&&I!==Y&&Array.isArray(le.roster)&&le.roster.length>0&&je.delete(le.id)}),typeof Vue.onBeforeUnmount=="function"&&Vue.onBeforeUnmount(()=>{m&&clearTimeout(m),m=null});let ye=()=>{a.value=!1},ie=Vue.computed(()=>!a.value&&!Ct.value&&ke.value),Te=Vue.computed(()=>{let I=qe(),Y=e.yeaftActiveSessionFilter||I?.activeSessionId||null;if(!Y)return[];let le=e.yeaftActiveTasksBySession?.[Y]||{};return rh(le)}),We=Vue.computed(()=>{if(!e.yeaftConversationId)return[];let Y=qe(),le=e.yeaftActiveSessionFilter||Y?.activeSessionId||null;if(!le)return[];let Ve=Dp(Y,le,e.currentAgent||null),Me=Ve&&Array.isArray(Ve.roster)?Ve.roster:[];if(Me.length===0)return[];let Ge=new Set(Me),ht=Pp(Me,s.vpList||[]),Ls=e.vpStatuses||{},ns={};for(let ot of Object.values(Ls)){if(!ot||!ot.vpId)continue;let Vo=ot.sessionId??ot.groupId;Vo&&Vo!==le||Ge.has(ot.vpId)&&(ns[ot.vpId]=ot)}return Ep({vpList:ht,vpStatuses:ns,stoppingVpTurnIds:e.stoppingVpTurnIds||{},connectionState:e.connectionState,vpLabelOf:ot=>s.vpLabel(ot),vpDescriptionOf:ot=>s.vpDescription(ot)})});return{store:e,pageRef:x,effectiveSidebarCollapsed:pe,debugMode:r,modelDropdownOpen:o,topbarGroup:Je,topbarSessionTitle:Li,topbarModel:Kt,topbarEffort:Ye,topbarModelRows:dn,selectableEffortsForModel:xs,isModelSelectionActive:Vi,isModelRowActive:Fi,modelOptionRef:Pi,modelOptionMatchesRef:ln,showSettings:a,showLlmConfig:l,sessionCreateOpen:c,settingsInitialTab:y,settingsInitialEditVpId:h,chatInputRef:A,messageListRef:S,historySearchRef:v,historySearchOpen:g,historySearchActiveIndex:b,toggleHistorySearch:dt,closeHistorySearch:Ke,onHistorySearchQuery:Dt,loadMoreHistorySearchResults:gt,selectHistorySearchResult:mt,yeaftInputDraftKey:L,openSettings:Ni,isMobile:O,isNarrowDetail:Z,detailPanel:G,isResizingDetail:ue,detailWidthStyle:w,startDetailResize:B,isProcessing:Ri,goBack:Be,sendMessage:Le,cancelYeaft:Ue,openWorkItemDraft:ze,toggleSidebar:rt,toggleDebug:Is,closeDebug:As,reloadMessages:Ei,reloadPage:_i,toggleModelDropdown:Hi,selectModel:Ts,openLlmConfig:Xt,trackOverlayPointerDown:st,trackOverlayPointerUp:nt,clearOverlayPointerGesture:it,closeLlmConfigFromOverlay:Bi,openSessionCreate:Wi,onSessionCreated:gn,copyOnboardingCommand:mn,copiedOnboardingCommand:d,onLlmConfigMessage:Et,onLlmConfigSaved:Ps,formatTokens:Ms,formatModelCtx:un,toggleSettings:fn,onSettingsSaved:ye,sidebarV2Enabled:E,onSelectGroupV2:R,onSelectChat:H,canUseWorkbench:M,shouldShowInviteModal:Rt,inviteGroupName:Ds,onInviteOpenLibrary:Zt,onInviteDismiss:Ui,isActiveGroupEmpty:vn,showOnboardingGuide:Ct,installAgentCommand:yn,connectAgentCommand:bn,copilotCommand:Es,agentSecret:u,agentSecretLoading:f,agentSecretError:p,groupSettingsOpen:Jt,groupSettingsId:es,groupSettingsAgentId:_s,groupSettingsSection:ts,groupSettingsEditVpId:ss,openSessionSettings:Rs,openAnnouncementSettings:k,closeGroupSettings:V,openVpLibraryFromGroupSettings:W,openMemberEditor:de,showVpTimeline:ie,vpTimelineRows:We,sessionStatusTasksForActiveSession:Te,sessionStatusAnnouncementText:$i,sessionStatusVisible:ke,toggleSessionStatus:De,closeSessionStatus:ne,timelineWidthStyle:j,startTimelineResize:ee,onEditVpFromTimeline:I=>{if(!I)return;let Y=cn();Y&&Rs({sessionId:Y,section:"members",editVpId:I})},onMentionVpFromTimeline:I=>{if(!I)return;let Y=A.value;Y&&typeof Y.appendMention=="function"&&Y.appendMention(I)},onCancelVpFromTimeline:I=>{if(!I)return;let Y=qe(),le=e.yeaftActiveSessionFilter||Y?.activeSessionId||null;le&&typeof e.cancelVpTurnForSession=="function"&&e.cancelVpTurnForSession(I,le)},onCancelTaskFromTimeline:I=>!I?.id||!I.sessionId||typeof e.cancelYeaftTask!="function"?!1:e.cancelYeaftTask({sessionId:I.sessionId,taskId:I.id})}}}});var lh=Gp(()=>{Fn();lt();cs();hc();yt();wc();Sc();Ic();xc();Zu();Yp();mo();Yr();window.Pinia={...Pinia,useChatStore:null,useAuthStore:null};var oh={components:{LoginPage:Ac,ChatPage:Xu,YeaftPage:Kp},template:`
|
|
7691
|
+
`,setup(){let e=Pinia.useChatStore(),t=Pinia.useAuthStore(),s=Pinia.useVpStore(),n=Vue.getCurrentInstance(),i=n&&n.appContext.config.globalProperties.$t||(I=>I),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(""),f=Vue.ref(!1),p=Vue.ref(""),m=null,y=Vue.ref("vp"),h=Vue.ref(null),A=Vue.ref(null),x=Vue.ref(null),S=Vue.ref(null),v=Vue.ref(null),g=Vue.ref(!1),b=Vue.ref(0),D=null,L=Vue.computed(()=>{let I=e.currentAgent||"agent",Y=qe(),le=e.yeaftActiveSessionFilter||Y?.activeSessionId||"session";return`yeaft:${I}:${le}`}),U=null,O=null,_=I=>{if(!I)return!1;let Y=String(I.tagName||"").toLowerCase();return Y==="textarea"||Y==="input"||I.isContentEditable===!0},P=({recoverScroll:I=!1}={})=>{let Y=x.value;if(!Y)return;if(!F.value){Y.style.removeProperty("--yeaft-visual-viewport-height");return}let le=window.visualViewport,Ve=Math.max(1,Math.round(le?.height||window.innerHeight||1));Y.style.setProperty("--yeaft-visual-viewport-height",`${Ve}px`),!(!I||le&&window.innerHeight&&le.height<window.innerHeight*.85||_(document.activeElement))&&window.scrollTo(0,0)},T=(I={})=>{U!=null&&cancelAnimationFrame(U),U=requestAnimationFrame(()=>{U=null,P(I)})},C=()=>{T({recoverScroll:!0}),O&&clearTimeout(O),O=setTimeout(()=>{O=null,T({recoverScroll:!0})},260)},M=Vue.computed(()=>e.hasCapability("terminal")||e.hasCapability("file_editor")),E=Vue.computed(()=>!0),R=I=>{let Y=I&&I.id?I.id:null;Y&&(e.setActiveSessionFilter(Y,{agentId:I.agentId||null}),F.value&&e.closeSessionSidebar())},H=I=>{},G=Vue.ref(null),ue=Vue.ref(!1),J=320,ve=Math.max(J,Math.round(window.innerWidth*.25)),ae=localStorage.getItem("yeaft-debug-width"),$=Vue.ref(ae?parseInt(ae,10):ve),w=Vue.computed(()=>({"--yeaft-detail-width":$.value+"px"})),B=I=>{ue.value=!0;let Y=I.clientX,le=$.value,Ve=window.innerWidth*.6,Me=ht=>{let Ls=Y-ht.clientX,ns=Math.min(Ve,Math.max(J,le+Ls));$.value=ns},Ge=()=>{ue.value=!1,document.removeEventListener("mousemove",Me),document.removeEventListener("mouseup",Ge),localStorage.setItem("yeaft-debug-width",String($.value))};document.addEventListener("mousemove",Me),document.addEventListener("mouseup",Ge)},X="yeaft-session-status-visible",re=()=>{try{let I=localStorage.getItem(X);return!(I==="0"||I==="false")}catch{return!0}},ke=Vue.ref(re()),Pe=I=>{ke.value=!!I;try{localStorage.setItem(X,ke.value?"1":"0")}catch{}},De=()=>Pe(!ke.value),ne=()=>Pe(!1),Q=220,q=280,te=(()=>{try{return localStorage.getItem("yeaft-vp-timeline-width")}catch{return null}})(),se=te?parseInt(te,10):NaN,be=Vue.ref(Number.isFinite(se)&&se>=Q?se:q),j=Vue.computed(()=>({"--yeaft-vp-timeline-width":be.value+"px"})),ee=I=>{let Y=I.clientX,le=be.value,Ve=Math.max(Q,Math.floor(window.innerWidth*.4)),Me=ht=>{let Ls=Y-ht.clientX,ns=Math.min(Ve,Math.max(Q,le+Ls));be.value=ns},Ge=()=>{document.removeEventListener("mousemove",Me),document.removeEventListener("mouseup",Ge);try{localStorage.setItem("yeaft-vp-timeline-width",String(be.value))}catch{}};document.addEventListener("mousemove",Me),document.addEventListener("mouseup",Ge)},me="(max-width: 768px)",ge="(max-width: 1024px)",Ee=typeof window.matchMedia=="function"?window.matchMedia(me):null,Oe=typeof window.matchMedia=="function"?window.matchMedia(ge):null,He=(I,Y)=>I?I.matches:window.innerWidth<=Y,F=Vue.ref(He(Ee,768)),Z=Vue.ref(He(Oe,1024)),pe=Vue.computed(()=>F.value?!e.sessionSidebarOpen:e.sidebarCollapsed),ce=()=>{F.value=He(Ee,768),Z.value=He(Oe,1024)},fe=()=>{ce(),C()},Se=I=>{I&&(typeof I.addEventListener=="function"?I.addEventListener("change",fe):typeof I.addListener=="function"&&I.addListener(fe))},Re=I=>{I&&(typeof I.removeEventListener=="function"?I.removeEventListener("change",fe):typeof I.removeListener=="function"&&I.removeListener(fe))},Ke=()=>{D&&(clearTimeout(D),D=null),e.searchYeaftHistory(""),g.value=!1,b.value=0},_e=()=>{g.value=!0,Vue.nextTick(()=>v.value?.focus?.())},dt=()=>{g.value?Ke():_e()},Dt=I=>{D&&clearTimeout(D),b.value=0,D=setTimeout(()=>e.searchYeaftHistory(I),220)},gt=()=>e.searchYeaftHistory(e.yeaftHistorySearchState.query,{append:!0}),mt=async I=>{!I||!await e.loadYeaftHistoryWindow(I)||(await Vue.nextTick(),await S.value?.revealMessage?.(I.messageId))},Ne=I=>{if((I.metaKey||I.ctrlKey)&&String(I.key).toLowerCase()==="f"){I.preventDefault(),_e();return}if(I.key==="Escape"){if(g.value){Ke();return}if(o.value){Qt();return}}};Vue.onMounted(()=>{ce(),window.addEventListener("resize",fe),Se(Ee),Se(Oe),window.visualViewport?.addEventListener("resize",C),window.visualViewport?.addEventListener("scroll",C),document.addEventListener("click",pn),document.addEventListener("keydown",Ne),T()}),Vue.onUnmounted(()=>{window.removeEventListener("resize",fe),Re(Ee),Re(Oe),window.visualViewport?.removeEventListener("resize",C),window.visualViewport?.removeEventListener("scroll",C),document.removeEventListener("click",pn),document.removeEventListener("keydown",Ne),U!=null&&cancelAnimationFrame(U),O&&clearTimeout(O),D&&clearTimeout(D)}),Vue.watch(()=>e.yeaftConversationId,I=>{I&&e.activeConversations[0]!==I&&(e.activeConversations=[I])}),Vue.watch(()=>[e.currentAgent,e.yeaftActiveSessionFilter],()=>{Ke(),e.yeaftHistorySearchState={requestId:null,agentId:null,sessionId:null,query:"",loading:!1,results:[],hasMore:!1,nextBeforeSeq:null,error:null}});let Be=()=>{e.leaveYeaft()},Le=(I,Y)=>{let le=qe();if(le&&le.activeNeedsInvite){let ht=le.activeSession;ht&&je.delete(ht.id);return}let Ve=e.yeaftActiveSessionFilter||le&&le.activeSessionId||"grp_default",Me=ri(I).mentions,Ge=Array.isArray(Y)?Y:void 0;e.sendYeaftSessionMessage({groupId:Ve,text:I,mentions:Me,attachments:Ge})},Ue=()=>{let I=qe(),Y=e.yeaftActiveSessionFilter||I?.activeSessionId||null;Y&&e.cancelYeaftSession(Y)},ze=(I="")=>{let Y=Je.value;Y&&e.enterWorkCenterFromSession(Y,I)},rt=()=>{if(F.value){e.toggleSessionSidebar();return}e.toggleSidebar()},Is=()=>{r.value=!r.value},As=()=>{r.value=!1},Ei=()=>{e.reloadYeaftMessages()},_i=()=>{window.location.reload()},qe=()=>{try{return window.Pinia?.useSessionsStore?.()||null}catch{return null}},Ri=Vue.computed(()=>{let I=qe(),Y=e.yeaftActiveSessionFilter||I?.activeSessionId||null;return Y?e.isYeaftSessionProcessing(Y):!1}),Je=Vue.computed(()=>{let I=qe();if(!I||!I.sessions)return null;let Y=e.yeaftActiveSessionFilter||null;if(Y&&typeof I.sessionById=="function"){let le=I.sessionById(Y,e.currentAgent||null);if(le)return le}if(I.activeSessionId&&typeof I.sessionById=="function"){let le=I.sessionById(I.activeSessionId,e.currentAgent||null);if(le)return le}return typeof I.sessionById=="function"?I.sessionById("grp_default",e.currentAgent||null):null}),cn=()=>Bp({activeSessionFilter:e.yeaftActiveSessionFilter,sessionsStore:qe(),topbarGroup:Je.value}),Li=Vue.computed(()=>{let I=Je.value||{},Y=typeof I.id=="string"?I.id.trim():"",le=[I.title,I.name,I.config?.title,I.config?.name];for(let Ve of le){let Me=typeof Ve=="string"?Ve.trim():"";if(Me&&!(Y&&Me===Y)&&!/^(sessions?|groups?)\//i.test(Me)&&!/^session_[A-Za-z0-9_-]+$/.test(Me)&&!(I.workDir&&Me===I.workDir))return Me}return""}),$i=Vue.computed(()=>Je.value&&typeof Je.value.announcement=="string"?Je.value.announcement:""),Kt=Vue.computed(()=>Lp(Je.value,e.yeaftModel||"")),Yt=Vue.computed(()=>{let I=Kt.value;return I&&e.yeaftAvailableModels.find(Y=>ln(Y,I))||null}),xs=I=>Ro(I?.effortOptions),Gt=Vue.computed(()=>Vp(Je.value,e.yeaftModelEffort||"")),Ye=Vue.computed(()=>{let I=Array.isArray(Yt.value?.effortOptions)?Yt.value.effortOptions.filter(Boolean):[];return I.length?I.includes(Gt.value)?Gt.value:Lo(I):null}),dn=Vue.computed(()=>Fp(e.yeaftAvailableModels)),Vi=(I,Y)=>ln(I,Kt.value)?Y?Y===Ye.value:!xs(I).length:!1,Fi=I=>!I||!ln(I.model,Kt.value)?!1:I.efforts.length?I.efforts.includes(Ye.value):!0,Oi=()=>{o.value=!0},Qt=()=>{o.value=!1},Hi=I=>{I.stopPropagation(),e.yeaftAvailableModels.length&&(o.value?Qt():Oi())},Ts=(I,Y=null)=>{if(!I)return;let le=Je.value?.id||null;e.switchYeaftModel(I,le,Y),Qt()},Ms=I=>!I||!Number.isFinite(I)||I<=0?"":I>=1e6?`${Math.round(I/1e5)/10}m`:I>=1e3?`${Math.round(I/1e3)}k`:String(I),un=I=>{let Y=Ms(I?.contextWindow),le=Ms(I?.maxOutput);return Y&&le?`${Y} \xB7 ${le} out`:Y},pn=I=>{if(!o.value)return;I.target.closest(".yeaft-topbar-model, .yeaft-topbar-model-dropdown")||Qt()},fn=()=>{a.value||(y.value="vp",h.value=null),a.value=!a.value},Ni=({initialTab:I="vp",editVpId:Y=null}={})=>{y.value=["vp","search","mcp"].includes(I)?I:"vp",h.value=y.value==="vp"&&Y||null,a.value=!0},Xt=()=>{o.value=!1,l.value=!0},Bi=I=>{Ze(I)&&(l.value=!1)},qi=async()=>{if(!(u.value||f.value)){f.value=!0,p.value="";try{let I={"Content-Type":"application/json"};t.token&&(I.Authorization=`Bearer ${t.token}`);let Y=await fetch("/api/user/agent-secret",{headers:I});if(!Y.ok){let Me=i("yeaft.onboarding.secretError");try{let Ge=await Y.json();Ge?.error&&(Me=Ge.error)}catch{}throw new Error(Me)}let le=await Y.json(),Ve=le?.agentSecret||le?.agent_secret||"";if(u.value=String(Ve||"").trim(),!u.value)throw new Error(i("yeaft.onboarding.secretError"))}catch(I){p.value=I?.message||i("yeaft.onboarding.secretError")}finally{f.value=!1}}},Wi=()=>{c.value=!0},gn=I=>{c.value=!1},mn=async(I,Y)=>{if(Y&&!(typeof navigator>"u"||!navigator.clipboard?.writeText))try{let le=typeof Y=="string"?Y:Y?.value||"";if(!le)return;await navigator.clipboard.writeText(le),d.value=I||"",m&&clearTimeout(m),m=setTimeout(()=>{d.value="",m=null},1800)}catch{}},Et=(I,Y)=>{},Ps=(I={})=>{Up(I)&&(l.value=!1)},je=Vue.reactive(new Set),_t=Vue.computed(()=>{let I=qe();return I?I.activeSession:null}),hn=I=>{if(!I)return"";if(I.id==="grp_default"&&(I.name==="Default"||!I.name))try{let Y=typeof window<"u"?window.i18n:null;if(Y&&Y.global&&typeof Y.global.t=="function")return Y.global.t("yeaft.session.defaultName")}catch{}return I.name||I.id||""},Ds=Vue.computed(()=>hn(_t.value)),Rt=Vue.computed(()=>{let I=qe();if(!I||!I.activeNeedsInvite)return!1;let Y=I.activeSession;return Y?!je.has(Y.id):!1}),vn=Vue.computed(()=>{let I=qe();return!!(I&&I.activeNeedsInvite)}),Ct=Vue.computed(()=>{let I=qe();return Hp({hasYeaftAgent:qp(e),sessionsReady:!!(I&&I.hasLoadedSnapshot),sessionsEmpty:!!(I&&I.isEmpty)})});Vue.watch(Ct,I=>{I&&qi()},{immediate:!0});let yn="npm install -g @yeaft/webchat-agent",bn=Vue.computed(()=>{let Y=(typeof window<"u"&&window.location?.origin?window.location.origin:"http://localhost:3456").replace(/^http:/,"ws:").replace(/^https:/,"wss:"),le=u.value||i("yeaft.onboarding.secretPending");return`yeaft-agent install --server ${Y} --name yeaft-agent --secret ${le}`}),Es="gh auth login && yeaft-agent llm use github-copilot --model gpt-5.5",Zt=()=>{let I=_t.value;I&&je.add(I.id),de(I?I.id:null)},Ui=()=>{let I=_t.value;I&&je.add(I.id)},Jt=Vue.ref(!1),es=Vue.ref(null),_s=Vue.ref(null),ts=Vue.ref("session"),ss=Vue.ref(""),Rs=(I={})=>{let Y=I&&(I.sessionId||I.groupId)||null,le=I&&I.editVpId||"",Ve=le?"members":I&&I.section||"session";Y&&(es.value=Y,_s.value=I&&I.agentId||null,ts.value=Ve,ss.value=le,Jt.value=!0)},k=()=>{let I=cn();I&&Rs({sessionId:I,section:"session"})},V=()=>{Jt.value=!1,es.value=null,_s.value=null,ss.value=""},W=()=>{V(),Ni({initialTab:"vp"})},de=I=>{I&&Rs({sessionId:I,section:"members"})};Vue.watch(()=>{let I=_t.value;return I?I.id+":"+(Array.isArray(I.roster)?I.roster.length:0)+":"+(I.defaultVpId||""):""},(I,Y)=>{let le=_t.value;le&&I!==Y&&Array.isArray(le.roster)&&le.roster.length>0&&je.delete(le.id)}),typeof Vue.onBeforeUnmount=="function"&&Vue.onBeforeUnmount(()=>{m&&clearTimeout(m),m=null});let ye=()=>{a.value=!1},ie=Vue.computed(()=>!a.value&&!Ct.value&&ke.value),Te=Vue.computed(()=>{let I=qe(),Y=e.yeaftActiveSessionFilter||I?.activeSessionId||null;if(!Y)return[];let le=e.yeaftActiveTasksBySession?.[Y]||{};return rh(le)}),We=Vue.computed(()=>{if(!e.yeaftConversationId)return[];let Y=qe(),le=e.yeaftActiveSessionFilter||Y?.activeSessionId||null;if(!le)return[];let Ve=Dp(Y,le,e.currentAgent||null),Me=Ve&&Array.isArray(Ve.roster)?Ve.roster:[];if(Me.length===0)return[];let Ge=new Set(Me),ht=Pp(Me,s.vpList||[]),Ls=e.vpStatuses||{},ns={};for(let ot of Object.values(Ls)){if(!ot||!ot.vpId)continue;let Vo=ot.sessionId??ot.groupId;Vo&&Vo!==le||Ge.has(ot.vpId)&&(ns[ot.vpId]=ot)}return Ep({vpList:ht,vpStatuses:ns,stoppingVpTurnIds:e.stoppingVpTurnIds||{},connectionState:e.connectionState,vpLabelOf:ot=>s.vpLabel(ot),vpDescriptionOf:ot=>s.vpDescription(ot)})});return{store:e,pageRef:x,effectiveSidebarCollapsed:pe,debugMode:r,modelDropdownOpen:o,topbarGroup:Je,topbarSessionTitle:Li,topbarModel:Kt,topbarEffort:Ye,topbarModelRows:dn,selectableEffortsForModel:xs,isModelSelectionActive:Vi,isModelRowActive:Fi,modelOptionRef:Pi,modelOptionMatchesRef:ln,showSettings:a,showLlmConfig:l,sessionCreateOpen:c,settingsInitialTab:y,settingsInitialEditVpId:h,chatInputRef:A,messageListRef:S,historySearchRef:v,historySearchOpen:g,historySearchActiveIndex:b,toggleHistorySearch:dt,closeHistorySearch:Ke,onHistorySearchQuery:Dt,loadMoreHistorySearchResults:gt,selectHistorySearchResult:mt,yeaftInputDraftKey:L,openSettings:Ni,isMobile:F,isNarrowDetail:Z,detailPanel:G,isResizingDetail:ue,detailWidthStyle:w,startDetailResize:B,isProcessing:Ri,goBack:Be,sendMessage:Le,cancelYeaft:Ue,openWorkItemDraft:ze,toggleSidebar:rt,toggleDebug:Is,closeDebug:As,reloadMessages:Ei,reloadPage:_i,toggleModelDropdown:Hi,selectModel:Ts,openLlmConfig:Xt,trackOverlayPointerDown:st,trackOverlayPointerUp:nt,clearOverlayPointerGesture:it,closeLlmConfigFromOverlay:Bi,openSessionCreate:Wi,onSessionCreated:gn,copyOnboardingCommand:mn,copiedOnboardingCommand:d,onLlmConfigMessage:Et,onLlmConfigSaved:Ps,formatTokens:Ms,formatModelCtx:un,toggleSettings:fn,onSettingsSaved:ye,sidebarV2Enabled:E,onSelectGroupV2:R,onSelectChat:H,canUseWorkbench:M,shouldShowInviteModal:Rt,inviteGroupName:Ds,onInviteOpenLibrary:Zt,onInviteDismiss:Ui,isActiveGroupEmpty:vn,showOnboardingGuide:Ct,installAgentCommand:yn,connectAgentCommand:bn,copilotCommand:Es,agentSecret:u,agentSecretLoading:f,agentSecretError:p,groupSettingsOpen:Jt,groupSettingsId:es,groupSettingsAgentId:_s,groupSettingsSection:ts,groupSettingsEditVpId:ss,openSessionSettings:Rs,openAnnouncementSettings:k,closeGroupSettings:V,openVpLibraryFromGroupSettings:W,openMemberEditor:de,showVpTimeline:ie,vpTimelineRows:We,sessionStatusTasksForActiveSession:Te,sessionStatusAnnouncementText:$i,sessionStatusVisible:ke,toggleSessionStatus:De,closeSessionStatus:ne,timelineWidthStyle:j,startTimelineResize:ee,onEditVpFromTimeline:I=>{if(!I)return;let Y=cn();Y&&Rs({sessionId:Y,section:"members",editVpId:I})},onMentionVpFromTimeline:I=>{if(!I)return;let Y=A.value;Y&&typeof Y.appendMention=="function"&&Y.appendMention(I)},onCancelVpFromTimeline:I=>{if(!I)return;let Y=qe(),le=e.yeaftActiveSessionFilter||Y?.activeSessionId||null;le&&typeof e.cancelVpTurnForSession=="function"&&e.cancelVpTurnForSession(I,le)},onCancelTaskFromTimeline:I=>!I?.id||!I.sessionId||typeof e.cancelYeaftTask!="function"?!1:e.cancelYeaftTask({sessionId:I.sessionId,taskId:I.id})}}}});var lh=Gp(()=>{Fn();lt();cs();hc();yt();wc();Sc();Ic();xc();Zu();Yp();mo();Yr();window.Pinia={...Pinia,useChatStore:null,useAuthStore:null};var oh={components:{LoginPage:Ac,ChatPage:Xu,YeaftPage:Kp},template:`
|
|
7692
7692
|
<LoginPage v-if="!authStore.isAuthenticated" />
|
|
7693
7693
|
<template v-else>
|
|
7694
7694
|
<YeaftPage v-if="chatStore.currentView === 'yeaft'" />
|