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 +0,0 @@
1
- import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as l}from"./vendor-react-DikRIOlj.js";import{B as f,h as j}from"./index-CQIUjucB.js";import{M as re,D as ae}from"./DeleteConfirmationModal-DIXbckY8.js";import{N as se,O as ie,Q as I,h as le,V as B,Y as ne,Z as ce,A as de,y as $,_ as oe}from"./vendor-icons-DLvvGkeN.js";import"./vendor-utils-D4NnWbOU.js";const xe=({className:a,...r})=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{className:`w-full caption-bottom text-sm ${a}`,...r})}),me=({...a})=>e.jsx("thead",{...a}),ue=({...a})=>e.jsx("tbody",{...a}),w=({...a})=>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",...a}),g=({className:a,...r})=>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 ${a}`,...r}),m=({className:a,...r})=>e.jsx("td",{className:`p-4 align-middle [&:has([role=checkbox])]:pr-0 ${a}`,...r}),L=({checked:a,onCheckedChange:r,className:s,...n})=>{const i=x=>{r&&r(x.target.checked),n.onChange&&n.onChange(x)};return e.jsx("input",{type:"checkbox",checked:a,onChange:i,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})},y=({className:a,variant:r="default",...s})=>{const i=`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 ${r==="destructive"?"border-transparent bg-red-500 text-zinc-50 dark:bg-red-900 dark:text-zinc-50":r==="secondary"?"border-transparent bg-azure-surface dark:bg-zinc-800 text-azure-text-secondary dark:text-matrix-secondary":r==="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"} ${a||""}`;return e.jsx("div",{className:i,...s})},C=({className:a,...r})=>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 ${a||""}`,...r}),E=({className:a,...r})=>e.jsx("div",{className:`flex flex-col space-y-1.5 p-6 ${a||""}`,...r}),he=({className:a,...r})=>e.jsx("h3",{className:`text-2xl font-semibold leading-none tracking-tight ${a||""}`,...r}),S=({className:a,...r})=>e.jsx("div",{className:`p-6 pt-0 ${a||""}`,...r}),ge=({className:a,variant:r="default",...s})=>{const i=`relative w-full rounded-lg border p-4 ${r==="destructive"?"border-red-500/50 text-red-700 dark:border-red-900/50 dark:text-red-300":"border-azure-border dark:border-matrix-primary"} ${a||""}`;return e.jsx("div",{className:i,...s})},fe=({className:a,...r})=>e.jsx("div",{className:`text-sm [&_p]:leading-relaxed ${a||""}`,...r}),pe=({isOpen:a,onClose:r,memory:s})=>s?e.jsx(re,{isOpen:a,onClose:r,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(se,{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(y,{variant:"outline",children:s.category})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{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(y,{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(I,{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(le,{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(B,{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(ne,{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(ce,{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(f,{onClick:r,children:"Close"})})]})}):null,je=()=>{const[a,r]=l.useState(!1),[s,n]=l.useState(null),i=l.useCallback(o=>(r(!0),n(null),j.get(o).then(c=>c).catch(c=>{throw n(c.message||"An error occurred"),c}).finally(()=>{r(!1)})),[]),x=l.useCallback((o,c)=>(r(!0),n(null),j.post(o,c).then(d=>d).catch(d=>{throw n(d.message||"An error occurred"),d}).finally(()=>{r(!1)})),[]),u=l.useCallback((o,c)=>(r(!0),n(null),j.post(o,c).then(d=>d).catch(d=>{throw n(d.message||"An error occurred"),d}).finally(()=>{r(!1)})),[]),b=l.useCallback(o=>(r(!0),n(null),j.delete(o).then(c=>c).catch(c=>{throw n(c.message||"An error occurred"),c}).finally(()=>{r(!1)})),[]);return{get:i,post:x,put:u,del:b,loading:a,error:s}},we=()=>{const[a,r]=l.useState([]),[s,n]=l.useState(!0),[i,x]=l.useState([]),[u,b]=l.useState(""),[o,c]=l.useState("all"),[d,F]=l.useState("all"),[D,p]=l.useState(null),[_,k]=l.useState(!1),[H,O]=l.useState(null),[P,M]=l.useState(!1),[A,T]=l.useState(null),[V,N]=l.useState(!1),{get:R,del:U,post:Q}=je();l.useEffect(()=>{v()},[]);const v=async()=>{try{n(!0);const t=await R("/sati/memories");r(t),p(null)}catch(t){p("Failed to load memories. Please try again."),console.error("Error fetching memories:",t)}finally{n(!1)}},Y=()=>{i.length===h.length?x([]):x(h.map(t=>t.id))},Z=t=>{i.includes(t)?x(i.filter(z=>z!==t)):x([...i,t])},q=async()=>{if(i.length!==0)try{await Q("/sati/memories/bulk-delete",{ids:i}),await v(),x([]),k(!1)}catch(t){p("Failed to delete memories. Please try again."),console.error("Error deleting memories:",t)}},G=t=>{T(t),N(!0)},J=async()=>{if(A)try{await U(`/sati/memories/${A}`),await v()}catch(t){p("Failed to delete memory. Please try again."),console.error("Error deleting memory:",t)}finally{T(null),N(!1)}},K=t=>{O(t),M(!0)},h=a.filter(t=>{const z=t.summary.toLowerCase().includes(u.toLowerCase())||t.details?.toLowerCase().includes(u.toLowerCase())||t.category.toLowerCase().includes(u.toLowerCase()),ee=o==="all"||t.category===o,te=d==="all"||t.importance===d;return z&&ee&&te&&!t.archived}),W=Array.from(new Set(a.map(t=>t.category))),X=Array.from(new Set(a.map(t=>t.importance)));return s?e.jsx(C,{className:"w-full",children:e.jsx(S,{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(de,{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."})]})]}),i.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:[i.length," selected"]}),e.jsxs(f,{variant:"destructive",size:"sm",onClick:()=>k(!0),disabled:i.length===0,children:[e.jsx($,{className:"w-4 h-4 mr-1"}),"Delete Selected"]})]})]}),D&&e.jsx(ge,{variant:"destructive",children:e.jsx(fe,{children:D})}),e.jsxs(C,{children:[e.jsx(E,{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(oe,{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:u,onChange:t=>b(t.target.value),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),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"}),W.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsxs("select",{value:d,onChange:t=>F(t.target.value),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"}),X.map(t=>e.jsx("option",{value:t,children:t},t))]})]})]})}),e.jsx(S,{className:"p-0",children:e.jsxs(xe,{children:[e.jsx(me,{children:e.jsxs(w,{className:"hover:bg-transparent",children:[e.jsx(g,{className:"w-12",children:e.jsx(L,{checked:h.length>0&&i.length===h.length,onCheckedChange:Y})}),e.jsx(g,{children:"Summary"}),e.jsx(g,{children:"Category"}),e.jsx(g,{children:"Importance"}),e.jsx(g,{children:"Created"}),e.jsx(g,{className:"w-32",children:"Actions"})]})}),e.jsx(ue,{children:h.length===0?e.jsx(w,{children:e.jsx(m,{colSpan:6,className:"text-center py-8 text-azure-text-secondary dark:text-matrix-secondary",children:s?"Loading memories...":"No memories found"})}):h.map(t=>e.jsxs(w,{children:[e.jsx(m,{children:e.jsx(L,{checked:i.includes(t.id),onCheckedChange:()=>Z(t.id)})}),e.jsx(m,{className:"font-medium max-w-xs truncate",children:t.summary}),e.jsx(m,{children:e.jsx(y,{variant:"outline",children:t.category})}),e.jsx(m,{children:e.jsx(y,{variant:t.importance==="critical"?"destructive":t.importance==="high"?"default":t.importance==="medium"?"secondary":"outline",children:t.importance})}),e.jsx(m,{children:e.jsxs("div",{className:"flex items-center gap-1 text-azure-text-secondary dark:text-matrix-secondary",children:[e.jsx(I,{className:"w-4 h-4"}),new Date(t.created_at).toLocaleDateString()]})}),e.jsx(m,{children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx(f,{variant:"ghost",size:"sm",onClick:()=>K(t),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:e.jsx(B,{className:"w-4 h-4"})}),e.jsx(f,{variant:"ghost",size:"sm",onClick:()=>G(t.id),className:"text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:e.jsx($,{className:"w-4 h-4"})})]})})]},t.id))})]})})]}),_&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs(C,{className:"w-full max-w-md mx-4",children:[e.jsx(E,{children:e.jsx(he,{children:"Delete Memories"})}),e.jsxs(S,{children:[e.jsxs("p",{className:"mb-4",children:["Are you sure you want to delete ",i.length," ","memory(ies)? This action cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(f,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),e.jsx(f,{variant:"destructive",onClick:q,children:"Delete"})]})]})]})}),e.jsx(pe,{isOpen:P,onClose:()=>M(!1),memory:H}),e.jsx(ae,{isOpen:V,onClose:()=>N(!1),onConfirm:J,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{we as SatiMemories};
@@ -1,9 +0,0 @@
1
- import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as g,f as N,c as v}from"./vendor-react-DikRIOlj.js";import{u as _}from"./vendor-utils-D4NnWbOU.js";import{h as w}from"./index-CQIUjucB.js";import{z as b,p as C,E as y,l as z,h as f,G as $,ag as S,a2 as L,ap as j,aq as E,n as R,i as O,ar as T,F as A,as as M,J as B,a5 as F,at as U,q as I,$ as P}from"./vendor-icons-DLvvGkeN.js";function D(t,a=0,n=100){const s=n,l=a*n,{data:x,error:d,isLoading:o}=_(t?`/sessions/${t}/audit?limit=${s}&offset=${l}`:null,r=>w.get(r),{revalidateOnFocus:!1});return{data:x,error:d,isLoading:o}}const G={llm_call:e.jsx(j,{size:14}),tool_call:e.jsx(b,{size:14}),mcp_tool:e.jsx(L,{size:14}),task_created:e.jsx(S,{size:14}),task_completed:e.jsx(y,{size:14}),skill_executed:e.jsx($,{size:14}),chronos_job:e.jsx(f,{size:14}),memory_recovery:e.jsx(z,{size:14})},J={llm_call:"text-blue-400 dark:text-blue-400",tool_call:"text-amber-500 dark:text-amber-400",mcp_tool:"text-purple-500 dark:text-purple-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"},V={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"};function W(t){return t==null?"—":t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function q(t){return t==null||t===0?"—":t<1e-4?"<$0.0001":`$${t.toFixed(4)}`}function Z(t,a){if(t==null&&a==null)return"";const n=t??0,s=a??0;return`↑${n.toLocaleString()} ↓${s.toLocaleString()}`}const k=({event:t})=>{const a=G[t.event_type]??e.jsx(b,{size:14}),n=J[t.event_type]??"text-gray-500",s=t.agent?V[t.agent]??"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300":null,l=t.metadata?JSON.parse(t.metadata):null,x=t.event_type==="memory_recovery"?`${l?.memories_count??0} memories retrieved`:t.tool_name??t.model??t.event_type,d=Z(t.input_tokens,t.output_tokens),o=q(t.estimated_cost_usd),r=W(t.duration_ms),c=t.status==="error"?e.jsx(C,{size:14,className:"text-red-500 flex-shrink-0"}):t.status==="success"?e.jsx(y,{size:14,className:"text-green-500 dark:text-matrix-highlight flex-shrink-0"}):null;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",children:[e.jsx("span",{className:`flex-shrink-0 ${n}`,children:a}),s&&e.jsx("span",{className:`flex-shrink-0 text-xs font-semibold px-1.5 py-0.5 rounded ${s}`,children:t.agent}),e.jsx("span",{className:"flex-1 text-sm text-gray-700 dark:text-matrix-secondary font-mono break-all leading-snug",children:x}),c]}),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:[d&&e.jsx("span",{children:d}),e.jsx("span",{children:r}),o!=="—"&&e.jsx("span",{className:"text-gray-600 dark:text-matrix-secondary",children:o})]})]}),e.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[e.jsx("span",{className:`flex-shrink-0 ${n}`,children:a}),s&&e.jsx("span",{className:`flex-shrink-0 text-xs font-semibold px-1.5 py-0.5 rounded ${s}`,children:t.agent}),e.jsx("span",{className:"flex-1 text-sm truncate text-gray-700 dark:text-matrix-secondary font-mono",children:x}),d&&e.jsx("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono whitespace-nowrap",children:d}),e.jsx("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono w-16 text-right whitespace-nowrap",children:r}),c,e.jsx("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono w-20 text-right whitespace-nowrap",children:o})]})]})},H=({events:t,page:a,pageSize:n,totalCount:s,onPageChange:l})=>{const x=Math.ceil(s/n),d=a*n+1,o=Math.min(a*n+t.length,s);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 r=[],c=new Map;for(const i of t)if(i.task_id){const m=c.get(i.task_id)??[];m.push(i),c.set(i.task_id,m)}const h=new Set;for(const i of t)i.task_id?h.has(i.task_id)||(h.add(i.task_id),r.push({taskId:i.task_id,events:c.get(i.task_id)})):r.push({taskId:null,events:[i]});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:r.map(i=>i.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: ",i.taskId.slice(0,8),"…"]}),e.jsx("div",{className:"pl-4",children:i.events.map(m=>e.jsx(k,{event:m},m.id))})]},i.taskId):e.jsx(k,{event:i.events[0]},i.events[0].id))}),x>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:[d,"–",o," of ",s," events"]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>l(a-1),disabled:a===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(E,{size:16})}),e.jsxs("span",{className:"text-xs self-center text-gray-500 dark:text-matrix-secondary font-mono px-2",children:[a+1," / ",x]}),e.jsx("button",{onClick:()=>l(a+1),disabled:a>=x-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(R,{size:16})})]})]})]})};function p(t){return t===0?"$0.00":t<1e-4?"<$0.0001":`$${t.toFixed(4)}`}function X(t){return t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(1)}s`:`${(t/6e4).toFixed(1)}m`}const K=({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(O,{size:14})," Total Cost"]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-matrix-highlight font-mono",children:p(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(j,{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(b,{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(f,{size:12,className:"text-gray-400"}),e.jsxs("span",{children:[X(t.totalDurationMs)," total duration"]})]})]})]}),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(a=>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:a.agent}),e.jsx("td",{className:"py-1.5 text-right text-gray-500 dark:text-matrix-secondary/70 font-mono",children:a.llmCalls}),e.jsx("td",{className:"py-1.5 text-right text-gray-500 dark:text-matrix-secondary/70 font-mono",children:(a.inputTokens+a.outputTokens).toLocaleString()}),e.jsx("td",{className:"py-1.5 text-right text-gray-700 dark:text-matrix-highlight font-mono",children:p(a.estimatedCostUsd)})]},a.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(a=>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:a.model}),e.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-matrix-highlight whitespace-nowrap shrink-0",children:p(a.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:[a.calls," calls"]}),e.jsxs("span",{children:["in ",a.inputTokens.toLocaleString()]}),e.jsxs("span",{children:["out ",a.outputTokens.toLocaleString()]})]})]},`${a.provider}/${a.model}`))})]})]});function Q(t,a){const n=new Blob([JSON.stringify(a,null,2)],{type:"application/json"}),s=URL.createObjectURL(n),l=document.createElement("a");l.href=s,l.download=`audit-${t.slice(0,8)}.json`,l.click(),URL.revokeObjectURL(s)}function Y(t,a){const n=["id","created_at","event_type","agent","tool_name","provider","model","input_tokens","output_tokens","duration_ms","status","estimated_cost_usd"],s=a.events.map(r=>[r.id,new Date(r.created_at).toISOString(),r.event_type,r.agent??"",r.tool_name??"",r.provider??"",r.model??"",r.input_tokens??"",r.output_tokens??"",r.duration_ms??"",r.status??"",r.estimated_cost_usd??""].map(c=>`"${String(c).replace(/"/g,'""')}"`).join(",")),l=[n.join(","),...s].join(`
2
- `),x=new Blob([l],{type:"text/csv"}),d=URL.createObjectURL(x),o=document.createElement("a");o.href=d,o.download=`audit-${t.slice(0,8)}.csv`,o.click(),URL.revokeObjectURL(d)}const ee=({sessionId:t,data:a})=>{const[n,s]=g.useState(!1);return a?e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>s(!n),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(T,{size:14}),"Export",e.jsx(A,{size:12})]}),n&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>s(!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:()=>{Q(t,a),s(!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(M,{size:14,className:"text-blue-500"}),"Export JSON"]}),e.jsxs("button",{onClick:()=>{Y(t,a),s(!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(B,{size:14,className:"text-green-500"}),"Export CSV"]})]})]})]}):null},u=100,le=()=>{const{id:t}=N(),a=v(),[n,s]=g.useState(0),{data:l,error:x,isLoading:d}=D(t??null,n,u),o=g.useRef(null),[r,c]=g.useState(()=>typeof window<"u"?window.innerWidth>=768:!0);return g.useEffect(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[l]),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:()=>a(-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(F,{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:()=>c(h=>!h),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(U,{size:18})}),e.jsx(ee,{sessionId:t??"",data:l})]})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden relative",children:[r&&e.jsx("div",{className:"fixed inset-0 bg-black/40 z-20 md:hidden",onClick:()=>c(!1)}),e.jsxs("div",{ref:o,className:"flex-[6] overflow-y-auto p-6 custom-scrollbar",children:[d&&e.jsxs("div",{className:"flex items-center justify-center h-40 gap-2 text-gray-400 dark:text-matrix-secondary",children:[e.jsx(I,{size:18,className:"animate-spin"}),"Loading audit events…"]}),x&&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(P,{size:16}),"Failed to load audit events: ",x.message]}),l&&e.jsx(H,{events:l.events,page:n,pageSize:u,totalCount:l.summary.llmCallCount+l.summary.toolCallCount,onPageChange:s})]}),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
- ${r?"translate-x-0":"translate-x-full"}
9
- `,children:l?e.jsx(K,{summary:l.summary}):!d&&e.jsx("div",{className:"text-sm text-gray-400 dark:text-matrix-secondary/50 text-center mt-10",children:"No summary available."})})]})]})};export{le as SessionAudit};
@@ -1,7 +0,0 @@
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 K}from"./vendor-utils-D4NnWbOU.js";import{s as l}from"./skills-BPjq0qV7.js";import{D as Z,e as O,j as V}from"./index-CQIUjucB.js";import{W as y,ah as u,K as b,$ as W,E as F,N as L,U as I,V as q,a0 as A,a1 as B,X as H,ai as M}from"./vendor-icons-DLvvGkeN.js";const U={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},g={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};function X({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 G({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:E}=K("/skills",()=>l.fetchSkills(),{refreshInterval:1e4}),m=S?.skills??[],D=S?.enabled??0,$=async()=>{await l.reloadSkills(),z()},R=async a=>{a.enabled?await l.disableSkill(a.name):await l.enableSkill(a.name),z()},T=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":"",", ",D," 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:$,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"]})]})]}),E?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(X,{skill:a,onToggle:()=>R(a),onView:()=>T(a)},a.name))}),e.jsx(G,{skill:r,open:!!r,onOpenChange:a=>!a&&i(null)}),e.jsxs(Z,{open:x,onOpenChange:N,children:[e.jsx(O,{children:e.jsx(V,{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(W,{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(F,{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};
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as x}from"./vendor-react-DikRIOlj.js";import{u as R}from"./vendor-utils-D4NnWbOU.js";import{c as b,S as X,N as v}from"./config-DX3Xb0XE.js";import{S as Y,T as w}from"./SelectInput-KVLsnfra.js";import{ab as J,$ as C,H as S,K as Q,aj as D,a3 as H,a9 as V,ak as I,aa as Z,al as ee,am as te,an as re,v as ae,y as se,k as ie,ao as ne,h as le,ac as de,F as oe,X as ce}from"./vendor-icons-DLvvGkeN.js";import"./index-CQIUjucB.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",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 O({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}=R("/api/smiths",b.getSmithsList,{refreshInterval:1e4}),{data:i,mutate:o}=R("/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)},B=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}`)}},q=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(F=>F.name===r.name?r:F)};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(D,{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(H,{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(D,{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(H,{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:B,onEdit:n=>{z({...n,auth_token:""}),u(null)},onDelete:q},r.name))}),p&&e.jsx(O,{title:"Add Smith",initial:xe,onSave:G,onClose:()=>f(!1),saving:_,error:$}),c&&e.jsx(O,{title:"Edit Smith",initial:c,isEdit:!0,onSave:W,onClose:()=>z(null),saving:_,error:$})]})}export{ze as SmithsPage};
@@ -1 +0,0 @@
1
- import{j as e,m as c}from"./vendor-motion-C3CZ8ZlO.js";import{r as l}from"./vendor-react-DikRIOlj.js";import{u as f}from"./vendor-utils-D4NnWbOU.js";import{t as x}from"./index-CQIUjucB.js";import{g as C,K as D,V as F,a8 as R,o as T,p as N,q as I,h as L,X as P,$ as B}from"./vendor-icons-DLvvGkeN.js";const E={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},b={hidden:{opacity:0,y:8},show:{opacity:1,y:0}},O={pending:"Pending",running:"Running",completed:"Completed",failed:"Failed",cancelled:"Cancelled"};function S({status:r}){const a="inline-flex items-center gap-1 text-xs font-medium rounded-full px-2 py-0.5 border";return r==="completed"?e.jsxs("span",{className:`${a} text-emerald-600 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-900/20 border-emerald-200 dark:border-emerald-700/50`,children:[e.jsx(T,{className:"w-3 h-3"}),"Completed"]}):r==="failed"?e.jsxs("span",{className:`${a} text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-700/50`,children:[e.jsx(N,{className:"w-3 h-3"}),"Failed"]}):r==="running"?e.jsxs("span",{className:`${a} text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-700/50`,children:[e.jsx(I,{className:"w-3 h-3 animate-spin"}),"Running"]}):r==="cancelled"?e.jsxs("span",{className:`${a} text-zinc-500 dark:text-zinc-400 bg-zinc-100 dark:bg-zinc-900 border-zinc-200 dark:border-zinc-700`,children:[e.jsx(N,{className:"w-3 h-3"}),"Cancelled"]}):e.jsxs("span",{className:`${a} text-yellow-600 dark:text-yellow-400 bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-700/50`,children:[e.jsx(L,{className:"w-3 h-3"}),"Pending"]})}function _({agent:r}){return e.jsx("span",{className:"inline-flex items-center text-[10px] font-medium font-mono rounded px-1.5 py-0.5 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 uppercase",children:r})}function A({channel:r}){return e.jsx("span",{className:"inline-flex items-center text-[10px] font-medium rounded px-1.5 py-0.5 border border-zinc-200 dark:border-zinc-700 bg-zinc-100 dark:bg-zinc-900 text-zinc-500 dark:text-zinc-400 uppercase",children:r})}const w=r=>r?new Date(r).toLocaleString(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"—",z=r=>r?new Date(r).toLocaleString():"—";function M({task:r,onClose:a,onCancel:o,onRetry:g}){const s=r.status==="pending"||r.status==="running",m=r.status==="failed";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:a}),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(C,{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",children:"Task Details"}),e.jsx(S,{status:r.status})]}),e.jsx("p",{className:"text-xs font-mono text-azure-text-secondary dark:text-matrix-tertiary mt-0.5 truncate",children:r.id})]})]}),e.jsx("button",{onClick:a,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(P,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"overflow-y-auto flex-1 p-5 space-y-5",children:[e.jsx("div",{className:"grid grid-cols-2 gap-x-6 gap-y-2 text-sm",children:[{label:"Agent",value:e.jsx(_,{agent:r.agent})},{label:"Channel",value:e.jsx(A,{channel:r.origin_channel})},{label:"Attempts",value:`${r.attempt_count} / ${r.max_attempts}`},{label:"Session",value:e.jsx("span",{className:"font-mono text-xs",children:r.session_id})},{label:"Created",value:z(r.created_at)},{label:"Finished",value:z(r.finished_at)}].map(({label:i,value:y})=>e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary",children:i}),e.jsx("span",{className:"text-azure-text dark:text-matrix-secondary",children:y})]},i))}),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:"Input"}),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-48 whitespace-pre-wrap leading-relaxed font-mono",children:r.input})]}),r.output&&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:"Output"}),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-64 whitespace-pre-wrap leading-relaxed font-mono",children:r.output})]}),r.error&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-red-500 mb-2 flex items-center gap-1",children:[e.jsx(B,{className:"w-3 h-3"})," Error"]}),e.jsx("pre",{className:"rounded-lg bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-800/50 p-4 text-xs text-red-600 dark:text-red-400 overflow-auto max-h-48 whitespace-pre-wrap leading-relaxed font-mono",children:r.error})]})]}),(s||m)&&e.jsxs("div",{className:"flex justify-end gap-2 px-5 py-4 border-t border-azure-border dark:border-matrix-primary shrink-0",children:[s&&e.jsx("button",{onClick:o,className:"px-4 py-2 rounded text-sm border border-red-300 dark:border-red-700/60 text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors",children:"Cancel Task"}),m&&e.jsx("button",{onClick:g,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 transition-colors",children:"Retry Task"})]})]})]})}const V={Pending:"text-yellow-600 dark:text-yellow-400",Running:"text-blue-600 dark:text-blue-400",Completed:"text-emerald-600 dark:text-emerald-400",Failed:"text-red-600 dark:text-red-400",Cancelled:"text-zinc-500 dark:text-zinc-400",Total:"text-azure-text dark:text-matrix-highlight"};function n({label:r,value:a}){return e.jsxs("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black px-4 py-3",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary",children:r}),e.jsx("p",{className:`text-2xl font-bold mt-0.5 ${V[r]??"text-azure-text dark:text-matrix-secondary"}`,children:a})]})}function G(){const[r,a]=l.useState(""),[o,g]=l.useState(""),[s,m]=l.useState(""),[i,y]=l.useState(""),[u,h]=l.useState(null),k=l.useMemo(()=>({status:r||void 0,agent:o||void 0,origin_channel:s||void 0,session_id:i.trim()||void 0,limit:200}),[r,o,s,i]),{data:d}=f("/tasks/stats",()=>x.stats(),{refreshInterval:5e3}),{data:v=[],mutate:j}=f(["/tasks",k],()=>x.list(k),{refreshInterval:3e3}),p="px-3 py-2 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";return e.jsxs(c.div,{variants:E,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(c.div,{variants:b,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(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:"Tasks"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"Async tasks delegated by Oracle and processed by workers."})]})]}),e.jsxs(c.div,{variants:b,className:"grid grid-cols-3 md:grid-cols-6 gap-3",children:[e.jsx(n,{label:"Pending",value:d?.pending??0}),e.jsx(n,{label:"Running",value:d?.running??0}),e.jsx(n,{label:"Completed",value:d?.completed??0}),e.jsx(n,{label:"Failed",value:d?.failed??0}),e.jsx(n,{label:"Cancelled",value:d?.cancelled??0}),e.jsx(n,{label:"Total",value:d?.total??0})]}),e.jsxs(c.div,{variants:b,className:"rounded-lg border border-azure-border dark:border-matrix-primary p-4 bg-white dark:bg-black grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsxs("select",{className:p,value:r,onChange:t=>a(t.target.value||""),children:[e.jsx("option",{value:"",children:"All status"}),Object.entries(O).map(([t,$])=>e.jsx("option",{value:t,children:$},t))]}),e.jsxs("select",{className:p,value:o,onChange:t=>g(t.target.value||""),children:[e.jsx("option",{value:"",children:"All agents"}),e.jsx("option",{value:"apoc",children:"Apoc"}),e.jsx("option",{value:"neo",children:"Neo"}),e.jsx("option",{value:"smith",children:"Smith"}),e.jsx("option",{value:"trinit",children:"Trinity"})]}),e.jsxs("select",{className:p,value:s,onChange:t=>m(t.target.value||""),children:[e.jsx("option",{value:"",children:"All channels"}),e.jsx("option",{value:"telegram",children:"Telegram"}),e.jsx("option",{value:"discord",children:"Discord"}),e.jsx("option",{value:"ui",children:"UI"}),e.jsx("option",{value:"api",children:"API"}),e.jsx("option",{value:"webhook",children:"Webhook"}),e.jsx("option",{value:"cli",children:"CLI"})]}),e.jsx("input",{className:`${p} placeholder:text-azure-text-secondary/50 dark:placeholder:text-matrix-secondary/40`,value:i,onChange:t=>y(t.target.value),placeholder:"Filter by session ID"})]}),e.jsx(c.div,{variants:b,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 min-w-[820px]",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:[{label:"ID",cls:"w-24"},{label:"Status",cls:"w-32"},{label:"Agent",cls:"w-24"},{label:"Channel",cls:"w-24"},{label:"Session",cls:"w-28"},{label:"Attempts",cls:"w-20"},{label:"Created",cls:"w-36"},{label:"Finished",cls:"w-36"},{label:"",cls:"w-16"}].map(t=>e.jsx("th",{className:`text-left px-4 py-3 text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary ${t.cls}`,children:t.label},t.label))})}),e.jsx("tbody",{children:v.length===0?e.jsx("tr",{children:e.jsxs("td",{colSpan:9,className:"px-4 py-12 text-center text-azure-text-secondary dark:text-matrix-tertiary",children:[e.jsx(D,{className:"w-5 h-5 mx-auto mb-2 opacity-40"}),"No tasks found."]})}):v.map(t=>e.jsxs("tr",{className:"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("td",{className:"px-4 py-3 font-mono text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:t.id.slice(0,8)}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(S,{status:t.status})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(_,{agent:t.agent})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(A,{channel:t.origin_channel})}),e.jsx("td",{className:"px-4 py-3 font-mono text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:t.session_id?t.session_id.slice(0,10):"—"}),e.jsxs("td",{className:"px-4 py-3 text-center text-azure-text-secondary dark:text-matrix-secondary text-xs",children:[t.attempt_count,"/",t.max_attempts]}),e.jsx("td",{className:"px-4 py-3 text-xs text-azure-text-secondary dark:text-matrix-secondary whitespace-nowrap",children:w(t.created_at)}),e.jsx("td",{className:"px-4 py-3 text-xs text-azure-text-secondary dark:text-matrix-secondary whitespace-nowrap",children:w(t.finished_at)}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>h(t),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(F,{className:"w-3.5 h-3.5"})}),(t.status==="pending"||t.status==="running")&&e.jsx("button",{onClick:async()=>{await x.cancel(t.id),j()},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:"Cancel task",children:e.jsx(R,{className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})}),u&&e.jsx(M,{task:u,onClose:()=>h(null),onCancel:async()=>{await x.cancel(u.id),h(null),j()},onRetry:async()=>{await x.retry(u.id),h(null),j()}})]})}export{G as TasksPage};
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as l}from"./vendor-react-DikRIOlj.js";import{u as ne,m as C}from"./vendor-utils-D4NnWbOU.js";import{h as u}from"./index-CQIUjucB.js";import{C as oe}from"./ConfirmationModal-Bx-GtD9B.js";import{D as S,a3 as de,a9 as D,aa as ce,ab as B,K as me,y as xe,F as he,n as pe,X as ue}from"./vendor-icons-DLvvGkeN.js";const T={postgresql:5432,mysql:3306,mongodb:27017,sqlite:0},H={name:"",type:"postgresql",host:"",port:"",database_name:"",username:"",password:"",connection_string:"",allow_read:!0,allow_insert:!1,allow_update:!1,allow_delete:!1,allow_ddl:!1},ge={postgresql:[{key:"allow_read",label:"SELECT",description:"Permite consultas SELECT"},{key:"allow_insert",label:"INSERT",description:"Permite inserir registros"},{key:"allow_update",label:"UPDATE",description:"Permite atualizar registros"},{key:"allow_delete",label:"DELETE",description:"Permite excluir registros"},{key:"allow_ddl",label:"DDL",description:"CREATE / ALTER / DROP TABLE"}],mysql:[{key:"allow_read",label:"SELECT",description:"Permite consultas SELECT"},{key:"allow_insert",label:"INSERT",description:"Permite inserir registros"},{key:"allow_update",label:"UPDATE",description:"Permite atualizar registros"},{key:"allow_delete",label:"DELETE",description:"Permite excluir registros"},{key:"allow_ddl",label:"DDL",description:"CREATE / ALTER / DROP TABLE"}],sqlite:[{key:"allow_read",label:"SELECT",description:"Permite consultas SELECT"},{key:"allow_insert",label:"INSERT",description:"Permite inserir registros"},{key:"allow_update",label:"UPDATE",description:"Permite atualizar registros"},{key:"allow_delete",label:"DELETE",description:"Permite excluir registros"},{key:"allow_ddl",label:"DDL",description:"CREATE / ALTER / DROP TABLE"}],mongodb:[{key:"allow_read",label:"find / aggregate",description:"Permite consultas e agregações"},{key:"allow_insert",label:"insertOne / insertMany",description:"Permite inserir documentos"},{key:"allow_update",label:"updateOne / updateMany",description:"Permite atualizar documentos"},{key:"allow_delete",label:"deleteOne / deleteMany",description:"Permite excluir documentos"},{key:"allow_ddl",label:"Schema changes",description:"createCollection / dropCollection / createIndex"}]};async function be(){return u.get("/trinity/databases")}function we(){const{data:v,error:R}=ne("/trinity/databases",be,{refreshInterval:3e4}),[W,h]=l.useState(!1),[o,P]=l.useState(null),[r,n]=l.useState(H),[L,w]=l.useState(!1),[z,g]=l.useState(null),[Q,G]=l.useState({}),[$,q]=l.useState(null),[J,M]=l.useState({}),[O,A]=l.useState(null),[K,I]=l.useState(null),[f,_]=l.useState(null),[b,y]=l.useState(!1),X=()=>{P(null),n(H),y(!1),g(null),h(!0)},Y=a=>{P(a),n({name:a.name,type:a.type,host:a.host||"",port:a.port?String(a.port):"",database_name:a.database_name||"",username:a.username||"",password:"",connection_string:"",allow_read:a.allow_read,allow_insert:a.allow_insert,allow_update:a.allow_update,allow_delete:a.allow_delete,allow_ddl:a.allow_ddl}),y(!!a.connection_string),g(null),h(!0)},V=async()=>{if(w(!0),g(null),!b&&!r.database_name.trim()){g(r.type==="sqlite"?"File path is required.":"Database name is required."),w(!1);return}try{const a={name:r.name,type:r.type,allow_read:r.allow_read,allow_insert:r.allow_insert,allow_update:r.allow_update,allow_delete:r.allow_delete,allow_ddl:r.allow_ddl};b?(!o||r.connection_string)&&(a.connection_string=r.connection_string||null):(a.host=r.host||null,a.port=r.port?parseInt(r.port):null,a.database_name=r.database_name||null,a.username=r.username||null,(!o||r.password)&&(a.password=r.password||null)),o?await u.put(`/trinity/databases/${o.id}`,a):await u.post("/trinity/databases",a),await C("/trinity/databases"),h(!1)}catch(a){g(a.message||"Failed to save database")}finally{w(!1)}},Z=a=>{_(a)},ee=async()=>{if(!f)return;const a=f.id;I(a);try{await u.delete(`/trinity/databases/${a}`),await C("/trinity/databases")}catch(t){alert(`Delete failed: ${t.message}`)}finally{I(null),_(null)}},ae=async a=>{q(a);try{const t=await u.post(`/trinity/databases/${a}/test`,{});M(i=>({...i,[a]:t.success}))}catch{M(t=>({...t,[a]:!1}))}finally{q(null)}},te=async a=>{A(a);try{await u.post(`/trinity/databases/${a}/refresh-schema`,{}),await C("/trinity/databases")}catch(t){alert(`Schema refresh failed: ${t.message}`)}finally{A(null)}},re=a=>{G(t=>({...t,[a]:!t[a]}))},se=a=>{a!=="mongodb"&&y(!1),n(t=>({...t,type:a,port:T[a]?String(T[a]):""}))},ie=a=>{n(t=>({...t,[a]:!t[a]}))};if(R)return e.jsxs("div",{className:"p-8 text-red-500",children:["Failed to load databases: ",R.message]});const x="w-full px-3 py-2 bg-azure-surface dark:bg-black border border-azure-border dark:border-matrix-primary rounded text-azure-text-primary dark:text-matrix-secondary font-mono text-sm focus:outline-none focus:border-azure-primary dark:focus:border-matrix-highlight",m="block text-xs font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",le=a=>[{key:"allow_read",badge:"R"},{key:"allow_insert",badge:"I"},{key:"allow_update",badge:"U"},{key:"allow_delete",badge:"D"},{key:"allow_ddl",badge:"DDL"}].filter(i=>a[i.key]).map(i=>i.badge);return e.jsxs("div",{className:"max-w-5xl mx-auto 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(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:"Trinity Databases"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"Register databases for Trinity to access and query."})]})]}),e.jsxs("button",{onClick:X,className:"flex items-center gap-2 px-4 py-2 bg-azure-primary text-white rounded hover:bg-azure-active dark:bg-matrix-highlight dark:text-black dark:hover:bg-matrix-highlight/90 transition-colors text-sm font-medium",children:[e.jsx(de,{className:"w-4 h-4"}),"Register Database"]})]}),v?v.length===0?e.jsxs("div",{className:"border border-azure-border dark:border-matrix-primary rounded p-8 text-center text-azure-text-secondary dark:text-matrix-secondary",children:[e.jsx(S,{className:"w-10 h-10 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"font-medium",children:"No databases registered"}),e.jsx("p",{className:"text-sm mt-1 opacity-70",children:'Click "Register Database" to add your first database.'})]}):e.jsx("div",{className:"space-y-4",children:v.map(a=>{const t=a.schema_json?JSON.parse(a.schema_json):null,i=!!t?.databases,c=i?t.databases.reduce((s,d)=>s+d.tables.length,0):t?.tables?.length??0,j=i?t.databases.length:0,k=a.type==="mongodb"?"collection":"table",p=a.type==="mongodb"?"collections":"tables",F=J[a.id],E=Q[a.id],U=le(a);return e.jsxs("div",{className:"border border-azure-border dark:border-matrix-primary rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"bg-azure-surface dark:bg-black/50 px-4 py-3 flex items-center gap-3",children:[e.jsx(S,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-bold text-azure-text-primary dark:text-matrix-highlight truncate",children:a.name}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary uppercase flex-shrink-0",children:a.type}),F===!0&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-500",children:[e.jsx(D,{className:"w-3 h-3"})," Connected"]}),F===!1&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-red-500",children:[e.jsx(ce,{className:"w-3 h-3"})," Failed"]}),U.length>0&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(B,{className:"w-3 h-3 text-azure-text-secondary dark:text-matrix-secondary opacity-60"}),U.map(s=>e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-azure-primary/10 dark:bg-matrix-highlight/10 text-azure-primary dark:text-matrix-highlight font-mono",children:s},s))]})]}),e.jsxs("div",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary truncate mt-0.5",children:[a.host?`${a.host}:${a.port}${a.database_name?`/${a.database_name}`:""}`:a.database_name||"connection string configured",i&&j>0&&e.jsxs("span",{className:"ml-2 opacity-70",children:["· ",j," database",j!==1?"s":""," · ",c," ",c!==1?p:k]}),!i&&c>0&&e.jsxs("span",{className:"ml-2 opacity-70",children:["· ",c," ",c!==1?p:k]}),a.schema_updated_at&&e.jsxs("span",{className:"ml-2 opacity-50",children:["· schema ",new Date(a.schema_updated_at).toLocaleDateString()]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("button",{onClick:()=>ae(a.id),disabled:$===a.id,title:"Test connection",className:"p-1.5 rounded hover:bg-azure-hover dark:hover:bg-matrix-primary/30 text-azure-text-secondary dark:text-matrix-secondary transition-colors",children:$===a.id?e.jsx(D,{className:"w-4 h-4 animate-pulse"}):e.jsx(D,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>te(a.id),disabled:O===a.id,title:"Refresh schema",className:"p-1.5 rounded hover:bg-azure-hover dark:hover:bg-matrix-primary/30 text-azure-text-secondary dark:text-matrix-secondary transition-colors",children:e.jsx(me,{className:`w-4 h-4 ${O===a.id?"animate-spin":""}`})}),e.jsx("button",{onClick:()=>Y(a),title:"Edit",className:"p-1.5 rounded hover:bg-azure-hover dark:hover:bg-matrix-primary/30 text-azure-text-secondary dark:text-matrix-secondary transition-colors text-xs font-medium px-2",children:"Edit"}),e.jsx("button",{onClick:()=>Z(a),disabled:K===a.id,title:"Delete",className:"p-1.5 rounded hover:bg-red-50 dark:hover:bg-red-900/20 text-red-500 transition-colors",children:e.jsx(xe,{className:"w-4 h-4"})}),t&&e.jsx("button",{onClick:()=>re(a.id),title:E?"Hide schema":"Show schema",className:"p-1.5 rounded hover:bg-azure-hover dark:hover:bg-matrix-primary/30 text-azure-text-secondary dark:text-matrix-secondary transition-colors",children:E?e.jsx(he,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]})]}),E&&t&&e.jsxs("div",{className:"border-t border-azure-border dark:border-matrix-primary px-4 py-3 bg-azure-bg dark:bg-black/20",children:[e.jsx("div",{className:"text-xs font-medium text-azure-text-secondary dark:text-matrix-secondary mb-2",children:i?`${j} database${j!==1?"s":""} — ${c} ${c!==1?p:k} total`:`Schema — ${c} ${c!==1?p:k}`}),e.jsx("div",{className:"space-y-2 max-h-72 overflow-y-auto",children:i?t.databases?.map(s=>e.jsxs("div",{className:"text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:"font-bold text-azure-primary dark:text-matrix-highlight",children:s.name}),e.jsxs("span",{className:"opacity-40 text-azure-text-secondary dark:text-matrix-secondary",children:["(",s.tables.length," ",s.tables.length!==1?p:k,")"]})]}),e.jsxs("div",{className:"pl-3 space-y-1.5 border-l border-azure-border dark:border-matrix-primary/40 ml-1",children:[s.tables.map(d=>e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-azure-text-primary dark:text-matrix-secondary mb-0.5",children:d.name}),e.jsx("div",{className:"pl-3 space-y-0.5",children:d.columns?.map(N=>e.jsxs("div",{className:"text-azure-text-secondary dark:text-matrix-secondary font-mono",children:[e.jsx("span",{children:N.name}),e.jsx("span",{className:"opacity-50 ml-2",children:N.type}),N.nullable===!1&&e.jsx("span",{className:"ml-1 opacity-40",children:"NOT NULL"})]},N.name))})]},d.name)),s.tables.length===0&&e.jsxs("div",{className:"text-azure-text-secondary dark:text-matrix-secondary opacity-50 italic",children:["no ",p]})]})]},s.name)):t.tables?.map(s=>e.jsxs("div",{className:"text-xs",children:[e.jsx("div",{className:"font-bold text-azure-primary dark:text-matrix-highlight mb-1",children:s.name}),e.jsx("div",{className:"pl-3 space-y-0.5",children:s.columns?.map(d=>e.jsxs("div",{className:"text-azure-text-secondary dark:text-matrix-secondary font-mono",children:[e.jsx("span",{className:"text-azure-text-primary dark:text-matrix-secondary",children:d.name}),e.jsx("span",{className:"opacity-50 ml-2",children:d.type}),d.nullable===!1&&e.jsx("span",{className:"ml-1 opacity-40 text-xs",children:"NOT NULL"})]},d.name))})]},s.name))})]})]},a.id)})}):e.jsx("div",{className:"text-azure-text-secondary dark:text-matrix-secondary",children:"Loading..."}),e.jsx(oe,{isOpen:!!f,onClose:()=>_(null),onConfirm:ee,title:"Delete database",description:`Remove "${f?.name}" from Trinity? The database itself won't be affected — only this registration will be deleted.`,confirmJson:"Delete",variant:"destructive"}),W&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:()=>h(!1)}),e.jsxs("div",{className:"relative bg-azure-surface dark:bg-black border border-azure-border dark:border-matrix-primary rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-azure-border dark:border-matrix-primary",children:[e.jsx("h2",{className:"text-lg font-bold text-azure-text-primary dark:text-matrix-highlight",children:o?"Edit Database":"Register Database"}),e.jsx("button",{onClick:()=>h(!1),className:"text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-text-primary dark:hover:text-matrix-highlight",children:e.jsx(ue,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:m,children:"Name *"}),e.jsx("input",{className:x,value:r.name,onChange:a=>n(t=>({...t,name:a.target.value})),placeholder:"My Production DB"})]}),e.jsxs("div",{children:[e.jsx("label",{className:m,children:"Type *"}),e.jsxs("select",{className:x,value:r.type,onChange:a=>se(a.target.value),children:[e.jsx("option",{value:"postgresql",children:"PostgreSQL"}),e.jsx("option",{value:"mysql",children:"MySQL / MariaDB"}),e.jsx("option",{value:"sqlite",children:"SQLite"}),e.jsx("option",{value:"mongodb",children:"MongoDB"})]})]}),r.type==="mongodb"&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>y(!1),className:`text-xs px-3 py-1.5 rounded border transition-colors ${b?"border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary":"border-azure-primary dark:border-matrix-highlight bg-azure-primary/10 dark:bg-matrix-highlight/10 text-azure-primary dark:text-matrix-highlight"}`,children:"Individual fields"}),e.jsx("button",{type:"button",onClick:()=>y(!0),className:`text-xs px-3 py-1.5 rounded border transition-colors ${b?"border-azure-primary dark:border-matrix-highlight bg-azure-primary/10 dark:bg-matrix-highlight/10 text-azure-primary dark:text-matrix-highlight":"border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary"}`,children:"Connection string"})]}),r.type==="mongodb"&&b?e.jsxs("div",{children:[e.jsxs("label",{className:m,children:["Connection String ",o&&e.jsx("span",{className:"opacity-60",children:"(leave blank to keep existing)"})]}),e.jsx("input",{className:x,type:"password",value:r.connection_string,onChange:a=>n(t=>({...t,connection_string:a.target.value})),placeholder:o?"unchanged":"mongodb://user:pass@host:27017/dbname"}),e.jsx("p",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary mt-1",children:"Stored encrypted with AES-256-GCM. Requires MORPHEUS_SECRET env var."})]}):e.jsxs(e.Fragment,{children:[r.type!=="sqlite"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:m,children:"Host"}),e.jsx("input",{className:x,value:r.host,onChange:a=>n(t=>({...t,host:a.target.value})),placeholder:"localhost"})]}),e.jsxs("div",{children:[e.jsx("label",{className:m,children:"Port"}),e.jsx("input",{className:x,type:"number",value:r.port,onChange:a=>n(t=>({...t,port:a.target.value})),placeholder:String(T[r.type]||"")})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:m,children:[r.type==="sqlite"?"File Path":"Database Name"," *"]}),e.jsx("input",{className:`w-full px-3 py-2 bg-azure-surface dark:bg-black border rounded text-azure-text-primary dark:text-matrix-secondary font-mono text-sm focus:outline-none ${z&&!r.database_name.trim()?"border-red-500 dark:border-red-500":"border-azure-border dark:border-matrix-primary focus:border-azure-primary dark:focus:border-matrix-highlight"}`,value:r.database_name,onChange:a=>n(t=>({...t,database_name:a.target.value})),placeholder:r.type==="sqlite"?"/path/to/database.db":"mydb"})]}),r.type!=="sqlite"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:m,children:"Username"}),e.jsx("input",{className:x,value:r.username,onChange:a=>n(t=>({...t,username:a.target.value})),placeholder:"postgres"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:m,children:["Password ",o&&e.jsx("span",{className:"opacity-60",children:"(leave blank to keep existing)"})]}),e.jsx("input",{className:x,type:"password",value:r.password,onChange:a=>n(t=>({...t,password:a.target.value})),placeholder:o?"unchanged":"••••••••"}),e.jsx("p",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary mt-1",children:"Stored encrypted with AES-256-GCM. Requires MORPHEUS_SECRET env var."})]})]})]}),e.jsxs("div",{className:"border-t border-azure-border dark:border-matrix-primary pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(B,{className:"w-4 h-4 text-azure-primary dark:text-matrix-highlight"}),e.jsx("span",{className:"text-sm font-medium text-azure-text-primary dark:text-matrix-highlight",children:"Permissões"})]}),e.jsx("p",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary mb-3",children:"Defina quais operações Trinity pode executar neste banco. Operações não permitidas retornarão erro de permissão."}),e.jsx("div",{className:"space-y-2",children:ge[r.type]?.map(({key:a,label:t,description:i})=>e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsxs("div",{className:"relative mt-0.5 flex-shrink-0",children:[e.jsx("input",{type:"checkbox",checked:!!r[a],onChange:()=>ie(a),className:"sr-only"}),e.jsx("div",{className:`w-4 h-4 rounded border transition-colors flex items-center justify-center ${r[a]?"bg-azure-primary dark:bg-matrix-highlight border-azure-primary dark:border-matrix-highlight":"border-azure-border dark:border-matrix-primary bg-transparent"}`,children:r[a]&&e.jsx("svg",{className:"w-2.5 h-2.5 text-white dark:text-black",fill:"none",viewBox:"0 0 10 10",children:e.jsx("path",{d:"M1.5 5l2.5 2.5L8.5 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-azure-text-primary dark:text-matrix-secondary font-mono",children:t}),e.jsx("p",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary opacity-70",children:i})]})]},a))})]}),z&&e.jsx("div",{className:"text-sm text-red-500 border border-red-500/30 bg-red-500/10 rounded px-3 py-2",children:z})]}),e.jsxs("div",{className:"flex justify-end gap-2 p-4 border-t border-azure-border dark:border-matrix-primary",children:[e.jsx("button",{onClick:()=>h(!1),className:"px-4 py-2 text-sm text-azure-text-secondary dark:text-matrix-secondary border border-azure-border dark:border-matrix-primary rounded hover:bg-azure-hover dark:hover:bg-matrix-primary/30 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:V,disabled:L||!r.name,className:"px-4 py-2 text-sm font-medium bg-azure-primary text-white rounded hover:bg-azure-active dark:bg-matrix-highlight dark:text-black dark:hover:bg-matrix-highlight/90 transition-colors disabled:opacity-50",children:L?"Saving...":o?"Update":"Register"})]})]})]})]})}export{we as TrinityDatabases};
@@ -1 +0,0 @@
1
- import{u as t}from"./vendor-utils-D4NnWbOU.js";import{h as n}from"./index-CQIUjucB.js";function i(o){const e=new URLSearchParams,s=e.toString()?`?${e}`:"";return t(`/chronos${s}`,()=>n.get(`/chronos${s}`))}function h(o,e=50){return t(o?`/chronos/${o}/executions?limit=${e}`:null,()=>n.get(`/chronos/${o}/executions?limit=${e}`))}function u(){return t("/config/chronos",()=>n.get("/config/chronos"))}const a={createJob:o=>n.post("/chronos",o),updateJob:(o,e)=>n.put(`/chronos/${o}`,e),deleteJob:o=>n.delete(`/chronos/${o}`),enableJob:o=>n.patch(`/chronos/${o}/enable`,{}),disableJob:o=>n.patch(`/chronos/${o}/disable`,{}),getConfig:()=>n.get("/config/chronos"),updateConfig:o=>n.post("/config/chronos",o),preview:(o,e,s)=>n.post("/chronos/preview",{expression:o,schedule_type:e,timezone:s})};export{h as a,i as b,a as c,u};