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.
- package/README.md +273 -628
- package/dist/chunks/archive-DpCwA8Nf.js +339 -0
- package/dist/chunks/archive-DpCwA8Nf.js.map +1 -0
- package/dist/chunks/atomic-CEfCUfkQ.js +25 -0
- package/dist/chunks/atomic-CEfCUfkQ.js.map +1 -0
- package/dist/chunks/backup-CPrJVPJI.js +797 -0
- package/dist/chunks/backup-CPrJVPJI.js.map +1 -0
- package/dist/chunks/backups-Bd2SF2qd.js +4346 -0
- package/dist/chunks/backups-Bd2SF2qd.js.map +1 -0
- package/dist/chunks/config-text-DifCHhnz.js +50 -0
- package/dist/chunks/config-text-DifCHhnz.js.map +1 -0
- package/dist/chunks/contracts-ku5ypHXJ.js +2256 -0
- package/dist/chunks/contracts-ku5ypHXJ.js.map +1 -0
- package/dist/chunks/daemon-TwXk5vb8.js +215 -0
- package/dist/chunks/daemon-TwXk5vb8.js.map +1 -0
- package/dist/chunks/daemon-log-BVj8cDEo.js +241 -0
- package/dist/chunks/daemon-log-BVj8cDEo.js.map +1 -0
- package/dist/chunks/docker-CGv4Uv7w.js +436 -0
- package/dist/chunks/docker-CGv4Uv7w.js.map +1 -0
- package/dist/chunks/down-BlX5X3bm.js +378 -0
- package/dist/chunks/down-BlX5X3bm.js.map +1 -0
- package/dist/chunks/init-DdmqHVra.js +263 -0
- package/dist/chunks/init-DdmqHVra.js.map +1 -0
- package/dist/chunks/last-stop-BZ08Z89-.js +52 -0
- package/dist/chunks/last-stop-BZ08Z89-.js.map +1 -0
- package/dist/chunks/layout-D74TGUnr.js +24 -0
- package/dist/chunks/layout-D74TGUnr.js.map +1 -0
- package/dist/chunks/log-buffer-HnP0jKhZ.js +350 -0
- package/dist/chunks/log-buffer-HnP0jKhZ.js.map +1 -0
- package/dist/chunks/logger-B5U4GD3j.js +13 -0
- package/dist/chunks/logger-B5U4GD3j.js.map +1 -0
- package/dist/chunks/logs-gI_69Q1P.js +265 -0
- package/dist/chunks/logs-gI_69Q1P.js.map +1 -0
- package/dist/chunks/migrate-BTlsibvF.js +155 -0
- package/dist/chunks/migrate-BTlsibvF.js.map +1 -0
- package/dist/chunks/nanny-20aBXL1o.js +1069 -0
- package/dist/chunks/nanny-20aBXL1o.js.map +1 -0
- package/dist/chunks/nanny-CjnnrIpm.js +132 -0
- package/dist/chunks/nanny-CjnnrIpm.js.map +1 -0
- package/dist/chunks/nanny-DUaAfCV-.js +39 -0
- package/dist/chunks/nanny-DUaAfCV-.js.map +1 -0
- package/dist/chunks/nanny-sweep-Ca9kPAVi.js +104 -0
- package/dist/chunks/nanny-sweep-Ca9kPAVi.js.map +1 -0
- package/dist/chunks/nearest-6KgQEDUe.js +41 -0
- package/dist/chunks/nearest-6KgQEDUe.js.map +1 -0
- package/dist/chunks/parse-B9owE47G.js +383 -0
- package/dist/chunks/parse-B9owE47G.js.map +1 -0
- package/dist/chunks/paths-BT94q6-w.js +172 -0
- package/dist/chunks/paths-BT94q6-w.js.map +1 -0
- package/dist/chunks/port-B8WBTRMk.js +333 -0
- package/dist/chunks/port-B8WBTRMk.js.map +1 -0
- package/dist/chunks/restart-UZgeDukG.js +126 -0
- package/dist/chunks/restart-UZgeDukG.js.map +1 -0
- package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/chunks/schema-o7Lgk0V1.js +102 -0
- package/dist/chunks/schema-o7Lgk0V1.js.map +1 -0
- package/dist/chunks/secrets-D7PdYh71.js +544 -0
- package/dist/chunks/secrets-D7PdYh71.js.map +1 -0
- package/dist/chunks/server-BuIeSsRu.js +169 -0
- package/dist/chunks/server-BuIeSsRu.js.map +1 -0
- package/dist/chunks/server-ids-DRuNLVCV.js +32 -0
- package/dist/chunks/server-ids-DRuNLVCV.js.map +1 -0
- package/dist/chunks/set-password-DegMumPh.js +43 -0
- package/dist/chunks/set-password-DegMumPh.js.map +1 -0
- package/dist/chunks/set-token-21d1FTDC.js +78 -0
- package/dist/chunks/set-token-21d1FTDC.js.map +1 -0
- package/dist/chunks/settings-BVSBnIwJ.js +332 -0
- package/dist/chunks/settings-BVSBnIwJ.js.map +1 -0
- package/dist/chunks/setup-temp-XiuAtiW2.js +150 -0
- package/dist/chunks/setup-temp-XiuAtiW2.js.map +1 -0
- package/dist/chunks/shape-DnTKzjQ2.js +24 -0
- package/dist/chunks/shape-DnTKzjQ2.js.map +1 -0
- package/dist/chunks/src-BL97vLVb.js +11153 -0
- package/dist/chunks/src-BL97vLVb.js.map +1 -0
- package/dist/chunks/status-EuWdRq8Q.js +119 -0
- package/dist/chunks/status-EuWdRq8Q.js.map +1 -0
- package/dist/chunks/ui-DbPuwddJ.js +323 -0
- package/dist/chunks/ui-DbPuwddJ.js.map +1 -0
- package/dist/chunks/ui-dir-CsU3uLNV.js +39 -0
- package/dist/chunks/ui-dir-CsU3uLNV.js.map +1 -0
- package/dist/chunks/ui-release-DKzVvlLd.js +312 -0
- package/dist/chunks/ui-release-DKzVvlLd.js.map +1 -0
- package/dist/chunks/ui-revert-BhqOAhmM.js +27 -0
- package/dist/chunks/ui-revert-BhqOAhmM.js.map +1 -0
- package/dist/chunks/ui-switch-CMoslPO2.js +150 -0
- package/dist/chunks/ui-switch-CMoslPO2.js.map +1 -0
- package/dist/chunks/ui-update-TTBBoDik.js +272 -0
- package/dist/chunks/ui-update-TTBBoDik.js.map +1 -0
- package/dist/chunks/up-C4H13hBw.js +196 -0
- package/dist/chunks/up-C4H13hBw.js.map +1 -0
- package/dist/chunks/usage-CSBgLRN5.js +85 -0
- package/dist/chunks/usage-CSBgLRN5.js.map +1 -0
- package/dist/chunks/workspaces-CAln2sQ7.js +221 -0
- package/dist/chunks/workspaces-CAln2sQ7.js.map +1 -0
- package/dist/chunks/wsl-temperature-BiCI4iK6.js +322 -0
- package/dist/chunks/wsl-temperature-BiCI4iK6.js.map +1 -0
- package/dist/cli.js +229 -24861
- package/dist/cli.js.map +1 -1
- package/dist/client.js +120 -0
- package/dist/client.js.map +1 -0
- package/dist/types/api/acme.d.ts +24 -0
- package/dist/types/api/auth/$.routes.d.ts +103 -0
- package/dist/types/api/backups.d.ts +179 -0
- package/dist/types/api/control.d.ts +469 -0
- package/dist/types/api/ddns.d.ts +432 -0
- package/dist/types/api/events.d.ts +21 -0
- package/dist/types/api/health.d.ts +27 -0
- package/dist/types/api/logs.d.ts +95 -0
- package/dist/types/api/metrics.d.ts +19 -0
- package/dist/types/api/notifications.d.ts +141 -0
- package/dist/types/api/proxy.d.ts +1128 -0
- package/dist/types/api/servers/$.routes.d.ts +1318 -0
- package/dist/types/api/settings.d.ts +642 -0
- package/dist/types/api/state.d.ts +492 -0
- package/dist/types/api/static.d.ts +11 -0
- package/dist/types/api/tls.d.ts +112 -0
- package/dist/types/api/workspaces/$.routes.d.ts +797 -0
- package/dist/types/api/wsl-temperature.d.ts +113 -0
- package/dist/types/app.d.ts +6080 -0
- package/dist/types/cli/args.d.ts +75 -0
- package/dist/types/cli/backup-offline.d.ts +23 -0
- package/dist/types/cli/backup.d.ts +79 -0
- package/dist/types/cli/down.d.ts +75 -0
- package/dist/types/cli/init.d.ts +60 -0
- package/dist/types/cli/io.d.ts +65 -0
- package/dist/types/cli/logs.d.ts +64 -0
- package/dist/types/cli/migrate.d.ts +33 -0
- package/dist/types/cli/nanny.d.ts +19 -0
- package/dist/types/cli/nearest.d.ts +10 -0
- package/dist/types/cli/restart.d.ts +42 -0
- package/dist/types/cli/server.d.ts +68 -0
- package/dist/types/cli/set-password.d.ts +14 -0
- package/dist/types/cli/set-token.d.ts +21 -0
- package/dist/types/cli/setup-temp.d.ts +65 -0
- package/dist/types/cli/status.d.ts +14 -0
- package/dist/types/cli/ui-revert.d.ts +3 -0
- package/dist/types/cli/ui-switch.d.ts +27 -0
- package/dist/types/cli/ui-update.d.ts +72 -0
- package/dist/types/cli/up.d.ts +90 -0
- package/dist/types/cli/usage.d.ts +23 -0
- package/dist/types/cli.d.ts +12 -0
- package/dist/types/client.d.ts +6284 -0
- package/dist/types/config/layout.d.ts +11 -0
- package/dist/types/config/migrations.d.ts +69 -0
- package/dist/types/config/parse.d.ts +54 -0
- package/dist/types/config/patch.d.ts +20 -0
- package/dist/types/config/schema.d.ts +318 -0
- package/dist/types/config/secret-parts.d.ts +48 -0
- package/dist/types/config/secrets.d.ts +206 -0
- package/dist/types/config/seed.d.ts +30 -0
- package/dist/types/config/server-ids.d.ts +14 -0
- package/dist/types/config/settings.d.ts +74 -0
- package/dist/types/config/store.d.ts +132 -0
- package/dist/types/config/workspaces.d.ts +96 -0
- package/dist/types/helpers/action-result.d.ts +46 -0
- package/dist/types/helpers/atomic.d.ts +9 -0
- package/dist/types/helpers/backoff.d.ts +7 -0
- package/dist/types/helpers/bind.d.ts +16 -0
- package/dist/types/helpers/config-text.d.ts +23 -0
- package/dist/types/helpers/cookies.d.ts +19 -0
- package/dist/types/helpers/copy-tree.d.ts +15 -0
- package/dist/types/helpers/daemon-log.d.ts +45 -0
- package/dist/types/helpers/daemon.d.ts +122 -0
- package/dist/types/helpers/deferred.d.ts +7 -0
- package/dist/types/helpers/env-file.d.ts +20 -0
- package/dist/types/helpers/error.d.ts +18 -0
- package/dist/types/helpers/factory.d.ts +6 -0
- package/dist/types/helpers/last-stop.d.ts +20 -0
- package/dist/types/helpers/logger.d.ts +7 -0
- package/dist/types/helpers/open.d.ts +2 -0
- package/dist/types/helpers/openapi.d.ts +46 -0
- package/dist/types/helpers/paths.d.ts +94 -0
- package/dist/types/helpers/restore-lock.d.ts +32 -0
- package/dist/types/helpers/runtime.d.ts +18 -0
- package/dist/types/helpers/secret-compare.d.ts +13 -0
- package/dist/types/helpers/shell.d.ts +19 -0
- package/dist/types/helpers/sse.d.ts +23 -0
- package/dist/types/helpers/template.d.ts +8 -0
- package/dist/types/helpers/ui-dir.d.ts +11 -0
- package/dist/types/helpers/validate.d.ts +7 -0
- package/dist/types/helpers/validator.d.ts +12 -0
- package/dist/types/helpers/version.d.ts +10 -0
- package/dist/types/helpers/workspace.d.ts +25 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/middleware/auth.d.ts +37 -0
- package/dist/types/middleware/host.d.ts +29 -0
- package/dist/types/middleware/loopback.d.ts +18 -0
- package/dist/types/openapi-reference.d.ts +22 -0
- package/dist/types/openapi.d.ts +34 -0
- package/dist/types/providers/archive.d.ts +54 -0
- package/dist/types/providers/backup-hook.d.ts +34 -0
- package/dist/types/providers/ddns/cloudflare.d.ts +2 -0
- package/dist/types/providers/ddns/desec.d.ts +2 -0
- package/dist/types/providers/ddns/digitalocean.d.ts +2 -0
- package/dist/types/providers/ddns/duckdns.d.ts +2 -0
- package/dist/types/providers/ddns/dyndns2.d.ts +15 -0
- package/dist/types/providers/ddns/dynu.d.ts +2 -0
- package/dist/types/providers/ddns/freedns.d.ts +2 -0
- package/dist/types/providers/ddns/gandi.d.ts +2 -0
- package/dist/types/providers/ddns/godaddy.d.ts +2 -0
- package/dist/types/providers/ddns/henet.d.ts +3 -0
- package/dist/types/providers/ddns/index.d.ts +12 -0
- package/dist/types/providers/ddns/ip.d.ts +27 -0
- package/dist/types/providers/ddns/namecheap-api.d.ts +13 -0
- package/dist/types/providers/ddns/namecheap.d.ts +6 -0
- package/dist/types/providers/ddns/noip.d.ts +2 -0
- package/dist/types/providers/ddns/porkbun.d.ts +2 -0
- package/dist/types/providers/ddns/spaceship.d.ts +7 -0
- package/dist/types/providers/ddns/types.d.ts +98 -0
- package/dist/types/providers/ddns/zone.d.ts +11 -0
- package/dist/types/providers/docker.d.ts +117 -0
- package/dist/types/providers/entry-state.d.ts +15 -0
- package/dist/types/providers/health-check.d.ts +27 -0
- package/dist/types/providers/host.d.ts +147 -0
- package/dist/types/providers/identity.d.ts +54 -0
- package/dist/types/providers/log-tail.d.ts +29 -0
- package/dist/types/providers/nanny-sweep.d.ts +51 -0
- package/dist/types/providers/nanny.d.ts +94 -0
- package/dist/types/providers/port.d.ts +142 -0
- package/dist/types/providers/proc.d.ts +116 -0
- package/dist/types/providers/process.d.ts +61 -0
- package/dist/types/providers/proxy/caddy.d.ts +2 -0
- package/dist/types/providers/proxy/index.d.ts +7 -0
- package/dist/types/providers/proxy/types.d.ts +54 -0
- package/dist/types/providers/server-vars.d.ts +4 -0
- package/dist/types/providers/telegram.d.ts +32 -0
- package/dist/types/providers/ui-release.d.ts +113 -0
- package/dist/types/providers/webhook.d.ts +64 -0
- package/dist/types/providers/wsl-temperature.d.ts +69 -0
- package/dist/types/services/acme-challenge.d.ts +44 -0
- package/dist/types/services/auth.d.ts +145 -0
- package/dist/types/services/backups.d.ts +352 -0
- package/dist/types/services/config-watch.d.ts +40 -0
- package/dist/types/services/control-server.d.ts +58 -0
- package/dist/types/services/ddns.d.ts +67 -0
- package/dist/types/services/dependencies.d.ts +21 -0
- package/dist/types/services/events.d.ts +17 -0
- package/dist/types/services/exposure.d.ts +33 -0
- package/dist/types/services/history.d.ts +36 -0
- package/dist/types/services/host-monitor.d.ts +32 -0
- package/dist/types/services/init.d.ts +71 -0
- package/dist/types/services/log-buffer.d.ts +28 -0
- package/dist/types/services/log-files.d.ts +87 -0
- package/dist/types/services/log-relay.d.ts +36 -0
- package/dist/types/services/nanny.d.ts +14 -0
- package/dist/types/services/notifications.d.ts +124 -0
- package/dist/types/services/panel.d.ts +194 -0
- package/dist/types/services/proxy-config.d.ts +83 -0
- package/dist/types/services/proxy.d.ts +454 -0
- package/dist/types/services/state.d.ts +41 -0
- package/dist/types/services/supervisor/compose.d.ts +17 -0
- package/dist/types/services/supervisor/entry.d.ts +139 -0
- package/dist/types/services/supervisor/health.d.ts +55 -0
- package/dist/types/services/supervisor/pending-load.d.ts +6 -0
- package/dist/types/services/supervisor/persistent.d.ts +55 -0
- package/dist/types/services/supervisor/port-preflight.d.ts +45 -0
- package/dist/types/services/supervisor/records.d.ts +38 -0
- package/dist/types/services/supervisor/spawn.d.ts +15 -0
- package/dist/types/services/supervisor/view.d.ts +4 -0
- package/dist/types/services/supervisor.d.ts +113 -0
- package/dist/types/services/tls.d.ts +48 -0
- package/dist/types/services/ui-update.d.ts +44 -0
- package/dist/types/services/ui.d.ts +50 -0
- package/dist/types/shared/api-client.d.ts +137 -0
- package/dist/types/shared/backup-scope.d.ts +109 -0
- package/dist/types/shared/clone.d.ts +14 -0
- package/dist/types/shared/contracts.d.ts +4233 -0
- package/dist/types/shared/cpu-scale.d.ts +25 -0
- package/dist/types/shared/ddns-form.d.ts +62 -0
- package/dist/types/shared/endpoint.d.ts +8 -0
- package/dist/types/shared/error-message.d.ts +8 -0
- package/dist/types/shared/fields.d.ts +21 -0
- package/dist/types/shared/generated.d.ts +26 -0
- package/dist/types/shared/host-readings.d.ts +185 -0
- package/dist/types/shared/patch-diff.d.ts +94 -0
- package/dist/types/shared/probe-latency.d.ts +25 -0
- package/dist/types/shared/proxy-form.d.ts +182 -0
- package/dist/types/shared/server-attention.d.ts +37 -0
- package/dist/types/shared/server-key.d.ts +13 -0
- package/dist/types/shared/server-readings.d.ts +55 -0
- package/dist/types/shared/server-url.d.ts +43 -0
- package/dist/types/shared/shape.d.ts +17 -0
- package/dist/types/shared/ui-format.d.ts +89 -0
- package/docs/API.md +180 -0
- package/docs/BACKUPS.md +97 -0
- package/docs/CLI.md +122 -0
- package/docs/DDNS.md +12 -3
- package/docs/NOTIFICATIONS.md +3 -1
- package/docs/RESTORE_DEMO.md +6 -4
- package/docs/REVERSE_PROXY.md +2 -2
- package/docs/SECURITY.md +82 -0
- package/docs/SERVERS.md +47 -15
- package/docs/UI_CREATION.md +82 -286
- package/package.json +18 -9
- package/uis/stock/dist/assets/de-DyGrM1KK.js +1 -0
- package/uis/stock/dist/assets/es-BebHdc0E.js +1 -0
- package/uis/stock/dist/assets/fr-DsDTrxhI.js +1 -0
- package/uis/stock/dist/assets/index-6LANO2Ua.css +2 -0
- package/uis/stock/dist/assets/index-D06cUZbM.js +56 -0
- package/uis/stock/dist/assets/ja-D3RARJjW.js +1 -0
- package/uis/stock/dist/assets/ko-CKI3dFoD.js +1 -0
- package/uis/stock/dist/assets/ru-DEU5ujXt.js +1 -0
- package/uis/stock/dist/assets/vi-ULKPnasj.js +1 -0
- package/uis/stock/dist/assets/zh-CN-tCvnOxWy.js +1 -0
- package/uis/stock/dist/index.html +2 -2
- package/uis/stock/dist/ui.json +3 -3
- package/AGENTS.md +0 -403
- package/uis/stock/dist/assets/de-CiSKBON6.js +0 -1
- package/uis/stock/dist/assets/es-BgNQbboq.js +0 -1
- package/uis/stock/dist/assets/fr-WzBF8AXI.js +0 -1
- package/uis/stock/dist/assets/index-CXDl25BP.js +0 -53
- package/uis/stock/dist/assets/index-Cok5msAO.css +0 -2
- package/uis/stock/dist/assets/ja-DMQqF4ip.js +0 -1
- package/uis/stock/dist/assets/ko-DgfSg9v_.js +0 -1
- package/uis/stock/dist/assets/ru-DjIByX61.js +0 -1
- package/uis/stock/dist/assets/vi-DOB8nYFC.js +0 -1
- package/uis/stock/dist/assets/zh-CN-DZ3WlUgy.js +0 -1
package/AGENTS.md
DELETED
|
@@ -1,403 +0,0 @@
|
|
|
1
|
-
# AGENTS.md
|
|
2
|
-
|
|
3
|
-
`home-hosted` is a Node 24 / TypeScript harness for self-hosted servers: `up` starts a Hono/srvx panel
|
|
4
|
-
(default `127.0.0.1:3999`) that supervises the entries in each workspace's `servers.config.json` and
|
|
5
|
-
serves a UI. Package manager: pnpm. User docs: `README.md` and `docs/`.
|
|
6
|
-
|
|
7
|
-
State lives only in `$HHOSTED_HOME/.hh` (default `~/.home-hosted/.hh`). Global files sit at its top
|
|
8
|
-
level: `settings.json` (listener, auth, TLS policy, host vitals, backups, reverse proxy),
|
|
9
|
-
`workspaces.json`, `.control-secrets.json` (0600: password hash, API token hash), `.tls/`, `.backups/`,
|
|
10
|
-
`.ui/`, `.logs/` (the panel console), `.proxy/` (the engine, its generated config and nanny state), and
|
|
11
|
-
`run.json` (the live daemon's pid/url/token, 0600).
|
|
12
|
-
|
|
13
|
-
Every workspace owns `.hh/<id>/`: `settings.json` (server defaults, log retention, notifications,
|
|
14
|
-
DDNS), `servers.config.json`, `.secrets.json` (0600: Telegram bot tokens, one per destination, plus
|
|
15
|
-
DDNS credentials sealed with AES-256-GCM under `HHOSTED_DDNS_SECRET` — only DDNS is sealed, because it
|
|
16
|
-
is the one thing replayed to a third party), `.logs/` (per server, `<id>.log` plus `<id>.log.1` when it
|
|
17
|
-
rotates), and `.state/` (nanny state, its 0600 spawn spec until read, `<id>.run.json` — the last
|
|
18
|
-
detached child, which is how an orphan is found, and `ddns.json`).
|
|
19
|
-
|
|
20
|
-
A home still on the 0.6.x layout is **refused** by `ensureLayout()`, which names the file and tells the
|
|
21
|
-
person to install the latest 0.7.x; 0.8.0 does not relocate it. **The package ships no servers**: never
|
|
22
|
-
commit a config, a seed entry, or a path that names one.
|
|
23
|
-
|
|
24
|
-
## Docs
|
|
25
|
-
|
|
26
|
-
Where knowledge lives, and when to reach for each:
|
|
27
|
-
|
|
28
|
-
| tier | what it holds | when you use it |
|
|
29
|
-
| --- | --- | --- |
|
|
30
|
-
| `AGENTS.md` — this file | orientation and the rules that prevent defects | read every session; write when a rule is learned the hard way |
|
|
31
|
-
| `.agentDocs/` | depth: module rationale, traps with their causes, compatibility | read on demand, before touching that area; write when a rule needs its reasoning kept |
|
|
32
|
-
| `docs/` | how-to and reference for a person using this package | read when the task is user-facing; write in the same commit as the change |
|
|
33
|
-
| `README.md` | the first read, for a person | write alongside `docs/` |
|
|
34
|
-
|
|
35
|
-
- **One home per fact.** State the rule here, keep the reasoning in `.agentDocs/` and link it — never both.
|
|
36
|
-
- **A dead pointer is a bug.** If the target is gone, delete the pointer rather than leave it.
|
|
37
|
-
- Move depth behind a pointer once a section outgrows a screen or two; keep the rule inline.
|
|
38
|
-
|
|
39
|
-
| file | what it covers |
|
|
40
|
-
| --- | --- |
|
|
41
|
-
| [`.agentDocs/ARCHITECTURE.md`](.agentDocs/ARCHITECTURE.md) | what each module owns and why; UI versioning |
|
|
42
|
-
| [`.agentDocs/GOTCHAS.md`](.agentDocs/GOTCHAS.md) | the traps this codebase already paid for, with causes |
|
|
43
|
-
| [`.agentDocs/COMPATIBILITY.md`](.agentDocs/COMPATIBILITY.md) | config and UI compatibility, migrations |
|
|
44
|
-
| [`.agentDocs/RELEASING.md`](.agentDocs/RELEASING.md) | how a release is cut, and which version to dispatch |
|
|
45
|
-
| [`docs/SERVERS.md`](docs/SERVERS.md) | entries, presets, port conflicts, persistent entries |
|
|
46
|
-
| [`docs/NOTIFICATIONS.md`](docs/NOTIFICATIONS.md) | notification destinations: Telegram, webhooks, shared defaults |
|
|
47
|
-
| [`docs/DDNS.md`](docs/DDNS.md) | dynamic-DNS providers and hostnames |
|
|
48
|
-
| [`docs/REVERSE_PROXY.md`](docs/REVERSE_PROXY.md) | the Caddy engine, routes, certificates |
|
|
49
|
-
| [`docs/UI_CREATION.md`](docs/UI_CREATION.md) | the contract for a new UI |
|
|
50
|
-
|
|
51
|
-
## Commands
|
|
52
|
-
|
|
53
|
-
`pnpm-workspace.yaml` is load-bearing: dropping an `allowBuilds` entry makes `pnpm install` **exit 1**
|
|
54
|
-
(`Ignored build scripts: …`). Keep the file's own comments explaining why each entry is there.
|
|
55
|
-
|
|
56
|
-
```sh
|
|
57
|
-
pnpm run cli <command> # any command, against state in .dev-state/ — never ~/.home-hosted
|
|
58
|
-
pnpm run cli backup list # e.g. `pnpm run cli <anything the CLI takes>`
|
|
59
|
-
pnpm run up|down|restart|status # shorthand for the four most-used; detached, and `down` asks
|
|
60
|
-
# /_hh/shutdown and signals only a pid whose identity it confirmed
|
|
61
|
-
pnpm run start # up --foreground (systemd, docker, a foreground shell)
|
|
62
|
-
pnpm dev # tsx-watch panel :6000 + the stock UI's Vite :6001, state in .dev-state/
|
|
63
|
-
pnpm dev --ui noc-console # the same, for another UI; --port/--ui-port override
|
|
64
|
-
pnpm dev --home /tmp/hh-dev # state elsewhere; HHOSTED_HOME is IGNORED here, and the real
|
|
65
|
-
# ~/.home-hosted is refused. Dev password: `dev`
|
|
66
|
-
pnpm run build # dist/cli.js + the stock UI (uis/stock/dist)
|
|
67
|
-
pnpm run build:uis # every UI under uis/, zipped into uis/dist/ (release assets)
|
|
68
|
-
pnpm run build:locales # i18n/sheets/*.csv -> the git-ignored i18n/generated/*.json (also
|
|
69
|
-
# runs on install and before every UI build)
|
|
70
|
-
pnpm run quickcheck # eslint + tsc + vue-tsc + the doc links — NOT the tests
|
|
71
|
-
pnpm exec vitest run # `pnpm test` is vitest in watch mode
|
|
72
|
-
pnpm run check # ← THE GATE: quickcheck + vitest run --coverage. Run before every
|
|
73
|
-
# push — CI's `test.yml` is `pnpm test --coverage`, so an area floor
|
|
74
|
-
# failing there fails the push while `quickcheck` stays green.
|
|
75
|
-
pnpm run cli set-password # non-interactive through HHOSTED_PASSWORD
|
|
76
|
-
pnpm run cli set-token --generate # print a new API token once
|
|
77
|
-
pnpm run cli migrate # bring the config up to this release's schema
|
|
78
|
-
pnpm exec tsx src/cli.ts init # scaffold a project (interactive; --yes for defaults)
|
|
79
|
-
pnpm run media # regenerate docs/media; needs `pnpm exec playwright install chromium`
|
|
80
|
-
# once (browser only; `gif` alone does not)
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
The published bin is `home-hosted`, with an `hh` alias: both names run the same CLI.
|
|
84
|
-
|
|
85
|
-
**Dev servers and test instances stay in the 6xxx range** — panel 6000, UI 6001, test-spawned panels
|
|
86
|
-
6100+ (`--port`/`--ui-port`, or `HHOSTED_DEV_PANEL_PORT`/`HHOSTED_DEV_UI_PORT`). Never assume 3999 is
|
|
87
|
-
free: an installed panel or another dev instance may hold it, and the port preflight runs *before* the
|
|
88
|
-
workspace config guard, so a busy default port turns config tests red for the wrong reason.
|
|
89
|
-
|
|
90
|
-
## Conventions
|
|
91
|
-
|
|
92
|
-
- **ArkType at every runtime boundary.** Routes use `validate('json'|'query'|'param', schema)` then
|
|
93
|
-
`c.req.valid(...)`; ad-hoc payloads use `parseOrThrow`. **A request schema rejects undeclared keys**
|
|
94
|
-
(`.onUndeclaredKey('reject')`); **a response/view schema does not** — a newer panel may add a field an
|
|
95
|
-
older client still reads, and rejecting there would blank that client.
|
|
96
|
-
- **Every failure is a `DetailedError`** (`@namesmt/utils`), mapped by `src/helpers/error.ts` into one
|
|
97
|
-
envelope `{ message, code, detail }`. Never hand-roll `c.json({ error })`.
|
|
98
|
-
- **Document routes with `describeRoute` + `jsonBody(schema)`**; `jsonBody` needs a real schema.
|
|
99
|
-
- **Patch schemas carry no defaults**; nested groups merge key-by-key and an explicit `null` clears a
|
|
100
|
-
key. `ddns`'s `accounts`/`domains` are **replaced** — a merge cannot express removing a hostname.
|
|
101
|
-
- **Two-sided bounds read inclusively** (`'1 <= number.integer <= 512'`). `test/shared/contracts.test.ts`
|
|
102
|
-
pins every boundary and the patch/schema parity — update it with any schema change.
|
|
103
|
-
- **A single on/off setting is a `ToggleSwitch`**; `CheckField` is only for picking items out of a set.
|
|
104
|
-
- **A destructive action one click away confirms in a popover**, never by arming the same button for a
|
|
105
|
-
second press — an impatient double click fires an armed button. Safe choice first in tab order.
|
|
106
|
-
- **A numeric option is a whole decimal integer, never a prefix parse** (`src/cli/up.ts`): `--port 1e3`
|
|
107
|
-
and `--port 8000x` are refused, not read as 1 and 8000. A flag the command cannot honour is refused
|
|
108
|
-
too — `restart --workspace <id>` with no server id exits 1 before anything is attempted, because the
|
|
109
|
-
panel's own restart is not per-server and `down` then `up` would restart every server
|
|
110
|
-
(`test/cli/server-action.test.ts`).
|
|
111
|
-
- **A bounded read stays bounded.** `logs --lines 1e3` falls back to the default and `0x10` is not the
|
|
112
|
-
"whole log" sentinel (`src/cli/logs.ts`); `--lines N` reads a tail, never the whole file
|
|
113
|
-
(`test/cli/logs.test.ts`).
|
|
114
|
-
- **A reader that hangs up is a finished conversation, not a crash.** `treatClosedReaderAsDone()`
|
|
115
|
-
(`src/cli/io.ts`) is installed **once** at the entry; only `EPIPE` is the reader leaving
|
|
116
|
-
(`test/cli/epipe.test.ts`). Why not `SIGPIPE`: [`.agentDocs/GOTCHAS.md`](.agentDocs/GOTCHAS.md).
|
|
117
|
-
- **One refusal is one message on one stream.** A refusal's whole text goes to stderr, including any
|
|
118
|
-
list it exists to explain; stdout carries only an answer (`test/cli/backup-args.test.ts`).
|
|
119
|
-
- **A browser API that needs a secure context is absent on the origin the docs promise.** Guard the
|
|
120
|
-
feature, not the call: `copyText` (`uis/stock/src/lib/clipboard.ts`) falls back to `execCommand` and
|
|
121
|
-
returns a verdict, or a button is dead on a LAN page; `uis/stock/test/clipboard-source.test.ts`
|
|
122
|
-
fails any other file that names `navigator.clipboard`.
|
|
123
|
-
- **A row of chrome is measured at 320 px with the tap floor counted.** No mount can measure a
|
|
124
|
-
layout, so `uis/stock/test/topbar-width.test.ts` pins the declarations that keep the title from
|
|
125
|
-
collapsing to 0 px.
|
|
126
|
-
- **A retention knob bounds the directory, not a loop.** Derive the set from the directory once
|
|
127
|
-
(`ownedFiles`/`retained`, `src/services/log-files.ts`) so the list, the size and the tail agree with
|
|
128
|
-
`readdir`, and prune inside `rotate` (`test/services/log-files.test.ts`).
|
|
129
|
-
- **A file a route hands back is streamed, and the bound decides how much it matters.** `logs.maxBytes`
|
|
130
|
-
allows 100 MB per rotation, so `createReadStream` + `stat` for `Content-Length`, in both routes. A
|
|
131
|
-
schema ceiling is not a reason to buffer: it is the size a person downloads at.
|
|
132
|
-
- **A page the panel serves must not be blank without a CDN.** Render real content from
|
|
133
|
-
`spec.json` first (`src/openapi-reference.ts`), then load any richer browser as optional
|
|
134
|
-
enhancement, **pinned** — an unpinned `import` from a CDN is a third party that can break the
|
|
135
|
-
panel's page. Before blaming a library for being online-only, drive its self-hosted build offline:
|
|
136
|
-
the claim is usually about the integration, not the library.
|
|
137
|
-
- **An entry's server is not always the process the panel spawned.** A compose entry's containers
|
|
138
|
-
outlive their wrapper, so resolve what the entry *declares it runs* (`composeTarget`), stop that,
|
|
139
|
-
and decide from a **fresh listing** — never the signal or `docker stop`'s exit code, which is 0 for
|
|
140
|
-
a container it could not end. A survivor is a `conflict` naming it (`src/providers/docker.ts`).
|
|
141
|
-
- **A per-frame path may not call a syscall per server.** The frame is built once a second and once
|
|
142
|
-
per request, so anything reading the host, the filesystem or the process table from a view builder
|
|
143
|
-
is cached on its own clock, not merely memoised per call (`lanAddress`, `src/helpers/bind.ts`).
|
|
144
|
-
- **A generated config says what it means for every branch, not just the one it names.** A name no
|
|
145
|
-
policy names gets the engine's **default** (the public CA), not "no automation" — so every local
|
|
146
|
-
name must be named in the internal policy too. A state describing something that has not happened
|
|
147
|
-
is a promise: decide `local` from the leaf in the store, not the hostname's shape.
|
|
148
|
-
- **A metric with no reading is absent, never zero.** A scrape has no page to qualify a number, so an
|
|
149
|
-
alerted-on gauge published as `0` from an unsampled view is indistinguishable from a healthy one
|
|
150
|
-
and silences the rule that exists to catch it. Omit the series (`src/api/metrics.ts`), and never
|
|
151
|
-
suffix `_total` a value that a user action resets — no series here is a counter, and
|
|
152
|
-
`test/api/panel.test.ts` enumerates the scrape and fails on a `_total` name or a `counter` type.
|
|
153
|
-
- **A reading is labelled with what it measured, and a fallback must measure the same thing.** The
|
|
154
|
-
"CPU temp" tile took `Math.max` over every hwmon chip, so a box with an NVMe reported the **disk's**
|
|
155
|
-
temperature as the CPU's — and fired the temperature alert on it. Pick the sensor *by name*
|
|
156
|
-
(`coretemp`/`k10temp`/`x86_pkg_temp`/`cpu-thermal`, then `acpitz`), and take the max only inside that
|
|
157
|
-
tier, because a CPU package honestly has several dies. `pickCpuTemperature` (`src/providers/host.ts`)
|
|
158
|
-
is the one place that decides, so it is testable without a sensor. **A platform with no sensor
|
|
159
|
-
reports `null` and the UI says `n/a`** — WSL2 exposes no thermal zone at all, and the Windows host's
|
|
160
|
-
`MSAcpi_ThermalZoneTemperature` returns a constant 20 °C whatever the load, so reaching for it
|
|
161
|
-
would publish a fabricated number in the tile that exists to warn about heat.
|
|
162
|
-
- **A throttle window belongs to a message that arrived.** A send that failed must give its window
|
|
163
|
-
back (`releaseCooldown`), or the alert that would have reached a recovering receiver is the one the
|
|
164
|
-
outage took. Undo only the deadline *this* send armed; `notify()` is fire-and-forget.
|
|
165
|
-
- **A header is a byte string, and a stub does not make it one.** HTTP headers are Latin-1, so
|
|
166
|
-
validate at the door (`headerProblem`/`parseHeaders`) rather than let a `ByteString` engine message
|
|
167
|
-
land on a person's row, and treat a header name as case-insensitive
|
|
168
|
-
(`test/services/notifications.test.ts`).
|
|
169
|
-
- **Name the cause the fix follows, not the one the code path suggests.** Node reports a missing
|
|
170
|
-
working directory and a missing program with the same `ENOENT`, so `describeSpawnError` checks the
|
|
171
|
-
resolved `cwd` **and** whether the field holds a whole command line before it blames the command —
|
|
172
|
-
otherwise a deploy under systemd reads "`node` is not installed" while `node` is fine and only the
|
|
173
|
-
launch directory is wrong, and a pasted `node server.js` reads the same way while `node` is
|
|
174
|
-
installed. The same rule decides which advice a refused start prints: a config that needs `migrate`
|
|
175
|
-
must say so rather than "install the release", and a file that cannot be parsed must not claim a
|
|
176
|
-
migration `migrate` cannot perform. Ask what the person will *do* with the sentence before choosing
|
|
177
|
-
it — and when a function's own docstring names the misreading it exists to prevent, that is a claim
|
|
178
|
-
to test, not a description of the code.
|
|
179
|
-
- **One envelope per reader.** This API answers `{ message, code, detail }` for a thrown error and
|
|
180
|
-
`{ ok: false, error }` for a refused lifecycle action. A client that reads one field shows
|
|
181
|
-
`request failed with 409` for the other, losing the only sentence that explains the refusal while
|
|
182
|
-
the card beside it prints that sentence in full. Read both in **one** helper
|
|
183
|
-
(`failureMessage`, `src/shared/api-client.ts`) and scan for the hand-rolled fallback — a unit test
|
|
184
|
-
cannot see a call site that has not been written yet.
|
|
185
|
-
- **A state and the streak behind it are written together.** `health`, `healthFailures` and
|
|
186
|
-
`unhealthySince` describe one process's run, so a path that resets one and leaves the others
|
|
187
|
-
reports a duration that keeps counting while nothing is measured — measured as `status=crashed
|
|
188
|
-
health=unknown` beside `Unhealthy for 3m 17s` and a `Not Probed` row, on the card and the page.
|
|
189
|
-
The explicit stop had that shape and was fixed alone once; the exit paths behind it were the same
|
|
190
|
-
defect. One helper decides the trio (`setHealth`/`resetHealth` in `src/services/supervisor.ts`)
|
|
191
|
-
and a scan fails a direct assignment. **A client cannot assume the server got there** — a newer
|
|
192
|
-
UI is served against an older panel, so a UI rendering a *duration* gates it on the verdict it
|
|
193
|
-
prints beside it, not on whether the timestamp is present.
|
|
194
|
-
- **A measurement belongs to the process that produced it, and goes when that process does.**
|
|
195
|
-
`pid`, `responseMs` and `resources` are one run's numbers; a path that detaches the pid and keeps
|
|
196
|
-
them reports a stopped entry with a live CPU, RSS and probe (`Probe 2 Ms / RSS 64.2 MB / Procs 1`
|
|
197
|
-
beside `Stopped`, and `hh_server_cpu_percent` in the scrape). The two **exit** paths cleared them
|
|
198
|
-
and the explicit stop did not — and an **adopted** successor has no exit event at all, because the
|
|
199
|
-
panel is not its parent, so one helper (`endProcessReadings`) owns all four and a scan fails a
|
|
200
|
-
clear outside it. The rule is general: ask which **lifecycle** clears a field, not which function
|
|
201
|
-
happened to. `portState` is the deliberate exception — a port's occupancy outlives its process.
|
|
202
|
-
The client half is the same predicate as the paragraph above: both UIs read a reading through
|
|
203
|
-
`liveReadings` (`src/shared/server-readings.ts`), never off the frame, and never `?? 0` (a zero
|
|
204
|
-
is the value that looks like a measured idle process).
|
|
205
|
-
- **A list card and its detail page answer the same question; fix both.** The card is a summary of a
|
|
206
|
-
page someone opens *precisely because the summary was not enough* — so a fact the card states and
|
|
207
|
-
the page omits is worse than either alone. A stopped entry's card learned to say "not running"
|
|
208
|
-
where the chart's default promised "collecting…", and the detail page kept the promise on all
|
|
209
|
-
three of its charts, on the one screen a confused person reaches. A disabled entry's card showed a
|
|
210
|
-
`disabled` chip; its detail page greyed out Start and Restart and said nothing, losing the only
|
|
211
|
-
explanation on the way in. When you give a surface an empty state, a reason or a qualifier, grep
|
|
212
|
-
for the other surface that renders the same field and land it there too — and prefer a shared
|
|
213
|
-
component or a scan test over two call sites remembering in parallel.
|
|
214
|
-
- **A replaced list is sent only when *this form* changed it, and merged against what it was
|
|
215
|
-
filled with.** `destinations` and `routes` are lists a patch replaces, so a save writes the
|
|
216
|
-
sender's whole view — including entries it never saw. Deciding that against live state makes
|
|
217
|
-
another client's save look like this form's own edit: measured with two tabs on one workspace
|
|
218
|
-
settings page, a destination added in one tab was removed from `settings.json` by the other
|
|
219
|
-
saving an unrelated toggle. Keep the baseline the block was filled with and compare the draft to
|
|
220
|
-
*that* (`mergeReplacedList`); a list that was never filled must not travel, because `[]` on a
|
|
221
|
-
replaced list means "delete every entry".
|
|
222
|
-
- **A refused operation is a failure, never an empty success.** The backup service answers a *plan*
|
|
223
|
-
for every archive, including ones it cannot read: `plan.error` carries the refusal and `items` is
|
|
224
|
-
empty. A caller that reads only `items` reports "restored 0 items" with exit 0, which on a blank
|
|
225
|
-
host — the one situation where nobody can check the result — is indistinguishable from a restore
|
|
226
|
-
that worked. Read `error`/`needsPassword` before anything else, exit non-zero, and print `skipped`
|
|
227
|
-
when an apply leaves pieces behind (`src/cli/backup.ts`). The same shape is why a scoped id is
|
|
228
|
-
checked against the plan in **both** directions: `--exclude` with a typo excludes nothing, and an
|
|
229
|
-
archive restored that way carries exactly the credentials the person meant to drop.
|
|
230
|
-
- **An archive outlives the release that wrote it.** Read a snapshot through the migrations `migrate`
|
|
231
|
-
would run (`liftArchived`, `src/services/backups.ts`), write the **lifted** file, and stamp it with
|
|
232
|
-
the release that wrote it; the newer direction stays a refusal from the manifest.
|
|
233
|
-
- **A summary line that disagrees with the lines above it is a bug.** Count every outcome a command
|
|
234
|
-
can have.
|
|
235
|
-
- **Conventional commits** — changelogen derives the changelog and `scripts/check-release-version.mjs`
|
|
236
|
-
the version bump. Below 1.0 the **minor is the breaking channel**: a fix is a patch, a minor means
|
|
237
|
-
someone has to read the release notes and act — ask what the user has to do, not whether the commit
|
|
238
|
-
says `feat:`. Never hand-edit `package.json`. See [`.agentDocs/RELEASING.md`](.agentDocs/RELEASING.md).
|
|
239
|
-
|
|
240
|
-
## Rules that matter
|
|
241
|
-
|
|
242
|
-
These prevent defects if broken. The *why* for the non-obvious ones is in
|
|
243
|
-
[`.agentDocs/GOTCHAS.md`](.agentDocs/GOTCHAS.md).
|
|
244
|
-
|
|
245
|
-
- **A server gets only its own fields; UIs are clients.** No blessed ids and no `dataDir`-style
|
|
246
|
-
globals: an entry is `command`/`args`/`env`/`dataEnvs`/`envFile`/`bootstrap`, and `#src/*` inside
|
|
247
|
-
`src/` is the only import form — UIs use `@shared/*` (and `@server` for types only). A test fails
|
|
248
|
-
if a core file names a particular server. Integrations the panel owns as infrastructure (the proxy
|
|
249
|
-
engine, docker's container lookup, notification providers, DDNS) are not server entries and are
|
|
250
|
-
expected in `src/`.
|
|
251
|
-
- **UIs are external clients.** Nothing in `src/**` may know a UI's markup or files;
|
|
252
|
-
`$HHOSTED_HOME/.hh/.ui` overrides the packaged UI at runtime.
|
|
253
|
-
- **`src/shared` has exactly one declaration per member** — neither a UI nor `src/**` may re-declare
|
|
254
|
-
one (`test/shared/ui-parity.test.ts`).
|
|
255
|
-
- **A new response *field* is optional (`'x?'`)** and read defensively: an upgrade writes a new UI while
|
|
256
|
-
an old panel keeps serving, so a required field blanks the app.
|
|
257
|
-
- **UIs move together.** A change to `uis/stock` — or to a shared contract it reads — lands in every
|
|
258
|
-
other UI under `uis/`, and each altered UI raises its `ui.json` version; `scripts/stamp-uis.mjs`
|
|
259
|
-
**refuses** a commit that changed a shipped UI without raising it (a UI's `test/` and its own
|
|
260
|
-
`README.md` are exempt — neither is in the built asset).
|
|
261
|
-
`src/shared/**` is a UI build input, so a runtime contract needs the bump too — the hook does not
|
|
262
|
-
inspect that commit. **`tag` and `unix` are build provenance**, stamped into `dist/ui.json` by
|
|
263
|
-
`build-uis.mjs`; never committed to `uis/<name>/public/ui.json`.
|
|
264
|
-
- **Paths.** `dataRoot` is state, under `dataRoot/.hh`; `projectDir` is the base for relative entry
|
|
265
|
-
paths. `{…}` and `${ENV}` expand in config — the full list is the table in
|
|
266
|
-
[`docs/SERVERS.md`](docs/SERVERS.md), which is what to keep in step. No package-relative state.
|
|
267
|
-
- **Secrets never enter the config.** Only policy goes in a config file; every secret is 0600.
|
|
268
|
-
- **Never expose beyond loopback without auth and a non-default password.** `checkExposure()` is the
|
|
269
|
-
single rule, enforced at startup, on every settings write, and in the UI. `checkProxyExposure()` is
|
|
270
|
-
the same bar for a proxy route pointing at the panel — **`tls` does not change that bar.**
|
|
271
|
-
- **A credential is scoped to its origin.** A release-asset download must not carry its token across a
|
|
272
|
-
cross-origin redirect; the runtime strips `authorization` today, so that is pinned against two real
|
|
273
|
-
servers rather than a stubbed `fetch` (`test/providers/ui-release.test.ts`).
|
|
274
|
-
- **The CLI drives a running panel through `/_hh`, never `/api`.** `down` and `start`/`stop` read
|
|
275
|
-
run.json's token over loopback through one guard (`assertLocalCall`), so they need no session. A new
|
|
276
|
-
local command must not open an unauthenticated `/api` route.
|
|
277
|
-
- **A server id is only unique inside its workspace.** Anything keyed by id alone — SSE, log buffers,
|
|
278
|
-
series, route params — must key on `(workspaceId, serverId)`, or same-named servers mix frames.
|
|
279
|
-
**So must "what this panel owns."** A per-workspace service answering a panel-wide question — "is
|
|
280
|
-
this pid ours?" — asks its own workspace and silently gets the wrong answer for the others: a port
|
|
281
|
-
held by a sibling workspace's server read as a stranger, so `free-port` terminated it and `follow`
|
|
282
|
-
adopted it into the wrong workspace (two workspaces then claimed one pid). The panel is the only
|
|
283
|
-
thing that can see every workspace, so it injects the answer (`SupervisorOptions.siblingServers`)
|
|
284
|
-
and a lone supervisor has none. Such a refusal must also say **where** the holder lives: "stop that
|
|
285
|
-
server instead" is a dead end when that server is on a page this workspace cannot show.
|
|
286
|
-
- **A workspace is the ownership boundary.** Servers, secrets, logs and nanny state belong to exactly
|
|
287
|
-
one; only listener, auth, TLS, host vitals, backups, UI and `run.json` are panel-wide. Reach a
|
|
288
|
-
per-workspace service through `PanelService.requireWorkspace(id)`, never a module global.
|
|
289
|
-
- **A restore writes only where a config says** — archive allowlist, `origin` matching first, symlinks
|
|
290
|
-
never recreated.
|
|
291
|
-
- **A declared path is the capture boundary, and its bytes keep their modes.** *Both* directions of a
|
|
292
|
-
backup obey the declared path: the restore may not write through a link that leaves it, and the
|
|
293
|
-
capture may not read through one — a `media -> /mnt/nas` link inside a declared `data/` put the whole
|
|
294
|
-
share in every archive, and `du` on the declared path still said empty. The allowlist is a *move*
|
|
295
|
-
rule, not a character rule: `My Photos/` and `ünïcode/日本語.txt` are what a real data tree holds, so
|
|
296
|
-
a `\w` allowlist refused the archive the panel had just written. And a mode is part of the data —
|
|
297
|
-
`0600`/`0700`/`0755` travel, a setuid bit does not — because a restore that widens a secret to `0644`
|
|
298
|
-
changes who can read what the backup existed to protect.
|
|
299
|
-
`src/providers/archive.ts` (`walk`, `permissionBits`), `src/services/backups.ts`
|
|
300
|
-
(`isSafeArchiveEntry`), `test/providers/archive.test.ts`.
|
|
301
|
-
- **A port is only ever freed from a fresh lookup, never a quoted pid.** `free-port` re-lists the
|
|
302
|
-
listeners and refuses any in `supervisedPids()` instead of killing it; a docker-published port has
|
|
303
|
-
no pid this user may see, so the container docker reports publishing *that* port is stopped instead.
|
|
304
|
-
- **A live pid is not the running panel.** Pids are recycled and a zombie still answers signal 0, so `up`/`status`/`down` decide
|
|
305
|
-
with `runtimeIsAlive`/`runtimeLiveness` (pid **plus** `run.json`'s own `startedAt`), never
|
|
306
|
-
`isProcessAlive` alone. Only `'gone'` deletes a record; `'unknown'` counts as alive, and `'recycled'`
|
|
307
|
-
blocks a **signal** but still allows the token-authenticated `/_hh/shutdown`, because the birth time is
|
|
308
|
-
wall-clock-derived.
|
|
309
|
-
- **Only `kill` ever touches a process the panel could not identify** — which is why it logs the pids
|
|
310
|
-
it stopped. `follow` adopts this entry's own successor, `reclaim` replaces it; ownership is the
|
|
311
|
-
entry's whole **tree**, and the panel's own tree is excluded.
|
|
312
|
-
- **A persistent entry is run by its own nanny** (`src/services/nanny.ts`), which owns the pipes and
|
|
313
|
-
mirrors the exit — the only arrangement that outlives the panel *and* keeps logging. The nanny never
|
|
314
|
-
restarts anything: retries and health stay the supervisor's. Three lifetimes are pinned (see
|
|
315
|
-
[`.agentDocs/GOTCHAS.md`](.agentDocs/GOTCHAS.md)).
|
|
316
|
-
- **The reverse proxy's engine is a process the panel owns, not a server entry.** Its config is applied
|
|
317
|
-
through the engine's admin API (atomic, never hand-edited), it runs under the same nanny a
|
|
318
|
-
`persistent: true` entry uses, and its admin endpoint stays panel-side.
|
|
319
|
-
- **A claim that a dependency touches nothing else has to be checked against the dependency.** The
|
|
320
|
-
proxy docs said "nothing else on the machine is touched", and the engine's own log said otherwise on
|
|
321
|
-
the very first start: `pki.ca.local | installing root certificate (you might be prompted for
|
|
322
|
-
password)` then `certificate installed properly in linux trusts` — the local CA's root goes into
|
|
323
|
-
`/etc/ssl/certs`, which is why a `.lan` name is trusted at all, and why that first start needs
|
|
324
|
-
`sudo`. Measured: one new `Caddy_Local_Authority_-_2026_ECC_Root*.pem` per engine data directory, so
|
|
325
|
-
two homes on one box leave two roots, and a root outlives the `.hh` it came from. The knob exists
|
|
326
|
-
(`apps.pki.certificate_authorities.local.install_trust`, verified by `POST /load`: `install_trust`
|
|
327
|
-
under `ca`, under `apps.tls`, and on the issuer are all `unknown field`) and the panel does not set
|
|
328
|
-
it, which is the right default — but the doc has to say what happens. Any run of the engine against
|
|
329
|
-
a scratch home therefore **writes the host's trust store**; say so and clean up the root and its
|
|
330
|
-
`/etc/ssl/certs` hash symlinks, or the next round inherits a machine with a dozen dead CAs.
|
|
331
|
-
|
|
332
|
-
- **Cross-platform is a hard requirement.** Linux/macOS/Windows: `/proc` vs `ps` vs Win32_Process,
|
|
333
|
-
process groups vs `taskkill /T`, graceful fallbacks, no shell utilities assumed. Three Windows
|
|
334
|
-
behaviours no other runner here can exercise, so each is decided in **one shared helper** rather
|
|
335
|
-
than at the call site: a state file hand-edited in a Windows editor carries a byte-order mark or is
|
|
336
|
-
UTF-16, so it is read through `readStateFile` (`src/helpers/config-text.ts`) and never
|
|
337
|
-
`readFileSync(file, 'utf8')`; a bare command found in `node_modules/.bin` must resolve to a shim
|
|
338
|
-
Windows can start, never the `#!/bin/sh` script written beside it (`resolveCommand`); and text
|
|
339
|
-
printed **for a person to paste** is quoted for the shell it targets (`cdCommand`).
|
|
340
|
-
- **Writes are atomic** (`writeFileAtomic`) and validated before commit.
|
|
341
|
-
|
|
342
|
-
## How to work here
|
|
343
|
-
|
|
344
|
-
- **Check the callers before you change anything.** Grep who uses it and which tests name it. If the
|
|
345
|
-
impact is unclear, say so — do not guess.
|
|
346
|
-
- **Never overwrite or delete a large section you have not understood.** Read it, or say what you could
|
|
347
|
-
not determine and ask.
|
|
348
|
-
- **Do not invent requirements.** Build what was asked; surface what else you notice and let it be
|
|
349
|
-
decided.
|
|
350
|
-
- **Fix the class, not the instance.** A copied helper, a rule stated twice, a guard bypassed by a
|
|
351
|
-
second path is one problem: one implementation, one guard. That is the work, not a follow-up to ask
|
|
352
|
-
for. Stay inside the task rather than refactoring the world.
|
|
353
|
-
- **Verify before claiming, and say what you checked.** A passing test is not evidence it pins
|
|
354
|
-
anything — **break the thing it guards and watch it fail.** If it still passes, either the test is
|
|
355
|
-
decoration or a different guard is running; find out which. Where a stub cannot answer the question,
|
|
356
|
-
drive the real thing.
|
|
357
|
-
- **Never write an identifier from memory.** A commit hash, path, line number or version must be quoted
|
|
358
|
-
from the source; a plausible-looking invented one is worse than none.
|
|
359
|
-
- **A stated blocker is a hypothesis, not a fact.** Re-test "cannot install X" / "tool unavailable"
|
|
360
|
-
before inheriting it, and never report a failure your own flag forced.
|
|
361
|
-
- **Report the risk with the change** — correctness, security, operational and integration; plus what
|
|
362
|
-
you could not verify and every assumption you made. An unverified claim marked as such beats a
|
|
363
|
-
confident one that is wrong.
|
|
364
|
-
- **Missing recall of this repo?** Read this file, `.agentDocs/` and `git log` before acting, then ask
|
|
365
|
-
1–3 focused questions rather than guessing at intent.
|
|
366
|
-
- **One guard here looked like the one that runs and was not**: `declaredData` marks a path
|
|
367
|
-
`included: false` so the copy never starts, while the check inside `copyInto` is a second line that
|
|
368
|
-
route does not reach.
|
|
369
|
-
|
|
370
|
-
## Conciseness
|
|
371
|
-
|
|
372
|
-
**Prune verbose, keep correctness** — code, comments, docs alike.
|
|
373
|
-
|
|
374
|
-
- Code: a comment only for non-obvious *intent*, never to restate the line, and never long. An
|
|
375
|
-
argument for the change belongs in the commit message.
|
|
376
|
-
- Docs: one idea per sentence. Cut anything that would not change what a reader does.
|
|
377
|
-
- Delete history `git log` already holds — keep the *rule* that came out of it, not the story.
|
|
378
|
-
- **Never drop a caveat to save a line.** Concise means no filler, not fewer facts.
|
|
379
|
-
|
|
380
|
-
## User-facing docs
|
|
381
|
-
|
|
382
|
-
`README.md` and the topical `docs/*.md` are for a person, not an agent:
|
|
383
|
-
|
|
384
|
-
- **Concise first read**, depth behind collapsible `<details>` spoilers, and **visuals for skimmers** —
|
|
385
|
-
the media in `docs/media/` is regenerated by `pnpm run media`.
|
|
386
|
-
- **Docs ship with the change.** A user-visible change updates the docs that describe it in the *same
|
|
387
|
-
commit*. A stale doc is a bug like stale code.
|
|
388
|
-
|
|
389
|
-
## Where to extend
|
|
390
|
-
|
|
391
|
-
- **Route**: `src/api/<x>.ts` (chained factory) → mount in `src/app.ts` → schemas in
|
|
392
|
-
`src/shared/contracts.ts` → `describeRoute` + `jsonBody`. A workspace-scoped route takes
|
|
393
|
-
`?workspace=<id>` (`workspaceQuerySchema` + `requireWorkspace` in `src/helpers/workspace.ts`); an
|
|
394
|
-
omitted id means the default workspace, never another one.
|
|
395
|
-
- **Server field**: `serverSchema` + its patch in contracts, merge keys in `src/config/patch.ts` when
|
|
396
|
-
nested, the form in `uis/stock/src/components/settings/`, and the contract tests.
|
|
397
|
-
- **UI**: a new `uis/<name>/` with a `vite.config.ts` from the shared factory;
|
|
398
|
-
`node scripts/build-uis.mjs <name> --zip`. The contract is `docs/UI_CREATION.md`.
|
|
399
|
-
- **Capability**: a stateless `src/providers/*` returning plain data; a DDNS provider is one file plus a
|
|
400
|
-
registry line (`src/providers/ddns/index.ts`) — the settings form, credentials and validation follow
|
|
401
|
-
from its metadata (`docs/DDNS.md`). A provider that is a **directory** also needs its own
|
|
402
|
-
`package.json#imports` entry, because `#src/*` maps to a path and Node refuses a directory import
|
|
403
|
-
(`test/helpers/imports.test.ts`).
|