@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.
Files changed (821) hide show
  1. package/README.md +140 -46
  2. package/dist/accessor/disk.d.ts +6 -0
  3. package/dist/accessor/disk.d.ts.map +1 -1
  4. package/dist/accessor/disk.js +8 -0
  5. package/dist/accessor/disk.js.map +1 -1
  6. package/dist/accessor/email.d.ts.map +1 -1
  7. package/dist/accessor/email.js +5 -0
  8. package/dist/accessor/email.js.map +1 -1
  9. package/dist/accessor/gridfs.d.ts.map +1 -1
  10. package/dist/accessor/gridfs.js +6 -1
  11. package/dist/accessor/gridfs.js.map +1 -1
  12. package/dist/accessor/hf_hub.d.ts +3 -7
  13. package/dist/accessor/hf_hub.d.ts.map +1 -1
  14. package/dist/accessor/hf_hub.js +10 -10
  15. package/dist/accessor/hf_hub.js.map +1 -1
  16. package/dist/cache/file/redis.d.ts +8 -7
  17. package/dist/cache/file/redis.d.ts.map +1 -1
  18. package/dist/cache/file/redis.js +46 -50
  19. package/dist/cache/file/redis.js.map +1 -1
  20. package/dist/commands/builtin/utils/http.js +13 -5
  21. package/dist/commands/builtin/utils/http.js.map +1 -1
  22. package/dist/commands/cli/builtin/hf/index.d.ts.map +1 -1
  23. package/dist/commands/cli/builtin/hf/index.js +4 -5
  24. package/dist/commands/cli/builtin/hf/index.js.map +1 -1
  25. package/dist/commands/cli/builtin/hf/upload.d.ts.map +1 -1
  26. package/dist/commands/cli/builtin/hf/upload.js +2 -5
  27. package/dist/commands/cli/builtin/hf/upload.js.map +1 -1
  28. package/dist/commands/cli/builtin/himalaya/builder.d.ts +2 -2
  29. package/dist/commands/cli/builtin/himalaya/builder.d.ts.map +1 -1
  30. package/dist/commands/cli/builtin/himalaya/builder.js +1 -1
  31. package/dist/commands/cli/builtin/himalaya/builder.js.map +1 -1
  32. package/dist/commands/cli/builtin/himalaya/deliver.d.ts +35 -7
  33. package/dist/commands/cli/builtin/himalaya/deliver.d.ts.map +1 -1
  34. package/dist/commands/cli/builtin/himalaya/deliver.js.map +1 -1
  35. package/dist/commands/cli/builtin/himalaya/index.d.ts.map +1 -1
  36. package/dist/commands/cli/builtin/himalaya/index.js +4 -5
  37. package/dist/commands/cli/builtin/himalaya/index.js.map +1 -1
  38. package/dist/commands/cli/builtin/himalaya/query.d.ts +2 -2
  39. package/dist/commands/cli/builtin/himalaya/query.d.ts.map +1 -1
  40. package/dist/commands/cli/builtin/himalaya/query.js +1 -1
  41. package/dist/commands/cli/builtin/himalaya/query.js.map +1 -1
  42. package/dist/commands/cli/builtin/himalaya/send.d.ts.map +1 -1
  43. package/dist/commands/cli/builtin/himalaya/send.js +2 -1
  44. package/dist/commands/cli/builtin/himalaya/send.js.map +1 -1
  45. package/dist/commands/cli/builtin/himalaya/smtp.d.ts +2 -2
  46. package/dist/commands/cli/builtin/himalaya/smtp.d.ts.map +1 -1
  47. package/dist/commands/cli/builtin/himalaya/smtp.js +5 -0
  48. package/dist/commands/cli/builtin/himalaya/smtp.js.map +1 -1
  49. package/dist/commands/cli/builtin/himalaya/util.d.ts +1 -1
  50. package/dist/commands/cli/builtin/himalaya/util.d.ts.map +1 -1
  51. package/dist/commands/cli/builtin/himalaya/util.js +6 -5
  52. package/dist/commands/cli/builtin/himalaya/util.js.map +1 -1
  53. package/dist/config.d.ts +57 -37
  54. package/dist/config.d.ts.map +1 -1
  55. package/dist/config.js +152 -277
  56. package/dist/config.js.map +1 -1
  57. package/dist/core/disk/capacity.d.ts +13 -0
  58. package/dist/core/disk/capacity.d.ts.map +1 -0
  59. package/dist/core/disk/capacity.js +93 -0
  60. package/dist/core/disk/capacity.js.map +1 -0
  61. package/dist/core/disk/constants.d.ts +0 -1
  62. package/dist/core/disk/constants.d.ts.map +1 -1
  63. package/dist/core/disk/constants.js +0 -1
  64. package/dist/core/disk/constants.js.map +1 -1
  65. package/dist/core/disk/copy.d.ts.map +1 -1
  66. package/dist/core/disk/copy.js +24 -13
  67. package/dist/core/disk/copy.js.map +1 -1
  68. package/dist/core/disk/mkdir.d.ts.map +1 -1
  69. package/dist/core/disk/mkdir.js +9 -0
  70. package/dist/core/disk/mkdir.js.map +1 -1
  71. package/dist/core/disk/read.d.ts +3 -3
  72. package/dist/core/disk/read.d.ts.map +1 -1
  73. package/dist/core/disk/read.js +4 -19
  74. package/dist/core/disk/read.js.map +1 -1
  75. package/dist/core/disk/rename.d.ts +3 -0
  76. package/dist/core/disk/rename.d.ts.map +1 -1
  77. package/dist/core/disk/rename.js +15 -1
  78. package/dist/core/disk/rename.js.map +1 -1
  79. package/dist/core/disk/rm.d.ts.map +1 -1
  80. package/dist/core/disk/rm.js +11 -1
  81. package/dist/core/disk/rm.js.map +1 -1
  82. package/dist/core/disk/rmdir.d.ts.map +1 -1
  83. package/dist/core/disk/rmdir.js +4 -0
  84. package/dist/core/disk/rmdir.js.map +1 -1
  85. package/dist/core/disk/set_attrs.d.ts +2 -9
  86. package/dist/core/disk/set_attrs.d.ts.map +1 -1
  87. package/dist/core/disk/set_attrs.js +2 -1
  88. package/dist/core/disk/set_attrs.js.map +1 -1
  89. package/dist/core/disk/stream.d.ts +8 -0
  90. package/dist/core/disk/stream.d.ts.map +1 -1
  91. package/dist/core/disk/stream.js +33 -13
  92. package/dist/core/disk/stream.js.map +1 -1
  93. package/dist/core/disk/unlink.d.ts.map +1 -1
  94. package/dist/core/disk/unlink.js +4 -0
  95. package/dist/core/disk/unlink.js.map +1 -1
  96. package/dist/core/disk/utils.d.ts +2 -0
  97. package/dist/core/disk/utils.d.ts.map +1 -1
  98. package/dist/core/disk/utils.js +68 -21
  99. package/dist/core/disk/utils.js.map +1 -1
  100. package/dist/core/disk/write.d.ts +7 -2
  101. package/dist/core/disk/write.d.ts.map +1 -1
  102. package/dist/core/disk/write.js +22 -16
  103. package/dist/core/disk/write.js.map +1 -1
  104. package/dist/core/email/_parse.d.ts +60 -12
  105. package/dist/core/email/_parse.d.ts.map +1 -1
  106. package/dist/core/email/_parse.js +2 -2
  107. package/dist/core/email/_parse.js.map +1 -1
  108. package/dist/core/email/client.d.ts +36 -9
  109. package/dist/core/email/client.d.ts.map +1 -1
  110. package/dist/core/email/client.js +15 -0
  111. package/dist/core/email/client.js.map +1 -1
  112. package/dist/core/email/config.d.ts +6 -9
  113. package/dist/core/email/config.d.ts.map +1 -1
  114. package/dist/core/email/config.js +31 -27
  115. package/dist/core/email/config.js.map +1 -1
  116. package/dist/core/email/readdir.d.ts +2 -2
  117. package/dist/core/email/readdir.d.ts.map +1 -1
  118. package/dist/core/email/readdir.js +1 -1
  119. package/dist/core/email/readdir.js.map +1 -1
  120. package/dist/core/email/render.d.ts +5 -5
  121. package/dist/core/email/render.d.ts.map +1 -1
  122. package/dist/core/email/render.js.map +1 -1
  123. package/dist/core/email/search.d.ts +2 -2
  124. package/dist/core/email/search.d.ts.map +1 -1
  125. package/dist/core/email/search.js +1 -1
  126. package/dist/core/email/search.js.map +1 -1
  127. package/dist/core/gridfs/client.d.ts +25 -2
  128. package/dist/core/gridfs/client.d.ts.map +1 -1
  129. package/dist/core/gridfs/client.js +74 -7
  130. package/dist/core/gridfs/client.js.map +1 -1
  131. package/dist/core/gridfs/constants.d.ts +1 -0
  132. package/dist/core/gridfs/constants.d.ts.map +1 -1
  133. package/dist/core/gridfs/constants.js +5 -0
  134. package/dist/core/gridfs/constants.js.map +1 -1
  135. package/dist/core/gridfs/driver.d.ts +1 -0
  136. package/dist/core/gridfs/driver.d.ts.map +1 -1
  137. package/dist/core/gridfs/driver.js +80 -67
  138. package/dist/core/gridfs/driver.js.map +1 -1
  139. package/dist/core/gridfs/events.d.ts +8 -3
  140. package/dist/core/gridfs/events.d.ts.map +1 -1
  141. package/dist/core/gridfs/events.js +11 -3
  142. package/dist/core/gridfs/events.js.map +1 -1
  143. package/dist/core/gridfs/read.d.ts +2 -7
  144. package/dist/core/gridfs/read.d.ts.map +1 -1
  145. package/dist/core/gridfs/read.js +4 -9
  146. package/dist/core/gridfs/read.js.map +1 -1
  147. package/dist/core/gridfs/stream.d.ts.map +1 -1
  148. package/dist/core/gridfs/stream.js +5 -2
  149. package/dist/core/gridfs/stream.js.map +1 -1
  150. package/dist/core/gridfs/write.d.ts +1 -1
  151. package/dist/core/gridfs/write.d.ts.map +1 -1
  152. package/dist/core/gridfs/write.js +2 -2
  153. package/dist/core/gridfs/write.js.map +1 -1
  154. package/dist/core/hf_buckets/driver.d.ts.map +1 -1
  155. package/dist/core/hf_buckets/driver.js +16 -0
  156. package/dist/core/hf_buckets/driver.js.map +1 -1
  157. package/dist/core/hf_buckets/read.d.ts +2 -6
  158. package/dist/core/hf_buckets/read.d.ts.map +1 -1
  159. package/dist/core/hf_buckets/read.js +1 -1
  160. package/dist/core/hf_buckets/read.js.map +1 -1
  161. package/dist/core/hf_buckets/stream.d.ts.map +1 -1
  162. package/dist/core/hf_buckets/stream.js +2 -0
  163. package/dist/core/hf_buckets/stream.js.map +1 -1
  164. package/dist/core/hf_hub/admin.d.ts +3 -4
  165. package/dist/core/hf_hub/admin.d.ts.map +1 -1
  166. package/dist/core/hf_hub/admin.js +4 -4
  167. package/dist/core/hf_hub/admin.js.map +1 -1
  168. package/dist/core/hf_hub/client.d.ts +11 -24
  169. package/dist/core/hf_hub/client.d.ts.map +1 -1
  170. package/dist/core/hf_hub/client.js +40 -97
  171. package/dist/core/hf_hub/client.js.map +1 -1
  172. package/dist/core/hf_hub/commit.d.ts +8 -9
  173. package/dist/core/hf_hub/commit.d.ts.map +1 -1
  174. package/dist/core/hf_hub/commit.js +4 -6
  175. package/dist/core/hf_hub/commit.js.map +1 -1
  176. package/dist/core/hf_hub/config.d.ts +5 -4
  177. package/dist/core/hf_hub/config.d.ts.map +1 -1
  178. package/dist/core/hf_hub/config.js +3 -1
  179. package/dist/core/hf_hub/config.js.map +1 -1
  180. package/dist/core/hf_hub/constants.d.ts +0 -1
  181. package/dist/core/hf_hub/constants.d.ts.map +1 -1
  182. package/dist/core/hf_hub/constants.js +0 -1
  183. package/dist/core/hf_hub/constants.js.map +1 -1
  184. package/dist/core/hf_hub/read.d.ts +2 -5
  185. package/dist/core/hf_hub/read.d.ts.map +1 -1
  186. package/dist/core/hf_hub/read.js.map +1 -1
  187. package/dist/core/hf_hub/stream.d.ts.map +1 -1
  188. package/dist/core/hf_hub/stream.js +2 -0
  189. package/dist/core/hf_hub/stream.js.map +1 -1
  190. package/dist/core/nextcloud/capacity.js.map +1 -1
  191. package/dist/core/nextcloud/checksum.js +4 -3
  192. package/dist/core/nextcloud/checksum.js.map +1 -1
  193. package/dist/core/nextcloud/constants.d.ts +2 -0
  194. package/dist/core/nextcloud/constants.d.ts.map +1 -1
  195. package/dist/core/nextcloud/constants.js +4 -0
  196. package/dist/core/nextcloud/constants.js.map +1 -1
  197. package/dist/core/nextcloud/copy.js.map +1 -1
  198. package/dist/core/nextcloud/dav.d.ts +9 -3
  199. package/dist/core/nextcloud/dav.d.ts.map +1 -1
  200. package/dist/core/nextcloud/dav.js +20 -2
  201. package/dist/core/nextcloud/dav.js.map +1 -1
  202. package/dist/core/nextcloud/read.d.ts +2 -6
  203. package/dist/core/nextcloud/read.d.ts.map +1 -1
  204. package/dist/core/nextcloud/read.js +1 -1
  205. package/dist/core/nextcloud/read.js.map +1 -1
  206. package/dist/core/nextcloud/search/query.js +2 -2
  207. package/dist/core/nextcloud/search/query.js.map +1 -1
  208. package/dist/core/nextcloud/search/response.d.ts +3 -2
  209. package/dist/core/nextcloud/search/response.d.ts.map +1 -1
  210. package/dist/core/nextcloud/search/response.js +5 -5
  211. package/dist/core/nextcloud/search/response.js.map +1 -1
  212. package/dist/core/nextcloud/search/types.d.ts +1 -1
  213. package/dist/core/nextcloud/search/types.d.ts.map +1 -1
  214. package/dist/core/nextcloud/set_attrs.js.map +1 -1
  215. package/dist/core/nextcloud/stat.d.ts.map +1 -1
  216. package/dist/core/nextcloud/stat.js +7 -9
  217. package/dist/core/nextcloud/stat.js.map +1 -1
  218. package/dist/core/nextcloud/stream.d.ts.map +1 -1
  219. package/dist/core/nextcloud/stream.js +2 -0
  220. package/dist/core/nextcloud/stream.js.map +1 -1
  221. package/dist/core/nextcloud/write.d.ts +7 -1
  222. package/dist/core/nextcloud/write.d.ts.map +1 -1
  223. package/dist/core/nextcloud/write.js +81 -8
  224. package/dist/core/nextcloud/write.js.map +1 -1
  225. package/dist/core/ssh/append.d.ts +1 -2
  226. package/dist/core/ssh/append.d.ts.map +1 -1
  227. package/dist/core/ssh/append.js +1 -4
  228. package/dist/core/ssh/append.js.map +1 -1
  229. package/dist/core/ssh/checksum.d.ts.map +1 -1
  230. package/dist/core/ssh/checksum.js +1 -0
  231. package/dist/core/ssh/checksum.js.map +1 -1
  232. package/dist/core/ssh/rm.d.ts.map +1 -1
  233. package/dist/core/ssh/rm.js +15 -6
  234. package/dist/core/ssh/rm.js.map +1 -1
  235. package/dist/core/ssh/rmdir.d.ts.map +1 -1
  236. package/dist/core/ssh/rmdir.js +2 -22
  237. package/dist/core/ssh/rmdir.js.map +1 -1
  238. package/dist/core/ssh/set_attrs.d.ts +2 -9
  239. package/dist/core/ssh/set_attrs.d.ts.map +1 -1
  240. package/dist/core/ssh/set_attrs.js +1 -1
  241. package/dist/core/ssh/set_attrs.js.map +1 -1
  242. package/dist/core/ssh/stat.d.ts.map +1 -1
  243. package/dist/core/ssh/stat.js +5 -4
  244. package/dist/core/ssh/stat.js.map +1 -1
  245. package/dist/core/ssh/stream.d.ts.map +1 -1
  246. package/dist/core/ssh/stream.js +10 -1
  247. package/dist/core/ssh/stream.js.map +1 -1
  248. package/dist/core/ssh/utils.d.ts +8 -2
  249. package/dist/core/ssh/utils.d.ts.map +1 -1
  250. package/dist/core/ssh/utils.js +24 -3
  251. package/dist/core/ssh/utils.js.map +1 -1
  252. package/dist/core/ssh/write.d.ts +1 -2
  253. package/dist/core/ssh/write.d.ts.map +1 -1
  254. package/dist/core/ssh/write.js +1 -4
  255. package/dist/core/ssh/write.js.map +1 -1
  256. package/dist/fuse/constants.d.ts +3 -2
  257. package/dist/fuse/constants.d.ts.map +1 -1
  258. package/dist/fuse/constants.js +6 -3
  259. package/dist/fuse/constants.js.map +1 -1
  260. package/dist/fuse/fs.d.ts +1 -1
  261. package/dist/fuse/fs.d.ts.map +1 -1
  262. package/dist/fuse/fs.js +6 -3
  263. package/dist/fuse/fs.js.map +1 -1
  264. package/dist/fuse/mount.d.ts +5 -0
  265. package/dist/fuse/mount.d.ts.map +1 -1
  266. package/dist/fuse/mount.js +47 -15
  267. package/dist/fuse/mount.js.map +1 -1
  268. package/dist/index.d.ts +130 -159
  269. package/dist/index.d.ts.map +1 -1
  270. package/dist/index.js +86 -135
  271. package/dist/index.js.map +1 -1
  272. package/dist/io/gateway.d.ts +6 -0
  273. package/dist/io/gateway.d.ts.map +1 -0
  274. package/dist/io/gateway.js +357 -0
  275. package/dist/io/gateway.js.map +1 -0
  276. package/dist/io/network.d.ts +35 -0
  277. package/dist/io/network.d.ts.map +1 -0
  278. package/dist/io/network.js +187 -0
  279. package/dist/io/network.js.map +1 -0
  280. package/dist/io/spool.js +3 -3
  281. package/dist/io/spool.js.map +1 -1
  282. package/dist/mount/constants.d.ts +9 -2
  283. package/dist/mount/constants.d.ts.map +1 -1
  284. package/dist/mount/constants.js +9 -2
  285. package/dist/mount/constants.js.map +1 -1
  286. package/dist/mount/errors.d.ts +2 -11
  287. package/dist/mount/errors.d.ts.map +1 -1
  288. package/dist/mount/errors.js +28 -42
  289. package/dist/mount/errors.js.map +1 -1
  290. package/dist/mount/nfs.d.ts +2 -2
  291. package/dist/mount/nfs.d.ts.map +1 -1
  292. package/dist/mount/nfs.js +8 -20
  293. package/dist/mount/nfs.js.map +1 -1
  294. package/dist/mount/sftp.d.ts +3 -3
  295. package/dist/mount/sftp.d.ts.map +1 -1
  296. package/dist/mount/sftp.js +26 -53
  297. package/dist/mount/sftp.js.map +1 -1
  298. package/dist/observe/disk_store.js +1 -1
  299. package/dist/observe/disk_store.js.map +1 -1
  300. package/dist/runtime/js/host/constants.d.ts +1 -1
  301. package/dist/runtime/js/host/constants.d.ts.map +1 -1
  302. package/dist/runtime/js/host/constants.js +9 -8
  303. package/dist/runtime/js/host/constants.js.map +1 -1
  304. package/dist/runtime/js/host/descriptors.d.ts +11 -71
  305. package/dist/runtime/js/host/descriptors.d.ts.map +1 -1
  306. package/dist/runtime/js/host/descriptors.js +16 -202
  307. package/dist/runtime/js/host/descriptors.js.map +1 -1
  308. package/dist/runtime/js/host/fs.d.ts.map +1 -1
  309. package/dist/runtime/js/host/fs.js +491 -135
  310. package/dist/runtime/js/host/fs.js.map +1 -1
  311. package/dist/runtime/js/host/list.d.ts +21 -0
  312. package/dist/runtime/js/host/list.d.ts.map +1 -0
  313. package/dist/runtime/js/host/list.js +107 -0
  314. package/dist/runtime/js/host/list.js.map +1 -0
  315. package/dist/runtime/js/host/stat.d.ts +10 -0
  316. package/dist/runtime/js/host/stat.d.ts.map +1 -0
  317. package/dist/runtime/js/host/stat.js +70 -0
  318. package/dist/runtime/js/host/stat.js.map +1 -0
  319. package/dist/runtime/python/local/runtime.d.ts +8 -7
  320. package/dist/runtime/python/local/runtime.d.ts.map +1 -1
  321. package/dist/runtime/python/local/runtime.js +51 -74
  322. package/dist/runtime/python/local/runtime.js.map +1 -1
  323. package/dist/runtime/sandbox/apple_container/constants.d.ts +2 -3
  324. package/dist/runtime/sandbox/apple_container/constants.d.ts.map +1 -1
  325. package/dist/runtime/sandbox/apple_container/constants.js +4 -11
  326. package/dist/runtime/sandbox/apple_container/constants.js.map +1 -1
  327. package/dist/runtime/sandbox/apple_container/runtime.d.ts +13 -9
  328. package/dist/runtime/sandbox/apple_container/runtime.d.ts.map +1 -1
  329. package/dist/runtime/sandbox/apple_container/runtime.js +34 -41
  330. package/dist/runtime/sandbox/apple_container/runtime.js.map +1 -1
  331. package/dist/runtime/sandbox/daytona/runtime.d.ts +6 -4
  332. package/dist/runtime/sandbox/daytona/runtime.d.ts.map +1 -1
  333. package/dist/runtime/sandbox/daytona/runtime.js +9 -6
  334. package/dist/runtime/sandbox/daytona/runtime.js.map +1 -1
  335. package/dist/runtime/sandbox/docker/constants.d.ts +6 -1
  336. package/dist/runtime/sandbox/docker/constants.d.ts.map +1 -1
  337. package/dist/runtime/sandbox/docker/constants.js +6 -1
  338. package/dist/runtime/sandbox/docker/constants.js.map +1 -1
  339. package/dist/runtime/sandbox/docker/runtime.d.ts +8 -8
  340. package/dist/runtime/sandbox/docker/runtime.d.ts.map +1 -1
  341. package/dist/runtime/sandbox/docker/runtime.js +21 -25
  342. package/dist/runtime/sandbox/docker/runtime.js.map +1 -1
  343. package/dist/runtime/sandbox/microsandbox/constants.d.ts +1 -3
  344. package/dist/runtime/sandbox/microsandbox/constants.d.ts.map +1 -1
  345. package/dist/runtime/sandbox/microsandbox/constants.js +1 -5
  346. package/dist/runtime/sandbox/microsandbox/constants.js.map +1 -1
  347. package/dist/runtime/sandbox/microsandbox/runtime.d.ts +8 -8
  348. package/dist/runtime/sandbox/microsandbox/runtime.d.ts.map +1 -1
  349. package/dist/runtime/sandbox/microsandbox/runtime.js +22 -34
  350. package/dist/runtime/sandbox/microsandbox/runtime.js.map +1 -1
  351. package/dist/runtime/sandbox/program.d.ts +165 -0
  352. package/dist/runtime/sandbox/program.d.ts.map +1 -0
  353. package/dist/runtime/sandbox/program.js +724 -0
  354. package/dist/runtime/sandbox/program.js.map +1 -0
  355. package/dist/runtime/sandbox/sandlock/constants.d.ts +1 -1
  356. package/dist/runtime/sandbox/sandlock/constants.d.ts.map +1 -1
  357. package/dist/runtime/sandbox/sandlock/constants.js +1 -1
  358. package/dist/runtime/sandbox/sandlock/constants.js.map +1 -1
  359. package/dist/runtime/sandbox/sandlock/runtime.d.ts +5 -6
  360. package/dist/runtime/sandbox/sandlock/runtime.d.ts.map +1 -1
  361. package/dist/runtime/sandbox/sandlock/runtime.js +27 -16
  362. package/dist/runtime/sandbox/sandlock/runtime.js.map +1 -1
  363. package/dist/runtime/sandbox/smolvm/constants.d.ts +2 -3
  364. package/dist/runtime/sandbox/smolvm/constants.d.ts.map +1 -1
  365. package/dist/runtime/sandbox/smolvm/constants.js +6 -13
  366. package/dist/runtime/sandbox/smolvm/constants.js.map +1 -1
  367. package/dist/runtime/sandbox/smolvm/runtime.d.ts +8 -8
  368. package/dist/runtime/sandbox/smolvm/runtime.d.ts.map +1 -1
  369. package/dist/runtime/sandbox/smolvm/runtime.js +21 -27
  370. package/dist/runtime/sandbox/smolvm/runtime.js.map +1 -1
  371. package/dist/runtime/sandbox/ssh/runtime.d.ts +23 -12
  372. package/dist/runtime/sandbox/ssh/runtime.d.ts.map +1 -1
  373. package/dist/runtime/sandbox/ssh/runtime.js +85 -30
  374. package/dist/runtime/sandbox/ssh/runtime.js.map +1 -1
  375. package/dist/secrets/config.d.ts +2 -2
  376. package/dist/secrets/config.d.ts.map +1 -1
  377. package/dist/secrets/onepassword.d.ts +5 -8
  378. package/dist/secrets/onepassword.d.ts.map +1 -1
  379. package/dist/secrets/onepassword.js.map +1 -1
  380. package/dist/shell/console/redis/constants.d.ts +1 -0
  381. package/dist/shell/console/redis/constants.d.ts.map +1 -1
  382. package/dist/shell/console/redis/constants.js +3 -0
  383. package/dist/shell/console/redis/constants.js.map +1 -1
  384. package/dist/shell/console/redis/store.d.ts +24 -9
  385. package/dist/shell/console/redis/store.d.ts.map +1 -1
  386. package/dist/shell/console/redis/store.js +48 -16
  387. package/dist/shell/console/redis/store.js.map +1 -1
  388. package/dist/shell/job_table/redis.d.ts +52 -0
  389. package/dist/shell/job_table/redis.d.ts.map +1 -0
  390. package/dist/shell/job_table/redis.js +156 -0
  391. package/dist/shell/job_table/redis.js.map +1 -0
  392. package/dist/utils/loader.d.ts.map +1 -1
  393. package/dist/utils/loader.js +1 -3
  394. package/dist/utils/loader.js.map +1 -1
  395. package/dist/vfs/aliyun/aliyun.d.ts +4 -5
  396. package/dist/vfs/aliyun/aliyun.d.ts.map +1 -1
  397. package/dist/vfs/aliyun/aliyun.js +2 -4
  398. package/dist/vfs/aliyun/aliyun.js.map +1 -1
  399. package/dist/vfs/aliyun/config.d.ts +40 -6
  400. package/dist/vfs/aliyun/config.d.ts.map +1 -1
  401. package/dist/vfs/aliyun/config.js +5 -6
  402. package/dist/vfs/aliyun/config.js.map +1 -1
  403. package/dist/vfs/backblaze/backblaze.d.ts +4 -5
  404. package/dist/vfs/backblaze/backblaze.d.ts.map +1 -1
  405. package/dist/vfs/backblaze/backblaze.js +2 -4
  406. package/dist/vfs/backblaze/backblaze.js.map +1 -1
  407. package/dist/vfs/backblaze/config.d.ts +40 -6
  408. package/dist/vfs/backblaze/config.d.ts.map +1 -1
  409. package/dist/vfs/backblaze/config.js +5 -6
  410. package/dist/vfs/backblaze/config.js.map +1 -1
  411. package/dist/vfs/ceph/ceph.d.ts +4 -5
  412. package/dist/vfs/ceph/ceph.d.ts.map +1 -1
  413. package/dist/vfs/ceph/ceph.js +2 -4
  414. package/dist/vfs/ceph/ceph.js.map +1 -1
  415. package/dist/vfs/ceph/config.d.ts +42 -5
  416. package/dist/vfs/ceph/config.d.ts.map +1 -1
  417. package/dist/vfs/ceph/config.js +7 -5
  418. package/dist/vfs/ceph/config.js.map +1 -1
  419. package/dist/vfs/databricks_volume/config.d.ts +2 -2
  420. package/dist/vfs/databricks_volume/config.d.ts.map +1 -1
  421. package/dist/vfs/databricks_volume/config.js +1 -1
  422. package/dist/vfs/databricks_volume/config.js.map +1 -1
  423. package/dist/vfs/databricks_volume/databricks_volume.d.ts +6 -9
  424. package/dist/vfs/databricks_volume/databricks_volume.d.ts.map +1 -1
  425. package/dist/vfs/databricks_volume/databricks_volume.js +4 -9
  426. package/dist/vfs/databricks_volume/databricks_volume.js.map +1 -1
  427. package/dist/vfs/digitalocean/config.d.ts +40 -6
  428. package/dist/vfs/digitalocean/config.d.ts.map +1 -1
  429. package/dist/vfs/digitalocean/config.js +5 -6
  430. package/dist/vfs/digitalocean/config.js.map +1 -1
  431. package/dist/vfs/digitalocean/digitalocean.d.ts +4 -5
  432. package/dist/vfs/digitalocean/digitalocean.d.ts.map +1 -1
  433. package/dist/vfs/digitalocean/digitalocean.js +2 -4
  434. package/dist/vfs/digitalocean/digitalocean.js.map +1 -1
  435. package/dist/vfs/discord/discord.d.ts +7 -10
  436. package/dist/vfs/discord/discord.d.ts.map +1 -1
  437. package/dist/vfs/discord/discord.js +7 -12
  438. package/dist/vfs/discord/discord.js.map +1 -1
  439. package/dist/vfs/disk/disk.d.ts +14 -14
  440. package/dist/vfs/disk/disk.d.ts.map +1 -1
  441. package/dist/vfs/disk/disk.js +87 -52
  442. package/dist/vfs/disk/disk.js.map +1 -1
  443. package/dist/vfs/dropbox/config.d.ts +7 -12
  444. package/dist/vfs/dropbox/config.d.ts.map +1 -1
  445. package/dist/vfs/dropbox/config.js +18 -15
  446. package/dist/vfs/dropbox/config.js.map +1 -1
  447. package/dist/vfs/email/email.d.ts +13 -11
  448. package/dist/vfs/email/email.d.ts.map +1 -1
  449. package/dist/vfs/email/email.js +31 -16
  450. package/dist/vfs/email/email.js.map +1 -1
  451. package/dist/vfs/email/index.d.ts +1 -2
  452. package/dist/vfs/email/index.d.ts.map +1 -1
  453. package/dist/vfs/email/index.js +1 -2
  454. package/dist/vfs/email/index.js.map +1 -1
  455. package/dist/vfs/gcs/config.d.ts +36 -28
  456. package/dist/vfs/gcs/config.d.ts.map +1 -1
  457. package/dist/vfs/gcs/config.js +15 -39
  458. package/dist/vfs/gcs/config.js.map +1 -1
  459. package/dist/vfs/gcs/gcs.d.ts +4 -5
  460. package/dist/vfs/gcs/gcs.d.ts.map +1 -1
  461. package/dist/vfs/gcs/gcs.js +2 -4
  462. package/dist/vfs/gcs/gcs.js.map +1 -1
  463. package/dist/vfs/gridfs/config.d.ts +6 -7
  464. package/dist/vfs/gridfs/config.d.ts.map +1 -1
  465. package/dist/vfs/gridfs/config.js +25 -11
  466. package/dist/vfs/gridfs/config.js.map +1 -1
  467. package/dist/vfs/gridfs/gridfs.d.ts +10 -18
  468. package/dist/vfs/gridfs/gridfs.d.ts.map +1 -1
  469. package/dist/vfs/gridfs/gridfs.js +23 -40
  470. package/dist/vfs/gridfs/gridfs.js.map +1 -1
  471. package/dist/vfs/hf_buckets/config.d.ts +14 -17
  472. package/dist/vfs/hf_buckets/config.d.ts.map +1 -1
  473. package/dist/vfs/hf_buckets/config.js +41 -28
  474. package/dist/vfs/hf_buckets/config.js.map +1 -1
  475. package/dist/vfs/hf_buckets/hf_buckets.d.ts +10 -15
  476. package/dist/vfs/hf_buckets/hf_buckets.d.ts.map +1 -1
  477. package/dist/vfs/hf_buckets/hf_buckets.js +14 -22
  478. package/dist/vfs/hf_buckets/hf_buckets.js.map +1 -1
  479. package/dist/vfs/hf_datasets/config.d.ts +1 -4
  480. package/dist/vfs/hf_datasets/config.d.ts.map +1 -1
  481. package/dist/vfs/hf_datasets/config.js +1 -3
  482. package/dist/vfs/hf_datasets/config.js.map +1 -1
  483. package/dist/vfs/hf_datasets/hf_datasets.d.ts +4 -7
  484. package/dist/vfs/hf_datasets/hf_datasets.d.ts.map +1 -1
  485. package/dist/vfs/hf_datasets/hf_datasets.js +4 -6
  486. package/dist/vfs/hf_datasets/hf_datasets.js.map +1 -1
  487. package/dist/vfs/hf_hub/base.d.ts +4 -8
  488. package/dist/vfs/hf_hub/base.d.ts.map +1 -1
  489. package/dist/vfs/hf_hub/base.js +7 -11
  490. package/dist/vfs/hf_hub/base.js.map +1 -1
  491. package/dist/vfs/hf_models/config.d.ts +1 -4
  492. package/dist/vfs/hf_models/config.d.ts.map +1 -1
  493. package/dist/vfs/hf_models/config.js +1 -3
  494. package/dist/vfs/hf_models/config.js.map +1 -1
  495. package/dist/vfs/hf_models/hf_models.d.ts +4 -7
  496. package/dist/vfs/hf_models/hf_models.d.ts.map +1 -1
  497. package/dist/vfs/hf_models/hf_models.js +4 -6
  498. package/dist/vfs/hf_models/hf_models.js.map +1 -1
  499. package/dist/vfs/hf_spaces/config.d.ts +1 -4
  500. package/dist/vfs/hf_spaces/config.d.ts.map +1 -1
  501. package/dist/vfs/hf_spaces/config.js +1 -3
  502. package/dist/vfs/hf_spaces/config.js.map +1 -1
  503. package/dist/vfs/hf_spaces/hf_spaces.d.ts +4 -7
  504. package/dist/vfs/hf_spaces/hf_spaces.d.ts.map +1 -1
  505. package/dist/vfs/hf_spaces/hf_spaces.js +4 -6
  506. package/dist/vfs/hf_spaces/hf_spaces.js.map +1 -1
  507. package/dist/vfs/jaeger/jaeger.d.ts +7 -9
  508. package/dist/vfs/jaeger/jaeger.d.ts.map +1 -1
  509. package/dist/vfs/jaeger/jaeger.js +7 -11
  510. package/dist/vfs/jaeger/jaeger.js.map +1 -1
  511. package/dist/vfs/lancedb/lancedb.d.ts +10 -11
  512. package/dist/vfs/lancedb/lancedb.d.ts.map +1 -1
  513. package/dist/vfs/lancedb/lancedb.js +4 -5
  514. package/dist/vfs/lancedb/lancedb.js.map +1 -1
  515. package/dist/vfs/lancedb/store.d.ts +2 -2
  516. package/dist/vfs/lancedb/store.d.ts.map +1 -1
  517. package/dist/vfs/lancedb/store.js +3 -0
  518. package/dist/vfs/lancedb/store.js.map +1 -1
  519. package/dist/vfs/minio/config.d.ts +42 -5
  520. package/dist/vfs/minio/config.d.ts.map +1 -1
  521. package/dist/vfs/minio/config.js +7 -5
  522. package/dist/vfs/minio/config.js.map +1 -1
  523. package/dist/vfs/minio/minio.d.ts +4 -5
  524. package/dist/vfs/minio/minio.d.ts.map +1 -1
  525. package/dist/vfs/minio/minio.js +2 -4
  526. package/dist/vfs/minio/minio.js.map +1 -1
  527. package/dist/vfs/mongodb/mongodb.d.ts +10 -11
  528. package/dist/vfs/mongodb/mongodb.d.ts.map +1 -1
  529. package/dist/vfs/mongodb/mongodb.js +6 -7
  530. package/dist/vfs/mongodb/mongodb.js.map +1 -1
  531. package/dist/vfs/mongodb/store.d.ts +2 -1
  532. package/dist/vfs/mongodb/store.d.ts.map +1 -1
  533. package/dist/vfs/mongodb/store.js +11 -3
  534. package/dist/vfs/mongodb/store.js.map +1 -1
  535. package/dist/vfs/nextcloud/config.d.ts +5 -8
  536. package/dist/vfs/nextcloud/config.d.ts.map +1 -1
  537. package/dist/vfs/nextcloud/config.js +19 -13
  538. package/dist/vfs/nextcloud/config.js.map +1 -1
  539. package/dist/vfs/nextcloud/nextcloud.d.ts +8 -14
  540. package/dist/vfs/nextcloud/nextcloud.d.ts.map +1 -1
  541. package/dist/vfs/nextcloud/nextcloud.js +18 -29
  542. package/dist/vfs/nextcloud/nextcloud.js.map +1 -1
  543. package/dist/vfs/notion/notion.d.ts +7 -10
  544. package/dist/vfs/notion/notion.d.ts.map +1 -1
  545. package/dist/vfs/notion/notion.js +7 -10
  546. package/dist/vfs/notion/notion.js.map +1 -1
  547. package/dist/vfs/oci/config.d.ts +41 -27
  548. package/dist/vfs/oci/config.d.ts.map +1 -1
  549. package/dist/vfs/oci/config.js +18 -45
  550. package/dist/vfs/oci/config.js.map +1 -1
  551. package/dist/vfs/oci/oci.d.ts +4 -5
  552. package/dist/vfs/oci/oci.d.ts.map +1 -1
  553. package/dist/vfs/oci/oci.js +2 -4
  554. package/dist/vfs/oci/oci.js.map +1 -1
  555. package/dist/vfs/postgres/postgres.d.ts +10 -11
  556. package/dist/vfs/postgres/postgres.d.ts.map +1 -1
  557. package/dist/vfs/postgres/postgres.js +5 -6
  558. package/dist/vfs/postgres/postgres.js.map +1 -1
  559. package/dist/vfs/postgres/store.d.ts +3 -3
  560. package/dist/vfs/postgres/store.d.ts.map +1 -1
  561. package/dist/vfs/postgres/store.js +1 -0
  562. package/dist/vfs/postgres/store.js.map +1 -1
  563. package/dist/vfs/qingstor/config.d.ts +40 -6
  564. package/dist/vfs/qingstor/config.d.ts.map +1 -1
  565. package/dist/vfs/qingstor/config.js +5 -6
  566. package/dist/vfs/qingstor/config.js.map +1 -1
  567. package/dist/vfs/qingstor/qingstor.d.ts +4 -5
  568. package/dist/vfs/qingstor/qingstor.d.ts.map +1 -1
  569. package/dist/vfs/qingstor/qingstor.js +2 -4
  570. package/dist/vfs/qingstor/qingstor.js.map +1 -1
  571. package/dist/vfs/r2/config.d.ts +39 -28
  572. package/dist/vfs/r2/config.d.ts.map +1 -1
  573. package/dist/vfs/r2/config.js +24 -48
  574. package/dist/vfs/r2/config.js.map +1 -1
  575. package/dist/vfs/r2/r2.d.ts +4 -5
  576. package/dist/vfs/r2/r2.d.ts.map +1 -1
  577. package/dist/vfs/r2/r2.js +2 -4
  578. package/dist/vfs/r2/r2.js.map +1 -1
  579. package/dist/vfs/redis/redis.d.ts +3 -0
  580. package/dist/vfs/redis/redis.d.ts.map +1 -1
  581. package/dist/vfs/redis/redis.js +1 -1
  582. package/dist/vfs/redis/redis.js.map +1 -1
  583. package/dist/vfs/redis/store.d.ts +2 -0
  584. package/dist/vfs/redis/store.d.ts.map +1 -1
  585. package/dist/vfs/redis/store.js +13 -2
  586. package/dist/vfs/redis/store.js.map +1 -1
  587. package/dist/vfs/registry.d.ts.map +1 -1
  588. package/dist/vfs/registry.js +111 -105
  589. package/dist/vfs/registry.js.map +1 -1
  590. package/dist/vfs/s3/config.d.ts +12 -23
  591. package/dist/vfs/s3/config.d.ts.map +1 -1
  592. package/dist/vfs/s3/config.js +16 -31
  593. package/dist/vfs/s3/config.js.map +1 -1
  594. package/dist/vfs/s3/s3.d.ts +6 -9
  595. package/dist/vfs/s3/s3.d.ts.map +1 -1
  596. package/dist/vfs/s3/s3.js +11 -14
  597. package/dist/vfs/s3/s3.js.map +1 -1
  598. package/dist/vfs/s3_alias.d.ts +69 -53
  599. package/dist/vfs/s3_alias.d.ts.map +1 -1
  600. package/dist/vfs/s3_alias.js +86 -82
  601. package/dist/vfs/s3_alias.js.map +1 -1
  602. package/dist/vfs/scaleway/config.d.ts +40 -6
  603. package/dist/vfs/scaleway/config.d.ts.map +1 -1
  604. package/dist/vfs/scaleway/config.js +5 -6
  605. package/dist/vfs/scaleway/config.js.map +1 -1
  606. package/dist/vfs/scaleway/scaleway.d.ts +4 -5
  607. package/dist/vfs/scaleway/scaleway.d.ts.map +1 -1
  608. package/dist/vfs/scaleway/scaleway.js +2 -4
  609. package/dist/vfs/scaleway/scaleway.js.map +1 -1
  610. package/dist/vfs/seaweedfs/config.d.ts +42 -5
  611. package/dist/vfs/seaweedfs/config.d.ts.map +1 -1
  612. package/dist/vfs/seaweedfs/config.js +7 -5
  613. package/dist/vfs/seaweedfs/config.js.map +1 -1
  614. package/dist/vfs/seaweedfs/seaweedfs.d.ts +4 -5
  615. package/dist/vfs/seaweedfs/seaweedfs.d.ts.map +1 -1
  616. package/dist/vfs/seaweedfs/seaweedfs.js +2 -4
  617. package/dist/vfs/seaweedfs/seaweedfs.js.map +1 -1
  618. package/dist/vfs/slack/slack.d.ts +7 -10
  619. package/dist/vfs/slack/slack.d.ts.map +1 -1
  620. package/dist/vfs/slack/slack.js +7 -12
  621. package/dist/vfs/slack/slack.js.map +1 -1
  622. package/dist/vfs/ssh/config.d.ts +5 -9
  623. package/dist/vfs/ssh/config.d.ts.map +1 -1
  624. package/dist/vfs/ssh/config.js +28 -18
  625. package/dist/vfs/ssh/config.js.map +1 -1
  626. package/dist/vfs/ssh/ssh.d.ts +8 -17
  627. package/dist/vfs/ssh/ssh.d.ts.map +1 -1
  628. package/dist/vfs/ssh/ssh.js +25 -43
  629. package/dist/vfs/ssh/ssh.js.map +1 -1
  630. package/dist/vfs/supabase/config.d.ts +40 -27
  631. package/dist/vfs/supabase/config.d.ts.map +1 -1
  632. package/dist/vfs/supabase/config.js +24 -48
  633. package/dist/vfs/supabase/config.js.map +1 -1
  634. package/dist/vfs/supabase/supabase.d.ts +4 -5
  635. package/dist/vfs/supabase/supabase.d.ts.map +1 -1
  636. package/dist/vfs/supabase/supabase.js +2 -4
  637. package/dist/vfs/supabase/supabase.js.map +1 -1
  638. package/dist/vfs/tencent/config.d.ts +40 -6
  639. package/dist/vfs/tencent/config.d.ts.map +1 -1
  640. package/dist/vfs/tencent/config.js +5 -6
  641. package/dist/vfs/tencent/config.js.map +1 -1
  642. package/dist/vfs/tencent/tencent.d.ts +4 -5
  643. package/dist/vfs/tencent/tencent.d.ts.map +1 -1
  644. package/dist/vfs/tencent/tencent.js +2 -4
  645. package/dist/vfs/tencent/tencent.js.map +1 -1
  646. package/dist/vfs/tidb_filesystem/config.d.ts +2 -0
  647. package/dist/vfs/tidb_filesystem/config.d.ts.map +1 -0
  648. package/dist/{mount/types.js → vfs/tidb_filesystem/config.js} +2 -2
  649. package/dist/vfs/tidb_filesystem/config.js.map +1 -0
  650. package/dist/vfs/tidb_filesystem/tidb_filesystem.d.ts +16 -0
  651. package/dist/vfs/tidb_filesystem/tidb_filesystem.d.ts.map +1 -0
  652. package/dist/vfs/tidb_filesystem/tidb_filesystem.js +39 -0
  653. package/dist/vfs/tidb_filesystem/tidb_filesystem.js.map +1 -0
  654. package/dist/vfs/wasabi/config.d.ts +35 -28
  655. package/dist/vfs/wasabi/config.d.ts.map +1 -1
  656. package/dist/vfs/wasabi/config.js +20 -45
  657. package/dist/vfs/wasabi/config.js.map +1 -1
  658. package/dist/vfs/wasabi/wasabi.d.ts +4 -5
  659. package/dist/vfs/wasabi/wasabi.d.ts.map +1 -1
  660. package/dist/vfs/wasabi/wasabi.js +2 -4
  661. package/dist/vfs/wasabi/wasabi.js.map +1 -1
  662. package/dist/workspace/{session → mount/namespace}/cas.lua +7 -2
  663. package/dist/workspace/mount/namespace/disk.d.ts +12 -7
  664. package/dist/workspace/mount/namespace/disk.d.ts.map +1 -1
  665. package/dist/workspace/mount/namespace/disk.js +37 -21
  666. package/dist/workspace/mount/namespace/disk.js.map +1 -1
  667. package/dist/workspace/mount/namespace/redis.d.ts +14 -9
  668. package/dist/workspace/mount/namespace/redis.d.ts.map +1 -1
  669. package/dist/workspace/mount/namespace/redis.js +29 -14
  670. package/dist/workspace/mount/namespace/redis.js.map +1 -1
  671. package/dist/workspace/nfs.d.ts.map +1 -1
  672. package/dist/workspace/nfs.js +3 -1
  673. package/dist/workspace/nfs.js.map +1 -1
  674. package/dist/workspace/record/disk.d.ts +12 -5
  675. package/dist/workspace/record/disk.d.ts.map +1 -1
  676. package/dist/workspace/record/disk.js +119 -72
  677. package/dist/workspace/record/disk.js.map +1 -1
  678. package/dist/workspace/store/disk.d.ts +12 -5
  679. package/dist/workspace/store/disk.d.ts.map +1 -1
  680. package/dist/workspace/store/disk.js +20 -4
  681. package/dist/workspace/store/disk.js.map +1 -1
  682. package/dist/workspace/store/redis.d.ts +13 -7
  683. package/dist/workspace/store/redis.d.ts.map +1 -1
  684. package/dist/workspace/store/redis.js +53 -26
  685. package/dist/workspace/store/redis.js.map +1 -1
  686. package/dist/workspace.d.ts +3 -1
  687. package/dist/workspace.d.ts.map +1 -1
  688. package/dist/workspace.js +22 -21
  689. package/dist/workspace.js.map +1 -1
  690. package/package.json +13 -17
  691. package/dist/compression_codecs.d.ts +0 -2
  692. package/dist/compression_codecs.d.ts.map +0 -1
  693. package/dist/compression_codecs.js +0 -42
  694. package/dist/compression_codecs.js.map +0 -1
  695. package/dist/core/disk/append.d.ts +0 -4
  696. package/dist/core/disk/append.d.ts.map +0 -1
  697. package/dist/core/disk/append.js +0 -30
  698. package/dist/core/disk/append.js.map +0 -1
  699. package/dist/mount/core.d.ts +0 -313
  700. package/dist/mount/core.d.ts.map +0 -1
  701. package/dist/mount/core.js +0 -916
  702. package/dist/mount/core.js.map +0 -1
  703. package/dist/mount/platform/macos.d.ts +0 -2
  704. package/dist/mount/platform/macos.d.ts.map +0 -1
  705. package/dist/mount/platform/macos.js +0 -23
  706. package/dist/mount/platform/macos.js.map +0 -1
  707. package/dist/mount/types.d.ts +0 -37
  708. package/dist/mount/types.d.ts.map +0 -1
  709. package/dist/mount/types.js.map +0 -1
  710. package/dist/observe/redis_store.d.ts +0 -27
  711. package/dist/observe/redis_store.d.ts.map +0 -1
  712. package/dist/observe/redis_store.js +0 -81
  713. package/dist/observe/redis_store.js.map +0 -1
  714. package/dist/runtime/sandbox/cli.d.ts +0 -71
  715. package/dist/runtime/sandbox/cli.d.ts.map +0 -1
  716. package/dist/runtime/sandbox/cli.js +0 -283
  717. package/dist/runtime/sandbox/cli.js.map +0 -1
  718. package/dist/vfs/aliyun/prompt.d.ts +0 -2
  719. package/dist/vfs/aliyun/prompt.d.ts.map +0 -1
  720. package/dist/vfs/aliyun/prompt.js +0 -19
  721. package/dist/vfs/aliyun/prompt.js.map +0 -1
  722. package/dist/vfs/backblaze/prompt.d.ts +0 -2
  723. package/dist/vfs/backblaze/prompt.d.ts.map +0 -1
  724. package/dist/vfs/backblaze/prompt.js +0 -19
  725. package/dist/vfs/backblaze/prompt.js.map +0 -1
  726. package/dist/vfs/ceph/prompt.d.ts +0 -2
  727. package/dist/vfs/ceph/prompt.d.ts.map +0 -1
  728. package/dist/vfs/ceph/prompt.js +0 -19
  729. package/dist/vfs/ceph/prompt.js.map +0 -1
  730. package/dist/vfs/digitalocean/prompt.d.ts +0 -2
  731. package/dist/vfs/digitalocean/prompt.d.ts.map +0 -1
  732. package/dist/vfs/digitalocean/prompt.js +0 -19
  733. package/dist/vfs/digitalocean/prompt.js.map +0 -1
  734. package/dist/vfs/disk/prompt.d.ts +0 -2
  735. package/dist/vfs/disk/prompt.d.ts.map +0 -1
  736. package/dist/vfs/disk/prompt.js +0 -17
  737. package/dist/vfs/disk/prompt.js.map +0 -1
  738. package/dist/vfs/email/prompt.d.ts +0 -3
  739. package/dist/vfs/email/prompt.d.ts.map +0 -1
  740. package/dist/vfs/email/prompt.js +0 -29
  741. package/dist/vfs/email/prompt.js.map +0 -1
  742. package/dist/vfs/gcs/prompt.d.ts +0 -2
  743. package/dist/vfs/gcs/prompt.d.ts.map +0 -1
  744. package/dist/vfs/gcs/prompt.js +0 -19
  745. package/dist/vfs/gcs/prompt.js.map +0 -1
  746. package/dist/vfs/gridfs/prompt.d.ts +0 -2
  747. package/dist/vfs/gridfs/prompt.d.ts.map +0 -1
  748. package/dist/vfs/gridfs/prompt.js +0 -19
  749. package/dist/vfs/gridfs/prompt.js.map +0 -1
  750. package/dist/vfs/hf_buckets/prompt.d.ts +0 -2
  751. package/dist/vfs/hf_buckets/prompt.d.ts.map +0 -1
  752. package/dist/vfs/hf_buckets/prompt.js +0 -18
  753. package/dist/vfs/hf_buckets/prompt.js.map +0 -1
  754. package/dist/vfs/hf_datasets/prompt.d.ts +0 -2
  755. package/dist/vfs/hf_datasets/prompt.d.ts.map +0 -1
  756. package/dist/vfs/hf_datasets/prompt.js +0 -18
  757. package/dist/vfs/hf_datasets/prompt.js.map +0 -1
  758. package/dist/vfs/hf_models/prompt.d.ts +0 -2
  759. package/dist/vfs/hf_models/prompt.d.ts.map +0 -1
  760. package/dist/vfs/hf_models/prompt.js +0 -18
  761. package/dist/vfs/hf_models/prompt.js.map +0 -1
  762. package/dist/vfs/hf_spaces/prompt.d.ts +0 -2
  763. package/dist/vfs/hf_spaces/prompt.d.ts.map +0 -1
  764. package/dist/vfs/hf_spaces/prompt.js +0 -18
  765. package/dist/vfs/hf_spaces/prompt.js.map +0 -1
  766. package/dist/vfs/jaeger/config.d.ts +0 -15
  767. package/dist/vfs/jaeger/config.d.ts.map +0 -1
  768. package/dist/vfs/jaeger/config.js +0 -28
  769. package/dist/vfs/jaeger/config.js.map +0 -1
  770. package/dist/vfs/minio/prompt.d.ts +0 -2
  771. package/dist/vfs/minio/prompt.d.ts.map +0 -1
  772. package/dist/vfs/minio/prompt.js +0 -19
  773. package/dist/vfs/minio/prompt.js.map +0 -1
  774. package/dist/vfs/nextcloud/prompt.d.ts +0 -2
  775. package/dist/vfs/nextcloud/prompt.d.ts.map +0 -1
  776. package/dist/vfs/nextcloud/prompt.js +0 -6
  777. package/dist/vfs/nextcloud/prompt.js.map +0 -1
  778. package/dist/vfs/oci/prompt.d.ts +0 -2
  779. package/dist/vfs/oci/prompt.d.ts.map +0 -1
  780. package/dist/vfs/oci/prompt.js +0 -19
  781. package/dist/vfs/oci/prompt.js.map +0 -1
  782. package/dist/vfs/qingstor/prompt.d.ts +0 -2
  783. package/dist/vfs/qingstor/prompt.d.ts.map +0 -1
  784. package/dist/vfs/qingstor/prompt.js +0 -19
  785. package/dist/vfs/qingstor/prompt.js.map +0 -1
  786. package/dist/vfs/r2/prompt.d.ts +0 -2
  787. package/dist/vfs/r2/prompt.d.ts.map +0 -1
  788. package/dist/vfs/r2/prompt.js +0 -19
  789. package/dist/vfs/r2/prompt.js.map +0 -1
  790. package/dist/vfs/scaleway/prompt.d.ts +0 -2
  791. package/dist/vfs/scaleway/prompt.d.ts.map +0 -1
  792. package/dist/vfs/scaleway/prompt.js +0 -19
  793. package/dist/vfs/scaleway/prompt.js.map +0 -1
  794. package/dist/vfs/seaweedfs/prompt.d.ts +0 -2
  795. package/dist/vfs/seaweedfs/prompt.d.ts.map +0 -1
  796. package/dist/vfs/seaweedfs/prompt.js +0 -19
  797. package/dist/vfs/seaweedfs/prompt.js.map +0 -1
  798. package/dist/vfs/ssh/prompt.d.ts +0 -2
  799. package/dist/vfs/ssh/prompt.d.ts.map +0 -1
  800. package/dist/vfs/ssh/prompt.js +0 -18
  801. package/dist/vfs/ssh/prompt.js.map +0 -1
  802. package/dist/vfs/supabase/prompt.d.ts +0 -2
  803. package/dist/vfs/supabase/prompt.d.ts.map +0 -1
  804. package/dist/vfs/supabase/prompt.js +0 -19
  805. package/dist/vfs/supabase/prompt.js.map +0 -1
  806. package/dist/vfs/tencent/prompt.d.ts +0 -2
  807. package/dist/vfs/tencent/prompt.d.ts.map +0 -1
  808. package/dist/vfs/tencent/prompt.js +0 -19
  809. package/dist/vfs/tencent/prompt.js.map +0 -1
  810. package/dist/vfs/wasabi/prompt.d.ts +0 -2
  811. package/dist/vfs/wasabi/prompt.d.ts.map +0 -1
  812. package/dist/vfs/wasabi/prompt.js +0 -19
  813. package/dist/vfs/wasabi/prompt.js.map +0 -1
  814. package/dist/workspace/session/disk.d.ts +0 -13
  815. package/dist/workspace/session/disk.d.ts.map +0 -1
  816. package/dist/workspace/session/disk.js +0 -29
  817. package/dist/workspace/session/disk.js.map +0 -1
  818. package/dist/workspace/session/redis.d.ts +0 -31
  819. package/dist/workspace/session/redis.d.ts.map +0 -1
  820. package/dist/workspace/session/redis.js +0 -87
  821. package/dist/workspace/session/redis.js.map +0 -1
