home-hosted 0.10.3 → 0.12.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 (317) hide show
  1. package/README.md +273 -628
  2. package/dist/chunks/archive-DpCwA8Nf.js +339 -0
  3. package/dist/chunks/archive-DpCwA8Nf.js.map +1 -0
  4. package/dist/chunks/atomic-CEfCUfkQ.js +25 -0
  5. package/dist/chunks/atomic-CEfCUfkQ.js.map +1 -0
  6. package/dist/chunks/backup-CPrJVPJI.js +797 -0
  7. package/dist/chunks/backup-CPrJVPJI.js.map +1 -0
  8. package/dist/chunks/backups-Bd2SF2qd.js +4346 -0
  9. package/dist/chunks/backups-Bd2SF2qd.js.map +1 -0
  10. package/dist/chunks/config-text-DifCHhnz.js +50 -0
  11. package/dist/chunks/config-text-DifCHhnz.js.map +1 -0
  12. package/dist/chunks/contracts-ku5ypHXJ.js +2256 -0
  13. package/dist/chunks/contracts-ku5ypHXJ.js.map +1 -0
  14. package/dist/chunks/daemon-TwXk5vb8.js +215 -0
  15. package/dist/chunks/daemon-TwXk5vb8.js.map +1 -0
  16. package/dist/chunks/daemon-log-BVj8cDEo.js +241 -0
  17. package/dist/chunks/daemon-log-BVj8cDEo.js.map +1 -0
  18. package/dist/chunks/docker-CGv4Uv7w.js +436 -0
  19. package/dist/chunks/docker-CGv4Uv7w.js.map +1 -0
  20. package/dist/chunks/down-BlX5X3bm.js +378 -0
  21. package/dist/chunks/down-BlX5X3bm.js.map +1 -0
  22. package/dist/chunks/init-DdmqHVra.js +263 -0
  23. package/dist/chunks/init-DdmqHVra.js.map +1 -0
  24. package/dist/chunks/last-stop-BZ08Z89-.js +52 -0
  25. package/dist/chunks/last-stop-BZ08Z89-.js.map +1 -0
  26. package/dist/chunks/layout-D74TGUnr.js +24 -0
  27. package/dist/chunks/layout-D74TGUnr.js.map +1 -0
  28. package/dist/chunks/log-buffer-HnP0jKhZ.js +350 -0
  29. package/dist/chunks/log-buffer-HnP0jKhZ.js.map +1 -0
  30. package/dist/chunks/logger-B5U4GD3j.js +13 -0
  31. package/dist/chunks/logger-B5U4GD3j.js.map +1 -0
  32. package/dist/chunks/logs-gI_69Q1P.js +265 -0
  33. package/dist/chunks/logs-gI_69Q1P.js.map +1 -0
  34. package/dist/chunks/migrate-BTlsibvF.js +155 -0
  35. package/dist/chunks/migrate-BTlsibvF.js.map +1 -0
  36. package/dist/chunks/nanny-20aBXL1o.js +1069 -0
  37. package/dist/chunks/nanny-20aBXL1o.js.map +1 -0
  38. package/dist/chunks/nanny-CjnnrIpm.js +132 -0
  39. package/dist/chunks/nanny-CjnnrIpm.js.map +1 -0
  40. package/dist/chunks/nanny-DUaAfCV-.js +39 -0
  41. package/dist/chunks/nanny-DUaAfCV-.js.map +1 -0
  42. package/dist/chunks/nanny-sweep-Ca9kPAVi.js +104 -0
  43. package/dist/chunks/nanny-sweep-Ca9kPAVi.js.map +1 -0
  44. package/dist/chunks/nearest-6KgQEDUe.js +41 -0
  45. package/dist/chunks/nearest-6KgQEDUe.js.map +1 -0
  46. package/dist/chunks/parse-B9owE47G.js +383 -0
  47. package/dist/chunks/parse-B9owE47G.js.map +1 -0
  48. package/dist/chunks/paths-BT94q6-w.js +172 -0
  49. package/dist/chunks/paths-BT94q6-w.js.map +1 -0
  50. package/dist/chunks/port-B8WBTRMk.js +333 -0
  51. package/dist/chunks/port-B8WBTRMk.js.map +1 -0
  52. package/dist/chunks/restart-UZgeDukG.js +126 -0
  53. package/dist/chunks/restart-UZgeDukG.js.map +1 -0
  54. package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
  55. package/dist/chunks/schema-o7Lgk0V1.js +102 -0
  56. package/dist/chunks/schema-o7Lgk0V1.js.map +1 -0
  57. package/dist/chunks/secrets-D7PdYh71.js +544 -0
  58. package/dist/chunks/secrets-D7PdYh71.js.map +1 -0
  59. package/dist/chunks/server-BuIeSsRu.js +169 -0
  60. package/dist/chunks/server-BuIeSsRu.js.map +1 -0
  61. package/dist/chunks/server-ids-DRuNLVCV.js +32 -0
  62. package/dist/chunks/server-ids-DRuNLVCV.js.map +1 -0
  63. package/dist/chunks/set-password-DegMumPh.js +43 -0
  64. package/dist/chunks/set-password-DegMumPh.js.map +1 -0
  65. package/dist/chunks/set-token-21d1FTDC.js +78 -0
  66. package/dist/chunks/set-token-21d1FTDC.js.map +1 -0
  67. package/dist/chunks/settings-BVSBnIwJ.js +332 -0
  68. package/dist/chunks/settings-BVSBnIwJ.js.map +1 -0
  69. package/dist/chunks/setup-temp-XiuAtiW2.js +150 -0
  70. package/dist/chunks/setup-temp-XiuAtiW2.js.map +1 -0
  71. package/dist/chunks/shape-DnTKzjQ2.js +24 -0
  72. package/dist/chunks/shape-DnTKzjQ2.js.map +1 -0
  73. package/dist/chunks/src-BL97vLVb.js +11153 -0
  74. package/dist/chunks/src-BL97vLVb.js.map +1 -0
  75. package/dist/chunks/status-EuWdRq8Q.js +119 -0
  76. package/dist/chunks/status-EuWdRq8Q.js.map +1 -0
  77. package/dist/chunks/ui-DbPuwddJ.js +323 -0
  78. package/dist/chunks/ui-DbPuwddJ.js.map +1 -0
  79. package/dist/chunks/ui-dir-CsU3uLNV.js +39 -0
  80. package/dist/chunks/ui-dir-CsU3uLNV.js.map +1 -0
  81. package/dist/chunks/ui-release-DKzVvlLd.js +312 -0
  82. package/dist/chunks/ui-release-DKzVvlLd.js.map +1 -0
  83. package/dist/chunks/ui-revert-BhqOAhmM.js +27 -0
  84. package/dist/chunks/ui-revert-BhqOAhmM.js.map +1 -0
  85. package/dist/chunks/ui-switch-CMoslPO2.js +150 -0
  86. package/dist/chunks/ui-switch-CMoslPO2.js.map +1 -0
  87. package/dist/chunks/ui-update-TTBBoDik.js +272 -0
  88. package/dist/chunks/ui-update-TTBBoDik.js.map +1 -0
  89. package/dist/chunks/up-C4H13hBw.js +196 -0
  90. package/dist/chunks/up-C4H13hBw.js.map +1 -0
  91. package/dist/chunks/usage-CSBgLRN5.js +85 -0
  92. package/dist/chunks/usage-CSBgLRN5.js.map +1 -0
  93. package/dist/chunks/workspaces-CAln2sQ7.js +221 -0
  94. package/dist/chunks/workspaces-CAln2sQ7.js.map +1 -0
  95. package/dist/chunks/wsl-temperature-BiCI4iK6.js +322 -0
  96. package/dist/chunks/wsl-temperature-BiCI4iK6.js.map +1 -0
  97. package/dist/cli.js +229 -24861
  98. package/dist/cli.js.map +1 -1
  99. package/dist/client.js +120 -0
  100. package/dist/client.js.map +1 -0
  101. package/dist/types/api/acme.d.ts +24 -0
  102. package/dist/types/api/auth/$.routes.d.ts +103 -0
  103. package/dist/types/api/backups.d.ts +179 -0
  104. package/dist/types/api/control.d.ts +469 -0
  105. package/dist/types/api/ddns.d.ts +432 -0
  106. package/dist/types/api/events.d.ts +21 -0
  107. package/dist/types/api/health.d.ts +27 -0
  108. package/dist/types/api/logs.d.ts +95 -0
  109. package/dist/types/api/metrics.d.ts +19 -0
  110. package/dist/types/api/notifications.d.ts +141 -0
  111. package/dist/types/api/proxy.d.ts +1128 -0
  112. package/dist/types/api/servers/$.routes.d.ts +1318 -0
  113. package/dist/types/api/settings.d.ts +642 -0
  114. package/dist/types/api/state.d.ts +492 -0
  115. package/dist/types/api/static.d.ts +11 -0
  116. package/dist/types/api/tls.d.ts +112 -0
  117. package/dist/types/api/workspaces/$.routes.d.ts +797 -0
  118. package/dist/types/api/wsl-temperature.d.ts +113 -0
  119. package/dist/types/app.d.ts +6080 -0
  120. package/dist/types/cli/args.d.ts +75 -0
  121. package/dist/types/cli/backup-offline.d.ts +23 -0
  122. package/dist/types/cli/backup.d.ts +79 -0
  123. package/dist/types/cli/down.d.ts +75 -0
  124. package/dist/types/cli/init.d.ts +60 -0
  125. package/dist/types/cli/io.d.ts +65 -0
  126. package/dist/types/cli/logs.d.ts +64 -0
  127. package/dist/types/cli/migrate.d.ts +33 -0
  128. package/dist/types/cli/nanny.d.ts +19 -0
  129. package/dist/types/cli/nearest.d.ts +10 -0
  130. package/dist/types/cli/restart.d.ts +42 -0
  131. package/dist/types/cli/server.d.ts +68 -0
  132. package/dist/types/cli/set-password.d.ts +14 -0
  133. package/dist/types/cli/set-token.d.ts +21 -0
  134. package/dist/types/cli/setup-temp.d.ts +65 -0
  135. package/dist/types/cli/status.d.ts +14 -0
  136. package/dist/types/cli/ui-revert.d.ts +3 -0
  137. package/dist/types/cli/ui-switch.d.ts +27 -0
  138. package/dist/types/cli/ui-update.d.ts +72 -0
  139. package/dist/types/cli/up.d.ts +90 -0
  140. package/dist/types/cli/usage.d.ts +23 -0
  141. package/dist/types/cli.d.ts +12 -0
  142. package/dist/types/client.d.ts +6284 -0
  143. package/dist/types/config/layout.d.ts +11 -0
  144. package/dist/types/config/migrations.d.ts +69 -0
  145. package/dist/types/config/parse.d.ts +54 -0
  146. package/dist/types/config/patch.d.ts +20 -0
  147. package/dist/types/config/schema.d.ts +318 -0
  148. package/dist/types/config/secret-parts.d.ts +48 -0
  149. package/dist/types/config/secrets.d.ts +206 -0
  150. package/dist/types/config/seed.d.ts +30 -0
  151. package/dist/types/config/server-ids.d.ts +14 -0
  152. package/dist/types/config/settings.d.ts +74 -0
  153. package/dist/types/config/store.d.ts +132 -0
  154. package/dist/types/config/workspaces.d.ts +96 -0
  155. package/dist/types/helpers/action-result.d.ts +46 -0
  156. package/dist/types/helpers/atomic.d.ts +9 -0
  157. package/dist/types/helpers/backoff.d.ts +7 -0
  158. package/dist/types/helpers/bind.d.ts +16 -0
  159. package/dist/types/helpers/config-text.d.ts +23 -0
  160. package/dist/types/helpers/cookies.d.ts +19 -0
  161. package/dist/types/helpers/copy-tree.d.ts +15 -0
  162. package/dist/types/helpers/daemon-log.d.ts +45 -0
  163. package/dist/types/helpers/daemon.d.ts +122 -0
  164. package/dist/types/helpers/deferred.d.ts +7 -0
  165. package/dist/types/helpers/env-file.d.ts +20 -0
  166. package/dist/types/helpers/error.d.ts +18 -0
  167. package/dist/types/helpers/factory.d.ts +6 -0
  168. package/dist/types/helpers/last-stop.d.ts +20 -0
  169. package/dist/types/helpers/logger.d.ts +7 -0
  170. package/dist/types/helpers/open.d.ts +2 -0
  171. package/dist/types/helpers/openapi.d.ts +46 -0
  172. package/dist/types/helpers/paths.d.ts +94 -0
  173. package/dist/types/helpers/restore-lock.d.ts +32 -0
  174. package/dist/types/helpers/runtime.d.ts +18 -0
  175. package/dist/types/helpers/secret-compare.d.ts +13 -0
  176. package/dist/types/helpers/shell.d.ts +19 -0
  177. package/dist/types/helpers/sse.d.ts +23 -0
  178. package/dist/types/helpers/template.d.ts +8 -0
  179. package/dist/types/helpers/ui-dir.d.ts +11 -0
  180. package/dist/types/helpers/validate.d.ts +7 -0
  181. package/dist/types/helpers/validator.d.ts +12 -0
  182. package/dist/types/helpers/version.d.ts +10 -0
  183. package/dist/types/helpers/workspace.d.ts +25 -0
  184. package/dist/types/index.d.ts +17 -0
  185. package/dist/types/middleware/auth.d.ts +37 -0
  186. package/dist/types/middleware/host.d.ts +29 -0
  187. package/dist/types/middleware/loopback.d.ts +18 -0
  188. package/dist/types/openapi-reference.d.ts +22 -0
  189. package/dist/types/openapi.d.ts +34 -0
  190. package/dist/types/providers/archive.d.ts +54 -0
  191. package/dist/types/providers/backup-hook.d.ts +34 -0
  192. package/dist/types/providers/ddns/cloudflare.d.ts +2 -0
  193. package/dist/types/providers/ddns/desec.d.ts +2 -0
  194. package/dist/types/providers/ddns/digitalocean.d.ts +2 -0
  195. package/dist/types/providers/ddns/duckdns.d.ts +2 -0
  196. package/dist/types/providers/ddns/dyndns2.d.ts +15 -0
  197. package/dist/types/providers/ddns/dynu.d.ts +2 -0
  198. package/dist/types/providers/ddns/freedns.d.ts +2 -0
  199. package/dist/types/providers/ddns/gandi.d.ts +2 -0
  200. package/dist/types/providers/ddns/godaddy.d.ts +2 -0
  201. package/dist/types/providers/ddns/henet.d.ts +3 -0
  202. package/dist/types/providers/ddns/index.d.ts +12 -0
  203. package/dist/types/providers/ddns/ip.d.ts +27 -0
  204. package/dist/types/providers/ddns/namecheap-api.d.ts +13 -0
  205. package/dist/types/providers/ddns/namecheap.d.ts +6 -0
  206. package/dist/types/providers/ddns/noip.d.ts +2 -0
  207. package/dist/types/providers/ddns/porkbun.d.ts +2 -0
  208. package/dist/types/providers/ddns/spaceship.d.ts +7 -0
  209. package/dist/types/providers/ddns/types.d.ts +98 -0
  210. package/dist/types/providers/ddns/zone.d.ts +11 -0
  211. package/dist/types/providers/docker.d.ts +117 -0
  212. package/dist/types/providers/entry-state.d.ts +15 -0
  213. package/dist/types/providers/health-check.d.ts +27 -0
  214. package/dist/types/providers/host.d.ts +147 -0
  215. package/dist/types/providers/identity.d.ts +54 -0
  216. package/dist/types/providers/log-tail.d.ts +29 -0
  217. package/dist/types/providers/nanny-sweep.d.ts +51 -0
  218. package/dist/types/providers/nanny.d.ts +94 -0
  219. package/dist/types/providers/port.d.ts +142 -0
  220. package/dist/types/providers/proc.d.ts +116 -0
  221. package/dist/types/providers/process.d.ts +61 -0
  222. package/dist/types/providers/proxy/caddy.d.ts +2 -0
  223. package/dist/types/providers/proxy/index.d.ts +7 -0
  224. package/dist/types/providers/proxy/types.d.ts +54 -0
  225. package/dist/types/providers/server-vars.d.ts +4 -0
  226. package/dist/types/providers/telegram.d.ts +32 -0
  227. package/dist/types/providers/ui-release.d.ts +113 -0
  228. package/dist/types/providers/webhook.d.ts +64 -0
  229. package/dist/types/providers/wsl-temperature.d.ts +69 -0
  230. package/dist/types/services/acme-challenge.d.ts +44 -0
  231. package/dist/types/services/auth.d.ts +145 -0
  232. package/dist/types/services/backups.d.ts +352 -0
  233. package/dist/types/services/config-watch.d.ts +40 -0
  234. package/dist/types/services/control-server.d.ts +58 -0
  235. package/dist/types/services/ddns.d.ts +67 -0
  236. package/dist/types/services/dependencies.d.ts +21 -0
  237. package/dist/types/services/events.d.ts +17 -0
  238. package/dist/types/services/exposure.d.ts +33 -0
  239. package/dist/types/services/history.d.ts +36 -0
  240. package/dist/types/services/host-monitor.d.ts +32 -0
  241. package/dist/types/services/init.d.ts +71 -0
  242. package/dist/types/services/log-buffer.d.ts +28 -0
  243. package/dist/types/services/log-files.d.ts +87 -0
  244. package/dist/types/services/log-relay.d.ts +36 -0
  245. package/dist/types/services/nanny.d.ts +14 -0
  246. package/dist/types/services/notifications.d.ts +124 -0
  247. package/dist/types/services/panel.d.ts +194 -0
  248. package/dist/types/services/proxy-config.d.ts +83 -0
  249. package/dist/types/services/proxy.d.ts +454 -0
  250. package/dist/types/services/state.d.ts +41 -0
  251. package/dist/types/services/supervisor/compose.d.ts +17 -0
  252. package/dist/types/services/supervisor/entry.d.ts +139 -0
  253. package/dist/types/services/supervisor/health.d.ts +55 -0
  254. package/dist/types/services/supervisor/pending-load.d.ts +6 -0
  255. package/dist/types/services/supervisor/persistent.d.ts +55 -0
  256. package/dist/types/services/supervisor/port-preflight.d.ts +45 -0
  257. package/dist/types/services/supervisor/records.d.ts +38 -0
  258. package/dist/types/services/supervisor/spawn.d.ts +15 -0
  259. package/dist/types/services/supervisor/view.d.ts +4 -0
  260. package/dist/types/services/supervisor.d.ts +113 -0
  261. package/dist/types/services/tls.d.ts +48 -0
  262. package/dist/types/services/ui-update.d.ts +44 -0
  263. package/dist/types/services/ui.d.ts +50 -0
  264. package/dist/types/shared/api-client.d.ts +137 -0
  265. package/dist/types/shared/backup-scope.d.ts +109 -0
  266. package/dist/types/shared/clone.d.ts +14 -0
  267. package/dist/types/shared/contracts.d.ts +4233 -0
  268. package/dist/types/shared/cpu-scale.d.ts +25 -0
  269. package/dist/types/shared/ddns-form.d.ts +62 -0
  270. package/dist/types/shared/endpoint.d.ts +8 -0
  271. package/dist/types/shared/error-message.d.ts +8 -0
  272. package/dist/types/shared/fields.d.ts +21 -0
  273. package/dist/types/shared/generated.d.ts +26 -0
  274. package/dist/types/shared/host-readings.d.ts +185 -0
  275. package/dist/types/shared/patch-diff.d.ts +94 -0
  276. package/dist/types/shared/probe-latency.d.ts +25 -0
  277. package/dist/types/shared/proxy-form.d.ts +182 -0
  278. package/dist/types/shared/server-attention.d.ts +37 -0
  279. package/dist/types/shared/server-key.d.ts +13 -0
  280. package/dist/types/shared/server-readings.d.ts +55 -0
  281. package/dist/types/shared/server-url.d.ts +43 -0
  282. package/dist/types/shared/shape.d.ts +17 -0
  283. package/dist/types/shared/ui-format.d.ts +89 -0
  284. package/docs/API.md +180 -0
  285. package/docs/BACKUPS.md +97 -0
  286. package/docs/CLI.md +122 -0
  287. package/docs/DDNS.md +12 -3
  288. package/docs/NOTIFICATIONS.md +3 -1
  289. package/docs/RESTORE_DEMO.md +6 -4
  290. package/docs/REVERSE_PROXY.md +2 -2
  291. package/docs/SECURITY.md +82 -0
  292. package/docs/SERVERS.md +47 -15
  293. package/docs/UI_CREATION.md +82 -286
  294. package/package.json +18 -9
  295. package/uis/stock/dist/assets/de-DyGrM1KK.js +1 -0
  296. package/uis/stock/dist/assets/es-BebHdc0E.js +1 -0
  297. package/uis/stock/dist/assets/fr-DsDTrxhI.js +1 -0
  298. package/uis/stock/dist/assets/index-6LANO2Ua.css +2 -0
  299. package/uis/stock/dist/assets/index-D06cUZbM.js +56 -0
  300. package/uis/stock/dist/assets/ja-D3RARJjW.js +1 -0
  301. package/uis/stock/dist/assets/ko-CKI3dFoD.js +1 -0
  302. package/uis/stock/dist/assets/ru-DEU5ujXt.js +1 -0
  303. package/uis/stock/dist/assets/vi-ULKPnasj.js +1 -0
  304. package/uis/stock/dist/assets/zh-CN-tCvnOxWy.js +1 -0
  305. package/uis/stock/dist/index.html +2 -2
  306. package/uis/stock/dist/ui.json +3 -3
  307. package/AGENTS.md +0 -403
  308. package/uis/stock/dist/assets/de-CiSKBON6.js +0 -1
  309. package/uis/stock/dist/assets/es-BgNQbboq.js +0 -1
  310. package/uis/stock/dist/assets/fr-WzBF8AXI.js +0 -1
  311. package/uis/stock/dist/assets/index-CXDl25BP.js +0 -53
  312. package/uis/stock/dist/assets/index-Cok5msAO.css +0 -2
  313. package/uis/stock/dist/assets/ja-DMQqF4ip.js +0 -1
  314. package/uis/stock/dist/assets/ko-DgfSg9v_.js +0 -1
  315. package/uis/stock/dist/assets/ru-DjIByX61.js +0 -1
  316. package/uis/stock/dist/assets/vi-DOB8nYFC.js +0 -1
  317. package/uis/stock/dist/assets/zh-CN-DZ3WlUgy.js +0 -1
