@smthrs/platform-node 0.0.0-stage → 1.0.0-rc.4

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 (442) hide show
  1. package/CHANGELOG.md +211 -0
  2. package/LICENSE +21 -0
  3. package/README.md +165 -2
  4. package/bin/darwin-arm64/smithers-jj-export +0 -0
  5. package/bin/darwin-x64/smithers-jj-export +0 -0
  6. package/bin/linux-arm64/smithers-jj-export +0 -0
  7. package/bin/linux-x64/smithers-jj-export +4 -0
  8. package/bin/win32-x64/smithers-jj-export.exe +0 -0
  9. package/dist/cjs/AtomicFileSystem.d.ts +147 -0
  10. package/dist/cjs/AtomicFileSystem.d.ts.map +1 -0
  11. package/dist/cjs/AtomicFileSystem.js +234 -0
  12. package/dist/cjs/AtomicFileSystem.js.map +7 -0
  13. package/dist/cjs/EgressHttpClient.d.ts +106 -0
  14. package/dist/cjs/EgressHttpClient.d.ts.map +1 -0
  15. package/dist/cjs/EgressHttpClient.js +202 -0
  16. package/dist/cjs/EgressHttpClient.js.map +7 -0
  17. package/dist/cjs/HostLiveness.d.ts +81 -0
  18. package/dist/cjs/HostLiveness.d.ts.map +1 -0
  19. package/dist/cjs/HostLiveness.js +49 -0
  20. package/dist/cjs/HostLiveness.js.map +7 -0
  21. package/dist/cjs/NodeHost.d.ts +145 -0
  22. package/dist/cjs/NodeHost.d.ts.map +1 -0
  23. package/dist/cjs/NodeHost.js +128 -0
  24. package/dist/cjs/NodeHost.js.map +7 -0
  25. package/dist/cjs/ProcessConfinement.d.ts +61 -0
  26. package/dist/cjs/ProcessConfinement.d.ts.map +1 -0
  27. package/dist/cjs/ProcessConfinement.js +292 -0
  28. package/dist/cjs/ProcessConfinement.js.map +7 -0
  29. package/dist/cjs/ProcessReaper.d.ts +457 -0
  30. package/dist/cjs/ProcessReaper.d.ts.map +1 -0
  31. package/dist/cjs/ProcessReaper.js +349 -0
  32. package/dist/cjs/ProcessReaper.js.map +7 -0
  33. package/dist/cjs/ProcessSandbox.d.ts +391 -0
  34. package/dist/cjs/ProcessSandbox.d.ts.map +1 -0
  35. package/dist/cjs/ProcessSandbox.js +774 -0
  36. package/dist/cjs/ProcessSandbox.js.map +7 -0
  37. package/dist/cjs/ScopedProcess.d.ts +66 -0
  38. package/dist/cjs/ScopedProcess.d.ts.map +1 -0
  39. package/dist/cjs/ScopedProcess.js +87 -0
  40. package/dist/cjs/ScopedProcess.js.map +7 -0
  41. package/dist/cjs/index.d.ts +38 -0
  42. package/dist/cjs/index.d.ts.map +1 -0
  43. package/dist/cjs/index.js +47 -0
  44. package/dist/cjs/index.js.map +7 -0
  45. package/dist/cjs/internal/AtomicFileSystemExecutable.d.ts +61 -0
  46. package/dist/cjs/internal/AtomicFileSystemExecutable.d.ts.map +1 -0
  47. package/dist/cjs/internal/AtomicFileSystemExecutable.js +250 -0
  48. package/dist/cjs/internal/AtomicFileSystemExecutable.js.map +7 -0
  49. package/dist/cjs/internal/AtomicFileSystemProtocol.d.ts +78 -0
  50. package/dist/cjs/internal/AtomicFileSystemProtocol.d.ts.map +1 -0
  51. package/dist/cjs/internal/AtomicFileSystemProtocol.js +382 -0
  52. package/dist/cjs/internal/AtomicFileSystemProtocol.js.map +7 -0
  53. package/dist/cjs/internal/AtomicFileSystemTransport.d.ts +44 -0
  54. package/dist/cjs/internal/AtomicFileSystemTransport.d.ts.map +1 -0
  55. package/dist/cjs/internal/AtomicFileSystemTransport.js +197 -0
  56. package/dist/cjs/internal/AtomicFileSystemTransport.js.map +7 -0
  57. package/dist/cjs/internal/AtomicHelperError.d.ts +35 -0
  58. package/dist/cjs/internal/AtomicHelperError.d.ts.map +1 -0
  59. package/dist/cjs/internal/AtomicHelperError.js +45 -0
  60. package/dist/cjs/internal/AtomicHelperError.js.map +7 -0
  61. package/dist/cjs/internal/AtomicHelperFault.d.ts +59 -0
  62. package/dist/cjs/internal/AtomicHelperFault.d.ts.map +1 -0
  63. package/dist/cjs/internal/AtomicHelperFault.js +66 -0
  64. package/dist/cjs/internal/AtomicHelperFault.js.map +7 -0
  65. package/dist/cjs/internal/PipedProcess.d.ts +35 -0
  66. package/dist/cjs/internal/PipedProcess.d.ts.map +1 -0
  67. package/dist/cjs/internal/PipedProcess.js +309 -0
  68. package/dist/cjs/internal/PipedProcess.js.map +7 -0
  69. package/dist/cjs/internal/ProcSnapshot.d.ts +85 -0
  70. package/dist/cjs/internal/ProcSnapshot.d.ts.map +1 -0
  71. package/dist/cjs/internal/ProcSnapshot.js +123 -0
  72. package/dist/cjs/internal/ProcSnapshot.js.map +7 -0
  73. package/dist/cjs/internal/ProcessCleanup.d.ts +64 -0
  74. package/dist/cjs/internal/ProcessCleanup.d.ts.map +1 -0
  75. package/dist/cjs/internal/ProcessCleanup.js +62 -0
  76. package/dist/cjs/internal/ProcessCleanup.js.map +7 -0
  77. package/dist/cjs/internal/ProcessCleanupPolicyError.d.ts +30 -0
  78. package/dist/cjs/internal/ProcessCleanupPolicyError.d.ts.map +1 -0
  79. package/dist/cjs/internal/ProcessCleanupPolicyError.js +33 -0
  80. package/dist/cjs/internal/ProcessCleanupPolicyError.js.map +7 -0
  81. package/dist/cjs/internal/ProcessFault.d.ts +63 -0
  82. package/dist/cjs/internal/ProcessFault.d.ts.map +1 -0
  83. package/dist/cjs/internal/ProcessFault.js +63 -0
  84. package/dist/cjs/internal/ProcessFault.js.map +7 -0
  85. package/dist/cjs/internal/ProcessSupervisor.d.ts +143 -0
  86. package/dist/cjs/internal/ProcessSupervisor.d.ts.map +1 -0
  87. package/dist/cjs/internal/ProcessSupervisor.js +685 -0
  88. package/dist/cjs/internal/ProcessSupervisor.js.map +7 -0
  89. package/dist/cjs/internal/SupervisorProgram.d.ts +9 -0
  90. package/dist/cjs/internal/SupervisorProgram.d.ts.map +1 -0
  91. package/dist/cjs/internal/SupervisorProgram.js +326 -0
  92. package/dist/cjs/internal/SupervisorProgram.js.map +7 -0
  93. package/dist/cjs/internal/WindowsProcessJob.d.ts +39 -0
  94. package/dist/cjs/internal/WindowsProcessJob.d.ts.map +1 -0
  95. package/dist/cjs/internal/WindowsProcessJob.js +113 -0
  96. package/dist/cjs/internal/WindowsProcessJob.js.map +7 -0
  97. package/dist/cjs/package.json +1 -0
  98. package/dist/esm/AtomicFileSystem.d.ts +147 -0
  99. package/dist/esm/AtomicFileSystem.d.ts.map +1 -0
  100. package/dist/esm/AtomicFileSystem.js +290 -0
  101. package/dist/esm/AtomicFileSystem.js.map +1 -0
  102. package/dist/esm/EgressHttpClient.d.ts +106 -0
  103. package/dist/esm/EgressHttpClient.d.ts.map +1 -0
  104. package/dist/esm/EgressHttpClient.js +259 -0
  105. package/dist/esm/EgressHttpClient.js.map +1 -0
  106. package/dist/esm/HostLiveness.d.ts +81 -0
  107. package/dist/esm/HostLiveness.d.ts.map +1 -0
  108. package/dist/esm/HostLiveness.js +68 -0
  109. package/dist/esm/HostLiveness.js.map +1 -0
  110. package/dist/esm/NodeHost.d.ts +145 -0
  111. package/dist/esm/NodeHost.d.ts.map +1 -0
  112. package/dist/esm/NodeHost.js +162 -0
  113. package/dist/esm/NodeHost.js.map +1 -0
  114. package/dist/esm/ProcessConfinement.d.ts +61 -0
  115. package/dist/esm/ProcessConfinement.d.ts.map +1 -0
  116. package/dist/esm/ProcessConfinement.js +311 -0
  117. package/dist/esm/ProcessConfinement.js.map +1 -0
  118. package/dist/esm/ProcessReaper.d.ts +457 -0
  119. package/dist/esm/ProcessReaper.d.ts.map +1 -0
  120. package/dist/esm/ProcessReaper.js +711 -0
  121. package/dist/esm/ProcessReaper.js.map +1 -0
  122. package/dist/esm/ProcessSandbox.d.ts +391 -0
  123. package/dist/esm/ProcessSandbox.d.ts.map +1 -0
  124. package/dist/esm/ProcessSandbox.js +1043 -0
  125. package/dist/esm/ProcessSandbox.js.map +1 -0
  126. package/dist/esm/ScopedProcess.d.ts +66 -0
  127. package/dist/esm/ScopedProcess.d.ts.map +1 -0
  128. package/dist/esm/ScopedProcess.js +67 -0
  129. package/dist/esm/ScopedProcess.js.map +1 -0
  130. package/dist/esm/index.d.ts +38 -0
  131. package/dist/esm/index.d.ts.map +1 -0
  132. package/dist/esm/index.js +38 -0
  133. package/dist/esm/index.js.map +1 -0
  134. package/dist/esm/internal/AtomicFileSystemExecutable.d.ts +61 -0
  135. package/dist/esm/internal/AtomicFileSystemExecutable.d.ts.map +1 -0
  136. package/dist/esm/internal/AtomicFileSystemExecutable.js +350 -0
  137. package/dist/esm/internal/AtomicFileSystemExecutable.js.map +1 -0
  138. package/dist/esm/internal/AtomicFileSystemProtocol.d.ts +78 -0
  139. package/dist/esm/internal/AtomicFileSystemProtocol.d.ts.map +1 -0
  140. package/dist/esm/internal/AtomicFileSystemProtocol.js +412 -0
  141. package/dist/esm/internal/AtomicFileSystemProtocol.js.map +1 -0
  142. package/dist/esm/internal/AtomicFileSystemTransport.d.ts +44 -0
  143. package/dist/esm/internal/AtomicFileSystemTransport.d.ts.map +1 -0
  144. package/dist/esm/internal/AtomicFileSystemTransport.js +242 -0
  145. package/dist/esm/internal/AtomicFileSystemTransport.js.map +1 -0
  146. package/dist/esm/internal/AtomicHelperError.d.ts +35 -0
  147. package/dist/esm/internal/AtomicHelperError.d.ts.map +1 -0
  148. package/dist/esm/internal/AtomicHelperError.js +39 -0
  149. package/dist/esm/internal/AtomicHelperError.js.map +1 -0
  150. package/dist/esm/internal/AtomicHelperFault.d.ts +59 -0
  151. package/dist/esm/internal/AtomicHelperFault.d.ts.map +1 -0
  152. package/dist/esm/internal/AtomicHelperFault.js +66 -0
  153. package/dist/esm/internal/AtomicHelperFault.js.map +1 -0
  154. package/dist/esm/internal/PipedProcess.d.ts +35 -0
  155. package/dist/esm/internal/PipedProcess.d.ts.map +1 -0
  156. package/dist/esm/internal/PipedProcess.js +321 -0
  157. package/dist/esm/internal/PipedProcess.js.map +1 -0
  158. package/dist/esm/internal/ProcSnapshot.d.ts +85 -0
  159. package/dist/esm/internal/ProcSnapshot.d.ts.map +1 -0
  160. package/dist/esm/internal/ProcSnapshot.js +188 -0
  161. package/dist/esm/internal/ProcSnapshot.js.map +1 -0
  162. package/dist/esm/internal/ProcessCleanup.d.ts +64 -0
  163. package/dist/esm/internal/ProcessCleanup.d.ts.map +1 -0
  164. package/dist/esm/internal/ProcessCleanup.js +45 -0
  165. package/dist/esm/internal/ProcessCleanup.js.map +1 -0
  166. package/dist/esm/internal/ProcessCleanupPolicyError.d.ts +30 -0
  167. package/dist/esm/internal/ProcessCleanupPolicyError.d.ts.map +1 -0
  168. package/dist/esm/internal/ProcessCleanupPolicyError.js +25 -0
  169. package/dist/esm/internal/ProcessCleanupPolicyError.js.map +1 -0
  170. package/dist/esm/internal/ProcessFault.d.ts +63 -0
  171. package/dist/esm/internal/ProcessFault.d.ts.map +1 -0
  172. package/dist/esm/internal/ProcessFault.js +64 -0
  173. package/dist/esm/internal/ProcessFault.js.map +1 -0
  174. package/dist/esm/internal/ProcessSupervisor.d.ts +143 -0
  175. package/dist/esm/internal/ProcessSupervisor.d.ts.map +1 -0
  176. package/dist/esm/internal/ProcessSupervisor.js +689 -0
  177. package/dist/esm/internal/ProcessSupervisor.js.map +1 -0
  178. package/dist/esm/internal/SupervisorProgram.d.ts +9 -0
  179. package/dist/esm/internal/SupervisorProgram.d.ts.map +1 -0
  180. package/dist/esm/internal/SupervisorProgram.js +310 -0
  181. package/dist/esm/internal/SupervisorProgram.js.map +1 -0
  182. package/dist/esm/internal/WindowsProcessJob.d.ts +39 -0
  183. package/dist/esm/internal/WindowsProcessJob.d.ts.map +1 -0
  184. package/dist/esm/internal/WindowsProcessJob.js +115 -0
  185. package/dist/esm/internal/WindowsProcessJob.js.map +1 -0
  186. package/dist/vendor/adapters.json +1757 -0
  187. package/dist/vendor/chunk-2Y7WC4KU.js +109 -0
  188. package/dist/vendor/chunk-3GR5VZ2M.js +118 -0
  189. package/dist/vendor/chunk-42QKY6T6.js +40 -0
  190. package/dist/vendor/chunk-54RLBMTZ.js +61 -0
  191. package/dist/vendor/chunk-5ZMHBXIK.js +55 -0
  192. package/dist/vendor/chunk-6ME2W7TF.js +28 -0
  193. package/dist/vendor/chunk-AMQKOQNT.js +34 -0
  194. package/dist/vendor/chunk-B3FZ67QU.js +59 -0
  195. package/dist/vendor/chunk-BKTBUBQY.js +437 -0
  196. package/dist/vendor/chunk-DS7GF46S.js +34 -0
  197. package/dist/vendor/chunk-DVOAHXPG.js +104 -0
  198. package/dist/vendor/chunk-DWSHTSVX.js +229 -0
  199. package/dist/vendor/chunk-EGBNVEEW.js +14 -0
  200. package/dist/vendor/chunk-EZWY45HP.js +18 -0
  201. package/dist/vendor/chunk-FNZOJHSV.js +71 -0
  202. package/dist/vendor/chunk-GXCHI7BM.js +131 -0
  203. package/dist/vendor/chunk-IIJ52ZU6.js +20 -0
  204. package/dist/vendor/chunk-J7A4CZDO.js +92 -0
  205. package/dist/vendor/chunk-JG5TTWPT.js +85 -0
  206. package/dist/vendor/chunk-JJ24ARBQ.js +394 -0
  207. package/dist/vendor/chunk-KOZMM5PZ.js +426 -0
  208. package/dist/vendor/chunk-KUUXSID7.js +18 -0
  209. package/dist/vendor/chunk-LEUPYT3Q.js +36 -0
  210. package/dist/vendor/chunk-M32LDTW7.js +18 -0
  211. package/dist/vendor/chunk-M7CLUILA.js +0 -0
  212. package/dist/vendor/chunk-MBSKBQ5D.js +21 -0
  213. package/dist/vendor/chunk-MLKGABMK.js +9 -0
  214. package/dist/vendor/chunk-NBVRTDTV.js +129 -0
  215. package/dist/vendor/chunk-OXNGN5H7.js +81 -0
  216. package/dist/vendor/chunk-QPLDT6A6.js +564 -0
  217. package/dist/vendor/chunk-QYBKAIA6.js +18 -0
  218. package/dist/vendor/chunk-RO2R4MJH.js +62 -0
  219. package/dist/vendor/chunk-SIR62W3Y.js +398 -0
  220. package/dist/vendor/chunk-TFIKFFSC.js +26 -0
  221. package/dist/vendor/chunk-TXKLEBBL.js +143 -0
  222. package/dist/vendor/chunk-UFH5UUZK.js +48 -0
  223. package/dist/vendor/chunk-VANKHF46.js +96 -0
  224. package/dist/vendor/chunk-VZBDV3TV.js +18 -0
  225. package/dist/vendor/chunk-XDKNKFBW.js +22 -0
  226. package/dist/vendor/chunk-XH4U3JSV.js +249 -0
  227. package/dist/vendor/chunk-Y35ZAO5U.js +53 -0
  228. package/dist/vendor/chunk-ZJMRMY57.js +0 -0
  229. package/dist/vendor/cjs/node/NodeChildProcessSpawner.d.ts +7 -0
  230. package/dist/vendor/cjs/node/NodeChildProcessSpawner.js +1 -0
  231. package/dist/vendor/cjs/node/NodeClusterHttp.d.ts +63 -0
  232. package/dist/vendor/cjs/node/NodeClusterHttp.js +1 -0
  233. package/dist/vendor/cjs/node/NodeClusterSocket.d.ts +79 -0
  234. package/dist/vendor/cjs/node/NodeClusterSocket.js +1 -0
  235. package/dist/vendor/cjs/node/NodeCrypto.d.ts +10 -0
  236. package/dist/vendor/cjs/node/NodeCrypto.js +1 -0
  237. package/dist/vendor/cjs/node/NodeFileSystem.d.ts +10 -0
  238. package/dist/vendor/cjs/node/NodeFileSystem.js +1 -0
  239. package/dist/vendor/cjs/node/NodeHttpClient.d.ts +179 -0
  240. package/dist/vendor/cjs/node/NodeHttpClient.js +1 -0
  241. package/dist/vendor/cjs/node/NodeHttpIncomingMessage.d.ts +62 -0
  242. package/dist/vendor/cjs/node/NodeHttpIncomingMessage.js +1 -0
  243. package/dist/vendor/cjs/node/NodeHttpPlatform.d.ts +36 -0
  244. package/dist/vendor/cjs/node/NodeHttpPlatform.js +1 -0
  245. package/dist/vendor/cjs/node/NodeHttpServer.d.ts +120 -0
  246. package/dist/vendor/cjs/node/NodeHttpServer.js +1 -0
  247. package/dist/vendor/cjs/node/NodeHttpServerRequest.d.ts +29 -0
  248. package/dist/vendor/cjs/node/NodeHttpServerRequest.js +1 -0
  249. package/dist/vendor/cjs/node/NodeMultipart.d.ts +46 -0
  250. package/dist/vendor/cjs/node/NodeMultipart.js +1 -0
  251. package/dist/vendor/cjs/node/NodeMultipartParser.d.ts +97 -0
  252. package/dist/vendor/cjs/node/NodeMultipartParser.js +1 -0
  253. package/dist/vendor/cjs/node/NodePath.d.ts +27 -0
  254. package/dist/vendor/cjs/node/NodePath.js +1 -0
  255. package/dist/vendor/cjs/node/NodeRedis.d.ts +74 -0
  256. package/dist/vendor/cjs/node/NodeRedis.js +1 -0
  257. package/dist/vendor/cjs/node/NodeRuntime.d.ts +85 -0
  258. package/dist/vendor/cjs/node/NodeRuntime.js +1 -0
  259. package/dist/vendor/cjs/node/NodeServices.d.ts +34 -0
  260. package/dist/vendor/cjs/node/NodeServices.js +1 -0
  261. package/dist/vendor/cjs/node/NodeSink.d.ts +8 -0
  262. package/dist/vendor/cjs/node/NodeSink.js +1 -0
  263. package/dist/vendor/cjs/node/NodeSocket.d.ts +38 -0
  264. package/dist/vendor/cjs/node/NodeSocket.js +1 -0
  265. package/dist/vendor/cjs/node/NodeSocketServer.d.ts +8 -0
  266. package/dist/vendor/cjs/node/NodeSocketServer.js +1 -0
  267. package/dist/vendor/cjs/node/NodeStdio.d.ts +11 -0
  268. package/dist/vendor/cjs/node/NodeStdio.js +1 -0
  269. package/dist/vendor/cjs/node/NodeStream.d.ts +8 -0
  270. package/dist/vendor/cjs/node/NodeStream.js +1 -0
  271. package/dist/vendor/cjs/node/NodeTerminal.d.ts +21 -0
  272. package/dist/vendor/cjs/node/NodeTerminal.js +1 -0
  273. package/dist/vendor/cjs/node/NodeWorker.d.ts +22 -0
  274. package/dist/vendor/cjs/node/NodeWorker.js +1 -0
  275. package/dist/vendor/cjs/node/NodeWorkerRunner.d.ts +12 -0
  276. package/dist/vendor/cjs/node/NodeWorkerRunner.js +1 -0
  277. package/dist/vendor/cjs/node/Undici.d.ts +28 -0
  278. package/dist/vendor/cjs/node/Undici.js +1 -0
  279. package/dist/vendor/cjs/node/index.d.ts +100 -0
  280. package/dist/vendor/cjs/node/index.js +1 -0
  281. package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.d.ts +57 -0
  282. package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.js +1 -0
  283. package/dist/vendor/cjs/node-shared/NodeClusterSocket.d.ts +22 -0
  284. package/dist/vendor/cjs/node-shared/NodeClusterSocket.js +1 -0
  285. package/dist/vendor/cjs/node-shared/NodeCrypto.d.ts +27 -0
  286. package/dist/vendor/cjs/node-shared/NodeCrypto.js +1 -0
  287. package/dist/vendor/cjs/node-shared/NodeFileSystem.d.ts +11 -0
  288. package/dist/vendor/cjs/node-shared/NodeFileSystem.js +1 -0
  289. package/dist/vendor/cjs/node-shared/NodeHttpCompression.d.ts +36 -0
  290. package/dist/vendor/cjs/node-shared/NodeHttpCompression.js +1 -0
  291. package/dist/vendor/cjs/node-shared/NodePath.d.ts +27 -0
  292. package/dist/vendor/cjs/node-shared/NodePath.js +1 -0
  293. package/dist/vendor/cjs/node-shared/NodeRuntime.d.ts +47 -0
  294. package/dist/vendor/cjs/node-shared/NodeRuntime.js +1 -0
  295. package/dist/vendor/cjs/node-shared/NodeSink.d.ts +69 -0
  296. package/dist/vendor/cjs/node-shared/NodeSink.js +1 -0
  297. package/dist/vendor/cjs/node-shared/NodeSocket.d.ts +134 -0
  298. package/dist/vendor/cjs/node-shared/NodeSocket.js +1 -0
  299. package/dist/vendor/cjs/node-shared/NodeSocketServer.d.ts +80 -0
  300. package/dist/vendor/cjs/node-shared/NodeSocketServer.js +1 -0
  301. package/dist/vendor/cjs/node-shared/NodeStdio.d.ts +12 -0
  302. package/dist/vendor/cjs/node-shared/NodeStdio.js +1 -0
  303. package/dist/vendor/cjs/node-shared/NodeStream.d.ts +179 -0
  304. package/dist/vendor/cjs/node-shared/NodeStream.js +1 -0
  305. package/dist/vendor/cjs/node-shared/NodeTerminal.d.ts +22 -0
  306. package/dist/vendor/cjs/node-shared/NodeTerminal.js +1 -0
  307. package/dist/vendor/cjs/node-shared/index.d.ts +56 -0
  308. package/dist/vendor/cjs/node-shared/index.js +1 -0
  309. package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.d.ts +4 -0
  310. package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.js +1 -0
  311. package/dist/vendor/cjs/node-shared/internal/utils.d.ts +2 -0
  312. package/dist/vendor/cjs/node-shared/internal/utils.js +1 -0
  313. package/dist/vendor/cjs/package.json +1 -0
  314. package/dist/vendor/cjs/platform-node-shared.d.ts +56 -0
  315. package/dist/vendor/cjs/platform-node-shared.js +1 -0
  316. package/dist/vendor/cjs/platform-node.d.ts +100 -0
  317. package/dist/vendor/cjs/platform-node.js +1 -0
  318. package/dist/vendor/node/LICENSE +21 -0
  319. package/dist/vendor/node/NodeChildProcessSpawner.d.ts +7 -0
  320. package/dist/vendor/node/NodeChildProcessSpawner.js +14 -0
  321. package/dist/vendor/node/NodeClusterHttp.d.ts +63 -0
  322. package/dist/vendor/node/NodeClusterHttp.js +43 -0
  323. package/dist/vendor/node/NodeClusterSocket.d.ts +79 -0
  324. package/dist/vendor/node/NodeClusterSocket.js +30 -0
  325. package/dist/vendor/node/NodeCrypto.d.ts +10 -0
  326. package/dist/vendor/node/NodeCrypto.js +8 -0
  327. package/dist/vendor/node/NodeFileSystem.d.ts +10 -0
  328. package/dist/vendor/node/NodeFileSystem.js +9 -0
  329. package/dist/vendor/node/NodeHttpClient.d.ts +179 -0
  330. package/dist/vendor/node/NodeHttpClient.js +46 -0
  331. package/dist/vendor/node/NodeHttpIncomingMessage.d.ts +62 -0
  332. package/dist/vendor/node/NodeHttpIncomingMessage.js +10 -0
  333. package/dist/vendor/node/NodeHttpPlatform.d.ts +36 -0
  334. package/dist/vendor/node/NodeHttpPlatform.js +16 -0
  335. package/dist/vendor/node/NodeHttpServer.d.ts +120 -0
  336. package/dist/vendor/node/NodeHttpServer.js +46 -0
  337. package/dist/vendor/node/NodeHttpServerRequest.d.ts +29 -0
  338. package/dist/vendor/node/NodeHttpServerRequest.js +9 -0
  339. package/dist/vendor/node/NodeMultipart.d.ts +46 -0
  340. package/dist/vendor/node/NodeMultipart.js +15 -0
  341. package/dist/vendor/node/NodeMultipartParser.d.ts +97 -0
  342. package/dist/vendor/node/NodeMultipartParser.js +11 -0
  343. package/dist/vendor/node/NodePath.d.ts +27 -0
  344. package/dist/vendor/node/NodePath.js +12 -0
  345. package/dist/vendor/node/NodeRedis.d.ts +74 -0
  346. package/dist/vendor/node/NodeRedis.js +11 -0
  347. package/dist/vendor/node/NodeRuntime.d.ts +85 -0
  348. package/dist/vendor/node/NodeRuntime.js +8 -0
  349. package/dist/vendor/node/NodeServices.d.ts +34 -0
  350. package/dist/vendor/node/NodeServices.js +23 -0
  351. package/dist/vendor/node/NodeSink.d.ts +8 -0
  352. package/dist/vendor/node/NodeSink.js +12 -0
  353. package/dist/vendor/node/NodeSocket.d.ts +38 -0
  354. package/dist/vendor/node/NodeSocket.js +31 -0
  355. package/dist/vendor/node/NodeSocketServer.d.ts +8 -0
  356. package/dist/vendor/node/NodeSocketServer.js +21 -0
  357. package/dist/vendor/node/NodeStdio.d.ts +11 -0
  358. package/dist/vendor/node/NodeStdio.js +10 -0
  359. package/dist/vendor/node/NodeStream.d.ts +8 -0
  360. package/dist/vendor/node/NodeStream.js +27 -0
  361. package/dist/vendor/node/NodeTerminal.d.ts +21 -0
  362. package/dist/vendor/node/NodeTerminal.js +10 -0
  363. package/dist/vendor/node/NodeWorker.d.ts +22 -0
  364. package/dist/vendor/node/NodeWorker.js +9 -0
  365. package/dist/vendor/node/NodeWorkerRunner.d.ts +12 -0
  366. package/dist/vendor/node/NodeWorkerRunner.js +7 -0
  367. package/dist/vendor/node/Undici.d.ts +28 -0
  368. package/dist/vendor/node/Undici.js +9 -0
  369. package/dist/vendor/node/index.d.ts +100 -0
  370. package/dist/vendor/node/index.js +115 -0
  371. package/dist/vendor/node-shared/LICENSE +21 -0
  372. package/dist/vendor/node-shared/NodeChildProcessSpawner.d.ts +57 -0
  373. package/dist/vendor/node-shared/NodeChildProcessSpawner.js +13 -0
  374. package/dist/vendor/node-shared/NodeClusterSocket.d.ts +22 -0
  375. package/dist/vendor/node-shared/NodeClusterSocket.js +11 -0
  376. package/dist/vendor/node-shared/NodeCrypto.d.ts +27 -0
  377. package/dist/vendor/node-shared/NodeCrypto.js +9 -0
  378. package/dist/vendor/node-shared/NodeFileSystem.d.ts +11 -0
  379. package/dist/vendor/node-shared/NodeFileSystem.js +8 -0
  380. package/dist/vendor/node-shared/NodeHttpCompression.d.ts +36 -0
  381. package/dist/vendor/node-shared/NodeHttpCompression.js +13 -0
  382. package/dist/vendor/node-shared/NodePath.d.ts +27 -0
  383. package/dist/vendor/node-shared/NodePath.js +11 -0
  384. package/dist/vendor/node-shared/NodeRuntime.d.ts +47 -0
  385. package/dist/vendor/node-shared/NodeRuntime.js +7 -0
  386. package/dist/vendor/node-shared/NodeSink.d.ts +69 -0
  387. package/dist/vendor/node-shared/NodeSink.js +11 -0
  388. package/dist/vendor/node-shared/NodeSocket.d.ts +134 -0
  389. package/dist/vendor/node-shared/NodeSocket.js +23 -0
  390. package/dist/vendor/node-shared/NodeSocketServer.d.ts +80 -0
  391. package/dist/vendor/node-shared/NodeSocketServer.js +20 -0
  392. package/dist/vendor/node-shared/NodeStdio.d.ts +12 -0
  393. package/dist/vendor/node-shared/NodeStdio.js +9 -0
  394. package/dist/vendor/node-shared/NodeStream.d.ts +179 -0
  395. package/dist/vendor/node-shared/NodeStream.js +26 -0
  396. package/dist/vendor/node-shared/NodeTerminal.d.ts +22 -0
  397. package/dist/vendor/node-shared/NodeTerminal.js +9 -0
  398. package/dist/vendor/node-shared/index.d.ts +56 -0
  399. package/dist/vendor/node-shared/index.js +58 -0
  400. package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.d.ts +4 -0
  401. package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.js +7 -0
  402. package/dist/vendor/node-shared/internal/utils.d.ts +2 -0
  403. package/dist/vendor/node-shared/internal/utils.js +7 -0
  404. package/dist/vendor/platform-node-shared.d.ts +56 -0
  405. package/dist/vendor/platform-node-shared.js +58 -0
  406. package/dist/vendor/platform-node.d.ts +100 -0
  407. package/dist/vendor/platform-node.js +115 -0
  408. package/docs/README.md +129 -0
  409. package/docs/api.md +553 -0
  410. package/docs/concepts/descriptor-relative-filesystem.md +181 -0
  411. package/docs/concepts/host-bundle.md +125 -0
  412. package/docs/concepts/process-containment.md +190 -0
  413. package/docs/guides/answer-run-ownership.md +87 -0
  414. package/docs/guides/configure-the-filesystem-helper.md +152 -0
  415. package/docs/guides/contain-child-processes.md +139 -0
  416. package/docs/guides/match-files-with-glob.md +151 -0
  417. package/docs/installation.md +204 -0
  418. package/docs/quickstart.md +147 -0
  419. package/docs/troubleshooting.md +130 -0
  420. package/package.json +202 -3
  421. package/src/AtomicFileSystem.ts +415 -0
  422. package/src/EgressHttpClient.ts +327 -0
  423. package/src/HostLiveness.ts +103 -0
  424. package/src/NodeHost.ts +253 -0
  425. package/src/ProcessConfinement.ts +363 -0
  426. package/src/ProcessReaper.ts +951 -0
  427. package/src/ProcessSandbox.ts +1307 -0
  428. package/src/ScopedProcess.ts +124 -0
  429. package/src/index.ts +44 -0
  430. package/src/internal/AtomicFileSystemExecutable.ts +379 -0
  431. package/src/internal/AtomicFileSystemProtocol.ts +502 -0
  432. package/src/internal/AtomicFileSystemTransport.ts +272 -0
  433. package/src/internal/AtomicHelperError.ts +50 -0
  434. package/src/internal/AtomicHelperFault.ts +84 -0
  435. package/src/internal/PipedProcess.ts +357 -0
  436. package/src/internal/ProcSnapshot.ts +193 -0
  437. package/src/internal/ProcessCleanup.ts +99 -0
  438. package/src/internal/ProcessCleanupPolicyError.ts +30 -0
  439. package/src/internal/ProcessFault.ts +82 -0
  440. package/src/internal/ProcessSupervisor.ts +807 -0
  441. package/src/internal/SupervisorProgram.ts +309 -0
  442. package/src/internal/WindowsProcessJob.ts +114 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcessReaper.js","sourceRoot":"","sources":["../../src/ProcessReaper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AE,CAAC;QACtD,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;IAC3E,CAAC;IACD,MAAM,WAAW,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAA;IACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;IACtF,MAAM,IAAI,GAAG,wCAAwC,CAAA;IACrD,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAA;AAC3G,CAAC,CAAC,CAAA;AAEJ;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAiB,EAA0D,EAAE,CACjG,KAAK,CAAC,aAAa,CACjB,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAChB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EACtB,MAAM,CAAC,QAAQ,CACb,yCAAyC,EACzC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,mEAAmE,EAAE,KAAK,CAAC,CACvG,CACF,CACF,CAAA","sourcesContent":["/**\n * Reaping the processes a dead host incarnation abandoned.\n *\n * Scope closure cleans up work a live host still owns. On POSIX, a prepared\n * supervisor also receives private-channel EOF when its host disappears and\n * independently requests group cleanup. The durable ledger remains the fallback\n * when that cleanup is incomplete or cannot be verified; the next incarnation\n * uses this module to examine the recorded process identities before acting.\n *\n * The rules are narrow on purpose, because the input is a durable record that\n * outlived the process that wrote it and a pid is reused. A record is signalled\n * only when ALL of these hold:\n *\n * - it belongs to a DIFFERENT incarnation of the SAME `hostId`\n * ({@link ProcessLedger.Service.orphans} already filters that);\n * - its owner is gone. A pid that exists but belongs to another user counts as\n * alive, exactly as {@link HostLiveness} counts it, so only `ESRCH` reads as\n * dead and every other answer keeps the record;\n * - it names a target the platform can actually signal. On POSIX that is a\n * process group the child leads itself, so `pgid` has to be a safe integer\n * above 1 and equal to `pid`; on Windows it is a pid, so `pgid` has to be\n * absent. The check is made against the DURABLE record rather than trusted\n * from it: `process.kill(-0, \"SIGKILL\")` signals this host's own process\n * group, and `@smthrs/kernel`'s ledger schema admits zero;\n * - that group is not THIS process's group, and its pid is not this process's\n * pid. The host's real process group is read from the operating system,\n * because a stored number can claim anything and the shell that started this\n * host shares its group. A host that cannot read its own group keeps the\n * record rather than signalling it on a guard that did not run;\n * - the number still names the process the record describes. A record written\n * before this machine booted names a pid from a pid space that no longer\n * exists, and within one boot the recorded start time has to match the start\n * time the operating system reports for that pid. A host that cannot ASK the\n * question answers {@link StartTime} `unavailable`, which refuses the kill\n * and keeps the record; no evidence never authorizes a signal.\n *\n * The outcome of the signal is part of the record. A kill that succeeds, or\n * that reports the group is already gone, retires the record through\n * {@link ProcessLedger.Service.reaped}; a kill that FAILS for any other reason\n * leaves the record inherited so the next incarnation tries again. A record\n * refused on grounds the operating system will not revisit — a number no\n * platform can signal, a pid that is gone, a start time that does not match — is\n * retired through {@link ProcessLedger.Service.skipped}, which says in the\n * journal that nothing was signalled and stops every later incarnation\n * re-examining a number the operating system has moved on from. The three\n * refusals a later incarnation CAN answer differently — `owner-alive`,\n * `identity-unverified`, and `own-group-unknown` — retire nothing.\n *\n * @since 0.1.0\n */\n\nimport * as ContainedSpawner from \"@smthrs/kernel/ContainedSpawner\"\nimport * as ProcessLedger from \"@smthrs/kernel/ProcessLedger\"\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport * as Metric from \"effect/Metric\"\nimport type * as ChildProcess from \"effect/unstable/process/ChildProcess\"\nimport { ChildProcessSpawner, make as makeSpawner } from \"effect/unstable/process/ChildProcessSpawner\"\nimport { spawnSync } from \"node:child_process\"\nimport { uptime } from \"node:os\"\nimport { parse, win32 } from \"node:path\"\nimport { packageRoot, resolveDefaultExecutable } from \"./internal/AtomicFileSystemExecutable.ts\"\nimport { usableExecutable } from \"./internal/AtomicFileSystemTransport.ts\"\nimport * as PipedProcess from \"./internal/PipedProcess.ts\"\nimport * as ProcessCleanup from \"./internal/ProcessCleanup.ts\"\nimport * as ProcSnapshot from \"./internal/ProcSnapshot.ts\"\n\n/**\n * What the operating system can say about a pid.\n *\n * `unknown` is not `dead`. A pid this host may not signal answers `EPERM`, and\n * a reaper that read that as \"gone\" would kill another user's children on the\n * strength of a record it cannot verify.\n *\n * @category models\n * @since 0.1.0\n */\nexport type Liveness = \"alive\" | \"dead\" | \"unknown\"\n\n/**\n * What happened when a process group was signalled.\n *\n * @category models\n * @since 0.1.0\n */\nexport type KillOutcome =\n /** The signal was delivered. */\n | \"signalled\"\n /** There was nothing left to signal, which is the same end state. */\n | \"already-gone\"\n /** The signal was refused, and the record must be tried again later. */\n | \"failed\"\n\n/**\n * What the operating system can say about when a pid started.\n *\n * The three negative answers are deliberately distinct, because they authorize\n * three different decisions. `gone` is evidence — the pid does not exist, so\n * the record describes nothing and is retired unsignalled. `unavailable` is the\n * ABSENCE of evidence: `ps` is missing, unanswerable, or printed something no\n * clock can read, so the record is kept for an incarnation that can ask.\n * `unsupported` is a platform that has no such column at all, which falls back\n * to the boot-time comparison alone.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type StartTime =\n /** The operating system reports this start time, in epoch milliseconds. */\n | { readonly _tag: \"started\"; readonly startedAtMs: number }\n /** The pid names no process. */\n | { readonly _tag: \"gone\" }\n /** The question could not be asked on this host. */\n | { readonly _tag: \"unavailable\" }\n /** The platform has no start-time column at all. */\n | { readonly _tag: \"unsupported\" }\n\n/**\n * The operating-system operations reaping needs.\n *\n * It is a seam, not an abstraction: `flows` ships exactly the two\n * implementations below and a test drives the Windows one on a POSIX host,\n * which is the only way that path is ever exercised in this repository.\n *\n * @category models\n * @since 0.1.0\n */\nexport interface System {\n /** Whether a pid names a process that still exists. */\n readonly isAlive: (pid: number) => Liveness\n /** When the process behind a pid started. */\n readonly startedAtMs: (pid: number) => StartTime\n /** The process group THIS process belongs to, or `null` where there are none. */\n readonly ownGroup: () => number | null\n /** When this machine booted, in epoch milliseconds. */\n readonly bootedAtMs: () => number\n /**\n * Whether the numbers in a record name something this platform may signal,\n * checked before any other guard consults them.\n */\n readonly refuseTarget: (record: ProcessLedger.ProcessRecord) => Refusal | undefined\n /** Ends an abandoned process and everything below it. */\n readonly killTree: (record: ProcessLedger.ProcessRecord) => KillOutcome\n}\n\nconst errorCode = (cause: unknown): string | undefined => (cause as { readonly code?: string } | null)?.code\n\nconst liveness = (pid: number): Liveness => {\n try {\n // Signal 0 delivers nothing; it only asks whether the pid is signalable.\n process.kill(pid, 0)\n return \"alive\"\n } catch (cause) {\n // ESRCH is the only answer that means gone. EPERM means the process\n // exists and belongs to another user; anything else is a question this\n // host could not ask, and both keep the record rather than kill on it.\n return errorCode(cause) === \"ESRCH\" ? \"dead\" : \"unknown\"\n }\n}\n\nconst bootedAtMs = (): number => Date.now() - Math.round(uptime() * 1000)\n\n/**\n * The start time `ps` reports for a pid.\n *\n * `lstart` is the one start-time column both BSD (macOS) and procps (Linux)\n * spell the same way, and it prints an absolute time rather than an elapsed\n * one, so the answer does not drift between reading it and comparing it. It is\n * also a LOCALIZED column, so the probe pins `LC_ALL=C` and `TZ=UTC`.\n * Its text has no zone; parsing explicitly as UTC keeps the identity independent\n * of the host runtime's timezone.\n */\nconst startedAtMs = (executable: string) => (pid: number): StartTime => {\n const answer = ps(executable, \"lstart\", pid)\n if (answer._tag === \"gone\") {\n // A nonzero exit is `ps` saying the pid does not exist, but it is also what\n // a `ps` that rejected the column, or one that is not the `ps` this probe\n // expects, says about a pid that is very much alive. The kernel is asked\n // directly before a live process is retired as gone.\n return liveness(pid) === \"dead\" ? answer : { _tag: \"unavailable\" }\n }\n if (answer._tag !== \"printed\") return answer\n const parsed = Date.parse(`${answer.text} UTC`)\n return Number.isNaN(parsed) ? { _tag: \"unavailable\" } : { _tag: \"started\", startedAtMs: parsed }\n}\n\n/**\n * The absolute path the process probe is run from.\n *\n * Never a `PATH` lookup. The inherited environment belongs to whoever started\n * this host, and a planted `ps` that prints a fabricated start time — or none\n * at all — would decide whether a `SIGKILL` is authorized.\n *\n * @category constants\n * @since 1.0.0-rc.0\n */\nexport const defaultPsExecutable = \"/bin/ps\"\n\n/** How long the probe may take before it counts as an answer nobody gave. */\nconst psTimeoutMs = 5000\n\n/**\n * The Windows directory the host was started with, when it names one.\n */\nconst windowsRoot = (): string => {\n const systemRoot = process.env.SystemRoot\n return systemRoot !== undefined && win32.isAbsolute(systemRoot) ? systemRoot : \"C:\\\\Windows\"\n}\n\n/**\n * The system `taskkill`, by absolute path. Windows resolves a bare name from\n * the current directory before `PATH`, so a flow that wrote `taskkill.exe`\n * into the host's working directory would otherwise run as the host.\n */\nconst taskkillExecutable = (): string => win32.join(windowsRoot(), \"System32\", \"taskkill.exe\")\n\n/** A live-release probe has its own short bound within the shutdown deadline. */\nconst cleanupProbeTimeoutMs = 2000\n\n/**\n * One fixed-path snapshot supplies group membership, start identities and our\n * own group together. Only numeric fields and C-locale lstart are read; command\n * text and the caller's PATH never influence signal authority.\n */\nconst psGroupSnapshot = (pgid: number): ProcessCleanup.Snapshot | undefined => {\n const result = spawnSync(defaultPsExecutable, [\"-A\", \"-o\", \"pid=,pgid=,stat=,lstart=\"], {\n encoding: \"utf8\",\n timeout: cleanupProbeTimeoutMs,\n killSignal: \"SIGKILL\",\n env: { LC_ALL: \"C\", TZ: \"UTC\", PATH: \"/usr/bin:/bin\" }\n })\n if (result.error !== undefined || result.signal !== null || result.status !== 0) return undefined\n let own: number | undefined\n const members: Array<ProcessCleanup.Member> = []\n for (const line of result.stdout.trim().split(\"\\n\")) {\n const match = /^\\s*([0-9]+)\\s+([0-9]+)\\s+(\\S+)\\s+(.+)$/.exec(line)\n if (match === null) return undefined\n const pid = Number(match[1])\n const group = Number(match[2])\n if (!Number.isSafeInteger(pid) || !Number.isSafeInteger(group)) return undefined\n if (pid === process.pid) own = group\n if (group !== pgid) continue\n const started = Date.parse(`${match[4]!} UTC`)\n if (Number.isNaN(started)) return undefined\n members.push({ pid, startedAtMs: started, zombie: match[3]!.startsWith(\"Z\") })\n }\n return own === undefined || own <= 0 ? undefined : { ownGroup: own, members }\n}\n\n/**\n * The observation the supervisor polls, from the source that platform has.\n *\n * Linux publishes the whole process table as files under `/proc`, which is\n * where `ps` itself reads it, so the kernel is asked directly. That needs no\n * `procps` in the image, cannot be answered by a planted binary, and costs no\n * fork on a poll that runs every 10ms. A missing `/bin/ps` is not a\n * hypothetical: `procps` is not in `debian:bookworm-slim`, and on Cloud CI run\n * 11727 every spawned target in every task finished its work and then failed\n * cleanup verification with `Unknown: ChildProcess.kill`, because this\n * observation could not be made.\n *\n * Every other POSIX host keeps the `ps` reading, which is the only portable\n * spelling of this question off Linux.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const groupSnapshotFor = (platform: string): (pgid: number) => ProcessCleanup.Snapshot | undefined =>\n platform === \"linux\" ? ProcSnapshot.snapshot(ProcSnapshot.defaultProcRoot) : psGroupSnapshot\n\n/**\n * Whether the kernel reports no process at all in a group.\n *\n * Signal 0 delivers nothing; it only asks the kernel whether the group has a\n * member. `ESRCH` is the one answer that proves the group empty, with no fork\n * and no process table to parse, so it still answers on a loaded host where a\n * `ps` snapshot cannot be taken. A live member, a zombie (macOS answers\n * `EPERM`, Linux succeeds), another user's member or any other error answers\n * `false`, which leaves the question to the snapshot.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const groupVacant = (pgid: number): boolean => {\n // kill(0) and kill(-1) address the caller's group and every process.\n if (!Number.isSafeInteger(pgid) || pgid <= 1) return false\n try {\n process.kill(-pgid, 0)\n return false\n } catch (cause) {\n return errorCode(cause) === \"ESRCH\"\n }\n}\n\n/**\n * Live cleanup for Node and Bun contained spawners.\n *\n * A trusted supervisor remains the group owner after the target exits. It\n * enforces cleanup on target completion, parent loss and explicit release; the\n * target starts only after its owner is durably recorded. Host observations\n * never signal a pid: they only shorten the owner's deadline or verify an empty\n * group before retiring its record. Failed verification retains the record.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const processLifecycle = ProcessCleanup.lifecycle({\n platform: process.platform,\n snapshot: groupSnapshotFor(process.platform),\n vacant: groupVacant\n})\n\n/**\n * The default grace period for a contained host spawner.\n *\n * The platform is always the running platform; callers cannot describe a\n * Windows ledger identity for a process that actually leads a POSIX group.\n * @category models\n * @since 1.0.0\n */\nexport type SpawnerOptions = Omit<ContainedSpawner.Options, \"platform\">\n\n/**\n * Provides a ledger-backed spawner with this platform's prepared cleanup.\n *\n * Native pipe listeners live until their descriptors close, including writes\n * interrupted by owner loss. The kernel expands pipelines before this private\n * standard-command adapter is called. Windows owners join a native job before\n * activation; POSIX owners enforce their process-group cleanup deadline.\n *\n * The caller supplies the durable or in-memory ledger. This layer records new\n * owners; {@link layer} separately reaps\n * records inherited from a previous host incarnation.\n * @category layers\n * @since 1.0.0\n */\nexport const layerSpawner = (\n options?: SpawnerOptions\n): Layer.Layer<ChildProcessSpawner, never, ProcessLedger.ProcessLedger> => {\n const contained = ContainedSpawner.layer({ graceMs: options?.graceMs, platform: process.platform }, processLifecycle)\n const standard = makeSpawner((command) =>\n PipedProcess.spawn(command as ChildProcess.StandardCommand, undefined, true)\n )\n return Layer.provide(contained, Layer.succeed(ChildProcessSpawner)(standard))\n}\n\n/** A whole number and nothing else, which is all a `pgid` column may be. */\nconst decimal = /^[0-9]+$/\n\n/**\n * One `ps` column for one pid.\n *\n * `printed` is an answer; every other tag is the absence of one. A nonzero exit\n * with no error is `ps` saying the pid does not exist, which is evidence; a\n * spawn that failed, a signal, or a timeout is not.\n */\nconst ps = (\n executable: string,\n column: string,\n pid: number\n): { readonly _tag: \"printed\"; readonly text: string } | StartTime => {\n const result = spawnSync(executable, [\"-o\", `${column}=`, \"-p\", String(pid)], {\n encoding: \"utf8\",\n timeout: psTimeoutMs,\n // `SIGKILL` rather than the default `SIGTERM`, because this call blocks the\n // event loop while a host is being built: `spawnSync` keeps waiting past\n // the deadline for a process that ignores the signal, so a `TERM` the probe\n // can decline is not a deadline at all.\n killSignal: \"SIGKILL\",\n // An empty-ish environment for the same reason the helper in\n // `AtomicFileSystem` gets one: nothing the caller exported may change what\n // this answers. Pin both the column's spelling and its timezone; the parser\n // supplies UTC explicitly because `lstart` does not print a zone.\n env: { LC_ALL: \"C\", TZ: \"UTC\", PATH: \"/usr/bin:/bin\" }\n })\n if (result.error !== undefined || result.signal !== null || result.status === null) {\n return { _tag: \"unavailable\" }\n }\n if (result.status !== 0) return { _tag: \"gone\" }\n const printed = result.stdout.trim()\n return printed === \"\" ? { _tag: \"unavailable\" } : { _tag: \"printed\", text: printed }\n}\n\n/**\n * This process's own process group.\n *\n * Node exposes no `getpgrp`, so the answer comes from `ps`, which both BSD and\n * procps spell `pgid`. A host that cannot read it answers `null` and loses one\n * guard, which is why the pid comparison below is kept as well.\n *\n * The text is required to be one run of decimal digits naming a real group,\n * rather than run through `Number.parseInt`, which reads a PREFIX: `\"12 34\"`,\n * `\"12abc\"`, and `\"0x10\"` all become a number that is not this host's group. A\n * wrong number is worse here than no number at all. It silently passes the\n * own-group comparison in {@link refuse}, and because it is not `null` it also\n * suppresses the `own-group-unknown` refusal that exists to say the comparison\n * could not be made, so the guard neither runs nor reports that it did not run\n * and a `SIGKILL` goes out on it. Anything else answers `null`, which refuses.\n */\nconst ownGroup = (executable: string) => (): number | null => {\n const answer = ps(executable, \"pgid\", process.pid)\n if (answer._tag !== \"printed\") return null\n if (!decimal.test(answer.text)) return null\n const parsed = Number(answer.text)\n return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null\n}\n\n/**\n * How a {@link System} asks the operating system its questions, and whose\n * identity it must never signal.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport interface SystemOptions {\n /**\n * The absolute `ps` the identity probe runs. Default\n * {@link defaultPsExecutable}. It is configuration for a host that installs\n * `ps` somewhere else, and the seam the probe's own parsing is driven\n * through; it is never a `PATH` lookup. Windows has no such probe and\n * ignores it.\n */\n readonly psExecutable?: string | undefined\n /** Absolute native helper for Windows process identity queries; never a PATH lookup. */\n readonly processExecutable?: string | undefined\n /**\n * The pid this system must never signal, nor signal the group of. Default\n * `process.pid`. {@link Options.ownerPid} is the same identity at the sweep\n * level; this one is what {@link System.killTree} enforces on its own,\n * because that function is exported and a caller can reach it without going\n * through {@link reap}.\n */\n readonly ownerPid?: number | undefined\n}\n\n/**\n * Whether a durable record names a POSIX process group this host may signal.\n *\n * `process.kill(-pgid, ...)` turns the stored number into a target directly, so\n * every value that is not a real foreign group has to be refused before it gets\n * there: `0` signals THIS process's group, a negative value stops naming a\n * group at all and names a single pid, and a `pgid` that differs from `pid`\n * describes a child that does not lead the group it claims —\n * `ContainedSpawner.groupOf` writes `pgid === pid` for every detached POSIX\n * child, so anything else is a record no writer in this repository produced.\n */\nconst refusePosixTarget = (record: ProcessLedger.ProcessRecord): Refusal | undefined => {\n if (record.pgid === null) return \"no-group\"\n if (!Number.isSafeInteger(record.pid) || record.pid <= 1) return \"invalid-record\"\n if (!Number.isSafeInteger(record.pgid) || record.pgid <= 1) return \"invalid-record\"\n return record.pgid === record.pid ? undefined : \"invalid-record\"\n}\n\n/**\n * Whether a durable record names a Windows process tree this host may signal.\n *\n * Windows has no process groups, so `ContainedSpawner.groupOf` records `null`\n * there and `taskkill /T` walks the tree from the pid instead. A win32 record\n * carrying a number is therefore a record some other platform wrote.\n */\nconst refuseWindowsTarget = (record: ProcessLedger.ProcessRecord): Refusal | undefined => {\n if (record.pgid !== null) return \"invalid-record\"\n return Number.isSafeInteger(record.pid) && record.pid > 1 && record.pid <= 0xffff_ffff ? undefined : \"invalid-record\"\n}\n\n/**\n * Reaping on a POSIX host, with the identity probe configured.\n *\n * The group is killed outright rather than asked politely first. `SIGTERM`\n * buys a graceful shutdown only when someone is left to wait for it, and the\n * incarnation that owned these processes is by definition gone.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const posixSystemWith = (options?: SystemOptions): System =>\n posixSystemFrom({\n startedAtMs: startedAtMs(options?.psExecutable ?? defaultPsExecutable),\n ownGroup: ownGroup(options?.psExecutable ?? defaultPsExecutable),\n bootedAtMs\n }, options?.ownerPid ?? process.pid)\n\n/**\n * Where a Linux {@link System} reads the process table, and whose identity it\n * must never signal.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface ProcSystemOptions {\n /** The `/proc` mount the probes read. Default `/proc`. */\n readonly procRoot?: string | undefined\n /** The pid this system must never signal, nor signal the group of. Default `process.pid`. */\n readonly ownerPid?: number | undefined\n}\n\n/**\n * Reaping on Linux, with every identity question read from `/proc` rather\n * than from `ps`.\n *\n * `procps` is not in `debian:bookworm-slim` (Cloud CI run 11727), and a\n * `ps`-based reaper on such a host can read neither its own group nor any\n * start time, so it refuses every orphan as `own-group-unknown` on every\n * restart. The live-cleanup observation ({@link groupSnapshotFor}) already\n * reads `/proc` for the same reason; this is the crash-recovery half.\n *\n * A pid with no `/proc/<pid>/stat` is `gone` only when the kernel also says so,\n * because a `hidepid` mount hides another user's live process the same way.\n *\n * @category constructors\n * @since 1.0.0-rc.1\n */\nexport const procSystemWith = (options?: ProcSystemOptions): System => {\n const root = options?.procRoot ?? ProcSnapshot.defaultProcRoot\n const readStart = ProcSnapshot.startedAtMs(root)\n return posixSystemFrom({\n startedAtMs: (pid) => {\n const answer = readStart(pid)\n return answer._tag === \"gone\" && liveness(pid) !== \"dead\" ? { _tag: \"unavailable\" } : answer\n },\n ownGroup: ProcSnapshot.ownGroup(root),\n bootedAtMs: () => ProcSnapshot.bootMs(root) ?? bootedAtMs()\n }, options?.ownerPid ?? process.pid)\n}\n\n/** The POSIX kill path over whichever probes the platform answers with. */\nconst posixSystemFrom = (\n probes: Pick<System, \"startedAtMs\" | \"ownGroup\" | \"bootedAtMs\">,\n ownerPid: number\n): System => {\n const readOwnGroup = probes.ownGroup\n return {\n isAlive: liveness,\n startedAtMs: probes.startedAtMs,\n ownGroup: readOwnGroup,\n bootedAtMs: probes.bootedAtMs,\n refuseTarget: refusePosixTarget,\n killTree: (record) => {\n // Repeated here and not only in `refuse`: this function is exported, and\n // the negation below is the one place a stored number becomes a signal.\n if (refusePosixTarget(record) !== undefined) return \"failed\"\n // The host's own identity, repeated for the same reason. `refuse` holds\n // one `ownGroup` reading for the whole sweep; a caller that reaches this\n // function directly has made no such reading, and `process.kill(-pgid)`\n // does not care which way the number arrived. A group that cannot be\n // read is a comparison that did not happen, so nothing is signalled.\n if (record.pid === ownerPid || record.pgid === ownerPid) return \"failed\"\n const group = readOwnGroup()\n if (group === null || record.pid === group || record.pgid === group) return \"failed\"\n try {\n process.kill(-(record.pgid as number), \"SIGKILL\")\n return \"signalled\"\n } catch (cause) {\n // The group settled between the liveness check and the signal: the end\n // state is the one that was wanted. Anything else is a kill that did NOT\n // happen, and saying so is what gets the record tried again.\n return errorCode(cause) === \"ESRCH\" ? \"already-gone\" : \"failed\"\n }\n }\n }\n}\n\n/**\n * Reaping on a POSIX host: one `SIGKILL` to the abandoned process group, with\n * the identity probe at {@link defaultPsExecutable}.\n *\n * @category constructors\n * @since 0.1.0\n */\nexport const posixSystem: System = posixSystemWith()\n\n/**\n * Reaping on Windows, with the identity the sweep must never signal\n * configured.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const windowsSystemWith = (options?: SystemOptions): System => {\n const ownerPid = options?.ownerPid ?? process.pid\n const startedAtMs = (pid: number): StartTime => {\n if (!Number.isSafeInteger(pid) || pid <= 1 || pid > 0xffff_ffff) return { _tag: \"unavailable\" }\n try {\n const configured = options?.processExecutable ?? process.env.SMITHERS_WORKSPACE_JJ_EXPORT_BINARY\n const executable = configured === undefined\n ? resolveDefaultExecutable(packageRoot, undefined)\n : usableExecutable(configured, undefined)\n const result = spawnSync(executable, [\"--process-info\", String(pid)], {\n cwd: parse(process.execPath).root,\n env: {},\n encoding: \"utf8\",\n timeout: psTimeoutMs,\n killSignal: \"SIGKILL\",\n maxBuffer: 4096\n })\n if (result.error !== undefined || result.signal !== null || result.status !== 0) return { _tag: \"unavailable\" }\n const value = JSON.parse(result.stdout) as { readonly status?: unknown; readonly startedAtMs?: unknown } | null\n if (value?.status === \"gone\") return { _tag: \"gone\" }\n return value?.status === \"started\" && typeof value.startedAtMs === \"number\" &&\n Number.isSafeInteger(value.startedAtMs) && value.startedAtMs >= 0\n ? { _tag: \"started\", startedAtMs: value.startedAtMs }\n : { _tag: \"unavailable\" }\n } catch {\n return { _tag: \"unavailable\" }\n }\n }\n return {\n isAlive: liveness,\n startedAtMs,\n ownGroup: () => null,\n bootedAtMs,\n refuseTarget: (record) => record.pid === ownerPid ? \"own-group\" : refuseWindowsTarget(record),\n killTree: (record) => {\n if (refuseWindowsTarget(record) !== undefined) return \"failed\"\n // `taskkill /T` walks the tree DOWN from the pid it is given, so a record\n // naming this host takes the host and everything it started with it.\n if (record.pid === ownerPid) return \"failed\"\n const result = spawnSync(taskkillExecutable(), [\"/pid\", String(record.pid), \"/T\", \"/F\"], {\n // An inert cwd and only the variable Windows system binaries need.\n cwd: parse(process.execPath).root,\n env: { SystemRoot: windowsRoot() },\n stdio: \"ignore\"\n })\n if (result.error !== undefined) return \"failed\"\n // 128 is `taskkill`'s \"no such process\", which is the same end state a\n // successful kill produces.\n if (result.status === 0) return \"signalled\"\n return result.status === 128 ? \"already-gone\" : \"failed\"\n }\n }\n}\n\n/**\n * Reaping on Windows, which has no process groups: `taskkill /T /F` by pid.\n *\n * **Windows is outside the 1.0.0-rc.0 support contract**\n * (`docs/pages/installation.md`). Full Windows process containment remains\n * under verification. It is kept — and reachable through {@link reap} rather than only\n * by calling it directly — because a reaper that silently retired every win32\n * record would be the \"excluded feature that appears to work partially\" the\n * release policy forbids. Treat it as unsupported best-effort.\n *\n * The packaged native helper reads creation time from a pinned process handle.\n * A missing helper, malformed reply, or denied query keeps the durable record\n * for retry. Windows has no process groups, so own-group refusal uses the pid.\n *\n * @category constructors\n * @since 0.1.0\n */\nexport const windowsSystem: System = windowsSystemWith()\n\n/**\n * Reaping on Linux from the kernel's own `/proc`.\n *\n * @category constructors\n * @since 1.0.0-rc.1\n */\nexport const procSystem: System = procSystemWith()\n\n/**\n * Selects the reaping implementation a platform needs.\n *\n * @category constructors\n * @since 0.1.0\n */\nexport const systemFor = (platform: string): System =>\n platform === \"win32\" ? windowsSystem : platform === \"linux\" ? procSystem : posixSystem\n\n/**\n * How far apart a recorded start time and the operating system's may be and\n * still describe the same process.\n *\n * `lstart` has one-second granularity and the ledger writes its record just\n * after the spawn returns, so the two never agree exactly. Two seconds covers\n * the gap; a pid the operating system handed to somebody else is minutes or\n * hours away from it, not milliseconds.\n *\n * @category models\n * @since 0.1.0\n */\nexport const identityToleranceMs = 2000\n\n/**\n * Reaper configuration.\n *\n * @category models\n * @since 0.1.0\n */\nexport interface Options {\n /** The pid this host must never signal a group for. Default `process.pid`. */\n readonly ownerPid?: number | undefined\n /** The operating-system seam. Default {@link systemFor} of `process.platform`. */\n readonly system?: System | undefined\n}\n\n/**\n * Why a record was not signalled.\n *\n * @category models\n * @since 0.1.0\n */\nexport type Refusal =\n /** The incarnation that started it is still running and will contain it. */\n | \"owner-alive\"\n /** It shared its owner's process group, so there is no group to signal. */\n | \"no-group\"\n /** It named this host's own process group or pid. */\n | \"own-group\"\n /** This host could not read its OWN process group, so it cannot rule that out. */\n | \"own-group-unknown\"\n /** Its numbers do not name anything this platform may signal. */\n | \"invalid-record\"\n /** It was written before this machine booted, so the pid space is not the same. */\n | \"pre-boot\"\n /** The pid it names does not exist, so there is no identity to confirm. */\n | \"process-gone\"\n /** The pid exists but did not start when the record says it did. */\n | \"identity-mismatch\"\n /** This host could not ask when the pid started, so it must not signal it. */\n | \"identity-unverified\"\n /** The signal was refused, so the record stays for the next incarnation. */\n | \"kill-failed\"\n\n/**\n * The refusals that leave a record inherited instead of retiring it.\n *\n * A refusal is final when the operating system has moved on from the number:\n * saying so in the journal is what stops every later incarnation re-examining\n * it. These three are not final. `owner-alive` means the incarnation that owns\n * the record will contain its own children; `identity-unverified` and\n * `own-group-unknown` mean this host could not ask a question at all — a host\n * that CAN ask has to get the chance.\n */\nconst retained: ReadonlySet<Refusal> = new Set<Refusal>([\n \"owner-alive\",\n \"identity-unverified\",\n \"own-group-unknown\"\n])\n\n/**\n * One record, and what the reaper decided about it.\n *\n * The two outcomes are a union rather than one shape with an optional field so\n * that `killed` narrows the reason: after `if (!entry.killed)` the\n * {@link Refusal} is there to read, and a killed record cannot be built\n * carrying a reason it never had. The runtime objects are unchanged — a killed\n * entry simply omits `refusal`.\n *\n * @category models\n * @since 0.1.0\n */\nexport type Reaped =\n | {\n readonly record: ProcessLedger.ProcessRecord\n readonly killed: true\n /** Never present when `killed` is `true`. */\n readonly refusal?: never\n }\n | {\n readonly record: ProcessLedger.ProcessRecord\n readonly killed: false\n /** Present exactly when `killed` is `false`. */\n readonly refusal: Refusal\n }\n\n/** The identity half of the decision, split out because it reads as a list. */\nconst refuseOnIdentity = (\n system: System,\n record: ProcessLedger.ProcessRecord,\n bootMs: number\n): Refusal | undefined => {\n // A record older than this boot names a pid from a pid space that no longer\n // exists. The tolerance points BACKWARDS from the boot instant on purpose:\n // `uptime` is second-granular, so a record written moments after boot could\n // otherwise be read as predating it, and refusing to kill is the safe way to\n // be wrong.\n //\n // The consequence is a narrow, deliberate leak, and it is a leak rather than\n // a retry: `reap` retires a `pre-boot` refusal through `ledger.skipped`, so a\n // group spawned within `identityToleranceMs` of the computed boot instant is\n // never reaped by any later incarnation either. That is the price of refusing\n // to kill on an instant `uptime` can only place to the nearest second.\n if (record.startedAtMs < bootMs + identityToleranceMs) return \"pre-boot\"\n const started = system.startedAtMs(record.pid)\n // A platform with no start-time column at all has already been checked\n // against this boot, which is the whole of its documented weaker guarantee.\n if (started._tag === \"unsupported\") return undefined\n if (started._tag === \"gone\") return \"process-gone\"\n if (started._tag === \"unavailable\") return \"identity-unverified\"\n return Math.abs(started.startedAtMs - record.startedAtMs) <= identityToleranceMs\n ? undefined\n : \"identity-mismatch\"\n}\n\n/** Everything the reaper checks before it is willing to signal a record. */\nconst refuse = (\n system: System,\n record: ProcessLedger.ProcessRecord,\n ownerPid: number,\n ownGroup: number | null,\n bootMs: number\n): Refusal | undefined => {\n // The host's own identity comes first, before the platform is consulted at\n // all: a record naming this process is refused on every platform, whatever\n // shape its numbers have.\n if (record.pgid === ownerPid || record.pid === ownerPid) return \"own-group\"\n if (ownGroup !== null && (record.pgid === ownGroup || record.pid === ownGroup)) return \"own-group\"\n const target = system.refuseTarget(record)\n if (target !== undefined) return target\n // A record naming a group can only be cleared of naming THIS host's group by\n // reading that group. When the probe cannot answer, the comparison above was\n // not made rather than made and passed, so the record is kept instead of\n // signalled on a guard that did not run.\n if (record.pgid !== null && ownGroup === null) return \"own-group-unknown\"\n if (system.isAlive(record.ownerPid) !== \"dead\") return \"owner-alive\"\n return refuseOnIdentity(system, record, bootMs)\n}\n\n/**\n * Kills the process groups a previous incarnation of this host abandoned.\n *\n * Returns one entry per inherited record so a caller can log what it decided;\n * `killed: false` carries the {@link Refusal} that produced it. Fails with\n * {@link ProcessLedger.ProcessLedgerReplayError} when the inherited history\n * cannot be read to its end: nothing is signalled or retired, so the next\n * sweep inherits every record again.\n *\n * @category constructors\n * @since 0.1.0\n */\nexport const reap = (\n options?: Options\n): Effect.Effect<ReadonlyArray<Reaped>, ProcessLedger.ProcessLedgerReplayError, ProcessLedger.ProcessLedger> =>\n Effect.gen(function*() {\n const ledger = yield* ProcessLedger.ProcessLedger\n const system = options?.system ?? systemFor(process.platform)\n const ownerPid = options?.ownerPid ?? process.pid\n const ownGroup = system.ownGroup()\n const bootMs = system.bootedAtMs()\n const orphans = yield* ledger.orphans\n const decided: Array<Reaped> = []\n for (const record of orphans) {\n const refusal = refuse(system, record, ownerPid, ownGroup, bootMs)\n if (refusal === undefined) {\n const outcome = system.killTree(record)\n if (outcome === \"failed\") {\n // Nothing was killed, so nothing is retired: leaving the record\n // inherited is what makes the next incarnation try again.\n decided.push({ record, killed: false, refusal: \"kill-failed\" })\n continue\n }\n yield* retire(ledger.reaped(record), record.pid, \"reaped\")\n decided.push({ record, killed: true })\n continue\n }\n // A retained refusal is not this host's to retire; every other refusal is\n // final and says so in the journal.\n if (!retained.has(refusal)) {\n yield* retire(ledger.skipped(record, refusal), record.pid, \"reap-skipped\")\n }\n decided.push({ record, killed: false, refusal })\n }\n return decided\n })\n\n/**\n * Writes one ledger retirement, logging rather than failing the sweep.\n *\n * A retirement that does not commit is not a lost kill: the process is already\n * dead and the record stays inherited, so the next incarnation reads it, finds\n * the pid gone, and retires it then. Failing the whole sweep over it would\n * take the host down for a bookkeeping write.\n */\nconst retire = (\n write: Effect.Effect<void, unknown>,\n pid: number,\n what: string\n): Effect.Effect<void> =>\n write.pipe(\n Effect.catch((error) => Effect.logWarning(`process reaper could not journal ${what} for ${pid}`, error))\n )\n\n/**\n * Refusals that leave a dead incarnation's process running with no live owner\n * to contain it: the host could not ask, or its signal failed.\n */\nconst unreaped: ReadonlySet<Refusal> = new Set<Refusal>([\"identity-unverified\", \"own-group-unknown\", \"kill-failed\"])\n\n/**\n * Counter over inherited records the reaper did not kill, with a `refusal`\n * attribute naming why.\n *\n * @category metrics\n * @since 1.0.0-rc.1\n */\nexport const refusals = Metric.counter(\"flows_process_reaper_refusals\", {\n description: \"Inherited process records the reaper did not kill, by refusal\"\n})\n\n/**\n * Reports one sweep: a counter update per refusal and one summary line. The\n * line is a warning when a record stays inherited (a retained refusal) or a\n * signal failed, because either leaves a crashed incarnation's processes\n * running with nothing else to say so.\n *\n * @category layers\n * @since 1.0.0-rc.1\n */\nexport const report = (decided: ReadonlyArray<Reaped>): Effect.Effect<void> =>\n Effect.gen(function*() {\n if (decided.length === 0) return\n const counts: Partial<Record<Refusal, number>> = {}\n let killed = 0\n for (const entry of decided) {\n if (entry.killed) {\n killed += 1\n continue\n }\n counts[entry.refusal] = (counts[entry.refusal] ?? 0) + 1\n }\n for (const [refusal, count] of Object.entries(counts)) {\n yield* Metric.update(Metric.withAttributes(refusals, { refusal }), count)\n }\n const annotations = { killed, ...counts }\n const alarming = decided.some((entry) => !entry.killed && unreaped.has(entry.refusal))\n const line = \"process reaper swept inherited records\"\n yield* (alarming ? Effect.logWarning(line) : Effect.logInfo(line)).pipe(Effect.annotateLogs(annotations))\n })\n\n/**\n * Runs {@link reap} once while the layer is built.\n *\n * Compose it into a host layer so standing a host up is also what cleans up\n * after the incarnation that crashed. A history that cannot be read refuses\n * the sweep with an error log and leaves every record inherited; the host\n * still starts, because the processes it will spawn are recorded and\n * contained regardless. Every decision is {@link report}ed.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layer = (options?: Options): Layer.Layer<never, never, ProcessLedger.ProcessLedger> =>\n Layer.effectDiscard(\n reap(options).pipe(\n Effect.flatMap(report),\n Effect.catchTag(\n \"@smthrs/kernel/ProcessLedgerReplayError\",\n (error) => Effect.logError(\"process reaper refused to sweep: the ledger history is incomplete\", error)\n )\n )\n )\n"]}
