home-hosted 0.13.1 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (485) hide show
  1. package/README.md +117 -322
  2. package/bin/home-hosted.mjs +41 -0
  3. package/dist/chunks/account-DiLrSyww.js +359 -0
  4. package/dist/chunks/account-DiLrSyww.js.map +1 -0
  5. package/dist/chunks/add-DEIYVkNK.js +183 -0
  6. package/dist/chunks/add-DEIYVkNK.js.map +1 -0
  7. package/dist/chunks/{archive-DP-XQR8X.js → archive-DFi3qK1c.js} +25 -73
  8. package/dist/chunks/archive-DFi3qK1c.js.map +1 -0
  9. package/dist/chunks/{atomic-C1PfJpE7.js → atomic-SZUwDtGD.js} +3 -6
  10. package/dist/chunks/atomic-SZUwDtGD.js.map +1 -0
  11. package/dist/chunks/{backup-DeAJ3pbO.js → backup-DnyxIzw0.js} +110 -190
  12. package/dist/chunks/backup-DnyxIzw0.js.map +1 -0
  13. package/dist/chunks/backups-BrrN6cwW.js +2203 -0
  14. package/dist/chunks/backups-BrrN6cwW.js.map +1 -0
  15. package/dist/chunks/bind-DIxrnUst.js +43 -0
  16. package/dist/chunks/bind-DIxrnUst.js.map +1 -0
  17. package/dist/chunks/config-text-DxMOQQnk.js +34 -0
  18. package/dist/chunks/config-text-DxMOQQnk.js.map +1 -0
  19. package/dist/chunks/{contracts-CMBD1TF9.js → contracts-CxZ7u1L3.js} +1239 -1454
  20. package/dist/chunks/contracts-CxZ7u1L3.js.map +1 -0
  21. package/dist/chunks/daemon-BAAYUYQC.js +211 -0
  22. package/dist/chunks/daemon-BAAYUYQC.js.map +1 -0
  23. package/dist/chunks/daemon-log-Ccu-69vB.js +179 -0
  24. package/dist/chunks/daemon-log-Ccu-69vB.js.map +1 -0
  25. package/dist/chunks/deploy-CggSOEkq.js +144 -0
  26. package/dist/chunks/deploy-CggSOEkq.js.map +1 -0
  27. package/dist/chunks/{docker-Cy9Lyvda.js → docker--Un0uLfF.js} +32 -68
  28. package/dist/chunks/docker--Un0uLfF.js.map +1 -0
  29. package/dist/chunks/{down-C59ne5aM.js → down-CpIN7LEQ.js} +34 -94
  30. package/dist/chunks/down-CpIN7LEQ.js.map +1 -0
  31. package/dist/chunks/exposure-CDJNvOCK.js +229 -0
  32. package/dist/chunks/exposure-CDJNvOCK.js.map +1 -0
  33. package/dist/chunks/import-Bd4VZH0f.js +205 -0
  34. package/dist/chunks/import-Bd4VZH0f.js.map +1 -0
  35. package/dist/chunks/import-plan--fDS_l5r.js +147 -0
  36. package/dist/chunks/import-plan--fDS_l5r.js.map +1 -0
  37. package/dist/chunks/import-write-BTfbeV26.js +42 -0
  38. package/dist/chunks/import-write-BTfbeV26.js.map +1 -0
  39. package/dist/chunks/{init-BZ7hK9Vf.js → init-Bv3oH65x.js} +14 -50
  40. package/dist/chunks/init-Bv3oH65x.js.map +1 -0
  41. package/dist/chunks/job-CYOdN6Ub.js +341 -0
  42. package/dist/chunks/job-CYOdN6Ub.js.map +1 -0
  43. package/dist/chunks/jobs-BX4ahcfh.js +489 -0
  44. package/dist/chunks/jobs-BX4ahcfh.js.map +1 -0
  45. package/dist/chunks/last-stop-DD3lHwo_.js +42 -0
  46. package/dist/chunks/last-stop-DD3lHwo_.js.map +1 -0
  47. package/dist/chunks/layout-D0ysDNav.js +18 -0
  48. package/dist/chunks/layout-D0ysDNav.js.map +1 -0
  49. package/dist/chunks/lazy-kfcBNeqj.js +48 -0
  50. package/dist/chunks/lazy-kfcBNeqj.js.map +1 -0
  51. package/dist/chunks/log-buffer-B7jmn7ts.js +110 -0
  52. package/dist/chunks/log-buffer-B7jmn7ts.js.map +1 -0
  53. package/dist/chunks/log-files-CZL2UhuE.js +488 -0
  54. package/dist/chunks/log-files-CZL2UhuE.js.map +1 -0
  55. package/dist/chunks/{logger-B5U4GD3j.js → logger-BnrKTBHQ.js} +2 -6
  56. package/dist/chunks/logger-BnrKTBHQ.js.map +1 -0
  57. package/dist/chunks/{logs---TI_bxM.js → logs-DxKI6OW2.js} +23 -73
  58. package/dist/chunks/logs-DxKI6OW2.js.map +1 -0
  59. package/dist/chunks/ls-BseUHy_m.js +128 -0
  60. package/dist/chunks/ls-BseUHy_m.js.map +1 -0
  61. package/dist/chunks/migrate-D4w_dXDm.js +268 -0
  62. package/dist/chunks/migrate-D4w_dXDm.js.map +1 -0
  63. package/dist/chunks/{nanny-rewguyXg.js → nanny-BWh7nuvv.js} +21 -14
  64. package/dist/chunks/nanny-BWh7nuvv.js.map +1 -0
  65. package/dist/chunks/{nanny-Dnun3hVB.js → nanny-BjF2-1pv.js} +3 -3
  66. package/dist/chunks/{nanny-Dnun3hVB.js.map → nanny-BjF2-1pv.js.map} +1 -1
  67. package/dist/chunks/nanny-DGTXVq5d.js +806 -0
  68. package/dist/chunks/nanny-DGTXVq5d.js.map +1 -0
  69. package/dist/chunks/{nanny-sweep-ClVuNJRo.js → nanny-sweep-hjmZ_p7S.js} +14 -24
  70. package/dist/chunks/nanny-sweep-hjmZ_p7S.js.map +1 -0
  71. package/dist/chunks/{nearest-6KgQEDUe.js → nearest-DOx4jySJ.js} +2 -10
  72. package/dist/chunks/nearest-DOx4jySJ.js.map +1 -0
  73. package/dist/chunks/{parse-DhmG26fI.js → parse-DVMPLUDe.js} +47 -72
  74. package/dist/chunks/parse-DVMPLUDe.js.map +1 -0
  75. package/dist/chunks/password-policy-Clq6PGE-.js +9 -0
  76. package/dist/chunks/password-policy-Clq6PGE-.js.map +1 -0
  77. package/dist/chunks/{paths-CGlGDrOU.js → paths-C34-TJLh.js} +32 -56
  78. package/dist/chunks/paths-C34-TJLh.js.map +1 -0
  79. package/dist/chunks/{port-k5VBw8t9.js → port-CnsrxKNR.js} +23 -70
  80. package/dist/chunks/port-CnsrxKNR.js.map +1 -0
  81. package/dist/chunks/process-CboOFPU_.js +192 -0
  82. package/dist/chunks/process-CboOFPU_.js.map +1 -0
  83. package/dist/chunks/{restart-BYu_E7x5.js → restart-C0J8dZ2L.js} +11 -29
  84. package/dist/chunks/restart-C0J8dZ2L.js.map +1 -0
  85. package/dist/chunks/run-deploy-DoNDvwT4.js +91 -0
  86. package/dist/chunks/run-deploy-DoNDvwT4.js.map +1 -0
  87. package/dist/chunks/{schema-B240VXcV.js → schema-CZ6f-PHD.js} +7 -20
  88. package/dist/chunks/schema-CZ6f-PHD.js.map +1 -0
  89. package/dist/chunks/secret-MY397r90.js +219 -0
  90. package/dist/chunks/secret-MY397r90.js.map +1 -0
  91. package/dist/chunks/secrets-CG5N4lwY.js +1061 -0
  92. package/dist/chunks/secrets-CG5N4lwY.js.map +1 -0
  93. package/dist/chunks/server-Dm_dXfTW.js +255 -0
  94. package/dist/chunks/server-Dm_dXfTW.js.map +1 -0
  95. package/dist/chunks/server-attention-UQwYXqKe.js +10 -0
  96. package/dist/chunks/server-attention-UQwYXqKe.js.map +1 -0
  97. package/dist/chunks/server-create-D7nvhgBd.js +96 -0
  98. package/dist/chunks/server-create-D7nvhgBd.js.map +1 -0
  99. package/dist/chunks/server-ids-BEQD2rFz.js +23 -0
  100. package/dist/chunks/server-ids-BEQD2rFz.js.map +1 -0
  101. package/dist/chunks/server-vars-DMYmHutL.js +27 -0
  102. package/dist/chunks/server-vars-DMYmHutL.js.map +1 -0
  103. package/dist/chunks/service-C8l-ewNA.js +585 -0
  104. package/dist/chunks/service-C8l-ewNA.js.map +1 -0
  105. package/dist/chunks/{settings-xu-XTfWg.js → settings-CtYDs5PX.js} +62 -78
  106. package/dist/chunks/settings-CtYDs5PX.js.map +1 -0
  107. package/dist/chunks/{setup-temp-CAN4_bA-.js → setup-temp-TAtDmMMU.js} +43 -37
  108. package/dist/chunks/setup-temp-TAtDmMMU.js.map +1 -0
  109. package/dist/chunks/shape-CDGeYl_J.js +9 -0
  110. package/dist/chunks/shape-CDGeYl_J.js.map +1 -0
  111. package/dist/chunks/{src-BOBh9MBf.js → src-BnzkVy_M.js} +12547 -10578
  112. package/dist/chunks/src-BnzkVy_M.js.map +1 -0
  113. package/dist/chunks/{status-B6f2-qhs.js → status-efbbfYZQ.js} +53 -26
  114. package/dist/chunks/status-efbbfYZQ.js.map +1 -0
  115. package/dist/chunks/store-Bs_Lljjm.js +2082 -0
  116. package/dist/chunks/store-Bs_Lljjm.js.map +1 -0
  117. package/dist/chunks/template-xan58bJh.js +28 -0
  118. package/dist/chunks/template-xan58bJh.js.map +1 -0
  119. package/dist/chunks/token-DDeWfZA4.js +142 -0
  120. package/dist/chunks/token-DDeWfZA4.js.map +1 -0
  121. package/dist/chunks/{ui-D562aqw5.js → ui-BcIAtyxE.js} +68 -79
  122. package/dist/chunks/ui-BcIAtyxE.js.map +1 -0
  123. package/dist/chunks/{ui-dir-CsU3uLNV.js → ui-dir-ClCzVRc3.js} +3 -7
  124. package/dist/chunks/ui-dir-ClCzVRc3.js.map +1 -0
  125. package/dist/chunks/ui-format-CDvvqOoi.js +53 -0
  126. package/dist/chunks/ui-format-CDvvqOoi.js.map +1 -0
  127. package/dist/chunks/{ui-release-DKzVvlLd.js → ui-release-XbJ85pYI.js} +36 -38
  128. package/dist/chunks/ui-release-XbJ85pYI.js.map +1 -0
  129. package/dist/chunks/{ui-revert-EkBBwRTt.js → ui-revert-Dgawq7ze.js} +4 -4
  130. package/dist/chunks/ui-revert-Dgawq7ze.js.map +1 -0
  131. package/dist/chunks/{ui-switch-BnZTdMDd.js → ui-switch-CfQMbZ0g.js} +31 -38
  132. package/dist/chunks/ui-switch-CfQMbZ0g.js.map +1 -0
  133. package/dist/chunks/{ui-update-_xryLYxw.js → ui-update-B3PPivUm.js} +30 -48
  134. package/dist/chunks/ui-update-B3PPivUm.js.map +1 -0
  135. package/dist/chunks/ui-update-CAiH2tFb.js +109 -0
  136. package/dist/chunks/ui-update-CAiH2tFb.js.map +1 -0
  137. package/dist/chunks/{up-DNZuTi2q.js → up-BQSnYxYd.js} +47 -53
  138. package/dist/chunks/up-BQSnYxYd.js.map +1 -0
  139. package/dist/chunks/{usage-BrnDARNM.js → usage-KG8TeOio.js} +7 -20
  140. package/dist/chunks/usage-KG8TeOio.js.map +1 -0
  141. package/dist/chunks/{workspaces-DYcfvKV_.js → workspaces-D9akpzU8.js} +80 -68
  142. package/dist/chunks/workspaces-D9akpzU8.js.map +1 -0
  143. package/dist/chunks/{wsl-temperature-BiCI4iK6.js → wsl-temperature-D-_d4Yk1.js} +47 -42
  144. package/dist/chunks/wsl-temperature-D-_d4Yk1.js.map +1 -0
  145. package/dist/cli.js +306 -238
  146. package/dist/cli.js.map +1 -1
  147. package/dist/client.js +76 -29
  148. package/dist/client.js.map +1 -1
  149. package/dist/types/api/acme.d.ts +3 -7
  150. package/dist/types/api/auth/$.routes.d.ts +107 -16
  151. package/dist/types/api/backups.d.ts +5 -5
  152. package/dist/types/api/control.d.ts +747 -38
  153. package/dist/types/api/ddns.d.ts +13 -18
  154. package/dist/types/api/events.d.ts +9 -3
  155. package/dist/types/api/health.d.ts +2 -4
  156. package/dist/types/api/jobs.d.ts +438 -0
  157. package/dist/types/api/logs.d.ts +20 -0
  158. package/dist/types/api/metrics.d.ts +2 -5
  159. package/dist/types/api/notifications.d.ts +3 -6
  160. package/dist/types/api/proxy.d.ts +63 -23
  161. package/dist/types/api/server-ops.d.ts +17 -0
  162. package/dist/types/api/servers/$.routes.d.ts +418 -186
  163. package/dist/types/api/session-required.d.ts +16 -0
  164. package/dist/types/api/settings.d.ts +7 -7
  165. package/dist/types/api/state.d.ts +100 -10
  166. package/dist/types/api/static.d.ts +2 -2
  167. package/dist/types/api/tls.d.ts +2 -5
  168. package/dist/types/api/workspaces/$.routes.d.ts +186 -12
  169. package/dist/types/api/wsl-temperature.d.ts +4 -10
  170. package/dist/types/app.d.ts +4511 -2778
  171. package/dist/types/cli/account.d.ts +23 -0
  172. package/dist/types/cli/add.d.ts +96 -0
  173. package/dist/types/cli/args.d.ts +24 -35
  174. package/dist/types/cli/backup-offline.d.ts +2 -8
  175. package/dist/types/cli/backup.d.ts +12 -21
  176. package/dist/types/cli/down.d.ts +15 -41
  177. package/dist/types/cli/import-plan.d.ts +55 -0
  178. package/dist/types/cli/import-write.d.ts +5 -0
  179. package/dist/types/cli/import.d.ts +86 -0
  180. package/dist/types/cli/io.d.ts +26 -35
  181. package/dist/types/cli/job.d.ts +99 -0
  182. package/dist/types/cli/logs.d.ts +1 -10
  183. package/dist/types/cli/ls.d.ts +57 -0
  184. package/dist/types/cli/migrate.d.ts +31 -8
  185. package/dist/types/cli/nearest.d.ts +1 -9
  186. package/dist/types/cli/run-deploy.d.ts +36 -0
  187. package/dist/types/cli/secret.d.ts +90 -0
  188. package/dist/types/cli/server.d.ts +6 -15
  189. package/dist/types/cli/service.d.ts +135 -0
  190. package/dist/types/cli/setup-temp.d.ts +17 -13
  191. package/dist/types/cli/status.d.ts +7 -1
  192. package/dist/types/cli/token.d.ts +6 -0
  193. package/dist/types/cli/ui-switch.d.ts +3 -14
  194. package/dist/types/cli/ui-update.d.ts +3 -16
  195. package/dist/types/cli/up.d.ts +9 -22
  196. package/dist/types/cli/usage.d.ts +2 -6
  197. package/dist/types/cli.d.ts +1 -10
  198. package/dist/types/client.d.ts +4099 -1142
  199. package/dist/types/config/accounts.d.ts +16 -0
  200. package/dist/types/config/jobs.d.ts +68 -0
  201. package/dist/types/config/layout.d.ts +2 -8
  202. package/dist/types/config/migrations.d.ts +9 -41
  203. package/dist/types/config/parse.d.ts +8 -13
  204. package/dist/types/config/patch.d.ts +1 -6
  205. package/dist/types/config/schema.d.ts +16 -18
  206. package/dist/types/config/secret-parts.d.ts +6 -27
  207. package/dist/types/config/secrets.d.ts +167 -88
  208. package/dist/types/config/seed.d.ts +1 -6
  209. package/dist/types/config/server-ids.d.ts +2 -11
  210. package/dist/types/config/settings.d.ts +13 -49
  211. package/dist/types/config/store.d.ts +17 -54
  212. package/dist/types/config/workspaces.d.ts +24 -56
  213. package/dist/types/helpers/action-result.d.ts +18 -32
  214. package/dist/types/helpers/atomic.d.ts +1 -4
  215. package/dist/types/helpers/backoff.d.ts +0 -1
  216. package/dist/types/helpers/bind.d.ts +3 -11
  217. package/dist/types/helpers/config-text.d.ts +4 -19
  218. package/dist/types/helpers/cookies.d.ts +2 -7
  219. package/dist/types/helpers/copy-tree.d.ts +4 -12
  220. package/dist/types/helpers/daemon-log.d.ts +8 -33
  221. package/dist/types/helpers/daemon.d.ts +20 -70
  222. package/dist/types/helpers/deferred.d.ts +2 -4
  223. package/dist/types/helpers/env-file.d.ts +2 -7
  224. package/dist/types/helpers/error.d.ts +3 -14
  225. package/dist/types/helpers/event-stream.d.ts +18 -10
  226. package/dist/types/helpers/factory.d.ts +2 -3
  227. package/dist/types/helpers/last-stop.d.ts +5 -12
  228. package/dist/types/helpers/logger.d.ts +1 -5
  229. package/dist/types/helpers/open.d.ts +0 -1
  230. package/dist/types/helpers/openapi.d.ts +19 -5
  231. package/dist/types/helpers/paths.d.ts +18 -53
  232. package/dist/types/helpers/restore-lock.d.ts +2 -17
  233. package/dist/types/helpers/runtime.d.ts +3 -13
  234. package/dist/types/helpers/secret-compare.d.ts +2 -10
  235. package/dist/types/helpers/server-create.d.ts +15 -0
  236. package/dist/types/helpers/shell.d.ts +2 -16
  237. package/dist/types/helpers/sse.d.ts +8 -6
  238. package/dist/types/helpers/ui-dir.d.ts +1 -5
  239. package/dist/types/helpers/utf8-chunks.d.ts +2 -8
  240. package/dist/types/helpers/validate.d.ts +2 -4
  241. package/dist/types/helpers/validator.d.ts +8 -4
  242. package/dist/types/helpers/version.d.ts +1 -6
  243. package/dist/types/helpers/workspace.d.ts +24 -16
  244. package/dist/types/index.d.ts +2 -3
  245. package/dist/types/middleware/auth.d.ts +8 -27
  246. package/dist/types/middleware/body-limit.d.ts +10 -0
  247. package/dist/types/middleware/host.d.ts +4 -23
  248. package/dist/types/middleware/loopback.d.ts +1 -8
  249. package/dist/types/middleware/token-scope.d.ts +34 -0
  250. package/dist/types/node-compat.d.ts +43 -0
  251. package/dist/types/openapi-reference.d.ts +4 -19
  252. package/dist/types/openapi.d.ts +5 -8
  253. package/dist/types/providers/archive.d.ts +8 -25
  254. package/dist/types/providers/backup-hook.d.ts +4 -19
  255. package/dist/types/providers/ddns/dyndns2.d.ts +0 -3
  256. package/dist/types/providers/ddns/index.d.ts +2 -3
  257. package/dist/types/providers/ddns/ip.d.ts +2 -12
  258. package/dist/types/providers/ddns/namecheap-api.d.ts +3 -2
  259. package/dist/types/providers/ddns/types.d.ts +6 -32
  260. package/dist/types/providers/ddns/zone.d.ts +1 -4
  261. package/dist/types/providers/docker.d.ts +18 -45
  262. package/dist/types/providers/entry-state.d.ts +4 -9
  263. package/dist/types/providers/health-check.d.ts +1 -5
  264. package/dist/types/providers/host.d.ts +33 -108
  265. package/dist/types/providers/identity.d.ts +9 -34
  266. package/dist/types/providers/log-tail.d.ts +14 -24
  267. package/dist/types/providers/nanny-sweep.d.ts +8 -25
  268. package/dist/types/providers/nanny.d.ts +16 -58
  269. package/dist/types/providers/port.d.ts +28 -83
  270. package/dist/types/providers/proc.d.ts +22 -80
  271. package/dist/types/providers/process.d.ts +12 -36
  272. package/dist/types/providers/proxy/admin.d.ts +11 -0
  273. package/dist/types/providers/proxy/types.d.ts +4 -16
  274. package/dist/types/providers/telegram.d.ts +1 -17
  275. package/dist/types/providers/ui-release.d.ts +15 -25
  276. package/dist/types/providers/webhook.d.ts +8 -29
  277. package/dist/types/providers/wsl-temperature.d.ts +13 -22
  278. package/dist/types/services/acme-challenge.d.ts +2 -16
  279. package/dist/types/services/auth.d.ts +65 -80
  280. package/dist/types/services/backups/archive-safety.d.ts +30 -0
  281. package/dist/types/services/backups/paths.d.ts +31 -0
  282. package/dist/types/services/backups.d.ts +61 -271
  283. package/dist/types/services/config-watch.d.ts +3 -15
  284. package/dist/types/services/control-server.d.ts +6 -10
  285. package/dist/types/services/ddns.d.ts +12 -13
  286. package/dist/types/services/dependencies.d.ts +3 -14
  287. package/dist/types/services/deploy.d.ts +34 -0
  288. package/dist/types/services/events.d.ts +15 -9
  289. package/dist/types/services/exposure.d.ts +13 -63
  290. package/dist/types/services/history.d.ts +5 -14
  291. package/dist/types/services/host-monitor.d.ts +6 -11
  292. package/dist/types/services/init.d.ts +5 -35
  293. package/dist/types/services/job-ledger.d.ts +27 -0
  294. package/dist/types/services/jobs.d.ts +113 -0
  295. package/dist/types/services/log-buffer.d.ts +7 -8
  296. package/dist/types/services/log-files.d.ts +12 -42
  297. package/dist/types/services/log-relay.d.ts +3 -13
  298. package/dist/types/services/nanny.d.ts +3 -10
  299. package/dist/types/services/notifications.d.ts +31 -61
  300. package/dist/types/services/panel.d.ts +32 -78
  301. package/dist/types/services/proxy-certificates/certificates.d.ts +31 -69
  302. package/dist/types/services/proxy-config.d.ts +15 -36
  303. package/dist/types/services/proxy-dns01.d.ts +14 -0
  304. package/dist/types/services/proxy.d.ts +73 -254
  305. package/dist/types/services/scheduler.d.ts +46 -0
  306. package/dist/types/services/state.d.ts +17 -8
  307. package/dist/types/services/supervisor/compose.d.ts +2 -6
  308. package/dist/types/services/supervisor/entry.d.ts +29 -32
  309. package/dist/types/services/supervisor/health.d.ts +8 -31
  310. package/dist/types/services/supervisor/job-run.d.ts +36 -0
  311. package/dist/types/services/supervisor/output.d.ts +13 -77
  312. package/dist/types/services/supervisor/persistent.d.ts +5 -11
  313. package/dist/types/services/supervisor/port-preflight.d.ts +4 -10
  314. package/dist/types/services/supervisor/records.d.ts +27 -60
  315. package/dist/types/services/supervisor/restart-required.d.ts +13 -0
  316. package/dist/types/services/supervisor/spawn.d.ts +3 -5
  317. package/dist/types/services/supervisor/view.d.ts +3 -1
  318. package/dist/types/services/supervisor.d.ts +31 -43
  319. package/dist/types/services/tls.d.ts +6 -17
  320. package/dist/types/services/ui-update.d.ts +19 -17
  321. package/dist/types/services/ui.d.ts +10 -19
  322. package/dist/types/shared/action-outcome.d.ts +2 -7
  323. package/dist/types/shared/api-client.d.ts +133 -177
  324. package/dist/types/shared/api-scopes.d.ts +17 -0
  325. package/dist/types/shared/backup-scope.d.ts +16 -90
  326. package/dist/types/shared/clone.d.ts +2 -11
  327. package/dist/types/shared/contracts/accounts.d.ts +99 -0
  328. package/dist/types/shared/contracts/backups.d.ts +219 -0
  329. package/dist/types/shared/contracts/ddns.d.ts +208 -0
  330. package/dist/types/shared/contracts/frames.d.ts +1395 -0
  331. package/dist/types/shared/contracts/index.d.ts +3 -0
  332. package/dist/types/shared/contracts/logs.d.ts +107 -0
  333. package/dist/types/shared/contracts/proxy.d.ts +303 -0
  334. package/dist/types/shared/contracts.d.ts +852 -1982
  335. package/dist/types/shared/cpu-scale.d.ts +3 -19
  336. package/dist/types/shared/crash-cause.d.ts +8 -0
  337. package/dist/types/shared/cron.d.ts +70 -0
  338. package/dist/types/shared/ddns-form.d.ts +9 -43
  339. package/dist/types/shared/endpoint.d.ts +1 -7
  340. package/dist/types/shared/error-codes.d.ts +438 -0
  341. package/dist/types/shared/error-message.d.ts +1 -7
  342. package/dist/types/shared/fields.d.ts +7 -17
  343. package/dist/types/shared/form-repair.d.ts +1 -5
  344. package/dist/types/shared/generated.d.ts +3 -19
  345. package/dist/types/shared/host-readings.d.ts +25 -128
  346. package/dist/types/shared/lazy.d.ts +1 -1
  347. package/dist/types/shared/live-frames.d.ts +2 -8
  348. package/dist/types/shared/live-series.d.ts +2 -8
  349. package/dist/types/shared/live-store.d.ts +4 -8
  350. package/dist/types/shared/log-download.d.ts +6 -0
  351. package/dist/types/shared/meta.d.ts +6 -0
  352. package/dist/types/shared/password-policy.d.ts +10 -0
  353. package/dist/types/shared/patch-diff.d.ts +13 -72
  354. package/dist/types/shared/port-reading.d.ts +18 -0
  355. package/dist/types/shared/probe-latency.d.ts +3 -21
  356. package/dist/types/shared/proxy-form.d.ts +33 -74
  357. package/dist/types/shared/proxy-validate.d.ts +11 -0
  358. package/dist/types/shared/query-params.d.ts +8 -0
  359. package/dist/types/shared/server-attention.d.ts +2 -27
  360. package/dist/types/shared/server-form.d.ts +15 -54
  361. package/dist/types/shared/server-key.d.ts +1 -12
  362. package/dist/types/shared/server-readings.d.ts +7 -32
  363. package/dist/types/shared/server-url.d.ts +9 -31
  364. package/dist/types/shared/shape.d.ts +1 -16
  365. package/dist/types/shared/stream-access.d.ts +2 -8
  366. package/dist/types/shared/ui-format.d.ts +25 -65
  367. package/docs/API.md +315 -107
  368. package/docs/BACKUPS.md +61 -56
  369. package/docs/CLI.md +255 -49
  370. package/docs/DDNS.md +35 -49
  371. package/docs/JOBS.md +129 -0
  372. package/docs/NOTIFICATIONS.md +58 -90
  373. package/docs/REVERSE_PROXY.md +116 -188
  374. package/docs/SECURITY.md +126 -44
  375. package/docs/SERVERS.md +282 -409
  376. package/docs/UI_CREATION.md +90 -47
  377. package/docs/demo/blank-host-restore.sh +31 -7
  378. package/package.json +15 -6
  379. package/scripts/prepare.mjs +47 -0
  380. package/uis/stock/dist/assets/CopyButton-8mliL0xi.js +1 -0
  381. package/uis/stock/dist/assets/GlobalSettingsView-BINXY77E.js +1 -0
  382. package/uis/stock/dist/assets/LogViewer-kiSnTwdY.js +1 -0
  383. package/uis/stock/dist/assets/LogsView-DDXf_ONs.js +1 -0
  384. package/uis/stock/dist/assets/Modal-lrUuViF2.js +39 -0
  385. package/uis/stock/dist/assets/ProxyView-uXMaJdSQ.js +1 -0
  386. package/uis/stock/dist/assets/ServerDetailView-CW0Vb_c0.js +4 -0
  387. package/uis/stock/dist/assets/SettingsShell-B135xWjJ.js +1 -0
  388. package/uis/stock/dist/assets/SettingsView-BLtWxVkl.js +2 -0
  389. package/uis/stock/dist/assets/de-BIoTrHBQ.js +1 -0
  390. package/uis/stock/dist/assets/es-x4-ih8lH.js +1 -0
  391. package/uis/stock/dist/assets/fr-DatqBBkO.js +1 -0
  392. package/uis/stock/dist/assets/index-CnojaKcA.css +2 -0
  393. package/uis/stock/dist/assets/index-D-CiZReu.js +16 -0
  394. package/uis/stock/dist/assets/ja-CW1703Gw.js +1 -0
  395. package/uis/stock/dist/assets/ko-wFbT4XtK.js +1 -0
  396. package/uis/stock/dist/assets/ru-C1p5C4VN.js +1 -0
  397. package/uis/stock/dist/assets/useUnsavedGuard-BcsXsfCC.js +9 -0
  398. package/uis/stock/dist/assets/vi-CDqr0uie.js +1 -0
  399. package/uis/stock/dist/assets/zh-CN-BJ7iit-X.js +1 -0
  400. package/uis/stock/dist/index.html +4 -3
  401. package/uis/stock/dist/ui.json +3 -3
  402. package/dist/chunks/archive-DP-XQR8X.js.map +0 -1
  403. package/dist/chunks/atomic-C1PfJpE7.js.map +0 -1
  404. package/dist/chunks/backup-DeAJ3pbO.js.map +0 -1
  405. package/dist/chunks/backups-twva7x2n.js +0 -4691
  406. package/dist/chunks/backups-twva7x2n.js.map +0 -1
  407. package/dist/chunks/config-text-DifCHhnz.js +0 -50
  408. package/dist/chunks/config-text-DifCHhnz.js.map +0 -1
  409. package/dist/chunks/contracts-CMBD1TF9.js.map +0 -1
  410. package/dist/chunks/daemon-CofN9k6Q.js +0 -247
  411. package/dist/chunks/daemon-CofN9k6Q.js.map +0 -1
  412. package/dist/chunks/daemon-log-BVj8cDEo.js +0 -241
  413. package/dist/chunks/daemon-log-BVj8cDEo.js.map +0 -1
  414. package/dist/chunks/docker-Cy9Lyvda.js.map +0 -1
  415. package/dist/chunks/down-C59ne5aM.js.map +0 -1
  416. package/dist/chunks/init-BZ7hK9Vf.js.map +0 -1
  417. package/dist/chunks/last-stop-C-BXz_XI.js +0 -53
  418. package/dist/chunks/last-stop-C-BXz_XI.js.map +0 -1
  419. package/dist/chunks/layout-DwTtmund.js +0 -24
  420. package/dist/chunks/layout-DwTtmund.js.map +0 -1
  421. package/dist/chunks/lazy-Ce5zEAq1.js +0 -66
  422. package/dist/chunks/lazy-Ce5zEAq1.js.map +0 -1
  423. package/dist/chunks/log-buffer-Dy9HHDMD.js +0 -414
  424. package/dist/chunks/log-buffer-Dy9HHDMD.js.map +0 -1
  425. package/dist/chunks/logger-B5U4GD3j.js.map +0 -1
  426. package/dist/chunks/logs---TI_bxM.js.map +0 -1
  427. package/dist/chunks/migrate-Cfoq-Vgh.js +0 -155
  428. package/dist/chunks/migrate-Cfoq-Vgh.js.map +0 -1
  429. package/dist/chunks/nanny-COyCJXj9.js +0 -1172
  430. package/dist/chunks/nanny-COyCJXj9.js.map +0 -1
  431. package/dist/chunks/nanny-rewguyXg.js.map +0 -1
  432. package/dist/chunks/nanny-sweep-ClVuNJRo.js.map +0 -1
  433. package/dist/chunks/nearest-6KgQEDUe.js.map +0 -1
  434. package/dist/chunks/parse-DhmG26fI.js.map +0 -1
  435. package/dist/chunks/paths-CGlGDrOU.js.map +0 -1
  436. package/dist/chunks/port-k5VBw8t9.js.map +0 -1
  437. package/dist/chunks/restart-BYu_E7x5.js.map +0 -1
  438. package/dist/chunks/schema-B240VXcV.js.map +0 -1
  439. package/dist/chunks/secrets-BieELnZh.js +0 -562
  440. package/dist/chunks/secrets-BieELnZh.js.map +0 -1
  441. package/dist/chunks/server-By-zktjx.js +0 -169
  442. package/dist/chunks/server-By-zktjx.js.map +0 -1
  443. package/dist/chunks/server-ids-DRuNLVCV.js +0 -32
  444. package/dist/chunks/server-ids-DRuNLVCV.js.map +0 -1
  445. package/dist/chunks/set-password-D5vZqqSX.js +0 -43
  446. package/dist/chunks/set-password-D5vZqqSX.js.map +0 -1
  447. package/dist/chunks/set-token-xJkA1IZp.js +0 -78
  448. package/dist/chunks/set-token-xJkA1IZp.js.map +0 -1
  449. package/dist/chunks/settings-xu-XTfWg.js.map +0 -1
  450. package/dist/chunks/setup-temp-CAN4_bA-.js.map +0 -1
  451. package/dist/chunks/shape-DnTKzjQ2.js +0 -24
  452. package/dist/chunks/shape-DnTKzjQ2.js.map +0 -1
  453. package/dist/chunks/src-BOBh9MBf.js.map +0 -1
  454. package/dist/chunks/status-B6f2-qhs.js.map +0 -1
  455. package/dist/chunks/ui-D562aqw5.js.map +0 -1
  456. package/dist/chunks/ui-dir-CsU3uLNV.js.map +0 -1
  457. package/dist/chunks/ui-release-DKzVvlLd.js.map +0 -1
  458. package/dist/chunks/ui-revert-EkBBwRTt.js.map +0 -1
  459. package/dist/chunks/ui-switch-BnZTdMDd.js.map +0 -1
  460. package/dist/chunks/ui-update-_xryLYxw.js.map +0 -1
  461. package/dist/chunks/up-DNZuTi2q.js.map +0 -1
  462. package/dist/chunks/usage-BrnDARNM.js.map +0 -1
  463. package/dist/chunks/workspaces-DYcfvKV_.js.map +0 -1
  464. package/dist/chunks/wsl-temperature-BiCI4iK6.js.map +0 -1
  465. package/dist/types/cli/set-password.d.ts +0 -14
  466. package/dist/types/cli/set-token.d.ts +0 -21
  467. package/uis/stock/dist/assets/CopyButton-BUBKRJyY.js +0 -1
  468. package/uis/stock/dist/assets/GlobalSettingsView-yYMcRWvt.js +0 -1
  469. package/uis/stock/dist/assets/LogViewer-DIliXy62.js +0 -1
  470. package/uis/stock/dist/assets/LogsView-B7Z-7RNg.js +0 -1
  471. package/uis/stock/dist/assets/Modal-DmKa5Qpp.js +0 -39
  472. package/uis/stock/dist/assets/ProxyView-DvZiNkwb.js +0 -1
  473. package/uis/stock/dist/assets/ServerDetailView-6idGT_EX.js +0 -2
  474. package/uis/stock/dist/assets/SettingsShell-CeGtleYI.js +0 -1
  475. package/uis/stock/dist/assets/SettingsView-BrhJIrmk.js +0 -2
  476. package/uis/stock/dist/assets/de-BRITeb0H.js +0 -1
  477. package/uis/stock/dist/assets/es-B2zIEssV.js +0 -1
  478. package/uis/stock/dist/assets/fr-s0ZOBEqh.js +0 -1
  479. package/uis/stock/dist/assets/index-C1MehbKy.css +0 -2
  480. package/uis/stock/dist/assets/index-CnBN54wF.js +0 -15
  481. package/uis/stock/dist/assets/ja-CU7MR85V.js +0 -1
  482. package/uis/stock/dist/assets/ko-tL5Me6d-.js +0 -1
  483. package/uis/stock/dist/assets/ru-92yrvkNJ.js +0 -1
  484. package/uis/stock/dist/assets/vi-CzvY16k2.js +0 -1
  485. package/uis/stock/dist/assets/zh-CN-DDwFW_uW.js +0 -1
