hermium 0.1.7 → 0.1.9

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.
Files changed (56) hide show
  1. package/bin/hermium.mjs +6 -5
  2. package/dist/public/assets/{IconAlertCircle-C98Iam1j.js → IconAlertCircle-BHkmI3j7.js} +1 -1
  3. package/dist/public/assets/{IconAlertTriangle-DdD7_dc8.js → IconAlertTriangle-wCJudlVg.js} +1 -1
  4. package/dist/public/assets/{IconCheck-CYZ4_524.js → IconCheck-CFuEh_p7.js} +1 -1
  5. package/dist/public/assets/{IconLoader2-DkEhzUxZ.js → IconLoader2-BIx3OuF9.js} +1 -1
  6. package/dist/public/assets/{IconRefresh-CCXMrUxO.js → IconRefresh-Dgm93w3T.js} +1 -1
  7. package/dist/public/assets/index-Bbz3abmO.js +14 -0
  8. package/dist/public/assets/index-CWUaRwcE.js +1 -0
  9. package/dist/public/assets/index-CinLq3cd.js +1 -0
  10. package/dist/public/assets/{index-DCT13_ZI.js → index-CrQs9n6q.js} +1 -1
  11. package/dist/public/assets/{index-zFJdOj6P.js → index-CtacpN3I.js} +1 -1
  12. package/dist/public/assets/{index-C0ivmMuU.js → index-DY7aE-9s.js} +1 -1
  13. package/dist/public/assets/index-DkYGodJj.js +94 -0
  14. package/dist/public/assets/{index-DhCVawEl.js → index-DvDLadUx.js} +1 -1
  15. package/dist/public/assets/index-U6RcWedt.js +1 -0
  16. package/dist/public/assets/index-_6iFZ0fh.js +1 -0
  17. package/dist/public/assets/index-enFS26SU.js +1 -0
  18. package/dist/public/assets/input-eNcwlDHp.js +1 -0
  19. package/dist/public/assets/queries-iHRgZzw2.js +1 -0
  20. package/dist/public/assets/styles-KcflDlA_.css +1 -0
  21. package/dist/public/assets/{switch-BKlJnOab.js → switch-B1DcZLwL.js} +1 -1
  22. package/dist/public/assets/{syntax-highlighter-BuOqgzbp.js → syntax-highlighter-DWPF-A_h.js} +2 -2
  23. package/dist/public/assets/{textarea-a9VUYAmJ.js → textarea-Di_syYTS.js} +1 -1
  24. package/dist/server/index.mjs +130 -129
  25. package/dist/web-server/_libs/tabler__icons-react.mjs +171 -165
  26. package/dist/web-server/_ssr/{index-KGEq7IhY.mjs → index-0n2Z3BPQ.mjs} +2 -2
  27. package/dist/web-server/_ssr/{index-DxgfsEKM.mjs → index-6itDALOw.mjs} +39 -20
  28. package/dist/web-server/_ssr/{index-BFCBaZTA.mjs → index-BIRTrOmp.mjs} +3 -3
  29. package/dist/web-server/_ssr/{index-BVtbpy73.mjs → index-BPzfADac.mjs} +1 -1
  30. package/dist/web-server/_ssr/{index-CmwSlgGR.mjs → index-BQE3bF14.mjs} +42 -20
  31. package/dist/web-server/_ssr/index-C5HpvlUP.mjs +190 -0
  32. package/dist/web-server/_ssr/{index-BT-fOdbN.mjs → index-C_ZxnypN.mjs} +2 -2
  33. package/dist/web-server/_ssr/{index-B_d-ca5z.mjs → index-Ca8JFH8f.mjs} +4 -4
  34. package/dist/web-server/_ssr/{index-D4rgpZTm.mjs → index-DNVESZiA.mjs} +4 -4
  35. package/dist/web-server/_ssr/index.mjs +2 -2
  36. package/dist/web-server/_ssr/{input-CZtNKDXd.mjs → input-CqXjTRQg.mjs} +1 -1
  37. package/dist/web-server/_ssr/{queries-ixVDom0l.mjs → queries-3H_19mUt.mjs} +1 -1
  38. package/dist/web-server/_ssr/{router-CrULUyXB.mjs → router-sbsNus0Y.mjs} +186 -91
  39. package/dist/web-server/_ssr/{switch-Bd3Khe3S.mjs → switch-usf2F1UM.mjs} +1 -1
  40. package/dist/web-server/_ssr/{textarea-ClM2KXId.mjs → textarea-DfRheWY0.mjs} +1 -1
  41. package/dist/web-server/_tanstack-start-manifest_v-DqW-pKEH.mjs +4 -0
  42. package/dist/web-server/index.mjs +135 -142
  43. package/package.json +1 -1
  44. package/dist/public/assets/index-BTiEWEax.js +0 -1
  45. package/dist/public/assets/index-Bfadg8tB.js +0 -1
  46. package/dist/public/assets/index-CQCxtJMS.js +0 -14
  47. package/dist/public/assets/index-D6B0cdTJ.js +0 -1
  48. package/dist/public/assets/index-KT0CxDFc.js +0 -1
  49. package/dist/public/assets/index-qsvsww7-.js +0 -1
  50. package/dist/public/assets/index-twHXYGSY.js +0 -90
  51. package/dist/public/assets/input-C_TtyOcH.js +0 -1
  52. package/dist/public/assets/queries-DuZAFrOY.js +0 -1
  53. package/dist/public/assets/styles-Bc7sFPhq.css +0 -1
  54. package/dist/public/assets/useQuery-ByTdbkfi.js +0 -1
  55. package/dist/web-server/_ssr/index-ClGONv4K.mjs +0 -189
  56. package/dist/web-server/_tanstack-start-manifest_v-cNUQI9I2.mjs +0 -4
