@struktoai/mirage-node 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/README.md +1 -1
  2. package/dist/{aliyun-TMZRUYCG.js → aliyun-JMJ3PFYY.js} +3 -3
  3. package/dist/{backblaze-OHW57DLK.js → backblaze-TDFD23QO.js} +3 -3
  4. package/dist/{box-UXTCAFOZ.js → box-GQ2U2R6R.js} +2 -2
  5. package/dist/{ceph-TNN4I2FT.js → ceph-S2VOYO6G.js} +3 -3
  6. package/dist/{chunk-FXFDBF3P.js → chunk-3WIO7NBR.js} +2 -2
  7. package/dist/{chunk-O7ODGJYL.js → chunk-47AVIIOT.js} +2 -2
  8. package/dist/{chunk-Q6CDMOM6.js → chunk-7CW3BMPH.js} +2 -2
  9. package/dist/{chunk-E7RW3SBV.js → chunk-A7IVFIOP.js} +2 -2
  10. package/dist/chunk-A7IVFIOP.js.map +1 -0
  11. package/dist/{chunk-3T3RMDNX.js → chunk-AUHSTJJ3.js} +2 -2
  12. package/dist/{chunk-PJBQKMCD.js → chunk-DM4GSE26.js} +2 -2
  13. package/dist/{chunk-5DLOHQJ2.js → chunk-EM4J5EQS.js} +2 -2
  14. package/dist/chunk-EM4J5EQS.js.map +1 -0
  15. package/dist/{chunk-ABTEGAFB.js → chunk-EZQ5HBAC.js} +2 -2
  16. package/dist/chunk-EZQ5HBAC.js.map +1 -0
  17. package/dist/{chunk-KTNDT45N.js → chunk-FQ33BYFR.js} +2 -2
  18. package/dist/{chunk-YAVGCQUP.js → chunk-G2WCEUQL.js} +2 -2
  19. package/dist/chunk-G2WCEUQL.js.map +1 -0
  20. package/dist/{chunk-RLGWMJD3.js → chunk-GCFYZSVR.js} +133 -3
  21. package/dist/chunk-GCFYZSVR.js.map +1 -0
  22. package/dist/{chunk-NHS7WLEQ.js → chunk-GS5AUKUO.js} +2 -2
  23. package/dist/chunk-GS5AUKUO.js.map +1 -0
  24. package/dist/{chunk-BYTU2YC3.js → chunk-HGCRXJGP.js} +2 -2
  25. package/dist/{chunk-G5BZE7UA.js → chunk-HJJMP6IX.js} +2 -2
  26. package/dist/{chunk-IQVNVTOP.js → chunk-I5THIMPP.js} +2 -2
  27. package/dist/chunk-IDYHQQOH.js +1095 -0
  28. package/dist/chunk-IDYHQQOH.js.map +1 -0
  29. package/dist/{chunk-C6NHFMIP.js → chunk-IK2L4EN3.js} +2 -2
  30. package/dist/{chunk-LYDMMNL2.js → chunk-JAGJTM3Q.js} +2 -2
  31. package/dist/chunk-JAGJTM3Q.js.map +1 -0
  32. package/dist/{chunk-A7X4L4JM.js → chunk-JCC4CU2I.js} +2 -2
  33. package/dist/chunk-JCC4CU2I.js.map +1 -0
  34. package/dist/{chunk-AJICZLHT.js → chunk-KPULTUOK.js} +2 -2
  35. package/dist/{chunk-YPT4JBUY.js → chunk-LV2G7VHL.js} +2 -2
  36. package/dist/chunk-LV2G7VHL.js.map +1 -0
  37. package/dist/{chunk-C6NHEDHY.js → chunk-M5FVUIYP.js} +2 -2
  38. package/dist/chunk-M5FVUIYP.js.map +1 -0
  39. package/dist/{chunk-HEHERHQ5.js → chunk-MPCCRRE6.js} +2 -2
  40. package/dist/chunk-MPCCRRE6.js.map +1 -0
  41. package/dist/{chunk-RQYEEA2O.js → chunk-N5FSLVKO.js} +2 -2
  42. package/dist/{chunk-CASCUFK2.js → chunk-NOHWIBRX.js} +2 -2
  43. package/dist/chunk-NOHWIBRX.js.map +1 -0
  44. package/dist/{chunk-TRTUHCS4.js → chunk-QCZ2XUKH.js} +2 -2
  45. package/dist/chunk-QCZ2XUKH.js.map +1 -0
  46. package/dist/{chunk-3IJSIVKT.js → chunk-QQBJC2FQ.js} +2 -2
  47. package/dist/{chunk-JZQHKDSY.js → chunk-RNQN2FOU.js} +2 -2
  48. package/dist/chunk-RNQN2FOU.js.map +1 -0
  49. package/dist/{chunk-DTAY7LPC.js → chunk-S5OVP467.js} +2 -2
  50. package/dist/chunk-S5OVP467.js.map +1 -0
  51. package/dist/{chunk-5YOCVEUB.js → chunk-SWCDFEUK.js} +2 -2
  52. package/dist/chunk-SWCDFEUK.js.map +1 -0
  53. package/dist/{chunk-MHCMHKM6.js → chunk-TA3WMOMU.js} +2 -2
  54. package/dist/chunk-TA3WMOMU.js.map +1 -0
  55. package/dist/{chunk-WSGEIVY3.js → chunk-TURD42QO.js} +101 -85
  56. package/dist/chunk-TURD42QO.js.map +1 -0
  57. package/dist/{chunk-WL7HS7EM.js → chunk-UINQOUZR.js} +2 -2
  58. package/dist/{chunk-A4Z6DZ22.js → chunk-VWKUT4CW.js} +2 -2
  59. package/dist/chunk-VWKUT4CW.js.map +1 -0
  60. package/dist/{chunk-ERELJ7BS.js → chunk-WAR4Q2NM.js} +2 -2
  61. package/dist/chunk-WAR4Q2NM.js.map +1 -0
  62. package/dist/{chunk-5HCVKTP3.js → chunk-WHFUWWI6.js} +92 -81
  63. package/dist/chunk-WHFUWWI6.js.map +1 -0
  64. package/dist/{chunk-HQ4KWN76.js → chunk-X3G37FXT.js} +2 -2
  65. package/dist/{chunk-OYV2DN66.js → chunk-X5HF2OFP.js} +2 -2
  66. package/dist/chunk-XWVDS66D.js +963 -0
  67. package/dist/chunk-XWVDS66D.js.map +1 -0
  68. package/dist/{chunk-L6JPBJAS.js → chunk-YAHRT6MB.js} +2 -2
  69. package/dist/{chunk-XRU5WXZX.js → chunk-ZEGAMJO2.js} +2 -2
  70. package/dist/chunk-ZEGAMJO2.js.map +1 -0
  71. package/dist/{chunk-B6SXRCBO.js → chunk-ZGSER5TG.js} +2 -2
  72. package/dist/databricks_volume-7XOUYSTY.js +7 -0
  73. package/dist/{digitalocean-6SPR4S7V.js → digitalocean-3CQ4CPPZ.js} +3 -3
  74. package/dist/{discord-SAV2RBJV.js → discord-BG7OSRJG.js} +2 -2
  75. package/dist/{disk-POACMF4G.js → disk-XVLBCVKE.js} +2 -2
  76. package/dist/{dropbox-CQ7MTYX2.js → dropbox-74GYLV3R.js} +2 -2
  77. package/dist/{email-KBQ7CXS7.js → email-5IZ7OBQ4.js} +2 -2
  78. package/dist/{gcs-SMIE4VMT.js → gcs-EMEYU2XT.js} +3 -3
  79. package/dist/{gdocs-X5Y2SIQX.js → gdocs-R67TDPON.js} +2 -2
  80. package/dist/{gdrive-SIQPRIGI.js → gdrive-PRN2ALRK.js} +2 -2
  81. package/dist/{github-KBHWANKQ.js → github-DV7E6OFV.js} +2 -2
  82. package/dist/{github_ci-HPITNK37.js → github_ci-Q554V5PA.js} +2 -2
  83. package/dist/{gmail-DKHAGJNX.js → gmail-OLN2LT4O.js} +2 -2
  84. package/dist/{gsheets-ZSUDIWGK.js → gsheets-H4RYMQJ5.js} +2 -2
  85. package/dist/{gslides-GYXM7IMJ.js → gslides-YLCHKJOM.js} +2 -2
  86. package/dist/{hf_buckets-RIOMV7WG.js → hf_buckets-DTKXKKFF.js} +3 -3
  87. package/dist/{hf_datasets-QF4BQ3OK.js → hf_datasets-55C4APKR.js} +3 -3
  88. package/dist/{hf_models-62GC2HPZ.js → hf_models-RO5JR36V.js} +3 -3
  89. package/dist/{hf_spaces-NVSMUNRM.js → hf_spaces-ZVZ3EDRX.js} +3 -3
  90. package/dist/index.d.ts +110 -44
  91. package/dist/index.js +520 -232
  92. package/dist/index.js.map +1 -1
  93. package/dist/{langfuse-HUAYVPHF.js → langfuse-ACASJZ7O.js} +2 -2
  94. package/dist/{linear-2MM55KBC.js → linear-IC37LZV7.js} +2 -2
  95. package/dist/{minio-L3XE6PQS.js → minio-HZ576XFQ.js} +3 -3
  96. package/dist/mongodb-JVR62OIO.js +7 -0
  97. package/dist/{notion-UK4GTMT4.js → notion-HKRPQMJS.js} +2 -2
  98. package/dist/{oci-NURLWPL2.js → oci-ZLVECXTW.js} +3 -3
  99. package/dist/postgres-P36Z2YN4.js +7 -0
  100. package/dist/{qingstor-W55D5YFO.js → qingstor-YLP6K3L4.js} +3 -3
  101. package/dist/{r2-FSZK7IFI.js → r2-RPK25ANI.js} +3 -3
  102. package/dist/{redis-S6GIPA4Z.js → redis-V5ULXULL.js} +2 -2
  103. package/dist/{s3-GMPUJ65D.js → s3-4OIOCAAT.js} +2 -2
  104. package/dist/{scaleway-5VM55Y6D.js → scaleway-CCWCLUHB.js} +3 -3
  105. package/dist/{seaweedfs-J3EPUEPE.js → seaweedfs-QSWKF2FN.js} +3 -3
  106. package/dist/{slack-FVBXY7KD.js → slack-YPS7PII3.js} +2 -2
  107. package/dist/{ssh-GCXETJ3Z.js → ssh-YFP3SMTJ.js} +2 -2
  108. package/dist/{supabase-HLWNHBBE.js → supabase-6CFTOKGZ.js} +3 -3
  109. package/dist/{tencent-YDO73XBD.js → tencent-IWZZOSQ4.js} +3 -3
  110. package/dist/{trello-CQ53BQUL.js → trello-XYKWZD6P.js} +2 -2
  111. package/dist/{wasabi-SOZKPMRQ.js → wasabi-6Z4DC5S5.js} +3 -3
  112. package/package.json +7 -5
  113. package/dist/chunk-5DLOHQJ2.js.map +0 -1
  114. package/dist/chunk-5HCVKTP3.js.map +0 -1
  115. package/dist/chunk-5YOCVEUB.js.map +0 -1
  116. package/dist/chunk-A4Z6DZ22.js.map +0 -1
  117. package/dist/chunk-A7X4L4JM.js.map +0 -1
  118. package/dist/chunk-ABTEGAFB.js.map +0 -1
  119. package/dist/chunk-C6NHEDHY.js.map +0 -1
  120. package/dist/chunk-CASCUFK2.js.map +0 -1
  121. package/dist/chunk-DTAY7LPC.js.map +0 -1
  122. package/dist/chunk-E7RW3SBV.js.map +0 -1
  123. package/dist/chunk-ERELJ7BS.js.map +0 -1
  124. package/dist/chunk-HEHERHQ5.js.map +0 -1
  125. package/dist/chunk-JZQHKDSY.js.map +0 -1
  126. package/dist/chunk-LYDMMNL2.js.map +0 -1
  127. package/dist/chunk-MHCMHKM6.js.map +0 -1
  128. package/dist/chunk-N72CAZEH.js +0 -1990
  129. package/dist/chunk-N72CAZEH.js.map +0 -1
  130. package/dist/chunk-NHS7WLEQ.js.map +0 -1
  131. package/dist/chunk-PBBG7VFT.js +0 -1896
  132. package/dist/chunk-PBBG7VFT.js.map +0 -1
  133. package/dist/chunk-RLGWMJD3.js.map +0 -1
  134. package/dist/chunk-TRTUHCS4.js.map +0 -1
  135. package/dist/chunk-WSGEIVY3.js.map +0 -1
  136. package/dist/chunk-XRU5WXZX.js.map +0 -1
  137. package/dist/chunk-YAVGCQUP.js.map +0 -1
  138. package/dist/chunk-YPT4JBUY.js.map +0 -1
  139. package/dist/databricks_volume-HNQ4DJVJ.js +0 -7
  140. package/dist/mongodb-ZOX4FRHJ.js +0 -7
  141. package/dist/postgres-JNFMPAO2.js +0 -7
  142. /package/dist/{aliyun-TMZRUYCG.js.map → aliyun-JMJ3PFYY.js.map} +0 -0
  143. /package/dist/{backblaze-OHW57DLK.js.map → backblaze-TDFD23QO.js.map} +0 -0
  144. /package/dist/{box-UXTCAFOZ.js.map → box-GQ2U2R6R.js.map} +0 -0
  145. /package/dist/{ceph-TNN4I2FT.js.map → ceph-S2VOYO6G.js.map} +0 -0
  146. /package/dist/{chunk-FXFDBF3P.js.map → chunk-3WIO7NBR.js.map} +0 -0
  147. /package/dist/{chunk-O7ODGJYL.js.map → chunk-47AVIIOT.js.map} +0 -0
  148. /package/dist/{chunk-Q6CDMOM6.js.map → chunk-7CW3BMPH.js.map} +0 -0
  149. /package/dist/{chunk-3T3RMDNX.js.map → chunk-AUHSTJJ3.js.map} +0 -0
  150. /package/dist/{chunk-PJBQKMCD.js.map → chunk-DM4GSE26.js.map} +0 -0
  151. /package/dist/{chunk-KTNDT45N.js.map → chunk-FQ33BYFR.js.map} +0 -0
  152. /package/dist/{chunk-BYTU2YC3.js.map → chunk-HGCRXJGP.js.map} +0 -0
  153. /package/dist/{chunk-G5BZE7UA.js.map → chunk-HJJMP6IX.js.map} +0 -0
  154. /package/dist/{chunk-IQVNVTOP.js.map → chunk-I5THIMPP.js.map} +0 -0
  155. /package/dist/{chunk-C6NHFMIP.js.map → chunk-IK2L4EN3.js.map} +0 -0
  156. /package/dist/{chunk-AJICZLHT.js.map → chunk-KPULTUOK.js.map} +0 -0
  157. /package/dist/{chunk-RQYEEA2O.js.map → chunk-N5FSLVKO.js.map} +0 -0
  158. /package/dist/{chunk-3IJSIVKT.js.map → chunk-QQBJC2FQ.js.map} +0 -0
  159. /package/dist/{chunk-WL7HS7EM.js.map → chunk-UINQOUZR.js.map} +0 -0
  160. /package/dist/{chunk-HQ4KWN76.js.map → chunk-X3G37FXT.js.map} +0 -0
  161. /package/dist/{chunk-OYV2DN66.js.map → chunk-X5HF2OFP.js.map} +0 -0
  162. /package/dist/{chunk-L6JPBJAS.js.map → chunk-YAHRT6MB.js.map} +0 -0
  163. /package/dist/{chunk-B6SXRCBO.js.map → chunk-ZGSER5TG.js.map} +0 -0
  164. /package/dist/{databricks_volume-HNQ4DJVJ.js.map → databricks_volume-7XOUYSTY.js.map} +0 -0
  165. /package/dist/{digitalocean-6SPR4S7V.js.map → digitalocean-3CQ4CPPZ.js.map} +0 -0
  166. /package/dist/{discord-SAV2RBJV.js.map → discord-BG7OSRJG.js.map} +0 -0
  167. /package/dist/{disk-POACMF4G.js.map → disk-XVLBCVKE.js.map} +0 -0
  168. /package/dist/{dropbox-CQ7MTYX2.js.map → dropbox-74GYLV3R.js.map} +0 -0
  169. /package/dist/{email-KBQ7CXS7.js.map → email-5IZ7OBQ4.js.map} +0 -0
  170. /package/dist/{gcs-SMIE4VMT.js.map → gcs-EMEYU2XT.js.map} +0 -0
  171. /package/dist/{gdocs-X5Y2SIQX.js.map → gdocs-R67TDPON.js.map} +0 -0
  172. /package/dist/{gdrive-SIQPRIGI.js.map → gdrive-PRN2ALRK.js.map} +0 -0
  173. /package/dist/{github-KBHWANKQ.js.map → github-DV7E6OFV.js.map} +0 -0
  174. /package/dist/{github_ci-HPITNK37.js.map → github_ci-Q554V5PA.js.map} +0 -0
  175. /package/dist/{gmail-DKHAGJNX.js.map → gmail-OLN2LT4O.js.map} +0 -0
  176. /package/dist/{gsheets-ZSUDIWGK.js.map → gsheets-H4RYMQJ5.js.map} +0 -0
  177. /package/dist/{gslides-GYXM7IMJ.js.map → gslides-YLCHKJOM.js.map} +0 -0
  178. /package/dist/{hf_buckets-RIOMV7WG.js.map → hf_buckets-DTKXKKFF.js.map} +0 -0
  179. /package/dist/{hf_datasets-QF4BQ3OK.js.map → hf_datasets-55C4APKR.js.map} +0 -0
  180. /package/dist/{hf_models-62GC2HPZ.js.map → hf_models-RO5JR36V.js.map} +0 -0
  181. /package/dist/{hf_spaces-NVSMUNRM.js.map → hf_spaces-ZVZ3EDRX.js.map} +0 -0
  182. /package/dist/{langfuse-HUAYVPHF.js.map → langfuse-ACASJZ7O.js.map} +0 -0
  183. /package/dist/{linear-2MM55KBC.js.map → linear-IC37LZV7.js.map} +0 -0
  184. /package/dist/{minio-L3XE6PQS.js.map → minio-HZ576XFQ.js.map} +0 -0
  185. /package/dist/{mongodb-ZOX4FRHJ.js.map → mongodb-JVR62OIO.js.map} +0 -0
  186. /package/dist/{notion-UK4GTMT4.js.map → notion-HKRPQMJS.js.map} +0 -0
  187. /package/dist/{oci-NURLWPL2.js.map → oci-ZLVECXTW.js.map} +0 -0
  188. /package/dist/{postgres-JNFMPAO2.js.map → postgres-P36Z2YN4.js.map} +0 -0
  189. /package/dist/{qingstor-W55D5YFO.js.map → qingstor-YLP6K3L4.js.map} +0 -0
  190. /package/dist/{r2-FSZK7IFI.js.map → r2-RPK25ANI.js.map} +0 -0
  191. /package/dist/{redis-S6GIPA4Z.js.map → redis-V5ULXULL.js.map} +0 -0
  192. /package/dist/{s3-GMPUJ65D.js.map → s3-4OIOCAAT.js.map} +0 -0
  193. /package/dist/{scaleway-5VM55Y6D.js.map → scaleway-CCWCLUHB.js.map} +0 -0
  194. /package/dist/{seaweedfs-J3EPUEPE.js.map → seaweedfs-QSWKF2FN.js.map} +0 -0
  195. /package/dist/{slack-FVBXY7KD.js.map → slack-YPS7PII3.js.map} +0 -0
  196. /package/dist/{ssh-GCXETJ3Z.js.map → ssh-YFP3SMTJ.js.map} +0 -0
  197. /package/dist/{supabase-HLWNHBBE.js.map → supabase-6CFTOKGZ.js.map} +0 -0
  198. /package/dist/{tencent-YDO73XBD.js.map → tencent-IWZZOSQ4.js.map} +0 -0
  199. /package/dist/{trello-CQ53BQUL.js.map → trello-XYKWZD6P.js.map} +0 -0
  200. /package/dist/{wasabi-SOZKPMRQ.js.map → wasabi-6Z4DC5S5.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/resource/gdrive/gdrive.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 BaseResource,\n type FileStat,\n GDRIVE_COMMANDS,\n GDRIVE_PROMPT,\n GDRIVE_VFS_OPS,\n GDriveAccessor,\n PathSpec,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n TokenManager,\n gdriveRead,\n gdriveReaddir,\n gdriveResolveGlob,\n gdriveStat,\n} from '@struktoai/mirage-core'\nimport { redactGDriveConfig, type GDriveConfig, type GDriveConfigRedacted } from './config.ts'\n\nexport interface GDriveResourceState {\n type: string\n config: GDriveConfigRedacted\n}\n\nexport class GDriveResource extends BaseResource implements Resource {\n readonly kind: string = ResourceName.GDRIVE\n readonly isRemote: boolean = true\n readonly indexTtl: number = 86_400\n readonly prompt: string = GDRIVE_PROMPT\n readonly config: GDriveConfig\n readonly accessor: GDriveAccessor\n\n constructor(config: GDriveConfig) {\n super()\n this.config = config\n const tm = new TokenManager({\n clientId: config.clientId,\n clientSecret: config.clientSecret,\n refreshToken: config.refreshToken,\n })\n this.accessor = new GDriveAccessor({ tokenManager: tm })\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n close(): Promise<void> {\n return Promise.resolve()\n }\n\n commands(): readonly RegisteredCommand[] {\n return GDRIVE_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return GDRIVE_VFS_OPS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return gdriveRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return gdriveReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return gdriveStat(this.accessor, p, this.index)\n }\n\n async fingerprint(p: PathSpec): Promise<string | null> {\n const lookup = await this.index.get(p.original)\n return lookup.entry?.remoteTime ?? null\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n 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 gdriveResolveGlob(this.accessor, effective, this.index)\n }\n\n getState(): Promise<GDriveResourceState> {\n return Promise.resolve({\n type: this.kind,\n config: redactGDriveConfig(this.config),\n })\n }\n\n loadState(_state: GDriveResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n"],"mappings":";;;;;AAcA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQA,IAAM,iBAAN,cAA6B,aAAiC;AAAA,EAC1D,OAAe,aAAa;AAAA,EAC5B,WAAoB;AAAA,EACpB,WAAmB;AAAA,EACnB,SAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EAET,YAAY,QAAsB;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A,MACrB,MAAM,KAAK;AAAA,MACX,QAAQ,mBAAmB,KAAK,MAAM;AAAA,IACxC,CAAC;AAAA,EACH;AAAA,EAEA,UAAU,QAA4C;AACpD,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/accessor/hf.ts","../src/commands/builtin/hf/awk.ts","../src/core/hf/stream.ts","../src/core/hf/constants.ts","../src/core/hf/read.ts","../src/core/hf/util.ts","../src/commands/builtin/hf/base64_cmd.ts","../src/commands/builtin/hf/basename.ts","../src/commands/builtin/hf/cat/cat.ts","../src/core/hf/glob.ts","../src/core/hf/readdir.ts","../src/core/hf/stat.ts","../src/commands/builtin/hf/provision.ts","../src/commands/builtin/hf/cmp.ts","../src/commands/builtin/hf/column.ts","../src/commands/builtin/hf/comm.ts","../src/commands/builtin/hf/csplit.ts","../src/core/hf/write.ts","../src/commands/builtin/hf/cut.ts","../src/commands/builtin/hf/diff.ts","../src/commands/builtin/hf/dirname.ts","../src/commands/builtin/hf/du.ts","../src/core/hf/du.ts","../src/commands/builtin/hf/expand.ts","../src/commands/builtin/hf/file/file.ts","../src/commands/builtin/hf/find.ts","../src/core/hf/find.ts","../src/commands/builtin/hf/fmt.ts","../src/commands/builtin/hf/fold.ts","../src/commands/builtin/hf/grep/grep.ts","../src/commands/builtin/hf/gunzip.ts","../src/core/hf/unlink.ts","../src/commands/builtin/hf/gzip.ts","../src/commands/builtin/hf/head/head.ts","../src/commands/builtin/hf/iconv.ts","../src/commands/builtin/hf/join.ts","../src/commands/builtin/hf/jq.ts","../src/commands/builtin/hf/look.ts","../src/commands/builtin/hf/ls/ls.ts","../src/commands/builtin/hf/md5.ts","../src/commands/builtin/hf/mktemp.ts","../src/core/hf/mkdir.ts","../src/commands/builtin/hf/nl.ts","../src/commands/builtin/hf/paste.ts","../src/commands/builtin/hf/readlink.ts","../src/commands/builtin/hf/realpath.ts","../src/commands/builtin/hf/rev.ts","../src/commands/builtin/hf/rg.ts","../src/commands/builtin/hf/rm.ts","../src/commands/builtin/hf/sed.ts","../src/commands/builtin/hf/sha256sum.ts","../src/commands/builtin/hf/shuf.ts","../src/commands/builtin/hf/sort.ts","../src/commands/builtin/hf/split.ts","../src/commands/builtin/hf/stat/stat.ts","../src/commands/builtin/hf/strings.ts","../src/commands/builtin/hf/tac.ts","../src/commands/builtin/hf/tail/tail.ts","../src/commands/builtin/hf/tar.ts","../src/commands/builtin/hf/touch.ts","../src/core/hf/exists.ts","../src/commands/builtin/hf/tr.ts","../src/commands/builtin/hf/tree.ts","../src/commands/builtin/hf/tsort.ts","../src/commands/builtin/hf/unexpand.ts","../src/commands/builtin/hf/uniq.ts","../src/commands/builtin/hf/unzip.ts","../src/commands/builtin/hf/wc/wc.ts","../src/commands/builtin/hf/xxd.ts","../src/commands/builtin/hf/zcat.ts","../src/commands/builtin/hf/zgrep.ts","../src/commands/builtin/hf/zip_cmd.ts","../src/commands/builtin/hf/index.ts","../src/core/hf/create.ts","../src/ops/hf/create.ts","../src/ops/hf/mkdir.ts","../src/ops/hf/read/read.ts","../src/ops/hf/read/read_feather.ts","../src/ops/hf/read/read_hdf5.ts","../src/ops/hf/read/read_parquet.ts","../src/ops/hf/readdir.ts","../src/ops/hf/stat.ts","../src/ops/hf/unlink.ts","../src/ops/hf/write.ts","../src/ops/hf/index.ts","../src/resource/hf_buckets/base.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 type { Operator } from 'opendal'\nimport { Accessor, ResourceName } from '@struktoai/mirage-core'\nimport { loadOptionalPeer } from '../optional_peer.ts'\nimport type { HfBucketsConfig, HfRepoConfig } from '../resource/hf_buckets/config.ts'\n\nexport const HF_RESOURCES = [\n ResourceName.HF_BUCKETS,\n ResourceName.HF_DATASETS,\n ResourceName.HF_MODELS,\n ResourceName.HF_SPACES,\n] as const\n\nexport abstract class HfAccessor extends Accessor {\n abstract readonly repoType: string\n abstract readonly resourceName: ResourceName\n private operatorPromise: Promise<Operator> | null = null\n\n constructor(public readonly config: HfBucketsConfig | HfRepoConfig) {\n super()\n }\n\n get repoId(): string {\n const config = this.config as { bucket?: string; repoId?: string }\n return config.repoId ?? config.bucket ?? ''\n }\n\n abstract get bucketUri(): string\n\n operatorOptions(): Record<string, string> {\n const options: Record<string, string> = {\n repo_type: this.repoType,\n repo_id: this.repoId,\n }\n if (this.config.token !== undefined && this.config.token !== '') {\n options.token = this.config.token\n }\n if (this.config.endpoint !== undefined && this.config.endpoint !== '') {\n options.endpoint = this.config.endpoint\n }\n const keyPrefix = this.config.keyPrefix\n if (keyPrefix !== undefined && keyPrefix !== '') {\n options.root = `/${stripSlashes(keyPrefix)}/`\n }\n const revision = (this.config as { revision?: string }).revision\n if (revision !== undefined && revision !== '') {\n options.revision = revision\n }\n return options\n }\n\n operator(): Promise<Operator> {\n this.operatorPromise ??= this.createOperator()\n return this.operatorPromise\n }\n\n private async createOperator(): Promise<Operator> {\n const mod = await loadOptionalPeer(\n () => import('opendal') as Promise<{ Operator: typeof Operator }>,\n { feature: 'HuggingFace resources', packageName: 'opendal' },\n )\n return new mod.Operator('hf', this.operatorOptions())\n }\n}\n\nfunction stripSlashes(value: string): string {\n let start = 0\n let end = value.length\n while (start < end && value[start] === '/') start += 1\n while (end > start && value[end - 1] === '/') end -= 1\n return value.slice(start, end)\n}\n\nexport class HfBucketsAccessor extends HfAccessor {\n readonly repoType: string = 'bucket'\n readonly resourceName: ResourceName = ResourceName.HF_BUCKETS\n\n get bucketUri(): string {\n return `hf://buckets/${this.repoId}`\n }\n}\n\nexport class HfDatasetsAccessor extends HfAccessor {\n readonly repoType: string = 'dataset'\n readonly resourceName: ResourceName = ResourceName.HF_DATASETS\n\n get bucketUri(): string {\n return `hf://datasets/${this.repoId}`\n }\n}\n\nexport class HfModelsAccessor extends HfAccessor {\n readonly repoType: string = 'model'\n readonly resourceName: ResourceName = ResourceName.HF_MODELS\n\n get bucketUri(): string {\n return `hf://models/${this.repoId}`\n }\n}\n\nexport class HfSpacesAccessor extends HfAccessor {\n readonly repoType: string = 'space'\n readonly resourceName: ResourceName = ResourceName.HF_SPACES\n\n get bucketUri(): string {\n return `hf://spaces/${this.repoId}`\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 { awkGeneric, command, specOf } from '@struktoai/mirage-core'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\n\nexport const HF_AWK = command({\n name: 'awk',\n resource: [...HF_RESOURCES],\n spec: specOf('awk'),\n fn: (accessor: HfAccessor, paths, texts, opts) =>\n awkGeneric(paths, texts, opts, (p) => hfStream(accessor, 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 IndexCacheStore, type PathSpec, recordStream } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../accessor/hf.ts'\nimport { DEFAULT_CHUNK_SIZE } from './constants.ts'\nimport { read } from './read.ts'\nimport { hfKey, isNotFound, rawPathOf } from './util.ts'\nimport { enoent } from '@struktoai/mirage-core'\n\nexport async function rangeRead(\n accessor: HfAccessor,\n path: PathSpec,\n start: number,\n end: number,\n): Promise<Uint8Array> {\n return read(accessor, path, undefined, { offset: start, size: end - start })\n}\n\nexport async function* stream(\n accessor: HfAccessor,\n path: PathSpec,\n _index?: IndexCacheStore,\n chunkSize: number = DEFAULT_CHUNK_SIZE,\n): AsyncIterable<Uint8Array> {\n const virtual = path.original\n const rawPath = rawPathOf(path)\n const key = hfKey(rawPath)\n const op = await accessor.operator()\n const rec = recordStream('read', virtual, accessor.resourceName)\n let reader\n try {\n reader = await op.reader(key)\n } catch (err) {\n if (isNotFound(err)) throw enoent(path)\n throw err\n }\n const buf = Buffer.alloc(chunkSize)\n for (;;) {\n const n = Number(await reader.read(buf))\n if (n <= 0) break\n const chunk = new Uint8Array(buf.subarray(0, n))\n if (rec !== null) rec.bytes += chunk.byteLength\n yield chunk\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\nexport const SCOPE_ERROR = 10000\nexport const DEFAULT_CHUNK_SIZE = 8192\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, record } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../accessor/hf.ts'\nimport { hfKey, isNotFound, rawPathOf } from './util.ts'\nimport { enoent } from '@struktoai/mirage-core'\n\nexport interface HfReadOptions {\n offset?: number\n size?: number\n}\n\nexport async function read(\n accessor: HfAccessor,\n path: PathSpec,\n _index?: IndexCacheStore,\n options: HfReadOptions = {},\n): Promise<Uint8Array> {\n const virtual = path.original\n const rawPath = rawPathOf(path)\n const key = hfKey(rawPath)\n const op = await accessor.operator()\n const readOptions: { offset?: bigint; size?: bigint } = {}\n if (options.offset !== undefined && options.offset > 0) {\n readOptions.offset = BigInt(options.offset)\n }\n if (options.size !== undefined) {\n readOptions.offset ??= 0n\n readOptions.size = BigInt(options.size)\n }\n const startMs = performance.now()\n let data: Buffer\n try {\n data =\n readOptions.offset !== undefined || readOptions.size !== undefined\n ? await op.read(key, readOptions)\n : await op.read(key)\n } catch (err) {\n if (isNotFound(err)) throw enoent(path)\n throw err\n }\n const bytes = new Uint8Array(data)\n record('read', virtual, accessor.resourceName, bytes.byteLength, startMs)\n return bytes\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'\n\nexport function rawPathOf(path: PathSpec): string {\n const prefix = path.prefix\n return prefix !== '' && path.original.startsWith(prefix)\n ? path.original.slice(prefix.length) || '/'\n : path.original\n}\n\nexport function hfKey(rawPath: string): string {\n let start = 0\n while (start < rawPath.length && rawPath[start] === '/') start += 1\n return rawPath.slice(start)\n}\n\nexport function isNotFound(err: unknown): boolean {\n return err instanceof Error && err.message.startsWith('NotFound')\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 { command, specOf, base64Generic } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_BASE64 = command({\n name: 'base64',\n resource: [...HF_RESOURCES],\n spec: specOf('base64'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n base64Generic(paths, opts, (p) => hfStream(accessor, 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 { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { command, specOf, basenameFn } from '@struktoai/mirage-core'\n\nexport const HF_BASENAME = command({\n name: 'basename',\n resource: [...HF_RESOURCES],\n spec: specOf('basename'),\n fn: basenameFn,\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 catGeneric,\n command,\n concatAggregate,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../../accessor/hf.ts'\nimport { resolveGlob } from '../../../../core/hf/glob.ts'\nimport { stat as hfStat } from '../../../../core/hf/stat.ts'\nimport { stream as hfStream } from '../../../../core/hf/stream.ts'\nimport { fileReadProvision } from '../provision.ts'\n\nasync function catCommand(\n accessor: HfAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const resolved =\n paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? undefined) : []\n return catGeneric(\n resolved,\n texts,\n opts,\n (p) => hfStat(accessor, p, opts.index ?? undefined),\n (p) => hfStream(accessor, p),\n )\n}\n\nexport const HF_CAT = command({\n name: 'cat',\n resource: [...HF_RESOURCES],\n spec: specOf('cat'),\n fn: catCommand,\n provision: fileReadProvision,\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 { fnmatch, type IndexCacheStore, PathSpec } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../accessor/hf.ts'\nimport { SCOPE_ERROR } from './constants.ts'\nimport { readdir } from './readdir.ts'\n\nexport async function resolveGlob(\n accessor: HfAccessor,\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 continue\n }\n if (p.pattern !== null && p.pattern !== '') {\n const entries = await readdir(accessor, p.dir, index)\n const matched: PathSpec[] = []\n for (const entry of entries) {\n const entryBase = entry.split('/').pop() ?? ''\n if (!fnmatch(entryBase, p.pattern)) continue\n matched.push(PathSpec.fromStrPath(entry, p.prefix))\n }\n if (matched.length > SCOPE_ERROR) {\n console.warn(\n `${p.directory}: ${String(matched.length)} matches exceeds limit (${String(SCOPE_ERROR)}), truncating`,\n )\n }\n const truncated = matched.length > SCOPE_ERROR ? matched.slice(0, SCOPE_ERROR) : matched\n result.push(...truncated)\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\nimport {\n IndexEntry,\n type IndexCacheStore,\n type PathSpec,\n ResourceType,\n rstripSlash,\n stripSlash,\n} from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../accessor/hf.ts'\nimport { SCOPE_ERROR } from './constants.ts'\nimport { isNotFound } from './util.ts'\nimport { enoent } from '@struktoai/mirage-core'\n\nexport async function readdir(\n accessor: HfAccessor,\n path: PathSpec,\n index?: IndexCacheStore,\n): Promise<string[]> {\n const prefix = path.prefix\n let target = path.pattern !== null ? path.directory : path.original\n if (prefix !== '' && target.startsWith(prefix)) {\n const rest = target.slice(prefix.length)\n if (prefix.endsWith('/') || rest === '' || rest.startsWith('/')) {\n target = rest || '/'\n }\n }\n const virtualKey = rstripSlash(prefix !== '' ? `${prefix}${target}` : target) || '/'\n if (index !== undefined) {\n const listing = await index.listDir(virtualKey)\n if (listing.entries !== undefined && listing.entries !== null) {\n return listing.entries\n }\n }\n const strippedTarget = stripSlash(target)\n const listPath = strippedTarget !== '' ? `${strippedTarget}/` : '/'\n const op = await accessor.operator()\n const names: string[] = []\n const dirKeys = new Set<string>()\n const sizes = new Map<string, number | null>()\n let entries\n try {\n entries = await op.list(listPath)\n } catch (err) {\n if (isNotFound(err)) throw enoent(path)\n throw err\n }\n for (const entry of entries) {\n const relative = entry.path()\n if (relative === '' || relative === listPath) continue\n const isDir = relative.endsWith('/')\n const base = `/${rstripSlash(relative)}`\n names.push(base)\n if (isDir) {\n dirKeys.add(base)\n } else {\n const meta = entry.metadata()\n const length = meta.contentLength\n sizes.set(base, length !== null ? Number(length) : null)\n }\n }\n names.sort()\n if (names.length > SCOPE_ERROR) {\n console.warn(\n `hf readdir: ${virtualKey} returned ${String(names.length)} entries (limit ${String(SCOPE_ERROR)})`,\n )\n }\n const virtualEntries = names.map((e) => (prefix !== '' ? `${prefix}${e}` : e)).sort()\n if (index !== undefined) {\n const indexEntries: [string, IndexEntry][] = names.map((e) => {\n const name = e.split('/').pop() ?? e\n if (dirKeys.has(e)) {\n return [name, new IndexEntry({ id: e, name, resourceType: ResourceType.FOLDER })]\n }\n return [\n name,\n new IndexEntry({\n id: e,\n name,\n resourceType: ResourceType.FILE,\n size: sizes.get(e) ?? null,\n }),\n ]\n })\n await index.setDir(virtualKey, indexEntries)\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 {\n FileStat,\n FileType,\n guessType,\n type IndexCacheStore,\n type PathSpec,\n stripSlash,\n} from '@struktoai/mirage-core'\nimport type { Metadata } from 'opendal'\nimport type { HfAccessor } from '../../accessor/hf.ts'\nimport { isNotFound, rawPathOf } from './util.ts'\nimport { enoent } from '@struktoai/mirage-core'\n\nexport async function stat(\n accessor: HfAccessor,\n path: PathSpec,\n index?: IndexCacheStore,\n): Promise<FileStat> {\n const prefix = path.prefix\n const rawPath = rawPathOf(path)\n const stripped = stripSlash(rawPath)\n if (stripped === '') {\n return new FileStat({ name: '/', type: FileType.DIRECTORY })\n }\n if (index !== undefined) {\n const virtualKey = prefix !== '' ? `${prefix}/${stripped}` : `/${stripped}`\n const lookup = await index.get(virtualKey)\n if (lookup.entry !== undefined && lookup.entry !== null) {\n const entry = lookup.entry\n if (entry.resourceType === 'folder') {\n return new FileStat({ name: entry.name, type: FileType.DIRECTORY })\n }\n return new FileStat({\n name: entry.name,\n size: entry.size ?? null,\n type: guessType(entry.name),\n })\n }\n const parent = virtualKey.slice(0, virtualKey.lastIndexOf('/')) || '/'\n const parentListing = await index.listDir(parent)\n if (parentListing.entries !== undefined && parentListing.entries !== null) {\n throw enoent(path)\n }\n }\n const op = await accessor.operator()\n let md: Metadata | null = null\n try {\n md = await op.stat(stripped)\n } catch (err) {\n if (!isNotFound(err)) throw err\n }\n if (md !== null && !md.isDirectory()) {\n const etag = md.etag\n return new FileStat({\n name: stripped.split('/').pop() ?? stripped,\n size: md.contentLength !== null ? Number(md.contentLength) : null,\n modified: md.lastModified,\n type: guessType(rawPath),\n fingerprint: etag,\n extra: etag !== null && etag !== '' ? { etag } : {},\n })\n }\n try {\n const mdDir = await op.stat(`${stripped}/`)\n if (mdDir.isDirectory()) {\n return new FileStat({\n name: stripped.split('/').pop() ?? '/',\n type: FileType.DIRECTORY,\n })\n }\n } catch (err) {\n if (!isNotFound(err)) throw err\n }\n throw enoent(path)\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 Accessor,\n type CommandOpts,\n type IndexCacheStore,\n type PathSpec,\n Precision,\n ProvisionResult,\n} from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { stat as hfStat } from '../../../core/hf/stat.ts'\n\ninterface ResolvedSizes {\n resolved: [string, number][]\n missing: number\n}\n\nasync function resolveSizes(\n accessor: HfAccessor,\n paths: readonly PathSpec[],\n index: IndexCacheStore | undefined,\n): Promise<ResolvedSizes> {\n const resolved: [string, number][] = []\n let missing = 0\n for (const p of paths) {\n const pathStr = p.original\n let size: number | null = null\n if (index !== undefined) {\n const lookup = await index.get(pathStr)\n if (lookup.entry !== undefined && lookup.entry !== null) {\n size = lookup.entry.size\n }\n }\n if (size === null) {\n try {\n const fileStat = await hfStat(accessor, p, index)\n size = fileStat.size\n } catch {\n // fall through — size stays null\n }\n }\n if (size !== null) {\n resolved.push([pathStr, size])\n } else {\n missing += 1\n }\n }\n return { resolved, missing }\n}\n\nexport async function fileReadProvision(\n accessor: Accessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<ProvisionResult> {\n if (paths.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const index = opts.index ?? undefined\n const { resolved, missing } = await resolveSizes(accessor as HfAccessor, paths, index)\n if (missing > 0 || resolved.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const total = resolved.reduce((sum, [, size]) => sum + size, 0)\n return new ProvisionResult({\n networkReadLow: total,\n networkReadHigh: total,\n readOps: resolved.length,\n precision: Precision.EXACT,\n })\n}\n\nfunction parseNumFlag(value: string | boolean | undefined): number | null {\n if (typeof value !== 'string') return null\n const n = Number.parseInt(value, 10)\n return Number.isFinite(n) ? n : null\n}\n\nexport async function headTailProvision(\n accessor: Accessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<ProvisionResult> {\n if (paths.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const index = opts.index ?? undefined\n const { resolved, missing } = await resolveSizes(accessor as HfAccessor, paths, index)\n if (missing > 0 || resolved.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const c = parseNumFlag(opts.flags.c)\n if (c !== null) {\n const total = resolved.reduce((sum, [, size]) => sum + Math.min(c, size), 0)\n return new ProvisionResult({\n networkReadLow: total,\n networkReadHigh: total,\n readOps: resolved.length,\n precision: Precision.EXACT,\n })\n }\n const full = resolved.reduce((sum, [, size]) => sum + size, 0)\n return new ProvisionResult({\n networkReadLow: 0,\n networkReadHigh: full,\n readOps: resolved.length,\n precision: Precision.RANGE,\n })\n}\n\nexport function metadataProvision(\n _accessor: Accessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): ProvisionResult {\n const n = Math.max(1, paths.length > 0 ? paths.length : 1)\n return new ProvisionResult({\n networkReadLow: 0,\n networkReadHigh: 0,\n readOps: n,\n precision: Precision.EXACT,\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 { command, specOf, cmpGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_CMP = command({\n name: 'cmp',\n resource: [...HF_RESOURCES],\n spec: specOf('cmp'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n cmpGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, specOf, columnGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_COLUMN = command({\n name: 'column',\n resource: [...HF_RESOURCES],\n spec: specOf('column'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n columnGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, specOf, commGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_COMM = command({\n name: 'comm',\n resource: [...HF_RESOURCES],\n spec: specOf('comm'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n commGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, specOf, csplitGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport { write as hfWrite } from '../../../core/hf/write.ts'\n\nexport const HF_CSPLIT = command({\n name: 'csplit',\n resource: [...HF_RESOURCES],\n spec: specOf('csplit'),\n fn: (accessor: HfAccessor, paths, texts, opts) =>\n csplitGeneric(\n paths,\n texts,\n opts,\n (p) => hfStream(accessor, p),\n (p, d) => hfWrite(accessor, p, d),\n ),\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 IndexCacheStore, type PathSpec, record } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../accessor/hf.ts'\nimport { hfKey, isNotFound, rawPathOf } from './util.ts'\nimport { enoent } from '@struktoai/mirage-core'\n\nexport async function write(\n accessor: HfAccessor,\n path: PathSpec,\n data: Uint8Array,\n _index?: IndexCacheStore,\n): Promise<void> {\n const rawPath = rawPathOf(path)\n const key = hfKey(rawPath)\n const op = await accessor.operator()\n const startMs = performance.now()\n try {\n await op.write(key, Buffer.from(data))\n } catch (err) {\n if (isNotFound(err)) throw enoent(path)\n throw err\n }\n record('write', path.original, accessor.resourceName, data.byteLength, startMs)\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 { command, cutGeneric, specOf } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_CUT = command({\n name: 'cut',\n resource: [...HF_RESOURCES],\n spec: specOf('cut'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n cutGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, diffGeneric, specOf } from '@struktoai/mirage-core'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\n\nexport const HF_DIFF = command({\n name: 'diff',\n resource: [...HF_RESOURCES],\n spec: specOf('diff'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n diffGeneric(paths, opts, (p) => hfStream(accessor, 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 { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { command, specOf, dirnameFn } from '@struktoai/mirage-core'\n\nexport const HF_DIRNAME = command({\n name: 'dirname',\n resource: [...HF_RESOURCES],\n spec: specOf('dirname'),\n fn: dirnameFn,\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 command,\n duGeneric,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../accessor/hf.ts'\nimport { du as hfDu, duAll as hfDuAll } from '../../../core/hf/du.ts'\nimport { resolveGlob } from '../../../core/hf/glob.ts'\n\nasync function duCommand(\n accessor: HfAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const resolved =\n paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? undefined) : []\n return duGeneric(\n resolved,\n opts,\n (p) => hfDu(accessor, p),\n (p) => hfDuAll(accessor, p),\n )\n}\n\nexport const HF_DU = command({\n name: 'du',\n resource: [...HF_RESOURCES],\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, stripSlash } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../accessor/hf.ts'\nimport { isNotFound, rawPathOf } from './util.ts'\n\nexport async function du(accessor: HfAccessor, path: PathSpec): Promise<number> {\n const target = rawPathOf(path)\n const pfx = stripSlash(target)\n const scanPath = pfx !== '' ? `${pfx}/` : '/'\n const op = await accessor.operator()\n let total = 0\n try {\n for (const entry of await op.list(scanPath, { recursive: true })) {\n if (entry.path().endsWith('/')) continue\n const length = entry.metadata().contentLength\n total += length !== null ? Number(length) : 0\n }\n } catch (err) {\n if (isNotFound(err)) return 0\n throw err\n }\n return total\n}\n\nexport async function duAll(\n accessor: HfAccessor,\n path: PathSpec,\n): Promise<[[string, number][], number]> {\n const target = rawPathOf(path)\n const pfx = stripSlash(target)\n const scanPath = pfx !== '' ? `${pfx}/` : '/'\n const op = await accessor.operator()\n const results: [string, number][] = []\n let total = 0\n try {\n for (const entry of await op.list(scanPath, { recursive: true })) {\n const rel = entry.path()\n if (rel === '' || rel.endsWith('/')) continue\n const length = entry.metadata().contentLength\n const size = length !== null ? Number(length) : 0\n results.push([`/${lstrip(rel)}`, size])\n total += size\n }\n } catch (err) {\n if (!isNotFound(err)) throw err\n }\n results.sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0))\n return [results, total]\n}\n\nfunction lstrip(value: string): string {\n let start = 0\n while (start < value.length && value[start] === '/') start += 1\n return value.slice(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 { command, specOf, expandGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_EXPAND = command({\n name: 'expand',\n resource: [...HF_RESOURCES],\n spec: specOf('expand'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n expandGeneric(paths, opts, (p) => hfStream(accessor, 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 command,\n fileGeneric,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../../accessor/hf.ts'\nimport { resolveGlob } from '../../../../core/hf/glob.ts'\nimport { read as hfRead } from '../../../../core/hf/read.ts'\nimport { stat as hfStat } from '../../../../core/hf/stat.ts'\n\nasync function fileCommand(\n accessor: HfAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const resolved =\n paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? undefined) : []\n return fileGeneric(\n resolved,\n opts,\n (p) => hfStat(accessor, p, opts.index ?? undefined),\n (p) => hfRead(accessor, p, opts.index ?? undefined),\n )\n}\n\nexport const HF_FILE = command({\n name: 'file',\n resource: [...HF_RESOURCES],\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 { command, findGeneric, specOf } from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../accessor/hf.ts'\nimport { find as hfFind } from '../../../core/hf/find.ts'\nimport { metadataProvision } from './provision.ts'\n\nexport const HF_FIND = command({\n name: 'find',\n resource: [...HF_RESOURCES],\n spec: specOf('find'),\n provision: metadataProvision,\n fn: (accessor: HfAccessor, paths, texts, opts) =>\n findGeneric(paths, texts, opts, (root, options) => hfFind(accessor, root, options)),\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 buildTree,\n type FindOptions,\n keep,\n type PathSpec,\n type PredNode,\n rstripSlash,\n stripSlash,\n} from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../accessor/hf.ts'\nimport { isNotFound, rawPathOf } from './util.ts'\n\ninterface CandidateMeta {\n size: number\n mtime: number | null\n}\n\nfunction matchesFilters(\n entryPath: string,\n kind: 'f' | 'd',\n meta: CandidateMeta,\n baseDepth: number,\n options: FindOptions,\n tree: PredNode,\n): boolean {\n const entryName = entryPath.split('/').pop() ?? ''\n const depth = (entryPath.match(/\\//g) ?? []).length - baseDepth\n if (options.maxDepth !== null && options.maxDepth !== undefined && depth > options.maxDepth) {\n return false\n }\n if (!keep({ key: entryPath, name: entryName, kind, depth }, tree, options.minDepth)) {\n return false\n }\n if (kind === 'f' && (options.minSize !== null || options.maxSize !== null)) {\n if (options.minSize !== null && options.minSize !== undefined && meta.size < options.minSize) {\n return false\n }\n if (options.maxSize !== null && options.maxSize !== undefined && meta.size > options.maxSize) {\n return false\n }\n }\n if (\n (options.mtimeMin !== null && options.mtimeMin !== undefined) ||\n (options.mtimeMax !== null && options.mtimeMax !== undefined)\n ) {\n if (meta.mtime === null) return false\n if (\n options.mtimeMin !== null &&\n options.mtimeMin !== undefined &&\n meta.mtime < options.mtimeMin\n ) {\n return false\n }\n if (\n options.mtimeMax !== null &&\n options.mtimeMax !== undefined &&\n meta.mtime > options.mtimeMax\n ) {\n return false\n }\n }\n return true\n}\n\nexport async function find(\n accessor: HfAccessor,\n path: PathSpec,\n options: FindOptions = {},\n): Promise<string[]> {\n const target = rawPathOf(path)\n const pfx = stripSlash(target)\n const scanPath = pfx !== '' ? `${pfx}/` : '/'\n const base = pfx !== '' ? `/${pfx}` : '/'\n const baseDepth = base === '/' ? 0 : (base.match(/\\//g) ?? []).length\n const op = await accessor.operator()\n const results: string[] = []\n const seenDirs = new Set<string>()\n let sawDescendant = false\n const tree =\n options.tree ??\n buildTree({\n name: options.name,\n iname: options.iname,\n pathPattern: options.pathPattern,\n type: options.type,\n nameExclude: options.nameExclude,\n orNames: options.orNames,\n })\n let entries\n try {\n entries = await op.list(scanPath, { recursive: true })\n } catch (err) {\n if (isNotFound(err)) return []\n throw err\n }\n for (const entry of entries) {\n const rel = entry.path()\n if (rel === '') continue\n const meta = entry.metadata()\n const isDir = rel.endsWith('/') || meta.isDirectory()\n const entryPath = `/${stripSlash(rel)}`\n if (entryPath !== base) sawDescendant = true\n const kind: 'f' | 'd' = isDir ? 'd' : 'f'\n const length = meta.contentLength\n const lm = meta.lastModified\n const candidateMeta: CandidateMeta = {\n size: length !== null ? Number(length) : 0,\n mtime: lm !== null ? Date.parse(lm) / 1000 : null,\n }\n const fileEntries: [string, 'f' | 'd'][] = [[entryPath, kind]]\n if (!isDir) {\n let parent = rstripSlash(entryPath.slice(0, entryPath.lastIndexOf('/'))) || '/'\n while (parent !== '' && parent !== base && parent !== '/') {\n if (!seenDirs.has(parent)) {\n seenDirs.add(parent)\n fileEntries.push([parent, 'd'])\n }\n parent = parent.slice(0, parent.lastIndexOf('/')) || '/'\n }\n }\n for (const [ep, k] of fileEntries) {\n if (matchesFilters(ep, k, candidateMeta, baseDepth, options, tree)) {\n results.push(ep)\n }\n }\n }\n if (base !== '/' && sawDescendant && (options.maxDepth == null || options.maxDepth >= 0)) {\n if (matchesFilters(base, 'd', { size: 0, mtime: null }, baseDepth, options, tree)) {\n results.push(base)\n }\n }\n return [...new Set(results)].sort()\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 command,\n fmtGeneric,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\n\nasync function fmtCommand(\n accessor: HfAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n return fmtGeneric(paths, opts, (p) => hfStream(accessor, p))\n}\n\nexport const HF_FMT = command({\n name: 'fmt',\n resource: [...HF_RESOURCES],\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 { command, specOf, foldGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_FOLD = command({\n name: 'fold',\n resource: [...HF_RESOURCES],\n spec: specOf('fold'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n foldGeneric(paths, opts, (p) => hfStream(accessor, 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 command,\n grepGeneric,\n prefixAggregate,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type FileStat,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { resolveGlob } from '../../../../core/hf/glob.ts'\nimport { readdir as hfReaddir } from '../../../../core/hf/readdir.ts'\nimport { stat as hfStat } from '../../../../core/hf/stat.ts'\nimport { stream as hfStream } from '../../../../core/hf/stream.ts'\nimport type { HfAccessor } from '../../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../../accessor/hf.ts'\nimport { fileReadProvision } from '../provision.ts'\n\nasync function grepFn(\n accessor: HfAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const resolved = paths.length > 0 ? await resolveGlob(accessor, paths) : []\n const stat = (p: PathSpec): Promise<FileStat> => hfStat(accessor, p)\n const readdir = (p: PathSpec): Promise<string[]> => hfReaddir(accessor, p)\n return grepGeneric('grep', resolved, texts, opts, stat, readdir, (p) => hfStream(accessor, p))\n}\n\nexport const HF_GREP = command({\n name: 'grep',\n resource: [...HF_RESOURCES],\n spec: specOf('grep'),\n fn: grepFn,\n provision: fileReadProvision,\n aggregate: prefixAggregate,\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 { command, specOf, gunzipGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport { write as hfWrite } from '../../../core/hf/write.ts'\nimport { unlink as hfUnlink } from '../../../core/hf/unlink.ts'\n\nexport const HF_GUNZIP = command({\n name: 'gunzip',\n resource: [...HF_RESOURCES],\n spec: specOf('gunzip'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n gunzipGeneric(\n paths,\n opts,\n (p) => hfStream(accessor, p),\n (p, d) => hfWrite(accessor, p, d),\n (p) => hfUnlink(accessor, p),\n ),\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 { FileType, type IndexCacheStore, type PathSpec, record } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../accessor/hf.ts'\nimport { stat } from './stat.ts'\nimport { hfKey, isNotFound, rawPathOf } from './util.ts'\nimport { enoent } from '@struktoai/mirage-core'\n\nexport async function unlink(\n accessor: HfAccessor,\n path: PathSpec,\n index?: IndexCacheStore,\n): Promise<void> {\n const fileStat = await stat(accessor, path, index)\n const rawPath = rawPathOf(path)\n if (fileStat.type === FileType.DIRECTORY) {\n const e = new Error(`EISDIR: ${rawPath}`) as Error & { code: string }\n e.code = 'EISDIR'\n throw e\n }\n const key = hfKey(rawPath)\n const op = await accessor.operator()\n const startMs = performance.now()\n try {\n await op.delete(key)\n } catch (err) {\n if (isNotFound(err)) throw enoent(path)\n throw err\n }\n record('unlink', path.original, accessor.resourceName, 0, startMs)\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 { command, specOf, gzipGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport { write as hfWrite } from '../../../core/hf/write.ts'\nimport { unlink as hfUnlink } from '../../../core/hf/unlink.ts'\n\nexport const HF_GZIP = command({\n name: 'gzip',\n resource: [...HF_RESOURCES],\n spec: specOf('gzip'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n gzipGeneric(\n paths,\n opts,\n (p) => hfStream(accessor, p),\n (p, d) => hfWrite(accessor, p, d),\n (p) => hfUnlink(accessor, p),\n ),\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 { command, headGeneric, headerAggregate, specOf } from '@struktoai/mirage-core'\nimport { stream as hfStream } from '../../../../core/hf/stream.ts'\nimport { stat as hfStat } from '../../../../core/hf/stat.ts'\nimport type { HfAccessor } from '../../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../../accessor/hf.ts'\nimport { headTailProvision } from '../provision.ts'\n\nexport const HF_HEAD = command({\n name: 'head',\n resource: [...HF_RESOURCES],\n spec: specOf('head'),\n provision: headTailProvision,\n fn: (accessor: HfAccessor, paths, texts, opts) =>\n headGeneric(\n paths,\n texts,\n opts,\n (p) => hfStat(accessor, p),\n (p) => hfStream(accessor, p),\n ),\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 { command, specOf, iconvGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport { write as hfWrite } from '../../../core/hf/write.ts'\n\nexport const HF_ICONV = command({\n name: 'iconv',\n resource: [...HF_RESOURCES],\n spec: specOf('iconv'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n iconvGeneric(\n paths,\n opts,\n (p) => hfStream(accessor, p),\n (p, d) => hfWrite(accessor, p, d),\n ),\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 { command, specOf, joinGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_JOIN = command({\n name: 'join',\n resource: [...HF_RESOURCES],\n spec: specOf('join'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n joinGeneric(paths, opts, (p) => hfStream(accessor, 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 command,\n isJsonlPath,\n isStreamableJsonlExpr,\n jqGeneric,\n Precision,\n ProvisionResult,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../accessor/hf.ts'\nimport { resolveGlob } from '../../../core/hf/glob.ts'\nimport { stat as hfStat } from '../../../core/hf/stat.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport async function jqProvision(\n accessor: HfAccessor,\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 hfStat(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\nasync function jqCommand(\n accessor: HfAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const resolved =\n paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? undefined) : []\n return jqGeneric(resolved, texts, opts, (p) => hfStream(accessor, p))\n}\n\nexport const HF_JQ = command({\n name: 'jq',\n resource: [...HF_RESOURCES],\n spec: specOf('jq'),\n provision: jqProvision,\n fn: jqCommand,\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 { command, specOf, lookGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_LOOK = command({\n name: 'look',\n resource: [...HF_RESOURCES],\n spec: specOf('look'),\n fn: (accessor: HfAccessor, paths, texts, opts) =>\n lookGeneric(paths, texts, opts, (p) => hfStream(accessor, 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 command,\n lsGeneric,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../../accessor/hf.ts'\nimport { resolveGlob } from '../../../../core/hf/glob.ts'\nimport { readdir as hfReaddir } from '../../../../core/hf/readdir.ts'\nimport { stat as hfStat } from '../../../../core/hf/stat.ts'\nimport { metadataProvision } from '../provision.ts'\n\nasync function lsCommand(\n accessor: HfAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const resolved =\n paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? undefined) : []\n return lsGeneric(\n resolved,\n opts,\n (p) => hfReaddir(accessor, p, opts.index ?? undefined),\n (p) => hfStat(accessor, p, opts.index ?? undefined),\n )\n}\n\nexport const HF_LS = command({\n name: 'ls',\n resource: [...HF_RESOURCES],\n spec: specOf('ls'),\n fn: lsCommand,\n provision: metadataProvision,\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 { command, specOf, md5Generic } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_MD5 = command({\n name: 'md5',\n resource: [...HF_RESOURCES],\n spec: specOf('md5'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n md5Generic(paths, opts, (p) => hfStream(accessor, 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 { command, mktempGeneric, specOf } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { mkdir as hfMkdir } from '../../../core/hf/mkdir.ts'\nimport { write as hfWrite } from '../../../core/hf/write.ts'\n\nexport const HF_MKTEMP = command({\n name: 'mktemp',\n resource: [...HF_RESOURCES],\n spec: specOf('mktemp'),\n fn: (accessor: HfAccessor, _paths, texts, opts) =>\n mktempGeneric(\n texts,\n opts,\n (p) => hfMkdir(accessor, p),\n (p, d) => hfWrite(accessor, p, d),\n ),\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 { IndexCacheStore, PathSpec } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../accessor/hf.ts'\n\nexport async function mkdir(\n _accessor: HfAccessor,\n _path: PathSpec,\n _index?: IndexCacheStore,\n): Promise<void> {\n // Object stores don't have real directories; mkdir is a no-op.\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 { command, specOf, nlGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_NL = command({\n name: 'nl',\n resource: [...HF_RESOURCES],\n spec: specOf('nl'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n nlGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, specOf, pasteGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_PASTE = command({\n name: 'paste',\n resource: [...HF_RESOURCES],\n spec: specOf('paste'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n pasteGeneric(paths, opts, (p) => hfStream(accessor, 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 { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { command, readlinkGeneric, specOf, type Accessor } from '@struktoai/mirage-core'\n\nexport const HF_READLINK = command({\n name: 'readlink',\n resource: [...HF_RESOURCES],\n spec: specOf('readlink'),\n fn: (_accessor: Accessor, paths, texts, opts) => readlinkGeneric(paths, texts, opts),\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 { command, realpathGeneric, specOf } from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../accessor/hf.ts'\nimport { stat as hfStat } from '../../../core/hf/stat.ts'\n\nexport const HF_REALPATH = command({\n name: 'realpath',\n resource: [...HF_RESOURCES],\n spec: specOf('realpath'),\n fn: (accessor: HfAccessor, paths, texts, opts) =>\n realpathGeneric(paths, texts, opts, (p) => hfStat(accessor, p, opts.index ?? undefined)),\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 { command, specOf, revGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_REV = command({\n name: 'rev',\n resource: [...HF_RESOURCES],\n spec: specOf('rev'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n revGeneric(paths, opts, (p) => hfStream(accessor, 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 command,\n rgGeneric,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type FileStat,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { resolveGlob } from '../../../core/hf/glob.ts'\nimport { readdir as hfReaddir } from '../../../core/hf/readdir.ts'\nimport { stat as hfStat } from '../../../core/hf/stat.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { fileReadProvision } from './provision.ts'\n\nasync function rgCommand(\n accessor: HfAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const resolved = paths.length > 0 ? await resolveGlob(accessor, paths) : []\n const stat = (p: PathSpec): Promise<FileStat> => hfStat(accessor, p)\n const readdir = (p: PathSpec): Promise<string[]> => hfReaddir(accessor, p)\n return rgGeneric(resolved, texts, opts, stat, readdir, (p) => hfStream(accessor, p))\n}\n\nexport const HF_RG = command({\n name: 'rg',\n resource: [...HF_RESOURCES],\n spec: specOf('rg'),\n fn: rgCommand,\n provision: fileReadProvision,\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 command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../accessor/hf.ts'\nimport { resolveGlob } from '../../../core/hf/glob.ts'\nimport { unlink as hfUnlink } from '../../../core/hf/unlink.ts'\n\nconst ENC = new TextEncoder()\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function* lines(parts: readonly string[]): AsyncIterable<Uint8Array> {\n for (const part of parts) yield ENC.encode(`${part}\\n`)\n}\n\nasync function rmCommand(\n accessor: HfAccessor,\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('rm: missing operand\\n') })]\n }\n if (opts.flags.r === true || opts.flags.R === true || opts.flags.d === true) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode('rm: recursive and directory removal are not supported\\n'),\n }),\n ]\n }\n const force = opts.flags.f === true\n const verbose = opts.flags.v === true\n const resolved = await resolveGlob(accessor, paths, opts.index ?? undefined)\n const verboseParts: string[] = []\n const removed: Record<string, Uint8Array> = {}\n for (const path of resolved) {\n try {\n await hfUnlink(accessor, path, opts.index ?? undefined)\n } catch (err) {\n const code = (err as { code?: string } | null)?.code\n if (code === 'EISDIR') {\n throw new Error(`rm: cannot remove '${path.original}': Is a directory`)\n }\n if (code === 'ENOENT' && force) continue\n throw err\n }\n removed[path.stripPrefix] = new Uint8Array()\n if (verbose) verboseParts.push(`removed '${path.original}'`)\n }\n const output: ByteSource | null = verbose ? lines(verboseParts) : null\n return [output, new IOResult({ writes: removed })]\n}\n\nexport const HF_RM = command({\n name: 'rm',\n resource: [...HF_RESOURCES],\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 { command, specOf, sedGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport { write as hfWrite } from '../../../core/hf/write.ts'\n\nexport const HF_SED = command({\n name: 'sed',\n resource: [...HF_RESOURCES],\n spec: specOf('sed'),\n fn: (accessor: HfAccessor, paths, texts, opts) =>\n sedGeneric(\n paths,\n texts,\n opts,\n (p) => hfStream(accessor, p),\n (p, d) => hfWrite(accessor, p, d),\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 { command, sha256sumGeneric, specOf } from '@struktoai/mirage-core'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\n\nexport const HF_SHA256SUM = command({\n name: 'sha256sum',\n resource: [...HF_RESOURCES],\n spec: specOf('sha256sum'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n sha256sumGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, specOf, shufGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_SHUF = command({\n name: 'shuf',\n resource: [...HF_RESOURCES],\n spec: specOf('shuf'),\n fn: (accessor: HfAccessor, paths, texts, opts) =>\n shufGeneric(paths, texts, opts, (p) => hfStream(accessor, 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 { command, specOf, sortGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_SORT = command({\n name: 'sort',\n resource: [...HF_RESOURCES],\n spec: specOf('sort'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n sortGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, specOf, splitGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport { write as hfWrite } from '../../../core/hf/write.ts'\n\nexport const HF_SPLIT = command({\n name: 'split',\n resource: [...HF_RESOURCES],\n spec: specOf('split'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n splitGeneric(\n paths,\n opts,\n (p) => hfStream(accessor, p),\n (p, d) => hfWrite(accessor, p, d),\n ),\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 command,\n specOf,\n statGeneric,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../../accessor/hf.ts'\nimport { resolveGlob } from '../../../../core/hf/glob.ts'\nimport { stat as hfStat } from '../../../../core/hf/stat.ts'\nimport { metadataProvision } from '../provision.ts'\n\nasync function statCommand(\n accessor: HfAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const resolved =\n paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? undefined) : []\n return statGeneric(resolved, opts, (p) => hfStat(accessor, p, opts.index ?? undefined))\n}\n\nexport const HF_STAT = command({\n name: 'stat',\n resource: [...HF_RESOURCES],\n spec: specOf('stat'),\n fn: statCommand,\n provision: metadataProvision,\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 { command, specOf, stringsGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_STRINGS = command({\n name: 'strings',\n resource: [...HF_RESOURCES],\n spec: specOf('strings'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n stringsGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, specOf, tacGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_TAC = command({\n name: 'tac',\n resource: [...HF_RESOURCES],\n spec: specOf('tac'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n tacGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, headerAggregate, specOf, tailGeneric } from '@struktoai/mirage-core'\nimport { stream as hfStream } from '../../../../core/hf/stream.ts'\nimport type { HfAccessor } from '../../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../../accessor/hf.ts'\nimport { headTailProvision } from '../provision.ts'\n\nexport const HF_TAIL = command({\n name: 'tail',\n resource: [...HF_RESOURCES],\n spec: specOf('tail'),\n provision: headTailProvision,\n fn: (accessor: HfAccessor, paths, texts, opts) =>\n tailGeneric(paths, texts, opts, (p) => hfStream(accessor, p)),\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 { command, specOf, tarGeneric } from '@struktoai/mirage-core'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport { write as hfWrite } from '../../../core/hf/write.ts'\nimport { mkdir as hfMkdir } from '../../../core/hf/mkdir.ts'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\n\nexport const HF_TAR = command({\n name: 'tar',\n resource: [...HF_RESOURCES],\n spec: specOf('tar'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n tarGeneric(\n paths,\n opts,\n (p) => hfStream(accessor, p),\n (p, data) => hfWrite(accessor, p, data),\n (p) => hfMkdir(accessor, p),\n ),\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 command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { write as hfWrite } from '../../../core/hf/write.ts'\nimport { exists as hfExists } from '../../../core/hf/exists.ts'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\n\nconst ENC = new TextEncoder()\n\nasync function touchCommand(\n accessor: HfAccessor,\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 hfExists(accessor, p))) {\n await hfWrite(accessor, p, new Uint8Array(0))\n }\n }\n return [null, new IOResult()]\n}\n\nexport const HF_TOUCH = command({\n name: 'touch',\n resource: [...HF_RESOURCES],\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 type { PathSpec } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../accessor/hf.ts'\nimport { stat } from './stat.ts'\n\nexport async function exists(accessor: HfAccessor, path: PathSpec): Promise<boolean> {\n try {\n await stat(accessor, path)\n return true\n } catch (err) {\n if ((err as { code?: string } | null)?.code === 'ENOENT') return false\n throw err\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 { command, specOf, trGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_TR = command({\n name: 'tr',\n resource: [...HF_RESOURCES],\n spec: specOf('tr'),\n fn: (accessor: HfAccessor, paths, texts, opts) =>\n trGeneric(paths, texts, opts, (p) => hfStream(accessor, 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 command,\n specOf,\n treeGeneric,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../accessor/hf.ts'\nimport { resolveGlob } from '../../../core/hf/glob.ts'\nimport { readdir as hfReaddir } from '../../../core/hf/readdir.ts'\nimport { stat as hfStat } from '../../../core/hf/stat.ts'\n\nasync function treeCommand(\n accessor: HfAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const resolved = await resolveGlob(accessor, paths, opts.index ?? undefined)\n return treeGeneric(\n resolved,\n opts,\n (p) => hfReaddir(accessor, p, opts.index ?? undefined),\n (p) => hfStat(accessor, p, opts.index ?? undefined),\n )\n}\n\nexport const HF_TREE = command({\n name: 'tree',\n resource: [...HF_RESOURCES],\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 { command, specOf, tsortGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_TSORT = command({\n name: 'tsort',\n resource: [...HF_RESOURCES],\n spec: specOf('tsort'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n tsortGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, specOf, unexpandGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_UNEXPAND = command({\n name: 'unexpand',\n resource: [...HF_RESOURCES],\n spec: specOf('unexpand'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n unexpandGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, specOf, uniqGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_UNIQ = command({\n name: 'uniq',\n resource: [...HF_RESOURCES],\n spec: specOf('uniq'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n uniqGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, specOf, unzipGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport { write as hfWrite } from '../../../core/hf/write.ts'\nimport { mkdir as hfMkdir } from '../../../core/hf/mkdir.ts'\n\nexport const HF_UNZIP = command({\n name: 'unzip',\n resource: [...HF_RESOURCES],\n spec: specOf('unzip'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n unzipGeneric(\n paths,\n opts,\n (p) => hfStream(accessor, p),\n (p, d) => hfWrite(accessor, p, d),\n (p) => hfMkdir(accessor, p),\n ),\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 { command, specOf, wcAggregate, wcGeneric } from '@struktoai/mirage-core'\nimport { stream as hfStream } from '../../../../core/hf/stream.ts'\nimport type { HfAccessor } from '../../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../../accessor/hf.ts'\nimport { fileReadProvision } from '../provision.ts'\n\nexport const HF_WC = command({\n name: 'wc',\n resource: [...HF_RESOURCES],\n spec: specOf('wc'),\n fn: (accessor: HfAccessor, paths, texts, opts) =>\n wcGeneric(paths, texts, opts, (p) => hfStream(accessor, p)),\n provision: fileReadProvision,\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 { command, specOf, xxdGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_XXD = command({\n name: 'xxd',\n resource: [...HF_RESOURCES],\n spec: specOf('xxd'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n xxdGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, specOf, zcatGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_ZCAT = command({\n name: 'zcat',\n resource: [...HF_RESOURCES],\n spec: specOf('zcat'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n zcatGeneric(paths, opts, (p) => hfStream(accessor, 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 { command, specOf, zgrepGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\n\nexport const HF_ZGREP = command({\n name: 'zgrep',\n resource: [...HF_RESOURCES],\n spec: specOf('zgrep'),\n fn: (accessor: HfAccessor, paths, texts, opts) =>\n zgrepGeneric(paths, texts, opts, (p) => hfStream(accessor, 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 { command, specOf, zipGeneric } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../../accessor/hf.ts'\nimport { HF_RESOURCES } from '../../../accessor/hf.ts'\nimport { stream as hfStream } from '../../../core/hf/stream.ts'\nimport { write as hfWrite } from '../../../core/hf/write.ts'\n\nexport const HF_ZIP = command({\n name: 'zip',\n resource: [...HF_RESOURCES],\n spec: specOf('zip'),\n fn: (accessor: HfAccessor, paths, _texts, opts) =>\n zipGeneric(\n paths,\n opts,\n (p) => hfStream(accessor, p),\n (p, d) => hfWrite(accessor, p, d),\n ),\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 { HF_AWK } from './awk.ts'\nimport { HF_BASE64 } from './base64_cmd.ts'\nimport { HF_BASENAME } from './basename.ts'\nimport { HF_CAT } from './cat/cat.ts'\nimport { HF_CMP } from './cmp.ts'\nimport { HF_COLUMN } from './column.ts'\nimport { HF_COMM } from './comm.ts'\nimport { HF_CSPLIT } from './csplit.ts'\nimport { HF_CUT } from './cut.ts'\nimport { HF_DIFF } from './diff.ts'\nimport { HF_DIRNAME } from './dirname.ts'\nimport { HF_DU } from './du.ts'\nimport { HF_EXPAND } from './expand.ts'\nimport { HF_FILE } from './file/file.ts'\nimport { HF_FIND } from './find.ts'\nimport { HF_FMT } from './fmt.ts'\nimport { HF_FOLD } from './fold.ts'\nimport { HF_GREP } from './grep/grep.ts'\nimport { HF_GUNZIP } from './gunzip.ts'\nimport { HF_GZIP } from './gzip.ts'\nimport { HF_HEAD } from './head/head.ts'\nimport { HF_ICONV } from './iconv.ts'\nimport { HF_JOIN } from './join.ts'\nimport { HF_JQ } from './jq.ts'\nimport { HF_LOOK } from './look.ts'\nimport { HF_LS } from './ls/ls.ts'\nimport { HF_MD5 } from './md5.ts'\nimport { HF_MKTEMP } from './mktemp.ts'\nimport { HF_NL } from './nl.ts'\nimport { HF_PASTE } from './paste.ts'\nimport { HF_READLINK } from './readlink.ts'\nimport { HF_REALPATH } from './realpath.ts'\nimport { HF_REV } from './rev.ts'\nimport { HF_RG } from './rg.ts'\nimport { HF_RM } from './rm.ts'\nimport { HF_SED } from './sed.ts'\nimport { HF_SHA256SUM } from './sha256sum.ts'\nimport { HF_SHUF } from './shuf.ts'\nimport { HF_SORT } from './sort.ts'\nimport { HF_SPLIT } from './split.ts'\nimport { HF_STAT } from './stat/stat.ts'\nimport { HF_STRINGS } from './strings.ts'\nimport { HF_TAC } from './tac.ts'\nimport { HF_TAIL } from './tail/tail.ts'\nimport { HF_TAR } from './tar.ts'\nimport { HF_TOUCH } from './touch.ts'\nimport { HF_TR } from './tr.ts'\nimport { HF_TREE } from './tree.ts'\nimport { HF_TSORT } from './tsort.ts'\nimport { HF_UNEXPAND } from './unexpand.ts'\nimport { HF_UNIQ } from './uniq.ts'\nimport { HF_UNZIP } from './unzip.ts'\nimport { HF_WC } from './wc/wc.ts'\nimport { HF_XXD } from './xxd.ts'\nimport { HF_ZCAT } from './zcat.ts'\nimport { HF_ZGREP } from './zgrep.ts'\nimport { HF_ZIP } from './zip_cmd.ts'\n\nexport const HF_COMMANDS: readonly RegisteredCommand[] = [\n ...HF_AWK,\n ...HF_BASE64,\n ...HF_BASENAME,\n ...HF_CAT,\n ...HF_CMP,\n ...HF_COLUMN,\n ...HF_COMM,\n ...HF_CSPLIT,\n ...HF_CUT,\n ...HF_DIFF,\n ...HF_DIRNAME,\n ...HF_DU,\n ...HF_EXPAND,\n ...HF_FILE,\n ...HF_FIND,\n ...HF_FMT,\n ...HF_FOLD,\n ...HF_GREP,\n ...HF_GUNZIP,\n ...HF_GZIP,\n ...HF_HEAD,\n ...HF_ICONV,\n ...HF_JOIN,\n ...HF_JQ,\n ...HF_LOOK,\n ...HF_LS,\n ...HF_MD5,\n ...HF_MKTEMP,\n ...HF_NL,\n ...HF_PASTE,\n ...HF_READLINK,\n ...HF_REALPATH,\n ...HF_REV,\n ...HF_RG,\n ...HF_RM,\n ...HF_SED,\n ...HF_SHA256SUM,\n ...HF_SHUF,\n ...HF_SORT,\n ...HF_SPLIT,\n ...HF_STAT,\n ...HF_STRINGS,\n ...HF_TAC,\n ...HF_TAIL,\n ...HF_TAR,\n ...HF_TOUCH,\n ...HF_TR,\n ...HF_TREE,\n ...HF_TSORT,\n ...HF_UNEXPAND,\n ...HF_UNIQ,\n ...HF_UNZIP,\n ...HF_WC,\n ...HF_XXD,\n ...HF_ZCAT,\n ...HF_ZGREP,\n ...HF_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 type { IndexCacheStore, PathSpec } from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../accessor/hf.ts'\nimport { write } from './write.ts'\n\nexport async function create(\n accessor: HfAccessor,\n path: PathSpec,\n index?: IndexCacheStore,\n): Promise<void> {\n await write(accessor, path, new Uint8Array(), index)\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 { HF_RESOURCES, type HfAccessor } from '../../accessor/hf.ts'\nimport { create as coreCreate } from '../../core/hf/create.ts'\n\nexport const createOps: readonly RegisteredOp[] = HF_RESOURCES.map((resource) => ({\n name: 'create',\n resource,\n filetype: null,\n write: true,\n fn: (accessor: HfAccessor, path: PathSpec) => {\n return coreCreate(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 { HF_RESOURCES, type HfAccessor } from '../../accessor/hf.ts'\nimport { mkdir as coreMkdir } from '../../core/hf/mkdir.ts'\n\nexport const mkdirOps: readonly RegisteredOp[] = HF_RESOURCES.map((resource) => ({\n name: 'mkdir',\n resource,\n filetype: null,\n write: true,\n fn: (accessor: HfAccessor, path: PathSpec) => {\n return coreMkdir(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 { OpKwargs, PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../accessor/hf.ts'\nimport { read as coreRead } from '../../../core/hf/read.ts'\n\nexport const readOps: readonly RegisteredOp[] = HF_RESOURCES.map((resource) => ({\n name: 'read',\n resource,\n filetype: null,\n write: false,\n fn: (accessor: HfAccessor, path: PathSpec, _args: readonly unknown[], kwargs: OpKwargs) => {\n return coreRead(accessor, path, kwargs.index)\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 { featherCat } from '@struktoai/mirage-core'\nimport type { OpKwargs, PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../accessor/hf.ts'\nimport { read as coreRead } from '../../../core/hf/read.ts'\n\nexport const readFeatherOps: readonly RegisteredOp[] = HF_RESOURCES.map((resource) => ({\n name: 'read',\n resource,\n filetype: '.feather',\n write: false,\n fn: async (accessor: HfAccessor, path: PathSpec, _args: readonly unknown[], kwargs: OpKwargs) => {\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 { hdf5Cat } from '@struktoai/mirage-core'\nimport type { OpKwargs, PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../accessor/hf.ts'\nimport { read as coreRead } from '../../../core/hf/read.ts'\n\nexport const readHdf5Ops: readonly RegisteredOp[] = HF_RESOURCES.map((resource) => ({\n name: 'read',\n resource,\n filetype: '.hdf5',\n write: false,\n fn: async (accessor: HfAccessor, path: PathSpec, _args: readonly unknown[], kwargs: OpKwargs) => {\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 { parquetCat } from '@struktoai/mirage-core'\nimport type { OpKwargs, PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../../accessor/hf.ts'\nimport { read as coreRead } from '../../../core/hf/read.ts'\n\nexport const readParquetOps: readonly RegisteredOp[] = HF_RESOURCES.map((resource) => ({\n name: 'read',\n resource,\n filetype: '.parquet',\n write: false,\n fn: async (accessor: HfAccessor, path: PathSpec, _args: readonly unknown[], kwargs: OpKwargs) => {\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 { OpKwargs, PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../accessor/hf.ts'\nimport { readdir as coreReaddir } from '../../core/hf/readdir.ts'\n\nexport const readdirOps: readonly RegisteredOp[] = HF_RESOURCES.map((resource) => ({\n name: 'readdir',\n resource,\n filetype: null,\n write: false,\n fn: (accessor: HfAccessor, path: PathSpec, _args: readonly unknown[], kwargs: OpKwargs) => {\n return coreReaddir(accessor, path, kwargs.index)\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 { OpKwargs, PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../accessor/hf.ts'\nimport { stat as coreStat } from '../../core/hf/stat.ts'\n\nexport const statOps: readonly RegisteredOp[] = HF_RESOURCES.map((resource) => ({\n name: 'stat',\n resource,\n filetype: null,\n write: false,\n fn: (accessor: HfAccessor, path: PathSpec, _args: readonly unknown[], kwargs: OpKwargs) => {\n return coreStat(accessor, path, kwargs.index)\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 { OpKwargs, PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../accessor/hf.ts'\nimport { unlink as coreUnlink } from '../../core/hf/unlink.ts'\n\nexport const unlinkOps: readonly RegisteredOp[] = HF_RESOURCES.map((resource) => ({\n name: 'unlink',\n resource,\n filetype: null,\n write: true,\n fn: (accessor: HfAccessor, path: PathSpec, _args: readonly unknown[], kwargs: OpKwargs) => {\n return coreUnlink(accessor, path, kwargs.index)\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 } from '@struktoai/mirage-core'\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { HF_RESOURCES, type HfAccessor } from '../../accessor/hf.ts'\nimport { write as coreWrite } from '../../core/hf/write.ts'\n\nexport const writeOps: readonly RegisteredOp[] = HF_RESOURCES.map((resource) => ({\n name: 'write',\n resource,\n filetype: null,\n write: true,\n fn: (accessor: HfAccessor, path: PathSpec, args: readonly unknown[]) => {\n const data = extractWriteData(args)\n return coreWrite(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 { createOps } from './create.ts'\nimport { mkdirOps } from './mkdir.ts'\nimport { readOps } from './read/read.ts'\nimport { readFeatherOps } from './read/read_feather.ts'\nimport { readHdf5Ops } from './read/read_hdf5.ts'\nimport { readParquetOps } from './read/read_parquet.ts'\nimport { readdirOps } from './readdir.ts'\nimport { statOps } from './stat.ts'\nimport { unlinkOps } from './unlink.ts'\nimport { writeOps } from './write.ts'\n\nexport const HF_OPS: readonly RegisteredOp[] = [\n ...createOps,\n ...mkdirOps,\n ...readOps,\n ...readFeatherOps,\n ...readHdf5Ops,\n ...readParquetOps,\n ...readdirOps,\n ...statOps,\n ...unlinkOps,\n ...writeOps,\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 BaseResource,\n type FileStat,\n type FindOptions,\n PathSpec,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n} from '@struktoai/mirage-core'\nimport type { HfAccessor } from '../../accessor/hf.ts'\nimport { HF_COMMANDS } from '../../commands/builtin/hf/index.ts'\nimport { create as createCore } from '../../core/hf/create.ts'\nimport { du as duCore, duAll as duAllCore } from '../../core/hf/du.ts'\nimport { exists as existsCore } from '../../core/hf/exists.ts'\nimport { find as findCore } from '../../core/hf/find.ts'\nimport { resolveGlob as globCore } from '../../core/hf/glob.ts'\nimport { mkdir as mkdirCore } from '../../core/hf/mkdir.ts'\nimport { read as readCore } from '../../core/hf/read.ts'\nimport { readdir as readdirCore } from '../../core/hf/readdir.ts'\nimport { stat as statCore } from '../../core/hf/stat.ts'\nimport { rangeRead as rangeReadCore, stream as streamCore } from '../../core/hf/stream.ts'\nimport { unlink as unlinkCore } from '../../core/hf/unlink.ts'\nimport { write as writeCore } from '../../core/hf/write.ts'\nimport { HF_OPS } from '../../ops/hf/index.ts'\n\nexport abstract class HfResource extends BaseResource implements Resource {\n abstract readonly kind: string\n abstract readonly prompt: string\n abstract readonly accessor: HfAccessor\n readonly isRemote: boolean = true\n readonly supportsSnapshot: boolean = true\n readonly opsMap: Record<string, unknown> = {\n read_bytes: readCore,\n readdir: readdirCore,\n stat: statCore,\n read_stream: streamCore,\n range_read: rangeReadCore,\n du_total: duCore,\n du_all: duAllCore,\n exists: existsCore,\n find_flat: findCore,\n write: writeCore,\n create: createCore,\n unlink: unlinkCore,\n mkdir: mkdirCore,\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n close(): Promise<void> {\n return Promise.resolve()\n }\n\n commands(): readonly RegisteredCommand[] {\n return HF_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return HF_OPS\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, this.index)\n }\n\n writeFile(p: PathSpec, data: Uint8Array): Promise<void> {\n return writeCore(this.accessor, p, data, this.index)\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, this.index)\n }\n\n exists(p: PathSpec): Promise<boolean> {\n return existsCore(this.accessor, p)\n }\n\n mkdir(p: PathSpec): Promise<void> {\n return mkdirCore(this.accessor, p)\n }\n\n unlink(p: PathSpec): Promise<void> {\n return unlinkCore(this.accessor, p, this.index)\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)\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 fingerprint(p: PathSpec): Promise<string | null> {\n try {\n const s = await statCore(this.accessor, p)\n return s.fingerprint\n } catch (err) {\n if ((err as { code?: string } | null)?.code === 'ENOENT') return null\n throw err\n }\n }\n\n loadState(_state: unknown): Promise<void> {\n return Promise.resolve()\n }\n}\n"],"mappings":";;;;;AAeA,SAAS,UAAU,oBAAoB;AAIhC,IAAM,eAAe;AAAA,EAC1B,aAAa;AAAA,EACb,aAAa;AAAA,EACb,aAAa;AAAA,EACb,aAAa;AACf;AAEO,IAAe,aAAf,cAAkC,SAAS;AAAA,EAKhD,YAA4B,QAAwC;AAClE,UAAM;AADoB;AAAA,EAE5B;AAAA,EAF4B;AAAA,EAFpB,kBAA4C;AAAA,EAMpD,IAAI,SAAiB;AACnB,UAAM,SAAS,KAAK;AACpB,WAAO,OAAO,UAAU,OAAO,UAAU;AAAA,EAC3C;AAAA,EAIA,kBAA0C;AACxC,UAAM,UAAkC;AAAA,MACtC,WAAW,KAAK;AAAA,MAChB,SAAS,KAAK;AAAA,IAChB;AACA,QAAI,KAAK,OAAO,UAAU,UAAa,KAAK,OAAO,UAAU,IAAI;AAC/D,cAAQ,QAAQ,KAAK,OAAO;AAAA,IAC9B;AACA,QAAI,KAAK,OAAO,aAAa,UAAa,KAAK,OAAO,aAAa,IAAI;AACrE,cAAQ,WAAW,KAAK,OAAO;AAAA,IACjC;AACA,UAAM,YAAY,KAAK,OAAO;AAC9B,QAAI,cAAc,UAAa,cAAc,IAAI;AA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,KAAS,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EAC9C;AAAA,EAEA,OAAO,GAA+B;AACpC,WAAO,OAAW,KAAK,UAAU,CAAC;AAAA,EACpC;AAAA,EAEA,MAAM,GAA4B;AAChC,WAAO,MAAU,KAAK,UAAU,CAAC;AAAA,EACnC;AAAA,EAEA,OAAO,GAA4B;AACjC,WAAO,OAAW,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EAChD;AAAA,EAEA,GAAG,GAA8B;AAC/B,WAAO,GAAO,KAAK,UAAU,CAAC;AAAA,EAChC;AAAA,EAEA,KAAK,GAAa,UAAuB,CAAC,GAAsB;AAC9D,WAAO,KAAS,KAAK,UAAU,GAAG,OAAO;AAAA,EAC3C;AAAA,EAEA,KAAK,OAA4B,SAAS,IAAyB;AACjE,UAAM,YAAY,SACd,MAAM;AAAA,MAAI,CAAC,MACT,EAAE,SACE,IACA,IAAIC,UAAS;AAAA,QACX,UAAU,EAAE;AAAA,QACZ,WAAW,EAAE;AAAA,QACb,GAAI,EAAE,YAAY,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,CAAC;AAAA,QACnD,UAAU,EAAE;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACP,IACA;AACJ,WAAO,YAAS,KAAK,UAAU,WAAW,KAAK,KAAK;AAAA,EACtD;AAAA,EAEA,MAAM,YAAY,GAAqC;AACrD,QAAI;AACF,YAAM,IAAI,MAAM,KAAS,KAAK,UAAU,CAAC;AACzC,aAAO,EAAE;AAAA,IACX,SAAS,KAAK;AACZ,UAAK,KAAkC,SAAS,SAAU,QAAO;AACjE,YAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,UAAU,QAAgC;AACxC,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":["enoent","command","specOf","command","specOf","command","specOf","command","specOf","enoent","stripSlash","enoent","stripSlash","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","record","enoent","record","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","stripSlash","stripSlash","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","rstripSlash","stripSlash","stripSlash","rstripSlash","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","stat","readdir","command","specOf","command","specOf","FileType","record","enoent","FileType","record","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","Precision","ProvisionResult","specOf","ProvisionResult","Precision","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","stat","readdir","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","headerAggregate","specOf","command","specOf","headerAggregate","command","specOf","command","specOf","IOResult","command","specOf","ENC","IOResult","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","command","specOf","PathSpec","PathSpec"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/resource/gsheets/gsheets.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 BaseResource,\n type FileStat,\n GSHEETS_COMMANDS,\n GSHEETS_PROMPT,\n GSHEETS_VFS_OPS,\n GSHEETS_WRITE_PROMPT,\n GSheetsAccessor,\n PathSpec,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n TokenManager,\n gsheetsRead,\n gsheetsReaddir,\n gsheetsResolveGlob,\n gsheetsStat,\n} from '@struktoai/mirage-core'\nimport { redactGSheetsConfig, type GSheetsConfig, type GSheetsConfigRedacted } from './config.ts'\n\nexport interface GSheetsResourceState {\n type: string\n config: GSheetsConfigRedacted\n}\n\nexport class GSheetsResource extends BaseResource implements Resource {\n readonly kind: string = ResourceName.GSHEETS\n readonly isRemote: boolean = true\n readonly indexTtl: number = 86_400\n readonly prompt: string = GSHEETS_PROMPT\n readonly writePrompt: string = GSHEETS_WRITE_PROMPT\n readonly config: GSheetsConfig\n readonly accessor: GSheetsAccessor\n\n constructor(config: GSheetsConfig) {\n super()\n this.config = config\n const tm = new TokenManager({\n clientId: config.clientId,\n clientSecret: config.clientSecret,\n refreshToken: config.refreshToken,\n })\n this.accessor = new GSheetsAccessor({ tokenManager: tm })\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n close(): Promise<void> {\n return Promise.resolve()\n }\n\n commands(): readonly RegisteredCommand[] {\n return GSHEETS_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return GSHEETS_VFS_OPS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return gsheetsRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return gsheetsReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return gsheetsStat(this.accessor, p, this.index)\n }\n\n async fingerprint(p: PathSpec): Promise<string | null> {\n const lookup = await this.index.get(p.original)\n return lookup.entry?.remoteTime ?? null\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n 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 gsheetsResolveGlob(this.accessor, effective, this.index)\n }\n\n getState(): Promise<GSheetsResourceState> {\n return Promise.resolve({\n type: this.kind,\n config: redactGSheetsConfig(this.config),\n })\n }\n\n loadState(_state: GSheetsResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n"],"mappings":";;;;;AAcA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQA,IAAM,kBAAN,cAA8B,aAAiC;AAAA,EAC3D,OAAe,aAAa;AAAA,EAC5B,WAAoB;AAAA,EACpB,WAAmB;AAAA,EACnB,SAAiB;AAAA,EACjB,cAAsB;AAAA,EACtB;AAAA,EACA;AAAA,EAET,YAAY,QAAuB;AACjC,UAAM;AACN,SAAK,SAAS;AACd,UAAM,KAAK,IAAI,aAAa;AAAA,MAC1B,UAAU,OAAO;AAAA,MACjB,cAAc,OAAO;AAAA,MACrB,cAAc,OAAO;AAAA,IACvB,CAAC;AACD,SAAK,WAAW,IAAI,gBAAgB,EAAE,cAAc,GAAG,CAAC;AAAA,EAC1D;AAAA,EAEA,OAAsB;AACpB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEA,QAAuB;AACrB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEA,WAAyC;AACvC,WAAO;AAAA,EACT;AAAA,EAEA,MAA+B;AAC7B,WAAO;AAAA,EACT;AAAA,EAEA,SAAS,GAAkC;AACzC,WAAO,YAAY,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EACjD;AAAA,EAEA,QAAQ,GAAgC;AACtC,WAAO,eAAe,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EACpD;AAAA,EAEA,KAAK,GAAgC;AACnC,WAAO,YAAY,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EACjD;AAAA,EAEA,MAAM,YAAY,GAAqC;AACrD,UAAM,SAAS,MAAM,KAAK,MAAM,IAAI,EAAE,QAAQ;AAC9C,WAAO,OAAO,OAAO,cAAc;AAAA,EACrC;AAAA,EAEA,KAAK,OAA4B,SAAS,IAAyB;AACjE,UAAM,YACJ,WAAW,KACP,MAAM;AAAA,MAAI,CAAC,MACT,EAAE,WAAW,KACT,IACA,IAAI,SAAS;AAAA,QACX,UAAU,EAAE;AAAA,QACZ,WAAW,EAAE;AAAA,QACb,GAAI,EAAE,YAAY,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,CAAC;AAAA,QACnD,UAAU,EAAE;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACP,IACA;AACN,WAAO,mBAAmB,KAAK,UAAU,WAAW,KAAK,KAAK;AAAA,EAChE;AAAA,EAEA,WAA0C;AACxC,WAAO,QAAQ,QAAQ;AAAA,MACrB,MAAM,KAAK;AAAA,MACX,QAAQ,oBAAoB,KAAK,MAAM;AAAA,IACzC,CAAC;AAAA,EACH;AAAA,EAEA,UAAU,QAA6C;AACrD,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/resource/linear/linear.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 BaseResource,\n type FileStat,\n HttpLinearTransport,\n LINEAR_COMMANDS,\n LINEAR_PROMPT,\n LINEAR_VFS_OPS,\n LINEAR_WRITE_PROMPT,\n LinearAccessor,\n type LinearReaddirFilter,\n linearRead,\n linearReaddir,\n linearStat,\n PathSpec,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n resolveLinearGlob,\n} from '@struktoai/mirage-core'\nimport { redactLinearConfig, type LinearConfig, type LinearConfigRedacted } from './config.ts'\n\nexport interface LinearResourceState {\n type: string\n config: LinearConfigRedacted\n}\n\nexport class LinearResource extends BaseResource implements Resource {\n readonly kind: string = ResourceName.LINEAR\n readonly isRemote: boolean = true\n readonly indexTtl: number = 600\n readonly prompt: string = LINEAR_PROMPT\n readonly writePrompt: string = LINEAR_WRITE_PROMPT\n readonly config: LinearConfig\n readonly accessor: LinearAccessor\n\n constructor(config: LinearConfig) {\n super()\n this.config = config\n const transportOpts: { apiKey: string; baseUrl?: string } = { apiKey: config.apiKey }\n if (config.baseUrl !== undefined) transportOpts.baseUrl = config.baseUrl\n this.accessor = new LinearAccessor(new HttpLinearTransport(transportOpts))\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n close(): Promise<void> {\n return Promise.resolve()\n }\n\n commands(): readonly RegisteredCommand[] {\n return LINEAR_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return LINEAR_VFS_OPS\n }\n\n private filter(): LinearReaddirFilter {\n const out: LinearReaddirFilter = {}\n if (this.config.teamIds !== undefined) out.teamIds = this.config.teamIds\n return out\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return linearRead(this.accessor, p, this.index, this.filter())\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return linearReaddir(this.accessor, p, this.index, this.filter())\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return linearStat(this.accessor, p, this.index)\n }\n\n async fingerprint(p: PathSpec): Promise<string | null> {\n const lookup = await this.index.get(p.original)\n return lookup.entry?.remoteTime ?? null\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n 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 resolveLinearGlob(this.accessor, effective, this.index, this.filter())\n }\n\n getState(): Promise<LinearResourceState> {\n return Promise.resolve({\n type: this.kind,\n config: redactLinearConfig(this.config),\n })\n }\n\n loadState(_state: LinearResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n"],"mappings":";;;;;AAcA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,OACK;AAQA,IAAM,iBAAN,cAA6B,aAAiC;AAAA,EAC1D,OAAe,aAAa;AAAA,EAC5B,WAAoB;AAAA,EACpB,WAAmB;AAAA,EACnB,SAAiB;AAAA,EACjB,cAAsB;AAAA,EACtB;AAAA,EACA;AAAA,EAET,YAAY,QAAsB;AAChC,UAAM;AACN,SAAK,SAAS;AACd,UAAM,gBAAsD,EAAE,QAAQ,OAAO,OAAO;AACpF,QAAI,OAAO,YAAY,OAAW,eAAc,UAAU,OAAO;AACjE,SAAK,WAAW,IAAI,eAAe,IAAI,oBAAoB,aAAa,CAAC;AAAA,EAC3E;AAAA,EAEA,OAAsB;AACpB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEA,QAAuB;AACrB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEA,WAAyC;AACvC,WAAO;AAAA,EACT;AAAA,EAEA,MAA+B;AAC7B,WAAO;AAAA,EACT;AAAA,EAEQ,SAA8B;AACpC,UAAM,MAA2B,CAAC;AAClC,QAAI,KAAK,OAAO,YAAY,OAAW,KAAI,UAAU,KAAK,OAAO;AACjE,WAAO;AAAA,EACT;AAAA,EAEA,SAAS,GAAkC;AACzC,WAAO,WAAW,KAAK,UAAU,GAAG,KAAK,OAAO,KAAK,OAAO,CAAC;AAAA,EAC/D;AAAA,EAEA,QAAQ,GAAgC;AACtC,WAAO,cAAc,KAAK,UAAU,GAAG,KAAK,OAAO,KAAK,OAAO,CAAC;AAAA,EAClE;AAAA,EAEA,KAAK,GAAgC;AACnC,WAAO,WAAW,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EAChD;AAAA,EAEA,MAAM,YAAY,GAAqC;AACrD,UAAM,SAAS,MAAM,KAAK,MAAM,IAAI,EAAE,QAAQ;AAC9C,WAAO,OAAO,OAAO,cAAc;AAAA,EACrC;AAAA,EAEA,KAAK,OAA4B,SAAS,IAAyB;AACjE,UAAM,YACJ,WAAW,KACP,MAAM;AAAA,MAAI,CAAC,MACT,EAAE,WAAW,KACT,IACA,IAAI,SAAS;AAAA,QACX,UAAU,EAAE;AAAA,QACZ,WAAW,EAAE;AAAA,QACb,GAAI,EAAE,YAAY,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,CAAC;AAAA,QACnD,UAAU,EAAE;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACP,IACA;AACN,WAAO,kBAAkB,KAAK,UAAU,WAAW,KAAK,OAAO,KAAK,OAAO,CAAC;AAAA,EAC9E;AAAA,EAEA,WAAyC;AACvC,WAAO,QAAQ,QAAQ;AAAA,MACrB,MAAM,KAAK;AAAA,MACX,QAAQ,mBAAmB,KAAK,MAAM;AAAA,IACxC,CAAC;AAAA,EACH;AAAA,EAEA,UAAU,QAA4C;AACpD,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/resource/github/github.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 BaseResource,\n fetchGitHubRepoInfo,\n fetchGitHubTree,\n type FileStat,\n GITHUB_COMMANDS,\n GITHUB_VFS_OPS,\n GitHubAccessor,\n HttpGitHubTransport,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n githubBuildTreeMap,\n githubPopulateIndex,\n githubRead,\n githubReaddir,\n githubResolveGlob,\n githubStat,\n} from '@struktoai/mirage-core'\nimport { redactGitHubConfig, type GitHubConfig, type GitHubConfigRedacted } from './config.ts'\n\nexport interface GitHubResourceState {\n type: string\n config: GitHubConfigRedacted\n defaultBranch: string\n truncated: boolean\n}\n\nexport class GitHubResource extends BaseResource implements Resource {\n readonly kind: string = ResourceName.GITHUB\n readonly isRemote: boolean = true\n readonly indexTtl: number = 86_400\n readonly config: GitHubConfig\n readonly accessor: GitHubAccessor\n\n private constructor(config: GitHubConfig, accessor: GitHubAccessor, index: IndexCacheStore) {\n super()\n this.config = config\n this.accessor = accessor\n this._index = index\n }\n\n static async create(config: GitHubConfig): Promise<GitHubResource> {\n const transportOpts: { token: string; baseUrl?: string } = { token: config.token }\n if (config.baseUrl !== undefined) transportOpts.baseUrl = config.baseUrl\n const transport = new HttpGitHubTransport(transportOpts)\n const repoInfo = await fetchGitHubRepoInfo(transport, config.owner, config.repo)\n const ref = config.ref ?? repoInfo.default_branch\n const { tree, truncated } = await fetchGitHubTree(transport, config.owner, config.repo, ref)\n const treeMap = githubBuildTreeMap(tree)\n const accessor = new GitHubAccessor({\n transport,\n owner: config.owner,\n repo: config.repo,\n ref,\n defaultBranch: repoInfo.default_branch,\n truncated,\n tree: treeMap,\n })\n const index = new RAMIndexCacheStore({ ttl: 86_400 })\n await githubPopulateIndex(index, tree)\n return new GitHubResource(config, accessor, index)\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n close(): Promise<void> {\n return Promise.resolve()\n }\n\n commands(): readonly RegisteredCommand[] {\n return GITHUB_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return GITHUB_VFS_OPS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return githubRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return githubReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return githubStat(this.accessor, p, this.index)\n }\n\n async fingerprint(p: PathSpec): Promise<string | null> {\n const lookup = await this.index.get(p.original)\n return lookup.entry?.id ?? null\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n 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 githubResolveGlob(this.accessor, effective, this.index)\n }\n\n getState(): Promise<GitHubResourceState> {\n return Promise.resolve({\n type: this.kind,\n config: redactGitHubConfig(this.config),\n defaultBranch: this.accessor.defaultBranch,\n truncated: this.accessor.truncated,\n })\n }\n\n loadState(_state: GitHubResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n"],"mappings":";;;;;AAcA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUA,IAAM,iBA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AgC;AACtC,WAAO,cAAc,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EACnD;AAAA,EAEA,KAAK,GAAgC;AACnC,WAAO,WAAW,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EAChD;AAAA,EAEA,MAAM,YAAY,GAAqC;AACrD,UAAM,SAAS,MAAM,KAAK,MAAM,IAAI,EAAE,QAAQ;AAC9C,WAAO,OAAO,OAAO,MAAM;AAAA,EAC7B;AAAA,EAEA,KAAK,OAA4B,SAAS,IAAyB;AACjE,UAAM,YACJ,WAAW,KACP,MAAM;AAAA,MAAI,CAAC,MACT,EAAE,WAAW,KACT,IACA,IAAI,SAAS;AAAA,QACX,UAAU,EAAE;AAAA,QACZ,WAAW,EAAE;AAAA,QACb,GAAI,EAAE,YAAY,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,CAAC;AAAA,QACnD,UAAU,EAAE;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACP,IACA;AACN,WAAO,kBAAkB,KAAK,UAAU,WAAW,KAAK,KAAK;AAAA,EAC/D;AAAA,EAEA,WAAyC;AACvC,WAAO,QAAQ,QAAQ;AAAA,MACrB,MAAM,KAAK;AAAA,MACX,QAAQ,mBAAmB,KAAK,MAAM;AAAA,MACtC,eAAe,KAAK,SAAS;AAAA,MAC7B,WAAW,KAAK,SAAS;AAAA,IAC3B,CAAC;AAAA,EACH;AAAA,EAEA,UAAU,QAA4C;AACpD,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
@@ -1,7 +0,0 @@
1
- import {
2
- DatabricksVolumeResource
3
- } from "./chunk-JZQHKDSY.js";
4
- export {
5
- DatabricksVolumeResource
6
- };
7
- //# sourceMappingURL=databricks_volume-HNQ4DJVJ.js.map
@@ -1,7 +0,0 @@
1
- import {
2
- MongoDBResource
3
- } from "./chunk-RLGWMJD3.js";
4
- export {
5
- MongoDBResource
6
- };
7
- //# sourceMappingURL=mongodb-ZOX4FRHJ.js.map
@@ -1,7 +0,0 @@
1
- import {
2
- PostgresResource
3
- } from "./chunk-NHS7WLEQ.js";
4
- export {
5
- PostgresResource
6
- };
7
- //# sourceMappingURL=postgres-JNFMPAO2.js.map