hermes-web-ui 0.6.24 → 0.6.25
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/dist/client/assets/js/{ChannelsView-DV-LtXVi.js → ChannelsView-p3dSvD02.js} +1 -1
- package/dist/client/assets/js/{ChatPanel-DyZWRnQs.js → ChatPanel-DRCE0v4g.js} +1 -1
- package/dist/client/assets/js/{ChatView-CuWpMwOd.js → ChatView-CAoJp8-Q.js} +1 -1
- package/dist/client/assets/js/{CodingAgentsView-D_Ngirz0.js → CodingAgentsView-X0I-H0Yu.js} +1 -1
- package/dist/client/assets/js/{DesktopPetView-BGY-7Dcd.js → DesktopPetView-BH9a1zur.js} +1 -1
- package/dist/client/assets/js/{DevicesView-BNZqDe2U.js → DevicesView-CMcwuGZ6.js} +1 -1
- package/dist/client/assets/js/{FileEditor-BPFC-M3W.js → FileEditor-CzWdryd5.js} +1 -1
- package/dist/client/assets/js/{FileRenameModal-5mJtyNBP.js → FileRenameModal-C2YmHkSN.js} +1 -1
- package/dist/client/assets/js/{FilesView-CRbkvC6l.js → FilesView-CKxvh6yi.js} +1 -1
- package/dist/client/assets/js/{GlobalAgentView-my3AKdll.js → GlobalAgentView-77p8MKvy.js} +1 -1
- package/dist/client/assets/js/{GroupChatView-btwSVoC0.js → GroupChatView-D1WFEfIs.js} +1 -1
- package/dist/client/assets/js/{HistoryMessageList-IubX9-tb.js → HistoryMessageList-BcG-gj6N.js} +1 -1
- package/dist/client/assets/js/{HistoryView-N3v7MNfo.js → HistoryView-CzybyBXj.js} +1 -1
- package/dist/client/assets/js/{JobsView-CHq_TJQ6.js → JobsView-BviznpSY.js} +1 -1
- package/dist/client/assets/js/{KanbanView-BMh8IgQo.js → KanbanView-B0c6OMrf.js} +1 -1
- package/dist/client/assets/js/{LoginView-sE4g4Zua.js → LoginView-B9nES8-3.js} +1 -1
- package/dist/client/assets/js/{LogsView-awh5ZCp8.js → LogsView-kLI6-05w.js} +1 -1
- package/dist/client/assets/js/{MarkdownRenderer-BbGvq6C-.js → MarkdownRenderer-DQvs79tf.js} +1 -1
- package/dist/client/assets/js/{McpManagerView-CnSCITtQ.js → McpManagerView-BZU1Puf0.js} +1 -1
- package/dist/client/assets/js/{MemoryView-CbQOeUKI.js → MemoryView-BH4LZtYd.js} +1 -1
- package/dist/client/assets/js/{MessageItem-DSHiAgFE.js → MessageItem-Cu3_aQT8.js} +2 -2
- package/dist/client/assets/js/{MessageList-oRCKlivC.js → MessageList-Ds_mjMbf.js} +1 -1
- package/dist/client/assets/js/{ModelsView-B0esXyBm.js → ModelsView-CZK6wwtt.js} +1 -1
- package/dist/client/assets/js/{OutlinePanel-BofcYepl.js → OutlinePanel-CYuSrNX9.js} +1 -1
- package/dist/client/assets/js/{PageSidebarFooter-BPeWlPvZ.js → PageSidebarFooter-Dk-OfmNy.js} +1 -1
- package/dist/client/assets/js/{PerformanceView-gc12dWCZ.js → PerformanceView-DkXk4HB_.js} +1 -1
- package/dist/client/assets/js/{PetdexView-CZjbg41u.js → PetdexView-DGkSZYVi.js} +1 -1
- package/dist/client/assets/js/{PluginsView-DRwyXTJC.js → PluginsView-D197obRC.js} +1 -1
- package/dist/client/assets/js/{ProfilesView-zVd3TfNW.js → ProfilesView-BhGBaYDE.js} +1 -1
- package/dist/client/assets/js/{SettingRow-G7ZusJw_.js → SettingRow-DfRI-z7L.js} +1 -1
- package/dist/client/assets/js/{SettingsCircuitBadge-CFo2KqP-.js → SettingsCircuitBadge-Eiv8LQz0.js} +1 -1
- package/dist/client/assets/js/{SettingsView-DDjt6UpN.js → SettingsView-B4ipIIOj.js} +1 -1
- package/dist/client/assets/js/{SkillsUsageView-DnVnAYHG.js → SkillsUsageView-DT4o1LA9.js} +1 -1
- package/dist/client/assets/js/{SkillsView-CHi4L7Oi.js → SkillsView-CUK-9OLz.js} +1 -1
- package/dist/client/assets/js/{TerminalPanel-Dx7huJY2.js → TerminalPanel-gyT2AS7Z.js} +1 -1
- package/dist/client/assets/js/{TerminalView-PQIIFHwX.js → TerminalView-C3a6BwEG.js} +1 -1
- package/dist/client/assets/js/{UsageView-Dzr2wBc7.js → UsageView-DrUS9OIk.js} +1 -1
- package/dist/client/assets/js/{VersionPreviewView-JQrieRPU.js → VersionPreviewView-qbXwqYd3.js} +1 -1
- package/dist/client/assets/js/{WorkflowView-DRanDY9s.js → WorkflowView-D-6z--9A.js} +1 -1
- package/dist/client/assets/js/{_plugin-vue_export-helper-fFMkIM4P.js → _plugin-vue_export-helper-CvnFozKy.js} +2 -2
- package/dist/client/assets/js/{chat-timestamp-CZtP79YD.js → chat-timestamp-CkDNtK9Y.js} +1 -1
- package/dist/client/assets/js/{files-DOpu4Qfg.js → files-CBYc0MSs.js} +1 -1
- package/dist/client/assets/js/index-B2IKGvbR.js +3 -0
- package/dist/client/assets/js/{models-y7NaVj-e.js → models-DetB4_Ug.js} +1 -1
- package/dist/client/assets/js/{session-browser-prefs-BOqwOeHi.js → session-browser-prefs-BYjSnxJq.js} +1 -1
- package/dist/client/assets/js/{skills-D7ZMzzzG.js → skills-5qxphanX.js} +1 -1
- package/dist/client/assets/js/{system-CRmVbE8Z.js → system-Onp4yS9N.js} +1 -1
- package/dist/client/assets/js/{ttsHelpers-vHLmbeY4.js → ttsHelpers-DNcZ5khq.js} +1 -1
- package/dist/client/assets/js/{useSttSettings-s4LBWl55.js → useSttSettings-C-jexrW7.js} +1 -1
- package/dist/client/index.html +3 -3
- package/dist/server/agent-bridge/python/bridge_runtime.py +2 -2
- package/dist/server/index.js +3 -3
- package/dist/server/openapi.json +1 -1
- package/package.json +1 -1
- package/dist/client/assets/js/index-Brl4qW5V.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as j}from"./rolldown-runtime-M0oDzQ_3.js";import{An as Tt,Bn as It,Bt as Ut,Hn as A,I as Vt,It as re,K as ht,Kt as N,Nn as K,Ot as q,P as Wt,Pt as jt,Un as Ht,V as ae,Y as Et,Zt as qt,an as e,cn as u,cr as l,ct as Ot,dn as Qt,en as ne,er as h,fn as P,ft as de,hn as Z,i as Kt,in as Q,jn as a,kn as ue,m as ve,mt as Nt,on as E,pn as T,pr as n,sn as b,t as G,tn as O,ur as H}from"./ui-vendor-DDMfmCj2.js";import{O as J,k as X}from"./vue-vendor-BsMpqyaC.js";import{f as se,n as Y,t as ee,u as Zt}from"./_plugin-vue_export-helper-fFMkIM4P.js";import{Dt as Gt,Et as Jt}from"./index-Brl4qW5V.js";import{a as Xt,c as Yt,d as ea,i as ce,l as ie,m as la,n as ta,p as aa,s as ia,t as sa,u as na}from"./skills-D7ZMzzzG.js";import{n as _t,t as oe}from"./MarkdownRenderer-BbGvq6C-.js";var pe,fe,ke,he,_e,ge,me,ye,we,$e,Ce,be,xe,Se,Me,De,Fe,Ae,Le,Be,Pe,ze,Re,Te,Ie,Ue,Ve,We,je,He,Ee,qe,Oe,Qe,Ke,Ne,gt,Ze=j((()=>{N(),G(),ie(),J(),pe={class:"skill-list"},fe={key:0,class:"skill-empty"},ke=["title","onClick"],he={class:"path-header-text"},_e={class:"category-count"},ge={key:0,class:"path-group-body"},me=["onClick"],ye={class:"category-name"},we={class:"category-count"},$e={key:0,class:"category-skills"},Ce=["onClick"],be={class:"skill-info"},xe={class:"skill-name"},Se=["title"],Me=["title"],De={key:0,class:"skill-desc"},Fe=["onClick"],Ae={class:"category-name"},Le={class:"category-count"},Be={key:0,class:"category-skills"},Pe=["onClick"],ze={class:"skill-info"},Re={class:"skill-name"},Te=["title"],Ie=["title"],Ue={key:0,class:"skill-desc"},Ve=["title","disabled","onClick"],We={key:3,class:"skill-category archive-section"},je={class:"category-name"},He={class:"category-count"},Ee={key:0,class:"category-skills"},qe=["onClick"],Oe={class:"skill-info"},Qe={class:"skill-name"},Ke=["title"],Ne={key:0,class:"skill-desc"},gt=Z({__name:"SkillList",props:{categories:{},archived:{},selectedSkill:{},searchQuery:{},sourceFilter:{},readonly:{type:Boolean}},emits:["select","deleted"],setup(_,{emit:$}){const{t:f}=X(),i=ae(),g=Et(),x=_,p=$,k=h(new Set),w=h(!0),L=h(new Set),D=h(new Set),C=Q(()=>{let o=x.archived;if(x.sourceFilter&&x.sourceFilter!=="modified"&&(o=o.filter(d=>(d.source||"local")===x.sourceFilter)),x.searchQuery){const d=x.searchQuery.toLowerCase();o=o.filter(s=>s.name.toLowerCase().includes(d)||s.description.toLowerCase().includes(d))}return o}),V=Q(()=>{let o=x.categories;if(x.sourceFilter&&(o=o.map(d=>({...d,skills:d.skills.filter(s=>x.sourceFilter==="modified"?s.modified:(s.source||"local")===x.sourceFilter)})).filter(d=>d.skills.length>0)),x.searchQuery){const d=x.searchQuery.toLowerCase();o=o.map(s=>({...s,skills:s.skills.filter(t=>t.name.toLowerCase().includes(d)||t.description.toLowerCase().includes(d))})).filter(s=>s.skills.length>0||s.name.toLowerCase().includes(d))}return o}),I=Q(()=>{if(x.sourceFilter!=="external")return null;const o=new Map,d=[],s=new Map;for(const t of V.value)for(const m of t.skills){const W=m.sourcePath||"";o.has(W)||(o.set(W,new Map),d.push(W),s.set(W,[]));const le=o.get(W);le.has(t.name)||(le.set(t.name,[]),s.get(W).push(t.name)),le.get(t.name).push(m)}return d.map(t=>({path:t,categories:s.get(t).map(m=>({name:m,skills:o.get(t).get(m)}))}))}),U=h(new Set);function F(o){U.value.has(o)?U.value.delete(o):U.value.add(o)}function z(o){return o||"(unknown)"}function R(o){k.value.has(o)?k.value.delete(o):k.value.add(o)}function B(o,d){p("select",o,d)}function c(o,d){return`${o}/${d.name}`}async function y(o,d,s){if(!L.value.has(d)){L.value.add(d);try{await la(d,s);const t=x.categories.find(m=>m.name===o)?.skills.find(m=>m.name===d);t&&(t.enabled=s)}catch(t){i.error(f("skills.toggleFailed")+`: ${t.message}`)}finally{L.value.delete(d)}}}function r(o,d){D.value.has(d)||g.warning({title:f("skills.delete"),content:f("skills.deleteConfirm",{name:d}),positiveText:f("common.delete"),negativeText:f("common.cancel"),onPositiveClick:async()=>{D.value.add(d);try{await sa(o,d),i.success(f("skills.deleteSuccess")),i.info(f("skills.reloadHint"),{duration:6e3}),p("deleted",o,d)}catch(s){i.error(f("skills.deleteFailed")+`: ${s.message}`)}finally{D.value.delete(d)}}})}return(o,d)=>(a(),u("div",pe,[V.value.length===0?(a(),u("div",fe,n(_.searchQuery?l(f)("skills.noMatch"):l(f)("skills.noSkills")),1)):b("",!0),I.value?(a(!0),u(O,{key:1},K(I.value,s=>(a(),u("div",{key:s.path||"__unknown__",class:"skill-path-group"},[e("button",{class:"path-header",title:s.path||"",onClick:t=>F(s.path)},[(a(),u("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:H(["category-arrow",{collapsed:U.value.has(s.path)}])},[...d[3]||(d[3]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),d[4]||(d[4]=e("span",{class:"path-header-icon"},[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})])],-1)),e("span",he,n(z(s.path)),1),e("span",_e,n(s.categories.reduce((t,m)=>t+m.skills.length,0)),1)],8,ke),U.value.has(s.path)?b("",!0):(a(),u("div",ge,[(a(!0),u(O,null,K(s.categories,t=>(a(),u("div",{key:t.name,class:"skill-category"},[e("button",{class:"category-header sub",onClick:m=>R(s.path+"::"+t.name)},[(a(),u("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:H(["category-arrow",{collapsed:k.value.has(s.path+"::"+t.name)}])},[...d[5]||(d[5]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",ye,n(t.name),1),e("span",we,n(t.skills.length),1)],8,me),k.value.has(s.path+"::"+t.name)?b("",!0):(a(),u("div",$e,[(a(!0),u(O,null,K(t.skills,m=>(a(),u("button",{key:c(t.name,m),class:H(["skill-item",[{active:_.selectedSkill===c(t.name,m)},`source-${m.source||"local"}`]]),onClick:W=>B(t.name,m.name)},[e("div",be,[e("span",xe,[e("span",{class:H(["source-dot",`dot-${m.source||"local"}`]),title:l(f)(`skills.source.${m.source||"local"}`)},null,10,Se),P(" "+n(m.name)+" ",1),m.modified?(a(),u("span",{key:0,class:"modified-badge",title:l(f)("skills.modified")},"✎",8,Me)):b("",!0)]),m.description?(a(),u("span",De,n(m.description),1)):b("",!0)]),_.readonly?b("",!0):(a(),E(l(ve),{key:0,size:"small",value:m.enabled!==!1,loading:L.value.has(m.name),"onUpdate:value":W=>y(t.name,m.name,W),onClick:d[0]||(d[0]=ne(()=>{},["stop"]))},null,8,["value","loading","onUpdate:value"]))],10,Ce))),128))]))]))),128))]))]))),128)):(a(!0),u(O,{key:2},K(V.value,s=>(a(),u("div",{key:s.name,class:"skill-category"},[e("button",{class:"category-header",onClick:t=>R(s.name)},[(a(),u("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:H(["category-arrow",{collapsed:k.value.has(s.name)}])},[...d[6]||(d[6]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",Ae,n(s.name),1),e("span",Le,n(s.skills.length),1)],8,Fe),k.value.has(s.name)?b("",!0):(a(),u("div",Be,[(a(!0),u(O,null,K(s.skills,t=>(a(),u("button",{key:c(s.name,t),class:H(["skill-item",[{active:_.selectedSkill===c(s.name,t)},`source-${t.source||"local"}`]]),onClick:m=>B(s.name,t.name)},[e("div",ze,[e("span",Re,[e("span",{class:H(["source-dot",`dot-${t.source||"local"}`]),title:l(f)(`skills.source.${t.source||"local"}`)},null,10,Te),P(" "+n(t.name)+" ",1),t.modified?(a(),u("span",{key:0,class:"modified-badge",title:l(f)("skills.modified")},"✎",8,Ie)):b("",!0)]),t.description?(a(),u("span",Ue,n(t.description),1)):b("",!0)]),!_.readonly&&(t.source??"local")==="local"?(a(),u("button",{key:0,class:"skill-action-btn",title:l(f)("skills.delete"),disabled:D.value.has(t.name),onClick:ne(m=>r(s.name,t.name),["stop"])},[...d[7]||(d[7]=[Qt('<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-07a45f3f><polyline points="3 6 5 6 21 6" data-v-07a45f3f></polyline><path d="M19 6l-2 14a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L5 6" data-v-07a45f3f></path><path d="M10 11v6" data-v-07a45f3f></path><path d="M14 11v6" data-v-07a45f3f></path><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" data-v-07a45f3f></path></svg>',1)])],8,Ve)):b("",!0),_.readonly?b("",!0):(a(),E(l(ve),{key:1,size:"small",value:t.enabled!==!1,loading:L.value.has(t.name),"onUpdate:value":m=>y(s.name,t.name,m),onClick:d[1]||(d[1]=ne(()=>{},["stop"]))},null,8,["value","loading","onUpdate:value"]))],10,Pe))),128))]))]))),128)),C.value.length>0||_.archived.length>0?(a(),u("div",We,[e("button",{class:"category-header archive-header",onClick:d[2]||(d[2]=s=>w.value=!w.value)},[(a(),u("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:H(["category-arrow",{collapsed:w.value}])},[...d[8]||(d[8]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",je,n(l(f)("skills.archived")),1),e("span",He,n(_.archived.length),1)]),w.value?b("",!0):(a(),u("div",Ee,[(a(!0),u(O,null,K(C.value,s=>(a(),u("button",{key:c(".archive",s),class:H(["skill-item skill-archived",{active:_.selectedSkill===c(".archive",s)}]),onClick:t=>B(".archive",s.name)},[e("div",Oe,[e("span",Qe,[e("span",{class:H(["source-dot",`dot-${s.source||"local"}`]),title:l(f)(`skills.source.${s.source||"local"}`)},null,10,Ke),P(" "+n(s.name),1)]),s.description?(a(),u("span",Ne,n(s.description),1)):b("",!0)])],10,qe))),128))]))])):b("",!0)]))}})})),oa=j((()=>{})),mt,ra=j((()=>{Ze(),Ze(),oa(),Y(),mt=ee(gt,[["__scopeId","data-v-07a45f3f"]])})),Ge,Je,Xe,Ye,el,ll,tl,al,il,sl,nl,ol,rl,ul,dl,vl,cl,pl,fl,kl,hl,_l,gl,yt,ml=j((()=>{N(),_t(),ie(),J(),G(),Ge={class:"skill-detail"},Je={class:"detail-title"},Xe={class:"detail-heading"},Ye={class:"detail-category"},el={class:"detail-name"},ll={class:"usage-stats"},tl=["title"],al=["disabled","title"],il=["disabled","title"],sl=["disabled","title"],nl=["fill"],ol={key:4,class:"usage-stat",title:"Views"},rl={key:5,class:"usage-stat",title:"Uses"},ul={key:6,class:"usage-stat",title:"Patches"},dl={key:0,class:"detail-loading"},vl={key:0,class:"detail-breadcrumb"},cl={class:"breadcrumb-path"},pl={class:"detail-content"},fl=["aria-label"],kl={key:1,class:"detail-files"},hl={class:"files-header"},_l={class:"files-list"},gl=["onClick"],yt=Z({__name:"SkillDetail",props:{category:{},skill:{},skillName:{},patchCount:{},useCount:{},viewCount:{},pinned:{type:Boolean},target:{},readonly:{type:Boolean},canPin:{type:Boolean}},emits:["pinToggled","saved"],setup(_,{emit:$}){const{t:f}=X(),i=ae(),g=_,x=$,p=h(""),k=h(""),w=h([]),L=h(!1),D=h(""),C=h(null),V=h(!1),I=h(!1),U=h(!1),F=Q(()=>k.value!==p.value);async function z(){L.value=!0,C.value=null,D.value="",w.value=[],p.value="",k.value="",I.value=!1;try{const s=`${g.category}/${g.skill}/SKILL.md`,[t,m]=await Promise.all([ce(s,g.target||"hermes"),Xt(g.category,g.skill,g.target||"hermes")]);p.value=t,k.value=t,w.value=m.filter(W=>!W.isDir&&W.path!=="SKILL.md")}catch(s){p.value=f("skills.loadFailed")+`: ${s.message}`,k.value=p.value}finally{L.value=!1}}async function R(s){V.value=!0,C.value=s;try{const t=`${g.category}/${g.skill}/`;let m=s;if(s.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(s)){const W=s.replace(/\\/g,"/").split(/(?:^|\/)(?:\.hermes|hermes)\/skills\//)[1];W&&(m=W.split("/").slice(2).join("/"))}D.value=await ce(`${t}${m}`,g.target||"hermes")}catch(t){D.value=f("skills.fileLoadFailed")+`: ${t.message}`}finally{V.value=!1}}function B(){C.value=null,D.value=""}function c(){k.value=p.value,I.value=!0}function y(){k.value=p.value,I.value=!1}async function r(){if(!(U.value||g.readonly)){U.value=!0;try{await aa(g.category,g.skill,k.value,g.target||"hermes"),p.value=k.value,I.value=!1,i.success(f("skills.saveSuccess")),i.info(f("skills.reloadHint"),{duration:6e3}),x("saved")}catch(s){i.error(f("skills.saveFailed")+`: ${s.message}`)}finally{U.value=!1}}}const o=h(!1);async function d(){if(!o.value){o.value=!0;try{const s=!g.pinned;await na(g.skillName,s),x("pinToggled",g.skillName,s)}catch(s){i.error(f("skills.pinFailed")+`: ${s.message}`)}finally{o.value=!1}}}return It(()=>`${g.target||"hermes"}/${g.category}/${g.skill}`,z,{immediate:!0}),(s,t)=>(a(),u("div",Ge,[e("div",Je,[e("div",Xe,[e("span",Ye,n(_.category),1),t[1]||(t[1]=e("span",{class:"detail-separator"},"/",-1)),e("span",el,n(_.skill),1)]),e("div",ll,[!_.readonly&&!C.value&&!I.value?(a(),u("button",{key:0,class:"detail-action",title:l(f)("skills.edit"),onClick:c},[t[2]||(t[2]=e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M12 20h9"}),e("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})],-1)),e("span",null,n(l(f)("skills.edit")),1)],8,tl)):b("",!0),!_.readonly&&!C.value&&I.value?(a(),u("button",{key:1,class:"detail-action",disabled:U.value||!F.value,title:l(f)("common.save"),onClick:r},[t[3]||(t[3]=e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2Z"}),e("path",{d:"M17 21v-8H7v8"}),e("path",{d:"M7 3v5h8"})],-1)),e("span",null,n(U.value?l(f)("skills.saving"):l(f)("common.save")),1)],8,al)):b("",!0),!_.readonly&&!C.value&&I.value?(a(),u("button",{key:2,class:"detail-action",disabled:U.value,title:l(f)("common.cancel"),onClick:y},[t[4]||(t[4]=e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M18 6 6 18"}),e("path",{d:"m6 6 12 12"})],-1)),e("span",null,n(l(f)("common.cancel")),1)],8,il)):b("",!0),_.canPin&&!_.readonly?(a(),u("button",{key:3,class:H(["pin-toggle",{active:_.pinned}]),disabled:o.value,title:_.pinned?l(f)("skills.unpin"):l(f)("skills.pin"),onClick:d},[(a(),u("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:_.pinned?"currentColor":"none",stroke:"currentColor","stroke-width":"2"},[...t[5]||(t[5]=[e("path",{d:"M16 12V4h1V2H7v2h1v8l-2 2v2h5.2v6h1.6v-6H18v-2l-2-2z"},null,-1)])],8,nl))],10,sl)):b("",!0),_.viewCount!=null?(a(),u("span",ol,[t[6]||(t[6]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e("circle",{cx:"12",cy:"12",r:"3"})],-1)),P(" "+n(_.viewCount),1)])):b("",!0),_.useCount!=null?(a(),u("span",rl,[t[7]||(t[7]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})],-1)),P(" "+n(_.useCount),1)])):b("",!0),_.patchCount!=null?(a(),u("span",ul,[t[8]||(t[8]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M12 20h9"}),e("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})],-1)),P(" "+n(_.patchCount),1)])):b("",!0)])]),L.value&&!p.value?(a(),u("div",dl,n(l(f)("common.loading")),1)):(a(),u(O,{key:1},[C.value?(a(),u("div",vl,[e("button",{class:"back-btn",onClick:B},[t[9]||(t[9]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"15 18 9 12 15 6"})],-1)),P(" "+n(l(f)("skills.backTo"))+" "+n(_.skill),1)]),e("span",cl,n(C.value),1)])):b("",!0),e("div",pl,[C.value?(a(),E(oe,{key:0,content:D.value},null,8,["content"])):I.value?Ht((a(),u("textarea",{key:1,"onUpdate:modelValue":t[0]||(t[0]=m=>k.value=m),class:"skill-editor","aria-label":l(f)("skills.editorLabel"),spellcheck:"false"},null,8,fl)),[[qt,k.value]]):(a(),E(oe,{key:2,content:p.value},null,8,["content"]))]),!C.value&&w.value.length>0?(a(),u("div",kl,[e("div",hl,n(l(f)("skills.attachedFiles")),1),e("div",_l,[(a(!0),u(O,null,K(w.value,m=>(a(),u("button",{key:m.path,class:"file-item",onClick:W=>R(m.path)},[t[10]||(t[10]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[e("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e("polyline",{points:"14 2 14 8 20 8"})],-1)),e("span",null,n(m.path),1)],8,gl))),128))])])):b("",!0)],64))]))}})})),ua=j((()=>{})),wt,da=j((()=>{ml(),ml(),ua(),Y(),wt=ee(yt,[["__scopeId","data-v-48cc1548"]])})),yl,wl,$l,Cl,bl,xl,Sl,Ml,$t,Dl=j((()=>{N(),G(),ie(),J(),yl={class:"form-row"},wl={class:"hint"},$l={class:"form-row"},Cl={class:"field-label"},bl={class:"form-row"},xl={key:1,class:"folder-picker"},Sl={key:0,class:"folder-info"},Ml={class:"modal-footer"},$t=Z({__name:"SkillImportModal",emits:["close","saved"],setup(_,{emit:$}){const f=$,{t:i}=X(),g=ae(),x=h(!0),p=h(!1),k=h("folder"),w=h([]),L=h([]),D=h(""),C=h(""),V=h(null),I=Q(()=>k.value==="zip"?w.value.length>0:L.value.length>0);function U(){w.value=[],L.value=[],D.value=""}function F({file:y}){return(y.name?.toLowerCase()||"").endsWith(".zip")?!0:(g.warning(i("skills.importInvalidFile")),!1)}function z(){V.value?.click()}function R(y){const r=y.target.files;if(!r||r.length===0)return;const o=[];for(let s=0;s<r.length;s++)o.push(r[s]);L.value=o;const d=o[0].webkitRelativePath;D.value=d?d.split("/")[0]:""}async function B(){if(!I.value){g.warning(i("skills.importNoSelection"));return}let y=[];if(k.value==="zip")for(const r of w.value)r.file&&y.push(r.file);else y=L.value;if(y.length===0){g.error(i("skills.importFailed"));return}p.value=!0;try{const r=await Yt(y,C.value.trim()||void 0);g.success(i("skills.importSuccess")+(r?.name?`: ${r.name}`:"")),g.info(i("skills.reloadHint"),{duration:6e3}),f("saved")}catch(r){g.error(i("skills.importFailed")+`: ${r.message}`)}finally{p.value=!1}}function c(){p.value||(x.value=!1,setTimeout(()=>f("close"),200))}return(y,r)=>(a(),E(l(ht),{show:x.value,"onUpdate:show":r[3]||(r[3]=o=>x.value=o),preset:"card",title:l(i)("skills.importTitle"),style:{width:"min(480px, calc(100vw - 32px))"},"mask-closable":!p.value,onAfterLeave:r[4]||(r[4]=o=>f("close"))},{footer:A(()=>[e("div",Ml,[T(l(q),{disabled:p.value,onClick:c},{default:A(()=>[P(n(l(i)("common.cancel")),1)]),_:1},8,["disabled"]),T(l(q),{type:"primary",loading:p.value,disabled:!I.value,onClick:B},{default:A(()=>[P(n(l(i)("common.confirm")),1)]),_:1},8,["loading","disabled"])])]),default:A(()=>[e("div",yl,[T(l(Ot),{value:k.value,"onUpdate:value":[r[0]||(r[0]=o=>k.value=o),U],size:"small",disabled:p.value},{default:A(()=>[T(l(de),{value:"folder"},{default:A(()=>[P(n(l(i)("skills.importModeFolder")),1)]),_:1}),T(l(de),{value:"zip"},{default:A(()=>[P(n(l(i)("skills.importModeZip")),1)]),_:1})]),_:1},8,["value","disabled"]),e("p",wl,n(k.value==="zip"?l(i)("skills.importHintZip"):l(i)("skills.importHintFolder")),1)]),e("div",$l,[e("label",Cl,n(l(i)("skills.importTargetCategory")),1),T(l(re),{value:C.value,"onUpdate:value":r[1]||(r[1]=o=>C.value=o),size:"small",placeholder:l(i)("skills.importTargetCategoryPlaceholder"),disabled:p.value},null,8,["value","placeholder","disabled"])]),e("div",bl,[k.value==="zip"?(a(),E(l(Kt),{key:0,"file-list":w.value,"onUpdate:fileList":r[2]||(r[2]=o=>w.value=o),max:1,accept:".zip","default-upload":!1,disabled:p.value,onBeforeUpload:F},{default:A(()=>[T(l(q),{disabled:p.value},{default:A(()=>[P(n(l(i)("skills.importSelectFile")),1)]),_:1},8,["disabled"])]),_:1},8,["file-list","disabled"])):(a(),u("div",xl,[e("input",{ref_key:"folderInputRef",ref:V,type:"file",webkitdirectory:"",multiple:"",style:{display:"none"},onChange:R},null,544),T(l(q),{disabled:p.value,onClick:z},{default:A(()=>[P(n(l(i)("skills.importSelectFolder")),1)]),_:1},8,["disabled"]),D.value?(a(),u("span",Sl,n(D.value)+" ("+n(L.value.length)+" "+n(l(i)("skills.importFileCount"))+") ",1)):b("",!0)]))])]),_:1},8,["show","title","mask-closable"]))}})})),va=j((()=>{})),Ct,ca=j((()=>{Dl(),Dl(),va(),Y(),Ct=ee($t,[["__scopeId","data-v-6cc6068d"]])})),Fl,Al,Ll,Bl,Pl,zl,Rl,Tl,Il,bt,Ul=j((()=>{N(),G(),J(),ie(),Fl={class:"hint"},Al={key:0,class:"state-row"},Ll={key:1,class:"state-row empty"},Bl={key:2,class:"dir-list"},Pl={class:"dir-input-wrap"},zl={key:0,class:"hint-tag broken"},Rl={key:1,class:"hint-tag broken"},Tl=["title","disabled","onClick"],Il={class:"modal-footer"},bt=Z({__name:"SkillExternalDirsModal",emits:["close","saved"],setup(_,{emit:$}){const f=$,{t:i}=X(),g=ae(),x=h(!0),p=h(!1),k=h(!0),w=h([]);function L(F){return F.exists?F.isDir?{raw:F.raw,hint:null}:{raw:F.raw,hint:"notdir"}:{raw:F.raw,hint:"missing"}}ue(async()=>{try{w.value=(await ta()).map(L)}catch(F){g.error(i("skills.externalDirs.loadFailed")+`: ${F.message}`)}finally{k.value=!1}});function D(){w.value.push({raw:"",hint:null})}function C(F){w.value.splice(F,1)}function V(F){w.value[F]&&(w.value[F].hint=null)}async function I(){const F=[],z=new Set;for(const R of w.value){const B=R.raw.trim();B&&(z.has(B)||(z.add(B),F.push(B)))}p.value=!0;try{await ea(F),g.success(i("skills.externalDirs.saveSuccess")),f("saved")}catch(R){g.error(i("skills.externalDirs.saveFailed")+`: ${R.message}`)}finally{p.value=!1}}function U(){p.value||(x.value=!1,setTimeout(()=>f("close"),200))}return(F,z)=>(a(),E(l(ht),{show:x.value,"onUpdate:show":z[0]||(z[0]=R=>x.value=R),preset:"card",title:l(i)("skills.externalDirs.title"),style:{width:"min(560px, calc(100vw - 32px))"},"mask-closable":!p.value,onAfterLeave:z[1]||(z[1]=R=>f("close"))},{footer:A(()=>[e("div",Il,[T(l(q),{disabled:p.value,onClick:U},{default:A(()=>[P(n(l(i)("common.cancel")),1)]),_:1},8,["disabled"]),T(l(q),{type:"primary",loading:p.value,disabled:k.value,onClick:I},{default:A(()=>[P(n(l(i)("common.save")),1)]),_:1},8,["loading","disabled"])])]),default:A(()=>[e("p",Fl,n(l(i)("skills.externalDirs.hint")),1),k.value?(a(),u("div",Al,n(l(i)("common.loading")),1)):w.value.length===0?(a(),u("div",Ll,n(l(i)("skills.externalDirs.empty")),1)):(a(),u("ul",Bl,[(a(!0),u(O,null,K(w.value,(R,B)=>(a(),u("li",{key:B,class:"dir-row"},[e("div",Pl,[T(l(re),{value:R.raw,"onUpdate:value":[c=>R.raw=c,c=>V(B)],size:"small",placeholder:l(i)("skills.externalDirs.placeholder"),disabled:p.value},null,8,["value","onUpdate:value","placeholder","disabled"]),R.hint==="missing"?(a(),u("span",zl,n(l(i)("skills.externalDirs.missing")),1)):R.hint==="notdir"?(a(),u("span",Rl,n(l(i)("skills.externalDirs.notDir")),1)):b("",!0)]),e("button",{class:"row-remove",title:l(i)("skills.externalDirs.removeRow"),disabled:p.value,onClick:c=>C(B)},[...z[2]||(z[2]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,Tl)]))),128))])),T(l(q),{size:"small",disabled:p.value,onClick:D},{icon:A(()=>[...z[3]||(z[3]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),default:A(()=>[P(" "+n(l(i)("skills.externalDirs.add")),1)]),_:1},8,["disabled"])]),_:1},8,["show","title","mask-closable"]))}})})),pa=j((()=>{})),xt,fa=j((()=>{Ul(),Ul(),pa(),Y(),xt=ee(bt,[["__scopeId","data-v-134aef16"]])}));async function St(){return se("/api/hermes/write-gate/pending")}async function ka(_,$){const f=await se(`/api/hermes/write-gate/pending/${encodeURIComponent(_)}/${encodeURIComponent($)}/diff`);return f.review?f.review:{subsystem:_,targetLabel:_,language:_==="memory"?"json":"",current:"",proposed:f.diff||"",diff:f.diff||"",payloadText:_==="memory"?f.diff||"":void 0,notes:[]}}async function ha(_,$){return se(`/api/hermes/write-gate/pending/${encodeURIComponent(_)}/${encodeURIComponent($)}/approve`,{method:"POST"})}async function _a(_,$){return se(`/api/hermes/write-gate/pending/${encodeURIComponent(_)}/${encodeURIComponent($)}/reject`,{method:"POST"})}var Mt=j((()=>{Zt()})),Vl,Wl,jl,Hl,El,ql,Ol,Ql,Kl,Nl,Zl,Gl,Dt,Jl=j((()=>{N(),G(),J(),_t(),Mt(),Vl={class:"write-approval-panel"},Wl={class:"write-approval-header"},jl={key:0,class:"write-approval-state"},Hl={key:1,class:"write-approval-state"},El={key:2,class:"write-approval-state"},ql={key:3,class:"write-approval-list"},Ol={class:"write-approval-main"},Ql={class:"write-approval-meta"},Kl={key:0},Nl={class:"write-approval-summary"},Zl={class:"write-approval-actions"},Gl={key:0,class:"write-approval-review"},Dt=Z({__name:"PendingWriteApprovals",emits:["count-change"],setup(_,{emit:$}){const f=$,{t:i}=X(),g=ae(),x=h([]),p=h(!1),k=h(""),w=h({}),L=h(!0),D=Q(()=>x.value.length);function C(c){return`${c.subsystem}:${c.id}`}function V(c,y){let o=y||"";return o=o.replaceAll("```","```"),o&&!o.endsWith(`
|
|
1
|
+
import{n as j}from"./rolldown-runtime-M0oDzQ_3.js";import{An as Tt,Bn as It,Bt as Ut,Hn as A,I as Vt,It as re,K as ht,Kt as N,Nn as K,Ot as q,P as Wt,Pt as jt,Un as Ht,V as ae,Y as Et,Zt as qt,an as e,cn as u,cr as l,ct as Ot,dn as Qt,en as ne,er as h,fn as P,ft as de,hn as Z,i as Kt,in as Q,jn as a,kn as ue,m as ve,mt as Nt,on as E,pn as T,pr as n,sn as b,t as G,tn as O,ur as H}from"./ui-vendor-DDMfmCj2.js";import{O as J,k as X}from"./vue-vendor-BsMpqyaC.js";import{f as se,n as Y,t as ee,u as Zt}from"./_plugin-vue_export-helper-CvnFozKy.js";import{Dt as Gt,Et as Jt}from"./index-B2IKGvbR.js";import{a as Xt,c as Yt,d as ea,i as ce,l as ie,m as la,n as ta,p as aa,s as ia,t as sa,u as na}from"./skills-5qxphanX.js";import{n as _t,t as oe}from"./MarkdownRenderer-DQvs79tf.js";var pe,fe,ke,he,_e,ge,me,ye,we,$e,Ce,be,xe,Se,Me,De,Fe,Ae,Le,Be,Pe,ze,Re,Te,Ie,Ue,Ve,We,je,He,Ee,qe,Oe,Qe,Ke,Ne,gt,Ze=j((()=>{N(),G(),ie(),J(),pe={class:"skill-list"},fe={key:0,class:"skill-empty"},ke=["title","onClick"],he={class:"path-header-text"},_e={class:"category-count"},ge={key:0,class:"path-group-body"},me=["onClick"],ye={class:"category-name"},we={class:"category-count"},$e={key:0,class:"category-skills"},Ce=["onClick"],be={class:"skill-info"},xe={class:"skill-name"},Se=["title"],Me=["title"],De={key:0,class:"skill-desc"},Fe=["onClick"],Ae={class:"category-name"},Le={class:"category-count"},Be={key:0,class:"category-skills"},Pe=["onClick"],ze={class:"skill-info"},Re={class:"skill-name"},Te=["title"],Ie=["title"],Ue={key:0,class:"skill-desc"},Ve=["title","disabled","onClick"],We={key:3,class:"skill-category archive-section"},je={class:"category-name"},He={class:"category-count"},Ee={key:0,class:"category-skills"},qe=["onClick"],Oe={class:"skill-info"},Qe={class:"skill-name"},Ke=["title"],Ne={key:0,class:"skill-desc"},gt=Z({__name:"SkillList",props:{categories:{},archived:{},selectedSkill:{},searchQuery:{},sourceFilter:{},readonly:{type:Boolean}},emits:["select","deleted"],setup(_,{emit:$}){const{t:f}=X(),i=ae(),g=Et(),x=_,p=$,k=h(new Set),w=h(!0),L=h(new Set),D=h(new Set),C=Q(()=>{let o=x.archived;if(x.sourceFilter&&x.sourceFilter!=="modified"&&(o=o.filter(d=>(d.source||"local")===x.sourceFilter)),x.searchQuery){const d=x.searchQuery.toLowerCase();o=o.filter(s=>s.name.toLowerCase().includes(d)||s.description.toLowerCase().includes(d))}return o}),V=Q(()=>{let o=x.categories;if(x.sourceFilter&&(o=o.map(d=>({...d,skills:d.skills.filter(s=>x.sourceFilter==="modified"?s.modified:(s.source||"local")===x.sourceFilter)})).filter(d=>d.skills.length>0)),x.searchQuery){const d=x.searchQuery.toLowerCase();o=o.map(s=>({...s,skills:s.skills.filter(t=>t.name.toLowerCase().includes(d)||t.description.toLowerCase().includes(d))})).filter(s=>s.skills.length>0||s.name.toLowerCase().includes(d))}return o}),I=Q(()=>{if(x.sourceFilter!=="external")return null;const o=new Map,d=[],s=new Map;for(const t of V.value)for(const m of t.skills){const W=m.sourcePath||"";o.has(W)||(o.set(W,new Map),d.push(W),s.set(W,[]));const le=o.get(W);le.has(t.name)||(le.set(t.name,[]),s.get(W).push(t.name)),le.get(t.name).push(m)}return d.map(t=>({path:t,categories:s.get(t).map(m=>({name:m,skills:o.get(t).get(m)}))}))}),U=h(new Set);function F(o){U.value.has(o)?U.value.delete(o):U.value.add(o)}function z(o){return o||"(unknown)"}function R(o){k.value.has(o)?k.value.delete(o):k.value.add(o)}function B(o,d){p("select",o,d)}function c(o,d){return`${o}/${d.name}`}async function y(o,d,s){if(!L.value.has(d)){L.value.add(d);try{await la(d,s);const t=x.categories.find(m=>m.name===o)?.skills.find(m=>m.name===d);t&&(t.enabled=s)}catch(t){i.error(f("skills.toggleFailed")+`: ${t.message}`)}finally{L.value.delete(d)}}}function r(o,d){D.value.has(d)||g.warning({title:f("skills.delete"),content:f("skills.deleteConfirm",{name:d}),positiveText:f("common.delete"),negativeText:f("common.cancel"),onPositiveClick:async()=>{D.value.add(d);try{await sa(o,d),i.success(f("skills.deleteSuccess")),i.info(f("skills.reloadHint"),{duration:6e3}),p("deleted",o,d)}catch(s){i.error(f("skills.deleteFailed")+`: ${s.message}`)}finally{D.value.delete(d)}}})}return(o,d)=>(a(),u("div",pe,[V.value.length===0?(a(),u("div",fe,n(_.searchQuery?l(f)("skills.noMatch"):l(f)("skills.noSkills")),1)):b("",!0),I.value?(a(!0),u(O,{key:1},K(I.value,s=>(a(),u("div",{key:s.path||"__unknown__",class:"skill-path-group"},[e("button",{class:"path-header",title:s.path||"",onClick:t=>F(s.path)},[(a(),u("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:H(["category-arrow",{collapsed:U.value.has(s.path)}])},[...d[3]||(d[3]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),d[4]||(d[4]=e("span",{class:"path-header-icon"},[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})])],-1)),e("span",he,n(z(s.path)),1),e("span",_e,n(s.categories.reduce((t,m)=>t+m.skills.length,0)),1)],8,ke),U.value.has(s.path)?b("",!0):(a(),u("div",ge,[(a(!0),u(O,null,K(s.categories,t=>(a(),u("div",{key:t.name,class:"skill-category"},[e("button",{class:"category-header sub",onClick:m=>R(s.path+"::"+t.name)},[(a(),u("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:H(["category-arrow",{collapsed:k.value.has(s.path+"::"+t.name)}])},[...d[5]||(d[5]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",ye,n(t.name),1),e("span",we,n(t.skills.length),1)],8,me),k.value.has(s.path+"::"+t.name)?b("",!0):(a(),u("div",$e,[(a(!0),u(O,null,K(t.skills,m=>(a(),u("button",{key:c(t.name,m),class:H(["skill-item",[{active:_.selectedSkill===c(t.name,m)},`source-${m.source||"local"}`]]),onClick:W=>B(t.name,m.name)},[e("div",be,[e("span",xe,[e("span",{class:H(["source-dot",`dot-${m.source||"local"}`]),title:l(f)(`skills.source.${m.source||"local"}`)},null,10,Se),P(" "+n(m.name)+" ",1),m.modified?(a(),u("span",{key:0,class:"modified-badge",title:l(f)("skills.modified")},"✎",8,Me)):b("",!0)]),m.description?(a(),u("span",De,n(m.description),1)):b("",!0)]),_.readonly?b("",!0):(a(),E(l(ve),{key:0,size:"small",value:m.enabled!==!1,loading:L.value.has(m.name),"onUpdate:value":W=>y(t.name,m.name,W),onClick:d[0]||(d[0]=ne(()=>{},["stop"]))},null,8,["value","loading","onUpdate:value"]))],10,Ce))),128))]))]))),128))]))]))),128)):(a(!0),u(O,{key:2},K(V.value,s=>(a(),u("div",{key:s.name,class:"skill-category"},[e("button",{class:"category-header",onClick:t=>R(s.name)},[(a(),u("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:H(["category-arrow",{collapsed:k.value.has(s.name)}])},[...d[6]||(d[6]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",Ae,n(s.name),1),e("span",Le,n(s.skills.length),1)],8,Fe),k.value.has(s.name)?b("",!0):(a(),u("div",Be,[(a(!0),u(O,null,K(s.skills,t=>(a(),u("button",{key:c(s.name,t),class:H(["skill-item",[{active:_.selectedSkill===c(s.name,t)},`source-${t.source||"local"}`]]),onClick:m=>B(s.name,t.name)},[e("div",ze,[e("span",Re,[e("span",{class:H(["source-dot",`dot-${t.source||"local"}`]),title:l(f)(`skills.source.${t.source||"local"}`)},null,10,Te),P(" "+n(t.name)+" ",1),t.modified?(a(),u("span",{key:0,class:"modified-badge",title:l(f)("skills.modified")},"✎",8,Ie)):b("",!0)]),t.description?(a(),u("span",Ue,n(t.description),1)):b("",!0)]),!_.readonly&&(t.source??"local")==="local"?(a(),u("button",{key:0,class:"skill-action-btn",title:l(f)("skills.delete"),disabled:D.value.has(t.name),onClick:ne(m=>r(s.name,t.name),["stop"])},[...d[7]||(d[7]=[Qt('<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-07a45f3f><polyline points="3 6 5 6 21 6" data-v-07a45f3f></polyline><path d="M19 6l-2 14a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L5 6" data-v-07a45f3f></path><path d="M10 11v6" data-v-07a45f3f></path><path d="M14 11v6" data-v-07a45f3f></path><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" data-v-07a45f3f></path></svg>',1)])],8,Ve)):b("",!0),_.readonly?b("",!0):(a(),E(l(ve),{key:1,size:"small",value:t.enabled!==!1,loading:L.value.has(t.name),"onUpdate:value":m=>y(s.name,t.name,m),onClick:d[1]||(d[1]=ne(()=>{},["stop"]))},null,8,["value","loading","onUpdate:value"]))],10,Pe))),128))]))]))),128)),C.value.length>0||_.archived.length>0?(a(),u("div",We,[e("button",{class:"category-header archive-header",onClick:d[2]||(d[2]=s=>w.value=!w.value)},[(a(),u("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:H(["category-arrow",{collapsed:w.value}])},[...d[8]||(d[8]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",je,n(l(f)("skills.archived")),1),e("span",He,n(_.archived.length),1)]),w.value?b("",!0):(a(),u("div",Ee,[(a(!0),u(O,null,K(C.value,s=>(a(),u("button",{key:c(".archive",s),class:H(["skill-item skill-archived",{active:_.selectedSkill===c(".archive",s)}]),onClick:t=>B(".archive",s.name)},[e("div",Oe,[e("span",Qe,[e("span",{class:H(["source-dot",`dot-${s.source||"local"}`]),title:l(f)(`skills.source.${s.source||"local"}`)},null,10,Ke),P(" "+n(s.name),1)]),s.description?(a(),u("span",Ne,n(s.description),1)):b("",!0)])],10,qe))),128))]))])):b("",!0)]))}})})),oa=j((()=>{})),mt,ra=j((()=>{Ze(),Ze(),oa(),Y(),mt=ee(gt,[["__scopeId","data-v-07a45f3f"]])})),Ge,Je,Xe,Ye,el,ll,tl,al,il,sl,nl,ol,rl,ul,dl,vl,cl,pl,fl,kl,hl,_l,gl,yt,ml=j((()=>{N(),_t(),ie(),J(),G(),Ge={class:"skill-detail"},Je={class:"detail-title"},Xe={class:"detail-heading"},Ye={class:"detail-category"},el={class:"detail-name"},ll={class:"usage-stats"},tl=["title"],al=["disabled","title"],il=["disabled","title"],sl=["disabled","title"],nl=["fill"],ol={key:4,class:"usage-stat",title:"Views"},rl={key:5,class:"usage-stat",title:"Uses"},ul={key:6,class:"usage-stat",title:"Patches"},dl={key:0,class:"detail-loading"},vl={key:0,class:"detail-breadcrumb"},cl={class:"breadcrumb-path"},pl={class:"detail-content"},fl=["aria-label"],kl={key:1,class:"detail-files"},hl={class:"files-header"},_l={class:"files-list"},gl=["onClick"],yt=Z({__name:"SkillDetail",props:{category:{},skill:{},skillName:{},patchCount:{},useCount:{},viewCount:{},pinned:{type:Boolean},target:{},readonly:{type:Boolean},canPin:{type:Boolean}},emits:["pinToggled","saved"],setup(_,{emit:$}){const{t:f}=X(),i=ae(),g=_,x=$,p=h(""),k=h(""),w=h([]),L=h(!1),D=h(""),C=h(null),V=h(!1),I=h(!1),U=h(!1),F=Q(()=>k.value!==p.value);async function z(){L.value=!0,C.value=null,D.value="",w.value=[],p.value="",k.value="",I.value=!1;try{const s=`${g.category}/${g.skill}/SKILL.md`,[t,m]=await Promise.all([ce(s,g.target||"hermes"),Xt(g.category,g.skill,g.target||"hermes")]);p.value=t,k.value=t,w.value=m.filter(W=>!W.isDir&&W.path!=="SKILL.md")}catch(s){p.value=f("skills.loadFailed")+`: ${s.message}`,k.value=p.value}finally{L.value=!1}}async function R(s){V.value=!0,C.value=s;try{const t=`${g.category}/${g.skill}/`;let m=s;if(s.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(s)){const W=s.replace(/\\/g,"/").split(/(?:^|\/)(?:\.hermes|hermes)\/skills\//)[1];W&&(m=W.split("/").slice(2).join("/"))}D.value=await ce(`${t}${m}`,g.target||"hermes")}catch(t){D.value=f("skills.fileLoadFailed")+`: ${t.message}`}finally{V.value=!1}}function B(){C.value=null,D.value=""}function c(){k.value=p.value,I.value=!0}function y(){k.value=p.value,I.value=!1}async function r(){if(!(U.value||g.readonly)){U.value=!0;try{await aa(g.category,g.skill,k.value,g.target||"hermes"),p.value=k.value,I.value=!1,i.success(f("skills.saveSuccess")),i.info(f("skills.reloadHint"),{duration:6e3}),x("saved")}catch(s){i.error(f("skills.saveFailed")+`: ${s.message}`)}finally{U.value=!1}}}const o=h(!1);async function d(){if(!o.value){o.value=!0;try{const s=!g.pinned;await na(g.skillName,s),x("pinToggled",g.skillName,s)}catch(s){i.error(f("skills.pinFailed")+`: ${s.message}`)}finally{o.value=!1}}}return It(()=>`${g.target||"hermes"}/${g.category}/${g.skill}`,z,{immediate:!0}),(s,t)=>(a(),u("div",Ge,[e("div",Je,[e("div",Xe,[e("span",Ye,n(_.category),1),t[1]||(t[1]=e("span",{class:"detail-separator"},"/",-1)),e("span",el,n(_.skill),1)]),e("div",ll,[!_.readonly&&!C.value&&!I.value?(a(),u("button",{key:0,class:"detail-action",title:l(f)("skills.edit"),onClick:c},[t[2]||(t[2]=e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M12 20h9"}),e("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})],-1)),e("span",null,n(l(f)("skills.edit")),1)],8,tl)):b("",!0),!_.readonly&&!C.value&&I.value?(a(),u("button",{key:1,class:"detail-action",disabled:U.value||!F.value,title:l(f)("common.save"),onClick:r},[t[3]||(t[3]=e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2Z"}),e("path",{d:"M17 21v-8H7v8"}),e("path",{d:"M7 3v5h8"})],-1)),e("span",null,n(U.value?l(f)("skills.saving"):l(f)("common.save")),1)],8,al)):b("",!0),!_.readonly&&!C.value&&I.value?(a(),u("button",{key:2,class:"detail-action",disabled:U.value,title:l(f)("common.cancel"),onClick:y},[t[4]||(t[4]=e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M18 6 6 18"}),e("path",{d:"m6 6 12 12"})],-1)),e("span",null,n(l(f)("common.cancel")),1)],8,il)):b("",!0),_.canPin&&!_.readonly?(a(),u("button",{key:3,class:H(["pin-toggle",{active:_.pinned}]),disabled:o.value,title:_.pinned?l(f)("skills.unpin"):l(f)("skills.pin"),onClick:d},[(a(),u("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:_.pinned?"currentColor":"none",stroke:"currentColor","stroke-width":"2"},[...t[5]||(t[5]=[e("path",{d:"M16 12V4h1V2H7v2h1v8l-2 2v2h5.2v6h1.6v-6H18v-2l-2-2z"},null,-1)])],8,nl))],10,sl)):b("",!0),_.viewCount!=null?(a(),u("span",ol,[t[6]||(t[6]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e("circle",{cx:"12",cy:"12",r:"3"})],-1)),P(" "+n(_.viewCount),1)])):b("",!0),_.useCount!=null?(a(),u("span",rl,[t[7]||(t[7]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})],-1)),P(" "+n(_.useCount),1)])):b("",!0),_.patchCount!=null?(a(),u("span",ul,[t[8]||(t[8]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M12 20h9"}),e("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})],-1)),P(" "+n(_.patchCount),1)])):b("",!0)])]),L.value&&!p.value?(a(),u("div",dl,n(l(f)("common.loading")),1)):(a(),u(O,{key:1},[C.value?(a(),u("div",vl,[e("button",{class:"back-btn",onClick:B},[t[9]||(t[9]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"15 18 9 12 15 6"})],-1)),P(" "+n(l(f)("skills.backTo"))+" "+n(_.skill),1)]),e("span",cl,n(C.value),1)])):b("",!0),e("div",pl,[C.value?(a(),E(oe,{key:0,content:D.value},null,8,["content"])):I.value?Ht((a(),u("textarea",{key:1,"onUpdate:modelValue":t[0]||(t[0]=m=>k.value=m),class:"skill-editor","aria-label":l(f)("skills.editorLabel"),spellcheck:"false"},null,8,fl)),[[qt,k.value]]):(a(),E(oe,{key:2,content:p.value},null,8,["content"]))]),!C.value&&w.value.length>0?(a(),u("div",kl,[e("div",hl,n(l(f)("skills.attachedFiles")),1),e("div",_l,[(a(!0),u(O,null,K(w.value,m=>(a(),u("button",{key:m.path,class:"file-item",onClick:W=>R(m.path)},[t[10]||(t[10]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[e("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e("polyline",{points:"14 2 14 8 20 8"})],-1)),e("span",null,n(m.path),1)],8,gl))),128))])])):b("",!0)],64))]))}})})),ua=j((()=>{})),wt,da=j((()=>{ml(),ml(),ua(),Y(),wt=ee(yt,[["__scopeId","data-v-48cc1548"]])})),yl,wl,$l,Cl,bl,xl,Sl,Ml,$t,Dl=j((()=>{N(),G(),ie(),J(),yl={class:"form-row"},wl={class:"hint"},$l={class:"form-row"},Cl={class:"field-label"},bl={class:"form-row"},xl={key:1,class:"folder-picker"},Sl={key:0,class:"folder-info"},Ml={class:"modal-footer"},$t=Z({__name:"SkillImportModal",emits:["close","saved"],setup(_,{emit:$}){const f=$,{t:i}=X(),g=ae(),x=h(!0),p=h(!1),k=h("folder"),w=h([]),L=h([]),D=h(""),C=h(""),V=h(null),I=Q(()=>k.value==="zip"?w.value.length>0:L.value.length>0);function U(){w.value=[],L.value=[],D.value=""}function F({file:y}){return(y.name?.toLowerCase()||"").endsWith(".zip")?!0:(g.warning(i("skills.importInvalidFile")),!1)}function z(){V.value?.click()}function R(y){const r=y.target.files;if(!r||r.length===0)return;const o=[];for(let s=0;s<r.length;s++)o.push(r[s]);L.value=o;const d=o[0].webkitRelativePath;D.value=d?d.split("/")[0]:""}async function B(){if(!I.value){g.warning(i("skills.importNoSelection"));return}let y=[];if(k.value==="zip")for(const r of w.value)r.file&&y.push(r.file);else y=L.value;if(y.length===0){g.error(i("skills.importFailed"));return}p.value=!0;try{const r=await Yt(y,C.value.trim()||void 0);g.success(i("skills.importSuccess")+(r?.name?`: ${r.name}`:"")),g.info(i("skills.reloadHint"),{duration:6e3}),f("saved")}catch(r){g.error(i("skills.importFailed")+`: ${r.message}`)}finally{p.value=!1}}function c(){p.value||(x.value=!1,setTimeout(()=>f("close"),200))}return(y,r)=>(a(),E(l(ht),{show:x.value,"onUpdate:show":r[3]||(r[3]=o=>x.value=o),preset:"card",title:l(i)("skills.importTitle"),style:{width:"min(480px, calc(100vw - 32px))"},"mask-closable":!p.value,onAfterLeave:r[4]||(r[4]=o=>f("close"))},{footer:A(()=>[e("div",Ml,[T(l(q),{disabled:p.value,onClick:c},{default:A(()=>[P(n(l(i)("common.cancel")),1)]),_:1},8,["disabled"]),T(l(q),{type:"primary",loading:p.value,disabled:!I.value,onClick:B},{default:A(()=>[P(n(l(i)("common.confirm")),1)]),_:1},8,["loading","disabled"])])]),default:A(()=>[e("div",yl,[T(l(Ot),{value:k.value,"onUpdate:value":[r[0]||(r[0]=o=>k.value=o),U],size:"small",disabled:p.value},{default:A(()=>[T(l(de),{value:"folder"},{default:A(()=>[P(n(l(i)("skills.importModeFolder")),1)]),_:1}),T(l(de),{value:"zip"},{default:A(()=>[P(n(l(i)("skills.importModeZip")),1)]),_:1})]),_:1},8,["value","disabled"]),e("p",wl,n(k.value==="zip"?l(i)("skills.importHintZip"):l(i)("skills.importHintFolder")),1)]),e("div",$l,[e("label",Cl,n(l(i)("skills.importTargetCategory")),1),T(l(re),{value:C.value,"onUpdate:value":r[1]||(r[1]=o=>C.value=o),size:"small",placeholder:l(i)("skills.importTargetCategoryPlaceholder"),disabled:p.value},null,8,["value","placeholder","disabled"])]),e("div",bl,[k.value==="zip"?(a(),E(l(Kt),{key:0,"file-list":w.value,"onUpdate:fileList":r[2]||(r[2]=o=>w.value=o),max:1,accept:".zip","default-upload":!1,disabled:p.value,onBeforeUpload:F},{default:A(()=>[T(l(q),{disabled:p.value},{default:A(()=>[P(n(l(i)("skills.importSelectFile")),1)]),_:1},8,["disabled"])]),_:1},8,["file-list","disabled"])):(a(),u("div",xl,[e("input",{ref_key:"folderInputRef",ref:V,type:"file",webkitdirectory:"",multiple:"",style:{display:"none"},onChange:R},null,544),T(l(q),{disabled:p.value,onClick:z},{default:A(()=>[P(n(l(i)("skills.importSelectFolder")),1)]),_:1},8,["disabled"]),D.value?(a(),u("span",Sl,n(D.value)+" ("+n(L.value.length)+" "+n(l(i)("skills.importFileCount"))+") ",1)):b("",!0)]))])]),_:1},8,["show","title","mask-closable"]))}})})),va=j((()=>{})),Ct,ca=j((()=>{Dl(),Dl(),va(),Y(),Ct=ee($t,[["__scopeId","data-v-6cc6068d"]])})),Fl,Al,Ll,Bl,Pl,zl,Rl,Tl,Il,bt,Ul=j((()=>{N(),G(),J(),ie(),Fl={class:"hint"},Al={key:0,class:"state-row"},Ll={key:1,class:"state-row empty"},Bl={key:2,class:"dir-list"},Pl={class:"dir-input-wrap"},zl={key:0,class:"hint-tag broken"},Rl={key:1,class:"hint-tag broken"},Tl=["title","disabled","onClick"],Il={class:"modal-footer"},bt=Z({__name:"SkillExternalDirsModal",emits:["close","saved"],setup(_,{emit:$}){const f=$,{t:i}=X(),g=ae(),x=h(!0),p=h(!1),k=h(!0),w=h([]);function L(F){return F.exists?F.isDir?{raw:F.raw,hint:null}:{raw:F.raw,hint:"notdir"}:{raw:F.raw,hint:"missing"}}ue(async()=>{try{w.value=(await ta()).map(L)}catch(F){g.error(i("skills.externalDirs.loadFailed")+`: ${F.message}`)}finally{k.value=!1}});function D(){w.value.push({raw:"",hint:null})}function C(F){w.value.splice(F,1)}function V(F){w.value[F]&&(w.value[F].hint=null)}async function I(){const F=[],z=new Set;for(const R of w.value){const B=R.raw.trim();B&&(z.has(B)||(z.add(B),F.push(B)))}p.value=!0;try{await ea(F),g.success(i("skills.externalDirs.saveSuccess")),f("saved")}catch(R){g.error(i("skills.externalDirs.saveFailed")+`: ${R.message}`)}finally{p.value=!1}}function U(){p.value||(x.value=!1,setTimeout(()=>f("close"),200))}return(F,z)=>(a(),E(l(ht),{show:x.value,"onUpdate:show":z[0]||(z[0]=R=>x.value=R),preset:"card",title:l(i)("skills.externalDirs.title"),style:{width:"min(560px, calc(100vw - 32px))"},"mask-closable":!p.value,onAfterLeave:z[1]||(z[1]=R=>f("close"))},{footer:A(()=>[e("div",Il,[T(l(q),{disabled:p.value,onClick:U},{default:A(()=>[P(n(l(i)("common.cancel")),1)]),_:1},8,["disabled"]),T(l(q),{type:"primary",loading:p.value,disabled:k.value,onClick:I},{default:A(()=>[P(n(l(i)("common.save")),1)]),_:1},8,["loading","disabled"])])]),default:A(()=>[e("p",Fl,n(l(i)("skills.externalDirs.hint")),1),k.value?(a(),u("div",Al,n(l(i)("common.loading")),1)):w.value.length===0?(a(),u("div",Ll,n(l(i)("skills.externalDirs.empty")),1)):(a(),u("ul",Bl,[(a(!0),u(O,null,K(w.value,(R,B)=>(a(),u("li",{key:B,class:"dir-row"},[e("div",Pl,[T(l(re),{value:R.raw,"onUpdate:value":[c=>R.raw=c,c=>V(B)],size:"small",placeholder:l(i)("skills.externalDirs.placeholder"),disabled:p.value},null,8,["value","onUpdate:value","placeholder","disabled"]),R.hint==="missing"?(a(),u("span",zl,n(l(i)("skills.externalDirs.missing")),1)):R.hint==="notdir"?(a(),u("span",Rl,n(l(i)("skills.externalDirs.notDir")),1)):b("",!0)]),e("button",{class:"row-remove",title:l(i)("skills.externalDirs.removeRow"),disabled:p.value,onClick:c=>C(B)},[...z[2]||(z[2]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,Tl)]))),128))])),T(l(q),{size:"small",disabled:p.value,onClick:D},{icon:A(()=>[...z[3]||(z[3]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),default:A(()=>[P(" "+n(l(i)("skills.externalDirs.add")),1)]),_:1},8,["disabled"])]),_:1},8,["show","title","mask-closable"]))}})})),pa=j((()=>{})),xt,fa=j((()=>{Ul(),Ul(),pa(),Y(),xt=ee(bt,[["__scopeId","data-v-134aef16"]])}));async function St(){return se("/api/hermes/write-gate/pending")}async function ka(_,$){const f=await se(`/api/hermes/write-gate/pending/${encodeURIComponent(_)}/${encodeURIComponent($)}/diff`);return f.review?f.review:{subsystem:_,targetLabel:_,language:_==="memory"?"json":"",current:"",proposed:f.diff||"",diff:f.diff||"",payloadText:_==="memory"?f.diff||"":void 0,notes:[]}}async function ha(_,$){return se(`/api/hermes/write-gate/pending/${encodeURIComponent(_)}/${encodeURIComponent($)}/approve`,{method:"POST"})}async function _a(_,$){return se(`/api/hermes/write-gate/pending/${encodeURIComponent(_)}/${encodeURIComponent($)}/reject`,{method:"POST"})}var Mt=j((()=>{Zt()})),Vl,Wl,jl,Hl,El,ql,Ol,Ql,Kl,Nl,Zl,Gl,Dt,Jl=j((()=>{N(),G(),J(),_t(),Mt(),Vl={class:"write-approval-panel"},Wl={class:"write-approval-header"},jl={key:0,class:"write-approval-state"},Hl={key:1,class:"write-approval-state"},El={key:2,class:"write-approval-state"},ql={key:3,class:"write-approval-list"},Ol={class:"write-approval-main"},Ql={class:"write-approval-meta"},Kl={key:0},Nl={class:"write-approval-summary"},Zl={class:"write-approval-actions"},Gl={key:0,class:"write-approval-review"},Dt=Z({__name:"PendingWriteApprovals",emits:["count-change"],setup(_,{emit:$}){const f=$,{t:i}=X(),g=ae(),x=h([]),p=h(!1),k=h(""),w=h({}),L=h(!0),D=Q(()=>x.value.length);function C(c){return`${c.subsystem}:${c.id}`}function V(c,y){let o=y||"";return o=o.replaceAll("```","```"),o&&!o.endsWith(`
|
|
2
2
|
`)&&(o+=`
|
|
3
3
|
`),`\`\`\`${c||""}
|
|
4
4
|
${o}\`\`\``}function I(c){const y=[];for(const r of c.notes||[])r.type==="patchOldStringMissing"?y.push(i("skills.writeApprovalPatchOldStringMissing",{file:r.targetLabel||c.targetLabel})):r.type==="currentReadFailed"?y.push(i("skills.writeApprovalCurrentReadFailed",{file:r.targetLabel||c.targetLabel})):r.type==="deleteSkill"?y.push(i("skills.writeApprovalDeleteSkill",{skill:r.skillName||"-"})):r.type==="removeFile"&&y.push(i("skills.writeApprovalRemoveFile",{file:r.targetLabel||c.targetLabel,skill:r.skillName||"-"}));return c.requestedOldString&&y.push([i("skills.writeApprovalRequestedOldString"),V(c.language||"text",c.requestedOldString)].join(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as H}from"./rolldown-runtime-M0oDzQ_3.js";import{An as Re,Bn as ze,Hn as h,Kt as Le,Nn as De,Ot as N,V as We,an as i,cn as u,cr as l,en as Ue,er as _,fn as g,fr as Ye,hn as He,in as D,jn as o,mt as Ge,on as Ve,ot as Fe,pn as w,pr as s,sn as O,t as Ke,tn as W,ur as J,w as je}from"./ui-vendor-DDMfmCj2.js";import{O as Xe,k as qe}from"./vue-vendor-BsMpqyaC.js";import{n as Je,o as Ze,s as Qe,t as et,u as tt}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{n as H}from"./rolldown-runtime-M0oDzQ_3.js";import{An as Re,Bn as ze,Hn as h,Kt as Le,Nn as De,Ot as N,V as We,an as i,cn as u,cr as l,en as Ue,er as _,fn as g,fr as Ye,hn as He,in as D,jn as o,mt as Ge,on as Ve,ot as Fe,pn as w,pr as s,sn as O,t as Ke,tn as W,ur as J,w as je}from"./ui-vendor-DDMfmCj2.js";import{O as Xe,k as qe}from"./vue-vendor-BsMpqyaC.js";import{n as Je,o as Ze,s as Qe,t as et,u as tt}from"./_plugin-vue_export-helper-CvnFozKy.js";import{a as nt,i as it,n as at,o as lt,r as st,s as rt,t as ot}from"./xterm-CraVE7U3.js";var Z,Q,ee,te,ne,ie,ae,le,se,re,oe,ce,ue,de,fe,he,me,_e,U,be,Y,ve,ge,ye,pe=H((()=>{Le(),rt(),it(),st(),ot(),tt(),Ke(),Xe(),Z={class:"terminal-panel-drawer"},Q={class:"sidebar-header"},ee={class:"sidebar-title"},te={class:"session-list"},ne={key:0,class:"session-error"},ie={key:1,class:"session-empty"},ae=["onClick"],le={class:"session-item-content"},se={class:"session-item-title"},re={class:"session-item-meta"},oe={class:"session-item-shell"},ce={key:0,class:"session-item-status"},ue={key:1,class:"session-item-time"},de={class:"terminal-main"},fe={class:"terminal-header"},he={key:0,class:"header-session-title"},me={class:"header-actions"},_e={class:"terminal-container"},U="hermes_terminal_theme",be=3,Y=18,ve=128,ge=8,ye=He({__name:"TerminalPanel",props:{visible:{type:Boolean},initialCommand:{}},setup(ke){const{t:r}=qe(),we=We(),G=ke,A={default:{label:"Default",theme:{background:"#1a1a2e",foreground:"#e0e0e0",cursor:"#4cc9f0",cursorAccent:"#1a1a2e",selectionBackground:"rgba(76, 201, 240, 0.3)",black:"#000000",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"solarized-dark":{label:"Solarized Dark",theme:{background:"#002b36",foreground:"#839496",cursor:"#93a1a1",cursorAccent:"#002b36",selectionBackground:"rgba(147, 161, 161, 0.3)",black:"#073642",red:"#dc322f",green:"#859900",yellow:"#b58900",blue:"#268bd2",magenta:"#d33682",cyan:"#2aa198",white:"#eee8d5",brightBlack:"#002b36",brightRed:"#cb4b16",brightGreen:"#586e75",brightYellow:"#657b83",brightBlue:"#839496",brightMagenta:"#6c71c4",brightCyan:"#93a1a1",brightWhite:"#fdf6e3"}},"tokyo-night":{label:"Tokyo Night",theme:{background:"#1a1b26",foreground:"#a9b1d6",cursor:"#c0caf5",cursorAccent:"#1a1b26",selectionBackground:"rgba(192, 202, 245, 0.2)",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}},"github-dark":{label:"GitHub Dark",theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",cursorAccent:"#0d1117",selectionBackground:"rgba(88, 166, 255, 0.25)",black:"#484f58",red:"#ff7b72",green:"#7ee787",yellow:"#ffa657",blue:"#79c0ff",magenta:"#d2a8ff",cyan:"#a5d6ff",white:"#c9d1d9",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#58a6ff",brightMagenta:"#bc8cff",brightCyan:"#79c0ff",brightWhite:"#f0f6fc"}}},p=_(null),c=_([]),d=_(null),E=_(localStorage.getItem(U)||"default"),b=_(null),C=_(!1),x=_(!1);let a=null;const m=new Map;let f=null,T=null,I=null,P=0,y=null,k=0;const V=_(!1),M=new Set,F=D(()=>c.value.find(e=>e.id===d.value)||null),Ce=D(()=>Object.entries(A).map(([e,t])=>({label:t.label,value:e}))),xe=D(()=>A[E.value]?.theme.background??"#1a1a2e");function Te(){const e=Ze(),t=Qe(),n=t?t.startsWith("https")?"wss:":"ws:":location.protocol==="https:"?"wss:":"ws:";return t?`${n}//${new URL(t).host}/api/hermes/terminal${e?`?token=${encodeURIComponent(e)}`:""}`:`${n}//${location.host}/api/hermes/terminal${e?`?token=${encodeURIComponent(e)}`:""}`}function $(){if(P>=be){b.value=r("terminal.connectionFailed"),C.value=!1;return}const e=Te();b.value=null,C.value=!0,P++,a=new WebSocket(e),a.onopen=()=>{C.value=!1,b.value=null},a.onmessage=t=>{const n=typeof t.data=="string"?t.data:"";if(n.charCodeAt(0)===123)try{Se(JSON.parse(n))}catch{}else f?.write(n)},a.onclose=t=>{if(C.value=!1,t.code===1e3||t.code===1003||t.code===1008){b.value=r("terminal.connectionClosed");return}setTimeout($,3e3)},a.onerror=t=>{console.error("[Terminal] WebSocket error:",t),b.value=r("terminal.connectionError")}}function S(e){!a||a.readyState!==WebSocket.OPEN||a.send(typeof e=="string"?e:JSON.stringify(e))}function Se(e){switch(e.type){case"created":P=0,c.value.push({id:e.id,shell:e.shell,pid:e.pid,title:`${e.shell} #${c.value.length+1}`,createdAt:Date.now(),exited:!1}),z(e.id),Be();break;case"exited":{const t=c.value.find(n=>n.id===e.id);t&&(t.exited=!0,d.value===e.id&&f?.write(`\r
|
|
2
2
|
\x1B[90m[${r("terminal.processExited",{code:e.exitCode})}]\x1B[0m\r
|
|
3
3
|
`));break}case"error":we.error(e.message);break}}function R(){S({type:"create"})}function Be(){const e=G.initialCommand?.trim();!e||V.value||(V.value=!0,K(`${e}\r`,0,100))}function K(e,t,n){const v=setTimeout(()=>{if(M.delete(v),!a||a.readyState!==WebSocket.OPEN)return;const B=Math.min(t+ve,e.length);S({type:"input",data:e.slice(t,B)}),B<e.length&&K(e,B,ge)},n);M.add(v)}function Ae(e){let t=m.get(e);if(!t){const n=new lt({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:{...A[E.value].theme}}),v=new nt;n.loadAddon(v),n.loadAddon(new at),n.onData(B=>{a?.readyState===WebSocket.OPEN&&a.send(B)}),t={term:n,fitAddon:v,opened:!1},m.set(e,t)}return t}function z(e){if(d.value===e)return;d.value=e;const t=Ae(e);f=t.term,T=t.fitAddon,Me(),S({type:"switch",sessionId:e})}function Ee(e){S({type:"close",sessionId:e}),c.value=c.value.filter(n=>n.id!==e);const t=m.get(e);t&&(t.term.dispose(),m.delete(e)),d.value===e&&(d.value=c.value.length>0?c.value[0].id:null,f=null,T=null,d.value?z(d.value):(j(),R()))}function Me(){if(!p.value)return;const e=p.value;for(;e.firstChild;)e.removeChild(e.firstChild);const t=m.get(d.value);if(t){if(!t.opened)t.term.open(e),t.opened=!0;else{const n=t.term.element;n&&e.appendChild(n)}I?.disconnect(),I=new ResizeObserver(()=>{L(),Ne()}),I.observe(p.value),setTimeout(()=>L(),50),setTimeout(()=>L(),200)}}function j(){if(!p.value)return;const e=p.value;for(;e.firstChild;)e.removeChild(e.firstChild)}function L(){if(T)try{T.fit()}catch{}}function Ne(){if(!(!f||!a||a.readyState!==WebSocket.OPEN))try{S({type:"resize",cols:f.cols,rows:f.rows})}catch{}}function Oe(e){if(e.touches.length!==1){y=null,k=0;return}y=e.touches[0].clientY,k=0}function Ie(e){if(!f||e.touches.length!==1||y===null)return;const t=e.touches[0].clientY;k+=y-t,y=t;const n=Math.trunc(k/Y);n!==0&&(f.scrollLines(n),k-=n*Y,e.preventDefault())}function X(){y=null,k=0}function Pe(e){E.value=e,localStorage.setItem(U,e);const t=A[e]?.theme;if(t)for(const n of m.values())n.term.options.theme={...t}}function $e(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}let q=!1;return ze(()=>G.visible,e=>{e&&!q&&!a&&(q=!0,$())},{immediate:!0}),Re(()=>{for(const e of M)clearTimeout(e);M.clear(),j();for(const e of m.values())e.term.dispose();m.clear(),f=null,T=null,a?.close(),a=null}),(e,t)=>(o(),u("div",Z,[x.value?(o(),u("div",{key:0,class:"sidebar-overlay",onClick:t[0]||(t[0]=n=>x.value=!1)})):O("",!0),i("div",{class:J(["terminal-sidebar",{"mobile-visible":x.value}])},[i("div",Q,[i("span",ee,s(l(r)("terminal.sessions")),1),w(l(Fe),{trigger:"hover"},{trigger:h(()=>[w(l(N),{quaternary:"",size:"tiny",onClick:R,circle:""},{icon:h(()=>[...t[3]||(t[3]=[i("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),_:1})]),default:h(()=>[g(" "+s(l(r)("terminal.newTab")),1)]),_:1})]),i("div",te,[b.value?(o(),u("div",ne,[t[4]||(t[4]=i("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i("circle",{cx:"12",cy:"12",r:"10"}),i("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),i("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})],-1)),i("span",null,s(b.value),1),w(l(N),{size:"tiny",onClick:$},{default:h(()=>[g(s(l(r)("common.retry")),1)]),_:1})])):c.value.length===0?(o(),u("div",ie,[C.value?(o(),u(W,{key:0},[g(s(l(r)("common.loading")),1)],64)):(o(),u(W,{key:1},[g(s(l(r)("terminal.noSessions")),1)],64))])):O("",!0),(o(!0),u(W,null,De(c.value,n=>(o(),u("button",{key:n.id,class:J(["session-item",{active:n.id===d.value,exited:n.exited}]),onClick:v=>z(n.id)},[i("div",le,[i("span",se,s(n.title),1),i("span",re,[i("span",oe,s(n.shell),1),n.exited?(o(),u("span",ce,s(l(r)("terminal.sessionExited")),1)):(o(),u("span",ue,s($e(n.createdAt)),1))])]),c.value.length>1?(o(),Ve(l(je),{key:0,onPositiveClick:v=>Ee(n.id)},{trigger:h(()=>[i("button",{class:"session-item-delete",onClick:t[1]||(t[1]=Ue(()=>{},["stop"]))},[...t[5]||(t[5]=[i("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),default:h(()=>[g(" "+s(l(r)("terminal.closeSession")),1)]),_:1},8,["onPositiveClick"])):O("",!0)],10,ae))),128))])],2),i("div",de,[i("header",fe,[F.value?(o(),u("span",he,s(F.value.title),1)):O("",!0),i("div",me,[w(l(N),{size:"small",onClick:t[2]||(t[2]=n=>x.value=!x.value),class:"sidebar-toggle"},{icon:h(()=>[...t[6]||(t[6]=[i("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),i("line",{x1:"9",y1:"3",x2:"9",y2:"21"})],-1)])]),default:h(()=>[g(" "+s(l(r)("terminal.sessions")),1)]),_:1}),w(l(Ge),{value:E.value,options:Ce.value,size:"small","consistent-menu-width":!1,class:"theme-select","onUpdate:value":Pe},null,8,["value","options"]),w(l(N),{size:"small",onClick:R},{icon:h(()=>[...t[7]||(t[7]=[i("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[i("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),default:h(()=>[g(" "+s(l(r)("terminal.newTab")),1)]),_:1})])]),i("div",_e,[i("div",{ref_key:"terminalRef",ref:p,class:"terminal-xterm",style:Ye({backgroundColor:xe.value}),onTouchstart:Oe,onTouchmove:Ie,onTouchend:X,onTouchcancel:X},null,36)])])]))}})})),ct=H((()=>{})),ut,Tt=H((()=>{pe(),pe(),ct(),Je(),ut=et(ye,[["__scopeId","data-v-b0c56b43"]])}));export{Tt as n,ut as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as M}from"./rolldown-runtime-M0oDzQ_3.js";import{An as xe,Hn as h,Kt as Te,Nn as Se,Ot as E,V as Me,an as r,cn as b,cr as i,en as Ae,er as w,fn as L,fr as Re,hn as We,in as O,jn as f,kn as Ye,mt as Ge,on as Ee,ot as Le,pn as p,pr as d,sn as B,t as Oe,tn as $e,ur as $,w as ze}from"./ui-vendor-DDMfmCj2.js";import{O as Ne,k as Ve}from"./vue-vendor-BsMpqyaC.js";import{n as De,o as Ie,s as Pe,t as Ue,u as He}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{n as M}from"./rolldown-runtime-M0oDzQ_3.js";import{An as xe,Hn as h,Kt as Te,Nn as Se,Ot as E,V as Me,an as r,cn as b,cr as i,en as Ae,er as w,fn as L,fr as Re,hn as We,in as O,jn as f,kn as Ye,mt as Ge,on as Ee,ot as Le,pn as p,pr as d,sn as B,t as Oe,tn as $e,ur as $,w as ze}from"./ui-vendor-DDMfmCj2.js";import{O as Ne,k as Ve}from"./vue-vendor-BsMpqyaC.js";import{n as De,o as Ie,s as Pe,t as Ue,u as He}from"./_plugin-vue_export-helper-CvnFozKy.js";import{a as Fe,i as je,n as qe,o as Ke,r as Xe,s as Je,t as Qe}from"./xterm-CraVE7U3.js";var U,H,F,j,q,K,X,J,Q,Z,ee,te,ae,re,ne,ie,le,oe,ce,z,N,fe,se=M((()=>{Te(),Je(),je(),Xe(),Qe(),He(),Oe(),Ne(),U={class:"terminal-panel"},H={class:"session-list-header"},F={key:0,class:"session-list-title"},j={class:"session-list-actions"},q={key:0,class:"session-items"},K={key:0,class:"session-empty"},X=["onClick"],J={class:"session-item-content"},Q={class:"session-item-title"},Z={class:"session-item-meta"},ee={class:"session-item-shell"},te={key:0,class:"session-item-status"},ae={key:1,class:"session-item-time"},re={class:"terminal-main"},ne={class:"terminal-header"},ie={class:"header-left"},le={key:0,class:"header-session-title"},oe={class:"header-actions"},ce={class:"terminal-container"},z="hermes_terminal_theme",N=18,fe=We({__name:"TerminalView",setup(rt){const{t:g}=Ve(),de=Me(),C={default:{label:"Default",theme:{background:"#1a1a2e",foreground:"#e0e0e0",cursor:"#4cc9f0",cursorAccent:"#1a1a2e",selectionBackground:"rgba(76, 201, 240, 0.3)",black:"#000000",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"solarized-dark":{label:"Solarized Dark",theme:{background:"#002b36",foreground:"#839496",cursor:"#93a1a1",cursorAccent:"#002b36",selectionBackground:"rgba(147, 161, 161, 0.3)",black:"#073642",red:"#dc322f",green:"#859900",yellow:"#b58900",blue:"#268bd2",magenta:"#d33682",cyan:"#2aa198",white:"#eee8d5",brightBlack:"#002b36",brightRed:"#cb4b16",brightGreen:"#586e75",brightYellow:"#657b83",brightBlue:"#839496",brightMagenta:"#6c71c4",brightCyan:"#93a1a1",brightWhite:"#fdf6e3"}},"solarized-light":{label:"Solarized Light",theme:{background:"#fdf6e3",foreground:"#657b83",cursor:"#586e75",cursorAccent:"#fdf6e3",selectionBackground:"rgba(88, 110, 117, 0.3)",black:"#073642",red:"#dc322f",green:"#859900",yellow:"#b58900",blue:"#268bd2",magenta:"#d33682",cyan:"#2aa198",white:"#eee8d5",brightBlack:"#002b36",brightRed:"#cb4b16",brightGreen:"#586e75",brightYellow:"#657b83",brightBlue:"#839496",brightMagenta:"#6c71c4",brightCyan:"#93a1a1",brightWhite:"#fdf6e3"}},monokai:{label:"Monokai",theme:{background:"#272822",foreground:"#f8f8f2",cursor:"#f8f8f0",cursorAccent:"#272822",selectionBackground:"rgba(248, 248, 242, 0.2)",black:"#272822",red:"#f92672",green:"#a6e22e",yellow:"#f4bf75",blue:"#66d9ef",magenta:"#ae81ff",cyan:"#a1efe4",white:"#f8f8f2",brightBlack:"#75715e",brightRed:"#fd971f",brightGreen:"#a6e22e",brightYellow:"#e6db74",brightBlue:"#66d9ef",brightMagenta:"#ae81ff",brightCyan:"#a1efe4",brightWhite:"#f9f8f5"}},dracula:{label:"Dracula",theme:{background:"#282a36",foreground:"#f8f8f2",cursor:"#f8f8f2",cursorAccent:"#282a36",selectionBackground:"rgba(248, 248, 242, 0.2)",black:"#21222c",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#f8f8f2",brightBlack:"#6272a4",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"}},nord:{label:"Nord",theme:{background:"#2e3440",foreground:"#d8dee9",cursor:"#d8dee9",cursorAccent:"#2e3440",selectionBackground:"rgba(216, 222, 233, 0.2)",black:"#3b4252",red:"#bf616a",green:"#a3be8c",yellow:"#ebcb8b",blue:"#81a1c1",magenta:"#b48ead",cyan:"#88c0d0",white:"#e5e9f0",brightBlack:"#4c566a",brightRed:"#bf616a",brightGreen:"#a3be8c",brightYellow:"#ebcb8b",brightBlue:"#81a1c1",brightMagenta:"#b48ead",brightCyan:"#8fbcbb",brightWhite:"#eceff4"}},"one-dark":{label:"One Dark",theme:{background:"#282c34",foreground:"#abb2bf",cursor:"#528bff",cursorAccent:"#282c34",selectionBackground:"rgba(82, 139, 255, 0.25)",black:"#282c34",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"github-dark":{label:"GitHub Dark",theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",cursorAccent:"#0d1117",selectionBackground:"rgba(88, 166, 255, 0.25)",black:"#484f58",red:"#ff7b72",green:"#7ee787",yellow:"#ffa657",blue:"#79c0ff",magenta:"#d2a8ff",cyan:"#a5d6ff",white:"#c9d1d9",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#58a6ff",brightMagenta:"#bc8cff",brightCyan:"#79c0ff",brightWhite:"#f0f6fc"}},"tokyo-night":{label:"Tokyo Night",theme:{background:"#1a1b26",foreground:"#a9b1d6",cursor:"#c0caf5",cursorAccent:"#1a1b26",selectionBackground:"rgba(192, 202, 245, 0.2)",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}},"github-light":{label:"GitHub Light",theme:{background:"#ffffff",foreground:"#24292f",cursor:"#0969da",cursorAccent:"#ffffff",selectionBackground:"rgba(9, 105, 218, 0.2)",black:"#24292f",red:"#cf222e",green:"#116329",yellow:"#4d2d00",blue:"#0969da",magenta:"#8250df",cyan:"#1b7c83",white:"#57606a",brightBlack:"#57606a",brightRed:"#a40e26",brightGreen:"#1a7f37",brightYellow:"#633c01",brightBlue:"#218bff",brightMagenta:"#a475f4",brightCyan:"#3192aa",brightWhite:"#8c959f"}},"catppuccin-latte":{label:"Catppuccin Latte",theme:{background:"#eff1f5",foreground:"#4c4f69",cursor:"#dc8a78",cursorAccent:"#eff1f5",selectionBackground:"rgba(220, 138, 120, 0.2)",black:"#5c5f77",red:"#d20f39",green:"#40a02b",yellow:"#df8e1d",blue:"#1e66f5",magenta:"#ea76cb",cyan:"#179299",white:"#4c4f69",brightBlack:"#6c6f85",brightRed:"#d20f39",brightGreen:"#40a02b",brightYellow:"#df8e1d",brightBlue:"#1e66f5",brightMagenta:"#ea76cb",brightCyan:"#179299",brightWhite:"#bcc0cc"}},"alabaster-light":{label:"Alabaster",theme:{background:"#f7f7f7",foreground:"#434343",cursor:"#528bff",cursorAccent:"#f7f7f7",selectionBackground:"rgba(82, 139, 255, 0.2)",black:"#000000",red:"#aa3731",green:"#448c27",yellow:"#cb9000",blue:"#325cc0",magenta:"#7a3e9d",cyan:"#0083b2",white:"#434343",brightBlack:"#777777",brightRed:"#f05050",brightGreen:"#60cb00",brightYellow:"#ffbc5d",brightBlue:"#0070ea",brightMagenta:"#ca64e2",brightCyan:"#00aacb",brightWhite:"#999999"}},"xterm-light":{label:"XTerm Light",theme:{background:"#fafafa",foreground:"#383a42",cursor:"#526fff",cursorAccent:"#fafafa",selectionBackground:"rgba(82, 111, 255, 0.2)",black:"#383a42",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a1a7",brightBlack:"#4f525e",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"one-light":{label:"One Light",theme:{background:"#fafafa",foreground:"#383a42",cursor:"#526eff",cursorAccent:"#fafafa",selectionBackground:"rgba(82, 110, 255, 0.2)",black:"#383a42",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a1a7",brightBlack:"#4f525e",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"}},"gruvbox-light":{label:"Gruvbox Light",theme:{background:"#fbf1c7",foreground:"#3c3836",cursor:"#9d0006",cursorAccent:"#fbf1c7",selectionBackground:"rgba(157, 0, 6, 0.15)",black:"#fbf1c7",red:"#cc241d",green:"#98971a",yellow:"#d79921",blue:"#458588",magenta:"#b16286",cyan:"#689d6a",white:"#504945",brightBlack:"#928374",brightRed:"#9d0006",brightGreen:"#79740e",brightYellow:"#b57614",brightBlue:"#076678",brightMagenta:"#8f3f71",brightCyan:"#427b58",brightWhite:"#3c3836"}}},m=w(null),o=w(!0),l=w([]),c=w(null),x=w(localStorage.getItem(z)||"default");let n=null;const u=new Map;let s=null,v=null,A=null,y=null,_=null,k=0;const V=O(()=>l.value.find(e=>e.id===c.value)||null),be=O(()=>Object.entries(C).map(([e,t])=>({label:t.label,value:e}))),ue=O(()=>C[x.value]?.theme.background??"#1a1a2e");function he(){const e=Ie(),t=Pe(),a=t?t.startsWith("https")?"wss:":"ws:":location.protocol==="https:"?"wss:":"ws:";return t?`${a}//${new URL(t).host}/api/hermes/terminal${e?`?token=${encodeURIComponent(e)}`:""}`:`${a}//${location.host}/api/hermes/terminal${e?`?token=${encodeURIComponent(e)}`:""}`}function D(){const e=he();n=new WebSocket(e),n.onopen=()=>{},n.onmessage=t=>{const a=typeof t.data=="string"?t.data:"";if(a.charCodeAt(0)===123)try{ge(JSON.parse(a))}catch{}else s?.write(a)},n.onopen=()=>{},n.onclose=()=>{setTimeout(D,3e3)},n.onerror=()=>{}}function T(e){!n||n.readyState!==WebSocket.OPEN||n.send(typeof e=="string"?e:JSON.stringify(e))}function ge(e){switch(e.type){case"created":l.value.push({id:e.id,shell:e.shell,pid:e.pid,title:`${e.shell} #${l.value.length+1}`,createdAt:Date.now(),exited:!1}),W(e.id);break;case"switched":break;case"exited":{const t=l.value.find(a=>a.id===e.id);t&&(t.exited=!0,c.value===e.id&&s?.write(`\r
|
|
2
2
|
\x1B[90m[${g("terminal.processExited",{code:e.exitCode})}]\x1B[0m\r
|
|
3
3
|
`));break}case"error":de.error(e.message);break}}function R(){T({type:"create"})}function me(e){let t=u.get(e);if(!t){const a=new Ke({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:{...C[x.value].theme}}),S=new Fe;a.loadAddon(S),a.loadAddon(new qe),a.onData(Ce=>{n?.readyState===WebSocket.OPEN&&n.send(Ce)}),t={term:a,fitAddon:S,opened:!1},u.set(e,t)}return t}function W(e){if(c.value===e)return;c.value=e;const t=me(e);s=t.term,v=t.fitAddon,ke(),T({type:"switch",sessionId:e}),y?.matches&&(o.value=!1)}function _e(e){T({type:"close",sessionId:e}),l.value=l.value.filter(a=>a.id!==e);const t=u.get(e);t&&(t.term.dispose(),u.delete(e)),c.value===e&&(c.value=l.value.length>0?l.value[0].id:null,s=null,v=null,c.value?W(c.value):(I(),R()))}function ke(){if(!m.value)return;const e=m.value;for(;e.firstChild;)e.removeChild(e.firstChild);const t=u.get(c.value);if(t){if(!t.opened)t.term.open(e),t.opened=!0;else{const a=t.term.element;a&&e.appendChild(a)}A?.disconnect(),A=new ResizeObserver(()=>{Y(),ve()}),A.observe(m.value),setTimeout(()=>Y(),50),setTimeout(()=>Y(),200)}}function I(){if(!m.value)return;const e=m.value;for(;e.firstChild;)e.removeChild(e.firstChild)}function Y(){if(v)try{v.fit()}catch{}}function ve(){if(!(!s||!n||n.readyState!==WebSocket.OPEN))try{T({type:"resize",cols:s.cols,rows:s.rows})}catch{}}function ye(e){if(e.touches.length!==1){_=null,k=0;return}_=e.touches[0].clientY,k=0}function we(e){if(!s||e.touches.length!==1||_===null)return;const t=e.touches[0].clientY;k+=_-t,_=t;const a=Math.trunc(k/N);a!==0&&(s.scrollLines(a),k-=a*N,e.preventDefault())}function P(){_=null,k=0}function pe(e){x.value=e,localStorage.setItem(z,e);const t=C[e]?.theme;if(t)for(const a of u.values())a.term.options.theme={...t}}function Be(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function G(e){e.matches&&o.value&&(o.value=!1)}return Ye(()=>{y=window.matchMedia("(max-width: 768px)"),G(y),y.addEventListener("change",G),D()}),xe(()=>{y?.removeEventListener("change",G),I();for(const e of u.values())e.term.dispose();u.clear(),s=null,v=null,n?.close(),n=null}),(e,t)=>(f(),b("div",U,[r("div",{class:$(["session-backdrop",{active:o.value}]),onClick:t[0]||(t[0]=a=>o.value=!1)},null,2),r("aside",{class:$(["session-list",{collapsed:!o.value}])},[r("div",H,[o.value?(f(),b("span",F,d(i(g)("terminal.sessions")),1)):B("",!0),r("div",j,[p(i(Le),{trigger:"hover"},{trigger:h(()=>[p(i(E),{quaternary:"",size:"tiny",onClick:R,circle:""},{icon:h(()=>[...t[3]||(t[3]=[r("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[r("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),_:1})]),default:h(()=>[L(" "+d(i(g)("terminal.newTab")),1)]),_:1})])]),o.value?(f(),b("div",q,[l.value.length===0?(f(),b("div",K,d(i(g)("common.loading")),1)):B("",!0),(f(!0),b($e,null,Se(l.value,a=>(f(),b("button",{key:a.id,class:$(["session-item",{active:a.id===c.value,exited:a.exited}]),onClick:S=>W(a.id)},[r("div",J,[r("span",Q,d(a.title),1),r("span",Z,[r("span",ee,d(a.shell),1),a.exited?(f(),b("span",te,d(i(g)("terminal.sessionExited")),1)):(f(),b("span",ae,d(Be(a.createdAt)),1))])]),l.value.length>1?(f(),Ee(i(ze),{key:0,onPositiveClick:S=>_e(a.id)},{trigger:h(()=>[r("button",{class:"session-item-delete",onClick:t[1]||(t[1]=Ae(()=>{},["stop"]))},[...t[4]||(t[4]=[r("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[r("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),default:h(()=>[L(" "+d(i(g)("terminal.closeSession")),1)]),_:1},8,["onPositiveClick"])):B("",!0)],10,X))),128))])):B("",!0)],2),r("div",re,[r("header",ne,[r("div",ie,[p(i(E),{quaternary:"",size:"small",onClick:t[2]||(t[2]=a=>o.value=!o.value),circle:""},{icon:h(()=>[...t[5]||(t[5]=[r("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[r("rect",{x:"3",y:"3",width:"7",height:"7"}),r("rect",{x:"14",y:"3",width:"7",height:"7"}),r("rect",{x:"3",y:"14",width:"7",height:"7"}),r("rect",{x:"14",y:"14",width:"7",height:"7"})],-1)])]),_:1}),V.value?(f(),b("span",le,d(V.value.title),1)):B("",!0)]),r("div",oe,[p(i(Ge),{value:x.value,options:be.value,size:"small","consistent-menu-width":!1,class:"theme-select","onUpdate:value":pe},null,8,["value","options"]),p(i(E),{size:"small",onClick:R},{icon:h(()=>[...t[6]||(t[6]=[r("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[r("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])]),default:h(()=>[L(" "+d(i(g)("terminal.newTab")),1)]),_:1})])]),r("div",ce,[r("div",{ref_key:"terminalRef",ref:m,class:"terminal-xterm",style:Re({backgroundColor:ue.value}),onTouchstart:ye,onTouchmove:we,onTouchend:P,onTouchcancel:P},null,36)])])]))}})})),Ze=M((()=>{})),et=M((()=>{})),tt,at=M((()=>{se(),se(),Ze(),et(),De(),tt=Ue(fe,[["__scopeId","data-v-33848db6"]])}));at();export{tt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as y}from"./rolldown-runtime-M0oDzQ_3.js";import{Hn as N,Kt as C,Nn as M,Ot as z,an as e,cn as c,cr as s,er as V,fn as T,fr as m,hn as R,in as k,jn as p,kn as st,pn as x,pr as t,sn as $,t as at,tn as S}from"./ui-vendor-DDMfmCj2.js";import{I as nt,L as ot,O as D,k as F}from"./vue-vendor-BsMpqyaC.js";import{n as B,t as H}from"./_plugin-vue_export-helper-fFMkIM4P.js";import{Dt as lt,Et as it,gt as ut,vt as rt}from"./index-Brl4qW5V.js";function Ge(_){return(_||"").trim()||"unknown"}function w(_,a){return a<=0?0:_/a*100}function K(_){const a=Ge(_);let n=0;for(let d=0;d<a.length;d+=1)n=(n<<5)-n+a.charCodeAt(d),n|=0;return L[Math.abs(n)%L.length]}var L,P,I=y((()=>{rt(),ot(),C(),L=["#4fd1c5","#63b3ed","#f6ad55","#b794f4","#68d391","#fc8181","#f687b3","#90cdf4","#fbd38d","#9ae6b4"],P=nt("usage",()=>{const _=V(null),a=V(!1);let n=0;async function d(u=30){const v=++n;a.value=!0;try{const b=await ut(u);v===n&&(_.value=b)}catch(b){v===n&&console.error("Failed to load usage stats:",b)}finally{v===n&&(a.value=!1)}}const g=k(()=>!!_.value&&_.value.total_sessions>0),r=k(()=>_.value?.total_input_tokens??0),h=k(()=>_.value?.total_output_tokens??0),i=k(()=>r.value+h.value),o=k(()=>_.value?.total_sessions??0),l=k(()=>_.value?.total_cache_read_tokens??0),f=k(()=>{const u=r.value+l.value;return u===0?null:l.value/u*100}),O=k(()=>_.value?.total_cost??0),q=k(()=>_.value?_.value.model_usage.map(u=>{const v=Ge(u.model),b=u.input_tokens+u.output_tokens,U=b+u.cache_read_tokens;return{model:v,inputTokens:u.input_tokens,outputTokens:u.output_tokens,cacheTokens:u.cache_read_tokens,cacheWriteTokens:u.cache_write_tokens,totalTokens:b,visualTokens:U,sessions:u.sessions,color:K(v),inputPercent:w(u.input_tokens,U),outputPercent:w(u.output_tokens,U),cachePercent:w(u.cache_read_tokens,U)}}).sort((u,v)=>v.visualTokens-u.visualTokens):[]);return{stats:_,isLoading:a,hasData:g,loadSessions:d,totalInputTokens:r,totalOutputTokens:h,totalTokens:i,totalSessions:o,totalCacheTokens:l,cacheHitRate:f,estimatedCost:O,modelUsage:q,modelLegend:k(()=>{const u=new Set;return q.value.filter(v=>u.has(v.model)?!1:(u.add(v.model),!0)).map(v=>({model:v.model,color:v.color}))}),dailyUsage:k(()=>(_.value?.daily_usage??[]).map(u=>{const v=u.input_tokens+u.output_tokens+u.cache_read_tokens;return{...u,visualTokens:v,inputPercent:w(u.input_tokens,v),outputPercent:w(u.output_tokens,v),cachePercent:w(u.cache_read_tokens,v)}})),avgSessionsPerDay:k(()=>{if(!_.value||_.value.daily_usage.length===0)return 0;const u=_.value.daily_usage.filter(b=>b.sessions>0).length,v=Math.max(1,u);return o.value/v}),getModelColor:K}})})),W,E,A,j,G,J,Q,X,Y,Z,ee,te,se,ae,ne,oe,Je,le=y((()=>{C(),D(),I(),W={class:"stat-cards"},E={class:"stat-card"},A={class:"stat-label"},j={class:"stat-value"},G={class:"stat-sub"},J={class:"stat-card"},Q={class:"stat-label"},X={class:"stat-value"},Y={class:"stat-sub"},Z={class:"stat-card"},ee={class:"stat-label"},te={class:"stat-value"},se={class:"stat-card"},ae={class:"stat-label"},ne={class:"stat-value"},oe={key:0,class:"stat-sub"},Je=R({__name:"StatCards",setup(_){const{t:a}=F(),n=P();function d(r){return r>=1e6?(r/1e6).toFixed(1)+"M":r>=1e3?(r/1e3).toFixed(1)+"K":String(r)}function g(r){return r===0?"$0.00":r<.01?"<$0.01":"$"+r.toFixed(2)}return(r,h)=>(p(),c("div",W,[e("div",E,[e("div",A,t(s(a)("usage.totalTokens")),1),e("div",j,t(d(s(n).totalTokens)),1),e("div",G,t(d(s(n).totalInputTokens))+" "+t(s(a)("usage.inputTokens"))+" / "+t(d(s(n).totalOutputTokens))+" "+t(s(a)("usage.outputTokens")),1)]),e("div",J,[e("div",Q,t(s(a)("usage.totalSessions")),1),e("div",X,t(s(n).totalSessions),1),e("div",Y,t(s(a)("usage.avgPerDay",{n:s(n).avgSessionsPerDay.toFixed(1)})),1)]),e("div",Z,[e("div",ee,t(s(a)("usage.estimatedCost")),1),e("div",te,t(g(s(n).estimatedCost)),1)]),e("div",se,[e("div",ae,t(s(a)("usage.cacheHitRate")),1),e("div",ne,t(s(n).cacheHitRate!==null?s(n).cacheHitRate.toFixed(1)+"%":"--"),1),s(n).cacheHitRate!==null?(p(),c("div",oe,t(d(s(n).totalCacheTokens))+" "+t(s(a)("usage.tokens")),1)):$("",!0)])]))}})})),_t=y((()=>{})),Qe,dt=y((()=>{le(),le(),_t(),B(),Qe=H(Je,[["__scopeId","data-v-3a594781"]])})),ie,ue,re,_e,de,ce,pe,ve,he,ge,ke,Xe,ye=y((()=>{C(),D(),I(),ie={class:"model-breakdown"},ue={class:"section-title"},re={class:"model-legend","aria-label":"Token type legend"},_e={class:"legend-item"},de={class:"legend-item"},ce={class:"legend-item"},pe={class:"model-list"},ve=["title"],he={class:"model-bar-wrap"},ge=["title"],ke={key:0},Xe=R({__name:"ModelBreakdown",setup(_){const{t:a}=F(),n=P(),d=k(()=>Math.max(...n.modelUsage.map(h=>h.visualTokens),1));function g(h){return h>=1e6?(h/1e6).toFixed(1)+"M":h>=1e3?(h/1e3).toFixed(1)+"K":String(h)}function r(h){const i=h.inputTokens+h.cacheTokens;return i===0?"--":(h.cacheTokens/i*100).toFixed(1)+"%"}return(h,i)=>(p(),c("div",ie,[e("h3",ue,t(s(a)("usage.modelBreakdown")),1),e("div",re,[e("div",_e,[i[0]||(i[0]=e("span",{class:"legend-swatch input"},null,-1)),T(t(s(a)("usage.inputTokens")),1)]),e("div",de,[i[1]||(i[1]=e("span",{class:"legend-swatch output"},null,-1)),T(t(s(a)("usage.outputTokens")),1)]),e("div",ce,[i[2]||(i[2]=e("span",{class:"legend-swatch cache"},null,-1)),T(t(s(a)("usage.cacheRead")),1)])]),e("div",pe,[(p(!0),c(S,null,M(s(n).modelUsage,o=>(p(),c("div",{key:o.model,class:"model-row"},[e("span",{class:"model-swatch",style:m({background:o.color})},null,4),e("span",{class:"model-name",title:o.model},t(o.model),9,ve),e("div",he,[e("div",{class:"model-bar",style:m({width:o.visualTokens/d.value*100+"%"})},[o.inputTokens>0?(p(),c("div",{key:0,class:"model-bar-segment input",style:m({width:o.inputPercent+"%"})},null,4)):$("",!0),o.outputTokens>0?(p(),c("div",{key:1,class:"model-bar-segment output",style:m({width:o.outputPercent+"%"})},null,4)):$("",!0),o.cacheTokens>0?(p(),c("div",{key:2,class:"model-bar-segment cache",style:m({width:o.cachePercent+"%"})},null,4)):$("",!0)],4)]),e("span",{class:"model-tokens",title:`${s(a)("usage.inputTokens")}: ${g(o.inputTokens)} · ${s(a)("usage.outputTokens")}: ${g(o.outputTokens)} · ${s(a)("usage.cacheRead")}: ${g(o.cacheTokens)} · ${s(a)("usage.cacheHitRate")}: ${r(o)}`},[T(t(g(o.totalTokens))+" ",1),o.cacheTokens>0?(p(),c("small",ke,"+"+t(g(o.cacheTokens)),1)):$("",!0)],8,ge)]))),128))])]))}})})),ct=y((()=>{})),Ye,pt=y((()=>{ye(),ye(),ct(),B(),Ye=H(Xe,[["__scopeId","data-v-692258ec"]])})),fe,me,Te,be,$e,we,xe,Se,Ce,Pe,Ue,Me,Re,De,Fe,Be,He,Ie,Ve,Ze,Le=y((()=>{C(),D(),I(),fe={class:"daily-trend"},me={class:"section-title"},Te={class:"bar-chart"},be={class:"bar-track"},$e={class:"bar-tooltip"},we={class:"tooltip-date"},xe={class:"tooltip-row"},Se={class:"tooltip-row"},Ce={class:"tooltip-row"},Pe={class:"tooltip-row"},Ue={class:"tooltip-row"},Me={class:"tooltip-row"},Re={class:"tooltip-row"},De={class:"bar-dates"},Fe={class:"chart-legend","aria-label":"Token type legend"},Be={class:"legend-item"},He={class:"legend-item"},Ie={class:"legend-item"},Ve={class:"trend-table"},Ze=R({__name:"DailyTrend",setup(_){const{t:a}=F(),n=P();function d(i){return i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":String(i)}function g(i){return i===0?"$0.00":i<.01?"<$0.01":"$"+i.toFixed(2)}function r(i){const o=i.input_tokens+i.cache_read_tokens;return o===0?"--":(i.cache_read_tokens/o*100).toFixed(1)+"%"}const h=k(()=>Math.max(...n.dailyUsage.map(i=>i.visualTokens),1));return(i,o)=>(p(),c("div",fe,[e("h3",me,t(s(a)("usage.dailyTrend")),1),e("div",Te,[(p(!0),c(S,null,M(s(n).dailyUsage,l=>(p(),c("div",{key:l.date,class:"bar-col"},[e("div",be,[e("div",{class:"bar-stack",style:m({height:l.visualTokens/h.value*100+"%"})},[l.output_tokens>0?(p(),c("div",{key:0,class:"bar-segment output",style:m({height:l.outputPercent+"%"})},null,4)):$("",!0),l.input_tokens>0?(p(),c("div",{key:1,class:"bar-segment input",style:m({height:l.inputPercent+"%"})},null,4)):$("",!0),l.cache_read_tokens>0?(p(),c("div",{key:2,class:"bar-segment cache",style:m({height:l.cachePercent+"%"})},null,4)):$("",!0)],4)]),e("div",$e,[e("div",we,t(l.date),1),e("div",xe,t(s(a)("usage.inputTokens"))+": "+t(d(l.input_tokens)),1),e("div",Se,t(s(a)("usage.outputTokens"))+": "+t(d(l.output_tokens)),1),e("div",Ce,t(s(a)("usage.cacheRead"))+": "+t(d(l.cache_read_tokens)),1),e("div",Pe,t(s(a)("usage.cacheWrite"))+": "+t(d(l.cache_write_tokens)),1),e("div",Ue,t(s(a)("usage.cacheHitRate"))+": "+t(r(l)),1),e("div",Me,t(s(a)("usage.sessions"))+": "+t(l.sessions),1),e("div",Re,t(s(a)("usage.cost"))+": "+t(g(l.cost)),1)])]))),128))]),e("div",De,[e("span",null,t(s(n).dailyUsage[0]?.date.slice(5)),1),e("span",null,t(s(n).dailyUsage[s(n).dailyUsage.length-1]?.date.slice(5)),1)]),e("div",Fe,[e("div",Be,[o[0]||(o[0]=e("span",{class:"legend-swatch input"},null,-1)),T(t(s(a)("usage.inputTokens")),1)]),e("div",He,[o[1]||(o[1]=e("span",{class:"legend-swatch output"},null,-1)),T(t(s(a)("usage.outputTokens")),1)]),e("div",Ie,[o[2]||(o[2]=e("span",{class:"legend-swatch cache"},null,-1)),T(t(s(a)("usage.cacheRead")),1)])]),e("div",Ve,[e("table",null,[e("thead",null,[e("tr",null,[e("th",null,t(s(a)("usage.date")),1),e("th",null,t(s(a)("usage.inputTokens")),1),e("th",null,t(s(a)("usage.outputTokens")),1),e("th",null,t(s(a)("usage.cacheRead")),1),e("th",null,t(s(a)("usage.cacheWrite")),1),e("th",null,t(s(a)("usage.cacheHitRate")),1),e("th",null,t(s(a)("usage.sessions")),1),e("th",null,t(s(a)("usage.cost")),1)])]),e("tbody",null,[(p(!0),c(S,null,M([...s(n).dailyUsage].reverse(),l=>(p(),c("tr",{key:l.date},[e("td",null,t(l.date),1),e("td",null,t(d(l.input_tokens)),1),e("td",null,t(d(l.output_tokens)),1),e("td",null,t(d(l.cache_read_tokens)),1),e("td",null,t(d(l.cache_write_tokens)),1),e("td",null,t(r(l)),1),e("td",null,t(l.sessions),1),e("td",null,t(g(l.cost)),1)]))),128))])])])]))}})})),vt=y((()=>{})),et,ht=y((()=>{Le(),Le(),vt(),B(),et=H(Ze,[["__scopeId","data-v-9eb202e8"]])})),Oe,qe,Ne,ze,Ke,We,Ee,Ae,tt,je=y((()=>{C(),at(),D(),I(),it(),dt(),pt(),ht(),Oe={class:"usage-view"},qe={class:"page-header"},Ne={class:"header-title"},ze={class:"usage-toolbar"},Ke={class:"period-selector",role:"group","aria-label":"Usage statistics period"},We={class:"usage-content"},Ee={key:0,class:"usage-loading"},Ae={key:2,class:"usage-empty"},tt=R({__name:"UsageView",setup(_){const{t:a}=F(),n=P(),d=lt(),g=[{label:"7d",days:7},{label:"30d",days:30},{label:"90d",days:90},{label:"365d",days:365}],r=V(30);async function h(){(!d.activeProfileName||d.profiles.length===0)&&await d.fetchProfiles()}async function i(o=r.value){r.value=o,await h(),await n.loadSessions(o)}return st(()=>{i(30)}),(o,l)=>(p(),c("div",Oe,[e("header",qe,[e("h2",Ne,t(s(a)("usage.title")),1),e("div",ze,[e("div",Ke,[(p(),c(S,null,M(g,f=>x(s(z),{key:f.days,class:"period-option",size:"small",type:r.value===f.days?"primary":"default",secondary:r.value===f.days,quaternary:r.value!==f.days,"aria-pressed":r.value===f.days,onClick:O=>i(f.days)},{default:N(()=>[T(t(f.label),1)]),_:2},1032,["type","secondary","quaternary","aria-pressed","onClick"])),64))]),x(s(z),{class:"refresh-button",size:"small",quaternary:"",loading:s(n).isLoading,onClick:l[0]||(l[0]=f=>i())},{default:N(()=>[T(t(s(a)("usage.refresh")),1)]),_:1},8,["loading"])])]),e("div",We,[s(n).isLoading&&!s(n).hasData?(p(),c("div",Ee,t(s(a)("common.loading")),1)):s(n).hasData?(p(),c(S,{key:1},[x(Qe),x(Ye),x(et)],64)):(p(),c("div",Ae,t(s(a)("usage.noData")),1))])]))}})})),gt=y((()=>{})),kt,yt=y((()=>{je(),je(),gt(),B(),kt=H(tt,[["__scopeId","data-v-b6148568"]])}));yt();export{kt as default};
|
|
1
|
+
import{n as y}from"./rolldown-runtime-M0oDzQ_3.js";import{Hn as N,Kt as C,Nn as M,Ot as z,an as e,cn as c,cr as s,er as V,fn as T,fr as m,hn as R,in as k,jn as p,kn as st,pn as x,pr as t,sn as $,t as at,tn as S}from"./ui-vendor-DDMfmCj2.js";import{I as nt,L as ot,O as D,k as F}from"./vue-vendor-BsMpqyaC.js";import{n as B,t as H}from"./_plugin-vue_export-helper-CvnFozKy.js";import{Dt as lt,Et as it,gt as ut,vt as rt}from"./index-B2IKGvbR.js";function Ge(_){return(_||"").trim()||"unknown"}function w(_,a){return a<=0?0:_/a*100}function K(_){const a=Ge(_);let n=0;for(let d=0;d<a.length;d+=1)n=(n<<5)-n+a.charCodeAt(d),n|=0;return L[Math.abs(n)%L.length]}var L,P,I=y((()=>{rt(),ot(),C(),L=["#4fd1c5","#63b3ed","#f6ad55","#b794f4","#68d391","#fc8181","#f687b3","#90cdf4","#fbd38d","#9ae6b4"],P=nt("usage",()=>{const _=V(null),a=V(!1);let n=0;async function d(u=30){const v=++n;a.value=!0;try{const b=await ut(u);v===n&&(_.value=b)}catch(b){v===n&&console.error("Failed to load usage stats:",b)}finally{v===n&&(a.value=!1)}}const g=k(()=>!!_.value&&_.value.total_sessions>0),r=k(()=>_.value?.total_input_tokens??0),h=k(()=>_.value?.total_output_tokens??0),i=k(()=>r.value+h.value),o=k(()=>_.value?.total_sessions??0),l=k(()=>_.value?.total_cache_read_tokens??0),f=k(()=>{const u=r.value+l.value;return u===0?null:l.value/u*100}),O=k(()=>_.value?.total_cost??0),q=k(()=>_.value?_.value.model_usage.map(u=>{const v=Ge(u.model),b=u.input_tokens+u.output_tokens,U=b+u.cache_read_tokens;return{model:v,inputTokens:u.input_tokens,outputTokens:u.output_tokens,cacheTokens:u.cache_read_tokens,cacheWriteTokens:u.cache_write_tokens,totalTokens:b,visualTokens:U,sessions:u.sessions,color:K(v),inputPercent:w(u.input_tokens,U),outputPercent:w(u.output_tokens,U),cachePercent:w(u.cache_read_tokens,U)}}).sort((u,v)=>v.visualTokens-u.visualTokens):[]);return{stats:_,isLoading:a,hasData:g,loadSessions:d,totalInputTokens:r,totalOutputTokens:h,totalTokens:i,totalSessions:o,totalCacheTokens:l,cacheHitRate:f,estimatedCost:O,modelUsage:q,modelLegend:k(()=>{const u=new Set;return q.value.filter(v=>u.has(v.model)?!1:(u.add(v.model),!0)).map(v=>({model:v.model,color:v.color}))}),dailyUsage:k(()=>(_.value?.daily_usage??[]).map(u=>{const v=u.input_tokens+u.output_tokens+u.cache_read_tokens;return{...u,visualTokens:v,inputPercent:w(u.input_tokens,v),outputPercent:w(u.output_tokens,v),cachePercent:w(u.cache_read_tokens,v)}})),avgSessionsPerDay:k(()=>{if(!_.value||_.value.daily_usage.length===0)return 0;const u=_.value.daily_usage.filter(b=>b.sessions>0).length,v=Math.max(1,u);return o.value/v}),getModelColor:K}})})),W,E,A,j,G,J,Q,X,Y,Z,ee,te,se,ae,ne,oe,Je,le=y((()=>{C(),D(),I(),W={class:"stat-cards"},E={class:"stat-card"},A={class:"stat-label"},j={class:"stat-value"},G={class:"stat-sub"},J={class:"stat-card"},Q={class:"stat-label"},X={class:"stat-value"},Y={class:"stat-sub"},Z={class:"stat-card"},ee={class:"stat-label"},te={class:"stat-value"},se={class:"stat-card"},ae={class:"stat-label"},ne={class:"stat-value"},oe={key:0,class:"stat-sub"},Je=R({__name:"StatCards",setup(_){const{t:a}=F(),n=P();function d(r){return r>=1e6?(r/1e6).toFixed(1)+"M":r>=1e3?(r/1e3).toFixed(1)+"K":String(r)}function g(r){return r===0?"$0.00":r<.01?"<$0.01":"$"+r.toFixed(2)}return(r,h)=>(p(),c("div",W,[e("div",E,[e("div",A,t(s(a)("usage.totalTokens")),1),e("div",j,t(d(s(n).totalTokens)),1),e("div",G,t(d(s(n).totalInputTokens))+" "+t(s(a)("usage.inputTokens"))+" / "+t(d(s(n).totalOutputTokens))+" "+t(s(a)("usage.outputTokens")),1)]),e("div",J,[e("div",Q,t(s(a)("usage.totalSessions")),1),e("div",X,t(s(n).totalSessions),1),e("div",Y,t(s(a)("usage.avgPerDay",{n:s(n).avgSessionsPerDay.toFixed(1)})),1)]),e("div",Z,[e("div",ee,t(s(a)("usage.estimatedCost")),1),e("div",te,t(g(s(n).estimatedCost)),1)]),e("div",se,[e("div",ae,t(s(a)("usage.cacheHitRate")),1),e("div",ne,t(s(n).cacheHitRate!==null?s(n).cacheHitRate.toFixed(1)+"%":"--"),1),s(n).cacheHitRate!==null?(p(),c("div",oe,t(d(s(n).totalCacheTokens))+" "+t(s(a)("usage.tokens")),1)):$("",!0)])]))}})})),_t=y((()=>{})),Qe,dt=y((()=>{le(),le(),_t(),B(),Qe=H(Je,[["__scopeId","data-v-3a594781"]])})),ie,ue,re,_e,de,ce,pe,ve,he,ge,ke,Xe,ye=y((()=>{C(),D(),I(),ie={class:"model-breakdown"},ue={class:"section-title"},re={class:"model-legend","aria-label":"Token type legend"},_e={class:"legend-item"},de={class:"legend-item"},ce={class:"legend-item"},pe={class:"model-list"},ve=["title"],he={class:"model-bar-wrap"},ge=["title"],ke={key:0},Xe=R({__name:"ModelBreakdown",setup(_){const{t:a}=F(),n=P(),d=k(()=>Math.max(...n.modelUsage.map(h=>h.visualTokens),1));function g(h){return h>=1e6?(h/1e6).toFixed(1)+"M":h>=1e3?(h/1e3).toFixed(1)+"K":String(h)}function r(h){const i=h.inputTokens+h.cacheTokens;return i===0?"--":(h.cacheTokens/i*100).toFixed(1)+"%"}return(h,i)=>(p(),c("div",ie,[e("h3",ue,t(s(a)("usage.modelBreakdown")),1),e("div",re,[e("div",_e,[i[0]||(i[0]=e("span",{class:"legend-swatch input"},null,-1)),T(t(s(a)("usage.inputTokens")),1)]),e("div",de,[i[1]||(i[1]=e("span",{class:"legend-swatch output"},null,-1)),T(t(s(a)("usage.outputTokens")),1)]),e("div",ce,[i[2]||(i[2]=e("span",{class:"legend-swatch cache"},null,-1)),T(t(s(a)("usage.cacheRead")),1)])]),e("div",pe,[(p(!0),c(S,null,M(s(n).modelUsage,o=>(p(),c("div",{key:o.model,class:"model-row"},[e("span",{class:"model-swatch",style:m({background:o.color})},null,4),e("span",{class:"model-name",title:o.model},t(o.model),9,ve),e("div",he,[e("div",{class:"model-bar",style:m({width:o.visualTokens/d.value*100+"%"})},[o.inputTokens>0?(p(),c("div",{key:0,class:"model-bar-segment input",style:m({width:o.inputPercent+"%"})},null,4)):$("",!0),o.outputTokens>0?(p(),c("div",{key:1,class:"model-bar-segment output",style:m({width:o.outputPercent+"%"})},null,4)):$("",!0),o.cacheTokens>0?(p(),c("div",{key:2,class:"model-bar-segment cache",style:m({width:o.cachePercent+"%"})},null,4)):$("",!0)],4)]),e("span",{class:"model-tokens",title:`${s(a)("usage.inputTokens")}: ${g(o.inputTokens)} · ${s(a)("usage.outputTokens")}: ${g(o.outputTokens)} · ${s(a)("usage.cacheRead")}: ${g(o.cacheTokens)} · ${s(a)("usage.cacheHitRate")}: ${r(o)}`},[T(t(g(o.totalTokens))+" ",1),o.cacheTokens>0?(p(),c("small",ke,"+"+t(g(o.cacheTokens)),1)):$("",!0)],8,ge)]))),128))])]))}})})),ct=y((()=>{})),Ye,pt=y((()=>{ye(),ye(),ct(),B(),Ye=H(Xe,[["__scopeId","data-v-692258ec"]])})),fe,me,Te,be,$e,we,xe,Se,Ce,Pe,Ue,Me,Re,De,Fe,Be,He,Ie,Ve,Ze,Le=y((()=>{C(),D(),I(),fe={class:"daily-trend"},me={class:"section-title"},Te={class:"bar-chart"},be={class:"bar-track"},$e={class:"bar-tooltip"},we={class:"tooltip-date"},xe={class:"tooltip-row"},Se={class:"tooltip-row"},Ce={class:"tooltip-row"},Pe={class:"tooltip-row"},Ue={class:"tooltip-row"},Me={class:"tooltip-row"},Re={class:"tooltip-row"},De={class:"bar-dates"},Fe={class:"chart-legend","aria-label":"Token type legend"},Be={class:"legend-item"},He={class:"legend-item"},Ie={class:"legend-item"},Ve={class:"trend-table"},Ze=R({__name:"DailyTrend",setup(_){const{t:a}=F(),n=P();function d(i){return i>=1e6?(i/1e6).toFixed(1)+"M":i>=1e3?(i/1e3).toFixed(1)+"K":String(i)}function g(i){return i===0?"$0.00":i<.01?"<$0.01":"$"+i.toFixed(2)}function r(i){const o=i.input_tokens+i.cache_read_tokens;return o===0?"--":(i.cache_read_tokens/o*100).toFixed(1)+"%"}const h=k(()=>Math.max(...n.dailyUsage.map(i=>i.visualTokens),1));return(i,o)=>(p(),c("div",fe,[e("h3",me,t(s(a)("usage.dailyTrend")),1),e("div",Te,[(p(!0),c(S,null,M(s(n).dailyUsage,l=>(p(),c("div",{key:l.date,class:"bar-col"},[e("div",be,[e("div",{class:"bar-stack",style:m({height:l.visualTokens/h.value*100+"%"})},[l.output_tokens>0?(p(),c("div",{key:0,class:"bar-segment output",style:m({height:l.outputPercent+"%"})},null,4)):$("",!0),l.input_tokens>0?(p(),c("div",{key:1,class:"bar-segment input",style:m({height:l.inputPercent+"%"})},null,4)):$("",!0),l.cache_read_tokens>0?(p(),c("div",{key:2,class:"bar-segment cache",style:m({height:l.cachePercent+"%"})},null,4)):$("",!0)],4)]),e("div",$e,[e("div",we,t(l.date),1),e("div",xe,t(s(a)("usage.inputTokens"))+": "+t(d(l.input_tokens)),1),e("div",Se,t(s(a)("usage.outputTokens"))+": "+t(d(l.output_tokens)),1),e("div",Ce,t(s(a)("usage.cacheRead"))+": "+t(d(l.cache_read_tokens)),1),e("div",Pe,t(s(a)("usage.cacheWrite"))+": "+t(d(l.cache_write_tokens)),1),e("div",Ue,t(s(a)("usage.cacheHitRate"))+": "+t(r(l)),1),e("div",Me,t(s(a)("usage.sessions"))+": "+t(l.sessions),1),e("div",Re,t(s(a)("usage.cost"))+": "+t(g(l.cost)),1)])]))),128))]),e("div",De,[e("span",null,t(s(n).dailyUsage[0]?.date.slice(5)),1),e("span",null,t(s(n).dailyUsage[s(n).dailyUsage.length-1]?.date.slice(5)),1)]),e("div",Fe,[e("div",Be,[o[0]||(o[0]=e("span",{class:"legend-swatch input"},null,-1)),T(t(s(a)("usage.inputTokens")),1)]),e("div",He,[o[1]||(o[1]=e("span",{class:"legend-swatch output"},null,-1)),T(t(s(a)("usage.outputTokens")),1)]),e("div",Ie,[o[2]||(o[2]=e("span",{class:"legend-swatch cache"},null,-1)),T(t(s(a)("usage.cacheRead")),1)])]),e("div",Ve,[e("table",null,[e("thead",null,[e("tr",null,[e("th",null,t(s(a)("usage.date")),1),e("th",null,t(s(a)("usage.inputTokens")),1),e("th",null,t(s(a)("usage.outputTokens")),1),e("th",null,t(s(a)("usage.cacheRead")),1),e("th",null,t(s(a)("usage.cacheWrite")),1),e("th",null,t(s(a)("usage.cacheHitRate")),1),e("th",null,t(s(a)("usage.sessions")),1),e("th",null,t(s(a)("usage.cost")),1)])]),e("tbody",null,[(p(!0),c(S,null,M([...s(n).dailyUsage].reverse(),l=>(p(),c("tr",{key:l.date},[e("td",null,t(l.date),1),e("td",null,t(d(l.input_tokens)),1),e("td",null,t(d(l.output_tokens)),1),e("td",null,t(d(l.cache_read_tokens)),1),e("td",null,t(d(l.cache_write_tokens)),1),e("td",null,t(r(l)),1),e("td",null,t(l.sessions),1),e("td",null,t(g(l.cost)),1)]))),128))])])])]))}})})),vt=y((()=>{})),et,ht=y((()=>{Le(),Le(),vt(),B(),et=H(Ze,[["__scopeId","data-v-9eb202e8"]])})),Oe,qe,Ne,ze,Ke,We,Ee,Ae,tt,je=y((()=>{C(),at(),D(),I(),it(),dt(),pt(),ht(),Oe={class:"usage-view"},qe={class:"page-header"},Ne={class:"header-title"},ze={class:"usage-toolbar"},Ke={class:"period-selector",role:"group","aria-label":"Usage statistics period"},We={class:"usage-content"},Ee={key:0,class:"usage-loading"},Ae={key:2,class:"usage-empty"},tt=R({__name:"UsageView",setup(_){const{t:a}=F(),n=P(),d=lt(),g=[{label:"7d",days:7},{label:"30d",days:30},{label:"90d",days:90},{label:"365d",days:365}],r=V(30);async function h(){(!d.activeProfileName||d.profiles.length===0)&&await d.fetchProfiles()}async function i(o=r.value){r.value=o,await h(),await n.loadSessions(o)}return st(()=>{i(30)}),(o,l)=>(p(),c("div",Oe,[e("header",qe,[e("h2",Ne,t(s(a)("usage.title")),1),e("div",ze,[e("div",Ke,[(p(),c(S,null,M(g,f=>x(s(z),{key:f.days,class:"period-option",size:"small",type:r.value===f.days?"primary":"default",secondary:r.value===f.days,quaternary:r.value!==f.days,"aria-pressed":r.value===f.days,onClick:O=>i(f.days)},{default:N(()=>[T(t(f.label),1)]),_:2},1032,["type","secondary","quaternary","aria-pressed","onClick"])),64))]),x(s(z),{class:"refresh-button",size:"small",quaternary:"",loading:s(n).isLoading,onClick:l[0]||(l[0]=f=>i())},{default:N(()=>[T(t(s(a)("usage.refresh")),1)]),_:1},8,["loading"])])]),e("div",We,[s(n).isLoading&&!s(n).hasData?(p(),c("div",Ee,t(s(a)("common.loading")),1)):s(n).hasData?(p(),c(S,{key:1},[x(Qe),x(Ye),x(et)],64)):(p(),c("div",Ae,t(s(a)("usage.noData")),1))])]))}})})),gt=y((()=>{})),kt,yt=y((()=>{je(),je(),gt(),B(),kt=H(tt,[["__scopeId","data-v-b6148568"]])}));yt();export{kt as default};
|
package/dist/client/assets/js/{VersionPreviewView-JQrieRPU.js → VersionPreviewView-qbXwqYd3.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as f}from"./rolldown-runtime-M0oDzQ_3.js";import{An as ke,Bn as M,Bt as C,Hn as n,Kt as ee,M as xe,Ot as b,Q as Te,Rt as Be,V as Ce,X as d,an as r,cn as ae,cr as e,er as g,fn as v,hn as te,in as P,jn as I,kn as Ie,mt as Ne,on as Oe,pn as l,pr as s,sn as Le,t as De}from"./ui-vendor-DDMfmCj2.js";import{O as ie,k as se}from"./vue-vendor-BsMpqyaC.js";import{n as le,t as ne}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{n as f}from"./rolldown-runtime-M0oDzQ_3.js";import{An as ke,Bn as M,Bt as C,Hn as n,Kt as ee,M as xe,Ot as b,Q as Te,Rt as Be,V as Ce,X as d,an as r,cn as ae,cr as e,er as g,fn as v,hn as te,in as P,jn as I,kn as Ie,mt as Ne,on as Oe,pn as l,pr as s,sn as Le,t as De}from"./ui-vendor-DDMfmCj2.js";import{O as ie,k as se}from"./vue-vendor-BsMpqyaC.js";import{n as le,t as ne}from"./_plugin-vue_export-helper-CvnFozKy.js";import{d as Ge,g as Me,h as $e,l as je,o as ze,s as Ae,u as Re}from"./system-Onp4yS9N.js";var $,j,z,A,R,E,H,K,q,F,J,ue,U=f((()=>{ee(),De(),ie(),je(),$={class:"github-preview-settings"},j={class:"settings-section"},z={class:"control-row"},A={class:"section-description"},R=["href"],E={class:"log-output"},H={class:"log-output-header"},K={class:"log-box"},q={class:"log-title"},F={class:"log-box"},J={class:"log-title"},ue=te({__name:"GithubPreviewSettings",setup(ce){const{t:a}=se(),p=Ce(),m=g(!1),y=g(!1),S=g(""),V=g([]),_=g(""),t=g(null),k=g(""),N=g(!1);let h=null;const _e=P(()=>V.value.map(i=>({label:i.name,value:i.name}))),ve=P(()=>t.value?.action_log||""),de=P(()=>t.value?.dev_log||""),w=P(()=>S.value||t.value?.active_action||""),x=P(()=>!!w.value),ge={prepare:"githubPreview.prepareSuccess",install:"githubPreview.installSuccess",start:"githubPreview.startSuccess",stop:"githubPreview.stopSuccess"};function pe(i){const o=String(i?.message||""),c=o.indexOf("{");if(!(c<0))try{const u=JSON.parse(o.slice(c));u&&typeof u=="object"&&"preview_dir"in u&&(t.value=u)}catch{}}function B(i,o){return i==="node_environment_missing"?a("githubPreview.nodeEnvironmentMissing"):o||a("githubPreview.actionFailed")}function fe(i){const o=String(i?.message||""),c=o.indexOf("{");if(c<0)return null;try{const u=JSON.parse(o.slice(c));return u&&typeof u=="object"?u:null}catch{return null}}async function O(){t.value=await ze(),!_.value&&t.value.current_tag&&(_.value=t.value.current_tag)}async function he(){y.value=!0;try{V.value=(await Ae()).tags,!_.value&&V.value[0]&&(_.value=V.value[0].name)}finally{y.value=!1}}async function L(){m.value=!0;try{await Promise.all([O(),he()])}finally{m.value=!1}}async function T(i,o,c){S.value=i;try{const u=await o();if(t.value=u,u.success===!1){p.warning(B(u.code,u.message));return}!u.accepted&&!u.active_action&&p.success(a(c))}catch(u){pe(u);const G=fe(u);p.error(B(G?.code,G?.message||u?.message))}finally{S.value=""}}async function we(){try{await O()}catch{}}function be(){h||(h=window.setInterval(()=>{we()},2e3))}function D(){h&&(window.clearInterval(h),h=null)}function Pe(){return _.value?_.value:(p.warning(a("githubPreview.selectTag")),null)}async function me(){const i=Pe();i&&await T("prepare",()=>Ge(i),"githubPreview.prepareSuccess")}async function ye(){await T("install",async()=>{const i=await Re();return i.success!==!1&&!i.accepted&&!i.active_action&&!i.installed?{...i,success:!1,message:i.message||a("githubPreview.actionFailed")}:i},"githubPreview.installSuccess")}async function Se(){await T("start",()=>$e(_.value||void 0),"githubPreview.startSuccess")}async function Ve(){await T("stop",Me,"githubPreview.stopSuccess")}return Ie(async()=>{await L(),k.value=t.value?.last_action_completed_at||"",N.value=!0}),ke(()=>{D()}),M(()=>t.value?.active_action||"",i=>{i?be():D()}),M(()=>t.value?.last_action_completed_at||"",i=>{if(!i)return;if(!N.value){k.value=i;return}if(i===k.value||S.value)return;k.value=i;const o=t.value?.last_action||"";if(t.value?.last_action_success===!1){p.error(B(t.value.last_action_code,t.value.last_action_message));return}const c=ge[o];c&&p.success(a(c))}),(i,o)=>(I(),ae("div",$,[r("div",j,[r("div",z,[l(e(Ne),{value:_.value,"onUpdate:value":o[0]||(o[0]=c=>_.value=c),class:"tag-select",filterable:"",loading:y.value,options:_e.value,placeholder:e(a)("githubPreview.selectTag")},null,8,["value","loading","options","placeholder"]),l(e(xe),null,{default:n(()=>[l(e(b),{type:"primary",loading:w.value==="prepare",disabled:x.value||!_.value,onClick:me},{default:n(()=>[v(s(e(a)("githubPreview.prepare")),1)]),_:1},8,["loading","disabled"]),l(e(b),{loading:w.value==="install",disabled:x.value||!t.value?.has_package,onClick:ye},{default:n(()=>[v(s(e(a)("githubPreview.install")),1)]),_:1},8,["loading","disabled"]),l(e(b),{type:"success",loading:w.value==="start",disabled:x.value||!t.value?.installed,onClick:Se},{default:n(()=>[v(s(e(a)("githubPreview.start")),1)]),_:1},8,["loading","disabled"]),l(e(b),{loading:w.value==="stop",disabled:x.value||!t.value?.running,onClick:Ve},{default:n(()=>[v(s(e(a)("githubPreview.stop")),1)]),_:1},8,["loading","disabled"]),l(e(b),{loading:m.value||y.value,onClick:L},{default:n(()=>[v(s(e(a)("githubPreview.refresh")),1)]),_:1},8,["loading"])]),_:1})]),r("p",A,s(e(a)("githubPreview.description")),1),l(e(Be),{type:"info",bordered:!1,class:"preview-note"},{default:n(()=>[v(s(e(a)("githubPreview.note")),1)]),_:1}),t.value?(I(),Oe(e(Te),{key:0,column:1,bordered:"",size:"small",class:"status-table"},{default:n(()=>[l(e(d),{label:e(a)("githubPreview.path")},{default:n(()=>[r("code",null,s(t.value.preview_dir),1)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.webuiHome")},{default:n(()=>[r("code",null,s(t.value.webui_home),1)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.currentTag")},{default:n(()=>[v(s(t.value.current_tag||"-"),1)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.repoReady")},{default:n(()=>[l(e(C),{size:"small",type:t.value.has_package?"success":"default"},{default:n(()=>[v(s(t.value.has_package?e(a)("githubPreview.yes"):e(a)("githubPreview.no")),1)]),_:1},8,["type"])]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.dependencies")},{default:n(()=>[l(e(C),{size:"small",type:t.value.installed?"success":"warning"},{default:n(()=>[v(s(t.value.installed?e(a)("githubPreview.yes"):e(a)("githubPreview.no")),1)]),_:1},8,["type"])]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.running")},{default:n(()=>[l(e(C),{size:"small",type:t.value.running?"success":"default"},{default:n(()=>[v(s(t.value.running?`PID ${t.value.pid}`:e(a)("githubPreview.notRunning")),1)]),_:1},8,["type"])]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.open")},{default:n(()=>[r("a",{href:t.value.frontend_url,target:"_blank",rel:"noopener noreferrer"},s(t.value.frontend_url),9,R)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.log")},{default:n(()=>[r("code",null,s(t.value.action_log_path),1)]),_:1},8,["label"]),l(e(d),{label:e(a)("githubPreview.devLog")},{default:n(()=>[r("code",null,s(t.value.dev_log_path),1)]),_:1},8,["label"])]),_:1})):Le("",!0),r("div",E,[r("div",H,s(e(a)("githubPreview.logOutput")),1),r("div",K,[r("div",q,s(e(a)("githubPreview.actionLog")),1),r("pre",null,s(ve.value||"-"),1)]),r("div",F,[r("div",J,s(e(a)("githubPreview.devLog")),1),r("pre",null,s(de.value||"-"),1)])])])]))}})})),Ee=f((()=>{})),re,He=f((()=>{U(),U(),Ee(),le(),re=ne(ue,[["__scopeId","data-v-721cf76a"]])})),Q,X,Z,W,oe,Y=f((()=>{ee(),ie(),He(),Q={class:"version-preview-view"},X={class:"page-header"},Z={class:"header-title"},W={class:"page-content"},oe=te({__name:"VersionPreviewView",setup(ce){const{t:a}=se();return(p,m)=>(I(),ae("div",Q,[r("header",X,[r("h2",Z,s(e(a)("githubPreview.title")),1)]),r("div",W,[l(re)])]))}})})),Ke=f((()=>{})),qe,Fe=f((()=>{Y(),Y(),Ke(),le(),qe=ne(oe,[["__scopeId","data-v-1447333d"]])}));Fe();export{qe as default};
|