@@ -0,0 +1,391 @@
1
+ /**
2
+ * The one operating-system sandbox every confined process goes through.
3
+ *
4
+ * A caller resolves what a run may touch, a {@link Request}: the network
5
+ * posture, the read and write sets, and optionally which mechanism it wants.
6
+ * This module turns the request into an argv the host enforces, or into an
7
+ * {@link Unenforceable} refusal naming what the host lacks. Two callers share
8
+ * it: the build graph confines every target's tool run under its declared
9
+ * inputs and outputs (`@smthrs/targets/ExecSandbox`), and the Node
10
+ * `ProcessConfinement` confines every approved agent command under the
11
+ * grants in force.
12
+ *
13
+ * Three mechanisms, one contract:
14
+ *
15
+ * - Linux: bubblewrap. An empty root contains only enumerated system/runtime
16
+ * paths and declared reads and writes. The workspace and root are remounted
17
+ * read-only after mounting grants. A private tmp supplies HOME. The network
18
+ * namespace is unshared unless explicitly opened; loopback-only is refused.
19
+ * - macOS: seatbelt (`sandbox-exec`). Host reads are denied except enumerated
20
+ * system/runtime paths, declared inputs, external reads, writes and private
21
+ * tmp. Host credential locations are re-closed under broad grants. Writes
22
+ * and network access are denied except what the request opens.
23
+ * - Docker: `docker run` with a read-only root, declared reads mounted
24
+ * read-only at their host paths, declared writes read-write, `--network
25
+ * none` unless the request opens it. The image supplies the toolchain. It is
26
+ * the path on Windows and on any host without the native mechanism.
27
+ *
28
+ * Every declared confinement is enforced or the caller fails closed. Nothing
29
+ * here logs "unenforced" and carries on; the one caller that may run
30
+ * unconfined when no mechanism exists, `ProcessConfinement`, says so in its
31
+ * own options and never on this module's behalf.
32
+ *
33
+ * @since 1.0.0-rc.1
34
+ */
35
+ /**
36
+ * The network posture a run is confined to. `"none"` closes IP networking.
37
+ * Build tools retain host Unix sockets by default. Native agent confinement
38
+ * additionally closes host Unix sockets regardless of the IP posture, except
39
+ * macOS's system DNS resolver endpoint when IP networking is open, and
40
+ * refuses all Linux socket creation when IP networking is closed;
41
+ * socketpair remains available for communication inside the process family.
42
+ *
43
+ * @category models
44
+ * @since 1.0.0-rc.1
45
+ */
46
+ export type Network = "none" | "loopback" | "open";
47
+ /**
48
+ * Which mechanism a request asks for. Absent means the platform's native
49
+ * mechanism: bubblewrap on Linux, seatbelt on macOS.
50
+ *
51
+ * @category models
52
+ * @since 1.0.0-rc.1
53
+ */
54
+ export type Selection = {
55
+ readonly _tag: "bubblewrap";
56
+ } | {
57
+ readonly _tag: "docker";
58
+ readonly image: string;
59
+ };
60
+ /**
61
+ * What a caller asks for: the network posture, the mechanism choice, and the
62
+ * read and write sets. Every path is workspace-relative and posix-shaped;
63
+ * a read may name a file or a directory, a write names a directory. A
64
+ * `readOnly` entry re-closes a subtree under a declared write.
65
+ *
66
+ * @category models
67
+ * @since 1.0.0-rc.1
68
+ */
69
+ export interface Request {
70
+ readonly network: Network;
71
+ /** Whether host Unix sockets are permitted; defaults to true for build tools. */
72
+ readonly unixSockets?: boolean | undefined;
73
+ /** Closed-by-default process and IPC policy for untrusted native commands. */
74
+ readonly strict?: boolean | undefined;
75
+ readonly mechanism?: Selection | undefined;
76
+ readonly reads: ReadonlyArray<string>;
77
+ readonly writes: ReadonlyArray<string>;
78
+ /**
79
+ * Declared outputs whose leaf is a file rather than a directory. A file
80
+ * cannot be bound writable on its own and does not exist before the tool
81
+ * writes it, so its parent directory becomes the writable bind. Kept apart
82
+ * from `writes` because only the caller knows which of the two a
83
+ * declaration meant: inferring it from the path would hand a not-yet-created
84
+ * `.cargo-home` or `dist.new` its parent, and a parent that is the
85
+ * workspace root opens the whole workspace for the run.
86
+ */
87
+ readonly writeFiles?: ReadonlyArray<string> | undefined;
88
+ readonly readOnly?: ReadonlyArray<string> | undefined;
89
+ /**
90
+ * Absolute host paths outside the workspace the tool reads: a git
91
+ * submodule's local source repository, for one. Bound read-only where the
92
+ * mechanism would otherwise hide them; a path that does not exist, or that
93
+ * sits inside the workspace, is dropped.
94
+ */
95
+ readonly externalReads?: ReadonlyArray<string> | undefined;
96
+ }
97
+ /**
98
+ * The host facts mechanism selection reads. Injectable so every platform's
99
+ * argv can be tested on every other platform.
100
+ *
101
+ * @category models
102
+ * @since 1.0.0-rc.1
103
+ */
104
+ export interface Host {
105
+ readonly platform: NodeJS.Platform;
106
+ /** Selected Xcode developer tree on a macOS runner. */
107
+ readonly developerDirectory?: string | undefined;
108
+ /** The real host home, used to mask credentials and locate runtime caches. */
109
+ readonly home?: string | undefined;
110
+ /** Resolves an executable name on `PATH` to an absolute path, or nothing. */
111
+ readonly executable: (name: string) => string | undefined;
112
+ /** Whether a host path exists. */
113
+ readonly exists: (path: string) => boolean;
114
+ /** Whether a host path is a directory. */
115
+ readonly isDirectory: (path: string) => boolean;
116
+ /** Tests the entry itself, including dangling links; defaults to the real host. */
117
+ readonly isSymbolicLink?: ((path: string) => boolean) | undefined;
118
+ /**
119
+ * The names of a directory's direct children, or undefined when the host
120
+ * cannot list it. Optional: a host without it keeps every declared file as
121
+ * its own entry, which is correct and merely long.
122
+ */
123
+ readonly entries?: ((directory: string) => ReadonlyArray<string> | undefined) | undefined;
124
+ /**
125
+ * Where a path's bytes actually live once every symbolic link on it is
126
+ * followed, or `undefined` when the host cannot say. Write validation uses
127
+ * the real host when this probe is omitted and refuses unresolved existing
128
+ * paths. Read aliases are only collected when this probe is supplied.
129
+ */
130
+ readonly realpath?: ((path: string) => string | undefined) | undefined;
131
+ /**
132
+ * The program a package-manager shim script runs: the absolute path on the
133
+ * `# cmd-shim-target=` line pnpm's cmd-shim writes, or `undefined` for any
134
+ * other file. Optional: a host without it treats a shim as the program.
135
+ */
136
+ readonly shimTarget?: ((path: string) => string | undefined) | undefined;
137
+ readonly uid: number | undefined;
138
+ readonly gid: number | undefined;
139
+ }
140
+ /**
141
+ * One selected enforcement mechanism.
142
+ *
143
+ * @category models
144
+ * @since 1.0.0-rc.1
145
+ */
146
+ export type Mechanism = {
147
+ readonly _tag: "bubblewrap";
148
+ readonly executable: string;
149
+ } | {
150
+ readonly _tag: "seatbelt";
151
+ readonly executable: string;
152
+ } | {
153
+ readonly _tag: "docker";
154
+ readonly executable: string;
155
+ readonly image: string;
156
+ } | {
157
+ readonly _tag: "none";
158
+ };
159
+ /**
160
+ * The refusal a host that cannot enforce a declared confinement produces.
161
+ * `mechanism` names what was selected, `missing` what the host lacks.
162
+ *
163
+ * @category models
164
+ * @since 1.0.0-rc.1
165
+ */
166
+ export interface Unenforceable {
167
+ readonly _tag: "@smthrs/platform-node/SandboxUnenforceable";
168
+ readonly platform: NodeJS.Platform;
169
+ readonly mechanism: string;
170
+ readonly missing: string;
171
+ readonly message: string;
172
+ }
173
+ /**
174
+ * Checks for an {@link Unenforceable} refusal.
175
+ *
176
+ * @category guards
177
+ * @since 1.0.0-rc.1
178
+ */
179
+ export declare const isUnenforceable: (value: unknown) => value is Unenforceable;
180
+ /**
181
+ * Builds an {@link Unenforceable} refusal.
182
+ *
183
+ * @category constructors
184
+ * @since 1.0.0-rc.1
185
+ */
186
+ export declare const unenforceable: (platform: NodeJS.Platform, mechanism: string, missing: string, detail: string) => Unenforceable;
187
+ /**
188
+ * The resolved confinement one spawn runs under. Every path is absolute and
189
+ * canonical.
190
+ *
191
+ * @category models
192
+ * @since 1.0.0-rc.1
193
+ */
194
+ export interface Plan {
195
+ readonly mechanism: Exclude<Mechanism, {
196
+ readonly _tag: "none";
197
+ }>;
198
+ readonly network: Network;
199
+ /** Whether host Unix sockets are permitted; defaults to true for build tools. */
200
+ readonly unixSockets?: boolean | undefined;
201
+ /** Closed-by-default process and IPC policy for untrusted native commands. */
202
+ readonly strict?: boolean | undefined;
203
+ readonly workspaceRoot: string;
204
+ readonly cwd: string;
205
+ readonly reads: ReadonlyArray<string>;
206
+ /**
207
+ * Paths inside a granted directory that the declaration did not cover,
208
+ * re-closed after the grant. Only a mechanism with deny rules (seatbelt)
209
+ * folds; the others keep every declared file as its own entry.
210
+ */
211
+ readonly readDenies: ReadonlyArray<string>;
212
+ readonly writes: ReadonlyArray<string>;
213
+ readonly readOnly: ReadonlyArray<string>;
214
+ /**
215
+ * Where a declared read's bytes actually live when the path reaches them
216
+ * through a symbolic link that leaves the workspace.
217
+ *
218
+ * Bubblewrap needs them because it replaces `/tmp` with a private tmpfs, so
219
+ * a link into the host's `/tmp` (the scratch tree's `node_modules`, which
220
+ * points back at the real workspace) resolves to nothing inside the sandbox.
221
+ * Binding the real location read-only makes the link resolve to the same
222
+ * bytes the host sees, which is what declaring the read asked for. Docker
223
+ * mounts them for the same reason: the image supplies everything outside
224
+ * the workspace, and these paths are on the host. Seatbelt leaves the host
225
+ * filesystem in place but must grant the resolved spelling too. The
226
+ * request's own `externalReads` land here too.
227
+ */
228
+ readonly externalReads: ReadonlyArray<string>;
229
+ /** A host directory the run may scribble in; created by the caller, removed after. */
230
+ readonly tmp: string;
231
+ readonly uid: number | undefined;
232
+ readonly gid: number | undefined;
233
+ }
234
+ /**
235
+ * The real host: platform, `PATH` lookup, and filesystem probes.
236
+ *
237
+ * @category resolution
238
+ * @since 0.1.0
239
+ */
240
+ export declare const host: (env?: Readonly<Record<string, string | undefined>>) => Host;
241
+ /**
242
+ * Selects the mechanism a request runs under on a host.
243
+ *
244
+ * A docker selection is honored when `docker` is on `PATH` and refused
245
+ * otherwise; a bubblewrap selection is refused off Linux. With no selection
246
+ * the platform decides: bubblewrap on Linux, seatbelt on macOS, and a refusal
247
+ * elsewhere, because Windows has no user-level process sandbox and Docker
248
+ * needs an image only the caller can name.
249
+ *
250
+ * @category resolution
251
+ * @since 1.0.0-rc.1
252
+ */
253
+ export declare const select: (request: Pick<Request, "network" | "mechanism">, hostFacts: Host) => Exclude<Mechanism, {
254
+ readonly _tag: "none";
255
+ }> | Unenforceable;
256
+ /**
257
+ * Rechecks write grants before directory creation and before rendering. Throws
258
+ * an {@link Unenforceable} refusal if a path changed since planning. Callers
259
+ * must keep the workspace stable until the operating system consumes mounts.
260
+ *
261
+ * @category resolution
262
+ * @since 0.1.0
263
+ */
264
+ export declare const validateWrites: (confinement: Plan, hostFacts?: Host) => void;
265
+ /**
266
+ * Resolves a request against a workspace into a {@link Plan}, or refuses.
267
+ *
268
+ * Every relative path is anchored at the canonical workspace root; one that
269
+ * escapes the workspace is dropped, because the sandbox never grants anything
270
+ * outside the tree the key covers. Reads that do not exist are dropped too:
271
+ * bubblewrap cannot bind a missing path, and a declared input that vanished is
272
+ * the executor's measurement failure, not this module's. A write containing
273
+ * any symbolic link below the canonical root is refused, including a missing
274
+ * output below a linked ancestor.
275
+ *
276
+ * @category resolution
277
+ * @since 0.1.0
278
+ */
279
+ export declare const plan: (request: Request, location: {
280
+ readonly workspaceRoot: string;
281
+ readonly cwd: string;
282
+ readonly tmp: string;
283
+ }, hostFacts: Host) => Plan | Unenforceable;
284
+ /**
285
+ * Environment the confined process receives on top of the tool environment:
286
+ * a private temporary directory and home, so nothing a tool caches lands in
287
+ * the real home or the shared temp directory.
288
+ *
289
+ * `COREPACK_HOME` is the one host cache kept: it holds the package-manager
290
+ * program a corepack shim execs, the run may only read it (the mechanisms
291
+ * deny writes outside the workspace), and without it a confined `pnpm` is a
292
+ * shim with nothing to run. A non-default cache location requires an explicit
293
+ * `externalReads` grant; preserving the variable does not grant access.
294
+ *
295
+ * @category rendering
296
+ * @since 0.1.0
297
+ */
298
+ export declare const environment: (confinement: Plan, hostEnv?: Readonly<Record<string, string | undefined>>, hostHome?: string) => Readonly<Record<string, string>>;
299
+ /**
300
+ * The program a confined run execs, made reachable inside its empty root.
301
+ *
302
+ * Bubblewrap resolves a bare program name with `execvp` against `PATH` inside
303
+ * the new root, and that root holds only the runtime paths and the declared
304
+ * sets. A package manager installed outside them — pnpm under the
305
+ * `pnpm/action-setup` prefix on a CI runner, a `.bin` link into a
306
+ * `node_modules` tree — is on the host `PATH` and absent from the sandbox, so
307
+ * the run died with `bwrap: execvp pnpm` before the tool started (#3140).
308
+ *
309
+ * A bare name is resolved on the tool's `PATH` (the host's when none is
310
+ * given). A program already inside a granted path is left exactly as spelled,
311
+ * so a multi-call binary keeps the name it dispatches on, and so is one inside
312
+ * the workspace, whose reads only the declaration may open. Otherwise the run
313
+ * execs the program's real file, and the nearest package directory holding it
314
+ * (its `package.json`, at most three levels up, never the home or the root)
315
+ * is bound read-only, because a script like `pnpm.cjs` loads its siblings.
316
+ * With no package directory only the real file is bound. A name that resolves
317
+ * nowhere is left for `execvp` to report.
318
+ *
319
+ * A package-manager shim script is followed like a link. `pnpm self-update`
320
+ * under `pnpm/action-setup` installs pnpm as a cmd-shim in `$PNPM_HOME/bin`
321
+ * that runs node on a package in pnpm's global store, a path relative to the
322
+ * script; binding the script alone left that package missing. When the
323
+ * program the shim names is executable, the run execs its real file and binds
324
+ * its package as above.
325
+ *
326
+ * @since 1.0.0
327
+ * @private
328
+ */
329
+ export declare const launcher: (program: string, searchPath: string | undefined, granted: ReadonlyArray<string>, workspaceRoot: string, hostFacts: Host) => {
330
+ readonly program: string;
331
+ readonly reads: ReadonlyArray<string>;
332
+ };
333
+ /**
334
+ * The bubblewrap argv for a plan.
335
+ *
336
+ * Order matters: bubblewrap applies operations in argument order, so the
337
+ * empty root goes first, runtime paths are bound, the workspace tmpfs shadows
338
+ * any broad runtime grant, declared paths are bound on top, and re-closed
339
+ * subtrees are bound read-only over their writable parents. The tmpfs is
340
+ * remounted read-only last so an undeclared write
341
+ * under the workspace fails with `EROFS` instead of vanishing into the tmpfs.
342
+ *
343
+ * @category rendering
344
+ * @since 0.1.0
345
+ */
346
+ export declare const bubblewrap: (confinement: Plan, argv: ReadonlyArray<string>, hostFacts?: Host, searchPath?: string | undefined) => ReadonlyArray<string>;
347
+ /**
348
+ * The seatbelt profile for a plan.
349
+ *
350
+ * File reads start closed, then enumerated runtime paths and declared sets
351
+ * are opened. The workspace is re-closed before its grants so a workspace
352
+ * under a runtime root does not inherit the broad runtime grant. Credentials
353
+ * are re-closed before explicit external reads, which can opt into them.
354
+ *
355
+ * @category rendering
356
+ * @since 0.1.0
357
+ */
358
+ export declare const seatbelt: (confinement: Plan, hostFacts?: Host) => string;
359
+ /**
360
+ * The `docker run` argv for a plan. Paths keep their host spelling inside the
361
+ * container so an argv that names workspace paths works unchanged; the image
362
+ * supplies everything outside the workspace.
363
+ *
364
+ * @category rendering
365
+ * @since 0.1.0
366
+ */
367
+ export declare const docker: (confinement: Plan, argv: ReadonlyArray<string>, env: Readonly<Record<string, string>>, hostFacts?: Host, containerName?: string) => ReadonlyArray<string>;
368
+ /**
369
+ * Wraps a tool argv in the plan's mechanism and reports the environment the
370
+ * wrapper needs the child to carry. Docker runs also return the unique
371
+ * container name the caller must forcibly remove when the client scope closes.
372
+ *
373
+ * @category rendering
374
+ * @since 0.1.0
375
+ */
376
+ export declare const wrap: (confinement: Plan, argv: ReadonlyArray<string>, env: Readonly<Record<string, string>>, hostFacts?: Host) => {
377
+ readonly argv: ReadonlyArray<string>;
378
+ readonly env: Readonly<Record<string, string>>;
379
+ readonly containerName?: string;
380
+ };
381
+ /**
382
+ * Names, from a failed tool's own output, the paths it touched outside the
383
+ * declared set. The sandbox denies at the kernel, so the only witness is the
384
+ * tool's error text; this reads it back and says which side of the boundary
385
+ * each path fell on.
386
+ *
387
+ * @category diagnostics
388
+ * @since 0.1.0
389
+ */
390
+ export declare const diagnose: (confinement: Plan, text: string) => string | undefined;
391
+ //# sourceMappingURL=ProcessSandbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcessSandbox.d.ts","sourceRoot":"","sources":["../../src/ProcessSandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAQH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAA;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAAE,GAC/B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvD;;;;;;;;GAQG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,iFAAiF;IACjF,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC1C,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC1C,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACrC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACtC;;;;;;;;OAQG;IACH,QAAQ,CAAC,UAAU,C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