morpheus-cli 0.8.6 → 0.8.7

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 (73) hide show
  1. package/dist/channels/telegram.js +43 -0
  2. package/dist/http/api.js +49 -13
  3. package/dist/http/routers/chronos.js +12 -1
  4. package/dist/http/webhooks-router.js +11 -3
  5. package/dist/runtime/ISubagent.js +1 -0
  6. package/dist/runtime/apoc.js +49 -39
  7. package/dist/runtime/audit/repository.js +193 -6
  8. package/dist/runtime/chronos/repository.js +35 -0
  9. package/dist/runtime/keymaker.js +6 -30
  10. package/dist/runtime/memory/sati/repository.js +37 -0
  11. package/dist/runtime/memory/sqlite.js +16 -3
  12. package/dist/runtime/neo.js +78 -34
  13. package/dist/runtime/oracle.js +31 -6
  14. package/dist/runtime/skills/tool.js +25 -0
  15. package/dist/runtime/subagent-utils.js +89 -0
  16. package/dist/runtime/tasks/repository.js +51 -0
  17. package/dist/runtime/tasks/worker.js +12 -2
  18. package/dist/runtime/telephonist.js +17 -9
  19. package/dist/runtime/tools/delegation-utils.js +120 -0
  20. package/dist/runtime/tools/index.js +0 -2
  21. package/dist/runtime/trinity.js +50 -34
  22. package/dist/runtime/webhooks/repository.js +31 -0
  23. package/dist/types/pagination.js +1 -0
  24. package/dist/ui/assets/AuditDashboard-5sA8Sd8S.js +1 -0
  25. package/dist/ui/assets/Chat-CjxeAQmd.js +41 -0
  26. package/dist/ui/assets/Chronos-BAjeLobF.js +1 -0
  27. package/dist/ui/assets/{ConfirmationModal-Bx-GtD9B.js → ConfirmationModal-fvgnOWTY.js} +1 -1
  28. package/dist/ui/assets/{Dashboard-DDyN_X-J.js → Dashboard-Ca5mSefz.js} +1 -1
  29. package/dist/ui/assets/{DeleteConfirmationModal-DIXbckY8.js → DeleteConfirmationModal-A8EmnHoa.js} +1 -1
  30. package/dist/ui/assets/{Logs-dzPLW45U.js → Logs-CYu7se7R.js} +1 -1
  31. package/dist/ui/assets/MCPManager-DsDA_ZVT.js +1 -0
  32. package/dist/ui/assets/ModelPricing-DnSm_Nh-.js +1 -0
  33. package/dist/ui/assets/Notifications-CiljQzvM.js +1 -0
  34. package/dist/ui/assets/Pagination-JsiwxVNQ.js +1 -0
  35. package/dist/ui/assets/SatiMemories-rnO2b0LG.js +1 -0
  36. package/dist/ui/assets/SessionAudit-Dfvhge3Z.js +9 -0
  37. package/dist/ui/assets/{Settings-DNDe62-H.js → Settings-OQlHAJoy.js} +1 -1
  38. package/dist/ui/assets/Skills-Crsybug0.js +7 -0
  39. package/dist/ui/assets/Smiths-wm90jRDT.js +1 -0
  40. package/dist/ui/assets/Tasks-C5FMu_Yu.js +1 -0
  41. package/dist/ui/assets/TrinityDatabases-BzYfecKI.js +1 -0
  42. package/dist/ui/assets/{UsageStats-doBLB7Lc.js → UsageStats-CBo2vW2n.js} +1 -1
  43. package/dist/ui/assets/{WebhookManager-D3A5pdjC.js → WebhookManager-0tDFkfHd.js} +1 -1
  44. package/dist/ui/assets/audit-B-F8XPLi.js +1 -0
  45. package/dist/ui/assets/chronos-BvMxfBQH.js +1 -0
  46. package/dist/ui/assets/{config-DX3Xb0XE.js → config-DteVgNGR.js} +1 -1
  47. package/dist/ui/assets/index-Cwqr-n0Y.js +10 -0
  48. package/dist/ui/assets/index-DcfyUdLI.css +1 -0
  49. package/dist/ui/assets/{mcp-DfhJYN14.js → mcp-DxzodOdH.js} +1 -1
  50. package/dist/ui/assets/{skills-BPjq0qV7.js → skills--hAyQnmG.js} +1 -1
  51. package/dist/ui/assets/{stats-DHCRNkJp.js → stats-Cibaisqd.js} +1 -1
  52. package/dist/ui/assets/vendor-icons-BVuQI-6R.js +1 -0
  53. package/dist/ui/index.html +3 -3
  54. package/dist/ui/sw.js +1 -1
  55. package/package.json +2 -1
  56. package/dist/runtime/tools/apoc-tool.js +0 -157
  57. package/dist/runtime/tools/neo-tool.js +0 -172
  58. package/dist/runtime/tools/trinity-tool.js +0 -157
  59. package/dist/ui/assets/Chat-CO15OnaY.js +0 -38
  60. package/dist/ui/assets/Chronos-CUZDQLh2.js +0 -1
  61. package/dist/ui/assets/MCPManager-CRHWR4S7.js +0 -1
  62. package/dist/ui/assets/ModelPricing-TRBesy0r.js +0 -1
  63. package/dist/ui/assets/Notifications-DMke7Dr7.js +0 -1
  64. package/dist/ui/assets/SatiMemories-CaLrgdZV.js +0 -1
  65. package/dist/ui/assets/SessionAudit-DedGO5XK.js +0 -9
  66. package/dist/ui/assets/Skills-KUhW7UXP.js +0 -7
  67. package/dist/ui/assets/Smiths-Btoqw4Ex.js +0 -1
  68. package/dist/ui/assets/Tasks-cwA25Hq2.js +0 -1
  69. package/dist/ui/assets/TrinityDatabases-CQhettEJ.js +0 -1
  70. package/dist/ui/assets/chronos-DlDM2UBT.js +0 -1
  71. package/dist/ui/assets/index-CQIUjucB.js +0 -10
  72. package/dist/ui/assets/index-DAh3q_hR.css +0 -1
  73. package/dist/ui/assets/vendor-icons-DLvvGkeN.js +0 -1
