home-hosted 0.13.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -322
- package/bin/home-hosted.mjs +41 -0
- package/dist/chunks/account-DiLrSyww.js +359 -0
- package/dist/chunks/account-DiLrSyww.js.map +1 -0
- package/dist/chunks/add-DEIYVkNK.js +183 -0
- package/dist/chunks/add-DEIYVkNK.js.map +1 -0
- package/dist/chunks/{archive-DP-XQR8X.js → archive-DFi3qK1c.js} +25 -73
- package/dist/chunks/archive-DFi3qK1c.js.map +1 -0
- package/dist/chunks/{atomic-C1PfJpE7.js → atomic-SZUwDtGD.js} +3 -6
- package/dist/chunks/atomic-SZUwDtGD.js.map +1 -0
- package/dist/chunks/{backup-DeAJ3pbO.js → backup-DnyxIzw0.js} +110 -190
- package/dist/chunks/backup-DnyxIzw0.js.map +1 -0
- package/dist/chunks/backups-BrrN6cwW.js +2203 -0
- package/dist/chunks/backups-BrrN6cwW.js.map +1 -0
- package/dist/chunks/bind-DIxrnUst.js +43 -0
- package/dist/chunks/bind-DIxrnUst.js.map +1 -0
- package/dist/chunks/config-text-DxMOQQnk.js +34 -0
- package/dist/chunks/config-text-DxMOQQnk.js.map +1 -0
- package/dist/chunks/{contracts-CMBD1TF9.js → contracts-CxZ7u1L3.js} +1239 -1454
- package/dist/chunks/contracts-CxZ7u1L3.js.map +1 -0
- package/dist/chunks/daemon-BAAYUYQC.js +211 -0
- package/dist/chunks/daemon-BAAYUYQC.js.map +1 -0
- package/dist/chunks/daemon-log-Ccu-69vB.js +179 -0
- package/dist/chunks/daemon-log-Ccu-69vB.js.map +1 -0
- package/dist/chunks/deploy-CggSOEkq.js +144 -0
- package/dist/chunks/deploy-CggSOEkq.js.map +1 -0
- package/dist/chunks/{docker-Cy9Lyvda.js → docker--Un0uLfF.js} +32 -68
- package/dist/chunks/docker--Un0uLfF.js.map +1 -0
- package/dist/chunks/{down-C59ne5aM.js → down-CpIN7LEQ.js} +34 -94
- package/dist/chunks/down-CpIN7LEQ.js.map +1 -0
- package/dist/chunks/exposure-CDJNvOCK.js +229 -0
- package/dist/chunks/exposure-CDJNvOCK.js.map +1 -0
- package/dist/chunks/import-Bd4VZH0f.js +205 -0
- package/dist/chunks/import-Bd4VZH0f.js.map +1 -0
- package/dist/chunks/import-plan--fDS_l5r.js +147 -0
- package/dist/chunks/import-plan--fDS_l5r.js.map +1 -0
- package/dist/chunks/import-write-BTfbeV26.js +42 -0
- package/dist/chunks/import-write-BTfbeV26.js.map +1 -0
- package/dist/chunks/{init-BZ7hK9Vf.js → init-Bv3oH65x.js} +14 -50
- package/dist/chunks/init-Bv3oH65x.js.map +1 -0
- package/dist/chunks/job-CYOdN6Ub.js +341 -0
- package/dist/chunks/job-CYOdN6Ub.js.map +1 -0
- package/dist/chunks/jobs-BX4ahcfh.js +489 -0
- package/dist/chunks/jobs-BX4ahcfh.js.map +1 -0
- package/dist/chunks/last-stop-DD3lHwo_.js +42 -0
- package/dist/chunks/last-stop-DD3lHwo_.js.map +1 -0
- package/dist/chunks/layout-D0ysDNav.js +18 -0
- package/dist/chunks/layout-D0ysDNav.js.map +1 -0
- package/dist/chunks/lazy-kfcBNeqj.js +48 -0
- package/dist/chunks/lazy-kfcBNeqj.js.map +1 -0
- package/dist/chunks/log-buffer-B7jmn7ts.js +110 -0
- package/dist/chunks/log-buffer-B7jmn7ts.js.map +1 -0
- package/dist/chunks/log-files-CZL2UhuE.js +488 -0
- package/dist/chunks/log-files-CZL2UhuE.js.map +1 -0
- package/dist/chunks/{logger-B5U4GD3j.js → logger-BnrKTBHQ.js} +2 -6
- package/dist/chunks/logger-BnrKTBHQ.js.map +1 -0
- package/dist/chunks/{logs---TI_bxM.js → logs-DxKI6OW2.js} +23 -73
- package/dist/chunks/logs-DxKI6OW2.js.map +1 -0
- package/dist/chunks/ls-BseUHy_m.js +128 -0
- package/dist/chunks/ls-BseUHy_m.js.map +1 -0
- package/dist/chunks/migrate-D4w_dXDm.js +268 -0
- package/dist/chunks/migrate-D4w_dXDm.js.map +1 -0
- package/dist/chunks/{nanny-rewguyXg.js → nanny-BWh7nuvv.js} +21 -14
- package/dist/chunks/nanny-BWh7nuvv.js.map +1 -0
- package/dist/chunks/{nanny-Dnun3hVB.js → nanny-BjF2-1pv.js} +3 -3
- package/dist/chunks/{nanny-Dnun3hVB.js.map → nanny-BjF2-1pv.js.map} +1 -1
- package/dist/chunks/nanny-DGTXVq5d.js +806 -0
- package/dist/chunks/nanny-DGTXVq5d.js.map +1 -0
- package/dist/chunks/{nanny-sweep-ClVuNJRo.js → nanny-sweep-hjmZ_p7S.js} +14 -24
- package/dist/chunks/nanny-sweep-hjmZ_p7S.js.map +1 -0
- package/dist/chunks/{nearest-6KgQEDUe.js → nearest-DOx4jySJ.js} +2 -10
- package/dist/chunks/nearest-DOx4jySJ.js.map +1 -0
- package/dist/chunks/{parse-DhmG26fI.js → parse-DVMPLUDe.js} +47 -72
- package/dist/chunks/parse-DVMPLUDe.js.map +1 -0
- package/dist/chunks/password-policy-Clq6PGE-.js +9 -0
- package/dist/chunks/password-policy-Clq6PGE-.js.map +1 -0
- package/dist/chunks/{paths-CGlGDrOU.js → paths-C34-TJLh.js} +32 -56
- package/dist/chunks/paths-C34-TJLh.js.map +1 -0
- package/dist/chunks/{port-k5VBw8t9.js → port-CnsrxKNR.js} +23 -70
- package/dist/chunks/port-CnsrxKNR.js.map +1 -0
- package/dist/chunks/process-CboOFPU_.js +192 -0
- package/dist/chunks/process-CboOFPU_.js.map +1 -0
- package/dist/chunks/{restart-BYu_E7x5.js → restart-C0J8dZ2L.js} +11 -29
- package/dist/chunks/restart-C0J8dZ2L.js.map +1 -0
- package/dist/chunks/run-deploy-DoNDvwT4.js +91 -0
- package/dist/chunks/run-deploy-DoNDvwT4.js.map +1 -0
- package/dist/chunks/{schema-B240VXcV.js → schema-CZ6f-PHD.js} +7 -20
- package/dist/chunks/schema-CZ6f-PHD.js.map +1 -0
- package/dist/chunks/secret-MY397r90.js +219 -0
- package/dist/chunks/secret-MY397r90.js.map +1 -0
- package/dist/chunks/secrets-CG5N4lwY.js +1061 -0
- package/dist/chunks/secrets-CG5N4lwY.js.map +1 -0
- package/dist/chunks/server-Dm_dXfTW.js +255 -0
- package/dist/chunks/server-Dm_dXfTW.js.map +1 -0
- package/dist/chunks/server-attention-UQwYXqKe.js +10 -0
- package/dist/chunks/server-attention-UQwYXqKe.js.map +1 -0
- package/dist/chunks/server-create-D7nvhgBd.js +96 -0
- package/dist/chunks/server-create-D7nvhgBd.js.map +1 -0
- package/dist/chunks/server-ids-BEQD2rFz.js +23 -0
- package/dist/chunks/server-ids-BEQD2rFz.js.map +1 -0
- package/dist/chunks/server-vars-DMYmHutL.js +27 -0
- package/dist/chunks/server-vars-DMYmHutL.js.map +1 -0
- package/dist/chunks/service-C8l-ewNA.js +585 -0
- package/dist/chunks/service-C8l-ewNA.js.map +1 -0
- package/dist/chunks/{settings-xu-XTfWg.js → settings-CtYDs5PX.js} +62 -78
- package/dist/chunks/settings-CtYDs5PX.js.map +1 -0
- package/dist/chunks/{setup-temp-CAN4_bA-.js → setup-temp-TAtDmMMU.js} +43 -37
- package/dist/chunks/setup-temp-TAtDmMMU.js.map +1 -0
- package/dist/chunks/shape-CDGeYl_J.js +9 -0
- package/dist/chunks/shape-CDGeYl_J.js.map +1 -0
- package/dist/chunks/{src-BOBh9MBf.js → src-BnzkVy_M.js} +12547 -10578
- package/dist/chunks/src-BnzkVy_M.js.map +1 -0
- package/dist/chunks/{status-B6f2-qhs.js → status-efbbfYZQ.js} +53 -26
- package/dist/chunks/status-efbbfYZQ.js.map +1 -0
- package/dist/chunks/store-Bs_Lljjm.js +2082 -0
- package/dist/chunks/store-Bs_Lljjm.js.map +1 -0
- package/dist/chunks/template-xan58bJh.js +28 -0
- package/dist/chunks/template-xan58bJh.js.map +1 -0
- package/dist/chunks/token-DDeWfZA4.js +142 -0
- package/dist/chunks/token-DDeWfZA4.js.map +1 -0
- package/dist/chunks/{ui-D562aqw5.js → ui-BcIAtyxE.js} +68 -79
- package/dist/chunks/ui-BcIAtyxE.js.map +1 -0
- package/dist/chunks/{ui-dir-CsU3uLNV.js → ui-dir-ClCzVRc3.js} +3 -7
- package/dist/chunks/ui-dir-ClCzVRc3.js.map +1 -0
- package/dist/chunks/ui-format-CDvvqOoi.js +53 -0
- package/dist/chunks/ui-format-CDvvqOoi.js.map +1 -0
- package/dist/chunks/{ui-release-DKzVvlLd.js → ui-release-XbJ85pYI.js} +36 -38
- package/dist/chunks/ui-release-XbJ85pYI.js.map +1 -0
- package/dist/chunks/{ui-revert-EkBBwRTt.js → ui-revert-Dgawq7ze.js} +4 -4
- package/dist/chunks/ui-revert-Dgawq7ze.js.map +1 -0
- package/dist/chunks/{ui-switch-BnZTdMDd.js → ui-switch-CfQMbZ0g.js} +31 -38
- package/dist/chunks/ui-switch-CfQMbZ0g.js.map +1 -0
- package/dist/chunks/{ui-update-_xryLYxw.js → ui-update-B3PPivUm.js} +30 -48
- package/dist/chunks/ui-update-B3PPivUm.js.map +1 -0
- package/dist/chunks/ui-update-CAiH2tFb.js +109 -0
- package/dist/chunks/ui-update-CAiH2tFb.js.map +1 -0
- package/dist/chunks/{up-DNZuTi2q.js → up-BQSnYxYd.js} +47 -53
- package/dist/chunks/up-BQSnYxYd.js.map +1 -0
- package/dist/chunks/{usage-BrnDARNM.js → usage-KG8TeOio.js} +7 -20
- package/dist/chunks/usage-KG8TeOio.js.map +1 -0
- package/dist/chunks/{workspaces-DYcfvKV_.js → workspaces-D9akpzU8.js} +80 -68
- package/dist/chunks/workspaces-D9akpzU8.js.map +1 -0
- package/dist/chunks/{wsl-temperature-BiCI4iK6.js → wsl-temperature-D-_d4Yk1.js} +47 -42
- package/dist/chunks/wsl-temperature-D-_d4Yk1.js.map +1 -0
- package/dist/cli.js +306 -238
- package/dist/cli.js.map +1 -1
- package/dist/client.js +76 -29
- package/dist/client.js.map +1 -1
- package/dist/types/api/acme.d.ts +3 -7
- package/dist/types/api/auth/$.routes.d.ts +107 -16
- package/dist/types/api/backups.d.ts +5 -5
- package/dist/types/api/control.d.ts +747 -38
- package/dist/types/api/ddns.d.ts +13 -18
- package/dist/types/api/events.d.ts +9 -3
- package/dist/types/api/health.d.ts +2 -4
- package/dist/types/api/jobs.d.ts +438 -0
- package/dist/types/api/logs.d.ts +20 -0
- package/dist/types/api/metrics.d.ts +2 -5
- package/dist/types/api/notifications.d.ts +3 -6
- package/dist/types/api/proxy.d.ts +63 -23
- package/dist/types/api/server-ops.d.ts +17 -0
- package/dist/types/api/servers/$.routes.d.ts +418 -186
- package/dist/types/api/session-required.d.ts +16 -0
- package/dist/types/api/settings.d.ts +7 -7
- package/dist/types/api/state.d.ts +100 -10
- package/dist/types/api/static.d.ts +2 -2
- package/dist/types/api/tls.d.ts +2 -5
- package/dist/types/api/workspaces/$.routes.d.ts +186 -12
- package/dist/types/api/wsl-temperature.d.ts +4 -10
- package/dist/types/app.d.ts +4511 -2778
- package/dist/types/cli/account.d.ts +23 -0
- package/dist/types/cli/add.d.ts +96 -0
- package/dist/types/cli/args.d.ts +24 -35
- package/dist/types/cli/backup-offline.d.ts +2 -8
- package/dist/types/cli/backup.d.ts +12 -21
- package/dist/types/cli/down.d.ts +15 -41
- package/dist/types/cli/import-plan.d.ts +55 -0
- package/dist/types/cli/import-write.d.ts +5 -0
- package/dist/types/cli/import.d.ts +86 -0
- package/dist/types/cli/io.d.ts +26 -35
- package/dist/types/cli/job.d.ts +99 -0
- package/dist/types/cli/logs.d.ts +1 -10
- package/dist/types/cli/ls.d.ts +57 -0
- package/dist/types/cli/migrate.d.ts +31 -8
- package/dist/types/cli/nearest.d.ts +1 -9
- package/dist/types/cli/run-deploy.d.ts +36 -0
- package/dist/types/cli/secret.d.ts +90 -0
- package/dist/types/cli/server.d.ts +6 -15
- package/dist/types/cli/service.d.ts +135 -0
- package/dist/types/cli/setup-temp.d.ts +17 -13
- package/dist/types/cli/status.d.ts +7 -1
- package/dist/types/cli/token.d.ts +6 -0
- package/dist/types/cli/ui-switch.d.ts +3 -14
- package/dist/types/cli/ui-update.d.ts +3 -16
- package/dist/types/cli/up.d.ts +9 -22
- package/dist/types/cli/usage.d.ts +2 -6
- package/dist/types/cli.d.ts +1 -10
- package/dist/types/client.d.ts +4099 -1142
- package/dist/types/config/accounts.d.ts +16 -0
- package/dist/types/config/jobs.d.ts +68 -0
- package/dist/types/config/layout.d.ts +2 -8
- package/dist/types/config/migrations.d.ts +9 -41
- package/dist/types/config/parse.d.ts +8 -13
- package/dist/types/config/patch.d.ts +1 -6
- package/dist/types/config/schema.d.ts +16 -18
- package/dist/types/config/secret-parts.d.ts +6 -27
- package/dist/types/config/secrets.d.ts +167 -88
- package/dist/types/config/seed.d.ts +1 -6
- package/dist/types/config/server-ids.d.ts +2 -11
- package/dist/types/config/settings.d.ts +13 -49
- package/dist/types/config/store.d.ts +17 -54
- package/dist/types/config/workspaces.d.ts +24 -56
- package/dist/types/helpers/action-result.d.ts +18 -32
- package/dist/types/helpers/atomic.d.ts +1 -4
- package/dist/types/helpers/backoff.d.ts +0 -1
- package/dist/types/helpers/bind.d.ts +3 -11
- package/dist/types/helpers/config-text.d.ts +4 -19
- package/dist/types/helpers/cookies.d.ts +2 -7
- package/dist/types/helpers/copy-tree.d.ts +4 -12
- package/dist/types/helpers/daemon-log.d.ts +8 -33
- package/dist/types/helpers/daemon.d.ts +20 -70
- package/dist/types/helpers/deferred.d.ts +2 -4
- package/dist/types/helpers/env-file.d.ts +2 -7
- package/dist/types/helpers/error.d.ts +3 -14
- package/dist/types/helpers/event-stream.d.ts +18 -10
- package/dist/types/helpers/factory.d.ts +2 -3
- package/dist/types/helpers/last-stop.d.ts +5 -12
- package/dist/types/helpers/logger.d.ts +1 -5
- package/dist/types/helpers/open.d.ts +0 -1
- package/dist/types/helpers/openapi.d.ts +19 -5
- package/dist/types/helpers/paths.d.ts +18 -53
- package/dist/types/helpers/restore-lock.d.ts +2 -17
- package/dist/types/helpers/runtime.d.ts +3 -13
- package/dist/types/helpers/secret-compare.d.ts +2 -10
- package/dist/types/helpers/server-create.d.ts +15 -0
- package/dist/types/helpers/shell.d.ts +2 -16
- package/dist/types/helpers/sse.d.ts +8 -6
- package/dist/types/helpers/ui-dir.d.ts +1 -5
- package/dist/types/helpers/utf8-chunks.d.ts +2 -8
- package/dist/types/helpers/validate.d.ts +2 -4
- package/dist/types/helpers/validator.d.ts +8 -4
- package/dist/types/helpers/version.d.ts +1 -6
- package/dist/types/helpers/workspace.d.ts +24 -16
- package/dist/types/index.d.ts +2 -3
- package/dist/types/middleware/auth.d.ts +8 -27
- package/dist/types/middleware/body-limit.d.ts +10 -0
- package/dist/types/middleware/host.d.ts +4 -23
- package/dist/types/middleware/loopback.d.ts +1 -8
- package/dist/types/middleware/token-scope.d.ts +34 -0
- package/dist/types/node-compat.d.ts +43 -0
- package/dist/types/openapi-reference.d.ts +4 -19
- package/dist/types/openapi.d.ts +5 -8
- package/dist/types/providers/archive.d.ts +8 -25
- package/dist/types/providers/backup-hook.d.ts +4 -19
- package/dist/types/providers/ddns/dyndns2.d.ts +0 -3
- package/dist/types/providers/ddns/index.d.ts +2 -3
- package/dist/types/providers/ddns/ip.d.ts +2 -12
- package/dist/types/providers/ddns/namecheap-api.d.ts +3 -2
- package/dist/types/providers/ddns/types.d.ts +6 -32
- package/dist/types/providers/ddns/zone.d.ts +1 -4
- package/dist/types/providers/docker.d.ts +18 -45
- package/dist/types/providers/entry-state.d.ts +4 -9
- package/dist/types/providers/health-check.d.ts +1 -5
- package/dist/types/providers/host.d.ts +33 -108
- package/dist/types/providers/identity.d.ts +9 -34
- package/dist/types/providers/log-tail.d.ts +14 -24
- package/dist/types/providers/nanny-sweep.d.ts +8 -25
- package/dist/types/providers/nanny.d.ts +16 -58
- package/dist/types/providers/port.d.ts +28 -83
- package/dist/types/providers/proc.d.ts +22 -80
- package/dist/types/providers/process.d.ts +12 -36
- package/dist/types/providers/proxy/admin.d.ts +11 -0
- package/dist/types/providers/proxy/types.d.ts +4 -16
- package/dist/types/providers/telegram.d.ts +1 -17
- package/dist/types/providers/ui-release.d.ts +15 -25
- package/dist/types/providers/webhook.d.ts +8 -29
- package/dist/types/providers/wsl-temperature.d.ts +13 -22
- package/dist/types/services/acme-challenge.d.ts +2 -16
- package/dist/types/services/auth.d.ts +65 -80
- package/dist/types/services/backups/archive-safety.d.ts +30 -0
- package/dist/types/services/backups/paths.d.ts +31 -0
- package/dist/types/services/backups.d.ts +61 -271
- package/dist/types/services/config-watch.d.ts +3 -15
- package/dist/types/services/control-server.d.ts +6 -10
- package/dist/types/services/ddns.d.ts +12 -13
- package/dist/types/services/dependencies.d.ts +3 -14
- package/dist/types/services/deploy.d.ts +34 -0
- package/dist/types/services/events.d.ts +15 -9
- package/dist/types/services/exposure.d.ts +13 -63
- package/dist/types/services/history.d.ts +5 -14
- package/dist/types/services/host-monitor.d.ts +6 -11
- package/dist/types/services/init.d.ts +5 -35
- package/dist/types/services/job-ledger.d.ts +27 -0
- package/dist/types/services/jobs.d.ts +113 -0
- package/dist/types/services/log-buffer.d.ts +7 -8
- package/dist/types/services/log-files.d.ts +12 -42
- package/dist/types/services/log-relay.d.ts +3 -13
- package/dist/types/services/nanny.d.ts +3 -10
- package/dist/types/services/notifications.d.ts +31 -61
- package/dist/types/services/panel.d.ts +32 -78
- package/dist/types/services/proxy-certificates/certificates.d.ts +31 -69
- package/dist/types/services/proxy-config.d.ts +15 -36
- package/dist/types/services/proxy-dns01.d.ts +14 -0
- package/dist/types/services/proxy.d.ts +73 -254
- package/dist/types/services/scheduler.d.ts +46 -0
- package/dist/types/services/state.d.ts +17 -8
- package/dist/types/services/supervisor/compose.d.ts +2 -6
- package/dist/types/services/supervisor/entry.d.ts +29 -32
- package/dist/types/services/supervisor/health.d.ts +8 -31
- package/dist/types/services/supervisor/job-run.d.ts +36 -0
- package/dist/types/services/supervisor/output.d.ts +13 -77
- package/dist/types/services/supervisor/persistent.d.ts +5 -11
- package/dist/types/services/supervisor/port-preflight.d.ts +4 -10
- package/dist/types/services/supervisor/records.d.ts +27 -60
- package/dist/types/services/supervisor/restart-required.d.ts +13 -0
- package/dist/types/services/supervisor/spawn.d.ts +3 -5
- package/dist/types/services/supervisor/view.d.ts +3 -1
- package/dist/types/services/supervisor.d.ts +31 -43
- package/dist/types/services/tls.d.ts +6 -17
- package/dist/types/services/ui-update.d.ts +19 -17
- package/dist/types/services/ui.d.ts +10 -19
- package/dist/types/shared/action-outcome.d.ts +2 -7
- package/dist/types/shared/api-client.d.ts +133 -177
- package/dist/types/shared/api-scopes.d.ts +17 -0
- package/dist/types/shared/backup-scope.d.ts +16 -90
- package/dist/types/shared/clone.d.ts +2 -11
- package/dist/types/shared/contracts/accounts.d.ts +99 -0
- package/dist/types/shared/contracts/backups.d.ts +219 -0
- package/dist/types/shared/contracts/ddns.d.ts +208 -0
- package/dist/types/shared/contracts/frames.d.ts +1395 -0
- package/dist/types/shared/contracts/index.d.ts +3 -0
- package/dist/types/shared/contracts/logs.d.ts +107 -0
- package/dist/types/shared/contracts/proxy.d.ts +303 -0
- package/dist/types/shared/contracts.d.ts +852 -1982
- package/dist/types/shared/cpu-scale.d.ts +3 -19
- package/dist/types/shared/crash-cause.d.ts +8 -0
- package/dist/types/shared/cron.d.ts +70 -0
- package/dist/types/shared/ddns-form.d.ts +9 -43
- package/dist/types/shared/endpoint.d.ts +1 -7
- package/dist/types/shared/error-codes.d.ts +438 -0
- package/dist/types/shared/error-message.d.ts +1 -7
- package/dist/types/shared/fields.d.ts +7 -17
- package/dist/types/shared/form-repair.d.ts +1 -5
- package/dist/types/shared/generated.d.ts +3 -19
- package/dist/types/shared/host-readings.d.ts +25 -128
- package/dist/types/shared/lazy.d.ts +1 -1
- package/dist/types/shared/live-frames.d.ts +2 -8
- package/dist/types/shared/live-series.d.ts +2 -8
- package/dist/types/shared/live-store.d.ts +4 -8
- package/dist/types/shared/log-download.d.ts +6 -0
- package/dist/types/shared/meta.d.ts +6 -0
- package/dist/types/shared/password-policy.d.ts +10 -0
- package/dist/types/shared/patch-diff.d.ts +13 -72
- package/dist/types/shared/port-reading.d.ts +18 -0
- package/dist/types/shared/probe-latency.d.ts +3 -21
- package/dist/types/shared/proxy-form.d.ts +33 -74
- package/dist/types/shared/proxy-validate.d.ts +11 -0
- package/dist/types/shared/query-params.d.ts +8 -0
- package/dist/types/shared/server-attention.d.ts +2 -27
- package/dist/types/shared/server-form.d.ts +15 -54
- package/dist/types/shared/server-key.d.ts +1 -12
- package/dist/types/shared/server-readings.d.ts +7 -32
- package/dist/types/shared/server-url.d.ts +9 -31
- package/dist/types/shared/shape.d.ts +1 -16
- package/dist/types/shared/stream-access.d.ts +2 -8
- package/dist/types/shared/ui-format.d.ts +25 -65
- package/docs/API.md +315 -107
- package/docs/BACKUPS.md +61 -56
- package/docs/CLI.md +255 -49
- package/docs/DDNS.md +35 -49
- package/docs/JOBS.md +129 -0
- package/docs/NOTIFICATIONS.md +58 -90
- package/docs/REVERSE_PROXY.md +116 -188
- package/docs/SECURITY.md +126 -44
- package/docs/SERVERS.md +282 -409
- package/docs/UI_CREATION.md +90 -47
- package/docs/demo/blank-host-restore.sh +31 -7
- package/package.json +15 -6
- package/scripts/prepare.mjs +47 -0
- package/uis/stock/dist/assets/CopyButton-8mliL0xi.js +1 -0
- package/uis/stock/dist/assets/GlobalSettingsView-BINXY77E.js +1 -0
- package/uis/stock/dist/assets/LogViewer-kiSnTwdY.js +1 -0
- package/uis/stock/dist/assets/LogsView-DDXf_ONs.js +1 -0
- package/uis/stock/dist/assets/Modal-lrUuViF2.js +39 -0
- package/uis/stock/dist/assets/ProxyView-uXMaJdSQ.js +1 -0
- package/uis/stock/dist/assets/ServerDetailView-CW0Vb_c0.js +4 -0
- package/uis/stock/dist/assets/SettingsShell-B135xWjJ.js +1 -0
- package/uis/stock/dist/assets/SettingsView-BLtWxVkl.js +2 -0
- package/uis/stock/dist/assets/de-BIoTrHBQ.js +1 -0
- package/uis/stock/dist/assets/es-x4-ih8lH.js +1 -0
- package/uis/stock/dist/assets/fr-DatqBBkO.js +1 -0
- package/uis/stock/dist/assets/index-CnojaKcA.css +2 -0
- package/uis/stock/dist/assets/index-D-CiZReu.js +16 -0
- package/uis/stock/dist/assets/ja-CW1703Gw.js +1 -0
- package/uis/stock/dist/assets/ko-wFbT4XtK.js +1 -0
- package/uis/stock/dist/assets/ru-C1p5C4VN.js +1 -0
- package/uis/stock/dist/assets/useUnsavedGuard-BcsXsfCC.js +9 -0
- package/uis/stock/dist/assets/vi-CDqr0uie.js +1 -0
- package/uis/stock/dist/assets/zh-CN-BJ7iit-X.js +1 -0
- package/uis/stock/dist/index.html +4 -3
- package/uis/stock/dist/ui.json +3 -3
- package/dist/chunks/archive-DP-XQR8X.js.map +0 -1
- package/dist/chunks/atomic-C1PfJpE7.js.map +0 -1
- package/dist/chunks/backup-DeAJ3pbO.js.map +0 -1
- package/dist/chunks/backups-twva7x2n.js +0 -4691
- package/dist/chunks/backups-twva7x2n.js.map +0 -1
- package/dist/chunks/config-text-DifCHhnz.js +0 -50
- package/dist/chunks/config-text-DifCHhnz.js.map +0 -1
- package/dist/chunks/contracts-CMBD1TF9.js.map +0 -1
- package/dist/chunks/daemon-CofN9k6Q.js +0 -247
- package/dist/chunks/daemon-CofN9k6Q.js.map +0 -1
- package/dist/chunks/daemon-log-BVj8cDEo.js +0 -241
- package/dist/chunks/daemon-log-BVj8cDEo.js.map +0 -1
- package/dist/chunks/docker-Cy9Lyvda.js.map +0 -1
- package/dist/chunks/down-C59ne5aM.js.map +0 -1
- package/dist/chunks/init-BZ7hK9Vf.js.map +0 -1
- package/dist/chunks/last-stop-C-BXz_XI.js +0 -53
- package/dist/chunks/last-stop-C-BXz_XI.js.map +0 -1
- package/dist/chunks/layout-DwTtmund.js +0 -24
- package/dist/chunks/layout-DwTtmund.js.map +0 -1
- package/dist/chunks/lazy-Ce5zEAq1.js +0 -66
- package/dist/chunks/lazy-Ce5zEAq1.js.map +0 -1
- package/dist/chunks/log-buffer-Dy9HHDMD.js +0 -414
- package/dist/chunks/log-buffer-Dy9HHDMD.js.map +0 -1
- package/dist/chunks/logger-B5U4GD3j.js.map +0 -1
- package/dist/chunks/logs---TI_bxM.js.map +0 -1
- package/dist/chunks/migrate-Cfoq-Vgh.js +0 -155
- package/dist/chunks/migrate-Cfoq-Vgh.js.map +0 -1
- package/dist/chunks/nanny-COyCJXj9.js +0 -1172
- package/dist/chunks/nanny-COyCJXj9.js.map +0 -1
- package/dist/chunks/nanny-rewguyXg.js.map +0 -1
- package/dist/chunks/nanny-sweep-ClVuNJRo.js.map +0 -1
- package/dist/chunks/nearest-6KgQEDUe.js.map +0 -1
- package/dist/chunks/parse-DhmG26fI.js.map +0 -1
- package/dist/chunks/paths-CGlGDrOU.js.map +0 -1
- package/dist/chunks/port-k5VBw8t9.js.map +0 -1
- package/dist/chunks/restart-BYu_E7x5.js.map +0 -1
- package/dist/chunks/schema-B240VXcV.js.map +0 -1
- package/dist/chunks/secrets-BieELnZh.js +0 -562
- package/dist/chunks/secrets-BieELnZh.js.map +0 -1
- package/dist/chunks/server-By-zktjx.js +0 -169
- package/dist/chunks/server-By-zktjx.js.map +0 -1
- package/dist/chunks/server-ids-DRuNLVCV.js +0 -32
- package/dist/chunks/server-ids-DRuNLVCV.js.map +0 -1
- package/dist/chunks/set-password-D5vZqqSX.js +0 -43
- package/dist/chunks/set-password-D5vZqqSX.js.map +0 -1
- package/dist/chunks/set-token-xJkA1IZp.js +0 -78
- package/dist/chunks/set-token-xJkA1IZp.js.map +0 -1
- package/dist/chunks/settings-xu-XTfWg.js.map +0 -1
- package/dist/chunks/setup-temp-CAN4_bA-.js.map +0 -1
- package/dist/chunks/shape-DnTKzjQ2.js +0 -24
- package/dist/chunks/shape-DnTKzjQ2.js.map +0 -1
- package/dist/chunks/src-BOBh9MBf.js.map +0 -1
- package/dist/chunks/status-B6f2-qhs.js.map +0 -1
- package/dist/chunks/ui-D562aqw5.js.map +0 -1
- package/dist/chunks/ui-dir-CsU3uLNV.js.map +0 -1
- package/dist/chunks/ui-release-DKzVvlLd.js.map +0 -1
- package/dist/chunks/ui-revert-EkBBwRTt.js.map +0 -1
- package/dist/chunks/ui-switch-BnZTdMDd.js.map +0 -1
- package/dist/chunks/ui-update-_xryLYxw.js.map +0 -1
- package/dist/chunks/up-DNZuTi2q.js.map +0 -1
- package/dist/chunks/usage-BrnDARNM.js.map +0 -1
- package/dist/chunks/workspaces-DYcfvKV_.js.map +0 -1
- package/dist/chunks/wsl-temperature-BiCI4iK6.js.map +0 -1
- package/dist/types/cli/set-password.d.ts +0 -14
- package/dist/types/cli/set-token.d.ts +0 -21
- package/uis/stock/dist/assets/CopyButton-BUBKRJyY.js +0 -1
- package/uis/stock/dist/assets/GlobalSettingsView-yYMcRWvt.js +0 -1
- package/uis/stock/dist/assets/LogViewer-DIliXy62.js +0 -1
- package/uis/stock/dist/assets/LogsView-B7Z-7RNg.js +0 -1
- package/uis/stock/dist/assets/Modal-DmKa5Qpp.js +0 -39
- package/uis/stock/dist/assets/ProxyView-DvZiNkwb.js +0 -1
- package/uis/stock/dist/assets/ServerDetailView-6idGT_EX.js +0 -2
- package/uis/stock/dist/assets/SettingsShell-CeGtleYI.js +0 -1
- package/uis/stock/dist/assets/SettingsView-BrhJIrmk.js +0 -2
- package/uis/stock/dist/assets/de-BRITeb0H.js +0 -1
- package/uis/stock/dist/assets/es-B2zIEssV.js +0 -1
- package/uis/stock/dist/assets/fr-s0ZOBEqh.js +0 -1
- package/uis/stock/dist/assets/index-C1MehbKy.css +0 -2
- package/uis/stock/dist/assets/index-CnBN54wF.js +0 -15
- package/uis/stock/dist/assets/ja-CU7MR85V.js +0 -1
- package/uis/stock/dist/assets/ko-tL5Me6d-.js +0 -1
- package/uis/stock/dist/assets/ru-92yrvkNJ.js +0 -1
- package/uis/stock/dist/assets/vi-CzvY16k2.js +0 -1
- package/uis/stock/dist/assets/zh-CN-DDwFW_uW.js +0 -1
|
@@ -1,13 +1,499 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { t as lazy } from "./lazy-
|
|
2
|
+
import { t as lazy } from "./lazy-kfcBNeqj.js";
|
|
3
3
|
import { type } from "arktype";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
//#region src/shared/contracts/accounts.ts
|
|
5
|
+
/** Accounts: one credential that signs in to the panel and authenticates the API. */
|
|
6
|
+
/** Must match `API_TOKEN_SCOPES` (`#src/config/secrets`), which the guard reads; `test/shared/contracts.test.ts` pins the two. */
|
|
7
|
+
var apiTokenScopeSchema = lazy(() => type.enumerated("read", "lifecycle", "config", "proxy", "admin"));
|
|
8
|
+
/** Signing in takes an id and a secret; the lengths are sanity caps, not policy. */
|
|
9
|
+
var loginSchema = lazy(() => type({
|
|
10
|
+
id: "1 <= string <= 64",
|
|
11
|
+
secret: "1 <= string <= 512"
|
|
12
|
+
}).onUndeclaredKey("reject"));
|
|
13
|
+
/** Any non-empty secret is allowed; only a sanity cap on the length. */
|
|
14
|
+
var passwordValueSchema = lazy(() => type("1 <= string <= 512"));
|
|
15
|
+
/** Changing your own secret, proving the current one. */
|
|
16
|
+
var accountSecretSchema = lazy(() => type({
|
|
17
|
+
currentSecret: passwordValueSchema,
|
|
18
|
+
newSecret: passwordValueSchema
|
|
19
|
+
}).onUndeclaredKey("reject"));
|
|
20
|
+
var accountViewSchema = lazy(() => type({
|
|
21
|
+
"id": "string",
|
|
22
|
+
"label": "string",
|
|
23
|
+
"scopes": apiTokenScopeSchema.array(),
|
|
24
|
+
"workspaces?": "string[]",
|
|
25
|
+
"enabled": "boolean",
|
|
26
|
+
"isDefault": "boolean",
|
|
27
|
+
/** Its secret is shorter than the exposure bar, so a non-loopback bind stays refused. */
|
|
28
|
+
"short": "boolean",
|
|
29
|
+
"createdAt": "number",
|
|
30
|
+
"updatedAt": "number",
|
|
31
|
+
"lastUsedAt?": "number"
|
|
32
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
33
|
+
/** One scope; `workspaceLimited` is `false` for a scope a workspace limit cannot narrow (`proxy`, `admin`). */
|
|
34
|
+
var scopeInfoSchema = lazy(() => type({
|
|
35
|
+
scope: apiTokenScopeSchema,
|
|
36
|
+
workspaceLimited: "boolean"
|
|
37
|
+
}));
|
|
38
|
+
var accountListSchema = lazy(() => type({
|
|
39
|
+
"accounts": accountViewSchema.array(),
|
|
40
|
+
/** Optional for an older panel. */
|
|
41
|
+
"scopes?": scopeInfoSchema.array()
|
|
42
|
+
}));
|
|
43
|
+
var accountIdBodySchema = lazy(() => type({ account: accountViewSchema }));
|
|
44
|
+
/** Absent `secret` means the panel generates one and shows it once. */
|
|
45
|
+
var accountCreateSchema = lazy(() => type({
|
|
46
|
+
"id": "1 <= string <= 64",
|
|
47
|
+
"label?": "1 <= string <= 120",
|
|
48
|
+
"scopes": apiTokenScopeSchema.array().atLeastLength(1),
|
|
49
|
+
"workspaces?": "string[]",
|
|
50
|
+
"secret?": passwordValueSchema
|
|
51
|
+
}).onUndeclaredKey("reject"));
|
|
52
|
+
/** Ids are immutable. */
|
|
53
|
+
var accountPatchSchema = lazy(() => type({
|
|
54
|
+
"label?": "1 <= string <= 120",
|
|
55
|
+
"scopes?": apiTokenScopeSchema.array().atLeastLength(1),
|
|
56
|
+
"workspaces?": type("string[]").or(type("null")),
|
|
57
|
+
"enabled?": "boolean"
|
|
58
|
+
}).onUndeclaredKey("reject"));
|
|
59
|
+
/** The create answer: the account, and its secret **once**. */
|
|
60
|
+
var accountCreatedBodySchema = lazy(() => type({
|
|
61
|
+
account: accountViewSchema,
|
|
62
|
+
secret: "string"
|
|
63
|
+
}));
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/shared/contracts/backups.ts
|
|
66
|
+
/** Backups: the archive list, the capture tree, the restore plan and both request shapes. */
|
|
67
|
+
var backupFileSchema = lazy(() => type({
|
|
68
|
+
name: "string",
|
|
69
|
+
sizeBytes: "number",
|
|
70
|
+
createdAt: "number",
|
|
71
|
+
encrypted: "boolean"
|
|
72
|
+
}));
|
|
73
|
+
/** One selectable backup entry: a global item, or a workspace whose `items` are its sub-choices. */
|
|
74
|
+
var backupEntrySchema = lazy(() => type({
|
|
75
|
+
/** `global:settings` | `global:secrets` | `global:tls` | `workspace:<id>`. */
|
|
76
|
+
"id": "string",
|
|
77
|
+
/** The panel's English wording, for older or single-language UIs; a translated UI uses `labelKey`. */
|
|
78
|
+
"label": "string",
|
|
79
|
+
/** A catalog key for `label`, with its placeholder values, so a UI can render its own language. */
|
|
80
|
+
"labelKey?": "string",
|
|
81
|
+
"labelParams?": "Record<string, string>",
|
|
82
|
+
"kind": "\"settings\" | \"secrets\" | \"tls\" | \"workspace\"",
|
|
83
|
+
"workspaceId?": "string",
|
|
84
|
+
"note": "string | null",
|
|
85
|
+
"noteKey?": "string",
|
|
86
|
+
"noteParams?": "Record<string, string>",
|
|
87
|
+
"items": type({
|
|
88
|
+
"id": "string",
|
|
89
|
+
"label": "string",
|
|
90
|
+
"labelKey?": "string",
|
|
91
|
+
"labelParams?": "Record<string, string>",
|
|
92
|
+
"kind": "\"settings\" | \"servers\" | \"secrets\" | \"jobs\" | \"data\"",
|
|
93
|
+
/** Which secret a `secrets` leaf carries (`password`, `apiToken`, `telegram`, `ddns`, …). */
|
|
94
|
+
"secret?": "string",
|
|
95
|
+
"path?": "string",
|
|
96
|
+
/** Who declared a data path: `global`, `<serverId>:backupPaths` or `<serverId>:<ENV>`. */
|
|
97
|
+
"origin?": "string",
|
|
98
|
+
"included": "boolean",
|
|
99
|
+
"note": "string | null",
|
|
100
|
+
"noteKey?": "string",
|
|
101
|
+
"noteParams?": "Record<string, string>",
|
|
102
|
+
"ignoreGenerated?": "boolean"
|
|
103
|
+
}).array()
|
|
104
|
+
}));
|
|
105
|
+
/** The schedule as a response carries it: undeclared keys are accepted at every level (`scope` is nested). */
|
|
106
|
+
var backupScheduleViewSchema = lazy(() => backupScheduleSchema.onDeepUndeclaredKey("ignore"));
|
|
107
|
+
var backupsViewSchema = lazy(() => type({
|
|
108
|
+
"enabled": "boolean",
|
|
109
|
+
"dir": "string",
|
|
110
|
+
"keep": "number",
|
|
111
|
+
/** Optional for an older panel; read as the schema defaults when absent. */
|
|
112
|
+
"schedule?": backupScheduleViewSchema,
|
|
113
|
+
/** When the last automatic archive was written; null until one has run. */
|
|
114
|
+
"lastAutomaticAt?": "number | null",
|
|
115
|
+
/** Why the last scheduled pass failed, and when; null once a pass succeeds. */
|
|
116
|
+
"scheduleError?": type({
|
|
117
|
+
message: "string",
|
|
118
|
+
at: "number"
|
|
119
|
+
}),
|
|
120
|
+
"includePaths": type("string[]"),
|
|
121
|
+
/** Sent only by an older panel; the selection model now lives at `GET /api/backups`. */
|
|
122
|
+
"entries?": backupEntrySchema.array(),
|
|
123
|
+
"files?": backupFileSchema.array()
|
|
124
|
+
}));
|
|
125
|
+
/** What a capture could include and what is on disk; its own route because building it is too costly per frame. */
|
|
126
|
+
var backupSelectionSchema = lazy(() => type({
|
|
127
|
+
dir: "string",
|
|
128
|
+
entries: backupEntrySchema.array(),
|
|
129
|
+
files: backupFileSchema.array()
|
|
130
|
+
}));
|
|
131
|
+
/** One restorable slice of an archive: a global item, a workspace item, or a data path. */
|
|
132
|
+
var restoreItemSchema = lazy(() => type({
|
|
133
|
+
/** A backup entry or leaf id (`workspace:<id>:servers`, `data:<path>`, ...). */
|
|
134
|
+
"id": "string",
|
|
135
|
+
"label": "string",
|
|
136
|
+
"labelKey?": "string",
|
|
137
|
+
"labelParams?": "Record<string, string>",
|
|
138
|
+
"kind": "\"settings\" | \"secrets\" | \"servers\" | \"jobs\" | \"tls\" | \"data\"",
|
|
139
|
+
"workspaceId?": "string",
|
|
140
|
+
/** false when the current instance does not declare it, or it is not in the archive. */
|
|
141
|
+
"restorable": "boolean",
|
|
142
|
+
"selected": "boolean",
|
|
143
|
+
"note": "string | null",
|
|
144
|
+
"noteKey?": "string",
|
|
145
|
+
"noteParams?": "Record<string, string>"
|
|
146
|
+
}));
|
|
147
|
+
/** Why one thing was skipped, in parts, so a translated UI can word it; `skipped` keeps the English sentences. */
|
|
148
|
+
var restoreSkipSchema = lazy(() => type({
|
|
149
|
+
"label": "string",
|
|
150
|
+
"labelKey?": "string",
|
|
151
|
+
"labelParams?": "Record<string, string>",
|
|
152
|
+
/** A catalog key for the parenthesis, e.g. `not selected`; absent when there is none. */
|
|
153
|
+
"reasonKey?": "string",
|
|
154
|
+
"reasonParams?": "Record<string, string>"
|
|
155
|
+
}));
|
|
156
|
+
var restorePlanSchema = lazy(() => type({
|
|
157
|
+
"dryRun": "boolean",
|
|
158
|
+
"encrypted": "boolean",
|
|
159
|
+
"needsPassword": "boolean",
|
|
160
|
+
/** Where the archive says it came from; absent for an older archive or panel. */
|
|
161
|
+
"archive?": type({
|
|
162
|
+
"writtenBy?": "string",
|
|
163
|
+
"schema?": "number"
|
|
164
|
+
}),
|
|
165
|
+
"items": restoreItemSchema.array(),
|
|
166
|
+
/** One row per backup hook that ran; `output` is a bounded tail, not a log. */
|
|
167
|
+
"hooks?": type({
|
|
168
|
+
"serverId": "string",
|
|
169
|
+
"workspaceId": "string",
|
|
170
|
+
"action": "\"dump\" | \"load\"",
|
|
171
|
+
"ok": "boolean",
|
|
172
|
+
"output?": "string"
|
|
173
|
+
}).array(),
|
|
174
|
+
"applied": type("string[]"),
|
|
175
|
+
/** The ids `applied` names, so a UI can render its own labels. */
|
|
176
|
+
"appliedIds?": type("string[]"),
|
|
177
|
+
"skipped": type("string[]"),
|
|
178
|
+
"skippedItems?": restoreSkipSchema.array(),
|
|
179
|
+
/** Only the panel's own listener needs a restart; its servers are re-read live. */
|
|
180
|
+
"restartRequired": "boolean",
|
|
181
|
+
"reloaded": "boolean",
|
|
182
|
+
/** Running servers whose declared data path this restore overwrote: anything written since the archive is gone. */
|
|
183
|
+
"replacedUnderRunning?": type({
|
|
184
|
+
workspaceId: "string",
|
|
185
|
+
serverId: "string",
|
|
186
|
+
path: "string"
|
|
187
|
+
}).array(),
|
|
188
|
+
/** Workspaces this restore created because the archive named them and the host did not have them. */
|
|
189
|
+
"createdWorkspaces?": type("string[]"),
|
|
190
|
+
"error": "string?"
|
|
191
|
+
}));
|
|
192
|
+
var backupCreateSchema = lazy(() => type({
|
|
193
|
+
/** Optional: encrypts the archive. Never stored. */
|
|
194
|
+
password: passwordValueSchema.optional(),
|
|
195
|
+
/** Leaf ids to capture (`global:settings`, `workspace:<id>:servers`, `data:<path>`, ...); omitted means everything. */
|
|
196
|
+
include: type("string[] >= 1").optional(),
|
|
197
|
+
/** Leaf ids to leave out, applied after `include`. Empty is refused as ambiguous, like `include`. */
|
|
198
|
+
exclude: type("string[] >= 1").optional()
|
|
199
|
+
}).onUndeclaredKey("reject"));
|
|
200
|
+
var restoreRequestSchema = lazy(() => type({
|
|
201
|
+
name: "string?",
|
|
202
|
+
password: passwordValueSchema.optional(),
|
|
203
|
+
/** Item ids to restore; omitted means every restorable item. */
|
|
204
|
+
include: type("string[]").optional(),
|
|
205
|
+
/** Item ids to leave out, applied after `include`. Empty is refused as ambiguous. */
|
|
206
|
+
exclude: type("string[] >= 1").optional()
|
|
207
|
+
}).onUndeclaredKey("reject"));
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/shared/contracts/ddns.ts
|
|
210
|
+
/** Dynamic DNS: accounts and domains, pass results, and provider metadata. */
|
|
211
|
+
var ddnsRecordTypeSchema = lazy(() => type.enumerated("A", "AAAA"));
|
|
212
|
+
/** One DNS provider account; its credentials live in the secrets file keyed by `id`, never in the config. */
|
|
213
|
+
var ddnsAccountSchema = lazy(() => type({
|
|
214
|
+
id: "/^[a-z0-9][a-z0-9_-]*$/",
|
|
215
|
+
provider: "string >= 1",
|
|
216
|
+
label: "string = \"\""
|
|
217
|
+
}).onUndeclaredKey("reject"));
|
|
218
|
+
/** A hostname to keep pointed at this machine. */
|
|
219
|
+
var ddnsDomainSchema = lazy(() => type({
|
|
220
|
+
host: "/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/",
|
|
221
|
+
account: "string >= 1",
|
|
222
|
+
/** Records to keep current; `A` unless the host needs IPv6 too. */
|
|
223
|
+
types: ddnsRecordTypeSchema.array().default(() => ["A"]),
|
|
224
|
+
/** The registered apex, only where a provider cannot look it up and the guess is wrong. */
|
|
225
|
+
zone: "string?",
|
|
226
|
+
/** Seconds; `1` means "automatic" where the provider supports it. */
|
|
227
|
+
ttl: "number.integer >= 1?",
|
|
228
|
+
/** Cloudflare only. */
|
|
229
|
+
proxied: "boolean = false",
|
|
230
|
+
enabled: "boolean = true"
|
|
231
|
+
}).onUndeclaredKey("reject"));
|
|
232
|
+
/** Which public IP families to detect; a provider is only called for the ones declared. */
|
|
233
|
+
var ddnsIpv4Schema = lazy(() => type({
|
|
234
|
+
enabled: "boolean = true",
|
|
235
|
+
/** Override the public-IP endpoint; empty uses the built-in list. */
|
|
236
|
+
url: "string = \"\""
|
|
237
|
+
}).onUndeclaredKey("reject"));
|
|
238
|
+
var ddnsIpv6Schema = lazy(() => type({
|
|
239
|
+
enabled: "boolean = false",
|
|
240
|
+
url: "string = \"\""
|
|
241
|
+
}).onUndeclaredKey("reject"));
|
|
242
|
+
/** A provider is called only when the address it last confirmed differs, to stay inside rate limits. */
|
|
243
|
+
var ddnsConfigSchema = lazy(() => type({
|
|
244
|
+
enabled: "boolean = false",
|
|
245
|
+
intervalMs: "number >= 60000 = 300000",
|
|
246
|
+
ipv4: ddnsIpv4Schema.default(() => ({})),
|
|
247
|
+
ipv6: ddnsIpv6Schema.default(() => ({})),
|
|
248
|
+
ttl: "number.integer >= 1 = 1",
|
|
249
|
+
accounts: ddnsAccountSchema.array().default(() => []),
|
|
250
|
+
domains: ddnsDomainSchema.array().default(() => [])
|
|
251
|
+
}).onUndeclaredKey("reject"));
|
|
252
|
+
var ddnsRecordStateSchema = lazy(() => type("\"pending\" | \"ok\" | \"unchanged\" | \"error\" | \"skipped\""));
|
|
253
|
+
var ddnsRecordViewSchema = lazy(() => type({
|
|
254
|
+
"host": "string",
|
|
255
|
+
"account": "string",
|
|
256
|
+
"provider": "string",
|
|
257
|
+
"type": ddnsRecordTypeSchema,
|
|
258
|
+
"ip": "string | null",
|
|
259
|
+
"state": ddnsRecordStateSchema,
|
|
260
|
+
"message": "string | null",
|
|
261
|
+
"updatedAt": "number | null",
|
|
262
|
+
/** The provider refused permanently; no retry until the hostname, account or credentials change, or a check. */
|
|
263
|
+
"stopped?": "boolean"
|
|
264
|
+
}));
|
|
265
|
+
/** Live DDNS state, as the state frame and the settings page read it. */
|
|
266
|
+
var ddnsStatusSchema = lazy(() => type({
|
|
267
|
+
enabled: "boolean",
|
|
268
|
+
running: "boolean",
|
|
269
|
+
lastRunAt: "number | null",
|
|
270
|
+
lastResult: "string | null",
|
|
271
|
+
ipv4: "string | null",
|
|
272
|
+
ipv6: "string | null",
|
|
273
|
+
records: ddnsRecordViewSchema.array()
|
|
274
|
+
}));
|
|
275
|
+
var ddnsProviderFieldSchema = lazy(() => type({
|
|
276
|
+
key: "string",
|
|
277
|
+
label: "string",
|
|
278
|
+
hint: "string = \"\"",
|
|
279
|
+
optional: "boolean = false"
|
|
280
|
+
}));
|
|
281
|
+
var ddnsProviderInfoSchema = lazy(() => type({
|
|
282
|
+
id: "string",
|
|
283
|
+
label: "string",
|
|
284
|
+
docsUrl: "string",
|
|
285
|
+
families: ddnsRecordTypeSchema.array(),
|
|
286
|
+
fields: ddnsProviderFieldSchema.array(),
|
|
287
|
+
ttl: "boolean",
|
|
288
|
+
proxied: "boolean",
|
|
289
|
+
/** These credentials can also answer an ACME DNS-01 challenge (a TXT record). */
|
|
290
|
+
txt: "boolean"
|
|
291
|
+
}));
|
|
292
|
+
/** `GET /api/ddns`: the policy, the live state, and the providers this build knows. */
|
|
293
|
+
var ddnsViewSchema = lazy(() => type({
|
|
294
|
+
config: ddnsConfigSchema,
|
|
295
|
+
status: ddnsStatusSchema,
|
|
296
|
+
providers: ddnsProviderInfoSchema.array(),
|
|
297
|
+
credentials: type("string[]")
|
|
298
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
299
|
+
/** `PUT /api/ddns/credentials/:id`; the provider travels along because the account may be an unsaved draft. */
|
|
300
|
+
var ddnsCredentialsSchema = lazy(() => type({
|
|
301
|
+
provider: "string >= 1",
|
|
302
|
+
credentials: type("Record<string, string>")
|
|
303
|
+
}).onUndeclaredKey("reject"));
|
|
304
|
+
/** No defaults; `accounts`/`domains` are replaced whole, while `ipv4`/`ipv6` merge. */
|
|
305
|
+
var ddnsPatchSchema = lazy(() => type({
|
|
306
|
+
enabled: "boolean?",
|
|
307
|
+
intervalMs: "number >= 60000?",
|
|
308
|
+
ipv4: type({
|
|
309
|
+
enabled: "boolean?",
|
|
310
|
+
url: "string?"
|
|
311
|
+
}).onUndeclaredKey("reject").optional(),
|
|
312
|
+
ipv6: type({
|
|
313
|
+
enabled: "boolean?",
|
|
314
|
+
url: "string?"
|
|
315
|
+
}).onUndeclaredKey("reject").optional(),
|
|
316
|
+
ttl: "number.integer >= 1?",
|
|
317
|
+
accounts: ddnsAccountSchema.array().optional(),
|
|
318
|
+
domains: ddnsDomainSchema.array().optional()
|
|
319
|
+
}).onUndeclaredKey("reject"));
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/shared/contracts/proxy.ts
|
|
322
|
+
/** The reverse proxy: routes, certificates, engine state, and the config and patch shapes. */
|
|
323
|
+
/** One engine ships today; the field keeps a config valid if a second one lands. */
|
|
324
|
+
var proxyEngineSchema = lazy(() => type.enumerated("caddy"));
|
|
325
|
+
/** What a route forwards to: a supervised entry, the panel itself, or a literal upstream. */
|
|
326
|
+
var proxyTargetSchema = lazy(() => type.enumerated("server", "panel", "external"));
|
|
327
|
+
/** `auto` lets the engine decide: a public name gets ACME, a local one its own CA. */
|
|
328
|
+
var proxyTlsModeSchema = lazy(() => type.enumerated("auto", "off", "manual"));
|
|
329
|
+
/** One public hostname and where it goes; routes are panel-wide, so a server target names its workspace too. */
|
|
330
|
+
var proxyRouteSchema = lazy(() => type({
|
|
331
|
+
"id": "/^[a-z0-9][a-z0-9_-]*$/",
|
|
332
|
+
"host": "/^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/",
|
|
333
|
+
"enabled": "boolean = true",
|
|
334
|
+
"target": proxyTargetSchema.default(() => "server"),
|
|
335
|
+
/** `target: "server"` — an id is only unique inside its workspace. */
|
|
336
|
+
"workspace": "string = \"\"",
|
|
337
|
+
"server": "string = \"\"",
|
|
338
|
+
/** `target: "external"` — a literal upstream such as `http://10.0.0.5:8080`. */
|
|
339
|
+
"url": "string = \"\"",
|
|
340
|
+
/** Optional path prefix; empty serves the whole host. */
|
|
341
|
+
"path": "string = \"\"",
|
|
342
|
+
"tls": proxyTlsModeSchema.default(() => "auto"),
|
|
343
|
+
/** `<workspace>/<account>` answering DNS-01 for this host; empty picks the workspace's only TXT-capable account. */
|
|
344
|
+
"dnsAccount": "string = \"\"",
|
|
345
|
+
/** Skip verifying an `https://` upstream's certificate; no default, so an untouched config is not rewritten. */
|
|
346
|
+
"upstreamSkipVerify?": "boolean"
|
|
347
|
+
}).onUndeclaredKey("reject"));
|
|
348
|
+
/** Names an uploaded PEM pair; the pair itself lives on disk (0600). */
|
|
349
|
+
var proxyCertificateSchema = lazy(() => type({
|
|
350
|
+
id: "/^[a-z0-9][a-z0-9_-]*$/",
|
|
351
|
+
label: "string = \"\""
|
|
352
|
+
}).onUndeclaredKey("reject"));
|
|
353
|
+
/** `fallback` is a public name the CA would not issue for, so the engine serves its own CA. */
|
|
354
|
+
var proxyCertificateStateSchema = lazy(() => type.enumerated("off", "local", "uploaded", "issued", "pending", "failed", "fallback"));
|
|
355
|
+
/** DNS-01, answered by the panel over ACMEProxy so the engine never holds DNS credentials. */
|
|
356
|
+
var proxyDns01Schema = lazy(() => type({
|
|
357
|
+
enabled: "boolean = false",
|
|
358
|
+
/** Nameservers Caddy checks the TXT record against; empty uses its own defaults. */
|
|
359
|
+
resolvers: type("string[]").default(() => [])
|
|
360
|
+
}).onUndeclaredKey("reject"));
|
|
361
|
+
var proxyConfigSchema = lazy(() => type({
|
|
362
|
+
enabled: "boolean = false",
|
|
363
|
+
engine: proxyEngineSchema.default(() => "caddy"),
|
|
364
|
+
/** Cleartext side: ACME HTTP-01 challenges and the redirect to HTTPS. */
|
|
365
|
+
httpPort: "1 <= number.integer <= 65535 = 80",
|
|
366
|
+
httpsPort: "1 <= number.integer <= 65535 = 443",
|
|
367
|
+
/** ACME account address; a public certificate needs one. */
|
|
368
|
+
email: "string = \"\"",
|
|
369
|
+
/** The ACME staging endpoint: untrusted certificates, no rate-limit burn. */
|
|
370
|
+
staging: "boolean = false",
|
|
371
|
+
dns01: proxyDns01Schema.default(() => ({})),
|
|
372
|
+
/** PEM pairs a route with `tls: "manual"` may serve; the engine picks by SNI. */
|
|
373
|
+
certificates: proxyCertificateSchema.array().default(() => []),
|
|
374
|
+
routes: proxyRouteSchema.array().default(() => [])
|
|
375
|
+
}).onUndeclaredKey("reject"));
|
|
376
|
+
var proxyEngineSourceSchema = lazy(() => type.enumerated("downloaded", "custom"));
|
|
377
|
+
var proxyEngineStatusSchema = lazy(() => type({
|
|
378
|
+
id: proxyEngineSchema,
|
|
379
|
+
installed: "boolean",
|
|
380
|
+
/** The version the binary reports; `null` until it has been probed. */
|
|
381
|
+
version: "string | null",
|
|
382
|
+
source: proxyEngineSourceSchema.or(type("null")),
|
|
383
|
+
path: "string | null",
|
|
384
|
+
bytes: "number | null",
|
|
385
|
+
error: "string | null"
|
|
386
|
+
}));
|
|
387
|
+
var proxyEngineInfoSchema = lazy(() => type({
|
|
388
|
+
id: proxyEngineSchema,
|
|
389
|
+
label: "string",
|
|
390
|
+
docsUrl: "string",
|
|
391
|
+
releaseUrl: "string",
|
|
392
|
+
acme: "boolean",
|
|
393
|
+
internalCa: "boolean",
|
|
394
|
+
dns01: "boolean",
|
|
395
|
+
tcp: "boolean"
|
|
396
|
+
}));
|
|
397
|
+
var proxyRouteStatusSchema = lazy(() => type.enumerated("ok", "disabled", "no-upstream", "error"));
|
|
398
|
+
var proxyRouteViewSchema = lazy(() => type({
|
|
399
|
+
"route": proxyRouteSchema,
|
|
400
|
+
"status": proxyRouteStatusSchema,
|
|
401
|
+
"upstream": "string | null",
|
|
402
|
+
"message": "string | null",
|
|
403
|
+
/** Where this hostname's certificate stands. Optional: an older panel omits it. */
|
|
404
|
+
"certificate?": type({
|
|
405
|
+
"state": proxyCertificateStateSchema,
|
|
406
|
+
"message": "string | null",
|
|
407
|
+
/** For `fallback`: minutes until the engine retries the CA by itself. */
|
|
408
|
+
"retryInMinutes?": "number"
|
|
409
|
+
})
|
|
410
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
411
|
+
var proxyRunStateSchema = lazy(() => type.enumerated("off", "stopped", "starting", "running", "error", "unsupported"));
|
|
412
|
+
var proxyStatusSchema = lazy(() => type({
|
|
413
|
+
state: proxyRunStateSchema,
|
|
414
|
+
pid: "number | null",
|
|
415
|
+
urls: type("string[]"),
|
|
416
|
+
/** Days until the soonest publicly-issued certificate expires; `null` when none. */
|
|
417
|
+
certExpiryDays: "number | null",
|
|
418
|
+
since: "number | null",
|
|
419
|
+
lastError: "string | null"
|
|
420
|
+
}));
|
|
421
|
+
var proxyCertificateViewSchema = lazy(() => type({
|
|
422
|
+
id: "string",
|
|
423
|
+
label: "string",
|
|
424
|
+
present: "boolean",
|
|
425
|
+
/** The engine would serve this pair for at least one manual route. */
|
|
426
|
+
used: "boolean",
|
|
427
|
+
subject: "string | null",
|
|
428
|
+
issuer: "string | null",
|
|
429
|
+
validTo: "string | null",
|
|
430
|
+
daysRemaining: "number | null",
|
|
431
|
+
hosts: type("string[]"),
|
|
432
|
+
error: "string | null"
|
|
433
|
+
}));
|
|
434
|
+
/** A DNS account a route may name, flattened across workspaces. */
|
|
435
|
+
var proxyDnsAccountViewSchema = lazy(() => type({
|
|
436
|
+
"workspace": "string",
|
|
437
|
+
"account": "string",
|
|
438
|
+
"provider": "string",
|
|
439
|
+
"label": "string",
|
|
440
|
+
/** The credentials can write a TXT record, so this account can answer a challenge. */
|
|
441
|
+
"writesTxt": "boolean",
|
|
442
|
+
"hasCredentials": "boolean",
|
|
443
|
+
/** Zones the account is known to hold; "automatic" uses it only for names inside one. */
|
|
444
|
+
"zones?": "string[]"
|
|
445
|
+
}));
|
|
446
|
+
/** `GET /api/proxy`: the policy, the engine, the live state and the resolved routes. */
|
|
447
|
+
var proxyViewSchema = lazy(() => type({
|
|
448
|
+
"config": proxyConfigSchema,
|
|
449
|
+
"engine": proxyEngineStatusSchema,
|
|
450
|
+
"engines": proxyEngineInfoSchema.array(),
|
|
451
|
+
"status": proxyStatusSchema,
|
|
452
|
+
"routes": proxyRouteViewSchema.array(),
|
|
453
|
+
"certificates": proxyCertificateViewSchema.array(),
|
|
454
|
+
/** Every DNS account a route may name. Optional: an older panel omits it. */
|
|
455
|
+
"dnsAccounts?": proxyDnsAccountViewSchema.array(),
|
|
456
|
+
/** On a write's answer only: the change was saved, but the engine did not apply it, and this says why. */
|
|
457
|
+
"applyError?": "string"
|
|
458
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
459
|
+
/** A route as a patch sends it: every field but `id`/`host` optional. */
|
|
460
|
+
var proxyRoutePatchSchema = lazy(() => type({
|
|
461
|
+
id: "string",
|
|
462
|
+
host: "string",
|
|
463
|
+
enabled: "boolean?",
|
|
464
|
+
target: proxyTargetSchema.optional(),
|
|
465
|
+
workspace: "string?",
|
|
466
|
+
server: "string?",
|
|
467
|
+
url: "string?",
|
|
468
|
+
path: "string?",
|
|
469
|
+
tls: proxyTlsModeSchema.optional(),
|
|
470
|
+
dnsAccount: "string?",
|
|
471
|
+
upstreamSkipVerify: "boolean?"
|
|
472
|
+
}).onUndeclaredKey("reject"));
|
|
473
|
+
/** No defaults; `routes` and `certificates` are replaced whole, since a merge cannot remove one. */
|
|
474
|
+
var proxyPatchSchema = lazy(() => type({
|
|
475
|
+
enabled: "boolean?",
|
|
476
|
+
engine: proxyEngineSchema.optional(),
|
|
477
|
+
httpPort: "1 <= number.integer <= 65535?",
|
|
478
|
+
httpsPort: "1 <= number.integer <= 65535?",
|
|
479
|
+
email: "string?",
|
|
480
|
+
staging: "boolean?",
|
|
481
|
+
/** Merged key by key; an explicit `null` clears a key. */
|
|
482
|
+
dns01: type({
|
|
483
|
+
enabled: "boolean | null?",
|
|
484
|
+
resolvers: "string[] | null?"
|
|
485
|
+
}).onUndeclaredKey("reject").optional(),
|
|
486
|
+
certificates: proxyCertificateSchema.array().optional(),
|
|
487
|
+
routes: proxyRoutePatchSchema.array().optional()
|
|
488
|
+
}).onUndeclaredKey("reject"));
|
|
489
|
+
/** `PUT /api/proxy/certificates/:id`: the pair itself, plus what to call it. */
|
|
490
|
+
var proxyCertificateUploadSchema = lazy(() => type({
|
|
491
|
+
label: "string = \"\"",
|
|
492
|
+
certificate: "string >= 1",
|
|
493
|
+
privateKey: "string >= 1"
|
|
494
|
+
}).onUndeclaredKey("reject"));
|
|
495
|
+
/** `POST /api/proxy/engine`: which release to install; empty means the current one. */
|
|
496
|
+
var proxyEngineInstallSchema = lazy(() => type({ version: "string = \"\"" }).onUndeclaredKey("reject"));
|
|
11
497
|
var HOST_ALERT_DEFAULTS = {
|
|
12
498
|
diskUsedPercent: 90,
|
|
13
499
|
memoryUsedPercent: 90,
|
|
@@ -16,6 +502,8 @@ var HOST_ALERT_DEFAULTS = {
|
|
|
16
502
|
};
|
|
17
503
|
var NOTHING_SAMPLED = {
|
|
18
504
|
sampled: false,
|
|
505
|
+
unmeasured: [],
|
|
506
|
+
staleSince: null,
|
|
19
507
|
cpuUsedPercent: null,
|
|
20
508
|
memoryUsedPercent: null,
|
|
21
509
|
swapUsedPercent: null,
|
|
@@ -30,35 +518,10 @@ var NOTHING_SAMPLED = {
|
|
|
30
518
|
swapBand: null,
|
|
31
519
|
tempBand: null
|
|
32
520
|
};
|
|
33
|
-
/** A number the frame carries, or null when it carries none. */
|
|
34
521
|
function present(value) {
|
|
35
522
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
36
523
|
}
|
|
37
|
-
/**
|
|
38
|
-
* How a per-cpu load sits against the threshold the panel notifies on.
|
|
39
|
-
*
|
|
40
|
-
* The ratio is what a person configures: `host.loadPerCpu` is the count the alert fires at, so
|
|
41
|
-
* `danger` is that number itself and `warn` is the approach to it. `0` disables the alert in
|
|
42
|
-
* `sampleHost`, so nothing can breach it and the band is `ok` — painting a box red for a
|
|
43
|
-
* notification that will never arrive is the same defect as inventing a reading. It lives here
|
|
44
|
-
* rather than in a component so both UIs share one band, the mistake that produced two hardcoded
|
|
45
|
-
* copies of the default.
|
|
46
|
-
*/
|
|
47
|
-
function loadBand(loadPerCpu, alertPerCpu) {
|
|
48
|
-
return thresholdBand(loadPerCpu, alertPerCpu, 2);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* How a reading sits against the threshold the panel notifies on.
|
|
52
|
-
*
|
|
53
|
-
* `danger` at the threshold is the whole point: the alert fires there, so a bar that stays `warn`
|
|
54
|
-
* while a notification goes out disagrees with the panel's own verdict. `0` disables that alert in
|
|
55
|
-
* `sampleHost`, so nothing can breach it and the band is `ok`. One rule for the per-cpu load, the
|
|
56
|
-
* three percentages and each disk — they differ only in what the number means, and the mistake this
|
|
57
|
-
* replaced was four surfaces each deciding a band for itself.
|
|
58
|
-
*/
|
|
59
|
-
function percentageBand(value, alertAt, fallback) {
|
|
60
|
-
return thresholdBand(value, alertAt, fallback);
|
|
61
|
-
}
|
|
524
|
+
/** `danger` *at* the threshold, where the alert fires; `0` disables the alert, so the band is `ok`. */
|
|
62
525
|
function thresholdBand(value, alertAt, fallback) {
|
|
63
526
|
if (value === null || !Number.isFinite(value)) return null;
|
|
64
527
|
const threshold = alertAt === void 0 || !Number.isFinite(alertAt) ? fallback : alertAt;
|
|
@@ -67,47 +530,196 @@ function thresholdBand(value, alertAt, fallback) {
|
|
|
67
530
|
if (value >= threshold * .7) return "warn";
|
|
68
531
|
return "ok";
|
|
69
532
|
}
|
|
70
|
-
/**
|
|
533
|
+
/** A missing frame is the same as an unsampled one. */
|
|
71
534
|
function hostReadings(host) {
|
|
72
535
|
if (host === null || host === void 0) return NOTHING_SAMPLED;
|
|
73
|
-
if (!(host.sampledAt !== null)) return {
|
|
536
|
+
if (!(host.sampledAt !== null && host.enabled !== false)) return {
|
|
74
537
|
...NOTHING_SAMPLED,
|
|
538
|
+
staleSince: host.sampledAt,
|
|
75
539
|
disks: []
|
|
76
540
|
};
|
|
77
|
-
const
|
|
541
|
+
const unmeasured = new Set(host.unmeasured ?? []);
|
|
542
|
+
const measured = (name, value) => unmeasured.has(name) ? null : present(value);
|
|
543
|
+
const load1m = measured("load", host.loadAvg[0]);
|
|
78
544
|
const cpus = present(host.cpus);
|
|
79
545
|
const loadPerCpu = load1m === null ? null : load1m / Math.max(1, cpus ?? 1);
|
|
546
|
+
const memoryUsedPercent = measured("memory", host.memoryUsedPercent);
|
|
547
|
+
const swapUsedPercent = measured("swap", host.swapUsedPercent);
|
|
548
|
+
const tempCelsius = present(host.tempCelsius);
|
|
80
549
|
return {
|
|
81
550
|
sampled: true,
|
|
551
|
+
unmeasured: [...unmeasured].filter((name) => [
|
|
552
|
+
"load",
|
|
553
|
+
"memory",
|
|
554
|
+
"swap"
|
|
555
|
+
].includes(name)),
|
|
556
|
+
staleSince: null,
|
|
82
557
|
cpuUsedPercent: present(host.cpuUsedPercent),
|
|
83
|
-
memoryUsedPercent
|
|
84
|
-
swapUsedPercent
|
|
558
|
+
memoryUsedPercent,
|
|
559
|
+
swapUsedPercent,
|
|
85
560
|
load1m,
|
|
86
|
-
load5m:
|
|
87
|
-
load15m:
|
|
561
|
+
load5m: measured("load", host.loadAvg[1]),
|
|
562
|
+
load15m: measured("load", host.loadAvg[2]),
|
|
88
563
|
loadPerCpu,
|
|
89
|
-
loadBand:
|
|
90
|
-
memoryBand:
|
|
91
|
-
swapBand:
|
|
92
|
-
tempBand:
|
|
93
|
-
tempCelsius
|
|
564
|
+
loadBand: thresholdBand(loadPerCpu, host.loadAlertPerCpu, 2),
|
|
565
|
+
memoryBand: thresholdBand(memoryUsedPercent, host.memoryUsedPercentAlert, HOST_ALERT_DEFAULTS.memoryUsedPercent),
|
|
566
|
+
swapBand: thresholdBand(swapUsedPercent, host.swapUsedPercentAlert, HOST_ALERT_DEFAULTS.swapUsedPercent),
|
|
567
|
+
tempBand: thresholdBand(tempCelsius, host.tempCelsiusAlert, HOST_ALERT_DEFAULTS.tempCelsius),
|
|
568
|
+
tempCelsius,
|
|
94
569
|
disks: host.disks.map((disk) => ({
|
|
95
570
|
...disk,
|
|
96
|
-
band:
|
|
571
|
+
band: thresholdBand(present(disk.usedPercent), host.diskUsedPercentAlert, HOST_ALERT_DEFAULTS.diskUsedPercent)
|
|
97
572
|
}))
|
|
98
573
|
};
|
|
99
574
|
}
|
|
100
575
|
//#endregion
|
|
576
|
+
//#region src/shared/query-params.ts
|
|
577
|
+
/**
|
|
578
|
+
* Query values parsed at the boundary: anything outside the accepted spellings or bounds is a
|
|
579
|
+
* `400 INVALID_INPUT`, never a silent default. `yes`/`no`/`on`/`off` are refused deliberately.
|
|
580
|
+
*/
|
|
581
|
+
/** A flag: `0`, `1`, `true` or `false`, parsed to a boolean. */
|
|
582
|
+
var booleanParam = lazy(() => type("\"0\" | \"1\" | \"true\" | \"false\"").pipe((value) => value === "1" || value === "true"));
|
|
583
|
+
/** A whole decimal integer within `min`–`max`, parsed to a number; out of bounds is refused, not clamped. */
|
|
584
|
+
function integerParam(min, max) {
|
|
585
|
+
return lazy(() => type("string.integer.parse").pipe(type(`${min} <= number <= ${max}`)));
|
|
586
|
+
}
|
|
587
|
+
//#endregion
|
|
588
|
+
//#region src/shared/contracts/frames.ts
|
|
589
|
+
/** The SSE frames, and the `event:` names derived from them. */
|
|
590
|
+
/** One SSE frame, discriminated by `type`; each is exported because the spec's `GET /api/events` names it in a `oneOf`. */
|
|
591
|
+
var sseStateFrameSchema = lazy(() => type({
|
|
592
|
+
type: "\"hello\" | \"state\"",
|
|
593
|
+
ts: "number",
|
|
594
|
+
state: appStateSchema
|
|
595
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
596
|
+
var sseServerFrameSchema = lazy(() => type({
|
|
597
|
+
"type": "\"server\"",
|
|
598
|
+
"ts": "number",
|
|
599
|
+
"workspaceId?": "string",
|
|
600
|
+
"serverId": "string",
|
|
601
|
+
"server": serverViewSchema
|
|
602
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
603
|
+
var sseLogFrameSchema = lazy(() => type({
|
|
604
|
+
"type": "\"log\"",
|
|
605
|
+
"ts": "number",
|
|
606
|
+
"workspaceId?": "string",
|
|
607
|
+
"serverId": "string",
|
|
608
|
+
"lines": logLineSchema.array()
|
|
609
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
610
|
+
/** The keep-alive: proxies close a stream that stays silent for 30 s. */
|
|
611
|
+
var ssePingFrameSchema = lazy(() => type({
|
|
612
|
+
type: "\"ping\"",
|
|
613
|
+
ts: "number"
|
|
614
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
615
|
+
/** Every `event:` name the streams send, derived from the frames; a cached function so import never builds the `lazy()` schemas. */
|
|
616
|
+
var sseEventNamesCache = null;
|
|
617
|
+
function sseEventNames() {
|
|
618
|
+
if (sseEventNamesCache !== null) return sseEventNamesCache;
|
|
619
|
+
sseEventNamesCache = [...new Set([
|
|
620
|
+
sseStateFrameSchema,
|
|
621
|
+
sseServerFrameSchema,
|
|
622
|
+
sseLogFrameSchema,
|
|
623
|
+
ssePingFrameSchema
|
|
624
|
+
].flatMap((schema) => {
|
|
625
|
+
const type = schema.toJsonSchema().properties?.type;
|
|
626
|
+
return type?.enum ?? (type?.const === void 0 ? [] : [type.const]);
|
|
627
|
+
}))].sort();
|
|
628
|
+
return sseEventNamesCache;
|
|
629
|
+
}
|
|
630
|
+
var sseMessageSchema = lazy(() => sseStateFrameSchema.or(sseServerFrameSchema).or(sseLogFrameSchema).or(ssePingFrameSchema));
|
|
631
|
+
//#endregion
|
|
632
|
+
//#region src/shared/contracts/logs.ts
|
|
633
|
+
/** The log shapes: buffered lines, on-disk history, and what a page needs to explain an empty answer. */
|
|
634
|
+
/** `GET /api/servers/:id/logs` — the buffered lines, straight from memory: no window, no rotation. */
|
|
635
|
+
var bufferedLogsResponseSchema = lazy(() => type({ lines: logLineSchema.array() }));
|
|
636
|
+
/** One job's log; `enabled` is `logs.persist`, so a page can say "nothing kept" rather than "nothing printed". */
|
|
637
|
+
var jobLogViewSchema = lazy(() => type({
|
|
638
|
+
jobId: "string",
|
|
639
|
+
enabled: "boolean",
|
|
640
|
+
sizeBytes: "number",
|
|
641
|
+
files: "string[]",
|
|
642
|
+
lines: logLineSchema.array()
|
|
643
|
+
}));
|
|
644
|
+
var logHistoryQuerySchema = lazy(() => type({
|
|
645
|
+
/** Lines to show, 50–5000; outside the range is a `400`, not a clamp. */
|
|
646
|
+
"tail?": integerParam(50, 5e3),
|
|
647
|
+
/** Case-insensitive filter, applied (like `stream`) to a window wider than `tail`; `searched` reports how many lines were read. */
|
|
648
|
+
"search": "string?",
|
|
649
|
+
"stream": "\"stdout\" | \"stderr\" | \"system\"?",
|
|
650
|
+
/** Lines after this cursor (a line's `ts`); with neither `since` nor `before`, the tail. */
|
|
651
|
+
"since?": integerParam(0, 9999999999999),
|
|
652
|
+
/** Return the lines **before** this cursor — the other direction, for backfill. */
|
|
653
|
+
"before?": integerParam(0, 9999999999999)
|
|
654
|
+
}));
|
|
655
|
+
var logCursorParam = lazy(() => type(/^\d{1,13}(?::\d{1,9})?$/).pipe((raw) => {
|
|
656
|
+
const [ts, n] = raw.split(":");
|
|
657
|
+
return {
|
|
658
|
+
ts: Number(ts),
|
|
659
|
+
n: n === void 0 ? null : Number(n)
|
|
660
|
+
};
|
|
661
|
+
}));
|
|
662
|
+
/**
|
|
663
|
+
* `GET /api/logs/:id`'s query. `after` and `before` are **log cursors**, not the `?since=<seq>` of the
|
|
664
|
+
* event streams; `since` is kept as the older name for `after`.
|
|
665
|
+
*/
|
|
666
|
+
var logPageQuerySchema = lazy(() => type({
|
|
667
|
+
/** Lines to show, 50–5000; outside the range is a `400`, not a clamp. */
|
|
668
|
+
"tail?": integerParam(50, 5e3),
|
|
669
|
+
"search": "string?",
|
|
670
|
+
"stream": "\"stdout\" | \"stderr\" | \"system\"?",
|
|
671
|
+
/** Lines after this cursor, oldest first. */
|
|
672
|
+
"after?": logCursorParam,
|
|
673
|
+
/** The older name for `after`; send one or the other. */
|
|
674
|
+
"since?": logCursorParam,
|
|
675
|
+
/** Lines before this cursor, newest last — the other direction, for backfill. */
|
|
676
|
+
"before?": logCursorParam
|
|
677
|
+
}));
|
|
678
|
+
var logFileInfoSchema = lazy(() => type({
|
|
679
|
+
name: "string",
|
|
680
|
+
sizeBytes: "number"
|
|
681
|
+
}));
|
|
682
|
+
var logServerViewSchema = lazy(() => type({
|
|
683
|
+
serverId: "string",
|
|
684
|
+
label: "string",
|
|
685
|
+
status: serverStatusSchema,
|
|
686
|
+
enabled: "boolean",
|
|
687
|
+
sizeBytes: "number",
|
|
688
|
+
files: logFileInfoSchema.array()
|
|
689
|
+
}));
|
|
690
|
+
var logServersViewSchema = lazy(() => type({ servers: logServerViewSchema.array() }));
|
|
691
|
+
/** One entry's log **from disk**, with its rotation and search window — the shape the UIs parse. */
|
|
692
|
+
var logHistoryViewSchema = lazy(() => type({
|
|
693
|
+
serverId: "string",
|
|
694
|
+
enabled: "boolean",
|
|
695
|
+
sizeBytes: "number",
|
|
696
|
+
files: type("string[]"),
|
|
697
|
+
/** How many lines the search looked at, or null when not searching. */
|
|
698
|
+
searched: "number | null",
|
|
699
|
+
lines: logLineSchema.array()
|
|
700
|
+
}));
|
|
701
|
+
/** The same answer under the name the route table used; one schema, so the two cannot drift. */
|
|
702
|
+
var logLinesResponseSchema = logHistoryViewSchema;
|
|
703
|
+
//#endregion
|
|
101
704
|
//#region src/shared/contracts.ts
|
|
102
705
|
var contracts_exports = /* @__PURE__ */ __exportAll({
|
|
706
|
+
JOB_TIMEOUT_MAX_SECONDS: () => JOB_TIMEOUT_MAX_SECONDS,
|
|
707
|
+
accountCreateSchema: () => accountCreateSchema,
|
|
708
|
+
accountCreatedBodySchema: () => accountCreatedBodySchema,
|
|
709
|
+
accountIdBodySchema: () => accountIdBodySchema,
|
|
710
|
+
accountListSchema: () => accountListSchema,
|
|
711
|
+
accountPatchSchema: () => accountPatchSchema,
|
|
712
|
+
accountSecretSchema: () => accountSecretSchema,
|
|
713
|
+
accountViewSchema: () => accountViewSchema,
|
|
103
714
|
actionResultSchema: () => actionResultSchema,
|
|
104
715
|
apiErrorSchema: () => apiErrorSchema,
|
|
105
|
-
|
|
716
|
+
apiTokenScopeSchema: () => apiTokenScopeSchema,
|
|
106
717
|
appStateSchema: () => appStateSchema,
|
|
107
718
|
authSchema: () => authSchema,
|
|
108
719
|
backupCreateSchema: () => backupCreateSchema,
|
|
109
720
|
backupCreatedResponseSchema: () => backupCreatedResponseSchema,
|
|
110
721
|
backupEntrySchema: () => backupEntrySchema,
|
|
722
|
+
backupFileSchema: () => backupFileSchema,
|
|
111
723
|
backupFilesResponseSchema: () => backupFilesResponseSchema,
|
|
112
724
|
backupLocalResponseSchema: () => backupLocalResponseSchema,
|
|
113
725
|
backupScheduleSchema: () => backupScheduleSchema,
|
|
@@ -118,39 +730,63 @@ var contracts_exports = /* @__PURE__ */ __exportAll({
|
|
|
118
730
|
bootstrapOrNullSchema: () => bootstrapOrNullSchema,
|
|
119
731
|
bufferedLogsResponseSchema: () => bufferedLogsResponseSchema,
|
|
120
732
|
controlSchema: () => controlSchema,
|
|
733
|
+
credentialKindSchema: () => credentialKindSchema,
|
|
734
|
+
credentialViewSchema: () => credentialViewSchema,
|
|
735
|
+
cronExpressionSchema: () => cronExpressionSchema,
|
|
121
736
|
ddnsConfigSchema: () => ddnsConfigSchema,
|
|
122
737
|
ddnsCredentialsSchema: () => ddnsCredentialsSchema,
|
|
123
738
|
ddnsDomainSchema: () => ddnsDomainSchema,
|
|
739
|
+
ddnsPatchSchema: () => ddnsPatchSchema,
|
|
740
|
+
ddnsProviderFieldSchema: () => ddnsProviderFieldSchema,
|
|
741
|
+
ddnsProviderInfoSchema: () => ddnsProviderInfoSchema,
|
|
124
742
|
ddnsStatusSchema: () => ddnsStatusSchema,
|
|
125
743
|
ddnsViewSchema: () => ddnsViewSchema,
|
|
126
744
|
defaultsSchema: () => defaultsSchema,
|
|
127
745
|
deliveryResultSchema: () => deliveryResultSchema,
|
|
128
746
|
destinationIdParamSchema: () => destinationIdParamSchema,
|
|
129
747
|
destinationTestSchema: () => destinationTestSchema,
|
|
748
|
+
duplicateSecretEnvNames: () => duplicateSecretEnvNames,
|
|
130
749
|
duplicateWebhookIds: () => duplicateWebhookIds,
|
|
750
|
+
entryHasJobFields: () => entryHasJobFields,
|
|
131
751
|
entryStateSchema: () => entryStateSchema,
|
|
132
752
|
freePortResultSchema: () => freePortResultSchema,
|
|
133
753
|
healthResponseSchema: () => healthResponseSchema,
|
|
134
754
|
healthSchema: () => healthSchema,
|
|
135
755
|
hostSchema: () => hostSchema,
|
|
756
|
+
jobCreateSchema: () => jobCreateSchema,
|
|
757
|
+
jobEntryViewSchema: () => jobEntryViewSchema,
|
|
758
|
+
jobLogViewSchema: () => jobLogViewSchema,
|
|
759
|
+
jobOutcomeSchema: () => jobOutcomeSchema,
|
|
760
|
+
jobPatchSchema: () => jobPatchSchema,
|
|
761
|
+
jobRunDetailSchema: () => jobRunDetailSchema,
|
|
762
|
+
jobRunSchema: () => jobRunSchema,
|
|
763
|
+
jobRunStartedSchema: () => jobRunStartedSchema,
|
|
764
|
+
jobRunsListSchema: () => jobRunsListSchema,
|
|
765
|
+
jobSchema: () => jobSchema,
|
|
766
|
+
jobTriggerSchema: () => jobTriggerSchema,
|
|
767
|
+
jobsFileSchema: () => jobsFileSchema,
|
|
768
|
+
jobsListSchema: () => jobsListSchema,
|
|
136
769
|
logBufferLinesSchema: () => logBufferLinesSchema,
|
|
137
770
|
logHistoryQuerySchema: () => logHistoryQuerySchema,
|
|
771
|
+
logHistoryViewSchema: () => logHistoryViewSchema,
|
|
772
|
+
logLineSchema: () => logLineSchema,
|
|
138
773
|
logLinesResponseSchema: () => logLinesResponseSchema,
|
|
774
|
+
logPageQuerySchema: () => logPageQuerySchema,
|
|
139
775
|
logQuerySchema: () => logQuerySchema,
|
|
140
776
|
logServersViewSchema: () => logServersViewSchema,
|
|
141
777
|
logStreamSchema: () => logStreamSchema,
|
|
142
778
|
loginSchema: () => loginSchema,
|
|
143
779
|
logsSchema: () => logsSchema,
|
|
780
|
+
metaViewSchema: () => metaViewSchema,
|
|
144
781
|
nannySpecSchema: () => nannySpecSchema,
|
|
145
782
|
nannyStateSchema: () => nannyStateSchema,
|
|
783
|
+
newWorkspaceIdSchema: () => newWorkspaceIdSchema,
|
|
146
784
|
notificationActionSchema: () => notificationActionSchema,
|
|
147
785
|
notificationDefaultsSchema: () => notificationDefaultsSchema,
|
|
148
786
|
notificationsSchema: () => notificationsSchema,
|
|
149
787
|
okResponseSchema: () => okResponseSchema,
|
|
150
788
|
onPortConflictSchema: () => onPortConflictSchema,
|
|
151
789
|
parseBind: () => parseBind,
|
|
152
|
-
passwordSchema: () => passwordSchema,
|
|
153
|
-
passwordSetResponseSchema: () => passwordSetResponseSchema,
|
|
154
790
|
passwordValueSchema: () => passwordValueSchema,
|
|
155
791
|
portSchema: () => portSchema,
|
|
156
792
|
proxyCertificateSchema: () => proxyCertificateSchema,
|
|
@@ -168,15 +804,26 @@ var contracts_exports = /* @__PURE__ */ __exportAll({
|
|
|
168
804
|
restorePlanSchema: () => restorePlanSchema,
|
|
169
805
|
restoreRequestSchema: () => restoreRequestSchema,
|
|
170
806
|
restoreSkipSchema: () => restoreSkipSchema,
|
|
807
|
+
scopeInfoSchema: () => scopeInfoSchema,
|
|
808
|
+
secretEnvNameSchema: () => secretEnvNameSchema,
|
|
809
|
+
secretEnvNamesSchema: () => secretEnvNamesSchema,
|
|
171
810
|
serverCreateSchema: () => serverCreateSchema,
|
|
172
811
|
serverPatchSchema: () => serverPatchSchema,
|
|
173
812
|
serverSchema: () => serverSchema,
|
|
813
|
+
serverSecretsSchema: () => serverSecretsSchema,
|
|
174
814
|
serverStatusSchema: () => serverStatusSchema,
|
|
175
815
|
serverViewSchema: () => serverViewSchema,
|
|
816
|
+
serverWriteResponseSchema: () => serverWriteResponseSchema,
|
|
176
817
|
sessionViewSchema: () => sessionViewSchema,
|
|
177
818
|
settingsPatchSchema: () => settingsPatchSchema,
|
|
178
819
|
settingsSavedSchema: () => settingsSavedSchema,
|
|
179
820
|
settingsViewSchema: () => settingsViewSchema,
|
|
821
|
+
sseEventNames: () => sseEventNames,
|
|
822
|
+
sseLogFrameSchema: () => sseLogFrameSchema,
|
|
823
|
+
sseMessageSchema: () => sseMessageSchema,
|
|
824
|
+
ssePingFrameSchema: () => ssePingFrameSchema,
|
|
825
|
+
sseServerFrameSchema: () => sseServerFrameSchema,
|
|
826
|
+
sseStateFrameSchema: () => sseStateFrameSchema,
|
|
180
827
|
stopSchema: () => stopSchema,
|
|
181
828
|
telegramChatsSchema: () => telegramChatsSchema,
|
|
182
829
|
telegramTokenSchema: () => telegramTokenSchema,
|
|
@@ -196,43 +843,30 @@ var contracts_exports = /* @__PURE__ */ __exportAll({
|
|
|
196
843
|
workspaceViewSchema: () => workspaceViewSchema,
|
|
197
844
|
wslTemperatureSchema: () => wslTemperatureSchema
|
|
198
845
|
});
|
|
199
|
-
/**
|
|
200
|
-
* Schemas shared by the control plane and the SPA: the server entry shape, the
|
|
201
|
-
* control panel's own settings, API DTOs and SSE frames. Nothing here knows
|
|
202
|
-
* about a particular server — an entry carries its own command, args, env and
|
|
203
|
-
* bootstrap.
|
|
204
|
-
*/
|
|
846
|
+
/** Schemas shared by the control plane and the UIs: server entries, panel settings, API DTOs, SSE frames. */
|
|
205
847
|
/** `local` -> 127.0.0.1, `lan` -> 0.0.0.0, or an explicit IPv4 to bind. */
|
|
206
848
|
var bindSchema = lazy(() => type("\"local\" | \"lan\" | /^\\d{1,3}(?:\\.\\d{1,3}){3}$/"));
|
|
207
|
-
/**
|
|
208
|
-
* A top-level unit: its own settings, servers, secrets, logs and nanny state
|
|
209
|
-
* under `$HHOSTED_HOME/.hh/<id>/`. The id is the directory name and never
|
|
210
|
-
* changes; the label is what a person reads and may rename at will.
|
|
211
|
-
*/
|
|
849
|
+
/** A workspace id is its directory under `.hh/` and never changes; the label may be renamed. */
|
|
212
850
|
var workspaceIdSchema = lazy(() => type("/^[a-z0-9][a-z0-9_-]*$/"));
|
|
851
|
+
/** A new workspace id: at most 40 chars, never a Windows device name. Separate so older, longer ids still load. */
|
|
852
|
+
var newWorkspaceIdSchema = lazy(() => type(/^(?!(?:con|prn|aux|nul|com[1-9]|lpt[1-9])$)[a-z0-9][a-z0-9_-]{0,39}$/).describe("a lowercase id of at most 40 letters, digits, - or _, starting with a letter or digit, and not a Windows device name (con, prn, aux, nul, com1-9, lpt1-9)"));
|
|
213
853
|
var workspaceSchema = lazy(() => type({
|
|
214
854
|
id: workspaceIdSchema,
|
|
215
855
|
label: "1 <= string <= 60"
|
|
216
856
|
}).onUndeclaredKey("reject"));
|
|
217
857
|
/** `id` is optional; when omitted it is derived from the label. */
|
|
218
858
|
var workspaceCreateSchema = lazy(() => type({
|
|
219
|
-
"id?":
|
|
859
|
+
"id?": newWorkspaceIdSchema,
|
|
220
860
|
"label?": "1 <= string <= 60"
|
|
221
861
|
}).onUndeclaredKey("reject"));
|
|
222
862
|
var workspaceRenameSchema = lazy(() => type({ label: "1 <= string <= 60" }).onUndeclaredKey("reject"));
|
|
223
|
-
/** Parses a bind value (`local` | `lan` | ipv4); null when it is not one. */
|
|
224
863
|
function parseBind(value) {
|
|
225
864
|
const parsed = bindSchema(value);
|
|
226
865
|
return parsed instanceof type.errors ? null : parsed;
|
|
227
866
|
}
|
|
228
867
|
/** `null` means "no port": no readiness probe, no health supervision, no preflight. */
|
|
229
868
|
var portSchema = lazy(() => type("1 <= number.integer <= 65535 | null"));
|
|
230
|
-
/**
|
|
231
|
-
* What to do when something already listens on the entry's port. `follow` and
|
|
232
|
-
* `reclaim` only ever act on a holder proven to be this entry's own detached
|
|
233
|
-
* successor (the `HHOSTED_SERVER_ID` marker, POSIX only); `kill` is the blunt one:
|
|
234
|
-
* it stops any holder except the panel's own process tree.
|
|
235
|
-
*/
|
|
869
|
+
/** `follow`/`reclaim` act only on this entry's own detached successor (POSIX); `kill` stops any holder outside the panel's tree. */
|
|
236
870
|
var onPortConflictSchema = lazy(() => type.enumerated("block", "warn", "follow", "reclaim", "kill"));
|
|
237
871
|
var restartSchema = lazy(() => type({
|
|
238
872
|
enabled: "boolean = true",
|
|
@@ -246,18 +880,15 @@ var restartSchema = lazy(() => type({
|
|
|
246
880
|
var httpCheckSchema = lazy(() => type({
|
|
247
881
|
/** `https` is for a backend that serves TLS itself; pair it with `allowInvalidCert` when it is self-signed. */
|
|
248
882
|
scheme: "\"http\" | \"https\" = \"http\"",
|
|
249
|
-
/** Accept any certificate
|
|
883
|
+
/** Accept any certificate: self-signed is the normal case, and the probe is local. */
|
|
250
884
|
allowInvalidCert: "boolean = false",
|
|
251
|
-
/** Path on the server's own port, e.g. `/healthz`. */
|
|
252
885
|
path: "string = \"/\"",
|
|
253
886
|
method: "\"GET\" | \"HEAD\" = \"GET\"",
|
|
254
|
-
/** Exact status to accept; `null`
|
|
255
|
-
expectStatus: "number.integer | null?",
|
|
256
|
-
expectStatusBelow: "number.integer = 400",
|
|
257
|
-
/** Substring that must appear in the response body. */
|
|
887
|
+
/** Exact status to accept; `null` or omitted means any status below `expectStatusBelow`. */
|
|
888
|
+
expectStatus: "100 <= number.integer <= 599 | null?",
|
|
889
|
+
expectStatusBelow: "101 <= number.integer <= 600 = 400",
|
|
258
890
|
expectBody: "string = \"\""
|
|
259
891
|
}).onUndeclaredKey("reject"));
|
|
260
|
-
/** Restart guards for the process tree. */
|
|
261
892
|
var resourcesSchema = lazy(() => type({
|
|
262
893
|
/** Restart when the tree's RSS exceeds this; 0 disables. */
|
|
263
894
|
maxRssBytes: "number.integer >= 0 = 0" }).onUndeclaredKey("reject"));
|
|
@@ -272,7 +903,6 @@ var healthSchema = lazy(() => type({
|
|
|
272
903
|
unhealthyThreshold: "number.integer >= 1 = 3",
|
|
273
904
|
/** 0 disables it; otherwise a port stuck unhealthy this long forces a restart. */
|
|
274
905
|
forceRestartAfterMs: "number >= 0 = 0",
|
|
275
|
-
/** How long to wait for the port to accept connections after spawn. */
|
|
276
906
|
startTimeoutMs: "number >= 0 = 20000"
|
|
277
907
|
}).onUndeclaredKey("reject"));
|
|
278
908
|
var stopSchema = lazy(() => type({
|
|
@@ -282,6 +912,37 @@ var stopSchema = lazy(() => type({
|
|
|
282
912
|
/** Last resort for wrappers that detach their real server. */
|
|
283
913
|
killPortHolders: "boolean = false"
|
|
284
914
|
}).onUndeclaredKey("reject"));
|
|
915
|
+
/** One deploy step. `cwd` resolves against the entry's own working directory; absent means that directory. */
|
|
916
|
+
var deployStepSchema = lazy(() => type({
|
|
917
|
+
"command": "string >= 1",
|
|
918
|
+
"args": type("string[]").default(() => []),
|
|
919
|
+
"cwd?": "string",
|
|
920
|
+
"timeoutMs": "number >= 1000 = 300000"
|
|
921
|
+
}).onUndeclaredKey("reject"));
|
|
922
|
+
/** Ordered steps, then a restart. A failed step stops the deploy and keeps the old process running. */
|
|
923
|
+
var deploySchema = lazy(() => type({
|
|
924
|
+
steps: deployStepSchema.array().atLeastLength(1),
|
|
925
|
+
restart: "boolean = true"
|
|
926
|
+
}).onUndeclaredKey("reject"));
|
|
927
|
+
/** Patch form of `deploy`: no defaults, because the group is replaced whole and a default would re-arm an untouched deploy. */
|
|
928
|
+
var deployStepPatchSchema = lazy(() => type({
|
|
929
|
+
"command": "string >= 1?",
|
|
930
|
+
"args": "string[]?",
|
|
931
|
+
"cwd?": "string",
|
|
932
|
+
"timeoutMs": "number >= 1000?"
|
|
933
|
+
}).onUndeclaredKey("reject"));
|
|
934
|
+
var deployPatchSchema = lazy(() => type({
|
|
935
|
+
"steps?": deployStepPatchSchema.array(),
|
|
936
|
+
"restart?": "boolean"
|
|
937
|
+
}).onUndeclaredKey("reject"));
|
|
938
|
+
var deployOrNullSchema = lazy(() => deploySchema.or(type("null")));
|
|
939
|
+
var deployPatchOrNullSchema = lazy(() => deployPatchSchema.or(type("null")));
|
|
940
|
+
var deployStatusSchema = lazy(() => type({
|
|
941
|
+
"running": "boolean",
|
|
942
|
+
"lastAt?": "number",
|
|
943
|
+
"lastOutcome?": "\"ok\" | \"failed\"",
|
|
944
|
+
"lastError?": "string"
|
|
945
|
+
}));
|
|
285
946
|
var bootstrapSchema = lazy(() => type({
|
|
286
947
|
command: "string",
|
|
287
948
|
args: type("string[]").default(() => []),
|
|
@@ -291,18 +952,7 @@ var bootstrapSchema = lazy(() => type({
|
|
|
291
952
|
runOnce: "boolean = true"
|
|
292
953
|
}).onUndeclaredKey("reject"));
|
|
293
954
|
var bootstrapOrNullSchema = lazy(() => bootstrapSchema.or(type("null")));
|
|
294
|
-
/**
|
|
295
|
-
* The `bootstrap` group as a patch carries it: every field optional, and **no defaults**.
|
|
296
|
-
*
|
|
297
|
-
* A patch must not fill a default in (`AGENTS.md`), and it could not here for a second reason.
|
|
298
|
-
* `bootstrap` is not in `SERVER_MERGE_KEYS`, so `applyPatch` **replaces** the whole group; the
|
|
299
|
-
* defaults on `bootstrapSchema` used to arrive with the patch, so sending one changed field
|
|
300
|
-
* wrote a group with the other four reset. Measured on `PATCH /api/servers/db` with
|
|
301
|
-
* `{"bootstrap":{"command":"next.sh"}}`: stored `args: ["--ci"]` became `[]`, `runOnce: false`
|
|
302
|
-
* became `true` — re-arming a one-shot bootstrap to run on every `up` — and `timeoutMs: 5000`
|
|
303
|
-
* became `120000`. The group is still replaced, so a caller sends the fields it means to keep;
|
|
304
|
-
* what changes is that the panel no longer invents the ones it did not send.
|
|
305
|
-
*/
|
|
955
|
+
/** Patch form of `bootstrap`: no defaults, because the group is replaced whole (not in `SERVER_MERGE_KEYS`). */
|
|
306
956
|
var bootstrapPatchSchema = lazy(() => type({
|
|
307
957
|
command: "string >= 1?",
|
|
308
958
|
args: "string[]?",
|
|
@@ -312,40 +962,19 @@ var bootstrapPatchSchema = lazy(() => type({
|
|
|
312
962
|
}).onUndeclaredKey("reject"));
|
|
313
963
|
var bootstrapPatchOrNullSchema = lazy(() => bootstrapPatchSchema.or(type("null")));
|
|
314
964
|
/**
|
|
315
|
-
* A command run around a backup, for engines that need
|
|
316
|
-
*
|
|
317
|
-
* `mongodump` is the reason this exists: copying `dbPath` while the server writes gives a torn copy,
|
|
318
|
-
* and a dump taken by the engine is the only supported way. Same shape as `bootstrap` — one program
|
|
319
|
-
* and its args, never a command line — and the same rule that the panel never guesses what an engine
|
|
320
|
-
* needs.
|
|
321
|
-
*
|
|
322
|
-
* `{dumpDir}` is created before `dump` runs and captured by the archive; on restore the same
|
|
323
|
-
* directory is filled again before `load` runs, so the two hooks see the same path.
|
|
965
|
+
* A command run around a backup, for engines that need it for a consistent copy (e.g. `mongodump`).
|
|
966
|
+
* `{dumpDir}` is created before `dump` and refilled before `load`, so both hooks see one path.
|
|
324
967
|
*/
|
|
325
968
|
var backupHookSchema = lazy(() => type({
|
|
326
969
|
command: "string >= 1",
|
|
327
970
|
args: type("string[]").default(() => []),
|
|
328
971
|
env: type("Record<string, string>").default(() => ({})),
|
|
329
972
|
timeoutMs: "number >= 1000 = 600000",
|
|
330
|
-
/**
|
|
331
|
-
* How long to wait for the entry to answer before running a `load`.
|
|
332
|
-
*
|
|
333
|
-
* Only matters for `load`, and only for an entry with no `port`: the wait is normally "the port
|
|
334
|
-
* accepts a connection", which an entry that declares no port cannot offer. Two seconds by
|
|
335
|
-
* default, because a portless entry usually starts fast and a fixed wait is pure delay; a slow
|
|
336
|
-
* database reached over a socket should raise it.
|
|
337
|
-
*/
|
|
973
|
+
/** `load` only, for an entry with no `port`: how long to wait for it to answer first. */
|
|
338
974
|
waitMs: "number >= 0 = 2000"
|
|
339
975
|
}).onUndeclaredKey("reject"));
|
|
340
976
|
var backupHookOrNullSchema = lazy(() => backupHookSchema.or(type("null")));
|
|
341
|
-
/**
|
|
342
|
-
* The `dump`/`load` group as a patch carries it: every field optional, and **no defaults**.
|
|
343
|
-
*
|
|
344
|
-
* The same defect `bootstrapPatchSchema` exists for, in the same `editableFields`: both hooks are
|
|
345
|
-
* replaced rather than merged, so the group's defaults used to arrive with a one-field edit and
|
|
346
|
-
* reset `args`, `env`, `timeoutMs` and `waitMs` to values nobody sent. `waitMs` is the one that
|
|
347
|
-
* bites hardest — a `load` waiting on a slow database would silently drop back to 2 s.
|
|
348
|
-
*/
|
|
977
|
+
/** Patch form of `dump`/`load`: no defaults, because both hooks are replaced whole. */
|
|
349
978
|
var backupHookPatchSchema = lazy(() => type({
|
|
350
979
|
command: "string >= 1?",
|
|
351
980
|
args: "string[]?",
|
|
@@ -354,44 +983,184 @@ var backupHookPatchSchema = lazy(() => type({
|
|
|
354
983
|
waitMs: "number >= 0?"
|
|
355
984
|
}).onUndeclaredKey("reject"));
|
|
356
985
|
var backupHookPatchOrNullSchema = lazy(() => backupHookPatchSchema.or(type("null")));
|
|
357
|
-
/**
|
|
358
|
-
* A label that may be written as `null`, which means "no label" — the same spelling `port` and
|
|
359
|
-
* `bootstrap` already accept in a file.
|
|
360
|
-
*
|
|
361
|
-
* `serverSchema.label` was `'string?'`, so a hand-edited `"label": null` refused the **whole config** with
|
|
362
|
-
* `servers[0] ("web"): label must be a string (was null)`. The write side already tolerates `null`, and every
|
|
363
|
-
* display falls back with `label ?? id` — which `null` satisfies and `''` does not.
|
|
364
|
-
*/
|
|
986
|
+
/** `null` means no label; displays fall back with `label ?? id`. */
|
|
365
987
|
var labelOrNullSchema = lazy(() => type("string | null"));
|
|
366
988
|
var logBufferLinesSchema = lazy(() => type("50 <= number.integer <= 100000"));
|
|
989
|
+
/** An environment-variable name every shell and OS accepts. */
|
|
990
|
+
var secretEnvNameSchema = lazy(() => type("/^[A-Za-z_][A-Za-z0-9_]*$/").describe("an environment-variable name: a letter or underscore, then letters, digits or underscores"));
|
|
991
|
+
/** Secret env var names, unique; the values live in the workspace's `.secrets.json`, never in a config. */
|
|
992
|
+
var secretEnvNamesSchema = lazy(() => type(secretEnvNameSchema.array()));
|
|
993
|
+
/** Uniqueness is checked here, not by a schema narrow, so the schema still renders to JSON Schema. */
|
|
994
|
+
function duplicateSecretEnvNames(names) {
|
|
995
|
+
const seen = /* @__PURE__ */ new Set();
|
|
996
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
997
|
+
for (const name of names) {
|
|
998
|
+
if (seen.has(name)) duplicates.add(name);
|
|
999
|
+
seen.add(name);
|
|
1000
|
+
}
|
|
1001
|
+
return [...duplicates];
|
|
1002
|
+
}
|
|
1003
|
+
/** Only the shape (exactly five fields); `cronProblem()` checks the contents at every write. */
|
|
1004
|
+
var cronExpressionSchema = lazy(() => type(/^\S+(?: +\S+){4}$/).describe("a 5-field cron expression (minute hour day-of-month month day-of-week); no seconds field, no @macros"));
|
|
1005
|
+
/** The refusal for a servers entry that still carries a job field (`kind`/`schedule`); `null` when it carries neither. */
|
|
1006
|
+
function entryHasJobFields(entry, command) {
|
|
1007
|
+
const hasKind = typeof entry.kind === "string";
|
|
1008
|
+
const hasSchedule = typeof entry.schedule === "string";
|
|
1009
|
+
if (!hasKind && !hasSchedule) return null;
|
|
1010
|
+
const migrate = command === void 0 ? "the migrate command" : `\`${command} migrate\``;
|
|
1011
|
+
if (entry.kind === "job") return `this entry is a \`job\`, which now lives in jobs.config.json — run ${migrate} to move it, then remove \`kind\`/\`schedule\` here`;
|
|
1012
|
+
return `\`kind\` and \`schedule\` belong to a job now, not a server — remove them (a server is always a supervised service), or run ${migrate} if this entry is a job`;
|
|
1013
|
+
}
|
|
1014
|
+
/** The longest one run may take: a day. Bounds a hung script, not a slow backup. */
|
|
1015
|
+
var JOB_TIMEOUT_MAX_SECONDS = 86400;
|
|
1016
|
+
/** A short-lived command on a cron schedule; it has no `port`, `health`, `restart` or `persistent`. */
|
|
1017
|
+
var jobSchema = lazy(() => type({
|
|
1018
|
+
"id": "/^[a-z0-9][a-z0-9_-]*$/",
|
|
1019
|
+
"label?": labelOrNullSchema,
|
|
1020
|
+
"description?": "string",
|
|
1021
|
+
"enabled": "boolean = true",
|
|
1022
|
+
"command": "string >= 1",
|
|
1023
|
+
"args": type("string[]").default(() => []),
|
|
1024
|
+
"cwd": "string = \".\"",
|
|
1025
|
+
"env": type("Record<string, string>").default(() => ({})),
|
|
1026
|
+
"secretEnv": secretEnvNamesSchema.default(() => []),
|
|
1027
|
+
/** 5-field cron expression, in the host's local timezone. */
|
|
1028
|
+
"schedule": cronExpressionSchema,
|
|
1029
|
+
/** How long one run may take before the panel ends it, in seconds. */
|
|
1030
|
+
"timeoutSeconds": type("1 <= number.integer <= 86400").default(3600),
|
|
1031
|
+
/** Run a missed occurrence once when the panel starts (the most recent one only). */
|
|
1032
|
+
"catchUp": "boolean = true"
|
|
1033
|
+
}).onUndeclaredKey("reject"));
|
|
1034
|
+
/** A workspace's jobs file; `jobs: []` is the normal state of a workspace with no jobs. */
|
|
1035
|
+
var jobsFileSchema = lazy(() => type({
|
|
1036
|
+
"meta?": type({
|
|
1037
|
+
"writtenBy?": "string",
|
|
1038
|
+
"schema?": "number"
|
|
1039
|
+
}),
|
|
1040
|
+
"jobs": jobSchema.array()
|
|
1041
|
+
}).onUndeclaredKey("reject"));
|
|
1042
|
+
/** What started a run: its schedule, a person or client, or the boot catch-up of a missed occurrence. */
|
|
1043
|
+
var jobTriggerSchema = lazy(() => type("\"schedule\" | \"manual\" | \"catch-up\""));
|
|
1044
|
+
/**
|
|
1045
|
+
* How a run ended. `timeout` is the panel ending it at `timeoutSeconds`, `cancelled` a stop,
|
|
1046
|
+
* `spawn-error` a command that never started, `interrupted` a run the panel stopped watching because
|
|
1047
|
+
* it exited mid-run. `running` only on the run in flight.
|
|
1048
|
+
*/
|
|
1049
|
+
var jobOutcomeSchema = lazy(() => type("\"running\" | \"ok\" | \"failed\" | \"timeout\" | \"cancelled\" | \"spawn-error\" | \"interrupted\""));
|
|
1050
|
+
/** One run, as the job's durable run ledger keeps it. */
|
|
1051
|
+
var jobRunSchema = lazy(() => type({
|
|
1052
|
+
"runId": "string",
|
|
1053
|
+
"trigger": jobTriggerSchema,
|
|
1054
|
+
/** The occurrence a scheduled or catch-up run was for, epoch ms. */
|
|
1055
|
+
"scheduledFor?": "number",
|
|
1056
|
+
"startedAt": "number",
|
|
1057
|
+
"endedAt": "number | null",
|
|
1058
|
+
"outcome": jobOutcomeSchema,
|
|
1059
|
+
"exitCode": "number | null",
|
|
1060
|
+
"signal": "string | null",
|
|
1061
|
+
/** Why a `spawn-error` run never started. */
|
|
1062
|
+
"error?": "string"
|
|
1063
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
1064
|
+
var jobEntryViewSchema = lazy(() => type({
|
|
1065
|
+
"id": "string",
|
|
1066
|
+
"label?": "string",
|
|
1067
|
+
"description?": "string",
|
|
1068
|
+
"enabled": "boolean",
|
|
1069
|
+
"command": "string",
|
|
1070
|
+
"args": "string[]",
|
|
1071
|
+
"schedule": "string",
|
|
1072
|
+
/** The next time this will run, epoch ms — `null` when disabled, broken, or the expression cannot occur. */
|
|
1073
|
+
"nextRunAt?": "number | null",
|
|
1074
|
+
"running": "boolean",
|
|
1075
|
+
/** The run in flight. */
|
|
1076
|
+
"current?": type({
|
|
1077
|
+
runId: "string",
|
|
1078
|
+
startedAt: "number",
|
|
1079
|
+
trigger: jobTriggerSchema
|
|
1080
|
+
}).onUndeclaredKey("ignore"),
|
|
1081
|
+
/** The latest finished run. */
|
|
1082
|
+
"last?": type({
|
|
1083
|
+
runId: "string",
|
|
1084
|
+
outcome: jobOutcomeSchema,
|
|
1085
|
+
exitCode: "number | null",
|
|
1086
|
+
signal: "string | null",
|
|
1087
|
+
startedAt: "number",
|
|
1088
|
+
endedAt: "number",
|
|
1089
|
+
durationMs: "number"
|
|
1090
|
+
}).onUndeclaredKey("ignore"),
|
|
1091
|
+
/** Why this entry of the jobs file cannot run; the rest of the file still does. */
|
|
1092
|
+
"problem?": "string",
|
|
1093
|
+
/** For older clients: the same facts as `last.endedAt` and `last.exitCode`. */
|
|
1094
|
+
"lastRunAt?": "number",
|
|
1095
|
+
"lastExitCode?": "number | null",
|
|
1096
|
+
/** The job's JSONL log in the workspace's `jobs/` log directory. */
|
|
1097
|
+
"logPath?": "string",
|
|
1098
|
+
/** Declared secret env names; `secretEnvSet` says which have a stored value. Values never travel. */
|
|
1099
|
+
"secretEnv?": "string[]",
|
|
1100
|
+
"secretEnvSet?": "string[]",
|
|
1101
|
+
"timeoutSeconds?": "number",
|
|
1102
|
+
"catchUp?": "boolean",
|
|
1103
|
+
"cwd?": "string",
|
|
1104
|
+
"env?": "Record<string, string>"
|
|
1105
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
1106
|
+
var jobsListSchema = lazy(() => type({
|
|
1107
|
+
"jobs": jobEntryViewSchema.array(),
|
|
1108
|
+
/** Why the jobs file as a whole cannot be read; none of its jobs run until it is fixed. */
|
|
1109
|
+
"fileError?": "string"
|
|
1110
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
1111
|
+
/** Creating a job. Everything the schema defaults is omittable; the schedule is not. */
|
|
1112
|
+
var jobCreateSchema = lazy(() => type({
|
|
1113
|
+
"id": "/^[a-z0-9][a-z0-9_-]*$/",
|
|
1114
|
+
"label?": labelOrNullSchema,
|
|
1115
|
+
"description?": "string",
|
|
1116
|
+
"enabled?": "boolean",
|
|
1117
|
+
"command": "string >= 1",
|
|
1118
|
+
"args?": "string[]",
|
|
1119
|
+
"cwd?": "string",
|
|
1120
|
+
"env?": "Record<string, string>",
|
|
1121
|
+
"secretEnv?": "string[]",
|
|
1122
|
+
"schedule": cronExpressionSchema,
|
|
1123
|
+
"timeoutSeconds?": "1 <= number.integer <= 86400",
|
|
1124
|
+
"catchUp?": "boolean"
|
|
1125
|
+
}).onUndeclaredKey("reject"));
|
|
1126
|
+
/** Hand-written, never `.partial()`: a derived patch would carry the defaults. `null` clears a label or description. */
|
|
1127
|
+
var jobPatchSchema = lazy(() => type({
|
|
1128
|
+
"label?": labelOrNullSchema.or(type("null")),
|
|
1129
|
+
"description?": "string | null",
|
|
1130
|
+
"enabled?": "boolean",
|
|
1131
|
+
"command?": "string >= 1",
|
|
1132
|
+
"args?": "string[]",
|
|
1133
|
+
"cwd?": "string",
|
|
1134
|
+
"env?": "Record<string, string>",
|
|
1135
|
+
"secretEnv?": "string[]",
|
|
1136
|
+
"schedule?": cronExpressionSchema,
|
|
1137
|
+
"timeoutSeconds?": "1 <= number.integer <= 86400",
|
|
1138
|
+
"catchUp?": "boolean"
|
|
1139
|
+
}).onUndeclaredKey("reject"));
|
|
1140
|
+
/** `POST /api/jobs/:id/run`: the run started (`202`), or, waited for, how it ended (`200`). */
|
|
1141
|
+
var jobRunStartedSchema = lazy(() => type({
|
|
1142
|
+
"runId": "string",
|
|
1143
|
+
/** Present once the run has ended. */
|
|
1144
|
+
"run?": jobRunSchema
|
|
1145
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
1146
|
+
var jobRunsListSchema = lazy(() => type({ runs: jobRunSchema.array() }).onDeepUndeclaredKey("ignore"));
|
|
367
1147
|
var serverSchema = lazy(() => type({
|
|
368
1148
|
id: "/^[a-z0-9][a-z0-9_-]*$/",
|
|
369
1149
|
label: labelOrNullSchema.optional(),
|
|
370
1150
|
enabled: "boolean = true",
|
|
371
1151
|
autostart: "boolean = false",
|
|
372
|
-
/**
|
|
373
|
-
* Handed to a nanny process that owns the pipes, so the entry keeps running when
|
|
374
|
-
* this panel stops, restarts or is killed. `down`/`stop-all` leave it alone and
|
|
375
|
-
* report it; only an explicit stop or restart stops it.
|
|
376
|
-
*/
|
|
1152
|
+
/** Owned by a nanny process, so it survives the panel stopping; only an explicit stop or restart ends it. */
|
|
377
1153
|
persistent: "boolean = false",
|
|
378
1154
|
command: "string >= 1",
|
|
379
1155
|
args: type("string[]").default(() => []),
|
|
380
1156
|
cwd: "string = \".\"",
|
|
381
1157
|
env: type("Record<string, string>").default(() => ({})),
|
|
382
|
-
/**
|
|
383
|
-
* `ENV=path` pairs: exported to the process (overriding `env`) *and* the path
|
|
384
|
-
* is backed up automatically — one declaration for data directories.
|
|
385
|
-
*/
|
|
1158
|
+
/** `ENV=path` pairs: exported to the process (overriding `env`) and backed up automatically. */
|
|
386
1159
|
dataEnvs: type("Record<string, string>").default(() => ({})),
|
|
387
1160
|
bootstrap: bootstrapOrNullSchema.optional(),
|
|
388
|
-
/**
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
* For a database: `mongodump --archive={dumpDir}/db.archive`. A failed dump **refuses the backup**
|
|
392
|
-
* rather than archiving a stale directory next to it — the whole point is that the dump is the
|
|
393
|
-
* authoritative copy.
|
|
394
|
-
*/
|
|
1161
|
+
/** Absent means no deploy action (`POST /api/servers/:id/deploy` answers `400 NO_DEPLOY`). */
|
|
1162
|
+
deploy: deployOrNullSchema.optional(),
|
|
1163
|
+
/** Run before this entry's data is captured, writing into `{dumpDir}`; a failed dump refuses the backup. */
|
|
395
1164
|
dump: backupHookOrNullSchema.optional(),
|
|
396
1165
|
/** Run after this entry's data is restored, reading from `{dumpDir}`. Its server is stopped first. */
|
|
397
1166
|
load: backupHookOrNullSchema.optional(),
|
|
@@ -407,349 +1176,121 @@ var serverSchema = lazy(() => type({
|
|
|
407
1176
|
/** Optional KEY=value file loaded at spawn; its values override `env`. */
|
|
408
1177
|
envFile: "string = \"\"",
|
|
409
1178
|
resources: resourcesSchema.default(() => ({})),
|
|
410
|
-
/** Paths included in backups for this server (templates allowed). */
|
|
411
1179
|
backupPaths: type("string[]").default(() => []),
|
|
412
|
-
/**
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
*/
|
|
416
|
-
backupIgnoreGenerated: "boolean = true"
|
|
1180
|
+
/** Skip build output and dependency directories (`node_modules`, `dist`, caches, …) inside declared paths. */
|
|
1181
|
+
backupIgnoreGenerated: "boolean = true",
|
|
1182
|
+
secretEnv: secretEnvNamesSchema.default(() => [])
|
|
417
1183
|
}).onUndeclaredKey("reject"));
|
|
418
|
-
/**
|
|
419
|
-
* Authentication for the control panel itself. The password never lives here —
|
|
420
|
-
* only the policy does; its scrypt hash sits in a git-ignored secrets file.
|
|
421
|
-
*/
|
|
1184
|
+
/** Panel authentication policy; the password's scrypt hash lives in the secrets file, never here. */
|
|
422
1185
|
var authSchema = lazy(() => type({
|
|
423
1186
|
enabled: "boolean = true",
|
|
424
1187
|
/** Idle timeout: a session dies this long after its **last** request, not after login. */
|
|
425
1188
|
sessionTtlMs: "number >= 60000 = 604800000",
|
|
426
1189
|
/** `auto` adds `Secure` when the request arrived over https (proxy-aware). */
|
|
427
1190
|
cookieSecure: "\"auto\" | \"always\" | \"never\" = \"auto\"",
|
|
428
|
-
/** Trust `x-forwarded-*` from a reverse proxy; also drives the client IP. */
|
|
429
|
-
trustProxy: "boolean | \"loopback\" = \"loopback\"",
|
|
430
|
-
maxLoginAttempts: "number.integer >= 1 = 5",
|
|
431
|
-
lockoutMs: "number >= 1000 = 60000"
|
|
432
|
-
}).onUndeclaredKey("reject"));
|
|
433
|
-
/**
|
|
434
|
-
* The event toggles and the throttle — the part a target may **inherit** instead of setting.
|
|
435
|
-
*
|
|
436
|
-
* `enabled` is deliberately not here: "send to this one" is a property of the target, never
|
|
437
|
-
* something to inherit. Everything else answers the same question for every transport, and one
|
|
438
|
-
* definition means a fourth cannot quietly spell `onRecovered` differently.
|
|
439
|
-
*/
|
|
440
|
-
var notificationPolicyShape = {
|
|
441
|
-
onCrash: "boolean = true",
|
|
442
|
-
onUnhealthy: "boolean = true",
|
|
443
|
-
onForcedRestart: "boolean = true",
|
|
444
|
-
onRecovered: "boolean = false",
|
|
445
|
-
/** Host vitals breaches (disk, memory, swap, load, temperature). */
|
|
446
|
-
onHost: "boolean = true",
|
|
447
|
-
/** Dynamic DNS changes and failures. */
|
|
448
|
-
onDdns: "boolean = true",
|
|
449
|
-
/** Per server *and* reason, so a flapping server cannot spam the chat. */
|
|
450
|
-
cooldownMs: "number >= 0 = 120000"
|
|
451
|
-
};
|
|
452
|
-
/**
|
|
453
|
-
* The general settings: what applies to every target that does not override it.
|
|
454
|
-
*
|
|
455
|
-
* The point of the block is that the common case — "tell me about crashes and host thresholds,
|
|
456
|
-
* throttled every two minutes" — is set **once**, instead of once per transport and again per
|
|
457
|
-
* destination.
|
|
458
|
-
*/
|
|
459
|
-
var notificationDefaultsSchema = lazy(() => type({ ...notificationPolicyShape }).onUndeclaredKey("reject"));
|
|
460
|
-
/**
|
|
461
|
-
* The same block **as a response**: tolerant of a key this release does not know.
|
|
462
|
-
*
|
|
463
|
-
* A request schema rejects undeclared keys, a response schema must not — an upgrade writes a new UI
|
|
464
|
-
* while an old panel keeps serving, and a newer panel adding one field here must not blank this
|
|
465
|
-
* build's whole app. Reusing the strict schema in the view did exactly that: one additive key in
|
|
466
|
-
* `defaults` rejected the state frame and the page went blank.
|
|
467
|
-
*/
|
|
468
|
-
var notificationDefaultsViewSchema = lazy(() => type({ ...notificationPolicyShape }));
|
|
469
|
-
/**
|
|
470
|
-
* Whether a target follows the general block or carries its own.
|
|
471
|
-
*
|
|
472
|
-
* **Defaults to `true`**, which is what an existing config means: before this block existed every
|
|
473
|
-
* target carried its own toggles, and reading one as "inherit" would silently change which events
|
|
474
|
-
* it delivers on upgrade. A target the page creates opts *in* to inheritance explicitly, so the
|
|
475
|
-
* new default applies to new targets without rewriting anybody's config.
|
|
476
|
-
*/
|
|
477
|
-
var useOwnSettingsSchema = "boolean = true";
|
|
478
|
-
/**
|
|
479
|
-
* One Telegram destination.
|
|
480
|
-
*
|
|
481
|
-
* `chatId` is config; the bot token is a **secret**, keyed by this target's `id` in the workspace's
|
|
482
|
-
* `.secrets.json`. More than one is allowed, which is why the token cannot be a singleton any more.
|
|
483
|
-
*/
|
|
484
|
-
var telegramDestinationSchema = lazy(() => type({
|
|
485
|
-
kind: "\"telegram\"",
|
|
486
|
-
id: "/^[a-z0-9][a-z0-9_-]*$/",
|
|
487
|
-
/** Off until configured: a bare `enabled: true` with no chat would fail every send. */
|
|
488
|
-
enabled: "boolean = false",
|
|
489
|
-
chatId: "string = \"\"",
|
|
490
|
-
useOwnSettings: useOwnSettingsSchema,
|
|
491
|
-
...notificationPolicyShape
|
|
492
|
-
}).onUndeclaredKey("reject"));
|
|
493
|
-
/**
|
|
494
|
-
* One webhook target: a URL, a method, and the headers to send with it.
|
|
495
|
-
*
|
|
496
|
-
* This is the general transport, and it is a *list* because a home panel alerts more than one
|
|
497
|
-
* place — a phone, a chat channel, a dashboard. The headers are what make it general rather
|
|
498
|
-
* than JSON-only: ntfy wants `Title`/`Priority` headers with a plain-text body, a bearer-token
|
|
499
|
-
* receiver wants `Authorization`, and a JSON receiver wants `content-type`. One shape covers
|
|
500
|
-
* all three; a per-service adapter would be a code change per service.
|
|
501
|
-
*/
|
|
502
|
-
/** One webhook destination. */
|
|
503
|
-
var webhookTargetSchema = lazy(() => type({
|
|
504
|
-
kind: "\"webhook\"",
|
|
505
|
-
id: "/^[a-z0-9][a-z0-9_-]*$/",
|
|
506
|
-
/** Empty only while the target is a draft; the page will not save one without it. */
|
|
507
|
-
url: "string = \"\"",
|
|
508
|
-
enabled: "boolean = true",
|
|
509
|
-
method: "\"POST\" | \"PUT\" = \"POST\"",
|
|
510
|
-
/** Payload format: `json` sends the event as JSON, `text` sends the plain message. */
|
|
511
|
-
format: "\"json\" | \"text\" = \"json\"",
|
|
512
|
-
/**
|
|
513
|
-
* Extra headers, `Name: value` per line. The one field that lets this transport talk to
|
|
514
|
-
* ntfy (`Title`, `Priority`), a bearer-token endpoint (`Authorization`) or anything else
|
|
515
|
-
* with a header-shaped contract.
|
|
516
|
-
*/
|
|
517
|
-
headers: "string = \"\"",
|
|
518
|
-
useOwnSettings: useOwnSettingsSchema,
|
|
519
|
-
...notificationPolicyShape
|
|
520
|
-
}).onUndeclaredKey("reject"));
|
|
521
|
-
/** A destination is one of the kinds this build can deliver to. */
|
|
522
|
-
var notificationTargetSchema = lazy(() => telegramDestinationSchema.or(webhookTargetSchema));
|
|
523
|
-
/**
|
|
524
|
-
* The destination list.
|
|
525
|
-
*
|
|
526
|
-
* `id` is the list key — the cooldown, the last-result record and a Telegram target's token are all
|
|
527
|
-
* keyed by it — so it must be unique across kinds, not just within one. Enforced by
|
|
528
|
-
* `duplicateWebhookIds` at the write; a schema `narrow` cannot be rendered to JSON Schema and every
|
|
529
|
-
* route's `toJsonSchema()` would throw.
|
|
530
|
-
*/
|
|
531
|
-
var destinationListSchema = lazy(() => notificationTargetSchema.array());
|
|
532
|
-
var notificationsSchema = lazy(() => type({
|
|
533
|
-
/** What every destination inherits unless it carries its own settings. */
|
|
534
|
-
defaults: notificationDefaultsSchema.default(() => ({})),
|
|
535
|
-
/** Replaced by a patch, the same way `ddns.accounts` is: a merge cannot express removing one. */
|
|
536
|
-
destinations: destinationListSchema.default(() => [])
|
|
537
|
-
}).onUndeclaredKey("reject"));
|
|
538
|
-
/**
|
|
539
|
-
* The ids that appear more than once, so a write can refuse them.
|
|
540
|
-
*
|
|
541
|
-
* A schema-level check is not available here (see above), and this is the one shape that has to
|
|
542
|
-
* be told apart from a plain validation error: the list is valid, but its identity is not.
|
|
543
|
-
*/
|
|
544
|
-
function duplicateWebhookIds(targets) {
|
|
545
|
-
const seen = /* @__PURE__ */ new Set();
|
|
546
|
-
const duplicates = /* @__PURE__ */ new Set();
|
|
547
|
-
for (const target of targets) {
|
|
548
|
-
if (seen.has(target.id)) duplicates.add(target.id);
|
|
549
|
-
seen.add(target.id);
|
|
550
|
-
}
|
|
551
|
-
return [...duplicates];
|
|
552
|
-
}
|
|
553
|
-
/** On-disk log retention for the Logs page. */
|
|
554
|
-
var logsSchema = lazy(() => type({
|
|
555
|
-
persist: "boolean = true",
|
|
556
|
-
/** Per server, before rotating to `.1`, `.2`, ... */
|
|
557
|
-
maxBytes: "10000 <= number <= 100000000 = 2000000",
|
|
558
|
-
keep: "1 <= number.integer <= 10 = 3"
|
|
559
|
-
}).onUndeclaredKey("reject"));
|
|
560
|
-
var tlsSchema = lazy(() => type({ enabled: "boolean = false" }).onUndeclaredKey("reject"));
|
|
561
|
-
/** Host-level vitals and their alert thresholds. */
|
|
562
|
-
var hostSchema = lazy(() => type({
|
|
563
|
-
enabled: "boolean = true",
|
|
564
|
-
intervalMs: "number >= 5000 = 15000",
|
|
565
|
-
/** Filesystems reported and alerted on; templates and `~` are expanded. */
|
|
566
|
-
diskPaths: type("string[]").default(() => ["."]),
|
|
567
|
-
/**
|
|
568
|
-
* 0 disables an individual alert. Each default is written from `HOST_ALERT_DEFAULTS`, so the
|
|
569
|
-
* number a fresh config gets and the number a surface bands against when a frame carries no
|
|
570
|
-
* threshold are one value — the same one-home rule `loadPerCpu` follows below.
|
|
571
|
-
*/
|
|
572
|
-
diskUsedPercent: `number >= 0 = ${HOST_ALERT_DEFAULTS.diskUsedPercent}`,
|
|
573
|
-
memoryUsedPercent: `number >= 0 = ${HOST_ALERT_DEFAULTS.memoryUsedPercent}`,
|
|
574
|
-
swapUsedPercent: `number >= 0 = ${HOST_ALERT_DEFAULTS.swapUsedPercent}`,
|
|
575
|
-
/**
|
|
576
|
-
* The per-cpu load the panel notifies on. One home: the frame's `loadAlertPerCpu` is this value,
|
|
577
|
-
* and `loadBand` reads it, so a surface cannot band the load against a number nobody configured.
|
|
578
|
-
*/
|
|
579
|
-
loadPerCpu: type("number >= 0").default(2),
|
|
580
|
-
tempCelsius: `number >= 0 = ${HOST_ALERT_DEFAULTS.tempCelsius}`,
|
|
581
|
-
/**
|
|
582
|
-
* How to read the CPU temperature when the kernel exposes no sensor.
|
|
583
|
-
*
|
|
584
|
-
* A command whose stdout is a number in °C — the escape hatch for a machine this panel cannot read
|
|
585
|
-
* for itself (a WSL2 guest, a VM, a board whose hwmon chip is unsupported). Empty means "use the
|
|
586
|
-
* built-in probe". It runs on the sampling interval, so it must be cheap; `docs/SERVERS.md` carries
|
|
587
|
-
* the WSL2 setup.
|
|
588
|
-
*/
|
|
589
|
-
tempCommand: "string <= 512 = \"\"",
|
|
590
|
-
/** How long that command may run before it is killed, so a hung helper cannot stall a sample. */
|
|
591
|
-
tempCommandTimeoutMs: "100 <= number <= 30000 = 5000"
|
|
592
|
-
}).onUndeclaredKey("reject"));
|
|
593
|
-
/** A record family the DDNS engine can point at this host. */
|
|
594
|
-
var ddnsRecordTypeSchema = lazy(() => type.enumerated("A", "AAAA"));
|
|
595
|
-
/**
|
|
596
|
-
* One DNS provider account. Its credentials are secrets and live in the secrets
|
|
597
|
-
* file keyed by this `id`, never in the config.
|
|
598
|
-
*/
|
|
599
|
-
var ddnsAccountSchema = lazy(() => type({
|
|
600
|
-
id: "/^[a-z0-9][a-z0-9_-]*$/",
|
|
601
|
-
provider: "string >= 1",
|
|
602
|
-
label: "string = \"\""
|
|
603
|
-
}).onUndeclaredKey("reject"));
|
|
604
|
-
/**
|
|
605
|
-
* A hostname to keep pointed at this machine. That list is the whole user-facing
|
|
606
|
-
* setup: the provider account it belongs to, and (optionally) which families.
|
|
607
|
-
*/
|
|
608
|
-
var ddnsDomainSchema = lazy(() => type({
|
|
609
|
-
host: "/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/",
|
|
610
|
-
account: "string >= 1",
|
|
611
|
-
/** Records to keep current; `A` unless the host needs IPv6 too. */
|
|
612
|
-
types: ddnsRecordTypeSchema.array().default(() => ["A"]),
|
|
613
|
-
/**
|
|
614
|
-
* The registered domain (apex) this host sits in. Only needed where a
|
|
615
|
-
* provider cannot look it up and the guess is wrong (three-label suffixes).
|
|
616
|
-
*/
|
|
617
|
-
zone: "string?",
|
|
618
|
-
/** Seconds; `1` means "automatic" where the provider supports it. */
|
|
619
|
-
ttl: "number.integer >= 1?",
|
|
620
|
-
/** Proxying is a property of the record, not the panel: Cloudflare only. */
|
|
621
|
-
proxied: "boolean = false",
|
|
622
|
-
enabled: "boolean = true"
|
|
623
|
-
}).onUndeclaredKey("reject"));
|
|
624
|
-
/** Which public IP families to detect; a provider is only called for the ones declared. */
|
|
625
|
-
var ddnsIpv4Schema = lazy(() => type({
|
|
626
|
-
enabled: "boolean = true",
|
|
627
|
-
/** Override the public-IP endpoint; empty uses the built-in list. */
|
|
628
|
-
url: "string = \"\""
|
|
629
|
-
}).onUndeclaredKey("reject"));
|
|
630
|
-
var ddnsIpv6Schema = lazy(() => type({
|
|
631
|
-
enabled: "boolean = false",
|
|
632
|
-
url: "string = \"\""
|
|
633
|
-
}).onUndeclaredKey("reject"));
|
|
634
|
-
/**
|
|
635
|
-
* Dynamic DNS: keep a list of hostnames pointed at this machine's public IP.
|
|
636
|
-
* Probing is cheap and constant; a provider is only called when the address it
|
|
637
|
-
* last confirmed differs, which is what keeps simple endpoints (FreeDNS, No-IP)
|
|
638
|
-
* inside their rate limits.
|
|
639
|
-
*/
|
|
640
|
-
var ddnsConfigSchema = lazy(() => type({
|
|
641
|
-
enabled: "boolean = false",
|
|
642
|
-
/** How often the public address is re-checked. */
|
|
643
|
-
intervalMs: "number >= 60000 = 300000",
|
|
644
|
-
ipv4: ddnsIpv4Schema.default(() => ({})),
|
|
645
|
-
ipv6: ddnsIpv6Schema.default(() => ({})),
|
|
646
|
-
/** Default TTL for the records that accept one. */
|
|
647
|
-
ttl: "number.integer >= 1 = 1",
|
|
648
|
-
accounts: ddnsAccountSchema.array().default(() => []),
|
|
649
|
-
domains: ddnsDomainSchema.array().default(() => [])
|
|
650
|
-
}).onUndeclaredKey("reject"));
|
|
651
|
-
var ddnsRecordStateSchema = lazy(() => type("\"pending\" | \"ok\" | \"unchanged\" | \"error\" | \"skipped\""));
|
|
652
|
-
/** What happened to one hostname on the last pass. */
|
|
653
|
-
var ddnsRecordViewSchema = lazy(() => type({
|
|
654
|
-
"host": "string",
|
|
655
|
-
"account": "string",
|
|
656
|
-
"provider": "string",
|
|
657
|
-
"type": ddnsRecordTypeSchema,
|
|
658
|
-
"ip": "string | null",
|
|
659
|
-
"state": ddnsRecordStateSchema,
|
|
660
|
-
"message": "string | null",
|
|
661
|
-
"updatedAt": "number | null",
|
|
662
|
-
/** The provider refused permanently; no retry until the hostname, account or credentials change, or a check. */
|
|
663
|
-
"stopped?": "boolean"
|
|
664
|
-
}));
|
|
665
|
-
/** Live DDNS state, as the state frame and the settings page read it. */
|
|
666
|
-
var ddnsStatusSchema = lazy(() => type({
|
|
667
|
-
enabled: "boolean",
|
|
668
|
-
running: "boolean",
|
|
669
|
-
lastRunAt: "number | null",
|
|
670
|
-
lastResult: "string | null",
|
|
671
|
-
ipv4: "string | null",
|
|
672
|
-
ipv6: "string | null",
|
|
673
|
-
records: ddnsRecordViewSchema.array()
|
|
674
|
-
}));
|
|
675
|
-
/** What a provider needs from the person configuring it. */
|
|
676
|
-
var ddnsProviderFieldSchema = lazy(() => type({
|
|
677
|
-
key: "string",
|
|
678
|
-
label: "string",
|
|
679
|
-
hint: "string = \"\"",
|
|
680
|
-
optional: "boolean = false"
|
|
681
|
-
}));
|
|
682
|
-
/** Provider capabilities, so the UI knows which options to show. */
|
|
683
|
-
var ddnsProviderInfoSchema = lazy(() => type({
|
|
684
|
-
id: "string",
|
|
685
|
-
label: "string",
|
|
686
|
-
docsUrl: "string",
|
|
687
|
-
families: ddnsRecordTypeSchema.array(),
|
|
688
|
-
fields: ddnsProviderFieldSchema.array(),
|
|
689
|
-
ttl: "boolean",
|
|
690
|
-
proxied: "boolean",
|
|
691
|
-
/** These credentials can also answer an ACME DNS-01 challenge (a TXT record). */
|
|
692
|
-
txt: "boolean"
|
|
693
|
-
}));
|
|
694
|
-
/** `GET /api/ddns`: the policy, the live state, and the providers this build knows. */
|
|
695
|
-
var ddnsViewSchema = lazy(() => type({
|
|
696
|
-
config: ddnsConfigSchema,
|
|
697
|
-
status: ddnsStatusSchema,
|
|
698
|
-
providers: ddnsProviderInfoSchema.array(),
|
|
699
|
-
/** Account ids whose credentials are stored. */
|
|
700
|
-
credentials: type("string[]")
|
|
701
|
-
}).onDeepUndeclaredKey("ignore"));
|
|
702
|
-
/**
|
|
703
|
-
* `PUT /api/ddns/credentials/:id`: the secret fields that provider declares.
|
|
704
|
-
*
|
|
705
|
-
* The provider travels with the request because the account may still be an
|
|
706
|
-
* unsaved draft — the server needs its field list, not a config entry.
|
|
707
|
-
*/
|
|
708
|
-
var ddnsCredentialsSchema = lazy(() => type({
|
|
709
|
-
provider: "string >= 1",
|
|
710
|
-
credentials: type("Record<string, string>")
|
|
1191
|
+
/** Trust `x-forwarded-*` from a reverse proxy; also drives the client IP. */
|
|
1192
|
+
trustProxy: "boolean | \"loopback\" = \"loopback\"",
|
|
1193
|
+
maxLoginAttempts: "number.integer >= 1 = 5",
|
|
1194
|
+
lockoutMs: "number >= 1000 = 60000"
|
|
711
1195
|
}).onUndeclaredKey("reject"));
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
1196
|
+
/** Event toggles and throttle a target may inherit; `enabled` is the target's own and never inherited. */
|
|
1197
|
+
var notificationPolicyShape = {
|
|
1198
|
+
onCrash: "boolean = true",
|
|
1199
|
+
onUnhealthy: "boolean = true",
|
|
1200
|
+
onForcedRestart: "boolean = true",
|
|
1201
|
+
onRecovered: "boolean = false",
|
|
1202
|
+
/** Host vitals breaches (disk, memory, swap, load, temperature). */
|
|
1203
|
+
onHost: "boolean = true",
|
|
1204
|
+
onDdns: "boolean = true",
|
|
1205
|
+
/** Per server *and* reason, so a flapping server cannot spam the chat. */
|
|
1206
|
+
cooldownMs: "number >= 0 = 120000"
|
|
1207
|
+
};
|
|
1208
|
+
var notificationDefaultsSchema = lazy(() => type({ ...notificationPolicyShape }).onUndeclaredKey("reject"));
|
|
1209
|
+
/** The same block as a response: tolerates keys this release does not know. */
|
|
1210
|
+
var notificationDefaultsViewSchema = lazy(() => type({ ...notificationPolicyShape }));
|
|
1211
|
+
/** Defaults to `true` so a config written before inheritance existed keeps its own toggles. */
|
|
1212
|
+
var useOwnSettingsSchema = "boolean = true";
|
|
1213
|
+
/** One Telegram destination; its bot token is a secret keyed by `id` in the workspace's `.secrets.json`. */
|
|
1214
|
+
var telegramDestinationSchema = lazy(() => type({
|
|
1215
|
+
kind: "\"telegram\"",
|
|
1216
|
+
id: "/^[a-z0-9][a-z0-9_-]*$/",
|
|
1217
|
+
/** Off until configured: a bare `enabled: true` with no chat would fail every send. */
|
|
1218
|
+
enabled: "boolean = false",
|
|
1219
|
+
chatId: "string = \"\"",
|
|
1220
|
+
useOwnSettings: useOwnSettingsSchema,
|
|
1221
|
+
...notificationPolicyShape
|
|
1222
|
+
}).onUndeclaredKey("reject"));
|
|
1223
|
+
/** One webhook destination; `headers` lets it serve ntfy, bearer-token or JSON receivers alike. */
|
|
1224
|
+
var webhookTargetSchema = lazy(() => type({
|
|
1225
|
+
kind: "\"webhook\"",
|
|
1226
|
+
id: "/^[a-z0-9][a-z0-9_-]*$/",
|
|
1227
|
+
/** Empty only while the target is a draft; the page will not save one without it. */
|
|
1228
|
+
url: "string = \"\"",
|
|
1229
|
+
enabled: "boolean = true",
|
|
1230
|
+
method: "\"POST\" | \"PUT\" = \"POST\"",
|
|
1231
|
+
/** Payload format: `json` sends the event as JSON, `text` sends the plain message. */
|
|
1232
|
+
format: "\"json\" | \"text\" = \"json\"",
|
|
1233
|
+
/** Extra headers, `Name: value` per line. */
|
|
1234
|
+
headers: "string = \"\"",
|
|
1235
|
+
useOwnSettings: useOwnSettingsSchema,
|
|
1236
|
+
...notificationPolicyShape
|
|
1237
|
+
}).onUndeclaredKey("reject"));
|
|
1238
|
+
var notificationTargetSchema = lazy(() => telegramDestinationSchema.or(webhookTargetSchema));
|
|
1239
|
+
/** `id` must be unique across kinds (it keys cooldowns, results and tokens); `duplicateWebhookIds` enforces it at write. */
|
|
1240
|
+
var destinationListSchema = lazy(() => notificationTargetSchema.array());
|
|
1241
|
+
var notificationsSchema = lazy(() => type({
|
|
1242
|
+
defaults: notificationDefaultsSchema.default(() => ({})),
|
|
1243
|
+
/** Replaced by a patch, the same way `ddns.accounts` is: a merge cannot express removing one. */
|
|
1244
|
+
destinations: destinationListSchema.default(() => [])
|
|
1245
|
+
}).onUndeclaredKey("reject"));
|
|
1246
|
+
/** Ids that appear more than once, so a write can refuse them (a schema narrow would break JSON Schema). */
|
|
1247
|
+
function duplicateWebhookIds(targets) {
|
|
1248
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1249
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
1250
|
+
for (const target of targets) {
|
|
1251
|
+
if (seen.has(target.id)) duplicates.add(target.id);
|
|
1252
|
+
seen.add(target.id);
|
|
1253
|
+
}
|
|
1254
|
+
return [...duplicates];
|
|
1255
|
+
}
|
|
1256
|
+
var logsSchema = lazy(() => type({
|
|
1257
|
+
persist: "boolean = true",
|
|
1258
|
+
/** Per server, before rotating to `.1`, `.2`, ... */
|
|
1259
|
+
maxBytes: "10000 <= number <= 100000000 = 2000000",
|
|
1260
|
+
keep: "1 <= number.integer <= 10 = 3"
|
|
1261
|
+
}).onUndeclaredKey("reject"));
|
|
1262
|
+
var tlsSchema = lazy(() => type({ enabled: "boolean = false" }).onUndeclaredKey("reject"));
|
|
1263
|
+
var hostSchema = lazy(() => type({
|
|
1264
|
+
enabled: "boolean = true",
|
|
1265
|
+
intervalMs: "number >= 5000 = 15000",
|
|
1266
|
+
/** Filesystems reported and alerted on; templates and `~` are expanded. */
|
|
1267
|
+
diskPaths: type("string[]").default(() => ["."]),
|
|
1268
|
+
/** 0 disables an individual alert. Defaults come from `HOST_ALERT_DEFAULTS`, the one home for them. */
|
|
1269
|
+
diskUsedPercent: `number >= 0 = ${HOST_ALERT_DEFAULTS.diskUsedPercent}`,
|
|
1270
|
+
memoryUsedPercent: `number >= 0 = ${HOST_ALERT_DEFAULTS.memoryUsedPercent}`,
|
|
1271
|
+
swapUsedPercent: `number >= 0 = ${HOST_ALERT_DEFAULTS.swapUsedPercent}`,
|
|
1272
|
+
/** Per-cpu load to notify on; the frame's `loadAlertPerCpu` carries it. */
|
|
1273
|
+
loadPerCpu: type("number >= 0").default(2),
|
|
1274
|
+
tempCelsius: `number >= 0 = ${HOST_ALERT_DEFAULTS.tempCelsius}`,
|
|
1275
|
+
/** A command printing the CPU temperature in °C, for when the kernel exposes no sensor; empty uses the built-in probe. */
|
|
1276
|
+
tempCommand: "string <= 512 = \"\"",
|
|
1277
|
+
/** How long that command may run before it is killed, so a hung helper cannot stall a sample. */
|
|
1278
|
+
tempCommandTimeoutMs: "100 <= number <= 30000 = 5000"
|
|
726
1279
|
}).onUndeclaredKey("reject"));
|
|
727
|
-
/** Tar archives of config, secrets, TLS and declared data paths. */
|
|
728
1280
|
/**
|
|
729
|
-
* What an automatic backup captures
|
|
730
|
-
*
|
|
731
|
-
* `only` is `--include`, `except` is `--all --exclude`, and both name the same ids: a coarse id
|
|
732
|
-
* (`workspace:default`) covers every leaf under it. Omitted means the full default scope, which is
|
|
733
|
-
* what a schedule written before this field existed must keep meaning.
|
|
734
|
-
*
|
|
735
|
-
* An empty `ids` is refused rather than read as either "nothing" or "everything": those are the two
|
|
736
|
-
* readings a person cannot tell apart from the file, and one of them captures nothing at all.
|
|
1281
|
+
* What an automatic backup captures: `only` is `--include`, `except` is `--all --exclude`, and a
|
|
1282
|
+
* coarse id covers every leaf under it. An empty `ids` is refused as ambiguous.
|
|
737
1283
|
*/
|
|
738
1284
|
var backupScopeSchema = lazy(() => type({
|
|
739
1285
|
mode: "\"only\" | \"except\"",
|
|
740
1286
|
ids: type("string >= 1").array().atLeastLength(1)
|
|
741
1287
|
}).onUndeclaredKey("reject"));
|
|
742
|
-
/** The scheduled half: an interval, a retention of its own, and what it captures. */
|
|
743
1288
|
var backupScheduleSchema = lazy(() => type({
|
|
744
1289
|
/** 0 turns the schedule off; otherwise the gap between automatic archives. */
|
|
745
1290
|
intervalMs: "number.integer >= 0 = 0",
|
|
746
1291
|
/** How many automatic archives to keep. Manual ones are never pruned by it. */
|
|
747
1292
|
keep: "number.integer >= 1 = 7",
|
|
748
|
-
/**
|
|
749
|
-
* Absent means the whole default scope — every workspace and `includePaths`. Deliberately not
|
|
750
|
-
* defaulted to an explicit value: a reader cannot tell an untouched file from one that chose
|
|
751
|
-
* "everything", and a default here would rewrite every existing schedule on its first save.
|
|
752
|
-
*/
|
|
1293
|
+
/** Absent means the whole default scope; not defaulted, so an untouched file stays distinguishable. */
|
|
753
1294
|
scope: backupScopeSchema.optional()
|
|
754
1295
|
}).onUndeclaredKey("reject"));
|
|
755
1296
|
var backupsSchema = lazy(() => type({
|
|
@@ -757,22 +1298,17 @@ var backupsSchema = lazy(() => type({
|
|
|
757
1298
|
dir: "string = \".backups\"",
|
|
758
1299
|
/** How many archives to keep in total, newest first. */
|
|
759
1300
|
keep: "number.integer >= 1 = 5",
|
|
760
|
-
/** Extra paths in every backup, in addition to each server's `backupPaths`. */
|
|
761
1301
|
includePaths: type("string[]").default(() => []),
|
|
762
1302
|
schedule: backupScheduleSchema.default(() => ({}))
|
|
763
1303
|
}).onUndeclaredKey("reject"));
|
|
764
1304
|
var allowedHostsSchema = lazy(() => type(/^(?:\*\.)?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i).array().atMostLength(64));
|
|
765
1305
|
var controlSchema = lazy(() => type({
|
|
766
|
-
/** What the panel calls itself; the stock UI shows it in the sidebar. */
|
|
767
1306
|
label: "1 <= string <= 60 = \"home-hosted\"",
|
|
768
1307
|
port: "1 <= number.integer <= 65535 = 3999",
|
|
769
1308
|
/** Where the control panel itself listens; keep it `local` unless you mean it. */
|
|
770
1309
|
host: bindSchema.default(() => "local"),
|
|
771
1310
|
openBrowser: "boolean = false",
|
|
772
|
-
/**
|
|
773
|
-
* Public hostnames the panel answers to, besides IPs, local names and its own proxy routes —
|
|
774
|
-
* a name an external reverse proxy or tunnel forwards. `*.example.com` matches subdomains.
|
|
775
|
-
*/
|
|
1311
|
+
/** Public hostnames besides IPs, local names and proxy routes; `*.example.com` matches subdomains. */
|
|
776
1312
|
allowedHosts: allowedHostsSchema.default(() => []),
|
|
777
1313
|
auth: authSchema.default(() => ({})),
|
|
778
1314
|
tls: tlsSchema.default(() => ({}))
|
|
@@ -839,13 +1375,7 @@ var notificationPolicyPatchShape = {
|
|
|
839
1375
|
onDdns: "boolean?",
|
|
840
1376
|
cooldownMs: "number >= 0?"
|
|
841
1377
|
};
|
|
842
|
-
/**
|
|
843
|
-
* The patch shape for one destination.
|
|
844
|
-
*
|
|
845
|
-
* `kind` is required: a patch cannot change a destination's kind (that would silently drop its
|
|
846
|
-
* credential), so it names the kind it is addressing. The list is **replaced**, not merged — a merge
|
|
847
|
-
* cannot express removing a destination, the same reason `ddns.accounts` is replaced.
|
|
848
|
-
*/
|
|
1378
|
+
/** `kind` is required: a patch cannot change a destination's kind (that would drop its credential). */
|
|
849
1379
|
var destinationPatchSchema = lazy(() => type({
|
|
850
1380
|
kind: "\"telegram\" | \"webhook\"",
|
|
851
1381
|
id: "/^[a-z0-9][a-z0-9_-]*$/",
|
|
@@ -861,16 +1391,7 @@ var destinationPatchSchema = lazy(() => type({
|
|
|
861
1391
|
...notificationPolicyPatchShape
|
|
862
1392
|
}).onUndeclaredKey("reject"));
|
|
863
1393
|
var notificationsPatchSchema = lazy(() => type({
|
|
864
|
-
/** Merged key by key,
|
|
865
|
-
/**
|
|
866
|
-
* A merge key-by-key, and **every field optional** — `notificationPolicyPatchShape`, not a
|
|
867
|
-
* `.partial()` of the defaults schema.
|
|
868
|
-
*
|
|
869
|
-
* ArkType's `.partial()` leaves a field's `= false` / `= 120000` default in place, so a body of
|
|
870
|
-
* `{ onHost: false }` validated into all seven keys and one toggle overwrote the rest. A patch
|
|
871
|
-
* schema here carries no defaults (the rule for every patch), and the store merges it over the
|
|
872
|
-
* stored block.
|
|
873
|
-
*/
|
|
1394
|
+
/** Merged key by key; no defaults, so one toggle does not overwrite the rest. */
|
|
874
1395
|
defaults: type({ ...notificationPolicyPatchShape }).onUndeclaredKey("reject").optional(),
|
|
875
1396
|
/** Replaced whole, so a removed destination stays removed. */
|
|
876
1397
|
destinations: destinationPatchSchema.array().optional()
|
|
@@ -890,10 +1411,7 @@ var hostPatchSchema = lazy(() => type({
|
|
|
890
1411
|
var backupSchedulePatchSchema = lazy(() => type({
|
|
891
1412
|
intervalMs: "number.integer >= 0?",
|
|
892
1413
|
keep: "number.integer >= 1?",
|
|
893
|
-
/**
|
|
894
|
-
* No defaults, like every patch: `null` clears it back to the full default scope, which is the
|
|
895
|
-
* only way to spell "forget the choice I made" — an omitted key means "leave it as it is".
|
|
896
|
-
*/
|
|
1414
|
+
/** `null` clears it back to the full default scope; omitted leaves it as it is. */
|
|
897
1415
|
scope: backupScopeSchema.or(type("null")).optional()
|
|
898
1416
|
}).onUndeclaredKey("reject"));
|
|
899
1417
|
var backupsPatchSchema = lazy(() => type({
|
|
@@ -931,13 +1449,7 @@ var defaultsPatchSchema = lazy(() => type({
|
|
|
931
1449
|
/** A function, so the schemas it names are built only when a patch schema is. */
|
|
932
1450
|
function editableFields() {
|
|
933
1451
|
return {
|
|
934
|
-
/**
|
|
935
|
-
* `null` clears it, the same spelling `serverSchema` accepts and every display's `label ?? id`
|
|
936
|
-
* fallback needs — an empty string satisfies neither. `serverPatchSchema` is what the editor
|
|
937
|
-
* validates its payload against and what `PATCH /api/servers/:id` checks, so without this a
|
|
938
|
-
* cleared Label was refused with "label must be a string (was null)" and could not be saved at all
|
|
939
|
-
* (`1f58a5d` fixed `applyPatch` and the *control* patch schema, and cited that one in its message).
|
|
940
|
-
*/
|
|
1452
|
+
/** `null` clears it, the spelling `serverSchema` accepts and `label ?? id` needs. */
|
|
941
1453
|
label: labelOrNullSchema.optional(),
|
|
942
1454
|
enabled: "boolean?",
|
|
943
1455
|
autostart: "boolean?",
|
|
@@ -948,6 +1460,7 @@ function editableFields() {
|
|
|
948
1460
|
env: "Record<string, string>?",
|
|
949
1461
|
dataEnvs: "Record<string, string>?",
|
|
950
1462
|
bootstrap: bootstrapPatchOrNullSchema.optional(),
|
|
1463
|
+
deploy: deployPatchOrNullSchema.optional(),
|
|
951
1464
|
dump: backupHookPatchOrNullSchema.optional(),
|
|
952
1465
|
load: backupHookPatchOrNullSchema.optional(),
|
|
953
1466
|
port: portSchema.optional(),
|
|
@@ -961,7 +1474,8 @@ function editableFields() {
|
|
|
961
1474
|
envFile: "string?",
|
|
962
1475
|
resources: resourcesPatchSchema.optional(),
|
|
963
1476
|
backupPaths: type("string[]").optional(),
|
|
964
|
-
backupIgnoreGenerated: "boolean?"
|
|
1477
|
+
backupIgnoreGenerated: "boolean?",
|
|
1478
|
+
secretEnv: secretEnvNamesSchema.optional()
|
|
965
1479
|
};
|
|
966
1480
|
}
|
|
967
1481
|
var serverPatchSchema = lazy(() => type(editableFields()).onUndeclaredKey("reject"));
|
|
@@ -970,11 +1484,12 @@ var serverCreateSchema = lazy(() => type({
|
|
|
970
1484
|
...editableFields(),
|
|
971
1485
|
command: "string"
|
|
972
1486
|
}).onUndeclaredKey("reject"));
|
|
973
|
-
/**
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1487
|
+
/** The stored entry plus run-time problems; `warnings` is absent when there is nothing to say, and is not a refusal. */
|
|
1488
|
+
var serverWriteResponseSchema = lazy(() => type({
|
|
1489
|
+
"server": serverSchema,
|
|
1490
|
+
"warnings?": "string[]"
|
|
1491
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
1492
|
+
/** What the panel hands a persistent entry's nanny, written 0600 and unlinked on read; everything is pre-resolved. */
|
|
978
1493
|
var nannySpecSchema = lazy(() => type({
|
|
979
1494
|
serverId: "string",
|
|
980
1495
|
command: "string",
|
|
@@ -983,23 +1498,16 @@ var nannySpecSchema = lazy(() => type({
|
|
|
983
1498
|
env: "Record<string, string>",
|
|
984
1499
|
/** Directory of the JSONL the nanny writes; `<dir>/<id>.log`, exactly as the panel names it. */
|
|
985
1500
|
logDir: "string",
|
|
986
|
-
/** The same retention the panel applies, so the nanny rotates identically. */
|
|
987
1501
|
logs: logsSchema,
|
|
988
|
-
/** How the nanny stops the child it owns. */
|
|
989
1502
|
stop: stopSchema
|
|
990
|
-
}).
|
|
991
|
-
/** How the child of a nanny ended, recorded for a panel that may not have been there. */
|
|
1503
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
992
1504
|
var nannyExitSchema = lazy(() => type({
|
|
993
1505
|
code: "number | null",
|
|
994
1506
|
signal: "string | null",
|
|
995
1507
|
at: "number",
|
|
996
1508
|
runtimeMs: "number"
|
|
997
|
-
}).
|
|
998
|
-
/**
|
|
999
|
-
* A persistent entry's process state, written by its nanny (heartbeat included) and
|
|
1000
|
-
* read by the panel to re-adopt a survivor and to learn how a child it never saw
|
|
1001
|
-
* exit actually ended.
|
|
1002
|
-
*/
|
|
1509
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
1510
|
+
/** A persistent entry's process state, written by its nanny (with a heartbeat) and read by the panel to re-adopt it. */
|
|
1003
1511
|
var nannyStateSchema = lazy(() => type({
|
|
1004
1512
|
"serverId": "string",
|
|
1005
1513
|
"nannyPid": "number",
|
|
@@ -1008,333 +1516,70 @@ var nannyStateSchema = lazy(() => type({
|
|
|
1008
1516
|
"logFile": "string",
|
|
1009
1517
|
"heartbeatAt": "number",
|
|
1010
1518
|
"lastExit?": nannyExitSchema
|
|
1011
|
-
}).
|
|
1012
|
-
/**
|
|
1013
|
-
* The part of an entry's supervision the panel must remember across its own restarts.
|
|
1014
|
-
*
|
|
1015
|
-
* In memory alone, a crash loop was handed a fresh `maxRetries` by every panel start
|
|
1016
|
-
* (`restarts` counted "since the control plane started"), and a `runOnce` bootstrap
|
|
1017
|
-
* re-ran for the same reason. Both are decisions whose whole point is to outlast the
|
|
1018
|
-
* process that made them.
|
|
1019
|
-
*/
|
|
1519
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
1520
|
+
/** Supervision state that must outlast a panel restart (retry budgets, `runOnce`). */
|
|
1020
1521
|
var entryStateSchema = lazy(() => type({
|
|
1021
1522
|
/** Attempts spent on the current crash sequence; reset once the process stays up. */
|
|
1022
1523
|
"restarts": "number.integer >= 0",
|
|
1023
|
-
/**
|
|
1024
|
-
* Force restarts spent on the current unhealthy sequence.
|
|
1025
|
-
*
|
|
1026
|
-
* Separate from `restarts` because the two are different failures — a process that keeps dying
|
|
1027
|
-
* and a process that stays up but cannot serve. Persisted for the same reason the crash counter
|
|
1028
|
-
* is: a budget that lives only in memory is handed back fresh by every panel restart, so a
|
|
1029
|
-
* health-storm that is restarted often enough never exhausts it.
|
|
1030
|
-
*/
|
|
1524
|
+
/** Force restarts spent on the current unhealthy sequence, separate from crash `restarts`. */
|
|
1031
1525
|
"healthRestarts?": "number.integer >= 0",
|
|
1032
|
-
/** The `runOnce` bootstrap already ran for this entry. */
|
|
1033
1526
|
"bootstrapDone": "boolean",
|
|
1034
|
-
/**
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
* next `start` runs the hook once the process is up. Persisted, because a restore followed by a
|
|
1040
|
-
* panel restart must not lose the load.
|
|
1041
|
-
*/
|
|
1042
|
-
"pendingLoad?": "string | null",
|
|
1043
|
-
/**
|
|
1044
|
-
* The last child this panel spawned for a non-persistent entry. A detached child
|
|
1045
|
-
* outlives the panel, so this is the only way a later boot recognizes its own
|
|
1046
|
-
* survivor instead of spawning a second copy beside it.
|
|
1047
|
-
*/
|
|
1048
|
-
"lastPid?": "number | null",
|
|
1049
|
-
"lastStartedAt?": "number | null"
|
|
1050
|
-
}));
|
|
1051
|
-
/** Edits to the panel-wide settings: listener, auth, TLS policy, host vitals, backups. */
|
|
1052
|
-
var settingsPatchSchema = lazy(() => type({
|
|
1053
|
-
control: controlPatchSchema.optional(),
|
|
1054
|
-
host: hostPatchSchema.optional(),
|
|
1055
|
-
backups: backupsPatchSchema.optional()
|
|
1056
|
-
}).onUndeclaredKey("reject"));
|
|
1057
|
-
/** Edits to one workspace's settings: server defaults, log retention, notifications. */
|
|
1058
|
-
var workspaceSettingsPatchSchema = lazy(() => type({
|
|
1059
|
-
defaults: defaultsPatchSchema.optional(),
|
|
1060
|
-
logs: logsPatchSchema.optional(),
|
|
1061
|
-
notifications: notificationsPatchSchema.optional()
|
|
1062
|
-
}).onUndeclaredKey("reject"));
|
|
1063
|
-
var authStatusSchema = lazy(() => type({
|
|
1064
|
-
enabled: "boolean",
|
|
1065
|
-
passwordSet: "boolean",
|
|
1066
|
-
passwordUpdatedAt: "number | null",
|
|
1067
|
-
/**
|
|
1068
|
-
* An API token is set; it is shown here as a flag, never as a value. Optional so
|
|
1069
|
-
* a freshly built UI still parses the state of a panel process that predates it:
|
|
1070
|
-
* an upgrade replaces `uis/stock/dist` on disk while the old process keeps
|
|
1071
|
-
* serving, and a missing key must not blank the whole app.
|
|
1072
|
-
*/
|
|
1073
|
-
apiTokenSet: "boolean?",
|
|
1074
|
-
/** Still the boot-time default; the login page says so and exposure stays blocked. */
|
|
1075
|
-
usingDefaultPassword: "boolean",
|
|
1076
|
-
/** The panel currently listens beyond loopback. */
|
|
1077
|
-
exposed: "boolean",
|
|
1078
|
-
/** Non-null when that exposure is not backed by a password. */
|
|
1079
|
-
blockedReason: "string | null",
|
|
1080
|
-
sessionTtlMs: "number",
|
|
1081
|
-
cookieSecure: "string",
|
|
1082
|
-
trustProxy: "boolean | \"loopback\"",
|
|
1083
|
-
maxLoginAttempts: "number",
|
|
1084
|
-
lockoutMs: "number"
|
|
1085
|
-
}));
|
|
1086
|
-
var tlsStatusSchema = lazy(() => type({
|
|
1087
|
-
enabled: "boolean",
|
|
1088
|
-
certPresent: "boolean",
|
|
1089
|
-
subject: "string | null",
|
|
1090
|
-
issuer: "string | null",
|
|
1091
|
-
validFrom: "string | null",
|
|
1092
|
-
validTo: "string | null",
|
|
1093
|
-
daysRemaining: "number | null",
|
|
1094
|
-
fingerprint: "string | null",
|
|
1095
|
-
keyMatches: "boolean | null",
|
|
1096
|
-
error: "string | null"
|
|
1097
|
-
}));
|
|
1098
|
-
/**
|
|
1099
|
-
* The reverse-proxy engine this panel can drive. One engine ships today; the
|
|
1100
|
-
* field exists so a config written now keeps working if a second one lands.
|
|
1101
|
-
*/
|
|
1102
|
-
var proxyEngineSchema = lazy(() => type.enumerated("caddy"));
|
|
1103
|
-
/** What a route forwards to: a supervised entry, the panel itself, or a literal upstream. */
|
|
1104
|
-
var proxyTargetSchema = lazy(() => type.enumerated("server", "panel", "external"));
|
|
1105
|
-
/** `auto` lets the engine decide: a public name gets ACME, a local one its own CA. */
|
|
1106
|
-
var proxyTlsModeSchema = lazy(() => type.enumerated("auto", "off", "manual"));
|
|
1107
|
-
/**
|
|
1108
|
-
* One public hostname, and where it goes. A route is panel-wide on purpose — the
|
|
1109
|
-
* point is one domain per service across every workspace — so a target that
|
|
1110
|
-
* names an entry names its workspace too.
|
|
1111
|
-
*/
|
|
1112
|
-
var proxyRouteSchema = lazy(() => type({
|
|
1113
|
-
id: "/^[a-z0-9][a-z0-9_-]*$/",
|
|
1114
|
-
/** The public hostname this route answers for. */
|
|
1115
|
-
host: "/^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/",
|
|
1116
|
-
enabled: "boolean = true",
|
|
1117
|
-
target: proxyTargetSchema.default(() => "server"),
|
|
1118
|
-
/** `target: "server"` — an id is only unique inside its workspace. */
|
|
1119
|
-
workspace: "string = \"\"",
|
|
1120
|
-
server: "string = \"\"",
|
|
1121
|
-
/** `target: "external"` — a literal upstream such as `http://10.0.0.5:8080`. */
|
|
1122
|
-
url: "string = \"\"",
|
|
1123
|
-
/** Optional path prefix; empty serves the whole host. */
|
|
1124
|
-
path: "string = \"\"",
|
|
1125
|
-
tls: proxyTlsModeSchema.default(() => "auto"),
|
|
1126
|
-
/**
|
|
1127
|
-
* Which DNS account answers a DNS-01 challenge for this hostname, as
|
|
1128
|
-
* `<workspace>/<account>` — the account belongs to a workspace, so the proxy
|
|
1129
|
-
* references it rather than owning it. Empty picks the workspace's only
|
|
1130
|
-
* account that can write TXT records.
|
|
1131
|
-
*/
|
|
1132
|
-
dnsAccount: "string = \"\""
|
|
1133
|
-
}).onUndeclaredKey("reject"));
|
|
1134
|
-
/**
|
|
1135
|
-
* One uploaded PEM pair. The pair itself lives on disk (0600) beside the panel's
|
|
1136
|
-
* own; this is the entry that names it, so a route can be checked against it.
|
|
1137
|
-
*/
|
|
1138
|
-
var proxyCertificateSchema = lazy(() => type({
|
|
1139
|
-
id: "/^[a-z0-9][a-z0-9_-]*$/",
|
|
1140
|
-
label: "string = \"\""
|
|
1141
|
-
}).onUndeclaredKey("reject"));
|
|
1142
|
-
/**
|
|
1143
|
-
* What a route's certificate situation is, for the page to show. `fallback` is a
|
|
1144
|
-
* public name the CA would not issue for, so the engine is serving its own CA.
|
|
1145
|
-
*/
|
|
1146
|
-
var proxyCertificateStateSchema = lazy(() => type.enumerated("off", "local", "uploaded", "issued", "pending", "failed", "fallback"));
|
|
1147
|
-
/**
|
|
1148
|
-
* DNS-01, answered by the panel instead of the engine.
|
|
1149
|
-
*
|
|
1150
|
-
* The engine never holds DNS credentials: it asks the panel over the ACMEProxy
|
|
1151
|
-
* protocol, and the panel writes the challenge record through the workspace
|
|
1152
|
-
* account a route names. `resolvers` overrides the nameservers Caddy uses to see
|
|
1153
|
-
* the record, which is what split-horizon DNS needs.
|
|
1154
|
-
*/
|
|
1155
|
-
var proxyDns01Schema = lazy(() => type({
|
|
1156
|
-
/** Off means the engine uses HTTP-01/TLS-ALPN-01, exactly as before. */
|
|
1157
|
-
enabled: "boolean = false",
|
|
1158
|
-
/** Nameservers Caddy checks the TXT record against; empty uses its own defaults. */
|
|
1159
|
-
resolvers: type("string[]").default(() => [])
|
|
1160
|
-
}).onUndeclaredKey("reject"));
|
|
1161
|
-
/** Reverse proxy: expose the stack through one engine, with automatic HTTPS. */
|
|
1162
|
-
var proxyConfigSchema = lazy(() => type({
|
|
1163
|
-
enabled: "boolean = false",
|
|
1164
|
-
engine: proxyEngineSchema.default(() => "caddy"),
|
|
1165
|
-
/** Cleartext side: ACME HTTP-01 challenges and the redirect to HTTPS. */
|
|
1166
|
-
httpPort: "1 <= number.integer <= 65535 = 80",
|
|
1167
|
-
httpsPort: "1 <= number.integer <= 65535 = 443",
|
|
1168
|
-
/** ACME account address; a public certificate needs one. */
|
|
1169
|
-
email: "string = \"\"",
|
|
1170
|
-
/** The ACME staging endpoint: untrusted certificates, no rate-limit burn. */
|
|
1171
|
-
staging: "boolean = false",
|
|
1172
|
-
dns01: proxyDns01Schema.default(() => ({})),
|
|
1173
|
-
/** PEM pairs a route with `tls: "manual"` may serve; the engine picks by SNI. */
|
|
1174
|
-
certificates: proxyCertificateSchema.array().default(() => []),
|
|
1175
|
-
routes: proxyRouteSchema.array().default(() => [])
|
|
1176
|
-
}).onUndeclaredKey("reject"));
|
|
1177
|
-
/** Where the binary came from: the release we downloaded, or a path a person set. */
|
|
1178
|
-
var proxyEngineSourceSchema = lazy(() => type.enumerated("downloaded", "custom"));
|
|
1179
|
-
/** What the panel knows about the installed engine. */
|
|
1180
|
-
var proxyEngineStatusSchema = lazy(() => type({
|
|
1181
|
-
id: proxyEngineSchema,
|
|
1182
|
-
installed: "boolean",
|
|
1183
|
-
/** The version the binary reports; `null` until it has been probed. */
|
|
1184
|
-
version: "string | null",
|
|
1185
|
-
source: proxyEngineSourceSchema.or(type("null")),
|
|
1186
|
-
path: "string | null",
|
|
1187
|
-
bytes: "number | null",
|
|
1188
|
-
error: "string | null"
|
|
1189
|
-
}));
|
|
1190
|
-
/** Engine capabilities, so the page knows which options to offer. */
|
|
1191
|
-
var proxyEngineInfoSchema = lazy(() => type({
|
|
1192
|
-
id: proxyEngineSchema,
|
|
1193
|
-
label: "string",
|
|
1194
|
-
docsUrl: "string",
|
|
1195
|
-
releaseUrl: "string",
|
|
1196
|
-
acme: "boolean",
|
|
1197
|
-
internalCa: "boolean",
|
|
1198
|
-
dns01: "boolean",
|
|
1199
|
-
tcp: "boolean"
|
|
1200
|
-
}));
|
|
1201
|
-
var proxyRouteStatusSchema = lazy(() => type.enumerated("ok", "disabled", "no-upstream", "error"));
|
|
1202
|
-
/** A route as the page reads it: the config, plus the upstream resolved live. */
|
|
1203
|
-
var proxyRouteViewSchema = lazy(() => type({
|
|
1204
|
-
"route": proxyRouteSchema,
|
|
1205
|
-
"status": proxyRouteStatusSchema,
|
|
1206
|
-
"upstream": "string | null",
|
|
1207
|
-
"message": "string | null",
|
|
1208
|
-
/** Where this hostname's certificate stands. Optional: an older panel omits it. */
|
|
1209
|
-
"certificate?": type({
|
|
1210
|
-
"state": proxyCertificateStateSchema,
|
|
1211
|
-
"message": "string | null",
|
|
1212
|
-
/**
|
|
1213
|
-
* For `fallback`: minutes until the engine tries the CA again by itself, read
|
|
1214
|
-
* from the certificate it fell back to. Optional, so an older client ignores it.
|
|
1215
|
-
*/
|
|
1216
|
-
"retryInMinutes?": "number"
|
|
1217
|
-
})
|
|
1218
|
-
}).onDeepUndeclaredKey("ignore"));
|
|
1219
|
-
var proxyRunStateSchema = lazy(() => type.enumerated("off", "stopped", "starting", "running", "error", "unsupported"));
|
|
1220
|
-
/** Live engine state. */
|
|
1221
|
-
var proxyStatusSchema = lazy(() => type({
|
|
1222
|
-
state: proxyRunStateSchema,
|
|
1223
|
-
pid: "number | null",
|
|
1224
|
-
/** The addresses the engine serves on, for the page to show. */
|
|
1225
|
-
urls: type("string[]"),
|
|
1226
|
-
/** Days until the soonest publicly-issued certificate expires; `null` when none. */
|
|
1227
|
-
certExpiryDays: "number | null",
|
|
1228
|
-
since: "number | null",
|
|
1229
|
-
lastError: "string | null"
|
|
1527
|
+
/** A restored dump still to load once the entry is up (the load hook needs a running server). */
|
|
1528
|
+
"pendingLoad?": "string | null",
|
|
1529
|
+
/** The last child spawned for a non-persistent entry, so a later boot recognizes its own survivor. */
|
|
1530
|
+
"lastPid?": "number | null",
|
|
1531
|
+
"lastStartedAt?": "number | null"
|
|
1230
1532
|
}));
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1533
|
+
var settingsPatchSchema = lazy(() => type({
|
|
1534
|
+
control: controlPatchSchema.optional(),
|
|
1535
|
+
host: hostPatchSchema.optional(),
|
|
1536
|
+
backups: backupsPatchSchema.optional()
|
|
1537
|
+
}).onUndeclaredKey("reject"));
|
|
1538
|
+
var workspaceSettingsPatchSchema = lazy(() => type({
|
|
1539
|
+
defaults: defaultsPatchSchema.optional(),
|
|
1540
|
+
logs: logsPatchSchema.optional(),
|
|
1541
|
+
notifications: notificationsPatchSchema.optional()
|
|
1542
|
+
}).onUndeclaredKey("reject"));
|
|
1543
|
+
var authStatusSchema = lazy(() => type({
|
|
1544
|
+
enabled: "boolean",
|
|
1545
|
+
passwordSet: "boolean",
|
|
1546
|
+
passwordUpdatedAt: "number | null",
|
|
1547
|
+
/** An API token is set (a flag, never the value). Optional for an older panel. */
|
|
1548
|
+
apiTokenSet: "boolean?",
|
|
1549
|
+
/** Still the boot-time default; the login page says so and exposure stays blocked. */
|
|
1550
|
+
usingDefaultPassword: "boolean",
|
|
1551
|
+
exposed: "boolean",
|
|
1552
|
+
/** Non-null when that exposure is not backed by a password. */
|
|
1553
|
+
blockedReason: "string | null",
|
|
1554
|
+
sessionTtlMs: "number",
|
|
1555
|
+
cookieSecure: "string",
|
|
1556
|
+
trustProxy: "boolean | \"loopback\"",
|
|
1557
|
+
maxLoginAttempts: "number",
|
|
1558
|
+
lockoutMs: "number"
|
|
1559
|
+
}));
|
|
1560
|
+
var tlsStatusSchema = lazy(() => type({
|
|
1561
|
+
enabled: "boolean",
|
|
1562
|
+
certPresent: "boolean",
|
|
1239
1563
|
subject: "string | null",
|
|
1240
1564
|
issuer: "string | null",
|
|
1565
|
+
validFrom: "string | null",
|
|
1241
1566
|
validTo: "string | null",
|
|
1242
1567
|
daysRemaining: "number | null",
|
|
1243
|
-
|
|
1244
|
-
|
|
1568
|
+
fingerprint: "string | null",
|
|
1569
|
+
keyMatches: "boolean | null",
|
|
1245
1570
|
error: "string | null"
|
|
1246
1571
|
}));
|
|
1247
|
-
/**
|
|
1248
|
-
* A DNS account the route table may name, flattened across workspaces so the proxy
|
|
1249
|
-
* page can offer one list. The account itself stays in its workspace.
|
|
1250
|
-
*/
|
|
1251
|
-
var proxyDnsAccountViewSchema = lazy(() => type({
|
|
1252
|
-
workspace: "string",
|
|
1253
|
-
account: "string",
|
|
1254
|
-
provider: "string",
|
|
1255
|
-
label: "string",
|
|
1256
|
-
/** The credentials can write a TXT record, so this account can answer a challenge. */
|
|
1257
|
-
writesTxt: "boolean",
|
|
1258
|
-
/** Credentials are stored; an account without them cannot answer yet. */
|
|
1259
|
-
hasCredentials: "boolean"
|
|
1260
|
-
}));
|
|
1261
|
-
/** `GET /api/proxy`: the policy, the engine, the live state and the resolved routes. */
|
|
1262
|
-
var proxyViewSchema = lazy(() => type({
|
|
1263
|
-
"config": proxyConfigSchema,
|
|
1264
|
-
"engine": proxyEngineStatusSchema,
|
|
1265
|
-
"engines": proxyEngineInfoSchema.array(),
|
|
1266
|
-
"status": proxyStatusSchema,
|
|
1267
|
-
"routes": proxyRouteViewSchema.array(),
|
|
1268
|
-
/** Every uploaded pair, with what it covers and when it expires. */
|
|
1269
|
-
"certificates": proxyCertificateViewSchema.array(),
|
|
1270
|
-
/** Every DNS account a route may name. Optional: an older panel omits it. */
|
|
1271
|
-
"dnsAccounts?": proxyDnsAccountViewSchema.array()
|
|
1272
|
-
}).onDeepUndeclaredKey("ignore"));
|
|
1273
|
-
/**
|
|
1274
|
-
* A route as a patch sends it: every field optional, so a client may change one
|
|
1275
|
-
* member of a route — or add a route with only the two fields that matter.
|
|
1276
|
-
*/
|
|
1277
|
-
var proxyRoutePatchSchema = lazy(() => type({
|
|
1278
|
-
id: "string",
|
|
1279
|
-
host: "string",
|
|
1280
|
-
enabled: "boolean?",
|
|
1281
|
-
target: proxyTargetSchema.optional(),
|
|
1282
|
-
workspace: "string?",
|
|
1283
|
-
server: "string?",
|
|
1284
|
-
url: "string?",
|
|
1285
|
-
path: "string?",
|
|
1286
|
-
tls: proxyTlsModeSchema.optional(),
|
|
1287
|
-
dnsAccount: "string?"
|
|
1288
|
-
}).onUndeclaredKey("reject"));
|
|
1289
|
-
/**
|
|
1290
|
-
* The proxy block as a patch: no defaults, and `routes` is a list a patch
|
|
1291
|
-
* **replaces** — a key-by-key merge cannot express removing a route.
|
|
1292
|
-
*/
|
|
1293
|
-
var proxyPatchSchema = lazy(() => type({
|
|
1294
|
-
enabled: "boolean?",
|
|
1295
|
-
engine: proxyEngineSchema.optional(),
|
|
1296
|
-
httpPort: "1 <= number.integer <= 65535?",
|
|
1297
|
-
httpsPort: "1 <= number.integer <= 65535?",
|
|
1298
|
-
email: "string?",
|
|
1299
|
-
staging: "boolean?",
|
|
1300
|
-
/**
|
|
1301
|
-
* A patch shape, not the config's: both keys are optional and merge, so a client
|
|
1302
|
-
* may send one without resetting the other, and an explicit `null` clears a key.
|
|
1303
|
-
*/
|
|
1304
|
-
dns01: type({
|
|
1305
|
-
enabled: "boolean | null?",
|
|
1306
|
-
resolvers: "string[] | null?"
|
|
1307
|
-
}).onUndeclaredKey("reject").optional(),
|
|
1308
|
-
certificates: proxyCertificateSchema.array().optional(),
|
|
1309
|
-
routes: proxyRoutePatchSchema.array().optional()
|
|
1310
|
-
}).onUndeclaredKey("reject"));
|
|
1311
|
-
/** `PUT /api/proxy/certificates/:id`: the pair itself, plus what to call it. */
|
|
1312
|
-
var proxyCertificateUploadSchema = lazy(() => type({
|
|
1313
|
-
label: "string = \"\"",
|
|
1314
|
-
certificate: "string >= 1",
|
|
1315
|
-
privateKey: "string >= 1"
|
|
1316
|
-
}).onUndeclaredKey("reject"));
|
|
1317
|
-
/** `POST /api/proxy/engine`: which release to install; empty means the current one. */
|
|
1318
|
-
var proxyEngineInstallSchema = lazy(() => type({ version: "string = \"\"" }).onUndeclaredKey("reject"));
|
|
1319
|
-
/** The policy columns a destination row carries — the values a send will actually use. */
|
|
1320
1572
|
var notificationPolicyStatusShape = {
|
|
1321
1573
|
onCrash: "boolean",
|
|
1322
1574
|
onUnhealthy: "boolean",
|
|
1323
1575
|
onForcedRestart: "boolean",
|
|
1324
1576
|
onRecovered: "boolean",
|
|
1325
|
-
/** Host vitals breaches (disk, memory, swap, load, temperature). */
|
|
1326
1577
|
onHost: "boolean",
|
|
1327
1578
|
/** Dynamic DNS, when this panel knows about it (optional for an older panel). */
|
|
1328
1579
|
onDdns: "boolean?",
|
|
1329
1580
|
cooldownMs: "number"
|
|
1330
1581
|
};
|
|
1331
|
-
/**
|
|
1332
|
-
* One destination as the page reads it: the fields it owns, the policy it will use, and the outcome
|
|
1333
|
-
* of the last send to it.
|
|
1334
|
-
*
|
|
1335
|
-
* The policy here is the **effective** one — inherited from the general block when
|
|
1336
|
-
* `useOwnSettings` is false — so the page shows what will happen, not what is stored.
|
|
1337
|
-
*/
|
|
1582
|
+
/** One destination with its effective policy (inherited when `useOwnSettings` is false) and last send outcome. */
|
|
1338
1583
|
var destinationStatusSchema = lazy(() => type({
|
|
1339
1584
|
"id": "string",
|
|
1340
1585
|
"kind": "\"telegram\" | \"webhook\"",
|
|
@@ -1343,7 +1588,6 @@ var destinationStatusSchema = lazy(() => type({
|
|
|
1343
1588
|
...notificationPolicyStatusShape,
|
|
1344
1589
|
/** Telegram only, null on a webhook. */
|
|
1345
1590
|
"chatId": "string | null",
|
|
1346
|
-
/** Telegram only: whether a bot token is stored for this destination. */
|
|
1347
1591
|
"tokenSet": "boolean",
|
|
1348
1592
|
/** Webhook only, null on a Telegram destination. */
|
|
1349
1593
|
"url": "string | null",
|
|
@@ -1354,73 +1598,86 @@ var destinationStatusSchema = lazy(() => type({
|
|
|
1354
1598
|
"lastResult?": "string | null",
|
|
1355
1599
|
"lastResultAt?": "number | null"
|
|
1356
1600
|
}));
|
|
1357
|
-
/**
|
|
1358
|
-
* The chats a bot can see, as `POST /notifications/destinations/:id/detect-chats` answers them.
|
|
1359
|
-
*
|
|
1360
|
-
* This was declared inline in the route while `TelegramChat` in `providers/telegram.ts` described the
|
|
1361
|
-
* same two fields — one shape written twice, which is the drift this file exists to prevent.
|
|
1362
|
-
*/
|
|
1601
|
+
/** The chats a bot can see, as `POST /notifications/destinations/:id/detect-chats` answers them. */
|
|
1363
1602
|
var telegramChatsSchema = lazy(() => type({ chats: type({
|
|
1364
1603
|
id: "string | number",
|
|
1365
1604
|
title: "string"
|
|
1366
1605
|
}).array() }));
|
|
1367
1606
|
var notificationViewSchema = lazy(() => type({
|
|
1368
|
-
/** The general block: what a destination inherits unless it overrides it. Optional for an older panel. */
|
|
1369
1607
|
"defaults?": notificationDefaultsViewSchema,
|
|
1370
|
-
/** Every destination, in config order. Optional for an older panel. */
|
|
1371
1608
|
"destinations?": destinationStatusSchema.array()
|
|
1372
1609
|
}));
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
usingDefaultPassword: "boolean",
|
|
1380
|
-
/** The boot-time password, exposed only while it is still in use. */
|
|
1381
|
-
defaultPassword: "string | null",
|
|
1382
|
-
sessionTtlMs: "number"
|
|
1610
|
+
/** What answered a request: the browser's session cookie, an API token, or this machine with auth unarmed. */
|
|
1611
|
+
var credentialKindSchema = lazy(() => type.enumerated("session", "token", "local"));
|
|
1612
|
+
/** Which credential answered; `name` is an API token's readable head, absent otherwise. */
|
|
1613
|
+
var credentialViewSchema = lazy(() => type({
|
|
1614
|
+
"kind": credentialKindSchema,
|
|
1615
|
+
"name?": "string"
|
|
1383
1616
|
}));
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1617
|
+
var sessionViewSchema = lazy(() => type({
|
|
1618
|
+
"authenticated": "boolean",
|
|
1619
|
+
"authRequired": "boolean",
|
|
1620
|
+
/** Whether any account can sign in — what arms authentication. */
|
|
1621
|
+
"passwordSet": "boolean",
|
|
1622
|
+
/** Whether any account exists. Kept for a client that branched on the old token field. */
|
|
1623
|
+
"apiTokenSet": "boolean?",
|
|
1624
|
+
"usingDefaultPassword": "boolean",
|
|
1625
|
+
"accountId?": "string",
|
|
1626
|
+
/** Never sent over the API (the first-run password is shown on the machine), so always absent. */
|
|
1627
|
+
"defaultPassword?": "string",
|
|
1628
|
+
"sessionTtlMs": "number",
|
|
1629
|
+
"credential?": credentialViewSchema
|
|
1388
1630
|
}));
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1631
|
+
/** `GET /api/meta`: release, API version, the caller's credential and refusals, live features, error codes and event names. */
|
|
1632
|
+
var metaViewSchema = lazy(() => type({
|
|
1633
|
+
version: "string",
|
|
1634
|
+
/** The response-shape version; bumped only when an older client cannot read a change. */
|
|
1635
|
+
apiVersion: "number.integer",
|
|
1636
|
+
credential: credentialViewSchema,
|
|
1637
|
+
/** Who this is, as a history event names them: `user`, `agent` or `policy`. */
|
|
1638
|
+
actor: "string",
|
|
1639
|
+
/** Actions this credential may not take: empty for a session and `local`; an API token is refused the takeover paths. */
|
|
1640
|
+
refused: "string[]",
|
|
1641
|
+
features: type({
|
|
1642
|
+
proxy: "boolean",
|
|
1643
|
+
/** Dynamic DNS, on if any workspace has it enabled (`workspace.ddns.enabled`). */
|
|
1644
|
+
ddns: "boolean",
|
|
1645
|
+
/** The WSL2 temperature bridge is configured (`host.tempCommand` names one). */
|
|
1646
|
+
temperature: "boolean"
|
|
1647
|
+
}),
|
|
1648
|
+
errorCodes: "string[]",
|
|
1649
|
+
events: "string[]"
|
|
1650
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
1396
1651
|
var serverStatusSchema = lazy(() => type("\"stopped\" | \"starting\" | \"running\" | \"stopping\" | \"backoff\" | \"crashed\" | \"conflict\""));
|
|
1397
1652
|
var healthStateSchema = lazy(() => type("\"disabled\" | \"unknown\" | \"healthy\" | \"unhealthy\""));
|
|
1398
1653
|
var portStateSchema = lazy(() => type("\"unknown\" | \"free\" | \"in-use\""));
|
|
1399
1654
|
var logStreamSchema = lazy(() => type("\"stdout\" | \"stderr\" | \"system\""));
|
|
1400
1655
|
var logLineSchema = lazy(() => type({
|
|
1401
|
-
ts: "number",
|
|
1402
|
-
stream: logStreamSchema,
|
|
1403
|
-
text: "string"
|
|
1656
|
+
"ts": "number",
|
|
1657
|
+
"stream": logStreamSchema,
|
|
1658
|
+
"text": "string",
|
|
1659
|
+
/** `GET /api/logs/:id` only: this line's position, to pass back as `?after=`/`?before=`. */
|
|
1660
|
+
"cursor?": "string"
|
|
1404
1661
|
}));
|
|
1405
|
-
/**
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
*/
|
|
1662
|
+
/** One run and the lines it wrote; `truncated` when only the newest of them are here. */
|
|
1663
|
+
var jobRunDetailSchema = lazy(() => type({
|
|
1664
|
+
"run": jobRunSchema,
|
|
1665
|
+
"lines": logLineSchema.array(),
|
|
1666
|
+
"truncated?": "boolean"
|
|
1667
|
+
}).onDeepUndeclaredKey("ignore"));
|
|
1668
|
+
/** Who caused an event: `policy` is the panel itself, `user` a session, `agent` an API token, `boot` autostart. */
|
|
1412
1669
|
var historyActorSchema = lazy(() => type.enumerated("policy", "user", "agent", "boot"));
|
|
1413
1670
|
var historyEventSchema = lazy(() => type({
|
|
1414
1671
|
"serverId": "string",
|
|
1415
1672
|
"ts": "number",
|
|
1416
|
-
"type": "\"start\" | \"exit\" | \"crash\" | \"forced-restart\" | \"unhealthy\" | \"recovered\"",
|
|
1673
|
+
"type": "\"start\" | \"exit\" | \"crash\" | \"forced-restart\" | \"unhealthy\" | \"recovered\" | \"deploy\"",
|
|
1417
1674
|
"detail": "string",
|
|
1418
|
-
/** How long the process had been up, recorded on exit and
|
|
1675
|
+
/** How long the process had been up, recorded on exit, crash and deploy. */
|
|
1419
1676
|
"runtimeMs": "number?",
|
|
1420
|
-
/**
|
|
1677
|
+
/** How a `deploy` ended. */
|
|
1678
|
+
"outcome?": "\"ok\" | \"failed\"",
|
|
1421
1679
|
"actor?": historyActorSchema
|
|
1422
1680
|
}));
|
|
1423
|
-
/** Rolling window stats derived from the persisted event log. */
|
|
1424
1681
|
var serverHistorySchema = lazy(() => type({
|
|
1425
1682
|
windowMs: "number",
|
|
1426
1683
|
/** Share of the window the process was up (null when nothing is known yet). */
|
|
@@ -1431,347 +1688,65 @@ var serverHistorySchema = lazy(() => type({
|
|
|
1431
1688
|
lastCrashAt: "number | null",
|
|
1432
1689
|
lastExitAt: "number | null",
|
|
1433
1690
|
lastRuntimeMs: "number | null",
|
|
1434
|
-
events: historyEventSchema.array()
|
|
1435
|
-
}));
|
|
1436
|
-
var processResourcesSchema = lazy(() => type({
|
|
1437
|
-
cpuPercent: "number | null",
|
|
1438
|
-
/** RSS of the process and its descendants. */
|
|
1439
|
-
rssBytes: "number | null",
|
|
1440
|
-
processes: "number",
|
|
1441
|
-
sampledAt: "number"
|
|
1442
|
-
}));
|
|
1443
|
-
var hostDiskSchema = lazy(() => type({
|
|
1444
|
-
path: "string",
|
|
1445
|
-
totalBytes: "number",
|
|
1446
|
-
freeBytes: "number",
|
|
1447
|
-
usedPercent: "number"
|
|
1448
|
-
}));
|
|
1449
|
-
var hostViewSchema = lazy(() => type({
|
|
1450
|
-
"enabled": "boolean",
|
|
1451
|
-
"cpus": "number",
|
|
1452
|
-
"loadAvg": type("number[]"),
|
|
1453
|
-
/**
|
|
1454
|
-
* Share of this machine's CPU capacity in use over the last sampling interval, 0–100.
|
|
1455
|
-
*
|
|
1456
|
-
* Optional: an older panel sends no such field, and a required one rejects the whole frame and
|
|
1457
|
-
* blanks the UI that panel is serving. `null` on the first sample, which has no window to
|
|
1458
|
-
* measure yet — a number there would be invented.
|
|
1459
|
-
*/
|
|
1460
|
-
"cpuUsedPercent?": "number | null",
|
|
1461
|
-
"uptimeMs": "number",
|
|
1462
|
-
"memoryUsedPercent": "number",
|
|
1463
|
-
"swapUsedPercent": "number",
|
|
1464
|
-
"tempCelsius": "number | null",
|
|
1465
|
-
"disks": hostDiskSchema.array(),
|
|
1466
|
-
/** Human readable threshold breaches, for the banner and notifications. */
|
|
1467
|
-
"alerts": type("string[]"),
|
|
1468
|
-
"sampledAt": "number | null",
|
|
1469
|
-
/**
|
|
1470
|
-
* The per-cpu load this panel notifies on — `host.loadPerCpu`, the number the alert fires at.
|
|
1471
|
-
*
|
|
1472
|
-
* Optional: a panel that predates this field alerts on the default, which is what the UI's band
|
|
1473
|
-
* assumes when the field is absent. It travels here because the frame is the only thing a host
|
|
1474
|
-
* surface reads, and a surface that cannot see the threshold hardcoded `2`/`1.4` — so raising
|
|
1475
|
-
* the threshold in Settings left the tile painting a healthy box `danger` while the alert the
|
|
1476
|
-
* threshold governs stayed silent. `0` disables the alert, so nothing can breach it.
|
|
1477
|
-
*/
|
|
1478
|
-
"loadAlertPerCpu?": "number",
|
|
1479
|
-
/**
|
|
1480
|
-
* The percentage alert thresholds — `host.diskUsedPercent`, `host.memoryUsedPercent`,
|
|
1481
|
-
* `host.swapUsedPercent` and `host.tempCelsius` — the numbers the panel notifies at.
|
|
1482
|
-
*
|
|
1483
|
-
* Optional for the same reason as `loadAlertPerCpu`, and carried for the same reason: a surface
|
|
1484
|
-
* that cannot see the threshold has to invent one, and the invented ones disagreed with the
|
|
1485
|
-
* panel's verdict. The swap bar called 50% `warn` while the alert fired there; raising
|
|
1486
|
-
* `host.tempCelsius` to 95 left a 90 °C box painted `danger` for a notification that never
|
|
1487
|
-
* arrives; and a disk threshold lowered to 80 notified at 82% while every disk bar called it
|
|
1488
|
-
* `warn`. `0` disables that alert, so nothing can breach it.
|
|
1489
|
-
*/
|
|
1490
|
-
"memoryUsedPercentAlert?": "number",
|
|
1491
|
-
"swapUsedPercentAlert?": "number",
|
|
1492
|
-
"tempCelsiusAlert?": "number",
|
|
1493
|
-
/**
|
|
1494
|
-
* `host.diskUsedPercent`, the threshold a filesystem is banded against.
|
|
1495
|
-
*
|
|
1496
|
-
* It travels once for the frame rather than per disk: the threshold is one config value that
|
|
1497
|
-
* applies to every configured path, which is why `hostReadings` copies it onto each disk's `band`.
|
|
1498
|
-
*/
|
|
1499
|
-
"diskUsedPercentAlert?": "number"
|
|
1500
|
-
}));
|
|
1501
|
-
/**
|
|
1502
|
-
* The WSL2 temperature bridge, as the settings page reports it.
|
|
1503
|
-
*
|
|
1504
|
-
* A WSL2 guest cannot read a CPU temperature at all, so the panel offers to install a Windows-side
|
|
1505
|
-
* helper and point `host.tempCommand` at it. `supported` is false on any other platform, which is
|
|
1506
|
-
* how the UI hides the whole block rather than offering a button that cannot work.
|
|
1507
|
-
*/
|
|
1508
|
-
var wslTemperatureSchema = lazy(() => type({
|
|
1509
|
-
/** This process runs under WSL. */
|
|
1510
|
-
"wsl": "boolean",
|
|
1511
|
-
/** The setup can work here — the same as `wsl` today, separate so a future bridge can differ. */
|
|
1512
|
-
"supported": "boolean",
|
|
1513
|
-
/** `host.tempCommand` already names a command. */
|
|
1514
|
-
"configured": "boolean",
|
|
1515
|
-
/** The helper script exists on disk. */
|
|
1516
|
-
"scriptWritten": "boolean",
|
|
1517
|
-
/** LibreHardwareMonitor was found on the Windows side. */
|
|
1518
|
-
"libraryPresent": "boolean",
|
|
1519
|
-
/** Where the helper was written, for the sentence that tells a person what to delete. */
|
|
1520
|
-
"scriptPath": "string | null",
|
|
1521
|
-
/** The command the panel would run, absent until it is configured. */
|
|
1522
|
-
"tempCommand?": "string | null",
|
|
1523
|
-
/** The last probe's reading, so the page can say "this works" without running it again. */
|
|
1524
|
-
"lastReadingCelsius?": "number | null",
|
|
1525
|
-
/** Why the last probe failed, if it did — a missing library and no sensor read differently. */
|
|
1526
|
-
"lastError?": "string | null",
|
|
1527
|
-
/**
|
|
1528
|
-
* The library is missing and installing it needs consent.
|
|
1529
|
-
*
|
|
1530
|
-
* The panel will not download a third-party binary on a click that did not mention one, so the
|
|
1531
|
-
* first press answers `needsDownload` and the page asks. Absent on an older panel.
|
|
1532
|
-
*/
|
|
1533
|
-
"needsDownload?": "boolean"
|
|
1534
|
-
}));
|
|
1535
|
-
var backupFileSchema = lazy(() => type({
|
|
1536
|
-
name: "string",
|
|
1537
|
-
sizeBytes: "number",
|
|
1538
|
-
createdAt: "number",
|
|
1539
|
-
/** The archive carries a password-protected payload. */
|
|
1540
|
-
encrypted: "boolean"
|
|
1541
|
-
}));
|
|
1542
|
-
/**
|
|
1543
|
-
* One selectable entry in a backup: a global item (`global:settings`,
|
|
1544
|
-
* `global:secrets`, `global:tls`) or a workspace, whose `items` are the
|
|
1545
|
-
* sub-choices a per-workspace dialog offers.
|
|
1546
|
-
*/
|
|
1547
|
-
var backupEntrySchema = lazy(() => type({
|
|
1548
|
-
/** `global:settings` | `global:secrets` | `global:tls` | `workspace:<id>`. */
|
|
1549
|
-
"id": "string",
|
|
1550
|
-
/**
|
|
1551
|
-
* The panel's own English wording. Kept because it is what an older UI reads, and what a
|
|
1552
|
-
* single-language UI wants; a translated UI prefers the `*Key` beside it.
|
|
1553
|
-
*/
|
|
1554
|
-
"label": "string",
|
|
1555
|
-
/** A catalog key for `label`, with its placeholder values, so a UI can render its own language. */
|
|
1556
|
-
"labelKey?": "string",
|
|
1557
|
-
"labelParams?": "Record<string, string>",
|
|
1558
|
-
"kind": "\"settings\" | \"secrets\" | \"tls\" | \"workspace\"",
|
|
1559
|
-
"workspaceId?": "string",
|
|
1560
|
-
"note": "string | null",
|
|
1561
|
-
/** The same pair for `note`: the panel knows which reason it is, the UI knows the wording. */
|
|
1562
|
-
"noteKey?": "string",
|
|
1563
|
-
"noteParams?": "Record<string, string>",
|
|
1564
|
-
/** What this entry would capture; a workspace carries several leaves. */
|
|
1565
|
-
"items": type({
|
|
1566
|
-
"id": "string",
|
|
1567
|
-
"label": "string",
|
|
1568
|
-
"labelKey?": "string",
|
|
1569
|
-
"labelParams?": "Record<string, string>",
|
|
1570
|
-
/** `settings`/`servers`/`secrets` for a workspace, `data` for a declared path. */
|
|
1571
|
-
"kind": "\"settings\" | \"servers\" | \"secrets\" | \"data\"",
|
|
1572
|
-
/** Which secret a `secrets` leaf carries (`password`, `apiToken`, `telegram`, `ddns`, …). */
|
|
1573
|
-
"secret?": "string",
|
|
1574
|
-
"path?": "string",
|
|
1575
|
-
/** Who declared a data path: `global`, `<serverId>:backupPaths` or `<serverId>:<ENV>`. */
|
|
1576
|
-
"origin?": "string",
|
|
1577
|
-
"included": "boolean",
|
|
1578
|
-
"note": "string | null",
|
|
1579
|
-
"noteKey?": "string",
|
|
1580
|
-
"noteParams?": "Record<string, string>",
|
|
1581
|
-
"ignoreGenerated?": "boolean"
|
|
1582
|
-
}).array()
|
|
1583
|
-
}));
|
|
1584
|
-
/**
|
|
1585
|
-
* The schedule as a *response* carries it: undeclared keys are accepted, at both levels.
|
|
1586
|
-
*
|
|
1587
|
-
* A response schema may not reject (a newer panel may add a field an older client still reads), and
|
|
1588
|
-
* `scope` is one level deep — so the outer `.onUndeclaredKey` on the config schema is not enough:
|
|
1589
|
-
* a frame carrying `schedule.scope` rejected outright while this was the config shape.
|
|
1590
|
-
*/
|
|
1591
|
-
var backupScheduleViewSchema = lazy(() => backupScheduleSchema.onDeepUndeclaredKey("ignore"));
|
|
1592
|
-
var backupsViewSchema = lazy(() => type({
|
|
1593
|
-
"enabled": "boolean",
|
|
1594
|
-
"dir": "string",
|
|
1595
|
-
"keep": "number",
|
|
1596
|
-
/**
|
|
1597
|
-
* The scheduled half, so the page can show and edit it.
|
|
1598
|
-
*
|
|
1599
|
-
* Optional because the panel and the UI upgrade separately: an older panel does not send it,
|
|
1600
|
-
* and a required field would blank the settings page for that panel. The page reads it as
|
|
1601
|
-
* "off, keep 7" when absent — the schema defaults — so nothing changes for it.
|
|
1602
|
-
*/
|
|
1603
|
-
"schedule?": backupScheduleViewSchema,
|
|
1604
|
-
/** When the last automatic archive was written; null until one has run. Optional for the same reason. */
|
|
1605
|
-
"lastAutomaticAt?": "number | null",
|
|
1606
|
-
/**
|
|
1607
|
-
* Why the last scheduled pass failed, and when it tried.
|
|
1608
|
-
*
|
|
1609
|
-
* A failed pass wrote only a panel-console warning, so "enabled, zero archives" looked the same
|
|
1610
|
-
* as "failing every interval since the day it was enabled" — indistinguishable from the page,
|
|
1611
|
-
* which is the only place a person looks. Null once a pass succeeds.
|
|
1612
|
-
*/
|
|
1613
|
-
"scheduleError?": type({
|
|
1614
|
-
message: "string",
|
|
1615
|
-
at: "number"
|
|
1616
|
-
}),
|
|
1617
|
-
/** Extra paths from the global config, in addition to each server's own. */
|
|
1618
|
-
"includePaths": type("string[]"),
|
|
1619
|
-
/**
|
|
1620
|
-
* The selection model, carried here only by a panel older than this release.
|
|
1621
|
-
*
|
|
1622
|
-
* Reading it costs a `readFileSync` of the global and every workspace's `.secrets.json` plus a
|
|
1623
|
-
* `statSync` per archive, and the state frame is rebuilt ~13×/s — so it moved to
|
|
1624
|
-
* `GET /api/backups` (`backupSelectionSchema`), which a dialog fetches when it opens. Optional on
|
|
1625
|
-
* purpose: a newer UI reads a panel that still sends it, and a UI must never reject a payload for
|
|
1626
|
-
* a field it does not use. Absent means "ask the endpoint".
|
|
1627
|
-
*/
|
|
1628
|
-
"entries?": backupEntrySchema.array(),
|
|
1629
|
-
"files?": backupFileSchema.array()
|
|
1630
|
-
}));
|
|
1631
|
-
/**
|
|
1632
|
-
* The backup *selection model*: what a capture could include, and what is already on disk.
|
|
1633
|
-
*
|
|
1634
|
-
* Its own route rather than a field of the state frame, because building it reads every workspace's
|
|
1635
|
-
* secrets file and stats every archive — work proportional to workspaces × archives, on a path that
|
|
1636
|
-
* runs per frame. A dialog needs it when it opens and not otherwise.
|
|
1637
|
-
*/
|
|
1638
|
-
var backupSelectionSchema = lazy(() => type({
|
|
1639
|
-
/** The archive directory, so a dialog can print the path without a second read. */
|
|
1640
|
-
dir: "string",
|
|
1641
|
-
/** Every selectable entry, global first, then each workspace. */
|
|
1642
|
-
entries: backupEntrySchema.array(),
|
|
1643
|
-
files: backupFileSchema.array()
|
|
1644
|
-
}));
|
|
1645
|
-
/** One restorable slice of an archive: a global item, a workspace item, or a data path. */
|
|
1646
|
-
var restoreItemSchema = lazy(() => type({
|
|
1647
|
-
/** A backup entry or leaf id (`workspace:<id>:servers`, `data:<path>`, ...). */
|
|
1648
|
-
"id": "string",
|
|
1649
|
-
"label": "string",
|
|
1650
|
-
"labelKey?": "string",
|
|
1651
|
-
"labelParams?": "Record<string, string>",
|
|
1652
|
-
"kind": "\"settings\" | \"secrets\" | \"servers\" | \"tls\" | \"data\"",
|
|
1653
|
-
"workspaceId?": "string",
|
|
1654
|
-
/** false when the current instance does not declare it, or it is not in the archive. */
|
|
1655
|
-
"restorable": "boolean",
|
|
1656
|
-
/** Echo of the request's selection, so the checkboxes round-trip. */
|
|
1657
|
-
"selected": "boolean",
|
|
1658
|
-
"note": "string | null",
|
|
1659
|
-
"noteKey?": "string",
|
|
1660
|
-
"noteParams?": "Record<string, string>"
|
|
1691
|
+
events: historyEventSchema.array()
|
|
1661
1692
|
}));
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
*/
|
|
1669
|
-
var restoreSkipSchema = lazy(() => type({
|
|
1670
|
-
"label": "string",
|
|
1671
|
-
"labelKey?": "string",
|
|
1672
|
-
"labelParams?": "Record<string, string>",
|
|
1673
|
-
/** A catalog key for the parenthesis, e.g. `not selected`; absent when there is none. */
|
|
1674
|
-
"reasonKey?": "string",
|
|
1675
|
-
"reasonParams?": "Record<string, string>"
|
|
1693
|
+
var processResourcesSchema = lazy(() => type({
|
|
1694
|
+
cpuPercent: "number | null",
|
|
1695
|
+
/** RSS of the process and its descendants. */
|
|
1696
|
+
rssBytes: "number | null",
|
|
1697
|
+
processes: "number",
|
|
1698
|
+
sampledAt: "number"
|
|
1676
1699
|
}));
|
|
1677
|
-
var
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
/**
|
|
1683
|
-
* Where the archive says it came from. Optional: an archive written before this
|
|
1684
|
-
* stamp existed carries neither field, and an older panel never sends the row.
|
|
1685
|
-
*/
|
|
1686
|
-
"archive?": type({
|
|
1687
|
-
"writtenBy?": "string",
|
|
1688
|
-
"schema?": "number"
|
|
1689
|
-
}),
|
|
1690
|
-
"items": restoreItemSchema.array(),
|
|
1691
|
-
/**
|
|
1692
|
-
* One row per backup hook that ran, so a person can see which entries brought their own dump.
|
|
1693
|
-
*
|
|
1694
|
-
* Optional, like every new response field: an older panel never sends it and an older UI never
|
|
1695
|
-
* reads it. `output` is a bounded tail, not a log — enough to see what `mongorestore` said.
|
|
1696
|
-
*/
|
|
1697
|
-
"hooks?": type({
|
|
1698
|
-
"serverId": "string",
|
|
1699
|
-
"workspaceId": "string",
|
|
1700
|
-
"action": "\"dump\" | \"load\"",
|
|
1701
|
-
"ok": "boolean",
|
|
1702
|
-
"output?": "string"
|
|
1703
|
-
}).array(),
|
|
1704
|
-
"applied": type("string[]"),
|
|
1705
|
-
/**
|
|
1706
|
-
* The ids `applied` names, so a UI resolves each through `items` and renders its own label.
|
|
1707
|
-
* `applied` itself stays: it is what a UI with one language reads.
|
|
1708
|
-
*/
|
|
1709
|
-
"appliedIds?": type("string[]"),
|
|
1710
|
-
"skipped": type("string[]"),
|
|
1711
|
-
"skippedItems?": restoreSkipSchema.array(),
|
|
1712
|
-
/** Only the panel's own listener needs a restart; its servers are re-read live. */
|
|
1713
|
-
"restartRequired": "boolean",
|
|
1714
|
-
/** The panel re-read the restored config within this same restore. */
|
|
1715
|
-
"reloaded": "boolean",
|
|
1716
|
-
/**
|
|
1717
|
-
* Servers that are **running now** and whose declared data path this restore overwrote.
|
|
1718
|
-
*
|
|
1719
|
-
* A data path is copied over while its owner keeps running, holding open handles to files
|
|
1720
|
-
* that were just replaced — the process keeps its old view and the archive's copy wins on
|
|
1721
|
-
* disk, so anything written since the archive was taken is gone. The plan has to say which
|
|
1722
|
-
* entries that happened to, because nothing else in the result mentions them.
|
|
1723
|
-
*
|
|
1724
|
-
* Optional: an older panel does not send it, and a plan that touched no running entry sends none.
|
|
1725
|
-
*/
|
|
1726
|
-
"replacedUnderRunning?": type({
|
|
1727
|
-
workspaceId: "string",
|
|
1728
|
-
serverId: "string",
|
|
1729
|
-
path: "string"
|
|
1730
|
-
}).array(),
|
|
1731
|
-
/**
|
|
1732
|
-
* Workspaces this restore created because the archive named them and the host did not
|
|
1733
|
-
* have them. Optional: an older panel never sends the row, and an archive written
|
|
1734
|
-
* before the registry was captured creates none.
|
|
1735
|
-
*/
|
|
1736
|
-
"createdWorkspaces?": type("string[]"),
|
|
1737
|
-
"error": "string?"
|
|
1700
|
+
var hostDiskSchema = lazy(() => type({
|
|
1701
|
+
path: "string",
|
|
1702
|
+
totalBytes: "number",
|
|
1703
|
+
freeBytes: "number",
|
|
1704
|
+
usedPercent: "number"
|
|
1738
1705
|
}));
|
|
1739
|
-
var
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1706
|
+
var hostViewSchema = lazy(() => type({
|
|
1707
|
+
"enabled": "boolean",
|
|
1708
|
+
"cpus": "number",
|
|
1709
|
+
"loadAvg": type("number[]"),
|
|
1710
|
+
/** Share of CPU capacity in use over the last interval, 0–100; `null` on the first sample. */
|
|
1711
|
+
"cpuUsedPercent?": "number | null",
|
|
1712
|
+
"uptimeMs": "number",
|
|
1713
|
+
"memoryUsedPercent": "number",
|
|
1714
|
+
"swapUsedPercent": "number",
|
|
1715
|
+
"tempCelsius": "number | null",
|
|
1716
|
+
"disks": hostDiskSchema.array(),
|
|
1717
|
+
"alerts": type("string[]"),
|
|
1718
|
+
"sampledAt": "number | null",
|
|
1719
|
+
/** `host.loadPerCpu`, the per-cpu load the alert fires at; `0` disables it. */
|
|
1720
|
+
"loadAlertPerCpu?": "number",
|
|
1721
|
+
/** The percentage alert thresholds from `host.*`, so a UI bands against the configured value; `0` disables. */
|
|
1722
|
+
"memoryUsedPercentAlert?": "number",
|
|
1723
|
+
"swapUsedPercentAlert?": "number",
|
|
1724
|
+
"tempCelsiusAlert?": "number",
|
|
1725
|
+
/** `host.diskUsedPercent`, sent once for the frame because it applies to every disk. */
|
|
1726
|
+
"diskUsedPercentAlert?": "number",
|
|
1758
1727
|
/**
|
|
1759
|
-
*
|
|
1760
|
-
*
|
|
1761
|
-
* `BackupService.restore()` has always taken it and the local channel has always sent it, but this
|
|
1762
|
-
* schema declared only `name`/`password`/`include` **and rejects undeclared keys**, so the same
|
|
1763
|
-
* request over `/api` answered `exclude must be removed`: a script or either UI could only say
|
|
1764
|
-
* "these items", never "everything except these", on the one path that overwrites a live host.
|
|
1765
|
-
*
|
|
1766
|
-
* Empty is refused for the same reason it is on a create — it reads as "nothing" to a person and
|
|
1767
|
-
* as "everything" to the reader, so it must not be sent at all.
|
|
1728
|
+
* Readings not taken on this sample (`load`, `memory`, `swap`). Their wire value stays `0` for older
|
|
1729
|
+
* UIs; `hostReadings` reports them as absent.
|
|
1768
1730
|
*/
|
|
1769
|
-
|
|
1770
|
-
})
|
|
1771
|
-
/**
|
|
1731
|
+
"unmeasured?": type("string[]")
|
|
1732
|
+
}));
|
|
1733
|
+
/** The WSL2 temperature bridge; `supported` is false off WSL, so the UI hides the block. */
|
|
1734
|
+
var wslTemperatureSchema = lazy(() => type({
|
|
1735
|
+
"wsl": "boolean",
|
|
1736
|
+
/** The setup can work here — the same as `wsl` today, separate so a future bridge can differ. */
|
|
1737
|
+
"supported": "boolean",
|
|
1738
|
+
"configured": "boolean",
|
|
1739
|
+
"scriptWritten": "boolean",
|
|
1740
|
+
"libraryPresent": "boolean",
|
|
1741
|
+
"scriptPath": "string | null",
|
|
1742
|
+
"tempCommand?": "string | null",
|
|
1743
|
+
"lastReadingCelsius?": "number | null",
|
|
1744
|
+
"lastError?": "string | null",
|
|
1745
|
+
/** The library is missing and downloading it needs the person's consent. */
|
|
1746
|
+
"needsDownload?": "boolean"
|
|
1747
|
+
}));
|
|
1772
1748
|
var serverViewSchema = lazy(() => type({
|
|
1773
1749
|
"id": "string",
|
|
1774
|
-
/** The workspace that owns it; optional so an older panel's frame still parses. */
|
|
1775
1750
|
"workspaceId?": "string",
|
|
1776
1751
|
"config": serverSchema,
|
|
1777
1752
|
"bindHost": "string",
|
|
@@ -1782,13 +1757,7 @@ var serverViewSchema = lazy(() => type({
|
|
|
1782
1757
|
"pid": "number | null",
|
|
1783
1758
|
/** True when the process serving this entry was adopted, not spawned by the panel. */
|
|
1784
1759
|
"adopted": "boolean?",
|
|
1785
|
-
/**
|
|
1786
|
-
* The panel stopped this entry because it could not serve, rather than someone asking.
|
|
1787
|
-
*
|
|
1788
|
-
* Optional, like every new field: an older panel does not send it. `/healthz` needs it because
|
|
1789
|
-
* the status alone cannot tell "the operator switched this off" (never a problem) from "the
|
|
1790
|
-
* panel gave up on it" (a broken service) — both are `stopped`.
|
|
1791
|
-
*/
|
|
1760
|
+
/** The panel stopped this entry because it could not serve, not because someone asked. */
|
|
1792
1761
|
"stoppedByPanel?": "boolean",
|
|
1793
1762
|
"startedAt": "number | null",
|
|
1794
1763
|
"exitCode": "number | null",
|
|
@@ -1796,19 +1765,21 @@ var serverViewSchema = lazy(() => type({
|
|
|
1796
1765
|
"restarts": "number",
|
|
1797
1766
|
"maxRetries": "number",
|
|
1798
1767
|
"lastError": "string | null",
|
|
1768
|
+
/** The failed run's last few stderr lines, oldest first, while the entry is crashed or backing off. */
|
|
1769
|
+
"lastStderr?": "string[]",
|
|
1799
1770
|
"nextRetryAt": "number | null",
|
|
1800
1771
|
"unhealthySince": "number | null",
|
|
1801
1772
|
"bufferedLines": "number",
|
|
1802
1773
|
"history": serverHistorySchema,
|
|
1803
|
-
/** Last health probe latency (TCP connect or HTTP request). */
|
|
1804
1774
|
"responseMs": "number | null",
|
|
1805
|
-
"resources": processResourcesSchema.or(type("null"))
|
|
1775
|
+
"resources": processResourcesSchema.or(type("null")),
|
|
1776
|
+
/** The declared secret names that have a stored value: names only, never a value. */
|
|
1777
|
+
"secretEnvSet?": "string[]",
|
|
1778
|
+
"deploy?": deployStatusSchema,
|
|
1779
|
+
/** The running process was started from a config that differs in a field a restart re-reads. */
|
|
1780
|
+
"restartRequired?": "boolean"
|
|
1806
1781
|
}).onDeepUndeclaredKey("ignore"));
|
|
1807
|
-
/**
|
|
1808
|
-
* What `/healthz` answers, on both statuses — 200 when serving, 503 when a server has crashed,
|
|
1809
|
-
* which shares this response's `content` in the spec. The detail fields are optional because they are
|
|
1810
|
-
* only included for an authenticated caller.
|
|
1811
|
-
*/
|
|
1782
|
+
/** What `/healthz` answers on 200 and 503; the detail fields are only for an authenticated caller. */
|
|
1812
1783
|
var healthResponseSchema = lazy(() => type({
|
|
1813
1784
|
"status": "\"ok\" | \"degraded\"",
|
|
1814
1785
|
"uptimeMs": "number",
|
|
@@ -1823,12 +1794,9 @@ var healthResponseSchema = lazy(() => type({
|
|
|
1823
1794
|
"home?": "string"
|
|
1824
1795
|
}));
|
|
1825
1796
|
var controlViewSchema = lazy(() => type({
|
|
1826
|
-
/** The configured panel name, for the shell to render. */
|
|
1827
1797
|
"label": "string",
|
|
1828
1798
|
"port": "number",
|
|
1829
|
-
/** The configured bind value (`local` | `lan` | ipv4). */
|
|
1830
1799
|
"host": "string",
|
|
1831
|
-
/** The address actually bound. */
|
|
1832
1800
|
"bindHost": "string",
|
|
1833
1801
|
"url": "string",
|
|
1834
1802
|
"openBrowser": "boolean",
|
|
@@ -1839,42 +1807,27 @@ var controlViewSchema = lazy(() => type({
|
|
|
1839
1807
|
"auth": authStatusSchema,
|
|
1840
1808
|
"tls": tlsStatusSchema
|
|
1841
1809
|
}));
|
|
1842
|
-
/**
|
|
1843
|
-
/**
|
|
1844
|
-
* A user-supplied UI, as the settings page shows it.
|
|
1845
|
-
*
|
|
1846
|
-
* Every field is optional, and none of them is a fallback: a `ui.json` may be written by
|
|
1847
|
-
* the panel (which adds `uploadedAt`/`files`) **or dropped in by hand** following
|
|
1848
|
-
* `docs/UI_CREATION.md`, which documents only the author-facing fields. Requiring ours
|
|
1849
|
-
* meant a hand-written file parsed to nothing at all, taking `repo`/`tag` with it and
|
|
1850
|
-
* silently disabling `ui-update` for exactly the UI that declared itself.
|
|
1851
|
-
*/
|
|
1810
|
+
/** A user-supplied UI's `ui.json`; every field optional because a hand-written one carries only the author fields. */
|
|
1852
1811
|
var uiMetaSchema = lazy(() => type({
|
|
1853
1812
|
"name?": "string",
|
|
1854
1813
|
"version?": "string | null",
|
|
1855
|
-
/** Set by the panel, not by the author. */
|
|
1856
1814
|
"uploadedAt?": "number",
|
|
1857
|
-
/** Counted by the panel, not declared. */
|
|
1858
1815
|
"files?": "number.integer >= 1",
|
|
1859
1816
|
/** `owner/name` of the UI's own repository, for `ui-update`. */
|
|
1860
1817
|
"repo?": "string",
|
|
1861
1818
|
/** The release tag this build came from, e.g. `v0.6.0`. Stamped by the build, never committed. */
|
|
1862
1819
|
"tag?": "string",
|
|
1863
|
-
/** The release asset name, e.g. `home-hosted-ui-noc-console`. */
|
|
1864
1820
|
"asset?": "string",
|
|
1865
1821
|
/** When the UI was built, in unix epoch seconds. Stamped by the build, never committed. */
|
|
1866
1822
|
"unix?": "number.integer >= 0"
|
|
1867
1823
|
}));
|
|
1868
1824
|
var uiStatusSchema = lazy(() => type({
|
|
1869
|
-
/** A user-supplied UI is being served instead of the stock one. */
|
|
1870
1825
|
custom: "boolean",
|
|
1871
|
-
/** Where that UI lives, whether or not it exists yet. */
|
|
1872
1826
|
dir: "string",
|
|
1873
1827
|
meta: uiMetaSchema.or(type("null"))
|
|
1874
1828
|
}));
|
|
1875
1829
|
/** One process a panel spawned that no configured entry claims any more. */
|
|
1876
1830
|
var serverOrphanSchema = lazy(() => type({
|
|
1877
|
-
/** The id it was started as, which is also the key of the state file it was found in. */
|
|
1878
1831
|
serverId: "string",
|
|
1879
1832
|
pid: "number",
|
|
1880
1833
|
/** When the panel spawned it; null when the record predates the stamp. */
|
|
@@ -1883,7 +1836,6 @@ var serverOrphanSchema = lazy(() => type({
|
|
|
1883
1836
|
var workspaceViewSchema = lazy(() => type({
|
|
1884
1837
|
"id": "string",
|
|
1885
1838
|
"label": "string",
|
|
1886
|
-
/** The workspace's servers config; the settings file sits beside it. */
|
|
1887
1839
|
"configPath": "string",
|
|
1888
1840
|
"settingsPath": "string",
|
|
1889
1841
|
"configError": "string | null",
|
|
@@ -1893,123 +1845,64 @@ var workspaceViewSchema = lazy(() => type({
|
|
|
1893
1845
|
"defaults": defaultsSchema,
|
|
1894
1846
|
"logs": logsSchema,
|
|
1895
1847
|
"notifications": notificationViewSchema,
|
|
1896
|
-
/** Dynamic DNS state. Optional so a newer UI still frames an older payload. */
|
|
1897
1848
|
"ddns?": ddnsStatusSchema,
|
|
1898
1849
|
"serverCount": "number",
|
|
1899
1850
|
"runningCount": "number",
|
|
1900
1851
|
"crashedCount": "number",
|
|
1901
|
-
/**
|
|
1902
|
-
* Processes this panel started that no current entry owns.
|
|
1903
|
-
*
|
|
1904
|
-
* A detached child outlives a hard panel death, and its handle is the entry-state file keyed by
|
|
1905
|
-
* the *id* it was started under. Rename the entry and nothing ever reads that file again; delete
|
|
1906
|
-
* the entry while the panel is down and the file is reclaimed, destroying the last handle. The
|
|
1907
|
-
* orphan then runs with no card, no `/healthz` line and no CLI action — for a queue consumer,
|
|
1908
|
-
* two consumers of the same queue. This is the view that makes it actionable.
|
|
1909
|
-
*
|
|
1910
|
-
* Optional: an older panel never sends it.
|
|
1911
|
-
*/
|
|
1852
|
+
/** Processes this panel started that no current entry owns (renamed or deleted while running). */
|
|
1912
1853
|
"orphans?": serverOrphanSchema.array(),
|
|
1913
|
-
"servers": serverViewSchema.array()
|
|
1854
|
+
"servers": serverViewSchema.array(),
|
|
1855
|
+
/** The workspace's jobs, live: what runs now, what runs next, how the last run ended. */
|
|
1856
|
+
"jobs?": jobEntryViewSchema.array(),
|
|
1857
|
+
"jobsError?": "string"
|
|
1914
1858
|
}).onDeepUndeclaredKey("ignore"));
|
|
1915
|
-
/**
|
|
1916
|
-
* The whole panel in one frame: global state plus every workspace. Workspace
|
|
1917
|
-
* pages read their own subtree; the global pages read across all of them.
|
|
1918
|
-
*/
|
|
1859
|
+
/** The whole panel in one frame: global state plus every workspace. */
|
|
1919
1860
|
var appStateSchema = lazy(() => type({
|
|
1920
1861
|
"control": controlViewSchema,
|
|
1921
1862
|
"host": hostViewSchema,
|
|
1922
1863
|
"backups": backupsViewSchema,
|
|
1923
1864
|
"ui": uiStatusSchema,
|
|
1924
1865
|
"workspaces": workspaceViewSchema.array(),
|
|
1925
|
-
/** The reverse proxy, when this panel has one. Optional: an older panel does not send it. */
|
|
1926
1866
|
"proxy?": proxyViewSchema,
|
|
1927
1867
|
/** The directory the panel was started from; relative entry paths use it. */
|
|
1928
1868
|
"projectDir": "string",
|
|
1929
|
-
/** `HHOSTED_HOME`: every file home-hosted owns lives under here. */
|
|
1930
1869
|
"dataRoot": "string",
|
|
1931
|
-
/** The
|
|
1870
|
+
/** The panel-wide `settings.json`, as the OS spells it. */
|
|
1871
|
+
"settingsPath?": "string",
|
|
1932
1872
|
"version?": "string",
|
|
1933
|
-
/**
|
|
1934
|
-
* The panel-wide `settings.json` could not be applied (a parse or schema error, or an edit refused
|
|
1935
|
-
* for exposing the panel); the running settings are kept. `null` when it is fine; absent on an
|
|
1936
|
-
* older panel.
|
|
1937
|
-
*/
|
|
1873
|
+
/** Why the panel-wide `settings.json` could not be applied (the running settings are kept); `null` when fine. */
|
|
1938
1874
|
"settingsError?": type({
|
|
1939
1875
|
message: "string",
|
|
1940
1876
|
path: "string"
|
|
1941
1877
|
}).or("null")
|
|
1942
1878
|
}).onDeepUndeclaredKey("ignore"));
|
|
1943
|
-
/**
|
|
1944
|
-
var
|
|
1945
|
-
|
|
1946
|
-
ts: "number",
|
|
1947
|
-
state: appStateSchema
|
|
1948
|
-
}).onDeepUndeclaredKey("ignore"));
|
|
1949
|
-
var serverFrameSchema = lazy(() => type({
|
|
1950
|
-
"type": "\"server\"",
|
|
1951
|
-
"ts": "number",
|
|
1952
|
-
"workspaceId?": "string",
|
|
1953
|
-
"serverId": "string",
|
|
1954
|
-
"server": serverViewSchema
|
|
1955
|
-
}).onDeepUndeclaredKey("ignore"));
|
|
1956
|
-
var logFrameSchema = lazy(() => type({
|
|
1957
|
-
"type": "\"log\"",
|
|
1958
|
-
"ts": "number",
|
|
1959
|
-
"workspaceId?": "string",
|
|
1960
|
-
"serverId": "string",
|
|
1961
|
-
"lines": logLineSchema.array()
|
|
1962
|
-
}).onDeepUndeclaredKey("ignore"));
|
|
1963
|
-
lazy(() => stateFrameSchema.or(serverFrameSchema).or(logFrameSchema));
|
|
1964
|
-
var logQuerySchema = lazy(() => type({ limit: "string?" }));
|
|
1965
|
-
/**
|
|
1966
|
-
* What a per-server lifecycle action answers with.
|
|
1967
|
-
*
|
|
1968
|
-
* `ok`/`error` are what the panel returns and every UI already reads; `code` was added so a
|
|
1969
|
-
* script can branch without matching English, and it is **absent on success** — a code names a
|
|
1970
|
-
* failure.
|
|
1971
|
-
*/
|
|
1879
|
+
/** `?limit=` on the buffered log route: a whole number of lines, 1–100000. */
|
|
1880
|
+
var logQuerySchema = lazy(() => type({ "limit?": integerParam(1, 1e5) }));
|
|
1881
|
+
/** A per-server lifecycle action's answer; `code` is absent on success. */
|
|
1972
1882
|
var actionResultSchema = lazy(() => type({
|
|
1973
1883
|
"ok": "boolean",
|
|
1974
1884
|
"error?": "string",
|
|
1975
1885
|
"message?": "string",
|
|
1976
|
-
"code?": "string"
|
|
1886
|
+
"code?": "string",
|
|
1887
|
+
/** On a successful stop: entries still running that declare `dependsOn` the one stopped. */
|
|
1888
|
+
"dependents?": "string[]"
|
|
1977
1889
|
}));
|
|
1978
|
-
/** Whether a probe (a test send, a token check) worked, and why not when it did not. */
|
|
1979
1890
|
var deliveryResultSchema = lazy(() => type({
|
|
1980
1891
|
"ok": "boolean",
|
|
1981
1892
|
"error?": "string"
|
|
1982
1893
|
}));
|
|
1983
|
-
/**
|
|
1984
|
-
var passwordSetResponseSchema = lazy(() => type({
|
|
1985
|
-
ok: "boolean",
|
|
1986
|
-
enabled: "boolean",
|
|
1987
|
-
sessionsInvalidated: "boolean"
|
|
1988
|
-
}));
|
|
1989
|
-
/**
|
|
1990
|
-
* What both TLS mutation routes answer: the panel's listener and the move that is in flight.
|
|
1991
|
-
*
|
|
1992
|
-
* Declared once because the two routes return the same `review()` body — the DELETE declared
|
|
1993
|
-
* `okResponseSchema` while returning this, so a generated client read `undefined` for every field.
|
|
1994
|
-
*/
|
|
1894
|
+
/** What both TLS mutation routes answer: the listener and the move in flight. */
|
|
1995
1895
|
var tlsReviewResponseSchema = lazy(() => type({
|
|
1996
1896
|
control: controlViewSchema,
|
|
1997
1897
|
rebinding: "boolean",
|
|
1998
1898
|
targetUrl: "string"
|
|
1999
1899
|
}));
|
|
2000
|
-
/**
|
|
2001
|
-
* The plain acknowledgement most mutations answer with.
|
|
2002
|
-
*
|
|
2003
|
-
* Defined once because a dozen routes return it, and each was declaring its own or none at all —
|
|
2004
|
-
* which is why the spec had untyped `200`s where a generated client needs a shape.
|
|
2005
|
-
*/
|
|
1900
|
+
/** The plain acknowledgement most mutations answer with. */
|
|
2006
1901
|
var okResponseSchema = lazy(() => type({ ok: "boolean" }));
|
|
2007
|
-
/** A backup was removed: the archive list it leaves behind. */
|
|
2008
1902
|
var backupFilesResponseSchema = lazy(() => type({
|
|
2009
1903
|
ok: "boolean",
|
|
2010
1904
|
files: backupFileSchema.array()
|
|
2011
1905
|
}));
|
|
2012
|
-
/** A UI build was installed (it also reports the build), or reverted. */
|
|
2013
1906
|
var uiInstallResponseSchema = lazy(() => type({
|
|
2014
1907
|
"ok": "boolean",
|
|
2015
1908
|
"meta?": uiStatusSchema.get("meta"),
|
|
@@ -2017,202 +1910,63 @@ var uiInstallResponseSchema = lazy(() => type({
|
|
|
2017
1910
|
/** Revert only: whether there was a custom UI to remove. */
|
|
2018
1911
|
"removed?": "boolean"
|
|
2019
1912
|
}));
|
|
2020
|
-
/** A backup was created: the new archive and the list it belongs to. */
|
|
2021
1913
|
var backupCreatedResponseSchema = lazy(() => type({
|
|
2022
1914
|
"file": backupFileSchema,
|
|
2023
1915
|
"files": backupFileSchema.array(),
|
|
2024
1916
|
/** Captured but worth a look: a declared path that holds no files. Optional: older panels never send it. */
|
|
2025
1917
|
"warnings?": "string[]"
|
|
2026
1918
|
}));
|
|
2027
|
-
/**
|
|
2028
|
-
* `POST /_hh/backups` without `confirm=true`: what a backup would capture, and nothing written.
|
|
2029
|
-
* The local channel plans by default; `POST /api/backups` creates at once.
|
|
2030
|
-
*/
|
|
1919
|
+
/** `POST /_hh/backups` without `confirm=true`: what a backup would capture, with nothing written. */
|
|
2031
1920
|
var backupPlanResponseSchema = lazy(() => type({
|
|
2032
1921
|
apply: "false",
|
|
2033
1922
|
entries: backupEntrySchema.array(),
|
|
2034
1923
|
includePaths: "string[]"
|
|
2035
1924
|
}));
|
|
2036
|
-
/** The local channel's answer: a plan, or the archive it wrote once confirmed. */
|
|
2037
1925
|
var backupLocalResponseSchema = lazy(() => backupPlanResponseSchema.or(backupCreatedResponseSchema));
|
|
2038
|
-
/** Buffered or persisted log lines, the shape every log-reading route returns. */
|
|
2039
|
-
/**
|
|
2040
|
-
* `GET /api/servers/:id/logs` — the **buffered** lines, straight from memory.
|
|
2041
|
-
*
|
|
2042
|
-
* It is not the disk history below: this route has no window, no rotation and no search, so it
|
|
2043
|
-
* answers `{ lines }` and nothing else. The schema used to be a copy of the disk shape
|
|
2044
|
-
* (`serverId`/`enabled`/`sizeBytes`/`files`/`searched`), so the documented response named five
|
|
2045
|
-
* fields the handler never sent — and `searched` was declared as an array here while the disk route
|
|
2046
|
-
* sends a number. `test/api/panel.test.ts` only walks routes it can reach with a live fixture and
|
|
2047
|
-
* skipped this one, so nothing caught it.
|
|
2048
|
-
*/
|
|
2049
|
-
var bufferedLogsResponseSchema = lazy(() => type({ lines: logLineSchema.array() }));
|
|
2050
|
-
/**
|
|
2051
|
-
* `GET /api/logs/:id` — one entry's log **from disk**, with its rotation and its search window.
|
|
2052
|
-
*
|
|
2053
|
-
* This is the shape the UIs parse (`logHistoryViewSchema` below is the same thing with its own
|
|
2054
|
-
* name for the client side), and it is what `logLinesResponseSchema` should always have been.
|
|
2055
|
-
*/
|
|
2056
|
-
var logLinesResponseSchema = lazy(() => type({
|
|
2057
|
-
serverId: "string",
|
|
2058
|
-
enabled: "boolean",
|
|
2059
|
-
sizeBytes: "number",
|
|
2060
|
-
/** The rotated files this entry has, newest first. */
|
|
2061
|
-
files: "string[]",
|
|
2062
|
-
/** How many lines the search looked at, or null when the request carried no `search`. */
|
|
2063
|
-
searched: "number | null",
|
|
2064
|
-
lines: logLineSchema.array()
|
|
2065
|
-
}));
|
|
2066
|
-
/**
|
|
2067
|
-
* One server's live resource reading, for `home-hosted usage`.
|
|
2068
|
-
*
|
|
2069
|
-
* `cpuPercent` and `rssBytes` are `number | null` because a reading can be absent — a process the
|
|
2070
|
-
* sampler has not seen yet, or one that just exited. Absent is **not** zero: a `0` here would read as
|
|
2071
|
-
* "idle" and hide a server that is not being measured at all.
|
|
2072
|
-
*/
|
|
2073
|
-
var usageEntrySchema = lazy(() => type({
|
|
2074
|
-
"id": "string",
|
|
2075
|
-
"workspaceId": "string",
|
|
2076
|
-
"label": "string",
|
|
2077
|
-
"status": serverStatusSchema,
|
|
2078
|
-
/** Absent when nothing is running or the sampler has no sample yet. */
|
|
2079
|
-
"cpuPercent?": "number",
|
|
2080
|
-
"rssBytes?": "number",
|
|
2081
|
-
/** Processes in this entry's tree, including an adopted successor's. */
|
|
2082
|
-
"processes?": "number",
|
|
2083
|
-
"sampledAt?": "number",
|
|
2084
|
-
/**
|
|
2085
|
-
* How the entry has behaved over the panel's history window, so `usage` can answer "is this
|
|
2086
|
-
* restarting every few minutes" and not only "what is it using right now". Copied from the same
|
|
2087
|
-
* `ServerView.history` the page reads; absent when nothing is known yet.
|
|
2088
|
-
*/
|
|
2089
|
-
"restarts?": "number",
|
|
2090
|
-
"crashes?": "number",
|
|
2091
|
-
"uptimeRatio?": "number",
|
|
2092
|
-
"lastExitAt?": "number"
|
|
2093
|
-
}));
|
|
2094
|
-
var usageViewSchema = lazy(() => type({
|
|
2095
|
-
"servers": usageEntrySchema.array(),
|
|
2096
|
-
/** When the host-level sample was taken, so a caller can tell live numbers from a frozen frame. */
|
|
2097
|
-
"sampledAt?": "number"
|
|
2098
|
-
}));
|
|
2099
|
-
/**
|
|
2100
|
-
* What a `free-port` attempt did. The pids are reported so the UI can say which
|
|
2101
|
-
* process left, and which listeners were deliberately left alone because this
|
|
2102
|
-
* panel supervises them.
|
|
2103
|
-
*/
|
|
2104
|
-
var freePortResultSchema = lazy(() => type({
|
|
2105
|
-
ok: "boolean",
|
|
2106
|
-
port: "number | null",
|
|
2107
|
-
/** Asked to leave with SIGTERM, and the ones that ignored it. */
|
|
2108
|
-
terminated: "number[]",
|
|
2109
|
-
forced: "number[]",
|
|
2110
|
-
/** Listeners this panel supervises; never signalled. */
|
|
2111
|
-
skipped: "number[]",
|
|
2112
|
-
/** The port answers no more after the attempt. */
|
|
2113
|
-
free: "boolean"
|
|
2114
|
-
}));
|
|
2115
|
-
var logHistoryQuerySchema = lazy(() => type({
|
|
2116
|
-
tail: "string?",
|
|
2117
|
-
/**
|
|
2118
|
-
* Case-insensitive substring filter. Both this and `stream` are filters, so the route reads a
|
|
2119
|
-
* wider window than `tail` and applies them to that: filtering only the display tail would
|
|
2120
|
-
* report an older match as "no results", and "the last N stderr lines" as whatever happened
|
|
2121
|
-
* to fall in a window sized for all streams. `searched` reports how many lines were read.
|
|
2122
|
-
*/
|
|
2123
|
-
search: "string?",
|
|
2124
|
-
stream: "\"stdout\" | \"stderr\" | \"system\"?"
|
|
2125
|
-
}));
|
|
2126
|
-
var logFileInfoSchema = lazy(() => type({
|
|
2127
|
-
name: "string",
|
|
2128
|
-
sizeBytes: "number"
|
|
2129
|
-
}));
|
|
2130
|
-
var logServerViewSchema = lazy(() => type({
|
|
2131
|
-
serverId: "string",
|
|
2132
|
-
label: "string",
|
|
2133
|
-
status: serverStatusSchema,
|
|
2134
|
-
enabled: "boolean",
|
|
2135
|
-
sizeBytes: "number",
|
|
2136
|
-
files: logFileInfoSchema.array()
|
|
2137
|
-
}));
|
|
2138
|
-
var logServersViewSchema = lazy(() => type({ servers: logServerViewSchema.array() }));
|
|
2139
|
-
lazy(() => type({
|
|
2140
|
-
serverId: "string",
|
|
2141
|
-
enabled: "boolean",
|
|
2142
|
-
sizeBytes: "number",
|
|
2143
|
-
files: type("string[]"),
|
|
2144
|
-
/** How many lines the search looked at, or null when not searching. */
|
|
2145
|
-
searched: "number | null",
|
|
2146
|
-
lines: logLineSchema.array()
|
|
2147
|
-
}));
|
|
2148
1926
|
var notificationActionSchema = lazy(() => type({
|
|
2149
1927
|
/** Optional override, so the token can be tried before it is saved. */
|
|
2150
1928
|
botToken: "string?",
|
|
2151
1929
|
chatId: "string?"
|
|
2152
1930
|
}).onUndeclaredKey("reject"));
|
|
2153
|
-
/**
|
|
2154
|
-
* The `:id` path parameter of a destination route.
|
|
2155
|
-
*
|
|
2156
|
-
* Validated, because the id is not only a lookup key: it also keys a bot token in the secrets file.
|
|
2157
|
-
* Unvalidated, `DELETE /destinations/ghost/token` answered `200`, and an id of `botToken` wrote the
|
|
2158
|
-
* literal secrets key `telegram.botToken`, which the reader then took for the **legacy singleton** —
|
|
2159
|
-
* every real destination's token became unreachable.
|
|
2160
|
-
*/
|
|
1931
|
+
/** A destination id; validated because it also keys a bot token in the secrets file. */
|
|
2161
1932
|
var destinationIdParamSchema = lazy(() => type({ id: "/^[a-z0-9][a-z0-9_-]*$/" }));
|
|
2162
|
-
/**
|
|
2163
|
-
* `POST /api/notifications/test-webhook`: the webhook to try, as a draft or by id.
|
|
2164
|
-
*
|
|
2165
|
-
* The target travels whole because the page tests what is in its form, which may not be saved yet —
|
|
2166
|
-
* and the request schema rejects undeclared keys, so the webhook shape is reused rather than a
|
|
2167
|
-
* second DTO that could drift from it.
|
|
2168
|
-
*/
|
|
1933
|
+
/** `POST /api/notifications/test-webhook`: the webhook to try, as an unsaved draft or by id. */
|
|
2169
1934
|
var destinationTestSchema = lazy(() => type({
|
|
2170
1935
|
target: webhookTargetSchema.omit("kind", "id").and(type({
|
|
2171
1936
|
id: "string?",
|
|
2172
1937
|
kind: "\"webhook\"?"
|
|
2173
1938
|
})),
|
|
2174
|
-
/** Echoed so the result is recorded against the right row; absent for a draft. */
|
|
2175
1939
|
id: "string?"
|
|
2176
1940
|
}).onUndeclaredKey("reject"));
|
|
2177
1941
|
var telegramTokenSchema = lazy(() => type({ botToken: "string >= 1" }).onUndeclaredKey("reject"));
|
|
2178
|
-
/**
|
|
2179
|
-
* The single error envelope every route answers failures with.
|
|
2180
|
-
*
|
|
2181
|
-
* `detail` is **optional**: `toErrorBody()` omits the key when the error carries none, which is the
|
|
2182
|
-
* common case — measured, `/api/logs/ghost`, `/api/servers/ghost` and `/api/settings/ui` all answer
|
|
2183
|
-
* `{ message, code }` and nothing else. Requiring it here told every OpenAPI client to expect a field
|
|
2184
|
-
* that is usually absent, and disagreed with `ApiErrorBody` in `helpers/error.ts`, which has it
|
|
2185
|
-
* optional because that is what it actually serialises.
|
|
2186
|
-
*/
|
|
1942
|
+
/** The error envelope every route answers failures with; `detail` is usually absent. */
|
|
2187
1943
|
var apiErrorSchema = lazy(() => type({
|
|
2188
1944
|
"message": "string",
|
|
2189
1945
|
/** Stable, machine-readable; `AUTH_REQUIRED` also drives the login redirect. */
|
|
2190
1946
|
"code": "string",
|
|
2191
|
-
/** Structured context when the failure has any — a field list, the routes holding a certificate. */
|
|
2192
1947
|
"detail?": "unknown"
|
|
2193
1948
|
}));
|
|
1949
|
+
/** `PUT /api/servers/:id/secrets`: values to set and names to remove; undeclared names are refused by the route. */
|
|
1950
|
+
var serverSecretsSchema = lazy(() => type({
|
|
1951
|
+
"set?": type({ "[string]": "string" }),
|
|
1952
|
+
"unset?": type("string[]")
|
|
1953
|
+
}).onUndeclaredKey("reject"));
|
|
2194
1954
|
var tlsUploadSchema = lazy(() => type({
|
|
2195
1955
|
certificate: "string >= 1",
|
|
2196
1956
|
privateKey: "string >= 1"
|
|
2197
1957
|
}).onUndeclaredKey("reject"));
|
|
2198
|
-
/** `GET /api/settings`: the panel-wide configuration, as Global Settings reads it. */
|
|
2199
1958
|
var settingsViewSchema = lazy(() => type({
|
|
2200
1959
|
control: controlViewSchema,
|
|
2201
1960
|
host: hostSchema,
|
|
2202
1961
|
backups: backupsViewSchema,
|
|
2203
1962
|
ui: uiStatusSchema
|
|
2204
1963
|
}).onDeepUndeclaredKey("ignore"));
|
|
2205
|
-
/** `PATCH /api/settings` answers with the saved view, plus where the listener lands. */
|
|
2206
1964
|
var settingsSavedSchema = lazy(() => settingsViewSchema.and(type({
|
|
2207
1965
|
/** The listener is moving; reconnect at `targetUrl` when it stops being null. */
|
|
2208
1966
|
rebinding: "boolean",
|
|
2209
1967
|
targetUrl: "string | null"
|
|
2210
1968
|
})));
|
|
2211
|
-
/**
|
|
2212
|
-
* `GET /api/settings/workspace?workspace=<id>`: what a workspace owns and can
|
|
2213
|
-
* change on its own. Global things (listener, auth, host, backups, TLS) are not
|
|
2214
|
-
* here — they belong to the panel, not to any workspace.
|
|
2215
|
-
*/
|
|
1969
|
+
/** `GET /api/settings/workspace?workspace=<id>`: what a workspace owns; panel-wide settings are not here. */
|
|
2216
1970
|
var workspaceSettingsViewSchema = lazy(() => type({
|
|
2217
1971
|
id: "string",
|
|
2218
1972
|
label: "string",
|
|
@@ -2224,7 +1978,38 @@ var workspaceSettingsViewSchema = lazy(() => type({
|
|
|
2224
1978
|
notifications: notificationViewSchema
|
|
2225
1979
|
}).onDeepUndeclaredKey("ignore"));
|
|
2226
1980
|
var workspaceSettingsSavedSchema = workspaceSettingsViewSchema;
|
|
1981
|
+
/** One server's live resource reading for `home-hosted usage`; an absent reading is not zero. */
|
|
1982
|
+
var usageEntrySchema = lazy(() => type({
|
|
1983
|
+
"id": "string",
|
|
1984
|
+
"workspaceId": "string",
|
|
1985
|
+
"label": "string",
|
|
1986
|
+
"status": serverStatusSchema,
|
|
1987
|
+
/** Absent when nothing is running or the sampler has no sample yet. */
|
|
1988
|
+
"cpuPercent?": "number",
|
|
1989
|
+
"rssBytes?": "number",
|
|
1990
|
+
"processes?": "number",
|
|
1991
|
+
"sampledAt?": "number",
|
|
1992
|
+
/** Behaviour over the history window, from `ServerView.history`; absent when nothing is known yet. */
|
|
1993
|
+
"restarts?": "number",
|
|
1994
|
+
"crashes?": "number",
|
|
1995
|
+
"uptimeRatio?": "number",
|
|
1996
|
+
"lastExitAt?": "number"
|
|
1997
|
+
}));
|
|
1998
|
+
var usageViewSchema = lazy(() => type({
|
|
1999
|
+
"servers": usageEntrySchema.array(),
|
|
2000
|
+
"sampledAt?": "number"
|
|
2001
|
+
}));
|
|
2002
|
+
var freePortResultSchema = lazy(() => type({
|
|
2003
|
+
ok: "boolean",
|
|
2004
|
+
port: "number | null",
|
|
2005
|
+
/** Asked to leave with SIGTERM, and the ones that ignored it. */
|
|
2006
|
+
terminated: "number[]",
|
|
2007
|
+
forced: "number[]",
|
|
2008
|
+
/** Listeners this panel supervises; never signalled. */
|
|
2009
|
+
skipped: "number[]",
|
|
2010
|
+
free: "boolean"
|
|
2011
|
+
}));
|
|
2227
2012
|
//#endregion
|
|
2228
|
-
export {
|
|
2013
|
+
export { telegramChatsSchema as $, jobsFileSchema as A, proxyConfigSchema as At, okResponseSchema as B, restorePlanSchema as Bt, jobEntryViewSchema as C, ssePingFrameSchema as Ct, jobRunStartedSchema as D, integerParam as Dt, jobRunSchema as E, booleanParam as Et, nannySpecSchema as F, ddnsConfigSchema as Ft, serverSecretsSchema as G, accountListSchema as Gt, serverCreateSchema as H, accountCreateSchema as Ht, nannyStateSchema as I, ddnsCredentialsSchema as It, sessionViewSchema as J, loginSchema as Jt, serverViewSchema as K, accountPatchSchema as Kt, newWorkspaceIdSchema as L, ddnsViewSchema as Lt, logQuerySchema as M, proxyPatchSchema as Mt, logsSchema as N, proxyRouteSchema as Nt, jobRunsListSchema as O, hostReadings as Ot, metaViewSchema as P, proxyViewSchema as Pt, stopSchema as Q, notificationActionSchema as R, backupCreateSchema as Rt, jobCreateSchema as S, sseMessageSchema as St, jobRunDetailSchema as T, sseStateFrameSchema as Tt, serverPatchSchema as U, accountCreatedBodySchema as Ut, parseBind as V, restoreRequestSchema as Vt, serverSchema as W, accountIdBodySchema as Wt, settingsSavedSchema as X, settingsPatchSchema as Y, settingsViewSchema as Z, entryHasJobFields as _, logHistoryViewSchema as _t, backupCreatedResponseSchema as a, usageViewSchema as at, healthResponseSchema as b, sseEventNames as bt, backupsSchema as c, workspaceRenameSchema as ct, defaultsSchema as d, workspaceSettingsSavedSchema as dt, telegramTokenSchema as et, deliveryResultSchema as f, workspaceSettingsViewSchema as ft, duplicateWebhookIds as g, jobLogViewSchema as gt, duplicateSecretEnvNames as h, bufferedLogsResponseSchema as ht, appStateSchema as i, uiMetaSchema as it, jobsListSchema as j, proxyEngineInstallSchema as jt, jobSchema as k, proxyCertificateUploadSchema as kt, contracts_exports as l, workspaceSchema as lt, destinationTestSchema as m, wslTemperatureSchema as mt, actionResultSchema as n, tlsUploadSchema as nt, backupFilesResponseSchema as o, workspaceCreateSchema as ot, destinationIdParamSchema as p, workspaceViewSchema as pt, serverWriteResponseSchema as q, accountSecretSchema as qt, apiErrorSchema as r, uiInstallResponseSchema as rt, backupLocalResponseSchema as s, workspaceIdSchema as st, JOB_TIMEOUT_MAX_SECONDS as t, tlsReviewResponseSchema as tt, controlSchema as u, workspaceSettingsPatchSchema as ut, entryStateSchema as v, logPageQuerySchema as vt, jobPatchSchema as w, sseServerFrameSchema as wt, hostSchema as x, sseLogFrameSchema as xt, freePortResultSchema as y, logServersViewSchema as yt, notificationsSchema as z, backupSelectionSchema as zt };
|
|
2229
2014
|
|
|
2230
|
-
//# sourceMappingURL=contracts-
|
|
2015
|
+
//# sourceMappingURL=contracts-CxZ7u1L3.js.map
|