@struktoai/mirage-node 0.0.8-alpha.1 → 0.0.8
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/README.md +140 -46
- package/dist/accessor/disk.d.ts +6 -0
- package/dist/accessor/disk.d.ts.map +1 -1
- package/dist/accessor/disk.js +8 -0
- package/dist/accessor/disk.js.map +1 -1
- package/dist/accessor/email.d.ts.map +1 -1
- package/dist/accessor/email.js +5 -0
- package/dist/accessor/email.js.map +1 -1
- package/dist/accessor/gridfs.d.ts.map +1 -1
- package/dist/accessor/gridfs.js +6 -1
- package/dist/accessor/gridfs.js.map +1 -1
- package/dist/accessor/hf_hub.d.ts +3 -7
- package/dist/accessor/hf_hub.d.ts.map +1 -1
- package/dist/accessor/hf_hub.js +10 -10
- package/dist/accessor/hf_hub.js.map +1 -1
- package/dist/cache/file/redis.d.ts +8 -7
- package/dist/cache/file/redis.d.ts.map +1 -1
- package/dist/cache/file/redis.js +46 -50
- package/dist/cache/file/redis.js.map +1 -1
- package/dist/commands/builtin/utils/http.js +13 -5
- package/dist/commands/builtin/utils/http.js.map +1 -1
- package/dist/commands/cli/builtin/hf/index.d.ts.map +1 -1
- package/dist/commands/cli/builtin/hf/index.js +4 -5
- package/dist/commands/cli/builtin/hf/index.js.map +1 -1
- package/dist/commands/cli/builtin/hf/upload.d.ts.map +1 -1
- package/dist/commands/cli/builtin/hf/upload.js +2 -5
- package/dist/commands/cli/builtin/hf/upload.js.map +1 -1
- package/dist/commands/cli/builtin/himalaya/builder.d.ts +2 -2
- package/dist/commands/cli/builtin/himalaya/builder.d.ts.map +1 -1
- package/dist/commands/cli/builtin/himalaya/builder.js +1 -1
- package/dist/commands/cli/builtin/himalaya/builder.js.map +1 -1
- package/dist/commands/cli/builtin/himalaya/deliver.d.ts +35 -7
- package/dist/commands/cli/builtin/himalaya/deliver.d.ts.map +1 -1
- package/dist/commands/cli/builtin/himalaya/deliver.js.map +1 -1
- package/dist/commands/cli/builtin/himalaya/index.d.ts.map +1 -1
- package/dist/commands/cli/builtin/himalaya/index.js +4 -5
- package/dist/commands/cli/builtin/himalaya/index.js.map +1 -1
- package/dist/commands/cli/builtin/himalaya/query.d.ts +2 -2
- package/dist/commands/cli/builtin/himalaya/query.d.ts.map +1 -1
- package/dist/commands/cli/builtin/himalaya/query.js +1 -1
- package/dist/commands/cli/builtin/himalaya/query.js.map +1 -1
- package/dist/commands/cli/builtin/himalaya/send.d.ts.map +1 -1
- package/dist/commands/cli/builtin/himalaya/send.js +2 -1
- package/dist/commands/cli/builtin/himalaya/send.js.map +1 -1
- package/dist/commands/cli/builtin/himalaya/smtp.d.ts +2 -2
- package/dist/commands/cli/builtin/himalaya/smtp.d.ts.map +1 -1
- package/dist/commands/cli/builtin/himalaya/smtp.js +5 -0
- package/dist/commands/cli/builtin/himalaya/smtp.js.map +1 -1
- package/dist/commands/cli/builtin/himalaya/util.d.ts +1 -1
- package/dist/commands/cli/builtin/himalaya/util.d.ts.map +1 -1
- package/dist/commands/cli/builtin/himalaya/util.js +6 -5
- package/dist/commands/cli/builtin/himalaya/util.js.map +1 -1
- package/dist/config.d.ts +57 -37
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +152 -277
- package/dist/config.js.map +1 -1
- package/dist/core/disk/capacity.d.ts +13 -0
- package/dist/core/disk/capacity.d.ts.map +1 -0
- package/dist/core/disk/capacity.js +93 -0
- package/dist/core/disk/capacity.js.map +1 -0
- package/dist/core/disk/constants.d.ts +0 -1
- package/dist/core/disk/constants.d.ts.map +1 -1
- package/dist/core/disk/constants.js +0 -1
- package/dist/core/disk/constants.js.map +1 -1
- package/dist/core/disk/copy.d.ts.map +1 -1
- package/dist/core/disk/copy.js +24 -13
- package/dist/core/disk/copy.js.map +1 -1
- package/dist/core/disk/mkdir.d.ts.map +1 -1
- package/dist/core/disk/mkdir.js +9 -0
- package/dist/core/disk/mkdir.js.map +1 -1
- package/dist/core/disk/read.d.ts +3 -3
- package/dist/core/disk/read.d.ts.map +1 -1
- package/dist/core/disk/read.js +4 -19
- package/dist/core/disk/read.js.map +1 -1
- package/dist/core/disk/rename.d.ts +3 -0
- package/dist/core/disk/rename.d.ts.map +1 -1
- package/dist/core/disk/rename.js +15 -1
- package/dist/core/disk/rename.js.map +1 -1
- package/dist/core/disk/rm.d.ts.map +1 -1
- package/dist/core/disk/rm.js +11 -1
- package/dist/core/disk/rm.js.map +1 -1
- package/dist/core/disk/rmdir.d.ts.map +1 -1
- package/dist/core/disk/rmdir.js +4 -0
- package/dist/core/disk/rmdir.js.map +1 -1
- package/dist/core/disk/set_attrs.d.ts +2 -9
- package/dist/core/disk/set_attrs.d.ts.map +1 -1
- package/dist/core/disk/set_attrs.js +2 -1
- package/dist/core/disk/set_attrs.js.map +1 -1
- package/dist/core/disk/stream.d.ts +8 -0
- package/dist/core/disk/stream.d.ts.map +1 -1
- package/dist/core/disk/stream.js +33 -13
- package/dist/core/disk/stream.js.map +1 -1
- package/dist/core/disk/unlink.d.ts.map +1 -1
- package/dist/core/disk/unlink.js +4 -0
- package/dist/core/disk/unlink.js.map +1 -1
- package/dist/core/disk/utils.d.ts +2 -0
- package/dist/core/disk/utils.d.ts.map +1 -1
- package/dist/core/disk/utils.js +68 -21
- package/dist/core/disk/utils.js.map +1 -1
- package/dist/core/disk/write.d.ts +7 -2
- package/dist/core/disk/write.d.ts.map +1 -1
- package/dist/core/disk/write.js +22 -16
- package/dist/core/disk/write.js.map +1 -1
- package/dist/core/email/_parse.d.ts +60 -12
- package/dist/core/email/_parse.d.ts.map +1 -1
- package/dist/core/email/_parse.js +2 -2
- package/dist/core/email/_parse.js.map +1 -1
- package/dist/core/email/client.d.ts +36 -9
- package/dist/core/email/client.d.ts.map +1 -1
- package/dist/core/email/client.js +15 -0
- package/dist/core/email/client.js.map +1 -1
- package/dist/core/email/config.d.ts +6 -9
- package/dist/core/email/config.d.ts.map +1 -1
- package/dist/core/email/config.js +31 -27
- package/dist/core/email/config.js.map +1 -1
- package/dist/core/email/readdir.d.ts +2 -2
- package/dist/core/email/readdir.d.ts.map +1 -1
- package/dist/core/email/readdir.js +1 -1
- package/dist/core/email/readdir.js.map +1 -1
- package/dist/core/email/render.d.ts +5 -5
- package/dist/core/email/render.d.ts.map +1 -1
- package/dist/core/email/render.js.map +1 -1
- package/dist/core/email/search.d.ts +2 -2
- package/dist/core/email/search.d.ts.map +1 -1
- package/dist/core/email/search.js +1 -1
- package/dist/core/email/search.js.map +1 -1
- package/dist/core/gridfs/client.d.ts +25 -2
- package/dist/core/gridfs/client.d.ts.map +1 -1
- package/dist/core/gridfs/client.js +74 -7
- package/dist/core/gridfs/client.js.map +1 -1
- package/dist/core/gridfs/constants.d.ts +1 -0
- package/dist/core/gridfs/constants.d.ts.map +1 -1
- package/dist/core/gridfs/constants.js +5 -0
- package/dist/core/gridfs/constants.js.map +1 -1
- package/dist/core/gridfs/driver.d.ts +1 -0
- package/dist/core/gridfs/driver.d.ts.map +1 -1
- package/dist/core/gridfs/driver.js +80 -67
- package/dist/core/gridfs/driver.js.map +1 -1
- package/dist/core/gridfs/events.d.ts +8 -3
- package/dist/core/gridfs/events.d.ts.map +1 -1
- package/dist/core/gridfs/events.js +11 -3
- package/dist/core/gridfs/events.js.map +1 -1
- package/dist/core/gridfs/read.d.ts +2 -7
- package/dist/core/gridfs/read.d.ts.map +1 -1
- package/dist/core/gridfs/read.js +4 -9
- package/dist/core/gridfs/read.js.map +1 -1
- package/dist/core/gridfs/stream.d.ts.map +1 -1
- package/dist/core/gridfs/stream.js +5 -2
- package/dist/core/gridfs/stream.js.map +1 -1
- package/dist/core/gridfs/write.d.ts +1 -1
- package/dist/core/gridfs/write.d.ts.map +1 -1
- package/dist/core/gridfs/write.js +2 -2
- package/dist/core/gridfs/write.js.map +1 -1
- package/dist/core/hf_buckets/driver.d.ts.map +1 -1
- package/dist/core/hf_buckets/driver.js +16 -0
- package/dist/core/hf_buckets/driver.js.map +1 -1
- package/dist/core/hf_buckets/read.d.ts +2 -6
- package/dist/core/hf_buckets/read.d.ts.map +1 -1
- package/dist/core/hf_buckets/read.js +1 -1
- package/dist/core/hf_buckets/read.js.map +1 -1
- package/dist/core/hf_buckets/stream.d.ts.map +1 -1
- package/dist/core/hf_buckets/stream.js +2 -0
- package/dist/core/hf_buckets/stream.js.map +1 -1
- package/dist/core/hf_hub/admin.d.ts +3 -4
- package/dist/core/hf_hub/admin.d.ts.map +1 -1
- package/dist/core/hf_hub/admin.js +4 -4
- package/dist/core/hf_hub/admin.js.map +1 -1
- package/dist/core/hf_hub/client.d.ts +11 -24
- package/dist/core/hf_hub/client.d.ts.map +1 -1
- package/dist/core/hf_hub/client.js +40 -97
- package/dist/core/hf_hub/client.js.map +1 -1
- package/dist/core/hf_hub/commit.d.ts +8 -9
- package/dist/core/hf_hub/commit.d.ts.map +1 -1
- package/dist/core/hf_hub/commit.js +4 -6
- package/dist/core/hf_hub/commit.js.map +1 -1
- package/dist/core/hf_hub/config.d.ts +5 -4
- package/dist/core/hf_hub/config.d.ts.map +1 -1
- package/dist/core/hf_hub/config.js +3 -1
- package/dist/core/hf_hub/config.js.map +1 -1
- package/dist/core/hf_hub/constants.d.ts +0 -1
- package/dist/core/hf_hub/constants.d.ts.map +1 -1
- package/dist/core/hf_hub/constants.js +0 -1
- package/dist/core/hf_hub/constants.js.map +1 -1
- package/dist/core/hf_hub/read.d.ts +2 -5
- package/dist/core/hf_hub/read.d.ts.map +1 -1
- package/dist/core/hf_hub/read.js.map +1 -1
- package/dist/core/hf_hub/stream.d.ts.map +1 -1
- package/dist/core/hf_hub/stream.js +2 -0
- package/dist/core/hf_hub/stream.js.map +1 -1
- package/dist/core/nextcloud/capacity.js.map +1 -1
- package/dist/core/nextcloud/checksum.js +4 -3
- package/dist/core/nextcloud/checksum.js.map +1 -1
- package/dist/core/nextcloud/constants.d.ts +2 -0
- package/dist/core/nextcloud/constants.d.ts.map +1 -1
- package/dist/core/nextcloud/constants.js +4 -0
- package/dist/core/nextcloud/constants.js.map +1 -1
- package/dist/core/nextcloud/copy.js.map +1 -1
- package/dist/core/nextcloud/dav.d.ts +9 -3
- package/dist/core/nextcloud/dav.d.ts.map +1 -1
- package/dist/core/nextcloud/dav.js +20 -2
- package/dist/core/nextcloud/dav.js.map +1 -1
- package/dist/core/nextcloud/read.d.ts +2 -6
- package/dist/core/nextcloud/read.d.ts.map +1 -1
- package/dist/core/nextcloud/read.js +1 -1
- package/dist/core/nextcloud/read.js.map +1 -1
- package/dist/core/nextcloud/search/query.js +2 -2
- package/dist/core/nextcloud/search/query.js.map +1 -1
- package/dist/core/nextcloud/search/response.d.ts +3 -2
- package/dist/core/nextcloud/search/response.d.ts.map +1 -1
- package/dist/core/nextcloud/search/response.js +5 -5
- package/dist/core/nextcloud/search/response.js.map +1 -1
- package/dist/core/nextcloud/search/types.d.ts +1 -1
- package/dist/core/nextcloud/search/types.d.ts.map +1 -1
- package/dist/core/nextcloud/set_attrs.js.map +1 -1
- package/dist/core/nextcloud/stat.d.ts.map +1 -1
- package/dist/core/nextcloud/stat.js +7 -9
- package/dist/core/nextcloud/stat.js.map +1 -1
- package/dist/core/nextcloud/stream.d.ts.map +1 -1
- package/dist/core/nextcloud/stream.js +2 -0
- package/dist/core/nextcloud/stream.js.map +1 -1
- package/dist/core/nextcloud/write.d.ts +7 -1
- package/dist/core/nextcloud/write.d.ts.map +1 -1
- package/dist/core/nextcloud/write.js +81 -8
- package/dist/core/nextcloud/write.js.map +1 -1
- package/dist/core/ssh/append.d.ts +1 -2
- package/dist/core/ssh/append.d.ts.map +1 -1
- package/dist/core/ssh/append.js +1 -4
- package/dist/core/ssh/append.js.map +1 -1
- package/dist/core/ssh/checksum.d.ts.map +1 -1
- package/dist/core/ssh/checksum.js +1 -0
- package/dist/core/ssh/checksum.js.map +1 -1
- package/dist/core/ssh/rm.d.ts.map +1 -1
- package/dist/core/ssh/rm.js +15 -6
- package/dist/core/ssh/rm.js.map +1 -1
- package/dist/core/ssh/rmdir.d.ts.map +1 -1
- package/dist/core/ssh/rmdir.js +2 -22
- package/dist/core/ssh/rmdir.js.map +1 -1
- package/dist/core/ssh/set_attrs.d.ts +2 -9
- package/dist/core/ssh/set_attrs.d.ts.map +1 -1
- package/dist/core/ssh/set_attrs.js +1 -1
- package/dist/core/ssh/set_attrs.js.map +1 -1
- package/dist/core/ssh/stat.d.ts.map +1 -1
- package/dist/core/ssh/stat.js +5 -4
- package/dist/core/ssh/stat.js.map +1 -1
- package/dist/core/ssh/stream.d.ts.map +1 -1
- package/dist/core/ssh/stream.js +10 -1
- package/dist/core/ssh/stream.js.map +1 -1
- package/dist/core/ssh/utils.d.ts +8 -2
- package/dist/core/ssh/utils.d.ts.map +1 -1
- package/dist/core/ssh/utils.js +24 -3
- package/dist/core/ssh/utils.js.map +1 -1
- package/dist/core/ssh/write.d.ts +1 -2
- package/dist/core/ssh/write.d.ts.map +1 -1
- package/dist/core/ssh/write.js +1 -4
- package/dist/core/ssh/write.js.map +1 -1
- package/dist/fuse/constants.d.ts +3 -2
- package/dist/fuse/constants.d.ts.map +1 -1
- package/dist/fuse/constants.js +6 -3
- package/dist/fuse/constants.js.map +1 -1
- package/dist/fuse/fs.d.ts +1 -1
- package/dist/fuse/fs.d.ts.map +1 -1
- package/dist/fuse/fs.js +6 -3
- package/dist/fuse/fs.js.map +1 -1
- package/dist/fuse/mount.d.ts +5 -0
- package/dist/fuse/mount.d.ts.map +1 -1
- package/dist/fuse/mount.js +47 -15
- package/dist/fuse/mount.js.map +1 -1
- package/dist/index.d.ts +130 -159
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +86 -135
- package/dist/index.js.map +1 -1
- package/dist/io/gateway.d.ts +6 -0
- package/dist/io/gateway.d.ts.map +1 -0
- package/dist/io/gateway.js +357 -0
- package/dist/io/gateway.js.map +1 -0
- package/dist/io/network.d.ts +35 -0
- package/dist/io/network.d.ts.map +1 -0
- package/dist/io/network.js +187 -0
- package/dist/io/network.js.map +1 -0
- package/dist/io/spool.js +3 -3
- package/dist/io/spool.js.map +1 -1
- package/dist/mount/constants.d.ts +9 -2
- package/dist/mount/constants.d.ts.map +1 -1
- package/dist/mount/constants.js +9 -2
- package/dist/mount/constants.js.map +1 -1
- package/dist/mount/errors.d.ts +2 -11
- package/dist/mount/errors.d.ts.map +1 -1
- package/dist/mount/errors.js +28 -42
- package/dist/mount/errors.js.map +1 -1
- package/dist/mount/nfs.d.ts +2 -2
- package/dist/mount/nfs.d.ts.map +1 -1
- package/dist/mount/nfs.js +8 -20
- package/dist/mount/nfs.js.map +1 -1
- package/dist/mount/sftp.d.ts +3 -3
- package/dist/mount/sftp.d.ts.map +1 -1
- package/dist/mount/sftp.js +26 -53
- package/dist/mount/sftp.js.map +1 -1
- package/dist/observe/disk_store.js +1 -1
- package/dist/observe/disk_store.js.map +1 -1
- package/dist/runtime/js/host/constants.d.ts +1 -1
- package/dist/runtime/js/host/constants.d.ts.map +1 -1
- package/dist/runtime/js/host/constants.js +9 -8
- package/dist/runtime/js/host/constants.js.map +1 -1
- package/dist/runtime/js/host/descriptors.d.ts +11 -71
- package/dist/runtime/js/host/descriptors.d.ts.map +1 -1
- package/dist/runtime/js/host/descriptors.js +16 -202
- package/dist/runtime/js/host/descriptors.js.map +1 -1
- package/dist/runtime/js/host/fs.d.ts.map +1 -1
- package/dist/runtime/js/host/fs.js +491 -135
- package/dist/runtime/js/host/fs.js.map +1 -1
- package/dist/runtime/js/host/list.d.ts +21 -0
- package/dist/runtime/js/host/list.d.ts.map +1 -0
- package/dist/runtime/js/host/list.js +107 -0
- package/dist/runtime/js/host/list.js.map +1 -0
- package/dist/runtime/js/host/stat.d.ts +10 -0
- package/dist/runtime/js/host/stat.d.ts.map +1 -0
- package/dist/runtime/js/host/stat.js +70 -0
- package/dist/runtime/js/host/stat.js.map +1 -0
- package/dist/runtime/python/local/runtime.d.ts +8 -7
- package/dist/runtime/python/local/runtime.d.ts.map +1 -1
- package/dist/runtime/python/local/runtime.js +51 -74
- package/dist/runtime/python/local/runtime.js.map +1 -1
- package/dist/runtime/sandbox/apple_container/constants.d.ts +2 -3
- package/dist/runtime/sandbox/apple_container/constants.d.ts.map +1 -1
- package/dist/runtime/sandbox/apple_container/constants.js +4 -11
- package/dist/runtime/sandbox/apple_container/constants.js.map +1 -1
- package/dist/runtime/sandbox/apple_container/runtime.d.ts +13 -9
- package/dist/runtime/sandbox/apple_container/runtime.d.ts.map +1 -1
- package/dist/runtime/sandbox/apple_container/runtime.js +34 -41
- package/dist/runtime/sandbox/apple_container/runtime.js.map +1 -1
- package/dist/runtime/sandbox/daytona/runtime.d.ts +6 -4
- package/dist/runtime/sandbox/daytona/runtime.d.ts.map +1 -1
- package/dist/runtime/sandbox/daytona/runtime.js +9 -6
- package/dist/runtime/sandbox/daytona/runtime.js.map +1 -1
- package/dist/runtime/sandbox/docker/constants.d.ts +6 -1
- package/dist/runtime/sandbox/docker/constants.d.ts.map +1 -1
- package/dist/runtime/sandbox/docker/constants.js +6 -1
- package/dist/runtime/sandbox/docker/constants.js.map +1 -1
- package/dist/runtime/sandbox/docker/runtime.d.ts +8 -8
- package/dist/runtime/sandbox/docker/runtime.d.ts.map +1 -1
- package/dist/runtime/sandbox/docker/runtime.js +21 -25
- package/dist/runtime/sandbox/docker/runtime.js.map +1 -1
- package/dist/runtime/sandbox/microsandbox/constants.d.ts +1 -3
- package/dist/runtime/sandbox/microsandbox/constants.d.ts.map +1 -1
- package/dist/runtime/sandbox/microsandbox/constants.js +1 -5
- package/dist/runtime/sandbox/microsandbox/constants.js.map +1 -1
- package/dist/runtime/sandbox/microsandbox/runtime.d.ts +8 -8
- package/dist/runtime/sandbox/microsandbox/runtime.d.ts.map +1 -1
- package/dist/runtime/sandbox/microsandbox/runtime.js +22 -34
- package/dist/runtime/sandbox/microsandbox/runtime.js.map +1 -1
- package/dist/runtime/sandbox/program.d.ts +165 -0
- package/dist/runtime/sandbox/program.d.ts.map +1 -0
- package/dist/runtime/sandbox/program.js +724 -0
- package/dist/runtime/sandbox/program.js.map +1 -0
- package/dist/runtime/sandbox/sandlock/constants.d.ts +1 -1
- package/dist/runtime/sandbox/sandlock/constants.d.ts.map +1 -1
- package/dist/runtime/sandbox/sandlock/constants.js +1 -1
- package/dist/runtime/sandbox/sandlock/constants.js.map +1 -1
- package/dist/runtime/sandbox/sandlock/runtime.d.ts +5 -6
- package/dist/runtime/sandbox/sandlock/runtime.d.ts.map +1 -1
- package/dist/runtime/sandbox/sandlock/runtime.js +27 -16
- package/dist/runtime/sandbox/sandlock/runtime.js.map +1 -1
- package/dist/runtime/sandbox/smolvm/constants.d.ts +2 -3
- package/dist/runtime/sandbox/smolvm/constants.d.ts.map +1 -1
- package/dist/runtime/sandbox/smolvm/constants.js +6 -13
- package/dist/runtime/sandbox/smolvm/constants.js.map +1 -1
- package/dist/runtime/sandbox/smolvm/runtime.d.ts +8 -8
- package/dist/runtime/sandbox/smolvm/runtime.d.ts.map +1 -1
- package/dist/runtime/sandbox/smolvm/runtime.js +21 -27
- package/dist/runtime/sandbox/smolvm/runtime.js.map +1 -1
- package/dist/runtime/sandbox/ssh/runtime.d.ts +23 -12
- package/dist/runtime/sandbox/ssh/runtime.d.ts.map +1 -1
- package/dist/runtime/sandbox/ssh/runtime.js +85 -30
- package/dist/runtime/sandbox/ssh/runtime.js.map +1 -1
- package/dist/secrets/config.d.ts +2 -2
- package/dist/secrets/config.d.ts.map +1 -1
- package/dist/secrets/onepassword.d.ts +5 -8
- package/dist/secrets/onepassword.d.ts.map +1 -1
- package/dist/secrets/onepassword.js.map +1 -1
- package/dist/shell/console/redis/constants.d.ts +1 -0
- package/dist/shell/console/redis/constants.d.ts.map +1 -1
- package/dist/shell/console/redis/constants.js +3 -0
- package/dist/shell/console/redis/constants.js.map +1 -1
- package/dist/shell/console/redis/store.d.ts +24 -9
- package/dist/shell/console/redis/store.d.ts.map +1 -1
- package/dist/shell/console/redis/store.js +48 -16
- package/dist/shell/console/redis/store.js.map +1 -1
- package/dist/shell/job_table/redis.d.ts +52 -0
- package/dist/shell/job_table/redis.d.ts.map +1 -0
- package/dist/shell/job_table/redis.js +156 -0
- package/dist/shell/job_table/redis.js.map +1 -0
- package/dist/utils/loader.d.ts.map +1 -1
- package/dist/utils/loader.js +1 -3
- package/dist/utils/loader.js.map +1 -1
- package/dist/vfs/aliyun/aliyun.d.ts +4 -5
- package/dist/vfs/aliyun/aliyun.d.ts.map +1 -1
- package/dist/vfs/aliyun/aliyun.js +2 -4
- package/dist/vfs/aliyun/aliyun.js.map +1 -1
- package/dist/vfs/aliyun/config.d.ts +40 -6
- package/dist/vfs/aliyun/config.d.ts.map +1 -1
- package/dist/vfs/aliyun/config.js +5 -6
- package/dist/vfs/aliyun/config.js.map +1 -1
- package/dist/vfs/backblaze/backblaze.d.ts +4 -5
- package/dist/vfs/backblaze/backblaze.d.ts.map +1 -1
- package/dist/vfs/backblaze/backblaze.js +2 -4
- package/dist/vfs/backblaze/backblaze.js.map +1 -1
- package/dist/vfs/backblaze/config.d.ts +40 -6
- package/dist/vfs/backblaze/config.d.ts.map +1 -1
- package/dist/vfs/backblaze/config.js +5 -6
- package/dist/vfs/backblaze/config.js.map +1 -1
- package/dist/vfs/ceph/ceph.d.ts +4 -5
- package/dist/vfs/ceph/ceph.d.ts.map +1 -1
- package/dist/vfs/ceph/ceph.js +2 -4
- package/dist/vfs/ceph/ceph.js.map +1 -1
- package/dist/vfs/ceph/config.d.ts +42 -5
- package/dist/vfs/ceph/config.d.ts.map +1 -1
- package/dist/vfs/ceph/config.js +7 -5
- package/dist/vfs/ceph/config.js.map +1 -1
- package/dist/vfs/databricks_volume/config.d.ts +2 -2
- package/dist/vfs/databricks_volume/config.d.ts.map +1 -1
- package/dist/vfs/databricks_volume/config.js +1 -1
- package/dist/vfs/databricks_volume/config.js.map +1 -1
- package/dist/vfs/databricks_volume/databricks_volume.d.ts +6 -9
- package/dist/vfs/databricks_volume/databricks_volume.d.ts.map +1 -1
- package/dist/vfs/databricks_volume/databricks_volume.js +4 -9
- package/dist/vfs/databricks_volume/databricks_volume.js.map +1 -1
- package/dist/vfs/digitalocean/config.d.ts +40 -6
- package/dist/vfs/digitalocean/config.d.ts.map +1 -1
- package/dist/vfs/digitalocean/config.js +5 -6
- package/dist/vfs/digitalocean/config.js.map +1 -1
- package/dist/vfs/digitalocean/digitalocean.d.ts +4 -5
- package/dist/vfs/digitalocean/digitalocean.d.ts.map +1 -1
- package/dist/vfs/digitalocean/digitalocean.js +2 -4
- package/dist/vfs/digitalocean/digitalocean.js.map +1 -1
- package/dist/vfs/discord/discord.d.ts +7 -10
- package/dist/vfs/discord/discord.d.ts.map +1 -1
- package/dist/vfs/discord/discord.js +7 -12
- package/dist/vfs/discord/discord.js.map +1 -1
- package/dist/vfs/disk/disk.d.ts +14 -14
- package/dist/vfs/disk/disk.d.ts.map +1 -1
- package/dist/vfs/disk/disk.js +87 -52
- package/dist/vfs/disk/disk.js.map +1 -1
- package/dist/vfs/dropbox/config.d.ts +7 -12
- package/dist/vfs/dropbox/config.d.ts.map +1 -1
- package/dist/vfs/dropbox/config.js +18 -15
- package/dist/vfs/dropbox/config.js.map +1 -1
- package/dist/vfs/email/email.d.ts +13 -11
- package/dist/vfs/email/email.d.ts.map +1 -1
- package/dist/vfs/email/email.js +31 -16
- package/dist/vfs/email/email.js.map +1 -1
- package/dist/vfs/email/index.d.ts +1 -2
- package/dist/vfs/email/index.d.ts.map +1 -1
- package/dist/vfs/email/index.js +1 -2
- package/dist/vfs/email/index.js.map +1 -1
- package/dist/vfs/gcs/config.d.ts +36 -28
- package/dist/vfs/gcs/config.d.ts.map +1 -1
- package/dist/vfs/gcs/config.js +15 -39
- package/dist/vfs/gcs/config.js.map +1 -1
- package/dist/vfs/gcs/gcs.d.ts +4 -5
- package/dist/vfs/gcs/gcs.d.ts.map +1 -1
- package/dist/vfs/gcs/gcs.js +2 -4
- package/dist/vfs/gcs/gcs.js.map +1 -1
- package/dist/vfs/gridfs/config.d.ts +6 -7
- package/dist/vfs/gridfs/config.d.ts.map +1 -1
- package/dist/vfs/gridfs/config.js +25 -11
- package/dist/vfs/gridfs/config.js.map +1 -1
- package/dist/vfs/gridfs/gridfs.d.ts +10 -18
- package/dist/vfs/gridfs/gridfs.d.ts.map +1 -1
- package/dist/vfs/gridfs/gridfs.js +23 -40
- package/dist/vfs/gridfs/gridfs.js.map +1 -1
- package/dist/vfs/hf_buckets/config.d.ts +14 -17
- package/dist/vfs/hf_buckets/config.d.ts.map +1 -1
- package/dist/vfs/hf_buckets/config.js +41 -28
- package/dist/vfs/hf_buckets/config.js.map +1 -1
- package/dist/vfs/hf_buckets/hf_buckets.d.ts +10 -15
- package/dist/vfs/hf_buckets/hf_buckets.d.ts.map +1 -1
- package/dist/vfs/hf_buckets/hf_buckets.js +14 -22
- package/dist/vfs/hf_buckets/hf_buckets.js.map +1 -1
- package/dist/vfs/hf_datasets/config.d.ts +1 -4
- package/dist/vfs/hf_datasets/config.d.ts.map +1 -1
- package/dist/vfs/hf_datasets/config.js +1 -3
- package/dist/vfs/hf_datasets/config.js.map +1 -1
- package/dist/vfs/hf_datasets/hf_datasets.d.ts +4 -7
- package/dist/vfs/hf_datasets/hf_datasets.d.ts.map +1 -1
- package/dist/vfs/hf_datasets/hf_datasets.js +4 -6
- package/dist/vfs/hf_datasets/hf_datasets.js.map +1 -1
- package/dist/vfs/hf_hub/base.d.ts +4 -8
- package/dist/vfs/hf_hub/base.d.ts.map +1 -1
- package/dist/vfs/hf_hub/base.js +7 -11
- package/dist/vfs/hf_hub/base.js.map +1 -1
- package/dist/vfs/hf_models/config.d.ts +1 -4
- package/dist/vfs/hf_models/config.d.ts.map +1 -1
- package/dist/vfs/hf_models/config.js +1 -3
- package/dist/vfs/hf_models/config.js.map +1 -1
- package/dist/vfs/hf_models/hf_models.d.ts +4 -7
- package/dist/vfs/hf_models/hf_models.d.ts.map +1 -1
- package/dist/vfs/hf_models/hf_models.js +4 -6
- package/dist/vfs/hf_models/hf_models.js.map +1 -1
- package/dist/vfs/hf_spaces/config.d.ts +1 -4
- package/dist/vfs/hf_spaces/config.d.ts.map +1 -1
- package/dist/vfs/hf_spaces/config.js +1 -3
- package/dist/vfs/hf_spaces/config.js.map +1 -1
- package/dist/vfs/hf_spaces/hf_spaces.d.ts +4 -7
- package/dist/vfs/hf_spaces/hf_spaces.d.ts.map +1 -1
- package/dist/vfs/hf_spaces/hf_spaces.js +4 -6
- package/dist/vfs/hf_spaces/hf_spaces.js.map +1 -1
- package/dist/vfs/jaeger/jaeger.d.ts +7 -9
- package/dist/vfs/jaeger/jaeger.d.ts.map +1 -1
- package/dist/vfs/jaeger/jaeger.js +7 -11
- package/dist/vfs/jaeger/jaeger.js.map +1 -1
- package/dist/vfs/lancedb/lancedb.d.ts +10 -11
- package/dist/vfs/lancedb/lancedb.d.ts.map +1 -1
- package/dist/vfs/lancedb/lancedb.js +4 -5
- package/dist/vfs/lancedb/lancedb.js.map +1 -1
- package/dist/vfs/lancedb/store.d.ts +2 -2
- package/dist/vfs/lancedb/store.d.ts.map +1 -1
- package/dist/vfs/lancedb/store.js +3 -0
- package/dist/vfs/lancedb/store.js.map +1 -1
- package/dist/vfs/minio/config.d.ts +42 -5
- package/dist/vfs/minio/config.d.ts.map +1 -1
- package/dist/vfs/minio/config.js +7 -5
- package/dist/vfs/minio/config.js.map +1 -1
- package/dist/vfs/minio/minio.d.ts +4 -5
- package/dist/vfs/minio/minio.d.ts.map +1 -1
- package/dist/vfs/minio/minio.js +2 -4
- package/dist/vfs/minio/minio.js.map +1 -1
- package/dist/vfs/mongodb/mongodb.d.ts +10 -11
- package/dist/vfs/mongodb/mongodb.d.ts.map +1 -1
- package/dist/vfs/mongodb/mongodb.js +6 -7
- package/dist/vfs/mongodb/mongodb.js.map +1 -1
- package/dist/vfs/mongodb/store.d.ts +2 -1
- package/dist/vfs/mongodb/store.d.ts.map +1 -1
- package/dist/vfs/mongodb/store.js +11 -3
- package/dist/vfs/mongodb/store.js.map +1 -1
- package/dist/vfs/nextcloud/config.d.ts +5 -8
- package/dist/vfs/nextcloud/config.d.ts.map +1 -1
- package/dist/vfs/nextcloud/config.js +19 -13
- package/dist/vfs/nextcloud/config.js.map +1 -1
- package/dist/vfs/nextcloud/nextcloud.d.ts +8 -14
- package/dist/vfs/nextcloud/nextcloud.d.ts.map +1 -1
- package/dist/vfs/nextcloud/nextcloud.js +18 -29
- package/dist/vfs/nextcloud/nextcloud.js.map +1 -1
- package/dist/vfs/notion/notion.d.ts +7 -10
- package/dist/vfs/notion/notion.d.ts.map +1 -1
- package/dist/vfs/notion/notion.js +7 -10
- package/dist/vfs/notion/notion.js.map +1 -1
- package/dist/vfs/oci/config.d.ts +41 -27
- package/dist/vfs/oci/config.d.ts.map +1 -1
- package/dist/vfs/oci/config.js +18 -45
- package/dist/vfs/oci/config.js.map +1 -1
- package/dist/vfs/oci/oci.d.ts +4 -5
- package/dist/vfs/oci/oci.d.ts.map +1 -1
- package/dist/vfs/oci/oci.js +2 -4
- package/dist/vfs/oci/oci.js.map +1 -1
- package/dist/vfs/postgres/postgres.d.ts +10 -11
- package/dist/vfs/postgres/postgres.d.ts.map +1 -1
- package/dist/vfs/postgres/postgres.js +5 -6
- package/dist/vfs/postgres/postgres.js.map +1 -1
- package/dist/vfs/postgres/store.d.ts +3 -3
- package/dist/vfs/postgres/store.d.ts.map +1 -1
- package/dist/vfs/postgres/store.js +1 -0
- package/dist/vfs/postgres/store.js.map +1 -1
- package/dist/vfs/qingstor/config.d.ts +40 -6
- package/dist/vfs/qingstor/config.d.ts.map +1 -1
- package/dist/vfs/qingstor/config.js +5 -6
- package/dist/vfs/qingstor/config.js.map +1 -1
- package/dist/vfs/qingstor/qingstor.d.ts +4 -5
- package/dist/vfs/qingstor/qingstor.d.ts.map +1 -1
- package/dist/vfs/qingstor/qingstor.js +2 -4
- package/dist/vfs/qingstor/qingstor.js.map +1 -1
- package/dist/vfs/r2/config.d.ts +39 -28
- package/dist/vfs/r2/config.d.ts.map +1 -1
- package/dist/vfs/r2/config.js +24 -48
- package/dist/vfs/r2/config.js.map +1 -1
- package/dist/vfs/r2/r2.d.ts +4 -5
- package/dist/vfs/r2/r2.d.ts.map +1 -1
- package/dist/vfs/r2/r2.js +2 -4
- package/dist/vfs/r2/r2.js.map +1 -1
- package/dist/vfs/redis/redis.d.ts +3 -0
- package/dist/vfs/redis/redis.d.ts.map +1 -1
- package/dist/vfs/redis/redis.js +1 -1
- package/dist/vfs/redis/redis.js.map +1 -1
- package/dist/vfs/redis/store.d.ts +2 -0
- package/dist/vfs/redis/store.d.ts.map +1 -1
- package/dist/vfs/redis/store.js +13 -2
- package/dist/vfs/redis/store.js.map +1 -1
- package/dist/vfs/registry.d.ts.map +1 -1
- package/dist/vfs/registry.js +111 -105
- package/dist/vfs/registry.js.map +1 -1
- package/dist/vfs/s3/config.d.ts +12 -23
- package/dist/vfs/s3/config.d.ts.map +1 -1
- package/dist/vfs/s3/config.js +16 -31
- package/dist/vfs/s3/config.js.map +1 -1
- package/dist/vfs/s3/s3.d.ts +6 -9
- package/dist/vfs/s3/s3.d.ts.map +1 -1
- package/dist/vfs/s3/s3.js +11 -14
- package/dist/vfs/s3/s3.js.map +1 -1
- package/dist/vfs/s3_alias.d.ts +69 -53
- package/dist/vfs/s3_alias.d.ts.map +1 -1
- package/dist/vfs/s3_alias.js +86 -82
- package/dist/vfs/s3_alias.js.map +1 -1
- package/dist/vfs/scaleway/config.d.ts +40 -6
- package/dist/vfs/scaleway/config.d.ts.map +1 -1
- package/dist/vfs/scaleway/config.js +5 -6
- package/dist/vfs/scaleway/config.js.map +1 -1
- package/dist/vfs/scaleway/scaleway.d.ts +4 -5
- package/dist/vfs/scaleway/scaleway.d.ts.map +1 -1
- package/dist/vfs/scaleway/scaleway.js +2 -4
- package/dist/vfs/scaleway/scaleway.js.map +1 -1
- package/dist/vfs/seaweedfs/config.d.ts +42 -5
- package/dist/vfs/seaweedfs/config.d.ts.map +1 -1
- package/dist/vfs/seaweedfs/config.js +7 -5
- package/dist/vfs/seaweedfs/config.js.map +1 -1
- package/dist/vfs/seaweedfs/seaweedfs.d.ts +4 -5
- package/dist/vfs/seaweedfs/seaweedfs.d.ts.map +1 -1
- package/dist/vfs/seaweedfs/seaweedfs.js +2 -4
- package/dist/vfs/seaweedfs/seaweedfs.js.map +1 -1
- package/dist/vfs/slack/slack.d.ts +7 -10
- package/dist/vfs/slack/slack.d.ts.map +1 -1
- package/dist/vfs/slack/slack.js +7 -12
- package/dist/vfs/slack/slack.js.map +1 -1
- package/dist/vfs/ssh/config.d.ts +5 -9
- package/dist/vfs/ssh/config.d.ts.map +1 -1
- package/dist/vfs/ssh/config.js +28 -18
- package/dist/vfs/ssh/config.js.map +1 -1
- package/dist/vfs/ssh/ssh.d.ts +8 -17
- package/dist/vfs/ssh/ssh.d.ts.map +1 -1
- package/dist/vfs/ssh/ssh.js +25 -43
- package/dist/vfs/ssh/ssh.js.map +1 -1
- package/dist/vfs/supabase/config.d.ts +40 -27
- package/dist/vfs/supabase/config.d.ts.map +1 -1
- package/dist/vfs/supabase/config.js +24 -48
- package/dist/vfs/supabase/config.js.map +1 -1
- package/dist/vfs/supabase/supabase.d.ts +4 -5
- package/dist/vfs/supabase/supabase.d.ts.map +1 -1
- package/dist/vfs/supabase/supabase.js +2 -4
- package/dist/vfs/supabase/supabase.js.map +1 -1
- package/dist/vfs/tencent/config.d.ts +40 -6
- package/dist/vfs/tencent/config.d.ts.map +1 -1
- package/dist/vfs/tencent/config.js +5 -6
- package/dist/vfs/tencent/config.js.map +1 -1
- package/dist/vfs/tencent/tencent.d.ts +4 -5
- package/dist/vfs/tencent/tencent.d.ts.map +1 -1
- package/dist/vfs/tencent/tencent.js +2 -4
- package/dist/vfs/tencent/tencent.js.map +1 -1
- package/dist/vfs/tidb_filesystem/config.d.ts +2 -0
- package/dist/vfs/tidb_filesystem/config.d.ts.map +1 -0
- package/dist/{mount/types.js → vfs/tidb_filesystem/config.js} +2 -2
- package/dist/vfs/tidb_filesystem/config.js.map +1 -0
- package/dist/vfs/tidb_filesystem/tidb_filesystem.d.ts +16 -0
- package/dist/vfs/tidb_filesystem/tidb_filesystem.d.ts.map +1 -0
- package/dist/vfs/tidb_filesystem/tidb_filesystem.js +39 -0
- package/dist/vfs/tidb_filesystem/tidb_filesystem.js.map +1 -0
- package/dist/vfs/wasabi/config.d.ts +35 -28
- package/dist/vfs/wasabi/config.d.ts.map +1 -1
- package/dist/vfs/wasabi/config.js +20 -45
- package/dist/vfs/wasabi/config.js.map +1 -1
- package/dist/vfs/wasabi/wasabi.d.ts +4 -5
- package/dist/vfs/wasabi/wasabi.d.ts.map +1 -1
- package/dist/vfs/wasabi/wasabi.js +2 -4
- package/dist/vfs/wasabi/wasabi.js.map +1 -1
- package/dist/workspace/{session → mount/namespace}/cas.lua +7 -2
- package/dist/workspace/mount/namespace/disk.d.ts +12 -7
- package/dist/workspace/mount/namespace/disk.d.ts.map +1 -1
- package/dist/workspace/mount/namespace/disk.js +37 -21
- package/dist/workspace/mount/namespace/disk.js.map +1 -1
- package/dist/workspace/mount/namespace/redis.d.ts +14 -9
- package/dist/workspace/mount/namespace/redis.d.ts.map +1 -1
- package/dist/workspace/mount/namespace/redis.js +29 -14
- package/dist/workspace/mount/namespace/redis.js.map +1 -1
- package/dist/workspace/nfs.d.ts.map +1 -1
- package/dist/workspace/nfs.js +3 -1
- package/dist/workspace/nfs.js.map +1 -1
- package/dist/workspace/record/disk.d.ts +12 -5
- package/dist/workspace/record/disk.d.ts.map +1 -1
- package/dist/workspace/record/disk.js +119 -72
- package/dist/workspace/record/disk.js.map +1 -1
- package/dist/workspace/store/disk.d.ts +12 -5
- package/dist/workspace/store/disk.d.ts.map +1 -1
- package/dist/workspace/store/disk.js +20 -4
- package/dist/workspace/store/disk.js.map +1 -1
- package/dist/workspace/store/redis.d.ts +13 -7
- package/dist/workspace/store/redis.d.ts.map +1 -1
- package/dist/workspace/store/redis.js +53 -26
- package/dist/workspace/store/redis.js.map +1 -1
- package/dist/workspace.d.ts +3 -1
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +22 -21
- package/dist/workspace.js.map +1 -1
- package/package.json +13 -17
- package/dist/compression_codecs.d.ts +0 -2
- package/dist/compression_codecs.d.ts.map +0 -1
- package/dist/compression_codecs.js +0 -42
- package/dist/compression_codecs.js.map +0 -1
- package/dist/core/disk/append.d.ts +0 -4
- package/dist/core/disk/append.d.ts.map +0 -1
- package/dist/core/disk/append.js +0 -30
- package/dist/core/disk/append.js.map +0 -1
- package/dist/mount/core.d.ts +0 -313
- package/dist/mount/core.d.ts.map +0 -1
- package/dist/mount/core.js +0 -916
- package/dist/mount/core.js.map +0 -1
- package/dist/mount/platform/macos.d.ts +0 -2
- package/dist/mount/platform/macos.d.ts.map +0 -1
- package/dist/mount/platform/macos.js +0 -23
- package/dist/mount/platform/macos.js.map +0 -1
- package/dist/mount/types.d.ts +0 -37
- package/dist/mount/types.d.ts.map +0 -1
- package/dist/mount/types.js.map +0 -1
- package/dist/observe/redis_store.d.ts +0 -27
- package/dist/observe/redis_store.d.ts.map +0 -1
- package/dist/observe/redis_store.js +0 -81
- package/dist/observe/redis_store.js.map +0 -1
- package/dist/runtime/sandbox/cli.d.ts +0 -71
- package/dist/runtime/sandbox/cli.d.ts.map +0 -1
- package/dist/runtime/sandbox/cli.js +0 -283
- package/dist/runtime/sandbox/cli.js.map +0 -1
- package/dist/vfs/aliyun/prompt.d.ts +0 -2
- package/dist/vfs/aliyun/prompt.d.ts.map +0 -1
- package/dist/vfs/aliyun/prompt.js +0 -19
- package/dist/vfs/aliyun/prompt.js.map +0 -1
- package/dist/vfs/backblaze/prompt.d.ts +0 -2
- package/dist/vfs/backblaze/prompt.d.ts.map +0 -1
- package/dist/vfs/backblaze/prompt.js +0 -19
- package/dist/vfs/backblaze/prompt.js.map +0 -1
- package/dist/vfs/ceph/prompt.d.ts +0 -2
- package/dist/vfs/ceph/prompt.d.ts.map +0 -1
- package/dist/vfs/ceph/prompt.js +0 -19
- package/dist/vfs/ceph/prompt.js.map +0 -1
- package/dist/vfs/digitalocean/prompt.d.ts +0 -2
- package/dist/vfs/digitalocean/prompt.d.ts.map +0 -1
- package/dist/vfs/digitalocean/prompt.js +0 -19
- package/dist/vfs/digitalocean/prompt.js.map +0 -1
- package/dist/vfs/disk/prompt.d.ts +0 -2
- package/dist/vfs/disk/prompt.d.ts.map +0 -1
- package/dist/vfs/disk/prompt.js +0 -17
- package/dist/vfs/disk/prompt.js.map +0 -1
- package/dist/vfs/email/prompt.d.ts +0 -3
- package/dist/vfs/email/prompt.d.ts.map +0 -1
- package/dist/vfs/email/prompt.js +0 -29
- package/dist/vfs/email/prompt.js.map +0 -1
- package/dist/vfs/gcs/prompt.d.ts +0 -2
- package/dist/vfs/gcs/prompt.d.ts.map +0 -1
- package/dist/vfs/gcs/prompt.js +0 -19
- package/dist/vfs/gcs/prompt.js.map +0 -1
- package/dist/vfs/gridfs/prompt.d.ts +0 -2
- package/dist/vfs/gridfs/prompt.d.ts.map +0 -1
- package/dist/vfs/gridfs/prompt.js +0 -19
- package/dist/vfs/gridfs/prompt.js.map +0 -1
- package/dist/vfs/hf_buckets/prompt.d.ts +0 -2
- package/dist/vfs/hf_buckets/prompt.d.ts.map +0 -1
- package/dist/vfs/hf_buckets/prompt.js +0 -18
- package/dist/vfs/hf_buckets/prompt.js.map +0 -1
- package/dist/vfs/hf_datasets/prompt.d.ts +0 -2
- package/dist/vfs/hf_datasets/prompt.d.ts.map +0 -1
- package/dist/vfs/hf_datasets/prompt.js +0 -18
- package/dist/vfs/hf_datasets/prompt.js.map +0 -1
- package/dist/vfs/hf_models/prompt.d.ts +0 -2
- package/dist/vfs/hf_models/prompt.d.ts.map +0 -1
- package/dist/vfs/hf_models/prompt.js +0 -18
- package/dist/vfs/hf_models/prompt.js.map +0 -1
- package/dist/vfs/hf_spaces/prompt.d.ts +0 -2
- package/dist/vfs/hf_spaces/prompt.d.ts.map +0 -1
- package/dist/vfs/hf_spaces/prompt.js +0 -18
- package/dist/vfs/hf_spaces/prompt.js.map +0 -1
- package/dist/vfs/jaeger/config.d.ts +0 -15
- package/dist/vfs/jaeger/config.d.ts.map +0 -1
- package/dist/vfs/jaeger/config.js +0 -28
- package/dist/vfs/jaeger/config.js.map +0 -1
- package/dist/vfs/minio/prompt.d.ts +0 -2
- package/dist/vfs/minio/prompt.d.ts.map +0 -1
- package/dist/vfs/minio/prompt.js +0 -19
- package/dist/vfs/minio/prompt.js.map +0 -1
- package/dist/vfs/nextcloud/prompt.d.ts +0 -2
- package/dist/vfs/nextcloud/prompt.d.ts.map +0 -1
- package/dist/vfs/nextcloud/prompt.js +0 -6
- package/dist/vfs/nextcloud/prompt.js.map +0 -1
- package/dist/vfs/oci/prompt.d.ts +0 -2
- package/dist/vfs/oci/prompt.d.ts.map +0 -1
- package/dist/vfs/oci/prompt.js +0 -19
- package/dist/vfs/oci/prompt.js.map +0 -1
- package/dist/vfs/qingstor/prompt.d.ts +0 -2
- package/dist/vfs/qingstor/prompt.d.ts.map +0 -1
- package/dist/vfs/qingstor/prompt.js +0 -19
- package/dist/vfs/qingstor/prompt.js.map +0 -1
- package/dist/vfs/r2/prompt.d.ts +0 -2
- package/dist/vfs/r2/prompt.d.ts.map +0 -1
- package/dist/vfs/r2/prompt.js +0 -19
- package/dist/vfs/r2/prompt.js.map +0 -1
- package/dist/vfs/scaleway/prompt.d.ts +0 -2
- package/dist/vfs/scaleway/prompt.d.ts.map +0 -1
- package/dist/vfs/scaleway/prompt.js +0 -19
- package/dist/vfs/scaleway/prompt.js.map +0 -1
- package/dist/vfs/seaweedfs/prompt.d.ts +0 -2
- package/dist/vfs/seaweedfs/prompt.d.ts.map +0 -1
- package/dist/vfs/seaweedfs/prompt.js +0 -19
- package/dist/vfs/seaweedfs/prompt.js.map +0 -1
- package/dist/vfs/ssh/prompt.d.ts +0 -2
- package/dist/vfs/ssh/prompt.d.ts.map +0 -1
- package/dist/vfs/ssh/prompt.js +0 -18
- package/dist/vfs/ssh/prompt.js.map +0 -1
- package/dist/vfs/supabase/prompt.d.ts +0 -2
- package/dist/vfs/supabase/prompt.d.ts.map +0 -1
- package/dist/vfs/supabase/prompt.js +0 -19
- package/dist/vfs/supabase/prompt.js.map +0 -1
- package/dist/vfs/tencent/prompt.d.ts +0 -2
- package/dist/vfs/tencent/prompt.d.ts.map +0 -1
- package/dist/vfs/tencent/prompt.js +0 -19
- package/dist/vfs/tencent/prompt.js.map +0 -1
- package/dist/vfs/wasabi/prompt.d.ts +0 -2
- package/dist/vfs/wasabi/prompt.d.ts.map +0 -1
- package/dist/vfs/wasabi/prompt.js +0 -19
- package/dist/vfs/wasabi/prompt.js.map +0 -1
- package/dist/workspace/session/disk.d.ts +0 -13
- package/dist/workspace/session/disk.d.ts.map +0 -1
- package/dist/workspace/session/disk.js +0 -29
- package/dist/workspace/session/disk.js.map +0 -1
- package/dist/workspace/session/redis.d.ts +0 -31
- package/dist/workspace/session/redis.d.ts.map +0 -1
- package/dist/workspace/session/redis.js +0 -87
- package/dist/workspace/session/redis.js.map +0 -1
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
|
|
14
|
+
import { execFile, spawn } from 'node:child_process';
|
|
15
|
+
import { constants, hostname } from 'node:os';
|
|
16
|
+
import { once } from 'node:events';
|
|
17
|
+
import { constants as fsConstants, realpathSync } from 'node:fs';
|
|
18
|
+
import { access, open, stat } from 'node:fs/promises';
|
|
19
|
+
import { basename, delimiter, dirname, join, resolve } from 'node:path';
|
|
20
|
+
import { Readable } from 'node:stream';
|
|
21
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
22
|
+
import { EXEC_PRELUDE, HOST_START_SLACK_SECONDS, PIPE_DIAGNOSTIC_BYTES, PIPE_DIAGNOSTIC_WAIT_SECONDS, STOP_GRACE_SECONDS, STOP_POLL_SECONDS, stopSignal, } from '@struktoai/mirage-core/runtime/sandbox/constants';
|
|
23
|
+
import { currentCaller } from '@struktoai/mirage-core/context/session_context';
|
|
24
|
+
import { debuglog } from 'node:util';
|
|
25
|
+
import { asyncChain, closeQuietly } from '@struktoai/mirage-core/io/stream';
|
|
26
|
+
import { abortable, makeAbortError } from '@struktoai/mirage-core/utils/abort';
|
|
27
|
+
import { shellJoin } from '@struktoai/mirage-core/shell/join';
|
|
28
|
+
import { rstripSlash } from '@struktoai/mirage-core/utils/slash';
|
|
29
|
+
import { CANNOT_EXECUTE_STATUS } from '@struktoai/mirage-core/shell/constants';
|
|
30
|
+
import { boundSystemClock } from '@struktoai/mirage-core/utils/clock';
|
|
31
|
+
import { FAKETIME_LIBRARIES, faketimeEnv } from '@struktoai/mirage-core/runtime/sandbox/constants';
|
|
32
|
+
/**
|
|
33
|
+
* What a process on this host needs to read the running workspace's system
|
|
34
|
+
* time (`faketimeEnv`). Empty when the workspace keeps the host's time, and
|
|
35
|
+
* when this host has no libfaketime, where the process runs on the host's
|
|
36
|
+
* clock. `env` is the process's environment, whose `LD_PRELOAD` libraries
|
|
37
|
+
* load after libfaketime. Mirrors Python's `system_time_env`.
|
|
38
|
+
*/
|
|
39
|
+
export async function systemTimeEnv(env) {
|
|
40
|
+
if (boundSystemClock() === null)
|
|
41
|
+
return {};
|
|
42
|
+
const library = process.platform === 'linux' ? await faketimeLibrary() : null;
|
|
43
|
+
if (library === null) {
|
|
44
|
+
debuglog('mirage')('libfaketime: none found, so the process runs on the host clock');
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
return faketimeEnv(library, env);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The first libfaketime this host has, null for none. Asynchronous, so a
|
|
51
|
+
* candidate on this process's own FUSE folder never blocks the loop that
|
|
52
|
+
* answers it; one that cannot be read is passed over.
|
|
53
|
+
*/
|
|
54
|
+
async function faketimeLibrary() {
|
|
55
|
+
for (const path of FAKETIME_LIBRARIES) {
|
|
56
|
+
try {
|
|
57
|
+
if ((await stat(path)).isFile())
|
|
58
|
+
return path;
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
const code = err.code;
|
|
62
|
+
if (code === undefined)
|
|
63
|
+
throw err;
|
|
64
|
+
debuglog('mirage')('libfaketime: passing over %s: %s', path, code);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Host folders a kernel mount in this process serves. A child started in
|
|
71
|
+
* one, or from one, would wait inside its spawn on the loop that answers
|
|
72
|
+
* for the folder, the very loop spawning it, so it starts outside and
|
|
73
|
+
* EXEC_PRELUDE takes it in once the spawn has returned. Each name counts the
|
|
74
|
+
* mounts recording it, so one going down leaves another at its path. Mirrors
|
|
75
|
+
* Python's `SERVED`.
|
|
76
|
+
*/
|
|
77
|
+
export const SERVED = new Map();
|
|
78
|
+
/**
|
|
79
|
+
* Record `folder` in `SERVED` under each name a child's path may give it: as
|
|
80
|
+
* given, made absolute, and with its parent's links resolved. Only the parent
|
|
81
|
+
* is read, never the mount, so recording it waits on no loop. Returns the
|
|
82
|
+
* names added, for `unserve` once the mount is gone. Mirrors Python's `serve`.
|
|
83
|
+
*/
|
|
84
|
+
export function serve(folder) {
|
|
85
|
+
const given = resolve(folder);
|
|
86
|
+
const names = [given];
|
|
87
|
+
try {
|
|
88
|
+
names.push(join(realpathSync(dirname(given)), basename(given)));
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
debuglog('mirage')('cannot resolve the parent of %s: %s', given, err);
|
|
92
|
+
}
|
|
93
|
+
for (const name of names)
|
|
94
|
+
SERVED.set(name, (SERVED.get(name) ?? 0) + 1);
|
|
95
|
+
return names;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Take one mount's names out of `SERVED`; a name another mount still records
|
|
99
|
+
* stays. Mirrors Python's `unserve`.
|
|
100
|
+
*/
|
|
101
|
+
export function unserve(names) {
|
|
102
|
+
for (const name of names) {
|
|
103
|
+
const left = (SERVED.get(name) ?? 0) - 1;
|
|
104
|
+
if (left > 0)
|
|
105
|
+
SERVED.set(name, left);
|
|
106
|
+
else
|
|
107
|
+
SERVED.delete(name);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** Whether `path` lies in a folder a kernel mount here serves. */
|
|
111
|
+
function served(path) {
|
|
112
|
+
for (const folder of SERVED.keys()) {
|
|
113
|
+
if (path === folder || path.startsWith(`${rstripSlash(folder)}/`))
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Where the host's own PATH finds a program, as Python's `shutil.which`
|
|
120
|
+
* does, as an absolute path: a child's environment may carry no host PATH,
|
|
121
|
+
* and a relative entry would be read against the child's directory, so the
|
|
122
|
+
* lookup cannot be left to spawn. Asynchronous, so a PATH entry on a mount
|
|
123
|
+
* this process serves never blocks the loop that answers it. An empty
|
|
124
|
+
* entry is the current directory, as for the shell. A name with a slash is
|
|
125
|
+
* taken as given, and one the PATH lacks too, so spawn reports it missing.
|
|
126
|
+
* On Windows a name without one of `PATHEXT`'s suffixes is tried with each.
|
|
127
|
+
*/
|
|
128
|
+
export async function onHostPath(name) {
|
|
129
|
+
if (name.includes('/'))
|
|
130
|
+
return name;
|
|
131
|
+
const suffixes = process.platform === 'win32'
|
|
132
|
+
? (process.env.PATHEXT ?? '.COM;.EXE;.BAT;.CMD').split(';').filter((s) => s !== '')
|
|
133
|
+
: [];
|
|
134
|
+
const names = suffixes.length === 0 || suffixes.some((s) => name.toLowerCase().endsWith(s.toLowerCase()))
|
|
135
|
+
? [name]
|
|
136
|
+
: suffixes.map((s) => name + s);
|
|
137
|
+
// The PATH and the directory as they are at the call.
|
|
138
|
+
const candidates = (process.env.PATH ?? '')
|
|
139
|
+
.split(delimiter)
|
|
140
|
+
.flatMap((dir) => names.map((each) => resolve(dir, each)));
|
|
141
|
+
for (const candidate of candidates) {
|
|
142
|
+
try {
|
|
143
|
+
if (!(await stat(candidate)).isFile())
|
|
144
|
+
continue;
|
|
145
|
+
await access(candidate, fsConstants.X_OK);
|
|
146
|
+
return candidate;
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
const code = err.code;
|
|
150
|
+
if (code === undefined)
|
|
151
|
+
throw err;
|
|
152
|
+
// Not usable here (absent, not executable, an unreadable entry):
|
|
153
|
+
// the next entry may be. Opt-in (NODE_DEBUG=mirage), on stderr.
|
|
154
|
+
debuglog('mirage')('%s is not usable: %s', candidate, code);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return name;
|
|
158
|
+
}
|
|
159
|
+
async function untilInputCloses(stream, work) {
|
|
160
|
+
if (stream.destroyed)
|
|
161
|
+
return null;
|
|
162
|
+
const controller = new AbortController();
|
|
163
|
+
const closed = once(stream, 'close', { signal: controller.signal }).then(() => null);
|
|
164
|
+
try {
|
|
165
|
+
return await Promise.race([work(controller.signal), closed]);
|
|
166
|
+
}
|
|
167
|
+
finally {
|
|
168
|
+
controller.abort();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Reject as spawn would for a program that is no regular file, or a script
|
|
173
|
+
* whose `#!` interpreter is missing or cannot run: through `EXEC_PRELUDE` the
|
|
174
|
+
* shell's exec fails instead, with the shell's status and words. Opened
|
|
175
|
+
* without waiting, so a FIFO fails rather than hangs, and each path is kept as
|
|
176
|
+
* spelled, as the host follows its links before its `..`. Mirrors Python's
|
|
177
|
+
* `_check_interpreter`.
|
|
178
|
+
*/
|
|
179
|
+
async function checkInterpreter(executable, cwd) {
|
|
180
|
+
const base = cwd ?? '.';
|
|
181
|
+
const under = (path) => (path.startsWith('/') ? path : `${base}/${path}`);
|
|
182
|
+
const failure = (code) => Object.assign(new Error(`spawn ${executable} ${code}`), {
|
|
183
|
+
code,
|
|
184
|
+
errno: -constants.errno[code],
|
|
185
|
+
syscall: `spawn ${executable}`,
|
|
186
|
+
path: executable,
|
|
187
|
+
});
|
|
188
|
+
let head;
|
|
189
|
+
try {
|
|
190
|
+
const file = await open(under(executable), fsConstants.O_RDONLY | fsConstants.O_NONBLOCK);
|
|
191
|
+
try {
|
|
192
|
+
if ((await file.stat()).isFile()) {
|
|
193
|
+
const { buffer, bytesRead } = await file.read(Buffer.alloc(256), 0, 256, 0);
|
|
194
|
+
head = buffer.subarray(0, bytesRead);
|
|
195
|
+
}
|
|
196
|
+
else
|
|
197
|
+
head = null;
|
|
198
|
+
}
|
|
199
|
+
finally {
|
|
200
|
+
await file.close();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch (err) {
|
|
204
|
+
debuglog('mirage')("reading %s's first line failed: %s", executable, String(err));
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (head === null)
|
|
208
|
+
throw failure('EACCES');
|
|
209
|
+
if (head[0] !== 0x23 || head[1] !== 0x21)
|
|
210
|
+
return;
|
|
211
|
+
const end = head.indexOf(0x0a, 2);
|
|
212
|
+
const name = head
|
|
213
|
+
.subarray(2, end === -1 ? head.length : end)
|
|
214
|
+
.toString('utf8')
|
|
215
|
+
.trim()
|
|
216
|
+
.split(/\s+/)[0];
|
|
217
|
+
if (name === undefined || name === '')
|
|
218
|
+
return;
|
|
219
|
+
const interpreter = under(name);
|
|
220
|
+
if (!(await stat(interpreter).then(() => true, () => false)))
|
|
221
|
+
throw failure('ENOENT');
|
|
222
|
+
if (!(await access(interpreter, fsConstants.X_OK).then(() => true, () => false)))
|
|
223
|
+
throw failure('EACCES');
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* One process run to its end: its output and its exit status. The child
|
|
227
|
+
* leads a process group of its own, and an aborted call kills the whole
|
|
228
|
+
* group and stops reading the pipes: a grandchild left alive, or one that
|
|
229
|
+
* left the group, holds the output pipes open, so 'close' would wait until
|
|
230
|
+
* it exited on its own, and the call rejects with an AbortError at once.
|
|
231
|
+
* When a `kill` stopped the runner with a signal other than KILL, the
|
|
232
|
+
* group gets that signal first (`endTree`), so the program's handlers get
|
|
233
|
+
* to run, and a `direct` child that exits on its own then leaves its status
|
|
234
|
+
* with the runner. A missing executable rejects with `hint` when one is given, else with
|
|
235
|
+
* spawn's own error. EPIPE means the command exited without draining its
|
|
236
|
+
* stdin (`head`-like), so it is not an error. An input pull still pending
|
|
237
|
+
* when the child exits is left to close on its own. One in or from a
|
|
238
|
+
* `SERVED` folder starts through `EXEC_PRELUDE`. Mirrors Python's
|
|
239
|
+
* `run_program`.
|
|
240
|
+
*/
|
|
241
|
+
export async function runProgram(executable, hint, args, stdin, options = {}) {
|
|
242
|
+
const { signal, children } = options;
|
|
243
|
+
signal?.throwIfAborted();
|
|
244
|
+
// Read now: an abort's listener runs as the caller that aborted.
|
|
245
|
+
const runner = currentCaller().process;
|
|
246
|
+
const { cwd } = options;
|
|
247
|
+
const prelude = process.platform !== 'win32' && (served(executable) || (cwd !== undefined && served(cwd)));
|
|
248
|
+
if (prelude) {
|
|
249
|
+
try {
|
|
250
|
+
await checkInterpreter(executable, cwd);
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
throw error.code === 'ENOENT' && hint !== null
|
|
254
|
+
? new Error(hint)
|
|
255
|
+
: error;
|
|
256
|
+
}
|
|
257
|
+
if (signal?.aborted === true)
|
|
258
|
+
throw makeAbortError(signal);
|
|
259
|
+
}
|
|
260
|
+
const child = spawn(prelude ? '/bin/sh' : executable, prelude ? ['-c', EXEC_PRELUDE, 'sh', cwd ?? '.', executable, ...args] : args, {
|
|
261
|
+
...(cwd !== undefined && !prelude ? { cwd } : {}),
|
|
262
|
+
...(options.env !== undefined ? { env: options.env } : {}),
|
|
263
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
264
|
+
detached: process.platform !== 'win32',
|
|
265
|
+
});
|
|
266
|
+
// Set by the abort listener, which flow analysis does not follow.
|
|
267
|
+
let stopping = null;
|
|
268
|
+
const abort = () => {
|
|
269
|
+
// The input ends first, as a pipe whose writer went away does: a
|
|
270
|
+
// handler reading it to the end gets there in the grace instead of
|
|
271
|
+
// waiting on a source that never ends.
|
|
272
|
+
child.stdin.end();
|
|
273
|
+
const signum = stopSignal(runner);
|
|
274
|
+
if (signum === null) {
|
|
275
|
+
stopTree(child);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
stopping = endTree(child, signum, runner).then(() => {
|
|
279
|
+
stopTree(child);
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
signal?.addEventListener('abort', abort, { once: true });
|
|
283
|
+
children?.add(child);
|
|
284
|
+
const runKey = `host:${String(child.pid)}`;
|
|
285
|
+
if (children !== undefined && child.pid !== undefined && runner !== null) {
|
|
286
|
+
const run = hostRun(child.pid, [executable, ...args]);
|
|
287
|
+
runner.addRun(runKey, run);
|
|
288
|
+
child.once('exit', () => {
|
|
289
|
+
if (runKey in runner.runs)
|
|
290
|
+
runner.addRun(runKey, { ...run, exited_at: Date.now() / 1000 });
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
const exited = new Promise((resolve, reject) => {
|
|
294
|
+
child.once('error', (error) => {
|
|
295
|
+
reject(error.code === 'ENOENT' && hint !== null ? new Error(hint) : error);
|
|
296
|
+
});
|
|
297
|
+
child.once('close', (code, name) => {
|
|
298
|
+
children?.delete(child);
|
|
299
|
+
resolve(code ?? (name === null ? 1 : 128 + constants.signals[name]));
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
// A failed spawn can arrive before its output readers finish.
|
|
303
|
+
void exited.catch(() => undefined);
|
|
304
|
+
const source = asyncChain([stdin])[Symbol.asyncIterator]();
|
|
305
|
+
const inputState = { ended: false, pulling: false };
|
|
306
|
+
const inputHasEnded = () => inputState.ended;
|
|
307
|
+
child.stdin.once('close', () => {
|
|
308
|
+
inputState.ended = true;
|
|
309
|
+
});
|
|
310
|
+
child.stdin.on('error', (error) => {
|
|
311
|
+
debuglog('mirage')('process stdin closed: %s', error);
|
|
312
|
+
});
|
|
313
|
+
const feeding = (async () => {
|
|
314
|
+
try {
|
|
315
|
+
while (!inputHasEnded()) {
|
|
316
|
+
inputState.pulling = true;
|
|
317
|
+
const next = await untilInputCloses(child.stdin, () => source.next());
|
|
318
|
+
if (next !== null)
|
|
319
|
+
inputState.pulling = false;
|
|
320
|
+
if (next === null || next.done === true || inputHasEnded())
|
|
321
|
+
break;
|
|
322
|
+
if (!child.stdin.write(next.value))
|
|
323
|
+
await untilInputCloses(child.stdin, (signal) => once(child.stdin, 'drain', { signal }));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
catch (err) {
|
|
327
|
+
if (err.code !== 'EPIPE' && !inputState.ended)
|
|
328
|
+
throw err;
|
|
329
|
+
debuglog('mirage')('process closed input: %s', err);
|
|
330
|
+
}
|
|
331
|
+
finally {
|
|
332
|
+
child.stdin.end();
|
|
333
|
+
}
|
|
334
|
+
})();
|
|
335
|
+
const out = [];
|
|
336
|
+
const err = [];
|
|
337
|
+
const reading = readInto(child, child.stdout, options.output, out, signal);
|
|
338
|
+
const erring = readInto(child, child.stderr, options.errors, err, signal);
|
|
339
|
+
const pumps = Promise.all([reading, erring, feeding]);
|
|
340
|
+
try {
|
|
341
|
+
await pumps;
|
|
342
|
+
const code = await exited;
|
|
343
|
+
if (signal?.aborted === true) {
|
|
344
|
+
if (options.direct === true && stopSignal(runner) !== null && child.exitCode !== null)
|
|
345
|
+
runner?.programExited(child.exitCode);
|
|
346
|
+
throw makeAbortError(signal);
|
|
347
|
+
}
|
|
348
|
+
const stderr = Buffer.concat(err);
|
|
349
|
+
return { stdout: Buffer.concat(out), stderr: stderr.length > 0 ? stderr : null, exitCode: code };
|
|
350
|
+
}
|
|
351
|
+
finally {
|
|
352
|
+
if (stopping !== null)
|
|
353
|
+
await stopping;
|
|
354
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
355
|
+
stopTree(child);
|
|
356
|
+
child.stdin.destroy();
|
|
357
|
+
await Promise.allSettled([pumps, exited]);
|
|
358
|
+
if (inputState.pulling)
|
|
359
|
+
void closeQuietly(stdin);
|
|
360
|
+
else
|
|
361
|
+
await closeQuietly(stdin);
|
|
362
|
+
signal?.removeEventListener('abort', abort);
|
|
363
|
+
children?.delete(child);
|
|
364
|
+
if (children !== undefined)
|
|
365
|
+
runner?.dropRun(runKey);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* How another workspace on this host reaches a child `runProgram` started,
|
|
370
|
+
* which leads its own process group: the host, the PID, and when it
|
|
371
|
+
* started, so a PID the host reused is never taken for it. `runProgram` adds
|
|
372
|
+
* `exited_at` once the child exits while what it started may run on. Mirrors
|
|
373
|
+
* Python's `host_run`.
|
|
374
|
+
*/
|
|
375
|
+
export function hostRun(pid, argv) {
|
|
376
|
+
return { host: hostname(), pid, started_at: Date.now() / 1000, command: shellJoin(argv) };
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* What `ps` prints given `args`, in the C locale, however long. Rejects when
|
|
380
|
+
* the host has no `ps`, or it ended on a signal before it printed everything;
|
|
381
|
+
* an exit status is its answer, as for a PID no process has.
|
|
382
|
+
*/
|
|
383
|
+
function ps(args) {
|
|
384
|
+
return new Promise((resolve, reject) => {
|
|
385
|
+
execFile('ps', [...args], { env: { ...process.env, LC_ALL: 'C' }, maxBuffer: Infinity }, (error, stdout) => {
|
|
386
|
+
if (error !== null && typeof error.code !== 'number') {
|
|
387
|
+
reject(error);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
resolve(stdout);
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
/** A start time as `ps -o lstart` prints it, in epoch seconds; throws for other text. */
|
|
395
|
+
function lstart(text) {
|
|
396
|
+
const found = /^\w{3}\s+(\w{3})\s+(\d{1,2})\s+(\d{2}):(\d{2}):(\d{2})\s+(\d{4})$/.exec(text);
|
|
397
|
+
if (found === null)
|
|
398
|
+
throw new Error(`not a start time: ${text}`);
|
|
399
|
+
const [, month, day, hours, minutes, seconds, year] = found;
|
|
400
|
+
const start = new Date(Number(year), 'JanFebMarAprMayJunJulAugSepOctNovDec'.indexOf(month ?? '') / 3, Number(day), Number(hours), Number(minutes), Number(seconds));
|
|
401
|
+
return start.getTime() / 1000;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* When a host process started, in epoch seconds; null once no process has
|
|
405
|
+
* the PID. Rejects when the host has no `ps`.
|
|
406
|
+
*/
|
|
407
|
+
async function startedAt(pid) {
|
|
408
|
+
const text = (await ps(['-o', 'lstart=', '-p', String(pid)])).trim();
|
|
409
|
+
return text === '' ? null : lstart(text);
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* When each process of a process group started, in epoch seconds. Rejects
|
|
413
|
+
* when the host has no `ps`.
|
|
414
|
+
*/
|
|
415
|
+
async function groupStarted(group) {
|
|
416
|
+
const starts = [];
|
|
417
|
+
for (const line of (await ps(['-A', '-o', 'pgid=,lstart='])).split('\n')) {
|
|
418
|
+
const [found = '', ...start] = line.trim().split(/\s+/);
|
|
419
|
+
if (found === String(group))
|
|
420
|
+
starts.push(lstart(start.join(' ')));
|
|
421
|
+
}
|
|
422
|
+
return starts;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Stop a host run a lapsed workspace left: its process group gets `signum`,
|
|
426
|
+
* then KILL after `STOP_GRACE_SECONDS`. Only a run of this host is reached,
|
|
427
|
+
* and only while its PID still names a process started when the run did, to
|
|
428
|
+
* the second `ps` shows, so a PID the host reused is left alone. A PID that
|
|
429
|
+
* names no process may still name the run's group, whose leader exited
|
|
430
|
+
* before the programs it started. That group is the run's while one of its
|
|
431
|
+
* members started by the last time the group was known to be: when the
|
|
432
|
+
* leader exited (`exited_at`), else when its workspace last vouched for the
|
|
433
|
+
* run (`seen_at`), with the leader still unreaped. The host gives no new
|
|
434
|
+
* process the id of a group that has members, and hands a number out again
|
|
435
|
+
* only after a full round of the others, so a group that took the id later
|
|
436
|
+
* has only members started since. One none of whose members proves it is not
|
|
437
|
+
* reached: its members may all have started since, the run's descendants, so
|
|
438
|
+
* its record stays. A group this workspace may not signal is not reached
|
|
439
|
+
* while its leader still runs
|
|
440
|
+
* (macOS answers EPERM for one that only exited unreaped). Answers true once
|
|
441
|
+
* the run is stopped or gone, false when this workspace cannot reach it.
|
|
442
|
+
* Mirrors Python's `reap_host_run`.
|
|
443
|
+
*/
|
|
444
|
+
export async function reapHostRun(run, signum) {
|
|
445
|
+
const pid = run.pid;
|
|
446
|
+
const recorded = run.started_at;
|
|
447
|
+
if (process.platform === 'win32' ||
|
|
448
|
+
run.host !== hostname() ||
|
|
449
|
+
typeof pid !== 'number' ||
|
|
450
|
+
typeof recorded !== 'number')
|
|
451
|
+
return false;
|
|
452
|
+
let started;
|
|
453
|
+
let members = [];
|
|
454
|
+
try {
|
|
455
|
+
started = await startedAt(pid);
|
|
456
|
+
if (started === null)
|
|
457
|
+
members = await groupStarted(pid);
|
|
458
|
+
}
|
|
459
|
+
catch (err) {
|
|
460
|
+
debuglog('mirage')('process %d not checked: %s', pid, err);
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
if (started !== null) {
|
|
464
|
+
if (Math.abs(started - recorded) > HOST_START_SLACK_SECONDS)
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
if (members.length === 0)
|
|
469
|
+
return true;
|
|
470
|
+
const known = run.exited_at ?? run.seen_at;
|
|
471
|
+
if (typeof known !== 'number' ||
|
|
472
|
+
!members.some((start) => start <= known + HOST_START_SLACK_SECONDS))
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
475
|
+
try {
|
|
476
|
+
process.kill(-pid, signum);
|
|
477
|
+
const deadline = Date.now() + STOP_GRACE_SECONDS * 1000;
|
|
478
|
+
while (Date.now() < deadline) {
|
|
479
|
+
await delay(STOP_POLL_SECONDS * 1000);
|
|
480
|
+
process.kill(-pid, 0);
|
|
481
|
+
}
|
|
482
|
+
debuglog('mirage')('process group %d outlived signal %d', pid, signum);
|
|
483
|
+
}
|
|
484
|
+
catch (err) {
|
|
485
|
+
const code = err.code;
|
|
486
|
+
if (code === 'ESRCH')
|
|
487
|
+
return true;
|
|
488
|
+
if (code === 'EPERM')
|
|
489
|
+
return (await startedAt(pid)) === null;
|
|
490
|
+
throw err;
|
|
491
|
+
}
|
|
492
|
+
try {
|
|
493
|
+
process.kill(-pid, 9);
|
|
494
|
+
}
|
|
495
|
+
catch (err) {
|
|
496
|
+
if (err.code === 'EPERM')
|
|
497
|
+
return (await startedAt(pid)) === null;
|
|
498
|
+
debuglog('mirage')('process group %d has already exited: %s', pid, err);
|
|
499
|
+
}
|
|
500
|
+
return true;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Read a child's output to its end, handing each chunk to `sink` as it
|
|
504
|
+
* arrives, or keeping it in `kept` without one. Past an abort the output is
|
|
505
|
+
* read and dropped, so a signal handler that writes is not held on a full
|
|
506
|
+
* pipe. Mirrors Python's `_read_into`.
|
|
507
|
+
*/
|
|
508
|
+
async function readInto(child, stream, sink, kept, signal) {
|
|
509
|
+
try {
|
|
510
|
+
for await (const chunk of stream.iterator({ destroyOnReturn: false })) {
|
|
511
|
+
if (signal?.aborted === true)
|
|
512
|
+
continue;
|
|
513
|
+
if (sink === undefined)
|
|
514
|
+
kept.push(chunk);
|
|
515
|
+
else
|
|
516
|
+
await abortable(sink(chunk), signal);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
catch (error) {
|
|
520
|
+
if (!child.killed && child.signalCode === null && signal?.aborted !== true)
|
|
521
|
+
throw error;
|
|
522
|
+
debuglog('mirage')('process output closed: %s', error);
|
|
523
|
+
stream.resume();
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* The state a sandbox's status command printed as JSON, at `path`: the keys
|
|
528
|
+
* and indexes down to it. Throws when the command failed or its JSON holds
|
|
529
|
+
* no state. Mirrors Python's `reported_state`.
|
|
530
|
+
*/
|
|
531
|
+
export function reportedState(result, command, path) {
|
|
532
|
+
if (result.exitCode !== 0) {
|
|
533
|
+
const said = DECODER.decode(result.stderr ?? new Uint8Array()).trim();
|
|
534
|
+
throw new Error(`${command} failed: ${said}`);
|
|
535
|
+
}
|
|
536
|
+
let state;
|
|
537
|
+
try {
|
|
538
|
+
state = JSON.parse(DECODER.decode(result.stdout));
|
|
539
|
+
for (const key of path) {
|
|
540
|
+
if (state === null || typeof state !== 'object' || !Object.hasOwn(state, key))
|
|
541
|
+
throw new Error(`no ${String(key)}`);
|
|
542
|
+
state = state[key];
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
catch (error) {
|
|
546
|
+
throw new Error(`${command} returned unreadable json: ${String(error)}`);
|
|
547
|
+
}
|
|
548
|
+
return String(state);
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* A sandbox program's exec arguments, the same for every program that runs a
|
|
552
|
+
* command in a box: the program's own words (`head`: `exec -i`, smolvm's
|
|
553
|
+
* `machine exec --name M`), `/` as the working directory and each
|
|
554
|
+
* variable as `-e`, the target or `--` (`tail`: `--` where the command is
|
|
555
|
+
* a trailing var arg, so a line starting with a dash is not read as a
|
|
556
|
+
* flag), then the command.
|
|
557
|
+
*
|
|
558
|
+
* A `cwd` runs the command there through the prelude, which exits 126
|
|
559
|
+
* when the box lacks it, and defers the chdir until the shell starts, so
|
|
560
|
+
* an agent that blocks on a chdir into a passive sshfs prefix still
|
|
561
|
+
* serves the mount's pipe. Null runs it from `/` as given, for a helper
|
|
562
|
+
* pipe. Mirrors Python's `exec_args`.
|
|
563
|
+
*/
|
|
564
|
+
export function execArgs(head, tail, env, cwd, argv) {
|
|
565
|
+
const args = [...head, '-w', '/'];
|
|
566
|
+
for (const [key, value] of Object.entries(env))
|
|
567
|
+
args.push('-e', `${key}=${value}`);
|
|
568
|
+
for (const item of tail)
|
|
569
|
+
args.push(item);
|
|
570
|
+
if (cwd !== null)
|
|
571
|
+
args.push('/bin/sh', '-c', EXEC_PRELUDE, 'sh', cwd);
|
|
572
|
+
return [...args, ...argv];
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Refuse a host program whose working directory this host lacks. The
|
|
576
|
+
* session cwd is a workspace path; running elsewhere instead would point
|
|
577
|
+
* a relative path at the wrong files. Mirrors Python's `cwd_refusal`.
|
|
578
|
+
*/
|
|
579
|
+
export async function cwdRefusal(name, cwd) {
|
|
580
|
+
const here = await stat(cwd).catch((err) => {
|
|
581
|
+
if (err.code === undefined)
|
|
582
|
+
throw err;
|
|
583
|
+
debuglog('mirage')('cannot use %s as the working directory: %s', cwd, err);
|
|
584
|
+
return null;
|
|
585
|
+
});
|
|
586
|
+
if (here?.isDirectory() === true)
|
|
587
|
+
return null;
|
|
588
|
+
return {
|
|
589
|
+
stdout: new Uint8Array(),
|
|
590
|
+
stderr: new TextEncoder().encode(`${name}: the working directory ${cwd} is not on this host\n`),
|
|
591
|
+
exitCode: CANNOT_EXECUTE_STATUS,
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Signal a child and everything it started: its process group. Windows has
|
|
596
|
+
* no process group to signal, and no signal but a kill, so only the child
|
|
597
|
+
* goes there, killed. A group whose members have all exited but are not
|
|
598
|
+
* yet reaped answers EPERM on macOS where Linux answers ESRCH; either way
|
|
599
|
+
* nothing in it is left to signal. The group's signal reaches the child
|
|
600
|
+
* too, so only a KILL also goes through `child.kill`, which marks it
|
|
601
|
+
* killed: a second gentler signal would reach its handler twice. Mirrors
|
|
602
|
+
* Python's `kill_tree`.
|
|
603
|
+
*
|
|
604
|
+
* @param signum the signal, KILL (9) by default.
|
|
605
|
+
*/
|
|
606
|
+
export function killTree(child, signum = 9) {
|
|
607
|
+
if (child.pid === undefined || process.platform === 'win32') {
|
|
608
|
+
child.kill('SIGKILL');
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
try {
|
|
612
|
+
process.kill(-child.pid, signum);
|
|
613
|
+
if (signum === 9)
|
|
614
|
+
child.kill(signum);
|
|
615
|
+
}
|
|
616
|
+
catch (err) {
|
|
617
|
+
const code = err.code;
|
|
618
|
+
if (code !== 'ESRCH' && code !== 'EPERM')
|
|
619
|
+
throw err;
|
|
620
|
+
debuglog('mirage')('process group %d has already exited', child.pid);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Signal a child's process group and give the group `STOP_GRACE_SECONDS`
|
|
625
|
+
* to end. The grace is the group's: a descendant still handling the signal
|
|
626
|
+
* after the child exited keeps it, unless a KILL reaches the runner first.
|
|
627
|
+
* What is left after it is the caller's to kill (`stopTree`). Mirrors
|
|
628
|
+
* Python's `end_tree`.
|
|
629
|
+
*
|
|
630
|
+
* @param signum the signal.
|
|
631
|
+
* @param runner the runner the signal stopped, whose KILL ends the grace.
|
|
632
|
+
*/
|
|
633
|
+
export async function endTree(child, signum, runner) {
|
|
634
|
+
killTree(child, signum);
|
|
635
|
+
const deadline = Date.now() + STOP_GRACE_SECONDS * 1000;
|
|
636
|
+
while (Date.now() < deadline && runner?.signal !== 9) {
|
|
637
|
+
if (child.pid === undefined || process.platform === 'win32') {
|
|
638
|
+
if (child.exitCode !== null || child.signalCode !== null)
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
try {
|
|
643
|
+
process.kill(-child.pid, 0);
|
|
644
|
+
}
|
|
645
|
+
catch (err) {
|
|
646
|
+
const code = err.code;
|
|
647
|
+
if (code === 'ESRCH' || code === 'EPERM')
|
|
648
|
+
return;
|
|
649
|
+
throw err;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
await delay(STOP_POLL_SECONDS * 1000);
|
|
653
|
+
}
|
|
654
|
+
debuglog('mirage')('process group %d outlived signal %d', child.pid, signum);
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Kill a child's tree and stop reading its pipes, which a descendant that
|
|
658
|
+
* left the group (a session of its own) survives the kill holding; 'close'
|
|
659
|
+
* comes once the child exits. Mirrors Python's `stop_tree`.
|
|
660
|
+
*/
|
|
661
|
+
function stopTree(child) {
|
|
662
|
+
killTree(child);
|
|
663
|
+
child.stdout?.destroy();
|
|
664
|
+
child.stderr?.destroy();
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Kill every child still running, so none outlives the workspace, and wait
|
|
668
|
+
* for each to close. Mirrors Python's `close_children`.
|
|
669
|
+
*/
|
|
670
|
+
export async function closeChildren(children) {
|
|
671
|
+
await Promise.all([...children].map((child) => new Promise((resolve) => {
|
|
672
|
+
child.once('close', () => {
|
|
673
|
+
resolve();
|
|
674
|
+
});
|
|
675
|
+
stopTree(child);
|
|
676
|
+
})));
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Hold a byte transport to a sandbox helper until stopped. The tail of what
|
|
680
|
+
* the helper says on stderr is kept for `diagnostic`, so a mount that fails
|
|
681
|
+
* can say why. Stopping ends the helper's input; one that has not closed
|
|
682
|
+
* 100 ms later loses its process group and our ends of its pipes, which
|
|
683
|
+
* output nobody read would otherwise hold open, exited or not. Mirrors
|
|
684
|
+
* Python's `open_program_pipe`.
|
|
685
|
+
*/
|
|
686
|
+
export function openProgramPipe(executable, args) {
|
|
687
|
+
const child = spawn(executable, args, {
|
|
688
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
689
|
+
detached: process.platform !== 'win32',
|
|
690
|
+
});
|
|
691
|
+
let said = Buffer.alloc(0);
|
|
692
|
+
child.stderr.on('data', (chunk) => {
|
|
693
|
+
said = Buffer.concat([said, chunk]).subarray(-PIPE_DIAGNOSTIC_BYTES);
|
|
694
|
+
});
|
|
695
|
+
child.stderr.on('error', (err) => {
|
|
696
|
+
debuglog('mirage')('%s helper stderr closed: %s', executable, err);
|
|
697
|
+
});
|
|
698
|
+
child.stdin.on('error', (err) => {
|
|
699
|
+
debuglog('mirage')('%s helper stdin closed: %s', executable, err);
|
|
700
|
+
});
|
|
701
|
+
const exited = once(child, 'close').then(() => true, (err) => {
|
|
702
|
+
debuglog('mirage')('%s helper failed: %s', executable, err);
|
|
703
|
+
return true;
|
|
704
|
+
});
|
|
705
|
+
return Promise.resolve({
|
|
706
|
+
reader: Readable.toWeb(child.stdout),
|
|
707
|
+
writer: child.stdin,
|
|
708
|
+
diagnostic: async () => {
|
|
709
|
+
await Promise.race([
|
|
710
|
+
exited,
|
|
711
|
+
delay(PIPE_DIAGNOSTIC_WAIT_SECONDS * 1000, false, { ref: false }),
|
|
712
|
+
]);
|
|
713
|
+
return said.toString('utf8').trim();
|
|
714
|
+
},
|
|
715
|
+
stop: async () => {
|
|
716
|
+
child.stdin.end();
|
|
717
|
+
if (!(await Promise.race([exited, delay(100, false, { ref: false })])))
|
|
718
|
+
stopTree(child);
|
|
719
|
+
await exited;
|
|
720
|
+
},
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
const DECODER = new TextDecoder();
|
|
724
|
+
//# sourceMappingURL=program.js.map
|