home-hosted 0.11.0 → 0.13.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 (340) hide show
  1. package/README.md +319 -628
  2. package/dist/chunks/archive-DP-XQR8X.js +352 -0
  3. package/dist/chunks/archive-DP-XQR8X.js.map +1 -0
  4. package/dist/chunks/atomic-C1PfJpE7.js +26 -0
  5. package/dist/chunks/atomic-C1PfJpE7.js.map +1 -0
  6. package/dist/chunks/backup-CZcVca2a.js +822 -0
  7. package/dist/chunks/backup-CZcVca2a.js.map +1 -0
  8. package/dist/chunks/backups-CFRaWe_m.js +4691 -0
  9. package/dist/chunks/backups-CFRaWe_m.js.map +1 -0
  10. package/dist/chunks/config-text-DifCHhnz.js +50 -0
  11. package/dist/chunks/config-text-DifCHhnz.js.map +1 -0
  12. package/dist/chunks/contracts-CMBD1TF9.js +2230 -0
  13. package/dist/chunks/contracts-CMBD1TF9.js.map +1 -0
  14. package/dist/chunks/daemon-log-BVj8cDEo.js +241 -0
  15. package/dist/chunks/daemon-log-BVj8cDEo.js.map +1 -0
  16. package/dist/chunks/daemon-qKVECISl.js +247 -0
  17. package/dist/chunks/daemon-qKVECISl.js.map +1 -0
  18. package/dist/chunks/docker-Cy9Lyvda.js +437 -0
  19. package/dist/chunks/docker-Cy9Lyvda.js.map +1 -0
  20. package/dist/chunks/down-pKbGCW9d.js +383 -0
  21. package/dist/chunks/down-pKbGCW9d.js.map +1 -0
  22. package/dist/chunks/init-BZ7hK9Vf.js +276 -0
  23. package/dist/chunks/init-BZ7hK9Vf.js.map +1 -0
  24. package/dist/chunks/last-stop-C-BXz_XI.js +53 -0
  25. package/dist/chunks/last-stop-C-BXz_XI.js.map +1 -0
  26. package/dist/chunks/layout-DwTtmund.js +24 -0
  27. package/dist/chunks/layout-DwTtmund.js.map +1 -0
  28. package/dist/chunks/lazy-Ce5zEAq1.js +66 -0
  29. package/dist/chunks/lazy-Ce5zEAq1.js.map +1 -0
  30. package/dist/chunks/log-buffer-Dy9HHDMD.js +414 -0
  31. package/dist/chunks/log-buffer-Dy9HHDMD.js.map +1 -0
  32. package/dist/chunks/logger-B5U4GD3j.js +13 -0
  33. package/dist/chunks/logger-B5U4GD3j.js.map +1 -0
  34. package/dist/chunks/logs---TI_bxM.js +267 -0
  35. package/dist/chunks/logs---TI_bxM.js.map +1 -0
  36. package/dist/chunks/migrate-Cfoq-Vgh.js +155 -0
  37. package/dist/chunks/migrate-Cfoq-Vgh.js.map +1 -0
  38. package/dist/chunks/nanny-B-Eu0sFW.js +132 -0
  39. package/dist/chunks/nanny-B-Eu0sFW.js.map +1 -0
  40. package/dist/chunks/nanny-BtWfy0QH.js +1167 -0
  41. package/dist/chunks/nanny-BtWfy0QH.js.map +1 -0
  42. package/dist/chunks/nanny-ChMtq1Zl.js +39 -0
  43. package/dist/chunks/nanny-ChMtq1Zl.js.map +1 -0
  44. package/dist/chunks/nanny-sweep-DErnlPY1.js +105 -0
  45. package/dist/chunks/nanny-sweep-DErnlPY1.js.map +1 -0
  46. package/dist/chunks/nearest-6KgQEDUe.js +41 -0
  47. package/dist/chunks/nearest-6KgQEDUe.js.map +1 -0
  48. package/dist/chunks/parse-DhmG26fI.js +383 -0
  49. package/dist/chunks/parse-DhmG26fI.js.map +1 -0
  50. package/dist/chunks/paths-CGlGDrOU.js +206 -0
  51. package/dist/chunks/paths-CGlGDrOU.js.map +1 -0
  52. package/dist/chunks/port-B8WBTRMk.js +333 -0
  53. package/dist/chunks/port-B8WBTRMk.js.map +1 -0
  54. package/dist/chunks/restart-Des4DrAN.js +92 -0
  55. package/dist/chunks/restart-Des4DrAN.js.map +1 -0
  56. package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
  57. package/dist/chunks/schema-B240VXcV.js +103 -0
  58. package/dist/chunks/schema-B240VXcV.js.map +1 -0
  59. package/dist/chunks/secrets-BieELnZh.js +562 -0
  60. package/dist/chunks/secrets-BieELnZh.js.map +1 -0
  61. package/dist/chunks/server-Bge2r2qQ.js +169 -0
  62. package/dist/chunks/server-Bge2r2qQ.js.map +1 -0
  63. package/dist/chunks/server-ids-DRuNLVCV.js +32 -0
  64. package/dist/chunks/server-ids-DRuNLVCV.js.map +1 -0
  65. package/dist/chunks/set-password-D5vZqqSX.js +43 -0
  66. package/dist/chunks/set-password-D5vZqqSX.js.map +1 -0
  67. package/dist/chunks/set-token-obPiEJYk.js +78 -0
  68. package/dist/chunks/set-token-obPiEJYk.js.map +1 -0
  69. package/dist/chunks/settings-xu-XTfWg.js +423 -0
  70. package/dist/chunks/settings-xu-XTfWg.js.map +1 -0
  71. package/dist/chunks/setup-temp-CAN4_bA-.js +150 -0
  72. package/dist/chunks/setup-temp-CAN4_bA-.js.map +1 -0
  73. package/dist/chunks/shape-DnTKzjQ2.js +24 -0
  74. package/dist/chunks/shape-DnTKzjQ2.js.map +1 -0
  75. package/dist/chunks/src-BtWMFmzZ.js +12338 -0
  76. package/dist/chunks/src-BtWMFmzZ.js.map +1 -0
  77. package/dist/chunks/status-DT1EsA-B.js +123 -0
  78. package/dist/chunks/status-DT1EsA-B.js.map +1 -0
  79. package/dist/chunks/ui-D562aqw5.js +325 -0
  80. package/dist/chunks/ui-D562aqw5.js.map +1 -0
  81. package/dist/chunks/ui-dir-CsU3uLNV.js +39 -0
  82. package/dist/chunks/ui-dir-CsU3uLNV.js.map +1 -0
  83. package/dist/chunks/ui-release-DKzVvlLd.js +312 -0
  84. package/dist/chunks/ui-release-DKzVvlLd.js.map +1 -0
  85. package/dist/chunks/ui-revert-EkBBwRTt.js +27 -0
  86. package/dist/chunks/ui-revert-EkBBwRTt.js.map +1 -0
  87. package/dist/chunks/ui-switch-BnZTdMDd.js +150 -0
  88. package/dist/chunks/ui-switch-BnZTdMDd.js.map +1 -0
  89. package/dist/chunks/ui-update-_xryLYxw.js +272 -0
  90. package/dist/chunks/ui-update-_xryLYxw.js.map +1 -0
  91. package/dist/chunks/up-Pdz-l6IH.js +210 -0
  92. package/dist/chunks/up-Pdz-l6IH.js.map +1 -0
  93. package/dist/chunks/usage-DFrCVXpT.js +111 -0
  94. package/dist/chunks/usage-DFrCVXpT.js.map +1 -0
  95. package/dist/chunks/workspaces-DYcfvKV_.js +229 -0
  96. package/dist/chunks/workspaces-DYcfvKV_.js.map +1 -0
  97. package/dist/chunks/wsl-temperature-BiCI4iK6.js +322 -0
  98. package/dist/chunks/wsl-temperature-BiCI4iK6.js.map +1 -0
  99. package/dist/cli.js +441 -25418
  100. package/dist/cli.js.map +1 -1
  101. package/dist/client.js +144 -0
  102. package/dist/client.js.map +1 -0
  103. package/dist/types/api/acme.d.ts +24 -0
  104. package/dist/types/api/auth/$.routes.d.ts +103 -0
  105. package/dist/types/api/backups.d.ts +184 -0
  106. package/dist/types/api/control.d.ts +470 -0
  107. package/dist/types/api/ddns.d.ts +432 -0
  108. package/dist/types/api/events.d.ts +22 -0
  109. package/dist/types/api/health.d.ts +28 -0
  110. package/dist/types/api/logs.d.ts +95 -0
  111. package/dist/types/api/metrics.d.ts +21 -0
  112. package/dist/types/api/notifications.d.ts +141 -0
  113. package/dist/types/api/proxy.d.ts +1128 -0
  114. package/dist/types/api/servers/$.routes.d.ts +1318 -0
  115. package/dist/types/api/settings.d.ts +642 -0
  116. package/dist/types/api/state.d.ts +498 -0
  117. package/dist/types/api/static.d.ts +11 -0
  118. package/dist/types/api/tls.d.ts +112 -0
  119. package/dist/types/api/workspaces/$.routes.d.ts +797 -0
  120. package/dist/types/api/wsl-temperature.d.ts +113 -0
  121. package/dist/types/app.d.ts +6095 -0
  122. package/dist/types/cli/args.d.ts +75 -0
  123. package/dist/types/cli/backup-offline.d.ts +23 -0
  124. package/dist/types/cli/backup.d.ts +86 -0
  125. package/dist/types/cli/down.d.ts +80 -0
  126. package/dist/types/cli/init.d.ts +60 -0
  127. package/dist/types/cli/io.d.ts +65 -0
  128. package/dist/types/cli/logs.d.ts +76 -0
  129. package/dist/types/cli/migrate.d.ts +33 -0
  130. package/dist/types/cli/nanny.d.ts +19 -0
  131. package/dist/types/cli/nearest.d.ts +10 -0
  132. package/dist/types/cli/restart.d.ts +41 -0
  133. package/dist/types/cli/server.d.ts +68 -0
  134. package/dist/types/cli/set-password.d.ts +14 -0
  135. package/dist/types/cli/set-token.d.ts +21 -0
  136. package/dist/types/cli/setup-temp.d.ts +65 -0
  137. package/dist/types/cli/status.d.ts +14 -0
  138. package/dist/types/cli/ui-revert.d.ts +3 -0
  139. package/dist/types/cli/ui-switch.d.ts +27 -0
  140. package/dist/types/cli/ui-update.d.ts +72 -0
  141. package/dist/types/cli/up.d.ts +96 -0
  142. package/dist/types/cli/usage.d.ts +23 -0
  143. package/dist/types/cli.d.ts +12 -0
  144. package/dist/types/client.d.ts +11891 -0
  145. package/dist/types/config/layout.d.ts +11 -0
  146. package/dist/types/config/migrations.d.ts +69 -0
  147. package/dist/types/config/parse.d.ts +54 -0
  148. package/dist/types/config/patch.d.ts +20 -0
  149. package/dist/types/config/schema.d.ts +318 -0
  150. package/dist/types/config/secret-parts.d.ts +48 -0
  151. package/dist/types/config/secrets.d.ts +208 -0
  152. package/dist/types/config/seed.d.ts +30 -0
  153. package/dist/types/config/server-ids.d.ts +14 -0
  154. package/dist/types/config/settings.d.ts +120 -0
  155. package/dist/types/config/store.d.ts +145 -0
  156. package/dist/types/config/workspaces.d.ts +99 -0
  157. package/dist/types/helpers/action-result.d.ts +46 -0
  158. package/dist/types/helpers/atomic.d.ts +9 -0
  159. package/dist/types/helpers/backoff.d.ts +7 -0
  160. package/dist/types/helpers/bind.d.ts +16 -0
  161. package/dist/types/helpers/config-text.d.ts +23 -0
  162. package/dist/types/helpers/cookies.d.ts +19 -0
  163. package/dist/types/helpers/copy-tree.d.ts +20 -0
  164. package/dist/types/helpers/daemon-log.d.ts +45 -0
  165. package/dist/types/helpers/daemon.d.ts +135 -0
  166. package/dist/types/helpers/deferred.d.ts +7 -0
  167. package/dist/types/helpers/env-file.d.ts +20 -0
  168. package/dist/types/helpers/error.d.ts +26 -0
  169. package/dist/types/helpers/event-stream.d.ts +21 -0
  170. package/dist/types/helpers/factory.d.ts +6 -0
  171. package/dist/types/helpers/last-stop.d.ts +20 -0
  172. package/dist/types/helpers/logger.d.ts +7 -0
  173. package/dist/types/helpers/open.d.ts +2 -0
  174. package/dist/types/helpers/openapi.d.ts +34 -0
  175. package/dist/types/helpers/paths.d.ts +112 -0
  176. package/dist/types/helpers/restore-lock.d.ts +32 -0
  177. package/dist/types/helpers/runtime.d.ts +18 -0
  178. package/dist/types/helpers/secret-compare.d.ts +13 -0
  179. package/dist/types/helpers/shell.d.ts +19 -0
  180. package/dist/types/helpers/sse.d.ts +23 -0
  181. package/dist/types/helpers/template.d.ts +8 -0
  182. package/dist/types/helpers/ui-dir.d.ts +11 -0
  183. package/dist/types/helpers/utf8-chunks.d.ts +15 -0
  184. package/dist/types/helpers/validate.d.ts +7 -0
  185. package/dist/types/helpers/validator.d.ts +12 -0
  186. package/dist/types/helpers/version.d.ts +10 -0
  187. package/dist/types/helpers/workspace.d.ts +25 -0
  188. package/dist/types/index.d.ts +17 -0
  189. package/dist/types/middleware/auth.d.ts +53 -0
  190. package/dist/types/middleware/host.d.ts +29 -0
  191. package/dist/types/middleware/loopback.d.ts +18 -0
  192. package/dist/types/openapi-reference.d.ts +22 -0
  193. package/dist/types/openapi.d.ts +34 -0
  194. package/dist/types/providers/archive.d.ts +54 -0
  195. package/dist/types/providers/backup-hook.d.ts +34 -0
  196. package/dist/types/providers/ddns/cloudflare.d.ts +2 -0
  197. package/dist/types/providers/ddns/desec.d.ts +2 -0
  198. package/dist/types/providers/ddns/digitalocean.d.ts +2 -0
  199. package/dist/types/providers/ddns/duckdns.d.ts +2 -0
  200. package/dist/types/providers/ddns/dyndns2.d.ts +15 -0
  201. package/dist/types/providers/ddns/dynu.d.ts +2 -0
  202. package/dist/types/providers/ddns/freedns.d.ts +2 -0
  203. package/dist/types/providers/ddns/gandi.d.ts +2 -0
  204. package/dist/types/providers/ddns/godaddy.d.ts +2 -0
  205. package/dist/types/providers/ddns/henet.d.ts +3 -0
  206. package/dist/types/providers/ddns/index.d.ts +12 -0
  207. package/dist/types/providers/ddns/ip.d.ts +27 -0
  208. package/dist/types/providers/ddns/namecheap-api.d.ts +13 -0
  209. package/dist/types/providers/ddns/namecheap.d.ts +6 -0
  210. package/dist/types/providers/ddns/noip.d.ts +2 -0
  211. package/dist/types/providers/ddns/porkbun.d.ts +2 -0
  212. package/dist/types/providers/ddns/spaceship.d.ts +7 -0
  213. package/dist/types/providers/ddns/types.d.ts +98 -0
  214. package/dist/types/providers/ddns/zone.d.ts +11 -0
  215. package/dist/types/providers/docker.d.ts +117 -0
  216. package/dist/types/providers/entry-state.d.ts +15 -0
  217. package/dist/types/providers/health-check.d.ts +27 -0
  218. package/dist/types/providers/host.d.ts +147 -0
  219. package/dist/types/providers/identity.d.ts +54 -0
  220. package/dist/types/providers/log-tail.d.ts +56 -0
  221. package/dist/types/providers/nanny-sweep.d.ts +54 -0
  222. package/dist/types/providers/nanny.d.ts +104 -0
  223. package/dist/types/providers/port.d.ts +142 -0
  224. package/dist/types/providers/proc.d.ts +125 -0
  225. package/dist/types/providers/process.d.ts +78 -0
  226. package/dist/types/providers/proxy/caddy.d.ts +2 -0
  227. package/dist/types/providers/proxy/index.d.ts +7 -0
  228. package/dist/types/providers/proxy/types.d.ts +54 -0
  229. package/dist/types/providers/server-vars.d.ts +4 -0
  230. package/dist/types/providers/telegram.d.ts +74 -0
  231. package/dist/types/providers/ui-release.d.ts +113 -0
  232. package/dist/types/providers/webhook.d.ts +64 -0
  233. package/dist/types/providers/wsl-temperature.d.ts +65 -0
  234. package/dist/types/services/acme-challenge.d.ts +44 -0
  235. package/dist/types/services/auth.d.ts +177 -0
  236. package/dist/types/services/backups.d.ts +476 -0
  237. package/dist/types/services/config-watch.d.ts +40 -0
  238. package/dist/types/services/control-server.d.ts +58 -0
  239. package/dist/types/services/ddns.d.ts +72 -0
  240. package/dist/types/services/dependencies.d.ts +21 -0
  241. package/dist/types/services/events.d.ts +17 -0
  242. package/dist/types/services/exposure.d.ts +86 -0
  243. package/dist/types/services/history.d.ts +37 -0
  244. package/dist/types/services/host-monitor.d.ts +33 -0
  245. package/dist/types/services/init.d.ts +71 -0
  246. package/dist/types/services/log-buffer.d.ts +39 -0
  247. package/dist/types/services/log-files.d.ts +77 -0
  248. package/dist/types/services/log-relay.d.ts +35 -0
  249. package/dist/types/services/nanny.d.ts +14 -0
  250. package/dist/types/services/notifications.d.ts +124 -0
  251. package/dist/types/services/panel.d.ts +213 -0
  252. package/dist/types/services/proxy-certificates/certificates.d.ts +116 -0
  253. package/dist/types/services/proxy-config.d.ts +83 -0
  254. package/dist/types/services/proxy.d.ts +431 -0
  255. package/dist/types/services/state.d.ts +38 -0
  256. package/dist/types/services/supervisor/compose.d.ts +17 -0
  257. package/dist/types/services/supervisor/entry.d.ts +149 -0
  258. package/dist/types/services/supervisor/health.d.ts +56 -0
  259. package/dist/types/services/supervisor/output.d.ts +126 -0
  260. package/dist/types/services/supervisor/pending-load.d.ts +6 -0
  261. package/dist/types/services/supervisor/persistent.d.ts +58 -0
  262. package/dist/types/services/supervisor/port-preflight.d.ts +45 -0
  263. package/dist/types/services/supervisor/records.d.ts +118 -0
  264. package/dist/types/services/supervisor/spawn.d.ts +15 -0
  265. package/dist/types/services/supervisor/view.d.ts +4 -0
  266. package/dist/types/services/supervisor.d.ts +145 -0
  267. package/dist/types/services/tls.d.ts +48 -0
  268. package/dist/types/services/ui-update.d.ts +44 -0
  269. package/dist/types/services/ui.d.ts +50 -0
  270. package/dist/types/shared/action-outcome.d.ts +25 -0
  271. package/dist/types/shared/api-client.d.ts +351 -0
  272. package/dist/types/shared/backup-scope.d.ts +167 -0
  273. package/dist/types/shared/clone.d.ts +14 -0
  274. package/dist/types/shared/contracts.d.ts +4175 -0
  275. package/dist/types/shared/cpu-scale.d.ts +25 -0
  276. package/dist/types/shared/ddns-form.d.ts +75 -0
  277. package/dist/types/shared/endpoint.d.ts +8 -0
  278. package/dist/types/shared/error-message.d.ts +8 -0
  279. package/dist/types/shared/fields.d.ts +21 -0
  280. package/dist/types/shared/form-repair.d.ts +6 -0
  281. package/dist/types/shared/generated.d.ts +26 -0
  282. package/dist/types/shared/host-readings.d.ts +185 -0
  283. package/dist/types/shared/lazy.d.ts +4 -0
  284. package/dist/types/shared/live-frames.d.ts +22 -0
  285. package/dist/types/shared/live-series.d.ts +21 -0
  286. package/dist/types/shared/live-store.d.ts +72 -0
  287. package/dist/types/shared/patch-diff.d.ts +105 -0
  288. package/dist/types/shared/probe-latency.d.ts +25 -0
  289. package/dist/types/shared/proxy-form.d.ts +184 -0
  290. package/dist/types/shared/server-attention.d.ts +37 -0
  291. package/dist/types/shared/server-form.d.ts +121 -0
  292. package/dist/types/shared/server-key.d.ts +13 -0
  293. package/dist/types/shared/server-readings.d.ts +55 -0
  294. package/dist/types/shared/server-url.d.ts +43 -0
  295. package/dist/types/shared/shape.d.ts +17 -0
  296. package/dist/types/shared/stream-access.d.ts +20 -0
  297. package/dist/types/shared/ui-format.d.ts +89 -0
  298. package/docs/API.md +209 -0
  299. package/docs/BACKUPS.md +117 -0
  300. package/docs/CLI.md +95 -0
  301. package/docs/DDNS.md +11 -1
  302. package/docs/NOTIFICATIONS.md +7 -1
  303. package/docs/REVERSE_PROXY.md +9 -3
  304. package/docs/SECURITY.md +93 -0
  305. package/docs/SERVERS.md +141 -34
  306. package/docs/UI_CREATION.md +91 -291
  307. package/docs/demo/blank-host-restore.sh +4 -3
  308. package/package.json +22 -14
  309. package/uis/stock/dist/assets/CopyButton-BUBKRJyY.js +1 -0
  310. package/uis/stock/dist/assets/GlobalSettingsView-yYMcRWvt.js +1 -0
  311. package/uis/stock/dist/assets/LogViewer-DIliXy62.js +1 -0
  312. package/uis/stock/dist/assets/LogsView-B7Z-7RNg.js +1 -0
  313. package/uis/stock/dist/assets/Modal-DmKa5Qpp.js +39 -0
  314. package/uis/stock/dist/assets/ProxyView-DvZiNkwb.js +1 -0
  315. package/uis/stock/dist/assets/ServerDetailView-6idGT_EX.js +2 -0
  316. package/uis/stock/dist/assets/SettingsShell-CeGtleYI.js +1 -0
  317. package/uis/stock/dist/assets/SettingsView-BrhJIrmk.js +2 -0
  318. package/uis/stock/dist/assets/de-BRITeb0H.js +1 -0
  319. package/uis/stock/dist/assets/es-B2zIEssV.js +1 -0
  320. package/uis/stock/dist/assets/fr-s0ZOBEqh.js +1 -0
  321. package/uis/stock/dist/assets/index-C1MehbKy.css +2 -0
  322. package/uis/stock/dist/assets/index-CnBN54wF.js +15 -0
  323. package/uis/stock/dist/assets/ja-CU7MR85V.js +1 -0
  324. package/uis/stock/dist/assets/ko-tL5Me6d-.js +1 -0
  325. package/uis/stock/dist/assets/ru-92yrvkNJ.js +1 -0
  326. package/uis/stock/dist/assets/vi-CzvY16k2.js +1 -0
  327. package/uis/stock/dist/assets/zh-CN-DDwFW_uW.js +1 -0
  328. package/uis/stock/dist/index.html +3 -2
  329. package/uis/stock/dist/ui.json +3 -3
  330. package/docs/RESTORE_DEMO.md +0 -306
  331. package/uis/stock/dist/assets/de-0YLueNal.js +0 -1
  332. package/uis/stock/dist/assets/es-FCHhRmn2.js +0 -1
  333. package/uis/stock/dist/assets/fr-C69Z8o0z.js +0 -1
  334. package/uis/stock/dist/assets/index-Cok5msAO.css +0 -2
  335. package/uis/stock/dist/assets/index-KdyqrVv8.js +0 -53
  336. package/uis/stock/dist/assets/ja-Chz9YOqR.js +0 -1
  337. package/uis/stock/dist/assets/ko-CtXZ2x1l.js +0 -1
  338. package/uis/stock/dist/assets/ru-D_jE64xN.js +0 -1
  339. package/uis/stock/dist/assets/vi-sxSffss7.js +0 -1
  340. package/uis/stock/dist/assets/zh-CN-ChTpf29X.js +0 -1
