@homeflare/alchemy 0.5.0 → 0.7.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 (288) hide show
  1. package/README.md +68 -55
  2. package/dist/caddy/admin-calls.d.ts +48 -0
  3. package/dist/caddy/admin-calls.d.ts.map +1 -0
  4. package/dist/caddy/admin-guard.d.ts +40 -0
  5. package/dist/caddy/admin-guard.d.ts.map +1 -0
  6. package/dist/caddy/admin.d.ts +73 -0
  7. package/dist/caddy/admin.d.ts.map +1 -0
  8. package/dist/caddy/caddyfile-tripwire.d.ts +5 -0
  9. package/dist/caddy/caddyfile-tripwire.d.ts.map +1 -0
  10. package/dist/caddy/config-form.d.ts +27 -0
  11. package/dist/caddy/config-form.d.ts.map +1 -0
  12. package/dist/caddy/config-lifecycle.d.ts +45 -0
  13. package/dist/caddy/config-lifecycle.d.ts.map +1 -0
  14. package/dist/caddy/config.d.ts +30 -0
  15. package/dist/caddy/config.d.ts.map +1 -0
  16. package/dist/caddy/digest.d.ts +7 -0
  17. package/dist/caddy/digest.d.ts.map +1 -0
  18. package/dist/caddy/fake-caddy.d.ts +43 -0
  19. package/dist/caddy/fake-caddy.d.ts.map +1 -0
  20. package/dist/caddy/index.d.ts +21 -0
  21. package/dist/caddy/index.d.ts.map +1 -0
  22. package/dist/caddy/index.js +912 -0
  23. package/dist/caddy/index.js.map +28 -0
  24. package/dist/caddy/local-admin.d.ts +45 -0
  25. package/dist/caddy/local-admin.d.ts.map +1 -0
  26. package/dist/caddy/providers.d.ts +14 -0
  27. package/dist/caddy/providers.d.ts.map +1 -0
  28. package/dist/caddy/with-file.d.ts +47 -0
  29. package/dist/caddy/with-file.d.ts.map +1 -0
  30. package/dist/cloudflare/fake-mesh.d.ts +58 -0
  31. package/dist/cloudflare/fake-mesh.d.ts.map +1 -0
  32. package/dist/cloudflare/index.d.ts +9 -3
  33. package/dist/cloudflare/index.d.ts.map +1 -1
  34. package/dist/cloudflare/index.js +218 -7
  35. package/dist/cloudflare/index.js.map +9 -4
  36. package/dist/cloudflare/mesh-node-api.d.ts +75 -0
  37. package/dist/cloudflare/mesh-node-api.d.ts.map +1 -0
  38. package/dist/cloudflare/mesh-node-form.d.ts +82 -0
  39. package/dist/cloudflare/mesh-node-form.d.ts.map +1 -0
  40. package/dist/cloudflare/mesh-node-harness.d.ts +46 -0
  41. package/dist/cloudflare/mesh-node-harness.d.ts.map +1 -0
  42. package/dist/cloudflare/mesh-node-lifecycle.d.ts +22 -0
  43. package/dist/cloudflare/mesh-node-lifecycle.d.ts.map +1 -0
  44. package/dist/cloudflare/mesh-node-token.d.ts +23 -0
  45. package/dist/cloudflare/mesh-node-token.d.ts.map +1 -0
  46. package/dist/cloudflare/mesh-node.d.ts +48 -0
  47. package/dist/cloudflare/mesh-node.d.ts.map +1 -0
  48. package/dist/cloudflare/providers.d.ts +1 -12
  49. package/dist/cloudflare/providers.d.ts.map +1 -1
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/launchd/fake-runner.d.ts +36 -0
  53. package/dist/launchd/fake-runner.d.ts.map +1 -0
  54. package/dist/launchd/host-effect.d.ts +19 -0
  55. package/dist/launchd/host-effect.d.ts.map +1 -0
  56. package/dist/launchd/host-file-form.d.ts +24 -0
  57. package/dist/launchd/host-file-form.d.ts.map +1 -0
  58. package/dist/launchd/host-file-lifecycle.d.ts +29 -0
  59. package/dist/launchd/host-file-lifecycle.d.ts.map +1 -0
  60. package/dist/launchd/host-file.d.ts +25 -0
  61. package/dist/launchd/host-file.d.ts.map +1 -0
  62. package/dist/launchd/host-lookup.d.ts +27 -0
  63. package/dist/launchd/host-lookup.d.ts.map +1 -0
  64. package/dist/launchd/index.d.ts +21 -0
  65. package/dist/launchd/index.d.ts.map +1 -0
  66. package/dist/launchd/index.js +969 -0
  67. package/dist/launchd/index.js.map +25 -0
  68. package/dist/launchd/job-form.d.ts +90 -0
  69. package/dist/launchd/job-form.d.ts.map +1 -0
  70. package/dist/launchd/job-lifecycle.d.ts +34 -0
  71. package/dist/launchd/job-lifecycle.d.ts.map +1 -0
  72. package/dist/launchd/job-preflight.d.ts +50 -0
  73. package/dist/launchd/job-preflight.d.ts.map +1 -0
  74. package/dist/launchd/job-validate.d.ts +25 -0
  75. package/dist/launchd/job-validate.d.ts.map +1 -0
  76. package/dist/launchd/job.d.ts +34 -0
  77. package/dist/launchd/job.d.ts.map +1 -0
  78. package/dist/launchd/launchctl.d.ts +62 -0
  79. package/dist/launchd/launchctl.d.ts.map +1 -0
  80. package/dist/launchd/local-runner.d.ts +7 -0
  81. package/dist/launchd/local-runner.d.ts.map +1 -0
  82. package/dist/launchd/plist.d.ts +41 -0
  83. package/dist/launchd/plist.d.ts.map +1 -0
  84. package/dist/launchd/providers.d.ts +15 -0
  85. package/dist/launchd/providers.d.ts.map +1 -0
  86. package/dist/launchd/runner.d.ts +91 -0
  87. package/dist/launchd/runner.d.ts.map +1 -0
  88. package/dist/launchd/secret-tripwire.d.ts +24 -0
  89. package/dist/launchd/secret-tripwire.d.ts.map +1 -0
  90. package/dist/openbao/auth-method-form.d.ts +7 -0
  91. package/dist/openbao/auth-method-form.d.ts.map +1 -1
  92. package/dist/openbao/auth-method-reconcile.d.ts +15 -0
  93. package/dist/openbao/auth-method-reconcile.d.ts.map +1 -0
  94. package/dist/openbao/auth-method.d.ts +6 -0
  95. package/dist/openbao/auth-method.d.ts.map +1 -1
  96. package/dist/openbao/auth-role-form.d.ts +9 -0
  97. package/dist/openbao/auth-role-form.d.ts.map +1 -1
  98. package/dist/openbao/auth-role.d.ts.map +1 -1
  99. package/dist/openbao/auth-token-form.d.ts +48 -0
  100. package/dist/openbao/auth-token-form.d.ts.map +1 -0
  101. package/dist/openbao/bao-identity.d.ts +81 -0
  102. package/dist/openbao/bao-identity.d.ts.map +1 -0
  103. package/dist/openbao/bao-namespace.d.ts +20 -0
  104. package/dist/openbao/bao-namespace.d.ts.map +1 -0
  105. package/dist/openbao/cloudflare-role.d.ts.map +1 -1
  106. package/dist/openbao/cloudflare-roles-expand.d.ts.map +1 -1
  107. package/dist/openbao/fake-engines.d.ts +30 -0
  108. package/dist/openbao/fake-engines.d.ts.map +1 -0
  109. package/dist/openbao/fake-stack.d.ts +29 -0
  110. package/dist/openbao/fake-stack.d.ts.map +1 -0
  111. package/dist/openbao/host-approles.d.ts +62 -0
  112. package/dist/openbao/host-approles.d.ts.map +1 -0
  113. package/dist/openbao/index.d.ts +19 -0
  114. package/dist/openbao/index.d.ts.map +1 -1
  115. package/dist/openbao/index.js +1518 -310
  116. package/dist/openbao/index.js.map +40 -17
  117. package/dist/openbao/jwt-config-form.d.ts +51 -0
  118. package/dist/openbao/jwt-config-form.d.ts.map +1 -0
  119. package/dist/openbao/jwt-config.d.ts +25 -0
  120. package/dist/openbao/jwt-config.d.ts.map +1 -0
  121. package/dist/openbao/jwt-role-form.d.ts +91 -0
  122. package/dist/openbao/jwt-role-form.d.ts.map +1 -0
  123. package/dist/openbao/jwt-role.d.ts +31 -0
  124. package/dist/openbao/jwt-role.d.ts.map +1 -0
  125. package/dist/openbao/kubernetes-role-form.d.ts +68 -0
  126. package/dist/openbao/kubernetes-role-form.d.ts.map +1 -0
  127. package/dist/openbao/kubernetes-role.d.ts +25 -0
  128. package/dist/openbao/kubernetes-role.d.ts.map +1 -0
  129. package/dist/openbao/mfa-enforcement-form.d.ts +46 -0
  130. package/dist/openbao/mfa-enforcement-form.d.ts.map +1 -0
  131. package/dist/openbao/mfa-enforcement.d.ts +41 -0
  132. package/dist/openbao/mfa-enforcement.d.ts.map +1 -0
  133. package/dist/openbao/mfa-totp-form.d.ts +52 -0
  134. package/dist/openbao/mfa-totp-form.d.ts.map +1 -0
  135. package/dist/openbao/mfa-totp.d.ts +33 -0
  136. package/dist/openbao/mfa-totp.d.ts.map +1 -0
  137. package/dist/openbao/mfa-wire.d.ts +63 -0
  138. package/dist/openbao/mfa-wire.d.ts.map +1 -0
  139. package/dist/openbao/mount-form.d.ts +7 -0
  140. package/dist/openbao/mount-form.d.ts.map +1 -1
  141. package/dist/openbao/mount-move.d.ts +49 -0
  142. package/dist/openbao/mount-move.d.ts.map +1 -0
  143. package/dist/openbao/mount-path.d.ts +8 -4
  144. package/dist/openbao/mount-path.d.ts.map +1 -1
  145. package/dist/openbao/mount-reconcile.d.ts +16 -0
  146. package/dist/openbao/mount-reconcile.d.ts.map +1 -0
  147. package/dist/openbao/mount.d.ts +9 -0
  148. package/dist/openbao/mount.d.ts.map +1 -1
  149. package/dist/openbao/pki-role-canonical.d.ts +46 -0
  150. package/dist/openbao/pki-role-canonical.d.ts.map +1 -0
  151. package/dist/openbao/pki-role-form.d.ts +38 -30
  152. package/dist/openbao/pki-role-form.d.ts.map +1 -1
  153. package/dist/openbao/pki-role.d.ts.map +1 -1
  154. package/dist/openbao/policy.d.ts +2 -0
  155. package/dist/openbao/policy.d.ts.map +1 -1
  156. package/dist/openbao/proxmox-role-form.d.ts +18 -8
  157. package/dist/openbao/proxmox-role-form.d.ts.map +1 -1
  158. package/dist/openbao/proxmox-role-wire.d.ts +18 -0
  159. package/dist/openbao/proxmox-role-wire.d.ts.map +1 -0
  160. package/dist/openbao/proxmox-role.d.ts.map +1 -1
  161. package/dist/openbao/remount-wire.d.ts +44 -0
  162. package/dist/openbao/remount-wire.d.ts.map +1 -0
  163. package/dist/openbao/rename.d.ts +106 -0
  164. package/dist/openbao/rename.d.ts.map +1 -0
  165. package/dist/openbao/role-reconcile.d.ts +40 -0
  166. package/dist/openbao/role-reconcile.d.ts.map +1 -0
  167. package/docs/caddy.md +180 -0
  168. package/docs/launchd.md +167 -0
  169. package/docs/mesh-node.md +188 -0
  170. package/package.json +12 -2
  171. package/src/caddy/admin-calls.ts +128 -0
  172. package/src/caddy/admin-guard.ts +170 -0
  173. package/src/caddy/admin.ts +74 -0
  174. package/src/caddy/caddyfile-tripwire.ts +133 -0
  175. package/src/caddy/config-form.ts +64 -0
  176. package/src/caddy/config-lifecycle.test.ts +218 -0
  177. package/src/caddy/config-lifecycle.ts +148 -0
  178. package/src/caddy/config.ts +116 -0
  179. package/src/caddy/digest.ts +44 -0
  180. package/src/caddy/fake-caddy.ts +160 -0
  181. package/src/caddy/guards.test.ts +156 -0
  182. package/src/caddy/index.ts +25 -0
  183. package/src/caddy/local-admin.test.ts +160 -0
  184. package/src/caddy/local-admin.ts +189 -0
  185. package/src/caddy/providers.test.ts +244 -0
  186. package/src/caddy/providers.ts +17 -0
  187. package/src/caddy/with-file.ts +62 -0
  188. package/src/cloudflare/fake-mesh.ts +181 -0
  189. package/src/cloudflare/index.ts +9 -3
  190. package/src/cloudflare/mesh-node-api.ts +127 -0
  191. package/src/cloudflare/mesh-node-edges.test.ts +103 -0
  192. package/src/cloudflare/mesh-node-form.test.ts +80 -0
  193. package/src/cloudflare/mesh-node-form.ts +115 -0
  194. package/src/cloudflare/mesh-node-harness.ts +124 -0
  195. package/src/cloudflare/mesh-node-lifecycle.ts +187 -0
  196. package/src/cloudflare/mesh-node-policy.test.ts +151 -0
  197. package/src/cloudflare/mesh-node-token.test.ts +117 -0
  198. package/src/cloudflare/mesh-node-token.ts +125 -0
  199. package/src/cloudflare/mesh-node.test.ts +172 -0
  200. package/src/cloudflare/mesh-node.ts +120 -0
  201. package/src/cloudflare/providers.ts +20 -2
  202. package/src/index.ts +2 -0
  203. package/src/launchd/fake-runner.ts +176 -0
  204. package/src/launchd/host-effect.ts +28 -0
  205. package/src/launchd/host-file-form.ts +71 -0
  206. package/src/launchd/host-file-lifecycle.test.ts +198 -0
  207. package/src/launchd/host-file-lifecycle.ts +164 -0
  208. package/src/launchd/host-file.ts +64 -0
  209. package/src/launchd/host-lookup.test.ts +92 -0
  210. package/src/launchd/host-lookup.ts +94 -0
  211. package/src/launchd/index.ts +26 -0
  212. package/src/launchd/job-form.test.ts +171 -0
  213. package/src/launchd/job-form.ts +180 -0
  214. package/src/launchd/job-identity.test.ts +147 -0
  215. package/src/launchd/job-lifecycle.test.ts +220 -0
  216. package/src/launchd/job-lifecycle.ts +194 -0
  217. package/src/launchd/job-preflight.ts +152 -0
  218. package/src/launchd/job-validate.ts +134 -0
  219. package/src/launchd/job.ts +96 -0
  220. package/src/launchd/launchctl.test.ts +181 -0
  221. package/src/launchd/launchctl.ts +188 -0
  222. package/src/launchd/local-runner.test.ts +125 -0
  223. package/src/launchd/local-runner.ts +143 -0
  224. package/src/launchd/plist.test.ts +186 -0
  225. package/src/launchd/plist.ts +156 -0
  226. package/src/launchd/providers.test.ts +222 -0
  227. package/src/launchd/providers.ts +21 -0
  228. package/src/launchd/runner.ts +95 -0
  229. package/src/launchd/secret-tripwire.test.ts +110 -0
  230. package/src/launchd/secret-tripwire.ts +81 -0
  231. package/src/openbao/README.md +181 -0
  232. package/src/openbao/REPLACE.md +163 -0
  233. package/src/openbao/auth-method-form.ts +7 -0
  234. package/src/openbao/auth-method-reconcile.ts +74 -0
  235. package/src/openbao/auth-method.ts +20 -41
  236. package/src/openbao/auth-role-form.test.ts +16 -1
  237. package/src/openbao/auth-role-form.ts +11 -0
  238. package/src/openbao/auth-role.ts +12 -0
  239. package/src/openbao/auth-token-form.ts +161 -0
  240. package/src/openbao/bao-identity.test.ts +131 -0
  241. package/src/openbao/bao-identity.ts +188 -0
  242. package/src/openbao/bao-namespace.ts +32 -0
  243. package/src/openbao/cloudflare-role-wire.test.ts +8 -34
  244. package/src/openbao/cloudflare-role.ts +30 -8
  245. package/src/openbao/cloudflare-roles-expand.ts +2 -5
  246. package/src/openbao/fake-engines.ts +119 -0
  247. package/src/openbao/fake-stack.ts +112 -0
  248. package/src/openbao/host-approles.test.ts +121 -0
  249. package/src/openbao/host-approles.ts +126 -0
  250. package/src/openbao/index.ts +19 -0
  251. package/src/openbao/jwt-config-form.ts +161 -0
  252. package/src/openbao/jwt-config.ts +85 -0
  253. package/src/openbao/jwt-role-form.test.ts +130 -0
  254. package/src/openbao/jwt-role-form.ts +231 -0
  255. package/src/openbao/jwt-role.ts +102 -0
  256. package/src/openbao/kubernetes-role-form.test.ts +82 -0
  257. package/src/openbao/kubernetes-role-form.ts +149 -0
  258. package/src/openbao/kubernetes-role.ts +94 -0
  259. package/src/openbao/mfa-enforcement-form.ts +147 -0
  260. package/src/openbao/mfa-enforcement.ts +143 -0
  261. package/src/openbao/mfa-totp-form.ts +155 -0
  262. package/src/openbao/mfa-totp.ts +118 -0
  263. package/src/openbao/mfa-wire.ts +117 -0
  264. package/src/openbao/mfa.test.ts +200 -0
  265. package/src/openbao/mount-form.ts +9 -1
  266. package/src/openbao/mount-move.test.ts +164 -0
  267. package/src/openbao/mount-move.ts +113 -0
  268. package/src/openbao/mount-path.test.ts +11 -1
  269. package/src/openbao/mount-path.ts +17 -11
  270. package/src/openbao/mount-reconcile.ts +75 -0
  271. package/src/openbao/mount.ts +26 -43
  272. package/src/openbao/pki-role-canonical.ts +163 -0
  273. package/src/openbao/pki-role-form.test.ts +112 -0
  274. package/src/openbao/pki-role-form.ts +76 -110
  275. package/src/openbao/pki-role.ts +12 -27
  276. package/src/openbao/policy-rename.test.ts +112 -0
  277. package/src/openbao/policy-wire.test.ts +7 -26
  278. package/src/openbao/policy.ts +27 -4
  279. package/src/openbao/proxmox-role-form.ts +27 -8
  280. package/src/openbao/proxmox-role-wire.ts +24 -0
  281. package/src/openbao/proxmox-role.ts +62 -37
  282. package/src/openbao/remount-wire.test.ts +87 -0
  283. package/src/openbao/remount-wire.ts +112 -0
  284. package/src/openbao/rename-occupied.test.ts +166 -0
  285. package/src/openbao/rename.ts +162 -0
  286. package/src/openbao/role-reconcile.test.ts +104 -0
  287. package/src/openbao/role-reconcile.ts +84 -0
  288. package/src/openbao/role-rename.test.ts +205 -0
