home-hosted 0.13.0 → 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-CZcVca2a.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-pKbGCW9d.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-B-Eu0sFW.js → nanny-BWh7nuvv.js} +21 -14
  64. package/dist/chunks/nanny-BWh7nuvv.js.map +1 -0
  65. package/dist/chunks/{nanny-ChMtq1Zl.js → nanny-BjF2-1pv.js} +3 -3
  66. package/dist/chunks/{nanny-ChMtq1Zl.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-DErnlPY1.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-B8WBTRMk.js → port-CnsrxKNR.js} +27 -71
  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-Des4DrAN.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-BtWMFmzZ.js → src-BnzkVy_M.js} +12548 -10576
  112. package/dist/chunks/src-BnzkVy_M.js.map +1 -0
  113. package/dist/chunks/{status-DT1EsA-B.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-Pdz-l6IH.js → up-BQSnYxYd.js} +47 -53
  138. package/dist/chunks/up-BQSnYxYd.js.map +1 -0
  139. package/dist/chunks/{usage-DFrCVXpT.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-CZcVca2a.js.map +0 -1
  405. package/dist/chunks/backups-CFRaWe_m.js +0 -4691
  406. package/dist/chunks/backups-CFRaWe_m.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-log-BVj8cDEo.js +0 -241
  411. package/dist/chunks/daemon-log-BVj8cDEo.js.map +0 -1
  412. package/dist/chunks/daemon-qKVECISl.js +0 -247
  413. package/dist/chunks/daemon-qKVECISl.js.map +0 -1
  414. package/dist/chunks/docker-Cy9Lyvda.js.map +0 -1
  415. package/dist/chunks/down-pKbGCW9d.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-B-Eu0sFW.js.map +0 -1
  430. package/dist/chunks/nanny-BtWfy0QH.js +0 -1167
  431. package/dist/chunks/nanny-BtWfy0QH.js.map +0 -1
  432. package/dist/chunks/nanny-sweep-DErnlPY1.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-B8WBTRMk.js.map +0 -1
  437. package/dist/chunks/restart-Des4DrAN.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-Bge2r2qQ.js +0 -169
  442. package/dist/chunks/server-Bge2r2qQ.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-obPiEJYk.js +0 -78
  448. package/dist/chunks/set-token-obPiEJYk.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-BtWMFmzZ.js.map +0 -1
  454. package/dist/chunks/status-DT1EsA-B.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-Pdz-l6IH.js.map +0 -1
  462. package/dist/chunks/usage-DFrCVXpT.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
package/docs/SERVERS.md CHANGED
@@ -4,12 +4,9 @@ Every supervised process is one entry in a **workspace**'s `servers.config.json`
4
4
  `$HHOSTED_HOME/.hh/<workspace-id>/servers.config.json`, default `~/.home-hosted/.hh/default/…`.
5
5
  Add it with **➕ Add server** in the panel, or write it by hand — the panel writes the same file.
6
6
 
7
- <sub>A workspace is the ownership boundary: its servers, secrets, logs and nanny state are its own (a
8
- **nanny** is the small supervisor a `persistent` entry runs under — this same CLI in a hidden mode —
9
- so the entry outlives the panel; see [Persistent entries](#persistent-entries)).
10
- Pick one in the header; the workspace's server defaults and log retention sit in
11
- **Workspace Settings**. Panel-wide things (listener, auth, TLS, host vitals, backups, UI) stay in
12
- **Global settings**.</sub>
7
+ <sub>A workspace owns its servers, secrets, logs and nanny state. Pick one in the header; its server
8
+ defaults and log retention are in **Workspace Settings**. Panel-wide things (listener, auth, TLS, host
9
+ vitals, backups, UI) are in **Global settings**.</sub>
13
10
 
14
11
  ```json
15
12
  {
@@ -26,134 +23,59 @@ Pick one in the header; the workspace's server defaults and log retention sit in
26
23
 
27
24
  Relative paths resolve against the directory you ran `home-hosted` from, so a project can keep its
28
25
  servers and its state together. **A service manager starts you somewhere else:** systemd uses `/`
29
- unless the unit sets `WorkingDirectory=`, and `docker run` does too without `-w`. Every relative
30
- `cwd`, `{projectDir}` and `dataEnvs` then points under `/`, and the entry fails to start. Pin the
31
- base with `--project`, `$HHOSTED_PROJECT`, or the unit's `WorkingDirectory=`.
26
+ unless the unit sets `WorkingDirectory=`, and so does `docker run` without `-w` — every relative `cwd`,
27
+ `{projectDir}` and `dataEnvs` then points under `/`. Pin the base with `--project`, `$HHOSTED_PROJECT`,
28
+ or the unit's `WorkingDirectory=`.
32
29
 
33
- ## Presets
34
-
35
- The add-server panel offers a gallery — Minecraft, Jellyfin, a Node app, a Python file server, Gitea,
36
- MongoDB, Docker Compose, a chat bot. Picking one **fills the form**; it creates nothing you cannot edit
37
- afterwards, and no preset is required to add a server.
38
-
39
- A preset is only a starting point, so two things to check:
40
-
41
- - **The port is what the panel probes, not always what the program binds.** Node, Python, Gitea and
42
- MongoDB take the form's port (`{port}`, in `args` or `env`). Three cannot: Minecraft reads
43
- `server-port` from `server.properties`, Jellyfin reads `network.xml`, and a compose stack publishes
44
- what its file says — for those the port only moves the probe, so set it to the port the program
45
- actually uses. The bot has no port at all, so it has no probe.
46
- - **The working directory matters.** Python's `http.server` serves the working directory; Minecraft
47
- needs it set to the folder holding `server.jar`. The preset description names what to point it at.
48
-
49
- ## Orphaned processes
50
-
51
- **A supervised server outlives the panel.** The child runs in its own process group, so nothing here
52
- signals it when the panel dies, and its output goes to a **file the child holds open and the panel
53
- reads back afterwards** rather than down a pipe the panel owns. That second half is what makes the
54
- survival real: a pipe's read end *is* the panel, so killing the panel closes it and the child's next
55
- write would fail and take the process with it. A file the child owns cannot be closed by anyone else,
56
- so a server that keeps writing keeps running.
57
-
58
- The panel keeps a handle per entry — `.hh/<workspace>/.state/<id>.run.json`, keyed by the id the
59
- child was started under — and uses it to **adopt** that child on the next boot, with its pid, start
60
- time and process-group identity intact. Surviving a panel death is therefore normal and handled, not
61
- a defect.
62
-
63
- An **orphan** is the case that handle cannot cover: an entry **renamed** or **removed** while its
64
- process is still running, with the panel **not running** at the time, leaves that process with no
65
- entry to own it. It keeps running, holding its port and its resources, and nothing else in the panel
66
- lists it. (Edit the config while the panel *is* up and it handles the change directly — it stops that
67
- entry and reclaims its state, rather than orphaning it.)
68
-
69
- **Servers** shows those: a warning above the list names each id, its pid and when it started, with a
70
- **Stop it** button. The state file is kept until the process is actually gone, so a survivor of
71
- `SIGKILL` — of the panel or of the server — is still findable on the next boot. There is no automatic
72
- kill: a pid whose identity the platform cannot confirm is exactly what the rest of this file refuses
73
- to signal on a guess.
74
-
75
- ## Where a server's output goes
76
-
77
- Two files per entry, in the workspace's state directory: `.hh/<workspace>/.state/<id>.out` and
78
- `<id>.err`, one per stream. The child writes to them itself; the panel reads the bytes back, splits
79
- them into lines and feeds the log, the Logs page and SSE from there — so a server's output reaches
80
- you exactly as before, whichever of the two wrote it.
81
-
82
- They are **transport, not history**, and are treated as such: not served to a browser, not counted
83
- against `logs.keep`, not included in a backup, and deleted with the entry. Do not put them in a
84
- backup path or expect them to survive a restore — `.logs/<id>.log` is the file to keep.
30
+ A scheduled command is a [job](./JOBS.md), not a server: an entry carrying `kind` or `schedule` is
31
+ refused. To bring in a pm2 or compose setup, use `home-hosted import`
32
+ ([CLI.md](./CLI.md#coming-from-pm2-or-compose)); what it cannot carry (pm2's `watch`, `cron_restart`,
33
+ cluster mode) is reported by name, and a compose stack becomes one entry.
85
34
 
86
- <sub>A `persistent` entry does not use these files: its output goes through the **nanny**, which owns
87
- the child's pipes and writes the log directly. That is safe because the nanny's lifetime is the
88
- entry's, not the panel's.</sub>
89
-
90
- ### A server that outruns the reader
91
-
92
- A file never slows a writer down the way a pipe does, so a server can write faster than the panel
93
- reads. It is bounded, and the bounds are worth knowing before you see them:
94
-
95
- - **An 8 MB file is emptied once it has been fully read.** Nothing is lost — every byte was already
96
- delivered to the log before the file is truncated, and a half-written line continues into the
97
- child's next write. This is invisible in normal use.
98
- - **A writer faster than the reader can drain is throttled by dropping.** Past a backlog of
99
- `max(8 MB, 256 KiB)` the oldest unread bytes go, the cut is moved forward to the next **line
100
- boundary** so the gap is whole lines rather than a torn one, and the entry's own log says so: `the
101
- server wrote faster than the panel could read it — N KiB of its output was dropped`. That line is
102
- the point — a silent drop is the failure this exists to avoid — but it does mean a genuinely
103
- firehose-level server can show those lines in its log instead of every line it wrote. A line the
104
- server had not finished writing when the gap began is discarded rather than completed, so a
105
- fragment is never spliced onto the first surviving line.
106
- - **One rare write window.** A byte written in the instant between the panel measuring the file and
107
- emptying it is lost unread. It is one small window per 8 MB of output, and only for a child writing
108
- at that exact moment.
109
-
110
- The panel reads at most 256 KiB per stream per pass, four times a second — roughly 1 MB/s each for
111
- stdout and stderr — while the drop path needs an 8 MB backlog, so a server has to sustain output near
112
- that rate to reach it. That is far more than a normal home service writes. If the lines do appear on
113
- a server that is not meant to be that loud, read them as a symptom: something is in a log loop.
114
-
115
- ## `PATH`, and the program an entry runs
35
+ ## Field reference
116
36
 
117
- `command` resolves against the environment the **panel** was started with, not your shell's. Under
118
- systemd, a container, or a `sudo` that reset the environment, that `PATH` is often shorter than the
119
- one you tested with — so every entry fails at once with:
37
+ | field | what it does |
38
+ | --- | --- |
39
+ | `id`, `label` | `id` is lowercase letters, digits, `-` and `_`, unique within the workspace; `label` is the display name (defaults to the id) |
40
+ | `command`, `args`, `cwd` | what to run. **`command` is a program, not a command line** — it is spawned with no shell, so write `"command": "node", "args": ["server.js"]`, not `"node server.js"`. `cwd` defaults to `.`. [Placeholders](#placeholders) expand in `args`, `env`, `dataEnvs`, `backupPaths` and the hook args; `command`, `cwd` and `envFile` are literal, so `cwd: "~/app"` is not your home directory |
41
+ | `enabled` | `true` (default). `false` keeps the entry but refuses to start it, stops it if running, and leaves a disabled `persistent` entry unattached at boot |
42
+ | `autostart` | `false` (default). `true` starts it when the panel comes `up` |
43
+ | `env`, `envFile`, `dataEnvs` | environment. `envFile` is a `KEY=value` file (relative to `cwd`) that keeps secrets out of the config; a BOM or UTF-16 from a Windows editor is fine. `dataEnvs` is `NAME: path` — exported to the process **and** backed up, so a data directory is declared once. Precedence, lowest first: `env` < `envFile` < `dataEnvs` < `secretEnv` |
44
+ | `secretEnv` | the **names** of secret variables; the values live in the workspace's `.secrets.json` (0600) — see [Secret environment](#secret-environment) |
45
+ | `port`, `bind` | `port` enables the readiness wait, health checks and the conflict preflight. With no port the entry reads `running` once its process exists, and a command that cannot start shows `crashed` with the reason. `bind` is `local` (`127.0.0.1`, default), `lan` (`0.0.0.0`) or one IPv4 address of this machine, exposed to the program as `{host}` |
46
+ | `onPortConflict` | `block` (default), `warn`, `follow`, `reclaim` or `kill` — see [A busy port](#a-busy-port) |
47
+ | `persistent` | `false` (default). Run it under its own nanny so it survives the panel — see [Persistent entries](#persistent-entries) |
48
+ | `health.enabled`, `health.mode` | on by default; `port` (TCP connect, default) or `http`. `intervalMs` 5000, `timeoutMs` 1500, `startTimeoutMs` 20000 (the readiness wait after spawn) |
49
+ | `health.http.*` | `path` (`/`), `method` (`GET` or `HEAD` — a `HEAD` has no body, so a body check is skipped with a warning), `expectStatus` (exact, 100–599) or `expectStatusBelow` (default 400), `expectBody` (a substring), `scheme` (`http` or `https` for a backend serving TLS itself) and `allowInvalidCert` (accept a self-signed certificate; off by default) |
50
+ | `health.unhealthyThreshold`, `health.forceRestartAfterMs` | failed probes in a row before the card warns (default 3), and how long unhealthy before a forced restart — default `0`, which **never** fires. Forced restarts are bounded by `restart.maxRetries`, after which the entry is stopped with the reason on its card. A start that never answers within `startTimeoutMs` counts as a full failed streak |
51
+ | `restart.*` | `enabled` (true), `maxRetries` (3), `baseDelayMs` (1000), `factor` (2), `maxDelayMs` (30000), `resetAfterMs` (60000: alive this long resets the counter). The spent budget is kept on disk, so a crash loop cannot outlast `maxRetries` by outliving the panel |
52
+ | `stop.*` | `signal` (`SIGTERM`, `SIGINT` or `SIGKILL`; default `SIGTERM`), `killGroup` (true), `graceMs` (5000, before SIGKILL), `killPortHolders` (false; sweep a leftover listener) |
53
+ | `dependsOn` | ids that must be healthy first. `stop-all`/`down` stop dependents before their dependencies; stopping **one** server does not cascade (the log names any dependent left running). In a cycle neither waits |
54
+ | `logBufferLines` | lines of live output kept in memory for the Logs page (50–100000, default 500). The file on disk is bounded by the workspace's `logs.maxBytes` / `logs.keep`; lowering `keep` deletes rotations above it |
55
+ | `resources.maxRssBytes` | restart when the process tree — or a compose stack's containers, summed — grows past this (`0`, the default, disables). It also acts on an adopted process |
56
+ | `bootstrap` | one command run before the first start (migrations, warmups): `command`, `args`, `env`, `timeoutMs` (120000), `runOnce` (true: once per `up`) |
57
+ | `deploy` | what "update this service" means — see [Deploying](#deploying) |
58
+ | `dump`, `load` | database hooks around a backup — see [Dumping a database for backups](#dumping-a-database-for-backups) |
59
+ | `backupPaths`, `backupIgnoreGenerated` | extra paths this entry owns, included in backups; the flag (on by default) skips `node_modules`, `dist`, `.next` and framework caches inside them. A symlink inside a declared path that leads outside it is not followed — declare the target instead |
60
+
61
+ ### Secret environment
62
+
63
+ An `envFile` beside the code is **not** in a backup, so a move to a new machine silently loses it.
64
+ `secretEnv` puts the **names** in the config and the **values** in the workspace's `.secrets.json`
65
+ (0600), which a backup's secrets carry:
120
66
 
121
- ```text
122
- `node` was not found — is it installed, and is it on PATH for the user running the panel?
67
+ ```json
68
+ { "id": "app", "command": "node", "args": ["server.js"], "secretEnv": ["DATABASE_URL", "SESSION_KEY"] }
123
69
  ```
124
70
 
125
- The panel itself always has Node (it *is* Node), but a child inherits `PATH`, not that fact. Three
126
- ways out, in order of preference:
127
-
128
- - **Point `command` at an absolute path** — `/usr/bin/node`, or a version manager's shim. The most
129
- portable answer, and the one that survives a unit file you did not write.
130
- - **Set `PATH` in `env`** for the entries that need it — that entry's scope, which is usually honest.
131
- - **Fix the unit or container** — systemd takes `Environment=PATH=…`, docker takes `ENV PATH=…`. The
132
- right fix when *everything* fails, because the next entry will hit it too.
71
+ Set a value with `home-hosted secret set app DATABASE_URL` ([CLI.md](./CLI.md#secret-environment)) or
72
+ in the entry's config page. A name is `^[A-Za-z_][A-Za-z0-9_]*$` and may not repeat.
133
73
 
134
- A whole command line in `command` is a different mistake with its own message: `"node server.js"`
135
- asks for a program of that name, because `command` is spawned with no shell.
136
-
137
- ## Field reference
138
-
139
- | field | what it does |
140
- | --- | --- |
141
- | `command`, `args`, `cwd` | what to run. `{placeholders}` resolve in `args` only (`env`, `dataEnvs`, `backupPaths` and `bootstrap.args` too); `command`, `cwd` and `envFile` are used literally, so `cwd: "~/app"` is not a home directory. **`command` is a program, not a command line** — it is spawned with no shell, so `"node server.js"` asks for a program of that name; write `"command": "node", "args": ["server.js"]` |
142
- | `env`, `dataEnvs`, `envFile` | environment; `dataEnvs` also marks data directories for backups, `envFile` keeps secrets out of the config. The env file is yours to write — `KEY=value`, one per line — and it is read whatever a Windows editor saved: a byte-order mark or UTF-16 is decoded, not refused |
143
- | `enabled` | `true` (default) starts it; `false` keeps the entry in the config but refuses to start it, stops it if it is running, and leaves a disabled `persistent` entry unattached at boot |
144
- | `port`, `bind` | `port` enables the readiness wait, health checks and the conflict preflight. `bind` is `local` (`127.0.0.1`, the default), `lan` (`0.0.0.0`, every interface) or one IPv4 address of this machine — a Wi-Fi or VPN address, say — exposed to the program as `{host}` |
145
- | `onPortConflict` | `block` (default), `warn`, `follow`, `reclaim`, or `kill` — see below |
146
- | `persistent` | run it under its own nanny so it survives the panel — see below |
147
- | `health.mode` | `port` (TCP connect) or `http` (path, expected status, expected body — a `HEAD` carries no body, so it is warned about and the body check is skipped) |
148
- | `health.http.scheme`, `health.http.allowInvalidCert` | `http` (default) or `https` for a backend that serves TLS itself; the second accepts a self-signed certificate, which is the usual case on a home network. A certificate is verified unless you say otherwise |
149
- | `health.unhealthyThreshold`, `forceRestartAfterMs` | how many consecutive failed probes (default 3) before the card warns, and when to restart anyway — `forceRestartAfterMs` defaults to `0`, which **never** fires, so a forced restart is opt-in. When set, it is bounded by `restart.maxRetries`, after which the entry is stopped rather than restarted forever, with the reason left on its card |
150
- | `restart.*` | backoff: `maxRetries`, `baseDelayMs`, `factor`, `maxDelayMs`, `resetAfterMs` — the spent budget is remembered on disk, so a crash loop cannot outlast `maxRetries` by outliving the panel |
151
- | `stop.*` | `signal`, `killGroup`, `graceMs`, and `killPortHolders` to sweep a leftover listener |
152
- | `dependsOn` | ids that must be healthy first. `stop-all`/`down` stop dependents before their dependencies; stopping **one** server does not cascade — the log names any dependent it left running. In a cycle (`a` → `b` → `a`) neither waits on the other |
153
- | `logBufferLines` | how many lines of live output the panel keeps in memory per entry (50–100000, default 500). The file on disk is separate: this is the buffer the Logs page streams from. The disk side is the **workspace's** `logs.maxBytes` / `logs.keep` in Workspace Settings — `keep` is a hard bound on `.hh/<workspace>/.logs`: it is how many rotations stay beside `<id>.log`, the Logs page reads all of them, and lowering it deletes the ones above the new ceiling. The raw transport files a child writes to first are separate again — [Where a server's output goes](#where-a-servers-output-goes) |
154
- | `resources.maxRssBytes` | restart when the process tree — or, for a compose entry, the summed containers — grows past a limit. It acts on an adopted process too (`follow`, or a persistent entry reattached to its nanny), not only on one the panel spawned |
155
- | `bootstrap` | one command to run once before the first start (migrations, warmups) |
156
- | `backupPaths`, `backupIgnoreGenerated` | extra paths this entry owns, included in backups; the flag (on by default) skips the known build and dependency directories inside them — `node_modules`, `dist`, `.next`, framework caches. A symlink inside a declared path that resolves outside it is not followed — declare the target as its own path instead |
74
+ - The secret wins over every other layer for its variable.
75
+ - **Only declared names are passed**, so a removed entry's leftover values never reach a process.
76
+ - Values never appear in the config, a log, history or an error
77
+ ([SECURITY.md](./SECURITY.md#a-servers-secret-environment-never-enters-its-config)).
78
+ - Changing `secretEnv` needs a restart; the view says so through `restartRequired`.
157
79
 
158
80
  ### Placeholders
159
81
 
@@ -163,22 +85,20 @@ asks for a program of that name, because `command` is spawned with no shell.
163
85
  | `{port}` | its configured port, empty when it has none |
164
86
  | `{bind}` `{host}` `{displayHost}` | `local`/`lan`/an address; the address it binds (`127.0.0.1`, `0.0.0.0`); the address to *show* (`127.0.0.1`, the LAN IP) |
165
87
  | `{lanIp}` | this machine's LAN address, or `127.0.0.1` |
166
- | `{cwd}` | the entry's working directory (its `cwd`, else the project directory) |
88
+ | `{cwd}` | the entry's resolved working directory |
167
89
  | `{projectDir}` | where you ran `home-hosted` (or `--project`) — `$HHOSTED_PROJECT` |
168
90
  | `{dataRoot}` | the state directory — `$HHOSTED_HOME`, default `~/.home-hosted` |
169
91
  | `{home}` | the current user's home directory |
92
+ | `{dumpDir}` | in `dump`/`load` only: the directory the backup carries |
170
93
 
171
- Unknown placeholders stay visible instead of silently becoming empty, and `${VAR}` reads from the
172
- environment (including `envFile`). Every supervised process also gets `HHOSTED_SERVER_ID` and
173
- `HHOSTED_CONTROL_PORT`, so a service can tell which entry it is and how to reach the panel.
174
-
175
- `dataEnvs` is the one that pays for itself twice: the value is exported to the process *and* the path
176
- is picked up by Backups, so a data directory is declared once.
94
+ An unknown placeholder stays visible rather than becoming empty, and `${VAR}` reads from the panel's
95
+ environment (including `envFile`). Every process also gets `HHOSTED_SERVER_ID` and
96
+ `HHOSTED_CONTROL_PORT`, so a service knows which entry it is and how to reach the panel.
177
97
 
178
98
  ### Dumping a database for backups
179
99
 
180
- Copying a database's data directory while it runs gives a torn copy. For anything with a real engine,
181
- declare `dump` and `load` so the backup is taken by the engine itself:
100
+ Copying a running database's data directory gives a torn copy. Declare `dump` and `load` so the engine
101
+ writes the backup itself:
182
102
 
183
103
  ```json
184
104
  {
@@ -190,16 +110,13 @@ declare `dump` and `load` so the backup is taken by the engine itself:
190
110
  }
191
111
  ```
192
112
 
193
- `{dumpDir}` is a directory the panel creates and the archive carries. Both hooks see the same path,
194
- so `dump` writes there and `load` reads from there. Same shape as `bootstrap`: one program plus args,
195
- never a shell string.
113
+ `{dumpDir}` is created by the panel and carried by the archive; both hooks see the same path. Each hook
114
+ is one program plus `args` (never a shell string), with optional `env` and `timeoutMs` (default 10
115
+ minutes).
196
116
 
197
- - **A failed `dump` refuses the backup.** An archive that looks complete is worse than no archive.
198
- - `load` runs after the files are restored, and its entry's data directory is restored first.
199
- - Both have `timeoutMs`, default 10 minutes, and `env`. Both UIs edit the hooks on the entry's
200
- config page, with the timeout in seconds.
201
-
202
- Verified pairs, one per engine:
117
+ - **A failed `dump` refuses the backup** — an archive that looks complete is worse than none.
118
+ - `load` runs after the files are restored, once the entry answers on its port. An entry with no port
119
+ waits `waitMs` (default 2 s) instead — raise it for a slow database.
203
120
 
204
121
  | engine | `dump` | `load` |
205
122
  | --- | --- | --- |
@@ -209,121 +126,145 @@ Verified pairs, one per engine:
209
126
  | Redis | `redis-cli --rdb {dumpDir}/dump.rdb` | `command: "cp"`, `args: ["{dumpDir}/dump.rdb", "<dir>/dump.rdb"]`, with Redis stopped |
210
127
  | SQLite | `sqlite3 {dbPath} ".backup '{dumpDir}/db.sqlite'"` | `cp {dumpDir}/db.sqlite {dbPath}` |
211
128
 
212
- Redis and SQLite prefer a file copy over a hook when the server is stopped anyway, which is what a
213
- migration looks like. The hooks earn their place for a database you cannot stop, or whose dump needs a
214
- login you keep in `env`.
129
+ For Redis and SQLite a plain file copy with the server stopped is usually simpler; the hooks earn their
130
+ place for a database you cannot stop.
215
131
 
216
132
  ### The "open server" link
217
133
 
218
- An entry with a `port` gets a link in the UI, and **it follows the hostname you are reading the panel
219
- at** whenever the entry binds `lan`. The panel's own report of a `lan` entry is this machine's LAN
220
- address (`http://192.168.1.20:4991`) — true, but unreachable from outside that LAN, which is exactly
221
- where a public hostname or a tunnel puts you. Reading the panel at `http://box.example:4999` therefore
222
- links to `http://box.example:4991`.
134
+ An entry with a `port` gets a link in the UI. For a `lan` entry the link uses **the hostname you are
135
+ reading the panel at**, so `http://box.example:4999` links to `http://box.example:4991` rather than an
136
+ unreachable LAN address. The port and the `http` scheme are always the entry's own. A `local` or
137
+ specific-IP entry keeps its reported address.
138
+
139
+ ## Presets
140
+
141
+ The add-server panel offers a gallery — Minecraft, Jellyfin, a Node app, a Python file server, Gitea,
142
+ MongoDB, Docker Compose, a chat bot. A preset only **fills the form**. Two things to check:
143
+
144
+ - **The port is what the panel probes, not always what the program binds.** Node, Python, Gitea and
145
+ MongoDB take the form's port (`{port}`). Minecraft reads `server.properties`, Jellyfin reads
146
+ `network.xml`, and a compose stack publishes what its file says — set the port to what the program
147
+ actually uses. The bot has no port, so no probe.
148
+ - **The working directory matters.** Python's `http.server` serves it; Minecraft needs the folder
149
+ holding `server.jar`.
150
+
151
+ ## Deploying
152
+
153
+ A `deploy` block is an ordered list of steps, run in the entry's working directory with its
154
+ environment, then a restart:
155
+
156
+ ```json
157
+ {
158
+ "id": "web",
159
+ "command": "node",
160
+ "args": ["server.js"],
161
+ "deploy": {
162
+ "steps": [
163
+ { "command": "git", "args": ["pull"] },
164
+ { "command": "pnpm", "args": ["install"] },
165
+ { "command": "pnpm", "args": ["build"] }
166
+ ],
167
+ "restart": true
168
+ }
169
+ }
170
+ ```
171
+
172
+ Run it with `home-hosted deploy <id>`, **Deploy** on the card, or `POST /api/servers/:id/deploy`; all
173
+ three wait for the outcome.
174
+
175
+ - **A failed step stops the sequence** and **leaves the running process alone** — the card says it is
176
+ still the previous version, and the failure is recorded and notified like a crash.
177
+ - **One at a time.** A second call answers `409 DEPLOY_RUNNING`. Stopping the server cancels a deploy
178
+ (the step's process group is killed).
179
+ - A step's `cwd` resolves against the entry's own. Its `timeoutMs` (default 5 minutes) kills a hung
180
+ step. `restart` defaults to `true`.
223
181
 
224
- The entry's port and scheme never change: a server port is plain HTTP whatever the panel is served
225
- over, and the port belongs to the entry. Two cases keep the reported address instead, because both are
226
- already correct: a `local` (or specific-IP) entry, which is reachable only at that address, and a
227
- viewer already on the machine via `localhost`.
182
+ The editor shows one step per line (`command arg arg`) and keeps a step's `cwd` and `timeoutMs` for a
183
+ line you did not change.
184
+
185
+ ## `PATH`, and the program an entry runs
186
+
187
+ `command` resolves against the environment the **panel** was started with. Under systemd, a container
188
+ or a `sudo` that reset the environment, that `PATH` is often shorter than your shell's, and every entry
189
+ fails with:
190
+
191
+ ```text
192
+ `node` was not found — is it installed, and is it on PATH for the user running the panel?
193
+ ```
194
+
195
+ Fixes, best first: use an **absolute path** in `command` (`/usr/bin/node`); set `PATH` in the entry's
196
+ `env`; or fix the unit/container (`Environment=PATH=…`, `ENV PATH=…`) when everything fails.
228
197
 
229
198
  ## A busy port
230
199
 
231
- Preflight runs before every start, so two servers cannot silently fight over one port.
200
+ A preflight runs before every start, so two servers cannot silently fight over one port.
232
201
 
233
- | `onPortConflict` | what happens when something already listens |
202
+ | `onPortConflict` | when something already listens |
234
203
  | --- | --- |
235
- | `block` *(default)* | the entry goes to **conflict** with `port 4000 is already in use (pid 4242)`, and does not start |
236
- | `warn` | it starts anyway — useful when the listener is a leftover you are replacing |
237
- | `follow` | if the listener is a **detached restart of this same entry**, the panel adopts it as-is; anything else blocks, exactly like `block` |
238
- | `reclaim` | same detection, but it stops that successor and starts a fully supervised process of its own |
239
- | `kill` | stops **whatever holds the port** — no ownership test — then starts. The blunt one: see below |
204
+ | `block` *(default)* | the entry goes to **conflict** (`port 4000 is already in use (pid 4242)`) and does not start |
205
+ | `warn` | it starts anyway |
206
+ | `follow` | adopts a **detached restart of this same entry**; anything else blocks |
207
+ | `reclaim` | stops such a restart and starts a supervised process of its own; anything else blocks |
208
+ | `kill` | stops **whatever holds the port**, then starts — see [The `kill` policy](#the-kill-policy) |
209
+
210
+ **A port held by a server this panel supervises is never adopted or killed**, in any workspace. The
211
+ refusal names the workspace and entry to stop:
212
+
213
+ ```text
214
+ port 7021 is held by pid 2505354, which this panel supervises on media-box/photos —
215
+ stop that server instead
216
+ ```
217
+
218
+ The same rule applies to **Free port**, `free-port` and `stop.killPortHolders`.
240
219
 
241
220
  ### Docker and compose
242
221
 
243
- A compose stack is a supervised entry like any other — `command: docker`, `args: ["compose","up"]`,
244
- `cwd` the directory holding `compose.yml`. The foreground form streams every container's log into
245
- the entry and a stop takes the stack down. Set `port` to the port the compose file publishes; that
246
- published port is the health probe.
222
+ A compose stack is one entry: `command: docker`, `args: ["compose","up"]`, `cwd` the directory holding
223
+ `compose.yml`, and `port` the published port (that is the health probe). The foreground form streams
224
+ every container's log, and a stop takes the stack down.
247
225
 
248
226
  ```json
249
227
  { "id": "blog", "command": "docker", "args": ["compose", "up"], "cwd": "./blog", "port": 8080 }
250
228
  ```
251
229
 
252
- `docker compose up -d` is not an entry: it exits as soon as the containers start, so there is nothing
253
- left to supervise, and the entry backs off against the stack it just started. Drop the `-d`.
254
-
255
- **Stop and `down` end the containers, not just the wrapper.** A stack outlives a reboot, a
256
- `compose up -d` from a shell, and a panel crash, so the entry's server may be running with nothing of
257
- the panel's holding it. Stopping that entry — the Stop button, `stop-all`, `down` — stops its
258
- containers through docker and then lists them again: if one is still up, the entry reports a
259
- **conflict** naming it instead of claiming it stopped. The stack is attributed the same way the
260
- metrics are (the project, else the compose file's directory), so another stack on the box is never
261
- touched.
262
-
263
- If the panel finds **this entry's own** stack already up at boot or at start (a reboot with
264
- `restart: unless-stopped`, a `compose up -d` run by hand) it cannot adopt it through the wrapper.
265
- It says so, and `onPortConflict: "warn"` starts the entry anyway so the panel supervises it from
266
- then on. Under the default `block` the page names the container and leaves it alone.
267
-
268
- **CPU and RSS are the containers', summed.** A compose entry is measured through `docker stats` over
269
- the project's own containers, so a busy stack reads busy and `resources.maxRssBytes` acts on the
270
- memory the containers actually use. Containers are attributed by compose's own labels — the project
271
- name, else the compose file the containers recorded — never by "every container on the machine".
272
-
273
- - Only when `command` **is** docker (with `compose`, or `docker-compose`). A shell that starts docker
274
- keeps the process-tree reading of that shell.
275
- - When docker cannot be asked — daemon down, or nothing of the project running — the entry falls back
276
- to the wrapper's reading. A stack with no reading shows as no reading, never `0`.
277
-
278
- A published port belongs to a root-owned `docker-proxy`, so it has no pid this process may signal.
279
- The panel asks docker instead and names the container. Both ways of freeing a port — the **Free
280
- port** button and `onPortConflict: kill` — then stop that container through docker, needing no
281
- privileges beyond the socket you already have. Under `block` the entry is reported and the message
282
- names the stack to stop.
283
-
284
- From a shell it is `home-hosted free-port <id>` (or `start <id> --free-port` to free and start in one
285
- go); a script driving the HTTP API calls `POST /api/servers/:id/free-port?workspace=<id>` with the
286
- API token, which is the route the button itself uses.
230
+ - **Drop `-d`.** `docker compose up -d` exits at once, leaving nothing to supervise.
231
+ - **Stop and `down` end the containers**, then list them again: one still up makes the entry report a
232
+ **conflict** naming it. Containers are attributed by compose's labels (the project, else the compose
233
+ file), so another stack is never touched.
234
+ - **A stack already up** at boot (`restart: unless-stopped`, a manual `up -d`) cannot be adopted. Under
235
+ `block` the page names the container and leaves it; `warn` starts the entry so the panel supervises
236
+ it from then on.
237
+ - **CPU and RSS are the containers', summed**, via `docker stats`, and `resources.maxRssBytes` acts on
238
+ that — only when `command` is docker (`compose` or `docker-compose`). With docker unreachable the
239
+ wrapper's reading is used; no reading shows as absent, never `0`.
240
+ - **A published port** belongs to a root-owned `docker-proxy`, so the panel asks docker and names the
241
+ container. **Free port** and `kill` stop that container through docker.
242
+
243
+ From a shell: `home-hosted free-port <id>`, or `start <id> --free-port`; over HTTP,
244
+ `POST /api/servers/:id/free-port?workspace=<id>`.
287
245
 
288
246
  ### When a program restarts itself
289
247
 
290
- Some programs restart themselves by launching a new detached process and exiting — a plugin doing an
291
- update, a `re-exec` on config change. The panel used to see the successor's port as a conflict and sit
292
- there blocked while the service was actually up.
293
-
294
- Every process gets `HHOSTED_SERVER_ID` in its environment and a successor inherits it, so the preflight
295
- can tell a successor from a stranger — read from `/proc` on Linux and `ps -E` on macOS. **Windows
296
- cannot read another process's environment**, so there the entry's own argv answers instead: a process
297
- holding the port is the successor when its image and its arguments are both the entry's own. That
298
- fallback also covers a Linux or macOS program that restarted itself in a way that dropped the marker.
299
- Two policies act on the result:
248
+ Some programs restart by launching a detached successor and exiting (a self-update, a re-exec on
249
+ config change). Every process gets `HHOSTED_SERVER_ID`, which a successor inherits, so the preflight
250
+ can tell it from a stranger (read from `/proc` on Linux, `ps -E` on macOS). **Windows cannot read
251
+ another process's environment**, so there — and as a fallback elsewhere — a holder is the successor
252
+ when its image and its arguments both match the entry's own, literally.
300
253
 
301
254
  | policy | what it does | trade-off |
302
255
  | --- | --- | --- |
303
- | `follow` | adopts the successor: pid, health probe, CPU/RSS, stop, and it starts its own process again when the successor exits | **keeps exactly what the program set up**, but its output is not captured — the pipe belongs to whoever spawned it, so that entry's log in the panel goes quiet |
304
- | `reclaim` | stops the successor, then starts a fully supervised process of its own | **full features** — live logs, resources, stop semantics all behave like any other entry — at the cost of one restart |
305
-
306
- Identification is deliberately strict, because `reclaim` kills what it identifies: the image has to be
307
- the entry's resolved command **and** the arguments have to be the entry's own, compared literally — an
308
- argument sharing a basename with another program's is not a match. When **more than one** holder
309
- matches, the panel refuses to guess and blocks, naming the pids. These are the cases that still block
310
- rather than being identified:
311
-
312
- - a successor that re-execs under a **different image**, or rewrites its own arguments;
313
- - an argument read back ambiguously — on macOS `ps` joins argv with spaces, so an argument that itself
314
- contains a space cannot be told from two arguments;
315
- - a Windows entry launched through an `npm`/`pnpm` **`.cmd` shim**: the shim runs under `cmd.exe`, so
316
- the process actually holding the port is `node.exe` and its argv never mentions the shim;
317
- - a Windows entry whose `CommandLine` PowerShell cannot read.
256
+ | `follow` | adopts the successor: pid, health probe, CPU/RSS, stop, and a fresh start when it exits | keeps what the program set up, but its **output is not captured** |
257
+ | `reclaim` | stops the successor and starts a supervised process | full logs and stop semantics, at the cost of one restart |
318
258
 
319
- `kill` exists precisely for those cases: it does not need to identify anything.
259
+ Both show the entry as **detached** while adopted. These still block rather than being identified:
320
260
 
321
- Both are shown as **detached** in the panel while adopted, both can be stopped and restarted like any
322
- other entry, and neither will ever start a second copy on top of a **stranger**: that still blocks,
323
- exactly like `block`.
261
+ - more than one matching holder (the pids are named);
262
+ - a successor under a **different image**, or one that rewrites its arguments;
263
+ - on macOS, an argument containing a space (`ps` joins argv with spaces);
264
+ - on Windows, an `npm`/`pnpm` **`.cmd` shim** (the port holder is `node.exe`), or a `CommandLine`
265
+ PowerShell cannot read.
324
266
 
325
- If the holder is ours under a different policy, the conflict message says so, which is how the setting
326
- is discovered:
267
+ `kill` covers those. When the holder is your own restart under another policy, the message says so:
327
268
 
328
269
  ```text
329
270
  port 4374 is already in use (pid 912) — pid 912 is a detached restart of this entry:
@@ -331,213 +272,145 @@ set onPortConflict to "follow" to adopt it, "reclaim" to replace it with a super
331
272
  or "kill" to stop whatever holds the port
332
273
  ```
333
274
 
334
- **A port held by a server this panel supervises is never adopted or killed.** That covers another
335
- workspace — a server id is only unique inside its workspace, but the process is the panel's, so the
336
- panel checks every workspace before it treats a listener as a stranger — and any entry in your own. The
337
- refusal names the workspace and entry to go and stop, because a pid alone does not say which row to
338
- click, and another workspace's server is not on the page you are looking at:
275
+ ### An entry with no port that outlived the panel
339
276
 
340
- ```text
341
- port 7021 is held by pid 2505354, which this panel supervises on media-box/photos —
342
- stop that server instead
343
- ```
277
+ With no port there is nothing to preflight, so every spawn also records the child's pid and start
278
+ time, checked before the next spawn:
344
279
 
345
- The same rule reaches `free-port` and `stop.killPortHolders`: a port is never freed from under a server
346
- this panel runs.
280
+ - alive, born when the record says, and carrying `HHOSTED_SERVER_ID` → adopted;
281
+ - **gone** → the run is reported as ended (at boot, as a crash with the reason), then the start
282
+ proceeds;
283
+ - alive but its identity cannot be confirmed → refused with the pid named, rather than duplicated.
284
+ Stop that pid, or use `persistent: true`.
347
285
 
348
- ### An entry with no port that outlived the panel
286
+ ### The `kill` policy
349
287
 
350
- A port is what makes the checks above possible, so an entry with **no port** has none of them — and
351
- that used to be a way to start a server twice. A non-persistent child survives a panel killed hard,
352
- and nothing recorded that it existed: with no port to check, the next boot started a **second copy**
353
- of a server that was already running. For a worker that consumes a queue, a duplicate is the
354
- dangerous kind of failure.
288
+ 1. SIGTERM every listener on the port, escalating to SIGKILL after `stop.graceMs`.
289
+ 2. Wait for the port to be free, then start.
290
+ 3. If it is still held, go to **conflict** with the pids it tried — no retry loop.
355
291
 
356
- Every spawn now also records the child's pid and start time, consulted before spawning:
292
+ It is the one policy that stops a **stranger**, so the log names each pid. It never touches the panel
293
+ or a process the panel supervises. To inspect a leftover first, use **Free port** on the card.
357
294
 
358
- - alive, **born when the record says** (a recycled pid is refused), and carrying `HHOSTED_SERVER_ID`
359
- → adopted, exactly like a successor above;
360
- - **gone** → the record is consumed and the run is **reported as ended**: an exit always, and — at
361
- boot — a crash with the reason. An entry that was running when the panel died and is not there now
362
- is the end of a run nobody was watching, not a clean stop, and it is also not something to start
363
- over silently. The start then proceeds;
364
- - alive but the platform **cannot confirm whose it is** → refused with the pid named, rather than
365
- duplicated. Stop that pid, or use `persistent: true`, which is the supported way to own a portless
366
- process across a panel restart.
295
+ ## Persistent entries
367
296
 
368
- An entry with a `port` is unaffected: its conflict policy stays the only witness.
297
+ `"persistent": true` keeps the entry running whatever happens to the panel — `down`, a restart, or a
298
+ kill. It is off by default and set per entry.
299
+
300
+ The panel runs the entry under a **nanny** (the same CLI in a hidden mode) that owns its pipes and
301
+ writes its log. The panel reattaches to the nanny on the next boot through
302
+ `.hh/<workspace>/.state/<id>.json`.
303
+
304
+ - **`down`, `restart` and `stop-all` leave it running** and say so. An explicit **Stop**, or removing or
305
+ disabling the entry, ends it. The panel's **Stop all** asks (**Ignore** / **With persistent**);
306
+ the API takes `POST /api/servers/stop-all?withPersistent=true`.
307
+ - **`down --with-persistent` / `restart --with-persistent` stop them too**, through the panel when it
308
+ is up, or by signalling each nanny from its state file when it is not. `restart --with-persistent`
309
+ starts them again afterwards, `autostart: false` included.
310
+ - **It is reattached, not restarted** — even with `--no-autostart`.
311
+ - **Logs keep flowing** while the panel is down. A log file is always written for it, even with
312
+ `logs.persist: false` (the Logs page still hides it).
313
+ - **A crash while the panel is away is reported, not restarted**: it shows **crashed** on the next boot
314
+ with the exit code explained (`code 137 (SIGKILL — which the kernel sends when memory runs out)`).
315
+ - **`onPortConflict` applies only when the state file is gone.** A program that restarts itself wants
316
+ `reclaim`, not `follow`: the nanny exits with its child, so `follow` would adopt a successor with no
317
+ log capture.
369
318
 
370
- ### The `kill` policy
319
+ ### What still ends one
371
320
 
372
- `follow` and `reclaim` need to know *whose* port it is. When they cannot answer that — a program that
373
- re-execs under a different image, or two holders that both look like the entry — `kill` skips the
374
- question:
321
+ - **systemd** with the default `KillMode=control-group` kills the whole cgroup, nanny included. Use
322
+ `KillMode=process` to let the panel decide.
323
+ - **A container** stops everything in it, so persistence lasts as long as the container.
375
324
 
376
- 1. SIGTERM every listener on the port, escalating to SIGKILL after `stop.graceMs`.
377
- 2. Wait for the port to actually accept nothing, then start as usual.
378
- 3. If the port is somehow still held, the entry goes to **conflict** with the pids it tried —
379
- it does **not** retry in a loop.
325
+ `down` forces the panel only after the slowest configured stop has had its time (between 20 s and 10
326
+ minutes), and even then ends only the panel's own pid — so a persistent entry survives that too.
380
327
 
381
- It is the one policy that will stop a **stranger** whose port you have configured, so the log says
382
- which pids it stopped and why. It will not touch the panel itself or any process the panel
383
- supervises: a port held by a sibling entry is a config mistake and still blocks, exactly as it does
384
- under `block`. If it is a stray leftover you would rather inspect first, the **Free port** button on
385
- the server card does the same thing on demand.
328
+ ## Orphaned processes
386
329
 
387
- Because a detached successor is not something the panel supervises, `kill` ends up doing what
388
- `reclaim` does for your own restarted process — stops it and starts a supervised child — without ever
389
- asking whether it was yours. Only `follow` ever adopts, and only `reclaim` will refuse to act on a
390
- holder it cannot prove is yours.
330
+ **Any supervised server outlives the panel being killed.** The child runs in its own process group and
331
+ writes its output to files it holds open, so nothing breaks when the panel dies. The panel keeps a
332
+ handle per entry (`.hh/<workspace>/.state/<id>.run.json`) and **adopts** the child on the next boot.
333
+ What `persistent` adds is surviving the panel's *deliberate* stops.
391
334
 
392
- ## Persistent entries
335
+ An **orphan** is a process whose entry was **renamed or removed while the panel was not running**: it
336
+ keeps running and holding its port with nothing to own it. (Edit the config while the panel is up and
337
+ it stops the old entry itself.) **Servers** shows a warning naming each orphan's id, pid and start time,
338
+ with a **Stop it** button. There is no automatic kill.
339
+
340
+ ## Where a server's output goes
393
341
 
394
- `"persistent": true` means "keep this running whatever happens to the panel". It is off by default,
395
- it is per entry (not a **Workspace Settings → Server defaults** field), and it covers the three ways
396
- the panel can go away: `down`, a restart, or being killed outright.
397
-
398
- <sub>Ordinary entries already survive being *killed* — see [Orphaned processes](#orphaned-processes).
399
- What `persistent` adds is surviving the panel's **deliberate** stops, `down` and `restart` included,
400
- with its output still being captured and its restart policy still the panel's job.</sub>
401
-
402
- How it works: the panel does not run the entry directly. It spawns a **nanny** — the same CLI, hidden
403
- `__nanny` mode — which starts the entry, owns its pipes and writes its output to the entry's own log
404
- file. The nanny is what survives; the panel reattaches to it on the next boot through
405
- `.hh/<workspace>/.state/<id>.json`, and a stale file is how it learns how a child ended while nobody
406
- was watching.
407
-
408
- What that changes:
409
-
410
- - **`down`, `restart` and `stop-all` leave it running** and say so (`2 persistent server(s) left
411
- running: …`). Only an explicit **Stop** on that entry — or removing/disabling it — ends it.
412
- `POST /api/servers/stop-all?withPersistent=true` is the same choice from the API, and the panel's
413
- **Stop all** asks it in a popover — **Ignore** leaves them running, **With persistent** ends them.
414
- - **`down --with-persistent` (and `restart --with-persistent`) stop them as well.** That is the
415
- flag's whole job, and it works in both situations: with the panel up the stop goes through it, so
416
- the entry gets its log line, history and health recorded like a click in the UI; with the panel
417
- already gone each nanny is signalled directly from its `.state` record, which is what makes the
418
- flag usable after a crash. `restart --with-persistent` starts them back afterwards, including
419
- entries marked `autostart: false` that `up` alone would leave stopped.
420
- - **It is reattached, not restarted.** `--no-autostart` still starts nothing, but a persistent entry
421
- that is already running is adopted, because leaving it unmanaged would make the panel treat its own
422
- server as a stranger on the port.
423
- - **Logs keep flowing.** The panel tails the nanny's file, so history survives the panel being down;
424
- `logs.persist: false` still keeps it out of the Logs page — but a file has to exist in the
425
- workspace's `.logs/`, because there is no pipe to carry the output.
426
- - **A crash while the panel is away is reported, not restarted.** Retries and backoff remain the
427
- panel's job, so an entry that dies with nobody watching shows up as **crashed** on the next boot
428
- with the reason in its log — the exit code, explained when it has a conventional meaning
429
- (`code 137 (SIGKILL — which the kernel sends when memory runs out)`), because that is the one an
430
- operator would otherwise have to look up. `home-hosted status` prints the directory those files
431
- live in, and names the `<id>.log` convention once there is one to read.
432
- - **Port policies still apply, as a fallback.** A persistent entry reattaches from its state file
433
- before any preflight runs, so `onPortConflict` matters only when that state is gone — and `follow`
434
- is then the policy that adopts instead of blocking.
435
- - **A program that restarts itself wants `reclaim`, not `follow`.** The nanny lives exactly as long
436
- as the child it owns: when that child exits to hand over to a successor, the nanny exits too, and
437
- nothing is left writing the entry's log — `follow` would adopt the successor with no capture at
438
- all. `reclaim` stops it and starts a fresh nanny, which is both the log and the persistence back.
342
+ When an entry crashes or is backing off, its card and detail page quote the last lines the failed run
343
+ wrote to stderr under the crash summary, with a link to the full output.
439
344
 
440
- ### What still ends one
345
+ Two files per entry, `.hh/<workspace>/.state/<id>.out` and `<id>.err`. The child writes them; the panel
346
+ reads them back into the log, the Logs page and SSE. They are **transport, not history**: not served,
347
+ not counted by `logs.keep`, not backed up, and deleted with the entry. The file to keep is
348
+ `.logs/<id>.log`. A `persistent` entry skips them — its nanny writes the log directly.
349
+
350
+ ### A server that outruns the reader
351
+
352
+ The panel reads up to 256 KiB per stream four times a second (about 1 MB/s), and empties a file once it
353
+ has reached 8 MB and been fully read. A server that sustains more than that falls behind; past an 8 MB
354
+ backlog the oldest unread whole lines are dropped, with a line in the entry's log:
355
+ `the server wrote faster than the panel could read it — N KiB of its output was dropped`. A home
356
+ service seeing that is usually stuck in a log loop.
357
+
358
+ ## Editing fields
359
+
360
+ A save from the panel is validated, atomic, and sends only the fields you changed. A cleared number box
361
+ keeps its value rather than becoming `0`. If the entry changed elsewhere while you were editing, the
362
+ page keeps your edits and saves only them.
441
363
 
442
- The panel is not the only thing that can sweep a process off a machine. A persistent entry is a
443
- normal process, so it is still subject to:
364
+ Hand edits to the file (an editor, `git checkout`, config management) are picked up within a couple of
365
+ seconds:
444
366
 
445
- - **systemd**, when the panel runs as a unit with the default `KillMode=control-group` — stopping the
446
- unit kills everything in its cgroup, nanny included. Use `KillMode=process` if you want the panel's
447
- own lifecycle to be the only thing that decides.
448
- - **A container.** Docker stops everything in the container's PID namespace, so persistence means the
449
- panel's lifetime inside that container, not the host's.
367
+ - **A changed definition** takes effect on that entry's next start; a running process is not restarted.
368
+ - **An added entry** appears, but nothing starts it until the next `up` (if `autostart`) — the same
369
+ for the panel, the API and `home-hosted add` ([CLI.md](./CLI.md#declaring-servers)). A duplicate id
370
+ is refused (`409 SERVER_EXISTS`). **A removed entry** is stopped and forgotten.
371
+ - **A file that does not parse or fails the schema** is reported with its path, and the running config
372
+ is kept until you fix it.
373
+ - **A lowered `logs.keep`** deletes rotations above it, as it would from the panel.
374
+ - **The panel-wide `.hh/settings.json`** is watched too. A new `control.host` or `port` waits for a
375
+ restart; a revision that does not parse, or would newly expose the panel without a secret, is
376
+ logged and not applied.
450
377
 
451
- `down` forces the panel only once it has outlived the slowest configured stop (its `stop.graceMs`, plus
452
- a compose stack's `docker stop`, plus a margin; between 20s and 10 minutes), and even then it ends the
453
- panel's own pid alone, on Windows too — a persistent entry survives the forced path.
454
- `--with-persistent` stops each nanny by pid, so it ends them on either path — and
455
- `restart --with-persistent` has to stop them for real, because `up` reattaches to a nanny that is
456
- still alive.
378
+ A panel save never overwrites an edit it has not read: if the file changed on disk, the save is refused
379
+ (`409 CONFIG_CHANGED_ON_DISK`), the panel reloads, and you save again. While the file is unusable,
380
+ every save is refused the same way. A UTF-8 BOM or UTF-16LE (common from Windows tools) is read fine.
457
381
 
458
382
  ## CPU temperature where the OS exposes none
459
383
 
460
- The Host vitals tile reads **n/a** when the machine offers no sensor. That is not a failure of the
461
- panel: on a WSL2 guest the kernel exposes no `thermal_zone*` at all, `/sys/class/hwmon` is empty, and
462
- the Windows-side ACPI zone answers a constant 20 °C whatever the load — so there is nothing honest to
463
- report. macOS and plain Windows behave the same way.
384
+ The Host vitals tile reads **n/a** when the machine offers no sensor — typical on WSL2 (no
385
+ `thermal_zone*`, empty `/sys/class/hwmon`), macOS and plain Windows.
464
386
 
465
- If your hardware does have a sensor, give the panel a command that prints it. **Global settings →
466
- Host → Temperature command** (or `host.tempCommand` in `settings.json`) runs on every sample and takes
467
- the first plausible °C number from its stdout; empty means "use the built-in probe". `tempCommandTimeoutMs`
468
- (default 5000) kills a helper that hangs.
387
+ If your hardware has a sensor, give the panel a command that prints it: **Global settings → Host →
388
+ Temperature command** (`host.tempCommand` in `settings.json`). It runs on every sample and takes the
389
+ first plausible °C number from stdout; empty uses the built-in probe, which you should keep wherever it
390
+ works. `tempCommandTimeoutMs` (default 5000) kills a helper that hangs.
469
391
 
470
392
  ### WSL2
471
393
 
472
- A WSL2 guest cannot read the sensor; the Windows host can, through
473
- [LibreHardwareMonitor](https://github.com/LibreHardwareMonitor/LibreHardwareMonitor). One command
474
- does the setup:
394
+ The Windows host can read the sensor through
395
+ [LibreHardwareMonitor](https://github.com/LibreHardwareMonitor/LibreHardwareMonitor):
475
396
 
476
397
  ```bash
477
398
  home-hosted setup-temp --wsl
478
399
  ```
479
400
 
480
- It writes a PowerShell helper, offers the ~6 MB download, points `host.tempCommand` at the helper, and
481
- prints the reading. Nothing reaches the config until the helper answers. The same is one button on
482
- **Global settings → Host vitals**, shown only on WSL.
401
+ It writes a PowerShell helper, offers the ~6 MB download, and points `host.tempCommand` at the helper
402
+ only once it answers. **Global settings → Host vitals** has the same button on WSL.
483
403
 
484
404
  | flag | what it does |
485
405
  | --- | --- |
486
406
  | *(none)* | reports whether a source is set, and lists the options |
487
407
  | `--wsl` | writes the helper and offers the download |
488
- | `--wsl --download` / `--wsl --no-download` | install without asking / never install |
489
- | `--clear` | stop using it and delete the helper |
490
-
491
- `--download` and `--no-download` modify `--wsl`; either one alone is refused rather than ignored, so a
492
- script cannot read a successful exit as "installed". `--clear` is refused beside them, because the two
493
- ask for opposite things.
494
-
495
- It installs into `%ProgramData%\home-hosted`, not `%LOCALAPPDATA%`: a boot-started panel runs as SYSTEM
496
- in session 0, where the per-user path differs and the library would be invisible. Installing there may
497
- ask for elevation.
498
-
499
- The PowerShell call costs a few hundred milliseconds per sample, so raise `host.intervalMs` to 15–30 s.
500
- The value is the host's CPU, which the guest shares — measured 63.9 °C idle and 75.2 °C under load on a
501
- NucBox EVO-X1, where every built-in path returned a constant 20 °C.
502
-
503
- > [!NOTE]
504
- > Where the panel *can* read a sensor, leave `Temperature command` empty — it overrides the probe.
505
-
506
- ## Editing fields
507
-
508
- Changes from the panel are atomic and validated before they are written, and a save sends only the
509
- fields you changed. If the entry changes elsewhere while its config page holds unsaved edits, the
510
- page keeps your edits and says so; saving then writes only them, never back over the other change.
511
- A number box you clear keeps its current value rather than becoming `0`.
512
-
513
- Editing the file by hand —
514
- an editor, a `git checkout`, a config-management tool — is picked up within a couple of seconds, no
515
- restart needed:
516
-
517
- - **A definition you changed** takes effect on that entry's next start; a running process is not
518
- restarted under you.
519
- - **A definition you added** appears (and starts itself if it is `autostart`); **one you removed** is
520
- stopped and forgotten.
521
- - **A file the schema rejects, or one that cannot be parsed**, is reported in the panel with the
522
- exact path and the running config is left alone. Fix it and it reloads on its own — a typo never
523
- stops a server.
524
-
525
- - **A lowered `logs.keep`** deletes the rotations above it on the next reload, the same as saving it
526
- in the panel. Both edit one file, so both mean the same thing.
527
- - **The panel-wide `.hh/settings.json`** (listener, host vitals, backups, proxy — what
528
- `home-hosted setup-temp` writes) is watched the same way. A new `control.host` or `port` waits for a
529
- restart, as it does when saved in the panel. A revision that cannot be parsed, or one that would
530
- newly expose the panel without a password, is not applied: the panel logs why and keeps the
531
- settings it was running.
532
-
533
- A save from the panel never overwrites an edit it has not read yet: if the file changed on disk since
534
- the panel last loaded it, the save is refused (`409 CONFIG_CHANGED_ON_DISK`), the panel reloads the
535
- file, and saving again applies your change on top of the edit. While the file on disk is one the
536
- panel could not use — it does not parse, fails the schema, or was refused for exposing the panel —
537
- every save from the panel is refused the same way, naming the problem, so your edit is never
538
- replaced: fix or revert it, and the next save builds on it.
539
-
540
- Whatever encoding your editor puts on the file is fine. A UTF-8 **byte-order mark** (Notepad's
541
- "UTF-8 with BOM", PowerShell 5.1's `Set-Content -Encoding UTF8`) and the **UTF-16LE** that
542
- `Out-File` and `>` write on Windows are both read as the JSON they hold, so the panel only ever
543
- complains about the JSON itself.
408
+ | `--wsl --download` / `--wsl --no-download` | install without asking / never install (either without `--wsl` is refused) |
409
+ | `--clear` | stop using it, and delete the helper when this home's command runs it (refused beside the others) |
410
+
411
+ - It installs into `%ProgramData%\home-hosted`, which may ask for elevation.
412
+ - **The panel must run elevated (Administrator) for CPU temperature**: otherwise the sensor reads `0`,
413
+ which the panel reports as "LibreHardwareMonitor needs administrator rights".
414
+ - Each sample costs a few hundred milliseconds, so raise `host.intervalMs` to 15–30 s.
415
+ - A helper left by an earlier setup under another Windows account may be undeletable from WSL; the
416
+ error names the elevated `Remove-Item` command to run.