@@ -1 +1 @@
1
- import{g as p,r as o,j as e,b as h,h as f}from"./index-twHXYGSY.js";import{I as b}from"./IconRefresh-CCXMrUxO.js";function j(t=30){return p(`/api/hermes/insights?days=${t}`)}const N=[{label:"7d",days:7},{label:"30d",days:30},{label:"90d",days:90}];function l(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:String(t)}function y(t){return t>=1?`$${t.toFixed(2)}`:t>=.01?`$${t.toFixed(4)}`:t>0?`$${t.toFixed(6)}`:"$0.00"}function g(t){return`${(t*100).toFixed(1)}%`}function v(t){try{return new Date(t+"T00:00:00").toLocaleDateString(void 0,{month:"short",day:"numeric"})}catch{return t}}function n({label:t,value:r,sub:s}){return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground/70",children:t}),e.jsx("span",{className:"text-xl font-semibold text-foreground tracking-tight",children:r}),s&&e.jsx("span",{className:"text-xs text-muted-foreground/50",children:s})]})}function _({models:t}){if(t.length===0)return null;const r=t.reduce((s,d)=>s+d.sessions,0);return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground mb-3",children:"Model Breakdown"}),e.jsx("div",{className:"space-y-2.5",children:t.map(s=>e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-sm text-foreground truncate",children:s.model}),e.jsx("span",{className:"text-sm text-muted-foreground tabular-nums ml-3",children:s.sessions})]}),e.jsx("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-primary/50 transition-all",style:{width:`${r>0?s.sessions/r*100:0}%`}})})]})},s.model))})]})}function k({daily:t}){return t.length===0?null:e.jsxs("div",{className:"rounded-xl border border-border bg-card",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 pt-4 pb-3",children:[e.jsx(f,{className:"size-4 text-muted-foreground"}),e.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Daily Usage (Last 30 Days)"})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-t border-border text-muted-foreground/60",children:[e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Date"}),e.jsx("th",{className:"text-right px-2 py-2 font-medium",children:"Input"}),e.jsx("th",{className:"text-right px-2 py-2 font-medium",children:"Output"}),e.jsx("th",{className:"text-right px-2 py-2 font-medium",children:"Cache Hit Rate"}),e.jsx("th",{className:"text-right px-2 py-2 font-medium",children:"Sessions"})]})}),e.jsx("tbody",{children:t.map(r=>e.jsxs("tr",{className:"border-t border-border/50 hover:bg-muted/30 transition-colors",children:[e.jsx("td",{className:"px-4 py-2.5 text-foreground font-medium whitespace-nowrap",children:v(r.date)}),e.jsx("td",{className:"px-2 py-2.5 text-right text-muted-foreground tabular-nums",children:r.input_tokens>0?l(r.input_tokens):"—"}),e.jsx("td",{className:"px-2 py-2.5 text-right text-muted-foreground tabular-nums",children:r.output_tokens>0?l(r.output_tokens):"—"}),e.jsx("td",{className:"px-2 py-2.5 text-right tabular-nums",style:{color:r.cache_hit_rate>.8?"#22c55e":r.cache_hit_rate>.5?"#eab308":"inherit"},children:r.cache_hit_rate>0?g(r.cache_hit_rate):"—"}),e.jsx("td",{className:"px-2 py-2.5 text-right text-muted-foreground tabular-nums",children:r.sessions})]},r.date))})]})})]})}function $(){const[t,r]=o.useState(30),[s,d]=o.useState(null),[i,x]=o.useState(!0),[u,m]=o.useState(null),c=o.useCallback(()=>{x(!0),m(null),j(t).then(d).catch(a=>m(a instanceof Error?a.message:"Failed to load")).finally(()=>x(!1))},[t]);return o.useEffect(()=>{c()},[c]),e.jsx("div",{className:"flex-1 min-w-0 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto max-w-3xl px-6 py-6 flex flex-col gap-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Usage"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-0.5 rounded-lg border border-border p-0.5",children:N.map(a=>e.jsx("button",{onClick:()=>r(a.days),className:h("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",t===a.days?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:a.label},a.label))}),e.jsx("button",{onClick:c,disabled:i,className:"flex items-center justify-center rounded-md size-7 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50","aria-label":"Refresh",children:e.jsx(b,{className:h("size-3.5",i&&"animate-spin")})})]})]}),i&&!s&&e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx("div",{className:"size-5 rounded-full border-2 border-muted-foreground/30 border-t-foreground animate-spin"})}),u&&e.jsx("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-3",children:e.jsx("p",{className:"text-sm text-destructive",children:u})}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsx(n,{label:"Total Tokens",value:s.total_tokens>0?l(s.total_tokens):"—",sub:s.total_tokens>0?`${l(s.total_input_tokens)} Input / ${l(s.total_output_tokens)} Output`:void 0}),e.jsx(n,{label:"Total Sessions",value:String(s.total_sessions),sub:s.total_sessions>0?`~${(s.total_sessions/t).toFixed(1)}/day avg`:void 0}),e.jsx(n,{label:"Est. Cost",value:y(s.total_cost)}),e.jsx(n,{label:"Cache Hit Rate",value:s.cache_hit_rate>0?g(s.cache_hit_rate):"—",sub:s.total_cache_read>0?`${l(s.total_cache_read)} Tokens`:void 0})]}),e.jsx(_,{models:s.models}),e.jsx(k,{daily:s.daily_tokens}),s.daily_tokens.length===0&&s.models.length===0&&e.jsxs("div",{className:"flex flex-col items-center py-20 text-muted-foreground",children:[e.jsx(f,{className:"size-8 mb-3 opacity-40"}),e.jsx("p",{className:"text-sm font-medium",children:"No usage data available"}),e.jsx("p",{className:"text-xs mt-1 text-muted-foreground/60",children:"Start a conversation to see usage stats."})]})]})]})})}const C=$;export{C as component};
1
+ import{h as p,r as o,j as e,d as h,i as f}from"./index-DkYGodJj.js";import{I as b}from"./IconRefresh-Dgm93w3T.js";function j(t=30){return p(`/api/hermes/insights?days=${t}`)}const N=[{label:"7d",days:7},{label:"30d",days:30},{label:"90d",days:90}];function l(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:String(t)}function y(t){return t>=1?`$${t.toFixed(2)}`:t>=.01?`$${t.toFixed(4)}`:t>0?`$${t.toFixed(6)}`:"$0.00"}function g(t){return`${(t*100).toFixed(1)}%`}function v(t){try{return new Date(t+"T00:00:00").toLocaleDateString(void 0,{month:"short",day:"numeric"})}catch{return t}}function n({label:t,value:r,sub:s}){return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground/70",children:t}),e.jsx("span",{className:"text-xl font-semibold text-foreground tracking-tight",children:r}),s&&e.jsx("span",{className:"text-xs text-muted-foreground/50",children:s})]})}function _({models:t}){if(t.length===0)return null;const r=t.reduce((s,d)=>s+d.sessions,0);return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground mb-3",children:"Model Breakdown"}),e.jsx("div",{className:"space-y-2.5",children:t.map(s=>e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-sm text-foreground truncate",children:s.model}),e.jsx("span",{className:"text-sm text-muted-foreground tabular-nums ml-3",children:s.sessions})]}),e.jsx("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-primary/50 transition-all",style:{width:`${r>0?s.sessions/r*100:0}%`}})})]})},s.model))})]})}function k({daily:t}){return t.length===0?null:e.jsxs("div",{className:"rounded-xl border border-border bg-card",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 pt-4 pb-3",children:[e.jsx(f,{className:"size-4 text-muted-foreground"}),e.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Daily Usage (Last 30 Days)"})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-t border-border text-muted-foreground/60",children:[e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Date"}),e.jsx("th",{className:"text-right px-2 py-2 font-medium",children:"Input"}),e.jsx("th",{className:"text-right px-2 py-2 font-medium",children:"Output"}),e.jsx("th",{className:"text-right px-2 py-2 font-medium",children:"Cache Hit Rate"}),e.jsx("th",{className:"text-right px-2 py-2 font-medium",children:"Sessions"})]})}),e.jsx("tbody",{children:t.map(r=>e.jsxs("tr",{className:"border-t border-border/50 hover:bg-muted/30 transition-colors",children:[e.jsx("td",{className:"px-4 py-2.5 text-foreground font-medium whitespace-nowrap",children:v(r.date)}),e.jsx("td",{className:"px-2 py-2.5 text-right text-muted-foreground tabular-nums",children:r.input_tokens>0?l(r.input_tokens):"—"}),e.jsx("td",{className:"px-2 py-2.5 text-right text-muted-foreground tabular-nums",children:r.output_tokens>0?l(r.output_tokens):"—"}),e.jsx("td",{className:"px-2 py-2.5 text-right tabular-nums",style:{color:r.cache_hit_rate>.8?"#22c55e":r.cache_hit_rate>.5?"#eab308":"inherit"},children:r.cache_hit_rate>0?g(r.cache_hit_rate):"—"}),e.jsx("td",{className:"px-2 py-2.5 text-right text-muted-foreground tabular-nums",children:r.sessions})]},r.date))})]})})]})}function $(){const[t,r]=o.useState(30),[s,d]=o.useState(null),[i,x]=o.useState(!0),[u,m]=o.useState(null),c=o.useCallback(()=>{x(!0),m(null),j(t).then(d).catch(a=>m(a instanceof Error?a.message:"Failed to load")).finally(()=>x(!1))},[t]);return o.useEffect(()=>{c()},[c]),e.jsx("div",{className:"flex-1 min-w-0 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto max-w-3xl px-6 py-6 flex flex-col gap-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Usage"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-0.5 rounded-lg border border-border p-0.5",children:N.map(a=>e.jsx("button",{onClick:()=>r(a.days),className:h("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",t===a.days?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:a.label},a.label))}),e.jsx("button",{onClick:c,disabled:i,className:"flex items-center justify-center rounded-md size-7 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50","aria-label":"Refresh",children:e.jsx(b,{className:h("size-3.5",i&&"animate-spin")})})]})]}),i&&!s&&e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx("div",{className:"size-5 rounded-full border-2 border-muted-foreground/30 border-t-foreground animate-spin"})}),u&&e.jsx("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-3",children:e.jsx("p",{className:"text-sm text-destructive",children:u})}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsx(n,{label:"Total Tokens",value:s.total_tokens>0?l(s.total_tokens):"—",sub:s.total_tokens>0?`${l(s.total_input_tokens)} Input / ${l(s.total_output_tokens)} Output`:void 0}),e.jsx(n,{label:"Total Sessions",value:String(s.total_sessions),sub:s.total_sessions>0?`~${(s.total_sessions/t).toFixed(1)}/day avg`:void 0}),e.jsx(n,{label:"Est. Cost",value:y(s.total_cost)}),e.jsx(n,{label:"Cache Hit Rate",value:s.cache_hit_rate>0?g(s.cache_hit_rate):"—",sub:s.total_cache_read>0?`${l(s.total_cache_read)} Tokens`:void 0})]}),e.jsx(_,{models:s.models}),e.jsx(k,{daily:s.daily_tokens}),s.daily_tokens.length===0&&s.models.length===0&&e.jsxs("div",{className:"flex flex-col items-center py-20 text-muted-foreground",children:[e.jsx(f,{className:"size-8 mb-3 opacity-40"}),e.jsx("p",{className:"text-sm font-medium",children:"No usage data available"}),e.jsx("p",{className:"text-xs mt-1 text-muted-foreground/60",children:"Start a conversation to see usage stats."})]})]})]})})}const C=$;export{C as component};
@@ -1,2 +1,2 @@
1
- import{c as j,g as z,p as Q,r as o,j as e,i as b,k as V,l as B,m as D,b as x}from"./index-twHXYGSY.js";import{S as G}from"./switch-BKlJnOab.js";import{I as C}from"./IconLoader2-DkEhzUxZ.js";import{I as H}from"./IconAlertCircle-C98Iam1j.js";import{I as K}from"./IconRefresh-CCXMrUxO.js";import{M as O,r as W}from"./index-DCT13_ZI.js";const X=[["path",{d:"M9 15l6 -6",key:"svg-0"}],["path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464",key:"svg-1"}],["path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463",key:"svg-2"}]],J=j("outline","link","Link",X);const U=[["path",{d:"M6.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3",key:"svg-1"}]],Y=j("outline","tag","Tag",U);const Z=[["path",{d:"M10 7a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -2 -2l0 -10",key:"svg-0"}],["path",{d:"M7 7l0 10",key:"svg-1"}],["path",{d:"M4 8l0 8",key:"svg-2"}]],ee=j("outline","versions","Versions",Z);async function te(){return z("/api/hermes/skills")}async function se(l,a){return z(`/api/hermes/skills/${l}/${a}/SKILL.md`)}async function re(l,a){return Q(`/api/hermes/skills/${l}/${a}/toggle`)}const le={a({href:l,children:a}){return e.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 underline underline-offset-2 decoration-blue-400/30 hover:decoration-blue-600/60 transition-colors",children:a})},img({src:l,alt:a}){return e.jsx("img",{src:l,alt:a,className:"rounded-xl max-w-full my-4",loading:"lazy"})},pre({children:l}){return e.jsx("pre",{className:"my-5 rounded-xl bg-muted/50 border border-border/60 px-5 py-4 text-[13px] leading-relaxed overflow-x-auto font-mono whitespace-pre-wrap",children:l})},code({children:l,className:a}){return a?e.jsx("code",{className:a,children:l}):e.jsx("code",{className:"rounded-md bg-muted/70 px-1.5 py-0.5 text-[13px] font-mono text-foreground/90 border border-border/50",children:l})}};function ne(){const[l,a]=o.useState([]),[p,I]=o.useState(0),[L,k]=o.useState(!0),[N,_]=o.useState(null),[u,y]=o.useState(""),[d,M]=o.useState(null),[i,q]=o.useState(null),[v,E]=o.useState(null),[$,c]=o.useState(""),[R,g]=o.useState(!1),[w,P]=o.useState(new Set),f=o.useCallback(async()=>{k(!0),_(null);try{const t=await te();a(t.categories),I(t.total)}catch(t){_(t instanceof Error?t.message:"Failed to load skills")}finally{k(!1)}},[]);o.useEffect(()=>{f()},[f]),o.useEffect(()=>{if(!d||!i){c("");return}let t=!1;return g(!0),se(d,i).then(s=>{if(!t){const r=s.content;if(r.startsWith("---")){const n=r.indexOf(`
1
+ import{c as j,h as z,p as Q,r as o,j as e,k as b,l as V,m as B,n as D,d as x}from"./index-DkYGodJj.js";import{S as G}from"./switch-B1DcZLwL.js";import{I as C}from"./IconLoader2-BIx3OuF9.js";import{I as H}from"./IconAlertCircle-BHkmI3j7.js";import{I as K}from"./IconRefresh-Dgm93w3T.js";import{M as O,r as W}from"./index-CrQs9n6q.js";const X=[["path",{d:"M9 15l6 -6",key:"svg-0"}],["path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464",key:"svg-1"}],["path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463",key:"svg-2"}]],J=j("outline","link","Link",X);const U=[["path",{d:"M6.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3",key:"svg-1"}]],Y=j("outline","tag","Tag",U);const Z=[["path",{d:"M10 7a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -2 -2l0 -10",key:"svg-0"}],["path",{d:"M7 7l0 10",key:"svg-1"}],["path",{d:"M4 8l0 8",key:"svg-2"}]],ee=j("outline","versions","Versions",Z);async function te(){return z("/api/hermes/skills")}async function se(l,a){return z(`/api/hermes/skills/${l}/${a}/SKILL.md`)}async function re(l,a){return Q(`/api/hermes/skills/${l}/${a}/toggle`)}const le={a({href:l,children:a}){return e.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 underline underline-offset-2 decoration-blue-400/30 hover:decoration-blue-600/60 transition-colors",children:a})},img({src:l,alt:a}){return e.jsx("img",{src:l,alt:a,className:"rounded-xl max-w-full my-4",loading:"lazy"})},pre({children:l}){return e.jsx("pre",{className:"my-5 rounded-xl bg-muted/50 border border-border/60 px-5 py-4 text-[13px] leading-relaxed overflow-x-auto font-mono whitespace-pre-wrap",children:l})},code({children:l,className:a}){return a?e.jsx("code",{className:a,children:l}):e.jsx("code",{className:"rounded-md bg-muted/70 px-1.5 py-0.5 text-[13px] font-mono text-foreground/90 border border-border/50",children:l})}};function ne(){const[l,a]=o.useState([]),[p,I]=o.useState(0),[L,k]=o.useState(!0),[N,_]=o.useState(null),[u,y]=o.useState(""),[d,M]=o.useState(null),[i,q]=o.useState(null),[v,E]=o.useState(null),[$,c]=o.useState(""),[R,g]=o.useState(!1),[w,P]=o.useState(new Set),f=o.useCallback(async()=>{k(!0),_(null);try{const t=await te();a(t.categories),I(t.total)}catch(t){_(t instanceof Error?t.message:"Failed to load skills")}finally{k(!1)}},[]);o.useEffect(()=>{f()},[f]),o.useEffect(()=>{if(!d||!i){c("");return}let t=!1;return g(!0),se(d,i).then(s=>{if(!t){const r=s.content;if(r.startsWith("---")){const n=r.indexOf(`
2
2
  ---`,3);c(n!==-1?r.slice(n+4).trim():r)}else c(r);g(!1)}}).catch(s=>{t||(c(s instanceof Error?s.message:"Failed to load skill"),g(!1))}),()=>{t=!0}},[d,i]);const m=u.toLowerCase().trim(),S=m?l.map(t=>({...t,skills:(t.skills??[]).filter(s=>s.name.toLowerCase().includes(m)||s.description.toLowerCase().includes(m)||(s.tags??[]).some(r=>r.toLowerCase().includes(m)))})).filter(t=>t.skills.length>0||t.name.toLowerCase().includes(m)):l,T=t=>{P(s=>{const r=new Set(s);return r.has(t)?r.delete(t):r.add(t),r})},F=(t,s,r)=>{M(t),q(s),E(r)},A=async(t,s)=>{a(r=>r.map(n=>n.name===t?{...n,skills:n.skills.map(h=>h.name===s?{...h,disabled:!h.disabled}:h)}:n));try{await re(t,s)}catch{f()}};return L?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[e.jsx(C,{className:"size-6 animate-spin"}),e.jsx("span",{className:"text-sm",children:"Loading skills..."})]})}):N?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[e.jsx(H,{className:"size-8 text-red-500"}),e.jsx("span",{className:"text-sm",children:N}),e.jsxs("button",{onClick:f,className:"inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium bg-muted hover:bg-muted/80 transition-colors",children:[e.jsx(K,{className:"size-3.5"}),"Retry"]})]})}):e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("aside",{className:"flex w-64 shrink-0 flex-col border-r border-border",children:[e.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-3.5 shrink-0",children:[e.jsx(b,{className:"size-5 text-muted-foreground"}),e.jsxs("span",{className:"text-sm font-semibold text-foreground",children:["Skills",p>0&&e.jsxs("span",{className:"ml-1.5 text-[11px] font-normal text-muted-foreground",children:["(",p,")"]})]})]}),e.jsx("div",{className:"px-3 pb-2 shrink-0",children:e.jsxs("div",{className:"relative",children:[e.jsx(V,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-3.5 text-muted-foreground/50"}),e.jsx("input",{value:u,onChange:t=>y(t.target.value),placeholder:"Search skills...",className:"w-full rounded-md border border-border/60 bg-muted/30 pl-8 pr-8 py-1.5 text-xs text-foreground placeholder:text-muted-foreground/40 outline-none focus:ring-1 focus:ring-primary/20 focus:border-primary/30"}),u&&e.jsx("button",{onClick:()=>y(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground/40 hover:text-muted-foreground",children:e.jsx(B,{className:"size-3"})})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:S.length===0?e.jsx("div",{className:"px-4 py-8 text-center",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:u?"No skills match your search":"No skills found"})}):S.map(t=>e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>T(t.name),className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-left hover:bg-muted/40 transition-colors",children:[e.jsx(D,{className:x("size-3 shrink-0 text-muted-foreground/50 transition-transform",w.has(t.name)&&"-rotate-90")}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground truncate",children:t.name.replace(/-/g," ")}),e.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-auto shrink-0",children:t.skills.length})]}),!w.has(t.name)&&e.jsx("div",{className:"pb-1",children:(t.skills??[]).map(s=>{const r=d===t.name&&i===s.name;return e.jsxs("button",{onClick:()=>F(t.name,s.name,s.name),className:x("flex w-full items-start gap-2 px-3 py-1.5 pl-8 text-left transition-colors",r?"bg-muted text-foreground":s.disabled?"text-muted-foreground/40 hover:bg-muted/20":"text-muted-foreground hover:bg-muted/30 hover:text-foreground"),children:[e.jsxs("div",{className:x("min-w-0 flex-1",s.disabled&&"opacity-50"),children:[e.jsx("div",{className:x("truncate text-xs font-medium",s.disabled&&"line-through"),children:s.name}),s.description&&e.jsx("div",{className:"truncate text-[10px] text-muted-foreground/60 mt-0.5",children:s.description})]}),e.jsx("div",{className:"shrink-0",onClick:n=>n.stopPropagation(),children:e.jsx(G,{checked:!s.disabled,onCheckedChange:()=>A(t.name,s.name)})})]},s.name)})})]},t.name))})]}),e.jsx("div",{className:"flex flex-1 flex-col min-w-0 overflow-y-auto",children:i?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shrink-0 border-b border-border px-6 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg bg-muted/50 border border-border/50",children:e.jsx(b,{className:"size-4 text-muted-foreground"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-base font-semibold text-foreground truncate",children:v}),e.jsxs("p",{className:"text-xs text-muted-foreground/60 mt-0.5 flex items-center gap-1",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/40",children:d?.replace(/-/g," ")}),e.jsx("span",{className:"text-muted-foreground/30",children:"/"}),e.jsx("span",{children:v})]})]})]}),(()=>{const s=l.find(r=>r.name===d)?.skills.find(r=>r.name===i);return s?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-3",children:[s.version&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground/60 bg-muted/40 rounded-full px-2 py-0.5",children:[e.jsx(ee,{className:"size-3"}),"v",s.version]}),(s.tags??[]).map(r=>e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground/60 bg-muted/40 rounded-full px-2 py-0.5",children:[e.jsx(Y,{className:"size-3"}),r]},r))]}):null})()]}),e.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 py-6",children:R?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(C,{className:"size-5 animate-spin text-muted-foreground"})}):e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsx("div",{className:x("prose-sm max-w-none","[&_h1]:mt-8 [&_h1]:mb-4 [&_h1]:text-2xl [&_h1]:font-bold [&_h1]:tracking-tight [&_h1]:text-foreground","[&_h2]:mt-7 [&_h2]:mb-3 [&_h2]:text-xl [&_h2]:font-semibold [&_h2]:tracking-tight [&_h2]:text-foreground","[&_h3]:mt-6 [&_h3]:mb-2.5 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:text-foreground","[&_h4]:mt-5 [&_h4]:mb-2 [&_h4]:text-base [&_h4]:font-medium [&_h4]:text-foreground","[&_p]:my-4 [&_p]:leading-[1.75] [&_p]:text-foreground/85","[&_ul]:my-4 [&_ul]:pl-6 [&_ul]:list-disc [&_ul]:space-y-1.5 [&_ul]:marker:text-muted-foreground/40","[&_ol]:my-4 [&_ol]:pl-6 [&_ol]:list-decimal [&_ol]:space-y-1.5 [&_ol]:marker:text-muted-foreground/40","[&_li]:leading-relaxed [&_li]:text-foreground/85","[&_blockquote]:my-5 [&_blockquote]:border-l-[3px] [&_blockquote]:border-amber-400 dark:[&_blockquote]:border-amber-500 [&_blockquote]:pl-4 [&_blockquote]:text-muted-foreground [&_blockquote]:italic [&_blockquote]:leading-relaxed","[&_hr]:my-8 [&_hr]:border-border/40","[&_table]:w-full [&_table]:my-4 [&_table]:text-sm","[&_th]:border [&_th]:border-border [&_th]:bg-muted/60 [&_th]:px-4 [&_th]:py-2.5 [&_th]:text-left [&_th]:font-medium [&_th]:text-foreground/80 [&_th]:text-xs [&_th]:uppercase [&_th]:tracking-wider","[&_td]:border [&_td]:border-border [&_td]:px-4 [&_td]:py-2.5 [&_td]:text-foreground/80","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0"),children:e.jsx(O,{remarkPlugins:[W],components:le,children:$})}),(()=>{const r=l.find(n=>n.name===d)?.skills.find(n=>n.name===i)?.related_skills??[];return r.length?e.jsxs("div",{className:"mt-8 pt-6 border-t border-border",children:[e.jsxs("h4",{className:"flex items-center gap-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:[e.jsx(J,{className:"size-3"}),"Related Skills"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.map(n=>e.jsx("span",{className:"rounded-md bg-muted/40 px-2.5 py-1 text-xs text-muted-foreground border border-border/40",children:n},n))})]}):null})()]})})]}):e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 text-muted-foreground max-w-sm text-center",children:[e.jsx("div",{className:"flex size-16 items-center justify-center rounded-2xl bg-muted/50 border border-border/50",children:e.jsx(b,{className:"size-7 text-muted-foreground/25"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground/60",children:"Select a skill to view details"}),e.jsx("p",{className:"text-xs text-muted-foreground/50 mt-1",children:"Browse skills from your Hermes agent library. Each skill provides instructions and context for specific tasks."})]})]})})})]})}const xe=ne;export{xe as component};