@@ -1,916 +0,0 @@
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 { constants as fsConstants } from 'node:fs';
15
- import { posix } from 'node:path';
16
- import { readerOf } from '@struktoai/mirage-core/workspace/files';
17
- import { ChunkedHandle, FileTable, overlaid, writeRuns, } from '@struktoai/mirage-core/runtime/handles/index';
18
- import { READ_CHUNK } from '@struktoai/mirage-core/runtime/handles/constants';
19
- import { classify } from '@struktoai/mirage-core/errors/index';
20
- import { FileStat, FileType, LIVE_KEY } from '@struktoai/mirage-core/types';
21
- import { posixNormpath } from '@struktoai/mirage-core/utils/path';
22
- import { rstripSlash } from '@struktoai/mirage-core/utils/slash';
23
- import { compareCodePoints } from '@struktoai/mirage-core/utils/sort';
24
- import { DIR_MODE, DIR_SIZE, atimeMs, contentSize, deviceRdev, isDir, isLink, mtimeMs, posixMode, } from '@struktoai/mirage-core/utils/stat_view';
25
- import { callsAs, currentCaller, runWithSession, } from '@struktoai/mirage-core/context/session_context';
26
- import { skippedAtDispatch } from '@struktoai/mirage-core/policy/match/rule';
27
- import { enoent } from '@struktoai/mirage-core/errors/fs';
28
- import { isMacosMetadata } from "./platform/macos.js";
29
- /**
30
- * Protocol-neutral mount logic shared by every kernel adapter.
31
- *
32
- * Everything here is expressed in POSIX terms (attribute records, ordinary
33
- * thrown errors) and imports nothing from `@zkochan/fuse-native`, so it is
34
- * reusable by a non-FUSE adapter and unit-testable without a kernel.
35
- *
36
- * The division of labour: this class decides *what* the filesystem
37
- * contains, an adapter decides *how* to say it to a particular kernel
38
- * interface. Adapters translate the errors thrown here into their own
39
- * error codes with `classifyErrno`. Mirrors Python's `MountCore`.
40
- *
41
- * Every op goes through `ws.vfs`, which delegates to the dispatcher, so
42
- * a mount walks the same dispatcher as a shell line (mount modes, policies,
43
- * cache, invalidation) and every op it runs lands on the `ws.vfs.records`
44
- * ledger. Reaching `ws.dispatch` from here instead would skip the record;
45
- * reaching a backend directly would skip the dispatcher.
46
- */
47
- export class MountCore {
48
- files;
49
- session;
50
- now;
51
- root;
52
- handles = new FileTable();
53
- // Per file identity: the hydration read out (opens share it), a
54
- // generation a change under it bumps, the chain of mutations, the chain of
55
- // removals, and the opens out that a removal waits for.
56
- hydrations = new Map();
57
- hydrationGen = new Map();
58
- pending = new Map();
59
- removals = new Map();
60
- opening = new Map();
61
- uid;
62
- gid;
63
- constructor(files, options = {}) {
64
- this.files = files;
65
- this.now = new Date();
66
- this.root = options.rootPrefix !== undefined ? rstripSlash(options.rootPrefix) : '';
67
- this.uid = typeof process.getuid === 'function' ? process.getuid() : 0;
68
- this.gid = typeof process.getgid === 'function' ? process.getgid() : 0;
69
- this.session = options.session ?? null;
70
- const skipped = this.session === null ? [] : skippedAtDispatch(this.session.commands);
71
- if (this.session !== null && skipped.length > 0) {
72
- // This entry point sees ops, never a line, so the profile's command-level
73
- // rules have nothing here to judge.
74
- console.warn(`session ${this.session.sessionId}: an entry point that sees only ops (a kernel mount, ` +
75
- `SFTP, codex-exec's file calls) cannot apply ${skipped.join('; ')}; path rules, ` +
76
- 'hides and modes still hold');
77
- }
78
- }
79
- // ── helpers ──────────────────────────────────────────────────────
80
- /**
81
- * Run one op under the bound session's mount grants and profile, as the
82
- * Python MountCore binds each op: dispatch reads the session from
83
- * context, so binding at the op entry point is what scopes a kernel or
84
- * SFTP mount to it. Unbound, an op runs as whatever session is current.
85
- */
86
- op(fn) {
87
- return this.session === null ? fn() : runWithSession(this.session, fn);
88
- }
89
- resolve(path) {
90
- if (this.root === '')
91
- return path;
92
- return path === '/' ? this.root : this.root + path;
93
- }
94
- dirStat() {
95
- return {
96
- mtime: this.now,
97
- atime: this.now,
98
- ctime: this.now,
99
- nlink: 2,
100
- size: DIR_SIZE,
101
- mode: DIR_MODE,
102
- uid: this.uid,
103
- gid: this.gid,
104
- rdev: 0,
105
- };
106
- }
107
- /**
108
- * The attrs for one stat row, the way a guest's stat reads it. The row
109
- * carries the namespace overlay (chmod bits, chown ids, a touched mtime),
110
- * so what a metadata op stored is what the mount shows, and a device
111
- * keeps its type and numbers. String uid/gid (names) fall back to the
112
- * mounting user: the kernel wants numbers and there is no user db to map
113
- * against. A missing stamp falls back to the mount's start time; epoch
114
- * zero is a real time and lands. `size` replaces the row's, from an open
115
- * handle or a link's shown target. Mirrors Python's `MountCore.attrs`.
116
- */
117
- attrs(s, size = null) {
118
- const mtime = mtimeMs(s);
119
- const when = mtime === null ? this.now : new Date(mtime);
120
- const atime = atimeMs(s);
121
- return {
122
- mtime: when,
123
- atime: atime === null ? when : new Date(atime),
124
- ctime: when,
125
- nlink: isDir(s) ? 2 : 1,
126
- size: size ?? contentSize(s),
127
- mode: posixMode(s),
128
- uid: typeof s.uid === 'number' ? s.uid : this.uid,
129
- gid: typeof s.gid === 'number' ? s.gid : this.gid,
130
- rdev: deviceRdev(s),
131
- };
132
- }
133
- /**
134
- * The target to present for a link at a mount path. Relative targets are
135
- * stored verbatim and returned as-is. Absolute targets name virtual
136
- * paths, so they are rewritten relative to the link's directory: returned
137
- * raw, the kernel would resolve them against the host root and escape
138
- * the mountpoint.
139
- */
140
- shownTarget(path, target) {
141
- if (!target.startsWith('/'))
142
- return target;
143
- let virtualTarget = target;
144
- if (this.root !== '') {
145
- if (target === this.root) {
146
- virtualTarget = '/';
147
- }
148
- else if (target.startsWith(this.root + '/')) {
149
- virtualTarget = target.slice(this.root.length);
150
- }
151
- else {
152
- // points outside the scoped root: unreachable through this
153
- // mount, keep the stored form (a dangling link is legal)
154
- return target;
155
- }
156
- }
157
- const slash = path.lastIndexOf('/');
158
- const parent = slash <= 0 ? '/' : path.slice(0, slash);
159
- // A target that is the link's own directory is `.`, as Python's relpath
160
- // names it; posix.relative answers the empty string.
161
- return posix.relative(parent, virtualTarget) || '.';
162
- }
163
- /**
164
- * The length of the bytes an open handle on the file holds. A size-unknown
165
- * file is read whole when it opens, so while a handle is open its length
166
- * answers a stat by path too (`ls -l` beside a `cat`). Once every handle
167
- * is released, the dispatcher answers from the workspace cache instead.
168
- * Mirrors Python's `held_size`.
169
- */
170
- heldSize(path) {
171
- for (const ctx of this.openOn(this.identity(path))) {
172
- if (ctx.data !== undefined)
173
- return ctx.data.byteLength;
174
- }
175
- return null;
176
- }
177
- /**
178
- * Read a size-unknown file whole for the handle opening it, through the
179
- * dispatcher, so a caching mount keeps the bytes for the next open and for
180
- * a stat once this one closes. Undefined when the read fails: open() stays
181
- * permissive and the read() that follows surfaces the error. Mirrors
182
- * Python's `_hydrate`.
183
- */
184
- hydrate(path) {
185
- const key = this.identity(path);
186
- const inflight = this.hydrations.get(key);
187
- if (inflight !== undefined)
188
- return inflight;
189
- const promise = (async () => {
190
- try {
191
- for (;;) {
192
- const gen = this.hydrationGen.get(key) ?? 0;
193
- const data = await this.op(() => this.files.read(this.resolve(path)));
194
- // The file changed while this read was out: what came back is
195
- // stale, so read again rather than hand it over.
196
- if ((this.hydrationGen.get(key) ?? 0) !== gen)
197
- continue;
198
- return data;
199
- }
200
- }
201
- catch (err) {
202
- console.debug(`fuse: hydration read of ${path} failed, deferring to read(): ${String(err)}`);
203
- return undefined;
204
- }
205
- finally {
206
- this.hydrations.delete(key);
207
- this.hydrationGen.delete(key);
208
- }
209
- })();
210
- this.hydrations.set(key, promise);
211
- return promise;
212
- }
213
- /**
214
- * Run one mutation of a file after every mutation already queued for
215
- * it, and let the next one wait for it. Serialization is per identity,
216
- * so a flush through a link and a truncate through its target queue
217
- * behind each other, and a flush still landing cannot be overtaken by a
218
- * truncate that would then be undone when the flush completes.
219
- */
220
- mutate(key, fn) {
221
- return this.queue(this.pending, key, fn);
222
- }
223
- /**
224
- * Run `fn` holding the chain of every key, taken in sorted order so two
225
- * callers that hold the same pair never wait on each other. Mirrors
226
- * Python's `_queue_all`.
227
- */
228
- queueAll(queues, keys, fn) {
229
- const [first = '', ...rest] = [...new Set(keys)].sort(compareCodePoints);
230
- if (rest.length === 0)
231
- return this.queue(queues, first, fn);
232
- return this.queue(queues, first, () => this.queueAll(queues, rest, fn));
233
- }
234
- /**
235
- * Run `fn`, which removes, replaces or moves the files at `paths`, after
236
- * the opens of those names already out, with later ones held back until
237
- * it is done, as the kernel orders an open and an unlink or a rename of
238
- * one name. `hold` reads the rest for the handles open before; an open
239
- * that slipped in while that read was out would get a chunked handle onto
240
- * bytes about to go. Chains of their own, taken before any `pending` one,
241
- * rather than `pending` itself: an open they wait for may be truncating
242
- * there.
243
- */
244
- removing(paths, fn) {
245
- const keys = paths.map((path) => this.identity(path, false));
246
- return this.queueAll(this.removals, keys, async () => {
247
- await Promise.all(keys.flatMap((key) => [...(this.opening.get(key) ?? [])]));
248
- await fn();
249
- });
250
- }
251
- /**
252
- * Run `fn` after every call already queued under `key` in `queues`, and
253
- * let the next one wait for it, whether it resolves or throws.
254
- */
255
- queue(queues, key, fn) {
256
- const prev = queues.get(key) ?? Promise.resolve();
257
- const run = prev.then(fn, fn);
258
- const tail = run.then(() => undefined, () => undefined);
259
- queues.set(key, tail);
260
- void tail.then(() => {
261
- if (queues.get(key) === tail)
262
- queues.delete(key);
263
- });
264
- return run;
265
- }
266
- /**
267
- * Land write runs on the mount, one pwrite each, in order. A pwrite keeps
268
- * every stored byte the handle did not write, so nothing is read through
269
- * the dispatcher first: a session that may write a file and not read it writes
270
- * through FUSE, as through a write-only descriptor. The runs that landed
271
- * leave `runs` in one step, so after a failure `runs` holds only what did
272
- * not land and a retry never replays a run over bytes another writer has
273
- * since put there. A run that fails still invalidates what the core holds,
274
- * since the runs before it have landed.
275
- */
276
- async applyWrites(path, runs) {
277
- const target = this.resolve(path);
278
- let landed = 0;
279
- try {
280
- for (const [offset, data] of runs) {
281
- await this.op(() => this.files.pwrite(target, data, offset));
282
- landed += 1;
283
- }
284
- }
285
- finally {
286
- runs.splice(0, landed);
287
- await this.changed(path);
288
- }
289
- }
290
- // ── POSIX surface (throws; adapters classify) ────────────────────
291
- /**
292
- * POSIX attributes for a path. One stat through the dispatcher answers: a
293
- * link the session cannot see is absent, as it is to the shell, and a
294
- * visible one reports its own row with its target read through the
295
- * dispatcher too. `follow` reports a trailing link's target rather than
296
- * the link (stat rather than lstat).
297
- */
298
- async getattr(path, follow = false, ctx = null) {
299
- let size = ctx?.data?.byteLength ?? null;
300
- if (path === '/')
301
- return this.rootAttrs();
302
- // macOS Finder/Spotlight probes .DS_Store, ._*, .Spotlight-V100, etc.
303
- // Reject early to avoid hitting the ops layer.
304
- const name = path.slice(path.lastIndexOf('/') + 1);
305
- if (isMacosMetadata(name)) {
306
- throw enoent(path);
307
- }
308
- const virtual = this.resolve(path);
309
- let s;
310
- if (ctx?.detached !== undefined) {
311
- // Its name is gone: it stats by the row its file had then.
312
- s = ctx.detached;
313
- }
314
- else {
315
- try {
316
- s = await this.op(() => this.files.stat(virtual, undefined, { nofollow: !follow }));
317
- }
318
- catch (err) {
319
- // An open descriptor keeps the bytes it had after an unlink.
320
- if (size === null || classify(err) !== 'ENOENT')
321
- throw err;
322
- s = new FileStat({ name, type: FileType.FILE });
323
- }
324
- }
325
- if (isLink(s)) {
326
- const target = await this.op(() => this.files.readlink(virtual));
327
- return this.attrs(s, new TextEncoder().encode(this.shownTarget(path, target)).byteLength);
328
- }
329
- if (isDir(s))
330
- return this.attrs(s);
331
- // A size-unknown file stats as 0 rather than be fetched on every ls -l;
332
- // direct_io keeps its reads whole regardless.
333
- if (size === null && s.size === null)
334
- size = this.heldSize(path);
335
- if (ctx?.writeBuf !== undefined && ctx.writeBuf.length > 0) {
336
- let end = size ?? contentSize(s);
337
- for (const [offset, data] of ctx.writeBuf)
338
- end = Math.max(end, offset + data.byteLength);
339
- size = end;
340
- }
341
- return this.attrs(s, size);
342
- }
343
- /**
344
- * Attributes through an open handle: the path's row, with the size the
345
- * handle holds, what it wrote and has not flushed included.
346
- */
347
- async fgetattr(path, fd) {
348
- const ctx = this.handles.get(fd) ?? null;
349
- if (ctx !== null)
350
- await this.settled(ctx);
351
- return this.getattr(ctx?.path ?? path, ctx !== null, ctx);
352
- }
353
- /**
354
- * The mount root's attrs: its own row through the dispatcher, so a chmod
355
- * made on it shows, or a plain directory when nothing answers for it (a
356
- * workspace with no mount at `/`). Mirrors Python's `root_attrs`.
357
- */
358
- async rootAttrs() {
359
- let s;
360
- try {
361
- s = await this.op(() => this.files.stat(this.resolve('/')));
362
- }
363
- catch (err) {
364
- if (classify(err) !== 'ENOENT')
365
- throw err;
366
- console.debug(`fuse: the mount root has no row of its own: ${String(err)}`);
367
- return this.dirStat();
368
- }
369
- return this.attrs(s);
370
- }
371
- async readdir(path) {
372
- const names = new Set();
373
- const entries = await this.op(() => this.files.readdir(this.resolve(path)));
374
- for (const e of entries) {
375
- const part = rstripSlash(e).split('/').pop() ?? '';
376
- if (part !== '' && !isMacosMetadata(part))
377
- names.add(part);
378
- }
379
- return ['.', '..', ...[...names].sort(compareCodePoints)];
380
- }
381
- async read(path, fd, pos, len) {
382
- // A rendered read: a filetype registered on the mount shows as text.
383
- const ctx = this.handles.get(fd);
384
- if (ctx !== undefined)
385
- await this.settled(ctx);
386
- if (ctx === undefined) {
387
- // Whole, as a handle's first read is: the read that fills the cache
388
- // and records the version a conditional write sends.
389
- const data = await this.op(() => this.files.read(this.resolve(path)));
390
- return data.subarray(pos, pos + len);
391
- }
392
- let stored;
393
- if (ctx.live === true) {
394
- stored = await this.op(() => this.files.read(this.resolve(ctx.path), { offset: pos, size: len }));
395
- }
396
- else if (ctx.chunked !== undefined && ctx.data === undefined) {
397
- stored = await ctx.chunked.pread(pos, len);
398
- }
399
- else {
400
- let held = ctx.data;
401
- if (held === undefined) {
402
- // A change landing while this read is out keeps it from holding
403
- // what it fetched.
404
- const generation = ctx.generation ?? 0;
405
- held = await this.op(() => this.files.read(this.resolve(ctx.path)));
406
- if ((ctx.generation ?? 0) === generation)
407
- ctx.data = held;
408
- }
409
- stored = held.subarray(pos, pos + len);
410
- }
411
- if (ctx.writeBuf === undefined || ctx.writeBuf.length === 0)
412
- return stored;
413
- return overlaid(stored, pos, len, ctx.writeBuf);
414
- }
415
- /** Buffer a write on its handle, or apply it directly when there is none. */
416
- async write(path, fd, data, pos) {
417
- const ctx = this.handles.get(fd);
418
- const key = ctx === undefined ? this.identity(path) : ctx.key;
419
- this.supersede(key, pos, data.byteLength, ctx);
420
- if (ctx !== undefined) {
421
- ctx.writeBuf ??= [];
422
- ctx.writeBuf.push([pos, data]);
423
- return;
424
- }
425
- await this.mutate(key, () => this.applyWrites(path, [[pos, data]]));
426
- }
427
- /**
428
- * Cut a new write's range out of what the file's other handles hold:
429
- * their bytes there are older, and the new write replaces them. No two
430
- * handles on a file then hold the same bytes, so whichever flush, release
431
- * or sync lands first, the file ends as its writes were made. Nothing
432
- * lands here, so a write never waits on one.
433
- */
434
- supersede(key, pos, size, ctx) {
435
- // Its name is gone: the handles open there are on another file.
436
- if (ctx?.detached !== undefined)
437
- return;
438
- const end = pos + size;
439
- for (const other of this.openOn(key)) {
440
- if (other === ctx || other.writeBuf === undefined)
441
- continue;
442
- const kept = [];
443
- for (const [at, run] of other.writeBuf) {
444
- if (at >= end || at + run.byteLength <= pos) {
445
- kept.push([at, run]);
446
- continue;
447
- }
448
- if (at < pos)
449
- kept.push([at, run.subarray(0, pos - at)]);
450
- if (at + run.byteLength > end)
451
- kept.push([end, run.subarray(end - at)]);
452
- }
453
- other.writeBuf = kept;
454
- }
455
- }
456
- /**
457
- * Create an empty file and return a fresh handle. `mode` is what the
458
- * creator asked for, umask applied; null takes the mount's default.
459
- */
460
- async create(path, mode = null) {
461
- const key = this.identity(path);
462
- await this.mutate(key, async () => {
463
- await this.op(() => this.files.create(this.resolve(path)));
464
- await this.keepMode(path, mode);
465
- await this.changed(path);
466
- });
467
- return this.handles.add({ path, key });
468
- }
469
- /** Create a directory, keeping the mode it was asked for. */
470
- async mkdir(path, mode = null) {
471
- await this.op(() => this.files.mkdir(this.resolve(path)));
472
- await this.keepMode(path, mode);
473
- }
474
- /**
475
- * Store the mode a create asked for, when it is not the one the backend
476
- * made the entry with (a disk mount applies the daemon's umask), so
477
- * `open(O_CREAT, 0600)` and `mkdir -m` read back as asked without a
478
- * write per ordinary create. Mirrors Python's `_keep_mode`.
479
- */
480
- async keepMode(path, mode) {
481
- if (mode === null)
482
- return;
483
- try {
484
- const made = await this.op(() => this.files.stat(this.resolve(path)));
485
- if ((posixMode(made) & 0o7777) !== (mode & 0o7777))
486
- await this.setattr(path, mode);
487
- }
488
- catch (err) {
489
- // The entry exists: a policy that refuses the stat or the chmod leaves
490
- // the mode it was made with rather than failing a create that landed.
491
- console.debug(`mount: keeping the mode of ${path} failed: ${String(err)}`);
492
- }
493
- }
494
- /** The target of a namespace link, read through the dispatcher; EINVAL when not a link. */
495
- async readlink(path) {
496
- const target = await this.op(() => this.files.readlink(this.resolve(path)));
497
- return this.shownTarget(path, target);
498
- }
499
- /**
500
- * Create namespace link `dest -> src` (ln -s src dest; libfuse passes
501
- * the pointee first). Relative sources are stored verbatim (resolved
502
- * at follow time, exactly like the shell `ln -s`); absolute sources
503
- * are mapped into virtual space so a scoped mount stores the path it
504
- * will later follow.
505
- */
506
- async symlink(src, dest) {
507
- // The write routes through the dispatcher like every other FUSE op, so
508
- // session grants and admission policies refuse a scoped kernel
509
- // mount exactly like a scoped shell.
510
- const stored = src.startsWith('/') ? this.resolve(src) : src;
511
- await this.op(() => this.files.symlink(this.resolve(dest), stored));
512
- }
513
- /**
514
- * Remove the entry at `path`, a link entry like any other.
515
- *
516
- * A link routes through the dispatcher rather than straight to the node
517
- * table: `unlink` is a LINK_ENTRY_OPS member, so the dispatcher answers a
518
- * link path itself, gated by session grants and admission policies
519
- * and recorded on the ledger. Writing the table here instead let a
520
- * session-scoped kernel mount delete a link on a mount its profile
521
- * hides. Mirrors Python's MountCore.unlink.
522
- */
523
- async unlink(path) {
524
- const key = this.identity(path, false);
525
- await this.removing([path], () => this.mutate(key, async () => {
526
- const named = this.named(path);
527
- const row = await this.hold(path, named);
528
- await this.op(() => this.files.unlink(this.resolve(path)));
529
- for (const ctx of named)
530
- ctx.detached = row;
531
- await this.changed(path, false);
532
- }));
533
- }
534
- /**
535
- * The one function every mutation of a file's bytes goes through. The
536
- * open handles on a file are matched by its identity (the mount path with
537
- * namespace links followed), and this is the only place their bytes are
538
- * refreshed, so a new mutating op cannot forget one of them and a link
539
- * alias cannot slip past. A hydration still in flight is outdated so it
540
- * re-reads instead of handing over what it fetched, and hydrated handles
541
- * on the file are refreshed in one read through the dispatcher, so fstat
542
- * and read through any of them, including the handle that wrote, see the
543
- * new bytes. A removal or rename passes `rehydrate = false`: POSIX keeps
544
- * an open descriptor on the bytes it had, and the name, not what it
545
- * points at, is what changed. A refresh that fails is logged
546
- * and leaves the handles unhydrated rather than failing the committed
547
- * mutation. Mirrors Python's `_changed`.
548
- */
549
- async changed(path, rehydrate = true) {
550
- const key = this.identity(path, rehydrate);
551
- if (this.hydrations.has(key)) {
552
- this.hydrationGen.set(key, (this.hydrationGen.get(key) ?? 0) + 1);
553
- }
554
- if (!rehydrate)
555
- return;
556
- const handles = this.openOn(key);
557
- for (const ctx of handles) {
558
- ctx.generation = (ctx.generation ?? 0) + 1;
559
- ctx.chunked?.drop();
560
- }
561
- const hydrated = handles.filter((ctx) => ctx.data !== undefined);
562
- if (hydrated.length === 0)
563
- return;
564
- let data;
565
- try {
566
- data = await this.op(() => this.files.read(this.resolve(path)));
567
- }
568
- catch (err) {
569
- // The mutation landed, so a refresh that fails must not fail it; the
570
- // next read through these handles fetches and reports.
571
- console.warn(`fuse: refresh of ${path} after a change failed: ${String(err)}`);
572
- for (const ctx of hydrated)
573
- delete ctx.data;
574
- return;
575
- }
576
- for (const ctx of hydrated)
577
- ctx.data = data;
578
- }
579
- async rename(src, dst) {
580
- // The facade is where a cross-mount pair is refused with EXDEV,
581
- // which is what makes `mv` between two backends fall back to
582
- // copy+unlink instead of addressing the destination against the
583
- // source's backend.
584
- const source = this.resolve(src);
585
- const target = this.resolve(dst);
586
- const moved = this.identity(src, false);
587
- await this.removing([src, dst], () => this.queueAll(this.pending, [moved, this.identity(dst, false)], async () => {
588
- const replaced = this.named(dst).filter((ctx) => ctx.key !== moved);
589
- const row = await this.hold(dst, replaced);
590
- await this.op(() => this.files.rename(source, target));
591
- for (const ctx of replaced)
592
- ctx.detached = row;
593
- for (const ctx of this.handles.values()) {
594
- if (ctx.detached !== undefined)
595
- continue;
596
- if (ctx.key === source || ctx.key.startsWith(`${source}/`)) {
597
- ctx.key = target + ctx.key.slice(source.length);
598
- ctx.path = ctx.key.slice(this.root.length);
599
- }
600
- }
601
- await this.changed(src, false);
602
- await this.changed(dst, false);
603
- }));
604
- }
605
- // No emptiness pre-check: every backend's rmdir refuses a non-empty
606
- // directory itself.
607
- async rmdir(path) {
608
- await this.op(() => this.files.rmdir(this.resolve(path)));
609
- }
610
- /**
611
- * Where a mount path really points: the mount-resolved path with every
612
- * namespace link followed, so two handles opened through a link and
613
- * its target are recognised as the same file.
614
- */
615
- identity(path, follow = true) {
616
- const virtual = this.resolve(path);
617
- const reader = readerOf(this.files);
618
- // An op on the entry itself (unlink, rename, lsetattr) names the link,
619
- // which may loop: only the links above it are followed.
620
- const resolved = () => follow ? posixNormpath(reader.follow(virtual)) : reader.followParent(virtual);
621
- // Judged as the bound session judges every op (`op`): outside it the
622
- // facade's session is the default one, whose profile may hide a link
623
- // this session's handles were opened through.
624
- if (this.session === null)
625
- return resolved();
626
- return callsAs({ ...currentCaller(), session: this.session }, resolved)();
627
- }
628
- /**
629
- * Persist a handle's buffered writes. The buffer is detached before the
630
- * await so a write arriving meanwhile is not lost to the clear, and the
631
- * runs that did not land are restored ahead of those later writes when
632
- * persistence fails, so the acknowledged bytes stay for the handle's own
633
- * flush to retry.
634
- */
635
- async settle(ctx) {
636
- // Queued with nothing buffered too: a flush still landing has taken the
637
- // buffer, and this one waits for it and retries what it puts back,
638
- // rather than reporting the file settled.
639
- for (;;) {
640
- const key = ctx.key;
641
- const landed = await this.mutate(key, async () => {
642
- // A rename that moved the handle while this waited put its file in
643
- // another queue: it lands from that one instead.
644
- if (ctx.key !== key)
645
- return false;
646
- await this.persistBuffered(ctx);
647
- return true;
648
- });
649
- if (landed)
650
- return;
651
- }
652
- }
653
- /** The handles open on the entry at `path` itself. */
654
- named(path) {
655
- return this.openOn(this.identity(path, false));
656
- }
657
- /**
658
- * The handles open on the file `key` names. A detached handle is on a file
659
- * with no name left, whatever its key says.
660
- */
661
- openOn(key) {
662
- return [...this.handles.values()].filter((ctx) => ctx.key === key && ctx.detached === undefined);
663
- }
664
- /** Land the buffered writes of every handle open on `key`. */
665
- async landBuffered(key) {
666
- for (const ctx of this.openOn(key))
667
- await this.persistBuffered(ctx);
668
- }
669
- async persistBuffered(ctx) {
670
- // A detached handle keeps what it wrote, as writes to an unlinked file
671
- // stay with it: there is no name to land them on.
672
- if (ctx.writeBuf === undefined || ctx.writeBuf.length === 0 || ctx.detached !== undefined)
673
- return;
674
- const runs = writeRuns(ctx.writeBuf);
675
- ctx.writeBuf = [];
676
- try {
677
- await this.applyWrites(ctx.path, runs);
678
- }
679
- catch (err) {
680
- ctx.writeBuf = [...runs, ...ctx.writeBuf];
681
- throw err;
682
- }
683
- }
684
- async truncate(path, size) {
685
- // A write the kernel already acknowledged on another handle precedes
686
- // this truncation in POSIX order, so it is flushed first rather than
687
- // left queued to land over the shortened file at that handle's
688
- // release. Handles are matched by identity, not by the path they
689
- // were opened through, so a link alias is settled too. Mirrors
690
- // Python's MountCore.truncate.
691
- const key = this.identity(path);
692
- await this.mutate(key, async () => {
693
- await this.landBuffered(key);
694
- await this.op(() => this.files.truncate(this.resolve(path), size));
695
- await this.changed(path);
696
- });
697
- }
698
- statfs() {
699
- return {
700
- bsize: 4096,
701
- frsize: 4096,
702
- blocks: 1024 * 1024,
703
- bfree: 1024 * 1024,
704
- bavail: 1024 * 1024,
705
- files: 1_000_000,
706
- ffree: 1_000_000,
707
- favail: 1_000_000,
708
- namemax: 255,
709
- };
710
- }
711
- /**
712
- * Store metadata through the dispatcher. The backend keeps what it can and
713
- * the namespace overlay the rest, so a chmod, chown or `touch -d` through
714
- * the mount is what `stat` in a shell reads back, on a backend with no
715
- * permission bits or settable times of its own too. A null field is left
716
- * as it is. Mirrors Python's `MountCore.setattr`.
717
- */
718
- async setattr(path, mode, uid = null, gid = null, atime = null, mtime = null, follow = false) {
719
- // The kernel has already resolved any link the call follows, so a
720
- // kernel mount names the entry to change, a link itself for `chown -h`;
721
- // SFTP's setstat asks to follow one.
722
- const fields = { nofollow: !follow };
723
- if (mode !== null)
724
- fields.mode = mode & 0o7777;
725
- if (uid !== null)
726
- fields.uid = uid;
727
- if (gid !== null)
728
- fields.gid = gid;
729
- if (atime !== null)
730
- fields.atime = atime.toISOString();
731
- if (mtime !== null)
732
- fields.mtime = mtime.toISOString();
733
- const key = this.identity(path, follow);
734
- const timed = atime !== null || mtime !== null;
735
- const run = async () => {
736
- // cp -p sets times on a file it still holds open: its buffered
737
- // writes land first, or they would stamp over them.
738
- if (timed)
739
- await this.landBuffered(key);
740
- await this.op(() => this.files.setattr(this.resolve(path), fields));
741
- };
742
- await (timed ? this.mutate(key, run) : run());
743
- }
744
- /**
745
- * Store an extended attribute through the dispatcher, which keeps
746
- * it on the path's namespace node: it outlives the mount, moves with a
747
- * rename, and is the attribute every other surface (the shell's
748
- * getfattr, a guest's os.getxattr) reads. Tools that set xattrs as a
749
- * matter of course (rsync -aX, tar --xattrs, cp -p, Finder writing
750
- * com.apple.*) succeed on a backend with no attribute slot of its own.
751
- * Mirrors the python MountCore.
752
- */
753
- async setxattr(path, name, value, opts = {}) {
754
- await this.op(() => this.files.setxattr(this.resolve(path), name, Uint8Array.from(value), opts));
755
- }
756
- /** One attribute, the backend's own facts included; ENODATA when unset. */
757
- async getxattr(path, name) {
758
- return this.op(() => this.files.getxattr(this.resolve(path), name));
759
- }
760
- async listxattr(path) {
761
- return this.op(() => this.files.listxattr(this.resolve(path)));
762
- }
763
- async removexattr(path, name) {
764
- await this.op(() => this.files.removexattr(this.resolve(path), name));
765
- }
766
- async open(path, flags = 0) {
767
- for (let removal = this.removalOf(path); removal !== undefined; removal = this.removalOf(path)) {
768
- await removal;
769
- }
770
- const keys = new Set([this.identity(path, false), this.identity(path)]);
771
- const opened = this.openPath(path, flags);
772
- const out = opened.then(() => undefined, () => undefined);
773
- for (const key of keys)
774
- this.opening.set(key, (this.opening.get(key) ?? new Set()).add(out));
775
- try {
776
- return await opened;
777
- }
778
- finally {
779
- for (const key of keys) {
780
- const opening = this.opening.get(key);
781
- opening?.delete(out);
782
- if (opening?.size === 0)
783
- this.opening.delete(key);
784
- }
785
- }
786
- }
787
- /** The open itself, which a removal of its name waits for. */
788
- async openPath(path, flags) {
789
- const s = await this.op(() => this.files.stat(this.resolve(path)));
790
- const ctx = { path, key: this.identity(path), live: s.extra[LIVE_KEY] === true };
791
- if (s.type === FileType.DIRECTORY)
792
- return this.handles.add(ctx);
793
- if ((flags & fsConstants.O_TRUNC) !== 0) {
794
- // libfuse 3 sends no SETATTR ahead of an O_TRUNC open (atomic
795
- // O_TRUNC), so the flag is the whole truncation.
796
- await this.truncate(path, 0);
797
- }
798
- if (ctx.live === true)
799
- return this.handles.add(ctx);
800
- if (s.size === null) {
801
- // Hydrate through the rendered read path, after an O_TRUNC too: an
802
- // extension whose renderer gives an empty file a body is honored
803
- // rather than shadowed by literal raw emptiness.
804
- const data = await this.hydrate(path);
805
- if (data !== undefined)
806
- ctx.data = data;
807
- }
808
- else if (s.size > READ_CHUNK && (flags & fsConstants.O_TRUNC) === 0) {
809
- // Read a chunk at a time, at the handle's path then (a rename moves
810
- // it): a `head` must not move the file.
811
- ctx.chunked = new ChunkedHandle(path, s.size, (offset, size) => this.op(() => this.files.read(this.resolve(ctx.path), { offset, size })));
812
- }
813
- return this.handles.add(ctx);
814
- }
815
- /**
816
- * A removal of `path` still running. One is keyed by the name it takes, so
817
- * an open through a link meets the link's removal and then its target's.
818
- */
819
- removalOf(path) {
820
- return this.removals.get(this.identity(path, false)) ?? this.removals.get(this.identity(path));
821
- }
822
- /**
823
- * Keep what the handles open on `path` need once it goes, and return the
824
- * row they stat by from then on. POSIX keeps an open descriptor on the
825
- * file it had, so an unlink or a rename onto it must not leave a handle
826
- * reading or stat'ing the file at that name next. A handle holding no
827
- * bytes yet (never read, or chunked and holding one chunk) gets them all
828
- * from one read every such handle shares; it runs under `removing` and
829
- * the file's `pending` chain, so no handle opens on the file and no write
830
- * lands on it meanwhile. The handles are matched by the
831
- * entry itself, so removing a link holds nothing: it takes the link,
832
- * never its target's bytes. A stat or a read that fails (a policy may
833
- * allow the removal and refuse either) leaves a bare row or the handles
834
- * as they are, each on its own, rather than refusing a mutation the
835
- * caller is allowed. Mirrors Python's `MountCore._hold`.
836
- */
837
- async hold(path, named) {
838
- const bare = new FileStat({ name: path.slice(path.lastIndexOf('/') + 1), type: FileType.FILE });
839
- if (named.length === 0)
840
- return bare;
841
- const virtual = this.resolve(path);
842
- let row = bare;
843
- try {
844
- row = await this.op(() => this.files.stat(virtual));
845
- }
846
- catch (err) {
847
- console.warn(`fuse: the row of ${path} before it goes failed: ${String(err)}`);
848
- }
849
- const lacking = named.filter((ctx) => ctx.data === undefined && ctx.live !== true);
850
- if (lacking.length === 0)
851
- return row;
852
- let data;
853
- try {
854
- data = await this.op(() => this.files.read(virtual));
855
- }
856
- catch (err) {
857
- console.warn(`fuse: holding ${path} before it goes failed: ${String(err)}`);
858
- return row;
859
- }
860
- for (const ctx of lacking) {
861
- ctx.data = data;
862
- delete ctx.chunked;
863
- }
864
- return row;
865
- }
866
- /**
867
- * Wait for a flush or truncation of the handle's file still landing, into
868
- * the queue a rename moved the handle to. Mirrors Python's `_settled`.
869
- */
870
- async settled(ctx) {
871
- let key = null;
872
- while (key !== ctx.key) {
873
- key = ctx.key;
874
- await this.pending.get(key);
875
- }
876
- }
877
- /**
878
- * Land a handle's buffered writes and let it go. The handle goes even
879
- * when the landing fails, as close(2) releases its descriptor: no
880
- * adapter retries a release, so a kept handle would never close. The
881
- * failure still reaches the caller.
882
- */
883
- async release(fd) {
884
- const ctx = this.handles.get(fd);
885
- try {
886
- // The FSKit shim sends RELEASE with no FLUSH before it.
887
- if (ctx !== undefined)
888
- await this.flush(ctx.path, fd);
889
- }
890
- finally {
891
- this.handles.pop(fd);
892
- }
893
- }
894
- async flush(_path, fd) {
895
- const ctx = this.handles.get(fd);
896
- if (ctx !== undefined)
897
- await this.settle(ctx);
898
- }
899
- /**
900
- * Land what every open handle holds, as sync(2) does, for a client whose
901
- * close(2) returns before it releases the handle (sshfs). A landing that
902
- * fails is logged, and its bytes stay on the handle for its own flush to
903
- * retry and report.
904
- */
905
- async sync() {
906
- for (const ctx of [...this.handles.values()]) {
907
- try {
908
- await this.settle(ctx);
909
- }
910
- catch (err) {
911
- console.warn(`fuse: landing ${ctx.path} failed: ${String(err)}`);
912
- }
913
- }
914
- }
915
- }
916
- //# sourceMappingURL=core.js.map