@homeflare/alchemy 0.20.0 → 0.21.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 (172) hide show
  1. package/README.md +25 -0
  2. package/dist/caddy/access-forward-auth.d.ts +56 -0
  3. package/dist/caddy/access-forward-auth.d.ts.map +1 -0
  4. package/dist/caddy/index.d.ts +6 -0
  5. package/dist/caddy/index.d.ts.map +1 -1
  6. package/dist/caddy/index.js +169 -75
  7. package/dist/caddy/index.js.map +10 -7
  8. package/dist/cloudflare/mcp-server-api.d.ts +135 -0
  9. package/dist/cloudflare/mcp-server-api.d.ts.map +1 -0
  10. package/dist/cloudflare/mcp-server-form.d.ts +116 -0
  11. package/dist/cloudflare/mcp-server-form.d.ts.map +1 -0
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/launchd/file-converge.d.ts +70 -0
  15. package/dist/launchd/file-converge.d.ts.map +1 -0
  16. package/dist/launchd/file-identity.d.ts +32 -0
  17. package/dist/launchd/file-identity.d.ts.map +1 -0
  18. package/dist/launchd/host-file-form.d.ts +2 -0
  19. package/dist/launchd/host-file-form.d.ts.map +1 -1
  20. package/dist/launchd/host-file-lifecycle.d.ts +11 -24
  21. package/dist/launchd/host-file-lifecycle.d.ts.map +1 -1
  22. package/dist/launchd/host-file.d.ts.map +1 -1
  23. package/dist/launchd/index.js +173 -120
  24. package/dist/launchd/index.js.map +12 -10
  25. package/dist/launchd/local-runner.d.ts.map +1 -1
  26. package/dist/launchd/runner.d.ts +17 -2
  27. package/dist/launchd/runner.d.ts.map +1 -1
  28. package/dist/launchd/sudo-runner.d.ts +11 -0
  29. package/dist/launchd/sudo-runner.d.ts.map +1 -1
  30. package/dist/linux/index.js.map +3 -3
  31. package/dist/linux/sudo-listing.d.ts +47 -0
  32. package/dist/linux/sudo-listing.d.ts.map +1 -0
  33. package/dist/proxmox/credential-literals.d.ts +1 -1
  34. package/dist/proxmox/credential-literals.d.ts.map +1 -1
  35. package/dist/proxmox/generated/pbs/nodes-node.d.ts +1 -1
  36. package/dist/proxmox/generated/pbs/nodes-node.d.ts.map +1 -1
  37. package/dist/proxmox/generated/pbs.d.ts +7 -0
  38. package/dist/proxmox/generated/pbs.d.ts.map +1 -1
  39. package/dist/proxmox/generated/pve.d.ts +7 -0
  40. package/dist/proxmox/generated/pve.d.ts.map +1 -1
  41. package/dist/proxmox/index.d.ts +1 -1
  42. package/dist/proxmox/index.d.ts.map +1 -1
  43. package/dist/proxmox/index.js +2 -2
  44. package/dist/proxmox/index.js.map +9 -9
  45. package/dist/proxmox/pbs-notification-target-form.d.ts +1 -1
  46. package/dist/proxmox/pbs-notification-target-form.d.ts.map +1 -1
  47. package/dist/proxmox/pbs-notification-target.d.ts +1 -1
  48. package/dist/proxmox/pbs-notification-target.d.ts.map +1 -1
  49. package/dist/release/archive.d.ts +11 -0
  50. package/dist/release/archive.d.ts.map +1 -0
  51. package/dist/release/binary-claim.d.ts +53 -0
  52. package/dist/release/binary-claim.d.ts.map +1 -0
  53. package/dist/release/binary-diff.d.ts +38 -0
  54. package/dist/release/binary-diff.d.ts.map +1 -0
  55. package/dist/release/binary-form.d.ts +118 -0
  56. package/dist/release/binary-form.d.ts.map +1 -0
  57. package/dist/release/binary-lifecycle.d.ts +55 -0
  58. package/dist/release/binary-lifecycle.d.ts.map +1 -0
  59. package/dist/release/binary-read.d.ts +11 -0
  60. package/dist/release/binary-read.d.ts.map +1 -0
  61. package/dist/release/binary.d.ts +68 -0
  62. package/dist/release/binary.d.ts.map +1 -0
  63. package/dist/release/catalog.d.ts +76 -0
  64. package/dist/release/catalog.d.ts.map +1 -0
  65. package/dist/release/checksums.d.ts +22 -0
  66. package/dist/release/checksums.d.ts.map +1 -0
  67. package/dist/release/declared-pins.d.ts +4 -0
  68. package/dist/release/declared-pins.d.ts.map +1 -0
  69. package/dist/release/download.d.ts +44 -0
  70. package/dist/release/download.d.ts.map +1 -0
  71. package/dist/release/fake-deploy.d.ts +48 -0
  72. package/dist/release/fake-deploy.d.ts.map +1 -0
  73. package/dist/release/fake-engine.d.ts +8 -0
  74. package/dist/release/fake-engine.d.ts.map +1 -0
  75. package/dist/release/fake-install.d.ts +39 -0
  76. package/dist/release/fake-install.d.ts.map +1 -0
  77. package/dist/release/fake-provider.d.ts +58 -0
  78. package/dist/release/fake-provider.d.ts.map +1 -0
  79. package/dist/release/fake-release.d.ts +95 -0
  80. package/dist/release/fake-release.d.ts.map +1 -0
  81. package/dist/release/index.d.ts +24 -0
  82. package/dist/release/index.d.ts.map +1 -0
  83. package/dist/release/index.js +1365 -0
  84. package/dist/release/index.js.map +35 -0
  85. package/dist/release/providers.d.ts +19 -0
  86. package/dist/release/providers.d.ts.map +1 -0
  87. package/dist/release/refused.d.ts +39 -0
  88. package/dist/release/refused.d.ts.map +1 -0
  89. package/dist/release/tar.d.ts +14 -0
  90. package/dist/release/tar.d.ts.map +1 -0
  91. package/dist/release/victoria.d.ts +36 -0
  92. package/dist/release/victoria.d.ts.map +1 -0
  93. package/dist/{proxmox → secrets}/write-only.d.ts.map +1 -1
  94. package/docs/release-binary-catalogs.md +113 -0
  95. package/docs/release-binary-measured.md +163 -0
  96. package/docs/release-binary-refusals.md +57 -0
  97. package/docs/release-binary-upstream.md +163 -0
  98. package/docs/release-binary.md +154 -0
  99. package/package.json +5 -1
  100. package/src/caddy/access-forward-auth.test.ts +63 -0
  101. package/src/caddy/access-forward-auth.ts +120 -0
  102. package/src/caddy/index.ts +10 -0
  103. package/src/caddy/providers.test.ts +4 -0
  104. package/src/cloudflare/mcp-server-api.ts +294 -0
  105. package/src/cloudflare/mcp-server-form.ts +219 -0
  106. package/src/index.ts +1 -0
  107. package/src/launchd/file-converge.ts +233 -0
  108. package/src/launchd/file-identity.ts +69 -0
  109. package/src/launchd/host-file-alias.test.ts +65 -0
  110. package/src/launchd/host-file-form.ts +2 -1
  111. package/src/launchd/host-file-lifecycle.ts +25 -144
  112. package/src/launchd/host-file.ts +8 -2
  113. package/src/launchd/local-runner.test.ts +12 -1
  114. package/src/launchd/local-runner.ts +2 -0
  115. package/src/launchd/runner.ts +17 -2
  116. package/src/launchd/sudo-runner.ts +11 -0
  117. package/src/linux/sudo-listing.ts +122 -0
  118. package/src/proxmox/credential-literals.ts +1 -1
  119. package/src/proxmox/generated/pbs/nodes-node.ts +1 -1
  120. package/src/proxmox/generated/pbs.ts +7 -0
  121. package/src/proxmox/generated/pve.ts +7 -0
  122. package/src/proxmox/index.ts +1 -1
  123. package/src/proxmox/pbs-notification-target-form.ts +1 -1
  124. package/src/proxmox/pbs-notification-target-lifecycle.ts +1 -1
  125. package/src/proxmox/pbs-notification-target-wire.ts +1 -1
  126. package/src/proxmox/pbs-notification-target.ts +1 -1
  127. package/src/release/adopt-parity.test.ts +106 -0
  128. package/src/release/apply-pins.test.ts +128 -0
  129. package/src/release/archive.ts +94 -0
  130. package/src/release/binary-alias.test.ts +109 -0
  131. package/src/release/binary-claim.ts +80 -0
  132. package/src/release/binary-claims.test.ts +47 -0
  133. package/src/release/binary-diff.ts +73 -0
  134. package/src/release/binary-form.ts +229 -0
  135. package/src/release/binary-lifecycle.test.ts +90 -0
  136. package/src/release/binary-lifecycle.ts +202 -0
  137. package/src/release/binary-read.ts +55 -0
  138. package/src/release/binary-refusals.test.ts +192 -0
  139. package/src/release/binary-sudo.test.ts +93 -0
  140. package/src/release/binary.ts +181 -0
  141. package/src/release/catalog.test.ts +96 -0
  142. package/src/release/catalog.ts +175 -0
  143. package/src/release/checksums.test.ts +35 -0
  144. package/src/release/checksums.ts +43 -0
  145. package/src/release/declared-pins.ts +39 -0
  146. package/src/release/download.test.ts +138 -0
  147. package/src/release/download.ts +110 -0
  148. package/src/release/error-channel.test.ts +69 -0
  149. package/src/release/fake-deploy.ts +87 -0
  150. package/src/release/fake-engine.ts +50 -0
  151. package/src/release/fake-install.ts +59 -0
  152. package/src/release/fake-provider.ts +68 -0
  153. package/src/release/fake-release.ts +185 -0
  154. package/src/release/fixtures/victoria/darwin-arm64-assets.txt +22 -0
  155. package/src/release/fixtures/victoria/victoria-logs-darwin-arm64-v1.52.0_checksums.txt +2 -0
  156. package/src/release/fixtures/victoria/victoria-metrics-darwin-arm64-v1.151.0_checksums.txt +2 -0
  157. package/src/release/fixtures/victoria/victoria-traces-darwin-arm64-v0.10.0_checksums.txt +2 -0
  158. package/src/release/fixtures/victoria/vmutils-darwin-arm64-v1.151.0_checksums.txt +8 -0
  159. package/src/release/index.ts +41 -0
  160. package/src/release/plan.test.ts +189 -0
  161. package/src/release/provider-refusals.test.ts +48 -0
  162. package/src/release/providers.test.ts +174 -0
  163. package/src/release/providers.ts +24 -0
  164. package/src/release/recovery-read.test.ts +44 -0
  165. package/src/release/refused.ts +40 -0
  166. package/src/release/tar.test.ts +142 -0
  167. package/src/release/tar.ts +195 -0
  168. package/src/release/victoria.test.ts +108 -0
  169. package/src/release/victoria.ts +154 -0
  170. package/src/{proxmox → secrets}/write-only.ts +6 -0
  171. /package/dist/{proxmox → secrets}/write-only.d.ts +0 -0
  172. /package/src/{proxmox → secrets}/write-only.test.ts +0 -0
