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
@@ -0,0 +1,34 @@
1
+ import type { ChildProcess } from '../node-compat.js';
2
+ import type { ServerConfig } from '../shared/contracts.js';
3
+ import { spawnManaged } from '../providers/process.js';
4
+ /**
5
+ * Running an entry's `deploy` steps in order, in its own environment. Unlike a best-effort bootstrap,
6
+ * a failed step stops the sequence and leaves the running process alone.
7
+ */
8
+ export interface DeployOutcome {
9
+ ok: boolean;
10
+ /** Which step failed, 1-based, and its message — absent on success. */
11
+ failedStep?: number;
12
+ error?: string;
13
+ durationMs: number;
14
+ }
15
+ /** The seams a test needs: spawn, the log sink, the clock, and the environment. */
16
+ export interface DeployContext {
17
+ log: (stream: 'stdout' | 'stderr' | 'system', text: string) => void;
18
+ /**
19
+ * The entry's own environment, resolved as its spawn does (`env` < `envFile` < `dataEnvs` <
20
+ * `secretEnv`). Supplied because only the supervisor holds the secrets store and `envFile` loader;
21
+ * required so no caller silently falls back to a subset.
22
+ */
23
+ env: () => Record<string, string>;
24
+ spawn?: typeof spawnManaged;
25
+ now?: () => number;
26
+ }
27
+ /**
28
+ * Runs every step. **Never throws for a step failure.** `cancelled()` is re-checked between steps and
29
+ * while one runs, so a stop kills the step's process group and ends the sequence.
30
+ */
31
+ export declare function runDeploy(config: ServerConfig, cancel: {
32
+ cancelled: () => boolean;
33
+ onChild?: (child: ChildProcess | null) => void;
34
+ }, context: DeployContext): Promise<DeployOutcome>;
@@ -1,17 +1,23 @@
1
1
  import type { SseMessage } from '../shared/contracts.js';
2
- export type EventListener = (message: SseMessage) => void;
3
- /**
4
- * Fan-out for SSE subscribers, optionally scoped to one server.
5
- *
6
- * The scope is `workspaceId/serverId`, never the bare id: server ids are only
7
- * unique *within* a workspace, so keying on the id alone would deliver one
8
- * workspace's log lines to a subscriber watching another workspace's server of
9
- * the same name.
10
- */
2
+ /** `seq` is the panel-wide frame number: the SSE `id:` line, and what a resume addresses. */
3
+ export type EventListener = (message: SseMessage, seq: number) => void;
4
+ /** Fan-out for SSE subscribers, optionally scoped to one server by `workspaceId/serverId`. */
11
5
  export { serverKey } from '../shared/server-key.js';
12
6
  export declare class EventHub {
13
7
  private readonly listeners;
8
+ /** Per panel, not per stream, so an `id` is meaningful across a reconnect. */
9
+ private seq;
10
+ private readonly buffer;
11
+ private bufferedBytes;
12
+ get lastSeq(): number;
13
+ get bufferedFrames(): number;
14
14
  subscribe(key: string | null, listener: EventListener): () => void;
15
+ /**
16
+ * Replays the buffered frames after `since`, then subscribes. The replay is synchronous, so no frame
17
+ * can land in the gap.
18
+ */
19
+ subscribeFrom(key: string | null, since: number, listener: EventListener): () => void;
15
20
  publish(message: SseMessage): void;
21
+ private remember;
16
22
  private dispatch;
17
23
  }
@@ -6,81 +6,31 @@ export interface ExposureState {
6
6
  blockedReason: string | null;
7
7
  }
8
8
  /**
9
- * Exposing the panel beyond loopback is only allowed with authentication fully
10
- * configured — this is checked at startup, on every settings write, and shown in
11
- * the UI, so the three can never disagree.
12
- */
13
- export declare function checkExposure(control: ControlConfig, passwordSet: boolean, usingDefaultPassword?: boolean): ExposureState;
14
- /**
15
- * A route pointing at the panel puts it on the internet, which is the same
16
- * exposure the listener rule guards — so it answers to the same bar. Said here
17
- * rather than in the proxy service because that rule must not have two homes.
9
+ * Exposing the panel beyond loopback requires auth fully configured, including a long enough secret.
10
+ * The one rule for startup, every settings write and the UI. `passwordTooShort` is flagged at hashing
11
+ * time, since the hash cannot be measured afterwards.
18
12
  */
