@omnitron-dev/omnitron 0.3.3 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +296 -6
- package/bin/{pnpmfile-sdk.mjs → pnpmfile-sdk.js} +19 -1
- package/bin/sdk.d.ts +19 -0
- package/bin/sdk.js +932 -0
- package/dist/BUILD.json +2 -2
- package/dist/cli/omnitron.js +68 -20
- package/dist/cli/omnitron.js.map +1 -1
- package/dist/commands/infra.d.ts +8 -2
- package/dist/commands/infra.d.ts.map +1 -1
- package/dist/commands/infra.js +52 -59
- package/dist/commands/infra.js.map +1 -1
- package/dist/commands/node.d.ts.map +1 -1
- package/dist/commands/node.js +8 -1
- package/dist/commands/node.js.map +1 -1
- package/dist/commands/release-store.d.ts.map +1 -1
- package/dist/commands/release-store.js +6 -9
- package/dist/commands/release-store.js.map +1 -1
- package/dist/commands/release.d.ts +4 -1
- package/dist/commands/release.d.ts.map +1 -1
- package/dist/commands/release.js +125 -5
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/stack.d.ts +3 -6
- package/dist/commands/stack.d.ts.map +1 -1
- package/dist/commands/stack.js +51 -9
- package/dist/commands/stack.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +1 -0
- package/dist/commands/status.js.map +1 -1
- package/dist/config/saved.d.ts +3 -0
- package/dist/config/saved.d.ts.map +1 -1
- package/dist/config/saved.js +1 -0
- package/dist/config/saved.js.map +1 -1
- package/dist/config/types.d.ts +4 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/daemon/daemon-client.d.ts +3 -15
- package/dist/daemon/daemon-client.d.ts.map +1 -1
- package/dist/daemon/daemon-client.js +4 -0
- package/dist/daemon/daemon-client.js.map +1 -1
- package/dist/daemon/daemon.d.ts +5 -11
- package/dist/daemon/daemon.d.ts.map +1 -1
- package/dist/daemon/daemon.js +58 -48
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/daemon.rpc-service.d.ts +3 -41
- package/dist/daemon/daemon.rpc-service.d.ts.map +1 -1
- package/dist/daemon/daemon.rpc-service.js +50 -117
- package/dist/daemon/daemon.rpc-service.js.map +1 -1
- package/dist/daemon/darwin-owner-evidence.js +1 -1
- package/dist/daemon/darwin-owner-evidence.js.map +1 -1
- package/dist/daemon/execution-capabilities.d.ts +1 -1
- package/dist/daemon/execution-capabilities.d.ts.map +1 -1
- package/dist/daemon/execution-capabilities.js +3 -3
- package/dist/daemon/execution-capabilities.js.map +1 -1
- package/dist/daemon/execution-client.d.ts +5 -1
- package/dist/daemon/execution-client.d.ts.map +1 -1
- package/dist/daemon/execution-client.js +45 -19
- package/dist/daemon/execution-client.js.map +1 -1
- package/dist/daemon/execution-host.d.ts +4 -11
- package/dist/daemon/execution-host.d.ts.map +1 -1
- package/dist/daemon/execution-host.js +3 -9
- package/dist/daemon/execution-host.js.map +1 -1
- package/dist/daemon/execution-owner.d.ts.map +1 -1
- package/dist/daemon/execution-owner.js +2 -16
- package/dist/daemon/execution-owner.js.map +1 -1
- package/dist/daemon/execution-shutdown.d.ts +1 -1
- package/dist/daemon/execution-shutdown.d.ts.map +1 -1
- package/dist/daemon/managed-owner-build.d.ts +4 -0
- package/dist/daemon/managed-owner-build.d.ts.map +1 -1
- package/dist/daemon/managed-owner-build.js +14 -2
- package/dist/daemon/managed-owner-build.js.map +1 -1
- package/dist/daemon/managed-runtime.js +1 -1
- package/dist/daemon/managed-runtime.js.map +1 -1
- package/dist/daemon/owner-reconciliation.d.ts.map +1 -1
- package/dist/daemon/owner-reconciliation.js +1 -2
- package/dist/daemon/owner-reconciliation.js.map +1 -1
- package/dist/daemon/startup-config.d.ts +1 -0
- package/dist/daemon/startup-config.d.ts.map +1 -1
- package/dist/daemon/system-guardian-cgroup.js +1 -1
- package/dist/daemon/system-guardian-cgroup.js.map +1 -1
- package/dist/infrastructure/container-runtime.d.ts +8 -0
- package/dist/infrastructure/container-runtime.d.ts.map +1 -1
- package/dist/infrastructure/container-runtime.js +5 -0
- package/dist/infrastructure/container-runtime.js.map +1 -1
- package/dist/infrastructure/existing-containers.d.ts +25 -0
- package/dist/infrastructure/existing-containers.d.ts.map +1 -0
- package/dist/infrastructure/existing-containers.js +183 -0
- package/dist/infrastructure/existing-containers.js.map +1 -0
- package/dist/infrastructure/infrastructure.service.d.ts +19 -1
- package/dist/infrastructure/infrastructure.service.d.ts.map +1 -1
- package/dist/infrastructure/infrastructure.service.js +136 -17
- package/dist/infrastructure/infrastructure.service.js.map +1 -1
- package/dist/infrastructure/presets/postgres.js +1 -1
- package/dist/infrastructure/presets/postgres.js.map +1 -1
- package/dist/infrastructure/presets/registry.d.ts.map +1 -1
- package/dist/infrastructure/presets/registry.js +11 -19
- package/dist/infrastructure/presets/registry.js.map +1 -1
- package/dist/infrastructure/stack-infra-manager.d.ts +11 -1
- package/dist/infrastructure/stack-infra-manager.d.ts.map +1 -1
- package/dist/infrastructure/stack-infra-manager.js +79 -8
- package/dist/infrastructure/stack-infra-manager.js.map +1 -1
- package/dist/mcp/tool-groups/infra.tools.d.ts.map +1 -1
- package/dist/mcp/tool-groups/infra.tools.js +4 -1
- package/dist/mcp/tool-groups/infra.tools.js.map +1 -1
- package/dist/monitoring/log-journal.d.ts.map +1 -1
- package/dist/monitoring/log-journal.js +1 -2
- package/dist/monitoring/log-journal.js.map +1 -1
- package/dist/operations.d.ts +1 -0
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +1 -0
- package/dist/operations.js.map +1 -1
- package/dist/orchestrator/app-name.d.ts +33 -0
- package/dist/orchestrator/app-name.d.ts.map +1 -0
- package/dist/orchestrator/app-name.js +68 -0
- package/dist/orchestrator/app-name.js.map +1 -0
- package/dist/orchestrator/bootstrap-loader.d.ts +2 -0
- package/dist/orchestrator/bootstrap-loader.d.ts.map +1 -1
- package/dist/orchestrator/bootstrap-loader.js +2 -1
- package/dist/orchestrator/bootstrap-loader.js.map +1 -1
- package/dist/orchestrator/classic-launcher.d.ts.map +1 -1
- package/dist/orchestrator/classic-launcher.js +2 -1
- package/dist/orchestrator/classic-launcher.js.map +1 -1
- package/dist/orchestrator/execution-contract.d.ts +2 -3
- package/dist/orchestrator/execution-contract.d.ts.map +1 -1
- package/dist/orchestrator/file-watcher.d.ts +11 -23
- package/dist/orchestrator/file-watcher.d.ts.map +1 -1
- package/dist/orchestrator/file-watcher.js +57 -42
- package/dist/orchestrator/file-watcher.js.map +1 -1
- package/dist/orchestrator/orchestrator.service.d.ts +11 -31
- package/dist/orchestrator/orchestrator.service.d.ts.map +1 -1
- package/dist/orchestrator/orchestrator.service.js +127 -109
- package/dist/orchestrator/orchestrator.service.js.map +1 -1
- package/dist/project/bootstrap-metadata.d.ts +1 -1
- package/dist/project/bootstrap-metadata.d.ts.map +1 -1
- package/dist/project/bootstrap-metadata.js +3 -2
- package/dist/project/bootstrap-metadata.js.map +1 -1
- package/dist/project/node-stack-stop.d.ts +2 -1
- package/dist/project/node-stack-stop.d.ts.map +1 -1
- package/dist/project/node-stack-stop.js +5 -1
- package/dist/project/node-stack-stop.js.map +1 -1
- package/dist/project/stack-diagnosis.d.ts.map +1 -1
- package/dist/project/stack-diagnosis.js +2 -3
- package/dist/project/stack-diagnosis.js.map +1 -1
- package/dist/release/artifact-store.d.ts +42 -7
- package/dist/release/artifact-store.d.ts.map +1 -1
- package/dist/release/artifact-store.js +176 -62
- package/dist/release/artifact-store.js.map +1 -1
- package/dist/release/closure-library-path.d.ts +8 -2
- package/dist/release/closure-library-path.d.ts.map +1 -1
- package/dist/release/closure-library-path.js +72 -28
- package/dist/release/closure-library-path.js.map +1 -1
- package/dist/release/configured-store.d.ts +6 -0
- package/dist/release/configured-store.d.ts.map +1 -0
- package/dist/release/configured-store.js +54 -0
- package/dist/release/configured-store.js.map +1 -0
- package/dist/release/load.d.ts +3 -0
- package/dist/release/load.d.ts.map +1 -1
- package/dist/release/load.js +8 -2
- package/dist/release/load.js.map +1 -1
- package/dist/release/local-installation.d.ts +2 -0
- package/dist/release/local-installation.d.ts.map +1 -1
- package/dist/release/local-installation.js +1 -1
- package/dist/release/local-installation.js.map +1 -1
- package/dist/release/portable-archive.d.ts +3 -0
- package/dist/release/portable-archive.d.ts.map +1 -1
- package/dist/release/portable-archive.js +13 -7
- package/dist/release/portable-archive.js.map +1 -1
- package/dist/release/registry-framework.d.ts +25 -0
- package/dist/release/registry-framework.d.ts.map +1 -1
- package/dist/release/registry-framework.js +51 -3
- package/dist/release/registry-framework.js.map +1 -1
- package/dist/release/target-runtime.d.ts +4 -0
- package/dist/release/target-runtime.d.ts.map +1 -1
- package/dist/release/target-runtime.js +9 -0
- package/dist/release/target-runtime.js.map +1 -1
- package/dist/services/host-upgrade.d.ts +2 -0
- package/dist/services/host-upgrade.d.ts.map +1 -1
- package/dist/services/host-upgrade.js +6 -2
- package/dist/services/host-upgrade.js.map +1 -1
- package/dist/services/infrastructure.rpc-service.d.ts +14 -2
- package/dist/services/infrastructure.rpc-service.d.ts.map +1 -1
- package/dist/services/infrastructure.rpc-service.js +128 -17
- package/dist/services/infrastructure.rpc-service.js.map +1 -1
- package/dist/services/kernel-rollout.service.d.ts.map +1 -1
- package/dist/services/kernel-rollout.service.js +1 -2
- package/dist/services/kernel-rollout.service.js.map +1 -1
- package/dist/services/migration-process.d.ts +1 -0
- package/dist/services/migration-process.d.ts.map +1 -1
- package/dist/services/migration-process.js +4 -2
- package/dist/services/migration-process.js.map +1 -1
- package/dist/services/node-deploy-lease.d.ts +4 -1
- package/dist/services/node-deploy-lease.d.ts.map +1 -1
- package/dist/services/node-deploy-lease.js +29 -4
- package/dist/services/node-deploy-lease.js.map +1 -1
- package/dist/services/node-manager.service.d.ts +5 -25
- package/dist/services/node-manager.service.d.ts.map +1 -1
- package/dist/services/node-manager.service.js +150 -139
- package/dist/services/node-manager.service.js.map +1 -1
- package/dist/services/pipeline-definition.d.ts.map +1 -1
- package/dist/services/pipeline-definition.js +32 -6
- package/dist/services/pipeline-definition.js.map +1 -1
- package/dist/services/pipeline.service.d.ts +7 -1
- package/dist/services/pipeline.service.d.ts.map +1 -1
- package/dist/services/pipeline.service.js +106 -13
- package/dist/services/pipeline.service.js.map +1 -1
- package/dist/services/project.rpc-service.d.ts +6 -5
- package/dist/services/project.rpc-service.d.ts.map +1 -1
- package/dist/services/project.rpc-service.js +13 -0
- package/dist/services/project.rpc-service.js.map +1 -1
- package/dist/services/project.service.d.ts +30 -6
- package/dist/services/project.service.d.ts.map +1 -1
- package/dist/services/project.service.js +414 -66
- package/dist/services/project.service.js.map +1 -1
- package/dist/services/release.rpc-service.d.ts +2 -1
- package/dist/services/release.rpc-service.d.ts.map +1 -1
- package/dist/services/release.rpc-service.js +19 -3
- package/dist/services/release.rpc-service.js.map +1 -1
- package/dist/services/release.service.d.ts +24 -11
- package/dist/services/release.service.d.ts.map +1 -1
- package/dist/services/release.service.js +162 -39
- package/dist/services/release.service.js.map +1 -1
- package/dist/services/remote-deployer.service.d.ts +1 -1
- package/dist/services/remote-deployer.service.d.ts.map +1 -1
- package/dist/services/remote-deployer.service.js +3 -0
- package/dist/services/remote-deployer.service.js.map +1 -1
- package/dist/services/secrets.service.d.ts +6 -0
- package/dist/services/secrets.service.d.ts.map +1 -1
- package/dist/services/secrets.service.js +95 -51
- package/dist/services/secrets.service.js.map +1 -1
- package/dist/shared/dto/backend.d.ts +3 -0
- package/dist/shared/dto/backend.d.ts.map +1 -1
- package/dist/shared/dto/backend.js.map +1 -1
- package/dist/shared/dto/nodes.d.ts +2 -0
- package/dist/shared/dto/nodes.d.ts.map +1 -1
- package/dist/shared/dto/pipelines.d.ts +54 -5
- package/dist/shared/dto/pipelines.d.ts.map +1 -1
- package/dist/shared/dto/pipelines.js +0 -7
- package/dist/shared/dto/pipelines.js.map +1 -1
- package/dist/shared/dto/project.d.ts +61 -1
- package/dist/shared/dto/project.d.ts.map +1 -1
- package/dist/shared/dto/releases.d.ts +8 -1
- package/dist/shared/dto/releases.d.ts.map +1 -1
- package/dist/shared/dto/services.d.ts +44 -18
- package/dist/shared/dto/services.d.ts.map +1 -1
- package/dist/shared/dto/services.js.map +1 -1
- package/dist/shared/release-reading.d.ts +6 -0
- package/dist/shared/release-reading.d.ts.map +1 -1
- package/dist/shared/release-reading.js +42 -0
- package/dist/shared/release-reading.js.map +1 -1
- package/dist/workers/system-worker-manager.d.ts +1 -2
- package/dist/workers/system-worker-manager.d.ts.map +1 -1
- package/dist/workers/system-worker-manager.js +5 -3
- package/dist/workers/system-worker-manager.js.map +1 -1
- package/package.json +20 -19
- package/webapp/dist/BUILD.json +2 -2
- package/webapp/dist/assets/{access-jWkHxGc7.js → access-B2gXuoMG.js} +1 -1
- package/webapp/dist/assets/{access-48hkC2-P.js → access-I0f72P9m.js} +1 -1
- package/webapp/dist/assets/{admin-data-table-BKSDI8sU.js → admin-data-table-CAEL2f-m.js} +1 -1
- package/webapp/dist/assets/{alert-uBG6r9NW.js → alert-BdJ2uaY0.js} +1 -1
- package/webapp/dist/assets/{alerts-CuPQ9YQJ.js → alerts-DeVkMXWo.js} +1 -1
- package/webapp/dist/assets/{apps-Drio028B.js → apps-9SuDvyGQ.js} +1 -1
- package/webapp/dist/assets/{audit-npSFJECe.js → audit-DT8cY7Ys.js} +1 -1
- package/webapp/dist/assets/backend-status.store-BbBE9cn8.js +4 -0
- package/webapp/dist/assets/{card-DkH32gMY.js → card-DaUEmUI5.js} +1 -1
- package/webapp/dist/assets/{chart-BpGXlCJc.js → chart-BKXP2ter.js} +1 -1
- package/webapp/dist/assets/{client-DFnuv2z3.js → client-CgyTwq9g.js} +1 -1
- package/webapp/dist/assets/{code-editor-DK6Tmmxv.js → code-editor-JVuQ4m-z.js} +1 -1
- package/webapp/dist/assets/{comparison-bars-BtC0dHjF.js → comparison-bars-Ds5Dt1oj.js} +1 -1
- package/webapp/dist/assets/{confirm-dialog-BbGsAz7_.js → confirm-dialog-BayExVbF.js} +1 -1
- package/webapp/dist/assets/{console-keyboard-D3YCA0yU.js → console-keyboard-uSLt92dB.js} +1 -1
- package/webapp/dist/assets/{containers-Bl8gAyZX.js → containers-DkXTgcrY.js} +1 -1
- package/webapp/dist/assets/{controls-C5W8gHU4.js → controls-CqeGPnaF.js} +1 -1
- package/webapp/dist/assets/{dashboard-UHlet3H9.js → dashboard-By5yPuOf.js} +1 -1
- package/webapp/dist/assets/{dashboard-builder-67PZFqhE.js → dashboard-builder-C0hvBwkd.js} +1 -1
- package/webapp/dist/assets/deploy-progress-B39cvvCE.js +1 -0
- package/webapp/dist/assets/deploy-release-dialog-CnzaO_xL.js +1 -0
- package/webapp/dist/assets/deployments-BXP943hA.js +1 -0
- package/webapp/dist/assets/{detail-B4TiBfxU.js → detail-B84RgiOb.js} +1 -1
- package/webapp/dist/assets/{detail-CYS81K6Y.js → detail-CVXDks9-.js} +1 -1
- package/webapp/dist/assets/detail-D9DixtaK.js +2 -0
- package/webapp/dist/assets/{empty-content-7jOFhG4C.js → empty-content-eyDOuOVp.js} +1 -1
- package/webapp/dist/assets/{error-boundary-CLLI8PWw.js → error-boundary-CQmDr_HS.js} +1 -1
- package/webapp/dist/assets/{event-fields-CiyqrRO8.js → event-fields-C7p2a2HY.js} +1 -1
- package/webapp/dist/assets/{files-DigwXndm.js → files-BsfGT3t6.js} +2 -2
- package/webapp/dist/assets/{icons-OboZgWSt.js → icons-B9Ct8PJ9.js} +1 -1
- package/webapp/dist/assets/index-BEfv96EF.js +1 -0
- package/webapp/dist/assets/{label-B1SF0RTL.js → label-avMhe08g.js} +1 -1
- package/webapp/dist/assets/{log-level-filter-Bcn31D1F.js → log-level-filter-oaUGdbpk.js} +1 -1
- package/webapp/dist/assets/{logs-BqHOufk8.js → logs-iC1OEDv3.js} +1 -1
- package/webapp/dist/assets/{metric-chart-M-kI-XOt.js → metric-chart-CSa_qv4F.js} +1 -1
- package/webapp/dist/assets/{metrics-QIQaF7iS.js → metrics-CKCmcGKw.js} +1 -1
- package/webapp/dist/assets/{mui-Cd711nOk.js → mui-B3fJdIMc.js} +1 -1
- package/webapp/dist/assets/{mui-CdB_p2lt.js → mui-Bdr6Ks5j.js} +1 -1
- package/webapp/dist/assets/{mui-BIz4LSVs.js → mui-CADnFGCx.js} +1 -1
- package/webapp/dist/assets/{mui-AnEgAVjz.js → mui-CMWGTMXv.js} +1 -1
- package/webapp/dist/assets/{mui-DyT2n1lx.js → mui-CN3dT7bb.js} +1 -1
- package/webapp/dist/assets/{mui-BwsIrivo.js → mui-CPEkFAPo.js} +1 -1
- package/webapp/dist/assets/{mui-B1jrje6Z.js → mui-D3qAWvfZ.js} +1 -1
- package/webapp/dist/assets/{mui-C_hromOc.js → mui-D7tBU80e.js} +1 -1
- package/webapp/dist/assets/{mui-y44PQOfG.js → mui-DaJavAoc.js} +1 -1
- package/webapp/dist/assets/{mui-BXSXx9c9.js → mui-SNRRJ_vi.js} +1 -1
- package/webapp/dist/assets/{nodes-BJPk02vv.js → nodes-DtLyXH0V.js} +1 -1
- package/webapp/dist/assets/{operation-status-Bm1x1wTz.js → operation-status-DHyYOT7G.js} +1 -1
- package/webapp/dist/assets/{page-breadcrumbs-fR7Jmpp4.js → page-breadcrumbs-3R8RZ3nA.js} +1 -1
- package/webapp/dist/assets/pipelines-Do2NAAqK.js +3 -0
- package/webapp/dist/assets/project.store-D5IR3fo9.js +1 -0
- package/webapp/dist/assets/{projects-YoBzcQ24.js → projects-BqlGbzeG.js} +1 -1
- package/webapp/dist/assets/{realtime.store-CBDO4Abj.js → realtime.store-C8D235-B.js} +1 -1
- package/webapp/dist/assets/release-bits-IehuBssK.js +1 -0
- package/webapp/dist/assets/release-build-panel-C48hP_9w.js +1 -0
- package/webapp/dist/assets/release-deployment-state-BfmxZP4Y.js +1 -0
- package/webapp/dist/assets/releases-Cm0RV5Xu.js +2 -0
- package/webapp/dist/assets/{search-input-C0MHI8vO.js → search-input-SWD1dXxD.js} +1 -1
- package/webapp/dist/assets/settings-DwuEPQGg.js +1 -0
- package/webapp/dist/assets/sign-in-CQ-WeS5A.js +1 -0
- package/webapp/dist/assets/{skeleton-BmWDJWF9.js → skeleton-BnVxAoeX.js} +1 -1
- package/webapp/dist/assets/{snackbar-DSPmjMyi.js → snackbar-CRX6eqRT.js} +1 -1
- package/webapp/dist/assets/{stack-health-status-BIv2C10x.js → stack-health-status-DfErRNb1.js} +1 -1
- package/webapp/dist/assets/{stack-start-notice-BVnMOwRQ.js → stack-start-notice-NkYDjR-f.js} +1 -1
- package/webapp/dist/assets/{stacks-IZ1mfizi.js → stacks-BOGCfW90.js} +1 -1
- package/webapp/dist/assets/{store-bqUBn2A4.js → store-DtTtbc9H.js} +1 -1
- package/webapp/dist/assets/{system-info-BFKNM-hf.js → system-info-Cw-xywgI.js} +1 -1
- package/webapp/dist/assets/{table-BOWT6Y9d.js → table-D-so_B1p.js} +1 -1
- package/webapp/dist/assets/{table-viewport-Bp4pq-c_.js → table-viewport-DdZ1yAKm.js} +1 -1
- package/webapp/dist/assets/{tabs-k5NPGLnJ.js → tabs-DGqBkXh_.js} +1 -1
- package/webapp/dist/assets/{terminal-QWBau-Us.js → terminal-Bbl0XNeB.js} +1 -1
- package/webapp/dist/assets/{topology-CPey5dP6.js → topology-DmrRy7nN.js} +1 -1
- package/webapp/dist/assets/{topology-metadata-dialog-BivuU2y6.js → topology-metadata-dialog-Dpfp4YF1.js} +1 -1
- package/webapp/dist/assets/{traces-By0rdfDC.js → traces-CKHsOabJ.js} +1 -1
- package/webapp/dist/assets/{use-stack-context-UkBsF-l7.js → use-stack-context-BuraYaeY.js} +1 -1
- package/webapp/dist/assets/webapp-D8h_eabt.js +35 -0
- package/webapp/dist/console-version.json +1 -1
- package/webapp/dist/index.html +34 -34
- package/webapp/dist/logo.svg +1 -80
- package/bin/sdk.d.mts +0 -8
- package/bin/sdk.mjs +0 -576
- package/dist/monitoring/process-lifetime.d.ts +0 -11
- package/dist/monitoring/process-lifetime.d.ts.map +0 -1
- package/dist/monitoring/process-lifetime.js +0 -45
- package/dist/monitoring/process-lifetime.js.map +0 -1
- package/dist/shared/host-boot-identity.d.ts +0 -12
- package/dist/shared/host-boot-identity.d.ts.map +0 -1
- package/dist/shared/host-boot-identity.js +0 -89
- package/dist/shared/host-boot-identity.js.map +0 -1
- package/webapp/dist/assets/deploy-release-dialog-BOXcD5Wo.js +0 -1
- package/webapp/dist/assets/deployments-qV20Ak0P.js +0 -1
- package/webapp/dist/assets/detail-B85-Wees.js +0 -2
- package/webapp/dist/assets/index-uq8Dkk4c.js +0 -1
- package/webapp/dist/assets/omnitron-logo-koMCbsCv.js +0 -1
- package/webapp/dist/assets/pipelines-T6Ch9LTw.js +0 -3
- package/webapp/dist/assets/project.store--G5pIF-J.js +0 -1
- package/webapp/dist/assets/release-bits-B2a_wbft.js +0 -1
- package/webapp/dist/assets/release-build-panel-BQmIdKW9.js +0 -1
- package/webapp/dist/assets/release-deployment-state-DRrEI2pP.js +0 -1
- package/webapp/dist/assets/release-wire-f2VuBoBF.js +0 -1
- package/webapp/dist/assets/releases-Bp3CDgmo.js +0 -2
- package/webapp/dist/assets/settings-B3egRvbI.js +0 -1
- package/webapp/dist/assets/sign-in-9q-Nfy83.js +0 -1
- package/webapp/dist/assets/webapp-D-UhjFhS.js +0 -35
- package/webapp/dist/favicon.png +0 -0
|
@@ -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{P as r,U as i,c as a,h as o,l as s,y 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{C as g,D as _,F as v,H as y,I as b,M as x,O as S,Q as C,V as w,X as T,Y as E,Z as D,_t as O,at as k,c as A,ct as ee,d as te,f as ne,g as re,gt as ie,h as ae,ht as oe,i as j,j as M,lt as N,m as se,ot as P,p as ce,r as F,s as le,st as ue,ut as I,vt as de,w as fe}from"./mui-BXSXx9c9.js";import{A as L,B as pe,C as R,D as me,F as z,I as he,O as ge,a as B,b as _e,d as ve,f as ye,k as V,o as be,w as xe,y as Se,z as H}from"./mui-Cd711nOk.js";import{B as Ce,D as we,E as Te,G as U,K as Ee,O as De,T as Oe,U as ke,W as Ae,it as je,l as W,rt as Me,u as Ne,z as Pe}from"./mui-AnEgAVjz.js";import{C as Fe,_ as G,v as Ie,w as Le}from"./mui-BwsIrivo.js";import{n as Re,r as ze}from"./alert-uBG6r9NW.js";import{n as Be,r as Ve}from"./snackbar-DSPmjMyi.js";import{c as He,n as K,s as Ue}from"./access-48hkC2-P.js";import{n as We,r as Ge,t as Ke}from"./use-polled-resource-B22hhr5L.js";import{n as qe,t as Je}from"./realtime.store-CBDO4Abj.js";import{A as Ye,E as Xe,G as Ze,L as Qe,M as $e,g as et,m as tt,p as nt,s as rt,z as it}from"./icons-OboZgWSt.js";import{n as at,t as ot}from"./operation-status-Bm1x1wTz.js";import{n as st,t as ct}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as lt,t as ut}from"./skeleton-BmWDJWF9.js";import{n as dt,t as ft}from"./empty-content-7jOFhG4C.js";import{r as pt,t as mt}from"./daemon-memory-BiEtr9jr.js";import{r as ht,t as gt}from"./log-location-DuBjh6HQ.js";import{p as _t,u as vt}from"./release-bits-B2a_wbft.js";import{a as yt,c as bt,i as xt,o as St,r as Ct,s as wt,t as Tt}from"./sync-reading-CN0jPKAg.js";function Et(e){let t=e.relay;if(!e.reachable||!t)return{state:`unknown`,label:`unavailable`,detail:e.error??`No relay measurement was returned; check node connectivity and access.`};if(t.state===`not-applicable`)return{state:`neutral`,label:`not applicable`,detail:`Worker logs and metrics use the durable replication outbox. Delivery evidence is reported under Replication.`};let n=t.stats;if(!n||typeof n.started!=`boolean`||!n.destination)return{state:`unknown`,label:`unavailable`,detail:`The node did not report relay lifecycle and destination; update its backend.`};let r=n.buffer.totalDropped>0||!!n.lastError;return{state:n.started&&(n.destination===`aggregator`||n.destination===`transport`&&n.transportConnected)&&!r?`healthy`:`degraded`,label:n.started?n.destination===`aggregator`?`local database`:n.destination===`transport`?n.transportConnected?`transport up`:`transport down`:`no destination`:`stopped`,detail:`${n.buffer.size} buffered · ${n.totalSent} sent · ${n.totalFailed} failed${n.lastError?` · ${n.lastError}`:``}`,dropped:n.buffer.totalDropped}}function Dt({receipt:e}){let t=e.targets.filter(e=>e.state===`succeeded`||e.state===`current`).length,n=e.state===`planning`,r=n?e.targets.filter(e=>e.state!==`pending`).length:t;return(0,J.jsxs)(G,{spacing:1.25,sx:{minWidth:0,overflowWrap:`anywhere`},children:[(0,J.jsxs)(G,{direction:`row`,useFlexGap:!0,spacing:1,sx:{flexWrap:`wrap`,alignItems:`center`},children:[(0,J.jsx)(D,{size:`small`,color:At[e.state],label:e.state}),(0,J.jsxs)(H,{variant:`body2`,"aria-live":`polite`,children:[r,`/`,e.targets.length,` `,n?`nodes checked`:`on target`]}),(0,J.jsxs)(H,{variant:`caption`,color:`text.secondary`,children:[`Updated `,_t(e.updatedAt)]})]}),(0,J.jsxs)(H,{variant:`caption`,color:`text.secondary`,component:`div`,children:[`Commit `,(0,J.jsx)(`code`,{children:e.commit}),(0,J.jsx)(`br`,{}),`Plan `,(0,J.jsx)(`code`,{children:e.id})]}),(n||e.state===`running`)&&(0,J.jsx)(Oe,{"aria-label":n?`Node preflight checks completed`:`Nodes confirmed on the target build`,variant:`determinate`,value:r/Math.max(1,e.targets.length)*100}),e.reason&&(0,J.jsx)(k,{severity:e.state===`failed`?`error`:`warning`,children:e.reason}),e.state===`uncertain`&&(0,J.jsx)(H,{variant:`body2`,children:`Reconciliation reads the recorded node outcome without replaying activation. Inspect its owner and rollback target before planning another update.`}),(0,J.jsx)(G,{component:`ol`,spacing:1,sx:{m:0,pl:0,listStyle:`none`},children:e.targets.map((e,t)=>(0,J.jsxs)(w,{component:`li`,sx:{minWidth:0,borderTop:1,borderColor:`divider`,pt:1},children:[(0,J.jsxs)(G,{direction:`row`,useFlexGap:!0,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,J.jsxs)(H,{variant:`body2`,sx:{fontWeight:600},children:[t+1,`. `,e.name]}),(0,J.jsx)(D,{size:`small`,variant:`outlined`,color:At[e.state],label:e.state})]}),e.reason&&(0,J.jsx)(H,{variant:`body2`,children:e.reason}),(0,J.jsxs)(w,{component:`details`,open:[`blocked`,`failed`,`rolled-back`,`uncertain`].includes(e.state),sx:{typography:`caption`,color:`text.secondary`,"& summary":{cursor:`pointer`}},children:[(0,J.jsx)(`summary`,{children:`Owner and rollback details`}),`Node `,(0,J.jsx)(`code`,{children:e.nodeId}),` · Owner `,(0,J.jsx)(`code`,{children:e.ownerId??`unconfirmed`}),e.ownerPid!==null&&(0,J.jsxs)(J.Fragment,{children:[` · PID `,e.ownerPid]}),(0,J.jsx)(`br`,{}),`Rollback target `,(0,J.jsx)(`code`,{children:e.previous??`unconfirmed`}),(0,J.jsx)(`br`,{}),`Candidate `,(0,J.jsx)(`code`,{children:e.candidate??`unconfirmed`})]})]},e.nodeId))})]})}function Ot({nodes:e,close:t,review:n}){let[r,i]=(0,q.useState)(``),[o,s]=(0,q.useState)([]),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(!1),{can:p}=He(),m=p(`OmnitronDaemon.status`),h=p(`OmnitronNodes.listKernelBuilds`),_=We(()=>c.listKernelBuilds(),{enabled:h,paused:!0,intervalMs:3e4,resourceKey:String(h)}),y=(0,q.useMemo)(()=>{let e=new Map;for(let t of h?_.data??[]:[]){let n=e.get(t.commit)??[];n.push(`${t.platform}/${t.arch} · Node ${t.nodeVersion}`),e.set(t.commit,n)}return e},[h,_.data]),b=We(async()=>{let{build:e}=await a.status();return e?.dirty===!1&&/^[a-f0-9]{40}$/.test(e.commit)?e.commit:null},{enabled:m,paused:!0,intervalMs:3e4,resourceKey:String(m)}),[x,S]=(0,q.useState)(!1),[C,T]=(0,q.useState)(null),D=(0,q.useRef)(!1),O=(0,q.useRef)(null);(0,q.useEffect)(()=>(D.current=!0,()=>{D.current=!1}),[]);let A=r.trim().toLowerCase(),ee=/^[a-f0-9]{40}$/.test(A)&&(d||o.length>0),ne=async()=>{if(ee&&!x){S(!0),T(null);try{let e={commit:A,...o.length?{nodeIds:o.map(e=>e.id)}:{},...l&&{stage:!0}},t=JSON.stringify(e);O.current&&O.current.inputs===t||(O.current={inputs:t,id:crypto.randomUUID()});let r=await c.planKernelRollout({...e,requestId:O.current.id});if(r.id!==O.current.id)throw Error(`Controller returned a different request ID.`);D.current&&n(r.id)}catch(e){T(e instanceof Error?e.message:String(e))}finally{S(!1)}}};return(0,J.jsxs)(ae,{open:!0,fullWidth:!0,maxWidth:`sm`,onClose:()=>{x||t()},"aria-labelledby":`kernel-plan-title`,children:[(0,J.jsx)(le,{id:`kernel-plan-title`,children:`Plan backend update`}),(0,J.jsxs)(w,{component:`form`,onSubmit:e=>{e.preventDefault(),ne()},children:[(0,J.jsx)(te,{children:(0,J.jsxs)(G,{spacing:2,children:[(0,J.jsx)(E,{freeSolo:!0,disabled:x,options:[...y.keys()],loading:h&&_.loading,inputValue:r,onInputChange:(e,t)=>i(t),renderOption:({key:e,...t},n)=>(0,J.jsx)(w,{component:`li`,...t,children:(0,J.jsxs)(w,{sx:{minWidth:0,overflowWrap:`anywhere`},children:[(0,J.jsx)(`code`,{children:n}),(0,J.jsx)(H,{component:`div`,variant:`caption`,children:y.get(n)?.join(`, `)})]})},e),renderInput:e=>(0,J.jsx)(B,{...e,label:`Target commit`,autoFocus:!0,required:!0,fullWidth:!0,helperText:_.error?`Catalog unavailable. Enter the commit manually. ${_.error}`:`Choose a catalog build or enter the full 40-character Git commit.`})}),m&&b.data&&(0,J.jsxs)(v,{size:`small`,sx:{alignSelf:`flex-start`},disabled:x,onClick:()=>i(b.data),children:[`Use controller commit `,b.data.slice(0,12)]}),(0,J.jsx)(E,{multiple:!0,disabled:x||d,options:e.filter(e=>!e.isLocal),value:o,getOptionLabel:e=>e.name+` · `+e.host,getOptionKey:e=>e.id,isOptionEqualToValue:(e,t)=>e.id===t.id,onChange:(e,t)=>s(t),renderInput:e=>(0,J.jsx)(B,{...e,label:`Target nodes`,helperText:`Select nodes in update order, or explicitly choose all registered remote nodes.`})}),(0,J.jsx)(ke,{control:(0,J.jsx)(g,{checked:d,disabled:x,onChange:e=>{f(e.target.checked),e.target.checked&&s([])}}),label:`All registered remote nodes`}),(0,J.jsx)(ke,{control:(0,J.jsx)(g,{checked:l,disabled:x,onChange:e=>u(e.target.checked)}),label:`Stage from controller catalog`}),l&&(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,children:`Preparation transfers missing runtimes from the controller and installs them for native checks. Applying the reviewed plan activates them.`}),C&&(0,J.jsx)(k,{severity:`warning`,action:O.current&&(0,J.jsx)(v,{size:`small`,color:`inherit`,onClick:()=>n(O.current.id),children:`Check last request`}),children:C})]})}),(0,J.jsxs)(ce,{children:[(0,J.jsx)(v,{onClick:t,disabled:x,children:`Cancel`}),(0,J.jsx)(v,{type:`submit`,variant:`contained`,loading:x,disabled:!ee,children:`Prepare plan`})]})]})]})}function kt({nodes:e,canPlan:t,canApply:n,canReconcile:r}){let[a,o]=i(),s=a.get(`rollout`),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(null),[y,b]=(0,q.useReducer)(e=>e+1,0),[x,S]=(0,q.useState)(!1),{data:C,error:T,loading:E}=We(async()=>{let e=await c.getKernelRollout(s?{id:s}:{});if(s&&e&&e.id!==s)throw Error(`Controller returned another rollout receipt.`);return e},{intervalMs:x?3e3:2e4,resourceKey:JSON.stringify([s,y])}),D=h?.id===s&&([`succeeded`,`failed`,`blocked`].includes(h.state)||!C||C.id===h.id&&C.state===`planned`&&h.state===`running`)?h:C;(0,q.useEffect)(()=>{S(D?.state===`running`||D?.state===`planning`)},[D?.state]);let O=e=>{m(null),g(null),o(t=>{let n=new URLSearchParams(t);return e?n.set(`rollout`,e):n.delete(`rollout`),n})},A=async e=>{if(!(d||T||!D||D.id!==s)&&!(e===`apply`?!n||D.state!==`planned`:!r||D.state!==`uncertain`)){f(!0),m(null);try{let t=e===`apply`?await c.startKernelRollout({id:D.id}):await c.reconcileKernelRollout({id:D.id});if(t.id!==D.id)throw Error(`Controller returned another rollout receipt.`);g(t)}catch(e){m(`Request was not confirmed. Check the controller receipt. `+(e instanceof Error?e.message:String(e)))}finally{f(!1),b()}}};return(0,J.jsxs)(M,{variant:`outlined`,component:`section`,"aria-label":`Managed backend updates`,sx:{minWidth:0},children:[(0,J.jsx)(_,{children:(0,J.jsxs)(G,{spacing:1.5,children:[(0,J.jsxs)(G,{direction:`row`,useFlexGap:!0,spacing:1,sx:{flexWrap:`wrap`,alignItems:`center`},children:[(0,J.jsx)(H,{variant:`subtitle2`,sx:{flex:`1 1 auto`},children:`Managed backend updates`}),s&&(0,J.jsx)(v,{size:`small`,disabled:d,onClick:()=>O(null),children:`Latest rollout`}),t&&(0,J.jsx)(v,{size:`small`,variant:`outlined`,disabled:d||D?.state===`running`||D?.state===`planning`,onClick:()=>u(!0),children:`Plan update…`})]}),E&&(0,J.jsx)(Oe,{"aria-label":`Reading rollout receipt`}),T&&(0,J.jsxs)(k,{severity:`warning`,action:(0,J.jsx)(v,{color:`inherit`,size:`small`,onClick:b,children:`Retry`}),children:[`Could not read the rollout receipt. `,T]}),p&&(0,J.jsx)(k,{severity:`warning`,children:p}),D?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Dt,{receipt:D}),n&&D.state===`planned`&&(0,J.jsx)(w,{children:D.id===s?(0,J.jsx)(v,{color:`primary`,variant:`contained`,loading:d,disabled:!!T||E,onClick:()=>void A(`apply`),children:`Apply reviewed plan`}):(0,J.jsx)(v,{variant:`outlined`,disabled:!!T,onClick:()=>O(D.id),children:`Review plan`})}),r&&D.state===`uncertain`&&(0,J.jsx)(w,{children:D.id===s?(0,J.jsx)(v,{variant:`outlined`,loading:d,disabled:!!T||E,onClick:()=>void A(`reconcile`),children:`Reconcile node status`}):(0,J.jsx)(v,{variant:`outlined`,disabled:!!T,onClick:()=>O(D.id),children:`Inspect uncertain rollout`})})]}):!E&&!T&&(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:s?`The controller has no receipt for this rollout.`:`No managed backend update has been planned.`})]})}),t&&l&&(0,J.jsx)(Ot,{nodes:e,close:()=>u(!1),review:e=>{O(e),u(!1),b()}})]})}var q,J,At;function jt(){return(jt=e((()=>{q=t(),l(),P(),T(),y(),b(),x(),S(),fe(),C(),re(),se(),ne(),A(),Ae(),Te(),Ie(),be(),pe(),Ke(),o(),Ue(),vt(),J=n(),At={pending:`default`,planning:`info`,planned:`default`,ready:`info`,running:`info`,succeeded:`success`,current:`success`,blocked:`warning`,uncertain:`warning`,failed:`error`,"rolled-back":`warning`}})))()}function Mt(e){return s.invoke(`daemon`,`OmnitronNodes`,`planUpgrade`,[{...e,build:!0}],{timeout:18e4})}function Nt(e){return e!==`done`&&e!==`failed`&&e!==`refused`}function Pt({nodes:e}){let{can:t,snapshot:n}=He(),[r,i]=(0,Y.useState)(!1),a=t(`OmnitronNodes.planKernelRollout`),o=t(`OmnitronNodes.startKernelRollout`),s=t(`OmnitronNodes.reconcileKernelRollout`);return(0,X.jsxs)(G,{spacing:1,children:[t(`OmnitronNodes.getKernelRollout`)&&(0,X.jsx)(kt,{nodes:e,canPlan:a,canApply:o,canReconcile:s},JSON.stringify([n?.userId,a,o,s])),t(`OmnitronNodes.getUpgradeProgress`)&&(0,X.jsxs)(w,{component:`details`,onToggle:e=>i(e.currentTarget.open),children:[(0,X.jsx)(H,{component:`summary`,variant:`caption`,color:`text.secondary`,sx:{cursor:`pointer`,py:1},children:`Advanced · workspace source bundle upgrades`}),r&&(0,X.jsx)(Ft,{nodes:e},n?.userId)]})]})}function Ft({nodes:e}){let{can:t}=He(),n=t(`OmnitronNodes.planUpgrade`)&&t(`OmnitronNodes.upgradeNodes`),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(null),[s,l]=(0,Y.useState)(!1),{data:u,refresh:d,error:f,loading:p}=We(async()=>{let e=await c.getUpgradeProgress();return l(e.some(e=>Nt(e.phase))),e},{intervalMs:s?3e3:2e4}),m=u??[],h=m.filter(e=>Nt(e.phase)),g=(0,Y.useMemo)(()=>new Map(e.map(e=>[e.id,e])),[e]),y=(0,Y.useCallback)(async e=>{try{let t=await c.cancelUpgrade({nodeId:e});o(t.stopped?null:t.because),await d()}catch(e){o(e.message)}},[d]);return(0,X.jsxs)(M,{variant:`outlined`,children:[(0,X.jsxs)(_,{children:[(0,X.jsxs)(G,{direction:`row`,spacing:1.5,sx:{alignItems:`center`,flexWrap:`wrap`,mb:h.length>0||m.length>0?1.5:0},children:[(0,X.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`},children:`Workspace source bundle upgrade`}),h.length>0&&(0,X.jsx)(D,{size:`small`,color:`info`,label:`${h.length} of ${m.length} in flight`,sx:{height:20,fontSize:11}}),(0,X.jsx)(w,{sx:{flex:1}}),n&&(0,X.jsx)(v,{size:`small`,variant:`contained`,startIcon:(0,X.jsx)(tt,{}),onClick:()=>i(!0),children:`Upgrade nodes…`})]}),a&&(0,X.jsx)(k,{severity:`warning`,variant:`outlined`,sx:{mb:1.5},onClose:()=>o(null),children:a}),p&&(0,X.jsx)(Oe,{"aria-label":`Reading source bundle upgrade progress`}),f&&(0,X.jsxs)(k,{severity:`warning`,children:[`Could not refresh source bundle upgrades. `,f]}),m.length===0&&!p&&!f?(0,X.jsx)(H,{variant:`body2`,sx:{color:`text.secondary`},children:`No upgrade has been run from this master since it started.`}):(0,X.jsx)(G,{spacing:1,children:m.map(e=>{let t=g.get(e.nodeId);return(0,X.jsxs)(w,{children:[(0,X.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,X.jsx)(H,{variant:`body2`,sx:{fontWeight:600,minWidth:140},children:t?.name??e.nodeId}),(0,X.jsx)(D,{size:`small`,color:Lt[e.phase],label:e.phase,sx:{height:20,fontSize:11}}),e.phase===`queued`&&e.position!=null&&(0,X.jsxs)(H,{variant:`caption`,sx:{color:`text.secondary`},children:[`#`,e.position,` in the queue`]}),(0,X.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`},children:e.message}),e.version&&(0,X.jsx)(H,{variant:`caption`,sx:{fontFamily:`monospace`,color:`text.secondary`},children:e.version}),(0,X.jsx)(w,{sx:{flex:1}}),(0,X.jsx)(H,{variant:`caption`,sx:{color:`text.disabled`},children:_t(e.at)}),Nt(e.phase)&&(0,X.jsx)(K,{permission:`OmnitronNodes.cancelUpgrade`,children:(0,X.jsx)(z,{title:e.phase===`queued`?`Drop this node from the queue`:`A node already installing is not interrupted — the daemon will say so`,arrow:!0,children:(0,X.jsx)(`span`,{children:(0,X.jsx)(v,{size:`small`,color:`warning`,startIcon:(0,X.jsx)(it,{}),onClick:()=>void y(e.nodeId),children:`Cancel`})})})})]}),Nt(e.phase)&&e.phase!==`queued`&&(0,X.jsx)(Oe,{variant:`determinate`,value:e.percent,sx:{mt:.5,height:4,borderRadius:2}})]},e.nodeId)})})]}),n&&(0,X.jsx)(It,{open:r,onClose:()=>i(!1),nodes:e,onStarted:()=>{l(!0),d()}})]})}function It({open:e,onClose:t,nodes:n,onStarted:r}){let[i,a]=(0,Y.useState)(new Set),[o,s]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(1),[h,_]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),x=(0,Y.useMemo)(()=>n.filter(e=>!e.isLocal),[n]),S=(0,Y.useMemo)(()=>new Map(n.map(e=>[e.id,e])),[n]),C=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),s(null),n}),T=i.size>0&&i.size===x.length,E=(0,Y.useCallback)(async e=>{u(!0),_(null);let t=i.size>0?{nodeIds:[...i]}:{};try{s(e?await Mt(t):await c.planUpgrade(t))}catch(e){_(e.message),s(null)}finally{u(!1)}},[i]),O=o?.rows.filter(e=>e.action===`upgrade`)??[];return(0,X.jsxs)(ae,{open:e,onClose:d?void 0:t,maxWidth:`md`,fullWidth:!0,children:[(0,X.jsx)(le,{children:`Upgrade nodes`}),(0,X.jsx)(te,{children:(0,X.jsxs)(G,{spacing:2.5,sx:{mt:1},children:[(0,X.jsx)(H,{variant:`body2`,sx:{color:`text.secondary`},children:`The master builds one bundle and installs it on each node in turn. The rollout runs in the daemon — closing this window does not stop it.`}),(0,X.jsxs)(w,{children:[(0,X.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:.5},children:[(0,X.jsx)(g,{size:`small`,checked:T,indeterminate:i.size>0&&!T,onChange:()=>{s(null),a(T?new Set:new Set(x.map(e=>e.id)))}}),(0,X.jsx)(H,{variant:`body2`,children:i.size===0?`every node`:`${i.size} of ${x.length} selected`})]}),(0,X.jsx)(w,{sx:{maxHeight:220,overflowY:`auto`},children:(0,X.jsx)(V,{size:`small`,children:(0,X.jsx)(me,{children:x.map(e=>(0,X.jsxs)(ve,{hover:!0,onClick:()=>C(e.id),sx:{cursor:`pointer`},children:[(0,X.jsx)(R,{padding:`checkbox`,children:(0,X.jsx)(g,{size:`small`,checked:i.has(e.id)})}),(0,X.jsx)(R,{sx:{fontWeight:600},children:e.name}),(0,X.jsxs)(R,{sx:{fontFamily:`monospace`,fontSize:12},children:[e.host,`:`,e.sshPort]}),(0,X.jsx)(R,{sx:{fontFamily:`monospace`,fontSize:12},children:e.status?.omnitronVersion??`—`}),(0,X.jsx)(R,{children:(0,X.jsx)(D,{size:`small`,label:e.status?.pingReachable?`reachable`:`not reachable`,color:e.status?.pingReachable?`success`:`default`,variant:`outlined`,sx:{height:18,fontSize:10}})})]},e.id))})})})]}),(0,X.jsxs)(G,{direction:`row`,spacing:1.5,sx:{alignItems:`center`},children:[(0,X.jsx)(v,{size:`small`,variant:`outlined`,onClick:()=>void E(!1),disabled:l||d,children:l?`Planning…`:`Plan`}),(0,X.jsx)(z,{title:`Builds the bundle so each node can be compared to it. It runs on the master's own thread and stops it answering anything else for a minute or two.`,arrow:!0,children:(0,X.jsx)(`span`,{children:(0,X.jsx)(v,{size:`small`,onClick:()=>void E(!0),disabled:l||d,children:`Compare versions`})})}),l&&(0,X.jsx)(ue,{size:16}),(0,X.jsx)(B,{select:!0,label:`At once`,size:`small`,value:p,onChange:e=>m(Number(e.target.value)),sx:{width:120},disabled:d,children:[1,2,3,4,6,8].map(e=>(0,X.jsx)(W,{value:e,children:e},e))}),(0,X.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`},children:l?`The master is building the bundle so the plan can name a target version — up to a few minutes.`:`An upgrade restarts the node's daemon, so one at a time is the safe default.`})]}),o&&(0,X.jsxs)(w,{children:[o.refusal&&(0,X.jsx)(k,{severity:`error`,sx:{mb:1},children:(0,X.jsx)(H,{variant:`body2`,sx:{whiteSpace:`pre-wrap`},children:o.refusal})}),o.compared?(0,X.jsxs)(H,{variant:`body2`,sx:{mb:1},children:[`Target `,(0,X.jsx)(`strong`,{style:{fontFamily:`monospace`},children:o.targetVersion}),` —`,` `,O.length,` would be upgraded, `,o.rows.filter(e=>e.action===`skip`).length,` already there,`,` `,o.rows.filter(e=>e.action===`refuse`).length,` refused.`]}):(0,X.jsxs)(w,{sx:{mb:1},children:[(0,X.jsxs)(H,{variant:`body2`,children:[O.length,` would be attempted, `,o.rows.filter(e=>e.action===`refuse`).length,` refused —`,` `,(0,X.jsx)(`strong`,{children:`nothing was compared`}),`.`]}),(0,X.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`},children:`No bundle has been built, so no row can say «already on the target version». Twelve rows reading «upgrade» here mean twelve nodes that would be touched, not twelve that are out of date.`})]}),(0,X.jsxs)(V,{size:`small`,children:[(0,X.jsx)(Se,{children:(0,X.jsxs)(ve,{children:[(0,X.jsx)(R,{children:`Node`}),(0,X.jsx)(R,{children:o.compared?`Now → target`:`Now`}),(0,X.jsx)(R,{children:`Action`}),(0,X.jsx)(R,{children:`Why`})]})}),(0,X.jsx)(me,{children:o.rows.map(e=>(0,X.jsxs)(ve,{children:[(0,X.jsxs)(R,{children:[(0,X.jsx)(H,{variant:`body2`,sx:{fontWeight:600},children:e.label}),(0,X.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:e.host??`no address`})]}),(0,X.jsxs)(R,{sx:{fontFamily:`monospace`,fontSize:12},children:[e.currentVersion??`—`,o.compared&&e.targetVersion&&e.targetVersion!==e.currentVersion&&(0,X.jsxs)(H,{component:`span`,variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:[` → `,e.targetVersion]})]}),(0,X.jsx)(R,{children:(0,X.jsx)(D,{size:`small`,label:e.action,color:e.action===`upgrade`?`info`:e.action===`skip`?`success`:`warning`,variant:`outlined`,sx:{height:18,fontSize:10}})}),(0,X.jsx)(R,{children:(0,X.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`},children:e.because})})]},e.nodeId))})]})]}),y&&(0,X.jsxs)(w,{children:[(0,X.jsx)(F,{sx:{mb:1.5}}),(0,X.jsxs)(k,{severity:y.refused.length>0?`warning`:`success`,children:[`Queued `,y.accepted.length,` node`,y.accepted.length===1?``:`s`,y.refused.length>0?`; ${y.refused.length} not taken`:``,`.`]}),y.refused.map(e=>(0,X.jsxs)(H,{variant:`caption`,sx:{display:`block`,mt:.5,color:`text.secondary`},children:[(0,X.jsx)(`strong`,{children:S.get(e.nodeId)?.name??e.nodeId}),` — `,e.because]},e.nodeId))]}),h&&(0,X.jsxs)(k,{severity:`error`,children:[(0,X.jsx)(H,{variant:`body2`,sx:{whiteSpace:`pre-wrap`},children:h}),/^(HTTP 50\d|Request timeout)/.test(h)&&(0,X.jsxs)(H,{variant:`caption`,sx:{display:`block`,mt:.5},children:[`The plan builds the bundle first — that is how it can say «already on the target version» instead of listing every node as an upgrade — and the request outlived the gateway's 120-second deadline. The master is still building; the CLI (`,(0,X.jsx)(`code`,{children:`omnitron fleet upgrade --dry-run`}),`) has no such deadline.`]})]})]})}),(0,X.jsxs)(ce,{children:[(0,X.jsx)(v,{onClick:t,size:`small`,disabled:d,children:y?`Close`:`Cancel`}),(0,X.jsx)(v,{variant:`contained`,size:`small`,startIcon:d?(0,X.jsx)(ue,{size:14,color:`inherit`}):(0,X.jsx)(tt,{}),disabled:d||!o||O.length===0||!!o.refusal||y!==null,onClick:async()=>{f(!0),_(null);try{let e=await c.upgradeNodes({nodeIds:O.map(e=>e.nodeId),concurrency:p});b(e),r()}catch(e){_(e.message)}finally{f(!1)}},children:d?`Queueing…`:`Start rollout (${O.length})`})]})]})}var Y,X,Lt;function Rt(){return(Rt=e((()=>{Ue(),jt(),Y=t(),P(),y(),b(),x(),S(),fe(),C(),ee(),re(),se(),ne(),A(),j(),Te(),Ne(),Ie(),L(),ge(),xe(),_e(),ye(),be(),he(),pe(),Ze(),Ke(),o(),vt(),X=n(),Lt={queued:`default`,building:`info`,transferring:`info`,activating:`warning`,done:`success`,failed:`error`,refused:`error`}})))()}function zt(e){if(!e||typeof e!=`object`)return!1;let t=e;return!!(t.event&&typeof t.event.id==`string`&&typeof t.event.title==`string`&&Array.isArray(t.event.evidence)&&t.event.evidence.every(e=>typeof e==`string`)&&(t.event.remedy===void 0||typeof t.event.remedy==`string`)&&typeof t.occurrences==`number`)}function Bt({active:e,nodeName:t}){let n=Array.isArray(e)?e.filter(zt).slice(0,100):[];return n.length?(0,Z.jsxs)(O,{disableGutters:!0,elevation:0,sx:{minWidth:0,mt:1,"&:before":{display:`none`}},children:[(0,Z.jsx)(N,{"aria-label":`Runtime diagnostic evidence`,children:(0,Z.jsxs)(H,{variant:`body2`,children:[`Evidence and recovery · `,n.length]})}),(0,Z.jsx)(oe,{children:(0,Z.jsxs)(G,{spacing:2,sx:{minWidth:0,overflowWrap:`anywhere`},children:[n.map(({event:e,occurrences:t})=>(0,Z.jsxs)(G,{spacing:.5,children:[(0,Z.jsx)(H,{variant:`body2`,sx:{fontWeight:600},children:e.title}),(0,Z.jsxs)(H,{variant:`caption`,sx:{fontFamily:`monospace`,color:`text.secondary`},children:[e.id,` · `,t,` occurrence(s)`]}),e.evidence.map((e,t)=>(0,Z.jsx)(H,{variant:`body2`,children:e},t)),e.remedy&&(0,Z.jsx)(H,{variant:`body2`,sx:{color:`text.secondary`},children:e.remedy})]},e.id)),(0,Z.jsx)(v,{component:r,to:ht(`omnitron`,t),size:`small`,sx:{alignSelf:`flex-start`},children:`Open daemon logs`})]})})]}):null}var Z;function Vt(){return(Vt=e((()=>{l(),de(),I(),ie(),b(),Ie(),pe(),gt(),Z=n()})))()}function Ht(e){if(e.omnitronConnected===!0)return`running`;let t=e.omnitronError??``;return t.startsWith(`omnitron: command not found`)?`not-installed`:e.sshConnected===!1?`unreachable`:e.omnitronConnected===!1&&t===`omnitron status reported no running daemon`?`not-running`:`unread`}function Ut(){return(Ut=e((()=>{})))()}function Wt(e,t){return e==null?t?`failed`:`unmeasured`:e?`ok`:`failed`}function Gt(e){let t=Ht({sshConnected:e.sshConnected??null,omnitronConnected:e.omnitronConnected??null,omnitronError:e.omnitronError??null});switch(t){case`running`:return`ok`;case`not-running`:case`not-installed`:return`failed`;case`unreachable`:return`unmeasured`;case`unread`:return e.omnitronConnected==null&&!e.omnitronError?`unmeasured`:`unknown`;default:return t}}function Kt(e){return e.pingError??e.sshError??e.omnitronError??null}function qt(e){return e.participant===`controller`||!e.participant&&(`leaderId`in e||typeof e.state==`string`)}function Jt(e){let t=e.cluster;if(!e.reachable||!t)return e.error||`Cluster participation unavailable`;if(t.participant===`standalone`)return`Standalone`;if(t.participant!==`worker`&&!qt(t))return`Cluster participation unreported`;let n=[t.participant===`worker`?`Worker`:`Controller`];return typeof t.clusterId==`string`&&n.push(t.clusterId),typeof t.state==`string`&&n.push(t.state),(typeof t.term==`string`||typeof t.term==`number`)&&n.push(`epoch ${t.term}`),t.fencedOperations?.length&&n.push(t.fencedOperations.join(`, `)),n.join(` · `)}function Yt(e){return e.flatMap(e=>{let t=e.cluster;return!e.reachable||!t||t.coordination!==`postgres-lease`||![`unavailable`,`expired`,`stopped`].includes(String(t.authority))?[]:[{nodeId:e.nodeId,reason:typeof t.reason==`string`&&t.reason?t.reason:`Cluster authority is ${String(t.authority)}`}]})}function Xt(e){let t=new Map;for(let n of e){if(!n.reachable||!n.cluster||!qt(n.cluster))continue;let e=typeof n.cluster.clusterId==`string`?n.cluster.clusterId:`legacy`;t.set(e,[...t.get(e)??[],n])}for(let[e,n]of t){let t=Zt(n,e);if(t.kind!==`none`)return t}return{kind:`none`}}function Zt(e,t){if(e.length<2)return{kind:`none`};let n=new Map,r=new Set;for(let t of e){let e=typeof t.cluster.leaderId==`string`?t.cluster.leaderId:`(none)`;n.has(e)||n.set(e,[]),n.get(e).push(t.nodeId);let i=t.cluster.term;typeof i==`string`&&/^[1-9][0-9]{0,18}$/.test(i)?r.add(i):typeof i==`number`&&Number.isSafeInteger(i)&&i>=0&&r.add(String(i))}return n.size>1?{kind:`leaders`,clusterId:t,answered:e.length,groups:[...n]}:r.size>1?{kind:`terms`,clusterId:t,answered:e.length,terms:[...r].sort((e,t)=>BigInt(e)<BigInt(t)?-1:1)}:{kind:`none`}}function Qt(){return(Qt=e((()=>{Ut()})))()}function $t(e,t){let n=e*864e5;return Math.max(1,Math.min(400,Math.ceil(n/Math.max(1,t))))}function en(e){if(!e)return`never`;let t=Date.now()-Date.parse(e);if(!Number.isFinite(t))return`never`;if(t<6e4)return`just now`;let n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function tn(e){if(!e)return!0;let t=Date.parse(e);return!Number.isFinite(t)||Date.now()-t>Nn}function nn({state:e,label:t,tooltip:n}){return(0,$.jsx)(z,{title:n??{online:`Connected`,offline:`Offline`,unknown:`Unknown`,unchecked:`Not checked`,checking:`Checking...`,"not-installed":`Not installed`}[e],arrow:!0,children:(0,$.jsxs)(G,{direction:`row`,spacing:.5,sx:{alignItems:`center`},children:[(0,$.jsx)(w,{sx:{width:8,height:8,borderRadius:`50%`,bgcolor:{online:`success.main`,offline:`error.main`,unknown:`warning.light`,unchecked:`text.disabled`,checking:`warning.main`,"not-installed":`text.disabled`}[e],flexShrink:0,...e===`checking`&&{animation:`${Fn} 1s ease-in-out infinite`},...e===`not-installed`&&{border:`1px dashed`,borderColor:`text.disabled`,bgcolor:`transparent`}}}),(0,$.jsx)(H,{variant:`caption`,noWrap:!0,sx:{color:`text.secondary`},children:t})]})})}function rn(e,t,n){if(e<0)return n===`absent`?f(t.palette.info.main,.35):n===`unreachable`?f(t.palette.warning.main,.3):n===`unread`?f(t.palette.text.disabled,.25):t.palette.action.disabledBackground;let r=an(t.palette.success.main),i=an(t.palette.error.main),a=i[0]+(r[0]-i[0])*e,o=i[1]+(r[1]-i[1])*e,s=i[2]+(r[2]-i[2])*e;return`hsl(${Math.round(a)}, ${Math.round(o)}%, ${Math.round(s)}%)`}function an(e){let t=e.replace(`#`,``),n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,i=parseInt(t.slice(4,6),16)/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=(a+o)/2;if(a===o)return[0,0,s*100];let c=a-o,l=s>.5?c/(2-a-o):c/(a+o),u;return u=a===n?(r-i)/c+(r<i?6:0):a===r?(i-n)/c+2:(n-r)/c+4,u*=60,[u,l*100,s*100]}function on({data:e,metric:t,label:n,segWidth:r=6,gap:i=4,height:a=10,lastCheckAt:o}){let s=m(),c=(0,Q.useRef)(null),[l,u]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let t=e.clientWidth;u(Math.max(1,Math.floor((t+i)/(r+i))))};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[r,i]);let d=[];if(l>0){let n=e.slice(-l);for(let e=0;e<l-n.length;e++)d.push({val:-1,time:``});for(let e of n){let n=e[t],r=e.t?new Date(e.t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``;d.push({val:n,time:r,...e.t?{iso:e.t}:{},checks:e.checks,unmeasured:e.omnitronUnmeasured})}}let f=d.filter(e=>e.val>=0),p=f.length>0?Math.round(f.reduce((e,t)=>e+t.val,0)/f.length*100):-1,h=p<0&&d.some(e=>e.unmeasured===`absent`),g=p>=0&&o&&Date.now()-new Date(o).getTime()>3e5?Date.now()-new Date(o).getTime():null,_=o?{time:new Date(o).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}:null,v=g==null?null:g>=36e5?`${Math.round(g/36e5)}h`:`${Math.max(1,Math.round(g/6e4))}m`;return(0,$.jsxs)(G,{spacing:.25,children:[(0,$.jsxs)(G,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.disabled`,fontSize:9,textTransform:`uppercase`,letterSpacing:.5},children:n}),v?(0,$.jsx)(z,{title:`Nothing has been recorded for ${v} — the last check was at ${_?.time}. The strip shows what was measured before that, not the node now.`,arrow:!0,children:(0,$.jsxs)(H,{variant:`caption`,sx:{fontSize:9,color:`warning.main`},children:[`no checks for `,v]})}):p>=0?(0,$.jsxs)(H,{variant:`caption`,sx:{fontSize:9,color:p>=95?`success.main`:p>=50?`warning.main`:`error.main`},children:[p,`%`]}):h?(0,$.jsx)(H,{variant:`caption`,sx:{fontSize:9,color:`info.main`},children:`not installed`}):null]}),(0,$.jsx)(G,{ref:c,direction:`row`,sx:{height:a,gap:`${i}px`},children:d.map((e,t)=>{let n=rn(e.val,s,e.unmeasured),i=e.checks==null?``:` (${e.checks} checks)`,a=e.val<0?e.unmeasured===`absent`?`${e.time} — omnitron not installed${i}`:e.unmeasured===`unreachable`?`${e.time} — could not reach the node${i}`:e.unmeasured===`unread`?`${e.time} — not measured: the node was reached and nothing could be read${i}`:e.time?`${e.time} — no data`:`No data`:`${e.time} — ${Math.round(e.val*100)}% up${i}`;return(0,$.jsx)(z,{title:a,arrow:!0,children:(0,$.jsx)(w,{sx:{width:r,minWidth:r,height:`100%`,bgcolor:n,borderRadius:`2px`,transition:`opacity 0.15s`,"&:hover":{opacity:.6}}})},t)})})]})}function sn(e){return/\+local\.[0-9a-zA-Z]+\.(\d{12})$/.exec(e??``)?.[1]??null}function cn(e,t){if(!e||!t)return`unknown`;if(e===t)return`current`;let n=sn(e),r=sn(t);return n&&r?n<r?`behind`:`current`:`differs`}function ln(e){let t,n=``;for(let r of e){if(!r)continue;let e=sn(r);e?e>n&&(n=e,t=r):t??=r}return t}function un(e,t){if(!e)return{state:`unchecked`,tooltip:`Not checked`};if(t)return e.omnitronConnected?{state:`online`,tooltip:`v${e.omnitronVersion??`?`} PID ${e.omnitronPid??`?`}`}:{state:`offline`,tooltip:e.omnitronError??`Not running`};let n=Ht(e);switch(n){case`running`:return{state:`online`,tooltip:`v${e.omnitronVersion??`?`} (${e.omnitronRole??`?`})`};case`not-running`:return{state:`offline`,tooltip:e.omnitronError??`Not running`};case`not-installed`:return{state:`not-installed`,tooltip:`Not installed on this node`};case`unreachable`:return{state:`unchecked`,tooltip:e.sshError?`SSH refused: ${e.sshError}`:`SSH refused`};case`unread`:return e.omnitronError?{state:`unknown`,tooltip:`Unknown — ${e.omnitronError}`}:{state:`unchecked`,tooltip:`Not checked yet`};default:return{state:`unchecked`,tooltip:String(n)}}}function dn({label:e,verdict:t,latencyMs:n,error:r,detail:i}){return(0,$.jsxs)(w,{sx:{py:1},children:[(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,$.jsx)(H,{variant:`body2`,sx:{fontWeight:600,minWidth:96},children:e}),(0,$.jsx)(D,{size:`small`,label:Vn[t],color:Bn[t],variant:Hn(t)?`outlined`:`filled`,sx:{height:20,fontSize:11}}),n!=null&&(0,$.jsxs)(H,{variant:`caption`,sx:{color:`text.secondary`},children:[n,`ms`]}),i&&(0,$.jsx)(H,{variant:`caption`,noWrap:!0,sx:{color:`text.secondary`},children:i})]}),r&&(0,$.jsx)(H,{variant:`caption`,component:`pre`,sx:{mt:.5,ml:`104px`,p:1,borderRadius:1,bgcolor:e=>f(e.palette.error.main,.08),color:`error.main`,fontFamily:`monospace`,fontSize:11,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:r})]})}function fn({row:e,isLocal:t}){let n=Wt(e.pingReachable,e.pingError),r=Wt(e.sshConnected,e.sshError),i=Gt(e),a=Kt(e),o=t?[[`OMNITRON`,i]]:[[`PING`,n],[`SSH`,r],[`OMNITRON`,i]];return(0,$.jsxs)(w,{sx:{py:.75,borderBottom:e=>`1px solid ${e.palette.divider}`},children:[(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,$.jsx)(H,{variant:`caption`,sx:{fontFamily:`monospace`,minWidth:148,color:`text.secondary`},children:new Date(e.checkedAt).toLocaleString()}),o.map(([e,t])=>(0,$.jsx)(D,{size:`small`,label:e,color:Bn[t],variant:Hn(t)?`outlined`:`filled`,sx:{height:18,fontSize:10}},e)),(0,$.jsxs)(H,{variant:`caption`,sx:{color:`text.disabled`,ml:`auto`},children:[e.checkDurationMs,`ms`]})]}),a&&(0,$.jsx)(H,{variant:`caption`,sx:{display:`block`,mt:.25,ml:`156px`,color:`error.main`,fontFamily:`monospace`,fontSize:11,wordBreak:`break-word`},children:a})]})}function pn({data:e,health:t}){if(!e)return(0,$.jsx)(H,{variant:`body2`,sx:{py:1,color:`text.secondary`},children:`Not read.`});if(!e.reachable||!e.answer)return(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{py:1,alignItems:`baseline`},children:[(0,$.jsx)(D,{size:`small`,label:`not asked`,variant:`outlined`,sx:{height:20,fontSize:11}}),(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:e.error??`no reason given`})]});let n=e.answer;if(n.apps.length===0)return(0,$.jsx)(H,{variant:`body2`,sx:{py:1,color:`text.secondary`},children:`The node answered and is running no applications.`});let i=e=>e===`online`?`success`:e===`starting`?`warning`:e===`stopped`?`default`:`error`;return(0,$.jsxs)(w,{sx:{py:.5},children:[(0,$.jsxs)(H,{variant:`caption`,sx:{display:`block`,mb:1,color:`text.secondary`},children:[n.apps.length,` app(s) · `,n.totalCpu.toFixed(1),`% CPU ·`,` `,(mt(n)/1024/1024).toFixed(0),` MB`]}),n.apps.map(n=>(0,$.jsxs)(w,{children:[(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{py:.5,alignItems:`baseline`,flexWrap:`wrap`},children:[(0,$.jsx)(D,{size:`small`,label:n.status,color:i(n.status),sx:{height:20,fontSize:11}}),(0,$.jsx)(H,{variant:`body2`,sx:{fontFamily:`monospace`},children:n.name}),(0,$.jsx)(v,{component:r,to:ht(n.name,e.nodeId===`local`?void 0:e.nodeId),size:`small`,"aria-label":`View logs for ${n.name}`,children:`Logs`}),(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:[n.pid?`pid ${n.pid}`:null,n.port?`:${n.port}`:null,n.uptime>0?`up ${En(n.uptime)}`:null,n.restarts>0?`${n.restarts} restarts`:null].filter(Boolean).join(` · `)})]},n.name),(0,$.jsxs)(H,{variant:`caption`,sx:{display:`block`,color:`text.secondary`},children:[`Health: `,t?.answer?.apps[n.name]?.status??`not read`,t?.error?` — ${t.error}`:``]}),t?.answer?.apps[n.name]?.checks.map(e=>(0,$.jsxs)(H,{variant:`caption`,sx:{display:`block`,pl:1,color:e.status===`fail`?`error.main`:e.status===`warn`?`warning.main`:`text.secondary`},children:[e.status,` · `,e.name,e.message?` — ${e.message}`:``]},e.name))]},n.name))]})}function mn({data:e}){let t=e.phase===`done`?`success`:e.phase===`failed`||e.phase===`refused`?`error`:`warning`,n=e.phase!==`done`&&e.phase!==`failed`&&e.phase!==`refused`;return(0,$.jsxs)(w,{sx:{py:.5},children:[(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,$.jsx)(D,{size:`small`,label:e.phase,color:t,sx:{height:20,fontSize:11}}),(0,$.jsx)(H,{variant:`body2`,children:e.message})]}),e.version&&(0,$.jsx)(H,{variant:`caption`,sx:{display:`block`,mt:.5,color:`text.secondary`,fontFamily:`monospace`},children:e.version}),n&&(0,$.jsx)(Oe,{variant:`determinate`,value:e.percent,sx:{mt:1,height:4,borderRadius:2}}),(0,$.jsx)(H,{variant:`caption`,sx:{display:`block`,mt:.5,color:`text.disabled`},children:new Date(e.at).toLocaleString()})]})}function hn({data:e,nodeName:t}){if(!e)return(0,$.jsx)(H,{variant:`body2`,sx:{py:1,color:`text.secondary`},children:`Not read.`});if(!e.reachable)return(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{py:1,alignItems:`baseline`},children:[(0,$.jsx)(D,{size:`small`,label:`not asked`,variant:`outlined`,sx:{height:20,fontSize:11}}),(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:e.error??`no reason given`})]});let n=Object.entries(e.indicators??{});if(n.length===0)return(0,$.jsx)(H,{variant:`body2`,sx:{py:1,color:`text.secondary`},children:`The node answered and registered no indicators.`});let r=e=>e===`healthy`?`success`:e===`degraded`?`warning`:e===`unhealthy`?`error`:`default`;return(0,$.jsxs)(w,{sx:{py:.5},children:[e.status&&(0,$.jsx)(D,{size:`small`,label:`overall: ${e.status}`,color:r(e.status),sx:{height:20,fontSize:11,mb:1}}),n.map(([e,t])=>(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{py:.4,alignItems:`baseline`,flexWrap:`wrap`},children:[(0,$.jsx)(H,{variant:`body2`,sx:{minWidth:120,fontWeight:500},children:e}),(0,$.jsx)(D,{size:`small`,label:t?.status??`unknown`,color:r(t?.status),variant:t?.status?`filled`:`outlined`,sx:{height:18,fontSize:10}}),t?.message&&(0,$.jsx)(H,{variant:`caption`,sx:{color:t.status===`healthy`?`text.secondary`:`error.main`},children:t.message})]},e)),(0,$.jsx)(Bt,{active:n.find(([e])=>e===`runtime-diagnostics`)?.[1].details?.active,nodeName:t})]})}function gn({data:e}){if(!e)return(0,$.jsx)(H,{variant:`body2`,sx:{py:1,color:`text.secondary`},children:`Not read.`});if(!e.reachable||!e.sync)return(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{py:1,alignItems:`baseline`},children:[(0,$.jsx)(D,{size:`small`,label:`unavailable`,variant:`outlined`,sx:{height:20,fontSize:11}}),(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:e.error??`No replication reading was returned.`})]});let t=e.sync,n=yt(t);return(0,$.jsxs)(w,{sx:{py:.5},children:[(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:.5},children:[(0,$.jsx)(D,{size:`small`,label:n.state===`unknown`?`delivery active`:n.state===`pulling`?`keeping up`:n.state===`synced`?`in sync`:n.state.replace(`-`,` `),color:wt(n),sx:{height:20,fontSize:11}}),(0,$.jsxs)(H,{variant:`caption`,sx:{color:`text.secondary`},children:[bt(n),` · `,t.bufferSizeAccuracy!==`measured`&&`~`,Math.round(t.bufferSize/1024),` KB pending · last release`,` `,t.lastSyncAt?en(new Date(t.lastSyncAgeMs==null?t.lastSyncAt:Date.now()-t.lastSyncAgeMs).toISOString()):`not recorded`,t.deliveryRatePerSecond!==void 0&&` · ${t.deliveryRatePerSecond.toFixed(1)} entries/s (60 s)`]}),t.failedAttempts>0&&(0,$.jsx)(D,{size:`small`,color:`error`,label:`${t.failedAttempts} failed attempts`,sx:{height:18,fontSize:10}})]}),t.evidence&&(0,$.jsxs)(H,{variant:`caption`,sx:{display:`block`,color:`text.secondary`,overflowWrap:`anywhere`,fontVariantNumeric:`tabular-nums`},children:[St(t.evidence),`. Released entries may include losses; evidence began `,new Date(t.evidence.since).toLocaleString(),`.`]}),t.lastError&&(0,$.jsx)(H,{variant:`caption`,sx:{display:`block`,color:`error.main`,fontFamily:`monospace`,fontSize:11,wordBreak:`break-word`},children:t.lastError}),!!t.history?.length&&(0,$.jsxs)(w,{component:`details`,sx:{mt:1,minWidth:0,"& summary":{cursor:`pointer`,typography:`caption`,color:`text.secondary`}},children:[(0,$.jsx)(`summary`,{children:`History before receipts · coverage and gaps`}),(0,$.jsx)(G,{spacing:1,sx:{pt:1},children:t.history.map(e=>(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,overflowWrap:`anywhere`},children:Tt(e)},e.sourceId))})]})]})}function _n({states:e}){let t=Object.values(e),n=Xt(t),r=Yt(t);return n.kind===`none`&&r.length===0?null:(0,$.jsxs)(G,{spacing:1,children:[r.map(e=>(0,$.jsxs)(Re,{severity:`warning`,children:[e.nodeId.slice(0,8),` · `,e.reason]},e.nodeId)),n.kind!==`none`&&(0,$.jsx)(Re,{severity:`warning`,children:n.kind===`leaders`?`${n.clusterId}: ${n.answered} controller observations name different leaders: `+n.groups.map(([e,t])=>`${e} (${t.length})`).join(`, `):`${n.clusterId}: ${n.answered} controller observations have different epochs: ${n.terms.join(`, `)}`})]})}function vn({data:e}){if(!e)return null;let t=Et(e);return(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{py:.5,alignItems:`center`,flexWrap:`wrap`},children:[(0,$.jsx)(H,{variant:`caption`,sx:{minWidth:96,color:`text.secondary`},children:`telemetry`}),(0,$.jsx)(D,{size:`small`,label:t.label,color:t.state===`healthy`?`success`:t.state===`degraded`?`warning`:`default`,variant:`outlined`,sx:{height:18,fontSize:10}}),(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,overflowWrap:`anywhere`},children:t.detail}),`dropped`in t&&t.dropped>0&&(0,$.jsx)(D,{size:`small`,color:`error`,label:`${t.dropped} DROPPED`,sx:{height:18,fontSize:10}})]})}function yn(e){return(0,$.jsx)(bn,{...e},e.open?e.node?.id??`none`:`closed`)}function bn({open:e,onClose:t,node:n,cluster:r}){let[i,a]=(0,Q.useState)([]),[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,y]=(0,Q.useState)(50),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),[A,ee]=(0,Q.useState)(!0),[ne,re]=(0,Q.useState)(!1),[ie,oe]=(0,Q.useState)(null),j=Ve(),M=(0,Q.useRef)(0),N=(0,Q.useCallback)(async(e,t)=>{let n=++M.current;ee(!0),oe(null);try{let[r,i,o,l,d,p,h,_,v]=await Promise.allSettled([c.getCheckHistory({nodeId:e,limit:t}),c.getNodeIndicators({nodeId:e}),c.getNodeSyncStatus({nodeId:e}),c.getNodeRelayStats({nodeId:e}),c.getNodeHealthSummaries(),c.getNodeDaemonStatus({nodeId:e}),c.getUpgradeProgress(),c.getNodeDaemonHealth({nodeId:e}),c.getMeshStatus()]);if(n!==M.current)return;if(f(v.status===`fulfilled`?v.value.find(t=>t.nodeId===e)??null:null),C(_.status===`fulfilled`?_.value:{nodeId:e,reachable:!1,answer:null,error:`Application health could not be read`}),x(p.status===`fulfilled`?p.value:null),E(h.status===`fulfilled`?h.value.find(t=>t.nodeId===e)??null:null),s(i.status===`fulfilled`?i.value:null),u(o.status===`fulfilled`?o.value:{nodeId:e,reachable:!1,sync:null,error:o.reason instanceof Error?o.reason.message:String(o.reason)}),m(l.status===`fulfilled`?l.value:null),g(d.status===`fulfilled`?d.value.find(t=>t.nodeId===e)??null:null),r.status===`rejected`)throw r.reason;a(r.value)}catch(e){if(n!==M.current)return;oe(e instanceof Error?e.message:String(e)),a([])}finally{n===M.current&&ee(!1)}},[]);(0,Q.useEffect)(()=>{let t=M;return e&&n&&N(n.id,_),()=>{t.current++}},[e,n,_,N]);let se=T!==null&&T.phase!==`done`&&T.phase!==`failed`&&T.phase!==`refused`;Ge(()=>{e&&n&&!A&&N(n.id,_)},{intervalMs:5e3,enabled:e});let P=(0,Q.useCallback)(async()=>{if(n){k(!0);try{let e=await c.upgradeNode({nodeId:n.id});if(!e.started){j.warning(e.reason??`The daemon refused to start an upgrade`);return}j.info(`Building a bundle — this takes a few minutes`),await N(n.id,_)}catch(e){j.error(e instanceof Error?e.message:`Could not start the upgrade`)}finally{k(!1)}}},[n,_,N,j]),ue=(0,Q.useCallback)(async()=>{if(n){re(!0);try{await c.triggerNodeCheck({nodeId:n.id}),await N(n.id,_),j.success(`Check complete`)}catch(e){j.error(e instanceof Error?e.message:`Check failed`)}finally{re(!1)}}},[n,_,N,j]);if(!n)return null;let I=n.status,de=n.isLocal;return(0,$.jsxs)(ae,{open:e,onClose:t,maxWidth:`md`,fullWidth:!0,children:[(0,$.jsx)(le,{children:(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,$.jsxs)(w,{component:`span`,children:[`Diagnostics — `,n.name]}),(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`},children:de?`this daemon`:`${n.host}:${n.daemonPort}`})]})}),(0,$.jsxs)(te,{dividers:!0,children:[A&&(0,$.jsx)(Oe,{"aria-label":`Loading node diagnostics`,sx:{mb:2}}),(0,$.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`},children:`Last check`}),h&&(h.consecutiveFailures>0||h.lastSeenOnline)&&(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{mb:1,alignItems:`center`,flexWrap:`wrap`},children:[h.consecutiveFailures>0&&(0,$.jsx)(D,{size:`small`,color:h.consecutiveFailures>3?`error`:`warning`,label:`${h.consecutiveFailures} consecutive failures`,sx:{height:20,fontSize:11}}),h.lastSeenOnline&&(0,$.jsxs)(H,{variant:`caption`,sx:{color:`text.secondary`},children:[`last seen online `,en(h.lastSeenOnline)]})]}),I?(0,$.jsxs)(w,{sx:{mb:2},children:[!de&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dn,{label:`PING`,verdict:Wt(I.pingReachable,I.pingError),latencyMs:I.pingLatencyMs,error:I.pingError??null}),(0,$.jsx)(dn,{label:`SSH`,verdict:Wt(I.sshConnected,I.sshError),latencyMs:I.sshLatencyMs,error:I.sshError??null,detail:I.sshConnected==null&&!I.sshError?`this check reaches the node over Netron`:void 0})]}),(0,$.jsx)(dn,{label:`OMNITRON`,verdict:Gt(I),error:I.omnitronError??null,detail:I.omnitronConnected?[I.omnitronVersion&&`v${I.omnitronVersion}`,I.omnitronPid&&`pid ${I.omnitronPid}`,I.omnitronUptime!=null&&I.omnitronUptime>0&&`up ${En(I.omnitronUptime)}`].filter(Boolean).join(` · `):void 0}),(0,$.jsx)(H,{variant:`caption`,sx:{display:`block`,mt:1,color:`text.disabled`},children:I.checkedAt?`Taken ${new Date(I.checkedAt).toLocaleString()}`:`Never checked`})]}):(0,$.jsx)(H,{variant:`body2`,sx:{mb:2,color:`text.secondary`},children:`This node has never been checked.`}),(0,$.jsx)(F,{sx:{my:2}}),(0,$.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`},children:`Indicators, from the node's own titan-health`}),(0,$.jsx)(hn,{data:o,nodeName:n.name}),(0,$.jsx)(F,{sx:{my:2}}),(0,$.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`},children:`Running on this node`}),(0,$.jsx)(pn,{data:b,health:S}),(0,$.jsx)(F,{sx:{my:2}}),(0,$.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`},children:`Replication`}),!n.isLocal&&d&&(0,$.jsxs)(w,{sx:{py:1,overflowWrap:`anywhere`},children:[(0,$.jsx)(H,{variant:`body2`,children:xt(d).connection}),xt(d).error&&(0,$.jsx)(H,{variant:`caption`,color:`error.main`,children:xt(d).error}),!(l?.reachable&&l.sync)&&(0,$.jsxs)(H,{variant:`caption`,sx:{display:`block`,color:`text.secondary`},children:[`Replication: `,xt(d).replication]})]}),r&&(0,$.jsxs)(H,{variant:`body2`,sx:{overflowWrap:`anywhere`},children:[`Cluster · `,Jt(r)]}),(0,$.jsx)(gn,{data:l}),(0,$.jsx)(vn,{data:p}),(0,$.jsx)(F,{sx:{my:2}}),(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,mb:1},children:[(0,$.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`},children:`History`}),(0,$.jsx)(U,{size:`small`,sx:{ml:`auto`,minWidth:120},children:(0,$.jsx)(Fe,{value:_,inputProps:{"aria-label":`History entries`},onChange:e=>y(Number(e.target.value)),sx:{height:30,fontSize:12},children:zn.map(e=>(0,$.jsxs)(W,{value:e,sx:{fontSize:12},children:[`last `,e,` checks`]},e))})})]}),ie&&(0,$.jsx)(Re,{onClose:()=>oe(null),children:ie}),A&&i.length===0?(0,$.jsx)(ut,{height:120}):i.length===0&&!ie?(0,$.jsx)(H,{variant:`body2`,sx:{py:2,color:`text.secondary`},children:`No checks recorded. History is kept by the daemon that runs the health worker.`}):(0,$.jsx)(w,{sx:{maxHeight:360,overflowY:`auto`},children:i.map(e=>(0,$.jsx)(fn,{row:e,isLocal:de},`${e.nodeId}-${e.checkedAt}`))}),T&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(F,{sx:{my:2}}),(0,$.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`},children:`Workspace source bundle upgrade`}),(0,$.jsx)(mn,{data:T})]})]}),(0,$.jsxs)(ce,{children:[(0,$.jsx)(K,{permission:`OmnitronNodes.triggerNodeCheck`,children:(0,$.jsx)(v,{onClick:ue,disabled:ne,startIcon:(0,$.jsx)($e,{sx:{fontSize:16}}),children:ne?`Checking…`:`Check now`})}),!de&&(0,$.jsx)(K,{permission:`OmnitronNodes.upgradeNode`,children:(0,$.jsxs)(w,{component:`details`,children:[(0,$.jsx)(H,{component:`summary`,variant:`caption`,sx:{cursor:`pointer`},children:`Advanced · workspace source bundle`}),(0,$.jsx)(v,{onClick:P,disabled:O||se,startIcon:(0,$.jsx)(tt,{sx:{fontSize:16}}),children:se?`Upgrading…`:`Install source bundle`})]})}),(0,$.jsx)(w,{sx:{flexGrow:1}}),(0,$.jsx)(v,{onClick:t,children:`Close`})]})]})}function xn({node:e,onEdit:t,onRemove:n,onCheckSsh:i,onDiagnose:a,checking:o,uptimeData:s,lastCheckAt:c,newest:l,mesh:u}){let{status:d}=e,f=un(d,e.isLocal),p=d?.pingReachable==null?`unchecked`:d.pingReachable?`online`:`offline`,m=!e.isLocal&&tn(d?.checkedAt);return(0,$.jsx)(M,{sx:{height:`100%`,display:`flex`,flexDirection:`column`,transition:`box-shadow 0.2s`,"&:hover":{boxShadow:e=>e.shadows[8]}},children:(0,$.jsxs)(_,{sx:{pb:`12px !important`,flexGrow:1,display:`flex`,flexDirection:`column`},children:[(0,$.jsxs)(G,{direction:`row`,sx:{alignItems:`flex-start`,justifyContent:`space-between`,flexWrap:`wrap`,gap:1,mb:1.5},children:[(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,minWidth:0},children:[e.isLocal?(0,$.jsx)(rt,{sx:{fontSize:24,color:`primary.main`,flexShrink:0}}):(0,$.jsx)(Xe,{sx:{fontSize:24,color:`text.secondary`,flexShrink:0}}),(0,$.jsxs)(w,{sx:{minWidth:0},children:[(0,$.jsx)(H,{variant:`subtitle2`,noWrap:!0,children:e.name}),(0,$.jsxs)(H,{variant:`caption`,noWrap:!0,sx:{color:`text.disabled`},children:[e.host,e.isLocal?``:`:${e.sshPort}`]})]})]}),(0,$.jsxs)(G,{direction:`row`,spacing:.5,useFlexGap:!0,sx:{flexWrap:`wrap`,justifyContent:`flex-end`,flexShrink:0,maxWidth:`100%`},children:[!e.isLocal&&(0,$.jsx)(K,{permission:`OmnitronNodes.removeNode`,children:(0,$.jsx)(z,{title:`Remove`,children:(0,$.jsx)(Me,{size:`small`,"aria-label":`Remove node ${e.name}`,onClick:()=>n(e.id),color:`error`,sx:{marginInlineEnd:1},children:(0,$.jsx)(nt,{sx:{fontSize:18}})})})}),!e.isLocal&&(0,$.jsx)(K,{permission:`OmnitronTerminal.open`,children:(0,$.jsx)(v,{component:r,to:`/terminal?${new URLSearchParams({node:e.id})}`,size:`small`,children:`SSH`})}),!e.isLocal&&(0,$.jsx)(z,{title:o?`Checking...`:`Check SSH connection`,children:(0,$.jsx)(`span`,{children:(0,$.jsx)(K,{permission:`OmnitronNodes.checkNodeStatus`,children:(0,$.jsx)(Me,{size:`small`,"aria-label":`Check SSH connection`,onClick:()=>i(e.id),disabled:o,children:(0,$.jsx)($e,{sx:{fontSize:18,...o&&{animation:`${Pn} 1s linear infinite`}}})})})})}),(0,$.jsx)(z,{title:`Diagnostics`,children:(0,$.jsx)(Me,{size:`small`,"aria-label":`Diagnostics for ${e.name}`,onClick:()=>a(e),children:(0,$.jsx)(et,{sx:{fontSize:18}})})}),!e.isLocal&&(0,$.jsx)($.Fragment,{children:(0,$.jsx)(K,{permission:`OmnitronNodes.updateNode`,children:(0,$.jsx)(z,{title:`Edit`,children:(0,$.jsx)(Me,{size:`small`,"aria-label":`Edit node ${e.name}`,onClick:()=>t(e),children:(0,$.jsx)(Qe,{sx:{fontSize:18}})})})})})]})]}),(0,$.jsxs)(G,{direction:`row`,spacing:2,sx:{mb:1.5,alignItems:`center`},children:[e.isLocal?(0,$.jsx)(nn,{state:f.state,label:`OMNITRON`,tooltip:f.tooltip}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(nn,{state:p,label:`PING`,tooltip:d?.pingReachable?`${d.pingLatencyMs??`?`}ms`:d?.pingError??`Not checked`}),(0,$.jsx)(nn,{state:f.state,label:`OMNITRON`,tooltip:f.tooltip})]}),(0,$.jsx)(z,{arrow:!0,title:d?.checkedAt?`Last checked ${new Date(d.checkedAt).toLocaleString()}`:`This node has never been checked`,children:(0,$.jsx)(H,{variant:`caption`,noWrap:!0,sx:{ml:`auto`,fontSize:10,color:m?`warning.main`:`text.disabled`},children:en(d?.checkedAt)})})]}),(0,$.jsx)(F,{sx:{mb:1.5}}),(0,$.jsxs)(G,{spacing:.5,children:[d?.omnitronVersion&&(0,$.jsx)(wn,{version:d.omnitronVersion,standing:cn(d.omnitronVersion,l)}),(0,$.jsx)(Tn,{label:`Runtime`,value:e.runtime}),(0,$.jsx)(Tn,{label:`Daemon Port`,value:String(e.daemonPort)}),!e.isLocal&&(0,$.jsx)(Tn,{label:`SSH User`,value:e.sshUser}),d?.os&&(0,$.jsx)(Tn,{label:`OS`,value:`${d.os.platform} ${d.os.arch}`}),d?.omnitronUptime!=null&&d.omnitronUptime>0&&(0,$.jsx)(Tn,{label:`Uptime`,value:En(d.omnitronUptime)}),!e.isLocal&&(0,$.jsx)(Cn,{mesh:u})]}),e.tags.length>0&&(0,$.jsx)(G,{direction:`row`,spacing:.5,useFlexGap:!0,sx:{mt:1.5,flexWrap:`wrap`},children:e.tags.map(e=>(0,$.jsx)(D,{label:e,size:`small`,variant:`outlined`,sx:{height:22,fontSize:11}},e))}),!e.isLocal&&(0,$.jsx)(w,{sx:{mt:`auto`,pt:1.5},children:(0,$.jsxs)(G,{spacing:.75,children:[(0,$.jsx)(on,{data:s,metric:`ping`,label:`PING`,segWidth:In,gap:Ln,height:Rn,lastCheckAt:c}),(0,$.jsx)(on,{data:s,metric:`omnitron`,label:`OMNITRON`,segWidth:In,gap:Ln,height:Rn,lastCheckAt:c})]})})]})})}function Sn(e){let t=xt(e),n=[t.connection,t.error,`Replication: ${t.replication}`].filter(Boolean).join(` `);switch(t.state){case`not-joined`:return{text:`not joined`,tone:`idle`,tooltip:n};case`reconnecting`:return{text:e.reconnectAt==null?`disconnected`:`retrying`,tone:`bad`,tooltip:n};case`connecting`:return{text:`joining`,tone:`quiet`,tooltip:n};case`stale`:return{text:`stale heartbeat`,tone:`warn`,tooltip:n};case`unauthenticated`:return{text:`unauthenticated`,tone:`warn`,tooltip:n};case`connected`:return e.via===`ssh-tunnel`?{text:`over SSH`,tone:`info`,tooltip:n}:{text:`direct`,tone:`good`,tooltip:n};default:return{text:`disconnected`,tone:`bad`,tooltip:`RPC state is unavailable.`}}}function Cn({mesh:e}){if(!e)return null;let t=Sn(e);return(0,$.jsxs)(G,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.disabled`,fontSize:11},children:`Mesh`}),(0,$.jsx)(z,{arrow:!0,title:t.tooltip,children:(0,$.jsx)(H,{variant:`caption`,noWrap:!0,sx:{fontSize:11,color:Un[t.tone],maxWidth:190},children:t.text})})]})}function wn({version:e,standing:t}){let[n,r]=e.split(`+`),i=r?.split(`.`)[1],a=i?`${n} · ${i.slice(0,7)}`:n,o=t===`behind`?{text:`behind`,color:`warning.main`}:t===`differs`?{text:`differs`,color:`info.main`}:null;return(0,$.jsxs)(G,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.disabled`,fontSize:11},children:`Version`}),(0,$.jsx)(z,{arrow:!0,title:e,children:(0,$.jsxs)(G,{direction:`row`,spacing:.75,sx:{alignItems:`center`},children:[o&&(0,$.jsx)(H,{variant:`caption`,sx:{fontSize:10,color:o.color},children:o.text}),(0,$.jsx)(H,{variant:`caption`,noWrap:!0,sx:{fontSize:11,maxWidth:190},children:a})]})})]})}function Tn({label:e,value:t}){return(0,$.jsxs)(G,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.disabled`},children:e}),(0,$.jsx)(H,{variant:`caption`,sx:{fontWeight:500},children:t})]})}function En(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function Dn({open:e,onClose:t,onSubmit:n,editNode:r,sshKeys:i,loading:a,error:o,onDismissError:s}){let[c,l]=(0,Q.useState)(Wn);(0,Q.useEffect)(()=>{e&&l(r?{name:r.name,host:r.host,sshPort:r.sshPort,sshUser:r.sshUser,sshAuthMethod:r.sshAuthMethod,sshPrivateKey:r.sshPrivateKey??``,sshPassphrase:``,sshPassword:``,runtime:r.runtime,daemonPort:r.daemonPort,tags:r.tags.join(`, `)}:{...Wn,sshPrivateKey:i[0]?.path??``})},[r,i,e]);let u=(e,t)=>l(n=>({...n,[e]:t})),d=!!r,f=c.name.trim()&&c.host.trim();return(0,$.jsxs)(ae,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,children:[(0,$.jsx)(le,{children:d?`Edit "${r.name}"`:`Add Node`}),(0,$.jsxs)(te,{children:[o&&(0,$.jsx)(Re,{onClose:s,children:o}),(0,$.jsxs)(G,{spacing:2.5,sx:{mt:1},children:[(0,$.jsx)(B,{label:`Name`,value:c.name,onChange:e=>u(`name`,e.target.value),fullWidth:!0,placeholder:`production-server-1`,autoFocus:!0}),(0,$.jsxs)(G,{direction:{xs:`column`,sm:`row`},spacing:2,children:[(0,$.jsx)(B,{label:`Host`,value:c.host,onChange:e=>u(`host`,e.target.value),fullWidth:!0,placeholder:`192.168.1.100`}),(0,$.jsx)(B,{label:`SSH Port`,value:c.sshPort,onChange:e=>u(`sshPort`,parseInt(e.target.value,10)||22),sx:{width:{xs:`100%`,sm:120},flexShrink:0},type:`number`})]}),(0,$.jsxs)(G,{direction:{xs:`column`,sm:`row`},spacing:2,children:[(0,$.jsx)(B,{label:`SSH User`,value:c.sshUser,onChange:e=>u(`sshUser`,e.target.value),fullWidth:!0}),(0,$.jsxs)(U,{sx:{minWidth:160},children:[(0,$.jsx)(we,{children:`Auth Method`}),(0,$.jsxs)(Fe,{value:c.sshAuthMethod,label:`Auth Method`,inputProps:{"aria-label":`Auth Method`},onChange:e=>u(`sshAuthMethod`,e.target.value),children:[(0,$.jsx)(W,{value:`key`,children:`SSH Key`}),(0,$.jsx)(W,{value:`password`,children:`Password`})]})]})]}),c.sshAuthMethod===`key`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(U,{fullWidth:!0,children:[(0,$.jsx)(we,{children:`SSH Private Key`}),(0,$.jsxs)(Fe,{value:c.sshPrivateKey,label:`SSH Private Key`,inputProps:{"aria-label":`SSH Private Key`},onChange:e=>u(`sshPrivateKey`,e.target.value),children:[i.map(e=>(0,$.jsx)(W,{value:e.path,children:(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,width:`100%`},children:[(0,$.jsx)(H,{variant:`body2`,sx:{fontWeight:500},children:e.name}),(0,$.jsx)(D,{label:e.type,size:`small`,sx:{height:20,fontSize:11}}),(0,$.jsx)(H,{variant:`caption`,noWrap:!0,sx:{color:`text.disabled`,ml:`auto`},children:e.path})]})},e.path)),i.length===0&&(0,$.jsx)(W,{disabled:!0,children:(0,$.jsx)(H,{variant:`body2`,sx:{color:`text.secondary`},children:`No SSH keys found`})})]})]}),(0,$.jsx)(B,{label:`Key Passphrase`,value:c.sshPassphrase,onChange:e=>u(`sshPassphrase`,e.target.value),fullWidth:!0,type:`password`,placeholder:r?.hasPassphrase?`Encrypted — leave empty to keep`:`Leave empty if key is not encrypted`,size:`small`,helperText:r?.hasPassphrase?`Passphrase is stored encrypted. Enter new value to change.`:void 0})]}):(0,$.jsx)(B,{label:`SSH Password`,value:c.sshPassword,onChange:e=>u(`sshPassword`,e.target.value),fullWidth:!0,type:`password`,placeholder:r?.hasPassword?`Stored — leave empty to keep`:``,helperText:r?.hasPassword?`Password is stored encrypted. Enter a new value to change it.`:void 0}),(0,$.jsx)(F,{}),(0,$.jsxs)(G,{direction:{xs:`column`,sm:`row`},spacing:2,children:[(0,$.jsxs)(U,{sx:{minWidth:140},children:[(0,$.jsx)(we,{children:`Runtime`}),(0,$.jsxs)(Fe,{value:c.runtime,label:`Runtime`,inputProps:{"aria-label":`Runtime`},onChange:e=>u(`runtime`,e.target.value),children:[(0,$.jsx)(W,{value:`node`,children:`Node.js`}),(0,$.jsx)(W,{value:`bun`,children:`Bun`})]})]}),(0,$.jsx)(B,{label:`Daemon Port`,value:c.daemonPort,onChange:e=>u(`daemonPort`,parseInt(e.target.value,10)||9700),sx:{width:{xs:`100%`,sm:140},flexShrink:0},type:`number`}),(0,$.jsx)(B,{label:`Tags`,value:c.tags,onChange:e=>u(`tags`,e.target.value),fullWidth:!0,placeholder:`production, gpu`,helperText:`Comma-separated`})]})]})]}),(0,$.jsxs)(ce,{children:[(0,$.jsx)(v,{onClick:t,color:`inherit`,children:`Cancel`}),(0,$.jsx)(v,{variant:`contained`,loading:a,onClick:()=>n(c),disabled:!f||a,children:d?`Save`:`Add Node`})]})]})}function On({open:e,onClose:t,onSaved:n}){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[s,l]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{e&&(l(null),c.getCheckConfig().then(e=>i(e)).catch(e=>l(e?.message??`Could not read the current settings`)))},[e]);let u=(e,t)=>i(n=>n&&{...n,[e]:t});return(0,$.jsxs)(ae,{open:e,onClose:a?void 0:t,maxWidth:`xs`,fullWidth:!0,children:[(0,$.jsx)(le,{children:`Check Settings`}),(0,$.jsxs)(te,{children:[s&&(0,$.jsx)(Re,{onClose:()=>l(null),children:s}),r?(0,$.jsxs)(G,{spacing:2.5,sx:{mt:1},children:[(0,$.jsxs)(U,{fullWidth:!0,children:[(0,$.jsx)(we,{children:`ICMP Ping`}),(0,$.jsxs)(Fe,{value:r.pingEnabled?`on`:`off`,label:`ICMP Ping`,inputProps:{"aria-label":`ICMP Ping`},onChange:e=>u(`pingEnabled`,e.target.value===`on`),children:[(0,$.jsx)(W,{value:`on`,children:`Enabled`}),(0,$.jsx)(W,{value:`off`,children:`Disabled`})]})]}),(0,$.jsx)(B,{label:`Ping timeout (ms)`,type:`number`,fullWidth:!0,value:r.pingTimeout,onChange:e=>u(`pingTimeout`,parseInt(e.target.value,10)||0),helperText:`250-60000`,disabled:!r.pingEnabled}),(0,$.jsx)(B,{label:`SSH timeout (ms)`,type:`number`,fullWidth:!0,value:r.sshTimeout,onChange:e=>u(`sshTimeout`,parseInt(e.target.value,10)||0),helperText:`1000-120000`}),(0,$.jsx)(B,{label:`Omnitron probe timeout (ms)`,type:`number`,fullWidth:!0,value:r.omnitronCheckTimeout,onChange:e=>u(`omnitronCheckTimeout`,parseInt(e.target.value,10)||0),helperText:`1000-120000`}),(0,$.jsx)(B,{label:`Concurrent checks`,type:`number`,fullWidth:!0,value:r.concurrency,onChange:e=>u(`concurrency`,parseInt(e.target.value,10)||0),helperText:`1-100 - how many nodes are checked at once`})]}):(0,$.jsx)(ut,{variant:`rounded`,height:220})]}),(0,$.jsxs)(ce,{children:[(0,$.jsx)(v,{onClick:t,color:`inherit`,disabled:a,children:`Cancel`}),(0,$.jsx)(K,{permission:`OmnitronNodes.setCheckConfig`,children:(0,$.jsx)(v,{variant:`contained`,onClick:async()=>{if(r){o(!0),l(null);try{n(await c.setCheckConfig(r)),t()}catch(e){l(e?.message??`Failed to save settings.`)}finally{o(!1)}}},disabled:!r||a,children:a?`Saving...`:`Save`})})]})]})}function kn(){let{can:e}=He(),t=e(`OmnitronNodes.listSshKeys`),[n,r]=(0,Q.useState)([]),[i,a]=(0,Q.useState)([]),[o,s]=(0,Q.useState)(!0),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(!1),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)({}),[D,O]=(0,Q.useState)({}),[k,A]=(0,Q.useState)(null),[ee,ne]=(0,Q.useState)(!1),[re,ie]=(0,Q.useState)({uptimeIntervalMs:An,retentionDays:jn}),oe=(0,Q.useRef)(re);oe.current=re;let[j,M]=(0,Q.useState)(null),[N,se]=(0,Q.useState)(null),P=(0,Q.useRef)([]);P.current=n;let[F,ue]=(0,Q.useState)({}),I=(0,Q.useRef)(0),[de,fe]=(0,Q.useState)({}),L=(0,Q.useCallback)(async()=>{try{let e=await c.listNodes();r(e),A(null);let t=await Promise.allSettled(e.map(async e=>({id:e.id,at:(await c.getCheckHistory({nodeId:e.id,limit:1}))[0]?.checkedAt??null}))),n={},i=null;for(let e of t)e.status===`fulfilled`?n[e.value.id]=e.value.at:i??=e.reason?.message??`Could not read the latest recorded checks`;return O(e=>({...e,...n})),se(i),e}catch(e){return A(e?.message??`Could not reach the daemon`),P.current}finally{s(!1)}},[]),pe=(0,Q.useCallback)(async()=>{try{let e=await c.getMeshStatus();ue(Object.fromEntries(e.map(e=>[e.nodeId,e])))}catch{}},[]),R=(0,Q.useCallback)(async e=>{let t=++I.current,n=await Promise.allSettled(e.map(async e=>c.getNodeClusterState({nodeId:e.id}))),r={};n.forEach((t,n)=>{let i=e[n].id;r[i]=t.status===`fulfilled`&&t.value?.nodeId===i?t.value:{nodeId:i,reachable:!1,cluster:null,error:t.status===`rejected`&&t.reason instanceof Error?t.reason.message:`Cluster participation unavailable`}}),t===I.current&&fe(r)},[]),me=(0,Q.useCallback)(async e=>{let t={},n=null;await Promise.allSettled(e.map(async e=>{try{let{uptimeIntervalMs:n,retentionDays:r}=oe.current;t[e.id]=await c.getUptimeBar({nodeId:e.id,bucketCount:$t(r,n),intervalMs:n})}catch(e){n??=e?.message??`Could not load uptime history`}})),E(e=>({...e,...t})),M(n)},[]),he=(0,Q.useCallback)(async()=>{if(!t)a([]);else try{a(await c.listSshKeys())}catch{}},[t]),ge=qe(e=>e.connected),B=qe(e=>e.lastNodeEvent),_e=qe(e=>e.initialize);(0,Q.useEffect)(()=>_e(),[_e]),Ge(()=>void L(),{intervalMs:ge?12e4:3e4}),Ge(()=>void pe(),{intervalMs:15e3}),Ge(()=>R(P.current),{intervalMs:6e4}),(0,Q.useEffect)(()=>{B&&L()},[B,L]),Ge(()=>void(async()=>{await me(P.current)})(),{intervalMs:Mn});let ve=n.map(e=>e.id).sort().join(`,`);(0,Q.useEffect)(()=>{R(P.current),ve&&me(P.current)},[ve,R,me]),(0,Q.useEffect)(()=>{he()},[he]),(0,Q.useEffect)(()=>{Promise.resolve().then(()=>c.getHistoryConfig()).then(e=>ie(e)).catch(()=>{})},[]);let ye=(0,Q.useMemo)(()=>ln(n.map(e=>e.status?.omnitronVersion)),[n]),V=Ve(),be=(0,Q.useCallback)(async e=>{let t=n.find(t=>t.id===e)?.name??e;p(e);try{let n=await c.checkNodeStatus({id:e});if(n.sshConnected){let e=n.sshLatencyMs==null?``:` (${n.sshLatencyMs}ms)`;V.success(`${t}: SSH connected${e}`)}else n.sshConnected===!1?V.error(`${t}: SSH failed — ${n.sshError??`Connection refused`}`):V.warning(`${t}: this check did not use SSH — ${n.omnitronConnected?`omnitron answered on its Netron port`:n.omnitronError??`no answer on the Netron port`}`)}catch(e){V.error(`${t}: ${e?.message??`Check failed`}`)}finally{p(null)}},[n,V]),[xe,Se]=(0,Q.useState)(null),[Ce,we]=(0,Q.useState)(!1),[Te,U]=(0,Q.useState)(null),Ee=(0,Q.useRef)(!1),De=n.find(e=>e.id===xe),Oe=(0,Q.useCallback)(async()=>{if(xe&&!Ee.current){Ee.current=!0,we(!0),U(null);try{await c.removeNode({id:xe}),await L(),Se(null)}catch(e){U(e?.message??`Failed to remove node.`)}finally{Ee.current=!1,we(!1)}}},[xe,L]),ke=(0,Q.useCallback)(()=>{Ee.current||(Se(null),U(null))},[]),Ae=(0,Q.useCallback)(()=>{_(null),w(null),h(!0)},[]),je=(0,Q.useCallback)(e=>{_(e),w(null),h(!0)},[]),W=(0,Q.useCallback)(()=>{h(!1),_(null),w(null)},[]),Ne=(0,Q.useCallback)(async e=>{S(!0),w(null);try{let t={name:e.name.trim(),host:e.host.trim(),sshPort:e.sshPort,sshUser:e.sshUser.trim(),sshAuthMethod:e.sshAuthMethod,sshPrivateKey:e.sshAuthMethod===`key`?e.sshPrivateKey:void 0,sshPassphrase:e.sshAuthMethod===`key`&&e.sshPassphrase?e.sshPassphrase:void 0,sshPassword:e.sshAuthMethod===`password`&&e.sshPassword?e.sshPassword:void 0,runtime:e.runtime,daemonPort:e.daemonPort,tags:e.tags.split(`,`).map(e=>e.trim()).filter(Boolean)};g?await c.updateNode({id:g.id,...t}):await c.addNode(t),W(),await L()}catch(e){w(e?.message??`Failed to save node.`)}finally{S(!1)}},[g,L,W]),Fe=[...n].sort((e,t)=>e.isLocal===t.isLocal?e.name.localeCompare(t.name):e.isLocal?-1:1);return(0,$.jsxs)(G,{spacing:3,children:[(0,$.jsx)(ct,{links:[{name:`Nodes`}],action:(0,$.jsxs)(G,{direction:`row`,spacing:1,children:[(0,$.jsx)(K,{permission:`OmnitronNodes.setCheckConfig`,children:(0,$.jsx)(v,{variant:`outlined`,size:`small`,startIcon:(0,$.jsx)(Qe,{sx:{fontSize:18}}),onClick:()=>ne(!0),children:`Check Settings`})}),(0,$.jsx)(z,{title:`Refresh`,children:(0,$.jsx)(Me,{"data-console-command":`refresh`,size:`small`,"aria-label":`Refresh`,loading:l,onClick:async()=>{if(!d.current){d.current=!0,u(!0);try{let e=await L();await Promise.all([me(e),pe(),R(e)])}finally{d.current=!1,u(!1)}}},children:(0,$.jsx)($e,{sx:{fontSize:18}})})}),(0,$.jsx)(K,{permission:`OmnitronNodes.addNode`,children:(0,$.jsx)(v,{variant:`contained`,size:`small`,startIcon:(0,$.jsx)(Ye,{sx:{fontSize:18}}),onClick:Ae,children:`Add Node`})})]})}),(0,$.jsx)(ot,{active:l,label:`Refreshing node status`,detail:`Reading fleet, replication and uptime observations`}),(0,$.jsx)(_n,{states:de}),(0,$.jsx)(Pt,{nodes:n}),k&&(0,$.jsxs)(Re,{severity:`warning`,onClose:()=>A(null),children:[`Could not refresh the node list — `,k,`. The cards below are the last state the daemon reported.`]}),(j||N)&&(0,$.jsxs)(Re,{severity:`warning`,onClose:()=>{M(null),se(null)},children:[`Could not refresh the uptime history — `,j||N,`. The strips below are the last aggregation that arrived, and may be behind the cards.`]}),o?(0,$.jsx)(Pe,{container:!0,spacing:3,children:[1,2,3].map(e=>(0,$.jsx)(Pe,{size:{xs:12,sm:6,md:4},children:(0,$.jsx)(ut,{variant:`rounded`,height:300})},e))}):Fe.length===0?(0,$.jsx)(ft,{title:k?`No nodes to show`:`No nodes registered`,description:k?`The list could not be refreshed, so this may not be the whole picture.`:`Add a node to manage a remote host from here.`}):(0,$.jsx)(Pe,{container:!0,spacing:3,children:Fe.map(e=>(0,$.jsx)(Pe,{size:{xs:12,sm:6,md:4},children:(0,$.jsx)(xn,{node:e,onEdit:je,onRemove:Se,onCheckSsh:be,onDiagnose:b,checking:f===e.id,uptimeData:T[e.id]??[],lastCheckAt:D[e.id]??null,newest:ye,mesh:F[e.id]})},e.id))}),(0,$.jsx)(yn,{cluster:y?de[y.id]:void 0,open:!!y,onClose:()=>b(null),node:y?n.find(e=>e.id===y.id)??y:null}),(0,$.jsxs)(ae,{open:!!xe,onClose:ke,maxWidth:`xs`,fullWidth:!0,children:[(0,$.jsx)(le,{children:`Remove Node`}),(0,$.jsxs)(te,{children:[(0,$.jsxs)(H,{variant:`body2`,children:[`Remove `,(0,$.jsx)(`strong`,{children:De?.name??xe}),`? This cannot be undone.`]}),Te&&(0,$.jsx)(Re,{onClose:()=>U(null),children:Te})]}),(0,$.jsxs)(ce,{children:[(0,$.jsx)(v,{onClick:ke,color:`inherit`,disabled:Ce,children:`Cancel`}),(0,$.jsx)(K,{permission:`OmnitronNodes.removeNode`,children:(0,$.jsx)(v,{onClick:Oe,color:`error`,variant:`contained`,disabled:Ce,children:Ce?`Removing…`:`Remove`})})]})]}),(0,$.jsx)(K,{permission:g?`OmnitronNodes.updateNode`:`OmnitronNodes.addNode`,children:(0,$.jsx)(Dn,{open:m,onClose:W,onSubmit:Ne,editNode:g,sshKeys:i,loading:x,error:C,onDismissError:()=>w(null)})}),(0,$.jsx)(K,{permission:`OmnitronNodes.setCheckConfig`,children:(0,$.jsx)(On,{open:ee,onClose:()=>ne(!1),onSaved:e=>{V.success(`Check settings saved — ping ${e.pingEnabled?`on`:`off`}, SSH timeout ${e.sshTimeout}ms`),L()}})})]})}var Q,$,An,jn,Mn,Nn,Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn;function Gn(){return(Gn=e((()=>{at(),Ue(),Q=t(),l(),y(),x(),S(),Ce(),pe(),b(),je(),he(),C(),Ie(),re(),A(),ne(),se(),be(),Ne(),Le(),Ee(),De(),j(),Te(),p(),u(),h(),st(),dt(),ze(),lt(),Be(),Rt(),Vt(),o(),Ke(),Qt(),Ut(),Ct(),pt(),gt(),Je(),Ze(),$=n(),An=864e5,jn=90,Mn=3e5,Nn=3e5,Pn=d`
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{P as r,U as i,c as a,h as o,l as s,y as c,z as l}from"./client-CgyTwq9g.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-Bdr6Ks5j.js";import{C as g,D as _,F as v,H as y,I as b,M as x,O as S,Q as C,V as w,X as T,Y as E,Z as D,_t as O,at as k,c as A,ct as ee,d as te,f as ne,g as re,gt as ie,h as ae,ht as oe,i as j,j as M,lt as N,m as se,ot as P,p as ce,r as F,s as le,st as ue,ut as I,vt as de,w as fe}from"./mui-SNRRJ_vi.js";import{A as L,B as pe,C as R,D as me,F as z,I as he,O as ge,a as B,b as _e,d as ve,f as ye,k as V,o as be,w as xe,y as Se,z as H}from"./mui-B3fJdIMc.js";import{B as Ce,D as we,E as Te,G as U,K as Ee,O as De,T as Oe,U as ke,W as Ae,it as je,l as W,rt as Me,u as Ne,z as Pe}from"./mui-CMWGTMXv.js";import{C as Fe,_ as G,v as Ie,w as Le}from"./mui-CPEkFAPo.js";import{n as Re,r as ze}from"./alert-BdJ2uaY0.js";import{n as Be,r as Ve}from"./snackbar-CRX6eqRT.js";import{c as He,n as K,s as Ue}from"./access-I0f72P9m.js";import{n as We,r as Ge,t as Ke}from"./use-polled-resource-B22hhr5L.js";import{n as qe,t as Je}from"./realtime.store-C8D235-B.js";import{A as Ye,E as Xe,G as Ze,L as Qe,M as $e,g as et,m as tt,p as nt,s as rt,z as it}from"./icons-B9Ct8PJ9.js";import{n as at,t as ot}from"./operation-status-DHyYOT7G.js";import{n as st,t as ct}from"./page-breadcrumbs-3R8RZ3nA.js";import{n as lt,t as ut}from"./skeleton-BnVxAoeX.js";import{n as dt,t as ft}from"./empty-content-eyDOuOVp.js";import{r as pt,t as mt}from"./daemon-memory-BiEtr9jr.js";import{r as ht,t as gt}from"./log-location-DuBjh6HQ.js";import{p as _t,u as vt}from"./release-bits-IehuBssK.js";import{a as yt,c as bt,i as xt,o as St,r as Ct,s as wt,t as Tt}from"./sync-reading-CN0jPKAg.js";function Et(e){let t=e.relay;if(!e.reachable||!t)return{state:`unknown`,label:`unavailable`,detail:e.error??`No relay measurement was returned; check node connectivity and access.`};if(t.state===`not-applicable`)return{state:`neutral`,label:`not applicable`,detail:`Worker logs and metrics use the durable replication outbox. Delivery evidence is reported under Replication.`};let n=t.stats;if(!n||typeof n.started!=`boolean`||!n.destination)return{state:`unknown`,label:`unavailable`,detail:`The node did not report relay lifecycle and destination; update its backend.`};let r=n.buffer.totalDropped>0||!!n.lastError;return{state:n.started&&(n.destination===`aggregator`||n.destination===`transport`&&n.transportConnected)&&!r?`healthy`:`degraded`,label:n.started?n.destination===`aggregator`?`local database`:n.destination===`transport`?n.transportConnected?`transport up`:`transport down`:`no destination`:`stopped`,detail:`${n.buffer.size} buffered · ${n.totalSent} sent · ${n.totalFailed} failed${n.lastError?` · ${n.lastError}`:``}`,dropped:n.buffer.totalDropped}}function Dt({receipt:e}){let t=e.targets.filter(e=>e.state===`succeeded`||e.state===`current`).length,n=e.state===`planning`,r=n?e.targets.filter(e=>e.state!==`pending`).length:t;return(0,J.jsxs)(G,{spacing:1.25,sx:{minWidth:0,overflowWrap:`anywhere`},children:[(0,J.jsxs)(G,{direction:`row`,useFlexGap:!0,spacing:1,sx:{flexWrap:`wrap`,alignItems:`center`},children:[(0,J.jsx)(D,{size:`small`,color:At[e.state],label:e.state}),(0,J.jsxs)(H,{variant:`body2`,"aria-live":`polite`,children:[r,`/`,e.targets.length,` `,n?`nodes checked`:`on target`]}),(0,J.jsxs)(H,{variant:`caption`,color:`text.secondary`,children:[`Updated `,_t(e.updatedAt)]})]}),(0,J.jsxs)(H,{variant:`caption`,color:`text.secondary`,component:`div`,children:[`Commit `,(0,J.jsx)(`code`,{children:e.commit}),(0,J.jsx)(`br`,{}),`Plan `,(0,J.jsx)(`code`,{children:e.id})]}),(n||e.state===`running`)&&(0,J.jsx)(Oe,{"aria-label":n?`Node preflight checks completed`:`Nodes confirmed on the target build`,variant:`determinate`,value:r/Math.max(1,e.targets.length)*100}),e.reason&&(0,J.jsx)(k,{severity:e.state===`failed`?`error`:`warning`,children:e.reason}),e.state===`uncertain`&&(0,J.jsx)(H,{variant:`body2`,children:`Reconciliation reads the recorded node outcome without replaying activation. Inspect its owner and rollback target before planning another update.`}),(0,J.jsx)(G,{component:`ol`,spacing:1,sx:{m:0,pl:0,listStyle:`none`},children:e.targets.map((e,t)=>(0,J.jsxs)(w,{component:`li`,sx:{minWidth:0,borderTop:1,borderColor:`divider`,pt:1},children:[(0,J.jsxs)(G,{direction:`row`,useFlexGap:!0,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,J.jsxs)(H,{variant:`body2`,sx:{fontWeight:600},children:[t+1,`. `,e.name]}),(0,J.jsx)(D,{size:`small`,variant:`outlined`,color:At[e.state],label:e.state})]}),e.reason&&(0,J.jsx)(H,{variant:`body2`,children:e.reason}),(0,J.jsxs)(w,{component:`details`,open:[`blocked`,`failed`,`rolled-back`,`uncertain`].includes(e.state),sx:{typography:`caption`,color:`text.secondary`,"& summary":{cursor:`pointer`}},children:[(0,J.jsx)(`summary`,{children:`Owner and rollback details`}),`Node `,(0,J.jsx)(`code`,{children:e.nodeId}),` · Owner `,(0,J.jsx)(`code`,{children:e.ownerId??`unconfirmed`}),e.ownerPid!==null&&(0,J.jsxs)(J.Fragment,{children:[` · PID `,e.ownerPid]}),(0,J.jsx)(`br`,{}),`Rollback target `,(0,J.jsx)(`code`,{children:e.previous??`unconfirmed`}),(0,J.jsx)(`br`,{}),`Candidate `,(0,J.jsx)(`code`,{children:e.candidate??`unconfirmed`})]})]},e.nodeId))})]})}function Ot({nodes:e,close:t,review:n}){let[r,i]=(0,q.useState)(``),[o,s]=(0,q.useState)([]),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(!1),{can:p}=He(),m=p(`OmnitronDaemon.status`),h=p(`OmnitronNodes.listKernelBuilds`),_=We(()=>c.listKernelBuilds(),{enabled:h,paused:!0,intervalMs:3e4,resourceKey:String(h)}),y=(0,q.useMemo)(()=>{let e=new Map;for(let t of h?_.data??[]:[]){let n=e.get(t.commit)??[];n.push(`${t.platform}/${t.arch} · Node ${t.nodeVersion}`),e.set(t.commit,n)}return e},[h,_.data]),b=We(async()=>{let{build:e}=await a.status();return e?.dirty===!1&&/^[a-f0-9]{40}$/.test(e.commit)?e.commit:null},{enabled:m,paused:!0,intervalMs:3e4,resourceKey:String(m)}),[x,S]=(0,q.useState)(!1),[C,T]=(0,q.useState)(null),D=(0,q.useRef)(!1),O=(0,q.useRef)(null);(0,q.useEffect)(()=>(D.current=!0,()=>{D.current=!1}),[]);let A=r.trim().toLowerCase(),ee=/^[a-f0-9]{40}$/.test(A)&&(d||o.length>0),ne=async()=>{if(ee&&!x){S(!0),T(null);try{let e={commit:A,...o.length?{nodeIds:o.map(e=>e.id)}:{},...l&&{stage:!0}},t=JSON.stringify(e);O.current&&O.current.inputs===t||(O.current={inputs:t,id:crypto.randomUUID()});let r=await c.planKernelRollout({...e,requestId:O.current.id});if(r.id!==O.current.id)throw Error(`Controller returned a different request ID.`);D.current&&n(r.id)}catch(e){T(e instanceof Error?e.message:String(e))}finally{S(!1)}}};return(0,J.jsxs)(ae,{open:!0,fullWidth:!0,maxWidth:`sm`,onClose:()=>{x||t()},"aria-labelledby":`kernel-plan-title`,children:[(0,J.jsx)(le,{id:`kernel-plan-title`,children:`Plan backend update`}),(0,J.jsxs)(w,{component:`form`,onSubmit:e=>{e.preventDefault(),ne()},children:[(0,J.jsx)(te,{children:(0,J.jsxs)(G,{spacing:2,children:[(0,J.jsx)(E,{freeSolo:!0,disabled:x,options:[...y.keys()],loading:h&&_.loading,inputValue:r,onInputChange:(e,t)=>i(t),renderOption:({key:e,...t},n)=>(0,J.jsx)(w,{component:`li`,...t,children:(0,J.jsxs)(w,{sx:{minWidth:0,overflowWrap:`anywhere`},children:[(0,J.jsx)(`code`,{children:n}),(0,J.jsx)(H,{component:`div`,variant:`caption`,children:y.get(n)?.join(`, `)})]})},e),renderInput:e=>(0,J.jsx)(B,{...e,label:`Target commit`,autoFocus:!0,required:!0,fullWidth:!0,helperText:_.error?`Catalog unavailable. Enter the commit manually. ${_.error}`:`Choose a catalog build or enter the full 40-character Git commit.`})}),m&&b.data&&(0,J.jsxs)(v,{size:`small`,sx:{alignSelf:`flex-start`},disabled:x,onClick:()=>i(b.data),children:[`Use controller commit `,b.data.slice(0,12)]}),(0,J.jsx)(E,{multiple:!0,disabled:x||d,options:e.filter(e=>!e.isLocal),value:o,getOptionLabel:e=>e.name+` · `+e.host,getOptionKey:e=>e.id,isOptionEqualToValue:(e,t)=>e.id===t.id,onChange:(e,t)=>s(t),renderInput:e=>(0,J.jsx)(B,{...e,label:`Target nodes`,helperText:`Select nodes in update order, or explicitly choose all registered remote nodes.`})}),(0,J.jsx)(ke,{control:(0,J.jsx)(g,{checked:d,disabled:x,onChange:e=>{f(e.target.checked),e.target.checked&&s([])}}),label:`All registered remote nodes`}),(0,J.jsx)(ke,{control:(0,J.jsx)(g,{checked:l,disabled:x,onChange:e=>u(e.target.checked)}),label:`Stage from controller catalog`}),l&&(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,children:`Preparation transfers missing runtimes from the controller and installs them for native checks. Applying the reviewed plan activates them.`}),C&&(0,J.jsx)(k,{severity:`warning`,action:O.current&&(0,J.jsx)(v,{size:`small`,color:`inherit`,onClick:()=>n(O.current.id),children:`Check last request`}),children:C})]})}),(0,J.jsxs)(ce,{children:[(0,J.jsx)(v,{onClick:t,disabled:x,children:`Cancel`}),(0,J.jsx)(v,{type:`submit`,variant:`contained`,loading:x,disabled:!ee,children:`Prepare plan`})]})]})]})}function kt({nodes:e,canPlan:t,canApply:n,canReconcile:r}){let[a,o]=i(),s=a.get(`rollout`),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(null),[y,b]=(0,q.useReducer)(e=>e+1,0),[x,S]=(0,q.useState)(!1),{data:C,error:T,loading:E}=We(async()=>{let e=await c.getKernelRollout(s?{id:s}:{});if(s&&e&&e.id!==s)throw Error(`Controller returned another rollout receipt.`);return e},{intervalMs:x?3e3:2e4,resourceKey:JSON.stringify([s,y])}),D=h?.id===s&&([`succeeded`,`failed`,`blocked`].includes(h.state)||!C||C.id===h.id&&C.state===`planned`&&h.state===`running`)?h:C;(0,q.useEffect)(()=>{S(D?.state===`running`||D?.state===`planning`)},[D?.state]);let O=e=>{m(null),g(null),o(t=>{let n=new URLSearchParams(t);return e?n.set(`rollout`,e):n.delete(`rollout`),n})},A=async e=>{if(!(d||T||!D||D.id!==s)&&!(e===`apply`?!n||D.state!==`planned`:!r||D.state!==`uncertain`)){f(!0),m(null);try{let t=e===`apply`?await c.startKernelRollout({id:D.id}):await c.reconcileKernelRollout({id:D.id});if(t.id!==D.id)throw Error(`Controller returned another rollout receipt.`);g(t)}catch(e){m(`Request was not confirmed. Check the controller receipt. `+(e instanceof Error?e.message:String(e)))}finally{f(!1),b()}}};return(0,J.jsxs)(M,{variant:`outlined`,component:`section`,"aria-label":`Managed backend updates`,sx:{minWidth:0},children:[(0,J.jsx)(_,{children:(0,J.jsxs)(G,{spacing:1.5,children:[(0,J.jsxs)(G,{direction:`row`,useFlexGap:!0,spacing:1,sx:{flexWrap:`wrap`,alignItems:`center`},children:[(0,J.jsx)(H,{variant:`subtitle2`,sx:{flex:`1 1 auto`},children:`Managed backend updates`}),s&&(0,J.jsx)(v,{size:`small`,disabled:d,onClick:()=>O(null),children:`Latest rollout`}),t&&(0,J.jsx)(v,{size:`small`,variant:`outlined`,disabled:d||D?.state===`running`||D?.state===`planning`,onClick:()=>u(!0),children:`Plan update…`})]}),E&&(0,J.jsx)(Oe,{"aria-label":`Reading rollout receipt`}),T&&(0,J.jsxs)(k,{severity:`warning`,action:(0,J.jsx)(v,{color:`inherit`,size:`small`,onClick:b,children:`Retry`}),children:[`Could not read the rollout receipt. `,T]}),p&&(0,J.jsx)(k,{severity:`warning`,children:p}),D?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Dt,{receipt:D}),n&&D.state===`planned`&&(0,J.jsx)(w,{children:D.id===s?(0,J.jsx)(v,{color:`primary`,variant:`contained`,loading:d,disabled:!!T||E,onClick:()=>void A(`apply`),children:`Apply reviewed plan`}):(0,J.jsx)(v,{variant:`outlined`,disabled:!!T,onClick:()=>O(D.id),children:`Review plan`})}),r&&D.state===`uncertain`&&(0,J.jsx)(w,{children:D.id===s?(0,J.jsx)(v,{variant:`outlined`,loading:d,disabled:!!T||E,onClick:()=>void A(`reconcile`),children:`Reconcile node status`}):(0,J.jsx)(v,{variant:`outlined`,disabled:!!T,onClick:()=>O(D.id),children:`Inspect uncertain rollout`})})]}):!E&&!T&&(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:s?`The controller has no receipt for this rollout.`:`No managed backend update has been planned.`})]})}),t&&l&&(0,J.jsx)(Ot,{nodes:e,close:()=>u(!1),review:e=>{O(e),u(!1),b()}})]})}var q,J,At;function jt(){return(jt=e((()=>{q=t(),l(),P(),T(),y(),b(),x(),S(),fe(),C(),re(),se(),ne(),A(),Ae(),Te(),Ie(),be(),pe(),Ke(),o(),Ue(),vt(),J=n(),At={pending:`default`,planning:`info`,planned:`default`,ready:`info`,running:`info`,succeeded:`success`,current:`success`,blocked:`warning`,uncertain:`warning`,failed:`error`,"rolled-back":`warning`}})))()}function Mt(e){return s.invoke(`daemon`,`OmnitronNodes`,`planUpgrade`,[{...e,build:!0}],{timeout:18e4})}function Nt(e){return e!==`done`&&e!==`failed`&&e!==`refused`}function Pt({nodes:e}){let{can:t,snapshot:n}=He(),[r,i]=(0,Y.useState)(!1),a=t(`OmnitronNodes.planKernelRollout`),o=t(`OmnitronNodes.startKernelRollout`),s=t(`OmnitronNodes.reconcileKernelRollout`);return(0,X.jsxs)(G,{spacing:1,children:[t(`OmnitronNodes.getKernelRollout`)&&(0,X.jsx)(kt,{nodes:e,canPlan:a,canApply:o,canReconcile:s},JSON.stringify([n?.userId,a,o,s])),t(`OmnitronNodes.getUpgradeProgress`)&&(0,X.jsxs)(w,{component:`details`,onToggle:e=>i(e.currentTarget.open),children:[(0,X.jsx)(H,{component:`summary`,variant:`caption`,color:`text.secondary`,sx:{cursor:`pointer`,py:1},children:`Advanced · workspace source bundle upgrades`}),r&&(0,X.jsx)(Ft,{nodes:e},n?.userId)]})]})}function Ft({nodes:e}){let{can:t}=He(),n=t(`OmnitronNodes.planUpgrade`)&&t(`OmnitronNodes.upgradeNodes`),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(null),[s,l]=(0,Y.useState)(!1),{data:u,refresh:d,error:f,loading:p}=We(async()=>{let e=await c.getUpgradeProgress();return l(e.some(e=>Nt(e.phase))),e},{intervalMs:s?3e3:2e4}),m=u??[],h=m.filter(e=>Nt(e.phase)),g=(0,Y.useMemo)(()=>new Map(e.map(e=>[e.id,e])),[e]),y=(0,Y.useCallback)(async e=>{try{let t=await c.cancelUpgrade({nodeId:e});o(t.stopped?null:t.because),await d()}catch(e){o(e.message)}},[d]);return(0,X.jsxs)(M,{variant:`outlined`,children:[(0,X.jsxs)(_,{children:[(0,X.jsxs)(G,{direction:`row`,spacing:1.5,sx:{alignItems:`center`,flexWrap:`wrap`,mb:h.length>0||m.length>0?1.5:0},children:[(0,X.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`,fontSize:`0.65rem`},children:`Workspace source bundle upgrade`}),h.length>0&&(0,X.jsx)(D,{size:`small`,color:`info`,label:`${h.length} of ${m.length} in flight`,sx:{height:20,fontSize:11}}),(0,X.jsx)(w,{sx:{flex:1}}),n&&(0,X.jsx)(v,{size:`small`,variant:`contained`,startIcon:(0,X.jsx)(tt,{}),onClick:()=>i(!0),children:`Upgrade nodes…`})]}),a&&(0,X.jsx)(k,{severity:`warning`,variant:`outlined`,sx:{mb:1.5},onClose:()=>o(null),children:a}),p&&(0,X.jsx)(Oe,{"aria-label":`Reading source bundle upgrade progress`}),f&&(0,X.jsxs)(k,{severity:`warning`,children:[`Could not refresh source bundle upgrades. `,f]}),m.length===0&&!p&&!f?(0,X.jsx)(H,{variant:`body2`,sx:{color:`text.secondary`},children:`No upgrade has been run from this master since it started.`}):(0,X.jsx)(G,{spacing:1,children:m.map(e=>{let t=g.get(e.nodeId);return(0,X.jsxs)(w,{children:[(0,X.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,X.jsx)(H,{variant:`body2`,sx:{fontWeight:600,minWidth:140},children:t?.name??e.nodeId}),(0,X.jsx)(D,{size:`small`,color:Lt[e.phase],label:e.phase,sx:{height:20,fontSize:11}}),e.phase===`queued`&&e.position!=null&&(0,X.jsxs)(H,{variant:`caption`,sx:{color:`text.secondary`},children:[`#`,e.position,` in the queue`]}),(0,X.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`},children:e.message}),e.version&&(0,X.jsx)(H,{variant:`caption`,sx:{fontFamily:`monospace`,color:`text.secondary`},children:e.version}),(0,X.jsx)(w,{sx:{flex:1}}),(0,X.jsx)(H,{variant:`caption`,sx:{color:`text.disabled`},children:_t(e.at)}),Nt(e.phase)&&(0,X.jsx)(K,{permission:`OmnitronNodes.cancelUpgrade`,children:(0,X.jsx)(z,{title:e.phase===`queued`?`Drop this node from the queue`:`A node already installing is not interrupted — the daemon will say so`,arrow:!0,children:(0,X.jsx)(`span`,{children:(0,X.jsx)(v,{size:`small`,color:`warning`,startIcon:(0,X.jsx)(it,{}),onClick:()=>void y(e.nodeId),children:`Cancel`})})})})]}),Nt(e.phase)&&e.phase!==`queued`&&(0,X.jsx)(Oe,{variant:`determinate`,value:e.percent,sx:{mt:.5,height:4,borderRadius:2}})]},e.nodeId)})})]}),n&&(0,X.jsx)(It,{open:r,onClose:()=>i(!1),nodes:e,onStarted:()=>{l(!0),d()}})]})}function It({open:e,onClose:t,nodes:n,onStarted:r}){let[i,a]=(0,Y.useState)(new Set),[o,s]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(1),[h,_]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),x=(0,Y.useMemo)(()=>n.filter(e=>!e.isLocal),[n]),S=(0,Y.useMemo)(()=>new Map(n.map(e=>[e.id,e])),[n]),C=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),s(null),n}),T=i.size>0&&i.size===x.length,E=(0,Y.useCallback)(async e=>{u(!0),_(null);let t=i.size>0?{nodeIds:[...i]}:{};try{s(e?await Mt(t):await c.planUpgrade(t))}catch(e){_(e.message),s(null)}finally{u(!1)}},[i]),O=o?.rows.filter(e=>e.action===`upgrade`)??[];return(0,X.jsxs)(ae,{open:e,onClose:d?void 0:t,maxWidth:`md`,fullWidth:!0,children:[(0,X.jsx)(le,{children:`Upgrade nodes`}),(0,X.jsx)(te,{children:(0,X.jsxs)(G,{spacing:2.5,sx:{mt:1},children:[(0,X.jsx)(H,{variant:`body2`,sx:{color:`text.secondary`},children:`The master builds one bundle and installs it on each node in turn. The rollout runs in the daemon — closing this window does not stop it.`}),(0,X.jsxs)(w,{children:[(0,X.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:.5},children:[(0,X.jsx)(g,{size:`small`,checked:T,indeterminate:i.size>0&&!T,onChange:()=>{s(null),a(T?new Set:new Set(x.map(e=>e.id)))}}),(0,X.jsx)(H,{variant:`body2`,children:i.size===0?`every node`:`${i.size} of ${x.length} selected`})]}),(0,X.jsx)(w,{sx:{maxHeight:220,overflowY:`auto`},children:(0,X.jsx)(V,{size:`small`,children:(0,X.jsx)(me,{children:x.map(e=>(0,X.jsxs)(ve,{hover:!0,onClick:()=>C(e.id),sx:{cursor:`pointer`},children:[(0,X.jsx)(R,{padding:`checkbox`,children:(0,X.jsx)(g,{size:`small`,checked:i.has(e.id)})}),(0,X.jsx)(R,{sx:{fontWeight:600},children:e.name}),(0,X.jsxs)(R,{sx:{fontFamily:`monospace`,fontSize:12},children:[e.host,`:`,e.sshPort]}),(0,X.jsx)(R,{sx:{fontFamily:`monospace`,fontSize:12},children:e.status?.omnitronVersion??`—`}),(0,X.jsx)(R,{children:(0,X.jsx)(D,{size:`small`,label:e.status?.pingReachable?`reachable`:`not reachable`,color:e.status?.pingReachable?`success`:`default`,variant:`outlined`,sx:{height:18,fontSize:10}})})]},e.id))})})})]}),(0,X.jsxs)(G,{direction:`row`,spacing:1.5,sx:{alignItems:`center`},children:[(0,X.jsx)(v,{size:`small`,variant:`outlined`,onClick:()=>void E(!1),disabled:l||d,children:l?`Planning…`:`Plan`}),(0,X.jsx)(z,{title:`Builds the bundle so each node can be compared to it. It runs on the master's own thread and stops it answering anything else for a minute or two.`,arrow:!0,children:(0,X.jsx)(`span`,{children:(0,X.jsx)(v,{size:`small`,onClick:()=>void E(!0),disabled:l||d,children:`Compare versions`})})}),l&&(0,X.jsx)(ue,{size:16}),(0,X.jsx)(B,{select:!0,label:`At once`,size:`small`,value:p,onChange:e=>m(Number(e.target.value)),sx:{width:120},disabled:d,children:[1,2,3,4,6,8].map(e=>(0,X.jsx)(W,{value:e,children:e},e))}),(0,X.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`},children:l?`The master is building the bundle so the plan can name a target version — up to a few minutes.`:`An upgrade restarts the node's daemon, so one at a time is the safe default.`})]}),o&&(0,X.jsxs)(w,{children:[o.refusal&&(0,X.jsx)(k,{severity:`error`,sx:{mb:1},children:(0,X.jsx)(H,{variant:`body2`,sx:{whiteSpace:`pre-wrap`},children:o.refusal})}),o.compared?(0,X.jsxs)(H,{variant:`body2`,sx:{mb:1},children:[`Target `,(0,X.jsx)(`strong`,{style:{fontFamily:`monospace`},children:o.targetVersion}),` —`,` `,O.length,` would be upgraded, `,o.rows.filter(e=>e.action===`skip`).length,` already there,`,` `,o.rows.filter(e=>e.action===`refuse`).length,` refused.`]}):(0,X.jsxs)(w,{sx:{mb:1},children:[(0,X.jsxs)(H,{variant:`body2`,children:[O.length,` would be attempted, `,o.rows.filter(e=>e.action===`refuse`).length,` refused —`,` `,(0,X.jsx)(`strong`,{children:`nothing was compared`}),`.`]}),(0,X.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`},children:`No bundle has been built, so no row can say «already on the target version». Twelve rows reading «upgrade» here mean twelve nodes that would be touched, not twelve that are out of date.`})]}),(0,X.jsxs)(V,{size:`small`,children:[(0,X.jsx)(Se,{children:(0,X.jsxs)(ve,{children:[(0,X.jsx)(R,{children:`Node`}),(0,X.jsx)(R,{children:o.compared?`Now → target`:`Now`}),(0,X.jsx)(R,{children:`Action`}),(0,X.jsx)(R,{children:`Why`})]})}),(0,X.jsx)(me,{children:o.rows.map(e=>(0,X.jsxs)(ve,{children:[(0,X.jsxs)(R,{children:[(0,X.jsx)(H,{variant:`body2`,sx:{fontWeight:600},children:e.label}),(0,X.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:e.host??`no address`})]}),(0,X.jsxs)(R,{sx:{fontFamily:`monospace`,fontSize:12},children:[e.currentVersion??`—`,o.compared&&e.targetVersion&&e.targetVersion!==e.currentVersion&&(0,X.jsxs)(H,{component:`span`,variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:[` → `,e.targetVersion]})]}),(0,X.jsx)(R,{children:(0,X.jsx)(D,{size:`small`,label:e.action,color:e.action===`upgrade`?`info`:e.action===`skip`?`success`:`warning`,variant:`outlined`,sx:{height:18,fontSize:10}})}),(0,X.jsx)(R,{children:(0,X.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`},children:e.because})})]},e.nodeId))})]})]}),y&&(0,X.jsxs)(w,{children:[(0,X.jsx)(F,{sx:{mb:1.5}}),(0,X.jsxs)(k,{severity:y.refused.length>0?`warning`:`success`,children:[`Queued `,y.accepted.length,` node`,y.accepted.length===1?``:`s`,y.refused.length>0?`; ${y.refused.length} not taken`:``,`.`]}),y.refused.map(e=>(0,X.jsxs)(H,{variant:`caption`,sx:{display:`block`,mt:.5,color:`text.secondary`},children:[(0,X.jsx)(`strong`,{children:S.get(e.nodeId)?.name??e.nodeId}),` — `,e.because]},e.nodeId))]}),h&&(0,X.jsxs)(k,{severity:`error`,children:[(0,X.jsx)(H,{variant:`body2`,sx:{whiteSpace:`pre-wrap`},children:h}),/^(HTTP 50\d|Request timeout)/.test(h)&&(0,X.jsxs)(H,{variant:`caption`,sx:{display:`block`,mt:.5},children:[`The plan builds the bundle first — that is how it can say «already on the target version» instead of listing every node as an upgrade — and the request outlived the gateway's 120-second deadline. The master is still building; the CLI (`,(0,X.jsx)(`code`,{children:`omnitron fleet upgrade --dry-run`}),`) has no such deadline.`]})]})]})}),(0,X.jsxs)(ce,{children:[(0,X.jsx)(v,{onClick:t,size:`small`,disabled:d,children:y?`Close`:`Cancel`}),(0,X.jsx)(v,{variant:`contained`,size:`small`,startIcon:d?(0,X.jsx)(ue,{size:14,color:`inherit`}):(0,X.jsx)(tt,{}),disabled:d||!o||O.length===0||!!o.refusal||y!==null,onClick:async()=>{f(!0),_(null);try{let e=await c.upgradeNodes({nodeIds:O.map(e=>e.nodeId),concurrency:p});b(e),r()}catch(e){_(e.message)}finally{f(!1)}},children:d?`Queueing…`:`Start rollout (${O.length})`})]})]})}var Y,X,Lt;function Rt(){return(Rt=e((()=>{Ue(),jt(),Y=t(),P(),y(),b(),x(),S(),fe(),C(),ee(),re(),se(),ne(),A(),j(),Te(),Ne(),Ie(),L(),ge(),xe(),_e(),ye(),be(),he(),pe(),Ze(),Ke(),o(),vt(),X=n(),Lt={queued:`default`,building:`info`,transferring:`info`,activating:`warning`,done:`success`,failed:`error`,refused:`error`}})))()}function zt(e){if(!e||typeof e!=`object`)return!1;let t=e;return!!(t.event&&typeof t.event.id==`string`&&typeof t.event.title==`string`&&Array.isArray(t.event.evidence)&&t.event.evidence.every(e=>typeof e==`string`)&&(t.event.remedy===void 0||typeof t.event.remedy==`string`)&&typeof t.occurrences==`number`)}function Bt({active:e,nodeName:t}){let n=Array.isArray(e)?e.filter(zt).slice(0,100):[];return n.length?(0,Z.jsxs)(O,{disableGutters:!0,elevation:0,sx:{minWidth:0,mt:1,"&:before":{display:`none`}},children:[(0,Z.jsx)(N,{"aria-label":`Runtime diagnostic evidence`,children:(0,Z.jsxs)(H,{variant:`body2`,children:[`Evidence and recovery · `,n.length]})}),(0,Z.jsx)(oe,{children:(0,Z.jsxs)(G,{spacing:2,sx:{minWidth:0,overflowWrap:`anywhere`},children:[n.map(({event:e,occurrences:t})=>(0,Z.jsxs)(G,{spacing:.5,children:[(0,Z.jsx)(H,{variant:`body2`,sx:{fontWeight:600},children:e.title}),(0,Z.jsxs)(H,{variant:`caption`,sx:{fontFamily:`monospace`,color:`text.secondary`},children:[e.id,` · `,t,` occurrence(s)`]}),e.evidence.map((e,t)=>(0,Z.jsx)(H,{variant:`body2`,children:e},t)),e.remedy&&(0,Z.jsx)(H,{variant:`body2`,sx:{color:`text.secondary`},children:e.remedy})]},e.id)),(0,Z.jsx)(v,{component:r,to:ht(`omnitron`,t),size:`small`,sx:{alignSelf:`flex-start`},children:`Open daemon logs`})]})})]}):null}var Z;function Vt(){return(Vt=e((()=>{l(),de(),I(),ie(),b(),Ie(),pe(),gt(),Z=n()})))()}function Ht(e){if(e.omnitronConnected===!0)return`running`;let t=e.omnitronError??``;return t.startsWith(`omnitron: command not found`)?`not-installed`:e.sshConnected===!1?`unreachable`:e.omnitronConnected===!1&&t===`omnitron status reported no running daemon`?`not-running`:`unread`}function Ut(){return(Ut=e((()=>{})))()}function Wt(e,t){return e==null?t?`failed`:`unmeasured`:e?`ok`:`failed`}function Gt(e){let t=Ht({sshConnected:e.sshConnected??null,omnitronConnected:e.omnitronConnected??null,omnitronError:e.omnitronError??null});switch(t){case`running`:return`ok`;case`not-running`:case`not-installed`:return`failed`;case`unreachable`:return`unmeasured`;case`unread`:return e.omnitronConnected==null&&!e.omnitronError?`unmeasured`:`unknown`;default:return t}}function Kt(e){return e.pingError??e.sshError??e.omnitronError??null}function qt(e){return e.participant===`controller`||!e.participant&&(`leaderId`in e||typeof e.state==`string`)}function Jt(e){let t=e.cluster;if(!e.reachable||!t)return e.error||`Cluster participation unavailable`;if(t.participant===`standalone`)return`Standalone`;if(t.participant!==`worker`&&!qt(t))return`Cluster participation unreported`;let n=[t.participant===`worker`?`Worker`:`Controller`];return typeof t.clusterId==`string`&&n.push(t.clusterId),typeof t.state==`string`&&n.push(t.state),(typeof t.term==`string`||typeof t.term==`number`)&&n.push(`epoch ${t.term}`),t.fencedOperations?.length&&n.push(t.fencedOperations.join(`, `)),n.join(` · `)}function Yt(e){return e.flatMap(e=>{let t=e.cluster;return!e.reachable||!t||t.coordination!==`postgres-lease`||![`unavailable`,`expired`,`stopped`].includes(String(t.authority))?[]:[{nodeId:e.nodeId,reason:typeof t.reason==`string`&&t.reason?t.reason:`Cluster authority is ${String(t.authority)}`}]})}function Xt(e){let t=new Map;for(let n of e){if(!n.reachable||!n.cluster||!qt(n.cluster))continue;let e=typeof n.cluster.clusterId==`string`?n.cluster.clusterId:`legacy`;t.set(e,[...t.get(e)??[],n])}for(let[e,n]of t){let t=Zt(n,e);if(t.kind!==`none`)return t}return{kind:`none`}}function Zt(e,t){if(e.length<2)return{kind:`none`};let n=new Map,r=new Set;for(let t of e){let e=typeof t.cluster.leaderId==`string`?t.cluster.leaderId:`(none)`;n.has(e)||n.set(e,[]),n.get(e).push(t.nodeId);let i=t.cluster.term;typeof i==`string`&&/^[1-9][0-9]{0,18}$/.test(i)?r.add(i):typeof i==`number`&&Number.isSafeInteger(i)&&i>=0&&r.add(String(i))}return n.size>1?{kind:`leaders`,clusterId:t,answered:e.length,groups:[...n]}:r.size>1?{kind:`terms`,clusterId:t,answered:e.length,terms:[...r].sort((e,t)=>BigInt(e)<BigInt(t)?-1:1)}:{kind:`none`}}function Qt(){return(Qt=e((()=>{Ut()})))()}function $t(e,t){let n=e*864e5;return Math.max(1,Math.min(400,Math.ceil(n/Math.max(1,t))))}function en(e){if(!e)return`never`;let t=Date.now()-Date.parse(e);if(!Number.isFinite(t))return`never`;if(t<6e4)return`just now`;let n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function tn(e){if(!e)return!0;let t=Date.parse(e);return!Number.isFinite(t)||Date.now()-t>Nn}function nn({state:e,label:t,tooltip:n}){return(0,$.jsx)(z,{title:n??{online:`Connected`,offline:`Offline`,unknown:`Unknown`,unchecked:`Not checked`,checking:`Checking...`,"not-installed":`Not installed`}[e],arrow:!0,children:(0,$.jsxs)(G,{direction:`row`,spacing:.5,sx:{alignItems:`center`},children:[(0,$.jsx)(w,{sx:{width:8,height:8,borderRadius:`50%`,bgcolor:{online:`success.main`,offline:`error.main`,unknown:`warning.light`,unchecked:`text.disabled`,checking:`warning.main`,"not-installed":`text.disabled`}[e],flexShrink:0,...e===`checking`&&{animation:`${Fn} 1s ease-in-out infinite`},...e===`not-installed`&&{border:`1px dashed`,borderColor:`text.disabled`,bgcolor:`transparent`}}}),(0,$.jsx)(H,{variant:`caption`,noWrap:!0,sx:{color:`text.secondary`},children:t})]})})}function rn(e,t,n){if(e<0)return n===`absent`?f(t.palette.info.main,.35):n===`unreachable`?f(t.palette.warning.main,.3):n===`unread`?f(t.palette.text.disabled,.25):t.palette.action.disabledBackground;let r=an(t.palette.success.main),i=an(t.palette.error.main),a=i[0]+(r[0]-i[0])*e,o=i[1]+(r[1]-i[1])*e,s=i[2]+(r[2]-i[2])*e;return`hsl(${Math.round(a)}, ${Math.round(o)}%, ${Math.round(s)}%)`}function an(e){let t=e.replace(`#`,``),n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,i=parseInt(t.slice(4,6),16)/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=(a+o)/2;if(a===o)return[0,0,s*100];let c=a-o,l=s>.5?c/(2-a-o):c/(a+o),u;return u=a===n?(r-i)/c+(r<i?6:0):a===r?(i-n)/c+2:(n-r)/c+4,u*=60,[u,l*100,s*100]}function on({data:e,metric:t,label:n,segWidth:r=6,gap:i=4,height:a=10,lastCheckAt:o}){let s=m(),c=(0,Q.useRef)(null),[l,u]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let t=e.clientWidth;u(Math.max(1,Math.floor((t+i)/(r+i))))};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[r,i]);let d=[];if(l>0){let n=e.slice(-l);for(let e=0;e<l-n.length;e++)d.push({val:-1,time:``});for(let e of n){let n=e[t],r=e.t?new Date(e.t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``;d.push({val:n,time:r,...e.t?{iso:e.t}:{},checks:e.checks,unmeasured:e.omnitronUnmeasured})}}let f=d.filter(e=>e.val>=0),p=f.length>0?Math.round(f.reduce((e,t)=>e+t.val,0)/f.length*100):-1,h=p<0&&d.some(e=>e.unmeasured===`absent`),g=p>=0&&o&&Date.now()-new Date(o).getTime()>3e5?Date.now()-new Date(o).getTime():null,_=o?{time:new Date(o).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}:null,v=g==null?null:g>=36e5?`${Math.round(g/36e5)}h`:`${Math.max(1,Math.round(g/6e4))}m`;return(0,$.jsxs)(G,{spacing:.25,children:[(0,$.jsxs)(G,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.disabled`,fontSize:9,textTransform:`uppercase`,letterSpacing:.5},children:n}),v?(0,$.jsx)(z,{title:`Nothing has been recorded for ${v} — the last check was at ${_?.time}. The strip shows what was measured before that, not the node now.`,arrow:!0,children:(0,$.jsxs)(H,{variant:`caption`,sx:{fontSize:9,color:`warning.main`},children:[`no checks for `,v]})}):p>=0?(0,$.jsxs)(H,{variant:`caption`,sx:{fontSize:9,color:p>=95?`success.main`:p>=50?`warning.main`:`error.main`},children:[p,`%`]}):h?(0,$.jsx)(H,{variant:`caption`,sx:{fontSize:9,color:`info.main`},children:`not installed`}):null]}),(0,$.jsx)(G,{ref:c,direction:`row`,sx:{height:a,gap:`${i}px`},children:d.map((e,t)=>{let n=rn(e.val,s,e.unmeasured),i=e.checks==null?``:` (${e.checks} checks)`,a=e.val<0?e.unmeasured===`absent`?`${e.time} — omnitron not installed${i}`:e.unmeasured===`unreachable`?`${e.time} — could not reach the node${i}`:e.unmeasured===`unread`?`${e.time} — not measured: the node was reached and nothing could be read${i}`:e.time?`${e.time} — no data`:`No data`:`${e.time} — ${Math.round(e.val*100)}% up${i}`;return(0,$.jsx)(z,{title:a,arrow:!0,children:(0,$.jsx)(w,{sx:{width:r,minWidth:r,height:`100%`,bgcolor:n,borderRadius:`2px`,transition:`opacity 0.15s`,"&:hover":{opacity:.6}}})},t)})})]})}function sn(e){return/\+local\.[0-9a-zA-Z]+\.(\d{12})$/.exec(e??``)?.[1]??null}function cn(e,t){if(!e||!t)return`unknown`;if(e===t)return`current`;let n=sn(e),r=sn(t);return n&&r?n<r?`behind`:`current`:`differs`}function ln(e){let t,n=``;for(let r of e){if(!r)continue;let e=sn(r);e?e>n&&(n=e,t=r):t??=r}return t}function un(e,t){if(!e)return{state:`unchecked`,tooltip:`Not checked`};if(t)return e.omnitronConnected?{state:`online`,tooltip:`v${e.omnitronVersion??`?`} PID ${e.omnitronPid??`?`}`}:{state:`offline`,tooltip:e.omnitronError??`Not running`};let n=Ht(e);switch(n){case`running`:return{state:`online`,tooltip:`v${e.omnitronVersion??`?`} (${e.omnitronRole??`?`})`};case`not-running`:return{state:`offline`,tooltip:e.omnitronError??`Not running`};case`not-installed`:return{state:`not-installed`,tooltip:`Not installed on this node`};case`unreachable`:return{state:`unchecked`,tooltip:e.sshError?`SSH refused: ${e.sshError}`:`SSH refused`};case`unread`:return e.omnitronError?{state:`unknown`,tooltip:`Unknown — ${e.omnitronError}`}:{state:`unchecked`,tooltip:`Not checked yet`};default:return{state:`unchecked`,tooltip:String(n)}}}function dn({label:e,verdict:t,latencyMs:n,error:r,detail:i}){return(0,$.jsxs)(w,{sx:{py:1},children:[(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,$.jsx)(H,{variant:`body2`,sx:{fontWeight:600,minWidth:96},children:e}),(0,$.jsx)(D,{size:`small`,label:Vn[t],color:Bn[t],variant:Hn(t)?`outlined`:`filled`,sx:{height:20,fontSize:11}}),n!=null&&(0,$.jsxs)(H,{variant:`caption`,sx:{color:`text.secondary`},children:[n,`ms`]}),i&&(0,$.jsx)(H,{variant:`caption`,noWrap:!0,sx:{color:`text.secondary`},children:i})]}),r&&(0,$.jsx)(H,{variant:`caption`,component:`pre`,sx:{mt:.5,ml:`104px`,p:1,borderRadius:1,bgcolor:e=>f(e.palette.error.main,.08),color:`error.main`,fontFamily:`monospace`,fontSize:11,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:r})]})}function fn({row:e,isLocal:t}){let n=Wt(e.pingReachable,e.pingError),r=Wt(e.sshConnected,e.sshError),i=Gt(e),a=Kt(e),o=t?[[`OMNITRON`,i]]:[[`PING`,n],[`SSH`,r],[`OMNITRON`,i]];return(0,$.jsxs)(w,{sx:{py:.75,borderBottom:e=>`1px solid ${e.palette.divider}`},children:[(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,$.jsx)(H,{variant:`caption`,sx:{fontFamily:`monospace`,minWidth:148,color:`text.secondary`},children:new Date(e.checkedAt).toLocaleString()}),o.map(([e,t])=>(0,$.jsx)(D,{size:`small`,label:e,color:Bn[t],variant:Hn(t)?`outlined`:`filled`,sx:{height:18,fontSize:10}},e)),(0,$.jsxs)(H,{variant:`caption`,sx:{color:`text.disabled`,ml:`auto`},children:[e.checkDurationMs,`ms`]})]}),a&&(0,$.jsx)(H,{variant:`caption`,sx:{display:`block`,mt:.25,ml:`156px`,color:`error.main`,fontFamily:`monospace`,fontSize:11,wordBreak:`break-word`},children:a})]})}function pn({data:e,health:t}){if(!e)return(0,$.jsx)(H,{variant:`body2`,sx:{py:1,color:`text.secondary`},children:`Not read.`});if(!e.reachable||!e.answer)return(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{py:1,alignItems:`baseline`},children:[(0,$.jsx)(D,{size:`small`,label:`not asked`,variant:`outlined`,sx:{height:20,fontSize:11}}),(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:e.error??`no reason given`})]});let n=e.answer;if(n.apps.length===0)return(0,$.jsx)(H,{variant:`body2`,sx:{py:1,color:`text.secondary`},children:`The node answered and is running no applications.`});let i=e=>e===`online`?`success`:e===`starting`?`warning`:e===`stopped`?`default`:`error`;return(0,$.jsxs)(w,{sx:{py:.5},children:[(0,$.jsxs)(H,{variant:`caption`,sx:{display:`block`,mb:1,color:`text.secondary`},children:[n.apps.length,` app(s) · `,n.totalCpu.toFixed(1),`% CPU ·`,` `,(mt(n)/1024/1024).toFixed(0),` MB`]}),n.apps.map(n=>(0,$.jsxs)(w,{children:[(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{py:.5,alignItems:`baseline`,flexWrap:`wrap`},children:[(0,$.jsx)(D,{size:`small`,label:n.status,color:i(n.status),sx:{height:20,fontSize:11}}),(0,$.jsx)(H,{variant:`body2`,sx:{fontFamily:`monospace`},children:n.name}),(0,$.jsx)(v,{component:r,to:ht(n.name,e.nodeId===`local`?void 0:e.nodeId),size:`small`,"aria-label":`View logs for ${n.name}`,children:`Logs`}),(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:[n.pid?`pid ${n.pid}`:null,n.port?`:${n.port}`:null,n.uptime>0?`up ${En(n.uptime)}`:null,n.restarts>0?`${n.restarts} restarts`:null].filter(Boolean).join(` · `)})]},n.name),(0,$.jsxs)(H,{variant:`caption`,sx:{display:`block`,color:`text.secondary`},children:[`Health: `,t?.answer?.apps[n.name]?.status??`not read`,t?.error?` — ${t.error}`:``]}),t?.answer?.apps[n.name]?.checks.map(e=>(0,$.jsxs)(H,{variant:`caption`,sx:{display:`block`,pl:1,color:e.status===`fail`?`error.main`:e.status===`warn`?`warning.main`:`text.secondary`},children:[e.status,` · `,e.name,e.message?` — ${e.message}`:``]},e.name))]},n.name))]})}function mn({data:e}){let t=e.phase===`done`?`success`:e.phase===`failed`||e.phase===`refused`?`error`:`warning`,n=e.phase!==`done`&&e.phase!==`failed`&&e.phase!==`refused`;return(0,$.jsxs)(w,{sx:{py:.5},children:[(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,$.jsx)(D,{size:`small`,label:e.phase,color:t,sx:{height:20,fontSize:11}}),(0,$.jsx)(H,{variant:`body2`,children:e.message})]}),e.version&&(0,$.jsx)(H,{variant:`caption`,sx:{display:`block`,mt:.5,color:`text.secondary`,fontFamily:`monospace`},children:e.version}),n&&(0,$.jsx)(Oe,{variant:`determinate`,value:e.percent,sx:{mt:1,height:4,borderRadius:2}}),(0,$.jsx)(H,{variant:`caption`,sx:{display:`block`,mt:.5,color:`text.disabled`},children:new Date(e.at).toLocaleString()})]})}function hn({data:e,nodeName:t}){if(!e)return(0,$.jsx)(H,{variant:`body2`,sx:{py:1,color:`text.secondary`},children:`Not read.`});if(!e.reachable)return(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{py:1,alignItems:`baseline`},children:[(0,$.jsx)(D,{size:`small`,label:`not asked`,variant:`outlined`,sx:{height:20,fontSize:11}}),(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:e.error??`no reason given`})]});let n=Object.entries(e.indicators??{});if(n.length===0)return(0,$.jsx)(H,{variant:`body2`,sx:{py:1,color:`text.secondary`},children:`The node answered and registered no indicators.`});let r=e=>e===`healthy`?`success`:e===`degraded`?`warning`:e===`unhealthy`?`error`:`default`;return(0,$.jsxs)(w,{sx:{py:.5},children:[e.status&&(0,$.jsx)(D,{size:`small`,label:`overall: ${e.status}`,color:r(e.status),sx:{height:20,fontSize:11,mb:1}}),n.map(([e,t])=>(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{py:.4,alignItems:`baseline`,flexWrap:`wrap`},children:[(0,$.jsx)(H,{variant:`body2`,sx:{minWidth:120,fontWeight:500},children:e}),(0,$.jsx)(D,{size:`small`,label:t?.status??`unknown`,color:r(t?.status),variant:t?.status?`filled`:`outlined`,sx:{height:18,fontSize:10}}),t?.message&&(0,$.jsx)(H,{variant:`caption`,sx:{color:t.status===`healthy`?`text.secondary`:`error.main`},children:t.message})]},e)),(0,$.jsx)(Bt,{active:n.find(([e])=>e===`runtime-diagnostics`)?.[1].details?.active,nodeName:t})]})}function gn({data:e}){if(!e)return(0,$.jsx)(H,{variant:`body2`,sx:{py:1,color:`text.secondary`},children:`Not read.`});if(!e.reachable||!e.sync)return(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{py:1,alignItems:`baseline`},children:[(0,$.jsx)(D,{size:`small`,label:`unavailable`,variant:`outlined`,sx:{height:20,fontSize:11}}),(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:e.error??`No replication reading was returned.`})]});let t=e.sync,n=yt(t);return(0,$.jsxs)(w,{sx:{py:.5},children:[(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:.5},children:[(0,$.jsx)(D,{size:`small`,label:n.state===`unknown`?`delivery active`:n.state===`pulling`?`keeping up`:n.state===`synced`?`in sync`:n.state.replace(`-`,` `),color:wt(n),sx:{height:20,fontSize:11}}),(0,$.jsxs)(H,{variant:`caption`,sx:{color:`text.secondary`},children:[bt(n),` · `,t.bufferSizeAccuracy!==`measured`&&`~`,Math.round(t.bufferSize/1024),` KB pending · last release`,` `,t.lastSyncAt?en(new Date(t.lastSyncAgeMs==null?t.lastSyncAt:Date.now()-t.lastSyncAgeMs).toISOString()):`not recorded`,t.deliveryRatePerSecond!==void 0&&` · ${t.deliveryRatePerSecond.toFixed(1)} entries/s (60 s)`]}),t.failedAttempts>0&&(0,$.jsx)(D,{size:`small`,color:`error`,label:`${t.failedAttempts} failed attempts`,sx:{height:18,fontSize:10}})]}),t.evidence&&(0,$.jsxs)(H,{variant:`caption`,sx:{display:`block`,color:`text.secondary`,overflowWrap:`anywhere`,fontVariantNumeric:`tabular-nums`},children:[St(t.evidence),`. Released entries may include losses; evidence began `,new Date(t.evidence.since).toLocaleString(),`.`]}),t.lastError&&(0,$.jsx)(H,{variant:`caption`,sx:{display:`block`,color:`error.main`,fontFamily:`monospace`,fontSize:11,wordBreak:`break-word`},children:t.lastError}),!!t.history?.length&&(0,$.jsxs)(w,{component:`details`,sx:{mt:1,minWidth:0,"& summary":{cursor:`pointer`,typography:`caption`,color:`text.secondary`}},children:[(0,$.jsx)(`summary`,{children:`History before receipts · coverage and gaps`}),(0,$.jsx)(G,{spacing:1,sx:{pt:1},children:t.history.map(e=>(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,overflowWrap:`anywhere`},children:Tt(e)},e.sourceId))})]})]})}function _n({states:e}){let t=Object.values(e),n=Xt(t),r=Yt(t);return n.kind===`none`&&r.length===0?null:(0,$.jsxs)(G,{spacing:1,children:[r.map(e=>(0,$.jsxs)(Re,{severity:`warning`,children:[e.nodeId.slice(0,8),` · `,e.reason]},e.nodeId)),n.kind!==`none`&&(0,$.jsx)(Re,{severity:`warning`,children:n.kind===`leaders`?`${n.clusterId}: ${n.answered} controller observations name different leaders: `+n.groups.map(([e,t])=>`${e} (${t.length})`).join(`, `):`${n.clusterId}: ${n.answered} controller observations have different epochs: ${n.terms.join(`, `)}`})]})}function vn({data:e}){if(!e)return null;let t=Et(e);return(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{py:.5,alignItems:`center`,flexWrap:`wrap`},children:[(0,$.jsx)(H,{variant:`caption`,sx:{minWidth:96,color:`text.secondary`},children:`telemetry`}),(0,$.jsx)(D,{size:`small`,label:t.label,color:t.state===`healthy`?`success`:t.state===`degraded`?`warning`:`default`,variant:`outlined`,sx:{height:18,fontSize:10}}),(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`,overflowWrap:`anywhere`},children:t.detail}),`dropped`in t&&t.dropped>0&&(0,$.jsx)(D,{size:`small`,color:`error`,label:`${t.dropped} DROPPED`,sx:{height:18,fontSize:10}})]})}function yn(e){return(0,$.jsx)(bn,{...e},e.open?e.node?.id??`none`:`closed`)}function bn({open:e,onClose:t,node:n,cluster:r}){let[i,a]=(0,Q.useState)([]),[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,y]=(0,Q.useState)(50),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),[A,ee]=(0,Q.useState)(!0),[ne,re]=(0,Q.useState)(!1),[ie,oe]=(0,Q.useState)(null),j=Ve(),M=(0,Q.useRef)(0),N=(0,Q.useCallback)(async(e,t)=>{let n=++M.current;ee(!0),oe(null);try{let[r,i,o,l,d,p,h,_,v]=await Promise.allSettled([c.getCheckHistory({nodeId:e,limit:t}),c.getNodeIndicators({nodeId:e}),c.getNodeSyncStatus({nodeId:e}),c.getNodeRelayStats({nodeId:e}),c.getNodeHealthSummaries(),c.getNodeDaemonStatus({nodeId:e}),c.getUpgradeProgress(),c.getNodeDaemonHealth({nodeId:e}),c.getMeshStatus()]);if(n!==M.current)return;if(f(v.status===`fulfilled`?v.value.find(t=>t.nodeId===e)??null:null),C(_.status===`fulfilled`?_.value:{nodeId:e,reachable:!1,answer:null,error:`Application health could not be read`}),x(p.status===`fulfilled`?p.value:null),E(h.status===`fulfilled`?h.value.find(t=>t.nodeId===e)??null:null),s(i.status===`fulfilled`?i.value:null),u(o.status===`fulfilled`?o.value:{nodeId:e,reachable:!1,sync:null,error:o.reason instanceof Error?o.reason.message:String(o.reason)}),m(l.status===`fulfilled`?l.value:null),g(d.status===`fulfilled`?d.value.find(t=>t.nodeId===e)??null:null),r.status===`rejected`)throw r.reason;a(r.value)}catch(e){if(n!==M.current)return;oe(e instanceof Error?e.message:String(e)),a([])}finally{n===M.current&&ee(!1)}},[]);(0,Q.useEffect)(()=>{let t=M;return e&&n&&N(n.id,_),()=>{t.current++}},[e,n,_,N]);let se=T!==null&&T.phase!==`done`&&T.phase!==`failed`&&T.phase!==`refused`;Ge(()=>{e&&n&&!A&&N(n.id,_)},{intervalMs:5e3,enabled:e});let P=(0,Q.useCallback)(async()=>{if(n){k(!0);try{let e=await c.upgradeNode({nodeId:n.id});if(!e.started){j.warning(e.reason??`The daemon refused to start an upgrade`);return}j.info(`Building a bundle — this takes a few minutes`),await N(n.id,_)}catch(e){j.error(e instanceof Error?e.message:`Could not start the upgrade`)}finally{k(!1)}}},[n,_,N,j]),ue=(0,Q.useCallback)(async()=>{if(n){re(!0);try{await c.triggerNodeCheck({nodeId:n.id}),await N(n.id,_),j.success(`Check complete`)}catch(e){j.error(e instanceof Error?e.message:`Check failed`)}finally{re(!1)}}},[n,_,N,j]);if(!n)return null;let I=n.status,de=n.isLocal;return(0,$.jsxs)(ae,{open:e,onClose:t,maxWidth:`md`,fullWidth:!0,children:[(0,$.jsx)(le,{children:(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,$.jsxs)(w,{component:`span`,children:[`Diagnostics — `,n.name]}),(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.secondary`},children:de?`this daemon`:`${n.host}:${n.daemonPort}`})]})}),(0,$.jsxs)(te,{dividers:!0,children:[A&&(0,$.jsx)(Oe,{"aria-label":`Loading node diagnostics`,sx:{mb:2}}),(0,$.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`},children:`Last check`}),h&&(h.consecutiveFailures>0||h.lastSeenOnline)&&(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{mb:1,alignItems:`center`,flexWrap:`wrap`},children:[h.consecutiveFailures>0&&(0,$.jsx)(D,{size:`small`,color:h.consecutiveFailures>3?`error`:`warning`,label:`${h.consecutiveFailures} consecutive failures`,sx:{height:20,fontSize:11}}),h.lastSeenOnline&&(0,$.jsxs)(H,{variant:`caption`,sx:{color:`text.secondary`},children:[`last seen online `,en(h.lastSeenOnline)]})]}),I?(0,$.jsxs)(w,{sx:{mb:2},children:[!de&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dn,{label:`PING`,verdict:Wt(I.pingReachable,I.pingError),latencyMs:I.pingLatencyMs,error:I.pingError??null}),(0,$.jsx)(dn,{label:`SSH`,verdict:Wt(I.sshConnected,I.sshError),latencyMs:I.sshLatencyMs,error:I.sshError??null,detail:I.sshConnected==null&&!I.sshError?`this check reaches the node over Netron`:void 0})]}),(0,$.jsx)(dn,{label:`OMNITRON`,verdict:Gt(I),error:I.omnitronError??null,detail:I.omnitronConnected?[I.omnitronVersion&&`v${I.omnitronVersion}`,I.omnitronPid&&`pid ${I.omnitronPid}`,I.omnitronUptime!=null&&I.omnitronUptime>0&&`up ${En(I.omnitronUptime)}`].filter(Boolean).join(` · `):void 0}),(0,$.jsx)(H,{variant:`caption`,sx:{display:`block`,mt:1,color:`text.disabled`},children:I.checkedAt?`Taken ${new Date(I.checkedAt).toLocaleString()}`:`Never checked`})]}):(0,$.jsx)(H,{variant:`body2`,sx:{mb:2,color:`text.secondary`},children:`This node has never been checked.`}),(0,$.jsx)(F,{sx:{my:2}}),(0,$.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`},children:`Indicators, from the node's own titan-health`}),(0,$.jsx)(hn,{data:o,nodeName:n.name}),(0,$.jsx)(F,{sx:{my:2}}),(0,$.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`},children:`Running on this node`}),(0,$.jsx)(pn,{data:b,health:S}),(0,$.jsx)(F,{sx:{my:2}}),(0,$.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`},children:`Replication`}),!n.isLocal&&d&&(0,$.jsxs)(w,{sx:{py:1,overflowWrap:`anywhere`},children:[(0,$.jsx)(H,{variant:`body2`,children:xt(d).connection}),xt(d).error&&(0,$.jsx)(H,{variant:`caption`,color:`error.main`,children:xt(d).error}),!(l?.reachable&&l.sync)&&(0,$.jsxs)(H,{variant:`caption`,sx:{display:`block`,color:`text.secondary`},children:[`Replication: `,xt(d).replication]})]}),r&&(0,$.jsxs)(H,{variant:`body2`,sx:{overflowWrap:`anywhere`},children:[`Cluster · `,Jt(r)]}),(0,$.jsx)(gn,{data:l}),(0,$.jsx)(vn,{data:p}),(0,$.jsx)(F,{sx:{my:2}}),(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,mb:1},children:[(0,$.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`},children:`History`}),(0,$.jsx)(U,{size:`small`,sx:{ml:`auto`,minWidth:120},children:(0,$.jsx)(Fe,{value:_,inputProps:{"aria-label":`History entries`},onChange:e=>y(Number(e.target.value)),sx:{height:30,fontSize:12},children:zn.map(e=>(0,$.jsxs)(W,{value:e,sx:{fontSize:12},children:[`last `,e,` checks`]},e))})})]}),ie&&(0,$.jsx)(Re,{onClose:()=>oe(null),children:ie}),A&&i.length===0?(0,$.jsx)(ut,{height:120}):i.length===0&&!ie?(0,$.jsx)(H,{variant:`body2`,sx:{py:2,color:`text.secondary`},children:`No checks recorded. History is kept by the daemon that runs the health worker.`}):(0,$.jsx)(w,{sx:{maxHeight:360,overflowY:`auto`},children:i.map(e=>(0,$.jsx)(fn,{row:e,isLocal:de},`${e.nodeId}-${e.checkedAt}`))}),T&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(F,{sx:{my:2}}),(0,$.jsx)(H,{variant:`overline`,sx:{color:`text.secondary`},children:`Workspace source bundle upgrade`}),(0,$.jsx)(mn,{data:T})]})]}),(0,$.jsxs)(ce,{children:[(0,$.jsx)(K,{permission:`OmnitronNodes.triggerNodeCheck`,children:(0,$.jsx)(v,{onClick:ue,disabled:ne,startIcon:(0,$.jsx)($e,{sx:{fontSize:16}}),children:ne?`Checking…`:`Check now`})}),!de&&(0,$.jsx)(K,{permission:`OmnitronNodes.upgradeNode`,children:(0,$.jsxs)(w,{component:`details`,children:[(0,$.jsx)(H,{component:`summary`,variant:`caption`,sx:{cursor:`pointer`},children:`Advanced · workspace source bundle`}),(0,$.jsx)(v,{onClick:P,disabled:O||se,startIcon:(0,$.jsx)(tt,{sx:{fontSize:16}}),children:se?`Upgrading…`:`Install source bundle`})]})}),(0,$.jsx)(w,{sx:{flexGrow:1}}),(0,$.jsx)(v,{onClick:t,children:`Close`})]})]})}function xn({node:e,onEdit:t,onRemove:n,onCheckSsh:i,onDiagnose:a,checking:o,uptimeData:s,lastCheckAt:c,newest:l,mesh:u}){let{status:d}=e,f=un(d,e.isLocal),p=d?.pingReachable==null?`unchecked`:d.pingReachable?`online`:`offline`,m=!e.isLocal&&tn(d?.checkedAt);return(0,$.jsx)(M,{sx:{height:`100%`,display:`flex`,flexDirection:`column`,transition:`box-shadow 0.2s`,"&:hover":{boxShadow:e=>e.shadows[8]}},children:(0,$.jsxs)(_,{sx:{pb:`12px !important`,flexGrow:1,display:`flex`,flexDirection:`column`},children:[(0,$.jsxs)(G,{direction:`row`,sx:{alignItems:`flex-start`,justifyContent:`space-between`,flexWrap:`wrap`,gap:1,mb:1.5},children:[(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,minWidth:0},children:[e.isLocal?(0,$.jsx)(rt,{sx:{fontSize:24,color:`primary.main`,flexShrink:0}}):(0,$.jsx)(Xe,{sx:{fontSize:24,color:`text.secondary`,flexShrink:0}}),(0,$.jsxs)(w,{sx:{minWidth:0},children:[(0,$.jsx)(H,{variant:`subtitle2`,noWrap:!0,children:e.name}),(0,$.jsxs)(H,{variant:`caption`,noWrap:!0,sx:{color:`text.disabled`},children:[e.host,e.isLocal?``:`:${e.sshPort}`]})]})]}),(0,$.jsxs)(G,{direction:`row`,spacing:.5,useFlexGap:!0,sx:{flexWrap:`wrap`,justifyContent:`flex-end`,flexShrink:0,maxWidth:`100%`},children:[!e.isLocal&&(0,$.jsx)(K,{permission:`OmnitronNodes.removeNode`,children:(0,$.jsx)(z,{title:`Remove`,children:(0,$.jsx)(Me,{size:`small`,"aria-label":`Remove node ${e.name}`,onClick:()=>n(e.id),color:`error`,sx:{marginInlineEnd:1},children:(0,$.jsx)(nt,{sx:{fontSize:18}})})})}),!e.isLocal&&(0,$.jsx)(K,{permission:`OmnitronTerminal.open`,children:(0,$.jsx)(v,{component:r,to:`/terminal?${new URLSearchParams({node:e.id})}`,size:`small`,children:`SSH`})}),!e.isLocal&&(0,$.jsx)(z,{title:o?`Checking...`:`Check SSH connection`,children:(0,$.jsx)(`span`,{children:(0,$.jsx)(K,{permission:`OmnitronNodes.checkNodeStatus`,children:(0,$.jsx)(Me,{size:`small`,"aria-label":`Check SSH connection`,onClick:()=>i(e.id),disabled:o,children:(0,$.jsx)($e,{sx:{fontSize:18,...o&&{animation:`${Pn} 1s linear infinite`}}})})})})}),(0,$.jsx)(z,{title:`Diagnostics`,children:(0,$.jsx)(Me,{size:`small`,"aria-label":`Diagnostics for ${e.name}`,onClick:()=>a(e),children:(0,$.jsx)(et,{sx:{fontSize:18}})})}),!e.isLocal&&(0,$.jsx)($.Fragment,{children:(0,$.jsx)(K,{permission:`OmnitronNodes.updateNode`,children:(0,$.jsx)(z,{title:`Edit`,children:(0,$.jsx)(Me,{size:`small`,"aria-label":`Edit node ${e.name}`,onClick:()=>t(e),children:(0,$.jsx)(Qe,{sx:{fontSize:18}})})})})})]})]}),(0,$.jsxs)(G,{direction:`row`,spacing:2,sx:{mb:1.5,alignItems:`center`},children:[e.isLocal?(0,$.jsx)(nn,{state:f.state,label:`OMNITRON`,tooltip:f.tooltip}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(nn,{state:p,label:`PING`,tooltip:d?.pingReachable?`${d.pingLatencyMs??`?`}ms`:d?.pingError??`Not checked`}),(0,$.jsx)(nn,{state:f.state,label:`OMNITRON`,tooltip:f.tooltip})]}),(0,$.jsx)(z,{arrow:!0,title:d?.checkedAt?`Last checked ${new Date(d.checkedAt).toLocaleString()}`:`This node has never been checked`,children:(0,$.jsx)(H,{variant:`caption`,noWrap:!0,sx:{ml:`auto`,fontSize:10,color:m?`warning.main`:`text.disabled`},children:en(d?.checkedAt)})})]}),(0,$.jsx)(F,{sx:{mb:1.5}}),(0,$.jsxs)(G,{spacing:.5,children:[d?.omnitronVersion&&(0,$.jsx)(wn,{version:d.omnitronVersion,standing:cn(d.omnitronVersion,l)}),(0,$.jsx)(Tn,{label:`Runtime`,value:e.runtime}),(0,$.jsx)(Tn,{label:`Daemon Port`,value:String(e.daemonPort)}),!e.isLocal&&(0,$.jsx)(Tn,{label:`SSH User`,value:e.sshUser}),d?.os&&(0,$.jsx)(Tn,{label:`OS`,value:`${d.os.platform} ${d.os.arch}`}),d?.omnitronUptime!=null&&d.omnitronUptime>0&&(0,$.jsx)(Tn,{label:`Uptime`,value:En(d.omnitronUptime)}),!e.isLocal&&(0,$.jsx)(Cn,{mesh:u})]}),e.tags.length>0&&(0,$.jsx)(G,{direction:`row`,spacing:.5,useFlexGap:!0,sx:{mt:1.5,flexWrap:`wrap`},children:e.tags.map(e=>(0,$.jsx)(D,{label:e,size:`small`,variant:`outlined`,sx:{height:22,fontSize:11}},e))}),!e.isLocal&&(0,$.jsx)(w,{sx:{mt:`auto`,pt:1.5},children:(0,$.jsxs)(G,{spacing:.75,children:[(0,$.jsx)(on,{data:s,metric:`ping`,label:`PING`,segWidth:In,gap:Ln,height:Rn,lastCheckAt:c}),(0,$.jsx)(on,{data:s,metric:`omnitron`,label:`OMNITRON`,segWidth:In,gap:Ln,height:Rn,lastCheckAt:c})]})})]})})}function Sn(e){let t=xt(e),n=[t.connection,t.error,`Replication: ${t.replication}`].filter(Boolean).join(` `);switch(t.state){case`not-joined`:return{text:`not joined`,tone:`idle`,tooltip:n};case`reconnecting`:return{text:e.reconnectAt==null?`disconnected`:`retrying`,tone:`bad`,tooltip:n};case`connecting`:return{text:`joining`,tone:`quiet`,tooltip:n};case`stale`:return{text:`stale heartbeat`,tone:`warn`,tooltip:n};case`unauthenticated`:return{text:`unauthenticated`,tone:`warn`,tooltip:n};case`connected`:return e.via===`ssh-tunnel`?{text:`over SSH`,tone:`info`,tooltip:n}:{text:`direct`,tone:`good`,tooltip:n};default:return{text:`disconnected`,tone:`bad`,tooltip:`RPC state is unavailable.`}}}function Cn({mesh:e}){if(!e)return null;let t=Sn(e);return(0,$.jsxs)(G,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.disabled`,fontSize:11},children:`Mesh`}),(0,$.jsx)(z,{arrow:!0,title:t.tooltip,children:(0,$.jsx)(H,{variant:`caption`,noWrap:!0,sx:{fontSize:11,color:Un[t.tone],maxWidth:190},children:t.text})})]})}function wn({version:e,standing:t}){let[n,r]=e.split(`+`),i=r?.split(`.`)[1],a=i?`${n} · ${i.slice(0,7)}`:n,o=t===`behind`?{text:`behind`,color:`warning.main`}:t===`differs`?{text:`differs`,color:`info.main`}:null;return(0,$.jsxs)(G,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.disabled`,fontSize:11},children:`Version`}),(0,$.jsx)(z,{arrow:!0,title:e,children:(0,$.jsxs)(G,{direction:`row`,spacing:.75,sx:{alignItems:`center`},children:[o&&(0,$.jsx)(H,{variant:`caption`,sx:{fontSize:10,color:o.color},children:o.text}),(0,$.jsx)(H,{variant:`caption`,noWrap:!0,sx:{fontSize:11,maxWidth:190},children:a})]})})]})}function Tn({label:e,value:t}){return(0,$.jsxs)(G,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(H,{variant:`caption`,sx:{color:`text.disabled`},children:e}),(0,$.jsx)(H,{variant:`caption`,sx:{fontWeight:500},children:t})]})}function En(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function Dn({open:e,onClose:t,onSubmit:n,editNode:r,sshKeys:i,loading:a,error:o,onDismissError:s}){let[c,l]=(0,Q.useState)(Wn);(0,Q.useEffect)(()=>{e&&l(r?{name:r.name,host:r.host,sshPort:r.sshPort,sshUser:r.sshUser,sshAuthMethod:r.sshAuthMethod,sshPrivateKey:r.sshPrivateKey??``,sshPassphrase:``,sshPassword:``,runtime:r.runtime,daemonPort:r.daemonPort,tags:r.tags.join(`, `)}:{...Wn,sshPrivateKey:i[0]?.path??``})},[r,i,e]);let u=(e,t)=>l(n=>({...n,[e]:t})),d=!!r,f=c.name.trim()&&c.host.trim();return(0,$.jsxs)(ae,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,children:[(0,$.jsx)(le,{children:d?`Edit "${r.name}"`:`Add Node`}),(0,$.jsxs)(te,{children:[o&&(0,$.jsx)(Re,{onClose:s,children:o}),(0,$.jsxs)(G,{spacing:2.5,sx:{mt:1},children:[(0,$.jsx)(B,{label:`Name`,value:c.name,onChange:e=>u(`name`,e.target.value),fullWidth:!0,placeholder:`production-server-1`,autoFocus:!0}),(0,$.jsxs)(G,{direction:{xs:`column`,sm:`row`},spacing:2,children:[(0,$.jsx)(B,{label:`Host`,value:c.host,onChange:e=>u(`host`,e.target.value),fullWidth:!0,placeholder:`192.168.1.100`}),(0,$.jsx)(B,{label:`SSH Port`,value:c.sshPort,onChange:e=>u(`sshPort`,parseInt(e.target.value,10)||22),sx:{width:{xs:`100%`,sm:120},flexShrink:0},type:`number`})]}),(0,$.jsxs)(G,{direction:{xs:`column`,sm:`row`},spacing:2,children:[(0,$.jsx)(B,{label:`SSH User`,value:c.sshUser,onChange:e=>u(`sshUser`,e.target.value),fullWidth:!0}),(0,$.jsxs)(U,{sx:{minWidth:160},children:[(0,$.jsx)(we,{children:`Auth Method`}),(0,$.jsxs)(Fe,{value:c.sshAuthMethod,label:`Auth Method`,inputProps:{"aria-label":`Auth Method`},onChange:e=>u(`sshAuthMethod`,e.target.value),children:[(0,$.jsx)(W,{value:`key`,children:`SSH Key`}),(0,$.jsx)(W,{value:`password`,children:`Password`})]})]})]}),c.sshAuthMethod===`key`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(U,{fullWidth:!0,children:[(0,$.jsx)(we,{shrink:r?.hasPrivateKey||void 0,children:`SSH Private Key`}),(0,$.jsxs)(Fe,{value:c.sshPrivateKey,label:`SSH Private Key`,displayEmpty:!!r?.hasPrivateKey,inputProps:{"aria-label":`SSH Private Key`},onChange:e=>u(`sshPrivateKey`,e.target.value),children:[r?.hasPrivateKey&&(0,$.jsx)(W,{value:``,children:`Keep stored key`}),i.map(e=>(0,$.jsx)(W,{value:e.path,children:(0,$.jsxs)(G,{direction:`row`,spacing:1,sx:{alignItems:`center`,width:`100%`},children:[(0,$.jsx)(H,{variant:`body2`,sx:{fontWeight:500},children:e.name}),(0,$.jsx)(D,{label:e.type,size:`small`,sx:{height:20,fontSize:11}}),(0,$.jsx)(H,{variant:`caption`,noWrap:!0,sx:{color:`text.disabled`,ml:`auto`},children:e.path})]})},e.path)),i.length===0&&(0,$.jsx)(W,{disabled:!0,children:(0,$.jsx)(H,{variant:`body2`,sx:{color:`text.secondary`},children:`No SSH keys found`})})]})]}),(0,$.jsx)(B,{label:`Key Passphrase`,value:c.sshPassphrase,onChange:e=>u(`sshPassphrase`,e.target.value),fullWidth:!0,type:`password`,placeholder:r?.hasPassphrase?`Encrypted — leave empty to keep`:`Leave empty if key is not encrypted`,size:`small`,helperText:r?.hasPassphrase?`Passphrase is stored encrypted. Enter new value to change.`:void 0})]}):(0,$.jsx)(B,{label:`SSH Password`,value:c.sshPassword,onChange:e=>u(`sshPassword`,e.target.value),fullWidth:!0,type:`password`,placeholder:r?.hasPassword?`Stored — leave empty to keep`:``,helperText:r?.hasPassword?`Password is stored encrypted. Enter a new value to change it.`:void 0}),(0,$.jsx)(F,{}),(0,$.jsxs)(G,{direction:{xs:`column`,sm:`row`},spacing:2,children:[(0,$.jsxs)(U,{sx:{minWidth:140},children:[(0,$.jsx)(we,{children:`Runtime`}),(0,$.jsxs)(Fe,{value:c.runtime,label:`Runtime`,inputProps:{"aria-label":`Runtime`},onChange:e=>u(`runtime`,e.target.value),children:[(0,$.jsx)(W,{value:`node`,children:`Node.js`}),(0,$.jsx)(W,{value:`bun`,children:`Bun`})]})]}),(0,$.jsx)(B,{label:`Daemon Port`,value:c.daemonPort,onChange:e=>u(`daemonPort`,parseInt(e.target.value,10)||9700),sx:{width:{xs:`100%`,sm:140},flexShrink:0},type:`number`}),(0,$.jsx)(B,{label:`Tags`,value:c.tags,onChange:e=>u(`tags`,e.target.value),fullWidth:!0,placeholder:`production, gpu`,helperText:`Comma-separated`})]})]})]}),(0,$.jsxs)(ce,{children:[(0,$.jsx)(v,{onClick:t,color:`inherit`,children:`Cancel`}),(0,$.jsx)(v,{variant:`contained`,loading:a,onClick:()=>n(c),disabled:!f||a,children:d?`Save`:`Add Node`})]})]})}function On({open:e,onClose:t,onSaved:n}){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[s,l]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{e&&(l(null),c.getCheckConfig().then(e=>i(e)).catch(e=>l(e?.message??`Could not read the current settings`)))},[e]);let u=(e,t)=>i(n=>n&&{...n,[e]:t});return(0,$.jsxs)(ae,{open:e,onClose:a?void 0:t,maxWidth:`xs`,fullWidth:!0,children:[(0,$.jsx)(le,{children:`Check Settings`}),(0,$.jsxs)(te,{children:[s&&(0,$.jsx)(Re,{onClose:()=>l(null),children:s}),r?(0,$.jsxs)(G,{spacing:2.5,sx:{mt:1},children:[(0,$.jsxs)(U,{fullWidth:!0,children:[(0,$.jsx)(we,{children:`ICMP Ping`}),(0,$.jsxs)(Fe,{value:r.pingEnabled?`on`:`off`,label:`ICMP Ping`,inputProps:{"aria-label":`ICMP Ping`},onChange:e=>u(`pingEnabled`,e.target.value===`on`),children:[(0,$.jsx)(W,{value:`on`,children:`Enabled`}),(0,$.jsx)(W,{value:`off`,children:`Disabled`})]})]}),(0,$.jsx)(B,{label:`Ping timeout (ms)`,type:`number`,fullWidth:!0,value:r.pingTimeout,onChange:e=>u(`pingTimeout`,parseInt(e.target.value,10)||0),helperText:`250-60000`,disabled:!r.pingEnabled}),(0,$.jsx)(B,{label:`SSH timeout (ms)`,type:`number`,fullWidth:!0,value:r.sshTimeout,onChange:e=>u(`sshTimeout`,parseInt(e.target.value,10)||0),helperText:`1000-120000`}),(0,$.jsx)(B,{label:`Omnitron probe timeout (ms)`,type:`number`,fullWidth:!0,value:r.omnitronCheckTimeout,onChange:e=>u(`omnitronCheckTimeout`,parseInt(e.target.value,10)||0),helperText:`1000-120000`}),(0,$.jsx)(B,{label:`Concurrent checks`,type:`number`,fullWidth:!0,value:r.concurrency,onChange:e=>u(`concurrency`,parseInt(e.target.value,10)||0),helperText:`1-100 - how many nodes are checked at once`})]}):(0,$.jsx)(ut,{variant:`rounded`,height:220})]}),(0,$.jsxs)(ce,{children:[(0,$.jsx)(v,{onClick:t,color:`inherit`,disabled:a,children:`Cancel`}),(0,$.jsx)(K,{permission:`OmnitronNodes.setCheckConfig`,children:(0,$.jsx)(v,{variant:`contained`,onClick:async()=>{if(r){o(!0),l(null);try{n(await c.setCheckConfig(r)),t()}catch(e){l(e?.message??`Failed to save settings.`)}finally{o(!1)}}},disabled:!r||a,children:a?`Saving...`:`Save`})})]})]})}function kn(){let{can:e}=He(),t=e(`OmnitronNodes.listSshKeys`),[n,r]=(0,Q.useState)([]),[i,a]=(0,Q.useState)([]),[o,s]=(0,Q.useState)(!0),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(!1),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)({}),[D,O]=(0,Q.useState)({}),[k,A]=(0,Q.useState)(null),[ee,ne]=(0,Q.useState)(!1),[re,ie]=(0,Q.useState)({uptimeIntervalMs:An,retentionDays:jn}),oe=(0,Q.useRef)(re);oe.current=re;let[j,M]=(0,Q.useState)(null),[N,se]=(0,Q.useState)(null),P=(0,Q.useRef)([]);P.current=n;let[F,ue]=(0,Q.useState)({}),I=(0,Q.useRef)(0),[de,fe]=(0,Q.useState)({}),L=(0,Q.useCallback)(async()=>{try{let e=await c.listNodes();r(e),A(null);let t=await Promise.allSettled(e.map(async e=>({id:e.id,at:(await c.getCheckHistory({nodeId:e.id,limit:1}))[0]?.checkedAt??null}))),n={},i=null;for(let e of t)e.status===`fulfilled`?n[e.value.id]=e.value.at:i??=e.reason?.message??`Could not read the latest recorded checks`;return O(e=>({...e,...n})),se(i),e}catch(e){return A(e?.message??`Could not reach the daemon`),P.current}finally{s(!1)}},[]),pe=(0,Q.useCallback)(async()=>{try{let e=await c.getMeshStatus();ue(Object.fromEntries(e.map(e=>[e.nodeId,e])))}catch{}},[]),R=(0,Q.useCallback)(async e=>{let t=++I.current,n=await Promise.allSettled(e.map(async e=>c.getNodeClusterState({nodeId:e.id}))),r={};n.forEach((t,n)=>{let i=e[n].id;r[i]=t.status===`fulfilled`&&t.value?.nodeId===i?t.value:{nodeId:i,reachable:!1,cluster:null,error:t.status===`rejected`&&t.reason instanceof Error?t.reason.message:`Cluster participation unavailable`}}),t===I.current&&fe(r)},[]),me=(0,Q.useCallback)(async e=>{let t={},n=null;await Promise.allSettled(e.map(async e=>{try{let{uptimeIntervalMs:n,retentionDays:r}=oe.current;t[e.id]=await c.getUptimeBar({nodeId:e.id,bucketCount:$t(r,n),intervalMs:n})}catch(e){n??=e?.message??`Could not load uptime history`}})),E(e=>({...e,...t})),M(n)},[]),he=(0,Q.useCallback)(async()=>{if(!t)a([]);else try{a(await c.listSshKeys())}catch{}},[t]),ge=qe(e=>e.connected),B=qe(e=>e.lastNodeEvent),_e=qe(e=>e.initialize);(0,Q.useEffect)(()=>_e(),[_e]),Ge(()=>void L(),{intervalMs:ge?12e4:3e4}),Ge(()=>void pe(),{intervalMs:15e3}),Ge(()=>R(P.current),{intervalMs:6e4}),(0,Q.useEffect)(()=>{B&&L()},[B,L]),Ge(()=>void(async()=>{await me(P.current)})(),{intervalMs:Mn});let ve=n.map(e=>e.id).sort().join(`,`);(0,Q.useEffect)(()=>{R(P.current),ve&&me(P.current)},[ve,R,me]),(0,Q.useEffect)(()=>{he()},[he]),(0,Q.useEffect)(()=>{Promise.resolve().then(()=>c.getHistoryConfig()).then(e=>ie(e)).catch(()=>{})},[]);let ye=(0,Q.useMemo)(()=>ln(n.map(e=>e.status?.omnitronVersion)),[n]),V=Ve(),be=(0,Q.useCallback)(async e=>{let t=n.find(t=>t.id===e)?.name??e;p(e);try{let n=await c.checkNodeStatus({id:e});if(n.sshConnected){let e=n.sshLatencyMs==null?``:` (${n.sshLatencyMs}ms)`;V.success(`${t}: SSH connected${e}`)}else n.sshConnected===!1?V.error(`${t}: SSH failed — ${n.sshError??`Connection refused`}`):V.warning(`${t}: this check did not use SSH — ${n.omnitronConnected?`omnitron answered on its Netron port`:n.omnitronError??`no answer on the Netron port`}`)}catch(e){V.error(`${t}: ${e?.message??`Check failed`}`)}finally{p(null)}},[n,V]),[xe,Se]=(0,Q.useState)(null),[Ce,we]=(0,Q.useState)(!1),[Te,U]=(0,Q.useState)(null),Ee=(0,Q.useRef)(!1),De=n.find(e=>e.id===xe),Oe=(0,Q.useCallback)(async()=>{if(xe&&!Ee.current){Ee.current=!0,we(!0),U(null);try{await c.removeNode({id:xe}),await L(),Se(null)}catch(e){U(e?.message??`Failed to remove node.`)}finally{Ee.current=!1,we(!1)}}},[xe,L]),ke=(0,Q.useCallback)(()=>{Ee.current||(Se(null),U(null))},[]),Ae=(0,Q.useCallback)(()=>{_(null),w(null),h(!0)},[]),je=(0,Q.useCallback)(e=>{_(e),w(null),h(!0)},[]),W=(0,Q.useCallback)(()=>{h(!1),_(null),w(null)},[]),Ne=(0,Q.useCallback)(async e=>{S(!0),w(null);try{let t={name:e.name.trim(),host:e.host.trim(),sshPort:e.sshPort,sshUser:e.sshUser.trim(),sshAuthMethod:e.sshAuthMethod,sshPrivateKey:e.sshAuthMethod===`key`&&e.sshPrivateKey?e.sshPrivateKey:void 0,sshPassphrase:e.sshAuthMethod===`key`&&e.sshPassphrase?e.sshPassphrase:void 0,sshPassword:e.sshAuthMethod===`password`&&e.sshPassword?e.sshPassword:void 0,runtime:e.runtime,daemonPort:e.daemonPort,tags:e.tags.split(`,`).map(e=>e.trim()).filter(Boolean)};g?await c.updateNode({id:g.id,...t}):await c.addNode(t),W(),await L()}catch(e){w(e?.message??`Failed to save node.`)}finally{S(!1)}},[g,L,W]),Fe=[...n].sort((e,t)=>e.isLocal===t.isLocal?e.name.localeCompare(t.name):e.isLocal?-1:1);return(0,$.jsxs)(G,{spacing:3,children:[(0,$.jsx)(ct,{links:[{name:`Nodes`}],action:(0,$.jsxs)(G,{direction:`row`,spacing:1,children:[(0,$.jsx)(K,{permission:`OmnitronNodes.setCheckConfig`,children:(0,$.jsx)(v,{variant:`outlined`,size:`small`,startIcon:(0,$.jsx)(Qe,{sx:{fontSize:18}}),onClick:()=>ne(!0),children:`Check Settings`})}),(0,$.jsx)(z,{title:`Refresh`,children:(0,$.jsx)(Me,{"data-console-command":`refresh`,size:`small`,"aria-label":`Refresh`,loading:l,onClick:async()=>{if(!d.current){d.current=!0,u(!0);try{let e=await L();await Promise.all([me(e),pe(),R(e)])}finally{d.current=!1,u(!1)}}},children:(0,$.jsx)($e,{sx:{fontSize:18}})})}),(0,$.jsx)(K,{permission:`OmnitronNodes.addNode`,children:(0,$.jsx)(v,{variant:`contained`,size:`small`,startIcon:(0,$.jsx)(Ye,{sx:{fontSize:18}}),onClick:Ae,children:`Add Node`})})]})}),(0,$.jsx)(ot,{active:l,label:`Refreshing node status`,detail:`Reading fleet, replication and uptime observations`}),(0,$.jsx)(_n,{states:de}),(0,$.jsx)(Pt,{nodes:n}),k&&(0,$.jsxs)(Re,{severity:`warning`,onClose:()=>A(null),children:[`Could not refresh the node list — `,k,`. The cards below are the last state the daemon reported.`]}),(j||N)&&(0,$.jsxs)(Re,{severity:`warning`,onClose:()=>{M(null),se(null)},children:[`Could not refresh the uptime history — `,j||N,`. The strips below are the last aggregation that arrived, and may be behind the cards.`]}),o?(0,$.jsx)(Pe,{container:!0,spacing:3,children:[1,2,3].map(e=>(0,$.jsx)(Pe,{size:{xs:12,sm:6,md:4},children:(0,$.jsx)(ut,{variant:`rounded`,height:300})},e))}):Fe.length===0?(0,$.jsx)(ft,{title:k?`No nodes to show`:`No nodes registered`,description:k?`The list could not be refreshed, so this may not be the whole picture.`:`Add a node to manage a remote host from here.`}):(0,$.jsx)(Pe,{container:!0,spacing:3,children:Fe.map(e=>(0,$.jsx)(Pe,{size:{xs:12,sm:6,md:4},children:(0,$.jsx)(xn,{node:e,onEdit:je,onRemove:Se,onCheckSsh:be,onDiagnose:b,checking:f===e.id,uptimeData:T[e.id]??[],lastCheckAt:D[e.id]??null,newest:ye,mesh:F[e.id]})},e.id))}),(0,$.jsx)(yn,{cluster:y?de[y.id]:void 0,open:!!y,onClose:()=>b(null),node:y?n.find(e=>e.id===y.id)??y:null}),(0,$.jsxs)(ae,{open:!!xe,onClose:ke,maxWidth:`xs`,fullWidth:!0,children:[(0,$.jsx)(le,{children:`Remove Node`}),(0,$.jsxs)(te,{children:[(0,$.jsxs)(H,{variant:`body2`,children:[`Remove `,(0,$.jsx)(`strong`,{children:De?.name??xe}),`? This cannot be undone.`]}),Te&&(0,$.jsx)(Re,{onClose:()=>U(null),children:Te})]}),(0,$.jsxs)(ce,{children:[(0,$.jsx)(v,{onClick:ke,color:`inherit`,disabled:Ce,children:`Cancel`}),(0,$.jsx)(K,{permission:`OmnitronNodes.removeNode`,children:(0,$.jsx)(v,{onClick:Oe,color:`error`,variant:`contained`,disabled:Ce,children:Ce?`Removing…`:`Remove`})})]})]}),(0,$.jsx)(K,{permission:g?`OmnitronNodes.updateNode`:`OmnitronNodes.addNode`,children:(0,$.jsx)(Dn,{open:m,onClose:W,onSubmit:Ne,editNode:g,sshKeys:i,loading:x,error:C,onDismissError:()=>w(null)})}),(0,$.jsx)(K,{permission:`OmnitronNodes.setCheckConfig`,children:(0,$.jsx)(On,{open:ee,onClose:()=>ne(!1),onSaved:e=>{V.success(`Check settings saved — ping ${e.pingEnabled?`on`:`off`}, SSH timeout ${e.sshTimeout}ms`),L()}})})]})}var Q,$,An,jn,Mn,Nn,Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn;function Gn(){return(Gn=e((()=>{at(),Ue(),Q=t(),l(),y(),x(),S(),Ce(),pe(),b(),je(),he(),C(),Ie(),re(),A(),ne(),se(),be(),Ne(),Le(),Ee(),De(),j(),Te(),p(),u(),h(),st(),dt(),ze(),lt(),Be(),Rt(),Vt(),o(),Ke(),Qt(),Ut(),Ct(),pt(),gt(),Je(),Ze(),$=n(),An=864e5,jn=90,Mn=3e5,Nn=3e5,Pn=d`
|
|
2
2
|
from { transform: rotate(0deg); }
|
|
3
3
|
to { transform: rotate(360deg); }
|
|
4
4
|
`,Fn=d`
|
|
@@ -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,V as i,ct as a,st as o}from"./mui-
|
|
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,V as i,ct as a,st as o}from"./mui-SNRRJ_vi.js";import{B as s,z as c}from"./mui-B3fJdIMc.js";function l({active:e,label:t,detail:n}){let[r,a]=(0,u.useState)(0);return(0,u.useEffect)(()=>{if(a(0),!e)return;let t=performance.now(),n=window.setInterval(()=>a(Math.floor((performance.now()-t)/1e3)),1e3);return()=>window.clearInterval(n)},[e,t]),e?(0,d.jsxs)(i,{role:`status`,"aria-live":`polite`,sx:{display:`flex`,gap:1.25,alignItems:`flex-start`,minWidth:0,py:1},children:[(0,d.jsx)(o,{size:16,thickness:4,"aria-hidden":!0,sx:{flexShrink:0,mt:`3px`,"@media (prefers-reduced-motion: reduce)":{animation:`none`,"& circle":{animation:`none`}}}}),(0,d.jsxs)(i,{sx:{flex:1,minWidth:0},children:[(0,d.jsx)(c,{variant:`body2`,sx:{overflowWrap:`anywhere`},children:t}),n&&(0,d.jsx)(c,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,overflowWrap:`anywhere`},children:n}),r>=10&&(0,d.jsx)(c,{variant:`caption`,color:`text.secondary`,sx:{display:`block`},children:`Still waiting for confirmation…`})]}),(0,d.jsxs)(c,{"aria-hidden":!0,variant:`caption`,color:`text.secondary`,sx:{fontFamily:`monospace`,whiteSpace:`nowrap`,pt:`2px`,fontVariantNumeric:`tabular-nums`},children:[r,`s`]})]}):null}var u,d;function f(){return(f=e((()=>{u=t(),r(),a(),s(),d=n()})))()}export{f as n,l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{P as r,z as i}from"./client-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{P as r,z as i}from"./client-CgyTwq9g.js";import{dn as a,un as o}from"./mui-Bdr6Ks5j.js";import{B as s,H as c,V as l,z as u}from"./mui-SNRRJ_vi.js";import{C as d,w as f}from"./mui-CMWGTMXv.js";import{N as p,P as m}from"./mui-CPEkFAPo.js";function h(){return(0,x.jsx)(p,{sx:{fontSize:18},children:(0,x.jsx)(`path`,{d:`M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z`})})}function g({href:e,label:t,sx:n,linkComponent:r}){let i=r?{component:r,to:e}:{href:e};return(0,x.jsxs)(d,{color:`inherit`,underline:`none`,sx:[e=>({verticalAlign:`middle`,display:`inline-flex`,alignItems:`center`,"& .PrismBackLinkIcon":{verticalAlign:`inherit`,transform:`translateY(-1px)`,ml:{xs:`-14px`,md:`-18px`},transition:e.transitions.create(`opacity`,{duration:e.transitions.duration.shorter})},"&:hover .PrismBackLinkIcon":{opacity:.48}}),...Array.isArray(n)?n:[n]],...i,children:[(0,x.jsx)(`span`,{className:`PrismBackLinkIcon`,children:(0,x.jsx)(h,{})}),t]})}function _({href:e,icon:t,name:n,disabled:r,current:i,linkComponent:a}){let o=(0,x.jsxs)(D,{disabled:r,"aria-current":i?`page`:void 0,children:[t&&(0,x.jsx)(O,{children:t}),n]});return e&&!r?(0,x.jsx)(d,{color:`inherit`,sx:{display:`inline-flex`},...a?{component:a,to:e}:{href:e},children:o}):o}function v(e){let t=e.trim();if(t.startsWith(`/`)||t.startsWith(`#`))return!0;try{return A.has(new URL(t,`https://placeholder.invalid`).protocol)}catch{return!1}}function y({links:e,sx:t,...n}){return(0,x.jsx)(k,{sx:t,...n,children:e?.filter(v).map(e=>(0,x.jsx)(`li`,{children:(0,x.jsx)(d,{href:e,variant:`body2`,target:`_blank`,rel:`noopener noreferrer`,children:e})},e))})}function b({sx:e,action:t,backHref:n,heading:r,slots:i={},links:a=[],moreLinks:o=[],slotProps:s={},activeLast:c=!1,linkComponent:l,...d}){let f=()=>(0,x.jsx)(C,{...s?.heading,children:n?(0,x.jsx)(g,{href:n,label:r,linkComponent:l}):r}),p=()=>i?.breadcrumbs??(0,x.jsx)(u,{separator:(0,x.jsx)(E,{}),...s?.breadcrumbs,children:a.map((e,t)=>(0,x.jsx)(_,{icon:e.icon,href:e.href,name:e.name,disabled:e.disabled||t===a.length-1&&!c,current:t===a.length-1,linkComponent:l},`${e.href??e.name??``}-${t}`))}),m=()=>(0,x.jsx)(y,{links:o,...s?.moreLinks});return(0,x.jsxs)(S,{sx:e,...d,children:[(0,x.jsxs)(w,{...s?.container,children:[(0,x.jsxs)(T,{...s?.content,children:[(r||n)&&f(),(!!a.length||i?.breadcrumbs)&&p()]}),t]}),!!o?.length&&m()]})}var x,S,C,w,T,E,D,O,k,A;function j(){return(j=e((()=>{o(),s(),f(),m(),x=n(),S=a(`div`)(({theme:e})=>({minWidth:0,display:`flex`,flexDirection:`column`,gap:e.spacing(2)})),C=a(`h6`)(({theme:e})=>({...e.typography.h4,margin:0,padding:0,display:`inline-flex`})),w=a(`div`)(({theme:e})=>({display:`flex`,flexWrap:`wrap`,gap:e.spacing(2),alignItems:`flex-start`,justifyContent:`flex-end`})),T=a(`div`)(({theme:e})=>({minWidth:0,display:`flex`,flex:`1 1 auto`,gap:e.spacing(2),flexDirection:`column`})),E=a(`span`)(({theme:e})=>({width:4,height:4,borderRadius:`50%`,backgroundColor:e.palette.text.disabled})),D=a(`div`,{shouldForwardProp:e=>e!==`disabled`})(({disabled:e,theme:t})=>({...t.typography.body2,minWidth:0,maxWidth:`100%`,overflowWrap:`anywhere`,alignItems:`center`,gap:t.spacing(.5),display:`inline-flex`,color:t.palette.text.secondary,...e&&{cursor:`default`,pointerEvents:`none`,color:t.palette.text.primary,fontWeight:600}})),O=a(`span`)({display:`inherit`,"& > :first-child:not(style)":{width:20,height:20}}),k=a(`ul`)({display:`flex`,flexDirection:`column`,"& > li":{display:`flex`}}),A=new Set([`http:`,`https:`,`mailto:`,`tel:`])})))()}function M({heading:e,links:t=[],backHref:n,sx:i,active:a=!0,action:o,...s}){let c=e||t.at(-1)?.name||`Console`,u=t.length?t:[{name:c}],d=u[0]?.href===`/`||u[0]?.name===`Console`?[...u]:[{name:`Console`,href:`/`},...u];return n&&!d.some(e=>e.href===n)&&d.splice(d.length-1,0,{name:`Back`,href:n}),(0,N.useEffect)(()=>{a&&(document.title=`${c} · Omnitron`)},[c,a]),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(l,{component:`h1`,sx:{position:`absolute`,width:`1px`,height:`1px`,p:0,m:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,border:0},children:c}),(0,P.jsx)(l,{"data-keyboard-region":`Page tools`,tabIndex:-1,sx:{minWidth:0,flexShrink:0},children:(0,P.jsx)(b,{...s,links:d,linkComponent:r,action:o?(0,P.jsx)(l,{sx:{minWidth:0,maxWidth:`100%`,"& > .MuiStack-root":{flexWrap:`wrap`}},children:o}):void 0,sx:[{minWidth:0,flexShrink:0,"& .MuiBreadcrumbs-ol":{rowGap:.5},"& .MuiBreadcrumbs-li":{minWidth:0}},...Array.isArray(i)?i:[i]]})})]})}var N,P;function F(){return(F=e((()=>{N=t(),i(),c(),j(),P=n()})))()}export{F as n,M as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{b as r,h as i,y as a}from"./client-CgyTwq9g.js";import{F as o,H as s,I as c,Q as l,V as u,Z as d,c as f,d as ee,f as p,g as m,h as te,m as h,n as g,p as ne,s as re,t as _}from"./mui-SNRRJ_vi.js";import{B as v,a as y,o as b,z as x}from"./mui-B3fJdIMc.js";import{E as S,T as C,it as w,l as T,rt as E,u as D}from"./mui-CMWGTMXv.js";import{_ as O,v as k}from"./mui-CPEkFAPo.js";import{r as A,t as j}from"./alert-BdJ2uaY0.js";import{n as M,s as N}from"./access-I0f72P9m.js";import{n as P,t as F}from"./use-polled-resource-B22hhr5L.js";import{A as I,G as L,M as R,k as ie,l as ae}from"./icons-B9Ct8PJ9.js";import{n as z,t as B}from"./operation-status-DHyYOT7G.js";import{n as V,t as oe}from"./page-breadcrumbs-3R8RZ3nA.js";import{n as H,t as se}from"./admin-data-table-CAEL2f-m.js";import{n as U,t as ce}from"./confirm-dialog-BayExVbF.js";import{r as le,t as ue}from"./formatters-RnRy4bXm.js";import{n as de,t as W}from"./settled-pair-B-wgSZl6.js";import{n as fe,r as G}from"./tabs-DGqBkXh_.js";function pe({definition:e,onClose:t,onSaved:n}){let[i,s]=(0,K.useState)(e?.name??``),[c,l]=(0,K.useState)(e?.description??``),[d,f]=(0,K.useState)(e?.steps??[{name:`inspect`,kind:`xec`,run:J}]),[p,m]=(0,K.useState)(`0`),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(``),[b,S]=(0,K.useState)(null),[C,w]=(0,K.useState)(!1),[E,D]=(0,K.useState)(!1),[k,A]=(0,K.useState)(!1),M=P(()=>a.listNodes(),{intervalMs:3e4}),N=Number(p),F=d[N],I=e=>{f(t=>t.map((t,n)=>n===N?{...t,...e}:t)),D(!0)},L=e=>{f(t=>t.map((t,n)=>n===N&&t.kind!==`release`?{...t,...e}:t)),D(!0)},R=()=>{C||(E?A(!0):t())};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(te,{open:!0,onClose:R,maxWidth:`lg`,fullWidth:!0,slotProps:{paper:{sx:{maxHeight:`calc(100dvh - 32px)`,m:2,width:`calc(100% - 32px)`}}},children:[(0,q.jsx)(re,{children:e?`Edit automation`:`New automation`}),(0,q.jsxs)(ee,{dividers:!0,sx:{minWidth:0},children:[(0,q.jsx)(B,{active:C,label:`Saving automation definition`}),(0,q.jsxs)(O,{spacing:2,children:[b&&(0,q.jsx)(j,{severity:`error`,variant:`outlined`,children:b}),(0,q.jsxs)(O,{direction:{xs:`column`,sm:`row`},spacing:2,children:[(0,q.jsx)(y,{autoFocus:!0,label:`Name`,size:`small`,value:i,fullWidth:!0,onChange:e=>{s(e.target.value),D(!0)}}),(0,q.jsx)(y,{label:`Description`,size:`small`,value:c,fullWidth:!0,onChange:e=>{l(e.target.value),D(!0)}})]}),(0,q.jsxs)(O,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`,flexWrap:`wrap`,gap:1},children:[(0,q.jsx)(x,{variant:`caption`,color:`text.secondary`,children:`Save a definition, then review its target before running.`}),(0,q.jsx)(o,{size:`small`,onClick:()=>{if(!h)v(JSON.stringify(d,null,2)),g(!0);else try{let e=JSON.parse(_);if(!Array.isArray(e)||!e.length||e.some(e=>typeof e?.name!=`string`||(e.kind===`release`?!e.target||e.run!==void 0:typeof e?.run!=`string`)))throw Error(`A non-empty array of named steps is required`);f(e),m(`0`),g(!1),S(null)}catch(e){S(String(e))}},children:h?`Step editor`:`Advanced JSON`})]}),h?(0,q.jsx)(y,{label:`Steps JSON`,multiline:!0,minRows:14,maxRows:28,fullWidth:!0,value:_,onChange:e=>{v(e.target.value),D(!0)},slotProps:{input:{sx:{fontFamily:`monospace`,fontSize:13}},htmlInput:{spellCheck:!1}}}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(fe,{value:p,onChange:m,variant:`scrollable`,scrollButtons:`auto`,"aria-label":`Automation steps`,tabs:d.map((e,t)=>({value:String(t),label:e.name||`Step ${t+1}`,closable:d.length>1})),onClose:e=>{let t=Number(e);f(e=>e.filter((e,n)=>n!==t)),m(String(Math.max(0,Math.min(N-+(t<N),d.length-2)))),D(!0)},action:(0,q.jsx)(o,{size:`small`,disabled:d.length>=32,onClick:()=>{f(e=>[...e,{name:`step-${e.length+1}`,kind:`xec`,run:J}]),m(String(d.length)),D(!0)},children:`Add step`})}),(0,q.jsxs)(u,{sx:{display:`grid`,gap:2,gridTemplateColumns:{xs:`1fr`,md:`minmax(0, 1fr) 260px`},minWidth:0},children:[(0,q.jsx)(y,{label:F.kind===`release`?`Pinned release target`:F.kind===`xec`?`Xec · TypeScript`:`Shell command`,multiline:!0,minRows:13,maxRows:26,fullWidth:!0,value:F.kind===`release`?JSON.stringify({target:F.target,args:F.args??[]},null,2):F.run,onChange:e=>L({run:e.target.value}),helperText:F.kind===`release`?`Use Advanced JSON to edit the artifact identity, entry and arguments. The daemon resolves and verifies its installation before every attempt.`:F.kind===`xec`?`$ runs locally · $target uses the selected node · params contains run input`:`Parameters are JSON in OMNITRON_PARAMS; shell interpolation is disabled`,slotProps:{input:{readOnly:F.kind===`release`,sx:{fontFamily:`monospace`,fontSize:13,lineHeight:1.7}},htmlInput:{spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`}}}),(0,q.jsxs)(O,{spacing:2,children:[(0,q.jsx)(y,{label:`Step name`,size:`small`,value:F.name,onChange:e=>I({name:e.target.value})}),(0,q.jsxs)(y,{select:!0,label:`Executor`,disabled:F.kind===`release`,size:`small`,value:F.kind??`shell`,onChange:e=>L({kind:e.target.value}),children:[(0,q.jsx)(T,{value:`xec`,children:`Xec · TypeScript`}),(0,q.jsx)(T,{value:`shell`,children:`Shell`}),F.kind===`release`&&(0,q.jsx)(T,{value:`release`,children:`Verified release`})]}),(0,q.jsxs)(y,{select:!0,label:`Target`,disabled:F.kind===`release`,size:`small`,value:F.nodeId??`local`,onChange:e=>I({nodeId:e.target.value}),children:[(0,q.jsx)(T,{value:`local`,children:`Local daemon host`}),(M.data??[]).filter(e=>!e.isLocal).map(e=>(0,q.jsx)(T,{value:e.id,children:e.name},e.id)),F.nodeId&&F.nodeId!==`local`&&!M.data?.some(e=>e.id===F.nodeId)&&(0,q.jsxs)(T,{value:F.nodeId,children:[`Unavailable · `,F.nodeId]})]}),M.error&&(0,q.jsxs)(j,{severity:`warning`,variant:`outlined`,children:[`Node list unavailable: `,M.error]}),(0,q.jsx)(y,{label:`Working directory`,size:`small`,value:F.cwd??``,placeholder:`Daemon working directory`,onChange:e=>I({cwd:e.target.value||void 0})}),(0,q.jsx)(y,{label:`Timeout (seconds)`,type:`number`,size:`small`,value:(F.timeout??3e5)/1e3,onChange:e=>I({timeout:Number(e.target.value)*1e3})}),(0,q.jsx)(y,{label:`Depends on`,size:`small`,value:(F.dependsOn??[]).join(`, `),helperText:`Step names, separated by commas`,onChange:e=>I({dependsOn:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})})]})]}),(0,q.jsx)(x,{variant:`caption`,color:`text.secondary`,children:`Scripts run with the daemon host's OS permissions. Remote targets require a trusted SSH host key. Use only reviewed code.`})]})]})]}),(0,q.jsxs)(ne,{children:[(0,q.jsx)(o,{onClick:R,disabled:C,children:`Cancel`}),(0,q.jsx)(o,{variant:`contained`,loading:C,onClick:async()=>{w(!0),S(null);try{let a={name:i,description:c,steps:h?JSON.parse(_):d,triggers:e?.triggers??[]};if(e){if(!e.conditionalUpdates)throw Error(`Update the daemon to support conditional pipeline edits`);await r.updatePipeline({id:e.id,definition:a,expectedRevision:e.revision})}else await r.createPipeline(a);n(),t()}catch(e){S(e instanceof Error?e.message:`Could not save the pipeline`)}finally{w(!1)}},disabled:C||!i.trim(),children:C?`Saving…`:`Save definition`})]})]}),(0,q.jsx)(ce,{open:k,onClose:()=>A(!1),onConfirm:t,title:`Discard edits?`,content:`Your unsaved automation changes will be lost.`,confirmLabel:`Discard`,confirmColor:`error`})]})}var K,q,J;function me(){return(me=e((()=>{z(),K=t(),s(),c(),m(),h(),p(),f(),D(),k(),b(),v(),G(),A(),U(),i(),F(),q=n(),J=`const result = await $target\`uname -s\`;
|
|
2
|
+
console.log(result.stdout);
|
|
3
|
+
`})))()}function he({run:e,targetLabel:t=e=>e??`Local daemon host`}){return(0,X.jsxs)(O,{spacing:2,sx:{minWidth:0},children:[(0,X.jsxs)(O,{direction:`row`,sx:{flexWrap:`wrap`,gap:1,alignItems:`center`},children:[(0,X.jsx)(d,{size:`small`,label:e.status,color:Z[e.status]??`default`}),(0,X.jsxs)(x,{variant:`caption`,children:[ue(e.startedAt),` · `,e.triggeredBy]})]}),(0,X.jsx)(x,{variant:`caption`,sx:{fontFamily:`monospace`,overflowWrap:`anywhere`},children:e.id}),Q(e)&&(0,X.jsx)(C,{"aria-label":`Automation in progress`}),e.status===`interrupted`&&(0,X.jsx)(j,{severity:`warning`,variant:`outlined`,children:`The executor stopped before recording completion. Inspect effects before starting another run.`}),e.steps.map(e=>(0,X.jsxs)(u,{sx:{border:1,borderColor:`divider`,borderRadius:1,p:1.5,minWidth:0},children:[(0,X.jsxs)(O,{direction:`row`,sx:{flexWrap:`wrap`,alignItems:`center`,gap:1,mb:1},children:[(0,X.jsx)(x,{variant:`subtitle2`,sx:{flex:1,overflowWrap:`anywhere`},children:e.name}),(0,X.jsx)(d,{size:`small`,label:e.status,color:Z[e.status]??`default`}),(0,X.jsxs)(x,{variant:`caption`,color:`text.secondary`,children:[le(e.duration),e.attempts?` · attempt ${e.attempts}`:``,e.exitCode!==void 0&&` · exit ${e.exitCode}`]})]}),(0,X.jsxs)(x,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,mb:1,overflowWrap:`anywhere`},children:[e.kind??`shell`,` · `,t(e.nodeId)]}),e.error&&(0,X.jsx)(j,{severity:`error`,variant:`outlined`,sx:{mb:1,overflowWrap:`anywhere`},children:e.error}),e.output&&(0,X.jsx)(u,{component:`pre`,"aria-label":`${e.name} stdout`,tabIndex:0,sx:$,children:e.output}),e.stderr&&(0,X.jsx)(u,{component:`pre`,"aria-label":`${e.name} stderr`,tabIndex:0,sx:{...$,mt:1},children:e.stderr}),e.outputTruncated&&(0,X.jsx)(x,{variant:`caption`,color:`warning.main`,children:`Output retention limit reached; earlier content was omitted.`}),e.sourceHash&&(0,X.jsxs)(x,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,mt:1,overflowWrap:`anywhere`,fontFamily:`monospace`},children:[`SHA-256 `,e.sourceHash]}),e.executions?.map(t=>(0,X.jsxs)(u,{sx:{mt:1},children:[t.state===`unconfirmed`&&(0,X.jsxs)(j,{severity:`warning`,variant:`outlined`,children:[`Attempt `,t.attempt,` has unconfirmed effects. Automatic retries were refused; inspect the recorded process before running again.`]}),(0,X.jsx)(u,{component:`pre`,"aria-label":`${e.name} release attempt ${t.attempt}`,sx:$,children:JSON.stringify(t,null,2)})]},t.attempt))]},e.name))]})}function ge(){let[e,t]=(0,Y.useState)(null),[n,i]=(0,Y.useState)(`definitions`),[s,c]=(0,Y.useState)(null),[l,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(`{}`),[h,g]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(0),[D,k]=(0,Y.useState)(25),A=P(()=>a.listNodes(),{intervalMs:3e4,enabled:!!(l||s)}),N=e=>!e||e===`local`?`Local daemon host`:A.data?.find(t=>t.id===e)?.name??e,{data:F,loading:L,error:z,refresh:B}=P(async()=>{let e=await de([r.listPipelines(),r.listRuns({limit:100})],[[],[]]);return{definitions:e.first,runs:e.second,partialFailure:e.partialFailure}},{intervalMs:3e3}),V=F?.definitions??[],H=F?.runs??[],U=P(()=>r.getRunStatus({runId:s}),{intervalMs:3e3,enabled:!!s,resourceKey:s}),W=U.data?.id===s?U.data:null,G=async e=>{b(!0),g(null);try{await e(),await B()}catch(e){g(_e(e))}finally{b(!1)}};return(0,X.jsxs)(O,{spacing:2,sx:{minWidth:0},children:[(0,X.jsx)(oe,{links:[{name:`Pipelines`}],action:(0,X.jsxs)(O,{direction:`row`,spacing:1,children:[(0,X.jsx)(E,{"data-console-command":`refresh`,size:`small`,title:`Refresh pipelines`,onClick:B,children:(0,X.jsx)(R,{})}),(0,X.jsx)(M,{permission:`OmnitronPipelines.createPipeline`,children:(0,X.jsx)(o,{size:`small`,variant:`contained`,startIcon:(0,X.jsx)(I,{}),onClick:()=>t(`new`),children:`New automation`})})]})}),(z||F?.partialFailure||h)&&(0,X.jsxs)(j,{severity:`warning`,variant:`outlined`,children:[h??z??F?.partialFailure,` · Displayed run state may be stale.`]}),(0,X.jsx)(fe,{value:n,onChange:e=>{i(e),T(0)},"aria-label":`Pipeline views`,tabs:[{value:`definitions`,label:`Automations · ${V.length}`},{value:`runs`,label:`Runs · ${H.length}`}]}),n===`definitions`?(0,X.jsx)(se,{data:V.slice(w*D,(w+1)*D),columns:[{key:`name`,header:`Automation`,render:e=>(0,X.jsx)(o,{size:`small`,onClick:()=>t(e),sx:{textAlign:`left`},children:e.name})},{key:`description`,header:`Description`,render:e=>e.description||`—`},{key:`steps`,header:`Steps`,render:e=>e.steps.length},{key:`actions`,header:``,align:`right`,render:e=>(0,X.jsxs)(O,{direction:`row`,sx:{justifyContent:`flex-end`,gap:1},children:[(0,X.jsx)(M,{permission:`OmnitronPipelines.executePipeline`,children:(0,X.jsx)(o,{size:`small`,startIcon:(0,X.jsx)(ie,{}),disabled:v,onClick:()=>{f(e),m(`{}`),g(null)},children:`Run`})}),(0,X.jsx)(M,{permission:`OmnitronPipelines.deletePipeline`,children:(0,X.jsx)(E,{size:`small`,title:`Delete ${e.name}`,disabled:v,onClick:()=>C(e),children:(0,X.jsx)(ae,{})})})]})}],rowKey:e=>e.id,total:V.length,page:w,pageSize:D,onPageChange:T,onPageSizeChange:e=>{k(e),T(0)},loading:L,loadError:z??F?.partialFailure,emptyMessage:`Create an automation to run Xec scripts and shell steps.`,minWidth:560,scrollLabel:`Automation definitions`,dense:!0}):(0,X.jsx)(se,{data:H.slice(w*D,(w+1)*D),columns:[{key:`name`,header:`Automation`,render:e=>(0,X.jsx)(o,{size:`small`,onClick:()=>c(e.id),children:V.find(t=>t.id===e.pipelineId)?.name??e.pipelineId.slice(0,8)})},{key:`status`,header:`Status`,render:e=>(0,X.jsx)(d,{size:`small`,label:e.status,color:Z[e.status]??`default`})},{key:`startedAt`,header:`Started`,render:e=>ue(e.startedAt)},{key:`duration`,header:`Duration`,render:e=>le(Date.parse(e.completedAt??new Date().toISOString())-Date.parse(e.startedAt))},{key:`triggeredBy`,header:`Actor`,render:e=>e.triggeredBy}],rowKey:e=>e.id,total:H.length,page:w,pageSize:D,onPageChange:T,onPageSizeChange:e=>{k(e),T(0)},loading:L,loadError:z??F?.partialFailure,emptyMessage:`No automation runs yet.`,minWidth:620,scrollLabel:`Automation run history`,dense:!0}),e&&(0,X.jsx)(pe,{...e===`new`?{}:{definition:e},onClose:()=>t(null),onSaved:()=>{B()}}),(0,X.jsxs)(te,{open:!!l,onClose:()=>{v||f(null)},maxWidth:`md`,fullWidth:!0,children:[(0,X.jsxs)(re,{children:[`Run `,l?.name]}),(0,X.jsx)(ee,{dividers:!0,children:(0,X.jsxs)(O,{spacing:2,children:[h&&(0,X.jsx)(j,{severity:`error`,variant:`outlined`,children:h}),A.error&&(0,X.jsx)(j,{severity:`warning`,variant:`outlined`,children:`Node names unavailable; verify target IDs below.`}),l?.steps.map(e=>(0,X.jsxs)(u,{component:`details`,children:[(0,X.jsxs)(u,{component:`summary`,sx:{cursor:`pointer`,fontSize:13},children:[e.name,` · `,e.kind??`shell`,` · `,N(e.nodeId),` · `,(e.timeout??3e5)/1e3,`s`]}),(0,X.jsx)(u,{component:`pre`,sx:{...$,mt:1},children:e.kind===`release`?JSON.stringify({target:e.target,args:e.args??[]},null,2):e.run}),(0,X.jsx)(u,{component:`pre`,"aria-label":`${e.name} execution settings`,sx:{...$,mt:1},children:JSON.stringify({targetId:e.nodeId??`local`,cwd:e.cwd??`Daemon working directory`,dependsOn:e.dependsOn??[],retries:e.retries??0,condition:e.condition??null,env:e.env??{}},null,2)})]},e.name)),(0,X.jsx)(y,{label:`Parameters (JSON)`,value:p,onChange:e=>m(e.target.value),multiline:!0,minRows:3,fullWidth:!0,helperText:`Values are passed as data and are not stored in run history.`,slotProps:{input:{sx:{fontFamily:`monospace`,fontSize:13}}}})]})}),(0,X.jsxs)(ne,{children:[(0,X.jsx)(o,{disabled:v,onClick:()=>f(null),children:`Cancel`}),(0,X.jsx)(o,{disabled:v,variant:`contained`,onClick:()=>G(async()=>{let e=await r.executePipeline({id:l.id,expectedRevision:l.revision,params:JSON.parse(p)});c(e.id),i(`runs`),T(0),f(null)}),children:v?`Starting…`:`Run automation`})]})]}),(0,X.jsxs)(_,{anchor:`right`,open:!!s,onClose:()=>c(null),slotProps:{paper:{sx:{width:{xs:`100%`,sm:640},maxWidth:`100vw`,p:2,boxSizing:`border-box`}}},children:[(0,X.jsxs)(O,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`,mb:2},children:[(0,X.jsx)(x,{variant:`subtitle2`,children:`Run details`}),(0,X.jsx)(E,{title:`Close run details`,onClick:()=>c(null),children:(0,X.jsx)(ae,{})})]}),U.error&&(0,X.jsx)(j,{severity:`warning`,variant:`outlined`,children:`Updates unavailable. The displayed state may be stale.`}),h&&(0,X.jsx)(j,{severity:`error`,variant:`outlined`,sx:{mb:2},children:h}),W?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(he,{run:W,targetLabel:N}),(0,X.jsx)(M,{permission:`OmnitronPipelines.cancelRun`,children:Q(W)&&(0,X.jsx)(o,{sx:{mt:2},color:`warning`,variant:`outlined`,disabled:v||W.status===`cancelling`,onClick:()=>G(async()=>{await r.cancelRun({runId:W.id}),await U.refresh()}),children:`Cancel run`})})]}):(0,X.jsx)(j,{severity:`info`,variant:`outlined`,children:U.loading?`Loading run state…`:`Run state is unavailable.`})]}),(0,X.jsx)(ce,{open:!!S,onClose:()=>{v||C(null)},onConfirm:()=>G(async()=>{await r.deletePipeline({id:S.id}),C(null)}),title:`Delete automation?`,content:`${S?.name??``} and its run history will be removed. Active runs must be stopped first.`,confirmLabel:`Delete`,confirmColor:`error`})]})}var Y,X,Z,Q,_e,$;function ve(){return(ve=e((()=>{Y=t(),s(),c(),l(),m(),h(),p(),f(),g(),w(),S(),k(),b(),v(),G(),H(),A(),U(),N(),L(),V(),me(),i(),F(),W(),X=n(),Z={success:`success`,failed:`error`,running:`info`,pending:`default`,cancelling:`warning`,interrupted:`warning`,cancelled:`default`},Q=e=>[`pending`,`running`,`cancelling`].includes(e.status),_e=e=>e instanceof Error?e.message:String(e),$={m:0,p:1.5,borderRadius:1,bgcolor:`action.hover`,fontFamily:`monospace`,fontSize:12,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,maxHeight:320,overflow:`auto`,minWidth:0}})))()}ve();export{he as PipelineRunDetail,ge as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-CNOWq4Kh.js";import{i as n}from"./react-BN8qLIAi.js";import{O as r,g as i,h as a,x as o}from"./client-CgyTwq9g.js";import{n as s,r as c}from"./services-BddvcFi8.js";import{n as l,t as u}from"./react-CEuifcaQ.js";import{a as d,i as f,n as p,o as m,r as h}from"./storage-CKXnhqkt.js";function g(e){let t=/^(.*)-\d{12}-([0-9a-f]{8})-([0-9a-f]{8})(?:-[A-Za-z0-9]{6})?$/.exec(e);return{project:t?.[1]??e,projectCommit:t?.[2]??null,omniCommit:t?.[3]??null}}function ee(e){let t=e.apps.filter(e=>e.status!==`online`).map(e=>`${e.name} (${e.status})`),n=e.apps.length,r=n-t.length,i=e.notUp??[],a=[...new Set([...i,...t.filter(e=>!i.some(t=>t.startsWith(e+`: `)))])];e.status!==`running`&&a.push(`stack state: ${e.status}`);let o=a.length===0?`confirmed`:e.status===`error`?`failed`:`partial`;return{confirmed:o===`confirmed`,outcome:o,online:r,total:n,issues:a}}function _(e){return JSON.stringify([e.project,e.stack,e.node,e.app])}async function v(e,t,n,r,i=3e3){let a=!0,o=!1,s,c=new Map,l=new Map,u=async()=>{let t=!0,d=[];try{let t=await n();if(!a)return;for(let n of t){if(n.project!==e.project||n.stack!==e.stack||!n.operationId||n.releaseId!==e.release)continue;let t=_(n),r=JSON.stringify([n.operationId,n.status,n.progress,n.at,n.message]);o&&c.get(t)!==r&&(d.push(n),l.set(t,n)),c.set(t,r)}o=!0}catch{t=!1}a&&(r([...l.values()].sort((e,t)=>t.at.localeCompare(e.at)),d,t),s=setTimeout(()=>{u()},i))};u();try{return await t()}finally{a=!1,clearTimeout(s)}}function y(e,t,n){let r=[],i=[];for(let a of e){if(!a.project||!a.stack){i.push(a);continue}let e=(t.configurations?.find(e=>e.runtimeProject===a.project))?.stacks[a.stack]??(a.project===t.name?a.stack:void 0);e&&(!n||e===n)&&r.push(a.project===t.name&&a.stack===e?a:{...a,project:t.name,stack:e})}return{transfers:r,unscoped:i}}function b(e){return e?`${e.platform}/${e.arch} · Node ${e.node} · ABI ${e.abi}`:`Target not recorded`}function x(e){let t=e.omni.reproduced,n=t?.packages??e.omni.registry?.packages,r=n?.length??e.builtWith?.packages?.length;return r===void 0?`Framework source not recorded`:`${t?`Reproduced archives`:n?`npm registry`:`Linked checkout`} · ${r} framework package${r===1?``:`s`}`}function te(e){let t=e.length===1?e[0]:null;return t&&t.name===`gates`&&t.status===`not-run`?t:null}function ne(e){if(e.manifestError)return{text:`invalid manifest`,tone:`failed`};if(!e.complete)return{text:`no manifest`,tone:`none`};let t=te(e.gateList);if(t)return{text:/--skip-gates/.test(t.detail??``)?`skipped`:`not run`,tone:`unfinished`};let{total:n,passed:r,failed:i}=e.gates;return n===0?{text:`—`,tone:`none`}:{text:`${r}/${n}`,tone:i>0?`failed`:r<n?`unfinished`:`passed`}}function re(e,t){return e?{known:!0,deployments:t}:{known:!1,why:w}}function ie(e){let t=new Map;for(let n of e)n.release&&t.set(n.release,[...t.get(n.release)??[],n]);return t}function ae(e,t){let n=[e.project===!1?t:null,e.omni===!1?`omni`:null].filter(Boolean),r=[e.project==null?t:null,e.omni==null?`omni`:null].filter(Boolean);return{state:n.length?`missing`:r.length?`unknown`:`recorded`,label:n.length?`Git: unpublished source`:r.length?`Git: unverified`:`Git: publication recorded`,detail:n.length?`This release records unpublished source for ${n.join(` and `)}. Source publication is separate from where applications are deployed or running.`:r.length?`Git publication could not be verified for ${r.join(` and `)} when this release was built. This does not establish that the source is unpublished.`:`This release records both source commits as published at build time. This saved observation does not check current availability or identify running deployments.`}}function S(e,t,n){if(!n.known)return n;let r=t.runtimeScope??{project:e,stack:t.name},i=n.deployments.filter(n=>n.project===e&&n.stack===t.name||n.project===r.project&&n.stack===r.stack);if(i.length===0)return{known:!0,last:null};if(i.some(e=>!Number.isFinite(Date.parse(e.at))))return{known:!1,why:`Deployment history contains an invalid timestamp`};let a=Math.max(...i.map(e=>Date.parse(e.at))),o=i.filter(e=>Date.parse(e.at)===a);return new Set(o.map(e=>JSON.stringify([e.release,e.releaseUnnamed,e.projectCommit,e.omniCommit]))).size>1?{known:!1,why:`Conflicting deployment records have the same timestamp`}:{known:!0,last:o[0]}}function C(e){let t=[],n=new Map,r=new Map,i=(e,i,a=!0)=>{if(a&&e.status===`stopped`)return;let o={app:e.name,node:i,pid:e.pid??null,...typeof e.generation==`string`&&{generation:e.generation}};if(!a||e.status===`unknown`){t.push({...o,state:`unavailable`,reason:`Application inventory unavailable; launch identity is unknown`});return}let s=e.release,c=e.generation!==void 0,l=typeof e.generation==`string`&&e.generation.length>0&&s?.state===`confirmed`&&e.generation===s.launchId,u=Number.isSafeInteger(e.pid)&&e.pid>0,d=c?l&&(e.pid==null||u):u,f=s?.state===`confirmed`?s.consumer:void 0,p=f===void 0||f&&typeof f==`object`&&!Array.isArray(f)&&Object.keys(f).sort().join(`,`)===`app,manifestSha256,releaseId`&&typeof f.releaseId==`string`&&/^[A-Za-z0-9][A-Za-z0-9._-]{0,255}$/.test(f.releaseId)&&!f.releaseId.includes(`..`)&&/^[a-f0-9]{64}$/.test(f.manifestSha256)&&f.app===e.name.split(`/`).at(-1);if(s?.state===`confirmed`&&e.status===`online`&&d&&s.basis===`verified-launch`&&typeof s.releaseId==`string`&&s.releaseId.length>0&&/^[a-f0-9]{64}$/.test(s.manifestSha256)&&/^[a-f0-9]{64}$/.test(s.artifactSha256)&&typeof s.launchId==`string`&&s.launchId.length>0&&Number.isFinite(Date.parse(s.observedAt))&&p){t.push({...o,state:`confirmed`,releaseId:s.releaseId,observedAt:s.observedAt,launchId:s.launchId,...f&&{consumer:{...f}}});let e=f??s;n.set(`${e.releaseId}:${e.manifestSha256}`,{releaseId:e.releaseId,manifestSha256:e.manifestSha256});let i=r.get(s.releaseId)??new Set;i.add(s.manifestSha256),r.set(s.releaseId,i)}else s?.state===`modified`?t.push({...o,state:`modified`,...s.releaseId&&{releaseId:s.releaseId},reason:s.reason}):t.push({...o,state:`unreported`,reason:e.status===`online`?s?.state===`confirmed`&&c&&!l?`Application generation is invalid or differs from its launch receipt; request a fresh owner observation`:s?.state===`confirmed`&&!d?`Application is online but its process identity is unavailable; the launch receipt cannot be bound to this instance`:p?s?.state===`unreported`?s.reason:s?`Runtime launch evidence is incomplete or invalid`:`Runtime does not report a verified launch receipt`:`Runtime launch consumer does not match this application or has invalid identity`:`Application is ${e.status}; no active launch is confirmed`})};if(e.type!==`local`&&e.placements?.length)for(let t of e.placements){for(let e of t.apps)i(e.process??{name:e.name,status:t.appsObserved?`stopped`:`unknown`},t.nodeKey,t.appsObserved);!t.appsObserved&&t.apps.length===0&&i({name:`inventory`,status:`unknown`},t.nodeKey,!1)}else{for(let t of e.apps)i(t,null);if(e.type!==`local`)for(let t of e.nodes.filter(e=>!e.connected))i({name:`inventory`,status:`unknown`},`${t.host}:${t.port}`,!1)}let a={verified:t.filter(e=>e.state===`confirmed`).length,total:t.length,releases:[...n.values()],observations:t},o=new Set(a.releases.map(e=>e.releaseId)).size!==n.size||[...r.values()].some(e=>e.size>1);return{runningRelease:t.length===0&&e.status===`stopped`?`not-running`:o||t.some(e=>e.state===`modified`)?`modified`:t.length===0||t.some(e=>e.state!==`confirmed`)?`unreported`:n.size>1?`mixed`:`confirmed`,releaseEvidence:a}}function oe(e){switch(e.runningRelease){case`not-running`:return`No applications running`;case`confirmed`:return`Launch release verified`;case`mixed`:return`Different releases are running`;case`modified`:return`Runtime differs from its release evidence`;default:return`Current release not reported`}}async function se(e,t){let[n,r]=await Promise.allSettled([t.stacks(),t.deployments()]),i=r.status===`fulfilled`?r.value:{known:!1,why:`Deployment history could not be read`},a=n.status===`fulfilled`?n.value.flatMap(e=>e.runtimeScope?[e.runtimeScope]:[]):[],o=i.known?{known:!0,deployments:i.deployments.filter(t=>t.project===e||a.some(e=>t.project===e.project&&t.stack===e.stack))}:i;return{project:e,observedAt:new Date().toISOString(),history:o,inventory:n.status===`fulfilled`?{known:!0}:{known:!1,why:`Stack inventory could not be read; execution state is unknown`},stacks:n.status===`fulfilled`?n.value.map(t=>({project:e,stack:t.name,type:t.type,status:t.status,apps:{online:t.apps.filter(e=>e.status===`online`).length,total:t.apps.length,unknown:t.apps.filter(e=>e.status===`unknown`).length},nodes:t.nodes.map(({host:e,port:t,label:n,connected:r})=>({host:e,port:t,label:n,connected:r,endpoint:`${e.includes(`:`)&&!e.startsWith(`[`)?`[${e}]`:e}:${t}`})),history:S(e,t,o),...C(t)})):[]}}var w;function T(){return(T=t((()=>{w=`the daemon cannot read the deployment audit history; current execution is a separate observation`})))()}function E(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:D(e)&&D(t)?O(e)&&O(t)?k(e,t):A(e,t):k({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}var D,O,k,A;function j(){return(j=t((()=>{D=e=>Symbol.iterator in e,O=e=>`entries`in e,k=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},A=(e,t)=>{let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),a=r.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=n.next(),a=r.next()}return!!i.done&&!!a.done}})))()}function M(e){let t=N.useRef(void 0);return n=>{let r=e(n);return E(t.current,r)?t.current:t.current=r}}var N;function P(){return(P=t((()=>{N=e(n(),1),j()})))()}function F(e){return{runningStacks:e.filter(e=>e.status===`running`).length,totalStacks:e.length,unknownStacks:e.filter(e=>e.status===`unknown`).length}}function I(e){return e.flatMap(e=>e.apps.map(t=>({...t,stack:e.name,stackType:e.type})))}function L(){return(L=t((()=>{})))()}function R(e,t,n){if(!t)return[];let r=e?.configurations??[];if(n){let e=new Set;for(let t of r)for(let[r,i]of Object.entries(t.stacks))i===n&&e.add(`${t.runtimeProject}/${r}/`);return e.add(`${t}/${n}/`),[...e]}return[...new Set([t,...r.map(e=>e.runtimeProject)])].map(e=>`${e}/`)}function z(e,t){let[n,r]=t.split(`/`);return!n||!r||t.split(`/`).length<3?null:e?.configurations?.find(e=>e.runtimeProject===n)?.stacks[r]??r}function B(e,t,n){let r=e.find(e=>e.name===t||e.configurations?.some(e=>e.runtimeProject===t));if(!r)return null;let i=r.configurations?.find(e=>e.runtimeProject===t),a=Object.values(i?.stacks??{});return{project:r.name,stack:r.name===t?n:n?i?.stacks[n]??null:a.length===1?a[0]:null}}function V(){return(V=t((()=>{})))()}function H(e,t){e?d(K,e):f(K),t?d(q,t):f(q)}function U(){let e=p(K);return{project:e,stack:e?p(q):null,routes:h(J,{})}}function W(e){m(J,e)}function G(e,t,n,r){let i=e[t];return i?{...e,[t]:i.map(e=>e.name===n?{...e,status:r}:e)}:e}function ce(){return X(M(e=>(e.activeProject?e.stacksByProject[e.activeProject]:void 0)??Q))}var K,q,J,Y,X,Z,Q;function $(){return($=t((()=>{s(),T(),l(),P(),a(),K=`omnitron_active_project`,q=`omnitron_active_stack`,J=`omnitron_workspace_routes`,Y=`__omnitron__`,X=u((e,t)=>{let n=U(),a=new Map,s=null,l=null,u=0,d=0,f=(t,n)=>e(e=>{let r={...e.stackNotices};return n?r[t]=n:delete r[t],{stackNotices:r}}),p=async(n,r)=>{try{await a.get(r),await t().fetchStacks(r)}finally{e(e=>{let t={...e.pendingOps};return delete t[n],{pendingOps:t}})}};return{projects:[],stacksByProject:{},stackReadErrors:{},stackNotices:{},clearStackNotice:e=>f(e),stackRuntimes:{},pendingOps:{},activeProject:n.project,activeStack:n.stack,workspaceRoutes:n.routes,loading:!1,error:null,fetchProjects:async n=>{if(!l)return;let r=u;try{e({loading:!0,error:null});let i=await o.listProjects();if(r!==u)return;e(e=>({projects:i.map(t=>e.stacksByProject[t.name]?{...t,...F(e.stacksByProject[t.name])}:t),loading:!1}));let a=t().activeProject;if(a){let r=B(i,a,t().activeStack);if(r){let i=t().activeStack;if(r.project!==a){let o=e=>i&&r.stack&&e===`/stacks/${i}`?`/stacks/${r.stack}`:e,s={...t().workspaceRoutes};if(s[a]&&!s[r.project]&&(s[r.project]=o(s[a])),e({activeProject:r.project,activeStack:r.stack,workspaceRoutes:s}),H(r.project,r.stack),W(s),t().fetchStacks(r.project),n&&o(n)!==n)return o(n)}else t().fetchStacks(a)}else e({activeProject:null,activeStack:null}),H(null,null)}else if(i.length===1){let n=i[0].name;e({activeProject:n}),H(n,null),t().fetchStacks(n)}}catch(t){r===u&&e({error:t.message,loading:!1})}},setInventoryReaders:(t,n)=>{l!==t&&(l=t,u++,e({projects:[],loading:!1,error:null})),s!==n&&(s=n,d++,a.clear(),e({stacksByProject:{},stackReadErrors:{}}))},fetchStacks:async n=>{if(!s)return null;let r=d,i=a.get(n);if(i)return i;let c=(async()=>{try{let i=await o.listStacks({project:n});return r===d?(e(e=>({stacksByProject:{...e.stacksByProject,[n]:i},stackReadErrors:{...e.stackReadErrors,[n]:null},projects:e.projects.map(e=>e.name===n?{...e,...F(i)}:e)})),t().activeProject===n&&t().activeStack&&!i.some(e=>e.name===t().activeStack)&&(e({activeStack:null}),H(n,null)),i):null}catch(t){return r===d&&e(e=>({stackReadErrors:{...e.stackReadErrors,[n]:t.message}})),null}})();a.set(n,c);try{return await c}finally{a.get(n)===c&&a.delete(n)}},fetchStackStatus:async(t,n)=>{try{let r=await o.getStackStatus({project:t,stack:n});return e(e=>({stackRuntimes:{...e.stackRuntimes,[`${t}/${n}`]:r}})),r}catch(t){return e({error:t.message}),null}},selectProject:(n,r)=>{let i=t(),a={...i.workspaceRoutes};if(r){let e=i.activeProject??Y;a[e]=r}let o=a[n]??`/`;return e({activeProject:n,activeStack:null,workspaceRoutes:a}),H(n,null),W(a),t().fetchStacks(n),o},deselectProject:n=>{let r=t(),i={...r.workspaceRoutes};n&&r.activeProject&&(i[r.activeProject]=n);let a=i[Y]??`/`;return e({activeProject:null,activeStack:null,workspaceRoutes:i}),H(null,null),W(i),a},saveCurrentRoute:n=>{let r=t(),i=r.activeProject??Y,a={...r.workspaceRoutes,[i]:n};e({workspaceRoutes:a}),W(a)},selectStack:n=>{let{activeProject:r,stacksByProject:i}=t();(!n||r&&i[r]?.some(e=>e.name===n))&&(e({activeStack:n}),H(r,n))},addProject:async(n,r)=>{try{e({loading:!0,error:null}),await o.addProject({name:n,path:r}),await t().fetchProjects()}catch(t){throw e({error:t.message,loading:!1}),t}},updateProject:async(n,r)=>{try{e({loading:!0,error:null});let i=await o.updateProject({name:n,...r});i.name!==n&&t().activeProject===n&&(e({activeProject:i.name,activeStack:null}),H(i.name,null)),await t().fetchProjects()}catch(t){throw e({error:t.message,loading:!1}),t}},removeProject:async n=>{try{e({loading:!0,error:null}),await o.removeProject({name:n}),t().activeProject===n&&(e({activeProject:null,activeStack:null}),H(null,null)),await t().fetchProjects()}catch(t){throw e({error:t.message,loading:!1}),t}},startStack:async(n,a,o)=>{let s=`${n}/${a}`;if(t().pendingOps[s])return{state:`busy`,message:`An operation is already pending for ${s}.`};f(s),e(e=>({pendingOps:{...e.pendingOps,[s]:`starting`},stacksByProject:G(e.stacksByProject,n,a,`starting`)}));try{let{outcome:e,issues:t,online:r,total:c}=ee(await i(`startStack`,{project:n,stack:a,...o?.release?{release:o.release}:{},...o?.workingTree?{workingTree:!0}:{},...o?.allowDirty?{allowDirty:!0}:{}}));if(e===`confirmed`)return{state:e};let l=`${s}: ${r}/${c} apps online. ${t.join(`; `)}.`;return f(s,l),{state:e,message:l}}catch(e){let t=r(e)||c(e),n=t?`No start acknowledgement for ${s}. Inspect the stack and deployment history before retrying.`:e instanceof Error?e.message:String(e);return f(s,n),{state:t?`unconfirmed`:`failed`,message:n}}finally{await p(s,n)}},resumeInstalledStack:async(n,a)=>{let o=`${n}/${a}`;if(!t().pendingOps[o]){f(o),e(e=>({pendingOps:{...e.pendingOps,[o]:`resuming`}}));try{let e=await i(`resumeInstalledStack`,{project:n,stack:a});if(e.outcome!==`running`){let t=e.nodes.filter(e=>e.outcome!==`running`).map(e=>[e.node,e.outcome,e.reason].filter(Boolean).join(` · `));f(o,[`Resume ${e.outcome}`,...t,e.operationId].join(` · `))}}catch(e){f(o,r(e)||c(e)?`Resume acknowledgement unavailable. Check the stack and each recipient before another recovery.`:e instanceof Error?e.message:String(e))}finally{await p(o,n)}}},stopStack:async(n,a,o,s=!1)=>{let l=`${n}/${a}`;if(!t().pendingOps[l]){f(l),e(e=>({pendingOps:{...e.pendingOps,[l]:`stopping`},stacksByProject:G(e.stacksByProject,n,a,`stopping`)}));try{let e=await i(`stopStack`,{project:n,stack:a,review:o,...s&&{keepInfrastructure:!0}});if(e.status!==`stopped`||e.stopOperation?.phase!==`stopped`)throw Error(`Daemon did not confirm the complete stack stop`);if(s&&e.stopOperation.keepInfrastructure!==!0)throw Error(`Daemon did not confirm infrastructure preservation. Inspect the stop operation before retrying.`)}catch(e){f(l,r(e)||c(e)?`Stop acknowledgement has not arrived. Check the stack operation before retrying; applications may still be running.`:e.message)}finally{await p(l,n)}}},createStack:async(n,r)=>{try{e({error:null});let i=await o.createStack({project:n,...r});return await t().fetchStacks(n),i}catch(t){throw e({error:t.message}),t}},deleteStack:async(e,n)=>{try{f(`${e}/${n}`),await o.deleteStack({project:e,stack:n}),await t().fetchStacks(e)}catch(t){throw f(`${e}/${n}`,t.message),t}},getStackPendingOp:(e,n)=>t().pendingOps[`${e}/${n}`]??null,clearError:()=>e({error:null})}}),Z=()=>X(e=>e.activeProject),Q=[]})))()}export{ie as C,oe as S,ne as _,V as a,ae as b,L as c,_ as d,re as f,y as g,v as h,X as i,I as l,T as m,Z as n,R as o,x as p,ce as r,z as s,$ as t,F as u,se as v,b as x,g as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{B as r,U as i,V as a,h as o,x as s,z as c}from"./client-DFnuv2z3.js";import{Vt as l,Yt as u}from"./mui-BTN91yBK.js";import{A as d,D as f,F as p,H as m,I as h,M as g,O as ee,Q as _,V as v,Z as y,c as b,d as x,f as S,g as C,h as w,i as T,j as E,k as D,m as O,p as k,r as A,s as j}from"./mui-BXSXx9c9.js";import{B as M,F as N,I as P,a as F,o as I,z as L}from"./mui-Cd711nOk.js";import{B as te,it as R,rt as z,z as B}from"./mui-AnEgAVjz.js";import{_ as V,v as H}from"./mui-BwsIrivo.js";import{r as ne,t as U}from"./alert-uBG6r9NW.js";import{n as re,r as ie}from"./snackbar-DSPmjMyi.js";import{c as ae,n as W,s as oe}from"./access-48hkC2-P.js";import{r as G,t as se}from"./use-polled-resource-B22hhr5L.js";import{i as K,t as ce}from"./project.store--G5pIF-J.js";import{A as le,G as ue,L as de,M as fe,j as pe,p as me}from"./icons-OboZgWSt.js";import{n as he,t as ge}from"./label-B1SF0RTL.js";import{n as _e,t as ve}from"./operation-status-Bm1x1wTz.js";import{n as ye,t as be}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as xe,t as Se}from"./skeleton-BmWDJWF9.js";import{l as Ce}from"./formatters-RnRy4bXm.js";import{n as we,t as Te}from"./empty-content-7jOFhG4C.js";function Ee({project:e,onClose:t,onImport:n}){let[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(`local=test`),[d,f]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),g=async()=>{f(``),h(!0);try{let i=Object.create(null);for(let e of l.trim().split(/\n+/)){let t=e.split(`=`).map(e=>e.trim());if(t.length!==2||!t[0]||!t[1]||Object.hasOwn(i,t[0]))throw Error(`Use one unique source=project stack mapping per line.`);i[t[0]]=t[1]}await n({project:e.name,name:r.trim(),path:a.trim(),...s.trim()?{registration:s.trim()}:{},stacks:i,expectedRevision:e.catalogRevision??``}),t()}catch(e){f(e instanceof Error?e.message:String(e))}finally{h(!1)}};return(0,J.jsxs)(w,{open:!0,onClose:m?void 0:t,fullWidth:!0,maxWidth:`sm`,children:[(0,J.jsxs)(j,{children:[`Import stacks into `,e.displayName]}),(0,J.jsx)(x,{children:(0,J.jsxs)(V,{spacing:2,sx:{pt:1},children:[(0,J.jsx)(L,{variant:`body2`,color:`text.secondary`,children:`Add stacks from a configuration in this repository. Running applications and their history stay in place.`}),(0,J.jsx)(ve,{active:m,label:`Importing stacks`,detail:`Validating the configuration and saving the project catalog`}),d&&(0,J.jsx)(U,{severity:`error`,children:d}),(0,J.jsx)(F,{autoFocus:!0,label:`Configuration name`,value:r,onChange:e=>i(e.target.value),disabled:m,required:!0}),(0,J.jsx)(F,{label:`Configuration directory`,value:a,onChange:e=>o(e.target.value),disabled:m,required:!0,helperText:`Inside ${e.path}`}),(0,J.jsx)(F,{label:`Stack mapping`,multiline:!0,minRows:2,value:l,onChange:e=>u(e.target.value),disabled:m,helperText:`Each line: source stack = stack name in this project. Map every source stack.`}),(0,J.jsx)(F,{label:`Existing registration (optional)`,value:s,onChange:e=>c(e.target.value),disabled:m,helperText:`To consolidate an existing registration, enter its exact name.`})]})}),(0,J.jsxs)(k,{children:[(0,J.jsx)(p,{onClick:t,disabled:m,children:`Cancel`}),(0,J.jsx)(p,{variant:`contained`,loading:m,onClick:()=>void g(),disabled:m||!r.trim()||!a.trim()||!l.trim()||!e.catalogRevision,children:`Import stacks`})]})]})}var q,J;function Y(){return(Y=e((()=>{_e(),q=t(),h(),C(),O(),S(),b(),H(),I(),M(),ne(),J=n()})))()}function De({project:e,onEdit:t,onRemove:n,onOpen:r,onImport:i}){let a=K(t=>t.stacksByProject[e.name]),o=K(t=>t.stackReadErrors[e.name]),s=K(e=>e.fetchStacks);G(()=>{s(e.name)},{intervalMs:1e4});let c=a?a.some(e=>e.status===`running`):!1,u=a?`${a.filter(e=>e.status===`running`).length}/${a.length}${o?` stale`:``}`:`?/${e.totalStacks}`;return(0,Q.jsxs)(E,{sx:{height:`100%`,display:`flex`,flexDirection:`column`,cursor:`pointer`,transition:`border-color 0.2s, box-shadow 0.2s`,"&:hover":{borderColor:e=>l(e.palette.primary.main,.3),boxShadow:e=>e.shadows[8]}},variant:`outlined`,onClick:()=>r(e.name),children:[(0,Q.jsxs)(f,{sx:{flex:1,pb:`12px !important`},children:[(0,Q.jsxs)(V,{direction:`row`,sx:{alignItems:`flex-start`,justifyContent:`space-between`,mb:1.5},children:[(0,Q.jsxs)(V,{direction:`row`,spacing:1,sx:{alignItems:`center`,minWidth:0},children:[(0,Q.jsx)(pe,{sx:{fontSize:28,color:c?`primary.main`:`text.secondary`,flexShrink:0}}),(0,Q.jsxs)(v,{sx:{minWidth:0},children:[(0,Q.jsx)(L,{variant:`subtitle2`,noWrap:!0,sx:{fontWeight:700},children:e.displayName}),(0,Q.jsx)(L,{variant:`caption`,noWrap:!0,sx:{color:`text.disabled`},children:e.name})]})]}),(0,Q.jsxs)(ge,{color:c?`success`:`default`,sx:{flexShrink:0},children:[u,` stacks`]})]}),(0,Q.jsx)(A,{sx:{mb:1.5}}),(0,Q.jsx)(X,{label:`Path`,value:e.path,mono:!0}),(0,Q.jsxs)(V,{spacing:.5,sx:{mt:1},children:[(0,Q.jsx)(X,{label:`Stacks`,value:u}),e.enabledStacks.length>0&&(0,Q.jsx)(X,{label:`Enabled`,value:e.enabledStacks.join(`, `)}),(0,Q.jsx)(X,{label:`Registered`,value:Ce(e.registeredAt)})]}),e.enabledStacks.length>0&&(0,Q.jsx)(V,{direction:`row`,spacing:.5,useFlexGap:!0,sx:{mt:1.5,flexWrap:`wrap`},children:e.enabledStacks.map(e=>(0,Q.jsx)(y,{label:e,size:`small`,variant:`outlined`,sx:{height:22,fontSize:11}},e))})]}),(0,Q.jsxs)(D,{sx:{px:2,pb:1.5,gap:1,flexWrap:`wrap`},onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(W,{permission:`OmnitronProject.removeProject`,children:(0,Q.jsx)(N,{title:`Remove project`,children:(0,Q.jsx)(`span`,{children:(0,Q.jsx)(z,{size:`small`,color:`error`,"aria-label":`Remove project ${e.name}`,onClick:()=>n(e.name),disabled:c,sx:{marginInlineEnd:1},children:(0,Q.jsx)(me,{sx:{fontSize:18}})})})})}),(0,Q.jsxs)(v,{sx:{marginInlineStart:`auto`,display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:1},children:[(0,Q.jsx)(W,{permission:`OmnitronProject.importConfiguration`,children:(0,Q.jsx)(p,{size:`small`,onClick:()=>i(e),children:`Import stacks`})}),(0,Q.jsx)(W,{permission:`OmnitronProject.updateProject`,children:(0,Q.jsx)(N,{title:`Settings`,children:(0,Q.jsx)(z,{size:`small`,"aria-label":`Settings for ${e.name}`,onClick:()=>t(e),children:(0,Q.jsx)(de,{sx:{fontSize:18}})})})})]})]})]})}function X({label:e,value:t,mono:n}){return(0,Q.jsxs)(V,{direction:`row`,spacing:1,sx:{justifyContent:`space-between`,alignItems:`center`},children:[(0,Q.jsx)(L,{variant:`caption`,sx:{color:`text.disabled`,flexShrink:0},children:e}),(0,Q.jsx)(L,{variant:`caption`,noWrap:!0,title:t,sx:{fontWeight:500,textAlign:`right`,minWidth:0,...n&&{fontFamily:`monospace`,fontSize:11}},children:t})]})}function Oe({open:e,onClose:t,project:n,onSave:r,loading:i}){let[a,o]=(0,Z.useState)(``);if((0,Z.useEffect)(()=>{e&&n&&o(n.path)},[e,n]),!n)return null;let s=a.trim()!==n.path,c=a.trim().length>0&&s;return(0,Q.jsxs)(w,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,children:[(0,Q.jsxs)(j,{children:[`Project Settings — `,n.displayName]}),(0,Q.jsx)(x,{children:(0,Q.jsxs)(V,{spacing:2.5,sx:{mt:1},children:[(0,Q.jsx)(F,{label:`Project Name`,value:n.displayName,disabled:!0,fullWidth:!0,helperText:`Derived from omnitron.config.ts — change it there to rename.`}),(0,Q.jsx)(F,{label:`Registry Name`,value:n.name,disabled:!0,fullWidth:!0,size:`small`}),(0,Q.jsx)(F,{label:`Project Path`,value:a,onChange:e=>o(e.target.value),fullWidth:!0,placeholder:`/absolute/path/to/project`,helperText:`Absolute path to the monorepo root containing omnitron.config.ts`,slotProps:{input:{sx:{fontFamily:`monospace`,fontSize:14}}}}),(n.configurations?.length??0)>1&&(0,Q.jsxs)(V,{spacing:1,children:[(0,Q.jsx)(L,{variant:`subtitle2`,children:`Stack configurations`}),n.configurations?.map(e=>(0,Q.jsxs)(v,{sx:{minWidth:0},children:[(0,Q.jsxs)(L,{variant:`body2`,children:[e.name,` · `,Object.values(e.stacks).join(`, `)||`Default stacks`]}),(0,Q.jsx)(L,{variant:`caption`,sx:{color:`text.secondary`,overflowWrap:`anywhere`},children:e.path})]},e.runtimeProject))]}),(0,Q.jsx)(F,{label:`Registered`,value:new Date(n.registeredAt).toLocaleString(),disabled:!0,fullWidth:!0,size:`small`})]})}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(p,{onClick:t,color:`inherit`,children:`Cancel`}),(0,Q.jsx)(W,{permission:`OmnitronProject.updateProject`,children:(0,Q.jsx)(p,{variant:`contained`,onClick:()=>r(n.name,{path:a.trim()}),disabled:!c||i,children:`Save`})})]})]})}function ke({open:e,onClose:t,onAdd:n,loading:r}){let[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{e&&(a(``),s(``))},[e]);let c=i.trim().length>0&&o.trim().length>0;return(0,Q.jsxs)(w,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,children:[(0,Q.jsx)(j,{children:`Add Project`}),(0,Q.jsx)(x,{children:(0,Q.jsxs)(V,{spacing:2.5,sx:{mt:1},children:[(0,Q.jsx)(F,{label:`Project Name`,value:i,onChange:e=>a(e.target.value),fullWidth:!0,autoFocus:!0,placeholder:`my-project`,helperText:`Unique identifier for the project registry`}),(0,Q.jsx)(F,{label:`Project Path`,value:o,onChange:e=>s(e.target.value),fullWidth:!0,placeholder:`/absolute/path/to/project`,helperText:`Absolute path to the monorepo root containing omnitron.config.ts`,slotProps:{input:{sx:{fontFamily:`monospace`,fontSize:14}}}})]})}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(p,{onClick:t,color:`inherit`,children:`Cancel`}),(0,Q.jsx)(W,{permission:`OmnitronProject.addProject`,children:(0,Q.jsx)(p,{variant:`contained`,onClick:()=>n(i.trim(),o.trim()),disabled:!c||r,children:`Add Project`})})]})]})}function Ae(){let e=K(e=>e.projects),t=K(e=>e.loading),n=K(e=>e.error),o=K(e=>e.clearError),c=K(e=>e.fetchProjects),l=K(e=>e.addProject),u=K(e=>e.updateProject),d=K(e=>e.removeProject),f=K(e=>e.selectProject),m=a(),{pathname:h}=r(),g=ie(),{can:ee}=ae(),[_,y]=i(),[b,S]=(0,Z.useState)(null),[C,T]=(0,Z.useState)(null),E=_.get(`create`)===`1`&&ee(`OmnitronProject.addProject`),D=(0,Z.useCallback)(e=>{y(t=>{let n=new URLSearchParams(t);return e?n.set(`create`,`1`):n.delete(`create`),n},{replace:!0})},[y]),[O,A]=(0,Z.useState)(null),[M,N]=(0,Z.useState)(!1);G(()=>void c(),{intervalMs:15e3});let P=(0,Z.useCallback)(e=>{let t=f(e,h);m(t)},[f,m,h]),F=(0,Z.useCallback)(async(e,t)=>{N(!0);try{await l(e,t),D(!1),g.success(`Project "${e}" added`)}catch(e){g.error(e?.message??`Failed to add project`)}finally{N(!1)}},[l,g,D]),I=(0,Z.useCallback)(async(e,t)=>{N(!0);try{await u(e,t),S(null),g.success(`Project "${e}" updated`)}catch(e){g.error(e?.message??`Failed to update project`)}finally{N(!1)}},[u,g]),te=(0,Z.useCallback)(async()=>{if(O){N(!0);try{await d(O),g.success(`Project "${O}" removed`)}catch(e){g.error(e?.message??`Failed to remove project`)}finally{A(null),N(!1)}}},[O,d,g]),R=e.find(e=>e.name===O);return(0,Q.jsxs)(V,{spacing:3,children:[(0,Q.jsx)(be,{links:[{name:`Projects`}],action:(0,Q.jsxs)(V,{direction:`row`,spacing:1,children:[(0,Q.jsx)(p,{"data-console-command":`refresh`,variant:`outlined`,size:`small`,startIcon:(0,Q.jsx)(fe,{sx:{fontSize:18}}),onClick:()=>c(),children:`Refresh`}),(0,Q.jsx)(W,{permission:`OmnitronProject.addProject`,children:(0,Q.jsx)(p,{variant:`contained`,size:`small`,startIcon:(0,Q.jsx)(le,{sx:{fontSize:18}}),onClick:()=>D(!0),children:`Add Project`})})]})}),n&&(0,Q.jsx)(U,{closable:!0,severity:`error`,onClose:o,children:n}),t&&e.length===0?(0,Q.jsx)(B,{container:!0,spacing:3,children:[1,2,3].map(e=>(0,Q.jsx)(B,{size:{xs:12,sm:6,md:4},children:(0,Q.jsx)(Se,{variant:`rounded`,height:260})},e))}):e.length===0?(0,Q.jsx)(v,{sx:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:300},children:(0,Q.jsx)(Te,{title:`No projects`,description:`Register your first project to get started. A project is a monorepo with omnitron.config.ts at the root.`})}):(0,Q.jsx)(B,{container:!0,spacing:3,children:e.map(e=>(0,Q.jsx)(B,{size:{xs:12,sm:6,md:4},children:(0,Q.jsx)(De,{project:e,onEdit:S,onRemove:A,onOpen:P,onImport:T})},e.name))}),C&&(0,Q.jsx)(Ee,{project:C,onClose:()=>T(null),onImport:async e=>{await s.importConfiguration(e),await c()}}),(0,Q.jsx)(Oe,{open:!!b,onClose:()=>S(null),project:b,onSave:I,loading:M}),(0,Q.jsx)(ke,{open:E,onClose:()=>D(!1),onAdd:F,loading:M}),(0,Q.jsxs)(w,{open:!!O,onClose:()=>A(null),maxWidth:`xs`,fullWidth:!0,children:[(0,Q.jsx)(j,{children:`Remove Project`}),(0,Q.jsxs)(x,{children:[(0,Q.jsxs)(L,{variant:`body2`,children:[`Remove `,(0,Q.jsx)(`strong`,{children:R?.displayName??O}),` from the registry? This does not delete any files on disk.`]}),R&&R.runningStacks>0&&(0,Q.jsxs)(U,{severity:`warning`,sx:{mt:2},children:[`This project has `,R.runningStacks,` running stack(s). Stop them first.`]})]}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(p,{onClick:()=>A(null),color:`inherit`,children:`Cancel`}),(0,Q.jsx)(W,{permission:`OmnitronProject.removeProject`,children:(0,Q.jsx)(p,{onClick:te,color:`error`,variant:`contained`,disabled:M||(R?.runningStacks??0)>0,children:`Remove`})})]})]})]})}var Z,Q;function $(){return($=e((()=>{oe(),Z=t(),c(),m(),g(),ee(),d(),te(),M(),h(),R(),P(),_(),H(),C(),b(),S(),O(),I(),T(),u(),ne(),ye(),we(),he(),xe(),re(),o(),Y(),ce(),se(),ue(),Q=n()})))()}$();export{Ae as default};
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{B as r,U as i,V as a,h as o,x as s,z as c}from"./client-CgyTwq9g.js";import{Vt as l,Yt as u}from"./mui-BTN91yBK.js";import{A as d,D as f,F as p,H as m,I as h,M as g,O as ee,Q as _,V as v,Z as y,c as b,d as x,f as S,g as C,h as w,i as T,j as E,k as D,m as O,p as k,r as A,s as j}from"./mui-SNRRJ_vi.js";import{B as M,F as N,I as P,a as F,o as I,z as L}from"./mui-B3fJdIMc.js";import{B as te,it as R,rt as z,z as B}from"./mui-CMWGTMXv.js";import{_ as V,v as H}from"./mui-CPEkFAPo.js";import{r as ne,t as U}from"./alert-BdJ2uaY0.js";import{n as re,r as ie}from"./snackbar-CRX6eqRT.js";import{c as ae,n as W,s as oe}from"./access-I0f72P9m.js";import{r as G,t as se}from"./use-polled-resource-B22hhr5L.js";import{i as K,t as ce}from"./project.store-D5IR3fo9.js";import{A as le,G as ue,L as de,M as fe,j as pe,p as me}from"./icons-B9Ct8PJ9.js";import{n as he,t as ge}from"./label-avMhe08g.js";import{n as _e,t as ve}from"./operation-status-DHyYOT7G.js";import{n as ye,t as be}from"./page-breadcrumbs-3R8RZ3nA.js";import{n as xe,t as Se}from"./skeleton-BnVxAoeX.js";import{l as Ce}from"./formatters-RnRy4bXm.js";import{n as we,t as Te}from"./empty-content-eyDOuOVp.js";function Ee({project:e,onClose:t,onImport:n}){let[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(`local=test`),[d,f]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),g=async()=>{f(``),h(!0);try{let i=Object.create(null);for(let e of l.trim().split(/\n+/)){let t=e.split(`=`).map(e=>e.trim());if(t.length!==2||!t[0]||!t[1]||Object.hasOwn(i,t[0]))throw Error(`Use one unique source=project stack mapping per line.`);i[t[0]]=t[1]}await n({project:e.name,name:r.trim(),path:a.trim(),...s.trim()?{registration:s.trim()}:{},stacks:i,expectedRevision:e.catalogRevision??``}),t()}catch(e){f(e instanceof Error?e.message:String(e))}finally{h(!1)}};return(0,J.jsxs)(w,{open:!0,onClose:m?void 0:t,fullWidth:!0,maxWidth:`sm`,children:[(0,J.jsxs)(j,{children:[`Import stacks into `,e.displayName]}),(0,J.jsx)(x,{children:(0,J.jsxs)(V,{spacing:2,sx:{pt:1},children:[(0,J.jsx)(L,{variant:`body2`,color:`text.secondary`,children:`Add stacks from a configuration in this repository. Running applications and their history stay in place.`}),(0,J.jsx)(ve,{active:m,label:`Importing stacks`,detail:`Validating the configuration and saving the project catalog`}),d&&(0,J.jsx)(U,{severity:`error`,children:d}),(0,J.jsx)(F,{autoFocus:!0,label:`Configuration name`,value:r,onChange:e=>i(e.target.value),disabled:m,required:!0}),(0,J.jsx)(F,{label:`Configuration directory`,value:a,onChange:e=>o(e.target.value),disabled:m,required:!0,helperText:`Inside ${e.path}`}),(0,J.jsx)(F,{label:`Stack mapping`,multiline:!0,minRows:2,value:l,onChange:e=>u(e.target.value),disabled:m,helperText:`Each line: source stack = stack name in this project. Map every source stack.`}),(0,J.jsx)(F,{label:`Existing registration (optional)`,value:s,onChange:e=>c(e.target.value),disabled:m,helperText:`To consolidate an existing registration, enter its exact name.`})]})}),(0,J.jsxs)(k,{children:[(0,J.jsx)(p,{onClick:t,disabled:m,children:`Cancel`}),(0,J.jsx)(p,{variant:`contained`,loading:m,onClick:()=>void g(),disabled:m||!r.trim()||!a.trim()||!l.trim()||!e.catalogRevision,children:`Import stacks`})]})]})}var q,J;function Y(){return(Y=e((()=>{_e(),q=t(),h(),C(),O(),S(),b(),H(),I(),M(),ne(),J=n()})))()}function De({project:e,onEdit:t,onRemove:n,onOpen:r,onImport:i}){let a=K(t=>t.stacksByProject[e.name]),o=K(t=>t.stackReadErrors[e.name]),s=K(e=>e.fetchStacks);G(()=>{s(e.name)},{intervalMs:1e4});let c=a?a.some(e=>e.status===`running`):!1,u=a?`${a.filter(e=>e.status===`running`).length}/${a.length}${o?` stale`:``}`:`?/${e.totalStacks}`;return(0,Q.jsxs)(E,{sx:{height:`100%`,display:`flex`,flexDirection:`column`,cursor:`pointer`,transition:`border-color 0.2s, box-shadow 0.2s`,"&:hover":{borderColor:e=>l(e.palette.primary.main,.3),boxShadow:e=>e.shadows[8]}},variant:`outlined`,onClick:()=>r(e.name),children:[(0,Q.jsxs)(f,{sx:{flex:1,pb:`12px !important`},children:[(0,Q.jsxs)(V,{direction:`row`,sx:{alignItems:`flex-start`,justifyContent:`space-between`,mb:1.5},children:[(0,Q.jsxs)(V,{direction:`row`,spacing:1,sx:{alignItems:`center`,minWidth:0},children:[(0,Q.jsx)(pe,{sx:{fontSize:28,color:c?`primary.main`:`text.secondary`,flexShrink:0}}),(0,Q.jsxs)(v,{sx:{minWidth:0},children:[(0,Q.jsx)(L,{variant:`subtitle2`,noWrap:!0,sx:{fontWeight:700},children:e.displayName}),(0,Q.jsx)(L,{variant:`caption`,noWrap:!0,sx:{color:`text.disabled`},children:e.name})]})]}),(0,Q.jsxs)(ge,{color:c?`success`:`default`,sx:{flexShrink:0},children:[u,` stacks`]})]}),(0,Q.jsx)(A,{sx:{mb:1.5}}),(0,Q.jsx)(X,{label:`Path`,value:e.path,mono:!0}),(0,Q.jsxs)(V,{spacing:.5,sx:{mt:1},children:[(0,Q.jsx)(X,{label:`Stacks`,value:u}),e.enabledStacks.length>0&&(0,Q.jsx)(X,{label:`Enabled`,value:e.enabledStacks.join(`, `)}),(0,Q.jsx)(X,{label:`Registered`,value:Ce(e.registeredAt)})]}),e.enabledStacks.length>0&&(0,Q.jsx)(V,{direction:`row`,spacing:.5,useFlexGap:!0,sx:{mt:1.5,flexWrap:`wrap`},children:e.enabledStacks.map(e=>(0,Q.jsx)(y,{label:e,size:`small`,variant:`outlined`,sx:{height:22,fontSize:11}},e))})]}),(0,Q.jsxs)(D,{sx:{px:2,pb:1.5,gap:1,flexWrap:`wrap`},onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(W,{permission:`OmnitronProject.removeProject`,children:(0,Q.jsx)(N,{title:`Remove project`,children:(0,Q.jsx)(`span`,{children:(0,Q.jsx)(z,{size:`small`,color:`error`,"aria-label":`Remove project ${e.name}`,onClick:()=>n(e.name),disabled:c,sx:{marginInlineEnd:1},children:(0,Q.jsx)(me,{sx:{fontSize:18}})})})})}),(0,Q.jsxs)(v,{sx:{marginInlineStart:`auto`,display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:1},children:[(0,Q.jsx)(W,{permission:`OmnitronProject.importConfiguration`,children:(0,Q.jsx)(p,{size:`small`,onClick:()=>i(e),children:`Import stacks`})}),(0,Q.jsx)(W,{permission:`OmnitronProject.updateProject`,children:(0,Q.jsx)(N,{title:`Settings`,children:(0,Q.jsx)(z,{size:`small`,"aria-label":`Settings for ${e.name}`,onClick:()=>t(e),children:(0,Q.jsx)(de,{sx:{fontSize:18}})})})})]})]})]})}function X({label:e,value:t,mono:n}){return(0,Q.jsxs)(V,{direction:`row`,spacing:1,sx:{justifyContent:`space-between`,alignItems:`center`},children:[(0,Q.jsx)(L,{variant:`caption`,sx:{color:`text.disabled`,flexShrink:0},children:e}),(0,Q.jsx)(L,{variant:`caption`,noWrap:!0,title:t,sx:{fontWeight:500,textAlign:`right`,minWidth:0,...n&&{fontFamily:`monospace`,fontSize:11}},children:t})]})}function Oe({open:e,onClose:t,project:n,onSave:r,loading:i}){let[a,o]=(0,Z.useState)(``);if((0,Z.useEffect)(()=>{e&&n&&o(n.path)},[e,n]),!n)return null;let s=a.trim()!==n.path,c=a.trim().length>0&&s;return(0,Q.jsxs)(w,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,children:[(0,Q.jsxs)(j,{children:[`Project Settings — `,n.displayName]}),(0,Q.jsx)(x,{children:(0,Q.jsxs)(V,{spacing:2.5,sx:{mt:1},children:[(0,Q.jsx)(F,{label:`Project Name`,value:n.displayName,disabled:!0,fullWidth:!0,helperText:`Derived from omnitron.config.ts — change it there to rename.`}),(0,Q.jsx)(F,{label:`Registry Name`,value:n.name,disabled:!0,fullWidth:!0,size:`small`}),(0,Q.jsx)(F,{label:`Project Path`,value:a,onChange:e=>o(e.target.value),fullWidth:!0,placeholder:`/absolute/path/to/project`,helperText:`Absolute path to the monorepo root containing omnitron.config.ts`,slotProps:{input:{sx:{fontFamily:`monospace`,fontSize:14}}}}),(n.configurations?.length??0)>1&&(0,Q.jsxs)(V,{spacing:1,children:[(0,Q.jsx)(L,{variant:`subtitle2`,children:`Stack configurations`}),n.configurations?.map(e=>(0,Q.jsxs)(v,{sx:{minWidth:0},children:[(0,Q.jsxs)(L,{variant:`body2`,children:[e.name,` · `,Object.values(e.stacks).join(`, `)||`Default stacks`]}),(0,Q.jsx)(L,{variant:`caption`,sx:{color:`text.secondary`,overflowWrap:`anywhere`},children:e.path})]},e.runtimeProject))]}),(0,Q.jsx)(F,{label:`Registered`,value:new Date(n.registeredAt).toLocaleString(),disabled:!0,fullWidth:!0,size:`small`})]})}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(p,{onClick:t,color:`inherit`,children:`Cancel`}),(0,Q.jsx)(W,{permission:`OmnitronProject.updateProject`,children:(0,Q.jsx)(p,{variant:`contained`,onClick:()=>r(n.name,{path:a.trim()}),disabled:!c||i,children:`Save`})})]})]})}function ke({open:e,onClose:t,onAdd:n,loading:r}){let[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{e&&(a(``),s(``))},[e]);let c=i.trim().length>0&&o.trim().length>0;return(0,Q.jsxs)(w,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,children:[(0,Q.jsx)(j,{children:`Add Project`}),(0,Q.jsx)(x,{children:(0,Q.jsxs)(V,{spacing:2.5,sx:{mt:1},children:[(0,Q.jsx)(F,{label:`Project Name`,value:i,onChange:e=>a(e.target.value),fullWidth:!0,autoFocus:!0,placeholder:`my-project`,helperText:`Unique identifier for the project registry`}),(0,Q.jsx)(F,{label:`Project Path`,value:o,onChange:e=>s(e.target.value),fullWidth:!0,placeholder:`/absolute/path/to/project`,helperText:`Absolute path to the monorepo root containing omnitron.config.ts`,slotProps:{input:{sx:{fontFamily:`monospace`,fontSize:14}}}})]})}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(p,{onClick:t,color:`inherit`,children:`Cancel`}),(0,Q.jsx)(W,{permission:`OmnitronProject.addProject`,children:(0,Q.jsx)(p,{variant:`contained`,onClick:()=>n(i.trim(),o.trim()),disabled:!c||r,children:`Add Project`})})]})]})}function Ae(){let e=K(e=>e.projects),t=K(e=>e.loading),n=K(e=>e.error),o=K(e=>e.clearError),c=K(e=>e.fetchProjects),l=K(e=>e.addProject),u=K(e=>e.updateProject),d=K(e=>e.removeProject),f=K(e=>e.selectProject),m=a(),{pathname:h}=r(),g=ie(),{can:ee}=ae(),[_,y]=i(),[b,S]=(0,Z.useState)(null),[C,T]=(0,Z.useState)(null),E=_.get(`create`)===`1`&&ee(`OmnitronProject.addProject`),D=(0,Z.useCallback)(e=>{y(t=>{let n=new URLSearchParams(t);return e?n.set(`create`,`1`):n.delete(`create`),n},{replace:!0})},[y]),[O,A]=(0,Z.useState)(null),[M,N]=(0,Z.useState)(!1);G(()=>void c(),{intervalMs:15e3});let P=(0,Z.useCallback)(e=>{let t=f(e,h);m(t)},[f,m,h]),F=(0,Z.useCallback)(async(e,t)=>{N(!0);try{await l(e,t),D(!1),g.success(`Project "${e}" added`)}catch(e){g.error(e?.message??`Failed to add project`)}finally{N(!1)}},[l,g,D]),I=(0,Z.useCallback)(async(e,t)=>{N(!0);try{await u(e,t),S(null),g.success(`Project "${e}" updated`)}catch(e){g.error(e?.message??`Failed to update project`)}finally{N(!1)}},[u,g]),te=(0,Z.useCallback)(async()=>{if(O){N(!0);try{await d(O),g.success(`Project "${O}" removed`)}catch(e){g.error(e?.message??`Failed to remove project`)}finally{A(null),N(!1)}}},[O,d,g]),R=e.find(e=>e.name===O);return(0,Q.jsxs)(V,{spacing:3,children:[(0,Q.jsx)(be,{links:[{name:`Projects`}],action:(0,Q.jsxs)(V,{direction:`row`,spacing:1,children:[(0,Q.jsx)(p,{"data-console-command":`refresh`,variant:`outlined`,size:`small`,startIcon:(0,Q.jsx)(fe,{sx:{fontSize:18}}),onClick:()=>c(),children:`Refresh`}),(0,Q.jsx)(W,{permission:`OmnitronProject.addProject`,children:(0,Q.jsx)(p,{variant:`contained`,size:`small`,startIcon:(0,Q.jsx)(le,{sx:{fontSize:18}}),onClick:()=>D(!0),children:`Add Project`})})]})}),n&&(0,Q.jsx)(U,{closable:!0,severity:`error`,onClose:o,children:n}),t&&e.length===0?(0,Q.jsx)(B,{container:!0,spacing:3,children:[1,2,3].map(e=>(0,Q.jsx)(B,{size:{xs:12,sm:6,md:4},children:(0,Q.jsx)(Se,{variant:`rounded`,height:260})},e))}):e.length===0?(0,Q.jsx)(v,{sx:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:300},children:(0,Q.jsx)(Te,{title:`No projects`,description:`Register your first project to get started. A project is a monorepo with omnitron.config.ts at the root.`})}):(0,Q.jsx)(B,{container:!0,spacing:3,children:e.map(e=>(0,Q.jsx)(B,{size:{xs:12,sm:6,md:4},children:(0,Q.jsx)(De,{project:e,onEdit:S,onRemove:A,onOpen:P,onImport:T})},e.name))}),C&&(0,Q.jsx)(Ee,{project:C,onClose:()=>T(null),onImport:async e=>{await s.importConfiguration(e),await c()}}),(0,Q.jsx)(Oe,{open:!!b,onClose:()=>S(null),project:b,onSave:I,loading:M}),(0,Q.jsx)(ke,{open:E,onClose:()=>D(!1),onAdd:F,loading:M}),(0,Q.jsxs)(w,{open:!!O,onClose:()=>A(null),maxWidth:`xs`,fullWidth:!0,children:[(0,Q.jsx)(j,{children:`Remove Project`}),(0,Q.jsxs)(x,{children:[(0,Q.jsxs)(L,{variant:`body2`,children:[`Remove `,(0,Q.jsx)(`strong`,{children:R?.displayName??O}),` from the registry? This does not delete any files on disk.`]}),R&&R.runningStacks>0&&(0,Q.jsxs)(U,{severity:`warning`,sx:{mt:2},children:[`This project has `,R.runningStacks,` running stack(s). Stop them first.`]})]}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(p,{onClick:()=>A(null),color:`inherit`,children:`Cancel`}),(0,Q.jsx)(W,{permission:`OmnitronProject.removeProject`,children:(0,Q.jsx)(p,{onClick:te,color:`error`,variant:`contained`,disabled:M||(R?.runningStacks??0)>0,children:`Remove`})})]})]})]})}var Z,Q;function $(){return($=e((()=>{oe(),Z=t(),c(),m(),g(),ee(),d(),te(),M(),h(),R(),P(),_(),H(),C(),b(),S(),O(),I(),T(),u(),ne(),ye(),we(),he(),xe(),re(),o(),Y(),ce(),se(),ue(),Q=n()})))()}$();export{Ae as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{A as t,h as n,k as r,p as i}from"./client-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{A as t,h as n,k as r,p as i}from"./client-CgyTwq9g.js";import{n as a,t as o}from"./react-CEuifcaQ.js";import{d as s,m as c}from"./project.store-D5IR3fo9.js";var l,u,d,f,p,m,h,g;function _(){return(_=e((()=>{l={STARTED:`app.started`,STOPPED:`app.stopped`,CRASHED:`app.crashed`,RESTARTING:`app.restarting`,SCALED:`app.scaled`,HEALTH_CHANGED:`app.health_changed`},u={READY:`infra.ready`,DEGRADED:`infra.degraded`,FAILED:`infra.failed`,SERVICE_UP:`infra.service_up`,SERVICE_DOWN:`infra.service_down`,SERVICE_RESTARTED:`infra.service_restarted`},d={FIRED:`alert.fired`,RESOLVED:`alert.resolved`,ACKNOWLEDGED:`alert.acknowledged`},f={COLLECTED:`metrics.collected`},p={ADDED:`project.added`,REMOVED:`project.removed`,CONFIG_RELOADED:`project.config_reloaded`},m={STARTING:`stack.starting`,STARTED:`stack.started`,STOPPING:`stack.stopping`,STOPPED:`stack.stopped`,ERROR:`stack.error`,INFRA_READY:`stack.infra_ready`,SYNC_COMPLETED:`stack.sync_completed`,SYNC_FAILED:`stack.sync_failed`,DEPLOY_PROGRESS:`stack.deploy_progress`,NODE_CONNECTED:`stack.node_connected`,NODE_DISCONNECTED:`stack.node_disconnected`},h={STATUS_UPDATED:`node.status_updated`,WENT_ONLINE:`node.went_online`,WENT_OFFLINE:`node.went_offline`,WENT_DEGRADED:`node.went_degraded`,CHECK_COMPLETED:`node.check_completed`},g={STARTED:`daemon.started`,STOPPING:`daemon.stopping`,CONFIG_RELOADED:`daemon.config_reloaded`},[...Object.values(l),...Object.values(u),...Object.values(d),...Object.values(f),...Object.values(p),...Object.values(m),...Object.values(h),...Object.values(g)]})))()}function v(e){return`${e.protocol===`https:`?`wss:`:`ws:`}//${e.host}/ws`}function y(){return S||=new x,S}var b,x,S;function C(){return(C=e((()=>{t(),_(),n(),b=[`app.*`,`infra.*`,`alert.*`,`metrics.collected`,`project.*`,`stack.*`,`node.*`,`daemon.*`],x=class{options;socket=null;eventListeners=new Map;connectionListeners=new Set;_connected=!1;constructor(e={}){this.options=e}get connected(){return this._connected}connect(){if(this.socket)return;let e=this.options.url??v(window.location),t=this.options.socket?.(e)??new r({url:e,reconnect:!0,maxReconnectAttempts:1/0});this.socket=t,t.onTask(`emit`,(e,t)=>{e===`omnitron:event`&&this.dispatchEvent(t)}),t.on(`disconnect`,()=>this.setConnected(!1)),t.on(`reconnect`,()=>void this.handshake(t)),t.connect().then(()=>this.handshake(t)).catch(()=>this.setConnected(!1))}disconnect(){let e=this.socket;this.socket=null,this.setConnected(!1),e?.disconnect().catch(()=>void 0)}on(e,t){let n=this.eventListeners.get(e);return n||(n=new Set,this.eventListeners.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&this.eventListeners.delete(e)}}onConnection(e){return this.connectionListeners.add(e),()=>this.connectionListeners.delete(e)}async handshake(e){let t=(this.options.token??i)();if(!t||e!==this.socket)this.setConnected(!1);else try{if(!(await e.runTask(`authenticate`,{token:t}))?.success){this.setConnected(!1);return}await e.invoke(`OmnitronEvents`,`subscribe`,[{channels:this.options.channels??b}]),e===this.socket&&this.setConnected(!0)}catch{this.setConnected(!1)}}setConnected(e){if(this._connected!==e){this._connected=e;for(let t of this.connectionListeners)try{t(e)}catch{}}}dispatchEvent(e){let t=this.eventListeners.get(e.channel);if(t)for(let n of t)n(e);for(let[t,n]of this.eventListeners)if(t===`*`)for(let t of n)t(e);else if(t.endsWith(`.*`)){let r=t.slice(0,-2);if(e.channel.startsWith(r+`.`))for(let t of n)t(e)}}},S=null})))()}function w(e,t){return e.filter(e=>t-e.receivedAt<E||e.status!==`success`&&e.status!==`failed`)}function T(){let e=!1;return()=>{e||(e=!0,--D,D===0&&O&&(O(),O=null))}}var E,D,O,k;function A(){return(A=e((()=>{a(),c(),C(),E=3e4,D=0,O=null,k=o((e,t)=>({connected:!1,appEvents:[],infraEvents:[],alerts:[],lastMetricsUpdate:0,lastEvent:null,lastNodeEvent:null,deployProgress:[],activeDeployProgress:()=>w(t().deployProgress,Date.now()),initialize:()=>{if(D+=1,O)return T();let t=y(),n=[];return n.push(t.onConnection(t=>{e({connected:t})})),n.push(t.on(`app.*`,t=>{let n=t.data,r={name:n.name??`unknown`,pid:n.pid??null,status:t.channel.split(`.`)[1]??`unknown`,timestamp:t.timestamp};e(e=>({appEvents:[r,...e.appEvents].slice(0,50),lastEvent:t}))})),n.push(t.on(`infra.*`,t=>{let n=t.data,r={service:n.service??n.services?.join(`, `)??`unknown`,status:t.channel.split(`.`)[1]??`unknown`,timestamp:t.timestamp};e(e=>({infraEvents:[r,...e.infraEvents].slice(0,20),lastEvent:t}))})),n.push(t.on(`alert.*`,t=>{let n=t.data,r={ruleId:n.ruleId??``,ruleName:n.ruleName??``,severity:n.severity??`info`,message:n.message,timestamp:t.timestamp};e(e=>t.channel===`alert.resolved`?{alerts:e.alerts.filter(e=>e.ruleId!==r.ruleId),lastEvent:t}:{alerts:[r,...e.alerts.filter(e=>e.ruleId!==r.ruleId)],lastEvent:t})})),n.push(t.on(`metrics.collected`,t=>{e({lastMetricsUpdate:t.timestamp,lastEvent:t})})),n.push(t.on(`project.*`,t=>{e({lastEvent:t})})),n.push(t.on(`stack.*`,t=>{if(t.channel===`stack.deploy_progress`){let n=t.data;e(e=>{let r=Date.now();return{deployProgress:[...w(e.deployProgress.filter(e=>s(e)!==s(n)),r),{...n,timestamp:t.timestamp,receivedAt:r}],lastEvent:t}})}else e({lastEvent:t})})),n.push(t.on(`node.*`,t=>{e({lastNodeEvent:t,lastEvent:t})})),n.push(t.on(`daemon.*`,t=>{e({lastEvent:t})})),t.connect(),O=()=>{for(let e of n)e();t.disconnect(),e({connected:!1})},T()}}))})))()}export{k as n,A as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{t}from"./react-BN8qLIAi.js";import{Vt as n,Yt as r}from"./mui-BTN91yBK.js";import{H as i,Q as a,V as o,Z as s}from"./mui-SNRRJ_vi.js";import{B as c,F as l,I as u,z as d}from"./mui-B3fJdIMc.js";import{E as f,T as p}from"./mui-CMWGTMXv.js";import{_ as m,v as h}from"./mui-CPEkFAPo.js";import{_ as g,b as _,m as v}from"./project.store-D5IR3fo9.js";function y(e){return e==null?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(2)} GB`}function b(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t} s`;let n=Math.floor(t/60);return n<60?`${n} m ${String(t%60).padStart(2,`0`)} s`:`${Math.floor(n/60)} h ${String(n%60).padStart(2,`0`)} m`}function x(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function S(e){if(e.length===0)return`No gates recorded — a stack that requires any will refuse this release.`;let t=e.filter(e=>e.status!==`passed`);return t.length===0?`All ${e.length} gates passed.`:`${t.length} of ${e.length} gates did not pass: ${t.map(e=>`${e.name} ${A[e.status].label}`).join(`, `)}.`}function C(e){return e!=null&&e.loadAtGateEnd[1]>e.cpus}function w(e){let t=e=>e.map(e=>e.toFixed(1)).join(` / `);return`${t(e.loadAtGateStart)} → ${t(e.loadAtGateEnd)} on ${e.cpus} cores`}function T({gates:e,size:t=10,columns:n}){if(e.length===0)return(0,k.jsx)(d,{variant:`caption`,sx:{color:`text.disabled`},children:`no gates`});let r=Math.max(2,Math.round(t*.35));return(0,k.jsx)(o,{sx:n?{display:`grid`,gridTemplateColumns:`repeat(${n}, ${t}px)`,gap:`${r}px`}:{display:`flex`,flexWrap:`wrap`,gap:`${r}px`},children:e.map((e,n)=>(0,k.jsx)(l,{title:`${e.name} — ${A[e.status].label}${e.durationMs?` (${Math.round(e.durationMs/1e3)} s)`:``}${e.detail?` — ${e.detail}`:``}`,arrow:!0,children:(0,k.jsx)(o,{sx:{width:t,height:t,borderRadius:`2px`,bgcolor:A[e.status].color,...e.status===`not-run`&&{bgcolor:`transparent`,border:e=>`1px solid ${e.palette.text.disabled}`}}})},`${e.name}-${n}`))})}function E({release:e,variant:t=`body2`}){let n=g(e);return(0,k.jsx)(d,{variant:t,sx:{fontWeight:600,color:j[n.tone],fontFamily:`monospace`},children:n.text})}function D({projectCommit:e,omniCommit:t,onRemote:n,project:r}){let i=_(n,r);return(0,k.jsxs)(m,{direction:`row`,useFlexGap:!0,spacing:.75,sx:{alignItems:`center`,flexWrap:`wrap`,minWidth:0},children:[(0,k.jsx)(l,{title:`${r} ${e??`unknown`}`,arrow:!0,children:(0,k.jsx)(d,{variant:`caption`,sx:{fontFamily:`monospace`},children:e?.slice(0,8)??`—`})}),(0,k.jsx)(d,{variant:`caption`,sx:{color:`text.disabled`},children:`+`}),(0,k.jsx)(l,{title:`omni ${t??`unknown`}`,arrow:!0,children:(0,k.jsx)(d,{variant:`caption`,sx:{fontFamily:`monospace`},children:t?.slice(0,8)??`—`})}),i.state!==`recorded`&&(0,k.jsx)(l,{title:i.detail,arrow:!0,children:(0,k.jsx)(s,{label:i.label,size:`small`,color:i.state===`missing`?`warning`:`default`,variant:`outlined`})})]})}function O({percent:e,state:t}){return(0,k.jsx)(p,{variant:`determinate`,value:Math.min(100,Math.max(0,e)),color:t===`failed`?`error`:t===`stopped`?`warning`:t===`done`?`success`:`primary`,sx:{height:6,borderRadius:3,bgcolor:e=>n(e.palette.text.primary,.08)}})}var k,A,j,M;function N(){return(N=e((()=>{i(),a(),f(),h(),u(),c(),r(),v(),k=t(),A={passed:{color:`success.main`,label:`passed`},failed:{color:`error.main`,label:`failed`},"timed-out":{color:`warning.main`,label:`timed out`},killed:{color:`warning.dark`,label:`killed`},"not-run":{color:`text.disabled`,label:`did not run`}},j={passed:`success.main`,failed:`error.main`,unfinished:`warning.main`,none:`text.disabled`},M={interrupted:{label:`Interrupted`,color:`warning`},queued:{label:`Queued`,color:`info`},running:{label:`Building`,color:`info`},done:{label:`Built`,color:`success`},failed:{label:`Failed`,color:`error`},stopped:{label:`Stopped`,color:`warning`}}})))()}export{E as a,b as c,w as d,C as f,A as i,S as l,O as n,T as o,x as p,D as r,y as s,M as t,N as u};
|