@@ -0,0 +1,35 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/launchd/secret-tripwire.ts", "../src/launchd/host-file-form.ts", "../src/release/binary-form.ts", "../src/release/binary.ts", "../src/launchd/host-effect.ts", "../src/launchd/runner.ts", "../src/ownership/adopt.ts", "../src/ownership/resume.ts", "../src/ownership/rows.ts", "../src/ownership/whole.ts", "../src/release/binary-diff.ts", "../src/launchd/file-identity.ts", "../src/launchd/job-form.ts", "../src/launchd/plist.ts", "../src/launchd/file-converge.ts", "../src/release/binary-claim.ts", "../src/release/refused.ts", "../src/release/tar.ts", "../src/release/archive.ts", "../src/release/binary-lifecycle.ts", "../src/release/binary-read.ts", "../src/release/declared-pins.ts", "../src/release/download.ts", "../src/release/catalog.ts", "../src/release/providers.ts", "../src/release/victoria.ts"],
4
+ "sourcesContent": [
5
+ "/**\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",
6
+ "/**\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\n/** A user or group as declared: a non-negative id, or a name the host could have. */\nexport const 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\n/**\n * An absolute, normalised path, or the reasons it is not. ★ Shared with sudo-allowlist.ts, so a\n * path the sudo runner may touch as root obeys exactly the rule a declared file does.\n */\nexport const pathProblems = (path: string): string[] => {\n const found: string[] = [];\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 return found;\n};\n\nexport const fileProblems = (props: HostFileProps): string[] => {\n const found = pathProblems(props.path);\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",
7
+ "/**\n * Release.Binary's props, attributes and validation — the pure half of the provider.\n *\n * ★ THE PINNED ARCHIVE IS A PROP, NOT A LOOKUP. Repository, tag, exact asset name, size, the\n * archive's SHA-256, the member and the member's SHA-256 all arrive as props — usually spread from\n * a vendor data set (victoria.ts) by `catalogBinary()`. So the resource knows no vendor at all: a\n * second vendor is a second data module, never a change here, and the resource is the shape\n * Alchemy could accept (docs/release-binary-upstream.md).\n * ⛔ NOTHING ESTATE-SPECIFIC IS A CONSTANT HERE. The install directory, owner, group and mode are\n * the consuming stack's props. A stack that keeps binaries under `/opt/<estate>/obs/bin` says so\n * in its own code.\n * ⛔ EVERY PIN IS REQUIRED, AND WELL-FORMED OR REFUSED. There is no \"latest\", no optional digest and\n * no fallback to a checksum file fetched at apply — see victoria.ts for why a pin beats a fetch.\n */\nimport type { HostFileAttributes } from '../launchd/host-file-form.ts';\nimport { identityProblems, pathProblems } from '../launchd/host-file-form.ts';\n\n/** One release archive, pinned: where it is published, and the bytes it must be. */\nexport interface ReleaseArchive {\n /** The GitHub repository that publishes it, `owner/name`: `'VictoriaMetrics/VictoriaMetrics'`. */\n readonly repo: string;\n /** The release tag, exactly as published: `'v1.151.0'`. */\n readonly tag: string;\n /**\n * The asset's file name, whole: `'vmutils-darwin-arm64-v1.151.0.tar.gz'`. ⛔ Never a prefix or a\n * pattern — `-enterprise` and `-cluster` siblings share every prefix with it.\n */\n readonly asset: string;\n /** Bytes, per the release API. A download that runs past this is cut off and refused. */\n readonly size: number;\n /** The archive's SHA-256, lower-case hex, as the vendor's checksum file lists it. */\n readonly sha256: string;\n}\n\nexport interface ReleaseBinaryProps {\n /** The pinned archive the binary comes out of. `catalogBinary()` fills it from a data set. */\n archive: ReleaseArchive;\n /** The archive member to extract, by its exact name: `'vmalert-prod'`. Nothing else is unpacked. */\n member: string;\n /** The member's own SHA-256 — what the installed file must hash to. */\n sha256: string;\n /**\n * The installed file name: `'vmalert'`. ★ Separate from `member` on purpose — VictoriaMetrics\n * names every member `<binary>-prod`, and a job's argv[0] should not carry that.\n */\n name: string;\n /**\n * The directory the binary is written into. ⛔ It must already exist — declare it with\n * `HostDirectory` and pass that resource's `path`, which also orders it first. ★ Give each\n * version its own directory (`catalogDirectory()`): an upgrade is then a new path — a\n * create-before-delete replace, never an overwrite under a running daemon — and a rollback is a\n * path. A new pin at the SAME path is refused (binary-diff.ts).\n */\n directory: string;\n /**\n * Permission bits. ⛔ Owner-readable and -executable, never group- or world-writable, never\n * setuid, setgid or sticky — a writable binary is whoever-can-write's code, run as whoever runs\n * the daemon. Its directory must not be group- or world-writable either (binary-lifecycle.ts).\n * @default 0o755\n */\n mode?: number;\n /** User name or numeric uid. Omitted: whoever the runner writes as. */\n owner?: string | number;\n /** Group name or numeric gid. Omitted: the directory's default group. */\n group?: string | number;\n}\n\nexport interface ReleaseBinaryAttributes extends HostFileAttributes {\n /** The archive the bytes came from, whole. */\n url: string;\n /** The archive member installed, by its exact name: `vmalert-prod`. */\n member: string;\n}\n\n/** Everything a download and its two checks need: one archive, one member, both digests. */\nexport type PinnedDownload = {\n readonly url: string;\n readonly size: number;\n /** The archive's pinned SHA-256. */\n readonly sha256: string;\n /** The archive member to extract, by exact name. */\n readonly member: string;\n /** The member's pinned SHA-256. */\n readonly memberSha256: string;\n};\n\nexport const DEFAULT_BINARY_MODE = 0o755;\n\n/**\n * The release-asset URL. ★ GITHUB'S DOWNLOAD PATH, NOT THE API: it needs no token and spends no rate\n * limit (it redirects to a signed CDN URL — measured 2026-09-22 with HEAD). Every consumer the\n * estate census found publishes on GitHub except Grafana (grafana.com), which is not a\n * single-binary consumer anyway (docs/release-binary-catalogs.md). A second source kind arrives\n * with its first consumer, not before.\n */\nexport const releaseUrl = (repo: string, tag: string, asset: string): string =>\n `https://github.com/${repo}/releases/download/${tag}/${asset}`;\n\n/** Where a declaration puts its binary: `<directory>/<name>`. */\nexport const releaseBinaryPath = (props: {\n readonly directory: string;\n readonly name: string;\n}): string => `${props.directory}/${props.name}`;\n\n/** The download a declaration means. ⚠️ Validate first (binaryProblems): this trusts its input. */\nexport const pinnedDownload = (props: ReleaseBinaryProps): PinnedDownload => ({\n member: props.member,\n memberSha256: props.sha256,\n sha256: props.archive.sha256,\n size: props.archive.size,\n url: releaseUrl(props.archive.repo, props.archive.tag, props.archive.asset),\n});\n\nexport const modeProblems = (mode: number): string[] => {\n if (!Number.isSafeInteger(mode) || mode < 0 || mode > 0o7777) return ['mode must be 0–0o7777'];\n const found: string[] = [];\n if ((mode & 0o7000) !== 0) found.push('mode must not set setuid, setgid or sticky');\n if ((mode & 0o022) !== 0) found.push('mode must not be group- or world-writable');\n if ((mode & 0o100) === 0) found.push('mode must let the owner execute it');\n // ⛔ AND READ IT: every plan re-hashes the binary, and a write is read back. MEASURED 2026-09-22,\n // an execute-only 0111 written by a non-root operator failed its read-back with EACCES.\n if ((mode & 0o400) === 0) found.push('mode must let the owner read it (it is re-hashed)');\n return found;\n};\n\nconst HEX64 = /^[0-9a-f]{64}$/;\nexport const MAX_ARCHIVE = 1 << 30;\n// ⛔ Strict on purpose: each is written into a URL or a path. GitHub's own owner and name alphabet.\nconst REPO = /^[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\\/[A-Za-z0-9._-]+$/;\nconst SEGMENT = /^[A-Za-z0-9._-]+$/;\n// ★ ONLY WHAT THE READER HANDLES: a gzipped tar. A `.zip` or a bare binary is a new capability\n// with its own walk-down, not a name this should accept and then fail to unpack.\nconst TARBALL = /\\.(tar\\.gz|tgz)$/;\n\n/** A single path segment that cannot climb, hide or name the directory itself. */\nconst segmentProblem = (what: string, value: string): string | undefined =>\n !SEGMENT.test(value) || value === '.' || value === '..'\n ? `${what} must be one path segment of letters, digits, '.', '_' or '-': ${JSON.stringify(value)}`\n : undefined;\n\n/** Everything wrong with the pins alone — plain strings in any declaration, resolved or not. */\nexport const pinProblems = (props: {\n readonly archive?: Partial<ReleaseArchive>;\n readonly member?: unknown;\n readonly sha256?: unknown;\n readonly name?: unknown;\n}): string[] => {\n const archive = props.archive ?? {};\n const found: string[] = [];\n const text = (what: string, value: unknown): string | undefined => {\n if (typeof value === 'string') return value;\n found.push(`${what} is required, as a plain string`);\n return undefined;\n };\n const repo = text('archive.repo', archive.repo);\n // ⚠️ `owner/..` passes the alphabet, and a URL parser normalises it away: the request would go\n // to `github.com/releases/…`, somewhere nobody pinned. Refused by name.\n const repoName = repo?.slice(repo.indexOf('/') + 1);\n if (repo !== undefined && (!REPO.test(repo) || repoName === '.' || repoName === '..'))\n found.push(`archive.repo must be \"owner/name\": ${JSON.stringify(repo)}`);\n for (const [what, value] of [\n ['archive.tag', archive.tag],\n ['name', props.name],\n ] as const) {\n const given = text(what, value);\n const problem = given === undefined ? undefined : segmentProblem(what, given);\n if (problem !== undefined) found.push(problem);\n }\n const asset = text('archive.asset', archive.asset);\n if (asset !== undefined) {\n const problem = segmentProblem('archive.asset', asset);\n if (problem !== undefined) found.push(problem);\n else if (!TARBALL.test(asset))\n found.push(`archive.asset must be a .tar.gz or .tgz: \"${asset}\"`);\n }\n // ⛔ THE SIZE IS ALLOCATED UP FRONT (download.ts fills one buffer of exactly this many bytes), so\n // a typo'd size is a memory bomb in the deploying process. vmutils, the largest archive pinned,\n // is 123.6 MB; a gibibyte is a ceiling nothing single-binary should reach.\n const size = archive.size;\n if (typeof size !== 'number' || !Number.isSafeInteger(size) || size <= 0 || size > MAX_ARCHIVE) {\n found.push(`archive.size must be the asset's byte count, 1 to ${String(MAX_ARCHIVE)}`);\n }\n for (const [what, value] of [\n ['archive.sha256', archive.sha256],\n ['sha256', props.sha256],\n ] as const) {\n const given = text(what, value);\n if (given !== undefined && !HEX64.test(given))\n found.push(`${what} must be 64 lower-case hex digits`);\n }\n const member = text('member', props.member);\n // ⛔ The tar reader refuses these entries anyway; asking for one is a mistake to name at plan.\n if (\n member !== undefined &&\n (member === '' || member.startsWith('/') || member.split('/').includes('..'))\n ) {\n found.push(`member must be a relative name inside the archive: ${JSON.stringify(member)}`);\n }\n return found;\n};\n\nconst ARCHIVE_KEYS = ['repo', 'tag', 'asset', 'size', 'sha256'] as const;\n\ntype Pins = Pick<ReleaseBinaryProps, 'archive' | 'member' | 'sha256'>;\n\n/** Whether two declarations pin different bytes: another archive, member or member digest. */\nexport const pinsMoved = (olds: Pins, news: Pins): boolean =>\n olds.member !== news.member ||\n olds.sha256 !== news.sha256 ||\n ARCHIVE_KEYS.some((key) => olds.archive[key] !== news.archive[key]);\n\n/**\n * ⛔ A NEW PIN IS A NEW PATH. The same path with other bytes would overwrite a binary under the\n * daemon running it, and leave no rollback but a re-download — so it is refused, at plan when the\n * path is resolved (binary-diff.ts) and at apply otherwise (binary-lifecycle.ts).\n */\nexport const inPlaceRefusal = (olds: Pins, news: Pins): string =>\n `a new pin (${news.archive.tag} ${news.member} ${news.sha256}) at the path of the installed ` +\n `one (${olds.archive.tag} ${olds.member} ${olds.sha256}) would overwrite it in place; give each ` +\n 'version its own directory (catalogDirectory), so an upgrade is a new path';\n\n/** Everything wrong with a declaration, before any host or network is asked anything. */\nexport const binaryProblems = (props: ReleaseBinaryProps): string[] => [\n ...pinProblems(props),\n ...pathProblems(props.directory).map((problem) => `directory: ${problem}`),\n ...modeProblems(props.mode ?? DEFAULT_BINARY_MODE),\n ...identityProblems('owner', props.owner),\n ...identityProblems('group', props.group),\n];\n",
8
+ "/**\n * `Release.Binary` — one binary out of a pinned release archive, written onto a host and verified\n * twice: the archive against its pinned SHA-256, then the binary against its own.\n *\n * - reconcile — validate every prop; download the archive by its exact URL; verify it; unpack ONLY\n * the declared member; verify that; write it atomically through the HostRunner; read it back. A\n * file already holding the pinned bytes is never downloaded again.\n * - read — lstat plus the SHA-256 of the bytes; never runs the binary.\n * - diff — the pins, the path, then mode and owner against the live file (binary-diff.ts).\n * - replace — when the path moves (a new version is a new directory): create-before-delete.\n * - delete — removes the file, never the directory.\n *\n * ★ VENDOR-NEUTRAL. The pinned archive arrives as props, usually from a data set beside this\n * (victoria.ts) through `catalogBinary()`; nothing here knows a vendor, a package or a version.\n * ⛔ IT INSTALLS; IT NEVER STARTS. No launchctl, no systemctl, no restart: the job that runs the\n * binary is the stack's own `LaunchdJob`, which puts this resource's `path` in its argv so the\n * engine installs first and restarts the job when the path moves.\n * ⚠️ NOTHING IS ADOPTED WITHOUT `--adopt`, AT PLAN OR AT APPLY: the probe reads a file already at\n * the path as `Unowned` — even one holding exactly the pinned bytes (docs/ownership.md) — and\n * where the probe never ran (a prop was an Output) reconcile refuses it the same way. With\n * `--adopt`, a file holding the pinned bytes is recognised by its digest and taken over without\n * a download. ⛔ A file with OTHER bytes is never adopted, `--adopt` or not: that would be an\n * overwrite in place that the plan prints as `adopted` (binary-claim.ts, both halves).\n */\nimport { Resource } from 'alchemy';\nimport * as Provider from 'alchemy/Provider';\nimport * as Effect from 'effect/Effect';\nimport * as HttpClient from 'effect/unstable/http/HttpClient';\nimport { lift } from '../launchd/host-effect.ts';\nimport { HostRunnerService } from '../launchd/runner.ts';\nimport { adoptsAtApply } from '../ownership/adopt.ts';\nimport { noteUnfinished } from '../ownership/resume.ts';\nimport { diffBinary } from './binary-diff.ts';\nimport {\n type ReleaseBinaryAttributes,\n type ReleaseBinaryProps,\n releaseBinaryPath,\n} from './binary-form.ts';\nimport {\n NOTHING,\n deleteBinary,\n reconcileBinary,\n refreshBinary,\n refuse,\n} from './binary-lifecycle.ts';\nimport { readWithoutState } from './binary-read.ts';\nimport { declaredPinProblems } from './declared-pins.ts';\nimport { type DownloadPolicy, httpFetchArchive, sharingInFlight } from './download.ts';\n\nexport type { ReleaseBinaryAttributes, ReleaseBinaryProps } from './binary-form.ts';\n\nexport interface ReleaseBinary extends Resource<\n 'Release.Binary',\n ReleaseBinaryProps,\n ReleaseBinaryAttributes\n> {}\n\n/**\n * One binary from a pinned release archive, installed onto a host and verified against digests\n * the stack pins in code — the archive's, then the binary's own.\n *\n * ### Installing a binary\n *\n * The directory is declared first and passed by its `path`, which orders the two; the job that\n * runs the binary references the binary's `path`, which orders the job after it.\n *\n * **Example:**\n *\n * ```ts\n * const vmalertOf = { package: 'vmutils', version: '1.151.0', platform: 'darwin-arm64', binary: 'vmalert' };\n * const dir = yield* HostDirectory('vmutils-1.151.0', {\n * path: catalogDirectory('/opt/example/bin', vmalertOf),\n * mode: 0o755,\n * });\n * const vmalert = yield* ReleaseBinary('vmalert', {\n * ...catalogBinary(VICTORIA_RELEASES, vmalertOf),\n * directory: dir.path,\n * });\n * // LaunchdJob(…, { programArguments: [vmalert.path, '--httpListenAddr=127.0.0.1:8880'] })\n * ```\n *\n * @resource\n */\nexport const ReleaseBinary = Resource<ReleaseBinary>('Release.Binary');\n\n/** Test seams — NOT on the barrel. Every caller outside tests uses the defaults. */\nexport type ReleaseBinaryInternals = { readonly download?: DownloadPolicy };\n\nexport const makeReleaseBinaryProvider = (internals: ReleaseBinaryInternals = {}) =>\n Provider.effect(\n ReleaseBinary,\n Effect.gen(function* () {\n const runner = yield* HostRunnerService;\n const client = yield* HttpClient.HttpClient;\n const fetch = sharingInFlight(httpFetchArchive(client, internals.download));\n /**\n * ⛔ ONE PATH, ONE DECLARATION. MEASURED 2026-09-22 (binary-claims.test.ts, before this): two\n * resources installing one path in one deploy both planned `create`, shared one download,\n * and both recorded the file as theirs. Dropping either later — gating vmalert-logs off\n * along with its own ReleaseBinary, say — deleted the file the other still declared, and\n * that deploy reported the survivor `noop`. So a second resource claiming a path in the\n * same run is refused before it touches anything. Two jobs that run one binary share ONE\n * ReleaseBinary. ⚠️ Keyed by spelling: one file under two spellings is not caught here.\n */\n const claims = new Map<string, string>();\n const claim = (fqn: string, props: ReleaseBinaryProps): void => {\n const path = releaseBinaryPath(props);\n const holder = claims.get(path);\n if (holder !== undefined && holder !== fqn) {\n throw refuse(\n path,\n `is already installed by ${holder} in this deploy; declare each binary path once, ` +\n `and let every job that runs it share that one resource. ${NOTHING}`,\n );\n }\n claims.set(path, fqn);\n };\n return ReleaseBinary.Provider.of({\n list: () => Effect.succeed([]),\n\n // ⛔ The probe (no `output`) validates every prop first, so a malformed pin fails the plan\n // here — before any host call, let alone a download. A recovery read never fails its\n // caller (binary-read.ts): its props are the failed deploy's.\n read: ({ fqn, instanceId, olds, output }) =>\n output === undefined\n ? readWithoutState(runner, { fqn, instanceId, olds })\n : lift(() => refreshBinary(runner, output)),\n\n diff: ({ instanceId, news, olds, output }) =>\n output === undefined\n ? noteUnfinished(instanceId)\n : lift(() => diffBinary(runner, news, olds, output)),\n\n // ★ `--adopt` reaches the apply too: the probe never ran for a create with an Output prop.\n // ⛔ So do the pins AS DECLARED: `news` is resolved by now, and a first deploy is never\n // diffed, so only the stack's own record can show a digest that was an Output.\n reconcile: ({ fqn, instanceId, news, olds, output, session }) =>\n Effect.gen(function* () {\n const declared = yield* declaredPinProblems(fqn);\n const adopt = yield* adoptsAtApply({ fqn, instanceId, output });\n return yield* lift(async () => {\n claim(fqn, news);\n return reconcileBinary(runner, fetch, news, {\n adopt,\n declared,\n note: (message) => Effect.runPromise(session.note(message)),\n olds,\n output,\n });\n });\n }),\n\n /**\n * ⛔ NEVER REMOVE A FILE ANOTHER DECLARATION INSTALLED IN THIS DEPLOY. Alchemy runs every\n * delete (Apply.ts collectGarbage, Phase 2) only after every reconcile has succeeded, so a\n * claim by another name means the file is that resource's now, verified as its pin.\n * 🔴 MEASURED 2026-09-22 (adopt-parity.test.ts): a rename under --adopt — the new name\n * claimed the file, the old name's orphan delete removed it, and the deploy succeeded\n * with the binary gone. ★ Left in place rather than removed: a stray file is a tidy-up, a\n * missing binary is an outage. ⚠️ Keyed by spelling, like the claims themselves.\n * ★ A deleted resource gives its claim back, so a provider that outlives one deploy never\n * refuses the next resource declared at that path.\n */\n delete: ({ fqn, output, session }) =>\n lift(async () => {\n const holder = claims.get(output.path);\n if (holder !== undefined && holder !== fqn) {\n await Effect.runPromise(\n session.note(`${output.path} was installed by ${holder} in this deploy; kept`),\n );\n return;\n }\n await deleteBinary(runner, output);\n if (holder === fqn) claims.delete(output.path);\n }),\n });\n }),\n );\n\n/** The provider, as a stack uses it. It needs a HostRunnerService and an HttpClient. */\nexport const ReleaseBinaryProvider = () => makeReleaseBinaryProvider();\n",
9
+ "/**\n * The one place a HostRunner's promises become Effects — plus the one probe of an unresolved\n * `news` both providers' diffs share. (The engine's adopt setting lives in ownership/adopt.ts.)\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",
10
+ "/**\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 * The entry's identity, device and inode, when the runner can say. ★ Two spellings of ONE file\n * (`/tmp/x` and `/private/tmp/x`; `Bin` and `bin` on case-insensitive APFS) differ as strings\n * and match here, and a move must not delete its old path when that path IS the new file\n * (file-identity.ts). Optional: a runner that leaves them out gets a check after the fact.\n */\n readonly dev?: number;\n readonly ino?: number;\n};\n\nexport type WriteOptions = {\n /**\n * Permission bits for the final file. localRunner applies them BEFORE the file is visible at\n * `path`. ⚠️ sudoRunner's `install -S` does NOT: MEASURED 2026-09-22 on macOS 27.2 (an lstat\n * poller racing /usr/bin/install), the new inode appears at `path` as 0600 and is chmodded\n * 0.2–0.4 ms later. Never torn, never wider than declared, but briefly not executable.\n */\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 this runner can do every root-needing call the\n * providers make of it: every call already runs as root (a runner that talks to a root helper,\n * say), or the runner elevates exactly those calls (sudoRunner). 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 SILENTLY. localRunner() never calls `sudo`: a deploy that prompts for\n * a password mid-plan, or quietly borrows a cached sudo ticket, is exactly the \"no silent sudo\"\n * failure. sudoRunner() does call `sudo -n`, but only when a stack passes it explicitly, only\n * for the argv shapes in sudo-allowlist.ts, and logging each one (decided 2026-09-21).\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 * (sudoRunner: the mode just after the rename, measured — see WriteOptions.mode; the owner too,\n * ⚠️ REASONED NOT MEASURED, since measuring it needs root).\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 /**\n * PLAN TIME: refuse, reading only and writing nothing, a write this runner would refuse at\n * apply — so the plan shows it before any resource is applied. Optional: a runner without it\n * refuses at the write. ★ sudoRunner implements it with the checks it makes before `sudo -n`;\n * ⛔ it never elevates, so a plan still never calls sudo.\n */\n checkWrite?(path: string, 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",
11
+ "/**\n * Whether a live object this stack holds no state for may be written — the apply-time half of the\n * house rule that NOTHING IS ADOPTED WITHOUT `--adopt` (decided 2026-09-21 for HostFile, LaunchdJob,\n * CaddyConfig and every Bao.* family). probe.ts is the plan-time half.\n *\n * ★ FAMILY-NEUTRAL ON PURPOSE. The engine questions here — what `--adopt` resolves to for one FQN,\n * whether this apply resumes the resource's own interrupted create — are the same for a vault\n * role, a launchd plist and a Caddy config, so they live once, outside every subpath's directory.\n */\nimport { AdoptPolicy } from 'alchemy/AdoptPolicy';\nimport { AlchemyContext } from 'alchemy/AlchemyContext';\nimport { Stack } from 'alchemy/Stack';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport { resumes, unfinished } from './resume.ts';\nimport { forgetRefusedCreate, isCreate } from './rows.ts';\n\n/**\n * Whether the resource at `fqn` may be adopted, resolved exactly as the planner resolves it (alchemy\n * beta.79 Plan.ts: `resource.Adopt ?? shouldAdopt`): a resource-scoped `adopt(…)`, else the\n * `AdoptPolicy` service, else `AlchemyContext.adopt`, else off.\n * ★ FOR A CREATE THE ENGINE NEVER PROBED. Alchemy skips the adoption probe while `news` holds an\n * Output, so an ownership check that must still honour `--adopt` can only run at apply. All three\n * reach the apply: Alchemist runs plan AND apply under the session context, which provides the\n * services from the CLI flag and the Stack the resources registered on (Alchemist/Session.ts,\n * routes/stack.ts; Apply.ts reads the same Stack).\n * ⛔ THE RESOURCE-SCOPED SETTING WINS, BOTH WAYS. The engine captures `adopt(…)` on the resource at\n * registration (Resource.ts `Adopt`, into `Stack.resources[fqn]`) and never hands it to a\n * provider. Reading only the deploy-wide flag let `--adopt` take over a resource declared\n * `.pipe(adopt(false))` — which the planner refuses — and refused one declared `adopt(true)`.\n * ⚠️ `resources` carries an `@internal` comment in Alchemy's source, but it is in the published types\n * and the planner reads `Adopt` from it. caddy/adopt-scope.test.ts registers through the real\n * `Resource`, so an upgrade that stops recording it there fails the suite.\n */\nexport const adoptEnabled = (fqn: string): Effect.Effect<boolean> =>\n Effect.gen(function* () {\n const stack = yield* Effect.serviceOption(Stack);\n const scoped = Option.isSome(stack) ? stack.value.resources[fqn]?.Adopt : undefined;\n if (scoped !== undefined) return scoped;\n const policy = yield* Effect.serviceOption(AdoptPolicy);\n if (Option.isSome(policy)) return policy.value;\n const context = yield* Effect.serviceOption(AlchemyContext);\n return Option.isSome(context) ? context.value.adopt : false;\n });\n\n/** The three fields of a `reconcile` (or `read`) call that say whose object this is. */\nexport type Owner = {\n readonly fqn: string;\n readonly instanceId: string;\n /** The attributes state holds; `undefined` on a create. */\n readonly output: unknown;\n};\n\n/**\n * Whether `--adopt` may speak for this apply's generation: a CREATE (rows.ts isCreate), or an\n * UNFINISHED generation whose row this plan's diff saw with no attributes (resume.ts) — the\n * resume Alchemy itself offers `--adopt` for (\"Cannot resume creating … Re-run with --adopt\").\n * ⛔ NOT A FRESH REPLACE'S NEW GENERATION. The planner never probes it and never offers it adoption,\n * so the identity it moves to was never asked about under `--adopt`: 🔴 MEASURED 2026-09-21\n * (launchd/adopt-apply.test.ts), a HostFile whose path changed onto a file it did not own\n * overwrote that file under a deploy-wide `--adopt` meant for something else. A Bao rename onto a\n * taken identity already fails the plan, `--adopt` or not (rename.ts judgeMove); this keeps the\n * apply to the same answer.\n */\nconst adoptable = (owner: Owner): Effect.Effect<boolean> =>\n Effect.gen(function* () {\n if (yield* isCreate(owner.fqn, owner.instanceId)) return true;\n return yield* unfinished(owner.instanceId);\n });\n\n/** Whether a stateless `reconcile` may take over a live object: adoption on, for an adoptable one. */\nexport const adoptsAtApply = (owner: Owner): Effect.Effect<boolean> =>\n Effect.gen(function* () {\n if (!(yield* adoptEnabled(owner.fqn))) return false;\n return yield* adoptable(owner);\n });\n\n/** A lifecycle helper's hook for refuseTakeover, bound to one call's Owner: `(what) => …`. */\nexport type Claim = (what: string) => Effect.Effect<void>;\n\n/**\n * `reconcile`'s check, called with the live object it found BEFORE any write: dies unless that\n * object may be written. It may when state already vouches for it (`output`), when this apply\n * resumes the resource's own interrupted create or replace and its diff proved the object that\n * generation's (resume.ts), or when adoption is on for a create or an unfinished generation\n * (adoptable).\n * ⛔ WHY IT EXISTS AT ALL: THE PROBE DOES NOT GUARD EVERY CREATE. Alchemy skips it while `news` holds\n * an Output (Plan.ts), a new generation of a replace is never probed, and an object can appear\n * between plan and apply. Each of those used to be a silent takeover: written over, then recorded\n * as ours, and deleted with the stack under `destroy`.\n * ⚠️ A CHECK, THEN A WRITE — NOT A LOCK. Two creates of one name in the same deploy run\n * concurrently, both read nothing, and both write (measured with the fakes, 2026-09-21). Nothing\n * between a read and a write can close that; declare each name once.\n * ⚠️ AN IDENTICAL OBJECT IS STILL A TAKEOVER (decided 2026-09-21). Nothing would be written, but the\n * state row would claim it, and a later delete would remove what another owner still relies on.\n * ⛔ A REFUSED CREATE FORGETS ITS `creating` ROW (rows.ts forgetRefusedCreate), or the next plan's\n * recovery read would adopt the very object this refused.\n */\nexport const refuseTakeover = (owner: Owner, what: string): Effect.Effect<void> =>\n Effect.gen(function* () {\n if (owner.output !== undefined) return;\n if (yield* resumes(owner.instanceId)) return;\n const may = yield* adoptable(owner);\n if (may && (yield* adoptEnabled(owner.fqn))) return;\n yield* forgetRefusedCreate(owner.fqn, owner.instanceId);\n const remedy = may\n ? 'Deploy with --adopt (or wrap the resource in adopt(true)) to take it over, or remove it first.'\n : 'It is the new identity of a replace, which --adopt does not cover: remove it first.';\n return yield* Effect.die(\n new Error(\n `${what}: already exists, and this stack holds no state for it — the plan could not ask ` +\n 'first (a prop was still an Output, a replace moved onto it, or it appeared after the ' +\n `plan). Nothing was written. ${remedy}`,\n ),\n );\n });\n\n/** refuseTakeover bound to one call's Owner, for a lifecycle helper that finds the live object. */\nexport const claimFor =\n (owner: Owner): Claim =>\n (what) =>\n refuseTakeover(owner, what);\n",
12
+ "/**\n * Whether this apply RESUMES a create or replace the engine already started for this resource AND\n * the live object it will find is proven that generation's own — the one case in which a stateless\n * `reconcile` may write over a live object without `--adopt`.\n *\n * ★ HOW THE ENGINE TELLS US. Alchemy calls `diff` whenever a state row exists, and hands it `output`\n * = that row's attributes (alchemy beta.79 Plan.ts). A row with NO attributes is exactly an\n * unfinished generation: `creating` (a create interrupted after its write, before its commit),\n * `replacing` (the same for a replace), or `deleting` re-driven as a create. A fresh create is\n * never diffed at all. So the diff of such a row decides, and the apply that follows (the same\n * instance id: Apply.ts reuses the row's) finds the note.\n * ⛔ A ROW PROVES NOTHING BY ITSELF (red team, 2026-09-21). Apply commits it BEFORE reconcile runs, so\n * a deploy killed before the claim — an upstream that failed, a Ctrl-C — leaves a row whose create\n * never asked whose object sat at its identity. 🔴 MEASURED (openbao/adopt-holes.test.ts): with the\n * name an Output, the next deploy \"resumed\" that create and wrote over another owner's role, in\n * every family that had a note on the row alone. So the note is left only when the family's own\n * `read`, asked as the recovery read (probe.ts ownedRead: a recorded instance, a row carrying the\n * whole declaration, and a live object that matches it), answers \"ours\". For a `creating` row\n * that is the question Plan.ts already asked; for a `replacing` row it is the only time it is asked.\n * ⚠️ WHY NOT THE STATE STORE ALONE. At reconcile both look the same: Apply commits the fresh create's\n * `creating` row before calling reconcile, so a row with this instance id is always there.\n * ★ THE CHANNEL IS ALCHEMY'S OWN: `Artifacts`, the per-FQN bag the engine shares between one plan\n * and its apply (Artifacts.ts: \"diff computes … create / update reads the same artifact\").\n * Deploy.ts and the Alchemist session both hold one store across the pair.\n * ⚠️ IT FAILS CLOSED. No bag, a bag the plan never wrote, or an object the read cannot prove ours\n * reads as a fresh create, and adopt.ts then asks for `--adopt` — the safe direction.\n * ★ AN UNPROVEN RESUME IS STILL MARKED UNFINISHED (`noteUnfinished`), so `--adopt` can take it over\n * the way Alchemy's own \"Cannot resume creating … Re-run with --adopt\" offers for a create — while\n * a FRESH replace's new generation, which no diff ever saw without attributes, stays unadoptable.\n */\nimport { Unowned } from 'alchemy/AdoptPolicy';\nimport { Artifacts } from 'alchemy/Artifacts';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nconst PROVEN = 'homeflare/ownership/resumes';\nconst UNFINISHED = 'homeflare/ownership/unfinished';\n\nconst note = (key: string, instanceId: string): Effect.Effect<void> =>\n Effect.gen(function* () {\n const bag = yield* Effect.serviceOption(Artifacts);\n if (Option.isSome(bag)) yield* bag.value.set(key, instanceId);\n });\n\nconst noted = (key: string, instanceId: string): Effect.Effect<boolean> =>\n Effect.gen(function* () {\n const bag = yield* Effect.serviceOption(Artifacts);\n if (Option.isNone(bag)) return false;\n return (yield* bag.value.get<string>(key)) === instanceId;\n });\n\n/**\n * `diff`'s note for a row with no attributes: `instanceId` is an unfinished generation of this\n * resource's own, which `--adopt` may resume when nothing proves it (adopt.ts adoptable). Returns\n * `undefined`, a diff's \"defer to the engine\".\n */\nexport const noteUnfinished = (instanceId: string): Effect.Effect<undefined> =>\n Effect.as(note(UNFINISHED, instanceId), undefined);\n\n/**\n * Note `instanceId` unfinished, and a proven resume when `recovered` — the family's `read` of the\n * row's props, asked with no attributes — answers a plain object: ours. `Unowned`, nothing, or a\n * read that fails or dies proves nothing. ⚠️ Never fails the plan: an unproven resume is refused\n * at apply instead, unless `--adopt`.\n */\nexport const noteResume = <R>(\n instanceId: string,\n recovered: Effect.Effect<unknown, unknown, R>,\n): Effect.Effect<void, never, R> =>\n Effect.gen(function* () {\n yield* noteUnfinished(instanceId);\n const unproven = () => Effect.succeed(undefined);\n const found = yield* recovered.pipe(Effect.catch(unproven), Effect.catchDefect(unproven));\n if (found === undefined || found === null || Unowned.is(found)) return;\n yield* note(PROVEN, instanceId);\n });\n\n/** Whether the plan for this apply noted `instanceId` as a proven resumed create or replace. */\nexport const resumes = (instanceId: string): Effect.Effect<boolean> => noted(PROVEN, instanceId);\n\n/** Whether the plan for this apply saw `instanceId` as an unfinished generation (proven or not). */\nexport const unfinished = (instanceId: string): Effect.Effect<boolean> =>\n noted(UNFINISHED, instanceId);\n\n/** The fields of a `read` or `diff` call provingResumes uses; a family's own input carries more. */\ntype Ask = {\n readonly id: string;\n readonly fqn: string;\n readonly instanceId: string;\n readonly olds: unknown;\n readonly output: unknown;\n};\ntype Hook = Effect.Effect<unknown, unknown, unknown>;\n\n/** The two hooks provingResumes wraps, as Alchemy's ProviderService declares them. */\ninterface Resumable {\n read?(input: Ask): Hook;\n diff?(input: Ask): Hook;\n}\n\n/**\n * A provider whose `diff`, for a row with no attributes, first asks the provider's own `read` whether\n * the live object is that unfinished generation's (noteResume), then runs as written. Every Bao.*\n * family is built through it, so their diffs answer such a row with a plain `undefined`.\n */\nexport const provingResumes = <S extends Resumable>(service: S): S => {\n const { diff, read } = service;\n if (diff === undefined || read === undefined) return service;\n const proving: Resumable['diff'] = (input) =>\n Effect.gen(function* () {\n if (input.output === undefined) {\n yield* noteResume(input.instanceId, read({ ...input, output: undefined }));\n }\n return yield* diff(input);\n });\n // ⚠️ The one cast: `diff` keeps the family's own signature — it is the family's diff, run after.\n return { ...service, diff: proving } as S;\n};\n",
13
+ "/**\n * The questions ownership/ asks of Alchemy's state store: does a row record this instance, and with\n * its whole declaration (probe.ts); is this apply a create rather than a replace's new generation\n * (adopt.ts); and — when reconcile refuses a create — forget the row Apply committed for it\n * (adopt.ts). Alchemy's own AWS.EC2.SecurityGroup provider reads the store the same way: the Stack\n * service names the stack and stage, and `State` yields the store.\n *\n * ⚠️ WITHOUT A STACK OR STATE IN CONTEXT, or with a store that errors, a row reads as \"not\n * recorded\" — the object is then `Unowned`, the safe answer — and nothing is forgotten, which\n * leaves the one gap forgetRefusedCreate exists to close. `alchemy deploy` and the Alchemist\n * session provide both.\n */\nimport { Stack } from 'alchemy/Stack';\nimport { State, type StateService, isActionState } from 'alchemy/State/State';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport { wholeDeclaration } from './whole.ts';\n\ntype Where = { readonly stack: string; readonly stage: string };\n\n/** The store, where this stack lives, and what it declares — or undefined outside a stack. */\nconst storeOf = Effect.gen(function* () {\n const stack = yield* Effect.serviceOption(Stack);\n const state = yield* Effect.serviceOption(State);\n if (Option.isNone(stack) || Option.isNone(state)) return undefined;\n const store: StateService = yield* state.value;\n const where: Where = { stack: stack.value.name, stage: stack.value.stage };\n return { resources: stack.value.resources, store, where };\n});\n\nconst rowAt = (store: StateService, where: Where, fqn: string) =>\n store.get({ ...where, fqn }).pipe(Effect.orElseSucceed(() => undefined));\n\n/** One generation of a persisted row, as far as ownership/ reads it. */\nexport type Generation = {\n readonly instanceId?: unknown;\n readonly status?: unknown;\n readonly props?: unknown;\n readonly attr?: unknown;\n readonly old?: unknown;\n /** Set by Apply on the `updating` row of an adoption, until that update commits (Apply.ts). */\n readonly adopting?: unknown;\n};\n\n/** The generation of a persisted row that carries `instanceId`: the row itself, or one in `old`. */\nconst generationOf = (row: unknown, instanceId: string): Generation | undefined => {\n let at = row;\n while (typeof at === 'object' && at !== null && !isActionState(at as never)) {\n const generation = at as Generation;\n if (generation.instanceId === instanceId) return generation;\n at = generation.old;\n }\n return undefined;\n};\n\n/** The generation `instanceId` names — at the FQN, or at a former FQN `renamedFrom` names. */\nexport const recordedGeneration = (\n fqn: string,\n instanceId: string,\n): Effect.Effect<Generation | undefined> =>\n Effect.gen(function* () {\n const found = yield* storeOf;\n if (found === undefined) return undefined;\n for (const at of [fqn, ...(found.resources[fqn]?.FormerFqns ?? [])]) {\n const generation = generationOf(yield* rowAt(found.store, found.where, at), instanceId);\n if (generation !== undefined) return generation;\n }\n return undefined;\n });\n\n/**\n * What the state store says of `instanceId` for this resource (at its FQN, or at a former FQN its\n * `renamedFrom` names — the planner migrates that row before it recovers it):\n * · `absent` — no row holds it. ★ This is what separates the probe from the recovery read: the\n * probe's instance id is minted for the probe (Plan.ts `generateInstanceId()`), 128 random bits\n * no row can hold.\n * · `partial` — a row holds it, but its props lack part of the declaration: a prop stripped at\n * commit because it was still an Output (whole.ts). Those props cannot prove an object ours.\n * · `whole` — a row holds it with every prop the declaration names.\n */\nexport type Recorded = 'absent' | 'partial' | 'whole';\n\nexport const recordedInstance = (fqn: string, instanceId: string): Effect.Effect<Recorded> =>\n Effect.gen(function* () {\n const generation = yield* recordedGeneration(fqn, instanceId);\n if (generation === undefined) return 'absent';\n return (yield* wholeDeclaration(fqn, generation.props)) ? 'whole' : 'partial';\n });\n\n/**\n * Whether this apply's `instanceId` is a CREATE: the row Apply committed for it is `creating`.\n * ⛔ A REPLACE'S NEW GENERATION IS NOT ONE. Apply commits it as `replacing`, and the planner never\n * offers it adoption — the probe runs only for a resource with no state — so `--adopt` must not\n * let it write over whatever sits at its new identity (adopt.ts adoptsAtApply).\n */\nexport const isCreate = (fqn: string, instanceId: string): Effect.Effect<boolean> =>\n Effect.map(\n recordedGeneration(fqn, instanceId),\n (generation) => generation?.status === 'creating',\n );\n\n/**\n * ⛔ A REFUSED CREATE MUST NOT LEAVE A ROW THAT CLAIMS THE OBJECT IT REFUSED. Apply commits a\n * `creating` row for this instance before it calls reconcile, and a failed reconcile leaves it\n * there. The next plan's recovery read would then find our instance id and an object that can\n * match its props — a prop that was an Output is stripped from the row, and an omitted prop is\n * \"not managed\" — and adopt exactly what this apply refused. 🔴 MEASURED 2026-09-21: Bao.Mount\n * and Bao.AuthMethod did (openbao/adopt-core.test.ts). So the row goes, and state reads as if\n * the create never started: the next plan probes, and the probe answers `Unowned`.\n * ⚠️ ONLY a `creating` row of THIS instance with no attributes — the one Apply just wrote. A\n * `replacing` row carries the previous generation in `old` and is never touched.\n */\nexport const forgetRefusedCreate = (fqn: string, instanceId: string): Effect.Effect<void> =>\n Effect.gen(function* () {\n const found = yield* storeOf;\n if (found === undefined) return;\n const row = yield* rowAt(found.store, found.where, fqn);\n const mine = row as { status?: unknown; instanceId?: unknown; attr?: unknown } | undefined;\n if (mine?.status !== 'creating' || mine.instanceId !== instanceId || mine.attr !== undefined) {\n return;\n }\n yield* found.store.delete({ ...found.where, fqn }).pipe(Effect.ignore);\n });\n",
14
+ "/**\n * Whether a state row's props say everything the declaration says — the test that separates a row\n * whose props can prove an object ours from one that cannot (probe.ts, rows.ts).\n *\n * ★ WHY A ROW CAN BE MISSING PART OF ITS DECLARATION. Apply commits the `creating` (or `replacing`)\n * row BEFORE reconcile runs, and strips every prop still an Output at that moment (alchemy\n * beta.79 Apply.ts `commit` → Diff.ts `stripUnresolved`); a JSON store then drops the key. So a\n * row written while an upstream was still being created carries a HOLE where that prop was.\n * ⛔ A HOLE IS \"UNKNOWN\", NOT \"UNMANAGED\". Most families read an absent prop as \"not managed\", so a\n * recovery read comparing the live object with holed props proves nothing: 🔴 MEASURED 2026-09-21\n * (openbao/adopt-holes.test.ts), a Bao.Mount whose `defaultLeaseTtl` was an Output, killed before\n * its reconcile ran, adopted — and tuned — another owner's mount on the next deploy; with the\n * NAME an Output, every role family read an empty name, found nothing, and the resumed create\n * wrote over another owner's role. Neither deploy had ever asked whose object it was.\n * ★ THE DECLARATION IS WHAT TELLS A HOLE FROM AN OMISSION. It still holds the Output (or the literal)\n * the row lacks, while an optional prop left out is absent from both.\n * ⚠️ CONSERVATIVE BY DESIGN: a prop added to the declaration after the crash also reads as a hole.\n * That costs one `--adopt`, never a takeover.\n */\nimport { Stack } from 'alchemy/Stack';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nconst absent = (value: unknown): boolean => value === undefined || value === null;\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> => {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return false;\n const proto: unknown = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n};\n\n/**\n * Whether `recorded` carries a value everywhere `declared` does. Plain objects and arrays are\n * walked; any other declared value — a literal, an Output, an Effect — needs a value in the row.\n */\nexport const carries = (declared: unknown, recorded: unknown): boolean => {\n if (absent(declared)) return true;\n if (absent(recorded)) return false;\n if (Array.isArray(declared)) {\n if (!Array.isArray(recorded)) return false;\n return declared.every((each, index) => carries(each, recorded[index]));\n }\n if (isPlainObject(declared)) {\n if (!isPlainObject(recorded)) return false;\n return Object.entries(declared).every(([key, each]) => carries(each, recorded[key]));\n }\n return true;\n};\n\n/**\n * Whether `props` — one generation's, from the state store — carry the whole declaration of the\n * resource at `fqn`. ⛔ FALSE WITH NOTHING TO COMPARE: no Stack in context, or a resource no longer\n * declared (an orphan's delete). That object then reads as `Unowned` and Apply leaves it in place\n * with a note, rather than deleting what it cannot prove it made.\n */\nexport const wholeDeclaration = (fqn: string, props: unknown): Effect.Effect<boolean> =>\n Effect.map(Effect.serviceOption(Stack), (stack) => {\n const declared = Option.isSome(stack) ? stack.value.resources[fqn] : undefined;\n return declared !== undefined && carries(declared.Props, props);\n });\n",
15
+ "/**\n * Release.Binary's plan-time answer: refuse what the plan can already see is wrong, `replace` when\n * the binary's identity moves, and otherwise compare the live file with the declaration.\n *\n * ⛔ THE PINS MUST BE PLAIN VALUES, AND ARE CHECKED EVEN WHILE `directory` IS AN OUTPUT. A pin that\n * is an Output would be computed during the deploy — a fetch by another name — so a malformed or\n * non-literal pin fails the plan here, before a byte is fetched, whatever else is unresolved.\n * ⚠️ A CREATE IS NEVER DIFFED: the engine plans a first deploy without calling diff, and skips\n * the adoption probe while any prop is an Output. A pin wired from another resource's Output on\n * a FIRST deploy therefore reaches no plan-time check; reconcile refuses it before any host call\n * or request, from the props as the stack program declared them (declared-pins.ts). 🔴 Until\n * 2026-09-22 it was checked there for shape only, and a swapped archive with swapped digests\n * installed (apply-pins.test.ts).\n * ⛔ A NEW PIN IS A NEW PATH (binary-form.ts inPlaceRefusal). When the path is resolved and\n * unchanged, a changed pin is refused here; when it is resolved and new, it is a `replace`.\n * ⚠️ WHILE THE DIRECTORY IS STILL AN OUTPUT the path is unknown, and the answer depends on whether\n * the BYTES move, because the path may turn out not to have:\n * - other bytes (or another name) → `replace`. If the path did not move after all, the new\n * generation's create finds the old file, which does not hold its bytes, and refuses\n * (file-converge.ts never overwrites what a generation does not own).\n * - the same bytes from another archive (a re-pin, a repack) → `update`, NEVER `replace`. 🔴 A\n * replace onto the same path would accept the old file as its own (same bytes, same mode) and\n * then Phase 2 would delete the OLD generation — at that same path, taking the new one's file\n * with it. An update reaches reconcile with `olds`, whose in-place guard refuses the same path,\n * and whose move (file-converge.ts) writes the new path before removing the old.\n * ★ Not the engine's default either way: a changed prop is an update by default, which is\n * exactly the in-place overwrite this resource refuses.\n * ★ Create-before-delete: two versions can sit in two directories at once, so nothing forces\n * `deleteFirst`; the old file goes only once the new one is written and verified.\n * ⚠️ HOUSE, NOT UPSTREAM: this reads the live file at plan time and can answer `noop`. Upstream's\n * guidance is a diff that rarely does either (docs/release-binary-upstream.md).\n */\nimport { type Diff, isResolved } from 'alchemy/Diff';\nimport type { Input } from 'alchemy/Input';\nimport { diffTarget } from '../launchd/file-converge.ts';\nimport { resolvedString } from '../launchd/host-effect.ts';\nimport type { HostRunner } from '../launchd/runner.ts';\nimport { adoptionProblem } from './binary-claim.ts';\nimport {\n type ReleaseBinaryAttributes,\n type ReleaseBinaryProps,\n inPlaceRefusal,\n pinProblems,\n pinsMoved,\n} from './binary-form.ts';\nimport { NOTHING, desiredBinary, refuse } from './binary-lifecycle.ts';\n\nexport const diffBinary = async (\n runner: HostRunner,\n news: Input<ReleaseBinaryProps>,\n olds: ReleaseBinaryProps,\n output: ReleaseBinaryAttributes,\n): Promise<Diff | undefined> => {\n const problems = pinProblems((news ?? {}) as Parameters<typeof pinProblems>[0]);\n if (problems.length > 0) throw refuse(output.path, `${problems.join('; ')}. ${NOTHING}`);\n // ⛔ A TAKEOVER IS ONLY EVER OF THE PINNED BINARY (binary-claim.ts): `output` here is a read of a\n // path with no state, so the plan refuses what it would otherwise print as `adopted`.\n const takeover = adoptionProblem(output.sha256, olds.sha256);\n if (takeover !== undefined) throw refuse(output.path, `${takeover}. ${NOTHING}`);\n // ★ pinProblems passed, so every pin — and `name` — is a plain value; only these are read below.\n const pins = news as Pick<ReleaseBinaryProps, 'archive' | 'member' | 'sha256' | 'name'>;\n const directory = resolvedString(news, 'directory');\n const path = directory === undefined ? undefined : `${directory}/${pins.name}`;\n const pinned = pinsMoved(olds, pins);\n if (pinned && path === output.path) {\n throw refuse(output.path, `${inPlaceRefusal(olds, pins)}. ${NOTHING}`);\n }\n // Resolved: a new path is a replace, other bytes or a mode or owner drift an update (diffTarget).\n if (isResolved(news)) return diffTarget(runner, (await desiredBinary(runner, news)).want, output);\n if (path !== undefined) return path === output.path ? undefined : { action: 'replace' };\n if (pins.name !== olds.name || pins.sha256 !== olds.sha256) return { action: 'replace' };\n return pinned ? { action: 'update' } : undefined;\n};\n",
16
+ "/**\n * Whether two paths name ONE file — the question a move must answer before it deletes its old\n * path, and a plan before it answers `replace`.\n *\n * 🔴 MEASURED 2026-09-22 (release/binary-alias.test.ts, localRunner over a real temp directory,\n * through Alchemy's own Plan and Apply): a Release.Binary whose directory was respelled to\n * another path for the SAME file — through a symlinked parent (`/tmp` → `/private/tmp`, `/etc`\n * → `/private/etc`), or by case alone on case-insensitive APFS, macOS's default — planned a\n * `replace`. The new generation took the file already there as its own (same bytes, same mode:\n * file-converge.ts's resume rule), then Phase 2 deleted the old generation's path, which was that\n * same file. The deploy SUCCEEDED and the binary was gone. The `update` route lost it in one step:\n * convergeFile's move removed the old path after \"writing\" the new one. Host.File shares both.\n * ★ IDENTITY, NOT SPELLING. Case-folding the strings would be wrong on a case-sensitive volume and\n * blind to a symlinked parent; device and inode from lstat are what the kernel itself compares.\n * ⚠️ A HARD LINK also shares an inode. At the old path of a move it is therefore kept, not removed:\n * one stray link left behind, rather than the risk of deleting the file just verified.\n */\nimport type { FileStat, HostRunner } from './runner.ts';\n\n/**\n * `true` when both entries exist and are one file; `false` when either is absent or they differ;\n * `undefined` when the runner reported no identity, so nobody can tell (fakes, custom runners).\n */\nexport const sameEntry = (\n a: FileStat | undefined,\n b: FileStat | undefined,\n): boolean | undefined => {\n if (a === undefined || b === undefined) return false;\n if (a.dev === undefined || a.ino === undefined || b.dev === undefined || b.ino === undefined) {\n return undefined;\n }\n return a.dev === b.dev && a.ino === b.ino;\n};\n\n/** Whether `a` and `b` are one file on this host right now. Equal strings always are. */\nexport const oneFile = async (\n runner: HostRunner,\n a: string,\n b: string,\n): Promise<boolean | undefined> => {\n if (a === b) return true;\n const [left, right] = await Promise.all([runner.stat(a), runner.stat(b)]);\n return sameEntry(left, right);\n};\n\n/**\n * The last step of a move: `remove` the old path unless it is the file just verified at `path`.\n * ⚠️ A runner that reports no identity cannot be asked beforehand, so `path` is checked after: a\n * file lost to a respelling then fails the deploy instead of reporting success.\n */\nexport const leaveOldPath = async (\n runner: HostRunner,\n oldPath: string,\n path: string,\n remove: () => Promise<void>,\n refuse: (path: string, message: string) => Error,\n): Promise<void> => {\n const same = await oneFile(runner, oldPath, path);\n if (same === true) return;\n await remove();\n if (same === undefined && (await runner.stat(path)) === undefined) {\n throw refuse(\n path,\n `removing the old path ${oldPath} removed this file too: they are one file under two ` +\n 'spellings (a symlinked parent, or case on a case-insensitive volume). Deploy again to ' +\n 'reinstall it, and keep one spelling.',\n );\n }\n};\n",
17
+ "/**\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",
18
+ "/**\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",
19
+ "/**\n * The one path a declared file's bytes take onto a host, shared by every resource that owns ONE\n * whole file: `Host.File` (text it was handed) and `Release.Binary` (bytes it downloaded and\n * verified). Read, diff, converge and delete, as plain async functions over a HostRunner.\n *\n * ★ EXTRACTED FROM host-file-lifecycle.ts, NOT COPIED (2026-09-22). The ownership rules below — a\n * file this resource does not own is never overwritten, a move onto an occupied path stays\n * refused, a failed create is rolled back — were red-teamed on Host.File (docs/ownership.md). A\n * second resource that writes a whole file gets them by calling this, so a fix lands in both.\n * ★ THE BYTES ARE ASKED FOR ONLY WHEN A WRITE IS DUE (`bytesFor`). Host.File has them already; a\n * binary has only a pinned digest until it downloads, and a host whose file already matches\n * must not cost a 120 MB download to prove it.\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 { leaveOldPath, oneFile } from './file-identity.ts';\nimport type { HostFileAttributes } from './host-file-form.ts';\nimport { sha256Hex } from './job-form.ts';\nimport { type HostRunner, type WriteOptions, canActAsRoot } from './runner.ts';\n\n/** What a whole file must be: where, which bytes (by digest), which mode and owner. */\nexport type FileTarget = {\n readonly path: string;\n readonly sha256: string;\n readonly mode: number;\n readonly uid?: number;\n readonly gid?: number;\n};\n\n/** A family's refusal: `<Type> <path>: <message>`, so a deploy log names the resource that said no. */\nexport type Refuse = (path: string, message: string) => Error;\n\nconst numericId = (value: string | number): number | undefined =>\n typeof value === 'number' ? value : /^\\d+$/.test(value) ? Number(value) : undefined;\n\n/** Resolve a declared owner and group (names or ids) to ids through the runner. */\nexport const resolveIds = async (\n runner: HostRunner,\n declared: { readonly owner?: string | number; readonly group?: string | number },\n path: string,\n refuse: Refuse,\n): Promise<{ uid?: number; gid?: number }> => {\n let uid: number | undefined;\n let gid: number | undefined;\n if (declared.owner !== undefined) {\n uid = numericId(declared.owner) ?? (await runner.lookupUser(String(declared.owner)))?.uid;\n if (uid === undefined) throw refuse(path, `no user ${String(declared.owner)} on this host`);\n }\n if (declared.group !== undefined) {\n gid = numericId(declared.group) ?? (await runner.lookupGroup(String(declared.group)));\n if (gid === undefined) throw refuse(path, `no group ${String(declared.group)} on this host`);\n }\n return { ...(uid === undefined ? {} : { uid }), ...(gid === undefined ? {} : { gid }) };\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\nexport const writeOptionsOf = (want: FileTarget): WriteOptions => ({\n mode: want.mode,\n ...(want.uid === undefined ? {} : { uid: want.uid }),\n ...(want.gid === undefined ? {} : { gid: want.gid }),\n});\n\nexport const fileMatches = (live: HostFileAttributes, want: FileTarget): 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\n/**\n * ★ A PLAN THAT WILL WRITE ASKS THE RUNNER FIRST (`checkWrite`, when it has one): sudoRunner's\n * refusals — a setuid or group-writable root file, a directory under a prefix another user may\n * change — then fail the plan, before any resource is applied, instead of halfway through it.\n */\nexport const diffTarget = async (\n runner: HostRunner,\n want: FileTarget,\n output: HostFileAttributes,\n): Promise<Diff> => {\n const writes = async (diff: Diff): Promise<Diff> => {\n await runner.checkWrite?.(want.path, writeOptionsOf(want));\n return diff;\n };\n // ★ Create-before-delete: two paths can hold two files at once, so nothing forces deleteFirst.\n // ⛔ …unless the two paths are ONE file (file-identity.ts). That is a respelling, not a move: a\n // replace would let Phase 2 delete the old generation's path, which is the new one's file. An\n // update records the new spelling, and convergeFile keeps the file.\n if (want.path !== output.path) {\n const same = await oneFile(runner, want.path, output.path);\n return writes({ action: same === true ? 'update' : 'replace' });\n }\n if (want.sha256 !== output.sha256) return writes({ action: 'update' });\n const live = await readFileAttributes(runner, want.path);\n return live !== undefined && fileMatches(live, want)\n ? { action: 'noop' }\n : writes({ action: 'update' });\n};\n\nexport type Converge = {\n readonly want: FileTarget;\n /** The owner as declared (a name or an id), for the chown refusal's wording. */\n readonly owner?: string | number | undefined;\n /** The bytes to write, asked for only when a write is due; `before` is what is there now. */\n readonly bytesFor: (before: HostFileAttributes | undefined) => Promise<Uint8Array>;\n readonly refuse: Refuse;\n};\n\n/**\n * Make the file at `want.path` match `want`, and return it as read back.\n *\n * `adopt` is whether adoption is on AND this apply is a create or an unfinished generation of our\n * own (ownership/adopt.ts adoptsAtApply). It lets such a generation take over a file already at the\n * path — the takeover the plan's probe would have allowed, had it run. ⛔ A move onto an occupied\n * path stays refused, both ways the engine drives one: an `update` across the move (`moved`,\n * below), and a fresh replace's new generation, which the caller never marks adoptable (its\n * `output` is undefined too, so this function cannot tell it from a create by itself).\n */\nexport const convergeFile = async (\n runner: HostRunner,\n spec: Converge,\n output?: HostFileAttributes,\n adopt = false,\n): Promise<HostFileAttributes> => {\n const { want, refuse } = spec;\n const path = want.path;\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 path,\n `owner ${String(spec.owner)} is not the deploying user; only root may chown. Deploy as root ` +\n 'or through a privileged HostRunner (sudoRunner() with this path under a prefix). This ' +\n 'provider never calls sudo itself.',\n );\n }\n const stat = await runner.stat(path);\n if (stat !== undefined && stat.kind !== 'file') {\n throw refuse(\n 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, 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 // ★ A respelling of ONE file (file-identity.ts) still counts as moved here, so a file there\n // that does not match is refused below — never rewritten in place under the old spelling's pins.\n const moved = output !== undefined && output.path !== 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 where it never\n * looked: the new path of a replace, and a create whose props still held an Output at plan\n * time. A path typo there would otherwise overwrite, say, a system file that a fresh\n * declaration of the same path would have been refused as `Unowned`. ★ With adoption on, a\n * create takes it over, as the probe would have let it (decided 2026-09-21).\n */\n const takeOver = adopt && output === undefined;\n if (prior === undefined && before !== undefined && !fileMatches(before, want) && !takeOver) {\n throw refuse(\n 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 || !fileMatches(before, want)) {\n const bytes = await spec.bytesFor(before);\n // ⛔ THE ONE WRITER NEVER WRITES BYTES THAT ARE NOT THE DECLARED ONES. Host.File's always are;\n // a supplier that verifies elsewhere (a download) is held to the same digest here, last.\n if (sha256Hex(bytes) !== want.sha256) {\n throw refuse(path, `the bytes to write do not hash to ${want.sha256}. Nothing was written.`);\n }\n await runner.writeFileAtomic(path, bytes, writeOptionsOf(want));\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 // ⚠️ Roll back a CREATE: left behind, the next plan's recovery `read` finds a file with no state,\n // reports it `Unowned`, and every later deploy demands --adopt for our own file. ⛔ Also when\n // the read-back THROWS: MEASURED 2026-09-22, a 0111 binary written as a non-root operator read\n // back EACCES and stayed, and every later plan's probe failed with the same EACCES.\n const rollBack = async () => {\n if (before === undefined) await runner.removeFile(path).catch(() => undefined);\n };\n const after = await readFileAttributes(runner, path).catch(async (cause: unknown) => {\n await rollBack();\n throw refuse(path, `the write returned but reading it back failed: ${String(cause)}`);\n });\n if (after === undefined || !fileMatches(after, want)) {\n await rollBack();\n throw refuse(path, 'the write returned but the file on disk does not match the declaration');\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 — and ⛔ never when the old path IS this file (file-identity.ts).\n if (moved)\n await leaveOldPath(\n runner,\n output.path,\n path,\n () => removeWholeFile(runner, output, refuse),\n refuse,\n );\n return after;\n};\n\n/** Remove the file. Idempotent. ⛔ Refuses a path that has since become a symlink or directory. */\nexport const removeWholeFile = async (\n runner: HostRunner,\n output: HostFileAttributes,\n refuse: Refuse,\n): 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",
20
+ "/**\n * What a Release.Binary may take over at a path it holds no state for: ONLY the pinned binary, and\n * only under `--adopt`. Asked the same way at plan (binary-diff.ts) and at apply\n * (binary-lifecycle.ts), so a plan never says `adopted` or `create` for a file the apply would then\n * overwrite or silently claim.\n *\n * ⛔ OTHER BYTES ARE NEVER ADOPTED, `--adopt` OR NOT. 🔴 MEASURED 2026-09-22 (adopt-parity.test.ts,\n * through Alchemy's own Plan and Apply): under `--adopt`, a file with other bytes at the path\n * planned as `adopted` — beta.79 forces an `adopted` update after every takeover and prints it for\n * drift too — and the apply downloaded the archive and overwrote that file in place. With the\n * directory an Output (the probe skipped) the same file planned as `create`, and was overwritten.\n * ★ Refused rather than converged, which is what Host.File does with a file it adopts: a binary's\n * content is named entirely by its pin, so \"adopting\" other bytes is replacing them under\n * whatever runs them, with no rollback but a re-download — the very overwrite binary-form.ts\n * inPlaceRefusal refuses for a re-pin. The pinned bytes with another mode or owner ARE adopted;\n * the apply re-writes the bytes already on disk.\n * ⛔ THE PINNED BYTES WITH NO STATE ARE NOT OURS WITHOUT `--adopt` — AT APPLY AS AT PLAN. The probe\n * already says `Unowned` for them (docs/ownership.md: identical is not ours). file-converge.ts\n * accepts them at apply as the resume of an interrupted install, and that gap is where the probe\n * never runs: every first deploy that passes `directory: dir.path`. 🔴 MEASURED 2026-09-22: a\n * declaration renamed (a new logical id, the same path) in a deploy that also changed its\n * HostDirectory's mode claimed the identical file at apply without `--adopt`; the orphan delete of\n * the old name then removed it, and the deploy reported success with the binary gone. With the\n * directory unchanged, the probe refused that same rename.\n * ⚠️ THE COST: an install interrupted between its write and its commit while a prop was an\n * Output now resumes only with `--adopt` — as the same install with every prop resolved already\n * did (its recovery read is `Unowned`), and as ownership.md says a create or replace interrupted\n * while a prop was an Output does. A retained old version is not re-claimed by a rollback either.\n * ★ `renamedFrom()` IS THE REMEDY FOR A RENAME: `.pipe(renamedFrom('old-id'))` migrates the row\n * and keeps the file (adopt-parity.test.ts). 🔴 MEASURED 2026-09-22: the same rename under\n * `--adopt` claimed the file, the old name's delete then removed it, and the deploy succeeded\n * with the binary gone. binary.ts's delete now leaves a path another declaration installed in\n * the same deploy, so that is kept too — as an adoption, not as the old row. ⚠️ That guard sees\n * only this deploy's claims, by spelling; nothing here sees another row's claim in state.\n * ★ HOW DIFF TELLS A TAKEOVER FROM ITS OWN ROW. Every row this resource commits records the digest\n * reconcile READ BACK, which it checked equal to the pin — so `output.sha256 === olds.sha256` for\n * every row of its own, and an update never changes the digest (a new digest is a new path, a\n * `replace`). The engine hands diff anything else only after a read of a path it holds no state\n * for: the adoption probe (`olds` = the declaration) or the recovery read of an interrupted\n * create (`olds` = its row). A non-file reads with digest '' (file-converge.ts).\n */\nimport { type FileTarget, readFileAttributes } from '../launchd/file-converge.ts';\nimport type { HostRunner } from '../launchd/runner.ts';\n\nconst TAKEN = 'already exists and is not this resource';\n\nconst otherBytes = (found: string, pinned: string): string =>\n `${found === '' ? 'something that is not a regular file' : `a file hashing to ${found}`} is ` +\n `there, not the pinned binary (${pinned}). --adopt takes over only the pinned binary: taking ` +\n 'over other bytes would overwrite them in place. Remove it (or move it aside) and deploy again';\n\n/** Plan side: why diff must refuse `found` — a digest read at a path with no state — or undefined. */\nexport const adoptionProblem = (found: string, pinned: string): string | undefined =>\n found === pinned ? undefined : `${TAKEN}: ${otherBytes(found, pinned)}`;\n\n/**\n * Apply side, for a reconcile with no `output` — a create, a replace's new generation, or the\n * resume of either: why it must not write, or undefined. `adopt` is adoptsAtApply's answer (never\n * true for a fresh replace). A symlink or directory is left to convergeFile, which refuses it by\n * kind.\n */\nexport const claimProblem = async (\n runner: HostRunner,\n want: FileTarget,\n adopt: boolean,\n): Promise<string | undefined> => {\n const stat = await runner.stat(want.path);\n if (stat?.kind !== 'file') return undefined;\n const found = (await readFileAttributes(runner, want.path))?.sha256 ?? '';\n if (found !== want.sha256) return adoptionProblem(found, want.sha256);\n if (adopt) return undefined;\n return (\n `${TAKEN}: it holds the pinned binary, but this stack holds no state for it and the plan ` +\n 'could not ask first (a prop was still an Output, or a replace landed on it). ' +\n 'Identical is not ours: once claimed, a later delete removes it from whoever put it there. ' +\n 'Deploy with --adopt to take it over (a create, or an interrupted install of this one), or ' +\n 'remove it. If another declaration in this stack owned it under another name, declare the ' +\n 'rename with renamedFrom() instead'\n );\n};\n",
21
+ "/**\n * Release.Binary's failures as tagged errors — each carrying the house refusal sentence\n * (`Release.Binary <path>: …`) as its `message`.\n *\n * ★ TAGGED BECAUSE ALCHEMY UPSTREAM REQUIRES IT (its AGENTS.md at v2.0.0-beta.79: Data.TaggedError,\n * `catchTag`, never a cast on `_tag`), so the classes need no rewrite on the way there. The\n * MESSAGE stays the kit's wording, so a deploy log reads the same as every other house family's.\n * ⚠️ TAGGED IS NOT YET TYPED END TO END — measured in error-channel.test.ts. catalogBinary() throws,\n * so in a stack program its BinaryRefused is a DEFECT that `catchTag` never sees; and the provider\n * runs every lifecycle call through the house `lift()`, which keeps the instance at runtime but\n * types the channel as `Error`. No caller can name one of these tags today without a cast.\n * ★ THE TAGS NAME NO VENDOR. Downloading a pinned archive, refusing an unsafe one and comparing\n * digests are the same for every catalog (docs/release-binary-upstream.md).\n */\nimport * as Data from 'effect/Data';\n\n/** The declaration itself: a version no catalog pins, a malformed pin, a bad path or mode. */\nexport class BinaryRefused extends Data.TaggedError('BinaryRefused')<{\n readonly message: string;\n}> {}\n\n/** The download: a status that is not 200, a body that is not the pinned size, a dead transport. */\nexport class DownloadFailed extends Data.TaggedError('DownloadFailed')<{\n readonly message: string;\n /** Worth another attempt: a transport failure or a 5xx, never a wrong size or a 404. */\n readonly retryable: boolean;\n}> {}\n\n/** Bytes that do not hash to their pin — the archive, or a member extracted from it. */\nexport class ChecksumMismatch extends Data.TaggedError('ChecksumMismatch')<{\n readonly message: string;\n readonly subject: string;\n readonly expected: string;\n readonly actual: string;\n}> {}\n\n/** An archive this reader will not trust: an unsafe or unexpected entry, a missing member. */\nexport class ArchiveRefused extends Data.TaggedError('ArchiveRefused')<{\n readonly message: string;\n}> {}\n",
22
+ "/**\n * A tar reader with one job: hand back the NAMED regular files of a vendor archive, and refuse the\n * whole archive if any entry could make a name mean something other than what it says.\n *\n * ★ IN PROCESS, NOT `tar` ON THE HOST. An exec'd tar writes through its own path — past the\n * HostRunner seam, past sudoRunner's allowlist, and past the member digest check, which has to\n * see the bytes BEFORE they exist on any disk. Nothing this file reads is ever written by it.\n * ★ STREAMING. It is fed the gunzip output chunk by chunk; an entry nobody asked for is counted\n * past, never held. vmutils unpacks to 264 MB across seven binaries (measured 2026-09-22) and a\n * stack wants two, so the unpacked archive never exists whole in memory.\n * ⛔ REFUSED, WHOLE ARCHIVE, whichever entry it is and whether or not it was asked for:\n * an absolute name; a `..` segment; a hard link, symlink, directory, device, FIFO or contiguous\n * file (only a regular file is accepted); a name given twice; a header whose checksum fails; a\n * size in GNU base-256; a header that is neither ustar nor GNU; a lone zero block between entries;\n * non-zero bytes after the end marker; an archive that stops before it.\n * ★ GNU LONG NAMES ('L', 'K') AND PAX HEADERS ('x', 'g') ARE REFUSED, NOT INTERPRETED. Each renames\n * the entry after it: a reader that honours them must get them exactly right to match exactly,\n * and one that skips them matches under the wrong name. The four pinned archives use neither\n * (measured 2026-09-22 with `tar -tvzf` on each: every entry a root-level regular file with a\n * short name), so refusing costs nothing today, and a vendor format change becomes a refusal that\n * says what changed instead of a silent mis-read.\n */\nimport { ArchiveRefused } from './refused.ts';\n\nconst BLOCK = 512;\n\nconst KINDS: Readonly<Record<string, string>> = {\n '1': 'a hard link',\n '2': 'a symlink',\n '3': 'a character device',\n '4': 'a block device',\n '5': 'a directory',\n '6': 'a FIFO',\n '7': 'a contiguous file',\n K: 'a GNU long-link header',\n L: 'a GNU long-name header',\n g: 'a PAX global header',\n x: 'a PAX extended header',\n};\n\nconst refuse = (message: string): ArchiveRefused => new ArchiveRefused({ message });\nconst strict = new TextDecoder('utf-8', { fatal: true });\nconst ascii = new TextDecoder('latin1');\n\n/** One NUL-terminated header field. */\nconst field = (block: Uint8Array, start: number, length: number): Uint8Array => {\n const slice = block.subarray(start, start + length);\n const end = slice.indexOf(0);\n return end === -1 ? slice : slice.subarray(0, end);\n};\n\nconst text = (block: Uint8Array, start: number, length: number): string => {\n try {\n return strict.decode(field(block, start, length));\n } catch {\n throw refuse('an entry name is not UTF-8');\n }\n};\n\nconst octal = (block: Uint8Array, start: number, length: number, what: string): number => {\n const raw = block.subarray(start, start + length);\n if (((raw[0] ?? 0) & 0x80) !== 0) throw refuse(`${what} is base-256 encoded`);\n const digits = ascii\n .decode(raw)\n .replace(/[\\0 ]+$/, '')\n .replace(/^ +/, '');\n if (!/^[0-7]+$/.test(digits)) throw refuse(`${what} is not octal: ${JSON.stringify(digits)}`);\n return Number.parseInt(digits, 8);\n};\n\nconst checksumHolds = (block: Uint8Array): boolean => {\n let sum = 0;\n // The checksum field itself counts as eight spaces (POSIX ustar).\n for (let at = 0; at < BLOCK; at += 1) sum += at >= 148 && at < 156 ? 0x20 : (block[at] ?? 0);\n return sum === octal(block, 148, 8, 'a header checksum');\n};\n\n/** Why an entry name is unsafe to trust, or undefined. */\nconst nameProblem = (name: string): string | undefined => {\n if (name === '') return 'has an empty name';\n if (name.startsWith('/')) return 'is absolute';\n if (name.split('/').includes('..')) return 'climbs out of the archive with \"..\"';\n return undefined;\n};\n\n/** Concatenate chunks into one buffer. */\nexport const concatBytes = (parts: readonly Uint8Array[]): Uint8Array => {\n const out = new Uint8Array(parts.reduce((total, part) => total + part.length, 0));\n let at = 0;\n for (const part of parts) {\n out.set(part, at);\n at += part.length;\n }\n return out;\n};\n\nexport type TarContents = {\n /** The asked-for regular files, by exact name. An asked-for name that is absent is absent here. */\n readonly members: ReadonlyMap<string, Uint8Array>;\n /** Every entry name, in archive order — so a refusal can say what the archive did hold. */\n readonly names: readonly string[];\n};\n\n/** A push parser: `push` each chunk of the unzipped stream, then `finish`. Either may throw. */\nexport const tarReader = (wanted: ReadonlySet<string>) => {\n const header = new Uint8Array(BLOCK);\n const members = new Map<string, Uint8Array>();\n const names: string[] = [];\n const seen = new Set<string>();\n let phase: 'header' | 'data' | 'pad' | 'end' = 'header';\n let filled = 0;\n let remaining = 0;\n let padding = 0;\n let zeros = 0;\n let name = '';\n let parts: Uint8Array[] | undefined;\n\n const endEntry = () => {\n if (parts !== undefined) members.set(name, concatBytes(parts));\n parts = undefined;\n phase = padding > 0 ? 'pad' : 'header';\n };\n\n const startEntry = () => {\n if (header.every((byte) => byte === 0)) {\n zeros += 1;\n if (zeros === 2) phase = 'end';\n return;\n }\n if (zeros > 0) throw refuse('a zero block sits between entries (truncated or spliced)');\n if (!checksumHolds(header)) throw refuse('an entry header fails its checksum');\n const magic = ascii.decode(header.subarray(257, 265));\n const posix = magic === 'ustar\\u000000';\n if (!posix && magic !== 'ustar \\u0000')\n throw refuse('an entry header is neither ustar nor GNU');\n const prefix = posix ? text(header, 345, 155) : '';\n name = prefix === '' ? text(header, 0, 100) : `${prefix}/${text(header, 0, 100)}`;\n const problem = nameProblem(name);\n if (problem !== undefined) throw refuse(`entry ${JSON.stringify(name)} ${problem}`);\n const type = String.fromCharCode(header[156] ?? 0);\n if (type !== '0' && type !== '\\0') {\n const kind = KINDS[type] ?? `of unknown type ${JSON.stringify(type)}`;\n throw refuse(`entry \"${name}\" is ${kind}; only regular files are accepted`);\n }\n if (seen.has(name)) throw refuse(`entry \"${name}\" appears twice`);\n seen.add(name);\n names.push(name);\n remaining = octal(header, 124, 12, `entry \"${name}\"'s size`);\n padding = (BLOCK - (remaining % BLOCK)) % BLOCK;\n parts = wanted.has(name) ? [] : undefined;\n phase = 'data';\n if (remaining === 0) endEntry();\n };\n\n const push = (chunk: Uint8Array): void => {\n let at = 0;\n while (at < chunk.length) {\n if (phase === 'end') {\n if (chunk.subarray(at).some((byte) => byte !== 0)) {\n throw refuse('data follows the end-of-archive marker');\n }\n return;\n }\n if (phase === 'header') {\n const take = Math.min(BLOCK - filled, chunk.length - at);\n header.set(chunk.subarray(at, at + take), filled);\n filled += take;\n at += take;\n if (filled === BLOCK) {\n filled = 0;\n startEntry();\n }\n } else if (phase === 'data') {\n const take = Math.min(remaining, chunk.length - at);\n // ⚠️ slice, not subarray: a chunk's buffer may be reused by the stream after this returns.\n parts?.push(chunk.slice(at, at + take));\n remaining -= take;\n at += take;\n if (remaining === 0) endEntry();\n } else {\n const take = Math.min(padding, chunk.length - at);\n padding -= take;\n at += take;\n if (padding === 0) phase = 'header';\n }\n }\n };\n\n const finish = (): TarContents => {\n if (phase !== 'end') throw refuse('the archive stops before its end-of-archive marker');\n return { members, names };\n };\n\n return { finish, push };\n};\n",
23
+ "/**\n * A pinned archive, verified, to the one member a declaration names, verified — the order the\n * checks run in is the point of the file.\n *\n * 1. the archive's SHA-256 against its pin — BEFORE a single byte is unpacked;\n * 2. gunzip and tar-read as one stream, keeping only the declared member (tar.ts refuses anything\n * unsafe in the archive, asked-for or not);\n * 3. that member's SHA-256 against its own pin.\n *\n * ★ BOTH LAYERS, BECAUSE THE VENDOR HASHES BOTH. Each checksum file lists the archive AND every\n * binary inside it (measured 2026-09-22, all four). The archive check says the download is the\n * published file; the member check says the bytes about to be written are the published binary —\n * and it is the only check that still holds if the tar reader were ever wrong about a boundary.\n * ★ DecompressionStream, THE WEB STANDARD: node and bun both ship it, so dist behaves the same\n * under either runtime — no zlib binding, no dependency.\n * ⛔ IN MEMORY ONLY. Nothing here touches a disk, so no failure below can leave a staged download\n * behind; the bytes reach a host only through HostRunner.writeFileAtomic (file-converge.ts).\n */\nimport { sha256Hex } from '../launchd/job-form.ts';\nimport type { PinnedDownload } from './binary-form.ts';\nimport { ArchiveRefused, ChecksumMismatch } from './refused.ts';\nimport { type TarContents, tarReader } from './tar.ts';\n\n/** How much gzip is handed to the inflater at a time. */\nconst SLICE = 1 << 20;\n\n/** Gunzip and read a tar, keeping only `wanted`. Throws ArchiveRefused. */\nexport const extractMembers = async (\n gzipped: Uint8Array,\n wanted: ReadonlySet<string>,\n): Promise<TarContents> => {\n const tar = tarReader(wanted);\n // ⚠️ FED IN SLICES, ON DEMAND. Enqueued whole, the 123.6 MB vmutils archive is inflated in one\n // transform step and all 264 MB of output queue up before the first read: MEASURED 2026-09-22,\n // a peak RSS of 1116 MB for vmalert alone under bun 1.4.0. `pull` hands over the next slice only\n // when the stream asks, so backpressure bounds what is inflated ahead of the tar reader.\n let offset = 0;\n const source = new ReadableStream<Uint8Array>({\n pull(controller) {\n if (offset >= gzipped.length) {\n controller.close();\n return;\n }\n controller.enqueue(gzipped.slice(offset, offset + SLICE));\n offset += SLICE;\n },\n });\n const unzipped = source.pipeThrough(new DecompressionStream('gzip')).getReader();\n try {\n for (;;) {\n const { done, value } = await unzipped.read();\n if (done) break;\n tar.push(value);\n }\n } catch (cause) {\n await unzipped.cancel().catch(() => undefined);\n if (cause instanceof ArchiveRefused) throw cause;\n throw new ArchiveRefused({ message: `not a gzip stream (${String(cause)})` });\n }\n return tar.finish();\n};\n\nconst mismatch = (subject: string, expected: string, actual: string): ChecksumMismatch =>\n new ChecksumMismatch({\n actual,\n expected,\n message: `${subject} hashes to ${actual}, not the pinned ${expected}`,\n subject,\n });\n\n/**\n * The declared member's bytes out of a downloaded archive, both layers checked.\n * ⚠️ `archive` may be shared with another resource's extraction (download.ts sharingInFlight):\n * this only reads it.\n */\nexport const verifiedMember = async (\n archive: Uint8Array,\n release: PinnedDownload,\n): Promise<Uint8Array> => {\n const archiveSha = sha256Hex(archive);\n if (archiveSha !== release.sha256) throw mismatch(release.url, release.sha256, archiveSha);\n const { members, names } = await extractMembers(archive, new Set([release.member]));\n const bytes = members.get(release.member);\n if (bytes === undefined) {\n throw new ArchiveRefused({\n message: `${release.url} has no member named exactly \"${release.member}\" (it has ${names.map((n) => `\"${n}\"`).join(', ') || 'none'})`,\n });\n }\n const memberSha = sha256Hex(bytes);\n if (memberSha !== release.memberSha256) {\n throw mismatch(`member \"${release.member}\"`, release.memberSha256, memberSha);\n }\n return bytes;\n};\n",
24
+ "/**\n * Release.Binary's read / reconcile / delete as plain async functions over a HostRunner and a\n * FetchArchive, so the lifecycle runs against fakes of both in tests. (diff: binary-diff.ts.)\n *\n * ⛔ ONE WRITER. The verified bytes reach the host through file-converge.ts — the path Host.File's\n * bytes take — and so through `HostRunner.writeFileAtomic` alone: a temp file in the same\n * directory, mode and owner set, rename. Under sudoRunner that is its staged `install -S`.\n * Nothing here opens a file, spawns `tar`, or stages a download on disk.\n * ★ REFUSE BEFORE TOUCHING ANYTHING. Validation runs before the first host call, the host checks\n * run before the first download, and the digest checks run before the one write — so every\n * refusal but a failed read-back can say \"Nothing was written.\"\n * ★ AN INSTALLED BINARY IS RECOGNISED BY ITS DIGEST. A file whose SHA-256 is the pin needs no\n * download to confirm, and a mode or owner fix re-writes the bytes already on disk.\n */\nimport {\n type FileTarget,\n convergeFile,\n readFileAttributes,\n removeWholeFile,\n resolveIds,\n} from '../launchd/file-converge.ts';\nimport type { HostFileAttributes } from '../launchd/host-file-form.ts';\nimport { sha256Hex } from '../launchd/job-form.ts';\nimport type { HostRunner } from '../launchd/runner.ts';\nimport { verifiedMember } from './archive.ts';\nimport { claimProblem } from './binary-claim.ts';\nimport {\n DEFAULT_BINARY_MODE,\n type PinnedDownload,\n type ReleaseBinaryAttributes,\n type ReleaseBinaryProps,\n binaryProblems,\n inPlaceRefusal,\n pinnedDownload,\n pinsMoved,\n releaseBinaryPath,\n} from './binary-form.ts';\nimport type { FetchArchive } from './download.ts';\nimport { ArchiveRefused, BinaryRefused, ChecksumMismatch, DownloadFailed } from './refused.ts';\n\nexport const NOTHING = 'Nothing was written.';\n\nexport const refuse = (path: string, message: string): BinaryRefused =>\n new BinaryRefused({ message: `Release.Binary ${path}: ${message}` });\n\n/** Re-say a download or archive failure as this resource's, keeping its tag. */\nconst restated = (path: string, cause: unknown): unknown => {\n const say = (message: string) => `Release.Binary ${path}: ${message}. ${NOTHING}`;\n if (cause instanceof ChecksumMismatch) {\n const { actual, expected, subject } = cause;\n return new ChecksumMismatch({ actual, expected, message: say(cause.message), subject });\n }\n if (cause instanceof ArchiveRefused) return new ArchiveRefused({ message: say(cause.message) });\n if (cause instanceof DownloadFailed) {\n return new DownloadFailed({ message: say(cause.message), retryable: cause.retryable });\n }\n return cause;\n};\n\nexport type Desired = { readonly want: FileTarget; readonly download: PinnedDownload };\n\n/** Validate every prop, then resolve owner and group through the runner. */\nexport const desiredBinary = async (\n runner: HostRunner,\n props: ReleaseBinaryProps,\n): Promise<Desired> => {\n const path = releaseBinaryPath(props);\n const problems = binaryProblems(props);\n if (problems.length > 0) throw refuse(path, `${problems.join('; ')}. ${NOTHING}`);\n const ids = await resolveIds(runner, props, path, refuse);\n const mode = props.mode ?? DEFAULT_BINARY_MODE;\n return { download: pinnedDownload(props), want: { mode, path, sha256: props.sha256, ...ids } };\n};\n\nconst withSource = (\n found: HostFileAttributes,\n download: PinnedDownload,\n): ReleaseBinaryAttributes => ({ ...found, member: download.member, url: download.url });\n\n/**\n * The file at the declaration's path, or undefined when absent — the adoption probe's answer.\n * ★ Its `sha256` is the digest of the bytes on disk, so a caller sees at once whether it is the\n * pinned binary (equal to `props.sha256`) without anything being executed.\n */\nexport const readBinary = async (\n runner: HostRunner,\n props: ReleaseBinaryProps,\n): Promise<ReleaseBinaryAttributes | undefined> => {\n const { download, want } = await desiredBinary(runner, props);\n const found = await readFileAttributes(runner, want.path);\n return found === undefined ? undefined : withSource(found, download);\n};\n\n/** An owned binary as it is now, at the path state recorded — no pins needed to find it. */\nexport const refreshBinary = async (\n runner: HostRunner,\n output: ReleaseBinaryAttributes,\n): Promise<ReleaseBinaryAttributes | undefined> => {\n const found = await readFileAttributes(runner, output.path);\n return found === undefined ? undefined : { ...found, member: output.member, url: output.url };\n};\n\n/**\n * ⛔ THE DIRECTORY IS DECLARED, NEVER INVENTED. Checked before any download: a missing directory\n * would otherwise cost 123 MB and then fail at the write. A symlink is refused as well — the\n * write would land wherever it points, under an owner nobody declared.\n */\nconst directoryReady = async (runner: HostRunner, props: ReleaseBinaryProps): Promise<void> => {\n const stat = await runner.stat(props.directory);\n /**\n * ⛔ AND ONE ONLY ITS OWNER MAY WRITE. The mode rule (binary-form.ts modeProblems) refuses a\n * group- or world-writable binary because its writers could change the code a daemon runs. A\n * directory they may write gives them the same power by another call: rename(2) their own file\n * over the binary, and the next launchd start runs theirs. The sticky bit is no excuse — a\n * binary directory has no business being shared.\n */\n if (stat?.kind === 'directory' && (stat.mode & 0o022) !== 0) {\n throw refuse(\n releaseBinaryPath(props),\n `directory ${props.directory} is writable by group or other (mode ` +\n `${stat.mode.toString(8).padStart(4, '0')}), so whoever may write it may replace the ` +\n `binary; declare it 0755 or narrower. ${NOTHING}`,\n );\n }\n if (stat?.kind === 'directory') return;\n const why = stat === undefined ? 'does not exist' : `is a ${stat.kind}, not a directory`;\n throw refuse(\n releaseBinaryPath(props),\n `directory ${props.directory} ${why}; declare it (HostDirectory) and pass its path. ${NOTHING}`,\n );\n};\n\nexport type ReconcileOptions = {\n /** The attributes state holds; undefined on a create. */\n readonly output?: ReleaseBinaryAttributes | undefined;\n /** The props state holds; undefined on a create and on an adoption. */\n readonly olds?: ReleaseBinaryProps | undefined;\n /** adoptsAtApply's answer. What it may take over is convergeFile's ⛔. @default false */\n readonly adopt?: boolean;\n /** Progress for the deploy log — the engine's `session.note`. */\n readonly note?: (message: string) => Promise<void>;\n /**\n * What is wrong with the pins as the stack program DECLARED them (declared-pins.ts) — an Output\n * there resolves to a plausible plain string by the time it reaches `props`. @default []\n */\n readonly declared?: readonly string[];\n};\n\n/** Install the declared binary unless it is already there, and return it as read back. */\nexport const reconcileBinary = async (\n runner: HostRunner,\n fetch: FetchArchive,\n props: ReleaseBinaryProps,\n options: ReconcileOptions = {},\n): Promise<ReleaseBinaryAttributes> => {\n const { adopt = false, declared = [], note = async () => undefined } = options;\n // ⛔ FIRST, before any host call: a digest the deploy computed is a fetch by another name.\n if (declared.length > 0) {\n throw refuse(\n releaseBinaryPath(props),\n `${declared.join('; ')}. A pin is copied into reviewed code, never computed during the ` +\n `deploy (declared-pins.ts). ${NOTHING}`,\n );\n }\n const { download, want } = await desiredBinary(runner, props);\n // ⛔ The apply-time half of binary-diff.ts's in-place refusal, for an update whose `olds` say so.\n const olds = options.olds;\n if (olds !== undefined && releaseBinaryPath(olds) === want.path && pinsMoved(olds, props)) {\n throw refuse(want.path, `${inPlaceRefusal(olds, props)}. ${NOTHING}`);\n }\n await directoryReady(runner, props);\n // ⛔ WITH NO STATE, ONLY THE PINNED BINARY UNDER --adopt (binary-claim.ts).\n // ⚠️ NOT an update across a move (`output` at another path): --adopt can never speak for one, so\n // refusing identical bytes there would strand the resume of our own interrupted move with no\n // remedy but a hand removal. Other bytes there stay refused (file-converge.ts).\n if (options.output === undefined) {\n const problem = await claimProblem(runner, want, adopt);\n if (problem !== undefined) throw refuse(want.path, `${problem}. ${NOTHING}`);\n }\n const bytesFor = async (before: HostFileAttributes | undefined): Promise<Uint8Array> => {\n // ★ The right bytes with the wrong mode or owner: re-write what is there, re-hashed, rather\n // than download 123 MB to get the same bytes back.\n if (before?.sha256 === want.sha256) {\n const local = await runner.readFile(want.path);\n if (local !== undefined && sha256Hex(local) === want.sha256) return local;\n }\n await note(`downloading ${download.url} (${String(download.size)} bytes)`);\n try {\n const bytes = await verifiedMember(await fetch(download.url, download.size), download);\n await note(`verified ${download.member} ${download.memberSha256}`);\n return bytes;\n } catch (cause) {\n throw restated(want.path, cause);\n }\n };\n const spec = { bytesFor, owner: props.owner, refuse, want };\n return withSource(await convergeFile(runner, spec, options.output, adopt), download);\n};\n\n/** Remove the binary. Idempotent. ⛔ Refuses a path that has since become a symlink or directory. */\nexport const deleteBinary = (runner: HostRunner, output: ReleaseBinaryAttributes): Promise<void> =>\n removeWholeFile(runner, output, refuse);\n",
25
+ "/**\n * Release.Binary's `read` with no attributes. Alchemy asks it twice over (ownership/probe.ts): as\n * the ADOPTION PROBE (no row; `olds` is the declaration, `instanceId` fresh) and as the RECOVERY\n * READ of a row whose create never recorded attributes (`olds` and `instanceId` are the row's —\n * Plan.ts for a `creating` row, Apply.ts for such a row it must delete).\n *\n * ⛔ THE PROBE VALIDATES; THE RECOVERY READ NEVER FAILS ITS CALLER. The probe's `olds` is today's\n * declaration, so a malformed prop fails the plan there, before anything is touched. The recovery\n * read's `olds` is the FAILED deploy's props, and with `directory: dir.path` — the documented\n * usage — a first deploy commits its `creating` row while the directory is still an Output, so\n * the row has no `directory` at all. 🔴 MEASURED 2026-09-22 (adopt-parity.test.ts): after ANY\n * failed first install — a 404, a checksum mismatch, a mode refused at apply — every later plan\n * died with `TypeError: undefined is not an object (evaluating 'path.startsWith')`, the fixed\n * declaration included, and removing the declaration failed too (DestroyError: the orphan's\n * recovery read crashed the same way). The stage was bricked until a hand `alchemy state delete`.\n * ownership/probe.ts states the rule this broke: the recovery read \"NEVER FAILS THE CALLER\".\n * ★ \"NOTHING RECOVERED\" IS THE SAFE ANSWER, NOT `Unowned`. The plan then re-drives the create, and\n * reconcile looks at the path itself with every prop resolved: a file there is refused unless\n * `--adopt` (binary-claim.ts), exactly as ownership.md says a create interrupted while a prop was\n * an Output resumes. An orphan's row is dropped and its path left alone — a leak at worst, never\n * a delete of something unproven.\n * ★ THE ROW, NOT THE SHAPE OF `olds`, SAYS WHICH READ THIS IS: a probe's instance id is minted for\n * the probe, so no row holds it (ownership/rows.ts). Without a Stack or State in context a row\n * reads as absent, and this validates as the probe does — the behaviour before this file.\n */\nimport { Unowned } from 'alchemy/AdoptPolicy';\nimport * as Effect from 'effect/Effect';\nimport { lift } from '../launchd/host-effect.ts';\nimport type { HostRunner } from '../launchd/runner.ts';\nimport { recordedGeneration } from '../ownership/rows.ts';\nimport type { ReleaseBinaryProps } from './binary-form.ts';\nimport { readBinary } from './binary-lifecycle.ts';\n\ntype Ask = { readonly fqn: string; readonly instanceId: string; readonly olds: unknown };\n\n/** The file a declaration (or a row) names, as `Unowned` — or undefined when there is none. */\nexport const readWithoutState = (runner: HostRunner, ask: Ask) =>\n Effect.gen(function* () {\n const recovering = (yield* recordedGeneration(ask.fqn, ask.instanceId)) !== undefined;\n const read = lift(() => readBinary(runner, ask.olds as ReleaseBinaryProps));\n const found = recovering\n ? yield* read.pipe(\n Effect.catch((cause) =>\n Effect.as(\n Effect.logWarning(\n `${ask.fqn}: the interrupted create's row cannot locate its binary (${cause.message}); ` +\n 'nothing is recovered, and the create is re-driven with the declaration as it is now',\n ),\n undefined,\n ),\n ),\n )\n : yield* read;\n return found === undefined ? undefined : Unowned(found);\n });\n",
26
+ "/**\n * The pins as the STACK PROGRAM declared them — before the engine resolved a single Output — checked\n * at apply. The half of \"a pin is never computed during the deploy\" that a FIRST deploy needs.\n *\n * ⛔ WHY APPLY HAS TO ASK THE STACK, NOT `news`. By the time `reconcile` runs, the engine has\n * resolved every Output in `news`, so a digest wired from another resource (a checksum file read\n * at apply, a lookup, a computed value) arrives as a well-formed plain string, indistinguishable\n * from a reviewed pin. And on a first deploy nothing else looked: Alchemy never diffs a create,\n * and skips the adoption probe while `news` holds an Output (beta.79 Plan.ts). 🔴 MEASURED\n * 2026-09-22 (apply-pins.test.ts): a swapped archive plus the swapped digests, wired in as an\n * Output, installed the swapped bytes and the deploy reported success. binary-diff.ts refused the\n * same declaration only from the SECOND plan on, after the wrong binary was on the host.\n * ★ `Stack.resources[fqn].Props` IS WHAT THE PROGRAM PASSED, Outputs and all: Alchemy's\n * `Resource` records it at registration (beta.79 Resource.ts, `Props: props`), and the same Stack\n * reaches the apply (ownership/adopt.ts reads `Adopt` from the same record for the same reason).\n * pinProblems then sees the Output itself — a function-typed proxy, an Effect or a Config — and\n * refuses it as \"not a plain string\".\n * ⚠️ NO STACK, NO ANSWER. A handler called outside the engine (the fake-provider.ts harness) has no\n * Stack service and no registration to read, so this says nothing there; the engine always has\n * one. apply-pins.test.ts runs the real Plan and Apply, so an Alchemy upgrade that stops\n * recording `Props` there makes the swapped bytes install again, and fails that test by name.\n */\nimport { Stack } from 'alchemy/Stack';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport { pinProblems } from './binary-form.ts';\n\n/** Everything wrong with the pins of the resource at `fqn` as its stack program declared them. */\nexport const declaredPinProblems = (fqn: string): Effect.Effect<string[]> =>\n Effect.gen(function* () {\n const stack = yield* Effect.serviceOption(Stack);\n if (Option.isNone(stack)) return [];\n const declared: unknown = stack.value.resources[fqn]?.Props;\n if (typeof declared !== 'object' && typeof declared !== 'function') return [];\n if (declared === null) return [];\n return pinProblems(declared as Parameters<typeof pinProblems>[0]).map(\n (problem) => `as declared in the stack program, ${problem}`,\n );\n });\n",
27
+ "/**\n * One pinned release archive over Effect's `HttpClient`: status first, then the body read against\n * the pinned size, into memory.\n *\n * ★ `HttpClient`, THE HOUSE TRANSPORT (openbao/bao-http.ts, decided 2026-09-14) and Alchemy's own:\n * a typed error channel, interruption, and a client a test swaps for a fake. releaseProviders()\n * provides `FetchHttpClient.layer` itself, so a host stack that has no HTTP layer yet (the Mac\n * stack's has none) cannot forget it. ⚠️ fetch follows GitHub's 302 to its asset CDN (measured\n * 2026-09-22 with HEAD: a signed, expiring URL), so the status judged here is the CDN's.\n * ★ THE PINNED SIZE BOUNDS MEMORY. A body that runs past it is cut off at that byte, so a\n * misbehaving server or a swapped asset cannot stream an unbounded file into the deploy.\n * ★ NO API CALL. The browser-download URL needs no token and spends no API rate limit; the pins\n * say everything the release API would.\n * ⚠️ IN MEMORY: vmutils is 123.6 MB. Nothing is staged on disk, so no failure leaves a file behind.\n */\nimport type * as Duration from 'effect/Duration';\nimport * as Effect from 'effect/Effect';\nimport * as Schedule from 'effect/Schedule';\nimport * as Stream from 'effect/Stream';\nimport * as HttpClient from 'effect/unstable/http/HttpClient';\nimport { DownloadFailed } from './refused.ts';\n\n/** The provider's view of a transport: an archive's bytes by URL, never longer than `size`. */\nexport type FetchArchive = (url: string, size: number) => Promise<Uint8Array>;\n\n/** How patient a download is. ★ Parameters so a test never waits for real. */\nexport type DownloadPolicy = {\n /** @default '10 minutes' — 123.6 MB on a slow link, and still a bounded wait. */\n readonly timeout?: Duration.Input;\n /** Retries after the first attempt, transport failures and 5xx only. @default 2 */\n readonly retries?: number;\n /** @default '2 seconds' */\n readonly spacing?: Duration.Input;\n};\n\nconst failed = (message: string, retryable: boolean) => new DownloadFailed({ message, retryable });\n\nconst attempt = (url: string, size: number) =>\n Effect.gen(function* () {\n const client = yield* HttpClient.HttpClient;\n const response = yield* client.get(url);\n if (response.status !== 200) {\n return yield* failed(`${url}: HTTP ${String(response.status)}`, response.status >= 500);\n }\n // ★ ONE BUFFER OF THE PINNED SIZE, filled in place: no chunk list and no concatenating copy,\n // so the archive costs its own size in memory and not twice it.\n const archive = new Uint8Array(size);\n let total = 0;\n yield* Stream.runForEach(response.stream, (chunk) => {\n if (total + chunk.length > size) {\n return Effect.fail(failed(`${url}: runs past the pinned ${String(size)} bytes`, false));\n }\n archive.set(chunk, total);\n total += chunk.length;\n return Effect.void;\n });\n if (total !== size) {\n return yield* failed(`${url}: ${String(total)} bytes, the pin says ${String(size)}`, true);\n }\n return archive;\n }).pipe(\n // ⛔ `.message` only: it carries the reason, method and URL, and nothing else goes to the log.\n Effect.catchTag('HttpClientError', (cause) => Effect.fail(failed(cause.message, true))),\n );\n\n/** The archive's bytes, exactly `size` of them, or DownloadFailed. */\nexport const downloadPinned = (\n url: string,\n size: number,\n policy: DownloadPolicy = {},\n): Effect.Effect<Uint8Array, DownloadFailed, HttpClient.HttpClient> =>\n attempt(url, size).pipe(\n Effect.timeoutOrElse({\n duration: policy.timeout ?? '10 minutes',\n orElse: () => Effect.fail(failed(`${url}: no complete response in time`, false)),\n }),\n Effect.retry({\n schedule: Schedule.spaced(policy.spacing ?? '2 seconds'),\n times: policy.retries ?? 2,\n while: (error: DownloadFailed) => error.retryable,\n }),\n );\n\n/** A FetchArchive over one HttpClient. ⚠️ Rejects with the DownloadFailed itself. */\nexport const httpFetchArchive =\n (client: HttpClient.HttpClient, policy: DownloadPolicy = {}): FetchArchive =>\n (url, size) =>\n Effect.runPromise(\n downloadPinned(url, size, policy).pipe(Effect.provideService(HttpClient.HttpClient, client)),\n );\n\n/**\n * ★ ONE DOWNLOAD PER ARCHIVE AT A TIME, NOT ONE PER BINARY. vmagent and vmalert are two resources\n * in one 123.6 MB archive, and Alchemy reconciles independent resources concurrently (its fan-out\n * is unbounded, Apply.ts), so two requests for one URL share the download already in flight.\n * The entry goes when it settles: a later request downloads again rather than pinning 123 MB in\n * memory for the rest of the deploy.\n * ⚠️ The buffer is shared, so nothing downstream may write into it (archive.ts only reads).\n */\nexport const sharingInFlight = (fetch: FetchArchive): FetchArchive => {\n const inFlight = new Map<string, Promise<Uint8Array>>();\n return (url, size) => {\n const key = `${String(size)} ${url}`;\n const running = inFlight.get(key);\n if (running !== undefined) return running;\n const started = fetch(url, size).finally(() => inFlight.delete(key));\n inFlight.set(key, started);\n return started;\n };\n};\n",
28
+ "/**\n * A vendor's pinned releases as DATA, and the one way to turn an entry into Release.Binary props —\n * or into the reasons there is none. Pure: no network, no host.\n *\n * ★ THE DATA SITS BESIDE THE RESOURCE, NOT INSIDE IT. A catalog (victoria.ts is the first) is the\n * reviewed record of what one vendor published: exact asset names, sizes, both digest layers and\n * where each was copied from. The resource takes one pinned archive as props and never reads a\n * catalog, so adding a vendor is a data module with its own walk-down, never a resource change.\n * ★ A VERSION THE CATALOG DOES NOT LIST IS A REFUSAL, NOT A DOWNLOAD ATTEMPT. `catalogBinary()` runs\n * in the stack's own program — which `alchemy plan` evaluates — so an unknown version, a\n * `-enterprise` spelling or a `v` prefix fails the plan before any resource is asked anything,\n * let alone fetches a byte.\n * ⛔ ADD A VENDOR ONLY AFTER ITS OWN WALK-DOWN (docs/release-binary-catalogs.md): its checksum\n * format read byte-exact, and its binary's linkage measured (`otool -L`). Vendor binaries were\n * measured self-contained ONLY for the five Victoria ones; that is not a property of \"Go\".\n */\nimport type { ReleaseArchive, ReleaseBinaryProps } from './binary-form.ts';\nimport { BinaryRefused } from './refused.ts';\n\n/** One release archive as a catalog records it: the pin, plus where every digest came from. */\nexport interface PinnedArchive extends ReleaseArchive {\n /** Archive member → its SHA-256. Every member the vendor's checksum file lists, not just ours. */\n readonly members: Readonly<Record<string, string>>;\n /** The checksum file the digests were copied from, its own SHA-256, and when. Never fetched. */\n readonly checksums: { readonly url: string; readonly sha256: string; readonly recorded: string };\n}\n\n/** One package (one archive per version and platform) of a vendor. */\nexport interface CatalogPackage {\n /**\n * Installed name → archive member, written out, never derived: a member the vendor adds is\n * installable only once somebody names it here.\n */\n readonly binaries: Readonly<Record<string, string>>;\n /** Version (as the catalog spells it) → platform (the vendor's spelling) → archive. */\n readonly versions: Readonly<Record<string, Readonly<Record<string, PinnedArchive>>>>;\n}\n\n/** A vendor's pinned releases. */\nexport interface ReleaseCatalog {\n /** Who publishes these, for refusals: `'VictoriaMetrics'`. */\n readonly vendor: string;\n readonly packages: Readonly<Record<string, CatalogPackage>>;\n}\n\n/** Which binary a stack asks a catalog for. */\nexport type CatalogRequest = {\n readonly package: string;\n readonly version: string;\n readonly platform: string;\n /** The installed name — `vmalert`, not the member `vmalert-prod`. */\n readonly binary: string;\n};\n\n/** The pinned half of Release.Binary's props; the stack adds `directory`, `mode` and owner. */\nexport type PinnedBinary = Pick<ReleaseBinaryProps, 'archive' | 'member' | 'sha256' | 'name'>;\n\nconst quoted = (names: Iterable<string>): string => [...names].map((n) => `\"${n}\"`).join(', ');\n\n// ★ A plain boolean, not a type guard: on a `Record<string, …>` a guard narrows the miss to `never`.\nconst has = (record: object, key: string): boolean => Object.hasOwn(record, key);\n\n/** Everything wrong with a request against a catalog; empty when it resolves. */\nexport const catalogProblems = (catalog: ReleaseCatalog, request: CatalogRequest): string[] => {\n const entry = has(catalog.packages, request.package)\n ? catalog.packages[request.package]\n : undefined;\n if (entry === undefined) {\n return [\n `${catalog.vendor} package \"${request.package}\" is not in the catalog (${quoted(Object.keys(catalog.packages))})`,\n ];\n }\n const found: string[] = [];\n if (!has(entry.binaries, request.binary)) {\n // ⚠️ The vendor spelling is the likeliest mistake: the member is `vmalert-prod`, the binary\n // this installs is `vmalert`.\n const member = Object.values(entry.binaries).includes(request.binary);\n const hint = member ? ' (that is the archive member; name the installed binary)' : '';\n found.push(\n `${request.package} has no binary \"${request.binary}\"${hint}; it has ${quoted(Object.keys(entry.binaries))}`,\n );\n }\n const platforms = has(entry.versions, request.version)\n ? entry.versions[request.version]\n : undefined;\n if (platforms === undefined) {\n found.push(\n `${request.package} ${request.version} is not in the catalog (it pins ${quoted(Object.keys(entry.versions))}); ` +\n 'a new version is a reviewed change that pins its digests, never a download of whatever is there',\n );\n return found;\n }\n const archive = has(platforms, request.platform) ? platforms[request.platform] : undefined;\n if (archive === undefined) {\n found.push(\n `${request.package} ${request.version} is not pinned for platform \"${request.platform}\" (${quoted(Object.keys(platforms))})`,\n );\n } else if (found.length === 0) {\n const member = entry.binaries[request.binary] ?? '';\n if (!has(archive.members, member)) {\n found.push(\n `${request.package} ${request.version}'s checksum file lists no member \"${member}\"`,\n );\n }\n }\n return found;\n};\n\n/**\n * The pinned props for one binary out of a catalog. ⛔ Throws BinaryRefused for anything the\n * catalog does not pin — in a stack program, that fails the plan before anything is fetched.\n */\nexport const catalogBinary = (catalog: ReleaseCatalog, request: CatalogRequest): PinnedBinary => {\n const problems = catalogProblems(catalog, request);\n // ⚠️ Own keys only: `packages.constructor` is Object's, and would read as a package.\n const own = <V>(record: Readonly<Record<string, V>> | undefined, key: string): V | undefined =>\n record !== undefined && has(record, key) ? record[key] : undefined;\n const entry = own(catalog.packages, request.package);\n const archive = own(own(entry?.versions, request.version), request.platform);\n const member = own(entry?.binaries, request.binary);\n const sha256 = member === undefined ? undefined : own(archive?.members, member);\n if (\n problems.length > 0 ||\n archive === undefined ||\n member === undefined ||\n sha256 === undefined\n ) {\n throw new BinaryRefused({\n message: `Release.Binary ${request.binary}: ${problems.join('; ')}. Nothing was fetched.`,\n });\n }\n const { asset, repo, sha256: archiveSha256, size, tag } = archive;\n return {\n archive: { asset, repo, sha256: archiveSha256, size, tag },\n member,\n name: request.binary,\n sha256,\n };\n};\n\n/** `<root>/<package>-<version>`: one directory per version, so an upgrade is a new path. */\nexport const catalogDirectory = (\n root: string,\n request: Pick<CatalogRequest, 'package' | 'version'>,\n): string => `${root}/${request.package}-${request.version}`;\n\n/** What a catalog says an installed binary is, found by its SHA-256 alone. */\nexport type IdentifiedBinary = CatalogRequest & { readonly vendor: string };\n\n/**\n * Name an installed file by its digest — never by running it. ★ IDENTITY BY SHA-256: the running\n * Nix victoria-traces reports an empty version (`vm_app_version{version=\"\"}` on /metrics, measured\n * 2026-09-22 — its build sets no buildinfo), a stamped build prints `-version` to STDERR, not\n * stdout (lib/buildinfo, read, not run), and executing a binary to learn what it is runs the very\n * bytes whose provenance is the question. A digest needs a read, nothing more.\n */\nexport const identifyBinary = (\n catalogs: readonly ReleaseCatalog[],\n sha256: string,\n): IdentifiedBinary | undefined => {\n for (const catalog of catalogs) {\n for (const [pkg, entry] of Object.entries(catalog.packages)) {\n for (const [version, platforms] of Object.entries(entry.versions)) {\n for (const [platform, archive] of Object.entries(platforms)) {\n for (const [binary, member] of Object.entries(entry.binaries)) {\n if (archive.members[member] === sha256) {\n return { binary, package: pkg, platform, vendor: catalog.vendor, version };\n }\n }\n }\n }\n }\n }\n return undefined;\n};\n",
29
+ "/**\n * The release-binary provider with ONE HostRunner and its own HTTP client, as a single layer for a\n * host stack:\n *\n * const runner = localRunner();\n * Layer.mergeAll(launchdProviders(runner), releaseProviders(runner), …the stack's others)\n *\n * ★ PASS THE SAME RUNNER THE JOBS USE, so the binary and the daemon that runs it are written by one\n * identity on one host — a stack cannot install as one user and bootstrap as another by accident.\n * ⛔ THERE IS NO DEFAULT RUNNER. A binary is written wherever the runner reaches; a silent default to\n * \"this machine\" would install a Mac's daemons onto whichever laptop ran the deploy (the same\n * reasoning as linuxProviders()).\n * ★ `FetchHttpClient.layer` IS PROVIDED HERE, not left to the stack: the Mac host stack this exists\n * for provides no HTTP layer, and a missing one fails only at the first install.\n */\nimport * as Layer from 'effect/Layer';\nimport * as FetchHttpClient from 'effect/unstable/http/FetchHttpClient';\nimport { type HostRunner, hostRunnerLayer } from '../launchd/runner.ts';\nimport { ReleaseBinaryProvider } from './binary.ts';\n\nexport const releaseProviders = (runner: HostRunner) =>\n ReleaseBinaryProvider().pipe(\n Layer.provide(Layer.mergeAll(hostRunnerLayer(runner), FetchHttpClient.layer)),\n );\n",
30
+ "/**\n * VictoriaMetrics' release archives, pinned — the first data set for Release.Binary, and vendor\n * facts only: every digest copied from the vendor's own checksum file for that archive and\n * cross-checked against GitHub's asset digest ON THE RECORDED DATE. Nothing here names a host, a\n * path, a user or an estate. victoria.test.ts holds every pin to the committed checksum files\n * (fixtures/victoria/) — ⚠️ consistency, not provenance: it cannot re-read GitHub, so a fixture\n * edited together with its pins passes, and review is the gate for that.\n *\n * ★ PINNED IN CODE, NOT FETCHED AT APPLY. The checksum file is published by the same account, on\n * the same release, over the same channel as the archive it describes — and these releases are\n * MUTABLE (`\"immutable\": false` on v1.151.0, v1.52.0 and v0.10.0, measured 2026-09-22; the\n * vendor's own release Makefile says to delete an asset in the UI to re-upload it). Whoever can\n * swap an archive can swap its checksum file in the same minute, and a provider that trusts\n * whatever checksum file it finds would install the new bytes and call them verified. A pin\n * committed here changes only through a reviewed kit release, so a swapped asset is a REFUSAL\n * that names the digest it expected. It also means an apply makes one request, not two, and a\n * plan knows exactly which bytes it will install without touching the network.\n * ⚠️ TRUST ROOT. At apply, these pins alone: the transport (TLS, the redirect, the CDN) can fail\n * a download, never pass other bytes. The pins' own root is the GitHub release over TLS as read\n * on RECORDED (trust on first use), uploaded from a maintainer's personal account.\n * VictoriaMetrics publishes no signature, cosign bundle, SLSA provenance or GitHub artifact\n * attestation for these archives (measured 2026-09-22: no .sig/.asc/.pem/.bundle assets; the\n * attestations API answers 404 for all four digests, next to a positive control that answers\n * 200). A checksum file proves the download is not corrupt — integrity — not who built it.\n * ⛔ A NEW VERSION IS A NEW ENTRY, WALKED DOWN THE SAME WAY — docs/release-binary-catalogs.md.\n * Never `latest`, never sorted by publish date: VictoriaLogs v1.51.1 was published AFTER v1.52.0.\n * ⛔ EXACT NAMES. `-enterprise`, `-cluster` and `-enterprise-cluster` archives sit beside each of\n * these with every prefix in common, so each asset name below is written out whole — never\n * composed from a package and a version, which is how a template drifts onto a sibling.\n * ★ THE VENDOR'S `-prod` SUFFIX IS DROPPED ON PURPOSE: every member is `<binary>-prod`, and\n * installing it as `<binary>` keeps a job's argv[0], `ps` and `pgrep` names identical to the\n * builds it replaces. The map is written out per package, never derived.\n */\nimport type { ReleaseCatalog } from './catalog.ts';\n\nconst RECORDED = '2026-09-22';\nconst DOWNLOAD = 'https://github.com/VictoriaMetrics';\n\nexport const VICTORIA_RELEASES: ReleaseCatalog = {\n packages: {\n 'victoria-logs': {\n binaries: { 'victoria-logs': 'victoria-logs-prod' },\n versions: {\n '1.52.0': {\n 'darwin-arm64': {\n asset: 'victoria-logs-darwin-arm64-v1.52.0.tar.gz',\n checksums: {\n recorded: RECORDED,\n sha256: 'd4ca686c3cceec78a0f4e733ef9ab3f857549131ea48cd6f89f701cda406ac4b',\n url: `${DOWNLOAD}/VictoriaLogs/releases/download/v1.52.0/victoria-logs-darwin-arm64-v1.52.0_checksums.txt`,\n },\n members: {\n 'victoria-logs-prod':\n '9e48809e314902782959b3a4e683a3087476759d0293791a0564921c676ca7be',\n },\n repo: 'VictoriaMetrics/VictoriaLogs',\n sha256: '3157d4b6181d8a7e3e30918e2cbfcd4cc4cb66263e3ef21ea91e4f20f8980883',\n size: 10_943_697,\n tag: 'v1.52.0',\n },\n },\n },\n },\n 'victoria-metrics': {\n // ⛔ The SINGLE-NODE archive. `…-cluster.tar.gz` holds vminsert/vmselect/vmstorage instead.\n binaries: { 'victoria-metrics': 'victoria-metrics-prod' },\n versions: {\n '1.151.0': {\n 'darwin-arm64': {\n asset: 'victoria-metrics-darwin-arm64-v1.151.0.tar.gz',\n checksums: {\n recorded: RECORDED,\n sha256: '735745ee0e7b2d5b8118883f2d0ed124c2a12d70261c16380128f5e362566d1e',\n url: `${DOWNLOAD}/VictoriaMetrics/releases/download/v1.151.0/victoria-metrics-darwin-arm64-v1.151.0_checksums.txt`,\n },\n members: {\n 'victoria-metrics-prod':\n '3c493a95ac1e9034a3261b230c4d62f3b186a04aafcdbacc99bfc110dc5de6a1',\n },\n repo: 'VictoriaMetrics/VictoriaMetrics',\n sha256: '8792437c4c0b63719fed7b44ad18d4b4167bbe6861ab3e84c7bb010c922e7582',\n size: 12_739_105,\n tag: 'v1.151.0',\n },\n },\n },\n },\n 'victoria-traces': {\n binaries: { 'victoria-traces': 'victoria-traces-prod' },\n versions: {\n '0.10.0': {\n 'darwin-arm64': {\n asset: 'victoria-traces-darwin-arm64-v0.10.0.tar.gz',\n checksums: {\n recorded: RECORDED,\n sha256: 'cd32bfc21900b48ba543124e43827a1d13d735e45d50dbfd742c0ca6640e1aae',\n url: `${DOWNLOAD}/VictoriaTraces/releases/download/v0.10.0/victoria-traces-darwin-arm64-v0.10.0_checksums.txt`,\n },\n members: {\n 'victoria-traces-prod':\n '4759ec89a466129b9eefc22244a111e1f489739340747805fd93b58fd0f7b2dd',\n },\n repo: 'VictoriaMetrics/VictoriaTraces',\n sha256: 'cbe83f1d409cbb85fbf1c890c4a9b7fd34c1d74acec4dce2e0ebe46fcb260e38',\n size: 11_126_077,\n tag: 'v0.10.0',\n },\n },\n },\n },\n vmutils: {\n // ★ ONE ARCHIVE, SEVEN TOOLS (measured: 264 MB unpacked). Only a declared member is extracted.\n // vmalert-logs is not a tool of its own: it is vmalert run with `--rule.defaultRuleType=vlogs`.\n binaries: {\n vmagent: 'vmagent-prod',\n vmalert: 'vmalert-prod',\n 'vmalert-tool': 'vmalert-tool-prod',\n vmauth: 'vmauth-prod',\n vmbackup: 'vmbackup-prod',\n vmctl: 'vmctl-prod',\n vmrestore: 'vmrestore-prod',\n },\n versions: {\n '1.151.0': {\n 'darwin-arm64': {\n asset: 'vmutils-darwin-arm64-v1.151.0.tar.gz',\n checksums: {\n recorded: RECORDED,\n sha256: 'fda5a64fce9022bee7614c3fda27271c0826f1d7b90f8b162e1f48c77c0df04b',\n url: `${DOWNLOAD}/VictoriaMetrics/releases/download/v1.151.0/vmutils-darwin-arm64-v1.151.0_checksums.txt`,\n },\n members: {\n 'vmagent-prod': 'd3b6fa1f71ef48beac619f15f8adfa7610e76605caf37db1ebfbb379b6692329',\n 'vmalert-prod': '62845795167e9ff47890e83ac4ac5934693c105767db88591c95a08f3c4fb354',\n 'vmalert-tool-prod':\n 'cbffb9495e4bb1457c9d45e0a7064b3a3a29b2cfd1ae24bfe8f00ec327c26998',\n // ⚠️ gitleaks' generic-api-key rule reads this one public digest as a key (its\n // entropy; measured 2026-09-22). It is the vendor's published SHA-256 of vmauth-prod.\n 'vmauth-prod': '398df9e0f5b7035d037e39ee9ff66a10ddde5333d832602463aa4d2865fdb508', // gitleaks:allow\n 'vmbackup-prod': '1974a2ee211b49bf581287808e010846f6c47ff135276214c6da628567777b9e',\n 'vmctl-prod': '998b111eee206b98e6d25fdf2fbaa455ecc17c7f9e7c3b2373e127cef762459f',\n 'vmrestore-prod': 'fc824df7215b01b57921ed46afde7fea6b6698adf13d9ea8e3fe36e194ef8190',\n },\n repo: 'VictoriaMetrics/VictoriaMetrics',\n sha256: '27d68bac90e28929214091ed9d27f2e9fef25a080407e2c8661ea9b52dd6b183',\n size: 123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,YACA,MAAM;AAAA,YACN,QAAQ;AAAA,YACR,MAAM;AAAA,YACN,KAAK;AAAA,UACP;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,QAAQ;AACV;",
33
+ "debugId": "F5F53F961865973E64756E2164756E21",
34
+ "names": []
35
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The release-binary provider with ONE HostRunner and its own HTTP client, as a single layer for a
3
+ * host stack:
4
+ *
5
+ * const runner = localRunner();
6
+ * Layer.mergeAll(launchdProviders(runner), releaseProviders(runner), …the stack's others)
7
+ *
8
+ * ★ PASS THE SAME RUNNER THE JOBS USE, so the binary and the daemon that runs it are written by one
9
+ * identity on one host — a stack cannot install as one user and bootstrap as another by accident.
10
+ * ⛔ THERE IS NO DEFAULT RUNNER. A binary is written wherever the runner reaches; a silent default to
11
+ * "this machine" would install a Mac's daemons onto whichever laptop ran the deploy (the same
12
+ * reasoning as linuxProviders()).
13
+ * ★ `FetchHttpClient.layer` IS PROVIDED HERE, not left to the stack: the Mac host stack this exists
14
+ * for provides no HTTP layer, and a missing one fails only at the first install.
15
+ */
16
+ import * as Layer from 'effect/Layer';
17
+ import { type HostRunner } from '../launchd/runner.ts';
18
+ export declare const releaseProviders: (runner: HostRunner) => Layer.Layer<import("alchemy").Provider<import("./binary.ts").ReleaseBinary>, never, never>;
19
+ //# sourceMappingURL=providers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/release/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,sBAAsB,CAAC;AAGxE,eAAO,MAAM,gBAAgB,WAAY,UAAU,+FAGhD,CAAC"}
@@ -0,0 +1,39 @@
1
+ declare const BinaryRefused_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
2
+ readonly _tag: "BinaryRefused";
3
+ } & Readonly<A>;
4
+ /** The declaration itself: a version no catalog pins, a malformed pin, a bad path or mode. */
5
+ export declare class BinaryRefused extends BinaryRefused_base<{
6
+ readonly message: string;
7
+ }> {
8
+ }
9
+ declare const DownloadFailed_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
10
+ readonly _tag: "DownloadFailed";
11
+ } & Readonly<A>;
12
+ /** The download: a status that is not 200, a body that is not the pinned size, a dead transport. */
13
+ export declare class DownloadFailed extends DownloadFailed_base<{
14
+ readonly message: string;
15
+ /** Worth another attempt: a transport failure or a 5xx, never a wrong size or a 404. */
16
+ readonly retryable: boolean;
17
+ }> {
18
+ }
19
+ declare const ChecksumMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
20
+ readonly _tag: "ChecksumMismatch";
21
+ } & Readonly<A>;
22
+ /** Bytes that do not hash to their pin — the archive, or a member extracted from it. */
23
+ export declare class ChecksumMismatch extends ChecksumMismatch_base<{
24
+ readonly message: string;
25
+ readonly subject: string;
26
+ readonly expected: string;
27
+ readonly actual: string;
28
+ }> {
29
+ }
30
+ declare const ArchiveRefused_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
31
+ readonly _tag: "ArchiveRefused";
32
+ } & Readonly<A>;
33
+ /** An archive this reader will not trust: an unsafe or unexpected entry, a missing member. */
34
+ export declare class ArchiveRefused extends ArchiveRefused_base<{
35
+ readonly message: string;
36
+ }> {
37
+ }
38
+ export {};
39
+ //# sourceMappingURL=refused.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refused.d.ts","sourceRoot":"","sources":["../../src/release/refused.ts"],"names":[],"mappings":";;;AAgBA,8FAA8F;AAC9F,qBAAa,aAAc,SAAQ,mBAAkC;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;CAAG;;;;AAEL,oGAAoG;AACpG,qBAAa,cAAe,SAAQ,oBAAmC;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wFAAwF;IACxF,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B,CAAC;CAAG;;;;AAEL,wFAAwF;AACxF,qBAAa,gBAAiB,SAAQ,sBAAqC;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;CAAG;;;;AAEL,8FAA8F;AAC9F,qBAAa,cAAe,SAAQ,oBAAmC;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;CAAG"}
@@ -0,0 +1,14 @@
1
+ /** Concatenate chunks into one buffer. */
2
+ export declare const concatBytes: (parts: readonly Uint8Array[]) => Uint8Array;
3
+ export type TarContents = {
4
+ /** The asked-for regular files, by exact name. An asked-for name that is absent is absent here. */
5
+ readonly members: ReadonlyMap<string, Uint8Array>;
6
+ /** Every entry name, in archive order — so a refusal can say what the archive did hold. */
7
+ readonly names: readonly string[];
8
+ };
9
+ /** A push parser: `push` each chunk of the unzipped stream, then `finish`. Either may throw. */
10
+ export declare const tarReader: (wanted: ReadonlySet<string>) => {
11
+ finish: () => TarContents;
12
+ push: (chunk: Uint8Array) => void;
13
+ };
14
+ //# sourceMappingURL=tar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tar.d.ts","sourceRoot":"","sources":["../../src/release/tar.ts"],"names":[],"mappings":"AAqFA,0CAA0C;AAC1C,eAAO,MAAM,WAAW,UAAW,SAAS,UAAU,EAAE,KAAG,UAQ1D,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,mGAAmG;IACnG,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAClD,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,SAAS,WAAY,WAAW,CAAC,MAAM,CAAC;kBAoFhC,WAAW;kBAlCT,UAAU,KAAG,IAAI;CAwCvC,CAAC"}