@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,457 @@
1
+ /**
2
+ * Reaping the processes a dead host incarnation abandoned.
3
+ *
4
+ * Scope closure cleans up work a live host still owns. On POSIX, a prepared
5
+ * supervisor also receives private-channel EOF when its host disappears and
6
+ * independently requests group cleanup. The durable ledger remains the fallback
7
+ * when that cleanup is incomplete or cannot be verified; the next incarnation
8
+ * uses this module to examine the recorded process identities before acting.
9
+ *
10
+ * The rules are narrow on purpose, because the input is a durable record that
11
+ * outlived the process that wrote it and a pid is reused. A record is signalled
12
+ * only when ALL of these hold:
13
+ *
14
+ * - it belongs to a DIFFERENT incarnation of the SAME `hostId`
15
+ * ({@link ProcessLedger.Service.orphans} already filters that);
16
+ * - its owner is gone. A pid that exists but belongs to another user counts as
17
+ * alive, exactly as {@link HostLiveness} counts it, so only `ESRCH` reads as
18
+ * dead and every other answer keeps the record;
19
+ * - it names a target the platform can actually signal. On POSIX that is a
20
+ * process group the child leads itself, so `pgid` has to be a safe integer
21
+ * above 1 and equal to `pid`; on Windows it is a pid, so `pgid` has to be
22
+ * absent. The check is made against the DURABLE record rather than trusted
23
+ * from it: `process.kill(-0, "SIGKILL")` signals this host's own process
24
+ * group, and `@smthrs/kernel`'s ledger schema admits zero;
25
+ * - that group is not THIS process's group, and its pid is not this process's
26
+ * pid. The host's real process group is read from the operating system,
27
+ * because a stored number can claim anything and the shell that started this
28
+ * host shares its group. A host that cannot read its own group keeps the
29
+ * record rather than signalling it on a guard that did not run;
30
+ * - the number still names the process the record describes. A record written
31
+ * before this machine booted names a pid from a pid space that no longer
32
+ * exists, and within one boot the recorded start time has to match the start
33
+ * time the operating system reports for that pid. A host that cannot ASK the
34
+ * question answers {@link StartTime} `unavailable`, which refuses the kill
35
+ * and keeps the record; no evidence never authorizes a signal.
36
+ *
37
+ * The outcome of the signal is part of the record. A kill that succeeds, or
38
+ * that reports the group is already gone, retires the record through
39
+ * {@link ProcessLedger.Service.reaped}; a kill that FAILS for any other reason
40
+ * leaves the record inherited so the next incarnation tries again. A record
41
+ * refused on grounds the operating system will not revisit — a number no
42
+ * platform can signal, a pid that is gone, a start time that does not match — is
43
+ * retired through {@link ProcessLedger.Service.skipped}, which says in the
44
+ * journal that nothing was signalled and stops every later incarnation
45
+ * re-examining a number the operating system has moved on from. The three
46
+ * refusals a later incarnation CAN answer differently — `owner-alive`,
47
+ * `identity-unverified`, and `own-group-unknown` — retire nothing.
48
+ *
49
+ * @since 0.1.0
50
+ */
51
+ import * as ContainedSpawner from "@smthrs/kernel/ContainedSpawner";
52
+ import * as ProcessLedger from "@smthrs/kernel/ProcessLedger";
53
+ import * as Effect from "effect/Effect";
54
+ import * as Layer from "effect/Layer";
55
+ import * as Metric from "effect/Metric";
56
+ import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
57
+ import * as ProcessCleanup from "./internal/ProcessCleanup.ts";
58
+ /**
59
+ * What the operating system can say about a pid.
60
+ *
61
+ * `unknown` is not `dead`. A pid this host may not signal answers `EPERM`, and
62
+ * a reaper that read that as "gone" would kill another user's children on the
63
+ * strength of a record it cannot verify.
64
+ *
65
+ * @category models
66
+ * @since 0.1.0
67
+ */
68
+ export type Liveness = "alive" | "dead" | "unknown";
69
+ /**
70
+ * What happened when a process group was signalled.
71
+ *
72
+ * @category models
73
+ * @since 0.1.0
74
+ */
75
+ export type KillOutcome =
76
+ /** The signal was delivered. */
77
+ "signalled"
78
+ /** There was nothing left to signal, which is the same end state. */
79
+ | "already-gone"
80
+ /** The signal was refused, and the record must be tried again later. */
81
+ | "failed";
82
+ /**
83
+ * What the operating system can say about when a pid started.
84
+ *
85
+ * The three negative answers are deliberately distinct, because they authorize
86
+ * three different decisions. `gone` is evidence — the pid does not exist, so
87
+ * the record describes nothing and is retired unsignalled. `unavailable` is the
88
+ * ABSENCE of evidence: `ps` is missing, unanswerable, or printed something no
89
+ * clock can read, so the record is kept for an incarnation that can ask.
90
+ * `unsupported` is a platform that has no such column at all, which falls back
91
+ * to the boot-time comparison alone.
92
+ *
93
+ * @category models
94
+ * @since 1.0.0-rc.0
95
+ */
96
+ export type StartTime =
97
+ /** The operating system reports this start time, in epoch milliseconds. */
98
+ {
99
+ readonly _tag: "started";
100
+ readonly startedAtMs: number;
101
+ }
102
+ /** The pid names no process. */
103
+ | {
104
+ readonly _tag: "gone";
105
+ }
106
+ /** The question could not be asked on this host. */
107
+ | {
108
+ readonly _tag: "unavailable";
109
+ }
110
+ /** The platform has no start-time column at all. */
111
+ | {
112
+ readonly _tag: "unsupported";
113
+ };
114
+ /**
115
+ * The operating-system operations reaping needs.
116
+ *
117
+ * It is a seam, not an abstraction: `flows` ships exactly the two
118
+ * implementations below and a test drives the Windows one on a POSIX host,
119
+ * which is the only way that path is ever exercised in this repository.
120
+ *
121
+ * @category models
122
+ * @since 0.1.0
123
+ */
124
+ export interface System {
125
+ /** Whether a pid names a process that still exists. */
126
+ readonly isAlive: (pid: number) => Liveness;
127
+ /** When the process behind a pid started. */
128
+ readonly startedAtMs: (pid: number) => StartTime;
129
+ /** The process group THIS process belongs to, or `null` where there are none. */
130
+ readonly ownGroup: () => number | null;
131
+ /** When this machine booted, in epoch milliseconds. */
132
+ readonly bootedAtMs: () => number;
133
+ /**
134
+ * Whether the numbers in a record name something this platform may signal,
135
+ * checked before any other guard consults them.
136
+ */
137
+ readonly refuseTarget: (record: ProcessLedger.ProcessRecord) => Refusal | undefined;
138
+ /** Ends an abandoned process and everything below it. */
139
+ readonly killTree: (record: ProcessLedger.ProcessRecord) => KillOutcome;
140
+ }
141
+ /**
142
+ * The absolute path the process probe is run from.
143
+ *
144
+ * Never a `PATH` lookup. The inherited environment belongs to whoever started
145
+ * this host, and a planted `ps` that prints a fabricated start time — or none
146
+ * at all — would decide whether a `SIGKILL` is authorized.
147
+ *
148
+ * @category constants
149
+ * @since 1.0.0-rc.0
150
+ */
151
+ export declare const defaultPsExecutable = "/bin/ps";
152
+ /**
153
+ * The observation the supervisor polls, from the source that platform has.
154
+ *
155
+ * Linux publishes the whole process table as files under `/proc`, which is
156
+ * where `ps` itself reads it, so the kernel is asked directly. That needs no
157
+ * `procps` in the image, cannot be answered by a planted binary, and costs no
158
+ * fork on a poll that runs every 10ms. A missing `/bin/ps` is not a
159
+ * hypothetical: `procps` is not in `debian:bookworm-slim`, and on Cloud CI run
160
+ * 11727 every spawned target in every task finished its work and then failed
161
+ * cleanup verification with `Unknown: ChildProcess.kill`, because this
162
+ * observation could not be made.
163
+ *
164
+ * Every other POSIX host keeps the `ps` reading, which is the only portable
165
+ * spelling of this question off Linux.
166
+ *
167
+ * @category constructors
168
+ * @since 1.0.0
169
+ */
170
+ export declare const groupSnapshotFor: (platform: string) => (pgid: number) => ProcessCleanup.Snapshot | undefined;
171
+ /**
172
+ * Whether the kernel reports no process at all in a group.
173
+ *
174
+ * Signal 0 delivers nothing; it only asks the kernel whether the group has a
175
+ * member. `ESRCH` is the one answer that proves the group empty, with no fork
176
+ * and no process table to parse, so it still answers on a loaded host where a
177
+ * `ps` snapshot cannot be taken. A live member, a zombie (macOS answers
178
+ * `EPERM`, Linux succeeds), another user's member or any other error answers
179
+ * `false`, which leaves the question to the snapshot.
180
+ *
181
+ * @category constructors
182
+ * @since 1.0.0
183
+ */
184
+ export declare const groupVacant: (pgid: number) => boolean;
185
+ /**
186
+ * Live cleanup for Node and Bun contained spawners.
187
+ *
188
+ * A trusted supervisor remains the group owner after the target exits. It
189
+ * enforces cleanup on target completion, parent loss and explicit release; the
190
+ * target starts only after its owner is durably recorded. Host observations
191
+ * never signal a pid: they only shorten the owner's deadline or verify an empty
192
+ * group before retiring its record. Failed verification retains the record.
193
+ *
194
+ * @category constructors
195
+ * @since 1.0.0
196
+ */
197
+ export declare const processLifecycle: ContainedSpawner.Lifecycle;
198
+ /**
199
+ * The default grace period for a contained host spawner.
200
+ *
201
+ * The platform is always the running platform; callers cannot describe a
202
+ * Windows ledger identity for a process that actually leads a POSIX group.
203
+ * @category models
204
+ * @since 1.0.0
205
+ */
206
+ export type SpawnerOptions = Omit<ContainedSpawner.Options, "platform">;
207
+ /**
208
+ * Provides a ledger-backed spawner with this platform's prepared cleanup.
209
+ *
210
+ * Native pipe listeners live until their descriptors close, including writes
211
+ * interrupted by owner loss. The kernel expands pipelines before this private
212
+ * standard-command adapter is called. Windows owners join a native job before
213
+ * activation; POSIX owners enforce their process-group cleanup deadline.
214
+ *
215
+ * The caller supplies the durable or in-memory ledger. This layer records new
216
+ * owners; {@link layer} separately reaps
217
+ * records inherited from a previous host incarnation.
218
+ * @category layers
219
+ * @since 1.0.0
220
+ */
221
+ export declare const layerSpawner: (options?: SpawnerOptions) => Layer.Layer<ChildProcessSpawner, never, ProcessLedger.ProcessLedger>;
222
+ /**
223
+ * How a {@link System} asks the operating system its questions, and whose
224
+ * identity it must never signal.
225
+ *
226
+ * @category models
227
+ * @since 1.0.0-rc.0
228
+ */
229
+ export interface SystemOptions {
230
+ /**
231
+ * The absolute `ps` the identity probe runs. Default
232
+ * {@link defaultPsExecutable}. It is configuration for a host that installs
233
+ * `ps` somewhere else, and the seam the probe's own parsing is driven
234
+ * through; it is never a `PATH` lookup. Windows has no such probe and
235
+ * ignores it.
236
+ */
237
+ readonly psExecutable?: string | undefined;
238
+ /** Absolute native helper for Windows process identity queries; never a PATH lookup. */
239
+ readonly processExecutable?: string | undefined;
240
+ /**
241
+ * The pid this system must never signal, nor signal the group of. Default
242
+ * `process.pid`. {@link Options.ownerPid} is the same identity at the sweep
243
+ * level; this one is what {@link System.killTree} enforces on its own,
244
+ * because that function is exported and a caller can reach it without going
245
+ * through {@link reap}.
246
+ */
247
+ readonly ownerPid?: number | undefined;
248
+ }
249
+ /**
250
+ * Reaping on a POSIX host, with the identity probe configured.
251
+ *
252
+ * The group is killed outright rather than asked politely first. `SIGTERM`
253
+ * buys a graceful shutdown only when someone is left to wait for it, and the
254
+ * incarnation that owned these processes is by definition gone.
255
+ *
256
+ * @category constructors
257
+ * @since 1.0.0-rc.0
258
+ */
259
+ export declare const posixSystemWith: (options?: SystemOptions) => System;
260
+ /**
261
+ * Where a Linux {@link System} reads the process table, and whose identity it
262
+ * must never signal.
263
+ *
264
+ * @category models
265
+ * @since 1.0.0-rc.1
266
+ */
267
+ export interface ProcSystemOptions {
268
+ /** The `/proc` mount the probes read. Default `/proc`. */
269
+ readonly procRoot?: string | undefined;
270
+ /** The pid this system must never signal, nor signal the group of. Default `process.pid`. */
271
+ readonly ownerPid?: number | undefined;
272
+ }
273
+ /**
274
+ * Reaping on Linux, with every identity question read from `/proc` rather
275
+ * than from `ps`.
276
+ *
277
+ * `procps` is not in `debian:bookworm-slim` (Cloud CI run 11727), and a
278
+ * `ps`-based reaper on such a host can read neither its own group nor any
279
+ * start time, so it refuses every orphan as `own-group-unknown` on every
280
+ * restart. The live-cleanup observation ({@link groupSnapshotFor}) already
281
+ * reads `/proc` for the same reason; this is the crash-recovery half.
282
+ *
283
+ * A pid with no `/proc/<pid>/stat` is `gone` only when the kernel also says so,
284
+ * because a `hidepid` mount hides another user's live process the same way.
285
+ *
286
+ * @category constructors
287
+ * @since 1.0.0-rc.1
288
+ */
289
+ export declare const procSystemWith: (options?: ProcSystemOptions) => System;
290
+ /**
291
+ * Reaping on a POSIX host: one `SIGKILL` to the abandoned process group, with
292
+ * the identity probe at {@link defaultPsExecutable}.
293
+ *
294
+ * @category constructors
295
+ * @since 0.1.0
296
+ */
297
+ export declare const posixSystem: System;
298
+ /**
299
+ * Reaping on Windows, with the identity the sweep must never signal
300
+ * configured.
301
+ *
302
+ * @category constructors
303
+ * @since 1.0.0-rc.0
304
+ */
305
+ export declare const windowsSystemWith: (options?: SystemOptions) => System;
306
+ /**
307
+ * Reaping on Windows, which has no process groups: `taskkill /T /F` by pid.
308
+ *
309
+ * **Windows is outside the 1.0.0-rc.0 support contract**
310
+ * (`docs/pages/installation.md`). Full Windows process containment remains
311
+ * under verification. It is kept — and reachable through {@link reap} rather than only
312
+ * by calling it directly — because a reaper that silently retired every win32
313
+ * record would be the "excluded feature that appears to work partially" the
314
+ * release policy forbids. Treat it as unsupported best-effort.
315
+ *
316
+ * The packaged native helper reads creation time from a pinned process handle.
317
+ * A missing helper, malformed reply, or denied query keeps the durable record
318
+ * for retry. Windows has no process groups, so own-group refusal uses the pid.
319
+ *
320
+ * @category constructors
321
+ * @since 0.1.0
322
+ */
323
+ export declare const windowsSystem: System;
324
+ /**
325
+ * Reaping on Linux from the kernel's own `/proc`.
326
+ *
327
+ * @category constructors
328
+ * @since 1.0.0-rc.1
329
+ */
330
+ export declare const procSystem: System;
331
+ /**
332
+ * Selects the reaping implementation a platform needs.
333
+ *
334
+ * @category constructors
335
+ * @since 0.1.0
336
+ */
337
+ export declare const systemFor: (platform: string) => System;
338
+ /**
339
+ * How far apart a recorded start time and the operating system's may be and
340
+ * still describe the same process.
341
+ *
342
+ * `lstart` has one-second granularity and the ledger writes its record just
343
+ * after the spawn returns, so the two never agree exactly. Two seconds covers
344
+ * the gap; a pid the operating system handed to somebody else is minutes or
345
+ * hours away from it, not milliseconds.
346
+ *
347
+ * @category models
348
+ * @since 0.1.0
349
+ */
350
+ export declare const identityToleranceMs = 2000;
351
+ /**
352
+ * Reaper configuration.
353
+ *
354
+ * @category models
355
+ * @since 0.1.0
356
+ */
357
+ export interface Options {
358
+ /** The pid this host must never signal a group for. Default `process.pid`. */
359
+ readonly ownerPid?: number | undefined;
360
+ /** The operating-system seam. Default {@link systemFor} of `process.platform`. */
361
+ readonly system?: System | undefined;
362
+ }
363
+ /**
364
+ * Why a record was not signalled.
365
+ *
366
+ * @category models
367
+ * @since 0.1.0
368
+ */
369
+ export type Refusal =
370
+ /** The incarnation that started it is still running and will contain it. */
371
+ "owner-alive"
372
+ /** It shared its owner's process group, so there is no group to signal. */
373
+ | "no-group"
374
+ /** It named this host's own process group or pid. */
375
+ | "own-group"
376
+ /** This host could not read its OWN process group, so it cannot rule that out. */
377
+ | "own-group-unknown"
378
+ /** Its numbers do not name anything this platform may signal. */
379
+ | "invalid-record"
380
+ /** It was written before this machine booted, so the pid space is not the same. */
381
+ | "pre-boot"
382
+ /** The pid it names does not exist, so there is no identity to confirm. */
383
+ | "process-gone"
384
+ /** The pid exists but did not start when the record says it did. */
385
+ | "identity-mismatch"
386
+ /** This host could not ask when the pid started, so it must not signal it. */
387
+ | "identity-unverified"
388
+ /** The signal was refused, so the record stays for the next incarnation. */
389
+ | "kill-failed";
390
+ /**
391
+ * One record, and what the reaper decided about it.
392
+ *
393
+ * The two outcomes are a union rather than one shape with an optional field so
394
+ * that `killed` narrows the reason: after `if (!entry.killed)` the
395
+ * {@link Refusal} is there to read, and a killed record cannot be built
396
+ * carrying a reason it never had. The runtime objects are unchanged — a killed
397
+ * entry simply omits `refusal`.
398
+ *
399
+ * @category models
400
+ * @since 0.1.0
401
+ */
402
+ export type Reaped = {
403
+ readonly record: ProcessLedger.ProcessRecord;
404
+ readonly killed: true;
405
+ /** Never present when `killed` is `true`. */
406
+ readonly refusal?: never;
407
+ } | {
408
+ readonly record: ProcessLedger.ProcessRecord;
409
+ readonly killed: false;
410
+ /** Present exactly when `killed` is `false`. */
411
+ readonly refusal: Refusal;
412
+ };
413
+ /**
414
+ * Kills the process groups a previous incarnation of this host abandoned.
415
+ *
416
+ * Returns one entry per inherited record so a caller can log what it decided;
417
+ * `killed: false` carries the {@link Refusal} that produced it. Fails with
418
+ * {@link ProcessLedger.ProcessLedgerReplayError} when the inherited history
419
+ * cannot be read to its end: nothing is signalled or retired, so the next
420
+ * sweep inherits every record again.
421
+ *
422
+ * @category constructors
423
+ * @since 0.1.0
424
+ */
425
+ export declare const reap: (options?: Options) => Effect.Effect<ReadonlyArray<Reaped>, ProcessLedger.ProcessLedgerReplayError, ProcessLedger.ProcessLedger>;
426
+ /**
427
+ * Counter over inherited records the reaper did not kill, with a `refusal`
428
+ * attribute naming why.
429
+ *
430
+ * @category metrics
431
+ * @since 1.0.0-rc.1
432
+ */
433
+ export declare const refusals: Metric.Counter<number>;
434
+ /**
435
+ * Reports one sweep: a counter update per refusal and one summary line. The
436
+ * line is a warning when a record stays inherited (a retained refusal) or a
437
+ * signal failed, because either leaves a crashed incarnation's processes
438
+ * running with nothing else to say so.
439
+ *
440
+ * @category layers
441
+ * @since 1.0.0-rc.1
442
+ */
443
+ export declare const report: (decided: ReadonlyArray<Reaped>) => Effect.Effect<void>;
444
+ /**
445
+ * Runs {@link reap} once while the layer is built.
446
+ *
447
+ * Compose it into a host layer so standing a host up is also what cleans up
448
+ * after the incarnation that crashed. A history that cannot be read refuses
449
+ * the sweep with an error log and leaves every record inherited; the host
450
+ * still starts, because the processes it will spawn are recorded and
451
+ * contained regardless. Every decision is {@link report}ed.
452
+ *
453
+ * @category layers
454
+ * @since 0.1.0
455
+ */
456
+ export declare const layer: (options?: Options) => Layer.Layer<never, never, ProcessLedger.ProcessLedger>;
457
+ //# sourceMappingURL=ProcessReaper.d.ts.map
@@ -0,0 +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,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE;AAC5D,gCAAgC;GAC9B;IAAE,Q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