@smthrs/platform-node 0.0.0-stage → 1.0.0-rc.3
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.
- package/CHANGELOG.md +211 -0
- package/LICENSE +21 -0
- package/README.md +165 -2
- package/bin/darwin-arm64/smithers-jj-export +0 -0
- package/bin/darwin-x64/smithers-jj-export +0 -0
- package/bin/linux-arm64/smithers-jj-export +0 -0
- package/bin/linux-x64/smithers-jj-export +4 -0
- package/bin/win32-x64/smithers-jj-export.exe +0 -0
- package/dist/cjs/AtomicFileSystem.d.ts +147 -0
- package/dist/cjs/AtomicFileSystem.d.ts.map +1 -0
- package/dist/cjs/AtomicFileSystem.js +234 -0
- package/dist/cjs/AtomicFileSystem.js.map +7 -0
- package/dist/cjs/EgressHttpClient.d.ts +106 -0
- package/dist/cjs/EgressHttpClient.d.ts.map +1 -0
- package/dist/cjs/EgressHttpClient.js +202 -0
- package/dist/cjs/EgressHttpClient.js.map +7 -0
- package/dist/cjs/HostLiveness.d.ts +81 -0
- package/dist/cjs/HostLiveness.d.ts.map +1 -0
- package/dist/cjs/HostLiveness.js +49 -0
- package/dist/cjs/HostLiveness.js.map +7 -0
- package/dist/cjs/NodeHost.d.ts +145 -0
- package/dist/cjs/NodeHost.d.ts.map +1 -0
- package/dist/cjs/NodeHost.js +128 -0
- package/dist/cjs/NodeHost.js.map +7 -0
- package/dist/cjs/ProcessConfinement.d.ts +61 -0
- package/dist/cjs/ProcessConfinement.d.ts.map +1 -0
- package/dist/cjs/ProcessConfinement.js +287 -0
- package/dist/cjs/ProcessConfinement.js.map +7 -0
- package/dist/cjs/ProcessReaper.d.ts +457 -0
- package/dist/cjs/ProcessReaper.d.ts.map +1 -0
- package/dist/cjs/ProcessReaper.js +349 -0
- package/dist/cjs/ProcessReaper.js.map +7 -0
- package/dist/cjs/ProcessSandbox.d.ts +377 -0
- package/dist/cjs/ProcessSandbox.d.ts.map +1 -0
- package/dist/cjs/ProcessSandbox.js +759 -0
- package/dist/cjs/ProcessSandbox.js.map +7 -0
- package/dist/cjs/ScopedProcess.d.ts +65 -0
- package/dist/cjs/ScopedProcess.d.ts.map +1 -0
- package/dist/cjs/ScopedProcess.js +87 -0
- package/dist/cjs/ScopedProcess.js.map +7 -0
- package/dist/cjs/index.d.ts +38 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +47 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/AtomicFileSystemExecutable.d.ts +61 -0
- package/dist/cjs/internal/AtomicFileSystemExecutable.d.ts.map +1 -0
- package/dist/cjs/internal/AtomicFileSystemExecutable.js +250 -0
- package/dist/cjs/internal/AtomicFileSystemExecutable.js.map +7 -0
- package/dist/cjs/internal/AtomicFileSystemProtocol.d.ts +78 -0
- package/dist/cjs/internal/AtomicFileSystemProtocol.d.ts.map +1 -0
- package/dist/cjs/internal/AtomicFileSystemProtocol.js +382 -0
- package/dist/cjs/internal/AtomicFileSystemProtocol.js.map +7 -0
- package/dist/cjs/internal/AtomicFileSystemTransport.d.ts +44 -0
- package/dist/cjs/internal/AtomicFileSystemTransport.d.ts.map +1 -0
- package/dist/cjs/internal/AtomicFileSystemTransport.js +197 -0
- package/dist/cjs/internal/AtomicFileSystemTransport.js.map +7 -0
- package/dist/cjs/internal/AtomicHelperError.d.ts +35 -0
- package/dist/cjs/internal/AtomicHelperError.d.ts.map +1 -0
- package/dist/cjs/internal/AtomicHelperError.js +45 -0
- package/dist/cjs/internal/AtomicHelperError.js.map +7 -0
- package/dist/cjs/internal/AtomicHelperFault.d.ts +59 -0
- package/dist/cjs/internal/AtomicHelperFault.d.ts.map +1 -0
- package/dist/cjs/internal/AtomicHelperFault.js +66 -0
- package/dist/cjs/internal/AtomicHelperFault.js.map +7 -0
- package/dist/cjs/internal/PipedProcess.d.ts +35 -0
- package/dist/cjs/internal/PipedProcess.d.ts.map +1 -0
- package/dist/cjs/internal/PipedProcess.js +309 -0
- package/dist/cjs/internal/PipedProcess.js.map +7 -0
- package/dist/cjs/internal/ProcSnapshot.d.ts +85 -0
- package/dist/cjs/internal/ProcSnapshot.d.ts.map +1 -0
- package/dist/cjs/internal/ProcSnapshot.js +123 -0
- package/dist/cjs/internal/ProcSnapshot.js.map +7 -0
- package/dist/cjs/internal/ProcessCleanup.d.ts +64 -0
- package/dist/cjs/internal/ProcessCleanup.d.ts.map +1 -0
- package/dist/cjs/internal/ProcessCleanup.js +62 -0
- package/dist/cjs/internal/ProcessCleanup.js.map +7 -0
- package/dist/cjs/internal/ProcessCleanupPolicyError.d.ts +30 -0
- package/dist/cjs/internal/ProcessCleanupPolicyError.d.ts.map +1 -0
- package/dist/cjs/internal/ProcessCleanupPolicyError.js +33 -0
- package/dist/cjs/internal/ProcessCleanupPolicyError.js.map +7 -0
- package/dist/cjs/internal/ProcessFault.d.ts +63 -0
- package/dist/cjs/internal/ProcessFault.d.ts.map +1 -0
- package/dist/cjs/internal/ProcessFault.js +63 -0
- package/dist/cjs/internal/ProcessFault.js.map +7 -0
- package/dist/cjs/internal/ProcessSupervisor.d.ts +141 -0
- package/dist/cjs/internal/ProcessSupervisor.d.ts.map +1 -0
- package/dist/cjs/internal/ProcessSupervisor.js +682 -0
- package/dist/cjs/internal/ProcessSupervisor.js.map +7 -0
- package/dist/cjs/internal/SupervisorProgram.d.ts +9 -0
- package/dist/cjs/internal/SupervisorProgram.d.ts.map +1 -0
- package/dist/cjs/internal/SupervisorProgram.js +306 -0
- package/dist/cjs/internal/SupervisorProgram.js.map +7 -0
- package/dist/cjs/internal/WindowsProcessJob.d.ts +39 -0
- package/dist/cjs/internal/WindowsProcessJob.d.ts.map +1 -0
- package/dist/cjs/internal/WindowsProcessJob.js +113 -0
- package/dist/cjs/internal/WindowsProcessJob.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/AtomicFileSystem.d.ts +147 -0
- package/dist/esm/AtomicFileSystem.d.ts.map +1 -0
- package/dist/esm/AtomicFileSystem.js +290 -0
- package/dist/esm/AtomicFileSystem.js.map +1 -0
- package/dist/esm/EgressHttpClient.d.ts +106 -0
- package/dist/esm/EgressHttpClient.d.ts.map +1 -0
- package/dist/esm/EgressHttpClient.js +259 -0
- package/dist/esm/EgressHttpClient.js.map +1 -0
- package/dist/esm/HostLiveness.d.ts +81 -0
- package/dist/esm/HostLiveness.d.ts.map +1 -0
- package/dist/esm/HostLiveness.js +68 -0
- package/dist/esm/HostLiveness.js.map +1 -0
- package/dist/esm/NodeHost.d.ts +145 -0
- package/dist/esm/NodeHost.d.ts.map +1 -0
- package/dist/esm/NodeHost.js +162 -0
- package/dist/esm/NodeHost.js.map +1 -0
- package/dist/esm/ProcessConfinement.d.ts +61 -0
- package/dist/esm/ProcessConfinement.d.ts.map +1 -0
- package/dist/esm/ProcessConfinement.js +311 -0
- package/dist/esm/ProcessConfinement.js.map +1 -0
- package/dist/esm/ProcessReaper.d.ts +457 -0
- package/dist/esm/ProcessReaper.d.ts.map +1 -0
- package/dist/esm/ProcessReaper.js +711 -0
- package/dist/esm/ProcessReaper.js.map +1 -0
- package/dist/esm/ProcessSandbox.d.ts +377 -0
- package/dist/esm/ProcessSandbox.d.ts.map +1 -0
- package/dist/esm/ProcessSandbox.js +1014 -0
- package/dist/esm/ProcessSandbox.js.map +1 -0
- package/dist/esm/ScopedProcess.d.ts +65 -0
- package/dist/esm/ScopedProcess.d.ts.map +1 -0
- package/dist/esm/ScopedProcess.js +66 -0
- package/dist/esm/ScopedProcess.js.map +1 -0
- package/dist/esm/index.d.ts +38 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +38 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/AtomicFileSystemExecutable.d.ts +61 -0
- package/dist/esm/internal/AtomicFileSystemExecutable.d.ts.map +1 -0
- package/dist/esm/internal/AtomicFileSystemExecutable.js +350 -0
- package/dist/esm/internal/AtomicFileSystemExecutable.js.map +1 -0
- package/dist/esm/internal/AtomicFileSystemProtocol.d.ts +78 -0
- package/dist/esm/internal/AtomicFileSystemProtocol.d.ts.map +1 -0
- package/dist/esm/internal/AtomicFileSystemProtocol.js +412 -0
- package/dist/esm/internal/AtomicFileSystemProtocol.js.map +1 -0
- package/dist/esm/internal/AtomicFileSystemTransport.d.ts +44 -0
- package/dist/esm/internal/AtomicFileSystemTransport.d.ts.map +1 -0
- package/dist/esm/internal/AtomicFileSystemTransport.js +242 -0
- package/dist/esm/internal/AtomicFileSystemTransport.js.map +1 -0
- package/dist/esm/internal/AtomicHelperError.d.ts +35 -0
- package/dist/esm/internal/AtomicHelperError.d.ts.map +1 -0
- package/dist/esm/internal/AtomicHelperError.js +39 -0
- package/dist/esm/internal/AtomicHelperError.js.map +1 -0
- package/dist/esm/internal/AtomicHelperFault.d.ts +59 -0
- package/dist/esm/internal/AtomicHelperFault.d.ts.map +1 -0
- package/dist/esm/internal/AtomicHelperFault.js +66 -0
- package/dist/esm/internal/AtomicHelperFault.js.map +1 -0
- package/dist/esm/internal/PipedProcess.d.ts +35 -0
- package/dist/esm/internal/PipedProcess.d.ts.map +1 -0
- package/dist/esm/internal/PipedProcess.js +321 -0
- package/dist/esm/internal/PipedProcess.js.map +1 -0
- package/dist/esm/internal/ProcSnapshot.d.ts +85 -0
- package/dist/esm/internal/ProcSnapshot.d.ts.map +1 -0
- package/dist/esm/internal/ProcSnapshot.js +188 -0
- package/dist/esm/internal/ProcSnapshot.js.map +1 -0
- package/dist/esm/internal/ProcessCleanup.d.ts +64 -0
- package/dist/esm/internal/ProcessCleanup.d.ts.map +1 -0
- package/dist/esm/internal/ProcessCleanup.js +45 -0
- package/dist/esm/internal/ProcessCleanup.js.map +1 -0
- package/dist/esm/internal/ProcessCleanupPolicyError.d.ts +30 -0
- package/dist/esm/internal/ProcessCleanupPolicyError.d.ts.map +1 -0
- package/dist/esm/internal/ProcessCleanupPolicyError.js +25 -0
- package/dist/esm/internal/ProcessCleanupPolicyError.js.map +1 -0
- package/dist/esm/internal/ProcessFault.d.ts +63 -0
- package/dist/esm/internal/ProcessFault.d.ts.map +1 -0
- package/dist/esm/internal/ProcessFault.js +64 -0
- package/dist/esm/internal/ProcessFault.js.map +1 -0
- package/dist/esm/internal/ProcessSupervisor.d.ts +141 -0
- package/dist/esm/internal/ProcessSupervisor.d.ts.map +1 -0
- package/dist/esm/internal/ProcessSupervisor.js +682 -0
- package/dist/esm/internal/ProcessSupervisor.js.map +1 -0
- package/dist/esm/internal/SupervisorProgram.d.ts +9 -0
- package/dist/esm/internal/SupervisorProgram.d.ts.map +1 -0
- package/dist/esm/internal/SupervisorProgram.js +290 -0
- package/dist/esm/internal/SupervisorProgram.js.map +1 -0
- package/dist/esm/internal/WindowsProcessJob.d.ts +39 -0
- package/dist/esm/internal/WindowsProcessJob.d.ts.map +1 -0
- package/dist/esm/internal/WindowsProcessJob.js +115 -0
- package/dist/esm/internal/WindowsProcessJob.js.map +1 -0
- package/dist/vendor/adapters.json +1757 -0
- package/dist/vendor/chunk-2Y7WC4KU.js +109 -0
- package/dist/vendor/chunk-3GR5VZ2M.js +118 -0
- package/dist/vendor/chunk-42QKY6T6.js +40 -0
- package/dist/vendor/chunk-54RLBMTZ.js +61 -0
- package/dist/vendor/chunk-5ZMHBXIK.js +55 -0
- package/dist/vendor/chunk-6ME2W7TF.js +28 -0
- package/dist/vendor/chunk-AMQKOQNT.js +34 -0
- package/dist/vendor/chunk-B3FZ67QU.js +59 -0
- package/dist/vendor/chunk-BKTBUBQY.js +437 -0
- package/dist/vendor/chunk-DS7GF46S.js +34 -0
- package/dist/vendor/chunk-DVOAHXPG.js +104 -0
- package/dist/vendor/chunk-DWSHTSVX.js +229 -0
- package/dist/vendor/chunk-EGBNVEEW.js +14 -0
- package/dist/vendor/chunk-EZWY45HP.js +18 -0
- package/dist/vendor/chunk-FNZOJHSV.js +71 -0
- package/dist/vendor/chunk-GXCHI7BM.js +131 -0
- package/dist/vendor/chunk-IIJ52ZU6.js +20 -0
- package/dist/vendor/chunk-J7A4CZDO.js +92 -0
- package/dist/vendor/chunk-JG5TTWPT.js +85 -0
- package/dist/vendor/chunk-JJ24ARBQ.js +394 -0
- package/dist/vendor/chunk-KOZMM5PZ.js +426 -0
- package/dist/vendor/chunk-KUUXSID7.js +18 -0
- package/dist/vendor/chunk-LEUPYT3Q.js +36 -0
- package/dist/vendor/chunk-M32LDTW7.js +18 -0
- package/dist/vendor/chunk-M7CLUILA.js +0 -0
- package/dist/vendor/chunk-MBSKBQ5D.js +21 -0
- package/dist/vendor/chunk-MLKGABMK.js +9 -0
- package/dist/vendor/chunk-NBVRTDTV.js +129 -0
- package/dist/vendor/chunk-OXNGN5H7.js +81 -0
- package/dist/vendor/chunk-QPLDT6A6.js +564 -0
- package/dist/vendor/chunk-QYBKAIA6.js +18 -0
- package/dist/vendor/chunk-RO2R4MJH.js +62 -0
- package/dist/vendor/chunk-SIR62W3Y.js +398 -0
- package/dist/vendor/chunk-TFIKFFSC.js +26 -0
- package/dist/vendor/chunk-TXKLEBBL.js +143 -0
- package/dist/vendor/chunk-UFH5UUZK.js +48 -0
- package/dist/vendor/chunk-VANKHF46.js +96 -0
- package/dist/vendor/chunk-VZBDV3TV.js +18 -0
- package/dist/vendor/chunk-XDKNKFBW.js +22 -0
- package/dist/vendor/chunk-XH4U3JSV.js +249 -0
- package/dist/vendor/chunk-Y35ZAO5U.js +53 -0
- package/dist/vendor/chunk-ZJMRMY57.js +0 -0
- package/dist/vendor/cjs/node/NodeChildProcessSpawner.d.ts +7 -0
- package/dist/vendor/cjs/node/NodeChildProcessSpawner.js +1 -0
- package/dist/vendor/cjs/node/NodeClusterHttp.d.ts +63 -0
- package/dist/vendor/cjs/node/NodeClusterHttp.js +1 -0
- package/dist/vendor/cjs/node/NodeClusterSocket.d.ts +79 -0
- package/dist/vendor/cjs/node/NodeClusterSocket.js +1 -0
- package/dist/vendor/cjs/node/NodeCrypto.d.ts +10 -0
- package/dist/vendor/cjs/node/NodeCrypto.js +1 -0
- package/dist/vendor/cjs/node/NodeFileSystem.d.ts +10 -0
- package/dist/vendor/cjs/node/NodeFileSystem.js +1 -0
- package/dist/vendor/cjs/node/NodeHttpClient.d.ts +179 -0
- package/dist/vendor/cjs/node/NodeHttpClient.js +1 -0
- package/dist/vendor/cjs/node/NodeHttpIncomingMessage.d.ts +62 -0
- package/dist/vendor/cjs/node/NodeHttpIncomingMessage.js +1 -0
- package/dist/vendor/cjs/node/NodeHttpPlatform.d.ts +36 -0
- package/dist/vendor/cjs/node/NodeHttpPlatform.js +1 -0
- package/dist/vendor/cjs/node/NodeHttpServer.d.ts +120 -0
- package/dist/vendor/cjs/node/NodeHttpServer.js +1 -0
- package/dist/vendor/cjs/node/NodeHttpServerRequest.d.ts +29 -0
- package/dist/vendor/cjs/node/NodeHttpServerRequest.js +1 -0
- package/dist/vendor/cjs/node/NodeMultipart.d.ts +46 -0
- package/dist/vendor/cjs/node/NodeMultipart.js +1 -0
- package/dist/vendor/cjs/node/NodeMultipartParser.d.ts +97 -0
- package/dist/vendor/cjs/node/NodeMultipartParser.js +1 -0
- package/dist/vendor/cjs/node/NodePath.d.ts +27 -0
- package/dist/vendor/cjs/node/NodePath.js +1 -0
- package/dist/vendor/cjs/node/NodeRedis.d.ts +74 -0
- package/dist/vendor/cjs/node/NodeRedis.js +1 -0
- package/dist/vendor/cjs/node/NodeRuntime.d.ts +85 -0
- package/dist/vendor/cjs/node/NodeRuntime.js +1 -0
- package/dist/vendor/cjs/node/NodeServices.d.ts +34 -0
- package/dist/vendor/cjs/node/NodeServices.js +1 -0
- package/dist/vendor/cjs/node/NodeSink.d.ts +8 -0
- package/dist/vendor/cjs/node/NodeSink.js +1 -0
- package/dist/vendor/cjs/node/NodeSocket.d.ts +38 -0
- package/dist/vendor/cjs/node/NodeSocket.js +1 -0
- package/dist/vendor/cjs/node/NodeSocketServer.d.ts +8 -0
- package/dist/vendor/cjs/node/NodeSocketServer.js +1 -0
- package/dist/vendor/cjs/node/NodeStdio.d.ts +11 -0
- package/dist/vendor/cjs/node/NodeStdio.js +1 -0
- package/dist/vendor/cjs/node/NodeStream.d.ts +8 -0
- package/dist/vendor/cjs/node/NodeStream.js +1 -0
- package/dist/vendor/cjs/node/NodeTerminal.d.ts +21 -0
- package/dist/vendor/cjs/node/NodeTerminal.js +1 -0
- package/dist/vendor/cjs/node/NodeWorker.d.ts +22 -0
- package/dist/vendor/cjs/node/NodeWorker.js +1 -0
- package/dist/vendor/cjs/node/NodeWorkerRunner.d.ts +12 -0
- package/dist/vendor/cjs/node/NodeWorkerRunner.js +1 -0
- package/dist/vendor/cjs/node/Undici.d.ts +28 -0
- package/dist/vendor/cjs/node/Undici.js +1 -0
- package/dist/vendor/cjs/node/index.d.ts +100 -0
- package/dist/vendor/cjs/node/index.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.d.ts +57 -0
- package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeClusterSocket.d.ts +22 -0
- package/dist/vendor/cjs/node-shared/NodeClusterSocket.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeCrypto.d.ts +27 -0
- package/dist/vendor/cjs/node-shared/NodeCrypto.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeFileSystem.d.ts +11 -0
- package/dist/vendor/cjs/node-shared/NodeFileSystem.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeHttpCompression.d.ts +36 -0
- package/dist/vendor/cjs/node-shared/NodeHttpCompression.js +1 -0
- package/dist/vendor/cjs/node-shared/NodePath.d.ts +27 -0
- package/dist/vendor/cjs/node-shared/NodePath.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeRuntime.d.ts +47 -0
- package/dist/vendor/cjs/node-shared/NodeRuntime.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeSink.d.ts +69 -0
- package/dist/vendor/cjs/node-shared/NodeSink.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeSocket.d.ts +134 -0
- package/dist/vendor/cjs/node-shared/NodeSocket.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeSocketServer.d.ts +80 -0
- package/dist/vendor/cjs/node-shared/NodeSocketServer.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeStdio.d.ts +12 -0
- package/dist/vendor/cjs/node-shared/NodeStdio.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeStream.d.ts +179 -0
- package/dist/vendor/cjs/node-shared/NodeStream.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeTerminal.d.ts +22 -0
- package/dist/vendor/cjs/node-shared/NodeTerminal.js +1 -0
- package/dist/vendor/cjs/node-shared/index.d.ts +56 -0
- package/dist/vendor/cjs/node-shared/index.js +1 -0
- package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.d.ts +4 -0
- package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.js +1 -0
- package/dist/vendor/cjs/node-shared/internal/utils.d.ts +2 -0
- package/dist/vendor/cjs/node-shared/internal/utils.js +1 -0
- package/dist/vendor/cjs/package.json +1 -0
- package/dist/vendor/cjs/platform-node-shared.d.ts +56 -0
- package/dist/vendor/cjs/platform-node-shared.js +1 -0
- package/dist/vendor/cjs/platform-node.d.ts +100 -0
- package/dist/vendor/cjs/platform-node.js +1 -0
- package/dist/vendor/node/LICENSE +21 -0
- package/dist/vendor/node/NodeChildProcessSpawner.d.ts +7 -0
- package/dist/vendor/node/NodeChildProcessSpawner.js +14 -0
- package/dist/vendor/node/NodeClusterHttp.d.ts +63 -0
- package/dist/vendor/node/NodeClusterHttp.js +43 -0
- package/dist/vendor/node/NodeClusterSocket.d.ts +79 -0
- package/dist/vendor/node/NodeClusterSocket.js +30 -0
- package/dist/vendor/node/NodeCrypto.d.ts +10 -0
- package/dist/vendor/node/NodeCrypto.js +8 -0
- package/dist/vendor/node/NodeFileSystem.d.ts +10 -0
- package/dist/vendor/node/NodeFileSystem.js +9 -0
- package/dist/vendor/node/NodeHttpClient.d.ts +179 -0
- package/dist/vendor/node/NodeHttpClient.js +46 -0
- package/dist/vendor/node/NodeHttpIncomingMessage.d.ts +62 -0
- package/dist/vendor/node/NodeHttpIncomingMessage.js +10 -0
- package/dist/vendor/node/NodeHttpPlatform.d.ts +36 -0
- package/dist/vendor/node/NodeHttpPlatform.js +16 -0
- package/dist/vendor/node/NodeHttpServer.d.ts +120 -0
- package/dist/vendor/node/NodeHttpServer.js +46 -0
- package/dist/vendor/node/NodeHttpServerRequest.d.ts +29 -0
- package/dist/vendor/node/NodeHttpServerRequest.js +9 -0
- package/dist/vendor/node/NodeMultipart.d.ts +46 -0
- package/dist/vendor/node/NodeMultipart.js +15 -0
- package/dist/vendor/node/NodeMultipartParser.d.ts +97 -0
- package/dist/vendor/node/NodeMultipartParser.js +11 -0
- package/dist/vendor/node/NodePath.d.ts +27 -0
- package/dist/vendor/node/NodePath.js +12 -0
- package/dist/vendor/node/NodeRedis.d.ts +74 -0
- package/dist/vendor/node/NodeRedis.js +11 -0
- package/dist/vendor/node/NodeRuntime.d.ts +85 -0
- package/dist/vendor/node/NodeRuntime.js +8 -0
- package/dist/vendor/node/NodeServices.d.ts +34 -0
- package/dist/vendor/node/NodeServices.js +23 -0
- package/dist/vendor/node/NodeSink.d.ts +8 -0
- package/dist/vendor/node/NodeSink.js +12 -0
- package/dist/vendor/node/NodeSocket.d.ts +38 -0
- package/dist/vendor/node/NodeSocket.js +31 -0
- package/dist/vendor/node/NodeSocketServer.d.ts +8 -0
- package/dist/vendor/node/NodeSocketServer.js +21 -0
- package/dist/vendor/node/NodeStdio.d.ts +11 -0
- package/dist/vendor/node/NodeStdio.js +10 -0
- package/dist/vendor/node/NodeStream.d.ts +8 -0
- package/dist/vendor/node/NodeStream.js +27 -0
- package/dist/vendor/node/NodeTerminal.d.ts +21 -0
- package/dist/vendor/node/NodeTerminal.js +10 -0
- package/dist/vendor/node/NodeWorker.d.ts +22 -0
- package/dist/vendor/node/NodeWorker.js +9 -0
- package/dist/vendor/node/NodeWorkerRunner.d.ts +12 -0
- package/dist/vendor/node/NodeWorkerRunner.js +7 -0
- package/dist/vendor/node/Undici.d.ts +28 -0
- package/dist/vendor/node/Undici.js +9 -0
- package/dist/vendor/node/index.d.ts +100 -0
- package/dist/vendor/node/index.js +115 -0
- package/dist/vendor/node-shared/LICENSE +21 -0
- package/dist/vendor/node-shared/NodeChildProcessSpawner.d.ts +57 -0
- package/dist/vendor/node-shared/NodeChildProcessSpawner.js +13 -0
- package/dist/vendor/node-shared/NodeClusterSocket.d.ts +22 -0
- package/dist/vendor/node-shared/NodeClusterSocket.js +11 -0
- package/dist/vendor/node-shared/NodeCrypto.d.ts +27 -0
- package/dist/vendor/node-shared/NodeCrypto.js +9 -0
- package/dist/vendor/node-shared/NodeFileSystem.d.ts +11 -0
- package/dist/vendor/node-shared/NodeFileSystem.js +8 -0
- package/dist/vendor/node-shared/NodeHttpCompression.d.ts +36 -0
- package/dist/vendor/node-shared/NodeHttpCompression.js +13 -0
- package/dist/vendor/node-shared/NodePath.d.ts +27 -0
- package/dist/vendor/node-shared/NodePath.js +11 -0
- package/dist/vendor/node-shared/NodeRuntime.d.ts +47 -0
- package/dist/vendor/node-shared/NodeRuntime.js +7 -0
- package/dist/vendor/node-shared/NodeSink.d.ts +69 -0
- package/dist/vendor/node-shared/NodeSink.js +11 -0
- package/dist/vendor/node-shared/NodeSocket.d.ts +134 -0
- package/dist/vendor/node-shared/NodeSocket.js +23 -0
- package/dist/vendor/node-shared/NodeSocketServer.d.ts +80 -0
- package/dist/vendor/node-shared/NodeSocketServer.js +20 -0
- package/dist/vendor/node-shared/NodeStdio.d.ts +12 -0
- package/dist/vendor/node-shared/NodeStdio.js +9 -0
- package/dist/vendor/node-shared/NodeStream.d.ts +179 -0
- package/dist/vendor/node-shared/NodeStream.js +26 -0
- package/dist/vendor/node-shared/NodeTerminal.d.ts +22 -0
- package/dist/vendor/node-shared/NodeTerminal.js +9 -0
- package/dist/vendor/node-shared/index.d.ts +56 -0
- package/dist/vendor/node-shared/index.js +58 -0
- package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.d.ts +4 -0
- package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.js +7 -0
- package/dist/vendor/node-shared/internal/utils.d.ts +2 -0
- package/dist/vendor/node-shared/internal/utils.js +7 -0
- package/dist/vendor/platform-node-shared.d.ts +56 -0
- package/dist/vendor/platform-node-shared.js +58 -0
- package/dist/vendor/platform-node.d.ts +100 -0
- package/dist/vendor/platform-node.js +115 -0
- package/docs/README.md +129 -0
- package/docs/api.md +552 -0
- package/docs/concepts/descriptor-relative-filesystem.md +181 -0
- package/docs/concepts/host-bundle.md +125 -0
- package/docs/concepts/process-containment.md +182 -0
- package/docs/guides/answer-run-ownership.md +87 -0
- package/docs/guides/configure-the-filesystem-helper.md +152 -0
- package/docs/guides/contain-child-processes.md +139 -0
- package/docs/guides/match-files-with-glob.md +151 -0
- package/docs/installation.md +204 -0
- package/docs/quickstart.md +147 -0
- package/docs/troubleshooting.md +130 -0
- package/package.json +202 -3
- package/src/AtomicFileSystem.ts +415 -0
- package/src/EgressHttpClient.ts +327 -0
- package/src/HostLiveness.ts +103 -0
- package/src/NodeHost.ts +253 -0
- package/src/ProcessConfinement.ts +356 -0
- package/src/ProcessReaper.ts +951 -0
- package/src/ProcessSandbox.ts +1273 -0
- package/src/ScopedProcess.ts +123 -0
- package/src/index.ts +44 -0
- package/src/internal/AtomicFileSystemExecutable.ts +379 -0
- package/src/internal/AtomicFileSystemProtocol.ts +502 -0
- package/src/internal/AtomicFileSystemTransport.ts +272 -0
- package/src/internal/AtomicHelperError.ts +50 -0
- package/src/internal/AtomicHelperFault.ts +84 -0
- package/src/internal/PipedProcess.ts +357 -0
- package/src/internal/ProcSnapshot.ts +193 -0
- package/src/internal/ProcessCleanup.ts +99 -0
- package/src/internal/ProcessCleanupPolicyError.ts +30 -0
- package/src/internal/ProcessFault.ts +82 -0
- package/src/internal/ProcessSupervisor.ts +801 -0
- package/src/internal/SupervisorProgram.ts +289 -0
- package/src/internal/WindowsProcessJob.ts +114 -0
|
@@ -0,0 +1,682 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var ProcessSupervisor_exports = {};
|
|
30
|
+
__export(ProcessSupervisor_exports, {
|
|
31
|
+
Control: () => Control,
|
|
32
|
+
bootstrapArguments: () => bootstrapArguments,
|
|
33
|
+
connectOwner: () => connectOwner,
|
|
34
|
+
failure: () => failure,
|
|
35
|
+
prepare: () => prepare,
|
|
36
|
+
targetPidOf: () => targetPidOf,
|
|
37
|
+
unverifiedCleanup: () => unverifiedCleanup
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(ProcessSupervisor_exports);
|
|
40
|
+
var Channel = __toESM(require("effect/Channel"), 1);
|
|
41
|
+
var Clock = __toESM(require("effect/Clock"), 1);
|
|
42
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
43
|
+
var PlatformError = __toESM(require("effect/PlatformError"), 1);
|
|
44
|
+
var Sink = __toESM(require("effect/Sink"), 1);
|
|
45
|
+
var Stream = __toESM(require("effect/Stream"), 1);
|
|
46
|
+
var ChildProcess = __toESM(require("effect/unstable/process/ChildProcess"), 1);
|
|
47
|
+
var import_ChildProcessSpawner = require("effect/unstable/process/ChildProcessSpawner");
|
|
48
|
+
var import_node_crypto = require("node:crypto");
|
|
49
|
+
var import_node_fs = require("node:fs");
|
|
50
|
+
var import_node_net = require("node:net");
|
|
51
|
+
var import_node_os = require("node:os");
|
|
52
|
+
var import_node_path = require("node:path");
|
|
53
|
+
var Tls = __toESM(require("node:tls"), 1);
|
|
54
|
+
var import_PipedProcess = require("./PipedProcess.js");
|
|
55
|
+
var import_ProcessFault = require("./ProcessFault.js");
|
|
56
|
+
var import_SupervisorProgram = require("./SupervisorProgram.js");
|
|
57
|
+
var import_WindowsProcessJob = require("./WindowsProcessJob.js");
|
|
58
|
+
const startupMs = 5e3;
|
|
59
|
+
const deliveryMs = 500;
|
|
60
|
+
const exitAllowanceMs = 2500;
|
|
61
|
+
const verificationMs = 2500;
|
|
62
|
+
const targets = /* @__PURE__ */ new WeakMap();
|
|
63
|
+
const processClock = Clock.Clock.defaultValue();
|
|
64
|
+
const targetPidOf = (handle) => targets.get(handle)?.targetPid;
|
|
65
|
+
const nativeError = (cause) => {
|
|
66
|
+
if (cause instanceof Error) return cause;
|
|
67
|
+
const value = cause ?? {};
|
|
68
|
+
const text = (field) => typeof value[field] === "string" ? value[field] : void 0;
|
|
69
|
+
return new import_ProcessFault.NativeProcessError({
|
|
70
|
+
message: text("message") ?? "The process supervisor failed",
|
|
71
|
+
code: text("code"),
|
|
72
|
+
errno: typeof value.errno === "number" ? value.errno : void 0,
|
|
73
|
+
reason: text("reason"),
|
|
74
|
+
syscall: text("syscall"),
|
|
75
|
+
path: text("path"),
|
|
76
|
+
signal: text("signal")
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const failure = (method, command, cause) => {
|
|
80
|
+
const error = nativeError(cause);
|
|
81
|
+
const tags = {
|
|
82
|
+
ENOENT: "NotFound",
|
|
83
|
+
EACCES: "PermissionDenied",
|
|
84
|
+
EEXIST: "AlreadyExists",
|
|
85
|
+
EISDIR: "BadResource",
|
|
86
|
+
ENOTDIR: "BadResource",
|
|
87
|
+
ELOOP: "BadResource",
|
|
88
|
+
EBUSY: "Busy"
|
|
89
|
+
};
|
|
90
|
+
return PlatformError.systemError({
|
|
91
|
+
_tag: tags[error.code ?? ""] ?? "Unknown",
|
|
92
|
+
module: "ChildProcess",
|
|
93
|
+
method,
|
|
94
|
+
pathOrDescriptor: command,
|
|
95
|
+
syscall: error.syscall,
|
|
96
|
+
description: error.message,
|
|
97
|
+
cause: error
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const unverifiedCleanup = (control, cleanupRequired, vacant, observed) => [
|
|
101
|
+
`target exited: ${control.targetDone}`,
|
|
102
|
+
`cleanup receipt: ${control.cleanupFailed ? "failed" : !cleanupRequired ? "not required" : control.cleanupAcknowledged ? "acknowledged" : "missing"}`,
|
|
103
|
+
`group vacant: ${vacant}`,
|
|
104
|
+
observed === void 0 ? "group snapshot: unavailable" : `group members: ${observed.members.length === 0 ? "none" : observed.members.map((member) => `${member.pid} ${member.zombie ? "zombie" : "live"}`).join(", ")}; host group ${observed.ownGroup}`,
|
|
105
|
+
...control.fault === void 0 ? [] : [`fault: ${String(control.fault?.message ?? control.fault)}`]
|
|
106
|
+
].join("; ");
|
|
107
|
+
const promise = () => {
|
|
108
|
+
let resolve2;
|
|
109
|
+
let reject;
|
|
110
|
+
const promise2 = new Promise((yes, no) => {
|
|
111
|
+
resolve2 = yes;
|
|
112
|
+
reject = no;
|
|
113
|
+
});
|
|
114
|
+
void promise2.catch(() => {
|
|
115
|
+
});
|
|
116
|
+
return { promise: promise2, resolve: resolve2, reject };
|
|
117
|
+
};
|
|
118
|
+
const wait = (value, method, command) => Effect.tryPromise({ try: () => value, catch: (cause) => failure(method, command, cause) });
|
|
119
|
+
const bounded = (effect, millis, method, command) => effect.pipe(
|
|
120
|
+
Effect.timeoutOrElse({
|
|
121
|
+
duration: millis,
|
|
122
|
+
orElse: () => Effect.fail(
|
|
123
|
+
failure(method, command, (0, import_ProcessFault.processFault)("supervisor_timeout", `Process supervisor ${method} timed out`))
|
|
124
|
+
)
|
|
125
|
+
}),
|
|
126
|
+
Effect.provideService(Clock.Clock, processClock)
|
|
127
|
+
);
|
|
128
|
+
const bootstrapArguments = (runtime) => runtime.sea || runtime.main.startsWith("/$bunfs/") ? Effect.fail(
|
|
129
|
+
failure(
|
|
130
|
+
"spawn",
|
|
131
|
+
process.execPath,
|
|
132
|
+
(0, import_ProcessFault.processFault)(
|
|
133
|
+
"runtime_unsupported",
|
|
134
|
+
"Process supervision requires a Node or Bun runtime executable, not a compiled application"
|
|
135
|
+
)
|
|
136
|
+
)
|
|
137
|
+
) : Effect.succeed(runtime.bun ? ["--no-env-file", "--config=/dev/null"] : []);
|
|
138
|
+
const channelEnvironment = "SMITHERS_PROCESS_CHANNEL";
|
|
139
|
+
const tlsOptions = { minVersion: "TLSv1.3", maxVersion: "TLSv1.3", ciphers: "TLS_AES_128_GCM_SHA256" };
|
|
140
|
+
const connectOwner = (path, environment) => {
|
|
141
|
+
const encoded = environment[channelEnvironment];
|
|
142
|
+
if (encoded === void 0) return (0, import_node_net.createConnection)(path);
|
|
143
|
+
const channel = JSON.parse(encoded);
|
|
144
|
+
return Tls.connect({
|
|
145
|
+
...tlsOptions,
|
|
146
|
+
host: "127.0.0.1",
|
|
147
|
+
port: path.endsWith("/r") ? channel.requests : channel.status,
|
|
148
|
+
pskCallback: () => ({ identity: "smithers-owner", psk: Buffer.from(channel.key, "hex") })
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
class Control {
|
|
152
|
+
ready = promise();
|
|
153
|
+
started = promise();
|
|
154
|
+
exited = promise();
|
|
155
|
+
lost = promise();
|
|
156
|
+
ended = promise();
|
|
157
|
+
requestsReady = promise();
|
|
158
|
+
directory;
|
|
159
|
+
path;
|
|
160
|
+
requestPath;
|
|
161
|
+
server;
|
|
162
|
+
requestServer;
|
|
163
|
+
listening;
|
|
164
|
+
key;
|
|
165
|
+
connections = /* @__PURE__ */ new Set();
|
|
166
|
+
socket;
|
|
167
|
+
requestSocket;
|
|
168
|
+
targetDone = false;
|
|
169
|
+
ownerCreation;
|
|
170
|
+
targetPid;
|
|
171
|
+
ownerDone = false;
|
|
172
|
+
spawnFailed = false;
|
|
173
|
+
cleanupFailed = false;
|
|
174
|
+
cleanupAcknowledged = false;
|
|
175
|
+
activationSent = false;
|
|
176
|
+
closeSent = false;
|
|
177
|
+
fault;
|
|
178
|
+
onTargetExit = () => {
|
|
179
|
+
};
|
|
180
|
+
onCleanup = () => {
|
|
181
|
+
};
|
|
182
|
+
receivedReady = false;
|
|
183
|
+
receivedStarted = false;
|
|
184
|
+
withdrawn = false;
|
|
185
|
+
constructor(transport = "native") {
|
|
186
|
+
this.key = transport === "tls" || process.platform === "win32" ? (0, import_node_crypto.randomBytes)(32) : void 0;
|
|
187
|
+
this.directory = (0, import_node_fs.mkdtempSync)(this.key === void 0 ? "/tmp/sm-p-" : (0, import_node_path.join)((0, import_node_os.tmpdir)(), "sm-p-"));
|
|
188
|
+
this.path = `${this.directory}/s`;
|
|
189
|
+
this.requestPath = `${this.directory}/r`;
|
|
190
|
+
const servers = [];
|
|
191
|
+
try {
|
|
192
|
+
(0, import_node_fs.chmodSync)(this.directory, 448);
|
|
193
|
+
this.server = this.makeServer((socket) => this.accept(socket));
|
|
194
|
+
servers.push(this.server);
|
|
195
|
+
this.requestServer = this.makeServer((socket) => this.acceptRequests(socket));
|
|
196
|
+
servers.push(this.requestServer);
|
|
197
|
+
this.listening = Promise.all([
|
|
198
|
+
new Promise((resolve2, reject) => {
|
|
199
|
+
this.server.once("error", reject);
|
|
200
|
+
if (this.key === void 0) this.server.listen(this.path, resolve2);
|
|
201
|
+
else this.server.listen(0, "127.0.0.1", resolve2);
|
|
202
|
+
}),
|
|
203
|
+
new Promise((resolve2, reject) => {
|
|
204
|
+
this.requestServer.once("error", reject);
|
|
205
|
+
if (this.key === void 0) this.requestServer.listen(this.requestPath, resolve2);
|
|
206
|
+
else this.requestServer.listen(0, "127.0.0.1", resolve2);
|
|
207
|
+
})
|
|
208
|
+
]).then(() => {
|
|
209
|
+
});
|
|
210
|
+
} catch (cause) {
|
|
211
|
+
for (const server of servers) server.close();
|
|
212
|
+
(0, import_node_fs.rmSync)(this.directory, { recursive: true, force: true });
|
|
213
|
+
throw cause;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
makeServer(accept) {
|
|
217
|
+
if (this.key === void 0) return (0, import_node_net.createServer)(accept);
|
|
218
|
+
const server = Tls.createServer({
|
|
219
|
+
...tlsOptions,
|
|
220
|
+
handshakeTimeout: startupMs,
|
|
221
|
+
pskCallback: (_socket, identity) => identity === "smithers-owner" ? this.key : null
|
|
222
|
+
}, accept);
|
|
223
|
+
server.on("connection", (socket) => {
|
|
224
|
+
this.connections.add(socket);
|
|
225
|
+
socket.once("close", () => this.connections.delete(socket));
|
|
226
|
+
});
|
|
227
|
+
server.on("tlsClientError", (_error, socket) => socket.destroy());
|
|
228
|
+
return server;
|
|
229
|
+
}
|
|
230
|
+
/** Only the trusted owner receives this environment; target configuration replaces it. */
|
|
231
|
+
environment() {
|
|
232
|
+
if (this.key === void 0) return {};
|
|
233
|
+
const status = this.server.address();
|
|
234
|
+
const requests = this.requestServer.address();
|
|
235
|
+
return {
|
|
236
|
+
[channelEnvironment]: JSON.stringify({
|
|
237
|
+
key: this.key.toString("hex"),
|
|
238
|
+
status: status.port,
|
|
239
|
+
requests: requests.port
|
|
240
|
+
})
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/** The test peer uses the same authenticated transport as the isolated owner. */
|
|
244
|
+
connect(requests = false) {
|
|
245
|
+
return connectOwner(requests ? this.requestPath : this.path, this.environment());
|
|
246
|
+
}
|
|
247
|
+
/** Validate the stored READY after the raw spawn effect has returned its pid. */
|
|
248
|
+
withdraw(pid, actual) {
|
|
249
|
+
if (pid !== actual) throw (0, import_ProcessFault.processFault)("identity_mismatch", "Wrong supervisor identity");
|
|
250
|
+
this.server.close();
|
|
251
|
+
this.server.unref();
|
|
252
|
+
this.requestServer.close();
|
|
253
|
+
this.requestServer.unref();
|
|
254
|
+
(0, import_node_fs.rmSync)(this.path, { force: true });
|
|
255
|
+
(0, import_node_fs.rmSync)(this.requestPath, { force: true });
|
|
256
|
+
(0, import_node_fs.rmdirSync)(this.directory);
|
|
257
|
+
this.withdrawn = true;
|
|
258
|
+
}
|
|
259
|
+
/** Request EOF asks for cleanup; leave its independent status reader intact. */
|
|
260
|
+
disconnect() {
|
|
261
|
+
this.requestSocket?.destroy();
|
|
262
|
+
}
|
|
263
|
+
dispose() {
|
|
264
|
+
for (const socket of this.connections) socket.destroy();
|
|
265
|
+
this.disconnect();
|
|
266
|
+
this.socket?.destroy();
|
|
267
|
+
this.server.close();
|
|
268
|
+
this.requestServer.close();
|
|
269
|
+
if (!this.withdrawn) (0, import_node_fs.rmSync)(this.directory, { recursive: true, force: true });
|
|
270
|
+
}
|
|
271
|
+
rawEnded() {
|
|
272
|
+
this.ownerDone = true;
|
|
273
|
+
if (this.socket === void 0) this.closed();
|
|
274
|
+
}
|
|
275
|
+
write(message) {
|
|
276
|
+
return new Promise((resolve2, reject) => {
|
|
277
|
+
const socket = this.requestSocket;
|
|
278
|
+
if (socket === void 0 || socket.destroyed || !socket.writable) {
|
|
279
|
+
reject((0, import_ProcessFault.processFault)("control_channel_closed", "Private process control channel closed"));
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const data = `${JSON.stringify(message)}
|
|
283
|
+
`;
|
|
284
|
+
if (Buffer.byteLength(data) > 4 * 1024 * 1024) {
|
|
285
|
+
reject((0, import_ProcessFault.processFault)("configuration_too_large", "Process configuration exceeds the private frame limit"));
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
socket.write(data, (error) => error ? reject(error) : resolve2());
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
closed() {
|
|
292
|
+
this.disconnect();
|
|
293
|
+
const cause = this.fault ?? (0, import_ProcessFault.processFault)("outcome_missing", "Process supervisor closed before reporting its outcome");
|
|
294
|
+
if (this.activationSent && !this.targetDone && !this.spawnFailed) this.lost.reject(cause);
|
|
295
|
+
this.ready.reject(cause);
|
|
296
|
+
this.requestsReady.reject(cause);
|
|
297
|
+
this.started.reject(cause);
|
|
298
|
+
this.exited.reject(cause);
|
|
299
|
+
this.ended.resolve();
|
|
300
|
+
}
|
|
301
|
+
acceptRequests(socket) {
|
|
302
|
+
if (this.requestSocket !== void 0) {
|
|
303
|
+
socket.destroy();
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
this.requestSocket = socket;
|
|
307
|
+
socket.on("error", (cause) => {
|
|
308
|
+
this.fault = cause;
|
|
309
|
+
});
|
|
310
|
+
this.requestsReady.resolve();
|
|
311
|
+
}
|
|
312
|
+
accept(socket) {
|
|
313
|
+
if (this.socket !== void 0) {
|
|
314
|
+
socket.destroy();
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
this.socket = socket;
|
|
318
|
+
let buffer = "";
|
|
319
|
+
socket.setEncoding("utf8");
|
|
320
|
+
socket.on("data", (data) => {
|
|
321
|
+
try {
|
|
322
|
+
buffer += data;
|
|
323
|
+
if (Buffer.byteLength(buffer) > 16 * 1024) {
|
|
324
|
+
throw (0, import_ProcessFault.processFault)("status_too_large", "Process status frame exceeds its limit");
|
|
325
|
+
}
|
|
326
|
+
for (; ; ) {
|
|
327
|
+
const end = buffer.indexOf("\n");
|
|
328
|
+
if (end < 0) break;
|
|
329
|
+
const line = buffer.slice(0, end);
|
|
330
|
+
buffer = buffer.slice(end + 1);
|
|
331
|
+
this.receive(JSON.parse(line));
|
|
332
|
+
}
|
|
333
|
+
} catch (cause) {
|
|
334
|
+
this.fault = cause;
|
|
335
|
+
socket.destroy();
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
socket.on("error", (cause) => {
|
|
339
|
+
this.fault = cause;
|
|
340
|
+
});
|
|
341
|
+
socket.once("close", () => this.closed());
|
|
342
|
+
}
|
|
343
|
+
receive(value) {
|
|
344
|
+
if (typeof value !== "object" || value === null) throw (0, import_ProcessFault.processFault)("status_invalid", "Invalid process status");
|
|
345
|
+
const message = value;
|
|
346
|
+
switch (message.type) {
|
|
347
|
+
case "ready":
|
|
348
|
+
if (this.receivedReady || message.version !== 1 || !Number.isSafeInteger(message.pid) || Number(message.pid) <= 1) {
|
|
349
|
+
throw (0, import_ProcessFault.processFault)("status_invalid", "Invalid process readiness");
|
|
350
|
+
}
|
|
351
|
+
this.receivedReady = true;
|
|
352
|
+
this.ownerCreation = message.created;
|
|
353
|
+
this.ready.resolve(Number(message.pid));
|
|
354
|
+
return;
|
|
355
|
+
case "spawned":
|
|
356
|
+
if (!this.activationSent || this.receivedStarted || !Number.isSafeInteger(message.pid) || Number(message.pid) <= 1) {
|
|
357
|
+
throw (0, import_ProcessFault.processFault)("status_invalid", "Invalid target startup");
|
|
358
|
+
}
|
|
359
|
+
this.receivedStarted = true;
|
|
360
|
+
this.targetPid = Number(message.pid);
|
|
361
|
+
this.started.resolve();
|
|
362
|
+
return;
|
|
363
|
+
case "spawn_error":
|
|
364
|
+
if (!this.activationSent || this.receivedStarted) {
|
|
365
|
+
throw (0, import_ProcessFault.processFault)("status_invalid", "Invalid target spawn failure");
|
|
366
|
+
}
|
|
367
|
+
this.spawnFailed = true;
|
|
368
|
+
this.fault = message;
|
|
369
|
+
this.started.reject(message);
|
|
370
|
+
this.exited.reject(message);
|
|
371
|
+
return;
|
|
372
|
+
case "fault":
|
|
373
|
+
this.fault = message;
|
|
374
|
+
this.started.reject(message);
|
|
375
|
+
this.exited.reject(message);
|
|
376
|
+
return;
|
|
377
|
+
case "exit":
|
|
378
|
+
if (!this.receivedStarted || this.targetDone || !(Number.isInteger(message.code) && Number(message.code) >= 0 && message.signal === null || message.code === null && typeof message.signal === "string" && /^SIG[A-Z0-9]+$/.test(message.signal))) {
|
|
379
|
+
throw (0, import_ProcessFault.processFault)("status_invalid", "Invalid target exit status");
|
|
380
|
+
}
|
|
381
|
+
this.targetDone = true;
|
|
382
|
+
if (message.code === null) {
|
|
383
|
+
this.exited.reject({
|
|
384
|
+
message: `Process interrupted due to receipt of signal: '${message.signal}'`,
|
|
385
|
+
signal: message.signal
|
|
386
|
+
});
|
|
387
|
+
} else this.exited.resolve((0, import_ChildProcessSpawner.ExitCode)(Number(message.code)));
|
|
388
|
+
this.onTargetExit();
|
|
389
|
+
return;
|
|
390
|
+
case "cleanup_error":
|
|
391
|
+
this.cleanupFailed = true;
|
|
392
|
+
this.fault = message;
|
|
393
|
+
return;
|
|
394
|
+
case "cleanup":
|
|
395
|
+
this.cleanupAcknowledged = true;
|
|
396
|
+
this.onCleanup();
|
|
397
|
+
return;
|
|
398
|
+
default:
|
|
399
|
+
throw (0, import_ProcessFault.processFault)("status_unknown", "Unknown process status");
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
const prepare = (system, policy, transport = "native") => (command, spawn) => Effect.gen(function* () {
|
|
404
|
+
const initial = yield* policy(command.options);
|
|
405
|
+
const bun = process.versions.bun !== void 0;
|
|
406
|
+
const sea = bun ? false : (yield* Effect.tryPromise({
|
|
407
|
+
try: () => import("node:sea"),
|
|
408
|
+
catch: (cause) => failure("spawn", process.execPath, cause)
|
|
409
|
+
})).isSea();
|
|
410
|
+
const bootstrap = yield* bootstrapArguments({
|
|
411
|
+
bun,
|
|
412
|
+
sea,
|
|
413
|
+
main: globalThis.Bun?.main ?? ""
|
|
414
|
+
});
|
|
415
|
+
const windows = system.platform === "win32";
|
|
416
|
+
const grouped = !windows && (command.options.detached ?? true);
|
|
417
|
+
const jobExecutable = windows ? yield* Effect.try({
|
|
418
|
+
try: import_WindowsProcessJob.resolveJobExecutable,
|
|
419
|
+
catch: (cause) => failure("spawn", command.command, cause)
|
|
420
|
+
}) : void 0;
|
|
421
|
+
const control = yield* Effect.acquireRelease(
|
|
422
|
+
Effect.try({ try: () => new Control(transport), catch: (cause) => failure("spawn", command.command, cause) }),
|
|
423
|
+
(control2) => Effect.sync(() => control2.dispose())
|
|
424
|
+
);
|
|
425
|
+
yield* bounded(wait(control.listening, "spawn", command.command), startupMs, "spawn", command.command);
|
|
426
|
+
const raw = yield* spawn(ChildProcess.make(process.execPath, [
|
|
427
|
+
...bootstrap,
|
|
428
|
+
"-e",
|
|
429
|
+
import_SupervisorProgram.source,
|
|
430
|
+
control.path,
|
|
431
|
+
grouped ? "group" : "direct"
|
|
432
|
+
], {
|
|
433
|
+
...command.options,
|
|
434
|
+
cwd: (0, import_node_path.parse)(process.execPath).root,
|
|
435
|
+
env: {
|
|
436
|
+
PATH: "/usr/bin:/bin",
|
|
437
|
+
HOME: "/",
|
|
438
|
+
XDG_CONFIG_HOME: "/",
|
|
439
|
+
BUN_RUNTIME_TRANSPILER_CACHE_PATH: "0",
|
|
440
|
+
...control.environment(),
|
|
441
|
+
...jobExecutable === void 0 ? {} : { SMITHERS_PROCESS_JOB_HELPER: jobExecutable }
|
|
442
|
+
},
|
|
443
|
+
extendEnv: false,
|
|
444
|
+
shell: false,
|
|
445
|
+
detached: grouped,
|
|
446
|
+
killSignal: "SIGTERM",
|
|
447
|
+
forceKillAfter: initial.graceMs
|
|
448
|
+
}));
|
|
449
|
+
yield* Effect.exit(raw.exitCode).pipe(Effect.andThen(Effect.sync(() => control.rawEnded())), Effect.forkScoped);
|
|
450
|
+
let job;
|
|
451
|
+
let settled = false;
|
|
452
|
+
let referenced = true;
|
|
453
|
+
let reref = Effect.void;
|
|
454
|
+
let selected = initial;
|
|
455
|
+
let requireCleanupReceipt = false;
|
|
456
|
+
const snapshot = () => system.snapshot(raw.pid);
|
|
457
|
+
const alone = () => {
|
|
458
|
+
if (!grouped) return control.targetDone;
|
|
459
|
+
const observed = snapshot();
|
|
460
|
+
if (observed === void 0 || observed.ownGroup === raw.pid) return false;
|
|
461
|
+
const running = observed.members.filter((member) => !member.zombie);
|
|
462
|
+
return running.length === 1 && running[0].pid === raw.pid;
|
|
463
|
+
};
|
|
464
|
+
control.onTargetExit = () => {
|
|
465
|
+
if (control.closeSent) return;
|
|
466
|
+
if (!alone()) return;
|
|
467
|
+
control.closeSent = true;
|
|
468
|
+
void control.write({ type: "stop", killSignal: "SIGKILL", fast: true }).catch(() => control.disconnect());
|
|
469
|
+
};
|
|
470
|
+
const finish = yield* Effect.cached(Effect.gen(function* () {
|
|
471
|
+
yield* bounded(Effect.exit(raw.exitCode), selected.graceMs + exitAllowanceMs, "kill", command.command).pipe(
|
|
472
|
+
Effect.catch(
|
|
473
|
+
(cause) => job === void 0 ? Effect.fail(cause) : Effect.gen(function* () {
|
|
474
|
+
job.stop();
|
|
475
|
+
yield* bounded(Effect.exit(raw.exitCode), exitAllowanceMs, "kill", command.command);
|
|
476
|
+
})
|
|
477
|
+
)
|
|
478
|
+
);
|
|
479
|
+
if (job !== void 0) {
|
|
480
|
+
yield* bounded(wait(job.settled.promise, "kill", command.command), 5500, "kill", command.command);
|
|
481
|
+
settled = true;
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
yield* bounded(wait(control.ended.promise, "kill", command.command), deliveryMs, "kill", command.command).pipe(
|
|
485
|
+
Effect.ignore
|
|
486
|
+
);
|
|
487
|
+
const deadline = Date.now() + verificationMs;
|
|
488
|
+
for (; ; ) {
|
|
489
|
+
const vacant = grouped && system.vacant(raw.pid);
|
|
490
|
+
const observed = grouped && !vacant ? snapshot() : void 0;
|
|
491
|
+
settled = !control.cleanupFailed && (!requireCleanupReceipt || control.cleanupAcknowledged) && (grouped ? vacant || observed !== void 0 && observed.ownGroup !== raw.pid && observed.members.every((member) => member.zombie) : control.targetDone || control.spawnFailed || !control.activationSent);
|
|
492
|
+
if (settled) return;
|
|
493
|
+
if (Date.now() >= deadline) {
|
|
494
|
+
return yield* Effect.fail(
|
|
495
|
+
failure(
|
|
496
|
+
"kill",
|
|
497
|
+
command.command,
|
|
498
|
+
(0, import_ProcessFault.processFault)(
|
|
499
|
+
"cleanup_unverified",
|
|
500
|
+
`Process cleanup could not be verified; its ledger record is retained (${unverifiedCleanup(control, requireCleanupReceipt, vacant, observed)})`,
|
|
501
|
+
{
|
|
502
|
+
cause: {
|
|
503
|
+
fault: control.fault,
|
|
504
|
+
cleanupFailed: control.cleanupFailed,
|
|
505
|
+
cleanupRequired: requireCleanupReceipt,
|
|
506
|
+
cleanupAcknowledged: control.cleanupAcknowledged,
|
|
507
|
+
targetDone: control.targetDone,
|
|
508
|
+
groupVacant: vacant,
|
|
509
|
+
ownerObserved: observed !== void 0,
|
|
510
|
+
members: observed?.members
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
)
|
|
514
|
+
)
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
yield* Effect.sleep(10).pipe(Effect.provideService(Clock.Clock, processClock));
|
|
518
|
+
}
|
|
519
|
+
}));
|
|
520
|
+
const kill = (options2 = {}) => Effect.gen(function* () {
|
|
521
|
+
const requested = yield* policy(options2, command.options);
|
|
522
|
+
if (!referenced) {
|
|
523
|
+
job?.reference(true);
|
|
524
|
+
control.socket?.ref();
|
|
525
|
+
control.requestSocket?.ref();
|
|
526
|
+
yield* reref;
|
|
527
|
+
referenced = true;
|
|
528
|
+
}
|
|
529
|
+
if (!control.closeSent) {
|
|
530
|
+
control.closeSent = true;
|
|
531
|
+
selected = requested;
|
|
532
|
+
requireCleanupReceipt = grouped && control.activationSent && !control.spawnFailed && !control.targetDone;
|
|
533
|
+
yield* bounded(
|
|
534
|
+
wait(
|
|
535
|
+
control.write({
|
|
536
|
+
type: "stop",
|
|
537
|
+
explicit: true,
|
|
538
|
+
...requested,
|
|
539
|
+
// A live target can move out of this group with setsid().
|
|
540
|
+
// Only an owner whose target was never activated can replace
|
|
541
|
+
// the requested signal; natural exit has its own fast path.
|
|
542
|
+
killSignal: !control.activationSent && alone() ? "SIGKILL" : requested.killSignal
|
|
543
|
+
}),
|
|
544
|
+
"kill",
|
|
545
|
+
command.command
|
|
546
|
+
),
|
|
547
|
+
deliveryMs,
|
|
548
|
+
"kill",
|
|
549
|
+
command.command
|
|
550
|
+
).pipe(Effect.catch(() => Effect.sync(() => control.disconnect())));
|
|
551
|
+
}
|
|
552
|
+
yield* finish;
|
|
553
|
+
}).pipe(Effect.uninterruptible);
|
|
554
|
+
yield* Effect.addFinalizer(
|
|
555
|
+
() => kill().pipe(
|
|
556
|
+
// A stuck owner keeps its ledger entry. Disable the underlying spawner's
|
|
557
|
+
// unconditional group-kill finalizer rather than signal a stale identity.
|
|
558
|
+
Effect.ensuring(
|
|
559
|
+
Effect.suspend(
|
|
560
|
+
() => settled ? Effect.void : Effect.andThen(
|
|
561
|
+
raw.unref,
|
|
562
|
+
Effect.sync(() => {
|
|
563
|
+
job?.stop();
|
|
564
|
+
job?.reference(false);
|
|
565
|
+
control.disconnect();
|
|
566
|
+
})
|
|
567
|
+
)
|
|
568
|
+
).pipe(Effect.orDie)
|
|
569
|
+
),
|
|
570
|
+
Effect.orDie
|
|
571
|
+
)
|
|
572
|
+
);
|
|
573
|
+
const ready = yield* bounded(
|
|
574
|
+
wait(control.ready.promise, "spawn", command.command),
|
|
575
|
+
startupMs,
|
|
576
|
+
"spawn",
|
|
577
|
+
command.command
|
|
578
|
+
);
|
|
579
|
+
yield* bounded(wait(control.requestsReady.promise, "spawn", command.command), startupMs, "spawn", command.command);
|
|
580
|
+
yield* Effect.try({
|
|
581
|
+
try: () => control.withdraw(ready, raw.pid),
|
|
582
|
+
catch: (cause) => failure("spawn", command.command, cause)
|
|
583
|
+
});
|
|
584
|
+
if (windows) {
|
|
585
|
+
job = yield* Effect.try({
|
|
586
|
+
try: () => new import_WindowsProcessJob.WindowsProcessJob(raw.pid, control.ownerCreation, jobExecutable),
|
|
587
|
+
catch: (cause) => failure("spawn", command.command, cause)
|
|
588
|
+
});
|
|
589
|
+
yield* bounded(wait(job.ready.promise, "spawn", command.command), startupMs, "spawn", command.command);
|
|
590
|
+
}
|
|
591
|
+
const acknowledgeCleanup = windows || transport === "tls";
|
|
592
|
+
if (acknowledgeCleanup) {
|
|
593
|
+
control.onCleanup = () => {
|
|
594
|
+
if (!control.ownerDone) {
|
|
595
|
+
void control.write({ type: "cleanup_ack" }).catch(() => control.disconnect());
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
const options = command.options;
|
|
600
|
+
const env = options.extendEnv ? { ...process.env, ...options.env } : options.env ?? { ...process.env };
|
|
601
|
+
yield* bounded(
|
|
602
|
+
wait(
|
|
603
|
+
control.write({
|
|
604
|
+
type: "configure",
|
|
605
|
+
acknowledgeCleanup,
|
|
606
|
+
command: command.command,
|
|
607
|
+
args: command.args,
|
|
608
|
+
cwd: (0, import_node_path.resolve)(options.cwd ?? process.cwd()),
|
|
609
|
+
env,
|
|
610
|
+
shell: options.shell,
|
|
611
|
+
windowsHide: options.windowsHide ?? true,
|
|
612
|
+
windowsVerbatimArguments: options.windowsVerbatimArguments,
|
|
613
|
+
standardFds: (0, import_PipedProcess.standardFdsOf)(raw),
|
|
614
|
+
userFds: [
|
|
615
|
+
...new Set(
|
|
616
|
+
Object.keys(options.additionalFds ?? {}).map(ChildProcess.parseFdName).filter((fd) => fd !== void 0)
|
|
617
|
+
)
|
|
618
|
+
],
|
|
619
|
+
...initial
|
|
620
|
+
}),
|
|
621
|
+
"spawn",
|
|
622
|
+
command.command
|
|
623
|
+
),
|
|
624
|
+
deliveryMs,
|
|
625
|
+
"spawn",
|
|
626
|
+
command.command
|
|
627
|
+
);
|
|
628
|
+
const activate = yield* Effect.cached(Effect.gen(function* () {
|
|
629
|
+
control.activationSent = true;
|
|
630
|
+
yield* bounded(
|
|
631
|
+
wait(control.write({ type: "start" }), "spawn", command.command),
|
|
632
|
+
deliveryMs,
|
|
633
|
+
"spawn",
|
|
634
|
+
command.command
|
|
635
|
+
);
|
|
636
|
+
yield* bounded(wait(control.started.promise, "spawn", command.command), startupMs, "spawn", command.command);
|
|
637
|
+
}));
|
|
638
|
+
const unref = Effect.gen(function* () {
|
|
639
|
+
if (referenced) {
|
|
640
|
+
reref = yield* raw.unref;
|
|
641
|
+
job?.reference(false);
|
|
642
|
+
control.socket?.unref();
|
|
643
|
+
control.requestSocket?.unref();
|
|
644
|
+
referenced = false;
|
|
645
|
+
}
|
|
646
|
+
return Effect.gen(function* () {
|
|
647
|
+
if (!referenced) {
|
|
648
|
+
job?.reference(true);
|
|
649
|
+
control.socket?.ref();
|
|
650
|
+
control.requestSocket?.ref();
|
|
651
|
+
yield* reref;
|
|
652
|
+
referenced = true;
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
});
|
|
656
|
+
const output = (stream) => stream.pipe(
|
|
657
|
+
Stream.interruptWhen(wait(control.lost.promise, "read", command.command))
|
|
658
|
+
);
|
|
659
|
+
const input = (sink) => Sink.fromChannel(
|
|
660
|
+
Sink.toChannel(sink).pipe(Channel.interruptWhen(wait(control.lost.promise, "write", command.command)))
|
|
661
|
+
);
|
|
662
|
+
const handle = (0, import_ChildProcessSpawner.makeHandle)({
|
|
663
|
+
...raw,
|
|
664
|
+
exitCode: wait(control.exited.promise, "exitCode", command.command),
|
|
665
|
+
isRunning: Effect.sync(() => !control.targetDone && !control.ownerDone),
|
|
666
|
+
stdin: input(raw.stdin),
|
|
667
|
+
getInputFd: (fd) => input(raw.getInputFd(fd)),
|
|
668
|
+
stdout: output(raw.stdout),
|
|
669
|
+
stderr: output(raw.stderr),
|
|
670
|
+
all: output(raw.all),
|
|
671
|
+
getOutputFd: (fd) => output(raw.getOutputFd(fd)),
|
|
672
|
+
kill,
|
|
673
|
+
unref
|
|
674
|
+
});
|
|
675
|
+
targets.set(handle, control);
|
|
676
|
+
return {
|
|
677
|
+
handle,
|
|
678
|
+
activate,
|
|
679
|
+
settled: Effect.sync(() => settled)
|
|
680
|
+
};
|
|
681
|
+
});
|
|
682
|
+
//# sourceMappingURL=ProcessSupervisor.js.map
|