@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,242 @@
1
+ /**
2
+ * The process transport beneath the atomic filesystem: resolving the
3
+ * configured helper to a file the confined workspace cannot have
4
+ * supplied, and running one isolated, bounded helper process per framed
5
+ * request.
6
+ * @since 1.0.0
7
+ */
8
+ import { Effect } from "effect";
9
+ import { spawn } from "node:child_process";
10
+ import { accessSync, constants, lstatSync, readlinkSync, realpathSync, statSync } from "node:fs";
11
+ import { basename, dirname, isAbsolute, join, parse, relative, sep } from "node:path";
12
+ import { convert, decode, failure, frameHeaderBytes } from "./AtomicFileSystemProtocol.js";
13
+ import { AtomicHelperError } from "./AtomicHelperError.js";
14
+ import { atomicHelperFault } from "./AtomicHelperFault.js";
15
+ let startedHelpers = 0;
16
+ /**
17
+ * Process-local helper starts, including helpers later cancelled or refused.
18
+ * @private
19
+ * @since 1.0.0
20
+ */
21
+ export const started = () => startedHelpers;
22
+ /** An inert working directory: nothing the helper could import lives there. */
23
+ const inertDirectory = parse(process.execPath).root;
24
+ /**
25
+ * True when `target` is at or below `root`. Both are absolute and already
26
+ * canonical. A different Windows drive produces an absolute relative result.
27
+ * @private
28
+ * @since 1.0.0
29
+ */
30
+ export const inside = (root, target) => {
31
+ const path = relative(root, target);
32
+ return path === "" || (path !== ".." && !path.startsWith(`..${sep}`) && !isAbsolute(path));
33
+ };
34
+ /** Resolve symlinks without replacing a hard-linked executable's entry name. */
35
+ const executablePath = (configured) => {
36
+ let current = configured;
37
+ for (let links = 0; links < 40; links++) {
38
+ if (current.endsWith("/") || current.endsWith(sep)) {
39
+ throw new AtomicHelperError({
40
+ code: "helper_path_invalid",
41
+ message: "atomic helper executable cannot end with a directory separator"
42
+ });
43
+ }
44
+ // Bun's macOS realpath can return another hard link to the final inode:
45
+ // A hard-linked executable can change its entry name during guarded reads.
46
+ // Directories cannot have those file aliases. Resolve the parent, preserve
47
+ // the leaf name, and explicitly follow only actual leaf symlinks.
48
+ const parent = realpathSync.native(dirname(current));
49
+ const candidate = join(parent, basename(current));
50
+ if (!lstatSync(candidate).isSymbolicLink())
51
+ return candidate;
52
+ const target = readlinkSync(candidate);
53
+ // Do not normalize `link/..` lexically; realpath must traverse it first.
54
+ current = isAbsolute(target) ? target : `${parent}/${target}`;
55
+ }
56
+ throw new AtomicHelperError({
57
+ code: "helper_path_invalid",
58
+ message: "atomic helper executable has too many symbolic links"
59
+ });
60
+ };
61
+ /**
62
+ * Resolves the configured helper to an absolute, executable regular file
63
+ * that the confined workspace cannot have supplied. Every failure throws, and
64
+ * every throw becomes a fail-closed `PermissionDenied`, so a host without a
65
+ * usable helper performs no filesystem operation at all.
66
+ * @private
67
+ * @since 1.0.0
68
+ */
69
+ export const usableExecutable = (configured, boundaryRoot) => {
70
+ if (!isAbsolute(configured)) {
71
+ throw new AtomicHelperError({
72
+ code: "helper_path_invalid",
73
+ message: `atomic helper executable must be an absolute path, got ${JSON.stringify(configured)}`
74
+ });
75
+ }
76
+ // Resolved first: the checks below have to describe the file that will
77
+ // actually run, not the name that leads to it.
78
+ const resolved = executablePath(configured);
79
+ if (!statSync(resolved).isFile()) {
80
+ throw new AtomicHelperError({
81
+ code: "helper_not_regular_file",
82
+ message: `atomic helper executable is not a regular file: ${resolved}`
83
+ });
84
+ }
85
+ accessSync(resolved, constants.X_OK);
86
+ if (boundaryRoot !== undefined && inside(boundaryRoot, resolved)) {
87
+ throw new AtomicHelperError({
88
+ code: "helper_inside_workspace",
89
+ message: `atomic helper executable must live outside the confined workspace: ${resolved}`
90
+ });
91
+ }
92
+ return resolved;
93
+ };
94
+ /**
95
+ * Runs one helper over one framed request and settles with its converted
96
+ * answer. Every exit path kills the child, releases its pipes, and waits for
97
+ * the operating system to report that the process has closed.
98
+ * @private
99
+ * @since 1.0.0
100
+ */
101
+ export const spawnHelper = (request, executable, payload, settings) => Effect.callback((resume) => {
102
+ const limits = settings.limits;
103
+ let settled = false;
104
+ const stdout = [];
105
+ let stdoutBytes = 0;
106
+ const stderr = [];
107
+ let stderrBytes = 0;
108
+ let truncated = false;
109
+ let writeFailure;
110
+ // The packaged helper runs with an inert cwd and empty environment. The
111
+ // configured executable is validated outside the confined root first.
112
+ let child;
113
+ try {
114
+ child = spawn(executable, ["--atomic-fs"], {
115
+ cwd: inertDirectory,
116
+ env: {},
117
+ stdio: ["pipe", "pipe", "pipe"]
118
+ });
119
+ startedHelpers++;
120
+ }
121
+ catch (cause) {
122
+ // libuv reports some exec failures — `ENOEXEC` for a file that is
123
+ // neither a script nor a binary — by throwing rather than by emitting an
124
+ // `error` event, so both arrivals have to end in the same refusal.
125
+ resume(Effect.fail(failure(request, cause)));
126
+ return Effect.void;
127
+ }
128
+ const closed = new Promise((resolve) => child.once("close", () => resolve()));
129
+ // `deadline` is armed below, after the completion it resumes through
130
+ // exists. Reading it here is safe because nothing calls `cleanup` before
131
+ // then: the one earlier exit, a spawn that threw, resumes and returns.
132
+ const cleanup = () => {
133
+ clearTimeout(deadline);
134
+ child.stdin.destroy();
135
+ child.stdout.destroy();
136
+ child.stderr.destroy();
137
+ child.kill("SIGKILL");
138
+ };
139
+ const complete = (effect) => {
140
+ if (settled)
141
+ return;
142
+ settled = true;
143
+ // Every exit path drains and kills, so an overflowing, hung, or already
144
+ // finished helper leaves no descriptor and no child behind.
145
+ cleanup();
146
+ resume(Effect.andThen(Effect.promise(() => closed), effect));
147
+ };
148
+ // A wall-clock backstop, independent of every byte ceiling. Those bound
149
+ // what a helper may SAY; nothing bounds how long it may take to say it, and
150
+ // a helper that never answers would otherwise hold the fiber until the run
151
+ // itself is interrupted.
152
+ const deadline = setTimeout(() => {
153
+ complete(Effect.fail(failure(request, atomicHelperFault("helper_timeout", `atomic helper did not answer within ${settings.timeoutMs} ms`))));
154
+ }, settings.timeoutMs);
155
+ deadline.unref();
156
+ // Raw buffers, never decoded strings: a chunk boundary in the middle of a
157
+ // multi-byte character would otherwise be decoded as two replacement
158
+ // characters before the JSON parse ever saw it. Concatenating once at the
159
+ // end also keeps accumulation linear instead of quadratic.
160
+ // Retained bytes are bounded by the ceiling plus at most one pipe chunk:
161
+ // an overflowing chunk is sliced before it is retained, so the host never
162
+ // relies on the stream implementation's chunk-size convention.
163
+ child.stdout.on("data", (chunk) => {
164
+ const remaining = limits.response + frameHeaderBytes - stdoutBytes;
165
+ if (chunk.byteLength > remaining) {
166
+ if (remaining > 0) {
167
+ stdout.push(chunk.subarray(0, remaining));
168
+ stdoutBytes += remaining;
169
+ }
170
+ complete(Effect.fail(failure(request, atomicHelperFault("response_limit_exceeded", `atomic helper wrote more than ${limits.response} response bytes`))));
171
+ return;
172
+ }
173
+ stdoutBytes += chunk.byteLength;
174
+ stdout.push(chunk);
175
+ });
176
+ // stderr is bounded on its own budget: a helper that says nothing useful
177
+ // on stdout must not be able to exhaust the host through diagnostics.
178
+ // Destroying the pipe stops the helper at its next write rather than
179
+ // letting it produce output nobody will read.
180
+ child.stderr.on("data", (chunk) => {
181
+ // Sliced to the remaining room rather than kept whole, so the retained
182
+ // text is exactly the budget and not the budget plus a pipe buffer.
183
+ const slice = chunk.subarray(0, limits.stderr - stderrBytes);
184
+ stderrBytes += slice.byteLength;
185
+ stderr.push(slice);
186
+ if (stderrBytes >= limits.stderr) {
187
+ truncated = true;
188
+ child.stderr.destroy();
189
+ }
190
+ });
191
+ child.on("error", (cause) => complete(Effect.fail(failure(request, cause))));
192
+ // A helper that exits before draining stdin — an unavailable helper,
193
+ // a rejected request, an interrupt that killed it mid-write — makes the
194
+ // request write fail with EPIPE. Without a listener that is an unhandled
195
+ // `error` event on the pipe, which terminates the host process instead of
196
+ // failing one filesystem call. It is recorded rather than resumed on, so
197
+ // that a helper which did manage to report a real errno keeps precedence
198
+ // over the broken pipe its own exit caused.
199
+ child.stdin.on("error", (cause) => {
200
+ writeFailure = cause;
201
+ });
202
+ child.on("close", (code) => {
203
+ let envelope;
204
+ let malformed;
205
+ try {
206
+ envelope = decode(Buffer.concat(stdout), limits);
207
+ }
208
+ catch (cause) {
209
+ malformed = cause;
210
+ }
211
+ if (envelope !== undefined && !envelope.ok) {
212
+ // The helper's own typed rejection outranks the exit status and any
213
+ // transport noise: it is the only thing that knows which errno the
214
+ // syscall produced.
215
+ complete(Effect.fail(failure(request, atomicHelperFault("helper_rejected", envelope.message ?? "atomic helper rejected the operation"), envelope)));
216
+ return;
217
+ }
218
+ if (envelope !== undefined && code === 0) {
219
+ try {
220
+ complete(convert(request, envelope.value, limits));
221
+ }
222
+ catch (cause) {
223
+ complete(Effect.fail(failure(request, cause)));
224
+ }
225
+ return;
226
+ }
227
+ const text = Buffer.concat(stderr).toString("utf8");
228
+ complete(Effect.fail(failure(request, text !== ""
229
+ ? atomicHelperFault("helper_exited", `atomic helper exited ${code}: ${text}${truncated ? " (truncated)" : ""}`)
230
+ : writeFailure !== undefined
231
+ ? writeFailure
232
+ : malformed !== undefined
233
+ ? malformed
234
+ : atomicHelperFault("helper_exited", `atomic helper exited ${code}`))));
235
+ });
236
+ child.stdin.end(payload);
237
+ return Effect.promise(async () => {
238
+ cleanup();
239
+ await closed;
240
+ });
241
+ });
242
+ //# sourceMappingURL=AtomicFileSystemTransport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AtomicFileSystemTransport.js","sourceRoot":"","sources":["../../../src/internal/AtomicFileSystemTransport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,MAAM,EAAsB,MAAM,QAAQ,CAAA;AACnD,OAAO,EAAuC,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAChG,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAErF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAqB,MAAM,+BAA+B,CAAA;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D,IAAI,cAAc,GAAG,CAAC,CAAA;AAEtB;;;;GAIG;AACH,MAAM,CAAC,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CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAC1B,OAAO,EACP,IAAI,KAAK,EAAE;YACT,CAAC,CAAC,iBAAiB,CACjB,eAAe,EACf,wBAAwB,IAAI,KAAK,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1E;YACD,CAAC,CAAC,YAAY,KAAK,SAAS;gBAC5B,CAAC,CAAC,YAAY;gBACd,CAAC,CAAC,SAAS,KAAK,SAAS;oBACzB,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,iBAAiB,CAAC,eAAe,EAAE,wBAAwB,IAAI,EAAE,CAAC,CACvE,CAAC,CAAC,CAAA;IACL,CAAC,CAAC,CAAA;IACF,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACxB,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;QAC/B,OAAO,EAAE,CAAA;QACT,MAAM,MAAM,CAAA;IACd,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/**\n * The process transport beneath the atomic filesystem: resolving the\n * configured helper to a file the confined workspace cannot have\n * supplied, and running one isolated, bounded helper process per framed\n * request.\n * @since 1.0.0\n */\n\nimport type * as KernelFileSystem from \"@smthrs/kernel/FileSystem\"\nimport { Effect, type PlatformError } from \"effect\"\nimport { type ChildProcessWithoutNullStreams, spawn } from \"node:child_process\"\nimport { accessSync, constants, lstatSync, readlinkSync, realpathSync, statSync } from \"node:fs\"\nimport { basename, dirname, isAbsolute, join, parse, relative, sep } from \"node:path\"\nimport type { Limits } from \"../AtomicFileSystem.ts\"\nimport { convert, decode, failure, frameHeaderBytes, type HelperResult } from \"./AtomicFileSystemProtocol.ts\"\nimport { AtomicHelperError } from \"./AtomicHelperError.ts\"\nimport { atomicHelperFault } from \"./AtomicHelperFault.ts\"\n\nlet startedHelpers = 0\n\n/**\n * Process-local helper starts, including helpers later cancelled or refused.\n * @private\n * @since 1.0.0\n */\nexport const started = (): number => startedHelpers\n\n/** An inert working directory: nothing the helper could import lives there. */\nconst inertDirectory = parse(process.execPath).root\n\n/**\n * True when `target` is at or below `root`. Both are absolute and already\n * canonical. A different Windows drive produces an absolute relative result.\n * @private\n * @since 1.0.0\n */\nexport const inside = (root: string, target: string): boolean => {\n const path = relative(root, target)\n return path === \"\" || (path !== \"..\" && !path.startsWith(`..${sep}`) && !isAbsolute(path))\n}\n\n/** Resolve symlinks without replacing a hard-linked executable's entry name. */\nconst executablePath = (configured: string): string => {\n let current = configured\n for (let links = 0; links < 40; links++) {\n if (current.endsWith(\"/\") || current.endsWith(sep)) {\n throw new AtomicHelperError({\n code: \"helper_path_invalid\",\n message: \"atomic helper executable cannot end with a directory separator\"\n })\n }\n // Bun's macOS realpath can return another hard link to the final inode:\n // A hard-linked executable can change its entry name during guarded reads.\n // Directories cannot have those file aliases. Resolve the parent, preserve\n // the leaf name, and explicitly follow only actual leaf symlinks.\n const parent = realpathSync.native(dirname(current))\n const candidate = join(parent, basename(current))\n if (!lstatSync(candidate).isSymbolicLink()) return candidate\n const target = readlinkSync(candidate)\n // Do not normalize `link/..` lexically; realpath must traverse it first.\n current = isAbsolute(target) ? target : `${parent}/${target}`\n }\n throw new AtomicHelperError({\n code: \"helper_path_invalid\",\n message: \"atomic helper executable has too many symbolic links\"\n })\n}\n\n/**\n * Resolves the configured helper to an absolute, executable regular file\n * that the confined workspace cannot have supplied. Every failure throws, and\n * every throw becomes a fail-closed `PermissionDenied`, so a host without a\n * usable helper performs no filesystem operation at all.\n * @private\n * @since 1.0.0\n */\nexport const usableExecutable = (configured: string, boundaryRoot: string | undefined): string => {\n if (!isAbsolute(configured)) {\n throw new AtomicHelperError({\n code: \"helper_path_invalid\",\n message: `atomic helper executable must be an absolute path, got ${JSON.stringify(configured)}`\n })\n }\n // Resolved first: the checks below have to describe the file that will\n // actually run, not the name that leads to it.\n const resolved = executablePath(configured)\n if (!statSync(resolved).isFile()) {\n throw new AtomicHelperError({\n code: \"helper_not_regular_file\",\n message: `atomic helper executable is not a regular file: ${resolved}`\n })\n }\n accessSync(resolved, constants.X_OK)\n if (boundaryRoot !== undefined && inside(boundaryRoot, resolved)) {\n throw new AtomicHelperError({\n code: \"helper_inside_workspace\",\n message: `atomic helper executable must live outside the confined workspace: ${resolved}`\n })\n }\n return resolved\n}\n\n/**\n * Runs one helper over one framed request and settles with its converted\n * answer. Every exit path kills the child, releases its pipes, and waits for\n * the operating system to report that the process has closed.\n * @private\n * @since 1.0.0\n */\nexport const spawnHelper = <A>(\n request: KernelFileSystem.AtomicRequest,\n executable: string,\n payload: Buffer,\n settings: { readonly limits: Limits; readonly timeoutMs: number }\n): Effect.Effect<A, PlatformError.PlatformError> =>\n Effect.callback<A, PlatformError.PlatformError>((resume) => {\n const limits = settings.limits\n let settled = false\n const stdout: Array<Buffer> = []\n let stdoutBytes = 0\n const stderr: Array<Buffer> = []\n let stderrBytes = 0\n let truncated = false\n let writeFailure: unknown\n\n // The packaged helper runs with an inert cwd and empty environment. The\n // configured executable is validated outside the confined root first.\n let child: ChildProcessWithoutNullStreams\n try {\n child = spawn(executable, [\"--atomic-fs\"], {\n cwd: inertDirectory,\n env: {},\n stdio: [\"pipe\", \"pipe\", \"pipe\"]\n })\n startedHelpers++\n } catch (cause) {\n // libuv reports some exec failures — `ENOEXEC` for a file that is\n // neither a script nor a binary — by throwing rather than by emitting an\n // `error` event, so both arrivals have to end in the same refusal.\n resume(Effect.fail(failure(request, cause)))\n return Effect.void\n }\n const closed = new Promise<void>((resolve) => child.once(\"close\", () => resolve()))\n // `deadline` is armed below, after the completion it resumes through\n // exists. Reading it here is safe because nothing calls `cleanup` before\n // then: the one earlier exit, a spawn that threw, resumes and returns.\n const cleanup = () => {\n clearTimeout(deadline)\n child.stdin.destroy()\n child.stdout.destroy()\n child.stderr.destroy()\n child.kill(\"SIGKILL\")\n }\n const complete = (effect: Effect.Effect<A, PlatformError.PlatformError>) => {\n if (settled) return\n settled = true\n // Every exit path drains and kills, so an overflowing, hung, or already\n // finished helper leaves no descriptor and no child behind.\n cleanup()\n resume(Effect.andThen(Effect.promise(() => closed), effect))\n }\n // A wall-clock backstop, independent of every byte ceiling. Those bound\n // what a helper may SAY; nothing bounds how long it may take to say it, and\n // a helper that never answers would otherwise hold the fiber until the run\n // itself is interrupted.\n const deadline = setTimeout(() => {\n complete(Effect.fail(failure(\n request,\n atomicHelperFault(\"helper_timeout\", `atomic helper did not answer within ${settings.timeoutMs} ms`)\n )))\n }, settings.timeoutMs)\n deadline.unref()\n // Raw buffers, never decoded strings: a chunk boundary in the middle of a\n // multi-byte character would otherwise be decoded as two replacement\n // characters before the JSON parse ever saw it. Concatenating once at the\n // end also keeps accumulation linear instead of quadratic.\n // Retained bytes are bounded by the ceiling plus at most one pipe chunk:\n // an overflowing chunk is sliced before it is retained, so the host never\n // relies on the stream implementation's chunk-size convention.\n child.stdout.on(\"data\", (chunk: Buffer) => {\n const remaining = limits.response + frameHeaderBytes - stdoutBytes\n if (chunk.byteLength > remaining) {\n if (remaining > 0) {\n stdout.push(chunk.subarray(0, remaining))\n stdoutBytes += remaining\n }\n complete(Effect.fail(failure(\n request,\n atomicHelperFault(\n \"response_limit_exceeded\",\n `atomic helper wrote more than ${limits.response} response bytes`\n )\n )))\n return\n }\n stdoutBytes += chunk.byteLength\n stdout.push(chunk)\n })\n // stderr is bounded on its own budget: a helper that says nothing useful\n // on stdout must not be able to exhaust the host through diagnostics.\n // Destroying the pipe stops the helper at its next write rather than\n // letting it produce output nobody will read.\n child.stderr.on(\"data\", (chunk: Buffer) => {\n // Sliced to the remaining room rather than kept whole, so the retained\n // text is exactly the budget and not the budget plus a pipe buffer.\n const slice = chunk.subarray(0, limits.stderr - stderrBytes)\n stderrBytes += slice.byteLength\n stderr.push(slice)\n if (stderrBytes >= limits.stderr) {\n truncated = true\n child.stderr.destroy()\n }\n })\n child.on(\"error\", (cause) => complete(Effect.fail(failure(request, cause))))\n // A helper that exits before draining stdin — an unavailable helper,\n // a rejected request, an interrupt that killed it mid-write — makes the\n // request write fail with EPIPE. Without a listener that is an unhandled\n // `error` event on the pipe, which terminates the host process instead of\n // failing one filesystem call. It is recorded rather than resumed on, so\n // that a helper which did manage to report a real errno keeps precedence\n // over the broken pipe its own exit caused.\n child.stdin.on(\"error\", (cause) => {\n writeFailure = cause\n })\n child.on(\"close\", (code) => {\n let envelope: HelperResult | undefined\n let malformed: unknown\n try {\n envelope = decode(Buffer.concat(stdout), limits)\n } catch (cause) {\n malformed = cause\n }\n if (envelope !== undefined && !envelope.ok) {\n // The helper's own typed rejection outranks the exit status and any\n // transport noise: it is the only thing that knows which errno the\n // syscall produced.\n complete(Effect.fail(failure(\n request,\n atomicHelperFault(\"helper_rejected\", envelope.message ?? \"atomic helper rejected the operation\"),\n envelope\n )))\n return\n }\n if (envelope !== undefined && code === 0) {\n try {\n complete(convert<A>(request, envelope.value, limits))\n } catch (cause) {\n complete(Effect.fail(failure(request, cause)))\n }\n return\n }\n const text = Buffer.concat(stderr).toString(\"utf8\")\n complete(Effect.fail(failure(\n request,\n text !== \"\"\n ? atomicHelperFault(\n \"helper_exited\",\n `atomic helper exited ${code}: ${text}${truncated ? \" (truncated)\" : \"\"}`\n )\n : writeFailure !== undefined\n ? writeFailure\n : malformed !== undefined\n ? malformed\n : atomicHelperFault(\"helper_exited\", `atomic helper exited ${code}`)\n )))\n })\n child.stdin.end(payload)\n return Effect.promise(async () => {\n cleanup()\n await closed\n })\n })\n"]}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The configuration failures of the atomic filesystem helper: a layer option
3
+ * outside its bounds, a request that cannot be serialized, and a helper that
4
+ * cannot be found, is not usable, or is not trusted. A caller classifies one
5
+ * by `_tag` and `code` instead of reading its message.
6
+ * @since 1.0.0
7
+ */
8
+ import { Schema } from "effect";
9
+ /**
10
+ * Why the atomic helper could not be configured or resolved.
11
+ * @category models
12
+ * @since 1.0.0
13
+ */
14
+ export declare const AtomicHelperErrorCode: Schema.Literals<readonly ["limit_invalid", "concurrency_invalid", "timeout_invalid", "request_not_serializable", "helper_missing", "helper_unusable", "helper_path_invalid", "helper_not_regular_file", "helper_inside_workspace", "staging_directory_not_private", "staging_unavailable"]>;
15
+ /**
16
+ * The stable code of an {@link AtomicHelperError}.
17
+ * @category models
18
+ * @since 1.0.0
19
+ */
20
+ export type AtomicHelperErrorCode = typeof AtomicHelperErrorCode.Type;
21
+ declare const AtomicHelperError_base: Schema.Class<AtomicHelperError, Schema.TaggedStruct<"@smthrs/platform-node/AtomicHelperError", {
22
+ readonly code: Schema.Literals<readonly ["limit_invalid", "concurrency_invalid", "timeout_invalid", "request_not_serializable", "helper_missing", "helper_unusable", "helper_path_invalid", "helper_not_regular_file", "helper_inside_workspace", "staging_directory_not_private", "staging_unavailable"]>;
23
+ readonly message: Schema.String;
24
+ }>, import("effect/Cause").YieldableError>;
25
+ /**
26
+ * The atomic helper is misconfigured, missing, or untrusted. `message` names
27
+ * what was searched and how to install the helper where that applies.
28
+ * @category errors
29
+ * @since 1.0.0
30
+ */
31
+ export declare class AtomicHelperError extends AtomicHelperError_base {
32
+ readonly name = "AtomicHelperError";
33
+ }
34
+ export {};
35
+ //# sourceMappingURL=AtomicHelperError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AtomicHelperError.d.ts","sourceRoot":"","sources":["../../../src/internal/AtomicHelperError.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,6RAYhC,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAC,IAAI,CAAA;;;;;AAErE;;;;;GAKG;AACH,qBAAa,iBACX,SAAQ,sBAGN;IAEF,SAAkB,IAAI,uBAAsB;CAC7C"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The configuration failures of the atomic filesystem helper: a layer option
3
+ * outside its bounds, a request that cannot be serialized, and a helper that
4
+ * cannot be found, is not usable, or is not trusted. A caller classifies one
5
+ * by `_tag` and `code` instead of reading its message.
6
+ * @since 1.0.0
7
+ */
8
+ import { Schema } from "effect";
9
+ /**
10
+ * Why the atomic helper could not be configured or resolved.
11
+ * @category models
12
+ * @since 1.0.0
13
+ */
14
+ export const AtomicHelperErrorCode = Schema.Literals([
15
+ "limit_invalid",
16
+ "concurrency_invalid",
17
+ "timeout_invalid",
18
+ "request_not_serializable",
19
+ "helper_missing",
20
+ "helper_unusable",
21
+ "helper_path_invalid",
22
+ "helper_not_regular_file",
23
+ "helper_inside_workspace",
24
+ "staging_directory_not_private",
25
+ "staging_unavailable"
26
+ ]);
27
+ /**
28
+ * The atomic helper is misconfigured, missing, or untrusted. `message` names
29
+ * what was searched and how to install the helper where that applies.
30
+ * @category errors
31
+ * @since 1.0.0
32
+ */
33
+ export class AtomicHelperError extends Schema.TaggedError()("@smthrs/platform-node/AtomicHelperError", {
34
+ code: AtomicHelperErrorCode,
35
+ message: Schema.String
36
+ }) {
37
+ name = "AtomicHelperError";
38
+ }
39
+ //# sourceMappingURL=AtomicHelperError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AtomicHelperError.js","sourceRoot":"","sources":["../../../src/internal/AtomicHelperError.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,QAAQ,CAAC;IACnD,eAAe;IACf,qBAAqB;IACrB,iBAAiB;IACjB,0BAA0B;IAC1B,gBAAgB;IAChB,iBAAiB;IACjB,qBAAqB;IACrB,yBAAyB;IACzB,yBAAyB;IACzB,+BAA+B;IAC/B,qBAAqB;CACtB,CAAC,CAAA;AASF;;;;;GAKG;AACH,MAAM,OAAO,iBACX,SAAQ,MAAM,CAAC,WAAW,EAAqB,CAAC,yCAAyC,EAAE;IACzF,IAAI,EAAE,qBAAqB;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CAAC;IAEgB,IAAI,GAAG,mBAAmB,CAAA;CAC7C","sourcesContent":["/**\n * The configuration failures of the atomic filesystem helper: a layer option\n * outside its bounds, a request that cannot be serialized, and a helper that\n * cannot be found, is not usable, or is not trusted. A caller classifies one\n * by `_tag` and `code` instead of reading its message.\n * @since 1.0.0\n */\n\nimport { Schema } from \"effect\"\n\n/**\n * Why the atomic helper could not be configured or resolved.\n * @category models\n * @since 1.0.0\n */\nexport const AtomicHelperErrorCode = Schema.Literals([\n \"limit_invalid\",\n \"concurrency_invalid\",\n \"timeout_invalid\",\n \"request_not_serializable\",\n \"helper_missing\",\n \"helper_unusable\",\n \"helper_path_invalid\",\n \"helper_not_regular_file\",\n \"helper_inside_workspace\",\n \"staging_directory_not_private\",\n \"staging_unavailable\"\n])\n\n/**\n * The stable code of an {@link AtomicHelperError}.\n * @category models\n * @since 1.0.0\n */\nexport type AtomicHelperErrorCode = typeof AtomicHelperErrorCode.Type\n\n/**\n * The atomic helper is misconfigured, missing, or untrusted. `message` names\n * what was searched and how to install the helper where that applies.\n * @category errors\n * @since 1.0.0\n */\nexport class AtomicHelperError\n extends Schema.TaggedError<AtomicHelperError>()(\"@smthrs/platform-node/AtomicHelperError\", {\n code: AtomicHelperErrorCode,\n message: Schema.String\n })\n{\n override readonly name = \"AtomicHelperError\"\n}\n"]}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The atomic helper broke its protocol or its transport failed: a response that
3
+ * is not framed, a field of the wrong shape, an answer over a bound, a helper
4
+ * that never answered, or one that exited. `AtomicFileSystemProtocol.failure`
5
+ * reports one as the `cause` of a `PlatformError`, so a caller classifies it by
6
+ * `_tag` and `code`. {@link AtomicHelperRejection} carries the errno a helper
7
+ * itself reported.
8
+ * @since 1.0.0
9
+ */
10
+ import { Schema } from "effect";
11
+ /**
12
+ * Which rule of the helper protocol or transport was broken.
13
+ * @category models
14
+ * @since 1.0.0
15
+ */
16
+ export declare const AtomicHelperFaultCode: Schema.Literals<readonly ["response_unframed", "response_tag_unknown", "response_length_invalid", "response_length_mismatch", "envelope_malformed", "field_malformed", "file_type_unknown", "payload_malformed", "read_limit_exceeded", "entries_malformed", "batch_malformed", "digest_malformed", "result_malformed", "operation_unsupported", "helper_timeout", "response_limit_exceeded", "helper_rejected", "helper_exited"]>;
17
+ /**
18
+ * The stable code of an {@link AtomicHelperFault}.
19
+ * @category models
20
+ * @since 1.0.0
21
+ */
22
+ export type AtomicHelperFaultCode = typeof AtomicHelperFaultCode.Type;
23
+ declare const AtomicHelperFault_base: Schema.Class<AtomicHelperFault, Schema.TaggedStruct<"@smthrs/platform-node/AtomicHelperFault", {
24
+ readonly code: Schema.Literals<readonly ["response_unframed", "response_tag_unknown", "response_length_invalid", "response_length_mismatch", "envelope_malformed", "field_malformed", "file_type_unknown", "payload_malformed", "read_limit_exceeded", "entries_malformed", "batch_malformed", "digest_malformed", "result_malformed", "operation_unsupported", "helper_timeout", "response_limit_exceeded", "helper_rejected", "helper_exited"]>;
25
+ readonly message: Schema.String;
26
+ }>, import("effect/Cause").YieldableError>;
27
+ /**
28
+ * The helper's response or process broke the protocol. The helper is treated as
29
+ * untrusted, so the operation fails closed.
30
+ * @category errors
31
+ * @since 1.0.0
32
+ */
33
+ export declare class AtomicHelperFault extends AtomicHelperFault_base {
34
+ readonly name = "AtomicHelperFault";
35
+ }
36
+ /**
37
+ * A helper fault with a stable code.
38
+ * @category constructors
39
+ * @since 1.0.0
40
+ */
41
+ export declare const atomicHelperFault: (code: AtomicHelperFaultCode, message: string) => AtomicHelperFault;
42
+ declare const AtomicHelperRejection_base: Schema.Class<AtomicHelperRejection, Schema.TaggedStruct<"@smthrs/platform-node/AtomicHelperRejection", {
43
+ readonly code: Schema.String;
44
+ readonly syscall: Schema.optional<Schema.String>;
45
+ readonly message: Schema.String;
46
+ readonly cause: Schema.optional<Schema.Unknown>;
47
+ }>, import("effect/Cause").YieldableError>;
48
+ /**
49
+ * The errno a helper reported for a syscall it ran, in the shape the native
50
+ * Node adapter's errors carry so callers that read `code` and `syscall` see the
51
+ * same contract.
52
+ * @category errors
53
+ * @since 1.0.0
54
+ */
55
+ export declare class AtomicHelperRejection extends AtomicHelperRejection_base {
56
+ readonly name = "AtomicHelperRejection";
57
+ }
58
+ export {};
59
+ //# sourceMappingURL=AtomicHelperFault.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AtomicHelperFault.d.ts","sourceRoot":"","sources":["../../../src/internal/AtomicHelperFault.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,oaAmBhC,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAC,IAAI,CAAA;;;;;AAErE;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,sBAGtC;IACC,SAAkB,IAAI,uBAAsB;CAC7C;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,qBAAqB,EAAE,SAAS,MAAM,KAAG,iBACvC,CAAA;;;;;;;AAE1C;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,0BAQ1C;IACC,SAAkB,IAAI,2BAA0B;CACjD"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The atomic helper broke its protocol or its transport failed: a response that
3
+ * is not framed, a field of the wrong shape, an answer over a bound, a helper
4
+ * that never answered, or one that exited. `AtomicFileSystemProtocol.failure`
5
+ * reports one as the `cause` of a `PlatformError`, so a caller classifies it by
6
+ * `_tag` and `code`. {@link AtomicHelperRejection} carries the errno a helper
7
+ * itself reported.
8
+ * @since 1.0.0
9
+ */
10
+ import { Schema } from "effect";
11
+ /**
12
+ * Which rule of the helper protocol or transport was broken.
13
+ * @category models
14
+ * @since 1.0.0
15
+ */
16
+ export const AtomicHelperFaultCode = Schema.Literals([
17
+ "response_unframed",
18
+ "response_tag_unknown",
19
+ "response_length_invalid",
20
+ "response_length_mismatch",
21
+ "envelope_malformed",
22
+ "field_malformed",
23
+ "file_type_unknown",
24
+ "payload_malformed",
25
+ "read_limit_exceeded",
26
+ "entries_malformed",
27
+ "batch_malformed",
28
+ "digest_malformed",
29
+ "result_malformed",
30
+ "operation_unsupported",
31
+ "helper_timeout",
32
+ "response_limit_exceeded",
33
+ "helper_rejected",
34
+ "helper_exited"
35
+ ]);
36
+ /**
37
+ * The helper's response or process broke the protocol. The helper is treated as
38
+ * untrusted, so the operation fails closed.
39
+ * @category errors
40
+ * @since 1.0.0
41
+ */
42
+ export class AtomicHelperFault extends Schema.TaggedError()("@smthrs/platform-node/AtomicHelperFault", { code: AtomicHelperFaultCode, message: Schema.String }) {
43
+ name = "AtomicHelperFault";
44
+ }
45
+ /**
46
+ * A helper fault with a stable code.
47
+ * @category constructors
48
+ * @since 1.0.0
49
+ */
50
+ export const atomicHelperFault = (code, message) => new AtomicHelperFault({ code, message });
51
+ /**
52
+ * The errno a helper reported for a syscall it ran, in the shape the native
53
+ * Node adapter's errors carry so callers that read `code` and `syscall` see the
54
+ * same contract.
55
+ * @category errors
56
+ * @since 1.0.0
57
+ */
58
+ export class AtomicHelperRejection extends Schema.TaggedError()("@smthrs/platform-node/AtomicHelperRejection", {
59
+ code: Schema.String,
60
+ syscall: Schema.optional(Schema.String),
61
+ message: Schema.String,
62
+ cause: Schema.optional(Schema.Unknown)
63
+ }) {
64
+ name = "AtomicHelperRejection";
65
+ }
66
+ //# sourceMappingURL=AtomicHelperFault.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AtomicHelperFault.js","sourceRoot":"","sources":["../../../src/internal/AtomicHelperFault.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,QAAQ,CAAC;IACnD,mBAAmB;IACnB,sBAAsB;IACtB,yBAAyB;IACzB,0BAA0B;IAC1B,oBAAoB;IACpB,iBAAiB;IACjB,mBAAmB;IACnB,mBAAmB;IACnB,qBAAqB;IACrB,mBAAmB;IACnB,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB,uBAAuB;IACvB,gBAAgB;IAChB,yBAAyB;IACzB,iBAAiB;IACjB,eAAe;CAChB,CAAC,CAAA;AASF;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,WAAW,EAAqB,CAC5E,yCAAyC,EACzC,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CACxD;IACmB,IAAI,GAAG,mBAAmB,CAAA;CAC7C;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAA2B,EAAE,OAAe,EAAqB,EAAE,CACnG,IAAI,iBAAiB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;AAE1C;;;;;;GAMG;AACH,MAAM,OAAO,qBAAsB,SAAQ,MAAM,CAAC,WAAW,EAAyB,CACpF,6CAA6C,EAC7C;IACE,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;CACvC,CACF;IACmB,IAAI,GAAG,uBAAuB,CAAA;CACjD","sourcesContent":["/**\n * The atomic helper broke its protocol or its transport failed: a response that\n * is not framed, a field of the wrong shape, an answer over a bound, a helper\n * that never answered, or one that exited. `AtomicFileSystemProtocol.failure`\n * reports one as the `cause` of a `PlatformError`, so a caller classifies it by\n * `_tag` and `code`. {@link AtomicHelperRejection} carries the errno a helper\n * itself reported.\n * @since 1.0.0\n */\n\nimport { Schema } from \"effect\"\n\n/**\n * Which rule of the helper protocol or transport was broken.\n * @category models\n * @since 1.0.0\n */\nexport const AtomicHelperFaultCode = Schema.Literals([\n \"response_unframed\",\n \"response_tag_unknown\",\n \"response_length_invalid\",\n \"response_length_mismatch\",\n \"envelope_malformed\",\n \"field_malformed\",\n \"file_type_unknown\",\n \"payload_malformed\",\n \"read_limit_exceeded\",\n \"entries_malformed\",\n \"batch_malformed\",\n \"digest_malformed\",\n \"result_malformed\",\n \"operation_unsupported\",\n \"helper_timeout\",\n \"response_limit_exceeded\",\n \"helper_rejected\",\n \"helper_exited\"\n])\n\n/**\n * The stable code of an {@link AtomicHelperFault}.\n * @category models\n * @since 1.0.0\n */\nexport type AtomicHelperFaultCode = typeof AtomicHelperFaultCode.Type\n\n/**\n * The helper's response or process broke the protocol. The helper is treated as\n * untrusted, so the operation fails closed.\n * @category errors\n * @since 1.0.0\n */\nexport class AtomicHelperFault extends Schema.TaggedError<AtomicHelperFault>()(\n \"@smthrs/platform-node/AtomicHelperFault\",\n { code: AtomicHelperFaultCode, message: Schema.String }\n) {\n override readonly name = \"AtomicHelperFault\"\n}\n\n/**\n * A helper fault with a stable code.\n * @category constructors\n * @since 1.0.0\n */\nexport const atomicHelperFault = (code: AtomicHelperFaultCode, message: string): AtomicHelperFault =>\n new AtomicHelperFault({ code, message })\n\n/**\n * The errno a helper reported for a syscall it ran, in the shape the native\n * Node adapter's errors carry so callers that read `code` and `syscall` see the\n * same contract.\n * @category errors\n * @since 1.0.0\n */\nexport class AtomicHelperRejection extends Schema.TaggedError<AtomicHelperRejection>()(\n \"@smthrs/platform-node/AtomicHelperRejection\",\n {\n code: Schema.String,\n syscall: Schema.optional(Schema.String),\n message: Schema.String,\n cause: Schema.optional(Schema.Unknown)\n }\n) {\n override readonly name = \"AtomicHelperRejection\"\n}\n"]}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Native I/O ownership for transient commands and prepared process owners.
3
+ * @since 1.0.0
4
+ */
5
+ import * as Effect from "effect/Effect";
6
+ import * as PlatformError from "effect/PlatformError";
7
+ import type * as Scope from "effect/Scope";
8
+ import * as ChildProcess from "effect/unstable/process/ChildProcess";
9
+ import { type ChildProcessHandle } from "effect/unstable/process/ChildProcessSpawner";
10
+ /**
11
+ * Windows owners receive caller streams above the reserved CRT standard slots.
12
+ * @private
13
+ * @since 1.0.0
14
+ */
15
+ export declare const standardFdsOf: (handle: ChildProcessHandle) => ReadonlyArray<number | "ignore"> | undefined;
16
+ /**
17
+ * Converts native errors without losing their errno or signal.
18
+ * @private
19
+ * @since 1.0.0
20
+ */
21
+ export declare const failure: (method: string, cause: unknown) => PlatformError.PlatformError;
22
+ /**
23
+ * Native standard-command I/O, including configured streams and custom pipes.
24
+ * Lifetime error listeners remain on every owned pipe after any consumer is
25
+ * interrupted, so a pending native write cannot raise an unhandled late EPIPE.
26
+ * Consumers still receive the original error through NodeStream/NodeSink.
27
+ * This adapter also preserves native Windows verbatim arguments.
28
+ *
29
+ * It never sends a negative-pid signal. POSIX tree cleanup belongs to the
30
+ * prepared supervisor, which remains alive while it signals its own group.
31
+ * @private
32
+ * @since 1.0.0
33
+ */
34
+ export declare const spawn: (command: ChildProcess.StandardCommand, windowsVerbatimArguments: boolean | undefined, owner?: boolean) => Effect.Effect<ChildProcessHandle, PlatformError.PlatformError, Scope.Scope>;
35
+ //# sourceMappingURL=PipedProcess.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PipedProcess.d.ts","sourceRoot":"","sources":["../../../src/internal/PipedProcess.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAG1C,OAAO,KAAK,YAAY,MAAM,sCAAsC,CAAA;AACpE,OAAO,EAAE,KAAK,kBAAkB,EAAmC,MAAM,6CAA6C,CAAA;AAMtH;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,kBAAkB,KAAG,aAAa,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,SAChE,CAAA;AAa9B;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,MAAM,EAAE,OAAO,OAAO,KAAG,aAAa,CAAC,aAUtE,CAAA;AAyCD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,KAAK,GAChB,SAAS,YAAY,CAAC,eAAe,EACrC,0BAA0B,OAAO,GAAG,SAAS,EAC7C,eAAa,KACZ,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC,aAAa,EAAE,KAAK,CAAC,KAAK,CAsPzE,CAAA"}