package/docs/API.md CHANGED
@@ -1,69 +1,63 @@
1
1
  # The API
2
2
 
3
- Everything the panel does goes through one HTTP API, so anything you build — a custom UI, a TUI, a
4
- desktop app, a script, an AI agent — can do it too. The stock UI is just one client of it.
3
+ Everything the panel does goes through one HTTP API, so anything you build — a custom UI, a script,
4
+ an AI agent — can do it too. The stock UI is just one client of it.
5
5
 
6
6
  - **Spec:** `GET /openapi/spec.json` (OpenAPI 3, no session needed), browsable at `/openapi/ui`.
7
- It is generated from the same schemas the server validates with, so it cannot drift.
7
+ It is generated from the schemas the server validates with.
8
8
  - **Live data:** server-sent events on `GET /api/events`.
9
9
  - **Base URL:** wherever the panel listens — `http://127.0.0.1:3999` by default.
10
10
 
11
11
  ## Authenticating
12
12
 
13
+ An **account** is one credential: its `id` and `secret` sign in to the panel *and* authenticate the
14
+ API.
15
+
13
16
  | Client | Credential |
14
17
  | --- | --- |
15
- | A browser UI served by the panel | the `hh_session` cookie from `POST /api/auth/login` |
16
- | Anything else | `Authorization: Bearer <token>` from `home-hosted set-token --generate` |
18
+ | A browser UI served by the panel | the `hh_session` cookie from `POST /api/auth/login` with `{ id, secret }` |
19
+ | Anything else | `Authorization: Bearer <id>:<secret>` (a value with no `:` is refused) |
17
20
 
