@hivemagnus/magnus-ui 3.6.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/.env.example +5 -4
  2. package/README.md +52 -4
  3. package/bin/magnus-ui.mjs +118 -2
  4. package/dist/app/apps/dashboard/.next/BUILD_ID +1 -1
  5. package/dist/app/apps/dashboard/.next/build-manifest.json +3 -3
  6. package/dist/app/apps/dashboard/.next/prerender-manifest.json +3 -3
  7. package/dist/app/apps/dashboard/.next/required-server-files.json +2 -16
  8. package/dist/app/apps/dashboard/.next/routes-manifest.json +9 -20
  9. package/dist/app/apps/dashboard/.next/server/app/_global-error.html +1 -1
  10. package/dist/app/apps/dashboard/.next/server/app/_global-error.rsc +1 -1
  11. package/dist/app/apps/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  12. package/dist/app/apps/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/dist/app/apps/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/dist/app/apps/dashboard/.next/server/app/_not-found/page.js.nft.json +1 -1
  15. package/dist/app/apps/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/dist/app/apps/dashboard/.next/server/app/anomalies/[anomalyId]/page.js.nft.json +1 -1
  17. package/dist/app/apps/dashboard/.next/server/app/anomalies/[anomalyId]/page_client-reference-manifest.js +1 -1
  18. package/dist/app/apps/dashboard/.next/server/app/anomalies/page.js.nft.json +1 -1
  19. package/dist/app/apps/dashboard/.next/server/app/anomalies/page_client-reference-manifest.js +1 -1
  20. package/dist/app/apps/dashboard/.next/server/app/anomalies/remediation/page.js.nft.json +1 -1
  21. package/dist/app/apps/dashboard/.next/server/app/anomalies/remediation/page_client-reference-manifest.js +1 -1
  22. package/dist/app/apps/dashboard/.next/server/app/api/auth/hive/callback/route.js.nft.json +1 -1
  23. package/dist/app/apps/dashboard/.next/server/app/api/auth/hive/configured/route.js.nft.json +1 -1
  24. package/dist/app/apps/dashboard/.next/server/app/api/auth/hive/start/route.js.nft.json +1 -1
  25. package/dist/app/apps/dashboard/.next/server/app/api/auth/login/route.js.nft.json +1 -1
  26. package/dist/app/apps/dashboard/.next/server/app/api/auth/logout/route.js +6 -5
  27. package/dist/app/apps/dashboard/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  28. package/dist/app/apps/dashboard/.next/server/app/api/auth/me/route.js.nft.json +1 -1
  29. package/dist/app/apps/dashboard/.next/server/app/api/control-nodes/[id]/route.js +2 -2
  30. package/dist/app/apps/dashboard/.next/server/app/api/control-nodes/[id]/route.js.nft.json +1 -1
  31. package/dist/app/apps/dashboard/.next/server/app/api/control-nodes/route.js +2 -2
  32. package/dist/app/apps/dashboard/.next/server/app/api/control-nodes/route.js.nft.json +1 -1
  33. package/dist/app/apps/dashboard/.next/server/app/api/federation/route.js +3 -3
  34. package/dist/app/apps/dashboard/.next/server/app/api/federation/route.js.nft.json +1 -1
  35. package/dist/app/apps/dashboard/.next/server/app/api/health/route.js.nft.json +1 -1
  36. package/dist/app/apps/dashboard/.next/server/app/api/hermes/dashboard/[[...path]]/route.js +8 -6
  37. package/dist/app/apps/dashboard/.next/server/app/api/hermes/dashboard/[[...path]]/route.js.nft.json +1 -1
  38. package/dist/app/apps/dashboard/.next/server/app/api/hive-router/dashboard/[[...path]]/route.js +7 -5
  39. package/dist/app/apps/dashboard/.next/server/app/api/hive-router/dashboard/[[...path]]/route.js.nft.json +1 -1
  40. package/dist/app/apps/dashboard/.next/server/app/api/proxy/[...path]/route.js +5 -5
  41. package/dist/app/apps/dashboard/.next/server/app/api/proxy/[...path]/route.js.nft.json +1 -1
  42. package/dist/app/apps/dashboard/.next/server/app/api/terminal/close/route.js.nft.json +1 -1
  43. package/dist/app/apps/dashboard/.next/server/app/api/terminal/input/route.js.nft.json +1 -1
  44. package/dist/app/apps/dashboard/.next/server/app/api/terminal/open/route.js +4 -4
  45. package/dist/app/apps/dashboard/.next/server/app/api/terminal/open/route.js.nft.json +1 -1
  46. package/dist/app/apps/dashboard/.next/server/app/api/terminal/resize/route.js.nft.json +1 -1
  47. package/dist/app/apps/dashboard/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
  48. package/dist/app/apps/dashboard/.next/server/app/api-docs/page.js.nft.json +1 -1
  49. package/dist/app/apps/dashboard/.next/server/app/api-docs/page_client-reference-manifest.js +1 -1
  50. package/dist/app/apps/dashboard/.next/server/app/application-operations/page.js.nft.json +1 -1
  51. package/dist/app/apps/dashboard/.next/server/app/application-operations/page_client-reference-manifest.js +1 -1
  52. package/dist/app/apps/dashboard/.next/server/app/ardent/installations/page.js.nft.json +1 -1
  53. package/dist/app/apps/dashboard/.next/server/app/ardent/installations/page_client-reference-manifest.js +1 -1
  54. package/dist/app/apps/dashboard/.next/server/app/ardent/page.js.nft.json +1 -1
  55. package/dist/app/apps/dashboard/.next/server/app/ardent/page_client-reference-manifest.js +1 -1
  56. package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/[id]/page.js.nft.json +1 -1
  57. package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/[id]/page_client-reference-manifest.js +1 -1
  58. package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/page.js.nft.json +1 -1
  59. package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/page_client-reference-manifest.js +1 -1
  60. package/dist/app/apps/dashboard/.next/server/app/audit/page.js +1 -1
  61. package/dist/app/apps/dashboard/.next/server/app/audit/page.js.nft.json +1 -1
  62. package/dist/app/apps/dashboard/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  63. package/dist/app/apps/dashboard/.next/server/app/codex/installations/page.js.nft.json +1 -1
  64. package/dist/app/apps/dashboard/.next/server/app/codex/installations/page_client-reference-manifest.js +1 -1
  65. package/dist/app/apps/dashboard/.next/server/app/codex/page.js.nft.json +1 -1
  66. package/dist/app/apps/dashboard/.next/server/app/codex/page_client-reference-manifest.js +1 -1
  67. package/dist/app/apps/dashboard/.next/server/app/commands/page.js.nft.json +1 -1
  68. package/dist/app/apps/dashboard/.next/server/app/commands/page_client-reference-manifest.js +1 -1
  69. package/dist/app/apps/dashboard/.next/server/app/cron/page/server-reference-manifest.json +1 -1
  70. package/dist/app/apps/dashboard/.next/server/app/cron/page.js +1 -1
  71. package/dist/app/apps/dashboard/.next/server/app/cron/page.js.nft.json +1 -1
  72. package/dist/app/apps/dashboard/.next/server/app/cron/page_client-reference-manifest.js +1 -1
  73. package/dist/app/apps/dashboard/.next/server/app/files/page.js.nft.json +1 -1
  74. package/dist/app/apps/dashboard/.next/server/app/files/page_client-reference-manifest.js +1 -1
  75. package/dist/app/apps/dashboard/.next/server/app/fleet-map/page.js.nft.json +1 -1
  76. package/dist/app/apps/dashboard/.next/server/app/fleet-map/page_client-reference-manifest.js +1 -1
  77. package/dist/app/apps/dashboard/.next/server/app/fleet-readiness/page.js +1 -1
  78. package/dist/app/apps/dashboard/.next/server/app/fleet-readiness/page.js.nft.json +1 -1
  79. package/dist/app/apps/dashboard/.next/server/app/fleet-readiness/page_client-reference-manifest.js +1 -1
  80. package/dist/app/apps/dashboard/.next/server/app/fleet-timeline/page.js +1 -1
  81. package/dist/app/apps/dashboard/.next/server/app/fleet-timeline/page.js.nft.json +1 -1
  82. package/dist/app/apps/dashboard/.next/server/app/fleet-timeline/page_client-reference-manifest.js +1 -1
  83. package/dist/app/apps/dashboard/.next/server/app/governor/operations/page.js.nft.json +1 -1
  84. package/dist/app/apps/dashboard/.next/server/app/governor/operations/page_client-reference-manifest.js +1 -1
  85. package/dist/app/apps/dashboard/.next/server/app/hermes-drift/page.js +1 -1
  86. package/dist/app/apps/dashboard/.next/server/app/hermes-drift/page.js.nft.json +1 -1
  87. package/dist/app/apps/dashboard/.next/server/app/hermes-drift/page_client-reference-manifest.js +1 -1
  88. package/dist/app/apps/dashboard/.next/server/app/hermes-security/page.js.nft.json +1 -1
  89. package/dist/app/apps/dashboard/.next/server/app/hermes-security/page_client-reference-manifest.js +1 -1
  90. package/dist/app/apps/dashboard/.next/server/app/incidents/page.js +1 -1
  91. package/dist/app/apps/dashboard/.next/server/app/incidents/page.js.nft.json +1 -1
  92. package/dist/app/apps/dashboard/.next/server/app/incidents/page_client-reference-manifest.js +1 -1
  93. package/dist/app/apps/dashboard/.next/server/app/library/page.js +1 -1
  94. package/dist/app/apps/dashboard/.next/server/app/library/page.js.nft.json +1 -1
  95. package/dist/app/apps/dashboard/.next/server/app/library/page_client-reference-manifest.js +1 -1
  96. package/dist/app/apps/dashboard/.next/server/app/login/page.js.nft.json +1 -1
  97. package/dist/app/apps/dashboard/.next/server/app/login/page_client-reference-manifest.js +1 -1
  98. package/dist/app/apps/dashboard/.next/server/app/logs/page.js.nft.json +1 -1
  99. package/dist/app/apps/dashboard/.next/server/app/logs/page_client-reference-manifest.js +1 -1
  100. package/dist/app/apps/dashboard/.next/server/app/mission-control/page.js +1 -1
  101. package/dist/app/apps/dashboard/.next/server/app/mission-control/page.js.nft.json +1 -1
  102. package/dist/app/apps/dashboard/.next/server/app/mission-control/page_client-reference-manifest.js +1 -1
  103. package/dist/app/apps/dashboard/.next/server/app/nodes/[nodeId]/page.js.nft.json +1 -1
  104. package/dist/app/apps/dashboard/.next/server/app/nodes/[nodeId]/page_client-reference-manifest.js +1 -1
  105. package/dist/app/apps/dashboard/.next/server/app/nodes/page.js +1 -1
  106. package/dist/app/apps/dashboard/.next/server/app/nodes/page.js.nft.json +1 -1
  107. package/dist/app/apps/dashboard/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
  108. package/dist/app/apps/dashboard/.next/server/app/notifications/page.js.nft.json +1 -1
  109. package/dist/app/apps/dashboard/.next/server/app/notifications/page_client-reference-manifest.js +1 -1
  110. package/dist/app/apps/dashboard/.next/server/app/orchestra/installations/page.js.nft.json +1 -1
  111. package/dist/app/apps/dashboard/.next/server/app/orchestra/installations/page_client-reference-manifest.js +1 -1
  112. package/dist/app/apps/dashboard/.next/server/app/orchestra/page.js.nft.json +1 -1
  113. package/dist/app/apps/dashboard/.next/server/app/orchestra/page_client-reference-manifest.js +1 -1
  114. package/dist/app/apps/dashboard/.next/server/app/orchestra/profiles/page.js.nft.json +1 -1
  115. package/dist/app/apps/dashboard/.next/server/app/orchestra/profiles/page_client-reference-manifest.js +1 -1
  116. package/dist/app/apps/dashboard/.next/server/app/orchestra/web-gateway/page.js.nft.json +1 -1
  117. package/dist/app/apps/dashboard/.next/server/app/orchestra/web-gateway/page_client-reference-manifest.js +1 -1
  118. package/dist/app/apps/dashboard/.next/server/app/page.js +1 -1
  119. package/dist/app/apps/dashboard/.next/server/app/page.js.nft.json +1 -1
  120. package/dist/app/apps/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
  121. package/dist/app/apps/dashboard/.next/server/app/retention/page.js +1 -1
  122. package/dist/app/apps/dashboard/.next/server/app/retention/page.js.nft.json +1 -1
  123. package/dist/app/apps/dashboard/.next/server/app/retention/page_client-reference-manifest.js +1 -1
  124. package/dist/app/apps/dashboard/.next/server/app/roles/page.js +1 -1
  125. package/dist/app/apps/dashboard/.next/server/app/roles/page.js.nft.json +1 -1
  126. package/dist/app/apps/dashboard/.next/server/app/roles/page_client-reference-manifest.js +1 -1
  127. package/dist/app/apps/dashboard/.next/server/app/rollouts/page.js.nft.json +1 -1
  128. package/dist/app/apps/dashboard/.next/server/app/rollouts/page_client-reference-manifest.js +1 -1
  129. package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/[caseId]/page.js.nft.json +1 -1
  130. package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/[caseId]/page_client-reference-manifest.js +1 -1
  131. package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/page.js.nft.json +1 -1
  132. package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/page_client-reference-manifest.js +1 -1
  133. package/dist/app/apps/dashboard/.next/server/app/security-fusion/entities/page.js.nft.json +1 -1
  134. package/dist/app/apps/dashboard/.next/server/app/security-fusion/entities/page_client-reference-manifest.js +1 -1
  135. package/dist/app/apps/dashboard/.next/server/app/security-fusion/events/page.js.nft.json +1 -1
  136. package/dist/app/apps/dashboard/.next/server/app/security-fusion/events/page_client-reference-manifest.js +1 -1
  137. package/dist/app/apps/dashboard/.next/server/app/security-fusion/evidence/page.js.nft.json +1 -1
  138. package/dist/app/apps/dashboard/.next/server/app/security-fusion/evidence/page_client-reference-manifest.js +1 -1
  139. package/dist/app/apps/dashboard/.next/server/app/security-fusion/page.js +1 -1
  140. package/dist/app/apps/dashboard/.next/server/app/security-fusion/page.js.nft.json +1 -1
  141. package/dist/app/apps/dashboard/.next/server/app/security-fusion/page_client-reference-manifest.js +1 -1
  142. package/dist/app/apps/dashboard/.next/server/app/security-fusion/policies/page.js.nft.json +1 -1
  143. package/dist/app/apps/dashboard/.next/server/app/security-fusion/policies/page_client-reference-manifest.js +1 -1
  144. package/dist/app/apps/dashboard/.next/server/app/security-fusion/sources/page.js.nft.json +1 -1
  145. package/dist/app/apps/dashboard/.next/server/app/security-fusion/sources/page_client-reference-manifest.js +1 -1
  146. package/dist/app/apps/dashboard/.next/server/app/skills/page/server-reference-manifest.json +1 -1
  147. package/dist/app/apps/dashboard/.next/server/app/skills/page.js +1 -1
  148. package/dist/app/apps/dashboard/.next/server/app/skills/page.js.nft.json +1 -1
  149. package/dist/app/apps/dashboard/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  150. package/dist/app/apps/dashboard/.next/server/app/webhooks/[id]/page.js.nft.json +1 -1
  151. package/dist/app/apps/dashboard/.next/server/app/webhooks/[id]/page_client-reference-manifest.js +1 -1
  152. package/dist/app/apps/dashboard/.next/server/app/webhooks/new/page.js.nft.json +1 -1
  153. package/dist/app/apps/dashboard/.next/server/app/webhooks/new/page_client-reference-manifest.js +1 -1
  154. package/dist/app/apps/dashboard/.next/server/app/webhooks/page.js.nft.json +1 -1
  155. package/dist/app/apps/dashboard/.next/server/app/webhooks/page_client-reference-manifest.js +1 -1
  156. package/dist/app/apps/dashboard/.next/server/chunks/{[externals]__0lufsyh_0gqup._.js → [externals]__1k43kg5-icx7b._.js} +1 -1
  157. package/dist/app/apps/dashboard/.next/server/chunks/{[root-of-the-server]__0vzssf5bgd660._.js → [root-of-the-server]__0ndj_rhwp_6vf._.js} +1 -1
  158. package/dist/app/apps/dashboard/.next/server/chunks/[root-of-the-server]__0ywmf3079vsm1._.js +1 -1
  159. package/dist/app/apps/dashboard/.next/server/chunks/{[root-of-the-server]__05vapur0p6d-l._.js → [root-of-the-server]__15_4jl4ba_7y3._.js} +1 -1
  160. package/dist/app/apps/dashboard/.next/server/chunks/{[root-of-the-server]__0iiv9pxo2yauj._.js → [root-of-the-server]__1cxla67mqwfdr._.js} +1 -1
  161. package/dist/app/apps/dashboard/.next/server/chunks/{[root-of-the-server]__0fwm7idn_76uf._.js → [root-of-the-server]__1rrn6p9afghbt._.js} +1 -1
  162. package/dist/app/apps/dashboard/.next/server/chunks/{[root-of-the-server]__0ioimsx71gr0o._.js → [root-of-the-server]__1wj2nw17pv5g8._.js} +1 -1
  163. package/dist/app/apps/dashboard/.next/server/chunks/_0jvoc4-ta3zc0._.js +1 -1
  164. package/dist/app/apps/dashboard/.next/server/chunks/_0oj6_-g5b2lvi._.js +1 -1
  165. package/dist/app/apps/dashboard/.next/server/chunks/_0rwz3f0jh1ty0._.js +1 -1
  166. package/dist/app/apps/dashboard/.next/server/chunks/_0s788ryrplkp6._.js +1 -1
  167. package/dist/app/apps/dashboard/.next/server/chunks/_1-ntqfqk_4-f0._.js +1 -1
  168. package/dist/app/apps/dashboard/.next/server/chunks/_120rsoc_nc7_3._.js +1 -1
  169. package/dist/app/apps/dashboard/.next/server/chunks/_1ilhtkg33m99h._.js +1 -1
  170. package/dist/app/apps/dashboard/.next/server/chunks/_1xodprib7qa_j._.js +2 -2
  171. package/dist/app/apps/dashboard/.next/server/chunks/apps_dashboard_runtime-embed-isolation_mjs_1ovehd-pl97ex._.js +3 -0
  172. package/dist/app/apps/dashboard/.next/server/chunks/apps_dashboard_src_lib_auth_ts_1hhq1tq6hjj-e._.js +2 -2
  173. package/dist/app/apps/dashboard/.next/server/chunks/apps_dashboard_src_lib_control-nodes-store_ts_01hjyte7nc7l2._.js +3 -2
  174. package/dist/app/apps/dashboard/.next/server/chunks/apps_dashboard_src_lib_embedded-frame_ts_1dw1tog69m3ap._.js +3 -0
  175. package/dist/app/apps/dashboard/.next/server/chunks/apps_dashboard_src_lib_hive-login_ts_0ab2iq7-rpy13._.js +1 -1
  176. package/dist/app/apps/dashboard/.next/server/chunks/ssr/[root-of-the-server]__02wumq04h7-2m._.js +1 -1
  177. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1koj-a25tcc9z._.js → [root-of-the-server]__0az7ayfxt936j._.js} +2 -2
  178. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__02rfo46o0ocq7._.js → [root-of-the-server]__0cbjirfjkahyz._.js} +1 -1
  179. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__0l7okklk-ix9t._.js → [root-of-the-server]__0mtl30w3r3d8n._.js} +1 -1
  180. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1w1bkuf_-8zxm._.js → [root-of-the-server]__0n1mehgazoyys._.js} +1 -1
  181. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1y4za7l5ph9o-._.js → [root-of-the-server]__0piptu4qrcax4._.js} +1 -1
  182. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__0neu-iblb1_-5._.js → [root-of-the-server]__0qoxqg_z229qc._.js} +1 -1
  183. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1jb0a4bkg6dd1._.js → [root-of-the-server]__0yvtveej1dtd6._.js} +1 -1
  184. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__000ndthd0hd5v._.js → [root-of-the-server]__0zftzxoekcfyw._.js} +1 -1
  185. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__202zczfuwkbzi._.js → [root-of-the-server]__15i5sz08w-tg0._.js} +1 -1
  186. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1ria97bl22vsq._.js → [root-of-the-server]__18k_-53xs-qpk._.js} +2 -2
  187. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1jtg9fc0ny1cg._.js → [root-of-the-server]__1cesdboqyg7rq._.js} +1 -1
  188. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1wsrd6m1h8q7q._.js → [root-of-the-server]__1p0rsbsf87odz._.js} +1 -1
  189. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1l8__2gqqi590._.js → [root-of-the-server]__1un9oi8-bokqt._.js} +1 -1
  190. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1gwofuehw8lyc._.js → [root-of-the-server]__206hwh476sy80._.js} +1 -1
  191. package/dist/app/apps/dashboard/.next/server/chunks/ssr/_07u8d93e_m_yo._.js +3 -2
  192. package/dist/app/apps/dashboard/.next/server/chunks/ssr/_0caxc2bc6a__r._.js +1 -1
  193. package/dist/app/apps/dashboard/.next/server/chunks/ssr/_1oebzzj_en62h._.js +1 -1
  194. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_runtime-environment_mjs_11tpywm9_soif._.js +1 -1
  195. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_0gs_s688kgg1i._.js +1 -1
  196. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_anomalies_remediation_page_tsx_179m33swiclif._.js +1 -1
  197. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_ardent_installations_page_tsx_0nvqgacugy6nf._.js +1 -1
  198. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_audit_audit-client_tsx_0iyab_tlw5yus._.js +1 -1
  199. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_cron_page_tsx_1i3duyygc0_tg._.js +1 -1
  200. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_files_page_tsx_1kls9-qinldks._.js +1 -1
  201. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_governor_operations_page_tsx_1tvdkgil8mlgk._.js +1 -1
  202. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_login_page_tsx_12_rihimtav2a._.js +1 -1
  203. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_logs_page_tsx_0473-hcpj1mqr._.js +1 -1
  204. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_mission-control_page_tsx_0crgxncex_u3w._.js +1 -1
  205. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_nodes_[nodeId]_page_tsx_1q7fqu18oklzc._.js +1 -1
  206. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_nodes_nodes-client_tsx_0pt4iarhpqbgn._.js +1 -1
  207. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_orchestra_web-gateway_page_tsx_1fz12np0wk27t._.js +1 -1
  208. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_security-fusion_page_tsx_0d314q7yh6fx8._.js +1 -1
  209. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_skills_page_tsx_0n5zp4xad38in._.js +1 -1
  210. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_webhooks_webhook-form_tsx_02z3be5wx7-cb._.js +1 -1
  211. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_components_ui_card_tsx_1pngl2ib-xo5t._.js +1 -1
  212. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_components_ui_node-selector_tsx_1ci6ldznpaofq._.js +1 -1
  213. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_lib_api-client_ts_0tho-kkk5ez7h._.js +1 -1
  214. package/dist/app/apps/dashboard/.next/server/middleware-build-manifest.js +3 -3
  215. package/dist/app/apps/dashboard/.next/server/pages/500.html +1 -1
  216. package/dist/app/apps/dashboard/.next/server/preview-props.json +3 -3
  217. package/dist/app/apps/dashboard/.next/server/server-reference-manifest.js +1 -1
  218. package/dist/app/apps/dashboard/.next/server/server-reference-manifest.json +3 -3
  219. package/dist/app/apps/dashboard/.next/static/chunks/{369vzlcjad-gn.js → 017x1uhn9l7nw.js} +1 -1
  220. package/dist/app/apps/dashboard/.next/static/chunks/{1-vn8cqro-f08.js → 06_2psos--paq.js} +1 -1
  221. package/dist/app/apps/dashboard/.next/static/chunks/0i8g96dmx-fbo.css +2 -0
  222. package/dist/app/apps/dashboard/.next/static/chunks/0nalo72r7vipw.js +1 -0
  223. package/dist/app/apps/dashboard/.next/static/chunks/0pswbe-19xxl5.js +1 -0
  224. package/dist/app/apps/dashboard/.next/static/chunks/{3ntnj6ts2r3e2.js → 0s2skhp7086pc.js} +1 -1
  225. package/dist/app/apps/dashboard/.next/static/chunks/{0nekvgtqt8goj.js → 0zsp_alwy1f3v.js} +1 -1
  226. package/dist/app/apps/dashboard/.next/static/chunks/1fpi73pmpn8v5.js +1 -0
  227. package/dist/app/apps/dashboard/.next/static/chunks/1gko0bkguj_g0.js +1 -0
  228. package/dist/app/apps/dashboard/.next/static/chunks/{0lxf5l-ugq-09.js → 1t6g3-pjlavb5.js} +1 -1
  229. package/dist/app/apps/dashboard/.next/static/chunks/{1bn40ef0zair9.js → 1ygangs-zn4yl.js} +1 -1
  230. package/dist/app/apps/dashboard/.next/static/chunks/2_eadjwf4989d.js +1 -0
  231. package/dist/app/apps/dashboard/.next/static/chunks/2fzv4_us4q1w_.js +1 -0
  232. package/dist/app/apps/dashboard/.next/static/chunks/{1cvbtmsr4d3ci.js → 2isl5q2zhjwiw.js} +1 -1
  233. package/dist/app/apps/dashboard/.next/static/chunks/2jaw-lni6k_dt.js +1 -0
  234. package/dist/app/apps/dashboard/.next/static/chunks/2sh8fn_vg-vs5.js +1 -0
  235. package/dist/app/apps/dashboard/.next/static/chunks/{1kx48jg-4j5iv.js → 2u4_fj_v8i521.js} +2 -2
  236. package/dist/app/apps/dashboard/.next/static/chunks/{0d6kculhmue59.js → 2zj24fir1fm27.js} +1 -1
  237. package/dist/app/apps/dashboard/.next/static/chunks/{3w-7xko96ljib.js → 2zjjqqg5z63sl.js} +1 -1
  238. package/dist/app/apps/dashboard/.next/static/chunks/337js55ro9g08.js +1 -0
  239. package/dist/app/apps/dashboard/.next/static/chunks/{37kstof-v-jwi.js → 33xay7yclh_jd.js} +1 -1
  240. package/dist/app/apps/dashboard/.next/static/chunks/34yff9n0mbd1h.js +1 -0
  241. package/dist/app/apps/dashboard/.next/static/chunks/{05p7s0xtb3koa.js → 3eo_31lzj51v9.js} +1 -1
  242. package/dist/app/apps/dashboard/.next/static/chunks/{12ju76tjcqh_z.js → 3f73kvi1pwabq.js} +4 -4
  243. package/dist/app/apps/dashboard/.next/static/chunks/{23o8zfgrdxuhk.js → 3kh386y5gla53.js} +1 -1
  244. package/dist/app/apps/dashboard/.next/static/chunks/3mwn69j8d-q9v.js +4 -0
  245. package/dist/app/apps/dashboard/.next/static/chunks/3p_wvl3sieoi4.js +1 -0
  246. package/dist/app/apps/dashboard/.next/static/chunks/{0yb36s9l-f3_w.js → 3qrrim22gq-vp.js} +1 -1
  247. package/dist/app/apps/dashboard/.next/static/chunks/3ui3xvxcdyc0r.js +1 -0
  248. package/dist/app/apps/dashboard/.next/static/chunks/3ya4-24grz_0f.js +1 -0
  249. package/dist/app/apps/dashboard/.next/static/chunks/{37pb0l96d03rk.js → 42j6wpibe0zrn.js} +1 -1
  250. package/dist/app/apps/dashboard/.next/static/chunks/4369o9c3gezxt.js +6 -0
  251. package/dist/app/apps/dashboard/.next/static/rWpgppq64sqgeZO3-MlD1/_buildManifest.js +11 -0
  252. package/dist/app/apps/dashboard/package.json +3 -2
  253. package/dist/app/apps/dashboard/runtime-control-node-credentials.mjs +638 -0
  254. package/dist/app/apps/dashboard/runtime-embed-isolation.mjs +450 -0
  255. package/dist/app/apps/dashboard/runtime-environment.mjs +1 -1
  256. package/dist/app/apps/dashboard/runtime-integrations.mjs +4 -4
  257. package/dist/app/apps/dashboard/server-tls.mjs +96 -47
  258. package/dist/app/apps/dashboard/server.js +1 -1
  259. package/npm-shrinkwrap.json +4 -3
  260. package/package.json +3 -2
  261. package/dist/app/apps/dashboard/.next/static/IOi-LmbFghqZcllGm0tny/_buildManifest.js +0 -20
  262. package/dist/app/apps/dashboard/.next/static/chunks/015s19fe5dtkp.css +0 -2
  263. package/dist/app/apps/dashboard/.next/static/chunks/06xzeulnw897e.js +0 -1
  264. package/dist/app/apps/dashboard/.next/static/chunks/07tx3h4lr-lxl.js +0 -6
  265. package/dist/app/apps/dashboard/.next/static/chunks/0j0dzrd0ev-gx.js +0 -1
  266. package/dist/app/apps/dashboard/.next/static/chunks/1-pj3rx01kcq0.js +0 -4
  267. package/dist/app/apps/dashboard/.next/static/chunks/1j5vpju4k1wlj.js +0 -1
  268. package/dist/app/apps/dashboard/.next/static/chunks/1kjl44-64ume7.js +0 -1
  269. package/dist/app/apps/dashboard/.next/static/chunks/28zpgt1trm_m4.js +0 -1
  270. package/dist/app/apps/dashboard/.next/static/chunks/2lk4ailve7631.js +0 -1
  271. package/dist/app/apps/dashboard/.next/static/chunks/2lulmsr2vjuw5.js +0 -1
  272. package/dist/app/apps/dashboard/.next/static/chunks/30npcziw-f8ld.js +0 -1
  273. package/dist/app/apps/dashboard/.next/static/chunks/31hx4x8k9707e.js +0 -1
  274. package/dist/app/apps/dashboard/.next/static/chunks/34mzv0h7jkx20.js +0 -1
  275. package/dist/app/apps/dashboard/.next/static/chunks/3cw8xs2dab1g-.js +0 -1
  276. package/dist/app/apps/dashboard/.next/static/chunks/3gjll_bse9v1f.js +0 -1
  277. package/dist/app/apps/dashboard/.next/static/chunks/3qq-otw-t-6b0.js +0 -1
  278. /package/dist/app/apps/dashboard/.next/static/{IOi-LmbFghqZcllGm0tny → rWpgppq64sqgeZO3-MlD1}/_clientMiddlewareManifest.js +0 -0
  279. /package/dist/app/apps/dashboard/.next/static/{IOi-LmbFghqZcllGm0tny → rWpgppq64sqgeZO3-MlD1}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,12246,e=>{"use strict";var t=e.i(43476),r=e.i(71645),a=e.i(75775),s=e.i(90985),n=e.i(9041),i=e.i(83902),l=e.i(82983),o=e.i(93999),d=e.i(46670),c=e.i(32568),x=e.i(63376),m=e.i(82022),h=e.i(21357),u=e.i(57665),p=e.i(56420);let b={name:"refresh-ccw",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"}]]};b.node;let g=(0,p.f)(b);var f=e.i(95925);function v(e){return`${e}${e.includes("?")?"&":"?"}mint=json`}function w(e){return e.displayName??e.hostname}function j({installation:e,frameSrc:a,frameTitle:s,heightClass:i="h-[720px]",emptyMessage:o="Select a Hermes installation with dashboard access."}){let[c,x]=(0,r.useState)(null),p=(0,r.useRef)(null),[b,y]=(0,r.useState)(null),[N,k]=(0,r.useState)(null),[M,S]=(0,r.useState)(null);(0,r.useEffect)(()=>{x(null),k(null),S(null)},[e?.id,a]),(0,r.useEffect)(()=>{if(c&&p.current&&a){var e,t,r;let s,n,i,l;return e=p.current,t=v(a),r=c.grant,s=e=>{try{let t=e.split(".")[1]??"",r=JSON.parse(atob(t.replace(/-/g,"+").replace(/_/g,"/")));return"string"==typeof r.sid?JSON.stringify([r.app,r.sid,r.ins??null]):null}catch{return null}},n=r,i=!1,l=r=>{if(r.source!==e.contentWindow||"null"!==r.origin||i)return;let a=r.data;if(!a||"magnus-frame-refresh"!==a.type||"string"!=typeof a.grant)return;let l=s(n);if(!l||s(a.grant)!==l)return;let o=r.source;i=!0,fetch(t,{credentials:"same-origin",cache:"no-store"}).then(e=>e.status>=400&&e.status<500?(o.postMessage({type:"magnus-frame-refused"},"*"),null):e.ok?e.json():null).then(e=>{e&&"string"==typeof e.grant&&(n=e.grant,o.postMessage({type:"magnus-frame-grant",grant:n},"*"))}).catch(()=>void 0).finally(()=>{i=!1})},window.addEventListener("message",l),()=>window.removeEventListener("message",l)}},[c,a]);let _=!!(e&&a);async function E(){if(_){S(null);try{let e=await fetch(v(a),{credentials:"same-origin",cache:"no-store"}),t=await e.json().catch(()=>null);if(!e.ok||!t?.grant||!t.frameUrl)throw Error(t?.error??`Dashboard frame unavailable (${e.status})`);x({url:t.frameUrl,grant:t.grant})}catch(e){S(e instanceof Error?e.message:"Dashboard frame unavailable")}}}async function I(t,r=!1){if(e){y(t),S(null),k(null);try{let a=await l.f.hermes.dashboardAction(e.id,t),s=a.data?.id?` Job ${a.data.id.slice(0,8)} queued.`:"";k(`${"launch"===t?"Launch":t} requested for ${w(e)}.${s}`),r&&window.setTimeout(()=>void E(),2500)}catch(e){S(e instanceof Error?e.message:`Failed to ${t} Hermes Dashboard`)}finally{y(null)}}}return e?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded border border-border/50 bg-bg/50 p-3",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider text-text",children:w(e)}),(0,t.jsxs)(d.t,{variant:(0,d.k)(e.dashboardStatus),children:["dashboard ",e.dashboardStatus]}),(0,t.jsxs)("span",{className:"rounded border border-border px-2 py-1 font-mono text-[10px] text-text-muted",children:["127.0.0.1:",e.dashboardPort]})]}),(0,t.jsx)("p",{className:"mt-1 truncate text-[11px] text-text-muted",children:e.hostname})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>void I("launch",!0),disabled:null!==b,className:"inline-flex h-8 items-center justify-center gap-2 rounded border border-primary/60 bg-primary/10 px-3 text-[11px] font-bold uppercase tracking-wider text-primary transition-all hover:bg-primary/20 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,t.jsx)(h.f,{className:"h-3.5 w-3.5"}),"Launch"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>void I("start"),disabled:null!==b,className:"inline-flex h-8 items-center justify-center gap-2 rounded border border-border bg-surface px-3 text-[11px] font-bold uppercase tracking-wider text-text-muted transition-all hover:border-success/50 hover:text-success disabled:cursor-not-allowed disabled:opacity-50",children:[(0,t.jsx)(u.f,{className:"h-3.5 w-3.5"}),"Start"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>void I("restart",!0),disabled:null!==b,className:"inline-flex h-8 items-center justify-center gap-2 rounded border border-border bg-surface px-3 text-[11px] font-bold uppercase tracking-wider text-text-muted transition-all hover:border-accent/50 hover:text-accent disabled:cursor-not-allowed disabled:opacity-50",children:[(0,t.jsx)(f.f,{className:"h-3.5 w-3.5"}),"Restart"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>void E(),disabled:!_||null!==b,className:"inline-flex h-8 items-center justify-center gap-2 rounded border border-border bg-surface px-3 text-[11px] font-bold uppercase tracking-wider text-text-muted transition-all hover:border-primary/50 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",children:[(0,t.jsx)(n.f,{className:"h-3.5 w-3.5"}),"Connect Frame"]}),a&&(0,t.jsxs)("a",{href:a,target:"_blank",rel:"noreferrer",className:"inline-flex h-8 items-center justify-center gap-2 rounded border border-border bg-surface px-3 text-[11px] font-bold uppercase tracking-wider text-text-muted transition-all hover:border-accent/50 hover:text-accent",children:[(0,t.jsx)(m.f,{className:"h-3.5 w-3.5"}),"Open"]})]})]}),(N||M||b)&&(0,t.jsx)("div",{className:`rounded border px-3 py-2 text-[11px] ${M?"border-danger/40 bg-danger/10 text-danger":"border-primary/30 bg-primary/10 text-primary"}`,children:M??(b?`${b} requested...`:N)}),c?(0,t.jsx)("div",{className:"overflow-hidden rounded border border-border/50 bg-bg",children:(0,t.jsx)("iframe",{ref:p,title:s,src:c.url,className:`${i} w-full bg-bg`,sandbox:"allow-scripts allow-forms allow-popups allow-downloads",referrerPolicy:"no-referrer"})}):(0,t.jsxs)("div",{className:"flex min-h-72 flex-col items-center justify-center rounded border border-border/50 bg-bg/40 p-8 text-center",children:[(0,t.jsx)(n.f,{className:"mb-3 h-6 w-6 text-primary"}),(0,t.jsx)("p",{className:"text-xs font-bold uppercase tracking-wider text-text",children:"Dashboard frame is idle"}),(0,t.jsx)("p",{className:"mt-2 max-w-xl text-[11px] leading-5 text-text-muted",children:"Launch or start the Hermes Dashboard on the selected agent, then connect the Magnus frame once the remote service is up."}),(0,t.jsxs)("button",{type:"button",onClick:()=>void I("launch",!0),disabled:null!==b,className:"mt-4 inline-flex h-8 items-center justify-center gap-2 rounded border border-primary/60 bg-primary/10 px-3 text-[11px] font-bold uppercase tracking-wider text-primary transition-all hover:bg-primary/20 disabled:cursor-not-allowed disabled:opacity-50",children:[b?(0,t.jsx)(g,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(h.f,{className:"h-3.5 w-3.5"}),"Launch And Connect"]})]})]}):(0,t.jsx)("div",{className:"rounded border border-border/50 bg-bg/40 p-8 text-center text-xs text-text-muted",children:o})}function y(e){return e.displayName??e.hostname}function N(e){return"running"===e.status&&"running"===e.dashboardStatus?0:"running"===e.dashboardStatus?1:"running"===e.status||"detected"===e.status?2:3}e.s(["default",0,function(){var e;let[m,h]=(0,r.useState)([]),[u,p]=(0,r.useState)(""),[b,g]=(0,r.useState)(!0),[f,v]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=!0;return async function(){g(!0),v(null);try{let t=(await l.f.hermes.installations()).data??[];if(!e)return;h(t);let r=new URLSearchParams(window.location.search).get("installationId"),a=t.find(e=>e.id===r)??t.find(e=>"running"===e.dashboardStatus)??t[0];a&&p(e=>e||a.id)}catch(t){e&&v(t instanceof Error?t.message:"Failed to load Hermes installations")}finally{e&&g(!1)}}(),()=>{e=!1}},[]);let w=(0,r.useMemo)(()=>m.find(e=>e.id===u)??null,[m,u]),k=(0,r.useMemo)(()=>[...m].sort((e,t)=>N(e)-N(t)||y(e).localeCompare(y(t))),[m]),M=u?`/api/hermes/dashboard?installationId=${encodeURIComponent(u)}`:"",S=m.filter(e=>"running"===e.dashboardStatus).length;return(0,t.jsxs)(x.U,{className:"space-y-6",children:[(0,t.jsx)(x.z,{children:(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-lg font-bold uppercase tracking-wider text-primary",children:"Web Gateway"}),(0,t.jsx)("p",{className:"mt-1 text-[11px] uppercase tracking-wider text-text-muted",children:"Redirect the selected Hermes Agent dashboard gateway through the Magnus UI frame."})]}),(0,t.jsxs)("a",{href:"https://hermes-agent.nousresearch.com/docs/user-guide/features/dashboard",target:"_blank",rel:"noreferrer",className:"inline-flex h-8 items-center justify-center gap-2 rounded border border-border bg-surface px-3 text-[11px] font-bold uppercase tracking-wider text-text-muted transition-all hover:border-accent/50 hover:text-accent",children:[(0,t.jsx)(a.f,{className:"h-3.5 w-3.5"}),"Docs"]})]})}),f&&(0,t.jsx)(x.z,{children:(0,t.jsx)(o.N,{children:(0,t.jsxs)("div",{className:"flex items-center gap-3 text-sm text-danger",children:[(0,t.jsx)(i.f,{className:"h-4 w-4"}),f]})})}),(0,t.jsx)(x.z,{children:(0,t.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,t.jsx)(o.N,{title:"Installations",children:(0,t.jsx)("div",{className:"text-2xl font-bold text-text",children:b?"-":m.length})}),(0,t.jsx)(o.N,{title:"Dashboards",children:(0,t.jsx)("div",{className:"text-2xl font-bold text-success",children:S})}),(0,t.jsx)(o.N,{title:"Selected",children:(0,t.jsx)("div",{className:"truncate text-2xl font-bold text-text",children:w?y(w):"-"})}),(0,t.jsx)(o.N,{title:"Port",children:(0,t.jsx)("div",{className:"font-mono text-2xl font-bold text-text",children:w?.dashboardPort??"-"})})]})}),(0,t.jsx)(x.z,{children:(0,t.jsxs)(o.N,{title:"Gateway Target",description:"Select the Hermes installation whose web dashboard should be started and framed.",children:[(0,t.jsxs)("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(240px,0.7fr)]",children:[(0,t.jsx)(c.G,{label:"Installation",children:(0,t.jsx)("select",{"aria-label":"Installation",className:c.N,value:u,onChange:e=>p(e.target.value),children:k.map(e=>(0,t.jsxs)("option",{value:e.id,children:[y(e)," (",e.hostname,") · dashboard ",e.dashboardStatus," · ",e.status]},e.id))})}),(0,t.jsx)("div",{className:"flex flex-wrap items-end gap-2 pb-0.5 text-[11px] text-text-muted",children:w&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(d.t,{variant:(0,d.k)(w.dashboardStatus),children:["dashboard ",w.dashboardStatus]}),(0,t.jsxs)(d.t,{variant:(0,d.k)(w.gatewayStatus),children:["gateway ",w.gatewayStatus]}),(0,t.jsxs)("span",{className:"rounded border border-border px-2 py-1 font-mono",children:["127.0.0.1:",w.dashboardPort]})]})})]}),w&&(0,t.jsxs)("div",{className:"mt-3 grid gap-2 text-[11px] text-text-muted md:grid-cols-3",children:[(0,t.jsxs)("div",{className:"rounded border border-border/50 bg-bg/50 p-3",children:[(0,t.jsx)("span",{className:"block uppercase tracking-wider text-text-muted/70",children:"Host"}),(0,t.jsx)("span",{className:"font-mono text-text",children:w.hostname})]}),(0,t.jsxs)("div",{className:"rounded border border-border/50 bg-bg/50 p-3",children:[(0,t.jsx)("span",{className:"block uppercase tracking-wider text-text-muted/70",children:"Home"}),(0,t.jsx)("span",{className:"font-mono text-text",children:w.hermesHome})]}),(0,t.jsxs)("div",{className:"rounded border border-border/50 bg-bg/50 p-3",children:[(0,t.jsx)("span",{className:"block uppercase tracking-wider text-text-muted/70",children:"Synced"}),(0,t.jsx)("span",{className:"text-text",children:(e=w.lastSyncedAt)?new Date(e).toLocaleString():"never"})]})]})]})}),(0,t.jsx)(x.z,{children:(0,t.jsx)(o.N,{title:"Hermes Web Gateway",description:"Launch the remote dashboard process and connect the full Hermes gateway into Magnus when it is ready.",children:(0,t.jsx)(j,{installation:w,frameSrc:M,frameTitle:"Hermes Web Gateway",heightClass:"h-[780px]",emptyMessage:"Select a Hermes installation to open the web gateway."})})}),(0,t.jsx)(x.z,{children:(0,t.jsx)(o.N,{title:"Connection Model",description:"Magnus proxies the selected remote dashboard over SSH and allows same-origin framing for this route.",children:(0,t.jsxs)("div",{className:"grid gap-3 md:grid-cols-3",children:[(0,t.jsxs)("div",{className:"rounded border border-border/50 bg-bg/50 p-3",children:[(0,t.jsx)(s.f,{className:"mb-2 h-4 w-4 text-primary"}),(0,t.jsx)("p",{className:"text-xs font-bold uppercase tracking-wider text-text",children:"Whole gateway"}),(0,t.jsx)("p",{className:"mt-1 text-[11px] leading-5 text-text-muted",children:"The root Hermes dashboard is framed, so native dashboard navigation stays inside Magnus."})]}),(0,t.jsxs)("div",{className:"rounded border border-border/50 bg-bg/50 p-3",children:[(0,t.jsx)(n.f,{className:"mb-2 h-4 w-4 text-primary"}),(0,t.jsx)("p",{className:"text-xs font-bold uppercase tracking-wider text-text",children:"Remote launch"}),(0,t.jsx)("p",{className:"mt-1 text-[11px] leading-5 text-text-muted",children:"The launch action starts the dashboard command on the target Hermes host before connecting the frame."})]}),(0,t.jsxs)("div",{className:"rounded border border-border/50 bg-bg/50 p-3",children:[(0,t.jsx)(i.f,{className:"mb-2 h-4 w-4 text-primary"}),(0,t.jsx)("p",{className:"text-xs font-bold uppercase tracking-wider text-text",children:"Frame headers"}),(0,t.jsx)("p",{className:"mt-1 text-[11px] leading-5 text-text-muted",children:"Only the Hermes dashboard proxy path permits same-origin iframe embedding."})]})]})})})]})}],12246)},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 d={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)]"},c={xs:"h-1",sm:"h-1.5",md:"h-2"};function x({value:e,max:r=100,tone:a,thresholds:s=o.q,label:n,size:l="xs",showValue:m=!1,valueLabel:h,glow:u,className:p,testId:b}){let g="number"==typeof e&&Number.isFinite(e),f=g?Math.max(0,Math.min(100,e/(r||1)*100)):0,v=a??(g?(0,o.Z)(f,s):"muted"),w=u||!a&&g&&f>=s.warn,j=h??(g?`${f.toFixed(+(f<10&&f>0))}%`:"—");return(0,t.jsxs)("div",{className:(0,i.f)("flex min-w-0 items-center gap-2",p),"data-testid":b,children:[(0,t.jsx)("div",{...g?{role:"meter","aria-label":n,"aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":e,"aria-valuetext":j}:{role:"img","aria-label":n?`${n}: no data`:"No data"},className:(0,i.f)("relative flex-1 overflow-hidden rounded-full bg-border/70",c[l]),children:(0,t.jsx)("div",{style:{"--meter":`${f}%`},className:(0,i.f)("h-full w-(--meter) rounded-full transition-[width] duration-700 ease-out-expo starting:w-0",o.H[v],w&&d[v])})}),m&&(0,t.jsx)("span",{className:(0,i.f)("num w-11 shrink-0 text-right text-[11px]",g?o.T[v]:"text-text-muted"),children:j})]})}e.s(["f",0,x],51196);var m=e.i(71645);function h({values:e,tone:r="primary",width:a=160,height:s=32,area:n=!0,max:l,percent:d=!1,threshold:c,live:x=!0,emptyLabel:u="not enough data",className:p,testId:b,label:g,stretch:f=!1}){let v=`spark${(0,m.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",p),"data-testid":b,children:u});let w=o.v[r],j=l??(d?Math.max(100,...e):Math.max(...e,c??0)||1),y=s-4,N=a/(e.length-1),k=e=>2+y-Math.max(0,e)/j*y,M=e.map((e,t)=>[t*N,k(e)]),S=M.map(([e,t])=>`${e.toFixed(1)},${t.toFixed(1)}`).join(" "),_=M[M.length-1];return(0,t.jsxs)("svg",{width:f?"100%":a,height:s,viewBox:`0 0 ${a} ${s}`,preserveAspectRatio:f?"none":void 0,className:(0,i.f)("block overflow-visible",p),"data-testid":b,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:v,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"0%",stopColor:w,stopOpacity:.35}),(0,t.jsx)("stop",{offset:"100%",stopColor:w,stopOpacity:0})]})}),(0,t.jsx)("polygon",{points:`0,${s} ${S} ${a},${s}`,fill:`url(#${v})`})]}),void 0!==c&&(0,t.jsx)("line",{x1:0,x2:a,y1:k(c),y2:k(c),stroke:"var(--color-warning)",strokeOpacity:.5,strokeDasharray:"3 3",strokeWidth:1}),(0,t.jsx)("polyline",{fill:"none",stroke:w,strokeWidth:1.5,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round",points:S}),x&&!f&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:_[0],cy:_[1],r:2.5,fill:w,className:"origin-center animate-halo [transform-box:fill-box]"}),(0,t.jsx)("circle",{cx:_[0],cy:_[1],r:2,fill:w})]})]})}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,...d}){return(0,t.jsx)(l.f,{...d,tone:i,corners:o,title:e,description:r,action:n,className:s,children:a})},"n",0,function({label:e,value:r,icon:a,trend:d,spark:c,meter:m,delta:u,tone:p="primary",className:b,testId:g}){let f=!u||u.value>=0===(u.positiveIsGood??!0);return(0,t.jsxs)(l.f,{tone:p,className:(0,i.f)("overflow-hidden",b),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"===p?"text-primary neon-text":o.T[p]),children:r}),u&&0!==u.value&&(0,t.jsxs)("span",{className:(0,i.f)("num mb-1 inline-flex items-center gap-0.5 text-[11px]",f?"text-success":"text-danger"),children:[u.value>0?(0,t.jsx)(n.f,{className:"h-3 w-3"}):(0,t.jsx)(s,{className:"h-3 w-3"}),Math.abs(u.value).toFixed(+!Number.isInteger(u.value)),u.unit]})]}),d&&(0,t.jsx)("div",{className:(0,i.f)("mt-1 text-[11px]",d.positive?"text-success":"text-danger"),children:d.value}),void 0!==m&&(0,t.jsx)(x,{value:m,className:"mt-3",label:e}),c&&c.length>1&&(0,t.jsx)("div",{className:"-mx-5 -mb-5 mt-3 opacity-80",children:(0,t.jsx)(h,{values:c,tone:p,width:240,height:28,stretch:!0,live:!1})})]})}],93999)},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:d=!0,hero:c=!1,title:x,description:m,icon:h,action:u,as:p="div",padding:b="md",testId:g,className:f,children:v,...w}){return(0,t.jsxs)(p,{...w,"data-testid":g??w["data-testid"],className:(0,r.f)("relative rounded-panel border border-border bg-surface transition-colors duration-300",l[b],o&&"panel-corners",o&&s[e],d&&"glow-hover",d&&n[e],d&&i[e],c&&"grid-bg overflow-hidden bg-surface/80",f),children:[(x||u||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:[x&&(0,t.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider",children:x}),m&&(0,t.jsx)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:m})]})]}),u]}),v]})}])},63376,e=>{"use strict";var t=e.i(43476);e.s(["z",0,function({children:e,className:r}){return(0,t.jsx)("div",{className:`animate-page-in${r?` ${r}`:""}`,children:e})},"U",0,function({children:e,className:r}){return(0,t.jsx)("div",{className:r,children:e})}])},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)},9041,e=>{"use strict";var t=e.i(56420);let r={name:"monitor-dot",size:24,node:[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M22 12.307V15a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8.693",key:"1dx6ho"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],9041)},21357,e=>{"use strict";var t=e.i(56420);let r={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],21357)},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)},83902,e=>{"use strict";var t=e.i(56420);let r={name:"shield-exclamation-point",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],aliases:["shield-alert"]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],83902)}]);
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,86421,e=>{"use strict";var t=e.i(43476),s=e.i(71645),a=e.i(93999),r=e.i(46670),n=e.i(68759),i=e.i(71417),l=e.i(82983),d=e.i(4050),c=e.i(77071),o=e.i(41120),u=e.i(15281),m=e.i(59659),x=e.i(66627),p=e.i(32781),h=e.i(92026),g=e.i(64155),f=e.i(84026),j=e.i(4139),b=e.i(86207),y=e.i(57665),N=e.i(41220),v=e.i(69174);let w=["/boot","/snap","/var/lib/docker/","/var/lib/containers/"],k=new Set(["iso9660","squashfs"]);var C=e.i(22016),S=e.i(14098),R=e.i(64971),E=e.i(62368),z=e.i(95925),U=e.i(69846),I=e.i(56420);let $={name:"chevron-up",size:24,node:[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]};$.node;let A=(0,I.f)($);var P=e.i(66794),O=e.i(35673),_=e.i(39430);function T(e){return e?.isGitRepo!==!1&&e?.legacyGitSelfUpdate===!0}function K(){let{activeNode:e,removeNode:a}=(0,d.l)(),[i,c]=(0,s.useState)("checking"),u=(0,s.useRef)(null),[x,h]=(0,s.useState)(null),[g,f]=(0,s.useState)(!1),[j,b]=(0,s.useState)(null),[y,w]=(0,s.useState)(null),[k,C]=(0,s.useState)("idle"),[S,I]=(0,s.useState)(null),[$,K]=(0,s.useState)(null),[F,B]=(0,s.useState)(!1),[D,q]=(0,s.useState)(null),[V,L]=(0,s.useState)(!1),M=(0,s.useCallback)(async()=>{try{let t=(0,_.L)(e.url),s=await fetch("/api/proxy/health",{method:"GET",headers:t,signal:AbortSignal.timeout(8e3)});c(s.ok?"online":"offline")}catch{c("offline")}},[e.url]),G=(0,s.useCallback)(async()=>{try{let e=await l.f.selfUpdate.version();e.success&&h(e.data??null)}catch{}},[]);(0,s.useEffect)(()=>(c("checking"),h(null),f(!1),w(null),I(null),K(null),M(),G(),u.current=setInterval(()=>{M()},3e4),()=>{u.current&&(clearInterval(u.current),u.current=null)}),[e.id,M,G]);let H=async()=>{C("checking"),K(null),I(null);try{let e=await l.f.selfUpdate.status();e.success&&b(e.data??null);let t=await l.f.selfUpdate.check();t.success&&(w(t.data??null),t.data.error?K(t.data.error):t.data.available||I("Already up to date."))}catch(t){let e="Failed to check for updates";if(t&&"object"==typeof t&&"response"in t)try{let s=(0,R.R)(await (0,R.O)(t));s&&(e=s)}catch{}else t instanceof Error&&(e=t.message);K(e)}finally{C("idle")}},J=async e=>{C("applying"),K(null),I(null);try{let t=await l.f.selfUpdate.apply(e);if(t.success){let e=t.data;if(!e)return;e.updated?I(`Updated from v${e.previousVersion} → v${e.currentVersion}`+(e.restart?.scheduled?`. Restarting via ${e.restart.method}…`:". Restart manually to apply.")):I("Code pulled but no version change detected."),w(null),G();let s=await l.f.selfUpdate.status();s.success&&b(s.data??null)}}catch(e){K(e instanceof Error?e.message:"Update failed")}finally{C("idle")}},W=async()=>{C("restarting"),K(null);try{let e=await l.f.selfUpdate.restart();e.success&&I(`Restart scheduled via ${e.data.method}. Reconnecting shortly…`)}catch(e){K(e instanceof Error?e.message:"Restart failed")}finally{C("idle")}},Y=async()=>{if(confirm(`Delete control node "${e.name}"? You'll be switched to another node.`))try{await a(e.id)}catch{}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"rounded border border-border bg-surface",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-5 py-3",children:[(0,t.jsx)("div",{className:"flex items-center gap-4 min-w-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)(N.f,{className:"h-4.5 w-4.5 text-primary shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 rounded border border-border bg-bg px-2.5 py-1 text-xs font-bold min-w-0",children:[(0,t.jsx)(N.f,{className:"h-3.5 w-3.5 shrink-0 text-text-muted"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]}),(0,t.jsx)("button",{onClick:()=>{q(e.id),L(!1),B(!0)},className:"rounded border border-border bg-bg p-1.5 text-text-muted transition-all hover:bg-surface-hover hover:text-text hover:border-primary/30 hover:shadow-[0_0_20px_var(--color-glow)]",title:"Control Node Settings",children:(0,t.jsx)(P.f,{className:"h-3.5 w-3.5"})}),(()=>{switch(i){case"checking":return(0,t.jsxs)(r.t,{variant:"info",children:[(0,t.jsx)(p.f,{className:"mr-1 h-3 w-3 animate-spin"}),"Checking"]});case"online":return(0,t.jsx)(r.t,{variant:"success",children:"Online"});case"offline":return(0,t.jsx)(r.t,{variant:"danger",children:"Offline"})}})()]}),(0,t.jsxs)("div",{className:"text-xs text-text-muted truncate mt-0.5",children:[e.url,x&&(0,t.jsxs)("span",{className:"ml-2",children:["v",x.controlApiVersion]})]})]})]})}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,t.jsxs)(n.K,{variant:"ghost",size:"sm",title:"Check for updates",onClick:()=>{g?f(!1):(f(!0),(async()=>{try{let e=await l.f.selfUpdate.status();e.success&&(b(e.data??null),T(e.data)&&H())}catch{}})())},children:[(0,t.jsx)(v.f,{className:"h-3.5 w-3.5 text-primary"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:"Update"})]}),(0,t.jsx)(n.K,{variant:"ghost",size:"sm",title:"Delete control node",onClick:()=>void Y(),children:(0,t.jsx)(m.f,{className:"h-3.5 w-3.5 text-danger"})}),(0,t.jsx)(n.K,{variant:"ghost",size:"sm",title:"Refresh status",onClick:()=>{c("checking"),M(),G()},children:(0,t.jsx)(o.f,{className:"h-3.5 w-3.5"})})]})]}),g&&(0,t.jsxs)("div",{className:"border-t border-border px-5 py-3 space-y-3",children:[$&&(0,t.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 p-3 text-xs text-danger",children:$}),S&&(0,t.jsx)("div",{className:"rounded border border-success/30 bg-success/10 p-3 text-xs text-success",children:S}),j&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-1 text-[11px] text-text-muted",children:[(0,t.jsxs)("span",{children:["Control API: ",(0,t.jsxs)("span",{className:"text-text",children:["v",j.controlApiVersion]})]}),(0,t.jsxs)("span",{children:["Agent: ",(0,t.jsxs)("span",{className:"text-text",children:["v",j.agentVersion]})]}),j.gitBranch&&(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(U.f,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"text-text",children:j.gitBranch})]}),j.gitCommit&&(0,t.jsxs)("span",{children:["Commit: ",(0,t.jsx)("span",{className:"text-text",children:j.gitCommit})]}),j.lastChecked&&(0,t.jsxs)("span",{children:["Checked: ",new Date(j.lastChecked).toLocaleString()]})]}),j&&!T(j)&&(0,t.jsxs)("div",{className:"rounded border border-primary/30 bg-primary/10 p-3 text-xs text-text-muted",children:[(0,t.jsx)("span",{className:"font-bold text-primary",children:"Upgrade on the server host"}),(0,t.jsxs)("span",{className:"ml-1",children:["with ",(0,t.jsx)("code",{className:"rounded bg-surface px-1 text-text",children:j.upgradeCommand??"magnus upgrade"}),": it backs up the database, migrates, restarts and switches back automatically if the new version is unhealthy."]})]}),y?.available&&(0,t.jsxs)("div",{className:"rounded border border-warning/30 bg-warning/10 p-3 text-xs",children:[(0,t.jsx)("span",{className:"font-bold text-warning uppercase tracking-wider",children:"Update available"}),(0,t.jsxs)("span",{className:"text-text-muted ml-1",children:["— ",y.behindBy," commit",1!==y.behindBy?"s":""," behind (",y.currentCommit," → ",y.remoteCommit,")"]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[T(j)&&(0,t.jsx)(n.K,{variant:"secondary",size:"sm",onClick:()=>void H(),disabled:"idle"!==k,icon:"checking"===k?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(o.f,{className:"h-3.5 w-3.5"}),children:"checking"===k?"Checking…":"Check for Updates"}),T(j)&&y?.available&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.K,{variant:"primary",size:"sm",onClick:()=>void J(!1),disabled:"idle"!==k,icon:"applying"===k?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(E.f,{className:"h-3.5 w-3.5"}),children:"applying"===k?"Updating…":"Pull & Build"}),(0,t.jsx)(n.K,{variant:"primary",size:"sm",onClick:()=>void J(!0),disabled:"idle"!==k,icon:"applying"===k?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(z.f,{className:"h-3.5 w-3.5"}),children:"applying"===k?"Updating…":"Pull, Build & Restart"})]}),T(j)&&(0,t.jsx)(n.K,{variant:"ghost",size:"sm",onClick:()=>void W(),disabled:"idle"!==k,icon:"restarting"===k?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(z.f,{className:"h-3.5 w-3.5"}),children:"restarting"===k?"Restarting…":"Restart Only"}),(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(n.K,{variant:"ghost",size:"sm",onClick:()=>f(!1),icon:(0,t.jsx)(A,{className:"h-3.5 w-3.5"}),children:"Close"})})]})]})]}),(0,t.jsx)(O.f,{open:F,onClose:()=>{B(!1),q(null),L(!1),M(),G()},editNodeId:D,createMode:V})]})}var F=e.i(32568);function B({open:a,onClose:r,node:n}){let i=(0,s.useRef)(null),l=(0,s.useRef)(null),d=(0,s.useRef)(null),c=(0,s.useRef)(null),o=(0,s.useRef)(!1),u=(0,s.useRef)(null),[m,x]=(0,s.useState)("connecting"),p=(0,s.useRef)(""),h=(0,s.useRef)(null),g=(0,s.useCallback)(()=>{h.current=null;let e=p.current;e&&c.current&&(p.current="",fetch("/api/terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:c.current,data:e})}).catch(()=>{}))},[]),f=(0,s.useCallback)(()=>{if(!o.current){o.current=!0,h.current&&(clearTimeout(h.current),h.current=null),u.current?.abort(),u.current=null,c.current&&(fetch("/api/terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:c.current})}).catch(()=>{}),c.current=null);try{l.current?.dispose()}catch{}l.current=null,d.current=null}},[]);(0,s.useEffect)(()=>{if(!a||!n||!i.current)return;o.current=!1,x("connecting");let t=!1;(async()=>{let s,{Terminal:a}=await e.A(37138),{FitAddon:r}=await e.A(59439);if(!document.getElementById("xterm-css")){let e=document.createElement("style");e.id="xterm-css",e.textContent=`
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,86421,e=>{"use strict";var t=e.i(43476),s=e.i(71645),a=e.i(93999),r=e.i(46670),n=e.i(68759),i=e.i(71417),l=e.i(82983),d=e.i(4050),c=e.i(77071),o=e.i(41120),u=e.i(15281),m=e.i(59659),x=e.i(66627),p=e.i(32781),h=e.i(92026),g=e.i(64155),f=e.i(84026),j=e.i(4139),b=e.i(86207),y=e.i(57665),N=e.i(41220),v=e.i(69174);let w=["/boot","/snap","/var/lib/docker/","/var/lib/containers/"],k=new Set(["iso9660","squashfs"]);var C=e.i(22016),S=e.i(14098),R=e.i(64971),E=e.i(62368),z=e.i(95925),U=e.i(69846),$=e.i(56420);let I={name:"chevron-up",size:24,node:[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]};I.node;let A=(0,$.f)(I);var P=e.i(66794),O=e.i(35673),_=e.i(39430);function T(e){return e?.isGitRepo!==!1&&e?.legacyGitSelfUpdate===!0}function K(){let{activeNode:e,removeNode:a}=(0,d.l)(),[i,c]=(0,s.useState)("checking"),u=(0,s.useRef)(null),[x,h]=(0,s.useState)(null),[g,f]=(0,s.useState)(!1),[j,b]=(0,s.useState)(null),[y,w]=(0,s.useState)(null),[k,C]=(0,s.useState)("idle"),[S,$]=(0,s.useState)(null),[I,K]=(0,s.useState)(null),[F,D]=(0,s.useState)(!1),[B,q]=(0,s.useState)(null),[V,L]=(0,s.useState)(!1),M=(0,s.useCallback)(async()=>{try{let t=(0,_.L)(e.url),s=await fetch("/api/proxy/health",{method:"GET",headers:t,signal:AbortSignal.timeout(8e3)});c(s.ok?"online":"offline")}catch{c("offline")}},[e.url]),G=(0,s.useCallback)(async()=>{try{let e=await l.f.selfUpdate.version();e.success&&h(e.data??null)}catch{}},[]);(0,s.useEffect)(()=>(c("checking"),h(null),f(!1),w(null),$(null),K(null),M(),G(),u.current=setInterval(()=>{M()},3e4),()=>{u.current&&(clearInterval(u.current),u.current=null)}),[e.id,M,G]);let H=async()=>{C("checking"),K(null),$(null);try{let e=await l.f.selfUpdate.status();e.success&&b(e.data??null);let t=await l.f.selfUpdate.check();t.success&&(w(t.data??null),t.data.error?K(t.data.error):t.data.available||$("Already up to date."))}catch(t){let e="Failed to check for updates";if(t&&"object"==typeof t&&"response"in t)try{let s=(0,R.R)(await (0,R.O)(t));s&&(e=s)}catch{}else t instanceof Error&&(e=t.message);K(e)}finally{C("idle")}},J=async e=>{C("applying"),K(null),$(null);try{let t=await l.f.selfUpdate.apply(e);if(t.success){let e=t.data;if(!e)return;e.updated?$(`Updated from v${e.previousVersion} → v${e.currentVersion}`+(e.restart?.scheduled?`. Restarting via ${e.restart.method}…`:". Restart manually to apply.")):$("Code pulled but no version change detected."),w(null),G();let s=await l.f.selfUpdate.status();s.success&&b(s.data??null)}}catch(e){K(e instanceof Error?e.message:"Update failed")}finally{C("idle")}},W=async()=>{C("restarting"),K(null);try{let e=await l.f.selfUpdate.restart();e.success&&$(`Restart scheduled via ${e.data.method}. Reconnecting shortly…`)}catch(e){K(e instanceof Error?e.message:"Restart failed")}finally{C("idle")}},Y=async()=>{if(confirm(`Delete control node "${e.name}"? You'll be switched to another node.`))try{await a(e.id)}catch{}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"rounded border border-border bg-surface",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-5 py-3",children:[(0,t.jsx)("div",{className:"flex items-center gap-4 min-w-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)(N.f,{className:"h-4.5 w-4.5 text-primary shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 rounded border border-border bg-bg px-2.5 py-1 text-xs font-bold min-w-0",children:[(0,t.jsx)(N.f,{className:"h-3.5 w-3.5 shrink-0 text-text-muted"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]}),(0,t.jsx)("button",{onClick:()=>{q(e.id),L(!1),D(!0)},className:"rounded border border-border bg-bg p-1.5 text-text-muted transition-all hover:bg-surface-hover hover:text-text hover:border-primary/30 hover:shadow-[0_0_20px_var(--color-glow)]",title:"Control Node Settings",children:(0,t.jsx)(P.f,{className:"h-3.5 w-3.5"})}),(()=>{switch(i){case"checking":return(0,t.jsxs)(r.t,{variant:"info",children:[(0,t.jsx)(p.f,{className:"mr-1 h-3 w-3 animate-spin"}),"Checking"]});case"online":return(0,t.jsx)(r.t,{variant:"success",children:"Online"});case"offline":return(0,t.jsx)(r.t,{variant:"danger",children:"Offline"})}})()]}),(0,t.jsxs)("div",{className:"text-xs text-text-muted truncate mt-0.5",children:[e.url,x&&(0,t.jsxs)("span",{className:"ml-2",children:["v",x.controlApiVersion]})]})]})]})}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,t.jsxs)(n.K,{variant:"ghost",size:"sm",title:"Check for updates",onClick:()=>{g?f(!1):(f(!0),(async()=>{try{let e=await l.f.selfUpdate.status();e.success&&(b(e.data??null),T(e.data)&&H())}catch{}})())},children:[(0,t.jsx)(v.f,{className:"h-3.5 w-3.5 text-primary"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:"Update"})]}),(0,t.jsx)(n.K,{variant:"ghost",size:"sm",title:"Delete control node",onClick:()=>void Y(),children:(0,t.jsx)(m.f,{className:"h-3.5 w-3.5 text-danger"})}),(0,t.jsx)(n.K,{variant:"ghost",size:"sm",title:"Refresh status",onClick:()=>{c("checking"),M(),G()},children:(0,t.jsx)(o.f,{className:"h-3.5 w-3.5"})})]})]}),g&&(0,t.jsxs)("div",{className:"border-t border-border px-5 py-3 space-y-3",children:[I&&(0,t.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 p-3 text-xs text-danger",children:I}),S&&(0,t.jsx)("div",{className:"rounded border border-success/30 bg-success/10 p-3 text-xs text-success",children:S}),j&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-1 text-[11px] text-text-muted",children:[(0,t.jsxs)("span",{children:["Control API: ",(0,t.jsxs)("span",{className:"text-text",children:["v",j.controlApiVersion]})]}),(0,t.jsxs)("span",{children:["Agent: ",(0,t.jsxs)("span",{className:"text-text",children:["v",j.agentVersion]})]}),j.gitBranch&&(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(U.f,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"text-text",children:j.gitBranch})]}),j.gitCommit&&(0,t.jsxs)("span",{children:["Commit: ",(0,t.jsx)("span",{className:"text-text",children:j.gitCommit})]}),j.lastChecked&&(0,t.jsxs)("span",{children:["Checked: ",new Date(j.lastChecked).toLocaleString()]})]}),j&&!T(j)&&(0,t.jsxs)("div",{className:"rounded border border-primary/30 bg-primary/10 p-3 text-xs text-text-muted",children:[(0,t.jsx)("span",{className:"font-bold text-primary",children:"Upgrade on the server host"}),(0,t.jsxs)("span",{className:"ml-1",children:["with ",(0,t.jsx)("code",{className:"rounded bg-surface px-1 text-text",children:j.upgradeCommand??"magnus upgrade"}),": it backs up the database, migrates, restarts and switches back automatically if the new version is unhealthy."]})]}),y?.available&&(0,t.jsxs)("div",{className:"rounded border border-warning/30 bg-warning/10 p-3 text-xs",children:[(0,t.jsx)("span",{className:"font-bold text-warning uppercase tracking-wider",children:"Update available"}),(0,t.jsxs)("span",{className:"text-text-muted ml-1",children:["— ",y.behindBy," commit",1!==y.behindBy?"s":""," behind (",y.currentCommit," → ",y.remoteCommit,")"]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[T(j)&&(0,t.jsx)(n.K,{variant:"secondary",size:"sm",onClick:()=>void H(),disabled:"idle"!==k,icon:"checking"===k?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(o.f,{className:"h-3.5 w-3.5"}),children:"checking"===k?"Checking…":"Check for Updates"}),T(j)&&y?.available&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.K,{variant:"primary",size:"sm",onClick:()=>void J(!1),disabled:"idle"!==k,icon:"applying"===k?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(E.f,{className:"h-3.5 w-3.5"}),children:"applying"===k?"Updating…":"Pull & Build"}),(0,t.jsx)(n.K,{variant:"primary",size:"sm",onClick:()=>void J(!0),disabled:"idle"!==k,icon:"applying"===k?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(z.f,{className:"h-3.5 w-3.5"}),children:"applying"===k?"Updating…":"Pull, Build & Restart"})]}),T(j)&&(0,t.jsx)(n.K,{variant:"ghost",size:"sm",onClick:()=>void W(),disabled:"idle"!==k,icon:"restarting"===k?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(z.f,{className:"h-3.5 w-3.5"}),children:"restarting"===k?"Restarting…":"Restart Only"}),(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(n.K,{variant:"ghost",size:"sm",onClick:()=>f(!1),icon:(0,t.jsx)(A,{className:"h-3.5 w-3.5"}),children:"Close"})})]})]})]}),(0,t.jsx)(O.f,{open:F,onClose:()=>{D(!1),q(null),L(!1),M(),G()},editNodeId:B,createMode:V})]})}var F=e.i(32568);function D({open:a,onClose:r,node:n}){let i=(0,s.useRef)(null),l=(0,s.useRef)(null),d=(0,s.useRef)(null),c=(0,s.useRef)(null),o=(0,s.useRef)(!1),u=(0,s.useRef)(null),[m,x]=(0,s.useState)("connecting"),p=(0,s.useRef)(""),h=(0,s.useRef)(null),g=(0,s.useCallback)(()=>{h.current=null;let e=p.current;e&&c.current&&(p.current="",fetch("/api/terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:c.current,data:e})}).catch(()=>{}))},[]),f=(0,s.useCallback)(()=>{if(!o.current){o.current=!0,h.current&&(clearTimeout(h.current),h.current=null),u.current?.abort(),u.current=null,c.current&&(fetch("/api/terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:c.current})}).catch(()=>{}),c.current=null);try{l.current?.dispose()}catch{}l.current=null,d.current=null}},[]);(0,s.useEffect)(()=>{if(!a||!n||!i.current)return;o.current=!1,x("connecting");let t=!1;(async()=>{let s,{Terminal:a}=await e.A(37138),{FitAddon:r}=await e.A(59439);if(!document.getElementById("xterm-css")){let e=document.createElement("style");e.id="xterm-css",e.textContent=`
2
2
  .xterm { position: relative; user-select: none; }
3
3
  .xterm.focus, .xterm:focus { outline: none; }
4
4
  .xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
@@ -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/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)}]);
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 B=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,$.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,$.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]),$=d?.nodes.filter(e=>"MAJOR_VERSION"===e.code).length??0,I=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))})]}),I&&(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"]}),$>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:[$," agent",1===$?" 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:[I&&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"}),I&&(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"}),I&&(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});I(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}I([]),_(null),ei([]),eo({}),em(null),ep(null),eg.current={},eb()},[U.id]),(0,s.useEffect)(()=>{let e=$.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)}},[$,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)(B.U,{className:"space-y-6",children:[(0,t.jsx)(B.z,{children:(0,t.jsx)(V.f,{title:"Nodes",eyebrow:"Fleet",description:"Manage your Magnus fleet nodes",status:$.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:$.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:$.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)(B.z,{children:(0,t.jsx)(K,{})}),ex&&(0,t.jsx)(B.z,{children:(0,t.jsx)(q.f,{summary:ex,showAction:!1})}),eu&&(0,t.jsx)(B.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)(B.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===$.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:$.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),"aria-label":`Edit ${e.name}`,title:"Edit node",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),"aria-label":`Delete ${e.name}`,title:"Delete node",children:(0,t.jsx)(m.f,{className:"h-3.5 w-3.5 text-danger"})})]})})]},e.id)})})]})})})}),(0,t.jsx)(B.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,I(t=>t.map(t=>t.id===X.id?{...t,role:e}:t))),eb()}}),(0,t.jsx)(D,{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),a=e.i(68759),r=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)("4065a3daee950507d795fccd94782f87c1191ae167",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)(a.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)(a.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)(r.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)(r.t,{variant:"default",children:"Disabled"}):(0,s.jsx)(r.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)(r.t,{variant:"default",children:t.user}),(0,s.jsx)(r.t,{variant:"info",children:t.schedule})]}),(0,s.jsxs)(a.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,a,r,n,i]=s;return"*"===t&&"*"===a&&"*"===r&&"*"===n&&"*"===i?"Every minute":"0"===t&&"*"===a&&"*"===r&&"*"===n&&"*"===i?"Every hour":"0"===t&&"0"===a&&"*"===r&&"*"===n&&"*"===i?"Daily at midnight":t?.startsWith("*/")?`Every ${t.slice(2)} minutes`:a?.startsWith("*/")?`Every ${a.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)(a.K,{variant:"secondary",size:"sm",onClick:()=>F(null),children:"Cancel"}),(0,s.jsx)(a.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 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)]"},r={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",a[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",r[n])}),(0,s.jsx)("span",{className:(0,t.f)("relative inline-flex h-1.5 w-1.5 rounded-full",r[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 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 r=(0,t.f)(a);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:a,thresholds:r=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=a??(j?(0,c.Z)(v,r):"muted"),b=u||!a&&j&&v>=r.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:a=160,height:r=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=r-4,y=a/(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%":a,height:r,viewBox:`0 0 ${a} ${r}`,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,${r} ${_} ${a},${r}`,fill:`url(#${g})`})]}),void 0!==d&&(0,s.jsx)("line",{x1:0,x2:a,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:a,className:r,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:r,children:a})},"n",0,function({label:e,value:t,icon:a,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}),a&&(0,s.jsx)("span",{className:"text-primary/60",children:a})]}),(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)(r,{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),a=e.i(35084);let r={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&&r[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",a.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),a=e.i(32781),r=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)(r.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)(a.f,{className:"h-3.5 w-3.5 text-primary animate-spin"}),"done"===e.status&&(0,s.jsx)(r.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 a=(0,s.f)(t);e.s(["f",0,a],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 a=(0,s.f)(t);e.s(["f",0,a],49882)},95187,(e,s,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a={callServer:function(){return n.callServer},createServerReference:function(){return l.createServerReference},findSourceMapURL:function(){return i.findSourceMapURL}};for(var r in a)Object.defineProperty(t,r,{enumerable:!0,get:a[r]});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),a=e.i(68759),r=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)("40d57f6bec3436f541f2dc13e227aca355dc9579fc",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),g=e.i(41220),v=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)(a.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)(a.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)(g.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)(g.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)(r.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)(r.t,{variant:"default",children:"Disabled"}):(0,s.jsx)(r.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)(v.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)(r.t,{variant:"default",children:t.user}),(0,s.jsx)(r.t,{variant:"info",children:t.schedule})]}),(0,s.jsxs)(a.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,a,r,n,i]=s;return"*"===t&&"*"===a&&"*"===r&&"*"===n&&"*"===i?"Every minute":"0"===t&&"*"===a&&"*"===r&&"*"===n&&"*"===i?"Every hour":"0"===t&&"0"===a&&"*"===r&&"*"===n&&"*"===i?"Daily at midnight":t?.startsWith("*/")?`Every ${t.slice(2)} minutes`:a?.startsWith("*/")?`Every ${a.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)(a.K,{variant:"secondary",size:"sm",onClick:()=>F(null),children:"Cancel"}),(0,s.jsx)(a.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 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)]"},r={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",a[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",r[n])}),(0,s.jsx)("span",{className:(0,t.f)("relative inline-flex h-1.5 w-1.5 rounded-full",r[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 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 r=(0,t.f)(a);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:a,thresholds:r=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),g=j?Math.max(0,Math.min(100,e/(t||1)*100)):0,v=a??(j?(0,c.Z)(g,r):"muted"),b=u||!a&&j&&g>=r.warn,N=h??(j?`${g.toFixed(+(g<10&&g>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",{...j?{role:"meter","aria-label":n,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-valuetext":N}:{role:"img","aria-label":n?`${n}: no data`:"No data"},className:(0,i.f)("relative flex-1 overflow-hidden rounded-full bg-border/70",d[l]),children:(0,s.jsx)("div",{style:{"--meter":`${g}%`},className:(0,i.f)("h-full w-(--meter) rounded-full transition-[width] duration-700 ease-out-expo starting:w-0",c.H[v],b&&o[v])})}),m&&(0,s.jsx)("span",{className:(0,i.f)("num w-11 shrink-0 text-right text-[11px]",j?c.T[v]:"text-text-muted"),children:N})]})}e.s(["f",0,x],51196);var m=e.i(71645);function h({values:e,tone:t="primary",width:a=160,height:r=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:g=!1}){let v=`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=r-4,y=a/(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:g?"100%":a,height:r,viewBox:`0 0 ${a} ${r}`,preserveAspectRatio:g?"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:v,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,${r} ${_} ${a},${r}`,fill:`url(#${v})`})]}),void 0!==d&&(0,s.jsx)("line",{x1:0,x2:a,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&&!g&&(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:a,className:r,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:r,children:a})},"n",0,function({label:e,value:t,icon:a,trend:o,spark:d,meter:m,delta:u,tone:p="primary",className:f,testId:j}){let g=!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}),a&&(0,s.jsx)("span",{className:"text-primary/60",children:a})]}),(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]",g?"text-success":"text-danger"),children:[u.value>0?(0,s.jsx)(n.f,{className:"h-3 w-3"}):(0,s.jsx)(r,{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),a=e.i(35084);let r={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:g,children:v,...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&&r[e],o&&"glow-hover",o&&n[e],o&&i[e],d&&"grid-bg overflow-hidden bg-surface/80",g),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",a.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]}),v]})}])},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),a=e.i(32781),r=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)(r.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)(a.f,{className:"h-3.5 w-3.5 text-primary animate-spin"}),"done"===e.status&&(0,s.jsx)(r.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 a=(0,s.f)(t);e.s(["f",0,a],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 a=(0,s.f)(t);e.s(["f",0,a],49882)},95187,(e,s,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a={callServer:function(){return n.callServer},createServerReference:function(){return l.createServerReference},findSourceMapURL:function(){return i.findSourceMapURL}};for(var r in a)Object.defineProperty(t,r,{enumerable:!0,get:a[r]});let n=e.r(32120),i=e.r(92245),l=e.r(35326)}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,5475,e=>{"use strict";var t=e.i(43476),a=e.i(22016),s=e.i(18566),r=e.i(71645),i=e.i(63376),l=e.i(93999),n=e.i(82983),o=e.i(9347),d=e.i(71567),c=e.i(56420);let m={name:"clock-3",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]]};m.node;let x=(0,c.f)(m);var p=e.i(69846),h=e.i(41120),u=e.i(63644),g=e.i(4139),f=e.i(64569);e.s(["default",0,function(){let e=(0,s.useParams)(),[c,m]=(0,r.useState)(null),[v,b]=(0,r.useState)(null),[j,y]=(0,r.useState)([]),[N,w]=(0,r.useState)([]),[k,$]=(0,r.useState)(!1),[_,I]=(0,r.useState)(!0),z=(0,r.useCallback)(async()=>{I(!0);try{let[t,a,s,r]=await Promise.allSettled([n.f.anomalies.correlation(e.anomalyId),n.f.assistant.conversations({type:"heartbeat",status:"all",pageSize:1}),n.f.remediation.listRules(),n.f.remediation.listExecutions({pageSize:20})]);if("fulfilled"===t.status&&m(t.value.data??null),"fulfilled"===a.status&&b(a.value.data?.conversations?.[0]??null),"fulfilled"===s.status&&y((s.value.data??[]).filter(e=>e.enabled)),"fulfilled"===r.status){let t=r.value.data?.executions??[];w(t.filter(t=>t.anomalyEventId===e.anomalyId))}}catch{}finally{I(!1)}},[e.anomalyId]);(0,r.useEffect)(()=>{z()},[z]);let S=async t=>{$(!0);try{await n.f.remediation.trigger({anomalyEventId:e.anomalyId,ruleId:t}),await z()}catch{}finally{$(!1)}},C=(0,r.useMemo)(()=>c?[{id:c.anomaly.id,kind:"target-anomaly",title:`Primary anomaly • ${c.anomaly.metric}`,timestamp:c.anomaly.createdAt,detail:`Value ${c.anomaly.value.toFixed(2)} • z-score ${c.anomaly.zScore.toFixed(2)} • severity ${c.anomaly.severity}`,nodeId:c.anomaly.nodeId},...c.group.anomalies.filter(e=>e.id!==c.anomaly.id).map(e=>({id:e.id,kind:"correlated-anomaly",title:`Correlated anomaly • ${e.metric}`,timestamp:e.createdAt,detail:`Value ${e.value.toFixed(2)} • z-score ${e.zScore.toFixed(2)} • severity ${e.severity}`,nodeId:e.nodeId})),...c.group.relatedCommands.map(e=>({id:e.id,kind:"command",title:`Related command • ${e.command}`,timestamp:e.createdAt,detail:`Status ${e.status}`,nodeId:e.nodeId}))].sort((e,t)=>e.timestamp.localeCompare(t.timestamp)):[],[c]);return(0,t.jsxs)(i.U,{children:[(0,t.jsx)(i.z,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(a.default,{href:"/anomalies",className:"mb-2 inline-flex items-center gap-1 text-xs uppercase tracking-wider text-text-muted hover:text-primary",children:[(0,t.jsx)(o.f,{className:"h-3.5 w-3.5"}),"Back to anomalies"]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(u.f,{className:"h-5 w-5 text-primary"}),(0,t.jsx)("h1",{className:"text-2xl font-bold uppercase tracking-wider text-text",children:"AI anomaly analysis"})]}),(0,t.jsx)("p",{className:"mt-1 text-xs uppercase tracking-wider text-text-muted",children:"Correlation timeline, root-cause hypotheses, and recommended actions"})]}),(0,t.jsxs)("button",{onClick:()=>void z(),className:"inline-flex items-center gap-2 rounded border border-border px-3 py-2 text-xs font-semibold uppercase tracking-wider text-text-muted transition-colors hover:border-primary/40 hover:text-primary",children:[(0,t.jsx)(h.f,{className:`h-3.5 w-3.5 ${_?"animate-spin":""}`}),"Refresh"]})]})}),c||_?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.z,{children:(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-3",children:[(0,t.jsxs)(l.N,{className:"p-4 lg:col-span-2",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(p.f,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"AI summary"})]}),(0,t.jsx)("p",{className:"text-sm text-text",children:c?.analysis.summary??(_?"Loading analysis…":"No summary available.")}),c&&(0,t.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-3",children:[(0,t.jsxs)("div",{className:"rounded border border-border/60 bg-bg/40 p-3",children:[(0,t.jsx)("p",{className:"text-lg font-bold text-text",children:c.group.anomalies.length}),(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Correlated anomalies"})]}),(0,t.jsxs)("div",{className:"rounded border border-border/60 bg-bg/40 p-3",children:[(0,t.jsx)("p",{className:"text-lg font-bold text-text",children:c.group.relatedCommands.length}),(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Related commands"})]}),(0,t.jsxs)("div",{className:"rounded border border-border/60 bg-bg/40 p-3",children:[(0,t.jsx)("p",{className:"text-lg font-bold text-text",children:c.analysis.blastRadius}),(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Blast radius"})]})]})]}),(0,t.jsxs)(l.N,{className:"p-4",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(d.f,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"Heartbeat context"})]}),v?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("p",{className:"text-sm text-text",children:"A legacy heartbeat analysis exists for this anomaly. New fleet checks are recorded as cron logs and exposed through the Magnus API."})}):(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"No legacy heartbeat conversation is attached. Use the fleet check logs for current cron-owned status."})]})]})}),(0,t.jsx)(i.z,{children:(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 xl:grid-cols-[1.35fr_0.85fr]",children:[(0,t.jsxs)(l.N,{className:"p-4",children:[(0,t.jsxs)("div",{className:"mb-4 flex items-center gap-2",children:[(0,t.jsx)(x,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"Correlation timeline"})]}),(0,t.jsx)("div",{className:"space-y-3",children:C.map(e=>{var a;return(0,t.jsxs)("div",{className:`rounded border p-3 ${"target-anomaly"===(a=e.kind)?"border-primary/30 bg-primary/5 text-primary":"command"===a?"border-warning/30 bg-warning/5 text-warning":"border-border bg-surface-hover text-text"}`,children:[(0,t.jsxs)("div",{className:"mb-1 flex items-center justify-between gap-3",children:[(0,t.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider",children:e.title}),(0,t.jsx)("span",{className:"text-[10px] opacity-80",children:new Date(e.timestamp).toLocaleString()})]}),(0,t.jsx)("p",{className:"text-[11px] opacity-90",children:e.detail}),(0,t.jsxs)("p",{className:"mt-1 text-[10px] opacity-70",children:["Node: ",e.nodeId]})]},`${e.kind}-${e.id}`)})})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)(l.N,{className:"p-4",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(g.f,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"Suspected triggers"})]}),(0,t.jsx)("ul",{className:"space-y-2 text-sm text-text-muted",children:(c?.analysis.suspectedTriggers??[]).map(e=>(0,t.jsx)("li",{className:"rounded border border-border/60 bg-bg/40 px-3 py-2",children:e},e))})]}),(0,t.jsxs)(l.N,{className:"p-4",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(u.f,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"Recommended actions"})]}),(0,t.jsx)("ul",{className:"space-y-2 text-sm text-text-muted",children:(c?.analysis.recommendedActions??[]).map(e=>(0,t.jsx)("li",{className:"rounded border border-border/60 bg-bg/40 px-3 py-2",children:e},e))})]}),(0,t.jsxs)(l.N,{className:"p-4",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(f.f,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"Auto-Remediation"})]}),j.length>0?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{className:"text-[11px] text-text-muted",children:"Trigger a remediation rule for this anomaly:"}),j.map(e=>(0,t.jsxs)("button",{disabled:k,onClick:()=>void S(e.id),className:"flex w-full items-center justify-between rounded border border-border/60 bg-bg/40 px-3 py-2 text-left text-sm text-text transition-colors hover:border-primary/40 disabled:opacity-50",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-semibold",children:e.name}),e.description&&(0,t.jsxs)("span",{className:"ml-2 text-text-muted text-xs",children:["— ",e.description]})]}),(0,t.jsx)(f.f,{className:"h-3.5 w-3.5 text-primary shrink-0"})]},e.id))]}):(0,t.jsxs)("p",{className:"text-sm text-text-muted",children:["No active remediation rules."," ",(0,t.jsx)(a.default,{href:"/anomalies/remediation",className:"text-primary hover:underline",children:"Create one"})]}),N.length>0&&(0,t.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-[11px] uppercase tracking-wider text-text-muted",children:"Executions for this anomaly"}),N.map(e=>(0,t.jsxs)("div",{className:"rounded border border-border/60 bg-bg/40 px-3 py-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,t.jsx)("span",{className:"font-semibold text-text",children:e.rule?.name??e.ruleId}),(0,t.jsx)("span",{className:`rounded px-2 py-0.5 font-semibold ${"completed"===e.status?"bg-success/20 text-success":"failed"===e.status?"bg-danger/20 text-danger":"running"===e.status?"bg-warning/20 text-warning":"bg-primary/20 text-primary"}`,children:e.status})]}),(0,t.jsx)("p",{className:"mt-1 text-[11px] text-text-muted",children:new Date(e.triggeredAt).toLocaleString()})]},e.id))]})]})]})]})})]}):(0,t.jsx)(i.z,{children:(0,t.jsx)(l.N,{className:"p-6 text-sm text-text-muted",children:"We couldn’t load correlation details for this anomaly."})})]})}],5475)},93999,51196,55427,e=>{"use strict";var t=e.i(43476),a=e.i(56420);let s={name:"arrow-down-right",size:24,node:[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]};s.node;let r=(0,a.f)(s);var i=e.i(75775),l=e.i(78571),n=e.i(3062),o=e.i(35084);let d={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)]"},c={xs:"h-1",sm:"h-1.5",md:"h-2"};function m({value:e,max:a=100,tone:s,thresholds:r=o.q,label:i,size:n="xs",showValue:x=!1,valueLabel:p,glow:h,className:u,testId:g}){let f="number"==typeof e&&Number.isFinite(e),v=f?Math.max(0,Math.min(100,e/(a||1)*100)):0,b=s??(f?(0,o.Z)(v,r):"muted"),j=h||!s&&f&&v>=r.warn,y=p??(f?`${v.toFixed(+(v<10&&v>0))}%`:"—");return(0,t.jsxs)("div",{className:(0,l.f)("flex min-w-0 items-center gap-2",u),"data-testid":g,children:[(0,t.jsx)("div",{role:"meter","aria-label":i,"aria-valuemin":0,"aria-valuemax":a,"aria-valuenow":f?e:void 0,"aria-valuetext":y,className:(0,l.f)("relative flex-1 overflow-hidden rounded-full bg-border/70",c[n]),children:(0,t.jsx)("div",{style:{"--meter":`${v}%`},className:(0,l.f)("h-full w-(--meter) rounded-full transition-[width] duration-700 ease-out-expo starting:w-0",o.H[b],j&&d[b])})}),x&&(0,t.jsx)("span",{className:(0,l.f)("num w-11 shrink-0 text-right text-[11px]",f?o.T[b]:"text-text-muted"),children:y})]})}e.s(["f",0,m],51196);var x=e.i(71645);function p({values:e,tone:a="primary",width:s=160,height:r=32,area:i=!0,max:n,percent:d=!1,threshold:c,live:m=!0,emptyLabel:h="not enough data",className:u,testId:g,label:f,stretch:v=!1}){let b=`spark${(0,x.useId)().replace(/:/g,"")}`;if(e.length<2)return(0,t.jsx)("div",{className:(0,l.f)("flex h-8 items-center text-xs italic text-text-muted",u),"data-testid":g,children:h});let j=o.v[a],y=n??(d?Math.max(100,...e):Math.max(...e,c??0)||1),N=r-4,w=s/(e.length-1),k=e=>2+N-Math.max(0,e)/y*N,$=e.map((e,t)=>[t*w,k(e)]),_=$.map(([e,t])=>`${e.toFixed(1)},${t.toFixed(1)}`).join(" "),I=$[$.length-1];return(0,t.jsxs)("svg",{width:v?"100%":s,height:r,viewBox:`0 0 ${s} ${r}`,preserveAspectRatio:v?"none":void 0,className:(0,l.f)("block overflow-visible",u),"data-testid":g,role:f?"img":void 0,"aria-label":f,"aria-hidden":!f||void 0,children:[i&&(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,${r} ${_} ${s},${r}`,fill:`url(#${b})`})]}),void 0!==c&&(0,t.jsx)("line",{x1:0,x2:s,y1:k(c),y2:k(c),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&&!v&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:I[0],cy:I[1],r:2.5,fill:j,className:"origin-center animate-halo [transform-box:fill-box]"}),(0,t.jsx)("circle",{cx:I[0],cy:I[1],r:2,fill:j})]})]})}e.s(["f",0,p],55427),e.s(["N",0,function({title:e,description:a,children:s,className:r,action:i,tone:l,corners:o=!1,...d}){return(0,t.jsx)(n.f,{...d,tone:l,corners:o,title:e,description:a,action:i,className:r,children:s})},"n",0,function({label:e,value:a,icon:s,trend:d,spark:c,meter:x,delta:h,tone:u="primary",className:g,testId:f}){let v=!h||h.value>=0===(h.positiveIsGood??!0);return(0,t.jsxs)(n.f,{tone:u,className:(0,l.f)("overflow-hidden",g),testId:f,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}),s&&(0,t.jsx)("span",{className:"text-primary/60",children:s})]}),(0,t.jsxs)("div",{className:"mt-2 flex items-end justify-between gap-2",children:[(0,t.jsx)("div",{className:(0,l.f)("num text-2xl font-bold","primary"===u?"text-primary neon-text":o.T[u]),children:a}),h&&0!==h.value&&(0,t.jsxs)("span",{className:(0,l.f)("num mb-1 inline-flex items-center gap-0.5 text-[11px]",v?"text-success":"text-danger"),children:[h.value>0?(0,t.jsx)(i.f,{className:"h-3 w-3"}):(0,t.jsx)(r,{className:"h-3 w-3"}),Math.abs(h.value).toFixed(+!Number.isInteger(h.value)),h.unit]})]}),d&&(0,t.jsx)("div",{className:(0,l.f)("mt-1 text-[11px]",d.positive?"text-success":"text-danger"),children:d.value}),void 0!==x&&(0,t.jsx)(m,{value:x,className:"mt-3",label:e}),c&&c.length>1&&(0,t.jsx)("div",{className:"-mx-5 -mb-5 mt-3 opacity-80",children:(0,t.jsx)(p,{values:c,tone:u,width:240,height:28,stretch:!0,live:!1})})]})}],93999)},3062,e=>{"use strict";var t=e.i(43476),a=e.i(78571),s=e.i(35084);let r={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)]"},i={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)]"},l={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"},n={none:"",sm:"p-3",md:"p-5",lg:"p-6"};e.s(["f",0,function({tone:e="primary",corners:o=!0,interactive:d=!0,hero:c=!1,title:m,description:x,icon:p,action:h,as:u="div",padding:g="md",testId:f,className:v,children:b,...j}){return(0,t.jsxs)(u,{...j,"data-testid":f??j["data-testid"],className:(0,a.f)("relative rounded-panel border border-border bg-surface transition-colors duration-300",n[g],o&&"panel-corners",o&&r[e],d&&"glow-hover",d&&i[e],d&&l[e],c&&"grid-bg overflow-hidden bg-surface/80",v),children:[(m||h||p)&&(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:[p&&(0,t.jsx)("span",{className:(0,a.f)("mt-0.5 shrink-0",s.T[e]),children:p}),(0,t.jsxs)("div",{className:"min-w-0",children:[m&&(0,t.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider",children:m}),x&&(0,t.jsx)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:x})]})]}),h]}),b]})}])},63376,e=>{"use strict";var t=e.i(43476);e.s(["z",0,function({children:e,className:a}){return(0,t.jsx)("div",{className:`animate-page-in${a?` ${a}`:""}`,children:e})},"U",0,function({children:e,className:a}){return(0,t.jsx)("div",{className:a,children:e})}])},9347,e=>{"use strict";var t=e.i(56420);let a={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],9347)},75775,e=>{"use strict";var t=e.i(56420);let a={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],75775)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,5475,e=>{"use strict";var t=e.i(43476),a=e.i(22016),s=e.i(18566),r=e.i(71645),i=e.i(63376),l=e.i(93999),n=e.i(82983),o=e.i(9347),d=e.i(71567),c=e.i(56420);let m={name:"clock-3",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]]};m.node;let x=(0,c.f)(m);var p=e.i(69846),h=e.i(41120),u=e.i(63644),g=e.i(4139),f=e.i(64569);e.s(["default",0,function(){let e=(0,s.useParams)(),[c,m]=(0,r.useState)(null),[v,b]=(0,r.useState)(null),[j,y]=(0,r.useState)([]),[N,w]=(0,r.useState)([]),[k,$]=(0,r.useState)(!1),[_,I]=(0,r.useState)(!0),z=(0,r.useCallback)(async()=>{I(!0);try{let[t,a,s,r]=await Promise.allSettled([n.f.anomalies.correlation(e.anomalyId),n.f.assistant.conversations({type:"heartbeat",status:"all",pageSize:1}),n.f.remediation.listRules(),n.f.remediation.listExecutions({pageSize:20})]);if("fulfilled"===t.status&&m(t.value.data??null),"fulfilled"===a.status&&b(a.value.data?.conversations?.[0]??null),"fulfilled"===s.status&&y((s.value.data??[]).filter(e=>e.enabled)),"fulfilled"===r.status){let t=r.value.data?.executions??[];w(t.filter(t=>t.anomalyEventId===e.anomalyId))}}catch{}finally{I(!1)}},[e.anomalyId]);(0,r.useEffect)(()=>{z()},[z]);let S=async t=>{$(!0);try{await n.f.remediation.trigger({anomalyEventId:e.anomalyId,ruleId:t}),await z()}catch{}finally{$(!1)}},C=(0,r.useMemo)(()=>c?[{id:c.anomaly.id,kind:"target-anomaly",title:`Primary anomaly • ${c.anomaly.metric}`,timestamp:c.anomaly.createdAt,detail:`Value ${c.anomaly.value.toFixed(2)} • z-score ${c.anomaly.zScore.toFixed(2)} • severity ${c.anomaly.severity}`,nodeId:c.anomaly.nodeId},...c.group.anomalies.filter(e=>e.id!==c.anomaly.id).map(e=>({id:e.id,kind:"correlated-anomaly",title:`Correlated anomaly • ${e.metric}`,timestamp:e.createdAt,detail:`Value ${e.value.toFixed(2)} • z-score ${e.zScore.toFixed(2)} • severity ${e.severity}`,nodeId:e.nodeId})),...c.group.relatedCommands.map(e=>({id:e.id,kind:"command",title:`Related command • ${e.command}`,timestamp:e.createdAt,detail:`Status ${e.status}`,nodeId:e.nodeId}))].sort((e,t)=>e.timestamp.localeCompare(t.timestamp)):[],[c]);return(0,t.jsxs)(i.U,{children:[(0,t.jsx)(i.z,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(a.default,{href:"/anomalies",className:"mb-2 inline-flex items-center gap-1 text-xs uppercase tracking-wider text-text-muted hover:text-primary",children:[(0,t.jsx)(o.f,{className:"h-3.5 w-3.5"}),"Back to anomalies"]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(u.f,{className:"h-5 w-5 text-primary"}),(0,t.jsx)("h1",{className:"text-2xl font-bold uppercase tracking-wider text-text",children:"AI anomaly analysis"})]}),(0,t.jsx)("p",{className:"mt-1 text-xs uppercase tracking-wider text-text-muted",children:"Correlation timeline, root-cause hypotheses, and recommended actions"})]}),(0,t.jsxs)("button",{onClick:()=>void z(),className:"inline-flex items-center gap-2 rounded border border-border px-3 py-2 text-xs font-semibold uppercase tracking-wider text-text-muted transition-colors hover:border-primary/40 hover:text-primary",children:[(0,t.jsx)(h.f,{className:`h-3.5 w-3.5 ${_?"animate-spin":""}`}),"Refresh"]})]})}),c||_?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.z,{children:(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-3",children:[(0,t.jsxs)(l.N,{className:"p-4 lg:col-span-2",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(p.f,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"AI summary"})]}),(0,t.jsx)("p",{className:"text-sm text-text",children:c?.analysis.summary??(_?"Loading analysis…":"No summary available.")}),c&&(0,t.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-3",children:[(0,t.jsxs)("div",{className:"rounded border border-border/60 bg-bg/40 p-3",children:[(0,t.jsx)("p",{className:"text-lg font-bold text-text",children:c.group.anomalies.length}),(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Correlated anomalies"})]}),(0,t.jsxs)("div",{className:"rounded border border-border/60 bg-bg/40 p-3",children:[(0,t.jsx)("p",{className:"text-lg font-bold text-text",children:c.group.relatedCommands.length}),(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Related commands"})]}),(0,t.jsxs)("div",{className:"rounded border border-border/60 bg-bg/40 p-3",children:[(0,t.jsx)("p",{className:"text-lg font-bold text-text",children:c.analysis.blastRadius}),(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Blast radius"})]})]})]}),(0,t.jsxs)(l.N,{className:"p-4",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(d.f,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"Heartbeat context"})]}),v?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("p",{className:"text-sm text-text",children:"A legacy heartbeat analysis exists for this anomaly. New fleet checks are recorded as cron logs and exposed through the Magnus API."})}):(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"No legacy heartbeat conversation is attached. Use the fleet check logs for current cron-owned status."})]})]})}),(0,t.jsx)(i.z,{children:(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 xl:grid-cols-[1.35fr_0.85fr]",children:[(0,t.jsxs)(l.N,{className:"p-4",children:[(0,t.jsxs)("div",{className:"mb-4 flex items-center gap-2",children:[(0,t.jsx)(x,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"Correlation timeline"})]}),(0,t.jsx)("div",{className:"space-y-3",children:C.map(e=>{var a;return(0,t.jsxs)("div",{className:`rounded border p-3 ${"target-anomaly"===(a=e.kind)?"border-primary/30 bg-primary/5 text-primary":"command"===a?"border-warning/30 bg-warning/5 text-warning":"border-border bg-surface-hover text-text"}`,children:[(0,t.jsxs)("div",{className:"mb-1 flex items-center justify-between gap-3",children:[(0,t.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider",children:e.title}),(0,t.jsx)("span",{className:"text-[10px] opacity-80",children:new Date(e.timestamp).toLocaleString()})]}),(0,t.jsx)("p",{className:"text-[11px] opacity-90",children:e.detail}),(0,t.jsxs)("p",{className:"mt-1 text-[10px] opacity-70",children:["Node: ",e.nodeId]})]},`${e.kind}-${e.id}`)})})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)(l.N,{className:"p-4",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(g.f,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"Suspected triggers"})]}),(0,t.jsx)("ul",{className:"space-y-2 text-sm text-text-muted",children:(c?.analysis.suspectedTriggers??[]).map(e=>(0,t.jsx)("li",{className:"rounded border border-border/60 bg-bg/40 px-3 py-2",children:e},e))})]}),(0,t.jsxs)(l.N,{className:"p-4",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(u.f,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"Recommended actions"})]}),(0,t.jsx)("ul",{className:"space-y-2 text-sm text-text-muted",children:(c?.analysis.recommendedActions??[]).map(e=>(0,t.jsx)("li",{className:"rounded border border-border/60 bg-bg/40 px-3 py-2",children:e},e))})]}),(0,t.jsxs)(l.N,{className:"p-4",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(f.f,{className:"h-4 w-4 text-primary"}),(0,t.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-text-muted",children:"Auto-Remediation"})]}),j.length>0?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{className:"text-[11px] text-text-muted",children:"Trigger a remediation rule for this anomaly:"}),j.map(e=>(0,t.jsxs)("button",{disabled:k,onClick:()=>void S(e.id),className:"flex w-full items-center justify-between rounded border border-border/60 bg-bg/40 px-3 py-2 text-left text-sm text-text transition-colors hover:border-primary/40 disabled:opacity-50",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-semibold",children:e.name}),e.description&&(0,t.jsxs)("span",{className:"ml-2 text-text-muted text-xs",children:["— ",e.description]})]}),(0,t.jsx)(f.f,{className:"h-3.5 w-3.5 text-primary shrink-0"})]},e.id))]}):(0,t.jsxs)("p",{className:"text-sm text-text-muted",children:["No active remediation rules."," ",(0,t.jsx)(a.default,{href:"/anomalies/remediation",className:"text-primary hover:underline",children:"Create one"})]}),N.length>0&&(0,t.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-[11px] uppercase tracking-wider text-text-muted",children:"Executions for this anomaly"}),N.map(e=>(0,t.jsxs)("div",{className:"rounded border border-border/60 bg-bg/40 px-3 py-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,t.jsx)("span",{className:"font-semibold text-text",children:e.rule?.name??e.ruleId}),(0,t.jsx)("span",{className:`rounded px-2 py-0.5 font-semibold ${"completed"===e.status?"bg-success/20 text-success":"failed"===e.status?"bg-danger/20 text-danger":"running"===e.status?"bg-warning/20 text-warning":"bg-primary/20 text-primary"}`,children:e.status})]}),(0,t.jsx)("p",{className:"mt-1 text-[11px] text-text-muted",children:new Date(e.triggeredAt).toLocaleString()})]},e.id))]})]})]})]})})]}):(0,t.jsx)(i.z,{children:(0,t.jsx)(l.N,{className:"p-6 text-sm text-text-muted",children:"We couldn’t load correlation details for this anomaly."})})]})}],5475)},93999,51196,55427,e=>{"use strict";var t=e.i(43476),a=e.i(56420);let s={name:"arrow-down-right",size:24,node:[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]};s.node;let r=(0,a.f)(s);var i=e.i(75775),l=e.i(78571),n=e.i(3062),o=e.i(35084);let d={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)]"},c={xs:"h-1",sm:"h-1.5",md:"h-2"};function m({value:e,max:a=100,tone:s,thresholds:r=o.q,label:i,size:n="xs",showValue:x=!1,valueLabel:p,glow:h,className:u,testId:g}){let f="number"==typeof e&&Number.isFinite(e),v=f?Math.max(0,Math.min(100,e/(a||1)*100)):0,b=s??(f?(0,o.Z)(v,r):"muted"),j=h||!s&&f&&v>=r.warn,y=p??(f?`${v.toFixed(+(v<10&&v>0))}%`:"—");return(0,t.jsxs)("div",{className:(0,l.f)("flex min-w-0 items-center gap-2",u),"data-testid":g,children:[(0,t.jsx)("div",{...f?{role:"meter","aria-label":i,"aria-valuemin":0,"aria-valuemax":a,"aria-valuenow":e,"aria-valuetext":y}:{role:"img","aria-label":i?`${i}: no data`:"No data"},className:(0,l.f)("relative flex-1 overflow-hidden rounded-full bg-border/70",c[n]),children:(0,t.jsx)("div",{style:{"--meter":`${v}%`},className:(0,l.f)("h-full w-(--meter) rounded-full transition-[width] duration-700 ease-out-expo starting:w-0",o.H[b],j&&d[b])})}),x&&(0,t.jsx)("span",{className:(0,l.f)("num w-11 shrink-0 text-right text-[11px]",f?o.T[b]:"text-text-muted"),children:y})]})}e.s(["f",0,m],51196);var x=e.i(71645);function p({values:e,tone:a="primary",width:s=160,height:r=32,area:i=!0,max:n,percent:d=!1,threshold:c,live:m=!0,emptyLabel:h="not enough data",className:u,testId:g,label:f,stretch:v=!1}){let b=`spark${(0,x.useId)().replace(/:/g,"")}`;if(e.length<2)return(0,t.jsx)("div",{className:(0,l.f)("flex h-8 items-center text-xs italic text-text-muted",u),"data-testid":g,children:h});let j=o.v[a],y=n??(d?Math.max(100,...e):Math.max(...e,c??0)||1),N=r-4,w=s/(e.length-1),k=e=>2+N-Math.max(0,e)/y*N,$=e.map((e,t)=>[t*w,k(e)]),_=$.map(([e,t])=>`${e.toFixed(1)},${t.toFixed(1)}`).join(" "),I=$[$.length-1];return(0,t.jsxs)("svg",{width:v?"100%":s,height:r,viewBox:`0 0 ${s} ${r}`,preserveAspectRatio:v?"none":void 0,className:(0,l.f)("block overflow-visible",u),"data-testid":g,role:f?"img":void 0,"aria-label":f,"aria-hidden":!f||void 0,children:[i&&(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,${r} ${_} ${s},${r}`,fill:`url(#${b})`})]}),void 0!==c&&(0,t.jsx)("line",{x1:0,x2:s,y1:k(c),y2:k(c),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&&!v&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:I[0],cy:I[1],r:2.5,fill:j,className:"origin-center animate-halo [transform-box:fill-box]"}),(0,t.jsx)("circle",{cx:I[0],cy:I[1],r:2,fill:j})]})]})}e.s(["f",0,p],55427),e.s(["N",0,function({title:e,description:a,children:s,className:r,action:i,tone:l,corners:o=!1,...d}){return(0,t.jsx)(n.f,{...d,tone:l,corners:o,title:e,description:a,action:i,className:r,children:s})},"n",0,function({label:e,value:a,icon:s,trend:d,spark:c,meter:x,delta:h,tone:u="primary",className:g,testId:f}){let v=!h||h.value>=0===(h.positiveIsGood??!0);return(0,t.jsxs)(n.f,{tone:u,className:(0,l.f)("overflow-hidden",g),testId:f,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}),s&&(0,t.jsx)("span",{className:"text-primary/60",children:s})]}),(0,t.jsxs)("div",{className:"mt-2 flex items-end justify-between gap-2",children:[(0,t.jsx)("div",{className:(0,l.f)("num text-2xl font-bold","primary"===u?"text-primary neon-text":o.T[u]),children:a}),h&&0!==h.value&&(0,t.jsxs)("span",{className:(0,l.f)("num mb-1 inline-flex items-center gap-0.5 text-[11px]",v?"text-success":"text-danger"),children:[h.value>0?(0,t.jsx)(i.f,{className:"h-3 w-3"}):(0,t.jsx)(r,{className:"h-3 w-3"}),Math.abs(h.value).toFixed(+!Number.isInteger(h.value)),h.unit]})]}),d&&(0,t.jsx)("div",{className:(0,l.f)("mt-1 text-[11px]",d.positive?"text-success":"text-danger"),children:d.value}),void 0!==x&&(0,t.jsx)(m,{value:x,className:"mt-3",label:e}),c&&c.length>1&&(0,t.jsx)("div",{className:"-mx-5 -mb-5 mt-3 opacity-80",children:(0,t.jsx)(p,{values:c,tone:u,width:240,height:28,stretch:!0,live:!1})})]})}],93999)},3062,e=>{"use strict";var t=e.i(43476),a=e.i(78571),s=e.i(35084);let r={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)]"},i={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)]"},l={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"},n={none:"",sm:"p-3",md:"p-5",lg:"p-6"};e.s(["f",0,function({tone:e="primary",corners:o=!0,interactive:d=!0,hero:c=!1,title:m,description:x,icon:p,action:h,as:u="div",padding:g="md",testId:f,className:v,children:b,...j}){return(0,t.jsxs)(u,{...j,"data-testid":f??j["data-testid"],className:(0,a.f)("relative rounded-panel border border-border bg-surface transition-colors duration-300",n[g],o&&"panel-corners",o&&r[e],d&&"glow-hover",d&&i[e],d&&l[e],c&&"grid-bg overflow-hidden bg-surface/80",v),children:[(m||h||p)&&(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:[p&&(0,t.jsx)("span",{className:(0,a.f)("mt-0.5 shrink-0",s.T[e]),children:p}),(0,t.jsxs)("div",{className:"min-w-0",children:[m&&(0,t.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider",children:m}),x&&(0,t.jsx)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:x})]})]}),h]}),b]})}])},63376,e=>{"use strict";var t=e.i(43476);e.s(["z",0,function({children:e,className:a}){return(0,t.jsx)("div",{className:`animate-page-in${a?` ${a}`:""}`,children:e})},"U",0,function({children:e,className:a}){return(0,t.jsx)("div",{className:a,children:e})}])},9347,e=>{"use strict";var t=e.i(56420);let a={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],9347)},75775,e=>{"use strict";var t=e.i(56420);let a={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],75775)}]);