@struktoai/mirage-node 0.0.7 → 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 +143 -48
- 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 +14 -10
- package/dist/runtime/sandbox/apple_container/runtime.d.ts.map +1 -1
- package/dist/runtime/sandbox/apple_container/runtime.js +38 -57
- package/dist/runtime/sandbox/apple_container/runtime.js.map +1 -1
- package/dist/runtime/sandbox/daytona/constants.d.ts +27 -0
- package/dist/runtime/sandbox/daytona/constants.d.ts.map +1 -0
- package/dist/runtime/sandbox/daytona/constants.js +47 -0
- package/dist/runtime/sandbox/daytona/constants.js.map +1 -0
- 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 +13 -9
- 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 -6
- package/dist/runtime/sandbox/docker/runtime.d.ts.map +1 -1
- package/dist/runtime/sandbox/docker/runtime.js +22 -28
- 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 +9 -8
- package/dist/runtime/sandbox/microsandbox/runtime.d.ts.map +1 -1
- package/dist/runtime/sandbox/microsandbox/runtime.js +26 -56
- 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 +9 -8
- package/dist/runtime/sandbox/smolvm/runtime.d.ts.map +1 -1
- package/dist/runtime/sandbox/smolvm/runtime.js +24 -45
- 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 +88 -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 -915
- 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 -56
- package/dist/runtime/sandbox/cli.d.ts.map +0 -1
- package/dist/runtime/sandbox/cli.js +0 -260
- package/dist/runtime/sandbox/cli.js.map +0 -1
- package/dist/runtime/sandbox/ssh/constants.d.ts +0 -12
- package/dist/runtime/sandbox/ssh/constants.d.ts.map +0 -1
- package/dist/runtime/sandbox/ssh/constants.js +0 -32
- package/dist/runtime/sandbox/ssh/constants.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
|
@@ -12,23 +12,36 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
|
|
14
14
|
import { Buffer } from 'node:buffer';
|
|
15
|
+
import { randomBytes } from 'node:crypto';
|
|
15
16
|
import { constants } from 'node:fs';
|
|
16
17
|
import { createRequire } from 'node:module';
|
|
17
18
|
import { posix } from 'node:path';
|
|
19
|
+
import { createInterface } from 'node:readline';
|
|
18
20
|
import { fileURLToPath } from 'node:url';
|
|
19
21
|
import { classify } from '@struktoai/mirage-core/errors/classify';
|
|
20
22
|
import { ebadf, einval, isMissingPath } from '@struktoai/mirage-core/errors/fs';
|
|
21
23
|
import { posixErrno, posixPhrase } from '@struktoai/mirage-core/errors/posix';
|
|
24
|
+
import { linkView } from '@struktoai/mirage-core/commands/builtin/utils/links';
|
|
22
25
|
import { workspaceBridge } from '@struktoai/mirage-core/runtime/binding';
|
|
26
|
+
import { MountCore } from '@struktoai/mirage-core/mount/core';
|
|
23
27
|
import { RuntimeFiles } from '@struktoai/mirage-core/runtime/files';
|
|
28
|
+
import { openMode } from '@struktoai/mirage-core/runtime/handles/mode';
|
|
24
29
|
import { posixStat } from '@struktoai/mirage-core/runtime/stat';
|
|
25
30
|
import { PrefixResolver } from '@struktoai/mirage-core/runtime/resolver';
|
|
26
31
|
import { MountMode } from '@struktoai/mirage-core/types';
|
|
32
|
+
import { MAX_SYMLINK_HOPS } from '@struktoai/mirage-core/utils/path';
|
|
27
33
|
import { entryName } from '@struktoai/mirage-core/utils/remnants';
|
|
34
|
+
import { pathMode } from '@struktoai/mirage-core/workspace/files';
|
|
28
35
|
import { DESCRIPTOR_CALLS, LISTENED_CALLS, PATH_ARGS, REFUSED_CALLS, ROUTED_CALLS, } from "./constants.js";
|
|
29
|
-
import { Descriptors, openFlags
|
|
36
|
+
import { Descriptors, openFlags } from "./descriptors.js";
|
|
37
|
+
import { dirent, openedDir } from "./list.js";
|
|
38
|
+
import { stats } from "./stat.js";
|
|
30
39
|
const fs = createRequire(import.meta.url)('node:fs');
|
|
31
|
-
|
|
40
|
+
// fs.promises as the patch leaves it, each call looked up when it is
|
|
41
|
+
// made: a call on it reaches node for a host path and the workspace for
|
|
42
|
+
// a mounted one, so a cp or glob across the two takes each end where it is.
|
|
43
|
+
const routed = fs.promises;
|
|
44
|
+
const { W_OK, X_OK, COPYFILE_EXCL } = constants;
|
|
32
45
|
/** `path` as a string a mount could serve, or null: a descriptor and a
|
|
33
46
|
* Buffer are host spellings no mount uses. */
|
|
34
47
|
function spelled(path) {
|
|
@@ -38,10 +51,6 @@ function spelled(path) {
|
|
|
38
51
|
return fileURLToPath(path);
|
|
39
52
|
return null;
|
|
40
53
|
}
|
|
41
|
-
/** A stamp in nanoseconds, as node's BigIntStats spells one. */
|
|
42
|
-
function ns(date) {
|
|
43
|
-
return BigInt(date.getTime()) * 1000000n;
|
|
44
|
-
}
|
|
45
54
|
/** A refusal spelled the way node's own fs spells an error. */
|
|
46
55
|
function refusal(condition, syscall, path) {
|
|
47
56
|
const err = new Error(`${condition}: ${posixPhrase(condition).toLowerCase()}, ${syscall} '${path}'`);
|
|
@@ -72,11 +81,44 @@ function syncRefusal(name, path) {
|
|
|
72
81
|
function fieldsOf(options) {
|
|
73
82
|
return typeof options === 'object' && options !== null ? options : {};
|
|
74
83
|
}
|
|
84
|
+
/** The mode a node call asks for: its number, its octal text, or the
|
|
85
|
+
* `mode` of its options. */
|
|
86
|
+
function modeOf(options) {
|
|
87
|
+
const mode = typeof options === 'object' ? fieldsOf(options).mode : options;
|
|
88
|
+
if (typeof mode === 'number')
|
|
89
|
+
return mode;
|
|
90
|
+
return typeof mode === 'string' ? parseInt(mode, 8) : undefined;
|
|
91
|
+
}
|
|
75
92
|
function encodingOf(options) {
|
|
76
93
|
if (typeof options === 'string')
|
|
77
94
|
return options;
|
|
78
95
|
return (fieldsOf(options).encoding ?? undefined);
|
|
79
96
|
}
|
|
97
|
+
/** A name as node answers one: a string, or a Buffer or another
|
|
98
|
+
* encoding where the options ask for it. */
|
|
99
|
+
function encoded(text, options) {
|
|
100
|
+
const encoding = encodingOf(options);
|
|
101
|
+
if (encoding === undefined || encoding === 'utf8')
|
|
102
|
+
return text;
|
|
103
|
+
const bytes = Buffer.from(text);
|
|
104
|
+
return encoding === 'buffer' ? bytes : bytes.toString(encoding);
|
|
105
|
+
}
|
|
106
|
+
/** One of node's own `cp` refusals (`ERR_FS_CP_*`), spelled as node spells it. */
|
|
107
|
+
function cpRefusal(code, title, condition, detail, path) {
|
|
108
|
+
return Object.assign(new Error(`${title}: cp returned ${condition} (${detail}) ${path}`), {
|
|
109
|
+
code,
|
|
110
|
+
errno: posixErrno(condition),
|
|
111
|
+
syscall: 'cp',
|
|
112
|
+
path,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/** Six characters from the alphabet of node's `mkdtemp` template. */
|
|
116
|
+
function tempSuffix() {
|
|
117
|
+
const alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
118
|
+
return Array.from(randomBytes(6), (byte) => alphabet[byte % alphabet.length]).join('');
|
|
119
|
+
}
|
|
120
|
+
// A path segment holding a character node's glob matcher reads as one.
|
|
121
|
+
const GLOB_MAGIC = /[*?[\]{}()!+@]/;
|
|
80
122
|
function bytesOf(data, options) {
|
|
81
123
|
if (typeof data === 'string')
|
|
82
124
|
return Buffer.from(data, encodingOf(options) ?? 'utf8');
|
|
@@ -94,6 +136,13 @@ function refusedIterator(err) {
|
|
|
94
136
|
},
|
|
95
137
|
};
|
|
96
138
|
}
|
|
139
|
+
/** Every item an async iterator yields. */
|
|
140
|
+
async function collected(items) {
|
|
141
|
+
const out = [];
|
|
142
|
+
for await (const item of items)
|
|
143
|
+
out.push(item);
|
|
144
|
+
return out;
|
|
145
|
+
}
|
|
97
146
|
/** A time argument (seconds, a numeric string, a Date) as the ISO stamp
|
|
98
147
|
* setattr stores. */
|
|
99
148
|
function stampOf(time) {
|
|
@@ -257,6 +306,13 @@ class MountedFileHandle {
|
|
|
257
306
|
throw ebadf(String(this.fd));
|
|
258
307
|
return fs.createWriteStream(null, { ...fieldsOf(options), fd: this.fd });
|
|
259
308
|
}
|
|
309
|
+
// node's own reads its lines through createReadStream, as this does.
|
|
310
|
+
readLines(options) {
|
|
311
|
+
return createInterface({
|
|
312
|
+
input: this.createReadStream(options),
|
|
313
|
+
crlfDelay: Infinity,
|
|
314
|
+
});
|
|
315
|
+
}
|
|
260
316
|
}
|
|
261
317
|
/**
|
|
262
318
|
* Every routed fs call, answered on a mount: python's `HostFs` for
|
|
@@ -280,22 +336,27 @@ class HostFs {
|
|
|
280
336
|
constructor(ws, native) {
|
|
281
337
|
this.ws = ws;
|
|
282
338
|
this.native = native;
|
|
283
|
-
|
|
339
|
+
// An op that fails with no condition (an upstream 502 a REST mount
|
|
340
|
+
// throws as it came) answers EIO, the kernel's word for a device that
|
|
341
|
+
// failed, as a guest's file adapter does; the original rides along as
|
|
342
|
+
// the cause.
|
|
343
|
+
const dispatch = async (name, path, args, kwargs, report) => {
|
|
284
344
|
try {
|
|
285
|
-
|
|
286
|
-
return value;
|
|
345
|
+
return await ws.vfs.dispatch(name, path, args, kwargs, report);
|
|
287
346
|
}
|
|
288
347
|
catch (err) {
|
|
289
348
|
if (classify(err) !== null)
|
|
290
349
|
throw err;
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
// rides along as the cause.
|
|
295
|
-
throw Object.assign(refusal('EIO', name, path), { cause: err });
|
|
350
|
+
throw Object.assign(refusal('EIO', name, typeof path === 'string' ? path : path.virtual), {
|
|
351
|
+
cause: err,
|
|
352
|
+
});
|
|
296
353
|
}
|
|
297
|
-
}
|
|
298
|
-
|
|
354
|
+
};
|
|
355
|
+
// Where a link leads, so a file reads as one inode whichever spelling
|
|
356
|
+
// reached it.
|
|
357
|
+
const links = linkView(ws.vfs);
|
|
358
|
+
this.files = new RuntimeFiles(workspaceBridge(async (name, path, args, kwargs) => (await dispatch(name, path, args, kwargs))[0]), new PrefixResolver(() => [], (directory) => ws.namespace.linkNamesUnder(directory)), links === undefined ? null : links.resolve.bind(links), new MountCore(ws.vfs.over(dispatch)));
|
|
359
|
+
this.descriptors = new Descriptors(this.files, native);
|
|
299
360
|
}
|
|
300
361
|
/** Whether `path` is under a mount the patch answers for. The synthetic
|
|
301
362
|
* root anchor matches every path but backs no files, so a path only it
|
|
@@ -314,80 +375,35 @@ class HostFs {
|
|
|
314
375
|
statsOf(path, st, options, unlinked = false) {
|
|
315
376
|
// The stat every runtime shares; an owner the row lacks is this
|
|
316
377
|
// process's own.
|
|
317
|
-
|
|
378
|
+
// The file the links lead to names both its inode and its device, so a
|
|
379
|
+
// stat through a link and the fstat of its open file agree.
|
|
380
|
+
const named = st.name ?? path;
|
|
381
|
+
const posix = posixStat(st, named, this.ws.registry.tryMountFor(named)?.prefix ?? '/', {
|
|
318
382
|
uid: process.getuid?.() ?? 0,
|
|
319
383
|
gid: process.getgid?.() ?? 0,
|
|
320
384
|
unknownMs: this.born,
|
|
321
385
|
});
|
|
322
|
-
|
|
323
|
-
const mtime = new Date(posix.mtimeMs);
|
|
324
|
-
const atime = new Date(posix.atimeMs);
|
|
325
|
-
const kinds = {
|
|
326
|
-
isFile: () => kind === S_IFREG,
|
|
327
|
-
isDirectory: () => kind === S_IFDIR,
|
|
328
|
-
isBlockDevice: () => false,
|
|
329
|
-
isCharacterDevice: () => kind === S_IFCHR,
|
|
330
|
-
isSymbolicLink: () => kind === S_IFLNK,
|
|
331
|
-
isFIFO: () => false,
|
|
332
|
-
isSocket: () => false,
|
|
333
|
-
};
|
|
334
|
-
const dates = { atime, mtime, ctime: mtime, birthtime: mtime };
|
|
335
|
-
const fields = {
|
|
336
|
-
dev: posix.dev,
|
|
337
|
-
ino: posix.ino,
|
|
338
|
-
mode: posix.mode,
|
|
339
|
-
nlink: unlinked ? 0 : posix.nlink,
|
|
340
|
-
uid: posix.uid,
|
|
341
|
-
gid: posix.gid,
|
|
342
|
-
rdev: posix.rdev,
|
|
343
|
-
size: posix.size,
|
|
344
|
-
blksize: posix.blksize,
|
|
345
|
-
blocks: posix.blocks,
|
|
346
|
-
atimeMs: posix.atimeMs,
|
|
347
|
-
mtimeMs: posix.mtimeMs,
|
|
348
|
-
ctimeMs: posix.ctimeMs,
|
|
349
|
-
birthtimeMs: posix.mtimeMs,
|
|
350
|
-
};
|
|
351
|
-
if (fieldsOf(options).bigint !== true)
|
|
352
|
-
return { ...kinds, ...fields, ...dates };
|
|
353
|
-
// node's BigIntStats: every number a bigint, plus the stamps in ns.
|
|
354
|
-
const big = Object.fromEntries(Object.entries(fields).map(([k, v]) => [k, BigInt(Math.trunc(v))]));
|
|
355
|
-
return {
|
|
356
|
-
...kinds,
|
|
357
|
-
...big,
|
|
358
|
-
atimeNs: ns(atime),
|
|
359
|
-
mtimeNs: ns(mtime),
|
|
360
|
-
ctimeNs: ns(mtime),
|
|
361
|
-
birthtimeNs: ns(mtime),
|
|
362
|
-
...dates,
|
|
363
|
-
};
|
|
386
|
+
return stats(unlinked ? { ...posix, nlink: 0 } : posix, fieldsOf(options).bigint === true);
|
|
364
387
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
isDirectory: () => kind === S_IFDIR,
|
|
373
|
-
isBlockDevice: () => false,
|
|
374
|
-
isCharacterDevice: () => kind === S_IFCHR,
|
|
375
|
-
isSymbolicLink: () => kind === S_IFLNK,
|
|
376
|
-
isFIFO: () => false,
|
|
377
|
-
isSocket: () => false,
|
|
378
|
-
};
|
|
388
|
+
/**
|
|
389
|
+
* Whether a write at `path` would be admitted by mode: the mode the write
|
|
390
|
+
* itself meets (`pathMode`). Mirrors Python's `_writable`.
|
|
391
|
+
*/
|
|
392
|
+
async writable(path) {
|
|
393
|
+
const mode = await pathMode(this.ws.vfs, path);
|
|
394
|
+
return mode !== null && mode !== MountMode.READ;
|
|
379
395
|
}
|
|
380
396
|
nativeCall(name, ...args) {
|
|
381
397
|
return this.native.promises[name](...args);
|
|
382
398
|
}
|
|
383
399
|
async access(path, mode = 0) {
|
|
384
400
|
const st = await this.files.stat(path);
|
|
385
|
-
// Write is the
|
|
386
|
-
//
|
|
387
|
-
// access(2)
|
|
388
|
-
|
|
401
|
+
// Write is the mode in force at the path for the session, mirage's
|
|
402
|
+
// access control: W_OK answers what the write itself would meet, as
|
|
403
|
+
// access(2) refuses a write on a read-only file system. Execute is the
|
|
404
|
+
// one question the bits answer.
|
|
405
|
+
if (mode & W_OK && !(await this.writable(path)))
|
|
389
406
|
throw refusal('EACCES', 'access', path);
|
|
390
|
-
}
|
|
391
407
|
if (mode & X_OK && (st.mode & 0o111) === 0)
|
|
392
408
|
throw refusal('EACCES', 'access', path);
|
|
393
409
|
}
|
|
@@ -458,6 +474,7 @@ class HostFs {
|
|
|
458
474
|
async mkdir(path, options) {
|
|
459
475
|
if (fieldsOf(options).recursive !== true) {
|
|
460
476
|
await this.files.mkdir(path);
|
|
477
|
+
await this.narrowed(path, modeOf(options));
|
|
461
478
|
return undefined;
|
|
462
479
|
}
|
|
463
480
|
// Each missing ancestor in turn, stopping at the mount root, as
|
|
@@ -481,6 +498,362 @@ class HostFs {
|
|
|
481
498
|
await this.files.mkdir(dir);
|
|
482
499
|
return missing[0];
|
|
483
500
|
}
|
|
501
|
+
async cp(src, dst, options) {
|
|
502
|
+
const opts = fieldsOf(options);
|
|
503
|
+
const filter = opts.filter;
|
|
504
|
+
if (filter !== undefined && !(await filter(src, dst)))
|
|
505
|
+
return;
|
|
506
|
+
const from = await this.checked(src, dst, opts);
|
|
507
|
+
// node makes the destination's missing parents first.
|
|
508
|
+
const parent = posix.dirname(posix.resolve(dst));
|
|
509
|
+
try {
|
|
510
|
+
await routed.stat(parent);
|
|
511
|
+
}
|
|
512
|
+
catch (err) {
|
|
513
|
+
if (!isMissingPath(err))
|
|
514
|
+
throw err;
|
|
515
|
+
await routed.mkdir(parent, { recursive: true });
|
|
516
|
+
}
|
|
517
|
+
await this.copied(src, dst, from, opts);
|
|
518
|
+
}
|
|
519
|
+
/** Narrow a directory just made to the permissions `mode` asks for, as
|
|
520
|
+
* mkdir(2) does: its own are what the umask left of 0o777, so the two
|
|
521
|
+
* together are what mkdir(2) leaves of `mode`, and a bit it inherited
|
|
522
|
+
* (a parent's set-group-ID) stays. A mode asking all of 0o777 needs no
|
|
523
|
+
* lookup, and one the workspace refuses leaves the directory as made. */
|
|
524
|
+
async narrowed(path, mode) {
|
|
525
|
+
if (mode === undefined || (mode & 0o777) === 0o777)
|
|
526
|
+
return;
|
|
527
|
+
let own;
|
|
528
|
+
try {
|
|
529
|
+
own = (await this.files.stat(path)).mode & 0o7777;
|
|
530
|
+
}
|
|
531
|
+
catch (err) {
|
|
532
|
+
const condition = classify(err);
|
|
533
|
+
if (condition !== 'EACCES' && condition !== 'EPERM')
|
|
534
|
+
throw err;
|
|
535
|
+
console.debug(`mkdir: ${path} keeps the mode it was made with: ${String(err)}`);
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
const narrow = (own & ~0o777) | (own & mode & 0o777);
|
|
539
|
+
if (narrow !== own)
|
|
540
|
+
await this.files.setattr(path, { mode: narrow });
|
|
541
|
+
}
|
|
542
|
+
/** Whether the link at `path` leads to a directory; a dangling one
|
|
543
|
+
* leads nowhere. */
|
|
544
|
+
async linksToDirectory(path) {
|
|
545
|
+
try {
|
|
546
|
+
return (await this.entryOf(path, true)).isDirectory();
|
|
547
|
+
}
|
|
548
|
+
catch (err) {
|
|
549
|
+
if (!isMissingPath(err))
|
|
550
|
+
throw err;
|
|
551
|
+
return false;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
/** The source's entry once the pair passes the checks node's `cp`
|
|
555
|
+
* makes of every pair it copies: two names for one file (a link that
|
|
556
|
+
* makes them one is caught as one spelling is), a directory without
|
|
557
|
+
* `recursive`, and a directory into itself. */
|
|
558
|
+
async checked(src, dst, opts) {
|
|
559
|
+
const follow = opts.dereference === true;
|
|
560
|
+
const [source, target] = [await this.identity(src, follow), await this.identity(dst, follow)];
|
|
561
|
+
if (source === target) {
|
|
562
|
+
throw cpRefusal('ERR_FS_CP_EINVAL', 'Invalid src or dest', 'EINVAL', 'src and dest cannot be the same', dst);
|
|
563
|
+
}
|
|
564
|
+
const from = await this.entryOf(src, follow);
|
|
565
|
+
if (from.isDirectory()) {
|
|
566
|
+
if (opts.recursive !== true) {
|
|
567
|
+
throw cpRefusal('ERR_FS_EISDIR', 'Path is a directory', 'EISDIR', `${src} is a directory (not copied)`, src);
|
|
568
|
+
}
|
|
569
|
+
if (target.startsWith(`${source}/`)) {
|
|
570
|
+
throw cpRefusal('ERR_FS_CP_EINVAL', 'Invalid src or dest', 'EINVAL', `cannot copy ${src} to a subdirectory of self ${dst}`, dst);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
return from;
|
|
574
|
+
}
|
|
575
|
+
/** The file `path` names once its links are followed, as node's `cp`
|
|
576
|
+
* tells two files apart: its directories always, its last name when
|
|
577
|
+
* `follow`, and a name not there as it is spelled. */
|
|
578
|
+
async identity(path, follow) {
|
|
579
|
+
const absolute = posix.resolve(path);
|
|
580
|
+
if (absolute === '/')
|
|
581
|
+
return absolute;
|
|
582
|
+
if (follow) {
|
|
583
|
+
try {
|
|
584
|
+
return await routed.realpath(absolute);
|
|
585
|
+
}
|
|
586
|
+
catch (err) {
|
|
587
|
+
if (!isMissingPath(err))
|
|
588
|
+
throw err;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
return posix.join(await this.identity(posix.dirname(absolute), true), posix.basename(absolute));
|
|
592
|
+
}
|
|
593
|
+
/** A path's own entry, or its target's, through the patched calls, so
|
|
594
|
+
* a host path reaches node and a mounted one the workspace. */
|
|
595
|
+
entryOf(path, follow) {
|
|
596
|
+
return follow ? routed.stat(path) : routed.lstat(path);
|
|
597
|
+
}
|
|
598
|
+
/** One entry of a `cp` and what is under it, as node's own copies it:
|
|
599
|
+
* a name already there is replaced unless `force` is off, and a link
|
|
600
|
+
* keeps its target, a relative one resolved against where it was. */
|
|
601
|
+
async copied(src, dst, from, opts) {
|
|
602
|
+
let to = null;
|
|
603
|
+
try {
|
|
604
|
+
// `dereference` follows a link on either side, as node's does.
|
|
605
|
+
to = await this.entryOf(dst, opts.dereference === true);
|
|
606
|
+
}
|
|
607
|
+
catch (err) {
|
|
608
|
+
if (!isMissingPath(err))
|
|
609
|
+
throw err;
|
|
610
|
+
}
|
|
611
|
+
if (from.isDirectory()) {
|
|
612
|
+
if (to !== null && !to.isDirectory()) {
|
|
613
|
+
throw cpRefusal('ERR_FS_CP_DIR_TO_NON_DIR', 'Cannot overwrite non-directory with directory', 'EISDIR', `cannot overwrite non-directory ${dst} with directory ${src}`, dst);
|
|
614
|
+
}
|
|
615
|
+
if (to === null)
|
|
616
|
+
await routed.mkdir(dst);
|
|
617
|
+
const filter = opts.filter;
|
|
618
|
+
for (const name of await routed.readdir(src)) {
|
|
619
|
+
const [child, target] = [posix.join(src, name), posix.join(dst, name)];
|
|
620
|
+
if (filter !== undefined && !(await filter(child, target)))
|
|
621
|
+
continue;
|
|
622
|
+
await this.copied(child, target, await this.checked(child, target, opts), opts);
|
|
623
|
+
}
|
|
624
|
+
// A directory it made takes the source's mode, once its entries are in.
|
|
625
|
+
if (to === null)
|
|
626
|
+
await routed.chmod(dst, from.mode & 0o7777);
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
if (to?.isDirectory() === true) {
|
|
630
|
+
throw cpRefusal('ERR_FS_CP_NON_DIR_TO_DIR', 'Cannot overwrite directory with non-directory', 'ENOTDIR', `cannot overwrite directory ${dst} with non-directory ${src}`, dst);
|
|
631
|
+
}
|
|
632
|
+
if (from.isSymbolicLink()) {
|
|
633
|
+
const target = await routed.readlink(src);
|
|
634
|
+
const kept = opts.verbatimSymlinks === true || posix.isAbsolute(target)
|
|
635
|
+
? target
|
|
636
|
+
: posix.resolve(posix.dirname(src), target);
|
|
637
|
+
// A link replaces a link there, whatever `force` says, unless one
|
|
638
|
+
// leads into the other's directory; onto any other entry the
|
|
639
|
+
// symlink itself refuses the name, as node's does.
|
|
640
|
+
if (to?.isSymbolicLink() === true) {
|
|
641
|
+
const there = await routed.readlink(dst);
|
|
642
|
+
const leads = posix.resolve(kept);
|
|
643
|
+
const led = posix.isAbsolute(there) ? there : posix.resolve(posix.dirname(dst), there);
|
|
644
|
+
if ((await this.entryOf(src, true)).isDirectory()) {
|
|
645
|
+
if (led === leads || led.startsWith(`${leads}/`)) {
|
|
646
|
+
throw cpRefusal('ERR_FS_CP_EINVAL', 'Invalid src or dest', 'EINVAL', `cannot copy ${kept} to a subdirectory of self ${led}`, dst);
|
|
647
|
+
}
|
|
648
|
+
if (leads.startsWith(`${led}/`)) {
|
|
649
|
+
throw cpRefusal('ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY', 'Cannot overwrite symlink in subdirectory of self', 'EINVAL', `cannot overwrite ${led} with ${kept}`, dst);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
await routed.unlink(dst);
|
|
653
|
+
}
|
|
654
|
+
await routed.symlink(kept, dst);
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
if (!from.isFile() && !from.isCharacterDevice() && !from.isBlockDevice()) {
|
|
658
|
+
const [code, kind] = from.isSocket()
|
|
659
|
+
? ['ERR_FS_CP_SOCKET', 'a socket file']
|
|
660
|
+
: from.isFIFO()
|
|
661
|
+
? ['ERR_FS_CP_FIFO_PIPE', 'a FIFO pipe']
|
|
662
|
+
: ['ERR_FS_CP_UNKNOWN', 'an unknown file type'];
|
|
663
|
+
throw cpRefusal(code, `Cannot copy ${kind}`, 'EINVAL', `cannot copy ${kind}: ${dst}`, dst);
|
|
664
|
+
}
|
|
665
|
+
if (to !== null) {
|
|
666
|
+
if (opts.force === false) {
|
|
667
|
+
if (opts.errorOnExist !== true)
|
|
668
|
+
return;
|
|
669
|
+
throw cpRefusal('ERR_FS_CP_EEXIST', 'Target already exists', 'EEXIST', `${dst} already exists`, dst);
|
|
670
|
+
}
|
|
671
|
+
await routed.unlink(dst);
|
|
672
|
+
}
|
|
673
|
+
await routed.copyFile(src, dst, typeof opts.mode === 'number' ? opts.mode : 0);
|
|
674
|
+
if (opts.preserveTimestamps === true)
|
|
675
|
+
await routed.utimes(dst, from.atime, from.mtime);
|
|
676
|
+
await routed.chmod(dst, from.mode & 0o7777);
|
|
677
|
+
}
|
|
678
|
+
/** The names `pattern` matches, as node's `fs.promises.glob` yields
|
|
679
|
+
* them: by node's own matcher, under the part of the pattern that has
|
|
680
|
+
* no wildcard, relative to `cwd` for a relative pattern. */
|
|
681
|
+
async *glob(pattern, options) {
|
|
682
|
+
const opts = fieldsOf(options);
|
|
683
|
+
const cwd = spelled(opts.cwd) ?? process.cwd();
|
|
684
|
+
const exclude = opts.exclude;
|
|
685
|
+
const typed = opts.withFileTypes === true;
|
|
686
|
+
const follow = opts.followSymlinks === true;
|
|
687
|
+
const seen = new Set();
|
|
688
|
+
for (const raw of Array.isArray(pattern) ? pattern : [pattern]) {
|
|
689
|
+
const spelling = spelled(raw);
|
|
690
|
+
if (spelling === null)
|
|
691
|
+
continue;
|
|
692
|
+
const spelt = posix.isAbsolute(spelling)
|
|
693
|
+
? posix.normalize(spelling)
|
|
694
|
+
: posix.join(cwd, spelling);
|
|
695
|
+
// A trailing slash asks for directories, named without it.
|
|
696
|
+
const directories = spelt.length > 1 && spelt.endsWith('/');
|
|
697
|
+
const absolute = directories ? spelt.slice(0, -1) : spelt;
|
|
698
|
+
const shown = (path) => posix.isAbsolute(spelling) ? path : posix.relative(cwd, path) || '.';
|
|
699
|
+
const parts = absolute.split('/').slice(1);
|
|
700
|
+
const magic = parts.findIndex((part) => GLOB_MAGIC.test(part));
|
|
701
|
+
const base = `/${parts.slice(0, magic === -1 ? parts.length : magic).join('/')}`;
|
|
702
|
+
const rest = magic === -1 ? '' : parts.slice(magic).join('/');
|
|
703
|
+
// A `**` that is a whole name, inside braces too, may match at any
|
|
704
|
+
// depth; within a name (`foo**`) it is a `*`.
|
|
705
|
+
const depth = /(^|[/{,])\*\*($|[/},])/.test(rest) ? Infinity : rest.split('/').length;
|
|
706
|
+
// An exclusion is matched from `cwd` and from the root alike,
|
|
707
|
+
// whichever way the pattern is spelled, as node matches it.
|
|
708
|
+
const skipped = (path, named, entry) => {
|
|
709
|
+
if (typeof exclude === 'function')
|
|
710
|
+
return Boolean(exclude(typed ? entry : named));
|
|
711
|
+
const spellings = [path, posix.relative(cwd, path) || '.'];
|
|
712
|
+
return (Array.isArray(exclude) &&
|
|
713
|
+
exclude.some((ex) => spellings.some((name) => posix.matchesGlob(name, String(ex)))));
|
|
714
|
+
};
|
|
715
|
+
let top;
|
|
716
|
+
try {
|
|
717
|
+
top = await this.entryOf(base, true);
|
|
718
|
+
}
|
|
719
|
+
catch (err) {
|
|
720
|
+
if (!isMissingPath(err))
|
|
721
|
+
throw err;
|
|
722
|
+
continue;
|
|
723
|
+
}
|
|
724
|
+
const baseEntry = {
|
|
725
|
+
name: posix.basename(base),
|
|
726
|
+
parentPath: posix.dirname(base),
|
|
727
|
+
path: posix.dirname(base),
|
|
728
|
+
isFile: () => top.isFile(),
|
|
729
|
+
isDirectory: () => top.isDirectory(),
|
|
730
|
+
isBlockDevice: () => false,
|
|
731
|
+
isCharacterDevice: () => false,
|
|
732
|
+
isSymbolicLink: () => false,
|
|
733
|
+
isFIFO: () => false,
|
|
734
|
+
isSocket: () => false,
|
|
735
|
+
};
|
|
736
|
+
// Each entry carries the directories its branch went through, by
|
|
737
|
+
// where their links lead, so a followed link never walks into one
|
|
738
|
+
// of them again, as node's walk does.
|
|
739
|
+
const pending = [[base, '', 0, baseEntry, []]];
|
|
740
|
+
for (let next = pending.shift(); next !== undefined; next = pending.shift()) {
|
|
741
|
+
const [path, relative, level, entry, walked] = next;
|
|
742
|
+
const named = shown(path);
|
|
743
|
+
// An excluded name is left out with all under it, the base too.
|
|
744
|
+
if (skipped(path, named, entry))
|
|
745
|
+
continue;
|
|
746
|
+
const kind = entry;
|
|
747
|
+
// `followSymlinks` takes a link to a directory as one.
|
|
748
|
+
const isDirectory = kind.isDirectory() ||
|
|
749
|
+
(follow && kind.isSymbolicLink() && (await this.linksToDirectory(path)));
|
|
750
|
+
if ((magic === -1 ? relative === '' : posix.matchesGlob(relative, rest)) &&
|
|
751
|
+
(!directories || isDirectory) &&
|
|
752
|
+
!seen.has(named)) {
|
|
753
|
+
seen.add(named);
|
|
754
|
+
yield typed ? entry : named;
|
|
755
|
+
}
|
|
756
|
+
if (magic === -1 || !isDirectory || level >= depth)
|
|
757
|
+
continue;
|
|
758
|
+
// A mounted directory's name is where the namespace's links lead,
|
|
759
|
+
// which needs no lookup; a host one is node's own realpath.
|
|
760
|
+
const real = !follow
|
|
761
|
+
? path
|
|
762
|
+
: this.mounted(path)
|
|
763
|
+
? this.files.walked(path)
|
|
764
|
+
: await routed.realpath(path);
|
|
765
|
+
if (follow && walked.includes(real))
|
|
766
|
+
continue;
|
|
767
|
+
const branch = follow ? [...walked, real] : walked;
|
|
768
|
+
const children = (await routed.readdir(path, { withFileTypes: true }));
|
|
769
|
+
for (const child of children) {
|
|
770
|
+
const childPath = posix.join(path, child.name);
|
|
771
|
+
pending.push([
|
|
772
|
+
childPath,
|
|
773
|
+
relative === '' ? child.name : `${relative}/${child.name}`,
|
|
774
|
+
child.isSymbolicLink() && !follow ? depth : level + 1,
|
|
775
|
+
child,
|
|
776
|
+
branch,
|
|
777
|
+
]);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
async mkdtemp(prefix, options) {
|
|
783
|
+
// A prefix whose names fall outside the mount (`/data` makes
|
|
784
|
+
// `/dataXXXXXX`) is the host's.
|
|
785
|
+
if (!this.mounted(`${prefix}XXXXXX`))
|
|
786
|
+
return this.nativeCall('mkdtemp', prefix, options);
|
|
787
|
+
// Six characters after the prefix, as node's template has them, drawn
|
|
788
|
+
// again for a name already there.
|
|
789
|
+
for (;;) {
|
|
790
|
+
const path = prefix + tempSuffix();
|
|
791
|
+
try {
|
|
792
|
+
await this.files.mkdir(path);
|
|
793
|
+
await this.narrowed(path, 0o700);
|
|
794
|
+
return encoded(path, options);
|
|
795
|
+
}
|
|
796
|
+
catch (err) {
|
|
797
|
+
if (classify(err) !== 'EEXIST')
|
|
798
|
+
throw fsError(err, 'mkdtemp', path);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
async mkdtempDisposable(prefix, options) {
|
|
803
|
+
// The name handed back takes the encoding asked for; the removal takes
|
|
804
|
+
// the directory's own.
|
|
805
|
+
const made = String(await this.mkdtemp(prefix));
|
|
806
|
+
const remove = () => routed.rm(made, { recursive: true, force: true });
|
|
807
|
+
return { path: encoded(made, options), remove, [Symbol.asyncDispose]: remove };
|
|
808
|
+
}
|
|
809
|
+
async opendir(path, options) {
|
|
810
|
+
try {
|
|
811
|
+
return openedDir(path, await this.readdir(path, {
|
|
812
|
+
withFileTypes: true,
|
|
813
|
+
recursive: fieldsOf(options).recursive === true,
|
|
814
|
+
encoding: fieldsOf(options).encoding,
|
|
815
|
+
}));
|
|
816
|
+
}
|
|
817
|
+
catch (err) {
|
|
818
|
+
throw fsError(err, 'opendir', path);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
async realpath(path, options) {
|
|
822
|
+
// As realpath(3) walks a path: each name in turn, a link swapped for
|
|
823
|
+
// where it leads, so a `..` after a link climbs from its target.
|
|
824
|
+
const todo = path.split('/');
|
|
825
|
+
let done = '/';
|
|
826
|
+
let hops = 0;
|
|
827
|
+
for (let name = todo.shift(); name !== undefined; name = todo.shift()) {
|
|
828
|
+
if (name === '' || name === '.')
|
|
829
|
+
continue;
|
|
830
|
+
if (name === '..') {
|
|
831
|
+
done = posix.dirname(done);
|
|
832
|
+
continue;
|
|
833
|
+
}
|
|
834
|
+
const next = posix.join(done, name);
|
|
835
|
+
let st;
|
|
836
|
+
try {
|
|
837
|
+
st = await this.files.stat(next, true);
|
|
838
|
+
}
|
|
839
|
+
catch (err) {
|
|
840
|
+
throw fsError(err, 'realpath', path);
|
|
841
|
+
}
|
|
842
|
+
if (st.isLink === true) {
|
|
843
|
+
if (++hops > MAX_SYMLINK_HOPS)
|
|
844
|
+
throw refusal('ELOOP', 'realpath', path);
|
|
845
|
+
const target = await this.files.readlink(next);
|
|
846
|
+
if (target.startsWith('/'))
|
|
847
|
+
done = '/';
|
|
848
|
+
todo.unshift(...target.split('/'));
|
|
849
|
+
continue;
|
|
850
|
+
}
|
|
851
|
+
if (!st.isDir && todo.some((rest) => rest !== ''))
|
|
852
|
+
throw refusal('ENOTDIR', 'realpath', path);
|
|
853
|
+
done = next;
|
|
854
|
+
}
|
|
855
|
+
return encoded(done, options);
|
|
856
|
+
}
|
|
484
857
|
async readFile(path, options) {
|
|
485
858
|
const bytes = Buffer.from(await this.files.read(path));
|
|
486
859
|
const encoding = encodingOf(options);
|
|
@@ -493,7 +866,7 @@ class HostFs {
|
|
|
493
866
|
const walk = async (directory, prefix) => {
|
|
494
867
|
for (const row of await this.files.readdir(directory, typed || recursive)) {
|
|
495
868
|
const name = entryName(row.path);
|
|
496
|
-
out.push(typed ?
|
|
869
|
+
out.push(typed ? dirent(directory, row, encoded(name, options)) : encoded(prefix + name, options));
|
|
497
870
|
if (recursive && row.isDir && row.isLink !== true) {
|
|
498
871
|
await walk(posix.join(directory, name), `${prefix}${name}/`);
|
|
499
872
|
}
|
|
@@ -503,40 +876,26 @@ class HostFs {
|
|
|
503
876
|
return out;
|
|
504
877
|
}
|
|
505
878
|
async readlink(path, options) {
|
|
506
|
-
|
|
507
|
-
const encoding = encodingOf(options);
|
|
508
|
-
if (encoding === undefined || encoding === 'utf8')
|
|
509
|
-
return target;
|
|
510
|
-
const bytes = Buffer.from(target);
|
|
511
|
-
return encoding === 'buffer' ? bytes : bytes.toString(encoding);
|
|
879
|
+
return encoded(await this.files.readlink(path), options);
|
|
512
880
|
}
|
|
513
881
|
async rename(src, dst) {
|
|
514
882
|
// A move between a mount and the host is EXDEV, the kernel's answer
|
|
515
883
|
// for two filesystems and the errno a mover retries as copy + delete.
|
|
516
884
|
if (!this.mounted(src) || !this.mounted(dst))
|
|
517
885
|
throw refusal('EXDEV', 'rename', src);
|
|
518
|
-
//
|
|
519
|
-
// link the walk takes. A rename onto its own name changes nothing, its
|
|
520
|
-
// descriptors included.
|
|
521
|
-
const from = this.descriptors.walked(src, false);
|
|
522
|
-
const to = this.descriptors.walked(dst, false);
|
|
523
|
-
const held = from === to ? [] : await this.descriptors.hold(dst);
|
|
886
|
+
// The descriptors open on either end follow it (the core sees to it).
|
|
524
887
|
await this.files.rename(src, dst);
|
|
525
|
-
this.descriptors.keep(held);
|
|
526
|
-
this.descriptors.moved(from, to);
|
|
527
888
|
}
|
|
528
889
|
/** Remove a file, the descriptors open on it keeping the bytes it had. */
|
|
529
890
|
async removeFile(path) {
|
|
530
|
-
const held = await this.descriptors.hold(path);
|
|
531
891
|
await this.files.unlink(path);
|
|
532
|
-
this.descriptors.keep(held);
|
|
533
892
|
}
|
|
534
893
|
async rm(path, options) {
|
|
535
894
|
const force = fieldsOf(options).force === true;
|
|
536
895
|
const recursive = fieldsOf(options).recursive === true;
|
|
537
896
|
// A mount root is refused however it is spelled (`/data/.`), before
|
|
538
897
|
// the stat a backend may answer for that spelling or not.
|
|
539
|
-
if (this.ws.
|
|
898
|
+
if (this.ws.vfs.isMount(posix.normalize(path)))
|
|
540
899
|
throw refusal('EBUSY', 'rm', path);
|
|
541
900
|
let st;
|
|
542
901
|
try {
|
|
@@ -578,7 +937,7 @@ class HostFs {
|
|
|
578
937
|
* before anything goes, as the agent adapters plan it, so a mount root
|
|
579
938
|
* anywhere in it refuses the call with nothing removed. */
|
|
580
939
|
async plan(path, isDir, out, top, where) {
|
|
581
|
-
if (this.ws.
|
|
940
|
+
if (this.ws.vfs.isMount(posix.normalize(path)))
|
|
582
941
|
throw refusal('EBUSY', 'rm', path);
|
|
583
942
|
if (isDir) {
|
|
584
943
|
this.held(path, where);
|
|
@@ -613,7 +972,7 @@ class HostFs {
|
|
|
613
972
|
async rmdir(path) {
|
|
614
973
|
// rmdir(2) on a mount point is EBUSY. A mount root is the
|
|
615
974
|
// deployment's own, which the shell's rm refuses the same way.
|
|
616
|
-
if (this.ws.
|
|
975
|
+
if (this.ws.vfs.isMount(posix.normalize(path))) {
|
|
617
976
|
throw refusal('EBUSY', 'rmdir', path);
|
|
618
977
|
}
|
|
619
978
|
await this.files.rmdir(path);
|
|
@@ -628,16 +987,14 @@ class HostFs {
|
|
|
628
987
|
// truncate(2) names a file that is there; the op creates a missing
|
|
629
988
|
// one, as GNU truncate does without -c.
|
|
630
989
|
await this.files.stat(path);
|
|
631
|
-
await this.descriptors.landPath(path);
|
|
632
990
|
await this.files.truncate(path, length);
|
|
633
991
|
}
|
|
634
992
|
async unlink(path) {
|
|
635
993
|
await this.removeFile(path);
|
|
636
994
|
}
|
|
637
995
|
async utimes(path, atime, mtime) {
|
|
638
|
-
// Writes a descriptor still owes land first
|
|
639
|
-
// close would stamp over the times set here.
|
|
640
|
-
await this.descriptors.landPath(path);
|
|
996
|
+
// Writes a descriptor still owes land first (the core sees to it), or
|
|
997
|
+
// landing them at its close would stamp over the times set here.
|
|
641
998
|
await this.files.setattr(path, { atime: stampOf(atime), mtime: stampOf(mtime) });
|
|
642
999
|
}
|
|
643
1000
|
async writeFile(path, data, options) {
|
|
@@ -650,7 +1007,7 @@ class HostFs {
|
|
|
650
1007
|
throw ebadf(String(target.fd));
|
|
651
1008
|
const fd = target instanceof MountedFileHandle ? target.fd : target;
|
|
652
1009
|
if (name === 'readFile') {
|
|
653
|
-
const read = () =>
|
|
1010
|
+
const read = () => this.descriptors.file(fd, true, false).read(-1);
|
|
654
1011
|
const bytes = Buffer.from(await this.descriptors.serial(fd, read));
|
|
655
1012
|
const encoding = encodingOf(rest[0]);
|
|
656
1013
|
return encoding === undefined ? bytes : bytes.toString(encoding);
|
|
@@ -671,22 +1028,23 @@ class HostFs {
|
|
|
671
1028
|
/** A read into `buffer` at `offset`, at `position` or, when null, at the
|
|
672
1029
|
* descriptor's own position, advancing it. The caller holds its queue. */
|
|
673
1030
|
async readInto(fd, buffer, offset, length, position) {
|
|
674
|
-
const
|
|
675
|
-
const bytes = position === null ? await
|
|
1031
|
+
const desc = this.descriptors.file(fd, true, false);
|
|
1032
|
+
const bytes = position === null ? await desc.read(length) : await desc.pread(position, length);
|
|
676
1033
|
buffer.set(bytes, offset);
|
|
677
1034
|
return bytes.byteLength;
|
|
678
1035
|
}
|
|
679
1036
|
/** A write through a mounted descriptor, in its turn on the descriptor. */
|
|
680
1037
|
fdWrite(fd, bytes, position) {
|
|
681
|
-
return this.descriptors.serial(fd, () => {
|
|
682
|
-
const
|
|
1038
|
+
return this.descriptors.serial(fd, async () => {
|
|
1039
|
+
const desc = this.descriptors.file(fd, false, true);
|
|
683
1040
|
// Linux appends a positioned write on an O_APPEND descriptor,
|
|
684
|
-
// whatever the position, and leaves the position where it was
|
|
1041
|
+
// whatever the position, and leaves the position where it was: the
|
|
1042
|
+
// core writes an appending handle at its end.
|
|
685
1043
|
if (position === null)
|
|
686
|
-
|
|
1044
|
+
await desc.write(bytes.slice());
|
|
687
1045
|
else
|
|
688
|
-
|
|
689
|
-
return
|
|
1046
|
+
await desc.pwrite(position, bytes.slice());
|
|
1047
|
+
return bytes.byteLength;
|
|
690
1048
|
});
|
|
691
1049
|
}
|
|
692
1050
|
/** A descriptor call on a mounted descriptor, answered with what node's
|
|
@@ -730,23 +1088,17 @@ class HostFs {
|
|
|
730
1088
|
return [await this.fdWrite(fd, joined, position), buffers];
|
|
731
1089
|
}
|
|
732
1090
|
case 'fstat': {
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
return [
|
|
736
|
-
this.statsOf(desc.opened, { ...st, size }, rest[0], desc.kept !== null),
|
|
737
|
-
];
|
|
1091
|
+
const row = await this.files.fstat(desc.fd);
|
|
1092
|
+
return [this.statsOf(desc.inode, row, rest[0], this.files.unlinked(desc.fd))];
|
|
738
1093
|
}
|
|
739
1094
|
case 'ftruncate':
|
|
740
1095
|
if (!desc.mode.writable)
|
|
741
1096
|
throw einval(desc.path);
|
|
742
|
-
await this.descriptors.serial(fd, () =>
|
|
743
|
-
this.descriptors.file(fd, false, true).truncate(Math.max(0, Number(rest[0] ?? 0)));
|
|
744
|
-
return Promise.resolve();
|
|
745
|
-
});
|
|
1097
|
+
await this.descriptors.serial(fd, () => this.descriptors.file(fd, false, true).truncate(Math.max(0, Number(rest[0] ?? 0))));
|
|
746
1098
|
return [];
|
|
747
1099
|
case 'fsync':
|
|
748
1100
|
case 'fdatasync':
|
|
749
|
-
await this.descriptors.serial(fd, () =>
|
|
1101
|
+
await this.descriptors.serial(fd, () => desc.land());
|
|
750
1102
|
return [];
|
|
751
1103
|
case 'close':
|
|
752
1104
|
await this.descriptors.close(fd);
|
|
@@ -775,16 +1127,16 @@ class HostFs {
|
|
|
775
1127
|
const given = fieldsOf(options).flag;
|
|
776
1128
|
const flag = typeof given === 'string' ? given : fallback;
|
|
777
1129
|
const bytes = bytesOf(data, options);
|
|
778
|
-
|
|
779
|
-
|
|
1130
|
+
// An open, a write and a close through the core, as node's own do, so
|
|
1131
|
+
// the descriptors open on the file see it and an exclusive flag refuses
|
|
1132
|
+
// a name that is there.
|
|
1133
|
+
const fd = await this.files.open(path, openMode(openFlags(flag), constants));
|
|
1134
|
+
try {
|
|
1135
|
+
await this.files.pwrite(fd, 0, bytes);
|
|
1136
|
+
}
|
|
1137
|
+
finally {
|
|
1138
|
+
await this.files.close(fd);
|
|
780
1139
|
}
|
|
781
|
-
// What descriptors on the file still owe lands first, so their older
|
|
782
|
-
// writes never land over this one.
|
|
783
|
-
await this.descriptors.landPath(path);
|
|
784
|
-
if (flag.startsWith('a'))
|
|
785
|
-
await this.files.append(path, bytes);
|
|
786
|
-
else
|
|
787
|
-
await this.files.write(path, bytes);
|
|
788
1140
|
}
|
|
789
1141
|
}
|
|
790
1142
|
/**
|
|
@@ -850,6 +1202,7 @@ export function patchNodeFs(ws) {
|
|
|
850
1202
|
const byDescriptor = (name, args) => FILE_CALLS.has(name) &&
|
|
851
1203
|
(host.descriptors.get(args[0]) !== undefined || args[0] instanceof MountedFileHandle);
|
|
852
1204
|
for (const name of ROUTED_CALLS) {
|
|
1205
|
+
// A promise, or for `glob` the iterator node's answers with.
|
|
853
1206
|
const route = (args) => host[name].call(host, ...spellPaths(name, args));
|
|
854
1207
|
swap(fs.promises, name, (original) => (...args) => {
|
|
855
1208
|
if (byDescriptor(name, args))
|
|
@@ -866,8 +1219,10 @@ export function patchNodeFs(ws) {
|
|
|
866
1219
|
if (typeof done !== 'function' || mountedIn(name, rest) === null)
|
|
867
1220
|
return original(...args);
|
|
868
1221
|
const callback = done;
|
|
869
|
-
|
|
870
|
-
|
|
1222
|
+
const answered = route(rest);
|
|
1223
|
+
(name === 'glob'
|
|
1224
|
+
? collected(answered)
|
|
1225
|
+
: answered).then((value) => {
|
|
871
1226
|
if (name === 'exists')
|
|
872
1227
|
callback(value);
|
|
873
1228
|
else
|
|
@@ -888,10 +1243,11 @@ export function patchNodeFs(ws) {
|
|
|
888
1243
|
if (path === null)
|
|
889
1244
|
return original(...args);
|
|
890
1245
|
// existsSync answers false where it cannot look, as node's does for
|
|
891
|
-
// any path whose stat fails; a mount
|
|
892
|
-
// knows is there without asking
|
|
1246
|
+
// any path whose stat fails; the root of a mount the session sees
|
|
1247
|
+
// is the one name it knows is there without asking, unless a `..`
|
|
1248
|
+
// in the spelling walks through a name it has not checked.
|
|
893
1249
|
if (name === 'exists')
|
|
894
|
-
return ws.
|
|
1250
|
+
return !path.split('/').includes('..') && ws.vfs.isMount(path);
|
|
895
1251
|
throw syncRefusal(`${name}Sync`, path);
|
|
896
1252
|
});
|
|
897
1253
|
}
|