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.
Files changed (485) hide show
  1. package/README.md +117 -322
  2. package/bin/home-hosted.mjs +41 -0
  3. package/dist/chunks/account-DiLrSyww.js +359 -0
  4. package/dist/chunks/account-DiLrSyww.js.map +1 -0
  5. package/dist/chunks/add-DEIYVkNK.js +183 -0
  6. package/dist/chunks/add-DEIYVkNK.js.map +1 -0
  7. package/dist/chunks/{archive-DP-XQR8X.js → archive-DFi3qK1c.js} +25 -73
  8. package/dist/chunks/archive-DFi3qK1c.js.map +1 -0
  9. package/dist/chunks/{atomic-C1PfJpE7.js → atomic-SZUwDtGD.js} +3 -6
  10. package/dist/chunks/atomic-SZUwDtGD.js.map +1 -0
  11. package/dist/chunks/{backup-DeAJ3pbO.js → backup-DnyxIzw0.js} +110 -190
  12. package/dist/chunks/backup-DnyxIzw0.js.map +1 -0
  13. package/dist/chunks/backups-BrrN6cwW.js +2203 -0
  14. package/dist/chunks/backups-BrrN6cwW.js.map +1 -0
  15. package/dist/chunks/bind-DIxrnUst.js +43 -0
  16. package/dist/chunks/bind-DIxrnUst.js.map +1 -0
  17. package/dist/chunks/config-text-DxMOQQnk.js +34 -0
  18. package/dist/chunks/config-text-DxMOQQnk.js.map +1 -0
  19. package/dist/chunks/{contracts-CMBD1TF9.js → contracts-CxZ7u1L3.js} +1239 -1454
  20. package/dist/chunks/contracts-CxZ7u1L3.js.map +1 -0
  21. package/dist/chunks/daemon-BAAYUYQC.js +211 -0
  22. package/dist/chunks/daemon-BAAYUYQC.js.map +1 -0
  23. package/dist/chunks/daemon-log-Ccu-69vB.js +179 -0
  24. package/dist/chunks/daemon-log-Ccu-69vB.js.map +1 -0
  25. package/dist/chunks/deploy-CggSOEkq.js +144 -0
  26. package/dist/chunks/deploy-CggSOEkq.js.map +1 -0
  27. package/dist/chunks/{docker-Cy9Lyvda.js → docker--Un0uLfF.js} +32 -68
  28. package/dist/chunks/docker--Un0uLfF.js.map +1 -0
  29. package/dist/chunks/{down-C59ne5aM.js → down-CpIN7LEQ.js} +34 -94
  30. package/dist/chunks/down-CpIN7LEQ.js.map +1 -0
  31. package/dist/chunks/exposure-CDJNvOCK.js +229 -0
  32. package/dist/chunks/exposure-CDJNvOCK.js.map +1 -0
  33. package/dist/chunks/import-Bd4VZH0f.js +205 -0
  34. package/dist/chunks/import-Bd4VZH0f.js.map +1 -0
  35. package/dist/chunks/import-plan--fDS_l5r.js +147 -0
  36. package/dist/chunks/import-plan--fDS_l5r.js.map +1 -0
  37. package/dist/chunks/import-write-BTfbeV26.js +42 -0
  38. package/dist/chunks/import-write-BTfbeV26.js.map +1 -0
  39. package/dist/chunks/{init-BZ7hK9Vf.js → init-Bv3oH65x.js} +14 -50
  40. package/dist/chunks/init-Bv3oH65x.js.map +1 -0
  41. package/dist/chunks/job-CYOdN6Ub.js +341 -0
  42. package/dist/chunks/job-CYOdN6Ub.js.map +1 -0
  43. package/dist/chunks/jobs-BX4ahcfh.js +489 -0
  44. package/dist/chunks/jobs-BX4ahcfh.js.map +1 -0
  45. package/dist/chunks/last-stop-DD3lHwo_.js +42 -0
  46. package/dist/chunks/last-stop-DD3lHwo_.js.map +1 -0
  47. package/dist/chunks/layout-D0ysDNav.js +18 -0
  48. package/dist/chunks/layout-D0ysDNav.js.map +1 -0
  49. package/dist/chunks/lazy-kfcBNeqj.js +48 -0
  50. package/dist/chunks/lazy-kfcBNeqj.js.map +1 -0
  51. package/dist/chunks/log-buffer-B7jmn7ts.js +110 -0
  52. package/dist/chunks/log-buffer-B7jmn7ts.js.map +1 -0
  53. package/dist/chunks/log-files-CZL2UhuE.js +488 -0
  54. package/dist/chunks/log-files-CZL2UhuE.js.map +1 -0
  55. package/dist/chunks/{logger-B5U4GD3j.js → logger-BnrKTBHQ.js} +2 -6
  56. package/dist/chunks/logger-BnrKTBHQ.js.map +1 -0
  57. package/dist/chunks/{logs---TI_bxM.js → logs-DxKI6OW2.js} +23 -73
  58. package/dist/chunks/logs-DxKI6OW2.js.map +1 -0
  59. package/dist/chunks/ls-BseUHy_m.js +128 -0
  60. package/dist/chunks/ls-BseUHy_m.js.map +1 -0
  61. package/dist/chunks/migrate-D4w_dXDm.js +268 -0
  62. package/dist/chunks/migrate-D4w_dXDm.js.map +1 -0
  63. package/dist/chunks/{nanny-rewguyXg.js → nanny-BWh7nuvv.js} +21 -14
  64. package/dist/chunks/nanny-BWh7nuvv.js.map +1 -0
  65. package/dist/chunks/{nanny-Dnun3hVB.js → nanny-BjF2-1pv.js} +3 -3
  66. package/dist/chunks/{nanny-Dnun3hVB.js.map → nanny-BjF2-1pv.js.map} +1 -1
  67. package/dist/chunks/nanny-DGTXVq5d.js +806 -0
  68. package/dist/chunks/nanny-DGTXVq5d.js.map +1 -0
  69. package/dist/chunks/{nanny-sweep-ClVuNJRo.js → nanny-sweep-hjmZ_p7S.js} +14 -24
  70. package/dist/chunks/nanny-sweep-hjmZ_p7S.js.map +1 -0
  71. package/dist/chunks/{nearest-6KgQEDUe.js → nearest-DOx4jySJ.js} +2 -10
  72. package/dist/chunks/nearest-DOx4jySJ.js.map +1 -0
  73. package/dist/chunks/{parse-DhmG26fI.js → parse-DVMPLUDe.js} +47 -72
  74. package/dist/chunks/parse-DVMPLUDe.js.map +1 -0
  75. package/dist/chunks/password-policy-Clq6PGE-.js +9 -0
  76. package/dist/chunks/password-policy-Clq6PGE-.js.map +1 -0
  77. package/dist/chunks/{paths-CGlGDrOU.js → paths-C34-TJLh.js} +32 -56
  78. package/dist/chunks/paths-C34-TJLh.js.map +1 -0
  79. package/dist/chunks/{port-k5VBw8t9.js → port-CnsrxKNR.js} +23 -70
  80. package/dist/chunks/port-CnsrxKNR.js.map +1 -0
  81. package/dist/chunks/process-CboOFPU_.js +192 -0
  82. package/dist/chunks/process-CboOFPU_.js.map +1 -0
  83. package/dist/chunks/{restart-BYu_E7x5.js → restart-C0J8dZ2L.js} +11 -29
  84. package/dist/chunks/restart-C0J8dZ2L.js.map +1 -0
  85. package/dist/chunks/run-deploy-DoNDvwT4.js +91 -0
  86. package/dist/chunks/run-deploy-DoNDvwT4.js.map +1 -0
  87. package/dist/chunks/{schema-B240VXcV.js → schema-CZ6f-PHD.js} +7 -20
  88. package/dist/chunks/schema-CZ6f-PHD.js.map +1 -0
  89. package/dist/chunks/secret-MY397r90.js +219 -0
  90. package/dist/chunks/secret-MY397r90.js.map +1 -0
  91. package/dist/chunks/secrets-CG5N4lwY.js +1061 -0
  92. package/dist/chunks/secrets-CG5N4lwY.js.map +1 -0
  93. package/dist/chunks/server-Dm_dXfTW.js +255 -0
  94. package/dist/chunks/server-Dm_dXfTW.js.map +1 -0
  95. package/dist/chunks/server-attention-UQwYXqKe.js +10 -0
  96. package/dist/chunks/server-attention-UQwYXqKe.js.map +1 -0
  97. package/dist/chunks/server-create-D7nvhgBd.js +96 -0
  98. package/dist/chunks/server-create-D7nvhgBd.js.map +1 -0
  99. package/dist/chunks/server-ids-BEQD2rFz.js +23 -0
  100. package/dist/chunks/server-ids-BEQD2rFz.js.map +1 -0
  101. package/dist/chunks/server-vars-DMYmHutL.js +27 -0
  102. package/dist/chunks/server-vars-DMYmHutL.js.map +1 -0
  103. package/dist/chunks/service-C8l-ewNA.js +585 -0
  104. package/dist/chunks/service-C8l-ewNA.js.map +1 -0
  105. package/dist/chunks/{settings-xu-XTfWg.js → settings-CtYDs5PX.js} +62 -78
  106. package/dist/chunks/settings-CtYDs5PX.js.map +1 -0
  107. package/dist/chunks/{setup-temp-CAN4_bA-.js → setup-temp-TAtDmMMU.js} +43 -37
  108. package/dist/chunks/setup-temp-TAtDmMMU.js.map +1 -0
  109. package/dist/chunks/shape-CDGeYl_J.js +9 -0
  110. package/dist/chunks/shape-CDGeYl_J.js.map +1 -0
  111. package/dist/chunks/{src-BOBh9MBf.js → src-BnzkVy_M.js} +12547 -10578
  112. package/dist/chunks/src-BnzkVy_M.js.map +1 -0
  113. package/dist/chunks/{status-B6f2-qhs.js → status-efbbfYZQ.js} +53 -26
  114. package/dist/chunks/status-efbbfYZQ.js.map +1 -0
  115. package/dist/chunks/store-Bs_Lljjm.js +2082 -0
  116. package/dist/chunks/store-Bs_Lljjm.js.map +1 -0
  117. package/dist/chunks/template-xan58bJh.js +28 -0
  118. package/dist/chunks/template-xan58bJh.js.map +1 -0
  119. package/dist/chunks/token-DDeWfZA4.js +142 -0
  120. package/dist/chunks/token-DDeWfZA4.js.map +1 -0
  121. package/dist/chunks/{ui-D562aqw5.js → ui-BcIAtyxE.js} +68 -79
  122. package/dist/chunks/ui-BcIAtyxE.js.map +1 -0
  123. package/dist/chunks/{ui-dir-CsU3uLNV.js → ui-dir-ClCzVRc3.js} +3 -7
  124. package/dist/chunks/ui-dir-ClCzVRc3.js.map +1 -0
  125. package/dist/chunks/ui-format-CDvvqOoi.js +53 -0
  126. package/dist/chunks/ui-format-CDvvqOoi.js.map +1 -0
  127. package/dist/chunks/{ui-release-DKzVvlLd.js → ui-release-XbJ85pYI.js} +36 -38
  128. package/dist/chunks/ui-release-XbJ85pYI.js.map +1 -0
  129. package/dist/chunks/{ui-revert-EkBBwRTt.js → ui-revert-Dgawq7ze.js} +4 -4
  130. package/dist/chunks/ui-revert-Dgawq7ze.js.map +1 -0
  131. package/dist/chunks/{ui-switch-BnZTdMDd.js → ui-switch-CfQMbZ0g.js} +31 -38
  132. package/dist/chunks/ui-switch-CfQMbZ0g.js.map +1 -0
  133. package/dist/chunks/{ui-update-_xryLYxw.js → ui-update-B3PPivUm.js} +30 -48
  134. package/dist/chunks/ui-update-B3PPivUm.js.map +1 -0
  135. package/dist/chunks/ui-update-CAiH2tFb.js +109 -0
  136. package/dist/chunks/ui-update-CAiH2tFb.js.map +1 -0
  137. package/dist/chunks/{up-DNZuTi2q.js → up-BQSnYxYd.js} +47 -53
  138. package/dist/chunks/up-BQSnYxYd.js.map +1 -0
  139. package/dist/chunks/{usage-BrnDARNM.js → usage-KG8TeOio.js} +7 -20
  140. package/dist/chunks/usage-KG8TeOio.js.map +1 -0
  141. package/dist/chunks/{workspaces-DYcfvKV_.js → workspaces-D9akpzU8.js} +80 -68
  142. package/dist/chunks/workspaces-D9akpzU8.js.map +1 -0
  143. package/dist/chunks/{wsl-temperature-BiCI4iK6.js → wsl-temperature-D-_d4Yk1.js} +47 -42
  144. package/dist/chunks/wsl-temperature-D-_d4Yk1.js.map +1 -0
  145. package/dist/cli.js +306 -238
  146. package/dist/cli.js.map +1 -1
  147. package/dist/client.js +76 -29
  148. package/dist/client.js.map +1 -1
  149. package/dist/types/api/acme.d.ts +3 -7
  150. package/dist/types/api/auth/$.routes.d.ts +107 -16
  151. package/dist/types/api/backups.d.ts +5 -5
  152. package/dist/types/api/control.d.ts +747 -38
  153. package/dist/types/api/ddns.d.ts +13 -18
  154. package/dist/types/api/events.d.ts +9 -3
  155. package/dist/types/api/health.d.ts +2 -4
  156. package/dist/types/api/jobs.d.ts +438 -0
  157. package/dist/types/api/logs.d.ts +20 -0
  158. package/dist/types/api/metrics.d.ts +2 -5
  159. package/dist/types/api/notifications.d.ts +3 -6
  160. package/dist/types/api/proxy.d.ts +63 -23
  161. package/dist/types/api/server-ops.d.ts +17 -0
  162. package/dist/types/api/servers/$.routes.d.ts +418 -186
  163. package/dist/types/api/session-required.d.ts +16 -0
  164. package/dist/types/api/settings.d.ts +7 -7
  165. package/dist/types/api/state.d.ts +100 -10
  166. package/dist/types/api/static.d.ts +2 -2
  167. package/dist/types/api/tls.d.ts +2 -5
  168. package/dist/types/api/workspaces/$.routes.d.ts +186 -12
  169. package/dist/types/api/wsl-temperature.d.ts +4 -10
  170. package/dist/types/app.d.ts +4511 -2778
  171. package/dist/types/cli/account.d.ts +23 -0
  172. package/dist/types/cli/add.d.ts +96 -0
  173. package/dist/types/cli/args.d.ts +24 -35
  174. package/dist/types/cli/backup-offline.d.ts +2 -8
  175. package/dist/types/cli/backup.d.ts +12 -21
  176. package/dist/types/cli/down.d.ts +15 -41
  177. package/dist/types/cli/import-plan.d.ts +55 -0
  178. package/dist/types/cli/import-write.d.ts +5 -0
  179. package/dist/types/cli/import.d.ts +86 -0
  180. package/dist/types/cli/io.d.ts +26 -35
  181. package/dist/types/cli/job.d.ts +99 -0
  182. package/dist/types/cli/logs.d.ts +1 -10
  183. package/dist/types/cli/ls.d.ts +57 -0
  184. package/dist/types/cli/migrate.d.ts +31 -8
  185. package/dist/types/cli/nearest.d.ts +1 -9
  186. package/dist/types/cli/run-deploy.d.ts +36 -0
  187. package/dist/types/cli/secret.d.ts +90 -0
  188. package/dist/types/cli/server.d.ts +6 -15
  189. package/dist/types/cli/service.d.ts +135 -0
  190. package/dist/types/cli/setup-temp.d.ts +17 -13
  191. package/dist/types/cli/status.d.ts +7 -1
  192. package/dist/types/cli/token.d.ts +6 -0
  193. package/dist/types/cli/ui-switch.d.ts +3 -14
  194. package/dist/types/cli/ui-update.d.ts +3 -16
  195. package/dist/types/cli/up.d.ts +9 -22
  196. package/dist/types/cli/usage.d.ts +2 -6
  197. package/dist/types/cli.d.ts +1 -10
  198. package/dist/types/client.d.ts +4099 -1142
  199. package/dist/types/config/accounts.d.ts +16 -0
  200. package/dist/types/config/jobs.d.ts +68 -0
  201. package/dist/types/config/layout.d.ts +2 -8
  202. package/dist/types/config/migrations.d.ts +9 -41
  203. package/dist/types/config/parse.d.ts +8 -13
  204. package/dist/types/config/patch.d.ts +1 -6
  205. package/dist/types/config/schema.d.ts +16 -18
  206. package/dist/types/config/secret-parts.d.ts +6 -27
  207. package/dist/types/config/secrets.d.ts +167 -88
  208. package/dist/types/config/seed.d.ts +1 -6
  209. package/dist/types/config/server-ids.d.ts +2 -11
  210. package/dist/types/config/settings.d.ts +13 -49
  211. package/dist/types/config/store.d.ts +17 -54
  212. package/dist/types/config/workspaces.d.ts +24 -56
  213. package/dist/types/helpers/action-result.d.ts +18 -32
  214. package/dist/types/helpers/atomic.d.ts +1 -4
  215. package/dist/types/helpers/backoff.d.ts +0 -1
  216. package/dist/types/helpers/bind.d.ts +3 -11
  217. package/dist/types/helpers/config-text.d.ts +4 -19
  218. package/dist/types/helpers/cookies.d.ts +2 -7
  219. package/dist/types/helpers/copy-tree.d.ts +4 -12
  220. package/dist/types/helpers/daemon-log.d.ts +8 -33
  221. package/dist/types/helpers/daemon.d.ts +20 -70
  222. package/dist/types/helpers/deferred.d.ts +2 -4
  223. package/dist/types/helpers/env-file.d.ts +2 -7
  224. package/dist/types/helpers/error.d.ts +3 -14
  225. package/dist/types/helpers/event-stream.d.ts +18 -10
  226. package/dist/types/helpers/factory.d.ts +2 -3
  227. package/dist/types/helpers/last-stop.d.ts +5 -12
  228. package/dist/types/helpers/logger.d.ts +1 -5
  229. package/dist/types/helpers/open.d.ts +0 -1
  230. package/dist/types/helpers/openapi.d.ts +19 -5
  231. package/dist/types/helpers/paths.d.ts +18 -53
  232. package/dist/types/helpers/restore-lock.d.ts +2 -17
  233. package/dist/types/helpers/runtime.d.ts +3 -13
  234. package/dist/types/helpers/secret-compare.d.ts +2 -10
  235. package/dist/types/helpers/server-create.d.ts +15 -0
  236. package/dist/types/helpers/shell.d.ts +2 -16
  237. package/dist/types/helpers/sse.d.ts +8 -6
  238. package/dist/types/helpers/ui-dir.d.ts +1 -5
  239. package/dist/types/helpers/utf8-chunks.d.ts +2 -8
  240. package/dist/types/helpers/validate.d.ts +2 -4
  241. package/dist/types/helpers/validator.d.ts +8 -4
  242. package/dist/types/helpers/version.d.ts +1 -6
  243. package/dist/types/helpers/workspace.d.ts +24 -16
  244. package/dist/types/index.d.ts +2 -3
  245. package/dist/types/middleware/auth.d.ts +8 -27
  246. package/dist/types/middleware/body-limit.d.ts +10 -0
  247. package/dist/types/middleware/host.d.ts +4 -23
  248. package/dist/types/middleware/loopback.d.ts +1 -8
  249. package/dist/types/middleware/token-scope.d.ts +34 -0
  250. package/dist/types/node-compat.d.ts +43 -0
  251. package/dist/types/openapi-reference.d.ts +4 -19
  252. package/dist/types/openapi.d.ts +5 -8
  253. package/dist/types/providers/archive.d.ts +8 -25
  254. package/dist/types/providers/backup-hook.d.ts +4 -19
  255. package/dist/types/providers/ddns/dyndns2.d.ts +0 -3
  256. package/dist/types/providers/ddns/index.d.ts +2 -3
  257. package/dist/types/providers/ddns/ip.d.ts +2 -12
  258. package/dist/types/providers/ddns/namecheap-api.d.ts +3 -2
  259. package/dist/types/providers/ddns/types.d.ts +6 -32
  260. package/dist/types/providers/ddns/zone.d.ts +1 -4
  261. package/dist/types/providers/docker.d.ts +18 -45
  262. package/dist/types/providers/entry-state.d.ts +4 -9
  263. package/dist/types/providers/health-check.d.ts +1 -5
  264. package/dist/types/providers/host.d.ts +33 -108
  265. package/dist/types/providers/identity.d.ts +9 -34
  266. package/dist/types/providers/log-tail.d.ts +14 -24
  267. package/dist/types/providers/nanny-sweep.d.ts +8 -25
  268. package/dist/types/providers/nanny.d.ts +16 -58
  269. package/dist/types/providers/port.d.ts +28 -83
  270. package/dist/types/providers/proc.d.ts +22 -80
  271. package/dist/types/providers/process.d.ts +12 -36
  272. package/dist/types/providers/proxy/admin.d.ts +11 -0
  273. package/dist/types/providers/proxy/types.d.ts +4 -16
  274. package/dist/types/providers/telegram.d.ts +1 -17
  275. package/dist/types/providers/ui-release.d.ts +15 -25
  276. package/dist/types/providers/webhook.d.ts +8 -29
  277. package/dist/types/providers/wsl-temperature.d.ts +13 -22
  278. package/dist/types/services/acme-challenge.d.ts +2 -16
  279. package/dist/types/services/auth.d.ts +65 -80
  280. package/dist/types/services/backups/archive-safety.d.ts +30 -0
  281. package/dist/types/services/backups/paths.d.ts +31 -0
  282. package/dist/types/services/backups.d.ts +61 -271
  283. package/dist/types/services/config-watch.d.ts +3 -15
  284. package/dist/types/services/control-server.d.ts +6 -10
  285. package/dist/types/services/ddns.d.ts +12 -13
  286. package/dist/types/services/dependencies.d.ts +3 -14
  287. package/dist/types/services/deploy.d.ts +34 -0
  288. package/dist/types/services/events.d.ts +15 -9
  289. package/dist/types/services/exposure.d.ts +13 -63
  290. package/dist/types/services/history.d.ts +5 -14
  291. package/dist/types/services/host-monitor.d.ts +6 -11
  292. package/dist/types/services/init.d.ts +5 -35
  293. package/dist/types/services/job-ledger.d.ts +27 -0
  294. package/dist/types/services/jobs.d.ts +113 -0
  295. package/dist/types/services/log-buffer.d.ts +7 -8
  296. package/dist/types/services/log-files.d.ts +12 -42
  297. package/dist/types/services/log-relay.d.ts +3 -13
  298. package/dist/types/services/nanny.d.ts +3 -10
  299. package/dist/types/services/notifications.d.ts +31 -61
  300. package/dist/types/services/panel.d.ts +32 -78
  301. package/dist/types/services/proxy-certificates/certificates.d.ts +31 -69
  302. package/dist/types/services/proxy-config.d.ts +15 -36
  303. package/dist/types/services/proxy-dns01.d.ts +14 -0
  304. package/dist/types/services/proxy.d.ts +73 -254
  305. package/dist/types/services/scheduler.d.ts +46 -0
  306. package/dist/types/services/state.d.ts +17 -8
  307. package/dist/types/services/supervisor/compose.d.ts +2 -6
  308. package/dist/types/services/supervisor/entry.d.ts +29 -32
  309. package/dist/types/services/supervisor/health.d.ts +8 -31
  310. package/dist/types/services/supervisor/job-run.d.ts +36 -0
  311. package/dist/types/services/supervisor/output.d.ts +13 -77
  312. package/dist/types/services/supervisor/persistent.d.ts +5 -11
  313. package/dist/types/services/supervisor/port-preflight.d.ts +4 -10
  314. package/dist/types/services/supervisor/records.d.ts +27 -60
  315. package/dist/types/services/supervisor/restart-required.d.ts +13 -0
  316. package/dist/types/services/supervisor/spawn.d.ts +3 -5
  317. package/dist/types/services/supervisor/view.d.ts +3 -1
  318. package/dist/types/services/supervisor.d.ts +31 -43
  319. package/dist/types/services/tls.d.ts +6 -17
  320. package/dist/types/services/ui-update.d.ts +19 -17
  321. package/dist/types/services/ui.d.ts +10 -19
  322. package/dist/types/shared/action-outcome.d.ts +2 -7
  323. package/dist/types/shared/api-client.d.ts +133 -177
  324. package/dist/types/shared/api-scopes.d.ts +17 -0
  325. package/dist/types/shared/backup-scope.d.ts +16 -90
  326. package/dist/types/shared/clone.d.ts +2 -11
  327. package/dist/types/shared/contracts/accounts.d.ts +99 -0
  328. package/dist/types/shared/contracts/backups.d.ts +219 -0
  329. package/dist/types/shared/contracts/ddns.d.ts +208 -0
  330. package/dist/types/shared/contracts/frames.d.ts +1395 -0
  331. package/dist/types/shared/contracts/index.d.ts +3 -0
  332. package/dist/types/shared/contracts/logs.d.ts +107 -0
  333. package/dist/types/shared/contracts/proxy.d.ts +303 -0
  334. package/dist/types/shared/contracts.d.ts +852 -1982
  335. package/dist/types/shared/cpu-scale.d.ts +3 -19
  336. package/dist/types/shared/crash-cause.d.ts +8 -0
  337. package/dist/types/shared/cron.d.ts +70 -0
  338. package/dist/types/shared/ddns-form.d.ts +9 -43
  339. package/dist/types/shared/endpoint.d.ts +1 -7
  340. package/dist/types/shared/error-codes.d.ts +438 -0
  341. package/dist/types/shared/error-message.d.ts +1 -7
  342. package/dist/types/shared/fields.d.ts +7 -17
  343. package/dist/types/shared/form-repair.d.ts +1 -5
  344. package/dist/types/shared/generated.d.ts +3 -19
  345. package/dist/types/shared/host-readings.d.ts +25 -128
  346. package/dist/types/shared/lazy.d.ts +1 -1
  347. package/dist/types/shared/live-frames.d.ts +2 -8
  348. package/dist/types/shared/live-series.d.ts +2 -8
  349. package/dist/types/shared/live-store.d.ts +4 -8
  350. package/dist/types/shared/log-download.d.ts +6 -0
  351. package/dist/types/shared/meta.d.ts +6 -0
  352. package/dist/types/shared/password-policy.d.ts +10 -0
  353. package/dist/types/shared/patch-diff.d.ts +13 -72
  354. package/dist/types/shared/port-reading.d.ts +18 -0
  355. package/dist/types/shared/probe-latency.d.ts +3 -21
  356. package/dist/types/shared/proxy-form.d.ts +33 -74
  357. package/dist/types/shared/proxy-validate.d.ts +11 -0
  358. package/dist/types/shared/query-params.d.ts +8 -0
  359. package/dist/types/shared/server-attention.d.ts +2 -27
  360. package/dist/types/shared/server-form.d.ts +15 -54
  361. package/dist/types/shared/server-key.d.ts +1 -12
  362. package/dist/types/shared/server-readings.d.ts +7 -32
  363. package/dist/types/shared/server-url.d.ts +9 -31
  364. package/dist/types/shared/shape.d.ts +1 -16
  365. package/dist/types/shared/stream-access.d.ts +2 -8
  366. package/dist/types/shared/ui-format.d.ts +25 -65
  367. package/docs/API.md +315 -107
  368. package/docs/BACKUPS.md +61 -56
  369. package/docs/CLI.md +255 -49
  370. package/docs/DDNS.md +35 -49
  371. package/docs/JOBS.md +129 -0
  372. package/docs/NOTIFICATIONS.md +58 -90
  373. package/docs/REVERSE_PROXY.md +116 -188
  374. package/docs/SECURITY.md +126 -44
  375. package/docs/SERVERS.md +282 -409
  376. package/docs/UI_CREATION.md +90 -47
  377. package/docs/demo/blank-host-restore.sh +31 -7
  378. package/package.json +15 -6
  379. package/scripts/prepare.mjs +47 -0
  380. package/uis/stock/dist/assets/CopyButton-8mliL0xi.js +1 -0
  381. package/uis/stock/dist/assets/GlobalSettingsView-BINXY77E.js +1 -0
  382. package/uis/stock/dist/assets/LogViewer-kiSnTwdY.js +1 -0
  383. package/uis/stock/dist/assets/LogsView-DDXf_ONs.js +1 -0
  384. package/uis/stock/dist/assets/Modal-lrUuViF2.js +39 -0
  385. package/uis/stock/dist/assets/ProxyView-uXMaJdSQ.js +1 -0
  386. package/uis/stock/dist/assets/ServerDetailView-CW0Vb_c0.js +4 -0
  387. package/uis/stock/dist/assets/SettingsShell-B135xWjJ.js +1 -0
  388. package/uis/stock/dist/assets/SettingsView-BLtWxVkl.js +2 -0
  389. package/uis/stock/dist/assets/de-BIoTrHBQ.js +1 -0
  390. package/uis/stock/dist/assets/es-x4-ih8lH.js +1 -0
  391. package/uis/stock/dist/assets/fr-DatqBBkO.js +1 -0
  392. package/uis/stock/dist/assets/index-CnojaKcA.css +2 -0
  393. package/uis/stock/dist/assets/index-D-CiZReu.js +16 -0
  394. package/uis/stock/dist/assets/ja-CW1703Gw.js +1 -0
  395. package/uis/stock/dist/assets/ko-wFbT4XtK.js +1 -0
  396. package/uis/stock/dist/assets/ru-C1p5C4VN.js +1 -0
  397. package/uis/stock/dist/assets/useUnsavedGuard-BcsXsfCC.js +9 -0
  398. package/uis/stock/dist/assets/vi-CDqr0uie.js +1 -0
  399. package/uis/stock/dist/assets/zh-CN-BJ7iit-X.js +1 -0
  400. package/uis/stock/dist/index.html +4 -3
  401. package/uis/stock/dist/ui.json +3 -3
  402. package/dist/chunks/archive-DP-XQR8X.js.map +0 -1
  403. package/dist/chunks/atomic-C1PfJpE7.js.map +0 -1
  404. package/dist/chunks/backup-DeAJ3pbO.js.map +0 -1
  405. package/dist/chunks/backups-twva7x2n.js +0 -4691
  406. package/dist/chunks/backups-twva7x2n.js.map +0 -1
  407. package/dist/chunks/config-text-DifCHhnz.js +0 -50
  408. package/dist/chunks/config-text-DifCHhnz.js.map +0 -1
  409. package/dist/chunks/contracts-CMBD1TF9.js.map +0 -1
  410. package/dist/chunks/daemon-CofN9k6Q.js +0 -247
  411. package/dist/chunks/daemon-CofN9k6Q.js.map +0 -1
  412. package/dist/chunks/daemon-log-BVj8cDEo.js +0 -241
  413. package/dist/chunks/daemon-log-BVj8cDEo.js.map +0 -1
  414. package/dist/chunks/docker-Cy9Lyvda.js.map +0 -1
  415. package/dist/chunks/down-C59ne5aM.js.map +0 -1
  416. package/dist/chunks/init-BZ7hK9Vf.js.map +0 -1
  417. package/dist/chunks/last-stop-C-BXz_XI.js +0 -53
  418. package/dist/chunks/last-stop-C-BXz_XI.js.map +0 -1
  419. package/dist/chunks/layout-DwTtmund.js +0 -24
  420. package/dist/chunks/layout-DwTtmund.js.map +0 -1
  421. package/dist/chunks/lazy-Ce5zEAq1.js +0 -66
  422. package/dist/chunks/lazy-Ce5zEAq1.js.map +0 -1
  423. package/dist/chunks/log-buffer-Dy9HHDMD.js +0 -414
  424. package/dist/chunks/log-buffer-Dy9HHDMD.js.map +0 -1
  425. package/dist/chunks/logger-B5U4GD3j.js.map +0 -1
  426. package/dist/chunks/logs---TI_bxM.js.map +0 -1
  427. package/dist/chunks/migrate-Cfoq-Vgh.js +0 -155
  428. package/dist/chunks/migrate-Cfoq-Vgh.js.map +0 -1
  429. package/dist/chunks/nanny-COyCJXj9.js +0 -1172
  430. package/dist/chunks/nanny-COyCJXj9.js.map +0 -1
  431. package/dist/chunks/nanny-rewguyXg.js.map +0 -1
  432. package/dist/chunks/nanny-sweep-ClVuNJRo.js.map +0 -1
  433. package/dist/chunks/nearest-6KgQEDUe.js.map +0 -1
  434. package/dist/chunks/parse-DhmG26fI.js.map +0 -1
  435. package/dist/chunks/paths-CGlGDrOU.js.map +0 -1
  436. package/dist/chunks/port-k5VBw8t9.js.map +0 -1
  437. package/dist/chunks/restart-BYu_E7x5.js.map +0 -1
  438. package/dist/chunks/schema-B240VXcV.js.map +0 -1
  439. package/dist/chunks/secrets-BieELnZh.js +0 -562
  440. package/dist/chunks/secrets-BieELnZh.js.map +0 -1
  441. package/dist/chunks/server-By-zktjx.js +0 -169
  442. package/dist/chunks/server-By-zktjx.js.map +0 -1
  443. package/dist/chunks/server-ids-DRuNLVCV.js +0 -32
  444. package/dist/chunks/server-ids-DRuNLVCV.js.map +0 -1
  445. package/dist/chunks/set-password-D5vZqqSX.js +0 -43
  446. package/dist/chunks/set-password-D5vZqqSX.js.map +0 -1
  447. package/dist/chunks/set-token-xJkA1IZp.js +0 -78
  448. package/dist/chunks/set-token-xJkA1IZp.js.map +0 -1
  449. package/dist/chunks/settings-xu-XTfWg.js.map +0 -1
  450. package/dist/chunks/setup-temp-CAN4_bA-.js.map +0 -1
  451. package/dist/chunks/shape-DnTKzjQ2.js +0 -24
  452. package/dist/chunks/shape-DnTKzjQ2.js.map +0 -1
  453. package/dist/chunks/src-BOBh9MBf.js.map +0 -1
  454. package/dist/chunks/status-B6f2-qhs.js.map +0 -1
  455. package/dist/chunks/ui-D562aqw5.js.map +0 -1
  456. package/dist/chunks/ui-dir-CsU3uLNV.js.map +0 -1
  457. package/dist/chunks/ui-release-DKzVvlLd.js.map +0 -1
  458. package/dist/chunks/ui-revert-EkBBwRTt.js.map +0 -1
  459. package/dist/chunks/ui-switch-BnZTdMDd.js.map +0 -1
  460. package/dist/chunks/ui-update-_xryLYxw.js.map +0 -1
  461. package/dist/chunks/up-DNZuTi2q.js.map +0 -1
  462. package/dist/chunks/usage-BrnDARNM.js.map +0 -1
  463. package/dist/chunks/workspaces-DYcfvKV_.js.map +0 -1
  464. package/dist/chunks/wsl-temperature-BiCI4iK6.js.map +0 -1
  465. package/dist/types/cli/set-password.d.ts +0 -14
  466. package/dist/types/cli/set-token.d.ts +0 -21
  467. package/uis/stock/dist/assets/CopyButton-BUBKRJyY.js +0 -1
  468. package/uis/stock/dist/assets/GlobalSettingsView-yYMcRWvt.js +0 -1
  469. package/uis/stock/dist/assets/LogViewer-DIliXy62.js +0 -1
  470. package/uis/stock/dist/assets/LogsView-B7Z-7RNg.js +0 -1
  471. package/uis/stock/dist/assets/Modal-DmKa5Qpp.js +0 -39
  472. package/uis/stock/dist/assets/ProxyView-DvZiNkwb.js +0 -1
  473. package/uis/stock/dist/assets/ServerDetailView-6idGT_EX.js +0 -2
  474. package/uis/stock/dist/assets/SettingsShell-CeGtleYI.js +0 -1
  475. package/uis/stock/dist/assets/SettingsView-BrhJIrmk.js +0 -2
  476. package/uis/stock/dist/assets/de-BRITeb0H.js +0 -1
  477. package/uis/stock/dist/assets/es-B2zIEssV.js +0 -1
  478. package/uis/stock/dist/assets/fr-s0ZOBEqh.js +0 -1
  479. package/uis/stock/dist/assets/index-C1MehbKy.css +0 -2
  480. package/uis/stock/dist/assets/index-CnBN54wF.js +0 -15
  481. package/uis/stock/dist/assets/ja-CU7MR85V.js +0 -1
  482. package/uis/stock/dist/assets/ko-tL5Me6d-.js +0 -1
  483. package/uis/stock/dist/assets/ru-92yrvkNJ.js +0 -1
  484. package/uis/stock/dist/assets/vi-CzvY16k2.js +0 -1
  485. package/uis/stock/dist/assets/zh-CN-DDwFW_uW.js +0 -1
