hermium 0.3.3 → 0.3.5
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/public/assets/js/ChatInputBlock-DtDwhu-o.js +1 -0
- package/dist/public/assets/js/MarkdownMessage-HqtkizAq.js +1 -0
- package/dist/public/assets/js/chat._sessionId-CQhAWRie.js +1 -0
- package/dist/public/assets/js/chat.index-Rey-yJNu.js +1 -0
- package/dist/public/assets/js/index-DaPM5Pp6.js +1 -0
- package/dist/public/assets/js/index-lcPGeFiu.js +60 -0
- package/dist/public/assets/js/memory-hKlWOmsk.js +3 -0
- package/dist/public/assets/js/settings-CgEeK7SY.js +1 -0
- package/dist/public/assets/js/skills-Os0vuATW.js +1 -0
- package/dist/public/assets/js/usage-Bkxk-UWX.js +1 -0
- package/dist/server/_ssr/{ChatInputBlock-BTSt3ldw.mjs → ChatInputBlock-Dax0BiWA.mjs} +1 -1
- package/dist/server/_ssr/{MarkdownMessage-DzImLKnw.mjs → MarkdownMessage-Cwh9eBP2.mjs} +1 -1
- package/dist/server/_ssr/{chat._sessionId-CUSsvbBX.mjs → chat._sessionId-CI4x2myS.mjs} +4 -4
- package/dist/server/_ssr/{chat.index-YqIyLr2b.mjs → chat.index-CkW4HXDE.mjs} +1 -1
- package/dist/server/_ssr/{index-Be17Jodh.mjs → index-CZIkem83.mjs} +2 -2
- package/dist/server/_ssr/{index--T6rScER.mjs → index-Cnfau46H.mjs} +2 -2
- package/dist/server/_ssr/{memory-DLVdk8UN.mjs → memory-DNXYkaz6.mjs} +3 -3
- package/dist/server/_ssr/{router-C0m-TE_e.mjs → router-BHawbDFJ.mjs} +39 -20
- package/dist/server/_ssr/{skills-DAVualEA.mjs → skills-De5OAjih.mjs} +5 -34
- package/dist/server/_ssr/{usage-CCOujow3.mjs → usage-CDQOB3tW.mjs} +1 -1
- package/dist/server/_tanstack-start-manifest_v-CZgpkRLi.mjs +4 -0
- package/dist/server/index.mjs +103 -117
- package/dist/server/public/assets/js/ChatInputBlock-DtDwhu-o.js +1 -0
- package/dist/server/public/assets/js/MarkdownMessage-HqtkizAq.js +1 -0
- package/dist/server/public/assets/js/chat._sessionId-CQhAWRie.js +1 -0
- package/dist/server/public/assets/js/chat.index-Rey-yJNu.js +1 -0
- package/dist/server/public/assets/js/index-DaPM5Pp6.js +1 -0
- package/dist/server/public/assets/js/index-lcPGeFiu.js +60 -0
- package/dist/server/public/assets/js/memory-hKlWOmsk.js +3 -0
- package/dist/server/public/assets/js/settings-CgEeK7SY.js +1 -0
- package/dist/server/public/assets/js/skills-Os0vuATW.js +1 -0
- package/dist/server/public/assets/js/usage-Bkxk-UWX.js +1 -0
- package/package.json +1 -1
- package/dist/public/assets/js/ChatInputBlock-D4CYR2D_.js +0 -1
- package/dist/public/assets/js/MarkdownMessage-Bu4diQAT.js +0 -1
- package/dist/public/assets/js/base-ui-DKZpRETY.js +0 -1
- package/dist/public/assets/js/chat._sessionId-IyYhnI65.js +0 -1
- package/dist/public/assets/js/chat.index-CdO1bi1g.js +0 -1
- package/dist/public/assets/js/index-CGq67I5U.js +0 -60
- package/dist/public/assets/js/index-CYDXRqze.js +0 -1
- package/dist/public/assets/js/memory-BC-tVM26.js +0 -3
- package/dist/public/assets/js/router-Cdi9aGOg.js +0 -1
- package/dist/public/assets/js/settings-CthZPCPZ.js +0 -1
- package/dist/public/assets/js/skills-COr12qk7.js +0 -1
- package/dist/public/assets/js/usage-oWmLZ5Lt.js +0 -1
- package/dist/server/_tanstack-start-manifest_v-wG3l04YA.mjs +0 -4
- package/dist/server/public/assets/js/ChatInputBlock-D4CYR2D_.js +0 -1
- package/dist/server/public/assets/js/MarkdownMessage-Bu4diQAT.js +0 -1
- package/dist/server/public/assets/js/base-ui-DKZpRETY.js +0 -1
- package/dist/server/public/assets/js/chat._sessionId-IyYhnI65.js +0 -1
- package/dist/server/public/assets/js/chat.index-CdO1bi1g.js +0 -1
- package/dist/server/public/assets/js/index-CGq67I5U.js +0 -60
- package/dist/server/public/assets/js/index-CYDXRqze.js +0 -1
- package/dist/server/public/assets/js/memory-BC-tVM26.js +0 -3
- package/dist/server/public/assets/js/router-Cdi9aGOg.js +0 -1
- package/dist/server/public/assets/js/settings-CthZPCPZ.js +0 -1
- package/dist/server/public/assets/js/skills-COr12qk7.js +0 -1
- package/dist/server/public/assets/js/usage-oWmLZ5Lt.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{am as e}from"./index-CGq67I5U.js";import{d as a}from"./router-Cdi9aGOg.js";import{C as n}from"./ChatInputBlock-D4CYR2D_.js";import"./base-ui-DKZpRETY.js";function x(){const t=a();return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-4",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 w-full max-w-2xl mx-auto",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-semibold tracking-tight text-foreground text-center",children:"What can I help you with?"}),e.jsx("div",{className:"w-full",children:e.jsx(n,{onCreateSession:s=>{t({to:"/chat/$sessionId",params:{sessionId:s}})}})})]})})}export{x as component};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{aw as y,ar as r,aF as w,am as e,j as g,S as z,D as k,d as j,b as u,p as C,l as I,s as M,r as E}from"./index-CGq67I5U.js";import{M as A}from"./MarkdownMessage-Bu4diQAT.js";import"./base-ui-DKZpRETY.js";import"./router-Cdi9aGOg.js";async function D(){return y("/api/hermes/memory")}async function F(s,o){await y("/api/hermes/memory",{method:"POST",body:JSON.stringify({section:s,content:o})})}const L={memory:{title:"My Notes",icon:e.jsx(E,{className:"size-4"}),empty:"No notes yet. Write down things you want the AI to remember.",placeholder:"Write anything you want the AI to remember about this conversation, context, or preferences..."},user:{title:"User Profile",icon:e.jsx(M,{className:"size-4"}),empty:"No user profile. Add details about yourself.",placeholder:"Describe yourself — your role, expertise, preferences, communication style..."},soul:{title:"Soul",icon:e.jsx(j,{className:"size-4"}),empty:"No soul defined. Set the AI's personality and behavior.",placeholder:"Define the AI's personality, tone, expertise, and how it should behave..."}};function P(s){if(!s)return"";try{return new Date(s).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return""}}function p({section:s,data:o,onSave:f}){const[l,i]=r.useState(!1),[c,m]=r.useState(""),[d,n]=r.useState(!1),a=L[s],t=o[s],x=o[`${s}_mtime`],N=!t.trim(),v=()=>{m(t),i(!0)},b=()=>{i(!1),m("")},S=async()=>{n(!0);try{await f(s,c),i(!1)}catch(h){console.error("Failed to save memory:",h)}finally{n(!1)}};return e.jsxs("div",{className:"flex flex-col border rounded-lg overflow-hidden h-full min-h-0",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5 bg-muted/50 border-b shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:a.icon}),e.jsx("span",{className:"text-sm font-medium",children:a.title}),x?e.jsx("span",{className:"text-[10px] text-muted-foreground/60 ml-1",children:P(x)}):null]}),l?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(u,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:b,disabled:d,children:"Cancel"}),e.jsx(u,{size:"sm",className:"h-7 px-3 text-xs",onClick:S,disabled:d,children:d?e.jsx(g,{className:"size-3 animate-spin"}):"Save"})]}):e.jsxs(u,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:v,children:[e.jsx(I,{className:"size-3 mr-1"}),"Edit"]})]}),l?e.jsx("textarea",{value:c,onChange:h=>m(h.target.value),placeholder:a.placeholder,spellCheck:!1,className:"flex-1 min-h-0 w-full resize-none border-0 bg-transparent px-3 py-3 text-sm leading-relaxed outline-none focus-visible:ring-0 font-mono"}):e.jsx("div",{className:"flex-1 overflow-y-auto p-3 min-h-0",children:N?e.jsx("p",{className:"text-sm text-muted-foreground italic",children:a.empty}):e.jsx(A,{content:t.replace(/§/g,`
|
|
2
|
-
|
|
3
|
-
`)})})]})}function U(){const[s,o]=r.useState(null),[f,l]=r.useState(!0),[i,c]=r.useState(!1),{state:m}=w(),d=m==="collapsed",n=r.useCallback(async()=>{try{const t=await D();o(t)}catch(t){console.error("Failed to load memory:",t)}},[]);r.useEffect(()=>{l(!0),n().finally(()=>l(!1))},[n]);const a=async(t,x)=>{await F(t,x),await n()};return f?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(g,{className:"size-4 animate-spin"}),"Loading memory…"]})}):s?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("header",{className:"flex items-center justify-between border-b px-4 py-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[d&&e.jsx(z,{className:k("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsx(j,{className:"size-5 text-muted-foreground"}),e.jsx("h2",{className:"text-sm font-medium",children:"Memory"})]}),e.jsxs(u,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{c(!0),n().finally(()=>c(!1))},disabled:i,children:[i?e.jsx(g,{className:"size-3 animate-spin"}):e.jsx(C,{className:"size-3"}),"Refresh"]})]}),e.jsx("div",{className:"flex-1 min-h-0 p-4 overflow-hidden",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 h-full min-h-0",children:[e.jsx(p,{section:"memory",data:s,onSave:a}),e.jsx(p,{section:"user",data:s,onSave:a}),e.jsx(p,{section:"soul",data:s,onSave:a})]})})]}):e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load memory."})})}export{U as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ar as c,am as i,J as ze,T as q,R as O,aG as g,a8 as k,av as we,a9 as xe,N as Je,au as Re,H as b,Q as Ce,ap as $e,aq as Ge,B as Ve,a as Qe,ae as Ye,ag as J,a1 as Ze,ay as ie,aj as Xe,F as et,ai as tt,Z as z,aC as Ie,A as Le,a5 as rt,E as Pe,y as nt,a6 as ot,K as st,ac as at,W as be,ax as it}from"./index-CGq67I5U.js";var $=c.use,H=typeof window<"u"?c.useLayoutEffect:c.useEffect;function se(e){const t=c.useRef({value:e,prev:null}),r=t.current.value;return e!==r&&(t.current={value:e,prev:r}),t.current.prev}function ct(e,t,r={},n={}){c.useEffect(()=>{if(!e.current||n.disabled||typeof IntersectionObserver!="function")return;const a=new IntersectionObserver(([o])=>{t(o)},r);return a.observe(e.current),()=>{a.disconnect()}},[t,r,n.disabled,e])}function ut(e){const t=c.useRef(null);return c.useImperativeHandle(e,()=>t.current,[]),t}function lt({promise:e}){if($)return $(e);const t=ze(e);if(t[q].status==="pending")throw t;if(t[q].status==="error")throw t[q].error;return t[q].data}function rr(e){const t=i.jsx(dt,{...e});return e.fallback?i.jsx(c.Suspense,{fallback:e.fallback,children:t}):t}function dt(e){const t=lt(e);return e.children(t)}function ce(e){const t=e.errorComponent??ue;return i.jsx(ft,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:r,reset:n})=>r?c.createElement(t,{error:r,reset:n}):e.children})}var ft=class extends c.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const r=e.getResetKey();return t.error&&t.resetKey!==r?{resetKey:r,error:null}:{resetKey:r}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function ue({error:e}){const[t,r]=c.useState(!1);return i.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[i.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),i.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>r(n=>!n),children:t?"Hide Error":"Show Error"})]}),i.jsx("div",{style:{height:".25rem"}}),t?i.jsx("div",{children:i.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?i.jsx("code",{children:e.message}):null})}):null]})}function ht({children:e,fallback:t=null}){return le()?i.jsx(O.Fragment,{children:e}):i.jsx(O.Fragment,{children:t})}function le(){return O.useSyncExternalStore(pt,()=>!0,()=>!1)}function pt(){return()=>{}}var _e=c.createContext(null);function S(e){return c.useContext(_e)}var G=c.createContext(void 0),mt=c.createContext(void 0),gt={get:()=>{},subscribe:()=>({unsubscribe:()=>{}})};function _(e){const t=S(),r=c.useContext(e.from?mt:G),n=e.from??r,a=n?e.from?t.stores.getRouteMatchStore(n):t.stores.matchStores.get(n):void 0,o=c.useRef(void 0);return g(a??gt,s=>{if((e.shouldThrow??!0)&&!s&&k(),s===void 0)return;const u=e.select?e.select(s):s;if(e.structuralSharing??t.options.defaultStructuralSharing){const h=we(o.current,u);return o.current=h,h}return u})}function Te(e){return _({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Me(e){const{select:t,...r}=e;return _({...r,select:n=>t?t(n.loaderDeps):n.loaderDeps})}function Ee(e){return _({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const r=e.strict===!1?t.params:t._strictParams;return e.select?e.select(r):r}})}function ke(e){return _({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ae(e){const t=S();return c.useCallback(r=>t.navigate({...r,from:r.from??e?.from}),[e?.from,t])}function Be(e){return _({...e,select:t=>e.select?e.select(t.context):t.context})}function yt(e,t){const r=S(),n=ut(t),{activeProps:a,inactiveProps:o,activeOptions:s,to:u,preload:h,preloadDelay:l,preloadIntentProximity:d,hashScrollIntoView:f,replace:y,startTransition:p,resetScroll:v,viewTransition:I,children:P,target:A,disabled:C,style:W,className:V,onClick:Q,onBlur:Y,onFocus:Z,onMouseEnter:X,onMouseLeave:ee,onTouchStart:te,ignoreBlocker:Oe,params:Jt,search:$t,hash:Gt,state:Vt,mask:Qt,reloadDocument:Yt,unsafeRelative:Zt,from:Xt,_fromLocation:er,...de}=e,re=le(),B=c.useMemo(()=>e,[r,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),j=g(r.stores.location,m=>m,(m,R)=>m.href===R.href),x=c.useMemo(()=>{const m={_fromLocation:j,...B};return r.buildLocation(m)},[r,j,B]),fe=x.maskedLocation?x.maskedLocation.publicHref:x.publicHref,he=x.maskedLocation?x.maskedLocation.external:x.external,F=c.useMemo(()=>It(fe,he,r.history,C),[C,he,fe,r.history]),D=c.useMemo(()=>{if(F?.external)return xe(F.href,r.protocolAllowlist)?void 0:F.href;if(!Pt(u)&&!(typeof u!="string"||u.indexOf(":")===-1))try{return new URL(u),xe(u,r.protocolAllowlist)?void 0:u}catch{}},[u,F,r.protocolAllowlist]),ne=c.useMemo(()=>{if(D)return!1;if(s?.exact){if(!Je(j.pathname,x.pathname,r.basepath))return!1}else{const m=Re(j.pathname,r.basepath),R=Re(x.pathname,r.basepath);if(!(m.startsWith(R)&&(m.length===R.length||m[R.length]==="/")))return!1}return(s?.includeSearch??!0)&&!b(j.search,x.search,{partial:!s?.exact,ignoreUndefined:!s?.explicitUndefined})?!1:s?.includeHash?re&&j.hash===x.hash:!0},[s?.exact,s?.explicitUndefined,s?.includeHash,s?.includeSearch,j,D,re,x.hash,x.pathname,x.search,r.basepath]),K=ne?Ce(a,{})??vt:ae,U=ne?ae:Ce(o,{})??ae,pe=[V,K.className,U.className].filter(Boolean).join(" "),me=(W||K.style||U.style)&&{...W,...K.style,...U.style},[We,ge]=c.useState(!1),ye=c.useRef(!1),T=e.reloadDocument||D?!1:h??r.options.defaultPreload,oe=l??r.options.defaultPreloadDelay??0,w=c.useCallback(()=>{r.preloadRoute({...B,_builtLocation:x}).catch(m=>{console.warn(m),console.warn($e)})},[r,B,x]);ct(n,c.useCallback(m=>{m?.isIntersecting&&w()},[w]),Ct,{disabled:!!C||T!=="viewport"}),c.useEffect(()=>{ye.current||!C&&T==="render"&&(w(),ye.current=!0)},[C,w,T]);const Ke=m=>{const R=m.currentTarget.getAttribute("target"),L=A!==void 0?A:R;if(!C&&!bt(m)&&!m.defaultPrevented&&(!L||L==="_self")&&m.button===0){m.preventDefault(),Ge.flushSync(()=>{ge(!0)});const qe=r.subscribe("onResolved",()=>{qe(),ge(!1)});r.navigate({...B,replace:y,resetScroll:v,hashScrollIntoView:f,startTransition:p,viewTransition:I,ignoreBlocker:Oe})}};if(D)return{...de,ref:n,href:D,...P&&{children:P},...A&&{target:A},...C&&{disabled:C},...W&&{style:W},...V&&{className:V},...Q&&{onClick:Q},...Y&&{onBlur:Y},...Z&&{onFocus:Z},...X&&{onMouseEnter:X},...ee&&{onMouseLeave:ee},...te&&{onTouchStart:te}};const ve=m=>{if(C||T!=="intent")return;if(!oe){w();return}const R=m.currentTarget;if(N.has(R))return;const L=setTimeout(()=>{N.delete(R),w()},oe);N.set(R,L)},Ue=m=>{C||T!=="intent"||w()},Se=m=>{if(C||!T||!oe)return;const R=m.currentTarget,L=N.get(R);L&&(clearTimeout(L),N.delete(R))};return{...de,...K,...U,href:F?.href,ref:n,onClick:M([Q,Ke]),onBlur:M([Y,Se]),onFocus:M([Z,ve]),onMouseEnter:M([X,ve]),onMouseLeave:M([ee,Se]),onTouchStart:M([te,Ue]),disabled:!!C,target:A,...me&&{style:me},...pe&&{className:pe},...C&&St,...ne&&xt,...re&&We&&Rt}}var ae={},vt={className:"active"},St={role:"link","aria-disabled":!0},xt={"data-status":"active","aria-current":"page"},Rt={"data-transitioning":"transitioning"},N=new WeakMap,Ct={rootMargin:"100px"},M=e=>t=>{for(const r of e)if(r){if(t.defaultPrevented)return;r(t)}};function It(e,t,r,n){if(!n)return t?{href:e,external:!0}:{href:r.createHref(e)||"/",external:!1}}function Pt(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Fe=c.forwardRef((e,t)=>{const{_asChild:r,...n}=e,{type:a,...o}=yt(n,t),s=typeof n.children=="function"?n.children({isActive:o["data-status"]==="active"}):n.children;if(!r){const{disabled:u,...h}=o;return c.createElement("a",h,s)}return c.createElement(r,o,s)});function bt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var jt=class extends Qe{constructor(e){super(e),this.useMatch=t=>_({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Be({...t,from:this.id}),this.useSearch=t=>ke({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Ee({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Me({...t,from:this.id}),this.useLoaderData=t=>Te({...t,from:this.id}),this.useNavigate=()=>Ae({from:this.fullPath}),this.Link=O.forwardRef((t,r)=>i.jsx(Fe,{ref:r,from:this.fullPath,...t}))}};function wt(e){return new jt(e)}var Lt=class extends Ve{constructor(e){super(e),this.useMatch=t=>_({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Be({...t,from:this.id}),this.useSearch=t=>ke({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Ee({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Me({...t,from:this.id}),this.useLoaderData=t=>Te({...t,from:this.id}),this.useNavigate=()=>Ae({from:this.fullPath}),this.Link=O.forwardRef((t,r)=>i.jsx(Fe,{ref:r,from:this.fullPath,...t}))}};function nr(e){return new Lt(e)}function or(e){return new _t(e,{silent:!0}).createRoute}var _t=class{constructor(e,t){this.path=e,this.createRoute=r=>{const n=wt(r);return n.isRoot=!1,n},this.silent=t?.silent}};function sr(e,t){let r,n,a,o;const s=()=>(r||(r=e().then(h=>{r=void 0,n=h[t]}).catch(h=>{if(a=h,Ye(a)&&a instanceof Error&&typeof window<"u"&&typeof sessionStorage<"u"){const l=`tanstack_router_reload:${a.message}`;sessionStorage.getItem(l)||(sessionStorage.setItem(l,"1"),o=!0)}})),r),u=function(l){if(o)throw window.location.reload(),new Promise(()=>{});if(a)throw a;if(!n)if($)$(s());else throw s();return c.createElement(n,l)};return u.preload=s,u}function Tt(e){const t=S(),r=`not-found-${g(t.stores.location,n=>n.pathname)}-${g(t.stores.status,n=>n)}`;return i.jsx(ce,{getResetKey:()=>r,onCatch:(n,a)=>{if(J(n))e.onCatch?.(n,a);else throw n},errorComponent:({error:n})=>{if(J(n))return e.fallback?.(n);throw n},children:e.children})}function Mt(){return i.jsx("p",{children:"Not Found"})}function E(e){return i.jsx(i.Fragment,{children:e.children})}function De(e,t,r){return t.options.notFoundComponent?i.jsx(t.options.notFoundComponent,{...r}):e.options.defaultNotFoundComponent?i.jsx(e.options.defaultNotFoundComponent,{...r}):i.jsx(Mt,{})}function Et(){return Ze(S()),null}var Ne=c.memo(function({matchId:t}){const r=S(),n=r.stores.matchStores.get(t);n||k();const a=g(r.stores.loadedAt,s=>s),o=g(n,s=>s);return i.jsx(kt,{router:r,matchId:t,resetKey:a,matchState:c.useMemo(()=>{const s=o.routeId,u=r.routesById[s].parentRoute?.id;return{routeId:s,ssr:o.ssr,_displayPending:o._displayPending,parentRouteId:u}},[o._displayPending,o.routeId,o.ssr,r.routesById])})});function kt({router:e,matchId:t,resetKey:r,matchState:n}){const a=e.routesById[n.routeId],o=a.options.pendingComponent??e.options.defaultPendingComponent,s=o?i.jsx(o,{}):null,u=a.options.errorComponent??e.options.defaultErrorComponent,h=a.options.onCatch??e.options.defaultOnCatch,l=a.isRoot?a.options.notFoundComponent??e.options.notFoundRoute?.options.component:a.options.notFoundComponent,d=n.ssr===!1||n.ssr==="data-only",f=(!a.isRoot||a.options.wrapInSuspense||d)&&(a.options.wrapInSuspense??o??(a.options.errorComponent?.preload||d))?c.Suspense:E,y=u?ce:E,p=l?Tt:E;return i.jsxs(a.isRoot?a.options.shellComponent??E:E,{children:[i.jsx(G.Provider,{value:t,children:i.jsx(f,{fallback:s,children:i.jsx(y,{getResetKey:()=>r,errorComponent:u||ue,onCatch:(v,I)=>{if(J(v))throw v.routeId??=n.routeId,v;h?.(v,I)},children:i.jsx(p,{fallback:v=>{if(v.routeId??=n.routeId,!l||v.routeId&&v.routeId!==n.routeId||!v.routeId&&!a.isRoot)throw v;return c.createElement(l,v)},children:d||n._displayPending?i.jsx(ht,{fallback:s,children:i.jsx(je,{matchId:t})}):i.jsx(je,{matchId:t})})})})}),n.parentRouteId===ie?i.jsxs(i.Fragment,{children:[i.jsx(At,{resetKey:r}),e.options.scrollRestoration&&Xe?i.jsx(Et,{}):null]}):null]})}function At({resetKey:e}){const t=S(),r=c.useRef(void 0);return H(()=>{const n=t.latestLocation.href;(r.current===void 0||r.current!==n)&&(t.emit({type:"onRendered",...z(t.stores.location.get(),t.stores.resolvedLocation.get())}),r.current=n)},[t.latestLocation.state.__TSR_key,e,t]),null}var je=c.memo(function({matchId:t}){const r=S(),n=(d,f)=>r.getMatch(d.id)?._nonReactive[f]??d._nonReactive[f],a=r.stores.matchStores.get(t);a||k();const o=g(a,d=>d),s=o.routeId,u=r.routesById[s],h=c.useMemo(()=>{const d=(r.routesById[s].options.remountDeps??r.options.defaultRemountDeps)?.({routeId:s,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return d?JSON.stringify(d):void 0},[s,o.loaderDeps,o._strictParams,o._strictSearch,r.options.defaultRemountDeps,r.routesById]),l=c.useMemo(()=>{const d=u.options.component??r.options.defaultComponent;return d?i.jsx(d,{},h):i.jsx(Bt,{})},[h,u.options.component,r.options.defaultComponent]);if(o._displayPending)throw n(o,"displayPendingPromise");if(o._forcePending)throw n(o,"minPendingPromise");if(o.status==="pending"){const d=u.options.pendingMinMs??r.options.defaultPendingMinMs;if(d){const f=r.getMatch(o.id);if(f&&!f._nonReactive.minPendingPromise){const y=et();f._nonReactive.minPendingPromise=y,setTimeout(()=>{y.resolve(),f._nonReactive.minPendingPromise=void 0},d)}}throw n(o,"loadPromise")}if(o.status==="notFound")return J(o.error)||k(),De(r,u,o.error);if(o.status==="redirected")throw tt(o.error)||k(),n(o,"loadPromise");if(o.status==="error")throw o.error;return l}),Bt=c.memo(function(){const t=S(),r=c.useContext(G);let n,a=!1,o;{const l=r?t.stores.matchStores.get(r):void 0;[n,a]=g(l,d=>[d?.routeId,d?.globalNotFound??!1]),o=g(t.stores.matchesId,d=>d[d.findIndex(f=>f===r)+1])}const s=n?t.routesById[n]:void 0,u=t.options.defaultPendingComponent?i.jsx(t.options.defaultPendingComponent,{}):null;if(a)return s||k(),De(t,s,void 0);if(!o)return null;const h=i.jsx(Ne,{matchId:o});return n===ie?i.jsx(c.Suspense,{fallback:u,children:h}):h});function Ft(){const e=S(),t=c.useRef({router:e,mounted:!1}),[r,n]=c.useState(!1),a=g(e.stores.isLoading,f=>f),o=g(e.stores.hasPending,f=>f),s=se(a),u=a||r||o,h=se(u),l=a||o,d=se(l);return e.startTransition=f=>{n(!0),c.startTransition(()=>{f(),n(!1)})},c.useEffect(()=>{const f=e.history.subscribe(e.load),y=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Ie(e.latestLocation.publicHref)!==Ie(y.publicHref)&&e.commitLocation({...y,replace:!0}),()=>{f()}},[e,e.history]),H(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(y){console.error(y)}})()},[e]),H(()=>{s&&!a&&e.emit({type:"onLoad",...z(e.stores.location.get(),e.stores.resolvedLocation.get())})},[s,e,a]),H(()=>{d&&!l&&e.emit({type:"onBeforeRouteMount",...z(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,d,e]),H(()=>{if(h&&!u){const f=z(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...f}),Le(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())}),f.hrefChanged&&rt(e)}},[u,h,e]),null}function Dt(){const e=S(),t=e.routesById[ie].options.pendingComponent??e.options.defaultPendingComponent,r=t?i.jsx(t,{}):null,n=i.jsxs(typeof document<"u"&&e.ssr?E:c.Suspense,{fallback:r,children:[i.jsx(Ft,{}),i.jsx(Nt,{})]});return e.options.InnerWrap?i.jsx(e.options.InnerWrap,{children:n}):n}function Nt(){const e=S(),t=g(e.stores.firstId,a=>a),r=g(e.stores.loadedAt,a=>a),n=t?i.jsx(Ne,{matchId:t}):null;return i.jsx(G.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?n:i.jsx(ce,{getResetKey:()=>r,errorComponent:ue,onCatch:void 0,children:n})})}var Ht=e=>({createMutableStore:Pe,createReadonlyStore:Pe,batch:Le}),ar=e=>new Ot(e),Ot=class extends nt{constructor(e){super(e,Ht)}};function Wt({router:e,children:t,...r}){ot(r)&&e.update({...e.options,...r,context:{...e.options.context,...r.context}});const n=i.jsx(_e.Provider,{value:e,children:t});return e.options.Wrap?i.jsx(e.options.Wrap,{children:n}):n}function ir({router:e,...t}){return i.jsx(Wt,{router:e,...t,children:i.jsx(Dt,{})})}function cr(e){const t=S(),r=c.useRef(void 0);return g(t.stores.location,n=>{const a=n;if(t.options.defaultStructuralSharing){const o=we(r.current,a);return r.current=o,o}return a})}function He(e){const{attrs:t,children:r,nonce:n}=e;switch(e.tag){case"title":return i.jsx("title",{...t,suppressHydrationWarning:!0,children:r});case"meta":return i.jsx("meta",{...t,suppressHydrationWarning:!0});case"link":return i.jsx("link",{...t,precedence:t?.precedence??(t?.rel==="stylesheet"?"default":void 0),nonce:n,suppressHydrationWarning:!0});case"style":return e.inlineCss,i.jsx("style",{...t,dangerouslySetInnerHTML:{__html:r},nonce:n});case"script":return i.jsx(Kt,{attrs:t,children:r});default:return null}}function Kt({attrs:e,children:t}){S();const r=le(),n=typeof e?.type=="string"&&e.type!==""&&e.type!=="text/javascript"&&e.type!=="module";if(c.useEffect(()=>{if(!n){if(e?.src){const a=(()=>{try{const s=document.baseURI||window.location.href;return new URL(e.src,s).href}catch{return e.src}})();if(Array.from(document.querySelectorAll("script[src]")).find(s=>s.src===a))return;const o=document.createElement("script");for(const[s,u]of Object.entries(e))s!=="suppressHydrationWarning"&&u!==void 0&&u!==!1&&o.setAttribute(s,typeof u=="boolean"?"":String(u));return document.head.appendChild(o),()=>{o.parentNode&&o.parentNode.removeChild(o)}}if(typeof t=="string"){const a=typeof e?.type=="string"?e.type:"text/javascript",o=typeof e?.nonce=="string"?e.nonce:void 0;if(Array.from(document.querySelectorAll("script:not([src])")).find(u=>{if(!(u instanceof HTMLScriptElement))return!1;const h=u.getAttribute("type")??"text/javascript",l=u.getAttribute("nonce")??void 0;return u.textContent===t&&h===a&&l===o}))return;const s=document.createElement("script");if(s.textContent=t,e)for(const[u,h]of Object.entries(e))u!=="suppressHydrationWarning"&&h!==void 0&&h!==!1&&s.setAttribute(u,typeof h=="boolean"?"":String(h));return document.head.appendChild(s),()=>{s.parentNode&&s.parentNode.removeChild(s)}}}},[e,t,n]),n&&typeof t=="string")return i.jsx("script",{...e,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:t}});if(!r){if(e?.src)return i.jsx("script",{...e,suppressHydrationWarning:!0});if(typeof t=="string")return i.jsx("script",{...e,dangerouslySetInnerHTML:{__html:t},suppressHydrationWarning:!0})}return null}var Ut=e=>{const t=S(),r=t.options.ssr?.nonce,n=g(t.stores.matches,l=>l.map(d=>d.meta).filter(Boolean),b),a=c.useMemo(()=>{const l=[],d={};let f;for(let y=n.length-1;y>=0;y--){const p=n[y];for(let v=p.length-1;v>=0;v--){const I=p[v];if(I)if(I.title)f||(f={tag:"title",children:I.title});else if("script:ld+json"in I)try{const P=JSON.stringify(I["script:ld+json"]);l.push({tag:"script",attrs:{type:"application/ld+json"},children:st(P)})}catch{}else{const P=I.name??I.property;if(P){if(d[P])continue;d[P]=!0}l.push({tag:"meta",attrs:{...I,nonce:r}})}}}return f&&l.push(f),r&&l.push({tag:"meta",attrs:{property:"csp-nonce",content:r}}),l.reverse(),l},[n,r]),o=g(t.stores.matches,l=>{const d=l.map(p=>p.links).filter(Boolean).flat(1).map(p=>({tag:"link",attrs:{...p,nonce:r}})),f=t.ssr?.manifest,y=l.map(p=>f?.routes[p.routeId]?.assets??[]).filter(Boolean).flat(1).flatMap(p=>p.tag==="link"?at(f,p)?[]:[{tag:"link",attrs:{...p.attrs,crossOrigin:be(e,"stylesheet")??p.attrs?.crossOrigin,suppressHydrationWarning:!0,nonce:r}}]:p.tag==="style"?[{tag:"style",attrs:{...p.attrs,nonce:r},children:p.children,...p.inlineCss?{inlineCss:!0}:{}}]:[]);return[...d,...y]},b),s=g(t.stores.matches,l=>{const d=[];return l.map(f=>t.looseRoutesById[f.routeId]).forEach(f=>t.ssr?.manifest?.routes[f.id]?.preloads?.filter(Boolean).forEach(y=>{const p=it(y);d.push({tag:"link",attrs:{rel:"modulepreload",href:p.href,crossOrigin:be(e,"modulepreload")??p.crossOrigin,nonce:r}})})),d},b),u=g(t.stores.matches,l=>l.map(d=>d.styles).flat(1).filter(Boolean).map(({children:d,...f})=>({tag:"style",attrs:{...f,nonce:r},children:d})),b),h=g(t.stores.matches,l=>l.map(d=>d.headScripts).flat(1).filter(Boolean).map(({children:d,...f})=>({tag:"script",attrs:{...f,nonce:r},children:d})),b);return qt([...a,...s,...o,...u,...h],l=>JSON.stringify(l))};function qt(e,t){const r=new Set;return e.filter(n=>{const a=t(n);return r.has(a)?!1:(r.add(a),!0)})}function ur(e){const t=Ut(e.assetCrossOrigin),r=S().options.ssr?.nonce;return i.jsx(i.Fragment,{children:t.map(n=>c.createElement(He,{...n,key:`tsr-meta-${JSON.stringify(n)}`,nonce:r}))})}var lr=()=>{const e=S(),t=e.options.ssr?.nonce,r=o=>{const s=[],u=e.ssr?.manifest;return u?(o.map(h=>e.looseRoutesById[h.routeId]).forEach(h=>u.routes[h.id]?.assets?.filter(l=>l.tag==="script").forEach(l=>{s.push({tag:"script",attrs:{...l.attrs,nonce:t},children:l.children})})),s):[]},n=o=>o.map(s=>s.scripts).flat(1).filter(Boolean).map(({children:s,...u})=>({tag:"script",attrs:{...u,suppressHydrationWarning:!0,nonce:t},children:s})),a=g(e.stores.matches,r,b);return zt(e,g(e.stores.matches,n,b),a)};function zt(e,t,r){let n;e.serverSsr&&(n=e.serverSsr.takeBufferedScripts());const a=[...t,...r];return n&&a.unshift(n),i.jsx(i.Fragment,{children:a.map((o,s)=>c.createElement(He,{...o,key:`tsr-scripts-${o.tag}-${s}`}))})}export{rr as A,ur as H,Fe as L,ir as R,lr as S,nr as a,ar as b,or as c,Ae as d,sr as l,cr as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{am as e}from"./index-CGq67I5U.js";import"./base-ui-DKZpRETY.js";import"./router-Cdi9aGOg.js";function n(){return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Settings"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"Configure profiles, models, and preferences."})]})}export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aw as j,am as e,D as m,aF as ae,ar as l,S as R,b as z,I as q,j as C,p as B,i as le,t as E,q as re,v as ie,g as K,f as O,n as ne}from"./index-CGq67I5U.js";import{S as oe,n as ce}from"./base-ui-DKZpRETY.js";import{M as H}from"./MarkdownMessage-Bu4diQAT.js";import"./router-Cdi9aGOg.js";async function de(){return j("/api/hermes/skills")}async function F(n){return(await j(`/api/hermes/skills/${n}`)).content}async function J(n,c){return(await j(`/api/hermes/skills/${n}/${c}/files`)).files}async function ue(n,c){await j("/api/hermes/skills/toggle",{method:"PUT",body:JSON.stringify({name:n,enabled:c})})}function me({className:n,size:c="default",...o}){return e.jsx(oe,{"data-slot":"switch","data-size":c,className:m("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",n),...o,children:e.jsx(ce,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function U({source:n}){const c=n==="builtin"?"bg-muted-foreground":n==="hub"?"bg-blue-400":"bg-emerald-400";return e.jsx("span",{className:m("size-2 rounded-full shrink-0",c)})}function ge(){const{state:n}=ae(),c=n==="collapsed",[o,L]=l.useState(null),[v,x]=l.useState(!0),[d,V]=l.useState(""),[u,W]=l.useState("all"),[I,G]=l.useState(new Set),[k,Q]=l.useState(!0),[r,b]=l.useState(null),[X,h]=l.useState(""),[$,N]=l.useState([]),[P,f]=l.useState(!1),[A,y]=l.useState(null),[Y,p]=l.useState(""),[,D]=l.useState(!1),w=l.useCallback(async()=>{try{const s=await de();L(s)}catch(s){console.error("Failed to load skills:",s)}},[]);l.useEffect(()=>{x(!0),w().finally(()=>x(!1))},[w]),l.useEffect(()=>{if(!r){h(""),N([]),y(null),p("");return}f(!0);const s=`${r.category}/${r.skill}/SKILL.md`;Promise.all([F(s),J(r.category,r.skill)]).then(([t,a])=>{h(t),N(a.filter(i=>!i.isDir))}).catch(t=>{h(`Failed to load skill: ${t.message}`)}).finally(()=>f(!1))},[r]);const M=l.useMemo(()=>{if(!o)return[];let s=o.categories;if(u!=="all"&&(s=s.map(t=>({...t,skills:t.skills.filter(a=>(a.source||"local")===u)})).filter(t=>t.skills.length>0)),d.trim()){const t=d.toLowerCase();s=s.map(a=>({...a,skills:a.skills.filter(i=>i.name.toLowerCase().includes(t)||i.description.toLowerCase().includes(t))})).filter(a=>a.skills.length>0||a.name.toLowerCase().includes(t))}return s},[o,u,d]),T=l.useMemo(()=>{if(!o)return[];let s=o.archived;if(u!=="all"&&(s=s.filter(t=>(t.source||"local")===u)),d.trim()){const t=d.toLowerCase();s=s.filter(a=>a.name.toLowerCase().includes(t)||a.description.toLowerCase().includes(t))}return s},[o,u,d]),Z=s=>{G(t=>{const a=new Set(t);return a.has(s)?a.delete(s):a.add(s),a})},_=async(s,t,a)=>{try{await ue(t,a),L(i=>i&&{...i,categories:i.categories.map(g=>g.name===s?{...g,skills:g.skills.map(S=>S.name===t?{...S,enabled:a}:S)}:g)})}catch(i){console.error("Toggle failed:",i)}},ee=async s=>{if(r){D(!0),y(s);try{const t=`${r.category}/${r.skill}/`,a=await F(`${t}${s}`);p(a)}catch(t){p(`Failed to load file: ${t.message}`)}finally{D(!1)}}},se=()=>{y(null),p("")},te=[{label:"All",value:"all"},{label:"Builtin",value:"builtin"},{label:"Hub",value:"hub"},{label:"Local",value:"local"}];return r?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("header",{className:"flex items-center justify-between border-b px-4 py-3 shrink-0 relative",children:[e.jsxs("div",{className:"flex items-center gap-2 z-10",children:[c&&e.jsx(R,{className:m("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsxs(z,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>b(null),children:[e.jsx(q,{className:"size-3.5 mr-1"}),"Back"]})]}),e.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 flex items-center gap-2 max-w-[50%]",children:[e.jsx("span",{className:"text-muted-foreground text-sm truncate",children:r.category}),e.jsx("span",{className:"text-muted-foreground shrink-0",children:"/"}),e.jsx("span",{className:"text-sm font-medium truncate",children:r.skill})]}),e.jsx("div",{className:"z-10",children:e.jsxs(z,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{f(!0);const s=`${r.category}/${r.skill}/SKILL.md`;Promise.all([F(s),J(r.category,r.skill)]).then(([t,a])=>{h(t),N(a.filter(i=>!i.isDir))}).finally(()=>f(!1))},disabled:P,children:[P?e.jsx(C,{className:"size-3 animate-spin"}):e.jsx(B,{className:"size-3"}),"Refresh"]})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:e.jsx("div",{className:"max-w-3xl mx-auto flex flex-col gap-4",children:A?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:se,className:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline w-fit",children:[e.jsx(q,{className:"size-3"}),"Back to ",r.skill]}),e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:A}),e.jsx(H,{content:Y})]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{content:X}),$.length>0&&e.jsxs("div",{className:"border-t pt-4 mt-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Attached Files"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:$.map(s=>e.jsxs("button",{onClick:()=>ee(s.path),className:"inline-flex items-center gap-1.5 rounded-md border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[e.jsx(le,{className:"size-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate max-w-[180px]",children:s.path})]},s.path))})]})]})})})]}):e.jsxs("div",{className:"flex h-full",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col h-full shrink-0",children:[e.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-3 shrink-0",children:[c&&e.jsx(R,{className:m("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsx(E,{className:"size-5 text-muted-foreground"}),e.jsx("h2",{className:"text-sm font-medium",children:"Skills"}),e.jsx(z,{variant:"ghost",size:"sm",className:"ml-auto h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{x(!0),w().finally(()=>x(!1))},disabled:v,children:v?e.jsx(C,{className:"size-3 animate-spin"}):e.jsx(B,{className:"size-3"})})]}),e.jsxs("div",{className:"px-3 py-2 border-b flex flex-col gap-2 shrink-0",children:[e.jsxs("div",{className:"relative",children:[e.jsx(re,{className:"absolute left-2 top-1/2 -translate-y-1/2 size-3.5 text-muted-foreground"}),e.jsx(ie,{value:d,onChange:s=>V(s.target.value),placeholder:"Search skills...",className:"h-8 pl-7 text-xs"})]}),e.jsx("div",{className:"flex items-center gap-1",children:te.map(s=>e.jsx("button",{onClick:()=>W(s.value),className:m("px-2 py-0.5 text-[11px] rounded-sm transition-colors",u===s.value?"bg-primary text-primary-foreground font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:s.label},s.value))})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:v?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(C,{className:"size-4 animate-spin text-muted-foreground"})}):!o||M.length===0?e.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:d?"No skills match your search.":"No skills found."}):e.jsxs("div",{className:"flex flex-col gap-1",children:[M.map(s=>e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("button",{onClick:()=>Z(s.name),className:"flex items-center gap-1.5 px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider rounded-md hover:bg-muted/50 transition-colors",children:[I.has(s.name)?e.jsx(K,{className:"size-3 shrink-0"}):e.jsx(O,{className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:s.name}),e.jsx("span",{className:"ml-auto text-[10px] bg-muted px-1.5 py-0.5 rounded-full",children:s.skills.length})]}),!I.has(s.name)&&e.jsx("div",{className:"flex flex-col",children:s.skills.map(t=>e.jsxs("div",{className:"group flex items-center gap-2 px-2 py-1.5 pl-7 rounded-md hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>b({category:s.name,skill:t.name}),children:[e.jsx(U,{source:t.source}),e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs font-medium truncate",children:t.name}),t.modified&&e.jsx("span",{className:"text-[10px] text-amber-500",title:"Modified",children:"✎"}),t.pinned&&e.jsx(ne,{className:"size-3 text-amber-500 shrink-0"})]}),t.description&&e.jsx("span",{className:"text-[10px] text-muted-foreground truncate",children:t.description})]}),e.jsx(me,{checked:t.enabled!==!1,onCheckedChange:a=>_(s.name,t.name,a),className:"scale-75 shrink-0",onClick:a=>a.stopPropagation()})]},t.name))})]},s.name)),(T.length>0||(o?.archived.length??0)>0)&&e.jsxs("div",{className:"flex flex-col mt-2 pt-2 border-t",children:[e.jsxs("button",{onClick:()=>Q(!k),className:"flex items-center gap-1.5 px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider rounded-md hover:bg-muted/50 transition-colors",children:[k?e.jsx(K,{className:"size-3 shrink-0"}):e.jsx(O,{className:"size-3 shrink-0"}),e.jsx("span",{children:"Archived"}),e.jsx("span",{className:"ml-auto text-[10px] bg-muted px-1.5 py-0.5 rounded-full",children:o?.archived.length??0})]}),!k&&T.map(s=>e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 pl-7 rounded-md hover:bg-muted/50 cursor-pointer transition-colors opacity-60",onClick:()=>b({category:".archive",skill:s.name}),children:[e.jsx(U,{source:s.source}),e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsx("span",{className:"text-xs font-medium truncate",children:s.name}),s.description&&e.jsx("span",{className:"text-[10px] text-muted-foreground truncate",children:s.description})]})]},s.name))]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[e.jsx(E,{className:"size-12 opacity-20"}),e.jsx("p",{className:"text-sm",children:"Select a skill to view its details"})]})})]})}export{ge as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aw as f,am as e,ar as o}from"./index-CGq67I5U.js";import"./base-ui-DKZpRETY.js";import"./router-Cdi9aGOg.js";async function g(t=30){const a=new URLSearchParams({days:String(t)});return f(`/api/hermes/usage/stats?${a}`)}const x=["#4fd1c5","#63b3ed","#f6ad55","#b794f4","#68d391","#fc8181","#f687b3","#90cdf4","#fbd38d","#9ae6b4"];function m(t){return(t||"").trim()||"unknown"}function j(t){const a=m(t);let n=0;for(let s=0;s<a.length;s++)n=(n<<5)-n+a.charCodeAt(s),n|=0;return x[Math.abs(n)%x.length]}function l(t){return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":String(t)}function u(t){return t===0?"$0.00":t<.01?"<$0.01":"$"+t.toFixed(2)}function c(t,a){return a<=0?0:t/a*100}function h(t,a){const n=t+a;return n===0?"--":(a/n*100).toFixed(1)+"%"}function b(t=30){const[a,n]=o.useState(null),[s,r]=o.useState(!1);return o.useEffect(()=>{r(!0),g(t).then(n).catch(console.error).finally(()=>r(!1))},[t]),{stats:a,loading:s}}function d({label:t,value:a,sub:n}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:t}),e.jsx("div",{className:"text-xl font-semibold",children:a}),n&&e.jsx("div",{className:"text-[11px] text-muted-foreground mt-1",children:n})]})}function N({stats:t}){const a=t.total_input_tokens+t.total_output_tokens,n=t.total_cache_read_tokens,s=a+n>0?(n/(t.total_input_tokens+n)*100).toFixed(1)+"%":"--",r=t.daily_usage.filter(p=>p.sessions>0).length,i=r>0?(t.total_sessions/r).toFixed(1):"0.0";return e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-5",children:[e.jsx(d,{label:"Total Tokens",value:l(a),sub:`${l(t.total_input_tokens)} input / ${l(t.total_output_tokens)} output`}),e.jsx(d,{label:"Total Sessions",value:String(t.total_sessions),sub:`${i} avg/day`}),e.jsx(d,{label:"Estimated Cost",value:u(t.total_cost??0)}),e.jsx(d,{label:"Cache Hit Rate",value:s,sub:n>0?`${l(n)} tokens`:void 0})]})}function k({stats:t}){const a=o.useMemo(()=>(t.daily_usage??[]).map(s=>{const r=s.input_tokens+s.output_tokens+s.cache_read_tokens;return{...s,visualTokens:r,inputPercent:c(s.input_tokens,r),outputPercent:c(s.output_tokens,r),cachePercent:c(s.cache_read_tokens,r)}}),[t]),n=o.useMemo(()=>Math.max(...a.map(s=>s.visualTokens),1),[a]);return a.length===0?null:e.jsxs("div",{className:"rounded-lg border bg-card p-4 mb-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-secondary-foreground mb-3",children:"Daily Trend"}),e.jsx("div",{className:"flex gap-0.5 mb-2",children:a.map(s=>e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col items-center relative group",children:[e.jsx("div",{className:"w-full h-36 bg-muted/40 rounded-t-sm flex items-end overflow-hidden",children:e.jsxs("div",{className:"w-full flex flex-col-reverse justify-start transition-all",style:{height:`${s.visualTokens/n*100}%`},children:[s.output_tokens>0&&e.jsx("div",{className:"w-full bg-emerald-500/80",style:{height:`${s.outputPercent}%`}}),s.input_tokens>0&&e.jsx("div",{className:"w-full bg-indigo-500/80",style:{height:`${s.inputPercent}%`}}),s.cache_read_tokens>0&&e.jsx("div",{className:"w-full bg-amber-400/80",style:{height:`${s.cachePercent}%`}})]})}),e.jsxs("div",{className:"hidden group-hover:block absolute bottom-[calc(100%+8px)] left-1/2 -translate-x-1/2 bg-popover text-popover-foreground text-[11px] whitespace-nowrap z-10 rounded-md border px-2 py-1.5 shadow-md",children:[e.jsx("div",{className:"font-semibold mb-0.5",children:s.date}),e.jsxs("div",{children:["Input: ",l(s.input_tokens)]}),e.jsxs("div",{children:["Output: ",l(s.output_tokens)]}),e.jsxs("div",{children:["Cache read: ",l(s.cache_read_tokens)]}),e.jsxs("div",{children:["Cache write: ",l(s.cache_write_tokens)]}),e.jsxs("div",{children:["Hit rate: ",h(s.input_tokens,s.cache_read_tokens)]}),e.jsxs("div",{children:["Sessions: ",s.sessions]}),e.jsxs("div",{children:["Cost: ",u(s.cost??0)]})]})]},s.date))}),e.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mb-3",children:[e.jsx("span",{children:a[0]?.date.slice(5)}),e.jsx("span",{children:a[a.length-1]?.date.slice(5)})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground mb-4",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm bg-indigo-500/80"})," Input"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm bg-emerald-500/80"})," Output"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm bg-amber-400/80"})," Cache read"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-[11px] border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-muted-foreground text-left",children:[e.jsx("th",{className:"pb-1.5 pr-2 font-medium",children:"Date"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Input"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Output"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Cache read"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Cache write"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Hit rate"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Sessions"}),e.jsx("th",{className:"pb-1.5 pr-2 font-medium text-right",children:"Cost"})]})}),e.jsx("tbody",{children:[...a].reverse().map(s=>e.jsxs("tr",{className:"border-t",children:[e.jsx("td",{className:"py-1.5 pr-2",children:s.date}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:l(s.input_tokens)}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:l(s.output_tokens)}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:l(s.cache_read_tokens)}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:l(s.cache_write_tokens)}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:h(s.input_tokens,s.cache_read_tokens)}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:s.sessions}),e.jsx("td",{className:"py-1.5 pr-2 text-right",children:u(s.cost??0)})]},s.date))})]})})]})}function v({stats:t}){const a=o.useMemo(()=>(t.model_usage??[]).map(s=>{const r=s.input_tokens+s.output_tokens,i=r+s.cache_read_tokens;return{model:m(s.model),inputTokens:s.input_tokens,outputTokens:s.output_tokens,cacheTokens:s.cache_read_tokens,cacheWriteTokens:s.cache_write_tokens,totalTokens:r,visualTokens:i,sessions:s.sessions,color:j(s.model),inputPercent:c(s.input_tokens,i),outputPercent:c(s.output_tokens,i),cachePercent:c(s.cache_read_tokens,i)}}).sort((s,r)=>r.visualTokens-s.visualTokens),[t]),n=o.useMemo(()=>Math.max(...a.map(s=>s.visualTokens),1),[a]);return a.length===0?null:e.jsxs("div",{className:"rounded-lg border bg-card p-4 mb-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-secondary-foreground mb-3",children:"Model Breakdown"}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground mb-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm bg-indigo-500/80"})," Input"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm bg-emerald-500/80"})," Output"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm bg-amber-400/80"})," Cache read"]})]}),e.jsx("div",{className:"flex flex-col gap-2",children:a.map(s=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:s.color}}),e.jsx("span",{className:"text-xs font-mono text-secondary-foreground w-32 shrink-0 truncate",title:s.model,children:s.model}),e.jsx("div",{className:"flex-1 h-4 bg-muted/40 rounded-sm overflow-hidden",children:e.jsxs("div",{className:"h-full flex min-w-[2px] transition-all",style:{width:`${s.visualTokens/n*100}%`},children:[s.inputTokens>0&&e.jsx("div",{className:"h-full bg-indigo-500/80",style:{width:`${s.inputPercent}%`}}),s.outputTokens>0&&e.jsx("div",{className:"h-full bg-emerald-500/80",style:{width:`${s.outputPercent}%`}}),s.cacheTokens>0&&e.jsx("div",{className:"h-full bg-amber-400/80",style:{width:`${s.cachePercent}%`}})]})}),e.jsxs("span",{className:"text-xs text-muted-foreground w-20 text-right shrink-0",children:[l(s.totalTokens),s.cacheTokens>0&&e.jsxs("span",{className:"text-[10px] text-amber-500 ml-1",children:["+",l(s.cacheTokens)]})]})]},s.model))})]})}function T(){const{stats:t,loading:a}=b(30);return e.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-6",children:e.jsxs("div",{className:"mx-auto max-w-5xl",children:[e.jsxs("header",{className:"mb-5",children:[e.jsx("h1",{className:"text-lg font-semibold",children:"Usage"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Token consumption and cost estimates over the last 30 days."})]}),a&&e.jsx("div",{className:"text-sm text-muted-foreground py-8",children:"Loading usage stats…"}),!a&&!t&&e.jsx("div",{className:"text-sm text-muted-foreground py-8",children:"Failed to load usage data."}),!a&&t&&t.total_sessions===0&&e.jsx("div",{className:"text-sm text-muted-foreground py-8",children:"No usage data yet."}),!a&&t&&t.total_sessions>0&&e.jsxs(e.Fragment,{children:[e.jsx(N,{stats:t}),e.jsx(v,{stats:t}),e.jsx(k,{stats:t})]})]})})}export{T as component};
|