@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,415 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Descriptor-relative filesystem operations through the packaged Rust helper.
|
|
3
|
+
* The helper pins the workspace root and walks each component with O_NOFOLLOW.
|
|
4
|
+
* Requests and responses are length-framed, size-limited, and cancellable.
|
|
5
|
+
* @since 0.1.0
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem"
|
|
9
|
+
import * as KernelFileSystem from "@smthrs/kernel/FileSystem"
|
|
10
|
+
import { Effect, FileSystem, Layer, PlatformError, Semaphore, Stream } from "effect"
|
|
11
|
+
import { realpath, stat } from "node:fs/promises"
|
|
12
|
+
import { availableParallelism } from "node:os"
|
|
13
|
+
import {
|
|
14
|
+
packageRoot,
|
|
15
|
+
resolveConfiguredExecutable,
|
|
16
|
+
resolveDefaultExecutable,
|
|
17
|
+
stagePackaged
|
|
18
|
+
} from "./internal/AtomicFileSystemExecutable.ts"
|
|
19
|
+
import * as Protocol from "./internal/AtomicFileSystemProtocol.ts"
|
|
20
|
+
import * as Transport from "./internal/AtomicFileSystemTransport.ts"
|
|
21
|
+
import { AtomicHelperError } from "./internal/AtomicHelperError.ts"
|
|
22
|
+
|
|
23
|
+
export { AtomicHelperError, AtomicHelperErrorCode } from "./internal/AtomicHelperError.ts"
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The legacy system installation path, used after package and checkout paths.
|
|
27
|
+
* Helper selection never consults `PATH` or the process working directory.
|
|
28
|
+
*
|
|
29
|
+
* @since 0.1.0
|
|
30
|
+
* @category constants
|
|
31
|
+
*/
|
|
32
|
+
export const defaultExecutable = "/usr/local/bin/smithers-jj-export"
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Byte ceilings for the helper protocol. Every one of them is a contract, not
|
|
36
|
+
* a tuning knob: without them a large file, a large directory tree, or a
|
|
37
|
+
* malfunctioning helper makes the host allocate until it dies.
|
|
38
|
+
*
|
|
39
|
+
* - `content` bounds the bytes a single `readFile`/`writeFile` may carry.
|
|
40
|
+
* - `request` bounds the framed request; an over-limit request is refused
|
|
41
|
+
* before an helper is even started.
|
|
42
|
+
* - `response` bounds the framed response, and is what a directory listing is
|
|
43
|
+
* charged against as it is built. It bounds the REJECTION envelope too, so a
|
|
44
|
+
* ceiling small enough to cut one off degrades that operation's typed reason
|
|
45
|
+
* to the fail-closed one.
|
|
46
|
+
* - `stderr` bounds the diagnostic text retained from a failing helper.
|
|
47
|
+
* - `batchEntry` bounds one batch member's encoded success or failure envelope.
|
|
48
|
+
* - `batchSize` bounds the number of operations in one batch, at most 128.
|
|
49
|
+
*
|
|
50
|
+
* All except `batchSize` count bytes. The two ceilings that decide whether the host
|
|
51
|
+
* survives a wide fan-out are {@link Options.concurrency}, which bounds how
|
|
52
|
+
* many helpers run at once, and {@link Options.timeoutMs}, which bounds
|
|
53
|
+
* how long any one of them may take.
|
|
54
|
+
*
|
|
55
|
+
* @since 0.1.0
|
|
56
|
+
* @category models
|
|
57
|
+
*/
|
|
58
|
+
export interface Limits {
|
|
59
|
+
readonly content: number
|
|
60
|
+
readonly request: number
|
|
61
|
+
readonly response: number
|
|
62
|
+
readonly stderr: number
|
|
63
|
+
/** Maximum operations in one helper invocation, at most 128. */
|
|
64
|
+
readonly batchSize: number
|
|
65
|
+
/** Maximum encoded result bytes for one batch member. */
|
|
66
|
+
readonly batchEntry: number
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 16 MiB of file content, 24 MiB of framed request and response (base64
|
|
71
|
+
* expands 16 MiB to 22369624 bytes, which has to fit), and 64 KiB of retained
|
|
72
|
+
* helper diagnostics.
|
|
73
|
+
*
|
|
74
|
+
* @since 0.1.0
|
|
75
|
+
* @category constants
|
|
76
|
+
*/
|
|
77
|
+
export const defaultLimits: Limits = {
|
|
78
|
+
content: 16 * 1024 * 1024,
|
|
79
|
+
request: 24 * 1024 * 1024,
|
|
80
|
+
response: 24 * 1024 * 1024,
|
|
81
|
+
stderr: 64 * 1024,
|
|
82
|
+
batchSize: KernelFileSystem.maxBatchSize,
|
|
83
|
+
batchEntry: 24 * 1024 * 1024
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The default number of helper processes that may run at once:
|
|
88
|
+
* `os.availableParallelism()`.
|
|
89
|
+
*
|
|
90
|
+
* @since 1.0.0-rc.0
|
|
91
|
+
* @category constants
|
|
92
|
+
*/
|
|
93
|
+
export const defaultConcurrency: number = availableParallelism()
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* How long one helper may run before it is killed and the operation fails
|
|
97
|
+
* closed: five minutes.
|
|
98
|
+
*
|
|
99
|
+
* It is a backstop, not a latency budget. A read at the content ceiling over a
|
|
100
|
+
* slow disk has to fit under it, so it is generous; what it bounds is a helper
|
|
101
|
+
* that will never answer at all.
|
|
102
|
+
*
|
|
103
|
+
* @since 1.0.0-rc.0
|
|
104
|
+
* @category constants
|
|
105
|
+
*/
|
|
106
|
+
export const defaultTimeoutMs = 300_000
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The deliberate seam for a POSIX host that installs the native helper somewhere other
|
|
110
|
+
* than {@link defaultExecutable}, or that needs different ceilings. It is
|
|
111
|
+
* configuration, never discovery: the executable is validated as an absolute,
|
|
112
|
+
* executable regular file outside the confined workspace on every request, and
|
|
113
|
+
* every other field is read ONCE, when the layer is built.
|
|
114
|
+
*
|
|
115
|
+
* @since 0.1.0
|
|
116
|
+
* @category models
|
|
117
|
+
*/
|
|
118
|
+
export interface Options {
|
|
119
|
+
readonly executable?: string | undefined
|
|
120
|
+
readonly limits?: Partial<Limits> | undefined
|
|
121
|
+
/**
|
|
122
|
+
* How many helper processes may run at once. Default
|
|
123
|
+
* {@link defaultConcurrency}.
|
|
124
|
+
*
|
|
125
|
+
* Each ordinary operation or batch starts one helper, so an unbounded
|
|
126
|
+
* `Effect.forEach` over a directory would start
|
|
127
|
+
* one helper per entry. This ceiling is what keeps a wide fan-out from
|
|
128
|
+
* pinning every core; it is a contract, not a tuning knob.
|
|
129
|
+
*/
|
|
130
|
+
readonly concurrency?: number | undefined
|
|
131
|
+
/**
|
|
132
|
+
* How long one helper may run before it is killed and the operation fails
|
|
133
|
+
* closed, in milliseconds. Default {@link defaultTimeoutMs}.
|
|
134
|
+
*/
|
|
135
|
+
readonly timeoutMs?: number | undefined
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Everything read out of {@link Options} once, when the layer is built.
|
|
140
|
+
*
|
|
141
|
+
* Snapshotted rather than re-read per request: `Options` is a plain object the
|
|
142
|
+
* caller still holds, and a byte ceiling that changes under a running host is
|
|
143
|
+
* not a ceiling. The executable is deliberately NOT here — it is re-validated
|
|
144
|
+
* per request, because the file it names can be replaced while the host runs.
|
|
145
|
+
*/
|
|
146
|
+
interface Settings {
|
|
147
|
+
readonly limits: Limits
|
|
148
|
+
readonly timeoutMs: number
|
|
149
|
+
readonly semaphore: Semaphore.Semaphore
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Process-local helper starts, for cost counters and local measurements.
|
|
154
|
+
* Includes helpers later cancelled or refused; rejected preflight starts none.
|
|
155
|
+
*
|
|
156
|
+
* @since 1.0.0
|
|
157
|
+
* @category metrics
|
|
158
|
+
*/
|
|
159
|
+
export const helperSpawns = (): number => Transport.started()
|
|
160
|
+
|
|
161
|
+
/** The helper enforces the same ceiling before it trusts a declared limit. */
|
|
162
|
+
const hardLimitBytes = 256 * 1024 * 1024
|
|
163
|
+
/** `setTimeout` clamps a longer delay to 1 ms, so a bigger backstop is none. */
|
|
164
|
+
const maxTimeoutMs = 2_147_483_647
|
|
165
|
+
|
|
166
|
+
/** Resolves every optional byte ceiling and refuses values that could disable a bound. */
|
|
167
|
+
const resolveLimits = (overrides: Partial<Limits> | undefined): Limits => {
|
|
168
|
+
const limits: Limits = {
|
|
169
|
+
content: overrides?.content ?? defaultLimits.content,
|
|
170
|
+
request: overrides?.request ?? defaultLimits.request,
|
|
171
|
+
response: overrides?.response ?? defaultLimits.response,
|
|
172
|
+
stderr: overrides?.stderr ?? defaultLimits.stderr,
|
|
173
|
+
batchSize: overrides?.batchSize ?? defaultLimits.batchSize,
|
|
174
|
+
batchEntry: overrides?.batchEntry ?? defaultLimits.batchEntry
|
|
175
|
+
}
|
|
176
|
+
for (const [name, value] of Object.entries(limits)) {
|
|
177
|
+
if (!Number.isSafeInteger(value) || value <= 0 || value > hardLimitBytes) {
|
|
178
|
+
throw new AtomicHelperError({
|
|
179
|
+
code: "limit_invalid",
|
|
180
|
+
message: `atomic helper ${name} limit must be a positive integer no greater than ${hardLimitBytes}`
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (limits.batchSize > KernelFileSystem.maxBatchSize) {
|
|
185
|
+
throw new AtomicHelperError({
|
|
186
|
+
code: "limit_invalid",
|
|
187
|
+
message: `atomic helper batchSize limit must be no greater than ${KernelFileSystem.maxBatchSize}`
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
return limits
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Reads the whole of {@link Options} once, at layer construction.
|
|
195
|
+
*
|
|
196
|
+
* A rejected value is carried rather than thrown, because the failure a caller
|
|
197
|
+
* sees for it is a typed `BadArgument` on the first operation and not an
|
|
198
|
+
* exception escaping a layer.
|
|
199
|
+
*/
|
|
200
|
+
const resolveSettings = (options: Options): Settings | { readonly invalid: unknown } => {
|
|
201
|
+
try {
|
|
202
|
+
const limits = resolveLimits(options.limits)
|
|
203
|
+
const concurrency = options.concurrency ?? defaultConcurrency
|
|
204
|
+
if (!Number.isSafeInteger(concurrency) || concurrency <= 0) {
|
|
205
|
+
throw new AtomicHelperError({
|
|
206
|
+
code: "concurrency_invalid",
|
|
207
|
+
message: "atomic helper concurrency must be a positive integer"
|
|
208
|
+
})
|
|
209
|
+
}
|
|
210
|
+
const timeoutMs = options.timeoutMs ?? defaultTimeoutMs
|
|
211
|
+
if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > maxTimeoutMs) {
|
|
212
|
+
throw new AtomicHelperError({
|
|
213
|
+
code: "timeout_invalid",
|
|
214
|
+
message: "atomic helper timeoutMs must be a positive integer no greater than 2147483647"
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
return { limits, timeoutMs, semaphore: Semaphore.makeUnsafe(concurrency) }
|
|
218
|
+
} catch (invalid) {
|
|
219
|
+
return { invalid }
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* The framed half, one concrete result type. Nothing on this side of the pipe
|
|
225
|
+
* can prove what the helper answered: the protocol pairs an operation with its
|
|
226
|
+
* result, and {@link execute} restates that pairing for the kernel's typed
|
|
227
|
+
* request. Keeping the decode `unknown` here confines that promise to one
|
|
228
|
+
* assertion instead of one per caller.
|
|
229
|
+
*/
|
|
230
|
+
const executeFramed = (options: Options, resolved: Settings | { readonly invalid: unknown }) =>
|
|
231
|
+
(
|
|
232
|
+
request: KernelFileSystem.AtomicRequest
|
|
233
|
+
): Effect.Effect<unknown, PlatformError.PlatformError> =>
|
|
234
|
+
Effect.suspend(() => {
|
|
235
|
+
if ("invalid" in resolved) {
|
|
236
|
+
const cause = resolved.invalid
|
|
237
|
+
return Effect.fail(PlatformError.badArgument({
|
|
238
|
+
module: Protocol.moduleName,
|
|
239
|
+
method: request.operation,
|
|
240
|
+
description: cause instanceof Error ? cause.message : "atomic helper limits are invalid",
|
|
241
|
+
cause
|
|
242
|
+
}))
|
|
243
|
+
}
|
|
244
|
+
const limits = resolved.limits
|
|
245
|
+
if (
|
|
246
|
+
request.operation === "batch" &&
|
|
247
|
+
(!Array.isArray(request.requests) || request.requests.length === 0 || request.requests.length > limits.batchSize)
|
|
248
|
+
) {
|
|
249
|
+
return Effect.fail(PlatformError.badArgument({
|
|
250
|
+
module: Protocol.moduleName,
|
|
251
|
+
method: "batch",
|
|
252
|
+
description: `atomic batch must contain 1 to ${limits.batchSize} operations`
|
|
253
|
+
}))
|
|
254
|
+
}
|
|
255
|
+
// Admission bounds request serialization and framing as well as children.
|
|
256
|
+
// Queued callers retain their input, without another full payload copy.
|
|
257
|
+
return resolved.semaphore.withPermits(1)(Effect.suspend(() => {
|
|
258
|
+
let body: Buffer
|
|
259
|
+
try {
|
|
260
|
+
const serialized = JSON.stringify(
|
|
261
|
+
request.operation === "batch"
|
|
262
|
+
? { ...request, batchSize: limits.batchSize, batchEntry: limits.batchEntry }
|
|
263
|
+
: request
|
|
264
|
+
)
|
|
265
|
+
if (serialized === undefined) {
|
|
266
|
+
throw new AtomicHelperError({
|
|
267
|
+
code: "request_not_serializable",
|
|
268
|
+
message: "atomic request is not serializable"
|
|
269
|
+
})
|
|
270
|
+
}
|
|
271
|
+
body = Buffer.from(serialized, "utf8")
|
|
272
|
+
} catch (cause) {
|
|
273
|
+
return Effect.fail(PlatformError.badArgument({
|
|
274
|
+
module: Protocol.moduleName,
|
|
275
|
+
method: request.operation,
|
|
276
|
+
description: "atomic request is not serializable",
|
|
277
|
+
cause
|
|
278
|
+
}))
|
|
279
|
+
}
|
|
280
|
+
if (body.byteLength > limits.request) {
|
|
281
|
+
// Refused before an helper exists: an over-limit request is caller
|
|
282
|
+
// input, and nothing about it improves by being sent.
|
|
283
|
+
return Effect.fail(PlatformError.badArgument({
|
|
284
|
+
module: Protocol.moduleName,
|
|
285
|
+
method: request.operation,
|
|
286
|
+
description: `atomic request of ${body.byteLength} bytes exceeds the ${limits.request} byte limit`
|
|
287
|
+
}))
|
|
288
|
+
}
|
|
289
|
+
let executable: string
|
|
290
|
+
try {
|
|
291
|
+
executable = resolveExecutable(options, request.boundaryRoot)
|
|
292
|
+
} catch (cause) {
|
|
293
|
+
return Effect.fail(Protocol.failure(request, cause))
|
|
294
|
+
}
|
|
295
|
+
return Transport.spawnHelper<unknown>(request, executable, Protocol.encode(body, limits), resolved)
|
|
296
|
+
}))
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
const resolveExecutable = (options: Pick<Options, "executable">, boundaryRoot: string | undefined): string => {
|
|
300
|
+
const configured = process.env.SMITHERS_WORKSPACE_JJ_EXPORT_BINARY
|
|
301
|
+
return options.executable !== undefined
|
|
302
|
+
? Transport.usableExecutable(options.executable, boundaryRoot)
|
|
303
|
+
: configured === undefined
|
|
304
|
+
? resolveDefaultExecutable(packageRoot, boundaryRoot, defaultExecutable)
|
|
305
|
+
: resolveConfiguredExecutable(configured, boundaryRoot)
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* The helper this process would start for an atomic operation, resolved exactly
|
|
310
|
+
* as an operation resolves it: `SMITHERS_WORKSPACE_JJ_EXPORT_BINARY`, then the
|
|
311
|
+
* packaged and checkout locations. Nothing is spawned. Throws an {@link AtomicHelperError} whose
|
|
312
|
+
* message names what was searched and how to install the helper when none is
|
|
313
|
+
* usable, so a diagnostic can report it before any operation needs it.
|
|
314
|
+
*
|
|
315
|
+
* @since 1.0.0
|
|
316
|
+
* @category constructors
|
|
317
|
+
*/
|
|
318
|
+
export const resolveHelper = (): string => resolveExecutable({}, undefined)
|
|
319
|
+
|
|
320
|
+
const execute = (
|
|
321
|
+
options: Options,
|
|
322
|
+
resolved: Settings | { readonly invalid: unknown }
|
|
323
|
+
): KernelFileSystem.AtomicFileSystem["execute"] => {
|
|
324
|
+
const framed = executeFramed(options, resolved)
|
|
325
|
+
return <R extends KernelFileSystem.AtomicRequest>(request: R) =>
|
|
326
|
+
framed(request) as Effect.Effect<KernelFileSystem.AtomicResult<R>, PlatformError.PlatformError>
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const nativeRealPath = (path: string) =>
|
|
330
|
+
Effect.tryPromise({
|
|
331
|
+
try: () => realpath(path),
|
|
332
|
+
catch: (cause) =>
|
|
333
|
+
Protocol.failure({ operation: "realPath", path }, cause, {
|
|
334
|
+
ok: false,
|
|
335
|
+
code: (cause as NodeJS.ErrnoException).code ?? null,
|
|
336
|
+
message: (cause as NodeJS.ErrnoException).message,
|
|
337
|
+
syscall: "realpath"
|
|
338
|
+
})
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* A Node filesystem layer carrying the kernel's atomic host extension, built
|
|
343
|
+
* against an explicitly configured helper, byte limits, process ceiling,
|
|
344
|
+
* and helper timeout.
|
|
345
|
+
*
|
|
346
|
+
* Every field of {@link Options} except `executable` is read once, here. The
|
|
347
|
+
* concurrency ceiling is one semaphore for the whole layer rather than one per
|
|
348
|
+
* request, which is the only arrangement that bounds anything.
|
|
349
|
+
*
|
|
350
|
+
* @since 0.1.0
|
|
351
|
+
* @category layers
|
|
352
|
+
*/
|
|
353
|
+
export const layerWith = (options: Options): Layer.Layer<FileSystem.FileSystem> => {
|
|
354
|
+
// Outside the layer body on purpose. Inside it the settings would be read
|
|
355
|
+
// again on every BUILD, so two compositions of the same layer value could
|
|
356
|
+
// enforce two different ceilings out of one mutated object, and each would
|
|
357
|
+
// get a process ceiling of its own instead of sharing one.
|
|
358
|
+
const settings = resolveSettings(options)
|
|
359
|
+
return Layer.effect(
|
|
360
|
+
FileSystem.FileSystem,
|
|
361
|
+
Effect.map(
|
|
362
|
+
// The packaged helper is pinned while the host is built, before any flow
|
|
363
|
+
// can rewrite a workspace-local install of this package.
|
|
364
|
+
Effect.andThen(
|
|
365
|
+
Effect.sync(() => {
|
|
366
|
+
if (options.executable === undefined && process.env.SMITHERS_WORKSPACE_JJ_EXPORT_BINARY === undefined) {
|
|
367
|
+
stagePackaged(packageRoot)
|
|
368
|
+
}
|
|
369
|
+
}),
|
|
370
|
+
FileSystem.FileSystem
|
|
371
|
+
),
|
|
372
|
+
(fileSystem) =>
|
|
373
|
+
KernelFileSystem.withAtomicFileSystem({
|
|
374
|
+
...fileSystem,
|
|
375
|
+
// Expand DOS names before pinning roots or opening native watchers.
|
|
376
|
+
realPath: nativeRealPath,
|
|
377
|
+
watch: (path, options) =>
|
|
378
|
+
process.platform !== "win32"
|
|
379
|
+
? fileSystem.watch(path, options)
|
|
380
|
+
: Stream.unwrap(
|
|
381
|
+
nativeRealPath(path).pipe(Effect.map((canonical) => fileSystem.watch(canonical, options)))
|
|
382
|
+
)
|
|
383
|
+
}, {
|
|
384
|
+
noFollowAuthorization: true,
|
|
385
|
+
execute: execute(options, settings),
|
|
386
|
+
identifyRoot: (path) =>
|
|
387
|
+
Effect.tryPromise({
|
|
388
|
+
try: async () => {
|
|
389
|
+
const info = await stat(path, { bigint: true })
|
|
390
|
+
return `${info.dev}:${info.ino}`
|
|
391
|
+
},
|
|
392
|
+
catch: (cause) =>
|
|
393
|
+
Protocol.failure({ operation: "stat", path }, cause, {
|
|
394
|
+
ok: false,
|
|
395
|
+
code: (cause as NodeJS.ErrnoException).code ?? null,
|
|
396
|
+
message: (cause as NodeJS.ErrnoException).message,
|
|
397
|
+
syscall: "stat"
|
|
398
|
+
})
|
|
399
|
+
}),
|
|
400
|
+
batchLimits: {
|
|
401
|
+
size: "invalid" in settings ? defaultLimits.batchSize : settings.limits.batchSize,
|
|
402
|
+
response: "invalid" in settings ? defaultLimits.response : settings.limits.response
|
|
403
|
+
},
|
|
404
|
+
contentLimit: "invalid" in settings ? defaultLimits.content : settings.limits.content
|
|
405
|
+
})
|
|
406
|
+
)
|
|
407
|
+
).pipe(Layer.provide(NodeFileSystem.layer))
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/** A Node filesystem layer carrying the kernel's atomic host extension.
|
|
411
|
+
*
|
|
412
|
+
* @since 0.1.0
|
|
413
|
+
* @category layers
|
|
414
|
+
*/
|
|
415
|
+
export const layer: Layer.Layer<FileSystem.FileSystem> = layerWith({})
|