@omnitron-dev/omnitron 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/bin/pnpmfile-sdk.mjs +6 -1
  2. package/bin/sdk.mjs +6 -2
  3. package/dist/BUILD.json +2 -2
  4. package/dist/cli/omnitron.js +54 -14
  5. package/dist/cli/omnitron.js.map +1 -1
  6. package/dist/commands/infra.d.ts +8 -2
  7. package/dist/commands/infra.d.ts.map +1 -1
  8. package/dist/commands/infra.js +52 -59
  9. package/dist/commands/infra.js.map +1 -1
  10. package/dist/commands/node.d.ts.map +1 -1
  11. package/dist/commands/node.js +8 -1
  12. package/dist/commands/node.js.map +1 -1
  13. package/dist/commands/release-store.d.ts.map +1 -1
  14. package/dist/commands/release-store.js +6 -9
  15. package/dist/commands/release-store.js.map +1 -1
  16. package/dist/commands/release.d.ts +4 -1
  17. package/dist/commands/release.d.ts.map +1 -1
  18. package/dist/commands/release.js +125 -5
  19. package/dist/commands/release.js.map +1 -1
  20. package/dist/commands/stack.d.ts +1 -1
  21. package/dist/commands/stack.d.ts.map +1 -1
  22. package/dist/commands/stack.js +19 -9
  23. package/dist/commands/stack.js.map +1 -1
  24. package/dist/config/saved.d.ts +3 -0
  25. package/dist/config/saved.d.ts.map +1 -1
  26. package/dist/config/saved.js +1 -0
  27. package/dist/config/saved.js.map +1 -1
  28. package/dist/config/types.d.ts +4 -0
  29. package/dist/config/types.d.ts.map +1 -1
  30. package/dist/daemon/daemon.d.ts.map +1 -1
  31. package/dist/daemon/daemon.js +30 -6
  32. package/dist/daemon/daemon.js.map +1 -1
  33. package/dist/daemon/daemon.rpc-service.d.ts +0 -26
  34. package/dist/daemon/daemon.rpc-service.d.ts.map +1 -1
  35. package/dist/daemon/daemon.rpc-service.js +23 -114
  36. package/dist/daemon/daemon.rpc-service.js.map +1 -1
  37. package/dist/daemon/execution-client.d.ts +1 -1
  38. package/dist/daemon/execution-client.d.ts.map +1 -1
  39. package/dist/daemon/execution-client.js +17 -13
  40. package/dist/daemon/execution-client.js.map +1 -1
  41. package/dist/daemon/startup-config.d.ts +1 -0
  42. package/dist/daemon/startup-config.d.ts.map +1 -1
  43. package/dist/infrastructure/container-runtime.d.ts +8 -0
  44. package/dist/infrastructure/container-runtime.d.ts.map +1 -1
  45. package/dist/infrastructure/container-runtime.js +5 -0
  46. package/dist/infrastructure/container-runtime.js.map +1 -1
  47. package/dist/infrastructure/infrastructure.service.d.ts +5 -0
  48. package/dist/infrastructure/infrastructure.service.d.ts.map +1 -1
  49. package/dist/infrastructure/infrastructure.service.js +18 -8
  50. package/dist/infrastructure/infrastructure.service.js.map +1 -1
  51. package/dist/infrastructure/presets/postgres.js +1 -1
  52. package/dist/infrastructure/presets/postgres.js.map +1 -1
  53. package/dist/infrastructure/presets/registry.d.ts.map +1 -1
  54. package/dist/infrastructure/presets/registry.js +11 -19
  55. package/dist/infrastructure/presets/registry.js.map +1 -1
  56. package/dist/infrastructure/stack-infra-manager.d.ts +4 -0
  57. package/dist/infrastructure/stack-infra-manager.d.ts.map +1 -1
  58. package/dist/infrastructure/stack-infra-manager.js +38 -4
  59. package/dist/infrastructure/stack-infra-manager.js.map +1 -1
  60. package/dist/mcp/tool-groups/infra.tools.d.ts.map +1 -1
  61. package/dist/mcp/tool-groups/infra.tools.js +4 -1
  62. package/dist/mcp/tool-groups/infra.tools.js.map +1 -1
  63. package/dist/orchestrator/app-name.d.ts +33 -0
  64. package/dist/orchestrator/app-name.d.ts.map +1 -0
  65. package/dist/orchestrator/app-name.js +68 -0
  66. package/dist/orchestrator/app-name.js.map +1 -0
  67. package/dist/orchestrator/orchestrator.service.d.ts +1 -26
  68. package/dist/orchestrator/orchestrator.service.d.ts.map +1 -1
  69. package/dist/orchestrator/orchestrator.service.js +10 -89
  70. package/dist/orchestrator/orchestrator.service.js.map +1 -1
  71. package/dist/project/stack-diagnosis.d.ts.map +1 -1
  72. package/dist/project/stack-diagnosis.js +2 -3
  73. package/dist/project/stack-diagnosis.js.map +1 -1
  74. package/dist/release/artifact-store.d.ts +42 -7
  75. package/dist/release/artifact-store.d.ts.map +1 -1
  76. package/dist/release/artifact-store.js +176 -62
  77. package/dist/release/artifact-store.js.map +1 -1
  78. package/dist/release/configured-store.d.ts +6 -0
  79. package/dist/release/configured-store.d.ts.map +1 -0
  80. package/dist/release/configured-store.js +54 -0
  81. package/dist/release/configured-store.js.map +1 -0
  82. package/dist/release/load.d.ts +3 -0
  83. package/dist/release/load.d.ts.map +1 -1
  84. package/dist/release/load.js +8 -2
  85. package/dist/release/load.js.map +1 -1
  86. package/dist/services/infrastructure.rpc-service.d.ts +6 -2
  87. package/dist/services/infrastructure.rpc-service.d.ts.map +1 -1
  88. package/dist/services/infrastructure.rpc-service.js +43 -12
  89. package/dist/services/infrastructure.rpc-service.js.map +1 -1
  90. package/dist/services/node-deploy-lease.d.ts +4 -1
  91. package/dist/services/node-deploy-lease.d.ts.map +1 -1
  92. package/dist/services/node-deploy-lease.js +29 -4
  93. package/dist/services/node-deploy-lease.js.map +1 -1
  94. package/dist/services/node-manager.service.d.ts +5 -25
  95. package/dist/services/node-manager.service.d.ts.map +1 -1
  96. package/dist/services/node-manager.service.js +150 -139
  97. package/dist/services/node-manager.service.js.map +1 -1
  98. package/dist/services/project.service.d.ts +6 -0
  99. package/dist/services/project.service.d.ts.map +1 -1
  100. package/dist/services/project.service.js +89 -9
  101. package/dist/services/project.service.js.map +1 -1
  102. package/dist/services/release.rpc-service.d.ts +2 -1
  103. package/dist/services/release.rpc-service.d.ts.map +1 -1
  104. package/dist/services/release.rpc-service.js +19 -3
  105. package/dist/services/release.rpc-service.js.map +1 -1
  106. package/dist/services/release.service.d.ts +24 -11
  107. package/dist/services/release.service.d.ts.map +1 -1
  108. package/dist/services/release.service.js +162 -39
  109. package/dist/services/release.service.js.map +1 -1
  110. package/dist/services/remote-deployer.service.d.ts +1 -1
  111. package/dist/services/remote-deployer.service.d.ts.map +1 -1
  112. package/dist/services/remote-deployer.service.js.map +1 -1
  113. package/dist/services/secrets.service.d.ts +6 -0
  114. package/dist/services/secrets.service.d.ts.map +1 -1
  115. package/dist/services/secrets.service.js +95 -51
  116. package/dist/services/secrets.service.js.map +1 -1
  117. package/dist/shared/dto/nodes.d.ts +2 -0
  118. package/dist/shared/dto/nodes.d.ts.map +1 -1
  119. package/dist/shared/dto/project.d.ts +1 -1
  120. package/dist/shared/dto/project.d.ts.map +1 -1
  121. package/dist/shared/dto/releases.d.ts +8 -1
  122. package/dist/shared/dto/releases.d.ts.map +1 -1
  123. package/dist/shared/dto/services.d.ts +18 -1
  124. package/dist/shared/dto/services.d.ts.map +1 -1
  125. package/dist/shared/dto/services.js.map +1 -1
  126. package/dist/shared/release-reading.d.ts +6 -0
  127. package/dist/shared/release-reading.d.ts.map +1 -1
  128. package/dist/shared/release-reading.js +42 -0
  129. package/dist/shared/release-reading.js.map +1 -1
  130. package/package.json +16 -16
  131. package/webapp/dist/BUILD.json +2 -2
  132. package/webapp/dist/assets/{access-48hkC2-P.js → access-BvKK9dEv.js} +1 -1
  133. package/webapp/dist/assets/{access-jWkHxGc7.js → access-DUjabwNX.js} +1 -1
  134. package/webapp/dist/assets/{alerts-CuPQ9YQJ.js → alerts-CzN6OqX5.js} +1 -1
  135. package/webapp/dist/assets/{apps-Drio028B.js → apps-G_Lm6m4F.js} +1 -1
  136. package/webapp/dist/assets/{audit-npSFJECe.js → audit-CLMpdBzG.js} +1 -1
  137. package/webapp/dist/assets/{containers-Bl8gAyZX.js → containers-BsFwprq4.js} +1 -1
  138. package/webapp/dist/assets/{dashboard-UHlet3H9.js → dashboard-BN7rKE5n.js} +1 -1
  139. package/webapp/dist/assets/{dashboard-builder-67PZFqhE.js → dashboard-builder-BXFxWjXP.js} +1 -1
  140. package/webapp/dist/assets/deploy-progress-CUUwlYtQ.js +1 -0
  141. package/webapp/dist/assets/deploy-release-dialog-58lGZDNk.js +1 -0
  142. package/webapp/dist/assets/deployments-DEzjHerg.js +1 -0
  143. package/webapp/dist/assets/detail-CBn9pjJU.js +2 -0
  144. package/webapp/dist/assets/{detail-CYS81K6Y.js → detail-Dj3gxaH0.js} +1 -1
  145. package/webapp/dist/assets/{detail-B4TiBfxU.js → detail-pXPk4O0E.js} +1 -1
  146. package/webapp/dist/assets/index-Bo9An3pJ.js +1 -0
  147. package/webapp/dist/assets/{logs-BqHOufk8.js → logs-DrsBbLfb.js} +1 -1
  148. package/webapp/dist/assets/{metrics-QIQaF7iS.js → metrics-D5cDZTEo.js} +1 -1
  149. package/webapp/dist/assets/{mui-y44PQOfG.js → mui-59N0OVRa.js} +1 -1
  150. package/webapp/dist/assets/{mui-C_hromOc.js → mui-D5m7fDCh.js} +1 -1
  151. package/webapp/dist/assets/{mui-BIz4LSVs.js → mui-Db5J-QUd.js} +1 -1
  152. package/webapp/dist/assets/{mui-B1jrje6Z.js → mui-dLCwWoMw.js} +1 -1
  153. package/webapp/dist/assets/{nodes-BJPk02vv.js → nodes-CwwZZuu4.js} +1 -1
  154. package/webapp/dist/assets/{pipelines-T6Ch9LTw.js → pipelines-BrfTjf6Y.js} +1 -1
  155. package/webapp/dist/assets/project.store-DuCgv6Eq.js +1 -0
  156. package/webapp/dist/assets/{projects-YoBzcQ24.js → projects-TBAdpCeX.js} +1 -1
  157. package/webapp/dist/assets/{realtime.store-CBDO4Abj.js → realtime.store-hfxZD2DU.js} +1 -1
  158. package/webapp/dist/assets/release-bits-BJ6i23y0.js +1 -0
  159. package/webapp/dist/assets/release-build-panel-BNXkwNE1.js +1 -0
  160. package/webapp/dist/assets/release-deployment-state-gN8ZT3aq.js +1 -0
  161. package/webapp/dist/assets/releases-CXXKUh-v.js +2 -0
  162. package/webapp/dist/assets/{stack-start-notice-BVnMOwRQ.js → stack-start-notice-D-AH_bzn.js} +1 -1
  163. package/webapp/dist/assets/{stacks-IZ1mfizi.js → stacks-WY_ynkON.js} +1 -1
  164. package/webapp/dist/assets/{system-info-BFKNM-hf.js → system-info-DXMwo6gl.js} +1 -1
  165. package/webapp/dist/assets/{topology-CPey5dP6.js → topology-C_Qp1RqW.js} +1 -1
  166. package/webapp/dist/assets/{use-stack-context-UkBsF-l7.js → use-stack-context-8yaHaN8L.js} +1 -1
  167. package/webapp/dist/assets/{webapp-D-UhjFhS.js → webapp-BO_WoB_z.js} +3 -3
  168. package/webapp/dist/console-version.json +1 -1
  169. package/webapp/dist/index.html +12 -12
  170. package/webapp/dist/assets/deploy-release-dialog-BOXcD5Wo.js +0 -1
  171. package/webapp/dist/assets/deployments-qV20Ak0P.js +0 -1
  172. package/webapp/dist/assets/detail-B85-Wees.js +0 -2
  173. package/webapp/dist/assets/index-uq8Dkk4c.js +0 -1
  174. package/webapp/dist/assets/project.store--G5pIF-J.js +0 -1
  175. package/webapp/dist/assets/release-bits-B2a_wbft.js +0 -1
  176. package/webapp/dist/assets/release-build-panel-BQmIdKW9.js +0 -1
  177. package/webapp/dist/assets/release-deployment-state-DRrEI2pP.js +0 -1
  178. package/webapp/dist/assets/release-wire-f2VuBoBF.js +0 -1
  179. package/webapp/dist/assets/releases-Bp3CDgmo.js +0 -2
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{H as r,P as i,V as a,z as o}from"./client-DFnuv2z3.js";import{D as s,F as c,H as l,I as u,M as d,O as ee,Q as f,V as p,Z as m,c as te,ct as h,d as ne,f as g,g as _,h as re,j as v,l as ie,m as y,p as b,s as x,st as ae,u as S}from"./mui-BXSXx9c9.js";import{B as C,z as w}from"./mui-Cd711nOk.js";import{E as T,T as oe,it as E,rt as D}from"./mui-AnEgAVjz.js";import{_ as O,v as k}from"./mui-BwsIrivo.js";import{n as se,r as A,t as j}from"./alert-uBG6r9NW.js";import{n as M,s as N}from"./access-48hkC2-P.js";import{r as ce,t as le}from"./use-polled-resource-B22hhr5L.js";import{i as P,n as ue,r as de,t as F}from"./project.store--G5pIF-J.js";import{B as fe,G as I,M as pe,k as me,m as L,p as he,z as ge}from"./icons-OboZgWSt.js";import{n as R,t as _e}from"./operation-status-Bm1x1wTz.js";import{n as z,t as B}from"./table-BOWT6Y9d.js";import{n as V,t as ve}from"./page-breadcrumbs-fR7Jmpp4.js";import{s as ye}from"./formatters-RnRy4bXm.js";import{n as be,r as xe,t as Se}from"./stack-health-status-BIv2C10x.js";import{a as H,c as Ce,r as U,s as W}from"./sync-reading-CN0jPKAg.js";import{n as G,t as we}from"./deploy-release-dialog-BOXcD5Wo.js";import{n as Te,t as K}from"./release-deployment-state-DRrEI2pP.js";import{a as Ee,c as De,i as Oe,l as ke,n as Ae,o as je,r as Me,s as Ne,t as Pe,u as Fe}from"./stack-start-notice-BVnMOwRQ.js";function Ie({operation:e}){if(!e||e.supersededAt)return null;let t=e.phase===`failed`,n=e.phase===`stopped`,r=e.nodes.filter(e=>e.outcome===`stopped`).length;if(n&&!e.nodes.length)return null;let i=e.nodes.map(e=>(0,q.jsxs)(p,{sx:{display:`flex`,flexWrap:`wrap`,columnGap:1.5,mt:.75},children:[(0,q.jsx)(w,{variant:`body2`,sx:{fontFamily:`monospace`,overflowWrap:`anywhere`},children:e.node}),(0,q.jsx)(w,{variant:`body2`,children:e.outcome===`unknown`?`Awaiting confirmation`:e.outcome}),e.authority&&(0,q.jsxs)(w,{variant:`caption`,sx:{overflowWrap:`anywhere`},children:[e.authority.clusterId,` · epoch `,e.authority.epoch,` · `,e.authority.nodeId]}),e.reason&&(0,q.jsx)(w,{variant:`caption`,sx:{width:`100%`,overflowWrap:`anywhere`},children:e.reason})]},e.node));return n?(0,q.jsxs)(p,{component:`details`,sx:{mb:2,minWidth:0,typography:`body2`,"& summary":{cursor:`pointer`}},children:[(0,q.jsxs)(`summary`,{children:[`Stop confirmed · `,r,`/`,e.nodes.length,` nodes`]}),i]}):(0,q.jsx)(j,{severity:t?`error`:`info`,sx:{mb:2,minWidth:0},children:(0,q.jsxs)(p,{role:`status`,"aria-live":`polite`,sx:{minWidth:0},children:[(0,q.jsxs)(w,{variant:`subtitle2`,children:[t?e.intentCommitted?`Stop not confirmed`:`Stop declined before execution`:e.phase===`preparing`?`Checking stop ownership`:`Stopping stack`,e.nodes.length>0&&` · ${r}/${e.nodes.length} nodes confirmed`]}),!t&&(0,q.jsx)(oe,{"aria-label":`Stack stop in progress`,sx:{mt:1,mb:1.5}}),e.error&&(0,q.jsx)(w,{variant:`body2`,sx:{overflowWrap:`anywhere`},children:e.error}),i]})})}var q;function Le(){return(Le=e((()=>{l(),C(),T(),A(),q=n()})))()}function Re({children:e,gap:t=Be,fill:n,sx:r,ref:i,...a}){return(0,ze.jsx)(O,{ref:i,spacing:t,sx:{...n&&{flex:1},...r},...a,children:e})}var ze,Be;function Ve(){return(Ve=e((()=>{t(),k(),ze=n(),Be=3})))()}function He({project:e,stack:t,requiresRelease:n,managed:r,selected:i,onDeploy:a,onWorkingTree:o}){return(0,J.jsxs)(p,{sx:{mb:2,minWidth:0},children:[!r&&(0,J.jsxs)(O,{direction:`row`,useFlexGap:!0,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:1},children:[i&&(0,J.jsx)(m,{label:`Selected: `+i,size:`small`,variant:`outlined`}),n&&(0,J.jsx)(m,{label:`Release required`,size:`small`,variant:`outlined`}),(0,J.jsx)(p,{sx:{flex:1}}),o&&(0,J.jsx)(M,{permission:`OmnitronProject.startStack`,children:(0,J.jsx)(c,{size:`small`,onClick:o,children:`Use working tree…`})}),(0,J.jsx)(M,{permission:`OmnitronProject.startStack`,children:(0,J.jsx)(c,{size:`small`,startIcon:(0,J.jsx)(L,{}),onClick:a,children:`Deploy release…`})})]}),(0,J.jsx)(K,{project:e,stack:t},`${e}/${t}`)]})}var J;function Ue(){return(Ue=e((()=>{l(),u(),f(),k(),N(),I(),Te(),J=n()})))()}function We(){let{name:e}=r(),t=a(),n=ue(),o=de(),l=P(e=>!!(n&&e.stacksByProject[n])),u=P(e=>n?e.stackReadErrors[n]:null),d=P(e=>e.fetchStacks),ee=P(e=>e.resumeInstalledStack),f=P(e=>e.startStack),te=P(e=>e.stopStack),h=P(e=>e.deleteStack),g=`${n}/${e}`,_=P(e=>e.stackNotices[g]),y=P(e=>e.clearStackNotice),S=P(e=>e.pendingOps),[C,T]=(0,Z.useState)(!1),[oe,E]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(!1),[A,N]=(0,Z.useState)(!1),[le,F]=(0,Z.useState)(!1),I=o.find(t=>t.name===e),R=n&&e?S[`${n}/${e}`]??null:null,z=Object.keys(S).length>0;ce(()=>void(n&&d(n)),{intervalMs:z?3e3:1e4,enabled:!!n,resourceKey:n});let V=(0,Z.useCallback)(async()=>{n&&e&&await f(n,e)},[n,e,f]),xe=(0,Z.useCallback)(async()=>{if(n&&e){try{await h(n,e),t(`/stacks`)}catch{}T(!1)}},[n,e,h,t]);if(!I&&n&&u)return(0,Q.jsxs)(j,{severity:`error`,children:[`Stack inventory unavailable · `,u,` `,(0,Q.jsx)(c,{onClick:()=>void d(n),children:`Retry`})]});if(!I&&n&&!l)return(0,Q.jsx)(_e,{active:!0,label:`Reading stack inventory`});if(!I)return(0,Q.jsx)(Re,{children:(0,Q.jsxs)(j,{severity:`warning`,children:[`Stack "`,e,`" not found.`,` `,(0,Q.jsx)(c,{size:`small`,onClick:()=>t(`/stacks`),children:`Back to Stacks`})]})});let H=[{id:`name`,label:`App`,render:e=>(0,Q.jsx)(p,{sx:{fontWeight:600},children:e.name})},{id:`status`,label:`Process`,render:e=>(0,Q.jsx)(m,{label:e.status,size:`small`,color:e.status===`online`?`success`:e.status===`crashed`||e.status===`errored`?`error`:`default`,sx:{height:18,fontSize:`0.6rem`}})},{id:`health`,label:`Health`,render:e=>(0,Q.jsx)(Se,{status:e.health})},{id:`pid`,label:`PID`,render:e=>(0,Q.jsx)(p,{sx:{fontFamily:`monospace`,fontSize:`0.8rem`},children:e.pid??`—`})},{id:`instances`,label:`Instances`,render:e=>e.instances},{id:`uptime`,label:`Uptime`,render:e=>(0,Q.jsx)(p,{sx:{fontFamily:`monospace`,fontSize:`0.8rem`},children:e.uptime>0?ye(e.uptime):`—`})}],Ce=[{id:`host`,label:`Host`,render:e=>(0,Q.jsxs)(p,{sx:{fontFamily:`monospace`,fontSize:`0.8rem`},children:[e.host,`:`,e.port,e.label&&(0,Q.jsxs)(w,{component:`span`,variant:`caption`,sx:{ml:1,color:`text.secondary`},children:[`(`,e.label,`)`]})]})},{id:`role`,label:`Role`,render:e=>(0,Q.jsx)(m,{label:e.role,size:`small`,sx:{height:18,fontSize:`0.6rem`}})},{id:`daemonRole`,label:`Daemon`,render:e=>(0,Q.jsx)(m,{label:e.daemonRole,size:`small`,color:e.daemonRole===`master`?`primary`:`default`,sx:{height:18,fontSize:`0.6rem`}})},{id:`connected`,label:`Status`,render:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(p,{component:`span`,sx:{display:`inline-block`,width:8,height:8,borderRadius:`50%`,bgcolor:e.connected?`success.main`:`warning.main`,mr:.5}}),e.connected?`Inventory observed`:`Inventory unavailable`]})},{id:`lastSeen`,label:`Last Seen`,render:e=>(0,Q.jsx)(p,{sx:{fontFamily:`monospace`,fontSize:`0.75rem`},children:e.lastSeen?new Date(e.lastSeen).toLocaleTimeString():`—`})}],U=I.config?.release?.mode===`required`,W=[`running`,`degraded`,`error`,`unknown`,`stopping`].includes(I.status),G=I.status===`stopped`,Te=I.status===`starting`||I.status===`stopping`||!!R,K=!!R;return(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(ve,{linkComponent:i,links:[{name:`Stacks`,href:`/stacks`},{name:I.name}],action:(0,Q.jsxs)(p,{sx:{display:`flex`,gap:1,alignItems:`center`,flexWrap:`wrap`},children:[G&&!K&&(0,Q.jsx)(M,{permission:`OmnitronProject.deleteStack`,children:(0,Q.jsx)(D,{size:`small`,color:`error`,onClick:()=>T(!0),title:`Delete stack`,"aria-label":`Delete stack ${I.name}`,sx:{marginInlineEnd:1},children:(0,Q.jsx)(he,{})})}),(0,Q.jsx)(m,{label:I.status.charAt(0).toUpperCase()+I.status.slice(1),size:`small`,sx:{bgcolor:$[I.status]??$.stopped,color:`white`,fontWeight:600}}),(0,Q.jsx)(M,{permission:`OmnitronProject.diagnoseStack`,children:(0,Q.jsx)(c,{size:`small`,onClick:()=>k(!0),children:`Diagnose`})}),(0,Q.jsx)(D,{size:`small`,"aria-label":`Refresh stack`,title:`Refresh stack`,onClick:()=>n&&d(n),children:(0,Q.jsx)(pe,{})}),Te?(0,Q.jsx)(c,{variant:`outlined`,size:`small`,disabled:!0,startIcon:(0,Q.jsx)(ae,{size:14}),children:R===`resuming`?`Resuming installed apps…`:R===`starting`||I.status===`starting`?`Starting…`:`Stopping…`}):n&&e&&ke(I)?(0,Q.jsx)(Ne,{stack:I,onResume:()=>void ee(n,e),onReviewStop:()=>E(!0)}):G?U&&!I.selectedRelease?(0,Q.jsx)(M,{permission:`OmnitronProject.startStack`,children:(0,Q.jsx)(c,{startIcon:(0,Q.jsx)(L,{}),color:`success`,variant:`contained`,size:`small`,onClick:()=>N(!0),children:`Deploy release…`})}):(0,Q.jsx)(M,{permission:`OmnitronProject.startStack`,children:(0,Q.jsx)(c,{startIcon:(0,Q.jsx)(me,{}),color:`success`,variant:`contained`,size:`small`,onClick:V,children:`Start`})}):W?(0,Q.jsx)(M,{permission:`OmnitronProject.reviewStackStop`,children:(0,Q.jsx)(c,{startIcon:(0,Q.jsx)(ge,{}),color:`error`,variant:`outlined`,size:`small`,onClick:()=>E(!0),children:I.stopOperation?.phase===`failed`&&!I.stopOperation.supersededAt?`Review retry…`:`Review stop…`})}):null]})}),oe&&n&&e&&(0,Q.jsx)(Ee,{project:n,stack:e,onClose:()=>E(!1),onConfirm:(t,r)=>{E(!1),te(n,e,t,r)}},`${n}/${e}`),O&&n&&e&&(0,Q.jsx)(Me,{project:n,stack:e,onClose:()=>k(!1)},`${n}/${e}`),(0,Q.jsx)(Ie,{operation:I.stopOperation}),(0,Q.jsx)(De,{stack:I}),(0,Q.jsx)(Pe,{stack:I}),(0,Q.jsx)(be,{stack:I}),u&&(0,Q.jsxs)(j,{severity:`warning`,children:[`Showing the last stack inventory · `,u]}),_&&_!==u&&(0,Q.jsx)(se,{sx:{mb:2},onClose:()=>y(g),children:_}),n&&e&&(0,Q.jsx)(He,{project:n,stack:e,requiresRelease:!!U,managed:!!I.config.managedOrigin,selected:I.selectedRelease?.id,onWorkingTree:I.selectedRelease&&G&&!K&&!U?()=>F(!0):void 0,onDeploy:()=>N(!0)}),I.type!==`local`&&W&&(0,Q.jsx)(v,{variant:`outlined`,sx:{mb:2,p:2},children:(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,gap:2},children:[(0,Q.jsx)(L,{sx:{fontSize:20,color:`primary.main`}}),(0,Q.jsxs)(p,{sx:{flex:1},children:[(0,Q.jsxs)(w,{variant:`body2`,sx:{fontWeight:600},children:[I.nodes.filter(e=>e.connected).length,`/`,I.nodes.length,` node inventories observed`]}),(0,Q.jsxs)(w,{variant:`caption`,sx:{color:`text.secondary`},children:[I.type===`remote`?`SSH`:`Cluster`,` deployment — `,Ge(I.nodes)]})]}),I.nodes.some(e=>!e.connected)&&(0,Q.jsx)(m,{label:`${I.nodes.filter(e=>!e.connected).length} unobserved`,size:`small`,color:`warning`,sx:{height:22,fontSize:`0.65rem`}})]})}),(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsxs)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`,mb:1,display:`block`},children:[`Applications (`,I.apps.length,`)`]}),(0,Q.jsx)(B,{scrollLabel:`Stack applications`,sx:{minWidth:640},columns:H,data:I.apps,rowKey:e=>e.handleKey,dense:!0,containerSx:{border:`none`,borderRadius:0},emptyContent:(0,Q.jsx)(w,{variant:`caption`,sx:{color:`text.disabled`},children:`No apps configured`})})]})}),(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsx)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`},children:`Overview`}),(0,Q.jsx)(Y,{label:`Type`,value:I.type===`local`?`Local`:I.type===`remote`?`Remote (SSH)`:`Cluster`}),(0,Q.jsx)(Y,{label:`Apps`,value:`${I.apps.filter(e=>e.status===`online`).length} / ${I.apps.length}`}),(0,Q.jsx)(Y,{label:`Nodes`,value:`${I.nodes.filter(e=>e.connected).length} / ${I.nodes.length}`}),I.uptime>0&&(0,Q.jsx)(Y,{label:`Uptime`,value:ye(I.uptime)}),I.portRange&&(0,Q.jsx)(Y,{label:`Port Range`,value:`${I.portRange.start}–${I.portRange.end}`,mono:!0}),I.type===`local`?I.startedAt&&(0,Q.jsx)(Y,{label:`Started`,value:new Date(I.startedAt).toLocaleString()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Y,{label:`Started`,value:I.startedAt?`${new Date(I.startedAt).toLocaleString()}, as its nodes report`:`unknown — no node reported an app of it running`}),I.attachedAt&&(0,Q.jsx)(Y,{label:`Attached`,value:`${new Date(I.attachedAt).toLocaleString()} — by this master`})]})]})}),(0,Q.jsx)(qe,{stack:I}),I.type!==`local`&&(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,gap:.5,mb:1},children:[(0,Q.jsx)(fe,{sx:{fontSize:16}}),(0,Q.jsx)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`},children:`Sync Status`})]}),I.nodes.map(e=>(0,Q.jsx)(Ke,{node:e},e.host)),I.nodes.length===0&&(0,Q.jsx)(w,{variant:`caption`,sx:{color:`text.disabled`},children:`No nodes configured`})]})}),I.nodes.length>0&&(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsxs)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`,mb:1,display:`block`},children:[`Nodes (`,I.nodes.length,`)`]}),(0,Q.jsx)(B,{scrollLabel:`Stack nodes`,sx:{minWidth:560},columns:Ce,data:I.nodes,rowKey:e=>e.host,dense:!0,containerSx:{border:`none`,borderRadius:0}})]})}),(0,Q.jsx)(M,{permission:`OmnitronProject.startStack`,children:(0,Q.jsx)(we,{open:A,onClose:()=>N(!1),project:n??``,release:null,...e?{stack:e}:{}})}),(0,Q.jsxs)(re,{open:le,onClose:()=>F(!1),children:[(0,Q.jsx)(x,{children:`Start from the working tree?`}),(0,Q.jsx)(ne,{children:(0,Q.jsxs)(ie,{children:[I.name,` will start from its registered project directory. Future restarts will use that directory until you select a release.`]})}),(0,Q.jsxs)(b,{children:[(0,Q.jsx)(c,{onClick:()=>F(!1),children:`Cancel`}),(0,Q.jsx)(M,{permission:`OmnitronProject.startStack`,children:(0,Q.jsx)(c,{variant:`contained`,disabled:!G||K||U,onClick:()=>{F(!1),n&&e&&f(n,e,{workingTree:!0})},children:`Start from working tree`})})]})]}),(0,Q.jsxs)(re,{open:C,onClose:()=>T(!1),children:[(0,Q.jsx)(x,{children:`Delete Stack`}),(0,Q.jsx)(ne,{children:(0,Q.jsxs)(ie,{children:[`Are you sure you want to delete stack `,(0,Q.jsx)(`strong`,{children:I.name}),`? This action cannot be undone. All infrastructure configuration for this stack will be removed.`]})}),(0,Q.jsxs)(b,{children:[(0,Q.jsx)(c,{onClick:()=>T(!1),children:`Cancel`}),(0,Q.jsx)(M,{permission:`OmnitronProject.deleteStack`,children:(0,Q.jsx)(c,{onClick:xe,color:`error`,variant:`contained`,children:`Delete`})})]})]})]})}function Y({label:e,value:t,mono:n}){return(0,Q.jsxs)(p,{sx:{display:`flex`,justifyContent:`space-between`,py:.5},children:[(0,Q.jsx)(w,{variant:`body2`,sx:{color:`text.secondary`},children:e}),(0,Q.jsx)(w,{variant:`body2`,sx:{fontWeight:600,...n&&{fontFamily:`monospace`,fontSize:`0.8rem`}},children:t})]})}function Ge(e){let t=e.map(e=>e.syncStatus?H(e.syncStatus):null),n=t.filter(e=>e?.state===`behind`).length,r=t.filter(e=>e?.state===`catching-up`).length,i=t.filter(e=>e?.state===`unknown`).length,a=t.filter(e=>e===null).length;return n+r+i+a===0?`replication in sync`:[n>0&&`${n} of ${e.length} behind`,r>0&&`${r} catching up`,i>0&&`${i} queue age unavailable`,a>0&&`${a} not reporting`].filter(Boolean).join(`, `)}function Ke({node:e}){let t=e.syncStatus,n=t?H(t):null;return(0,Q.jsxs)(p,{sx:{py:.75},children:[(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,Q.jsx)(p,{sx:{width:8,height:8,borderRadius:`50%`,bgcolor:e.connected?`success.main`:`warning.main`}}),(0,Q.jsxs)(p,{children:[(0,Q.jsxs)(w,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:`0.8rem`,fontWeight:600},children:[e.host,`:`,e.port]}),(0,Q.jsxs)(w,{variant:`caption`,sx:{color:`text.secondary`,fontSize:`0.6rem`},children:[e.daemonRole,e.label?` — ${e.label}`:``]})]})]}),t&&n?(0,Q.jsxs)(p,{sx:{textAlign:`right`},children:[(0,Q.jsx)(m,{label:Ce(n),size:`small`,color:W(n),variant:`outlined`,sx:{height:20,fontSize:`0.6rem`,fontWeight:600}}),t.lastSyncAt&&(0,Q.jsxs)(w,{variant:`caption`,sx:{color:`text.disabled`,display:`block`,fontSize:`0.5rem`,mt:.25},children:[`last sync `,new Date(t.lastSyncAt).toLocaleTimeString()]})]}):(0,Q.jsx)(m,{label:e.connected?`Inventory observed`:`Inventory unavailable`,size:`small`,color:e.connected?`success`:`warning`,variant:`outlined`,sx:{height:20,fontSize:`0.6rem`}})]}),t?.lastError&&(0,Q.jsx)(w,{variant:`caption`,sx:{color:`error.main`,fontSize:`0.55rem`,mt:.25,display:`block`,ml:2.5},children:t.lastError})]})}function qe({stack:e}){let t=e.config?.infrastructure,n=e.infrastructure?.services??{},r=t&&Object.keys(t).length>0,i=Object.keys(n).length>0;if(!r&&!i)return null;let a=t?.postgres,o=t?.redis,c=t?.minio;return(0,Q.jsxs)(Q.Fragment,{children:[a&&(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:1},children:[(0,Q.jsx)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`},children:`PostgreSQL`}),(0,Q.jsx)(X,{name:`postgres`,runtime:n})]}),(0,Q.jsx)(Y,{label:`Port`,value:String(a.port??5432),mono:!0}),a.databases&&Object.keys(a.databases).length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(w,{variant:`caption`,sx:{color:`text.secondary`,mt:1,display:`block`},children:[`Databases (`,Object.keys(a.databases).length,`)`]}),Object.entries(a.databases).map(([e,t])=>(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,py:.25,pl:1},children:[(0,Q.jsx)(w,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:`0.8rem`},children:e}),t?.migrate&&(0,Q.jsx)(m,{label:`migrate`,size:`small`,sx:{height:16,fontSize:`0.55rem`}})]},e))]})]})}),o&&(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:1},children:[(0,Q.jsx)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`},children:`Redis`}),(0,Q.jsx)(X,{name:`redis`,runtime:n})]}),(0,Q.jsx)(Y,{label:`Port`,value:String(o.port??6379),mono:!0}),o.databases&&Object.keys(o.databases).length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(w,{variant:`caption`,sx:{color:`text.secondary`,mt:1,display:`block`},children:[`DB Allocations (`,Object.keys(o.databases).length,`)`]}),Object.entries(o.databases).map(([e,t])=>{let n=e.includes(`:`);return(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,py:.25,pl:1},children:[(0,Q.jsx)(w,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:`0.8rem`},children:n?e.split(`:`)[1]:e}),(0,Q.jsxs)(p,{sx:{display:`flex`,gap:.5,alignItems:`center`},children:[n&&(0,Q.jsx)(m,{label:e.split(`:`)[0],size:`small`,variant:`outlined`,sx:{height:16,fontSize:`0.5rem`}}),(0,Q.jsxs)(w,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:`0.75rem`,color:`text.secondary`,minWidth:28,textAlign:`right`},children:[`DB `,t]})]})]},e)})]})]})}),c&&(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:1},children:[(0,Q.jsx)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`},children:`MinIO / S3`}),(0,Q.jsx)(X,{name:`minio`,runtime:n})]}),c.ports&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Y,{label:`API Port`,value:String(c.ports.api??9e3),mono:!0}),(0,Q.jsx)(Y,{label:`Console Port`,value:String(c.ports.console??9001),mono:!0})]}),c.buckets&&c.buckets.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(w,{variant:`caption`,sx:{color:`text.secondary`,mt:1,display:`block`},children:[`Buckets (`,c.buckets.length,`)`]}),c.buckets.map(e=>(0,Q.jsx)(w,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:`0.8rem`,pl:1,py:.25},children:e},e))]})]})})]})}function X({name:e,runtime:t}){let n=t[e];return n?(0,Q.jsxs)(O,{spacing:.5,sx:{alignItems:`flex-end`,minWidth:0,maxWidth:320},children:[(0,Q.jsx)(m,{label:n.provisioning===`pending`?`Setup pending`:n.status,size:`small`,color:n.status===`error`?`error`:n.provisioning===`pending`?`warning`:n.status===`running`?`success`:`default`}),n.error&&(0,Q.jsx)(w,{variant:`caption`,color:`error.main`,sx:{overflowWrap:`anywhere`},children:n.error})]}):(0,Q.jsx)(m,{label:`Stopped`,size:`small`,sx:{height:18,fontSize:`0.6rem`}})}var Z,Q,$;function Je(){return(Je=e((()=>{xe(),Fe(),je(),Oe(),Le(),Ae(),N(),Z=t(),o(),l(),k(),d(),ee(),C(),f(),u(),h(),E(),_(),te(),g(),S(),y(),A(),V(),Ve(),z(),I(),F(),G(),R(),Ue(),le(),U(),Q=n(),$={running:`#22c55e`,starting:`#eab308`,stopping:`#eab308`,degraded:`#f97316`,error:`#ef4444`,stopped:`#6b7280`}})))()}Je();export{We as default};
1
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{H as r,P as i,V as a,z as o}from"./client-DFnuv2z3.js";import{D as s,F as c,H as l,I as u,M as d,O as ee,Q as f,V as p,Z as m,c as te,ct as h,d as ne,f as g,g as _,h as re,j as v,l as ie,m as y,p as b,s as x,st as ae,u as S}from"./mui-BXSXx9c9.js";import{B as C,z as w}from"./mui-Cd711nOk.js";import{E as T,T as oe,it as E,rt as D}from"./mui-AnEgAVjz.js";import{_ as O,v as k}from"./mui-BwsIrivo.js";import{n as se,r as A,t as j}from"./alert-uBG6r9NW.js";import{n as M,s as N}from"./access-BvKK9dEv.js";import{r as ce,t as le}from"./use-polled-resource-B22hhr5L.js";import{i as P,n as ue,r as de,t as F}from"./project.store-DuCgv6Eq.js";import{B as fe,G as I,M as pe,k as me,m as L,p as he,z as ge}from"./icons-OboZgWSt.js";import{n as R,t as _e}from"./operation-status-Bm1x1wTz.js";import{n as z,t as B}from"./table-BOWT6Y9d.js";import{n as V,t as ve}from"./page-breadcrumbs-fR7Jmpp4.js";import{s as ye}from"./formatters-RnRy4bXm.js";import{n as be,r as xe,t as Se}from"./stack-health-status-BIv2C10x.js";import{a as H,c as Ce,r as U,s as W}from"./sync-reading-CN0jPKAg.js";import{n as G,t as we}from"./deploy-release-dialog-58lGZDNk.js";import{n as Te,t as K}from"./release-deployment-state-gN8ZT3aq.js";import{a as Ee,c as De,i as Oe,l as ke,n as Ae,o as je,r as Me,s as Ne,t as Pe,u as Fe}from"./stack-start-notice-D-AH_bzn.js";function Ie({operation:e}){if(!e||e.supersededAt)return null;let t=e.phase===`failed`,n=e.phase===`stopped`,r=e.nodes.filter(e=>e.outcome===`stopped`).length;if(n&&!e.nodes.length)return null;let i=e.nodes.map(e=>(0,q.jsxs)(p,{sx:{display:`flex`,flexWrap:`wrap`,columnGap:1.5,mt:.75},children:[(0,q.jsx)(w,{variant:`body2`,sx:{fontFamily:`monospace`,overflowWrap:`anywhere`},children:e.node}),(0,q.jsx)(w,{variant:`body2`,children:e.outcome===`unknown`?`Awaiting confirmation`:e.outcome}),e.authority&&(0,q.jsxs)(w,{variant:`caption`,sx:{overflowWrap:`anywhere`},children:[e.authority.clusterId,` · epoch `,e.authority.epoch,` · `,e.authority.nodeId]}),e.reason&&(0,q.jsx)(w,{variant:`caption`,sx:{width:`100%`,overflowWrap:`anywhere`},children:e.reason})]},e.node));return n?(0,q.jsxs)(p,{component:`details`,sx:{mb:2,minWidth:0,typography:`body2`,"& summary":{cursor:`pointer`}},children:[(0,q.jsxs)(`summary`,{children:[`Stop confirmed · `,r,`/`,e.nodes.length,` nodes`]}),i]}):(0,q.jsx)(j,{severity:t?`error`:`info`,sx:{mb:2,minWidth:0},children:(0,q.jsxs)(p,{role:`status`,"aria-live":`polite`,sx:{minWidth:0},children:[(0,q.jsxs)(w,{variant:`subtitle2`,children:[t?e.intentCommitted?`Stop not confirmed`:`Stop declined before execution`:e.phase===`preparing`?`Checking stop ownership`:`Stopping stack`,e.nodes.length>0&&` · ${r}/${e.nodes.length} nodes confirmed`]}),!t&&(0,q.jsx)(oe,{"aria-label":`Stack stop in progress`,sx:{mt:1,mb:1.5}}),e.error&&(0,q.jsx)(w,{variant:`body2`,sx:{overflowWrap:`anywhere`},children:e.error}),i]})})}var q;function Le(){return(Le=e((()=>{l(),C(),T(),A(),q=n()})))()}function Re({children:e,gap:t=Be,fill:n,sx:r,ref:i,...a}){return(0,ze.jsx)(O,{ref:i,spacing:t,sx:{...n&&{flex:1},...r},...a,children:e})}var ze,Be;function Ve(){return(Ve=e((()=>{t(),k(),ze=n(),Be=3})))()}function He({project:e,stack:t,requiresRelease:n,managed:r,selected:i,onDeploy:a,onWorkingTree:o}){return(0,J.jsxs)(p,{sx:{mb:2,minWidth:0},children:[!r&&(0,J.jsxs)(O,{direction:`row`,useFlexGap:!0,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:1},children:[i&&(0,J.jsx)(m,{label:`Selected: `+i,size:`small`,variant:`outlined`}),n&&(0,J.jsx)(m,{label:`Release required`,size:`small`,variant:`outlined`}),(0,J.jsx)(p,{sx:{flex:1}}),o&&(0,J.jsx)(M,{permission:`OmnitronProject.startStack`,children:(0,J.jsx)(c,{size:`small`,onClick:o,children:`Use working tree…`})}),(0,J.jsx)(M,{permission:`OmnitronProject.startStack`,children:(0,J.jsx)(c,{size:`small`,startIcon:(0,J.jsx)(L,{}),onClick:a,children:`Deploy release…`})})]}),(0,J.jsx)(K,{project:e,stack:t},`${e}/${t}`)]})}var J;function Ue(){return(Ue=e((()=>{l(),u(),f(),k(),N(),I(),Te(),J=n()})))()}function We(){let{name:e}=r(),t=a(),n=ue(),o=de(),l=P(e=>!!(n&&e.stacksByProject[n])),u=P(e=>n?e.stackReadErrors[n]:null),d=P(e=>e.fetchStacks),ee=P(e=>e.resumeInstalledStack),f=P(e=>e.startStack),te=P(e=>e.stopStack),h=P(e=>e.deleteStack),g=`${n}/${e}`,_=P(e=>e.stackNotices[g]),y=P(e=>e.clearStackNotice),S=P(e=>e.pendingOps),[C,T]=(0,Z.useState)(!1),[oe,E]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(!1),[A,N]=(0,Z.useState)(!1),[le,F]=(0,Z.useState)(!1),I=o.find(t=>t.name===e),R=n&&e?S[`${n}/${e}`]??null:null,z=Object.keys(S).length>0;ce(()=>void(n&&d(n)),{intervalMs:z?3e3:1e4,enabled:!!n,resourceKey:n});let V=(0,Z.useCallback)(async()=>{n&&e&&await f(n,e)},[n,e,f]),xe=(0,Z.useCallback)(async()=>{if(n&&e){try{await h(n,e),t(`/stacks`)}catch{}T(!1)}},[n,e,h,t]);if(!I&&n&&u)return(0,Q.jsxs)(j,{severity:`error`,children:[`Stack inventory unavailable · `,u,` `,(0,Q.jsx)(c,{onClick:()=>void d(n),children:`Retry`})]});if(!I&&n&&!l)return(0,Q.jsx)(_e,{active:!0,label:`Reading stack inventory`});if(!I)return(0,Q.jsx)(Re,{children:(0,Q.jsxs)(j,{severity:`warning`,children:[`Stack "`,e,`" not found.`,` `,(0,Q.jsx)(c,{size:`small`,onClick:()=>t(`/stacks`),children:`Back to Stacks`})]})});let H=[{id:`name`,label:`App`,render:e=>(0,Q.jsx)(p,{sx:{fontWeight:600},children:e.name})},{id:`status`,label:`Process`,render:e=>(0,Q.jsx)(m,{label:e.status,size:`small`,color:e.status===`online`?`success`:e.status===`crashed`||e.status===`errored`?`error`:`default`,sx:{height:18,fontSize:`0.6rem`}})},{id:`health`,label:`Health`,render:e=>(0,Q.jsx)(Se,{status:e.health})},{id:`pid`,label:`PID`,render:e=>(0,Q.jsx)(p,{sx:{fontFamily:`monospace`,fontSize:`0.8rem`},children:e.pid??`—`})},{id:`instances`,label:`Instances`,render:e=>e.instances},{id:`uptime`,label:`Uptime`,render:e=>(0,Q.jsx)(p,{sx:{fontFamily:`monospace`,fontSize:`0.8rem`},children:e.uptime>0?ye(e.uptime):`—`})}],Ce=[{id:`host`,label:`Host`,render:e=>(0,Q.jsxs)(p,{sx:{fontFamily:`monospace`,fontSize:`0.8rem`},children:[e.host,`:`,e.port,e.label&&(0,Q.jsxs)(w,{component:`span`,variant:`caption`,sx:{ml:1,color:`text.secondary`},children:[`(`,e.label,`)`]})]})},{id:`role`,label:`Role`,render:e=>(0,Q.jsx)(m,{label:e.role,size:`small`,sx:{height:18,fontSize:`0.6rem`}})},{id:`daemonRole`,label:`Daemon`,render:e=>(0,Q.jsx)(m,{label:e.daemonRole,size:`small`,color:e.daemonRole===`master`?`primary`:`default`,sx:{height:18,fontSize:`0.6rem`}})},{id:`connected`,label:`Status`,render:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(p,{component:`span`,sx:{display:`inline-block`,width:8,height:8,borderRadius:`50%`,bgcolor:e.connected?`success.main`:`warning.main`,mr:.5}}),e.connected?`Inventory observed`:`Inventory unavailable`]})},{id:`lastSeen`,label:`Last Seen`,render:e=>(0,Q.jsx)(p,{sx:{fontFamily:`monospace`,fontSize:`0.75rem`},children:e.lastSeen?new Date(e.lastSeen).toLocaleTimeString():`—`})}],U=I.config?.release?.mode===`required`,W=[`running`,`degraded`,`error`,`unknown`,`stopping`].includes(I.status),G=I.status===`stopped`,Te=I.status===`starting`||I.status===`stopping`||!!R,K=!!R;return(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(ve,{linkComponent:i,links:[{name:`Stacks`,href:`/stacks`},{name:I.name}],action:(0,Q.jsxs)(p,{sx:{display:`flex`,gap:1,alignItems:`center`,flexWrap:`wrap`},children:[G&&!K&&(0,Q.jsx)(M,{permission:`OmnitronProject.deleteStack`,children:(0,Q.jsx)(D,{size:`small`,color:`error`,onClick:()=>T(!0),title:`Delete stack`,"aria-label":`Delete stack ${I.name}`,sx:{marginInlineEnd:1},children:(0,Q.jsx)(he,{})})}),(0,Q.jsx)(m,{label:I.status.charAt(0).toUpperCase()+I.status.slice(1),size:`small`,sx:{bgcolor:$[I.status]??$.stopped,color:`white`,fontWeight:600}}),(0,Q.jsx)(M,{permission:`OmnitronProject.diagnoseStack`,children:(0,Q.jsx)(c,{size:`small`,onClick:()=>k(!0),children:`Diagnose`})}),(0,Q.jsx)(D,{size:`small`,"aria-label":`Refresh stack`,title:`Refresh stack`,onClick:()=>n&&d(n),children:(0,Q.jsx)(pe,{})}),Te?(0,Q.jsx)(c,{variant:`outlined`,size:`small`,disabled:!0,startIcon:(0,Q.jsx)(ae,{size:14}),children:R===`resuming`?`Resuming installed apps…`:R===`starting`||I.status===`starting`?`Starting…`:`Stopping…`}):n&&e&&ke(I)?(0,Q.jsx)(Ne,{stack:I,onResume:()=>void ee(n,e),onReviewStop:()=>E(!0)}):G?U&&!I.selectedRelease?(0,Q.jsx)(M,{permission:`OmnitronProject.startStack`,children:(0,Q.jsx)(c,{startIcon:(0,Q.jsx)(L,{}),color:`success`,variant:`contained`,size:`small`,onClick:()=>N(!0),children:`Deploy release…`})}):(0,Q.jsx)(M,{permission:`OmnitronProject.startStack`,children:(0,Q.jsx)(c,{startIcon:(0,Q.jsx)(me,{}),color:`success`,variant:`contained`,size:`small`,onClick:V,children:`Start`})}):W?(0,Q.jsx)(M,{permission:`OmnitronProject.reviewStackStop`,children:(0,Q.jsx)(c,{startIcon:(0,Q.jsx)(ge,{}),color:`error`,variant:`outlined`,size:`small`,onClick:()=>E(!0),children:I.stopOperation?.phase===`failed`&&!I.stopOperation.supersededAt?`Review retry…`:`Review stop…`})}):null]})}),oe&&n&&e&&(0,Q.jsx)(Ee,{project:n,stack:e,onClose:()=>E(!1),onConfirm:(t,r)=>{E(!1),te(n,e,t,r)}},`${n}/${e}`),O&&n&&e&&(0,Q.jsx)(Me,{project:n,stack:e,onClose:()=>k(!1)},`${n}/${e}`),(0,Q.jsx)(Ie,{operation:I.stopOperation}),(0,Q.jsx)(De,{stack:I}),(0,Q.jsx)(Pe,{stack:I}),(0,Q.jsx)(be,{stack:I}),u&&(0,Q.jsxs)(j,{severity:`warning`,children:[`Showing the last stack inventory · `,u]}),_&&_!==u&&(0,Q.jsx)(se,{sx:{mb:2},onClose:()=>y(g),children:_}),n&&e&&(0,Q.jsx)(He,{project:n,stack:e,requiresRelease:!!U,managed:!!I.config.managedOrigin,selected:I.selectedRelease?.id,onWorkingTree:I.selectedRelease&&G&&!K&&!U?()=>F(!0):void 0,onDeploy:()=>N(!0)}),I.type!==`local`&&W&&(0,Q.jsx)(v,{variant:`outlined`,sx:{mb:2,p:2},children:(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,gap:2},children:[(0,Q.jsx)(L,{sx:{fontSize:20,color:`primary.main`}}),(0,Q.jsxs)(p,{sx:{flex:1},children:[(0,Q.jsxs)(w,{variant:`body2`,sx:{fontWeight:600},children:[I.nodes.filter(e=>e.connected).length,`/`,I.nodes.length,` node inventories observed`]}),(0,Q.jsxs)(w,{variant:`caption`,sx:{color:`text.secondary`},children:[I.type===`remote`?`SSH`:`Cluster`,` deployment — `,Ge(I.nodes)]})]}),I.nodes.some(e=>!e.connected)&&(0,Q.jsx)(m,{label:`${I.nodes.filter(e=>!e.connected).length} unobserved`,size:`small`,color:`warning`,sx:{height:22,fontSize:`0.65rem`}})]})}),(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsxs)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`,mb:1,display:`block`},children:[`Applications (`,I.apps.length,`)`]}),(0,Q.jsx)(B,{scrollLabel:`Stack applications`,sx:{minWidth:640},columns:H,data:I.apps,rowKey:e=>e.handleKey,dense:!0,containerSx:{border:`none`,borderRadius:0},emptyContent:(0,Q.jsx)(w,{variant:`caption`,sx:{color:`text.disabled`},children:`No apps configured`})})]})}),(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsx)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`},children:`Overview`}),(0,Q.jsx)(Y,{label:`Type`,value:I.type===`local`?`Local`:I.type===`remote`?`Remote (SSH)`:`Cluster`}),(0,Q.jsx)(Y,{label:`Apps`,value:`${I.apps.filter(e=>e.status===`online`).length} / ${I.apps.length}`}),(0,Q.jsx)(Y,{label:`Nodes`,value:`${I.nodes.filter(e=>e.connected).length} / ${I.nodes.length}`}),I.uptime>0&&(0,Q.jsx)(Y,{label:`Uptime`,value:ye(I.uptime)}),I.portRange&&(0,Q.jsx)(Y,{label:`Port Range`,value:`${I.portRange.start}–${I.portRange.end}`,mono:!0}),I.type===`local`?I.startedAt&&(0,Q.jsx)(Y,{label:`Started`,value:new Date(I.startedAt).toLocaleString()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Y,{label:`Started`,value:I.startedAt?`${new Date(I.startedAt).toLocaleString()}, as its nodes report`:`unknown — no node reported an app of it running`}),I.attachedAt&&(0,Q.jsx)(Y,{label:`Attached`,value:`${new Date(I.attachedAt).toLocaleString()} — by this master`})]})]})}),(0,Q.jsx)(qe,{stack:I}),I.type!==`local`&&(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,gap:.5,mb:1},children:[(0,Q.jsx)(fe,{sx:{fontSize:16}}),(0,Q.jsx)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`},children:`Sync Status`})]}),I.nodes.map(e=>(0,Q.jsx)(Ke,{node:e},e.host)),I.nodes.length===0&&(0,Q.jsx)(w,{variant:`caption`,sx:{color:`text.disabled`},children:`No nodes configured`})]})}),I.nodes.length>0&&(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsxs)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`,mb:1,display:`block`},children:[`Nodes (`,I.nodes.length,`)`]}),(0,Q.jsx)(B,{scrollLabel:`Stack nodes`,sx:{minWidth:560},columns:Ce,data:I.nodes,rowKey:e=>e.host,dense:!0,containerSx:{border:`none`,borderRadius:0}})]})}),(0,Q.jsx)(M,{permission:`OmnitronProject.startStack`,children:(0,Q.jsx)(we,{open:A,onClose:()=>N(!1),project:n??``,release:null,...e?{stack:e}:{}})}),(0,Q.jsxs)(re,{open:le,onClose:()=>F(!1),children:[(0,Q.jsx)(x,{children:`Start from the working tree?`}),(0,Q.jsx)(ne,{children:(0,Q.jsxs)(ie,{children:[I.name,` will start from its registered project directory. Future restarts will use that directory until you select a release.`]})}),(0,Q.jsxs)(b,{children:[(0,Q.jsx)(c,{onClick:()=>F(!1),children:`Cancel`}),(0,Q.jsx)(M,{permission:`OmnitronProject.startStack`,children:(0,Q.jsx)(c,{variant:`contained`,disabled:!G||K||U,onClick:()=>{F(!1),n&&e&&f(n,e,{workingTree:!0})},children:`Start from working tree`})})]})]}),(0,Q.jsxs)(re,{open:C,onClose:()=>T(!1),children:[(0,Q.jsx)(x,{children:`Delete Stack`}),(0,Q.jsx)(ne,{children:(0,Q.jsxs)(ie,{children:[`Are you sure you want to delete stack `,(0,Q.jsx)(`strong`,{children:I.name}),`? This action cannot be undone. All infrastructure configuration for this stack will be removed.`]})}),(0,Q.jsxs)(b,{children:[(0,Q.jsx)(c,{onClick:()=>T(!1),children:`Cancel`}),(0,Q.jsx)(M,{permission:`OmnitronProject.deleteStack`,children:(0,Q.jsx)(c,{onClick:xe,color:`error`,variant:`contained`,children:`Delete`})})]})]})]})}function Y({label:e,value:t,mono:n}){return(0,Q.jsxs)(p,{sx:{display:`flex`,justifyContent:`space-between`,py:.5},children:[(0,Q.jsx)(w,{variant:`body2`,sx:{color:`text.secondary`},children:e}),(0,Q.jsx)(w,{variant:`body2`,sx:{fontWeight:600,...n&&{fontFamily:`monospace`,fontSize:`0.8rem`}},children:t})]})}function Ge(e){let t=e.map(e=>e.syncStatus?H(e.syncStatus):null),n=t.filter(e=>e?.state===`behind`).length,r=t.filter(e=>e?.state===`catching-up`).length,i=t.filter(e=>e?.state===`unknown`).length,a=t.filter(e=>e===null).length;return n+r+i+a===0?`replication in sync`:[n>0&&`${n} of ${e.length} behind`,r>0&&`${r} catching up`,i>0&&`${i} queue age unavailable`,a>0&&`${a} not reporting`].filter(Boolean).join(`, `)}function Ke({node:e}){let t=e.syncStatus,n=t?H(t):null;return(0,Q.jsxs)(p,{sx:{py:.75},children:[(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,Q.jsx)(p,{sx:{width:8,height:8,borderRadius:`50%`,bgcolor:e.connected?`success.main`:`warning.main`}}),(0,Q.jsxs)(p,{children:[(0,Q.jsxs)(w,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:`0.8rem`,fontWeight:600},children:[e.host,`:`,e.port]}),(0,Q.jsxs)(w,{variant:`caption`,sx:{color:`text.secondary`,fontSize:`0.6rem`},children:[e.daemonRole,e.label?` — ${e.label}`:``]})]})]}),t&&n?(0,Q.jsxs)(p,{sx:{textAlign:`right`},children:[(0,Q.jsx)(m,{label:Ce(n),size:`small`,color:W(n),variant:`outlined`,sx:{height:20,fontSize:`0.6rem`,fontWeight:600}}),t.lastSyncAt&&(0,Q.jsxs)(w,{variant:`caption`,sx:{color:`text.disabled`,display:`block`,fontSize:`0.5rem`,mt:.25},children:[`last sync `,new Date(t.lastSyncAt).toLocaleTimeString()]})]}):(0,Q.jsx)(m,{label:e.connected?`Inventory observed`:`Inventory unavailable`,size:`small`,color:e.connected?`success`:`warning`,variant:`outlined`,sx:{height:20,fontSize:`0.6rem`}})]}),t?.lastError&&(0,Q.jsx)(w,{variant:`caption`,sx:{color:`error.main`,fontSize:`0.55rem`,mt:.25,display:`block`,ml:2.5},children:t.lastError})]})}function qe({stack:e}){let t=e.config?.infrastructure,n=e.infrastructure?.services??{},r=t&&Object.keys(t).length>0,i=Object.keys(n).length>0;if(!r&&!i)return null;let a=t?.postgres,o=t?.redis,c=t?.minio;return(0,Q.jsxs)(Q.Fragment,{children:[a&&(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:1},children:[(0,Q.jsx)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`},children:`PostgreSQL`}),(0,Q.jsx)(X,{name:`postgres`,runtime:n})]}),(0,Q.jsx)(Y,{label:`Port`,value:String(a.port??5432),mono:!0}),a.databases&&Object.keys(a.databases).length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(w,{variant:`caption`,sx:{color:`text.secondary`,mt:1,display:`block`},children:[`Databases (`,Object.keys(a.databases).length,`)`]}),Object.entries(a.databases).map(([e,t])=>(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,py:.25,pl:1},children:[(0,Q.jsx)(w,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:`0.8rem`},children:e}),t?.migrate&&(0,Q.jsx)(m,{label:`migrate`,size:`small`,sx:{height:16,fontSize:`0.55rem`}})]},e))]})]})}),o&&(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:1},children:[(0,Q.jsx)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`},children:`Redis`}),(0,Q.jsx)(X,{name:`redis`,runtime:n})]}),(0,Q.jsx)(Y,{label:`Port`,value:String(o.port??6379),mono:!0}),o.databases&&Object.keys(o.databases).length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(w,{variant:`caption`,sx:{color:`text.secondary`,mt:1,display:`block`},children:[`DB Allocations (`,Object.keys(o.databases).length,`)`]}),Object.entries(o.databases).map(([e,t])=>{let n=e.includes(`:`);return(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,py:.25,pl:1},children:[(0,Q.jsx)(w,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:`0.8rem`},children:n?e.split(`:`)[1]:e}),(0,Q.jsxs)(p,{sx:{display:`flex`,gap:.5,alignItems:`center`},children:[n&&(0,Q.jsx)(m,{label:e.split(`:`)[0],size:`small`,variant:`outlined`,sx:{height:16,fontSize:`0.5rem`}}),(0,Q.jsxs)(w,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:`0.75rem`,color:`text.secondary`,minWidth:28,textAlign:`right`},children:[`DB `,t]})]})]},e)})]})]})}),c&&(0,Q.jsx)(v,{variant:`outlined`,children:(0,Q.jsxs)(s,{children:[(0,Q.jsxs)(p,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:1},children:[(0,Q.jsx)(w,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`},children:`MinIO / S3`}),(0,Q.jsx)(X,{name:`minio`,runtime:n})]}),c.ports&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Y,{label:`API Port`,value:String(c.ports.api??9e3),mono:!0}),(0,Q.jsx)(Y,{label:`Console Port`,value:String(c.ports.console??9001),mono:!0})]}),c.buckets&&c.buckets.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(w,{variant:`caption`,sx:{color:`text.secondary`,mt:1,display:`block`},children:[`Buckets (`,c.buckets.length,`)`]}),c.buckets.map(e=>(0,Q.jsx)(w,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:`0.8rem`,pl:1,py:.25},children:e},e))]})]})})]})}function X({name:e,runtime:t}){let n=t[e];return n?(0,Q.jsxs)(O,{spacing:.5,sx:{alignItems:`flex-end`,minWidth:0,maxWidth:320},children:[(0,Q.jsx)(m,{label:n.provisioning===`pending`?`Setup pending`:n.status,size:`small`,color:n.status===`error`?`error`:n.provisioning===`pending`?`warning`:n.status===`running`?`success`:`default`}),n.error&&(0,Q.jsx)(w,{variant:`caption`,color:`error.main`,sx:{overflowWrap:`anywhere`},children:n.error})]}):(0,Q.jsx)(m,{label:`Stopped`,size:`small`,sx:{height:18,fontSize:`0.6rem`}})}var Z,Q,$;function Je(){return(Je=e((()=>{xe(),Fe(),je(),Oe(),Le(),Ae(),N(),Z=t(),o(),l(),k(),d(),ee(),C(),f(),u(),h(),E(),_(),te(),g(),S(),y(),A(),V(),Ve(),z(),I(),F(),G(),R(),Ue(),le(),U(),Q=n(),$={running:`#22c55e`,starting:`#eab308`,stopping:`#eab308`,degraded:`#f97316`,error:`#ef4444`,stopped:`#6b7280`}})))()}Je();export{We as default};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{H as r,P as i,_ as a,c as o,h as s,v as c,z as l}from"./client-DFnuv2z3.js";import{a as u,o as d}from"./mui-agG5dued.js";import{Vt as f,Yt as p}from"./mui-BTN91yBK.js";import{_n as m,gn as h}from"./mui-CdB_p2lt.js";import{D as g,E as _,F as v,H as y,I as b,M as x,O as S,Q as C,St as w,T,V as E,Z as D,j as O,xt as ee}from"./mui-BXSXx9c9.js";import{B as te,F as ne,I as re,M as ie,a as ae,c as oe,j as k,o as se,s as ce,z as A}from"./mui-Cd711nOk.js";import{A as le,E as ue,T as de,it as fe,k as pe,rt as me}from"./mui-AnEgAVjz.js";import{_ as j,v as he}from"./mui-BwsIrivo.js";import{r as M,t as N}from"./alert-uBG6r9NW.js";import{n as ge,t as P}from"./chart-BpGXlCJc.js";import{n as F,s as _e}from"./access-48hkC2-P.js";import{n as ve,r as I,t as L}from"./use-polled-resource-B22hhr5L.js";import{a as ye,c as be,l as xe,n as Se,s as Ce,t as we}from"./app-address-BCXfN59F.js";import{F as Te,G as Ee,M as R,P as De,c as Oe,k as z,z as B}from"./icons-OboZgWSt.js";import{n as V,r as ke,t as Ae}from"./constants-CyhngVXh.js";import{n as je,t as Me}from"./table-BOWT6Y9d.js";import{n as Ne,t as Pe}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as Fe,t as H}from"./skeleton-BmWDJWF9.js";import{i as U,s as Ie}from"./formatters-RnRy4bXm.js";import{c as Le,n as Re,s as ze,t as Be}from"./log-level-filter-Bcn31D1F.js";import{n as Ve,t as He}from"./use-stack-context-UkBsF-l7.js";function Ue({appName:e,refreshToken:t,onLogs:n}){let{data:r,error:i,loading:a,refresh:s}=ve(async()=>{let t=await o.getHealth({name:e}),n=t.apps[e];if(!n)throw Error(`The daemon returned no health answer for this application.`);return{...n,timestamp:t.timestamp}},{intervalMs:5e3,resourceKey:e});(0,We.useEffect)(()=>{t>0&&s()},[t,s]);let c=r!==null&&(!Number.isFinite(r.timestamp)||Date.now()-r.timestamp>=3e4||r.timestamp>Date.now()+5e3),l=r!==null&&!i&&!c,u=l?r.status:`unverified`,d=u===`healthy`?`success`:u===`unhealthy`?`error`:`warning`,f=r?[...r.checks].sort((e,t)=>({fail:0,warn:1,pass:2})[e.status]-{fail:0,warn:1,pass:2}[t.status]):[];return(0,W.jsx)(O,{variant:`outlined`,component:`section`,"aria-label":`Application readiness`,sx:{minWidth:0},children:(0,W.jsxs)(g,{sx:{p:2,"&:last-child":{pb:2}},children:[(0,W.jsxs)(j,{direction:`row`,useFlexGap:!0,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:1.5},children:[(0,W.jsx)(A,{variant:`subtitle2`,children:`Readiness`}),(0,W.jsx)(D,{size:`small`,variant:`outlined`,color:d,label:a&&!r?`Checking`:u}),r&&Number.isFinite(r.timestamp)&&(0,W.jsxs)(A,{variant:`caption`,color:`text.secondary`,children:[l?`Checked`:`Last observation`,` `,new Date(r.timestamp).toLocaleTimeString()]}),(0,W.jsx)(v,{size:`small`,onClick:n,sx:{ml:`auto`},children:`View logs`})]}),(i||c)&&(0,W.jsxs)(N,{severity:`warning`,variant:`outlined`,sx:{mb:1.5},children:[i??`Health observation is stale. Waiting for a fresh answer.`,r?` The checks below are the last observation, not a current health verdict.`:``]}),!r&&!i&&(0,W.jsx)(A,{variant:`body2`,color:`text.secondary`,children:`Waiting for the application health probe.`}),r&&f.length===0&&(0,W.jsxs)(A,{variant:`body2`,color:`text.secondary`,children:[`The application reported `,r.status,` without individual checks. Add named readiness checks to its bootstrap.`]}),(0,W.jsx)(j,{spacing:1.5,children:f.map((t,n)=>(0,W.jsxs)(E,{sx:{display:`grid`,gridTemplateColumns:`auto minmax(0, 1fr)`,gap:1,alignItems:`start`},children:[(0,W.jsx)(D,{size:`small`,variant:`outlined`,label:t.status,color:t.status===`pass`?`success`:t.status===`fail`?`error`:`warning`}),(0,W.jsxs)(E,{sx:{minWidth:0,overflowWrap:`anywhere`},children:[(0,W.jsx)(A,{variant:`body2`,sx:{fontWeight:600},children:t.name.startsWith(`${e}/`)?t.name.slice(e.length+1):t.name}),(0,W.jsx)(A,{variant:`body2`,color:`text.secondary`,children:t.message??`No diagnostic message was supplied by the application.`})]})]},`${t.name}-${n}`))})]})})}var We,W;function Ge(){return(Ge=e((()=>{We=t(),y(),x(),S(),he(),C(),b(),te(),M(),s(),L(),W=n()})))()}function G({children:e,value:t,index:n}){let[r,i]=(0,Y.useState)(t===n);return(0,Y.useEffect)(()=>{t===n&&i(!0)},[t,n]),r?(0,X.jsx)(E,{sx:{pt:2,display:t===n?`block`:`none`},children:e}):null}function K({label:e,value:t,sub:n,color:r}){return(0,X.jsx)(O,{variant:`outlined`,sx:{flex:1,minWidth:140,bgcolor:r?f(r,.04):void 0,borderColor:r?f(r,.2):void 0},children:(0,X.jsxs)(g,{sx:{py:1.5,px:2,"&:last-child":{pb:1.5}},children:[(0,X.jsx)(A,{variant:`caption`,sx:{color:`text.secondary`,textTransform:`uppercase`,letterSpacing:.5,fontSize:10},children:e}),(0,X.jsx)(A,{variant:`h5`,sx:{fontWeight:700,color:r??`text.primary`,mt:.25},children:t}),n&&(0,X.jsx)(A,{variant:`caption`,sx:{color:`text.disabled`,fontSize:11},children:n})]})})}function Ke({app:e,diagnostics:t,diagLoading:n}){let r=m(),i=t&&t.memory.heapTotal>0?Math.round(t.memory.heapUsed/t.memory.heapTotal*100):0,a=t!=null&&t.memory.heapTotal>0,o=be(e,t),s=o?` of ${o.name}`:``;return(0,X.jsxs)(j,{spacing:3,children:[(0,X.jsxs)(j,{direction:`row`,spacing:2,sx:{flexWrap:`wrap`},children:[(0,X.jsx)(K,{label:`CPU`,value:e.cpu>0?`${e.cpu.toFixed(1)}%`:`—`,color:e.cpu>80?r.palette.error.main:void 0}),(0,X.jsx)(K,{label:`Memory`,value:U(e.memory),sub:t?a?`Heap${s}: ${U(t.memory.heapUsed)} / ${U(t.memory.heapTotal)}`:`RSS${s}: ${U(t.memory.rss)}`:void 0}),(0,X.jsx)(K,{label:`Uptime`,value:Ie(e.uptime)}),(0,X.jsx)(K,{label:`Restarts`,value:e.restarts,color:e.restarts>0?r.palette.warning.main:void 0}),(0,X.jsx)(K,{label:`Instances`,value:e.instances})]}),t&&(0,X.jsx)(O,{variant:`outlined`,children:(0,X.jsx)(g,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(j,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`,mb:.5},children:[(0,X.jsxs)(A,{variant:`caption`,sx:{color:`text.secondary`},children:[`Heap Usage`,s]}),(0,X.jsxs)(A,{variant:`caption`,sx:{fontWeight:600},children:[i,`%`]})]}),(0,X.jsx)(de,{variant:`determinate`,value:i,sx:{height:6,borderRadius:3,bgcolor:f(r.palette.primary.main,.08),"& .MuiLinearProgress-bar":{borderRadius:3,bgcolor:i>85?r.palette.error.main:r.palette.primary.main}}}),(0,X.jsxs)(j,{direction:`row`,sx:{justifyContent:`space-between`,mt:.5},children:[(0,X.jsxs)(A,{variant:`caption`,sx:{color:`text.disabled`},children:[`RSS`,s,`: `,U(t.memory.rss)]}),(0,X.jsxs)(A,{variant:`caption`,sx:{color:`text.disabled`},children:[`External: `,U(t.memory.external)]})]})]}):(0,X.jsxs)(j,{spacing:.5,children:[(0,X.jsxs)(A,{variant:`caption`,sx:{color:`text.secondary`},children:[`Memory (RSS)`,s]}),(0,X.jsx)(A,{variant:`h6`,sx:{fontWeight:600},children:U(t.memory.rss)})]})})}),e.processes&&e.processes.length>0&&(0,X.jsx)(O,{variant:`outlined`,children:(0,X.jsxs)(g,{sx:{p:0,"&:last-child":{pb:0}},children:[(0,X.jsx)(A,{variant:`subtitle2`,sx:{fontWeight:600,px:2,pt:1.5,pb:1},children:`Process Topology`}),(0,X.jsx)(Me,{columns:[{id:`name`,label:`Process`,render:e=>(0,X.jsxs)(j,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,X.jsx)(Oe,{sx:{fontSize:8,color:e.status===`online`?r.palette.success.main:e.status===`stopped`?r.palette.text.disabled:r.palette.error.main}}),(0,X.jsx)(A,{variant:`body2`,sx:{fontWeight:600},children:e.name})]})},{id:`type`,label:`Type`,render:e=>(0,X.jsx)(D,{label:e.type,size:`small`,variant:`outlined`,sx:{fontSize:11,height:22}})},{id:`status`,label:`Status`,render:e=>(0,X.jsx)(D,{label:e.status,size:`small`,color:V[e.status]||`default`,variant:`outlined`,sx:{fontSize:11,height:22}})},{id:`pid`,label:`PID`,align:`right`,render:e=>(0,X.jsx)(A,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:12},children:e.pid??`—`})},{id:`uptime`,label:`Uptime`,render:e=>(0,X.jsx)(A,{variant:`body2`,sx:{fontSize:12},children:Ie(e.uptime)})},{id:`cpu`,label:`CPU`,align:`right`,render:e=>(0,X.jsx)(A,{variant:`body2`,sx:{fontSize:12},children:e.cpu>0?`${e.cpu.toFixed(1)}%`:`—`})},{id:`memory`,label:`Memory`,align:`right`,render:e=>(0,X.jsx)(A,{variant:`body2`,sx:{fontSize:12},children:U(e.memory)})},{id:`restarts`,label:`Restarts`,align:`right`,render:e=>(0,X.jsx)(A,{variant:`body2`,sx:{fontSize:12,color:e.restarts!==null&&e.restarts>0?r.palette.warning.main:void 0},children:e.restarts??`—`})}],data:e.processes,rowKey:e=>e.name,dense:!0,containerSx:{border:`none`,borderRadius:0}})]})}),t&&t.services.length>0&&(()=>{let e=[...new Set(t.services)];return(0,X.jsx)(O,{variant:`outlined`,children:(0,X.jsxs)(g,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:[(0,X.jsx)(A,{variant:`subtitle2`,sx:{fontWeight:600,mb:1},children:`Exposed Services`}),(0,X.jsx)(j,{direction:`row`,spacing:.75,useFlexGap:!0,sx:{flexWrap:`wrap`},children:e.map(e=>(0,X.jsx)(D,{label:e,size:`small`,variant:`outlined`,sx:{fontSize:11,height:24}},e))})]})})})(),(0,X.jsx)(O,{variant:`outlined`,children:(0,X.jsxs)(g,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:[(0,X.jsx)(A,{variant:`subtitle2`,sx:{fontWeight:600,mb:1},children:`Details`}),(0,X.jsxs)(j,{spacing:.75,children:[(0,X.jsx)(q,{label:`Mode`,value:e.mode}),(0,X.jsx)(q,{label:`PID`,value:e.pid??`—`,mono:!0}),(0,X.jsx)(q,{label:`Port`,value:e.port??`—`,mono:!0}),(0,X.jsx)(q,{label:`Critical`,value:e.critical?`Yes`:`No`})]})]})})]})}function q({label:e,value:t,mono:n}){return(0,X.jsxs)(j,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`},children:[(0,X.jsx)(A,{variant:`body2`,sx:{color:`text.secondary`,fontSize:13},children:e}),(0,X.jsx)(A,{variant:`body2`,sx:{fontSize:13,...n&&{fontFamily:`monospace`}},children:t})]})}function qe(e){let t=typeof e==`string`?new Date(e):e;return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function Je(e){let t=typeof e==`string`?new Date(e):e;return`${t.toLocaleString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function Ye({log:e,isNew:t}){let[n,r]=(0,Y.useState)(!1),i=Object.hasOwn(Ae,e.level)?Ae[e.level]:`#6b7280`,a=Object.hasOwn(Z,e.level)?Z[e.level]:`transparent`,o=e.labels||e.traceId||e.spanId||e.metadata;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(E,{onClick:()=>o&&r(e=>!e),sx:{display:`grid`,gridTemplateColumns:`90px 36px 1fr`,gap:1,alignItems:`baseline`,px:1.5,py:`3px`,bgcolor:n?`rgba(255,255,255,0.04)`:a,borderLeft:`2px solid ${n?i:`transparent`}`,cursor:o?`pointer`:`default`,transition:`background-color 0.15s ease`,animation:t?`${tt} 0.3s ease-out`:void 0,"&:hover":{bgcolor:`rgba(255,255,255,0.04)`}},children:[(0,X.jsx)(ne,{title:Je(e.timestamp),placement:`top-start`,arrow:!0,enterDelay:400,children:(0,X.jsx)(A,{component:`span`,sx:{fontFamily:Q,fontSize:11,color:`#7c8493`,lineHeight:`20px`,whiteSpace:`nowrap`,letterSpacing:`-0.02em`},children:qe(e.timestamp)})}),(0,X.jsx)(A,{component:`span`,sx:{fontFamily:Q,fontSize:10,fontWeight:700,color:i,lineHeight:`20px`,textTransform:`uppercase`,letterSpacing:`0.04em`},children:Le(e.level)}),(0,X.jsx)(A,{component:`span`,sx:{fontFamily:Q,fontSize:11.5,lineHeight:`20px`,overflow:`hidden`,color:e.level===`error`||e.level===`fatal`?`#fca5a5`:`#c9d1d9`,textOverflow:`ellipsis`,whiteSpace:n?`pre-wrap`:`nowrap`,wordBreak:n?`break-all`:void 0},children:e.message})]}),(0,X.jsx)(ee,{in:n,unmountOnExit:!0,children:(0,X.jsx)(E,{sx:{ml:`14px`,mr:1.5,mb:.5,p:1.5,bgcolor:`rgba(255,255,255,0.025)`,borderRadius:1,borderLeft:`2px solid ${f(i,.3)}`},children:(0,X.jsxs)(E,{component:`pre`,sx:{fontFamily:Q,fontSize:11,color:`#8b949e`,m:0,whiteSpace:`pre-wrap`,wordBreak:`break-all`,lineHeight:1.7},children:[e.traceId&&(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{style:{color:`#7c8493`},children:`traceId: `}),(0,X.jsx)(`span`,{style:{color:`#d2a8ff`},children:e.traceId}),`
1
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{H as r,P as i,_ as a,c as o,h as s,v as c,z as l}from"./client-DFnuv2z3.js";import{a as u,o as d}from"./mui-agG5dued.js";import{Vt as f,Yt as p}from"./mui-BTN91yBK.js";import{_n as m,gn as h}from"./mui-CdB_p2lt.js";import{D as g,E as _,F as v,H as y,I as b,M as x,O as S,Q as C,St as w,T,V as E,Z as D,j as O,xt as ee}from"./mui-BXSXx9c9.js";import{B as te,F as ne,I as re,M as ie,a as ae,c as oe,j as k,o as se,s as ce,z as A}from"./mui-Cd711nOk.js";import{A as le,E as ue,T as de,it as fe,k as pe,rt as me}from"./mui-AnEgAVjz.js";import{_ as j,v as he}from"./mui-BwsIrivo.js";import{r as M,t as N}from"./alert-uBG6r9NW.js";import{n as ge,t as P}from"./chart-BpGXlCJc.js";import{n as F,s as _e}from"./access-BvKK9dEv.js";import{n as ve,r as I,t as L}from"./use-polled-resource-B22hhr5L.js";import{a as ye,c as be,l as xe,n as Se,s as Ce,t as we}from"./app-address-BCXfN59F.js";import{F as Te,G as Ee,M as R,P as De,c as Oe,k as z,z as B}from"./icons-OboZgWSt.js";import{n as V,r as ke,t as Ae}from"./constants-CyhngVXh.js";import{n as je,t as Me}from"./table-BOWT6Y9d.js";import{n as Ne,t as Pe}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as Fe,t as H}from"./skeleton-BmWDJWF9.js";import{i as U,s as Ie}from"./formatters-RnRy4bXm.js";import{c as Le,n as Re,s as ze,t as Be}from"./log-level-filter-Bcn31D1F.js";import{n as Ve,t as He}from"./use-stack-context-8yaHaN8L.js";function Ue({appName:e,refreshToken:t,onLogs:n}){let{data:r,error:i,loading:a,refresh:s}=ve(async()=>{let t=await o.getHealth({name:e}),n=t.apps[e];if(!n)throw Error(`The daemon returned no health answer for this application.`);return{...n,timestamp:t.timestamp}},{intervalMs:5e3,resourceKey:e});(0,We.useEffect)(()=>{t>0&&s()},[t,s]);let c=r!==null&&(!Number.isFinite(r.timestamp)||Date.now()-r.timestamp>=3e4||r.timestamp>Date.now()+5e3),l=r!==null&&!i&&!c,u=l?r.status:`unverified`,d=u===`healthy`?`success`:u===`unhealthy`?`error`:`warning`,f=r?[...r.checks].sort((e,t)=>({fail:0,warn:1,pass:2})[e.status]-{fail:0,warn:1,pass:2}[t.status]):[];return(0,W.jsx)(O,{variant:`outlined`,component:`section`,"aria-label":`Application readiness`,sx:{minWidth:0},children:(0,W.jsxs)(g,{sx:{p:2,"&:last-child":{pb:2}},children:[(0,W.jsxs)(j,{direction:`row`,useFlexGap:!0,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:1.5},children:[(0,W.jsx)(A,{variant:`subtitle2`,children:`Readiness`}),(0,W.jsx)(D,{size:`small`,variant:`outlined`,color:d,label:a&&!r?`Checking`:u}),r&&Number.isFinite(r.timestamp)&&(0,W.jsxs)(A,{variant:`caption`,color:`text.secondary`,children:[l?`Checked`:`Last observation`,` `,new Date(r.timestamp).toLocaleTimeString()]}),(0,W.jsx)(v,{size:`small`,onClick:n,sx:{ml:`auto`},children:`View logs`})]}),(i||c)&&(0,W.jsxs)(N,{severity:`warning`,variant:`outlined`,sx:{mb:1.5},children:[i??`Health observation is stale. Waiting for a fresh answer.`,r?` The checks below are the last observation, not a current health verdict.`:``]}),!r&&!i&&(0,W.jsx)(A,{variant:`body2`,color:`text.secondary`,children:`Waiting for the application health probe.`}),r&&f.length===0&&(0,W.jsxs)(A,{variant:`body2`,color:`text.secondary`,children:[`The application reported `,r.status,` without individual checks. Add named readiness checks to its bootstrap.`]}),(0,W.jsx)(j,{spacing:1.5,children:f.map((t,n)=>(0,W.jsxs)(E,{sx:{display:`grid`,gridTemplateColumns:`auto minmax(0, 1fr)`,gap:1,alignItems:`start`},children:[(0,W.jsx)(D,{size:`small`,variant:`outlined`,label:t.status,color:t.status===`pass`?`success`:t.status===`fail`?`error`:`warning`}),(0,W.jsxs)(E,{sx:{minWidth:0,overflowWrap:`anywhere`},children:[(0,W.jsx)(A,{variant:`body2`,sx:{fontWeight:600},children:t.name.startsWith(`${e}/`)?t.name.slice(e.length+1):t.name}),(0,W.jsx)(A,{variant:`body2`,color:`text.secondary`,children:t.message??`No diagnostic message was supplied by the application.`})]})]},`${t.name}-${n}`))})]})})}var We,W;function Ge(){return(Ge=e((()=>{We=t(),y(),x(),S(),he(),C(),b(),te(),M(),s(),L(),W=n()})))()}function G({children:e,value:t,index:n}){let[r,i]=(0,Y.useState)(t===n);return(0,Y.useEffect)(()=>{t===n&&i(!0)},[t,n]),r?(0,X.jsx)(E,{sx:{pt:2,display:t===n?`block`:`none`},children:e}):null}function K({label:e,value:t,sub:n,color:r}){return(0,X.jsx)(O,{variant:`outlined`,sx:{flex:1,minWidth:140,bgcolor:r?f(r,.04):void 0,borderColor:r?f(r,.2):void 0},children:(0,X.jsxs)(g,{sx:{py:1.5,px:2,"&:last-child":{pb:1.5}},children:[(0,X.jsx)(A,{variant:`caption`,sx:{color:`text.secondary`,textTransform:`uppercase`,letterSpacing:.5,fontSize:10},children:e}),(0,X.jsx)(A,{variant:`h5`,sx:{fontWeight:700,color:r??`text.primary`,mt:.25},children:t}),n&&(0,X.jsx)(A,{variant:`caption`,sx:{color:`text.disabled`,fontSize:11},children:n})]})})}function Ke({app:e,diagnostics:t,diagLoading:n}){let r=m(),i=t&&t.memory.heapTotal>0?Math.round(t.memory.heapUsed/t.memory.heapTotal*100):0,a=t!=null&&t.memory.heapTotal>0,o=be(e,t),s=o?` of ${o.name}`:``;return(0,X.jsxs)(j,{spacing:3,children:[(0,X.jsxs)(j,{direction:`row`,spacing:2,sx:{flexWrap:`wrap`},children:[(0,X.jsx)(K,{label:`CPU`,value:e.cpu>0?`${e.cpu.toFixed(1)}%`:`—`,color:e.cpu>80?r.palette.error.main:void 0}),(0,X.jsx)(K,{label:`Memory`,value:U(e.memory),sub:t?a?`Heap${s}: ${U(t.memory.heapUsed)} / ${U(t.memory.heapTotal)}`:`RSS${s}: ${U(t.memory.rss)}`:void 0}),(0,X.jsx)(K,{label:`Uptime`,value:Ie(e.uptime)}),(0,X.jsx)(K,{label:`Restarts`,value:e.restarts,color:e.restarts>0?r.palette.warning.main:void 0}),(0,X.jsx)(K,{label:`Instances`,value:e.instances})]}),t&&(0,X.jsx)(O,{variant:`outlined`,children:(0,X.jsx)(g,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(j,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`,mb:.5},children:[(0,X.jsxs)(A,{variant:`caption`,sx:{color:`text.secondary`},children:[`Heap Usage`,s]}),(0,X.jsxs)(A,{variant:`caption`,sx:{fontWeight:600},children:[i,`%`]})]}),(0,X.jsx)(de,{variant:`determinate`,value:i,sx:{height:6,borderRadius:3,bgcolor:f(r.palette.primary.main,.08),"& .MuiLinearProgress-bar":{borderRadius:3,bgcolor:i>85?r.palette.error.main:r.palette.primary.main}}}),(0,X.jsxs)(j,{direction:`row`,sx:{justifyContent:`space-between`,mt:.5},children:[(0,X.jsxs)(A,{variant:`caption`,sx:{color:`text.disabled`},children:[`RSS`,s,`: `,U(t.memory.rss)]}),(0,X.jsxs)(A,{variant:`caption`,sx:{color:`text.disabled`},children:[`External: `,U(t.memory.external)]})]})]}):(0,X.jsxs)(j,{spacing:.5,children:[(0,X.jsxs)(A,{variant:`caption`,sx:{color:`text.secondary`},children:[`Memory (RSS)`,s]}),(0,X.jsx)(A,{variant:`h6`,sx:{fontWeight:600},children:U(t.memory.rss)})]})})}),e.processes&&e.processes.length>0&&(0,X.jsx)(O,{variant:`outlined`,children:(0,X.jsxs)(g,{sx:{p:0,"&:last-child":{pb:0}},children:[(0,X.jsx)(A,{variant:`subtitle2`,sx:{fontWeight:600,px:2,pt:1.5,pb:1},children:`Process Topology`}),(0,X.jsx)(Me,{columns:[{id:`name`,label:`Process`,render:e=>(0,X.jsxs)(j,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,X.jsx)(Oe,{sx:{fontSize:8,color:e.status===`online`?r.palette.success.main:e.status===`stopped`?r.palette.text.disabled:r.palette.error.main}}),(0,X.jsx)(A,{variant:`body2`,sx:{fontWeight:600},children:e.name})]})},{id:`type`,label:`Type`,render:e=>(0,X.jsx)(D,{label:e.type,size:`small`,variant:`outlined`,sx:{fontSize:11,height:22}})},{id:`status`,label:`Status`,render:e=>(0,X.jsx)(D,{label:e.status,size:`small`,color:V[e.status]||`default`,variant:`outlined`,sx:{fontSize:11,height:22}})},{id:`pid`,label:`PID`,align:`right`,render:e=>(0,X.jsx)(A,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:12},children:e.pid??`—`})},{id:`uptime`,label:`Uptime`,render:e=>(0,X.jsx)(A,{variant:`body2`,sx:{fontSize:12},children:Ie(e.uptime)})},{id:`cpu`,label:`CPU`,align:`right`,render:e=>(0,X.jsx)(A,{variant:`body2`,sx:{fontSize:12},children:e.cpu>0?`${e.cpu.toFixed(1)}%`:`—`})},{id:`memory`,label:`Memory`,align:`right`,render:e=>(0,X.jsx)(A,{variant:`body2`,sx:{fontSize:12},children:U(e.memory)})},{id:`restarts`,label:`Restarts`,align:`right`,render:e=>(0,X.jsx)(A,{variant:`body2`,sx:{fontSize:12,color:e.restarts!==null&&e.restarts>0?r.palette.warning.main:void 0},children:e.restarts??`—`})}],data:e.processes,rowKey:e=>e.name,dense:!0,containerSx:{border:`none`,borderRadius:0}})]})}),t&&t.services.length>0&&(()=>{let e=[...new Set(t.services)];return(0,X.jsx)(O,{variant:`outlined`,children:(0,X.jsxs)(g,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:[(0,X.jsx)(A,{variant:`subtitle2`,sx:{fontWeight:600,mb:1},children:`Exposed Services`}),(0,X.jsx)(j,{direction:`row`,spacing:.75,useFlexGap:!0,sx:{flexWrap:`wrap`},children:e.map(e=>(0,X.jsx)(D,{label:e,size:`small`,variant:`outlined`,sx:{fontSize:11,height:24}},e))})]})})})(),(0,X.jsx)(O,{variant:`outlined`,children:(0,X.jsxs)(g,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:[(0,X.jsx)(A,{variant:`subtitle2`,sx:{fontWeight:600,mb:1},children:`Details`}),(0,X.jsxs)(j,{spacing:.75,children:[(0,X.jsx)(q,{label:`Mode`,value:e.mode}),(0,X.jsx)(q,{label:`PID`,value:e.pid??`—`,mono:!0}),(0,X.jsx)(q,{label:`Port`,value:e.port??`—`,mono:!0}),(0,X.jsx)(q,{label:`Critical`,value:e.critical?`Yes`:`No`})]})]})})]})}function q({label:e,value:t,mono:n}){return(0,X.jsxs)(j,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`},children:[(0,X.jsx)(A,{variant:`body2`,sx:{color:`text.secondary`,fontSize:13},children:e}),(0,X.jsx)(A,{variant:`body2`,sx:{fontSize:13,...n&&{fontFamily:`monospace`}},children:t})]})}function qe(e){let t=typeof e==`string`?new Date(e):e;return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function Je(e){let t=typeof e==`string`?new Date(e):e;return`${t.toLocaleString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function Ye({log:e,isNew:t}){let[n,r]=(0,Y.useState)(!1),i=Object.hasOwn(Ae,e.level)?Ae[e.level]:`#6b7280`,a=Object.hasOwn(Z,e.level)?Z[e.level]:`transparent`,o=e.labels||e.traceId||e.spanId||e.metadata;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(E,{onClick:()=>o&&r(e=>!e),sx:{display:`grid`,gridTemplateColumns:`90px 36px 1fr`,gap:1,alignItems:`baseline`,px:1.5,py:`3px`,bgcolor:n?`rgba(255,255,255,0.04)`:a,borderLeft:`2px solid ${n?i:`transparent`}`,cursor:o?`pointer`:`default`,transition:`background-color 0.15s ease`,animation:t?`${tt} 0.3s ease-out`:void 0,"&:hover":{bgcolor:`rgba(255,255,255,0.04)`}},children:[(0,X.jsx)(ne,{title:Je(e.timestamp),placement:`top-start`,arrow:!0,enterDelay:400,children:(0,X.jsx)(A,{component:`span`,sx:{fontFamily:Q,fontSize:11,color:`#7c8493`,lineHeight:`20px`,whiteSpace:`nowrap`,letterSpacing:`-0.02em`},children:qe(e.timestamp)})}),(0,X.jsx)(A,{component:`span`,sx:{fontFamily:Q,fontSize:10,fontWeight:700,color:i,lineHeight:`20px`,textTransform:`uppercase`,letterSpacing:`0.04em`},children:Le(e.level)}),(0,X.jsx)(A,{component:`span`,sx:{fontFamily:Q,fontSize:11.5,lineHeight:`20px`,overflow:`hidden`,color:e.level===`error`||e.level===`fatal`?`#fca5a5`:`#c9d1d9`,textOverflow:`ellipsis`,whiteSpace:n?`pre-wrap`:`nowrap`,wordBreak:n?`break-all`:void 0},children:e.message})]}),(0,X.jsx)(ee,{in:n,unmountOnExit:!0,children:(0,X.jsx)(E,{sx:{ml:`14px`,mr:1.5,mb:.5,p:1.5,bgcolor:`rgba(255,255,255,0.025)`,borderRadius:1,borderLeft:`2px solid ${f(i,.3)}`},children:(0,X.jsxs)(E,{component:`pre`,sx:{fontFamily:Q,fontSize:11,color:`#8b949e`,m:0,whiteSpace:`pre-wrap`,wordBreak:`break-all`,lineHeight:1.7},children:[e.traceId&&(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{style:{color:`#7c8493`},children:`traceId: `}),(0,X.jsx)(`span`,{style:{color:`#d2a8ff`},children:e.traceId}),`
2
2
  `]}),e.spanId&&(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{style:{color:`#7c8493`},children:`spanId: `}),(0,X.jsx)(`span`,{style:{color:`#d2a8ff`},children:e.spanId}),`
3
3
  `]}),e.labels&&(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{style:{color:`#7c8493`},children:`labels: `}),(0,X.jsx)(`span`,{style:{color:`#7ee787`},children:JSON.stringify(e.labels,null,2)}),`
4
4
  `]}),e.metadata&&(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{style:{color:`#7c8493`},children:`metadata:`}),`
@@ -0,0 +1 @@
1
+ import{t as e}from"./webapp-BO_WoB_z.js";e();
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{U as r,_ as i,c as ee,h as a,y as te,z as o}from"./client-DFnuv2z3.js";import{a as s,o as c}from"./mui-agG5dued.js";import{Vt as l,Yt as ne}from"./mui-BTN91yBK.js";import{_n as re,gn as u}from"./mui-CdB_p2lt.js";import{F as d,H as f,I as p,N as ie,P as m,Q as h,St as g,V as _,Z as ae,xt as oe}from"./mui-BXSXx9c9.js";import{B as v,F as y,I as se,a as b,o as ce,z as x}from"./mui-Cd711nOk.js";import{A as S,it as le,k as ue,l as C,rt as de,u as fe}from"./mui-AnEgAVjz.js";import{_ as w,v as T}from"./mui-BwsIrivo.js";import{a as pe,j as E}from"./controls-C5W8gHU4.js";import{r as me,t as he}from"./alert-uBG6r9NW.js";import{n as ge,t as D}from"./use-copy-to-clipboard-BWYpToS3.js";import{F as _e,G as ve,M as ye,V as be,k as xe,l as Se,z as Ce}from"./icons-OboZgWSt.js";import{n as O,t as we}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as Te,t as Ee}from"./skeleton-BmWDJWF9.js";import{a as De,i as k,n as Oe,o as A,r as ke,s as Ae,t as je}from"./log-level-filter-Bcn31D1F.js";import{n as Me,t as j}from"./use-stack-context-UkBsF-l7.js";import{n as Ne,t as Pe}from"./log-location-DuBjh6HQ.js";function Fe(e){if(!e?.journal)return{severity:`warning`,title:`Log persistence unverified`,detail:`This backend does not expose durable capture diagnostics.`};let t=[[`Log ingestion`,e.lastError],[`Local journal`,e.journal.error],[`Owner journal`,e.ownerError]].flatMap(([e,t])=>t==null?[]:[`${e}: ${t.trim()||`operation failed; backend supplied no details`}`]);if(t.length)return{severity:`error`,title:`Log persistence delayed`,detail:`${t.join(`; `)}. ${e.journal.pending} local records await confirmation; unacknowledged records are retained.`};if(e.capture===`legacy-owner`)return{severity:`warning`,title:`Legacy log capture`,detail:`Database delivery is checked; the running owner cannot prove original capture time or durable replay. An owner update is required.`};let n=e.journal.pending+(e.ownerPending??0);return e.durability!==`persistent`||!e.lastCommitAt?{severity:`warning`,title:`Awaiting a durable log commit`,detail:`${n} records pending. Database durability: ${e.durability}.`}:{severity:n>5e3||n>0&&Date.now()-Date.parse(e.lastCommitAt)>1e4?`warning`:`success`,title:n?`${n} logs pending`:`Logs committed`,detail:`Last database commit: ${e.lastCommitAt}. Capture: ${e.capture}. Dropped: ${e.droppedTotal}.`}}function Ie(e){let t=e=>{let t=A.indexOf(e);return t===-1?A.length:t};return[...e].sort((e,n)=>t(e.level)-t(n.level))}function Le(e){if(!e.trim())return;let t={};for(let n of e.split(`,`)){let[e,r]=n.split(`=`).map(e=>e.trim());e&&r&&(t[e]=r)}return Object.keys(t).length>0?t:void 0}function M(){let[e,t]=(0,N.useState)(null),n=Fe(e);(0,N.useEffect)(()=>{let e=!0,n=!1,r=async()=>{if(!n){n=!0;try{let n=await i.getIngestionStats();e&&t(n)}catch{e&&t(null)}finally{n=!1}}};r();let ee=setInterval(()=>{r()},5e3);return()=>{e=!1,clearInterval(ee)}},[]);let a=re(),{activeProject:o,namespacePrefixes:s,matchesNamespace:c,filterApps:ne,displayName:u}=Me(),f=!o,[p,m]=r(),h=ge(),g=p.get(`app`)??(f?`omnitron`:``),v=p.get(`node`)??``,se=e=>m(t=>{let n=new URLSearchParams(t);return n.set(`app`,e),n},{replace:!0}),ce=e=>m(t=>{let n=new URLSearchParams(t);return e?n.set(`node`,e):n.delete(`node`),n},{replace:!0}),[S,le]=(0,N.useState)([]);(0,N.useEffect)(()=>{o&&g&&!c(g)&&m(e=>{let t=new URLSearchParams(e);return t.set(`app`,``),t},{replace:!0})},[o,g,c,m]);let fe=(0,N.useMemo)(()=>Object.fromEntries(S.map(e=>[e.id,e.hostname])),[S]),T=(0,N.useMemo)(()=>[...new Set(p.getAll(`level`))],[p]),[E,me]=(0,N.useState)(``),[D,ve]=(0,N.useState)(``),[O,Te]=(0,N.useState)(!1),[k,Oe]=(0,N.useState)(``),[A,Ae]=(0,N.useState)(`live`),[j,Pe]=(0,N.useState)(``),[M,I]=(0,N.useState)(``),[L,R]=(0,N.useState)([]),[Ge,Ke]=(0,N.useState)([]),[qe,Je]=(0,N.useState)([]),[Ye,Xe]=(0,N.useState)([]),[Ze,z]=(0,N.useState)(0),[Qe,B]=(0,N.useState)(!1),[$e,V]=(0,N.useState)(!0),[et,tt]=(0,N.useState)(!1),[nt,H]=(0,N.useState)(null),[rt,it]=(0,N.useState)(!1),[at,ot]=(0,N.useState)(!1),[U,st]=(0,N.useState)(!1),[W,G]=(0,N.useState)(0),K=(0,N.useRef)(null),q=(0,N.useRef)(null),J=(0,N.useRef)(new Set),Y=(0,N.useRef)(0);(0,N.useEffect)(()=>{let e=Y;return e.current++,R([]),z(0),B(!1),G(0),q.current=null,ot(!1),()=>{e.current++}},[g,s,v,T,D,k,A,j,M]);let X=(0,N.useRef)(null),[ct,lt]=(0,N.useState)(!0),ut=(0,N.useRef)(!0),Z=(0,N.useRef)(null);(0,N.useEffect)(()=>(Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>{ve(E)},He),()=>{Z.current&&clearTimeout(Z.current)}),[E]);let Q=A===`live`;(0,N.useEffect)(()=>{it(!(!Q||U))},[Q,U]),(0,N.useEffect)(()=>{(async()=>{try{let e=await ee.list();Je(ne(e).map(e=>e.name))}catch{}})()},[ne]),(0,N.useEffect)(()=>{(async()=>{try{let e=await te.listNodes(),t=Array.isArray(e)?e.filter(e=>!e.isLocal):[];t.length>0&&le(t.map(e=>({id:e.id,hostname:e.name})))}catch{}})()},[]);let dt=(0,N.useCallback)(async()=>{try{let e=await i.getLogStats();Xe(e.byApp.map(e=>e.app))}catch{}},[]);(0,N.useEffect)(()=>{dt()},[dt]);let ft=(0,N.useMemo)(()=>{let e=e=>e===g||c(e)||!e.includes(`/`),t=[...new Set([...qe,...Ye,...g?[g]:[]])].filter(e).sort(),n=new Map;for(let e of t){let t=u(e);n.set(t,(n.get(t)??0)+1)}return t.map(e=>{let t=u(e);return{value:e,label:f||n.get(t)>1?e:t}})},[qe,Ye,c,u,g,f]),pt=(0,N.useCallback)((e=0)=>{let t={limit:ze,offset:e};g&&(t.app=g),o&&(t.appPrefixes=s),T.length>0&&(t.level=T),D.trim()&&(t.search=D.trim()),v&&(t.nodeId=v);let n=Le(k);if(n&&Object.keys(n).length>0&&(t.labels=n),A===`custom`)j&&(t.from=new Date(j).toISOString()),M&&(t.to=new Date(M).toISOString());else if(A!==`live`){let e=Re.find(e=>e.key===A);e&&e.minutes>0&&(t.from=new Date(Date.now()-e.minutes*60*1e3).toISOString())}return t},[g,o,s,v,T,D,k,A,j,M]),mt=(0,N.useCallback)(async()=>{let e=Y.current;try{V(!0);let t=await i.queryLogs(pt(0));if(e!==Y.current)return;R(t.entries),z(t.total),Ke(t.byLevel),B(t.hasMore),H(null),J.current.clear(),t.entries.length>0&&(q.current=new Date(t.entries[0].timestamp).toISOString())}catch(t){if(e!==Y.current)return;H(t?.message??`Failed to query logs`)}finally{e===Y.current&&V(!1)}},[pt]),ht=async()=>{let e=Y.current;tt(!0);try{let t=await i.queryLogs(pt(L.length));if(e!==Y.current)return;R(e=>[...e,...t.entries]),B(t.hasMore)}catch(t){if(e!==Y.current)return;H(t?.message??`Failed to load more`)}finally{tt(!1)}};(0,N.useEffect)(()=>{Q||mt()},[mt,Q]);let $=(0,N.useMemo)(()=>{let e={tail:100};g&&(e.app=g),o&&(e.appPrefixes=s),T.length>0&&(e.level=T),D.trim()&&(e.search=D.trim()),v&&(e.nodeId=v);let t=Le(k);return t&&Object.keys(t).length>0&&(e.labels=t),e},[g,o,s,T,D,v,k]);(0,N.useEffect)(()=>{if(!Q)return;let e=!0;return(async()=>{try{V(!0);let t=await i.streamLogs($);if(!e)return;let n=[...t].reverse();R(n),z(t.length),B(!1),H(null),J.current.clear(),t.length>0&&(q.current=new Date(t[t.length-1].timestamp).toISOString())}catch(t){if(!e)return;H(t?.message??`Failed to stream logs`)}finally{e&&V(!1)}})(),()=>{e=!1}},[Q,$]),(0,N.useEffect)(()=>{if(K.current&&=(clearInterval(K.current),null),!rt||U)return;let e=!0,t=!1;return K.current=setInterval(async()=>{if(!t){t=!0;try{let t=q.current,n={...$,tail:Ve,...t?{since:t}:{}},r=await i.streamLogs(n);if(!e||(H(null),r.length===Ve&&ot(!0),r.length===0))return;let ee=new Set(L.map(e=>e.id)),a=r.filter(e=>!ee.has(e.id));if(a.length===0)return;a.forEach(e=>J.current.add(e.id)),setTimeout(()=>{a.forEach(e=>J.current.delete(e.id))},2e3),q.current=new Date(a[a.length-1].timestamp).toISOString(),R(e=>{let t=[...a.reverse(),...e];return t.length>2e3?t.slice(0,2e3):t}),z(e=>e+a.length),ut.current||G(e=>e+a.length)}catch{e&&H(`Live log stream unavailable. Retrying.`)}finally{t=!1}}},Be),()=>{e=!1,K.current&&clearInterval(K.current)}},[rt,U,$,L]),(0,N.useEffect)(()=>{if(ut.current&&X.current){let e=X.current;requestAnimationFrame(()=>{e.scrollTop=0})}},[L]);let gt=(0,N.useCallback)(()=>{let e=X.current;if(!e)return;let t=e.scrollTop<Ue;ut.current=t,lt(t),t&&G(0)},[]),_t=(0,N.useCallback)(()=>{let e=X.current;e&&(e.scrollTo({top:0,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),G(0))},[]),vt=e=>m(t=>{let n=new URLSearchParams(t);n.delete(`level`);for(let t of e)n.append(`level`,t);return n},{replace:!0}),yt=()=>{m({app:``},{replace:!0}),me(``),ve(``),Oe(``),Ae(`1h`),Pe(``),I(``)},bt=g!==``||v!==``||T.length>0||D!==``||k!==``,xt=(0,N.useMemo)(()=>{if(!Q)return Ie(Ge);let e=new Map;for(let t of L)e.set(t.level,(e.get(t.level)??0)+1);return Ie([...e].map(([e,t])=>({level:e,count:t})))},[Q,Ge,L]);return(0,P.jsxs)(_,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,minHeight:0,minWidth:0},children:[(0,P.jsxs)(_,{sx:{position:`relative`,flexShrink:0,zIndex:10,mb:2,p:{xs:1.5,sm:2},borderRadius:2,bgcolor:`background.paper`,border:`1px solid`,borderColor:`divider`},children:[(0,P.jsx)(we,{links:[{name:`Logs`}],sx:{mb:1.5},action:(0,P.jsxs)(w,{direction:`row`,spacing:.5,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,P.jsx)(y,{title:`Current node: ${n.detail}`,children:(0,P.jsx)(ae,{size:`small`,color:n.severity,variant:`outlined`,label:n.title})}),Q&&(0,P.jsx)(ae,{label:U?`PAUSED`:`LIVE TAIL`,size:`small`,sx:{height:20,fontSize:10,fontWeight:700,fontFamily:F,letterSpacing:`0.08em`,bgcolor:l(U?`#f59e0b`:`#22c55e`,.15),color:a.palette[U?`warning`:`success`][a.palette.mode===`light`?`dark`:`light`],animation:U?void 0:`${We} 2s ease-in-out infinite`,border:`1px solid`,borderColor:l(U?`#f59e0b`:`#22c55e`,.3)}}),Q&&(0,P.jsx)(y,{title:U?`Resume streaming`:`Pause streaming`,children:(0,P.jsx)(de,{size:`small`,onClick:()=>st(e=>!e),sx:{color:a.palette[U?`warning`:`success`][a.palette.mode===`light`?`dark`:`light`]},children:U?(0,P.jsx)(xe,{}):(0,P.jsx)(Ce,{})})}),(0,P.jsx)(y,{title:`Refresh (R)`,children:(0,P.jsx)(de,{"data-console-command":`refresh`,"aria-label":`Refresh logs`,size:`small`,onClick:()=>{Q&&(q.current=null),mt(),dt()},children:(0,P.jsx)(ye,{})})}),bt&&(0,P.jsx)(y,{title:`Clear all filters`,children:(0,P.jsx)(de,{size:`small`,onClick:yt,sx:{color:`error.main`},children:(0,P.jsx)(Se,{})})})]})}),(0,P.jsxs)(w,{direction:`row`,spacing:1.5,useFlexGap:!0,sx:{flexWrap:`wrap`,mb:1.5},children:[(0,P.jsxs)(b,{select:!0,size:`small`,label:`Application`,value:g,onChange:e=>se(e.target.value),sx:{minWidth:0,flex:`1 1 160px`,"& .MuiInputBase-root":{fontFamily:F,fontSize:12},"& .MuiInputLabel-root":{fontSize:12}},children:[(0,P.jsx)(C,{value:``,children:(0,P.jsx)(`em`,{children:`All Apps`})}),ft.map(({value:e,label:t})=>(0,P.jsx)(C,{value:e,sx:{fontFamily:F,fontSize:12},children:t},e))]}),S.length>0&&(0,P.jsxs)(b,{select:!0,size:`small`,label:`Node`,value:v,onChange:e=>ce(e.target.value),sx:{minWidth:0,flex:`1 1 150px`,"& .MuiInputBase-root":{fontFamily:F,fontSize:12},"& .MuiInputLabel-root":{fontSize:12}},children:[(0,P.jsx)(C,{value:``,children:(0,P.jsx)(`em`,{children:`All Nodes`})}),S.map(e=>(0,P.jsx)(C,{value:e.id,sx:{fontFamily:F,fontSize:12},children:e.hostname},e.id))]}),(0,P.jsx)(b,{"data-console-command":`search`,size:`small`,placeholder:`Search messages...`,label:`Search messages`,value:E,onChange:e=>me(e.target.value),slotProps:{input:{startAdornment:(0,P.jsx)(ue,{position:`start`,children:(0,P.jsx)(_e,{sx:{fontSize:16,color:`text.secondary`}})})}},sx:{flex:`2 1 220px`,minWidth:0,"& .MuiInputBase-root":{fontFamily:F,fontSize:12}}}),(0,P.jsxs)(d,{size:`small`,"aria-expanded":O,"aria-controls":`log-filter-options`,variant:O?`outlined`:`text`,onClick:()=>Te(e=>!e),children:[`Filters`,T.length>0||k||A!==`live`?` · ${Number(T.length>0)+Number(!!k)+Number(A!==`live`)}`:``]})]}),v&&(0,P.jsxs)(x,{variant:`caption`,sx:{display:`block`,mb:1,color:`text.secondary`},children:[`Replicated logs from `,fe[v]??v,`. An empty result does not prove that an operation was not attempted.`]}),(0,P.jsxs)(oe,{in:O,id:`log-filter-options`,children:[(0,P.jsx)(_,{sx:{pt:1,pb:1.5},children:(0,P.jsx)(b,{size:`small`,placeholder:`key=val, key2=val2`,label:`Labels`,value:k,onChange:e=>Oe(e.target.value),sx:{width:`100%`,maxWidth:480,minWidth:0,"& .MuiInputBase-root":{fontFamily:F,fontSize:12}}})}),g&&(0,P.jsxs)(w,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:1,minWidth:0},children:[(0,P.jsx)(x,{component:`code`,variant:`caption`,sx:{fontFamily:F,overflowWrap:`anywhere`},children:Ne(g,v)}),(0,P.jsx)(d,{size:`small`,onClick:()=>void h.copy(Ne(g,v)),children:h.state===`success`?`Copied`:h.state===`error`?`Retry copy`:`Copy app/node command`})]}),(0,P.jsxs)(w,{direction:`row`,spacing:2,useFlexGap:!0,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,P.jsx)(je,{selected:T,counts:new Map(xt.map(e=>[e.level,e.count])),onChange:vt}),(0,P.jsx)(_,{sx:{width:`1px`,height:20,bgcolor:`text.disabled`,mx:.5}}),(0,P.jsx)(ie,{size:`small`,variant:`outlined`,sx:{flexWrap:`wrap`,maxWidth:`100%`,rowGap:.5},children:Re.map(e=>{let t=A===e.key;return(0,P.jsx)(d,{"aria-pressed":t,onClick:()=>Ae(e.key),variant:t?`contained`:`outlined`,sx:{minWidth:e.key===`live`?52:36,px:1,fontSize:11,fontFamily:F,fontWeight:t?700:400,...e.key===`live`&&t?{bgcolor:l(`#22c55e`,.2),color:a.palette.success[a.palette.mode===`light`?`dark`:`light`],borderColor:l(`#22c55e`,.4),"&:hover":{bgcolor:l(`#22c55e`,.3)}}:{}},children:e.label},e.key)})}),A===`custom`&&(0,P.jsxs)(w,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,P.jsx)(b,{type:`datetime-local`,size:`small`,value:j,onChange:e=>Pe(e.target.value),label:`From`,sx:{width:200,maxWidth:`100%`,minWidth:0,"& .MuiInputBase-root":{fontSize:11,fontFamily:F},"& .MuiInputLabel-root":{fontSize:11}},slotProps:{inputLabel:{shrink:!0}}}),(0,P.jsx)(b,{type:`datetime-local`,size:`small`,value:M,onChange:e=>I(e.target.value),label:`To`,sx:{width:200,maxWidth:`100%`,minWidth:0,"& .MuiInputBase-root":{fontSize:11,fontFamily:F},"& .MuiInputLabel-root":{fontSize:11}},slotProps:{inputLabel:{shrink:!0}}})]})]})]})]}),(0,P.jsxs)(w,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`,flexWrap:`wrap`,gap:1,mb:1,px:.5},children:[(0,P.jsxs)(w,{direction:`row`,spacing:2,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,P.jsx)(x,{variant:`caption`,sx:{fontFamily:F,fontSize:11,color:`text.secondary`},children:$e?`Loading...`:Q?`${L.length.toLocaleString()} entries`:`Showing ${L.length.toLocaleString()} of ${Ze.toLocaleString()}`}),!$e&&xt.length>0&&(0,P.jsxs)(w,{direction:`row`,spacing:1.5,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,P.jsx)(_,{sx:{width:`1px`,height:12,bgcolor:`divider`}}),xt.map(e=>(0,P.jsxs)(w,{direction:`row`,spacing:.5,sx:{alignItems:`center`},children:[(0,P.jsx)(_,{sx:{width:5,height:5,borderRadius:`50%`,bgcolor:De(e.level,a)}}),(0,P.jsxs)(x,{variant:`caption`,sx:{fontFamily:F,fontSize:10,color:`text.secondary`},children:[e.level,`: `,e.count.toLocaleString()]})]},e.level))]})]}),rt&&!U&&(0,P.jsx)(x,{variant:`caption`,sx:{fontFamily:F,fontSize:10,color:a.palette[at?`warning`:`success`][a.palette.mode===`light`?`dark`:`light`],animation:`${We} 2s ease-in-out infinite`},children:at?`Tail window filled · use history for the full record`:`Recent tail · every 2s · up to 50 events per poll`})]}),nt&&(0,P.jsx)(he,{closable:!0,severity:`error`,variant:`outlined`,onClose:()=>H(null),sx:{mb:1,fontFamily:F,fontSize:12},children:nt}),(0,P.jsxs)(_,{sx:{position:`relative`,flex:1,minHeight:320,flexShrink:0,borderRadius:2,overflow:`hidden`,border:`1px solid`,borderColor:`divider`,bgcolor:`background.paper`},children:[(0,P.jsxs)(_,{sx:{display:`flex`,alignItems:`center`,height:32,px:1.5,bgcolor:`action.hover`,borderBottom:`1px solid`,borderColor:`divider`},children:[(0,P.jsx)(be,{sx:{fontSize:16,color:`text.secondary`,mr:1}}),(0,P.jsxs)(x,{variant:`caption`,sx:{fontFamily:F,fontSize:10,color:`text.secondary`,letterSpacing:`0.04em`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[f?`omnitron-daemon`:`omnitron-logs`,g?` — ${g}`:``]})]}),(0,P.jsx)(_,{ref:X,onScroll:gt,sx:{height:`calc(100% - 32px)`,overflowY:`auto`,overflowX:`hidden`,py:.5,"&::-webkit-scrollbar":{width:6},"&::-webkit-scrollbar-track":{bgcolor:`transparent`},"&::-webkit-scrollbar-thumb":{bgcolor:`action.selected`,borderRadius:3,"&:hover":{bgcolor:`text.disabled`}}},children:$e?(0,P.jsx)(w,{spacing:.25,sx:{p:1.5},children:Array.from({length:20},(e,t)=>(0,P.jsx)(Ee,{height:18,sx:{bgcolor:`action.hover`,borderRadius:.5,animationDuration:`${1.5+t%5*.2}s`}},t))}):L.length===0?(0,P.jsxs)(w,{sx:{alignItems:`center`,justifyContent:`center`,height:`100%`,py:8},children:[(0,P.jsx)(be,{sx:{fontSize:40,color:`text.disabled`,mb:1.5}}),(0,P.jsx)(x,{sx:{fontFamily:F,fontSize:12,color:`text.secondary`,textAlign:`center`},children:`No log entries match the current filters.`}),(0,P.jsx)(x,{sx:{fontFamily:F,fontSize:11,color:`text.secondary`,mt:.5},children:bt?`Try adjusting your filters.`:`Waiting for log data...`})]}):(0,P.jsxs)(P.Fragment,{children:[Qe&&!Q&&(0,P.jsx)(w,{sx:{alignItems:`center`,py:1},children:(0,P.jsx)(d,{size:`small`,variant:`text`,onClick:ht,disabled:et,sx:{fontFamily:F,fontSize:10,color:a.palette.info[a.palette.mode===`light`?`dark`:`light`],textTransform:`none`,"&:hover":{bgcolor:l(`#58a6ff`,.08)}},children:et?`Loading...`:`Load older entries (${(Ze-L.length).toLocaleString()} remaining)`})}),L.map(e=>(0,P.jsx)(ke,{log:e,isNew:J.current.has(e.id),nodeNames:fe},e.id))]})}),Q&&!ct&&(0,P.jsxs)(d,{size:`small`,variant:`contained`,onClick:_t,"aria-label":W?`Jump to latest logs, ${W} new entries`:`Jump to latest logs`,"data-console-command":`latest`,startIcon:(0,P.jsx)(pe,{}),sx:{position:`absolute`,bottom:{xs:12,sm:16},right:{xs:12,sm:16},minHeight:{xs:44,sm:36},px:1.5,gap:.75,bgcolor:`background.paper`,color:`primary.main`,border:1,borderColor:`divider`,boxShadow:a.shadows[3],"&:hover":{bgcolor:`action.hover`},"& .MuiButton-startIcon":{mr:.25}},children:[`Latest`,W>0&&(0,P.jsx)(_,{component:`span`,"aria-hidden":`true`,sx:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,minWidth:22,height:22,px:.75,borderRadius:.75,bgcolor:`primary.main`,color:`primary.contrastText`,fontSize:11,fontWeight:600,lineHeight:1,fontVariantNumeric:`tabular-nums`},children:W>999?`999+`:W})]})]})]})}var N,P,F,Re,ze,Be,Ve,He,Ue,We;function I(){return(I=e((()=>{E(),N=t(),o(),f(),v(),T(),ce(),fe(),p(),m(),h(),le(),se(),g(),S(),ne(),s(),u(),ve(),me(),O(),k(),Te(),D(),a(),j(),Oe(),Ae(),Pe(),P=n(),F=`'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace`,Re=[{key:`live`,label:`Live`,minutes:0},{key:`15m`,label:`15m`,minutes:15},{key:`1h`,label:`1h`,minutes:60},{key:`6h`,label:`6h`,minutes:360},{key:`24h`,label:`24h`,minutes:1440},{key:`custom`,label:`Custom`,minutes:-1}],ze=100,Be=2e3,Ve=50,He=300,Ue=80,We=c`
1
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{U as r,_ as i,c as ee,h as a,y as te,z as o}from"./client-DFnuv2z3.js";import{a as s,o as c}from"./mui-agG5dued.js";import{Vt as l,Yt as ne}from"./mui-BTN91yBK.js";import{_n as re,gn as u}from"./mui-CdB_p2lt.js";import{F as d,H as f,I as p,N as ie,P as m,Q as h,St as g,V as _,Z as ae,xt as oe}from"./mui-BXSXx9c9.js";import{B as v,F as y,I as se,a as b,o as ce,z as x}from"./mui-Cd711nOk.js";import{A as S,it as le,k as ue,l as C,rt as de,u as fe}from"./mui-AnEgAVjz.js";import{_ as w,v as T}from"./mui-BwsIrivo.js";import{a as pe,j as E}from"./controls-C5W8gHU4.js";import{r as me,t as he}from"./alert-uBG6r9NW.js";import{n as ge,t as D}from"./use-copy-to-clipboard-BWYpToS3.js";import{F as _e,G as ve,M as ye,V as be,k as xe,l as Se,z as Ce}from"./icons-OboZgWSt.js";import{n as O,t as we}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as Te,t as Ee}from"./skeleton-BmWDJWF9.js";import{a as De,i as k,n as Oe,o as A,r as ke,s as Ae,t as je}from"./log-level-filter-Bcn31D1F.js";import{n as Me,t as j}from"./use-stack-context-8yaHaN8L.js";import{n as Ne,t as Pe}from"./log-location-DuBjh6HQ.js";function Fe(e){if(!e?.journal)return{severity:`warning`,title:`Log persistence unverified`,detail:`This backend does not expose durable capture diagnostics.`};let t=[[`Log ingestion`,e.lastError],[`Local journal`,e.journal.error],[`Owner journal`,e.ownerError]].flatMap(([e,t])=>t==null?[]:[`${e}: ${t.trim()||`operation failed; backend supplied no details`}`]);if(t.length)return{severity:`error`,title:`Log persistence delayed`,detail:`${t.join(`; `)}. ${e.journal.pending} local records await confirmation; unacknowledged records are retained.`};if(e.capture===`legacy-owner`)return{severity:`warning`,title:`Legacy log capture`,detail:`Database delivery is checked; the running owner cannot prove original capture time or durable replay. An owner update is required.`};let n=e.journal.pending+(e.ownerPending??0);return e.durability!==`persistent`||!e.lastCommitAt?{severity:`warning`,title:`Awaiting a durable log commit`,detail:`${n} records pending. Database durability: ${e.durability}.`}:{severity:n>5e3||n>0&&Date.now()-Date.parse(e.lastCommitAt)>1e4?`warning`:`success`,title:n?`${n} logs pending`:`Logs committed`,detail:`Last database commit: ${e.lastCommitAt}. Capture: ${e.capture}. Dropped: ${e.droppedTotal}.`}}function Ie(e){let t=e=>{let t=A.indexOf(e);return t===-1?A.length:t};return[...e].sort((e,n)=>t(e.level)-t(n.level))}function Le(e){if(!e.trim())return;let t={};for(let n of e.split(`,`)){let[e,r]=n.split(`=`).map(e=>e.trim());e&&r&&(t[e]=r)}return Object.keys(t).length>0?t:void 0}function M(){let[e,t]=(0,N.useState)(null),n=Fe(e);(0,N.useEffect)(()=>{let e=!0,n=!1,r=async()=>{if(!n){n=!0;try{let n=await i.getIngestionStats();e&&t(n)}catch{e&&t(null)}finally{n=!1}}};r();let ee=setInterval(()=>{r()},5e3);return()=>{e=!1,clearInterval(ee)}},[]);let a=re(),{activeProject:o,namespacePrefixes:s,matchesNamespace:c,filterApps:ne,displayName:u}=Me(),f=!o,[p,m]=r(),h=ge(),g=p.get(`app`)??(f?`omnitron`:``),v=p.get(`node`)??``,se=e=>m(t=>{let n=new URLSearchParams(t);return n.set(`app`,e),n},{replace:!0}),ce=e=>m(t=>{let n=new URLSearchParams(t);return e?n.set(`node`,e):n.delete(`node`),n},{replace:!0}),[S,le]=(0,N.useState)([]);(0,N.useEffect)(()=>{o&&g&&!c(g)&&m(e=>{let t=new URLSearchParams(e);return t.set(`app`,``),t},{replace:!0})},[o,g,c,m]);let fe=(0,N.useMemo)(()=>Object.fromEntries(S.map(e=>[e.id,e.hostname])),[S]),T=(0,N.useMemo)(()=>[...new Set(p.getAll(`level`))],[p]),[E,me]=(0,N.useState)(``),[D,ve]=(0,N.useState)(``),[O,Te]=(0,N.useState)(!1),[k,Oe]=(0,N.useState)(``),[A,Ae]=(0,N.useState)(`live`),[j,Pe]=(0,N.useState)(``),[M,I]=(0,N.useState)(``),[L,R]=(0,N.useState)([]),[Ge,Ke]=(0,N.useState)([]),[qe,Je]=(0,N.useState)([]),[Ye,Xe]=(0,N.useState)([]),[Ze,z]=(0,N.useState)(0),[Qe,B]=(0,N.useState)(!1),[$e,V]=(0,N.useState)(!0),[et,tt]=(0,N.useState)(!1),[nt,H]=(0,N.useState)(null),[rt,it]=(0,N.useState)(!1),[at,ot]=(0,N.useState)(!1),[U,st]=(0,N.useState)(!1),[W,G]=(0,N.useState)(0),K=(0,N.useRef)(null),q=(0,N.useRef)(null),J=(0,N.useRef)(new Set),Y=(0,N.useRef)(0);(0,N.useEffect)(()=>{let e=Y;return e.current++,R([]),z(0),B(!1),G(0),q.current=null,ot(!1),()=>{e.current++}},[g,s,v,T,D,k,A,j,M]);let X=(0,N.useRef)(null),[ct,lt]=(0,N.useState)(!0),ut=(0,N.useRef)(!0),Z=(0,N.useRef)(null);(0,N.useEffect)(()=>(Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>{ve(E)},He),()=>{Z.current&&clearTimeout(Z.current)}),[E]);let Q=A===`live`;(0,N.useEffect)(()=>{it(!(!Q||U))},[Q,U]),(0,N.useEffect)(()=>{(async()=>{try{let e=await ee.list();Je(ne(e).map(e=>e.name))}catch{}})()},[ne]),(0,N.useEffect)(()=>{(async()=>{try{let e=await te.listNodes(),t=Array.isArray(e)?e.filter(e=>!e.isLocal):[];t.length>0&&le(t.map(e=>({id:e.id,hostname:e.name})))}catch{}})()},[]);let dt=(0,N.useCallback)(async()=>{try{let e=await i.getLogStats();Xe(e.byApp.map(e=>e.app))}catch{}},[]);(0,N.useEffect)(()=>{dt()},[dt]);let ft=(0,N.useMemo)(()=>{let e=e=>e===g||c(e)||!e.includes(`/`),t=[...new Set([...qe,...Ye,...g?[g]:[]])].filter(e).sort(),n=new Map;for(let e of t){let t=u(e);n.set(t,(n.get(t)??0)+1)}return t.map(e=>{let t=u(e);return{value:e,label:f||n.get(t)>1?e:t}})},[qe,Ye,c,u,g,f]),pt=(0,N.useCallback)((e=0)=>{let t={limit:ze,offset:e};g&&(t.app=g),o&&(t.appPrefixes=s),T.length>0&&(t.level=T),D.trim()&&(t.search=D.trim()),v&&(t.nodeId=v);let n=Le(k);if(n&&Object.keys(n).length>0&&(t.labels=n),A===`custom`)j&&(t.from=new Date(j).toISOString()),M&&(t.to=new Date(M).toISOString());else if(A!==`live`){let e=Re.find(e=>e.key===A);e&&e.minutes>0&&(t.from=new Date(Date.now()-e.minutes*60*1e3).toISOString())}return t},[g,o,s,v,T,D,k,A,j,M]),mt=(0,N.useCallback)(async()=>{let e=Y.current;try{V(!0);let t=await i.queryLogs(pt(0));if(e!==Y.current)return;R(t.entries),z(t.total),Ke(t.byLevel),B(t.hasMore),H(null),J.current.clear(),t.entries.length>0&&(q.current=new Date(t.entries[0].timestamp).toISOString())}catch(t){if(e!==Y.current)return;H(t?.message??`Failed to query logs`)}finally{e===Y.current&&V(!1)}},[pt]),ht=async()=>{let e=Y.current;tt(!0);try{let t=await i.queryLogs(pt(L.length));if(e!==Y.current)return;R(e=>[...e,...t.entries]),B(t.hasMore)}catch(t){if(e!==Y.current)return;H(t?.message??`Failed to load more`)}finally{tt(!1)}};(0,N.useEffect)(()=>{Q||mt()},[mt,Q]);let $=(0,N.useMemo)(()=>{let e={tail:100};g&&(e.app=g),o&&(e.appPrefixes=s),T.length>0&&(e.level=T),D.trim()&&(e.search=D.trim()),v&&(e.nodeId=v);let t=Le(k);return t&&Object.keys(t).length>0&&(e.labels=t),e},[g,o,s,T,D,v,k]);(0,N.useEffect)(()=>{if(!Q)return;let e=!0;return(async()=>{try{V(!0);let t=await i.streamLogs($);if(!e)return;let n=[...t].reverse();R(n),z(t.length),B(!1),H(null),J.current.clear(),t.length>0&&(q.current=new Date(t[t.length-1].timestamp).toISOString())}catch(t){if(!e)return;H(t?.message??`Failed to stream logs`)}finally{e&&V(!1)}})(),()=>{e=!1}},[Q,$]),(0,N.useEffect)(()=>{if(K.current&&=(clearInterval(K.current),null),!rt||U)return;let e=!0,t=!1;return K.current=setInterval(async()=>{if(!t){t=!0;try{let t=q.current,n={...$,tail:Ve,...t?{since:t}:{}},r=await i.streamLogs(n);if(!e||(H(null),r.length===Ve&&ot(!0),r.length===0))return;let ee=new Set(L.map(e=>e.id)),a=r.filter(e=>!ee.has(e.id));if(a.length===0)return;a.forEach(e=>J.current.add(e.id)),setTimeout(()=>{a.forEach(e=>J.current.delete(e.id))},2e3),q.current=new Date(a[a.length-1].timestamp).toISOString(),R(e=>{let t=[...a.reverse(),...e];return t.length>2e3?t.slice(0,2e3):t}),z(e=>e+a.length),ut.current||G(e=>e+a.length)}catch{e&&H(`Live log stream unavailable. Retrying.`)}finally{t=!1}}},Be),()=>{e=!1,K.current&&clearInterval(K.current)}},[rt,U,$,L]),(0,N.useEffect)(()=>{if(ut.current&&X.current){let e=X.current;requestAnimationFrame(()=>{e.scrollTop=0})}},[L]);let gt=(0,N.useCallback)(()=>{let e=X.current;if(!e)return;let t=e.scrollTop<Ue;ut.current=t,lt(t),t&&G(0)},[]),_t=(0,N.useCallback)(()=>{let e=X.current;e&&(e.scrollTo({top:0,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),G(0))},[]),vt=e=>m(t=>{let n=new URLSearchParams(t);n.delete(`level`);for(let t of e)n.append(`level`,t);return n},{replace:!0}),yt=()=>{m({app:``},{replace:!0}),me(``),ve(``),Oe(``),Ae(`1h`),Pe(``),I(``)},bt=g!==``||v!==``||T.length>0||D!==``||k!==``,xt=(0,N.useMemo)(()=>{if(!Q)return Ie(Ge);let e=new Map;for(let t of L)e.set(t.level,(e.get(t.level)??0)+1);return Ie([...e].map(([e,t])=>({level:e,count:t})))},[Q,Ge,L]);return(0,P.jsxs)(_,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,minHeight:0,minWidth:0},children:[(0,P.jsxs)(_,{sx:{position:`relative`,flexShrink:0,zIndex:10,mb:2,p:{xs:1.5,sm:2},borderRadius:2,bgcolor:`background.paper`,border:`1px solid`,borderColor:`divider`},children:[(0,P.jsx)(we,{links:[{name:`Logs`}],sx:{mb:1.5},action:(0,P.jsxs)(w,{direction:`row`,spacing:.5,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,P.jsx)(y,{title:`Current node: ${n.detail}`,children:(0,P.jsx)(ae,{size:`small`,color:n.severity,variant:`outlined`,label:n.title})}),Q&&(0,P.jsx)(ae,{label:U?`PAUSED`:`LIVE TAIL`,size:`small`,sx:{height:20,fontSize:10,fontWeight:700,fontFamily:F,letterSpacing:`0.08em`,bgcolor:l(U?`#f59e0b`:`#22c55e`,.15),color:a.palette[U?`warning`:`success`][a.palette.mode===`light`?`dark`:`light`],animation:U?void 0:`${We} 2s ease-in-out infinite`,border:`1px solid`,borderColor:l(U?`#f59e0b`:`#22c55e`,.3)}}),Q&&(0,P.jsx)(y,{title:U?`Resume streaming`:`Pause streaming`,children:(0,P.jsx)(de,{size:`small`,onClick:()=>st(e=>!e),sx:{color:a.palette[U?`warning`:`success`][a.palette.mode===`light`?`dark`:`light`]},children:U?(0,P.jsx)(xe,{}):(0,P.jsx)(Ce,{})})}),(0,P.jsx)(y,{title:`Refresh (R)`,children:(0,P.jsx)(de,{"data-console-command":`refresh`,"aria-label":`Refresh logs`,size:`small`,onClick:()=>{Q&&(q.current=null),mt(),dt()},children:(0,P.jsx)(ye,{})})}),bt&&(0,P.jsx)(y,{title:`Clear all filters`,children:(0,P.jsx)(de,{size:`small`,onClick:yt,sx:{color:`error.main`},children:(0,P.jsx)(Se,{})})})]})}),(0,P.jsxs)(w,{direction:`row`,spacing:1.5,useFlexGap:!0,sx:{flexWrap:`wrap`,mb:1.5},children:[(0,P.jsxs)(b,{select:!0,size:`small`,label:`Application`,value:g,onChange:e=>se(e.target.value),sx:{minWidth:0,flex:`1 1 160px`,"& .MuiInputBase-root":{fontFamily:F,fontSize:12},"& .MuiInputLabel-root":{fontSize:12}},children:[(0,P.jsx)(C,{value:``,children:(0,P.jsx)(`em`,{children:`All Apps`})}),ft.map(({value:e,label:t})=>(0,P.jsx)(C,{value:e,sx:{fontFamily:F,fontSize:12},children:t},e))]}),S.length>0&&(0,P.jsxs)(b,{select:!0,size:`small`,label:`Node`,value:v,onChange:e=>ce(e.target.value),sx:{minWidth:0,flex:`1 1 150px`,"& .MuiInputBase-root":{fontFamily:F,fontSize:12},"& .MuiInputLabel-root":{fontSize:12}},children:[(0,P.jsx)(C,{value:``,children:(0,P.jsx)(`em`,{children:`All Nodes`})}),S.map(e=>(0,P.jsx)(C,{value:e.id,sx:{fontFamily:F,fontSize:12},children:e.hostname},e.id))]}),(0,P.jsx)(b,{"data-console-command":`search`,size:`small`,placeholder:`Search messages...`,label:`Search messages`,value:E,onChange:e=>me(e.target.value),slotProps:{input:{startAdornment:(0,P.jsx)(ue,{position:`start`,children:(0,P.jsx)(_e,{sx:{fontSize:16,color:`text.secondary`}})})}},sx:{flex:`2 1 220px`,minWidth:0,"& .MuiInputBase-root":{fontFamily:F,fontSize:12}}}),(0,P.jsxs)(d,{size:`small`,"aria-expanded":O,"aria-controls":`log-filter-options`,variant:O?`outlined`:`text`,onClick:()=>Te(e=>!e),children:[`Filters`,T.length>0||k||A!==`live`?` · ${Number(T.length>0)+Number(!!k)+Number(A!==`live`)}`:``]})]}),v&&(0,P.jsxs)(x,{variant:`caption`,sx:{display:`block`,mb:1,color:`text.secondary`},children:[`Replicated logs from `,fe[v]??v,`. An empty result does not prove that an operation was not attempted.`]}),(0,P.jsxs)(oe,{in:O,id:`log-filter-options`,children:[(0,P.jsx)(_,{sx:{pt:1,pb:1.5},children:(0,P.jsx)(b,{size:`small`,placeholder:`key=val, key2=val2`,label:`Labels`,value:k,onChange:e=>Oe(e.target.value),sx:{width:`100%`,maxWidth:480,minWidth:0,"& .MuiInputBase-root":{fontFamily:F,fontSize:12}}})}),g&&(0,P.jsxs)(w,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:1,minWidth:0},children:[(0,P.jsx)(x,{component:`code`,variant:`caption`,sx:{fontFamily:F,overflowWrap:`anywhere`},children:Ne(g,v)}),(0,P.jsx)(d,{size:`small`,onClick:()=>void h.copy(Ne(g,v)),children:h.state===`success`?`Copied`:h.state===`error`?`Retry copy`:`Copy app/node command`})]}),(0,P.jsxs)(w,{direction:`row`,spacing:2,useFlexGap:!0,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,P.jsx)(je,{selected:T,counts:new Map(xt.map(e=>[e.level,e.count])),onChange:vt}),(0,P.jsx)(_,{sx:{width:`1px`,height:20,bgcolor:`text.disabled`,mx:.5}}),(0,P.jsx)(ie,{size:`small`,variant:`outlined`,sx:{flexWrap:`wrap`,maxWidth:`100%`,rowGap:.5},children:Re.map(e=>{let t=A===e.key;return(0,P.jsx)(d,{"aria-pressed":t,onClick:()=>Ae(e.key),variant:t?`contained`:`outlined`,sx:{minWidth:e.key===`live`?52:36,px:1,fontSize:11,fontFamily:F,fontWeight:t?700:400,...e.key===`live`&&t?{bgcolor:l(`#22c55e`,.2),color:a.palette.success[a.palette.mode===`light`?`dark`:`light`],borderColor:l(`#22c55e`,.4),"&:hover":{bgcolor:l(`#22c55e`,.3)}}:{}},children:e.label},e.key)})}),A===`custom`&&(0,P.jsxs)(w,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,P.jsx)(b,{type:`datetime-local`,size:`small`,value:j,onChange:e=>Pe(e.target.value),label:`From`,sx:{width:200,maxWidth:`100%`,minWidth:0,"& .MuiInputBase-root":{fontSize:11,fontFamily:F},"& .MuiInputLabel-root":{fontSize:11}},slotProps:{inputLabel:{shrink:!0}}}),(0,P.jsx)(b,{type:`datetime-local`,size:`small`,value:M,onChange:e=>I(e.target.value),label:`To`,sx:{width:200,maxWidth:`100%`,minWidth:0,"& .MuiInputBase-root":{fontSize:11,fontFamily:F},"& .MuiInputLabel-root":{fontSize:11}},slotProps:{inputLabel:{shrink:!0}}})]})]})]})]}),(0,P.jsxs)(w,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`,flexWrap:`wrap`,gap:1,mb:1,px:.5},children:[(0,P.jsxs)(w,{direction:`row`,spacing:2,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,P.jsx)(x,{variant:`caption`,sx:{fontFamily:F,fontSize:11,color:`text.secondary`},children:$e?`Loading...`:Q?`${L.length.toLocaleString()} entries`:`Showing ${L.length.toLocaleString()} of ${Ze.toLocaleString()}`}),!$e&&xt.length>0&&(0,P.jsxs)(w,{direction:`row`,spacing:1.5,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,P.jsx)(_,{sx:{width:`1px`,height:12,bgcolor:`divider`}}),xt.map(e=>(0,P.jsxs)(w,{direction:`row`,spacing:.5,sx:{alignItems:`center`},children:[(0,P.jsx)(_,{sx:{width:5,height:5,borderRadius:`50%`,bgcolor:De(e.level,a)}}),(0,P.jsxs)(x,{variant:`caption`,sx:{fontFamily:F,fontSize:10,color:`text.secondary`},children:[e.level,`: `,e.count.toLocaleString()]})]},e.level))]})]}),rt&&!U&&(0,P.jsx)(x,{variant:`caption`,sx:{fontFamily:F,fontSize:10,color:a.palette[at?`warning`:`success`][a.palette.mode===`light`?`dark`:`light`],animation:`${We} 2s ease-in-out infinite`},children:at?`Tail window filled · use history for the full record`:`Recent tail · every 2s · up to 50 events per poll`})]}),nt&&(0,P.jsx)(he,{closable:!0,severity:`error`,variant:`outlined`,onClose:()=>H(null),sx:{mb:1,fontFamily:F,fontSize:12},children:nt}),(0,P.jsxs)(_,{sx:{position:`relative`,flex:1,minHeight:320,flexShrink:0,borderRadius:2,overflow:`hidden`,border:`1px solid`,borderColor:`divider`,bgcolor:`background.paper`},children:[(0,P.jsxs)(_,{sx:{display:`flex`,alignItems:`center`,height:32,px:1.5,bgcolor:`action.hover`,borderBottom:`1px solid`,borderColor:`divider`},children:[(0,P.jsx)(be,{sx:{fontSize:16,color:`text.secondary`,mr:1}}),(0,P.jsxs)(x,{variant:`caption`,sx:{fontFamily:F,fontSize:10,color:`text.secondary`,letterSpacing:`0.04em`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[f?`omnitron-daemon`:`omnitron-logs`,g?` — ${g}`:``]})]}),(0,P.jsx)(_,{ref:X,onScroll:gt,sx:{height:`calc(100% - 32px)`,overflowY:`auto`,overflowX:`hidden`,py:.5,"&::-webkit-scrollbar":{width:6},"&::-webkit-scrollbar-track":{bgcolor:`transparent`},"&::-webkit-scrollbar-thumb":{bgcolor:`action.selected`,borderRadius:3,"&:hover":{bgcolor:`text.disabled`}}},children:$e?(0,P.jsx)(w,{spacing:.25,sx:{p:1.5},children:Array.from({length:20},(e,t)=>(0,P.jsx)(Ee,{height:18,sx:{bgcolor:`action.hover`,borderRadius:.5,animationDuration:`${1.5+t%5*.2}s`}},t))}):L.length===0?(0,P.jsxs)(w,{sx:{alignItems:`center`,justifyContent:`center`,height:`100%`,py:8},children:[(0,P.jsx)(be,{sx:{fontSize:40,color:`text.disabled`,mb:1.5}}),(0,P.jsx)(x,{sx:{fontFamily:F,fontSize:12,color:`text.secondary`,textAlign:`center`},children:`No log entries match the current filters.`}),(0,P.jsx)(x,{sx:{fontFamily:F,fontSize:11,color:`text.secondary`,mt:.5},children:bt?`Try adjusting your filters.`:`Waiting for log data...`})]}):(0,P.jsxs)(P.Fragment,{children:[Qe&&!Q&&(0,P.jsx)(w,{sx:{alignItems:`center`,py:1},children:(0,P.jsx)(d,{size:`small`,variant:`text`,onClick:ht,disabled:et,sx:{fontFamily:F,fontSize:10,color:a.palette.info[a.palette.mode===`light`?`dark`:`light`],textTransform:`none`,"&:hover":{bgcolor:l(`#58a6ff`,.08)}},children:et?`Loading...`:`Load older entries (${(Ze-L.length).toLocaleString()} remaining)`})}),L.map(e=>(0,P.jsx)(ke,{log:e,isNew:J.current.has(e.id),nodeNames:fe},e.id))]})}),Q&&!ct&&(0,P.jsxs)(d,{size:`small`,variant:`contained`,onClick:_t,"aria-label":W?`Jump to latest logs, ${W} new entries`:`Jump to latest logs`,"data-console-command":`latest`,startIcon:(0,P.jsx)(pe,{}),sx:{position:`absolute`,bottom:{xs:12,sm:16},right:{xs:12,sm:16},minHeight:{xs:44,sm:36},px:1.5,gap:.75,bgcolor:`background.paper`,color:`primary.main`,border:1,borderColor:`divider`,boxShadow:a.shadows[3],"&:hover":{bgcolor:`action.hover`},"& .MuiButton-startIcon":{mr:.25}},children:[`Latest`,W>0&&(0,P.jsx)(_,{component:`span`,"aria-hidden":`true`,sx:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,minWidth:22,height:22,px:.75,borderRadius:.75,bgcolor:`primary.main`,color:`primary.contrastText`,fontSize:11,fontWeight:600,lineHeight:1,fontVariantNumeric:`tabular-nums`},children:W>999?`999+`:W})]})]})]})}var N,P,F,Re,ze,Be,Ve,He,Ue,We;function I(){return(I=e((()=>{E(),N=t(),o(),f(),v(),T(),ce(),fe(),p(),m(),h(),le(),se(),g(),S(),ne(),s(),u(),ve(),me(),O(),k(),Te(),D(),a(),j(),Oe(),Ae(),Pe(),P=n(),F=`'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace`,Re=[{key:`live`,label:`Live`,minutes:0},{key:`15m`,label:`15m`,minutes:15},{key:`1h`,label:`1h`,minutes:60},{key:`6h`,label:`6h`,minutes:360},{key:`24h`,label:`24h`,minutes:1440},{key:`custom`,label:`Custom`,minutes:-1}],ze=100,Be=2e3,Ve=50,He=300,Ue=80,We=c`
2
2
  0%, 100% { opacity: 1; }
3
3
  50% { opacity: 0.5; }
4
4
  `})))()}I();export{M as default};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{_ as r,c as i,h as a,v as o,x as s,y as c}from"./client-DFnuv2z3.js";import{_t as l,gt as u,ht as d,lt as f,ut as p,vt as m}from"./mui-BXSXx9c9.js";import{B as h,a as ee,o as g,z as _}from"./mui-Cd711nOk.js";import{B as v,U as y,W as b,it as x,l as S,rt as C,u as w,z as T}from"./mui-AnEgAVjz.js";import{_ as E,n as D,t as O,v as k}from"./mui-BwsIrivo.js";import{r as A,t as j}from"./alert-uBG6r9NW.js";import{n as M,t as N}from"./use-polled-resource-B22hhr5L.js";import{a as P,u as te}from"./app-address-BCXfN59F.js";import{G as F,M as I}from"./icons-OboZgWSt.js";import{n as L,t as R}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as z,t as B}from"./metric-chart-M-kI-XOt.js";import{n as V,t as ne}from"./use-stack-context-UkBsF-l7.js";import{a as re,c as H,i as U,n as W,o as G,r as K,s as q,t as J}from"./metric-series-WxePniyw.js";import{n as Y,t as ie}from"./comparison-bars-BtC0dHjF.js";import{n as ae,r as oe}from"./card-DkH32gMY.js";function X(e,t=Date.now()){if(!e)return{severity:`warning`,summary:`Metrics persistence is not reported`,detail:`This daemon cannot report database write confirmation.`};let n=[];e.durability!==`persistent`&&n.push(e.durability===`volatile`?`History is volatile and will be lost on restart`:`Storage durability is unknown`),e.lastError&&n.push(`Write failed: ${e.lastError}`),e.cleanupError&&n.push(`Retention failed: ${e.cleanupError}`),e.syncError&&n.push(`Post-write callback failed: ${e.syncError}`),e.droppedSamples>0&&n.push(`${e.droppedSamples} samples lost before persistence in this process`);let r=e.oldestPendingAt?Date.parse(e.oldestPendingAt):NaN;e.pendingSamples>0&&Number.isFinite(r)&&t-r>=6e4&&n.push(`Database write queue is more than 60s behind`);let i=e.lastWriteAt?`Last completed write ${e.lastWriteAt}`:`No completed write in this process yet`;return{severity:n.length?`warning`:e.lastWriteAt?`success`:`info`,summary:n.length?`Metrics storage needs attention · ${e.type}`:`${e.type} · ${e.lastWriteAt?`database writes confirmed`:`awaiting first write`}`,detail:[...n,`${e.pendingSamples}/${e.capacity} samples awaiting write`,i,`Acknowledgements cover database commit, not backup or replica availability`].join(`. `)}}function se(){let{activeProject:e,activeStack:t}=V(),[n,r]=(0,Z.useState)(`5m`),[i,a]=(0,Z.useState)(!0);return(0,Q.jsx)(ce,{window:n,setWindow:r,autoRefresh:i,setAutoRefresh:a},JSON.stringify([e,t,n]))}function ce({window:e,setWindow:t,autoRefresh:n,setAutoRefresh:a}){let{activeProject:l,activeStack:u,namespacePrefix:d}=V(),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(!1),g=(0,Z.useRef)(null),v=J[e],b=M(()=>o.getStorageStatus(),{intervalMs:1e4,paused:!n}),x=X(b.error?null:b.data),w=M(async()=>{let[e,t]=await Promise.all([i.list(),l?s.getProjectApps({project:l}):Promise.resolve(null)]),n=te(l,u,t,e);return{apps:n,cpu:q(n.map(e=>e.cpu)),memory:q(n.map(e=>e.memory)),at:Date.now()}},{intervalMs:1e4,paused:!n}),D=M(async()=>{let e=Date.now(),t=e-v.duration,[n,r,i]=await Promise.all([o.querySeries({names:[`cpu_percent`,`memory_bytes`],from:t,to:e,interval:v.interval,limit:120}),l?s.listStacks({project:l}):Promise.resolve([]),c.listNodes()]);return{series:n,from:t,to:e,nodeNames:Object.fromEntries(i.map(e=>[e.id,e.name])),scope:l?G(l,u,r,i):void 0}},{intervalMs:1e4,paused:!n}),k=M(async()=>{let e=await r.getIngestionStats(),t=Date.now(),n=g.current,i=n?e.ingestedTotal-n.total:-1,a=n&&t>n.at&&i>=0?i*1e3/(t-n.at):null;return g.current={total:e.ingestedTotal,at:t},a},{intervalMs:1e4,paused:!n}),A=async()=>{h(!0);try{await Promise.all([w.refresh(),D.refresh(),k.refresh(),b.refresh()])}finally{h(!1)}},N=D.data?.from??Date.now()-v.duration,P=D.data?.to??Date.now(),F=e=>re(D.data?.series??[],e,d,f,D.data?.nodeNames??{},v.bucket,D.data?.scope),L=w.data,z=`${v.interval} averages · local time · ${f?`apps and child processes`:`application totals`}`;return(0,Q.jsxs)(E,{spacing:2,sx:{minWidth:0},children:[(0,Q.jsx)(R,{heading:`Metrics`,links:[{name:`Metrics`}],action:(0,Q.jsxs)(E,{direction:`row`,spacing:1,useFlexGap:!0,children:[(0,Q.jsx)(y,{sx:{m:0},control:(0,Q.jsx)(O,{size:`small`,checked:n,onChange:(e,t)=>a(t)}),label:(0,Q.jsx)(_,{variant:`caption`,children:`Live`})}),(0,Q.jsx)(C,{"data-console-command":`refresh`,size:`small`,"aria-label":`Refresh metrics`,disabled:m,onClick:A,children:(0,Q.jsx)(I,{})})]})}),(0,Q.jsxs)(j,{severity:x.severity,variant:`outlined`,sx:{minWidth:0,overflowWrap:`anywhere`},children:[(0,Q.jsx)(_,{variant:`body2`,children:x.summary}),(0,Q.jsxs)(_,{variant:`caption`,children:[x.detail,b.error?`. ${b.error}`:``]})]}),w.error&&(0,Q.jsxs)(j,{severity:`warning`,variant:`outlined`,children:[`Application readings: `,w.error,`.`,` `,L?`Showing the last received values.`:`No readings available.`]}),(0,Q.jsx)(T,{container:!0,spacing:1.5,children:[{label:`Applications`,value:L?`${L.apps.filter(e=>e.status===`online`).length}/${L.apps.length}`:`—`,subtitle:`Online in this selection`},{label:`CPU`,value:K(L?.cpu),subtitle:`Sum across selected apps`},{label:`Resident memory`,value:W(L?.memory),subtitle:`Sum across selected apps`},{label:`Log ingestion`,value:k.error||k.data==null?`—`:`${k.data.toFixed(1)}/s`,subtitle:k.error?`Counter unavailable`:`Daemon · all projects`}].map(e=>(0,Q.jsx)(T,{size:{xs:6,md:3},children:(0,Q.jsx)(ae,{...e,loading:e.label===`Log ingestion`?k.loading:w.loading,color:`primary`,sx:{height:`100%`,"& h4":{fontSize:{xs:22,sm:26},overflowWrap:`anywhere`,fontVariantNumeric:`tabular-nums`}}})},e.label))}),(0,Q.jsxs)(E,{direction:`row`,spacing:1.5,useFlexGap:!0,sx:{flexWrap:`wrap`,alignItems:`center`},children:[(0,Q.jsx)(ee,{select:!0,size:`small`,label:`Time window`,value:e,onChange:e=>t(e.target.value),sx:{minWidth:140},children:Object.entries(J).map(([e,t])=>(0,Q.jsx)(S,{value:e,children:t.label},e))}),(0,Q.jsx)(y,{sx:{m:0},control:(0,Q.jsx)(O,{size:`small`,checked:f,onChange:(e,t)=>p(t)}),label:(0,Q.jsx)(_,{variant:`caption`,children:`Include child processes`})}),(0,Q.jsxs)(_,{variant:`caption`,color:`text.secondary`,sx:{ml:{sm:`auto`}},children:[n?`Every 10 s`:`Paused`,D.data?` · received ${new Date(D.data.to).toLocaleTimeString()}`:``]})]}),(0,Q.jsxs)(T,{container:!0,spacing:2,children:[(0,Q.jsx)(T,{size:{xs:12,lg:6},children:(0,Q.jsx)(B,{title:`CPU`,description:z,lines:F(`cpu_percent`),format:K,from:N,to:P,loading:D.loading,error:D.error})}),(0,Q.jsx)(T,{size:{xs:12,lg:6},children:(0,Q.jsx)(B,{title:`Resident memory`,description:z,lines:F(`memory_bytes`),format:W,from:N,to:P,loading:D.loading,error:D.error})})]}),(0,Q.jsx)(_,{variant:`caption`,color:`text.secondary`,children:`CPU is summed process usage and can exceed 100%. Memory is resident bytes, not a percentage of host capacity. Child processes are shown separately and must not be added to their application totals.`}),(0,Q.jsx)(le,{})]})}function le(){let[e,t]=(0,Z.useState)(!1),n=M(()=>r.getLogStats(),{intervalMs:6e4,enabled:e}),i=n.data?.byLevel??[];return(0,Q.jsxs)(l,{expanded:e,onChange:(e,n)=>t(n),disableGutters:!0,variant:`outlined`,sx:{"&::before":{display:`none`}},children:[(0,Q.jsx)(f,{"aria-controls":`log-store-data`,id:`log-store-toggle`,children:(0,Q.jsxs)(_,{variant:`body2`,children:[e?`−`:`+`,` Log store · all projects`]})}),(0,Q.jsxs)(d,{id:`log-store-data`,children:[(0,Q.jsx)(_,{variant:`caption`,color:`text.secondary`,children:`Cumulative lines by level in this daemon’s log store. Independent of the selected project and time window. Refreshes every minute while expanded.`}),n.error&&(0,Q.jsx)(j,{severity:`warning`,children:n.error}),i.length?(0,Q.jsx)(ie,{label:`Cumulative log lines by level`,items:i.map(({level:e,count:t})=>({id:e,name:e,value:t})),format:e=>e.toLocaleString()}):(0,Q.jsx)(_,{sx:{py:2},variant:`body2`,children:n.loading?`Reading log store…`:`No log totals available`})]})]})}var Z,Q;function $(){return($=e((()=>{Z=t(),m(),u(),p(),b(),v(),x(),w(),k(),D(),g(),h(),A(),oe(),Y(),L(),z(),F(),a(),ne(),N(),P(),U(),Q=n()})))()}$();export{se as default,H as seriesLabel};
1
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{_ as r,c as i,h as a,v as o,x as s,y as c}from"./client-DFnuv2z3.js";import{_t as l,gt as u,ht as d,lt as f,ut as p,vt as m}from"./mui-BXSXx9c9.js";import{B as h,a as ee,o as g,z as _}from"./mui-Cd711nOk.js";import{B as v,U as y,W as b,it as x,l as S,rt as C,u as w,z as T}from"./mui-AnEgAVjz.js";import{_ as E,n as D,t as O,v as k}from"./mui-BwsIrivo.js";import{r as A,t as j}from"./alert-uBG6r9NW.js";import{n as M,t as N}from"./use-polled-resource-B22hhr5L.js";import{a as P,u as te}from"./app-address-BCXfN59F.js";import{G as F,M as I}from"./icons-OboZgWSt.js";import{n as L,t as R}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as z,t as B}from"./metric-chart-M-kI-XOt.js";import{n as V,t as ne}from"./use-stack-context-8yaHaN8L.js";import{a as re,c as H,i as U,n as W,o as G,r as K,s as q,t as J}from"./metric-series-WxePniyw.js";import{n as Y,t as ie}from"./comparison-bars-BtC0dHjF.js";import{n as ae,r as oe}from"./card-DkH32gMY.js";function X(e,t=Date.now()){if(!e)return{severity:`warning`,summary:`Metrics persistence is not reported`,detail:`This daemon cannot report database write confirmation.`};let n=[];e.durability!==`persistent`&&n.push(e.durability===`volatile`?`History is volatile and will be lost on restart`:`Storage durability is unknown`),e.lastError&&n.push(`Write failed: ${e.lastError}`),e.cleanupError&&n.push(`Retention failed: ${e.cleanupError}`),e.syncError&&n.push(`Post-write callback failed: ${e.syncError}`),e.droppedSamples>0&&n.push(`${e.droppedSamples} samples lost before persistence in this process`);let r=e.oldestPendingAt?Date.parse(e.oldestPendingAt):NaN;e.pendingSamples>0&&Number.isFinite(r)&&t-r>=6e4&&n.push(`Database write queue is more than 60s behind`);let i=e.lastWriteAt?`Last completed write ${e.lastWriteAt}`:`No completed write in this process yet`;return{severity:n.length?`warning`:e.lastWriteAt?`success`:`info`,summary:n.length?`Metrics storage needs attention · ${e.type}`:`${e.type} · ${e.lastWriteAt?`database writes confirmed`:`awaiting first write`}`,detail:[...n,`${e.pendingSamples}/${e.capacity} samples awaiting write`,i,`Acknowledgements cover database commit, not backup or replica availability`].join(`. `)}}function se(){let{activeProject:e,activeStack:t}=V(),[n,r]=(0,Z.useState)(`5m`),[i,a]=(0,Z.useState)(!0);return(0,Q.jsx)(ce,{window:n,setWindow:r,autoRefresh:i,setAutoRefresh:a},JSON.stringify([e,t,n]))}function ce({window:e,setWindow:t,autoRefresh:n,setAutoRefresh:a}){let{activeProject:l,activeStack:u,namespacePrefix:d}=V(),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(!1),g=(0,Z.useRef)(null),v=J[e],b=M(()=>o.getStorageStatus(),{intervalMs:1e4,paused:!n}),x=X(b.error?null:b.data),w=M(async()=>{let[e,t]=await Promise.all([i.list(),l?s.getProjectApps({project:l}):Promise.resolve(null)]),n=te(l,u,t,e);return{apps:n,cpu:q(n.map(e=>e.cpu)),memory:q(n.map(e=>e.memory)),at:Date.now()}},{intervalMs:1e4,paused:!n}),D=M(async()=>{let e=Date.now(),t=e-v.duration,[n,r,i]=await Promise.all([o.querySeries({names:[`cpu_percent`,`memory_bytes`],from:t,to:e,interval:v.interval,limit:120}),l?s.listStacks({project:l}):Promise.resolve([]),c.listNodes()]);return{series:n,from:t,to:e,nodeNames:Object.fromEntries(i.map(e=>[e.id,e.name])),scope:l?G(l,u,r,i):void 0}},{intervalMs:1e4,paused:!n}),k=M(async()=>{let e=await r.getIngestionStats(),t=Date.now(),n=g.current,i=n?e.ingestedTotal-n.total:-1,a=n&&t>n.at&&i>=0?i*1e3/(t-n.at):null;return g.current={total:e.ingestedTotal,at:t},a},{intervalMs:1e4,paused:!n}),A=async()=>{h(!0);try{await Promise.all([w.refresh(),D.refresh(),k.refresh(),b.refresh()])}finally{h(!1)}},N=D.data?.from??Date.now()-v.duration,P=D.data?.to??Date.now(),F=e=>re(D.data?.series??[],e,d,f,D.data?.nodeNames??{},v.bucket,D.data?.scope),L=w.data,z=`${v.interval} averages · local time · ${f?`apps and child processes`:`application totals`}`;return(0,Q.jsxs)(E,{spacing:2,sx:{minWidth:0},children:[(0,Q.jsx)(R,{heading:`Metrics`,links:[{name:`Metrics`}],action:(0,Q.jsxs)(E,{direction:`row`,spacing:1,useFlexGap:!0,children:[(0,Q.jsx)(y,{sx:{m:0},control:(0,Q.jsx)(O,{size:`small`,checked:n,onChange:(e,t)=>a(t)}),label:(0,Q.jsx)(_,{variant:`caption`,children:`Live`})}),(0,Q.jsx)(C,{"data-console-command":`refresh`,size:`small`,"aria-label":`Refresh metrics`,disabled:m,onClick:A,children:(0,Q.jsx)(I,{})})]})}),(0,Q.jsxs)(j,{severity:x.severity,variant:`outlined`,sx:{minWidth:0,overflowWrap:`anywhere`},children:[(0,Q.jsx)(_,{variant:`body2`,children:x.summary}),(0,Q.jsxs)(_,{variant:`caption`,children:[x.detail,b.error?`. ${b.error}`:``]})]}),w.error&&(0,Q.jsxs)(j,{severity:`warning`,variant:`outlined`,children:[`Application readings: `,w.error,`.`,` `,L?`Showing the last received values.`:`No readings available.`]}),(0,Q.jsx)(T,{container:!0,spacing:1.5,children:[{label:`Applications`,value:L?`${L.apps.filter(e=>e.status===`online`).length}/${L.apps.length}`:`—`,subtitle:`Online in this selection`},{label:`CPU`,value:K(L?.cpu),subtitle:`Sum across selected apps`},{label:`Resident memory`,value:W(L?.memory),subtitle:`Sum across selected apps`},{label:`Log ingestion`,value:k.error||k.data==null?`—`:`${k.data.toFixed(1)}/s`,subtitle:k.error?`Counter unavailable`:`Daemon · all projects`}].map(e=>(0,Q.jsx)(T,{size:{xs:6,md:3},children:(0,Q.jsx)(ae,{...e,loading:e.label===`Log ingestion`?k.loading:w.loading,color:`primary`,sx:{height:`100%`,"& h4":{fontSize:{xs:22,sm:26},overflowWrap:`anywhere`,fontVariantNumeric:`tabular-nums`}}})},e.label))}),(0,Q.jsxs)(E,{direction:`row`,spacing:1.5,useFlexGap:!0,sx:{flexWrap:`wrap`,alignItems:`center`},children:[(0,Q.jsx)(ee,{select:!0,size:`small`,label:`Time window`,value:e,onChange:e=>t(e.target.value),sx:{minWidth:140},children:Object.entries(J).map(([e,t])=>(0,Q.jsx)(S,{value:e,children:t.label},e))}),(0,Q.jsx)(y,{sx:{m:0},control:(0,Q.jsx)(O,{size:`small`,checked:f,onChange:(e,t)=>p(t)}),label:(0,Q.jsx)(_,{variant:`caption`,children:`Include child processes`})}),(0,Q.jsxs)(_,{variant:`caption`,color:`text.secondary`,sx:{ml:{sm:`auto`}},children:[n?`Every 10 s`:`Paused`,D.data?` · received ${new Date(D.data.to).toLocaleTimeString()}`:``]})]}),(0,Q.jsxs)(T,{container:!0,spacing:2,children:[(0,Q.jsx)(T,{size:{xs:12,lg:6},children:(0,Q.jsx)(B,{title:`CPU`,description:z,lines:F(`cpu_percent`),format:K,from:N,to:P,loading:D.loading,error:D.error})}),(0,Q.jsx)(T,{size:{xs:12,lg:6},children:(0,Q.jsx)(B,{title:`Resident memory`,description:z,lines:F(`memory_bytes`),format:W,from:N,to:P,loading:D.loading,error:D.error})})]}),(0,Q.jsx)(_,{variant:`caption`,color:`text.secondary`,children:`CPU is summed process usage and can exceed 100%. Memory is resident bytes, not a percentage of host capacity. Child processes are shown separately and must not be added to their application totals.`}),(0,Q.jsx)(le,{})]})}function le(){let[e,t]=(0,Z.useState)(!1),n=M(()=>r.getLogStats(),{intervalMs:6e4,enabled:e}),i=n.data?.byLevel??[];return(0,Q.jsxs)(l,{expanded:e,onChange:(e,n)=>t(n),disableGutters:!0,variant:`outlined`,sx:{"&::before":{display:`none`}},children:[(0,Q.jsx)(f,{"aria-controls":`log-store-data`,id:`log-store-toggle`,children:(0,Q.jsxs)(_,{variant:`body2`,children:[e?`−`:`+`,` Log store · all projects`]})}),(0,Q.jsxs)(d,{id:`log-store-data`,children:[(0,Q.jsx)(_,{variant:`caption`,color:`text.secondary`,children:`Cumulative lines by level in this daemon’s log store. Independent of the selected project and time window. Refreshes every minute while expanded.`}),n.error&&(0,Q.jsx)(j,{severity:`warning`,children:n.error}),i.length?(0,Q.jsx)(ie,{label:`Cumulative log lines by level`,items:i.map(({level:e,count:t})=>({id:e,name:e,value:t})),format:e=>e.toLocaleString()}):(0,Q.jsx)(_,{sx:{py:2},variant:`body2`,children:n.loading?`Reading log store…`:`No log totals available`})]})]})}var Z,Q;function $(){return($=e((()=>{Z=t(),m(),u(),p(),b(),v(),x(),w(),k(),D(),g(),h(),A(),oe(),Y(),L(),z(),F(),a(),ne(),N(),P(),U(),Q=n()})))()}$();export{se as default,H as seriesLabel};
@@ -1 +1 @@
1
- import{i as e,n as t}from"./rolldown-runtime-CNOWq4Kh.js";import{i as n}from"./react-BN8qLIAi.js";import{it as r,rt as i}from"./mui-BTN91yBK.js";import{i as a}from"./dayjs.min-DHwAvH5f.js";import{A as o,F as s,H as c,N as l,P as u,R as d,j as f}from"./mui-C_hromOc.js";import{S as p,b as m,w as h,x as g}from"./mui-BIz4LSVs.js";var _;function v(){return(v=t((()=>{_=e=>({components:{MuiLocalizationProvider:{defaultProps:{localeText:a({},e)}}}})})))()}var y,b;function x(){return(x=t((()=>{v(),y={previousMonth:`Previous month`,nextMonth:`Next month`,openPreviousView:`Open previous view`,openNextView:`Open next view`,calendarViewSwitchingButtonAriaLabel:e=>e===`year`?`year view is open, switch to calendar view`:`calendar view is open, switch to year view`,start:`Start`,end:`End`,startDate:`Start date`,startTime:`Start time`,endDate:`End date`,endTime:`End time`,cancelButtonLabel:`Cancel`,clearButtonLabel:`Clear`,okButtonLabel:`OK`,todayButtonLabel:`Today`,nextStepButtonLabel:`Next`,datePickerToolbarTitle:`Select date`,dateTimePickerToolbarTitle:`Select date & time`,timePickerToolbarTitle:`Select time`,dateRangePickerToolbarTitle:`Select date range`,timeRangePickerToolbarTitle:`Select time range`,clockLabelText:(e,t)=>`Select ${e}. ${t?`Selected time is ${t}`:`No time selected`}`,hoursClockNumberText:e=>`${e} ${Number(e)===1?`hour`:`hours`}`,minutesClockNumberText:e=>`${e} ${Number(e)===1?`minute`:`minutes`}`,secondsClockNumberText:e=>`${e} ${Number(e)===1?`second`:`seconds`}`,selectViewText:e=>`Select ${e}`,calendarWeekNumberHeaderLabel:`Week number`,calendarWeekNumberHeaderText:`#`,calendarWeekNumberAriaLabelText:e=>`Week ${e}`,calendarWeekNumberText:e=>`${e}`,openDatePickerDialogue:e=>e?`Choose date, selected date is ${e}`:`Choose date`,openTimePickerDialogue:e=>e?`Choose time, selected time is ${e}`:`Choose time`,openRangePickerDialogue:e=>e?`Choose range, selected range is ${e}`:`Choose range`,fieldClearLabel:`Clear`,timeTableLabel:`pick time`,dateTableLabel:`pick date`,fieldYearPlaceholder:e=>`Y`.repeat(e.digitAmount),fieldMonthPlaceholder:e=>e.contentType===`letter`?`MMMM`:`MM`,fieldDayPlaceholder:()=>`DD`,fieldWeekDayPlaceholder:e=>e.contentType===`letter`?`EEEE`:`EE`,fieldHoursPlaceholder:()=>`hh`,fieldMinutesPlaceholder:()=>`mm`,fieldSecondsPlaceholder:()=>`ss`,fieldMeridiemPlaceholder:()=>`aa`,year:`Year`,month:`Month`,day:`Day`,weekDay:`Week day`,hours:`Hours`,minutes:`Minutes`,seconds:`Seconds`,meridiem:`Meridiem`,empty:`Empty`},b=y,_(y)})))()}var S,C,w,T,E;function D(){return(D=t((()=>{S=[`disablePast`,`disableFuture`,`minDate`,`maxDate`,`shouldDisableDate`,`shouldDisableMonth`,`shouldDisableYear`],C=[`disablePast`,`disableFuture`,`minTime`,`maxTime`,`shouldDisableTime`,`minutesStep`,`ampm`,`disableIgnoringDatePartForTimeValidation`],w=[`minDateTime`,`maxDateTime`],T=[...S,...C,...w],E=e=>T.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})})))()}var O;function k(){return(k=t((()=>{l(),O=({props:e,value:t,timezone:n,adapter:r})=>{if(t===null)return null;let{shouldDisableDate:i,shouldDisableMonth:a,shouldDisableYear:o,disablePast:s,disableFuture:c,minDate:l,maxDate:u}=e,d=r.date(void 0,n);switch(!0){case!r.isValid(t):return`invalidDate`;case!!(i&&i(t)):return`shouldDisableDate`;case!!(a&&a(t)):return`shouldDisableMonth`;case!!(o&&o(t)):return`shouldDisableYear`;case!!(c&&r.isAfterDay(t,d)):return`disableFuture`;case!!(s&&r.isBeforeDay(t,d)):return`disablePast`;case!!(l&&r.isBeforeDay(t,l)):return`minDate`;case!!(u&&r.isAfterDay(t,u)):return`maxDate`;default:return null}},O.valueManager=s})))()}function A(e){let{props:t,validator:n,value:i,timezone:a,onError:o}=e,s=h(),c=j.useRef(n.valueManager.defaultErrorState),l=n({adapter:s,value:i,timezone:a,props:t}),u=n.valueManager.hasError(l);return j.useEffect(()=>{o&&!n.valueManager.isSameError(l,c.current)&&o(l,i),c.current=l},[n,o,l,i]),{validationError:l,hasValidationError:u,getValidationErrorForNewValue:r(e=>n({adapter:s,value:e,timezone:a,props:t}))}}var j;function M(){return(M=t((()=>{j=e(n(),1),i(),p()})))()}function N(){return L.useMemo(()=>({valueType:`date`,validator:O,internal_valueManager:s,internal_fieldValueManager:u,internal_useApplyDefaultValuesToFieldInternalProps:F,internal_useOpenPickerButtonAriaLabel:P}),[])}function P(e){let t=h(),n=g();return L.useMemo(()=>{let r=t.isValid(e)?t.format(e,`fullDate`):null;return n.openDatePickerDialogue(r)},[e,n,t])}function F(e){let t=h(),n=I(e);return L.useMemo(()=>a({},e,n,{format:e.format??t.formats.keyboardDate}),[e,n,t])}function I(e){let t=h(),n=f();return L.useMemo(()=>({disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,minDate:d(t,e.minDate,n.minDate),maxDate:d(t,e.maxDate,n.maxDate)}),[e.minDate,e.maxDate,e.disableFuture,e.disablePast,t,n])}var L;function R(){return(R=t((()=>{L=e(n(),1),c(),l(),k(),o(),p(),m()})))()}export{A as a,w as c,E as d,D as f,M as i,S as l,x as m,I as n,k as o,b as p,N as r,O as s,R as t,C as u};
1
+ import{i as e,n as t}from"./rolldown-runtime-CNOWq4Kh.js";import{i as n}from"./react-BN8qLIAi.js";import{it as r,rt as i}from"./mui-BTN91yBK.js";import{i as a}from"./dayjs.min-DHwAvH5f.js";import{A as o,F as s,H as c,N as l,P as u,R as d,j as f}from"./mui-D5m7fDCh.js";import{S as p,b as m,w as h,x as g}from"./mui-Db5J-QUd.js";var _;function v(){return(v=t((()=>{_=e=>({components:{MuiLocalizationProvider:{defaultProps:{localeText:a({},e)}}}})})))()}var y,b;function x(){return(x=t((()=>{v(),y={previousMonth:`Previous month`,nextMonth:`Next month`,openPreviousView:`Open previous view`,openNextView:`Open next view`,calendarViewSwitchingButtonAriaLabel:e=>e===`year`?`year view is open, switch to calendar view`:`calendar view is open, switch to year view`,start:`Start`,end:`End`,startDate:`Start date`,startTime:`Start time`,endDate:`End date`,endTime:`End time`,cancelButtonLabel:`Cancel`,clearButtonLabel:`Clear`,okButtonLabel:`OK`,todayButtonLabel:`Today`,nextStepButtonLabel:`Next`,datePickerToolbarTitle:`Select date`,dateTimePickerToolbarTitle:`Select date & time`,timePickerToolbarTitle:`Select time`,dateRangePickerToolbarTitle:`Select date range`,timeRangePickerToolbarTitle:`Select time range`,clockLabelText:(e,t)=>`Select ${e}. ${t?`Selected time is ${t}`:`No time selected`}`,hoursClockNumberText:e=>`${e} ${Number(e)===1?`hour`:`hours`}`,minutesClockNumberText:e=>`${e} ${Number(e)===1?`minute`:`minutes`}`,secondsClockNumberText:e=>`${e} ${Number(e)===1?`second`:`seconds`}`,selectViewText:e=>`Select ${e}`,calendarWeekNumberHeaderLabel:`Week number`,calendarWeekNumberHeaderText:`#`,calendarWeekNumberAriaLabelText:e=>`Week ${e}`,calendarWeekNumberText:e=>`${e}`,openDatePickerDialogue:e=>e?`Choose date, selected date is ${e}`:`Choose date`,openTimePickerDialogue:e=>e?`Choose time, selected time is ${e}`:`Choose time`,openRangePickerDialogue:e=>e?`Choose range, selected range is ${e}`:`Choose range`,fieldClearLabel:`Clear`,timeTableLabel:`pick time`,dateTableLabel:`pick date`,fieldYearPlaceholder:e=>`Y`.repeat(e.digitAmount),fieldMonthPlaceholder:e=>e.contentType===`letter`?`MMMM`:`MM`,fieldDayPlaceholder:()=>`DD`,fieldWeekDayPlaceholder:e=>e.contentType===`letter`?`EEEE`:`EE`,fieldHoursPlaceholder:()=>`hh`,fieldMinutesPlaceholder:()=>`mm`,fieldSecondsPlaceholder:()=>`ss`,fieldMeridiemPlaceholder:()=>`aa`,year:`Year`,month:`Month`,day:`Day`,weekDay:`Week day`,hours:`Hours`,minutes:`Minutes`,seconds:`Seconds`,meridiem:`Meridiem`,empty:`Empty`},b=y,_(y)})))()}var S,C,w,T,E;function D(){return(D=t((()=>{S=[`disablePast`,`disableFuture`,`minDate`,`maxDate`,`shouldDisableDate`,`shouldDisableMonth`,`shouldDisableYear`],C=[`disablePast`,`disableFuture`,`minTime`,`maxTime`,`shouldDisableTime`,`minutesStep`,`ampm`,`disableIgnoringDatePartForTimeValidation`],w=[`minDateTime`,`maxDateTime`],T=[...S,...C,...w],E=e=>T.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})})))()}var O;function k(){return(k=t((()=>{l(),O=({props:e,value:t,timezone:n,adapter:r})=>{if(t===null)return null;let{shouldDisableDate:i,shouldDisableMonth:a,shouldDisableYear:o,disablePast:s,disableFuture:c,minDate:l,maxDate:u}=e,d=r.date(void 0,n);switch(!0){case!r.isValid(t):return`invalidDate`;case!!(i&&i(t)):return`shouldDisableDate`;case!!(a&&a(t)):return`shouldDisableMonth`;case!!(o&&o(t)):return`shouldDisableYear`;case!!(c&&r.isAfterDay(t,d)):return`disableFuture`;case!!(s&&r.isBeforeDay(t,d)):return`disablePast`;case!!(l&&r.isBeforeDay(t,l)):return`minDate`;case!!(u&&r.isAfterDay(t,u)):return`maxDate`;default:return null}},O.valueManager=s})))()}function A(e){let{props:t,validator:n,value:i,timezone:a,onError:o}=e,s=h(),c=j.useRef(n.valueManager.defaultErrorState),l=n({adapter:s,value:i,timezone:a,props:t}),u=n.valueManager.hasError(l);return j.useEffect(()=>{o&&!n.valueManager.isSameError(l,c.current)&&o(l,i),c.current=l},[n,o,l,i]),{validationError:l,hasValidationError:u,getValidationErrorForNewValue:r(e=>n({adapter:s,value:e,timezone:a,props:t}))}}var j;function M(){return(M=t((()=>{j=e(n(),1),i(),p()})))()}function N(){return L.useMemo(()=>({valueType:`date`,validator:O,internal_valueManager:s,internal_fieldValueManager:u,internal_useApplyDefaultValuesToFieldInternalProps:F,internal_useOpenPickerButtonAriaLabel:P}),[])}function P(e){let t=h(),n=g();return L.useMemo(()=>{let r=t.isValid(e)?t.format(e,`fullDate`):null;return n.openDatePickerDialogue(r)},[e,n,t])}function F(e){let t=h(),n=I(e);return L.useMemo(()=>a({},e,n,{format:e.format??t.formats.keyboardDate}),[e,n,t])}function I(e){let t=h(),n=f();return L.useMemo(()=>({disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,minDate:d(t,e.minDate,n.minDate),maxDate:d(t,e.maxDate,n.maxDate)}),[e.minDate,e.maxDate,e.disableFuture,e.disablePast,t,n])}var L;function R(){return(R=t((()=>{L=e(n(),1),c(),l(),k(),o(),p(),m()})))()}export{A as a,w as c,E as d,D as f,M as i,S as l,x as m,I as n,k as o,b as p,N as r,O as s,R as t,C as u};