@smthrs/platform-node 1.0.0-rc.4 → 1.0.0-rc.6

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 (278) hide show
  1. package/README.md +2 -2
  2. package/bin/darwin-arm64/smithers-jj-export +0 -0
  3. package/bin/darwin-x64/smithers-jj-export +0 -0
  4. package/bin/linux-arm64/smithers-jj-export +0 -0
  5. package/bin/linux-x64/smithers-jj-export +2 -2
  6. package/bin/win32-x64/smithers-jj-export.exe +0 -0
  7. package/dist/cjs/EgressHttpClient.d.ts +1 -1
  8. package/dist/cjs/EgressHttpClient.d.ts.map +1 -1
  9. package/dist/cjs/EgressHttpClient.js +4 -4
  10. package/dist/cjs/EgressHttpClient.js.map +2 -2
  11. package/dist/cjs/NodeHost.d.ts +2 -2
  12. package/dist/cjs/NodeHost.d.ts.map +1 -1
  13. package/dist/cjs/NodeHost.js.map +2 -2
  14. package/dist/cjs/ProcessConfinement.js +1 -1
  15. package/dist/cjs/ProcessConfinement.js.map +2 -2
  16. package/dist/cjs/ProcessReaper.d.ts +1 -1
  17. package/dist/cjs/ProcessReaper.d.ts.map +1 -1
  18. package/dist/cjs/ProcessReaper.js +1 -1
  19. package/dist/cjs/ProcessReaper.js.map +1 -1
  20. package/dist/cjs/ScopedProcess.d.ts +2 -2
  21. package/dist/cjs/ScopedProcess.d.ts.map +1 -1
  22. package/dist/cjs/ScopedProcess.js +1 -1
  23. package/dist/cjs/ScopedProcess.js.map +2 -2
  24. package/dist/cjs/internal/PipedProcess.d.ts +2 -2
  25. package/dist/cjs/internal/PipedProcess.d.ts.map +1 -1
  26. package/dist/cjs/internal/PipedProcess.js +2 -2
  27. package/dist/cjs/internal/PipedProcess.js.map +2 -2
  28. package/dist/cjs/internal/ProcessCleanup.d.ts +1 -1
  29. package/dist/cjs/internal/ProcessCleanup.d.ts.map +1 -1
  30. package/dist/cjs/internal/ProcessCleanup.js.map +1 -1
  31. package/dist/cjs/internal/ProcessSupervisor.d.ts +2 -2
  32. package/dist/cjs/internal/ProcessSupervisor.d.ts.map +1 -1
  33. package/dist/cjs/internal/ProcessSupervisor.js +2 -2
  34. package/dist/cjs/internal/ProcessSupervisor.js.map +2 -2
  35. package/dist/esm/EgressHttpClient.d.ts +1 -1
  36. package/dist/esm/EgressHttpClient.d.ts.map +1 -1
  37. package/dist/esm/EgressHttpClient.js +4 -4
  38. package/dist/esm/EgressHttpClient.js.map +1 -1
  39. package/dist/esm/NodeHost.d.ts +2 -2
  40. package/dist/esm/NodeHost.d.ts.map +1 -1
  41. package/dist/esm/NodeHost.js.map +1 -1
  42. package/dist/esm/ProcessConfinement.js +1 -1
  43. package/dist/esm/ProcessConfinement.js.map +1 -1
  44. package/dist/esm/ProcessReaper.d.ts +1 -1
  45. package/dist/esm/ProcessReaper.d.ts.map +1 -1
  46. package/dist/esm/ProcessReaper.js +1 -1
  47. package/dist/esm/ProcessReaper.js.map +1 -1
  48. package/dist/esm/ScopedProcess.d.ts +2 -2
  49. package/dist/esm/ScopedProcess.d.ts.map +1 -1
  50. package/dist/esm/ScopedProcess.js +1 -1
  51. package/dist/esm/ScopedProcess.js.map +1 -1
  52. package/dist/esm/internal/PipedProcess.d.ts +2 -2
  53. package/dist/esm/internal/PipedProcess.d.ts.map +1 -1
  54. package/dist/esm/internal/PipedProcess.js +2 -2
  55. package/dist/esm/internal/PipedProcess.js.map +1 -1
  56. package/dist/esm/internal/ProcessCleanup.d.ts +1 -1
  57. package/dist/esm/internal/ProcessCleanup.d.ts.map +1 -1
  58. package/dist/esm/internal/ProcessCleanup.js.map +1 -1
  59. package/dist/esm/internal/ProcessSupervisor.d.ts +2 -2
  60. package/dist/esm/internal/ProcessSupervisor.d.ts.map +1 -1
  61. package/dist/esm/internal/ProcessSupervisor.js +2 -2
  62. package/dist/esm/internal/ProcessSupervisor.js.map +1 -1
  63. package/dist/vendor/adapters.json +622 -382
  64. package/dist/vendor/{chunk-42QKY6T6.js → chunk-2ZAGBWTH.js} +1 -1
  65. package/dist/vendor/{chunk-3GR5VZ2M.js → chunk-3SL3HKQA.js} +3 -3
  66. package/dist/vendor/{chunk-VANKHF46.js → chunk-423HXGL6.js} +55 -23
  67. package/dist/vendor/{chunk-6ME2W7TF.js → chunk-4WIQ2XN7.js} +2 -2
  68. package/dist/vendor/{chunk-Y35ZAO5U.js → chunk-6FSJ2PMW.js} +8 -8
  69. package/dist/vendor/{chunk-5ZMHBXIK.js → chunk-6L2NJEOV.js} +11 -4
  70. package/dist/vendor/{chunk-TFIKFFSC.js → chunk-7NMJM44J.js} +2 -2
  71. package/dist/vendor/{chunk-OXNGN5H7.js → chunk-A7UXCEJA.js} +1 -1
  72. package/dist/vendor/chunk-ADP5LRUF.js +274 -0
  73. package/dist/vendor/{chunk-DS7GF46S.js → chunk-AWNTTSHL.js} +2 -2
  74. package/dist/vendor/{chunk-IIJ52ZU6.js → chunk-BUKVIAEM.js} +2 -2
  75. package/dist/vendor/{chunk-BKTBUBQY.js → chunk-BY3SDXID.js} +71 -7
  76. package/dist/vendor/{chunk-JJ24ARBQ.js → chunk-C3PGUWW5.js} +53 -33
  77. package/dist/vendor/{chunk-J7A4CZDO.js → chunk-D2ZL4PLZ.js} +8 -7
  78. package/dist/vendor/{chunk-XDKNKFBW.js → chunk-D4HEMNGU.js} +2 -2
  79. package/dist/vendor/{chunk-DVOAHXPG.js → chunk-FFD6R5JZ.js} +3 -3
  80. package/dist/vendor/{chunk-UFH5UUZK.js → chunk-HDV6VIRM.js} +1 -1
  81. package/dist/vendor/chunk-IWSDM4CG.js +16 -0
  82. package/dist/vendor/{chunk-KUUXSID7.js → chunk-KABHKTVG.js} +2 -2
  83. package/dist/vendor/{chunk-B3FZ67QU.js → chunk-KFDBU6RR.js} +4 -3
  84. package/dist/vendor/chunk-LNWGIDIG.js +20 -0
  85. package/dist/vendor/{chunk-TXKLEBBL.js → chunk-MUEED3C3.js} +3 -2
  86. package/dist/vendor/{chunk-EZWY45HP.js → chunk-N6TK35N5.js} +2 -2
  87. package/dist/vendor/{chunk-QPLDT6A6.js → chunk-NQO6V4KI.js} +29 -13
  88. package/dist/vendor/{chunk-AMQKOQNT.js → chunk-NTEWGPPG.js} +9 -9
  89. package/dist/vendor/chunk-NUJQMLJP.js +325 -0
  90. package/dist/vendor/{chunk-54RLBMTZ.js → chunk-OF3N2FN4.js} +1 -1
  91. package/dist/vendor/{chunk-RO2R4MJH.js → chunk-PA32ARKD.js} +17 -17
  92. package/dist/vendor/{chunk-JG5TTWPT.js → chunk-PECOFLCU.js} +3 -3
  93. package/dist/vendor/{chunk-VZBDV3TV.js → chunk-PU7QVYND.js} +2 -2
  94. package/dist/vendor/{chunk-2Y7WC4KU.js → chunk-QHR2RC5M.js} +2 -2
  95. package/dist/vendor/{chunk-QYBKAIA6.js → chunk-R327POEZ.js} +2 -2
  96. package/dist/vendor/chunk-RKVXYKHJ.js +29 -0
  97. package/dist/vendor/{chunk-XH4U3JSV.js → chunk-RQH5DSBA.js} +2 -2
  98. package/dist/vendor/{chunk-DWSHTSVX.js → chunk-S6QUQLBV.js} +5 -5
  99. package/dist/vendor/{chunk-KOZMM5PZ.js → chunk-UPIQ52FQ.js} +12 -12
  100. package/dist/vendor/{chunk-EGBNVEEW.js → chunk-UUQXJRMK.js} +1 -1
  101. package/dist/vendor/{chunk-LEUPYT3Q.js → chunk-UUYTTEDH.js} +1 -1
  102. package/dist/vendor/{chunk-NBVRTDTV.js → chunk-V2EB7FHY.js} +2 -2
  103. package/dist/vendor/{chunk-M32LDTW7.js → chunk-VIWU4EBF.js} +2 -2
  104. package/dist/vendor/{chunk-SIR62W3Y.js → chunk-VWSWEUN5.js} +51 -31
  105. package/dist/vendor/{chunk-MBSKBQ5D.js → chunk-WPZDL2D7.js} +1 -1
  106. package/dist/vendor/chunk-YDY5P7GL.js +20 -0
  107. package/dist/vendor/{chunk-FNZOJHSV.js → chunk-YFD4QFIL.js} +17 -17
  108. package/dist/vendor/{chunk-GXCHI7BM.js → chunk-ZVJCBTJG.js} +5 -5
  109. package/dist/vendor/cjs/node/NodeAddressResolver.d.ts +16 -0
  110. package/dist/vendor/cjs/node/NodeAddressResolver.js +1 -0
  111. package/dist/vendor/cjs/node/NodeChildProcessSpawner.d.ts +1 -0
  112. package/dist/vendor/cjs/node/NodeClusterHttp.d.ts +13 -22
  113. package/dist/vendor/cjs/node/NodeClusterSocket.d.ts +14 -8
  114. package/dist/vendor/cjs/node/NodeCrypto.d.ts +1 -0
  115. package/dist/vendor/cjs/node/NodeDatagramSocket.d.ts +10 -0
  116. package/dist/vendor/cjs/node/NodeDatagramSocket.js +1 -0
  117. package/dist/vendor/cjs/node/NodeDns.d.ts +51 -0
  118. package/dist/vendor/cjs/node/NodeDns.js +1 -0
  119. package/dist/vendor/cjs/node/NodeFileSystem.d.ts +1 -0
  120. package/dist/vendor/cjs/node/NodeHttpClient.d.ts +21 -2
  121. package/dist/vendor/cjs/node/NodeHttpIncomingMessage.d.ts +5 -3
  122. package/dist/vendor/cjs/node/NodeHttpPlatform.d.ts +8 -6
  123. package/dist/vendor/cjs/node/NodeHttpServer.d.ts +21 -10
  124. package/dist/vendor/cjs/node/NodeHttpServerRequest.d.ts +4 -1
  125. package/dist/vendor/cjs/node/NodeMultipart.d.ts +5 -1
  126. package/dist/vendor/cjs/node/NodeMultipartParser.d.ts +9 -1
  127. package/dist/vendor/cjs/node/NodePath.d.ts +3 -0
  128. package/dist/vendor/cjs/node/NodeRedis.d.ts +5 -1
  129. package/dist/vendor/cjs/node/NodeRuntime.d.ts +3 -0
  130. package/dist/vendor/cjs/node/NodeServices.d.ts +4 -1
  131. package/dist/vendor/cjs/node/NodeSink.d.ts +1 -0
  132. package/dist/vendor/cjs/node/NodeSocket.d.ts +10 -3
  133. package/dist/vendor/cjs/node/NodeSocketServer.d.ts +1 -0
  134. package/dist/vendor/cjs/node/NodeStdio.d.ts +1 -0
  135. package/dist/vendor/cjs/node/NodeStream.d.ts +1 -0
  136. package/dist/vendor/cjs/node/NodeTerminal.d.ts +6 -3
  137. package/dist/vendor/cjs/node/NodeWorker.d.ts +3 -1
  138. package/dist/vendor/cjs/node/NodeWorkerRunner.d.ts +2 -1
  139. package/dist/vendor/cjs/node/Undici.d.ts +3 -0
  140. package/dist/vendor/cjs/node/index.d.ts +40 -0
  141. package/dist/vendor/cjs/node-shared/NodeAddressResolver.d.ts +13 -0
  142. package/dist/vendor/cjs/node-shared/NodeAddressResolver.js +1 -0
  143. package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.d.ts +12 -3
  144. package/dist/vendor/cjs/node-shared/NodeClusterSocket.d.ts +17 -4
  145. package/dist/vendor/cjs/node-shared/NodeCrypto.d.ts +3 -0
  146. package/dist/vendor/cjs/node-shared/NodeDatagramSocket.d.ts +246 -0
  147. package/dist/vendor/cjs/node-shared/NodeDatagramSocket.js +1 -0
  148. package/dist/vendor/cjs/node-shared/NodeDns.d.ts +221 -0
  149. package/dist/vendor/cjs/node-shared/NodeDns.js +1 -0
  150. package/dist/vendor/cjs/node-shared/NodeFileSystem.d.ts +1 -0
  151. package/dist/vendor/cjs/node-shared/NodeHttpCompression.d.ts +5 -1
  152. package/dist/vendor/cjs/node-shared/NodePath.d.ts +3 -0
  153. package/dist/vendor/cjs/node-shared/NodeRuntime.d.ts +4 -0
  154. package/dist/vendor/cjs/node-shared/NodeSink.d.ts +4 -0
  155. package/dist/vendor/cjs/node-shared/NodeSocket.d.ts +11 -1
  156. package/dist/vendor/cjs/node-shared/NodeSocketServer.d.ts +8 -1
  157. package/dist/vendor/cjs/node-shared/NodeStdio.d.ts +1 -0
  158. package/dist/vendor/cjs/node-shared/NodeStream.d.ts +15 -0
  159. package/dist/vendor/cjs/node-shared/NodeTerminal.d.ts +6 -4
  160. package/dist/vendor/cjs/node-shared/index.d.ts +29 -0
  161. package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.d.ts +1 -1
  162. package/dist/vendor/cjs/platform-node-shared.d.ts +29 -0
  163. package/dist/vendor/cjs/platform-node.d.ts +40 -0
  164. package/dist/vendor/node/NodeAddressResolver.d.ts +16 -0
  165. package/dist/vendor/node/NodeAddressResolver.js +8 -0
  166. package/dist/vendor/node/NodeChildProcessSpawner.d.ts +1 -0
  167. package/dist/vendor/node/NodeChildProcessSpawner.js +6 -6
  168. package/dist/vendor/node/NodeClusterHttp.d.ts +13 -22
  169. package/dist/vendor/node/NodeClusterHttp.js +32 -32
  170. package/dist/vendor/node/NodeClusterSocket.d.ts +14 -8
  171. package/dist/vendor/node/NodeClusterSocket.js +15 -15
  172. package/dist/vendor/node/NodeCrypto.d.ts +1 -0
  173. package/dist/vendor/node/NodeCrypto.js +2 -2
  174. package/dist/vendor/node/NodeDatagramSocket.d.ts +10 -0
  175. package/dist/vendor/node/NodeDatagramSocket.js +12 -0
  176. package/dist/vendor/node/NodeDns.d.ts +51 -0
  177. package/dist/vendor/node/NodeDns.js +12 -0
  178. package/dist/vendor/node/NodeFileSystem.d.ts +1 -0
  179. package/dist/vendor/node/NodeFileSystem.js +3 -3
  180. package/dist/vendor/node/NodeHttpClient.d.ts +21 -2
  181. package/dist/vendor/node/NodeHttpClient.js +6 -6
  182. package/dist/vendor/node/NodeHttpIncomingMessage.d.ts +5 -3
  183. package/dist/vendor/node/NodeHttpIncomingMessage.js +4 -4
  184. package/dist/vendor/node/NodeHttpPlatform.d.ts +8 -6
  185. package/dist/vendor/node/NodeHttpPlatform.js +8 -8
  186. package/dist/vendor/node/NodeHttpServer.d.ts +21 -10
  187. package/dist/vendor/node/NodeHttpServer.js +26 -26
  188. package/dist/vendor/node/NodeHttpServerRequest.d.ts +4 -1
  189. package/dist/vendor/node/NodeHttpServerRequest.js +1 -1
  190. package/dist/vendor/node/NodeMultipart.d.ts +5 -1
  191. package/dist/vendor/node/NodeMultipart.js +5 -5
  192. package/dist/vendor/node/NodeMultipartParser.d.ts +9 -1
  193. package/dist/vendor/node/NodeMultipartParser.js +1 -1
  194. package/dist/vendor/node/NodePath.d.ts +3 -0
  195. package/dist/vendor/node/NodePath.js +2 -2
  196. package/dist/vendor/node/NodeRedis.d.ts +5 -1
  197. package/dist/vendor/node/NodeRedis.js +1 -1
  198. package/dist/vendor/node/NodeRuntime.d.ts +3 -0
  199. package/dist/vendor/node/NodeRuntime.js +2 -2
  200. package/dist/vendor/node/NodeServices.d.ts +4 -1
  201. package/dist/vendor/node/NodeServices.js +17 -17
  202. package/dist/vendor/node/NodeSink.d.ts +1 -0
  203. package/dist/vendor/node/NodeSink.js +2 -2
  204. package/dist/vendor/node/NodeSocket.d.ts +10 -3
  205. package/dist/vendor/node/NodeSocket.js +2 -2
  206. package/dist/vendor/node/NodeSocketServer.d.ts +1 -0
  207. package/dist/vendor/node/NodeSocketServer.js +3 -3
  208. package/dist/vendor/node/NodeStdio.d.ts +1 -0
  209. package/dist/vendor/node/NodeStdio.js +4 -4
  210. package/dist/vendor/node/NodeStream.d.ts +1 -0
  211. package/dist/vendor/node/NodeStream.js +3 -3
  212. package/dist/vendor/node/NodeTerminal.d.ts +6 -3
  213. package/dist/vendor/node/NodeTerminal.js +2 -2
  214. package/dist/vendor/node/NodeWorker.d.ts +3 -1
  215. package/dist/vendor/node/NodeWorker.js +1 -1
  216. package/dist/vendor/node/NodeWorkerRunner.d.ts +2 -1
  217. package/dist/vendor/node/NodeWorkerRunner.js +1 -1
  218. package/dist/vendor/node/Undici.d.ts +3 -0
  219. package/dist/vendor/node/Undici.js +1 -1
  220. package/dist/vendor/node/index.d.ts +40 -0
  221. package/dist/vendor/node/index.js +70 -55
  222. package/dist/vendor/node-shared/NodeAddressResolver.d.ts +13 -0
  223. package/dist/vendor/node-shared/NodeAddressResolver.js +7 -0
  224. package/dist/vendor/node-shared/NodeChildProcessSpawner.d.ts +12 -3
  225. package/dist/vendor/node-shared/NodeChildProcessSpawner.js +5 -5
  226. package/dist/vendor/node-shared/NodeClusterSocket.d.ts +17 -4
  227. package/dist/vendor/node-shared/NodeClusterSocket.js +3 -3
  228. package/dist/vendor/node-shared/NodeCrypto.d.ts +3 -0
  229. package/dist/vendor/node-shared/NodeCrypto.js +1 -1
  230. package/dist/vendor/node-shared/NodeDatagramSocket.d.ts +246 -0
  231. package/dist/vendor/node-shared/NodeDatagramSocket.js +11 -0
  232. package/dist/vendor/node-shared/NodeDns.d.ts +221 -0
  233. package/dist/vendor/node-shared/NodeDns.js +31 -0
  234. package/dist/vendor/node-shared/NodeFileSystem.d.ts +1 -0
  235. package/dist/vendor/node-shared/NodeFileSystem.js +2 -2
  236. package/dist/vendor/node-shared/NodeHttpCompression.d.ts +5 -1
  237. package/dist/vendor/node-shared/NodeHttpCompression.js +1 -1
  238. package/dist/vendor/node-shared/NodePath.d.ts +3 -0
  239. package/dist/vendor/node-shared/NodePath.js +1 -1
  240. package/dist/vendor/node-shared/NodeRuntime.d.ts +4 -0
  241. package/dist/vendor/node-shared/NodeRuntime.js +1 -1
  242. package/dist/vendor/node-shared/NodeSink.d.ts +4 -0
  243. package/dist/vendor/node-shared/NodeSink.js +1 -1
  244. package/dist/vendor/node-shared/NodeSocket.d.ts +11 -1
  245. package/dist/vendor/node-shared/NodeSocket.js +1 -1
  246. package/dist/vendor/node-shared/NodeSocketServer.d.ts +8 -1
  247. package/dist/vendor/node-shared/NodeSocketServer.js +2 -2
  248. package/dist/vendor/node-shared/NodeStdio.d.ts +1 -0
  249. package/dist/vendor/node-shared/NodeStdio.js +3 -3
  250. package/dist/vendor/node-shared/NodeStream.d.ts +15 -0
  251. package/dist/vendor/node-shared/NodeStream.js +2 -2
  252. package/dist/vendor/node-shared/NodeTerminal.d.ts +6 -4
  253. package/dist/vendor/node-shared/NodeTerminal.js +1 -1
  254. package/dist/vendor/node-shared/index.d.ts +29 -0
  255. package/dist/vendor/node-shared/index.js +34 -22
  256. package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.d.ts +1 -1
  257. package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.js +1 -1
  258. package/dist/vendor/node-shared/internal/utils.js +1 -1
  259. package/dist/vendor/platform-node-shared.d.ts +29 -0
  260. package/dist/vendor/platform-node-shared.js +34 -22
  261. package/dist/vendor/platform-node.d.ts +40 -0
  262. package/dist/vendor/platform-node.js +70 -55
  263. package/docs/README.md +2 -2
  264. package/docs/api.md +2 -2
  265. package/docs/concepts/host-bundle.md +2 -2
  266. package/docs/installation.md +8 -9
  267. package/docs/quickstart.md +2 -2
  268. package/package.json +12 -12
  269. package/src/EgressHttpClient.ts +4 -4
  270. package/src/NodeHost.ts +2 -2
  271. package/src/ProcessConfinement.ts +1 -1
  272. package/src/ProcessReaper.ts +2 -2
  273. package/src/ScopedProcess.ts +2 -2
  274. package/src/internal/PipedProcess.ts +2 -2
  275. package/src/internal/ProcessCleanup.ts +1 -1
  276. package/src/internal/ProcessSupervisor.ts +2 -2
  277. /package/dist/vendor/{chunk-M7CLUILA.js → chunk-3WUGYBFU.js} +0 -0
  278. /package/dist/vendor/{chunk-ZJMRMY57.js → chunk-ASGOJ3XA.js} +0 -0