18
21
  ```bash
19
- home-hosted set-token --generate # printed once; only its hash is stored
20
- curl -H "Authorization: Bearer hh_…" http://127.0.0.1:3999/api/state
22
+ home-hosted account create monitor --scope read # prints the secret once; only a hash is stored
23
+ curl -H "Authorization: Bearer monitor:hh_…" http://127.0.0.1:3999/api/state
21
24
  ```
22
25
 
23
- Or, signed in from anywhere: **Global settings → Authentication → Generate token**, which is
24
- `POST /api/auth/token` (a session is required — a token cannot mint its successor) and returns the
25
- token once; `DELETE /api/auth/token` revokes it. A `401` with `code: "AUTH_REQUIRED"` means "show
26
- your login screen". The token never expires.
26
+ Accounts are also managed under **Global settings → Accounts** (`/api/auth/accounts`). Every account
27
+ route needs a signed-in **session** whose account holds `admin`; a bearer credential may not create,
28
+ edit or revoke one. A `401` with `code: "AUTH_REQUIRED"` means "show your login screen". A session's
29
+ lifetime is an idle timeout; a secret does not expire until it is rotated.
27
30
 
28
- While no password is in force (authentication off, or on with none set yet), `/api` answers only
29
- this machine — a loopback request with no forwarding header — or the token. Anything else, including
30
- a request relayed by a proxy on the same host, is `401 AUTH_DISABLED_REMOTE` (auth off) or
31
- `401 AUTH_UNARMED` (auth on, no password): set a password first. `POST /api/auth/logout` needs no
32
- credential, so a browser whose session already expired can still clear its cookie.
31
+ While no account is in force (authentication off, or on with none set yet), `/api` answers only this
32
+ machine — a loopback request with no forwarding header — or a credential. Anything else, including a
33
+ request relayed by a proxy on the same host, is `401 AUTH_DISABLED_REMOTE` (auth off) or
34
+ `401 AUTH_UNARMED` (auth on, no account). `POST /api/auth/logout` needs no credential, so a browser
35
+ whose session expired can still clear its cookie.
33
36
 