@@ -1,50 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import fs from "node:fs";
3
- import { Buffer } from "node:buffer";
4
- //#region src/helpers/config-text.ts
5
- var config_text_exports = /* @__PURE__ */ __exportAll({
6
- decodeStateFile: () => decodeStateFile,
7
- readStateFile: () => readStateFile
8
- });
9
- /**
10
- * Decodes a hand-editable state file the way the editors that write them save it.
11
- *
12
- * A file the panel invites a person to hand-edit arrives the way their editor saved it, and the
13
- * editors that write one on Windows prepend a **byte-order mark**: PowerShell's
14
- * `Set-Content -Encoding UTF8` (5.1) and `Out-File`/`>` (UTF-16LE) both do, and Notepad writes one
15
- * for a "UTF-8 with BOM" save. For JSON the refusal is a parse error naming an invisible character
16
- * — `Unexpected token '\uFEFF'` — so the person is told their JSON is broken when it is not. For a
17
- * `KEY=value` file it is quieter: every key carries a NUL and is dropped, so the process starts
18
- * without the secrets the file exists to hold.
19
- *
20
- * Stripping the mark is not a silent coercion: a BOM is not content, and a file whose real
21
- * content is unchanged parses to the same object with or without it. UTF-16 is decoded rather
22
- * than refused because that is what `>` produces on Windows, and it is recognisable from its own
23
- * prefix — a file in neither encoding still fails loudly in the reader above.
24
- *
25
- * Read as a `Buffer`, never with `'utf8'`: a `'utf8'` read of UTF-16LE text has already lost
26
- * the information this needs to tell them apart.
27
- */
28
- function decodeStateFile(bytes) {
29
- if (bytes.length >= 2) {
30
- if (bytes[0] === 255 && bytes[1] === 254) return stripBom(bytes.subarray(2).toString("utf16le"));
31
- if (bytes[0] === 254 && bytes[1] === 255) {
32
- const swapped = Buffer.from(bytes.subarray(2));
33
- swapped.swap16();
34
- return stripBom(swapped.toString("utf16le"));
35
- }
36
- }
37
- return stripBom(bytes.toString("utf8"));
38
- }
39
- /** A UTF-8 BOM is three bytes; Node decodes it to the one `\uFEFF` character. */
40
- function stripBom(text) {
41
- return text.charCodeAt(0) === 65279 ? text.slice(1) : text;
42
- }
43
- /** `decodeStateFile` for a path. Missing files still throw `ENOENT`, as a caller expects. */
44
- function readStateFile(file) {
45
- return decodeStateFile(fs.readFileSync(file));
46
- }
47
- //#endregion
48
- export { readStateFile as n, config_text_exports as t };
49
-
50
- //# sourceMappingURL=config-text-DifCHhnz.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-text-DifCHhnz.js","names":[],"sources":["../../src/helpers/config-text.ts"],"sourcesContent":["import { Buffer } from 'node:buffer'\nimport fs from 'node:fs'\n\n/**\n * Decodes a hand-editable state file the way the editors that write them save it.\n *\n * A file the panel invites a person to hand-edit arrives the way their editor saved it, and the\n * editors that write one on Windows prepend a **byte-order mark**: PowerShell's\n * `Set-Content -Encoding UTF8` (5.1) and `Out-File`/`>` (UTF-16LE) both do, and Notepad writes one\n * for a \"UTF-8 with BOM\" save. For JSON the refusal is a parse error naming an invisible character\n * — `Unexpected token '\\uFEFF'` — so the person is told their JSON is broken when it is not. For a\n * `KEY=value` file it is quieter: every key carries a NUL and is dropped, so the process starts\n * without the secrets the file exists to hold.\n *\n * Stripping the mark is not a silent coercion: a BOM is not content, and a file whose real\n * content is unchanged parses to the same object with or without it. UTF-16 is decoded rather\n * than refused because that is what `>` produces on Windows, and it is recognisable from its own\n * prefix — a file in neither encoding still fails loudly in the reader above.\n *\n * Read as a `Buffer`, never with `'utf8'`: a `'utf8'` read of UTF-16LE text has already lost\n * the information this needs to tell them apart.\n */\nexport function decodeStateFile(bytes: Buffer): string {\n if (bytes.length >= 2) {\n if (bytes[0] === 0xFF && bytes[1] === 0xFE)\n return stripBom(bytes.subarray(2).toString('utf16le'))\n if (bytes[0] === 0xFE && bytes[1] === 0xFF) {\n // UTF-16BE: swap into LE, the only order Node decodes.\n const swapped = Buffer.from(bytes.subarray(2))\n swapped.swap16()\n return stripBom(swapped.toString('utf16le'))\n }\n }\n return stripBom(bytes.toString('utf8'))\n}\n\n/** A UTF-8 BOM is three bytes; Node decodes it to the one `\\uFEFF` character. */\nfunction stripBom(text: string): string {\n return text.charCodeAt(0) === 0xFEFF ? text.slice(1) : text\n}\n\n/** `decodeStateFile` for a path. Missing files still throw `ENOENT`, as a caller expects. */\nexport function readStateFile(file: string): string {\n return decodeStateFile(fs.readFileSync(file))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,gBAAgB,OAAuB;CACrD,IAAI,MAAM,UAAU,GAAG;EACrB,IAAI,MAAM,OAAO,OAAQ,MAAM,OAAO,KACpC,OAAO,SAAS,MAAM,SAAS,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC;EACvD,IAAI,MAAM,OAAO,OAAQ,MAAM,OAAO,KAAM;GAE1C,MAAM,UAAU,OAAO,KAAK,MAAM,SAAS,CAAC,CAAC;GAC7C,QAAQ,OAAO;GACf,OAAO,SAAS,QAAQ,SAAS,SAAS,CAAC;EAC7C;CACF;CACA,OAAO,SAAS,MAAM,SAAS,MAAM,CAAC;AACxC;;AAGA,SAAS,SAAS,MAAsB;CACtC,OAAO,KAAK,WAAW,CAAC,MAAM,QAAS,KAAK,MAAM,CAAC,IAAI;AACzD;;AAGA,SAAgB,cAAc,MAAsB;CAClD,OAAO,gBAAgB,GAAG,aAAa,IAAI,CAAC;AAC9C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"contracts-CMBD1TF9.js","names":[],"sources":["../../src/shared/host-readings.ts","../../src/shared/contracts.ts"],"sourcesContent":["/**\n * The host's measurements, and the one place that decides a sample exists.\n *\n * `emptyHostView()` is what `HostMonitor` starts from, and it is also the frame a panel keeps for\n * ever when host vitals are switched off: `sampledAt: null`, with **every value zero** because the\n * wire type says `number`. `/api/metrics` refuses to publish those zeros — a scrape has no page to\n * qualify a number, so a `0` it invents silences the alert rule that exists to catch a full disk.\n * The panel's own pages read the same frame and printed it: `0.0%` memory, `0.0%` swap, `0.00`\n * load, under a head that says \"sampling off\". On a homelab box being told memory is at 0% is the\n * same lie as a dashboard being told it, told to the person instead.\n *\n * So `sampledAt === null` means \"nothing has been measured\" and every reading here is `null`.\n * The zeros stay on the wire: an older overridden UI under `.hh/.ui` reads `memoryUsedPercent` as a\n * `number` and calls `.toFixed()` on it, so a nullable field would crash it — the absence is decided\n * where it is rendered, once, instead.\n *\n * `cpus` and `uptimeMs` are **not** readings: they describe the machine, not a sample, and the\n * empty frame already reports them truthfully.\n *\n * `loadAlertPerCpu` is not a reading either: it is the threshold the panel *notifies* on, and it\n * travels with the frame so a surface can band the load against the number a person actually\n * chose. `AGENTS.md` names the rule — a verdict is measured against the configured threshold, and\n * one module decides it — after two surfaces hardcoded the default and kept calling a box a person\n * had raised the threshold on `danger`, for a notification that stayed silent.\n */\n\n/**\n * The load per cpu a panel notifies on when nothing else is configured.\n *\n * One home: `hostSchema` defaults to it, and a surface reading a frame from a panel that predates\n * the field bands its load against the same number the older panel alerted on.\n */\nexport const LOAD_ALERT_PER_CPU_DEFAULT = 2\n\n/**\n * The alert thresholds a percentage reading is banded against, when the frame carries none.\n *\n * One home, the same rule as `LOAD_ALERT_PER_CPU_DEFAULT`: `hostSchema` defaults to these, and a\n * surface reading a frame from a panel that predates the fields bands against the numbers that\n * panel alerted on.\n */\nexport const HOST_ALERT_DEFAULTS = { diskUsedPercent: 90, memoryUsedPercent: 90, swapUsedPercent: 50, tempCelsius: 85 } as const\n\n/** A configurable alert threshold, as it travels on the frame. */\nexport interface HostAlertThresholds {\n /** `host.diskUsedPercent` — the threshold the panel notifies on, `0` disabling it. */\n diskUsedPercentAlert?: number\n /** `host.memoryUsedPercent` — the threshold the panel notifies on, `0` disabling it. */\n memoryUsedPercentAlert?: number\n swapUsedPercentAlert?: number\n tempCelsiusAlert?: number\n}\n\n/** One configured filesystem, with the band its own usage is painted in. */\nexport interface HostDiskReading {\n path: string\n totalBytes: number\n freeBytes: number\n usedPercent: number\n /**\n * How urgent that filesystem's usage is, against `host.diskUsedPercent` — the threshold the panel\n * **notifies** on — else `null` when nothing was measured.\n *\n * It rides on the disk rather than beside the frame because the threshold is per-path usage and a\n * frame can carry several paths; a single `diskBand` next to `memoryBand` would answer for one of\n * them. The band was the last literal: `Gauge`/`Meter` defaulted to `75`/`90` and both\n * noc-console surfaces restated the same pair, which is `hostSchema`'s *default*, so lowering\n * `host.diskUsedPercent` to 80 made the panel notify at 82% while every surface called it `warn`.\n */\n band: HostBand\n}\n\n/** What the predicate needs: the sample's stamp and the numbers the frame carries. */\nexport interface HostReadingSource extends HostAlertThresholds {\n sampledAt: number | null\n cpus: number\n /** The alert thresholds from the panel's own config; absent on a panel that predates the fields. */\n loadAlertPerCpu?: number\n cpuUsedPercent?: number | null\n memoryUsedPercent: number\n swapUsedPercent: number\n loadAvg: number[]\n tempCelsius: number | null\n disks: Array<{ path: string, totalBytes: number, freeBytes: number, usedPercent: number }>\n}\n\n/** One host sample, with every measurement absent until the host has been sampled. */\nexport interface HostReadings {\n /** Whether the frame carries a sample at all. */\n sampled: boolean\n cpuUsedPercent: number | null\n memoryUsedPercent: number | null\n swapUsedPercent: number | null\n load1m: number | null\n load5m: number | null\n load15m: number | null\n /**\n * The 1-minute load as a share of one core. Load is a **count of runnable tasks**, so this is a\n * count per core, never a percentage — `1.00` is one core's worth of work.\n */\n loadPerCpu: number | null\n tempCelsius: number | null\n /** Each configured filesystem, carrying its own band. Empty when nothing was sampled. */\n disks: HostDiskReading[]\n /**\n * How urgent that per-cpu load is: `null` when nothing was measured (an absent reading has no\n * band of its own, or a zero would read as healthy), else the alert threshold it crossed.\n */\n loadBand: HostBand\n /**\n * The same verdict for the three percentage readings, each against the threshold the panel\n * **notifies** on — `null` when nothing was measured. A surface paints `thresholdBand`, never a\n * literal: the swap bar used to call 50% `warn` while the alert fired there, and a raised\n * `tempCelsius` left a box painted `danger` for a notification that never arrives.\n */\n memoryBand: HostBand\n swapBand: HostBand\n tempBand: HostBand\n}\n\n/** A reading's urgency, or `null` when there is no reading to judge. */\nexport type HostBand = 'ok' | 'warn' | 'danger' | null\n\nconst NOTHING_SAMPLED: HostReadings = {\n sampled: false,\n cpuUsedPercent: null,\n memoryUsedPercent: null,\n swapUsedPercent: null,\n load1m: null,\n load5m: null,\n load15m: null,\n loadPerCpu: null,\n tempCelsius: null,\n disks: [],\n loadBand: null,\n memoryBand: null,\n swapBand: null,\n tempBand: null,\n}\n\n/** A number the frame carries, or null when it carries none. */\nfunction present(value: number | null | undefined): number | null {\n return typeof value === 'number' && Number.isFinite(value) ? value : null\n}\n\n/**\n * How a per-cpu load sits against the threshold the panel notifies on.\n *\n * The ratio is what a person configures: `host.loadPerCpu` is the count the alert fires at, so\n * `danger` is that number itself and `warn` is the approach to it. `0` disables the alert in\n * `sampleHost`, so nothing can breach it and the band is `ok` — painting a box red for a\n * notification that will never arrive is the same defect as inventing a reading. It lives here\n * rather than in a component so both UIs share one band, the mistake that produced two hardcoded\n * copies of the default.\n */\nexport function loadBand(loadPerCpu: number | null, alertPerCpu: number | undefined): HostBand {\n return thresholdBand(loadPerCpu, alertPerCpu, LOAD_ALERT_PER_CPU_DEFAULT)\n}\n\n/**\n * The band for the host's own CPU share, which has no configurable alert.\n *\n * `host.cpuUsedPercent` is a share of the whole machine, and `hostSchema` has no threshold for it —\n * so there is nothing a person chose for a surface to follow, and a fixed band is a decision. The\n * decision is *this one*: the two UIs disagreed (noc-console painted 70/90, every stock dial 80/95),\n * so one 75% reading came back `warn` on one page and `ok` on the other — `AGENTS.md`'s \"UIs move\n * together\" broken by two literal pairs. A real alert would make this a `…Alert` field on the frame\n * like its neighbours; until then it is a constant here, not a pair at each call site.\n */\nexport const HOST_CPU_BAND = { warnAt: 80, dangerAt: 95 } as const\n\n/** The band for a host cpu share, against {@link HOST_CPU_BAND}. */\nexport function hostCpuBand(percent: number | null): HostBand {\n if (percent === null || !Number.isFinite(percent))\n return null\n // An explicit pair, not `thresholdBand`'s 70%-of-the-alert: these are two chosen numbers, and\n // deriving one from the other moved the warn line to 66.5 for a band written as 80/95.\n if (percent >= HOST_CPU_BAND.dangerAt)\n return 'danger'\n if (percent >= HOST_CPU_BAND.warnAt)\n return 'warn'\n return 'ok'\n}\n\n/**\n * How a reading sits against the threshold the panel notifies on.\n *\n * `danger` at the threshold is the whole point: the alert fires there, so a bar that stays `warn`\n * while a notification goes out disagrees with the panel's own verdict. `0` disables that alert in\n * `sampleHost`, so nothing can breach it and the band is `ok`. One rule for the per-cpu load, the\n * three percentages and each disk — they differ only in what the number means, and the mistake this\n * replaced was four surfaces each deciding a band for itself.\n */\nexport function percentageBand(value: number | null, alertAt: number | undefined, fallback: number): HostBand {\n return thresholdBand(value, alertAt, fallback)\n}\n\n/**\n * The full scale of a temperature dial: the threshold the panel **notifies** on.\n *\n * There is no natural `100 °C`, so unlike a percentage a temperature has no scale of its own —\n * the alert is the only number a person configured for it, and it is what the dial is drawn\n * against. `0` disables the alert and leaves no scale to draw, so the default the older panels\n * alerted on is kept rather than dividing by zero.\n *\n * This exists because the *band* was moved onto the frame and the *scale* was not: one stock\n * surface scaled by `tempCelsiusAlert` while the other kept `(tempCelsius / 85) * 100`, so one\n * frame at 60 °C against an alert of 95 drew arcs of `101.19` and `113.10` — the same number\n * fuller on one page than the other. A tone test cannot see that; only the arc can.\n */\nexport function tempScale(alertAt: number | undefined): number {\n return alertAt === undefined || !Number.isFinite(alertAt) || alertAt <= 0 ? HOST_ALERT_DEFAULTS.tempCelsius : alertAt\n}\n\n/**\n * How full a temperature dial is, as the percentage a `Gauge`/bar draws: a share of `tempScale`.\n *\n * `null` when nothing was measured — an absent reading has no dial, the same rule every other\n * reading on the frame follows.\n */\nexport function tempDialPercent(temp: number | null | undefined, alertAt: number | undefined): number | null {\n const value = present(temp)\n if (value === null)\n return null\n return (value / tempScale(alertAt)) * 100\n}\n\nfunction thresholdBand(value: number | null, alertAt: number | undefined, fallback: number): HostBand {\n if (value === null || !Number.isFinite(value))\n return null\n // An older panel sends no threshold, and it alerted on the default — so that is the band to draw.\n const threshold = alertAt === undefined || !Number.isFinite(alertAt) ? fallback : alertAt\n if (threshold <= 0)\n return 'ok'\n if (value >= threshold)\n return 'danger'\n if (value >= threshold * 0.7)\n return 'warn'\n return 'ok'\n}\n\n/** The readings of one host frame; a missing frame is the same as an unsampled one. */\nexport function hostReadings(host: HostReadingSource | null | undefined): HostReadings {\n if (host === null || host === undefined)\n return NOTHING_SAMPLED\n const sampled = host.sampledAt !== null\n if (!sampled)\n return { ...NOTHING_SAMPLED, disks: [] }\n // A truthy `sampledAt` is the only thing that makes a zero a reading: an honestly idle box\n // reports 0%, and that must survive as 0 rather than becoming an absence of its own.\n const load1m = present(host.loadAvg[0])\n const cpus = present(host.cpus)\n const loadPerCpu = load1m === null ? null : load1m / Math.max(1, cpus ?? 1)\n return {\n sampled: true,\n cpuUsedPercent: present(host.cpuUsedPercent),\n memoryUsedPercent: present(host.memoryUsedPercent),\n swapUsedPercent: present(host.swapUsedPercent),\n load1m,\n load5m: present(host.loadAvg[1]),\n load15m: present(host.loadAvg[2]),\n loadPerCpu,\n loadBand: loadBand(loadPerCpu, host.loadAlertPerCpu),\n memoryBand: percentageBand(present(host.memoryUsedPercent), host.memoryUsedPercentAlert, HOST_ALERT_DEFAULTS.memoryUsedPercent),\n swapBand: percentageBand(present(host.swapUsedPercent), host.swapUsedPercentAlert, HOST_ALERT_DEFAULTS.swapUsedPercent),\n tempBand: percentageBand(present(host.tempCelsius), host.tempCelsiusAlert, HOST_ALERT_DEFAULTS.tempCelsius),\n tempCelsius: present(host.tempCelsius),\n // Each disk is banded against the same configured alert, on its own usage.\n disks: host.disks.map(disk => ({\n ...disk,\n band: percentageBand(present(disk.usedPercent), host.diskUsedPercentAlert, HOST_ALERT_DEFAULTS.diskUsedPercent),\n })),\n }\n}\n","import { type } from 'arktype'\nimport { HOST_ALERT_DEFAULTS, LOAD_ALERT_PER_CPU_DEFAULT } from './host-readings'\nimport { lazy } from './lazy'\n\n/**\n * Schemas shared by the control plane and the SPA: the server entry shape, the\n * control panel's own settings, API DTOs and SSE frames. Nothing here knows\n * about a particular server — an entry carries its own command, args, env and\n * bootstrap.\n */\n\n/** `local` -> 127.0.0.1, `lan` -> 0.0.0.0, or an explicit IPv4 to bind. */\nconst bindSchema = lazy(() => type('\"local\" | \"lan\" | /^\\\\d{1,3}(?:\\\\.\\\\d{1,3}){3}$/'))\nexport type Bind = typeof bindSchema.infer\n\n/**\n * A top-level unit: its own settings, servers, secrets, logs and nanny state\n * under `$HHOSTED_HOME/.hh/<id>/`. The id is the directory name and never\n * changes; the label is what a person reads and may rename at will.\n */\nexport const workspaceIdSchema = lazy(() => type('/^[a-z0-9][a-z0-9_-]*$/'))\nexport const workspaceSchema = lazy(() => type({\n id: workspaceIdSchema,\n label: '1 <= string <= 60',\n}).onUndeclaredKey('reject'))\nexport type Workspace = typeof workspaceSchema.infer\n\n/** `id` is optional; when omitted it is derived from the label. */\nexport const workspaceCreateSchema = lazy(() => type({\n 'id?': workspaceIdSchema,\n 'label?': '1 <= string <= 60',\n}).onUndeclaredKey('reject'))\nexport type WorkspaceCreate = typeof workspaceCreateSchema.infer\n\nexport const workspaceRenameSchema = lazy(() => type({\n label: '1 <= string <= 60',\n}).onUndeclaredKey('reject'))\n\n/** Parses a bind value (`local` | `lan` | ipv4); null when it is not one. */\nexport function parseBind(value: string): Bind | null {\n const parsed = bindSchema(value)\n return parsed instanceof type.errors ? null : parsed\n}\n\n/** `null` means \"no port\": no readiness probe, no health supervision, no preflight. */\nexport const portSchema = lazy(() => type('1 <= number.integer <= 65535 | null'))\n\n/**\n * What to do when something already listens on the entry's port. `follow` and\n * `reclaim` only ever act on a holder proven to be this entry's own detached\n * successor (the `HHOSTED_SERVER_ID` marker, POSIX only); `kill` is the blunt one:\n * it stops any holder except the panel's own process tree.\n */\nexport const onPortConflictSchema = lazy(() => type.enumerated('block', 'warn', 'follow', 'reclaim', 'kill'))\nexport type OnPortConflict = typeof onPortConflictSchema.infer\n\nexport const restartSchema = lazy(() => type({\n enabled: 'boolean = true',\n maxRetries: 'number.integer >= 0 = 3',\n baseDelayMs: 'number >= 0 = 1000',\n factor: 'number >= 1 = 2',\n maxDelayMs: 'number >= 0 = 30000',\n /** A process alive this long is considered healthy again and the retry counter resets. */\n resetAfterMs: 'number >= 0 = 60000',\n}).onUndeclaredKey('reject'))\n\nexport type RestartConfig = typeof restartSchema.infer\n\nconst httpCheckSchema = lazy(() => type({\n /** `https` is for a backend that serves TLS itself; pair it with `allowInvalidCert` when it is self-signed. */\n scheme: '\"http\" | \"https\" = \"http\"',\n /** Accept any certificate. A self-signed pair is the normal case here, and the probe is local. */\n allowInvalidCert: 'boolean = false',\n /** Path on the server's own port, e.g. `/healthz`. */\n path: 'string = \"/\"',\n method: '\"GET\" | \"HEAD\" = \"GET\"',\n /** Exact status to accept; `null` (or omitted) means any status below `expectStatusBelow`. */\n expectStatus: 'number.integer | null?',\n expectStatusBelow: 'number.integer = 400',\n /** Substring that must appear in the response body. */\n expectBody: 'string = \"\"',\n}).onUndeclaredKey('reject'))\nexport type HttpCheckConfig = typeof httpCheckSchema.infer\n\n/** Restart guards for the process tree. */\nconst resourcesSchema = lazy(() => type({\n /** Restart when the tree's RSS exceeds this; 0 disables. */\n maxRssBytes: 'number.integer >= 0 = 0',\n}).onUndeclaredKey('reject'))\n\nexport const healthSchema = lazy(() => type({\n enabled: 'boolean = true',\n /** `port` = TCP connect only; `http` = fetch `http.path` and assert the response. */\n mode: '\"port\" | \"http\" = \"port\"',\n http: httpCheckSchema.default(() => ({})),\n intervalMs: 'number >= 500 = 5000',\n timeoutMs: 'number >= 100 = 1500',\n /** Consecutive failed probes before the warning state is shown. */\n unhealthyThreshold: 'number.integer >= 1 = 3',\n /** 0 disables it; otherwise a port stuck unhealthy this long forces a restart. */\n forceRestartAfterMs: 'number >= 0 = 0',\n /** How long to wait for the port to accept connections after spawn. */\n startTimeoutMs: 'number >= 0 = 20000',\n}).onUndeclaredKey('reject'))\n\nexport type HealthConfig = typeof healthSchema.infer\n\nexport const stopSchema = lazy(() => type({\n signal: '\"SIGTERM\" | \"SIGINT\" | \"SIGKILL\" = \"SIGTERM\"',\n killGroup: 'boolean = true',\n graceMs: 'number >= 0 = 5000',\n /** Last resort for wrappers that detach their real server. */\n killPortHolders: 'boolean = false',\n}).onUndeclaredKey('reject'))\n\nexport type StopConfig = typeof stopSchema.infer\n\nconst bootstrapSchema = lazy(() => type({\n command: 'string',\n args: type('string[]').default(() => []),\n env: type('Record<string, string>').default(() => ({})),\n timeoutMs: 'number >= 1000 = 120000',\n /** Run once per `up` session; whatever it installs persists on disk. */\n runOnce: 'boolean = true',\n}).onUndeclaredKey('reject'))\nexport const bootstrapOrNullSchema = lazy(() => bootstrapSchema.or(type('null')))\n\n/**\n * The `bootstrap` group as a patch carries it: every field optional, and **no defaults**.\n *\n * A patch must not fill a default in (`AGENTS.md`), and it could not here for a second reason.\n * `bootstrap` is not in `SERVER_MERGE_KEYS`, so `applyPatch` **replaces** the whole group; the\n * defaults on `bootstrapSchema` used to arrive with the patch, so sending one changed field\n * wrote a group with the other four reset. Measured on `PATCH /api/servers/db` with\n * `{\"bootstrap\":{\"command\":\"next.sh\"}}`: stored `args: [\"--ci\"]` became `[]`, `runOnce: false`\n * became `true` — re-arming a one-shot bootstrap to run on every `up` — and `timeoutMs: 5000`\n * became `120000`. The group is still replaced, so a caller sends the fields it means to keep;\n * what changes is that the panel no longer invents the ones it did not send.\n */\nconst bootstrapPatchSchema = lazy(() => type({\n command: 'string >= 1?',\n args: 'string[]?',\n env: 'Record<string, string>?',\n timeoutMs: 'number >= 1000?',\n runOnce: 'boolean?',\n}).onUndeclaredKey('reject'))\nconst bootstrapPatchOrNullSchema = lazy(() => bootstrapPatchSchema.or(type('null')))\n\n/**\n * A command run around a backup, for engines that need one to produce a consistent copy.\n *\n * `mongodump` is the reason this exists: copying `dbPath` while the server writes gives a torn copy,\n * and a dump taken by the engine is the only supported way. Same shape as `bootstrap` — one program\n * and its args, never a command line — and the same rule that the panel never guesses what an engine\n * needs.\n *\n * `{dumpDir}` is created before `dump` runs and captured by the archive; on restore the same\n * directory is filled again before `load` runs, so the two hooks see the same path.\n */\nconst backupHookSchema = lazy(() => type({\n // Non-empty: an empty command is accepted by `spawn`'s type but fails at run time, and a `dump`\n // hook that cannot start refuses **every** backup — a config mistake that reads as a broken feature.\n command: 'string >= 1',\n args: type('string[]').default(() => []),\n env: type('Record<string, string>').default(() => ({})),\n timeoutMs: 'number >= 1000 = 600000',\n /**\n * How long to wait for the entry to answer before running a `load`.\n *\n * Only matters for `load`, and only for an entry with no `port`: the wait is normally \"the port\n * accepts a connection\", which an entry that declares no port cannot offer. Two seconds by\n * default, because a portless entry usually starts fast and a fixed wait is pure delay; a slow\n * database reached over a socket should raise it.\n */\n waitMs: 'number >= 0 = 2000',\n}).onUndeclaredKey('reject'))\nconst backupHookOrNullSchema = lazy(() => backupHookSchema.or(type('null')))\n\n/**\n * The `dump`/`load` group as a patch carries it: every field optional, and **no defaults**.\n *\n * The same defect `bootstrapPatchSchema` exists for, in the same `editableFields`: both hooks are\n * replaced rather than merged, so the group's defaults used to arrive with a one-field edit and\n * reset `args`, `env`, `timeoutMs` and `waitMs` to values nobody sent. `waitMs` is the one that\n * bites hardest — a `load` waiting on a slow database would silently drop back to 2 s.\n */\nconst backupHookPatchSchema = lazy(() => type({\n command: 'string >= 1?',\n args: 'string[]?',\n env: 'Record<string, string>?',\n timeoutMs: 'number >= 1000?',\n waitMs: 'number >= 0?',\n}).onUndeclaredKey('reject'))\nconst backupHookPatchOrNullSchema = lazy(() => backupHookPatchSchema.or(type('null')))\n\nexport type BackupHookConfig = typeof backupHookSchema.infer\n\n/**\n * A label that may be written as `null`, which means \"no label\" — the same spelling `port` and\n * `bootstrap` already accept in a file.\n *\n * `serverSchema.label` was `'string?'`, so a hand-edited `\"label\": null` refused the **whole config** with\n * `servers[0] (\"web\"): label must be a string (was null)`. The write side already tolerates `null`, and every\n * display falls back with `label ?? id` — which `null` satisfies and `''` does not.\n */\nconst labelOrNullSchema = lazy(() => type('string | null'))\n\nexport const logBufferLinesSchema = lazy(() => type('50 <= number.integer <= 100000'))\n\nexport const serverSchema = lazy(() => type({\n id: '/^[a-z0-9][a-z0-9_-]*$/',\n label: labelOrNullSchema.optional(),\n enabled: 'boolean = true',\n autostart: 'boolean = false',\n /**\n * Handed to a nanny process that owns the pipes, so the entry keeps running when\n * this panel stops, restarts or is killed. `down`/`stop-all` leave it alone and\n * report it; only an explicit stop or restart stops it.\n */\n persistent: 'boolean = false',\n command: 'string >= 1',\n args: type('string[]').default(() => []),\n cwd: 'string = \".\"',\n env: type('Record<string, string>').default(() => ({})),\n /**\n * `ENV=path` pairs: exported to the process (overriding `env`) *and* the path\n * is backed up automatically — one declaration for data directories.\n */\n dataEnvs: type('Record<string, string>').default(() => ({})),\n bootstrap: bootstrapOrNullSchema.optional(),\n /**\n * Run before this entry's data is captured, writing into `{dumpDir}`.\n *\n * For a database: `mongodump --archive={dumpDir}/db.archive`. A failed dump **refuses the backup**\n * rather than archiving a stale directory next to it — the whole point is that the dump is the\n * authoritative copy.\n */\n dump: backupHookOrNullSchema.optional(),\n /** Run after this entry's data is restored, reading from `{dumpDir}`. Its server is stopped first. */\n load: backupHookOrNullSchema.optional(),\n port: portSchema.optional(),\n bind: bindSchema.default(() => 'local' as const),\n // The stored forms carry the default; a patch must not (see the patch schemas below).\n onPortConflict: onPortConflictSchema.default('block'),\n restart: restartSchema.default(() => ({})),\n health: healthSchema.default(() => ({})),\n stop: stopSchema.default(() => ({})),\n logBufferLines: logBufferLinesSchema.default(() => 500),\n /** Ids this server needs running first (and healthy); `stop-all` stops dependents before it. */\n dependsOn: type('string[]').default(() => []),\n /** Optional KEY=value file loaded at spawn; its values override `env`. */\n envFile: 'string = \"\"',\n resources: resourcesSchema.default(() => ({})),\n /** Paths included in backups for this server (templates allowed). */\n backupPaths: type('string[]').default(() => []),\n /**\n * Skip well-known build output and dependency directories (`node_modules`,\n * `dist`, `.next`, caches, …) inside the paths this entry declares.\n */\n backupIgnoreGenerated: 'boolean = true',\n}).onUndeclaredKey('reject'))\nexport type ServerConfig = Omit<typeof serverSchema.infer, 'port'> & { port: number | null }\n\n/**\n * Authentication for the control panel itself. The password never lives here —\n * only the policy does; its scrypt hash sits in a git-ignored secrets file.\n */\nexport const authSchema = lazy(() => type({\n enabled: 'boolean = true',\n /** Idle timeout: a session dies this long after its **last** request, not after login. */\n sessionTtlMs: 'number >= 60000 = 604800000',\n /** `auto` adds `Secure` when the request arrived over https (proxy-aware). */\n cookieSecure: '\"auto\" | \"always\" | \"never\" = \"auto\"',\n /** Trust `x-forwarded-*` from a reverse proxy; also drives the client IP. */\n trustProxy: 'boolean | \"loopback\" = \"loopback\"',\n maxLoginAttempts: 'number.integer >= 1 = 5',\n lockoutMs: 'number >= 1000 = 60000',\n}).onUndeclaredKey('reject'))\nexport type AuthConfig = typeof authSchema.infer\n\n/**\n * The event toggles and the throttle — the part a target may **inherit** instead of setting.\n *\n * `enabled` is deliberately not here: \"send to this one\" is a property of the target, never\n * something to inherit. Everything else answers the same question for every transport, and one\n * definition means a fourth cannot quietly spell `onRecovered` differently.\n */\nconst notificationPolicyShape = {\n onCrash: 'boolean = true',\n onUnhealthy: 'boolean = true',\n onForcedRestart: 'boolean = true',\n onRecovered: 'boolean = false',\n /** Host vitals breaches (disk, memory, swap, load, temperature). */\n onHost: 'boolean = true',\n /** Dynamic DNS changes and failures. */\n onDdns: 'boolean = true',\n /** Per server *and* reason, so a flapping server cannot spam the chat. */\n cooldownMs: 'number >= 0 = 120000',\n} as const\n\n/**\n * The general settings: what applies to every target that does not override it.\n *\n * The point of the block is that the common case — \"tell me about crashes and host thresholds,\n * throttled every two minutes\" — is set **once**, instead of once per transport and again per\n * destination.\n */\nexport const notificationDefaultsSchema = lazy(() => type({\n ...notificationPolicyShape,\n}).onUndeclaredKey('reject'))\nexport type NotificationDefaults = typeof notificationDefaultsSchema.infer\n\n/**\n * The same block **as a response**: tolerant of a key this release does not know.\n *\n * A request schema rejects undeclared keys, a response schema must not — an upgrade writes a new UI\n * while an old panel keeps serving, and a newer panel adding one field here must not blank this\n * build's whole app. Reusing the strict schema in the view did exactly that: one additive key in\n * `defaults` rejected the state frame and the page went blank.\n */\nconst notificationDefaultsViewSchema = lazy(() => type({\n ...notificationPolicyShape,\n}))\n\n/**\n * Whether a target follows the general block or carries its own.\n *\n * **Defaults to `true`**, which is what an existing config means: before this block existed every\n * target carried its own toggles, and reading one as \"inherit\" would silently change which events\n * it delivers on upgrade. A target the page creates opts *in* to inheritance explicitly, so the\n * new default applies to new targets without rewriting anybody's config.\n */\nconst useOwnSettingsSchema = 'boolean = true'\n\n/**\n * One Telegram destination.\n *\n * `chatId` is config; the bot token is a **secret**, keyed by this target's `id` in the workspace's\n * `.secrets.json`. More than one is allowed, which is why the token cannot be a singleton any more.\n */\nconst telegramDestinationSchema = lazy(() => type({\n kind: '\"telegram\"',\n id: '/^[a-z0-9][a-z0-9_-]*$/',\n /** Off until configured: a bare `enabled: true` with no chat would fail every send. */\n enabled: 'boolean = false',\n chatId: 'string = \"\"',\n useOwnSettings: useOwnSettingsSchema,\n ...notificationPolicyShape,\n // Rejects any other key, which is what keeps a `botToken` out of a config file: without this the\n // schema tolerated it, so a hand-edited settings.json loaded a plaintext secret with no warning.\n}).onUndeclaredKey('reject'))\n\n/**\n * One webhook target: a URL, a method, and the headers to send with it.\n *\n * This is the general transport, and it is a *list* because a home panel alerts more than one\n * place — a phone, a chat channel, a dashboard. The headers are what make it general rather\n * than JSON-only: ntfy wants `Title`/`Priority` headers with a plain-text body, a bearer-token\n * receiver wants `Authorization`, and a JSON receiver wants `content-type`. One shape covers\n * all three; a per-service adapter would be a code change per service.\n */\n/** One webhook destination. */\nconst webhookTargetSchema = lazy(() => type({\n kind: '\"webhook\"',\n id: '/^[a-z0-9][a-z0-9_-]*$/',\n /** Empty only while the target is a draft; the page will not save one without it. */\n url: 'string = \"\"',\n enabled: 'boolean = true',\n method: '\"POST\" | \"PUT\" = \"POST\"',\n /** Payload format: `json` sends the event as JSON, `text` sends the plain message. */\n format: '\"json\" | \"text\" = \"json\"',\n /**\n * Extra headers, `Name: value` per line. The one field that lets this transport talk to\n * ntfy (`Title`, `Priority`), a bearer-token endpoint (`Authorization`) or anything else\n * with a header-shaped contract.\n */\n headers: 'string = \"\"',\n useOwnSettings: useOwnSettingsSchema,\n ...notificationPolicyShape,\n}).onUndeclaredKey('reject'))\nexport type WebhookTarget = typeof webhookTargetSchema.infer\n\n/** A destination is one of the kinds this build can deliver to. */\nconst notificationTargetSchema = lazy(() => telegramDestinationSchema.or(webhookTargetSchema))\nexport type NotificationTarget = typeof notificationTargetSchema.infer\n\n/**\n * The destination list.\n *\n * `id` is the list key — the cooldown, the last-result record and a Telegram target's token are all\n * keyed by it — so it must be unique across kinds, not just within one. Enforced by\n * `duplicateWebhookIds` at the write; a schema `narrow` cannot be rendered to JSON Schema and every\n * route's `toJsonSchema()` would throw.\n */\nconst destinationListSchema = lazy(() => notificationTargetSchema.array())\n\nexport const notificationsSchema = lazy(() => type({\n /** What every destination inherits unless it carries its own settings. */\n defaults: notificationDefaultsSchema.default(() => ({})),\n /** Replaced by a patch, the same way `ddns.accounts` is: a merge cannot express removing one. */\n destinations: destinationListSchema.default(() => []),\n}).onUndeclaredKey('reject'))\n\n/**\n * The ids that appear more than once, so a write can refuse them.\n *\n * A schema-level check is not available here (see above), and this is the one shape that has to\n * be told apart from a plain validation error: the list is valid, but its identity is not.\n */\nexport function duplicateWebhookIds(targets: ReadonlyArray<{ id: string }>): string[] {\n const seen = new Set<string>()\n const duplicates = new Set<string>()\n for (const target of targets) {\n if (seen.has(target.id))\n duplicates.add(target.id)\n seen.add(target.id)\n }\n return [...duplicates]\n}\nexport type NotificationsConfig = typeof notificationsSchema.infer\n\n/** On-disk log retention for the Logs page. */\nexport const logsSchema = lazy(() => type({\n persist: 'boolean = true',\n /** Per server, before rotating to `.1`, `.2`, ... */\n maxBytes: '10000 <= number <= 100000000 = 2000000',\n keep: '1 <= number.integer <= 10 = 3',\n}).onUndeclaredKey('reject'))\nexport type LogsConfig = typeof logsSchema.infer\n\nexport const tlsSchema = lazy(() => type({\n enabled: 'boolean = false',\n}).onUndeclaredKey('reject'))\n\n/** Host-level vitals and their alert thresholds. */\nexport const hostSchema = lazy(() => type({\n enabled: 'boolean = true',\n intervalMs: 'number >= 5000 = 15000',\n /** Filesystems reported and alerted on; templates and `~` are expanded. */\n diskPaths: type('string[]').default(() => ['.']),\n /**\n * 0 disables an individual alert. Each default is written from `HOST_ALERT_DEFAULTS`, so the\n * number a fresh config gets and the number a surface bands against when a frame carries no\n * threshold are one value — the same one-home rule `loadPerCpu` follows below.\n */\n diskUsedPercent: `number >= 0 = ${HOST_ALERT_DEFAULTS.diskUsedPercent}`,\n memoryUsedPercent: `number >= 0 = ${HOST_ALERT_DEFAULTS.memoryUsedPercent}`,\n swapUsedPercent: `number >= 0 = ${HOST_ALERT_DEFAULTS.swapUsedPercent}`,\n /**\n * The per-cpu load the panel notifies on. One home: the frame's `loadAlertPerCpu` is this value,\n * and `loadBand` reads it, so a surface cannot band the load against a number nobody configured.\n */\n loadPerCpu: type('number >= 0').default(LOAD_ALERT_PER_CPU_DEFAULT),\n tempCelsius: `number >= 0 = ${HOST_ALERT_DEFAULTS.tempCelsius}`,\n /**\n * How to read the CPU temperature when the kernel exposes no sensor.\n *\n * A command whose stdout is a number in °C — the escape hatch for a machine this panel cannot read\n * for itself (a WSL2 guest, a VM, a board whose hwmon chip is unsupported). Empty means \"use the\n * built-in probe\". It runs on the sampling interval, so it must be cheap; `docs/SERVERS.md` carries\n * the WSL2 setup.\n */\n tempCommand: 'string <= 512 = \"\"',\n /** How long that command may run before it is killed, so a hung helper cannot stall a sample. */\n tempCommandTimeoutMs: '100 <= number <= 30000 = 5000',\n}).onUndeclaredKey('reject'))\nexport type HostConfig = typeof hostSchema.infer\n\n/** A record family the DDNS engine can point at this host. */\nconst ddnsRecordTypeSchema = lazy(() => type.enumerated('A', 'AAAA'))\nexport type DdnsRecordType = typeof ddnsRecordTypeSchema.infer\n\n/**\n * One DNS provider account. Its credentials are secrets and live in the secrets\n * file keyed by this `id`, never in the config.\n */\nconst ddnsAccountSchema = lazy(() => type({\n id: '/^[a-z0-9][a-z0-9_-]*$/',\n provider: 'string >= 1',\n label: 'string = \"\"',\n}).onUndeclaredKey('reject'))\nexport type DdnsAccount = typeof ddnsAccountSchema.infer\n\n/**\n * A hostname to keep pointed at this machine. That list is the whole user-facing\n * setup: the provider account it belongs to, and (optionally) which families.\n */\nexport const ddnsDomainSchema = lazy(() => type({\n 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])?)+$/',\n account: 'string >= 1',\n /** Records to keep current; `A` unless the host needs IPv6 too. */\n types: ddnsRecordTypeSchema.array().default(() => ['A' as const]),\n /**\n * The registered domain (apex) this host sits in. Only needed where a\n * provider cannot look it up and the guess is wrong (three-label suffixes).\n */\n zone: 'string?',\n /** Seconds; `1` means \"automatic\" where the provider supports it. */\n ttl: 'number.integer >= 1?',\n /** Proxying is a property of the record, not the panel: Cloudflare only. */\n proxied: 'boolean = false',\n enabled: 'boolean = true',\n}).onUndeclaredKey('reject'))\nexport type DdnsDomain = typeof ddnsDomainSchema.infer\n\n/** Which public IP families to detect; a provider is only called for the ones declared. */\nconst ddnsIpv4Schema = lazy(() => type({\n enabled: 'boolean = true',\n /** Override the public-IP endpoint; empty uses the built-in list. */\n url: 'string = \"\"',\n}).onUndeclaredKey('reject'))\n\nconst ddnsIpv6Schema = lazy(() => type({\n enabled: 'boolean = false',\n url: 'string = \"\"',\n}).onUndeclaredKey('reject'))\n\n/**\n * Dynamic DNS: keep a list of hostnames pointed at this machine's public IP.\n * Probing is cheap and constant; a provider is only called when the address it\n * last confirmed differs, which is what keeps simple endpoints (FreeDNS, No-IP)\n * inside their rate limits.\n */\nexport const ddnsConfigSchema = lazy(() => type({\n enabled: 'boolean = false',\n /** How often the public address is re-checked. */\n intervalMs: 'number >= 60000 = 300000',\n ipv4: ddnsIpv4Schema.default(() => ({})),\n ipv6: ddnsIpv6Schema.default(() => ({})),\n /** Default TTL for the records that accept one. */\n ttl: 'number.integer >= 1 = 1',\n accounts: ddnsAccountSchema.array().default(() => []),\n domains: ddnsDomainSchema.array().default(() => []),\n}).onUndeclaredKey('reject'))\nexport type DdnsConfig = typeof ddnsConfigSchema.infer\n\nconst ddnsRecordStateSchema = lazy(() => type('\"pending\" | \"ok\" | \"unchanged\" | \"error\" | \"skipped\"'))\nexport type DdnsRecordState = typeof ddnsRecordStateSchema.infer\n\n/** What happened to one hostname on the last pass. */\nconst ddnsRecordViewSchema = lazy(() => type({\n 'host': 'string',\n 'account': 'string',\n 'provider': 'string',\n 'type': ddnsRecordTypeSchema,\n 'ip': 'string | null',\n 'state': ddnsRecordStateSchema,\n 'message': 'string | null',\n 'updatedAt': 'number | null',\n /** The provider refused permanently; no retry until the hostname, account or credentials change, or a check. */\n 'stopped?': 'boolean',\n}))\nexport type DdnsRecordView = typeof ddnsRecordViewSchema.infer\n\n/** Live DDNS state, as the state frame and the settings page read it. */\nexport const ddnsStatusSchema = lazy(() => type({\n enabled: 'boolean',\n running: 'boolean',\n lastRunAt: 'number | null',\n lastResult: 'string | null',\n ipv4: 'string | null',\n ipv6: 'string | null',\n records: ddnsRecordViewSchema.array(),\n}))\nexport type DdnsStatus = typeof ddnsStatusSchema.infer\n\n/** What a provider needs from the person configuring it. */\nconst ddnsProviderFieldSchema = lazy(() => type({\n key: 'string',\n label: 'string',\n hint: 'string = \"\"',\n optional: 'boolean = false',\n}))\nexport type DdnsProviderField = typeof ddnsProviderFieldSchema.infer\n\n/** Provider capabilities, so the UI knows which options to show. */\nconst ddnsProviderInfoSchema = lazy(() => type({\n id: 'string',\n label: 'string',\n docsUrl: 'string',\n families: ddnsRecordTypeSchema.array(),\n fields: ddnsProviderFieldSchema.array(),\n ttl: 'boolean',\n proxied: 'boolean',\n /** These credentials can also answer an ACME DNS-01 challenge (a TXT record). */\n txt: 'boolean',\n}))\nexport type DdnsProviderInfo = typeof ddnsProviderInfoSchema.infer\n\n/** `GET /api/ddns`: the policy, the live state, and the providers this build knows. */\nexport const ddnsViewSchema = lazy(() => type({\n config: ddnsConfigSchema,\n status: ddnsStatusSchema,\n providers: ddnsProviderInfoSchema.array(),\n /** Account ids whose credentials are stored. */\n credentials: type('string[]'),\n}).onDeepUndeclaredKey('ignore'))\nexport type DdnsView = typeof ddnsViewSchema.infer\n\n/**\n * `PUT /api/ddns/credentials/:id`: the secret fields that provider declares.\n *\n * The provider travels with the request because the account may still be an\n * unsaved draft — the server needs its field list, not a config entry.\n */\nexport const ddnsCredentialsSchema = lazy(() => type({\n provider: 'string >= 1',\n credentials: type('Record<string, string>'),\n}).onUndeclaredKey('reject'))\n\n/**\n * The DDNS block as a patch: no defaults, and `accounts`/`domains` are lists a\n * patch **replaces** — a key-by-key merge cannot express removing a hostname.\n * `ipv4`/`ipv6` still merge, so a patch may decide just one of their members.\n */\nconst _ddnsPatchSchema = lazy(() => type({\n enabled: 'boolean?',\n intervalMs: 'number >= 60000?',\n ipv4: type({ enabled: 'boolean?', url: 'string?' }).onUndeclaredKey('reject').optional(),\n ipv6: type({ enabled: 'boolean?', url: 'string?' }).onUndeclaredKey('reject').optional(),\n ttl: 'number.integer >= 1?',\n accounts: ddnsAccountSchema.array().optional(),\n domains: ddnsDomainSchema.array().optional(),\n}).onUndeclaredKey('reject'))\nexport type DdnsPatch = typeof _ddnsPatchSchema.infer\n\n/** Tar archives of config, secrets, TLS and declared data paths. */\n/**\n * What an automatic backup captures, in the vocabulary the manual dialog and the CLI already use.\n *\n * `only` is `--include`, `except` is `--all --exclude`, and both name the same ids: a coarse id\n * (`workspace:default`) covers every leaf under it. Omitted means the full default scope, which is\n * what a schedule written before this field existed must keep meaning.\n *\n * An empty `ids` is refused rather than read as either \"nothing\" or \"everything\": those are the two\n * readings a person cannot tell apart from the file, and one of them captures nothing at all.\n */\nconst backupScopeSchema = lazy(() => type({\n mode: '\"only\" | \"except\"',\n ids: type('string >= 1').array().atLeastLength(1),\n}).onUndeclaredKey('reject'))\nexport type BackupScope = typeof backupScopeSchema.infer\n\n/** The scheduled half: an interval, a retention of its own, and what it captures. */\nexport const backupScheduleSchema = lazy(() => type({\n /** 0 turns the schedule off; otherwise the gap between automatic archives. */\n intervalMs: 'number.integer >= 0 = 0',\n /** How many automatic archives to keep. Manual ones are never pruned by it. */\n keep: 'number.integer >= 1 = 7',\n /**\n * Absent means the whole default scope — every workspace and `includePaths`. Deliberately not\n * defaulted to an explicit value: a reader cannot tell an untouched file from one that chose\n * \"everything\", and a default here would rewrite every existing schedule on its first save.\n */\n scope: backupScopeSchema.optional(),\n}).onUndeclaredKey('reject'))\nexport type BackupScheduleConfig = typeof backupScheduleSchema.infer\n\nexport const backupsSchema = lazy(() => type({\n enabled: 'boolean = true',\n dir: 'string = \".backups\"',\n /** How many archives to keep in total, newest first. */\n keep: 'number.integer >= 1 = 5',\n /** Extra paths in every backup, in addition to each server's `backupPaths`. */\n includePaths: type('string[]').default(() => []),\n schedule: backupScheduleSchema.default(() => ({})),\n}).onUndeclaredKey('reject'))\nexport type BackupsConfig = typeof backupsSchema.infer\n\nconst 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))\n\nexport const controlSchema = lazy(() => type({\n /** What the panel calls itself; the stock UI shows it in the sidebar. */\n label: '1 <= string <= 60 = \"home-hosted\"',\n port: '1 <= number.integer <= 65535 = 3999',\n /** Where the control panel itself listens; keep it `local` unless you mean it. */\n host: bindSchema.default(() => 'local' as const),\n openBrowser: 'boolean = false',\n /**\n * Public hostnames the panel answers to, besides IPs, local names and its own proxy routes —\n * a name an external reverse proxy or tunnel forwards. `*.example.com` matches subdomains.\n */\n allowedHosts: allowedHostsSchema.default(() => []),\n auth: authSchema.default(() => ({})),\n tls: tlsSchema.default(() => ({})),\n}).onUndeclaredKey('reject'))\nexport type ControlConfig = typeof controlSchema.infer\n\n/** Applied to every server entry; whatever an entry sets wins. */\nexport const defaultsSchema = lazy(() => type({\n enabled: 'boolean = true',\n autostart: 'boolean = false',\n bind: bindSchema.default(() => 'local' as const),\n // The stored forms carry the default; a patch must not (see the patch schemas below).\n onPortConflict: onPortConflictSchema.default('block'),\n restart: restartSchema.default(() => ({})),\n health: healthSchema.default(() => ({})),\n stop: stopSchema.default(() => ({})),\n logBufferLines: logBufferLinesSchema.default(() => 500),\n}).onUndeclaredKey('reject'))\nexport type ServerDefaults = typeof defaultsSchema.infer\n\n// Patch variants stay default-free: an API client sends only what it changes, so\n// a partial nested group must not silently pull in the code defaults.\nconst restartPatchSchema = lazy(() => type({\n enabled: 'boolean?',\n maxRetries: 'number.integer >= 0?',\n baseDelayMs: 'number >= 0?',\n factor: 'number >= 1?',\n maxDelayMs: 'number >= 0?',\n resetAfterMs: 'number >= 0?',\n}).onUndeclaredKey('reject'))\n\nconst httpCheckPatchSchema = lazy(() => type({\n scheme: '\"http\" | \"https\"?',\n allowInvalidCert: 'boolean?',\n path: 'string?',\n method: '\"GET\" | \"HEAD\"?',\n expectStatus: 'number.integer | null?',\n expectStatusBelow: 'number.integer?',\n expectBody: 'string?',\n}).onUndeclaredKey('reject'))\n\nconst resourcesPatchSchema = lazy(() => type({\n maxRssBytes: 'number.integer >= 0?',\n}).onUndeclaredKey('reject'))\n\nconst healthPatchSchema = lazy(() => type({\n enabled: 'boolean?',\n mode: '\"port\" | \"http\"?',\n http: httpCheckPatchSchema.optional(),\n intervalMs: 'number >= 500?',\n timeoutMs: 'number >= 100?',\n unhealthyThreshold: 'number.integer >= 1?',\n forceRestartAfterMs: 'number >= 0?',\n startTimeoutMs: 'number >= 0?',\n}).onUndeclaredKey('reject'))\n\nconst stopPatchSchema = lazy(() => type({\n signal: '\"SIGTERM\" | \"SIGINT\" | \"SIGKILL\"?',\n killGroup: 'boolean?',\n graceMs: 'number >= 0?',\n killPortHolders: 'boolean?',\n}).onUndeclaredKey('reject'))\n\nconst authPatchSchema = lazy(() => type({\n enabled: 'boolean?',\n sessionTtlMs: 'number >= 60000?',\n cookieSecure: '\"auto\" | \"always\" | \"never\"?',\n trustProxy: 'boolean | \"loopback\"?',\n maxLoginAttempts: 'number.integer >= 1?',\n lockoutMs: 'number >= 1000?',\n}).onUndeclaredKey('reject'))\n\nconst notificationPolicyPatchShape = {\n onCrash: 'boolean?',\n onUnhealthy: 'boolean?',\n onForcedRestart: 'boolean?',\n onRecovered: 'boolean?',\n onHost: 'boolean?',\n onDdns: 'boolean?',\n cooldownMs: 'number >= 0?',\n} as const\n\n/**\n * The patch shape for one destination.\n *\n * `kind` is required: a patch cannot change a destination's kind (that would silently drop its\n * credential), so it names the kind it is addressing. The list is **replaced**, not merged — a merge\n * cannot express removing a destination, the same reason `ddns.accounts` is replaced.\n */\nconst destinationPatchSchema = lazy(() => type({\n kind: '\"telegram\" | \"webhook\"',\n id: '/^[a-z0-9][a-z0-9_-]*$/',\n enabled: 'boolean?',\n useOwnSettings: 'boolean?',\n /** Telegram only. */\n chatId: 'string?',\n /** Webhook only. */\n url: 'string?',\n method: '\"POST\" | \"PUT\"?',\n format: '\"json\" | \"text\"?',\n headers: 'string?',\n ...notificationPolicyPatchShape,\n}).onUndeclaredKey('reject'))\n\nconst notificationsPatchSchema = lazy(() => type({\n /** Merged key by key, like the other nested groups. */\n /**\n * A merge key-by-key, and **every field optional** — `notificationPolicyPatchShape`, not a\n * `.partial()` of the defaults schema.\n *\n * ArkType's `.partial()` leaves a field's `= false` / `= 120000` default in place, so a body of\n * `{ onHost: false }` validated into all seven keys and one toggle overwrote the rest. A patch\n * schema here carries no defaults (the rule for every patch), and the store merges it over the\n * stored block.\n */\n defaults: type({ ...notificationPolicyPatchShape }).onUndeclaredKey('reject').optional(),\n /** Replaced whole, so a removed destination stays removed. */\n destinations: destinationPatchSchema.array().optional(),\n}).onUndeclaredKey('reject'))\n\nconst hostPatchSchema = lazy(() => type({\n enabled: 'boolean?',\n intervalMs: 'number >= 5000?',\n diskPaths: type('string[]').optional(),\n diskUsedPercent: 'number >= 0?',\n memoryUsedPercent: 'number >= 0?',\n swapUsedPercent: 'number >= 0?',\n loadPerCpu: 'number >= 0?',\n tempCelsius: 'number >= 0?',\n tempCommand: 'string <= 512?',\n tempCommandTimeoutMs: '100 <= number <= 30000?',\n}).onUndeclaredKey('reject'))\n\nconst backupSchedulePatchSchema = lazy(() => type({\n intervalMs: 'number.integer >= 0?',\n keep: 'number.integer >= 1?',\n /**\n * No defaults, like every patch: `null` clears it back to the full default scope, which is the\n * only way to spell \"forget the choice I made\" — an omitted key means \"leave it as it is\".\n */\n scope: backupScopeSchema.or(type('null')).optional(),\n}).onUndeclaredKey('reject'))\n\nconst backupsPatchSchema = lazy(() => type({\n enabled: 'boolean?',\n dir: 'string?',\n keep: 'number.integer >= 1?',\n includePaths: type('string[]').optional(),\n schedule: backupSchedulePatchSchema.optional(),\n}).onUndeclaredKey('reject'))\n\nconst logsPatchSchema = lazy(() => type({\n persist: 'boolean?',\n maxBytes: '10000 <= number <= 100000000?',\n keep: '1 <= number.integer <= 10?',\n}).onUndeclaredKey('reject'))\n\nconst tlsPatchSchema = lazy(() => type({\n enabled: 'boolean?',\n}).onUndeclaredKey('reject'))\n\nconst controlPatchSchema = lazy(() => type({\n label: '1 <= string <= 60 | null?',\n port: '1 <= number.integer <= 65535?',\n host: bindSchema.optional(),\n openBrowser: 'boolean?',\n allowedHosts: allowedHostsSchema.optional(),\n auth: authPatchSchema.optional(),\n tls: tlsPatchSchema.optional(),\n}).onUndeclaredKey('reject'))\n\nconst defaultsPatchSchema = lazy(() => type({\n enabled: 'boolean?',\n autostart: 'boolean?',\n bind: bindSchema.optional(),\n onPortConflict: onPortConflictSchema.optional(),\n restart: restartPatchSchema.optional(),\n health: healthPatchSchema.optional(),\n stop: stopPatchSchema.optional(),\n logBufferLines: logBufferLinesSchema.optional(),\n}).onUndeclaredKey('reject'))\n\n/** A function, so the schemas it names are built only when a patch schema is. */\nfunction editableFields() {\n return {\n /**\n * `null` clears it, the same spelling `serverSchema` accepts and every display's `label ?? id`\n * fallback needs — an empty string satisfies neither. `serverPatchSchema` is what the editor\n * validates its payload against and what `PATCH /api/servers/:id` checks, so without this a\n * cleared Label was refused with \"label must be a string (was null)\" and could not be saved at all\n * (`1f58a5d` fixed `applyPatch` and the *control* patch schema, and cited that one in its message).\n */\n label: labelOrNullSchema.optional(),\n enabled: 'boolean?',\n autostart: 'boolean?',\n persistent: 'boolean?',\n command: 'string?',\n args: 'string[]?',\n cwd: 'string?',\n env: 'Record<string, string>?',\n dataEnvs: 'Record<string, string>?',\n bootstrap: bootstrapPatchOrNullSchema.optional(),\n dump: backupHookPatchOrNullSchema.optional(),\n load: backupHookPatchOrNullSchema.optional(),\n port: portSchema.optional(),\n bind: bindSchema.optional(),\n onPortConflict: onPortConflictSchema.optional(),\n restart: restartPatchSchema.optional(),\n health: healthPatchSchema.optional(),\n stop: stopPatchSchema.optional(),\n logBufferLines: logBufferLinesSchema.optional(),\n dependsOn: type('string[]').optional(),\n envFile: 'string?',\n resources: resourcesPatchSchema.optional(),\n backupPaths: type('string[]').optional(),\n backupIgnoreGenerated: 'boolean?',\n } as const\n}\n\nexport const serverPatchSchema = lazy(() => type(editableFields()).onUndeclaredKey('reject'))\nexport type ServerPatch = typeof serverPatchSchema.infer\n\nexport const serverCreateSchema = lazy(() => type({\n id: '/^[a-z0-9][a-z0-9_-]*$/',\n ...editableFields(),\n command: 'string',\n}).onUndeclaredKey('reject'))\nexport type ServerCreate = typeof serverCreateSchema.infer\n\n/**\n * What the panel hands a persistent entry's nanny, written 0600 and unlinked by the\n * nanny as it reads it. Everything is already resolved and expanded, because\n * `Supervisor.resolveSpawn()` must stay the only resolver.\n */\nexport const nannySpecSchema = lazy(() => type({\n serverId: 'string',\n command: 'string',\n args: 'string[]',\n cwd: 'string',\n env: 'Record<string, string>',\n /** Directory of the JSONL the nanny writes; `<dir>/<id>.log`, exactly as the panel names it. */\n logDir: 'string',\n /** The same retention the panel applies, so the nanny rotates identically. */\n logs: logsSchema,\n /** How the nanny stops the child it owns. */\n stop: stopSchema,\n}).onUndeclaredKey('reject'))\nexport type NannySpec = typeof nannySpecSchema.infer\n\n/** How the child of a nanny ended, recorded for a panel that may not have been there. */\nconst nannyExitSchema = lazy(() => type({\n code: 'number | null',\n signal: 'string | null',\n at: 'number',\n runtimeMs: 'number',\n}).onUndeclaredKey('reject'))\nexport type NannyExit = typeof nannyExitSchema.infer\n\n/**\n * A persistent entry's process state, written by its nanny (heartbeat included) and\n * read by the panel to re-adopt a survivor and to learn how a child it never saw\n * exit actually ended.\n */\nexport const nannyStateSchema = lazy(() => type({\n 'serverId': 'string',\n 'nannyPid': 'number',\n 'childPid': 'number | null',\n 'startedAt': 'number',\n 'logFile': 'string',\n 'heartbeatAt': 'number',\n 'lastExit?': nannyExitSchema,\n}).onUndeclaredKey('reject'))\nexport type NannyState = typeof nannyStateSchema.infer\n\n/**\n * The part of an entry's supervision the panel must remember across its own restarts.\n *\n * In memory alone, a crash loop was handed a fresh `maxRetries` by every panel start\n * (`restarts` counted \"since the control plane started\"), and a `runOnce` bootstrap\n * re-ran for the same reason. Both are decisions whose whole point is to outlast the\n * process that made them.\n */\nexport const entryStateSchema = lazy(() => type({\n /** Attempts spent on the current crash sequence; reset once the process stays up. */\n 'restarts': 'number.integer >= 0',\n /**\n * Force restarts spent on the current unhealthy sequence.\n *\n * Separate from `restarts` because the two are different failures — a process that keeps dying\n * and a process that stays up but cannot serve. Persisted for the same reason the crash counter\n * is: a budget that lives only in memory is handed back fresh by every panel restart, so a\n * health-storm that is restarted often enough never exhausts it.\n */\n 'healthRestarts?': 'number.integer >= 0',\n /** The `runOnce` bootstrap already ran for this entry. */\n 'bootstrapDone': 'boolean',\n /**\n * A restored dump this entry still has to load, and where it is.\n *\n * The restore cannot run the load hook itself: `mongorestore` needs a server that is answering, and\n * the entry is stopped at that moment. So the restore stages the dump and records it here, and the\n * next `start` runs the hook once the process is up. Persisted, because a restore followed by a\n * panel restart must not lose the load.\n */\n 'pendingLoad?': 'string | null',\n /**\n * The last child this panel spawned for a non-persistent entry. A detached child\n * outlives the panel, so this is the only way a later boot recognizes its own\n * survivor instead of spawning a second copy beside it.\n */\n 'lastPid?': 'number | null',\n 'lastStartedAt?': 'number | null',\n}))\nexport type EntryState = typeof entryStateSchema.infer\n\n/** Edits to the panel-wide settings: listener, auth, TLS policy, host vitals, backups. */\nexport const settingsPatchSchema = lazy(() => type({\n control: controlPatchSchema.optional(),\n host: hostPatchSchema.optional(),\n backups: backupsPatchSchema.optional(),\n}).onUndeclaredKey('reject'))\nexport type SettingsPatch = typeof settingsPatchSchema.infer\n\n/** Edits to one workspace's settings: server defaults, log retention, notifications. */\nexport const workspaceSettingsPatchSchema = lazy(() => type({\n defaults: defaultsPatchSchema.optional(),\n logs: logsPatchSchema.optional(),\n notifications: notificationsPatchSchema.optional(),\n}).onUndeclaredKey('reject'))\nexport type WorkspaceSettingsPatch = typeof workspaceSettingsPatchSchema.infer\n\nconst authStatusSchema = lazy(() => type({\n enabled: 'boolean',\n passwordSet: 'boolean',\n passwordUpdatedAt: 'number | null',\n /**\n * An API token is set; it is shown here as a flag, never as a value. Optional so\n * a freshly built UI still parses the state of a panel process that predates it:\n * an upgrade replaces `uis/stock/dist` on disk while the old process keeps\n * serving, and a missing key must not blank the whole app.\n */\n apiTokenSet: 'boolean?',\n /** Still the boot-time default; the login page says so and exposure stays blocked. */\n usingDefaultPassword: 'boolean',\n /** The panel currently listens beyond loopback. */\n exposed: 'boolean',\n /** Non-null when that exposure is not backed by a password. */\n blockedReason: 'string | null',\n sessionTtlMs: 'number',\n cookieSecure: 'string',\n trustProxy: 'boolean | \"loopback\"',\n maxLoginAttempts: 'number',\n lockoutMs: 'number',\n}))\nexport type AuthStatus = typeof authStatusSchema.infer\n\nconst tlsStatusSchema = lazy(() => type({\n enabled: 'boolean',\n certPresent: 'boolean',\n subject: 'string | null',\n issuer: 'string | null',\n validFrom: 'string | null',\n validTo: 'string | null',\n daysRemaining: 'number | null',\n fingerprint: 'string | null',\n keyMatches: 'boolean | null',\n error: 'string | null',\n}))\nexport type TlsStatus = typeof tlsStatusSchema.infer\n\n/**\n * The reverse-proxy engine this panel can drive. One engine ships today; the\n * field exists so a config written now keeps working if a second one lands.\n */\nconst proxyEngineSchema = lazy(() => type.enumerated('caddy'))\nexport type ProxyEngine = typeof proxyEngineSchema.infer\n\n/** What a route forwards to: a supervised entry, the panel itself, or a literal upstream. */\nconst proxyTargetSchema = lazy(() => type.enumerated('server', 'panel', 'external'))\nexport type ProxyTarget = typeof proxyTargetSchema.infer\n\n/** `auto` lets the engine decide: a public name gets ACME, a local one its own CA. */\nconst proxyTlsModeSchema = lazy(() => type.enumerated('auto', 'off', 'manual'))\nexport type ProxyTlsMode = typeof proxyTlsModeSchema.infer\n\n/**\n * One public hostname, and where it goes. A route is panel-wide on purpose — the\n * point is one domain per service across every workspace — so a target that\n * names an entry names its workspace too.\n */\nexport const proxyRouteSchema = lazy(() => type({\n id: '/^[a-z0-9][a-z0-9_-]*$/',\n /** The public hostname this route answers for. */\n 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])?)*$/',\n enabled: 'boolean = true',\n target: proxyTargetSchema.default(() => 'server' as const),\n /** `target: \"server\"` — an id is only unique inside its workspace. */\n workspace: 'string = \"\"',\n server: 'string = \"\"',\n /** `target: \"external\"` — a literal upstream such as `http://10.0.0.5:8080`. */\n url: 'string = \"\"',\n /** Optional path prefix; empty serves the whole host. */\n path: 'string = \"\"',\n tls: proxyTlsModeSchema.default(() => 'auto' as const),\n /**\n * Which DNS account answers a DNS-01 challenge for this hostname, as\n * `<workspace>/<account>` — the account belongs to a workspace, so the proxy\n * references it rather than owning it. Empty picks the workspace's only\n * account that can write TXT records.\n */\n dnsAccount: 'string = \"\"',\n}).onUndeclaredKey('reject'))\nexport type ProxyRoute = typeof proxyRouteSchema.infer\n\n/**\n * One uploaded PEM pair. The pair itself lives on disk (0600) beside the panel's\n * own; this is the entry that names it, so a route can be checked against it.\n */\nexport const proxyCertificateSchema = lazy(() => type({\n id: '/^[a-z0-9][a-z0-9_-]*$/',\n label: 'string = \"\"',\n}).onUndeclaredKey('reject'))\n\n/**\n * What a route's certificate situation is, for the page to show. `fallback` is a\n * public name the CA would not issue for, so the engine is serving its own CA.\n */\nconst proxyCertificateStateSchema = lazy(() => type.enumerated('off', 'local', 'uploaded', 'issued', 'pending', 'failed', 'fallback'))\nexport type ProxyCertificateState = typeof proxyCertificateStateSchema.infer\n\n/**\n * DNS-01, answered by the panel instead of the engine.\n *\n * The engine never holds DNS credentials: it asks the panel over the ACMEProxy\n * protocol, and the panel writes the challenge record through the workspace\n * account a route names. `resolvers` overrides the nameservers Caddy uses to see\n * the record, which is what split-horizon DNS needs.\n */\nconst proxyDns01Schema = lazy(() => type({\n /** Off means the engine uses HTTP-01/TLS-ALPN-01, exactly as before. */\n enabled: 'boolean = false',\n /** Nameservers Caddy checks the TXT record against; empty uses its own defaults. */\n resolvers: type('string[]').default(() => []),\n}).onUndeclaredKey('reject'))\n\n/** Reverse proxy: expose the stack through one engine, with automatic HTTPS. */\nexport const proxyConfigSchema = lazy(() => type({\n enabled: 'boolean = false',\n engine: proxyEngineSchema.default(() => 'caddy' as const),\n /** Cleartext side: ACME HTTP-01 challenges and the redirect to HTTPS. */\n httpPort: '1 <= number.integer <= 65535 = 80',\n httpsPort: '1 <= number.integer <= 65535 = 443',\n /** ACME account address; a public certificate needs one. */\n email: 'string = \"\"',\n /** The ACME staging endpoint: untrusted certificates, no rate-limit burn. */\n staging: 'boolean = false',\n dns01: proxyDns01Schema.default(() => ({})),\n /** PEM pairs a route with `tls: \"manual\"` may serve; the engine picks by SNI. */\n certificates: proxyCertificateSchema.array().default(() => []),\n routes: proxyRouteSchema.array().default(() => []),\n}).onUndeclaredKey('reject'))\nexport type ProxyConfig = typeof proxyConfigSchema.infer\n\n/** Where the binary came from: the release we downloaded, or a path a person set. */\nconst proxyEngineSourceSchema = lazy(() => type.enumerated('downloaded', 'custom'))\n\n/** What the panel knows about the installed engine. */\nexport const proxyEngineStatusSchema = lazy(() => type({\n id: proxyEngineSchema,\n installed: 'boolean',\n /** The version the binary reports; `null` until it has been probed. */\n version: 'string | null',\n source: proxyEngineSourceSchema.or(type('null')),\n path: 'string | null',\n bytes: 'number | null',\n error: 'string | null',\n}))\nexport type ProxyEngineStatus = typeof proxyEngineStatusSchema.infer\n\n/** Engine capabilities, so the page knows which options to offer. */\nconst proxyEngineInfoSchema = lazy(() => type({\n id: proxyEngineSchema,\n label: 'string',\n docsUrl: 'string',\n releaseUrl: 'string',\n acme: 'boolean',\n internalCa: 'boolean',\n dns01: 'boolean',\n tcp: 'boolean',\n}))\nexport type ProxyEngineInfo = typeof proxyEngineInfoSchema.infer\n\nconst proxyRouteStatusSchema = lazy(() => type.enumerated('ok', 'disabled', 'no-upstream', 'error'))\nexport type ProxyRouteStatus = typeof proxyRouteStatusSchema.infer\n\n/** A route as the page reads it: the config, plus the upstream resolved live. */\nexport const proxyRouteViewSchema = lazy(() => type({\n 'route': proxyRouteSchema,\n 'status': proxyRouteStatusSchema,\n 'upstream': 'string | null',\n 'message': 'string | null',\n /** Where this hostname's certificate stands. Optional: an older panel omits it. */\n 'certificate?': type({\n 'state': proxyCertificateStateSchema,\n 'message': 'string | null',\n /**\n * For `fallback`: minutes until the engine tries the CA again by itself, read\n * from the certificate it fell back to. Optional, so an older client ignores it.\n */\n 'retryInMinutes?': 'number',\n }),\n}).onDeepUndeclaredKey('ignore'))\nexport type ProxyRouteView = typeof proxyRouteViewSchema.infer\n\nconst proxyRunStateSchema = lazy(() => type.enumerated('off', 'stopped', 'starting', 'running', 'error', 'unsupported'))\nexport type ProxyRunState = typeof proxyRunStateSchema.infer\n\n/** Live engine state. */\nexport const proxyStatusSchema = lazy(() => type({\n state: proxyRunStateSchema,\n pid: 'number | null',\n /** The addresses the engine serves on, for the page to show. */\n urls: type('string[]'),\n /** Days until the soonest publicly-issued certificate expires; `null` when none. */\n certExpiryDays: 'number | null',\n since: 'number | null',\n lastError: 'string | null',\n}))\nexport type ProxyStatus = typeof proxyStatusSchema.infer\n\n/** One uploaded pair, described: what it is for, and whether it is usable. */\nconst proxyCertificateViewSchema = lazy(() => type({\n id: 'string',\n label: 'string',\n /** Both halves are on disk. */\n present: 'boolean',\n /** The engine would serve this pair for at least one manual route. */\n used: 'boolean',\n subject: 'string | null',\n issuer: 'string | null',\n validTo: 'string | null',\n daysRemaining: 'number | null',\n /** Hostnames the pair covers, read from its SANs. */\n hosts: type('string[]'),\n error: 'string | null',\n}))\nexport type ProxyCertificateView = typeof proxyCertificateViewSchema.infer\n\n/**\n * A DNS account the route table may name, flattened across workspaces so the proxy\n * page can offer one list. The account itself stays in its workspace.\n */\nconst proxyDnsAccountViewSchema = lazy(() => type({\n workspace: 'string',\n account: 'string',\n provider: 'string',\n label: 'string',\n /** The credentials can write a TXT record, so this account can answer a challenge. */\n writesTxt: 'boolean',\n /** Credentials are stored; an account without them cannot answer yet. */\n hasCredentials: 'boolean',\n}))\nexport type ProxyDnsAccountView = typeof proxyDnsAccountViewSchema.infer\n\n/** `GET /api/proxy`: the policy, the engine, the live state and the resolved routes. */\nexport const proxyViewSchema = lazy(() => type({\n 'config': proxyConfigSchema,\n 'engine': proxyEngineStatusSchema,\n 'engines': proxyEngineInfoSchema.array(),\n 'status': proxyStatusSchema,\n 'routes': proxyRouteViewSchema.array(),\n /** Every uploaded pair, with what it covers and when it expires. */\n 'certificates': proxyCertificateViewSchema.array(),\n /** Every DNS account a route may name. Optional: an older panel omits it. */\n 'dnsAccounts?': proxyDnsAccountViewSchema.array(),\n}).onDeepUndeclaredKey('ignore'))\nexport type ProxyView = typeof proxyViewSchema.infer\n\n/**\n * A route as a patch sends it: every field optional, so a client may change one\n * member of a route — or add a route with only the two fields that matter.\n */\nconst proxyRoutePatchSchema = lazy(() => type({\n id: 'string',\n host: 'string',\n enabled: 'boolean?',\n target: proxyTargetSchema.optional(),\n workspace: 'string?',\n server: 'string?',\n url: 'string?',\n path: 'string?',\n tls: proxyTlsModeSchema.optional(),\n dnsAccount: 'string?',\n}).onUndeclaredKey('reject'))\nexport type ProxyRoutePatch = typeof proxyRoutePatchSchema.infer\n\n/**\n * The proxy block as a patch: no defaults, and `routes` is a list a patch\n * **replaces** — a key-by-key merge cannot express removing a route.\n */\nexport const proxyPatchSchema = lazy(() => type({\n enabled: 'boolean?',\n engine: proxyEngineSchema.optional(),\n httpPort: '1 <= number.integer <= 65535?',\n httpsPort: '1 <= number.integer <= 65535?',\n email: 'string?',\n staging: 'boolean?',\n /**\n * A patch shape, not the config's: both keys are optional and merge, so a client\n * may send one without resetting the other, and an explicit `null` clears a key.\n */\n dns01: type({\n enabled: 'boolean | null?',\n resolvers: 'string[] | null?',\n }).onUndeclaredKey('reject').optional(),\n certificates: proxyCertificateSchema.array().optional(),\n routes: proxyRoutePatchSchema.array().optional(),\n}).onUndeclaredKey('reject'))\nexport type ProxyPatch = typeof proxyPatchSchema.infer\n\n/** `PUT /api/proxy/certificates/:id`: the pair itself, plus what to call it. */\nexport const proxyCertificateUploadSchema = lazy(() => type({\n label: 'string = \"\"',\n certificate: 'string >= 1',\n privateKey: 'string >= 1',\n}).onUndeclaredKey('reject'))\n\n/** `POST /api/proxy/engine`: which release to install; empty means the current one. */\nexport const proxyEngineInstallSchema = lazy(() => type({\n version: 'string = \"\"',\n}).onUndeclaredKey('reject'))\n\n/** The policy columns a destination row carries — the values a send will actually use. */\nconst notificationPolicyStatusShape = {\n onCrash: 'boolean',\n onUnhealthy: 'boolean',\n onForcedRestart: 'boolean',\n onRecovered: 'boolean',\n /** Host vitals breaches (disk, memory, swap, load, temperature). */\n onHost: 'boolean',\n /** Dynamic DNS, when this panel knows about it (optional for an older panel). */\n onDdns: 'boolean?',\n cooldownMs: 'number',\n} as const\n\n/**\n * One destination as the page reads it: the fields it owns, the policy it will use, and the outcome\n * of the last send to it.\n *\n * The policy here is the **effective** one — inherited from the general block when\n * `useOwnSettings` is false — so the page shows what will happen, not what is stored.\n */\nconst destinationStatusSchema = lazy(() => type({\n 'id': 'string',\n 'kind': '\"telegram\" | \"webhook\"',\n 'enabled': 'boolean',\n 'useOwnSettings': 'boolean',\n ...notificationPolicyStatusShape,\n /** Telegram only, null on a webhook. */\n 'chatId': 'string | null',\n /** Telegram only: whether a bot token is stored for this destination. */\n 'tokenSet': 'boolean',\n /** Webhook only, null on a Telegram destination. */\n 'url': 'string | null',\n 'method': '\"POST\" | \"PUT\" | null',\n 'format': '\"json\" | \"text\" | null',\n 'headers': 'string | null',\n /** Last delivery outcome, for the page. Optional: a newer panel may not have sent one yet. */\n 'lastResult?': 'string | null',\n 'lastResultAt?': 'number | null',\n}))\nexport type DestinationStatusView = typeof destinationStatusSchema.infer\n\n/**\n * The chats a bot can see, as `POST /notifications/destinations/:id/detect-chats` answers them.\n *\n * This was declared inline in the route while `TelegramChat` in `providers/telegram.ts` described the\n * same two fields — one shape written twice, which is the drift this file exists to prevent.\n */\nexport const telegramChatsSchema = lazy(() => type({\n chats: type({ id: 'string | number', title: 'string' }).array(),\n}))\n\nconst notificationViewSchema = lazy(() => type({\n /** The general block: what a destination inherits unless it overrides it. Optional for an older panel. */\n 'defaults?': notificationDefaultsViewSchema,\n /** Every destination, in config order. Optional for an older panel. */\n 'destinations?': destinationStatusSchema.array(),\n}))\nexport type NotificationView = typeof notificationViewSchema.infer\n\nexport const sessionViewSchema = lazy(() => type({\n authenticated: 'boolean',\n authRequired: 'boolean',\n passwordSet: 'boolean',\n /** A long-lived API token is configured; optional for the same reason as above. */\n apiTokenSet: 'boolean?',\n usingDefaultPassword: 'boolean',\n /** The boot-time password, exposed only while it is still in use. */\n defaultPassword: 'string | null',\n sessionTtlMs: 'number',\n}))\nexport type SessionView = typeof sessionViewSchema.infer\n\n/** `POST /api/auth/token`: the new token, returned once, and the readable head the panel keeps. */\nexport const apiTokenCreatedSchema = lazy(() => type({ token: 'string', hint: 'string' }))\n\nexport const loginSchema = lazy(() => type({ password: 'string <= 512' }).onUndeclaredKey('reject'))\nexport type LoginRequest = typeof loginSchema.infer\n\n/** Any non-empty password is allowed; only a sanity cap on the length. */\nexport const passwordValueSchema = lazy(() => type('1 <= string <= 512'))\n\nexport const passwordSchema = lazy(() => type({\n currentPassword: 'string?',\n newPassword: passwordValueSchema,\n}).onUndeclaredKey('reject'))\nexport type PasswordRequest = typeof passwordSchema.infer\n\nexport const serverStatusSchema = lazy(() => type('\"stopped\" | \"starting\" | \"running\" | \"stopping\" | \"backoff\" | \"crashed\" | \"conflict\"'))\nexport type ServerStatus = typeof serverStatusSchema.infer\n\nconst healthStateSchema = lazy(() => type('\"disabled\" | \"unknown\" | \"healthy\" | \"unhealthy\"'))\nexport type HealthState = typeof healthStateSchema.infer\n\nconst portStateSchema = lazy(() => type('\"unknown\" | \"free\" | \"in-use\"'))\nexport type PortState = typeof portStateSchema.infer\n\nexport const logStreamSchema = lazy(() => type('\"stdout\" | \"stderr\" | \"system\"'))\nexport type LogStream = typeof logStreamSchema.infer\n\nconst logLineSchema = lazy(() => type({\n ts: 'number',\n stream: logStreamSchema,\n text: 'string',\n}))\nexport type LogLine = typeof logLineSchema.infer\n\n/**\n * Who asked for something, so a restart can be attributed.\n *\n * `policy` is the panel acting on its own (a health-forced restart, a memory ceiling);\n * `user` is a signed-in browser; `agent` is a request carrying an API token; `boot` is\n * the autostart pass. Optional: events written before this field existed carry none.\n */\nconst historyActorSchema = lazy(() => type.enumerated('policy', 'user', 'agent', 'boot'))\nexport type HistoryActor = typeof historyActorSchema.infer\n\nconst historyEventSchema = lazy(() => type({\n 'serverId': 'string',\n 'ts': 'number',\n 'type': '\"start\" | \"exit\" | \"crash\" | \"forced-restart\" | \"unhealthy\" | \"recovered\"',\n 'detail': 'string',\n /** How long the process had been up, recorded on exit and crash. */\n 'runtimeMs': 'number?',\n /** Who caused it; absent on events from before this field existed. */\n 'actor?': historyActorSchema,\n}))\nexport type HistoryEvent = typeof historyEventSchema.infer\n\n/** Rolling window stats derived from the persisted event log. */\nconst serverHistorySchema = lazy(() => type({\n windowMs: 'number',\n /** Share of the window the process was up (null when nothing is known yet). */\n uptimeRatio: 'number | null',\n restarts: 'number',\n crashes: 'number',\n forcedRestarts: 'number',\n lastCrashAt: 'number | null',\n lastExitAt: 'number | null',\n lastRuntimeMs: 'number | null',\n events: historyEventSchema.array(),\n}))\nexport type ServerHistory = typeof serverHistorySchema.infer\n\nconst processResourcesSchema = lazy(() => type({\n cpuPercent: 'number | null',\n /** RSS of the process and its descendants. */\n rssBytes: 'number | null',\n processes: 'number',\n sampledAt: 'number',\n}))\nexport type ProcessResources = typeof processResourcesSchema.infer\n\nconst hostDiskSchema = lazy(() => type({\n path: 'string',\n totalBytes: 'number',\n freeBytes: 'number',\n usedPercent: 'number',\n}))\n\nconst hostViewSchema = lazy(() => type({\n 'enabled': 'boolean',\n 'cpus': 'number',\n 'loadAvg': type('number[]'),\n /**\n * Share of this machine's CPU capacity in use over the last sampling interval, 0–100.\n *\n * Optional: an older panel sends no such field, and a required one rejects the whole frame and\n * blanks the UI that panel is serving. `null` on the first sample, which has no window to\n * measure yet — a number there would be invented.\n */\n 'cpuUsedPercent?': 'number | null',\n 'uptimeMs': 'number',\n 'memoryUsedPercent': 'number',\n 'swapUsedPercent': 'number',\n 'tempCelsius': 'number | null',\n 'disks': hostDiskSchema.array(),\n /** Human readable threshold breaches, for the banner and notifications. */\n 'alerts': type('string[]'),\n 'sampledAt': 'number | null',\n /**\n * The per-cpu load this panel notifies on — `host.loadPerCpu`, the number the alert fires at.\n *\n * Optional: a panel that predates this field alerts on the default, which is what the UI's band\n * assumes when the field is absent. It travels here because the frame is the only thing a host\n * surface reads, and a surface that cannot see the threshold hardcoded `2`/`1.4` — so raising\n * the threshold in Settings left the tile painting a healthy box `danger` while the alert the\n * threshold governs stayed silent. `0` disables the alert, so nothing can breach it.\n */\n 'loadAlertPerCpu?': 'number',\n /**\n * The percentage alert thresholds — `host.diskUsedPercent`, `host.memoryUsedPercent`,\n * `host.swapUsedPercent` and `host.tempCelsius` — the numbers the panel notifies at.\n *\n * Optional for the same reason as `loadAlertPerCpu`, and carried for the same reason: a surface\n * that cannot see the threshold has to invent one, and the invented ones disagreed with the\n * panel's verdict. The swap bar called 50% `warn` while the alert fired there; raising\n * `host.tempCelsius` to 95 left a 90 °C box painted `danger` for a notification that never\n * arrives; and a disk threshold lowered to 80 notified at 82% while every disk bar called it\n * `warn`. `0` disables that alert, so nothing can breach it.\n */\n 'memoryUsedPercentAlert?': 'number',\n 'swapUsedPercentAlert?': 'number',\n 'tempCelsiusAlert?': 'number',\n /**\n * `host.diskUsedPercent`, the threshold a filesystem is banded against.\n *\n * It travels once for the frame rather than per disk: the threshold is one config value that\n * applies to every configured path, which is why `hostReadings` copies it onto each disk's `band`.\n */\n 'diskUsedPercentAlert?': 'number',\n}))\nexport type HostView = typeof hostViewSchema.infer\n\n/**\n * The WSL2 temperature bridge, as the settings page reports it.\n *\n * A WSL2 guest cannot read a CPU temperature at all, so the panel offers to install a Windows-side\n * helper and point `host.tempCommand` at it. `supported` is false on any other platform, which is\n * how the UI hides the whole block rather than offering a button that cannot work.\n */\nexport const wslTemperatureSchema = lazy(() => type({\n /** This process runs under WSL. */\n 'wsl': 'boolean',\n /** The setup can work here — the same as `wsl` today, separate so a future bridge can differ. */\n 'supported': 'boolean',\n /** `host.tempCommand` already names a command. */\n 'configured': 'boolean',\n /** The helper script exists on disk. */\n 'scriptWritten': 'boolean',\n /** LibreHardwareMonitor was found on the Windows side. */\n 'libraryPresent': 'boolean',\n /** Where the helper was written, for the sentence that tells a person what to delete. */\n 'scriptPath': 'string | null',\n /** The command the panel would run, absent until it is configured. */\n 'tempCommand?': 'string | null',\n /** The last probe's reading, so the page can say \"this works\" without running it again. */\n 'lastReadingCelsius?': 'number | null',\n /** Why the last probe failed, if it did — a missing library and no sensor read differently. */\n 'lastError?': 'string | null',\n /**\n * The library is missing and installing it needs consent.\n *\n * The panel will not download a third-party binary on a click that did not mention one, so the\n * first press answers `needsDownload` and the page asks. Absent on an older panel.\n */\n 'needsDownload?': 'boolean',\n}))\nexport type WslTemperatureStatus = typeof wslTemperatureSchema.infer\n\nconst backupFileSchema = lazy(() => type({\n name: 'string',\n sizeBytes: 'number',\n createdAt: 'number',\n /** The archive carries a password-protected payload. */\n encrypted: 'boolean',\n}))\n\nexport type BackupFile = typeof backupFileSchema.infer\n\n/**\n * One selectable entry in a backup: a global item (`global:settings`,\n * `global:secrets`, `global:tls`) or a workspace, whose `items` are the\n * sub-choices a per-workspace dialog offers.\n */\nexport const backupEntrySchema = lazy(() => type({\n /** `global:settings` | `global:secrets` | `global:tls` | `workspace:<id>`. */\n 'id': 'string',\n /**\n * The panel's own English wording. Kept because it is what an older UI reads, and what a\n * single-language UI wants; a translated UI prefers the `*Key` beside it.\n */\n 'label': 'string',\n /** A catalog key for `label`, with its placeholder values, so a UI can render its own language. */\n 'labelKey?': 'string',\n 'labelParams?': 'Record<string, string>',\n 'kind': '\"settings\" | \"secrets\" | \"tls\" | \"workspace\"',\n 'workspaceId?': 'string',\n 'note': 'string | null',\n /** The same pair for `note`: the panel knows which reason it is, the UI knows the wording. */\n 'noteKey?': 'string',\n 'noteParams?': 'Record<string, string>',\n /** What this entry would capture; a workspace carries several leaves. */\n 'items': type({\n 'id': 'string',\n 'label': 'string',\n 'labelKey?': 'string',\n 'labelParams?': 'Record<string, string>',\n /** `settings`/`servers`/`secrets` for a workspace, `data` for a declared path. */\n 'kind': '\"settings\" | \"servers\" | \"secrets\" | \"data\"',\n /** Which secret a `secrets` leaf carries (`password`, `apiToken`, `telegram`, `ddns`, …). */\n 'secret?': 'string',\n 'path?': 'string',\n /** Who declared a data path: `global`, `<serverId>:backupPaths` or `<serverId>:<ENV>`. */\n 'origin?': 'string',\n 'included': 'boolean',\n 'note': 'string | null',\n 'noteKey?': 'string',\n 'noteParams?': 'Record<string, string>',\n 'ignoreGenerated?': 'boolean',\n }).array(),\n}))\nexport type BackupEntry = typeof backupEntrySchema.infer\n\n/**\n * The schedule as a *response* carries it: undeclared keys are accepted, at both levels.\n *\n * A response schema may not reject (a newer panel may add a field an older client still reads), and\n * `scope` is one level deep — so the outer `.onUndeclaredKey` on the config schema is not enough:\n * a frame carrying `schedule.scope` rejected outright while this was the config shape.\n */\nexport const backupScheduleViewSchema = lazy(() => backupScheduleSchema.onDeepUndeclaredKey('ignore'))\n\nexport const backupsViewSchema = lazy(() => type({\n 'enabled': 'boolean',\n 'dir': 'string',\n 'keep': 'number',\n /**\n * The scheduled half, so the page can show and edit it.\n *\n * Optional because the panel and the UI upgrade separately: an older panel does not send it,\n * and a required field would blank the settings page for that panel. The page reads it as\n * \"off, keep 7\" when absent — the schema defaults — so nothing changes for it.\n */\n 'schedule?': backupScheduleViewSchema,\n /** When the last automatic archive was written; null until one has run. Optional for the same reason. */\n 'lastAutomaticAt?': 'number | null',\n /**\n * Why the last scheduled pass failed, and when it tried.\n *\n * A failed pass wrote only a panel-console warning, so \"enabled, zero archives\" looked the same\n * as \"failing every interval since the day it was enabled\" — indistinguishable from the page,\n * which is the only place a person looks. Null once a pass succeeds.\n */\n 'scheduleError?': type({\n message: 'string',\n at: 'number',\n }),\n /** Extra paths from the global config, in addition to each server's own. */\n 'includePaths': type('string[]'),\n /**\n * The selection model, carried here only by a panel older than this release.\n *\n * Reading it costs a `readFileSync` of the global and every workspace's `.secrets.json` plus a\n * `statSync` per archive, and the state frame is rebuilt ~13×/s — so it moved to\n * `GET /api/backups` (`backupSelectionSchema`), which a dialog fetches when it opens. Optional on\n * purpose: a newer UI reads a panel that still sends it, and a UI must never reject a payload for\n * a field it does not use. Absent means \"ask the endpoint\".\n */\n 'entries?': backupEntrySchema.array(),\n 'files?': backupFileSchema.array(),\n}))\nexport type BackupsView = typeof backupsViewSchema.infer\n\n/**\n * The backup *selection model*: what a capture could include, and what is already on disk.\n *\n * Its own route rather than a field of the state frame, because building it reads every workspace's\n * secrets file and stats every archive — work proportional to workspaces × archives, on a path that\n * runs per frame. A dialog needs it when it opens and not otherwise.\n */\nexport const backupSelectionSchema = lazy(() => type({\n /** The archive directory, so a dialog can print the path without a second read. */\n dir: 'string',\n /** Every selectable entry, global first, then each workspace. */\n entries: backupEntrySchema.array(),\n files: backupFileSchema.array(),\n}))\nexport type BackupSelection = typeof backupSelectionSchema.infer\n\n/** One restorable slice of an archive: a global item, a workspace item, or a data path. */\nexport const restoreItemSchema = lazy(() => type({\n /** A backup entry or leaf id (`workspace:<id>:servers`, `data:<path>`, ...). */\n 'id': 'string',\n 'label': 'string',\n 'labelKey?': 'string',\n 'labelParams?': 'Record<string, string>',\n 'kind': '\"settings\" | \"secrets\" | \"servers\" | \"tls\" | \"data\"',\n 'workspaceId?': 'string',\n /** false when the current instance does not declare it, or it is not in the archive. */\n 'restorable': 'boolean',\n /** Echo of the request's selection, so the checkboxes round-trip. */\n 'selected': 'boolean',\n 'note': 'string | null',\n 'noteKey?': 'string',\n 'noteParams?': 'Record<string, string>',\n}))\nexport type RestoreItem = typeof restoreItemSchema.infer\n\n/**\n * Why one thing was skipped, as a reason the UI can word itself.\n *\n * `skipped` stays a list of ready-made English sentences for an older UI and for\n * `noc-console`; this is the same list in parts, so a translated UI says it in the\n * reader's language instead of showing the panel's English inside its own sentence.\n */\nexport const restoreSkipSchema = lazy(() => type({\n 'label': 'string',\n 'labelKey?': 'string',\n 'labelParams?': 'Record<string, string>',\n /** A catalog key for the parenthesis, e.g. `not selected`; absent when there is none. */\n 'reasonKey?': 'string',\n 'reasonParams?': 'Record<string, string>',\n}))\nexport type RestoreSkip = typeof restoreSkipSchema.infer\n\nexport const restorePlanSchema = lazy(() => type({\n 'dryRun': 'boolean',\n 'encrypted': 'boolean',\n /** The archive needs a password (none or a wrong one was supplied). */\n 'needsPassword': 'boolean',\n /**\n * Where the archive says it came from. Optional: an archive written before this\n * stamp existed carries neither field, and an older panel never sends the row.\n */\n 'archive?': type({\n 'writtenBy?': 'string',\n 'schema?': 'number',\n }),\n 'items': restoreItemSchema.array(),\n /**\n * One row per backup hook that ran, so a person can see which entries brought their own dump.\n *\n * Optional, like every new response field: an older panel never sends it and an older UI never\n * reads it. `output` is a bounded tail, not a log — enough to see what `mongorestore` said.\n */\n 'hooks?': type({\n 'serverId': 'string',\n 'workspaceId': 'string',\n 'action': '\"dump\" | \"load\"',\n 'ok': 'boolean',\n 'output?': 'string',\n }).array(),\n 'applied': type('string[]'),\n /**\n * The ids `applied` names, so a UI resolves each through `items` and renders its own label.\n * `applied` itself stays: it is what a UI with one language reads.\n */\n 'appliedIds?': type('string[]'),\n 'skipped': type('string[]'),\n 'skippedItems?': restoreSkipSchema.array(),\n /** Only the panel's own listener needs a restart; its servers are re-read live. */\n 'restartRequired': 'boolean',\n /** The panel re-read the restored config within this same restore. */\n 'reloaded': 'boolean',\n /**\n * Servers that are **running now** and whose declared data path this restore overwrote.\n *\n * A data path is copied over while its owner keeps running, holding open handles to files\n * that were just replaced — the process keeps its old view and the archive's copy wins on\n * disk, so anything written since the archive was taken is gone. The plan has to say which\n * entries that happened to, because nothing else in the result mentions them.\n *\n * Optional: an older panel does not send it, and a plan that touched no running entry sends none.\n */\n 'replacedUnderRunning?': type({\n workspaceId: 'string',\n serverId: 'string',\n path: 'string',\n }).array(),\n /**\n * Workspaces this restore created because the archive named them and the host did not\n * have them. Optional: an older panel never sends the row, and an archive written\n * before the registry was captured creates none.\n */\n 'createdWorkspaces?': type('string[]'),\n 'error': 'string?',\n}))\nexport type RestorePlan = typeof restorePlanSchema.infer\n\nexport const backupCreateSchema = lazy(() => type({\n /** Optional: encrypts the archive. Never stored. */\n password: passwordValueSchema.optional(),\n /** Leaf ids to capture (`global:settings`, `workspace:<id>:servers`, `data:<path>`, ...); omitted means everything. */\n include: type('string[] >= 1').optional(),\n /**\n * Leaf ids to leave out, applied after `include` — the CLI's `--exclude`, and the one thing to\n * name when the archive should carry everything but the credentials.\n *\n * Empty is refused for the same reason `include` refuses it: an empty list reads as \"nothing\" to\n * a person and as \"everything\" to a reader, so it must not be sent at all.\n */\n exclude: type('string[] >= 1').optional(),\n}).onUndeclaredKey('reject'))\nexport type BackupCreate = typeof backupCreateSchema.infer\n\nexport const restoreRequestSchema = lazy(() => type({\n name: 'string?',\n password: passwordValueSchema.optional(),\n /** Item ids to restore; omitted means every restorable item. */\n include: type('string[]').optional(),\n /**\n * Item ids to leave out, applied after `include` — the CLI's `--exclude` on the same command.\n *\n * `BackupService.restore()` has always taken it and the local channel has always sent it, but this\n * schema declared only `name`/`password`/`include` **and rejects undeclared keys**, so the same\n * request over `/api` answered `exclude must be removed`: a script or either UI could only say\n * \"these items\", never \"everything except these\", on the one path that overwrites a live host.\n *\n * Empty is refused for the same reason it is on a create — it reads as \"nothing\" to a person and\n * as \"everything\" to the reader, so it must not be sent at all.\n */\n exclude: type('string[] >= 1').optional(),\n}).onUndeclaredKey('reject'))\nexport type RestoreRequest = typeof restoreRequestSchema.infer\n\n/** Runtime view of a server: its effective config plus everything observed. */\nexport const serverViewSchema = lazy(() => type({\n 'id': 'string',\n /** The workspace that owns it; optional so an older panel's frame still parses. */\n 'workspaceId?': 'string',\n 'config': serverSchema,\n 'bindHost': 'string',\n 'url': 'string | null',\n 'status': serverStatusSchema,\n 'health': healthStateSchema,\n 'portState': portStateSchema,\n 'pid': 'number | null',\n /** True when the process serving this entry was adopted, not spawned by the panel. */\n 'adopted': 'boolean?',\n /**\n * The panel stopped this entry because it could not serve, rather than someone asking.\n *\n * Optional, like every new field: an older panel does not send it. `/healthz` needs it because\n * the status alone cannot tell \"the operator switched this off\" (never a problem) from \"the\n * panel gave up on it\" (a broken service) — both are `stopped`.\n */\n 'stoppedByPanel?': 'boolean',\n 'startedAt': 'number | null',\n 'exitCode': 'number | null',\n 'exitSignal': 'string | null',\n 'restarts': 'number',\n 'maxRetries': 'number',\n 'lastError': 'string | null',\n 'nextRetryAt': 'number | null',\n 'unhealthySince': 'number | null',\n 'bufferedLines': 'number',\n 'history': serverHistorySchema,\n /** Last health probe latency (TCP connect or HTTP request). */\n 'responseMs': 'number | null',\n 'resources': processResourcesSchema.or(type('null')),\n}).onDeepUndeclaredKey('ignore'))\n// `config` is emitted normalized (port is always `number | null`, never absent),\n// while the schema accepts both forms so a hand-written payload still validates.\nexport type ServerView = Omit<typeof serverViewSchema.infer, 'config'> & { config: ServerConfig }\n\n/**\n * What `/healthz` answers, on both statuses — 200 when serving, 503 when a server has crashed,\n * which shares this response's `content` in the spec. The detail fields are optional because they are\n * only included for an authenticated caller.\n */\nexport const healthResponseSchema = lazy(() => type({\n 'status': '\"ok\" | \"degraded\"',\n 'uptimeMs': 'number',\n 'servers?': type({ total: 'number', running: 'number', crashed: 'number', unhealthy: 'number' }),\n 'hostAlerts?': 'string[]',\n /** Which state root this panel serves, as a fingerprint — only to a loopback caller (the CLI). */\n 'home?': 'string',\n}))\n\nconst controlViewSchema = lazy(() => type({\n /** The configured panel name, for the shell to render. */\n 'label': 'string',\n 'port': 'number',\n /** The configured bind value (`local` | `lan` | ipv4). */\n 'host': 'string',\n /** The address actually bound. */\n 'bindHost': 'string',\n 'url': 'string',\n 'openBrowser': 'boolean',\n 'allowedHosts?': 'string[]',\n /** The live listener differs from the configured host/port. */\n 'restartRequired': 'boolean',\n 'protocol': 'string',\n 'auth': authStatusSchema,\n 'tls': tlsStatusSchema,\n}))\nexport type ControlView = typeof controlViewSchema.infer\n\n/** Everything one workspace owns, plus the live state of its servers. */\n/**\n * A user-supplied UI, as the settings page shows it.\n *\n * Every field is optional, and none of them is a fallback: a `ui.json` may be written by\n * the panel (which adds `uploadedAt`/`files`) **or dropped in by hand** following\n * `docs/UI_CREATION.md`, which documents only the author-facing fields. Requiring ours\n * meant a hand-written file parsed to nothing at all, taking `repo`/`tag` with it and\n * silently disabling `ui-update` for exactly the UI that declared itself.\n */\nexport const uiMetaSchema = lazy(() => type({\n 'name?': 'string',\n 'version?': 'string | null',\n /** Set by the panel, not by the author. */\n 'uploadedAt?': 'number',\n /** Counted by the panel, not declared. */\n 'files?': 'number.integer >= 1',\n /** `owner/name` of the UI's own repository, for `ui-update`. */\n 'repo?': 'string',\n /** The release tag this build came from, e.g. `v0.6.0`. Stamped by the build, never committed. */\n 'tag?': 'string',\n /** The release asset name, e.g. `home-hosted-ui-noc-console`. */\n 'asset?': 'string',\n /** When the UI was built, in unix epoch seconds. Stamped by the build, never committed. */\n 'unix?': 'number.integer >= 0',\n}))\nexport type UiMeta = typeof uiMetaSchema.infer\n\nconst uiStatusSchema = lazy(() => type({\n /** A user-supplied UI is being served instead of the stock one. */\n custom: 'boolean',\n /** Where that UI lives, whether or not it exists yet. */\n dir: 'string',\n meta: uiMetaSchema.or(type('null')),\n}))\nexport type UiStatus = typeof uiStatusSchema.infer\n\n/** One process a panel spawned that no configured entry claims any more. */\nconst serverOrphanSchema = lazy(() => type({\n /** The id it was started as, which is also the key of the state file it was found in. */\n serverId: 'string',\n pid: 'number',\n /** When the panel spawned it; null when the record predates the stamp. */\n startedAt: 'number | null',\n}))\nexport type ServerOrphan = typeof serverOrphanSchema.infer\n\nexport const workspaceViewSchema = lazy(() => type({\n 'id': 'string',\n 'label': 'string',\n /** The workspace's servers config; the settings file sits beside it. */\n 'configPath': 'string',\n 'settingsPath': 'string',\n 'configError': 'string | null',\n /** Keys a newer release wrote that this one ignores. */\n 'configWarnings?': type('string[]'),\n 'logsDir': 'string',\n 'defaults': defaultsSchema,\n 'logs': logsSchema,\n 'notifications': notificationViewSchema,\n /** Dynamic DNS state. Optional so a newer UI still frames an older payload. */\n 'ddns?': ddnsStatusSchema,\n 'serverCount': 'number',\n 'runningCount': 'number',\n 'crashedCount': 'number',\n /**\n * Processes this panel started that no current entry owns.\n *\n * A detached child outlives a hard panel death, and its handle is the entry-state file keyed by\n * the *id* it was started under. Rename the entry and nothing ever reads that file again; delete\n * the entry while the panel is down and the file is reclaimed, destroying the last handle. The\n * orphan then runs with no card, no `/healthz` line and no CLI action — for a queue consumer,\n * two consumers of the same queue. This is the view that makes it actionable.\n *\n * Optional: an older panel never sends it.\n */\n 'orphans?': serverOrphanSchema.array(),\n 'servers': serverViewSchema.array(),\n}).onDeepUndeclaredKey('ignore'))\nexport type WorkspaceView = typeof workspaceViewSchema.infer\n\n/**\n * The whole panel in one frame: global state plus every workspace. Workspace\n * pages read their own subtree; the global pages read across all of them.\n */\nexport const appStateSchema = lazy(() => type({\n 'control': controlViewSchema,\n 'host': hostViewSchema,\n 'backups': backupsViewSchema,\n 'ui': uiStatusSchema,\n 'workspaces': workspaceViewSchema.array(),\n /** The reverse proxy, when this panel has one. Optional: an older panel does not send it. */\n 'proxy?': proxyViewSchema,\n /** The directory the panel was started from; relative entry paths use it. */\n 'projectDir': 'string',\n /** `HHOSTED_HOME`: every file home-hosted owns lives under here. */\n 'dataRoot': 'string',\n /** The release this panel is running. Optional: an older panel does not send one. */\n 'version?': 'string',\n /**\n * The panel-wide `settings.json` could not be applied (a parse or schema error, or an edit refused\n * for exposing the panel); the running settings are kept. `null` when it is fine; absent on an\n * older panel.\n */\n 'settingsError?': type({ message: 'string', path: 'string' }).or('null'),\n}).onDeepUndeclaredKey('ignore'))\nexport type AppState = typeof appStateSchema.infer\n\n/** One SSE frame, discriminated by `type`: a client narrowing on it gets the payload that frame carries. */\nconst stateFrameSchema = lazy(() => type({\n type: '\"hello\" | \"state\"',\n ts: 'number',\n state: appStateSchema,\n}).onDeepUndeclaredKey('ignore'))\nconst serverFrameSchema = lazy(() => type({\n 'type': '\"server\"',\n 'ts': 'number',\n 'workspaceId?': 'string',\n 'serverId': 'string',\n 'server': serverViewSchema,\n}).onDeepUndeclaredKey('ignore'))\nconst logFrameSchema = lazy(() => type({\n 'type': '\"log\"',\n 'ts': 'number',\n 'workspaceId?': 'string',\n 'serverId': 'string',\n 'lines': logLineSchema.array(),\n}).onDeepUndeclaredKey('ignore'))\nexport const sseMessageSchema = lazy(() => stateFrameSchema.or(serverFrameSchema).or(logFrameSchema))\nexport type SseMessage = typeof sseMessageSchema.infer\n\nexport const logQuerySchema = lazy(() => type({\n limit: 'string?',\n}))\n\n/**\n * What a per-server lifecycle action answers with.\n *\n * `ok`/`error` are what the panel returns and every UI already reads; `code` was added so a\n * script can branch without matching English, and it is **absent on success** — a code names a\n * failure.\n */\nexport const actionResultSchema = lazy(() => type({\n 'ok': 'boolean',\n 'error?': 'string',\n 'message?': 'string',\n 'code?': 'string',\n}))\nexport type ActionResultBody = typeof actionResultSchema.infer\n\n/** Whether a probe (a test send, a token check) worked, and why not when it did not. */\nexport const deliveryResultSchema = lazy(() => type({\n 'ok': 'boolean',\n 'error?': 'string',\n}))\n\n/** A password was set or changed, and what that means for the caller's session. */\nexport const passwordSetResponseSchema = lazy(() => type({\n ok: 'boolean',\n enabled: 'boolean',\n sessionsInvalidated: 'boolean',\n}))\n\n/**\n * What both TLS mutation routes answer: the panel's listener and the move that is in flight.\n *\n * Declared once because the two routes return the same `review()` body — the DELETE declared\n * `okResponseSchema` while returning this, so a generated client read `undefined` for every field.\n */\nexport const tlsReviewResponseSchema = lazy(() => type({\n control: controlViewSchema,\n rebinding: 'boolean',\n targetUrl: 'string',\n}))\n\n/**\n * The plain acknowledgement most mutations answer with.\n *\n * Defined once because a dozen routes return it, and each was declaring its own or none at all —\n * which is why the spec had untyped `200`s where a generated client needs a shape.\n */\nexport const okResponseSchema = lazy(() => type({ ok: 'boolean' }))\n\n/** A backup was removed: the archive list it leaves behind. */\nexport const backupFilesResponseSchema = lazy(() => type({\n ok: 'boolean',\n files: backupFileSchema.array(),\n}))\n\n/** A UI build was installed (it also reports the build), or reverted. */\nexport const uiInstallResponseSchema = lazy(() => type({\n 'ok': 'boolean',\n 'meta?': uiStatusSchema.get('meta'),\n 'ui': uiStatusSchema,\n /** Revert only: whether there was a custom UI to remove. */\n 'removed?': 'boolean',\n}))\n\n/** A backup was created: the new archive and the list it belongs to. */\nexport const backupCreatedResponseSchema = lazy(() => type({\n 'file': backupFileSchema,\n 'files': backupFileSchema.array(),\n /** Captured but worth a look: a declared path that holds no files. Optional: older panels never send it. */\n 'warnings?': 'string[]',\n}))\n\n/**\n * `POST /_hh/backups` without `confirm=true`: what a backup would capture, and nothing written.\n * The local channel plans by default; `POST /api/backups` creates at once.\n */\nconst backupPlanResponseSchema = lazy(() => type({\n apply: 'false',\n entries: backupEntrySchema.array(),\n includePaths: 'string[]',\n}))\nexport type BackupPlanResponse = typeof backupPlanResponseSchema.infer\n\n/** The local channel's answer: a plan, or the archive it wrote once confirmed. */\nexport const backupLocalResponseSchema = lazy(() => backupPlanResponseSchema.or(backupCreatedResponseSchema))\n\n/** Buffered or persisted log lines, the shape every log-reading route returns. */\n/**\n * `GET /api/servers/:id/logs` — the **buffered** lines, straight from memory.\n *\n * It is not the disk history below: this route has no window, no rotation and no search, so it\n * answers `{ lines }` and nothing else. The schema used to be a copy of the disk shape\n * (`serverId`/`enabled`/`sizeBytes`/`files`/`searched`), so the documented response named five\n * fields the handler never sent — and `searched` was declared as an array here while the disk route\n * sends a number. `test/api/panel.test.ts` only walks routes it can reach with a live fixture and\n * skipped this one, so nothing caught it.\n */\nexport const bufferedLogsResponseSchema = lazy(() => type({\n lines: logLineSchema.array(),\n}))\n\n/**\n * `GET /api/logs/:id` — one entry's log **from disk**, with its rotation and its search window.\n *\n * This is the shape the UIs parse (`logHistoryViewSchema` below is the same thing with its own\n * name for the client side), and it is what `logLinesResponseSchema` should always have been.\n */\nexport const logLinesResponseSchema = lazy(() => type({\n serverId: 'string',\n enabled: 'boolean',\n sizeBytes: 'number',\n /** The rotated files this entry has, newest first. */\n files: 'string[]',\n /** How many lines the search looked at, or null when the request carried no `search`. */\n searched: 'number | null',\n lines: logLineSchema.array(),\n}))\n\n/**\n * One server's live resource reading, for `home-hosted usage`.\n *\n * `cpuPercent` and `rssBytes` are `number | null` because a reading can be absent — a process the\n * sampler has not seen yet, or one that just exited. Absent is **not** zero: a `0` here would read as\n * \"idle\" and hide a server that is not being measured at all.\n */\nconst usageEntrySchema = lazy(() => type({\n 'id': 'string',\n 'workspaceId': 'string',\n 'label': 'string',\n 'status': serverStatusSchema,\n /** Absent when nothing is running or the sampler has no sample yet. */\n 'cpuPercent?': 'number',\n 'rssBytes?': 'number',\n /** Processes in this entry's tree, including an adopted successor's. */\n 'processes?': 'number',\n 'sampledAt?': 'number',\n /**\n * How the entry has behaved over the panel's history window, so `usage` can answer \"is this\n * restarting every few minutes\" and not only \"what is it using right now\". Copied from the same\n * `ServerView.history` the page reads; absent when nothing is known yet.\n */\n 'restarts?': 'number',\n 'crashes?': 'number',\n 'uptimeRatio?': 'number',\n 'lastExitAt?': 'number',\n}))\n\nexport const usageViewSchema = lazy(() => type({\n 'servers': usageEntrySchema.array(),\n /** When the host-level sample was taken, so a caller can tell live numbers from a frozen frame. */\n 'sampledAt?': 'number',\n}))\n\n/**\n * What a `free-port` attempt did. The pids are reported so the UI can say which\n * process left, and which listeners were deliberately left alone because this\n * panel supervises them.\n */\nexport const freePortResultSchema = lazy(() => type({\n ok: 'boolean',\n port: 'number | null',\n /** Asked to leave with SIGTERM, and the ones that ignored it. */\n terminated: 'number[]',\n forced: 'number[]',\n /** Listeners this panel supervises; never signalled. */\n skipped: 'number[]',\n /** The port answers no more after the attempt. */\n free: 'boolean',\n}))\nexport type FreePortResult = typeof freePortResultSchema.infer\n\nexport const logHistoryQuerySchema = lazy(() => type({\n tail: 'string?',\n /**\n * Case-insensitive substring filter. Both this and `stream` are filters, so the route reads a\n * wider window than `tail` and applies them to that: filtering only the display tail would\n * report an older match as \"no results\", and \"the last N stderr lines\" as whatever happened\n * to fall in a window sized for all streams. `searched` reports how many lines were read.\n */\n search: 'string?',\n stream: '\"stdout\" | \"stderr\" | \"system\"?',\n}))\n\nconst logFileInfoSchema = lazy(() => type({\n name: 'string',\n sizeBytes: 'number',\n}))\n\nconst logServerViewSchema = lazy(() => type({\n serverId: 'string',\n label: 'string',\n status: serverStatusSchema,\n enabled: 'boolean',\n sizeBytes: 'number',\n files: logFileInfoSchema.array(),\n}))\nexport type LogServerView = typeof logServerViewSchema.infer\n\nexport const logServersViewSchema = lazy(() => type({\n servers: logServerViewSchema.array(),\n}))\n\nexport const logHistoryViewSchema = lazy(() => type({\n serverId: 'string',\n enabled: 'boolean',\n sizeBytes: 'number',\n files: type('string[]'),\n /** How many lines the search looked at, or null when not searching. */\n searched: 'number | null',\n lines: logLineSchema.array(),\n}))\nexport type LogHistoryView = typeof logHistoryViewSchema.infer\n\nexport const notificationActionSchema = lazy(() => type({\n /** Optional override, so the token can be tried before it is saved. */\n botToken: 'string?',\n chatId: 'string?',\n}).onUndeclaredKey('reject'))\n\n/**\n * The `:id` path parameter of a destination route.\n *\n * Validated, because the id is not only a lookup key: it also keys a bot token in the secrets file.\n * Unvalidated, `DELETE /destinations/ghost/token` answered `200`, and an id of `botToken` wrote the\n * literal secrets key `telegram.botToken`, which the reader then took for the **legacy singleton** —\n * every real destination's token became unreachable.\n */\nexport const destinationIdParamSchema = lazy(() => type({\n id: '/^[a-z0-9][a-z0-9_-]*$/',\n}))\n\n/**\n * `POST /api/notifications/test-webhook`: the webhook to try, as a draft or by id.\n *\n * The target travels whole because the page tests what is in its form, which may not be saved yet —\n * and the request schema rejects undeclared keys, so the webhook shape is reused rather than a\n * second DTO that could drift from it.\n */\nexport const destinationTestSchema = lazy(() => type({\n target: webhookTargetSchema.omit('kind', 'id').and(type({ id: 'string?', kind: '\"webhook\"?' })),\n /** Echoed so the result is recorded against the right row; absent for a draft. */\n id: 'string?',\n}).onUndeclaredKey('reject'))\n\nexport const telegramTokenSchema = lazy(() => type({\n botToken: 'string >= 1',\n}).onUndeclaredKey('reject'))\n\n/**\n * The single error envelope every route answers failures with.\n *\n * `detail` is **optional**: `toErrorBody()` omits the key when the error carries none, which is the\n * common case — measured, `/api/logs/ghost`, `/api/servers/ghost` and `/api/settings/ui` all answer\n * `{ message, code }` and nothing else. Requiring it here told every OpenAPI client to expect a field\n * that is usually absent, and disagreed with `ApiErrorBody` in `helpers/error.ts`, which has it\n * optional because that is what it actually serialises.\n */\nexport const apiErrorSchema = lazy(() => type({\n 'message': 'string',\n /** Stable, machine-readable; `AUTH_REQUIRED` also drives the login redirect. */\n 'code': 'string',\n /** Structured context when the failure has any — a field list, the routes holding a certificate. */\n 'detail?': 'unknown',\n}))\n\nexport const tlsUploadSchema = lazy(() => type({\n certificate: 'string >= 1',\n privateKey: 'string >= 1',\n}).onUndeclaredKey('reject'))\n\n/** `GET /api/settings`: the panel-wide configuration, as Global Settings reads it. */\nexport const settingsViewSchema = lazy(() => type({\n control: controlViewSchema,\n host: hostSchema,\n backups: backupsViewSchema,\n ui: uiStatusSchema,\n}).onDeepUndeclaredKey('ignore'))\nexport type SettingsView = typeof settingsViewSchema.infer\n\n/** `PATCH /api/settings` answers with the saved view, plus where the listener lands. */\nexport const settingsSavedSchema = lazy(() => settingsViewSchema.and(type({\n /** The listener is moving; reconnect at `targetUrl` when it stops being null. */\n rebinding: 'boolean',\n targetUrl: 'string | null',\n})))\nexport type SettingsSaved = typeof settingsSavedSchema.infer\n\n/**\n * `GET /api/settings/workspace?workspace=<id>`: what a workspace owns and can\n * change on its own. Global things (listener, auth, host, backups, TLS) are not\n * here — they belong to the panel, not to any workspace.\n */\nexport const workspaceSettingsViewSchema = lazy(() => type({\n id: 'string',\n label: 'string',\n settingsPath: 'string',\n configPath: 'string',\n configError: 'string | null',\n defaults: defaultsSchema,\n logs: logsSchema,\n notifications: notificationViewSchema,\n}).onDeepUndeclaredKey('ignore'))\nexport type WorkspaceSettingsView = typeof workspaceSettingsViewSchema.infer\n\nexport const workspaceSettingsSavedSchema = workspaceSettingsViewSchema\n"],"mappings":";;;;;;;;;;AAyCA,IAAa,sBAAsB;CAAE,iBAAiB;CAAI,mBAAmB;CAAI,iBAAiB;CAAI,aAAa;AAAG;AAkFtH,IAAM,kBAAgC;CACpC,SAAS;CACT,gBAAgB;CAChB,mBAAmB;CACnB,iBAAiB;CACjB,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,YAAY;CACZ,aAAa;CACb,OAAO,CAAC;CACR,UAAU;CACV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