13
+ export declare function checkExposure(control: ControlConfig, passwordSet: boolean, usingDefaultPassword?: boolean, passwordTooShort?: boolean): ExposureState;
14
+ /** A proxy route to the panel is the same exposure as the listener, so it answers to the same bar. */
19
15
  export declare function checkProxyExposure(proxy: ProxyConfig, authEnabled: boolean, passwordSet: boolean, usingDefaultPassword?: boolean,
20
16
  /** The ports the panel listens on (live, and configured): an `external` route dialing one on this machine is a panel route. */
21
- panelPorts?: readonly number[]): string | null;
22
- /** What resolves one hostname: production reads the system resolver, a test substitutes its table. */
17
+ panelPorts?: readonly number[], passwordTooShort?: boolean): string | null;
23
18
  type UpstreamResolver = (host: string) => Promise<string[] | null>;
24
- /**
25
- * Replaces the resolver, and drops every cached answer.
26
- *
27
- * A seam for tests, like `forgetLanAddress()`: the alternative was patching `node:dns`, which the
28
- * named import in this module would not see — and a test that believes it stubbed DNS while the real
29
- * resolver answers is worse than no test.
30
- */
19
+ /** Test seam: replaces the resolver and drops every cached answer. */
31
20
  export declare function setUpstreamResolver(next?: UpstreamResolver): void;
32
21
  /**
33
- * Warms `dialsPanel`'s cache for every `external` upstream in a proxy config.
34
- *
35
- * The exposure predicate is synchronous because it is read from the save guards as well as from the
36
- * engine's apply path, and a save must not wait on DNS. The asynchronous half lives here: the paths
37
- * that can act on a route (a proxy save, a settings write, the engine's apply and sync) have an
38
- * `await` to spare, so they resolve first and the predicate reads the answer. A route whose host is
39
- * not resolved when the predicate runs is treated as pointing at the panel until it is — fail
40
- * closed, and the next reconcile has the answer.
22
+ * Warms `dialsPanel`'s cache for every `external` upstream. The predicate stays synchronous so a save
23
+ * never waits on DNS; the paths that can await resolve here first.
41
24
  */
42
25
  export declare function primeUpstreamResolutions(proxy: ProxyConfig): Promise<void>;
43
26
  /**
44
- * True when `upstream` names this machine on one of `panelPorts` — the panel's own listener.
45
- *
46
- * **The rule: a route points at the panel when its destination can be established as loopback.**
47
- * Two answers count as loopback — a literal loopback spelling, and a hostname whose resolution
48
- * includes a loopback address — and a third, deliberately, also counts: a name that does **not**
49
- * resolve. A destination the panel cannot establish is not evidence that it is harmless, and the
50
- * cost of the two mistakes is not symmetric: publishing a route that turns out to dial the panel
51
- * serves the whole panel to the internet with no credential, while refusing a route the person meant
52
- * to add is one save they retry once DNS is back.
53
- *
54
- * That inversion is the fix for the measured bypass. This predicate used to recognise literal
55
- * loopback only, so `http://panel.attacker.example:3999` with an A record of `127.0.0.1` — or
56
- * `127.0.0.1.nip.io` — was an ordinary `external` route: `checkProxyExposure` saw no panel route, the
57
- * engine published it, and the engine then dialled the panel from `127.0.0.1` with no forwarding
58
- * headers, which is exactly what `isLoopbackRequest` reads as this machine. Chasing names is not the
59
- * fix — a blocking list of spellings loses to the next spelling — so the question asked is "where
60
- * does this go", not "what is it called".
61
- *
62
- * `new URL` still normalizes the numeric spellings that need no resolver (`127.1`, `0`,
63
- * `2130706433`, `0x7f000001`, `[::1]`, `[::ffff:127.0.0.1]`), so those answer without DNS at all.
64
- * A non-loopback bind is already held to the listener rule (`checkExposure`), which is why an
65
- * interface address is not enumerated here.
66
- *
67
- * The lookup is served from the cache `primeUpstreamResolutions` fills; a name that has not been
68
- * resolved yet is treated as pointing at the panel, so this can read as over-strict for one reconcile
69
- * after a route is added — never as permissive.
27
+ * True when `upstream` names this machine on one of `panelPorts`. A name that does not resolve, or is
28
+ * not cached yet, counts too: wrongly publishing the panel is far worse than a refused save.
70
29
  */