package/README.md CHANGED
@@ -51,8 +51,8 @@ A missing helper refuses confined operations, including MCP flow discovery.
51
51
  ```ts
52
52
  import { NodeHost } from "@smthrs/platform-node"
53
53
  import { Effect } from "effect"
54
- import * as ChildProcess from "effect/unstable/process/ChildProcess"
55
- import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner"
54
+ import * as ChildProcess from "effect/process/ChildProcess"
55
+ import { ChildProcessSpawner } from "effect/process/ChildProcessSpawner"
56
56
 
57
57
  const program = Effect.gen(function*() {
58
58
  const spawner = yield* ChildProcessSpawner
Binary file
Binary file
Binary file
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/linux-x64/smithers-jj-export
3
- size: 53554360 bytes
4
- sha256: 082aad5f9ca4c16a4bf1ad78225e1c0e1677141913c3a5601c586f8a8a5fdb08
3
+ size: 53557016 bytes
4
+ sha256: bf2b35d0a9b35df1bd5dd504c25c655988e4a5a07cbda16f221c812e344dac06
@@ -29,10 +29,10 @@
29
29
  import type * as Undici from "../vendor/cjs/node/Undici.js";
30
30
  import { GrantStore } from "@smthrs/kernel/GrantStore";
31
31
  import * as Effect from "effect/Effect";
32
+ import { HttpClient } from "effect/http/HttpClient";
32
33
  import * as Layer from "effect/Layer";
33
34
  import * as Schema from "effect/Schema";
34
35
  import * as Scope from "effect/Scope";
35
- import { HttpClient } from "effect/unstable/http/HttpClient";
36
36
  declare const EgressAddressError_base: Schema.Class<EgressAddressError, Schema.TaggedStruct<"@smthrs/platform-node/EgressAddressError", {
37
37
  readonly code: Schema.Literal<"no_approved_address">;
38
38
  readonly message: Schema.String;
@@ -1 +1 @@
1
- {"version":3,"file":"EgressHttpClient.d.ts","sourceRoot":"","sources":["../../src/EgressHttpClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,KAAK,KAAK,MAAM,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAGtD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;;;;;AAM5D;;;;;;;GAOG;AACH,qBAAa,kBAAmB,SAAQ,uBAGvC;IACC,SAAkB,IAAI,wBAAuB;CAC9C;AAoCD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,GACrB,aAAa,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,KACxD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAsBlD,CAAA;AAEJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,GAChB,aAAa,QAAQ,CAAC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uBAGvC;IACC,SAAkB,IAAI,wBAAuB;CAC9C;AAoCD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,GACrB,aAAa,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,KACxD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAsBlD,CAAA;AAEJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,GAChB,aAAa,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,KACxD,KAAK,CAAC,KAAK,CAAC,UAAU,CAqHtB,CAAA;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,EAC7D,WAAU,CAAC,MAAM,EAAE,UAAU,KAAK,MAAM,CAAC,MAAM,CAAC,UAAU,CAAkB,KAC3E,MAAM,CAAC,MAAM,CACd;IACE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;CAC5C,EACD,KAAK,EACL,KAAK,CAAC,KAAK,CAqBT,CAAA;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,aAAa,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;qBAlCrE,UAAU;sBACT,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;mCAyC3C,CAAA"}
@@ -41,14 +41,14 @@ var KernelHttpClient = __toESM(require("@smthrs/kernel/HttpClient"), 1);
41
41
  var import_HttpClient = require("@smthrs/kernel/HttpClient");
42
42
  var Effect = __toESM(require("effect/Effect"), 1);
43
43
  var Exit = __toESM(require("effect/Exit"), 1);
44
+ var import_HttpClient2 = require("effect/http/HttpClient");
45
+ var EffectHttpClient = __toESM(require("effect/http/HttpClient"), 1);
46
+ var HttpClientError = __toESM(require("effect/http/HttpClientError"), 1);
47
+ var HttpClientRequest = __toESM(require("effect/http/HttpClientRequest"), 1);
44
48
  var Layer = __toESM(require("effect/Layer"), 1);
45
49
  var Schema = __toESM(require("effect/Schema"), 1);
46
50
  var Scope = __toESM(require("effect/Scope"), 1);
47
51
  var Semaphore = __toESM(require("effect/Semaphore"), 1);
48
- var import_HttpClient2 = require("effect/unstable/http/HttpClient");
49
- var EffectHttpClient = __toESM(require("effect/unstable/http/HttpClient"), 1);
50
- var HttpClientError = __toESM(require("effect/unstable/http/HttpClientError"), 1);
51
- var HttpClientRequest = __toESM(require("effect/unstable/http/HttpClientRequest"), 1);
52
52
  var import_node_net = require("node:net");
53
53
  class EgressAddressError extends Schema.TaggedError()(
54
54
  "@smthrs/platform-node/EgressAddressError",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/EgressHttpClient.ts"],
4
- "sourcesContent": ["/**\n * The outbound HTTP client a Node process should use, read off its environment.\n *\n * `@effect/platform-node` ships `NodeHttpClient.layerUndici`, and its\n * dispatcher is a bare Undici `Agent`. A bare `Agent` dials every origin\n * directly: it does not read `HTTP_PROXY`, `HTTPS_PROXY` or `NO_PROXY`, and\n * nothing at the call site says so. That is invisible on a developer machine\n * with open egress and fatal inside a sandbox whose egress is default-deny\n * behind a named proxy \u2014 the request leaves for the origin, the firewall drops\n * it, and the only symptom is a transport failure far from the composition\n * that chose the client.\n *\n * This module is the one place that decision is made. {@link layer} is the\n * client every Node host composition installs; it honours the proxy the\n * environment names. Requests without a web destination use a shared pool;\n * web requests receive a fresh pinned dispatcher.\n *\n * The rule for loopback is fixed here, not by the environment: `localhost`,\n * `127.0.0.1` and `[::1]` are always reached directly, even when the\n * environment names a proxy and no exclusion, and every other origin follows\n * `NO_PROXY`. A proxy is how a process leaves its machine, and\n * `--remote http://127.0.0.1:3000` is not leaving it. The exemption is those\n * three names and nothing wider: Undici matches `NO_PROXY` entries by name,\n * never by resolved address, so `127.0.0.2` or a hostname that resolves to\n * loopback is an origin like any other and goes through the proxy.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as NodeHttpClient from \"@effect/platform-node/NodeHttpClient\"\nimport type * as Undici from \"@effect/platform-node/Undici\"\nimport { GrantStore } from \"@smthrs/kernel/GrantStore\"\nimport * as KernelHttpClient from \"@smthrs/kernel/HttpClient\"\nimport { Destination, withDestinationPinning } from \"@smthrs/kernel/HttpClient\"\nimport * as Effect from \"effect/Effect\"\nimport * as Exit from \"effect/Exit\"\nimport * as Layer from \"effect/Layer\"\nimport * as Schema from \"effect/Schema\"\nimport * as Scope from \"effect/Scope\"\nimport * as Semaphore from \"effect/Semaphore\"\nimport { HttpClient } from \"effect/unstable/http/HttpClient\"\nimport * as EffectHttpClient from \"effect/unstable/http/HttpClient\"\nimport * as HttpClientError from \"effect/unstable/http/HttpClientError\"\nimport * as HttpClientRequest from \"effect/unstable/http/HttpClientRequest\"\nimport { isIP } from \"node:net\"\n\n/**\n * A pinned connection asked for an address family none of the authorized\n * addresses has. It is the `cause` of the `TransportError` the request fails\n * with; `code` is always `no_approved_address`.\n *\n * @category errors\n * @since 1.0.0\n */\nexport class EgressAddressError extends Schema.TaggedError<EgressAddressError>()(\n \"@smthrs/platform-node/EgressAddressError\",\n { code: Schema.Literal(\"no_approved_address\"), message: Schema.String }\n) {\n override readonly name = \"EgressAddressError\"\n}\n\n/**\n * The hosts a proxy is never for. A proxy is how a process leaves its machine;\n * these names are the machine itself. Matched by name, the way Undici matches\n * every `NO_PROXY` entry, so the list is exactly these three and not\n * `127.0.0.0/8`.\n */\nconst loopback = [\"localhost\", \"127.0.0.1\", \"::1\"] as const\n\n/**\n * The exclusion list to hand Undici, given the one the environment names.\n *\n * Undici proxies *every* origin when `NO_PROXY` is empty \u2014 `#shouldProxy`\n * returns early with \"Always proxy if NO_PROXY is not set or empty\" \u2014 so a host\n * that names a proxy to reach the internet would also send `smthrs --remote\n * http://127.0.0.1:3000` and a local Ollama at `http://localhost:11434` to it.\n * Nothing in this repository has ever needed `NO_PROXY=127.0.0.1`, because the\n * client these compositions used before ignored the proxy variables outright.\n * So loopback is always excluded, the way Go's `net/http.ProxyFromEnvironment`\n * excludes it, and the environment's own entries are kept beside it.\n *\n * `*` is returned untouched: Undici recognises the wildcard only as the entire\n * value, and it already means every origin is direct.\n */\nconst exclusions = (declared: string): string =>\n declared === \"*\" ? declared : [declared, ...loopback].filter((entry) => entry !== \"\").join(\",\")\n\n// Split ESM bundles expose CommonJS Undici through default, without synthetic\n// named exports. Node and Bun also expose its constructors through default.\n// Its typings declare `default` as a namespace without them, and `bundler`\n// resolution reads that, so the value is typed as the module it carries.\nconst loadUndici = Effect.promise(\n async () => (await import(\"undici/index.js\")).default as unknown as typeof Undici\n)\n\n/**\n * An Undici dispatcher that routes through the egress proxy the supplied\n * environment names, or a direct one when it names none.\n *\n * The proxy variables are read in the order Undici itself reads them,\n * lowercase first, and passed explicitly rather than left to\n * `EnvHttpProxyAgent`'s own ambient lookup: a host serving a guest's\n * environment is not the guest, and the pool has to follow the record it was\n * handed. Loopback is always direct; see {@link exclusions}. Each dispatcher is\n * acquired in the caller's scope and destroyed with it, so a composition that\n * builds several still owns every pool it opened.\n *\n * @param environment the environment record whose proxy variables decide the route\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const dispatcher = (\n environment: Readonly<Record<string, string | undefined>>\n): Effect.Effect<Undici.Dispatcher, never, Scope.Scope> =>\n Effect.suspend(() => {\n const httpProxy = environment.http_proxy ?? environment.HTTP_PROXY ?? \"\"\n const httpsProxy = environment.https_proxy ?? environment.HTTPS_PROXY ?? \"\"\n const noProxy = exclusions(environment.no_proxy ?? environment.NO_PROXY ?? \"\")\n // Explicit empty values prevent Undici from falling back to a different\n // ambient environment. Each replacement pool uses the same proxy policy.\n //\n // Undici is loaded here rather than imported at the top, the way\n // `NodeHttpClient.makeDispatcher` loads it, because this module is imported\n // by `NodeHost` and every bundle built on it. A static import pulls the\n // whole of Undici into any process that merely composes a host, whose\n // side effects a host bundle must not carry: it reddened the Node host's\n // own `FileSystem` contract case, which never makes a request. The explicit\n // package entry also avoids Bun's incomplete built-in \"undici\" substitute.\n return Effect.acquireRelease(\n Effect.map(\n loadUndici,\n (undici) => new undici.EnvHttpProxyAgent({ httpProxy, httpsProxy, noProxy })\n ),\n (dispatcher) => Effect.promise(() => dispatcher.destroy())\n )\n })\n\n/**\n * The Undici `HttpClient` to install, given the environment the process runs in.\n *\n * Use this wherever `NodeHttpClient.layerUndici` would otherwise be provided\n * under a layer that takes `HttpClient` from context \u2014 a model transport, a\n * judge, a fetch rule, a host bundle. The two differ only in whether the pool\n * honours `HTTP_PROXY`/`HTTPS_PROXY`/`NO_PROXY`, which is the difference\n * between a request that reaches the gateway from inside a default-deny\n * sandbox and one the firewall drops.\n *\n * @param environment the environment record whose proxy variables decide the route\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layer = (\n environment: Readonly<Record<string, string | undefined>>\n): Layer.Layer<HttpClient> =>\n Layer.effect(\n HttpClient,\n Effect.gen(function*() {\n const shared = yield* dispatcher(environment)\n const ordinary = yield* NodeHttpClient.makeUndici.pipe(Effect.provideService(NodeHttpClient.Dispatcher, shared))\n return withDestinationPinning(EffectHttpClient.transform(ordinary, (execute, request) =>\n Effect.gen(function*() {\n const destination = yield* Destination\n if (destination === undefined) return yield* execute\n const url = new URL(request.url)\n if (\n url.origin !== destination.origin || destination.addresses.length === 0 ||\n destination.addresses.some((address) => isIP(address) === 0)\n ) {\n return yield* Effect.fail(\n new HttpClientError.HttpClientError({\n reason: new HttpClientError.TransportError({\n request,\n description: \"Invalid pinned HTTP destination\"\n })\n })\n )\n }\n const proxies = [\n environment.http_proxy ?? environment.HTTP_PROXY,\n environment.https_proxy ?? environment.HTTPS_PROXY\n ]\n // The record is read per request, and a live one such as NodeHost's\n // `process.env` can name an unparsable proxy after the shared pool\n // was built from it; that is a refusal here, never a thrown URL error.\n const validProxies = proxies.every((proxy) => {\n if (!proxy) return true\n try {\n return [\"http:\", \"https:\"].includes(new URL(proxy).protocol)\n } catch {\n return false\n }\n })\n if (!validProxies) {\n return yield* Effect.fail(\n new HttpClientError.HttpClientError({\n reason: new HttpClientError.TransportError({\n request,\n description: \"Pinned HTTP requests require HTTP or HTTPS proxies\"\n })\n })\n )\n }\n const undici = yield* loadUndici\n const addresses = destination.addresses.map((address) => ({ address, family: isIP(address) }))\n // Construction and its disposal are one uninterruptible step: an\n // interruption that lands after the agent exists but before the request\n // owns it would otherwise leave the agent neither destroyed nor closed.\n return yield* Effect.uninterruptibleMask((restore) => {\n const pinned = new undici.EnvHttpProxyAgent({\n httpProxy: environment.http_proxy ?? environment.HTTP_PROXY ?? \"\",\n httpsProxy: environment.https_proxy ?? environment.HTTPS_PROXY ?? \"\",\n noProxy: exclusions(environment.no_proxy ?? environment.NO_PROXY ?? \"\"),\n // Tunnelling HTTP too prevents the proxy resolving the target hostname.\n proxyTunnel: true,\n connect: {\n lookup: (_hostname, options, callback) => {\n const candidates = options.family\n ? addresses.filter((item) => item.family === options.family)\n : addresses\n const first = candidates[0]\n if (first === undefined) {\n return callback(\n new EgressAddressError({\n code: \"no_approved_address\",\n message: \"No approved address for family\"\n }),\n \"\",\n 4\n )\n }\n if (options.all) callback(null, candidates)\n else callback(null, first.address, first.family)\n }\n },\n clientFactory: (origin, options) => {\n const proxy = new undici.Pool(origin, options)\n const connect = proxy.connect.bind(proxy)\n // EnvHttpProxyAgent selects the route using the ORIGINAL hostname.\n // Only the proxy tunnel destination changes; endpoint TLS still uses\n // the original hostname for SNI and certificate verification.\n proxy.connect = (options: Undici.Dispatcher.ConnectOptions) => {\n const address = addresses[0]!.address\n const host = isIP(address) === 6 ? `[${address}]` : address\n const authority = `${host}:${url.port || (url.protocol === \"https:\" ? \"443\" : \"80\")}`\n return connect({ ...options, path: authority, headers: { ...options.headers, host: authority } })\n }\n return proxy\n }\n })\n const pinnedRequest = request.pipe(\n HttpClientRequest.setHeader(\"host\", url.host),\n HttpClientRequest.removeHeader(\"proxy-authorization\"),\n HttpClientRequest.removeHeader(\"connection\"),\n HttpClientRequest.removeHeader(\"transfer-encoding\"),\n HttpClientRequest.removeHeader(\"content-length\")\n )\n return restore(NodeHttpClient.makeUndici.pipe(\n Effect.provideService(NodeHttpClient.Dispatcher, pinned),\n Effect.flatMap((client) => client.execute(pinnedRequest))\n )).pipe(Effect.onExit((exit) =>\n Exit.isFailure(exit)\n ? Effect.promise(() => pinned.destroy())\n // close prevents reuse immediately, but lets the active body drain.\n : Effect.sync(() => {\n void pinned.close().catch(() => pinned.destroy())\n })\n ))\n })\n })))\n })\n )\n\n/**\n * Owns one replaceable Undici pool in the caller's scope. Each replacement\n * receives the same middleware and closes the previous pool.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const rebuildableTransport = (\n acquire: Effect.Effect<Undici.Dispatcher, never, Scope.Scope>,\n decorate: (client: HttpClient) => Effect.Effect<HttpClient> = Effect.succeed\n): Effect.Effect<\n {\n readonly client: HttpClient\n readonly rebuild: Effect.Effect<HttpClient>\n },\n never,\n Scope.Scope\n> =>\n Effect.gen(function*() {\n const scope = yield* Scope.Scope\n const gate = yield* Semaphore.make(1)\n let held: Scope.Closeable | undefined = undefined\n const rebuild = gate.withPermit(Effect.uninterruptibleMask((restore) =>\n Effect.gen(function*() {\n const owned = yield* Scope.fork(scope)\n const client = yield* restore(NodeHttpClient.makeUndici.pipe(\n Effect.provideServiceEffect(NodeHttpClient.Dispatcher, acquire),\n Effect.flatMap(decorate),\n Effect.provideService(Scope.Scope, owned)\n )).pipe(Effect.onExit((exit) => Exit.isSuccess(exit) ? Effect.void : Scope.close(owned, exit)))\n const previous = held\n held = owned\n if (previous !== undefined) yield* Scope.close(previous, Exit.void)\n return client\n })\n ))\n return { client: yield* rebuild, rebuild }\n })\n\n/**\n * A model transport whose replacements retain the caller's grant store and\n * environment proxy policy. Pass it to RequestExecutor.makeWith in the host scope.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const guardedTransport = (environment: Readonly<Record<string, string | undefined>>) =>\n Effect.gen(function*() {\n const grants = yield* GrantStore\n return yield* rebuildableTransport(dispatcher(environment), (client) =>\n HttpClient.pipe(Effect.provide(KernelHttpClient.layer.pipe(\n Layer.provide(Layer.succeed(HttpClient)(client)),\n Layer.provide(Layer.succeed(GrantStore)(grants))\n ))))\n })\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BA,qBAAgC;AAEhC,wBAA2B;AAC3B,uBAAkC;AAClC,wBAAoD;AACpD,aAAwB;AACxB,WAAsB;AACtB,YAAuB;AACvB,aAAwB;AACxB,YAAuB;AACvB,gBAA2B;AAC3B,IAAAA,qBAA2B;AAC3B,uBAAkC;AAClC,sBAAiC;AACjC,wBAAmC;AACnC,sBAAqB;AAUd,MAAM,2BAA2B,OAAO,YAAgC;AAAA,EAC7E;AAAA,EACA,EAAE,MAAM,OAAO,QAAQ,qBAAqB,GAAG,SAAS,OAAO,OAAO;AACxE,EAAE;AAAA,EACkB,OAAO;AAC3B;AAQA,MAAM,WAAW,CAAC,aAAa,aAAa,KAAK;AAiBjD,MAAM,aAAa,CAAC,aAClB,aAAa,MAAM,WAAW,CAAC,UAAU,GAAG,QAAQ,EAAE,OAAO,CAAC,UAAU,UAAU,EAAE,EAAE,KAAK,GAAG;AAMhG,MAAM,aAAa,OAAO;AAAA,EACxB,aAAa,MAAM,OAAO,iBAAiB,GAAG;AAChD;AAkBO,MAAM,aAAa,CACxB,gBAEA,OAAO,QAAQ,MAAM;AACnB,QAAM,YAAY,YAAY,cAAc,YAAY,cAAc;AACtE,QAAM,aAAa,YAAY,eAAe,YAAY,eAAe;AACzE,QAAM,UAAU,WAAW,YAAY,YAAY,YAAY,YAAY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AM,QAAQ,OAAO,MAAM,KAAK,KAAK;AACrC,YAAM,SAAS,OAAO,QAAQ,eAAe,WAAW;AAAA,QACtD,OAAO,qBAAqB,eAAe,YAAY,OAAO;AAAA,QAC9D,OAAO,QAAQ,QAAQ;AAAA,QACvB,OAAO,eAAe,MAAM,OAAO,KAAK;AAAA,MAC1C,CAAC,EAAE,KAAK,OAAO,OAAO,CAAC,SAAS,KAAK,UAAU,IAAI,IAAI,OAAO,OAAO,MAAM,MAAM,OAAO,IAAI,CAAC,CAAC;AAC9F,YAAM,WAAW;AACjB,aAAO;AACP,UAAI,aAAa,OAAW,QAAO,MAAM,MAAM,UAAU,KAAK,IAAI;AAClE,aAAO;AAAA,IACT,CAAC;AAAA,EACH,CAAC;AACD,SAAO,EAAE,QAAQ,OAAO,SAAS,QAAQ;AAC3C,CAAC;AASI,MAAM,mBAAmB,CAAC,gBAC/B,OAAO,IAAI,aAAY;AACrB,QAAM,SAAS,OAAO;AACtB,SAAO,OAAO,qBAAqB,WAAW,WAAW,GAAG,CAAC,WAC3D,8BAAW,KAAK,OAAO,QAAQ,iBAAiB,MAAM;AAAA,IACpD,MAAM,QAAQ,MAAM,QAAQ,6BAAU,EAAE,MAAM,CAAC;AAAA,IAC/C,MAAM,QAAQ,MAAM,QAAQ,4BAAU,EAAE,MAAM,CAAC;AAAA,EACjD,CAAC,CAAC,CAAC;AACP,CAAC;",
4
+ "sourcesContent": ["/**\n * The outbound HTTP client a Node process should use, read off its environment.\n *\n * `@effect/platform-node` ships `NodeHttpClient.layerUndici`, and its\n * dispatcher is a bare Undici `Agent`. A bare `Agent` dials every origin\n * directly: it does not read `HTTP_PROXY`, `HTTPS_PROXY` or `NO_PROXY`, and\n * nothing at the call site says so. That is invisible on a developer machine\n * with open egress and fatal inside a sandbox whose egress is default-deny\n * behind a named proxy \u2014 the request leaves for the origin, the firewall drops\n * it, and the only symptom is a transport failure far from the composition\n * that chose the client.\n *\n * This module is the one place that decision is made. {@link layer} is the\n * client every Node host composition installs; it honours the proxy the\n * environment names. Requests without a web destination use a shared pool;\n * web requests receive a fresh pinned dispatcher.\n *\n * The rule for loopback is fixed here, not by the environment: `localhost`,\n * `127.0.0.1` and `[::1]` are always reached directly, even when the\n * environment names a proxy and no exclusion, and every other origin follows\n * `NO_PROXY`. A proxy is how a process leaves its machine, and\n * `--remote http://127.0.0.1:3000` is not leaving it. The exemption is those\n * three names and nothing wider: Undici matches `NO_PROXY` entries by name,\n * never by resolved address, so `127.0.0.2` or a hostname that resolves to\n * loopback is an origin like any other and goes through the proxy.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as NodeHttpClient from \"@effect/platform-node/NodeHttpClient\"\nimport type * as Undici from \"@effect/platform-node/Undici\"\nimport { GrantStore } from \"@smthrs/kernel/GrantStore\"\nimport * as KernelHttpClient from \"@smthrs/kernel/HttpClient\"\nimport { Destination, withDestinationPinning } from \"@smthrs/kernel/HttpClient\"\nimport * as Effect from \"effect/Effect\"\nimport * as Exit from \"effect/Exit\"\nimport { HttpClient } from \"effect/http/HttpClient\"\nimport * as EffectHttpClient from \"effect/http/HttpClient\"\nimport * as HttpClientError from \"effect/http/HttpClientError\"\nimport * as HttpClientRequest from \"effect/http/HttpClientRequest\"\nimport * as Layer from \"effect/Layer\"\nimport * as Schema from \"effect/Schema\"\nimport * as Scope from \"effect/Scope\"\nimport * as Semaphore from \"effect/Semaphore\"\nimport { isIP } from \"node:net\"\n\n/**\n * A pinned connection asked for an address family none of the authorized\n * addresses has. It is the `cause` of the `TransportError` the request fails\n * with; `code` is always `no_approved_address`.\n *\n * @category errors\n * @since 1.0.0\n */\nexport class EgressAddressError extends Schema.TaggedError<EgressAddressError>()(\n \"@smthrs/platform-node/EgressAddressError\",\n { code: Schema.Literal(\"no_approved_address\"), message: Schema.String }\n) {\n override readonly name = \"EgressAddressError\"\n}\n\n/**\n * The hosts a proxy is never for. A proxy is how a process leaves its machine;\n * these names are the machine itself. Matched by name, the way Undici matches\n * every `NO_PROXY` entry, so the list is exactly these three and not\n * `127.0.0.0/8`.\n */\nconst loopback = [\"localhost\", \"127.0.0.1\", \"::1\"] as const\n\n/**\n * The exclusion list to hand Undici, given the one the environment names.\n *\n * Undici proxies *every* origin when `NO_PROXY` is empty \u2014 `#shouldProxy`\n * returns early with \"Always proxy if NO_PROXY is not set or empty\" \u2014 so a host\n * that names a proxy to reach the internet would also send `smthrs --remote\n * http://127.0.0.1:3000` and a local Ollama at `http://localhost:11434` to it.\n * Nothing in this repository has ever needed `NO_PROXY=127.0.0.1`, because the\n * client these compositions used before ignored the proxy variables outright.\n * So loopback is always excluded, the way Go's `net/http.ProxyFromEnvironment`\n * excludes it, and the environment's own entries are kept beside it.\n *\n * `*` is returned untouched: Undici recognises the wildcard only as the entire\n * value, and it already means every origin is direct.\n */\nconst exclusions = (declared: string): string =>\n declared === \"*\" ? declared : [declared, ...loopback].filter((entry) => entry !== \"\").join(\",\")\n\n// Split ESM bundles expose CommonJS Undici through default, without synthetic\n// named exports. Node and Bun also expose its constructors through default.\n// Its typings declare `default` as a namespace without them, and `bundler`\n// resolution reads that, so the value is typed as the module it carries.\nconst loadUndici = Effect.promise(\n async () => (await import(\"undici/index.js\")).default as unknown as typeof Undici\n)\n\n/**\n * An Undici dispatcher that routes through the egress proxy the supplied\n * environment names, or a direct one when it names none.\n *\n * The proxy variables are read in the order Undici itself reads them,\n * lowercase first, and passed explicitly rather than left to\n * `EnvHttpProxyAgent`'s own ambient lookup: a host serving a guest's\n * environment is not the guest, and the pool has to follow the record it was\n * handed. Loopback is always direct; see {@link exclusions}. Each dispatcher is\n * acquired in the caller's scope and destroyed with it, so a composition that\n * builds several still owns every pool it opened.\n *\n * @param environment the environment record whose proxy variables decide the route\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const dispatcher = (\n environment: Readonly<Record<string, string | undefined>>\n): Effect.Effect<Undici.Dispatcher, never, Scope.Scope> =>\n Effect.suspend(() => {\n const httpProxy = environment.http_proxy ?? environment.HTTP_PROXY ?? \"\"\n const httpsProxy = environment.https_proxy ?? environment.HTTPS_PROXY ?? \"\"\n const noProxy = exclusions(environment.no_proxy ?? environment.NO_PROXY ?? \"\")\n // Explicit empty values prevent Undici from falling back to a different\n // ambient environment. Each replacement pool uses the same proxy policy.\n //\n // Undici is loaded here rather than imported at the top, the way\n // `NodeHttpClient.makeDispatcher` loads it, because this module is imported\n // by `NodeHost` and every bundle built on it. A static import pulls the\n // whole of Undici into any process that merely composes a host, whose\n // side effects a host bundle must not carry: it reddened the Node host's\n // own `FileSystem` contract case, which never makes a request. The explicit\n // package entry also avoids Bun's incomplete built-in \"undici\" substitute.\n return Effect.acquireRelease(\n Effect.map(\n loadUndici,\n (undici) => new undici.EnvHttpProxyAgent({ httpProxy, httpsProxy, noProxy })\n ),\n (dispatcher) => Effect.promise(() => dispatcher.destroy())\n )\n })\n\n/**\n * The Undici `HttpClient` to install, given the environment the process runs in.\n *\n * Use this wherever `NodeHttpClient.layerUndici` would otherwise be provided\n * under a layer that takes `HttpClient` from context \u2014 a model transport, a\n * judge, a fetch rule, a host bundle. The two differ only in whether the pool\n * honours `HTTP_PROXY`/`HTTPS_PROXY`/`NO_PROXY`, which is the difference\n * between a request that reaches the gateway from inside a default-deny\n * sandbox and one the firewall drops.\n *\n * @param environment the environment record whose proxy variables decide the route\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layer = (\n environment: Readonly<Record<string, string | undefined>>\n): Layer.Layer<HttpClient> =>\n Layer.effect(\n HttpClient,\n Effect.gen(function*() {\n const shared = yield* dispatcher(environment)\n const ordinary = yield* NodeHttpClient.makeUndici.pipe(Effect.provideService(NodeHttpClient.Dispatcher, shared))\n return withDestinationPinning(EffectHttpClient.transform(ordinary, (execute, request) =>\n Effect.gen(function*() {\n const destination = yield* Destination\n if (destination === undefined) return yield* execute\n const url = new URL(request.url)\n if (\n url.origin !== destination.origin || destination.addresses.length === 0 ||\n destination.addresses.some((address) => isIP(address) === 0)\n ) {\n return yield* Effect.fail(\n new HttpClientError.HttpClientError({\n reason: new HttpClientError.TransportError({\n request,\n description: \"Invalid pinned HTTP destination\"\n })\n })\n )\n }\n const proxies = [\n environment.http_proxy ?? environment.HTTP_PROXY,\n environment.https_proxy ?? environment.HTTPS_PROXY\n ]\n // The record is read per request, and a live one such as NodeHost's\n // `process.env` can name an unparsable proxy after the shared pool\n // was built from it; that is a refusal here, never a thrown URL error.\n const validProxies = proxies.every((proxy) => {\n if (!proxy) return true\n try {\n return [\"http:\", \"https:\"].includes(new URL(proxy).protocol)\n } catch {\n return false\n }\n })\n if (!validProxies) {\n return yield* Effect.fail(\n new HttpClientError.HttpClientError({\n reason: new HttpClientError.TransportError({\n request,\n description: \"Pinned HTTP requests require HTTP or HTTPS proxies\"\n })\n })\n )\n }\n const undici = yield* loadUndici\n const addresses = destination.addresses.map((address) => ({ address, family: isIP(address) }))\n // Construction and its disposal are one uninterruptible step: an\n // interruption that lands after the agent exists but before the request\n // owns it would otherwise leave the agent neither destroyed nor closed.\n return yield* Effect.uninterruptibleMask((restore) => {\n const pinned = new undici.EnvHttpProxyAgent({\n httpProxy: environment.http_proxy ?? environment.HTTP_PROXY ?? \"\",\n httpsProxy: environment.https_proxy ?? environment.HTTPS_PROXY ?? \"\",\n noProxy: exclusions(environment.no_proxy ?? environment.NO_PROXY ?? \"\"),\n // Tunnelling HTTP too prevents the proxy resolving the target hostname.\n proxyTunnel: true,\n connect: {\n lookup: (_hostname, options, callback) => {\n const candidates = options.family\n ? addresses.filter((item) => item.family === options.family)\n : addresses\n const first = candidates[0]\n if (first === undefined) {\n return callback(\n new EgressAddressError({\n code: \"no_approved_address\",\n message: \"No approved address for family\"\n }),\n \"\",\n 4\n )\n }\n if (options.all) callback(null, candidates)\n else callback(null, first.address, first.family)\n }\n },\n clientFactory: (origin, options) => {\n const proxy = new undici.Pool(origin, options)\n const connect = proxy.connect.bind(proxy)\n // EnvHttpProxyAgent selects the route using the ORIGINAL hostname.\n // Only the proxy tunnel destination changes; endpoint TLS still uses\n // the original hostname for SNI and certificate verification.\n proxy.connect = (options: Undici.Dispatcher.ConnectOptions) => {\n const address = addresses[0]!.address\n const host = isIP(address) === 6 ? `[${address}]` : address\n const authority = `${host}:${url.port || (url.protocol === \"https:\" ? \"443\" : \"80\")}`\n return connect({ ...options, path: authority, headers: { ...options.headers, host: authority } })\n }\n return proxy\n }\n })\n const pinnedRequest = request.pipe(\n HttpClientRequest.setHeader(\"host\", url.host),\n HttpClientRequest.removeHeader(\"proxy-authorization\"),\n HttpClientRequest.removeHeader(\"connection\"),\n HttpClientRequest.removeHeader(\"transfer-encoding\"),\n HttpClientRequest.removeHeader(\"content-length\")\n )\n return restore(NodeHttpClient.makeUndici.pipe(\n Effect.provideService(NodeHttpClient.Dispatcher, pinned),\n Effect.flatMap((client) => client.execute(pinnedRequest))\n )).pipe(Effect.onExit((exit) =>\n Exit.isFailure(exit)\n ? Effect.promise(() => pinned.destroy())\n // close prevents reuse immediately, but lets the active body drain.\n : Effect.sync(() => {\n void pinned.close().catch(() => pinned.destroy())\n })\n ))\n })\n })))\n })\n )\n\n/**\n * Owns one replaceable Undici pool in the caller's scope. Each replacement\n * receives the same middleware and closes the previous pool.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const rebuildableTransport = (\n acquire: Effect.Effect<Undici.Dispatcher, never, Scope.Scope>,\n decorate: (client: HttpClient) => Effect.Effect<HttpClient> = Effect.succeed\n): Effect.Effect<\n {\n readonly client: HttpClient\n readonly rebuild: Effect.Effect<HttpClient>\n },\n never,\n Scope.Scope\n> =>\n Effect.gen(function*() {\n const scope = yield* Scope.Scope\n const gate = yield* Semaphore.make(1)\n let held: Scope.Closeable | undefined = undefined\n const rebuild = gate.withPermit(Effect.uninterruptibleMask((restore) =>\n Effect.gen(function*() {\n const owned = yield* Scope.fork(scope)\n const client = yield* restore(NodeHttpClient.makeUndici.pipe(\n Effect.provideServiceEffect(NodeHttpClient.Dispatcher, acquire),\n Effect.flatMap(decorate),\n Effect.provideService(Scope.Scope, owned)\n )).pipe(Effect.onExit((exit) => Exit.isSuccess(exit) ? Effect.void : Scope.close(owned, exit)))\n const previous = held\n held = owned\n if (previous !== undefined) yield* Scope.close(previous, Exit.void)\n return client\n })\n ))\n return { client: yield* rebuild, rebuild }\n })\n\n/**\n * A model transport whose replacements retain the caller's grant store and\n * environment proxy policy. Pass it to RequestExecutor.makeWith in the host scope.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const guardedTransport = (environment: Readonly<Record<string, string | undefined>>) =>\n Effect.gen(function*() {\n const grants = yield* GrantStore\n return yield* rebuildableTransport(dispatcher(environment), (client) =>\n HttpClient.pipe(Effect.provide(KernelHttpClient.layer.pipe(\n Layer.provide(Layer.succeed(HttpClient)(client)),\n Layer.provide(Layer.succeed(GrantStore)(grants))\n ))))\n })\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BA,qBAAgC;AAEhC,wBAA2B;AAC3B,uBAAkC;AAClC,wBAAoD;AACpD,aAAwB;AACxB,WAAsB;AACtB,IAAAA,qBAA2B;AAC3B,uBAAkC;AAClC,sBAAiC;AACjC,wBAAmC;AACnC,YAAuB;AACvB,aAAwB;AACxB,YAAuB;AACvB,gBAA2B;AAC3B,sBAAqB;AAUd,MAAM,2BAA2B,OAAO,YAAgC;AAAA,EAC7E;AAAA,EACA,EAAE,MAAM,OAAO,QAAQ,qBAAqB,GAAG,SAAS,OAAO,OAAO;AACxE,EAAE;AAAA,EACkB,OAAO;AAC3B;AAQA,MAAM,WAAW,CAAC,aAAa,aAAa,KAAK;AAiBjD,MAAM,aAAa,CAAC,aAClB,aAAa,MAAM,WAAW,CAAC,UAAU,GAAG,QAAQ,EAAE,OAAO,CAAC,UAAU,UAAU,EAAE,EAAE,KAAK,GAAG;AAMhG,MAAM,aAAa,OAAO;AAAA,EACxB,aAAa,MAAM,OAAO,iBAAiB,GAAG;AAChD;AAkBO,MAAM,aAA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,OAAO,MAAM;AAC3B,QAAM,OAAO,OAAO,UAAU,KAAK,CAAC;AACpC,MAAI,OAAoC;AACxC,QAAM,UAAU,KAAK,WAAW,OAAO;AAAA,IAAoB,CAAC,YAC1D,OAAO,IAAI,aAAY;AACrB,YAAM,QAAQ,OAAO,MAAM,KAAK,KAAK;AACrC,YAAM,SAAS,OAAO,QAAQ,eAAe,WAAW;AAAA,QACtD,OAAO,qBAAqB,eAAe,YAAY,OAAO;AAAA,QAC9D,OAAO,QAAQ,QAAQ;AAAA,QACvB,OAAO,eAAe,MAAM,OAAO,KAAK;AAAA,MAC1C,CAAC,EAAE,KAAK,OAAO,OAAO,CAAC,SAAS,KAAK,UAAU,IAAI,IAAI,OAAO,OAAO,MAAM,MAAM,OAAO,IAAI,CAAC,CAAC;AAC9F,YAAM,WAAW;AACjB,aAAO;AACP,UAAI,aAAa,OAAW,QAAO,MAAM,MAAM,UAAU,KAAK,IAAI;AAClE,aAAO;AAAA,IACT,CAAC;AAAA,EACH,CAAC;AACD,SAAO,EAAE,QAAQ,OAAO,SAAS,QAAQ;AAC3C,CAAC;AASI,MAAM,mBAAmB,CAAC,gBAC/B,OAAO,IAAI,aAAY;AACrB,QAAM,SAAS,OAAO;AACtB,SAAO,OAAO,qBAAqB,WAAW,WAAW,GAAG,CAAC,WAC3D,8BAAW,KAAK,OAAO,QAAQ,iBAAiB,MAAM;AAAA,IACpD,MAAM,QAAQ,MAAM,QAAQ,6BAAU,EAAE,MAAM,CAAC;AAAA,IAC/C,MAAM,QAAQ,MAAM,QAAQ,4BAAU,EAAE,MAAM,CAAC;AAAA,EACjD,CAAC,CAAC,CAAC;AACP,CAAC;",
6
6
  "names": ["import_HttpClient", "dispatcher", "options"]
7
7
  }
