@struktoai/mirage-browser 0.0.4 → 0.0.5

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 (235) hide show
  1. package/README.md +2 -1
  2. package/dist/aliyun-DR6KT3H6.js +8 -0
  3. package/dist/backblaze-XCLZXTES.js +8 -0
  4. package/dist/box-XBCSU3AA.js +8 -0
  5. package/dist/ceph-F5S2NMTO.js +8 -0
  6. package/dist/{chunk-DGP3N4WM.js → chunk-2J35WXX5.js} +7 -2
  7. package/dist/chunk-2J35WXX5.js.map +1 -0
  8. package/dist/{chunk-LW56WZDS.js → chunk-2WNXK742.js} +2 -2
  9. package/dist/{chunk-PSEXJ5S5.js → chunk-2WSKXBSV.js} +11 -2
  10. package/dist/chunk-2WSKXBSV.js.map +1 -0
  11. package/dist/{chunk-DKPDXQML.js → chunk-3IYCVC7W.js} +7 -3
  12. package/dist/chunk-3IYCVC7W.js.map +1 -0
  13. package/dist/{chunk-NVGB3B7J.js → chunk-46HNNKFR.js} +7 -3
  14. package/dist/chunk-46HNNKFR.js.map +1 -0
  15. package/dist/chunk-4IF4TGAI.js +11 -0
  16. package/dist/chunk-4IF4TGAI.js.map +1 -0
  17. package/dist/{chunk-AUXZEXCG.js → chunk-5OZJMTYW.js} +7 -3
  18. package/dist/{chunk-AUXZEXCG.js.map → chunk-5OZJMTYW.js.map} +1 -1
  19. package/dist/{chunk-6BXVYCIC.js → chunk-5UM6EBVW.js} +10 -2
  20. package/dist/chunk-5UM6EBVW.js.map +1 -0
  21. package/dist/{chunk-JV4T5HNB.js → chunk-6HRSCX2U.js} +7 -3
  22. package/dist/chunk-6HRSCX2U.js.map +1 -0
  23. package/dist/{chunk-EDS5Q5B7.js → chunk-7HWQAYXR.js} +7 -3
  24. package/dist/chunk-7HWQAYXR.js.map +1 -0
  25. package/dist/{chunk-2R7SPBTM.js → chunk-AUZNQ7EI.js} +5 -10
  26. package/dist/chunk-AUZNQ7EI.js.map +1 -0
  27. package/dist/{chunk-DC6VA36O.js → chunk-BGA2F226.js} +19 -7
  28. package/dist/chunk-BGA2F226.js.map +1 -0
  29. package/dist/{chunk-NYTRDAWX.js → chunk-BV372CUO.js} +6 -11
  30. package/dist/chunk-BV372CUO.js.map +1 -0
  31. package/dist/{chunk-HTQ4GBKM.js → chunk-C4THTILY.js} +7 -3
  32. package/dist/chunk-C4THTILY.js.map +1 -0
  33. package/dist/{chunk-GENFT46X.js → chunk-D4MEOKNQ.js} +7 -3
  34. package/dist/chunk-D4MEOKNQ.js.map +1 -0
  35. package/dist/chunk-D4RAMWYH.js +88 -0
  36. package/dist/chunk-D4RAMWYH.js.map +1 -0
  37. package/dist/{chunk-3FZ3GHZO.js → chunk-EHIT6WCY.js} +7 -3
  38. package/dist/chunk-EHIT6WCY.js.map +1 -0
  39. package/dist/{chunk-PCC6EZIE.js → chunk-EN6TZYT2.js} +7 -3
  40. package/dist/chunk-EN6TZYT2.js.map +1 -0
  41. package/dist/{chunk-MB4TUUJQ.js → chunk-FTDVV7EQ.js} +7 -3
  42. package/dist/chunk-FTDVV7EQ.js.map +1 -0
  43. package/dist/{chunk-VASFK7V6.js → chunk-G67Q2Z6I.js} +7 -3
  44. package/dist/{chunk-VASFK7V6.js.map → chunk-G67Q2Z6I.js.map} +1 -1
  45. package/dist/{chunk-AAJQ6AQT.js → chunk-GM2QMJAY.js} +5 -10
  46. package/dist/chunk-GM2QMJAY.js.map +1 -0
  47. package/dist/{chunk-POJ3IQMQ.js → chunk-HRWLHJX2.js} +5 -11
  48. package/dist/chunk-HRWLHJX2.js.map +1 -0
  49. package/dist/{chunk-AUKVYHNZ.js → chunk-INEXV2PN.js} +7 -3
  50. package/dist/chunk-INEXV2PN.js.map +1 -0
  51. package/dist/chunk-IZMKMD3O.js +11 -0
  52. package/dist/chunk-IZMKMD3O.js.map +1 -0
  53. package/dist/{chunk-N5VRBFRT.js → chunk-JUVMJ5GI.js} +5 -10
  54. package/dist/{chunk-HPID7BWJ.js.map → chunk-JUVMJ5GI.js.map} +1 -1
  55. package/dist/{chunk-GQVJTQXU.js → chunk-L64GRKOD.js} +7 -2
  56. package/dist/chunk-L64GRKOD.js.map +1 -0
  57. package/dist/chunk-M2UF2JHJ.js +11 -0
  58. package/dist/chunk-M2UF2JHJ.js.map +1 -0
  59. package/dist/{chunk-5ZNWDS5I.js → chunk-NVHPJ5CV.js} +11 -2
  60. package/dist/chunk-NVHPJ5CV.js.map +1 -0
  61. package/dist/{chunk-MQMUOJZ2.js → chunk-OSTDTTWI.js} +7 -2
  62. package/dist/chunk-OSTDTTWI.js.map +1 -0
  63. package/dist/{chunk-GZFNGV55.js → chunk-PQCRGTSA.js} +7 -3
  64. package/dist/chunk-PQCRGTSA.js.map +1 -0
  65. package/dist/{chunk-6ETIHSTA.js → chunk-QE7QNA45.js} +6 -2
  66. package/dist/{chunk-6ETIHSTA.js.map → chunk-QE7QNA45.js.map} +1 -1
  67. package/dist/{chunk-EHTYPBGX.js → chunk-QG2NUNCY.js} +7 -3
  68. package/dist/chunk-QG2NUNCY.js.map +1 -0
  69. package/dist/chunk-UFHBDBZD.js +1212 -0
  70. package/dist/chunk-UFHBDBZD.js.map +1 -0
  71. package/dist/{chunk-E77ESWWV.js → chunk-UY22T4AC.js} +11 -3
  72. package/dist/chunk-UY22T4AC.js.map +1 -0
  73. package/dist/chunk-XJBC3OYX.js +11 -0
  74. package/dist/chunk-XJBC3OYX.js.map +1 -0
  75. package/dist/{chunk-TCFD6YJ5.js → chunk-Y6DYUK6J.js} +7 -3
  76. package/dist/chunk-Y6DYUK6J.js.map +1 -0
  77. package/dist/{chunk-HPID7BWJ.js → chunk-YOCTIHQZ.js} +5 -1
  78. package/dist/chunk-YOCTIHQZ.js.map +1 -0
  79. package/dist/{chunk-PDZSZ5CB.js → chunk-ZDJPUXYH.js} +6 -2
  80. package/dist/{chunk-PDZSZ5CB.js.map → chunk-ZDJPUXYH.js.map} +1 -1
  81. package/dist/{chunk-CQERQTAZ.js → chunk-ZKCOSE3R.js} +6 -9
  82. package/dist/chunk-ZKCOSE3R.js.map +1 -0
  83. package/dist/chunk-ZTHVEXIV.js +11 -0
  84. package/dist/chunk-ZTHVEXIV.js.map +1 -0
  85. package/dist/{config-MHBKYS53.js → config-2Y6LZKLV.js} +2 -2
  86. package/dist/config-4GSOMUMF.js +9 -0
  87. package/dist/config-5YBUWFUP.js +9 -0
  88. package/dist/{config-PWZXYJOI.js → config-DE5OZ4I7.js} +2 -2
  89. package/dist/config-ELDOFRJW.js +9 -0
  90. package/dist/config-FPM3LAW7.js +9 -0
  91. package/dist/{config-22T7HJBJ.js → config-JY557MA6.js} +2 -2
  92. package/dist/config-WRACCRPN.js +9 -0
  93. package/dist/digitalocean-QDHTRS2W.js +8 -0
  94. package/dist/discord-ERUI7OAQ.js +7 -0
  95. package/dist/dropbox-3U6D4HLE.js +8 -0
  96. package/dist/gcal-MTBSDG34.js +8 -0
  97. package/dist/gcs-KNGRBBET.js +8 -0
  98. package/dist/gdocs-RUIOIRKP.js +8 -0
  99. package/dist/gdrive-5JB7ZKEP.js +8 -0
  100. package/dist/github-CIXBFBVO.js +7 -0
  101. package/dist/github_ci-HR6YOYAO.js +8 -0
  102. package/dist/{gmail-HLZIMKQU.js → gmail-JHGWTQU5.js} +2 -2
  103. package/dist/gsheets-N54JO2RS.js +8 -0
  104. package/dist/gslides-B4VMNLMB.js +8 -0
  105. package/dist/index.d.ts +284 -352
  106. package/dist/index.js +165 -104
  107. package/dist/index.js.map +1 -1
  108. package/dist/langfuse-HEUJGDOC.js +7 -0
  109. package/dist/linear-J4QQ3CA6.js +7 -0
  110. package/dist/minio-BXWHJ6K5.js +8 -0
  111. package/dist/notion-I5S5SRLO.js +7 -0
  112. package/dist/oci-XOPKH4AE.js +8 -0
  113. package/dist/opfs-36QO72Y5.js +7 -0
  114. package/dist/qingstor-JKAHLK62.js +8 -0
  115. package/dist/r2-L3QXQ76M.js +8 -0
  116. package/dist/{s3-CSFY3PLT.js → s3-LRZJPGHK.js} +2 -2
  117. package/dist/scaleway-CGNDYNKS.js +8 -0
  118. package/dist/seaweedfs-BSQWCBIR.js +8 -0
  119. package/dist/slack-62ECSENR.js +7 -0
  120. package/dist/supabase-J66NXWAF.js +8 -0
  121. package/dist/tencent-AC667LV3.js +8 -0
  122. package/dist/trello-SUPG6VDF.js +7 -0
  123. package/dist/trello-SUPG6VDF.js.map +1 -0
  124. package/dist/wasabi-5KKPW6LH.js +8 -0
  125. package/dist/wasabi-5KKPW6LH.js.map +1 -0
  126. package/package.json +2 -2
  127. package/dist/aliyun-YEWHEWCL.js +0 -8
  128. package/dist/backblaze-LWE2HEDK.js +0 -8
  129. package/dist/box-GTWWIB6F.js +0 -8
  130. package/dist/ceph-ATSCSVGU.js +0 -8
  131. package/dist/chunk-23NO22WD.js +0 -25
  132. package/dist/chunk-23NO22WD.js.map +0 -1
  133. package/dist/chunk-2R7SPBTM.js.map +0 -1
  134. package/dist/chunk-3FZ3GHZO.js.map +0 -1
  135. package/dist/chunk-4YUYQTRN.js +0 -2334
  136. package/dist/chunk-4YUYQTRN.js.map +0 -1
  137. package/dist/chunk-5ZNWDS5I.js.map +0 -1
  138. package/dist/chunk-6BXVYCIC.js.map +0 -1
  139. package/dist/chunk-AAJQ6AQT.js.map +0 -1
  140. package/dist/chunk-AUKVYHNZ.js.map +0 -1
  141. package/dist/chunk-CQERQTAZ.js.map +0 -1
  142. package/dist/chunk-DC6VA36O.js.map +0 -1
  143. package/dist/chunk-DGP3N4WM.js.map +0 -1
  144. package/dist/chunk-DKPDXQML.js.map +0 -1
  145. package/dist/chunk-DQK6H5LW.js +0 -25
  146. package/dist/chunk-DQK6H5LW.js.map +0 -1
  147. package/dist/chunk-E77ESWWV.js.map +0 -1
  148. package/dist/chunk-EDS5Q5B7.js.map +0 -1
  149. package/dist/chunk-EHTYPBGX.js.map +0 -1
  150. package/dist/chunk-GENFT46X.js.map +0 -1
  151. package/dist/chunk-GQVJTQXU.js.map +0 -1
  152. package/dist/chunk-GZFNGV55.js.map +0 -1
  153. package/dist/chunk-HTQ4GBKM.js.map +0 -1
  154. package/dist/chunk-JV4T5HNB.js.map +0 -1
  155. package/dist/chunk-MB4TUUJQ.js.map +0 -1
  156. package/dist/chunk-MQMUOJZ2.js.map +0 -1
  157. package/dist/chunk-N5VRBFRT.js.map +0 -1
  158. package/dist/chunk-NVGB3B7J.js.map +0 -1
  159. package/dist/chunk-NYTRDAWX.js.map +0 -1
  160. package/dist/chunk-PCC6EZIE.js.map +0 -1
  161. package/dist/chunk-POJ3IQMQ.js.map +0 -1
  162. package/dist/chunk-PSEXJ5S5.js.map +0 -1
  163. package/dist/chunk-QXJP6TWI.js +0 -27
  164. package/dist/chunk-QXJP6TWI.js.map +0 -1
  165. package/dist/chunk-TCFD6YJ5.js.map +0 -1
  166. package/dist/chunk-ZLHC2CZ6.js +0 -25
  167. package/dist/chunk-ZLHC2CZ6.js.map +0 -1
  168. package/dist/config-A56HUM6C.js +0 -9
  169. package/dist/config-DIWQZBOK.js +0 -9
  170. package/dist/config-HGJ2MGAC.js +0 -9
  171. package/dist/config-PAHALM2T.js +0 -9
  172. package/dist/digitalocean-SQA6MJJQ.js +0 -8
  173. package/dist/discord-ASNFJP6A.js +0 -7
  174. package/dist/dropbox-VV2WZE6I.js +0 -8
  175. package/dist/gcs-2W6DDWM7.js +0 -8
  176. package/dist/gdocs-QPM7VXXE.js +0 -8
  177. package/dist/gdrive-KT6R7EVB.js +0 -8
  178. package/dist/github-3IFZGW6I.js +0 -7
  179. package/dist/github_ci-CKKF2Y4S.js +0 -8
  180. package/dist/gsheets-HF4YPIEF.js +0 -8
  181. package/dist/gslides-EV2JJH7I.js +0 -8
  182. package/dist/langfuse-74ZCR6QL.js +0 -7
  183. package/dist/linear-XABGTU6E.js +0 -7
  184. package/dist/minio-JPNSX2NP.js +0 -8
  185. package/dist/notion-YJOTGH7J.js +0 -7
  186. package/dist/oci-R4VYQKGJ.js +0 -8
  187. package/dist/opfs-4RWMJBCI.js +0 -7
  188. package/dist/qingstor-ZWWK2ZGV.js +0 -8
  189. package/dist/r2-PZAN2YFG.js +0 -8
  190. package/dist/scaleway-BFROPDBB.js +0 -8
  191. package/dist/seaweedfs-X6THZT26.js +0 -8
  192. package/dist/slack-O7BTJ4YR.js +0 -7
  193. package/dist/supabase-PHN3MIXW.js +0 -8
  194. package/dist/tencent-JGCJEKHV.js +0 -8
  195. package/dist/trello-QUDOP3M2.js +0 -7
  196. package/dist/wasabi-5VMNAFOC.js +0 -8
  197. /package/dist/{aliyun-YEWHEWCL.js.map → aliyun-DR6KT3H6.js.map} +0 -0
  198. /package/dist/{backblaze-LWE2HEDK.js.map → backblaze-XCLZXTES.js.map} +0 -0
  199. /package/dist/{box-GTWWIB6F.js.map → box-XBCSU3AA.js.map} +0 -0
  200. /package/dist/{ceph-ATSCSVGU.js.map → ceph-F5S2NMTO.js.map} +0 -0
  201. /package/dist/{chunk-LW56WZDS.js.map → chunk-2WNXK742.js.map} +0 -0
  202. /package/dist/{config-22T7HJBJ.js.map → config-2Y6LZKLV.js.map} +0 -0
  203. /package/dist/{config-A56HUM6C.js.map → config-4GSOMUMF.js.map} +0 -0
  204. /package/dist/{config-DIWQZBOK.js.map → config-5YBUWFUP.js.map} +0 -0
  205. /package/dist/{config-HGJ2MGAC.js.map → config-DE5OZ4I7.js.map} +0 -0
  206. /package/dist/{config-MHBKYS53.js.map → config-ELDOFRJW.js.map} +0 -0
  207. /package/dist/{config-PAHALM2T.js.map → config-FPM3LAW7.js.map} +0 -0
  208. /package/dist/{config-PWZXYJOI.js.map → config-JY557MA6.js.map} +0 -0
  209. /package/dist/{digitalocean-SQA6MJJQ.js.map → config-WRACCRPN.js.map} +0 -0
  210. /package/dist/{discord-ASNFJP6A.js.map → digitalocean-QDHTRS2W.js.map} +0 -0
  211. /package/dist/{dropbox-VV2WZE6I.js.map → discord-ERUI7OAQ.js.map} +0 -0
  212. /package/dist/{gcs-2W6DDWM7.js.map → dropbox-3U6D4HLE.js.map} +0 -0
  213. /package/dist/{gdocs-QPM7VXXE.js.map → gcal-MTBSDG34.js.map} +0 -0
  214. /package/dist/{gdrive-KT6R7EVB.js.map → gcs-KNGRBBET.js.map} +0 -0
  215. /package/dist/{github-3IFZGW6I.js.map → gdocs-RUIOIRKP.js.map} +0 -0
  216. /package/dist/{github_ci-CKKF2Y4S.js.map → gdrive-5JB7ZKEP.js.map} +0 -0
  217. /package/dist/{gmail-HLZIMKQU.js.map → github-CIXBFBVO.js.map} +0 -0
  218. /package/dist/{gsheets-HF4YPIEF.js.map → github_ci-HR6YOYAO.js.map} +0 -0
  219. /package/dist/{gslides-EV2JJH7I.js.map → gmail-JHGWTQU5.js.map} +0 -0
  220. /package/dist/{langfuse-74ZCR6QL.js.map → gsheets-N54JO2RS.js.map} +0 -0
  221. /package/dist/{linear-XABGTU6E.js.map → gslides-B4VMNLMB.js.map} +0 -0
  222. /package/dist/{minio-JPNSX2NP.js.map → langfuse-HEUJGDOC.js.map} +0 -0
  223. /package/dist/{notion-YJOTGH7J.js.map → linear-J4QQ3CA6.js.map} +0 -0
  224. /package/dist/{oci-R4VYQKGJ.js.map → minio-BXWHJ6K5.js.map} +0 -0
  225. /package/dist/{opfs-4RWMJBCI.js.map → notion-I5S5SRLO.js.map} +0 -0
  226. /package/dist/{qingstor-ZWWK2ZGV.js.map → oci-XOPKH4AE.js.map} +0 -0
  227. /package/dist/{r2-PZAN2YFG.js.map → opfs-36QO72Y5.js.map} +0 -0
  228. /package/dist/{s3-CSFY3PLT.js.map → qingstor-JKAHLK62.js.map} +0 -0
  229. /package/dist/{scaleway-BFROPDBB.js.map → r2-L3QXQ76M.js.map} +0 -0
  230. /package/dist/{seaweedfs-X6THZT26.js.map → s3-LRZJPGHK.js.map} +0 -0
  231. /package/dist/{slack-O7BTJ4YR.js.map → scaleway-CGNDYNKS.js.map} +0 -0
  232. /package/dist/{supabase-PHN3MIXW.js.map → seaweedfs-BSQWCBIR.js.map} +0 -0
  233. /package/dist/{tencent-JGCJEKHV.js.map → slack-62ECSENR.js.map} +0 -0
  234. /package/dist/{trello-QUDOP3M2.js.map → supabase-J66NXWAF.js.map} +0 -0
  235. /package/dist/{wasabi-5VMNAFOC.js.map → tencent-AC667LV3.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resource/opfs/opfs.ts","../src/accessor/opfs.ts","../src/commands/builtin/opfs/index.ts","../src/core/opfs/append.ts","../src/core/opfs/utils.ts","../src/core/opfs/constants.ts","../src/core/opfs/copy.ts","../src/core/opfs/write.ts","../src/core/opfs/create.ts","../src/core/opfs/du/walk.ts","../src/core/opfs/du/entries.ts","../src/core/opfs/du/size.ts","../src/core/opfs/exists.ts","../src/core/opfs/find.ts","../src/core/opfs/mkdir.ts","../src/core/opfs/read.ts","../src/core/opfs/readdir.ts","../src/core/opfs/rename.ts","../src/core/opfs/rm.ts","../src/core/opfs/rmdir.ts","../src/core/opfs/stat.ts","../src/core/opfs/stream.ts","../src/core/opfs/truncate.ts","../src/core/opfs/unlink.ts","../src/commands/builtin/opfs/io.ts","../src/ops/opfs/append.ts","../src/ops/opfs/create.ts","../src/ops/opfs/mkdir.ts","../src/ops/opfs/read.ts","../src/ops/opfs/readdir.ts","../src/ops/opfs/rename.ts","../src/ops/opfs/rmdir.ts","../src/ops/opfs/stat.ts","../src/ops/opfs/truncate.ts","../src/ops/opfs/unlink.ts","../src/ops/opfs/write.ts","../src/ops/opfs/index.ts","../src/resource/opfs/prompt.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type FileStat,\n type FindOptions,\n type PathSpec,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n lstripSlash,\n makeResolveGlob,\n compareCodePoints,\n} from '@struktoai/mirage-core'\nimport { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { OPFS_COMMANDS } from '../../commands/builtin/opfs/index.ts'\nimport { appendBytes as appendCore } from '../../core/opfs/append.ts'\nimport { SCOPE_ERROR } from '../../core/opfs/constants.ts'\nimport { copy as copyCore } from '../../core/opfs/copy.ts'\nimport { size as duSizeCore } from '../../core/opfs/du/index.ts'\nimport { exists as existsCore } from '../../core/opfs/exists.ts'\nimport { find as findCore, type FindOptions as OPFSFindOptions } from '../../core/opfs/find.ts'\nimport { mkdir as mkdirCore } from '../../core/opfs/mkdir.ts'\nimport { read as readCoreFn } from '../../core/opfs/read.ts'\nimport { readdir as readdirCore } from '../../core/opfs/readdir.ts'\nimport { rename as renameCore } from '../../core/opfs/rename.ts'\nimport { rmR as rmRCore } from '../../core/opfs/rm.ts'\nimport { rmdir as rmdirCore } from '../../core/opfs/rmdir.ts'\nimport { stat as statCore } from '../../core/opfs/stat.ts'\nimport { stream as streamCore } from '../../core/opfs/stream.ts'\nimport { truncate as truncateCore } from '../../core/opfs/truncate.ts'\nimport { unlink as unlinkCore } from '../../core/opfs/unlink.ts'\nimport { iterEntries, toWritableChunk } from '../../core/opfs/utils.ts'\nimport { writeBytes as writeCore } from '../../core/opfs/write.ts'\nimport { OPFS_OPS } from '../../ops/opfs/index.ts'\nimport { OPFS_PROMPT } from './prompt.ts'\n\nconst globCore = makeResolveGlob(readdirCore, SCOPE_ERROR)\n\nexport interface OPFSResourceOptions {\n root?: string\n}\n\nexport interface OPFSResourceState {\n type: string\n files: Record<string, Uint8Array>\n dirs: string[]\n}\n\nasync function walkFiles(\n dir: FileSystemDirectoryHandle,\n currentPath: string,\n files: Record<string, Uint8Array>,\n): Promise<void> {\n for await (const [name, handle] of iterEntries(dir)) {\n const childPath = currentPath === '' ? name : `${currentPath}/${name}`\n if (handle.kind === 'file') {\n const fh = await dir.getFileHandle(name, { create: false })\n const file = await fh.getFile()\n files[childPath] = new Uint8Array(await file.arrayBuffer())\n } else {\n const child = await dir.getDirectoryHandle(name, { create: false })\n await walkFiles(child, childPath, files)\n }\n }\n}\n\nasync function walkDirs(\n dir: FileSystemDirectoryHandle,\n currentPath: string,\n dirs: string[],\n): Promise<void> {\n for await (const [name, handle] of iterEntries(dir)) {\n if (handle.kind !== 'directory') continue\n const childPath = currentPath === '' ? `/${name}` : `${currentPath}/${name}`\n dirs.push(childPath)\n const child = await dir.getDirectoryHandle(name, { create: false })\n await walkDirs(child, childPath, dirs)\n }\n}\n\nasync function splitAndCreate(\n root: FileSystemDirectoryHandle,\n relativePath: string,\n): Promise<FileSystemDirectoryHandle> {\n let handle = root\n for (const seg of relativePath.split('/')) {\n if (seg === '' || seg === '.') continue\n handle = await handle.getDirectoryHandle(seg, { create: true })\n }\n return handle\n}\n\nexport class OPFSResource implements Resource {\n readonly kind = ResourceName.OPFS\n // OPFS is a real filesystem: getFile().size is the exact byte count a\n // read returns.\n readonly sizesAlwaysKnown: boolean = true\n readonly prompt = OPFS_PROMPT\n readonly rootName: string\n readonly accessor: OPFSAccessor\n private rootHandle: FileSystemDirectoryHandle | null = null\n private openPromise: Promise<FileSystemDirectoryHandle> | null = null\n\n constructor(options: OPFSResourceOptions = {}) {\n this.rootName = options.root ?? ''\n this.accessor = new OPFSAccessor(this)\n }\n\n open(): Promise<void> {\n return this.ensureOpen().then(() => undefined)\n }\n\n close(): Promise<void> {\n this.rootHandle = null\n this.openPromise = null\n return Promise.resolve()\n }\n\n /**\n * Lazily resolve to a usable root handle. Memoizes `navigator.storage`\n * traversal so the resource self-initializes on first method call without\n * relying on an external orchestrator.\n */\n private ensureOpen(): Promise<FileSystemDirectoryHandle> {\n if (this.rootHandle !== null) return Promise.resolve(this.rootHandle)\n this.openPromise ??= (async () => {\n const origin = await navigator.storage.getDirectory()\n let handle = origin\n for (const seg of this.rootName.split('/')) {\n if (seg === '' || seg === '.') continue\n handle = await handle.getDirectoryHandle(seg, { create: true })\n }\n this.rootHandle = handle\n return handle\n })()\n return this.openPromise\n }\n\n requireHandle(): FileSystemDirectoryHandle {\n if (this.rootHandle === null) {\n throw new Error('OPFSResource is not open — call open() first')\n }\n return this.rootHandle\n }\n\n ops(): readonly RegisteredOp[] {\n return OPFS_OPS\n }\n\n commands(): readonly RegisteredCommand[] {\n return OPFS_COMMANDS\n }\n\n async *streamPath(p: PathSpec): AsyncIterable<Uint8Array> {\n await this.ensureOpen()\n yield* streamCore(this.accessor, p)\n }\n\n async readFile(p: PathSpec): Promise<Uint8Array> {\n await this.ensureOpen()\n return readCoreFn(this.accessor, p)\n }\n\n async writeFile(p: PathSpec, data: Uint8Array): Promise<void> {\n await this.ensureOpen()\n return writeCore(this.accessor, p, data)\n }\n\n async appendFile(p: PathSpec, data: Uint8Array): Promise<void> {\n await this.ensureOpen()\n return appendCore(this.accessor, p, data)\n }\n\n async readdir(p: PathSpec): Promise<string[]> {\n await this.ensureOpen()\n return readdirCore(this.accessor, p)\n }\n\n async stat(p: PathSpec): Promise<FileStat> {\n await this.ensureOpen()\n return statCore(this.accessor, p)\n }\n\n async exists(p: PathSpec): Promise<boolean> {\n await this.ensureOpen()\n return existsCore(this.accessor, p)\n }\n\n async mkdir(p: PathSpec, options?: { recursive?: boolean }): Promise<void> {\n await this.ensureOpen()\n return mkdirCore(this.accessor, p, options?.recursive === true)\n }\n\n async rmdir(p: PathSpec): Promise<void> {\n await this.ensureOpen()\n return rmdirCore(this.accessor, p)\n }\n\n async unlink(p: PathSpec): Promise<void> {\n await this.ensureOpen()\n return unlinkCore(this.accessor, p)\n }\n\n async rename(src: PathSpec, dst: PathSpec): Promise<void> {\n await this.ensureOpen()\n return renameCore(this.accessor, src, dst)\n }\n\n async truncate(p: PathSpec, length: number): Promise<void> {\n await this.ensureOpen()\n return truncateCore(this.accessor, p, length)\n }\n\n async copy(src: PathSpec, dst: PathSpec): Promise<void> {\n await this.ensureOpen()\n return copyCore(this.accessor, src, dst)\n }\n\n async rmR(p: PathSpec): Promise<void> {\n await this.ensureOpen()\n return rmRCore(this.accessor, p)\n }\n\n async du(p: PathSpec): Promise<number> {\n await this.ensureOpen()\n return duSizeCore(this.accessor, p)\n }\n\n async find(p: PathSpec, options: FindOptions = {}): Promise<string[]> {\n await this.ensureOpen()\n return findCore(this.accessor, p, options as OPFSFindOptions)\n }\n\n async glob(paths: readonly PathSpec[]): Promise<PathSpec[]> {\n await this.ensureOpen()\n return globCore(this.accessor, paths)\n }\n\n async getState(): Promise<OPFSResourceState> {\n const handle = await this.ensureOpen()\n const files: Record<string, Uint8Array> = {}\n await walkFiles(handle, '', files)\n const dirs: string[] = []\n await walkDirs(handle, '', dirs)\n dirs.sort(compareCodePoints)\n return {\n type: this.kind,\n files,\n dirs,\n }\n }\n\n async loadState(state: OPFSResourceState): Promise<void> {\n const handle = await this.ensureOpen()\n for (const dir of state.dirs) {\n const rel = lstripSlash(dir)\n if (rel === '') continue\n await splitAndCreate(handle, rel)\n }\n for (const [rel, data] of Object.entries(state.files)) {\n const segs = rel.split('/').filter((s) => s !== '' && s !== '.')\n const fileName = segs.pop()\n if (fileName === undefined) continue\n let dir = handle\n for (const seg of segs) {\n dir = await dir.getDirectoryHandle(seg, { create: true })\n }\n const fh = await dir.getFileHandle(fileName, { create: true })\n const writable = await fh.createWritable()\n await writable.write(toWritableChunk(data))\n await writable.close()\n }\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { Accessor } from '@struktoai/mirage-core'\n\nexport interface OPFSHandleProvider {\n requireHandle(): FileSystemDirectoryHandle\n}\n\nexport class OPFSAccessor extends Accessor {\n private readonly provider: OPFSHandleProvider\n\n constructor(provider: OPFSHandleProvider) {\n super()\n this.provider = provider\n }\n\n get rootHandle(): FileSystemDirectoryHandle {\n return this.provider.requireHandle()\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 { ResourceName, makeGenericCommands, type RegisteredCommand } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\nimport { OPFS_IO } from './io.ts'\n\nexport const OPFS_COMMANDS: readonly RegisteredCommand[] = [\n ...makeGenericCommands<OPFSAccessor>(ResourceName.OPFS, OPFS_IO),\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, record, ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { destError, resolveFileHandle, toWritableChunk } from './utils.ts'\n\nexport async function appendBytes(\n accessor: OPFSAccessor,\n p: PathSpec,\n data: Uint8Array,\n): Promise<void> {\n const root = accessor.rootHandle\n const start = performance.now()\n const virtual = p.mountPath\n let handle: FileSystemFileHandle\n try {\n handle = await resolveFileHandle(root, virtual, { create: true })\n } catch (err) {\n throw destError(err, p)\n }\n const existing = await handle.getFile()\n const existingBytes = new Uint8Array(await existing.arrayBuffer())\n const merged = new Uint8Array(existingBytes.byteLength + data.byteLength)\n merged.set(existingBytes, 0)\n merged.set(data, existingBytes.byteLength)\n const writable = await handle.createWritable()\n await writable.write(toWritableChunk(merged))\n await writable.close()\n record('append', virtual, ResourceName.OPFS, data.byteLength, start)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { enoent, enotdir, type PathSpec } from '@struktoai/mirage-core'\n\nexport { norm, parent, gnuBasename as basename } from '@struktoai/mirage-core'\n\nexport function dirname(p: string): string {\n const i = p.lastIndexOf('/')\n if (i < 0) return ''\n if (i === 0) return '/'\n return p.slice(0, i)\n}\n\nexport function splitSegments(virtual: string): string[] {\n const parts: string[] = []\n for (const seg of virtual.split('/')) {\n if (seg === '' || seg === '.') continue\n if (seg === '..') {\n if (parts.length === 0) {\n throw new Error(`path escapes root: ${virtual}`)\n }\n parts.pop()\n continue\n }\n parts.push(seg)\n }\n return parts\n}\n\nexport async function resolveDirHandle(\n root: FileSystemDirectoryHandle,\n virtual: string,\n options: { create?: boolean } = {},\n): Promise<FileSystemDirectoryHandle> {\n const segs = splitSegments(virtual)\n let handle = root\n for (const seg of segs) {\n handle = await handle.getDirectoryHandle(seg, { create: options.create ?? false })\n }\n return handle\n}\n\n// `create` applies to the named file only, never to its parents: that is\n// what O_CREAT means, and OPFS would otherwise build the whole chain on\n// demand (a silent `mkdir -p`) where GNU reports ENOENT. A missing parent\n// surfaces as NotFoundError and a plain-file component as TypeMismatchError,\n// which the callers map to ENOENT/ENOTDIR against the operand.\nexport async function resolveFileHandle(\n root: FileSystemDirectoryHandle,\n virtual: string,\n options: { create?: boolean } = {},\n): Promise<FileSystemFileHandle> {\n const segs = splitSegments(virtual)\n const fileName = segs.pop()\n if (fileName === undefined) {\n throw new Error(`not a file: ${virtual}`)\n }\n let dir = root\n for (const seg of segs) {\n dir = await dir.getDirectoryHandle(seg, { create: false })\n }\n return dir.getFileHandle(fileName, { create: options.create ?? false })\n}\n\nexport async function resolveParentDirHandle(\n root: FileSystemDirectoryHandle,\n virtual: string,\n options: { create?: boolean } = {},\n): Promise<[FileSystemDirectoryHandle, string]> {\n const segs = splitSegments(virtual)\n const name = segs.pop()\n if (name === undefined) {\n throw new Error(`no parent directory: ${virtual}`)\n }\n let dir = root\n for (const seg of segs) {\n dir = await dir.getDirectoryHandle(seg, { create: options.create ?? false })\n }\n return [dir, name]\n}\n\n// Translate a handle-resolution failure on a write target into the errno the\n// command layer reports. OPFS raises NotFoundError for a missing component\n// and TypeMismatchError for one that is a plain file, which are exactly\n// rename(2)'s ENOENT and ENOTDIR. Anything else is a real fault and is\n// rethrown untouched.\nexport function destError(err: unknown, spec: PathSpec): unknown {\n if (isNotFound(err)) return enoent(spec)\n if (isTypeMismatch(err)) return enotdir(spec)\n return err\n}\n\n// What lives at a mount-local key: 'file', 'dir', or null when nothing does.\n// OPFS raises the same TypeMismatchError whichever kind is in the way, so a\n// chain walk that has to tell GNU's two errnos apart can only get the split by\n// trying both handle kinds.\nexport async function kindAt(\n root: FileSystemDirectoryHandle,\n key: string,\n): Promise<'file' | 'dir' | null> {\n let dir: FileSystemDirectoryHandle\n let name: string\n try {\n ;[dir, name] = await resolveParentDirHandle(root, key, { create: false })\n } catch (err) {\n // A chain that stops short is \"nothing here\"; anything else (a\n // SecurityError, an invalid state) is a real backend failure and must\n // not read as an absent component.\n if (!isNotFound(err) && !isTypeMismatch(err)) throw err\n return null\n }\n try {\n await dir.getDirectoryHandle(name, { create: false })\n return 'dir'\n } catch (err) {\n if (!isNotFound(err) && !isTypeMismatch(err)) throw err\n }\n try {\n await dir.getFileHandle(name, { create: false })\n return 'file'\n } catch (err) {\n if (!isNotFound(err) && !isTypeMismatch(err)) throw err\n }\n return null\n}\n\nexport function isNotFound(err: unknown): boolean {\n if (err instanceof DOMException) {\n return err.name === 'NotFoundError'\n }\n return false\n}\n\nexport function isTypeMismatch(err: unknown): boolean {\n if (err instanceof DOMException) {\n return err.name === 'TypeMismatchError'\n }\n return false\n}\n\ninterface DirEntryIter {\n entries(): AsyncIterableIterator<[string, FileSystemHandle]>\n}\n\nexport function toWritableChunk(data: Uint8Array): Blob {\n const copy = new Uint8Array(data.byteLength)\n copy.set(data)\n return new Blob([copy])\n}\n\nexport async function* iterEntries(\n dir: FileSystemDirectoryHandle,\n): AsyncIterable<[string, FileSystemHandle]> {\n const iter = (dir as unknown as DirEntryIter).entries()\n for await (const [name, handle] of iter) {\n yield [name, handle]\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_WARN = 5000\nexport const SCOPE_ERROR = 50000\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { enoent } from '@struktoai/mirage-core'\nimport { destError, isNotFound, resolveFileHandle, toWritableChunk } from './utils.ts'\n\nexport async function copy(accessor: OPFSAccessor, src: PathSpec, dst: PathSpec): Promise<void> {\n const root = accessor.rootHandle\n let srcHandle: FileSystemFileHandle\n try {\n srcHandle = await resolveFileHandle(root, src.mountPath, { create: false })\n } catch (err) {\n if (isNotFound(err)) throw enoent(src)\n throw err\n }\n const file = await srcHandle.getFile()\n const data = new Uint8Array(await file.arrayBuffer())\n let dstHandle: FileSystemFileHandle\n try {\n dstHandle = await resolveFileHandle(root, dst.mountPath, { create: true })\n } catch (err) {\n throw destError(err, dst)\n }\n const writable = await dstHandle.createWritable()\n await writable.write(toWritableChunk(data))\n await writable.close()\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, record, ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { destError, resolveFileHandle, toWritableChunk } from './utils.ts'\n\nexport async function writeBytes(\n accessor: OPFSAccessor,\n p: PathSpec,\n data: Uint8Array,\n): Promise<void> {\n const root = accessor.rootHandle\n const start = performance.now()\n const virtual = p.mountPath\n let handle: FileSystemFileHandle\n try {\n handle = await resolveFileHandle(root, virtual, { create: true })\n } catch (err) {\n throw destError(err, p)\n }\n const writable = await handle.createWritable()\n await writable.write(toWritableChunk(data))\n await writable.close()\n record('write', virtual, ResourceName.OPFS, data.byteLength, start)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { writeBytes } from './write.ts'\n\nexport function create(accessor: OPFSAccessor, path: PathSpec): Promise<void> {\n return writeBytes(accessor, path, new Uint8Array())\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 { isNotFound, iterEntries, resolveDirHandle, resolveParentDirHandle } from '../utils.ts'\n\nasync function walkSizes(dir: FileSystemDirectoryHandle): Promise<number> {\n let total = 0\n for await (const [name, handle] of iterEntries(dir)) {\n if (handle.kind === 'file') {\n try {\n const fh = await dir.getFileHandle(name, { create: false })\n const file = await fh.getFile()\n total += file.size\n } catch {\n // ignore\n }\n } else {\n try {\n const child = await dir.getDirectoryHandle(name, { create: false })\n total += await walkSizes(child)\n } catch {\n // ignore\n }\n }\n }\n return total\n}\n\nexport async function walkAll(\n dir: FileSystemDirectoryHandle,\n currentPath: string,\n entries: [string, number][],\n): Promise<number> {\n let total = 0\n for await (const [name, handle] of iterEntries(dir)) {\n const childPath = currentPath === '/' ? `/${name}` : `${currentPath}/${name}`\n if (handle.kind === 'file') {\n try {\n const fh = await dir.getFileHandle(name, { create: false })\n const file = await fh.getFile()\n entries.push([childPath, file.size])\n total += file.size\n } catch {\n // ignore\n }\n } else {\n try {\n const child = await dir.getDirectoryHandle(name, { create: false })\n total += await walkAll(child, childPath, entries)\n } catch {\n // ignore\n }\n }\n }\n return total\n}\n\nexport async function sizeOfPath(\n root: FileSystemDirectoryHandle,\n virtual: string,\n): Promise<number> {\n try {\n const [parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n try {\n const fh = await parentDir.getFileHandle(name, { create: false })\n const file = await fh.getFile()\n return file.size\n } catch (err) {\n if (!isNotFound(err) && !(err instanceof DOMException && err.name === 'TypeMismatchError')) {\n throw err\n }\n }\n const dir = await parentDir.getDirectoryHandle(name, { create: false })\n return await walkSizes(dir)\n } catch (err) {\n if (isNotFound(err)) return 0\n if (err instanceof Error && err.message.startsWith('no parent directory')) {\n try {\n const rootDir = await resolveDirHandle(root, virtual, { create: false })\n return await walkSizes(rootDir)\n } catch {\n return 0\n }\n }\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 type { PathSpec } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\nimport { isNotFound, norm, resolveDirHandle, resolveParentDirHandle } from '../utils.ts'\nimport { walkAll } from './walk.ts'\nimport { compareCodePoints } from '@struktoai/mirage-core'\n\nexport async function entries(\n accessor: OPFSAccessor,\n p: PathSpec,\n): Promise<[entries: [string, number][], total: number]> {\n const root = accessor.rootHandle\n const virtual = norm(p.mountPath)\n const entries: [string, number][] = []\n try {\n const [parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n try {\n const fh = await parentDir.getFileHandle(name, { create: false })\n const file = await fh.getFile()\n entries.push([virtual, file.size])\n return [entries, file.size]\n } catch (err) {\n if (!isNotFound(err) && !(err instanceof DOMException && err.name === 'TypeMismatchError')) {\n throw err\n }\n }\n const dir = await parentDir.getDirectoryHandle(name, { create: false })\n const total = await walkAll(dir, virtual, entries)\n entries.sort((a, b) => compareCodePoints(a[0], b[0]))\n return [entries, total]\n } catch (err) {\n if (isNotFound(err)) return [entries, 0]\n if (err instanceof Error && err.message.startsWith('no parent directory')) {\n try {\n const rootDir = await resolveDirHandle(root, virtual, { create: false })\n const total = await walkAll(rootDir, virtual, entries)\n entries.sort((a, b) => compareCodePoints(a[0], b[0]))\n return [entries, total]\n } catch {\n return [entries, 0]\n }\n }\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 type { PathSpec } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\nimport { sizeOfPath } from './walk.ts'\n\nexport async function size(accessor: OPFSAccessor, p: PathSpec): Promise<number> {\n return sizeOfPath(accessor.rootHandle, p.mountPath)\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 { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { isNotFound, isTypeMismatch, resolveDirHandle, resolveParentDirHandle } from './utils.ts'\n\nexport async function exists(accessor: OPFSAccessor, path: PathSpec): Promise<boolean> {\n const root = accessor.rootHandle\n const virtual = path.mountPath\n if (virtual === '/' || virtual === '') return true\n try {\n const [parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n try {\n await parentDir.getFileHandle(name, { create: false })\n return true\n } catch (err) {\n if (!isNotFound(err) && !(err instanceof DOMException && err.name === 'TypeMismatchError')) {\n throw err\n }\n }\n try {\n await parentDir.getDirectoryHandle(name, { create: false })\n return true\n } catch (err) {\n if (isNotFound(err) || (err instanceof DOMException && err.name === 'TypeMismatchError')) {\n return false\n }\n throw err\n }\n } catch (err) {\n if (isNotFound(err)) return false\n // A plain file partway down the chain means the path cannot exist, the\n // same answer the kernel gives `test -e /plain/x`. Leaking the raw\n // DOMException instead made callers report the mock's own wording.\n if (isTypeMismatch(err)) return false\n if (err instanceof Error && err.message.startsWith('path escapes root')) return false\n if (err instanceof Error && err.message.startsWith('no parent directory')) {\n try {\n await resolveDirHandle(root, virtual, { create: false })\n return true\n } catch {\n return false\n }\n }\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 type { PathSpec } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { isNotFound, iterEntries, norm, resolveDirHandle } from './utils.ts'\nimport {\n buildTree,\n emitStartPath,\n keep,\n type PredNode,\n startBasename,\n compareCodePoints,\n} from '@struktoai/mirage-core'\n\nexport interface FindOptions {\n name?: string | null\n type?: string | null\n minSize?: number | null\n maxSize?: number | null\n maxDepth?: number | null\n minDepth?: number | null\n nameExclude?: string | null\n orNames?: string[] | null\n iname?: string | null\n pathPattern?: string | null\n empty?: boolean | null\n tree?: PredNode | null\n mtimeMin?: number | null\n mtimeMax?: number | null\n}\n\ninterface WalkCtx {\n options: FindOptions\n tree: PredNode\n results: string[]\n}\n\nasync function walk(\n ctx: WalkCtx,\n dir: FileSystemDirectoryHandle,\n current: string,\n depth: number,\n): Promise<void> {\n const opts = ctx.options\n if (opts.maxDepth !== null && opts.maxDepth !== undefined && depth > opts.maxDepth) return\n let iter: AsyncIterable<[string, FileSystemHandle]>\n try {\n iter = iterEntries(dir)\n } catch {\n return\n }\n for await (const [entryName, handle] of iter) {\n const kind: 'f' | 'd' = handle.kind === 'directory' ? 'd' : 'f'\n const entryPath = current === '/' ? `/${entryName}` : `${current}/${entryName}`\n const entryDepth = depth + 1\n\n let accept = true\n if (opts.maxDepth !== null && opts.maxDepth !== undefined && entryDepth > opts.maxDepth) {\n accept = false\n }\n let isEmpty: boolean | null = null\n if (accept && opts.empty === true) {\n try {\n if (kind === 'f') {\n isEmpty = (await (handle as FileSystemFileHandle).getFile()).size === 0\n } else {\n isEmpty = true\n for await (const _child of iterEntries(handle as FileSystemDirectoryHandle)) {\n void _child\n isEmpty = false\n break\n }\n }\n } catch {\n isEmpty = null\n }\n }\n if (\n accept &&\n !keep(\n { key: entryPath, name: entryName, kind, depth: entryDepth, isEmpty },\n ctx.tree,\n opts.minDepth,\n )\n ) {\n accept = false\n }\n\n // Directories count as size 0 for -size (deliberate GNU divergence).\n if (accept && kind !== 'f' && (opts.minSize != null || opts.maxSize != null)) {\n // Directories contribute size 0 to -size (#318).\n if (opts.minSize != null && opts.minSize > 0) accept = false\n if (opts.maxSize != null && opts.maxSize < 0) accept = false\n }\n if (\n accept &&\n kind === 'f' &&\n (opts.minSize !== null ||\n opts.maxSize !== null ||\n opts.mtimeMin !== null ||\n opts.mtimeMax !== null)\n ) {\n try {\n const fh = await dir.getFileHandle(entryName, { create: false })\n const file = await fh.getFile()\n if (opts.minSize !== null && opts.minSize !== undefined && file.size < opts.minSize)\n accept = false\n if (opts.maxSize !== null && opts.maxSize !== undefined && file.size > opts.maxSize)\n accept = false\n if (accept && (opts.mtimeMin !== undefined || opts.mtimeMax !== undefined)) {\n const mtime = file.lastModified / 1000\n if (opts.mtimeMin !== null && opts.mtimeMin !== undefined && mtime < opts.mtimeMin)\n accept = false\n if (opts.mtimeMax !== null && opts.mtimeMax !== undefined && mtime > opts.mtimeMax)\n accept = false\n }\n } catch {\n accept = false\n }\n }\n\n if (accept) ctx.results.push(entryPath)\n\n if (kind === 'd') {\n try {\n const child = await dir.getDirectoryHandle(entryName, { create: false })\n await walk(ctx, child, entryPath, depth + 1)\n } catch {\n // ignore\n }\n }\n }\n}\n\nexport async function find(\n accessor: OPFSAccessor,\n p: PathSpec,\n options: FindOptions = {},\n): Promise<string[]> {\n const root = accessor.rootHandle\n const virtual = norm(p.mountPath)\n const startName = startBasename(p.virtual)\n const results: string[] = []\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 empty: options.empty,\n })\n let dir: FileSystemDirectoryHandle\n try {\n dir = await resolveDirHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) return results\n throw err\n }\n if (options.maxDepth == null || options.maxDepth >= 0) {\n let rootEmpty: boolean | null = null\n if (options.empty === true) {\n rootEmpty = true\n for await (const _child of iterEntries(dir)) {\n void _child\n rootEmpty = false\n break\n }\n }\n emitStartPath(results, virtual, startName, {\n kind: 'd',\n isEmpty: rootEmpty,\n exists: true,\n tree,\n maxDepth: options.maxDepth,\n minDepth: options.minDepth,\n minSize: options.minSize,\n maxSize: options.maxSize,\n })\n }\n await walk({ options, tree, results }, dir, virtual, 0)\n results.sort(compareCodePoints)\n return results\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type PathSpec,\n ancestors,\n eexist,\n enotdir,\n invalidateAfterWrite,\n invalidateAncestors,\n mountedPath,\n norm,\n} from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport {\n destError,\n kindAt,\n resolveDirHandle,\n resolveParentDirHandle,\n splitSegments,\n} from './utils.ts'\n\n// Reject a `mkdir` OPFS cannot satisfy, the way the store backends'\n// checkMkdirTarget does. OPFS has no kernel to consult and raises the same\n// TypeMismatchError whether the chain crossed a plain file or the target\n// itself is one, so the chain is walked to tell GNU's two errnos apart and to\n// name the component `-p` tripped on.\nasync function checkMkdirTarget(\n root: FileSystemDirectoryHandle,\n spec: PathSpec,\n key: string,\n parents: boolean,\n): Promise<void> {\n if (!parents) {\n if ((await kindAt(root, key)) !== null) throw eexist(spec)\n return\n }\n for (const component of [...ancestors(key), key]) {\n if ((await kindAt(root, component)) !== 'file') continue\n const named = mountedPath(spec, component)\n throw component === key ? eexist(named) : enotdir(named)\n }\n}\n\nexport async function mkdir(\n accessor: OPFSAccessor,\n path: PathSpec,\n parents = false,\n): Promise<void> {\n const root = accessor.rootHandle\n const virtual = path.mountPath\n const segs = splitSegments(virtual)\n if (segs.length === 0) return\n await checkMkdirTarget(root, path, norm(virtual), parents)\n if (parents) {\n await resolveDirHandle(root, virtual, { create: true })\n await invalidateAfterWrite(path)\n await invalidateAncestors(path)\n return\n }\n let parentDir: FileSystemDirectoryHandle\n let name: string\n try {\n ;[parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n } catch (err) {\n // A bare Error here would not be classified as a filesystem failure,\n // so the command layer could not report it with a GNU strerror.\n throw destError(err, path)\n }\n await parentDir.getDirectoryHandle(name, { create: true })\n await invalidateAfterWrite(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 { type PathSpec, record, ResourceName } from '@struktoai/mirage-core'\nimport { eisdir, enoent } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { isNotFound, resolveFileHandle } from './utils.ts'\n\nexport async function read(accessor: OPFSAccessor, path: PathSpec): Promise<Uint8Array> {\n const root = accessor.rootHandle\n const start = performance.now()\n const virtual = path.mountPath\n let handle: FileSystemFileHandle\n try {\n handle = await resolveFileHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) throw enoent(path)\n if (err instanceof DOMException && err.name === 'TypeMismatchError') throw eisdir(path)\n throw err\n }\n const file = await handle.getFile()\n const bytes = new Uint8Array(await file.arrayBuffer())\n record('read', virtual, ResourceName.OPFS, bytes.byteLength, start)\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 { compareCodePoints, mountPrefixOf } from '@struktoai/mirage-core'\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { enoent, enotdir } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { isNotFound, isTypeMismatch, iterEntries, norm, resolveDirHandle } from './utils.ts'\n\nexport async function readdir(accessor: OPFSAccessor, path: PathSpec): Promise<string[]> {\n const root = accessor.rootHandle\n const virtual = path.pattern !== null ? path.directory : path.mountPath\n let dir: FileSystemDirectoryHandle\n try {\n dir = await resolveDirHandle(root, virtual, { create: false })\n } catch (err) {\n // OPFS already separates the two cases the way the kernel does: a missing\n // component is NotFoundError (ENOENT), a component that exists but is a\n // file is TypeMismatchError (ENOTDIR). Keep the split instead of\n // collapsing both into one errno.\n if (isNotFound(err)) throw enoent(path)\n if (isTypeMismatch(err)) throw enotdir(path)\n throw err\n }\n const names: string[] = []\n for await (const [name] of iterEntries(dir)) {\n names.push(name)\n }\n const base = norm(virtual)\n const dirPrefix = base === '/' ? '/' : `${base}/`\n const mountPrefix = mountPrefixOf(path.virtual, path.resourcePath)\n return names.map((n) => `${mountPrefix}${dirPrefix}${n}`).sort(compareCodePoints)\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 { enoent, type PathSpec } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport {\n destError,\n isNotFound,\n iterEntries,\n resolveDirHandle,\n resolveFileHandle,\n resolveParentDirHandle,\n toWritableChunk,\n} from './utils.ts'\n\nasync function copyDirRecursive(\n root: FileSystemDirectoryHandle,\n srcPath: string,\n dstPath: string,\n): Promise<void> {\n const srcDir = await resolveDirHandle(root, srcPath, { create: false })\n const dstDir = await resolveDirHandle(root, dstPath, { create: true })\n for await (const [name, handle] of iterEntries(srcDir)) {\n if (handle.kind === 'file') {\n const srcFile = await srcDir.getFileHandle(name, { create: false })\n const file = await srcFile.getFile()\n const data = new Uint8Array(await file.arrayBuffer())\n const dstFile = await dstDir.getFileHandle(name, { create: true })\n const writable = await dstFile.createWritable()\n await writable.write(toWritableChunk(data))\n await writable.close()\n } else {\n await copyDirRecursive(root, `${srcPath}/${name}`, `${dstPath}/${name}`)\n }\n }\n}\n\nexport async function rename(accessor: OPFSAccessor, src: PathSpec, dst: PathSpec): Promise<void> {\n const root = accessor.rootHandle\n const srcPath = src.mountPath\n const dstPath = dst.mountPath\n let srcParent: FileSystemDirectoryHandle\n let srcName: string\n try {\n ;[srcParent, srcName] = await resolveParentDirHandle(root, srcPath, { create: false })\n } catch (err) {\n if (isNotFound(err)) throw enoent(src)\n throw err\n }\n let isFile = false\n try {\n await srcParent.getFileHandle(srcName, { create: false })\n isFile = true\n } catch (err) {\n if (!isNotFound(err) && !(err instanceof DOMException && err.name === 'TypeMismatchError')) {\n throw err\n }\n }\n if (!isFile) {\n try {\n await srcParent.getDirectoryHandle(srcName, { create: false })\n } catch (err) {\n if (isNotFound(err)) throw enoent(src)\n throw err\n }\n }\n // rename(2) resolves the destination first and never creates parents;\n // OPFS creates per segment, so the chain has to be probed explicitly.\n try {\n await resolveParentDirHandle(root, dstPath, { create: false })\n } catch (err) {\n throw destError(err, dst)\n }\n if (isFile) {\n const srcFile = await resolveFileHandle(root, srcPath, { create: false })\n const file = await srcFile.getFile()\n const data = new Uint8Array(await file.arrayBuffer())\n let dstFile: FileSystemFileHandle\n try {\n dstFile = await resolveFileHandle(root, dstPath, { create: true })\n } catch (err) {\n throw destError(err, dst)\n }\n const writable = await dstFile.createWritable()\n await writable.write(toWritableChunk(data))\n await writable.close()\n await srcParent.removeEntry(srcName)\n return\n }\n await copyDirRecursive(root, srcPath, dstPath)\n await srcParent.removeEntry(srcName, { recursive: 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 { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { isNotFound, resolveParentDirHandle } from './utils.ts'\n\nexport async function rmR(accessor: OPFSAccessor, path: PathSpec): Promise<void> {\n const root = accessor.rootHandle\n const virtual = path.mountPath\n let parentDir: FileSystemDirectoryHandle\n let name: string\n try {\n ;[parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) return\n if (err instanceof Error && err.message.startsWith('no parent directory')) return\n throw err\n }\n try {\n await parentDir.removeEntry(name, { recursive: true })\n } catch (err) {\n if (isNotFound(err)) return\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 type { PathSpec } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { isNotFound, resolveParentDirHandle } from './utils.ts'\n\nexport async function rmdir(accessor: OPFSAccessor, path: PathSpec): Promise<void> {\n const root = accessor.rootHandle\n const virtual = path.mountPath\n let parentDir: FileSystemDirectoryHandle\n let name: string\n try {\n ;[parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) return\n if (err instanceof Error && err.message.startsWith('no parent directory')) return\n throw err\n }\n try {\n await parentDir.removeEntry(name, { recursive: false })\n } catch (err) {\n if (isNotFound(err)) return\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 { FileStat, FileType, guessType, type PathSpec } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport {\n destError,\n isNotFound,\n iterEntries,\n resolveDirHandle,\n resolveParentDirHandle,\n splitSegments,\n} from './utils.ts'\n\nexport async function stat(accessor: OPFSAccessor, p: PathSpec): Promise<FileStat> {\n const root = accessor.rootHandle\n const virtual = p.mountPath\n const segs = splitSegments(virtual)\n const last = segs.at(-1)\n if (last === undefined) {\n return new FileStat({\n name: '/',\n size: null,\n modified: null,\n type: FileType.DIRECTORY,\n })\n }\n const name = last\n let parentDir: FileSystemDirectoryHandle\n let entryName: string\n try {\n ;[parentDir, entryName] = await resolveParentDirHandle(root, virtual, { create: false })\n } catch (err) {\n // A plain file partway down the chain is ENOTDIR, not ENOENT: the\n // read-family commands report \"Not a directory\" for it, the way the\n // kernel does.\n throw destError(err, p)\n }\n try {\n const fileHandle = await parentDir.getFileHandle(entryName, { create: false })\n const file = await fileHandle.getFile()\n const modified = new Date(file.lastModified).toISOString()\n return new FileStat({\n name,\n size: file.size,\n modified,\n fingerprint: modified,\n type: guessType(name),\n })\n } catch (err) {\n if (!isNotFound(err) && !(err instanceof DOMException && err.name === 'TypeMismatchError')) {\n throw err\n }\n }\n let dirHandle: FileSystemDirectoryHandle\n try {\n dirHandle = await resolveDirHandle(root, virtual, { create: false })\n } catch (err) {\n // A plain file partway down the chain is ENOTDIR, not ENOENT: the\n // read-family commands report \"Not a directory\" for it, the way the\n // kernel does.\n throw destError(err, p)\n }\n // OPFS exposes no directory timestamp, so derive one from the newest file\n // child's lastModified (null when the directory holds no files).\n let latest = 0\n for await (const [, handle] of iterEntries(dirHandle)) {\n if (handle.kind !== 'file') continue\n const file = await (handle as FileSystemFileHandle).getFile()\n if (file.lastModified > latest) latest = file.lastModified\n }\n return new FileStat({\n name,\n size: null,\n modified: latest > 0 ? new Date(latest).toISOString() : null,\n type: FileType.DIRECTORY,\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, recordStream, ResourceName } from '@struktoai/mirage-core'\nimport { eisdir, enoent } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { isNotFound, resolveFileHandle } from './utils.ts'\n\nexport async function* stream(accessor: OPFSAccessor, path: PathSpec): AsyncIterable<Uint8Array> {\n const root = accessor.rootHandle\n const virtual = path.mountPath\n let handle: FileSystemFileHandle\n try {\n handle = await resolveFileHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) throw enoent(path)\n if (err instanceof DOMException && err.name === 'TypeMismatchError') throw eisdir(path)\n throw err\n }\n const file = await handle.getFile()\n const rec = recordStream('read', virtual, ResourceName.OPFS)\n const reader = file.stream().getReader()\n for (;;) {\n const { value, done } = await reader.read()\n if (done) break\n if (rec !== null) rec.bytes += value.byteLength\n yield value\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 { ResourceName, record, type PathSpec } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { destError, isNotFound, resolveFileHandle, toWritableChunk } from './utils.ts'\n\nexport async function truncate(\n accessor: OPFSAccessor,\n path: PathSpec,\n length: number,\n): Promise<void> {\n const start = performance.now()\n const root = accessor.rootHandle\n const virtual = path.mountPath\n let handle: FileSystemFileHandle\n let existing: Uint8Array\n try {\n handle = await resolveFileHandle(root, virtual, { create: false })\n const file = await handle.getFile()\n existing = new Uint8Array(await file.arrayBuffer())\n } catch (err) {\n if (isNotFound(err)) {\n try {\n handle = await resolveFileHandle(root, virtual, { create: true })\n } catch (cerr) {\n throw destError(cerr, path)\n }\n existing = new Uint8Array()\n } else {\n throw destError(err, path)\n }\n }\n const out = new Uint8Array(length)\n out.set(existing.subarray(0, Math.min(existing.byteLength, length)))\n const writable = await handle.createWritable()\n await writable.write(toWritableChunk(out))\n await writable.close()\n record('truncate', virtual, ResourceName.OPFS, 0, start)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { isNotFound, resolveParentDirHandle } from './utils.ts'\n\nexport async function unlink(accessor: OPFSAccessor, path: PathSpec): Promise<void> {\n const root = accessor.rootHandle\n const virtual = path.mountPath\n let parentDir: FileSystemDirectoryHandle\n let name: string\n try {\n ;[parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) return\n if (err instanceof Error && err.message.startsWith('no parent directory')) return\n throw err\n }\n try {\n await parentDir.removeEntry(name)\n } catch (err) {\n if (isNotFound(err)) return\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 type { CommandIO } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\nimport { appendBytes as opfsAppend } from '../../../core/opfs/append.ts'\nimport { SCOPE_ERROR } from '../../../core/opfs/constants.ts'\nimport { copy as opfsCopy } from '../../../core/opfs/copy.ts'\nimport { create as opfsCreate } from '../../../core/opfs/create.ts'\nimport { size as opfsDu, entries as opfsDuAll } from '../../../core/opfs/du/index.ts'\nimport { exists as opfsExists } from '../../../core/opfs/exists.ts'\nimport { find as opfsFind } from '../../../core/opfs/find.ts'\nimport { mkdir as opfsMkdir } from '../../../core/opfs/mkdir.ts'\nimport { read as opfsRead } from '../../../core/opfs/read.ts'\nimport { readdir as opfsReaddir } from '../../../core/opfs/readdir.ts'\nimport { rename as opfsRename } from '../../../core/opfs/rename.ts'\nimport { rmR as opfsRmR } from '../../../core/opfs/rm.ts'\nimport { rmdir as opfsRmdir } from '../../../core/opfs/rmdir.ts'\nimport { stat as opfsStat } from '../../../core/opfs/stat.ts'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport { truncate as opfsTruncate } from '../../../core/opfs/truncate.ts'\nimport { unlink as opfsUnlink } from '../../../core/opfs/unlink.ts'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\n\nexport const OPFS_IO: CommandIO<OPFSAccessor> = {\n readdir: opfsReaddir,\n readBytes: opfsRead,\n readStream: opfsStream,\n stat: opfsStat,\n isMounted: () => true,\n local: true,\n maxGlobMatches: SCOPE_ERROR,\n write: opfsWrite,\n exists: opfsExists,\n mkdir: opfsMkdir,\n unlink: opfsUnlink,\n rmdir: opfsRmdir,\n rmR: opfsRmR,\n rename: opfsRename,\n copy: opfsCopy,\n create: opfsCreate,\n truncate: opfsTruncate,\n append: opfsAppend,\n find: opfsFind,\n du: { size: opfsDu, entries: opfsDuAll },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { appendBytes as coreAppend } from '../../core/opfs/append.ts'\n\nexport const appendOp: RegisteredOp = {\n name: 'append',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec, args: readonly unknown[]) => {\n const data = args[0]\n if (!(data instanceof Uint8Array)) {\n throw new TypeError('append op requires a Uint8Array as the first arg')\n }\n return coreAppend(accessor, path, data)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { create as coreCreate } from '../../core/opfs/create.ts'\n\nexport const createOp: RegisteredOp = {\n name: 'create',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreCreate(accessor, 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 type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { mkdir as coreMkdir } from '../../core/opfs/mkdir.ts'\n\nexport const mkdirOp: RegisteredOp = {\n name: 'mkdir',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreMkdir(accessor, path, 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, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { read as coreRead } from '../../core/opfs/read.ts'\n\nexport const readOp: RegisteredOp = {\n name: 'read',\n resource: ResourceName.OPFS,\n filetype: null,\n write: false,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreRead(accessor, 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 type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { readdir as coreReaddir } from '../../core/opfs/readdir.ts'\n\nexport const readdirOp: RegisteredOp = {\n name: 'readdir',\n resource: ResourceName.OPFS,\n filetype: null,\n write: false,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreReaddir(accessor, 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 type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { rename as coreRename } from '../../core/opfs/rename.ts'\n\nexport const renameOp: RegisteredOp = {\n name: 'rename',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec, args: readonly unknown[]) => {\n const dst = args[0]\n if (dst === undefined || dst === null || typeof dst !== 'object' || !('virtual' in dst)) {\n throw new TypeError('rename op requires a PathSpec destination as the first arg')\n }\n return coreRename(accessor, path, dst as PathSpec)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { rmdir as coreRmdir } from '../../core/opfs/rmdir.ts'\n\nexport const rmdirOp: RegisteredOp = {\n name: 'rmdir',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreRmdir(accessor, 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 type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { stat as coreStat } from '../../core/opfs/stat.ts'\n\nexport const statOp: RegisteredOp = {\n name: 'stat',\n resource: ResourceName.OPFS,\n filetype: null,\n write: false,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreStat(accessor, 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 type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { truncate as coreTruncate } from '../../core/opfs/truncate.ts'\n\nexport const truncateOp: RegisteredOp = {\n name: 'truncate',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec, args: readonly unknown[]) => {\n const length = args[0]\n if (typeof length !== 'number') {\n throw new TypeError('truncate op requires a number length as the first arg')\n }\n return coreTruncate(accessor, path, length)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { unlink as coreUnlink } from '../../core/opfs/unlink.ts'\n\nexport const unlinkOp: RegisteredOp = {\n name: 'unlink',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreUnlink(accessor, 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 type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { writeBytes } from '../../core/opfs/write.ts'\n\nexport const writeOp: RegisteredOp = {\n name: 'write',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec, args: readonly unknown[]) => {\n const data = args[0]\n if (!(data instanceof Uint8Array)) {\n throw new TypeError('write op requires a Uint8Array as the first arg')\n }\n return writeBytes(accessor, path, data)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RegisteredOp } from '@struktoai/mirage-core'\nimport { appendOp } from './append.ts'\nimport { createOp } from './create.ts'\nimport { mkdirOp } from './mkdir.ts'\nimport { readOp } from './read.ts'\nimport { readdirOp } from './readdir.ts'\nimport { renameOp } from './rename.ts'\nimport { rmdirOp } from './rmdir.ts'\nimport { statOp } from './stat.ts'\nimport { truncateOp } from './truncate.ts'\nimport { unlinkOp } from './unlink.ts'\nimport { writeOp } from './write.ts'\n\nexport const OPFS_OPS: readonly RegisteredOp[] = [\n appendOp,\n createOp,\n mkdirOp,\n readOp,\n readdirOp,\n renameOp,\n rmdirOp,\n statOp,\n truncateOp,\n unlinkOp,\n writeOp,\n]\n\nexport {\n appendOp,\n createOp,\n mkdirOp,\n readOp,\n readdirOp,\n renameOp,\n rmdirOp,\n statOp,\n truncateOp,\n unlinkOp,\n writeOp,\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport const OPFS_PROMPT = `{prefix}\n Browser Origin Private File System. Persistent per-origin storage that survives page reloads.\n Standard commands: ls, cat, head, tail, grep, wc, find, tree, mkdir, touch, cp, mv, rm, tee.`\n"],"mappings":";AAcA;AAAA,EAOE,gBAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAAC;AAAA,OACK;;;ACXP,SAAS,gBAAgB;AAMlB,IAAM,eAAN,cAA2B,SAAS;AAAA,EACxB;AAAA,EAEjB,YAAY,UAA8B;AACxC,UAAM;AACN,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,IAAI,aAAwC;AAC1C,WAAO,KAAK,SAAS,cAAc;AAAA,EACrC;AACF;;;ACjBA,SAAS,gBAAAC,eAAc,2BAAmD;;;ACA1E,SAAwB,QAAQ,oBAAoB;;;ACApD,SAAS,QAAQ,eAA8B;AAE/C,SAAS,MAAM,QAAuB,mBAAgB;AAS/C,SAAS,cAAc,SAA2B;AACvD,QAAM,QAAkB,CAAC;AACzB,aAAW,OAAO,QAAQ,MAAM,GAAG,GAAG;AACpC,QAAI,QAAQ,MAAM,QAAQ,IAAK;AAC/B,QAAI,QAAQ,MAAM;AAChB,UAAI,MAAM,WAAW,GAAG;AACtB,cAAM,IAAI,MAAM,sBAAsB,OAAO,EAAE;AAAA,MACjD;AACA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gBAAgB,IAAI,CAAC;AAC1C,YAAM,SAAS,MAAM;AAAA,IACvB;AAAA,EACF;AACF;","names":["ResourceName","compareCodePoints","ResourceName","copy","enoent","enoent","record","ResourceName","record","ResourceName","entries","entries","compareCodePoints","enotdir","norm","enotdir","norm","record","ResourceName","enoent","enoent","record","ResourceName","compareCodePoints","enoent","enotdir","enoent","enotdir","compareCodePoints","enoent","enoent","ResourceName","eisdir","enoent","enoent","eisdir","ResourceName","ResourceName","record","record","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","compareCodePoints"]}
@@ -17,11 +17,15 @@ import {
17
17
  } from "@struktoai/mirage-core";
18
18
 
19
19
  // src/resource/linear/config.ts
20
- import { redactConfigWithSchema, secretStr, z } from "@struktoai/mirage-core";
20
+ import {
21
+ redactConfigWithSchema,
22
+ secretStr,
23
+ z
24
+ } from "@struktoai/mirage-core";
21
25
  var LinearConfigSchema = z.object({
22
26
  apiKey: secretStr(),
23
27
  workspace: z.string().optional(),
24
- teamIds: z.array(z.string()).optional(),
28
+ teamIds: z.array(z.string()).readonly().optional(),
25
29
  baseUrl: z.string().optional()
26
30
  });
27
31
  function redactLinearConfig(config) {
@@ -35,6 +39,10 @@ var resolveLinearGlob = (accessor, paths, index, filter) => makeResolveGlob(
35
39
  var LinearResource = class {
36
40
  kind = ResourceName.LINEAR;
37
41
  cachesReads = true;
42
+ // Every file is sized at its parent's readdir from the listing payload
43
+ // (comments.jsonl via one bounded comments call), so stat always reports
44
+ // the rendered byte length and fskit mounts serve exact reads.
45
+ sizesAlwaysKnown = true;
38
46
  indexTtl = 600;
39
47
  prompt = LINEAR_PROMPT;
40
48
  writePrompt = LINEAR_WRITE_PROMPT;
@@ -101,4 +109,4 @@ export {
101
109
  redactLinearConfig,
102
110
  LinearResource
103
111
  };
104
- //# sourceMappingURL=chunk-E77ESWWV.js.map
112
+ //# sourceMappingURL=chunk-UY22T4AC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resource/linear/linear.ts","../src/resource/linear/config.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 { mountKey, mountPrefixOf } from '@struktoai/mirage-core'\nimport {\n type FileStat,\n HttpLinearTransport,\n type IndexCacheStore,\n LINEAR_COMMANDS,\n LINEAR_PROMPT,\n LINEAR_OPS,\n LINEAR_WRITE_PROMPT,\n LinearAccessor,\n type LinearReaddirFilter,\n linearRead,\n linearReaddir,\n linearStat,\n makeResolveGlob,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n} from '@struktoai/mirage-core'\nimport { redactLinearConfig, type LinearConfig, type LinearConfigRedacted } from './config.ts'\n\nconst resolveLinearGlob = (\n accessor: LinearAccessor,\n paths: readonly PathSpec[],\n index: IndexCacheStore | undefined,\n filter: LinearReaddirFilter,\n): Promise<PathSpec[]> =>\n makeResolveGlob((a: LinearAccessor, p: PathSpec, i?: IndexCacheStore) =>\n linearReaddir(a, p, i, filter),\n )(accessor, paths, index)\n\nexport interface LinearResourceState {\n type: string\n config: LinearConfigRedacted\n}\n\nexport class LinearResource implements Resource {\n readonly kind: string = ResourceName.LINEAR\n readonly cachesReads: boolean = true\n // Every file is sized at its parent's readdir from the listing payload\n // (comments.jsonl via one bounded comments call), so stat always reports\n // the rendered byte length and fskit mounts serve exact reads.\n readonly sizesAlwaysKnown: 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 readonly index: IndexCacheStore\n\n constructor(config: LinearConfig) {\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 this.index = new RAMIndexCacheStore({ ttl: this.indexTtl })\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_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 glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n prefix !== ''\n ? paths.map((p) =>\n mountPrefixOf(p.virtual, p.resourcePath) !== ''\n ? p\n : new PathSpec({\n virtual: p.virtual,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n resourcePath: mountKey(p.virtual, 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","// ========= 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 redactConfigWithSchema,\n type ConfigOf,\n type RedactedConfig,\n secretStr,\n z,\n} from '@struktoai/mirage-core'\n\nconst LinearConfigSchema = z.object({\n apiKey: secretStr(),\n workspace: z.string().optional(),\n teamIds: z.array(z.string()).readonly().optional(),\n baseUrl: z.string().optional(),\n})\n\nexport type LinearConfig = ConfigOf<typeof LinearConfigSchema>\n\nexport type LinearConfigRedacted = RedactedConfig<LinearConfig, 'apiKey'>\n\nexport function redactLinearConfig(config: LinearConfig): LinearConfigRedacted {\n return redactConfigWithSchema(LinearConfigSchema, config) as unknown as LinearConfigRedacted\n}\n"],"mappings":";AAcA,SAAS,UAAU,qBAAqB;AACxC;AAAA,EAEE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIA;AAAA,OACK;;;ACrBP;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AAEP,IAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,QAAQ,UAAU;AAAA,EAClB,WAAW,EAAE,OAAO,EAAE,SAAS;AAAA,EAC/B,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,SAAS;AAAA,EACjD,SAAS,EAAE,OAAO,EAAE,SAAS;A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;AAAA,EAClE;AAAA,EAEA,KAAK,GAAgC;AACnC,WAAO,WAAW,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EAChD;AAAA,EAEA,KAAK,OAA4B,SAAS,IAAyB;AACjE,UAAM,YACJ,WAAW,KACP,MAAM;AAAA,MAAI,CAAC,MACT,cAAc,EAAE,SAAS,EAAE,YAAY,MAAM,KACzC,IACA,IAAI,SAAS;AAAA,QACX,SAAS,EAAE;AAAA,QACX,WAAW,EAAE;AAAA,QACb,GAAI,EAAE,YAAY,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,CAAC;AAAA,QACnD,UAAU,EAAE;AAAA,QACZ,cAAc,SAAS,EAAE,SAAS,MAAM;AAAA,MAC1C,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":[]}
@@ -0,0 +1,11 @@
1
+ // src/resource/gdocs/config.ts
2
+ import {
3
+ normalizeGoogleConfig,
4
+ redactGoogleConfig
5
+ } from "@struktoai/mirage-core";
6
+
7
+ export {
8
+ normalizeGoogleConfig,
9
+ redactGoogleConfig
10
+ };
11
+ //# sourceMappingURL=chunk-XJBC3OYX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resource/gdocs/config.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\nexport {\n normalizeGoogleConfig as normalizeGDocsConfig,\n redactGoogleConfig as redactGDocsConfig,\n type GoogleConfig as GDocsConfig,\n type GoogleConfigRedacted as GDocsConfigRedacted,\n} from '@struktoai/mirage-core'\n"],"mappings":";AAcA;AAAA,EAC2B;AAAA,EACH;AAAA,OAGjB;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  S3Resource
3
- } from "./chunk-DC6VA36O.js";
3
+ } from "./chunk-BGA2F226.js";
4
4
 
5
5
  // src/resource/minio/minio.ts
6
6
  import {
@@ -10,7 +10,11 @@ import {
10
10
  } from "@struktoai/mirage-core";
11
11
 
12
12
  // src/resource/minio/config.ts
13
- import { redactConfigWithSchema, secretSchema, z } from "@struktoai/mirage-core";
13
+ import {
14
+ redactConfigWithSchema,
15
+ secretSchema,
16
+ z
17
+ } from "@struktoai/mirage-core";
14
18
  var MinIOConfigSchema = z.object({
15
19
  bucket: z.string(),
16
20
  presignedUrlProvider: secretSchema(
@@ -78,4 +82,4 @@ export {
78
82
  MINIO_BROWSER_PROMPT,
79
83
  MinIOResource
80
84
  };
81
- //# sourceMappingURL=chunk-TCFD6YJ5.js.map
85
+ //# sourceMappingURL=chunk-Y6DYUK6J.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resource/minio/minio.ts","../src/resource/minio/config.ts","../src/resource/minio/prompt.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 remapCommandsResource,\n remapOpsResource,\n ResourceName,\n type RegisteredCommand,\n type RegisteredOp,\n} from '@struktoai/mirage-core'\nimport { S3Resource } from '../s3/s3.ts'\nimport {\n minioToS3Config,\n redactMinIOConfig,\n type MinIOConfig,\n type MinIOConfigRedacted,\n} from './config.ts'\nimport { MINIO_BROWSER_PROMPT } from './prompt.ts'\n\nexport interface MinIOResourceState {\n type: string\n config: MinIOConfigRedacted\n}\n\nexport class MinIOResource extends S3Resource {\n override readonly kind: string = ResourceName.MINIO\n override readonly prompt: string = MINIO_BROWSER_PROMPT\n readonly minioConfig: MinIOConfig\n private readonly minioOps: readonly RegisteredOp[]\n private readonly minioCommands: readonly RegisteredCommand[]\n\n constructor(config: MinIOConfig) {\n super(minioToS3Config(config))\n this.minioConfig = config\n this.minioOps = remapOpsResource(super.ops(), ResourceName.MINIO)\n this.minioCommands = remapCommandsResource(super.commands(), ResourceName.MINIO)\n }\n\n override ops(): readonly RegisteredOp[] {\n return this.minioOps\n }\n\n override commands(): readonly RegisteredCommand[] {\n return this.minioCommands\n }\n\n override getState(): Promise<MinIOResourceState> {\n return Promise.resolve({\n type: this.kind,\n config: redactMinIOConfig(this.minioConfig),\n })\n }\n\n override loadState(_state: MinIOResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n redactConfigWithSchema,\n type ConfigOf,\n type RedactedConfig,\n secretSchema,\n z,\n} from '@struktoai/mirage-core'\nimport type { S3BrowserPresignedUrlProvider, S3Config } from '../s3/config.ts'\n\nconst MinIOConfigSchema = z.object({\n bucket: z.string(),\n presignedUrlProvider: secretSchema(\n z.custom<S3BrowserPresignedUrlProvider>((value) => typeof value === 'function'),\n ),\n endpoint: z.string().optional(),\n region: z.string().optional(),\n defaultContentType: z.string().optional(),\n keyPrefix: z.string().optional(),\n})\n\nexport type MinIOConfig = ConfigOf<typeof MinIOConfigSchema>\n\nexport type MinIOConfigRedacted = RedactedConfig<MinIOConfig, 'presignedUrlProvider'>\n\nexport function minioToS3Config(config: MinIOConfig): S3Config {\n return {\n bucket: config.bucket,\n presignedUrlProvider: config.presignedUrlProvider,\n ...(config.region !== undefined ? { region: config.region } : {}),\n ...(config.endpoint !== undefined ? { endpoint: config.endpoint } : {}),\n ...(config.defaultContentType !== undefined\n ? { defaultContentType: config.defaultContentType }\n : {}),\n ...(config.keyPrefix !== undefined ? { keyPrefix: config.keyPrefix } : {}),\n }\n}\n\nexport function redactMinIOConfig(config: MinIOConfig): MinIOConfigRedacted {\n return redactConfigWithSchema(MinIOConfigSchema, config) as unknown as MinIOConfigRedacted\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 MINIO_BROWSER_PROMPT = `{prefix}\n Remote MinIO bucket (S3-compatible) accessed via presigned URLs (browser runtime).\n Supports the full filesystem command set: ls/tree/cat/grep/find/du/cp/mv/rm/etc.\n Listing operations require the presigner to sign LIST/COPY operations in\n addition to GET/PUT/HEAD/DELETE — see S3BrowserPresignedUrlProvider docs.`\n"],"mappings":";;;;;AAcA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;;;ACNP;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AAGP,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACjC,QAAQ,EAAE,OAAO;AAAA,EACjB,sBAAsB;AAAA,IACpB,EAAE,OAAsC,CAAC,UAAU,OAAO,UAAU,UAAU;AAAA,EAChF;AAAA,EACA,UAAU,EAAE,OAAO,EAAE,SAAS;AAAA,EAC9B,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,oBAAoB,EAAE,OAAO,EAAE,SAAS;AAAA,EACxC,WAAW,EAAE,OAAO,EAAE,SAAS;AACjC,CAAC;AAMM,SAAS,gBAAgB,QAA+B;AAC7D,SAAO;AAAA,IACL,QAAQ,OAAO;AAAA,IACf,sBAAsB,OAAO;AAAA,IAC7B,GAAI,OAAO,WAAW,SAAY,EAAE,QAAQ,OAAO,OAAO,IAAI,CAAC;AAAA,IAC/D,GAAI,OAAO,aAAa,SAAY,EAAE,UAAU,OAAO,SAAS,IAAI,CAAC;AAAA,IACrE,GAAI,OAAO,uBAAuB,SAC9B,EAAE,oBAAoB,OAAO,mBAAmB,IAChD,CAAC;AAAA,IACL,GAAI,OAAO,cAAc,SAAY,EAAE,WAAW,OAAO,UAAU,IAAI,CAAC;AAAA,EAC1E;AACF;AAEO,SAAS,kBAAkB,QAA0C;AAC1E,SAAO,uBAAuB,mBAAmB,MAAM;AACzD;;;ACvCO,IAAM,uBAAuB;AAAA;AAAA;AAAA;AAAA;;;AFqB7B,IAAM,gBAAN,cAA4B,WAAW;AAAA,EAC1B,OAAe,aAAa;AAAA,EAC5B,SAAiB;AAAA,EAC1B;AAAA,EACQ;AAAA,EACA;AAAA,EAEjB,YAAY,QAAqB;AAC/B,UAAM,gBAAgB,MAAM,CAAC;AAC7B,SAAK,cAAc;AACnB,SAAK,WAAW,iBAAiB,MAAM,IAAI,GAAG,aAAa,KAAK;AAChE,SAAK,gBAAgB,sBAAsB,MAAM,SAAS,GAAG,aAAa,KAAK;AAAA,EACjF;AAAA,EAES,MAA+B;AACtC,WAAO,KAAK;AAAA,EACd;AAAA,EAES,WAAyC;AAChD,WAAO,KAAK;AAAA,EACd;AAAA,EAES,WAAwC;AAC/C,WAAO,QAAQ,QAAQ;AAAA,MACrB,MAAM,KAAK;AAAA,MACX,QAAQ,kBAAkB,KAAK,WAAW;AAAA,IAC5C,CAAC;AAAA,EACH;AAAA,EAES,UAAU,QAA2C;AAC5D,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
@@ -23,6 +23,10 @@ var gmailResolveGlob = makeResolveGlob(gmailReaddir);
23
23
  var GmailResource = class {
24
24
  kind = ResourceName.GMAIL;
25
25
  cachesReads = true;
26
+ // Every listed file carries an exact size: .gmail.json is rendered at
27
+ // readdir from the full message the listing already fetched, and
28
+ // attachments carry the decoded byte count.
29
+ sizesAlwaysKnown = true;
26
30
  indexTtl = 86400;
27
31
  prompt = GMAIL_PROMPT;
28
32
  writePrompt = GMAIL_WRITE_PROMPT;
@@ -82,4 +86,4 @@ var GmailResource = class {
82
86
  export {
83
87
  GmailResource
84
88
  };
85
- //# sourceMappingURL=chunk-HPID7BWJ.js.map
89
+ //# sourceMappingURL=chunk-YOCTIHQZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resource/gmail/gmail.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 { mountKey, mountPrefixOf } from '@struktoai/mirage-core'\nimport {\n type FileStat,\n GMAIL_COMMANDS,\n GMAIL_PROMPT,\n GMAIL_WRITE_PROMPT,\n GMAIL_OPS,\n GmailAccessor,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n TokenManager,\n gmailRead,\n gmailReaddir,\n makeResolveGlob,\n gmailStat,\n} from '@struktoai/mirage-core'\nimport { redactGmailConfig, type GmailConfig, type GmailConfigRedacted } from './config.ts'\n\nconst gmailResolveGlob = makeResolveGlob(gmailReaddir)\n\nexport interface GmailResourceState {\n type: string\n config: GmailConfigRedacted\n}\n\nexport class GmailResource implements Resource {\n readonly kind: string = ResourceName.GMAIL\n readonly cachesReads: boolean = true\n // Every listed file carries an exact size: .gmail.json is rendered at\n // readdir from the full message the listing already fetched, and\n // attachments carry the decoded byte count.\n readonly sizesAlwaysKnown: boolean = true\n readonly indexTtl: number = 86_400\n readonly prompt: string = GMAIL_PROMPT\n readonly writePrompt: string = GMAIL_WRITE_PROMPT\n readonly config: GmailConfig\n readonly accessor: GmailAccessor\n readonly index: IndexCacheStore\n\n constructor(config: GmailConfig) {\n this.config = config\n const tm = new TokenManager(config)\n this.accessor = new GmailAccessor({ tokenManager: tm })\n this.index = new RAMIndexCacheStore({ ttl: 86_400 })\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 GMAIL_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return GMAIL_OPS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return gmailRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return gmailReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return gmailStat(this.accessor, p, this.index)\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n prefix !== ''\n ? paths.map((p) =>\n mountPrefixOf(p.virtual, p.resourcePath) !== ''\n ? p\n : new PathSpec({\n virtual: p.virtual,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n resourcePath: mountKey(p.virtual, prefix),\n }),\n )\n : paths\n return gmailResolveGlob(this.accessor, effective, this.index)\n }\n\n getState(): Promise<GmailResourceState> {\n return Promise.resolve({\n type: this.kind,\n config: redactGmailConfig(this.config),\n })\n }\n\n loadState(_state: GmailResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n"],"mappings":";;;;;AAcA,SAAS,UAAU,qBAAqB;AACxC;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,IAAM,mBAAmB,gBAAgB,YAAY;AAO9C,IAAM,gBAAN,MAAwC;AAAA,EACpC,OAAe,aAAa;AAAA,EAC5B,cAAuB;AAAA;AAAA;AAAA;AAAA,EAIvB,mBAA4B;AAAA,EAC5B,WAAmB;AAAA,EACnB,SAAiB;AAAA,EACjB,cAAsB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAqB;AAC/B,SAAK,SAAS;AACd,UAAM,KAAK,IAAI,aAAa,MAAM;AAClC,SAAK,WAAW,IAAI,cAAc,EAAE,cAAc,GAAG,CAAC;AACtD,SAAK,QAAQ,IAAI,mBAAmB,EAAE,KAAK,MAAO,CAAC;AAAA,EACrD;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,UAAU,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EAC/C;AAAA,EAEA,QAAQ,GAAgC;AACtC,WAAO,aAAa,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EAClD;AAAA,EAEA,KAAK,GAAgC;AACnC,WAAO,UAAU,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EAC/C;AAAA,EAEA,KAAK,OAA4B,SAAS,IAAyB;AACjE,UAAM,YACJ,WAAW,KACP,MAAM;AAAA,MAAI,CAAC,MACT,cAAc,EAAE,SAAS,EAAE,YAAY,MAAM,KACzC,IACA,IAAI,SAAS;AAAA,QACX,SAAS,EAAE;AAAA,QACX,WAAW,EAAE;AAAA,QACb,GAAI,EAAE,YAAY,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,CAAC;AAAA,QACnD,UAAU,EAAE;AAAA,QACZ,cAAc,SAAS,EAAE,SAAS,MAAM;AAAA,MAC1C,CAAC;AAAA,IACP,IACA;AACN,WAAO,iBAAiB,KAAK,UAAU,WAAW,KAAK,KAAK;AAAA,EAC9D;AAAA,EAEA,WAAwC;AACtC,WAAO,QAAQ,QAAQ;AAAA,MACrB,MAAM,KAAK;AAAA,MACX,QAAQ,mBAAkB,KAAK,MAAM;AAAA,IACvC,CAAC;AAAA,EACH;AAAA,EAEA,UAAU,QAA2C;AACnD,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
@@ -17,7 +17,11 @@ import {
17
17
  } from "@struktoai/mirage-core";
18
18
 
19
19
  // src/resource/notion/config.ts
20
- import { redactConfigWithSchema, secretSchema, z } from "@struktoai/mirage-core";
20
+ import {
21
+ redactConfigWithSchema,
22
+ secretSchema,
23
+ z
24
+ } from "@struktoai/mirage-core";
21
25
  var NotionConfigSchema = z.object({
22
26
  authProvider: secretSchema(
23
27
  z.custom((value) => value !== null && typeof value === "object")
@@ -94,4 +98,4 @@ export {
94
98
  redactNotionConfig,
95
99
  NotionResource
96
100
  };
97
- //# sourceMappingURL=chunk-PDZSZ5CB.js.map
101
+ //# sourceMappingURL=chunk-ZDJPUXYH.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/resource/notion/notion.ts","../src/resource/notion/config.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 { mountKey, mountPrefixOf } from '@struktoai/mirage-core'\nimport {\n type FileStat,\n type IndexCacheStore,\n MCPNotionTransport,\n type MCPNotionTransportOptions,\n NOTION_COMMANDS,\n NOTION_PROMPT,\n NOTION_OPS,\n NOTION_WRITE_PROMPT,\n NotionAccessor,\n notionRead,\n notionReaddir,\n notionStat,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n makeResolveGlob,\n} from '@struktoai/mirage-core'\nimport { redactNotionConfig, type NotionConfig, type NotionConfigRedacted } from './config.ts'\n\nconst resolveNotionGlob = makeResolveGlob<NotionAccessor>(notionReaddir)\n\nexport interface NotionResourceState {\n type: string\n config: NotionConfigRedacted\n}\n\nexport class NotionResource implements Resource {\n readonly kind: string = ResourceName.NOTION\n readonly cachesReads: boolean = true\n readonly indexTtl: number = 600\n readonly prompt: string = NOTION_PROMPT\n readonly writePrompt: string = NOTION_WRITE_PROMPT\n readonly config: NotionConfig\n readonly accessor: NotionAccessor\n readonly index: IndexCacheStore\n\n constructor(config: NotionConfig) {\n this.config = config\n const opts: MCPNotionTransportOptions = { authProvider: config.authProvider }\n if (config.serverUrl !== undefined) opts.serverUrl = config.serverUrl\n this.accessor = new NotionAccessor(new MCPNotionTransport(opts))\n this.index = new RAMIndexCacheStore({ ttl: this.indexTtl })\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 NOTION_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return NOTION_OPS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return notionRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return notionReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return notionStat(this.accessor, p, this.index)\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n prefix !== ''\n ? paths.map((p) =>\n mountPrefixOf(p.virtual, p.resourcePath) !== ''\n ? p\n : new PathSpec({\n virtual: p.virtual,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n resourcePath: mountKey(p.virtual, prefix),\n }),\n )\n : paths\n return resolveNotionGlob(this.accessor, effective, this.index)\n }\n\n getState(): Promise<NotionResourceState> {\n return Promise.resolve({\n type: this.kind,\n config: redactNotionConfig(this.config),\n })\n }\n\n loadState(_state: NotionResourceState): Promise<void> {\n return Promise.resolve()\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 { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js'\nimport { redactConfigWithSchema, secretSchema, z } from '@struktoai/mirage-core'\n\nexport interface NotionConfig {\n authProvider: OAuthClientProvider\n serverUrl?: string\n}\n\nexport interface NotionConfigRedacted {\n authProvider: '<REDACTED>'\n serverUrl?: string\n}\n\nconst NotionConfigSchema = z.object({\n authProvider: secretSchema(\n z.custom<OAuthClientProvider>((value) => value !== null && typeof value === 'object'),\n ),\n serverUrl: z.string().optional(),\n})\n\nexport function redactNotionConfig(config: NotionConfig): NotionConfigRedacted {\n return redactConfigWithSchema(NotionConfigSchema, config) as unknown as NotionConfigRedacted\n}\n"],"mappings":";AAcA,SAAS,UAAU,qBAAqB;AACxC;AAAA,EAGE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,OACK;;;ACpBP,SAAS,wBAAwB,cAAc,SAAS;AAYxD,IAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,cAAc;AAAA,IACZ,EAAE,OAA4B,CAAC,UAAU,UAAU,QAAQ,OAAO,UAAU,QAAQ;AAAA,EACtF;AAAA,EACA,WAAW,EAAE,OAAO,EAAE,SAAS;AACjC,CAAC;AAEM,SAAS,mBAAmB,QAA4C;AAC7E,SAAO,uBAAuB,oBAAoB,MAAM;AAC1D;;;ADEA,IAAM,oBAAoB,gBAAgC,aAAa;AAOhE,IAAM,iBAAN,MAAyC;AAAA,EACrC,OAAe,aAAa;AAAA,EAC5B,cAAuB;AAAA,EACvB,WAAmB;AAAA,EACnB,SAAiB;AAAA,EACjB,cAAsB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAsB;AAChC,SAAK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MAAM;AAAA,IACxC,CAAC;AAAA,EACH;AAAA,EAEA,UAAU,QAA4C;AACpD,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/resource/notion/notion.ts","../src/resource/notion/config.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 { mountKey, mountPrefixOf } from '@struktoai/mirage-core'\nimport {\n type FileStat,\n type IndexCacheStore,\n MCPNotionTransport,\n type MCPNotionTransportOptions,\n NOTION_COMMANDS,\n NOTION_PROMPT,\n NOTION_OPS,\n NOTION_WRITE_PROMPT,\n NotionAccessor,\n notionRead,\n notionReaddir,\n notionStat,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n makeResolveGlob,\n} from '@struktoai/mirage-core'\nimport { redactNotionConfig, type NotionConfig, type NotionConfigRedacted } from './config.ts'\n\nconst resolveNotionGlob = makeResolveGlob<NotionAccessor>(notionReaddir)\n\nexport interface NotionResourceState {\n type: string\n config: NotionConfigRedacted\n}\n\nexport class NotionResource implements Resource {\n readonly kind: string = ResourceName.NOTION\n readonly cachesReads: boolean = true\n readonly indexTtl: number = 600\n readonly prompt: string = NOTION_PROMPT\n readonly writePrompt: string = NOTION_WRITE_PROMPT\n readonly config: NotionConfig\n readonly accessor: NotionAccessor\n readonly index: IndexCacheStore\n\n constructor(config: NotionConfig) {\n this.config = config\n const opts: MCPNotionTransportOptions = { authProvider: config.authProvider }\n if (config.serverUrl !== undefined) opts.serverUrl = config.serverUrl\n this.accessor = new NotionAccessor(new MCPNotionTransport(opts))\n this.index = new RAMIndexCacheStore({ ttl: this.indexTtl })\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 NOTION_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return NOTION_OPS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return notionRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return notionReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return notionStat(this.accessor, p, this.index)\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n prefix !== ''\n ? paths.map((p) =>\n mountPrefixOf(p.virtual, p.resourcePath) !== ''\n ? p\n : new PathSpec({\n virtual: p.virtual,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n resourcePath: mountKey(p.virtual, prefix),\n }),\n )\n : paths\n return resolveNotionGlob(this.accessor, effective, this.index)\n }\n\n getState(): Promise<NotionResourceState> {\n return Promise.resolve({\n type: this.kind,\n config: redactNotionConfig(this.config),\n })\n }\n\n loadState(_state: NotionResourceState): Promise<void> {\n return Promise.resolve()\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 { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js'\nimport {\n redactConfigWithSchema,\n type ConfigOf,\n type RedactedConfig,\n secretSchema,\n z,\n} from '@struktoai/mirage-core'\n\nconst NotionConfigSchema = z.object({\n authProvider: secretSchema(\n z.custom<OAuthClientProvider>((value) => value !== null && typeof value === 'object'),\n ),\n serverUrl: z.string().optional(),\n})\n\nexport type NotionConfig = ConfigOf<typeof NotionConfigSchema>\n\nexport type NotionConfigRedacted = RedactedConfig<NotionConfig, 'authProvider'>\n\nexport function redactNotionConfig(config: NotionConfig): NotionConfigRedacted {\n return redactConfigWithSchema(NotionConfigSchema, config) as unknown as NotionConfigRedacted\n}\n"],"mappings":";AAcA,SAAS,UAAU,qBAAqB;AACxC;AAAA,EAGE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,OACK;;;ACpBP;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AAEP,IAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,cAAc;AAAA,IACZ,EAAE,OAA4B,CAAC,UAAU,UAAU,QAAQ,OAAO,UAAU,QAAQ;AAAA,EACtF;AAAA,EACA,WAAW,EAAE,OAAO,EAAE,SAAS;AACjC,CAAC;AAMM,SAAS,mBAAmB,QAA4C;AAC7E,SAAO,uBAAuB,oBAAoB,MAAM;AAC1D;;;ADEA,IAAM,oBAAoB,gBAAgC,aAAa;AAOhE,IAAM,iBAAN,MAAyC;AAAA,EACrC,OAAe,aAAa;AAAA,EAC5B,cAAuB;AAAA,EACvB,WAAmB;AAAA,EACnB,SAAiB;AAAA,EACjB,cAAsB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAsB;AAChC,SAAK,SAAS;AACd,UAAM,OAAkC,EAAE,cAAc,OAAO,aAAa;AAC5E,QAAI,OAAO,cAAc,OAAW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QAAQ;AAAA,EACzB;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactDropboxConfig
3
- } from "./chunk-MQMUOJZ2.js";
3
+ } from "./chunk-OSTDTTWI.js";
4
4
 
5
5
  // src/resource/dropbox/dropbox.ts
6
6
  import { mountKey, mountPrefixOf } from "@struktoai/mirage-core";
@@ -22,6 +22,9 @@ var dropboxResolveGlob = makeResolveGlob(dropboxReaddir);
22
22
  var DropboxResource = class {
23
23
  kind = ResourceName.DROPBOX;
24
24
  cachesReads = true;
25
+ // list_folder carries an exact byte `size` for every file (0 included).
26
+ // Paper docs 409 on raw download, a loud error, never a silent empty read.
27
+ sizesAlwaysKnown = true;
25
28
  indexTtl = 86400;
26
29
  prompt = DROPBOX_PROMPT;
27
30
  config;
@@ -29,13 +32,7 @@ var DropboxResource = class {
29
32
  index;
30
33
  constructor(config) {
31
34
  this.config = config;
32
- const tm = new DropboxTokenManager({
33
- clientId: config.clientId,
34
- ...config.clientSecret !== void 0 ? { clientSecret: config.clientSecret } : {},
35
- refreshToken: config.refreshToken,
36
- ...config.endpoint !== void 0 ? { endpoint: config.endpoint } : {},
37
- ...config.refreshFn !== void 0 ? { refreshFn: config.refreshFn } : {}
38
- });
35
+ const tm = new DropboxTokenManager(config);
39
36
  this.accessor = new DropboxAccessor({
40
37
  tokenManager: tm,
41
38
  ...config.rootPath !== void 0 ? { rootPath: config.rootPath } : {},
@@ -90,4 +87,4 @@ var DropboxResource = class {
90
87
  export {
91
88
  DropboxResource
92
89
  };
93
- //# sourceMappingURL=chunk-CQERQTAZ.js.map
90
+ //# sourceMappingURL=chunk-ZKCOSE3R.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resource/dropbox/dropbox.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 { mountKey, mountPrefixOf } from '@struktoai/mirage-core'\nimport {\n type FileStat,\n DROPBOX_COMMANDS,\n DROPBOX_PROMPT,\n DROPBOX_OPS,\n DropboxAccessor,\n DropboxTokenManager,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n dropboxRead,\n dropboxReaddir,\n makeResolveGlob,\n dropboxStat,\n} from '@struktoai/mirage-core'\nimport { redactDropboxConfig, type DropboxConfig, type DropboxConfigRedacted } from './config.ts'\n\nconst dropboxResolveGlob = makeResolveGlob(dropboxReaddir)\n\nexport interface DropboxResourceState {\n type: string\n config: DropboxConfigRedacted\n}\n\nexport class DropboxResource implements Resource {\n readonly kind: string = ResourceName.DROPBOX\n readonly cachesReads: boolean = true\n // list_folder carries an exact byte `size` for every file (0 included).\n // Paper docs 409 on raw download, a loud error, never a silent empty read.\n readonly sizesAlwaysKnown: boolean = true\n readonly indexTtl: number = 86_400\n readonly prompt: string = DROPBOX_PROMPT\n readonly config: DropboxConfig\n readonly accessor: DropboxAccessor\n readonly index: IndexCacheStore\n\n constructor(config: DropboxConfig) {\n this.config = config\n const tm = new DropboxTokenManager(config)\n this.accessor = new DropboxAccessor({\n tokenManager: tm,\n ...(config.rootPath !== undefined ? { rootPath: config.rootPath } : {}),\n ...(config.contentSearch !== undefined ? { contentSearch: config.contentSearch } : {}),\n })\n this.index = new RAMIndexCacheStore({ ttl: 86_400 })\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 DROPBOX_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return DROPBOX_OPS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return dropboxRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return dropboxReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return dropboxStat(this.accessor, p, this.index)\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n prefix !== ''\n ? paths.map((p) =>\n mountPrefixOf(p.virtual, p.resourcePath) !== ''\n ? p\n : new PathSpec({\n virtual: p.virtual,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n resourcePath: mountKey(p.virtual, prefix),\n }),\n )\n : paths\n return dropboxResolveGlob(this.accessor, effective, this.index)\n }\n\n getState(): Promise<DropboxResourceState> {\n return Promise.resolve({\n type: this.kind,\n config: redactDropboxConfig(this.config),\n })\n }\n\n loadState(_state: DropboxResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n"],"mappings":";;;;;AAcA,SAAS,UAAU,qBAAqB;AACxC;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,IAAM,qBAAqB,gBAAgB,cAAc;AAOlD,IAAM,kBAAN,MAA0C;AAAA,EACtC,OAAe,aAAa;AAAA,EAC5B,cAAuB;AAAA;AAAA;AAAA,EAGvB,mBAA4B;AAAA,EAC5B,WAAmB;AAAA,EACnB,SAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAuB;AACjC,SAAK,SAAS;AACd,UAAM,KAAK,IAAI,oBAAoB,MAAM;AACzC,SAAK,WAAW,IAAI,gBAAgB;AAAA,MAClC,cAAc;AAAA,MACd,GAAI,OAAO,aAAa,SAAY,EAAE,UAA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AAU,QAA6C;AACrD,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
@@ -0,0 +1,11 @@
1
+ // src/resource/gcal/config.ts
2
+ import {
3
+ normalizeGoogleConfig,
4
+ redactGoogleConfig
5
+ } from "@struktoai/mirage-core";
6
+
7
+ export {
8
+ normalizeGoogleConfig,
9
+ redactGoogleConfig
10
+ };
11
+ //# sourceMappingURL=chunk-ZTHVEXIV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resource/gcal/config.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\nexport {\n normalizeGoogleConfig as normalizeGCalConfig,\n redactGoogleConfig as redactGCalConfig,\n type GoogleConfig as GCalConfig,\n type GoogleConfigRedacted as GCalConfigRedacted,\n} from '@struktoai/mirage-core'\n"],"mappings":";AAcA;AAAA,EAC2B;AAAA,EACH;AAAA,OAGjB;","names":[]}
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  normalizeGitHubCIConfig,
3
3
  redactGitHubCIConfig
4
- } from "./chunk-DGP3N4WM.js";
4
+ } from "./chunk-2J35WXX5.js";
5
5
  export {
6
6
  normalizeGitHubCIConfig,
7
7
  redactGitHubCIConfig
8
8
  };
9
- //# sourceMappingURL=config-MHBKYS53.js.map
9
+ //# sourceMappingURL=config-2Y6LZKLV.js.map
@@ -0,0 +1,9 @@
1
+ import {
2
+ normalizeGoogleConfig,
3
+ redactGoogleConfig
4
+ } from "./chunk-ZTHVEXIV.js";
5
+ export {
6
+ normalizeGoogleConfig as normalizeGCalConfig,
7
+ redactGoogleConfig as redactGCalConfig
8
+ };
9
+ //# sourceMappingURL=config-4GSOMUMF.js.map
@@ -0,0 +1,9 @@
1
+ import {
2
+ normalizeGoogleConfig,
3
+ redactGoogleConfig
4
+ } from "./chunk-M2UF2JHJ.js";
5
+ export {
6
+ normalizeGoogleConfig as normalizeGSheetsConfig,
7
+ redactGoogleConfig as redactGSheetsConfig
8
+ };
9
+ //# sourceMappingURL=config-5YBUWFUP.js.map