71
30
  export declare function dialsPanel(upstream: string, panelPorts: readonly number[]): boolean;
72
31
  /**
73
- * A warning for the combination that makes the login lockout advisory.
74
- *
75
- * `trustProxy: true` tells srvx to trust `x-forwarded-*` from **any** peer, and it resolves the client
76
- * address from the leftmost entry of `x-forwarded-for` — a value the caller controls. Login failures are
77
- * keyed on that address, so a client that rotates the header never accumulates them: measured, 30 wrong
78
- * passwords from 30 forged addresses produced **zero** 429s, against 27 from a fixed address.
79
- *
80
- * This is a warning rather than a refusal because `true` has legitimate uses — a proxy on another host —
81
- * and, once the header is trusted, the real peer is not reachable through srvx (`#remoteAddress` is
82
- * private), so the panel cannot re-key the lockout on it. Prefer `host: local` with the proxy on this
83
- * machine, or leave `trustProxy` off and reach the panel directly.
32
+ * `trustProxy: true` takes the client address from a caller-controlled `x-forwarded-for`, so the
33
+ * per-address login lockout can be dodged. A warning, not a refusal: `true` has legitimate uses.
84
34
  */
85
35
  export declare function proxyTrustWarning(control: ControlConfig): string | null;
86
36
  export {};
@@ -1,11 +1,7 @@
1
1
  import type { HistoryEvent, ServerHistory } from '../shared/contracts.js';
2
2
  /**
3
- * Bounded event log per server, persisted as JSON so uptime and crash counts
4
- * survive a restart of the control plane.
5
- *
6
- * Uptime is derived from recorded runtimes (each exit stores how long the process
7
- * was up) rather than from sampling, so it stays accurate without a background
8
- * poller.
3
+ * Bounded event log per server, persisted as JSON. Uptime is derived from recorded runtimes (each
4
+ * exit stores how long the process was up) rather than from sampling.
9
5
  */