@@ -0,0 +1,184 @@
1
+ import type { ProxyCertificateView, ProxyConfig, ProxyPatch, ProxyRoute, ProxyRoutePatch } from './contracts.js';
2
+ /**
3
+ * The reverse-proxy form, shared by both UIs: the route draft the table edits, the patch a save
4
+ * sends, and the checks the panel would otherwise answer with a 400.
5
+ *
6
+ * These declarations were identical copies in `uis/stock` and `uis/noc-console`
7
+ * (`parseUpstream` differs only in a doc comment, so it takes the fuller one). Eight commits had
8
+ * touched both files, one literally "carry the fix into the other UI" — a measured cost.
9
+ *
10
+ * Nothing here may import Vue: the UIs bundle it as a devDependency while the published package
11
+ * does not ship it, so a Vue import would break the server if it ever read this file. That is also
12
+ * why the detach is `clonePlain` (`./clone.ts`), never `structuredClone(toRaw(...))`.
13
+ */
14
+ export interface CertificateErrors {
15
+ label?: string;
16
+ id?: string;
17
+ certificate?: string;
18
+ privateKey?: string;
19
+ }
20
+ export declare const HOST_PATTERN: RegExp;
21
+ export declare const LOCAL_LISTENER: RegExp;
22
+ export declare const LOCAL_TLDS: string[];
23
+ /** The panel-wide block a save writes besides the route table. */
24
+ export interface ListenerDraft {
25
+ enabled: boolean;
26
+ httpPort: number;
27
+ httpsPort: number;
28
+ email: string;
29
+ staging: boolean;
30
+ /** DNS-01: the panel answers the challenge instead of the engine using ports. */
31
+ dns01: boolean;
32
+ /** Nameservers the engine checks the record against, as typed: one per line or comma. */
33
+ resolvers: string;
34
+ }
35
+ /** The listener form filled from a config: a fresh object, so editing it never touches live state. */
36
+ export declare function cloneListenerDraft(config: ProxyConfig): ListenerDraft;
37
+ export interface ProxyWorkspace {
38
+ id: string;
39
+ label: string;
40
+ servers: Array<{
41
+ id: string;
42
+ }>;
43
+ }
44
+ export declare const ROUTE_ID_PATTERN: RegExp;
45
+ /** The route as the page edits it: the config plus a stable key for `v-for`. */
46
+ export interface RouteDraft extends ProxyRoute {
47
+ key: string;
48
+ }
49
+ export interface RouteErrors {
50
+ host?: string;
51
+ id?: string;
52
+ workspace?: string;
53
+ server?: string;
54
+ url?: string;
55
+ path?: string;
56
+ form?: string;
57
+ }
58
+ /**
59
+ * The sentences `validateRouteDraft` puts in {@link RouteErrors}, as a seam for translation.
60
+ *
61
+ * The rules belong here — both UIs must refuse the same input for the same reason — but the
62
+ * wording does not: a UI shipping more than one language has to render these in the reader's
63
+ * language, and `src/shared/` may not import Vue or the UI's i18n. So the caller passes messages
64
+ * and the defaults keep every existing caller's output byte-identical.
65
+ */
66
+ export interface RouteErrorMessages {
67
+ hostRequired: () => string;
68
+ hostInvalid: () => string;
69
+ hostDuplicate: (host: string) => string;
70
+ pathNeedsSlash: () => string;
71
+ pathHasSpace: () => string;
72
+ idInvalid: () => string;
73
+ idDuplicate: (id: string) => string;
74
+ workspaceRequired: () => string;
75
+ serverRequired: () => string;
76
+ urlInvalid: () => string;
77
+ }
78
+ /** The words the route list shows for a target or a retry delay, as a translation seam. */
79
+ export interface RouteSummaryLabels {
80
+ controlPanel: () => string;
81
+ noUpstream: () => string;
82
+ noServerPicked: () => string;
83
+ fallbackRetry: () => string;
84
+ retryOne: (count: number, unit: 'minute' | 'hour') => string;
85
+ retryMany: (count: number, unit: 'minute' | 'hour') => string;
86
+ }
87
+ export declare const UNPRIVILEGED_HTTPS_PORT = 4443;
88
+ export declare const UNPRIVILEGED_HTTP_PORT = 4480;
89
+ /** One uploaded pair, as the list shows it; the files themselves are on disk. */
90
+ export declare function certificateTitle(certificate: Pick<ProxyCertificateView, 'label' | 'id'>): string;
91
+ /** The first public name that would need the e-mail, for the hint to name it. */
92
+ export declare function firstPublicHost(routes: readonly RouteDraft[]): string | null;
93
+ export declare function formatBytes(bytes: number | null): string;
94
+ export declare function isPrivilegedPort(port: number): boolean;
95
+ /** A name an ACME CA could issue for; anything else gets the engine's own CA. */
96
+ export declare function isPublicHost(host: string): boolean;
97
+ export declare function listenerPatch(current: ProxyConfig, draft: ListenerDraft): Partial<ProxyPatch>;
98
+ export declare function newRouteDraft(): RouteDraft;
99
+ export declare function newRouteKey(): string;
100
+ /**
101
+ * A detached, plain copy of the route list, so an edit cannot reach live state.
102
+ *
103
+ * `clonePlain`, not `structuredClone(toRaw(...))`: a list the page rebuilt holds Vue proxies
104
+ * inside the raw array, and the clone then throws `DataCloneError`.
105
+ */
106
+ export declare function cloneRoutes(routes: readonly ProxyRoute[]): RouteDraft[];
107
+ /**
108
+ * Applies a dialog result to the draft list.
109
+ *
110
+ * `edited` is matched by route **id**, never by the row's `key`: a state frame arriving while the
111
+ * dialog is open re-clones the list and mints a fresh key per row, so the row the dialog was opened
112
+ * from no longer matches by key — and the edit was then dropped with the dialog closing as if it
113
+ * had saved. An id survives the re-clone. `null` means the dialog is adding, which is why the add
114
+ * case is not "no match found".
115
+ */
116
+ export declare function applyRouteDraft(routes: readonly RouteDraft[], edited: RouteDraft | null, next: RouteDraft): RouteDraft[];
117
+ /** Nameservers as typed: split on commas or newlines, trimmed, empties dropped. */
118
+ export declare function parseResolvers(value: string): string[];
119
+ /** The whole patch a save sends, or `null` when nothing changed. */
120
+ export declare function proxyPatch(current: ProxyConfig, listener: ListenerDraft, drafts: readonly RouteDraft[], filledRoutes?: readonly ProxyRoute[]): ProxyPatch | null;
121
+ /**
122
+ * The e-mail rule the panel enforces: a public name served over TLS needs an
123
+ * ACME account address. A local-only name gets the engine's own CA, so a
124
+ * LAN-only setup never needs one.
125
+ */
126
+ export declare function requiresEmail(listener: Pick<ListenerDraft, 'email' | 'staging'>, routes: readonly RouteDraft[]): boolean;
127
+ export declare function retryInLabel(minutes: number | null, labels?: RouteSummaryLabels): string;
128
+ /**
129
+ * Where a route answers, for the list's link. A route with TLS off is served on the
130
+ * plain port, and a standard port stays out of the URL.
131
+ */
132
+ export declare function routeUrl(route: Pick<ProxyRoute, 'host' | 'path' | 'tls'>, httpPort: number, httpsPort: number): string | null;
133
+ export declare function routesEqual(current: readonly ProxyRoute[], drafts: readonly RouteDraft[]): boolean;
134
+ /**
135
+ * The route table to send, or `null` when unchanged.
136
+ *
137
+ * `filled` is the table this form was filled with. With it the patch is a three-way merge, so a
138
+ * route another client added while the page was open survives a save from this one; without it the
139
+ * draft's whole view is sent, which is only safe when the caller knows it holds the current table.
140
+ */
141
+ export declare function routesPatch(current: readonly ProxyRoute[], drafts: readonly RouteDraft[], filled?: readonly ProxyRoute[]): ProxyRoutePatch[] | null;
142
+ /**
143
+ * The routes both this form and another client changed, so the save can refuse instead of choosing.
144
+ *
145
+ * Same rule as `destinationConflicts`: a three-way merge keeps a concurrent addition but cannot keep
146
+ * a concurrent edit to one route, because both sides moved it off the same baseline.
147
+ */
148
+ export declare function routeConflicts(current: readonly ProxyRoute[], drafts: readonly RouteDraft[], filled?: readonly ProxyRoute[]): string[];
149
+ export declare function sameWire(a: ProxyRoute, b: ProxyRoute): boolean;
150
+ /** A certificate is named by its label; the id names the files on disk. */
151
+ export declare function slugifyCertificateId(label: string): string;
152
+ export declare function slugifyId(value: string, fallback: string): string;
153
+ export declare function slugifyRouteId(host: string): string;
154
+ /** What the target column reads: who a route forwards to. */
155
+ export declare function targetSummary(route: ProxyRoute, workspaces: readonly ProxyWorkspace[], labels?: RouteSummaryLabels): string;
156
+ export declare function toProxyRoutes(drafts: readonly RouteDraft[]): ProxyRoutePatch[];
157
+ /**
158
+ * The wire shape of a route: a row key is a UI detail, and the schema rejects
159
+ * undeclared keys.
160
+ */
161
+ export declare function toRouteWire(route: ProxyRoute): ProxyRoutePatch;
162
+ export declare function uniqueCertificateId(base: string, taken: readonly string[]): string;
163
+ export declare function uniqueId(base: string, taken: readonly string[]): string;
164
+ export declare function uniqueRouteId(base: string, taken: readonly string[]): string;
165
+ /** True while the ports are the unprivileged pair this page offers as a switch. */
166
+ export declare function usesFallbackPorts(config: Pick<ProxyConfig, 'httpPort' | 'httpsPort'>): boolean;
167
+ export declare function validateRouteDraft(draft: RouteDraft, options: {
168
+ others: readonly RouteDraft[];
169
+ workspaces: readonly ProxyWorkspace[];
170
+ messages?: Partial<RouteErrorMessages>;
171
+ }): RouteErrors;
172
+ /**
173
+ * The panel accepts an upstream with or without a scheme, and a port is optional
174
+ * because every scheme has a default one — the panel fills in :80 or :443.
175
+ *
176
+ * A typed default port is dropped on the way to the panel: `new URL` normalizes
177
+ * `:80` on `http:` away, so `http://10.0.0.5:80` and `http://10.0.0.5` are one
178
+ * upstream, and a route table that keeps both forms would read as unchanged after
179
+ * a save that the panel had actually rewritten.
180
+ */
181
+ export declare function parseUpstream(value: string): {
182
+ host: string;
183
+ port: string;
184
+ } | null;
@@ -0,0 +1,37 @@
1
+ import type { HealthState, ServerStatus } from './contracts.js';
2
+ /**
3
+ * Whether one entry is a problem someone has to look at.
4
+ *
5
+ * Every surface that answers "is anything wrong" asks this question — the panel's own `/healthz`,
6
+ * which an external monitor polls, and the three "needs attention" counts and filters the UIs draw
7
+ * — and it was written out at **seven** call sites as a hand-picked disjunction. They had already
8
+ * disagreed, in both directions, and each disagreement was invisible from the surface that got it
9
+ * right:
10
+ *
11
+ * - **`/healthz` said `ok` with a `conflict` entry.** Its filter named `crashed`, `stoppedByPanel`
12
+ * and a running-unhealthy entry, but not `conflict` — the status that means "this entry cannot
13
+ * start because its port is held". Measured on a panel whose only entry was blocked:
14
+ * `GET /healthz` → `200 {"status":"ok"}` while `GET /_hh/usage` and the card both read
15
+ * `web conflict`. A monitor watching that endpoint reported a healthy home with a server down.
16
+ *
17
+ * - **The UIs said nothing about an entry the panel itself gave up on.** They read `health` and
18
+ * `status` but never `stoppedByPanel`, so an entry stopped after its health budget was spent
19
+ * counted as "stopped", which is the status the same predicate deliberately treats as fine. The
20
+ * card kept its reason on `lastError` and `/healthz` answered 503, so the one page a person opens
21
+ * to find out what broke was the one place it was not counted.
22
+ *
23
+ * Both are the same defect: a question with several right answers, decided once per call site. The
24
+ * list is read from the **status enum**, not from whichever statuses a given surface happened to
25
+ * think of, and `stoppedByPanel` is part of it because `stopped` cannot say which stop it was.
26
+ *
27
+ * A deliberate stop is not here, and that is the distinction the statuses exist to make: stopping
28
+ * sets `stopped`, never `crashed` or `conflict`. `stoppedByPanel` is the exception, because the
29
+ * panel stopping an entry that cannot serve is a broken service, not an operator's decision.
30
+ */
31
+ export interface AttentionSource {
32
+ status: ServerStatus;
33
+ health?: HealthState;
34
+ /** Optional so a newer UI reading an older panel's frame still parses it. */
35
+ stoppedByPanel?: boolean;
36
+ }
37
+ export declare function needsAttention(server: AttentionSource): boolean;
@@ -0,0 +1,121 @@
1
+ import type { HealthConfig, HttpCheckConfig, OnPortConflict, RestartConfig, ServerConfig, StopConfig } from './contracts.js';
2
+ import type { Patch } from './patch-diff.js';
3
+ /**
4
+ * Editing one existing server entry: config → form, form → payload, and the diff that Save sends.
5
+ *
6
+ * `uis/stock`'s `ServerConfigEditor` and `uis/noc-console`'s `ServerConfigView` each carried this
7
+ * whole round trip, and they had drifted: the console read every box with `Number(...)`, so a
8
+ * cleared `grace (ms)` saved `0` — an instant SIGKILL on the next stop — while the stock editor
9
+ * repaired some boxes by hand and clamped others; only one of them could edit `dump`/`load`; both
10
+ * showed the hook timeouts in ms although their floor is a second. The UIs keep their own markup
11
+ * and their own form objects; what a value *means* is decided here, once.
12
+ *
13
+ * Every numeric box is a `NumericInput` — a native `<input>` reports a string, a number field a
14
+ * number, `NaN` or `null` — and a box that decided nothing (blank or unreadable) falls back to the
15
+ * value the form was **filled** from, never to `0`.
16
+ */
17
+ /** What a numeric box can hold, across both UIs' controls. */
18
+ export type NumericInput = number | string | null | undefined;
19
+ /** Default hook timeouts, as `contracts.ts` declares them. */
20
+ export declare const BOOTSTRAP_TIMEOUT_MS = 120000;
21
+ export declare const BACKUP_HOOK_TIMEOUT_MS = 600000;
22
+ /** Whether a box was left empty, as opposed to holding something unreadable. */
23
+ export declare function isBlankInput(raw: NumericInput): boolean;
24
+ /** A numeric box as a number; `NaN` when it decided nothing (blank or unreadable). */
25
+ export declare function readFormNumber(raw: NumericInput): number;
26
+ /** Every number member of `T` loosened to what a box reports. */
27
+ type Loose<T, N> = {
28
+ [K in keyof T]-?: T[K] extends number ? N : T[K];
29
+ };
30
+ export interface HookForm<N extends NumericInput = NumericInput> {
31
+ enabled: boolean;
32
+ command: string;
33
+ /** One per line. */
34
+ args: string;
35
+ /** `KEY=value` per line. */
36
+ env: string;
37
+ /** Seconds: the schema floor is 1000 ms, so a sub-second value is never meaningful. */
38
+ timeoutSeconds: N;
39
+ }
40
+ export interface BootstrapForm<N extends NumericInput = NumericInput> extends HookForm<N> {
41
+ runOnce: boolean;
42
+ }
43
+ /**
44
+ * The form, with `N` the type its numeric boxes hold: a number field's `number | null`, or the
45
+ * string a native `<input>` reports.
46
+ */
47
+ export interface ServerEditForm<N extends NumericInput = NumericInput> {
48
+ label: string;
49
+ command: string;
50
+ cwd: string;
51
+ /** One per line. */
52
+ args: string;
53
+ env: string;
54
+ dataEnvs: string;
55
+ backupPaths: string;
56
+ backupIgnoreGenerated: boolean;
57
+ /** Comma separated. */
58
+ dependsOn: string;
59
+ envFile: string;
60
+ /** MiB; blank is "no guard". */
61
+ maxRssMb: N;
62
+ /** Blank is "no port". */
63
+ port: N;
64
+ bind: string;
65
+ onPortConflict: OnPortConflict;
66
+ logBufferLines: N;
67
+ enabled: boolean;
68
+ autostart: boolean;
69
+ persistent: boolean;
70
+ restart: Loose<RestartConfig, N>;
71
+ health: Omit<Loose<HealthConfig, N>, 'http'> & {
72
+ http: Omit<Loose<HttpCheckConfig, N>, 'expectStatus'> & {
73
+ expectStatus: N;
74
+ };
75
+ };
76
+ stop: Loose<StopConfig, N>;
77
+ bootstrap: BootstrapForm<N>;
78
+ dump: HookForm<N>;
79
+ load: HookForm<N>;
80
+ }
81
+ /** A config as the form a person edits. Detached: nothing in it aliases `config`. */
82
+ export declare function serverEditForm(config: ServerConfig): ServerEditForm<number | null>;
83
+ /**
84
+ * Seconds back to the stored ms, keeping the filled value when the box still shows it.
85
+ *
86
+ * A stored `1500` reads `2` s; writing `2000` back for a box nobody touched would be a phantom
87
+ * change on every open, so an unchanged reading keeps the exact stored milliseconds.
88
+ */
89
+ export declare function hookTimeoutMs(raw: NumericInput, filledMs: number | undefined, defaultMs: number): number;
90
+ /**
91
+ * The whole entry as the form now describes it.
92
+ *
93
+ * `filled` is the config the form was filled from: a box that decided nothing falls back to its
94
+ * value. That is also what `serverEditPatch` diffs against, so an untouched field never travels.
95
+ */
96
+ export declare function serverEditPayload(form: ServerEditForm, filled: ServerConfig): Patch;
97
+ /**
98
+ * Exactly what Save writes: the payload minus everything equal to the **filled** snapshot.
99
+ *
100
+ * Diffing against live state instead would treat another client's change as this form's own and
101
+ * write the old value back over it.
102
+ */
103
+ export declare function serverEditPatch(form: ServerEditForm, filled: ServerConfig): Patch;
104
+ /**
105
+ * Whether a live config object is a genuine change from the one a form was filled from.
106
+ *
107
+ * By value, because the control plane re-creates every config object on each state frame: an
108
+ * identity check would call every frame a change. `snapshot` must be an independent copy.
109
+ */
110
+ export declare function isLiveConfigChange(next: unknown, snapshot: unknown): boolean;
111
+ /**
112
+ * What an open editor does when a state frame arrives.
113
+ *
114
+ * `keep` — nothing changed. `refill` — the config moved and the form holds no edits, so it shows the
115
+ * new values. `notice` — it moved while the form holds edits: they are kept (Save sends only them),
116
+ * and the person is told, rather than having what they typed wiped by someone else's save.
117
+ */
118
+ export declare function liveConfigUpdate(next: ServerConfig | null | undefined, filled: ServerConfig, dirty: boolean): 'keep' | 'refill' | 'notice';
119
+ /** A detached snapshot of the config a form is filled from. */
120
+ export declare function fillSnapshot(config: ServerConfig): ServerConfig;
121
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The SSE bucket key: one server inside one workspace.
3
+ *
4
+ * A server id is only unique within its workspace, so anything keyed by id alone mixes frames between
5
+ * same-named servers — and this key was **three separate definitions**: `services/events.ts` (which
6
+ * dispatches) and both UIs' composables (which subscribe). Byte-identical today, but a change to the
7
+ * format on either side would route messages to the wrong bucket or to none, silently — the panel
8
+ * would simply stop updating, with nothing to error on.
9
+ *
10
+ * It lives in `src/shared` rather than a UI because this module imports no Vue and is reachable from
11
+ * the server and both UIs alike.
12
+ */
13
+ export declare function serverKey(workspaceId: string, serverId: string): string;
@@ -0,0 +1,55 @@
1
+ import type { ServerStatus } from './contracts.js';
2
+ /**
3
+ * The measurements that belong to a running process, and to nothing else.
4
+ *
5
+ * `responseMs` and `resources` are one run's numbers: the last health probe's latency, and the
6
+ * last CPU/RSS sample of that process tree. A viewer is told to read them as *now*, so an entry
7
+ * that is not running has no reading — not a stale one.
8
+ *
9
+ * The panel clears them when a process ends, but a **newer UI is served against an older panel**
10
+ * (the documented upgrade rule), and a panel before this release kept them across a stop of an
11
+ * adopted successor. The verdict is on the wire beside the number, so the UI gates on that rather
12
+ * than trusting the fields' presence — the same rule the unhealthy duration follows.
13
+ *
14
+ * The input is **structural** rather than `ServerView`: `noc-console` builds its rows from a
15
+ * locally-decoded frame whose `config` is looser than the contract's, and demanding the full type
16
+ * would push a cast into every call site.
17
+ *
18
+ * `portState` is deliberately not here: whether the *port* is occupied outlives the process that
19
+ * used it (a stop leaves the occupancy probe meaningful), which is why the panel keeps taking it
20
+ * while stopped.
21
+ */
22
+ export interface LiveReadings {
23
+ /** The last probe's latency in milliseconds, or null when nothing is running. */
24
+ responseMs: number | null;
25
+ cpuPercent: number | null;
26
+ rssBytes: number | null;
27
+ processes: number | null;
28
+ }
29
+ /** What the predicate needs: the verdict, plus the two readings whose lifetime it decides. */
30
+ export interface ReadingSource {
31
+ status: ServerStatus;
32
+ responseMs?: number | null;
33
+ resources?: {
34
+ cpuPercent?: number | null;
35
+ rssBytes?: number | null;
36
+ processes?: number | null;
37
+ } | null;
38
+ }
39
+ /** The live readings of one entry, absent rather than stale once its process is gone. */
40
+ export declare function liveReadings(server: ReadingSource): LiveReadings;
41
+ /**
42
+ * The same reading summed across several entries — a workspace's own total.
43
+ *
44
+ * An aggregate is a reading of the *set*, so it inherits the set's absence: if one entry has no
45
+ * sample the total is `null`, never the other entries' sum. `OverviewView` summed a workspace's CPU
46
+ * with `?? 0` and printed `0.0% cpu now`, so a workspace whose only server had just started — the
47
+ * first sampling window has no window to measure yet — claimed a measured `0.0%`. That is the
48
+ * fabricated idle process the predicate above exists to prevent, in the one number that summarises
49
+ * every entry at once, and it was the same shape for process memory.
50
+ *
51
+ * An empty list is a genuine `0`: nothing is running, and the surface beside it says so. A member
52
+ * that honestly measured `0` also survives, because `0` is a number and only a missing one is
53
+ * absent.
54
+ */
55
+ export declare function sumReadings(servers: ReadingSource[], field: keyof LiveReadings): number | null;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The address a *browser* should open for a server entry.
3
+ *
4
+ * The panel builds `ServerView.url` from its own view of the network: for a `lan` bind that is this
5
+ * machine's LAN address (`displayHost` → `lanAddress`). Someone who reached the panel over a public
6
+ * hostname or a tunnel — `http://box.example:4999` — has no route to `192.168.1.20:4991`, so every
7
+ * "open server" link was dead for exactly the users the bind was opened for. Only the browser knows
8
+ * the name that reached the panel, so the swap happens here, in the one module both UIs read.
9
+ *
10
+ * The entry's own address is kept unless the swap is *provably* right:
11
+ *
12
+ * - a `lan` bind (`0.0.0.0`) listens on every interface, so whatever name reached the panel also
13
+ * reaches the entry, on the entry's own port;
14
+ * - any other bind is reachable at that address and nowhere else. A specific IP must be kept, and
15
+ * rewriting a loopback entry would turn "not reachable from here" into a link to the panel;
16
+ * - and if the page itself is loopback the viewer is on this machine, where the LAN address is
17
+ * already the right answer.
18
+ *
19
+ * The scheme and the entry's port are never touched: a server port is plain HTTP whatever the panel
20
+ * is served over, and the port belongs to the entry.
21
+ */
22
+ /** The fields this reads off a `ServerView`; narrowed so a test needs no whole view. */
23
+ export interface ServerLinkSource {
24
+ /** The panel-computed address, or `null` when the entry has no port. */
25
+ url: string | null;
26
+ /** The address the entry actually binds: `127.0.0.1` for `local`, `0.0.0.0` for `lan`, else the IP. */
27
+ bindHost: string;
28
+ }
29
+ /** True for a name a browser resolves to this machine: `localhost`, `127.0.0.0/8`, `::1`. */
30
+ export declare function isLoopbackHost(host: string): boolean;
31
+ /**
32
+ * `url`, with this machine's own address replaced by the hostname the page was reached at — but only
33
+ * when the entry listens on every interface and the viewer is not already on this machine. Anything
34
+ * it must not rewrite comes back unchanged, and so does a `url` it cannot parse: a reachable address
35
+ * is better than a link pointing at nothing.
36
+ */
37
+ export declare function browserServerUrl(server: ServerLinkSource, pageHost: string): string | null;
38
+ /**
39
+ * The hostname this page was reached at, or `''` where there is no location (a test, or a render that
40
+ * never reaches a browser). Read through a narrowed `globalThis` so this module keeps the server
41
+ * package's non-DOM type surface — it is compiled by both `tsconfig`s.
42
+ */
43
+ export declare function pageHostname(): string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A plain object, and nothing else: not `null`, and not an array.
3
+ *
4
+ * Every untyped boundary here narrows to this shape, and it lived as **nine** definitions across
5
+ * `src/` and the UIs: seven strict (one an inline ternary rather than a named function, which is why
6
+ * a search for the name found only some of them) and two — both UIs' `lib/api.ts` — that accepted an
7
+ * array.
8
+ *
9
+ * The `!Array.isArray` half is the one that matters: `typeof [] === 'object'` is true, so without
10
+ * it an array narrows to a record and reading a property off it silently yields `undefined`
11
+ * instead of failing — and iterating it with `Object.entries` yields the *indices*.
12
+ *
13
+ * The two loose copies happened to behave the same on the payloads they see, but only by accident
14
+ * of which properties they read. They use this one now, so the next reader does not have to work
15
+ * that out.
16
+ */
17
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
@@ -0,0 +1,20 @@
1
+ import type { SessionView } from './contracts.js';
2
+ /**
3
+ * What a UI does once the browser has given up on an event stream.
4
+ *
5
+ * `EventSource` reports only "it failed", never the status. The panel ends a stream whose credential
6
+ * stopped being valid (a sign-out, a password change), and the browser's retry then meets a 401 and
7
+ * gives up — so the UI has to find out why. A signed-out session goes to the login view. A 401 that
8
+ * signing in cannot fix (`LocalOnlyError`: no password in force and this caller is not the panel's
9
+ * machine) ends the retries with the panel's message instead of reconnecting forever. Anything else
10
+ * — the panel restarting, a dropped network — reconnects.
11
+ */
12
+ export type StreamRecovery = {
13
+ action: 'retry';
14
+ } | {
15
+ action: 'login';
16
+ } | {
17
+ action: 'refused';
18
+ message: string;
19
+ };
20
+ export declare function streamRecovery(fetchSession: () => Promise<SessionView>, probe: () => Promise<unknown>): Promise<StreamRecovery>;
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Formatting both UIs share, so a fix lands once instead of in two copies.
3
+ *
4
+ * Only the genuinely identical functions live here: `formatBytes`, `formatBytesShort` and
5
+ * `formatDateTime` differ between the products on purpose (signatures, thresholds, locale options)
6
+ * and stay where they are.
7
+ *
8
+ * The relative-time functions take **words**. The rule (which unit, which threshold, the
9
+ * backwards-clock clamp) belongs here; the words do not, because `src/shared/` may not import a
10
+ * UI's i18n. A caller that ships one language passes nothing and gets the English it always got.
11
+ */
12
+ /** A 0–1 ratio as a percentage. Unknown reads as an em-dash, never the literal `NaN%`. */
13
+ export declare function formatRatio(value: number | null): string;
14
+ /** Wall-clock time, 24-hour, in the host locale. */
15
+ export declare function formatClock(ts: number): string;
16
+ /** The unit a span counts in. `s`/`m`/`h`/`d` keep the call sites free of a translated word. */
17
+ export type DurationUnit = 's' | 'm' | 'h' | 'd';
18
+ /**
19
+ * The words the relative-time formatters put around a measurement.
20
+ *
21
+ * Each takes the raw value and unit rather than a pre-rendered fragment, so a caller can reach for
22
+ * `Intl.RelativeTimeFormat` — which knows each language's word order, plurals and abbreviations —
23
+ * instead of concatenating translated pieces.
24
+ */
25
+ export interface DurationWords {
26
+ /** A span as its two largest units: `1h 30m`. `tail` is null for a single unit. */
27
+ span: (value: number, unit: DurationUnit, tail: {
28
+ value: number;
29
+ unit: DurationUnit;
30
+ } | null) => string;
31
+ /** The moment has arrived. */
32
+ now: () => string;
33
+ /** A forward countdown: `in 4s`. */
34
+ ahead: (value: number, unit: 's' | 'm') => string;
35
+ /** A moment in the past: `12s ago`. */
36
+ ago: (value: number, unit: DurationUnit) => string;
37
+ /** No such moment ever happened. */
38
+ never: () => string;
39
+ }
40
+ /** A span as its two largest units: `1h 30m`, `2d 3h`. Unknown or negative reads as an em-dash. */
41
+ export declare function formatDuration(ms: number, words?: DurationWords): string;
42
+ /** A **forward** countdown to an expiry: a moment already past clamps to `now`, never negative. */
43
+ export declare function relativeFrom(ts: number, now: number, words?: DurationWords): string;
44
+ /** How long ago, coarsely. `null` is "never", and a backwards clock clamps to `0s ago`. */
45
+ export declare function formatAgo(ts: number | null, now: number, words?: DurationWords): string;
46
+ /**
47
+ * A millisecond setting, shown to a person in **seconds**.
48
+ *
49
+ * The config stores `ms` because that is what a timer is; nothing about it is worth retyping, and
50
+ * changing it would be a migration for no gain. But a person never thinks "1200000" — every field
51
+ * whose floor is a second or more (`sessionTtlMs` 60s, `lockoutMs` 1s, the vitals `intervalMs` 5s,
52
+ * the notification `cooldownMs`, and the DDNS check interval) is edited in seconds and converted
53
+ * here, once, rather than at eight call sites.
54
+ *
55
+ * Rounding is deliberate: a value stored as `1500` reads `2s`, and only a *change* writes, so
56
+ * simply visiting a page cannot rewrite a config that was fine.
57
+ */
58
+ export declare function msToSeconds(ms: number): number;
59
+ /** The inverse: whole seconds back to the milliseconds the config stores. */
60
+ export declare function secondsToMs(seconds: number): number;
61
+ /**
62
+ * Whole seconds back to milliseconds, or `fallbackMs` when the box decided nothing.
63
+ *
64
+ * A seconds box is `:value`/`@input` by necessity — that is what carries the conversion — so its
65
+ * read-back is hand-written, and `Number('')` is `0`: a *decided* value. For a field whose floor is
66
+ * a minute that is a save the schema refuses (`sessionTtlMs must be at least 60000 (was 0)`); for
67
+ * the notification throttle, whose off sentinel is also `0`, it silently disables it. Neither is
68
+ * what clearing a box to retype means, so a blank or unreadable one keeps the value the field
69
+ * already held — the same answer `repairNumbers` gives a `v-model` box.
70
+ *
71
+ * `0` stays `0`: both callers treat it as a real setting.
72
+ */
73
+ export declare function secondsToMsOr(seconds: number | null | undefined, fallbackMs: number): number;
74
+ /**
75
+ * The seconds an input's raw value reports, with `NaN` for "nothing decided".
76
+ *
77
+ * Takes the raw `value` rather than the event so this stays free of the DOM: `src/shared` builds
78
+ * for the panel as well, whose typecheck has no `lib.dom`.
79
+ */
80
+ export declare function readSeconds(raw: unknown): number;
81
+ /**
82
+ * Whether a field is shown in seconds.
83
+ *
84
+ * Decided by the schema's floor, not per call site: below a second (`health.timeoutMs` starts at
85
+ * 100 ms, `intervalMs` at 500) a seconds box would round away the only values the field accepts, so
86
+ * those stay in `ms`. A field whose floor is 1000 or more has no meaningful sub-second value, which
87
+ * is what makes the conversion safe to apply.
88
+ */
89
+ export declare function shownInSeconds(minMs: number): boolean;