@hivemagnus/magnus-ui 2.10.3 → 3.0.1
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/app/apps/dashboard/.next/BUILD_ID +1 -1
- package/dist/app/apps/dashboard/.next/build-manifest.json +3 -3
- package/dist/app/apps/dashboard/.next/prerender-manifest.json +3 -3
- package/dist/app/apps/dashboard/.next/required-server-files.json +2 -2
- package/dist/app/apps/dashboard/.next/server/app/_global-error.html +1 -1
- package/dist/app/apps/dashboard/.next/server/app/_global-error.rsc +1 -1
- package/dist/app/apps/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dist/app/apps/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/app/apps/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/app/apps/dashboard/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/anomalies/[anomalyId]/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/anomalies/[anomalyId]/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/anomalies/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/anomalies/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/anomalies/remediation/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/anomalies/remediation/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api-docs/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api-docs/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/application-operations/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/application-operations/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/installations/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/installations/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/[id]/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/[id]/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/audit/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/codex/installations/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/codex/installations/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/codex/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/codex/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/commands/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/commands/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/cron/page/server-reference-manifest.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/cron/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/cron/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/files/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/files/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-map/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-map/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-readiness/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-readiness/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-timeline/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-timeline/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/governor/operations/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/governor/operations/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/governor/share/[token]/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/governor/share/[token]/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/hermes-drift/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/hermes-drift/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/hermes-security/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/hermes-security/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/incidents/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/incidents/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/library/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/library/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/login/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/logs/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/logs/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/mission-control/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/mission-control/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/nodes/[nodeId]/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/nodes/[nodeId]/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/nodes/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/notifications/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/notifications/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/installations/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/installations/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/profiles/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/profiles/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/web-gateway/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/web-gateway/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/retention/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/retention/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/roles/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/roles/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/rollouts/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/rollouts/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/[caseId]/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/[caseId]/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/entities/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/entities/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/events/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/events/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/evidence/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/evidence/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/policies/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/policies/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/sources/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/sources/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/skills/page/server-reference-manifest.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/skills/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/webhooks/[id]/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/webhooks/[id]/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/webhooks/new/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/webhooks/new/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/webhooks/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/webhooks/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/[root-of-the-server]__06giq9g4me8eh._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/[root-of-the-server]__08sgyyf_y8ab8._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/[root-of-the-server]__11pe-l2-ko65_._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/_0caxc2bc6a__r._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/_1oebzzj_en62h._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_0gs_s688kgg1i._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_ardent_installations_page_tsx_0nvqgacugy6nf._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_cron_page_tsx_1i3duyygc0_tg._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_nodes_nodes-client_tsx_0pt4iarhpqbgn._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_skills_page_tsx_0n5zp4xad38in._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_lib_agent-upgrade-view_ts_1nvhevz6hq0t2._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/middleware-build-manifest.js +3 -3
- package/dist/app/apps/dashboard/.next/server/pages/500.html +1 -1
- package/dist/app/apps/dashboard/.next/server/preview-props.json +3 -3
- package/dist/app/apps/dashboard/.next/server/server-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/server-reference-manifest.json +3 -3
- package/dist/app/apps/dashboard/.next/static/chunks/{0iexpdr9u3nd1.js → 0vavzfxiifcwc.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/{215cfit1tgz2o.js → 1kx48jg-4j5iv.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/{35f3puf3wu5yn.js → 1p-c6o7qsu5ou.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/{3m0uo80ux19g9.js → 25a8c2es3dpaa.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/{3hyzhnpkvtpte.js → 269qlvth5p8b4.js} +4 -4
- package/dist/app/apps/dashboard/.next/static/chunks/2b1ydgoygp0dh.js +4 -0
- package/dist/app/apps/dashboard/.next/static/chunks/{0m_m818vlel4g.js → 3gpf_4ytco8dz.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/3s98rvw78e82w.js +1 -0
- package/dist/app/apps/dashboard/package.json +2 -2
- package/dist/app/apps/dashboard/server.js +1 -1
- package/package.json +2 -2
- package/dist/app/apps/dashboard/.next/static/chunks/0v0j0cmp0ypq4.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/2eh19fhy2ucj0.js +0 -4
- /package/dist/app/apps/dashboard/.next/static/{D6wKgqHoLnGgJgcAWwwAB → L-DxwQwJQSLJRijzllP8k}/_buildManifest.js +0 -0
- /package/dist/app/apps/dashboard/.next/static/{D6wKgqHoLnGgJgcAWwwAB → L-DxwQwJQSLJRijzllP8k}/_clientMiddlewareManifest.js +0 -0
- /package/dist/app/apps/dashboard/.next/static/{D6wKgqHoLnGgJgcAWwwAB → L-DxwQwJQSLJRijzllP8k}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,53721,e=>{"use strict";var t=e.i(43476),r=e.i(64155),a=e.i(46670),s=e.i(63646);e.s(["x",0,function({readiness:e}){return e?.status!=="not-ready"?null:(0,t.jsx)("span",{title:(0,s.K)(e),"data-testid":"upgrade-readiness-badge",children:(0,t.jsxs)(a.t,{variant:"warning",children:[(0,t.jsx)(r.f,{className:"mr-1 inline h-3 w-3"}),"Upgrade blocked (",e.problems.length,")"]})})},"a",0,function({readiness:e}){return e?.status!=="not-ready"?null:(0,t.jsxs)("div",{className:"rounded border border-warning/40 bg-warning/10 px-3 py-2 text-[11px]","data-testid":"upgrade-readiness-panel",children:[(0,t.jsxs)("p",{className:"flex items-center gap-2 font-bold uppercase tracking-wider text-warning",children:[(0,t.jsx)(r.f,{className:"h-3.5 w-3.5"})," This node could not take an agent upgrade now"]}),(0,t.jsx)("ul",{className:"mt-2 space-y-2",children:e.problems.map(e=>(0,t.jsxs)("li",{children:[(0,t.jsxs)("p",{className:"font-medium text-text",children:[(0,t.jsx)("span",{className:"num",children:e.code}),": ",e.detail]}),(0,t.jsx)("p",{className:"text-text-muted",children:e.remedy})]},`${e.code}-${e.detail}`))})]})}])},57108,e=>{"use strict";var t=e.i(43476),r=e.i(46670);e.s(["f",0,function({configuration:e}){if(e?.memoryProvider!=="hivemem")return null;let a=e.hiveMemToken,s=a?.status??"unknown";return(0,t.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[(0,t.jsxs)(r.t,{variant:"valid"===s?"success":"expiring"===s||"unreachable"===s||"unknown"===s?"warning":"danger",children:["Token ",s]}),a?.expiresAt&&(0,t.jsxs)("time",{dateTime:a.expiresAt,title:"HiveMem token expiration",children:["expires ",new Date(a.expiresAt).toLocaleString()]}),a?.checkedAt&&(0,t.jsxs)("time",{dateTime:a.checkedAt,className:"text-text-muted/70",title:"Last HiveMem authentication check",children:["checked ",new Date(a.checkedAt).toLocaleString()]})]})}])},46670,e=>{"use strict";var t=e.i(43476),r=e.i(78571);let a={default:"border-border text-text-muted",success:"border-success/40 text-success bg-success/5 shadow-[0_0_6px_rgba(0,255,65,0.15)]",warning:"border-warning/40 text-warning bg-warning/5 shadow-[0_0_6px_rgba(255,179,0,0.15)]",danger:"border-danger/40 text-danger bg-danger/5 shadow-[0_0_6px_rgba(255,23,68,0.15)]",info:"border-info/40 text-info bg-info/5 shadow-[0_0_6px_rgba(0,176,255,0.15)]"},s={default:"bg-text-muted",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info"};e.s(["t",0,function({children:e,variant:n="default",className:i,dot:l=!1,pulse:o=!1}){return(0,t.jsxs)("span",{className:(0,r.f)("inline-flex items-center gap-1.5 rounded-chip border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",a[n],i),children:[l&&(0,t.jsxs)("span",{"aria-hidden":"true",className:"relative inline-flex h-1.5 w-1.5",children:[o&&(0,t.jsx)("span",{className:(0,r.f)("absolute inset-0 rounded-full animate-halo",s[n])}),(0,t.jsx)("span",{className:(0,r.f)("relative inline-flex h-1.5 w-1.5 rounded-full",s[n])})]}),e]})},"k",0,function(e){switch(e.toUpperCase()){case"ONLINE":case"COMPLETED":case"ACTIVE":case"RUNNING":case"INSTALLED":case"HEALTHY":return"success";case"DEGRADED":case"PAUSED":case"QUEUED":case"PENDING":case"INSTALLING":return"warning";case"OFFLINE":case"FAILED":case"ERROR":case"TIMEOUT":case"CANCELLED":case"DECOMMISSIONED":case"CRITICAL":return"danger";case"PROVISIONING":case"UPDATING":return"info";default:return"default"}}])},93999,51196,55427,e=>{"use strict";var t=e.i(43476),r=e.i(56420);let a={name:"arrow-down-right",size:24,node:[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]};a.node;let s=(0,r.f)(a);var n=e.i(75775),i=e.i(78571),l=e.i(3062),o=e.i(35084);let c={warning:"shadow-[0_0_6px_var(--color-warning)]",danger:"shadow-[0_0_8px_var(--color-danger)]",accent:"shadow-[0_0_6px_var(--color-accent)]",primary:"shadow-[0_0_6px_var(--color-primary)]"},d={xs:"h-1",sm:"h-1.5",md:"h-2"};function u({value:e,max:r=100,tone:a,thresholds:s=o.q,label:n,size:l="xs",showValue:x=!1,valueLabel:h,glow:m,className:f,testId:p}){let g="number"==typeof e&&Number.isFinite(e),v=g?Math.max(0,Math.min(100,e/(r||1)*100)):0,b=a??(g?(0,o.Z)(v,s):"muted"),j=m||!a&&g&&v>=s.warn,y=h??(g?`${v.toFixed(+(v<10&&v>0))}%`:"—");return(0,t.jsxs)("div",{className:(0,i.f)("flex min-w-0 items-center gap-2",f),"data-testid":p,children:[(0,t.jsx)("div",{role:"meter","aria-label":n,"aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":g?e:void 0,"aria-valuetext":y,className:(0,i.f)("relative flex-1 overflow-hidden rounded-full bg-border/70",d[l]),children:(0,t.jsx)("div",{style:{"--meter":`${v}%`},className:(0,i.f)("h-full w-(--meter) rounded-full transition-[width] duration-700 ease-out-expo starting:w-0",o.H[b],j&&c[b])})}),x&&(0,t.jsx)("span",{className:(0,i.f)("num w-11 shrink-0 text-right text-[11px]",g?o.T[b]:"text-text-muted"),children:y})]})}e.s(["f",0,u],51196);var x=e.i(71645);function h({values:e,tone:r="primary",width:a=160,height:s=32,area:n=!0,max:l,percent:c=!1,threshold:d,live:u=!0,emptyLabel:m="not enough data",className:f,testId:p,label:g,stretch:v=!1}){let b=`spark${(0,x.useId)().replace(/:/g,"")}`;if(e.length<2)return(0,t.jsx)("div",{className:(0,i.f)("flex h-8 items-center text-xs italic text-text-muted",f),"data-testid":p,children:m});let j=o.v[r],y=l??(c?Math.max(100,...e):Math.max(...e,d??0)||1),N=s-4,w=a/(e.length-1),k=e=>2+N-Math.max(0,e)/y*N,_=e.map((e,t)=>[t*w,k(e)]),M=_.map(([e,t])=>`${e.toFixed(1)},${t.toFixed(1)}`).join(" "),S=_[_.length-1];return(0,t.jsxs)("svg",{width:v?"100%":a,height:s,viewBox:`0 0 ${a} ${s}`,preserveAspectRatio:v?"none":void 0,className:(0,i.f)("block overflow-visible",f),"data-testid":p,role:g?"img":void 0,"aria-label":g,"aria-hidden":!g||void 0,children:[n&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:b,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"0%",stopColor:j,stopOpacity:.35}),(0,t.jsx)("stop",{offset:"100%",stopColor:j,stopOpacity:0})]})}),(0,t.jsx)("polygon",{points:`0,${s} ${M} ${a},${s}`,fill:`url(#${b})`})]}),void 0!==d&&(0,t.jsx)("line",{x1:0,x2:a,y1:k(d),y2:k(d),stroke:"var(--color-warning)",strokeOpacity:.5,strokeDasharray:"3 3",strokeWidth:1}),(0,t.jsx)("polyline",{fill:"none",stroke:j,strokeWidth:1.5,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round",points:M}),u&&!v&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:S[0],cy:S[1],r:2.5,fill:j,className:"origin-center animate-halo [transform-box:fill-box]"}),(0,t.jsx)("circle",{cx:S[0],cy:S[1],r:2,fill:j})]})]})}e.s(["f",0,h],55427),e.s(["N",0,function({title:e,description:r,children:a,className:s,action:n,tone:i,corners:o=!1,...c}){return(0,t.jsx)(l.f,{...c,tone:i,corners:o,title:e,description:r,action:n,className:s,children:a})},"n",0,function({label:e,value:r,icon:a,trend:c,spark:d,meter:x,delta:m,tone:f="primary",className:p,testId:g}){let v=!m||m.value>=0===(m.positiveIsGood??!0);return(0,t.jsxs)(l.f,{tone:f,className:(0,i.f)("overflow-hidden",p),testId:g,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-[10px] font-medium uppercase tracking-[0.15em] text-text-muted",children:e}),a&&(0,t.jsx)("span",{className:"text-primary/60",children:a})]}),(0,t.jsxs)("div",{className:"mt-2 flex items-end justify-between gap-2",children:[(0,t.jsx)("div",{className:(0,i.f)("num text-2xl font-bold","primary"===f?"text-primary neon-text":o.T[f]),children:r}),m&&0!==m.value&&(0,t.jsxs)("span",{className:(0,i.f)("num mb-1 inline-flex items-center gap-0.5 text-[11px]",v?"text-success":"text-danger"),children:[m.value>0?(0,t.jsx)(n.f,{className:"h-3 w-3"}):(0,t.jsx)(s,{className:"h-3 w-3"}),Math.abs(m.value).toFixed(+!Number.isInteger(m.value)),m.unit]})]}),c&&(0,t.jsx)("div",{className:(0,i.f)("mt-1 text-[11px]",c.positive?"text-success":"text-danger"),children:c.value}),void 0!==x&&(0,t.jsx)(u,{value:x,className:"mt-3",label:e}),d&&d.length>1&&(0,t.jsx)("div",{className:"-mx-5 -mb-5 mt-3 opacity-80",children:(0,t.jsx)(h,{values:d,tone:f,width:240,height:28,stretch:!0,live:!1})})]})}],93999)},54149,21176,e=>{"use strict";var t=e.i(43476),r=e.i(71645),a=e.i(78571),s=e.i(35084);e.s(["f",0,function({value:e,max:n=100,label:i,sublabel:l,tone:o,thresholds:c=s.q,higherIsBetter:d=!1,size:u=140,display:x,ticks:h=!0,hideLabel:m=!1,className:f,testId:p}){let g=(0,r.useId)().replace(/:/g,""),v="number"==typeof e&&Number.isFinite(e),b=v?Math.max(0,Math.min(100,e/(n||1)*100)):0,j=o??(v?d?(0,s.Z)(100-b,c):(0,s.Z)(b,c):"muted"),y=Math.max(4,Math.round(u/16)),N=50-y/2-4,w=2*Math.PI*N,k=.75*w,_=k*b/100,M=u>=140,S=x??(v?`${Math.round(b)}%`:"—"),C=h?Array.from({length:11},(e,r)=>{let a=(135+270*r/10)*Math.PI/180,s=50-(r%5==0?4:2.5);return(0,t.jsx)("line",{x1:50+48.5*Math.cos(a),y1:50+48.5*Math.sin(a),x2:50+s*Math.cos(a),y2:50+s*Math.sin(a),stroke:"var(--color-border-strong)",strokeWidth:.8},r)}):null;return(0,t.jsxs)("div",{role:"img","aria-label":`${i}: ${S}`,"data-testid":p,className:(0,a.f)("relative inline-flex flex-col items-center",f),style:{width:u},children:[(0,t.jsxs)("svg",{viewBox:"0 0 100 100",width:u,height:u,"aria-hidden":"true",className:"overflow-visible",children:[M&&(0,t.jsx)("defs",{children:(0,t.jsxs)("filter",{id:`g${g}`,x:"-30%",y:"-30%",width:"160%",height:"160%",children:[(0,t.jsx)("feGaussianBlur",{stdDeviation:"2.2",result:"blur"}),(0,t.jsxs)("feMerge",{children:[(0,t.jsx)("feMergeNode",{in:"blur"}),(0,t.jsx)("feMergeNode",{in:"SourceGraphic"})]})]})}),C,(0,t.jsx)("circle",{cx:50,cy:50,r:N,fill:"none",stroke:"var(--color-border)",strokeWidth:y,strokeLinecap:"round",strokeDasharray:`${k} ${w}`,transform:"rotate(135 50 50)"}),(0,t.jsx)("circle",{cx:50,cy:50,r:N,fill:"none",stroke:s.v[j],strokeWidth:y,strokeLinecap:"round",transform:"rotate(135 50 50)",filter:M?`url(#g${g})`:void 0,style:{"--dash":`${_} ${w}`},className:"[stroke-dasharray:var(--dash)] transition-[stroke-dasharray] duration-1000 ease-out-expo starting:[stroke-dasharray:0_1000]"})]}),(0,t.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center",style:{height:u},children:[(0,t.jsx)("span",{className:(0,a.f)("num font-bold leading-none",s.T[j],M&&s.z[j]),style:{fontSize:Math.max(12,.2*u)},children:S}),l&&(0,t.jsx)("span",{className:"num mt-1 text-text-muted",style:{fontSize:Math.max(9,.075*u)},children:l})]}),!m&&(0,t.jsx)("span",{className:"-mt-[10%] text-center text-[10px] font-medium uppercase tracking-[0.15em] text-text-muted",children:i})]})}],54149);var n=e.i(70703),i=e.i(65369);let l=(0,n.default)(()=>e.A(1321),{loadableGenerated:{modules:[69944]},ssr:!1,loading:()=>(0,t.jsx)(i.l,{className:"h-[180px] w-full"})});e.s(["f",0,l],21176)},3062,e=>{"use strict";var t=e.i(43476),r=e.i(78571),a=e.i(35084);let s={primary:"[--panel-corner-color:color-mix(in_srgb,var(--color-primary)_60%,transparent)]",accent:"[--panel-corner-color:color-mix(in_srgb,var(--color-accent)_70%,transparent)]",success:"[--panel-corner-color:color-mix(in_srgb,var(--color-success)_60%,transparent)]",warning:"[--panel-corner-color:color-mix(in_srgb,var(--color-warning)_70%,transparent)]",danger:"[--panel-corner-color:color-mix(in_srgb,var(--color-danger)_70%,transparent)]",info:"[--panel-corner-color:color-mix(in_srgb,var(--color-info)_60%,transparent)]",muted:"[--panel-corner-color:var(--color-border-strong)]"},n={primary:"[--glow-hover-color:var(--color-glow)]",accent:"[--glow-hover-color:var(--color-glow-accent)]",success:"[--glow-hover-color:var(--color-glow-success)]",warning:"[--glow-hover-color:var(--color-glow-warning)]",danger:"[--glow-hover-color:var(--color-glow-danger)]",info:"[--glow-hover-color:var(--color-glow)]",muted:"[--glow-hover-color:var(--color-glow)]"},i={primary:"hover:border-primary/30",accent:"hover:border-accent/40",success:"hover:border-success/30",warning:"hover:border-warning/40",danger:"hover:border-danger/40",info:"hover:border-info/30",muted:"hover:border-border-strong"},l={none:"",sm:"p-3",md:"p-5",lg:"p-6"};e.s(["f",0,function({tone:e="primary",corners:o=!0,interactive:c=!0,hero:d=!1,title:u,description:x,icon:h,action:m,as:f="div",padding:p="md",testId:g,className:v,children:b,...j}){return(0,t.jsxs)(f,{...j,"data-testid":g??j["data-testid"],className:(0,r.f)("relative rounded-panel border border-border bg-surface transition-colors duration-300",l[p],o&&"panel-corners",o&&s[e],c&&"glow-hover",c&&n[e],c&&i[e],d&&"grid-bg overflow-hidden bg-surface/80",v),children:[(u||m||h)&&(0,t.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[h&&(0,t.jsx)("span",{className:(0,r.f)("mt-0.5 shrink-0",a.T[e]),children:h}),(0,t.jsxs)("div",{className:"min-w-0",children:[u&&(0,t.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider",children:u}),x&&(0,t.jsx)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:x})]})]}),m]}),b]})}])},65369,e=>{"use strict";var t=e.i(43476),r=e.i(78571);function a({className:e}){return(0,t.jsx)("div",{"aria-hidden":"true",className:(0,r.f)("skeleton h-3 w-full",e)})}e.s(["l",0,a,"g",0,function({count:e=4,className:s}){return(0,t.jsx)("div",{role:"status","aria-label":"Loading",className:(0,r.f)("grid gap-4 sm:grid-cols-2 lg:grid-cols-4",s),children:Array.from({length:e},(e,r)=>(0,t.jsxs)("div",{className:"panel-corners rounded-panel border border-border bg-surface p-5",children:[(0,t.jsx)(a,{className:"h-2 w-1/2"}),(0,t.jsx)(a,{className:"mt-4 h-7 w-2/3"}),(0,t.jsx)(a,{className:"mt-3 h-1 w-full opacity-60"})]},r))})},"F",0,function({rows:e=5,cols:s=4,className:n}){return(0,t.jsxs)("div",{role:"status","aria-label":"Loading",className:(0,r.f)("overflow-hidden rounded-panel border border-border",n),children:[(0,t.jsx)("div",{className:"flex gap-4 border-b border-border bg-surface px-4 py-3",children:Array.from({length:s},(e,r)=>(0,t.jsx)(a,{className:"h-2 flex-1 opacity-60"},r))}),Array.from({length:e},(e,n)=>(0,t.jsx)("div",{className:"flex gap-4 border-b border-border/50 px-4 py-3 last:border-0",children:Array.from({length:s},(e,s)=>(0,t.jsx)(a,{className:(0,r.f)("h-3 flex-1",(n+s)%3==0&&"max-w-[60%]")},s))},n))]})},"Q",0,function({lines:e=3,className:s}){let n=["w-full","w-11/12","w-4/5","w-2/3","w-3/4"];return(0,t.jsx)("div",{role:"status","aria-label":"Loading",className:(0,r.f)("space-y-2",s),children:Array.from({length:e},(e,r)=>(0,t.jsx)(a,{className:n[r%n.length]},r))})}])},75723,e=>{"use strict";var t=e.i(43476),r=e.i(78571),a=e.i(46670);let s={success:"bg-success shadow-[0_0_6px_var(--color-success)]",warning:"bg-warning shadow-[0_0_6px_var(--color-warning)]",danger:"bg-danger shadow-[0_0_6px_var(--color-danger)]",info:"bg-info shadow-[0_0_6px_var(--color-info)]",default:"bg-text-muted"},n={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",default:"bg-text-muted"},i=new Set(["ONLINE","RUNNING","ACTIVE","HEALTHY","CRITICAL","UPDATING","PROVISIONING"]);e.s(["f",0,function({status:e,pulse:l,size:o="sm",className:c,label:d}){let u=(0,a.k)(e),x=l??i.has(e.toUpperCase()),h="xs"===o?"h-1.5 w-1.5":"h-2 w-2";return(0,t.jsxs)("span",{className:(0,r.f)("relative inline-flex shrink-0",h,c),role:d?"img":void 0,"aria-label":d,"aria-hidden":!d||void 0,children:[x&&(0,t.jsx)("span",{className:(0,r.f)("absolute inset-0 rounded-full animate-halo",n[u])}),(0,t.jsx)("span",{className:(0,r.f)("relative inline-flex rounded-full",h,s[u])})]})}])},71417,e=>{"use strict";e.s(["L",0,function(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(1))} ${["B","KB","MB","GB","TB"][t]}`},"C",0,function(e){return e?("string"==typeof e?new Date(e):e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}])},79432,e=>{"use strict";var t=e.i(56420);let r={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],79432)},9347,e=>{"use strict";var t=e.i(56420);let r={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],9347)},75775,e=>{"use strict";var t=e.i(56420);let r={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],75775)},82022,e=>{"use strict";var t=e.i(56420);let r={name:"external-link",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],82022)},57665,e=>{"use strict";var t=e.i(56420);let r={name:"power",size:24,node:[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],57665)},86207,14098,e=>{"use strict";var t=e.i(56420);let r={name:"refresh-ccw-dot",size:24,node:[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],86207);var s=e.i(43476),n=e.i(71645),i=e.i(68759),l=e.i(32568),o=e.i(82983),c=e.i(41220),d=e.i(32781);e.s(["E",0,function({open:e,node:t,onClose:r,onSaved:a}){let[u,x]=(0,n.useState)([]),[h,m]=(0,n.useState)(""),[f,p]=(0,n.useState)(!0),[g,v]=(0,n.useState)(!1),[b,j]=(0,n.useState)(""),[y,N]=(0,n.useState)(!1);(0,n.useEffect)(()=>{e&&(j(""),m(t?.role?.id??""),p(!0),N(!0),(async()=>{try{let e=await o.f.roles.list();x(e.data??[])}catch{j("Failed to load roles")}finally{N(!1)}})())},[e,t?.role?.id]);let w=async()=>{if(t){v(!0),j("");try{let e=t.role?.id;e&&e!==h&&await o.f.roles.unassign(e,{nodeIds:[t.id]}),h&&await o.f.roles.assign(h,{nodeIds:[t.id],defer:!f});let s=h?u.find(e=>e.id===h)??null:null;a(s),r()}catch(e){j(e instanceof Error?e.message:"Failed to assign role")}finally{v(!1)}}},k=async()=>{if(t?.role){v(!0),j("");try{await o.f.roles.unassign(t.role.id,{nodeIds:[t.id]}),a(null),r()}catch(e){j(e instanceof Error?e.message:"Failed to unassign role")}finally{v(!1)}}},_=()=>{j(""),v(!1),r()};return(0,s.jsx)(l.n,{open:e,onClose:_,title:t?.role?"Change Role":"Assign Role",description:t?`Node: ${t.name}`:"",icon:(0,s.jsx)(c.f,{className:"h-5 w-5 text-primary"}),children:(0,s.jsxs)("div",{className:"space-y-4",children:[y?(0,s.jsxs)("div",{className:"flex items-center gap-2 py-4 text-xs text-text-muted",children:[(0,s.jsx)(d.f,{className:"h-4 w-4 animate-spin"}),"Loading roles…"]}):0===u.length?(0,s.jsx)("p",{className:"text-xs text-text-muted py-4",children:"No roles found. Create a role first on the Roles page."}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.G,{label:"Role",children:(0,s.jsxs)("select",{value:h,onChange:e=>m(e.target.value),className:l.N,children:[(0,s.jsx)("option",{value:"",children:"— No role —"}),u.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]})}),h&&(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[(0,s.jsx)("input",{type:"checkbox",checked:f,onChange:e=>p(e.target.checked),className:"rounded border-border"}),"Apply role immediately"]})]}),b&&(0,s.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:b}),(0,s.jsxs)("div",{className:"flex justify-between pt-2",children:[(0,s.jsx)("div",{children:t?.role&&(0,s.jsx)(i.K,{variant:"secondary",size:"sm",onClick:()=>void k(),disabled:g,children:"Unassign Role"})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.K,{variant:"secondary",size:"sm",onClick:_,children:"Cancel"}),(0,s.jsx)(i.K,{size:"sm",onClick:()=>void w(),disabled:g||!h||0===u.length,icon:g?(0,s.jsx)(d.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:g?"Saving…":t?.role?"Change Role":"Assign Role"})]})]})]})})},"F",0,function({open:e,node:t,onClose:r,onSaved:a}){let[u,x]=(0,n.useState)(""),[h,m]=(0,n.useState)(""),[f,p]=(0,n.useState)(""),[g,v]=(0,n.useState)(!1),[b,j]=(0,n.useState)("");(0,n.useEffect)(()=>{if(t){x(t.name);try{let e=JSON.parse(t.tags);m(e.join(", "))}catch{m("")}p(t.status),j("")}},[t]);let y=async()=>{if(t&&u.trim()){v(!0),j("");try{let e=h.split(",").map(e=>e.trim()).filter(Boolean);await o.f.nodes.update(t.id,{name:u.trim(),tags:e,status:f.toUpperCase()}),a(),r()}catch(e){j(e instanceof Error?e.message:"Failed to update node")}finally{v(!1)}}},N=()=>{j(""),v(!1),r()};return(0,s.jsx)(l.n,{open:e,onClose:N,title:"Edit Node",description:t?`${t.hostname}`:"",icon:(0,s.jsx)(c.f,{className:"h-5 w-5 text-primary"}),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(l.G,{label:"Name",required:!0,children:(0,s.jsx)("input",{type:"text",value:u,onChange:e=>x(e.target.value),className:l.W})}),(0,s.jsx)(l.G,{label:"Status",children:(0,s.jsxs)("select",{value:f,onChange:e=>p(e.target.value),className:l.N,children:[(0,s.jsx)("option",{value:"ONLINE",children:"ONLINE"}),(0,s.jsx)("option",{value:"OFFLINE",children:"OFFLINE"}),(0,s.jsx)("option",{value:"DEGRADED",children:"DEGRADED"}),(0,s.jsx)("option",{value:"PROVISIONING",children:"PROVISIONING"}),(0,s.jsx)("option",{value:"MAINTENANCE",children:"MAINTENANCE"})]})}),(0,s.jsxs)(l.G,{label:"Tags",children:[(0,s.jsx)("input",{type:"text",value:h,onChange:e=>m(e.target.value),placeholder:"web, production, us-east",className:l.W}),(0,s.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Comma-separated list of tags"})]}),b&&(0,s.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:b}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,s.jsx)(i.K,{variant:"secondary",size:"sm",onClick:N,children:"Cancel"}),(0,s.jsx)(i.K,{size:"sm",onClick:()=>void y(),disabled:g||!u.trim(),icon:g?(0,s.jsx)(d.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:g?"Saving…":"Save Changes"})]})]})})},"M",0,function({open:e,onClose:t,onRegistered:r}){let[a,u]=(0,n.useState)(""),[x,h]=(0,n.useState)(""),[m,f]=(0,n.useState)("4100"),[p,g]=(0,n.useState)("linux"),[v,b]=(0,n.useState)("x86_64"),[j,y]=(0,n.useState)(""),[N,w]=(0,n.useState)(!1),[k,_]=(0,n.useState)(""),M=async()=>{if(a.trim()&&x.trim()){w(!0),_("");try{let e=j.split(",").map(e=>e.trim()).filter(Boolean);await o.f.nodes.register({name:a.trim(),hostname:x.trim(),ipAddress:x.trim(),port:Number(m)||4100,os:p,arch:v,tags:e,agentVersion:"2.10.3"}),r(),S()}catch(e){_(e instanceof Error?e.message:"Failed to register node")}finally{w(!1)}}},S=()=>{u(""),h(""),f("4100"),g("linux"),b("x86_64"),y(""),_(""),w(!1),t()};return(0,s.jsx)(l.n,{open:e,onClose:S,title:"Register Node",description:"Manually register a node already running the agent",icon:(0,s.jsx)(c.f,{className:"h-5 w-5 text-primary"}),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(l.G,{label:"Node Name",required:!0,children:(0,s.jsx)("input",{type:"text",value:a,onChange:e=>u(e.target.value),placeholder:"web-server-01",className:l.W,autoFocus:!0})}),(0,s.jsx)(l.G,{label:"FQDN / Hostname",required:!0,children:(0,s.jsx)("input",{type:"text",value:x,onChange:e=>h(e.target.value),placeholder:"node-1.example.com",className:l.W})}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,s.jsx)(l.G,{label:"Port",children:(0,s.jsx)("input",{type:"number",value:m,onChange:e=>f(e.target.value),className:l.W})}),(0,s.jsx)(l.G,{label:"OS",children:(0,s.jsxs)("select",{value:p,onChange:e=>g(e.target.value),className:l.N,children:[(0,s.jsx)("option",{value:"linux",children:"Linux"}),(0,s.jsx)("option",{value:"darwin",children:"macOS"}),(0,s.jsx)("option",{value:"windows",children:"Windows"})]})}),(0,s.jsx)(l.G,{label:"Architecture",children:(0,s.jsxs)("select",{value:v,onChange:e=>b(e.target.value),className:l.N,children:[(0,s.jsx)("option",{value:"x86_64",children:"x86_64"}),(0,s.jsx)("option",{value:"aarch64",children:"aarch64"}),(0,s.jsx)("option",{value:"arm",children:"arm"})]})})]}),(0,s.jsxs)(l.G,{label:"Tags",children:[(0,s.jsx)("input",{type:"text",value:j,onChange:e=>y(e.target.value),placeholder:"web, production, us-east",className:l.W}),(0,s.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Comma-separated"})]}),k&&(0,s.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:k}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,s.jsx)(i.K,{variant:"secondary",size:"sm",onClick:S,children:"Cancel"}),(0,s.jsx)(i.K,{size:"sm",onClick:()=>void M(),disabled:N||!a.trim()||!x.trim(),icon:N?(0,s.jsx)(d.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:N?"Registering…":"Register Node"})]})]})})}],14098)},25398,e=>{"use strict";var t=e.i(56420);let r={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],25398)},90317,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a={bindSnapshot:function(){return d},createAsyncLocalStorage:function(){return o},createSnapshot:function(){return u},getOrCreateGlobalAsyncLocalStorage:function(){return c}};for(var s in a)Object.defineProperty(r,s,{enumerable:!0,get:a[s]});let n=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class i{disable(){throw n}getStore(){}run(){throw n}exit(){throw n}enterWith(){throw n}static bind(e){return e}}let l="u">typeof globalThis&&globalThis.AsyncLocalStorage;function o(){return l?new l:new i}function c(e){let t=Symbol.for(`@next/${e}@16.4.5`),r=globalThis;return r[t]??=o()}function d(e){return l?l.bind(e):i.bind(e)}function u(){return l?l.snapshot():function(e,...t){return e(...t)}}},42344,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorageInstance",{enumerable:!0,get:function(){return a}});let a=(0,e.r(90317).getOrCreateGlobalAsyncLocalStorage)("work-async-storage")},63599,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorage",{enumerable:!0,get:function(){return a.workAsyncStorageInstance}});let a=e.r(42344)},70703,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return s}});let a=e.r(55682)._(e.r(69093));function s(e,t){let r={};"function"==typeof e&&(r.loader=e);let s={...r,...t};return(0,a.default)({...s,modules:s.loadableGenerated?.modules})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},9885,(e,t,r)=>{"use strict";function a(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"encodeURIPath",{enumerable:!0,get:function(){return a}})},67585,(e,t,r)=>{"use strict";e.i(47167),Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BailoutToCSRForNextDynamic",{enumerable:!0,get:function(){return i}});let a=e.r(71645),s=e.r(74080);e.r(32061);let n=e.r(49354).createReactBrowserBailoutReason.bind(null,"next/dynamic");function i({children:e}){return(0,a.use)((0,s.browser)(n)),e}},69093,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return c}});let a=e.r(43476),s=e.r(71645),n=e.r(67585),i=e.r(52157);function l(e){return{default:e&&"default"in e?e.default:e}}let o={loader:()=>Promise.resolve(l(()=>null)),loading:null,ssr:!0},c=function(e){let t={...o,...e},r=(0,s.lazy)(()=>t.loader().then(l)),c=t.loading;function d(e){let l=c?(0,a.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,d=o?s.Suspense:s.Fragment,u=t.ssr?(0,a.jsxs)(a.Fragment,{children:["u"<typeof window?(0,a.jsx)(i.PreloadChunks,{moduleIds:t.modules}):null,(0,a.jsx)(r,{...e})]}):(0,a.jsx)(n.BailoutToCSRForNextDynamic,{children:(0,a.jsx)(r,{...e})});return(0,a.jsx)(d,{...o?{fallback:l}:{},children:u})}return d.displayName="LoadableComponent",d}},52157,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"PreloadChunks",{enumerable:!0,get:function(){return o}});let a=e.r(43476),s=e.r(74080),n=e.r(63599),i=e.r(9885),l=e.r(43369);function o({moduleIds:e}){if("u">typeof window)return null;let t=n.workAsyncStorage.getStore();if(void 0===t)return null;let r=[];if(t.reactLoadableManifest&&e){let a=t.reactLoadableManifest;for(let t of e){if(!a[t])continue;let e=a[t].files;r.push(...e)}}if(0===r.length)return null;let c=(0,l.getAssetTokenQuery)();return(0,a.jsx)(a.Fragment,{children:r.map(e=>{let r=`${t.assetPrefix}/_next/${(0,i.encodeURIPath)(e)}${c}`;return e.endsWith(".css")?(0,a.jsx)("link",{precedence:"dynamic",href:r,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,s.preload)(r,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},49354,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a={createReactBrowserBailoutReason:function(){return i},getReactBrowserBailoutReason:function(){return l},isNextBrowserBailoutError:function(){return o}};for(var s in a)Object.defineProperty(r,s,{enumerable:!0,get:a[s]});let n=Symbol.for("next.browser-bailout-reason");function i(e){return{$$typeof:n,reason:e}}function l(e){let t=e?.cause;return t?.$$typeof===n?t.reason:void 0}function o(e){return void 0!==l(e)}}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,53721,e=>{"use strict";var t=e.i(43476),r=e.i(64155),a=e.i(46670),s=e.i(63646);e.s(["x",0,function({readiness:e}){return e?.status!=="not-ready"?null:(0,t.jsx)("span",{title:(0,s.K)(e),"data-testid":"upgrade-readiness-badge",children:(0,t.jsxs)(a.t,{variant:"warning",children:[(0,t.jsx)(r.f,{className:"mr-1 inline h-3 w-3"}),"Upgrade blocked (",e.problems.length,")"]})})},"a",0,function({readiness:e}){return e?.status!=="not-ready"?null:(0,t.jsxs)("div",{className:"rounded border border-warning/40 bg-warning/10 px-3 py-2 text-[11px]","data-testid":"upgrade-readiness-panel",children:[(0,t.jsxs)("p",{className:"flex items-center gap-2 font-bold uppercase tracking-wider text-warning",children:[(0,t.jsx)(r.f,{className:"h-3.5 w-3.5"})," This node could not take an agent upgrade now"]}),(0,t.jsx)("ul",{className:"mt-2 space-y-2",children:e.problems.map(e=>(0,t.jsxs)("li",{children:[(0,t.jsxs)("p",{className:"font-medium text-text",children:[(0,t.jsx)("span",{className:"num",children:e.code}),": ",e.detail]}),(0,t.jsx)("p",{className:"text-text-muted",children:e.remedy})]},`${e.code}-${e.detail}`))})]})}])},57108,e=>{"use strict";var t=e.i(43476),r=e.i(46670);e.s(["f",0,function({configuration:e}){if(e?.memoryProvider!=="hivemem")return null;let a=e.hiveMemToken,s=a?.status??"unknown";return(0,t.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[(0,t.jsxs)(r.t,{variant:"valid"===s?"success":"expiring"===s||"unreachable"===s||"unknown"===s?"warning":"danger",children:["Token ",s]}),a?.expiresAt&&(0,t.jsxs)("time",{dateTime:a.expiresAt,title:"HiveMem token expiration",children:["expires ",new Date(a.expiresAt).toLocaleString()]}),a?.checkedAt&&(0,t.jsxs)("time",{dateTime:a.checkedAt,className:"text-text-muted/70",title:"Last HiveMem authentication check",children:["checked ",new Date(a.checkedAt).toLocaleString()]})]})}])},46670,e=>{"use strict";var t=e.i(43476),r=e.i(78571);let a={default:"border-border text-text-muted",success:"border-success/40 text-success bg-success/5 shadow-[0_0_6px_rgba(0,255,65,0.15)]",warning:"border-warning/40 text-warning bg-warning/5 shadow-[0_0_6px_rgba(255,179,0,0.15)]",danger:"border-danger/40 text-danger bg-danger/5 shadow-[0_0_6px_rgba(255,23,68,0.15)]",info:"border-info/40 text-info bg-info/5 shadow-[0_0_6px_rgba(0,176,255,0.15)]"},s={default:"bg-text-muted",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info"};e.s(["t",0,function({children:e,variant:n="default",className:i,dot:l=!1,pulse:o=!1}){return(0,t.jsxs)("span",{className:(0,r.f)("inline-flex items-center gap-1.5 rounded-chip border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",a[n],i),children:[l&&(0,t.jsxs)("span",{"aria-hidden":"true",className:"relative inline-flex h-1.5 w-1.5",children:[o&&(0,t.jsx)("span",{className:(0,r.f)("absolute inset-0 rounded-full animate-halo",s[n])}),(0,t.jsx)("span",{className:(0,r.f)("relative inline-flex h-1.5 w-1.5 rounded-full",s[n])})]}),e]})},"k",0,function(e){switch(e.toUpperCase()){case"ONLINE":case"COMPLETED":case"ACTIVE":case"RUNNING":case"INSTALLED":case"HEALTHY":return"success";case"DEGRADED":case"PAUSED":case"QUEUED":case"PENDING":case"INSTALLING":return"warning";case"OFFLINE":case"FAILED":case"ERROR":case"TIMEOUT":case"CANCELLED":case"DECOMMISSIONED":case"CRITICAL":return"danger";case"PROVISIONING":case"UPDATING":return"info";default:return"default"}}])},93999,51196,55427,e=>{"use strict";var t=e.i(43476),r=e.i(56420);let a={name:"arrow-down-right",size:24,node:[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]};a.node;let s=(0,r.f)(a);var n=e.i(75775),i=e.i(78571),l=e.i(3062),o=e.i(35084);let c={warning:"shadow-[0_0_6px_var(--color-warning)]",danger:"shadow-[0_0_8px_var(--color-danger)]",accent:"shadow-[0_0_6px_var(--color-accent)]",primary:"shadow-[0_0_6px_var(--color-primary)]"},d={xs:"h-1",sm:"h-1.5",md:"h-2"};function u({value:e,max:r=100,tone:a,thresholds:s=o.q,label:n,size:l="xs",showValue:x=!1,valueLabel:h,glow:m,className:f,testId:p}){let g="number"==typeof e&&Number.isFinite(e),v=g?Math.max(0,Math.min(100,e/(r||1)*100)):0,b=a??(g?(0,o.Z)(v,s):"muted"),j=m||!a&&g&&v>=s.warn,y=h??(g?`${v.toFixed(+(v<10&&v>0))}%`:"—");return(0,t.jsxs)("div",{className:(0,i.f)("flex min-w-0 items-center gap-2",f),"data-testid":p,children:[(0,t.jsx)("div",{role:"meter","aria-label":n,"aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":g?e:void 0,"aria-valuetext":y,className:(0,i.f)("relative flex-1 overflow-hidden rounded-full bg-border/70",d[l]),children:(0,t.jsx)("div",{style:{"--meter":`${v}%`},className:(0,i.f)("h-full w-(--meter) rounded-full transition-[width] duration-700 ease-out-expo starting:w-0",o.H[b],j&&c[b])})}),x&&(0,t.jsx)("span",{className:(0,i.f)("num w-11 shrink-0 text-right text-[11px]",g?o.T[b]:"text-text-muted"),children:y})]})}e.s(["f",0,u],51196);var x=e.i(71645);function h({values:e,tone:r="primary",width:a=160,height:s=32,area:n=!0,max:l,percent:c=!1,threshold:d,live:u=!0,emptyLabel:m="not enough data",className:f,testId:p,label:g,stretch:v=!1}){let b=`spark${(0,x.useId)().replace(/:/g,"")}`;if(e.length<2)return(0,t.jsx)("div",{className:(0,i.f)("flex h-8 items-center text-xs italic text-text-muted",f),"data-testid":p,children:m});let j=o.v[r],y=l??(c?Math.max(100,...e):Math.max(...e,d??0)||1),N=s-4,w=a/(e.length-1),k=e=>2+N-Math.max(0,e)/y*N,_=e.map((e,t)=>[t*w,k(e)]),M=_.map(([e,t])=>`${e.toFixed(1)},${t.toFixed(1)}`).join(" "),S=_[_.length-1];return(0,t.jsxs)("svg",{width:v?"100%":a,height:s,viewBox:`0 0 ${a} ${s}`,preserveAspectRatio:v?"none":void 0,className:(0,i.f)("block overflow-visible",f),"data-testid":p,role:g?"img":void 0,"aria-label":g,"aria-hidden":!g||void 0,children:[n&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:b,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"0%",stopColor:j,stopOpacity:.35}),(0,t.jsx)("stop",{offset:"100%",stopColor:j,stopOpacity:0})]})}),(0,t.jsx)("polygon",{points:`0,${s} ${M} ${a},${s}`,fill:`url(#${b})`})]}),void 0!==d&&(0,t.jsx)("line",{x1:0,x2:a,y1:k(d),y2:k(d),stroke:"var(--color-warning)",strokeOpacity:.5,strokeDasharray:"3 3",strokeWidth:1}),(0,t.jsx)("polyline",{fill:"none",stroke:j,strokeWidth:1.5,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round",points:M}),u&&!v&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:S[0],cy:S[1],r:2.5,fill:j,className:"origin-center animate-halo [transform-box:fill-box]"}),(0,t.jsx)("circle",{cx:S[0],cy:S[1],r:2,fill:j})]})]})}e.s(["f",0,h],55427),e.s(["N",0,function({title:e,description:r,children:a,className:s,action:n,tone:i,corners:o=!1,...c}){return(0,t.jsx)(l.f,{...c,tone:i,corners:o,title:e,description:r,action:n,className:s,children:a})},"n",0,function({label:e,value:r,icon:a,trend:c,spark:d,meter:x,delta:m,tone:f="primary",className:p,testId:g}){let v=!m||m.value>=0===(m.positiveIsGood??!0);return(0,t.jsxs)(l.f,{tone:f,className:(0,i.f)("overflow-hidden",p),testId:g,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-[10px] font-medium uppercase tracking-[0.15em] text-text-muted",children:e}),a&&(0,t.jsx)("span",{className:"text-primary/60",children:a})]}),(0,t.jsxs)("div",{className:"mt-2 flex items-end justify-between gap-2",children:[(0,t.jsx)("div",{className:(0,i.f)("num text-2xl font-bold","primary"===f?"text-primary neon-text":o.T[f]),children:r}),m&&0!==m.value&&(0,t.jsxs)("span",{className:(0,i.f)("num mb-1 inline-flex items-center gap-0.5 text-[11px]",v?"text-success":"text-danger"),children:[m.value>0?(0,t.jsx)(n.f,{className:"h-3 w-3"}):(0,t.jsx)(s,{className:"h-3 w-3"}),Math.abs(m.value).toFixed(+!Number.isInteger(m.value)),m.unit]})]}),c&&(0,t.jsx)("div",{className:(0,i.f)("mt-1 text-[11px]",c.positive?"text-success":"text-danger"),children:c.value}),void 0!==x&&(0,t.jsx)(u,{value:x,className:"mt-3",label:e}),d&&d.length>1&&(0,t.jsx)("div",{className:"-mx-5 -mb-5 mt-3 opacity-80",children:(0,t.jsx)(h,{values:d,tone:f,width:240,height:28,stretch:!0,live:!1})})]})}],93999)},54149,21176,e=>{"use strict";var t=e.i(43476),r=e.i(71645),a=e.i(78571),s=e.i(35084);e.s(["f",0,function({value:e,max:n=100,label:i,sublabel:l,tone:o,thresholds:c=s.q,higherIsBetter:d=!1,size:u=140,display:x,ticks:h=!0,hideLabel:m=!1,className:f,testId:p}){let g=(0,r.useId)().replace(/:/g,""),v="number"==typeof e&&Number.isFinite(e),b=v?Math.max(0,Math.min(100,e/(n||1)*100)):0,j=o??(v?d?(0,s.Z)(100-b,c):(0,s.Z)(b,c):"muted"),y=Math.max(4,Math.round(u/16)),N=50-y/2-4,w=2*Math.PI*N,k=.75*w,_=k*b/100,M=u>=140,S=x??(v?`${Math.round(b)}%`:"—"),C=h?Array.from({length:11},(e,r)=>{let a=(135+270*r/10)*Math.PI/180,s=50-(r%5==0?4:2.5);return(0,t.jsx)("line",{x1:50+48.5*Math.cos(a),y1:50+48.5*Math.sin(a),x2:50+s*Math.cos(a),y2:50+s*Math.sin(a),stroke:"var(--color-border-strong)",strokeWidth:.8},r)}):null;return(0,t.jsxs)("div",{role:"img","aria-label":`${i}: ${S}`,"data-testid":p,className:(0,a.f)("relative inline-flex flex-col items-center",f),style:{width:u},children:[(0,t.jsxs)("svg",{viewBox:"0 0 100 100",width:u,height:u,"aria-hidden":"true",className:"overflow-visible",children:[M&&(0,t.jsx)("defs",{children:(0,t.jsxs)("filter",{id:`g${g}`,x:"-30%",y:"-30%",width:"160%",height:"160%",children:[(0,t.jsx)("feGaussianBlur",{stdDeviation:"2.2",result:"blur"}),(0,t.jsxs)("feMerge",{children:[(0,t.jsx)("feMergeNode",{in:"blur"}),(0,t.jsx)("feMergeNode",{in:"SourceGraphic"})]})]})}),C,(0,t.jsx)("circle",{cx:50,cy:50,r:N,fill:"none",stroke:"var(--color-border)",strokeWidth:y,strokeLinecap:"round",strokeDasharray:`${k} ${w}`,transform:"rotate(135 50 50)"}),(0,t.jsx)("circle",{cx:50,cy:50,r:N,fill:"none",stroke:s.v[j],strokeWidth:y,strokeLinecap:"round",transform:"rotate(135 50 50)",filter:M?`url(#g${g})`:void 0,style:{"--dash":`${_} ${w}`},className:"[stroke-dasharray:var(--dash)] transition-[stroke-dasharray] duration-1000 ease-out-expo starting:[stroke-dasharray:0_1000]"})]}),(0,t.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center",style:{height:u},children:[(0,t.jsx)("span",{className:(0,a.f)("num font-bold leading-none",s.T[j],M&&s.z[j]),style:{fontSize:Math.max(12,.2*u)},children:S}),l&&(0,t.jsx)("span",{className:"num mt-1 text-text-muted",style:{fontSize:Math.max(9,.075*u)},children:l})]}),!m&&(0,t.jsx)("span",{className:"-mt-[10%] text-center text-[10px] font-medium uppercase tracking-[0.15em] text-text-muted",children:i})]})}],54149);var n=e.i(70703),i=e.i(65369);let l=(0,n.default)(()=>e.A(1321),{loadableGenerated:{modules:[69944]},ssr:!1,loading:()=>(0,t.jsx)(i.l,{className:"h-[180px] w-full"})});e.s(["f",0,l],21176)},3062,e=>{"use strict";var t=e.i(43476),r=e.i(78571),a=e.i(35084);let s={primary:"[--panel-corner-color:color-mix(in_srgb,var(--color-primary)_60%,transparent)]",accent:"[--panel-corner-color:color-mix(in_srgb,var(--color-accent)_70%,transparent)]",success:"[--panel-corner-color:color-mix(in_srgb,var(--color-success)_60%,transparent)]",warning:"[--panel-corner-color:color-mix(in_srgb,var(--color-warning)_70%,transparent)]",danger:"[--panel-corner-color:color-mix(in_srgb,var(--color-danger)_70%,transparent)]",info:"[--panel-corner-color:color-mix(in_srgb,var(--color-info)_60%,transparent)]",muted:"[--panel-corner-color:var(--color-border-strong)]"},n={primary:"[--glow-hover-color:var(--color-glow)]",accent:"[--glow-hover-color:var(--color-glow-accent)]",success:"[--glow-hover-color:var(--color-glow-success)]",warning:"[--glow-hover-color:var(--color-glow-warning)]",danger:"[--glow-hover-color:var(--color-glow-danger)]",info:"[--glow-hover-color:var(--color-glow)]",muted:"[--glow-hover-color:var(--color-glow)]"},i={primary:"hover:border-primary/30",accent:"hover:border-accent/40",success:"hover:border-success/30",warning:"hover:border-warning/40",danger:"hover:border-danger/40",info:"hover:border-info/30",muted:"hover:border-border-strong"},l={none:"",sm:"p-3",md:"p-5",lg:"p-6"};e.s(["f",0,function({tone:e="primary",corners:o=!0,interactive:c=!0,hero:d=!1,title:u,description:x,icon:h,action:m,as:f="div",padding:p="md",testId:g,className:v,children:b,...j}){return(0,t.jsxs)(f,{...j,"data-testid":g??j["data-testid"],className:(0,r.f)("relative rounded-panel border border-border bg-surface transition-colors duration-300",l[p],o&&"panel-corners",o&&s[e],c&&"glow-hover",c&&n[e],c&&i[e],d&&"grid-bg overflow-hidden bg-surface/80",v),children:[(u||m||h)&&(0,t.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[h&&(0,t.jsx)("span",{className:(0,r.f)("mt-0.5 shrink-0",a.T[e]),children:h}),(0,t.jsxs)("div",{className:"min-w-0",children:[u&&(0,t.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider",children:u}),x&&(0,t.jsx)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:x})]})]}),m]}),b]})}])},65369,e=>{"use strict";var t=e.i(43476),r=e.i(78571);function a({className:e}){return(0,t.jsx)("div",{"aria-hidden":"true",className:(0,r.f)("skeleton h-3 w-full",e)})}e.s(["l",0,a,"g",0,function({count:e=4,className:s}){return(0,t.jsx)("div",{role:"status","aria-label":"Loading",className:(0,r.f)("grid gap-4 sm:grid-cols-2 lg:grid-cols-4",s),children:Array.from({length:e},(e,r)=>(0,t.jsxs)("div",{className:"panel-corners rounded-panel border border-border bg-surface p-5",children:[(0,t.jsx)(a,{className:"h-2 w-1/2"}),(0,t.jsx)(a,{className:"mt-4 h-7 w-2/3"}),(0,t.jsx)(a,{className:"mt-3 h-1 w-full opacity-60"})]},r))})},"F",0,function({rows:e=5,cols:s=4,className:n}){return(0,t.jsxs)("div",{role:"status","aria-label":"Loading",className:(0,r.f)("overflow-hidden rounded-panel border border-border",n),children:[(0,t.jsx)("div",{className:"flex gap-4 border-b border-border bg-surface px-4 py-3",children:Array.from({length:s},(e,r)=>(0,t.jsx)(a,{className:"h-2 flex-1 opacity-60"},r))}),Array.from({length:e},(e,n)=>(0,t.jsx)("div",{className:"flex gap-4 border-b border-border/50 px-4 py-3 last:border-0",children:Array.from({length:s},(e,s)=>(0,t.jsx)(a,{className:(0,r.f)("h-3 flex-1",(n+s)%3==0&&"max-w-[60%]")},s))},n))]})},"Q",0,function({lines:e=3,className:s}){let n=["w-full","w-11/12","w-4/5","w-2/3","w-3/4"];return(0,t.jsx)("div",{role:"status","aria-label":"Loading",className:(0,r.f)("space-y-2",s),children:Array.from({length:e},(e,r)=>(0,t.jsx)(a,{className:n[r%n.length]},r))})}])},75723,e=>{"use strict";var t=e.i(43476),r=e.i(78571),a=e.i(46670);let s={success:"bg-success shadow-[0_0_6px_var(--color-success)]",warning:"bg-warning shadow-[0_0_6px_var(--color-warning)]",danger:"bg-danger shadow-[0_0_6px_var(--color-danger)]",info:"bg-info shadow-[0_0_6px_var(--color-info)]",default:"bg-text-muted"},n={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",default:"bg-text-muted"},i=new Set(["ONLINE","RUNNING","ACTIVE","HEALTHY","CRITICAL","UPDATING","PROVISIONING"]);e.s(["f",0,function({status:e,pulse:l,size:o="sm",className:c,label:d}){let u=(0,a.k)(e),x=l??i.has(e.toUpperCase()),h="xs"===o?"h-1.5 w-1.5":"h-2 w-2";return(0,t.jsxs)("span",{className:(0,r.f)("relative inline-flex shrink-0",h,c),role:d?"img":void 0,"aria-label":d,"aria-hidden":!d||void 0,children:[x&&(0,t.jsx)("span",{className:(0,r.f)("absolute inset-0 rounded-full animate-halo",n[u])}),(0,t.jsx)("span",{className:(0,r.f)("relative inline-flex rounded-full",h,s[u])})]})}])},71417,e=>{"use strict";e.s(["L",0,function(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(1))} ${["B","KB","MB","GB","TB"][t]}`},"C",0,function(e){return e?("string"==typeof e?new Date(e):e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}])},79432,e=>{"use strict";var t=e.i(56420);let r={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],79432)},9347,e=>{"use strict";var t=e.i(56420);let r={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],9347)},75775,e=>{"use strict";var t=e.i(56420);let r={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],75775)},82022,e=>{"use strict";var t=e.i(56420);let r={name:"external-link",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],82022)},57665,e=>{"use strict";var t=e.i(56420);let r={name:"power",size:24,node:[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],57665)},86207,14098,e=>{"use strict";var t=e.i(56420);let r={name:"refresh-ccw-dot",size:24,node:[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],86207);var s=e.i(43476),n=e.i(71645),i=e.i(68759),l=e.i(32568),o=e.i(82983),c=e.i(41220),d=e.i(32781);e.s(["E",0,function({open:e,node:t,onClose:r,onSaved:a}){let[u,x]=(0,n.useState)([]),[h,m]=(0,n.useState)(""),[f,p]=(0,n.useState)(!0),[g,v]=(0,n.useState)(!1),[b,j]=(0,n.useState)(""),[y,N]=(0,n.useState)(!1);(0,n.useEffect)(()=>{e&&(j(""),m(t?.role?.id??""),p(!0),N(!0),(async()=>{try{let e=await o.f.roles.list();x(e.data??[])}catch{j("Failed to load roles")}finally{N(!1)}})())},[e,t?.role?.id]);let w=async()=>{if(t){v(!0),j("");try{let e=t.role?.id;e&&e!==h&&await o.f.roles.unassign(e,{nodeIds:[t.id]}),h&&await o.f.roles.assign(h,{nodeIds:[t.id],defer:!f});let s=h?u.find(e=>e.id===h)??null:null;a(s),r()}catch(e){j(e instanceof Error?e.message:"Failed to assign role")}finally{v(!1)}}},k=async()=>{if(t?.role){v(!0),j("");try{await o.f.roles.unassign(t.role.id,{nodeIds:[t.id]}),a(null),r()}catch(e){j(e instanceof Error?e.message:"Failed to unassign role")}finally{v(!1)}}},_=()=>{j(""),v(!1),r()};return(0,s.jsx)(l.n,{open:e,onClose:_,title:t?.role?"Change Role":"Assign Role",description:t?`Node: ${t.name}`:"",icon:(0,s.jsx)(c.f,{className:"h-5 w-5 text-primary"}),children:(0,s.jsxs)("div",{className:"space-y-4",children:[y?(0,s.jsxs)("div",{className:"flex items-center gap-2 py-4 text-xs text-text-muted",children:[(0,s.jsx)(d.f,{className:"h-4 w-4 animate-spin"}),"Loading roles…"]}):0===u.length?(0,s.jsx)("p",{className:"text-xs text-text-muted py-4",children:"No roles found. Create a role first on the Roles page."}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.G,{label:"Role",children:(0,s.jsxs)("select",{value:h,onChange:e=>m(e.target.value),className:l.N,children:[(0,s.jsx)("option",{value:"",children:"— No role —"}),u.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]})}),h&&(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[(0,s.jsx)("input",{type:"checkbox",checked:f,onChange:e=>p(e.target.checked),className:"rounded border-border"}),"Apply role immediately"]})]}),b&&(0,s.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:b}),(0,s.jsxs)("div",{className:"flex justify-between pt-2",children:[(0,s.jsx)("div",{children:t?.role&&(0,s.jsx)(i.K,{variant:"secondary",size:"sm",onClick:()=>void k(),disabled:g,children:"Unassign Role"})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.K,{variant:"secondary",size:"sm",onClick:_,children:"Cancel"}),(0,s.jsx)(i.K,{size:"sm",onClick:()=>void w(),disabled:g||!h||0===u.length,icon:g?(0,s.jsx)(d.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:g?"Saving…":t?.role?"Change Role":"Assign Role"})]})]})]})})},"F",0,function({open:e,node:t,onClose:r,onSaved:a}){let[u,x]=(0,n.useState)(""),[h,m]=(0,n.useState)(""),[f,p]=(0,n.useState)(""),[g,v]=(0,n.useState)(!1),[b,j]=(0,n.useState)("");(0,n.useEffect)(()=>{if(t){x(t.name);try{let e=JSON.parse(t.tags);m(e.join(", "))}catch{m("")}p(t.status),j("")}},[t]);let y=async()=>{if(t&&u.trim()){v(!0),j("");try{let e=h.split(",").map(e=>e.trim()).filter(Boolean);await o.f.nodes.update(t.id,{name:u.trim(),tags:e,status:f.toUpperCase()}),a(),r()}catch(e){j(e instanceof Error?e.message:"Failed to update node")}finally{v(!1)}}},N=()=>{j(""),v(!1),r()};return(0,s.jsx)(l.n,{open:e,onClose:N,title:"Edit Node",description:t?`${t.hostname}`:"",icon:(0,s.jsx)(c.f,{className:"h-5 w-5 text-primary"}),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(l.G,{label:"Name",required:!0,children:(0,s.jsx)("input",{type:"text",value:u,onChange:e=>x(e.target.value),className:l.W})}),(0,s.jsx)(l.G,{label:"Status",children:(0,s.jsxs)("select",{value:f,onChange:e=>p(e.target.value),className:l.N,children:[(0,s.jsx)("option",{value:"ONLINE",children:"ONLINE"}),(0,s.jsx)("option",{value:"OFFLINE",children:"OFFLINE"}),(0,s.jsx)("option",{value:"DEGRADED",children:"DEGRADED"}),(0,s.jsx)("option",{value:"PROVISIONING",children:"PROVISIONING"}),(0,s.jsx)("option",{value:"MAINTENANCE",children:"MAINTENANCE"})]})}),(0,s.jsxs)(l.G,{label:"Tags",children:[(0,s.jsx)("input",{type:"text",value:h,onChange:e=>m(e.target.value),placeholder:"web, production, us-east",className:l.W}),(0,s.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Comma-separated list of tags"})]}),b&&(0,s.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:b}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,s.jsx)(i.K,{variant:"secondary",size:"sm",onClick:N,children:"Cancel"}),(0,s.jsx)(i.K,{size:"sm",onClick:()=>void y(),disabled:g||!u.trim(),icon:g?(0,s.jsx)(d.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:g?"Saving…":"Save Changes"})]})]})})},"M",0,function({open:e,onClose:t,onRegistered:r}){let[a,u]=(0,n.useState)(""),[x,h]=(0,n.useState)(""),[m,f]=(0,n.useState)("4100"),[p,g]=(0,n.useState)("linux"),[v,b]=(0,n.useState)("x86_64"),[j,y]=(0,n.useState)(""),[N,w]=(0,n.useState)(!1),[k,_]=(0,n.useState)(""),M=async()=>{if(a.trim()&&x.trim()){w(!0),_("");try{let e=j.split(",").map(e=>e.trim()).filter(Boolean);await o.f.nodes.register({name:a.trim(),hostname:x.trim(),ipAddress:x.trim(),port:Number(m)||4100,os:p,arch:v,tags:e,agentVersion:"3.0.1"}),r(),S()}catch(e){_(e instanceof Error?e.message:"Failed to register node")}finally{w(!1)}}},S=()=>{u(""),h(""),f("4100"),g("linux"),b("x86_64"),y(""),_(""),w(!1),t()};return(0,s.jsx)(l.n,{open:e,onClose:S,title:"Register Node",description:"Manually register a node already running the agent",icon:(0,s.jsx)(c.f,{className:"h-5 w-5 text-primary"}),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(l.G,{label:"Node Name",required:!0,children:(0,s.jsx)("input",{type:"text",value:a,onChange:e=>u(e.target.value),placeholder:"web-server-01",className:l.W,autoFocus:!0})}),(0,s.jsx)(l.G,{label:"FQDN / Hostname",required:!0,children:(0,s.jsx)("input",{type:"text",value:x,onChange:e=>h(e.target.value),placeholder:"node-1.example.com",className:l.W})}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,s.jsx)(l.G,{label:"Port",children:(0,s.jsx)("input",{type:"number",value:m,onChange:e=>f(e.target.value),className:l.W})}),(0,s.jsx)(l.G,{label:"OS",children:(0,s.jsxs)("select",{value:p,onChange:e=>g(e.target.value),className:l.N,children:[(0,s.jsx)("option",{value:"linux",children:"Linux"}),(0,s.jsx)("option",{value:"darwin",children:"macOS"}),(0,s.jsx)("option",{value:"windows",children:"Windows"})]})}),(0,s.jsx)(l.G,{label:"Architecture",children:(0,s.jsxs)("select",{value:v,onChange:e=>b(e.target.value),className:l.N,children:[(0,s.jsx)("option",{value:"x86_64",children:"x86_64"}),(0,s.jsx)("option",{value:"aarch64",children:"aarch64"}),(0,s.jsx)("option",{value:"arm",children:"arm"})]})})]}),(0,s.jsxs)(l.G,{label:"Tags",children:[(0,s.jsx)("input",{type:"text",value:j,onChange:e=>y(e.target.value),placeholder:"web, production, us-east",className:l.W}),(0,s.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Comma-separated"})]}),k&&(0,s.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:k}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,s.jsx)(i.K,{variant:"secondary",size:"sm",onClick:S,children:"Cancel"}),(0,s.jsx)(i.K,{size:"sm",onClick:()=>void M(),disabled:N||!a.trim()||!x.trim(),icon:N?(0,s.jsx)(d.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:N?"Registering…":"Register Node"})]})]})})}],14098)},25398,e=>{"use strict";var t=e.i(56420);let r={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],25398)},90317,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a={bindSnapshot:function(){return d},createAsyncLocalStorage:function(){return o},createSnapshot:function(){return u},getOrCreateGlobalAsyncLocalStorage:function(){return c}};for(var s in a)Object.defineProperty(r,s,{enumerable:!0,get:a[s]});let n=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class i{disable(){throw n}getStore(){}run(){throw n}exit(){throw n}enterWith(){throw n}static bind(e){return e}}let l="u">typeof globalThis&&globalThis.AsyncLocalStorage;function o(){return l?new l:new i}function c(e){let t=Symbol.for(`@next/${e}@16.4.5`),r=globalThis;return r[t]??=o()}function d(e){return l?l.bind(e):i.bind(e)}function u(){return l?l.snapshot():function(e,...t){return e(...t)}}},42344,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorageInstance",{enumerable:!0,get:function(){return a}});let a=(0,e.r(90317).getOrCreateGlobalAsyncLocalStorage)("work-async-storage")},63599,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorage",{enumerable:!0,get:function(){return a.workAsyncStorageInstance}});let a=e.r(42344)},70703,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return s}});let a=e.r(55682)._(e.r(69093));function s(e,t){let r={};"function"==typeof e&&(r.loader=e);let s={...r,...t};return(0,a.default)({...s,modules:s.loadableGenerated?.modules})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},9885,(e,t,r)=>{"use strict";function a(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"encodeURIPath",{enumerable:!0,get:function(){return a}})},67585,(e,t,r)=>{"use strict";e.i(47167),Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BailoutToCSRForNextDynamic",{enumerable:!0,get:function(){return i}});let a=e.r(71645),s=e.r(74080);e.r(32061);let n=e.r(49354).createReactBrowserBailoutReason.bind(null,"next/dynamic");function i({children:e}){return(0,a.use)((0,s.browser)(n)),e}},69093,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return c}});let a=e.r(43476),s=e.r(71645),n=e.r(67585),i=e.r(52157);function l(e){return{default:e&&"default"in e?e.default:e}}let o={loader:()=>Promise.resolve(l(()=>null)),loading:null,ssr:!0},c=function(e){let t={...o,...e},r=(0,s.lazy)(()=>t.loader().then(l)),c=t.loading;function d(e){let l=c?(0,a.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,d=o?s.Suspense:s.Fragment,u=t.ssr?(0,a.jsxs)(a.Fragment,{children:["u"<typeof window?(0,a.jsx)(i.PreloadChunks,{moduleIds:t.modules}):null,(0,a.jsx)(r,{...e})]}):(0,a.jsx)(n.BailoutToCSRForNextDynamic,{children:(0,a.jsx)(r,{...e})});return(0,a.jsx)(d,{...o?{fallback:l}:{},children:u})}return d.displayName="LoadableComponent",d}},52157,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"PreloadChunks",{enumerable:!0,get:function(){return o}});let a=e.r(43476),s=e.r(74080),n=e.r(63599),i=e.r(9885),l=e.r(43369);function o({moduleIds:e}){if("u">typeof window)return null;let t=n.workAsyncStorage.getStore();if(void 0===t)return null;let r=[];if(t.reactLoadableManifest&&e){let a=t.reactLoadableManifest;for(let t of e){if(!a[t])continue;let e=a[t].files;r.push(...e)}}if(0===r.length)return null;let c=(0,l.getAssetTokenQuery)();return(0,a.jsx)(a.Fragment,{children:r.map(e=>{let r=`${t.assetPrefix}/_next/${(0,i.encodeURIPath)(e)}${c}`;return e.endsWith(".css")?(0,a.jsx)("link",{precedence:"dynamic",href:r,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,s.preload)(r,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},49354,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a={createReactBrowserBailoutReason:function(){return i},getReactBrowserBailoutReason:function(){return l},isNextBrowserBailoutError:function(){return o}};for(var s in a)Object.defineProperty(r,s,{enumerable:!0,get:a[s]});let n=Symbol.for("next.browser-bailout-reason");function i(e){return{$$typeof:n,reason:e}}function l(e){let t=e?.cause;return t?.$$typeof===n?t.reason:void 0}function o(e){return void 0!==l(e)}}]);
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
`,document.head.appendChild(e)}if(t||o.current)return;let m=new a({cursorBlink:!0,scrollback:1e3,fontFamily:'"JetBrains Mono", "Fira Code", "Cascadia Code", monospace',fontSize:13,theme:{background:"#06060d",foreground:"#e0e0ec",cursor:"#00e5ff",cursorAccent:"#06060d",selectionBackground:"#00e5ff33",black:"#06060d",red:"#ff1744",green:"#00ff41",yellow:"#ffb300",blue:"#00b0ff",magenta:"#ff006e",cyan:"#00e5ff",white:"#e0e0ec",brightBlack:"#5a5a7a",brightRed:"#ff5252",brightGreen:"#69f0ae",brightYellow:"#ffd740",brightBlue:"#40c4ff",brightMagenta:"#ff4081",brightCyan:"#18ffff",brightWhite:"#ffffff"}}),f=new r;if(m.loadAddon(f),l.current=m,d.current=f,i.current&&(m.open(i.current),requestAnimationFrame(()=>{o.current||f.fit()})),t||o.current)return;let j=f.proposeDimensions(),b=j?.cols??120,y=j?.rows??30,N=n.hostname||n.ipAddress;m.write(`\x1b[38;2;138;138;171mConnecting to ${N} as ${N===n.hostname?n.hostname:n.ipAddress}...\x1b[0m\r
|
|
13
13
|
`);try{let e=await fetch("/api/terminal/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({host:N,cols:b,rows:y})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`HTTP ${e.status}`)}c.current=s=(await e.json()).sessionId}catch(s){if(t||o.current)return;let e=s instanceof Error?s.message:"Unknown error";m.write(`\r
|
|
14
14
|
\x1b[31mFailed to open session: ${e}\x1b[0m\r
|
|
15
|
-
`),x("error");return}if(t||o.current)return;x("connected");let v=new AbortController;u.current=v,(async()=>{try{let e=await fetch(`/api/terminal/stream?sessionId=${encodeURIComponent(s)}`,{signal:v.signal});if(!e.ok||!e.body){t||o.current||(m.write("\r\n\x1b[31mFailed to connect output stream\x1b[0m\r\n"),x("error"));return}let a=e.body.getReader();for(;;){let{done:e,value:s}=await a.read();if(e||t||o.current)break;s&&m.write(s)}}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return}t||o.current||(x("closed"),m.write("\r\n\x1b[38;2;138;138;171m── Session ended ──\x1b[0m\r\n"))})(),m.onData(e=>{!o.current&&c.current&&(p.current+=e,h.current||(h.current=setTimeout(g,16)))}),m.onResize(({cols:e,rows:t})=>{!o.current&&c.current&&fetch("/api/terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:c.current,cols:e,rows:t})}).catch(()=>{})})})();let s=()=>{d.current&&!o.current&&d.current.fit()};return window.addEventListener("resize",s),()=>{t=!0,window.removeEventListener("resize",s),f()}},[a,n,f,g]);let b=(0,s.useCallback)(()=>{f(),r()},[f,r]);return n?(0,t.jsx)(F.n,{open:a,onClose:b,title:`Terminal: ${n.name}`,description:"Interactive SSH session",icon:(0,t.jsx)(j.f,{className:"h-5 w-5 text-primary"}),className:"max-w-5xl",children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("div",{className:"absolute top-0 right-0 z-10 flex items-center gap-1.5 px-2 py-1",children:[(0,t.jsx)("div",{className:`h-1.5 w-1.5 rounded-full ${"connected"===m?"bg-success":"connecting"===m?"bg-warning animate-pulse":"error"===m?"bg-danger":"bg-text-muted"}`}),(0,t.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:m})]}),(0,t.jsx)("div",{ref:i,className:"h-[65vh] w-full rounded border border-border/50 bg-[#06060d] p-1 overflow-hidden"})]})}):null}var D=e.i(63376),q=e.i(67683),V=e.i(73404),L=e.i(51196),M=e.i(75723),G=e.i(2067),H=e.i(65369),J=e.i(51757);let W={name:"clipboard-check",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]};W.node;let Y=(0,I.f)(W),Q={name:"octagon-x",size:24,node:[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],aliases:["x-octagon"]};Q.node;let X=(0,I.f)(Q);var Z=e.i(83967),ee=e.i(63646);let et={pending:{label:"Queued",variant:"default"},requested:{label:"Installing",variant:"info"},watching:{label:"Watching",variant:"info"},ambiguous:{label:"Unknown",variant:"warning"},confirmed:{label:"Upgraded",variant:"success"},reverted:{label:"Reverted",variant:"danger"},failed:{label:"Failed",variant:"danger"},refused:{label:"Refused",variant:"warning"},skipped:{label:"Skipped",variant:"default"}};function es({open:e,onClose:a,onFinished:i}){let[d,c]=(0,s.useState)(null),[o,u]=(0,s.useState)(new Set),[m,x]=(0,s.useState)(null),[h,f]=(0,s.useState)(null),[j,b]=(0,s.useState)(!1),[y,N]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1),[C,S]=(0,s.useState)(""),R=async e=>f(await (0,ee.s)(e)),E=(0,s.useCallback)(async()=>{f(null);try{let e=await l.f.agentUpgrades.eligibility();c(e),u(new Set(e.nodes.filter(e=>e.eligible).map(e=>e.nodeId))),x(e.latestRun??null)}catch(e){f(await (0,ee.s)(e))}},[]);(0,s.useEffect)(()=>{e&&(x(null),N(null),E())},[e,E]),(0,s.useEffect)(()=>{if(!m||"running"!==m.status)return;let e=window.setInterval(()=>{l.f.agentUpgrades.run(m.id).then(e=>{x(e),"running"!==e.status&&i?.()}).catch(async t=>{window.clearInterval(e),f((0,ee.c)(t)?`Upgrade run ${m.id} is no longer known to the server`:await (0,ee.s)(t)),(0,ee.c)(t)&&x(null)})},5e3);return()=>window.clearInterval(e)},[m,i]);let U=(0,s.useMemo)(()=>d?.nodes.filter(e=>e.eligible).length??0,[d]),I=d?.nodes.filter(e=>"MAJOR_VERSION"===e.code).length??0,$=d&&(!m||"running"!==m.status),A=async e=>{b(!0),f(null);try{x(await e())}catch(e){await R(e)}finally{b(!1)}},P=/^[1-9][0-9]{0,2}$/.test(C)?{maxFailures:Number(C)}:{},O=async()=>{k(!0),f(null);try{N(await l.f.agentUpgrades.check({version:d?.version,...o.size?{nodeIds:[...o]}:{}}))}catch(e){await R(e)}finally{k(!1)}},_=(e=!1)=>m&&A(()=>l.f.agentUpgrades.retry(m.id,e?{acknowledgeSuspicion:e}:{}));return(0,t.jsx)(F.n,{open:e,onClose:a,title:"Upgrade agents",icon:(0,t.jsx)(v.f,{className:"h-4 w-4"}),description:d?(0,ee.Q)(d):void 0,className:"max-h-[calc(100dvh-1.5rem)] max-w-4xl overflow-y-auto",children:(0,t.jsxs)("div",{className:"space-y-4 text-[11px]",children:[h&&(0,t.jsx)("div",{className:"rounded border border-danger/40 bg-danger/10 px-3 py-2 text-danger","data-testid":"agent-upgrade-error",children:h}),d&&!d.upgradesEnabled&&(0,t.jsxs)("div",{className:"rounded border border-warning/40 bg-warning/10 px-3 py-2 text-warning",children:["Agent upgrades are off: ",d.disabledReason]}),!d&&!h&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,t.jsx)(p.f,{className:"h-4 w-4 animate-spin"})," Checking agents…"]}),m&&(0,t.jsxs)("div",{className:"space-y-2","data-testid":"agent-upgrade-run",children:[(0,t.jsxs)("p",{className:"flex flex-wrap items-center gap-2",children:["running"===m.status&&(0,t.jsx)(p.f,{className:"h-4 w-4 animate-spin text-primary"}),"succeeded"===m.status&&(0,t.jsx)(J.f,{className:"h-4 w-4 text-success"}),"partial"===m.status&&(0,t.jsx)(g.f,{className:"h-4 w-4 text-warning"}),("failed"===m.status||"interrupted"===m.status)&&(0,t.jsx)(Z.f,{className:"h-4 w-4 text-danger"}),"stopped"===m.status&&(0,t.jsx)(X,{className:"h-4 w-4 text-warning"}),(0,t.jsx)("span",{className:"font-bold uppercase tracking-wider",children:"running"===m.status?`Upgrading to ${m.version}${m.stopRequestedBy?" (stopping after the nodes in progress)":""}`:(0,ee.P)(m)})]}),"running"!==m.status&&m.message&&(0,t.jsx)("p",{className:"text-text-muted","data-testid":"agent-upgrade-run-message",children:m.message}),(m.warnings??[]).map(e=>(0,t.jsxs)("p",{className:"text-warning","data-testid":"agent-upgrade-warning",children:[e.name,": ",e.detail]},`${e.nodeId}-${e.code}`)),(0,t.jsxs)("details",{open:"running"===m.status,className:"group",children:[(0,t.jsxs)("summary",{className:"cursor-pointer text-text-muted",children:["running"===m.status?"Current rollout":"Previous rollout"," to ",m.version," · ",m.nodes.length," agent",1===m.nodes.length?"":"s"]}),(0,t.jsxs)("ul",{className:"mt-2 max-h-80 divide-y divide-border/40 overflow-y-auto rounded border border-border",children:[m.nodes.map(e=>(0,t.jsxs)("li",{className:"flex flex-wrap items-center gap-3 px-3 py-2",children:[(0,t.jsxs)("span",{className:"w-40 truncate font-medium text-text",children:[e.name,e.nodeId===(m.canaryNodeId??m.nodes[0]?.nodeId)?" (canary)":""]}),(0,t.jsxs)("span",{className:"num shrink-0 text-text-muted",children:[e.from," → ",m.version]}),(0,t.jsxs)(r.t,{variant:et[e.state]?.variant??"default",children:["requested"===e.state&&(0,t.jsx)(p.f,{className:"mr-1 inline h-3 w-3 animate-spin"}),"reverted"===e.state&&(0,t.jsx)(z.f,{className:"mr-1 inline h-3 w-3"}),et[e.state]?.label??e.state]}),(e.attempts??1)>1&&(0,t.jsxs)("span",{className:"num text-text-muted",children:["try ",e.attempts]}),(0,ee.b)(e)&&(0,t.jsx)("span",{className:"w-full break-words text-text-muted",children:(0,ee.b)(e)})]},e.nodeId)),(m.excluded??[]).map(e=>(0,t.jsxs)("li",{className:"flex flex-wrap items-center gap-3 px-3 py-2 text-text-muted",title:e.reason,children:[(0,t.jsx)("span",{className:"w-40 truncate font-medium text-text",children:e.name}),(0,t.jsx)(r.t,{variant:"default",children:"Not included"}),(0,t.jsx)("span",{className:"w-full break-words text-text-muted",children:e.reason})]},`excluded-${e.nodeId}`))]})]}),"running"!==m.status&&(m.attention?.length??0)>0&&(0,t.jsxs)("div",{className:"space-y-2 rounded border border-warning/40 bg-warning/10 px-3 py-2","data-testid":"agent-upgrade-attention",children:[(0,t.jsx)("p",{className:"font-bold uppercase tracking-wider text-warning",children:"Needs attention"}),(0,t.jsx)("ul",{className:"max-h-48 space-y-2 overflow-y-auto",children:m.attention.map(e=>(0,t.jsxs)("li",{children:[(0,t.jsxs)("p",{className:"font-medium text-text",children:[e.name,": ",(0,t.jsx)("span",{className:"num",children:e.code}),"release"===e.failureClass?" (points at the release)":"",e.unknownCode?" (unrecognised code)":""]}),e.detail&&(0,t.jsx)("p",{className:"text-text-muted",children:e.detail}),(0,t.jsx)("p",{className:"text-text",children:e.remedy})]},`${e.nodeId}-${e.code}`))})]})]}),y&&(0,t.jsxs)("div",{className:"space-y-2","data-testid":"agent-upgrade-check",children:[(0,t.jsxs)("p",{className:"font-bold uppercase tracking-wider",children:["Check: ",y.eligible," ready, ",y.blocked," blocked",y.release.verified?"":`; target not verified: ${y.release.reason??"unknown"}`]}),(0,t.jsx)("ul",{className:"max-h-64 divide-y divide-border/40 overflow-y-auto rounded border border-border",children:y.nodes.map(e=>(0,t.jsxs)("li",{className:"space-y-1 px-3 py-2",children:[(0,t.jsxs)("p",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"w-40 truncate font-medium text-text",children:e.name}),(0,t.jsx)(r.t,{variant:e.eligible?"success":e.preflight?.status==="blocked"?"danger":"default",children:e.eligible?"Ready":e.code??"Not eligible"}),(0,t.jsxs)("span",{className:"text-text-muted",children:["preflight ",e.preflight?.status??"not run"]})]}),!e.eligible&&e.reason&&(0,t.jsx)("p",{className:"text-text-muted",children:e.reason}),!e.eligible&&e.remedy&&(0,t.jsx)("p",{className:"text-text",children:e.remedy}),e.preflight?.problems.filter(t=>t.code!==e.code).map(e=>(0,t.jsxs)("p",{className:"text-text-muted",children:[(0,t.jsx)("span",{className:"num",children:e.code}),": ",e.detail,". ",(0,ee.V)(e.code)]},`${e.code}-${e.detail}`))]},e.nodeId))})]}),$&&(0,t.jsxs)("section",{className:"space-y-2","aria-label":"Current upgrade eligibility",children:[(0,t.jsxs)("p",{className:"font-bold uppercase tracking-wider",children:["Target ",d.version,": ",U," ready, ",d.nodes.length-U," unavailable"]}),I>0&&(0,t.jsxs)("div",{className:"space-y-1 rounded border border-warning/40 bg-warning/10 px-3 py-2 text-warning","data-testid":"agent-upgrade-major-notice",children:[(0,t.jsxs)("p",{children:[I," agent",1===I?" requires":"s require"," a manual major-version upgrade to ",d.version,". This dialog only upgrades agents within their current major version."]}),(0,t.jsxs)("p",{children:["Read the ",(0,t.jsx)("a",{href:"https://github.com/ChefTaco/magnus/blob/main/UPGRADING.md#agents",target:"_blank",rel:"noreferrer",className:"underline",children:"agent upgrade guide"}),", then upgrade each affected node using its installation method. A successful rollout to an older version does not complete this upgrade."]})]}),0===U&&(0,t.jsx)("p",{className:"text-text-muted","data-testid":"agent-upgrade-empty",children:"No agents can be upgraded from this dialog right now. Review the reasons below; Check refreshes the readiness report."}),(0,t.jsxs)("ul",{className:"max-h-80 divide-y divide-border/40 overflow-y-auto rounded border border-border","data-testid":"agent-upgrade-candidates",children:[d.nodes.map(e=>(0,t.jsx)("li",{className:"px-3 py-2",children:(0,t.jsxs)("label",{className:"flex items-start gap-3",children:[(0,t.jsx)("input",{type:"checkbox",className:"mt-0.5 shrink-0","aria-label":`Upgrade ${e.name}`,checked:o.has(e.nodeId),disabled:!e.eligible||!d.upgradesEnabled,onChange:()=>{let t;return t=e.nodeId,u(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})}}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-1",children:[(0,t.jsxs)("span",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,t.jsx)("span",{className:"break-words font-medium text-text",children:e.name}),(0,t.jsxs)("span",{className:"num text-text-muted",children:[e.version,e.eligible?` → ${d.version}`:""]}),e.preflight&&"ok"!==e.preflight.status&&(0,t.jsxs)(r.t,{variant:"blocked"===e.preflight.status?"danger":"default",children:["preflight ",e.preflight.status]})]}),!e.eligible&&(0,t.jsx)("span",{className:"block break-words text-text-muted",children:e.reason})]})]})},e.nodeId)),0===d.nodes.length&&(0,t.jsx)("li",{className:"px-3 py-2 text-text-muted",children:"No nodes registered."})]})]}),(0,t.jsxs)("div",{className:"space-y-3 border-t border-border pt-3",children:[(0,t.jsx)("p",{className:"text-text-muted",children:"The first agent is a canary. Each agent switches back by itself if the new version does not report a heartbeat in time. Only evidence about the release stops the run: a failure on the canary, an integrity mismatch, or too many reverts. A problem of one node is recorded and the run goes on."}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-3",children:[$&&U>0&&(0,t.jsxs)("label",{className:"flex shrink-0 items-center gap-1 text-text-muted",title:"Reverts or failed installs that stop the run after its canary. Empty: the server's setting.",children:["Stop after",(0,t.jsx)("input",{className:"w-12 rounded border border-border bg-transparent px-1 py-0.5 text-text",inputMode:"numeric","aria-label":"Release failures that stop the run",value:C,onChange:e=>S(e.target.value),"data-testid":"agent-upgrade-max-failures"}),"failures"]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(n.K,{variant:"secondary",size:"sm",onClick:a,children:"Close"}),m?.status==="running"&&(0,t.jsx)(n.K,{variant:"danger",size:"sm",onClick:()=>void(m&&A(()=>l.f.agentUpgrades.stop(m.id))),"data-testid":"agent-upgrade-stop",disabled:j||!!m.stopRequestedBy,icon:(0,t.jsx)(X,{className:"h-3.5 w-3.5"}),children:"Stop"}),(0,ee.v)(m)&&d?.upgradesEnabled&&(0,t.jsxs)(n.K,{variant:"secondary",size:"sm",onClick:()=>void _(),"data-testid":"agent-upgrade-retry",disabled:j,icon:(0,t.jsx)(z.f,{className:"h-3.5 w-3.5"}),children:["Retry ",(0,ee.w)(m)," node",1===(0,ee.w)(m)?"":"s"]}),(0,ee.v)(m)&&d?.upgradesEnabled&&(m?.suspectedRelease||m?.excluded?.some(e=>"RETRY_HELD_SUSPECTED"===e.code))&&(0,t.jsx)(n.K,{variant:"danger",size:"sm",onClick:()=>void _(!0),"data-testid":"agent-upgrade-retry-acknowledged",disabled:j,title:"Each attempt on an older agent can strand another lease. Read the agent log first.",icon:(0,t.jsx)(z.f,{className:"h-3.5 w-3.5"}),children:"Retry older agents too"}),$&&(0,t.jsx)(n.K,{variant:"secondary",size:"sm",onClick:()=>void O(),"data-testid":"agent-upgrade-check-button",disabled:j||w,icon:w?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(Y,{className:"h-3.5 w-3.5"}),children:"Check"}),$&&(0,t.jsxs)(n.K,{variant:"primary",size:"sm",onClick:()=>void A(()=>l.f.agentUpgrades.start({nodeIds:[...o],version:d?.version,...d?.prerelease?{allowPrerelease:!0}:{},...P})),"data-testid":"agent-upgrade-start",disabled:j||0===o.size||!d?.upgradesEnabled,icon:j?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(v.f,{className:"h-3.5 w-3.5"}),children:["Upgrade ",o.size," agent",1===o.size?"":"s"]})]})]})]})]})})}var ea=e.i(53721);function er(e){try{let t=JSON.parse(e);if("string"==typeof t.deployError)return{label:"Deploy failed",message:t.deployError};if("string"==typeof t.upgradeError)return{label:"Upgrade failed",message:t.upgradeError};return null}catch{return null}}e.s(["default",0,function({initialNodes:e,initialTailscaleSummary:R}){let E,z,{activeNode:U}=(0,d.l)(),[I,$]=(0,s.useState)(e),[A,P]=(0,s.useState)((!!e.length||void 0===e)&&!1),[O,_]=(0,s.useState)(null),[T,F]=(0,s.useState)(!1),[J,W]=(0,s.useState)(!1);(0,s.useEffect)(()=>{"agents"===new URLSearchParams(window.location.search).get("upgrade")&&W(!0)},[]);let[Y,Q]=(0,s.useState)(null),[X,Z]=(0,s.useState)(null),[ee,et]=(0,s.useState)(!1),[en,ei]=(0,s.useState)([]),[el,ed]=(0,s.useState)(null),[ec,eo]=(0,s.useState)({}),[eu,em]=(0,s.useState)(null),[ex,ep]=(0,s.useState)(R),eh=(0,s.useRef)(null),eg=(0,s.useRef)({}),[ef,ej]=(0,s.useState)(e.length>0),eb=(0,s.useCallback)(async(e=!1)=>{try{e||P(!0),_(null);let[t,s,a]=await Promise.all([l.f.nodes.list(),l.f.nodes.systemUpdatesSummary().catch(()=>null),l.f.nodes.tailscaleSummary().catch(()=>null)]),r=t.data.map(e=>{if(e.role)return delete eg.current[e.id],e;let t=eg.current[e.id];return void 0!==t?{...e,role:t}:e});$(r),em(s?.data??null),ep(a?.data??null);let n=await Promise.all(r.map(async e=>{try{let t=await l.f.nodes.health(e.id);return[e.id,t.data]}catch{return[e.id,null]}}));eo(Object.fromEntries(n.filter(e=>null!==e[1])))}catch(a){let t=a instanceof Error?a.message:String(a),s="Failed to fetch"===t||t.includes("TypeError")||t.includes("NetworkError")||t.includes("ECONNREFUSED")||t.includes("timeout");e||_(s?`Control node unreachable (${U.name})`:t)}finally{e||P(!1)}},[U.name]);(0,s.useEffect)(()=>{if(ef){ej(!1),(async()=>{e.length>0&&eo(Object.fromEntries((await Promise.all(e.map(async e=>{try{let t=await l.f.nodes.health(e.id);return[e.id,t.data]}catch{return[e.id,null]}}))).filter(e=>null!==e[1])));try{let e=await l.f.nodes.systemUpdatesSummary();em(e.data)}catch{em(null)}try{let e=await l.f.nodes.tailscaleSummary();ep(e.data??null)}catch{ep(null)}})();return}$([]),_(null),ei([]),eo({}),em(null),ep(null),eg.current={},eb()},[U.id]),(0,s.useEffect)(()=>{let e=I.some(e=>"PROVISIONING"===e.status||e.agent?.status==="UPDATING");return e&&!eh.current?eh.current=setInterval(()=>{eb(!0)},4e3):!e&&eh.current&&(clearInterval(eh.current),eh.current=null),()=>{eh.current&&(clearInterval(eh.current),eh.current=null)}},[I,eb]);let ey=async e=>{if(confirm(`Delete node "${e.name}"? This will permanently remove it and all associated data.`))try{await l.f.nodes.delete(e.id),eb()}catch{}},eN=async()=>{et(!0),ei([]);try{let e=await l.f.discovery.scan(5e3);e.success&&Array.isArray(e.data)&&ei(e.data)}catch{}finally{et(!1)}};return(0,t.jsxs)(D.U,{className:"space-y-6",children:[(0,t.jsx)(D.z,{children:(0,t.jsx)(V.f,{title:"Nodes",eyebrow:"Fleet",description:"Manage your Magnus fleet nodes",status:I.length>0?(0,t.jsxs)("span",{className:"flex items-center gap-3 text-[10px] uppercase tracking-wider text-text-muted",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(M.f,{status:"ONLINE",size:"xs"}),(0,t.jsx)("span",{className:"num",children:I.filter(e=>"ONLINE"===e.status).length})," online"]}),(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(M.f,{status:"OFFLINE",size:"xs",pulse:!1}),(0,t.jsx)("span",{className:"num",children:I.filter(e=>"OFFLINE"===e.status).length})," offline"]})]}):void 0,actions:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.K,{variant:"secondary",size:"sm",icon:(0,t.jsx)(o.f,{className:"h-3.5 w-3.5"}),onClick:()=>void eb(),children:"Refresh"}),(0,t.jsx)(n.K,{variant:"secondary",size:"sm",icon:(0,t.jsx)(v.f,{className:"h-3.5 w-3.5"}),onClick:()=>W(!0),"data-testid":"open-agent-upgrade",children:"Upgrade Agents"}),(0,t.jsx)(n.K,{variant:"secondary",size:"sm",icon:(0,t.jsx)(c.f,{className:"h-3.5 w-3.5"}),onClick:()=>F(!0),children:"Register Node"})]})})}),(0,t.jsx)(D.z,{children:(0,t.jsx)(K,{})}),ex&&(0,t.jsx)(D.z,{children:(0,t.jsx)(q.f,{summary:ex,showAction:!1})}),eu&&(0,t.jsx)(D.z,{children:(0,t.jsx)("section",{className:"panel-corners overflow-hidden rounded-panel border border-border bg-surface","aria-label":"System update readiness",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-y divide-border/60 sm:grid-cols-4 sm:divide-y-0",children:[(0,t.jsxs)("div",{className:"col-span-2 flex items-center gap-3 px-4 py-3 sm:col-span-1",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-panel border border-primary/30 bg-primary/10 text-primary shadow-[0_0_10px_var(--color-glow)]",children:(0,t.jsx)(b.f,{className:"h-4 w-4"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-[0.16em] text-text-muted",children:"Auto-update coverage"}),(0,t.jsxs)("p",{className:"num mt-0.5 text-sm font-semibold",children:[eu.enabled," / ",eu.reporting," enabled"]}),(0,t.jsx)(L.f,{className:"mt-1.5",value:eu.reporting>0?eu.enabled/eu.reporting*100:null,tone:eu.enabled===eu.reporting?"success":"warning",label:"Auto-update coverage"})]})]}),(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-[0.16em] text-text-muted",children:"Action needed"}),(0,t.jsx)("p",{className:`num mt-1 text-lg font-bold ${eu.actionNeeded?"text-warning glow-text-warning":"text-success"}`,children:eu.actionNeeded})]}),(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-[0.16em] text-text-muted",children:"Reboot debt"}),(0,t.jsxs)("p",{className:`num mt-1 flex items-center gap-1.5 text-lg font-bold ${eu.rebootRequired?"text-danger glow-text-danger":"text-success"}`,children:[eu.rebootRequired?(0,t.jsx)(y.f,{className:"h-4 w-4"}):null,eu.rebootRequired]})]}),(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-[0.16em] text-text-muted",children:"Reporting"}),(0,t.jsxs)("p",{className:"num mt-1 text-lg font-bold",children:[eu.reporting," / ",eu.total]})]})]})})}),(0,t.jsx)(D.z,{children:(0,t.jsx)(a.N,{children:O?O.startsWith("Control node unreachable")?(0,t.jsx)(G.f,{tone:"warning",icon:(0,t.jsx)(x.f,{className:"h-5 w-5"}),title:O,description:"Cannot connect to this Control Node. Verify it is running and reachable.",action:(0,t.jsx)(n.K,{variant:"secondary",size:"sm",onClick:()=>void eb(),children:"Retry"})}):(0,t.jsx)(G.f,{tone:"danger",icon:(0,t.jsx)(h.f,{className:"h-5 w-5"}),title:"Error loading nodes",description:O,action:(0,t.jsx)(n.K,{variant:"secondary",size:"sm",onClick:()=>void eb(),children:"Retry"})}):A?(0,t.jsx)(H.F,{rows:6,cols:9,className:"border-0"}):0===I.length?(0,t.jsx)(G.f,{tone:"primary",icon:(0,t.jsx)(N.f,{className:"h-5 w-5"}),title:"No nodes registered",description:"Register your first Magnus node to get started.",action:(0,t.jsx)(n.K,{size:"sm",icon:(0,t.jsx)(c.f,{className:"h-3.5 w-3.5"}),onClick:()=>F(!0),children:"Register Node"})}):(0,t.jsx)("div",{className:"max-h-[70vh] overflow-auto",children:(0,t.jsxs)("table",{className:"w-full text-[11px]",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"sticky top-0 z-10 border-b border-primary/30 bg-surface/95 text-left text-[10px] font-bold uppercase tracking-[0.15em] text-text-muted shadow-[0_1px_0_var(--color-primary),0_4px_12px_-6px_var(--color-glow)] backdrop-blur-sm",children:[(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Name"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Host"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Address"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Status"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Agent"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Role"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"CPU"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Memory"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Persistent Disk"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Updates"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Tailscale key"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Last Heartbeat"}),(0,t.jsx)("th",{className:"pb-3",children:"Actions"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border/50",children:I.map(e=>{var s;let a=ec[e.id],l=(function(e){if(Array.isArray(e))return e;if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}})(a?.disks).filter(e=>"/"===e.mountPoint||"/home"===e.mountPoint||e.mountPoint.startsWith("/home/")||e.mountPoint.startsWith("/mnt/")||e.mountPoint.startsWith("/srv/")).filter(e=>!w.some(t=>e.mountPoint===t||e.mountPoint.startsWith(t))).filter(e=>!k.has((e.filesystemType??"").toLowerCase())).sort((e,t)=>t.usagePercent-e.usagePercent)[0]??null,d=l?(s=l.usagePercent)>=95?"critical":s>=80?"warning":"normal":null,c=eu?.nodes.find(t=>t.id===e.id)?.systemUpdates??null,o=ex?.nodes.find(t=>t.id===e.id)?.tailscale??null;return(0,t.jsxs)("tr",{className:"group/row relative transition-colors hover:bg-primary/[0.03] [&>td:first-child]:shadow-[inset_2px_0_0_transparent] hover:[&>td:first-child]:shadow-[inset_2px_0_0_var(--color-primary)]",children:[(0,t.jsx)("td",{className:"py-3 pl-2 pr-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(M.f,{status:e.status,size:"xs"}),"ONLINE"===e.status&&(0,t.jsx)("button",{onClick:()=>ed(e),title:`Open terminal on ${e.name}`,className:"flex h-6 w-6 items-center justify-center rounded border border-border/50 text-text-muted hover:text-primary hover:border-primary/40 transition-colors",children:(0,t.jsx)(j.f,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(C.default,{href:`/nodes/${e.id}`,className:"font-medium text-primary hover:text-primary-hover transition-colors",children:e.name})]})}),(0,t.jsx)("td",{className:"py-3 pr-4 text-text-muted",children:e.hostname}),(0,t.jsxs)("td",{className:"py-3 pr-4 text-text-muted",children:[e.ipAddress,":",e.port]}),(0,t.jsx)("td",{className:"py-3 pr-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(r.t,{variant:(0,r.k)(e.status),children:e.status}),("DEGRADED"===e.status||e.agent?.status==="ERROR")&&er(e.metadata)&&(0,t.jsx)("span",{title:`${er(e.metadata).label}: ${er(e.metadata).message}`,children:(0,t.jsx)(h.f,{className:"h-3.5 w-3.5 text-danger cursor-help"})}),"PROVISIONING"===e.status&&(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 text-info animate-spin"}),(0,t.jsx)(ea.x,{readiness:e.upgradeReadiness})]})}),(0,t.jsx)("td",{className:"py-3 pr-4 text-text-muted",children:(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[e.agent?`v${e.agent.version}`:"—",e.agent?.status==="UPDATING"&&(0,t.jsx)(p.f,{className:"h-3 w-3 text-info animate-spin"})]})}),(0,t.jsx)("td",{className:"py-3 pr-4",children:e.role?(0,t.jsxs)("button",{className:"inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/5 px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider text-primary hover:bg-primary/10 hover:border-primary/50 transition-all cursor-pointer",onClick:()=>Z(e),title:"Change role",children:[(0,t.jsx)(f.f,{className:"h-3 w-3"}),e.role.name]}):(0,t.jsx)("button",{className:"text-[10px] text-text-muted hover:text-primary transition-colors cursor-pointer uppercase tracking-wider",onClick:()=>Z(e),children:"+ Assign"})}),(0,t.jsx)("td",{className:"py-3 pr-4 text-text-muted",children:a?(0,t.jsx)(L.f,{value:a.cpuUsagePercent,label:`${e.name} CPU`,valueLabel:`${a.cpuUsagePercent.toFixed(1)}%`,showValue:!0,className:"w-28"}):"—"}),(0,t.jsx)("td",{className:"py-3 pr-4 text-text-muted",children:a?(0,t.jsxs)("div",{className:"w-36",children:[(0,t.jsx)(L.f,{value:a.memoryPercent,label:`${e.name} memory`,showValue:!0}),(0,t.jsxs)("span",{className:"num mt-0.5 block text-[10px] text-text-muted/80",children:[(a.memoryUsedBytes/0x40000000).toFixed(1)," / ",(a.memoryTotalBytes/0x40000000).toFixed(1)," GB"]})]}):"—"}),(0,t.jsx)("td",{className:"py-3 pr-4",children:l?(0,t.jsxs)("span",{className:"flex w-36 flex-col gap-0.5",title:`${l.mountPoint} filesystem is ${l.usagePercent}% used${"normal"===d?"":" — disk usage anomaly"}`,children:[(0,t.jsx)(L.f,{value:l.usagePercent,tone:"critical"===d?"danger":"warning"===d?"warning":"success",label:`${e.name} ${l.mountPoint} disk`,valueLabel:`${l.usagePercent.toFixed(0)}%`,glow:"normal"!==d,showValue:!0}),(0,t.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-text-muted",children:["normal"!==d&&(0,t.jsx)(g.f,{"aria-label":`${d} disk usage anomaly`,className:"critical"===d?"h-3 w-3 text-danger":"h-3 w-3 text-warning"}),l.mountPoint]})]}):(0,t.jsx)("span",{className:"text-text-muted",children:"—"})}),(0,t.jsx)("td",{className:"py-3 pr-4",children:c?c.rebootRequired?(0,t.jsx)(r.t,{variant:"danger",children:"reboot required"}):"enabled"===c.automaticUpdates?(0,t.jsx)(r.t,{variant:"success",children:"automatic"}):"unsupported"===c.automaticUpdates?(0,t.jsx)(r.t,{variant:"default",children:"unsupported"}):(0,t.jsx)(r.t,{variant:"warning",children:"enable updates"}):(0,t.jsx)(r.t,{variant:"default",children:"awaiting agent"})}),(0,t.jsx)("td",{className:"py-3 pr-4",title:o?.keyExpiry?`Expires ${o.keyExpiry}`:void 0,children:o?o.expiryEnabled?o.expired?(0,t.jsx)(r.t,{variant:"danger",children:"expired"}):null===o.daysRemaining?(0,t.jsx)(r.t,{variant:"default",children:"unknown"}):o.requiresRenewal?(0,t.jsxs)(r.t,{variant:"warning",children:[o.daysRemaining,"d"]}):(0,t.jsxs)(r.t,{variant:"success",children:[o.daysRemaining,"d"]}):(0,t.jsx)(r.t,{variant:"success",children:"no expiry"}):(0,t.jsx)(r.t,{variant:"default",children:"awaiting agent"})}),(0,t.jsx)("td",{className:"num py-3 pr-4 text-text-muted",children:(0,i.C)(e.lastHeartbeatAt)}),(0,t.jsx)("td",{className:"py-3",children:(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)(C.default,{href:`/nodes/${e.id}`,children:(0,t.jsx)(n.K,{variant:"ghost",size:"sm",children:"View"})}),(0,t.jsx)(n.K,{variant:"ghost",size:"sm",onClick:()=>Q(e),children:(0,t.jsx)(u.f,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(n.K,{variant:"ghost",size:"sm",onClick:()=>void ey(e),children:(0,t.jsx)(m.f,{className:"h-3.5 w-3.5 text-danger"})})]})})]},e.id)})})]})})})}),(0,t.jsx)(D.z,{children:(0,t.jsxs)(a.N,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(x.f,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider",children:"Network Discovery"}),(0,t.jsx)("span",{className:"text-[11px] text-text-muted",children:"— Unadopted agents found on the local network"})]}),(0,t.jsx)(n.K,{variant:"secondary",size:"sm",icon:ee?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(x.f,{className:"h-3.5 w-3.5"}),onClick:()=>void eN(),disabled:ee,children:ee?"Scanning…":"Scan Network"})]}),0===en.length?ee?(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,t.jsxs)("div",{className:"relative h-16 w-16 overflow-hidden rounded-full border border-primary/30 shadow-[0_0_16px_var(--color-glow)]",children:[(0,t.jsx)("div",{className:"absolute inset-0 animate-sweep rounded-full bg-[conic-gradient(from_0deg,transparent_0deg,transparent_280deg,var(--color-primary)_360deg)] opacity-60"}),(0,t.jsx)("div",{className:"absolute inset-[30%] rounded-full border border-primary/20"})]}),(0,t.jsx)("p",{className:"text-[11px] uppercase tracking-wider text-primary",children:"Broadcasting discovery probe…"})]}):(0,t.jsx)(G.f,{compact:!0,icon:(0,t.jsx)(x.f,{className:"h-4 w-4"}),title:"No scan results yet",description:'Click "Scan Network" to discover unadopted agents on your network.'}):(E=en.filter(e=>!e.registered),z=en.filter(e=>e.registered),0===E.length?(0,t.jsxs)("div",{className:"py-6 text-center text-[11px] text-text-muted",children:["All ",z.length," discovered agent",1!==z.length?"s":""," already registered. No new nodes to adopt."]}):(0,t.jsxs)("div",{className:"overflow-x-auto",children:[(0,t.jsxs)("table",{className:"w-full text-[11px]",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b border-primary/20 text-left text-[10px] font-bold uppercase tracking-[0.15em] text-text-muted",children:[(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Hostname"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"IP Address"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Port"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Agent Version"}),(0,t.jsx)("th",{className:"pb-3",children:"Registration"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border/50",children:E.map(e=>(0,t.jsxs)("tr",{className:"hover:bg-surface-hover transition-colors",children:[(0,t.jsx)("td",{className:"py-3 pr-4 font-medium",children:e.fqdn||e.hostname}),(0,t.jsx)("td",{className:"py-3 pr-4 text-text-muted",children:e.ip}),(0,t.jsx)("td",{className:"py-3 pr-4 text-text-muted",children:e.port}),(0,t.jsxs)("td",{className:"py-3 pr-4 text-text-muted",children:["v",e.version]}),(0,t.jsx)("td",{className:"py-3 text-text-muted",children:"Use the reviewed key-only agent deploy runbook, then register the authenticated heartbeat."})]},`${e.ip}:${e.port}`))})]}),z.length>0&&(0,t.jsxs)("p",{className:"mt-3 text-xs text-text-muted",children:[z.length," already-registered agent",1!==z.length?"s":""," ","hidden from this list."]})]}))]})}),(0,t.jsx)(es,{open:J,onClose:()=>W(!1),onFinished:()=>void eb()}),(0,t.jsx)(S.M,{open:T,onClose:()=>F(!1),onRegistered:()=>void eb()}),(0,t.jsx)(S.F,{open:!!Y,node:Y,onClose:()=>Q(null),onSaved:()=>void eb()}),(0,t.jsx)(S.E,{open:!!X,node:X,onClose:()=>Z(null),onSaved:e=>{X&&(eg.current[X.id]=e,$(t=>t.map(t=>t.id===X.id?{...t,role:e}:t))),eb()}}),(0,t.jsx)(B,{open:!!el,onClose:()=>ed(null),node:el})]})}],86421)}]);
|
|
15
|
+
`),x("error");return}if(t||o.current)return;x("connected");let v=new AbortController;u.current=v,(async()=>{try{let e=await fetch(`/api/terminal/stream?sessionId=${encodeURIComponent(s)}`,{signal:v.signal});if(!e.ok||!e.body){t||o.current||(m.write("\r\n\x1b[31mFailed to connect output stream\x1b[0m\r\n"),x("error"));return}let a=e.body.getReader();for(;;){let{done:e,value:s}=await a.read();if(e||t||o.current)break;s&&m.write(s)}}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return}t||o.current||(x("closed"),m.write("\r\n\x1b[38;2;138;138;171m── Session ended ──\x1b[0m\r\n"))})(),m.onData(e=>{!o.current&&c.current&&(p.current+=e,h.current||(h.current=setTimeout(g,16)))}),m.onResize(({cols:e,rows:t})=>{!o.current&&c.current&&fetch("/api/terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:c.current,cols:e,rows:t})}).catch(()=>{})})})();let s=()=>{d.current&&!o.current&&d.current.fit()};return window.addEventListener("resize",s),()=>{t=!0,window.removeEventListener("resize",s),f()}},[a,n,f,g]);let b=(0,s.useCallback)(()=>{f(),r()},[f,r]);return n?(0,t.jsx)(F.n,{open:a,onClose:b,title:`Terminal: ${n.name}`,description:"Interactive SSH session",icon:(0,t.jsx)(j.f,{className:"h-5 w-5 text-primary"}),className:"max-w-5xl",children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("div",{className:"absolute top-0 right-0 z-10 flex items-center gap-1.5 px-2 py-1",children:[(0,t.jsx)("div",{className:`h-1.5 w-1.5 rounded-full ${"connected"===m?"bg-success":"connecting"===m?"bg-warning animate-pulse":"error"===m?"bg-danger":"bg-text-muted"}`}),(0,t.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:m})]}),(0,t.jsx)("div",{ref:i,className:"h-[65vh] w-full rounded border border-border/50 bg-[#06060d] p-1 overflow-hidden"})]})}):null}var D=e.i(63376),q=e.i(67683),V=e.i(73404),L=e.i(51196),M=e.i(75723),G=e.i(2067),H=e.i(65369),J=e.i(51757);let W={name:"clipboard-check",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]};W.node;let Y=(0,I.f)(W),Q={name:"octagon-x",size:24,node:[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],aliases:["x-octagon"]};Q.node;let X=(0,I.f)(Q);var Z=e.i(83967),ee=e.i(63646);let et={pending:{label:"Queued",variant:"default"},requested:{label:"Installing",variant:"info"},watching:{label:"Watching",variant:"info"},ambiguous:{label:"Unknown",variant:"warning"},confirmed:{label:"Upgraded",variant:"success"},reverted:{label:"Reverted",variant:"danger"},failed:{label:"Failed",variant:"danger"},refused:{label:"Refused",variant:"warning"},skipped:{label:"Skipped",variant:"default"}};function es({open:e,onClose:a,onFinished:i}){let[d,c]=(0,s.useState)(null),[o,u]=(0,s.useState)(new Set),[m,x]=(0,s.useState)(null),[h,f]=(0,s.useState)(null),[j,b]=(0,s.useState)(!1),[y,N]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1),[C,S]=(0,s.useState)(""),R=async e=>f(await (0,ee.s)(e)),E=(0,s.useCallback)(async()=>{f(null);try{let e=await l.f.agentUpgrades.eligibility();c(e),u(new Set(e.nodes.filter(e=>e.eligible).map(e=>e.nodeId))),x(e.latestRun??null)}catch(e){f(await (0,ee.s)(e))}},[]);(0,s.useEffect)(()=>{e&&(x(null),N(null),E())},[e,E]),(0,s.useEffect)(()=>{if(!m||"running"!==m.status)return;let e=window.setInterval(()=>{l.f.agentUpgrades.run(m.id).then(e=>{x(e),"running"!==e.status&&i?.()}).catch(async t=>{window.clearInterval(e),f((0,ee.c)(t)?`Upgrade run ${m.id} is no longer known to the server`:await (0,ee.s)(t)),(0,ee.c)(t)&&x(null)})},5e3);return()=>window.clearInterval(e)},[m,i]);let U=(0,s.useMemo)(()=>d?.nodes.filter(e=>e.eligible).length??0,[d]),I=d?.nodes.filter(e=>"MAJOR_VERSION"===e.code).length??0,$=d&&(!m||"running"!==m.status),A=async e=>{b(!0),f(null);try{x(await e())}catch(e){await R(e)}finally{b(!1)}},P=/^[1-9][0-9]{0,2}$/.test(C)?{maxFailures:Number(C)}:{},O=async()=>{k(!0),f(null);try{N(await l.f.agentUpgrades.check({version:d?.version,...o.size?{nodeIds:[...o]}:{}}))}catch(e){await R(e)}finally{k(!1)}},_=(e=!1)=>m&&A(()=>l.f.agentUpgrades.retry(m.id,e?{acknowledgeSuspicion:e}:{}));return(0,t.jsx)(F.n,{open:e,onClose:a,title:"Upgrade agents",icon:(0,t.jsx)(v.f,{className:"h-4 w-4"}),description:d?(0,ee.Q)(d):void 0,className:"max-h-[calc(100dvh-1.5rem)] max-w-4xl overflow-y-auto",children:(0,t.jsxs)("div",{className:"space-y-4 text-[11px]",children:[h&&(0,t.jsx)("div",{className:"rounded border border-danger/40 bg-danger/10 px-3 py-2 text-danger","data-testid":"agent-upgrade-error",children:h}),d&&!d.upgradesEnabled&&(0,t.jsxs)("div",{className:"rounded border border-warning/40 bg-warning/10 px-3 py-2 text-warning",children:["Agent upgrades are off: ",d.disabledReason]}),!d&&!h&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,t.jsx)(p.f,{className:"h-4 w-4 animate-spin"})," Checking agents…"]}),m&&(0,t.jsxs)("div",{className:"space-y-2","data-testid":"agent-upgrade-run",children:[(0,t.jsxs)("p",{className:"flex flex-wrap items-center gap-2",children:["running"===m.status&&(0,t.jsx)(p.f,{className:"h-4 w-4 animate-spin text-primary"}),"succeeded"===m.status&&(0,t.jsx)(J.f,{className:"h-4 w-4 text-success"}),"partial"===m.status&&(0,t.jsx)(g.f,{className:"h-4 w-4 text-warning"}),("failed"===m.status||"interrupted"===m.status)&&(0,t.jsx)(Z.f,{className:"h-4 w-4 text-danger"}),"stopped"===m.status&&(0,t.jsx)(X,{className:"h-4 w-4 text-warning"}),(0,t.jsx)("span",{className:"font-bold uppercase tracking-wider",children:"running"===m.status?`Upgrading to ${m.version}${m.stopRequestedBy?" (stopping after the nodes in progress)":""}`:(0,ee.P)(m)})]}),"running"!==m.status&&m.message&&(0,t.jsx)("p",{className:"text-text-muted","data-testid":"agent-upgrade-run-message",children:m.message}),(m.warnings??[]).map(e=>(0,t.jsxs)("p",{className:"text-warning","data-testid":"agent-upgrade-warning",children:[e.name,": ",e.detail]},`${e.nodeId}-${e.code}`)),(0,t.jsxs)("details",{open:"running"===m.status,className:"group",children:[(0,t.jsxs)("summary",{className:"cursor-pointer text-text-muted",children:["running"===m.status?"Current rollout":"Previous rollout"," to ",m.version," · ",m.nodes.length," agent",1===m.nodes.length?"":"s"]}),(0,t.jsxs)("ul",{className:"mt-2 max-h-80 divide-y divide-border/40 overflow-y-auto rounded border border-border",children:[m.nodes.map(e=>(0,t.jsxs)("li",{className:"flex flex-wrap items-center gap-3 px-3 py-2",children:[(0,t.jsxs)("span",{className:"w-40 truncate font-medium text-text",children:[e.name,e.nodeId===(m.canaryNodeId??m.nodes[0]?.nodeId)?" (canary)":""]}),(0,t.jsxs)("span",{className:"num shrink-0 text-text-muted",children:[e.from," → ",m.version]}),(0,t.jsxs)(r.t,{variant:et[e.state]?.variant??"default",children:["requested"===e.state&&(0,t.jsx)(p.f,{className:"mr-1 inline h-3 w-3 animate-spin"}),"reverted"===e.state&&(0,t.jsx)(z.f,{className:"mr-1 inline h-3 w-3"}),et[e.state]?.label??e.state]}),(e.attempts??1)>1&&(0,t.jsxs)("span",{className:"num text-text-muted",children:["try ",e.attempts]}),(0,ee.b)(e)&&(0,t.jsx)("span",{className:"w-full break-words text-text-muted",children:(0,ee.b)(e)})]},e.nodeId)),(m.excluded??[]).map(e=>(0,t.jsxs)("li",{className:"flex flex-wrap items-center gap-3 px-3 py-2 text-text-muted",title:e.reason,children:[(0,t.jsx)("span",{className:"w-40 truncate font-medium text-text",children:e.name}),(0,t.jsx)(r.t,{variant:"default",children:"Not included"}),(0,t.jsx)("span",{className:"w-full break-words text-text-muted",children:e.reason})]},`excluded-${e.nodeId}`))]})]}),"running"!==m.status&&(m.attention?.length??0)>0&&(0,t.jsxs)("div",{className:"space-y-2 rounded border border-warning/40 bg-warning/10 px-3 py-2","data-testid":"agent-upgrade-attention",children:[(0,t.jsx)("p",{className:"font-bold uppercase tracking-wider text-warning",children:"Needs attention"}),(0,t.jsx)("ul",{className:"max-h-48 space-y-2 overflow-y-auto",children:m.attention.map(e=>(0,t.jsxs)("li",{children:[(0,t.jsxs)("p",{className:"font-medium text-text",children:[e.name,": ",(0,t.jsx)("span",{className:"num",children:e.code}),"release"===e.failureClass?" (points at the release)":"",e.unknownCode?" (unrecognised code)":""]}),e.detail&&(0,t.jsx)("p",{className:"text-text-muted",children:e.detail}),(0,t.jsx)("p",{className:"text-text",children:e.remedy})]},`${e.nodeId}-${e.code}`))})]})]}),y&&(0,t.jsxs)("div",{className:"space-y-2","data-testid":"agent-upgrade-check",children:[(0,t.jsxs)("p",{className:"font-bold uppercase tracking-wider",children:["Check: ",y.eligible," ready, ",y.blocked," blocked",y.release.verified?"":`; target not verified: ${y.release.reason??"unknown"}`]}),(0,t.jsx)("ul",{className:"max-h-64 divide-y divide-border/40 overflow-y-auto rounded border border-border",children:y.nodes.map(e=>(0,t.jsxs)("li",{className:"space-y-1 px-3 py-2",children:[(0,t.jsxs)("p",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"w-40 truncate font-medium text-text",children:e.name}),(0,t.jsx)(r.t,{variant:e.eligible?"success":e.preflight?.status==="blocked"?"danger":"default",children:e.eligible?"Ready":e.code??"Not eligible"}),(0,t.jsxs)("span",{className:"text-text-muted",children:["preflight ",e.preflight?.status??"not run"]})]}),!e.eligible&&e.reason&&(0,t.jsx)("p",{className:"text-text-muted",children:e.reason}),!e.eligible&&e.remedy&&(0,t.jsx)("p",{className:"text-text",children:e.remedy}),e.preflight?.problems.filter(t=>t.code!==e.code).map(e=>(0,t.jsxs)("p",{className:"text-text-muted",children:[(0,t.jsx)("span",{className:"num",children:e.code}),": ",e.detail,". ",(0,ee.V)(e.code)]},`${e.code}-${e.detail}`))]},e.nodeId))})]}),$&&(0,t.jsxs)("section",{className:"space-y-2","aria-label":"Current upgrade eligibility",children:[(0,t.jsxs)("p",{className:"font-bold uppercase tracking-wider",children:["Target ",d.version,": ",U," ready, ",d.nodes.length-U," unavailable"]}),I>0&&(0,t.jsxs)("div",{className:"space-y-1 rounded border border-warning/40 bg-warning/10 px-3 py-2 text-warning","data-testid":"agent-upgrade-major-notice",children:[(0,t.jsxs)("p",{children:[I," agent",1===I?" requires":"s require"," a manual major-version upgrade to ",d.version,". This dialog only upgrades agents within their current major version."]}),(0,t.jsxs)("p",{children:["Read the ",(0,t.jsx)("a",{href:"https://github.com/ChefTaco/magnus/blob/main/docs/NODE_CREDENTIALS.md#moving-agents-across-a-major-version",target:"_blank",rel:"noreferrer",className:"underline",children:"cross-major procedure"}),": from the server host, ",(0,t.jsxs)("code",{children:["magnus-server agents upgrade --to ",d.version," --allow-major"]})," moves keyed agents of 2.10.3 or later with a server-signed authorization; older agents take 2.10.3 first. A successful rollout to an older version does not complete this upgrade."]})]}),0===U&&(0,t.jsx)("p",{className:"text-text-muted","data-testid":"agent-upgrade-empty",children:"No agents can be upgraded from this dialog right now. Review the reasons below; Check refreshes the readiness report."}),(0,t.jsxs)("ul",{className:"max-h-80 divide-y divide-border/40 overflow-y-auto rounded border border-border","data-testid":"agent-upgrade-candidates",children:[d.nodes.map(e=>(0,t.jsx)("li",{className:"px-3 py-2",children:(0,t.jsxs)("label",{className:"flex items-start gap-3",children:[(0,t.jsx)("input",{type:"checkbox",className:"mt-0.5 shrink-0","aria-label":`Upgrade ${e.name}`,checked:o.has(e.nodeId),disabled:!e.eligible||!d.upgradesEnabled,onChange:()=>{let t;return t=e.nodeId,u(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})}}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-1",children:[(0,t.jsxs)("span",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,t.jsx)("span",{className:"break-words font-medium text-text",children:e.name}),(0,t.jsxs)("span",{className:"num text-text-muted",children:[e.version,e.eligible?` → ${d.version}`:""]}),e.preflight&&"ok"!==e.preflight.status&&(0,t.jsxs)(r.t,{variant:"blocked"===e.preflight.status?"danger":"default",children:["preflight ",e.preflight.status]})]}),!e.eligible&&(0,t.jsx)("span",{className:"block break-words text-text-muted",children:e.reason})]})]})},e.nodeId)),0===d.nodes.length&&(0,t.jsx)("li",{className:"px-3 py-2 text-text-muted",children:"No nodes registered."})]})]}),(0,t.jsxs)("div",{className:"space-y-3 border-t border-border pt-3",children:[(0,t.jsx)("p",{className:"text-text-muted",children:"The first agent is a canary. Each agent switches back by itself if the new version does not report a heartbeat in time. Only evidence about the release stops the run: a failure on the canary, an integrity mismatch, or too many reverts. A problem of one node is recorded and the run goes on."}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-3",children:[$&&U>0&&(0,t.jsxs)("label",{className:"flex shrink-0 items-center gap-1 text-text-muted",title:"Reverts or failed installs that stop the run after its canary. Empty: the server's setting.",children:["Stop after",(0,t.jsx)("input",{className:"w-12 rounded border border-border bg-transparent px-1 py-0.5 text-text",inputMode:"numeric","aria-label":"Release failures that stop the run",value:C,onChange:e=>S(e.target.value),"data-testid":"agent-upgrade-max-failures"}),"failures"]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(n.K,{variant:"secondary",size:"sm",onClick:a,children:"Close"}),m?.status==="running"&&(0,t.jsx)(n.K,{variant:"danger",size:"sm",onClick:()=>void(m&&A(()=>l.f.agentUpgrades.stop(m.id))),"data-testid":"agent-upgrade-stop",disabled:j||!!m.stopRequestedBy,icon:(0,t.jsx)(X,{className:"h-3.5 w-3.5"}),children:"Stop"}),(0,ee.v)(m)&&d?.upgradesEnabled&&(0,t.jsxs)(n.K,{variant:"secondary",size:"sm",onClick:()=>void _(),"data-testid":"agent-upgrade-retry",disabled:j,icon:(0,t.jsx)(z.f,{className:"h-3.5 w-3.5"}),children:["Retry ",(0,ee.w)(m)," node",1===(0,ee.w)(m)?"":"s"]}),(0,ee.v)(m)&&d?.upgradesEnabled&&(m?.suspectedRelease||m?.excluded?.some(e=>"RETRY_HELD_SUSPECTED"===e.code))&&(0,t.jsx)(n.K,{variant:"danger",size:"sm",onClick:()=>void _(!0),"data-testid":"agent-upgrade-retry-acknowledged",disabled:j,title:"Each attempt on an older agent can strand another lease. Read the agent log first.",icon:(0,t.jsx)(z.f,{className:"h-3.5 w-3.5"}),children:"Retry older agents too"}),$&&(0,t.jsx)(n.K,{variant:"secondary",size:"sm",onClick:()=>void O(),"data-testid":"agent-upgrade-check-button",disabled:j||w,icon:w?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(Y,{className:"h-3.5 w-3.5"}),children:"Check"}),$&&(0,t.jsxs)(n.K,{variant:"primary",size:"sm",onClick:()=>void A(()=>l.f.agentUpgrades.start({nodeIds:[...o],version:d?.version,...d?.prerelease?{allowPrerelease:!0}:{},...P})),"data-testid":"agent-upgrade-start",disabled:j||0===o.size||!d?.upgradesEnabled,icon:j?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(v.f,{className:"h-3.5 w-3.5"}),children:["Upgrade ",o.size," agent",1===o.size?"":"s"]})]})]})]})]})})}var ea=e.i(53721);function er(e){try{let t=JSON.parse(e);if("string"==typeof t.deployError)return{label:"Deploy failed",message:t.deployError};if("string"==typeof t.upgradeError)return{label:"Upgrade failed",message:t.upgradeError};return null}catch{return null}}e.s(["default",0,function({initialNodes:e,initialTailscaleSummary:R}){let E,z,{activeNode:U}=(0,d.l)(),[I,$]=(0,s.useState)(e),[A,P]=(0,s.useState)((!!e.length||void 0===e)&&!1),[O,_]=(0,s.useState)(null),[T,F]=(0,s.useState)(!1),[J,W]=(0,s.useState)(!1);(0,s.useEffect)(()=>{"agents"===new URLSearchParams(window.location.search).get("upgrade")&&W(!0)},[]);let[Y,Q]=(0,s.useState)(null),[X,Z]=(0,s.useState)(null),[ee,et]=(0,s.useState)(!1),[en,ei]=(0,s.useState)([]),[el,ed]=(0,s.useState)(null),[ec,eo]=(0,s.useState)({}),[eu,em]=(0,s.useState)(null),[ex,ep]=(0,s.useState)(R),eh=(0,s.useRef)(null),eg=(0,s.useRef)({}),[ef,ej]=(0,s.useState)(e.length>0),eb=(0,s.useCallback)(async(e=!1)=>{try{e||P(!0),_(null);let[t,s,a]=await Promise.all([l.f.nodes.list(),l.f.nodes.systemUpdatesSummary().catch(()=>null),l.f.nodes.tailscaleSummary().catch(()=>null)]),r=t.data.map(e=>{if(e.role)return delete eg.current[e.id],e;let t=eg.current[e.id];return void 0!==t?{...e,role:t}:e});$(r),em(s?.data??null),ep(a?.data??null);let n=await Promise.all(r.map(async e=>{try{let t=await l.f.nodes.health(e.id);return[e.id,t.data]}catch{return[e.id,null]}}));eo(Object.fromEntries(n.filter(e=>null!==e[1])))}catch(a){let t=a instanceof Error?a.message:String(a),s="Failed to fetch"===t||t.includes("TypeError")||t.includes("NetworkError")||t.includes("ECONNREFUSED")||t.includes("timeout");e||_(s?`Control node unreachable (${U.name})`:t)}finally{e||P(!1)}},[U.name]);(0,s.useEffect)(()=>{if(ef){ej(!1),(async()=>{e.length>0&&eo(Object.fromEntries((await Promise.all(e.map(async e=>{try{let t=await l.f.nodes.health(e.id);return[e.id,t.data]}catch{return[e.id,null]}}))).filter(e=>null!==e[1])));try{let e=await l.f.nodes.systemUpdatesSummary();em(e.data)}catch{em(null)}try{let e=await l.f.nodes.tailscaleSummary();ep(e.data??null)}catch{ep(null)}})();return}$([]),_(null),ei([]),eo({}),em(null),ep(null),eg.current={},eb()},[U.id]),(0,s.useEffect)(()=>{let e=I.some(e=>"PROVISIONING"===e.status||e.agent?.status==="UPDATING");return e&&!eh.current?eh.current=setInterval(()=>{eb(!0)},4e3):!e&&eh.current&&(clearInterval(eh.current),eh.current=null),()=>{eh.current&&(clearInterval(eh.current),eh.current=null)}},[I,eb]);let ey=async e=>{if(confirm(`Delete node "${e.name}"? This will permanently remove it and all associated data.`))try{await l.f.nodes.delete(e.id),eb()}catch{}},eN=async()=>{et(!0),ei([]);try{let e=await l.f.discovery.scan(5e3);e.success&&Array.isArray(e.data)&&ei(e.data)}catch{}finally{et(!1)}};return(0,t.jsxs)(D.U,{className:"space-y-6",children:[(0,t.jsx)(D.z,{children:(0,t.jsx)(V.f,{title:"Nodes",eyebrow:"Fleet",description:"Manage your Magnus fleet nodes",status:I.length>0?(0,t.jsxs)("span",{className:"flex items-center gap-3 text-[10px] uppercase tracking-wider text-text-muted",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(M.f,{status:"ONLINE",size:"xs"}),(0,t.jsx)("span",{className:"num",children:I.filter(e=>"ONLINE"===e.status).length})," online"]}),(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(M.f,{status:"OFFLINE",size:"xs",pulse:!1}),(0,t.jsx)("span",{className:"num",children:I.filter(e=>"OFFLINE"===e.status).length})," offline"]})]}):void 0,actions:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.K,{variant:"secondary",size:"sm",icon:(0,t.jsx)(o.f,{className:"h-3.5 w-3.5"}),onClick:()=>void eb(),children:"Refresh"}),(0,t.jsx)(n.K,{variant:"secondary",size:"sm",icon:(0,t.jsx)(v.f,{className:"h-3.5 w-3.5"}),onClick:()=>W(!0),"data-testid":"open-agent-upgrade",children:"Upgrade Agents"}),(0,t.jsx)(n.K,{variant:"secondary",size:"sm",icon:(0,t.jsx)(c.f,{className:"h-3.5 w-3.5"}),onClick:()=>F(!0),children:"Register Node"})]})})}),(0,t.jsx)(D.z,{children:(0,t.jsx)(K,{})}),ex&&(0,t.jsx)(D.z,{children:(0,t.jsx)(q.f,{summary:ex,showAction:!1})}),eu&&(0,t.jsx)(D.z,{children:(0,t.jsx)("section",{className:"panel-corners overflow-hidden rounded-panel border border-border bg-surface","aria-label":"System update readiness",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-y divide-border/60 sm:grid-cols-4 sm:divide-y-0",children:[(0,t.jsxs)("div",{className:"col-span-2 flex items-center gap-3 px-4 py-3 sm:col-span-1",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-panel border border-primary/30 bg-primary/10 text-primary shadow-[0_0_10px_var(--color-glow)]",children:(0,t.jsx)(b.f,{className:"h-4 w-4"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-[0.16em] text-text-muted",children:"Auto-update coverage"}),(0,t.jsxs)("p",{className:"num mt-0.5 text-sm font-semibold",children:[eu.enabled," / ",eu.reporting," enabled"]}),(0,t.jsx)(L.f,{className:"mt-1.5",value:eu.reporting>0?eu.enabled/eu.reporting*100:null,tone:eu.enabled===eu.reporting?"success":"warning",label:"Auto-update coverage"})]})]}),(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-[0.16em] text-text-muted",children:"Action needed"}),(0,t.jsx)("p",{className:`num mt-1 text-lg font-bold ${eu.actionNeeded?"text-warning glow-text-warning":"text-success"}`,children:eu.actionNeeded})]}),(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-[0.16em] text-text-muted",children:"Reboot debt"}),(0,t.jsxs)("p",{className:`num mt-1 flex items-center gap-1.5 text-lg font-bold ${eu.rebootRequired?"text-danger glow-text-danger":"text-success"}`,children:[eu.rebootRequired?(0,t.jsx)(y.f,{className:"h-4 w-4"}):null,eu.rebootRequired]})]}),(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-[0.16em] text-text-muted",children:"Reporting"}),(0,t.jsxs)("p",{className:"num mt-1 text-lg font-bold",children:[eu.reporting," / ",eu.total]})]})]})})}),(0,t.jsx)(D.z,{children:(0,t.jsx)(a.N,{children:O?O.startsWith("Control node unreachable")?(0,t.jsx)(G.f,{tone:"warning",icon:(0,t.jsx)(x.f,{className:"h-5 w-5"}),title:O,description:"Cannot connect to this Control Node. Verify it is running and reachable.",action:(0,t.jsx)(n.K,{variant:"secondary",size:"sm",onClick:()=>void eb(),children:"Retry"})}):(0,t.jsx)(G.f,{tone:"danger",icon:(0,t.jsx)(h.f,{className:"h-5 w-5"}),title:"Error loading nodes",description:O,action:(0,t.jsx)(n.K,{variant:"secondary",size:"sm",onClick:()=>void eb(),children:"Retry"})}):A?(0,t.jsx)(H.F,{rows:6,cols:9,className:"border-0"}):0===I.length?(0,t.jsx)(G.f,{tone:"primary",icon:(0,t.jsx)(N.f,{className:"h-5 w-5"}),title:"No nodes registered",description:"Register your first Magnus node to get started.",action:(0,t.jsx)(n.K,{size:"sm",icon:(0,t.jsx)(c.f,{className:"h-3.5 w-3.5"}),onClick:()=>F(!0),children:"Register Node"})}):(0,t.jsx)("div",{className:"max-h-[70vh] overflow-auto",children:(0,t.jsxs)("table",{className:"w-full text-[11px]",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"sticky top-0 z-10 border-b border-primary/30 bg-surface/95 text-left text-[10px] font-bold uppercase tracking-[0.15em] text-text-muted shadow-[0_1px_0_var(--color-primary),0_4px_12px_-6px_var(--color-glow)] backdrop-blur-sm",children:[(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Name"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Host"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Address"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Status"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Agent"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Role"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"CPU"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Memory"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Persistent Disk"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Updates"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Tailscale key"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Last Heartbeat"}),(0,t.jsx)("th",{className:"pb-3",children:"Actions"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border/50",children:I.map(e=>{var s;let a=ec[e.id],l=(function(e){if(Array.isArray(e))return e;if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}})(a?.disks).filter(e=>"/"===e.mountPoint||"/home"===e.mountPoint||e.mountPoint.startsWith("/home/")||e.mountPoint.startsWith("/mnt/")||e.mountPoint.startsWith("/srv/")).filter(e=>!w.some(t=>e.mountPoint===t||e.mountPoint.startsWith(t))).filter(e=>!k.has((e.filesystemType??"").toLowerCase())).sort((e,t)=>t.usagePercent-e.usagePercent)[0]??null,d=l?(s=l.usagePercent)>=95?"critical":s>=80?"warning":"normal":null,c=eu?.nodes.find(t=>t.id===e.id)?.systemUpdates??null,o=ex?.nodes.find(t=>t.id===e.id)?.tailscale??null;return(0,t.jsxs)("tr",{className:"group/row relative transition-colors hover:bg-primary/[0.03] [&>td:first-child]:shadow-[inset_2px_0_0_transparent] hover:[&>td:first-child]:shadow-[inset_2px_0_0_var(--color-primary)]",children:[(0,t.jsx)("td",{className:"py-3 pl-2 pr-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(M.f,{status:e.status,size:"xs"}),"ONLINE"===e.status&&(0,t.jsx)("button",{onClick:()=>ed(e),title:`Open terminal on ${e.name}`,className:"flex h-6 w-6 items-center justify-center rounded border border-border/50 text-text-muted hover:text-primary hover:border-primary/40 transition-colors",children:(0,t.jsx)(j.f,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(C.default,{href:`/nodes/${e.id}`,className:"font-medium text-primary hover:text-primary-hover transition-colors",children:e.name})]})}),(0,t.jsx)("td",{className:"py-3 pr-4 text-text-muted",children:e.hostname}),(0,t.jsxs)("td",{className:"py-3 pr-4 text-text-muted",children:[e.ipAddress,":",e.port]}),(0,t.jsx)("td",{className:"py-3 pr-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(r.t,{variant:(0,r.k)(e.status),children:e.status}),("DEGRADED"===e.status||e.agent?.status==="ERROR")&&er(e.metadata)&&(0,t.jsx)("span",{title:`${er(e.metadata).label}: ${er(e.metadata).message}`,children:(0,t.jsx)(h.f,{className:"h-3.5 w-3.5 text-danger cursor-help"})}),"PROVISIONING"===e.status&&(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 text-info animate-spin"}),(0,t.jsx)(ea.x,{readiness:e.upgradeReadiness})]})}),(0,t.jsx)("td",{className:"py-3 pr-4 text-text-muted",children:(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[e.agent?`v${e.agent.version}`:"—",e.agent?.status==="UPDATING"&&(0,t.jsx)(p.f,{className:"h-3 w-3 text-info animate-spin"})]})}),(0,t.jsx)("td",{className:"py-3 pr-4",children:e.role?(0,t.jsxs)("button",{className:"inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/5 px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider text-primary hover:bg-primary/10 hover:border-primary/50 transition-all cursor-pointer",onClick:()=>Z(e),title:"Change role",children:[(0,t.jsx)(f.f,{className:"h-3 w-3"}),e.role.name]}):(0,t.jsx)("button",{className:"text-[10px] text-text-muted hover:text-primary transition-colors cursor-pointer uppercase tracking-wider",onClick:()=>Z(e),children:"+ Assign"})}),(0,t.jsx)("td",{className:"py-3 pr-4 text-text-muted",children:a?(0,t.jsx)(L.f,{value:a.cpuUsagePercent,label:`${e.name} CPU`,valueLabel:`${a.cpuUsagePercent.toFixed(1)}%`,showValue:!0,className:"w-28"}):"—"}),(0,t.jsx)("td",{className:"py-3 pr-4 text-text-muted",children:a?(0,t.jsxs)("div",{className:"w-36",children:[(0,t.jsx)(L.f,{value:a.memoryPercent,label:`${e.name} memory`,showValue:!0}),(0,t.jsxs)("span",{className:"num mt-0.5 block text-[10px] text-text-muted/80",children:[(a.memoryUsedBytes/0x40000000).toFixed(1)," / ",(a.memoryTotalBytes/0x40000000).toFixed(1)," GB"]})]}):"—"}),(0,t.jsx)("td",{className:"py-3 pr-4",children:l?(0,t.jsxs)("span",{className:"flex w-36 flex-col gap-0.5",title:`${l.mountPoint} filesystem is ${l.usagePercent}% used${"normal"===d?"":" — disk usage anomaly"}`,children:[(0,t.jsx)(L.f,{value:l.usagePercent,tone:"critical"===d?"danger":"warning"===d?"warning":"success",label:`${e.name} ${l.mountPoint} disk`,valueLabel:`${l.usagePercent.toFixed(0)}%`,glow:"normal"!==d,showValue:!0}),(0,t.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-text-muted",children:["normal"!==d&&(0,t.jsx)(g.f,{"aria-label":`${d} disk usage anomaly`,className:"critical"===d?"h-3 w-3 text-danger":"h-3 w-3 text-warning"}),l.mountPoint]})]}):(0,t.jsx)("span",{className:"text-text-muted",children:"—"})}),(0,t.jsx)("td",{className:"py-3 pr-4",children:c?c.rebootRequired?(0,t.jsx)(r.t,{variant:"danger",children:"reboot required"}):"enabled"===c.automaticUpdates?(0,t.jsx)(r.t,{variant:"success",children:"automatic"}):"unsupported"===c.automaticUpdates?(0,t.jsx)(r.t,{variant:"default",children:"unsupported"}):(0,t.jsx)(r.t,{variant:"warning",children:"enable updates"}):(0,t.jsx)(r.t,{variant:"default",children:"awaiting agent"})}),(0,t.jsx)("td",{className:"py-3 pr-4",title:o?.keyExpiry?`Expires ${o.keyExpiry}`:void 0,children:o?o.expiryEnabled?o.expired?(0,t.jsx)(r.t,{variant:"danger",children:"expired"}):null===o.daysRemaining?(0,t.jsx)(r.t,{variant:"default",children:"unknown"}):o.requiresRenewal?(0,t.jsxs)(r.t,{variant:"warning",children:[o.daysRemaining,"d"]}):(0,t.jsxs)(r.t,{variant:"success",children:[o.daysRemaining,"d"]}):(0,t.jsx)(r.t,{variant:"success",children:"no expiry"}):(0,t.jsx)(r.t,{variant:"default",children:"awaiting agent"})}),(0,t.jsx)("td",{className:"num py-3 pr-4 text-text-muted",children:(0,i.C)(e.lastHeartbeatAt)}),(0,t.jsx)("td",{className:"py-3",children:(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)(C.default,{href:`/nodes/${e.id}`,children:(0,t.jsx)(n.K,{variant:"ghost",size:"sm",children:"View"})}),(0,t.jsx)(n.K,{variant:"ghost",size:"sm",onClick:()=>Q(e),children:(0,t.jsx)(u.f,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(n.K,{variant:"ghost",size:"sm",onClick:()=>void ey(e),children:(0,t.jsx)(m.f,{className:"h-3.5 w-3.5 text-danger"})})]})})]},e.id)})})]})})})}),(0,t.jsx)(D.z,{children:(0,t.jsxs)(a.N,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(x.f,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider",children:"Network Discovery"}),(0,t.jsx)("span",{className:"text-[11px] text-text-muted",children:"— Unadopted agents found on the local network"})]}),(0,t.jsx)(n.K,{variant:"secondary",size:"sm",icon:ee?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(x.f,{className:"h-3.5 w-3.5"}),onClick:()=>void eN(),disabled:ee,children:ee?"Scanning…":"Scan Network"})]}),0===en.length?ee?(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,t.jsxs)("div",{className:"relative h-16 w-16 overflow-hidden rounded-full border border-primary/30 shadow-[0_0_16px_var(--color-glow)]",children:[(0,t.jsx)("div",{className:"absolute inset-0 animate-sweep rounded-full bg-[conic-gradient(from_0deg,transparent_0deg,transparent_280deg,var(--color-primary)_360deg)] opacity-60"}),(0,t.jsx)("div",{className:"absolute inset-[30%] rounded-full border border-primary/20"})]}),(0,t.jsx)("p",{className:"text-[11px] uppercase tracking-wider text-primary",children:"Broadcasting discovery probe…"})]}):(0,t.jsx)(G.f,{compact:!0,icon:(0,t.jsx)(x.f,{className:"h-4 w-4"}),title:"No scan results yet",description:'Click "Scan Network" to discover unadopted agents on your network.'}):(E=en.filter(e=>!e.registered),z=en.filter(e=>e.registered),0===E.length?(0,t.jsxs)("div",{className:"py-6 text-center text-[11px] text-text-muted",children:["All ",z.length," discovered agent",1!==z.length?"s":""," already registered. No new nodes to adopt."]}):(0,t.jsxs)("div",{className:"overflow-x-auto",children:[(0,t.jsxs)("table",{className:"w-full text-[11px]",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b border-primary/20 text-left text-[10px] font-bold uppercase tracking-[0.15em] text-text-muted",children:[(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Hostname"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"IP Address"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Port"}),(0,t.jsx)("th",{className:"pb-3 pr-4",children:"Agent Version"}),(0,t.jsx)("th",{className:"pb-3",children:"Registration"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border/50",children:E.map(e=>(0,t.jsxs)("tr",{className:"hover:bg-surface-hover transition-colors",children:[(0,t.jsx)("td",{className:"py-3 pr-4 font-medium",children:e.fqdn||e.hostname}),(0,t.jsx)("td",{className:"py-3 pr-4 text-text-muted",children:e.ip}),(0,t.jsx)("td",{className:"py-3 pr-4 text-text-muted",children:e.port}),(0,t.jsxs)("td",{className:"py-3 pr-4 text-text-muted",children:["v",e.version]}),(0,t.jsx)("td",{className:"py-3 text-text-muted",children:"Use the reviewed key-only agent deploy runbook, then register the authenticated heartbeat."})]},`${e.ip}:${e.port}`))})]}),z.length>0&&(0,t.jsxs)("p",{className:"mt-3 text-xs text-text-muted",children:[z.length," already-registered agent",1!==z.length?"s":""," ","hidden from this list."]})]}))]})}),(0,t.jsx)(es,{open:J,onClose:()=>W(!1),onFinished:()=>void eb()}),(0,t.jsx)(S.M,{open:T,onClose:()=>F(!1),onRegistered:()=>void eb()}),(0,t.jsx)(S.F,{open:!!Y,node:Y,onClose:()=>Q(null),onSaved:()=>void eb()}),(0,t.jsx)(S.E,{open:!!X,node:X,onClose:()=>Z(null),onSaved:e=>{X&&(eg.current[X.id]=e,$(t=>t.map(t=>t.id===X.id?{...t,role:e}:t))),eb()}}),(0,t.jsx)(B,{open:!!el,onClose:()=>ed(null),node:el})]})}],86421)}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,47061,e=>{"use strict";var s=e.i(43476),t=e.i(71645),r=e.i(68759),a=e.i(46670),n=e.i(93999),i=e.i(32568),l=e.i(82983),c=e.i(34479),o=e.i(4050),d=e.i(95187);let x=(0,d.createServerReference)("4054df23a195bd661532b327632e62fe6ae31db06c",d.callServer,void 0,d.findSourceMapURL,"scanCron");var m=e.i(78571),h=e.i(63376),u=e.i(88187),p=e.i(41120),f=e.i(66595),j=e.i(74544),v=e.i(41220),g=e.i(16327),b=e.i(67927),N=e.i(25981),w=e.i(32781),y=e.i(4139),k=e.i(49882),S=e.i(64155),_=e.i(51757),C=e.i(83967);e.s(["default",0,function(){let{activeNode:e}=(0,o.l)(),[d,I]=(0,t.useState)([]),[E,$]=(0,t.useState)(!1),[L,M]=(0,t.useState)(null),[D,z]=(0,t.useState)(!1),[R,T]=(0,t.useState)(""),[O,A]=(0,t.useState)(new Set),[P,F]=(0,t.useState)(null),[U,G]=(0,t.useState)("1.0.0"),[W,K]=(0,t.useState)(""),[H,q]=(0,t.useState)(!1),B=(0,t.useCallback)(async()=>{$(!0),I([]),M(null);let s=Date.now();try{let s=await x(e.id);if(s.success&&Array.isArray(s.data)){let e=s.data.map(e=>({...e,status:"error"===e.status?"error":"done"}));I(e);let t=new Set(e.filter(e=>e.jobs.length>0).map(e=>e.nodeId));A(t.size>0?t:new Set(e.map(e=>e.nodeId)))}else M(s.error?.message??"Scan returned unsuccessful response")}catch(s){let e=s instanceof Error?s.message:"Scan request failed";M(e)}finally{let e=Date.now()-s;e<1500&&await new Promise(s=>setTimeout(s,1500-e)),$(!1),z(!0)}},[e]);(0,t.useEffect)(()=>{e&&B()},[e,B]);let J=d.reduce((e,s)=>e+("done"===s.status?s.jobs.length:0),0),V=d.filter(e=>"done"===e.status).length,Q=d.filter(e=>"error"===e.status).length,Y=e=>{if(!R)return!0;let s=R.toLowerCase();return e.name.toLowerCase().includes(s)||e.command.toLowerCase().includes(s)||e.schedule.toLowerCase().includes(s)||(e.user?.toLowerCase().includes(s)??!1)},Z=async()=>{if(P&&U){q(!0);try{let e=JSON.stringify({name:P.job.name,version:U,schedule:P.job.schedule,command:P.job.command,description:W},null,2);await l.f.library.files.create({name:`${P.job.name} v${U}`,fileName:`${P.job.name}-${U}.json`,mimeType:"application/x-magnus-cronjob",content:e,tags:["cronjob","cron"]}),F(null),G("1.0.0"),K("")}catch{}finally{q(!1)}}};return(0,s.jsxs)(h.U,{className:"space-y-6",children:[(0,s.jsx)(h.z,{children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-lg font-bold uppercase tracking-wider",children:"Cron Jobs"}),(0,s.jsx)("p",{className:"text-[11px] text-text-muted uppercase tracking-wider",children:"Discover and manage scheduled jobs across your fleet"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[D&&!E&&(0,s.jsxs)("span",{className:"text-[10px] text-text-muted uppercase tracking-wider mr-2",children:[d.length," node",1!==d.length?"s":""," · ",J," job",1!==J?"s":"",Q>0&&` \xb7 ${Q} error${1!==Q?"s":""}`]}),(0,s.jsxs)(r.K,{variant:"secondary",size:"sm",onClick:()=>void B(),disabled:E,children:[(0,s.jsx)(p.f,{className:(0,m.f)("h-3.5 w-3.5 mr-1.5",E&&"animate-spin")}),E?"Scanning...":"Rescan"]})]})]})}),E&&(0,s.jsx)(h.z,{children:(0,s.jsx)(u.f,{title:"Scanning Nodes for Cron Jobs",description:"Probing all online nodes...",nodes:d.map(e=>({nodeId:e.nodeId,nodeName:e.nodeName,status:e.status,error:e.error})),scanning:!0})}),!E&&D&&J>0&&(0,s.jsx)(h.z,{children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(f.f,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-text-muted"}),(0,s.jsx)("input",{type:"text",placeholder:"Search jobs by name, command, or schedule...",value:R,onChange:e=>T(e.target.value),className:(0,m.f)(i.W,"pl-9")})]})}),!E&&D&&L&&(0,s.jsx)(h.z,{children:(0,s.jsx)(n.N,{children:(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,s.jsx)(S.f,{className:"h-10 w-10 text-danger/60 mb-3"}),(0,s.jsx)("p",{className:"text-xs font-bold text-danger mb-1",children:"Scan Failed"}),(0,s.jsx)("p",{className:"text-[11px] text-text-muted max-w-md",children:L}),(0,s.jsxs)(r.K,{variant:"secondary",size:"sm",className:"mt-4",onClick:()=>void B(),children:[(0,s.jsx)(p.f,{className:"h-3.5 w-3.5 mr-1.5"}),"Retry Scan"]})]})})}),!E&&D&&!L&&(0,s.jsxs)(s.Fragment,{children:[0===d.length?(0,s.jsx)(h.z,{children:(0,s.jsx)(n.N,{children:(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,s.jsx)(v.f,{className:"h-10 w-10 text-text-muted/40 mb-3"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"No online nodes found to scan. Ensure at least one node agent is running and connected."})]})})}):d.map(e=>{let t=O.has(e.nodeId),i=e.jobs.filter(Y);return(0,s.jsx)(h.z,{children:(0,s.jsxs)(n.N,{className:"overflow-hidden",children:[(0,s.jsxs)("button",{onClick:()=>{var s;return s=e.nodeId,void A(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},className:"w-full flex items-center gap-4 p-4 text-left hover:bg-surface-hover transition-all",children:[(0,s.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded border border-primary/30 bg-primary/5 shrink-0",children:(0,s.jsx)(v.f,{className:"h-4 w-4 text-primary"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider",children:e.nodeName}),"done"===e.status&&(0,s.jsxs)(a.t,{variant:e.jobs.length>0?"success":"default",children:[e.jobs.length," job",1!==e.jobs.length?"s":""]}),"error"===e.status&&((0,c.f)(e.error)?(0,s.jsx)(a.t,{variant:"default",children:"Disabled"}):(0,s.jsx)(a.t,{variant:"danger",children:"Error"}))]}),"error"===e.status&&e.error&&(0,s.jsx)("p",{className:(0,m.f)("text-[11px] mt-0.5 truncate",(0,c.f)(e.error)?"text-text-muted":"text-danger"),children:(0,c.f)(e.error)??e.error}),"done"===e.status&&0===e.jobs.length&&(0,s.jsx)("p",{className:"text-[11px] text-text-muted mt-0.5",children:"No cron jobs found on this node"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:["done"===e.status?(0,s.jsx)(_.f,{className:"h-4 w-4 text-success"}):(0,s.jsx)(C.f,{className:"h-4 w-4 text-danger"}),t?(0,s.jsx)(g.f,{className:"h-4 w-4 text-text-muted"}):(0,s.jsx)(b.f,{className:"h-4 w-4 text-text-muted"})]})]}),t&&"done"===e.status&&(0,s.jsx)("div",{className:"border-t border-border/50 bg-bg/50",children:0===i.length?(0,s.jsx)("div",{className:"flex items-center justify-center py-8 text-center",children:(0,s.jsx)("p",{className:"text-[11px] text-text-muted",children:0===e.jobs.length?"No cron jobs found on this node.":"No jobs match your search on this node."})}):(0,s.jsx)("div",{className:"divide-y divide-border/30",children:i.map((t,n)=>(0,s.jsxs)("div",{className:"p-4 space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(j.f,{className:"h-4 w-4 text-primary"}),(0,s.jsx)("span",{className:"text-xs font-bold",children:t.name}),t.user&&(0,s.jsx)(a.t,{variant:"default",children:t.user}),(0,s.jsx)(a.t,{variant:"info",children:t.schedule})]}),(0,s.jsxs)(r.K,{size:"sm",variant:"secondary",onClick:()=>{F({job:t,nodeId:e.nodeId,nodeName:e.nodeName}),G("1.0.0"),K("")},children:[(0,s.jsx)(N.f,{className:"h-3 w-3 mr-1"}),"Publish"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1 text-[11px] text-text-muted",children:[(0,s.jsx)(k.f,{className:"h-3 w-3"}),function(e){let s=e.split(/\s+/);if(s.length<5)return e;let[t,r,a,n,i]=s;return"*"===t&&"*"===r&&"*"===a&&"*"===n&&"*"===i?"Every minute":"0"===t&&"*"===r&&"*"===a&&"*"===n&&"*"===i?"Every hour":"0"===t&&"0"===r&&"*"===a&&"*"===n&&"*"===i?"Daily at midnight":t?.startsWith("*/")?`Every ${t.slice(2)} minutes`:r?.startsWith("*/")?`Every ${r.slice(2)} hours`:e}(t.schedule)]}),(0,s.jsxs)("div",{className:"flex items-start gap-2 rounded border border-border bg-surface p-3",children:[(0,s.jsx)(y.f,{className:"h-3.5 w-3.5 text-primary mt-0.5 shrink-0"}),(0,s.jsx)("pre",{className:"text-xs whitespace-pre-wrap break-all flex-1",children:t.command})]})]},`${t.name}-${n}`))})})]})},e.nodeId)}),d.length>0&&(0,s.jsx)(h.z,{children:(0,s.jsxs)("div",{className:"flex items-center justify-between text-[10px] text-text-muted uppercase tracking-wider",children:[(0,s.jsxs)("span",{children:[V," node",1!==V?"s":""," scanned ·"," ",J," job",1!==J?"s":""," discovered"]}),Q>0&&(0,s.jsxs)("span",{className:"text-danger",children:[Q," node",1!==Q?"s":""," unreachable"]})]})})]}),(0,s.jsx)(i.n,{open:!!P,onClose:()=>F(null),title:"Publish to Library",description:P?.job.name??"",icon:(0,s.jsx)(N.f,{className:"h-5 w-5 text-primary"}),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-[11px] font-bold uppercase tracking-wider mb-1.5",children:["Version ",(0,s.jsx)("span",{className:"text-accent",children:"*"})]}),(0,s.jsx)("input",{type:"text",value:U,onChange:e=>G(e.target.value),placeholder:"1.0.0",className:i.W})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-[11px] font-bold uppercase tracking-wider mb-1.5",children:"Description"}),(0,s.jsx)("input",{type:"text",value:W,onChange:e=>K(e.target.value),placeholder:"What does this cron job do?",className:i.W})]}),P&&(0,s.jsxs)("div",{className:"rounded border border-border bg-bg p-3 text-xs space-y-1",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-text-muted",children:"Source:"})," ",P.nodeName]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-text-muted",children:"Schedule:"})," ",P.job.schedule]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-text-muted",children:"Command:"})," ",(0,s.jsx)("span",{className:"text-primary",children:P.job.command})]})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,s.jsx)(r.K,{variant:"secondary",size:"sm",onClick:()=>F(null),children:"Cancel"}),(0,s.jsx)(r.K,{size:"sm",onClick:()=>void Z(),disabled:H||!U,children:H?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(w.f,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),"Publishing..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.f,{className:"h-3.5 w-3.5 mr-1.5"}),"Publish"]})})]})]})})]})}],47061)},46670,e=>{"use strict";var s=e.i(43476),t=e.i(78571);let r={default:"border-border text-text-muted",success:"border-success/40 text-success bg-success/5 shadow-[0_0_6px_rgba(0,255,65,0.15)]",warning:"border-warning/40 text-warning bg-warning/5 shadow-[0_0_6px_rgba(255,179,0,0.15)]",danger:"border-danger/40 text-danger bg-danger/5 shadow-[0_0_6px_rgba(255,23,68,0.15)]",info:"border-info/40 text-info bg-info/5 shadow-[0_0_6px_rgba(0,176,255,0.15)]"},a={default:"bg-text-muted",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info"};e.s(["t",0,function({children:e,variant:n="default",className:i,dot:l=!1,pulse:c=!1}){return(0,s.jsxs)("span",{className:(0,t.f)("inline-flex items-center gap-1.5 rounded-chip border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",r[n],i),children:[l&&(0,s.jsxs)("span",{"aria-hidden":"true",className:"relative inline-flex h-1.5 w-1.5",children:[c&&(0,s.jsx)("span",{className:(0,t.f)("absolute inset-0 rounded-full animate-halo",a[n])}),(0,s.jsx)("span",{className:(0,t.f)("relative inline-flex h-1.5 w-1.5 rounded-full",a[n])})]}),e]})},"k",0,function(e){switch(e.toUpperCase()){case"ONLINE":case"COMPLETED":case"ACTIVE":case"RUNNING":case"INSTALLED":case"HEALTHY":return"success";case"DEGRADED":case"PAUSED":case"QUEUED":case"PENDING":case"INSTALLING":return"warning";case"OFFLINE":case"FAILED":case"ERROR":case"TIMEOUT":case"CANCELLED":case"DECOMMISSIONED":case"CRITICAL":return"danger";case"PROVISIONING":case"UPDATING":return"info";default:return"default"}}])},93999,51196,55427,e=>{"use strict";var s=e.i(43476),t=e.i(56420);let r={name:"arrow-down-right",size:24,node:[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]};r.node;let a=(0,t.f)(r);var n=e.i(75775),i=e.i(78571),l=e.i(3062),c=e.i(35084);let o={warning:"shadow-[0_0_6px_var(--color-warning)]",danger:"shadow-[0_0_8px_var(--color-danger)]",accent:"shadow-[0_0_6px_var(--color-accent)]",primary:"shadow-[0_0_6px_var(--color-primary)]"},d={xs:"h-1",sm:"h-1.5",md:"h-2"};function x({value:e,max:t=100,tone:r,thresholds:a=c.q,label:n,size:l="xs",showValue:m=!1,valueLabel:h,glow:u,className:p,testId:f}){let j="number"==typeof e&&Number.isFinite(e),v=j?Math.max(0,Math.min(100,e/(t||1)*100)):0,g=r??(j?(0,c.Z)(v,a):"muted"),b=u||!r&&j&&v>=a.warn,N=h??(j?`${v.toFixed(+(v<10&&v>0))}%`:"—");return(0,s.jsxs)("div",{className:(0,i.f)("flex min-w-0 items-center gap-2",p),"data-testid":f,children:[(0,s.jsx)("div",{role:"meter","aria-label":n,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":j?e:void 0,"aria-valuetext":N,className:(0,i.f)("relative flex-1 overflow-hidden rounded-full bg-border/70",d[l]),children:(0,s.jsx)("div",{style:{"--meter":`${v}%`},className:(0,i.f)("h-full w-(--meter) rounded-full transition-[width] duration-700 ease-out-expo starting:w-0",c.H[g],b&&o[g])})}),m&&(0,s.jsx)("span",{className:(0,i.f)("num w-11 shrink-0 text-right text-[11px]",j?c.T[g]:"text-text-muted"),children:N})]})}e.s(["f",0,x],51196);var m=e.i(71645);function h({values:e,tone:t="primary",width:r=160,height:a=32,area:n=!0,max:l,percent:o=!1,threshold:d,live:x=!0,emptyLabel:u="not enough data",className:p,testId:f,label:j,stretch:v=!1}){let g=`spark${(0,m.useId)().replace(/:/g,"")}`;if(e.length<2)return(0,s.jsx)("div",{className:(0,i.f)("flex h-8 items-center text-xs italic text-text-muted",p),"data-testid":f,children:u});let b=c.v[t],N=l??(o?Math.max(100,...e):Math.max(...e,d??0)||1),w=a-4,y=r/(e.length-1),k=e=>2+w-Math.max(0,e)/N*w,S=e.map((e,s)=>[s*y,k(e)]),_=S.map(([e,s])=>`${e.toFixed(1)},${s.toFixed(1)}`).join(" "),C=S[S.length-1];return(0,s.jsxs)("svg",{width:v?"100%":r,height:a,viewBox:`0 0 ${r} ${a}`,preserveAspectRatio:v?"none":void 0,className:(0,i.f)("block overflow-visible",p),"data-testid":f,role:j?"img":void 0,"aria-label":j,"aria-hidden":!j||void 0,children:[n&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("defs",{children:(0,s.jsxs)("linearGradient",{id:g,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:b,stopOpacity:.35}),(0,s.jsx)("stop",{offset:"100%",stopColor:b,stopOpacity:0})]})}),(0,s.jsx)("polygon",{points:`0,${a} ${_} ${r},${a}`,fill:`url(#${g})`})]}),void 0!==d&&(0,s.jsx)("line",{x1:0,x2:r,y1:k(d),y2:k(d),stroke:"var(--color-warning)",strokeOpacity:.5,strokeDasharray:"3 3",strokeWidth:1}),(0,s.jsx)("polyline",{fill:"none",stroke:b,strokeWidth:1.5,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round",points:_}),x&&!v&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("circle",{cx:C[0],cy:C[1],r:2.5,fill:b,className:"origin-center animate-halo [transform-box:fill-box]"}),(0,s.jsx)("circle",{cx:C[0],cy:C[1],r:2,fill:b})]})]})}e.s(["f",0,h],55427),e.s(["N",0,function({title:e,description:t,children:r,className:a,action:n,tone:i,corners:c=!1,...o}){return(0,s.jsx)(l.f,{...o,tone:i,corners:c,title:e,description:t,action:n,className:a,children:r})},"n",0,function({label:e,value:t,icon:r,trend:o,spark:d,meter:m,delta:u,tone:p="primary",className:f,testId:j}){let v=!u||u.value>=0===(u.positiveIsGood??!0);return(0,s.jsxs)(l.f,{tone:p,className:(0,i.f)("overflow-hidden",f),testId:j,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-[10px] font-medium uppercase tracking-[0.15em] text-text-muted",children:e}),r&&(0,s.jsx)("span",{className:"text-primary/60",children:r})]}),(0,s.jsxs)("div",{className:"mt-2 flex items-end justify-between gap-2",children:[(0,s.jsx)("div",{className:(0,i.f)("num text-2xl font-bold","primary"===p?"text-primary neon-text":c.T[p]),children:t}),u&&0!==u.value&&(0,s.jsxs)("span",{className:(0,i.f)("num mb-1 inline-flex items-center gap-0.5 text-[11px]",v?"text-success":"text-danger"),children:[u.value>0?(0,s.jsx)(n.f,{className:"h-3 w-3"}):(0,s.jsx)(a,{className:"h-3 w-3"}),Math.abs(u.value).toFixed(+!Number.isInteger(u.value)),u.unit]})]}),o&&(0,s.jsx)("div",{className:(0,i.f)("mt-1 text-[11px]",o.positive?"text-success":"text-danger"),children:o.value}),void 0!==m&&(0,s.jsx)(x,{value:m,className:"mt-3",label:e}),d&&d.length>1&&(0,s.jsx)("div",{className:"-mx-5 -mb-5 mt-3 opacity-80",children:(0,s.jsx)(h,{values:d,tone:p,width:240,height:28,stretch:!0,live:!1})})]})}],93999)},3062,e=>{"use strict";var s=e.i(43476),t=e.i(78571),r=e.i(35084);let a={primary:"[--panel-corner-color:color-mix(in_srgb,var(--color-primary)_60%,transparent)]",accent:"[--panel-corner-color:color-mix(in_srgb,var(--color-accent)_70%,transparent)]",success:"[--panel-corner-color:color-mix(in_srgb,var(--color-success)_60%,transparent)]",warning:"[--panel-corner-color:color-mix(in_srgb,var(--color-warning)_70%,transparent)]",danger:"[--panel-corner-color:color-mix(in_srgb,var(--color-danger)_70%,transparent)]",info:"[--panel-corner-color:color-mix(in_srgb,var(--color-info)_60%,transparent)]",muted:"[--panel-corner-color:var(--color-border-strong)]"},n={primary:"[--glow-hover-color:var(--color-glow)]",accent:"[--glow-hover-color:var(--color-glow-accent)]",success:"[--glow-hover-color:var(--color-glow-success)]",warning:"[--glow-hover-color:var(--color-glow-warning)]",danger:"[--glow-hover-color:var(--color-glow-danger)]",info:"[--glow-hover-color:var(--color-glow)]",muted:"[--glow-hover-color:var(--color-glow)]"},i={primary:"hover:border-primary/30",accent:"hover:border-accent/40",success:"hover:border-success/30",warning:"hover:border-warning/40",danger:"hover:border-danger/40",info:"hover:border-info/30",muted:"hover:border-border-strong"},l={none:"",sm:"p-3",md:"p-5",lg:"p-6"};e.s(["f",0,function({tone:e="primary",corners:c=!0,interactive:o=!0,hero:d=!1,title:x,description:m,icon:h,action:u,as:p="div",padding:f="md",testId:j,className:v,children:g,...b}){return(0,s.jsxs)(p,{...b,"data-testid":j??b["data-testid"],className:(0,t.f)("relative rounded-panel border border-border bg-surface transition-colors duration-300",l[f],c&&"panel-corners",c&&a[e],o&&"glow-hover",o&&n[e],o&&i[e],d&&"grid-bg overflow-hidden bg-surface/80",v),children:[(x||u||h)&&(0,s.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[h&&(0,s.jsx)("span",{className:(0,t.f)("mt-0.5 shrink-0",r.T[e]),children:h}),(0,s.jsxs)("div",{className:"min-w-0",children:[x&&(0,s.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider",children:x}),m&&(0,s.jsx)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:m})]})]}),u]}),g]})}])},63376,e=>{"use strict";var s=e.i(43476);e.s(["z",0,function({children:e,className:t}){return(0,s.jsx)("div",{className:`animate-page-in${t?` ${t}`:""}`,children:e})},"U",0,function({children:e,className:t}){return(0,s.jsx)("div",{className:t,children:e})}])},88187,25981,e=>{"use strict";var s=e.i(43476),t=e.i(32181),r=e.i(32781),a=e.i(51757),n=e.i(83967),i=e.i(15331);e.s(["f",0,function({title:e,description:l,nodes:c,scanning:o}){return(0,s.jsxs)(t.f.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.4,ease:[.16,1,.3,1]},className:"rounded border border-primary/30 bg-surface p-6 relative overflow-hidden",children:[o&&(0,s.jsx)(t.f.div,{className:"absolute inset-0 pointer-events-none",initial:{opacity:0},animate:{opacity:1},children:(0,s.jsx)(t.f.div,{className:"absolute left-0 right-0 h-px bg-gradient-to-r from-transparent via-primary/60 to-transparent",animate:{top:["0%","100%"]},transition:{duration:2,repeat:1/0,ease:"linear"}})}),(0,s.jsx)("div",{className:"absolute inset-0 rounded pointer-events-none",style:{boxShadow:o?"0 0 20px var(--color-glow), inset 0 0 20px rgba(0,229,255,0.03)":"none",transition:"box-shadow 0.5s ease"}}),(0,s.jsxs)("div",{className:"relative z-10",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[o?(0,s.jsx)(t.f.div,{animate:{rotate:360},transition:{duration:2,repeat:1/0,ease:"linear"},children:(0,s.jsx)(i.f,{className:"h-5 w-5 text-primary"})}):(0,s.jsx)(a.f,{className:"h-5 w-5 text-success"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-bold uppercase tracking-wider",children:o?e:"Scan Complete"}),l&&(0,s.jsx)("p",{className:"text-[11px] text-text-muted",children:l})]})]}),c.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:c.map((e,i)=>(0,s.jsxs)(t.f.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:.05*i,duration:.3},className:"flex items-center gap-3 text-xs",children:["scanning"===e.status&&(0,s.jsx)(r.f,{className:"h-3.5 w-3.5 text-primary animate-spin"}),"done"===e.status&&(0,s.jsx)(a.f,{className:"h-3.5 w-3.5 text-success"}),"error"===e.status&&(0,s.jsx)(n.f,{className:"h-3.5 w-3.5 text-danger"}),(0,s.jsx)("span",{className:"text-text",children:e.nodeName}),"error"===e.status&&e.error&&(0,s.jsx)("span",{className:"text-[10px] text-danger/70 truncate max-w-[200px]",children:e.error})]},e.nodeId))}),0===c.length&&o&&(0,s.jsx)("p",{className:"text-[11px] text-text-muted",children:"Discovering nodes..."})]})]})}],88187);var l=e.i(56420);let c={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};c.node;let o=(0,l.f)(c);e.s(["f",0,o],25981)},75775,e=>{"use strict";var s=e.i(56420);let t={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};t.node;let r=(0,s.f)(t);e.s(["f",0,r],75775)},49882,e=>{"use strict";var s=e.i(56420);let t={name:"calendar",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}]]};t.node;let r=(0,s.f)(t);e.s(["f",0,r],49882)},95187,(e,s,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={callServer:function(){return n.callServer},createServerReference:function(){return l.createServerReference},findSourceMapURL:function(){return i.findSourceMapURL}};for(var a in r)Object.defineProperty(t,a,{enumerable:!0,get:r[a]});let n=e.r(32120),i=e.r(92245),l=e.r(35326)}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,47061,e=>{"use strict";var s=e.i(43476),t=e.i(71645),r=e.i(68759),a=e.i(46670),n=e.i(93999),i=e.i(32568),l=e.i(82983),c=e.i(34479),o=e.i(4050),d=e.i(95187);let x=(0,d.createServerReference)("407c1f44b72869676d6ad141516322fb58e312dda6",d.callServer,void 0,d.findSourceMapURL,"scanCron");var m=e.i(78571),h=e.i(63376),u=e.i(88187),p=e.i(41120),f=e.i(66595),j=e.i(74544),v=e.i(41220),g=e.i(16327),b=e.i(67927),N=e.i(25981),w=e.i(32781),y=e.i(4139),k=e.i(49882),S=e.i(64155),_=e.i(51757),C=e.i(83967);e.s(["default",0,function(){let{activeNode:e}=(0,o.l)(),[d,I]=(0,t.useState)([]),[E,$]=(0,t.useState)(!1),[L,M]=(0,t.useState)(null),[D,z]=(0,t.useState)(!1),[R,T]=(0,t.useState)(""),[O,A]=(0,t.useState)(new Set),[P,F]=(0,t.useState)(null),[U,G]=(0,t.useState)("1.0.0"),[W,K]=(0,t.useState)(""),[H,q]=(0,t.useState)(!1),B=(0,t.useCallback)(async()=>{$(!0),I([]),M(null);let s=Date.now();try{let s=await x(e.id);if(s.success&&Array.isArray(s.data)){let e=s.data.map(e=>({...e,status:"error"===e.status?"error":"done"}));I(e);let t=new Set(e.filter(e=>e.jobs.length>0).map(e=>e.nodeId));A(t.size>0?t:new Set(e.map(e=>e.nodeId)))}else M(s.error?.message??"Scan returned unsuccessful response")}catch(s){let e=s instanceof Error?s.message:"Scan request failed";M(e)}finally{let e=Date.now()-s;e<1500&&await new Promise(s=>setTimeout(s,1500-e)),$(!1),z(!0)}},[e]);(0,t.useEffect)(()=>{e&&B()},[e,B]);let J=d.reduce((e,s)=>e+("done"===s.status?s.jobs.length:0),0),V=d.filter(e=>"done"===e.status).length,Q=d.filter(e=>"error"===e.status).length,Y=e=>{if(!R)return!0;let s=R.toLowerCase();return e.name.toLowerCase().includes(s)||e.command.toLowerCase().includes(s)||e.schedule.toLowerCase().includes(s)||(e.user?.toLowerCase().includes(s)??!1)},Z=async()=>{if(P&&U){q(!0);try{let e=JSON.stringify({name:P.job.name,version:U,schedule:P.job.schedule,command:P.job.command,description:W},null,2);await l.f.library.files.create({name:`${P.job.name} v${U}`,fileName:`${P.job.name}-${U}.json`,mimeType:"application/x-magnus-cronjob",content:e,tags:["cronjob","cron"]}),F(null),G("1.0.0"),K("")}catch{}finally{q(!1)}}};return(0,s.jsxs)(h.U,{className:"space-y-6",children:[(0,s.jsx)(h.z,{children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-lg font-bold uppercase tracking-wider",children:"Cron Jobs"}),(0,s.jsx)("p",{className:"text-[11px] text-text-muted uppercase tracking-wider",children:"Discover and manage scheduled jobs across your fleet"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[D&&!E&&(0,s.jsxs)("span",{className:"text-[10px] text-text-muted uppercase tracking-wider mr-2",children:[d.length," node",1!==d.length?"s":""," · ",J," job",1!==J?"s":"",Q>0&&` \xb7 ${Q} error${1!==Q?"s":""}`]}),(0,s.jsxs)(r.K,{variant:"secondary",size:"sm",onClick:()=>void B(),disabled:E,children:[(0,s.jsx)(p.f,{className:(0,m.f)("h-3.5 w-3.5 mr-1.5",E&&"animate-spin")}),E?"Scanning...":"Rescan"]})]})]})}),E&&(0,s.jsx)(h.z,{children:(0,s.jsx)(u.f,{title:"Scanning Nodes for Cron Jobs",description:"Probing all online nodes...",nodes:d.map(e=>({nodeId:e.nodeId,nodeName:e.nodeName,status:e.status,error:e.error})),scanning:!0})}),!E&&D&&J>0&&(0,s.jsx)(h.z,{children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(f.f,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-text-muted"}),(0,s.jsx)("input",{type:"text",placeholder:"Search jobs by name, command, or schedule...",value:R,onChange:e=>T(e.target.value),className:(0,m.f)(i.W,"pl-9")})]})}),!E&&D&&L&&(0,s.jsx)(h.z,{children:(0,s.jsx)(n.N,{children:(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,s.jsx)(S.f,{className:"h-10 w-10 text-danger/60 mb-3"}),(0,s.jsx)("p",{className:"text-xs font-bold text-danger mb-1",children:"Scan Failed"}),(0,s.jsx)("p",{className:"text-[11px] text-text-muted max-w-md",children:L}),(0,s.jsxs)(r.K,{variant:"secondary",size:"sm",className:"mt-4",onClick:()=>void B(),children:[(0,s.jsx)(p.f,{className:"h-3.5 w-3.5 mr-1.5"}),"Retry Scan"]})]})})}),!E&&D&&!L&&(0,s.jsxs)(s.Fragment,{children:[0===d.length?(0,s.jsx)(h.z,{children:(0,s.jsx)(n.N,{children:(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,s.jsx)(v.f,{className:"h-10 w-10 text-text-muted/40 mb-3"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"No online nodes found to scan. Ensure at least one node agent is running and connected."})]})})}):d.map(e=>{let t=O.has(e.nodeId),i=e.jobs.filter(Y);return(0,s.jsx)(h.z,{children:(0,s.jsxs)(n.N,{className:"overflow-hidden",children:[(0,s.jsxs)("button",{onClick:()=>{var s;return s=e.nodeId,void A(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},className:"w-full flex items-center gap-4 p-4 text-left hover:bg-surface-hover transition-all",children:[(0,s.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded border border-primary/30 bg-primary/5 shrink-0",children:(0,s.jsx)(v.f,{className:"h-4 w-4 text-primary"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider",children:e.nodeName}),"done"===e.status&&(0,s.jsxs)(a.t,{variant:e.jobs.length>0?"success":"default",children:[e.jobs.length," job",1!==e.jobs.length?"s":""]}),"error"===e.status&&((0,c.f)(e.error)?(0,s.jsx)(a.t,{variant:"default",children:"Disabled"}):(0,s.jsx)(a.t,{variant:"danger",children:"Error"}))]}),"error"===e.status&&e.error&&(0,s.jsx)("p",{className:(0,m.f)("text-[11px] mt-0.5 truncate",(0,c.f)(e.error)?"text-text-muted":"text-danger"),children:(0,c.f)(e.error)??e.error}),"done"===e.status&&0===e.jobs.length&&(0,s.jsx)("p",{className:"text-[11px] text-text-muted mt-0.5",children:"No cron jobs found on this node"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:["done"===e.status?(0,s.jsx)(_.f,{className:"h-4 w-4 text-success"}):(0,s.jsx)(C.f,{className:"h-4 w-4 text-danger"}),t?(0,s.jsx)(g.f,{className:"h-4 w-4 text-text-muted"}):(0,s.jsx)(b.f,{className:"h-4 w-4 text-text-muted"})]})]}),t&&"done"===e.status&&(0,s.jsx)("div",{className:"border-t border-border/50 bg-bg/50",children:0===i.length?(0,s.jsx)("div",{className:"flex items-center justify-center py-8 text-center",children:(0,s.jsx)("p",{className:"text-[11px] text-text-muted",children:0===e.jobs.length?"No cron jobs found on this node.":"No jobs match your search on this node."})}):(0,s.jsx)("div",{className:"divide-y divide-border/30",children:i.map((t,n)=>(0,s.jsxs)("div",{className:"p-4 space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(j.f,{className:"h-4 w-4 text-primary"}),(0,s.jsx)("span",{className:"text-xs font-bold",children:t.name}),t.user&&(0,s.jsx)(a.t,{variant:"default",children:t.user}),(0,s.jsx)(a.t,{variant:"info",children:t.schedule})]}),(0,s.jsxs)(r.K,{size:"sm",variant:"secondary",onClick:()=>{F({job:t,nodeId:e.nodeId,nodeName:e.nodeName}),G("1.0.0"),K("")},children:[(0,s.jsx)(N.f,{className:"h-3 w-3 mr-1"}),"Publish"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1 text-[11px] text-text-muted",children:[(0,s.jsx)(k.f,{className:"h-3 w-3"}),function(e){let s=e.split(/\s+/);if(s.length<5)return e;let[t,r,a,n,i]=s;return"*"===t&&"*"===r&&"*"===a&&"*"===n&&"*"===i?"Every minute":"0"===t&&"*"===r&&"*"===a&&"*"===n&&"*"===i?"Every hour":"0"===t&&"0"===r&&"*"===a&&"*"===n&&"*"===i?"Daily at midnight":t?.startsWith("*/")?`Every ${t.slice(2)} minutes`:r?.startsWith("*/")?`Every ${r.slice(2)} hours`:e}(t.schedule)]}),(0,s.jsxs)("div",{className:"flex items-start gap-2 rounded border border-border bg-surface p-3",children:[(0,s.jsx)(y.f,{className:"h-3.5 w-3.5 text-primary mt-0.5 shrink-0"}),(0,s.jsx)("pre",{className:"text-xs whitespace-pre-wrap break-all flex-1",children:t.command})]})]},`${t.name}-${n}`))})})]})},e.nodeId)}),d.length>0&&(0,s.jsx)(h.z,{children:(0,s.jsxs)("div",{className:"flex items-center justify-between text-[10px] text-text-muted uppercase tracking-wider",children:[(0,s.jsxs)("span",{children:[V," node",1!==V?"s":""," scanned ·"," ",J," job",1!==J?"s":""," discovered"]}),Q>0&&(0,s.jsxs)("span",{className:"text-danger",children:[Q," node",1!==Q?"s":""," unreachable"]})]})})]}),(0,s.jsx)(i.n,{open:!!P,onClose:()=>F(null),title:"Publish to Library",description:P?.job.name??"",icon:(0,s.jsx)(N.f,{className:"h-5 w-5 text-primary"}),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-[11px] font-bold uppercase tracking-wider mb-1.5",children:["Version ",(0,s.jsx)("span",{className:"text-accent",children:"*"})]}),(0,s.jsx)("input",{type:"text",value:U,onChange:e=>G(e.target.value),placeholder:"1.0.0",className:i.W})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-[11px] font-bold uppercase tracking-wider mb-1.5",children:"Description"}),(0,s.jsx)("input",{type:"text",value:W,onChange:e=>K(e.target.value),placeholder:"What does this cron job do?",className:i.W})]}),P&&(0,s.jsxs)("div",{className:"rounded border border-border bg-bg p-3 text-xs space-y-1",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-text-muted",children:"Source:"})," ",P.nodeName]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-text-muted",children:"Schedule:"})," ",P.job.schedule]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-text-muted",children:"Command:"})," ",(0,s.jsx)("span",{className:"text-primary",children:P.job.command})]})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,s.jsx)(r.K,{variant:"secondary",size:"sm",onClick:()=>F(null),children:"Cancel"}),(0,s.jsx)(r.K,{size:"sm",onClick:()=>void Z(),disabled:H||!U,children:H?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(w.f,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),"Publishing..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.f,{className:"h-3.5 w-3.5 mr-1.5"}),"Publish"]})})]})]})})]})}],47061)},46670,e=>{"use strict";var s=e.i(43476),t=e.i(78571);let r={default:"border-border text-text-muted",success:"border-success/40 text-success bg-success/5 shadow-[0_0_6px_rgba(0,255,65,0.15)]",warning:"border-warning/40 text-warning bg-warning/5 shadow-[0_0_6px_rgba(255,179,0,0.15)]",danger:"border-danger/40 text-danger bg-danger/5 shadow-[0_0_6px_rgba(255,23,68,0.15)]",info:"border-info/40 text-info bg-info/5 shadow-[0_0_6px_rgba(0,176,255,0.15)]"},a={default:"bg-text-muted",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info"};e.s(["t",0,function({children:e,variant:n="default",className:i,dot:l=!1,pulse:c=!1}){return(0,s.jsxs)("span",{className:(0,t.f)("inline-flex items-center gap-1.5 rounded-chip border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",r[n],i),children:[l&&(0,s.jsxs)("span",{"aria-hidden":"true",className:"relative inline-flex h-1.5 w-1.5",children:[c&&(0,s.jsx)("span",{className:(0,t.f)("absolute inset-0 rounded-full animate-halo",a[n])}),(0,s.jsx)("span",{className:(0,t.f)("relative inline-flex h-1.5 w-1.5 rounded-full",a[n])})]}),e]})},"k",0,function(e){switch(e.toUpperCase()){case"ONLINE":case"COMPLETED":case"ACTIVE":case"RUNNING":case"INSTALLED":case"HEALTHY":return"success";case"DEGRADED":case"PAUSED":case"QUEUED":case"PENDING":case"INSTALLING":return"warning";case"OFFLINE":case"FAILED":case"ERROR":case"TIMEOUT":case"CANCELLED":case"DECOMMISSIONED":case"CRITICAL":return"danger";case"PROVISIONING":case"UPDATING":return"info";default:return"default"}}])},93999,51196,55427,e=>{"use strict";var s=e.i(43476),t=e.i(56420);let r={name:"arrow-down-right",size:24,node:[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]};r.node;let a=(0,t.f)(r);var n=e.i(75775),i=e.i(78571),l=e.i(3062),c=e.i(35084);let o={warning:"shadow-[0_0_6px_var(--color-warning)]",danger:"shadow-[0_0_8px_var(--color-danger)]",accent:"shadow-[0_0_6px_var(--color-accent)]",primary:"shadow-[0_0_6px_var(--color-primary)]"},d={xs:"h-1",sm:"h-1.5",md:"h-2"};function x({value:e,max:t=100,tone:r,thresholds:a=c.q,label:n,size:l="xs",showValue:m=!1,valueLabel:h,glow:u,className:p,testId:f}){let j="number"==typeof e&&Number.isFinite(e),v=j?Math.max(0,Math.min(100,e/(t||1)*100)):0,g=r??(j?(0,c.Z)(v,a):"muted"),b=u||!r&&j&&v>=a.warn,N=h??(j?`${v.toFixed(+(v<10&&v>0))}%`:"—");return(0,s.jsxs)("div",{className:(0,i.f)("flex min-w-0 items-center gap-2",p),"data-testid":f,children:[(0,s.jsx)("div",{role:"meter","aria-label":n,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":j?e:void 0,"aria-valuetext":N,className:(0,i.f)("relative flex-1 overflow-hidden rounded-full bg-border/70",d[l]),children:(0,s.jsx)("div",{style:{"--meter":`${v}%`},className:(0,i.f)("h-full w-(--meter) rounded-full transition-[width] duration-700 ease-out-expo starting:w-0",c.H[g],b&&o[g])})}),m&&(0,s.jsx)("span",{className:(0,i.f)("num w-11 shrink-0 text-right text-[11px]",j?c.T[g]:"text-text-muted"),children:N})]})}e.s(["f",0,x],51196);var m=e.i(71645);function h({values:e,tone:t="primary",width:r=160,height:a=32,area:n=!0,max:l,percent:o=!1,threshold:d,live:x=!0,emptyLabel:u="not enough data",className:p,testId:f,label:j,stretch:v=!1}){let g=`spark${(0,m.useId)().replace(/:/g,"")}`;if(e.length<2)return(0,s.jsx)("div",{className:(0,i.f)("flex h-8 items-center text-xs italic text-text-muted",p),"data-testid":f,children:u});let b=c.v[t],N=l??(o?Math.max(100,...e):Math.max(...e,d??0)||1),w=a-4,y=r/(e.length-1),k=e=>2+w-Math.max(0,e)/N*w,S=e.map((e,s)=>[s*y,k(e)]),_=S.map(([e,s])=>`${e.toFixed(1)},${s.toFixed(1)}`).join(" "),C=S[S.length-1];return(0,s.jsxs)("svg",{width:v?"100%":r,height:a,viewBox:`0 0 ${r} ${a}`,preserveAspectRatio:v?"none":void 0,className:(0,i.f)("block overflow-visible",p),"data-testid":f,role:j?"img":void 0,"aria-label":j,"aria-hidden":!j||void 0,children:[n&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("defs",{children:(0,s.jsxs)("linearGradient",{id:g,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:b,stopOpacity:.35}),(0,s.jsx)("stop",{offset:"100%",stopColor:b,stopOpacity:0})]})}),(0,s.jsx)("polygon",{points:`0,${a} ${_} ${r},${a}`,fill:`url(#${g})`})]}),void 0!==d&&(0,s.jsx)("line",{x1:0,x2:r,y1:k(d),y2:k(d),stroke:"var(--color-warning)",strokeOpacity:.5,strokeDasharray:"3 3",strokeWidth:1}),(0,s.jsx)("polyline",{fill:"none",stroke:b,strokeWidth:1.5,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round",points:_}),x&&!v&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("circle",{cx:C[0],cy:C[1],r:2.5,fill:b,className:"origin-center animate-halo [transform-box:fill-box]"}),(0,s.jsx)("circle",{cx:C[0],cy:C[1],r:2,fill:b})]})]})}e.s(["f",0,h],55427),e.s(["N",0,function({title:e,description:t,children:r,className:a,action:n,tone:i,corners:c=!1,...o}){return(0,s.jsx)(l.f,{...o,tone:i,corners:c,title:e,description:t,action:n,className:a,children:r})},"n",0,function({label:e,value:t,icon:r,trend:o,spark:d,meter:m,delta:u,tone:p="primary",className:f,testId:j}){let v=!u||u.value>=0===(u.positiveIsGood??!0);return(0,s.jsxs)(l.f,{tone:p,className:(0,i.f)("overflow-hidden",f),testId:j,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-[10px] font-medium uppercase tracking-[0.15em] text-text-muted",children:e}),r&&(0,s.jsx)("span",{className:"text-primary/60",children:r})]}),(0,s.jsxs)("div",{className:"mt-2 flex items-end justify-between gap-2",children:[(0,s.jsx)("div",{className:(0,i.f)("num text-2xl font-bold","primary"===p?"text-primary neon-text":c.T[p]),children:t}),u&&0!==u.value&&(0,s.jsxs)("span",{className:(0,i.f)("num mb-1 inline-flex items-center gap-0.5 text-[11px]",v?"text-success":"text-danger"),children:[u.value>0?(0,s.jsx)(n.f,{className:"h-3 w-3"}):(0,s.jsx)(a,{className:"h-3 w-3"}),Math.abs(u.value).toFixed(+!Number.isInteger(u.value)),u.unit]})]}),o&&(0,s.jsx)("div",{className:(0,i.f)("mt-1 text-[11px]",o.positive?"text-success":"text-danger"),children:o.value}),void 0!==m&&(0,s.jsx)(x,{value:m,className:"mt-3",label:e}),d&&d.length>1&&(0,s.jsx)("div",{className:"-mx-5 -mb-5 mt-3 opacity-80",children:(0,s.jsx)(h,{values:d,tone:p,width:240,height:28,stretch:!0,live:!1})})]})}],93999)},3062,e=>{"use strict";var s=e.i(43476),t=e.i(78571),r=e.i(35084);let a={primary:"[--panel-corner-color:color-mix(in_srgb,var(--color-primary)_60%,transparent)]",accent:"[--panel-corner-color:color-mix(in_srgb,var(--color-accent)_70%,transparent)]",success:"[--panel-corner-color:color-mix(in_srgb,var(--color-success)_60%,transparent)]",warning:"[--panel-corner-color:color-mix(in_srgb,var(--color-warning)_70%,transparent)]",danger:"[--panel-corner-color:color-mix(in_srgb,var(--color-danger)_70%,transparent)]",info:"[--panel-corner-color:color-mix(in_srgb,var(--color-info)_60%,transparent)]",muted:"[--panel-corner-color:var(--color-border-strong)]"},n={primary:"[--glow-hover-color:var(--color-glow)]",accent:"[--glow-hover-color:var(--color-glow-accent)]",success:"[--glow-hover-color:var(--color-glow-success)]",warning:"[--glow-hover-color:var(--color-glow-warning)]",danger:"[--glow-hover-color:var(--color-glow-danger)]",info:"[--glow-hover-color:var(--color-glow)]",muted:"[--glow-hover-color:var(--color-glow)]"},i={primary:"hover:border-primary/30",accent:"hover:border-accent/40",success:"hover:border-success/30",warning:"hover:border-warning/40",danger:"hover:border-danger/40",info:"hover:border-info/30",muted:"hover:border-border-strong"},l={none:"",sm:"p-3",md:"p-5",lg:"p-6"};e.s(["f",0,function({tone:e="primary",corners:c=!0,interactive:o=!0,hero:d=!1,title:x,description:m,icon:h,action:u,as:p="div",padding:f="md",testId:j,className:v,children:g,...b}){return(0,s.jsxs)(p,{...b,"data-testid":j??b["data-testid"],className:(0,t.f)("relative rounded-panel border border-border bg-surface transition-colors duration-300",l[f],c&&"panel-corners",c&&a[e],o&&"glow-hover",o&&n[e],o&&i[e],d&&"grid-bg overflow-hidden bg-surface/80",v),children:[(x||u||h)&&(0,s.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[h&&(0,s.jsx)("span",{className:(0,t.f)("mt-0.5 shrink-0",r.T[e]),children:h}),(0,s.jsxs)("div",{className:"min-w-0",children:[x&&(0,s.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider",children:x}),m&&(0,s.jsx)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:m})]})]}),u]}),g]})}])},63376,e=>{"use strict";var s=e.i(43476);e.s(["z",0,function({children:e,className:t}){return(0,s.jsx)("div",{className:`animate-page-in${t?` ${t}`:""}`,children:e})},"U",0,function({children:e,className:t}){return(0,s.jsx)("div",{className:t,children:e})}])},88187,25981,e=>{"use strict";var s=e.i(43476),t=e.i(32181),r=e.i(32781),a=e.i(51757),n=e.i(83967),i=e.i(15331);e.s(["f",0,function({title:e,description:l,nodes:c,scanning:o}){return(0,s.jsxs)(t.f.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.4,ease:[.16,1,.3,1]},className:"rounded border border-primary/30 bg-surface p-6 relative overflow-hidden",children:[o&&(0,s.jsx)(t.f.div,{className:"absolute inset-0 pointer-events-none",initial:{opacity:0},animate:{opacity:1},children:(0,s.jsx)(t.f.div,{className:"absolute left-0 right-0 h-px bg-gradient-to-r from-transparent via-primary/60 to-transparent",animate:{top:["0%","100%"]},transition:{duration:2,repeat:1/0,ease:"linear"}})}),(0,s.jsx)("div",{className:"absolute inset-0 rounded pointer-events-none",style:{boxShadow:o?"0 0 20px var(--color-glow), inset 0 0 20px rgba(0,229,255,0.03)":"none",transition:"box-shadow 0.5s ease"}}),(0,s.jsxs)("div",{className:"relative z-10",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[o?(0,s.jsx)(t.f.div,{animate:{rotate:360},transition:{duration:2,repeat:1/0,ease:"linear"},children:(0,s.jsx)(i.f,{className:"h-5 w-5 text-primary"})}):(0,s.jsx)(a.f,{className:"h-5 w-5 text-success"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-bold uppercase tracking-wider",children:o?e:"Scan Complete"}),l&&(0,s.jsx)("p",{className:"text-[11px] text-text-muted",children:l})]})]}),c.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:c.map((e,i)=>(0,s.jsxs)(t.f.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:.05*i,duration:.3},className:"flex items-center gap-3 text-xs",children:["scanning"===e.status&&(0,s.jsx)(r.f,{className:"h-3.5 w-3.5 text-primary animate-spin"}),"done"===e.status&&(0,s.jsx)(a.f,{className:"h-3.5 w-3.5 text-success"}),"error"===e.status&&(0,s.jsx)(n.f,{className:"h-3.5 w-3.5 text-danger"}),(0,s.jsx)("span",{className:"text-text",children:e.nodeName}),"error"===e.status&&e.error&&(0,s.jsx)("span",{className:"text-[10px] text-danger/70 truncate max-w-[200px]",children:e.error})]},e.nodeId))}),0===c.length&&o&&(0,s.jsx)("p",{className:"text-[11px] text-text-muted",children:"Discovering nodes..."})]})]})}],88187);var l=e.i(56420);let c={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};c.node;let o=(0,l.f)(c);e.s(["f",0,o],25981)},75775,e=>{"use strict";var s=e.i(56420);let t={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};t.node;let r=(0,s.f)(t);e.s(["f",0,r],75775)},49882,e=>{"use strict";var s=e.i(56420);let t={name:"calendar",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}]]};t.node;let r=(0,s.f)(t);e.s(["f",0,r],49882)},95187,(e,s,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={callServer:function(){return n.callServer},createServerReference:function(){return l.createServerReference},findSourceMapURL:function(){return i.findSourceMapURL}};for(var a in r)Object.defineProperty(t,a,{enumerable:!0,get:r[a]});let n=e.r(32120),i=e.r(92245),l=e.r(35326)}]);
|