10
6
  export declare class HistoryStore {
11
7
  private readonly file;
@@ -19,15 +15,10 @@ export declare class HistoryStore {
19
15
  load(): void;
20
16
  record(serverId: string, event: Omit<HistoryEvent, 'serverId' | 'ts'>, ts?: number): void;
21
17
  all(): HistoryEvent[];
22
- /**
23
- * Drops every event for a server that no longer exists.
24
- *
25
- * An id is only unique *while* it exists. Nothing pruned on removal, so re-adding an id — a
26
- * rename-back, a restore, a config edit — inherited the old entry's crash time and event list, and
27
- * the card showed "Last crash" for a server that had never been started. Bounded (5000 events) so it
28
- * was never a leak, but wrong in the same way the log files were.
29
- */
18
+ /** Drops every event for a removed server, so a re-added id does not inherit its history. */
30
19
  forget(serverId: string): void;
20
+ /** When a server last recorded an event of one type, or `null`. */
21
+ lastEventAt(serverId: string, type: HistoryEvent['type']): number | null;
31
22
  /** `runningSince` adds the in-flight up-interval so a long-running server shows its real ratio. */
32
23
  summarize(serverId: string, windowMs: number, now?: number, runningSince?: number | null): ServerHistory;
33
24
  /** Flushes a pending save only: a store never read holds `[]`, and saving it would empty the file. */
@@ -11,23 +11,18 @@ export interface HostNotifier {
11
11
  export declare class HostMonitor {
12
12
  private readonly getConfig;
13
13
  private readonly resolvePath;
14
- /**
15
- * Every workspace's notification service: host vitals are panel-wide, so a
16
- * breach reaches each workspace that asked for host alerts.
17
- */
18
14
  private readonly notifications;
19
15
  private current;
16
+ private staleView;
20
17
  private lastSampleAt;
18
+ /** The breach kinds last notified: a new kind is news even while another is standing. */
21
19
  private alerting;
22
20
  private sampling;
23
- constructor(getConfig: () => HostConfig, resolvePath: (target: string) => string,
24
- /**
25
- * Every workspace's notification service: host vitals are panel-wide, so a
26
- * breach reaches each workspace that asked for host alerts.
27
- */
28
- notifications: HostNotifier | HostNotifier[]);
21
+ constructor(getConfig: () => HostConfig, resolvePath: (target: string) => string, notifications: HostNotifier | HostNotifier[]);
22
+ /** A stale sample (a sampler that stopped returning) is published as unsampled. */
29
23
  get view(): HostView;
30
24
  private notify;
31
- /** Cheap when the interval has not elapsed; safe to call every tick. */
32
25
  tick(now?: number): Promise<void>;
26
+ /** Records the standing breaches, announcing recovery when the last one clears. */
27
+ private settle;
33
28
  }
@@ -17,11 +17,7 @@ export interface InitResult {
17
17
  export declare function projectScripts(): Record<string, string>;
18
18
  /** `home-hosted` is pinned to the version that wrote the project, and open to newer ones. */
19
19
  export declare function projectManifest(name: string): string;
20
- /**
21
- * State is generated, so it stays out. The workspace definitions worth committing
22
- * (`.hh/settings.json`, `.hh/workspaces.json`, and each workspace's
23
- * `settings.json` + `servers.config.json`) are un-ignored explicitly.
24
- */
20
+ /** State stays out; the workspace definitions worth committing are un-ignored explicitly. */
25
21
  export declare function projectGitignore(): string;
26
22
  export declare function isEmptyDir(dir: string): boolean;
27
23
  /** Writes the project skeleton. Nothing is installed or initialized here. */
@@ -29,43 +25,17 @@ export declare function scaffold(options: InitOptions): InitResult;
29
25
  export declare const PACKAGE_MANAGERS: PackageManager[];
30
26
  /** The package manager this machine actually has, preferring pnpm. */
31
27
  export declare function detectPackageManager(exists: (command: string) => boolean): PackageManager;
32
- /** How to run one of the project's scripts with a given package manager. */
33
28
  export declare function runCommand(pm: PackageManager, script: string): string;
34
- /**
35
- * One line of `init`'s "Next:" block. A step is either a command to type or a prose line beneath
36
- * the one above it, and the two are kept apart so the block can be asserted without a terminal.
37
- */
29
+ /** One line of `init`'s "Next:" block: a command to type, or prose about the step above. */
38
30
  export interface NextStep {
39
- /** The command, already `cd`-prefixed; `null` when the line is prose about the step above. */
31
+ /** Already `cd`-prefixed; `null` when the line is prose about the step above. */
40
32
  command: string | null;
41
- /** What the command does, or the prose itself. */
42
33
  text: string;
43
34
  }
44
- /**
45
- * What `init` hands the person once the project is written.
46
- *
47
- * Built here rather than printed inline for two reasons, both measured. The install step was
48
- * missing under `--no-install`, so the scripts it went on to name answered `home-hosted: command
49
- * not found` (npm exits 127) — the one sequence the scaffold exists to hand over, broken at step
50
- * one. And the password hint named a page the UI does not have: the sidebar entry is **Global
51
- * settings**, and "Settings → Authentication" names nothing a person can click.
52
- */
53
35
  export declare function nextSteps(pm: PackageManager, install: boolean, cd: string): NextStep[];
54
- /**
55
- * The `cd` that reaches a scaffolded project, quoted for the shell it will be pasted into.
56
- *
57
- * The quoting rule is `shellQuote` (`helpers/shell.ts`), shared with every other string this
58
- * package prints for a person to copy: `init` printed `cd my servers && npm run up` for a directory
59
- * with a space, which the shell answers `cd: too many arguments` — an error naming a command the
60
- * person did not compose, on the one line the scaffold exists to hand them over.
61
- */
36
+ /** The `cd` that reaches a scaffolded project, quoted for the shell it will be pasted into. */
62
37
  export declare function cdCommand(where: string): string;
63
38
  /** Install arguments for a scaffolded project (the manifest already lists the dependency). */
64
39
  export declare function installArgs(pm: PackageManager): string[];
65
- /**
66
- * The install command as a person types it — `pnpm install`, `yarn` with no argument.
67
- *
68
- * Distinct from `runCommand`, which runs one of the project's **scripts**: `npm run install` is not
69
- * an install, it is a script named `install` that this manifest does not declare.
70
- */
40
+ /** The install command as typed (`yarn` takes no argument); not `runCommand`, which runs a script. */
71
41
  export declare function installCommand(pm: PackageManager): string;
@@ -0,0 +1,27 @@
1
+ import type { JobRun } from '../shared/contracts.js';
2
+ /** Runs kept per job; the oldest roll off. */
3
+ export declare const MAX_JOB_RUNS = 50;
4
+ /**
5
+ * Each job's durable run history, one JSONL file per job id (`<id>.runs.jsonl`). A run is written
6
+ * when it starts and again when it ends, so a run the panel never saw end is known after a restart
7
+ * (`interrupted`), and the scheduler's "when did this last run" survives one. Read once per job per
8
+ * process, then served from memory.
9
+ */
10
+ export declare class JobRunLedger {
11
+ private readonly dir;
12
+ /** Oldest first. */
13
+ private readonly cache;
14
+ constructor(dir: string);
15
+ /** Newest first. */
16
+ runs(id: string): JobRun[];
17
+ run(id: string, runId: string): JobRun | null;
18
+ latest(id: string): JobRun | null;
19
+ latestFinished(id: string): JobRun | null;
20
+ /** Writes a new run or a later state of one (matched by `runId`). */
21
+ record(id: string, run: JobRun): void;
22
+ /** Drops a removed job's history, so a re-declared id starts clean. */
23
+ forget(id: string): void;
24
+ private file;
25
+ private load;
26
+ private save;
27
+ }
@@ -0,0 +1,113 @@
1
+ import type { JobConfig, JobCreate, JobEntryView, JobRun, JobRunDetail, JobTrigger, LogLine, LogsConfig } from '../shared/contracts.js';
2
+ export interface JobsServiceOptions {
3
+ workspaceId: string;
4
+ /** Where the jobs file is; passed rather than via `HHOSTED_HOME`, since `dataRoot` is fixed at import. */
5
+ file?: string;
6
+ /** The workspace's `logs` group; omitted, the contract's defaults. `persist` is ignored: a job's output is always kept. */
7
+ logs?: () => LogsConfig;
8
+ /** The log directory; omitted, the workspace's own job-log directory. */
9
+ logDir?: string;
10
+ /** Where each job's run history lives; omitted, `<workspace>/.state/jobs`. */
11
+ stateDir?: string;
12
+ /** Watch the jobs file for hand edits (default `true`). */
13
+ watch?: boolean;
14
+ onStateChange?: () => void;
15
+ /** A run ended: the caller notifies on failure. */
16
+ onRunFinished?: (job: JobConfig, run: JobRun) => void;
17
+ /** A job's stored secret values (only names in its `secretEnv` are ever used — consent), and their removal. */
18
+ secrets?: {
19
+ read: (jobId: string) => Record<string, string>;
20
+ forget: (jobId: string) => void;
21
+ };
22
+ }
23
+ export type StartResult = {
24
+ ok: true;
25
+ runId: string;
26
+ finished: Promise<JobRun>;
27
+ } | {
28
+ ok: false;
29
+ reason: 'unknown' | 'running' | 'stopped';
30
+ };
31
+ export declare class JobsService {
32
+ private readonly options;
33
+ private readonly store;
34
+ private readonly ledger;
35
+ private readonly scheduler;
36
+ /** One file per job id, in a directory of its own: job and server ids are separate namespaces. */
37
+ private readonly logs;
38
+ private readonly watch;
39
+ private readonly running;
40
+ /** `nextRunAt` per expression, recomputed when the minute changes: the view is built every second. */
41
+ private nextBySchedule;
42
+ private nextMinute;
43
+ private reportedFileError;
44
+ private disposed;
45
+ constructor(options: JobsServiceOptions);
46
+ /** The jobs file actually in use — a backup captures this, not a path re-derived from the id. */
47
+ get path(): string;
48
+ /** Why the jobs file cannot be read as a whole; `null` when it can. */
49
+ get fileError(): string | null;
50
+ /** Every entry, broken ones included, from memory: the state frame calls this every second. */
51
+ list(now?: number): JobEntryView[];
52
+ viewOf(id: string): JobEntryView | null;
53
+ /** A runnable job, or `null` (unknown or broken). */
54
+ get(id: string): JobConfig | null;
55
+ /** Whether the file has an entry with this id, runnable or not. */
56
+ has(id: string): boolean;
57
+ /** Re-reads the jobs file if it changed on disk (a hand edit, a restore). */
58
+ reload(): void;
59
+ create(input: JobCreate): JobEntryView;
60
+ /** `null` when no job has the id. */
61
+ update(id: string, patch: Record<string, unknown>): JobEntryView | null;
62
+ /**
63
+ * Removes a job and everything kept under its id: a run in flight is stopped first (bounded), then
64
+ * the entry, its run history, its log and its stored secrets go, so a re-declared id starts clean.
65
+ */
66
+ remove(id: string): Promise<boolean>;
67
+ /** Starts a run now and answers at once; `finished` resolves (never rejects) when it ends. */
68
+ start(id: string, trigger?: JobTrigger, scheduledFor?: number): StartResult;
69
+ /** Starts a run and waits for it; `null` when it could not start. For tests and the CLI's wait. */
70
+ run(id: string, trigger?: JobTrigger): Promise<JobRun | null>;
71
+ /** Ends the run in flight; `false` when nothing was running. */
72
+ stop(id: string): Promise<boolean>;
73
+ isRunning(id: string): boolean;
74
+ /** A job's runs, newest first. */
75
+ runs(id: string): JobRun[];
76
+ /** One run and the lines it wrote, found by its time window: one run at a time per job. */
77
+ runDetail(id: string, runId: string): Promise<JobRunDetail | null>;
78
+ /** A job's own log, newest last. */
79
+ readLog(id: string, tail: number): Promise<LogLine[]>;
80
+ logInfo(id: string): {
81
+ enabled: boolean;
82
+ sizeBytes: number;
83
+ files: Array<{
84
+ name: string;
85
+ sizeBytes: number;
86
+ }>;
87
+ directory: string;
88
+ };
89
+ /** The path a person would open on disk, whether or not a run has written one yet. */
90
+ logPath(id: string): string;
91
+ /** One scheduler pass — the panel's own 1 Hz tick. */
92
+ tick(now?: number): void;
93
+ /** Stops every run (bounded), then closes the logs: a run's last lines are written before they close. */
94
+ shutdown(deadlineMs?: number): Promise<void>;
95
+ /** The synchronous fallback when `shutdown` was not awaited: runs are signalled, not waited for. */
96
+ dispose(): void;
97
+ private stopWithin;
98
+ private execute;
99
+ private view;
100
+ private history;
101
+ private nextRunAt;
102
+ /** Which of a job's declared names have a stored value — sorted, and **never** the values. */
103
+ private secretEnvSet;
104
+ /** A job's own env and argv: no `port`, `bind` or `envFile`, so only the template vars it can have. */
105
+ private resolve;
106
+ /** Output goes to the job's own file; only the system lines also go to the panel log. */
107
+ private log;
108
+ /** A file that cannot be read is logged when it breaks and when its reason changes, not every tick. */
109
+ private reportFileError;
110
+ /** Something the view shows changed outside this service (a job's stored secrets). */
111
+ notifyChanged(): void;
112
+ private changed;
113
+ }
@@ -1,4 +1,4 @@
1
- import type { Buffer } from 'node:buffer';
1
+ import type { Buffer } from '../node-compat.js';
2
2
  import type { LogLine, LogStream } from '../shared/contracts.js';
3
3
  /** Fixed-capacity line buffer; oldest lines are dropped first. */
4
4
  export declare class LogBuffer {
@@ -6,13 +6,16 @@ export declare class LogBuffer {
6
6
  private lines;
7
7
  /** Characters held, so the byte ceiling never needs a rescan. */
8
8
  private chars;
9
+ /** The newest stderr lines, kept past the ring's own eviction: they are a crash's most likely cause. */
10
+ private stderr;
9
11
  constructor(capacity: number);
10
12
  push(line: LogLine): void;
11
- /** Removes the oldest `count` lines and keeps `chars` in step with them. */
12
13
  private dropOldest;
13
14
  extend(lines: LogLine[]): void;
14
15
  list(limit?: number): LogLine[];
15
16
  clear(): void;
17
+ /** Up to the last few stderr lines, oldest first. */
18
+ get recentStderr(): readonly LogLine[];
16
19
  get size(): number;
17
20
  }
18
21
  /**
@@ -28,12 +31,8 @@ export declare class LineSplitter {
28
31
  push(stream: LogStream, chunk: string | Buffer): void;
29
32
  flush(stream: LogStream): void;
30
33
  /**
31
- * Throws away a held partial line, because the bytes that would have finished it are gone.
32
- *
33
- * Only the file-transport reader calls this, when it drops a backlog: it discards from a byte
34
- * offset, so whatever half-line it was holding can never be completed by what follows. Keeping it
35
- * would splice the fragment onto the first surviving line and emit text the child never wrote —
36
- * corrupted output presented as real, which is worse than the gap it was meant to describe.
34
+ * Throws away a held partial line after a dropped backlog, so the fragment is not spliced onto the
35
+ * first surviving line.
37
36
  */
38
37
  discard(): void;
39
38
  }
@@ -3,17 +3,22 @@ export interface LogFileInfo {
3
3
  name: string;
4
4
  sizeBytes: number;
5
5
  }
6
+ export interface AppendOptions {
7
+ /** `false` while another process (a persistent entry's nanny) owns this file's rotation. */
8
+ rotate?: boolean;
9
+ }
6
10
  export declare class LogFiles {
7
11
  private readonly dir;
8
12
  private readonly getConfig;
9
13
  private readonly pending;
14
+ private readonly noRotate;
10
15
  private timer;
11
16
  private closed;
12
17
  constructor(dir: string, getConfig: () => LogsConfig);
13
18
  get directory(): string;
14
19
  /** The retention a nanny has to apply itself, on the same files. */
15
20
  get config(): LogsConfig;
16
- append(serverId: string, line: LogLine): void;
21
+ append(serverId: string, line: LogLine, options?: AppendOptions): void;
17
22
  flush(): void;
18
23
  info(serverId: string): {
19
24
  enabled: boolean;
@@ -21,57 +26,22 @@ export declare class LogFiles {
21
26
  files: LogFileInfo[];
22
27
  };
23
28
  /**
24
- * Reads the last `tail` lines, newest file first, padding from the rotations behind it.
25
- *
26
- * With `persist` off there is nothing this panel is willing to serve, even though a
27
- * persistent entry's nanny still writes its file: that file is the log's transport —
28
- * there is no pipe to carry it — and `persist` decides what counts as history.
29
- *
30
- * Every *retained* file is a source, not just `.1`: `keep` is the number of rotations the
31
- * person asked to keep, so a 5000-line window over a 10 MB rotation could not be filled by
32
- * the current file and `.1` alone. It read two of eleven files and returned "no matches" for
33
- * a line that was on disk — a search that answers "nothing found" while the log holds the
34
- * match is worse than a shorter window.
29
+ * Reads the last `tail` lines across every retained file, newest first. With `persist` off nothing
30
+ * is served, even though a persistent entry's nanny still writes its file as the log's transport.
35
31
  */
36
32
  readTail(serverId: string, tail: number): Promise<LogLine[]>;
37
33
  clear(serverId: string): void;
38
- /**
39
- * Drops rotations above the current `keep`, for every server, now.
40
- *
41
- * `rotate` prunes too, but it only runs when a file fills — which on a quiet entry can be days
42
- * after the person lowered the ceiling. A retention setting that takes effect "eventually, once
43
- * the server is chatty enough" is not the promise the page makes, so the settings save calls
44
- * this directly.
45
- */
34
+ /** Drops rotations above the current `keep`, for every server, now — not only on the next rotation. */
46
35
  prune(): void;
47
36
  dispose(): void;
48
37
  private write;
49
- /**
50
- * Drops this id's rotations numbered above `keep`.
51
- *
52
- * They are left over from a higher ceiling (or an older release). Renaming up only ever shifts
53
- * them further out of reach, so they have to be removed outright: a retention setting is a
54
- * promise about the directory, not about a rename loop.
55
- */
38
+ /** Drops this id's rotations numbered above `keep`, left over from a higher ceiling. */
56
39
  private pruneServer;
57
40
  private rotate;
58
41
  private currentPath;
59
42
  private rotatedPath;
60
- /**
61
- * Every file this id owns on disk, newest first, found by reading the directory.
62
- *
63
- * The count comes from the directory rather than from `keep` because the two disagree the
64
- * moment a person lowers it: `rotate` only renames *up* to the new ceiling, so it never removes
65
- * the rotations numbered above it. Those files stayed, were invisible to `info()`, were served
66
- * by no reader, and survived a `clear` — growth the retention setting promised to bound, in
67
- * files nothing would ever show. Reading the directory is also what makes them prunable.
68
- */
43
+ /** Every file this id owns on disk, newest first — from the directory, not `keep`, which can lag it. */
69
44
  private ownedFiles;
70
- /**
71
- * The files `keep` still covers, newest first — what `info` lists and what a tail may read.
72
- *
73
- * The current file is always first and never counted against `keep`, which is what the UI
74
- * promises ("before rolling to .1, .2, …").
75
- */
45
+ /** The files `keep` still covers, newest first; the current file is never counted against `keep`. */
76
46
  private retained;
77
47
  }
@@ -10,23 +10,13 @@ export declare class LogRelay {
10
10
  private closed;
11
11
  constructor(options: LogRelayOptions);
12
12
  /**
13
- * Idempotent: following the same file again keeps the position already read.
14
- *
15
- * With `backfill`, the last lines already on disk are returned *and* the live position
16
- * is set past them by the same tailer, so the caller can fill a buffer without a line
17
- * being both history and news. Without it, the live stream simply starts at the end.
13
+ * Idempotent. With `backfill`, the last lines on disk are returned and the live position is set
14
+ * past them by the same tailer, so no line is both history and news.
18
15
  */
19
16
  follow(serverId: string, file: string, options?: {
20
17
  backfill?: number;
21
18
  }): LogLine[];
22
- /**
23
- * Stops following and hands back whatever the file still held unread.
24
- *
25
- * A nanny writes its last lines and exits in the same breath, so the tailer can be
26
- * dropped between two polls with its final lines — the child's crash output — still
27
- * on disk. Losing them here is what made a persistent entry's crash silent in the
28
- * panel, so the caller gets them to ingest rather than an empty hand.
29
- */
19
+ /** Stops following and hands back what is still unread — often the child's crash output. */
30
20
  unfollow(serverId: string): LogLine[];
31
21
  dispose(): void;
32
22
  private start;
@@ -1,14 +1,7 @@
1
1
  import type { NannySpec } from '../shared/contracts.js';
2
2
  /**
3
- * The nanny of one persistent entry: it spawns the child, owns its pipes, writes its
4
- * output to the entry's JSONL log and mirrors the child's exit.
5
- *
6
- * This is the whole reason a persistent entry survives the panel. The pipes belong to
7
- * a process that is not the panel, so a panel stop, restart or SIGKILL cannot break
8
- * them; the log keeps being written; and the exit code the panel would have collected
9
- * as a parent is left in the state file for whoever comes back.
10
- *
11
- * It deliberately does *not* restart anything: retries, backoff and health stay the
12
- * panel's business, so there is only ever one supervisor making that decision.
3
+ * The nanny of one persistent entry: it spawns the child, owns its pipes (so a panel stop or SIGKILL
4
+ * cannot break them), writes its log and leaves the exit in the state file. It never restarts
5
+ * anything: retries, backoff and health stay the panel's business.
13
6
  */
14
7
  export declare function runNanny(spec: NannySpec, statePath: string): Promise<void>;