@@ -1 +1 @@
1
- import{j as e,m as d}from"./vendor-motion-C3CZ8ZlO.js";import{u as P,t as z,h as w,f as U}from"./index-CQIUjucB.js";import{u as n}from"./vendor-utils-D4NnWbOU.js";import{s as A}from"./stats-DHCRNkJp.js";import{m as E}from"./mcp-DfhJYN14.js";import{s as R}from"./skills-BPjq0qV7.js";import{L as V,A as F,h as j,k as O,l as J,m as W,i as B,W as G,P as H,H as q,g as X,n as S,o as K,p as Q,q as Y}from"./vendor-icons-DLvvGkeN.js";import{L as C}from"./vendor-react-DikRIOlj.js";const Z={hidden:{opacity:0,y:20},show:{opacity:1,y:0}},k=({title:r,value:a,icon:i,subValue:l})=>e.jsxs(d.div,{variants:Z,className:"border border-azure-border dark:border-matrix-primary bg-azure-surface/50 dark:bg-zinc-950/50 p-6 rounded relative overflow-hidden group hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsx("h3",{className:"text-azure-text-secondary dark:text-matrix-secondary text-sm font-bold uppercase",children:r}),e.jsx(i,{className:"w-6 h-6 text-azure-primary dark:text-matrix-primary group-hover:text-azure-primary dark:group-hover:text-matrix-highlight transition-colors"})]}),e.jsx("div",{className:"text-3xl font-bold text-azure-primary dark:text-matrix-highlight mb-1 font-mono tracking-tighter truncate",children:a}),l&&e.jsx("div",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary opacity-70 font-mono",children:l})]}),ee={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.07}}},c={hidden:{opacity:0,y:12},show:{opacity:1,y:0}};function m({icon:r,title:a,to:i,children:l,status:o="neutral"}){const h=o==="ok"?"border-emerald-300/60 dark:border-emerald-700/40":o==="warn"?"border-amber-300/60 dark:border-amber-700/40":o==="error"?"border-red-300/60 dark:border-red-700/40":"border-azure-border dark:border-matrix-primary/50";return e.jsxs(C,{to:i,className:`group flex flex-col gap-3 rounded-lg border bg-white dark:bg-black p-4 hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors ${h}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{className:"w-4 h-4 text-azure-primary dark:text-matrix-highlight"}),e.jsx("span",{className:"text-sm font-semibold text-azure-text dark:text-matrix-highlight",children:a})]}),e.jsx(S,{className:"w-3.5 h-3.5 text-azure-text-secondary dark:text-matrix-tertiary group-hover:text-azure-primary dark:group-hover:text-matrix-highlight transition-colors"})]}),e.jsx("div",{className:"space-y-1.5",children:l})]})}function s({label:r,value:a,highlight:i}){return e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:r}),e.jsx("span",{className:i?"font-semibold text-azure-text dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-secondary",children:a})]})}function te({status:r}){return r==="completed"?e.jsx(K,{className:"w-3.5 h-3.5 text-emerald-500 shrink-0"}):r==="failed"?e.jsx(Q,{className:"w-3.5 h-3.5 text-red-500 shrink-0"}):r==="running"?e.jsx(Y,{className:"w-3.5 h-3.5 text-blue-500 animate-spin shrink-0"}):e.jsx(j,{className:"w-3.5 h-3.5 text-yellow-500 shrink-0"})}function xe(){const{data:r}=P(),{data:a}=n("/tasks/stats",()=>z.stats(),{refreshInterval:5e3}),{data:i}=n("/api/stats/usage",()=>A.fetchUsageStats(),{refreshInterval:3e4}),{data:l}=n("/api/mcp/stats",()=>E.fetchStats(),{refreshInterval:3e4}),{data:o}=n("/smiths",()=>w.get("/smiths"),{refreshInterval:1e4}),{data:h=[]}=n("/chronos",()=>w.get("/chronos"),{refreshInterval:3e4}),{data:x}=n("/api/skills",()=>R.fetchSkills(),{refreshInterval:6e4}),{data:p=[]}=n(["/tasks",{limit:5}],()=>z.list({limit:5}),{refreshInterval:5e3}),v=(i?.totalInputTokens??0)+(i?.totalOutputTokens??0),f=i?.totalEstimatedCostUsd!=null,T=i?.totalEstimatedCostUsd??0,g=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t),u=h.filter(t=>t.enabled),y=u.filter(t=>t.next_run_at).sort((t,b)=>t.next_run_at-b.next_run_at)[0],N=y?.next_run_at?(()=>{const t=y.next_run_at-Date.now();return t<0?"due now":t<6e4?`${Math.floor(t/1e3)}s`:t<36e5?`${Math.floor(t/6e4)}m`:`${Math.floor(t/36e5)}h`})():null,$=(a?.pending??0)+(a?.running??0),I=a?.failed?"warn":$>0?"ok":"neutral",L=(l?.totalTools??0)>0?"ok":"neutral",_=(o?.online??0)>0?"ok":(o?.total??0)>0?"warn":"neutral",D=u.length>0?"ok":"neutral",M=(x?.enabled??0)>0?"ok":"neutral";return e.jsxs(d.div,{className:"space-y-6",variants:ee,initial:"hidden",animate:"show",children:[e.jsxs(d.div,{variants:c,className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(V,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Dashboard"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"Overview of the Morpheus agent runtime."})]})]}),e.jsxs(d.div,{variants:c,className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(k,{title:"Agent Status",value:r?.status.toUpperCase()??"CONNECTING...",icon:F,subValue:r?`PID: ${r.pid}`:""}),e.jsx(k,{title:"Uptime",value:r?U(r.uptimeSeconds):"-",icon:j,subValue:r?`${r.uptimeSeconds.toFixed(0)}s elapsed`:""}),e.jsx(k,{title:"Version",value:r?.projectVersion??"-",icon:O,subValue:`Node ${r?.nodeVersion??"-"}`})]}),e.jsxs(d.div,{variants:c,className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black p-4",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Provider"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{className:"w-4 h-4 text-azure-primary dark:text-matrix-highlight shrink-0"}),e.jsx("p",{className:"text-base font-bold text-azure-text dark:text-matrix-highlight truncate",children:r?.llmProvider?.toUpperCase()??"—"})]})]}),e.jsxs("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black p-4",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Model"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{className:"w-4 h-4 text-azure-primary dark:text-matrix-highlight shrink-0"}),e.jsx("p",{className:"text-sm font-bold text-azure-text dark:text-matrix-highlight truncate leading-tight",children:r?.llmModel??"—"})]})]}),e.jsxs("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black p-4",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Total Tokens"}),e.jsx("p",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:v>0?g(v):"—"}),e.jsxs("p",{className:"text-[10px] text-azure-text-secondary dark:text-matrix-tertiary mt-1",children:[g(i?.totalInputTokens??0)," in · ",g(i?.totalOutputTokens??0)," out"]})]}),e.jsxs("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black p-4",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Est. Cost"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(B,{className:"w-4 h-4 text-emerald-500 shrink-0"}),e.jsx("p",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:f?`$${T.toFixed(4)}`:"—"})]}),e.jsx("p",{className:"text-[10px] text-azure-text-secondary dark:text-matrix-tertiary mt-1",children:f?"accumulated total":"configure pricing to track"})]})]}),e.jsxs(d.div,{variants:c,children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-3",children:"Platform"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4",children:[e.jsxs(m,{icon:G,title:"Skills",to:"/skills",status:M,children:[e.jsx(s,{label:"Enabled",value:x?`${x.enabled} / ${x.total}`:"—",highlight:(x?.enabled??0)>0}),e.jsx(s,{label:"Total",value:x?.total??"—"})]}),e.jsxs(m,{icon:H,title:"MCP Servers",to:"/mcp-servers",status:L,children:[e.jsx(s,{label:"Tools loaded",value:l?.totalTools??"—",highlight:!!l?.totalTools}),e.jsx(s,{label:"Servers",value:l?.servers?.length??"—"}),l?.lastLoadedAt&&e.jsx(s,{label:"Last loaded",value:new Date(l.lastLoadedAt).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})})]}),e.jsxs(m,{icon:q,title:"Smiths",to:"/smiths",status:_,children:[e.jsx(s,{label:"Online",value:o?`${o.online} / ${o.total}`:"—",highlight:(o?.online??0)>0}),e.jsx(s,{label:"System",value:o?.enabled?"enabled":"disabled"})]}),e.jsxs(m,{icon:X,title:"Tasks",to:"/tasks",status:I,children:[e.jsx(s,{label:"Running",value:a?.running??"—",highlight:!!a?.running}),e.jsx(s,{label:"Pending",value:a?.pending??"—"}),e.jsx(s,{label:"Completed",value:a?.completed??"—"}),(a?.failed??0)>0&&e.jsx(s,{label:"Failed",value:a.failed})]}),e.jsxs(m,{icon:j,title:"Chronos",to:"/chronos",status:D,children:[e.jsx(s,{label:"Active jobs",value:u.length,highlight:u.length>0}),e.jsx(s,{label:"Total jobs",value:h.length}),N&&e.jsx(s,{label:"Next run",value:`in ${N}`})]})]})]}),p.length>0&&e.jsxs(d.div,{variants:c,children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary",children:"Recent Tasks"}),e.jsxs(C,{to:"/tasks",className:"flex items-center gap-0.5 text-xs text-azure-primary dark:text-matrix-highlight hover:underline",children:["View all ",e.jsx(S,{className:"w-3 h-3"})]})]}),e.jsx("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary overflow-hidden",children:p.map((t,b)=>e.jsxs("div",{className:`flex items-center gap-3 px-4 py-2.5 ${b<p.length-1?"border-b border-azure-border dark:border-matrix-primary/30":""} hover:bg-azure-surface/60 dark:hover:bg-zinc-900/50 transition-colors`,children:[e.jsx(te,{status:t.status}),e.jsx("span",{className:"font-mono text-[10px] text-azure-text-secondary dark:text-matrix-tertiary w-16 shrink-0",children:t.id.slice(0,8)}),e.jsx("span",{className:"flex-1 text-xs text-azure-text dark:text-matrix-secondary truncate",children:t.input.slice(0,100)}),e.jsx("span",{className:"text-[10px] font-mono uppercase text-azure-text-secondary dark:text-matrix-tertiary shrink-0",children:t.agent}),e.jsx("span",{className:"text-[10px] text-azure-text-secondary dark:text-matrix-tertiary shrink-0",children:new Date(t.created_at).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})})]},t.id))})]})]})}export{xe as Dashboard};
1
+ import{j as e,m as d}from"./vendor-motion-C3CZ8ZlO.js";import{u as P,t as z,h as w,f as U}from"./index-Cwqr-n0Y.js";import{u as n}from"./vendor-utils-D4NnWbOU.js";import{s as A}from"./stats-Cibaisqd.js";import{m as E}from"./mcp-DxzodOdH.js";import{s as R}from"./skills--hAyQnmG.js";import{L as V,A as F,h as j,l as O,m as J,n as W,i as B,W as G,P as H,H as q,g as X,o as S,p as K,q as Q,r as Y}from"./vendor-icons-BVuQI-6R.js";import{L as C}from"./vendor-react-DikRIOlj.js";const Z={hidden:{opacity:0,y:20},show:{opacity:1,y:0}},k=({title:r,value:a,icon:i,subValue:l})=>e.jsxs(d.div,{variants:Z,className:"border border-azure-border dark:border-matrix-primary bg-azure-surface/50 dark:bg-zinc-950/50 p-6 rounded relative overflow-hidden group hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsx("h3",{className:"text-azure-text-secondary dark:text-matrix-secondary text-sm font-bold uppercase",children:r}),e.jsx(i,{className:"w-6 h-6 text-azure-primary dark:text-matrix-primary group-hover:text-azure-primary dark:group-hover:text-matrix-highlight transition-colors"})]}),e.jsx("div",{className:"text-3xl font-bold text-azure-primary dark:text-matrix-highlight mb-1 font-mono tracking-tighter truncate",children:a}),l&&e.jsx("div",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary opacity-70 font-mono",children:l})]}),ee={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.07}}},c={hidden:{opacity:0,y:12},show:{opacity:1,y:0}};function m({icon:r,title:a,to:i,children:l,status:o="neutral"}){const h=o==="ok"?"border-emerald-300/60 dark:border-emerald-700/40":o==="warn"?"border-amber-300/60 dark:border-amber-700/40":o==="error"?"border-red-300/60 dark:border-red-700/40":"border-azure-border dark:border-matrix-primary/50";return e.jsxs(C,{to:i,className:`group flex flex-col gap-3 rounded-lg border bg-white dark:bg-black p-4 hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors ${h}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{className:"w-4 h-4 text-azure-primary dark:text-matrix-highlight"}),e.jsx("span",{className:"text-sm font-semibold text-azure-text dark:text-matrix-highlight",children:a})]}),e.jsx(S,{className:"w-3.5 h-3.5 text-azure-text-secondary dark:text-matrix-tertiary group-hover:text-azure-primary dark:group-hover:text-matrix-highlight transition-colors"})]}),e.jsx("div",{className:"space-y-1.5",children:l})]})}function s({label:r,value:a,highlight:i}){return e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:r}),e.jsx("span",{className:i?"font-semibold text-azure-text dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-secondary",children:a})]})}function te({status:r}){return r==="completed"?e.jsx(K,{className:"w-3.5 h-3.5 text-emerald-500 shrink-0"}):r==="failed"?e.jsx(Q,{className:"w-3.5 h-3.5 text-red-500 shrink-0"}):r==="running"?e.jsx(Y,{className:"w-3.5 h-3.5 text-blue-500 animate-spin shrink-0"}):e.jsx(j,{className:"w-3.5 h-3.5 text-yellow-500 shrink-0"})}function xe(){const{data:r}=P(),{data:a}=n("/tasks/stats",()=>z.stats(),{refreshInterval:5e3}),{data:i}=n("/api/stats/usage",()=>A.fetchUsageStats(),{refreshInterval:3e4}),{data:l}=n("/api/mcp/stats",()=>E.fetchStats(),{refreshInterval:3e4}),{data:o}=n("/smiths",()=>w.get("/smiths"),{refreshInterval:1e4}),{data:h=[]}=n("/chronos",()=>w.get("/chronos"),{refreshInterval:3e4}),{data:x}=n("/api/skills",()=>R.fetchSkills(),{refreshInterval:6e4}),{data:p=[]}=n(["/tasks",{limit:5}],()=>z.list({limit:5}),{refreshInterval:5e3}),v=(i?.totalInputTokens??0)+(i?.totalOutputTokens??0),f=i?.totalEstimatedCostUsd!=null,T=i?.totalEstimatedCostUsd??0,g=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t),u=h.filter(t=>t.enabled),y=u.filter(t=>t.next_run_at).sort((t,b)=>t.next_run_at-b.next_run_at)[0],N=y?.next_run_at?(()=>{const t=y.next_run_at-Date.now();return t<0?"due now":t<6e4?`${Math.floor(t/1e3)}s`:t<36e5?`${Math.floor(t/6e4)}m`:`${Math.floor(t/36e5)}h`})():null,$=(a?.pending??0)+(a?.running??0),I=a?.failed?"warn":$>0?"ok":"neutral",L=(l?.totalTools??0)>0?"ok":"neutral",_=(o?.online??0)>0?"ok":(o?.total??0)>0?"warn":"neutral",D=u.length>0?"ok":"neutral",M=(x?.enabled??0)>0?"ok":"neutral";return e.jsxs(d.div,{className:"space-y-6",variants:ee,initial:"hidden",animate:"show",children:[e.jsxs(d.div,{variants:c,className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(V,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Dashboard"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"Overview of the Morpheus agent runtime."})]})]}),e.jsxs(d.div,{variants:c,className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(k,{title:"Agent Status",value:r?.status.toUpperCase()??"CONNECTING...",icon:F,subValue:r?`PID: ${r.pid}`:""}),e.jsx(k,{title:"Uptime",value:r?U(r.uptimeSeconds):"-",icon:j,subValue:r?`${r.uptimeSeconds.toFixed(0)}s elapsed`:""}),e.jsx(k,{title:"Version",value:r?.projectVersion??"-",icon:O,subValue:`Node ${r?.nodeVersion??"-"}`})]}),e.jsxs(d.div,{variants:c,className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black p-4",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Provider"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{className:"w-4 h-4 text-azure-primary dark:text-matrix-highlight shrink-0"}),e.jsx("p",{className:"text-base font-bold text-azure-text dark:text-matrix-highlight truncate",children:r?.llmProvider?.toUpperCase()??"—"})]})]}),e.jsxs("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black p-4",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Model"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{className:"w-4 h-4 text-azure-primary dark:text-matrix-highlight shrink-0"}),e.jsx("p",{className:"text-sm font-bold text-azure-text dark:text-matrix-highlight truncate leading-tight",children:r?.llmModel??"—"})]})]}),e.jsxs("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black p-4",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Total Tokens"}),e.jsx("p",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:v>0?g(v):"—"}),e.jsxs("p",{className:"text-[10px] text-azure-text-secondary dark:text-matrix-tertiary mt-1",children:[g(i?.totalInputTokens??0)," in · ",g(i?.totalOutputTokens??0)," out"]})]}),e.jsxs("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black p-4",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Est. Cost"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(B,{className:"w-4 h-4 text-emerald-500 shrink-0"}),e.jsx("p",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:f?`$${T.toFixed(4)}`:"—"})]}),e.jsx("p",{className:"text-[10px] text-azure-text-secondary dark:text-matrix-tertiary mt-1",children:f?"accumulated total":"configure pricing to track"})]})]}),e.jsxs(d.div,{variants:c,children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-3",children:"Platform"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4",children:[e.jsxs(m,{icon:G,title:"Skills",to:"/skills",status:M,children:[e.jsx(s,{label:"Enabled",value:x?`${x.enabled} / ${x.total}`:"—",highlight:(x?.enabled??0)>0}),e.jsx(s,{label:"Total",value:x?.total??"—"})]}),e.jsxs(m,{icon:H,title:"MCP Servers",to:"/mcp-servers",status:L,children:[e.jsx(s,{label:"Tools loaded",value:l?.totalTools??"—",highlight:!!l?.totalTools}),e.jsx(s,{label:"Servers",value:l?.servers?.length??"—"}),l?.lastLoadedAt&&e.jsx(s,{label:"Last loaded",value:new Date(l.lastLoadedAt).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})})]}),e.jsxs(m,{icon:q,title:"Smiths",to:"/smiths",status:_,children:[e.jsx(s,{label:"Online",value:o?`${o.online} / ${o.total}`:"—",highlight:(o?.online??0)>0}),e.jsx(s,{label:"System",value:o?.enabled?"enabled":"disabled"})]}),e.jsxs(m,{icon:X,title:"Tasks",to:"/tasks",status:I,children:[e.jsx(s,{label:"Running",value:a?.running??"—",highlight:!!a?.running}),e.jsx(s,{label:"Pending",value:a?.pending??"—"}),e.jsx(s,{label:"Completed",value:a?.completed??"—"}),(a?.failed??0)>0&&e.jsx(s,{label:"Failed",value:a.failed})]}),e.jsxs(m,{icon:j,title:"Chronos",to:"/chronos",status:D,children:[e.jsx(s,{label:"Active jobs",value:u.length,highlight:u.length>0}),e.jsx(s,{label:"Total jobs",value:h.length}),N&&e.jsx(s,{label:"Next run",value:`in ${N}`})]})]})]}),p.length>0&&e.jsxs(d.div,{variants:c,children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary",children:"Recent Tasks"}),e.jsxs(C,{to:"/tasks",className:"flex items-center gap-0.5 text-xs text-azure-primary dark:text-matrix-highlight hover:underline",children:["View all ",e.jsx(S,{className:"w-3 h-3"})]})]}),e.jsx("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary overflow-hidden",children:p.map((t,b)=>e.jsxs("div",{className:`flex items-center gap-3 px-4 py-2.5 ${b<p.length-1?"border-b border-azure-border dark:border-matrix-primary/30":""} hover:bg-azure-surface/60 dark:hover:bg-zinc-900/50 transition-colors`,children:[e.jsx(te,{status:t.status}),e.jsx("span",{className:"font-mono text-[10px] text-azure-text-secondary dark:text-matrix-tertiary w-16 shrink-0",children:t.id.slice(0,8)}),e.jsx("span",{className:"flex-1 text-xs text-azure-text dark:text-matrix-secondary truncate",children:t.input.slice(0,100)}),e.jsx("span",{className:"text-[10px] font-mono uppercase text-azure-text-secondary dark:text-matrix-tertiary shrink-0",children:t.agent}),e.jsx("span",{className:"text-[10px] text-azure-text-secondary dark:text-matrix-tertiary shrink-0",children:new Date(t.created_at).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})})]},t.id))})]})]})}export{xe as Dashboard};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import"./vendor-react-DikRIOlj.js";import{B as d}from"./index-CQIUjucB.js";const n=({isOpen:a,onClose:r,title:t,children:s,size:i="md"})=>{if(!a)return null;const l={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl"};return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:`relative bg-azure-surface dark:bg-black rounded-lg border border-azure-border dark:border-matrix-primary shadow-xl w-full ${l[i]} max-h-[90vh] overflow-hidden flex flex-col`,children:[t&&e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-azure-border dark:border-matrix-primary",children:[t&&e.jsx("h3",{className:"text-lg font-semibold text-azure-text-primary dark:text-matrix-highlight",children:t}),r&&e.jsx("button",{onClick:r,className:"text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text-primary dark:hover:text-matrix-highlight",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),e.jsx("div",{className:"overflow-y-auto flex-grow p-6",children:s})]})]})},h=({isOpen:a,onClose:r,onConfirm:t,title:s="Confirm Deletion",message:i="Are you sure you want to delete this item? This action cannot be undone.",confirmButtonText:l="Delete",cancelButtonText:x="Cancel"})=>e.jsx(n,{isOpen:a,onClose:r,title:s,size:"md",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("p",{className:"text-azure-text-primary dark:text-matrix-secondary",children:i}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{variant:"outline",onClick:r,children:x}),e.jsx(d,{variant:"destructive",onClick:()=>{t(),r()},children:l})]})]})});export{h as D,n as M};
1
+ import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import"./vendor-react-DikRIOlj.js";import{B as d}from"./index-Cwqr-n0Y.js";const n=({isOpen:a,onClose:r,title:t,children:s,size:i="md"})=>{if(!a)return null;const l={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl"};return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:`relative bg-azure-surface dark:bg-black rounded-lg border border-azure-border dark:border-matrix-primary shadow-xl w-full ${l[i]} max-h-[90vh] overflow-hidden flex flex-col`,children:[t&&e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-azure-border dark:border-matrix-primary",children:[t&&e.jsx("h3",{className:"text-lg font-semibold text-azure-text-primary dark:text-matrix-highlight",children:t}),r&&e.jsx("button",{onClick:r,className:"text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text-primary dark:hover:text-matrix-highlight",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),e.jsx("div",{className:"overflow-y-auto flex-grow p-6",children:s})]})]})},h=({isOpen:a,onClose:r,onConfirm:t,title:s="Confirm Deletion",message:i="Are you sure you want to delete this item? This action cannot be undone.",confirmButtonText:l="Delete",cancelButtonText:x="Cancel"})=>e.jsx(n,{isOpen:a,onClose:r,title:s,size:"md",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("p",{className:"text-azure-text-primary dark:text-matrix-secondary",children:i}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{variant:"outline",onClick:r,children:x}),e.jsx(d,{variant:"destructive",onClick:()=>{t(),r()},children:l})]})]})});export{h as D,n as M};
@@ -1 +1 @@
1
- import{j as e,m}from"./vendor-motion-C3CZ8ZlO.js";import{r as i}from"./vendor-react-DikRIOlj.js";import{a as h,b as u}from"./index-CQIUjucB.js";import{J as c,K as p}from"./vendor-icons-DLvvGkeN.js";import"./vendor-utils-D4NnWbOU.js";function j(){const{data:t}=h(),[a,n]=i.useState(null),{data:o,mutate:x}=u(a),s=i.useRef(null);return i.useEffect(()=>{!a&&t&&t.length>0&&n(t[0].name)},[t,a]),i.useEffect(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[o]),e.jsxs(m.div,{className:"flex flex-col space-y-4 md:pt-0",style:{height:"calc(100vh - 2rem)"},initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},transition:{duration:.3},children:[e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(c,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Logs"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"View runtime logs."})]})]}),e.jsxs("div",{className:"flex-1 flex gap-4 min-h-0 border border-azure-border dark:border-matrix-primary rounded bg-azure-surface dark:bg-zinc-950 p-4",children:[e.jsxs("div",{className:"hidden md:flex w-64 flex-col gap-2 border-r border-azure-border dark:border-matrix-primary pr-4 overflow-y-auto shrink-0",children:[e.jsx("h3",{className:"font-bold text-azure-text-secondary dark:text-matrix-secondary mb-2 sticky top-0 bg-azure-surface dark:bg-zinc-950",children:"LOG FILES"}),t?.map(r=>e.jsxs("button",{onClick:()=>n(r.name),className:`text-left px-3 py-2 rounded text-sm truncate flex items-center gap-2 group transition-colors ${a===r.name?"bg-azure-active text-azure-primary dark:bg-matrix-primary dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-secondary hover:bg-azure-hover dark:hover:bg-zinc-900 group-hover:text-azure-primary dark:group-hover:text-matrix-highlight"}`,children:[e.jsx(c,{className:"w-4 h-4 shrink-0"}),e.jsxs("div",{className:"flex flex-col overflow-hidden",children:[e.jsx("span",{className:"truncate font-bold",children:r.name}),e.jsxs("span",{className:"text-xs opacity-70",children:[(r.size/1024).toFixed(1)," KB"]})]})]},r.name))]}),e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 bg-azure-bg dark:bg-black border border-azure-border dark:border-matrix-primary/50 rounded",children:[e.jsxs("div",{className:"shrink-0 flex justify-between items-center gap-2 p-2 bg-azure-hover dark:bg-zinc-900 border-b border-azure-border dark:border-matrix-primary/50",children:[e.jsx("select",{value:a??"",onChange:r=>n(r.target.value),className:"md:hidden flex-1 bg-transparent text-azure-text-primary dark:text-matrix-highlight font-bold font-mono text-sm border-none outline-none cursor-pointer",children:t?.map(r=>e.jsx("option",{value:r.name,children:r.name},r.name))}),e.jsx("span",{className:"hidden md:block text-azure-text-primary dark:text-matrix-highlight font-bold font-mono text-sm truncate",children:a}),e.jsx("button",{onClick:()=>x(),className:"shrink-0 text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",children:e.jsx(p,{className:"w-4 h-4"})})]}),e.jsx("div",{ref:s,className:"flex-1 overflow-x-hidden overflow-y-auto p-4 font-mono text-xs break-all text-azure-text-primary dark:text-white",children:o?o.lines.map((r,l)=>{const d=r.match(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z)\s?(.*)/s);return d?e.jsxs("div",{children:[e.jsxs("span",{className:"hidden md:inline opacity-50",children:[d[1]," "]}),e.jsx("span",{children:d[2]})]},l):e.jsx("div",{children:r},l)}):e.jsx("span",{className:"opacity-50",children:"Select a log file to view content..."})})]})]})]})}export{j as Logs};
1
+ import{j as e,m}from"./vendor-motion-C3CZ8ZlO.js";import{r as i}from"./vendor-react-DikRIOlj.js";import{a as h,b as u}from"./index-Cwqr-n0Y.js";import{N as c,O as p}from"./vendor-icons-BVuQI-6R.js";import"./vendor-utils-D4NnWbOU.js";function j(){const{data:t}=h(),[a,n]=i.useState(null),{data:o,mutate:x}=u(a),s=i.useRef(null);return i.useEffect(()=>{!a&&t&&t.length>0&&n(t[0].name)},[t,a]),i.useEffect(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[o]),e.jsxs(m.div,{className:"flex flex-col space-y-4 md:pt-0",style:{height:"calc(100vh - 2rem)"},initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},transition:{duration:.3},children:[e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(c,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Logs"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"View runtime logs."})]})]}),e.jsxs("div",{className:"flex-1 flex gap-4 min-h-0 border border-azure-border dark:border-matrix-primary rounded bg-azure-surface dark:bg-zinc-950 p-4",children:[e.jsxs("div",{className:"hidden md:flex w-64 flex-col gap-2 border-r border-azure-border dark:border-matrix-primary pr-4 overflow-y-auto shrink-0",children:[e.jsx("h3",{className:"font-bold text-azure-text-secondary dark:text-matrix-secondary mb-2 sticky top-0 bg-azure-surface dark:bg-zinc-950",children:"LOG FILES"}),t?.map(r=>e.jsxs("button",{onClick:()=>n(r.name),className:`text-left px-3 py-2 rounded text-sm truncate flex items-center gap-2 group transition-colors ${a===r.name?"bg-azure-active text-azure-primary dark:bg-matrix-primary dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-secondary hover:bg-azure-hover dark:hover:bg-zinc-900 group-hover:text-azure-primary dark:group-hover:text-matrix-highlight"}`,children:[e.jsx(c,{className:"w-4 h-4 shrink-0"}),e.jsxs("div",{className:"flex flex-col overflow-hidden",children:[e.jsx("span",{className:"truncate font-bold",children:r.name}),e.jsxs("span",{className:"text-xs opacity-70",children:[(r.size/1024).toFixed(1)," KB"]})]})]},r.name))]}),e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 bg-azure-bg dark:bg-black border border-azure-border dark:border-matrix-primary/50 rounded",children:[e.jsxs("div",{className:"shrink-0 flex justify-between items-center gap-2 p-2 bg-azure-hover dark:bg-zinc-900 border-b border-azure-border dark:border-matrix-primary/50",children:[e.jsx("select",{value:a??"",onChange:r=>n(r.target.value),className:"md:hidden flex-1 bg-transparent text-azure-text-primary dark:text-matrix-highlight font-bold font-mono text-sm border-none outline-none cursor-pointer",children:t?.map(r=>e.jsx("option",{value:r.name,children:r.name},r.name))}),e.jsx("span",{className:"hidden md:block text-azure-text-primary dark:text-matrix-highlight font-bold font-mono text-sm truncate",children:a}),e.jsx("button",{onClick:()=>x(),className:"shrink-0 text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",children:e.jsx(p,{className:"w-4 h-4"})})]}),e.jsx("div",{ref:s,className:"flex-1 overflow-x-hidden overflow-y-auto p-4 font-mono text-xs break-all text-azure-text-primary dark:text-white",children:o?o.lines.map((r,l)=>{const d=r.match(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z)\s?(.*)/s);return d?e.jsxs("div",{children:[e.jsxs("span",{className:"hidden md:inline opacity-50",children:[d[1]," "]}),e.jsx("span",{children:d[2]})]},l):e.jsx("div",{children:r},l)}):e.jsx("span",{className:"opacity-50",children:"Select a log file to view content..."})})]})]})]})}export{j as Logs};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as i}from"./vendor-react-DikRIOlj.js";import{o as J,s as L,a as Z,l as R,u as ee}from"./vendor-utils-D4NnWbOU.js";import{m as k}from"./mcp-DxzodOdH.js";import{D as q,d as H,e as U,j as _}from"./index-Cwqr-n0Y.js";import{E as re,a1 as te,w as ae,a2 as se,a3 as oe,z as de,T as ne,a4 as ie,F as le,q as ce,P as me}from"./vendor-icons-BVuQI-6R.js";const xe=({label:r,values:s,onChange:t,placeholder:b})=>{const h=s.length>0?s:[""],m=(u,o)=>{const n=[...h];n[u]=o,t(n.filter(d=>d.trim().length>0))},c=()=>t([...h,""]),x=u=>{const o=h.filter((n,d)=>d!==u);t(o.filter(n=>n.trim().length>0))};return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-semibold text-azure-text-primary dark:text-matrix-secondary",children:r}),h.map((u,o)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:"flex-1 rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:u,placeholder:b,onChange:n=>m(o,n.target.value)}),e.jsx("button",{type:"button",className:"rounded-md border border-red-300 px-3 py-2 text-sm text-red-600 hover:border-red-400 hover:text-red-500 dark:border-red-900 dark:text-red-400",onClick:()=>x(o),children:"Remove"})]},`${r}-${o}`)),e.jsx("button",{type:"button",className:"text-sm font-semibold text-azure-primary hover:text-azure-secondary dark:text-matrix-highlight hover:dark:text-matrix-secondary",onClick:c,children:"Add argument"})]})},O=({label:r,values:s,onChange:t,keyPlaceholder:b,valuePlaceholder:h})=>{const m=i.useMemo(()=>s.length>0?s:[{key:"",value:""}],[s]),c=(o,n,d)=>{const v=[...m];v[o]={...v[o],[n]:d},t(v.filter(f=>f.key.trim().length>0||f.value.trim().length>0))},x=()=>t([...m,{key:"",value:""}]),u=o=>{const n=m.filter((d,v)=>v!==o);t(n.filter(d=>d.key.trim().length>0||d.value.trim().length>0))};return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-semibold text-azure-text-primary dark:text-matrix-secondary",children:r}),m.map((o,n)=>e.jsxs("div",{className:"grid gap-2 md:grid-cols-5",children:[e.jsx("input",{className:"col-span-2 rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:o.key,placeholder:b,onChange:d=>c(n,"key",d.target.value)}),e.jsx("input",{className:"col-span-2 rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:o.value,placeholder:h,onChange:d=>c(n,"value",d.target.value)}),e.jsx("button",{type:"button",className:"rounded-md border border-red-300 px-3 py-2 text-sm text-red-600 hover:border-red-400 hover:text-red-500 dark:border-red-900 dark:text-red-400",onClick:()=>u(n),children:"Remove"})]},`${r}-${n}`)),e.jsx("button",{type:"button",className:"text-sm font-semibold text-azure-primary hover:text-azure-secondary dark:text-matrix-highlight hover:dark:text-matrix-secondary",onClick:x,children:"Add entry"})]})},ue=({transport:r,command:s,url:t,args:b,env:h,headers:m,onCommandChange:c,onUrlChange:x,onArgsChange:u,onEnvChange:o,onHeadersChange:n})=>e.jsxs("div",{className:"space-y-4",children:[r==="stdio"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block space-y-2 text-sm text-azure-text-primary dark:text-matrix-secondary",children:["Command",e.jsx("input",{className:"w-full rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:s,onChange:d=>c(d.target.value),placeholder:"npx"})]}),e.jsx(xe,{label:"Arguments",values:b,onChange:u,placeholder:"--flag"})]}),r==="http"&&e.jsxs("label",{className:"block space-y-2 text-sm text-azure-text-primary dark:text-matrix-secondary",children:["URL",e.jsx("input",{className:"w-full rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:t,onChange:d=>x(d.target.value),placeholder:"https://example.com/mcp"})]}),e.jsx(O,{label:"Environment Variables",values:h,onChange:o,keyPlaceholder:"KEY",valuePlaceholder:"value"}),r==="http"&&e.jsx(O,{label:"Headers",values:m,onChange:n,keyPlaceholder:"Header",valuePlaceholder:"value"})]}),he=J({name:L().min(1,"Name is required"),transport:Z([R("stdio"),R("http")]),command:L().optional(),url:L().optional()}),D=r=>r?Object.entries(r).map(([s,t])=>({key:s,value:t})):[],A=r=>r.reduce((s,t)=>(t.key.trim().length===0||(s[t.key]=t.value),s),{}),pe=({open:r,mode:s,initial:t,onClose:b,onSubmit:h})=>{const[m,c]=i.useState(t?.name??""),[x,u]=i.useState(t?.config.transport??"stdio"),[o,n]=i.useState(t?.config.transport==="stdio"?t.config.command:""),[d,v]=i.useState(t?.config.transport==="http"?t.config.url:""),[f,N]=i.useState(t?.config.args??[]),[j,C]=i.useState(D(t?.config.env)),[p,T]=i.useState(t?.config.transport==="http"?D(t.config.headers):[]),[w,z]=i.useState(null);i.useEffect(()=>{r&&(c(t?.name??""),u(t?.config.transport??"stdio"),n(t?.config.transport==="stdio"?t.config.command:""),v(t?.config.transport==="http"?t.config.url:""),N(t?.config.args??[]),C(D(t?.config.env)),T(t?.config.transport==="http"?D(t.config.headers):[]),z(null))},[r,t]);const P=s==="create",M=async()=>{const y=he.safeParse({name:m,transport:x,command:o,url:d});if(!y.success){z(y.error.issues[0]?.message??"Invalid form");return}if(x==="stdio"&&(!o||o.trim().length===0)){z("Command is required for stdio transport.");return}if(x==="http"&&(!d||d.trim().length===0)){z("URL is required for http transport.");return}const E=x==="stdio"?{transport:"stdio",command:o.trim(),args:f.length>0?f:void 0,env:j.length>0?A(j):void 0}:{transport:"http",url:d.trim(),headers:p.length>0?A(p):void 0,env:j.length>0?A(j):void 0};z(null),await h(m.trim(),E)},$=i.useMemo(()=>s==="create"?"Add MCP Server":"Edit MCP Server",[s]);return e.jsx(q,{open:r,onOpenChange:b,children:e.jsxs(H,{children:[e.jsx(U,{children:e.jsx(_,{children:$})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2 text-sm text-azure-text-primary dark:text-matrix-secondary",children:["Name",e.jsx("input",{className:"w-full rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none disabled:bg-azure-border dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary dark:disabled:bg-matrix-primary/50",value:m,onChange:y=>c(y.target.value),placeholder:"coolify",disabled:!P})]}),e.jsxs("label",{className:"block space-y-2 text-sm text-azure-text-primary dark:text-matrix-secondary",children:["Transport",e.jsxs("select",{className:"w-full rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:x,onChange:y=>u(y.target.value),children:[e.jsx("option",{value:"stdio",children:"stdio"}),e.jsx("option",{value:"http",children:"http"})]})]}),e.jsx(ue,{transport:x,command:o,url:d,args:f,env:j,headers:p,onCommandChange:n,onUrlChange:v,onArgsChange:N,onEnvChange:C,onHeadersChange:T}),w&&e.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/50 dark:text-red-400",children:w}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",className:"rounded-md border border-azure-border px-4 py-2 text-sm text-azure-text-primary hover:border-azure-primary hover:text-azure-primary dark:border-matrix-primary dark:text-matrix-secondary hover:dark:border-matrix-highlight hover:dark:text-matrix-highlight",onClick:b,children:"Cancel"}),e.jsx("button",{type:"button",className:"rounded-md bg-azure-primary px-4 py-2 text-sm font-semibold text-white shadow hover:bg-azure-secondary dark:bg-matrix-highlight dark:text-matrix-bg hover:dark:bg-matrix-secondary",onClick:M,children:"Save"})]})]})]})})};function be({transport:r}){return r==="stdio"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium border rounded px-1.5 py-0.5 text-amber-500 bg-amber-500/10 border-amber-500/30",children:[e.jsx(ne,{className:"w-2.5 h-2.5"}),"stdio"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium border rounded px-1.5 py-0.5 text-cyan-500 bg-cyan-500/10 border-cyan-500/30",children:[e.jsx(ie,{className:"w-2.5 h-2.5"}),"http"]})}function ge({result:r}){return r?r.ok?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-emerald-500",children:[e.jsx(le,{className:"w-3 h-3"}),r.toolCount," tool",r.toolCount!==1?"s":""]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-red-500",children:[e.jsx(ce,{className:"w-3 h-3"}),"failed"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-zinc-400 dark:text-zinc-600",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zinc-400 dark:bg-zinc-600"}),"unchecked"]})}const ye=({server:r,probeResult:s,onEdit:t,onDelete:b,onToggle:h})=>{const m=s?.ok,c=s&&!s.ok,x=r.config.env?Object.entries(r.config.env):[];return e.jsxs("div",{className:`rounded-lg border flex flex-col bg-azure-surface/50 dark:bg-zinc-950/50 transition-all ${r.enabled?c?"border-red-400/40 dark:border-red-500/30":m?"border-emerald-400/50 dark:border-emerald-500/30":"border-azure-primary/40 dark:border-matrix-primary":"border-azure-border dark:border-matrix-primary/30"}`,children:[e.jsxs("div",{className:"p-4 flex items-start gap-3",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 ${r.enabled?m?"bg-emerald-500/10":c?"bg-red-500/10":"bg-azure-primary/10 dark:bg-matrix-highlight/10":"bg-azure-surface dark:bg-zinc-900"}`,children:e.jsx(re,{className:`w-4 h-4 ${r.enabled?m?"text-emerald-500":c?"text-red-500":"text-azure-primary dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-tertiary"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:`font-semibold truncate ${r.enabled?"text-azure-text dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-secondary"}`,children:r.name}),e.jsx(be,{transport:r.config.transport}),!r.enabled&&e.jsx("span",{className:"text-[10px] font-medium text-zinc-400 dark:text-zinc-500 bg-zinc-100 dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded px-1.5 py-0.5 shrink-0",children:"disabled"})]}),e.jsx("div",{className:"mt-1",children:e.jsx(ge,{result:s})})]})]}),e.jsxs("div",{className:"px-4 pb-4 space-y-2",children:[r.config.transport==="stdio"&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-1",children:"Command"}),e.jsxs("code",{className:"block text-xs font-mono text-azure-text dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-2.5 py-1.5 break-all",children:[r.config.command,r.config.args&&r.config.args.length>0&&e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:[" ",r.config.args.join(" ")]})]})]}),r.config.transport==="http"&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-1",children:"URL"}),e.jsx("code",{className:"block text-xs font-mono text-azure-text dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-2.5 py-1.5 break-all",children:r.config.url})]}),x.length>0&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-1",children:["Env vars (",x.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:x.map(([u])=>e.jsx("span",{className:"text-[10px] font-mono text-azure-text-secondary dark:text-matrix-tertiary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/30 rounded px-1.5 py-0.5",children:u},u))})]}),c&&s.error&&e.jsxs("div",{className:"flex items-start gap-2 text-xs text-red-500 bg-red-500/10 border border-red-500/20 rounded p-2",children:[e.jsx(te,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{className:"break-all line-clamp-2",title:s.error,children:s.error})]})]}),e.jsxs("div",{className:"mt-auto px-4 py-3 border-t border-azure-border dark:border-matrix-primary/30 flex items-center justify-between gap-2",children:[r.config._comment?e.jsx("p",{className:"text-xs text-azure-text-secondary dark:text-matrix-tertiary truncate min-w-0",children:r.config._comment}):e.jsx("div",{}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>t(r),className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary/50 text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"Edit",children:e.jsx(ae,{className:"w-3.5 h-3.5"})}),e.jsx("button",{type:"button",onClick:()=>h(r,!r.enabled),className:`p-1.5 rounded border transition-colors ${r.enabled?"border-emerald-300 dark:border-emerald-700/60 text-emerald-500 dark:text-emerald-400 hover:bg-emerald-50 dark:hover:bg-emerald-900/20":"border-azure-border dark:border-matrix-primary/40 text-zinc-400 dark:text-zinc-600 hover:text-azure-text dark:hover:text-matrix-secondary hover:border-azure-border dark:hover:border-matrix-primary"}`,title:r.enabled?"Disable":"Enable",children:r.enabled?e.jsx(se,{className:"w-4 h-4"}):e.jsx(oe,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:()=>b(r),className:"p-1.5 rounded border border-red-200 dark:border-red-800/50 text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-500 transition-colors",title:"Delete",children:e.jsx(de,{className:"w-3.5 h-3.5"})})]})]})]})},Ce=()=>{const{data:r,error:s,mutate:t,isLoading:b}=ee("/api/mcp/servers",()=>k.fetchServers()),[h,m]=i.useState(""),[c,x]=i.useState("all"),[u,o]=i.useState(!1),[n,d]=i.useState(null),[v,f]=i.useState(!1),[N,j]=i.useState(null),[C,p]=i.useState(null),[T,w]=i.useState({}),[z,P]=i.useState(!1),[M,$]=i.useState(!1),[y,E]=i.useState(null),F=r?.servers??[];i.useEffect(()=>{k.fetchStats().then(a=>{E(a);const g={};for(const l of a.servers)g[l.name]={name:l.name,ok:l.ok,toolCount:l.toolCount,error:l.error};w(g)}).catch(()=>{})},[]);const I=i.useMemo(()=>F.filter(a=>{const g=a.name.toLowerCase().includes(h.toLowerCase()),l=c==="all"||a.config.transport===c;return g&&l}),[F,h,c]),K=()=>{d(null),o(!0)},V=a=>{d(a),o(!0)},S=async()=>{const a=await k.fetchStats();E(a);const g={};for(const l of a.servers)g[l.name]={name:l.name,ok:l.ok,toolCount:l.toolCount,error:l.error};return w(g),a},B=async(a,g)=>{try{n?await k.updateServer(n.name,g):await k.addServer(a,g),o(!1),d(null),await t(),await k.reloadTools();const l=await S();p({type:"success",message:`MCP server saved. Tools reloaded: ${l.totalTools} total.`})}catch(l){p({type:"error",message:l.message||"Failed to save MCP server."})}},Q=async a=>{j(a),f(!0)},W=async()=>{if(N)try{await k.deleteServer(N.name),await t(),f(!1),j(null),await k.reloadTools();const a=await S();p({type:"success",message:`MCP server deleted. Tools reloaded: ${a.totalTools} total.`})}catch(a){p({type:"error",message:a.message||"Failed to delete MCP server."})}},G=async()=>{P(!0);try{const a=await S();p({type:"success",message:`Status checked: ${a.totalTools} tools from ${a.servers.length} servers.`})}catch(a){p({type:"error",message:a.message||"Failed to check MCP status."})}finally{P(!1)}},X=async()=>{$(!0);try{await k.reloadTools();const a=await S();p({type:"success",message:`MCP tools reloaded: ${a.totalTools} tools from ${a.servers.length} servers.`})}catch(a){p({type:"error",message:a.message||"Failed to reload MCP tools."})}finally{$(!1)}},Y=async(a,g)=>{try{await k.toggleServer(a.name,g),await t(),await k.reloadTools();const l=await S();p({type:"success",message:`MCP server ${g?"enabled":"disabled"}. Tools reloaded: ${l.totalTools} total.`})}catch(l){p({type:"error",message:l.message||"Failed to toggle MCP server."})}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(me,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"MCP Servers"}),y&&y.totalTools>0&&e.jsxs("span",{className:"rounded-full bg-azure-primary/10 px-2.5 py-0.5 text-xs font-semibold text-azure-primary dark:bg-matrix-highlight/20 dark:text-matrix-highlight",children:[y.totalTools," tools cached"]})]}),e.jsxs("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:["Manage MCP servers stored in mcps.json."," ",y?.lastLoadedAt&&e.jsxs("span",{className:"dark:text-matrix-tertiary",children:["Last loaded: ",new Date(y.lastLoadedAt).toLocaleTimeString()]})]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",disabled:z,className:"rounded-md border border-azure-border px-4 py-2 text-sm font-semibold text-azure-text-primary shadow hover:border-azure-primary hover:text-azure-primary disabled:opacity-50 dark:border-matrix-primary dark:text-matrix-secondary hover:dark:border-matrix-highlight hover:dark:text-matrix-highlight",onClick:G,children:z?"Checking…":"Check Status"}),e.jsx("button",{type:"button",disabled:M,className:"rounded-md border border-azure-border px-4 py-2 text-sm font-semibold text-azure-text-primary shadow hover:border-azure-primary hover:text-azure-primary disabled:opacity-50 dark:border-matrix-primary dark:text-matrix-secondary hover:dark:border-matrix-highlight hover:dark:text-matrix-highlight",onClick:X,children:M?"Reloading…":"Reload MCPs"}),e.jsx("button",{type:"button",className:"rounded-md bg-azure-primary px-4 py-2 text-sm font-semibold text-white shadow hover:bg-azure-secondary dark:bg-matrix-highlight dark:text-matrix-bg hover:dark:bg-matrix-secondary",onClick:K,children:"Add Server"})]})]}),C&&e.jsx("div",{className:`p-4 rounded border ${C.type==="success"?"border-azure-primary text-azure-primary bg-azure-primary/10 dark:border-matrix-highlight dark:text-matrix-highlight dark:bg-matrix-highlight/10":"border-red-500 text-red-500 bg-red-900/10"}`,children:C.message}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center",children:[e.jsx("input",{className:"w-full rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:h,onChange:a=>m(a.target.value),placeholder:"Search by name"}),e.jsxs("select",{className:"rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:c,onChange:a=>x(a.target.value),children:[e.jsx("option",{value:"all",children:"All"}),e.jsx("option",{value:"stdio",children:"stdio"}),e.jsx("option",{value:"http",children:"http"})]})]}),b&&e.jsx("div",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary",children:"Loading MCP servers..."}),s&&e.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:"Failed to load MCP servers."}),!b&&I.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-azure-border bg-azure-surface/60 p-6 text-center text-sm text-azure-text-secondary dark:border-matrix-primary dark:bg-zinc-950/60 dark:text-matrix-secondary",children:"No MCP servers found. Add a server to get started."}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:I.map(a=>e.jsx(ye,{server:a,probeResult:T[a.name],onEdit:V,onDelete:Q,onToggle:Y},`${a.name}-${a.enabled?"on":"off"}`))}),e.jsx(pe,{open:u,mode:n?"edit":"create",initial:n??void 0,onClose:()=>o(!1),onSubmit:B}),e.jsx(q,{open:v,onOpenChange:f,children:e.jsxs(H,{children:[e.jsx(U,{children:e.jsx(_,{children:"Confirm Deletion"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary",children:["Are you sure you want to delete the MCP server ",e.jsxs("span",{className:"font-semibold text-azure-text-primary dark:text-matrix-highlight",children:['"',N?.name,'"']}),"? This action cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",className:"rounded-md border border-azure-border px-4 py-2 text-sm text-azure-text-primary hover:border-azure-primary hover:text-azure-primary dark:border-matrix-primary dark:text-matrix-secondary hover:dark:border-matrix-highlight hover:dark:text-matrix-highlight",onClick:()=>f(!1),children:"Cancel"}),e.jsx("button",{type:"button",className:"rounded-md bg-red-500 px-4 py-2 text-sm font-semibold text-white shadow hover:bg-red-400 dark:bg-red-600 hover:dark:bg-red-500",onClick:W,children:"Delete"})]})]})]})})]})};export{Ce as MCPManager};
@@ -0,0 +1 @@
1
+ import{j as e,m}from"./vendor-motion-C3CZ8ZlO.js";import{r as o}from"./vendor-react-DikRIOlj.js";import{u as M}from"./vendor-utils-D4NnWbOU.js";import{h as u,D as j,d as z,e as v,j as N}from"./index-Cwqr-n0Y.js";import{i as F,a5 as E,w as I,z as R}from"./vendor-icons-BVuQI-6R.js";const g={list:()=>u.get("/model-pricing"),upsert:a=>u.post("/model-pricing",a),update:(a,s,p)=>u.put(`/model-pricing/${encodeURIComponent(a)}/${encodeURIComponent(s)}`,p),delete:(a,s)=>u.delete(`/model-pricing/${encodeURIComponent(a)}/${encodeURIComponent(s)}`)},T={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},_={hidden:{opacity:0,y:10},show:{opacity:1,y:0}},A=["anthropic","openai","google","openrouter","ollama","other"],w=()=>({provider:"",model:"",input_price_per_1m:0,output_price_per_1m:0,audio_cost_per_second:null}),V=()=>{const{data:a=[],mutate:s}=M("/api/model-pricing",()=>g.list()),[p,n]=o.useState(!1),[l,b]=o.useState(null),[t,i]=o.useState(w()),[d,c]=o.useState(null),[h,y]=o.useState(null),[k,f]=o.useState(!1),x=(r,D)=>{y({type:r,message:D}),setTimeout(()=>y(null),3e3)},C=()=>{b(null),i(w()),n(!0)},$=r=>{b(r),i({...r}),n(!0)},S=async()=>{if(!(!t.provider.trim()||!t.model.trim())){f(!0);try{await g.upsert(t),await s(),n(!1),x("success",l?"Pricing updated.":"Pricing created.")}catch{x("error","Failed to save pricing entry.")}finally{f(!1)}}},P=async()=>{if(d)try{await g.delete(d.provider,d.model),await s(),c(null),x("success","Pricing entry deleted.")}catch{x("error","Failed to delete pricing entry.")}};return e.jsxs(m.div,{variants:T,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(m.div,{variants:_,className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(F,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Model Pricing"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary mt-0.5",children:"Manage per-model pricing to estimate LLM costs in Usage Stats."})]})]}),e.jsxs("button",{onClick:C,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-matrix-highlight text-sm font-medium hover:opacity-90 transition-opacity",children:[e.jsx(E,{className:"w-4 h-4"})," Add Pricing"]})]}),h&&e.jsx(m.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},className:`px-4 py-3 rounded-lg text-sm font-medium border ${h.type==="success"?"bg-green-50 dark:bg-green-900/20 border-green-300 dark:border-green-700 text-green-800 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 border-red-300 dark:border-red-700 text-red-800 dark:text-red-400"}`,children:h.message}),e.jsx(m.div,{variants:_,className:"rounded-lg border border-azure-border dark:border-matrix-primary overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-azure-surface dark:bg-zinc-900 border-b border-azure-border dark:border-matrix-primary",children:e.jsx("tr",{children:["Provider","Model","Input ($/1M tokens)","Output ($/1M tokens)","Audio ($/s)","Actions"].map(r=>e.jsx("th",{className:"px-4 py-3 text-left font-semibold text-azure-text-secondary dark:text-matrix-secondary",children:r},r))})}),e.jsx("tbody",{children:a.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-azure-text-secondary dark:text-matrix-secondary",children:'No pricing entries. Click "Add Pricing" to get started.'})}):a.map(r=>e.jsxs("tr",{className:"border-b border-azure-border dark:border-matrix-primary/30 hover:bg-azure-surface/50 dark:hover:bg-zinc-800/50 transition-colors",children:[e.jsx("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text capitalize",children:r.provider}),e.jsx("td",{className:"px-4 py-3 font-mono text-azure-text-primary dark:text-matrix-highlight text-xs",children:r.model}),e.jsxs("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text",children:["$",r.input_price_per_1m.toFixed(4)]}),e.jsxs("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text",children:["$",r.output_price_per_1m.toFixed(4)]}),e.jsx("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text",children:r.audio_cost_per_second!=null?`$${r.audio_cost_per_second.toFixed(6)}`:e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-secondary/40",children:"—"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>$(r),className:"p-1.5 rounded hover:bg-azure-border dark:hover:bg-matrix-primary/30 text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",title:"Edit",children:e.jsx(I,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>c(r),className:"p-1.5 rounded hover:bg-red-50 dark:hover:bg-red-900/20 text-azure-text-secondary dark:text-matrix-secondary hover:text-red-600 dark:hover:text-red-400 transition-colors",title:"Delete",children:e.jsx(R,{className:"w-4 h-4"})})]})})]},`${r.provider}/${r.model}`))})]})}),e.jsx(j,{open:p,onOpenChange:n,children:e.jsxs(z,{children:[e.jsx(v,{children:e.jsx(N,{children:l?"Edit Pricing":"Add Pricing"})}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Provider"}),l?e.jsx("p",{className:"px-3 py-2 rounded-lg bg-azure-bg dark:bg-zinc-900 text-azure-text-primary dark:text-matrix-secondary text-sm capitalize",children:t.provider}):e.jsxs("select",{value:t.provider,onChange:r=>i({...t,provider:r.target.value}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight",children:[e.jsx("option",{value:"",children:"Select provider..."}),A.map(r=>e.jsx("option",{value:r,children:r},r))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Model"}),l?e.jsx("p",{className:"px-3 py-2 rounded-lg bg-azure-bg dark:bg-zinc-900 text-azure-text-primary dark:text-matrix-secondary text-sm font-mono",children:t.model}):e.jsx("input",{type:"text",value:t.model,onChange:r=>i({...t,model:r.target.value}),placeholder:"e.g. gpt-4o",className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Input price / 1M tokens ($)"}),e.jsx("input",{type:"number",min:0,step:.001,value:t.input_price_per_1m,onChange:r=>i({...t,input_price_per_1m:parseFloat(r.target.value)||0}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Output price / 1M tokens ($)"}),e.jsx("input",{type:"number",min:0,step:.001,value:t.output_price_per_1m,onChange:r=>i({...t,output_price_per_1m:parseFloat(r.target.value)||0}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:["Audio price / second ($)",e.jsx("span",{className:"ml-2 text-[11px] font-normal text-azure-text-secondary/60 dark:text-matrix-secondary/40",children:"for Whisper/audio-only models · leave blank for token-based"})]}),e.jsx("input",{type:"number",min:0,step:1e-6,placeholder:"e.g. 0.0001 (Whisper = $0.006/min)",value:t.audio_cost_per_second??"",onChange:r=>i({...t,audio_cost_per_second:r.target.value===""?null:parseFloat(r.target.value)}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight placeholder-azure-text-secondary/40 dark:placeholder-matrix-secondary/30"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:()=>n(!1),className:"px-4 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary text-sm hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:S,disabled:k||!t.provider.trim()||!t.model.trim(),className:"px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-matrix-highlight text-sm font-medium hover:opacity-90 disabled:opacity-50 transition-opacity",children:k?"Saving...":"Save"})]})]})]})}),e.jsx(j,{open:!!d,onOpenChange:r=>!r&&c(null),children:e.jsxs(z,{children:[e.jsx(v,{children:e.jsx(N,{children:"Delete Pricing Entry"})}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("p",{className:"text-sm text-azure-text-primary dark:text-matrix-text",children:["Are you sure you want to delete the pricing for"," ",e.jsxs("span",{className:"font-mono font-semibold text-azure-primary dark:text-matrix-highlight",children:[d?.provider,"/",d?.model]}),"? This cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>c(null),className:"px-4 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary text-sm hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:P,className:"px-4 py-2 rounded-lg bg-red-600 text-white text-sm font-medium hover:bg-red-700 transition-colors",children:"Delete"})]})]})]})})]})};export{V as ModelPricing};
@@ -0,0 +1 @@
1
+ import{j as e,m as n}from"./vendor-motion-C3CZ8ZlO.js";import{r as i,L as P}from"./vendor-react-DikRIOlj.js";import{u as S}from"./vendor-utils-D4NnWbOU.js";import{w as y,D as _,e as D,j as R}from"./index-Cwqr-n0Y.js";import{P as O}from"./Pagination-JsiwxVNQ.js";import{B as k,a7 as A,a8 as F,a9 as B,Z as L,p as W,q as E,h as J}from"./vendor-icons-BVuQI-6R.js";const M={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},g={hidden:{opacity:0,y:10},show:{opacity:1,y:0}},j=({status:r})=>r==="completed"?e.jsxs("div",{className:"flex items-center gap-1.5 text-green-600 dark:text-green-400",children:[e.jsx(W,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs",children:"Completed"})]}):r==="failed"?e.jsxs("div",{className:"flex items-center gap-1.5 text-red-600 dark:text-red-400",children:[e.jsx(E,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs",children:"Failed"})]}):e.jsxs("div",{className:"flex items-center gap-1.5 text-yellow-600 dark:text-yellow-400",children:[e.jsx(J,{className:"w-4 h-4 animate-pulse"}),e.jsx("span",{className:"text-xs",children:"Pending"})]}),x=r=>new Date(r).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),U=r=>{try{return JSON.stringify(JSON.parse(r),null,2)}catch{return r}},X=()=>{const[r,f]=i.useState(!1),[c,N]=i.useState("all"),[m,d]=i.useState(1),[h,v]=i.useState(20),[a,u]=i.useState(null),{data:s,mutate:z}=S(["/webhooks/notifications",r,c,m,h],()=>y.listNotifications({unreadOnly:r,status:c,page:m,per_page:h}),{refreshInterval:5e3}),o=s?.data??[],l=o.filter(t=>!t.read).length,b=async t=>{t.length!==0&&(await y.markRead(t),await z())},w=()=>{const t=o.filter(p=>!p.read).map(p=>p.id);b(t)},C=async t=>{u(t),t.read||await b([t.id])};return e.jsxs(n.div,{variants:M,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(n.div,{variants:g,className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:[e.jsx(k,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"}),l>0&&e.jsx("span",{className:"absolute -top-1.5 -right-1.5 bg-red-500 text-white text-[10px] font-bold rounded-full w-4 h-4 flex items-center justify-center leading-none",children:l>9?"9+":l})]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Notifications"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary mt-0.5",children:"Webhook execution results from the Oracle agent."})]})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs(P,{to:"/webhooks",className:"flex items-center gap-2 text-sm text-azure-text-secondary dark:text-matrix-dim hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",children:[e.jsx(A,{className:"w-4 h-4"}),"Back to Webhooks"]}),e.jsxs("select",{value:c,onChange:t=>{N(t.target.value),d(1)},className:"px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black text-azure-text-secondary dark:text-matrix-dim text-sm focus:outline-none focus:border-azure-primary dark:focus:border-matrix-highlight",children:[e.jsx("option",{value:"all",children:"All statuses"}),e.jsx("option",{value:"completed",children:"Completed"}),e.jsx("option",{value:"failed",children:"Failed"}),e.jsx("option",{value:"pending",children:"Pending"})]}),e.jsxs("button",{onClick:()=>{f(!r),d(1)},className:`flex items-center gap-2 px-3 py-2 rounded-lg border text-sm transition-colors ${r?"border-azure-primary dark:border-matrix-highlight bg-azure-active dark:bg-matrix-primary/20 text-azure-primary dark:text-matrix-highlight":"border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-dim hover:bg-azure-surface dark:hover:bg-zinc-800"}`,children:[e.jsx(F,{className:"w-4 h-4"}),"Unread only"]}),l>0&&e.jsxs("button",{onClick:w,className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-sm text-azure-text-secondary dark:text-matrix-dim hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:[e.jsx(B,{className:"w-4 h-4"}),"Mark all read"]})]})]}),e.jsx(n.div,{variants:g,className:"rounded-lg border border-azure-border dark:border-matrix-primary overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-azure-surface dark:bg-zinc-900 border-b border-azure-border dark:border-matrix-primary",children:e.jsx("tr",{children:["","Webhook","Status","Created","Completed","Actions"].map(t=>e.jsx("th",{className:"px-4 py-3 text-left font-semibold text-azure-text-secondary dark:text-matrix-dim",children:t},t))})}),e.jsx("tbody",{children:o.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-azure-text-secondary dark:text-matrix-dim",children:r?"No unread notifications.":"No notifications yet."})}):o.map(t=>e.jsxs("tr",{className:`border-b border-azure-border dark:border-matrix-primary/30 hover:bg-azure-surface/50 dark:hover:bg-zinc-800/50 transition-colors ${t.read?"":"bg-blue-50/40 dark:bg-blue-900/10"}`,children:[e.jsx("td",{className:"px-4 py-3 w-6",children:!t.read&&e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-blue-500 dark:bg-matrix-highlight"})}),e.jsx("td",{className:"px-4 py-3 font-mono font-medium text-azure-text-primary dark:text-matrix-text",children:t.webhook_name}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(j,{status:t.status})}),e.jsx("td",{className:"px-4 py-3 text-xs text-azure-text-secondary dark:text-matrix-dim whitespace-nowrap",children:x(t.created_at)}),e.jsx("td",{className:"px-4 py-3 text-xs text-azure-text-secondary dark:text-matrix-dim whitespace-nowrap",children:t.completed_at?x(t.completed_at):"—"}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("button",{onClick:()=>C(t),title:"View details",className:"p-1.5 rounded hover:bg-azure-border dark:hover:bg-matrix-primary/30 text-azure-text-secondary dark:text-matrix-dim hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",children:e.jsx(L,{className:"w-4 h-4"})})})]},t.id))})]})})}),s&&s.total_pages>1&&e.jsx(n.div,{variants:g,children:e.jsx("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black",children:e.jsx(O,{page:m,totalPages:s.total_pages,perPage:h,total:s.total,onPageChange:d,onPerPageChange:t=>{v(t),d(1)}})})}),e.jsxs(_,{open:!!a,onOpenChange:t=>!t&&u(null),children:[e.jsx(D,{children:e.jsxs(R,{className:"text-azure-text-primary dark:text-matrix-highlight flex items-center gap-2",children:[e.jsx(k,{className:"w-4 h-4"}),a?.webhook_name]})}),a&&e.jsxs("div",{className:"p-6 space-y-4 overflow-y-auto max-h-[65vh]",children:[e.jsxs("div",{className:"flex items-center gap-4 text-xs text-azure-text-secondary dark:text-matrix-dim",children:[e.jsx(j,{status:a.status}),e.jsx("span",{children:x(a.created_at)}),a.completed_at&&e.jsxs("span",{children:["→ ",x(a.completed_at)]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-azure-text-secondary dark:text-matrix-dim mb-1.5",children:"Received Payload"}),e.jsx("pre",{className:"bg-azure-bg dark:bg-zinc-950 rounded-lg p-3 text-xs font-mono overflow-auto max-h-44 text-azure-text-primary dark:text-matrix-text border border-azure-border dark:border-matrix-primary/30 whitespace-pre-wrap",children:U(a.payload)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-azure-text-secondary dark:text-matrix-dim mb-1.5",children:"Agent Result"}),e.jsx("div",{className:"bg-azure-bg dark:bg-zinc-950 rounded-lg p-3 text-xs font-mono overflow-auto max-h-64 text-azure-text-primary dark:text-matrix-text border border-azure-border dark:border-matrix-primary/30 whitespace-pre-wrap",children:a.result??e.jsx("span",{className:"text-yellow-600 dark:text-yellow-400 animate-pulse",children:"Processing…"})})]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx("button",{onClick:()=>u(null),className:"px-4 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-dim text-sm hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:"Close"})})]})]})]})};export{X as Notifications};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{ai as c,o as m}from"./vendor-icons-BVuQI-6R.js";function b({page:r,totalPages:i,perPage:a,total:s,onPageChange:d,onPerPageChange:o,perPageOptions:l=[10,20,50,100]}){const x="flex items-center gap-1 px-3 py-1.5 rounded border text-sm transition-colors disabled:opacity-40 disabled:cursor-not-allowed",n="border-azure-border dark:border-matrix-primary text-azure-text dark:text-matrix-secondary hover:border-azure-primary dark:hover:border-matrix-highlight hover:text-azure-primary dark:hover:text-matrix-highlight";return e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 px-4 py-3 border-t border-azure-border dark:border-matrix-primary",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:[e.jsx("span",{children:"Rows per page:"}),e.jsx("select",{value:a,onChange:t=>o(Number(t.target.value)),className:"px-2 py-1 rounded border border-azure-border dark:border-matrix-primary bg-white dark:bg-black text-azure-text dark:text-matrix-secondary text-sm focus:outline-none focus:border-azure-primary dark:focus:border-matrix-highlight",children:l.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary whitespace-nowrap",children:s===0?"0 records":`${(r-1)*a+1}–${Math.min(r*a,s)} of ${s}`}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("button",{onClick:()=>d(r-1),disabled:r<=1,className:`${x} ${n}`,title:"Previous page",children:[e.jsx(c,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Prev"})]}),e.jsxs("span",{className:"px-3 py-1.5 text-sm text-azure-text dark:text-matrix-secondary tabular-nums",children:[r," / ",i||1]}),e.jsxs("button",{onClick:()=>d(r+1),disabled:r>=i,className:`${x} ${n}`,title:"Next page",children:[e.jsx("span",{className:"hidden sm:inline",children:"Next"}),e.jsx(m,{className:"w-4 h-4"})]})]})]})]})}export{b as P};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as i}from"./vendor-react-DikRIOlj.js";import{B as j,h as N}from"./index-Cwqr-n0Y.js";import{M as de,D as oe}from"./DeleteConfirmationModal-A8EmnHoa.js";import{Q as xe,V as me,Y as H,h as ue,Z as O,_ as he,$ as ge,A as pe,z as B,a0 as fe}from"./vendor-icons-BVuQI-6R.js";import{P as je}from"./Pagination-JsiwxVNQ.js";import"./vendor-utils-D4NnWbOU.js";const ye=({className:r,...a})=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{className:`w-full caption-bottom text-sm ${r}`,...a})}),be=({...r})=>e.jsx("thead",{...r}),ke=({...r})=>e.jsx("tbody",{...r}),M=({...r})=>e.jsx("tr",{className:"border-b border-azure-border dark:border-matrix-primary/30 transition-colors hover:bg-azure-hover/50 dark:hover:bg-matrix-primary/10",...r}),f=({className:r,...a})=>e.jsx("th",{className:`h-12 px-4 text-left align-middle font-medium text-azure-text-secondary dark:text-matrix-secondary/70 [&:has([role=checkbox])]:pr-0 ${r}`,...a}),g=({className:r,...a})=>e.jsx("td",{className:`p-4 align-middle [&:has([role=checkbox])]:pr-0 ${r}`,...a}),F=({checked:r,onCheckedChange:a,className:s,...n})=>{const l=x=>{a&&a(x.target.checked),n.onChange&&n.onChange(x)};return e.jsx("input",{type:"checkbox",checked:r,onChange:l,className:`h-4 w-4 rounded border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-primary dark:text-matrix-highlight focus:ring-azure-primary dark:focus:ring-matrix-highlight ${s||""}`,...n})},v=({className:r,variant:a="default",...s})=>{const l=`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-zinc-950 focus:ring-offset-2 dark:focus:ring-zinc-300 ${a==="destructive"?"border-transparent bg-red-500 text-zinc-50 dark:bg-red-900 dark:text-zinc-50":a==="secondary"?"border-transparent bg-azure-surface dark:bg-zinc-800 text-azure-text-secondary dark:text-matrix-secondary":a==="outline"?"text-azure-text-primary dark:text-matrix-secondary border-azure-border dark:border-matrix-primary":"border-transparent bg-azure-primary dark:bg-matrix-highlight text-azure-text-inverse dark:text-black"} ${r||""}`;return e.jsx("div",{className:l,...s})},T=({className:r,...a})=>e.jsx("div",{className:`rounded-lg border border-azure-border dark:border-matrix-primary/30 bg-azure-surface dark:bg-zinc-900 text-azure-text-primary dark:text-matrix-secondary shadow-sm ${r||""}`,...a}),I=({className:r,...a})=>e.jsx("div",{className:`flex flex-col space-y-1.5 p-6 ${r||""}`,...a}),Ne=({className:r,...a})=>e.jsx("h3",{className:`text-2xl font-semibold leading-none tracking-tight ${r||""}`,...a}),A=({className:r,...a})=>e.jsx("div",{className:`p-6 pt-0 ${r||""}`,...a}),ve=({className:r,variant:a="default",...s})=>{const l=`relative w-full rounded-lg border p-4 ${a==="destructive"?"border-red-500/50 text-red-700 dark:border-red-900/50 dark:text-red-300":"border-azure-border dark:border-matrix-primary"} ${r||""}`;return e.jsx("div",{className:l,...s})},ze=({className:r,...a})=>e.jsx("div",{className:`text-sm [&_p]:leading-relaxed ${r||""}`,...a}),we=({isOpen:r,onClose:a,memory:s})=>s?e.jsx(de,{isOpen:r,onClose:a,title:"Memory Details",size:"lg",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Category"})]}),e.jsx("div",{children:e.jsx(v,{variant:"outline",children:s.category})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Importance"})]}),e.jsx("div",{children:e.jsx(v,{variant:s.importance==="critical"?"destructive":s.importance==="high"?"default":s.importance==="medium"?"secondary":"outline",children:s.importance})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Created"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary",children:new Date(s.created_at).toLocaleString()}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ue,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Updated"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary",children:new Date(s.updated_at).toLocaleString()}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Access Count"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary",children:s.access_count}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Hash"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary break-all text-sm",children:s.hash}),s.source&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ge,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Source"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary",children:s.source})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm mb-2",children:"Summary"}),e.jsx("p",{className:"text-azure-text-primary dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 p-3 rounded-md",children:s.summary})]}),s.details&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm mb-2",children:"Details"}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 p-3 rounded-md whitespace-pre-wrap",children:s.details})]}),e.jsx("div",{className:"flex justify-end pt-4",children:e.jsx(j,{onClick:a,children:"Close"})})]})}):null,Ce=()=>{const[r,a]=i.useState(!1),[s,n]=i.useState(null),l=i.useCallback(o=>(a(!0),n(null),N.get(o).then(c=>c).catch(c=>{throw n(c.message||"An error occurred"),c}).finally(()=>{a(!1)})),[]),x=i.useCallback((o,c)=>(a(!0),n(null),N.post(o,c).then(d=>d).catch(d=>{throw n(d.message||"An error occurred"),d}).finally(()=>{a(!1)})),[]),m=i.useCallback((o,c)=>(a(!0),n(null),N.post(o,c).then(d=>d).catch(d=>{throw n(d.message||"An error occurred"),d}).finally(()=>{a(!1)})),[]),z=i.useCallback(o=>(a(!0),n(null),N.delete(o).then(c=>c).catch(c=>{throw n(c.message||"An error occurred"),c}).finally(()=>{a(!1)})),[]);return{get:l,post:x,put:m,del:z,loading:r,error:s}},_e=()=>{const[r,a]=i.useState([]),[s,n]=i.useState(!0),[l,x]=i.useState([]),[m,z]=i.useState(""),[o,c]=i.useState("all"),[d,R]=i.useState("all"),[u,y]=i.useState(1),[h,U]=i.useState(20),[V,q]=i.useState(0),[$,Q]=i.useState(1),[P,b]=i.useState(null),[Y,w]=i.useState(!1),[Z,G]=i.useState(null),[J,_]=i.useState(!1),[E,L]=i.useState(null),[K,C]=i.useState(!1),{get:W,del:X,post:ee}=Ce(),S=i.useCallback(async(t=u,D=h)=>{try{n(!0);const p=new URLSearchParams({page:String(t),per_page:String(D)});o!=="all"&&p.set("category",o),d!=="all"&&p.set("importance",d),m.trim()&&p.set("search",m.trim());const k=await W(`/sati/memories?${p}`);a(k.data??k),q(k.total??0),Q(k.total_pages??1),b(null)}catch(p){b("Failed to load memories. Please try again."),console.error("Error fetching memories:",p)}finally{n(!1)}},[u,h,o,d,m]);i.useEffect(()=>{S(u,h)},[u,h,o,d,m]);const te=()=>{l.length===r.length?x([]):x(r.map(t=>t.id))},re=t=>{l.includes(t)?x(l.filter(D=>D!==t)):x([...l,t])},ae=async()=>{if(l.length!==0)try{await ee("/sati/memories/bulk-delete",{ids:l}),await S(u,h),x([]),w(!1)}catch(t){b("Failed to delete memories. Please try again."),console.error("Error deleting memories:",t)}},se=t=>{L(t),C(!0)},ie=async()=>{if(E)try{await X(`/sati/memories/${E}`),await S(u,h)}catch(t){b("Failed to delete memory. Please try again."),console.error("Error deleting memory:",t)}finally{L(null),C(!1)}},le=t=>{G(t),_(!0)},ne=["preference","project","identity","constraint","context","personal_data","languages","favorite_things","relationships","pets","naming","professional_profile"],ce=["low","medium","high"];return s&&r.length===0?e.jsx(T,{className:"w-full",children:e.jsx(A,{className:"flex justify-center items-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-azure-primary dark:border-matrix-highlight"})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(pe,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Sati Memories"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"View and manage long-term memories stored by Sati."})]})]}),l.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm text-azure-text-muted dark:text-matrix-secondary",children:[l.length," selected"]}),e.jsxs(j,{variant:"destructive",size:"sm",onClick:()=>w(!0),disabled:l.length===0,children:[e.jsx(B,{className:"w-4 h-4 mr-1"}),"Delete Selected"]})]})]}),P&&e.jsx(ve,{variant:"destructive",children:e.jsx(ze,{children:P})}),e.jsxs(T,{children:[e.jsx(I,{className:"border-b border-azure-border dark:border-matrix-primary",children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e.jsxs("div",{className:"flex flex-col relative w-full",children:[e.jsx(fe,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-azure-text-secondary dark:text-matrix-secondary w-4 h-4"}),e.jsx("input",{type:"text",placeholder:"Search memories...",value:m,onChange:t=>{z(t.target.value),y(1)},className:"w-full pl-10 pr-4 py-2 bg-azure-surface dark:bg-black border border-azure-border dark:border-matrix-primary rounded-md text-azure-text-primary dark:text-matrix-secondary focus:outline-none focus:ring-2 focus:ring-azure-primary dark:focus:ring-matrix-highlight"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsxs("select",{value:o,onChange:t=>{c(t.target.value),y(1)},className:"px-3 py-2 bg-azure-surface dark:bg-black border border-azure-border dark:border-matrix-primary rounded-md text-azure-text-primary dark:text-matrix-secondary focus:outline-none focus:ring-2 focus:ring-azure-primary dark:focus:ring-matrix-highlight flex-grow",children:[e.jsx("option",{value:"all",children:"All Categories"}),ne.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsxs("select",{value:d,onChange:t=>{R(t.target.value),y(1)},className:"px-3 py-2 bg-azure-surface dark:bg-black border border-azure-border dark:border-matrix-primary rounded-md text-azure-text-primary dark:text-matrix-secondary focus:outline-none focus:ring-2 focus:ring-azure-primary dark:focus:ring-matrix-highlight flex-grow",children:[e.jsx("option",{value:"all",children:"All Importance"}),ce.map(t=>e.jsx("option",{value:t,children:t},t))]})]})]})}),e.jsx(A,{className:"p-0",children:e.jsxs(ye,{children:[e.jsx(be,{children:e.jsxs(M,{className:"hover:bg-transparent",children:[e.jsx(f,{className:"w-12",children:e.jsx(F,{checked:r.length>0&&l.length===r.length,onCheckedChange:te})}),e.jsx(f,{children:"Summary"}),e.jsx(f,{children:"Category"}),e.jsx(f,{children:"Importance"}),e.jsx(f,{children:"Created"}),e.jsx(f,{className:"w-32",children:"Actions"})]})}),e.jsx(ke,{children:r.length===0?e.jsx(M,{children:e.jsx(g,{colSpan:6,className:"text-center py-8 text-azure-text-secondary dark:text-matrix-secondary",children:s?"Loading memories...":"No memories found"})}):r.map(t=>e.jsxs(M,{children:[e.jsx(g,{children:e.jsx(F,{checked:l.includes(t.id),onCheckedChange:()=>re(t.id)})}),e.jsx(g,{className:"font-medium max-w-xs truncate",children:t.summary}),e.jsx(g,{children:e.jsx(v,{variant:"outline",children:t.category})}),e.jsx(g,{children:e.jsx(v,{variant:t.importance==="critical"?"destructive":t.importance==="high"?"default":t.importance==="medium"?"secondary":"outline",children:t.importance})}),e.jsx(g,{children:e.jsxs("div",{className:"flex items-center gap-1 text-azure-text-secondary dark:text-matrix-secondary",children:[e.jsx(H,{className:"w-4 h-4"}),new Date(t.created_at).toLocaleDateString()]})}),e.jsx(g,{children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>le(t),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:e.jsx(O,{className:"w-4 h-4"})}),e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>se(t.id),className:"text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:e.jsx(B,{className:"w-4 h-4"})})]})})]},t.id))})]})}),$>1&&e.jsx(je,{page:u,totalPages:$,perPage:h,total:V,onPageChange:y,onPerPageChange:t=>{U(t),y(1)}})]}),Y&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs(T,{className:"w-full max-w-md mx-4",children:[e.jsx(I,{children:e.jsx(Ne,{children:"Delete Memories"})}),e.jsxs(A,{children:[e.jsxs("p",{className:"mb-4",children:["Are you sure you want to delete ",l.length," ","memory(ies)? This action cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(j,{variant:"outline",onClick:()=>w(!1),children:"Cancel"}),e.jsx(j,{variant:"destructive",onClick:ae,children:"Delete"})]})]})]})}),e.jsx(we,{isOpen:J,onClose:()=>_(!1),memory:Z}),e.jsx(oe,{isOpen:K,onClose:()=>C(!1),onConfirm:ie,title:"Confirm Memory Deletion",message:"Are you sure you want to delete this memory? This action cannot be undone.",confirmButtonText:"Delete Memory",cancelButtonText:"Cancel"})]})};export{_e as SatiMemories};
@@ -0,0 +1,9 @@
1
+ import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as h,f as B,c as U}from"./vendor-react-DikRIOlj.js";import{u as I}from"./audit-B-F8XPLi.js";import{E as f,q as F,F as S,J as L,m as J,h as E,I as D,ah as P,ar as O,G as M,o as T,ai as G,i as V,as as W,at as Z,N as q,a7 as H,au as X,r as K,a1 as Q}from"./vendor-icons-BVuQI-6R.js";import"./vendor-utils-D4NnWbOU.js";import"./index-Cwqr-n0Y.js";const Y={llm_call:e.jsx(O,{size:16}),tool_call:e.jsx(f,{size:16}),mcp_tool:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M3.49994 11.7501L11.6717 3.57855C12.7762 2.47398 14.5672 2.47398 15.6717 3.57855C16.7762 4.68312 16.7762 6.47398 15.6717 7.57855M15.6717 7.57855L9.49994 13.7501M15.6717 7.57855C16.7762 6.47398 18.5672 6.47398 19.6717 7.57855C20.7762 8.68312 20.7762 10.474 19.6717 11.5785L12.7072 18.543C12.3167 18.9335 12.3167 19.5667 12.7072 19.9572L13.9999 21.2499",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M17.4999 9.74921L11.3282 15.921C10.2237 17.0255 8.43272 17.0255 7.32823 15.921C6.22373 14.8164 6.22373 13.0255 7.32823 11.921L13.4999 5.74939",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),task_created:e.jsx(P,{size:16}),task_completed:e.jsx(S,{size:16}),skill_executed:e.jsx(D,{size:16}),chronos_job:e.jsx(E,{size:16}),memory_recovery:e.jsx(J,{size:16}),telephonist:e.jsx(L,{size:16})},ee={llm_call:"text-blue-400 dark:text-blue-400",tool_call:"text-amber-500 dark:text-amber-400",mcp_tool:"text-orange-500 dark:text-orange-400",task_created:"text-gray-500 dark:text-matrix-secondary",task_completed:"text-green-600 dark:text-matrix-highlight",skill_executed:"text-teal-600 dark:text-teal-400",chronos_job:"text-orange-500 dark:text-orange-400",memory_recovery:"text-emerald-600 dark:text-emerald-400",telephonist:"text-rose-500 dark:text-rose-400"},te={llm_call:"border-blue-300 dark:border-blue-500/40",tool_call:"border-amber-300 dark:border-amber-500/40",mcp_tool:"border-purple-300 dark:border-purple-500/40",task_created:"border-gray-300 dark:border-matrix-primary/40",task_completed:"border-green-300 dark:border-matrix-highlight/40",skill_executed:"border-teal-300 dark:border-teal-500/40",chronos_job:"border-orange-300 dark:border-orange-500/40",memory_recovery:"border-emerald-300 dark:border-emerald-500/40",telephonist:"border-rose-300 dark:border-rose-500/40"},re={oracle:"🔮",apoc:"🧑‍🔬",neo:"🥷",trinity:"👩‍💻",smith:"🤖",keymaker:"🗝️",chronos:"⏰",sati:"🧠",telephonist:"📞"},ae={oracle:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300",apoc:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",neo:"bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300",trinity:"bg-teal-100 text-teal-700 dark:bg-teal-900/40 dark:text-teal-300",smith:"bg-gray-200 text-gray-700 dark:bg-gray-700/60 dark:text-gray-300",keymaker:"bg-pink-100 text-pink-700 dark:bg-pink-900/40 dark:text-pink-300",chronos:"bg-orange-100 text-orange-700 dark:bg-orange-900/40 dark:text-orange-300",sati:"bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300",telephonist:"bg-rose-100 text-rose-700 dark:bg-rose-900/40 dark:text-rose-300"};function se(t){return t==null?"—":t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function oe(t){return t==null||t===0?"—":t<1e-4?"<$0.0001":`$${t.toFixed(4)}`}function ne(t,r){if(t==null&&r==null)return"";const i=t??0,a=r??0;return`↑${i.toLocaleString()} ↓${a.toLocaleString()}`}function C(t){return typeof t=="string"?t:JSON.stringify(t,null,2)}function ie({parsedMeta:t,eventType:r}){const i=r==="tool_call"||r==="mcp_tool",{args:a,result:s,...d}=t;return i&&(a!==void 0||s!==void 0)?e.jsxs("div",{className:"space-y-2",children:[a!==void 0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-gray-400 dark:text-matrix-secondary/50 mb-1",children:"args"}),e.jsx("pre",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words max-h-40 overflow-y-auto",children:C(a)})]}),s!==void 0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-gray-400 dark:text-matrix-secondary/50 mb-1",children:"result"}),e.jsx("pre",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words max-h-48 overflow-y-auto",children:C(s)})]}),Object.keys(d).length>0&&e.jsx("pre",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words",children:JSON.stringify(d,null,2)})]}):e.jsx("pre",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words max-h-48 overflow-y-auto",children:JSON.stringify(t,null,2)})}const z=({event:t})=>{const[r,i]=h.useState(!1),a=Y[t.event_type]??e.jsx(f,{size:14}),s=ee[t.event_type]??"text-gray-500",d=te[t.event_type]??"border-gray-300 dark:border-matrix-primary/40",c=t.agent?ae[t.agent]??"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300":null,x=t.agent?re[t.agent]:void 0,o=x?`${t.agent?.toUpperCase()} ${x}`:t.agent?.toUpperCase()||null,l=(()=>{try{return t.metadata?JSON.parse(t.metadata):null}catch{return null}})(),m=l!==null&&Object.keys(l).length>0,n=t.event_type==="memory_recovery"?`${l?.memories_count??0} memories retrieved`:t.event_type==="telephonist"?(()=>{const u=l?.audio_duration_seconds,p=l?.text_preview,R=u!=null?`${u}s`:"",A=typeof p=="string"&&p?`"${p.length>60?p.slice(0,60)+"…":p}"`:"";return[R,A].filter(Boolean).join(" · ")||"audio transcription"})():t.tool_name??t.model??t.event_type,g=t.event_type==="telephonist",j=l?.audio_duration_seconds,b=g?j!=null?`🎵 ${j}s audio`:"":ne(t.input_tokens,t.output_tokens),k=oe(t.estimated_cost_usd),N=se(t.duration_ms),v=t.status==="error"?e.jsx(F,{size:14,className:"text-red-500 flex-shrink-0"}):t.status==="success"?e.jsx(S,{size:14,className:"text-green-500 dark:text-matrix-highlight flex-shrink-0"}):null,_=e.jsx("span",{className:`flex-shrink-0 w-3.5 flex items-center justify-center transition-colors ${m?"text-gray-300 dark:text-matrix-secondary/30 hover:text-gray-500 dark:hover:text-matrix-secondary cursor-pointer":"text-transparent pointer-events-none"}`,children:r?e.jsx(M,{size:12}):e.jsx(T,{size:12})}),w=()=>{m&&i(u=>!u)};return e.jsxs("div",{className:"py-2 px-3 rounded-lg hover:bg-gray-50 dark:hover:bg-zinc-900/60 transition-colors border-b border-gray-100 dark:border-matrix-primary/20 last:border-0",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 md:hidden",children:[e.jsxs("div",{className:`flex items-center gap-2 min-w-0 ${m?"cursor-pointer":""}`,onClick:w,children:[_,e.jsx("span",{className:`flex-shrink-0 ${s}`,children:a}),c&&e.jsx("span",{className:`flex-shrink-0 text-xs font-semibold px-1.5 py-0.5 rounded ${c}`,children:o}),e.jsx("span",{className:"flex-1 text-sm text-gray-700 dark:text-matrix-secondary font-mono break-all leading-snug",children:n}),v]}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0 pl-5 text-[11px] text-gray-400 dark:text-matrix-secondary/60 font-mono",children:[b&&e.jsx("span",{children:b}),e.jsx("span",{children:N}),k!=="—"&&e.jsx("span",{className:"text-gray-600 dark:text-matrix-secondary",children:k})]})]}),e.jsxs("div",{className:`hidden md:flex items-center gap-3 ${m?"cursor-pointer":""}`,onClick:w,children:[_,e.jsx("span",{className:`flex-shrink-0 ${s}`,children:a}),c&&e.jsx("span",{className:`flex-shrink-0 text-xs font-semibold px-1.5 py-0.5 rounded ${c}`,children:o}),e.jsx("span",{className:"flex-1 text-sm truncate text-gray-700 dark:text-matrix-secondary font-mono",children:n}),b&&e.jsx("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono whitespace-nowrap",children:b}),e.jsx("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono w-16 text-right whitespace-nowrap",children:N}),v,e.jsx("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono w-20 text-right whitespace-nowrap",children:k})]}),r&&m&&l&&e.jsx("div",{className:`mt-1.5 ml-5 pl-3 border-l-2 ${d}`,children:e.jsx(ie,{parsedMeta:l,eventType:t.event_type})})]})},le=({events:t,page:r,pageSize:i,totalCount:a,onPageChange:s})=>{const d=Math.ceil(a/i),c=r*i+1,x=Math.min(r*i+t.length,a);if(t.length===0)return e.jsx("div",{className:"flex items-center justify-center h-40 text-gray-400 dark:text-matrix-secondary/50 text-sm",children:"No audit events for this session."});const o=[],l=new Map;for(const n of t)if(n.task_id){const g=l.get(n.task_id)??[];g.push(n),l.set(n.task_id,g)}const m=new Set;for(const n of t)n.task_id?m.has(n.task_id)||(m.add(n.task_id),o.push({taskId:n.task_id,events:l.get(n.task_id)})):o.push({taskId:null,events:[n]});return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"hidden md:flex items-center gap-3 px-3 py-1 text-xs text-gray-400 dark:text-matrix-secondary/60 border-b border-gray-200 dark:border-matrix-primary/30 font-mono",children:[e.jsx("span",{className:"w-4"}),e.jsx("span",{className:"w-14 flex-shrink-0",children:"agent"}),e.jsx("span",{className:"flex-1",children:"event / tool / model"}),e.jsx("span",{className:"w-28 text-right",children:"tokens ↑↓"}),e.jsx("span",{className:"w-16 text-right",children:"duration"}),e.jsx("span",{className:"w-4"}),e.jsx("span",{className:"w-20 text-right",children:"cost"})]}),e.jsx("div",{className:"flex flex-col",children:o.map(n=>n.taskId?e.jsxs("div",{className:"mb-1",children:[e.jsxs("div",{className:"px-3 py-1 text-xs text-gray-400 dark:text-matrix-secondary/50 font-mono border-l-2 border-blue-300 dark:border-matrix-primary/60 ml-1 mb-0.5",children:["task: ",n.taskId.slice(0,8),"…"]}),e.jsx("div",{className:"pl-4",children:n.events.map(g=>e.jsx(z,{event:g},g.id))})]},n.taskId):e.jsx(z,{event:n.events[0]},n.events[0].id))}),d>1&&e.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-200 dark:border-matrix-primary/30 mt-2",children:[e.jsxs("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60",children:[c,"–",x," of ",a," events"]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>s(r-1),disabled:r===0,className:"p-1 rounded text-gray-400 dark:text-matrix-secondary hover:text-gray-700 dark:hover:text-matrix-highlight disabled:opacity-30 transition-colors",children:e.jsx(G,{size:16})}),e.jsxs("span",{className:"text-xs self-center text-gray-500 dark:text-matrix-secondary font-mono px-2",children:[r+1," / ",d]}),e.jsx("button",{onClick:()=>s(r+1),disabled:r>=d-1,className:"p-1 rounded text-gray-400 dark:text-matrix-secondary hover:text-gray-700 dark:hover:text-matrix-highlight disabled:opacity-30 transition-colors",children:e.jsx(T,{size:16})})]})]})]})};function y(t){return t===0?"$0.00":t<1e-4?"<$0.0001":`$${t.toFixed(4)}`}function de(t){return t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(1)}s`:`${(t/6e4).toFixed(1)}m`}const xe=({summary:t})=>e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-matrix-primary p-4 bg-white dark:bg-black",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-700 dark:text-matrix-highlight mb-3 flex items-center gap-2",children:[e.jsx(V,{size:14})," Total Cost"]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-matrix-highlight font-mono",children:y(t.totalCostUsd)}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs text-gray-500 dark:text-matrix-secondary",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(O,{size:12,className:"text-blue-400"}),e.jsxs("span",{children:[t.llmCallCount," LLM calls"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(f,{size:12,className:"text-amber-400"}),e.jsxs("span",{children:[t.toolCallCount," tool calls"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 col-span-2",children:[e.jsx(E,{size:12,className:"text-gray-400"}),e.jsxs("span",{children:[de(t.totalDurationMs)," total duration"]})]}),t.totalAudioSeconds>0&&e.jsxs("div",{className:"flex items-center gap-1.5 col-span-2",children:[e.jsx(L,{size:12,className:"text-rose-400"}),e.jsxs("span",{children:[t.totalAudioSeconds.toFixed(1),"s audio"]})]})]})]}),t.byAgent.length>0&&e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-matrix-primary p-4 bg-white dark:bg-black",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-matrix-highlight mb-3",children:"By Agent"}),e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-gray-400 dark:text-matrix-secondary/60 border-b border-gray-100 dark:border-matrix-primary/30",children:[e.jsx("th",{className:"text-left pb-1.5",children:"Agent"}),e.jsx("th",{className:"text-right pb-1.5",children:"Calls"}),e.jsx("th",{className:"text-right pb-1.5",children:"Tokens"}),e.jsx("th",{className:"text-right pb-1.5",children:"Cost"})]})}),e.jsx("tbody",{children:t.byAgent.map(r=>e.jsxs("tr",{className:"border-b border-gray-50 dark:border-matrix-primary/10 last:border-0",children:[e.jsx("td",{className:"py-1.5 text-gray-700 dark:text-matrix-secondary font-semibold",children:r.agent}),e.jsx("td",{className:"py-1.5 text-right text-gray-500 dark:text-matrix-secondary/70 font-mono",children:r.llmCalls}),e.jsx("td",{className:"py-1.5 text-right text-gray-500 dark:text-matrix-secondary/70 font-mono",children:(r.inputTokens+r.outputTokens).toLocaleString()}),e.jsx("td",{className:"py-1.5 text-right text-gray-700 dark:text-matrix-highlight font-mono",children:y(r.estimatedCostUsd)})]},r.agent))})]})]}),t.byModel.length>0&&e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-matrix-primary p-4 bg-white dark:bg-black",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-matrix-highlight mb-3",children:"By Model"}),e.jsx("div",{className:"flex flex-col gap-2",children:t.byModel.map(r=>e.jsxs("div",{className:"border-b border-gray-50 dark:border-matrix-primary/10 last:border-0 pb-2 last:pb-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-0.5",children:[e.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-matrix-secondary break-all leading-snug",children:r.model}),e.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-matrix-highlight whitespace-nowrap shrink-0",children:y(r.estimatedCostUsd)})]}),e.jsxs("div",{className:"text-[11px] text-gray-400 dark:text-matrix-secondary/60 font-mono flex flex-wrap gap-x-3",children:[e.jsxs("span",{children:[r.calls," calls"]}),e.jsxs("span",{children:["in ",r.inputTokens.toLocaleString()]}),e.jsxs("span",{children:["out ",r.outputTokens.toLocaleString()]})]})]},`${r.provider}/${r.model}`))})]})]});function ce(t,r){const i=new Blob([JSON.stringify(r,null,2)],{type:"application/json"}),a=URL.createObjectURL(i),s=document.createElement("a");s.href=a,s.download=`audit-${t.slice(0,8)}.json`,s.click(),URL.revokeObjectURL(a)}function me(t,r){const i=["id","created_at","event_type","agent","tool_name","provider","model","input_tokens","output_tokens","duration_ms","status","estimated_cost_usd"],a=r.events.map(o=>[o.id,new Date(o.created_at).toISOString(),o.event_type,o.agent??"",o.tool_name??"",o.provider??"",o.model??"",o.input_tokens??"",o.output_tokens??"",o.duration_ms??"",o.status??"",o.estimated_cost_usd??""].map(l=>`"${String(l).replace(/"/g,'""')}"`).join(",")),s=[i.join(","),...a].join(`
2
+ `),d=new Blob([s],{type:"text/csv"}),c=URL.createObjectURL(d),x=document.createElement("a");x.href=c,x.download=`audit-${t.slice(0,8)}.csv`,x.click(),URL.revokeObjectURL(c)}const ge=({sessionId:t,data:r})=>{const[i,a]=h.useState(!1);return r?e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>a(!i),className:"flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-matrix-primary text-gray-600 dark:text-matrix-secondary hover:text-gray-900 dark:hover:text-matrix-highlight hover:border-gray-300 dark:hover:border-matrix-highlight transition-colors",children:[e.jsx(W,{size:14}),"Export",e.jsx(M,{size:12})]}),i&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>a(!1)}),e.jsxs("div",{className:"absolute right-0 top-full mt-1 z-20 bg-white dark:bg-black border border-gray-200 dark:border-matrix-primary rounded-lg shadow-xl min-w-[140px] py-1",children:[e.jsxs("button",{onClick:()=>{ce(t,r),a(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-matrix-secondary hover:bg-gray-50 dark:hover:bg-zinc-900 transition-colors",children:[e.jsx(Z,{size:14,className:"text-blue-500"}),"Export JSON"]}),e.jsxs("button",{onClick:()=>{me(t,r),a(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-matrix-secondary hover:bg-gray-50 dark:hover:bg-zinc-900 transition-colors",children:[e.jsx(q,{size:14,className:"text-green-500"}),"Export CSV"]})]})]})]}):null},$=100,fe=()=>{const{id:t}=B(),r=U(),[i,a]=h.useState(0),{data:s,error:d,isLoading:c}=I(t??null,i,$),x=h.useRef(null),[o,l]=h.useState(()=>typeof window<"u"?window.innerWidth>=768:!0);return h.useEffect(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[s]),e.jsxs("div",{className:"flex flex-col h-full bg-gray-50 dark:bg-black",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-matrix-primary bg-white dark:bg-black flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>r(-1),className:"p-1.5 rounded-lg text-gray-400 dark:text-matrix-secondary hover:text-gray-700 dark:hover:text-matrix-highlight hover:bg-gray-100 dark:hover:bg-zinc-900 transition-colors",children:e.jsx(H,{size:18})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-matrix-highlight",children:"Session Audit"}),e.jsx("p",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono",children:t})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>l(m=>!m),className:"p-1.5 rounded-lg text-gray-400 dark:text-matrix-secondary hover:text-gray-700 dark:hover:text-matrix-highlight hover:bg-gray-100 dark:hover:bg-zinc-900 transition-colors md:hidden",title:"Toggle summary panel",children:e.jsx(X,{size:18})}),e.jsx(ge,{sessionId:t??"",data:s})]})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden relative",children:[o&&e.jsx("div",{className:"fixed inset-0 bg-black/40 z-20 md:hidden",onClick:()=>l(!1)}),e.jsxs("div",{ref:x,className:"flex-[6] overflow-y-auto p-6 custom-scrollbar",children:[c&&e.jsxs("div",{className:"flex items-center justify-center h-40 gap-2 text-gray-400 dark:text-matrix-secondary",children:[e.jsx(K,{size:18,className:"animate-spin"}),"Loading audit events…"]}),d&&e.jsxs("div",{className:"flex items-center gap-2 text-red-500 dark:text-red-400 p-4 rounded-lg border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20",children:[e.jsx(Q,{size:16}),"Failed to load audit events: ",d.message]}),s&&e.jsx(le,{events:s.events,page:i,pageSize:$,totalCount:s.summary.llmCallCount+s.summary.toolCallCount,onPageChange:a})]}),e.jsx("div",{className:`
3
+ fixed top-16 bottom-0 right-0 z-40 w-72
4
+ md:relative md:inset-auto md:z-auto md:w-auto md:flex-[4] md:translate-x-0
5
+ transition-transform duration-300 ease-out
6
+ overflow-y-auto p-6 border-l border-gray-200 dark:border-matrix-primary
7
+ bg-white dark:bg-black custom-scrollbar
8
+ ${o?"translate-x-0":"translate-x-full"}
9
+ `,children:s?e.jsx(xe,{summary:s.summary}):!c&&e.jsx("div",{className:"text-sm text-gray-400 dark:text-matrix-secondary/50 text-center mt-10",children:"No summary available."})})]})]})};export{fe as SessionAudit};
@@ -1,4 +1,4 @@
1
- import{j as s}from"./vendor-motion-C3CZ8ZlO.js";import{r as D}from"./vendor-react-DikRIOlj.js";import{u as de,Z as hr,m as he}from"./vendor-utils-D4NnWbOU.js";import{u as gr,c as vr}from"./chronos-DlDM2UBT.js";import{T as w,S as K}from"./SelectInput-KVLsnfra.js";import{c as V,N as U,S as H}from"./config-DX3Xb0XE.js";import{d as br,X as yr}from"./vendor-icons-DLvvGkeN.js";import"./index-CQIUjucB.js";function L({title:e,description:t,children:r}){return s.jsxs("div",{className:"border border-azure-border dark:border-matrix-primary rounded-lg p-6 bg-azure-surface/50 dark:bg-matrix-base/50",children:[s.jsxs("div",{className:"mb-4",children:[s.jsx("h3",{className:"text-lg font-medium text-azure-text-primary dark:text-matrix-highlight",children:e}),t&&s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mt-1",children:t})]}),s.jsx("div",{className:"space-y-4",children:r})]})}function p(e,t,r){function n(l,d){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,d);const m=a.prototype,f=Object.keys(m);for(let u=0;u<f.length;u++){const v=f[u];v in l||(l[v]=m[v].bind(l))}}const o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(l){var d;const m=r?.Parent?new i:this;n(m,l),(d=m._zod).deferred??(d.deferred=[]);for(const f of m._zod.deferred)f();return m}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>r?.Parent&&l instanceof r.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class be extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Nt extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const $t={};function ae(e){return $t}function Ot(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Be(e,t){return typeof t=="bigint"?t.toString():t}function Pe(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function We(e){return e==null}function Ge(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function xr(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const d=n.match(/\d?e-(\d?)/);d?.[1]&&(o=Number.parseInt(d[1]))}const i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return a%l/10**i}const ot=Symbol("evaluating");function z(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ot)return n===void 0&&(n=ot,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function me(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function le(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function at(e){return JSON.stringify(e)}function _r(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Zt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const kr=Pe(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ye(e){if(Se(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Se(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ct(e){return ye(e)?{...e}:Array.isArray(e)?[...e]:e}const wr=new Set(["string","number","symbol"]);function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function g(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function zr(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const jr={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Sr(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=le(e._zod.def,{get shape(){const a={};for(const l in t){if(!(l in r.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(a[l]=r.shape[l])}return me(this,"shape",a),a},checks:[]});return ce(e,i)}function Nr(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=le(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const l in t){if(!(l in r.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete a[l]}return me(this,"shape",a),a},checks:[]});return ce(e,i)}function $r(e,t){if(!ye(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=le(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return me(this,"shape",i),i}});return ce(e,o)}function Or(e,t){if(!ye(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=le(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return me(this,"shape",n),n}});return ce(e,r)}function Zr(e,t){const r=le(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return me(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ce(e,r)}function Cr(e,t,r){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=le(t._zod.def,{get shape(){const l=t._zod.def.shape,d={...l};if(r)for(const m in r){if(!(m in l))throw new Error(`Unrecognized key: "${m}"`);r[m]&&(d[m]=e?new e({type:"optional",innerType:l[m]}):l[m])}else for(const m in l)d[m]=e?new e({type:"optional",innerType:l[m]}):l[m];return me(this,"shape",d),d},checks:[]});return ce(t,a)}function Ar(e,t,r){const n=le(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(r)for(const a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return me(this,"shape",i),i}});return ce(t,n)}function ge(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ve(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Oe(e){return typeof e=="string"?e:e?.message}function ie(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Oe(e.inst?._zod.def?.error?.(e))??Oe(t?.error?.(e))??Oe(r.customError?.(e))??Oe(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function qe(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ne(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const At=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Be,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Et=p("$ZodError",At),Tt=p("$ZodError",At,{Parent:Error});function Er(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Tr(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,l=0;for(;l<i.path.length;){const d=i.path[l];l===i.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(i))):a[d]=a[d]||{_errors:[]},a=a[d],l++}}};return n(e),r}const Ye=e=>(t,r,n,o)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new be;if(a.issues.length){const l=new(o?.Err??e)(a.issues.map(d=>ie(d,i,ae())));throw Zt(l,o?.callee),l}return a.value},Xe=e=>async(t,r,n,o)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new(o?.Err??e)(a.issues.map(d=>ie(d,i,ae())));throw Zt(l,o?.callee),l}return a.value},Re=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new be;return i.issues.length?{success:!1,error:new(e??Et)(i.issues.map(a=>ie(a,o,ae())))}:{success:!0,data:i.value}},Ir=Re(Tt),De=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>ie(a,o,ae())))}:{success:!0,data:i.value}},Pr=De(Tt),Rr=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ye(e)(t,r,o)},Dr=e=>(t,r,n)=>Ye(e)(t,r,n),Ur=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xe(e)(t,r,o)},Mr=e=>async(t,r,n)=>Xe(e)(t,r,n),Jr=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Re(e)(t,r,o)},Lr=e=>(t,r,n)=>Re(e)(t,r,n),Fr=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return De(e)(t,r,o)},Br=e=>async(t,r,n)=>De(e)(t,r,n),Kr=/^[cC][^\s-]{8,}$/,Vr=/^[0-9a-z]+$/,Wr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Gr=/^[0-9a-vA-V]{20}$/,qr=/^[A-Za-z0-9]{27}$/,Yr=/^[a-zA-Z0-9_-]{21}$/,Xr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Hr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,it=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Qr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,en="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function tn(){return new RegExp(en,"u")}const rn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,nn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,on=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,an=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,It=/^[A-Za-z0-9_-]*$/,ln=/^\+[1-9]\d{6,14}$/,Pt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",cn=new RegExp(`^${Pt}$`);function Rt(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function un(e){return new RegExp(`^${Rt(e)}$`)}function dn(e){const t=Rt({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Pt}T(?:${n})$`)}const mn=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},pn=/^-?\d+$/,Dt=/^-?\d+(?:\.\d+)?$/,fn=/^(?:true|false)$/i,hn=/^[^A-Z]*$/,gn=/^[^a-z]*$/,B=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ut={number:"number",bigint:"bigint",object:"date"},Mt=p("$ZodCheckLessThan",(e,t)=>{B.init(e,t);const r=Ut[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jt=p("$ZodCheckGreaterThan",(e,t)=>{B.init(e,t);const r=Ut[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vn=p("$ZodCheckMultipleOf",(e,t)=>{B.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):xr(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),bn=p("$ZodCheckNumberFormat",(e,t)=>{B.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,i]=jr[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,r&&(l.pattern=pn)}),e._zod.check=a=>{const l=a.value;if(r){if(!Number.isInteger(l)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}l<o&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),yn=p("$ZodCheckMaxLength",(e,t)=>{var r;B.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!We(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const a=qe(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),xn=p("$ZodCheckMinLength",(e,t)=>{var r;B.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!We(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const a=qe(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_n=p("$ZodCheckLengthEquals",(e,t)=>{var r;B.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!We(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,i=o.length;if(i===t.length)return;const a=qe(o),l=i>t.length;n.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ue=p("$ZodCheckStringFormat",(e,t)=>{var r,n;B.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),kn=p("$ZodCheckRegex",(e,t)=>{Ue.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),wn=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=hn),Ue.init(e,t)}),zn=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=gn),Ue.init(e,t)}),jn=p("$ZodCheckIncludes",(e,t)=>{B.init(e,t);const r=xe(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Sn=p("$ZodCheckStartsWith",(e,t)=>{B.init(e,t);const r=new RegExp(`^${xe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Nn=p("$ZodCheckEndsWith",(e,t)=>{B.init(e,t);const r=new RegExp(`.*${xe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),$n=p("$ZodCheckOverwrite",(e,t)=>{B.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class On{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
1
+ import{j as s}from"./vendor-motion-C3CZ8ZlO.js";import{r as D}from"./vendor-react-DikRIOlj.js";import{u as de,Z as hr,m as he}from"./vendor-utils-D4NnWbOU.js";import{u as gr,c as vr}from"./chronos-BvMxfBQH.js";import{T as w,S as K}from"./SelectInput-KVLsnfra.js";import{c as V,N as U,S as H}from"./config-DteVgNGR.js";import{d as br,X as yr}from"./vendor-icons-BVuQI-6R.js";import"./index-Cwqr-n0Y.js";function L({title:e,description:t,children:r}){return s.jsxs("div",{className:"border border-azure-border dark:border-matrix-primary rounded-lg p-6 bg-azure-surface/50 dark:bg-matrix-base/50",children:[s.jsxs("div",{className:"mb-4",children:[s.jsx("h3",{className:"text-lg font-medium text-azure-text-primary dark:text-matrix-highlight",children:e}),t&&s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mt-1",children:t})]}),s.jsx("div",{className:"space-y-4",children:r})]})}function p(e,t,r){function n(l,d){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,d);const m=a.prototype,f=Object.keys(m);for(let u=0;u<f.length;u++){const v=f[u];v in l||(l[v]=m[v].bind(l))}}const o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(l){var d;const m=r?.Parent?new i:this;n(m,l),(d=m._zod).deferred??(d.deferred=[]);for(const f of m._zod.deferred)f();return m}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>r?.Parent&&l instanceof r.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class be extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Nt extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const $t={};function ae(e){return $t}function Ot(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Be(e,t){return typeof t=="bigint"?t.toString():t}function Pe(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function We(e){return e==null}function Ge(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function xr(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const d=n.match(/\d?e-(\d?)/);d?.[1]&&(o=Number.parseInt(d[1]))}const i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return a%l/10**i}const ot=Symbol("evaluating");function z(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ot)return n===void 0&&(n=ot,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function me(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function le(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function at(e){return JSON.stringify(e)}function _r(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Zt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const kr=Pe(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ye(e){if(Se(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Se(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ct(e){return ye(e)?{...e}:Array.isArray(e)?[...e]:e}const wr=new Set(["string","number","symbol"]);function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function g(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function zr(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const jr={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Sr(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=le(e._zod.def,{get shape(){const a={};for(const l in t){if(!(l in r.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(a[l]=r.shape[l])}return me(this,"shape",a),a},checks:[]});return ce(e,i)}function Nr(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=le(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const l in t){if(!(l in r.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete a[l]}return me(this,"shape",a),a},checks:[]});return ce(e,i)}function $r(e,t){if(!ye(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=le(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return me(this,"shape",i),i}});return ce(e,o)}function Or(e,t){if(!ye(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=le(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return me(this,"shape",n),n}});return ce(e,r)}function Zr(e,t){const r=le(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return me(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ce(e,r)}function Cr(e,t,r){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=le(t._zod.def,{get shape(){const l=t._zod.def.shape,d={...l};if(r)for(const m in r){if(!(m in l))throw new Error(`Unrecognized key: "${m}"`);r[m]&&(d[m]=e?new e({type:"optional",innerType:l[m]}):l[m])}else for(const m in l)d[m]=e?new e({type:"optional",innerType:l[m]}):l[m];return me(this,"shape",d),d},checks:[]});return ce(t,a)}function Ar(e,t,r){const n=le(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(r)for(const a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return me(this,"shape",i),i}});return ce(t,n)}function ge(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ve(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Oe(e){return typeof e=="string"?e:e?.message}function ie(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Oe(e.inst?._zod.def?.error?.(e))??Oe(t?.error?.(e))??Oe(r.customError?.(e))??Oe(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function qe(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ne(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const At=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Be,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Et=p("$ZodError",At),Tt=p("$ZodError",At,{Parent:Error});function Er(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Tr(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,l=0;for(;l<i.path.length;){const d=i.path[l];l===i.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(i))):a[d]=a[d]||{_errors:[]},a=a[d],l++}}};return n(e),r}const Ye=e=>(t,r,n,o)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new be;if(a.issues.length){const l=new(o?.Err??e)(a.issues.map(d=>ie(d,i,ae())));throw Zt(l,o?.callee),l}return a.value},Xe=e=>async(t,r,n,o)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new(o?.Err??e)(a.issues.map(d=>ie(d,i,ae())));throw Zt(l,o?.callee),l}return a.value},Re=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new be;return i.issues.length?{success:!1,error:new(e??Et)(i.issues.map(a=>ie(a,o,ae())))}:{success:!0,data:i.value}},Ir=Re(Tt),De=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>ie(a,o,ae())))}:{success:!0,data:i.value}},Pr=De(Tt),Rr=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ye(e)(t,r,o)},Dr=e=>(t,r,n)=>Ye(e)(t,r,n),Ur=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xe(e)(t,r,o)},Mr=e=>async(t,r,n)=>Xe(e)(t,r,n),Jr=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Re(e)(t,r,o)},Lr=e=>(t,r,n)=>Re(e)(t,r,n),Fr=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return De(e)(t,r,o)},Br=e=>async(t,r,n)=>De(e)(t,r,n),Kr=/^[cC][^\s-]{8,}$/,Vr=/^[0-9a-z]+$/,Wr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Gr=/^[0-9a-vA-V]{20}$/,qr=/^[A-Za-z0-9]{27}$/,Yr=/^[a-zA-Z0-9_-]{21}$/,Xr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Hr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,it=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Qr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,en="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function tn(){return new RegExp(en,"u")}const rn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,nn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,on=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,an=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,It=/^[A-Za-z0-9_-]*$/,ln=/^\+[1-9]\d{6,14}$/,Pt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",cn=new RegExp(`^${Pt}$`);function Rt(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function un(e){return new RegExp(`^${Rt(e)}$`)}function dn(e){const t=Rt({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Pt}T(?:${n})$`)}const mn=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},pn=/^-?\d+$/,Dt=/^-?\d+(?:\.\d+)?$/,fn=/^(?:true|false)$/i,hn=/^[^A-Z]*$/,gn=/^[^a-z]*$/,B=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ut={number:"number",bigint:"bigint",object:"date"},Mt=p("$ZodCheckLessThan",(e,t)=>{B.init(e,t);const r=Ut[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jt=p("$ZodCheckGreaterThan",(e,t)=>{B.init(e,t);const r=Ut[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vn=p("$ZodCheckMultipleOf",(e,t)=>{B.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):xr(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),bn=p("$ZodCheckNumberFormat",(e,t)=>{B.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,i]=jr[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,r&&(l.pattern=pn)}),e._zod.check=a=>{const l=a.value;if(r){if(!Number.isInteger(l)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}l<o&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),yn=p("$ZodCheckMaxLength",(e,t)=>{var r;B.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!We(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const a=qe(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),xn=p("$ZodCheckMinLength",(e,t)=>{var r;B.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!We(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const a=qe(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_n=p("$ZodCheckLengthEquals",(e,t)=>{var r;B.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!We(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,i=o.length;if(i===t.length)return;const a=qe(o),l=i>t.length;n.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ue=p("$ZodCheckStringFormat",(e,t)=>{var r,n;B.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),kn=p("$ZodCheckRegex",(e,t)=>{Ue.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),wn=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=hn),Ue.init(e,t)}),zn=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=gn),Ue.init(e,t)}),jn=p("$ZodCheckIncludes",(e,t)=>{B.init(e,t);const r=xe(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Sn=p("$ZodCheckStartsWith",(e,t)=>{B.init(e,t);const r=new RegExp(`^${xe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Nn=p("$ZodCheckEndsWith",(e,t)=>{B.init(e,t);const r=new RegExp(`.*${xe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),$n=p("$ZodCheckOverwrite",(e,t)=>{B.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class On{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
2
2
  `).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
3
3
  `))}}const Zn={major:4,minor:3,patch:6},Z=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Zn;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(a,l,d)=>{let m=ge(a),f;for(const u of l){if(u._zod.def.when){if(!u._zod.def.when(a))continue}else if(m)continue;const v=a.issues.length,h=u._zod.check(a);if(h instanceof Promise&&d?.async===!1)throw new be;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await h,a.issues.length!==v&&(m||(m=ge(a,v)))});else{if(a.issues.length===v)continue;m||(m=ge(a,v))}}return f?f.then(()=>a):a},i=(a,l,d)=>{if(ge(a))return a.aborted=!0,a;const m=o(l,n,d);if(m instanceof Promise){if(d.async===!1)throw new be;return m.then(f=>e._zod.parse(f,d))}return e._zod.parse(m,d)};e._zod.run=(a,l)=>{if(l.skipChecks)return e._zod.parse(a,l);if(l.direction==="backward"){const m=e._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return m instanceof Promise?m.then(f=>i(f,a,l)):i(m,a,l)}const d=e._zod.parse(a,l);if(d instanceof Promise){if(l.async===!1)throw new be;return d.then(m=>o(m,n,l))}return o(d,n,l)}}z(e,"~standard",()=>({validate:o=>{try{const i=Ir(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Pr(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),He=p("$ZodString",(e,t)=>{Z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??mn(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),$=p("$ZodStringFormat",(e,t)=>{Ue.init(e,t),He.init(e,t)}),Cn=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Hr),$.init(e,t)}),An=p("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=it(n))}else t.pattern??(t.pattern=it());$.init(e,t)}),En=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Qr),$.init(e,t)}),Tn=p("$ZodURL",(e,t)=>{$.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),In=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=tn()),$.init(e,t)}),Pn=p("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Yr),$.init(e,t)}),Rn=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Kr),$.init(e,t)}),Dn=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Vr),$.init(e,t)}),Un=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Wr),$.init(e,t)}),Mn=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Gr),$.init(e,t)}),Jn=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=qr),$.init(e,t)}),Ln=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=dn(t)),$.init(e,t)}),Fn=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=cn),$.init(e,t)}),Bn=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=un(t)),$.init(e,t)}),Kn=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Xr),$.init(e,t)}),Vn=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=rn),$.init(e,t),e._zod.bag.format="ipv4"}),Wn=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=nn),$.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Gn=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=on),$.init(e,t)}),qn=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=an),$.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,i]=n;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Lt(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Yn=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=sn),$.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Lt(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Xn(e){if(!It.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Lt(r)}const Hn=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=It),$.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Xn(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Qn=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ln),$.init(e,t)});function eo(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const to=p("$ZodJWT",(e,t)=>{$.init(e,t),e._zod.check=r=>{eo(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Ft=p("$ZodNumber",(e,t)=>{Z.init(e,t),e._zod.pattern=e._zod.bag.pattern??Dt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),ro=p("$ZodNumberFormat",(e,t)=>{bn.init(e,t),Ft.init(e,t)}),no=p("$ZodBoolean",(e,t)=>{Z.init(e,t),e._zod.pattern=fn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),oo=p("$ZodUnknown",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r}),ao=p("$ZodNever",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function st(e,t,r){e.issues.length&&t.issues.push(...ve(r,e.issues)),t.value[r]=e.value}const io=p("$ZodArray",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const l=o[a],d=t.element._zod.run({value:l,issues:[]},n);d instanceof Promise?i.push(d.then(m=>st(m,r,a))):st(d,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Ee(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...ve(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Bt(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=zr(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Kt(e,t,r,n,o,i){const a=[],l=o.keySet,d=o.catchall._zod,m=d.def.type,f=d.optout==="optional";for(const u in t){if(l.has(u))continue;if(m==="never"){a.push(u);continue}const v=d.run({value:t[u],issues:[]},n);v instanceof Promise?e.push(v.then(h=>Ee(h,r,u,t,f))):Ee(v,r,u,t,f)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const so=p("$ZodObject",(e,t)=>{if(Z.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const d={...l};return Object.defineProperty(t,"shape",{value:d}),d}})}const n=Pe(()=>Bt(t));z(e._zod,"propValues",()=>{const l=t.shape,d={};for(const m in l){const f=l[m]._zod;if(f.values){d[m]??(d[m]=new Set);for(const u of f.values)d[m].add(u)}}return d});const o=Se,i=t.catchall;let a;e._zod.parse=(l,d)=>{a??(a=n.value);const m=l.value;if(!o(m))return l.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),l;l.value={};const f=[],u=a.shape;for(const v of a.keys){const h=u[v],I=h._zod.optout==="optional",b=h._zod.run({value:m[v],issues:[]},d);b instanceof Promise?f.push(b.then(Q=>Ee(Q,l,v,m,I))):Ee(b,l,v,m,I)}return i?Kt(f,m,l,d,n.value,e):f.length?Promise.all(f).then(()=>l):l}}),lo=p("$ZodObjectJIT",(e,t)=>{so.init(e,t);const r=e._zod.parse,n=Pe(()=>Bt(t)),o=v=>{const h=new On(["shape","payload","ctx"]),I=n.value,b=_=>{const P=at(_);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};h.write("const input = payload.value;");const Q=Object.create(null);let O=0;for(const _ of I.keys)Q[_]=`key_${O++}`;h.write("const newResult = {};");for(const _ of I.keys){const P=Q[_],E=at(_),te=v[_]?._zod?.optout==="optional";h.write(`const ${P} = ${b(_)};`),te?h.write(`
4
4
  if (${P}.issues.length) {
@@ -0,0 +1,7 @@
1
+ import{j as e,m as n}from"./vendor-motion-C3CZ8ZlO.js";import{r as s}from"./vendor-react-DikRIOlj.js";import{u as Z}from"./vendor-utils-D4NnWbOU.js";import{s as l}from"./skills--hAyQnmG.js";import{D as O,e as K,j as F}from"./index-Cwqr-n0Y.js";import{W as y,aj as u,O as b,a1 as V,F as W,Q as L,U as I,Z as q,a2 as A,a3 as B,X as H,ak as M}from"./vendor-icons-BVuQI-6R.js";const U={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},g={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};function Q({skill:r,onToggle:i,onView:d}){return e.jsxs(n.div,{variants:g,className:`rounded-lg border flex flex-col transition-all ${r.enabled?"border-azure-primary/50 dark:border-matrix-primary bg-white dark:bg-black":"border-azure-border dark:border-matrix-primary/30 bg-azure-surface/50 dark:bg-black"}`,children:[e.jsxs("div",{className:"p-4 flex items-start gap-3 flex-1",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 ${r.enabled?"bg-azure-primary/10 dark:bg-matrix-highlight/10":"bg-azure-surface dark:bg-zinc-900"}`,children:e.jsx(y,{className:`w-4 h-4 ${r.enabled?"text-azure-primary dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-tertiary"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:`font-semibold truncate ${r.enabled?"text-azure-text dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-secondary"}`,children:r.name}),r.version&&e.jsxs("span",{className:"text-[10px] font-mono text-azure-text-secondary dark:text-matrix-tertiary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-1.5 py-0.5 shrink-0",children:["v",r.version]}),!r.enabled&&e.jsx("span",{className:"text-[10px] font-medium text-zinc-400 dark:text-zinc-500 bg-zinc-100 dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded px-1.5 py-0.5 shrink-0",children:"disabled"})]}),e.jsx("p",{className:`text-sm mt-1.5 line-clamp-2 leading-relaxed ${r.enabled?"text-azure-text-secondary dark:text-matrix-secondary":"text-azure-text-secondary/70 dark:text-matrix-tertiary"}`,children:r.description}),r.tags&&r.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:r.tags.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded border border-azure-primary/20 dark:border-matrix-primary/40 bg-azure-primary/5 dark:bg-matrix-primary/10 text-azure-primary dark:text-matrix-secondary",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t]},t))})]})]}),e.jsxs("div",{className:"px-4 py-3 border-t border-azure-border dark:border-matrix-primary/30 flex items-center justify-between gap-2",children:[r.author?e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-azure-text-secondary dark:text-matrix-tertiary min-w-0",children:[e.jsx(I,{className:"w-3 h-3 shrink-0"}),e.jsx("span",{className:"truncate",children:r.author})]}):e.jsx("div",{}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:d,className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary/50 text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"View details",children:e.jsx(q,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:i,className:`p-1.5 rounded border transition-colors ${r.enabled?"border-emerald-300 dark:border-emerald-700/60 text-emerald-500 dark:text-emerald-400 hover:bg-emerald-50 dark:hover:bg-emerald-900/20":"border-azure-border dark:border-matrix-primary/40 text-zinc-400 dark:text-zinc-600 hover:text-azure-text dark:hover:text-matrix-secondary hover:border-azure-border dark:hover:border-matrix-primary"}`,title:r.enabled?"Disable skill":"Enable skill",children:r.enabled?e.jsx(A,{className:"w-4 h-4"}):e.jsx(B,{className:"w-4 h-4"})})]})]})]})}function X({skill:r,open:i,onOpenChange:d}){return!i||!r?null:e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>d(!1)}),e.jsxs("div",{className:"relative bg-white dark:bg-black border border-azure-border dark:border-matrix-primary rounded-lg shadow-xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-b border-azure-border dark:border-matrix-primary shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 flex items-center justify-center shrink-0",children:e.jsx(y,{className:"w-4 h-4 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:"text-base font-semibold text-azure-text dark:text-matrix-highlight truncate",children:r.name}),r.version&&e.jsxs("span",{className:"text-[10px] font-mono text-azure-text-secondary dark:text-matrix-tertiary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-1.5 py-0.5 shrink-0",children:["v",r.version]})]}),r.author&&e.jsxs("div",{className:"flex items-center gap-1 mt-0.5 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:[e.jsx(I,{className:"w-3 h-3 shrink-0"}),r.author]})]})]}),e.jsx("button",{onClick:()=>d(!1),className:"p-1.5 rounded text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-highlight hover:bg-azure-surface dark:hover:bg-zinc-900 transition-colors shrink-0",children:e.jsx(H,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"overflow-y-auto flex-1 p-5 space-y-5",children:[r.description&&e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary leading-relaxed",children:r.description}),e.jsx("div",{className:"flex flex-col gap-2",children:e.jsxs("div",{className:"flex items-start gap-2 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:[e.jsx(M,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{className:"break-all font-mono text-azure-text dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-2 py-0.5",children:r.path})]})}),r.tags&&r.tags.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.tags.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded border border-azure-primary/20 dark:border-matrix-primary/40 bg-azure-primary/5 dark:bg-matrix-primary/10 text-azure-primary dark:text-matrix-secondary",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t]},t))})]}),r.examples&&r.examples.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Examples"}),e.jsx("ul",{className:"space-y-1.5",children:r.examples.map((t,x)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-azure-text-secondary dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/30 rounded px-3 py-2",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary font-mono text-xs mt-0.5 shrink-0",children:[x+1,"."]}),t]},x))})]}),r.content&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"SKILL.md"}),e.jsx("pre",{className:"rounded-lg bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 p-4 text-xs text-azure-text-secondary dark:text-matrix-secondary overflow-auto max-h-72 whitespace-pre-wrap leading-relaxed font-mono",children:r.content})]})]})]})]})}function ae(){const[r,i]=s.useState(null),[d,t]=s.useState(!1),[x,N]=s.useState(!1),[o,v]=s.useState(!1),[c,k]=s.useState(null),[w,f]=s.useState(null),j=s.useRef(null),{data:S,mutate:z,isLoading:D}=Z("/skills",()=>l.fetchSkills(),{refreshInterval:1e4}),m=S?.skills??[],E=S?.enabled??0,R=async()=>{await l.reloadSkills(),z()},T=async a=>{a.enabled?await l.disableSkill(a.name):await l.enableSkill(a.name),z()},$=async a=>{t(!0);try{const p=await l.fetchSkill(a.name);i(p)}finally{t(!1)}},P=async a=>{const p=a.target.files?.[0];if(p){k(null),f(null),v(!0);try{const h=await l.uploadSkill(p);f(`Skill "${h.skill.name}" uploaded successfully!`),z(),j.current&&(j.current.value="")}catch(h){k({error:h.message||"Upload failed",details:h.details})}finally{v(!1)}}},C=()=>{k(null),f(null),N(!0)};return e.jsxs(n.div,{variants:U,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(n.div,{variants:g,className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(y,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Skills"}),e.jsxs("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:[m.length," skill",m.length!==1?"s":"",", ",E," enabled"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:C,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-azure-primary dark:border-matrix-primary text-azure-primary dark:text-matrix-primary font-medium hover:bg-azure-primary/10 dark:hover:bg-matrix-primary/10 transition-colors",children:[e.jsx(u,{className:"w-4 h-4"}),"Upload"]}),e.jsxs("button",{onClick:R,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-black font-medium hover:opacity-90 transition-opacity",children:[e.jsx(b,{className:"w-4 h-4"}),"Reload"]})]})]}),D?e.jsxs(n.div,{variants:g,className:"text-center py-12",children:[e.jsx(b,{className:"w-8 h-8 animate-spin mx-auto text-azure-text-secondary dark:text-matrix-dim"}),e.jsx("p",{className:"mt-2 text-azure-text-secondary dark:text-matrix-dim",children:"Loading skills..."})]}):m.length===0?e.jsxs(n.div,{variants:g,className:"rounded-lg border border-dashed border-azure-border dark:border-matrix-primary p-8 text-center",children:[e.jsx(y,{className:"w-12 h-12 mx-auto text-azure-text-tertiary dark:text-matrix-dim"}),e.jsx("h3",{className:"mt-4 text-lg font-medium text-azure-text-primary dark:text-matrix-highlight",children:"No skills found"}),e.jsxs("p",{className:"mt-2 text-azure-text-secondary dark:text-matrix-secondary max-w-md mx-auto",children:["Upload a skill ZIP or add skills manually to"," ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"~/.morpheus/skills/"}),". Each skill folder must contain a"," ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"SKILL.md"})," file with frontmatter."]}),e.jsxs("button",{onClick:C,className:"mt-4 inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-black font-medium hover:opacity-90 transition-opacity",children:[e.jsx(u,{className:"w-4 h-4"}),"Upload Skill"]})]}):e.jsx(n.div,{variants:U,initial:"hidden",animate:"show",className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:m.map(a=>e.jsx(Q,{skill:a,onToggle:()=>T(a),onView:()=>$(a)},a.name))}),e.jsx(X,{skill:r,open:!!r,onOpenChange:a=>!a&&i(null)}),e.jsxs(O,{open:x,onOpenChange:N,children:[e.jsx(K,{children:e.jsx(F,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{className:"w-5 h-5"}),"Upload Skill"]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-azure-text-secondary dark:text-matrix-secondary text-sm",children:["Upload a ZIP file containing your skill folder. The ZIP must have exactly one folder at root level with a valid ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"SKILL.md"})," file."]}),e.jsxs("div",{className:"border-2 border-dashed border-azure-border dark:border-matrix-primary rounded-lg p-6",children:[e.jsx("input",{ref:j,type:"file",accept:".zip,application/zip,application/x-zip-compressed",onChange:P,disabled:o,className:"hidden",id:"skill-upload-input"}),e.jsxs("label",{htmlFor:"skill-upload-input",className:`flex flex-col items-center gap-2 cursor-pointer ${o?"opacity-50 cursor-not-allowed":""}`,children:[o?e.jsx(b,{className:"w-8 h-8 animate-spin text-azure-primary dark:text-matrix-primary"}):e.jsx(u,{className:"w-8 h-8 text-azure-text-tertiary dark:text-matrix-dim"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-secondary",children:o?"Uploading...":"Click to select ZIP file"})]})]}),c&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:[e.jsx(V,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200",children:c.error}),c.details&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-300 mt-1",children:c.details})]})]}),w&&e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800",children:[e.jsx(W,{className:"w-5 h-5 text-green-600 dark:text-green-400"}),e.jsx("p",{className:"text-sm text-green-800 dark:text-green-200",children:w})]}),e.jsxs("div",{className:"rounded-lg bg-azure-hover dark:bg-zinc-900 p-3",children:[e.jsx("h4",{className:"text-sm font-medium text-azure-text-primary dark:text-matrix-highlight mb-2",children:"ZIP Structure Example"}),e.jsx("pre",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary",children:`my-skill.zip
2
+ └── my-skill/
3
+ ├── SKILL.md (required)
4
+ ├── scripts/ (optional)
5
+ │ └── script.js
6
+ └── examples/ (optional)
7
+ └── output.txt`})]})]})]}),d&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsx(b,{className:"w-8 h-8 animate-spin text-white"})})]})}export{ae as SkillsPage};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as x}from"./vendor-react-DikRIOlj.js";import{u as F}from"./vendor-utils-D4NnWbOU.js";import{c as b,S as X,N as v}from"./config-DteVgNGR.js";import{S as Y,T as w}from"./SelectInput-KVLsnfra.js";import{j as J,a1 as C,H as S,O as Q,al as O,a5 as D,ab as V,am as I,ac as Z,an as ee,ao as te,ap as re,w as ae,z as se,l as ie,aq as ne,h as le,ad as de,G as oe,X as ce}from"./vendor-icons-BVuQI-6R.js";import"./index-Cwqr-n0Y.js";const xe={name:"",host:"",port:7900,auth_token:"",tls:!1};function me(t){const l=Math.floor(t/86400),i=Math.floor(t%86400/3600),o=Math.floor(t%3600/60);return l>0?`${l}d ${i}h`:i>0?`${i}h ${o}m`:`${o}m`}function he(t,l){const i=t>=1024?`${(t/1024).toFixed(1)}GB`:`${Math.round(t)}MB`,o=l>=1024?`${(l/1024).toFixed(1)}GB`:`${Math.round(l)}MB`;return`${i} / ${o}`}function ue({state:t}){return t==="online"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-emerald-500 bg-emerald-500/10 border border-emerald-500/30 rounded-full px-2 py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),"online"]}):t==="connecting"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-amber-500 bg-amber-500/10 border border-amber-500/30 rounded-full px-2 py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"}),"connecting"]}):t==="error"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-red-500 bg-red-500/10 border border-red-500/30 rounded-full px-2 py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),"error"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-zinc-500 bg-zinc-500/10 border border-zinc-500/30 rounded-full px-2 py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zinc-500"}),"offline"]})}function ge({cap:t}){const i={filesystem:"text-blue-400 bg-blue-400/10 border-blue-400/30",shell:"text-yellow-400 bg-yellow-400/10 border-yellow-400/30",git:"text-orange-400 bg-orange-400/10 border-orange-400/30",browser:"text-purple-400 bg-purple-400/10 border-purple-400/30",network:"text-cyan-400 bg-cyan-400/10 border-cyan-400/30",packages:"text-green-400 bg-green-400/10 border-green-400/30",processes:"text-pink-400 bg-pink-400/10 border-pink-400/30",system:"text-indigo-400 bg-indigo-400/10 border-indigo-400/30"}[t]??"text-zinc-400 bg-zinc-400/10 border-zinc-400/30";return e.jsx("span",{className:`text-[10px] font-medium border rounded px-1.5 py-0.5 ${i}`,children:t})}function be({status:t,entry:l,onPing:i,onEdit:o,onDelete:a}){const[d,h]=x.useState(!1),s=t.state==="online";return e.jsxs("div",{className:`rounded-lg border bg-white dark:bg-black transition-all ${s?"border-emerald-500/40 dark:border-emerald-500/30":t.state==="error"?"border-red-500/40 dark:border-red-500/30":t.state==="connecting"?"border-amber-500/40 dark:border-amber-500/30":"border-azure-border dark:border-matrix-primary"}`,children:[e.jsxs("div",{className:"p-4 bg-azure-surface/50 dark:bg-zinc-950/50",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 ${s?"bg-emerald-500/10":"bg-zinc-100 dark:bg-zinc-900"}`,children:e.jsx(te,{className:`w-4 h-4 ${s?"text-emerald-500":"text-zinc-400 dark:text-matrix-tertiary"}`})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-semibold text-azure-text dark:text-matrix-highlight truncate",children:t.name}),e.jsx(ue,{state:t.state}),l?.tls&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-emerald-500 bg-emerald-500/10 border border-emerald-500/30 rounded px-1.5 py-0.5",children:[e.jsx(re,{className:"w-2.5 h-2.5"}),"TLS"]})]}),e.jsxs("div",{className:"text-xs text-azure-text-secondary dark:text-matrix-tertiary mt-0.5",children:[t.host,":",t.port]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>i(t.name),className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"Ping",children:e.jsx(I,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>o(l??{name:t.name,host:t.host,port:t.port,auth_token:"",tls:!1}),className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"Edit",children:e.jsx(ae,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>a(t.name),className:"p-1.5 rounded border border-red-200 dark:border-red-800/50 text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-500 transition-colors",title:"Remove",children:e.jsx(se,{className:"w-3.5 h-3.5"})})]})]}),t.error&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 text-xs text-red-500 bg-red-500/10 border border-red-500/20 rounded p-2",children:[e.jsx(C,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{children:t.error})]}),s&&t.stats&&e.jsx("div",{className:"mt-3 space-y-2",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:"OS"}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono",children:t.stats.os})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:"Hostname"}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono truncate max-w-[120px]",children:t.stats.hostname})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary flex items-center gap-1",children:[e.jsx(ie,{className:"w-3 h-3"})," CPU"]}),e.jsxs("span",{className:"text-azure-text dark:text-matrix-secondary font-mono",children:[t.stats.cpu_percent.toFixed(1),"%"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary flex items-center gap-1",children:[e.jsx(ne,{className:"w-3 h-3"})," RAM"]}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono",children:he(t.stats.memory_used_mb,t.stats.memory_total_mb)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary flex items-center gap-1",children:[e.jsx(le,{className:"w-3 h-3"})," Uptime"]}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono",children:me(t.stats.uptime_seconds)})]}),t.config?.sandbox_dir&&e.jsxs("div",{className:"flex justify-between col-span-2",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary shrink-0",children:"Sandbox"}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary font-mono truncate text-right ml-2",children:t.config.sandbox_dir})]}),t.config&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:"Read-only"}),e.jsx("span",{className:`font-medium ${t.config.readonly_mode?"text-amber-500":"text-emerald-500"}`,children:t.config.readonly_mode?"yes":"no"})]})]})}),!s&&t.lastSeen&&e.jsxs("div",{className:"mt-2 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:["Last seen: ",new Date(t.lastSeen).toLocaleString()]})]}),t.capabilities.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>h(!d),className:"w-full flex items-center justify-between px-4 py-2 border-t border-azure-border dark:border-matrix-primary/30 text-xs text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-secondary hover:bg-azure-surface/50 dark:hover:bg-zinc-900/50 transition-colors",children:[e.jsxs("span",{children:["Capabilities (",t.capabilities.length,")"]}),d?e.jsx(de,{className:"w-3.5 h-3.5"}):e.jsx(oe,{className:"w-3.5 h-3.5"})]}),d&&e.jsxs("div",{className:"px-4 pb-4 pt-3 border-t border-azure-border dark:border-matrix-primary/30 bg-azure-surface/30 dark:bg-zinc-900/30",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.capabilities.map(m=>e.jsx(ge,{cap:m},m))}),t.lastSeen&&e.jsxs("div",{className:"text-xs text-azure-text-secondary dark:text-matrix-tertiary mt-3",children:["Last seen: ",new Date(t.lastSeen).toLocaleString()]})]})]})]})}function H({title:t,initial:l,isEdit:i,onSave:o,onClose:a,saving:d,error:h}){const[s,m]=x.useState(l),[j,p]=x.useState(null),f=()=>{if(!s.name.trim()){p("Name is required.");return}if(!s.host.trim()){p("Host is required.");return}if(!i&&!s.auth_token.trim()){p("Auth token is required.");return}p(null),o(s)};return e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white dark:bg-black border border-azure-border dark:border-matrix-primary rounded-lg shadow-xl w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-azure-border dark:border-matrix-primary",children:[e.jsxs("h2",{className:"text-base font-semibold text-azure-text dark:text-matrix-highlight flex items-center gap-2",children:[e.jsx(S,{className:"w-4 h-4"}),t]}),e.jsx("button",{onClick:a,className:"text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-highlight transition-colors",children:e.jsx(ce,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"p-5 space-y-3",children:[(j||h)&&e.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-500 bg-red-500/10 border border-red-500/20 rounded p-3",children:[e.jsx(C,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:j||h})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx("div",{className:"col-span-2",children:e.jsx(w,{label:"Name",value:s.name,onChange:c=>m({...s,name:c.target.value}),disabled:i,helperText:i?"Name cannot be changed after creation.":"Unique identifier (lowercase, hyphens ok)."})}),e.jsx(w,{label:"Host",value:s.host,onChange:c=>m({...s,host:c.target.value}),placeholder:"localhost"}),e.jsx(v,{label:"Port",value:s.port,onChange:c=>m({...s,port:Number(c.target.value)}),min:1,max:65535}),e.jsx("div",{className:"col-span-2",children:e.jsx(w,{label:"Auth Token",value:s.auth_token,onChange:c=>m({...s,auth_token:c.target.value}),placeholder:i?"Leave blank to keep existing token":"Shared secret",helperText:i?"Leave blank to keep the current token.":void 0})})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx("input",{type:"checkbox",id:"smith-tls",checked:s.tls??!1,onChange:c=>m({...s,tls:c.target.checked}),className:"w-4 h-4 accent-azure-primary dark:accent-matrix-highlight"}),e.jsxs("label",{htmlFor:"smith-tls",className:"text-sm text-azure-text-secondary dark:text-matrix-secondary cursor-pointer",children:["Use TLS (",e.jsx("code",{className:"text-xs font-mono",children:"wss://"}),")"]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 px-5 py-4 border-t border-azure-border dark:border-matrix-primary",children:[e.jsx("button",{onClick:a,className:"px-4 py-2 rounded text-sm text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-highlight transition-colors",children:"Cancel"}),e.jsx("button",{onClick:f,disabled:d,className:"px-4 py-2 rounded text-sm font-medium bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black dark:hover:bg-matrix-highlight/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:d?"Saving…":i?"Update Smith":"Add Smith"})]})]})})}function ze(){const{data:t,mutate:l}=F("/api/smiths",b.getSmithsList,{refreshInterval:1e4}),{data:i,mutate:o}=F("/api/smiths/config",b.getSmithsConfig),[a,d]=x.useState(null),[h,s]=x.useState(!1),[m,j]=x.useState(!1),[p,f]=x.useState(!1),[c,z]=x.useState(null),[_,k]=x.useState(!1),[$,u]=x.useState(null),[N,T]=x.useState(null),[U,M]=x.useState(!1);i&&!a&&d(i);const g=(r,n)=>{T({type:r,message:n}),setTimeout(()=>T(null),4e3)},q=async r=>{try{const n=await b.pingSmith(r);g("success",`Ping ${r}: ${n.latency_ms}ms`)}catch(n){g("error",`Ping failed: ${n.message}`)}},B=async r=>{if(confirm(`Remove Smith "${r}" from the registry?`))try{await b.removeSmith(r),l(),o(),d(null),g("success",`Smith "${r}" removed.`)}catch(n){g("error",`Failed to remove: ${n.message}`)}},G=async r=>{if(a){if(a.entries.some(n=>n.name===r.name)){u(`Smith "${r.name}" already exists.`);return}k(!0),u(null);try{const n={...a,entries:[...a.entries,r]};await b.updateSmithsConfig(n),f(!1),d(null),l(),o(),g("success",`Smith "${r.name}" added.`)}catch(n){u(n.message)}finally{k(!1)}}},W=async r=>{if(a){k(!0),u(null);try{const n={...a,entries:a.entries.map(R=>R.name===r.name?r:R)};await b.updateSmithsConfig(n),z(null),d(null),l(),o(),g("success",`Smith "${r.name}" updated.`)}catch(n){u(n.message)}finally{k(!1)}}},K=async()=>{if(a){j(!0);try{await b.updateSmithsConfig(a),l(),o(),g("success","Settings saved."),s(!1)}catch(r){g("error",r.message)}finally{j(!1)}}},y=t?.smiths??[],L=y.filter(r=>r.state==="online").length,P=y.filter(r=>r.state==="offline"||r.state==="error").length,A=y.filter(r=>r.state==="connecting").length,E={};return(a??i)?.entries?.forEach(r=>{E[r.name]=r}),e.jsxs("div",{className:"space-y-6",children:[N&&e.jsxs("div",{className:`fixed top-4 right-4 z-50 flex items-center gap-2 px-4 py-3 rounded-lg shadow-xl text-sm border ${N.type==="success"?"bg-emerald-50 dark:bg-emerald-900/30 border-emerald-300 dark:border-emerald-500/50 text-emerald-700 dark:text-emerald-400":"bg-red-50 dark:bg-red-900/30 border-red-300 dark:border-red-500/50 text-red-700 dark:text-red-400"}`,children:[N.type==="success"?e.jsx(J,{className:"w-4 h-4"}):e.jsx(C,{className:"w-4 h-4"}),N.message]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(S,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Smiths"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"Remote DevKit agents via WebSocket"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:async()=>{M(!0),await Promise.all([l(),o(),new Promise(r=>setTimeout(r,500))]),M(!1)},className:"p-2 rounded border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",title:"Refresh",children:e.jsx(Q,{className:`w-4 h-4 transition-transform ${U?"animate-spin":""}`})}),e.jsxs("button",{onClick:()=>{s(!h),!a&&i&&d(i)},className:`flex items-center gap-1.5 px-3 py-2 rounded border text-sm transition-colors ${h?"bg-azure-primary/10 border-azure-primary dark:bg-matrix-highlight/10 dark:border-matrix-highlight text-azure-primary dark:text-matrix-highlight":"border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight"}`,children:[e.jsx(O,{className:"w-4 h-4"}),"Settings"]}),e.jsxs("button",{onClick:()=>{f(!0),u(null)},className:"flex items-center gap-1.5 px-3 py-2 rounded bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black dark:hover:bg-matrix-highlight/90 text-sm font-medium transition-colors",children:[e.jsx(D,{className:"w-4 h-4"}),"Add Smith"]})]})]}),t&&e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:"Total"}),e.jsx("span",{className:"font-semibold text-azure-text dark:text-matrix-secondary",children:t.total})]}),L>0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(V,{className:"w-3.5 h-3.5 text-emerald-500"}),e.jsxs("span",{className:"font-semibold text-emerald-500",children:[L," online"]})]}),A>0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(I,{className:"w-3.5 h-3.5 text-amber-500"}),e.jsxs("span",{className:"font-semibold text-amber-500",children:[A," connecting"]})]}),P>0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(Z,{className:"w-3.5 h-3.5 text-zinc-400 dark:text-matrix-tertiary"}),e.jsxs("span",{className:"font-semibold text-zinc-500 dark:text-matrix-tertiary",children:[P," offline"]})]}),!t.enabled&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-amber-500 bg-amber-500/10 border border-amber-500/30 rounded-full px-2.5 py-0.5",children:[e.jsx(ee,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Smiths subsystem disabled"})]})]}),h&&a&&e.jsxs("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black p-5 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h2",{className:"text-sm font-semibold text-azure-text dark:text-matrix-highlight flex items-center gap-2",children:[e.jsx(O,{className:"w-4 h-4"}),"Global Settings"]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx("div",{className:"sm:col-span-2",children:e.jsx(X,{label:"Enable Smiths",checked:a.enabled,onChange:r=>d({...a,enabled:r}),helperText:"Master switch — disabling stops all Smith connections."})}),e.jsx(Y,{label:"Execution Mode",value:a.execution_mode,onChange:r=>d({...a,execution_mode:r.target.value}),options:[{label:"Sync — inline result",value:"sync"},{label:"Async — background task",value:"async"}]}),e.jsx(v,{label:"Heartbeat Interval (s)",value:Math.round(a.heartbeat_interval_ms/1e3),onChange:r=>d({...a,heartbeat_interval_ms:Number(r.target.value)*1e3}),min:5}),e.jsx(v,{label:"Connection Timeout (s)",value:Math.round(a.connection_timeout_ms/1e3),onChange:r=>d({...a,connection_timeout_ms:Number(r.target.value)*1e3}),min:1}),e.jsx(v,{label:"Task Timeout (s)",value:Math.round(a.task_timeout_ms/1e3),onChange:r=>d({...a,task_timeout_ms:Number(r.target.value)*1e3}),min:5})]}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx("button",{onClick:K,disabled:m,className:"px-4 py-2 rounded text-sm font-medium bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black dark:hover:bg-matrix-highlight/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:m?"Saving…":"Save Settings"})})]}),y.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary flex items-center justify-center mb-4",children:e.jsx(S,{className:"w-7 h-7 text-azure-text-secondary dark:text-matrix-tertiary"})}),e.jsx("h3",{className:"text-base font-semibold text-azure-text dark:text-matrix-highlight mb-1",children:"No Smiths configured"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary mb-4",children:"Add a remote agent to delegate DevKit tasks to isolated environments."}),e.jsxs("button",{onClick:()=>{f(!0),u(null)},className:"flex items-center gap-2 px-4 py-2 rounded bg-azure-primary text-white hover:bg-azure-active dark:bg-matrix-highlight dark:text-black text-sm font-medium transition-colors",children:[e.jsx(D,{className:"w-4 h-4"}),"Add First Smith"]})]}):e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:y.map(r=>e.jsx(be,{status:r,entry:E[r.name],onPing:q,onEdit:n=>{z({...n,auth_token:""}),u(null)},onDelete:B},r.name))}),p&&e.jsx(H,{title:"Add Smith",initial:xe,onSave:G,onClose:()=>f(!1),saving:_,error:$}),c&&e.jsx(H,{title:"Edit Smith",initial:c,isEdit:!0,onSave:W,onClose:()=>z(null),saving:_,error:$})]})}export{ze as SmithsPage};