34
37
  > [!WARNING]
35
- > **A token is full admin.** It can create and start a server entry, and an entry runs any command
36
- > as the user running the panel. Treat it like that user's password. A few operations are still
37
- > refused to a token (`403 SESSION_REQUIRED`) — clearing the password, switching authentication off,
38
- > minting or revoking an API token, setting the *first* password (only this machine may), installing
39
- > a custom UI, and restoring an archive that carries the panel's own credentials — so a script
40
- > cannot do those *by accident*, but they are not a security boundary against someone holding the
41
- > token.
42
-
43
- ### Hosts and origins
44
-
45
- - **`Host` must name this panel.** An IP address, `localhost`, a single-label name (`homeserver`)
46
- or a local suffix (`.local`, `.lan`, `.home.arpa`, `.internal`, …) is always accepted. A public
47
- name is accepted only when a reverse-proxy route serves the panel on it, or it is listed in
48
- `control.allowedHosts` (`"*.example.com"` matches subdomains). Anything else is `421
49
- HOST_NOT_ALLOWED`. This is what stops a malicious web page from reaching the panel through DNS
50
- rebinding.
51
- - **A cookie-authenticated write must be same-origin.** A non-GET request carrying a different
52
- `Origin` is `403 CROSS_ORIGIN`. A request authenticated with a **bearer token** is exempt — a
53
- browser never attaches one by itself, so it cannot be a forged request. That is what lets a
54
- desktop app, whose requests carry their own `Origin`, use the API.
55
- - **No CORS headers are sent.** A web page on another origin cannot read the API; a desktop shell
56
- (Tauri, Electron) should call it from its native/main process with a token.
38
+ > **`admin` is everything the panel's user can do** — an entry runs any command as that user. Give a
39
+ > script only the scopes it needs and revoke it when it may have leaked; the scope rules are in
40
+ > [SECURITY.md](./SECURITY.md#an-account-is-scoped-and-the-scopes-mean-something). Creating or
41
+ > revoking an account, switching authentication off, installing a custom UI and restoring an archive
42
+ > that carries the panel's own credentials are refused to a **bearer** credential
43
+ > (`403 SESSION_REQUIRED`), so a stolen one cannot make itself permanent.
57
44
 
58
45
  ## Workspaces
59
46
 
60
47
  Workspace-scoped routes take `?workspace=<id>`. Omitting it means the panel's default workspace; an
61
48
  unknown id is `404 UNKNOWN_WORKSPACE`, never a fallback. **Query keys a route does not declare are
62
- refused** (`400 INVALID_INPUT`, naming the key) — a typo like `?worspace=staging` must not act on
63
- the default workspace. That includes cache-busters.
49
+ refused** (`400 INVALID_INPUT`, naming the key), so a typo like `?worspace=staging` never acts on the
50
+ default workspace. That includes cache-busters.
64
51
 
65
52
  A server id is unique only inside its workspace: key anything you store by `(workspaceId, serverId)`.
66
53
 
54
+ Query **values** are typed, and a value outside its shape is `400 INVALID_INPUT`:
55
+
56
+ - A flag accepts `0`, `1`, `true` or `false` only (`yes`, `on` and `TRUE` are refused).
57
+ - A count is a whole decimal integer inside the route's range — `/api/logs/:id?tail=` is 50–5000,
58
+ `/api/servers/:id/logs?limit=` is 1–100000. Out of range is refused, not clamped; leaving it out
59
+ gets the route's default.
60
+
67
61
  ## Errors
68
62
 
69
63
  Every failure is one JSON envelope with a stable `code` to branch on:
@@ -74,103 +68,322 @@ Every failure is one JSON envelope with a stable `code` to branch on:
74
68
 
75
69
  `detail` is present only when there is structure to report (validation issues, conflicting routes).
76
70
  A refused lifecycle action (`start`, `stop`, `restart`) also carries `ok: false` and `error` (the same
77
- text as `message`) for older clients. Status codes: `400` bad input, `401` no credential, `403`
71
+ text as `message`) for older clients; its `code` is one of `UNKNOWN_SERVER`, `SERVER_DISABLED`,
72
+ `SERVER_BUSY`, `PORT_IN_USE`, `DEPENDENCY_FAILED` or `ACTION_FAILED`. A dependency that is **up but
73
+ unhealthy** does not refuse the dependent: the panel logs `starting anyway` and starts it.
74
+
75
+ Status codes: `400` bad input (including a body that is not JSON), `401` no credential, `403`
78
76
  forbidden for this credential or origin, `404` unknown id, `409` the entry cannot do that now (or
79
- `CONFIG_CHANGED_ON_DISK`: the config file was edited since the panel read it — it reloads, so retry),
80
- `413` too large, `421` unknown host, `502` the reverse-proxy engine or its download failed.
81
- A body that is not valid JSON is `400 INVALID_INPUT`, like any other rejected input. A path under
82
- `/api`, `/_hh` or `/openapi` that matches no route — or any non-`GET` request that matches none — is
83
- `404 NOT_FOUND` in the same envelope, never the UI's `index.html`.
77
+ `CONFIG_CHANGED_ON_DISK`: the config file was edited since the panel read it — retry), `413` too
78
+ large, `421` unknown host, `502` the reverse-proxy engine or its download failed. A path under `/api`,
79
+ `/_hh` or `/openapi` that matches no route — or any non-`GET` that matches none — is `404 NOT_FOUND`
80
+ in the same envelope, never the UI's `index.html`.
81
+
82
+ ### Every code
83
+
84
+ <details>
85
+ <summary>The full catalogue (also served as <code>errorCodes</code> by <code>GET /api/meta</code>)</summary>
86
+
87
+ | `code` | status | meaning |
88
+ | --- | --- | --- |
89
+ | `INVALID_INPUT` | 400 | the body, query or path did not validate; `detail` lists the fields |
90
+ | `ID_MISMATCH` | 400 | a `PUT` body's `id` does not match the path id |
91
+ | `NOT_FOUND` | 404 | no route matches this method and path |
92
+ | `PAYLOAD_TOO_LARGE` | 413 | the request body was larger than the panel accepts (1 MB, or the route's own ceiling for an upload) |
93
+ | `LENGTH_REQUIRED` | 411 | the request body was chunked, so its size could not be checked before reading it — send a `Content-Length` |
94
+ | `INTERNAL_ERROR` | 500 | a failure with no more specific code; the panel logged it |
95
+ | `DETAILED_ERROR` | 500 | a `DetailedError` thrown without a code — a bug in the panel |
96
+ | `HTTP_EXCEPTION` | 500 | a refusal from the HTTP framework itself; the status line carries its real status |
97
+ | `AUTH_REQUIRED` | 401 | no valid session or token; show the login screen |
98
+ | `AUTH_UNARMED` | 401 | authentication is on but no password is set, and the caller is not this machine |
99
+ | `AUTH_DISABLED_REMOTE` | 401 | authentication is off and the caller is not this machine (a proxy counts) |
100
+ | `LOGIN_FAILED` | 401 | a sign-in failed: wrong id or secret (401), or no account can sign in yet (409) |
101
+ | `LOGIN_THROTTLED` | 429 | too many failed sign-ins; wait for `Retry-After` (also `detail.retryAfterMs`). Older panels sent `LOGIN_FAILED` with the same 429 |
102
+ | `SESSION_REQUIRED` | 403 | this operation needs a signed-in session, not an API token (this machine passes while authentication is off or has no account) |
103
+ | `TOKEN_SCOPE` | 403 | the API token's scopes do not cover this route, or its workspace limit excludes it — `detail` names what it needed and what it holds |
104
+ | `UNKNOWN_JOB` | 404 | no job has that id in this workspace |
105
+ | `UNKNOWN_JOB_RUN` | 404 | that job has no run with this id; only its last 50 runs are kept |
106
+ | `JOB_EXISTS` | 409 | a job with that id already exists |
107
+ | `JOB_RUNNING` | 409 | that job is already running |
108
+ | `INVALID_JOB` | 400 | the job would not be runnable |
109
+ | `INVALID_CONFIG` | 400 | the jobs file could not be read, and was left untouched |
110
+ | `NO_DEPLOY` | 400 | the server has no `deploy` steps to run |
111
+ | `DEPLOY_RUNNING` | 409 | a deploy is already running for that server |
112
+ | `DEPLOY_FAILED` | 409 | a deploy step failed — the previous process is still running |
113
+ | `ACCOUNT_EXISTS` | 409 | an account with that id already exists |
114
+ | `UNKNOWN_ACCOUNT` | 404 | no account has that id |
115
+ | `CANNOT_REVOKE_SELF` | 400 | that is the account making the request |
116
+ | `LAST_ACCOUNT` | 400 | the last account that can sign in; revoking it would lock the panel |
117
+ | `LAST_ADMIN` | 400 | the last enabled account with `admin`; taking it away would leave no one able to manage accounts from the panel |
118
+ | `CURRENT_PASSWORD_WRONG` | 401 | `currentSecret` was incorrect (the code keeps its older name) |
119
+ | `PASSWORD_TOO_SHORT` | 400 | a password below the 12-character bar while the panel is exposed |
120
+ | `EXPOSED_WITHOUT_PASSWORD` | 400 | this would expose the panel with authentication off or no password |
121
+ | `EXPOSURE_BLOCKED` | 400 | the listener change would expose the panel without auth and a long-enough password |
122
+ | `PROXY_EXPOSURE_BLOCKED` | 400 | a proxy route to the panel would expose it without auth and a long-enough password |
123
+ | `CROSS_ORIGIN` | 403 | a cookie-authenticated write from another origin |
124
+ | `HOST_NOT_ALLOWED` | 421 | the `Host` header names a host this panel does not answer to |
125
+ | `INVALID_TOKEN` | 403 | the local `/_hh` token does not match `run.json` |
126
+ | `NOT_LOOPBACK` | 403 | this local-only operation was called from another machine |
127
+ | `INVALID_SETTINGS` | 400 | the settings patch was rejected by the store |
128
+ | `CONFIG_CHANGED_ON_DISK` | 409 | the config file was edited since the panel read it; it reloads, so retry |
129
+ | `UNKNOWN_WORKSPACE` | 404 | `?workspace=` names no workspace this panel has |
130
+ | `SERVER_EXISTS` | 409 | a server with this id already exists in the workspace |
131
+ | `INVALID_SERVER` | 400 | the store refused the entry as written; the message names the field |
132
+ | `WORKSPACE_EXISTS` | 409 | a workspace with that id already exists |
133
+ | `INVALID_WORKSPACE` | 400 | the workspace registry refused the change (a bad id or label, or removing the only workspace) |
134
+ | `UNKNOWN_SERVER` | 404 | no server has that id in the workspace |
135
+ | `SERVER_DISABLED` | 409 | the entry is switched off (`enabled: false`) |
136
+ | `SERVER_BUSY` | 409 | a stop, or the same action, is already in flight |
137
+ | `PORT_IN_USE` | 409 | the entry's port is held and could not be freed |
138
+ | `FREE_PORT_FAILED` | 409 | the port could not be freed: nothing holds it, or the holder is supervised by this panel |
139
+ | `DEPENDENCY_FAILED` | 409 | an entry in `dependsOn` could not be started |
140
+ | `ACTION_FAILED` | 409 | a lifecycle refusal none of the more specific codes describes |
141
+ | `UNKNOWN_ORPHAN` | 404 | no orphaned process is running under that id |
142
+ | `ORPHAN_SURVIVED` | 409 | an orphaned process ignored the stop |
143
+ | `UNKNOWN_LOG_FILE` | 404 | that file is not one of this entry's log rotations |
144
+ | `CURSOR_OUT_OF_RANGE` | 400 | an `?after=`/`?before=` log cursor is older than the lines this route reads; download the log file for the full history |
145
+ | `INVALID_PROXY` | 400 | the proxy configuration failed validation; `detail` lists the problems |
146
+ | `PROXY_DISABLED` | 400 | the reverse proxy is switched off |
147
+ | `PROXY_ROUTE_UNKNOWN` | 404 | no proxy route has that id |
148
+ | `PROXY_CERT_NOT_MANAGED` | 400 | that host is not one a CA issues for, so there is no certificate to retry |
149
+ | `PROXY_CERT_RETRY_LAST_ROUTE` | 409 | that is the only route on its name; the certificate could not be dropped for a retry |
150
+ | `PROXY_TLS_IN_USE` | 400 | that certificate is still used by a route |
151
+ | `PROXY_PORT_IN_USE` | 409 | a proxy port is held by something else; `detail.holders` names them |
152
+ | `PROXY_CONFIG_REJECTED` | 400 | the engine refused the generated configuration |
153
+ | `PROXY_NO_PREVIOUS` | 400 | there is no earlier engine configuration to revert to |
154
+ | `PROXY_NO_ADMIN_PORT` | 500 | no free loopback port was found for the engine admin endpoint |
155
+ | `INVALID_CERTIFICATE` | 400 | an uploaded PEM pair was rejected |
156
+ | `UNKNOWN_ENGINE` | 500 | the configured proxy engine name is not one this panel implements |
157
+ | `ENGINE_MISSING` | 400 | the proxy engine is not installed yet |
158
+ | `ENGINE_NOT_RUNNING` | 400 | the proxy engine is not running |
159
+ | `ENGINE_NOT_READY` | 502 | the engine started but never answered on its admin endpoint |
160
+ | `ENGINE_UNREACHABLE` | 502 | the engine admin endpoint did not answer |
161
+ | `ENGINE_ALREADY_RUNNING` | 409 | an engine is running whose admin endpoint the panel does not know |
162
+ | `ENGINE_BUSY` | 409 | the engine is running, so it cannot be replaced |
163
+ | `ENGINE_INTEGRITY` | 409 | the installed engine binary is not the one the panel downloaded |
164
+ | `ENGINE_MODULE_NOT_INSTALLED` | 400 | the engine module is not available in this install |
165
+ | `ENGINE_DOWNLOAD_FAILED` | 502 | the engine download or its verification failed |
166
+ | `ENGINE_DOWNLOAD_UNTRUSTED` | 502 | the engine download did not come from where it should |
167
+ | `INVALID_ENGINE_VERSION` | 400 | that is not a version of this engine |
168
+ | `UNSUPPORTED_PLATFORM` | 400 | the engine has no build for this platform/architecture |
169
+ | `BACKUP_FAILED` | 400 | the archive could not be written |
170
+ | `BACKUP_NOT_FOUND` | 404 | no archive has that name |
171
+ | `MISSING_ARCHIVE` | 400 | a restore needs a backup name or an uploaded file |
172
+ | `INVALID_INCLUDE` | 400 | an upload's `include` field is not a JSON array of item ids |
173
+ | `INVALID_EXCLUDE` | 400 | an upload's `exclude` field is not a JSON array of item ids |
174
+ | `MISSING_FILE` | 400 | the multipart body carried no `file` field |
175
+ | `MISSING_NAME` | 400 | a restore needs `name` (or `from`) |
176
+ | `NAME_AND_FROM` | 400 | a restore takes `name` or `from`, not both |
177
+ | `FROM_NOT_ABSOLUTE` | 400 | `from` must be an absolute path |
178
+ | `RESTORE_FAILED` | 400 | the restore plan could not be applied; `detail` names the items |
179
+ | `RESTORE_IN_PROGRESS` | 409 | a restore is already running |
180
+ | `INVALID_UI` | 400 | the uploaded UI zip was rejected |
181
+ | `UPLOAD_TOO_LARGE` | 413 | the upload is larger than the limit |
182
+ | `CONFIG_COPY_CONFLICT` | 400 | a directory could not be copied over a non-directory |
183
+ | `TELEGRAM_TOKEN_REJECTED` | 400 | Telegram did not accept the bot token |
184
+ | `TELEGRAM_LIST_FAILED` | 400 | listing chats from Telegram failed |
185
+ | `TELEGRAM_SEND_FAILED` | 400 | the test message could not be delivered through Telegram |
186
+ | `WEBHOOK_SEND_FAILED` | 400 | the test webhook could not be delivered |
187
+ | `UNKNOWN_DESTINATION` | 404 | no notification destination has that id in this workspace |
188
+ | `INVALID_DDNS` | 400 | the DDNS configuration failed validation; `detail` lists the problems |
189
+ | `INVALID_DDNS_CREDENTIALS` | 400 | the DDNS account credentials were rejected by their provider |
190
+ | `UNKNOWN_DDNS_PROVIDER` | 400 | no DDNS provider has that id |
191
+ | `NOT_WSL` | 400 | the temperature bridge is WSL2-only |
192
+ | `WINDOWS_DRIVE_MISSING` | 400 | the Windows drive is not mounted where the helper must be written |
193
+ | `SCRIPT_WRITE_FAILED` | 400 | the temperature helper could not be written |
194
+ | `LIBRARY_INSTALL_FAILED` | 400 | LibreHardwareMonitor could not be installed |
195
+
196
+ </details>
84
197
 
85
198
  ## Endpoints
86
199
 
87
200
  ✅ takes `?workspace=<id>`; everything else is panel-wide. The spec documents every `/api`, `/_hh`
88
- and `/healthz` operation with its body and responses — the two documents that describe it
89
- (`/openapi/spec.json` and `/openapi/ui`) are served but not listed in it.
201
+ and `/healthz` operation with its body and responses.
90
202
 
91
203
  | Endpoint | What it is | |
92
204
  | --- | --- | --- |
93
- | `GET /api/state` | the whole snapshot: settings, every workspace and server, host vitals | |
94
- | `GET /api/events` | the live feed (below) | ✅ optional |
95
- | `GET`/`POST /api/workspaces`, `PATCH`/`DELETE /api/workspaces/:id` | the workspace registry | |
96
- | `GET`/`POST /api/servers` | one workspace's entries | ✅ |
97
- | `GET`/`PUT`/`PATCH`/`DELETE /api/servers/:id` | one entry. `PUT` is create-or-replace (201, then 200): the idempotent form for config management. It writes config only — restart to apply | ✅ |
205
+ | `GET /api/state` | the whole snapshot: settings, every workspace and server, host vitals. An account with a `workspaces` limit gets only its own workspaces | |
206
+ | `GET /api/meta` | what this panel is and what this credential may not do ([below](#what-this-panel-is)) | |
207
+ | `GET /api/events` | the live feed ([below](#live-events)), narrowed for a limited account like `/api/state` | ✅ optional |
208
+ | `GET`/`POST /api/workspaces`, `PATCH`/`DELETE /api/workspaces/:id` | the workspace registry. `GET` narrows to the workspaces a limited account names | |
209
+ | `GET`/`POST /api/servers` | one workspace's entries. A create answers an optional `warnings` list when the entry cannot start as written (`command` holding a whole command line) | ✅ |
210
+ | `GET`/`PUT`/`PATCH`/`DELETE /api/servers/:id` | one entry. `PUT` is create-or-replace (201, then 200); its body must repeat the path `id` (`400 ID_MISMATCH` otherwise, never a rename). `DELETE` stops the entry first and keeps it when the stop fails (`409`, with the lifecycle `code`). See `restartRequired` below | ✅ |
211
+ | `PUT /api/servers/:id/secrets` | `{ set?, unset? }` — the entry's secret environment values, write-only. A name the entry does not declare in `secretEnv` is refused | ✅ |
98
212
  | `POST /api/servers/:id/{start,stop,restart,free-port,clear-logs}` | lifecycle; `free-port` asks whatever holds the port to stop (a supervised holder is refused) | ✅ |
213
+ | `POST /api/servers/:id/deploy` | run the entry's `deploy` steps, then restart. **Waits** for the outcome; `?wait=false` answers `202` instead (`NO_DEPLOY`, `DEPLOY_RUNNING`, `DEPLOY_FAILED`) | ✅ |
214
+ | `POST /api/servers/orphans/:id/stop` | stop a process the panel started that no entry claims any more (listed on the workspace view) | ✅ |
99
215
  | `POST /api/servers/{start-all,stop-all}` | the whole workspace (`?withPersistent=true` includes persistent entries) | ✅ |
100
- | `GET /api/servers/:id/logs`, `GET /api/servers/:id/stream` | buffered lines; one server's SSE (replays its last 200 lines first) | ✅ |
101
- | `GET /api/logs`, `/api/logs/:id?tail=&search=`, `/api/logs/:id/download` | log files on disk | ✅ |
216
+ | `GET /api/servers/:id/logs?limit=` | the in-memory buffer (1–100000 lines) | ✅ |
217
+ | `GET /api/servers/:id/stream` | one server's SSE: `server` frame, then its last 200 `log` lines, then live frames | ✅ |
218
+ | `GET /api/logs`, `/api/logs/:id?tail=&search=&stream=&after=&before=`, `DELETE /api/logs/:id`, `/api/logs/:id/download?file=` | log files on disk. `tail` is 50–5000; `stream` filters `stdout`/`stderr`/`system`; `file` names one rotation (`404 UNKNOWN_LOG_FILE` otherwise). `after`/`before` are **log cursors**, exclusive on both ends: pass back a line's `cursor` (`<ts>:<n>`, the `n`th line of millisecond `ts`) and paging neither repeats nor skips a line. **Not** the `?since=<seq>` of the event streams: here `?since=` is the older name for `?after=`, and a bare `<ts>` stands for that whole millisecond. A cursor older than the readable window is `400 CURSOR_OUT_OF_RANGE` | ✅ |
102
219
  | `GET`/`PATCH /api/settings` | panel-wide settings: listener, auth, TLS, host vitals, backups, UI | |
103
220
  | `GET`/`PATCH /api/settings/workspace` | server defaults, log retention, notifications | ✅ |
104
221
  | `GET`/`PUT /api/ddns`, `PUT`/`DELETE /api/ddns/credentials/:id`, `POST /api/ddns/check` | dynamic DNS | ✅ |
105
222
  | `PUT`/`DELETE /api/notifications/destinations/:id/token`, `POST …/{test,detect-chats}`, `POST /api/notifications/test-webhook` | notification credentials and test sends | ✅ |
106
- | `GET`/`PATCH /api/proxy`, `POST /api/proxy/{engine,start,stop,apply,revert}`, `PUT`/`DELETE /api/proxy/certificates/:id` | the reverse proxy | |
107
- | `GET`/`POST /api/backups`, `POST /api/backups/restore`, `GET /api/backups/:name/download` | archives; `GET` is the selection model, fetch it when a dialog opens. `POST /api/backups` creates at once; a restore only plans unless `?confirm=true` | |
223
+ | `GET`/`PATCH /api/proxy`, `POST /api/proxy/{engine,start,stop,apply,revert}`, `POST /api/proxy/routes/:id/retry-certificate`, `PUT`/`DELETE /api/proxy/certificates/:id` | the reverse proxy ([REVERSE_PROXY.md](./REVERSE_PROXY.md)). A limited account sees only its own workspaces' routes and DNS accounts; a `PATCH` row naming another workspace, or a changed or new row naming none (`panel`/`external`), is `403 TOKEN_SCOPE`; the rows it may not touch stay where they are. A `PATCH` or engine install that saved but the engine did not apply answers `200` with `applyError` | |
224
+ | `GET`/`POST /api/backups`, `DELETE /api/backups/:name`, `POST /api/backups/restore`, `GET /api/backups/:name/download` | archives; `GET` is the selection model, fetch it when a dialog opens. A restore only plans unless `?confirm=true` | |
108
225
  | `POST`/`DELETE /api/settings/ui`, `POST`/`DELETE /api/settings/tls` | install a UI zip / a PEM pair | |
109
- | `POST /api/auth/login`, `GET /api/auth/session`, `POST /api/auth/logout`, `POST`/`DELETE /api/auth/password` | the session and the password | |
110
- | `POST`/`DELETE /api/auth/token` | generate (session only, shown once) or revoke the API token | |
111
- | `GET`/`POST`/`DELETE /api/host/temperature` | the WSL2 temperature bridge: whether a helper is installed, install one, remove it (`supported: false` off WSL — hide the control) | |
112
- | `GET /api/metrics` | Prometheus text | |
113
- | `GET /healthz` | **no credential**: `200`/`503` and uptime; per-server counts with a session, the API token, or the local `run.json` token from this machine; to a caller on this machine, `home` — a fingerprint of the state directory, so the CLI can tell this home's panel from another one sharing the port | |
226
+ | `POST /api/auth/login`, `GET /api/auth/session`, `POST /api/auth/logout` | the session | |
227
+ | `DELETE /api/auth/password` | switch authentication off (session only; the accounts stay on disk) | |
228
+ | `GET`/`POST /api/auth/accounts`, `PATCH`/`DELETE /api/auth/accounts/:id` | the accounts (admin session only; a new secret is shown once). Scopes are `read`, `lifecycle`, `config`, `proxy`, `admin`, cumulative; `workspaces` limits an account, except for `proxy` and `admin`. The list carries `scopes: [{ scope, workspaceLimited }]`. `scopes` is never empty. A `DELETE`, or a `PATCH` that disables an account or takes its `admin`, refuses the account making the request (`CANNOT_REVOKE_SELF`), the last one that can sign in (`LAST_ACCOUNT`) and the last enabled admin (`LAST_ADMIN`); a duplicate id is `409 ACCOUNT_EXISTS`, any other refused value `400 INVALID_INPUT`. Each route's requirement is published in the spec as `x-required-scope` | |
229
+ | `POST /api/auth/accounts/me/secret` | change **your own** secret: `{ currentSecret, newSecret }`, both required (a missing `currentSecret` is `400 INVALID_INPUT`, a wrong one `401 CURRENT_PASSWORD_WRONG`); keeps the session that made the change | |
230
+ | `GET`/`POST /api/jobs`, `PATCH`/`DELETE /api/jobs/:id` | a workspace's [jobs](./JOBS.md): commands on cron schedules | ✅ |
231
+ | `POST /api/jobs/:id/run` | start a run now: `202 { runId }`. `?wait=true` holds up to 30 s for `200 { runId, run }`; a failed run is still a `200`, its `outcome` is the answer. A run already going is `409 JOB_RUNNING` | ✅ |
232
+ | `POST /api/jobs/:id/stop` | end the run in flight and wait for it; `{ stopped: false }` when nothing ran | ✅ |
233
+ | `GET /api/jobs/:id/runs`, `GET /api/jobs/:id/runs/:runId` | the last 50 runs, newest first; one run with the lines it wrote | ✅ |
234
+ | `GET /api/jobs/:id/log` | a job's own log; takes a server log's `tail`/`search`/`stream` and `after`/`before` cursors | ✅ |
235
+ | `PUT /api/jobs/:id/secrets` | a job's secret environment values, write-only, names declared in `secretEnv` only | ✅ |
236
+ | `GET`/`POST`/`DELETE /api/host/temperature` | the WSL2 temperature bridge: status, install, remove (`supported: false` off WSL — hide the control) | |
237
+ | `GET /api/metrics` | Prometheus text ([below](#metrics)) | |
238
+ | `GET /healthz` | **no credential**: `200`/`503` and uptime; per-server counts with a credential or the local `run.json` token; to a caller on this machine, `home` — a fingerprint of the state directory | |
114
239
 
115
240
  An entry body is **partial**: send only the fields the person chose, and the workspace's server
116
241
  defaults fill the rest. Sending a default explicitly freezes it against later default changes.
117
242
 
243
+ **A create or `PUT` writes config; the running process keeps what it was started with.** The server
244
+ view's optional `restartRequired` is `true` while a running process predates a change to `command`,
245
+ `args`, `cwd`, `env`, `envFile`, `secretEnv`, `dataEnvs`, `port`, `bind`, `persistent` or `stop`.
246
+ Every other field takes effect live.
247
+
248
+ While an entry is `crashed` or in `backoff`, the view's optional `lastStderr` carries the last few
249
+ lines the failed run wrote to stderr (oldest first), so a client can show the cause beside
250
+ `lastError` without reading the log.
251
+
252
+ ## The local channel: `/_hh`
253
+
254
+ `/_hh` is what the CLI talks to when a panel is already running on this machine (`down`, `start`,
255
+ `stop`, `backup`, `job run`, …). It is not a second public API:
256
+
257
+ - **Loopback only** — a loopback peer with no forwarding headers, otherwise `403 NOT_LOOPBACK`.
258
+ - **The `run.json` token** — `$HHOSTED_HOME/.hh/run.json` (0600, written at boot) carries a token, sent
259
+ as `x-home-hosted-token` and checked before any body is read (`403 INVALID_TOKEN`). It has no
260
+ scopes: it is the panel's own key, not a credential to hand to anything.
261
+
262
+ ```bash
263
+ # run.json carries the token and the port the panel actually bound.
264
+ HH="$HOME/.home-hosted/.hh"
265
+ TOKEN=$(node -e "process.stdout.write(require('$HH/run.json').token)")
266
+ PORT=$(node -e "process.stdout.write(String(require('$HH/run.json').port))")
267
+ curl -sS -H "x-home-hosted-token: $TOKEN" "http://127.0.0.1:$PORT/_hh/usage"
268
+ ```
269
+
270
+ **Reach for `/api` unless you are the CLI**: an account does everything `/_hh` does, over a
271
+ credential you can scope and revoke.
272
+
273
+ ## What this panel is
274
+
275
+ `GET /api/meta` answers in one request what a client would otherwise probe for:
276
+
277
+ ```json
278
+ {
279
+ "version": "0.13.0",
280
+ "apiVersion": 1,
281
+ "credential": { "kind": "token", "name": "monitor" },
282
+ "actor": "agent",
283
+ "refused": ["password.clear", "password.first", "auth.disable", "token.generate", "token.revoke", "ui.install", "restore.credentials"],
284
+ "features": { "proxy": true, "ddns": false, "temperature": false },
285
+ "errorCodes": ["INVALID_INPUT", "ID_MISMATCH", "…"],
286
+ "events": ["hello", "log", "ping", "server", "state"]
287
+ }
288
+ ```
289
+
290
+ - **`version`** is the release running; **`apiVersion`** the response-shape version (`1` today).
291
+ - **`credential.kind`** is `session` (a browser cookie), `token` (a bearer credential; `name` is the
292
+ account's label) or `local` (no account in force, and the caller is this machine). `actor` is how a
293
+ history event names it (`user`, `agent`).
294
+ - **`refused`** lists the actions this credential may **not** take — the moves that would let a
295
+ stolen bearer credential take the panel over. It is empty for a session and for `local`. It is not
296
+ a measure of reduced authority: an `admin` credential can still run any command through an entry.
297
+ - **`features`** says whether each optional subsystem is switched on **now** (`ddns` if any workspace
298
+ has it enabled, `temperature` if a temperature command is configured). Do not cache it across a
299
+ settings save.
300
+ - **`errorCodes`** is the whole catalogue above; **`events`** the `event:` names streams send.
301
+
302
+ `GET /api/auth/session` carries the same `credential` field. Its `defaultPassword` is **absent**,
303
+ never `null`: the first-run secret is shown on the machine that started the panel, never over the API.
304
+
118
305
  ## Live events
119
306
 
120
307
  `GET /api/events` is a standard SSE stream. Browsers use `EventSource` (cookie auth); anything else
121
308
  reads it with a streaming `fetch` and the bearer header.
122
309
 
310
+ Every frame except `ping` carries one JSON object in `data` with a `type` field that repeats the
311
+ `event:` name, so a client can switch on the parsed object alone.
312
+
123
313
  | `event:` | `data:` |
124
314
  | --- | --- |
125
- | `hello` | `{ ts, state }` — always first: the complete snapshot |
126
- | `state` | `{ ts, state }` — something changed |
127
- | `server` | `{ ts, workspaceId, serverId, server }` — one entry |
128
- | `log` | `{ ts, workspaceId, serverId, lines }` — new output |
129
- | `ping` | the time, every 15 s |
130
-
131
- A stream is authorised when it opens **and** re-checked on every ping and whenever credentials
132
- change (sign-out, a password set, changed or cleared, the token rotated, auth settings saved): once
133
- the caller would no longer be let in, the panel ends the stream, and the reconnect meets the usual
134
- `401`. The re-check does not count as activity, so an open stream does not keep an idle session
135
- alive.
315
+ | `hello` | `{ type: "hello", ts, state }` — always first: the complete snapshot |
316
+ | `state` | `{ type: "state", ts, state }` — something changed |
317
+ | `server` | `{ type: "server", ts, workspaceId, serverId, server }` — one entry |
318
+ | `log` | `{ type: "log", ts, workspaceId, serverId, lines }` — new output |
319
+ | `ping` | the current time in ms (a bare number, not JSON), every 15 s |
320
+
321
+ Query: `?workspace=<id>` narrows `server`/`log` frames to one workspace, `&serverId=<id>` to one
322
+ server of it (of the **default** workspace when `workspace` is omitted), and `?logs=0` drops log
323
+ frames. Naming a workspace or server that does not exist is a `404` before the stream opens. Asking
324
+ for a server in a workspace outside the credential's limit is `403 TOKEN_SCOPE` whether or not that
325
+ id exists.
326
+
327
+ A stream is re-authorised on every ping and whenever credentials change (sign-out, a secret rotated,
328
+ auth settings saved); once the caller would no longer be let in, the panel ends it. The re-check does
329
+ not keep an idle session alive. A slow client never makes the panel buffer without bound: queued
330
+ `state` and `server` frames are replaced by newer ones, and log frames are dropped once too many are
331
+ waiting — treat every snapshot as complete and logs as best-effort.
136
332
 
137
333
  `state.settingsError` is `{ message, path }` while the panel-wide `settings.json` cannot be applied
138
334
  (the running settings are kept), `null` when it is fine, and absent on an older panel. A workspace's
139
335
  own config problem is `configError` on that workspace.
140
336
 
141
- Query: `?workspace=<id>` narrows `server`/`log` frames to one workspace, `&serverId=<id>` to one
142
- server of it — of the **default** workspace when `workspace` is omitted, since ids repeat across
143
- workspaces (an unknown workspace is `404`) — and `?logs=0` drops log frames. A slow client never makes the panel buffer without bound: queued
144
- `state` and `server` frames are replaced by newer ones, and log frames are dropped once too many are
145
- waiting — so treat every snapshot as complete, and logs as best-effort (the log routes have the
146
- full history).
337
+ ### Resuming a stream
338
+
339
+ Every frame carries an `id:`, the panel-wide sequence number. The opening frame also sends
340
+ `retry: 3000` (the reconnect delay, in ms). A reconnecting client says where it got to with the
341
+ `Last-Event-ID` header (an `EventSource` does this by itself) or `?since=<seq>` (a `fetch` reader);
342
+ `?since=` wins if both are present, and a non-numeric `Last-Event-ID` starts a fresh stream. (This `since` is an event sequence; the log history route's cursors are `?after=`/`?before=`.)
343
+
344
+ A resumed stream sends **one current snapshot first** (`hello`, or `server` on a per-server stream),
345
+ whose `id:` is your resume point, **then** the buffered `log` frames published after it, oldest first:
346
+
347
+ - Apply the snapshot as state, and the replay to your log buffer only.
348
+ - `hello`, `state` and `server` frames are never replayed, and you need not refetch `/api/state` after
349
+ a successful resume.
350
+ - Only the last 200 `log` frames (at most 256 KB) are kept, so a long absence loses log lines, never
351
+ state. `/api/logs/:id?after=` and `/api/logs/:id/download` have the full history.
352
+
353
+ A fresh per-server stream (`GET /api/servers/:id/stream`) is seeded with the entry's last 200
354
+ buffered lines; a resumed one replays from the sequence instead, so no line arrives twice.
147
355
 
148
356
  ## Metrics
149
357
 
150
- `GET /api/metrics` is Prometheus text behind the same credential as every `/api` route — scrape it
151
- with a bearer token. Every series is a gauge; none ends in `_total`. A series with no reading is
152
- **absent**, never `0`, so do not let a dashboard fill gaps with zero. `hh_host_cpu_used_percent`
153
- (0–100) is the CPU figure to alert on; `hh_host_load1_per_cpu` is runnable tasks per core.
154
- `hh_server_restarts` is the current crash streak (reset by a manual start), so compare it directly
155
- rather than through `rate()`. `hh_server_uptime_ratio_24h` is the share of the last 24 hours a server
156
- was up **measured over the time the panel observed it**, so a server added ten minutes ago and up
157
- throughout reads `1`, not `0.0069`.
358
+ `GET /api/metrics` is Prometheus text behind the same credential as every `/api` route. Every series
359
+ is a gauge; none ends in `_total`. A series with no reading is **absent**, never `0` — do not let a
360
+ dashboard fill gaps with zero. Host series go absent when sampling is off, when the last sample is
361
+ more than three intervals old, and per reading when the platform cannot take it (Windows has no load
362
+ average); the state frame names those in `host.unmeasured`.
363
+
364
+ - `hh_host_cpu_used_percent` (0–100) is the CPU figure to alert on; `hh_host_load1_per_cpu` is
365
+ runnable tasks per core.
366
+ - `hh_server_restarts` is the current crash streak (reset by a manual start): compare it directly,
367
+ not through `rate()`.
368
+ - `hh_server_uptime_ratio_24h` is measured over the time the panel observed the server, so one added
369
+ ten minutes ago and up throughout reads `1`.
158
370
 
159
371
  ## Compatibility
160
372
 
161
- - Fields are only ever **added** to responses and frames, and a new field is optional — read
162
- defensively, ignore what you do not know. Event names do not change.
163
- - Request bodies are strict: an undeclared key is a `400`, so a typo is never silently ignored.
164
- - `GET /api/state` → `version` is the panel's release.
373
+ - Fields are only ever **added** to responses and frames, and a new field is optional — ignore what
374
+ you do not know. Event names do not change.
375
+ - Request bodies are strict: an undeclared key is a `400`.
376
+ - `apiVersion` in `GET /api/meta` changes only for a change an older client cannot read.
165
377
 
166
378
  ## The TypeScript client
167
379
 
168
- `home-hosted/client` ships in the package: a ~2 KB gzipped runtime over `hono/client`, typed from the
169
- panel's own route table — every path, parameter, body and response — plus the event stream.
380
+ `home-hosted/client` ships in the package: a small runtime over `hono/client`, typed from the panel's
381
+ own route table — every path, parameter, body and response — plus the event stream.
170
382
 
171
383
  ```ts
172
384
  import { createClient, HomeHostedError } from 'home-hosted/client'
173
385
 
386
+ // `token` is an account's `<id>:<secret>`
174
387
  const hh = createClient({ baseUrl: 'http://127.0.0.1:3999', token: process.env.HH_TOKEN })
175
388
 
176
389
  const { servers } = await hh.json(hh.api.servers.$get({ query: { workspace: 'default' } }))
@@ -183,13 +396,11 @@ for await (const frame of hh.events({ workspace: 'default', logs: false })) {
183
396
  ```
184
397
 
185
398
  `hh.json(...)` returns the body or throws a `HomeHostedError` (`status`, `code`, `detail`). `hh.api`
186
- is the raw Hono client rooted at `/api`, for when you want the `Response`; `hh.rpc` is the same client
187
- at the root (`hh.rpc.healthz.$get()`). Pass `fetch` to use your own (tests, custom TLS).
188
- With a `token`, `createClient` refuses a `baseUrl` that is plain `http` to anything but this machine
189
- (`localhost`, `127.x`, `::1`) — the token is full admin and would cross the network readable. Use
190
- https, or pass `allowInsecureToken: true` for a network you trust end to end.
191
- Types such as `AppState`, `ServerView` and `SseMessage` are exported too. The client and the panel
192
- should come from the same release: the types describe the routes of the version they shipped with.
399
+ is the raw Hono client rooted at `/api`; `hh.rpc` is the same client at the root
400
+ (`hh.rpc.healthz.$get()`). Pass `fetch` to use your own. With a `token`, `createClient` refuses a
401
+ plain-`http` `baseUrl` that is not this machine (`localhost`, `127.x`, `::1`); use https, or pass
402
+ `allowInsecureToken: true` for a network you trust end to end. Types such as `AppState`, `ServerView`
403
+ and `SseMessage` are exported too. Use the client from the same release as the panel.
193
404
 
194
405
  ## Generating a client in another language
195
406
 
@@ -197,13 +408,10 @@ should come from the same release: the types describe the routes of the version
197
408
  pnpm dlx openapi-typescript http://127.0.0.1:3999/openapi/spec.json -o src/home-hosted.d.ts
198
409
  ```
199
410
 
200
- Any OpenAPI generator works: the document declares `bearerAuth`, gives every error a body and every
201
- 2xx a schema. Inside this repository the UIs call the published client instead — `@shared/api-client`,
202
- which both UIs import and which validates each response against the same ArkType schema the route
203
- validates its request with.
411
+ Any OpenAPI generator works: the document declares `bearerAuth` and gives every error a body and
412
+ every 2xx a schema.
204
413
 
205
414
  ## For an AI agent
206
415
 
207
- Give it the token, `/openapi/spec.json`, `home-hosted status --json` (where everything lives) and
208
- [SERVERS.md](./SERVERS.md) (how an entry is declared). That is enough to run a home server without
209
- guessing.
416
+ Give it a scoped account, `/openapi/spec.json`, `home-hosted status --json` (where everything lives)
417
+ and [SERVERS.md](./SERVERS.md) (how an entry is declared).