@@ -29,11 +29,11 @@ import type { HostServiceIds } from "@smthrs/kernel/HostServices";
29
29
  import type * as KernelProcessConfinement from "@smthrs/kernel/ProcessConfinement";
30
30
  import type * as ProcessLedger from "@smthrs/kernel/ProcessLedger";
31
31
  import type { FileSystem } from "effect/FileSystem";
32
+ import type { HttpClient } from "effect/http/HttpClient";
32
33
  import * as Layer from "effect/Layer";
33
34
  import type * as Path from "effect/Path";
35
+ import type { ChildProcessSpawner } from "effect/process/ChildProcessSpawner";
34
36
  import * as Schema from "effect/Schema";
35
- import type { HttpClient } from "effect/unstable/http/HttpClient";
36
- import type { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
37
37
  import * as AtomicFileSystem from "./AtomicFileSystem.ts";
38
38
  import * as EgressHttpClient from "./EgressHttpClient.ts";
39
39
  import * as ProcessReaper from "./ProcessReaper.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"NodeHost.d.ts","sourceRoot":"","sources":["../../src/NodeHost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,uBAAuB,MAAM,+CAA+C,CAAA;AACxF,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAA;AAC9D,OAAO,KAAK,cAAc,MAAM,sCAAsC,CAAA;AACtE,OAAO,KAAK,cAAc,MAAM,sCAAsC,CAAA;AAEtE,OAAO,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,KAAK,KAAK,wBAAwB,MAAM,mCAAmC,CAAA;AAClF,OAAO,KAAK,KAAK,aAAa,MAAM,8BAA8B,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,KAAK,IAAI,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;AAEtF,OAAO,KAA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GAChB,UAAU,GACV,IAAI,CAAC,IAAI,GACT,mBAAmB,GACnB,EAAE,GACF,UAAU,GACV,wBAAwB,CAAC,kBAAkB,CAAA;;;;;AAE/C;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,kBAGjC;IACA,SAAkB,IAAI,mBAAkB;CACzC;AAYD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAMvF,CAAA;AAKD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,cAAc,GAAG,aAAa,CAAC,OAAO,CAAA;AAQnF;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAMhD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,gBAAgB,MAAM,KAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAO3E,CAAA;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,gBAAgB,KACzB,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,aAAa,CAgB5D,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC3B,gBAAgB,MAAM,EACtB,UAAU,gBAAgB,KACzB,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,aAAa,CAW5D,CAAA"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/NodeHost.ts"],
