morpheus-cli 0.9.4 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/http/routers/smiths.js +14 -4
- package/dist/ui/assets/{AuditDashboard-C1f6Hbdw.js → AuditDashboard-DliJ1CX0.js} +1 -1
- package/dist/ui/assets/{Chat-5AeRYuRj.js → Chat-BNtutgja.js} +1 -1
- package/dist/ui/assets/{Chronos-BrKldYVw.js → Chronos-3C8RPZcl.js} +1 -1
- package/dist/ui/assets/{ConfirmationModal-DsbS3XkJ.js → ConfirmationModal-ZQPBeJ2Z.js} +1 -1
- package/dist/ui/assets/{Dashboard-DvrTXLdo.js → Dashboard-CqkHzr2F.js} +1 -1
- package/dist/ui/assets/{DeleteConfirmationModal-BfSjv04R.js → DeleteConfirmationModal-CioxFWn_.js} +1 -1
- package/dist/ui/assets/{Logs-B0ZYWs5x.js → Logs-DBVanS0O.js} +1 -1
- package/dist/ui/assets/{MCPManager-BwHGTeNs.js → MCPManager-vXfL3P2U.js} +1 -1
- package/dist/ui/assets/{ModelPricing-CYhGRQr8.js → ModelPricing-DyfdunLT.js} +1 -1
- package/dist/ui/assets/{Notifications-BYMAtVMq.js → Notifications-VL-vep6d.js} +1 -1
- package/dist/ui/assets/{SatiMemories-I1vsYtP2.js → SatiMemories-jaadkW0U.js} +1 -1
- package/dist/ui/assets/{SessionAudit-BCecQWde.js → SessionAudit-BsXrWlwz.js} +1 -1
- package/dist/ui/assets/{Settings-Cu4D-7tb.js → Settings-B4eezRcg.js} +1 -1
- package/dist/ui/assets/{Skills-lGU3I5DO.js → Skills-DE3zziXL.js} +1 -1
- package/dist/ui/assets/Smiths-pmogN1mU.js +1 -0
- package/dist/ui/assets/{Tasks-Bz92GPWK.js → Tasks-Bs8s34Jc.js} +1 -1
- package/dist/ui/assets/{TrinityDatabases-BUY-3j7Q.js → TrinityDatabases-D7uihcdp.js} +1 -1
- package/dist/ui/assets/{UsageStats-Dr5eSgJc.js → UsageStats-B9gePLZ0.js} +1 -1
- package/dist/ui/assets/{WebhookManager-DIASAC-1.js → WebhookManager-B2L3rCLM.js} +1 -1
- package/dist/ui/assets/{audit-CcAEDbZh.js → audit-Cggeu9mM.js} +1 -1
- package/dist/ui/assets/{chronos-2Z9E96_1.js → chronos-D3-sWhfU.js} +1 -1
- package/dist/ui/assets/{config-DdfK4DX6.js → config-CBqRUPgn.js} +1 -1
- package/dist/ui/assets/{index-Dpd1Mkgp.js → index-zKplfrXZ.js} +2 -2
- package/dist/ui/assets/{mcp-BWMt8aY7.js → mcp-uL1R9hyA.js} +1 -1
- package/dist/ui/assets/{skills-D7JjK7JH.js → skills-jmw8yTJs.js} +1 -1
- package/dist/ui/assets/{stats-DoIhtLot.js → stats-HOms6GnM.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/ui/sw.js +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/Smiths-DnEH3nID.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as c}from"./index-
|
|
1
|
+
import{H as c}from"./index-zKplfrXZ.js";const e=c.getInstance(),n={fetchServers:async()=>e.get("/mcp/servers"),addServer:async(t,s)=>e.post("/mcp/servers",{name:t,config:s}),updateServer:async(t,s)=>e.put(`/mcp/servers/${encodeURIComponent(t)}`,{config:s}),deleteServer:async t=>e.delete(`/mcp/servers/${encodeURIComponent(t)}`),toggleServer:async(t,s)=>e.patch(`/mcp/servers/${encodeURIComponent(t)}/toggle`,{enabled:s}),reloadTools:async()=>e.post("/mcp/reload",{}),fetchStatus:async()=>e.get("/mcp/status"),fetchStats:async()=>e.get("/mcp/stats")};export{n as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as e}from"./index-
|
|
1
|
+
import{H as e}from"./index-zKplfrXZ.js";const s=e.getInstance(),o={fetchSkills:async()=>s.get("/skills"),fetchSkill:async l=>s.get(`/skills/${encodeURIComponent(l)}`),reloadSkills:async()=>s.post("/skills/reload",{}),enableSkill:async l=>s.post(`/skills/${encodeURIComponent(l)}/enable`,{}),disableSkill:async l=>s.post(`/skills/${encodeURIComponent(l)}/disable`,{}),uploadSkill:async l=>s.uploadFile("/skills/upload",l)};export{o as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t}from"./index-
|
|
1
|
+
import{h as t}from"./index-zKplfrXZ.js";const e={fetchUsageStats:async()=>t.get("/stats/usage"),fetchGroupedUsageStats:async()=>t.get("/stats/usage/grouped")};export{e as s};
|
package/dist/ui/index.html
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<title>Morpheus Agent UI</title>
|
|
20
20
|
<!-- vite-plugin-pwa injeta <link rel="manifest"> automaticamente no build -->
|
|
21
|
-
<script type="module" crossorigin src="./assets/index-
|
|
21
|
+
<script type="module" crossorigin src="./assets/index-zKplfrXZ.js"></script>
|
|
22
22
|
<link rel="modulepreload" crossorigin href="./assets/vendor-react-DikRIOlj.js">
|
|
23
23
|
<link rel="modulepreload" crossorigin href="./assets/vendor-motion-C3CZ8ZlO.js">
|
|
24
24
|
<link rel="modulepreload" crossorigin href="./assets/vendor-utils-D4NnWbOU.js">
|
package/dist/ui/sw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
if(!self.define){let s,e={};const i=(i,n)=>(i=new URL(i+".js",n).href,e[i]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=i,s.onload=e,document.head.appendChild(s)}else s=i,importScripts(i),e()}).then(()=>{let s=e[i];if(!s)throw new Error(`Module ${i} didn’t register its module`);return s}));self.define=(n,l)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let a={};const o=s=>i(s,r),u={module:{uri:r},exports:a,require:o};e[r]=Promise.all(n.map(s=>u[s]||o(s))).then(s=>(l(...s),a))}}define(["./workbox-26f462e7"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"vite.svg",revision:"5e386a6b1608494961c0a0de283e0df8"},{url:"registerSW.js",revision:"402b66900e731ca748771b6fc5e7a068"},{url:"pwa-maskable-512x512.png",revision:"e9dc04fc1b43cd6093e286bf765726d8"},{url:"pwa-maskable-192x192.png",revision:"8eb12fd764e6cb6f56247b2e1b21a31f"},{url:"pwa-512x512.png",revision:"f9619ef45b67856ce91010c1eb1d3c0c"},{url:"pwa-192x192.png",revision:"6174f6c5724689f6c15526be28983ca8"},{url:"index.html",revision:"
|
|
1
|
+
if(!self.define){let s,e={};const i=(i,n)=>(i=new URL(i+".js",n).href,e[i]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=i,s.onload=e,document.head.appendChild(s)}else s=i,importScripts(i),e()}).then(()=>{let s=e[i];if(!s)throw new Error(`Module ${i} didn’t register its module`);return s}));self.define=(n,l)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let a={};const o=s=>i(s,r),u={module:{uri:r},exports:a,require:o};e[r]=Promise.all(n.map(s=>u[s]||o(s))).then(s=>(l(...s),a))}}define(["./workbox-26f462e7"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"vite.svg",revision:"5e386a6b1608494961c0a0de283e0df8"},{url:"registerSW.js",revision:"402b66900e731ca748771b6fc5e7a068"},{url:"pwa-maskable-512x512.png",revision:"e9dc04fc1b43cd6093e286bf765726d8"},{url:"pwa-maskable-192x192.png",revision:"8eb12fd764e6cb6f56247b2e1b21a31f"},{url:"pwa-512x512.png",revision:"f9619ef45b67856ce91010c1eb1d3c0c"},{url:"pwa-192x192.png",revision:"6174f6c5724689f6c15526be28983ca8"},{url:"index.html",revision:"1a803a545b14e620e59d0c18dbe2fa3d"},{url:"assets/vendor-utils-D4NnWbOU.js",revision:null},{url:"assets/vendor-react-DikRIOlj.js",revision:null},{url:"assets/vendor-motion-C3CZ8ZlO.js",revision:null},{url:"assets/vendor-markdown-BN_Np5Ta.js",revision:null},{url:"assets/vendor-icons-DMd9RGvJ.js",revision:null},{url:"assets/stats-HOms6GnM.js",revision:null},{url:"assets/skills-jmw8yTJs.js",revision:null},{url:"assets/mcp-uL1R9hyA.js",revision:null},{url:"assets/index-zKplfrXZ.js",revision:null},{url:"assets/index-D4fzIKy1.css",revision:null},{url:"assets/config-CBqRUPgn.js",revision:null},{url:"assets/chronos-D3-sWhfU.js",revision:null},{url:"assets/audit-Cggeu9mM.js",revision:null},{url:"assets/WebhookManager-B2L3rCLM.js",revision:null},{url:"assets/UsageStats-B9gePLZ0.js",revision:null},{url:"assets/TrinityDatabases-D7uihcdp.js",revision:null},{url:"assets/Tasks-Bs8s34Jc.js",revision:null},{url:"assets/Smiths-pmogN1mU.js",revision:null},{url:"assets/Skills-DE3zziXL.js",revision:null},{url:"assets/Settings-B4eezRcg.js",revision:null},{url:"assets/SessionAudit-BsXrWlwz.js",revision:null},{url:"assets/SelectInput-KVLsnfra.js",revision:null},{url:"assets/SatiMemories-jaadkW0U.js",revision:null},{url:"assets/Pagination-oTGieBLM.js",revision:null},{url:"assets/Notifications-VL-vep6d.js",revision:null},{url:"assets/ModelPricing-DyfdunLT.js",revision:null},{url:"assets/MCPManager-vXfL3P2U.js",revision:null},{url:"assets/Logs-DBVanS0O.js",revision:null},{url:"assets/DeleteConfirmationModal-CioxFWn_.js",revision:null},{url:"assets/Dashboard-CqkHzr2F.js",revision:null},{url:"assets/ConfirmationModal-ZQPBeJ2Z.js",revision:null},{url:"assets/Chronos-3C8RPZcl.js",revision:null},{url:"assets/Chat-BNtutgja.js",revision:null},{url:"assets/AuditDashboard-DliJ1CX0.js",revision:null},{url:"pwa-192x192.png",revision:"6174f6c5724689f6c15526be28983ca8"},{url:"pwa-512x512.png",revision:"f9619ef45b67856ce91010c1eb1d3c0c"},{url:"pwa-maskable-192x192.png",revision:"8eb12fd764e6cb6f56247b2e1b21a31f"},{url:"pwa-maskable-512x512.png",revision:"e9dc04fc1b43cd6093e286bf765726d8"},{url:"manifest.webmanifest",revision:"da8b9a11743009a7e50876a50de29362"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("/index.html"),{denylist:[/^\/api\//]})),s.registerRoute(/^\/api\//,new s.NetworkOnly,"GET"),s.registerRoute(/\.(?:js|css|woff2)$/,new s.CacheFirst({cacheName:"static-assets",plugins:[new s.ExpirationPlugin({maxAgeSeconds:31536e3})]}),"GET"),s.registerRoute(/\.(?:png|svg|ico)$/,new s.StaleWhileRevalidate({cacheName:"images",plugins:[new s.ExpirationPlugin({maxEntries:50,maxAgeSeconds:2592e3})]}),"GET")});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "morpheus-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"description": "Morpheus is a local AI agent for developers, running as a CLI daemon that connects to LLMs, local tools, and MCPs, enabling interaction via Terminal, Telegram, and Discord. Inspired by the character Morpheus from *The Matrix*, the project acts as an intelligent orchestrator, bridging the gap between the developer and complex systems.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"morpheus": "./bin/morpheus.js"
|
|
@@ -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 F}from"./vendor-utils-D4NnWbOU.js";import{c as b,S as Q,N as v}from"./config-DdfK4DX6.js";import{S as X,T as z}from"./SelectInput-KVLsnfra.js";import{h as Y,a2 as C,H as S,Q as J,am as D,a6 as H,ac as V,an as I,ad as Z,ao as ee,ap as te,aq as re,w as ae,z as se,l as ie,ar as ne,g as le,ae as de,G as oe,X as ce}from"./vendor-icons-DMd9RGvJ.js";import"./index-Dpd1Mkgp.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-zinc-900 shadow-sm transition-all ${s?"border-emerald-500/40 dark:border-emerald-500/30":t.state==="error"?"border-red-500/40 dark:border-red-500/30":t.state==="connecting"?"border-amber-500/40 dark:border-amber-500/30":"border-azure-border dark:border-matrix-primary"}`,children:[e.jsxs("div",{className:"p-4 bg-white dark:bg-zinc-900 shadow-sm rounded-tl-lg rounded-tr-lg",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(z,{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(z,{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(z,{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 we(){const{data:t,mutate:l}=F("/api/smiths",b.getSmithsList,{refreshInterval:1e4}),{data:i,mutate:o}=F("/api/smiths/config",b.getSmithsConfig),[a,d]=x.useState(null),[h,s]=x.useState(!1),[m,j]=x.useState(!1),[p,f]=x.useState(!1),[c,w]=x.useState(null),[_,k]=x.useState(!1),[$,u]=x.useState(null),[N,T]=x.useState(null),[U,M]=x.useState(!1);i&&!a&&d(i);const g=(r,n)=>{T({type:r,message:n}),setTimeout(()=>T(null),4e3)},q=async r=>{try{const n=await b.pingSmith(r);g("success",`Ping ${r}: ${n.latency_ms}ms`)}catch(n){g("error",`Ping failed: ${n.message}`)}},B=async r=>{if(confirm(`Remove Smith "${r}" from the registry?`))try{await b.removeSmith(r),l(),o(),d(null),g("success",`Smith "${r}" removed.`)}catch(n){g("error",`Failed to remove: ${n.message}`)}},G=async r=>{if(a){if(a.entries.some(n=>n.name===r.name)){u(`Smith "${r.name}" already exists.`);return}k(!0),u(null);try{const n={...a,entries:[...a.entries,r]};await b.updateSmithsConfig(n),f(!1),d(null),l(),o(),g("success",`Smith "${r.name}" added.`)}catch(n){u(n.message)}finally{k(!1)}}},W=async r=>{if(a){k(!0),u(null);try{const n={...a,entries:a.entries.map(R=>R.name===r.name?r:R)};await b.updateSmithsConfig(n),w(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(Y,{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(J,{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(Q,{label:"Enable Smiths",checked:a.enabled,onChange:r=>d({...a,enabled:r}),helperText:"Master switch — disabling stops all Smith connections."})}),e.jsx(X,{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:q,onEdit:n=>{w({...n,auth_token:""}),u(null)},onDelete:B},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:()=>w(null),saving:_,error:$})]})}export{we as SmithsPage};
|