@@ -0,0 +1,28 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/caddy/admin.ts", "../src/launchd/job-form.ts", "../src/launchd/plist.ts", "../src/caddy/digest.ts", "../src/caddy/admin-calls.ts", "../src/caddy/config.ts", "../src/launchd/host-effect.ts", "../src/caddy/admin-guard.ts", "../src/launchd/secret-tripwire.ts", "../src/caddy/caddyfile-tripwire.ts", "../src/caddy/config-form.ts", "../src/caddy/config-lifecycle.ts", "../src/caddy/local-admin.ts", "../src/caddy/providers.ts", "../src/caddy/with-file.ts", "../src/launchd/host-file.ts", "../src/launchd/host-file-form.ts", "../src/launchd/runner.ts", "../src/launchd/host-file-lifecycle.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * The one seam between the Caddy provider and a running Caddy: every call to Caddy's admin API goes\n * through a CaddyAdmin, and nothing in this directory reaches Caddy any other way.\n *\n * ★ CADDY's OWN MANAGEMENT API, NOT A FILE AND A SIGNAL. Decision 23 (vault consolidation plan,\n * 2026-09-21): `POST /load` applies a Caddyfile with a graceful reload and rolls back a config\n * Caddy refuses; `GET /config/` reports what is running. Read in caddyserver/caddy v2.11.4,\n * caddyconfig/load.go and admin.go, and in the API docs (caddyserver.com/docs/api).\n * ★ A SEAM, THE SAME SHAPE AS launchd's HostRunner, so the lifecycle runs against a fake admin\n * server in tests and a consumer can plug in another route to the API (an SSH-forwarded socket\n * today; a remote runner later) without touching the provider. PROMISES, NOT EFFECTS, for the\n * same reason as HostRunner: a consumer writing their own implements plain async functions.\n * ⛔ THE ADMIN API HAS NO AUTHENTICATION. Anyone who reaches it can replace every site. It stays on\n * loopback or a unix socket; localCaddyAdmin() refuses anything else (local-admin.ts).\n */\nimport * as Context from 'effect/Context';\nimport * as Layer from 'effect/Layer';\n\n/** One admin API exchange. ⛔ `body` may hold the running config — never log it whole. */\nexport type CaddyAdminResponse = {\n readonly status: number;\n readonly body: string;\n};\n\nexport type CaddyAdminRequest = {\n readonly method: 'GET' | 'POST';\n /** Absolute API path: `/load`, `/adapt`, `/config/`. */\n readonly path: string;\n readonly headers?: Readonly<Record<string, string>>;\n readonly body?: string;\n};\n\n/**\n * Where the admin listener is, in the terms Caddy's own `admin` option uses — so a Caddyfile that\n * would move the listener away from where the provider talks to it can be refused (admin-guard.ts).\n */\nexport type CaddyAdminListener =\n | { readonly kind: 'tcp'; readonly hostHeader: string; readonly port: number }\n | { readonly kind: 'unix'; readonly path: string };\n\nexport interface CaddyAdmin {\n /** Where requests go, for error messages and the resource's attributes. Never a credential. */\n readonly endpoint: string;\n /**\n * The listener as Caddy sees it. `hostHeader` is the Host every request carries: Caddy checks it\n * against `admin.origins` (admin.go checkHost) on any loopback TCP listener.\n */\n readonly listener: CaddyAdminListener;\n /**\n * Send one request. Resolves with ANY status — classifying it is the caller's job\n * (admin-calls.ts). Rejects only when there was no HTTP exchange at all: with a\n * CaddyUnreachableError when nothing accepted the connection, any other Error otherwise.\n */\n request(request: CaddyAdminRequest): Promise<CaddyAdminResponse>;\n}\n\n/**\n * Nothing accepted the connection — Caddy is not running, or not listening yet. A transport rejects\n * with THIS only when the request provably never reached Caddy (refused, no socket file), because\n * the provider treats it differently from every other failure: a stopped Caddy must not fail the\n * PLAN that would bring it back (its launchd job in the same stack) — see config.ts.\n */\nexport class CaddyUnreachableError extends Error {\n override readonly name = 'CaddyUnreachableError';\n}\n\n/** The Effect service the Caddy provider reads its admin transport from. */\nexport class CaddyAdminService extends Context.Service<CaddyAdminService, CaddyAdmin>()(\n 'homeflare/caddy/CaddyAdmin',\n) {}\n\n/** Provide a transport to the provider: `Layer.provide(caddyAdminLayer(localCaddyAdmin()))`. */\nexport const caddyAdminLayer = (admin: CaddyAdmin): Layer.Layer<CaddyAdminService> =>\n Layer.succeed(CaddyAdminService, admin);\n",
6
+ "/**\n * LaunchdJob's props, attributes and the pure half of the provider: domain parsing, the plist path,\n * and the props → plist mapping whose SHA-256 is the whole diff.\n *\n * ★ KEY NAMES AND MEANINGS FROM launchd.plist(5), checked against the 148 nix-darwin daemons on a\n * macOS 27.2 host on 2026-09-21 (read-only, from /nix/store): Label, ProgramArguments, RunAtLoad,\n * KeepAlive (boolean or {SuccessfulExit}), ThrottleInterval, StandardOutPath/StandardErrorPath,\n * EnvironmentVariables, UserName, StartInterval and StartCalendarInterval are the keys in real\n * use. Everything rarer goes through `extraKeys`.\n */\nimport { createHash } from 'node:crypto';\nimport { type PlistDict, type PlistValue, renderPlist } from './plist.ts';\n\n/** `system` (LaunchDaemons, root) or one user's login session, `gui/<uid>` (LaunchAgents). */\nexport type LaunchdDomain = 'system' | `gui/${number}`;\n\n/** One StartCalendarInterval entry. An omitted field is a wildcard, as in cron. */\nexport type CalendarInterval = {\n readonly minute?: number;\n readonly hour?: number;\n readonly day?: number;\n /** 0 and 7 are both Sunday. */\n readonly weekday?: number;\n readonly month?: number;\n};\n\n/** `true` = always restart; the object form restarts only on the named conditions. */\nexport type KeepAlive = boolean | { readonly successfulExit?: boolean; readonly crashed?: boolean };\n\nexport interface LaunchdJobProps {\n /** Reverse-DNS label. Unique per domain; also the plist's file name. */\n label: string;\n domain: LaunchdDomain;\n /** argv; the first element must be an absolute path. */\n programArguments: readonly string[];\n /**\n * ⛔ NON-SECRET VALUES ONLY. Props are stored unencrypted in Alchemy state, and these also land in\n * the plist on disk and in `launchctl print`. Pass a secret as a FILE PATH that a secret renderer\n * (openbao-agent) maintains — secret-tripwire.ts refuses the obvious mistakes.\n */\n environment?: Readonly<Record<string, string>>;\n runAtLoad?: boolean;\n keepAlive?: KeepAlive;\n /** Seconds between starts. */\n startInterval?: number;\n startCalendarInterval?: CalendarInterval | readonly CalendarInterval[];\n /** Minimum seconds between (re)starts; launchd's default is 10. */\n throttleInterval?: number;\n standardOutPath?: string;\n standardErrorPath?: string;\n workingDirectory?: string;\n /** Run as this user. ⚠️ System domain only — launchd ignores it for agents, so it is refused. */\n userName?: string;\n /** Run as this group. ⚠️ System domain only, like `userName`. */\n groupName?: string;\n /**\n * Any other launchd.plist(5) key, verbatim (`ProcessType`, `SoftResourceLimits`, …).\n * ⛔ A key the typed props own is refused, so one job can never say two things.\n */\n extraKeys?: PlistDict;\n}\n\nexport interface LaunchdJobAttributes {\n label: string;\n domain: LaunchdDomain;\n /** `<domain>/<label>` — what `launchctl print` / `bootout` take. */\n serviceTarget: string;\n plistPath: string;\n /** SHA-256 of the plist bytes last bootstrapped (reconcile) or found on disk (read). */\n plistSha256: string;\n /** Bootstrapped into the domain — not necessarily running. */\n loaded: boolean;\n /** launchd's own word: `running`, `not running`, … */\n state?: string;\n pid?: number;\n lastExitCode?: number;\n}\n\nexport type ParsedDomain =\n | { readonly kind: 'system' }\n | { readonly kind: 'gui'; readonly uid: number };\n\nexport const parseDomain = (domain: string): ParsedDomain | undefined => {\n if (domain === 'system') return { kind: 'system' };\n const match = /^gui\\/(\\d+)$/.exec(domain);\n return match?.[1] === undefined ? undefined : { kind: 'gui', uid: Number(match[1]) };\n};\n\nexport const serviceTarget = (label: string, domain: LaunchdDomain): string => `${domain}/${label}`;\n\n/**\n * Where launchd expects the job's plist. ★ Derived, never declared: a daemon's plist outside\n * /Library/LaunchDaemons is not bootstrapped at boot, so a free-form path would be a job that\n * silently stops existing after the next restart.\n */\nexport const plistPathFor = (\n label: string,\n domain: ParsedDomain,\n home: string | undefined,\n): string => {\n if (domain.kind === 'system') return `/Library/LaunchDaemons/${label}.plist`;\n // ⛔ No `~` fallback: the provider may run as root, whose `~` is not the agent owner's home.\n if (home === undefined || !home.startsWith('/')) {\n throw new Error(`gui/${String(domain.uid)}: no home directory for that uid on this host`);\n }\n return `${home}/Library/LaunchAgents/${label}.plist`;\n};\n\n/** Plist keys the typed props own — `extraKeys` may not name them. `Program` is refused too. */\nexport const OWNED_KEYS: readonly string[] = [\n 'EnvironmentVariables',\n 'GroupName',\n 'KeepAlive',\n 'Label',\n 'Program',\n 'ProgramArguments',\n 'RunAtLoad',\n 'StandardErrorPath',\n 'StandardOutPath',\n 'StartCalendarInterval',\n 'StartInterval',\n 'ThrottleInterval',\n 'UserName',\n 'WorkingDirectory',\n];\n\nconst calendarDict = (entry: CalendarInterval): PlistDict => {\n const dict: Record<string, PlistValue> = {};\n if (entry.minute !== undefined) dict['Minute'] = entry.minute;\n if (entry.hour !== undefined) dict['Hour'] = entry.hour;\n if (entry.day !== undefined) dict['Day'] = entry.day;\n if (entry.weekday !== undefined) dict['Weekday'] = entry.weekday;\n if (entry.month !== undefined) dict['Month'] = entry.month;\n return dict;\n};\n\nconst keepAliveValue = (keepAlive: KeepAlive): PlistValue => {\n if (typeof keepAlive === 'boolean') return keepAlive;\n const dict: Record<string, PlistValue> = {};\n if (keepAlive.successfulExit !== undefined) dict['SuccessfulExit'] = keepAlive.successfulExit;\n if (keepAlive.crashed !== undefined) dict['Crashed'] = keepAlive.crashed;\n return dict;\n};\n\n/** The plist dict for a job. ⚠️ Assumes jobProblems() came back empty. */\nexport const jobPlistDict = (props: LaunchdJobProps): PlistDict => {\n const dict: Record<string, PlistValue> = { ...props.extraKeys };\n dict['Label'] = props.label;\n dict['ProgramArguments'] = [...props.programArguments];\n const env = props.environment ?? {};\n if (Object.keys(env).length > 0) dict['EnvironmentVariables'] = { ...env };\n if (props.runAtLoad !== undefined) dict['RunAtLoad'] = props.runAtLoad;\n if (props.keepAlive !== undefined) dict['KeepAlive'] = keepAliveValue(props.keepAlive);\n if (props.startInterval !== undefined) dict['StartInterval'] = props.startInterval;\n const calendar = props.startCalendarInterval;\n if (calendar !== undefined) {\n dict['StartCalendarInterval'] = Array.isArray(calendar)\n ? (calendar as readonly CalendarInterval[]).map(calendarDict)\n : calendarDict(calendar as CalendarInterval);\n }\n if (props.throttleInterval !== undefined) dict['ThrottleInterval'] = props.throttleInterval;\n if (props.standardOutPath !== undefined) dict['StandardOutPath'] = props.standardOutPath;\n if (props.standardErrorPath !== undefined) dict['StandardErrorPath'] = props.standardErrorPath;\n if (props.workingDirectory !== undefined) dict['WorkingDirectory'] = props.workingDirectory;\n if (props.userName !== undefined) dict['UserName'] = props.userName;\n if (props.groupName !== undefined) dict['GroupName'] = props.groupName;\n return dict;\n};\n\nexport const sha256Hex = (bytes: Uint8Array | string): string =>\n createHash('sha256').update(bytes).digest('hex');\n\n/** The rendered plist and its digest — the only thing LaunchdJob compares. */\nexport const renderJob = (\n props: LaunchdJobProps,\n): { text: string; bytes: Uint8Array; sha256: string } => {\n const text = renderPlist(jobPlistDict(props));\n const bytes = new TextEncoder().encode(text);\n return { bytes, sha256: sha256Hex(bytes), text };\n};\n",
7
+ "/**\n * An XML property list serializer — the subset launchd.plist(5) reads, and nothing else.\n *\n * ★ WHY NOT AN npm LIBRARY. Nothing in this workspace depends on one (checked 2026-09-21: no\n * `plist`, `xmlbuilder` or `@xmldom/xmldom` anywhere under node_modules), and the common one pulls\n * an XML DOM in for PARSING, which a provider that only RENDERS never does. The subset a launchd\n * job needs is five node types, so this is ~100 lines plus exhaustive tests (plist.test.ts), which\n * also round-trip every case through Apple's own `plutil` when the tests run on macOS.\n *\n * ⛔ THE OUTPUT MUST BE DETERMINISTIC. LaunchdJob diffs by the SHA-256 of these bytes, so two\n * renders of one declaration must be byte-identical: dict keys are sorted, indentation is fixed,\n * and nothing depends on insertion order. A non-deterministic render is a forever-`update`.\n * ⚠️ AND A CHANGE TO THIS FILE'S OUTPUT RESTARTS EVERY JOB. A new header, indent or escape changes\n * every digest, so the next deploy after the kit upgrade updates — restarts — every declared\n * job at once. Treat any byte change here as a breaking change and say so in its changeset.\n *\n * ⛔ REFUSE, NEVER COERCE. `undefined`, `null`, a fraction, NaN, a class instance or a character XML\n * 1.0 cannot carry is a thrown PlistError naming the path, not a silently dropped key. A dropped\n * `KeepAlive` is a daemon that never restarts, and nothing downstream would say why.\n */\n\n/** Every value launchd reads. ⚠️ No `<real>`, `<date>` or `<data>`: no launchd key needs one. */\nexport type PlistValue =\n | string\n | number\n | boolean\n | readonly PlistValue[]\n | { readonly [key: string]: PlistValue };\n\nexport type PlistDict = { readonly [key: string]: PlistValue };\n\nexport class PlistError extends Error {\n constructor(\n readonly path: string,\n detail: string,\n ) {\n super(`plist ${path === '' ? '(root)' : path}: ${detail}`);\n this.name = 'PlistError';\n }\n}\n\nconst HEADER =\n '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n' +\n '<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" ' +\n '\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\\n' +\n '<plist version=\"1.0\">\\n';\n\n/** ⚠️ A cycle, or a runaway generator, would otherwise recurse until the stack dies. */\nconst MAX_DEPTH = 32;\n\n/**\n * ⛔ CHARACTERS XML 1.0 CANNOT CARRY AT ALL — not even escaped (XML 1.0 §2.2 `Char`). C0 controls\n * other than tab, LF and CR; U+FFFE / U+FFFF; and an unpaired surrogate, which has no UTF-8 form.\n */\n// ★ The `u` flag makes a VALID surrogate pair one code point above U+FFFF, outside this class, so\n// only an unpaired half matches the \\uD800-\\uDFFF range.\n// oxlint-disable-next-line no-control-regex -- matching control characters is the point\nconst FORBIDDEN = /[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\uD800-\\uDFFF\\uFFFE\\uFFFF]/u;\n\n/**\n * Escape text content.\n * ⚠️ CR IS A CHARACTER REFERENCE, NOT A LITERAL. An XML parser normalises a literal CR (and CRLF)\n * to LF before the application sees it (XML 1.0 §2.11), so `a\\r\\nb` would come back as `a\\nb` and\n * the argument launchd passes would differ from the one declared. `&#13;` survives normalisation.\n */\nexport const escapeText = (text: string, path: string): string => {\n const bad = FORBIDDEN.exec(text);\n if (bad !== null) {\n const code = bad[0].codePointAt(0) ?? 0;\n throw new PlistError(\n path,\n `U+${code.toString(16).toUpperCase().padStart(4, '0')} cannot appear in XML 1.0`,\n );\n }\n return text\n .replaceAll('&', '&amp;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;')\n .replaceAll('\\r', '&#13;');\n};\n\nconst isPlainObject = (value: object): boolean => {\n const proto = Object.getPrototypeOf(value) as unknown;\n return proto === Object.prototype || proto === null;\n};\n\nconst renderValue = (value: unknown, path: string, depth: number, out: string[]): void => {\n const pad = '\\t'.repeat(depth);\n if (depth > MAX_DEPTH) throw new PlistError(path, `nested deeper than ${String(MAX_DEPTH)}`);\n if (typeof value === 'string') {\n out.push(`${pad}<string>${escapeText(value, path)}</string>`);\n return;\n }\n if (typeof value === 'boolean') {\n out.push(`${pad}<${value ? 'true' : 'false'}/>`);\n return;\n }\n if (typeof value === 'number') {\n // ⛔ launchd reads every numeric key as an integer; 1.5 would be a silently different job.\n if (!Number.isSafeInteger(value)) {\n throw new PlistError(path, `${String(value)} is not a safe integer (no <real> support)`);\n }\n out.push(`${pad}<integer>${String(value === 0 ? 0 : value)}</integer>`);\n return;\n }\n if (Array.isArray(value)) {\n if (value.length === 0) {\n out.push(`${pad}<array/>`);\n return;\n }\n out.push(`${pad}<array>`);\n for (const [index, item] of (value as readonly unknown[]).entries()) {\n renderValue(item, `${path}[${String(index)}]`, depth + 1, out);\n }\n out.push(`${pad}</array>`);\n return;\n }\n if (typeof value === 'object' && value !== null && isPlainObject(value)) {\n renderDict(value as Record<string, unknown>, path, depth, out);\n return;\n }\n const kind = value === null ? 'null' : typeof value;\n throw new PlistError(path, `${kind} has no plist form — omit the key instead`);\n};\n\nconst renderDict = (\n dict: Record<string, unknown>,\n path: string,\n depth: number,\n out: string[],\n): void => {\n const pad = '\\t'.repeat(depth);\n // ★ Code-unit order, not localeCompare: the same bytes on every machine and every locale.\n const keys = Object.keys(dict).sort();\n if (keys.length === 0) {\n out.push(`${pad}<dict/>`);\n return;\n }\n out.push(`${pad}<dict>`);\n for (const key of keys) {\n const child = path === '' ? key : `${path}.${key}`;\n out.push(`${pad}\\t<key>${escapeText(key, child)}</key>`);\n renderValue(dict[key], child, depth + 1, out);\n }\n out.push(`${pad}</dict>`);\n};\n\n/** Render a top-level dict as a complete XML plist document, ending in a newline. */\nexport const renderPlist = (dict: PlistDict): string => {\n if (typeof dict !== 'object' || dict === null || Array.isArray(dict) || !isPlainObject(dict)) {\n throw new PlistError('', 'the top level of a launchd plist must be a dict');\n }\n const out: string[] = [];\n renderDict(dict as Record<string, unknown>, '', 0, out);\n return `${HEADER}${out.join('\\n')}\\n</plist>\\n`;\n};\n",
8
+ "/**\n * The one form an adapted Caddy config is hashed in — so what `POST /adapt` returns for the\n * declared Caddyfile and what `GET /config/` reports after the load hash the same.\n *\n * ⛔ THE TWO ARE NOT THE SAME BYTES, AND COMPARING BYTES WOULD BE A FOREVER-`update`. Read in\n * caddyserver/caddy v2.11.4:\n * · `/adapt` returns the adapter's `json.Marshal(cfg)` of Go STRUCTS — keys in field order\n * (caddyconfig/caddyfile/adapter.go Adapt; load.go handleAdapt).\n * · `/load` decodes that JSON into a generic `any` and re-marshals it (caddy.go changeConfig):\n * Go sorts MAP keys, so the stored config has every object's keys sorted.\n * · `GET /config/` streams that stored value through `json.Encoder`, which appends a newline\n * (admin.go unsyncedConfigAccess), and escapes `<`, `>` and `&` as `\\u003c`, `\\u003e`, `\\u0026`.\n * Parsing both and re-serialising with sorted keys erases all three differences. MEASURED\n * 2026-09-21 on a throwaway Caddy 2.11.4: the digest of `GET /config/` after `POST /load` equals\n * the digest of `/adapt` for the same Caddyfile — and a Caddy started with `--config <file>`\n * hashes the same as `/adapt` of that file's text, so adopting it is a noop.\n * ★ NUMBERS AGREE BY CONSTRUCTION. Go decodes every JSON number in that generic `any` as float64\n * (caddy.go indexConfigObjects says so), and JSON.parse does too — the same double on both sides\n * serialises the same way here.\n */\nimport { sha256Hex } from '../launchd/job-form.ts';\n\ntype Json = null | boolean | number | string | readonly Json[] | { readonly [key: string]: Json };\n\nconst sorted = (value: Json): Json => {\n if (Array.isArray(value)) return (value as readonly Json[]).map(sorted);\n if (typeof value === 'object' && value !== null) {\n const object = value as { readonly [key: string]: Json };\n const out: Record<string, Json> = {};\n for (const key of Object.keys(object).sort()) out[key] = sorted(object[key] ?? null);\n return out;\n }\n return value;\n};\n\n/** Parse a config body Caddy returned. ⚠️ An empty config is the JSON `null`, not an error. */\nexport const parseConfig = (text: string): unknown => JSON.parse(text) as unknown;\n\n/** The canonical text of a parsed config: sorted keys, no whitespace. */\nexport const canonicalConfig = (config: unknown): string =>\n JSON.stringify(sorted((config ?? null) as Json));\n\n/** SHA-256 of the canonical form — what the resource stores and compares, never the config. */\nexport const configDigest = (config: unknown): string => sha256Hex(canonicalConfig(config));\n",
9
+ "/**\n * The three admin API calls the provider makes, each classified into a value or a readable Error\n * that carries Caddy's own message.\n *\n * Read in caddyserver/caddy v2.11.4 (and the API docs, caddyserver.com/docs/api):\n * · `POST /adapt` — adapts without running (load.go handleAdapt): 200 `{warnings?, result}`,\n * or 400 `{\"error\": …}`. Side-effect free, so it is what plan-time validation uses.\n * · `POST /load` — Content-Type `text/caddyfile` picks the adapter (load.go adaptByContentType);\n * \"if the new config fails for any reason, the old config is rolled back into place without\n * downtime\" (docs; caddy.go changeConfig restores the previous raw config). An identical\n * config is a no-op without `Cache-Control: must-revalidate`.\n * · `GET /config/` — the running config as JSON, `null` when empty (admin.go handleConfig).\n * ⛔ A FAILED LOAD CAN ANSWER 200. load.go writes the adapter's WARNINGS to the body before it\n * runs the config; if the run then fails, the error JSON is appended to a response whose status\n * is already 200 (Go's first Write sends 200; the later WriteHeader(400) is ignored). The\n * Caddyfile adapter warns on every unformatted input (adapter.go FormattingDifference), so this\n * is the COMMON failure shape, not an edge. Hence: look for the error in the body whatever the\n * status — and the lifecycle reads the config back after every load anyway.\n * MEASURED 2026-09-21 on a throwaway Caddy 2.11.4 (loopback ports, isolated XDG dirs): an\n * unformatted Caddyfile whose port was taken answered `200` with body\n * `[{\"file\":\"Caddyfile\",\"line\":8,\"message\":\"Caddyfile input is not formatted; …\"}]{\"error\":\"loading\n * config: … bind: address already in use\"}`, and Caddy kept serving the previous config.\n */\nimport type { CaddyAdmin, CaddyAdminResponse } from './admin.ts';\nimport { parseConfig } from './digest.ts';\n\nexport class CaddyAdminError extends Error {\n constructor(\n readonly status: number,\n readonly method: string,\n readonly path: string,\n reason: string,\n ) {\n super(`Caddy ${method} ${path} → ${String(status)}: ${reason}`);\n this.name = 'CaddyAdminError';\n }\n}\n\nconst CADDYFILE = 'text/caddyfile';\n/** APIError marshals as exactly this key (admin.go APIError, `json:\"error\"`). */\nconst ERROR_OPEN = '{\"error\":';\n\ntype Warning = { file?: string; line?: number; message?: string };\n\nconst describe = (warning: Warning): string =>\n `${warning.file ?? 'Caddyfile'}:${String(warning.line ?? 0)}: ${warning.message ?? '(no message)'}`;\n\n/** Caddy's `error` string from a body that holds one, or `undefined`. */\nconst errorIn = (body: string): string | undefined => {\n const at = body.lastIndexOf(ERROR_OPEN);\n if (at === -1) return undefined;\n try {\n const parsed = JSON.parse(body.slice(at)) as { error?: unknown };\n return typeof parsed.error === 'string' ? parsed.error : undefined;\n } catch {\n return undefined;\n }\n};\n\nconst warningsIn = (text: string): string[] => {\n if (text.trim() === '') return [];\n try {\n const parsed = JSON.parse(text) as unknown;\n return Array.isArray(parsed) ? (parsed as Warning[]).map(describe) : [];\n } catch {\n return [];\n }\n};\n\nconst fail = (response: CaddyAdminResponse, method: string, path: string): never => {\n const reason = errorIn(response.body) ?? (response.body.trim().slice(0, 500) || '(empty body)');\n // ⚠️ Say so when the status lied (the ⛔ above), or \"→ 200\" reads like success.\n const shown = response.status === 200 ? `${reason} (error in a 200 body)` : reason;\n throw new CaddyAdminError(response.status, method, path, shown);\n};\n\nexport type Adapted = { readonly config: unknown; readonly warnings: readonly string[] };\n\n/** Adapt a Caddyfile to JSON on the running Caddy, without loading it. */\nexport const adaptCaddyfile = async (admin: CaddyAdmin, caddyfile: string): Promise<Adapted> => {\n const response = await admin.request({\n body: caddyfile,\n headers: { 'Content-Type': CADDYFILE },\n method: 'POST',\n path: '/adapt',\n });\n // ★ Status alone here: /adapt writes its body once, and a successful result is config JSON in\n // which an `error` handler's key could look like an error object to a substring search.\n if (response.status !== 200) fail(response, 'POST', '/adapt');\n const parsed = JSON.parse(response.body) as { result?: unknown; warnings?: Warning[] };\n return { config: parsed.result ?? null, warnings: (parsed.warnings ?? []).map(describe) };\n};\n\n/** The running config, parsed; `null` when Caddy runs with none. */\nexport const readRunningConfig = async (admin: CaddyAdmin): Promise<unknown> => {\n const response = await admin.request({ method: 'GET', path: '/config/' });\n if (response.status !== 200) fail(response, 'GET', '/config/');\n return parseConfig(response.body);\n};\n\n/**\n * Apply a Caddyfile with `POST /load`; resolves with the adapter's warnings.\n *\n * ★ `sourceFile` RIDES AS `Caddy-Config-Source-File` (+ `-Adapter: caddyfile`), the headers\n * `caddy reload` sends (cmd/commandfuncs.go). A load WITHOUT them makes Caddy forget the file it\n * was started with (caddy.go ClearLastConfigIfDifferent), and SIGUSR1 then no longer reloads\n * from that file. With them, and the same path, it keeps it.\n */\nexport const loadCaddyfile = async (\n admin: CaddyAdmin,\n caddyfile: string,\n sourceFile?: string,\n): Promise<readonly string[]> => {\n const response = await admin.request({\n body: caddyfile,\n headers: {\n 'Content-Type': CADDYFILE,\n ...(sourceFile === undefined\n ? {}\n : { 'Caddy-Config-Source-Adapter': 'caddyfile', 'Caddy-Config-Source-File': sourceFile }),\n },\n method: 'POST',\n path: '/load',\n });\n const refused = errorIn(response.body);\n if (response.status !== 200 || refused !== undefined) fail(response, 'POST', '/load');\n return warningsIn(response.body);\n};\n",
10
+ "/**\n * `Caddy.Config` — a running Caddy's whole config, declared as Caddyfile text and applied through\n * Caddy's own admin API (decision 23).\n *\n * - create / update — `POST /adapt` (validate), `POST /load` with `text/caddyfile` (a graceful\n * reload; Caddy keeps the old config if it refuses the new one, and the error names why), then\n * `GET /config/` and insist it matches. Skipped when Caddy already runs this config.\n * - read — the digest of `GET /config/`. ★ WITH NO STATE, A RUNNING CADDY IS ADOPTED: its live\n * config becomes the starting point, and the deploy's forced update loads the declared one.\n * - diff — declared, live and stored digests (config-lifecycle.ts). Never `replace`.\n * - delete — ⛔ NOTHING. See below.\n *\n * ⛔ DELETE NEVER TOUCHES CADDY, UNDER EITHER REMOVAL POLICY. Removing this declaration must not take\n * every site down: there is no \"less config\" to fall back to, and an empty config stops all\n * servers. `retain` is the default (the engine never calls delete); with `destroy` the handler\n * still only forgets. It never calls `/stop` (which exits the process) or `DELETE /config/`.\n * To empty a Caddy, do it by hand at its admin API.\n * ⛔ `caddyfile` IS NEVER A SECRET — see config-form.ts; refused before anything is sent.\n * ⚠️ WHICH CADDY is the transport's (providers.ts), not a prop: one CaddyAdmin per stack.\n */\nimport { Resource } from 'alchemy';\nimport { isResolved } from 'alchemy/Diff';\nimport * as Provider from 'alchemy/Provider';\nimport * as Effect from 'effect/Effect';\nimport { lift, resolvedString } from '../launchd/host-effect.ts';\nimport { CaddyAdminService, CaddyUnreachableError } from './admin.ts';\nimport type { CaddyConfigAttributes, CaddyConfigProps } from './config-form.ts';\nimport { diffConfig, readLive, reconcileConfig } from './config-lifecycle.ts';\n\nexport type { CaddyConfigAttributes, CaddyConfigProps } from './config-form.ts';\n\nexport interface CaddyConfig extends Resource<\n 'Caddy.Config',\n CaddyConfigProps,\n CaddyConfigAttributes\n> {}\n\nexport const CaddyConfig = Resource<CaddyConfig>('Caddy.Config', {\n defaultRemovalPolicy: 'retain',\n});\n\nconst unreachable = (error: Error): error is CaddyUnreachableError =>\n error instanceof CaddyUnreachableError;\n\n/**\n * ⚠️ A STOPPED CADDY MUST NOT FAIL THE PLAN THAT BRINGS IT BACK. Its launchd job usually sits in the\n * same stack; if every plan died on `ECONNREFUSED`, the fix to that job could never be deployed.\n * So at PLAN time only (read, diff) an unreachable Caddy plans an update — with a warning, because\n * the plan-time `/adapt` check did not run — and reconcile, which needs Caddy, still fails loudly.\n */\nconst planWithoutCaddy =\n <A>(admin: { endpoint: string }, fallback: A) =>\n (error: Error) =>\n Effect.as(\n Effect.logWarning(\n `Caddy.Config: no Caddy at ${admin.endpoint} (${error.message}); planning without it — ` +\n 'the Caddyfile is validated when the deploy reaches Caddy',\n ),\n fallback,\n );\n\nexport const CaddyConfigProvider = () =>\n Provider.effect(\n CaddyConfig,\n Effect.gen(function* () {\n const admin = yield* CaddyAdminService;\n return CaddyConfig.Provider.of({\n /** ⛔ A Caddy has one config; there is nothing to enumerate, and nothing for nuke to delete. */\n list: () => Effect.succeed([]),\n\n /**\n * ★ Plain attributes, never `Unowned`: a Caddy on this host's loopback admin API is the one\n * the stack means (the transport refuses anything else), and adopting reads — it changes\n * nothing until reconcile loads the declared Caddyfile.\n */\n read: ({ olds }) =>\n lift(() => readLive(admin, resolvedString(olds, 'sourceFile'))).pipe(\n // ★ Nothing to adopt from a Caddy that is down: plan a create, which is the same load.\n Effect.catchIf(unreachable, planWithoutCaddy(admin, undefined)),\n ),\n\n diff: ({ news, output }) => {\n if (output === undefined) return Effect.succeed(undefined);\n const update = planWithoutCaddy(admin, { action: 'update' as const });\n if (isResolved(news)) {\n return lift(() => diffConfig(admin, news, output)).pipe(\n Effect.catchIf(unreachable, update),\n );\n }\n /**\n * ⚠️ `sourceFile` is an Output while its HostFile changes in the same deploy\n * (caddyWithFile). The Caddyfile itself is usually plain text, so validate and compare\n * it now — a bad Caddyfile must fail the PLAN, before the HostFile writes it to disk —\n * and plan an update, which reloads only if the config really differs.\n */\n const caddyfile = resolvedString(news, 'caddyfile');\n if (caddyfile === undefined) return Effect.succeed(undefined);\n return lift(async () => {\n await diffConfig(admin, { caddyfile }, output);\n return { action: 'update' as const };\n }).pipe(Effect.catchIf(unreachable, update));\n },\n\n reconcile: ({ news }) =>\n Effect.gen(function* () {\n const applied = yield* lift(() => reconcileConfig(admin, news));\n for (const warning of applied.warnings) {\n yield* Effect.logWarning(`Caddy.Config at ${admin.endpoint}: ${warning}`);\n }\n return applied.attributes;\n }),\n\n delete: () => Effect.void,\n });\n }),\n );\n",
11
+ "/**\n * The one place a HostRunner's promises become Effects — plus the one probe of an unresolved\n * `news` both providers' diffs share.\n *\n * ★ The lifecycle files are plain async functions over a HostRunner (see runner.ts for why the\n * runner is promise-based), so each provider handler is a single `lift(() => step(runner, …))`.\n * ⚠️ A thrown Error stays that Error — its message is the refusal a deploy prints. Anything else\n * thrown is wrapped, so the failure channel is always an Error with a readable message.\n */\nimport * as Effect from 'effect/Effect';\n\nexport const lift = <A>(step: () => Promise<A>): Effect.Effect<A, Error> =>\n Effect.tryPromise({\n catch: (cause) => (cause instanceof Error ? cause : new Error(String(cause))),\n try: step,\n });\n\n/**\n * A string prop of a diff's `news`, when that one prop is already resolved; `undefined` while it\n * is still an Output (a function-typed proxy), an Effect or a Config.\n * ★ For the identity props a diff must see even when the rest of `news` is unresolved — a plain\n * string is resolved by definition, so `typeof` is the whole test.\n */\nexport const resolvedString = (news: unknown, key: string): string | undefined => {\n if (typeof news !== 'object' || news === null) return undefined;\n const value = (news as Record<string, unknown>)[key];\n return typeof value === 'string' ? value : undefined;\n};\n",
12
+ "/**\n * Refuse a config whose `admin` block would cut the provider off from Caddy, or expose the admin\n * API — checked on the ADAPTED JSON (`POST /adapt`), before anything is loaded.\n *\n * ⛔ A Caddyfile can move its own admin endpoint. After `POST /load`, Caddy swaps the admin server\n * to the new config's (admin.go replaceLocalAdminServer), so each of these would succeed ONCE and\n * then strand the resource — no read-back, no drift check, no next deploy — or worse:\n * · `admin off` (`disabled`): nothing can manage this Caddy through its API again.\n * · a `listen` off loopback (`:2019`, `0.0.0.0:2019`, a LAN address): the unauthenticated API is\n * on the network. Decision 23: never expose :2019.\n * · a `listen` on another port, socket or loopback ADDRESS than the transport's: the provider\n * loses Caddy. Go binds exactly the literal address given (`[::1]:2019` is not reachable at\n * `127.0.0.1:2019`), and a hostname binds its first IPv4 address (net ListenConfig.Listen,\n * `addrs.first(isIPv4)`), so `localhost:2019` is `127.0.0.1:2019`. MEASURED 2026-09-21 on a\n * throwaway Caddy 2.11.4: after loading `admin [::1]:<p>`, `127.0.0.1:<p>` refused the\n * connection; after `admin localhost:<p>`, `[::1]:<p>` did.\n * · NO `admin` address at all: Caddy falls back to DefaultAdminListen — `localhost:2019`, or\n * `$CADDY_ADMIN` in ITS environment (admin.go replaceLocalAdminServer), which this side cannot\n * see. A Caddy reached any other way (a socket, another port) moves there on the first load.\n * Refused unless the transport is at that default; declaring `admin <address>` is the fix.\n * · a Host the new config does not allow: `origins` without it, or — with no `origins` — a Host\n * outside Caddy's loopback defaults (`localhost`, `[::1]`, `127.0.0.1` at the listen port).\n * Every later call answers 403 (admin.go allowedOrigins / checkHost; MEASURED on the mini's\n * Caddy 2.11.4 — `host not allowed`). The transport also sends `Origin: http://<Host>`, which\n * Caddy checks against the same list (originAllowed), so one check covers both.\n * · `enforce_origin` over a unix socket: this transport, like Caddy's CLI (cmd/commandfuncs.go\n * AdminAPIRequest), sends no Origin there, and a unix listener has no default origins — so\n * checkOrigin answers 403 to every call. MEASURED 2026-09-21 on a throwaway Caddy 2.11.4:\n * `client is not allowed to access from origin ''`, and that Caddy could not be managed again.\n * · `remote`: a second, network-facing admin listener (mTLS on :2021) — declare that deliberately,\n * not through this resource.\n * · `config.load`: Caddy pulls its config from elsewhere, replacing this one on a timer.\n * ★ Read in caddyserver/caddy v2.11.4: admin.go AdminConfig / allowedOrigins / originAllowed, and\n * httpcaddyfile/options.go parseOptAdmin (an `admin { … }` block with no address still emits\n * `listen` as the default, so a present `listen` is the norm, not a change).\n */\nimport type { CaddyAdminListener } from './admin.ts';\n\ntype AdminBlock = {\n disabled?: boolean;\n listen?: string;\n origins?: string[];\n enforce_origin?: boolean;\n remote?: unknown;\n config?: { load?: unknown };\n};\n\n/** Caddy's compiled-in admin port (admin.go DefaultAdminListen `localhost:2019`). */\nconst DEFAULT_ADMIN_PORT = 2019;\n\nconst LOOPBACK_HOST = /^(?:localhost|127(?:\\.\\d{1,3}){3}|\\[?::1\\]?)$/;\n\ntype Listen = { kind: 'tcp'; host: string; port: number } | { kind: 'unix'; path: string };\n\n/** Caddy network address → a listener, or a description of why it is not one we can check. */\nconst parseListen = (listen: string): Listen | string => {\n if (listen.includes('{')) return 'a placeholder, which cannot be checked before it runs';\n const unix = /^unix(?:gram|packet)?\\/(.+?)(?:\\|[0-7]{3,4})?$/.exec(listen);\n if (unix !== null) return { kind: 'unix', path: unix[1] ?? '' };\n if (/^[a-z0-9]+\\//.test(listen) && !/^tcp[46]?\\//.test(listen)) {\n return `network ${JSON.stringify(listen.split('/')[0])}, not tcp or unix`;\n }\n const address = listen.replace(/^tcp[46]?\\//, '');\n const colon = address.lastIndexOf(':');\n const port = Number(address.slice(colon + 1));\n if (colon === -1 || !Number.isInteger(port) || port <= 0) return 'no single port';\n return { host: address.slice(0, colon), kind: 'tcp', port };\n};\n\nconst unbracket = (host: string): string => host.replace(/^\\[(.*)\\]$/, '$1');\n\n/**\n * Whether a transport sending `hostHeader` reaches a listener bound to `listenHost`.\n * ★ The Host stands in for the dial address: they are the same unless `hostHeader` was set for a\n * forward, where it should name the far side's address anyway. `localhost` on the transport's\n * side may resolve to either family (node tries both), so it reaches any loopback listener; a\n * literal address reaches only itself.\n */\nconst reaches = (hostHeader: string, listenHost: string): boolean => {\n const dialled = unbracket(hostHeader.slice(0, hostHeader.lastIndexOf(':')));\n const listening = unbracket(listenHost);\n return (\n dialled === 'localhost' || dialled === (listening === 'localhost' ? '127.0.0.1' : listening)\n );\n};\n\nconst sameListener = (listen: Listen, transport: CaddyAdminListener): boolean =>\n listen.kind === 'tcp'\n ? transport.kind === 'tcp' &&\n listen.port === transport.port &&\n reaches(transport.hostHeader, listen.host)\n : transport.kind === 'unix' && listen.path === transport.path;\n\n/** Caddy's allowed Hosts for a loopback listener with no `origins` (admin.go allowedOrigins). */\nconst defaultOrigins = (port: number): string[] =>\n ['localhost', '[::1]', '127.0.0.1'].map((host) => `${host}:${String(port)}`);\n\nconst originHost = (origin: string): string | undefined => {\n if (!origin.includes('://')) return origin;\n try {\n const url = new URL(origin);\n // ⚠️ originAllowed compares schemes when an entry has one; the transport sends `http://`.\n return url.protocol === 'http:' ? url.host : undefined;\n } catch {\n return undefined;\n }\n};\n\nconst listenProblem = (admin: AdminBlock, transport: CaddyAdminListener): string | undefined => {\n if (admin.listen === undefined) {\n const atDefault =\n transport.kind === 'tcp' &&\n transport.port === DEFAULT_ADMIN_PORT &&\n reaches(transport.hostHeader, 'localhost');\n return atDefault\n ? undefined\n : 'no `admin` address: Caddy would fall back to its default listener (localhost:2019, or ' +\n '$CADDY_ADMIN), away from where this provider reaches it — declare `admin <address>`';\n }\n const listen = parseListen(admin.listen);\n const shown = JSON.stringify(admin.listen);\n if (typeof listen === 'string') {\n return `admin listen ${shown} is ${listen}; declare a literal loopback address`;\n }\n if (listen.kind === 'tcp' && !LOOPBACK_HOST.test(listen.host)) {\n return `admin listen ${shown} is not loopback — it would put the admin API on the network`;\n }\n return sameListener(listen, transport)\n ? undefined\n : `admin listen ${shown} moves the admin API away from where this provider reaches it`;\n};\n\n/** Refusals for the adapted config's `admin` block, given where the transport reaches Caddy. */\nexport const adminProblems = (adapted: unknown, transport: CaddyAdminListener): string[] => {\n const admin =\n typeof adapted === 'object' && adapted !== null\n ? ((adapted as { admin?: AdminBlock }).admin ?? {})\n : {};\n const found: string[] = [];\n if (admin.disabled === true) {\n return ['`admin off` would disable the admin API this resource manages Caddy through'];\n }\n if (admin.remote !== undefined) found.push('`admin.remote` opens a network-facing admin API');\n if (admin.config?.load !== undefined) {\n found.push(\n '`admin.config.load` makes Caddy pull its config from elsewhere, replacing this one',\n );\n }\n const moved = listenProblem(admin, transport);\n if (moved !== undefined) found.push(moved);\n if (transport.kind === 'tcp') {\n const allowed = admin.origins?.map(originHost) ?? defaultOrigins(transport.port);\n if (!allowed.includes(transport.hostHeader)) {\n const which =\n admin.origins === undefined\n ? `Caddy's default origins (no \\`origins\\` declared) ${JSON.stringify(allowed)}`\n : `admin origins ${JSON.stringify(admin.origins)}`;\n found.push(\n `${which} do not allow Host ${transport.hostHeader}, which this provider sends — ` +\n 'Caddy would refuse it every call after this one',\n );\n }\n } else if (admin.enforce_origin === true) {\n found.push(\n '`enforce_origin` over a unix socket: this transport (like the Caddy CLI) sends no Origin ' +\n 'there, so Caddy would answer 403 to every call',\n );\n }\n return found;\n};\n",
13
+ "/**\n * A tripwire for the obvious ways a secret ends up in Alchemy state through these providers.\n *\n * ⛔ WHY IT EXISTS. Alchemy persists every prop UNENCRYPTED in its state store — the same reason\n * the OpenBao families are metadata-only (openbao/policy.ts). A LaunchdJob's `environment` and\n * `programArguments`, and a HostFile's `content`, are props. A token declared there is a token\n * copied into the state store, into every plan diff, and into the plist or file on disk.\n * ★ THE ALTERNATIVE, NAMED IN EVERY REFUSAL: let a secret renderer (openbao-agent, or any other)\n * write the secret to a root-owned file, and declare only its PATH — `FOO_TOKEN_FILE=/path`,\n * `--token-file /path`. The job reads the file at start; the state holds a path.\n *\n * ⚠️ A TRIPWIRE, NOT A SCANNER. It catches the names and shapes people actually type. A token in\n * an innocently named variable passes; nothing here can make a secret safe to declare.\n */\nimport type { PlistDict, PlistValue } from './plist.ts';\n\nconst ALTERNATIVE =\n 'props are stored unencrypted in Alchemy state. Have a secret renderer (e.g. openbao-agent) ' +\n 'write it to a root-owned file and declare the file path instead (FOO_FILE=/path, --foo-file /path).';\n\n/** Names that end in a word meaning \"this is the secret itself\". `*_FILE`, `*_PATH` never match. */\nconst SECRET_NAME =\n /(?:^|_)(?:TOKEN|SECRET|PASSWORD|PASSWD|PASSPHRASE|API_?KEY|ACCESS_KEY|PRIVATE_KEY|SECRET_KEY|CREDENTIALS?)$/i;\n\n/** `--token=…` / `-password=…` style flags carrying their value inline. */\nconst INLINE_FLAG = /^--?[a-z0-9-]*(?:token|password|passwd|passphrase|secret|api-?key)=./i;\n\n/** A flag whose NEXT argv element is the secret: `--token abc`. */\nconst BARE_FLAG = /^--?(?:[a-z0-9]+-)*(?:token|password|passwd|passphrase|secret|api-?key)$/i;\n\nexport const PRIVATE_KEY = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----/;\n\n/** Paths of every string leaf in a plist value holding a private key. */\nconst keyLeaves = (value: PlistValue, path: string): string[] => {\n if (typeof value === 'string') return PRIVATE_KEY.test(value) ? [path] : [];\n if (Array.isArray(value)) {\n return (value as readonly PlistValue[]).flatMap((item, index) =>\n keyLeaves(item, `${path}[${String(index)}]`),\n );\n }\n if (typeof value === 'object' && value !== null) {\n return Object.entries(value).flatMap(([key, item]) => keyLeaves(item, `${path}.${key}`));\n }\n return [];\n};\n\n/**\n * Refusals for a job's environment, argv and extraKeys. Empty means nothing tripped.\n * ★ extraKeys too: it is a prop like the others, so it lands in state just the same.\n */\nexport const jobSecretProblems = (\n environment: Readonly<Record<string, string>> | undefined,\n argv: readonly string[],\n extraKeys?: PlistDict,\n): string[] => {\n const found: string[] = [];\n for (const [name, value] of Object.entries(environment ?? {})) {\n if (SECRET_NAME.test(name))\n found.push(`environment ${name} looks like a secret: ${ALTERNATIVE}`);\n else if (PRIVATE_KEY.test(value))\n found.push(`environment ${name} holds a private key: ${ALTERNATIVE}`);\n }\n for (const [index, arg] of argv.entries()) {\n // ⛔ Never echo the argument itself: if it IS a secret, the refusal would print it.\n if (INLINE_FLAG.test(arg)) {\n found.push(`programArguments[${String(index)}] passes a secret inline: ${ALTERNATIVE}`);\n } else if (BARE_FLAG.test(arg) && index + 1 < argv.length) {\n found.push(`programArguments[${String(index + 1)}] follows a secret flag: ${ALTERNATIVE}`);\n } else if (PRIVATE_KEY.test(arg)) {\n found.push(`programArguments[${String(index)}] holds a private key: ${ALTERNATIVE}`);\n }\n }\n for (const path of keyLeaves(extraKeys ?? {}, 'extraKeys')) {\n found.push(`${path} holds a private key: ${ALTERNATIVE}`);\n }\n return found;\n};\n\n/** Refusals for a HostFile's content. */\nexport const fileSecretProblems = (content: string): string[] =>\n PRIVATE_KEY.test(content) ? [`content holds a private key: ${ALTERNATIVE}`] : [];\n",
14
+ "/**\n * A tripwire for the obvious ways a secret ends up in a CaddyConfig's `caddyfile` prop.\n *\n * ⛔ WHY IT EXISTS. Alchemy stores every prop UNENCRYPTED in its state store and prints it in plan\n * diffs (the reason launchd's secret-tripwire.ts and the metadata-only OpenBao families exist).\n * The whole Caddyfile is one prop, so a token typed into it is a token in state.\n * ★ THE ALTERNATIVE, NAMED IN EVERY REFUSAL: a RUNTIME placeholder, which Caddy resolves in its own\n * process and which therefore never enters the Caddyfile, the state, the adapted JSON or\n * `autosave.json` (caddyserver/caddy v2.11.4 replacer.go):\n * · `{env.NAME}` — the Caddy process's environment; start Caddy with `--envfile <path>` where a\n * secret renderer (openbao-agent) writes that file. A rotated value needs a Caddy restart.\n * · `{file./path}` — the file's contents, trailing newline trimmed, read when the placeholder is\n * evaluated; the renderer writes the file.\n * ⚠️ `{$NAME}` IS NOT ONE OF THEM. It is substituted at ADAPT time (caddyfile/parse.go\n * replaceEnvVars), so the value lands in the adapted JSON — readable at `GET /config/` and\n * written to `autosave.json`. It is not refused (the prop holds only the name), but it is worse.\n * `{$NAME:default}` is different: the default IS in the prop, and is checked as a literal.\n * ⚠️ A TRIPWIRE, NOT A SCANNER. It catches the names and shapes people actually type; a secret in\n * an innocent-looking argument passes. Nothing here makes a secret safe to declare.\n */\nimport { PRIVATE_KEY } from '../launchd/secret-tripwire.ts';\n\nconst ALTERNATIVE =\n 'props are stored unencrypted in Alchemy state. Use a runtime placeholder instead: {env.NAME} ' +\n '(Caddy started with --envfile <file a secret renderer writes>) or {file./path/to/secret}.';\n\n/** A subdirective whose whole name says \"my argument is the secret\". `*_file` never matches. */\nconst SECRET_WORD =\n /^(?:token|api_token|auth_token|access_token|secret|client_secret|shared_secret|secret_key|password|passwd|passphrase|api_key|apikey|private_key|mac_key|hmac_key)$/i;\n\n/** Directives whose second argument is a DNS provider's credential: `dns cloudflare <token>`. */\nconst DNS_DIRECTIVE = /^(?:dns|acme_dns)$/;\n\nconst HEADER_DIRECTIVE = /^(?:header|header_up|header_down|request_header)$/;\nconst CREDENTIAL_HEADER =\n /^[+-]?(?:authorization|proxy-authorization|cookie|x-api-key|api-key|x-auth-token|x-vault-token)$/i;\n\n/** Shapes that are a credential wherever they appear. The label is what the refusal says. */\nconst SHAPES: readonly (readonly [RegExp, string])[] = [\n [/^(?:gh[pousr]_[A-Za-z0-9]{30,}|github_pat_[A-Za-z0-9_]{20,})$/, 'a GitHub token'],\n [/^(?:AKIA|ASIA)[0-9A-Z]{16}$/, 'an AWS access key id'],\n [/^xox[abposr]-[A-Za-z0-9-]{10,}$/, 'a Slack token'],\n [/^sk-(?:ant-|proj-)?[A-Za-z0-9_-]{20,}$/, 'an API secret key'],\n [/^eyJ[A-Za-z0-9_-]{8,}\\.eyJ[A-Za-z0-9_-]{8,}\\.[A-Za-z0-9_-]{8,}$/, 'a JWT'],\n // ★ basic_auth replaces placeholders in the hash at provision time (caddyauth/basicauth.go\n // Provision), so `{env.ADMIN_HASH}` works and a literal hash never needs to be declared.\n [/^\\$2[abxy]?\\$\\d{2}\\$[./A-Za-z0-9]{53}$/, 'a bcrypt password hash'],\n [/^\\$argon2(?:id|i|d)\\$/, 'an argon2 password hash'],\n];\n\nconst PLACEHOLDER = /\\{[^{}\\s]+\\}/g;\nconst AUTH_SCHEME = /^(?:bearer|basic|token|digest)$/i;\n\n/**\n * ⛔ `{$NAME:default}` IS A LITERAL. Caddy splices the default in at ADAPT time whenever NAME is\n * unset (caddyfile/parse.go replaceEnvVars: SplitN on `:`), so a secret typed as the default is\n * in the prop, the state and the adapted JSON. MEASURED 2026-09-21 on a throwaway Caddy 2.11.4:\n * `respond \"{$UNSET:literal-default}\"` adapted to the body `literal-default`. So each line is\n * checked as Caddy sees it with every such variable unset. The RUNTIME replacer has no default\n * syntax (replacer.go looks the whole key up), so `{env.X}` stays the safe form.\n */\nconst ENV_DEFAULT = /\\{\\$[^{}\\s:]*:([^}]*)\\}/g;\nconst withDefaults = (line: string): string => line.replace(ENV_DEFAULT, '$1');\n\n/** One line's tokens: whitespace-separated, \"double-quoted\" and `backquoted` kept whole, # comments dropped. */\nexport const tokensOf = (line: string): string[] => {\n const tokens: string[] = [];\n let current = '';\n let quote: string | undefined;\n for (let index = 0; index < line.length; index += 1) {\n const char = line[index] ?? '';\n if (quote !== undefined) {\n if (char === '\\\\' && quote === '\"' && index + 1 < line.length) {\n index += 1;\n current += line[index] ?? '';\n } else if (char === quote) quote = undefined;\n else current += char;\n } else if (char === '\"' || char === '`') {\n quote = char;\n } else if (/\\s/.test(char)) {\n if (current !== '') tokens.push(current);\n current = '';\n } else if (char === '#' && current === '') {\n break; // a comment starts only at the beginning of a token (caddyfile lexer)\n } else current += char;\n }\n if (current !== '') tokens.push(current);\n return tokens;\n};\n\n/**\n * True when nothing but placeholders (and an auth scheme word) is left of these tokens.\n * ⚠️ A bare `{` / `}` is a block brace, not a value: `dns cloudflare {` opens a block whose\n * `api_token` line is checked on its own.\n */\nconst placeholderOnly = (tokens: readonly string[]): boolean =>\n tokens\n .flatMap((token) => token.replace(PLACEHOLDER, ' ').split(/\\s+/))\n .filter((part) => part !== '' && part !== '{' && part !== '}' && !AUTH_SCHEME.test(part))\n .length === 0;\n\nconst lineProblems = (tokens: readonly string[], where: string): string[] => {\n const [first = '', second] = tokens;\n const found: string[] = [];\n if (SECRET_WORD.test(first) && tokens.length > 1 && !placeholderOnly(tokens.slice(1))) {\n found.push(`${where}: \\`${first}\\` has a literal value`);\n }\n if (DNS_DIRECTIVE.test(first) && tokens.length > 2 && !placeholderOnly(tokens.slice(2))) {\n found.push(`${where}: \\`${first} ${second ?? ''}\\` has a literal credential`);\n }\n if (HEADER_DIRECTIVE.test(first)) {\n const at = tokens.findIndex((token, index) => index > 0 && CREDENTIAL_HEADER.test(token));\n if (at !== -1 && tokens.length > at + 1 && !placeholderOnly(tokens.slice(at + 1))) {\n found.push(`${where}: \\`${first} ${tokens[at] ?? ''}\\` sets a literal credential`);\n }\n }\n for (const token of tokens) {\n const shape = SHAPES.find(([pattern]) => pattern.test(token));\n // ⛔ Never echo the token: if it IS a secret, the refusal would print it.\n if (shape !== undefined) found.push(`${where}: holds what looks like ${shape[1]}`);\n }\n return found;\n};\n\n/** Refusals for a Caddyfile's text. Empty means nothing tripped. */\nexport const caddyfileSecretProblems = (caddyfile: string): string[] => {\n const found: string[] = [];\n if (PRIVATE_KEY.test(caddyfile)) found.push('the Caddyfile holds a PEM private key');\n for (const [index, line] of caddyfile.split('\\n').entries()) {\n found.push(...lineProblems(tokensOf(withDefaults(line)), `line ${String(index + 1)}`));\n }\n return found.map((problem) => `${problem}: ${ALTERNATIVE}`);\n};\n",
15
+ "/**\n * CaddyConfig's props, attributes and validation — the pure half of the provider.\n *\n * ⛔ `caddyfile` IS NEVER A SECRET. Alchemy stores props unencrypted, so the whole Caddyfile sits in\n * the state store and in every plan diff. Secrets reach Caddy as runtime placeholders\n * (`{env.NAME}`, `{file./path}`) resolved from files a secret renderer writes — see\n * caddyfile-tripwire.ts, which refuses the obvious literals.\n */\nimport { caddyfileSecretProblems } from './caddyfile-tripwire.ts';\n\nexport interface CaddyConfigProps {\n /**\n * The whole Caddyfile. Applied with `POST /load` (Content-Type `text/caddyfile`); it REPLACES the\n * running config. ⛔ Never a secret. ⚠️ `import` paths resolve against Caddy's working directory\n * (the API adapts with no file name), so keep them absolute.\n */\n caddyfile: string;\n /**\n * The file Caddy was started with (`caddy run --config <this>`), when the same Caddyfile is also\n * written there — `caddyWithFile()` sets it from its HostFile. Sent as\n * `Caddy-Config-Source-File` so a load keeps Caddy's SIGUSR1 reload-from-file working.\n */\n sourceFile?: string;\n}\n\nexport interface CaddyConfigAttributes {\n /**\n * SHA-256 of the ADAPTED JSON Caddy reported after the last apply (digest.ts canonical form) —\n * never the config itself. Drift is the live config hashing to anything else.\n */\n configSha256: string;\n /** The admin endpoint the config was applied through (no credential; the API has none). */\n endpoint: string;\n /** The `sourceFile` prop as applied. */\n sourceFile?: string;\n}\n\nconst absoluteNormalised = (path: string): boolean =>\n path.startsWith('/') &&\n !path.endsWith('/') &&\n !path.includes('\\x00') &&\n !path\n .split('/')\n .slice(1)\n .some((part) => part === '' || part === '.' || part === '..');\n\nexport const configProblems = (props: CaddyConfigProps): string[] => {\n const found: string[] = [];\n /**\n * ⛔ AN EMPTY CADDYFILE IS NOT \"NOTHING TO DO\". It adapts to a config with no apps, and loading\n * it stops every server Caddy runs — every site down, on a templating bug that rendered ''.\n * Emptying Caddy is a deliberate act for a person at the admin API, not a declaration.\n * Text that is not empty but serves nothing (only comments, only global options) is caught\n * after `/adapt`, where it shows as no apps (config-lifecycle.ts servesNothing).\n */\n if (props.caddyfile.trim() === '') {\n found.push('caddyfile is empty — loading it would stop every site Caddy serves');\n }\n if (props.sourceFile !== undefined && !absoluteNormalised(props.sourceFile)) {\n found.push('sourceFile must be an absolute, normalised path');\n }\n found.push(...caddyfileSecretProblems(props.caddyfile));\n return found;\n};\n",
16
+ "/**\n * CaddyConfig's read / diff / reconcile as plain async functions over a CaddyAdmin, so the\n * lifecycle runs against a fake admin server in tests.\n *\n * The comparison is always between DIGESTS OF ADAPTED JSON (digest.ts): what `POST /adapt` makes\n * of the declared Caddyfile, what `GET /config/` reports, and what was stored after the last\n * apply. Three digests, because they answer different questions:\n * · declared ≠ stored — the declaration changed.\n * · live ≠ stored — DRIFT: a hand `curl` to the API, or a restart that loaded a different file\n * (or an `autosave.json` holding someone else's change, under `--resume`).\n * · declared = live — nothing to load, whatever the state says.\n */\nimport type { Diff } from 'alchemy/Diff';\nimport type { CaddyAdmin } from './admin.ts';\nimport {\n CaddyAdminError,\n adaptCaddyfile,\n loadCaddyfile,\n readRunningConfig,\n} from './admin-calls.ts';\nimport { adminProblems } from './admin-guard.ts';\nimport {\n type CaddyConfigAttributes,\n type CaddyConfigProps,\n configProblems,\n} from './config-form.ts';\nimport { configDigest } from './digest.ts';\n\nconst refuse = (admin: CaddyAdmin, message: string): Error =>\n new Error(`Caddy.Config at ${admin.endpoint}: ${message}`);\n\nconst short = (digest: string): string => digest.slice(0, 12);\n\ntype Desired = { readonly digest: string; readonly warnings: readonly string[] };\n\n/**\n * ⛔ A CONFIG WITH NO APPS SERVES NOTHING. A Caddyfile of only comments or only global options\n * passes the empty-text check (config-form.ts) yet adapts to `{}` or `{\"admin\":…}` — MEASURED\n * 2026-09-21 on a throwaway Caddy 2.11.4 — and loading it stops every server: the same outage,\n * from the same templating bug, that the empty check exists to prevent.\n */\nconst servesNothing = (config: unknown): boolean => {\n const apps =\n typeof config === 'object' && config !== null ? (config as { apps?: unknown }).apps : undefined;\n return typeof apps !== 'object' || apps === null || Object.keys(apps).length === 0;\n};\n\n/**\n * Validate the props, adapt the Caddyfile on the running Caddy, and check its `admin` block.\n * ★ Every refusal happens HERE, before anything is loaded — and diff calls this at plan time, so a\n * Caddyfile that does not adapt, carries a literal secret, or would strand the admin API fails the\n * PLAN, before any resource (a HostFile holding the same text included) is applied.\n */\nexport const desiredConfig = async (\n admin: CaddyAdmin,\n props: CaddyConfigProps,\n): Promise<Desired> => {\n const found = configProblems(props);\n if (found.length > 0) throw refuse(admin, found.join('; '));\n const adapted = await adaptCaddyfile(admin, props.caddyfile);\n if (servesNothing(adapted.config)) {\n throw refuse(admin, 'the Caddyfile adapts to no apps — loading it would stop every site');\n }\n const guard = adminProblems(adapted.config, admin.listener);\n if (guard.length > 0) throw refuse(admin, guard.join('; '));\n return { digest: configDigest(adapted.config), warnings: adapted.warnings };\n};\n\n/** What is running now, as attributes. `sourceFile` is carried over, never discovered. */\nexport const readLive = async (\n admin: CaddyAdmin,\n sourceFile?: string,\n): Promise<CaddyConfigAttributes> => ({\n configSha256: configDigest(await readRunningConfig(admin)),\n endpoint: admin.endpoint,\n ...(sourceFile === undefined ? {} : { sourceFile }),\n});\n\n/**\n * ★ NEVER `replace`. Nothing in the props names a different object: a new Caddyfile is a reload of\n * the same Caddy, and `sourceFile` is a header. (Which Caddy is the transport's business — see\n * the ⚠️ on `endpoint` in the diff.)\n */\nexport const diffConfig = async (\n admin: CaddyAdmin,\n news: CaddyConfigProps,\n output: CaddyConfigAttributes,\n): Promise<Diff> => {\n const want = await desiredConfig(admin, news);\n const live = await readLive(admin);\n const converged =\n want.digest === live.configSha256 &&\n live.configSha256 === output.configSha256 &&\n news.sourceFile === output.sourceFile &&\n // ⚠️ A stack whose transport now reaches ANOTHER Caddy (a new address) must load there; the\n // old one keeps what it has — the same as a delete, which never unloads (see config.ts).\n admin.endpoint === output.endpoint;\n return converged ? { action: 'noop' } : { action: 'update' };\n};\n\nexport type Applied = {\n readonly attributes: CaddyConfigAttributes;\n /** The adapter's warnings (e.g. \"Caddyfile input is not formatted\") — log them, never refuse. */\n readonly warnings: readonly string[];\n /** Whether a `POST /load` was sent (false when Caddy already ran this config). */\n readonly loaded: boolean;\n};\n\n/** Load the Caddyfile unless Caddy already runs it, then read it back and insist it matches. */\nexport const reconcileConfig = async (\n admin: CaddyAdmin,\n props: CaddyConfigProps,\n): Promise<Applied> => {\n const want = await desiredConfig(admin, props);\n const before = configDigest(await readRunningConfig(admin));\n let warnings = want.warnings;\n const loaded = before !== want.digest;\n if (loaded) {\n try {\n warnings = await loadCaddyfile(admin, props.caddyfile, props.sourceFile);\n } catch (cause) {\n if (!(cause instanceof CaddyAdminError)) throw cause;\n // ★ SAY WHAT IS RUNNING NOW. Caddy restores the previous config on a failed load (caddy.go\n // changeConfig); confirm it rather than promise it, because the deploy log is where the\n // person decides whether sites are down.\n const after = await readLive(admin).catch(() => undefined);\n const state =\n after === undefined\n ? 'and the running config could not be read back'\n : after.configSha256 === before\n ? 'Caddy kept the previous config (still serving)'\n : `and the running config is now ${short(after.configSha256)}, not the previous ${short(before)}`;\n throw refuse(admin, `Caddy refused the Caddyfile — ${cause.message}; ${state}`);\n }\n }\n // ⚠️ READ BACK, never echo the declaration: a concurrent writer, or a load Caddy answered 200 but\n // did not apply (admin-calls.ts), shows up here as a refusal instead of as stored state that is\n // already wrong.\n const attributes = await readLive(admin, props.sourceFile);\n if (attributes.configSha256 !== want.digest) {\n throw refuse(\n admin,\n `after the load Caddy runs config ${short(attributes.configSha256)}, not the ` +\n `${short(want.digest)} this Caddyfile adapts to — another writer changed it, or it was not applied`,\n );\n }\n return { attributes, loaded, warnings };\n};\n",
17
+ "/**\n * The real CaddyAdmin: this machine's Caddy, over loopback TCP or a unix socket.\n *\n * ★ node:http, NOT fetch. MEASURED 2026-09-21 on bun 1.4.0 and node 26.7.0: node:http sends a Host\n * override and dials a unix socket on BOTH runtimes, while node's fetch silently drops a `Host`\n * header (it sent the URL's host) and only Bun's fetch has a `unix` option. The published dist\n * loads under node too (launchd's local-runner.ts makes the same call for the same reason).\n * ⛔ LOOPBACK OR A UNIX SOCKET, NOTHING ELSE. The admin API is unauthenticated plaintext; an\n * address off this machine means it is reachable from the network, which decision 23 forbids.\n * Reaching another host's Caddy means forwarding its socket or port to here (SSH), never\n * exposing :2019.\n * ★ HOST AND ORIGIN, AS CADDY's OWN CLI SENDS THEM (cmd/commandfuncs.go AdminAPIRequest): over\n * TCP, `Host` and `Origin: http://<host>`; over a socket, `Host: 127.0.0.1` and no Origin, because\n * Caddy skips the Host check on unix listeners (admin.go allowedOrigins). MEASURED against the\n * mini's Caddy 2.11.4: any other Host gets 403 `host not allowed`, a forwarded port included —\n * hence `hostHeader`.\n */\nimport { request as httpRequest } from 'node:http';\nimport {\n type CaddyAdmin,\n type CaddyAdminListener,\n type CaddyAdminResponse,\n CaddyUnreachableError,\n} from './admin.ts';\n\nexport type LocalCaddyAdminOptions = {\n /**\n * `http://<loopback>:<port>` or `unix:///absolute/path.sock`.\n * @default 'http://127.0.0.1:2019' — Caddy's default admin listener (`localhost:2019`).\n */\n readonly address?: string;\n /**\n * The Host (and Origin) to send over TCP, when it is not the address's own: the Caddyfile\n * narrowed `admin { origins … }`, or the port is an SSH forward of the real one (Caddy checks\n * the Host against ITS port, not yours). Form `host:port`.\n */\n readonly hostHeader?: string;\n /**\n * Abort an exchange after this long. @default 60_000\n * ⚠️ A `shutdown_delay` in the Caddyfile makes `/load` block that long (caddyhttp app.go Stop);\n * a timeout then fails the deploy while Caddy goes on to apply — the next plan converges.\n */\n readonly timeoutMs?: number;\n /**\n * Retries when the connection is REFUSED (nothing listening yet — a Caddy launchd job that was\n * bootstrapped a moment ago). Only refusals: those never reached Caddy, so re-sending a\n * `POST /load` cannot apply it twice. @default 2\n */\n readonly retries?: number;\n /** @default 500 */\n readonly retryDelayMs?: number;\n};\n\nexport const DEFAULT_ADMIN_ADDRESS = 'http://127.0.0.1:2019';\n\ntype Target =\n | { readonly kind: 'tcp'; readonly host: string; readonly port: number }\n | { readonly kind: 'unix'; readonly socketPath: string };\n\nconst UNIX = 'unix://';\nconst HOST_PORT = /^(?:[A-Za-z0-9.-]+|\\[[0-9A-Fa-f:.]+\\]):\\d{1,5}$/;\n\nconst refuse = (address: string, why: string): Error =>\n new Error(`Caddy admin address ${JSON.stringify(address)}: ${why}`);\n\nconst isLoopback = (hostname: string): boolean =>\n hostname === 'localhost' || hostname === '[::1]' || /^127(?:\\.\\d{1,3}){3}$/.test(hostname);\n\n/** The dial target and listener for an address, or a refusal naming what is wrong with it. */\nexport const parseAdminAddress = (\n address: string,\n hostHeader?: string,\n): { target: Target; listener: CaddyAdminListener } => {\n if (hostHeader !== undefined && !HOST_PORT.test(hostHeader)) {\n throw refuse(address, `hostHeader ${JSON.stringify(hostHeader)} must be host:port`);\n }\n if (address.startsWith(UNIX)) {\n const socketPath = address.slice(UNIX.length);\n if (!socketPath.startsWith('/')) throw refuse(address, 'the socket path must be absolute');\n return { listener: { kind: 'unix', path: socketPath }, target: { kind: 'unix', socketPath } };\n }\n let url: URL;\n try {\n url = new URL(address);\n } catch {\n throw refuse(address, 'not a URL (http://127.0.0.1:2019 or unix:///path)');\n }\n // ⛔ Caddy's local admin endpoint is plaintext by design; its TLS one (`admin.remote`, mTLS on\n // :2021) is a different, network-facing API this transport deliberately does not speak.\n if (url.protocol !== 'http:') throw refuse(address, 'only http:// (loopback) or unix://');\n if (!isLoopback(url.hostname)) {\n throw refuse(address, 'not loopback — the admin API is unauthenticated; forward it to here');\n }\n if (url.pathname !== '/' || url.search !== '' || url.username !== '') {\n throw refuse(address, 'no path, query or credentials — the API lives at the root');\n }\n const port = url.port === '' ? 80 : Number(url.port);\n // ⚠️ NOT `url.host`: WHATWG URL drops a default port (`http://127.0.0.1:80` has host\n // `127.0.0.1`), and Caddy compares the Host against `host:port` (admin.go allowedOrigins), so\n // a portless Host is a 403 on every call. The Caddy CLI always sends the port (JoinHostPort).\n const host = hostHeader ?? `${url.hostname}:${String(port)}`;\n return {\n listener: {\n hostHeader: host,\n kind: 'tcp',\n port: Number(host.slice(host.lastIndexOf(':') + 1)),\n },\n // ★ `hostname` keeps IPv6 brackets; node:http wants them off.\n target: { host: url.hostname.replace(/^\\[(.*)\\]$/, '$1'), kind: 'tcp', port },\n };\n};\n\nconst code = (cause: unknown): string | undefined =>\n typeof cause === 'object' && cause !== null && 'code' in cause\n ? String((cause as { code: unknown }).code)\n : undefined;\n\n/** Nothing accepted the connection: refused TCP, or no socket file yet. The request never left. */\nconst neverConnected = (cause: unknown): boolean =>\n code(cause) === 'ECONNREFUSED' || code(cause) === 'ENOENT';\n\nconst exchange = (\n target: Target,\n method: string,\n path: string,\n headers: Record<string, string>,\n body: string | undefined,\n timeoutMs: number,\n): Promise<CaddyAdminResponse> =>\n new Promise((resolve, reject) => {\n const bytes = body === undefined ? undefined : Buffer.from(body, 'utf8');\n const request = httpRequest(\n {\n ...(target.kind === 'tcp'\n ? { host: target.host, port: target.port }\n : { socketPath: target.socketPath }),\n headers: bytes === undefined ? headers : { ...headers, 'Content-Length': bytes.length },\n method,\n path,\n timeout: timeoutMs,\n },\n (response) => {\n const chunks: Buffer[] = [];\n response.on('data', (chunk: Buffer) => chunks.push(chunk));\n response.on('error', reject);\n response.on('end', () =>\n resolve({\n body: Buffer.concat(chunks).toString('utf8'),\n status: response.statusCode ?? 0,\n }),\n );\n },\n );\n request.on('timeout', () => request.destroy(new Error(`no answer in ${String(timeoutMs)} ms`)));\n request.on('error', reject);\n request.end(bytes);\n });\n\nexport const localCaddyAdmin = (options: LocalCaddyAdminOptions = {}): CaddyAdmin => {\n const address = options.address ?? DEFAULT_ADMIN_ADDRESS;\n const { listener, target } = parseAdminAddress(address, options.hostHeader);\n const timeoutMs = options.timeoutMs ?? 60_000;\n const retries = options.retries ?? 2;\n const delay = options.retryDelayMs ?? 500;\n const fixed: Record<string, string> =\n listener.kind === 'tcp'\n ? { Host: listener.hostHeader, Origin: `http://${listener.hostHeader}` }\n : { Host: '127.0.0.1' };\n return {\n endpoint: address,\n listener,\n request: async ({ body, headers, method, path }) => {\n for (let attempt = 0; ; attempt += 1) {\n try {\n // oxlint-disable-next-line no-await-in-loop -- sequential by design: retry after a wait\n return await exchange(target, method, path, { ...headers, ...fixed }, body, timeoutMs);\n } catch (cause) {\n if (!neverConnected(cause) || attempt >= retries) {\n const reason = cause instanceof Error ? cause.message : String(cause);\n const message = `Caddy admin ${method} ${path} at ${address}: ${reason}`;\n throw neverConnected(cause) ? new CaddyUnreachableError(message) : new Error(message);\n }\n // oxlint-disable-next-line no-await-in-loop -- the wait between attempts\n await new Promise((resolve) => setTimeout(resolve, delay));\n }\n }\n },\n };\n};\n",
18
+ "/**\n * The Caddy provider with its admin transport, as a single layer for a host stack.\n *\n * Layer.mergeAll(caddyProviders(), launchdProviders(), …the stack's other providers)\n *\n * ★ launchdProviders() TOO when the stack uses caddyWithFile(): the file is a launchd-subpath\n * HostFile, written through that subpath's HostRunner.\n * ⚠️ The default is localCaddyAdmin(): `http://127.0.0.1:2019`, Caddy's default admin listener.\n * Pass another CaddyAdmin for a unix socket, a narrowed `admin { origins }`, or an SSH forward.\n */\nimport * as Layer from 'effect/Layer';\nimport { type CaddyAdmin, caddyAdminLayer } from './admin.ts';\nimport { CaddyConfigProvider } from './config.ts';\nimport { localCaddyAdmin } from './local-admin.ts';\n\nexport const caddyProviders = (admin: CaddyAdmin = localCaddyAdmin()) =>\n CaddyConfigProvider().pipe(Layer.provide(caddyAdminLayer(admin)));\n",
19
+ "/**\n * `caddyWithFile` — one Caddyfile, applied to the running Caddy AND written to the file Caddy\n * starts from, so a restart keeps it (decision 23: \"the file also lands on disk\").\n *\n * ★ REUSES launchd's HostFile, NOT A SECOND FILE WRITER. The file is an ordinary `Host.File`\n * (atomic write, digest diff, symlink refusal, `--adopt` for a file already there); the config is\n * a `Caddy.Config` whose `sourceFile` is that HostFile's `path` Output — which is what orders them.\n *\n * ⛔ THE ORDER IS FILE, THEN `/load`. The dependency makes Alchemy write the file first, and it is the\n * only order that bootstraps: a new host's Caddy launchd job starts from the file, before any\n * admin API exists to load into. Its cost, and what bounds it:\n * · A Caddyfile that does not ADAPT never reaches disk once the config has state: CaddyConfig's\n * diff adapts it at PLAN time and fails the plan. (On the very first deploy the file's path is\n * still an Output, Alchemy skips the adoption probe, and the check runs at apply instead.)\n * · A Caddyfile that adapts but that Caddy then REFUSES (a port in use, a missing cert file) is\n * on disk when `/load` fails. Caddy keeps serving the old config, the deploy fails with Caddy's\n * reason — and a RESTART before the fix would load the refused file. Fix and redeploy, or run\n * Caddy with `--resume` (docs/caddy.md): it restarts from `autosave.json`, the last config Caddy\n * ACCEPTED, and the file is only the first-boot fallback.\n * ⛔ SECRETS ARE REFUSED HERE, AT DECLARATION, before the HostFile exists: its `content` is a prop\n * too, and would carry a literal into state even if the CaddyConfig then refused it.\n * ★ BOTH RETAIN. Removing this from a stack must not delete the file a restart needs.\n */\nimport * as Effect from 'effect/Effect';\nimport * as RemovalPolicy from 'alchemy/RemovalPolicy';\nimport { HostFile } from '../launchd/host-file.ts';\nimport { CaddyConfig } from './config.ts';\nimport { configProblems } from './config-form.ts';\n\nexport interface CaddyWithFileProps {\n /** The whole Caddyfile. ⛔ Never a secret — use `{env.NAME}` / `{file./path}` placeholders. */\n readonly caddyfile: string;\n /** Absolute path Caddy is started with: `caddy run --config <path> --adapter caddyfile`. */\n readonly path: string;\n /** @default 0o644 */\n readonly mode?: number;\n readonly owner?: string | number;\n readonly group?: string | number;\n}\n\n/**\n * Declare the file (`<id>-file`) and the config (`<id>`). Provide `launchdProviders()` for the\n * file and `caddyProviders()` for the config.\n *\n * const { config, file } = yield* caddyWithFile('caddy', { caddyfile, path: '/usr/local/etc/Caddyfile' });\n */\nexport const caddyWithFile = (id: string, props: CaddyWithFileProps) =>\n Effect.gen(function* () {\n const found = configProblems({ caddyfile: props.caddyfile, sourceFile: props.path });\n if (found.length > 0) {\n return yield* Effect.fail(new Error(`caddyWithFile ${id}: ${found.join('; ')}`));\n }\n const file = yield* HostFile(`${id}-file`, {\n content: props.caddyfile,\n mode: props.mode ?? 0o644,\n path: props.path,\n ...(props.owner === undefined ? {} : { owner: props.owner }),\n ...(props.group === undefined ? {} : { group: props.group }),\n }).pipe(RemovalPolicy.retain());\n const config = yield* CaddyConfig(id, { caddyfile: props.caddyfile, sourceFile: file.path });\n return { config, file };\n });\n",
20
+ "/**\n * `Host.File` — one text file on the host, declared: content, mode, owner, group.\n *\n * - create / update — atomic write (temp file in the same directory, mode and owner set, rename),\n * skipped when the file already matches; then read back and compared.\n * - read — lstat plus the SHA-256 of the bytes.\n * - diff — declared SHA-256 against the stored and on-disk digest, plus mode and owner.\n * - replace — only when `path` changes; create-before-delete.\n * - delete — removes the file.\n *\n * ⛔ NEVER A SECRET — see host-file-form.ts. Secret files stay rendered by openbao-agent.\n * ⚠️ NOTHING IS ADOPTED WITHOUT `--adopt`: a file already at the path reads as `Unowned`.\n * ★ IT LIVES IN THE launchd SUBPATH because the two travel together: a Mac host stack declares a\n * daemon's config file and the daemon that reads it, through the same HostRunner.\n */\nimport { Resource } from 'alchemy';\nimport { Unowned } from 'alchemy/AdoptPolicy';\nimport { isResolved } from 'alchemy/Diff';\nimport * as Provider from 'alchemy/Provider';\nimport * as Effect from 'effect/Effect';\nimport { lift, resolvedString } from './host-effect.ts';\nimport type { HostFileAttributes, HostFileProps } from './host-file-form.ts';\nimport { deleteFile, diffFile, readFileAttributes, reconcileFile } from './host-file-lifecycle.ts';\nimport { HostRunnerService } from './runner.ts';\n\nexport type { HostFileAttributes, HostFileProps } from './host-file-form.ts';\n\nexport interface HostFile extends Resource<'Host.File', HostFileProps, HostFileAttributes> {}\n\nexport const HostFile = Resource<HostFile>('Host.File');\n\nexport const HostFileProvider = () =>\n Provider.effect(\n HostFile,\n Effect.gen(function* () {\n const runner = yield* HostRunnerService;\n return HostFile.Provider.of({\n list: () => Effect.succeed([]),\n\n read: ({ olds, output }) =>\n lift(async () => {\n const found = await readFileAttributes(runner, olds.path);\n if (found === undefined) return undefined;\n return output === undefined ? Unowned(found) : found;\n }),\n\n diff: ({ news, output }) => {\n if (output === undefined) return Effect.succeed(undefined);\n if (isResolved(news)) return lift(() => diffFile(runner, news, output));\n // ⛔ A new path is a replace even while `content` is unresolved (an Output templated in):\n // the engine's default would be an update, which writes the new path and never\n // removes the old one. reconcileFile also defends, for a path that is an Output.\n const path = resolvedString(news, 'path');\n return Effect.succeed(\n path !== undefined && path !== output.path ? { action: 'replace' as const } : undefined,\n );\n },\n\n reconcile: ({ news, output }) => lift(() => reconcileFile(runner, news, output)),\n\n delete: ({ output }) => lift(() => deleteFile(runner, output)),\n });\n }),\n );\n",
21
+ "/**\n * HostFile's props, attributes and validation — the pure half of the provider.\n *\n * ⛔ `content` IS NEVER A SECRET. Alchemy stores props unencrypted, so the content of every HostFile\n * sits in the state store and in every plan diff. A secret file stays RENDERED BY A SECRET\n * RENDERER (openbao-agent templates, on this estate) that fetches it at run time; the stack\n * declares only non-secret config, and at most the PATH the renderer writes to.\n * secret-tripwire.ts refuses the obvious case (a PEM private key); nothing can catch all of them.\n */\nimport { fileSecretProblems } from './secret-tripwire.ts';\n\nexport interface HostFileProps {\n /** Absolute path. The parent directory must already exist. */\n path: string;\n /** UTF-8 text. ⛔ Never a secret — see the file header. */\n content: string;\n /** Permission bits. @default 0o644 */\n mode?: number;\n /** User name or numeric uid. Omitted: whoever the runner writes as (a rewrite keeps no owner). */\n owner?: string | number;\n /** Group name or numeric gid. Omitted: the directory's default group. */\n group?: string | number;\n}\n\nexport interface HostFileAttributes {\n path: string;\n /** SHA-256 of the bytes on disk. */\n sha256: string;\n mode: number;\n uid: number;\n gid: number;\n size: number;\n}\n\nexport const DEFAULT_MODE = 0o644;\n\nconst identityProblems = (name: string, value: string | number | undefined): string[] => {\n if (value === undefined) return [];\n if (typeof value === 'number') {\n return Number.isSafeInteger(value) && value >= 0\n ? []\n : [`${name} must be a non-negative integer id`];\n }\n return /^[A-Za-z_][A-Za-z0-9_.-]*$/.test(value) || /^\\d+$/.test(value)\n ? []\n : [`${name} ${JSON.stringify(value)} is not a valid user or group name`];\n};\n\nexport const fileProblems = (props: HostFileProps): string[] => {\n const found: string[] = [];\n const { path } = props;\n if (!path.startsWith('/')) found.push('path must be absolute');\n // ★ One spelling per file: `a/./b`, `a//b` and `a/../b` would each be a second resource for the\n // same inode, and `..` is how a derived path walks out of the directory it was meant for.\n if (\n path.endsWith('/') ||\n path\n .split('/')\n .slice(1)\n .some((part) => part === '' || part === '.' || part === '..')\n ) {\n found.push('path must be normalised (no trailing slash, no empty, \".\" or \"..\" segments)');\n }\n if (path.includes('\\x00')) found.push('path contains NUL');\n const mode = props.mode ?? DEFAULT_MODE;\n if (!Number.isSafeInteger(mode) || mode < 0 || mode > 0o7777) found.push('mode must be 0–0o7777');\n found.push(...identityProblems('owner', props.owner));\n found.push(...identityProblems('group', props.group));\n found.push(...fileSecretProblems(props.content));\n return found;\n};\n",
22
+ "/**\n * The one seam between the launchd providers and the host: every file read, file write and\n * `launchctl` call goes through a HostRunner, and nothing in this directory touches the host any\n * other way.\n *\n * ★ WHY A SEAM AND NOT DIRECT node:fs CALLS. launchd has no SDK — the provider renders a plist and\n * drives `launchctl` — so the only way to test the lifecycle without a real launchd (and without\n * writing /Library) is to swap the host out. fake-runner.ts is an in-memory host with a scripted\n * launchd; local-runner.ts is the real one. The same seam is where a consumer plugs in a runner\n * that reaches a host some other way.\n *\n * ★ PROMISES, NOT EFFECTS, ON PURPOSE. A consumer writing their own runner implements plain async\n * functions; the providers lift them into Effect at the call site (host-effect.ts).\n */\nimport * as Context from 'effect/Context';\nimport * as Layer from 'effect/Layer';\n\n/** One finished process. ⛔ `stdout` may carry anything the job's environment holds — never log it. */\nexport type ExecResult = {\n readonly exitCode: number;\n readonly stdout: string;\n readonly stderr: string;\n};\n\n/**\n * What `lstat` says about a path. ⚠️ lstat, not stat: a symlink is reported as a symlink, because\n * writing through one would change a file this resource never named.\n */\nexport type FileStat = {\n readonly kind: 'file' | 'directory' | 'symlink' | 'other';\n /** Permission bits only (`& 0o7777`), never the file-type bits. */\n readonly mode: number;\n readonly uid: number;\n readonly gid: number;\n readonly size: number;\n};\n\nexport type WriteOptions = {\n /** Permission bits for the final file, applied BEFORE it becomes visible at `path`. */\n readonly mode: number;\n /** Numeric owner; omitted means whoever the runner writes as. */\n readonly uid?: number;\n /** Numeric group; omitted means the directory's default. */\n readonly gid?: number;\n};\n\nexport type HostUser = { readonly uid: number; readonly gid: number; readonly home: string };\n\nexport interface HostRunner {\n /**\n * ⛔ DECLARED, NEVER INFERRED. `true` only when every call this runner makes already runs with\n * root's authority — a runner that talks to a root helper, say. The providers refuse\n * system-domain writes unless `effectiveUid()` is 0 or this is `true`, so claiming it falsely\n * turns that refusal into an EACCES halfway through a deploy.\n * ⛔ THE KIT NEVER ELEVATES. No runner here calls `sudo`: a deploy that prompts for a password\n * mid-plan, or silently uses a cached sudo ticket, is exactly the \"no silent sudo\" failure. A\n * consumer who wants elevation writes that runner deliberately and sets this flag.\n */\n readonly privileged: boolean;\n /** The uid file writes and launchctl calls run as. */\n effectiveUid(): number;\n /** Run a program with an argv — ⛔ never through a shell. */\n exec(argv: readonly string[]): Promise<ExecResult>;\n /** File bytes, or `undefined` when nothing is at `path`. */\n readFile(path: string): Promise<Uint8Array | undefined>;\n /** lstat, or `undefined` when nothing is at `path`. */\n stat(path: string): Promise<FileStat | undefined>;\n /**\n * Write `bytes` so that `path` holds either the old file or the new one, never a torn mix:\n * a temporary file in the same directory, mode and owner set on it, then rename(2) over `path`.\n * ⚠️ The parent directory must exist; creating it would invent an owner and mode nobody declared.\n */\n writeFileAtomic(path: string, bytes: Uint8Array, options: WriteOptions): Promise<void>;\n /** Remove a file. Idempotent: nothing at `path` is success. */\n removeFile(path: string): Promise<void>;\n /** A user by name or numeric id, or `undefined` when the host has none. */\n lookupUser(nameOrId: string): Promise<HostUser | undefined>;\n /** A group's gid by name or numeric id, or `undefined` when the host has none. */\n lookupGroup(nameOrId: string): Promise<number | undefined>;\n /** Wait between launchctl polls. ★ Injected so a test never sleeps for real. */\n sleep(ms: number): Promise<void>;\n}\n\n/** The Effect service every launchd provider reads its runner from. */\nexport class HostRunnerService extends Context.Service<HostRunnerService, HostRunner>()(\n 'homeflare/launchd/HostRunner',\n) {}\n\n/** Provide a runner to the providers: `Layer.provide(hostRunnerLayer(localRunner()))`. */\nexport const hostRunnerLayer = (runner: HostRunner): Layer.Layer<HostRunnerService> =>\n Layer.succeed(HostRunnerService, runner);\n\n/** True when this runner may write root-owned paths and drive the system domain. */\nexport const canActAsRoot = (runner: HostRunner): boolean =>\n runner.privileged || runner.effectiveUid() === 0;\n",
23
+ "/**\n * HostFile's read / diff / reconcile / delete as plain async functions over a HostRunner, so the\n * lifecycle runs against fake-runner.ts in tests.\n *\n * ⛔ SYMLINKS AND DIRECTORIES ARE REFUSED, NOT REPLACED. rename(2) over a symlink replaces the LINK,\n * so a path that is a symlink (nix-darwin's /etc entries point into /nix/store) would be quietly\n * taken from the tool that owns it — which puts it back, or refuses its next activation. Remove\n * the path from its owner first, then declare it here.\n */\nimport type { Diff } from 'alchemy/Diff';\nimport {\n DEFAULT_MODE,\n type HostFileAttributes,\n type HostFileProps,\n fileProblems,\n} from './host-file-form.ts';\nimport { sha256Hex } from './job-form.ts';\nimport { type HostRunner, canActAsRoot } from './runner.ts';\n\ntype Desired = {\n readonly bytes: Uint8Array;\n readonly sha256: string;\n readonly mode: number;\n readonly uid?: number;\n readonly gid?: number;\n};\n\nconst refuse = (path: string, message: string): Error => new Error(`Host.File ${path}: ${message}`);\n\nconst numericId = (value: string | number): number | undefined =>\n typeof value === 'number' ? value : /^\\d+$/.test(value) ? Number(value) : undefined;\n\n/** Validate, then resolve owner/group names to ids through the runner. */\nexport const desiredFile = async (runner: HostRunner, props: HostFileProps): Promise<Desired> => {\n const found = fileProblems(props);\n if (found.length > 0) throw refuse(props.path, found.join('; '));\n const bytes = new TextEncoder().encode(props.content);\n let uid: number | undefined;\n let gid: number | undefined;\n if (props.owner !== undefined) {\n uid = numericId(props.owner) ?? (await runner.lookupUser(String(props.owner)))?.uid;\n if (uid === undefined) throw refuse(props.path, `no user ${String(props.owner)} on this host`);\n }\n if (props.group !== undefined) {\n gid = numericId(props.group) ?? (await runner.lookupGroup(String(props.group)));\n if (gid === undefined) throw refuse(props.path, `no group ${String(props.group)} on this host`);\n }\n return {\n bytes,\n mode: props.mode ?? DEFAULT_MODE,\n sha256: sha256Hex(bytes),\n ...(uid === undefined ? {} : { uid }),\n ...(gid === undefined ? {} : { gid }),\n };\n};\n\n/** The file as it is now, or `undefined` when nothing is at the path. Non-files read with no digest. */\nexport const readFileAttributes = async (\n runner: HostRunner,\n path: string,\n): Promise<HostFileAttributes | undefined> => {\n const stat = await runner.stat(path);\n if (stat === undefined) return undefined;\n const bytes = stat.kind === 'file' ? await runner.readFile(path) : undefined;\n return {\n gid: stat.gid,\n mode: stat.mode,\n path,\n sha256: bytes === undefined ? '' : sha256Hex(bytes),\n size: stat.size,\n uid: stat.uid,\n };\n};\n\nconst matches = (live: HostFileAttributes, want: Desired): boolean =>\n live.sha256 === want.sha256 &&\n live.mode === want.mode &&\n (want.uid === undefined || live.uid === want.uid) &&\n (want.gid === undefined || live.gid === want.gid);\n\nexport const diffFile = async (\n runner: HostRunner,\n news: HostFileProps,\n output: HostFileAttributes,\n): Promise<Diff> => {\n // ★ Create-before-delete: two paths can hold two files at once, so nothing forces deleteFirst.\n if (news.path !== output.path) return { action: 'replace' };\n const want = await desiredFile(runner, news);\n if (want.sha256 !== output.sha256) return { action: 'update' };\n const live = await readFileAttributes(runner, news.path);\n return live !== undefined && matches(live, want) ? { action: 'noop' } : { action: 'update' };\n};\n\nexport const reconcileFile = async (\n runner: HostRunner,\n props: HostFileProps,\n output?: HostFileAttributes,\n): Promise<HostFileAttributes> => {\n const want = await desiredFile(runner, props);\n // ⛔ NO SILENT SUDO: handing a file to another user is root's call (chown(2)), so say so up front.\n if (want.uid !== undefined && want.uid !== runner.effectiveUid() && !canActAsRoot(runner)) {\n throw refuse(\n props.path,\n `owner ${String(props.owner)} is not the deploying user; only root may chown. Deploy as root ` +\n 'or through a privileged HostRunner (privileged: true). This provider never calls sudo.',\n );\n }\n const stat = await runner.stat(props.path);\n if (stat !== undefined && stat.kind !== 'file') {\n throw refuse(\n props.path,\n `is a ${stat.kind}; remove it from whatever owns it before declaring it here`,\n );\n }\n const before = stat === undefined ? undefined : await readFileAttributes(runner, props.path);\n // ⚠️ An `output` at another path: the engine planned an UPDATE across a move, which it does\n // when diff could not see the new path (host-file.ts). Finish it the way a replace would.\n const moved = output !== undefined && output.path !== props.path;\n const prior = moved ? undefined : output;\n /**\n * ⛔ A FILE THIS RESOURCE DOES NOT OWN IS NEVER OVERWRITTEN. With no prior state for this path,\n * the engine's adoption probe has already refused anything it found — except at the new path of\n * a replace, where it reads nothing. A path typo there would otherwise overwrite, say, a system\n * file that a fresh declaration of the same path would have been refused as `Unowned`.\n */\n if (prior === undefined && before !== undefined && !matches(before, want)) {\n throw refuse(\n props.path,\n 'already exists and is not this resource. Remove it, or declare it as a new resource and ' +\n 'deploy with --adopt.',\n );\n }\n if (before === undefined || !matches(before, want)) {\n await runner.writeFileAtomic(props.path, want.bytes, {\n mode: want.mode,\n ...(want.uid === undefined ? {} : { uid: want.uid }),\n ...(want.gid === undefined ? {} : { gid: want.gid }),\n });\n }\n // ⚠️ READ BACK, never echo the declaration: a umask, an ACL or a runner that ignored `uid` shows\n // up here as a refusal instead of as a forever-`update`.\n const after = await readFileAttributes(runner, props.path);\n if (after === undefined || !matches(after, want)) {\n // ⚠️ Roll back a CREATE: left behind, the next plan's recovery `read` finds a file with no\n // state, reports it `Unowned`, and every later deploy demands --adopt for our own file.\n if (before === undefined) await runner.removeFile(props.path).catch(() => undefined);\n throw refuse(\n props.path,\n 'the write returned but the file on disk does not match the declaration',\n );\n }\n // ★ Create-before-delete, as the replace would have been: the old path goes only once the new\n // one is written and verified.\n if (moved) await deleteFile(runner, output);\n return after;\n};\n\n/** Remove the file. Idempotent. ⛔ Refuses a path that has since become a symlink or directory. */\nexport const deleteFile = async (runner: HostRunner, output: HostFileAttributes): Promise<void> => {\n const stat = await runner.stat(output.path);\n if (stat === undefined) return;\n if (stat.kind !== 'file') throw refuse(output.path, `is now a ${stat.kind}; not removing it`);\n await runner.removeFile(output.path);\n};\n"
24
+ ],
25
+ "mappings": ";AAeA;AACA;AAAA;AA8CO,MAAM,8BAA8B,MAAM;AAAA,EAC7B,OAAO;AAC3B;AAAA;AAGO,MAAM,0BAAkC,gBAAuC,EACpF,4BACF,EAAE;AAAC;AAGI,IAAM,kBAAkB,CAAC,UACxB,cAAQ,mBAAmB,KAAK;;AC/DxC;;;ACqBO,MAAM,mBAAmB,MAAM;AAAA,EAEzB;AAAA,EADX,WAAW,CACA,MACT,QACA;AAAA,IACA,MAAM,SAAS,SAAS,KAAK,WAAW,SAAS,QAAQ;AAAA,IAHhD;AAAA,IAIT,KAAK,OAAO;AAAA;AAEhB;AAEA,IAAM,SACJ;AAAA,IACA,0DACA;AAAA,IACA;AAAA;AAGF,IAAM,YAAY;AASlB,IAAM,YAAY;AAQX,IAAM,aAAa,CAAC,MAAc,SAAyB;AAAA,EAChE,MAAM,MAAM,UAAU,KAAK,IAAI;AAAA,EAC/B,IAAI,QAAQ,MAAM;AAAA,IAChB,MAAM,OAAO,IAAI,GAAG,YAAY,CAAC,KAAK;AAAA,IACtC,MAAM,IAAI,WACR,MACA,KAAK,KAAK,SAAS,EAAE,EAAE,YAAY,EAAE,SAAS,GAAG,GAAG,4BACtD;AAAA,EACF;AAAA,EACA,OAAO,KACJ,WAAW,KAAK,OAAO,EACvB,WAAW,KAAK,MAAM,EACtB,WAAW,KAAK,MAAM,EACtB,WAAW,MAAM,OAAO;AAAA;AAG7B,IAAM,gBAAgB,CAAC,UAA2B;AAAA,EAChD,MAAM,QAAQ,OAAO,eAAe,KAAK;AAAA,EACzC,OAAO,UAAU,OAAO,aAAa,UAAU;AAAA;AAGjD,IAAM,cAAc,CAAC,OAAgB,MAAc,OAAe,QAAwB;AAAA,EACxF,MAAM,MAAM,KAAK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AM,gBAAgB,CAAC,IAAY,UACjC,YAAI,UAAU,GAAG;AAAA,EACtB,MAAM,QAAQ,eAAe,EAAE,WAAW,MAAM,WAAW,YAAY,MAAM,KAAK,CAAC;AAAA,EACnF,IAAI,MAAM,SAAS,GAAG;AAAA,IACpB,OAAO,OAAc,aAAK,IAAI,MAAM,iBAAiB,OAAO,MAAM,KAAK,IAAI,GAAG,CAAC;AAAA,EACjF;AAAA,EACA,MAAM,OAAO,OAAO,SAAS,GAAG,WAAW;AAAA,IACzC,SAAS,MAAM;AAAA,IACf,MAAM,MAAM,QAAQ;AAAA,IACpB,MAAM,MAAM;AAAA,OACR,MAAM,UAAU,YAAY,CAAC,IAAI,EAAE,OAAO,MAAM,MAAM;AAAA,OACtD,MAAM,UAAU,YAAY,CAAC,IAAI,EAAE,OAAO,MAAM,MAAM;AAAA,EAC5D,CAAC,EAAE,KAAmB,qBAAO,CAAC;AAAA,EAC9B,MAAM,SAAS,OAAO,YAAY,IAAI,EAAE,WAAW,MAAM,WAAW,YAAY,KAAK,KAAK,CAAC;AAAA,EAC3F,OAAO,EAAE,QAAQ,KAAK;AAAA,CACvB;",
26
+ "debugId": "205F5FF536DDDFA164756E2164756E21",
27
+ "names": []
28
+ }
@@ -0,0 +1,45 @@
1
+ import { type CaddyAdmin, type CaddyAdminListener } from './admin.ts';
2
+ export type LocalCaddyAdminOptions = {
3
+ /**
4
+ * `http://<loopback>:<port>` or `unix:///absolute/path.sock`.
5
+ * @default 'http://127.0.0.1:2019' — Caddy's default admin listener (`localhost:2019`).
6
+ */
7
+ readonly address?: string;
8
+ /**
9
+ * The Host (and Origin) to send over TCP, when it is not the address's own: the Caddyfile
10
+ * narrowed `admin { origins … }`, or the port is an SSH forward of the real one (Caddy checks
11
+ * the Host against ITS port, not yours). Form `host:port`.
12
+ */
13
+ readonly hostHeader?: string;
14
+ /**
15
+ * Abort an exchange after this long. @default 60_000
16
+ * ⚠️ A `shutdown_delay` in the Caddyfile makes `/load` block that long (caddyhttp app.go Stop);
17
+ * a timeout then fails the deploy while Caddy goes on to apply — the next plan converges.
18
+ */
19
+ readonly timeoutMs?: number;
20
+ /**
21
+ * Retries when the connection is REFUSED (nothing listening yet — a Caddy launchd job that was
22
+ * bootstrapped a moment ago). Only refusals: those never reached Caddy, so re-sending a
23
+ * `POST /load` cannot apply it twice. @default 2
24
+ */
25
+ readonly retries?: number;
26
+ /** @default 500 */
27
+ readonly retryDelayMs?: number;
28
+ };
29
+ export declare const DEFAULT_ADMIN_ADDRESS = "http://127.0.0.1:2019";
30
+ type Target = {
31
+ readonly kind: 'tcp';
32
+ readonly host: string;
33
+ readonly port: number;
34
+ } | {
35
+ readonly kind: 'unix';
36
+ readonly socketPath: string;
37
+ };
38
+ /** The dial target and listener for an address, or a refusal naming what is wrong with it. */
39
+ export declare const parseAdminAddress: (address: string, hostHeader?: string) => {
40
+ target: Target;
41
+ listener: CaddyAdminListener;
42
+ };
43
+ export declare const localCaddyAdmin: (options?: LocalCaddyAdminOptions) => CaddyAdmin;
44
+ export {};
45
+ //# sourceMappingURL=local-admin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-admin.d.ts","sourceRoot":"","sources":["../../src/caddy/local-admin.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,kBAAkB,EAGxB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB;IACnB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,KAAK,MAAM,GACP;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACtE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAW3D,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB,YACnB,MAAM,eACF,MAAM,KAClB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,kBAAkB,CAAA;CAsChD,CAAC;AAgDF,eAAO,MAAM,eAAe,aAAa,sBAAsB,KAAQ,UA8BtE,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The Caddy provider with its admin transport, as a single layer for a host stack.
3
+ *
4
+ * Layer.mergeAll(caddyProviders(), launchdProviders(), …the stack's other providers)
5
+ *
6
+ * ★ launchdProviders() TOO when the stack uses caddyWithFile(): the file is a launchd-subpath
7
+ * HostFile, written through that subpath's HostRunner.
8
+ * ⚠️ The default is localCaddyAdmin(): `http://127.0.0.1:2019`, Caddy's default admin listener.
9
+ * Pass another CaddyAdmin for a unix socket, a narrowed `admin { origins }`, or an SSH forward.
10
+ */
11
+ import * as Layer from 'effect/Layer';
12
+ import { type CaddyAdmin } from './admin.ts';
13
+ export declare const caddyProviders: (admin?: CaddyAdmin) => Layer.Layer<import("alchemy").Provider<import("./config.ts").CaddyConfig>, never, never>;
14
+ //# sourceMappingURL=providers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/caddy/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,YAAY,CAAC;AAI9D,eAAO,MAAM,cAAc,WAAW,UAAU,6FACmB,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * `caddyWithFile` — one Caddyfile, applied to the running Caddy AND written to the file Caddy
3
+ * starts from, so a restart keeps it (decision 23: "the file also lands on disk").
4
+ *
5
+ * ★ REUSES launchd's HostFile, NOT A SECOND FILE WRITER. The file is an ordinary `Host.File`
6
+ * (atomic write, digest diff, symlink refusal, `--adopt` for a file already there); the config is
7
+ * a `Caddy.Config` whose `sourceFile` is that HostFile's `path` Output — which is what orders them.
8
+ *
9
+ * ⛔ THE ORDER IS FILE, THEN `/load`. The dependency makes Alchemy write the file first, and it is the
10
+ * only order that bootstraps: a new host's Caddy launchd job starts from the file, before any
11
+ * admin API exists to load into. Its cost, and what bounds it:
12
+ * · A Caddyfile that does not ADAPT never reaches disk once the config has state: CaddyConfig's
13
+ * diff adapts it at PLAN time and fails the plan. (On the very first deploy the file's path is
14
+ * still an Output, Alchemy skips the adoption probe, and the check runs at apply instead.)
15
+ * · A Caddyfile that adapts but that Caddy then REFUSES (a port in use, a missing cert file) is
16
+ * on disk when `/load` fails. Caddy keeps serving the old config, the deploy fails with Caddy's
17
+ * reason — and a RESTART before the fix would load the refused file. Fix and redeploy, or run
18
+ * Caddy with `--resume` (docs/caddy.md): it restarts from `autosave.json`, the last config Caddy
19
+ * ACCEPTED, and the file is only the first-boot fallback.
20
+ * ⛔ SECRETS ARE REFUSED HERE, AT DECLARATION, before the HostFile exists: its `content` is a prop
21
+ * too, and would carry a literal into state even if the CaddyConfig then refused it.
22
+ * ★ BOTH RETAIN. Removing this from a stack must not delete the file a restart needs.
23
+ */
24
+ import * as Effect from 'effect/Effect';
25
+ import { HostFile } from '../launchd/host-file.ts';
26
+ import { CaddyConfig } from './config.ts';
27
+ export interface CaddyWithFileProps {
28
+ /** The whole Caddyfile. ⛔ Never a secret — use `{env.NAME}` / `{file./path}` placeholders. */
29
+ readonly caddyfile: string;
30
+ /** Absolute path Caddy is started with: `caddy run --config <path> --adapter caddyfile`. */
31
+ readonly path: string;
32
+ /** @default 0o644 */
33
+ readonly mode?: number;
34
+ readonly owner?: string | number;
35
+ readonly group?: string | number;
36
+ }
37
+ /**
38
+ * Declare the file (`<id>-file`) and the config (`<id>`). Provide `launchdProviders()` for the
39
+ * file and `caddyProviders()` for the config.
40
+ *
41
+ * const { config, file } = yield* caddyWithFile('caddy', { caddyfile, path: '/usr/local/etc/Caddyfile' });
42
+ */
43
+ export declare const caddyWithFile: (id: string, props: CaddyWithFileProps) => Effect.Effect<{
44
+ config: CaddyConfig;
45
+ file: HostFile;
46
+ }, Error, import("alchemy").Provider<CaddyConfig> | import("alchemy").Provider<HostFile>>;
47
+ //# sourceMappingURL=with-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with-file.d.ts","sourceRoot":"","sources":["../../src/caddy/with-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,MAAM,WAAW,kBAAkB;IACjC,8FAA8F;IAC9F,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,4FAA4F;IAC5F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qBAAqB;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAClC;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,OAAQ,MAAM,SAAS,kBAAkB;;;yFAe/D,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * A fake Cloudflare `warp_connector` API for the MeshNode tests — an in-memory `fetch` handed to
3
+ * Effect's real FetchHttpClient through its `Fetch` reference, so the tests exercise distilled's
4
+ * real path assembly, query and body encoding, envelope decoding and error matching.
5
+ *
6
+ * ⛔ TEST-ONLY, AND NO NETWORK. No provider imports this file. The base URL is RFC 2606
7
+ * `api.example.com`, and any request outside `/accounts/<FAKE_ACCOUNT>/warp_connector` throws, so
8
+ * a mis-wired test fails instead of reaching a real API. The credentials are placeholders.
9
+ * ★ THE NAME FILTER IS A SUBSTRING MATCH ON PURPOSE. The real filter's exactness is undocumented;
10
+ * a loose fake proves the client re-checks the exact name.
11
+ * ★ PAGES OF TWO by default, so every lookup walks more than one page.
12
+ * ★ `is_deleted` IS HONOURED AS THE SDK DOCUMENTS IT: `false` → live only, `true` → deleted only,
13
+ * absent → every tunnel. So a lookup that forgot the filter sees tombstones and must drop them.
14
+ * ★ `onCreate` runs before a POST is answered: a test uses it to put a node in the way between
15
+ * the provider's lookup and its create — what a retried POST whose first response was lost does.
16
+ */
17
+ import { type Credentials } from '@distilled.cloud/cloudflare/Credentials';
18
+ import * as Cloudflare from 'alchemy/Cloudflare';
19
+ import * as Layer from 'effect/Layer';
20
+ export declare const FAKE_BASE = "https://api.example.com/client/v4";
21
+ export declare const FAKE_ACCOUNT = "00000000000000000000000000000001";
22
+ /** ⚠️ A placeholder, not a credential. Tests assert it is what the SDK sends. */
23
+ export declare const FAKE_API_TOKEN = "placeholder-api-token";
24
+ export type FakeNode = {
25
+ id: string;
26
+ name: string;
27
+ ha: boolean;
28
+ status: string;
29
+ token: string;
30
+ deleted_at: string | null;
31
+ };
32
+ export type Seen = {
33
+ readonly method: string;
34
+ readonly path: string;
35
+ readonly body: unknown;
36
+ };
37
+ export declare const fakeFailure: (status: number, code: number, message: string) => Response;
38
+ export type FakeOptions = {
39
+ readonly perPage?: number;
40
+ /** Return a Response to answer the POST with it instead (e.g. `fakeFailure(409, 1013, …)`). */
41
+ readonly onCreate?: (name: string) => Response | void;
42
+ };
43
+ export declare const fakeMesh: (options?: FakeOptions) => {
44
+ auth: string[];
45
+ fetch: typeof fetch;
46
+ live: () => FakeNode[];
47
+ nodes: Map<string, FakeNode>;
48
+ seed: (node: Partial<FakeNode> & {
49
+ name: string;
50
+ }) => FakeNode;
51
+ seen: Seen[];
52
+ };
53
+ export type FakeMesh = ReturnType<typeof fakeMesh>;
54
+ /** distilled Credentials + the real FetchHttpClient over the fake — what a Bun script provides. */
55
+ export declare const fakeClientLayer: (fake: FakeMesh, credentials?: Layer.Layer<Credentials>) => Layer.Layer<Credentials | import("effect/unstable/http/HttpClient").HttpClient, never, never>;
56
+ /** …plus the account, as Alchemy's CloudflareEnvironment hands it to a provider. */
57
+ export declare const fakeProviderLayer: (fake: FakeMesh, accountId?: string) => Layer.Layer<Cloudflare.CloudflareEnvironment | Credentials | import("effect/unstable/http/HttpClient").HttpClient, never, never>;
58
+ //# sourceMappingURL=fake-mesh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake-mesh.d.ts","sourceRoot":"","sources":["../../src/cloudflare/fake-mesh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,yCAAyC,CAAC;AACzF,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,eAAO,MAAM,SAAS,sCAAsC,CAAC;AAC7D,eAAO,MAAM,YAAY,qCAAqC,CAAC;AAC/D,iFAAiF;AACjF,eAAO,MAAM,cAAc,0BAA0B,CAAC;AAEtD,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAK9F,eAAO,MAAM,WAAW,WAAY,MAAM,QAAQ,MAAM,WAAW,MAAM,aAItE,CAAC;AAaJ,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,+FAA+F;IAC/F,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,GAAG,IAAI,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,QAAQ,aAAa,WAAW;;;;;iBAWvB,OAAO,CAAC,QAAQ,CAAC,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAG,QAAQ;;CAyEpE,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEnD,mGAAmG;AACnG,eAAO,MAAM,eAAe,SACpB,QAAQ,gBACD,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,kGASpC,CAAC;AAEJ,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,SAAU,QAAQ,cAAa,MAAM,qIAYhE,CAAC"}
@@ -1,12 +1,18 @@
1
1
  /**
2
2
  * Cloudflare providers for Alchemy — the gaps the vendor SDK leaves.
3
3
  *
4
- * ★ Built on the official `cloudflare` SDK, not hand-rolled HTTP: it already has
5
- * `r2.buckets.locks.update/get` over the documented endpoints, so there is no path
6
- * string this package invents.
4
+ * ★ Built on vendor SDKs, not hand-rolled HTTP. `R2BucketLock` uses the official `cloudflare`
5
+ * SDK, which already has `r2.buckets.locks.update/get` over the documented endpoints.
6
+ * `MeshNode` uses `@distilled.cloud/cloudflare`, the SDK Alchemy's own Cloudflare providers
7
+ * use, because `cloudflare@4.5.0` cannot create an HA node (mesh-node-api.ts). Either way
8
+ * there is no path string this package invents.
7
9
  */
8
10
  export type { R2LockRule } from './lock-rules.ts';
9
11
  export { R2BucketLock, type R2BucketLockProps } from './r2-bucket-lock.ts';
12
+ export { MeshNode, MeshNodeProvider, type MeshNodeServices } from './mesh-node.ts';
13
+ export type { MeshNodeAttributes, MeshNodeProps } from './mesh-node-form.ts';
14
+ export { MeshNodeError, type MeshNodeStatus } from './mesh-node-api.ts';
15
+ export { fetchMeshNodeToken, type MeshNodeRef } from './mesh-node-token.ts';
10
16
  export { providers } from './providers.ts';
11
17
  export { astroWebsite, viteWebsite, type AstroWebsiteProps, type ViteWebsiteProps, } from './website.ts';
12
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACnF,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC"}