4
- "sourcesContent": ["/**\n * Aggregate Node.js Host bundle.\n *\n * This module defines the `NodeHost` service union and a single `layer` that\n * provides the closed Host surface backed by Node: `@effect/platform-node`'s\n * filesystem, child-process spawner, Undici `HttpClient`, native `Path`,\n * and the Node `Jj` adapter from its own package. Use the layer when a Node\n * program wants every host capability from one place; use the individual\n * modules when a program should only be able to reach part of the host. The\n * bundle also supplies native `ProcessConfinement` for the kernel spawner.\n *\n * There is no Node HTTP module either: outgoing requests are Effect's\n * `HttpClient`, and `@effect/platform-node` already ships the Undici-backed\n * implementation. Undici follows no redirect unless a redirect interceptor is\n * installed, so every hop stays visible to `@smthrs/kernel`'s decorator.\n *\n * There is no Node shell module: running a command is Effect's\n * `ChildProcessSpawner`, and `@effect/platform-node` already ships the\n * implementation.\n *\n * @since 0.1.0\n */\n\nimport * as NodeChildProcessSpawner from \"@effect/platform-node/NodeChildProcessSpawner\"\nimport * as NodeCrypto from \"@effect/platform-node/NodeCrypto\"\nimport * as NodeFileSystem from \"@effect/platform-node/NodeFileSystem\"\nimport * as NodeHttpClient from \"@effect/platform-node/NodeHttpClient\"\nimport * as NodePath from \"@effect/platform-node/NodePath\"\nimport type { Jj, JjError } from \"@smthrs/jj\"\nimport * as NodeJj from \"@smthrs/jj/node/NodeJj\"\nimport type { HostServiceIds } from \"@smthrs/kernel/HostServices\"\nimport type * as KernelProcessConfinement from \"@smthrs/kernel/ProcessConfinement\"\nimport type * as ProcessLedger from \"@smthrs/kernel/ProcessLedger\"\nimport type { FileSystem } from \"effect/FileSystem\"\nimport * as Layer from \"effect/Layer\"\nimport type * as Path from \"effect/Path\"\nimport * as Schema from \"effect/Schema\"\nimport type { HttpClient } from \"effect/unstable/http/HttpClient\"\nimport type { ChildProcessSpawner } from \"effect/unstable/process/ChildProcessSpawner\"\nimport { isAbsolute } from \"node:path\"\nimport * as AtomicFileSystem from \"./AtomicFileSystem.ts\"\nimport * as EgressHttpClient from \"./EgressHttpClient.ts\"\nimport * as ProcessConfinement from \"./ProcessConfinement.ts\"\nimport * as ProcessReaper from \"./ProcessReaper.ts\"\n\n/**\n * The Node platform modules Effect ships, re-exported so a program that wants\n * only part of the host has one place to reach for them. `NodeJj` belongs to\n * `@smthrs/jj`; import it from there.\n *\n * `NodeCrypto` is here for a different reason than the rest. `Crypto` is not a\n * Host service \u2014 it carries no host authority the kernel could attenuate, so\n * it is not in {@link NodeHost} and not in the closed list \u2014 but every durable\n * composition needs one, and a program that already depends on this package\n * for its host should not have to add a second dependency for the digest.\n *\n * @category re-exports\n * @since 0.1.0\n */\nexport {\n AtomicFileSystem,\n EgressHttpClient,\n NodeChildProcessSpawner,\n NodeCrypto,\n NodeFileSystem,\n NodeHttpClient,\n ProcessReaper\n}\n\n/**\n * The `HttpClient` every bundle below installs: Undici through the egress\n * proxy this process's environment names, and a direct Undici pool when it\n * names none.\n *\n * `NodeHttpClient.layerUndici` is the direct pool unconditionally. It is still\n * re-exported above for a program composing its own services, but a bundle\n * that spans a whole host has to work inside a sandbox whose only way out is a\n * proxy, so the bundles read the environment. See {@link EgressHttpClient}.\n */\nconst httpClient = EgressHttpClient.layer(process.env)\n\n/**\n * The union of host services provided by the Node host layer.\n *\n * @category models\n * @since 0.1.0\n */\nexport type NodeHost =\n | FileSystem\n | Path.Path\n | ChildProcessSpawner\n | Jj\n | HttpClient\n | KernelProcessConfinement.ProcessConfinement\n\n/**\n * Invalid repository-root configuration, refused before layer construction.\n * @category errors\n * @since 1.0.0-rc.0\n */\nexport class NodeHostError extends Schema.TaggedError<NodeHostError>()(\"@smthrs/platform-node/NodeHostError\", {\n code: Schema.Literal(\"invalid_repository_root\"),\n message: Schema.String\n}) {\n override readonly name = \"NodeHostError\"\n}\n\nconst absoluteRoot = (root: string): string => {\n if (isAbsolute(root)) return root\n throw new NodeHostError({\n code: \"invalid_repository_root\",\n message: `NodeHost requires an absolute repository root, got ${\n JSON.stringify(Array.from(root).slice(0, 64).join(\"\"))\n }`\n })\n}\n\n/**\n * Stable implementation identities for the raw bundle's five Host slots.\n * Contained POSIX factories replace its spawner with {@link ProcessReaper.layerSpawner}.\n * @category models\n * @since 1.0.0-rc.0\n */\nexport const implementationIds: Readonly<Record<(typeof HostServiceIds)[number], string>> = {\n \"effect/FileSystem\": \"@smthrs/platform-node/AtomicFileSystem\",\n \"effect/Path\": \"@effect/platform-node/NodePath\",\n \"effect/process/ChildProcessSpawner\": \"@effect/platform-node/NodeChildProcessSpawner\",\n \"@smthrs/jj/Jj\": \"@smthrs/jj/node/NodeJj\",\n \"effect/HttpClient\": \"@smthrs/platform-node/EgressHttpClient\"\n}\n\n/** The two services `NodeChildProcessSpawner` resolves paths and files with. */\nconst platform = Layer.mergeAll(AtomicFileSystem.layer, NodePath.layer)\n\n/**\n * What a caller may configure about a contained Node host.\n *\n * `platform` is deliberately absent. `ContainedSpawner.Options` declares it so a\n * caller that supplies its own spawner can describe one, but this native host\n * detaches by `process.platform` whatever a record claims. A caller-supplied\n * `\"win32\"` on a POSIX host would therefore\n * record `pgid: null` for a child that really does lead a group, and\n * {@link ProcessReaper.reap} would retire that record as `no-group` and leave\n * the orphan running forever \u2014 a durable lie rather than a compile error.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type ContainedOptions = ProcessReaper.SpawnerOptions & ProcessReaper.Options\n\n/** The reaper half of {@link ContainedOptions}. */\nconst reaping = (options?: ContainedOptions): ProcessReaper.Options => ({\n ownerPid: options?.ownerPid,\n system: options?.system\n})\n\n/**\n * Provides the default Node implementations for the whole closed Host surface.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layer: Layer.Layer<NodeHost, JjError> = Layer.mergeAll(\n ProcessConfinement.layer(),\n platform,\n Layer.provide(NodeChildProcessSpawner.layer, platform),\n httpClient,\n NodeJj.layer\n)\n\n/**\n * Provides the Node host with `Jj` bound to one absolute repository root.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layerAt = (repositoryRoot: string): Layer.Layer<NodeHost, JjError> =>\n Layer.mergeAll(\n ProcessConfinement.layer(),\n platform,\n Layer.provide(NodeChildProcessSpawner.layer, platform),\n httpClient,\n NodeJj.layerAt(absoluteRoot(repositoryRoot))\n )\n\n/**\n * Provides the Node host with process containment turned on.\n *\n * The difference from {@link layer} is what happens to a spawned process when\n * its run stops. Under {@link layer} a child is signalled when its scope\n * closes and then waited for, forever if it ignores `SIGTERM`, and a host that\n * dies without closing its scopes abandons every child it started. This layer\n * gives each child an escalation deadline and records it in the\n * `ProcessLedger`, then sweeps the records a previous incarnation of the same\n * host left behind before it hands the host over\n * ({@link ProcessReaper.reap}).\n *\n * jj is contained here too: `layerContained` builds the `Jj` service over the\n * same spawner rather than letting it start its own children, so a `jj`\n * invocation a crashed host left running is a record the next incarnation\n * reaps like any other.\n *\n * The ledger is a requirement rather than a default because the durable half\n * of containment is only as good as the journal underneath it:\n * `ProcessLedger.layer` inherits a crashed incarnation's processes,\n * `ProcessLedger.layerMemory` contains this incarnation and nothing more, and\n * the choice belongs to the program that knows which it has.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layerContained = (\n options?: ContainedOptions\n): Layer.Layer<NodeHost, JjError, ProcessLedger.ProcessLedger> => {\n const spawner = Layer.provide(\n ProcessReaper.layerSpawner({ graceMs: options?.graceMs }),\n Layer.provide(NodeChildProcessSpawner.layer, platform)\n )\n return Layer.mergeAll(\n ProcessConfinement.layer(),\n platform,\n httpClient,\n // jj goes through the CONTAINED spawner here, not around it. `NodeJj.layer`\n // spawns its own children, which is right for a host that has no spawner\n // to offer, but under containment it would mean a `jj` that leads no\n // recorded process group, appears in no ledger, and survives the\n // incarnation that started it.\n Layer.provideMerge(NodeJj.layerSpawner, spawner)\n ).pipe(Layer.provideMerge(ProcessReaper.layer(reaping(options))))\n}\n\n/**\n * Provides the contained Node host with `Jj` bound to one absolute repository\n * root.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layerContainedAt = (\n repositoryRoot: string,\n options?: ContainedOptions\n): Layer.Layer<NodeHost, JjError, ProcessLedger.ProcessLedger> => {\n const spawner = Layer.provide(\n ProcessReaper.layerSpawner({ graceMs: options?.graceMs }),\n Layer.provide(NodeChildProcessSpawner.layer, platform)\n )\n return Layer.mergeAll(\n ProcessConfinement.layer(),\n platform,\n httpClient,\n Layer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AA,EACA,MAAM,QAAQ,wBAAwB,OAAO,QAAQ;AAAA,EACrD;AAAA,EACA,OAAO;AACT;AAQO,MAAM,UAAU,CAAC,mBACtB,MAAM;AAAA,EACJ,mBAAmB,MAAM;AAAA,EACzB;AAAA,EACA,MAAM,QAAQ,wBAAwB,OAAO,QAAQ;AAAA,EACrD;AAAA,EACA,OAAO,QAAQ,aAAa,cAAc,CAAC;AAC7C;AA4BK,MAAM,iBAAiB,CAC5B,YACgE;AAChE,QAAM,UAAU,MAAM;AAAA,IACpB,cAAc,aAAa,EAAE,SAAS,SAAS,QAAQ,CAAC;AAAA,IACxD,MAAM,QAAQ,wBAAwB,OAAO,QAAQ;AAAA,EACvD;AACA,SAAO,MAAM;AAAA,IACX,mBAAmB,MAAM;AAAA,IACzB;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,MAAM,aAAa,OAAO,cAAc,OAAO;AAAA,EACjD,EAAE,KAAK,MAAM,aAAa,cAAc,MAAM,QAAQ,OAAO,CAAC,CAAC,CAAC;AAClE;AASO,MAAM,mBAAmB,CAC9B,gBACA,YACgE;AAChE,QAAM,UAAU,MAAM;AAAA,IACpB,cAAc,aAAa,EAAE,SAAS,SAAS,QAAQ,CAAC;AAAA,IACxD,MAAM,QAAQ,wBAAwB,OAAO,QAAQ;AAAA,EACvD;AACA,SAAO,MAAM;AAAA,IACX,mBAAmB,MAAM;AAAA,IACzB;AAAA,IACA;AAAA,IACA,MAAM,aAAa,OAAO,eAAe,aAAa,cAAc,CAAC,GAAG,OAAO;AAAA,EACjF,EAAE,KAAK,MAAM,aAAa,cAAc,MAAM,QAAQ,OAAO,CAAC,CAAC,CAAC;AAClE;",
4
+ "sourcesContent": ["/**\n * Aggregate Node.js Host bundle.\n *\n * This module defines the `NodeHost` service union and a single `layer` that\n * provides the closed Host surface backed by Node: `@effect/platform-node`'s\n * filesystem, child-process spawner, Undici `HttpClient`, native `Path`,\n * and the Node `Jj` adapter from its own package. Use the layer when a Node\n * program wants every host capability from one place; use the individual\n * modules when a program should only be able to reach part of the host. The\n * bundle also supplies native `ProcessConfinement` for the kernel spawner.\n *\n * There is no Node HTTP module either: outgoing requests are Effect's\n * `HttpClient`, and `@effect/platform-node` already ships the Undici-backed\n * implementation. Undici follows no redirect unless a redirect interceptor is\n * installed, so every hop stays visible to `@smthrs/kernel`'s decorator.\n *\n * There is no Node shell module: running a command is Effect's\n * `ChildProcessSpawner`, and `@effect/platform-node` already ships the\n * implementation.\n *\n * @since 0.1.0\n */\n\nimport * as NodeChildProcessSpawner from \"@effect/platform-node/NodeChildProcessSpawner\"\nimport * as NodeCrypto from \"@effect/platform-node/NodeCrypto\"\nimport * as NodeFileSystem from \"@effect/platform-node/NodeFileSystem\"\nimport * as NodeHttpClient from \"@effect/platform-node/NodeHttpClient\"\nimport * as NodePath from \"@effect/platform-node/NodePath\"\nimport type { Jj, JjError } from \"@smthrs/jj\"\nimport * as NodeJj from \"@smthrs/jj/node/NodeJj\"\nimport type { HostServiceIds } from \"@smthrs/kernel/HostServices\"\nimport type * as KernelProcessConfinement from \"@smthrs/kernel/ProcessConfinement\"\nimport type * as ProcessLedger from \"@smthrs/kernel/ProcessLedger\"\nimport type { FileSystem } from \"effect/FileSystem\"\nimport type { HttpClient } from \"effect/http/HttpClient\"\nimport * as Layer from \"effect/Layer\"\nimport type * as Path from \"effect/Path\"\nimport type { ChildProcessSpawner } from \"effect/process/ChildProcessSpawner\"\nimport * as Schema from \"effect/Schema\"\nimport { isAbsolute } from \"node:path\"\nimport * as AtomicFileSystem from \"./AtomicFileSystem.ts\"\nimport * as EgressHttpClient from \"./EgressHttpClient.ts\"\nimport * as ProcessConfinement from \"./ProcessConfinement.ts\"\nimport * as ProcessReaper from \"./ProcessReaper.ts\"\n\n/**\n * The Node platform modules Effect ships, re-exported so a program that wants\n * only part of the host has one place to reach for them. `NodeJj` belongs to\n * `@smthrs/jj`; import it from there.\n *\n * `NodeCrypto` is here for a different reason than the rest. `Crypto` is not a\n * Host service \u2014 it carries no host authority the kernel could attenuate, so\n * it is not in {@link NodeHost} and not in the closed list \u2014 but every durable\n * composition needs one, and a program that already depends on this package\n * for its host should not have to add a second dependency for the digest.\n *\n * @category re-exports\n * @since 0.1.0\n */\nexport {\n AtomicFileSystem,\n EgressHttpClient,\n NodeChildProcessSpawner,\n NodeCrypto,\n NodeFileSystem,\n NodeHttpClient,\n ProcessReaper\n}\n\n/**\n * The `HttpClient` every bundle below installs: Undici through the egress\n * proxy this process's environment names, and a direct Undici pool when it\n * names none.\n *\n * `NodeHttpClient.layerUndici` is the direct pool unconditionally. It is still\n * re-exported above for a program composing its own services, but a bundle\n * that spans a whole host has to work inside a sandbox whose only way out is a\n * proxy, so the bundles read the environment. See {@link EgressHttpClient}.\n */\nconst httpClient = EgressHttpClient.layer(process.env)\n\n/**\n * The union of host services provided by the Node host layer.\n *\n * @category models\n * @since 0.1.0\n */\nexport type NodeHost =\n | FileSystem\n | Path.Path\n | ChildProcessSpawner\n | Jj\n | HttpClient\n | KernelProcessConfinement.ProcessConfinement\n\n/**\n * Invalid repository-root configuration, refused before layer construction.\n * @category errors\n * @since 1.0.0-rc.0\n */\nexport class NodeHostError extends Schema.TaggedError<NodeHostError>()(\"@smthrs/platform-node/NodeHostError\", {\n code: Schema.Literal(\"invalid_repository_root\"),\n message: Schema.String\n}) {\n override readonly name = \"NodeHostError\"\n}\n\nconst absoluteRoot = (root: string): string => {\n if (isAbsolute(root)) return root\n throw new NodeHostError({\n code: \"invalid_repository_root\",\n message: `NodeHost requires an absolute repository root, got ${\n JSON.stringify(Array.from(root).slice(0, 64).join(\"\"))\n }`\n })\n}\n\n/**\n * Stable implementation identities for the raw bundle's five Host slots.\n * Contained POSIX factories replace its spawner with {@link ProcessReaper.layerSpawner}.\n * @category models\n * @since 1.0.0-rc.0\n */\nexport const implementationIds: Readonly<Record<(typeof HostServiceIds)[number], string>> = {\n \"effect/FileSystem\": \"@smthrs/platform-node/AtomicFileSystem\",\n \"effect/Path\": \"@effect/platform-node/NodePath\",\n \"effect/process/ChildProcessSpawner\": \"@effect/platform-node/NodeChildProcessSpawner\",\n \"@smthrs/jj/Jj\": \"@smthrs/jj/node/NodeJj\",\n \"effect/HttpClient\": \"@smthrs/platform-node/EgressHttpClient\"\n}\n\n/** The two services `NodeChildProcessSpawner` resolves paths and files with. */\nconst platform = Layer.mergeAll(AtomicFileSystem.layer, NodePath.layer)\n\n/**\n * What a caller may configure about a contained Node host.\n *\n * `platform` is deliberately absent. `ContainedSpawner.Options` declares it so a\n * caller that supplies its own spawner can describe one, but this native host\n * detaches by `process.platform` whatever a record claims. A caller-supplied\n * `\"win32\"` on a POSIX host would therefore\n * record `pgid: null` for a child that really does lead a group, and\n * {@link ProcessReaper.reap} would retire that record as `no-group` and leave\n * the orphan running forever \u2014 a durable lie rather than a compile error.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type ContainedOptions = ProcessReaper.SpawnerOptions & ProcessReaper.Options\n\n/** The reaper half of {@link ContainedOptions}. */\nconst reaping = (options?: ContainedOptions): ProcessReaper.Options => ({\n ownerPid: options?.ownerPid,\n system: options?.system\n})\n\n/**\n * Provides the default Node implementations for the whole closed Host surface.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layer: Layer.Layer<NodeHost, JjError> = Layer.mergeAll(\n ProcessConfinement.layer(),\n platform,\n Layer.provide(NodeChildProcessSpawner.layer, platform),\n httpClient,\n NodeJj.layer\n)\n\n/**\n * Provides the Node host with `Jj` bound to one absolute repository root.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layerAt = (repositoryRoot: string): Layer.Layer<NodeHost, JjError> =>\n Layer.mergeAll(\n ProcessConfinement.layer(),\n platform,\n Layer.provide(NodeChildProcessSpawner.layer, platform),\n httpClient,\n NodeJj.layerAt(absoluteRoot(repositoryRoot))\n )\n\n/**\n * Provides the Node host with process containment turned on.\n *\n * The difference from {@link layer} is what happens to a spawned process when\n * its run stops. Under {@link layer} a child is signalled when its scope\n * closes and then waited for, forever if it ignores `SIGTERM`, and a host that\n * dies without closing its scopes abandons every child it started. This layer\n * gives each child an escalation deadline and records it in the\n * `ProcessLedger`, then sweeps the records a previous incarnation of the same\n * host left behind before it hands the host over\n * ({@link ProcessReaper.reap}).\n *\n * jj is contained here too: `layerContained` builds the `Jj` service over the\n * same spawner rather than letting it start its own children, so a `jj`\n * invocation a crashed host left running is a record the next incarnation\n * reaps like any other.\n *\n * The ledger is a requirement rather than a default because the durable half\n * of containment is only as good as the journal underneath it:\n * `ProcessLedger.layer` inherits a crashed incarnation's processes,\n * `ProcessLedger.layerMemory` contains this incarnation and nothing more, and\n * the choice belongs to the program that knows which it has.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layerContained = (\n options?: ContainedOptions\n): Layer.Layer<NodeHost, JjError, ProcessLedger.ProcessLedger> => {\n const spawner = Layer.provide(\n ProcessReaper.layerSpawner({ graceMs: options?.graceMs }),\n Layer.provide(NodeChildProcessSpawner.layer, platform)\n )\n return Layer.mergeAll(\n ProcessConfinement.layer(),\n platform,\n httpClient,\n // jj goes through the CONTAINED spawner here, not around it. `NodeJj.layer`\n // spawns its own children, which is right for a host that has no spawner\n // to offer, but under containment it would mean a `jj` that leads no\n // recorded process group, appears in no ledger, and survives the\n // incarnation that started it.\n Layer.provideMerge(NodeJj.layerSpawner, spawner)\n ).pipe(Layer.provideMerge(ProcessReaper.layer(reaping(options))))\n}\n\n/**\n * Provides the contained Node host with `Jj` bound to one absolute repository\n * root.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layerContainedAt = (\n repositoryRoot: string,\n options?: ContainedOptions\n): Layer.Layer<NodeHost, JjError, ProcessLedger.ProcessLedger> => {\n const spawner = Layer.provide(\n ProcessReaper.layerSpawner({ graceMs: options?.graceMs }),\n Layer.provide(NodeChildProcessSpawner.layer, platform)\n )\n return Layer.mergeAll(\n ProcessConfinement.layer(),\n platform,\n httpClient,\n Layer.provideMerge(NodeJj.layerSpawnerAt(absoluteRoot(repositoryRoot)),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,EACrD;AAAA,EACA,OAAO;AACT;AAQO,MAAM,UAAU,CAAC,mBACtB,MAAM;AAAA,EACJ,mBAAmB,MAAM;AAAA,EACzB;AAAA,EACA,MAAM,QAAQ,wBAAwB,OAAO,QAAQ;AAAA,EACrD;AAAA,EACA,OAAO,QAAQ,aAAa,cAAc,CAAC;AAC7C;AA4BK,MAAM,iBAAiB,CAC5B,YACgE;AAChE,QAAM,UAAU,MAAM;AAAA,IACpB,cAAc,aAAa,EAAE,SAAS,SAAS,QAAQ,CAAC;AAAA,IACxD,MAAM,QAAQ,wBAAwB,OAAO,QAAQ;AAAA,EACvD;AACA,SAAO,MAAM;AAAA,IACX,mBAAmB,MAAM;AAAA,IACzB;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,MAAM,aAAa,OAAO,cAAc,OAAO;AAAA,EACjD,EAAE,KAAK,MAAM,aAAa,cAAc,MAAM,QAAQ,OAAO,CAAC,CAAC,CAAC;AAClE;AASO,MAAM,mBAAmB,CAC9B,gBACA,YACgE;AAChE,QAAM,UAAU,MAAM;AAAA,IACpB,cAAc,aAAa,EAAE,SAAS,SAAS,QAAQ,CAAC;AAAA,IACxD,MAAM,QAAQ,wBAAwB,OAAO,QAAQ;AAAA,EACvD;AACA,SAAO,MAAM;AAAA,IACX,mBAAmB,MAAM;AAAA,IACzB;AAAA,IACA;AAAA,IACA,MAAM,aAAa,OAAO,eAAe,aAAa,cAAc,CAAC,GAAG,OAAO;AAAA,EACjF,EAAE,KAAK,MAAM,aAAa,cAAc,MAAM,QAAQ,OAAO,CAAC,CAAC,CAAC;AAClE;",
6
6
  "names": []
7
7
  }
@@ -36,7 +36,7 @@ var KernelProcessConfinement = __toESM(require("@smthrs/kernel/ProcessConfinemen
36
36
  var Effect = __toESM(require("effect/Effect"), 1);
37
37
  var Layer = __toESM(require("effect/Layer"), 1);
38
38
  var PlatformError = __toESM(require("effect/PlatformError"), 1);
39
- var ChildProcess = __toESM(require("effect/unstable/process/ChildProcess"), 1);
39
+ var ChildProcess = __toESM(require("effect/process/ChildProcess"), 1);
40
40
  var NodeFs = __toESM(require("node:fs"), 1);
41
41
  var NodeOs = __toESM(require("node:os"), 1);
42
42
  var NodePath = __toESM(require("node:path"), 1);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ProcessConfinement.ts"],
4
- "sourcesContent": ["/**\n * The kernel's `ProcessConfinement` seam, filled with this host's native\n * sandbox: bubblewrap on Linux, seatbelt on macOS.\n *\n * `@smthrs/kernel`'s `ChildProcessSpawner.layer` hands every stage that passed\n * its `proc:spawn` check to the confinement in its context, together with the\n * `ProcessConfinement.Profile` the grants in force admit. This module turns\n * that profile into a {@link ProcessSandbox.Request}, plans it against the\n * workspace, and wraps the stage's argv in the mechanism the host has, so an\n * approved `bash` can write only where an `fs:write` grant says and reach the\n * network only when a `net:*` grant says. A stage that asked for the platform\n * shell is spelled out as `/bin/sh -c <line>` first: wrapping a `shell: true`\n * command line would otherwise leave its redirections and pipes to a shell\n * outside the sandbox.\n *\n * A host with no mechanism is the one decision this module leaves to its\n * caller: {@link Options.unavailable} either refuses the spawn, so nothing\n * runs that the profile would not have confined, or runs it unconfined with\n * a warning, the way every host did before this seam existed. A write set\n * the mechanism cannot enforce safely, a symbolic link below the workspace\n * root, is always refused.\n *\n * @since 1.0.0-rc.1\n */\n\nimport * as KernelProcessConfinement from \"@smthrs/kernel/ProcessConfinement\"\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport * as PlatformError from \"effect/PlatformError\"\nimport type * as Scope from \"effect/Scope\"\nimport * as ChildProcess from \"effect/unstable/process/ChildProcess\"\nimport * as NodeFs from \"node:fs\"\nimport * as NodeOs from \"node:os\"\nimport * as NodePath from \"node:path\"\nimport * as ProcessSandbox from \"./ProcessSandbox.ts\"\n\n/**\n * How the confinement is built.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface Options {\n /**\n * What happens when this host has no mechanism to enforce a profile with.\n * `\"refuse\"` fails the spawn, so a command never runs with more than the\n * profile allows; `\"unconfined\"` runs it as given and logs a\n * warning naming what the host lacks.\n */\n readonly unavailable?: \"refuse\" | \"unconfined\" | undefined\n /** The host facts mechanism selection reads; defaults to the real host. */\n readonly host?: ProcessSandbox.Host | undefined\n /** Where each run's private temporary directory is created; defaults to the OS temporary directory. */\n readonly temporaryDirectory?: string | undefined\n}\n\nconst shellLine = (command: ChildProcess.StandardCommand): string => [command.command, ...command.args].join(\" \")\n\n/**\n * The argv a stage executes, with a shell request made explicit.\n *\n * Node runs a `shell: true` stage as `/bin/sh -c <line>` on POSIX, and a\n * string shell as `<shell> -c <line>`; the wrapper needs that program to be\n * the one it confines, so the shell becomes the argv's first token and the\n * spawned stage no longer asks for one.\n */\nconst argvOf = (command: ChildProcess.StandardCommand): ReadonlyArray<string> => {\n const shell = command.options.shell\n if (shell === undefined || shell === false) return [command.command, ...command.args]\n return [shell === true ? \"/bin/sh\" : shell, \"-c\", shellLine(command)]\n}\n\nconst failure = (\n tag: \"NotFound\" | \"PermissionDenied\" | \"Unknown\",\n command: ChildProcess.StandardCommand,\n description: string,\n cause: unknown\n): PlatformError.PlatformError =>\n PlatformError.systemError({\n _tag: tag,\n module: \"ProcessConfinement\",\n method: \"confine\",\n pathOrDescriptor: shellLine(command),\n description,\n cause\n })\n\nconst messageOf = (cause: unknown): string =>\n ProcessSandbox.isUnenforceable(cause)\n ? cause.message\n : cause instanceof Error\n ? cause.message\n : String(cause)\n\n/** Classic BPF for seccomp_data: deny host Unix sockets and io_uring, preserving stream socketpair.\n * Closed networking additionally denies every IP socket family.\n * Wrong ABI and x32 syscall encodings fail closed rather than bypassing socket(). */\nconst networkFilter = (architecture: string, network: \"none\" | \"open\"): Uint8Array => {\n const abi = architecture === \"x64\"\n ? { audit: 0xc000003e, socket: 41, socketpair: 53 }\n : architecture === \"arm64\"\n ? { audit: 0xc00000b7, socket: 198, socketpair: 199 }\n : undefined\n if (abi === undefined) throw new Error(`native-network seccomp is unavailable on ${architecture}`)\n const instructions: Array<readonly [number, number, number, number]> = [\n [0x20, 0, 0, 4], // load audit architecture\n [0x15, 1, 0, abi.audit],\n [0x06, 0, 0, 0x80000000], // kill unsupported ABI\n [0x20, 0, 0, 0], // load syscall number\n [0x35, 0, 1, 0x40000000],\n [0x06, 0, 0, 0x80000000], // kill x32 / invalid high syscall numbers\n [0x15, 0, 1, 425], // io_uring_setup on both supported ABIs\n [0x06, 0, 0, 0x00050001], // io_uring can otherwise create sockets without socket()\n [0x15, 0, 6, abi.socketpair],\n [0x20, 0, 0, 16], // socketpair domain\n [0x15, 0, 4, 1], // AF_UNIX\n [0x20, 0, 0, 24], // socketpair type, low 32 bits of args[1]\n [0x54, 0, 0, 0xf], // strip SOCK_NONBLOCK and SOCK_CLOEXEC\n [0x15, 1, 0, 1], // only SOCK_STREAM; Linux aliases SOCK_RAW to datagram operations\n [0x06, 0, 0, 0x00050001],\n [0x20, 0, 0, 0] // reload syscall number before the socket() policy\n ]\n if (network === \"none\") {\n instructions.push([0x15, 0, 1, abi.socket], [0x06, 0, 0, 0x00050001]) // EPERM for every socket family\n } else {\n instructions.push(\n [0x15, 0, 3, abi.socket],\n [0x20, 0, 0, 16], // socket domain, low 32 bits of args[0]\n [0x15, 0, 1, 1], // AF_UNIX; IP families remain available\n [0x06, 0, 0, 0x00050001]\n )\n }\n instructions.push([0x06, 0, 0, 0x7fff0000]) // SECCOMP_RET_ALLOW\n const bytes = new Uint8Array(instructions.length * 8)\n const view = new DataView(bytes.buffer)\n for (const [index, [code, jt, jf, value]] of instructions.entries()) {\n view.setUint16(index * 8, code, true)\n view.setUint8(index * 8 + 2, jt)\n view.setUint8(index * 8 + 3, jf)\n view.setUint32(index * 8 + 4, value, true)\n }\n return bytes\n}\n\n/**\n * Builds the native confinement.\n *\n * @category constructors\n * @since 1.0.0-rc.1\n */\nexport const make = (options: Options = {}): KernelProcessConfinement.Service => {\n const hostFacts = options.host ?? ProcessSandbox.host()\n const temporaryRoot = options.temporaryDirectory ?? NodeOs.tmpdir()\n const unavailable = options.unavailable ?? \"refuse\"\n const confine = Effect.fn(\"ProcessConfinement.confine\")(function*(\n command: ChildProcess.StandardCommand,\n profile: KernelProcessConfinement.Profile\n ): Effect.fn.Return<ChildProcess.StandardCommand, PlatformError.PlatformError, Scope.Scope> {\n const request: ProcessSandbox.Request = {\n network: profile.network,\n unixSockets: false,\n strict: true,\n reads: profile.reads,\n writes: profile.writes,\n readOnly: profile.readOnly\n }\n const selected = ProcessSandbox.select(request, hostFacts)\n if (ProcessSandbox.isUnenforceable(selected)) {\n if (unavailable === \"refuse\") {\n return yield* failure(\n \"NotFound\",\n command,\n `${selected.message} This host refuses to spawn unconfined.`,\n selected\n )\n }\n yield* Effect.logWarning(`${selected.message} Running unconfined.`)\n return command\n }\n // The stage's directory is absolute: the kernel spawner roots it first.\n const cwd = command.options.cwd ?? profile.workspaceRoot\n const within = (root: string, path: string): boolean => {\n const relative = NodePath.relative(root, path)\n return relative !== \"..\" && !relative.startsWith(`..${NodePath.sep}`) && !NodePath.isAbsolute(relative)\n }\n if (!within(profile.workspaceRoot, cwd)) {\n return yield* failure(\"PermissionDenied\", command, \"command directory is outside the workspace\", undefined)\n }\n // A lexical workspace path can enter an unrelated host directory through\n // a symlink. Check the real directory before granting or preparing a run.\n const canonical = yield* Effect.try({\n try: () => {\n const root = NodeFs.realpathSync(profile.workspaceRoot)\n const directory = NodeFs.realpathSync(cwd)\n if (!within(root, directory)) throw new Error(\"command directory is outside the workspace\")\n for (const relative of profile.reads) {\n const lexical = NodePath.resolve(root, relative)\n if (!within(root, lexical)) continue\n // A read bind follows its source symlink. Refuse a grant that would\n // therefore mount unrelated host bytes inside the workspace.\n if (NodeFs.existsSync(lexical)) {\n const real = NodeFs.realpathSync(lexical)\n if (!within(root, real)) throw new Error(\"read grant resolves outside the workspace\")\n if (real !== lexical) throw new Error(\"read grant is a symbolic link\")\n }\n }\n return { root, cwd: directory }\n },\n catch: (cause) => failure(\"PermissionDenied\", command, messageOf(cause), cause)\n })\n // The private tmp lives as long as the spawn's scope, however preparation\n // ends; the declared write directories are created so the mechanism has\n // something to bind, which the grant that opened them already permits.\n const allocatedTmp = yield* Effect.acquireRelease(\n Effect.try({\n try: () => NodeFs.mkdtempSync(NodePath.join(temporaryRoot, \"smithers-confinement-\")),\n catch: (cause) => failure(\"Unknown\", command, `could not prepare the confinement: ${messageOf(cause)}`, cause)\n }),\n (directory) =>\n Effect.sync(() => {\n try {\n NodeFs.rmSync(directory, { recursive: true, force: true })\n } catch {\n // Cleanup is best-effort when the host refuses directory removal.\n }\n })\n )\n const tmp = yield* Effect.try({\n try: () => NodeFs.realpathSync(allocatedTmp),\n catch: (cause) => failure(\"Unknown\", command, `could not prepare the confinement: ${messageOf(cause)}`, cause)\n })\n const planned = yield* Effect.try({\n try: () => ProcessSandbox.plan(request, { workspaceRoot: canonical.root, cwd: canonical.cwd, tmp }, hostFacts),\n catch: (cause) => failure(\"Unknown\", command, `could not plan the confinement: ${messageOf(cause)}`, cause)\n })\n if (ProcessSandbox.isUnenforceable(planned)) {\n return yield* failure(\"PermissionDenied\", command, planned.message, planned)\n }\n // Build outputs may grant their parent directory. An agent grant must\n // never inherit that widening when a requested tree is already a file.\n const exactWrites = profile.writes.map((relative) => NodePath.resolve(planned.workspaceRoot, relative))\n if (planned.writes.some((write) => !exactWrites.includes(write))) {\n return yield* failure(\"PermissionDenied\", command, \"write grant is not a directory tree\", undefined)\n }\n // A workspace link does not grant authority to its target on the host.\n const confinement: ProcessSandbox.Plan = { ...planned, externalReads: [] }\n yield* Effect.try({\n try: () => {\n ProcessSandbox.validateWrites(confinement, hostFacts)\n NodeFs.mkdirSync(NodePath.join(tmp, \"home\"), { recursive: true })\n NodeFs.mkdirSync(NodePath.join(tmp, \"cache\"), { recursive: true })\n for (const write of planned.writes) NodeFs.mkdirSync(write, { recursive: true })\n },\n catch: (cause) => failure(\"Unknown\", command, `could not prepare the confinement: ${messageOf(cause)}`, cause)\n })\n // Only the target receives its requested environment. Dynamic-loader and\n // other startup variables must never configure the host sandbox launcher.\n const targetEnvironment: Record<string, string> = {}\n const inherited = command.options.env === undefined || command.options.extendEnv === true\n for (const [name, value] of Object.entries(inherited ? process.env : {})) {\n // Bash exports functions as names such as BASH_FUNC_which%%. These\n // ambient entries cannot be exported by the portable inner launcher.\n if (typeof value === \"string\" && /^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) targetEnvironment[name] = value\n }\n for (const [name, value] of Object.entries(command.options.env ?? {})) {\n if (typeof value === \"string\") targetEnvironment[name] = value\n else delete targetEnvironment[name]\n }\n const privateEnvironment = ProcessSandbox.environment(confinement)\n const script = yield* Effect.try({\n try: () => {\n const quote = (value: string): string => `'${value.replaceAll(\"'\", \"'\\\\''\")}'`\n const exports: Array<string> = []\n for (const [name, value] of Object.entries({ ...targetEnvironment, ...privateEnvironment })) {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) throw new Error(\"environment variable name is not portable\")\n if (value.includes(\"\\0\")) throw new Error(\"environment variable contains a null byte\")\n exports.push(`export ${name}=${quote(value)}`)\n }\n const file = NodePath.join(tmp, \"environment.sh\")\n // Values stay off argv and journal receipts; the script is private,\n // removed with the scope, and interpreted only inside confinement.\n NodeFs.writeFileSync(\n file,\n [\n \"#!/bin/sh\",\n \"unset ENV BASH_ENV CDPATH PWD OLDPWD SHLVL _\",\n ...exports,\n \"exec \\\"$@\\\"\",\n \"\"\n ].join(\"\\n\"),\n { flag: \"wx\", mode: 0o600 }\n )\n return file\n },\n catch: (cause) => failure(\"PermissionDenied\", command, messageOf(cause), cause)\n })\n // Resolve the actual program before wrapping it in the environment shell.\n // Otherwise the sandbox sees only /usr/bin/env and omits a native helper\n // installed outside its ordinary runtime paths.\n const originalArgv = argvOf(command)\n const launch = ProcessSandbox.launcher(\n originalArgv[0]!,\n targetEnvironment.PATH,\n [...confinement.reads, ...confinement.writes, ...confinement.externalReads],\n confinement.workspaceRoot,\n hostFacts\n )\n const targetArgv = [\"/usr/bin/env\", \"-i\", \"/bin/sh\", script, launch.program, ...originalArgv.slice(1)]\n const wrapped = yield* Effect.try({\n try: () =>\n ProcessSandbox.wrap(\n { ...confinement, externalReads: [...confinement.externalReads, ...launch.reads, script] },\n targetArgv,\n targetEnvironment,\n hostFacts\n ),\n catch: (cause) => failure(\"Unknown\", command, `could not render the confinement: ${messageOf(cause)}`, cause)\n })\n let [executable, ...args] = wrapped.argv\n if (selected._tag === \"bubblewrap\") {\n const filter = yield* Effect.try({\n try: () => {\n const file = NodePath.join(tmp, \"network.seccomp\")\n NodeFs.writeFileSync(file, networkFilter(process.arch, profile.network), { flag: \"wx\", mode: 0o600 })\n return file\n },\n catch: (cause) => failure(\"PermissionDenied\", command, messageOf(cause), cause)\n })\n let fd = 3\n while (command.options.additionalFds?.[`fd${fd}`] !== undefined) fd++\n // A regular file avoids a filter-input pipe whose early closure can\n // surface as an unhandled ECONNRESET before bwrap reports its refusal.\n args = [\n \"-c\",\n `exec ${fd}<\"$1\"; shift; exec \"$@\"`,\n \"smithers-seccomp\",\n filter,\n executable!,\n \"--seccomp\",\n String(fd),\n ...args\n ]\n executable = \"/bin/sh\"\n }\n return ChildProcess.make(executable!, args, {\n ...command.options,\n cwd: canonical.cwd,\n shell: false,\n env: { PATH: \"/usr/bin:/bin:/usr/sbin:/sbin\", LANG: \"C\", ...privateEnvironment },\n extendEnv: false\n })\n })\n return KernelProcessConfinement.ProcessConfinement.of({ confine })\n}\n\n/**\n * Provides the native confinement.\n *\n * @category layers\n * @since 1.0.0-rc.1\n */\nexport const layer = (options: Options = {}): Layer.Layer<KernelProcessConfinement.ProcessConfinement> =>\n Layer.succeed(KernelProcessConfinement.ProcessConfinement)(make(options))\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBA,+BAA0C;AAC1C,aAAwB;AACxB,YAAuB;AACvB,oBAA+B;AAE/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CAAC;AACD,SAAO,yBAAyB,mBAAmB,GAAG,EAAE,QAAQ,CAAC;AACnE;AAQO,MAAM,QAAQ,CAAC,UAAmB,CAAC,MACxC,MAAM,QAAQ,yBAAyB,kBAAkB,EAAE,KAAK,OAAO,CAAC;",
4
+ "sourcesContent": ["/**\n * The kernel's `ProcessConfinement` seam, filled with this host's native\n * sandbox: bubblewrap on Linux, seatbelt on macOS.\n *\n * `@smthrs/kernel`'s `ChildProcessSpawner.layer` hands every stage that passed\n * its `proc:spawn` check to the confinement in its context, together with the\n * `ProcessConfinement.Profile` the grants in force admit. This module turns\n * that profile into a {@link ProcessSandbox.Request}, plans it against the\n * workspace, and wraps the stage's argv in the mechanism the host has, so an\n * approved `bash` can write only where an `fs:write` grant says and reach the\n * network only when a `net:*` grant says. A stage that asked for the platform\n * shell is spelled out as `/bin/sh -c <line>` first: wrapping a `shell: true`\n * command line would otherwise leave its redirections and pipes to a shell\n * outside the sandbox.\n *\n * A host with no mechanism is the one decision this module leaves to its\n * caller: {@link Options.unavailable} either refuses the spawn, so nothing\n * runs that the profile would not have confined, or runs it unconfined with\n * a warning, the way every host did before this seam existed. A write set\n * the mechanism cannot enforce safely, a symbolic link below the workspace\n * root, is always refused.\n *\n * @since 1.0.0-rc.1\n */\n\nimport * as KernelProcessConfinement from \"@smthrs/kernel/ProcessConfinement\"\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport * as PlatformError from \"effect/PlatformError\"\nimport * as ChildProcess from \"effect/process/ChildProcess\"\nimport type * as Scope from \"effect/Scope\"\nimport * as NodeFs from \"node:fs\"\nimport * as NodeOs from \"node:os\"\nimport * as NodePath from \"node:path\"\nimport * as ProcessSandbox from \"./ProcessSandbox.ts\"\n\n/**\n * How the confinement is built.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface Options {\n /**\n * What happens when this host has no mechanism to enforce a profile with.\n * `\"refuse\"` fails the spawn, so a command never runs with more than the\n * profile allows; `\"unconfined\"` runs it as given and logs a\n * warning naming what the host lacks.\n */\n readonly unavailable?: \"refuse\" | \"unconfined\" | undefined\n /** The host facts mechanism selection reads; defaults to the real host. */\n readonly host?: ProcessSandbox.Host | undefined\n /** Where each run's private temporary directory is created; defaults to the OS temporary directory. */\n readonly temporaryDirectory?: string | undefined\n}\n\nconst shellLine = (command: ChildProcess.StandardCommand): string => [command.command, ...command.args].join(\" \")\n\n/**\n * The argv a stage executes, with a shell request made explicit.\n *\n * Node runs a `shell: true` stage as `/bin/sh -c <line>` on POSIX, and a\n * string shell as `<shell> -c <line>`; the wrapper needs that program to be\n * the one it confines, so the shell becomes the argv's first token and the\n * spawned stage no longer asks for one.\n */\nconst argvOf = (command: ChildProcess.StandardCommand): ReadonlyArray<string> => {\n const shell = command.options.shell\n if (shell === undefined || shell === false) return [command.command, ...command.args]\n return [shell === true ? \"/bin/sh\" : shell, \"-c\", shellLine(command)]\n}\n\nconst failure = (\n tag: \"NotFound\" | \"PermissionDenied\" | \"Unknown\",\n command: ChildProcess.StandardCommand,\n description: string,\n cause: unknown\n): PlatformError.PlatformError =>\n PlatformError.systemError({\n _tag: tag,\n module: \"ProcessConfinement\",\n method: \"confine\",\n pathOrDescriptor: shellLine(command),\n description,\n cause\n })\n\nconst messageOf = (cause: unknown): string =>\n ProcessSandbox.isUnenforceable(cause)\n ? cause.message\n : cause instanceof Error\n ? cause.message\n : String(cause)\n\n/** Classic BPF for seccomp_data: deny host Unix sockets and io_uring, preserving stream socketpair.\n * Closed networking additionally denies every IP socket family.\n * Wrong ABI and x32 syscall encodings fail closed rather than bypassing socket(). */\nconst networkFilter = (architecture: string, network: \"none\" | \"open\"): Uint8Array => {\n const abi = architecture === \"x64\"\n ? { audit: 0xc000003e, socket: 41, socketpair: 53 }\n : architecture === \"arm64\"\n ? { audit: 0xc00000b7, socket: 198, socketpair: 199 }\n : undefined\n if (abi === undefined) throw new Error(`native-network seccomp is unavailable on ${architecture}`)\n const instructions: Array<readonly [number, number, number, number]> = [\n [0x20, 0, 0, 4], // load audit architecture\n [0x15, 1, 0, abi.audit],\n [0x06, 0, 0, 0x80000000], // kill unsupported ABI\n [0x20, 0, 0, 0], // load syscall number\n [0x35, 0, 1, 0x40000000],\n [0x06, 0, 0, 0x80000000], // kill x32 / invalid high syscall numbers\n [0x15, 0, 1, 425], // io_uring_setup on both supported ABIs\n [0x06, 0, 0, 0x00050001], // io_uring can otherwise create sockets without socket()\n [0x15, 0, 6, abi.socketpair],\n [0x20, 0, 0, 16], // socketpair domain\n [0x15, 0, 4, 1], // AF_UNIX\n [0x20, 0, 0, 24], // socketpair type, low 32 bits of args[1]\n [0x54, 0, 0, 0xf], // strip SOCK_NONBLOCK and SOCK_CLOEXEC\n [0x15, 1, 0, 1], // only SOCK_STREAM; Linux aliases SOCK_RAW to datagram operations\n [0x06, 0, 0, 0x00050001],\n [0x20, 0, 0, 0] // reload syscall number before the socket() policy\n ]\n if (network === \"none\") {\n instructions.push([0x15, 0, 1, abi.socket], [0x06, 0, 0, 0x00050001]) // EPERM for every socket family\n } else {\n instructions.push(\n [0x15, 0, 3, abi.socket],\n [0x20, 0, 0, 16], // socket domain, low 32 bits of args[0]\n [0x15, 0, 1, 1], // AF_UNIX; IP families remain available\n [0x06, 0, 0, 0x00050001]\n )\n }\n instructions.push([0x06, 0, 0, 0x7fff0000]) // SECCOMP_RET_ALLOW\n const bytes = new Uint8Array(instructions.length * 8)\n const view = new DataView(bytes.buffer)\n for (const [index, [code, jt, jf, value]] of instructions.entries()) {\n view.setUint16(index * 8, code, true)\n view.setUint8(index * 8 + 2, jt)\n view.setUint8(index * 8 + 3, jf)\n view.setUint32(index * 8 + 4, value, true)\n }\n return bytes\n}\n\n/**\n * Builds the native confinement.\n *\n * @category constructors\n * @since 1.0.0-rc.1\n */\nexport const make = (options: Options = {}): KernelProcessConfinement.Service => {\n const hostFacts = options.host ?? ProcessSandbox.host()\n const temporaryRoot = options.temporaryDirectory ?? NodeOs.tmpdir()\n const unavailable = options.unavailable ?? \"refuse\"\n const confine = Effect.fn(\"ProcessConfinement.confine\")(function*(\n command: ChildProcess.StandardCommand,\n profile: KernelProcessConfinement.Profile\n ): Effect.fn.Return<ChildProcess.StandardCommand, PlatformError.PlatformError, Scope.Scope> {\n const request: ProcessSandbox.Request = {\n network: profile.network,\n unixSockets: false,\n strict: true,\n reads: profile.reads,\n writes: profile.writes,\n readOnly: profile.readOnly\n }\n const selected = ProcessSandbox.select(request, hostFacts)\n if (ProcessSandbox.isUnenforceable(selected)) {\n if (unavailable === \"refuse\") {\n return yield* failure(\n \"NotFound\",\n command,\n `${selected.message} This host refuses to spawn unconfined.`,\n selected\n )\n }\n yield* Effect.logWarning(`${selected.message} Running unconfined.`)\n return command\n }\n // The stage's directory is absolute: the kernel spawner roots it first.\n const cwd = command.options.cwd ?? profile.workspaceRoot\n const within = (root: string, path: string): boolean => {\n const relative = NodePath.relative(root, path)\n return relative !== \"..\" && !relative.startsWith(`..${NodePath.sep}`) && !NodePath.isAbsolute(relative)\n }\n if (!within(profile.workspaceRoot, cwd)) {\n return yield* failure(\"PermissionDenied\", command, \"command directory is outside the workspace\", undefined)\n }\n // A lexical workspace path can enter an unrelated host directory through\n // a symlink. Check the real directory before granting or preparing a run.\n const canonical = yield* Effect.try({\n try: () => {\n const root = NodeFs.realpathSync(profile.workspaceRoot)\n const directory = NodeFs.realpathSync(cwd)\n if (!within(root, directory)) throw new Error(\"command directory is outside the workspace\")\n for (const relative of profile.reads) {\n const lexical = NodePath.resolve(root, relative)\n if (!within(root, lexical)) continue\n // A read bind follows its source symlink. Refuse a grant that would\n // therefore mount unrelated host bytes inside the workspace.\n if (NodeFs.existsSync(lexical)) {\n const real = NodeFs.realpathSync(lexical)\n if (!within(root, real)) throw new Error(\"read grant resolves outside the workspace\")\n if (real !== lexical) throw new Error(\"read grant is a symbolic link\")\n }\n }\n return { root, cwd: directory }\n },\n catch: (cause) => failure(\"PermissionDenied\", command, messageOf(cause), cause)\n })\n // The private tmp lives as long as the spawn's scope, however preparation\n // ends; the declared write directories are created so the mechanism has\n // something to bind, which the grant that opened them already permits.\n const allocatedTmp = yield* Effect.acquireRelease(\n Effect.try({\n try: () => NodeFs.mkdtempSync(NodePath.join(temporaryRoot, \"smithers-confinement-\")),\n catch: (cause) => failure(\"Unknown\", command, `could not prepare the confinement: ${messageOf(cause)}`, cause)\n }),\n (directory) =>\n Effect.sync(() => {\n try {\n NodeFs.rmSync(directory, { recursive: true, force: true })\n } catch {\n // Cleanup is best-effort when the host refuses directory removal.\n }\n })\n )\n const tmp = yield* Effect.try({\n try: () => NodeFs.realpathSync(allocatedTmp),\n catch: (cause) => failure(\"Unknown\", command, `could not prepare the confinement: ${messageOf(cause)}`, cause)\n })\n const planned = yield* Effect.try({\n try: () => ProcessSandbox.plan(request, { workspaceRoot: canonical.root, cwd: canonical.cwd, tmp }, hostFacts),\n catch: (cause) => failure(\"Unknown\", command, `could not plan the confinement: ${messageOf(cause)}`, cause)\n })\n if (ProcessSandbox.isUnenforceable(planned)) {\n return yield* failure(\"PermissionDenied\", command, planned.message, planned)\n }\n // Build outputs may grant their parent directory. An agent grant must\n // never inherit that widening when a requested tree is already a file.\n const exactWrites = profile.writes.map((relative) => NodePath.resolve(planned.workspaceRoot, relative))\n if (planned.writes.some((write) => !exactWrites.includes(write))) {\n return yield* failure(\"PermissionDenied\", command, \"write grant is not a directory tree\", undefined)\n }\n // A workspace link does not grant authority to its target on the host.\n const confinement: ProcessSandbox.Plan = { ...planned, externalReads: [] }\n yield* Effect.try({\n try: () => {\n ProcessSandbox.validateWrites(confinement, hostFacts)\n NodeFs.mkdirSync(NodePath.join(tmp, \"home\"), { recursive: true })\n NodeFs.mkdirSync(NodePath.join(tmp, \"cache\"), { recursive: true })\n for (const write of planned.writes) NodeFs.mkdirSync(write, { recursive: true })\n },\n catch: (cause) => failure(\"Unknown\", command, `could not prepare the confinement: ${messageOf(cause)}`, cause)\n })\n // Only the target receives its requested environment. Dynamic-loader and\n // other startup variables must never configure the host sandbox launcher.\n const targetEnvironment: Record<string, string> = {}\n const inherited = command.options.env === undefined || command.options.extendEnv === true\n for (const [name, value] of Object.entries(inherited ? process.env : {})) {\n // Bash exports functions as names such as BASH_FUNC_which%%. These\n // ambient entries cannot be exported by the portable inner launcher.\n if (typeof value === \"string\" && /^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) targetEnvironment[name] = value\n }\n for (const [name, value] of Object.entries(command.options.env ?? {})) {\n if (typeof value === \"string\") targetEnvironment[name] = value\n else delete targetEnvironment[name]\n }\n const privateEnvironment = ProcessSandbox.environment(confinement)\n const script = yield* Effect.try({\n try: () => {\n const quote = (value: string): string => `'${value.replaceAll(\"'\", \"'\\\\''\")}'`\n const exports: Array<string> = []\n for (const [name, value] of Object.entries({ ...targetEnvironment, ...privateEnvironment })) {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) throw new Error(\"environment variable name is not portable\")\n if (value.includes(\"\\0\")) throw new Error(\"environment variable contains a null byte\")\n exports.push(`export ${name}=${quote(value)}`)\n }\n const file = NodePath.join(tmp, \"environment.sh\")\n // Values stay off argv and journal receipts; the script is private,\n // removed with the scope, and interpreted only inside confinement.\n NodeFs.writeFileSync(\n file,\n [\n \"#!/bin/sh\",\n \"unset ENV BASH_ENV CDPATH PWD OLDPWD SHLVL _\",\n ...exports,\n \"exec \\\"$@\\\"\",\n \"\"\n ].join(\"\\n\"),\n { flag: \"wx\", mode: 0o600 }\n )\n return file\n },\n catch: (cause) => failure(\"PermissionDenied\", command, messageOf(cause), cause)\n })\n // Resolve the actual program before wrapping it in the environment shell.\n // Otherwise the sandbox sees only /usr/bin/env and omits a native helper\n // installed outside its ordinary runtime paths.\n const originalArgv = argvOf(command)\n const launch = ProcessSandbox.launcher(\n originalArgv[0]!,\n targetEnvironment.PATH,\n [...confinement.reads, ...confinement.writes, ...confinement.externalReads],\n confinement.workspaceRoot,\n hostFacts\n )\n const targetArgv = [\"/usr/bin/env\", \"-i\", \"/bin/sh\", script, launch.program, ...originalArgv.slice(1)]\n const wrapped = yield* Effect.try({\n try: () =>\n ProcessSandbox.wrap(\n { ...confinement, externalReads: [...confinement.externalReads, ...launch.reads, script] },\n targetArgv,\n targetEnvironment,\n hostFacts\n ),\n catch: (cause) => failure(\"Unknown\", command, `could not render the confinement: ${messageOf(cause)}`, cause)\n })\n let [executable, ...args] = wrapped.argv\n if (selected._tag === \"bubblewrap\") {\n const filter = yield* Effect.try({\n try: () => {\n const file = NodePath.join(tmp, \"network.seccomp\")\n NodeFs.writeFileSync(file, networkFilter(process.arch, profile.network), { flag: \"wx\", mode: 0o600 })\n return file\n },\n catch: (cause) => failure(\"PermissionDenied\", command, messageOf(cause), cause)\n })\n let fd = 3\n while (command.options.additionalFds?.[`fd${fd}`] !== undefined) fd++\n // A regular file avoids a filter-input pipe whose early closure can\n // surface as an unhandled ECONNRESET before bwrap reports its refusal.\n args = [\n \"-c\",\n `exec ${fd}<\"$1\"; shift; exec \"$@\"`,\n \"smithers-seccomp\",\n filter,\n executable!,\n \"--seccomp\",\n String(fd),\n ...args\n ]\n executable = \"/bin/sh\"\n }\n return ChildProcess.make(executable!, args, {\n ...command.options,\n cwd: canonical.cwd,\n shell: false,\n env: { PATH: \"/usr/bin:/bin:/usr/sbin:/sbin\", LANG: \"C\", ...privateEnvironment },\n extendEnv: false\n })\n })\n return KernelProcessConfinement.ProcessConfinement.of({ confine })\n}\n\n/**\n * Provides the native confinement.\n *\n * @category layers\n * @since 1.0.0-rc.1\n */\nexport const layer = (options: Options = {}): Layer.Layer<KernelProcessConfinement.ProcessConfinement> =>\n Layer.succeed(KernelProcessConfinement.ProcessConfinement)(make(options))\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBA,+BAA0C;AAC1C,aAAwB;AACxB,YAAuB;AACvB,oBAA+B;AAC/B,mBAA8B;AAE9B,aAAwB;AACxB,aAAwB;AACxB,eAA0B;AAC1B,qBAAgC;AAs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MAAM,QAAQ,CAAC,UAAmB,CAAC,MACxC,MAAM,QAAQ,yBAAyB,kBAAkB,EAAE,KAAK,OAAO,CAAC;",
6
6
  "names": []
7
7
  }
@@ -53,7 +53,7 @@ import * as ProcessLedger from "@smthrs/kernel/ProcessLedger";
53
53
  import * as Effect from "effect/Effect";
54
54
  import * as Layer from "effect/Layer";
55
55
  import * as Metric from "effect/Metric";
56
- import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
56
+ import { ChildProcessSpawner } from "effect/process/ChildProcessSpawner";
57
57
  import * as ProcessCleanup from "./internal/ProcessCleanup.ts";
58
58
  /**
59
59
  * What the operating system can say about a pid.
@@ -1 +1 @@
1
- {"version":3,"file":"ProcessReaper.d.ts","sourceRoot":"","sources":["../../src/ProcessReaper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,KAAK,gBAAgB,MAAM,iCAAiC,CAAA;AACnE,OAAO,KAAK,aAAa,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,mBAAmB,EAAuB,MAAM,6CAA6C,CAAA;AAOtG,OAAO,KAAK,cAAc,MAAM,8BAA8B,CAAA;AAG9D;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,WAAW;AACrB,gCAAgC;AAC9B,WAAW;AACb,qEAAqE;GACnE,cAAc;AAChB,wEAAwE;GACtE,QAAQ,CAAA;AAEZ;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS;AACnB,2EAA2E;AACzE;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC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CAmBtE,CAAA;AAEJ;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,KAAK,GAAI,UAAU,OAAO,KAAG,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,aAAa,CAS5F,CAAA"}
@@ -52,7 +52,7 @@ var ProcessLedger = __toESM(require("@smthrs/kernel/ProcessLedger"), 1);
52
52
  var Effect = __toESM(require("effect/Effect"), 1);
53
53
  var Layer = __toESM(require("effect/Layer"), 1);
54
54
  var Metric = __toESM(require("effect/Metric"), 1);
55
- var import_ChildProcessSpawner = require("effect/unstable/process/ChildProcessSpawner");
55
+ var import_ChildProcessSpawner = require("effect/process/ChildProcessSpawner");
56
56
  var import_node_child_process = require("node:child_process");
57
57
  var import_node_os = require("node:os");
58
58
  var import_node_path = require("node:path");