@@ -0,0 +1,17 @@
1
+ import { ConfigWatch } from './services/config-watch.js';
2
+ export interface ControlPlaneOptions {
3
+ /** One-off overrides, persisted only after every guard below passes. */
4
+ port?: number;
5
+ host?: string;
6
+ autostart: boolean;
7
+ open: boolean;
8
+ /** Print the effective settings and workspaces and exit without starting anything. */
9
+ printConfig: boolean;
10
+ }
11
+ /**
12
+ * Runs the control plane in *this* process until it is stopped. `home-hosted up`
13
+ * detaches a child that calls this; `--foreground` (systemd, docker) calls it
14
+ * directly.
15
+ */
16
+ export declare function runControlPlane(options: ControlPlaneOptions): Promise<void>;
17
+ export { ConfigWatch };
@@ -0,0 +1,37 @@
1
+ import type { Context, MiddlewareHandler } from 'hono';
2
+ import type { AuthIdentity, AuthService } from '../services/auth.js';
3
+ import type { HistoryActor } from '../shared/contracts.js';
4
+ import { SESSION_COOKIE } from '../services/auth.js';
5
+ /** 401s from the guard carry this code so the SPA can route to the login view. */
6
+ export declare const AUTH_REQUIRED_CODE = "AUTH_REQUIRED";
7
+ /**
8
+ * The one place that reads a request's credentials, so the guard, the session
9
+ * route and `/healthz` can never disagree about who is calling.
10
+ */
11
+ export declare function requestIdentity(c: Context, auth: AuthService): AuthIdentity;
12
+ export interface AuthGuardDeps {
13
+ auth: AuthService;
14
+ /** Test hook: bind the guard to an explicit cookie header / ip. */
15
+ now?: () => number;
16
+ }
17
+ /**
18
+ * Guards every `/api/*` route. The SPA shell stays public (it holds no data),
19
+ * so the browser can load the app and show the login screen.
20
+ *
21
+ * A request may prove itself with the session cookie or with an API token
22
+ * (`Authorization: Bearer …`), which is what lets a script or an agent drive the
23
+ * panel without a browser. The token also works while auth is enabled but no
24
+ * password is set — that state otherwise only trusts this machine.
25
+ *
26
+ * State-changing requests that carry an `Origin` must come from this same host:
27
+ * with `SameSite=Strict` cookies that closes the cross-site CSRF path.
28
+ */
29
+ export declare function createAuthGuard(deps: AuthGuardDeps): MiddlewareHandler;
30
+ export { SESSION_COOKIE };
31
+ /**
32
+ * Who is behind a request, as a history event names them: a cookie is a person at
33
+ * the panel, a bearer token is a script or an agent. Anonymous callers can only be
34
+ * loopback requests while auth is unarmed, which is the browser's own origin.
35
+ */
36
+ export declare function requestActor(c: Context, auth: AuthService): HistoryActor;
37
+ export { isLoopbackRequest, requestIp } from './loopback.js';
@@ -0,0 +1,29 @@
1
+ import type { Context, MiddlewareHandler } from 'hono';
2
+ /**
3
+ * The authority a request named, from either protocol.
4
+ *
5
+ * HTTP/2 carries no `Host` header — the name arrives as the `:authority` pseudo-header, which srvx
6
+ * keeps on the underlying node request and filters out of the header bag. Reading only `host` left
7
+ * the guard blind on every TLS listener, so a rebound name reached the app unchecked.
8
+ *
9
+ * Deliberately **not** `new URL(c.req.url).host`: with `trustProxy: 'loopback'` srvx builds that
10
+ * from `X-Forwarded-Host`, which a rebound page sets freely (it is same-origin with the panel, so no
11
+ * preflight stops it) — using it would hand the attacker back the field being checked.
12
+ */
13
+ export declare function requestAuthority(c: Context): string | undefined;
14
+ /** The hostname part of a `Host` header: port and IPv6 brackets dropped, lowercased. */
15
+ export declare function hostnameOf(header: string): string;
16
+ /**
17
+ * Whether a request's `Host` names this panel rather than an attacker's domain.
18
+ *
19
+ * DNS rebinding points a public name at 127.0.0.1, which makes the attacker's page same-origin with
20
+ * the panel — the `Origin` check cannot see it. An IP literal or a name no public DNS can answer
21
+ * (`localhost`, a single label, `.local`, `.lan`, …) cannot be rebound by a remote site, so those are
22
+ * always allowed; a public name must be one the person declared or a proxy route serving the panel.
23
+ *
24
+ * A request that names no host at all is **refused**: HTTP/1.1 requires `Host`, so its absence means
25
+ * the caller reached us through a channel this guard cannot inspect — and answering `true` there is
26
+ * what turned "no `Host` over HTTP/2" into an open door rather than a closed one.
27
+ */
28
+ export declare function isAllowedHost(header: string | undefined, allowed: Iterable<string>): boolean;
29
+ export declare function createHostGuard(allowed: () => Iterable<string>): MiddlewareHandler;
@@ -0,0 +1,18 @@
1
+ /** Client address helpers shared by the auth guard and the setup routes. */
2
+ export declare function requestIp(c: {
3
+ req: {
4
+ raw: unknown;
5
+ };
6
+ }): string | null;
7
+ export declare function isLoopback(address: string | null): boolean;
8
+ /**
9
+ * Whether the request was made on this machine, by something that did not relay it.
10
+ *
11
+ * The panel's own reverse proxy connects from 127.0.0.1, so a loopback peer alone would hand every
12
+ * internet client this machine's trust (the "no password set yet" pass, first-setup, `/_hh`).
13
+ */
14
+ export declare function isLoopbackRequest(c: {
15
+ req: {
16
+ raw: unknown;
17
+ };
18
+ }): boolean;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The browsable API reference at `/openapi/ui`.
3
+ *
4
+ * It used to be `Scalar()`, whose HTML is a `<script type="module">` importing the reference from
5
+ * `cdn.jsdelivr.net` and nothing else — so with no route to the internet `#app` held 0 children and 0
6
+ * characters. Measured in Chromium with every non-panel request aborted; the same page made 30 off-origin
7
+ * requests and pulled a 754 KB bundle when it could reach them.
8
+ *
9
+ * Scalar itself is not the limitation: its standalone bundle renders fine offline when it is served
10
+ * alongside the panel. It weighs 4.9 MB, and `docs/UI_CREATION.md` point 5 says an offline home server
11
+ * should not need a CDN, so shipping that to every install is a worse trade than rendering the route
12
+ * index from `/openapi/spec.json` — grouped by tag, every operation with its method, path and summary —
13
+ * and offering the interactive browser to whoever can reach it. The index is what renders first and
14
+ * stays if the import fails, so the page is never blank.
15
+ *
16
+ * The spec stays the single source of truth; this file only formats what the routes already declare.
17
+ */
18
+ /**
19
+ * Deliberately a string, not a `.vue` or a template dependency: this route is outside `/api` and outside
20
+ * both UIs, and `src/**` may not know a UI's files.
21
+ */
22
+ export declare function openApiReferencePage(specUrl: string): string;
@@ -0,0 +1,34 @@
1
+ import { generateSpecs } from 'hono-openapi';
2
+ /**
3
+ * The machine-readable contract, generated from the same ArkType schemas the
4
+ * routes validate with — one source of truth, no second set of DTOs to drift.
5
+ * `/openapi/ui` is the browsable reference and needs no session, since a UI
6
+ * author has to be able to read it before they can log in.
7
+ */
8
+ /** The version the package was built with, so the spec never drifts from it. */
9
+ export declare function setupOpenAPI(app: Parameters<typeof generateSpecs>[0]): import("hono/hono-base").HonoBase<import("hono").Env, {
10
+ "/openapi/spec.json": {
11
+ $get: {
12
+ input: {};
13
+ output: {
14
+ [x: string]: import("hono/utils/types").JSONValue;
15
+ };
16
+ outputFormat: "json";
17
+ status: import("hono/utils/http-status").ContentfulStatusCode;
18
+ };
19
+ };
20
+ } & {
21
+ "/openapi/ui": {
22
+ $get: {
23
+ input: {};
24
+ output: {};
25
+ outputFormat: string;
26
+ status: import("hono/utils/http-status").StatusCode;
27
+ };
28
+ };
29
+ }, "/", "/openapi/ui">;
30
+ /**
31
+ * What the route table cannot say for itself: which credential each group takes, the failures the
32
+ * guards answer before any handler runs, and a body on every documented error.
33
+ */
34
+ export declare function finishSpec(spec: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,54 @@
1
+ /** Recognised by content, never by the file's name. */
2
+ export declare function isZipArchive(file: string): boolean;
3
+ export interface ArchiveEntry {
4
+ /** Forward-slash path inside the archive; directories end with `/`. */
5
+ name: string;
6
+ directory: boolean;
7
+ encrypted: boolean;
8
+ symlink: boolean;
9
+ /** Uncompressed size, for callers that cap what they will extract. */
10
+ size: number;
11
+ /** The Unix mode the entry carries, when the archive recorded one. */
12
+ mode?: number;
13
+ }
14
+ /** The central directory is not encrypted, so this works without a password. */
15
+ export declare function listZip(file: string): Promise<ArchiveEntry[]>;
16
+ /**
17
+ * True when the archive rejected the password we used.
18
+ *
19
+ * Matched on the wording zip.js raises for a bad password, not on the word alone: the message is
20
+ * `Invalid password`, while a *file it cannot open* produces `ENOENT: … stat '/tmp/…/my-password-
21
+ * backup.zip'` — which carries the word because the caller named the archive that. A substring test
22
+ * read that as a wrong password and told the person to re-enter one, when the archive was simply
23
+ * not there. (Caught by CI, where Node's fs message names the path; the local run said
24
+ * `Unable to open file as blob`, so the same call looked fine.)
25
+ */
26
+ export declare function isInvalidPassword(error: unknown): boolean;
27
+ /**
28
+ * Writes the contents of `sourceDir` into `destination`, preserving the tree and each
29
+ * entry's permission bits.
30
+ *
31
+ * The mode is captured because the tree is somebody's data directory: a `0600` key, a `0700`
32
+ * directory and a `0755` script are all routine there, and a backup that restores them as `0644`
33
+ * changes who can read the data it was taken to protect. What a symlink may bring in is bounded by
34
+ * the tree itself (`walk`): the target has to be inside it, so a declared path cannot capture bytes
35
+ * from outside itself. Streams from disk to disk: nothing is buffered whole.
36
+ */
37
+ export declare function createZip(sourceDir: string, destination: string, options?: {
38
+ password?: string;
39
+ }): Promise<void>;
40
+ /**
41
+ * Extracts the given entries (already validated by the caller) into
42
+ * `destination`. Symbolic links are never recreated — an archive is not allowed
43
+ * to make the filesystem point somewhere else.
44
+ *
45
+ * An entry's permission bits are applied after it lands. The file is created under a restrictive
46
+ * mode first, so a `0600` secret never exists world-readable between two calls, and a mode the
47
+ * current umask would widen is set with an explicit `chmod` rather than left to the create.
48
+ */
49
+ export declare function extractZip(file: string, destination: string, options: {
50
+ names: string[];
51
+ password?: string;
52
+ }): Promise<{
53
+ skipped: string[];
54
+ }>;
@@ -0,0 +1,34 @@
1
+ import type { BackupHookConfig, ServerConfig } from '../shared/contracts.js';
2
+ /**
3
+ * Runs one backup hook (`dump` before capture, `load` after restore).
4
+ *
5
+ * Same discipline as `bootstrap`: one program plus args, never a shell string, so a path with a space
6
+ * cannot become two arguments and nothing is interpreted. Not the same code, because the failure
7
+ * handling is the opposite — a bootstrap is best-effort and a hook is not. A `dump` that fails must
8
+ * refuse the backup: archiving the live data directory beside a failed dump would produce an archive
9
+ * that looks complete and is not.
10
+ */
11
+ export interface HookResult {
12
+ ok: boolean;
13
+ code: number | null;
14
+ /** Bounded tail of both streams, for the plan and the error. */
15
+ output: string;
16
+ /** Set when the process could not be started or timed out. */
17
+ error?: string;
18
+ }
19
+ /**
20
+ * Run a hook for one entry.
21
+ *
22
+ * `dumpDir` is passed in rather than templated by the caller so the same absolute path can be handed
23
+ * to `dump` and later to `load`, which is what makes the pair symmetric.
24
+ */
25
+ export declare function runBackupHook(hook: BackupHookConfig, server: ServerConfig, dumpDir: string, options?: {
26
+ requireDumpDir?: boolean;
27
+ }): Promise<HookResult>;
28
+ /**
29
+ * The line a person reads when a hook fails.
30
+ *
31
+ * Names the entry, the program and the last thing it said — a bare "the backup failed" would send
32
+ * them to the panel's log to find out which of five databases refused.
33
+ */
34
+ export declare function hookFailure(action: 'dump' | 'load', server: ServerConfig, result: HookResult): string;
@@ -0,0 +1,2 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ export declare const cloudflareProvider: DdnsProvider;
@@ -0,0 +1,2 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ export declare const desecProvider: DdnsProvider;
@@ -0,0 +1,2 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ export declare const digitaloceanProvider: DdnsProvider;
@@ -0,0 +1,2 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ export declare const duckdnsProvider: DdnsProvider;
@@ -0,0 +1,15 @@
1
+ import type { DdnsResult } from './types.js';
2
+ export interface DyndnsReply {
3
+ code: string;
4
+ /** Everything after the code, typically the address the provider now serves. */
5
+ detail: string;
6
+ }
7
+ /** The first word of the body is the code; the rest is provider detail. */
8
+ export declare function parseDyndnsReply(body: string): DyndnsReply;
9
+ /** Maps a dyndns2 body onto the panel's result shape. */
10
+ export declare function describeDyndnsReply(body: string, provider: string): DdnsResult;
11
+ /**
12
+ * A 401/400 with a non-dyndns2 body is still an answer worth quoting; a known
13
+ * code wins, because several of these endpoints report errors with HTTP 200.
14
+ */
15
+ export declare function describeDyndnsResponse(response: Response, body: string, provider: string): DdnsResult;
@@ -0,0 +1,2 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ export declare const dynuProvider: DdnsProvider;
@@ -0,0 +1,2 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ export declare const freednsProvider: DdnsProvider;
@@ -0,0 +1,2 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ export declare const gandiProvider: DdnsProvider;
@@ -0,0 +1,2 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ export declare const godaddyProvider: DdnsProvider;
@@ -0,0 +1,3 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ /** Hurricane Electric keeps a per-host DDNS key, shown in its DNS panel. */
3
+ export declare const henetProvider: DdnsProvider;
@@ -0,0 +1,12 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ import type { DdnsConfig, DdnsProviderInfo } from '../../shared/contracts.js';
3
+ /** Registry order is what the settings page offers. */
4
+ export declare const DDNS_PROVIDERS: readonly DdnsProvider[];
5
+ export declare function ddnsProvider(id: string): DdnsProvider | null;
6
+ export declare function ddnsProviderInfos(): DdnsProviderInfo[];
7
+ /**
8
+ * Cross-field problems ArkType cannot see. Credentials are deliberately not
9
+ * required here: an account is normally added before its secret is typed in,
10
+ * and a missing secret is reported per record instead of blocking the save.
11
+ */
12
+ export declare function validateDdnsConfig(config: DdnsConfig): string[];
@@ -0,0 +1,27 @@
1
+ import type { DdnsFetch } from './types.js';
2
+ /**
3
+ * Keyless public-address services. The family-specific hostnames are the point:
4
+ * a bare `ipify.org` answers over whichever family the connection happened to
5
+ * take, which is exactly what an AAAA update must not get.
6
+ */
7
+ export declare const DEFAULT_IPV4_ENDPOINTS: string[];
8
+ export declare const DEFAULT_IPV6_ENDPOINTS: string[];
9
+ /** RFC1918, loopback, link-local, CGNAT, documentation, benchmarking and multicast/reserved are never a public DNS target. */
10
+ export declare function isPublicAddress(ip: string, family: 'A' | 'AAAA'): boolean;
11
+ /**
12
+ * Reads the address out of whatever the endpoint answered: a bare address, a
13
+ * Cloudflare `cdn-cgi/trace` body (`ip=…`), or a small JSON object.
14
+ */
15
+ export declare function parseAddressResponse(text: string, family: 'A' | 'AAAA'): string | null;
16
+ /** One address lookup; the pass's own deadline still bounds the whole list. */
17
+ export declare const DETECT_TIMEOUT_MS = 10000;
18
+ export interface DetectResult {
19
+ ip: string | null;
20
+ error: string | null;
21
+ }
22
+ /**
23
+ * Tries the configured endpoint, or the built-in list in order, and returns the
24
+ * first address that is really public. A transient failure never deletes a
25
+ * record; it just leaves the previous one in place.
26
+ */
27
+ export declare function detectPublicAddress(family: 'A' | 'AAAA', overrideUrl: string, fetchImpl: DdnsFetch, signal?: AbortSignal, timeoutMs?: number): Promise<DetectResult>;
@@ -0,0 +1,13 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ export interface NamecheapRecord {
3
+ name: string;
4
+ type: string;
5
+ address: string;
6
+ mxPref: string;
7
+ ttl: string;
8
+ }
9
+ /** Every `<Host ... />` in a `getHosts` reply, in the order the API listed them. */
10
+ export declare function parseHosts(body: string): NamecheapRecord[];
11
+ /** The first `<Err1>`…`<ErrN>` a failed reply carries, as one sentence. */
12
+ export declare function describeErrors(body: string): string;
13
+ export declare const namecheapApiProvider: DdnsProvider;
@@ -0,0 +1,6 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ /**
3
+ * Namecheap's router-style Dynamic DNS: one GET, one A record, HTTP 200 even on
4
+ * failure — the XML `ErrCount` is the only truth.
5
+ */
6
+ export declare const namecheapProvider: DdnsProvider;
@@ -0,0 +1,2 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ export declare const noipProvider: DdnsProvider;
@@ -0,0 +1,2 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ export declare const porkbunProvider: DdnsProvider;
@@ -0,0 +1,7 @@
1
+ import type { DdnsProvider } from './types.js';
2
+ /**
3
+ * Spaceship has no DDNS endpoint: the DNS API upserts whole record sets by
4
+ * (name, type) and answers 204 with no body, so the only way to report
5
+ * "unchanged" is to read the records back first.
6
+ */
7
+ export declare const spaceshipProvider: DdnsProvider;
@@ -0,0 +1,98 @@
1
+ import type { DdnsProviderField, DdnsRecordType } from '../../shared/contracts.js';
2
+ /**
3
+ * One record to keep current. Providers are stateless adapters over one HTTP
4
+ * call each, so everything they need is resolved before they are called.
5
+ */
6
+ /** Provider ids the panel may have cached (a Cloudflare zone, a record), so the next pass skips lookups. */
7
+ export interface DdnsRecordCache {
8
+ zoneId?: string;
9
+ recordId?: string;
10
+ }
11
+ export interface DdnsRecord {
12
+ host: string;
13
+ type: DdnsRecordType;
14
+ ip: string;
15
+ /** The registered domain, when the config pins it; providers that need a zone fall back to a heuristic. */
16
+ zone?: string;
17
+ /** Seconds; `1` is "automatic" where the provider supports it. */
18
+ ttl: number;
19
+ proxied: boolean;
20
+ cache?: DdnsRecordCache;
21
+ }
22
+ export type DdnsFetch = (input: string, init?: RequestInit) => Promise<Response>;
23
+ export interface DdnsContext {
24
+ /** Whatever the person stored for this account; provider fields only. */
25
+ credentials: Record<string, string>;
26
+ fetch: DdnsFetch;
27
+ signal?: AbortSignal;
28
+ }
29
+ export interface DdnsResult {
30
+ ok: boolean;
31
+ /** False when the provider already served exactly this address. */
32
+ changed: boolean;
33
+ message: string;
34
+ error?: string;
35
+ /** The provider refused in a way retrying cannot fix (bad credentials, unknown host, abuse block). */
36
+ permanent?: boolean;
37
+ /** Provider ids worth remembering, so the next pass skips a lookup. */
38
+ cache?: DdnsRecordCache;
39
+ }
40
+ export interface DdnsProvider {
41
+ id: string;
42
+ label: string;
43
+ docsUrl: string;
44
+ /** Record families this provider can manage. */
45
+ families: DdnsRecordType[];
46
+ fields: DdnsProviderField[];
47
+ /** The provider honours a per-record TTL. */
48
+ ttl: boolean;
49
+ /** The provider has a proxy/CDN flag (Cloudflare). */
50
+ proxied: boolean;
51
+ /**
52
+ * Non-null when the stored credentials cannot drive this provider yet.
53
+ */
54
+ validate: (credentials: Record<string, string> | null) => string | null;
55
+ /**
56
+ * Keeps one address record current. Absent for a provider that exists only to
57
+ * answer DNS-01 challenges — an account on one of those cannot be used as a DDNS
58
+ * hostname, and saying so beats a stub that pretends to work.
59
+ */
60
+ update?: (record: DdnsRecord, context: DdnsContext) => Promise<DdnsResult>;
61
+ /**
62
+ * Present when these credentials can answer an ACME DNS-01 challenge, which
63
+ * needs a temporary `TXT` record — a capability the update path does not imply.
64
+ * A router-style Dynamic DNS password cannot write TXT, so it is absent there.
65
+ */
66
+ challenge?: (record: DdnsChallengeRecord, context: DdnsContext) => Promise<DdnsChallengeResult>;
67
+ }
68
+ /** One `_acme-challenge` TXT record, as the ACME server asked for it. */
69
+ export interface DdnsChallengeRecord {
70
+ /** The full name the CA reads, e.g. `_acme-challenge.git.example.com`. */
71
+ fqdn: string;
72
+ /** The value the CA expects to find. */
73
+ value: string;
74
+ /** `present` writes it, `cleanup` removes it again. */
75
+ action: 'present' | 'cleanup';
76
+ }
77
+ export interface DdnsChallengeResult {
78
+ ok: boolean;
79
+ message: string;
80
+ }
81
+ export declare function succeeded(message: string, changed: boolean): DdnsResult;
82
+ export declare function failed(error: string, permanent?: boolean): DdnsResult;
83
+ /**
84
+ * The result of the write six providers end their `update()` with.
85
+ *
86
+ * They repeated the same two lines after their own write call, and they have to agree: a
87
+ * non-ok response is a provider error with its body attached, and an ok one is a change.
88
+ * The message names the record, because a settings page shows it as the account's last
89
+ * result and "ok" would not say what actually moved.
90
+ */
91
+ export declare function wrote(response: Response, record: DdnsRecord): Promise<DdnsResult>;
92
+ /** Missing required credential keys, as a sentence for the settings page. */
93
+ export declare function missingFields(credentials: Record<string, string> | null, keys: string[]): string | null;
94
+ export declare function basicAuth(user: string, password: string): string;
95
+ /** A provider error body is useful, but never worth throwing over. */
96
+ export declare function errorText(response: Response, limit?: number): Promise<string>;
97
+ /** `Sub.Domain.COM.` -> `sub.domain.com`; DuckDNS and friends are case-insensitive. */
98
+ export declare function normalizeHost(host: string): string;
@@ -0,0 +1,11 @@
1
+ export interface HostParts {
2
+ /** The registered domain (the zone), e.g. `example.com`. */
3
+ zone: string;
4
+ /** The record name inside that zone; `@` for the apex. */
5
+ name: string;
6
+ }
7
+ /**
8
+ * Splits a hostname into the zone and the record name, which is what every
9
+ * provider that has no zone lookup needs. `zone` short-circuits the heuristic.
10
+ */
11
+ export declare function splitHost(host: string, zone?: string): HostParts;
@@ -0,0 +1,117 @@
1
+ /** One container docker reports, with the labels that attribute it to a project. */
2
+ export interface ContainerRow {
3
+ id: string;
4
+ name: string;
5
+ project: string | null;
6
+ configFiles: string[];
7
+ }
8
+ /** What one compose entry's containers add up to. */
9
+ export interface ComposeReading {
10
+ /** Summed CPU share, so 200 is two saturated cores. */
11
+ cpuPercent: number;
12
+ rssBytes: number;
13
+ /** Processes inside the containers — the same question the tree sampler answers. */
14
+ processes: number;
15
+ /** How many containers the sum covers. */
16
+ containers: number;
17
+ }
18
+ /** The evidence that an entry runs a compose project, and the key its containers are attributed by. */
19
+ export interface ComposeTarget {
20
+ /** What the caller looks the reading up by: the project, else the compose files. */
21
+ key: string;
22
+ project: string | null;
23
+ configFiles: string[];
24
+ }
25
+ /** `816KiB` -> bytes. Docker prints binary units for memory, and `0B` for a container that is not running. */
26
+ export declare function parseHumanBytes(value: string): number | null;
27
+ /** `MemUsage` is `used / limit`; only the used part measures this stack. */
28
+ export declare function parseMemUsage(value: string): number | null;
29
+ /** `99.61%` -> 99.61. `--` is docker's "no reading", which must not become a zero. */
30
+ export declare function parsePercent(value: string): number | null;
31
+ /** The containers docker reports, from the tab-separated `--format` above. */
32
+ export declare function parseDockerPs(text: string): ContainerRow[];
33
+ /** Per-container readings from `docker stats --no-stream --format json`, keyed by container id. */
34
+ export declare function parseDockerStats(text: string): Map<string, Omit<ComposeReading, 'containers'>>;
35
+ /**
36
+ * The compose options before the subcommand, and where the subcommand starts.
37
+ *
38
+ * Compose requires its global options **before** the subcommand — it answers `unknown shorthand
39
+ * flag: 'p'` for `up -p x` — so only this leading run can carry the project name or the file.
40
+ */
41
+ export declare function parseComposeHead(args: string[]): {
42
+ subcommandAt: number;
43
+ projectName: string | null;
44
+ files: string[];
45
+ projectDirectory: string | null;
46
+ };
47
+ /** The compose file compose would pick: the first known name here or in a parent directory. */
48
+ export declare function findComposeFile(from: string): string[];
49
+ /** Whether this argv runs a compose stack, without resolving anything — a cheap pre-check. */
50
+ export declare function isComposeCommand(command: string, args: string[]): boolean;
51
+ /**
52
+ * The compose project an entry runs, from evidence in its own config: the command it spawns, its
53
+ * argv, its cwd and its environment. `null` means "sample the process tree", which is the right
54
+ * answer for every entry this cannot attribute honestly — see the module comment for the limits.
55
+ */
56
+ export declare function composeTarget(input: {
57
+ command: string;
58
+ args: string[];
59
+ cwd: string;
60
+ env?: Record<string, string | undefined>;
61
+ }): ComposeTarget | null;
62
+ /**
63
+ * The containers belonging to one target, or `null` when that cannot be decided.
64
+ *
65
+ * `null` is the ambiguity refusal: two projects sharing a compose file can only be told apart by an
66
+ * explicit project name, so picking one would report another stack's CPU and RSS as this entry's.
67
+ */
68
+ export declare function attributeContainers(target: ComposeTarget, rows: ContainerRow[]): ContainerRow[] | null;
69
+ /**
70
+ * The sum over one project's containers.
71
+ *
72
+ * Exported so the arithmetic is testable against the shapes docker actually prints; the class below
73
+ * only decides when to spawn. `null` for no containers, and for a listed container without a
74
+ * reading — an under-report is the one direction a memory ceiling must not miss.
75
+ */
76
+ export declare function sumContainers(rows: ContainerRow[], readings: Map<string, Omit<ComposeReading, 'containers'>>): ComposeReading | null;
77
+ /** Whether a container publishing a port belongs to the stack this entry itself declares. */
78
+ export declare function isOwnStack(holder: {
79
+ project: string | null;
80
+ composeDir: string | null;
81
+ }, target: ComposeTarget | null): boolean;
82
+ /** One target's running containers from a fresh `docker ps`, or `null` when docker cannot answer. */
83
+ export declare function composeContainers(target: ComposeTarget): Promise<ContainerRow[] | null>;
84
+ /**
85
+ * Stops every container of one target and reports what is still running afterwards.
86
+ *
87
+ * The answer comes from a **fresh listing**, not from `docker stop`'s exit code: a stop that
88
+ * printed success for a container still listed is the empty success this exists to refuse.
89
+ * `null` means docker could not be asked, which is not the same as "it stopped".
90
+ */
91
+ export declare function stopComposeContainers(target: ComposeTarget): Promise<{
92
+ stopped: string[];
93
+ survivors: string[];
94
+ } | null>;
95
+ /**
96
+ * Container readings per compose project, refreshed out of band.
97
+ *
98
+ * One `docker ps` and one batched `docker stats` serve every docker-backed entry, however many
99
+ * there are. When docker cannot be reached the cache is emptied rather than filled with zeros: the
100
+ * caller keeps the process-tree sample, which is at least true of the wrapper, and a metric with no
101
+ * reading is never published as an idle one.
102
+ */
103
+ export declare class DockerMetrics {
104
+ private cache;
105
+ private refreshing;
106
+ /**
107
+ * The last completed readings, and a refresh started when they are stale.
108
+ *
109
+ * Deliberately synchronous: the spawn takes seconds, and awaiting it here would stretch the
110
+ * supervisor tick that publishes the whole state frame. A fresh reading lands on a later tick.
111
+ */
112
+ readings(targets: ComposeTarget[], now?: number): ReadonlyMap<string, ComposeReading>;
113
+ /** Resolves once the refresh in flight, if any, has finished. */
114
+ settle(): Promise<void>;
115
+ /** One listing and one batched stats call; replaces the cache only with a complete answer. */
116
+ refresh(targets: ComposeTarget[], now?: number): Promise<void>;
117
+ }
@@ -0,0 +1,15 @@
1
+ import type { EntryState } from '../shared/contracts.js';
2
+ /**
3
+ * The small slice of a server's runtime the panel has to remember across its own
4
+ * restarts: how much of the retry budget is spent, and whether a `runOnce` bootstrap
5
+ * already ran.
6
+ *
7
+ * Both lived only in memory, so a panel restart — a `restart`, a crash, a reboot —
8
+ * handed a crash-looping server a fresh `maxRetries` and re-ran its bootstrap. The
9
+ * retry counter has to outlive the process that increments it to bound anything.
10
+ */
11
+ /** One JSON file per entry, beside the nanny's own state. */
12
+ export declare function entryStatePath(dir: string, id: string): string;
13
+ export declare function readEntryState(file: string): EntryState | null;
14
+ export declare function writeEntryState(file: string, state: EntryState): void;
15
+ export declare function clearEntryState(file: string): void;