@struktoai/mirage-node 0.0.1 → 0.0.2

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 (407) hide show
  1. package/README.md +63 -129
  2. package/dist/aliyun-TMZRUYCG.js +10 -0
  3. package/dist/backblaze-OHW57DLK.js +10 -0
  4. package/dist/box-UXTCAFOZ.js +8 -0
  5. package/dist/ceph-TNN4I2FT.js +10 -0
  6. package/dist/chunk-2CC5VW7K.js +52 -0
  7. package/dist/chunk-2CC5VW7K.js.map +1 -0
  8. package/dist/chunk-3IJSIVKT.js +57 -0
  9. package/dist/chunk-3IJSIVKT.js.map +1 -0
  10. package/dist/chunk-3T3RMDNX.js +57 -0
  11. package/dist/chunk-3T3RMDNX.js.map +1 -0
  12. package/dist/chunk-54NTYJEO.js +13 -0
  13. package/dist/chunk-54NTYJEO.js.map +1 -0
  14. package/dist/{chunk-DCJQ2PIX.js → chunk-5DLOHQJ2.js} +5 -8
  15. package/dist/chunk-5DLOHQJ2.js.map +1 -0
  16. package/dist/chunk-5HCVKTP3.js +2086 -0
  17. package/dist/chunk-5HCVKTP3.js.map +1 -0
  18. package/dist/{chunk-5E6BULAK.js → chunk-5YOCVEUB.js} +5 -8
  19. package/dist/chunk-5YOCVEUB.js.map +1 -0
  20. package/dist/{chunk-6M2NL363.js → chunk-A4Z6DZ22.js} +6 -8
  21. package/dist/chunk-A4Z6DZ22.js.map +1 -0
  22. package/dist/{chunk-NOZZFJEB.js → chunk-A7X4L4JM.js} +5 -8
  23. package/dist/chunk-A7X4L4JM.js.map +1 -0
  24. package/dist/{chunk-GCB4JUF7.js → chunk-ABTEGAFB.js} +5 -8
  25. package/dist/chunk-ABTEGAFB.js.map +1 -0
  26. package/dist/chunk-AJICZLHT.js +57 -0
  27. package/dist/chunk-AJICZLHT.js.map +1 -0
  28. package/dist/{chunk-H74QYTN7.js → chunk-B2ZOKNN4.js} +14 -3
  29. package/dist/chunk-B2ZOKNN4.js.map +1 -0
  30. package/dist/{chunk-ICSS5ETT.js → chunk-B6SXRCBO.js} +8 -18
  31. package/dist/chunk-B6SXRCBO.js.map +1 -0
  32. package/dist/{chunk-HEQL3LPK.js → chunk-BYTU2YC3.js} +8 -18
  33. package/dist/chunk-BYTU2YC3.js.map +1 -0
  34. package/dist/{chunk-V5OLWE7F.js → chunk-C6NHEDHY.js} +5 -8
  35. package/dist/chunk-C6NHEDHY.js.map +1 -0
  36. package/dist/chunk-C6NHFMIP.js +57 -0
  37. package/dist/chunk-C6NHFMIP.js.map +1 -0
  38. package/dist/chunk-CASCUFK2.js +87 -0
  39. package/dist/chunk-CASCUFK2.js.map +1 -0
  40. package/dist/chunk-DNBAMB5J.js +18 -0
  41. package/dist/chunk-DNBAMB5J.js.map +1 -0
  42. package/dist/chunk-DP2PP5V2.js +26 -0
  43. package/dist/chunk-DP2PP5V2.js.map +1 -0
  44. package/dist/{chunk-OYJXYJTE.js → chunk-DTAY7LPC.js} +303 -866
  45. package/dist/chunk-DTAY7LPC.js.map +1 -0
  46. package/dist/chunk-DYXEITK3.js +52 -0
  47. package/dist/chunk-DYXEITK3.js.map +1 -0
  48. package/dist/chunk-E2ISWXLB.js +7 -0
  49. package/dist/chunk-E2ISWXLB.js.map +1 -0
  50. package/dist/{chunk-XDEEOTVK.js → chunk-E7RW3SBV.js} +5 -8
  51. package/dist/chunk-E7RW3SBV.js.map +1 -0
  52. package/dist/chunk-EGB7V74Z.js +76 -0
  53. package/dist/chunk-EGB7V74Z.js.map +1 -0
  54. package/dist/{chunk-LBBM3LKK.js → chunk-ERELJ7BS.js} +5 -8
  55. package/dist/chunk-ERELJ7BS.js.map +1 -0
  56. package/dist/chunk-FXFDBF3P.js +57 -0
  57. package/dist/chunk-FXFDBF3P.js.map +1 -0
  58. package/dist/chunk-G5BZE7UA.js +50 -0
  59. package/dist/chunk-G5BZE7UA.js.map +1 -0
  60. package/dist/chunk-H3BST2LI.js +26 -0
  61. package/dist/chunk-H3BST2LI.js.map +1 -0
  62. package/dist/chunk-H3I2KZIY.js +25 -0
  63. package/dist/chunk-H3I2KZIY.js.map +1 -0
  64. package/dist/{chunk-UWMOTOXA.js → chunk-HEHERHQ5.js} +8 -15
  65. package/dist/chunk-HEHERHQ5.js.map +1 -0
  66. package/dist/chunk-HQ4KWN76.js +57 -0
  67. package/dist/chunk-HQ4KWN76.js.map +1 -0
  68. package/dist/{chunk-MY3NUJJD.js → chunk-IQVNVTOP.js} +8 -18
  69. package/dist/chunk-IQVNVTOP.js.map +1 -0
  70. package/dist/chunk-JALIYI6M.js +55 -0
  71. package/dist/chunk-JALIYI6M.js.map +1 -0
  72. package/dist/chunk-JZQHKDSY.js +216 -0
  73. package/dist/chunk-JZQHKDSY.js.map +1 -0
  74. package/dist/chunk-JZT4QGIP.js +24 -0
  75. package/dist/chunk-JZT4QGIP.js.map +1 -0
  76. package/dist/chunk-KTNDT45N.js +57 -0
  77. package/dist/chunk-KTNDT45N.js.map +1 -0
  78. package/dist/chunk-L6JPBJAS.js +57 -0
  79. package/dist/chunk-L6JPBJAS.js.map +1 -0
  80. package/dist/{chunk-6VKNSO6U.js → chunk-LAJJPLEV.js} +17 -11
  81. package/dist/chunk-LAJJPLEV.js.map +1 -0
  82. package/dist/chunk-LW25LMIH.js +26 -0
  83. package/dist/chunk-LW25LMIH.js.map +1 -0
  84. package/dist/{chunk-WSDQ2MRG.js → chunk-LYDMMNL2.js} +5 -8
  85. package/dist/chunk-LYDMMNL2.js.map +1 -0
  86. package/dist/{chunk-G7O6DAWU.js → chunk-MHCMHKM6.js} +15 -9
  87. package/dist/chunk-MHCMHKM6.js.map +1 -0
  88. package/dist/chunk-N72CAZEH.js +1990 -0
  89. package/dist/chunk-N72CAZEH.js.map +1 -0
  90. package/dist/{chunk-XQUQSNCA.js → chunk-NHS7WLEQ.js} +4 -5
  91. package/dist/chunk-NHS7WLEQ.js.map +1 -0
  92. package/dist/chunk-NJMGCT63.js +54 -0
  93. package/dist/chunk-NJMGCT63.js.map +1 -0
  94. package/dist/chunk-O7ODGJYL.js +57 -0
  95. package/dist/chunk-O7ODGJYL.js.map +1 -0
  96. package/dist/chunk-OHROA3FQ.js +54 -0
  97. package/dist/chunk-OHROA3FQ.js.map +1 -0
  98. package/dist/chunk-OPYQ5KIO.js +52 -0
  99. package/dist/chunk-OPYQ5KIO.js.map +1 -0
  100. package/dist/chunk-OYV2DN66.js +50 -0
  101. package/dist/chunk-OYV2DN66.js.map +1 -0
  102. package/dist/chunk-OZAEWZZ3.js +31 -0
  103. package/dist/chunk-OZAEWZZ3.js.map +1 -0
  104. package/dist/chunk-PBBG7VFT.js +1896 -0
  105. package/dist/chunk-PBBG7VFT.js.map +1 -0
  106. package/dist/{chunk-HXWGG4K7.js → chunk-PJBQKMCD.js} +10 -20
  107. package/dist/chunk-PJBQKMCD.js.map +1 -0
  108. package/dist/chunk-Q2IAILVC.js +26 -0
  109. package/dist/chunk-Q2IAILVC.js.map +1 -0
  110. package/dist/chunk-Q6CDMOM6.js +57 -0
  111. package/dist/chunk-Q6CDMOM6.js.map +1 -0
  112. package/dist/{chunk-ALAMUIGJ.js → chunk-QGRDPSAH.js} +17 -12
  113. package/dist/chunk-QGRDPSAH.js.map +1 -0
  114. package/dist/{chunk-7QXJ4KWQ.js → chunk-RLGWMJD3.js} +63 -9
  115. package/dist/chunk-RLGWMJD3.js.map +1 -0
  116. package/dist/chunk-RO5IQEDQ.js +30 -0
  117. package/dist/chunk-RO5IQEDQ.js.map +1 -0
  118. package/dist/{chunk-ZC4KNEOQ.js → chunk-RQK5UPMP.js} +16 -11
  119. package/dist/chunk-RQK5UPMP.js.map +1 -0
  120. package/dist/chunk-RQYEEA2O.js +50 -0
  121. package/dist/chunk-RQYEEA2O.js.map +1 -0
  122. package/dist/chunk-SFUCUARB.js +21 -0
  123. package/dist/chunk-SFUCUARB.js.map +1 -0
  124. package/dist/{chunk-MVE5VVMQ.js → chunk-TRTUHCS4.js} +5 -8
  125. package/dist/chunk-TRTUHCS4.js.map +1 -0
  126. package/dist/chunk-TWGVQLG2.js +24 -0
  127. package/dist/chunk-TWGVQLG2.js.map +1 -0
  128. package/dist/chunk-UGK4TAVK.js +32 -0
  129. package/dist/chunk-UGK4TAVK.js.map +1 -0
  130. package/dist/{chunk-LPMPTQYP.js → chunk-UT2OPSN4.js} +12 -10
  131. package/dist/chunk-UT2OPSN4.js.map +1 -0
  132. package/dist/chunk-VGLHY6BK.js +31 -0
  133. package/dist/chunk-VGLHY6BK.js.map +1 -0
  134. package/dist/chunk-W7FLHT65.js +26 -0
  135. package/dist/chunk-W7FLHT65.js.map +1 -0
  136. package/dist/chunk-WL7HS7EM.js +50 -0
  137. package/dist/chunk-WL7HS7EM.js.map +1 -0
  138. package/dist/chunk-WSGEIVY3.js +1766 -0
  139. package/dist/chunk-WSGEIVY3.js.map +1 -0
  140. package/dist/{chunk-H3JR7MN3.js → chunk-XGJ2QERC.js} +17 -10
  141. package/dist/chunk-XGJ2QERC.js.map +1 -0
  142. package/dist/chunk-XHCBHYN4.js +54 -0
  143. package/dist/chunk-XHCBHYN4.js.map +1 -0
  144. package/dist/chunk-XLQI4IT2.js +54 -0
  145. package/dist/chunk-XLQI4IT2.js.map +1 -0
  146. package/dist/{chunk-3PBSL7BS.js → chunk-XRU5WXZX.js} +5 -8
  147. package/dist/chunk-XRU5WXZX.js.map +1 -0
  148. package/dist/{chunk-UZZD4MRJ.js → chunk-YAVGCQUP.js} +5 -8
  149. package/dist/chunk-YAVGCQUP.js.map +1 -0
  150. package/dist/chunk-YGZMVNN5.js +54 -0
  151. package/dist/chunk-YGZMVNN5.js.map +1 -0
  152. package/dist/{chunk-PEZYBKZH.js → chunk-YPT4JBUY.js} +10 -24
  153. package/dist/chunk-YPT4JBUY.js.map +1 -0
  154. package/dist/chunk-YUK3X3B4.js +27 -0
  155. package/dist/chunk-YUK3X3B4.js.map +1 -0
  156. package/dist/chunk-ZNWVJ6UW.js +54 -0
  157. package/dist/chunk-ZNWVJ6UW.js.map +1 -0
  158. package/dist/config-34LHOGLM.js +13 -0
  159. package/dist/config-3BBWD5AB.js +11 -0
  160. package/dist/{config-FNR6LJ5H.js → config-3IVQJBNW.js} +4 -2
  161. package/dist/config-4UDVSUQJ.js +11 -0
  162. package/dist/config-CMDBAPDH.js +11 -0
  163. package/dist/config-CVZ2AGCO.js +21 -0
  164. package/dist/config-D3RLSPNF.js +11 -0
  165. package/dist/config-DG65OEG3.js +11 -0
  166. package/dist/{config-HNSDNQZH.js → config-EIHSP5DZ.js} +4 -2
  167. package/dist/config-EO23EY62.js +15 -0
  168. package/dist/config-GCQK6NJY.js +11 -0
  169. package/dist/{config-5ZPGISS6.js → config-GE4W4ZJC.js} +4 -2
  170. package/dist/config-GHRUKEQ6.js +13 -0
  171. package/dist/config-GVH27UPE.js +11 -0
  172. package/dist/config-HKRMKD76.js +15 -0
  173. package/dist/config-HXVYIXP5.js +11 -0
  174. package/dist/config-IDZMEW73.js +11 -0
  175. package/dist/config-IJJXGLBQ.js +11 -0
  176. package/dist/config-IVY5EQQ2.js +15 -0
  177. package/dist/config-KJOLGVB2.js +11 -0
  178. package/dist/{config-S47UDVRZ.js → config-KMVCVBYN.js} +4 -2
  179. package/dist/{config-UKZ72IDO.js → config-KYTRXAB2.js} +4 -2
  180. package/dist/{config-MOLWOSRG.js → config-LHFFXVYI.js} +4 -2
  181. package/dist/config-NV5WXP64.js +11 -0
  182. package/dist/config-OT2TQQCN.js +11 -0
  183. package/dist/config-Q45Y46YT.js +15 -0
  184. package/dist/config-QAA646XB.js +15 -0
  185. package/dist/config-QNMKWJ4M.js +15 -0
  186. package/dist/config-QWCY3LBQ.js +11 -0
  187. package/dist/{config-HIZHA5VD.js → config-VM526IKB.js} +4 -2
  188. package/dist/config-WDAZFXYD.js +15 -0
  189. package/dist/config-ZFJYQZCH.js +13 -0
  190. package/dist/config-ZV6G2ZEC.js +11 -0
  191. package/dist/databricks_volume-HNQ4DJVJ.js +7 -0
  192. package/dist/digitalocean-6SPR4S7V.js +10 -0
  193. package/dist/discord-SAV2RBJV.js +8 -0
  194. package/dist/{disk-C7TJNU2B.js → disk-POACMF4G.js} +2 -2
  195. package/dist/dropbox-CQ7MTYX2.js +8 -0
  196. package/dist/email-KBQ7CXS7.js +8 -0
  197. package/dist/gcs-SMIE4VMT.js +10 -0
  198. package/dist/gdocs-X5Y2SIQX.js +8 -0
  199. package/dist/gdrive-SIQPRIGI.js +8 -0
  200. package/dist/github-KBHWANKQ.js +8 -0
  201. package/dist/github-KBHWANKQ.js.map +1 -0
  202. package/dist/github_ci-HPITNK37.js +8 -0
  203. package/dist/github_ci-HPITNK37.js.map +1 -0
  204. package/dist/gmail-DKHAGJNX.js +8 -0
  205. package/dist/gmail-DKHAGJNX.js.map +1 -0
  206. package/dist/gsheets-ZSUDIWGK.js +8 -0
  207. package/dist/gsheets-ZSUDIWGK.js.map +1 -0
  208. package/dist/gslides-GYXM7IMJ.js +8 -0
  209. package/dist/gslides-GYXM7IMJ.js.map +1 -0
  210. package/dist/hf_buckets-RIOMV7WG.js +10 -0
  211. package/dist/hf_buckets-RIOMV7WG.js.map +1 -0
  212. package/dist/hf_datasets-QF4BQ3OK.js +10 -0
  213. package/dist/hf_datasets-QF4BQ3OK.js.map +1 -0
  214. package/dist/hf_models-62GC2HPZ.js +10 -0
  215. package/dist/hf_models-62GC2HPZ.js.map +1 -0
  216. package/dist/hf_spaces-NVSMUNRM.js +10 -0
  217. package/dist/hf_spaces-NVSMUNRM.js.map +1 -0
  218. package/dist/index.d.ts +722 -277
  219. package/dist/index.js +646 -2268
  220. package/dist/index.js.map +1 -1
  221. package/dist/langfuse-HUAYVPHF.js +8 -0
  222. package/dist/langfuse-HUAYVPHF.js.map +1 -0
  223. package/dist/linear-2MM55KBC.js +8 -0
  224. package/dist/linear-2MM55KBC.js.map +1 -0
  225. package/dist/minio-L3XE6PQS.js +10 -0
  226. package/dist/minio-L3XE6PQS.js.map +1 -0
  227. package/dist/mongodb-ZOX4FRHJ.js +7 -0
  228. package/dist/mongodb-ZOX4FRHJ.js.map +1 -0
  229. package/dist/notion-UK4GTMT4.js +8 -0
  230. package/dist/notion-UK4GTMT4.js.map +1 -0
  231. package/dist/oci-NURLWPL2.js +10 -0
  232. package/dist/oci-NURLWPL2.js.map +1 -0
  233. package/dist/postgres-JNFMPAO2.js +7 -0
  234. package/dist/postgres-JNFMPAO2.js.map +1 -0
  235. package/dist/qingstor-W55D5YFO.js +10 -0
  236. package/dist/qingstor-W55D5YFO.js.map +1 -0
  237. package/dist/r2-FSZK7IFI.js +10 -0
  238. package/dist/r2-FSZK7IFI.js.map +1 -0
  239. package/dist/redis-S6GIPA4Z.js +8 -0
  240. package/dist/redis-S6GIPA4Z.js.map +1 -0
  241. package/dist/s3-GMPUJ65D.js +8 -0
  242. package/dist/s3-GMPUJ65D.js.map +1 -0
  243. package/dist/scaleway-5VM55Y6D.js +10 -0
  244. package/dist/scaleway-5VM55Y6D.js.map +1 -0
  245. package/dist/seaweedfs-J3EPUEPE.js +10 -0
  246. package/dist/seaweedfs-J3EPUEPE.js.map +1 -0
  247. package/dist/slack-FVBXY7KD.js +8 -0
  248. package/dist/slack-FVBXY7KD.js.map +1 -0
  249. package/dist/ssh-GCXETJ3Z.js +9 -0
  250. package/dist/ssh-GCXETJ3Z.js.map +1 -0
  251. package/dist/supabase-HLWNHBBE.js +10 -0
  252. package/dist/supabase-HLWNHBBE.js.map +1 -0
  253. package/dist/tencent-YDO73XBD.js +10 -0
  254. package/dist/tencent-YDO73XBD.js.map +1 -0
  255. package/dist/trello-CQ53BQUL.js +8 -0
  256. package/dist/trello-CQ53BQUL.js.map +1 -0
  257. package/dist/wasabi-SOZKPMRQ.js +10 -0
  258. package/dist/wasabi-SOZKPMRQ.js.map +1 -0
  259. package/package.json +39 -13
  260. package/dist/box-4P7DCJH7.js +0 -8
  261. package/dist/chunk-35PVZRWU.js +0 -24
  262. package/dist/chunk-35PVZRWU.js.map +0 -1
  263. package/dist/chunk-3PBSL7BS.js.map +0 -1
  264. package/dist/chunk-3Y625AUP.js +0 -24
  265. package/dist/chunk-3Y625AUP.js.map +0 -1
  266. package/dist/chunk-5E6BULAK.js.map +0 -1
  267. package/dist/chunk-5ITBZN55.js +0 -24
  268. package/dist/chunk-5ITBZN55.js.map +0 -1
  269. package/dist/chunk-6M2NL363.js.map +0 -1
  270. package/dist/chunk-6M3QVVOH.js +0 -32
  271. package/dist/chunk-6M3QVVOH.js.map +0 -1
  272. package/dist/chunk-6VKNSO6U.js.map +0 -1
  273. package/dist/chunk-6Y6GWMFF.js +0 -24
  274. package/dist/chunk-6Y6GWMFF.js.map +0 -1
  275. package/dist/chunk-7QXJ4KWQ.js.map +0 -1
  276. package/dist/chunk-ALAMUIGJ.js.map +0 -1
  277. package/dist/chunk-DCJQ2PIX.js.map +0 -1
  278. package/dist/chunk-EKPH4MMD.js +0 -27
  279. package/dist/chunk-EKPH4MMD.js.map +0 -1
  280. package/dist/chunk-FZ2GJ4BJ.js +0 -29
  281. package/dist/chunk-FZ2GJ4BJ.js.map +0 -1
  282. package/dist/chunk-G7O6DAWU.js.map +0 -1
  283. package/dist/chunk-GCB4JUF7.js.map +0 -1
  284. package/dist/chunk-GKQNMLQU.js +0 -7757
  285. package/dist/chunk-GKQNMLQU.js.map +0 -1
  286. package/dist/chunk-GO67AOYK.js +0 -24
  287. package/dist/chunk-GO67AOYK.js.map +0 -1
  288. package/dist/chunk-GPF66TH2.js +0 -24
  289. package/dist/chunk-GPF66TH2.js.map +0 -1
  290. package/dist/chunk-H3JR7MN3.js.map +0 -1
  291. package/dist/chunk-H74QYTN7.js.map +0 -1
  292. package/dist/chunk-HEQL3LPK.js.map +0 -1
  293. package/dist/chunk-HXWGG4K7.js.map +0 -1
  294. package/dist/chunk-I4RRGZGB.js +0 -24
  295. package/dist/chunk-I4RRGZGB.js.map +0 -1
  296. package/dist/chunk-ICSS5ETT.js.map +0 -1
  297. package/dist/chunk-KINMBZHC.js +0 -18
  298. package/dist/chunk-KINMBZHC.js.map +0 -1
  299. package/dist/chunk-LBBM3LKK.js.map +0 -1
  300. package/dist/chunk-LPMPTQYP.js.map +0 -1
  301. package/dist/chunk-M42JTWPR.js +0 -2794
  302. package/dist/chunk-M42JTWPR.js.map +0 -1
  303. package/dist/chunk-MVE5VVMQ.js.map +0 -1
  304. package/dist/chunk-MY3NUJJD.js.map +0 -1
  305. package/dist/chunk-NOZZFJEB.js.map +0 -1
  306. package/dist/chunk-OYJXYJTE.js.map +0 -1
  307. package/dist/chunk-PEZYBKZH.js.map +0 -1
  308. package/dist/chunk-QWWOBAYU.js +0 -26
  309. package/dist/chunk-QWWOBAYU.js.map +0 -1
  310. package/dist/chunk-RQYYYBQG.js +0 -24
  311. package/dist/chunk-RQYYYBQG.js.map +0 -1
  312. package/dist/chunk-T2WWAEKH.js +0 -7591
  313. package/dist/chunk-T2WWAEKH.js.map +0 -1
  314. package/dist/chunk-UWMOTOXA.js.map +0 -1
  315. package/dist/chunk-UZZD4MRJ.js.map +0 -1
  316. package/dist/chunk-V5OLWE7F.js.map +0 -1
  317. package/dist/chunk-VCLMTMSO.js +0 -23
  318. package/dist/chunk-VCLMTMSO.js.map +0 -1
  319. package/dist/chunk-WSDQ2MRG.js.map +0 -1
  320. package/dist/chunk-XDEEOTVK.js.map +0 -1
  321. package/dist/chunk-XQUQSNCA.js.map +0 -1
  322. package/dist/chunk-XVYZO2FG.js +0 -14
  323. package/dist/chunk-XVYZO2FG.js.map +0 -1
  324. package/dist/chunk-ZC4KNEOQ.js.map +0 -1
  325. package/dist/config-6HWSKHEU.js +0 -9
  326. package/dist/config-6TNFPYZF.js +0 -9
  327. package/dist/config-BHLXQ3OL.js +0 -9
  328. package/dist/config-E7UOEWEP.js +0 -9
  329. package/dist/config-IXLFUSMQ.js +0 -9
  330. package/dist/config-J3TM7NIS.js +0 -9
  331. package/dist/config-JXLZ4XEW.js +0 -9
  332. package/dist/config-KQCEMLNZ.js +0 -9
  333. package/dist/config-R3XJ5OW4.js +0 -9
  334. package/dist/config-V7XI5UTG.js +0 -9
  335. package/dist/config-YLIX3ZBT.js +0 -9
  336. package/dist/config-Z5JGDOKE.js +0 -9
  337. package/dist/config-ZCZZAH5W.js +0 -9
  338. package/dist/config-ZZGIWDUC.js +0 -9
  339. package/dist/discord-2PWP2MGX.js +0 -8
  340. package/dist/dropbox-L5DPYGKR.js +0 -8
  341. package/dist/email-HASRFBKC.js +0 -8
  342. package/dist/gcs-P5QMKTPR.js +0 -10
  343. package/dist/gdocs-IF2I35HZ.js +0 -8
  344. package/dist/gdrive-TAETVCKP.js +0 -8
  345. package/dist/github-5E6GSCNZ.js +0 -8
  346. package/dist/github_ci-2DSZI3Y7.js +0 -8
  347. package/dist/gmail-F5VYGKOT.js +0 -8
  348. package/dist/gsheets-BAO54CQ7.js +0 -8
  349. package/dist/gslides-A62CEEMR.js +0 -8
  350. package/dist/langfuse-YKBYRQLU.js +0 -8
  351. package/dist/linear-WJDQ6JDE.js +0 -8
  352. package/dist/mongodb-MK4DVSIK.js +0 -7
  353. package/dist/oci-KZ7XFZ2X.js +0 -10
  354. package/dist/postgres-M2N2APFZ.js +0 -7
  355. package/dist/r2-X4DDNSAZ.js +0 -10
  356. package/dist/redis-NVCXUUIO.js +0 -7
  357. package/dist/s3-HVAL7ZX3.js +0 -8
  358. package/dist/slack-GUQMDGLP.js +0 -8
  359. package/dist/ssh-LY6WYVVD.js +0 -9
  360. package/dist/supabase-H3ZP4Y3W.js +0 -10
  361. package/dist/trello-WR6TEDYD.js +0 -8
  362. /package/dist/{box-4P7DCJH7.js.map → aliyun-TMZRUYCG.js.map} +0 -0
  363. /package/dist/{config-5ZPGISS6.js.map → backblaze-OHW57DLK.js.map} +0 -0
  364. /package/dist/{config-6HWSKHEU.js.map → box-UXTCAFOZ.js.map} +0 -0
  365. /package/dist/{config-6TNFPYZF.js.map → ceph-TNN4I2FT.js.map} +0 -0
  366. /package/dist/{config-BHLXQ3OL.js.map → config-34LHOGLM.js.map} +0 -0
  367. /package/dist/{config-E7UOEWEP.js.map → config-3BBWD5AB.js.map} +0 -0
  368. /package/dist/{config-FNR6LJ5H.js.map → config-3IVQJBNW.js.map} +0 -0
  369. /package/dist/{config-HIZHA5VD.js.map → config-4UDVSUQJ.js.map} +0 -0
  370. /package/dist/{config-HNSDNQZH.js.map → config-CMDBAPDH.js.map} +0 -0
  371. /package/dist/{config-IXLFUSMQ.js.map → config-CVZ2AGCO.js.map} +0 -0
  372. /package/dist/{config-J3TM7NIS.js.map → config-D3RLSPNF.js.map} +0 -0
  373. /package/dist/{config-JXLZ4XEW.js.map → config-DG65OEG3.js.map} +0 -0
  374. /package/dist/{config-KQCEMLNZ.js.map → config-EIHSP5DZ.js.map} +0 -0
  375. /package/dist/{config-MOLWOSRG.js.map → config-EO23EY62.js.map} +0 -0
  376. /package/dist/{config-R3XJ5OW4.js.map → config-GCQK6NJY.js.map} +0 -0
  377. /package/dist/{config-S47UDVRZ.js.map → config-GE4W4ZJC.js.map} +0 -0
  378. /package/dist/{config-UKZ72IDO.js.map → config-GHRUKEQ6.js.map} +0 -0
  379. /package/dist/{config-V7XI5UTG.js.map → config-GVH27UPE.js.map} +0 -0
  380. /package/dist/{config-YLIX3ZBT.js.map → config-HKRMKD76.js.map} +0 -0
  381. /package/dist/{config-Z5JGDOKE.js.map → config-HXVYIXP5.js.map} +0 -0
  382. /package/dist/{config-ZCZZAH5W.js.map → config-IDZMEW73.js.map} +0 -0
  383. /package/dist/{config-ZZGIWDUC.js.map → config-IJJXGLBQ.js.map} +0 -0
  384. /package/dist/{discord-2PWP2MGX.js.map → config-IVY5EQQ2.js.map} +0 -0
  385. /package/dist/{disk-C7TJNU2B.js.map → config-KJOLGVB2.js.map} +0 -0
  386. /package/dist/{dropbox-L5DPYGKR.js.map → config-KMVCVBYN.js.map} +0 -0
  387. /package/dist/{email-HASRFBKC.js.map → config-KYTRXAB2.js.map} +0 -0
  388. /package/dist/{gcs-P5QMKTPR.js.map → config-LHFFXVYI.js.map} +0 -0
  389. /package/dist/{gdocs-IF2I35HZ.js.map → config-NV5WXP64.js.map} +0 -0
  390. /package/dist/{gdrive-TAETVCKP.js.map → config-OT2TQQCN.js.map} +0 -0
  391. /package/dist/{github-5E6GSCNZ.js.map → config-Q45Y46YT.js.map} +0 -0
  392. /package/dist/{github_ci-2DSZI3Y7.js.map → config-QAA646XB.js.map} +0 -0
  393. /package/dist/{gmail-F5VYGKOT.js.map → config-QNMKWJ4M.js.map} +0 -0
  394. /package/dist/{gsheets-BAO54CQ7.js.map → config-QWCY3LBQ.js.map} +0 -0
  395. /package/dist/{gslides-A62CEEMR.js.map → config-VM526IKB.js.map} +0 -0
  396. /package/dist/{langfuse-YKBYRQLU.js.map → config-WDAZFXYD.js.map} +0 -0
  397. /package/dist/{linear-WJDQ6JDE.js.map → config-ZFJYQZCH.js.map} +0 -0
  398. /package/dist/{mongodb-MK4DVSIK.js.map → config-ZV6G2ZEC.js.map} +0 -0
  399. /package/dist/{oci-KZ7XFZ2X.js.map → databricks_volume-HNQ4DJVJ.js.map} +0 -0
  400. /package/dist/{postgres-M2N2APFZ.js.map → digitalocean-6SPR4S7V.js.map} +0 -0
  401. /package/dist/{r2-X4DDNSAZ.js.map → discord-SAV2RBJV.js.map} +0 -0
  402. /package/dist/{redis-NVCXUUIO.js.map → disk-POACMF4G.js.map} +0 -0
  403. /package/dist/{s3-HVAL7ZX3.js.map → dropbox-CQ7MTYX2.js.map} +0 -0
  404. /package/dist/{slack-GUQMDGLP.js.map → email-KBQ7CXS7.js.map} +0 -0
  405. /package/dist/{ssh-LY6WYVVD.js.map → gcs-SMIE4VMT.js.map} +0 -0
  406. /package/dist/{supabase-H3ZP4Y3W.js.map → gdocs-X5Y2SIQX.js.map} +0 -0
  407. /package/dist/{trello-WR6TEDYD.js.map → gdrive-SIQPRIGI.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/resource/redis/redis.ts","../src/commands/builtin/redis/awk.ts","../src/core/redis/stream.ts","../src/core/redis/utils.ts","../src/commands/builtin/redis/base64_cmd.ts","../src/commands/builtin/redis/basename.ts","../src/commands/builtin/redis/cat/cat.ts","../src/core/redis/stat.ts","../src/commands/builtin/redis/cat/cat_feather.ts","../src/commands/builtin/redis/cat/cat_hdf5.ts","../src/commands/builtin/redis/cat/cat_parquet.ts","../src/commands/builtin/redis/cmp.ts","../src/commands/builtin/redis/column.ts","../src/commands/builtin/redis/comm.ts","../src/commands/builtin/redis/cp.ts","../src/core/redis/write.ts","../src/core/redis/read.ts","../src/commands/builtin/redis/csplit.ts","../src/commands/builtin/redis/cut/cut.ts","../src/commands/builtin/redis/cut/cut_feather.ts","../src/commands/builtin/redis/cut/cut_hdf5.ts","../src/commands/builtin/redis/cut/cut_parquet.ts","../src/commands/builtin/redis/diff.ts","../src/commands/builtin/redis/dirname.ts","../src/commands/builtin/redis/du.ts","../src/core/redis/du.ts","../src/commands/builtin/redis/expand.ts","../src/commands/builtin/redis/file/file.ts","../src/commands/builtin/redis/file/file_feather.ts","../src/commands/builtin/redis/file/file_hdf5.ts","../src/commands/builtin/redis/file/file_parquet.ts","../src/commands/builtin/redis/find.ts","../src/core/redis/find.ts","../src/commands/builtin/redis/fmt.ts","../src/commands/builtin/redis/fold.ts","../src/commands/builtin/redis/grep/grep.ts","../src/commands/builtin/redis/grep/grep_feather.ts","../src/commands/builtin/redis/grep/grep_hdf5.ts","../src/commands/builtin/redis/grep/grep_parquet.ts","../src/commands/builtin/redis/gunzip.ts","../src/core/redis/unlink.ts","../src/commands/builtin/redis/gzip.ts","../src/commands/builtin/redis/head/head.ts","../src/commands/builtin/redis/head/head_feather.ts","../src/commands/builtin/redis/head/head_hdf5.ts","../src/commands/builtin/redis/head/head_parquet.ts","../src/commands/builtin/redis/iconv.ts","../src/commands/builtin/redis/join.ts","../src/commands/builtin/redis/jq.ts","../src/commands/builtin/redis/ln.ts","../src/core/redis/exists.ts","../src/commands/builtin/redis/look.ts","../src/commands/builtin/redis/ls/ls.ts","../src/core/redis/readdir.ts","../src/core/redis/entry.ts","../src/commands/builtin/redis/ls/ls_feather.ts","../src/commands/builtin/redis/ls/ls_hdf5.ts","../src/commands/builtin/redis/ls/ls_parquet.ts","../src/commands/builtin/redis/md5.ts","../src/commands/builtin/redis/mkdir.ts","../src/core/redis/mkdir.ts","../src/commands/builtin/redis/mktemp.ts","../src/commands/builtin/redis/mv.ts","../src/core/redis/rename.ts","../src/commands/builtin/redis/nl.ts","../src/commands/builtin/redis/paste.ts","../src/commands/builtin/redis/patch.ts","../src/commands/builtin/redis/readlink.ts","../src/commands/builtin/redis/realpath.ts","../src/commands/builtin/redis/rev.ts","../src/commands/builtin/redis/rg.ts","../src/commands/builtin/redis/rm.ts","../src/core/redis/rmdir.ts","../src/core/redis/rm.ts","../src/commands/builtin/redis/sed.ts","../src/commands/builtin/redis/sha256sum.ts","../src/commands/builtin/redis/shuf.ts","../src/commands/builtin/redis/sort.ts","../src/commands/builtin/redis/split.ts","../src/commands/builtin/redis/stat/stat.ts","../src/commands/builtin/redis/stat/stat_feather.ts","../src/commands/builtin/redis/stat/stat_hdf5.ts","../src/commands/builtin/redis/stat/stat_parquet.ts","../src/commands/builtin/redis/strings.ts","../src/commands/builtin/redis/tac.ts","../src/commands/builtin/redis/tail/tail.ts","../src/commands/builtin/redis/tail/tail_feather.ts","../src/commands/builtin/redis/tail/tail_hdf5.ts","../src/commands/builtin/redis/tail/tail_parquet.ts","../src/commands/builtin/redis/tar.ts","../src/commands/builtin/redis/tee.ts","../src/commands/builtin/redis/touch.ts","../src/commands/builtin/redis/tr.ts","../src/commands/builtin/redis/tree.ts","../src/commands/builtin/redis/tsort.ts","../src/commands/builtin/redis/unexpand.ts","../src/commands/builtin/redis/uniq.ts","../src/commands/builtin/redis/unzip.ts","../src/commands/builtin/redis/wc/wc.ts","../src/commands/builtin/redis/wc/wc_feather.ts","../src/commands/builtin/redis/wc/wc_hdf5.ts","../src/commands/builtin/redis/wc/wc_parquet.ts","../src/commands/builtin/redis/xxd.ts","../src/commands/builtin/redis/zcat.ts","../src/commands/builtin/redis/zgrep.ts","../src/commands/builtin/redis/zip_cmd.ts","../src/commands/builtin/redis/index.ts","../src/accessor/redis.ts","../src/core/redis/append.ts","../src/core/redis/copy.ts","../src/core/redis/create.ts","../src/core/redis/glob.ts","../src/core/redis/constants.ts","../src/core/redis/truncate.ts","../src/ops/redis/append.ts","../src/ops/redis/create.ts","../src/ops/redis/mkdir.ts","../src/ops/redis/read.ts","../src/ops/redis/read_feather.ts","../src/ops/redis/read_hdf5.ts","../src/ops/redis/read_parquet.ts","../src/ops/redis/readdir.ts","../src/ops/redis/rename.ts","../src/ops/redis/rmdir.ts","../src/ops/redis/stat.ts","../src/ops/redis/truncate.ts","../src/ops/redis/unlink.ts","../src/ops/redis/write.ts","../src/ops/redis/index.ts","../src/resource/redis/prompt.ts","../src/optional_peer.ts","../src/resource/redis/store.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type FileStat,\n type FindOptions,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n} from '@struktoai/mirage-core'\nimport { REDIS_COMMANDS } from '../../commands/builtin/redis/index.ts'\nimport type { RedisClientType } from 'redis'\nimport { RedisAccessor } from '../../accessor/redis.ts'\nimport { appendBytes } from '../../core/redis/append.ts'\nimport { copy as copyCore } from '../../core/redis/copy.ts'\nimport { create as createCore } from '../../core/redis/create.ts'\nimport { du as duCore, duAll as duAllCore } from '../../core/redis/du.ts'\nimport { exists as existsCore } from '../../core/redis/exists.ts'\nimport { find as findCore, type FindOptions as RedisFindOptions } from '../../core/redis/find.ts'\nimport { resolveGlob as globCore } from '../../core/redis/glob.ts'\nimport { mkdir as mkdirCore } from '../../core/redis/mkdir.ts'\nimport { read as readCore } from '../../core/redis/read.ts'\nimport { readdir as readdirCore } from '../../core/redis/readdir.ts'\nimport { rename as renameCore } from '../../core/redis/rename.ts'\nimport { rmR as rmRCore } from '../../core/redis/rm.ts'\nimport { rmdir as rmdirCore } from '../../core/redis/rmdir.ts'\nimport { stat as statCore } from '../../core/redis/stat.ts'\nimport { stream as streamCore } from '../../core/redis/stream.ts'\nimport { truncate as truncateCore } from '../../core/redis/truncate.ts'\nimport { unlink as unlinkCore } from '../../core/redis/unlink.ts'\nimport { writeBytes as writeCore } from '../../core/redis/write.ts'\nimport { REDIS_OPS } from '../../ops/redis/index.ts'\nimport { REDIS_PROMPT } from './prompt.ts'\nimport { RedisStore } from './store.ts'\n\nexport interface RedisResourceOptions {\n url?: string\n keyPrefix?: string\n}\n\nexport interface RedisModule {\n createClient: (options: { url: string }) => RedisClientType\n RESP_TYPES: { readonly BLOB_STRING: number }\n}\n\nexport interface RedisResourceState {\n type: string\n needsOverride: boolean\n redactedFields: string[]\n keyPrefix: string\n files: Record<string, Uint8Array>\n dirs: string[]\n}\n\nexport class RedisResource implements Resource {\n readonly kind: string = ResourceName.REDIS\n readonly isRemote: boolean = false\n readonly indexTtl: number = 0\n readonly prompt: string = REDIS_PROMPT\n readonly url: string\n readonly keyPrefix: string\n readonly store: RedisStore\n readonly accessor: RedisAccessor\n readonly index: IndexCacheStore\n\n readonly opsMap: Record<string, unknown> = {\n read_bytes: readCore,\n write: writeCore,\n readdir: readdirCore,\n stat: statCore,\n unlink: unlinkCore,\n rmdir: rmdirCore,\n copy: copyCore,\n rename: renameCore,\n mkdir: mkdirCore,\n read_stream: streamCore,\n rm_recursive: rmRCore,\n du_total: duCore,\n du_all: duAllCore,\n create: createCore,\n truncate: truncateCore,\n exists: existsCore,\n find_flat: findCore,\n append: appendBytes,\n }\n\n constructor(options: RedisResourceOptions = {}) {\n this.url = options.url ?? 'redis://localhost:6379/0'\n this.keyPrefix = options.keyPrefix ?? 'mirage:fs:'\n this.store = new RedisStore({ url: this.url, keyPrefix: this.keyPrefix })\n this.accessor = new RedisAccessor(this.store)\n this.index = new RAMIndexCacheStore({ ttl: this.indexTtl })\n }\n\n async open(): Promise<void> {\n await this.store.client()\n }\n\n close(): Promise<void> {\n return this.store.close()\n }\n\n client(): Promise<RedisClientType> {\n return this.store.client()\n }\n\n protected module(): Promise<RedisModule> {\n return import('redis') as unknown as Promise<RedisModule>\n }\n\n ops(): readonly RegisteredOp[] {\n return REDIS_OPS\n }\n\n commands(): readonly RegisteredCommand[] {\n return REDIS_COMMANDS\n }\n\n streamPath(p: PathSpec): AsyncIterable<Uint8Array> {\n return streamCore(this.accessor, p)\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return readCore(this.accessor, p)\n }\n\n writeFile(p: PathSpec, data: Uint8Array): Promise<void> {\n return writeCore(this.accessor, p, data)\n }\n\n appendFile(p: PathSpec, data: Uint8Array): Promise<void> {\n return appendBytes(this.accessor, p, data)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return readdirCore(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return statCore(this.accessor, p)\n }\n\n exists(p: PathSpec): Promise<boolean> {\n return existsCore(this.accessor, p)\n }\n\n mkdir(p: PathSpec, options?: { recursive?: boolean }): Promise<void> {\n return mkdirCore(this.accessor, p, options?.recursive === true)\n }\n\n rmdir(p: PathSpec): Promise<void> {\n return rmdirCore(this.accessor, p)\n }\n\n unlink(p: PathSpec): Promise<void> {\n return unlinkCore(this.accessor, p)\n }\n\n rename(src: PathSpec, dst: PathSpec): Promise<void> {\n return renameCore(this.accessor, src, dst)\n }\n\n truncate(p: PathSpec, length: number): Promise<void> {\n return truncateCore(this.accessor, p, length)\n }\n\n copy(src: PathSpec, dst: PathSpec): Promise<void> {\n return copyCore(this.accessor, src, dst)\n }\n\n rmR(p: PathSpec): Promise<void> {\n return rmRCore(this.accessor, p)\n }\n\n du(p: PathSpec): Promise<number> {\n return duCore(this.accessor, p)\n }\n\n find(p: PathSpec, options: FindOptions = {}): Promise<string[]> {\n return findCore(this.accessor, p, options as RedisFindOptions)\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective = prefix\n ? paths.map((p) =>\n p.prefix\n ? p\n : new PathSpec({\n original: p.original,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n prefix,\n }),\n )\n : paths\n return globCore(this.accessor, effective, this.index)\n }\n\n async getState(): Promise<RedisResourceState> {\n const files: Record<string, Uint8Array> = {}\n for (const key of await this.store.listFiles()) {\n const data = await this.store.getFile(key)\n if (data !== null) files[key] = data\n }\n const dirs = [...(await this.store.listDirs())].sort()\n return {\n type: this.kind,\n needsOverride: true,\n redactedFields: ['url'],\n keyPrefix: this.keyPrefix,\n files,\n dirs,\n }\n }\n\n async loadState(state: RedisResourceState): Promise<void> {\n const c = await this.store.client()\n const pipe = c.multi()\n const dirKey = `${this.keyPrefix}dir`\n for (const [path, data] of Object.entries(state.files)) {\n pipe.set(\n `${this.keyPrefix}file:${path}`,\n Buffer.from(data.buffer, data.byteOffset, data.byteLength),\n )\n }\n for (const dir of state.dirs) {\n pipe.sAdd(dirKey, dir)\n }\n await pipe.exec()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n materialize,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction escapeRegex(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\nfunction splitFields(line: string, fs: string): string[] {\n if (fs === '') return line.split(/\\s+/).filter((s) => s !== '')\n const re = fs.length === 1 ? new RegExp(escapeRegex(fs)) : new RegExp(fs)\n return line.split(re)\n}\n\nfunction parseProgram(program: string): [string, string] {\n const trimmed = program.trim()\n if (trimmed.startsWith('{')) return ['', trimmed.slice(1).replace(/\\}$/, '')]\n if (trimmed.includes('{')) {\n const idx = trimmed.indexOf('{')\n const condition = trimmed.slice(0, idx).trim()\n const action = trimmed\n .slice(idx + 1)\n .replace(/\\}$/, '')\n .trim()\n return [condition, action]\n }\n return ['', trimmed]\n}\n\nfunction evalCondition(condition: string, fieldMap: Record<string, string>): boolean {\n const cond = condition.trim()\n if (cond === 'BEGIN' || cond === 'END') return false\n const patterns = [\n /(\\$\\d+|NR|NF)\\s*==\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*!=\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*>\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*<\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*>=\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*<=\\s*(.+)/,\n ]\n for (const pat of patterns) {\n const m = pat.exec(cond)\n if (m !== null) {\n const lhsKey = m[1] ?? ''\n const rhsRaw = (m[2] ?? '').trim().replace(/^\"|\"$/g, '')\n const lhs = fieldMap[lhsKey] ?? ''\n const opMatch = /(==|!=|>=|<=|>|<)/.exec(cond)\n const op = opMatch !== null ? opMatch[1] : ''\n const lhsNum = Number.parseFloat(lhs)\n const rhsNum = Number.parseFloat(rhsRaw)\n if (!Number.isNaN(lhsNum) && !Number.isNaN(rhsNum)) {\n if (op === '==') return lhsNum === rhsNum\n if (op === '!=') return lhsNum !== rhsNum\n if (op === '>') return lhsNum > rhsNum\n if (op === '<') return lhsNum < rhsNum\n if (op === '>=') return lhsNum >= rhsNum\n if (op === '<=') return lhsNum <= rhsNum\n }\n if (op === '==') return lhs === rhsRaw\n if (op === '!=') return lhs !== rhsRaw\n return false\n }\n }\n if (cond.startsWith('/') && cond.endsWith('/')) {\n return new RegExp(cond.slice(1, -1)).test(fieldMap.$0 ?? '')\n }\n return true\n}\n\nfunction evalAction(action: string, fieldMap: Record<string, string>): string {\n const parts: string[] = []\n for (const rawStmt of action.split(';')) {\n const stmt = rawStmt.trim()\n if (stmt === '') continue\n if (stmt.startsWith('print')) {\n const args = stmt.slice(5).trim()\n if (args === '') {\n parts.push(fieldMap.$0 ?? '')\n } else {\n const tokens = args.split(/,\\s*/)\n const vals: string[] = []\n for (const raw of tokens) {\n const tok = raw.trim().replace(/^\"|\"$/g, '')\n vals.push(fieldMap[tok] ?? tok)\n }\n parts.push(vals.join(' '))\n }\n }\n }\n return parts.join('\\n')\n}\n\nfunction awkEvalLine(\n line: string,\n program: string,\n fs: string,\n variables: Record<string, string>,\n nr: number,\n): string | null {\n const fields = splitFields(line, fs)\n const fieldMap: Record<string, string> = {\n $0: line,\n NR: String(nr),\n NF: String(fields.length),\n }\n for (let i = 0; i < fields.length; i++) fieldMap[`$${String(i + 1)}`] = fields[i] ?? ''\n for (const [k, v] of Object.entries(variables)) fieldMap[k] = v\n const [condition, action] = parseProgram(program)\n if (condition !== '' && !evalCondition(condition, fieldMap)) return null\n if (action === '') return line\n return evalAction(action, fieldMap)\n}\n\nfunction parseBlocks(program: string): [string, string, string] {\n let begin = ''\n let end = ''\n let main = program\n const beginMatch = /^BEGIN\\s*\\{([^}]*)\\}\\s*([\\s\\S]*)/.exec(program)\n if (beginMatch !== null) {\n begin = (beginMatch[1] ?? '').trim()\n main = (beginMatch[2] ?? '').trim()\n }\n const endMatch = /END\\s*\\{([^}]*)\\}\\s*$/.exec(main)\n if (endMatch !== null) {\n end = (endMatch[1] ?? '').trim()\n main = main.slice(0, endMatch.index).trim()\n }\n return [begin, main, end]\n}\n\nfunction evalAccumulator(\n action: string,\n fieldMap: Record<string, string>,\n accum: Record<string, number>,\n): void {\n for (const rawStmt of action.split(';')) {\n const stmt = rawStmt.trim()\n const m = /(\\w+)\\s*\\+=\\s*(.+)/.exec(stmt)\n if (m !== null) {\n const variable = m[1] ?? ''\n const expr = (m[2] ?? '').trim()\n const val = fieldMap[expr] ?? expr\n const n = Number.parseFloat(val)\n if (!Number.isNaN(n)) accum[variable] = (accum[variable] ?? 0) + n\n }\n }\n}\n\nfunction evalEndAction(action: string, accum: Record<string, number>): string {\n const parts: string[] = []\n for (const rawStmt of action.split(';')) {\n const stmt = rawStmt.trim()\n if (!stmt.startsWith('print')) continue\n const args = stmt.slice(5).trim()\n if (args === '') continue\n const tokens = args.split(/,\\s*/)\n const vals: string[] = []\n for (const raw of tokens) {\n const tok = raw.trim().replace(/^\"|\"$/g, '')\n if (tok in accum) {\n const v = accum[tok] ?? 0\n vals.push(Number.isInteger(v) ? String(v) : String(v))\n } else {\n vals.push(tok)\n }\n }\n parts.push(vals.join(' '))\n }\n return parts.join('\\n')\n}\n\nasync function* awkStream(\n source: AsyncIterable<Uint8Array>,\n program: string,\n fs: string,\n variables: Record<string, string>,\n): AsyncIterable<Uint8Array> {\n const [, main, end] = parseBlocks(program)\n const accum: Record<string, number> = {}\n let nr = 0\n const iter = new AsyncLineIterator(source)\n for await (const lineBytes of iter) {\n nr += 1\n const line = DEC.decode(lineBytes)\n if (main !== '') {\n const fields = splitFields(line, fs)\n const fieldMap: Record<string, string> = {\n $0: line,\n NR: String(nr),\n NF: String(fields.length),\n }\n for (let i = 0; i < fields.length; i++) fieldMap[`$${String(i + 1)}`] = fields[i] ?? ''\n const [condition, action] = parseProgram(main)\n if (condition !== '' && !evalCondition(condition, fieldMap)) continue\n evalAccumulator(action, fieldMap, accum)\n const result = awkEvalLine(line, main, fs, variables, nr)\n if (result !== null && result !== '') yield ENC.encode(result + '\\n')\n }\n }\n if (end !== '') {\n const result = evalEndAction(end, accum)\n if (result !== '') yield ENC.encode(result + '\\n')\n }\n}\n\nfunction stripMount(virtualPath: string, prefix: string): string {\n if (prefix !== '' && virtualPath.startsWith(prefix + '/')) {\n return '/' + virtualPath.slice(prefix.length).replace(/^\\/+/, '')\n }\n return virtualPath\n}\n\nasync function readFile(accessor: RedisAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(redisStream(accessor, p))\n}\n\nasync function awkCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const fFlag = typeof opts.flags.f === 'string' ? opts.flags.f : null\n let program: string\n let dataPaths: string[]\n if (fFlag !== null) {\n const programPath = fFlag\n const programSpec: PathSpec = { original: programPath, stripPrefix: programPath } as PathSpec\n try {\n program = DEC.decode(await readFile(accessor, programSpec)).trim()\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const mountPrefix = paths[0]?.prefix ?? ''\n dataPaths = [\n ...texts.map((t) => stripMount(t, mountPrefix)),\n ...paths.map((p) => p.stripPrefix),\n ]\n } else if (texts.length > 0 && texts[0] !== undefined) {\n program = texts[0]\n dataPaths = paths.map((p) => p.stripPrefix)\n } else {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`awk: usage: awk [-F fs] [-v var=val] 'program' [file ...]\\n`),\n }),\n ]\n }\n const fs = typeof opts.flags.F === 'string' ? opts.flags.F : ' '\n const variables: Record<string, string> = {}\n if (typeof opts.flags.v === 'string' && opts.flags.v.includes('=')) {\n const [key, val] = opts.flags.v.split('=', 2)\n if (key !== undefined && val !== undefined) variables[key] = val\n }\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (dataPaths.length > 0) {\n const firstPath = dataPaths[0]\n if (firstPath === undefined) return [null, new IOResult()]\n const spec: PathSpec = { original: firstPath, stripPrefix: firstPath } as PathSpec\n source = redisStream(accessor, spec)\n cache.push(firstPath)\n } else {\n try {\n source = resolveSource(opts.stdin, 'awk: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n return [awkStream(source, program, fs, variables), new IOResult({ cache })]\n}\n\nexport const REDIS_AWK = command({\n name: 'awk',\n resource: ResourceName.REDIS,\n spec: specOf('awk'),\n fn: awkCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type IndexCacheStore,\n recordStream,\n ResourceName,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm } from './utils.ts'\n\nexport async function* stream(\n accessor: RedisAccessor,\n path: PathSpec,\n _index?: IndexCacheStore,\n): AsyncIterable<Uint8Array> {\n const p = norm(path.stripPrefix)\n const data = await accessor.store.getFile(p)\n if (data === null) throw new Error(`file not found: ${p}`)\n const rec = recordStream('read', p, ResourceName.REDIS)\n if (rec !== null) rec.bytes = data.byteLength\n yield data\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport function norm(path: string): string {\n return `/${path.replace(/^\\/+|\\/+$/g, '')}`\n}\n\nexport function parent(path: string): string {\n const i = path.lastIndexOf('/')\n if (i <= 0) return '/'\n return path.slice(0, i)\n}\n\nexport function basename(path: string): string {\n const tail = path.split('/').pop()\n return tail !== undefined && tail.length > 0 ? tail : '/'\n}\n\nexport function nowIso(): string {\n return new Date().toISOString()\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n decodeBase64,\n encodeBase64,\n materialize,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nasync function* base64EncodeStream(\n source: AsyncIterable<Uint8Array>,\n wrap: number | null,\n): AsyncIterable<Uint8Array> {\n const buf = await materialize(source)\n const encoded = encodeBase64(buf)\n if (wrap !== null && wrap === 0) {\n yield ENC.encode(encoded + '\\n')\n return\n }\n const lineLen = wrap ?? 76\n const lines: string[] = []\n for (let i = 0; i < encoded.length; i += lineLen) {\n lines.push(encoded.slice(i, i + lineLen))\n }\n yield ENC.encode(lines.join('\\n') + '\\n')\n}\n\nasync function* base64DecodeStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n const buf = await materialize(source)\n const text = DEC.decode(buf).replace(/[\\r\\n ]/g, '')\n yield decodeBase64(text)\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function base64Command(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const decode = opts.flags.d === true || opts.flags.D === true\n const wrap = typeof opts.flags.w === 'string' ? Number.parseInt(opts.flags.w, 10) : null\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = redisStream(accessor, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'base64: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n const out = decode ? base64DecodeStream(source) : base64EncodeStream(source, wrap)\n return [out, new IOResult({ cache })]\n}\n\nexport const RAM_BASE64 = command({\n name: 'base64',\n resource: ResourceName.REDIS,\n spec: specOf('base64'),\n fn: base64Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type Accessor,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\n\nfunction basenameCommand(\n _accessor: Accessor,\n paths: PathSpec[],\n texts: string[],\n _opts: CommandOpts,\n): CommandFnResult {\n const arg = texts[0] ?? paths[0]?.original ?? ''\n const stripped = arg.replace(/\\/+$/, '')\n const idx = stripped.lastIndexOf('/')\n const base = idx >= 0 ? stripped.slice(idx + 1) : stripped\n const out: ByteSource = new TextEncoder().encode(`${base}\\n`)\n return [out, new IOResult()]\n}\n\nexport const REDIS_BASENAME = command({\n name: 'basename',\n resource: ResourceName.REDIS,\n spec: specOf('basename'),\n fn: basenameCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n CachableAsyncIterator,\n IOResult,\n ProvisionResult,\n ResourceName,\n command,\n concatAggregate,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport { stat as redisStat } from '../../../../core/redis/stat.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function* numberLinesStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n let num = 1\n const lineIter = new AsyncLineIterator(source)\n for await (const line of lineIter) {\n yield ENC.encode(` ${String(num)}\\t`)\n yield line\n yield ENC.encode('\\n')\n num += 1\n }\n}\n\nexport async function catProvision(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<ProvisionResult> {\n const [first] = paths\n if (first === undefined) return new ProvisionResult({ command: 'cat' })\n try {\n const s = await redisStat(accessor, first)\n return new ProvisionResult({\n command: `cat ${first.original}`,\n networkReadLow: s.size ?? 0,\n networkReadHigh: s.size ?? 0,\n readOps: 1,\n })\n } catch {\n return new ProvisionResult({ command: 'cat' })\n }\n}\n\nasync function* chainStreams(\n streams: readonly AsyncIterable<Uint8Array>[],\n): AsyncIterable<Uint8Array> {\n for (const s of streams) {\n for await (const chunk of s) yield chunk\n }\n}\n\nasync function catCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nFlag = opts.flags.n === true\n if (paths.length > 0) {\n for (const p of paths) await redisStat(accessor, p)\n const reads: Record<string, ByteSource> = {}\n const cacheKeys: string[] = []\n const outputs: AsyncIterable<Uint8Array>[] = []\n for (const p of paths) {\n const cachable = new CachableAsyncIterator(redisStream(accessor, p))\n reads[p.stripPrefix] = cachable\n cacheKeys.push(p.stripPrefix)\n outputs.push(cachable)\n }\n const merged = chainStreams(outputs)\n const out: ByteSource = nFlag ? numberLinesStream(merged) : merged\n return [out, new IOResult({ reads, cache: cacheKeys })]\n }\n try {\n const source = resolveSource(opts.stdin, 'cat: missing operand')\n const out: ByteSource = nFlag ? numberLinesStream(source) : source\n return [out, new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const REDIS_CAT = command({\n name: 'cat',\n resource: ResourceName.REDIS,\n spec: specOf('cat'),\n fn: catCommand,\n provision: catProvision,\n aggregate: concatAggregate,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileStat,\n FileType,\n guessType,\n type IndexCacheStore,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { basename, norm } from './utils.ts'\n\nexport async function stat(\n accessor: RedisAccessor,\n path: PathSpec,\n _index?: IndexCacheStore,\n): Promise<FileStat> {\n const p = norm(path.stripPrefix)\n const store = accessor.store\n if (await store.hasDir(p)) {\n return new FileStat({\n name: basename(p),\n modified: await store.getModified(p),\n type: FileType.DIRECTORY,\n })\n }\n if (await store.hasFile(p)) {\n const size = await store.fileLen(p)\n return new FileStat({\n name: basename(p),\n size,\n modified: await store.getModified(p),\n type: guessType(p),\n })\n }\n throw new Error(`file not found: ${p}`)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n featherCat,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function catFeatherCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = featherCat(raw)\n const out: ByteSource = result\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_CAT_FEATHER = command({\n name: 'cat',\n resource: ResourceName.REDIS,\n spec: specOf('cat'),\n filetype: '.feather',\n fn: catFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n hdf5Cat,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function catHdf5Command(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = await hdf5Cat(raw)\n const out: ByteSource = result\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_CAT_HDF5 = command({\n name: 'cat',\n resource: ResourceName.REDIS,\n spec: specOf('cat'),\n filetype: '.h5',\n fn: catHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n parquetCat,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function catParquetCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = await parquetCat(raw)\n const out: ByteSource = result\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_CAT_PARQUET = command({\n name: 'cat',\n resource: ResourceName.REDIS,\n spec: specOf('cat'),\n filetype: '.parquet',\n fn: catParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nfunction octal(n: number): string {\n return '0o' + n.toString(8)\n}\n\nfunction arraysEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.byteLength !== b.byteLength) return false\n for (let i = 0; i < a.byteLength; i++) if (a[i] !== b[i]) return false\n return true\n}\n\nasync function cmpCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [null, new IOResult({ exitCode: 2, stderr: ENC.encode('cmp: requires two paths\\n') })]\n }\n const p0 = paths[0]\n const p1 = paths[1]\n if (p0 === undefined || p1 === undefined) return [null, new IOResult()]\n let data1 = await materialize(redisStream(accessor, p0))\n let data2 = await materialize(redisStream(accessor, p1))\n if (typeof opts.flags.i === 'string') {\n const skip = Number.parseInt(opts.flags.i, 10)\n data1 = data1.slice(skip)\n data2 = data2.slice(skip)\n }\n if (typeof opts.flags.n === 'string') {\n const limit = Number.parseInt(opts.flags.n, 10)\n data1 = data1.slice(0, limit)\n data2 = data2.slice(0, limit)\n }\n if (arraysEqual(data1, data2)) return [null, new IOResult()]\n if (opts.flags.s === true) return [null, new IOResult({ exitCode: 1 })]\n if (opts.flags.args_l === true) {\n const outLines: string[] = []\n const limit = Math.min(data1.byteLength, data2.byteLength)\n for (let idx = 0; idx < limit; idx++) {\n if (data1[idx] !== data2[idx]) {\n outLines.push(`${String(idx + 1)} ${octal(data1[idx] ?? 0)} ${octal(data2[idx] ?? 0)}`)\n }\n }\n const out: ByteSource = ENC.encode(outLines.join('\\n'))\n return [out, new IOResult({ exitCode: 1 })]\n }\n const limit = Math.min(data1.byteLength, data2.byteLength)\n for (let idx = 0; idx < limit; idx++) {\n if (data1[idx] !== data2[idx]) {\n let line = 1\n for (let k = 0; k < idx; k++) if (data1[k] === 0x0a) line += 1\n let msg = `${p0.original} ${p1.original} differ: byte ${String(idx + 1)}, line ${String(line)}`\n if (opts.flags.b === true) {\n msg += ` is ${octal(data1[idx] ?? 0)} ${String.fromCharCode(data1[idx] ?? 0)} ${octal(data2[idx] ?? 0)} ${String.fromCharCode(data2[idx] ?? 0)}`\n }\n return [ENC.encode(msg), new IOResult({ exitCode: 1 })]\n }\n }\n const shorter = data1.byteLength < data2.byteLength ? p0 : p1\n return [ENC.encode(`cmp: EOF on ${shorter.original}`), new IOResult({ exitCode: 1 })]\n}\n\nexport const REDIS_CMP = command({\n name: 'cmp',\n resource: ResourceName.REDIS,\n spec: specOf('cmp'),\n fn: cmpCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction padRight(s: string, width: number): string {\n if (s.length >= width) return s\n return s + ' '.repeat(width - s.length)\n}\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction tableFormat(text: string, separator: string | null, outputSep: string): string {\n const lines = splitLinesNoTrailing(text)\n if (lines.length === 0) return ''\n const rows: string[][] = []\n for (const line of lines) {\n if (separator !== null && separator !== '') {\n rows.push(line.split(separator))\n } else {\n rows.push(line.split(/\\s+/).filter((s) => s !== ''))\n }\n }\n if (rows.length === 0) return ''\n let maxCols = 0\n for (const r of rows) {\n if (r.length > maxCols) maxCols = r.length\n }\n const widths = new Array(maxCols).fill(0) as number[]\n for (const row of rows) {\n for (let idx = 0; idx < row.length; idx++) {\n const cell = row[idx] ?? ''\n if (cell.length > (widths[idx] ?? 0)) widths[idx] = cell.length\n }\n }\n const out: string[] = []\n for (const row of rows) {\n const parts: string[] = []\n for (let idx = 0; idx < row.length; idx++) {\n const cell = row[idx] ?? ''\n if (idx < row.length - 1) parts.push(padRight(cell, widths[idx] ?? 0))\n else parts.push(cell)\n }\n out.push(parts.join(outputSep))\n }\n return out.join('\\n') + '\\n'\n}\n\nasync function columnCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const tMode = opts.flags.t === true\n const sFlag = typeof opts.flags.s === 'string' ? opts.flags.s : null\n const oFlag = typeof opts.flags.o === 'string' ? opts.flags.o : ' '\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(redisStream(accessor, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('column: missing input\\n') })]\n }\n raw = stdinData\n }\n const text = DEC.decode(raw)\n const output = tMode ? tableFormat(text, sFlag, oFlag) : text\n const result: ByteSource = ENC.encode(output)\n return [result, new IOResult()]\n}\n\nexport const REDIS_COLUMN = command({\n name: 'column',\n resource: ResourceName.REDIS,\n spec: specOf('column'),\n fn: columnCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\ntype MergeEntry = [number, string]\n\nfunction commMerge(lines1: readonly string[], lines2: readonly string[]): MergeEntry[] {\n const result: MergeEntry[] = []\n let i = 0\n let j = 0\n while (i < lines1.length && j < lines2.length) {\n const a = lines1[i] ?? ''\n const b = lines2[j] ?? ''\n if (a < b) {\n result.push([1, a])\n i += 1\n } else if (a > b) {\n result.push([2, b])\n j += 1\n } else {\n result.push([3, a])\n i += 1\n j += 1\n }\n }\n while (i < lines1.length) {\n result.push([1, lines1[i] ?? ''])\n i += 1\n }\n while (j < lines2.length) {\n result.push([2, lines2[j] ?? ''])\n j += 1\n }\n return result\n}\n\nfunction formatComm(\n merged: readonly MergeEntry[],\n suppress1: boolean,\n suppress2: boolean,\n suppress3: boolean,\n): string {\n const out: string[] = []\n for (const [col, text] of merged) {\n if (col === 1 && !suppress1) {\n out.push(text)\n } else if (col === 2 && !suppress2) {\n const prefix = suppress1 ? '' : '\\t'\n out.push(prefix + text)\n } else if (col === 3 && !suppress3) {\n let prefix = ''\n if (!suppress1) prefix += '\\t'\n if (!suppress2) prefix += '\\t'\n out.push(prefix + text)\n }\n }\n return out.length > 0 ? out.join('\\n') + '\\n' : ''\n}\n\nfunction isSorted(lines: readonly string[]): boolean {\n for (let i = 1; i < lines.length; i++) {\n if ((lines[i - 1] ?? '') > (lines[i] ?? '')) return false\n }\n return true\n}\n\nasync function commCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('comm: requires two paths\\n') })]\n }\n const p1 = paths[0]\n const p2 = paths[1]\n if (p1 === undefined || p2 === undefined) return [null, new IOResult()]\n const data1 = DEC.decode(await materialize(redisStream(accessor, p1)))\n const data2 = DEC.decode(await materialize(redisStream(accessor, p2)))\n const lines1 = splitLinesNoTrailing(data1)\n const lines2 = splitLinesNoTrailing(data2)\n let stderr = ''\n if (opts.flags['check-order'] === true) {\n if (!isSorted(lines1)) stderr = 'comm: file 1 is not in sorted order\\n'\n else if (!isSorted(lines2)) stderr = 'comm: file 2 is not in sorted order\\n'\n }\n const suppress1 = opts.flags['1'] === true\n const suppress2 = opts.flags['2'] === true\n const suppress3 = opts.flags['3'] === true\n const merged = commMerge(lines1, lines2)\n const output = formatComm(merged, suppress1, suppress2, suppress3)\n const result: ByteSource = ENC.encode(output)\n return [result, new IOResult({ stderr: stderr !== '' ? ENC.encode(stderr) : null })]\n}\n\nexport const REDIS_COMM = command({\n name: 'comm',\n resource: ResourceName.REDIS,\n spec: specOf('comm'),\n fn: commCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { read as redisRead } from '../../../core/redis/read.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nasync function cpCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('cp: missing operand\\n'),\n }),\n ]\n }\n const sources = paths.slice(0, -1)\n const dst = paths[paths.length - 1]\n if (dst === undefined) return [null, new IOResult()]\n for (const src of sources) {\n const data = await redisRead(accessor, src)\n await redisWrite(accessor, dst, data)\n }\n return [null, new IOResult()]\n}\n\nexport const REDIS_CP = command({\n name: 'cp',\n resource: ResourceName.REDIS,\n spec: specOf('cp'),\n fn: cpCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { record, ResourceName, type PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm, nowIso, parent } from './utils.ts'\n\nexport async function writeBytes(\n accessor: RedisAccessor,\n path: PathSpec,\n data: Uint8Array,\n): Promise<void> {\n const start = performance.now()\n const p = norm(path.stripPrefix)\n const par = parent(p)\n const store = accessor.store\n if (par !== '/' && !(await store.hasDir(par))) {\n throw new Error(`parent directory does not exist: ${par}`)\n }\n await store.setFile(p, data)\n await store.setModified(p, nowIso())\n record('write', p, ResourceName.REDIS, data.byteLength, start)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { type IndexCacheStore, record, ResourceName, type PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm } from './utils.ts'\n\nexport async function read(\n accessor: RedisAccessor,\n path: PathSpec,\n _index?: IndexCacheStore,\n): Promise<Uint8Array> {\n const start = performance.now()\n const p = norm(path.stripPrefix)\n const data = await accessor.store.getFile(p)\n if (data === null) {\n throw new Error(`file not found: ${p}`)\n }\n record('read', p, ResourceName.REDIS, data.byteLength, start)\n return data\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction splitByPatterns(lines: readonly string[], patterns: readonly string[]): string[][] {\n const parts: string[][] = []\n let currentStart = 0\n for (const pat of patterns) {\n if (pat.startsWith('/') && pat.endsWith('/')) {\n const regex = new RegExp(pat.slice(1, -1))\n for (let idx = currentStart; idx < lines.length; idx++) {\n if (regex.test(lines[idx] ?? '')) {\n parts.push(lines.slice(currentStart, idx))\n currentStart = idx\n break\n }\n }\n } else {\n const lineNum = Number.parseInt(pat, 10)\n const splitAt = lineNum - 1\n if (splitAt > currentStart) {\n parts.push(lines.slice(currentStart, splitAt))\n currentStart = splitAt\n }\n }\n }\n if (currentStart < lines.length) {\n parts.push(lines.slice(currentStart))\n }\n return parts\n}\n\nfunction padNum(n: number, digits: number): string {\n const s = String(n)\n return s.length >= digits ? s : '0'.repeat(digits - s.length) + s\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function writePart(\n accessor: RedisAccessor,\n filename: string,\n data: Uint8Array,\n writes: Record<string, Uint8Array>,\n): Promise<void> {\n await redisWrite(accessor, makePathSpec(filename), data)\n writes[filename] = data\n}\n\nasync function csplitCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const prefix = typeof opts.flags.f === 'string' ? opts.flags.f : 'xx'\n const digits = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 2\n const quiet = opts.flags.s === true\n const keep = opts.flags.k === true\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(redisStream(accessor, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('csplit: missing input\\n') })]\n }\n raw = stdinData\n }\n const text = DEC.decode(raw)\n const lines = splitLinesNoTrailing(text)\n const parts = splitByPatterns(lines, texts)\n const writes: Record<string, Uint8Array> = {}\n const sizes: string[] = []\n try {\n for (let idx = 0; idx < parts.length; idx++) {\n const part = parts[idx] ?? []\n const filename = prefix + padNum(idx, digits)\n const data = part.length > 0 ? ENC.encode(part.join('\\n') + '\\n') : new Uint8Array(0)\n await writePart(accessor, filename, data, writes)\n sizes.push(String(data.byteLength))\n }\n } catch (err) {\n if (!keep) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`csplit: ${msg}\\n`) })]\n }\n }\n const output = quiet ? '' : sizes.join('\\n') + '\\n'\n const result: ByteSource = ENC.encode(output)\n return [result, new IOResult({ writes })]\n}\n\nexport const REDIS_CSPLIT = command({\n name: 'csplit',\n resource: ResourceName.REDIS,\n spec: specOf('csplit'),\n fn: csplitCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction parseRangeSpec(spec: string): number[] {\n const out: number[] = []\n for (const part of spec.split(',')) {\n if (part.includes('-')) {\n const [loStr, hiStr] = part.split('-', 2) as [string, string]\n const lo = Number.parseInt(loStr, 10)\n const hi = Number.parseInt(hiStr, 10)\n for (let i = lo; i <= hi; i++) out.push(i)\n } else {\n out.push(Number.parseInt(part, 10))\n }\n }\n return out\n}\n\nfunction parseCharRanges(spec: string): [number, number][] {\n const ranges: [number, number][] = []\n for (const part of spec.split(',')) {\n if (part.includes('-')) {\n const [loStr, hiStr] = part.split('-', 2) as [string, string]\n ranges.push([Number.parseInt(loStr, 10), Number.parseInt(hiStr, 10)])\n } else {\n const val = Number.parseInt(part, 10)\n ranges.push([val, val])\n }\n }\n return ranges\n}\n\nasync function* cutStream(\n source: AsyncIterable<Uint8Array>,\n delimiter: string,\n fields: number[] | null,\n chars: [number, number][] | null,\n complement: boolean,\n zeroTerminated: boolean,\n): AsyncIterable<Uint8Array> {\n const raw = await materialize(source)\n const sep = zeroTerminated ? 0 : 0x0a\n const sepStr = zeroTerminated ? '\\x00' : '\\n'\n // Split raw bytes on sep, drop trailing empty record if present\n const records: Uint8Array[] = []\n let start = 0\n for (let i = 0; i < raw.byteLength; i++) {\n if (raw[i] === sep) {\n records.push(raw.subarray(start, i))\n start = i + 1\n }\n }\n if (start < raw.byteLength) {\n records.push(raw.subarray(start))\n }\n for (const rec of records) {\n const line = DEC.decode(rec)\n if (chars !== null) {\n if (complement) {\n const selectedIndices = new Set<number>()\n for (const [s, e] of chars) {\n for (let i = s - 1; i < e; i++) selectedIndices.add(i)\n }\n const parts: string[] = []\n for (let i = 0; i < line.length; i++) {\n if (!selectedIndices.has(i)) {\n const ch = line.charAt(i)\n if (ch !== '') parts.push(ch)\n }\n }\n yield ENC.encode(parts.join('') + sepStr)\n } else {\n const parts: string[] = []\n for (const [s, e] of chars) {\n parts.push(line.slice(s - 1, e))\n }\n yield ENC.encode(parts.join('') + sepStr)\n }\n } else if (fields !== null && fields.length > 0) {\n const partsF = line.split(delimiter)\n let selected: string[]\n if (complement) {\n const fieldSet = new Set(fields)\n selected = partsF.filter((_, i) => !fieldSet.has(i + 1))\n } else {\n selected = []\n for (const f of fields) {\n const part = partsF[f - 1]\n if (part !== undefined) selected.push(part)\n }\n }\n yield ENC.encode(selected.join(delimiter) + sepStr)\n } else {\n const out = new Uint8Array(rec.byteLength + 1)\n out.set(rec, 0)\n out[rec.byteLength] = sep\n yield out\n }\n }\n}\n\nfunction cutCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): CommandFnResult {\n const f = typeof opts.flags.f === 'string' ? opts.flags.f : null\n const d = typeof opts.flags.d === 'string' ? opts.flags.d : null\n const c = typeof opts.flags.c === 'string' ? opts.flags.c : null\n const complement = opts.flags.complement === true\n const z = opts.flags.z === true\n const fields = f !== null ? parseRangeSpec(f) : null\n const chars = c !== null ? parseCharRanges(c) : null\n const delim = d ?? '\\t'\n\n let source: AsyncIterable<Uint8Array>\n const cache: string[] = []\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = redisStream(accessor, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'cut: missing operand')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n const out: ByteSource = cutStream(source, delim, fields, chars, complement, z)\n return [out, new IOResult({ cache })]\n}\n\nexport const REDIS_CUT = command({\n name: 'cut',\n resource: ResourceName.REDIS,\n spec: specOf('cut'),\n fn: cutCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherCut,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function cutFeatherCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const fSpec = typeof opts.flags.f === 'string' ? opts.flags.f : ''\n const columns = fSpec.split(',').filter((c) => c.length > 0)\n if (columns.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: -f required\\n') })]\n }\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = featherCut(raw, columns)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cut: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_CUT_FEATHER = command({\n name: 'cut',\n resource: ResourceName.REDIS,\n spec: specOf('cut'),\n filetype: '.feather',\n fn: cutFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Cut,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function cutHdf5Command(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const fSpec = typeof opts.flags.f === 'string' ? opts.flags.f : ''\n const columns = fSpec.split(',').filter((c) => c.length > 0)\n if (columns.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: -f required\\n') })]\n }\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = await hdf5Cut(raw, columns)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cut: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_CUT_HDF5 = command({\n name: 'cut',\n resource: ResourceName.REDIS,\n spec: specOf('cut'),\n filetype: '.h5',\n fn: cutHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetCut,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function cutParquetCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const fSpec = typeof opts.flags.f === 'string' ? opts.flags.f : ''\n const columns = fSpec.split(',').filter((c) => c.length > 0)\n if (columns.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: -f required\\n') })]\n }\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = await parquetCut(raw, columns)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cut: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_CUT_PARQUET = command({\n name: 'cut',\n resource: ResourceName.REDIS,\n spec: specOf('cut'),\n filetype: '.parquet',\n fn: cutParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n edScript,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n unifiedDiff,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\ninterface DiffFlags {\n i: boolean\n w: boolean\n b: boolean\n e: boolean\n q: boolean\n}\n\nfunction splitLinesKeepEnds(text: string): string[] {\n const lines: string[] = []\n let start = 0\n for (let i = 0; i < text.length; i++) {\n if (text[i] === '\\n') {\n lines.push(text.slice(start, i + 1))\n start = i + 1\n }\n }\n if (start < text.length) lines.push(text.slice(start))\n return lines\n}\n\nasync function readFile(accessor: RedisAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(redisStream(accessor, p))\n}\n\nasync function diffPair(\n accessor: RedisAccessor,\n path1: PathSpec,\n path2: PathSpec,\n flags: DiffFlags,\n): Promise<Uint8Array> {\n const dataA = await readFile(accessor, path1)\n const dataB = await readFile(accessor, path2)\n let textA = DEC.decode(dataA)\n let textB = DEC.decode(dataB)\n if (flags.i) {\n textA = textA.toLowerCase()\n textB = textB.toLowerCase()\n }\n if (flags.w) {\n textA = textA.replace(/\\s+/g, '')\n textB = textB.replace(/\\s+/g, '')\n }\n if (flags.b) {\n textA = textA.replace(/[ \\t]+/g, ' ')\n textB = textB.replace(/[ \\t]+/g, ' ')\n }\n if (flags.q) {\n if (textA !== textB) return ENC.encode(`Files ${path1.original} and ${path2.original} differ\\n`)\n return new Uint8Array(0)\n }\n const aLines = splitLinesKeepEnds(textA)\n const bLines = splitLinesKeepEnds(textB)\n const result = flags.e\n ? edScript(aLines, bLines)\n : unifiedDiff(aLines, bLines, path1.original, path2.original)\n return ENC.encode(result.join(''))\n}\n\nasync function diffCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [null, new IOResult({ exitCode: 2, stderr: ENC.encode('diff: requires two paths\\n') })]\n }\n const flags: DiffFlags = {\n i: opts.flags.i === true,\n w: opts.flags.w === true,\n b: opts.flags.b === true,\n e: opts.flags.e === true,\n q: opts.flags.q === true,\n }\n const p0 = paths[0]\n const p1 = paths[1]\n if (p0 === undefined || p1 === undefined) return [null, new IOResult()]\n const output = await diffPair(accessor, p0, p1, flags)\n const exitCode = output.byteLength > 0 ? 1 : 0\n const out: ByteSource = output\n return [out, new IOResult({ exitCode, cache: [p0.stripPrefix, p1.stripPrefix] })]\n}\n\nexport const REDIS_DIFF = command({\n name: 'diff',\n resource: ResourceName.REDIS,\n spec: specOf('diff'),\n fn: diffCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type Accessor,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\n\nfunction dirnameCommand(\n _accessor: Accessor,\n paths: PathSpec[],\n texts: string[],\n _opts: CommandOpts,\n): CommandFnResult {\n const arg = texts[0] ?? paths[0]?.original ?? ''\n const stripped = arg.replace(/\\/+$/, '')\n const idx = stripped.lastIndexOf('/')\n const dir = idx > 0 ? stripped.slice(0, idx) : idx === 0 ? '/' : '.'\n const out: ByteSource = new TextEncoder().encode(`${dir}\\n`)\n return [out, new IOResult()]\n}\n\nexport const REDIS_DIRNAME = command({\n name: 'dirname',\n resource: ResourceName.REDIS,\n spec: specOf('dirname'),\n fn: dirnameCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { du as redisDu } from '../../../core/redis/du.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nfunction humanSize(n: number): string {\n const units = ['', 'K', 'M', 'G', 'T']\n let v = n\n let i = 0\n while (v >= 1024 && i < units.length - 1) {\n v /= 1024\n i += 1\n }\n const s = v >= 10 || i === 0 ? Math.round(v).toString() : v.toFixed(1)\n return `${s}${units[i] ?? ''}`\n}\n\nasync function duCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const human = opts.flags.h === true\n const targets =\n paths.length > 0 ? paths : [new PathSpec({ original: '/', directory: '/', resolved: false })]\n const lines: string[] = []\n for (const root of targets) {\n let total = 0\n try {\n total = await redisDu(accessor, root)\n } catch {\n total = 0\n }\n const sizeStr = human ? humanSize(total) : String(total)\n lines.push(`${sizeStr}\\t${root.original}`)\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const REDIS_DU = command({\n name: 'du',\n resource: ResourceName.REDIS,\n spec: specOf('du'),\n fn: duCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm } from './utils.ts'\n\nexport async function du(accessor: RedisAccessor, path: PathSpec): Promise<number> {\n const p = norm(path.stripPrefix)\n const store = accessor.store\n const prefix = p.replace(/\\/+$/, '') + '/'\n let total = 0\n for (const key of await store.listFiles()) {\n if (key === p || key.startsWith(prefix)) {\n total += await store.fileLen(key)\n }\n }\n return total\n}\n\nexport async function duAll(\n accessor: RedisAccessor,\n path: PathSpec,\n): Promise<{ entries: [string, number][]; total: number }> {\n const p = norm(path.stripPrefix)\n const store = accessor.store\n const prefix = p.replace(/\\/+$/, '') + '/'\n const entries: [string, number][] = []\n let total = 0\n for (const key of await store.listFiles()) {\n if (key === p || key.startsWith(prefix)) {\n const size = await store.fileLen(key)\n entries.push([key, size])\n total += size\n }\n }\n return { entries, total }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction expandTabs(text: string, tabsize: number): string {\n const out: string[] = []\n let col = 0\n for (const ch of text) {\n if (ch === '\\t') {\n const spaces = tabsize - (col % tabsize)\n out.push(' '.repeat(spaces))\n col += spaces\n } else if (ch === '\\n') {\n out.push(ch)\n col = 0\n } else {\n out.push(ch)\n col += 1\n }\n }\n return out.join('')\n}\n\nfunction expandLeadingTabs(text: string, tabsize: number): string {\n const lines = text.split('\\n')\n const result: string[] = []\n for (const line of lines) {\n let i = 0\n while (i < line.length && line[i] === '\\t') i += 1\n if (i === 0) {\n result.push(line)\n } else {\n const leading = line.slice(0, i)\n const rest = line.slice(i)\n result.push(expandTabs(leading, tabsize) + rest)\n }\n }\n return result.join('\\n')\n}\n\nasync function expandCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const tabsize = typeof opts.flags.t === 'string' ? Number.parseInt(opts.flags.t, 10) : 8\n const leadingOnly = opts.flags.i === true\n const expander = (txt: string) =>\n leadingOnly ? expandLeadingTabs(txt, tabsize) : expandTabs(txt, tabsize)\n if (paths.length > 0) {\n const parts: string[] = []\n for (const p of paths) {\n const data = DEC.decode(await materialize(redisStream(accessor, p)))\n parts.push(expander(data))\n }\n const result: ByteSource = ENC.encode(parts.join(''))\n return [result, new IOResult()]\n }\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('expand: missing operand\\n') })]\n }\n const text = DEC.decode(stdinData)\n const result: ByteSource = ENC.encode(expander(text))\n return [result, new IOResult()]\n}\n\nexport const REDIS_EXPAND = command({\n name: 'expand',\n resource: ResourceName.REDIS,\n spec: specOf('expand'),\n fn: expandCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n ResourceName,\n command,\n detectFileType,\n formatFileResult,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stat as redisStat } from '../../../../core/redis/stat.ts'\nimport { read as redisRead } from '../../../../core/redis/read.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function fileCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('file: missing operand\\n') })]\n }\n const brief = opts.flags.b === true\n const mime = opts.flags.i === true\n const lines: string[] = []\n for (const p of paths) {\n const s = await redisStat(accessor, p)\n if (s.type === FileType.DIRECTORY) {\n lines.push(formatFileResult(p.original, FileType.DIRECTORY, brief, mime))\n continue\n }\n let header: Uint8Array\n try {\n const raw = await redisRead(accessor, p)\n header = raw.subarray(0, 512)\n } catch {\n header = new Uint8Array(0)\n }\n const result = detectFileType(header, s)\n lines.push(formatFileResult(p.original, result, brief, mime))\n }\n const out: ByteSource = ENC.encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const REDIS_FILE = command({\n name: 'file',\n resource: ResourceName.REDIS,\n spec: specOf('file'),\n fn: fileCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherDescribe,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function fileFeatherCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('file: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = featherDescribe(raw)\n const out: ByteSource = ENC.encode(result)\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`file: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_FILE_FEATHER = command({\n name: 'file',\n resource: ResourceName.REDIS,\n spec: specOf('file'),\n filetype: '.feather',\n fn: fileFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Describe,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function fileHdf5Command(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('file: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = await hdf5Describe(raw)\n const out: ByteSource = ENC.encode(result)\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`file: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_FILE_HDF5 = command({\n name: 'file',\n resource: ResourceName.REDIS,\n spec: specOf('file'),\n filetype: '.h5',\n fn: fileHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetDescribe,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function fileParquetCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('file: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = parquetDescribe(raw)\n const out: ByteSource = ENC.encode(result)\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`file: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_FILE_PARQUET = command({\n name: 'file',\n resource: ResourceName.REDIS,\n spec: specOf('file'),\n filetype: '.parquet',\n fn: fileParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { find as redisFind } from '../../../core/redis/find.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\n/**\n * Parse a `-size` argument (e.g. `+1M`, `-100c`, `512`) into [min, max] bytes.\n * `+N` → larger than N; `-N` → smaller; bare N → exactly N.\n * Suffixes: c=byte, k=KB, M=MB, G=GB. Mirrors Python `_parse_size`.\n */\nfunction parseSize(spec: string): [number | null, number | null] {\n const suffixes: Record<string, number> = { c: 1, k: 1024, M: 1024 ** 2, G: 1024 ** 3 }\n const sign = spec.startsWith('+') ? '+' : spec.startsWith('-') ? '-' : ''\n const raw = sign === '' ? spec : spec.slice(1)\n const lastChar = raw.slice(-1)\n const mult = suffixes[lastChar] ?? 1\n const numPart = lastChar in suffixes ? raw.slice(0, -1) : raw\n const num = Number.parseInt(numPart, 10) * mult\n if (sign === '+') return [num, null]\n if (sign === '-') return [null, num]\n return [num, num]\n}\n\n/**\n * Parse a `-mtime` argument (e.g. `+7`, `-1`) into [minTimestamp, maxTimestamp].\n * Days are 86400-second buckets relative to now. Mirrors Python `_parse_mtime`.\n */\nfunction parseMtime(spec: string): [number | null, number | null] {\n const now = Date.now() / 1000\n const day = 86_400\n const n = Number.parseInt(spec.replace(/^[+-]/, ''), 10)\n if (spec.startsWith('+')) return [null, now - n * day]\n if (spec.startsWith('-')) return [now - n * day, null]\n return [now - (n + 1) * day, now - n * day]\n}\n\n/**\n * Extract `-not -name PATTERN` from positional args. Mirrors Python\n * `_extract_not_name`.\n */\nfunction extractNotName(texts: readonly string[]): string | null {\n for (let i = 0; i < texts.length; i++) {\n const pat = texts[i + 2]\n if (texts[i] === '-not' && texts[i + 1] === '-name' && pat !== undefined) {\n return pat\n }\n }\n return null\n}\n\n/**\n * Extract `-or -name PATTERN` repeated entries. Mirrors Python\n * `_extract_or_names`. Always includes the primary `-name` if given.\n */\nfunction extractOrNames(name: string | null, texts: readonly string[]): string[] {\n const names: string[] = []\n if (name !== null) names.push(name)\n let i = 0\n while (i < texts.length) {\n const pat = texts[i + 2]\n if (texts[i] === '-or' && texts[i + 1] === '-name' && pat !== undefined) {\n names.push(pat)\n i += 3\n } else {\n i += 1\n }\n }\n return names\n}\n\nasync function findCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nameFlag = typeof opts.flags.name === 'string' ? opts.flags.name : null\n const inameFlag = typeof opts.flags.iname === 'string' ? opts.flags.iname : null\n const typeFlag = typeof opts.flags.type === 'string' ? opts.flags.type : null\n const pathFlag = typeof opts.flags.path === 'string' ? opts.flags.path : null\n const maxDepthFlag = typeof opts.flags.maxdepth === 'string' ? opts.flags.maxdepth : null\n const minDepthFlag = typeof opts.flags.mindepth === 'string' ? opts.flags.mindepth : null\n const sizeFlag = typeof opts.flags.size === 'string' ? opts.flags.size : null\n const mtimeFlag = typeof opts.flags.mtime === 'string' ? opts.flags.mtime : null\n const targets =\n paths.length > 0 ? paths : [new PathSpec({ original: '/', directory: '/', resolved: false })]\n const findType: 'f' | 'd' | null = typeFlag === 'f' ? 'f' : typeFlag === 'd' ? 'd' : null\n const maxDepth = maxDepthFlag !== null ? Number.parseInt(maxDepthFlag, 10) : null\n const minDepth = minDepthFlag !== null ? Number.parseInt(minDepthFlag, 10) : null\n const [minSize, maxSize] = sizeFlag !== null ? parseSize(sizeFlag) : [null, null]\n const [mtimeMin, mtimeMax] = mtimeFlag !== null ? parseMtime(mtimeFlag) : [null, null]\n const nameExclude = extractNotName(texts)\n const orNames = extractOrNames(nameFlag, texts)\n const matches: string[] = []\n for (const root of targets) {\n let keys: string[]\n try {\n keys = await redisFind(accessor, root, {\n name: nameFlag,\n iname: inameFlag,\n type: findType,\n ...(maxDepth !== null ? { maxDepth } : {}),\n ...(minDepth !== null ? { minDepth } : {}),\n ...(minSize !== null ? { minSize } : {}),\n ...(maxSize !== null ? { maxSize } : {}),\n ...(mtimeMin !== null ? { mtimeMin } : {}),\n ...(mtimeMax !== null ? { mtimeMax } : {}),\n ...(nameExclude !== null ? { nameExclude } : {}),\n ...(pathFlag !== null ? { pathPattern: pathFlag } : {}),\n ...(orNames.length > 1 ? { orNames } : {}),\n })\n } catch {\n continue\n }\n const rootKey = root.stripPrefix.replace(/\\/+$/, '') || '/'\n for (const key of keys) {\n const displayPath =\n root.original === '/'\n ? key\n : root.original.replace(/\\/+$/, '') + key.slice(rootKey === '/' ? 0 : rootKey.length)\n matches.push(displayPath)\n }\n }\n matches.sort()\n const out: ByteSource = new TextEncoder().encode(matches.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const REDIS_FIND = command({\n name: 'find',\n resource: ResourceName.REDIS,\n spec: specOf('find'),\n fn: findCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm } from './utils.ts'\n\nexport interface FindOptions {\n name?: string | null\n type?: 'f' | 'd' | null\n minSize?: number | null\n maxSize?: number | null\n maxDepth?: number | null\n minDepth?: number | null\n nameExclude?: string | null\n orNames?: string[] | null\n iname?: string | null\n pathPattern?: string | null\n}\n\nfunction fnmatch(name: string, pattern: string): boolean {\n let re = '^'\n for (const ch of pattern) {\n if (ch === '*') re += '.*'\n else if (ch === '?') re += '.'\n else if (/[.+^${}()|[\\]\\\\]/.test(ch)) re += '\\\\' + ch\n else re += ch\n }\n re += '$'\n return new RegExp(re).test(name)\n}\n\nexport async function find(\n accessor: RedisAccessor,\n path: PathSpec,\n options: FindOptions = {},\n): Promise<string[]> {\n const p = norm(path.stripPrefix)\n const store = accessor.store\n const prefix = p.replace(/\\/+$/, '') + '/'\n const baseDepth = (p.match(/\\//g) ?? []).length\n const results: string[] = []\n const candidates: [string, 'f' | 'd'][] = []\n if (options.type !== 'd') {\n for (const key of await store.listFiles()) candidates.push([key, 'f'])\n }\n if (options.type !== 'f') {\n for (const key of await store.listDirs()) {\n if (key !== '/') candidates.push([key, 'd'])\n }\n }\n for (const [key, kind] of candidates) {\n if (key !== p && !key.startsWith(prefix)) continue\n if (key === p && kind === 'd') continue\n const depth = (key.match(/\\//g) ?? []).length - baseDepth\n if (options.maxDepth !== null && options.maxDepth !== undefined && depth > options.maxDepth)\n continue\n if (options.minDepth !== null && options.minDepth !== undefined && depth < options.minDepth)\n continue\n const basename = key.slice(key.lastIndexOf('/') + 1)\n if (options.name !== null && options.name !== undefined && !fnmatch(basename, options.name))\n continue\n if (\n options.iname !== null &&\n options.iname !== undefined &&\n !fnmatch(basename.toLowerCase(), options.iname.toLowerCase())\n )\n continue\n if (\n options.pathPattern !== null &&\n options.pathPattern !== undefined &&\n !fnmatch(key, options.pathPattern)\n )\n continue\n if (\n options.orNames !== null &&\n options.orNames !== undefined &&\n !options.orNames.some((pat) => fnmatch(basename, pat))\n )\n continue\n if (\n options.nameExclude !== null &&\n options.nameExclude !== undefined &&\n fnmatch(basename, options.nameExclude)\n )\n continue\n if (\n kind === 'f' &&\n ((options.minSize !== null && options.minSize !== undefined) ||\n (options.maxSize !== null && options.maxSize !== undefined))\n ) {\n const size = await store.fileLen(key)\n if (options.minSize !== null && options.minSize !== undefined && size < options.minSize)\n continue\n if (options.maxSize !== null && options.maxSize !== undefined && size > options.maxSize)\n continue\n }\n results.push(key)\n }\n results.sort()\n return results\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction wrapText(text: string, width: number): string {\n const words = text.split(/\\s+/).filter((w) => w !== '')\n if (words.length === 0) return ''\n const lines: string[] = []\n let current = ''\n for (const w of words) {\n if (current === '') {\n current = w\n } else if (current.length + 1 + w.length <= width) {\n current = current + ' ' + w\n } else {\n lines.push(current)\n current = w\n }\n }\n if (current !== '') lines.push(current)\n return lines.join('\\n')\n}\n\nfunction fmtText(text: string, width: number): string {\n const paragraphs = text.split('\\n\\n')\n const formatted: string[] = []\n for (const para of paragraphs) {\n const trimmed = para.trim()\n if (trimmed !== '') formatted.push(wrapText(trimmed, width))\n else formatted.push('')\n }\n return formatted.join('\\n\\n') + '\\n'\n}\n\nasync function fmtCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const width = typeof opts.flags.w === 'string' ? Number.parseInt(opts.flags.w, 10) : 75\n if (paths.length > 0) {\n const parts: string[] = []\n for (const p of paths) {\n parts.push(DEC.decode(await materialize(redisStream(accessor, p))))\n }\n const result: ByteSource = ENC.encode(fmtText(parts.join(''), width))\n return [result, new IOResult()]\n }\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('fmt: missing operand\\n') })]\n }\n const text = DEC.decode(stdinData)\n const result: ByteSource = ENC.encode(fmtText(text, width))\n return [result, new IOResult()]\n}\n\nexport const REDIS_FMT = command({\n name: 'fmt',\n resource: ResourceName.REDIS,\n spec: specOf('fmt'),\n fn: fmtCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction foldLine(line: string, width: number, breakSpaces: boolean): string {\n if (line.length <= width) return line\n const parts: string[] = []\n let rest = line\n while (rest.length > width) {\n if (breakSpaces) {\n const idx = rest.lastIndexOf(' ', width - 1)\n if (idx > 0) {\n parts.push(rest.slice(0, idx + 1))\n rest = rest.slice(idx + 1)\n } else {\n parts.push(rest.slice(0, width))\n rest = rest.slice(width)\n }\n } else {\n parts.push(rest.slice(0, width))\n rest = rest.slice(width)\n }\n }\n if (rest !== '') parts.push(rest)\n return parts.join('\\n')\n}\n\nasync function foldCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const width = typeof opts.flags.w === 'string' ? Number.parseInt(opts.flags.w, 10) : 80\n const breakSpaces = opts.flags.s === true\n if (paths.length > 0) {\n const allLines: string[] = []\n for (const p of paths) {\n const data = DEC.decode(await materialize(redisStream(accessor, p)))\n for (const line of splitLinesNoTrailing(data)) {\n allLines.push(foldLine(line, width, breakSpaces))\n }\n }\n const result: ByteSource = ENC.encode(allLines.join('\\n') + '\\n')\n return [result, new IOResult()]\n }\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('fold: missing operand\\n') })]\n }\n const lines = splitLinesNoTrailing(DEC.decode(stdinData))\n const result: ByteSource = ENC.encode(\n lines.map((ln) => foldLine(ln, width, breakSpaces)).join('\\n') + '\\n',\n )\n return [result, new IOResult()]\n}\n\nexport const REDIS_FOLD = command({\n name: 'fold',\n resource: ResourceName.REDIS,\n spec: specOf('fold'),\n fn: foldCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n compilePattern,\n exitOnEmpty,\n grepLines,\n grepStream,\n materialize,\n prefixAggregate,\n quietMatch,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport { stat as redisStat } from '../../../../core/redis/stat.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction getPattern(texts: readonly string[], flags: Record<string, string | boolean>): string {\n if (typeof flags.e === 'string') return flags.e\n if (texts.length > 0 && texts[0] !== undefined) return texts[0]\n throw new Error('grep: usage: grep [flags] pattern [path]')\n}\n\ninterface FlagSet {\n ignoreCase: boolean\n invert: boolean\n lineNumbers: boolean\n countOnly: boolean\n filesOnly: boolean\n wholeWord: boolean\n fixedString: boolean\n onlyMatching: boolean\n maxCount: number | null\n quiet: boolean\n afterContext: number\n beforeContext: number\n}\n\nfunction parseFlags(flags: Record<string, string | boolean>): FlagSet {\n const toInt = (v: string | boolean | undefined): number | null =>\n typeof v === 'string' ? Number.parseInt(v, 10) : null\n const aCtx = toInt(flags.A)\n const bCtx = toInt(flags.B)\n const cCtx = toInt(flags.C)\n return {\n ignoreCase: flags.i === true,\n invert: flags.v === true,\n lineNumbers: flags.n === true,\n countOnly: flags.c === true,\n filesOnly: flags.args_l === true || flags.l === true,\n wholeWord: flags.w === true,\n fixedString: flags.F === true,\n onlyMatching: flags.o === true,\n maxCount: toInt(flags.m),\n quiet: flags.q === true,\n afterContext: aCtx ?? cCtx ?? 0,\n beforeContext: bCtx ?? cCtx ?? 0,\n }\n}\n\nasync function readFile(accessor: RedisAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(redisStream(accessor, p))\n}\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nasync function grepImpl(\n name: string,\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n let pattern: string\n try {\n pattern = getPattern(texts, opts.flags)\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 2, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const f = parseFlags(opts.flags)\n\n if (paths.length > 0) {\n const pat = compilePattern(pattern, f.ignoreCase, f.fixedString, f.wholeWord)\n\n if (paths.length > 1) {\n const allResults: string[] = []\n for (const p of paths) {\n const data = splitLinesNoTrailing(DEC.decode(await readFile(accessor, p)))\n const hits = grepLines(p.original, data, pat, f)\n if (f.countOnly) {\n if (hits.length > 0) allResults.push(`${p.original}:${hits[0] ?? ''}`)\n } else if (f.filesOnly) {\n for (const h of hits) allResults.push(h)\n } else {\n for (const h of hits) allResults.push(`${p.original}:${h}`)\n }\n }\n if (allResults.length === 0) return [new Uint8Array(0), new IOResult({ exitCode: 1 })]\n const out: ByteSource = ENC.encode(allResults.join('\\n'))\n return [out, new IOResult()]\n }\n\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n await redisStat(accessor, first)\n if (f.filesOnly) {\n const data = splitLinesNoTrailing(DEC.decode(await readFile(accessor, first)))\n const hits = grepLines(first.original, data, pat, f)\n if (hits.length === 0) return [new Uint8Array(0), new IOResult({ exitCode: 1 })]\n return [ENC.encode(hits.join('\\n')), new IOResult()]\n }\n const source = redisStream(accessor, first)\n const stream = grepStream(source, pat, f)\n if (f.quiet) {\n const io = new IOResult({ exitCode: 1 })\n return [quietMatch(stream, io), io]\n }\n const io = new IOResult()\n return [exitOnEmpty(stream, io), io]\n }\n\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, `${name}: usage: ${name} [flags] pattern [path]`)\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 2, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const pat = compilePattern(pattern, f.ignoreCase, f.fixedString, f.wholeWord)\n const stream = grepStream(source, pat, f)\n if (f.quiet) {\n const io = new IOResult({ exitCode: 1 })\n return [quietMatch(stream, io), io]\n }\n const io = new IOResult()\n return [exitOnEmpty(stream, io), io]\n}\n\nconst grepFn = (\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> => grepImpl('grep', accessor, paths, texts, opts)\n\nexport const REDIS_GREP = command({\n name: 'grep',\n resource: ResourceName.REDIS,\n spec: specOf('grep'),\n fn: grepFn,\n aggregate: prefixAggregate,\n})\n\nexport { grepImpl }\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherGrep,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function grepFeatherCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = featherGrep(raw, pattern, ignoreCase)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_GREP_FEATHER = command({\n name: 'grep',\n resource: ResourceName.REDIS,\n spec: specOf('grep'),\n filetype: '.feather',\n fn: grepFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Grep,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function grepHdf5Command(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = await hdf5Grep(raw, pattern, ignoreCase)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_GREP_HDF5 = command({\n name: 'grep',\n resource: ResourceName.REDIS,\n spec: specOf('grep'),\n filetype: '.h5',\n fn: grepHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetGrep,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function grepParquetCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = await parquetGrep(raw, pattern, ignoreCase)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_GREP_PARQUET = command({\n name: 'grep',\n resource: ResourceName.REDIS,\n spec: specOf('grep'),\n filetype: '.parquet',\n fn: grepParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n gunzip,\n materialize,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { unlink as redisUnlink } from '../../../core/redis/unlink.ts'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function gunzipCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const keep = opts.flags.k === true\n const stdoutMode = opts.flags.c === true\n const testMode = opts.flags.t === true\n\n if (paths.length === 0) {\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, 'gunzip: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const data = await materialize(source)\n const out = await gunzip(data)\n const result: ByteSource = out\n return [result, new IOResult()]\n }\n\n if (testMode) {\n for (const p of paths) {\n const raw = await materialize(redisStream(accessor, p))\n await gunzip(raw)\n }\n return [null, new IOResult()]\n }\n\n if (stdoutMode) {\n const chunks: Uint8Array[] = []\n for (const p of paths) {\n const raw = await materialize(redisStream(accessor, p))\n chunks.push(await gunzip(raw))\n }\n return [concat(chunks), new IOResult()]\n }\n\n const writes: Record<string, Uint8Array> = {}\n for (const p of paths) {\n const raw = await materialize(redisStream(accessor, p))\n const pStripped = p.stripPrefix\n const outPath = pStripped.endsWith('.gz') ? pStripped.slice(0, -3) : pStripped + '.out'\n const outData = await gunzip(raw)\n await redisWrite(accessor, makePathSpec(outPath), outData)\n writes[outPath] = outData\n if (!keep) await redisUnlink(accessor, p)\n }\n return [null, new IOResult({ writes })]\n}\n\nfunction concat(chunks: Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nexport const REDIS_GUNZIP = command({\n name: 'gunzip',\n resource: ResourceName.REDIS,\n spec: specOf('gunzip'),\n fn: gunzipCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm } from './utils.ts'\n\nexport async function unlink(accessor: RedisAccessor, path: PathSpec): Promise<void> {\n const p = norm(path.stripPrefix)\n const store = accessor.store\n if (!(await store.hasFile(p))) {\n throw new Error(`file not found: ${p}`)\n }\n await store.delFile(p)\n await store.delModified(p)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n gunzip,\n gzip,\n materialize,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { unlink as redisUnlink } from '../../../core/redis/unlink.ts'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function gzipCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const decompress = opts.flags.d === true\n const keep = opts.flags.k === true\n const stdoutMode = opts.flags.c === true\n\n if (paths.length === 0) {\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, 'gzip: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const data = await materialize(source)\n const out = decompress ? await gunzip(data) : await gzip(data)\n const result: ByteSource = out\n return [result, new IOResult()]\n }\n\n if (stdoutMode) {\n const chunks: Uint8Array[] = []\n for (const p of paths) {\n const raw = await materialize(redisStream(accessor, p))\n const out = decompress ? await gunzip(raw) : await gzip(raw)\n chunks.push(out)\n }\n return [concat(chunks), new IOResult()]\n }\n\n const writes: Record<string, Uint8Array> = {}\n for (const p of paths) {\n const raw = await materialize(redisStream(accessor, p))\n const pStripped = p.stripPrefix\n let outPath: string\n let outData: Uint8Array\n if (decompress) {\n outPath = pStripped.endsWith('.gz') ? pStripped.slice(0, -3) : pStripped + '.out'\n outData = await gunzip(raw)\n } else {\n outPath = pStripped + '.gz'\n outData = await gzip(raw)\n }\n await redisWrite(accessor, makePathSpec(outPath), outData)\n writes[outPath] = outData\n if (!keep) await redisUnlink(accessor, p)\n }\n return [null, new IOResult({ writes })]\n}\n\nfunction concat(chunks: Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nexport const REDIS_GZIP = command({\n name: 'gzip',\n resource: ResourceName.REDIS,\n spec: specOf('gzip'),\n fn: gzipCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n Precision,\n ProvisionResult,\n ResourceName,\n command,\n headerAggregate,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport { stat as redisStat } from '../../../../core/redis/stat.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function* headStream(\n source: AsyncIterable<Uint8Array>,\n lines: number,\n bytesMode: number | null,\n): AsyncIterable<Uint8Array> {\n if (bytesMode !== null) {\n let remaining = bytesMode\n for await (const chunk of source) {\n if (chunk.byteLength <= remaining) {\n yield chunk\n remaining -= chunk.byteLength\n if (remaining <= 0) return\n } else {\n yield chunk.slice(0, remaining)\n return\n }\n }\n return\n }\n let count = 0\n const lineIter = new AsyncLineIterator(source)\n for await (const line of lineIter) {\n const out = new Uint8Array(line.byteLength + 1)\n out.set(line, 0)\n out[line.byteLength] = 0x0a\n yield out\n count += 1\n if (count >= lines) return\n }\n}\n\nasync function* headMulti(\n accessor: RedisAccessor,\n paths: readonly PathSpec[],\n lines: number,\n bytesMode: number | null,\n): AsyncIterable<Uint8Array> {\n for (let i = 0; i < paths.length; i++) {\n const p = paths[i]\n if (p === undefined) continue\n if (paths.length > 1) {\n const prefix = i > 0 ? '\\n' : ''\n yield ENC.encode(`${prefix}==> ${p.original} <==\\n`)\n }\n const source = redisStream(accessor, p)\n for await (const chunk of headStream(source, lines, bytesMode)) yield chunk\n }\n}\n\nexport async function headProvision(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<ProvisionResult> {\n const [first] = paths\n if (first === undefined) return new ProvisionResult({ command: 'head' })\n try {\n const s = await redisStat(accessor, first)\n const fileSize = s.size ?? 0\n const nFlag = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : null\n const lines = nFlag !== null && Number.isFinite(nFlag) ? nFlag : 10\n const avgLine = 80\n const low = Math.min(lines * avgLine, fileSize)\n return new ProvisionResult({\n command: `head ${first.original}`,\n networkReadLow: low,\n networkReadHigh: fileSize,\n readOps: 1,\n precision: Precision.RANGE,\n })\n } catch {\n return new ProvisionResult({ command: 'head' })\n }\n}\n\nasync function headCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nRaw = typeof opts.flags.n === 'string' ? opts.flags.n : null\n const cRaw = typeof opts.flags.c === 'string' ? opts.flags.c : null\n const lineCount = nRaw !== null ? Number.parseInt(nRaw, 10) : 10\n const byteCount = cRaw !== null ? Number.parseInt(cRaw, 10) : null\n if (paths.length > 0) {\n for (const p of paths) await redisStat(accessor, p)\n return [headMulti(accessor, paths, lineCount, byteCount), new IOResult()]\n }\n try {\n const source = resolveSource(opts.stdin, 'head: missing operand')\n return [headStream(source, lineCount, byteCount), new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const REDIS_HEAD = command({\n name: 'head',\n resource: ResourceName.REDIS,\n spec: specOf('head'),\n fn: headCommand,\n provision: headProvision,\n aggregate: headerAggregate,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherHead,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function headFeatherCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = featherHead(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_HEAD_FEATHER = command({\n name: 'head',\n resource: ResourceName.REDIS,\n spec: specOf('head'),\n filetype: '.feather',\n fn: headFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Head,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function headHdf5Command(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = await hdf5Head(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_HEAD_HDF5 = command({\n name: 'head',\n resource: ResourceName.REDIS,\n spec: specOf('head'),\n filetype: '.h5',\n fn: headHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetHead,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function headParquetCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = await parquetHead(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_HEAD_PARQUET = command({\n name: 'head',\n resource: ResourceName.REDIS,\n spec: specOf('head'),\n filetype: '.parquet',\n fn: headParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\ntype EncodingId = 'utf-8' | 'utf-16le' | 'utf-16be' | 'latin1' | 'ascii'\n\nconst ENCODING_ALIASES: Record<string, EncodingId> = {\n 'utf-8': 'utf-8',\n utf8: 'utf-8',\n 'utf-16le': 'utf-16le',\n utf16le: 'utf-16le',\n ucs2: 'utf-16le',\n 'ucs-2': 'utf-16le',\n 'utf-16be': 'utf-16be',\n utf16be: 'utf-16be',\n latin1: 'latin1',\n iso88591: 'latin1',\n 'iso-8859-1': 'latin1',\n ascii: 'ascii',\n}\n\nfunction normalizeEncoding(name: string): EncodingId | null {\n const lower = name.toLowerCase().replace(/_/g, '-')\n return ENCODING_ALIASES[lower] ?? ENCODING_ALIASES[lower.replace(/-/g, '')] ?? null\n}\n\nfunction decodeUtf16BE(data: Uint8Array): string {\n const view = new DataView(data.buffer, data.byteOffset, data.byteLength)\n const chars: string[] = []\n for (let i = 0; i + 1 < data.byteLength; i += 2) {\n chars.push(String.fromCharCode(view.getUint16(i, false)))\n }\n return chars.join('')\n}\n\nfunction encodeUtf16BE(text: string): Uint8Array {\n const out = new Uint8Array(text.length * 2)\n const view = new DataView(out.buffer)\n for (let i = 0; i < text.length; i++) {\n view.setUint16(i * 2, text.charCodeAt(i), false)\n }\n return out\n}\n\nfunction decodeLatin1(data: Uint8Array): string {\n let s = ''\n for (let i = 0; i < data.byteLength; i++) s += String.fromCharCode(data[i] ?? 0)\n return s\n}\n\nfunction encodeLatin1(text: string): Uint8Array {\n const out = new Uint8Array(text.length)\n for (let i = 0; i < text.length; i++) out[i] = text.charCodeAt(i) & 0xff\n return out\n}\n\nfunction decodeAscii(data: Uint8Array): string {\n let s = ''\n for (let i = 0; i < data.byteLength; i++) s += String.fromCharCode((data[i] ?? 0) & 0x7f)\n return s\n}\n\nfunction encodeAscii(text: string): Uint8Array {\n const out = new Uint8Array(text.length)\n for (let i = 0; i < text.length; i++) out[i] = text.charCodeAt(i) & 0x7f\n return out\n}\n\nfunction decodeBytes(data: Uint8Array, enc: EncodingId): string {\n if (enc === 'utf-8') return new TextDecoder('utf-8', { fatal: false }).decode(data)\n if (enc === 'utf-16le') return new TextDecoder('utf-16le', { fatal: false }).decode(data)\n if (enc === 'utf-16be') return decodeUtf16BE(data)\n if (enc === 'latin1') return decodeLatin1(data)\n return decodeAscii(data)\n}\n\nfunction encodeText(text: string, enc: EncodingId): Uint8Array {\n if (enc === 'utf-8') return new TextEncoder().encode(text)\n if (enc === 'utf-16le') {\n const out = new Uint8Array(text.length * 2)\n const view = new DataView(out.buffer)\n for (let i = 0; i < text.length; i++) view.setUint16(i * 2, text.charCodeAt(i), true)\n return out\n }\n if (enc === 'utf-16be') return encodeUtf16BE(text)\n if (enc === 'latin1') return encodeLatin1(text)\n return encodeAscii(text)\n}\n\nasync function iconvCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const fromName = typeof opts.flags.f === 'string' ? opts.flags.f : 'utf-8'\n const toName = typeof opts.flags.t === 'string' ? opts.flags.t : 'utf-8'\n const fromEnc = normalizeEncoding(fromName)\n const toEnc = normalizeEncoding(toName)\n if (fromEnc === null) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`iconv: unsupported encoding: ${fromName}\\n`),\n }),\n ]\n }\n if (toEnc === null) {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode(`iconv: unsupported encoding: ${toName}\\n`) }),\n ]\n }\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(redisStream(accessor, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('iconv: missing input\\n') })]\n }\n raw = stdinData\n }\n const decoded = decodeBytes(raw, fromEnc)\n const encoded = encodeText(decoded, toEnc)\n const outPath = typeof opts.flags.o === 'string' ? opts.flags.o : null\n if (outPath !== null) {\n const spec = new PathSpec({ original: outPath, directory: outPath, resolved: true })\n await redisWrite(accessor, spec, encoded)\n return [null, new IOResult({ writes: { [outPath]: encoded } })]\n }\n const result: ByteSource = encoded\n return [result, new IOResult()]\n}\n\nexport const REDIS_ICONV = command({\n name: 'iconv',\n resource: ResourceName.REDIS,\n spec: specOf('iconv'),\n fn: iconvCommand,\n write: true,\n})\n\nexport type { EncodingId as SupportedEncoding }\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction splitFields(line: string, delimiter: string | null): string[] {\n if (delimiter !== null && delimiter !== '') return line.split(delimiter)\n return line.split(/\\s+/).filter((s) => s !== '')\n}\n\nfunction buildJoinMap(\n lines: readonly string[],\n fieldIdx: number,\n delimiter: string | null,\n): Map<string, string[][]> {\n const result = new Map<string, string[][]>()\n for (const line of lines) {\n const parts = splitFields(line, delimiter)\n if (fieldIdx < parts.length) {\n const key = parts[fieldIdx] ?? ''\n const rest = parts.slice(0, fieldIdx).concat(parts.slice(fieldIdx + 1))\n const list = result.get(key)\n if (list === undefined) result.set(key, [rest])\n else list.push(rest)\n }\n }\n return result\n}\n\nfunction formatRow(\n key: string,\n rest1: readonly string[],\n rest2: readonly string[],\n oFmt: string | null,\n outSep: string,\n): string {\n if (oFmt === null) return [key, ...rest1, ...rest2].join(outSep)\n const fields: string[] = []\n for (const spec of oFmt.split(',')) {\n const trimmed = spec.trim()\n if (trimmed === '0') {\n fields.push(key)\n } else {\n const parts = trimmed.split('.')\n const fileN = Number.parseInt(parts[0] ?? '', 10)\n const fieldM = Number.parseInt(parts[1] ?? '', 10) - 1\n const src = fileN === 1 ? rest1 : rest2\n if (fieldM >= 0 && fieldM < src.length) fields.push(src[fieldM] ?? '')\n else fields.push('')\n }\n }\n return fields.join(outSep)\n}\n\nfunction firstValue<K, V>(map: Map<K, V>): V | undefined {\n for (const v of map.values()) return v\n return undefined\n}\n\nfunction joinLines(\n lines1: readonly string[],\n lines2: readonly string[],\n field1: number,\n field2: number,\n sep: string | null,\n aFlag: string | null,\n vFlag: string | null,\n eFlag: string | null,\n oFlag: string | null,\n): string[] {\n const map1 = buildJoinMap(lines1, field1, sep)\n const map2 = buildJoinMap(lines2, field2, sep)\n const outSep = sep !== null && sep !== '' ? sep : ' '\n const outLines: string[] = []\n const matchedKeys2 = new Set<string>()\n\n for (const line of lines1) {\n const parts = splitFields(line, sep)\n if (field1 >= parts.length) continue\n const key = parts[field1] ?? ''\n const rest1 = parts.slice(0, field1).concat(parts.slice(field1 + 1))\n const hit = map2.get(key)\n if (hit !== undefined) {\n matchedKeys2.add(key)\n if (vFlag === null) {\n for (const rest2 of hit) {\n outLines.push(formatRow(key, rest1, rest2, oFlag, outSep))\n }\n }\n } else {\n if (vFlag === '1' || aFlag === '1') {\n let placeholder: string[] = []\n if (oFlag !== null && eFlag !== null && map2.size > 0) {\n const sample = firstValue(map2)?.[0]\n if (sample !== undefined) placeholder = sample.map(() => eFlag)\n }\n outLines.push(formatRow(key, rest1, placeholder, oFlag, outSep))\n }\n }\n }\n\n if (aFlag === '2' || vFlag === '2') {\n for (const line of lines2) {\n const parts = splitFields(line, sep)\n if (field2 >= parts.length) continue\n const key = parts[field2] ?? ''\n if (!matchedKeys2.has(key)) {\n const rest2 = parts.slice(0, field2).concat(parts.slice(field2 + 1))\n let placeholder: string[] = []\n if (oFlag !== null && eFlag !== null && map1.size > 0) {\n const sample = firstValue(map1)?.[0]\n if (sample !== undefined) placeholder = sample.map(() => eFlag)\n }\n outLines.push(formatRow(key, placeholder, rest2, oFlag, outSep))\n }\n }\n }\n\n return outLines\n}\n\nasync function joinCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('join: requires two paths\\n') })]\n }\n const p1 = paths[0]\n const p2 = paths[1]\n if (p1 === undefined || p2 === undefined) return [null, new IOResult()]\n const field1 =\n (typeof opts.flags['1'] === 'string' ? Number.parseInt(opts.flags['1'], 10) : 1) - 1\n const field2 =\n (typeof opts.flags['2'] === 'string' ? Number.parseInt(opts.flags['2'], 10) : 1) - 1\n const sep = typeof opts.flags.t === 'string' ? opts.flags.t : null\n const aFlag = typeof opts.flags.a === 'string' ? opts.flags.a : null\n const vFlag = typeof opts.flags.v === 'string' ? opts.flags.v : null\n const eFlag = typeof opts.flags.e === 'string' ? opts.flags.e : null\n const oFlag = typeof opts.flags.o === 'string' ? opts.flags.o : null\n const data1 = DEC.decode(await materialize(redisStream(accessor, p1)))\n const data2 = DEC.decode(await materialize(redisStream(accessor, p2)))\n const lines1 = splitLinesNoTrailing(data1)\n const lines2 = splitLinesNoTrailing(data2)\n const out = joinLines(lines1, lines2, field1, field2, sep, aFlag, vFlag, eFlag, oFlag)\n if (out.length === 0) return [null, new IOResult()]\n const result: ByteSource = ENC.encode(out.join('\\n') + '\\n')\n return [result, new IOResult()]\n}\n\nexport const REDIS_JOIN = command({\n name: 'join',\n resource: ResourceName.REDIS,\n spec: specOf('join'),\n fn: joinCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n Precision,\n ProvisionResult,\n ResourceName,\n command,\n evalJsonlStream,\n isJsonlPath,\n isStreamableJsonlExpr,\n jqEval,\n materialize,\n parseJsonAuto,\n parseJsonPath,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport { stat as redisStat } from '../../../core/redis/stat.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nexport async function jqProvision(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n _opts: CommandOpts,\n): Promise<ProvisionResult> {\n const [first] = paths\n const [expr] = texts\n if (first === undefined || expr === undefined) return new ProvisionResult({ command: 'jq' })\n try {\n const s = await redisStat(accessor, first)\n const fileSize = s.size ?? 0\n if (isJsonlPath(first.original) && isStreamableJsonlExpr(expr)) {\n return new ProvisionResult({\n command: `jq '${expr}' ${first.original}`,\n networkReadLow: 0,\n networkReadHigh: fileSize,\n readOps: 1,\n precision: Precision.RANGE,\n })\n }\n return new ProvisionResult({\n command: `jq '${expr}' ${first.original}`,\n networkReadLow: fileSize,\n networkReadHigh: fileSize,\n readOps: 1,\n precision: Precision.EXACT,\n })\n } catch {\n return new ProvisionResult({ command: 'jq' })\n }\n}\n\nfunction formatResult(result: unknown, raw: boolean, compact: boolean): Uint8Array {\n if (raw && typeof result === 'string') return ENC.encode(result + '\\n')\n const json = compact ? JSON.stringify(result) : JSON.stringify(result, null, 2)\n return ENC.encode(json + '\\n')\n}\n\nfunction formatResults(\n result: unknown,\n raw: boolean,\n compact: boolean,\n spread: boolean,\n): Uint8Array {\n if (spread && Array.isArray(result)) {\n const parts: Uint8Array[] = []\n for (const item of result) parts.push(formatResult(item, raw, compact))\n return concat(parts)\n }\n return formatResult(result, raw, compact)\n}\n\nfunction concat(chunks: Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nasync function readFile(accessor: RedisAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(redisStream(accessor, p))\n}\n\nasync function jqCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const expression = texts[0]\n if (expression === undefined) {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('jq: usage: jq EXPRESSION [path]\\n') }),\n ]\n }\n const raw = opts.flags.r === true\n const compact = opts.flags.c === true\n const slurp = opts.flags.s === true\n\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (isJsonlPath(first.original) && isStreamableJsonlExpr(expression)) {\n return [evalJsonlStream(redisStream(accessor, first), expression), new IOResult()]\n }\n const outputs: Uint8Array[] = []\n for (const p of paths) {\n const bytes = await readFile(accessor, p)\n let data = parseJsonPath(bytes, p.original)\n if (slurp) data = Array.isArray(data) ? data : [data]\n const result = await jqEval(data, expression.trim())\n const spread = expression.includes('[]')\n outputs.push(formatResults(result, raw, compact, spread))\n }\n const out: ByteSource = concat(outputs)\n return [out, new IOResult()]\n }\n\n const bytes = await readStdinAsync(opts.stdin)\n if (bytes === null) return [null, new IOResult()]\n let data = parseJsonAuto(bytes)\n if (slurp && !Array.isArray(data)) data = [data]\n const result = await jqEval(data, expression.trim())\n const spread = expression.includes('[]')\n return [formatResults(result, raw, compact, spread), new IOResult()]\n}\n\nexport const REDIS_JQ = command({\n name: 'jq',\n resource: ResourceName.REDIS,\n spec: specOf('jq'),\n fn: jqCommand,\n provision: jqProvision,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { exists as redisExists } from '../../../core/redis/exists.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function lnCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('ln: usage: ln [-s] [-f] source dest\\n') }),\n ]\n }\n const source = paths[0]\n const dest = paths[1]\n if (source === undefined || dest === undefined) return [null, new IOResult()]\n if (opts.flags.n === true && (await redisExists(accessor, dest))) {\n return [null, new IOResult()]\n }\n const data = await materialize(redisStream(accessor, source))\n await redisWrite(accessor, dest, data)\n const out: ByteSource | null =\n opts.flags.v === true ? ENC.encode(`'${source.original}' -> '${dest.original}'\\n`) : null\n return [out, new IOResult({ writes: { [dest.stripPrefix]: data } })]\n}\n\nexport const REDIS_LN = command({\n name: 'ln',\n resource: ResourceName.REDIS,\n spec: specOf('ln'),\n fn: lnCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm } from './utils.ts'\n\nexport async function exists(accessor: RedisAccessor, path: PathSpec): Promise<boolean> {\n const p = norm(path.stripPrefix)\n const store = accessor.store\n return (await store.hasFile(p)) || (await store.hasDir(p))\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nasync function lookCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (texts.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('look: missing prefix\\n') })]\n }\n const prefix = texts[0] ?? ''\n const caseInsensitive = opts.flags.f === true\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(redisStream(accessor, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('look: missing input\\n') })]\n }\n raw = stdinData\n }\n const lines = splitLinesNoTrailing(DEC.decode(raw))\n const cmpPrefix = caseInsensitive ? prefix.toLowerCase() : prefix\n const matched: string[] = []\n for (const line of lines) {\n const cmpLine = caseInsensitive ? line.toLowerCase() : line\n if (cmpLine.startsWith(cmpPrefix)) matched.push(line)\n }\n if (matched.length === 0) return [null, new IOResult({ exitCode: 1 })]\n const result: ByteSource = ENC.encode(matched.join('\\n') + '\\n')\n return [result, new IOResult()]\n}\n\nexport const REDIS_LOOK = command({\n name: 'look',\n resource: ResourceName.REDIS,\n spec: specOf('look'),\n fn: lookCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { stat as redisStat } from '../../../../core/redis/stat.ts'\nimport { readdir as redisReaddir } from '../../../../core/redis/readdir.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nfunction humanSize(n: number): string {\n const units = ['B', 'K', 'M', 'G', 'T']\n let v = n\n let i = 0\n while (v >= 1024 && i < units.length - 1) {\n v /= 1024\n i += 1\n }\n const s = v >= 10 || i === 0 ? Math.round(v).toString() : v.toFixed(1)\n return `${s}${units[i] ?? ''}`\n}\n\nasync function lsCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const targets: PathSpec[] =\n paths.length > 0\n ? paths\n : [\n new PathSpec({\n original: opts.cwd,\n directory: opts.cwd,\n resolved: false,\n prefix: opts.mountPrefix ?? '',\n }),\n ]\n const long = opts.flags.args_l === true\n const all = opts.flags.a === true || opts.flags.A === true\n const human = opts.flags.h === true\n const reverse = opts.flags.r === true\n const classify = opts.flags.F === true\n const sortBy = opts.flags.t === true ? 'time' : opts.flags.S === true ? 'size' : 'name'\n const warnings: string[] = []\n const lines: string[] = []\n for (const p of targets) {\n let stats\n try {\n const entries = await redisReaddir(accessor, p)\n stats = await Promise.all(\n entries.map((entryPath) =>\n redisStat(\n accessor,\n new PathSpec({\n original: entryPath,\n directory: entryPath,\n resolved: false,\n prefix: p.prefix,\n }),\n ),\n ),\n )\n } catch (err) {\n // not a directory — try treating it as a single entry (matches real `ls foo.txt`)\n try {\n stats = [await redisStat(accessor, p)]\n } catch {\n const msg = err instanceof Error ? err.message : String(err)\n warnings.push(`ls: cannot access '${p.original}': ${msg}`)\n continue\n }\n }\n let filtered = stats\n if (!all) filtered = filtered.filter((s) => !s.name.startsWith('.'))\n filtered.sort((a, b) => {\n if (sortBy === 'time') {\n return (b.modified ?? '').localeCompare(a.modified ?? '')\n }\n if (sortBy === 'size') {\n return (b.size ?? 0) - (a.size ?? 0)\n }\n return a.name.localeCompare(b.name)\n })\n if (reverse) filtered.reverse()\n for (const s of filtered) {\n if (long) {\n const size = human ? humanSize(s.size ?? 0) : String(s.size ?? 0)\n lines.push(`${s.type ?? '-'}\\t${size}\\t${s.modified ?? ''}\\t${s.name}`)\n } else {\n const suffix = classify && s.type === FileType.DIRECTORY ? '/' : ''\n lines.push(`${s.name}${suffix}`)\n }\n }\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n const exitCode = warnings.length > 0 && lines.length === 0 ? 1 : 0\n if (warnings.length > 0) {\n const stderr = new TextEncoder().encode(warnings.join('\\n'))\n return [out, new IOResult({ stderr, exitCode })]\n }\n return [out, new IOResult({ exitCode })]\n}\n\nexport const REDIS_LS = command({\n name: 'ls',\n resource: ResourceName.REDIS,\n spec: specOf('ls'),\n fn: lsCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { type IndexCacheStore, type PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { RedisIndexEntry } from './entry.ts'\nimport { norm } from './utils.ts'\n\nexport async function readdir(\n accessor: RedisAccessor,\n path: PathSpec,\n index?: IndexCacheStore,\n): Promise<string[]> {\n const virtual = path.pattern !== null ? path.directory : path.stripPrefix\n const mountPrefix = path.prefix\n const virtualKey = mountPrefix + virtual\n if (index !== undefined) {\n const cached = await index.listDir(virtualKey)\n if (cached.entries !== undefined && cached.entries !== null) {\n return cached.entries\n }\n }\n const store = accessor.store\n const p = norm(virtual)\n if (!(await store.hasDir(p))) {\n throw new Error(`not a directory: ${p}`)\n }\n const dirPrefix = p === '/' ? '/' : `${p}/`\n const seen = new Set<string>()\n const files = await store.listFiles()\n const dirs = await store.listDirs()\n for (const key of [...files, ...dirs]) {\n if (key === p) continue\n if (!key.startsWith(dirPrefix)) continue\n const remainder = key.slice(dirPrefix.length)\n const first = remainder.split('/')[0]\n if (first !== undefined && first.length > 0) seen.add(dirPrefix + first)\n }\n const sorted = [...seen].sort()\n const virtualEntries = sorted.map((entry) => `${mountPrefix}${entry}`)\n if (index !== undefined) {\n const fileSet = new Set(files)\n const entries: [string, RedisIndexEntry][] = sorted.map((e) => {\n const name = e.slice(e.lastIndexOf('/') + 1)\n return [name, fileSet.has(e) ? RedisIndexEntry.file(e) : RedisIndexEntry.folder(e)]\n })\n await index.setDir(virtualKey, entries)\n }\n return virtualEntries\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { IndexEntry } from '@struktoai/mirage-core'\n\nexport const RedisResourceType = Object.freeze({\n FILE: 'file',\n FOLDER: 'folder',\n} as const)\n\nexport type RedisResourceType = (typeof RedisResourceType)[keyof typeof RedisResourceType]\n\nexport class RedisIndexEntry extends IndexEntry {\n static file(path: string, size = 0): RedisIndexEntry {\n const name = path.slice(path.lastIndexOf('/') + 1)\n return new RedisIndexEntry({\n id: path,\n name,\n resourceType: RedisResourceType.FILE,\n vfsName: name,\n size,\n })\n }\n\n static folder(path: string): RedisIndexEntry {\n const name = path.slice(path.lastIndexOf('/') + 1)\n return new RedisIndexEntry({\n id: path,\n name,\n resourceType: RedisResourceType.FOLDER,\n vfsName: name,\n })\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherLs,\n featherLsFallback,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport { stat as redisStat } from '../../../../core/redis/stat.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function lsFeatherCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n const [first] = paths\n if (first === undefined) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('ls: missing operand\\n') })]\n }\n const stat = await redisStat(accessor, first)\n const meta = { size: stat.size ?? 0, modified: stat.modified, name: stat.name }\n try {\n const raw = await materialize(redisStream(accessor, first))\n const out: ByteSource = featherLs(raw, meta)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch {\n return [featherLsFallback(meta), new IOResult()]\n }\n}\n\nexport const REDIS_LS_FEATHER = [\n ...command({\n name: 'ls',\n resource: ResourceName.REDIS,\n spec: specOf('ls'),\n filetype: '.arrow',\n fn: lsFeatherCommand,\n }),\n ...command({\n name: 'ls',\n resource: ResourceName.REDIS,\n spec: specOf('ls'),\n filetype: '.ipc',\n fn: lsFeatherCommand,\n }),\n ...command({\n name: 'ls',\n resource: ResourceName.REDIS,\n spec: specOf('ls'),\n filetype: '.feather',\n fn: lsFeatherCommand,\n }),\n]\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Ls,\n hdf5LsFallback,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport { stat as redisStat } from '../../../../core/redis/stat.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function lsHdf5Command(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n const [first] = paths\n if (first === undefined) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('ls: missing operand\\n') })]\n }\n const stat = await redisStat(accessor, first)\n const meta = { size: stat.size ?? 0, modified: stat.modified, name: stat.name }\n try {\n const raw = await materialize(redisStream(accessor, first))\n const out: ByteSource = await hdf5Ls(raw, meta)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch {\n return [hdf5LsFallback(meta), new IOResult()]\n }\n}\n\nexport const RAM_LS_HDF5 = [\n ...command({\n name: 'ls',\n resource: ResourceName.REDIS,\n spec: specOf('ls'),\n filetype: '.hdf5',\n fn: lsHdf5Command,\n }),\n ...command({\n name: 'ls',\n resource: ResourceName.REDIS,\n spec: specOf('ls'),\n filetype: '.h5',\n fn: lsHdf5Command,\n }),\n]\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetLs,\n parquetLsFallback,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport { stat as redisStat } from '../../../../core/redis/stat.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function lsParquetCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n const [first] = paths\n if (first === undefined) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('ls: missing operand\\n') })]\n }\n const stat = await redisStat(accessor, first)\n const meta = { size: stat.size ?? 0, modified: stat.modified, name: stat.name }\n try {\n const raw = await materialize(redisStream(accessor, first))\n const out: ByteSource = parquetLs(raw, meta)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch {\n return [parquetLsFallback(meta), new IOResult()]\n }\n}\n\nexport const REDIS_LS_PARQUET = command({\n name: 'ls',\n resource: ResourceName.REDIS,\n spec: specOf('ls'),\n filetype: '.parquet',\n fn: lsParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n md5Hex,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { read as redisRead } from '../../../core/redis/read.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nasync function md5Command(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const lines: string[] = []\n if (paths.length > 0) {\n for (const p of paths) {\n const data = await redisRead(accessor, p)\n lines.push(`${md5Hex(data)} ${p.original}`)\n }\n } else if (opts.stdin !== null) {\n const data = await materialize(opts.stdin)\n lines.push(md5Hex(data))\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const RAM_MD5 = command({\n name: 'md5',\n resource: ResourceName.REDIS,\n spec: specOf('md5'),\n fn: md5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { mkdir as redisMkdir } from '../../../core/redis/mkdir.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nasync function mkdirCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const parents = opts.flags.p === true\n if (paths.length === 0) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('mkdir: missing operand\\n'),\n }),\n ]\n }\n for (const p of paths) {\n await redisMkdir(accessor, p, parents)\n }\n return [null, new IOResult()]\n}\n\nexport const REDIS_MKDIR = command({\n name: 'mkdir',\n resource: ResourceName.REDIS,\n spec: specOf('mkdir'),\n fn: mkdirCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm, nowIso, parent } from './utils.ts'\n\nexport async function mkdir(\n accessor: RedisAccessor,\n path: PathSpec,\n parents = false,\n): Promise<void> {\n const p = norm(path.stripPrefix)\n const store = accessor.store\n if (parents) {\n const parts = p.replace(/^\\/+|\\/+$/g, '').split('/')\n let current = ''\n const now = nowIso()\n for (const part of parts) {\n current += `/${part}`\n await store.addDir(current)\n const mod = await store.getModified(current)\n if (mod === null) {\n await store.setModified(current, now)\n }\n }\n return\n }\n const par = parent(p)\n if (par !== '/' && !(await store.hasDir(par))) {\n throw new Error(`parent directory does not exist: ${par}`)\n }\n await store.addDir(p)\n await store.setModified(p, nowIso())\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { mkdir as redisMkdir } from '../../../core/redis/mkdir.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nfunction randomSuffix(): string {\n const chars = 'abcdefghijklmnopqrstuvwxyz0123456789'\n let out = ''\n for (let i = 0; i < 8; i++) {\n out += chars[Math.floor(Math.random() * chars.length)] ?? ''\n }\n return out\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function mktempCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const tFlag = opts.flags.t === true\n const parent = tFlag ? '/tmp' : typeof opts.flags.p === 'string' ? opts.flags.p : '/tmp'\n const suffix = randomSuffix()\n const templateArg = texts[0]\n const template = templateArg !== undefined && templateArg !== '' ? templateArg : 'tmp.XXXXXXXXXX'\n const xRun = /X+$/.exec(template)\n let name: string\n if (xRun !== null) {\n name = template.slice(0, xRun.index) + suffix\n } else {\n name = `${template}.${suffix}`\n }\n const path = `${parent.replace(/\\/+$/, '')}/${name}`\n await redisMkdir(accessor, makePathSpec(parent), true)\n if (opts.flags.d === true) {\n await redisMkdir(accessor, makePathSpec(path))\n } else {\n await redisWrite(accessor, makePathSpec(path), new Uint8Array(0))\n }\n const result: ByteSource = ENC.encode(path + '\\n')\n return [result, new IOResult()]\n}\n\nexport const REDIS_MKTEMP = command({\n name: 'mktemp',\n resource: ResourceName.REDIS,\n spec: specOf('mktemp'),\n fn: mktempCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { rename as redisRename } from '../../../core/redis/rename.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nasync function mvCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('mv: missing operand\\n'),\n }),\n ]\n }\n const sources = paths.slice(0, -1)\n const dst = paths[paths.length - 1]\n if (dst === undefined) return [null, new IOResult()]\n for (const src of sources) {\n await redisRename(accessor, src, dst)\n }\n return [null, new IOResult()]\n}\n\nexport const REDIS_MV = command({\n name: 'mv',\n resource: ResourceName.REDIS,\n spec: specOf('mv'),\n fn: mvCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm, nowIso } from './utils.ts'\n\nexport async function rename(accessor: RedisAccessor, src: PathSpec, dst: PathSpec): Promise<void> {\n const s = norm(src.stripPrefix)\n const d = norm(dst.stripPrefix)\n const now = nowIso()\n const store = accessor.store\n if (await store.hasFile(s)) {\n const data = await store.getFile(s)\n const mod = await store.getModified(s)\n if (data === null) throw new Error(`file not found: ${s}`)\n await store.delFile(s)\n await store.delModified(s)\n await store.setFile(d, data)\n await store.setModified(d, mod ?? now)\n return\n }\n if (await store.hasDir(s)) {\n const mod = await store.getModified(s)\n await store.removeDir(s)\n await store.delModified(s)\n await store.addDir(d)\n await store.setModified(d, mod ?? now)\n const prefix = s.replace(/\\/+$/, '') + '/'\n const dPrefix = d.replace(/\\/+$/, '') + '/'\n const files = await store.listFiles()\n for (const key of files) {\n if (key.startsWith(prefix)) {\n const newKey = dPrefix + key.slice(prefix.length)\n const data = await store.getFile(key)\n if (data === null) continue\n await store.delFile(key)\n await store.setFile(newKey, data)\n }\n }\n return\n }\n throw new Error(`file not found: ${s}`)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction shouldNumber(line: string, bodyNumbering: string, pattern: RegExp | null): boolean {\n if (bodyNumbering === 'n') return false\n if (bodyNumbering === 'a') return true\n if (bodyNumbering === 'p' && pattern !== null) return pattern.test(line)\n return line.trim() !== ''\n}\n\nfunction padLeft(value: string, width: number): string {\n return value.length >= width ? value : ' '.repeat(width - value.length) + value\n}\n\ninterface NlOptions {\n bodyNumbering: string\n start: number\n increment: number\n width: number\n separator: string\n pattern: RegExp | null\n}\n\nasync function* nlStream(\n source: AsyncIterable<Uint8Array>,\n opts: NlOptions,\n): AsyncIterable<Uint8Array> {\n let num = opts.start\n const iter = new AsyncLineIterator(source)\n for await (const raw of iter) {\n const line = DEC.decode(raw)\n if (shouldNumber(line, opts.bodyNumbering, opts.pattern)) {\n yield ENC.encode(`${padLeft(String(num), opts.width)}${opts.separator}${line}\\n`)\n num += opts.increment\n } else {\n yield ENC.encode(`${' '.repeat(opts.width)}${opts.separator}${line}\\n`)\n }\n }\n}\n\nasync function* nlMulti(\n accessor: RedisAccessor,\n paths: readonly PathSpec[],\n opts: NlOptions,\n): AsyncIterable<Uint8Array> {\n for (const p of paths) {\n for await (const chunk of nlStream(redisStream(accessor, p), opts)) yield chunk\n }\n}\n\nfunction parseOptions(flags: Record<string, string | boolean>): NlOptions {\n const b = typeof flags.b === 'string' ? flags.b : 't'\n let bodyNumbering = b\n let pattern: RegExp | null = null\n if (b.startsWith('p')) {\n bodyNumbering = 'p'\n pattern = new RegExp(b.slice(1))\n }\n const parseIntFlag = (key: 'v' | 'i' | 'w', fallback: number): number =>\n typeof flags[key] === 'string' ? Number.parseInt(flags[key], 10) : fallback\n return {\n bodyNumbering,\n start: parseIntFlag('v', 1),\n increment: parseIntFlag('i', 1),\n width: parseIntFlag('w', 6),\n separator: typeof flags.s === 'string' ? flags.s : '\\t',\n pattern,\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function nlCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nlOpts = parseOptions(opts.flags)\n if (paths.length > 0) {\n return [nlMulti(accessor, paths, nlOpts), new IOResult()]\n }\n try {\n const source = resolveSource(opts.stdin, 'nl: missing operand')\n return [nlStream(source, nlOpts), new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const REDIS_NL = command({\n name: 'nl',\n resource: ResourceName.REDIS,\n spec: specOf('nl'),\n fn: nlCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoEnds(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nasync function pasteCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const delimiter = typeof opts.flags.d === 'string' ? opts.flags.d : '\\t'\n const serial = opts.flags.s === true\n const fileLines: string[][] = []\n let stdinConsumed = false\n for (const p of paths) {\n if (p.original === '-') {\n const raw = stdinConsumed ? null : await readStdinAsync(opts.stdin)\n stdinConsumed = true\n fileLines.push(splitLinesNoEnds(raw !== null ? DEC.decode(raw) : ''))\n } else {\n const data = await materialize(redisStream(accessor, p))\n fileLines.push(splitLinesNoEnds(DEC.decode(data)))\n }\n }\n if (fileLines.length === 0 && !stdinConsumed) {\n const raw = await readStdinAsync(opts.stdin)\n if (raw !== null) fileLines.push(splitLinesNoEnds(DEC.decode(raw)))\n }\n if (fileLines.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('paste: missing operand\\n') })]\n }\n let outLines: string[]\n if (serial) {\n outLines = fileLines.map((lines) => lines.join(delimiter))\n } else {\n const maxLen = Math.max(...fileLines.map((l) => l.length))\n outLines = []\n for (let i = 0; i < maxLen; i++) {\n outLines.push(fileLines.map((lines) => lines[i] ?? '').join(delimiter))\n }\n }\n const out: ByteSource = ENC.encode(outLines.join('\\n') + '\\n')\n return [out, new IOResult()]\n}\n\nexport const REDIS_PASTE = command({\n name: 'paste',\n resource: ResourceName.REDIS,\n spec: specOf('paste'),\n fn: pasteCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\ntype Hunk = [number, string[]]\n\nfunction stripPath(path: string, stripCount: number): string {\n const parts = path.split('/')\n if (stripCount < parts.length) return parts.slice(stripCount).join('/')\n return parts[parts.length - 1] ?? ''\n}\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nfunction applyHunks(\n originalLines: readonly string[],\n hunks: readonly Hunk[],\n forwardOnly: boolean,\n): string[] {\n // Walk through each hunk in order, tracking the output position as we go.\n // Each hunk's leading context copies lines verbatim from the original;\n // `-` drops a source line; `+` inserts; trailing context copies too.\n const result: string[] = []\n let srcIdx = 0\n for (const [startLine, hunkLines] of hunks) {\n const hunkStart = startLine - 1\n while (srcIdx < hunkStart && srcIdx < originalLines.length) {\n result.push(originalLines[srcIdx] ?? '')\n srcIdx += 1\n }\n if (forwardOnly) {\n const expected: string[] = []\n for (const hl of hunkLines) {\n if (hl.startsWith(' ') || hl.startsWith('-')) expected.push(hl.slice(1))\n }\n const actual = originalLines.slice(srcIdx, srcIdx + expected.length)\n let mismatch = expected.length !== actual.length\n if (!mismatch) {\n for (let i = 0; i < expected.length; i++) {\n if (expected[i] !== actual[i]) {\n mismatch = true\n break\n }\n }\n }\n if (mismatch) {\n // Skip this hunk, copy the lines it expected verbatim\n for (const _ of expected) {\n void _\n if (srcIdx < originalLines.length) {\n result.push(originalLines[srcIdx] ?? '')\n srcIdx += 1\n }\n }\n continue\n }\n }\n for (const hl of hunkLines) {\n if (hl.startsWith(' ')) {\n result.push(hl.slice(1))\n srcIdx += 1\n } else if (hl.startsWith('-')) {\n srcIdx += 1\n } else if (hl.startsWith('+')) {\n result.push(hl.slice(1))\n }\n }\n }\n while (srcIdx < originalLines.length) {\n result.push(originalLines[srcIdx] ?? '')\n srcIdx += 1\n }\n return result\n}\n\nfunction parsePatch(patchText: string, stripCount: number): Map<string, Hunk[]> {\n const files = new Map<string, Hunk[]>()\n let currentFile: string | null = null\n let currentHunks: Hunk[] = []\n let currentHunkLines: string[] = []\n let currentStart = 0\n\n for (const line of patchText.split('\\n')) {\n if (line.startsWith('--- ')) continue\n if (line.startsWith('+++ ')) {\n if (currentFile !== null && currentHunkLines.length > 0) {\n currentHunks.push([currentStart, currentHunkLines])\n }\n if (currentFile !== null) files.set(currentFile, currentHunks)\n const rawPath = (line.slice(4).split('\\t')[0] ?? '').trim()\n currentFile = '/' + stripPath(rawPath, stripCount).replace(/^\\/+/, '')\n currentHunks = []\n currentHunkLines = []\n continue\n }\n const m = /^@@ -(\\d+)/.exec(line)\n if (m !== null) {\n if (currentHunkLines.length > 0) {\n currentHunks.push([currentStart, currentHunkLines])\n }\n currentStart = Number.parseInt(m[1] ?? '0', 10)\n currentHunkLines = []\n continue\n }\n if (\n currentFile !== null &&\n (line.startsWith('+') || line.startsWith('-') || line.startsWith(' '))\n ) {\n currentHunkLines.push(line)\n }\n }\n\n if (currentFile !== null && currentHunkLines.length > 0) {\n currentHunks.push([currentStart, currentHunkLines])\n }\n if (currentFile !== null) files.set(currentFile, currentHunks)\n\n return files\n}\n\nasync function patchCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const stripCount = typeof opts.flags.p === 'string' ? Number.parseInt(opts.flags.p, 10) : 0\n const reverseMode = opts.flags.R === true\n const forwardOnly = opts.flags.N === true\n const iFlag = typeof opts.flags.i === 'string' ? opts.flags.i : null\n const mountPrefix = opts.mountPrefix ?? ''\n const stripMount = (p: string): string =>\n mountPrefix !== '' && p.startsWith(mountPrefix + '/')\n ? p.slice(mountPrefix.length)\n : p === mountPrefix\n ? '/'\n : p\n let patchData: Uint8Array | null = null\n if (iFlag !== null) {\n const resolved = stripMount(iFlag)\n const spec = new PathSpec({\n original: resolved,\n directory: resolved,\n resolved: true,\n prefix: mountPrefix,\n })\n patchData = await materialize(redisStream(accessor, spec))\n } else if (paths.length > 0) {\n const first = paths[0]\n if (first !== undefined) patchData = await materialize(redisStream(accessor, first))\n } else {\n patchData = await readStdinAsync(opts.stdin)\n }\n if (patchData === null || patchData.byteLength === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('patch: missing input\\n') })]\n }\n\n const patchText = DEC.decode(patchData)\n const fileHunks = parsePatch(patchText, stripCount)\n const writes: Record<string, Uint8Array> = {}\n\n for (const [filePath, hunks] of fileHunks) {\n let original = ''\n try {\n const spec = new PathSpec({ original: filePath, directory: filePath, resolved: true })\n original = DEC.decode(await materialize(redisStream(accessor, spec)))\n } catch (err) {\n if (!(err instanceof Error) || !/not found/i.test(err.message)) throw err\n }\n const originalLines = splitLinesNoTrailing(original)\n\n let effective = hunks\n if (reverseMode) {\n const reversed: Hunk[] = []\n for (const [start, hunkLines] of hunks) {\n const reversedLines: string[] = []\n for (const hl of hunkLines) {\n if (hl.startsWith('+')) reversedLines.push('-' + hl.slice(1))\n else if (hl.startsWith('-')) reversedLines.push('+' + hl.slice(1))\n else reversedLines.push(hl)\n }\n reversed.push([start, reversedLines])\n }\n effective = reversed\n }\n\n const patched = applyHunks(originalLines, effective, forwardOnly)\n const patchedData = ENC.encode(patched.join('\\n') + '\\n')\n await redisWrite(accessor, makePathSpec(filePath), patchedData)\n writes[filePath] = patchedData\n }\n\n return [null, new IOResult({ writes })]\n}\n\nexport const REDIS_PATCH = command({\n name: 'patch',\n resource: ResourceName.REDIS,\n spec: specOf('patch'),\n fn: patchCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type Accessor,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\n\nconst ENC = new TextEncoder()\n\nfunction normPath(p: string): string {\n const parts = p.split('/')\n const out: string[] = []\n for (const seg of parts) {\n if (seg === '' || seg === '.') continue\n if (seg === '..') {\n if (out.length > 0) out.pop()\n continue\n }\n out.push(seg)\n }\n const leading = p.startsWith('/') ? '/' : ''\n return leading + out.join('/') || (leading !== '' ? '/' : '.')\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function readlinkCommand(\n _accessor: Accessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('readlink: missing operand\\n') })]\n }\n const normalize = opts.flags.f === true || opts.flags.e === true || opts.flags.m === true\n const noNewline = opts.flags.n === true\n const results: string[] = []\n for (const p of paths) {\n let vp = p.prefix !== '' ? p.prefix + '/' + p.original.replace(/^\\/+/, '') : p.original\n if (normalize) vp = normPath(vp)\n results.push(vp)\n }\n let text = results.join('\\n')\n if (!noNewline) text += '\\n'\n const out: ByteSource = ENC.encode(text)\n return [out, new IOResult()]\n}\n\nexport const REDIS_READLINK = command({\n name: 'readlink',\n resource: ResourceName.REDIS,\n spec: specOf('readlink'),\n fn: readlinkCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type Accessor,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\n\nfunction normalize(p: string, cwd: string): string {\n const path = p.startsWith('/') ? p : `${cwd.replace(/\\/+$/, '')}/${p}`\n const parts = path.split('/').filter((s) => s !== '' && s !== '.')\n const out: string[] = []\n for (const part of parts) {\n if (part === '..') out.pop()\n else out.push(part)\n }\n return '/' + out.join('/')\n}\n\nfunction realpathCommand(\n _accessor: Accessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): CommandFnResult {\n const args = paths.length > 0 ? paths.map((p) => p.original) : texts\n const lines = args.map((a) => normalize(a, opts.cwd))\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n') + '\\n')\n return [out, new IOResult()]\n}\n\nexport const REDIS_REALPATH = command({\n name: 'realpath',\n resource: ResourceName.REDIS,\n spec: specOf('realpath'),\n fn: realpathCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction reverseString(s: string): string {\n return Array.from(s).reverse().join('')\n}\n\nasync function* revStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n const iter = new AsyncLineIterator(source)\n for await (const line of iter) {\n yield ENC.encode(reverseString(DEC.decode(line)) + '\\n')\n }\n}\n\nasync function* revMulti(\n accessor: RedisAccessor,\n paths: readonly PathSpec[],\n): AsyncIterable<Uint8Array> {\n for (const p of paths) {\n for await (const chunk of revStream(redisStream(accessor, p))) yield chunk\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function revCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length > 0) {\n return [revMulti(accessor, paths), new IOResult()]\n }\n try {\n const source = resolveSource(opts.stdin, 'rev: missing operand')\n return [revStream(source), new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const REDIS_REV = command({\n name: 'rev',\n resource: ResourceName.REDIS,\n spec: specOf('rev'),\n fn: revCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n PathSpec,\n ResourceName,\n command,\n compilePattern,\n exitOnEmpty,\n grepStream,\n materialize,\n resolveSource,\n rgFolderFiletype,\n rgFull,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type FileStat,\n} from '@struktoai/mirage-core'\nimport { readdir as redisReaddir } from '../../../core/redis/readdir.ts'\nimport { stat as redisStat } from '../../../core/redis/stat.ts'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport { find as redisFind } from '../../../core/redis/find.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\nimport { grepImpl } from './grep/grep.ts'\n\nconst ENC = new TextEncoder()\n\ninterface RgFlags {\n ignoreCase: boolean\n invert: boolean\n lineNumbers: boolean\n countOnly: boolean\n filesOnly: boolean\n wholeWord: boolean\n fixedString: boolean\n onlyMatching: boolean\n maxCount: number | null\n afterContext: number\n beforeContext: number\n fileType: string | null\n globPattern: string | null\n hidden: boolean\n}\n\nfunction parseRgFlags(flags: Record<string, string | boolean>): RgFlags {\n const toInt = (v: string | boolean | undefined): number | null =>\n typeof v === 'string' ? Number.parseInt(v, 10) : null\n const a = toInt(flags.A)\n const b = toInt(flags.B)\n const c = toInt(flags.C)\n return {\n ignoreCase: flags.i === true,\n invert: flags.v === true,\n lineNumbers: flags.n === true,\n countOnly: flags.c === true,\n filesOnly: flags.args_l === true,\n wholeWord: flags.w === true,\n fixedString: flags.F === true,\n onlyMatching: flags.o === true,\n maxCount: toInt(flags.m),\n afterContext: a ?? c ?? 0,\n beforeContext: b ?? c ?? 0,\n fileType: typeof flags.type === 'string' ? flags.type : null,\n globPattern: typeof flags.glob === 'string' ? flags.glob : null,\n hidden: flags.hidden === true,\n }\n}\n\nasync function rgCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const [exprText] = texts\n if (exprText === undefined) {\n return [\n null,\n new IOResult({ exitCode: 2, stderr: ENC.encode('rg: usage: rg [flags] pattern [path]\\n') }),\n ]\n }\n const flags = parseRgFlags(opts.flags)\n const [first] = paths\n\n if (first === undefined) {\n // stdin mode\n const source = resolveSource(opts.stdin, 'rg: usage: rg [flags] pattern [path]')\n const pat = compilePattern(exprText, flags.ignoreCase, flags.fixedString, flags.wholeWord)\n const stream = grepStream(source, pat, {\n invert: flags.invert,\n lineNumbers: flags.lineNumbers,\n countOnly: flags.countOnly,\n onlyMatching: flags.onlyMatching,\n maxCount: flags.maxCount,\n afterContext: flags.afterContext,\n beforeContext: flags.beforeContext,\n })\n const io = new IOResult()\n return [exitOnEmpty(stream, io), io]\n }\n\n // Detect directory vs file\n let isDir = false\n try {\n const s = await redisStat(accessor, first)\n isDir = s.type === FileType.DIRECTORY\n } catch {\n try {\n await redisReaddir(accessor, first)\n isDir = true\n } catch {\n // not readable\n }\n }\n\n if (isDir && opts.filetypeFns !== null && Object.keys(opts.filetypeFns).length > 0) {\n // Directory recursion with filetype-specific extraction\n const readdirFn = async (p: string): Promise<string[]> => {\n const keys = await redisFind(accessor, makeSpec(p, first), { type: null })\n return keys\n }\n const statFn = (p: string): Promise<FileStat> => redisStat(accessor, makeSpec(p, first))\n const readBytesFn = (p: string): Promise<Uint8Array> =>\n materialize(redisStream(accessor, makeSpec(p, first)))\n const warnings: string[] = []\n const results = await rgFolderFiletype(\n readdirFn,\n statFn,\n readBytesFn,\n first.original,\n exprText,\n {},\n {\n ignoreCase: flags.ignoreCase,\n invert: flags.invert,\n lineNumbers: flags.lineNumbers,\n countOnly: flags.countOnly,\n filesOnly: flags.filesOnly,\n onlyMatching: flags.onlyMatching,\n maxCount: flags.maxCount,\n fixedString: flags.fixedString,\n wholeWord: flags.wholeWord,\n fileType: flags.fileType,\n globPattern: flags.globPattern,\n hidden: flags.hidden,\n },\n warnings,\n )\n const stderr = warnings.length > 0 ? ENC.encode(warnings.join('\\n')) : undefined\n if (results.length === 0) {\n const io = new IOResult({ exitCode: 1, ...(stderr !== undefined ? { stderr } : {}) })\n return [new Uint8Array(0), io]\n }\n const out: ByteSource = ENC.encode(results.join('\\n'))\n const io = new IOResult(stderr !== undefined ? { stderr } : {})\n return [out, io]\n }\n\n const needsFull =\n flags.filesOnly ||\n flags.beforeContext > 0 ||\n flags.afterContext > 0 ||\n flags.fileType !== null ||\n flags.globPattern !== null\n if (needsFull) {\n const readdirFn = async (p: string): Promise<string[]> => {\n const keys = await redisFind(accessor, makeSpec(p, first), { type: null })\n return keys\n }\n const statFn = (p: string): Promise<FileStat> => redisStat(accessor, makeSpec(p, first))\n const readBytesFn = (p: string): Promise<Uint8Array> =>\n materialize(redisStream(accessor, makeSpec(p, first)))\n const warnings: string[] = []\n const results = await rgFull(\n readdirFn,\n statFn,\n readBytesFn,\n first.original,\n exprText,\n {\n ignoreCase: flags.ignoreCase,\n invert: flags.invert,\n lineNumbers: flags.lineNumbers,\n countOnly: flags.countOnly,\n filesOnly: flags.filesOnly,\n fixedString: flags.fixedString,\n onlyMatching: flags.onlyMatching,\n maxCount: flags.maxCount,\n wholeWord: flags.wholeWord,\n contextBefore: flags.beforeContext,\n contextAfter: flags.afterContext,\n fileType: flags.fileType,\n globPattern: flags.globPattern,\n hidden: flags.hidden,\n },\n warnings,\n )\n const stderr = warnings.length > 0 ? ENC.encode(warnings.join('\\n')) : undefined\n if (results.length === 0) {\n const io = new IOResult({ exitCode: 1, ...(stderr !== undefined ? { stderr } : {}) })\n return [new Uint8Array(0), io]\n }\n const out: ByteSource = ENC.encode(results.join('\\n'))\n const io = new IOResult(stderr !== undefined ? { stderr } : {})\n return [out, io]\n }\n\n // Fall back to single-file grep semantics for plain file mode.\n return grepImpl('rg', accessor, paths, texts, opts)\n}\n\nfunction makeSpec(path: string, template: PathSpec): PathSpec {\n // Reuse prefix from the first scope so downstream fs helpers treat the\n // absolute path as a normal mount-relative path.\n return new PathSpec({\n original: path,\n directory: path,\n resolved: false,\n prefix: template.prefix,\n })\n}\n\nexport const REDIS_RG = command({\n name: 'rg',\n resource: ResourceName.REDIS,\n spec: specOf('rg'),\n fn: rgCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { rmdir as redisRmdir } from '../../../core/redis/rmdir.ts'\nimport { stat as redisStat } from '../../../core/redis/stat.ts'\nimport { unlink as redisUnlink } from '../../../core/redis/unlink.ts'\nimport { rmR as redisRmR } from '../../../core/redis/rm.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nasync function rmCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('rm: missing operand\\n'),\n }),\n ]\n }\n const recursive = opts.flags.r === true || opts.flags.R === true\n for (const p of paths) {\n let isDir = false\n try {\n const st = await redisStat(accessor, p)\n isDir = st.type === FileType.DIRECTORY\n } catch {\n isDir = false\n }\n if (isDir) {\n if (recursive) {\n await redisRmR(accessor, p)\n } else {\n await redisRmdir(accessor, p)\n }\n } else {\n await redisUnlink(accessor, p)\n }\n }\n return [null, new IOResult()]\n}\n\nexport const REDIS_RM = command({\n name: 'rm',\n resource: ResourceName.REDIS,\n spec: specOf('rm'),\n fn: rmCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm } from './utils.ts'\n\nexport async function rmdir(accessor: RedisAccessor, path: PathSpec): Promise<void> {\n const p = norm(path.stripPrefix)\n const store = accessor.store\n if (!(await store.hasDir(p))) {\n throw new Error(`not a directory: ${p}`)\n }\n const prefix = p.replace(/\\/+$/, '') + '/'\n const files = await store.listFiles()\n const dirs = await store.listDirs()\n const candidates = [...files, ...dirs]\n for (const k of candidates) {\n if (k !== p && k.startsWith(prefix)) {\n throw new Error(`directory not empty: ${p}`)\n }\n }\n await store.removeDir(p)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm } from './utils.ts'\n\nexport async function rmR(accessor: RedisAccessor, path: PathSpec): Promise<void> {\n const p = norm(path.stripPrefix)\n const store = accessor.store\n const prefix = p.replace(/\\/+$/, '') + '/'\n const files = await store.listFiles()\n for (const key of files) {\n if (key === p || key.startsWith(prefix)) {\n await store.delFile(key)\n await store.delModified(key)\n }\n }\n const dirs = await store.listDirs()\n for (const key of dirs) {\n if (key === p || key.startsWith(prefix)) {\n await store.removeDir(key)\n await store.delModified(key)\n }\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n executeProgram,\n materialize,\n parseOneCommand,\n parseProgram,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type SedCommand,\n} from '@struktoai/mirage-core'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nasync function readFile(accessor: RedisAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(redisStream(accessor, p))\n}\n\nasync function sedCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const script = texts[0]\n if (script === undefined) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('sed: missing script\\n') })]\n }\n const suppress = opts.flags.n === true\n const inPlace = opts.flags.i === true\n let commands: SedCommand[]\n try {\n if (script.includes(';') || script.includes('{')) {\n commands = parseProgram(script)\n } else {\n commands = [parseOneCommand(script)[0]]\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const first = commands[0]\n const isSimpleSub =\n commands.length === 1 &&\n first?.cmd === 's' &&\n (first.addrStart === null || first.addrStart === undefined) &&\n !suppress\n\n if (paths.length > 0) {\n if (isSimpleSub) {\n const pat = first.pattern ?? ''\n const repl = first.replacement ?? ''\n const ef = first.exprFlags ?? ''\n const ignoreCase = ef.includes('i')\n const global = ef.includes('g')\n const flags = (ignoreCase ? 'i' : '') + (global ? 'g' : '')\n if (inPlace) {\n const writes: Record<string, Uint8Array> = {}\n for (const p of paths) {\n const data = await readFile(accessor, p)\n const text = DEC.decode(data)\n const newText = text.replace(new RegExp(pat, flags), repl)\n const newData = ENC.encode(newText)\n await redisWrite(accessor, p, newData)\n writes[p.stripPrefix] = newData\n }\n return [null, new IOResult({ writes, cache: paths.map((p) => p.stripPrefix) })]\n }\n const outputs: string[] = []\n for (const p of paths) {\n const data = await readFile(accessor, p)\n const text = DEC.decode(data)\n outputs.push(text.replace(new RegExp(pat, flags), repl))\n }\n const out: ByteSource = ENC.encode(outputs.join(''))\n return [out, new IOResult({ cache: paths.map((p) => p.stripPrefix) })]\n }\n\n const modifying = inPlace && commands.some((c) => c.cmd === 's' || c.cmd === 'd')\n const allOutputs: string[] = []\n const writes: Record<string, Uint8Array> = {}\n for (const p of paths) {\n const data = await readFile(accessor, p)\n const text = DEC.decode(data)\n const result = executeProgram(text, commands, suppress)\n if (modifying) {\n const newData = ENC.encode(result)\n await redisWrite(accessor, p, newData)\n writes[p.stripPrefix] = newData\n } else {\n allOutputs.push(result)\n }\n }\n if (modifying) {\n return [null, new IOResult({ writes, cache: paths.map((p) => p.stripPrefix) })]\n }\n const out: ByteSource = ENC.encode(allOutputs.join('\\n'))\n return [out, new IOResult()]\n }\n\n const raw = await readStdinAsync(opts.stdin)\n if (raw === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('sed: missing operand\\n') })]\n }\n const text = DEC.decode(raw)\n const result = executeProgram(text, commands, suppress)\n return [ENC.encode(result), new IOResult()]\n}\n\nexport const REDIS_SED = command({\n name: 'sed',\n resource: ResourceName.REDIS,\n spec: specOf('sed'),\n fn: sedCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n resolveSource,\n sha256Hex,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nasync function hashStream(source: AsyncIterable<Uint8Array>): Promise<string> {\n const data = await materialize(source)\n return sha256Hex(data)\n}\n\nasync function* sha256SingleStream(\n source: AsyncIterable<Uint8Array>,\n label: string,\n): AsyncIterable<Uint8Array> {\n const digest = await hashStream(source)\n yield ENC.encode(`${digest} ${label}\\n`)\n}\n\nasync function* sha256Multi(\n accessor: RedisAccessor,\n paths: readonly PathSpec[],\n): AsyncIterable<Uint8Array> {\n for (const p of paths) {\n const digest = await hashStream(redisStream(accessor, p))\n yield ENC.encode(`${digest} ${p.stripPrefix}\\n`)\n }\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function sha256Check(accessor: RedisAccessor, p: PathSpec): Promise<[Uint8Array, number]> {\n const data = DEC.decode(await materialize(redisStream(accessor, p)))\n const lines: string[] = []\n let failed = false\n for (const line of data.split('\\n')) {\n if (line.trim() === '') continue\n const idx = line.indexOf(' ')\n if (idx < 0) continue\n const expected = line.slice(0, idx)\n const filename = line.slice(idx + 2)\n const digest = await hashStream(redisStream(accessor, makePathSpec(filename)))\n if (digest === expected) lines.push(`${filename}: OK`)\n else {\n lines.push(`${filename}: FAILED`)\n failed = true\n }\n }\n return [ENC.encode(lines.join('\\n') + '\\n'), failed ? 1 : 0]\n}\n\nasync function sha256sumCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const check = opts.flags.c === true\n if (check && paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const [out, exitCode] = await sha256Check(accessor, first)\n const result: ByteSource = out\n return [result, new IOResult({ exitCode })]\n }\n if (paths.length > 0) {\n return [sha256Multi(accessor, paths), new IOResult({ cache: paths.map((p) => p.stripPrefix) })]\n }\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, 'sha256sum: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n return [sha256SingleStream(source, '-'), new IOResult()]\n}\n\nexport const RAM_SHA256SUM = command({\n name: 'sha256sum',\n resource: ResourceName.REDIS,\n spec: specOf('sha256sum'),\n fn: sha256sumCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction shuffleInPlace(arr: string[]): void {\n for (let i = arr.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1))\n const tmp = arr[i] ?? ''\n arr[i] = arr[j] ?? ''\n arr[j] = tmp\n }\n}\n\nfunction choicesWithReplacement(items: readonly string[], k: number): string[] {\n if (items.length === 0) return []\n const out: string[] = []\n for (let i = 0; i < k; i++) {\n out.push(items[Math.floor(Math.random() * items.length)] ?? '')\n }\n return out\n}\n\nasync function shufCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nFlag = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : null\n const echoMode = opts.flags.e === true\n const zeroSep = opts.flags.z === true\n const repeat = opts.flags.r === true\n const sep = zeroSep ? '\\x00' : '\\n'\n\n const processItems = (items: string[]): string[] => {\n if (repeat) {\n const count = nFlag ?? items.length\n return choicesWithReplacement(items, count)\n }\n shuffleInPlace(items)\n if (nFlag !== null) return items.slice(0, nFlag)\n return items\n }\n\n if (echoMode) {\n const base = paths.length > 0 ? paths.map((p) => p.stripPrefix) : [...texts]\n const out = processItems(base)\n const result: ByteSource = ENC.encode(out.join(sep) + sep)\n return [result, new IOResult()]\n }\n\n if (paths.length > 0) {\n const allLines: string[] = []\n for (const p of paths) {\n const data = DEC.decode(await materialize(redisStream(accessor, p)))\n if (zeroSep) for (const l of data.split('\\x00')) allLines.push(l)\n else for (const l of splitLinesNoTrailing(data)) allLines.push(l)\n }\n const out = processItems(allLines)\n const result: ByteSource = ENC.encode(out.join(sep) + sep)\n return [result, new IOResult()]\n }\n\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('shuf: missing operand\\n') })]\n }\n const text = DEC.decode(stdinData)\n const lines = zeroSep ? text.split('\\x00') : splitLinesNoTrailing(text)\n const out = processItems(lines)\n const result: ByteSource = ENC.encode(out.join(sep) + sep)\n return [result, new IOResult()]\n}\n\nexport const REDIS_SHUF = command({\n name: 'shuf',\n resource: ResourceName.REDIS,\n spec: specOf('shuf'),\n fn: shufCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n compareKeys,\n materialize,\n readStdinAsync,\n sortKey,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type SortKeyOptions,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction parseKeyOptions(flags: Record<string, string | boolean>): SortKeyOptions {\n return {\n keyField: typeof flags.k === 'string' ? Number.parseInt(flags.k, 10) : null,\n fieldSep: typeof flags.t === 'string' ? flags.t : null,\n ignoreCase: flags.f === true,\n numeric: flags.n === true,\n humanNumeric: flags.h === true,\n version: flags.V === true,\n month: flags.M === true,\n }\n}\n\nfunction sortAndDedupe(\n lines: string[],\n opts: SortKeyOptions,\n reverse: boolean,\n unique: boolean,\n): string[] {\n const keyed = lines.map((l) => ({ l, k: sortKey(l, opts) }))\n keyed.sort((a, b) => compareKeys(a.k, b.k))\n let sorted = keyed.map((x) => x.l)\n if (reverse) sorted.reverse()\n if (unique) {\n const seen = new Set<string>()\n sorted = sorted.filter((l) => {\n if (seen.has(l)) return false\n seen.add(l)\n return true\n })\n }\n return sorted\n}\n\nfunction splitLinesNoEnds(text: string): string[] {\n if (text === '') return []\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped.split('\\n')\n}\n\nasync function readFile(accessor: RedisAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(redisStream(accessor, p))\n}\n\nasync function sortCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const keyOpts = parseKeyOptions(opts.flags)\n const reverse = opts.flags.r === true\n const unique = opts.flags.u === true\n let allLines: string[] = []\n if (paths.length > 0) {\n for (const p of paths) {\n const data = DEC.decode(await readFile(accessor, p))\n allLines = allLines.concat(splitLinesNoEnds(data))\n }\n } else {\n const raw = await readStdinAsync(opts.stdin)\n if (raw === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('sort: missing operand\\n') })]\n }\n allLines = splitLinesNoEnds(DEC.decode(raw))\n }\n const sorted = sortAndDedupe(allLines, keyOpts, reverse, unique)\n const output = sorted.join('\\n')\n const out: ByteSource = output === '' ? new Uint8Array(0) : ENC.encode(output + '\\n')\n return [out, new IOResult()]\n}\n\nexport const REDIS_SORT = command({\n name: 'sort',\n resource: ResourceName.REDIS,\n spec: specOf('sort'),\n fn: sortCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n PathSpec,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nfunction alphaSuffix(index: number, length: number): string {\n const chars: string[] = []\n let n = index\n for (let i = 0; i < length; i++) {\n chars.push(String.fromCharCode('a'.charCodeAt(0) + (n % 26)))\n n = Math.floor(n / 26)\n }\n return chars.reverse().join('')\n}\n\nfunction numericSuffix(index: number, length: number): string {\n const s = String(index)\n return s.length >= length ? s : '0'.repeat(length - s.length) + s\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function splitCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const prefixPath = paths.length >= 2 && paths[1] !== undefined ? paths[1].stripPrefix : 'x'\n const linesFlag = typeof opts.flags.l === 'string' ? opts.flags.l : null\n const bFlag = typeof opts.flags.b === 'string' ? opts.flags.b : null\n const nFlag = typeof opts.flags.n === 'string' ? opts.flags.n : null\n const aFlag = typeof opts.flags.a === 'string' ? opts.flags.a : null\n const dFlag = opts.flags.d === true\n const linesPerFile =\n linesFlag !== null\n ? Number.parseInt(linesFlag, 10)\n : bFlag === null && nFlag === null\n ? 1000\n : 0\n const byteLimit = bFlag !== null ? Number.parseInt(bFlag, 10) : 0\n const nChunks = nFlag !== null ? Number.parseInt(nFlag, 10) : 0\n const suffixLen = aFlag !== null ? Number.parseInt(aFlag, 10) : 2\n const suffixFn = dFlag ? numericSuffix : alphaSuffix\n\n let source: AsyncIterable<Uint8Array>\n const first = paths[0]\n if (first !== undefined) {\n source = redisStream(accessor, first)\n } else {\n try {\n source = resolveSource(opts.stdin, 'split: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n\n const writes: Record<string, Uint8Array> = {}\n let fileIdx = 0\n\n if (nChunks > 0) {\n const chunks: Uint8Array[] = []\n let total = 0\n for await (const c of source) {\n chunks.push(c)\n total += c.byteLength\n }\n const allData = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n allData.set(c, offset)\n offset += c.byteLength\n }\n const chunkSize = Math.max(1, Math.ceil(total / nChunks))\n offset = 0\n for (let i = 0; i < nChunks; i++) {\n const part = allData.slice(offset, offset + chunkSize)\n if (part.byteLength === 0) break\n const outPath = prefixPath + suffixFn(i, suffixLen)\n await redisWrite(accessor, makePathSpec(outPath), part)\n writes[outPath] = part\n offset += chunkSize\n }\n } else if (byteLimit > 0) {\n let buf = new Uint8Array(0)\n for await (const c of source) {\n const merged = new Uint8Array(buf.byteLength + c.byteLength)\n merged.set(buf, 0)\n merged.set(c, buf.byteLength)\n buf = merged\n while (buf.byteLength >= byteLimit) {\n const outPath = prefixPath + suffixFn(fileIdx, suffixLen)\n const data = buf.slice(0, byteLimit)\n await redisWrite(accessor, makePathSpec(outPath), data)\n writes[outPath] = data\n buf = buf.slice(byteLimit)\n fileIdx += 1\n }\n }\n if (buf.byteLength > 0) {\n const outPath = prefixPath + suffixFn(fileIdx, suffixLen)\n await redisWrite(accessor, makePathSpec(outPath), buf)\n writes[outPath] = buf\n }\n } else {\n const lineBuf: Uint8Array[] = []\n const iter = new AsyncLineIterator(source)\n for await (const line of iter) {\n lineBuf.push(line)\n if (lineBuf.length >= linesPerFile) {\n const outPath = prefixPath + suffixFn(fileIdx, suffixLen)\n const data = joinLines(lineBuf)\n await redisWrite(accessor, makePathSpec(outPath), data)\n writes[outPath] = data\n lineBuf.length = 0\n fileIdx += 1\n }\n }\n if (lineBuf.length > 0) {\n const outPath = prefixPath + suffixFn(fileIdx, suffixLen)\n const data = joinLines(lineBuf)\n await redisWrite(accessor, makePathSpec(outPath), data)\n writes[outPath] = data\n }\n }\n return [null, new IOResult({ writes })]\n}\n\nfunction joinLines(lines: readonly Uint8Array[]): Uint8Array {\n let total = 0\n for (const l of lines) total += l.byteLength + 1\n const out = new Uint8Array(total)\n let offset = 0\n for (const l of lines) {\n out.set(l, offset)\n offset += l.byteLength\n out[offset] = 0x0a\n offset += 1\n }\n return out\n}\n\nexport const REDIS_SPLIT = command({\n name: 'split',\n resource: ResourceName.REDIS,\n spec: specOf('split'),\n fn: splitCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n ProvisionResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type FileStat,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stat as redisStat } from '../../../../core/redis/stat.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst TYPE_LABELS: Record<string, string> = {\n [FileType.DIRECTORY]: 'directory',\n [FileType.TEXT]: 'regular file',\n [FileType.BINARY]: 'regular file',\n [FileType.JSON]: 'regular file',\n [FileType.CSV]: 'regular file',\n}\n\nfunction formatStat(fmt: string, s: FileStat): string {\n return fmt.replace(/%(.)/g, (_, spec: string) => {\n if (spec === 'n') return s.name\n if (spec === 's') return String(s.size ?? 0)\n if (spec === 'F') return s.type ? (TYPE_LABELS[s.type] ?? 'regular file') : 'regular file'\n if (spec === 'y') return s.modified ?? ''\n return '?'\n })\n}\n\nexport function statProvision(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): ProvisionResult {\n const [first] = paths\n return new ProvisionResult({\n command: first !== undefined ? `stat ${first.original}` : 'stat',\n })\n}\n\nasync function statCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('stat: missing operand\\n'),\n }),\n ]\n }\n const fmt =\n typeof opts.flags.c === 'string'\n ? opts.flags.c\n : typeof opts.flags.f === 'string'\n ? opts.flags.f\n : null\n const lines: string[] = []\n for (const p of paths) {\n const s = await redisStat(accessor, p)\n if (fmt !== null) {\n lines.push(formatStat(fmt, s))\n } else {\n const sizeStr = s.size === null ? 'None' : String(s.size)\n const modStr = s.modified ?? 'None'\n const typeStr = s.type ?? 'None'\n lines.push(`name=${s.name} size=${sizeStr} modified=${modStr} type=${typeStr}`)\n }\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const REDIS_STAT = command({\n name: 'stat',\n resource: ResourceName.REDIS,\n spec: specOf('stat'),\n fn: statCommand,\n provision: statProvision,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n featherStat,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statFeatherCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('stat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(redisStream(accessor, first))\n const out: ByteSource = featherStat(raw)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_STAT_FEATHER = command({\n name: 'stat',\n resource: ResourceName.REDIS,\n spec: specOf('stat'),\n filetype: '.feather',\n fn: statFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n hdf5Stat,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statHdf5Command(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('stat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(redisStream(accessor, first))\n const out: ByteSource = await hdf5Stat(raw)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_STAT_HDF5 = command({\n name: 'stat',\n resource: ResourceName.REDIS,\n spec: specOf('stat'),\n filetype: '.h5',\n fn: statHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n parquetStat,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statParquetCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('stat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(redisStream(accessor, first))\n const out: ByteSource = parquetStat(raw)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_STAT_PARQUET = command({\n name: 'stat',\n resource: ResourceName.REDIS,\n spec: specOf('stat'),\n filetype: '.parquet',\n fn: statParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nfunction extractStrings(data: Uint8Array, minLen: number): string[] {\n const out: string[] = []\n let current: number[] = []\n for (let i = 0; i < data.byteLength; i++) {\n const b = data[i] ?? 0\n if (b >= 0x20 && b <= 0x7e) {\n current.push(b)\n } else {\n if (current.length >= minLen) {\n out.push(String.fromCharCode(...current))\n }\n current = []\n }\n }\n if (current.length >= minLen) {\n out.push(String.fromCharCode(...current))\n }\n return out\n}\n\nasync function stringsCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const minLen = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 4\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(redisStream(accessor, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('strings: missing input\\n') })]\n }\n raw = stdinData\n }\n const matches = extractStrings(raw, minLen)\n const output = matches.length > 0 ? matches.join('\\n') + '\\n' : ''\n const result: ByteSource = ENC.encode(output)\n return [result, new IOResult()]\n}\n\nexport const REDIS_STRINGS = command({\n name: 'strings',\n resource: ResourceName.REDIS,\n spec: specOf('strings'),\n fn: stringsCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function collectLines(source: AsyncIterable<Uint8Array>): Promise<Uint8Array[]> {\n const lines: Uint8Array[] = []\n const iter = new AsyncLineIterator(source)\n for await (const line of iter) lines.push(line)\n return lines\n}\n\nasync function tacCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = redisStream(accessor, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'tac: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n const lines = await collectLines(source)\n lines.reverse()\n let total = 0\n for (const l of lines) total += l.byteLength + 1\n const out = new Uint8Array(total)\n let offset = 0\n for (const l of lines) {\n out.set(l, offset)\n offset += l.byteLength\n out[offset] = 0x0a\n offset += 1\n }\n const result: ByteSource = out\n return [result, new IOResult({ cache })]\n}\n\nexport const REDIS_TAC = command({\n name: 'tac',\n resource: ResourceName.REDIS,\n spec: specOf('tac'),\n fn: tacCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n countNewlines,\n headerAggregate,\n materialize,\n parseN,\n readStdinAsync,\n specOf,\n tailBytes,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function readFile(accessor: RedisAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(redisStream(accessor, p))\n}\n\nasync function tailCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nRaw = typeof opts.flags.n === 'string' ? opts.flags.n : null\n const cRaw = typeof opts.flags.c === 'string' ? opts.flags.c : null\n const qFlag = opts.flags.q === true\n const vFlag = opts.flags.v === true\n const [lines, plusMode] = parseN(nRaw)\n const bytesMode = cRaw !== null ? Number.parseInt(cRaw, 10) : null\n\n if (paths.length > 0) {\n const chunks: Uint8Array[] = []\n const cache: string[] = []\n const showHeaders = (vFlag || paths.length > 1) && !qFlag\n for (let i = 0; i < paths.length; i++) {\n const p = paths[i]\n if (p === undefined) continue\n const raw = await readFile(accessor, p)\n if (showHeaders) {\n const header = i > 0 ? `\\n==> ${p.original} <==\\n` : `==> ${p.original} <==\\n`\n chunks.push(ENC.encode(header))\n }\n if (bytesMode !== null) {\n chunks.push(bytesMode === 0 ? new Uint8Array(0) : raw.slice(-bytesMode))\n if (bytesMode >= raw.byteLength) cache.push(p.original)\n } else {\n chunks.push(tailBytes(raw, lines, null, plusMode))\n if (!plusMode && lines >= countNewlines(raw)) cache.push(p.original)\n }\n }\n const out: ByteSource = concat(chunks)\n return [out, new IOResult({ cache })]\n }\n const raw = await readStdinAsync(opts.stdin)\n if (raw === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n if (bytesMode !== null) {\n const out: ByteSource = bytesMode === 0 ? new Uint8Array(0) : raw.slice(-bytesMode)\n return [out, new IOResult()]\n }\n return [tailBytes(raw, lines, null, plusMode), new IOResult()]\n}\n\nfunction concat(chunks: Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nexport const REDIS_TAIL = command({\n name: 'tail',\n resource: ResourceName.REDIS,\n spec: specOf('tail'),\n fn: tailCommand,\n aggregate: headerAggregate,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n featherTail,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailFeatherCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = featherTail(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_TAIL_FEATHER = command({\n name: 'tail',\n resource: ResourceName.REDIS,\n spec: specOf('tail'),\n filetype: '.feather',\n fn: tailFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n hdf5Tail,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailHdf5Command(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = await hdf5Tail(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_TAIL_HDF5 = command({\n name: 'tail',\n resource: ResourceName.REDIS,\n spec: specOf('tail'),\n filetype: '.h5',\n fn: tailHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n parquetTail,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailParquetCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(redisStream(accessor, first))\n const result = await parquetTail(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_TAIL_PARQUET = command({\n name: 'tail',\n resource: ResourceName.REDIS,\n spec: specOf('tail'),\n filetype: '.parquet',\n fn: tailParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n gunzip,\n gzip,\n materialize,\n readTar,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type TarEntry,\n writeTar,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { mkdir as redisMkdir } from '../../../core/redis/mkdir.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function compress(data: Uint8Array, z: boolean): Promise<Uint8Array> {\n if (!z) return data\n return gzip(data)\n}\n\nasync function decompress(data: Uint8Array, z: boolean): Promise<Uint8Array> {\n if (!z) return data\n return gunzip(data)\n}\n\nasync function tarCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const create = opts.flags.c === true\n const extract = opts.flags.x === true\n const list = opts.flags.t === true\n const z = opts.flags.z === true\n if (opts.flags.j === true || opts.flags.J === true) {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('tar: bzip2/xz not supported\\n') }),\n ]\n }\n const fFlag = typeof opts.flags.f === 'string' ? opts.flags.f : null\n const CFlag = typeof opts.flags.C === 'string' ? opts.flags.C : null\n const stripN =\n typeof opts.flags.strip_components === 'string'\n ? Number.parseInt(opts.flags.strip_components, 10)\n : 0\n const exclude = typeof opts.flags.exclude === 'string' ? opts.flags.exclude : null\n const archivePath = fFlag\n const destPath = CFlag ?? '/'\n\n if (create) {\n if (archivePath === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tar: -f is required\\n') })]\n }\n const filtered =\n exclude !== null\n ? paths.filter((p) => !p.original.split('/').pop()?.includes(exclude))\n : paths\n const entries: TarEntry[] = []\n for (const p of filtered) {\n const data = await materialize(redisStream(accessor, p))\n entries.push({ name: p.original.replace(/^\\/+/, ''), data, isFile: true })\n }\n const archive = await compress(writeTar(entries), z)\n await redisWrite(accessor, makePathSpec(archivePath), archive)\n return [null, new IOResult({ writes: { [archivePath]: archive } })]\n }\n\n if (list) {\n if (archivePath === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tar: -f is required\\n') })]\n }\n const raw = await materialize(redisStream(accessor, makePathSpec(archivePath)))\n const data = await decompress(raw, z)\n const entries = readTar(data)\n const out: ByteSource = ENC.encode(entries.map((e) => e.name).join('\\n') + '\\n')\n return [out, new IOResult()]\n }\n\n if (extract) {\n if (archivePath === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tar: -f is required\\n') })]\n }\n const raw = await materialize(redisStream(accessor, makePathSpec(archivePath)))\n const data = await decompress(raw, z)\n const writes: Record<string, Uint8Array> = {}\n for (const entry of readTar(data)) {\n if (!entry.isFile) continue\n const nameParts = entry.name.split('/')\n const stripped = stripN > 0 ? nameParts.slice(stripN) : nameParts\n if (stripped.length === 0) continue\n const outPath = destPath.replace(/\\/+$/, '') + '/' + stripped.join('/')\n const parts = outPath.replace(/^\\/+|\\/+$/g, '').split('/')\n for (let pi = 1; pi < parts.length; pi++) {\n const d = '/' + parts.slice(0, pi).join('/')\n try {\n await redisMkdir(accessor, makePathSpec(d))\n } catch {\n // already exists\n }\n }\n await redisWrite(accessor, makePathSpec(outPath), entry.data)\n writes[outPath] = entry.data\n }\n return [null, new IOResult({ writes })]\n }\n\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('tar: must specify -c, -x, or -t\\n') }),\n ]\n}\n\nexport const REDIS_TAR = command({\n name: 'tar',\n resource: ResourceName.REDIS,\n spec: specOf('tar'),\n fn: tarCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function teeCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tee: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const stdinData = await readStdinAsync(opts.stdin)\n const raw: Uint8Array = stdinData ?? ENC.encode(texts.join(' '))\n let writeData = raw\n if (opts.flags.a === true) {\n try {\n const existing = await materialize(redisStream(accessor, first))\n writeData = new Uint8Array(existing.byteLength + raw.byteLength)\n writeData.set(existing, 0)\n writeData.set(raw, existing.byteLength)\n } catch (err) {\n if (!(err instanceof Error) || !/not found/i.test(err.message)) throw err\n }\n }\n await redisWrite(accessor, first, writeData)\n const out: ByteSource = raw\n return [\n out,\n new IOResult({\n writes: { [first.stripPrefix]: writeData },\n cache: [first.stripPrefix],\n }),\n ]\n}\n\nexport const REDIS_TEE = command({\n name: 'tee',\n resource: ResourceName.REDIS,\n spec: specOf('tee'),\n fn: teeCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { exists as redisExists } from '../../../core/redis/exists.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function touchCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('touch: missing operand\\n') })]\n }\n const createOnly = opts.flags.c === true\n for (const p of paths) {\n if (createOnly) continue\n if (!(await redisExists(accessor, p))) {\n await redisWrite(accessor, p, new Uint8Array(0))\n }\n }\n return [null, new IOResult()]\n}\n\nexport const REDIS_TOUCH = command({\n name: 'touch',\n resource: ResourceName.REDIS,\n spec: specOf('touch'),\n fn: touchCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n interpretEscapes,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction expandRanges(s: string): string {\n let out = ''\n let i = 0\n while (i < s.length) {\n if (i + 2 < s.length && s[i + 1] === '-') {\n const start = s.charCodeAt(i)\n const end = s.charCodeAt(i + 2)\n for (let c = start; c <= end; c++) out += String.fromCharCode(c)\n i += 3\n } else {\n out += s[i] ?? ''\n i += 1\n }\n }\n return out\n}\n\ninterface TrOptions {\n set1: string\n set2: string\n del: boolean\n squeeze: boolean\n table: Map<string, string> | null\n}\n\nasync function* trStream(\n source: AsyncIterable<Uint8Array>,\n opts: TrOptions,\n): AsyncIterable<Uint8Array> {\n const squeezeSet: Set<string> =\n opts.squeeze && opts.set2 !== ''\n ? new Set(opts.set2)\n : opts.squeeze\n ? new Set(opts.set1)\n : new Set()\n let prevChar = ''\n for await (const chunk of source) {\n const text = DEC.decode(chunk)\n let result: string\n if (opts.del) {\n const set1Set = new Set(opts.set1)\n result = Array.from(text)\n .filter((c) => !set1Set.has(c))\n .join('')\n } else if (opts.table !== null) {\n result = Array.from(text)\n .map((c) => opts.table?.get(c) ?? c)\n .join('')\n } else {\n result = text\n }\n if (squeezeSet.size > 0) {\n const squeezed: string[] = []\n for (const c of result) {\n if (squeezeSet.has(c) && c === prevChar) continue\n squeezed.push(c)\n prevChar = c\n }\n result = squeezed.join('')\n } else if (result.length > 0) {\n prevChar = result[result.length - 1] ?? ''\n }\n yield ENC.encode(result)\n }\n}\n\nfunction buildOptions(\n texts: readonly string[],\n flags: Record<string, string | boolean>,\n): TrOptions {\n if (texts.length === 0) throw new Error('tr: usage: tr [-d] [-s] [-c] set1 [set2] [path]')\n let set1 = expandRanges(interpretEscapes(texts[0] ?? ''))\n if (flags.c === true) {\n let allChars = ''\n for (let i = 0; i < 128; i++) allChars += String.fromCharCode(i)\n const s1 = new Set(set1)\n set1 = Array.from(allChars)\n .filter((c) => !s1.has(c))\n .join('')\n }\n let set2 = texts.length >= 2 ? expandRanges(interpretEscapes(texts[1] ?? '')) : ''\n if (set2 !== '' && set2.length < set1.length) {\n const last = set2[set2.length - 1] ?? ''\n set2 = set2 + last.repeat(set1.length - set2.length)\n }\n const del = flags.d === true\n const squeeze = flags.s === true\n let table: Map<string, string> | null = null\n if (!del && set2 !== '') {\n table = new Map<string, string>()\n for (let i = 0; i < set1.length; i++) {\n const from = set1[i]\n const to = set2[i]\n if (from !== undefined && to !== undefined) table.set(from, to)\n }\n } else if (!del && set2 === '' && !squeeze) {\n throw new Error('tr: usage: tr set1 set2')\n }\n return { set1, set2, del, squeeze, table }\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function trCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n let trOpts: TrOptions\n try {\n trOpts = buildOptions(texts, opts.flags)\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = redisStream(accessor, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'tr: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n return [trStream(source, trOpts), new IOResult({ cache })]\n}\n\nexport const REDIS_TR = command({\n name: 'tr',\n resource: ResourceName.REDIS,\n spec: specOf('tr'),\n fn: trCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { readdir as redisReaddir } from '../../../core/redis/readdir.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nasync function walkTree(\n accessor: RedisAccessor,\n path: PathSpec,\n prefix: string,\n lines: string[],\n): Promise<void> {\n let entries: string[]\n try {\n entries = await redisReaddir(accessor, path)\n } catch {\n return\n }\n entries.sort()\n for (let i = 0; i < entries.length; i++) {\n const childPath = entries[i]\n if (childPath === undefined) continue\n const last = i === entries.length - 1\n const connector = last ? '└── ' : '├── '\n const displayName = childPath.slice(childPath.lastIndexOf('/') + 1)\n lines.push(`${prefix}${connector}${displayName}`)\n const sub = new PathSpec({\n original: childPath,\n directory: childPath,\n resolved: false,\n prefix: path.prefix,\n })\n const nextPrefix = prefix + (last ? ' ' : '│ ')\n await walkTree(accessor, sub, nextPrefix, lines)\n }\n}\n\nasync function treeCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const targets =\n paths.length > 0\n ? paths\n : [\n new PathSpec({\n original: opts.cwd,\n directory: opts.cwd,\n resolved: false,\n prefix: opts.mountPrefix ?? '',\n }),\n ]\n const lines: string[] = []\n for (const p of targets) {\n await walkTree(accessor, p, '', lines)\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const REDIS_TREE = command({\n name: 'tree',\n resource: ResourceName.REDIS,\n spec: specOf('tree'),\n fn: treeCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction topologicalSort(pairs: readonly (readonly [string, string])[]): [string[], boolean] {\n const graph = new Map<string, Set<string>>()\n const inDegree = new Map<string, number>()\n const getOrCreate = (node: string): Set<string> => {\n const existing = graph.get(node)\n if (existing !== undefined) return existing\n const created = new Set<string>()\n graph.set(node, created)\n inDegree.set(node, 0)\n return created\n }\n for (const [a, b] of pairs) {\n const adj = getOrCreate(a)\n getOrCreate(b)\n if (!adj.has(b)) {\n adj.add(b)\n inDegree.set(b, (inDegree.get(b) ?? 0) + 1)\n }\n }\n const queue: string[] = []\n for (const [node, deg] of inDegree) {\n if (deg === 0) queue.push(node)\n }\n const result: string[] = []\n let head = 0\n while (head < queue.length) {\n const node = queue[head] ?? ''\n head += 1\n result.push(node)\n const neighbors = [...(graph.get(node) ?? new Set<string>())].sort()\n for (const nb of neighbors) {\n const d = (inDegree.get(nb) ?? 0) - 1\n inDegree.set(nb, d)\n if (d === 0) queue.push(nb)\n }\n }\n const hasCycle = result.length !== graph.size\n return [result, hasCycle]\n}\n\nasync function tsortCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(redisStream(accessor, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tsort: missing input\\n') })]\n }\n raw = stdinData\n }\n const text = DEC.decode(raw)\n const tokens = text.split(/\\s+/).filter((s) => s !== '')\n if (tokens.length % 2 !== 0) {\n const out: ByteSource = ENC.encode('tsort: odd number of tokens\\n')\n return [out, new IOResult({ exitCode: 1 })]\n }\n const pairs: [string, string][] = []\n for (let i = 0; i < tokens.length; i += 2) {\n pairs.push([tokens[i] ?? '', tokens[i + 1] ?? ''])\n }\n const [sorted, hasCycle] = topologicalSort(pairs)\n if (hasCycle) {\n const out: ByteSource = ENC.encode('tsort: cycle detected\\n')\n return [out, new IOResult({ exitCode: 1 })]\n }\n const result: ByteSource = ENC.encode(sorted.join('\\n') + '\\n')\n return [result, new IOResult()]\n}\n\nexport const REDIS_TSORT = command({\n name: 'tsort',\n resource: ResourceName.REDIS,\n spec: specOf('tsort'),\n fn: tsortCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesKeepEnds(text: string): string[] {\n const lines: string[] = []\n let start = 0\n for (let i = 0; i < text.length; i++) {\n if (text[i] === '\\n') {\n lines.push(text.slice(start, i + 1))\n start = i + 1\n }\n }\n if (start < text.length) lines.push(text.slice(start))\n return lines\n}\n\nfunction unexpandLine(line: string, tabsize: number, allSpaces: boolean): string {\n if (allSpaces) {\n const result: string[] = []\n let i = 0\n while (i < line.length) {\n let count = 0\n while (i + count < line.length && line[i + count] === ' ') count += 1\n if (count >= tabsize) {\n const tabs = Math.floor(count / tabsize)\n const remainder = count % tabsize\n result.push('\\t'.repeat(tabs) + ' '.repeat(remainder))\n i += count\n } else if (count > 0) {\n result.push(' '.repeat(count))\n i += count\n } else {\n result.push(line[i] ?? '')\n i += 1\n }\n }\n return result.join('')\n }\n let leading = 0\n while (leading < line.length && line[leading] === ' ') leading += 1\n if (leading >= tabsize) {\n const tabs = Math.floor(leading / tabsize)\n const remainder = leading % tabsize\n return '\\t'.repeat(tabs) + ' '.repeat(remainder) + line.slice(leading)\n }\n return line\n}\n\nasync function unexpandCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const tabsize = typeof opts.flags.t === 'string' ? Number.parseInt(opts.flags.t, 10) : 8\n const allSpaces = opts.flags.a === true\n if (paths.length > 0) {\n const parts: string[] = []\n for (const p of paths) {\n const data = DEC.decode(await materialize(redisStream(accessor, p)))\n for (const ln of splitLinesKeepEnds(data)) parts.push(unexpandLine(ln, tabsize, allSpaces))\n }\n const result: ByteSource = ENC.encode(parts.join(''))\n return [result, new IOResult()]\n }\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('unexpand: missing operand\\n') })]\n }\n const text = DEC.decode(stdinData)\n const lines = splitLinesKeepEnds(text)\n const result: ByteSource = ENC.encode(\n lines.map((ln) => unexpandLine(ln, tabsize, allSpaces)).join(''),\n )\n return [result, new IOResult()]\n}\n\nexport const REDIS_UNEXPAND = command({\n name: 'unexpand',\n resource: ResourceName.REDIS,\n spec: specOf('unexpand'),\n fn: unexpandCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\ninterface UniqOptions {\n count: boolean\n duplicatesOnly: boolean\n uniqueOnly: boolean\n skipFields: number\n skipChars: number\n checkChars: number\n ignoreCase: boolean\n}\n\nfunction comparisonKey(line: Uint8Array, opts: UniqOptions): string {\n let text = DEC.decode(line)\n if (opts.skipFields > 0) {\n const parts = text.split(/\\s+/).filter((s) => s !== '')\n const remaining = opts.skipFields < parts.length ? parts.slice(opts.skipFields) : []\n text = remaining.join(' ')\n }\n if (opts.skipChars > 0) text = text.slice(opts.skipChars)\n if (opts.checkChars > 0) text = text.slice(0, opts.checkChars)\n if (opts.ignoreCase) text = text.toLowerCase()\n return text\n}\n\nfunction padLeft(value: string, width: number): string {\n return value.length >= width ? value : ' '.repeat(width - value.length) + value\n}\n\nfunction emitLine(line: Uint8Array, count: number, opts: UniqOptions): Uint8Array | null {\n if (opts.duplicatesOnly && count === 1) return null\n if (opts.uniqueOnly && count > 1) return null\n if (opts.count) {\n const prefix = ENC.encode(`${padLeft(String(count), 7)} `)\n const out = new Uint8Array(prefix.byteLength + line.byteLength + 1)\n out.set(prefix, 0)\n out.set(line, prefix.byteLength)\n out[out.byteLength - 1] = 0x0a\n return out\n }\n const out = new Uint8Array(line.byteLength + 1)\n out.set(line, 0)\n out[line.byteLength] = 0x0a\n return out\n}\n\nasync function* uniqStream(\n source: AsyncIterable<Uint8Array>,\n opts: UniqOptions,\n): AsyncIterable<Uint8Array> {\n let prevLine: Uint8Array | null = null\n let prevKey: string | null = null\n let prevCount = 0\n const iter = new AsyncLineIterator(source)\n for await (const rawLine of iter) {\n const key = comparisonKey(rawLine, opts)\n if (key === prevKey) {\n prevCount += 1\n } else {\n if (prevLine !== null) {\n const chunk = emitLine(prevLine, prevCount, opts)\n if (chunk !== null) yield chunk\n }\n prevLine = rawLine\n prevKey = key\n prevCount = 1\n }\n }\n if (prevLine !== null) {\n const chunk = emitLine(prevLine, prevCount, opts)\n if (chunk !== null) yield chunk\n }\n}\n\nfunction parseOptions(flags: Record<string, string | boolean>): UniqOptions {\n const intFlag = (key: 'f' | 's' | 'w'): number =>\n typeof flags[key] === 'string' ? Number.parseInt(flags[key], 10) : 0\n return {\n count: flags.c === true,\n duplicatesOnly: flags.d === true,\n uniqueOnly: flags.u === true,\n skipFields: intFlag('f'),\n skipChars: intFlag('s'),\n checkChars: intFlag('w'),\n ignoreCase: flags.i === true,\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function uniqCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const uniqOpts = parseOptions(opts.flags)\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n return [\n uniqStream(redisStream(accessor, first), uniqOpts),\n new IOResult({ cache: [first.stripPrefix] }),\n ]\n }\n try {\n const source = resolveSource(opts.stdin, 'uniq: missing operand')\n return [uniqStream(source, uniqOpts), new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const REDIS_UNIQ = command({\n name: 'uniq',\n resource: ResourceName.REDIS,\n spec: specOf('uniq'),\n fn: uniqCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n inflateRaw,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { mkdir as redisMkdir } from '../../../core/redis/mkdir.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\ninterface ZipEntry {\n name: string\n size: number\n data: Uint8Array\n}\n\nfunction readU16LE(data: Uint8Array, offset: number): number {\n return (data[offset] ?? 0) | ((data[offset + 1] ?? 0) << 8)\n}\n\nfunction readU32LE(data: Uint8Array, offset: number): number {\n return (\n ((data[offset] ?? 0) |\n ((data[offset + 1] ?? 0) << 8) |\n ((data[offset + 2] ?? 0) << 16) |\n ((data[offset + 3] ?? 0) << 24)) >>>\n 0\n )\n}\n\nasync function readZipEntries(data: Uint8Array): Promise<ZipEntry[]> {\n const entries: ZipEntry[] = []\n let offset = 0\n while (offset + 4 <= data.byteLength) {\n const sig = readU32LE(data, offset)\n if (sig !== 0x04034b50) break\n const compressionMethod = readU16LE(data, offset + 8)\n const compressedSize = readU32LE(data, offset + 18)\n const uncompressedSize = readU32LE(data, offset + 22)\n const nameLen = readU16LE(data, offset + 26)\n const extraLen = readU16LE(data, offset + 28)\n const headerEnd = offset + 30 + nameLen + extraLen\n const nameBytes = data.subarray(offset + 30, offset + 30 + nameLen)\n const name = DEC.decode(nameBytes)\n const body = data.subarray(headerEnd, headerEnd + compressedSize)\n let content: Uint8Array\n if (compressionMethod === 0) {\n content = body.slice()\n } else if (compressionMethod === 8) {\n content = await inflateRaw(body)\n } else {\n throw new Error(`unzip: unsupported compression method: ${String(compressionMethod)}`)\n }\n entries.push({ name, size: uncompressedSize, data: content })\n offset = headerEnd + compressedSize\n }\n return entries\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function ensureParents(accessor: RedisAccessor, path: string): Promise<void> {\n const idx = path.lastIndexOf('/')\n if (idx <= 0) return\n const dir = path.slice(0, idx)\n if (dir === '' || dir === '/') return\n await redisMkdir(accessor, makePathSpec(dir), true)\n}\n\nasync function unzipCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('unzip: missing operand\\n') })]\n }\n const archivePath = paths[0]\n if (archivePath === undefined) return [null, new IOResult()]\n const data = await materialize(redisStream(accessor, archivePath))\n const entries = await readZipEntries(data)\n\n const listMode = opts.flags.args_l === true\n const testMode = opts.flags.t === true\n const pipeMode = opts.flags.p === true\n const quiet = opts.flags.q === true\n const mountPrefix = archivePath.prefix\n const destRaw = typeof opts.flags.d === 'string' ? opts.flags.d : '/'\n const dest =\n mountPrefix !== '' && destRaw.startsWith(mountPrefix + '/')\n ? destRaw.slice(mountPrefix.length)\n : destRaw === mountPrefix\n ? '/'\n : destRaw\n\n if (listMode) {\n const lines = [' Length Name', '--------- ----']\n for (const e of entries) {\n lines.push(`${String(e.size).padStart(9, ' ')} ${e.name}`)\n }\n const out: ByteSource = ENC.encode(lines.join('\\n') + '\\n')\n return [out, new IOResult()]\n }\n\n if (testMode) {\n const msg = `No errors detected in ${archivePath.original}\\n`\n const out: ByteSource = ENC.encode(msg)\n return [out, new IOResult()]\n }\n\n if (pipeMode) {\n const chunks: Uint8Array[] = []\n for (const e of entries) {\n if (!e.name.endsWith('/')) chunks.push(e.data)\n }\n let total = 0\n for (const c of chunks) total += c.byteLength\n const merged = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n merged.set(c, offset)\n offset += c.byteLength\n }\n const out: ByteSource = merged\n return [out, new IOResult()]\n }\n\n const writes: Record<string, Uint8Array> = {}\n const outputLines: string[] = []\n for (const e of entries) {\n if (e.name.endsWith('/')) continue\n const entryName = e.name.replace(/^\\/+/, '')\n const outPath = dest.replace(/\\/+$/, '') + '/' + entryName\n await ensureParents(accessor, outPath)\n await redisWrite(accessor, makePathSpec(outPath), e.data)\n const reportPath = mountPrefix !== '' ? mountPrefix + outPath : outPath\n writes[reportPath] = e.data\n if (!quiet) outputLines.push(` inflating: ${reportPath}`)\n }\n const stdout: ByteSource | null =\n outputLines.length > 0 ? ENC.encode(outputLines.join('\\n') + '\\n') : null\n return [stdout, new IOResult({ writes })]\n}\n\nexport const REDIS_UNZIP = command({\n name: 'unzip',\n resource: ResourceName.REDIS,\n spec: specOf('unzip'),\n fn: unzipCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n wcAggregate,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nasync function* wcLinesStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n let count = 0\n for await (const chunk of source) {\n for (let i = 0; i < chunk.byteLength; i++) if (chunk[i] === 0x0a) count += 1\n }\n yield ENC.encode(String(count))\n}\n\nasync function readStream(accessor: RedisAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(redisStream(accessor, p))\n}\n\nasync function wcCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const f = opts.flags\n const lFlag = f.args_l === true\n const wFlag = f.w === true\n const cFlag = f.c === true\n const mFlag = f.m === true\n const LFlag = f.L === true\n if (paths.length > 0) {\n const outputs: string[] = []\n let totalLines = 0\n let totalWords = 0\n let totalBytes = 0\n for (const p of paths) {\n const data = await readStream(accessor, p)\n const text = DEC.decode(data)\n const lineCount = countChar(text, '\\n')\n const wordCount = text.split(/\\s+/).filter((s) => s !== '').length\n const byteCount = data.byteLength\n if (LFlag) {\n const maxLen = text.split(/\\r?\\n/).reduce((m, l) => Math.max(m, l.length), 0)\n outputs.push(`${String(maxLen)}\\t${p.original}`)\n } else if (lFlag) {\n outputs.push(`${String(lineCount)}\\t${p.original}`)\n totalLines += lineCount\n } else if (wFlag) {\n outputs.push(`${String(wordCount)}\\t${p.original}`)\n totalWords += wordCount\n } else if (cFlag) {\n outputs.push(`${String(byteCount)}\\t${p.original}`)\n totalBytes += byteCount\n } else if (mFlag) {\n const charCount = text.length\n outputs.push(`${String(charCount)}\\t${p.original}`)\n totalBytes += charCount\n } else {\n outputs.push(\n `${String(lineCount)}\\t${String(wordCount)}\\t${String(byteCount)}\\t${p.original}`,\n )\n totalLines += lineCount\n totalWords += wordCount\n totalBytes += byteCount\n }\n }\n if (paths.length > 1) {\n if (lFlag) outputs.push(`${String(totalLines)}\\ttotal`)\n else if (wFlag) outputs.push(`${String(totalWords)}\\ttotal`)\n else if (cFlag) outputs.push(`${String(totalBytes)}\\ttotal`)\n else if (mFlag) outputs.push(`${String(totalBytes)}\\ttotal`)\n else\n outputs.push(`${String(totalLines)}\\t${String(totalWords)}\\t${String(totalBytes)}\\ttotal`)\n }\n const out: ByteSource = ENC.encode(outputs.join('\\n'))\n return [out, new IOResult()]\n }\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, 'wc: missing operand')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n if (lFlag) return [wcLinesStream(source), new IOResult()]\n const raw = await materialize(source)\n const text = DEC.decode(raw)\n const lc = countChar(text, '\\n')\n const wcVal = text.split(/\\s+/).filter((s) => s !== '').length\n const bc = raw.byteLength\n const cc = text.length\n if (LFlag) {\n const maxLen = text.split(/\\r?\\n/).reduce((m, l) => Math.max(m, l.length), 0)\n return [ENC.encode(String(maxLen)), new IOResult()]\n }\n if (wFlag) return [ENC.encode(String(wcVal)), new IOResult()]\n if (mFlag) return [ENC.encode(String(cc)), new IOResult()]\n if (cFlag) return [ENC.encode(String(bc)), new IOResult()]\n return [ENC.encode(`${String(lc)}\\t${String(wcVal)}\\t${String(bc)}`), new IOResult()]\n}\n\nfunction countChar(text: string, ch: string): number {\n let n = 0\n for (const c of text) if (c === ch) n += 1\n return n\n}\n\nexport const REDIS_WC = command({\n name: 'wc',\n resource: ResourceName.REDIS,\n spec: specOf('wc'),\n fn: wcCommand,\n aggregate: wcAggregate,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n featherWc,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function wcFeatherCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('wc: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(redisStream(accessor, first))\n const rows = featherWc(raw)\n const out: ByteSource = ENC.encode(`${String(rows)}\\t${first.original}\\n`)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`wc: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_WC_FEATHER = command({\n name: 'wc',\n resource: ResourceName.REDIS,\n spec: specOf('wc'),\n filetype: '.feather',\n fn: wcFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n hdf5Wc,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function wcHdf5Command(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('wc: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(redisStream(accessor, first))\n const rows = await hdf5Wc(raw)\n const out: ByteSource = ENC.encode(`${String(rows)}\\t${first.original}\\n`)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`wc: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_WC_HDF5 = command({\n name: 'wc',\n resource: ResourceName.REDIS,\n spec: specOf('wc'),\n filetype: '.h5',\n fn: wcHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n parquetWc,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function wcParquetCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('wc: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(redisStream(accessor, first))\n const rows = parquetWc(raw)\n const out: ByteSource = ENC.encode(`${String(rows)}\\t${first.original}\\n`)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`wc: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const REDIS_WC_PARQUET = command({\n name: 'wc',\n resource: ResourceName.REDIS,\n spec: specOf('wc'),\n filetype: '.parquet',\n fn: wcParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction padLeft(s: string, width: number, ch = ' '): string {\n return s.length >= width ? s : ch.repeat(width - s.length) + s\n}\n\nfunction padRight(s: string, width: number, ch = ' '): string {\n return s.length >= width ? s : s + ch.repeat(width - s.length)\n}\n\nfunction hexByte(b: number, uppercase: boolean): string {\n const h = b.toString(16).padStart(2, '0')\n return uppercase ? h.toUpperCase() : h\n}\n\nfunction hexOffset(offset: number, uppercase: boolean): string {\n const h = offset.toString(16).padStart(8, '0')\n return uppercase ? h.toUpperCase() : h\n}\n\nasync function* xxdDumpStream(\n source: AsyncIterable<Uint8Array>,\n cols: number,\n group: number,\n uppercase: boolean,\n): AsyncIterable<Uint8Array> {\n let offset = 0\n let leftover = new Uint8Array(0)\n const hexColumnWidth = cols * 2 + Math.floor(cols / group) - 1\n const emitRow = (row: Uint8Array): Uint8Array => {\n const hexParts: string[] = []\n for (let g = 0; g < row.byteLength; g += group) {\n let seg = ''\n const end = Math.min(g + group, row.byteLength)\n for (let k = g; k < end; k++) seg += hexByte(row[k] ?? 0, uppercase)\n hexParts.push(seg)\n }\n const hexPart = hexParts.join(' ')\n let asciiPart = ''\n for (const b of row) asciiPart += b >= 32 && b < 127 ? String.fromCharCode(b) : '.'\n const line = `${hexOffset(offset, uppercase)}: ${padRight(hexPart, hexColumnWidth)} ${asciiPart}\\n`\n return ENC.encode(line)\n }\n for await (const chunk of source) {\n const merged = new Uint8Array(leftover.byteLength + chunk.byteLength)\n merged.set(leftover, 0)\n merged.set(chunk, leftover.byteLength)\n let i = 0\n while (i + cols <= merged.byteLength) {\n yield emitRow(merged.subarray(i, i + cols))\n offset += cols\n i += cols\n }\n leftover = merged.subarray(i)\n }\n if (leftover.byteLength > 0) {\n yield emitRow(leftover)\n }\n}\n\nasync function* xxdPlainStream(\n source: AsyncIterable<Uint8Array>,\n uppercase: boolean,\n): AsyncIterable<Uint8Array> {\n for await (const chunk of source) {\n let hex = ''\n for (const b of chunk) hex += hexByte(b, uppercase)\n yield ENC.encode(hex)\n }\n yield ENC.encode('\\n')\n}\n\nasync function* xxdReverseStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n const chunks: Uint8Array[] = []\n for await (const c of source) chunks.push(c)\n let total = 0\n for (const c of chunks) total += c.byteLength\n const buf = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n buf.set(c, offset)\n offset += c.byteLength\n }\n const text = DEC.decode(buf).replace(/[\\n ]/g, '')\n const out = new Uint8Array(text.length / 2)\n for (let i = 0; i < out.byteLength; i++)\n out[i] = Number.parseInt(text.slice(i * 2, i * 2 + 2), 16)\n yield out\n}\n\nasync function* applyLimits(\n source: AsyncIterable<Uint8Array>,\n skip: number,\n limit: number,\n): AsyncIterable<Uint8Array> {\n let pos = 0\n let remaining = limit\n for await (let chunk of source) {\n const len = chunk.byteLength\n if (pos + len <= skip) {\n pos += len\n continue\n }\n if (pos < skip) {\n chunk = chunk.subarray(skip - pos)\n pos = skip\n }\n if (remaining <= 0) break\n if (chunk.byteLength > remaining) chunk = chunk.subarray(0, remaining)\n yield chunk\n remaining -= chunk.byteLength\n pos += chunk.byteLength\n }\n}\n\nvoid padLeft\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function xxdCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = redisStream(accessor, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'xxd: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n const toInt = (v: string | boolean | undefined): number =>\n typeof v === 'string' ? Number.parseInt(v, 10) : 0\n const skip = toInt(opts.flags.s)\n const limitFlag = toInt(opts.flags.l)\n if (skip > 0 || limitFlag > 0) {\n const limit = limitFlag > 0 ? limitFlag : Number.MAX_SAFE_INTEGER\n source = applyLimits(source, skip, limit)\n }\n const uppercase = opts.flags.u === true\n if (opts.flags.r === true) return [xxdReverseStream(source), new IOResult({ cache })]\n if (opts.flags.p === true) return [xxdPlainStream(source, uppercase), new IOResult({ cache })]\n const cols = toInt(opts.flags.c) > 0 ? toInt(opts.flags.c) : 16\n const group = toInt(opts.flags.g) > 0 ? toInt(opts.flags.g) : 2\n return [xxdDumpStream(source, cols, group, uppercase), new IOResult({ cache })]\n}\n\nexport const REDIS_XXD = command({\n name: 'xxd',\n resource: ResourceName.REDIS,\n spec: specOf('xxd'),\n fn: xxdCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n gunzip,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nasync function zcatCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n let raw: Uint8Array\n if (paths.length > 0 && paths[0] !== undefined) {\n raw = await materialize(redisStream(accessor, paths[0]))\n } else {\n const stdinBytes = await readStdinAsync(opts.stdin)\n if (stdinBytes === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('zcat: missing input\\n') })]\n }\n raw = stdinBytes\n }\n const out = await gunzip(raw)\n const result: ByteSource = out\n return [result, new IOResult()]\n}\n\nexport const REDIS_ZCAT = command({\n name: 'zcat',\n resource: ResourceName.REDIS,\n spec: specOf('zcat'),\n fn: zcatCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n compilePattern,\n gunzip,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\ninterface ZgrepOpts {\n ignoreCase: boolean\n invert: boolean\n count: boolean\n lineNumbers: boolean\n onlyMatching: boolean\n maxCount: number | null\n}\n\nfunction zgrepSearch(\n data: Uint8Array,\n pattern: RegExp,\n opts: ZgrepOpts,\n filename: string | null,\n): [string[], boolean] {\n const text = DEC.decode(data)\n const lines = splitLinesNoTrailing(text)\n const reGlobal = opts.onlyMatching\n ? new RegExp(pattern.source, pattern.flags.includes('g') ? pattern.flags : pattern.flags + 'g')\n : null\n const matched: [number, string][] = []\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? ''\n if (opts.onlyMatching && !opts.invert && reGlobal !== null) {\n reGlobal.lastIndex = 0\n let m: RegExpExecArray | null\n const hits: RegExpExecArray[] = []\n while ((m = reGlobal.exec(line)) !== null) {\n hits.push(m)\n if (m[0] === '') reGlobal.lastIndex += 1\n }\n if (hits.length > 0) {\n for (const h of hits) {\n matched.push([i + 1, h[0]])\n if (opts.maxCount !== null && matched.length >= opts.maxCount) break\n }\n }\n } else {\n let hit = pattern.test(line)\n if (opts.invert) hit = !hit\n if (hit) matched.push([i + 1, line])\n }\n if (opts.maxCount !== null && matched.length >= opts.maxCount) break\n }\n if (opts.count) return [[String(matched.length)], matched.length > 0]\n const result: string[] = []\n for (const [idx, line] of matched) {\n let prefix = ''\n if (filename !== null) prefix = filename + ':'\n if (opts.lineNumbers) prefix += String(idx) + ':'\n result.push(prefix + line)\n }\n return [result, matched.length > 0]\n}\n\nasync function zgrepCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const rawPattern =\n typeof opts.flags.e === 'string'\n ? opts.flags.e\n : texts.length > 0 && texts[0] !== undefined\n ? texts[0]\n : ''\n const extendedRegex = opts.flags.E === true\n const fixedString = opts.flags.F === true\n const wholeWord = opts.flags.w === true\n const ignoreCase = opts.flags.i === true\n const invert = opts.flags.v === true\n const countOnly = opts.flags.c === true\n const lineNumbers = opts.flags.n === true\n const onlyMatching = opts.flags.o === true\n const quiet = opts.flags.q === true\n const filesOnly = opts.flags.args_l === true\n const forceH = opts.flags.H === true\n const hideH = opts.flags.h === true\n const maxCount = typeof opts.flags.m === 'string' ? Number.parseInt(opts.flags.m, 10) : null\n void extendedRegex\n const pattern = compilePattern(rawPattern, ignoreCase, fixedString, wholeWord)\n\n const multi = paths.length > 1\n const showFilename = forceH || (multi && !hideH)\n let anyMatch = false\n const allResults: string[] = []\n\n if (paths.length > 0) {\n for (const p of paths) {\n const compressed = await materialize(redisStream(accessor, p))\n const data = await gunzip(compressed)\n const fname = showFilename ? p.original : null\n if (filesOnly) {\n const text = DEC.decode(data)\n const lines = splitLinesNoTrailing(text)\n for (const line of lines) {\n let hit = pattern.test(line)\n if (invert) hit = !hit\n if (hit) {\n allResults.push(p.original)\n anyMatch = true\n break\n }\n }\n } else {\n const [result, hadMatch] = zgrepSearch(\n data,\n pattern,\n {\n ignoreCase,\n invert,\n count: countOnly,\n lineNumbers,\n onlyMatching,\n maxCount,\n },\n fname,\n )\n if (hadMatch) anyMatch = true\n for (const r of result) allResults.push(r)\n }\n }\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('zgrep: missing input\\n') })]\n }\n const data = await gunzip(stdinData)\n if (filesOnly) {\n const text = DEC.decode(data)\n const lines = splitLinesNoTrailing(text)\n for (const line of lines) {\n let hit = pattern.test(line)\n if (invert) hit = !hit\n if (hit) {\n allResults.push('(standard input)')\n anyMatch = true\n break\n }\n }\n } else {\n const [result, hadMatch] = zgrepSearch(\n data,\n pattern,\n { ignoreCase, invert, count: countOnly, lineNumbers, onlyMatching, maxCount },\n null,\n )\n if (hadMatch) anyMatch = true\n for (const r of result) allResults.push(r)\n }\n }\n\n if (quiet) return [null, new IOResult({ exitCode: anyMatch ? 0 : 1 })]\n if (!anyMatch) return [null, new IOResult({ exitCode: 1 })]\n const result: ByteSource = ENC.encode(allResults.join('\\n') + '\\n')\n return [result, new IOResult()]\n}\n\nexport const REDIS_ZGREP = command({\n name: 'zgrep',\n resource: ResourceName.REDIS,\n spec: specOf('zgrep'),\n fn: zgrepCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n deflateRaw,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { writeBytes as redisWrite } from '../../../core/redis/write.ts'\nimport { stream as redisStream } from '../../../core/redis/stream.ts'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\n\nconst ENC = new TextEncoder()\n\nconst CRC_TABLE = (() => {\n const table = new Uint32Array(256)\n for (let n = 0; n < 256; n++) {\n let c = n\n for (let k = 0; k < 8; k++) {\n c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1\n }\n table[n] = c >>> 0\n }\n return table\n})()\n\nfunction crc32(data: Uint8Array): number {\n let c = 0xffffffff\n for (let i = 0; i < data.byteLength; i++) {\n c = (CRC_TABLE[((c ^ (data[i] ?? 0)) & 0xff) >>> 0] ?? 0) ^ (c >>> 8)\n }\n return (c ^ 0xffffffff) >>> 0\n}\n\nfunction writeU16LE(buf: Uint8Array, offset: number, value: number): void {\n buf[offset] = value & 0xff\n buf[offset + 1] = (value >>> 8) & 0xff\n}\n\nfunction writeU32LE(buf: Uint8Array, offset: number, value: number): void {\n buf[offset] = value & 0xff\n buf[offset + 1] = (value >>> 8) & 0xff\n buf[offset + 2] = (value >>> 16) & 0xff\n buf[offset + 3] = (value >>> 24) & 0xff\n}\n\ninterface ZipItem {\n name: string\n data: Uint8Array\n compressed: Uint8Array\n crc: number\n method: number\n localOffset: number\n}\n\nfunction basename(path: string): string {\n const idx = path.lastIndexOf('/')\n return idx >= 0 ? path.slice(idx + 1) : path\n}\n\nfunction concat(chunks: readonly Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nfunction buildZip(items: ZipItem[]): Uint8Array {\n const parts: Uint8Array[] = []\n let offset = 0\n for (const item of items) {\n item.localOffset = offset\n const nameBytes = ENC.encode(item.name)\n const header = new Uint8Array(30 + nameBytes.byteLength)\n writeU32LE(header, 0, 0x04034b50)\n writeU16LE(header, 4, 20)\n writeU16LE(header, 6, 0)\n writeU16LE(header, 8, item.method)\n writeU16LE(header, 10, 0)\n writeU16LE(header, 12, 0)\n writeU32LE(header, 14, item.crc)\n writeU32LE(header, 18, item.compressed.byteLength)\n writeU32LE(header, 22, item.data.byteLength)\n writeU16LE(header, 26, nameBytes.byteLength)\n writeU16LE(header, 28, 0)\n header.set(nameBytes, 30)\n parts.push(header)\n parts.push(item.compressed)\n offset += header.byteLength + item.compressed.byteLength\n }\n const centralStart = offset\n for (const item of items) {\n const nameBytes = ENC.encode(item.name)\n const central = new Uint8Array(46 + nameBytes.byteLength)\n writeU32LE(central, 0, 0x02014b50)\n writeU16LE(central, 4, 20)\n writeU16LE(central, 6, 20)\n writeU16LE(central, 8, 0)\n writeU16LE(central, 10, item.method)\n writeU16LE(central, 12, 0)\n writeU16LE(central, 14, 0)\n writeU32LE(central, 16, item.crc)\n writeU32LE(central, 20, item.compressed.byteLength)\n writeU32LE(central, 24, item.data.byteLength)\n writeU16LE(central, 28, nameBytes.byteLength)\n writeU16LE(central, 30, 0)\n writeU16LE(central, 32, 0)\n writeU16LE(central, 34, 0)\n writeU16LE(central, 36, 0)\n writeU32LE(central, 38, 0)\n writeU32LE(central, 42, item.localOffset)\n central.set(nameBytes, 46)\n parts.push(central)\n offset += central.byteLength\n }\n const centralSize = offset - centralStart\n const end = new Uint8Array(22)\n writeU32LE(end, 0, 0x06054b50)\n writeU16LE(end, 4, 0)\n writeU16LE(end, 6, 0)\n writeU16LE(end, 8, items.length)\n writeU16LE(end, 10, items.length)\n writeU32LE(end, 12, centralSize)\n writeU32LE(end, 16, centralStart)\n writeU16LE(end, 20, 0)\n parts.push(end)\n return concat(parts)\n}\n\nasync function zipCommand(\n accessor: RedisAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode('zip: usage: zip archive.zip file1 [file2 ...]\\n'),\n }),\n ]\n }\n const archivePath = paths[0]\n const filePaths = paths.slice(1)\n if (archivePath === undefined) return [null, new IOResult()]\n const junkPaths = opts.flags.j === true\n const quiet = opts.flags.q === true\n\n const items: ZipItem[] = []\n const outputLines: string[] = []\n for (const p of filePaths) {\n const raw = await materialize(redisStream(accessor, p))\n const data = new Uint8Array(raw.byteLength)\n data.set(raw)\n const arcname = junkPaths ? basename(p.original) : p.original.replace(/^\\/+/, '')\n const compressed = await deflateRaw(data)\n items.push({\n name: arcname,\n data,\n compressed,\n crc: crc32(data),\n method: 8,\n localOffset: 0,\n })\n if (!quiet) outputLines.push(` adding: ${arcname}`)\n }\n const archive = buildZip(items)\n await redisWrite(accessor, archivePath, archive)\n const stdout: ByteSource | null =\n outputLines.length > 0 ? ENC.encode(outputLines.join('\\n') + '\\n') : null\n return [stdout, new IOResult({ writes: { [archivePath.stripPrefix]: archive } })]\n}\n\nexport const REDIS_ZIP = command({\n name: 'zip',\n resource: ResourceName.REDIS,\n spec: specOf('zip'),\n fn: zipCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RegisteredCommand } from '@struktoai/mirage-core'\nimport { REDIS_AWK } from './awk.ts'\nimport { RAM_BASE64 } from './base64_cmd.ts'\nimport { REDIS_BASENAME } from './basename.ts'\nimport { REDIS_CAT } from './cat/cat.ts'\nimport { REDIS_CAT_FEATHER } from './cat/cat_feather.ts'\nimport { RAM_CAT_HDF5 } from './cat/cat_hdf5.ts'\nimport { REDIS_CAT_PARQUET } from './cat/cat_parquet.ts'\nimport { REDIS_CMP } from './cmp.ts'\nimport { REDIS_COLUMN } from './column.ts'\nimport { REDIS_COMM } from './comm.ts'\nimport { REDIS_CP } from './cp.ts'\nimport { REDIS_CSPLIT } from './csplit.ts'\nimport { REDIS_CUT } from './cut/cut.ts'\nimport { REDIS_CUT_FEATHER } from './cut/cut_feather.ts'\nimport { RAM_CUT_HDF5 } from './cut/cut_hdf5.ts'\nimport { REDIS_CUT_PARQUET } from './cut/cut_parquet.ts'\nimport { REDIS_DIFF } from './diff.ts'\nimport { REDIS_DIRNAME } from './dirname.ts'\nimport { REDIS_DU } from './du.ts'\nimport { REDIS_EXPAND } from './expand.ts'\nimport { REDIS_FILE } from './file/file.ts'\nimport { REDIS_FILE_FEATHER } from './file/file_feather.ts'\nimport { RAM_FILE_HDF5 } from './file/file_hdf5.ts'\nimport { REDIS_FILE_PARQUET } from './file/file_parquet.ts'\nimport { REDIS_FIND } from './find.ts'\nimport { REDIS_FMT } from './fmt.ts'\nimport { REDIS_FOLD } from './fold.ts'\nimport { REDIS_GREP } from './grep/grep.ts'\nimport { REDIS_GREP_FEATHER } from './grep/grep_feather.ts'\nimport { RAM_GREP_HDF5 } from './grep/grep_hdf5.ts'\nimport { REDIS_GREP_PARQUET } from './grep/grep_parquet.ts'\nimport { REDIS_GUNZIP } from './gunzip.ts'\nimport { REDIS_GZIP } from './gzip.ts'\nimport { REDIS_HEAD } from './head/head.ts'\nimport { REDIS_HEAD_FEATHER } from './head/head_feather.ts'\nimport { RAM_HEAD_HDF5 } from './head/head_hdf5.ts'\nimport { REDIS_HEAD_PARQUET } from './head/head_parquet.ts'\nimport { REDIS_ICONV } from './iconv.ts'\nimport { REDIS_JOIN } from './join.ts'\nimport { REDIS_JQ } from './jq.ts'\nimport { REDIS_LN } from './ln.ts'\nimport { REDIS_LOOK } from './look.ts'\nimport { REDIS_LS } from './ls/ls.ts'\nimport { REDIS_LS_FEATHER } from './ls/ls_feather.ts'\nimport { RAM_LS_HDF5 } from './ls/ls_hdf5.ts'\nimport { REDIS_LS_PARQUET } from './ls/ls_parquet.ts'\nimport { RAM_MD5 } from './md5.ts'\nimport { REDIS_MKDIR } from './mkdir.ts'\nimport { REDIS_MKTEMP } from './mktemp.ts'\nimport { REDIS_MV } from './mv.ts'\nimport { REDIS_NL } from './nl.ts'\nimport { REDIS_PASTE } from './paste.ts'\nimport { REDIS_PATCH } from './patch.ts'\nimport { REDIS_READLINK } from './readlink.ts'\nimport { REDIS_REALPATH } from './realpath.ts'\nimport { REDIS_REV } from './rev.ts'\nimport { REDIS_RG } from './rg.ts'\nimport { REDIS_RM } from './rm.ts'\nimport { REDIS_SED } from './sed.ts'\nimport { RAM_SHA256SUM } from './sha256sum.ts'\nimport { REDIS_SHUF } from './shuf.ts'\nimport { REDIS_SORT } from './sort.ts'\nimport { REDIS_SPLIT } from './split.ts'\nimport { REDIS_STAT } from './stat/stat.ts'\nimport { REDIS_STAT_FEATHER } from './stat/stat_feather.ts'\nimport { RAM_STAT_HDF5 } from './stat/stat_hdf5.ts'\nimport { REDIS_STAT_PARQUET } from './stat/stat_parquet.ts'\nimport { REDIS_STRINGS } from './strings.ts'\nimport { REDIS_TAC } from './tac.ts'\nimport { REDIS_TAIL } from './tail/tail.ts'\nimport { REDIS_TAIL_FEATHER } from './tail/tail_feather.ts'\nimport { RAM_TAIL_HDF5 } from './tail/tail_hdf5.ts'\nimport { REDIS_TAIL_PARQUET } from './tail/tail_parquet.ts'\nimport { REDIS_TAR } from './tar.ts'\nimport { REDIS_TEE } from './tee.ts'\nimport { REDIS_TOUCH } from './touch.ts'\nimport { REDIS_TR } from './tr.ts'\nimport { REDIS_TREE } from './tree.ts'\nimport { REDIS_TSORT } from './tsort.ts'\nimport { REDIS_UNEXPAND } from './unexpand.ts'\nimport { REDIS_UNIQ } from './uniq.ts'\nimport { REDIS_UNZIP } from './unzip.ts'\nimport { REDIS_WC } from './wc/wc.ts'\nimport { REDIS_WC_FEATHER } from './wc/wc_feather.ts'\nimport { RAM_WC_HDF5 } from './wc/wc_hdf5.ts'\nimport { REDIS_WC_PARQUET } from './wc/wc_parquet.ts'\nimport { REDIS_XXD } from './xxd.ts'\nimport { REDIS_ZCAT } from './zcat.ts'\nimport { REDIS_ZGREP } from './zgrep.ts'\nimport { REDIS_ZIP } from './zip_cmd.ts'\n\nexport const REDIS_COMMANDS: readonly RegisteredCommand[] = [\n ...REDIS_AWK,\n ...RAM_BASE64,\n ...REDIS_BASENAME,\n ...REDIS_CAT,\n ...REDIS_CAT_FEATHER,\n ...RAM_CAT_HDF5,\n ...REDIS_CAT_PARQUET,\n ...REDIS_CMP,\n ...REDIS_COLUMN,\n ...REDIS_COMM,\n ...REDIS_CP,\n ...REDIS_CSPLIT,\n ...REDIS_CUT,\n ...REDIS_CUT_FEATHER,\n ...RAM_CUT_HDF5,\n ...REDIS_CUT_PARQUET,\n ...REDIS_DIFF,\n ...REDIS_DIRNAME,\n ...REDIS_DU,\n ...REDIS_EXPAND,\n ...REDIS_FILE,\n ...REDIS_FILE_FEATHER,\n ...RAM_FILE_HDF5,\n ...REDIS_FILE_PARQUET,\n ...REDIS_FIND,\n ...REDIS_FMT,\n ...REDIS_FOLD,\n ...REDIS_GREP,\n ...REDIS_GREP_FEATHER,\n ...RAM_GREP_HDF5,\n ...REDIS_GREP_PARQUET,\n ...REDIS_GUNZIP,\n ...REDIS_GZIP,\n ...REDIS_HEAD,\n ...REDIS_HEAD_FEATHER,\n ...RAM_HEAD_HDF5,\n ...REDIS_HEAD_PARQUET,\n ...REDIS_ICONV,\n ...REDIS_JOIN,\n ...REDIS_JQ,\n ...REDIS_LN,\n ...REDIS_LOOK,\n ...REDIS_LS,\n ...REDIS_LS_FEATHER,\n ...RAM_LS_HDF5,\n ...REDIS_LS_PARQUET,\n ...RAM_MD5,\n ...REDIS_MKDIR,\n ...REDIS_MKTEMP,\n ...REDIS_MV,\n ...REDIS_NL,\n ...REDIS_PASTE,\n ...REDIS_PATCH,\n ...REDIS_READLINK,\n ...REDIS_REALPATH,\n ...REDIS_REV,\n ...REDIS_RG,\n ...REDIS_RM,\n ...REDIS_SED,\n ...RAM_SHA256SUM,\n ...REDIS_SHUF,\n ...REDIS_SORT,\n ...REDIS_SPLIT,\n ...REDIS_STAT,\n ...REDIS_STAT_FEATHER,\n ...RAM_STAT_HDF5,\n ...REDIS_STAT_PARQUET,\n ...REDIS_STRINGS,\n ...REDIS_TAC,\n ...REDIS_TAIL,\n ...REDIS_TAIL_FEATHER,\n ...RAM_TAIL_HDF5,\n ...REDIS_TAIL_PARQUET,\n ...REDIS_TAR,\n ...REDIS_TEE,\n ...REDIS_TOUCH,\n ...REDIS_TR,\n ...REDIS_TREE,\n ...REDIS_TSORT,\n ...REDIS_UNEXPAND,\n ...REDIS_UNIQ,\n ...REDIS_UNZIP,\n ...REDIS_WC,\n ...REDIS_WC_FEATHER,\n ...RAM_WC_HDF5,\n ...REDIS_WC_PARQUET,\n ...REDIS_XXD,\n ...REDIS_ZCAT,\n ...REDIS_ZGREP,\n ...REDIS_ZIP,\n]\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { Accessor } from '@struktoai/mirage-core'\nimport type { RedisStore } from '../resource/redis/store.ts'\n\nexport class RedisAccessor extends Accessor {\n readonly store: RedisStore\n\n constructor(store: RedisStore) {\n super()\n this.store = store\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { record, ResourceName, type PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm, nowIso } from './utils.ts'\n\nexport async function appendBytes(\n accessor: RedisAccessor,\n path: PathSpec,\n data: Uint8Array,\n): Promise<void> {\n const start = performance.now()\n const p = norm(path.stripPrefix)\n const store = accessor.store\n const existing = await store.getFile(p)\n if (existing !== null) {\n const merged = new Uint8Array(existing.byteLength + data.byteLength)\n merged.set(existing, 0)\n merged.set(data, existing.byteLength)\n await store.setFile(p, merged)\n } else {\n await store.setFile(p, data)\n }\n await store.setModified(p, nowIso())\n record('append', p, ResourceName.REDIS, data.byteLength, start)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm, nowIso } from './utils.ts'\n\nexport async function copy(accessor: RedisAccessor, src: PathSpec, dst: PathSpec): Promise<void> {\n const s = norm(src.stripPrefix)\n const d = norm(dst.stripPrefix)\n const store = accessor.store\n const data = await store.getFile(s)\n if (data === null) {\n throw new Error(`file not found: ${s}`)\n }\n await store.setFile(d, data)\n await store.setModified(d, nowIso())\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm, nowIso } from './utils.ts'\n\nexport async function create(accessor: RedisAccessor, path: PathSpec): Promise<void> {\n const p = norm(path.stripPrefix)\n const store = accessor.store\n await store.setFile(p, new Uint8Array(0))\n await store.setModified(p, nowIso())\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { type IndexCacheStore, PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { SCOPE_ERROR } from './constants.ts'\nimport { readdir } from './readdir.ts'\n\nfunction fnmatch(name: string, pattern: string): boolean {\n let re = '^'\n for (const ch of pattern) {\n if (ch === '*') re += '.*'\n else if (ch === '?') re += '.'\n else if (/[.+^${}()|[\\]\\\\]/.test(ch)) re += '\\\\' + ch\n else re += ch\n }\n re += '$'\n return new RegExp(re).test(name)\n}\n\nfunction basenameOf(p: string): string {\n return p.slice(p.lastIndexOf('/') + 1)\n}\n\nexport async function resolveGlob(\n accessor: RedisAccessor,\n paths: readonly PathSpec[],\n index?: IndexCacheStore,\n): Promise<PathSpec[]> {\n const result: PathSpec[] = []\n for (const p of paths) {\n if (p.resolved) {\n result.push(p)\n } else if (p.pattern !== null) {\n const dirSpec = new PathSpec({\n original: p.directory,\n directory: p.directory,\n resolved: true,\n prefix: p.prefix,\n })\n const entries = await readdir(accessor, dirSpec, index)\n const matched: PathSpec[] = []\n for (const e of entries) {\n if (fnmatch(basenameOf(e), p.pattern)) {\n matched.push(\n new PathSpec({\n original: e,\n directory: p.directory,\n resolved: true,\n prefix: p.prefix,\n }),\n )\n }\n }\n if (matched.length > SCOPE_ERROR) matched.length = SCOPE_ERROR\n result.push(...matched)\n } else {\n result.push(p)\n }\n }\n return result\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport const SCOPE_WARN = 5000\nexport const SCOPE_ERROR = 50000\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { norm, nowIso } from './utils.ts'\n\nexport async function truncate(\n accessor: RedisAccessor,\n path: PathSpec,\n length: number,\n): Promise<void> {\n const p = norm(path.stripPrefix)\n const store = accessor.store\n const existing = await store.getFile(p)\n const data = existing ?? new Uint8Array(0)\n const out = new Uint8Array(length)\n const copyLen = Math.min(data.byteLength, length)\n out.set(data.subarray(0, copyLen), 0)\n await store.setFile(p, out)\n await store.setModified(p, nowIso())\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { appendBytes } from '../../core/redis/append.ts'\n\nexport const appendOp: RegisteredOp = {\n name: 'append',\n resource: ResourceName.REDIS,\n filetype: null,\n write: true,\n fn: (accessor: RedisAccessor, path: PathSpec, args: readonly unknown[]) => {\n const data = args[0]\n if (!(data instanceof Uint8Array)) {\n throw new TypeError('append op requires a Uint8Array as the first arg')\n }\n return appendBytes(accessor, path, data)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { create } from '../../core/redis/create.ts'\n\nexport const createOp: RegisteredOp = {\n name: 'create',\n resource: ResourceName.REDIS,\n filetype: null,\n write: true,\n fn: (accessor: RedisAccessor, path: PathSpec) => {\n return create(accessor, path)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { mkdir } from '../../core/redis/mkdir.ts'\n\nexport const mkdirOp: RegisteredOp = {\n name: 'mkdir',\n resource: ResourceName.REDIS,\n filetype: null,\n write: true,\n fn: (accessor: RedisAccessor, path: PathSpec, args: readonly unknown[]) => {\n const parents = args[0]\n return mkdir(accessor, path, parents === true)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { read as coreRead } from '../../core/redis/read.ts'\n\nexport const readOp: RegisteredOp = {\n name: 'read',\n resource: ResourceName.REDIS,\n filetype: null,\n write: false,\n fn: (accessor: RedisAccessor, path: PathSpec) => {\n return coreRead(accessor, path)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n featherCat,\n type OpKwargs,\n type PathSpec,\n type RegisteredOp,\n ResourceName,\n} from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { read as coreRead } from '../../core/redis/read.ts'\n\nexport const readFeatherOp: RegisteredOp = {\n name: 'read',\n resource: ResourceName.REDIS,\n filetype: '.feather',\n write: false,\n fn: async (\n accessor: RedisAccessor,\n path: PathSpec,\n _args: readonly unknown[],\n kwargs: OpKwargs,\n ) => {\n const raw = await coreRead(accessor, path, kwargs.index)\n return featherCat(raw)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n hdf5Cat,\n type OpKwargs,\n type PathSpec,\n type RegisteredOp,\n ResourceName,\n} from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { read as coreRead } from '../../core/redis/read.ts'\n\nexport const readHdf5Op: RegisteredOp = {\n name: 'read',\n resource: ResourceName.REDIS,\n filetype: '.hdf5',\n write: false,\n fn: async (\n accessor: RedisAccessor,\n path: PathSpec,\n _args: readonly unknown[],\n kwargs: OpKwargs,\n ) => {\n const raw = await coreRead(accessor, path, kwargs.index)\n return hdf5Cat(raw)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type OpKwargs,\n parquetCat,\n type PathSpec,\n type RegisteredOp,\n ResourceName,\n} from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { read as coreRead } from '../../core/redis/read.ts'\n\nexport const readParquetOp: RegisteredOp = {\n name: 'read',\n resource: ResourceName.REDIS,\n filetype: '.parquet',\n write: false,\n fn: async (\n accessor: RedisAccessor,\n path: PathSpec,\n _args: readonly unknown[],\n kwargs: OpKwargs,\n ) => {\n const raw = await coreRead(accessor, path, kwargs.index)\n return parquetCat(raw)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { readdir } from '../../core/redis/readdir.ts'\n\nexport const readdirOp: RegisteredOp = {\n name: 'readdir',\n resource: ResourceName.REDIS,\n filetype: null,\n write: false,\n fn: (accessor: RedisAccessor, path: PathSpec) => {\n return readdir(accessor, path)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { rename } from '../../core/redis/rename.ts'\n\nexport const renameOp: RegisteredOp = {\n name: 'rename',\n resource: ResourceName.REDIS,\n filetype: null,\n write: true,\n fn: (accessor: RedisAccessor, path: PathSpec, args: readonly unknown[]) => {\n const dst = args[0]\n if (dst === undefined || dst === null || typeof dst !== 'object' || !('original' in dst)) {\n throw new TypeError('rename op requires a PathSpec destination as the first arg')\n }\n return rename(accessor, path, dst as PathSpec)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { rmdir } from '../../core/redis/rmdir.ts'\n\nexport const rmdirOp: RegisteredOp = {\n name: 'rmdir',\n resource: ResourceName.REDIS,\n filetype: null,\n write: true,\n fn: (accessor: RedisAccessor, path: PathSpec) => {\n return rmdir(accessor, path)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { stat as coreStat } from '../../core/redis/stat.ts'\n\nexport const statOp: RegisteredOp = {\n name: 'stat',\n resource: ResourceName.REDIS,\n filetype: null,\n write: false,\n fn: (accessor: RedisAccessor, path: PathSpec) => {\n return coreStat(accessor, path)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { truncate } from '../../core/redis/truncate.ts'\n\nexport const truncateOp: RegisteredOp = {\n name: 'truncate',\n resource: ResourceName.REDIS,\n filetype: null,\n write: true,\n fn: (accessor: RedisAccessor, path: PathSpec, args: readonly unknown[]) => {\n const length = args[0]\n if (typeof length !== 'number') {\n throw new TypeError('truncate op requires a number length as the first arg')\n }\n return truncate(accessor, path, length)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { unlink } from '../../core/redis/unlink.ts'\n\nexport const unlinkOp: RegisteredOp = {\n name: 'unlink',\n resource: ResourceName.REDIS,\n filetype: null,\n write: true,\n fn: (accessor: RedisAccessor, path: PathSpec) => {\n return unlink(accessor, path)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { extractWriteData, type PathSpec, type RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../accessor/redis.ts'\nimport { writeBytes } from '../../core/redis/write.ts'\n\nexport const writeOp: RegisteredOp = {\n name: 'write',\n resource: ResourceName.REDIS,\n filetype: null,\n write: true,\n fn: (accessor: RedisAccessor, path: PathSpec, args: readonly unknown[]) => {\n const data = extractWriteData(args)\n return writeBytes(accessor, path, data)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RegisteredOp } from '@struktoai/mirage-core'\nimport { appendOp } from './append.ts'\nimport { createOp } from './create.ts'\nimport { mkdirOp } from './mkdir.ts'\nimport { readOp } from './read.ts'\nimport { readFeatherOp } from './read_feather.ts'\nimport { readHdf5Op } from './read_hdf5.ts'\nimport { readParquetOp } from './read_parquet.ts'\nimport { readdirOp } from './readdir.ts'\nimport { renameOp } from './rename.ts'\nimport { rmdirOp } from './rmdir.ts'\nimport { statOp } from './stat.ts'\nimport { truncateOp } from './truncate.ts'\nimport { unlinkOp } from './unlink.ts'\nimport { writeOp } from './write.ts'\n\nexport const REDIS_OPS: readonly RegisteredOp[] = [\n appendOp,\n createOp,\n mkdirOp,\n readOp,\n readFeatherOp,\n readHdf5Op,\n readParquetOp,\n readdirOp,\n renameOp,\n rmdirOp,\n statOp,\n truncateOp,\n unlinkOp,\n writeOp,\n]\n\nexport {\n appendOp,\n createOp,\n mkdirOp,\n readOp,\n readFeatherOp,\n readHdf5Op,\n readParquetOp,\n readdirOp,\n renameOp,\n rmdirOp,\n statOp,\n truncateOp,\n unlinkOp,\n writeOp,\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport const REDIS_PROMPT = `Redis-backed persistent filesystem. Behaves like a standard filesystem.\nStandard commands: ls, cat, head, tail, grep, wc, find, tree, mkdir, touch, cp, mv, rm, tee.`\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport { loadOptionalPeer, type OptionalPeerConfig } from '@struktoai/mirage-core'\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RedisClientType } from 'redis'\nimport { loadOptionalPeer } from '../../optional_peer.ts'\n\nexport interface RedisStoreOptions {\n url?: string\n client?: RedisClientType\n keyPrefix?: string\n}\n\nexport class RedisStore {\n readonly url: string\n readonly keyPrefix: string\n private readonly providedClient: RedisClientType | null\n private clientPromise: Promise<RedisClientType> | null = null\n\n constructor(options: RedisStoreOptions = {}) {\n this.url = options.url ?? 'redis://localhost:6379/0'\n this.keyPrefix = options.keyPrefix ?? 'mirage:fs:'\n this.providedClient = options.client ?? null\n }\n\n fk(path: string): string {\n return `${this.keyPrefix}file:${path}`\n }\n\n dk(): string {\n return `${this.keyPrefix}dir`\n }\n\n mk(path: string): string {\n return `${this.keyPrefix}modified:${path}`\n }\n\n async client(): Promise<RedisClientType> {\n if (this.providedClient !== null) return this.providedClient\n this.clientPromise ??= (async () => {\n const mod = await loadOptionalPeer(\n () =>\n import('redis') as unknown as Promise<{\n createClient: (o: { url: string }) => RedisClientType\n }>,\n { feature: 'RedisResource / RedisFileCacheStore', packageName: 'redis' },\n )\n const c = mod.createClient({\n url: this.url,\n socket: { reconnectStrategy: false },\n } as Parameters<typeof mod.createClient>[0])\n await c.connect()\n await c.sAdd(this.dk(), '/')\n return c\n })()\n return this.clientPromise\n }\n\n async getFile(path: string): Promise<Uint8Array | null> {\n const c = await this.client()\n const typed = c as unknown as {\n withTypeMapping: (m: Record<number, unknown>) => {\n get: (k: string) => Promise<Buffer | null>\n }\n }\n const mod = (await import('redis')) as unknown as {\n RESP_TYPES: { readonly BLOB_STRING: number }\n }\n const blob = mod.RESP_TYPES.BLOB_STRING\n const mapping: Record<number, unknown> = { [blob]: Buffer }\n const raw = await typed.withTypeMapping(mapping).get(this.fk(path))\n if (raw === null) return null\n return new Uint8Array(raw.buffer, raw.byteOffset, raw.byteLength)\n }\n\n async setFile(path: string, data: Uint8Array): Promise<void> {\n const c = await this.client()\n await c.set(this.fk(path), Buffer.from(data.buffer, data.byteOffset, data.byteLength))\n }\n\n async delFile(path: string): Promise<void> {\n const c = await this.client()\n await c.del(this.fk(path))\n }\n\n async hasFile(path: string): Promise<boolean> {\n const c = await this.client()\n return (await c.exists(this.fk(path))) > 0\n }\n\n async listFiles(prefix = ''): Promise<string[]> {\n const c = await this.client()\n const pattern = `${this.keyPrefix}file:${prefix}*`\n const strip = `${this.keyPrefix}file:`.length\n const result: string[] = []\n for await (const k of c.scanIterator({ MATCH: pattern })) {\n const keys = Array.isArray(k) ? k : [k]\n for (const key of keys) result.push(key.slice(strip))\n }\n return result.sort()\n }\n\n async fileLen(path: string): Promise<number> {\n const c = await this.client()\n return c.strLen(this.fk(path))\n }\n\n async getRange(path: string, start: number, end: number): Promise<Uint8Array> {\n const c = await this.client()\n const typed = c as unknown as {\n withTypeMapping: (m: Record<number, unknown>) => {\n getRange: (k: string, s: number, e: number) => Promise<Buffer>\n }\n }\n const mod = (await import('redis')) as unknown as {\n RESP_TYPES: { readonly BLOB_STRING: number }\n }\n const blob = mod.RESP_TYPES.BLOB_STRING\n const mapping: Record<number, unknown> = { [blob]: Buffer }\n const raw = await typed.withTypeMapping(mapping).getRange(this.fk(path), start, end)\n return new Uint8Array(raw.buffer, raw.byteOffset, raw.byteLength)\n }\n\n async hasDir(path: string): Promise<boolean> {\n const c = await this.client()\n return (await c.sIsMember(this.dk(), path)) === 1\n }\n\n async addDir(path: string): Promise<void> {\n const c = await this.client()\n await c.sAdd(this.dk(), path)\n }\n\n async removeDir(path: string): Promise<void> {\n const c = await this.client()\n await c.sRem(this.dk(), path)\n }\n\n async listDirs(): Promise<Set<string>> {\n const c = await this.client()\n const members = await c.sMembers(this.dk())\n return new Set(members)\n }\n\n async getModified(path: string): Promise<string | null> {\n const c = await this.client()\n return c.get(this.mk(path))\n }\n\n async setModified(path: string, ts: string): Promise<void> {\n const c = await this.client()\n await c.set(this.mk(path), ts)\n }\n\n async delModified(path: string): Promise<void> {\n const c = await this.client()\n await c.del(this.mk(path))\n }\n\n async clear(): Promise<void> {\n const c = await this.client()\n for (const pattern of [`${this.keyPrefix}file:*`, `${this.keyPrefix}modified:*`]) {\n const keys: string[] = []\n for await (const k of c.scanIterator({ MATCH: pattern })) {\n if (Array.isArray(k)) keys.push(...k)\n else keys.push(k)\n }\n if (keys.length > 0) await c.del(keys)\n }\n await c.del(this.dk())\n }\n\n async close(): Promise<void> {\n if (this.providedClient !== null) return\n if (this.clientPromise === null) return\n const c = await this.clientPromise\n const typed = c as unknown as { destroy?: () => void }\n if (typeof typed.destroy === 'function') typed.destroy()\n else if (c.isOpen) await c.quit()\n this.clientPromise = null\n }\n}\n"],"mappings":";AAcA;AAAA,EAIE,YAAAA;AAAA,EACA;AAAA,EAIA,gBAAAC;AAAA,OACK;;;ACVP;AAAA,EACE;AAAA,EACA;AAAA,EACA,gBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;;;AC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A,MACf,gBAAgB,CAAC,KAAK;AAAA,MACtB,WAAW,KAAK;AAAA,MAChB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,UAAU,OAA0C;AACxD,UAAM,IAAI,MAAM,KAAK,MAAM,OAAO;AAClC,UAAM,OAAO,EAAE,MAAM;AACrB,UAAM,SAAS,GAAG,KAAK,SAAS;AAChC,eAAW,CAAC,MAAM,IAAI,KAAK,OAAO,QAAQ,MAAM,KAAK,GAAG;AACtD,WAAK;AAAA,QACH,GAAG,KAAK,SAAS,QAAQ,IAAI;AAAA,QAC7B,OAAO,KAAK,KAAK,QAAQ,KAAK,YAAY,KAAK,UAAU;AAAA,MAC3D;AAAA,IACF;AACA,eAAW,OAAO,MAAM,MAAM;AAC5B,WAAK,KAAK,QAAQ,GAAG;AAAA,IACvB;AACA,UAAM,KAAK,KAAK;AAAA,EAClB;AACF;","names":["PathSpec","ResourceName","ResourceName","ResourceName","IOResult","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","materialize","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","AsyncLineIterator","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","limit","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","splitLinesNoTrailing","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ResourceName","ResourceName","record","ResourceName","record","ResourceName","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","materialize","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","readFile","materialize","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","IOResult","PathSpec","ResourceName","command","specOf","PathSpec","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","materialize","result","IOResult","readStdinAsync","command","ResourceName","specOf","FileType","IOResult","ResourceName","command","specOf","ENC","IOResult","FileType","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","specOf","basename","PathSpec","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","materialize","result","IOResult","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","materialize","result","IOResult","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","readFile","materialize","splitLinesNoTrailing","IOResult","pat","source","stream","io","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","resolveSource","specOf","ENC","makePathSpec","PathSpec","resolveSource","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","gunzip","materialize","resolveSource","specOf","ENC","makePathSpec","PathSpec","decompress","resolveSource","IOResult","materialize","gunzip","concat","command","ResourceName","specOf","AsyncLineIterator","IOResult","ProvisionResult","ResourceName","command","resolveSource","specOf","ENC","AsyncLineIterator","ProvisionResult","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","readStdinAsync","specOf","ENC","IOResult","materialize","readStdinAsync","PathSpec","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","splitLinesNoTrailing","splitFields","IOResult","materialize","command","ResourceName","specOf","IOResult","Precision","ProvisionResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","ProvisionResult","Precision","concat","readFile","materialize","IOResult","bytes","data","result","spread","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","FileType","IOResult","PathSpec","ResourceName","command","specOf","humanSize","PathSpec","FileType","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","stat","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","stat","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","stat","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","materialize","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","IOResult","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","specOf","ENC","makePathSpec","PathSpec","parent","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","IOResult","command","ResourceName","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","AsyncLineIterator","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","readStdinAsync","materialize","IOResult","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","makePathSpec","PathSpec","stripMount","materialize","readStdinAsync","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","normalize","IOResult","ResourceName","command","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","AsyncLineIterator","IOResult","resolveSource","command","ResourceName","specOf","FileType","IOResult","PathSpec","ResourceName","command","compilePattern","exitOnEmpty","grepStream","materialize","resolveSource","specOf","ENC","IOResult","resolveSource","compilePattern","stream","grepStream","exitOnEmpty","FileType","materialize","io","PathSpec","command","ResourceName","specOf","FileType","IOResult","ResourceName","command","specOf","IOResult","FileType","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","parseProgram","readStdinAsync","specOf","ENC","DEC","readFile","materialize","IOResult","parseProgram","writes","text","out","result","readStdinAsync","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","materialize","makePathSpec","PathSpec","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","out","result","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoEnds","readFile","materialize","readStdinAsync","IOResult","command","ResourceName","specOf","AsyncLineIterator","IOResult","PathSpec","ResourceName","command","resolveSource","specOf","ENC","makePathSpec","PathSpec","resolveSource","IOResult","AsyncLineIterator","joinLines","command","ResourceName","specOf","FileType","IOResult","ProvisionResult","ResourceName","command","specOf","FileType","ProvisionResult","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","AsyncLineIterator","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","headerAggregate","materialize","readStdinAsync","specOf","ENC","readFile","materialize","raw","concat","IOResult","readStdinAsync","command","ResourceName","specOf","headerAggregate","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","gunzip","gzip","materialize","specOf","ENC","makePathSpec","PathSpec","gzip","gunzip","create","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","IOResult","readStdinAsync","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","IOResult","resolveSource","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","specOf","PathSpec","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesKeepEnds","materialize","result","IOResult","readStdinAsync","command","ResourceName","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","padLeft","out","AsyncLineIterator","parseOptions","IOResult","resolveSource","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","specOf","ENC","DEC","makePathSpec","PathSpec","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","materialize","text","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","padRight","ENC","DEC","IOResult","resolveSource","ENC","command","ResourceName","specOf","IOResult","ResourceName","command","gunzip","materialize","readStdinAsync","specOf","ENC","materialize","readStdinAsync","IOResult","gunzip","command","ResourceName","specOf","IOResult","ResourceName","command","compilePattern","gunzip","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","compilePattern","materialize","gunzip","result","readStdinAsync","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","basename","concat","IOResult","materialize","command","ResourceName","specOf","record","ResourceName","record","ResourceName","PathSpec","fnmatch","PathSpec","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","featherCat","ResourceName","ResourceName","featherCat","hdf5Cat","ResourceName","ResourceName","hdf5Cat","parquetCat","ResourceName","ResourceName","parquetCat","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","PathSpec"]}