hermium 0.3.2 → 0.3.4
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/bin/hermium.mjs +9 -11
- package/dist/public/assets/js/ChatInputBlock-BNWxaUZs.js +1 -0
- package/dist/public/assets/js/MarkdownMessage-Dj4H-Hot.js +1 -0
- package/dist/public/assets/js/chat._sessionId-CdFGOM3V.js +1 -0
- package/dist/public/assets/js/chat.index-BjoDk7Pf.js +1 -0
- package/dist/public/assets/js/index-CGA2_Unz.js +1 -0
- package/dist/public/assets/js/index-C_aaviLR.js +60 -0
- package/dist/public/assets/js/memory-BE78tPkH.js +3 -0
- package/dist/public/assets/js/settings-RFphMDu9.js +1 -0
- package/dist/public/assets/js/skills-BNq1laCc.js +1 -0
- package/dist/public/assets/js/usage-CLJFoVEz.js +1 -0
- package/dist/server/_libs/h3.mjs +117 -0
- package/dist/server/_libs/ufo.mjs +158 -1
- package/dist/server/_ssr/{ChatInputBlock-BTSt3ldw.mjs → ChatInputBlock-CrbSl9-U.mjs} +1 -1
- package/dist/server/_ssr/{MarkdownMessage-DzImLKnw.mjs → MarkdownMessage-DXbASNGx.mjs} +1 -1
- package/dist/server/_ssr/{chat._sessionId-CUSsvbBX.mjs → chat._sessionId-iub1hqTX.mjs} +4 -4
- package/dist/server/_ssr/{chat.index-YqIyLr2b.mjs → chat.index-QiK175_4.mjs} +1 -1
- package/dist/server/_ssr/{index--T6rScER.mjs → index-B981awUw.mjs} +2 -2
- package/dist/server/_ssr/{index-Be17Jodh.mjs → index-CKVADumM.mjs} +2 -2
- package/dist/server/_ssr/{memory-DLVdk8UN.mjs → memory-C1B4dJi_.mjs} +3 -3
- package/dist/server/_ssr/{router-C0m-TE_e.mjs → router-BNU46tgz.mjs} +35 -10
- package/dist/server/_ssr/{skills-DAVualEA.mjs → skills-BK-0zOm1.mjs} +5 -34
- package/dist/server/_ssr/{usage-CCOujow3.mjs → usage-DEWJSXAs.mjs} +1 -1
- package/dist/server/_tanstack-start-manifest_v-DZ_z1QIO.mjs +4 -0
- package/dist/server/index.mjs +131 -104
- package/dist/server/public/assets/js/ChatInputBlock-BNWxaUZs.js +1 -0
- package/dist/server/public/assets/js/MarkdownMessage-Dj4H-Hot.js +1 -0
- package/dist/server/public/assets/js/chat._sessionId-CdFGOM3V.js +1 -0
- package/dist/server/public/assets/js/chat.index-BjoDk7Pf.js +1 -0
- package/dist/server/public/assets/js/index-CGA2_Unz.js +1 -0
- package/dist/server/public/assets/js/index-C_aaviLR.js +60 -0
- package/dist/server/public/assets/js/memory-BE78tPkH.js +3 -0
- package/dist/server/public/assets/js/settings-RFphMDu9.js +1 -0
- package/dist/server/public/assets/js/skills-BNq1laCc.js +1 -0
- package/dist/server/public/assets/js/usage-CLJFoVEz.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
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{G as y,D as n,L as w,C as e,h as g,S as z,x as k,b as j,B as u,n as C,j as I,q as M,p as E}from"./index-C_aaviLR.js";import{M as A}from"./MarkdownMessage-Dj4H-Hot.js";async function D(){return y("/api/hermes/memory")}async function L(s,o){await y("/api/hermes/memory",{method:"POST",body:JSON.stringify({section:s,content:o})})}const P={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 R(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]=n.useState(!1),[c,m]=n.useState(""),[d,r]=n.useState(!1),a=P[s],t=o[s],x=o[`${s}_mtime`],N=!t.trim(),v=()=>{m(t),i(!0)},b=()=>{i(!1),m("")},S=async()=>{r(!0);try{await f(s,c),i(!1)}catch(h){console.error("Failed to save memory:",h)}finally{r(!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:R(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 T(){const[s,o]=n.useState(null),[f,l]=n.useState(!0),[i,c]=n.useState(!1),{state:m}=w(),d=m==="collapsed",r=n.useCallback(async()=>{try{const t=await D();o(t)}catch(t){console.error("Failed to load memory:",t)}},[]);n.useEffect(()=>{l(!0),r().finally(()=>l(!1))},[r]);const a=async(t,x)=>{await L(t,x),await r()};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),r().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{T as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e}from"./index-C_aaviLR.js";function t(){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{t as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,v as ee,w as se,x as m,L as te,R as ae,D as r,z as w,A as R,S as M,B as y,I as P,h as S,n as B,g as le,r as T,o as re,t as ie,e as E,d as q,l as ne,H as oe}from"./index-C_aaviLR.js";import{M as H}from"./MarkdownMessage-Dj4H-Hot.js";function ce({className:d,size:x="default",...n}){return e.jsx(ee,{"data-slot":"switch","data-size":x,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",d),...n,children:e.jsx(se,{"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 K({source:d}){const x=d==="builtin"?"bg-muted-foreground":d==="hub"?"bg-blue-400":"bg-emerald-400";return e.jsx("span",{className:m("size-2 rounded-full shrink-0",x)})}function me(){const{state:d}=te(),x=d==="collapsed",n=ae.useLoaderData(),[g,z]=r.useState(!1),[o,O]=r.useState(""),[c,V]=r.useState("all"),[C,W]=r.useState(new Set),[j,G]=r.useState(!0),[l,v]=r.useState(null),[J,u]=r.useState(""),[L,N]=r.useState([]),[F,h]=r.useState(!1),[I,b]=r.useState(null),[Q,f]=r.useState(""),[,$]=r.useState(!1);r.useEffect(()=>{if(!l){u(""),N([]),b(null),f("");return}h(!0);const s=`${l.category}/${l.skill}/SKILL.md`;Promise.all([w(s),R(l.category,l.skill)]).then(([t,a])=>{u(t),N(a.filter(i=>!i.isDir))}).catch(t=>{u(`Failed to load skill: ${t.message}`)}).finally(()=>h(!1))},[l]);const A=r.useMemo(()=>{if(!n)return[];let s=n.categories;if(c!=="all"&&(s=s.map(t=>({...t,skills:t.skills.filter(a=>(a.source||"local")===c)})).filter(t=>t.skills.length>0)),o.trim()){const t=o.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},[n,c,o]),D=r.useMemo(()=>{if(!n)return[];let s=n.archived;if(c!=="all"&&(s=s.filter(t=>(t.source||"local")===c)),o.trim()){const t=o.toLowerCase();s=s.filter(a=>a.name.toLowerCase().includes(t)||a.description.toLowerCase().includes(t))}return s},[n,c,o]),U=s=>{W(t=>{const a=new Set(t);return a.has(s)?a.delete(s):a.add(s),a})},X=async(s,t,a)=>{try{await oe(t,a),setData(i=>i&&{...i,categories:i.categories.map(p=>p.name===s?{...p,skills:p.skills.map(k=>k.name===t?{...k,enabled:a}:k)}:p)})}catch(i){console.error("Toggle failed:",i)}},Y=async s=>{if(l){$(!0),b(s);try{const t=`${l.category}/${l.skill}/`,a=await w(`${t}${s}`);f(a)}catch(t){f(`Failed to load file: ${t.message}`)}finally{$(!1)}}},Z=()=>{b(null),f("")},_=[{label:"All",value:"all"},{label:"Builtin",value:"builtin"},{label:"Hub",value:"hub"},{label:"Local",value:"local"}];return l?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:[x&&e.jsx(M,{className:m("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsxs(y,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>v(null),children:[e.jsx(P,{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:l.category}),e.jsx("span",{className:"text-muted-foreground shrink-0",children:"/"}),e.jsx("span",{className:"text-sm font-medium truncate",children:l.skill})]}),e.jsx("div",{className:"z-10",children:e.jsxs(y,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{h(!0);const s=`${l.category}/${l.skill}/SKILL.md`;Promise.all([w(s),R(l.category,l.skill)]).then(([t,a])=>{u(t),N(a.filter(i=>!i.isDir))}).finally(()=>h(!1))},disabled:F,children:[F?e.jsx(S,{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:I?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:Z,className:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline w-fit",children:[e.jsx(P,{className:"size-3"}),"Back to ",l.skill]}),e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:I}),e.jsx(H,{content:Q})]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{content:J}),L.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:L.map(s=>e.jsxs("button",{onClick:()=>Y(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:[x&&e.jsx(M,{className:m("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsx(T,{className:"size-5 text-muted-foreground"}),e.jsx("h2",{className:"text-sm font-medium",children:"Skills"}),e.jsx(y,{variant:"ghost",size:"sm",className:"ml-auto h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{z(!0),load().finally(()=>z(!1))},disabled:g,children:g?e.jsx(S,{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:o,onChange:s=>O(s.target.value),placeholder:"Search skills...",className:"h-8 pl-7 text-xs"})]}),e.jsx("div",{className:"flex items-center gap-1",children:_.map(s=>e.jsx("button",{onClick:()=>V(s.value),className:m("px-2 py-0.5 text-[11px] rounded-sm transition-colors",c===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:g?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(S,{className:"size-4 animate-spin text-muted-foreground"})}):!n||A.length===0?e.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:o?"No skills match your search.":"No skills found."}):e.jsxs("div",{className:"flex flex-col gap-1",children:[A.map(s=>e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("button",{onClick:()=>U(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:[C.has(s.name)?e.jsx(E,{className:"size-3 shrink-0"}):e.jsx(q,{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})]}),!C.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:()=>v({category:s.name,skill:t.name}),children:[e.jsx(K,{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(ce,{checked:t.enabled!==!1,onCheckedChange:a=>X(s.name,t.name,a),className:"scale-75 shrink-0",onClick:a=>a.stopPropagation()})]},t.name))})]},s.name)),(D.length>0||(n?.archived.length??0)>0)&&e.jsxs("div",{className:"flex flex-col mt-2 pt-2 border-t",children:[e.jsxs("button",{onClick:()=>G(!j),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:[j?e.jsx(E,{className:"size-3 shrink-0"}):e.jsx(q,{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:n?.archived.length??0})]}),!j&&D.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:()=>v({category:".archive",skill:s.name}),children:[e.jsx(K,{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(T,{className:"size-12 opacity-20"}),e.jsx("p",{className:"text-sm",children:"Select a skill to view its details"})]})})]})}export{me as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as f,C as e,D as o}from"./index-C_aaviLR.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 y(){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{y as component};
|
package/dist/server/_libs/h3.mjs
CHANGED
|
@@ -398,11 +398,128 @@ var H3Core = class {
|
|
|
398
398
|
return routeMiddleware ? [...globalMiddleware, ...routeMiddleware] : globalMiddleware;
|
|
399
399
|
}
|
|
400
400
|
};
|
|
401
|
+
const PayloadMethods = /* @__PURE__ */ new Set([
|
|
402
|
+
"PATCH",
|
|
403
|
+
"POST",
|
|
404
|
+
"PUT",
|
|
405
|
+
"DELETE"
|
|
406
|
+
]);
|
|
407
|
+
const ignoredHeaders = /* @__PURE__ */ new Set([
|
|
408
|
+
"transfer-encoding",
|
|
409
|
+
"connection",
|
|
410
|
+
"keep-alive",
|
|
411
|
+
"upgrade",
|
|
412
|
+
"expect",
|
|
413
|
+
"host",
|
|
414
|
+
"accept"
|
|
415
|
+
]);
|
|
416
|
+
function rewriteCookieProperty(header, map, property) {
|
|
417
|
+
const _map = typeof map === "string" ? { "*": map } : map;
|
|
418
|
+
return header.replace(new RegExp(`(;\\s*${property}=)([^;]+)`, "gi"), (match, prefix, previousValue) => {
|
|
419
|
+
let newValue;
|
|
420
|
+
if (previousValue in _map) newValue = _map[previousValue];
|
|
421
|
+
else if ("*" in _map) newValue = _map["*"];
|
|
422
|
+
else return match;
|
|
423
|
+
return newValue ? prefix + newValue : "";
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
function mergeHeaders(defaults, ...inputs) {
|
|
427
|
+
const _inputs = inputs.filter(Boolean);
|
|
428
|
+
if (_inputs.length === 0) return defaults;
|
|
429
|
+
const merged = new Headers(defaults);
|
|
430
|
+
for (const input of _inputs) {
|
|
431
|
+
const entries = Array.isArray(input) ? input : typeof input.entries === "function" ? input.entries() : Object.entries(input);
|
|
432
|
+
for (const [key, value] of entries) if (value !== void 0) merged.set(key, value);
|
|
433
|
+
}
|
|
434
|
+
return merged;
|
|
435
|
+
}
|
|
436
|
+
async function proxyRequest(event, target, opts = {}) {
|
|
437
|
+
const requestBody = PayloadMethods.has(event.req.method) ? event.req.body : void 0;
|
|
438
|
+
const method = opts.fetchOptions?.method || event.req.method;
|
|
439
|
+
const fetchHeaders = mergeHeaders(getProxyRequestHeaders(event, {
|
|
440
|
+
host: target.startsWith("/"),
|
|
441
|
+
forwardHeaders: opts.forwardHeaders,
|
|
442
|
+
filterHeaders: opts.filterHeaders
|
|
443
|
+
}), opts.fetchOptions?.headers, opts.headers);
|
|
444
|
+
return proxy(event, target, {
|
|
445
|
+
...opts,
|
|
446
|
+
fetchOptions: {
|
|
447
|
+
method,
|
|
448
|
+
body: requestBody,
|
|
449
|
+
duplex: requestBody ? "half" : void 0,
|
|
450
|
+
...opts.fetchOptions,
|
|
451
|
+
headers: fetchHeaders
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
async function proxy(event, target, opts = {}) {
|
|
456
|
+
const fetchOptions = {
|
|
457
|
+
headers: opts.headers,
|
|
458
|
+
...opts.fetchOptions
|
|
459
|
+
};
|
|
460
|
+
let response;
|
|
461
|
+
try {
|
|
462
|
+
response = target[0] === "/" ? await event.app.fetch(createSubRequest(event, target, fetchOptions)) : await fetch(target, fetchOptions);
|
|
463
|
+
} catch (error) {
|
|
464
|
+
throw new HTTPError({
|
|
465
|
+
status: 502,
|
|
466
|
+
cause: error
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
const headers = new Headers();
|
|
470
|
+
const cookies = [];
|
|
471
|
+
for (const [key, value] of response.headers.entries()) {
|
|
472
|
+
if (key === "content-encoding" || key === "content-length" || key === "transfer-encoding") continue;
|
|
473
|
+
if (key === "set-cookie") {
|
|
474
|
+
cookies.push(value);
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
headers.append(key, value);
|
|
478
|
+
}
|
|
479
|
+
if (cookies.length > 0) {
|
|
480
|
+
const _cookies = cookies.map((cookie) => {
|
|
481
|
+
if (opts.cookieDomainRewrite) cookie = rewriteCookieProperty(cookie, opts.cookieDomainRewrite, "domain");
|
|
482
|
+
if (opts.cookiePathRewrite) cookie = rewriteCookieProperty(cookie, opts.cookiePathRewrite, "path");
|
|
483
|
+
return cookie;
|
|
484
|
+
});
|
|
485
|
+
for (const cookie of _cookies) headers.append("set-cookie", cookie);
|
|
486
|
+
}
|
|
487
|
+
if (opts.onResponse) await opts.onResponse(event, response);
|
|
488
|
+
return new HTTPResponse(response.body, {
|
|
489
|
+
status: response.status,
|
|
490
|
+
statusText: response.statusText,
|
|
491
|
+
headers
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
function getProxyRequestHeaders(event, opts) {
|
|
495
|
+
const headers = new NullProtoObj();
|
|
496
|
+
for (const [name, value] of event.req.headers.entries()) {
|
|
497
|
+
if (opts?.filterHeaders?.includes(name)) continue;
|
|
498
|
+
if (opts?.forwardHeaders?.includes(name)) {
|
|
499
|
+
headers[name] = value;
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
if (!ignoredHeaders.has(name) || name === "host" && opts?.host) {
|
|
503
|
+
headers[name] = value;
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return headers;
|
|
508
|
+
}
|
|
509
|
+
function createSubRequest(event, path, init) {
|
|
510
|
+
const url = new URL(path, event.url);
|
|
511
|
+
const req = new Request(url, init);
|
|
512
|
+
req.runtime = event.req.runtime;
|
|
513
|
+
req.waitUntil = event.req.waitUntil;
|
|
514
|
+
req.ip = event.req.ip;
|
|
515
|
+
return req;
|
|
516
|
+
}
|
|
401
517
|
export {
|
|
402
518
|
H3Core as H,
|
|
403
519
|
HTTPError as a,
|
|
404
520
|
defineLazyEventHandler as b,
|
|
405
521
|
toRequest as c,
|
|
406
522
|
defineHandler as d,
|
|
523
|
+
proxyRequest as p,
|
|
407
524
|
toEventHandler as t
|
|
408
525
|
};
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
+
const HASH_RE = /#/g;
|
|
2
|
+
const AMPERSAND_RE = /&/g;
|
|
3
|
+
const SLASH_RE = /\//g;
|
|
4
|
+
const EQUAL_RE = /=/g;
|
|
5
|
+
const PLUS_RE = /\+/g;
|
|
6
|
+
const ENC_CARET_RE = /%5e/gi;
|
|
7
|
+
const ENC_BACKTICK_RE = /%60/gi;
|
|
8
|
+
const ENC_PIPE_RE = /%7c/gi;
|
|
9
|
+
const ENC_SPACE_RE = /%20/gi;
|
|
1
10
|
const ENC_SLASH_RE = /%2f/gi;
|
|
11
|
+
function encode(text) {
|
|
12
|
+
return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
|
|
13
|
+
}
|
|
14
|
+
function encodeQueryValue(input) {
|
|
15
|
+
return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
|
|
16
|
+
}
|
|
17
|
+
function encodeQueryKey(text) {
|
|
18
|
+
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
|
19
|
+
}
|
|
2
20
|
function decode(text = "") {
|
|
3
21
|
try {
|
|
4
22
|
return decodeURIComponent("" + text);
|
|
@@ -9,7 +27,67 @@ function decode(text = "") {
|
|
|
9
27
|
function decodePath(text) {
|
|
10
28
|
return decode(text.replace(ENC_SLASH_RE, "%252F"));
|
|
11
29
|
}
|
|
30
|
+
function decodeQueryKey(text) {
|
|
31
|
+
return decode(text.replace(PLUS_RE, " "));
|
|
32
|
+
}
|
|
33
|
+
function decodeQueryValue(text) {
|
|
34
|
+
return decode(text.replace(PLUS_RE, " "));
|
|
35
|
+
}
|
|
36
|
+
function parseQuery(parametersString = "") {
|
|
37
|
+
const object = /* @__PURE__ */ Object.create(null);
|
|
38
|
+
if (parametersString[0] === "?") {
|
|
39
|
+
parametersString = parametersString.slice(1);
|
|
40
|
+
}
|
|
41
|
+
for (const parameter of parametersString.split("&")) {
|
|
42
|
+
const s = parameter.match(/([^=]+)=?(.*)/) || [];
|
|
43
|
+
if (s.length < 2) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const key = decodeQueryKey(s[1]);
|
|
47
|
+
if (key === "__proto__" || key === "constructor") {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const value = decodeQueryValue(s[2] || "");
|
|
51
|
+
if (object[key] === void 0) {
|
|
52
|
+
object[key] = value;
|
|
53
|
+
} else if (Array.isArray(object[key])) {
|
|
54
|
+
object[key].push(value);
|
|
55
|
+
} else {
|
|
56
|
+
object[key] = [object[key], value];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return object;
|
|
60
|
+
}
|
|
61
|
+
function encodeQueryItem(key, value) {
|
|
62
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
63
|
+
value = String(value);
|
|
64
|
+
}
|
|
65
|
+
if (!value) {
|
|
66
|
+
return encodeQueryKey(key);
|
|
67
|
+
}
|
|
68
|
+
if (Array.isArray(value)) {
|
|
69
|
+
return value.map(
|
|
70
|
+
(_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`
|
|
71
|
+
).join("&");
|
|
72
|
+
}
|
|
73
|
+
return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
|
|
74
|
+
}
|
|
75
|
+
function stringifyQuery(query) {
|
|
76
|
+
return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
|
|
77
|
+
}
|
|
78
|
+
const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
|
|
79
|
+
const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
|
|
80
|
+
const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
|
|
12
81
|
const JOIN_LEADING_SLASH_RE = /^\.?\//;
|
|
82
|
+
function hasProtocol(inputString, opts = {}) {
|
|
83
|
+
if (typeof opts === "boolean") {
|
|
84
|
+
opts = { acceptRelative: opts };
|
|
85
|
+
}
|
|
86
|
+
if (opts.strict) {
|
|
87
|
+
return PROTOCOL_STRICT_REGEX.test(inputString);
|
|
88
|
+
}
|
|
89
|
+
return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
|
|
90
|
+
}
|
|
13
91
|
function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
|
14
92
|
{
|
|
15
93
|
return input.endsWith("/");
|
|
@@ -31,6 +109,30 @@ function hasLeadingSlash(input = "") {
|
|
|
31
109
|
function withLeadingSlash(input = "") {
|
|
32
110
|
return hasLeadingSlash(input) ? input : "/" + input;
|
|
33
111
|
}
|
|
112
|
+
function withoutBase(input, base) {
|
|
113
|
+
if (isEmptyURL(base)) {
|
|
114
|
+
return input;
|
|
115
|
+
}
|
|
116
|
+
const _base = withoutTrailingSlash(base);
|
|
117
|
+
if (!input.startsWith(_base)) {
|
|
118
|
+
return input;
|
|
119
|
+
}
|
|
120
|
+
const nextChar = input[_base.length];
|
|
121
|
+
if (nextChar && nextChar !== "/" && nextChar !== "?") {
|
|
122
|
+
return input;
|
|
123
|
+
}
|
|
124
|
+
const trimmed = input.slice(_base.length).replace(/^\/+/, "");
|
|
125
|
+
return "/" + trimmed;
|
|
126
|
+
}
|
|
127
|
+
function withQuery(input, query) {
|
|
128
|
+
const parsed = parseURL(input);
|
|
129
|
+
const mergedQuery = { ...parseQuery(parsed.search), ...query };
|
|
130
|
+
parsed.search = stringifyQuery(mergedQuery);
|
|
131
|
+
return stringifyParsedURL(parsed);
|
|
132
|
+
}
|
|
133
|
+
function isEmptyURL(url) {
|
|
134
|
+
return !url || url === "/";
|
|
135
|
+
}
|
|
34
136
|
function isNonEmptyURL(url) {
|
|
35
137
|
return url && url !== "/";
|
|
36
138
|
}
|
|
@@ -46,8 +148,63 @@ function joinURL(base, ...input) {
|
|
|
46
148
|
}
|
|
47
149
|
return url;
|
|
48
150
|
}
|
|
151
|
+
const protocolRelative = /* @__PURE__ */ Symbol.for("ufo:protocolRelative");
|
|
152
|
+
function parseURL(input = "", defaultProto) {
|
|
153
|
+
const _specialProtoMatch = input.match(
|
|
154
|
+
/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i
|
|
155
|
+
);
|
|
156
|
+
if (_specialProtoMatch) {
|
|
157
|
+
const [, _proto, _pathname = ""] = _specialProtoMatch;
|
|
158
|
+
return {
|
|
159
|
+
protocol: _proto.toLowerCase(),
|
|
160
|
+
pathname: _pathname,
|
|
161
|
+
href: _proto + _pathname,
|
|
162
|
+
auth: "",
|
|
163
|
+
host: "",
|
|
164
|
+
search: "",
|
|
165
|
+
hash: ""
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
if (!hasProtocol(input, { acceptRelative: true })) {
|
|
169
|
+
return parsePath(input);
|
|
170
|
+
}
|
|
171
|
+
const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
|
|
172
|
+
let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
|
|
173
|
+
if (protocol === "file:") {
|
|
174
|
+
path = path.replace(/\/(?=[A-Za-z]:)/, "");
|
|
175
|
+
}
|
|
176
|
+
const { pathname, search, hash } = parsePath(path);
|
|
177
|
+
return {
|
|
178
|
+
protocol: protocol.toLowerCase(),
|
|
179
|
+
auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
|
|
180
|
+
host,
|
|
181
|
+
pathname,
|
|
182
|
+
search,
|
|
183
|
+
hash,
|
|
184
|
+
[protocolRelative]: !protocol
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function parsePath(input = "") {
|
|
188
|
+
const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
|
|
189
|
+
return {
|
|
190
|
+
pathname,
|
|
191
|
+
search,
|
|
192
|
+
hash
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function stringifyParsedURL(parsed) {
|
|
196
|
+
const pathname = parsed.pathname || "";
|
|
197
|
+
const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
|
|
198
|
+
const hash = parsed.hash || "";
|
|
199
|
+
const auth = parsed.auth ? parsed.auth + "@" : "";
|
|
200
|
+
const host = parsed.host || "";
|
|
201
|
+
const proto = parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "";
|
|
202
|
+
return proto + auth + host + pathname + search + hash;
|
|
203
|
+
}
|
|
49
204
|
export {
|
|
50
|
-
|
|
205
|
+
withQuery as a,
|
|
206
|
+
withoutBase as b,
|
|
207
|
+
withoutTrailingSlash as c,
|
|
51
208
|
decodePath as d,
|
|
52
209
|
joinURL as j,
|
|
53
210
|
withLeadingSlash as w
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
-
import { u as useChatStore, B as Button, c as cn } from "./router-
|
|
2
|
+
import { u as useChatStore, B as Button, c as cn } from "./router-BNU46tgz.mjs";
|
|
3
3
|
import { k as IconFile, C as IconX, o as IconPaperclip, q as IconPhotoScan, t as IconPlayerStop, a as IconArrowUp } from "../_libs/tabler__icons-react.mjs";
|
|
4
4
|
function Textarea({ className, ...props }) {
|
|
5
5
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
-
import "./index-
|
|
2
|
+
import "./index-CKVADumM.mjs";
|
|
3
3
|
import { M as Markdown } from "../_libs/react-markdown.mjs";
|
|
4
4
|
import { r as rehypeHighlight } from "../_libs/rehype-highlight.mjs";
|
|
5
5
|
import { r as remarkGfm } from "../_libs/remark-gfm.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { M as MarkdownMessage } from "./MarkdownMessage-
|
|
4
|
-
import { C as ChatInputBlock } from "./ChatInputBlock-
|
|
5
|
-
import "./index-
|
|
2
|
+
import { a as Route, u as useChatStore, g as useSidebar, S as SidebarTrigger, c as cn } from "./router-BNU46tgz.mjs";
|
|
3
|
+
import { M as MarkdownMessage } from "./MarkdownMessage-DXbASNGx.mjs";
|
|
4
|
+
import { C as ChatInputBlock } from "./ChatInputBlock-CrbSl9-U.mjs";
|
|
5
|
+
import "./index-CKVADumM.mjs";
|
|
6
6
|
import { k as IconFile, f as IconChevronRight, m as IconLoader2, d as IconCheck, i as IconCopy } from "../_libs/tabler__icons-react.mjs";
|
|
7
7
|
import "../_libs/tanstack__react-router.mjs";
|
|
8
8
|
import "../_libs/tanstack__router-core.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
2
|
import { d as useNavigate } from "../_libs/tanstack__react-router.mjs";
|
|
3
|
-
import { u as useChatStore,
|
|
3
|
+
import { u as useChatStore, b as createSession } from "./router-BNU46tgz.mjs";
|
|
4
4
|
import "../_libs/tanstack__router-core.mjs";
|
|
5
5
|
import "../_libs/tanstack__history.mjs";
|
|
6
6
|
import "node:stream/web";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
2
|
import { d as useNavigate } from "../_libs/tanstack__react-router.mjs";
|
|
3
|
-
import { C as ChatInputBlock } from "./ChatInputBlock-
|
|
4
|
-
import "./router-
|
|
3
|
+
import { C as ChatInputBlock } from "./ChatInputBlock-CrbSl9-U.mjs";
|
|
4
|
+
import "./router-BNU46tgz.mjs";
|
|
5
5
|
import "../_libs/tanstack__router-core.mjs";
|
|
6
6
|
import "../_libs/tanstack__history.mjs";
|
|
7
7
|
import "node:stream/web";
|
|
@@ -3096,7 +3096,7 @@ const defaultSerovalPlugins = [
|
|
|
3096
3096
|
p
|
|
3097
3097
|
];
|
|
3098
3098
|
async function getStartManifest(matchedRoutes) {
|
|
3099
|
-
const { tsrStartManifest } = await import("../_tanstack-start-manifest_v-
|
|
3099
|
+
const { tsrStartManifest } = await import("../_tanstack-start-manifest_v-DZ_z1QIO.mjs");
|
|
3100
3100
|
const startManifest = tsrStartManifest();
|
|
3101
3101
|
const rootRoute = startManifest.routes[rootRouteId] = startManifest.routes[rootRouteId] || {};
|
|
3102
3102
|
rootRoute.assets = rootRoute.assets || [];
|
|
@@ -4575,7 +4575,7 @@ var getBaseManifest = getProdBaseManifest;
|
|
|
4575
4575
|
var createEarlyHintsForRequest = createEarlyHintsCollector;
|
|
4576
4576
|
async function loadEntries() {
|
|
4577
4577
|
const [routerEntry, startEntry, pluginAdapters] = await Promise.all([
|
|
4578
|
-
import("./router-
|
|
4578
|
+
import("./router-BNU46tgz.mjs").then((n2) => n2.e),
|
|
4579
4579
|
Promise.resolve().then(() => start),
|
|
4580
4580
|
import("../__23tanstack-start-plugin-adapters-Cwee5PKy.mjs")
|
|
4581
4581
|
]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { M as MarkdownMessage } from "./MarkdownMessage-
|
|
4
|
-
import "./index-
|
|
2
|
+
import { g as useSidebar, S as SidebarTrigger, c as cn, B as Button, r as request } from "./router-BNU46tgz.mjs";
|
|
3
|
+
import { M as MarkdownMessage } from "./MarkdownMessage-DXbASNGx.mjs";
|
|
4
|
+
import "./index-CKVADumM.mjs";
|
|
5
5
|
import { m as IconLoader2, b as IconBrain, u as IconRefresh, p as IconPencil, A as IconUser, x as IconSparkles } from "../_libs/tabler__icons-react.mjs";
|
|
6
6
|
import "../_libs/tanstack__react-router.mjs";
|
|
7
7
|
import "../_libs/tanstack__router-core.mjs";
|
|
@@ -1934,31 +1934,52 @@ function RootDocument({ children }) {
|
|
|
1934
1934
|
] })
|
|
1935
1935
|
] });
|
|
1936
1936
|
}
|
|
1937
|
-
const $$splitComponentImporter$6 = () => import("./usage-
|
|
1937
|
+
const $$splitComponentImporter$6 = () => import("./usage-DEWJSXAs.mjs");
|
|
1938
1938
|
const Route$6 = createFileRoute("/usage")({
|
|
1939
1939
|
component: lazyRouteComponent($$splitComponentImporter$6, "component")
|
|
1940
1940
|
});
|
|
1941
|
-
|
|
1941
|
+
async function fetchSkills() {
|
|
1942
|
+
return request("/api/hermes/skills");
|
|
1943
|
+
}
|
|
1944
|
+
async function fetchSkillContent(skillPath) {
|
|
1945
|
+
const res = await request(`/api/hermes/skills/${skillPath}`);
|
|
1946
|
+
return res.content;
|
|
1947
|
+
}
|
|
1948
|
+
async function fetchSkillFiles(category, skill) {
|
|
1949
|
+
const res = await request(`/api/hermes/skills/${category}/${skill}/files`);
|
|
1950
|
+
return res.files;
|
|
1951
|
+
}
|
|
1952
|
+
async function toggleSkill(name, enabled) {
|
|
1953
|
+
await request("/api/hermes/skills/toggle", {
|
|
1954
|
+
method: "PUT",
|
|
1955
|
+
body: JSON.stringify({ name, enabled })
|
|
1956
|
+
});
|
|
1957
|
+
}
|
|
1958
|
+
const $$splitComponentImporter$5 = () => import("./skills-BK-0zOm1.mjs");
|
|
1942
1959
|
const Route$5 = createFileRoute("/skills")({
|
|
1960
|
+
loader: async () => {
|
|
1961
|
+
const data = await fetchSkills();
|
|
1962
|
+
return data;
|
|
1963
|
+
},
|
|
1943
1964
|
component: lazyRouteComponent($$splitComponentImporter$5, "component")
|
|
1944
1965
|
});
|
|
1945
1966
|
const $$splitComponentImporter$4 = () => import("./settings-DoXurzvn.mjs");
|
|
1946
1967
|
const Route$4 = createFileRoute("/settings")({
|
|
1947
1968
|
component: lazyRouteComponent($$splitComponentImporter$4, "component")
|
|
1948
1969
|
});
|
|
1949
|
-
const $$splitComponentImporter$3 = () => import("./memory-
|
|
1970
|
+
const $$splitComponentImporter$3 = () => import("./memory-C1B4dJi_.mjs");
|
|
1950
1971
|
const Route$3 = createFileRoute("/memory")({
|
|
1951
1972
|
component: lazyRouteComponent($$splitComponentImporter$3, "component")
|
|
1952
1973
|
});
|
|
1953
|
-
const $$splitComponentImporter$2 = () => import("./index
|
|
1974
|
+
const $$splitComponentImporter$2 = () => import("./index-B981awUw.mjs");
|
|
1954
1975
|
const Route$2 = createFileRoute("/")({
|
|
1955
1976
|
component: lazyRouteComponent($$splitComponentImporter$2, "component")
|
|
1956
1977
|
});
|
|
1957
|
-
const $$splitComponentImporter$1 = () => import("./chat.index-
|
|
1978
|
+
const $$splitComponentImporter$1 = () => import("./chat.index-QiK175_4.mjs");
|
|
1958
1979
|
const Route$1 = createFileRoute("/chat/")({
|
|
1959
1980
|
component: lazyRouteComponent($$splitComponentImporter$1, "component")
|
|
1960
1981
|
});
|
|
1961
|
-
const $$splitComponentImporter = () => import("./chat._sessionId-
|
|
1982
|
+
const $$splitComponentImporter = () => import("./chat._sessionId-iub1hqTX.mjs");
|
|
1962
1983
|
const Route = createFileRoute("/chat/$sessionId")({
|
|
1963
1984
|
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
1964
1985
|
});
|
|
@@ -2022,12 +2043,16 @@ const router = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
2022
2043
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2023
2044
|
export {
|
|
2024
2045
|
Button as B,
|
|
2025
|
-
Route as R,
|
|
2046
|
+
Route$5 as R,
|
|
2026
2047
|
SidebarTrigger as S,
|
|
2027
|
-
|
|
2028
|
-
|
|
2048
|
+
Route as a,
|
|
2049
|
+
createSession as b,
|
|
2029
2050
|
cn as c,
|
|
2030
|
-
|
|
2051
|
+
fetchSkillFiles as d,
|
|
2052
|
+
router as e,
|
|
2053
|
+
fetchSkillContent as f,
|
|
2054
|
+
useSidebar as g,
|
|
2031
2055
|
request as r,
|
|
2056
|
+
toggleSkill as t,
|
|
2032
2057
|
useChatStore as u
|
|
2033
2058
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { M as MarkdownMessage } from "./MarkdownMessage-
|
|
4
|
-
import "./index-
|
|
2
|
+
import { g as useSidebar, R as Route$5, f as fetchSkillContent, d as fetchSkillFiles, S as SidebarTrigger, c as cn, B as Button, t as toggleSkill } from "./router-BNU46tgz.mjs";
|
|
3
|
+
import { M as MarkdownMessage } from "./MarkdownMessage-DXbASNGx.mjs";
|
|
4
|
+
import "./index-CKVADumM.mjs";
|
|
5
5
|
import { I as IconArrowLeft, m as IconLoader2, u as IconRefresh, k as IconFile, B as IconWand, v as IconSearch, f as IconChevronRight, e as IconChevronDown, r as IconPin } from "../_libs/tabler__icons-react.mjs";
|
|
6
6
|
import { I as Input$1, S as SwitchRoot, n as SwitchThumb } from "../_libs/base-ui__react.mjs";
|
|
7
7
|
import "../_libs/tanstack__react-router.mjs";
|
|
@@ -120,23 +120,6 @@ function Input({ className, type, ...props }) {
|
|
|
120
120
|
}
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
|
-
async function fetchSkills() {
|
|
124
|
-
return request("/api/hermes/skills");
|
|
125
|
-
}
|
|
126
|
-
async function fetchSkillContent(skillPath) {
|
|
127
|
-
const res = await request(`/api/hermes/skills/${skillPath}`);
|
|
128
|
-
return res.content;
|
|
129
|
-
}
|
|
130
|
-
async function fetchSkillFiles(category, skill) {
|
|
131
|
-
const res = await request(`/api/hermes/skills/${category}/${skill}/files`);
|
|
132
|
-
return res.files;
|
|
133
|
-
}
|
|
134
|
-
async function toggleSkill(name, enabled) {
|
|
135
|
-
await request("/api/hermes/skills/toggle", {
|
|
136
|
-
method: "PUT",
|
|
137
|
-
body: JSON.stringify({ name, enabled })
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
123
|
function Switch({
|
|
141
124
|
className,
|
|
142
125
|
size = "default",
|
|
@@ -173,8 +156,8 @@ function SkillsPage() {
|
|
|
173
156
|
state
|
|
174
157
|
} = useSidebar();
|
|
175
158
|
const isCollapsed = state === "collapsed";
|
|
176
|
-
const
|
|
177
|
-
const [loading, setLoading] = reactExports.useState(
|
|
159
|
+
const data = Route$5.useLoaderData();
|
|
160
|
+
const [loading, setLoading] = reactExports.useState(false);
|
|
178
161
|
const [search, setSearch] = reactExports.useState("");
|
|
179
162
|
const [sourceFilter, setSourceFilter] = reactExports.useState("all");
|
|
180
163
|
const [collapsed, setCollapsed] = reactExports.useState(/* @__PURE__ */ new Set());
|
|
@@ -186,18 +169,6 @@ function SkillsPage() {
|
|
|
186
169
|
const [viewingFile, setViewingFile] = reactExports.useState(null);
|
|
187
170
|
const [fileContent, setFileContent] = reactExports.useState("");
|
|
188
171
|
const [, setFileLoading] = reactExports.useState(false);
|
|
189
|
-
const load = reactExports.useCallback(async () => {
|
|
190
|
-
try {
|
|
191
|
-
const d = await fetchSkills();
|
|
192
|
-
setData(d);
|
|
193
|
-
} catch (err) {
|
|
194
|
-
console.error("Failed to load skills:", err);
|
|
195
|
-
}
|
|
196
|
-
}, []);
|
|
197
|
-
reactExports.useEffect(() => {
|
|
198
|
-
setLoading(true);
|
|
199
|
-
load().finally(() => setLoading(false));
|
|
200
|
-
}, [load]);
|
|
201
172
|
reactExports.useEffect(() => {
|
|
202
173
|
if (!selected) {
|
|
203
174
|
setSkillContent("");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports, r as reactExports } from "../_libs/react.mjs";
|
|
2
|
-
import { r as request } from "./router-
|
|
2
|
+
import { r as request } from "./router-BNU46tgz.mjs";
|
|
3
3
|
import "../_libs/tanstack__react-router.mjs";
|
|
4
4
|
import "../_libs/tanstack__router-core.mjs";
|
|
5
5
|
import "../_libs/tanstack__history.mjs";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const tsrStartManifest = () => ({ routes: { __root__: { filePath: "/home/abbskhnv/Desktop/hermium-new/packages/web/src/routes/__root.tsx", children: ["/", "/memory", "/settings", "/skills", "/usage", "/chat/$sessionId", "/chat/"], assets: [{ tag: "link", attrs: { rel: "stylesheet", href: "/assets/css/index-Dfs9RUU9.css", type: "text/css" } }], preloads: ["/assets/js/index-C_aaviLR.js"] }, "/": { filePath: "/home/abbskhnv/Desktop/hermium-new/packages/web/src/routes/index.tsx", children: void 0, assets: [], preloads: ["/assets/js/index-CGA2_Unz.js", "/assets/js/ChatInputBlock-BNWxaUZs.js"] }, "/memory": { filePath: "/home/abbskhnv/Desktop/hermium-new/packages/web/src/routes/memory.tsx", children: void 0, assets: [], preloads: ["/assets/js/memory-BE78tPkH.js", "/assets/js/MarkdownMessage-Dj4H-Hot.js"] }, "/settings": { filePath: "/home/abbskhnv/Desktop/hermium-new/packages/web/src/routes/settings.tsx", children: void 0, assets: [], preloads: ["/assets/js/settings-RFphMDu9.js"] }, "/skills": { filePath: "/home/abbskhnv/Desktop/hermium-new/packages/web/src/routes/skills.tsx", children: void 0, assets: [], preloads: ["/assets/js/skills-BNq1laCc.js", "/assets/js/MarkdownMessage-Dj4H-Hot.js"] }, "/usage": { filePath: "/home/abbskhnv/Desktop/hermium-new/packages/web/src/routes/usage.tsx", children: void 0, assets: [], preloads: ["/assets/js/usage-CLJFoVEz.js"] }, "/chat/$sessionId": { filePath: "/home/abbskhnv/Desktop/hermium-new/packages/web/src/routes/chat.$sessionId.tsx", children: void 0, assets: [], preloads: ["/assets/js/chat._sessionId-CdFGOM3V.js", "/assets/js/MarkdownMessage-Dj4H-Hot.js", "/assets/js/ChatInputBlock-BNWxaUZs.js"] }, "/chat/": { filePath: "/home/abbskhnv/Desktop/hermium-new/packages/web/src/routes/chat.index.tsx", children: void 0, assets: [], preloads: ["/assets/js/chat.index-BjoDk7Pf.js"] } }, clientEntry: "/assets/js/index-C_aaviLR.js" });
|
|
2
|
+
export {
|
|
3
|
+
tsrStartManifest
|
|
4
|
+
};
|