@struktoai/mirage-node 0.0.1-alpha.1

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 (191) hide show
  1. package/README.md +230 -0
  2. package/dist/box-4P7DCJH7.js +8 -0
  3. package/dist/box-4P7DCJH7.js.map +1 -0
  4. package/dist/chunk-35PVZRWU.js +24 -0
  5. package/dist/chunk-35PVZRWU.js.map +1 -0
  6. package/dist/chunk-3PBSL7BS.js +93 -0
  7. package/dist/chunk-3PBSL7BS.js.map +1 -0
  8. package/dist/chunk-3Y625AUP.js +24 -0
  9. package/dist/chunk-3Y625AUP.js.map +1 -0
  10. package/dist/chunk-5E6BULAK.js +92 -0
  11. package/dist/chunk-5E6BULAK.js.map +1 -0
  12. package/dist/chunk-5ITBZN55.js +24 -0
  13. package/dist/chunk-5ITBZN55.js.map +1 -0
  14. package/dist/chunk-6M2NL363.js +94 -0
  15. package/dist/chunk-6M2NL363.js.map +1 -0
  16. package/dist/chunk-6M3QVVOH.js +32 -0
  17. package/dist/chunk-6M3QVVOH.js.map +1 -0
  18. package/dist/chunk-6VKNSO6U.js +56 -0
  19. package/dist/chunk-6VKNSO6U.js.map +1 -0
  20. package/dist/chunk-6Y6GWMFF.js +24 -0
  21. package/dist/chunk-6Y6GWMFF.js.map +1 -0
  22. package/dist/chunk-7QXJ4KWQ.js +132 -0
  23. package/dist/chunk-7QXJ4KWQ.js.map +1 -0
  24. package/dist/chunk-ALAMUIGJ.js +57 -0
  25. package/dist/chunk-ALAMUIGJ.js.map +1 -0
  26. package/dist/chunk-DCJQ2PIX.js +100 -0
  27. package/dist/chunk-DCJQ2PIX.js.map +1 -0
  28. package/dist/chunk-EKPH4MMD.js +27 -0
  29. package/dist/chunk-EKPH4MMD.js.map +1 -0
  30. package/dist/chunk-FZ2GJ4BJ.js +29 -0
  31. package/dist/chunk-FZ2GJ4BJ.js.map +1 -0
  32. package/dist/chunk-G7O6DAWU.js +178 -0
  33. package/dist/chunk-G7O6DAWU.js.map +1 -0
  34. package/dist/chunk-GCB4JUF7.js +94 -0
  35. package/dist/chunk-GCB4JUF7.js.map +1 -0
  36. package/dist/chunk-GKQNMLQU.js +7757 -0
  37. package/dist/chunk-GKQNMLQU.js.map +1 -0
  38. package/dist/chunk-GO67AOYK.js +24 -0
  39. package/dist/chunk-GO67AOYK.js.map +1 -0
  40. package/dist/chunk-GPF66TH2.js +24 -0
  41. package/dist/chunk-GPF66TH2.js.map +1 -0
  42. package/dist/chunk-H3JR7MN3.js +45 -0
  43. package/dist/chunk-H3JR7MN3.js.map +1 -0
  44. package/dist/chunk-H74QYTN7.js +50 -0
  45. package/dist/chunk-H74QYTN7.js.map +1 -0
  46. package/dist/chunk-HEQL3LPK.js +66 -0
  47. package/dist/chunk-HEQL3LPK.js.map +1 -0
  48. package/dist/chunk-HXWGG4K7.js +66 -0
  49. package/dist/chunk-HXWGG4K7.js.map +1 -0
  50. package/dist/chunk-I4RRGZGB.js +24 -0
  51. package/dist/chunk-I4RRGZGB.js.map +1 -0
  52. package/dist/chunk-ICSS5ETT.js +67 -0
  53. package/dist/chunk-ICSS5ETT.js.map +1 -0
  54. package/dist/chunk-KINMBZHC.js +18 -0
  55. package/dist/chunk-KINMBZHC.js.map +1 -0
  56. package/dist/chunk-LBBM3LKK.js +99 -0
  57. package/dist/chunk-LBBM3LKK.js.map +1 -0
  58. package/dist/chunk-LPMPTQYP.js +36 -0
  59. package/dist/chunk-LPMPTQYP.js.map +1 -0
  60. package/dist/chunk-M42JTWPR.js +2794 -0
  61. package/dist/chunk-M42JTWPR.js.map +1 -0
  62. package/dist/chunk-MVE5VVMQ.js +91 -0
  63. package/dist/chunk-MVE5VVMQ.js.map +1 -0
  64. package/dist/chunk-MY3NUJJD.js +67 -0
  65. package/dist/chunk-MY3NUJJD.js.map +1 -0
  66. package/dist/chunk-NOZZFJEB.js +93 -0
  67. package/dist/chunk-NOZZFJEB.js.map +1 -0
  68. package/dist/chunk-OYJXYJTE.js +2358 -0
  69. package/dist/chunk-OYJXYJTE.js.map +1 -0
  70. package/dist/chunk-PEZYBKZH.js +124 -0
  71. package/dist/chunk-PEZYBKZH.js.map +1 -0
  72. package/dist/chunk-QWWOBAYU.js +26 -0
  73. package/dist/chunk-QWWOBAYU.js.map +1 -0
  74. package/dist/chunk-RQYYYBQG.js +24 -0
  75. package/dist/chunk-RQYYYBQG.js.map +1 -0
  76. package/dist/chunk-T2WWAEKH.js +7591 -0
  77. package/dist/chunk-T2WWAEKH.js.map +1 -0
  78. package/dist/chunk-U6QSXTUS.js +7 -0
  79. package/dist/chunk-U6QSXTUS.js.map +1 -0
  80. package/dist/chunk-UWMOTOXA.js +93 -0
  81. package/dist/chunk-UWMOTOXA.js.map +1 -0
  82. package/dist/chunk-UZZD4MRJ.js +95 -0
  83. package/dist/chunk-UZZD4MRJ.js.map +1 -0
  84. package/dist/chunk-V5OLWE7F.js +88 -0
  85. package/dist/chunk-V5OLWE7F.js.map +1 -0
  86. package/dist/chunk-VCLMTMSO.js +23 -0
  87. package/dist/chunk-VCLMTMSO.js.map +1 -0
  88. package/dist/chunk-WSDQ2MRG.js +102 -0
  89. package/dist/chunk-WSDQ2MRG.js.map +1 -0
  90. package/dist/chunk-XDEEOTVK.js +93 -0
  91. package/dist/chunk-XDEEOTVK.js.map +1 -0
  92. package/dist/chunk-XQUQSNCA.js +117 -0
  93. package/dist/chunk-XQUQSNCA.js.map +1 -0
  94. package/dist/chunk-XVYZO2FG.js +14 -0
  95. package/dist/chunk-XVYZO2FG.js.map +1 -0
  96. package/dist/chunk-ZC4KNEOQ.js +50 -0
  97. package/dist/chunk-ZC4KNEOQ.js.map +1 -0
  98. package/dist/config-5ZPGISS6.js +13 -0
  99. package/dist/config-5ZPGISS6.js.map +1 -0
  100. package/dist/config-6HWSKHEU.js +9 -0
  101. package/dist/config-6HWSKHEU.js.map +1 -0
  102. package/dist/config-6TNFPYZF.js +9 -0
  103. package/dist/config-6TNFPYZF.js.map +1 -0
  104. package/dist/config-BHLXQ3OL.js +9 -0
  105. package/dist/config-BHLXQ3OL.js.map +1 -0
  106. package/dist/config-E7UOEWEP.js +9 -0
  107. package/dist/config-E7UOEWEP.js.map +1 -0
  108. package/dist/config-FNR6LJ5H.js +11 -0
  109. package/dist/config-FNR6LJ5H.js.map +1 -0
  110. package/dist/config-HIZHA5VD.js +13 -0
  111. package/dist/config-HIZHA5VD.js.map +1 -0
  112. package/dist/config-HNSDNQZH.js +9 -0
  113. package/dist/config-HNSDNQZH.js.map +1 -0
  114. package/dist/config-IXLFUSMQ.js +9 -0
  115. package/dist/config-IXLFUSMQ.js.map +1 -0
  116. package/dist/config-J3TM7NIS.js +9 -0
  117. package/dist/config-J3TM7NIS.js.map +1 -0
  118. package/dist/config-JXLZ4XEW.js +9 -0
  119. package/dist/config-JXLZ4XEW.js.map +1 -0
  120. package/dist/config-KQCEMLNZ.js +9 -0
  121. package/dist/config-KQCEMLNZ.js.map +1 -0
  122. package/dist/config-MOLWOSRG.js +9 -0
  123. package/dist/config-MOLWOSRG.js.map +1 -0
  124. package/dist/config-R3XJ5OW4.js +9 -0
  125. package/dist/config-R3XJ5OW4.js.map +1 -0
  126. package/dist/config-S47UDVRZ.js +13 -0
  127. package/dist/config-S47UDVRZ.js.map +1 -0
  128. package/dist/config-UKZ72IDO.js +13 -0
  129. package/dist/config-UKZ72IDO.js.map +1 -0
  130. package/dist/config-V7XI5UTG.js +9 -0
  131. package/dist/config-V7XI5UTG.js.map +1 -0
  132. package/dist/config-YLIX3ZBT.js +9 -0
  133. package/dist/config-YLIX3ZBT.js.map +1 -0
  134. package/dist/config-Z5JGDOKE.js +9 -0
  135. package/dist/config-Z5JGDOKE.js.map +1 -0
  136. package/dist/config-ZCZZAH5W.js +9 -0
  137. package/dist/config-ZCZZAH5W.js.map +1 -0
  138. package/dist/config-ZZGIWDUC.js +9 -0
  139. package/dist/config-ZZGIWDUC.js.map +1 -0
  140. package/dist/discord-2PWP2MGX.js +8 -0
  141. package/dist/discord-2PWP2MGX.js.map +1 -0
  142. package/dist/disk-C7TJNU2B.js +8 -0
  143. package/dist/disk-C7TJNU2B.js.map +1 -0
  144. package/dist/dropbox-L5DPYGKR.js +8 -0
  145. package/dist/dropbox-L5DPYGKR.js.map +1 -0
  146. package/dist/email-HASRFBKC.js +8 -0
  147. package/dist/email-HASRFBKC.js.map +1 -0
  148. package/dist/gcs-P5QMKTPR.js +10 -0
  149. package/dist/gcs-P5QMKTPR.js.map +1 -0
  150. package/dist/gdocs-IF2I35HZ.js +8 -0
  151. package/dist/gdocs-IF2I35HZ.js.map +1 -0
  152. package/dist/gdrive-TAETVCKP.js +8 -0
  153. package/dist/gdrive-TAETVCKP.js.map +1 -0
  154. package/dist/github-5E6GSCNZ.js +8 -0
  155. package/dist/github-5E6GSCNZ.js.map +1 -0
  156. package/dist/github_ci-2DSZI3Y7.js +8 -0
  157. package/dist/github_ci-2DSZI3Y7.js.map +1 -0
  158. package/dist/gmail-F5VYGKOT.js +8 -0
  159. package/dist/gmail-F5VYGKOT.js.map +1 -0
  160. package/dist/gsheets-BAO54CQ7.js +8 -0
  161. package/dist/gsheets-BAO54CQ7.js.map +1 -0
  162. package/dist/gslides-A62CEEMR.js +8 -0
  163. package/dist/gslides-A62CEEMR.js.map +1 -0
  164. package/dist/index.d.ts +1671 -0
  165. package/dist/index.js +3564 -0
  166. package/dist/index.js.map +1 -0
  167. package/dist/langfuse-YKBYRQLU.js +8 -0
  168. package/dist/langfuse-YKBYRQLU.js.map +1 -0
  169. package/dist/linear-WJDQ6JDE.js +8 -0
  170. package/dist/linear-WJDQ6JDE.js.map +1 -0
  171. package/dist/mongodb-MK4DVSIK.js +7 -0
  172. package/dist/mongodb-MK4DVSIK.js.map +1 -0
  173. package/dist/oci-KZ7XFZ2X.js +10 -0
  174. package/dist/oci-KZ7XFZ2X.js.map +1 -0
  175. package/dist/postgres-M2N2APFZ.js +7 -0
  176. package/dist/postgres-M2N2APFZ.js.map +1 -0
  177. package/dist/r2-X4DDNSAZ.js +10 -0
  178. package/dist/r2-X4DDNSAZ.js.map +1 -0
  179. package/dist/redis-NVCXUUIO.js +7 -0
  180. package/dist/redis-NVCXUUIO.js.map +1 -0
  181. package/dist/s3-HVAL7ZX3.js +8 -0
  182. package/dist/s3-HVAL7ZX3.js.map +1 -0
  183. package/dist/slack-GUQMDGLP.js +8 -0
  184. package/dist/slack-GUQMDGLP.js.map +1 -0
  185. package/dist/ssh-LY6WYVVD.js +9 -0
  186. package/dist/ssh-LY6WYVVD.js.map +1 -0
  187. package/dist/supabase-H3ZP4Y3W.js +10 -0
  188. package/dist/supabase-H3ZP4Y3W.js.map +1 -0
  189. package/dist/trello-WR6TEDYD.js +8 -0
  190. package/dist/trello-WR6TEDYD.js.map +1 -0
  191. package/package.json +118 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/workspace.ts","../src/native.ts","../src/workspace/fuse.ts","../src/fuse/mount.ts","../src/fuse/fs.ts","../src/fuse/platform/macos.ts","../src/fs_monkey.ts","../src/commands/builtin/redis/provision.ts","../src/cache/redis/file.ts","../src/cache/redis/index_cache.ts","../src/resource/sscholar/sscholar.ts","../src/resource/sscholar/author.ts","../src/resource/vercel/vercel.ts","../src/resource/posthog/posthog.ts","../src/resource/registry.ts","../src/commands/local_audio/disk/cat_mp3.ts","../src/commands/local_audio/utils.ts","../src/commands/local_audio/disk/cat_ogg.ts","../src/commands/local_audio/disk/cat_wav.ts","../src/commands/local_audio/disk/grep_mp3.ts","../src/commands/local_audio/disk/grep_ogg.ts","../src/commands/local_audio/disk/grep_wav.ts","../src/commands/local_audio/disk/head_mp3.ts","../src/commands/local_audio/disk/head_ogg.ts","../src/commands/local_audio/disk/head_wav.ts","../src/commands/local_audio/disk/stat_mp3.ts","../src/commands/local_audio/disk/stat_ogg.ts","../src/commands/local_audio/disk/stat_wav.ts","../src/commands/local_audio/disk/tail_mp3.ts","../src/commands/local_audio/disk/tail_ogg.ts","../src/commands/local_audio/disk/tail_wav.ts","../src/commands/local_audio/disk/index.ts","../src/commands/local_audio/ram/cat_mp3.ts","../src/commands/local_audio/ram/read.ts","../src/commands/local_audio/ram/cat_ogg.ts","../src/commands/local_audio/ram/cat_wav.ts","../src/commands/local_audio/ram/grep_mp3.ts","../src/commands/local_audio/ram/grep_ogg.ts","../src/commands/local_audio/ram/grep_wav.ts","../src/commands/local_audio/ram/head_mp3.ts","../src/commands/local_audio/ram/head_ogg.ts","../src/commands/local_audio/ram/head_wav.ts","../src/commands/local_audio/ram/stat_mp3.ts","../src/commands/local_audio/ram/stat_ogg.ts","../src/commands/local_audio/ram/stat_wav.ts","../src/commands/local_audio/ram/tail_mp3.ts","../src/commands/local_audio/ram/tail_ogg.ts","../src/commands/local_audio/ram/tail_wav.ts","../src/commands/local_audio/ram/index.ts","../src/commands/local_audio/index.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 * from '@struktoai/mirage-core'\nexport { Workspace } from './workspace.ts'\nexport {\n DiskResource,\n type DiskResourceOptions,\n type DiskResourceState,\n} from './resource/disk/disk.ts'\nexport { DISK_PROMPT } from './resource/disk/prompt.ts'\nexport { DISK_OPS } from './ops/disk/index.ts'\nexport { patchNodeFs } from './fs_monkey.ts'\nexport {\n RedisResource,\n type RedisResourceOptions,\n type RedisResourceState,\n} from './resource/redis/redis.ts'\nexport { REDIS_PROMPT } from './resource/redis/prompt.ts'\nexport { RedisStore, type RedisStoreOptions } from './resource/redis/store.ts'\nexport { RedisAccessor } from './accessor/redis.ts'\nexport { REDIS_OPS } from './ops/redis/index.ts'\nexport {\n fileReadProvision,\n headTailProvision,\n metadataProvision,\n type RedisResourceLike,\n} from './commands/builtin/redis/provision.ts'\nexport { RedisFileCacheStore, type RedisFileCacheOptions } from './cache/redis/file.ts'\nexport { RedisIndexCacheStore, type RedisIndexCacheOptions } from './cache/redis/index_cache.ts'\nexport { FuseManager } from './workspace/fuse.ts'\nexport { MirageFS, type MirageFSOptions, type FuseAttr } from './fuse/fs.ts'\nexport {\n nativeExec,\n nativeExecStream,\n type NativeExecOptions,\n type NativeExecResult,\n type NativeProcess,\n} from './native.ts'\nexport {\n mount as fuseMount,\n mountBackground as fuseMountBackground,\n type FuseHandle,\n type MountOptions as FuseMountOptions,\n} from './fuse/mount.ts'\nexport { isMacosMetadata } from './fuse/platform/macos.ts'\nexport { S3Resource, type S3ResourceState } from './resource/s3/s3.ts'\nexport {\n redactConfig as redactS3Config,\n type S3Config,\n type S3ConfigRedacted,\n} from './resource/s3/config.ts'\nexport { GCSResource, type GCSResourceState } from './resource/gcs/gcs.ts'\nexport {\n GCS_ENDPOINT,\n redactGcsConfig,\n type GCSConfig,\n type GCSConfigRedacted,\n} from './resource/gcs/config.ts'\nexport { GCS_PROMPT } from './resource/gcs/prompt.ts'\nexport { OCIResource, type OCIResourceState } from './resource/oci/oci.ts'\nexport { redactOciConfig, type OCIConfig, type OCIConfigRedacted } from './resource/oci/config.ts'\nexport { OCI_PROMPT } from './resource/oci/prompt.ts'\nexport { R2Resource, type R2ResourceState } from './resource/r2/r2.ts'\nexport { redactR2Config, type R2Config, type R2ConfigRedacted } from './resource/r2/config.ts'\nexport { R2_PROMPT } from './resource/r2/prompt.ts'\nexport { SupabaseResource, type SupabaseResourceState } from './resource/supabase/supabase.ts'\nexport {\n redactSupabaseConfig,\n resolvedSupabaseEndpoint,\n type SupabaseConfig,\n type SupabaseConfigRedacted,\n} from './resource/supabase/config.ts'\nexport { SUPABASE_PROMPT } from './resource/supabase/prompt.ts'\nexport { PostgresResource, type PostgresResourceOptions } from './resource/postgres/postgres.ts'\nexport { PostgresStore } from './resource/postgres/store.ts'\nexport { MongoDBResource, type MongoDBResourceOptions } from './resource/mongodb/mongodb.ts'\nexport { MongoDBStore } from './resource/mongodb/store.ts'\nexport {\n SSCholarPaperResource,\n type SSCholarPaperResourceOptions,\n} from './resource/sscholar/sscholar.ts'\nexport {\n SSCholarAuthorResource,\n type SSCholarAuthorResourceOptions,\n} from './resource/sscholar/author.ts'\nexport { VercelResource, type VercelResourceOptions } from './resource/vercel/vercel.ts'\nexport { PostHogResource, type PostHogResourceOptions } from './resource/posthog/posthog.ts'\nexport { SlackResource, type SlackResourceState } from './resource/slack/slack.ts'\nexport {\n normalizeSlackConfig,\n redactSlackConfig,\n type SlackConfig,\n type SlackConfigRedacted,\n} from './resource/slack/config.ts'\nexport { SSHResource, type SSHResourceState } from './resource/ssh/ssh.ts'\nexport {\n normalizeSshConfig,\n redactSshConfig,\n type SSHConfig,\n type SSHConfigRedacted,\n} from './resource/ssh/config.ts'\nexport { SSHAccessor } from './accessor/ssh.ts'\nexport { SSH_PROMPT } from './resource/ssh/prompt.ts'\nexport { SSH_COMMANDS } from './commands/builtin/ssh/index.ts'\nexport { SSH_OPS } from './ops/ssh/index.ts'\nexport { DiscordResource, type DiscordResourceState } from './resource/discord/discord.ts'\nexport {\n normalizeDiscordConfig,\n redactDiscordConfig,\n type DiscordConfig,\n type DiscordConfigRedacted,\n} from './resource/discord/config.ts'\nexport { TrelloResource, type TrelloResourceState } from './resource/trello/trello.ts'\nexport {\n normalizeTrelloConfig,\n redactTrelloConfig,\n type TrelloConfig,\n type TrelloConfigRedacted,\n} from './resource/trello/config.ts'\nexport { LinearResource, type LinearResourceState } from './resource/linear/linear.ts'\nexport {\n normalizeLinearConfig,\n redactLinearConfig,\n type LinearConfig,\n type LinearConfigRedacted,\n} from './resource/linear/config.ts'\nexport { LangfuseResource, type LangfuseResourceState } from './resource/langfuse/langfuse.ts'\nexport {\n normalizeLangfuseConfig,\n redactLangfuseConfig,\n type LangfuseConfig,\n type LangfuseConfigRedacted,\n} from './resource/langfuse/config.ts'\nexport { GitHubResource, type GitHubResourceState } from './resource/github/github.ts'\nexport {\n normalizeGitHubConfig,\n redactGitHubConfig,\n type GitHubConfig,\n type GitHubConfigRedacted,\n} from './resource/github/config.ts'\nexport { GitHubCIResource, type GitHubCIResourceState } from './resource/github_ci/github_ci.ts'\nexport {\n normalizeGitHubCIConfig,\n redactGitHubCIConfig,\n type GitHubCIConfig,\n type GitHubCIConfigRedacted,\n} from './resource/github_ci/config.ts'\nexport { GDocsResource, type GDocsResourceState } from './resource/gdocs/gdocs.ts'\nexport {\n normalizeGDocsConfig,\n redactGDocsConfig,\n type GDocsConfig,\n type GDocsConfigRedacted,\n} from './resource/gdocs/config.ts'\nexport { GSheetsResource, type GSheetsResourceState } from './resource/gsheets/gsheets.ts'\nexport {\n normalizeGSheetsConfig,\n redactGSheetsConfig,\n type GSheetsConfig,\n type GSheetsConfigRedacted,\n} from './resource/gsheets/config.ts'\nexport { GSlidesResource, type GSlidesResourceState } from './resource/gslides/gslides.ts'\nexport {\n normalizeGSlidesConfig,\n redactGSlidesConfig,\n type GSlidesConfig,\n type GSlidesConfigRedacted,\n} from './resource/gslides/config.ts'\nexport { GDriveResource, type GDriveResourceState } from './resource/gdrive/gdrive.ts'\nexport {\n normalizeGDriveConfig,\n redactGDriveConfig,\n type GDriveConfig,\n type GDriveConfigRedacted,\n} from './resource/gdrive/config.ts'\nexport { DropboxResource, type DropboxResourceState } from './resource/dropbox/dropbox.ts'\nexport {\n normalizeDropboxConfig,\n redactDropboxConfig,\n type DropboxConfig,\n type DropboxConfigRedacted,\n} from './resource/dropbox/config.ts'\nexport { BoxResource, type BoxResourceState } from './resource/box/box.ts'\nexport {\n normalizeBoxConfig,\n redactBoxConfig,\n type BoxConfig,\n type BoxConfigRedacted,\n} from './resource/box/config.ts'\nexport { GmailResource, type GmailResourceState } from './resource/gmail/gmail.ts'\nexport {\n normalizeGmailConfig,\n redactGmailConfig,\n type GmailConfig,\n type GmailConfigRedacted,\n} from './resource/gmail/config.ts'\nexport { EmailResource, type EmailResourceState } from './resource/email/email.ts'\nexport {\n buildEmailConfig,\n normalizeEmailConfig,\n redactEmailConfig,\n type EmailConfig,\n type EmailConfigInput,\n type EmailConfigRedacted,\n EMAIL_PROMPT,\n EMAIL_WRITE_PROMPT,\n} from './resource/email/index.ts'\nexport { EmailAccessor } from './accessor/email.ts'\nexport { EMAIL_COMMANDS } from './commands/builtin/email/index.ts'\nexport { EMAIL_OPS } from './ops/email/index.ts'\nexport {\n buildResource,\n knownResources,\n register as registerResourceFactory,\n type ResourceFactory,\n} from './resource/registry.ts'\nexport { DISK_COMMANDS } from './commands/builtin/disk/index.ts'\nexport { REDIS_COMMANDS } from './commands/builtin/redis/index.ts'\nexport {\n LOCAL_AUDIO_COMMANDS,\n DISK_LOCAL_AUDIO_COMMANDS,\n RAM_LOCAL_AUDIO_COMMANDS,\n configure as configureLocalAudio,\n getConfig as getLocalAudioConfig,\n transcribe as localAudioTranscribe,\n metadata as localAudioMetadata,\n estimateByteRange as localAudioEstimateByteRange,\n formatDuration as localAudioFormatDuration,\n formatMetadata as localAudioFormatMetadata,\n type LocalAudioMetadata,\n type LocalAudioConfig,\n type LocalAudioTranscriber,\n} from './commands/local_audio/index.ts'\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport {\n createShellParser,\n ExecuteResult,\n type ExecuteOptions,\n type ProvisionResult,\n type Resource,\n type ShellParser,\n Workspace as CoreWorkspace,\n type WorkspaceOptions,\n} from '@struktoai/mirage-core'\nimport { nativeExec, type NativeExecOptions } from './native.ts'\nimport { FuseManager } from './workspace/fuse.ts'\n\nconst requireCjs = createRequire(import.meta.url)\n\nlet cachedParser: Promise<ShellParser> | null = null\n\nfunction loadShellParser(): Promise<ShellParser> {\n if (cachedParser !== null) return cachedParser\n const enginePath = requireCjs.resolve('web-tree-sitter/web-tree-sitter.wasm')\n const grammarPath = requireCjs.resolve('tree-sitter-bash/tree-sitter-bash.wasm')\n cachedParser = createShellParser({\n engineWasm: readFileSync(enginePath),\n grammarWasm: readFileSync(grammarPath),\n })\n return cachedParser\n}\n\nexport interface NodeWorkspaceOptions extends WorkspaceOptions {\n fuse?: boolean\n native?: boolean\n}\n\nexport class Workspace extends CoreWorkspace {\n private readonly defaultNative: boolean\n private readonly autoFuseManager: FuseManager | null\n private fuseSetupPromise: Promise<void> | null = null\n\n constructor(resources: Record<string, Resource>, options: NodeWorkspaceOptions = {}) {\n super(resources, {\n ...options,\n shellParserFactory: options.shellParserFactory ?? loadShellParser,\n })\n this.defaultNative = options.native ?? false\n this.autoFuseManager = options.fuse === true ? new FuseManager() : null\n if (this.autoFuseManager !== null) {\n // Kick off mount eagerly; await inside execute() / close() so callers\n // don't need to await the constructor. Python mirrors this: fuse=True\n // runs setup() during __init__ and __enter__ just returns self.\n const fm = this.autoFuseManager\n this.fuseSetupPromise = fm.setup(this).then(() => undefined)\n }\n }\n\n private async ensureFuseReady(): Promise<void> {\n if (this.fuseSetupPromise !== null) {\n await this.fuseSetupPromise\n this.fuseSetupPromise = null\n }\n }\n\n override execute(\n command: string,\n options?: ExecuteOptions & { provision?: false | undefined },\n ): Promise<ExecuteResult>\n override execute(\n command: string,\n options: ExecuteOptions & { provision: true },\n ): Promise<ProvisionResult>\n override execute(\n command: string,\n options: ExecuteOptions,\n ): Promise<ExecuteResult | ProvisionResult>\n override async execute(\n command: string,\n options: ExecuteOptions = {},\n ): Promise<ExecuteResult | ProvisionResult> {\n await this.ensureFuseReady()\n const useNative = options.native ?? this.defaultNative\n if (useNative) {\n const mp = this.fuseMountpoint\n if (mp === null) {\n console.warn(\n 'native=true requires FUSE. Install macFUSE (macOS) or libfuse (Linux) ' +\n 'and set ws.setFuseMountpoint(). Falling back to virtual mode.',\n )\n } else if (this.ownsFuseMount) {\n // TODO(fuse-native-deadlock): Node is single-threaded — @zkochan/fuse-native's\n // napi callbacks share the same event loop as child_process.spawn. Running\n // nativeExec against a mount we own in this process deadlocks. Python avoids\n // this via a daemon threading.Thread for FUSE. Fix options: (a) run FUSE in\n // a worker_thread, (b) spawn a helper process to host the mount. Until then,\n // raise with a pointer to the workarounds instead of hanging the process.\n throw new Error(\n 'native=true with a same-process FUSE mount would deadlock ' +\n '(Node single event loop). Workarounds:\\n' +\n ' 1. Mount FUSE in a helper process; call nativeExec from this process.\\n' +\n ' 2. Point nativeExec at a mountpoint created by another tool ' +\n '(then call ws.setFuseMountpoint(path) without using FuseManager).\\n' +\n ' 3. Use execute() without native=true (virtual executor is in-process safe).\\n' +\n 'See https://mirage.dev/typescript/limitations for details.',\n )\n } else {\n const opts: NativeExecOptions = { cwd: mp }\n if (options.signal !== undefined) opts.signal = options.signal\n const { stdout, stderr, exitCode } = await nativeExec(command, opts)\n return new ExecuteResult(stdout, stderr, exitCode)\n }\n }\n return super.execute(command, options)\n }\n\n override async close(): Promise<void> {\n await this.ensureFuseReady().catch(() => undefined)\n if (this.autoFuseManager !== null) {\n await this.autoFuseManager.close(this)\n }\n await super.close()\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 { spawn, type ChildProcess, type SpawnOptionsWithoutStdio } from 'node:child_process'\nimport type { Readable } from 'node:stream'\nimport { ExecuteResult } from '@struktoai/mirage-core'\n\nexport interface NativeExecOptions {\n cwd: string\n env?: Record<string, string>\n timeoutMs?: number | null\n signal?: AbortSignal\n}\n\nexport type NativeExecResult = ExecuteResult\n\nfunction concatChunks(chunks: readonly Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nexport function nativeExec(command: string, options: NativeExecOptions): Promise<NativeExecResult> {\n return new Promise((resolve, reject) => {\n const env = options.env ?? (process.env as Record<string, string>)\n const spawnOpts: SpawnOptionsWithoutStdio = {\n cwd: options.cwd,\n env,\n }\n if (options.signal !== undefined) spawnOpts.signal = options.signal\n const proc = spawn('sh', ['-c', command], spawnOpts)\n const stdoutChunks: Uint8Array[] = []\n const stderrChunks: Uint8Array[] = []\n let killed = false\n const timeoutMs = options.timeoutMs ?? null\n const timer =\n timeoutMs !== null\n ? setTimeout(() => {\n killed = true\n proc.kill('SIGKILL')\n // When sh spawns a child (e.g. `echo x && sleep 5`), SIGKILL'ing sh\n // leaves the grandchild holding the stdio fds — Node's 'close' event\n // never fires until the grandchild dies. Destroying the pipes\n // unblocks the promise so we return promptly on timeout.\n proc.stdout.destroy()\n proc.stderr.destroy()\n }, timeoutMs)\n : null\n\n proc.stdout.on('data', (chunk: Buffer) => {\n stdoutChunks.push(new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength))\n })\n proc.stderr.on('data', (chunk: Buffer) => {\n stderrChunks.push(new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength))\n })\n proc.on('error', (err: Error) => {\n if (timer !== null) clearTimeout(timer)\n if (err.name === 'AbortError' || options.signal?.aborted === true) {\n reject(new DOMException('execute aborted', 'AbortError'))\n return\n }\n reject(err)\n })\n proc.on('close', (code) => {\n if (timer !== null) clearTimeout(timer)\n // Abort wins over timeout: if both fired, surface the caller's cancel.\n if (options.signal?.aborted === true) {\n reject(new DOMException('execute aborted', 'AbortError'))\n return\n }\n if (killed) {\n // Align with Python mirage.workspace.native.native_exec: on timeout\n // the caller doesn't get the partial stdout that was collected before\n // the SIGKILL — just an empty buffer and the \"timeout\\n\" stderr marker.\n resolve(new ExecuteResult(new Uint8Array(), new TextEncoder().encode('timeout\\n'), 124))\n return\n }\n resolve(new ExecuteResult(concatChunks(stdoutChunks), concatChunks(stderrChunks), code ?? 0))\n })\n })\n}\n\nexport interface NativeProcess {\n raw: ChildProcess\n stdoutStream(): Readable\n stderrStream(): Readable | null\n wait(): Promise<number>\n}\n\nexport function nativeExecStream(command: string, options: NativeExecOptions): NativeProcess {\n const env = options.env ?? (process.env as Record<string, string>)\n // Note: signal intentionally NOT threaded to nativeExecStream's spawn — would\n // require an 'error' handler and abort-aware wait() to avoid (a) unhandled\n // process crash and (b) silent success on abort. Wire when a caller needs it.\n const spawnOpts: SpawnOptionsWithoutStdio = {\n cwd: options.cwd,\n env,\n }\n const proc = spawn('sh', ['-c', command], spawnOpts)\n return {\n raw: proc,\n stdoutStream(): Readable {\n return proc.stdout\n },\n stderrStream(): Readable | null {\n return proc.stderr\n },\n wait(): Promise<number> {\n return new Promise((resolve) => {\n proc.on('close', (code) => {\n resolve(code ?? 0)\n })\n })\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 { rmSync } from 'node:fs'\nimport type { Workspace } from '@struktoai/mirage-core'\nimport { forceUnmount, mount, type FuseHandle, type MountOptions } from '../fuse/mount.ts'\n\nconst SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP'] as const\ntype Signal = (typeof SIGNALS)[number]\n\n/**\n * Tracks auto-mounted FUSE handles and installs a single process-wide cleanup\n * path on SIGINT / SIGTERM / SIGHUP / `process.exit` so the kernel never ends\n * up with a stale mountpoint after the node process dies. Mirrors Python's\n * KeyboardInterrupt → `diskutil unmount force` / `fusermount -u` in mount.py.\n */\nclass FuseCleanupRegistry {\n private readonly mounts = new Set<{ mountpoint: string; handle: FuseHandle }>()\n private installed = false\n private exiting = false\n\n register(entry: { mountpoint: string; handle: FuseHandle }): void {\n this.mounts.add(entry)\n this.install()\n }\n\n unregister(entry: { mountpoint: string; handle: FuseHandle }): void {\n this.mounts.delete(entry)\n }\n\n private install(): void {\n if (this.installed) return\n this.installed = true\n for (const sig of SIGNALS) {\n process.on(sig, this.onSignal)\n }\n process.on('beforeExit', this.onExit)\n process.on('exit', this.onExit)\n }\n\n private readonly onSignal = (sig: Signal): void => {\n if (this.exiting) return\n this.exiting = true\n this.drainSync()\n // Re-raise the signal so the default termination action runs after we've\n // unmounted. Node suppresses the default when a listener is attached.\n process.kill(process.pid, sig)\n }\n\n private readonly onExit = (): void => {\n if (this.exiting) return\n this.exiting = true\n this.drainSync()\n }\n\n private drainSync(): void {\n for (const entry of this.mounts) {\n forceUnmount(entry.mountpoint)\n try {\n rmSync(entry.mountpoint, { recursive: true, force: true })\n } catch {\n // best-effort\n }\n }\n this.mounts.clear()\n }\n}\n\nconst CLEANUP = new FuseCleanupRegistry()\n\nexport class FuseManager {\n private handle: FuseHandle | null = null\n private externalMountpoint: string | null = null\n private auto = false\n private cleanupEntry: { mountpoint: string; handle: FuseHandle } | null = null\n\n get mountpoint(): string | null {\n if (this.handle !== null) return this.handle.mountpoint\n return this.externalMountpoint\n }\n\n set mountpoint(path: string | null) {\n this.externalMountpoint = path\n }\n\n async setup(ws: Workspace, options: MountOptions = {}): Promise<string> {\n if (this.handle !== null) return this.handle.mountpoint\n this.handle = await mount(ws, options)\n this.auto = true\n this.externalMountpoint = null\n this.cleanupEntry = { mountpoint: this.handle.mountpoint, handle: this.handle }\n CLEANUP.register(this.cleanupEntry)\n ws.setFuseMountpoint(this.handle.mountpoint, { owned: true })\n return this.handle.mountpoint\n }\n\n async unmount(ws?: Workspace): Promise<void> {\n if (this.handle === null) {\n if (ws !== undefined) ws.setFuseMountpoint(null)\n this.externalMountpoint = null\n return\n }\n const mp = this.handle.mountpoint\n try {\n await this.handle.unmount()\n } finally {\n if (this.cleanupEntry !== null) {\n CLEANUP.unregister(this.cleanupEntry)\n this.cleanupEntry = null\n }\n this.handle = null\n this.auto = false\n ws?.setFuseMountpoint(null)\n try {\n rmSync(mp, { recursive: true, force: true })\n } catch {\n // mountpoint may still be busy; caller can retry\n }\n }\n }\n\n async close(ws?: Workspace): Promise<void> {\n if (this.auto) await this.unmount(ws)\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 { execSync } from 'node:child_process'\nimport { mkdtempSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { join } from 'node:path'\nimport type { Workspace } from '@struktoai/mirage-core'\nimport { loadOptionalPeer } from '../optional_peer.ts'\nimport { MirageFS } from './fs.ts'\n\nexport interface FuseHandle {\n mountpoint: string\n unmount: () => Promise<void>\n}\n\nexport interface MountOptions {\n mountpoint?: string\n agentId?: string\n /**\n * When true, `@zkochan/fuse-native`'s `autoUnmount` flag is set so the\n * kernel releases the mount if the process exits abnormally. Defaults to\n * `true` on Linux, `false` on darwin — macFUSE rejects the option with\n * \"unknown option `auto_unmount'\". On darwin the SIGINT cleanup in\n * FuseManager runs `diskutil unmount force` instead.\n */\n autoUnmount?: boolean\n /** Extra options forwarded verbatim to `@zkochan/fuse-native`. */\n fuseOptions?: Record<string, unknown>\n}\n\ntype FuseConstructor = new (\n mountpoint: string,\n ops: Record<string, unknown>,\n options?: Record<string, unknown>,\n) => {\n mount: (cb: (err: Error | null) => void) => void\n unmount: (cb: (err: Error | null) => void) => void\n}\n\nasync function loadFuse(): Promise<FuseConstructor> {\n const mod = await loadOptionalPeer(\n () => import('@zkochan/fuse-native') as unknown as Promise<{ default?: FuseConstructor }>,\n {\n feature: 'FUSE support',\n packageName: '@zkochan/fuse-native',\n docsUrl: 'https://mirage.dev/typescript/setup/fuse',\n },\n )\n const Fuse = (mod.default ?? mod) as unknown as FuseConstructor\n if (typeof Fuse !== 'function') {\n throw new Error('@zkochan/fuse-native did not export a constructor')\n }\n return Fuse\n}\n\n/** Fallback unmount via platform tools — mirrors Python's SIGINT handler. */\nexport function forceUnmount(mountpoint: string): void {\n try {\n if (process.platform === 'darwin') {\n execSync(`diskutil unmount force ${JSON.stringify(mountpoint)}`, { stdio: 'ignore' })\n } else {\n execSync(`fusermount -u ${JSON.stringify(mountpoint)}`, { stdio: 'ignore' })\n }\n } catch {\n // best-effort; caller already tried the clean path\n }\n}\n\nexport async function mount(ws: Workspace, options: MountOptions = {}): Promise<FuseHandle> {\n const Fuse = await loadFuse()\n const mountpoint = options.mountpoint ?? mkdtempSync(join(tmpdir(), 'mirage-fuse-'))\n const agentId = options.agentId\n const mfs = new MirageFS(ws, agentId !== undefined ? { agentId } : {})\n const autoUnmount = options.autoUnmount ?? process.platform === 'linux'\n const fuseOpts: Record<string, unknown> = {\n force: true,\n mkdir: true,\n ...(autoUnmount ? { autoUnmount: true } : {}),\n ...(options.fuseOptions ?? {}),\n }\n const fuse = new Fuse(mountpoint, mfs.ops(), fuseOpts)\n await new Promise<void>((resolve, reject) => {\n fuse.mount((err) => {\n if (err === null) resolve()\n else reject(err)\n })\n })\n return {\n mountpoint,\n unmount: () =>\n new Promise<void>((resolve, reject) => {\n fuse.unmount((err) => {\n if (err === null) resolve()\n else reject(err)\n })\n }),\n }\n}\n\nexport function mountBackground(ws: Workspace, options: MountOptions = {}): Promise<FuseHandle> {\n return mount(ws, options)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { FileType, type OpRecord, type Workspace } from '@struktoai/mirage-core'\nimport { isMacosMetadata } from './platform/macos.ts'\n\nconst ENV_AGENT_ID = 'MIRAGE_AGENT_ID'\nconst MIRAGE_DIR = '/.mirage'\nconst MIRAGE_WHOAMI = '/.mirage/whoami'\n\n// FUSE errno values (negative for fuse-native callbacks; positive for errors thrown).\nconst ENOENT = -2\nconst EACCES = -13\nconst ENOTDIR = -20\nconst EEXIST = -17\nconst ENOTEMPTY = -66 // macOS; Linux is -39 — fuse-native normalizes.\nconst EIO = -5\n\nexport interface FuseAttr {\n mtime: Date\n atime: Date\n ctime: Date\n nlink: number\n size: number\n mode: number\n uid: number\n gid: number\n}\n\ninterface Handle {\n path: string\n data?: Uint8Array\n writeBuf?: [number, Uint8Array][]\n}\n\ninterface PrefetchEntry {\n data: Uint8Array\n expires: number\n}\n\nconst PREFETCH_TTL_MS = 30_000\n\n/**\n * Sentinel size reported by getattr for API-backed files where the resource\n * returns size=null up front (Trello, Linear, Slack…). Python uses libfuse's\n * `direct_io` flag to make the kernel ignore reported size and issue read()\n * regardless; @zkochan/fuse-native doesn't expose direct_io, so we instead\n * report a deliberately-large size. The read handler returns 0 once the\n * actual bytes are exhausted, which surfaces as EOF to userspace.\n *\n * Reporting a real size requires fetching the bytes — fine for `cat`, but\n * disastrous for `ls`/`ls -l` because macOS's FUSE layer calls getattr per\n * directory entry. Using a sentinel keeps `ls` cheap (no API calls) while\n * still letting `cat` work. Once a file has been opened (and its bytes\n * cached), subsequent getattrs return the real size via cachedSize().\n *\n * The cap is bounded by Node's `fs/promises` readFile path: it allocates a\n * buffer of the reported size and converts it to a utf-8 string at the end,\n * which fails with `RangeError: Invalid string length` past V8's ~512 MiB\n * string limit. 100 MiB sits well under that, covers very busy Slack\n * channels' daily history, and bounds Buffer allocation per stat.\n */\nconst UNKNOWN_SIZE_SENTINEL = 100 * 1024 * 1024 // 100 MiB\n\ntype Cb<T> = (code: number, result?: T) => void\n\nfunction classifyError(err: unknown): number {\n const msg = (err instanceof Error ? err.message : String(err)).toLowerCase()\n if (msg.includes('not empty') || msg.includes('enotempty')) return ENOTEMPTY\n if (msg.includes('not a directory') || msg.includes('enotdir')) return ENOTDIR\n if (msg.includes('permission') || msg.includes('eacces') || msg.includes('read-only'))\n return EACCES\n if (msg.includes('file exists') || msg.includes('eexist')) return EEXIST\n if (\n msg.includes('not found') ||\n msg.includes('no such') ||\n msg.includes('enoent') ||\n msg.includes('no mount')\n )\n return ENOENT\n return EIO\n}\n\nexport interface MirageFSOptions {\n agentId?: string\n}\n\nexport class MirageFS {\n private readonly ws: Workspace\n readonly agentId: string\n private readonly now: Date\n private readonly prefixes: string[]\n private readonly handles = new Map<number, Handle>()\n private readonly prefetchCache = new Map<string, PrefetchEntry>()\n private readonly prefetchInflight = new Map<string, Promise<Uint8Array | null>>()\n private nextFh = 1\n private readonly uid: number\n private readonly gid: number\n\n constructor(ws: Workspace, options: MirageFSOptions = {}) {\n this.ws = ws\n this.agentId =\n options.agentId ??\n process.env[ENV_AGENT_ID] ??\n `agent-${Math.random().toString(36).slice(2, 10)}`\n this.now = new Date()\n this.prefixes = ws.mounts().map((m) => m.prefix)\n this.uid = typeof process.getuid === 'function' ? process.getuid() : 0\n this.gid = typeof process.getgid === 'function' ? process.getgid() : 0\n }\n\n // ── helpers ──────────────────────────────────────────────────────\n\n private whoamiContent(): Uint8Array {\n const lines = [`agent: ${this.agentId}`, 'cwd: /', `mounts: ${this.prefixes.join(', ')}`]\n return new TextEncoder().encode(lines.join('\\n') + '\\n')\n }\n\n private dirStat(): FuseAttr {\n return {\n mtime: this.now,\n atime: this.now,\n ctime: this.now,\n nlink: 2,\n size: 0,\n mode: 0o040755,\n uid: this.uid,\n gid: this.gid,\n }\n }\n\n private fileStat(size: number): FuseAttr {\n return {\n mtime: this.now,\n atime: this.now,\n ctime: this.now,\n nlink: 1,\n size,\n mode: 0o100644,\n uid: this.uid,\n gid: this.gid,\n }\n }\n\n private isVirtualDir(path: string): boolean {\n const bare = path.replace(/\\/+$/, '')\n const normalized = bare + '/'\n for (const p of this.prefixes) {\n const pBare = p.replace(/\\/+$/, '')\n if (p.startsWith(normalized) || pBare === bare) return true\n }\n return false\n }\n\n private virtualChildren(path: string): string[] {\n const normalized = path === '/' ? '/' : path.replace(/\\/+$/, '') + '/'\n const children = new Set<string>()\n for (const p of this.prefixes) {\n if (p.startsWith(normalized) && p !== normalized) {\n const rest = p.slice(normalized.length)\n const child = rest.split('/')[0]\n if (child !== undefined && child !== '') children.add(child)\n }\n }\n return [...children].sort()\n }\n\n private cachedSize(path: string): number | null {\n for (const ctx of this.handles.values()) {\n if (ctx.path === path && ctx.data !== undefined) return ctx.data.byteLength\n }\n const entry = this.prefetchCache.get(path)\n if (entry !== undefined && entry.expires > Date.now()) return entry.data.byteLength\n return null\n }\n\n private cachedData(path: string): Uint8Array | null {\n for (const ctx of this.handles.values()) {\n if (ctx.path === path && ctx.data !== undefined) return ctx.data\n }\n const entry = this.prefetchCache.get(path)\n if (entry !== undefined && entry.expires > Date.now()) return entry.data\n if (entry !== undefined) this.prefetchCache.delete(path)\n return null\n }\n\n /**\n * Fetch bytes for a size-unknown file and cache them so the immediate\n * getattr → open → read burst (and subsequent stats within the TTL) reuse\n * the same fetch. Required because @zkochan/fuse-native doesn't expose\n * libfuse's `direct_io` flag — without a real size from getattr, the kernel\n * decides the file is empty and never issues read().\n */\n private async prefetch(path: string): Promise<Uint8Array | null> {\n const cached = this.cachedData(path)\n if (cached !== null) return cached\n const inflight = this.prefetchInflight.get(path)\n if (inflight !== undefined) return inflight\n const promise = (async (): Promise<Uint8Array | null> => {\n try {\n const data = await this.ws.fs.readFile(path)\n this.prefetchCache.set(path, { data, expires: Date.now() + PREFETCH_TTL_MS })\n return data\n } catch {\n return null\n } finally {\n this.prefetchInflight.delete(path)\n }\n })()\n this.prefetchInflight.set(path, promise)\n return promise\n }\n\n /** Drain and return accumulated op records (mirrors Python's drain_ops). */\n drainOps(): OpRecord[] {\n const records = [...this.ws.records]\n this.ws.records.length = 0\n return records\n }\n\n // ── FUSE op surface (mirrors mfusepy Operations) ─────────────────\n\n ops(): Record<string, unknown> {\n return {\n readdir: this.readdir.bind(this),\n getattr: this.getattr.bind(this),\n open: this.open.bind(this),\n read: this.read.bind(this),\n write: this.write.bind(this),\n create: this.create.bind(this),\n unlink: this.unlink.bind(this),\n mkdir: this.mkdir.bind(this),\n rmdir: this.rmdir.bind(this),\n rename: this.rename.bind(this),\n release: this.release.bind(this),\n truncate: this.truncate.bind(this),\n flush: this.flush.bind(this),\n fsync: this.fsync.bind(this),\n utimens: this.utimens.bind(this),\n chmod: this.chmod.bind(this),\n chown: this.chown.bind(this),\n access: this.access.bind(this),\n statfs: this.statfs.bind(this),\n }\n }\n\n private getattr(path: string, cb: Cb<FuseAttr>): void {\n void (async () => {\n if (path === '/' || path === MIRAGE_DIR) {\n cb(0, this.dirStat())\n return\n }\n if (path === MIRAGE_WHOAMI) {\n cb(0, this.fileStat(this.whoamiContent().byteLength))\n return\n }\n // macOS Finder/Spotlight probes .DS_Store, ._*, .Spotlight-V100, etc.\n // Reject early to avoid hitting the ops layer.\n const name = path.slice(path.lastIndexOf('/') + 1)\n if (isMacosMetadata(name)) {\n cb(ENOENT)\n return\n }\n if (this.isVirtualDir(path)) {\n cb(0, this.dirStat())\n return\n }\n try {\n const s = await this.ws.fs.stat(path)\n if (s.type === FileType.DIRECTORY) {\n cb(0, this.dirStat())\n return\n }\n let size = s.size\n size ??= this.cachedSize(path) ?? UNKNOWN_SIZE_SENTINEL\n cb(0, this.fileStat(size))\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private readdir(path: string, cb: Cb<string[]>): void {\n void (async () => {\n // `/.mirage/` virtual dir — a single pseudo file.\n if (path === MIRAGE_DIR) {\n cb(0, ['.', '..', 'whoami'])\n return\n }\n const names = new Set(this.virtualChildren(path))\n if (path === '/') names.add('.mirage')\n try {\n const entries = await this.ws.fs.readdir(path)\n for (const e of entries) {\n const part = e.replace(/\\/+$/, '').split('/').pop() ?? ''\n if (part !== '' && !isMacosMetadata(part)) names.add(part)\n }\n } catch {\n if (names.size === 0) {\n cb(ENOENT)\n return\n }\n }\n cb(0, ['.', '..', ...[...names].sort()])\n })()\n }\n\n private read(\n path: string,\n fd: number,\n buf: Buffer,\n len: number,\n pos: number,\n cb: (result: number) => void,\n ): void {\n void (async () => {\n if (path === MIRAGE_WHOAMI) {\n const data = this.whoamiContent()\n const slice = data.subarray(pos, pos + len)\n buf.set(slice, 0)\n cb(slice.byteLength)\n return\n }\n const ctx = this.handles.get(fd)\n try {\n // Filetype-aware read: no `raw: true`, so parquet/feather/hdf5/etc.\n // get routed through their read ops and surface as rendered text —\n // matches Python's `self._ops.read(path)` which also goes through\n // filetype dispatch.\n if (ctx !== undefined && ctx.data === undefined) {\n const cached = this.cachedData(path)\n ctx.data = cached ?? (await this.ws.fs.readFile(path))\n }\n const data = ctx?.data ?? this.cachedData(path) ?? (await this.ws.fs.readFile(path))\n const slice = data.subarray(pos, pos + len)\n buf.set(slice, 0)\n cb(slice.byteLength)\n } catch {\n cb(0)\n }\n })()\n }\n\n private write(\n path: string,\n fd: number,\n buf: Buffer,\n len: number,\n pos: number,\n cb: (result: number) => void,\n ): void {\n const ctx = this.handles.get(fd)\n const data = new Uint8Array(buf.subarray(0, len))\n if (ctx !== undefined) {\n ctx.writeBuf ??= []\n ctx.writeBuf.push([pos, data])\n cb(len)\n return\n }\n void (async () => {\n try {\n let existing: Uint8Array = new Uint8Array(0)\n try {\n existing = await this.ws.fs.readFile(path, { raw: true })\n } catch {\n // file may not exist yet\n }\n let merged = existing\n if (pos > merged.byteLength) {\n // zero-pad from end-of-file up to the write offset (sparse write).\n const padded = new Uint8Array(pos + data.byteLength)\n padded.set(merged, 0)\n padded.set(data, pos)\n merged = padded\n } else {\n const size = Math.max(merged.byteLength, pos + data.byteLength)\n const out = new Uint8Array(size)\n out.set(merged.subarray(0, pos), 0)\n out.set(data, pos)\n if (pos + data.byteLength < merged.byteLength) {\n out.set(merged.subarray(pos + data.byteLength), pos + data.byteLength)\n }\n merged = out\n }\n await this.ws.fs.writeFile(path, merged)\n cb(len)\n } catch {\n cb(0)\n }\n })()\n }\n\n private create(path: string, _mode: number, cb: Cb<number>): void {\n void (async () => {\n try {\n // Route through the resource's `create` op so backends that distinguish\n // \"create empty\" from \"write bytes\" get the right code path. Falls back\n // to writeFile(empty) when the resource doesn't expose `create`.\n try {\n await this.ws.dispatch('create', path)\n } catch (dispatchErr) {\n const msg = (\n dispatchErr instanceof Error ? dispatchErr.message : String(dispatchErr)\n ).toLowerCase()\n if (!msg.includes('no op')) throw dispatchErr\n await this.ws.fs.writeFile(path, new Uint8Array(0))\n }\n const fh = this.nextFh++\n this.handles.set(fh, { path })\n cb(0, fh)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private mkdir(path: string, _mode: number, cb: (code: number) => void): void {\n void (async () => {\n try {\n await this.ws.fs.mkdir(path)\n cb(0)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private unlink(path: string, cb: (code: number) => void): void {\n void (async () => {\n try {\n await this.ws.fs.unlink(path)\n cb(0)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private rename(src: string, dst: string, cb: (code: number) => void): void {\n void (async () => {\n try {\n await this.ws.fs.rename(src, dst)\n cb(0)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private rmdir(path: string, cb: (code: number) => void): void {\n void (async () => {\n try {\n // Detect non-empty directories up front so we can map to ENOTEMPTY\n // cleanly. Message-string sniffing alone (classifyError) is unreliable\n // across backends; check contents first.\n try {\n const entries = await this.ws.fs.readdir(path)\n if (entries.length > 0) {\n cb(ENOTEMPTY)\n return\n }\n } catch {\n // readdir failure — fall through to rmdir and let it raise the real\n // error (e.g. ENOENT for missing path).\n }\n await this.ws.fs.rmdir(path)\n cb(0)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private truncate(path: string, size: number, cb: (code: number) => void): void {\n void (async () => {\n try {\n // Prefer the resource's dedicated `truncate` op (atomic on most\n // backends). Fall back to read/resize/write for resources that don't\n // expose one.\n try {\n await this.ws.dispatch('truncate', path, [size])\n } catch (dispatchErr) {\n const msg = (\n dispatchErr instanceof Error ? dispatchErr.message : String(dispatchErr)\n ).toLowerCase()\n if (!msg.includes('no op')) throw dispatchErr\n const data = await this.ws.fs.readFile(path, { raw: true }).catch(() => new Uint8Array(0))\n const out = new Uint8Array(size)\n out.set(data.subarray(0, Math.min(data.byteLength, size)), 0)\n await this.ws.fs.writeFile(path, out)\n }\n cb(0)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private statfs(_path: string, cb: Cb<Record<string, number>>): void {\n cb(0, {\n bsize: 4096,\n frsize: 4096,\n blocks: 1024 * 1024,\n bfree: 1024 * 1024,\n bavail: 1024 * 1024,\n files: 1_000_000,\n ffree: 1_000_000,\n favail: 1_000_000,\n namemax: 255,\n })\n }\n\n // chmod / chown / utimens / access are no-ops for the filesystem but must\n // validate path existence — callers like `touch`/`chmod` on a missing file\n // should fail with ENOENT, not silently succeed.\n\n private chmod(path: string, _mode: number, cb: (code: number) => void): void {\n this.getattrValidate(path, cb)\n }\n\n private chown(path: string, _uid: number, _gid: number, cb: (code: number) => void): void {\n this.getattrValidate(path, cb)\n }\n\n private utimens(path: string, _atime: Date, _mtime: Date, cb: (code: number) => void): void {\n this.getattrValidate(path, cb)\n }\n\n private access(path: string, _amode: number, cb: (code: number) => void): void {\n this.getattrValidate(path, cb)\n }\n\n private getattrValidate(path: string, cb: (code: number) => void): void {\n // getattr's callback returns 0 on success and a negative errno on failure\n // (FUSE convention). Pass the code straight through so missing paths\n // surface as ENOENT instead of silently succeeding.\n this.getattr(path, (code) => {\n cb(code)\n })\n }\n\n private open(path: string, _flags: number, cb: Cb<number>): void {\n void (async () => {\n if (path === MIRAGE_WHOAMI) {\n const fh = this.nextFh++\n this.handles.set(fh, { path })\n cb(0, fh)\n return\n }\n try {\n const s = await this.ws.fs.stat(path)\n const ctx: Handle = { path }\n if (s.size === null && s.type !== FileType.DIRECTORY) {\n const data = await this.prefetch(path)\n if (data !== null) ctx.data = data\n }\n const fh = this.nextFh++\n this.handles.set(fh, ctx)\n cb(0, fh)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private release(_path: string, fd: number, cb: (code: number) => void): void {\n // Python does NOT flush on release — the kernel always issues flush first.\n // Auto-flushing here would conflict on error paths and hide real failures.\n this.handles.delete(fd)\n cb(0)\n }\n\n private flush(path: string, fd: number, cb: (code: number) => void): void {\n const ctx = this.handles.get(fd)\n if (ctx?.writeBuf === undefined || ctx.writeBuf.length === 0) {\n cb(0)\n return\n }\n const writes = ctx.writeBuf\n ctx.writeBuf = []\n void (async () => {\n try {\n let existing: Uint8Array = new Uint8Array(0)\n try {\n existing = await this.ws.fs.readFile(path, { raw: true })\n } catch {\n // ignore\n }\n let total = existing.byteLength\n for (const [off, chunk] of writes) {\n total = Math.max(total, off + chunk.byteLength)\n }\n const merged = new Uint8Array(total)\n merged.set(existing, 0)\n for (const [off, chunk] of writes) {\n merged.set(chunk, off)\n }\n await this.ws.fs.writeFile(path, merged)\n cb(0)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private fsync(path: string, _datasync: number, fd: number, cb: (code: number) => void): void {\n this.flush(path, fd, cb)\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\nconst MACOS_METADATA: ReadonlySet<string> = new Set([\n '.DS_Store',\n '.Spotlight-V100',\n '.fseventsd',\n '.Trashes',\n])\n\nexport function isMacosMetadata(name: string): boolean {\n return MACOS_METADATA.has(name) || name.startsWith('._')\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 { Buffer } from 'node:buffer'\nimport { createRequire } from 'node:module'\nimport { FileType, type Workspace } from '@struktoai/mirage-core'\n\nconst requireCjs = createRequire(import.meta.url)\nconst fs = requireCjs('node:fs') as Record<string, unknown>\n// fs-monkey ships no types\nconst fsMonkey = requireCjs('fs-monkey') as {\n patchFs: (vol: unknown, target?: unknown) => void\n}\nconst { patchFs } = fsMonkey\n\ntype Cb<T> = (err: NodeJS.ErrnoException | null, value?: T) => void\n\ntype FsLike = Record<string, unknown>\n\nfunction mountedPath(ws: Workspace, p: string): boolean {\n try {\n return ws.registry.mountFor(p) !== null\n } catch {\n return false\n }\n}\n\nasync function mirageStat(ws: Workspace, p: string): Promise<unknown> {\n const s = await ws.fs.stat(p)\n const isDir = s.type === FileType.DIRECTORY\n const mtime = s.modified !== null ? new Date(s.modified) : new Date(0)\n return {\n isFile: () => !isDir,\n isDirectory: () => isDir,\n isBlockDevice: () => false,\n isCharacterDevice: () => false,\n isSymbolicLink: () => false,\n isFIFO: () => false,\n isSocket: () => false,\n size: s.size ?? 0,\n mtime,\n mtimeMs: mtime.getTime(),\n atime: mtime,\n atimeMs: mtime.getTime(),\n ctime: mtime,\n ctimeMs: mtime.getTime(),\n birthtime: mtime,\n birthtimeMs: mtime.getTime(),\n mode: 0,\n nlink: 1,\n uid: 0,\n gid: 0,\n rdev: 0,\n blksize: 0,\n blocks: 0,\n dev: 0,\n ino: 0,\n }\n}\n\n/**\n * Monkey-patch Node's `fs` module so that paths under any mirage mount\n * route through the workspace. Paths NOT under a mount fall through to\n * the real native fs. CJS-friendly; for ESM code you still need to use\n * `ws.fs.*` directly since ESM bindings are frozen.\n *\n * Returns a `restore()` function that undoes the patch.\n */\nexport function patchNodeFs(ws: Workspace): () => void {\n const originalFs: FsLike = { ...(fs as unknown as FsLike) }\n\n const vol: FsLike = {\n promises: {\n readFile: async (p: string, opts?: { encoding?: BufferEncoding } | BufferEncoding) => {\n if (mountedPath(ws, p)) {\n const bytes = await ws.fs.readFile(p)\n const encoding = typeof opts === 'string' ? opts : opts?.encoding\n if (encoding !== undefined) return Buffer.from(bytes).toString(encoding)\n return Buffer.from(bytes)\n }\n const native = (originalFs.promises as FsLike).readFile as (\n path: string,\n opts?: unknown,\n ) => Promise<Uint8Array | string>\n return native(p, opts)\n },\n writeFile: async (p: string, data: Uint8Array | string): Promise<void> => {\n if (mountedPath(ws, p)) {\n await ws.fs.writeFile(p, typeof data === 'string' ? data : data)\n return\n }\n const native = (originalFs.promises as FsLike).writeFile as (\n path: string,\n data: Uint8Array | string,\n ) => Promise<void>\n await native(p, data)\n },\n readdir: async (p: string): Promise<string[]> => {\n if (mountedPath(ws, p)) {\n // Workspace returns full paths; Node's fs.promises.readdir returns basenames.\n // Strip trailing slash on directory entries before slicing so dirs\n // don't collapse to ''.\n const entries = await ws.fs.readdir(p)\n return entries.map((e) => {\n const trimmed = e.endsWith('/') ? e.slice(0, -1) : e\n return trimmed.slice(trimmed.lastIndexOf('/') + 1)\n })\n }\n const native = (originalFs.promises as FsLike).readdir as (\n path: string,\n ) => Promise<string[]>\n return native(p)\n },\n stat: async (p: string): Promise<unknown> => {\n if (mountedPath(ws, p)) return mirageStat(ws, p)\n const native = (originalFs.promises as FsLike).stat as (path: string) => Promise<unknown>\n return native(p)\n },\n unlink: async (p: string): Promise<void> => {\n if (mountedPath(ws, p)) return ws.fs.unlink(p)\n const native = (originalFs.promises as FsLike).unlink as (path: string) => Promise<void>\n await native(p)\n },\n mkdir: async (p: string): Promise<void> => {\n if (mountedPath(ws, p)) return ws.fs.mkdir(p)\n const native = (originalFs.promises as FsLike).mkdir as (path: string) => Promise<void>\n await native(p)\n },\n rmdir: async (p: string): Promise<void> => {\n if (mountedPath(ws, p)) return ws.fs.rmdir(p)\n const native = (originalFs.promises as FsLike).rmdir as (path: string) => Promise<void>\n await native(p)\n },\n },\n readFileSync: (): Uint8Array => {\n throw new Error('mirage.patchNodeFs: sync fs methods not supported — use fs.promises.*')\n },\n readFile: (p: string, cb: Cb<Uint8Array>) => {\n if (mountedPath(ws, p)) {\n ws.fs\n .readFile(p)\n .then((data) => {\n cb(null, Buffer.from(data))\n })\n .catch((err: unknown) => {\n cb(err as NodeJS.ErrnoException)\n })\n return\n }\n const native = originalFs.readFile as (path: string, cb: Cb<Uint8Array>) => void\n native(p, cb)\n },\n readdir: (p: string, cb: Cb<string[]>) => {\n if (mountedPath(ws, p)) {\n ws.fs\n .readdir(p)\n .then((entries) => {\n cb(\n null,\n entries.map((e) => {\n const trimmed = e.endsWith('/') ? e.slice(0, -1) : e\n return trimmed.slice(trimmed.lastIndexOf('/') + 1)\n }),\n )\n })\n .catch((err: unknown) => {\n cb(err as NodeJS.ErrnoException)\n })\n return\n }\n const native = originalFs.readdir as (path: string, cb: Cb<string[]>) => void\n native(p, cb)\n },\n }\n\n patchFs(vol, fs)\n return function restore(): void {\n for (const [k, v] of Object.entries(originalFs)) {\n const desc = Object.getOwnPropertyDescriptor(fs, k)\n if (desc?.writable === false && desc.set === undefined) continue\n try {\n fs[k] = v\n } catch {\n // some fs properties are accessor-only and can't be reassigned; skip\n }\n }\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type Accessor,\n type CommandOpts,\n type IndexCacheStore,\n type PathSpec,\n Precision,\n ProvisionResult,\n type Resource,\n} from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\nimport { stat as redisStat } from '../../../core/redis/stat.ts'\n\nexport interface RedisResourceLike extends Resource {\n readonly accessor: RedisAccessor\n}\n\ninterface ResolvedSizes {\n resolved: [string, number][]\n missing: number\n}\n\nasync function resolveSizes(\n accessor: RedisAccessor,\n paths: readonly PathSpec[],\n index: IndexCacheStore | undefined,\n): Promise<ResolvedSizes> {\n const resolved: [string, number][] = []\n let missing = 0\n for (const p of paths) {\n const pathStr = p.original\n let size: number | null = null\n if (index !== undefined) {\n const lookup = await index.get(pathStr)\n if (lookup.entry !== undefined && lookup.entry !== null) {\n size = lookup.entry.size\n }\n }\n if (size === null) {\n try {\n const fileStat = await redisStat(accessor, p)\n size = fileStat.size\n } catch {\n // fall through — size stays null\n }\n }\n if (size !== null) {\n resolved.push([pathStr, size])\n } else {\n missing += 1\n }\n }\n return { resolved, missing }\n}\n\nexport async function fileReadProvision(\n accessor: Accessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<ProvisionResult> {\n if (paths.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const { resolved, missing } = await resolveSizes(accessor as RedisAccessor, paths, undefined)\n if (missing > 0 || resolved.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const total = resolved.reduce((sum, [, size]) => sum + size, 0)\n return new ProvisionResult({\n networkReadLow: total,\n networkReadHigh: total,\n readOps: resolved.length,\n precision: Precision.EXACT,\n })\n}\n\nexport async function headTailProvision(\n accessor: Accessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<ProvisionResult> {\n if (paths.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const { resolved, missing } = await resolveSizes(accessor as RedisAccessor, paths, undefined)\n if (missing > 0 || resolved.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const total = resolved.reduce((sum, [, size]) => sum + size, 0)\n return new ProvisionResult({\n networkReadLow: total,\n networkReadHigh: total,\n readOps: resolved.length,\n precision: Precision.EXACT,\n })\n}\n\nexport function metadataProvision(\n _accessor: Accessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): ProvisionResult {\n const n = Math.max(1, paths.length > 0 ? paths.length : 1)\n return new ProvisionResult({\n networkReadLow: 0,\n networkReadHigh: 0,\n readOps: n,\n precision: Precision.EXACT,\n })\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type FileCache,\n defaultFingerprint,\n parseLimit,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { RedisClientType } from 'redis'\nimport { RedisResource, type RedisResourceOptions } from '../../resource/redis/redis.ts'\n\nexport interface RedisFileCacheOptions extends RedisResourceOptions {\n cacheLimit?: string | number\n maxDrainBytes?: number | null\n}\n\nexport class RedisFileCacheStore extends RedisResource implements FileCache {\n private readonly limit: number\n private readonly dataPrefix: string\n private readonly metaPrefix: string\n maxDrainBytes: number | null\n\n constructor(options: RedisFileCacheOptions = {}) {\n super({\n url: options.url ?? 'redis://localhost:6379/0',\n keyPrefix: options.keyPrefix ?? 'mirage:cache:',\n })\n this.limit = parseLimit(options.cacheLimit ?? '512MB')\n this.dataPrefix = `${this.keyPrefix}data:`\n this.metaPrefix = `${this.keyPrefix}meta:`\n this.maxDrainBytes = options.maxDrainBytes ?? null\n }\n\n readonly cacheSize = 0\n\n get cacheLimit(): number {\n return this.limit\n }\n\n cacheClient(): Promise<RedisClientType> {\n return this.store.client()\n }\n\n async get(key: string): Promise<Uint8Array | null> {\n const c = await this.cacheClient()\n const mod = await this.module()\n const blob = mod.RESP_TYPES.BLOB_STRING\n const mapping: Record<number, unknown> = { [blob]: Buffer }\n const typed = c as unknown as {\n withTypeMapping: (m: Record<number, unknown>) => {\n get: (k: string) => Promise<Buffer | null>\n }\n }\n const raw = await typed.withTypeMapping(mapping).get(`${this.dataPrefix}${key}`)\n if (raw === null) return null\n return new Uint8Array(raw.buffer, raw.byteOffset, raw.byteLength)\n }\n\n async set(\n key: string,\n data: Uint8Array,\n options: { fingerprint?: string | null; ttl?: number | null } = {},\n ): Promise<void> {\n const fp = options.fingerprint ?? defaultFingerprint(data)\n const c = await this.cacheClient()\n const dk = `${this.dataPrefix}${key}`\n const mk = `${this.metaPrefix}${key}`\n const pipe = c.multi()\n pipe.set(dk, Buffer.from(data.buffer, data.byteOffset, data.byteLength))\n pipe.set(mk, fp)\n if (options.ttl !== null && options.ttl !== undefined) {\n pipe.expire(dk, options.ttl)\n pipe.expire(mk, options.ttl)\n }\n await pipe.exec()\n }\n\n async add(\n key: string,\n data: Uint8Array,\n options: { fingerprint?: string | null; ttl?: number | null } = {},\n ): Promise<boolean> {\n const c = await this.cacheClient()\n const exists = await c.exists(`${this.dataPrefix}${key}`)\n if (exists) return false\n await this.set(key, data, options)\n return true\n }\n\n async remove(key: string): Promise<void> {\n const c = await this.cacheClient()\n const pipe = c.multi()\n pipe.del(`${this.dataPrefix}${key}`)\n pipe.del(`${this.metaPrefix}${key}`)\n await pipe.exec()\n }\n\n async exists(key: string | PathSpec): Promise<boolean> {\n const k = typeof key === 'string' ? key : key.stripPrefix\n const c = await this.cacheClient()\n return (await c.exists(`${this.dataPrefix}${k}`)) > 0\n }\n\n async isFresh(key: string, remoteFingerprint: string): Promise<boolean> {\n const c = await this.cacheClient()\n const fp = await c.get(`${this.metaPrefix}${key}`)\n if (fp === null) return false\n return fp === remoteFingerprint\n }\n\n async clear(): Promise<void> {\n const c = await this.cacheClient()\n for (const pattern of [`${this.dataPrefix}*`, `${this.metaPrefix}*`]) {\n const batch: string[] = []\n for await (const k of c.scanIterator({ MATCH: pattern })) {\n if (Array.isArray(k)) batch.push(...k)\n else batch.push(k)\n }\n if (batch.length > 0) await c.del(batch)\n }\n }\n\n async allCached(keys: readonly string[]): Promise<boolean> {\n for (const k of keys) {\n if (!(await this.exists(k))) return false\n }\n return true\n }\n\n async multiGet(keys: readonly string[]): Promise<(Uint8Array | null)[]> {\n const out: (Uint8Array | null)[] = []\n for (const k of keys) out.push(await this.get(k))\n return out\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 IndexCacheStore,\n IndexEntry,\n type IndexConfig,\n type ListResult,\n type LookupResult,\n LookupStatus,\n} from '@struktoai/mirage-core'\nimport type { RedisClientType } from 'redis'\nimport { loadOptionalPeer } from '../../optional_peer.ts'\n\nconst ENTRY_PREFIX = 'mirage:idx:entry:'\nconst CHILDREN_PREFIX = 'mirage:idx:children:'\n\nexport interface RedisIndexCacheOptions {\n ttl?: number\n url?: string\n client?: RedisClientType\n keyPrefix?: string\n}\n\nexport class RedisIndexCacheStore extends IndexCacheStore {\n private readonly ttl: number\n private readonly url: string\n private readonly providedClient: RedisClientType | null\n private readonly entryPrefix: string\n private readonly childrenPrefix: string\n private clientPromise: Promise<RedisClientType> | null = null\n\n constructor(options: RedisIndexCacheOptions = {}) {\n super()\n this.ttl = options.ttl ?? 600\n this.url = options.url ?? 'redis://localhost:6379/0'\n this.providedClient = options.client ?? null\n const prefix = options.keyPrefix ?? ''\n this.entryPrefix = `${prefix}${ENTRY_PREFIX}`\n this.childrenPrefix = `${prefix}${CHILDREN_PREFIX}`\n }\n\n static fromConfig(\n config: IndexConfig,\n extra: Omit<RedisIndexCacheOptions, 'ttl'> = {},\n ): RedisIndexCacheStore {\n return new RedisIndexCacheStore({ ttl: config.ttl ?? 600, ...extra })\n }\n\n private entryKey(path: string): string {\n return `${this.entryPrefix}${path}`\n }\n\n private childrenKey(path: string): string {\n return `${this.childrenPrefix}${path}`\n }\n\n private client(): Promise<RedisClientType> {\n if (this.providedClient !== null) return Promise.resolve(this.providedClient)\n this.clientPromise ??= (async () => {\n const mod = await loadOptionalPeer(\n () =>\n import('redis') as unknown as Promise<{\n createClient: (o: { url: string }) => RedisClientType\n }>,\n { feature: 'RedisIndexCacheStore', packageName: 'redis' },\n )\n const c = mod.createClient({\n url: this.url,\n socket: { reconnectStrategy: false },\n } as Parameters<typeof mod.createClient>[0])\n await c.connect()\n return c\n })()\n return this.clientPromise\n }\n\n async get(resourcePath: string): Promise<LookupResult> {\n const c = await this.client()\n const raw = await c.get(this.entryKey(resourcePath))\n if (raw === null) return { status: LookupStatus.NOT_FOUND }\n const parsed = JSON.parse(raw) as {\n id: string\n name: string\n resourceType: string\n remoteTime?: string\n indexTime?: string\n vfsName?: string\n size?: number | null\n }\n return { entry: new IndexEntry(parsed) }\n }\n\n async put(resourcePath: string, entry: IndexEntry): Promise<void> {\n const c = await this.client()\n const stored =\n entry.indexTime === '' ? entry.copyWith({ indexTime: new Date().toISOString() }) : entry\n await c.set(this.entryKey(resourcePath), JSON.stringify(this.serialize(stored)))\n }\n\n async listDir(resourcePath: string): Promise<ListResult> {\n const c = await this.client()\n const key = this.childrenKey(resourcePath)\n const exists = await c.exists(key)\n if (!exists) return { status: LookupStatus.NOT_FOUND }\n const ttlRemaining = await c.ttl(key)\n if (ttlRemaining === -2) return { status: LookupStatus.EXPIRED }\n const raw = await c.lRange(key, 0, -1)\n return { entries: [...raw].sort() }\n }\n\n async setDir(\n resourcePath: string,\n entries: readonly [string, IndexEntry][],\n expiredAt?: Date | null,\n ): Promise<void> {\n const c = await this.client()\n const now = new Date()\n const nowIso = now.toISOString()\n const prefix = resourcePath === '/' ? '/' : `${resourcePath}/`\n const pipe = c.multi()\n const childKeys: string[] = []\n for (const [name, entry] of entries) {\n const fullPath = prefix + name\n const stored = entry.indexTime === '' ? entry.copyWith({ indexTime: nowIso }) : entry\n pipe.set(this.entryKey(fullPath), JSON.stringify(this.serialize(stored)))\n childKeys.push(fullPath)\n }\n const childrenKey = this.childrenKey(resourcePath)\n pipe.del(childrenKey)\n if (childKeys.length > 0) {\n childKeys.sort()\n pipe.rPush(childrenKey, childKeys)\n }\n const ttlSeconds =\n expiredAt !== null && expiredAt !== undefined\n ? Math.max(1, Math.floor((expiredAt.getTime() - now.getTime()) / 1000))\n : Math.max(1, Math.floor(this.ttl))\n pipe.expire(childrenKey, ttlSeconds)\n await pipe.exec()\n }\n\n async invalidateDir(resourcePath: string): Promise<void> {\n const c = await this.client()\n await c.del(this.childrenKey(resourcePath))\n }\n\n async clear(): Promise<void> {\n const c = await this.client()\n for (const pattern of [`${this.entryPrefix}*`, `${this.childrenPrefix}*`]) {\n const keys: string[] = []\n for await (const k of c.scanIterator({ MATCH: pattern })) {\n if (Array.isArray(k)) keys.push(...k)\n else keys.push(k)\n }\n if (keys.length > 0) await c.del(keys)\n }\n }\n\n async close(): Promise<void> {\n if (this.providedClient !== null) return\n if (this.clientPromise === null) return\n const c = await this.clientPromise\n const typed = c as unknown as { destroy?: () => void }\n if (typeof typed.destroy === 'function') typed.destroy()\n else if (c.isOpen) await c.quit()\n this.clientPromise = null\n }\n\n private serialize(e: IndexEntry): Record<string, unknown> {\n return {\n id: e.id,\n name: e.name,\n resourceType: e.resourceType,\n remoteTime: e.remoteTime,\n indexTime: e.indexTime,\n vfsName: e.vfsName,\n size: e.size,\n }\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type FileStat,\n HttpSSCholarDriver,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n type SSCholarConfig,\n type SSCholarConfigResolved,\n type SSCholarDriver,\n SSCHOLAR_PAPER_COMMANDS,\n SSCHOLAR_PAPER_OPS,\n SSCHOLAR_PAPER_PROMPT,\n SSCholarAccessor,\n resolveSSCholarConfig,\n resolveSSCholarPaperGlob,\n sscholarPaperRead,\n sscholarPaperReaddir,\n sscholarPaperStat,\n} from '@struktoai/mirage-core'\n\nexport interface SSCholarPaperResourceOptions {\n config?: SSCholarConfig\n prefix?: string\n driver?: SSCholarDriver\n}\n\nexport class SSCholarPaperResource implements Resource {\n readonly kind: string = ResourceName.SSCHOLAR_PAPER\n readonly isRemote: boolean = true\n readonly indexTtl: number = 0\n readonly prompt: string\n readonly config: SSCholarConfigResolved\n readonly driver: SSCholarDriver\n readonly accessor: SSCholarAccessor\n readonly index: IndexCacheStore\n\n constructor(options: SSCholarPaperResourceOptions | SSCholarConfig = {}) {\n const opts: SSCholarPaperResourceOptions =\n 'config' in options || 'driver' in options || 'prefix' in options\n ? options\n : { config: options as SSCholarConfig }\n this.config = resolveSSCholarConfig(opts.config ?? {})\n this.driver =\n opts.driver ??\n new HttpSSCholarDriver({ baseUrl: this.config.baseUrl, apiKey: this.config.apiKey })\n this.accessor = new SSCholarAccessor(this.driver, this.config)\n this.index = new RAMIndexCacheStore({ ttl: this.indexTtl })\n this.prompt = SSCHOLAR_PAPER_PROMPT.replace('{prefix}', opts.prefix ?? '')\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n async close(): Promise<void> {\n await this.driver.close()\n }\n\n ops(): readonly RegisteredOp[] {\n return SSCHOLAR_PAPER_OPS\n }\n\n commands(): readonly RegisteredCommand[] {\n return SSCHOLAR_PAPER_COMMANDS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return sscholarPaperRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return sscholarPaperReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return sscholarPaperStat(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 p.prefix !== ''\n ? p\n : new PathSpec({\n original: p.original,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n prefix,\n }),\n )\n : paths\n return resolveSSCholarPaperGlob(this.accessor, effective, this.index)\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type FileStat,\n HttpSSCholarDriver,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n type SSCholarConfig,\n type SSCholarConfigResolved,\n type SSCholarDriver,\n SSCHOLAR_AUTHOR_COMMANDS,\n SSCHOLAR_AUTHOR_OPS,\n SSCHOLAR_AUTHOR_PROMPT,\n SSCholarAccessor,\n resolveSSCholarAuthorGlob,\n resolveSSCholarConfig,\n sscholarAuthorRead,\n sscholarAuthorReaddir,\n sscholarAuthorStat,\n} from '@struktoai/mirage-core'\n\nexport interface SSCholarAuthorResourceOptions {\n config?: SSCholarConfig\n prefix?: string\n driver?: SSCholarDriver\n}\n\nexport class SSCholarAuthorResource implements Resource {\n readonly kind: string = ResourceName.SSCHOLAR_AUTHOR\n readonly isRemote: boolean = true\n readonly indexTtl: number = 0\n readonly prompt: string\n readonly config: SSCholarConfigResolved\n readonly driver: SSCholarDriver\n readonly accessor: SSCholarAccessor\n readonly index: IndexCacheStore\n\n constructor(options: SSCholarAuthorResourceOptions | SSCholarConfig = {}) {\n const opts: SSCholarAuthorResourceOptions =\n 'config' in options || 'driver' in options || 'prefix' in options\n ? options\n : { config: options as SSCholarConfig }\n this.config = resolveSSCholarConfig(opts.config ?? {})\n this.driver =\n opts.driver ??\n new HttpSSCholarDriver({ baseUrl: this.config.baseUrl, apiKey: this.config.apiKey })\n this.accessor = new SSCholarAccessor(this.driver, this.config)\n this.index = new RAMIndexCacheStore({ ttl: this.indexTtl })\n this.prompt = SSCHOLAR_AUTHOR_PROMPT.replace('{prefix}', opts.prefix ?? '')\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n async close(): Promise<void> {\n await this.driver.close()\n }\n\n ops(): readonly RegisteredOp[] {\n return SSCHOLAR_AUTHOR_OPS\n }\n\n commands(): readonly RegisteredCommand[] {\n return SSCHOLAR_AUTHOR_COMMANDS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return sscholarAuthorRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return sscholarAuthorReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return sscholarAuthorStat(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 p.prefix !== ''\n ? p\n : new PathSpec({\n original: p.original,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n prefix,\n }),\n )\n : paths\n return resolveSSCholarAuthorGlob(this.accessor, effective, this.index)\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type FileStat,\n HttpVercelDriver,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n type VercelConfig,\n type VercelConfigResolved,\n type VercelDriver,\n VERCEL_COMMANDS,\n VERCEL_OPS,\n VERCEL_PROMPT,\n VercelAccessor,\n resolveVercelConfig,\n resolveVercelGlob,\n vercelRead,\n vercelReaddir,\n vercelStat,\n} from '@struktoai/mirage-core'\n\nexport interface VercelResourceOptions {\n config?: VercelConfig\n prefix?: string\n driver?: VercelDriver\n}\n\nexport class VercelResource implements Resource {\n readonly kind: string = ResourceName.VERCEL\n readonly isRemote: boolean = true\n readonly indexTtl: number = 60\n readonly prompt: string\n readonly config: VercelConfigResolved\n readonly driver: VercelDriver\n readonly accessor: VercelAccessor\n readonly index: IndexCacheStore\n\n constructor(options: VercelResourceOptions | VercelConfig = {}) {\n const opts: VercelResourceOptions =\n 'config' in options || 'driver' in options || 'prefix' in options\n ? options\n : { config: options as VercelConfig }\n this.config = resolveVercelConfig(opts.config ?? {})\n this.driver =\n opts.driver ??\n new HttpVercelDriver({\n baseUrl: this.config.baseUrl,\n token: this.config.token,\n teamId: this.config.teamId,\n })\n this.accessor = new VercelAccessor(this.driver, this.config)\n this.index = new RAMIndexCacheStore({ ttl: this.indexTtl })\n this.prompt = VERCEL_PROMPT.replace('{prefix}', opts.prefix ?? '')\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n async close(): Promise<void> {\n await this.driver.close()\n }\n\n ops(): readonly RegisteredOp[] {\n return VERCEL_OPS\n }\n\n commands(): readonly RegisteredCommand[] {\n return VERCEL_COMMANDS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return vercelRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return vercelReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return vercelStat(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 p.prefix !== ''\n ? p\n : new PathSpec({\n original: p.original,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n prefix,\n }),\n )\n : paths\n return resolveVercelGlob(this.accessor, effective, this.index)\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type FileStat,\n HttpPostHogDriver,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n type PostHogConfig,\n type PostHogConfigResolved,\n type PostHogDriver,\n POSTHOG_COMMANDS,\n POSTHOG_OPS,\n POSTHOG_PROMPT,\n PostHogAccessor,\n posthogRead,\n posthogReaddir,\n posthogStat,\n resolvePostHogConfig,\n resolvePostHogGlob,\n} from '@struktoai/mirage-core'\n\nexport interface PostHogResourceOptions {\n config?: PostHogConfig\n prefix?: string\n driver?: PostHogDriver\n}\n\nexport class PostHogResource implements Resource {\n readonly kind: string = ResourceName.POSTHOG\n readonly isRemote: boolean = true\n readonly indexTtl: number = 60\n readonly prompt: string\n readonly config: PostHogConfigResolved\n readonly driver: PostHogDriver\n readonly accessor: PostHogAccessor\n readonly index: IndexCacheStore\n\n constructor(options: PostHogResourceOptions | PostHogConfig = {}) {\n const opts: PostHogResourceOptions =\n 'config' in options || 'driver' in options || 'prefix' in options\n ? options\n : { config: options as PostHogConfig }\n this.config = resolvePostHogConfig(opts.config ?? {})\n this.driver =\n opts.driver ??\n new HttpPostHogDriver({ baseUrl: this.config.baseUrl, apiKey: this.config.apiKey })\n this.accessor = new PostHogAccessor(this.driver, this.config)\n this.index = new RAMIndexCacheStore({ ttl: this.indexTtl })\n this.prompt = POSTHOG_PROMPT.replace('{prefix}', opts.prefix ?? '')\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n async close(): Promise<void> {\n await this.driver.close()\n }\n\n ops(): readonly RegisteredOp[] {\n return POSTHOG_OPS\n }\n\n commands(): readonly RegisteredCommand[] {\n return POSTHOG_COMMANDS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return posthogRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return posthogReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return posthogStat(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 p.prefix !== ''\n ? p\n : new PathSpec({\n original: p.original,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n prefix,\n }),\n )\n : paths\n return resolvePostHogGlob(this.accessor, effective, this.index)\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { normalizeFields, type Resource } from '@struktoai/mirage-core'\n\n/**\n * Construct a resource by registry name. Mirrors Python's\n * `mirage.resource.registry.build_resource`.\n *\n * Each entry is an async factory that lazy-imports its module so that\n * importing this file doesn't pull in every backend's dependencies.\n * Only the resource you actually request gets loaded — important for\n * S3/Redis whose peer deps (`@aws-sdk/client-s3`, `redis`) are optional.\n *\n * Configs are normalized from Python-style snake_case (used in YAML and\n * by the Python `mirage.config` loader) to TS-idiomatic camelCase. So\n * the same YAML file works in both Python and TS.\n */\nexport type ResourceFactory = (config: Record<string, unknown>) => Promise<Resource>\n\nconst REGISTRY: Record<string, ResourceFactory> = {\n ram: async (_config) => {\n const { RAMResource } = await import('@struktoai/mirage-core')\n return new RAMResource()\n },\n disk: async (config) => {\n const { DiskResource } = await import('./disk/disk.ts')\n const norm = normalizeFields(config) as { root: string }\n return new DiskResource(norm)\n },\n redis: async (config) => {\n const { RedisResource } = await import('./redis/redis.ts')\n const norm = normalizeFields(config)\n return new RedisResource(norm)\n },\n s3: async (config) => {\n const { S3Resource } = await import('./s3/s3.ts')\n const { normalizeS3Config } = await import('./s3/config.ts')\n return new S3Resource(normalizeS3Config(config))\n },\n gcs: async (config) => {\n const { GCSResource } = await import('./gcs/gcs.ts')\n const { normalizeGcsConfig } = await import('./gcs/config.ts')\n return new GCSResource(normalizeGcsConfig(config))\n },\n oci: async (config) => {\n const { OCIResource } = await import('./oci/oci.ts')\n const { normalizeOciConfig } = await import('./oci/config.ts')\n return new OCIResource(normalizeOciConfig(config))\n },\n r2: async (config) => {\n const { R2Resource } = await import('./r2/r2.ts')\n const { normalizeR2Config } = await import('./r2/config.ts')\n return new R2Resource(normalizeR2Config(config))\n },\n supabase: async (config) => {\n const { SupabaseResource } = await import('./supabase/supabase.ts')\n const { normalizeSupabaseConfig } = await import('./supabase/config.ts')\n return new SupabaseResource(normalizeSupabaseConfig(config))\n },\n postgres: async (config) => {\n const { PostgresResource } = await import('./postgres/postgres.ts')\n const { normalizePostgresConfig } = await import('@struktoai/mirage-core')\n return new PostgresResource(normalizePostgresConfig(config))\n },\n mongodb: async (config) => {\n const { MongoDBResource } = await import('./mongodb/mongodb.ts')\n const { normalizeMongoDBConfig } = await import('@struktoai/mirage-core')\n return new MongoDBResource(normalizeMongoDBConfig(config))\n },\n slack: async (config) => {\n const { SlackResource } = await import('./slack/slack.ts')\n const { normalizeSlackConfig } = await import('./slack/config.ts')\n return new SlackResource(normalizeSlackConfig(config))\n },\n ssh: async (config) => {\n const { SSHResource } = await import('./ssh/ssh.ts')\n const { normalizeSshConfig } = await import('./ssh/config.ts')\n return new SSHResource(normalizeSshConfig(config))\n },\n discord: async (config) => {\n const { DiscordResource } = await import('./discord/discord.ts')\n const { normalizeDiscordConfig } = await import('./discord/config.ts')\n return new DiscordResource(normalizeDiscordConfig(config))\n },\n trello: async (config) => {\n const { TrelloResource } = await import('./trello/trello.ts')\n const { normalizeTrelloConfig } = await import('./trello/config.ts')\n return new TrelloResource(normalizeTrelloConfig(config))\n },\n linear: async (config) => {\n const { LinearResource } = await import('./linear/linear.ts')\n const { normalizeLinearConfig } = await import('./linear/config.ts')\n return new LinearResource(normalizeLinearConfig(config))\n },\n langfuse: async (config) => {\n const { LangfuseResource } = await import('./langfuse/langfuse.ts')\n const { normalizeLangfuseConfig } = await import('./langfuse/config.ts')\n return new LangfuseResource(normalizeLangfuseConfig(config))\n },\n github: async (config) => {\n const { GitHubResource } = await import('./github/github.ts')\n const { normalizeGitHubConfig } = await import('./github/config.ts')\n return GitHubResource.create(normalizeGitHubConfig(config))\n },\n github_ci: async (config) => {\n const { GitHubCIResource } = await import('./github_ci/github_ci.ts')\n const { normalizeGitHubCIConfig } = await import('./github_ci/config.ts')\n return new GitHubCIResource(normalizeGitHubCIConfig(config))\n },\n gdocs: async (config) => {\n const { GDocsResource } = await import('./gdocs/gdocs.ts')\n const { normalizeGDocsConfig } = await import('./gdocs/config.ts')\n return new GDocsResource(normalizeGDocsConfig(config))\n },\n gsheets: async (config) => {\n const { GSheetsResource } = await import('./gsheets/gsheets.ts')\n const { normalizeGSheetsConfig } = await import('./gsheets/config.ts')\n return new GSheetsResource(normalizeGSheetsConfig(config))\n },\n gslides: async (config) => {\n const { GSlidesResource } = await import('./gslides/gslides.ts')\n const { normalizeGSlidesConfig } = await import('./gslides/config.ts')\n return new GSlidesResource(normalizeGSlidesConfig(config))\n },\n gdrive: async (config) => {\n const { GDriveResource } = await import('./gdrive/gdrive.ts')\n const { normalizeGDriveConfig } = await import('./gdrive/config.ts')\n return new GDriveResource(normalizeGDriveConfig(config))\n },\n dropbox: async (config) => {\n const { DropboxResource } = await import('./dropbox/dropbox.ts')\n const { normalizeDropboxConfig } = await import('./dropbox/config.ts')\n return new DropboxResource(normalizeDropboxConfig(config))\n },\n box: async (config) => {\n const { BoxResource } = await import('./box/box.ts')\n const { normalizeBoxConfig } = await import('./box/config.ts')\n return new BoxResource(normalizeBoxConfig(config))\n },\n gmail: async (config) => {\n const { GmailResource } = await import('./gmail/gmail.ts')\n const { normalizeGmailConfig } = await import('./gmail/config.ts')\n return new GmailResource(normalizeGmailConfig(config))\n },\n email: async (config) => {\n const { EmailResource } = await import('./email/email.ts')\n const { normalizeEmailConfig } = await import('./email/config.ts')\n return new EmailResource(normalizeEmailConfig(config))\n },\n}\n\n/**\n * Look up the registered names. Lazily-mutated by `register()` so users\n * can extend the registry with custom resources.\n */\nexport function knownResources(): string[] {\n return Object.keys(REGISTRY).sort()\n}\n\n/**\n * Register a custom resource factory under `name`. Existing entries\n * are overwritten, mirroring Python's mutable REGISTRY dict.\n */\nexport function register(name: string, factory: ResourceFactory): void {\n REGISTRY[name] = factory\n}\n\n/**\n * Build a resource instance by registry name. Throws if the name is\n * unknown.\n */\nexport async function buildResource(\n name: string,\n config: Record<string, unknown> = {},\n): Promise<Resource> {\n const factory = REGISTRY[name]\n if (factory === undefined) {\n throw new Error(\n `unknown resource ${JSON.stringify(name)}; known: ${knownResources().join(', ')}`,\n )\n }\n return factory(config)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { transcribe } from '../utils.ts'\n\nconst ENC = new TextEncoder()\n\nasync function catMp3Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const out: ByteSource = transcribe(raw)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as mp3: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_CAT_MP3 = command({\n name: 'cat',\n resource: ResourceName.DISK,\n spec: specOf('cat'),\n filetype: '.mp3',\n fn: catMp3Command,\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 { createRequire } from 'node:module'\nimport { join } from 'node:path'\nimport { parseBuffer } from 'music-metadata'\n\nexport interface LocalAudioMetadata {\n duration: number | null\n sampleRate: number | null\n channels: number | null\n bitrate: number | null\n}\n\nexport type LocalAudioTranscriber = (\n raw: Uint8Array,\n startSec?: number,\n endSec?: number,\n) => AsyncIterable<Uint8Array | string>\n\nexport interface LocalAudioConfig {\n modelDir?: string\n recognizer?: LocalAudioTranscriber\n}\n\ninterface SherpaOfflineRecognizer {\n createStream(): {\n acceptWaveform(w: { sampleRate: number; samples: Float32Array }): void\n }\n decodeAsync(stream: object): Promise<{ text: string }>\n}\n\ninterface SherpaModule {\n OfflineRecognizer: new (cfg: unknown) => SherpaOfflineRecognizer\n}\n\ninterface WaveFileModule {\n WaveFile: new (bytes?: Uint8Array) => {\n toSampleRate(rate: number): void\n toBitDepth(depth: string): void\n getSamples(interleaved: boolean, type: Float32ArrayConstructor): Float32Array\n }\n}\n\nconst _config: LocalAudioConfig = {}\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder()\n\nlet _sherpa: SherpaModule | null = null\nlet _wavefile: WaveFileModule | null = null\nlet _recognizer: SherpaOfflineRecognizer | null = null\nlet _loadedModelDir: string | null = null\n\nconst require = createRequire(import.meta.url)\n\nfunction loadSherpa(): SherpaModule {\n if (_sherpa !== null) return _sherpa\n try {\n _sherpa = require('sherpa-onnx-node') as SherpaModule\n return _sherpa\n } catch {\n throw new Error(\n \"Audio transcription requires 'sherpa-onnx-node'. Install with: \" +\n 'npm i sherpa-onnx-node (or pnpm/yarn add).',\n )\n }\n}\n\nfunction loadWavefile(): WaveFileModule {\n if (_wavefile !== null) return _wavefile\n try {\n _wavefile = require('wavefile') as WaveFileModule\n return _wavefile\n } catch {\n throw new Error(\n \"Built-in WAV decoding requires 'wavefile'. Install with: npm i wavefile \" +\n '(or pass a custom recognizer via configure({ recognizer }) to skip it).',\n )\n }\n}\n\nfunction getRecognizer(modelDir: string): SherpaOfflineRecognizer {\n if (_recognizer !== null && _loadedModelDir === modelDir) return _recognizer\n const sherpa = loadSherpa()\n _recognizer = new sherpa.OfflineRecognizer({\n featConfig: { sampleRate: 16000, featureDim: 80 },\n modelConfig: {\n whisper: {\n encoder: join(modelDir, 'base-encoder.int8.onnx'),\n decoder: join(modelDir, 'base-decoder.int8.onnx'),\n },\n tokens: join(modelDir, 'base-tokens.txt'),\n numThreads: 2,\n provider: 'cpu',\n },\n })\n _loadedModelDir = modelDir\n return _recognizer\n}\n\nexport function configure(opts: LocalAudioConfig): void {\n if (opts.modelDir !== undefined) _config.modelDir = opts.modelDir\n if (opts.recognizer !== undefined) _config.recognizer = opts.recognizer\n if (opts.modelDir !== undefined && opts.modelDir !== _loadedModelDir) {\n _recognizer = null\n _loadedModelDir = null\n }\n}\n\nexport function getConfig(): Readonly<LocalAudioConfig> {\n return _config\n}\n\nexport async function* transcribe(\n raw: Uint8Array,\n startSec?: number,\n endSec?: number,\n): AsyncIterable<Uint8Array> {\n // User-supplied recognizer: full override (strings auto-encoded for convenience).\n if (_config.recognizer !== undefined) {\n for await (const chunk of _config.recognizer(raw, startSec, endSec)) {\n yield typeof chunk === 'string' ? ENC.encode(chunk) : chunk\n }\n return\n }\n\n // Built-in pipeline: sherpa-onnx (Whisper) + wavefile. Mirrors Python's\n // mirage.commands.audio.utils.transcribe() which uses sherpa-onnx + PyAV.\n if (_config.modelDir !== undefined) {\n const isWav = raw.byteLength >= 12 && DEC.decode(raw.subarray(0, 4)) === 'RIFF'\n if (!isWav) {\n throw new Error(\n 'Built-in transcriber handles WAV only. For MP3/OGG/other, pass a custom ' +\n 'transcriber via configure({ recognizer: (raw, startSec?, endSec?) => ' +\n 'AsyncIterable<string | Uint8Array> }).',\n )\n }\n const { WaveFile } = loadWavefile()\n const w = new WaveFile(raw)\n w.toSampleRate(16000)\n w.toBitDepth('32f')\n let samples = w.getSamples(true, Float32Array)\n if (startSec !== undefined || endSec !== undefined) {\n const s = Math.max(0, Math.floor((startSec ?? 0) * 16000))\n const e =\n endSec !== undefined ? Math.min(samples.length, Math.floor(endSec * 16000)) : samples.length\n samples = samples.subarray(s, e)\n }\n const recognizer = getRecognizer(_config.modelDir)\n const stream = recognizer.createStream()\n stream.acceptWaveform({ sampleRate: 16000, samples })\n const result = await recognizer.decodeAsync(stream)\n const text = result.text.trim()\n if (text !== '') yield ENC.encode(`${text}\\n`)\n return\n }\n\n throw new Error(\n 'Audio transcription not configured. Call configure({ modelDir }) to use the ' +\n 'built-in sherpa-onnx+wavefile pipeline, or configure({ recognizer }) to plug ' +\n 'your own.',\n )\n}\n\nexport async function metadata(raw: Uint8Array): Promise<LocalAudioMetadata> {\n const parsed = await parseBuffer(raw, undefined, { duration: true })\n const f = parsed.format\n return {\n duration: f.duration ?? null,\n sampleRate: f.sampleRate ?? null,\n channels: f.numberOfChannels ?? null,\n bitrate: f.bitrate !== undefined ? f.bitrate / 1000 : null,\n }\n}\n\nexport function estimateByteRange(\n meta: LocalAudioMetadata,\n fileSize: number,\n startSec?: number,\n endSec?: number,\n): [number, number] {\n const duration = meta.duration ?? 0\n if (duration <= 0) return [0, fileSize]\n const start = startSec ?? 0\n const end = endSec ?? duration\n const ratioStart = Math.max(0, start / duration)\n const ratioEnd = Math.min(1, end / duration)\n return [Math.floor(ratioStart * fileSize), Math.floor(ratioEnd * fileSize)]\n}\n\nexport function formatDuration(duration: number): string {\n const total = Math.floor(duration)\n const hours = Math.floor(total / 3600)\n const minutes = Math.floor((total % 3600) / 60)\n const seconds = total % 60\n const mm = String(minutes).padStart(2, '0')\n const ss = String(seconds).padStart(2, '0')\n if (hours > 0) return `${String(hours)}:${mm}:${ss}`\n return `${String(minutes)}:${ss}`\n}\n\nexport function formatMetadata(\n meta: LocalAudioMetadata,\n path: string,\n fileSize?: number | null,\n): string {\n const lines: string[] = [`${path}:`]\n const { duration, sampleRate, channels, bitrate } = meta\n\n if (duration !== null) lines.push(` Duration: ${formatDuration(duration)}`)\n else lines.push(' Duration: unknown')\n\n if (sampleRate !== null) lines.push(` Sample rate: ${String(Math.floor(sampleRate))} Hz`)\n\n if (channels !== null) {\n const ch = Math.floor(channels)\n const label = ch === 1 ? 'mono' : ch === 2 ? 'stereo' : `${String(ch)} channels`\n lines.push(` Channels: ${String(ch)} (${label})`)\n }\n\n if (bitrate !== null) lines.push(` Bitrate: ${bitrate.toFixed(1)} kbps`)\n\n if (fileSize !== undefined && fileSize !== null) {\n if (fileSize >= 1_048_576) lines.push(` File size: ${(fileSize / 1_048_576).toFixed(1)} MB`)\n else if (fileSize >= 1024) lines.push(` File size: ${(fileSize / 1024).toFixed(1)} KB`)\n else lines.push(` File size: ${String(fileSize)} B`)\n }\n\n return lines.join('\\n')\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { transcribe } from '../utils.ts'\n\nconst ENC = new TextEncoder()\n\nasync function catOggCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const out: ByteSource = transcribe(raw)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as ogg: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_CAT_OGG = command({\n name: 'cat',\n resource: ResourceName.DISK,\n spec: specOf('cat'),\n filetype: '.ogg',\n fn: catOggCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { transcribe } from '../utils.ts'\n\nconst ENC = new TextEncoder()\n\nasync function catWavCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const out: ByteSource = transcribe(raw)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as wav: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_CAT_WAV = command({\n name: 'cat',\n resource: ResourceName.DISK,\n spec: specOf('cat'),\n filetype: '.wav',\n fn: catWavCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { transcribe } from '../utils.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder()\n\nasync function grepMp3Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0 || texts.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = await materialize(diskStream(accessor, first))\n const text = DEC.decode(await materialize(transcribe(raw)))\n const flags = ignoreCase ? 'i' : ''\n const re = new RegExp(pattern, flags)\n if (re.test(text)) {\n const out: ByteSource = ENC.encode(text)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n }\n return [\n null,\n new IOResult({\n exitCode: 1,\n reads: { [first.original]: raw },\n cache: [first.original],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as mp3: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_GREP_MP3 = command({\n name: 'grep',\n resource: ResourceName.DISK,\n spec: specOf('grep'),\n filetype: '.mp3',\n fn: grepMp3Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { transcribe } from '../utils.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder()\n\nasync function grepOggCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0 || texts.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = await materialize(diskStream(accessor, first))\n const text = DEC.decode(await materialize(transcribe(raw)))\n const flags = ignoreCase ? 'i' : ''\n const re = new RegExp(pattern, flags)\n if (re.test(text)) {\n const out: ByteSource = ENC.encode(text)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n }\n return [\n null,\n new IOResult({\n exitCode: 1,\n reads: { [first.original]: raw },\n cache: [first.original],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as ogg: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_GREP_OGG = command({\n name: 'grep',\n resource: ResourceName.DISK,\n spec: specOf('grep'),\n filetype: '.ogg',\n fn: grepOggCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { transcribe } from '../utils.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder()\n\nasync function grepWavCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0 || texts.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = await materialize(diskStream(accessor, first))\n const text = DEC.decode(await materialize(transcribe(raw)))\n const flags = ignoreCase ? 'i' : ''\n const re = new RegExp(pattern, flags)\n if (re.test(text)) {\n const out: ByteSource = ENC.encode(text)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n }\n return [\n null,\n new IOResult({\n exitCode: 1,\n reads: { [first.original]: raw },\n cache: [first.original],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as wav: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_GREP_WAV = command({\n name: 'grep',\n resource: ResourceName.DISK,\n spec: specOf('grep'),\n filetype: '.wav',\n fn: grepWavCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { transcribe } from '../utils.ts'\n\nconst ENC = new TextEncoder()\n\nasync function headMp3Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (typeof opts.flags.c === 'string') {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('head: -c not supported for audio files\\n') }),\n ]\n }\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(diskStream(accessor, first))\n const out: ByteSource = transcribe(raw, undefined, n)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as mp3: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_HEAD_MP3 = command({\n name: 'head',\n resource: ResourceName.DISK,\n spec: specOf('head'),\n filetype: '.mp3',\n fn: headMp3Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { transcribe } from '../utils.ts'\n\nconst ENC = new TextEncoder()\n\nasync function headOggCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (typeof opts.flags.c === 'string') {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('head: -c not supported for audio files\\n') }),\n ]\n }\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(diskStream(accessor, first))\n const out: ByteSource = transcribe(raw, undefined, n)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as ogg: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_HEAD_OGG = command({\n name: 'head',\n resource: ResourceName.DISK,\n spec: specOf('head'),\n filetype: '.ogg',\n fn: headOggCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { transcribe } from '../utils.ts'\n\nconst ENC = new TextEncoder()\n\nasync function headWavCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (typeof opts.flags.c === 'string') {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('head: -c not supported for audio files\\n') }),\n ]\n }\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(diskStream(accessor, first))\n const out: ByteSource = transcribe(raw, undefined, n)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as wav: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_HEAD_WAV = command({\n name: 'head',\n resource: ResourceName.DISK,\n spec: specOf('head'),\n filetype: '.wav',\n fn: headWavCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stat as diskStat } from '../../../core/disk/stat.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { formatMetadata, metadata } from '../utils.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statMp3Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('stat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const meta = await metadata(raw)\n const fs = await diskStat(accessor, first)\n const out: ByteSource = ENC.encode(formatMetadata(meta, first.original, fs.size ?? null))\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as mp3: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_STAT_MP3 = command({\n name: 'stat',\n resource: ResourceName.DISK,\n spec: specOf('stat'),\n filetype: '.mp3',\n fn: statMp3Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stat as diskStat } from '../../../core/disk/stat.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { formatMetadata, metadata } from '../utils.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statOggCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('stat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const meta = await metadata(raw)\n const fs = await diskStat(accessor, first)\n const out: ByteSource = ENC.encode(formatMetadata(meta, first.original, fs.size ?? null))\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as ogg: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_STAT_OGG = command({\n name: 'stat',\n resource: ResourceName.DISK,\n spec: specOf('stat'),\n filetype: '.ogg',\n fn: statOggCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stat as diskStat } from '../../../core/disk/stat.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { formatMetadata, metadata } from '../utils.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statWavCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('stat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const meta = await metadata(raw)\n const fs = await diskStat(accessor, first)\n const out: ByteSource = ENC.encode(formatMetadata(meta, first.original, fs.size ?? null))\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as wav: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_STAT_WAV = command({\n name: 'stat',\n resource: ResourceName.DISK,\n spec: specOf('stat'),\n filetype: '.wav',\n fn: statWavCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { metadata, transcribe } from '../utils.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailMp3Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (typeof opts.flags.c === 'string') {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('tail: -c not supported for audio files\\n') }),\n ]\n }\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(diskStream(accessor, first))\n const meta = await metadata(raw)\n const duration = meta.duration ?? 0\n const start = Math.max(0, duration - n)\n const out: ByteSource = transcribe(raw, start)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as mp3: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_TAIL_MP3 = command({\n name: 'tail',\n resource: ResourceName.DISK,\n spec: specOf('tail'),\n filetype: '.mp3',\n fn: tailMp3Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { metadata, transcribe } from '../utils.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailOggCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (typeof opts.flags.c === 'string') {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('tail: -c not supported for audio files\\n') }),\n ]\n }\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(diskStream(accessor, first))\n const meta = await metadata(raw)\n const duration = meta.duration ?? 0\n const start = Math.max(0, duration - n)\n const out: ByteSource = transcribe(raw, start)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as ogg: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_TAIL_OGG = command({\n name: 'tail',\n resource: ResourceName.DISK,\n spec: specOf('tail'),\n filetype: '.ogg',\n fn: tailOggCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { metadata, transcribe } from '../utils.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailWavCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (typeof opts.flags.c === 'string') {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('tail: -c not supported for audio files\\n') }),\n ]\n }\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(diskStream(accessor, first))\n const meta = await metadata(raw)\n const duration = meta.duration ?? 0\n const start = Math.max(0, duration - n)\n const out: ByteSource = transcribe(raw, start)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as wav: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_LOCAL_AUDIO_TAIL_WAV = command({\n name: 'tail',\n resource: ResourceName.DISK,\n spec: specOf('tail'),\n filetype: '.wav',\n fn: tailWavCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RegisteredCommand } from '@struktoai/mirage-core'\nimport { DISK_LOCAL_AUDIO_CAT_MP3 } from './cat_mp3.ts'\nimport { DISK_LOCAL_AUDIO_CAT_OGG } from './cat_ogg.ts'\nimport { DISK_LOCAL_AUDIO_CAT_WAV } from './cat_wav.ts'\nimport { DISK_LOCAL_AUDIO_GREP_MP3 } from './grep_mp3.ts'\nimport { DISK_LOCAL_AUDIO_GREP_OGG } from './grep_ogg.ts'\nimport { DISK_LOCAL_AUDIO_GREP_WAV } from './grep_wav.ts'\nimport { DISK_LOCAL_AUDIO_HEAD_MP3 } from './head_mp3.ts'\nimport { DISK_LOCAL_AUDIO_HEAD_OGG } from './head_ogg.ts'\nimport { DISK_LOCAL_AUDIO_HEAD_WAV } from './head_wav.ts'\nimport { DISK_LOCAL_AUDIO_STAT_MP3 } from './stat_mp3.ts'\nimport { DISK_LOCAL_AUDIO_STAT_OGG } from './stat_ogg.ts'\nimport { DISK_LOCAL_AUDIO_STAT_WAV } from './stat_wav.ts'\nimport { DISK_LOCAL_AUDIO_TAIL_MP3 } from './tail_mp3.ts'\nimport { DISK_LOCAL_AUDIO_TAIL_OGG } from './tail_ogg.ts'\nimport { DISK_LOCAL_AUDIO_TAIL_WAV } from './tail_wav.ts'\n\nexport const DISK_LOCAL_AUDIO_COMMANDS: readonly RegisteredCommand[] = [\n ...DISK_LOCAL_AUDIO_CAT_WAV,\n ...DISK_LOCAL_AUDIO_CAT_MP3,\n ...DISK_LOCAL_AUDIO_CAT_OGG,\n ...DISK_LOCAL_AUDIO_HEAD_WAV,\n ...DISK_LOCAL_AUDIO_HEAD_MP3,\n ...DISK_LOCAL_AUDIO_HEAD_OGG,\n ...DISK_LOCAL_AUDIO_TAIL_WAV,\n ...DISK_LOCAL_AUDIO_TAIL_MP3,\n ...DISK_LOCAL_AUDIO_TAIL_OGG,\n ...DISK_LOCAL_AUDIO_GREP_WAV,\n ...DISK_LOCAL_AUDIO_GREP_MP3,\n ...DISK_LOCAL_AUDIO_GREP_OGG,\n ...DISK_LOCAL_AUDIO_STAT_WAV,\n ...DISK_LOCAL_AUDIO_STAT_MP3,\n ...DISK_LOCAL_AUDIO_STAT_OGG,\n]\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { transcribe } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\n\nfunction catMp3Command(\n accessor: RAMAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): CommandFnResult {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = readRam(accessor, first)\n const out: ByteSource = transcribe(raw)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as mp3: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_CAT_MP3 = command({\n name: 'cat',\n resource: ResourceName.RAM,\n spec: specOf('cat'),\n filetype: '.mp3',\n fn: catMp3Command,\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 { RAMAccessor, PathSpec } from '@struktoai/mirage-core'\n\nfunction norm(p: string): string {\n return `/${p.replace(/^\\/+|\\/+$/g, '')}`\n}\n\nexport function readRam(accessor: RAMAccessor, path: PathSpec): Uint8Array {\n const p = norm(path.stripPrefix)\n const data = accessor.store.files.get(p)\n if (data === undefined) throw new Error(`file not found: ${p}`)\n return data\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { transcribe } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\n\nfunction catOggCommand(\n accessor: RAMAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): CommandFnResult {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = readRam(accessor, first)\n const out: ByteSource = transcribe(raw)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as ogg: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_CAT_OGG = command({\n name: 'cat',\n resource: ResourceName.RAM,\n spec: specOf('cat'),\n filetype: '.ogg',\n fn: catOggCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { transcribe } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\n\nfunction catWavCommand(\n accessor: RAMAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): CommandFnResult {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = readRam(accessor, first)\n const out: ByteSource = transcribe(raw)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as wav: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_CAT_WAV = command({\n name: 'cat',\n resource: ResourceName.RAM,\n spec: specOf('cat'),\n filetype: '.wav',\n fn: catWavCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { transcribe } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder()\n\nasync function grepMp3Command(\n accessor: RAMAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0 || texts.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = readRam(accessor, first)\n const text = DEC.decode(await materialize(transcribe(raw)))\n const flags = ignoreCase ? 'i' : ''\n const re = new RegExp(pattern, flags)\n if (re.test(text)) {\n const out: ByteSource = ENC.encode(text)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n }\n return [\n null,\n new IOResult({\n exitCode: 1,\n reads: { [first.original]: raw },\n cache: [first.original],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as mp3: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_GREP_MP3 = command({\n name: 'grep',\n resource: ResourceName.RAM,\n spec: specOf('grep'),\n filetype: '.mp3',\n fn: grepMp3Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { transcribe } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder()\n\nasync function grepOggCommand(\n accessor: RAMAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0 || texts.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = readRam(accessor, first)\n const text = DEC.decode(await materialize(transcribe(raw)))\n const flags = ignoreCase ? 'i' : ''\n const re = new RegExp(pattern, flags)\n if (re.test(text)) {\n const out: ByteSource = ENC.encode(text)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n }\n return [\n null,\n new IOResult({\n exitCode: 1,\n reads: { [first.original]: raw },\n cache: [first.original],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as ogg: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_GREP_OGG = command({\n name: 'grep',\n resource: ResourceName.RAM,\n spec: specOf('grep'),\n filetype: '.ogg',\n fn: grepOggCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { transcribe } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder()\n\nasync function grepWavCommand(\n accessor: RAMAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0 || texts.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = readRam(accessor, first)\n const text = DEC.decode(await materialize(transcribe(raw)))\n const flags = ignoreCase ? 'i' : ''\n const re = new RegExp(pattern, flags)\n if (re.test(text)) {\n const out: ByteSource = ENC.encode(text)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n }\n return [\n null,\n new IOResult({\n exitCode: 1,\n reads: { [first.original]: raw },\n cache: [first.original],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as wav: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_GREP_WAV = command({\n name: 'grep',\n resource: ResourceName.RAM,\n spec: specOf('grep'),\n filetype: '.wav',\n fn: grepWavCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { transcribe } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\n\nfunction headMp3Command(\n accessor: RAMAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): CommandFnResult {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (typeof opts.flags.c === 'string') {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('head: -c not supported for audio files\\n') }),\n ]\n }\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = readRam(accessor, first)\n const out: ByteSource = transcribe(raw, undefined, n)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as mp3: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_HEAD_MP3 = command({\n name: 'head',\n resource: ResourceName.RAM,\n spec: specOf('head'),\n filetype: '.mp3',\n fn: headMp3Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { transcribe } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\n\nfunction headOggCommand(\n accessor: RAMAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): CommandFnResult {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (typeof opts.flags.c === 'string') {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('head: -c not supported for audio files\\n') }),\n ]\n }\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = readRam(accessor, first)\n const out: ByteSource = transcribe(raw, undefined, n)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as ogg: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_HEAD_OGG = command({\n name: 'head',\n resource: ResourceName.RAM,\n spec: specOf('head'),\n filetype: '.ogg',\n fn: headOggCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { transcribe } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\n\nfunction headWavCommand(\n accessor: RAMAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): CommandFnResult {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (typeof opts.flags.c === 'string') {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('head: -c not supported for audio files\\n') }),\n ]\n }\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = readRam(accessor, first)\n const out: ByteSource = transcribe(raw, undefined, n)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as wav: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_HEAD_WAV = command({\n name: 'head',\n resource: ResourceName.RAM,\n spec: specOf('head'),\n filetype: '.wav',\n fn: headWavCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { formatMetadata, metadata } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statMp3Command(\n accessor: RAMAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('stat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = readRam(accessor, first)\n const meta = await metadata(raw)\n const out: ByteSource = ENC.encode(formatMetadata(meta, first.original, null))\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as mp3: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_STAT_MP3 = command({\n name: 'stat',\n resource: ResourceName.RAM,\n spec: specOf('stat'),\n filetype: '.mp3',\n fn: statMp3Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { formatMetadata, metadata } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statOggCommand(\n accessor: RAMAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('stat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = readRam(accessor, first)\n const meta = await metadata(raw)\n const out: ByteSource = ENC.encode(formatMetadata(meta, first.original, null))\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as ogg: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_STAT_OGG = command({\n name: 'stat',\n resource: ResourceName.RAM,\n spec: specOf('stat'),\n filetype: '.ogg',\n fn: statOggCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { formatMetadata, metadata } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statWavCommand(\n accessor: RAMAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('stat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = readRam(accessor, first)\n const meta = await metadata(raw)\n const out: ByteSource = ENC.encode(formatMetadata(meta, first.original, null))\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as wav: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_STAT_WAV = command({\n name: 'stat',\n resource: ResourceName.RAM,\n spec: specOf('stat'),\n filetype: '.wav',\n fn: statWavCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { metadata, transcribe } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailMp3Command(\n accessor: RAMAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (typeof opts.flags.c === 'string') {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('tail: -c not supported for audio files\\n') }),\n ]\n }\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = readRam(accessor, first)\n const meta = await metadata(raw)\n const duration = meta.duration ?? 0\n const start = Math.max(0, duration - n)\n const out: ByteSource = transcribe(raw, start)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as mp3: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_TAIL_MP3 = command({\n name: 'tail',\n resource: ResourceName.RAM,\n spec: specOf('tail'),\n filetype: '.mp3',\n fn: tailMp3Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { metadata, transcribe } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailOggCommand(\n accessor: RAMAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (typeof opts.flags.c === 'string') {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('tail: -c not supported for audio files\\n') }),\n ]\n }\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = readRam(accessor, first)\n const meta = await metadata(raw)\n const duration = meta.duration ?? 0\n const start = Math.max(0, duration - n)\n const out: ByteSource = transcribe(raw, start)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as ogg: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_TAIL_OGG = command({\n name: 'tail',\n resource: ResourceName.RAM,\n spec: specOf('tail'),\n filetype: '.ogg',\n fn: tailOggCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type RAMAccessor,\n} from '@struktoai/mirage-core'\nimport { metadata, transcribe } from '../utils.ts'\nimport { readRam } from './read.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailWavCommand(\n accessor: RAMAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (typeof opts.flags.c === 'string') {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('tail: -c not supported for audio files\\n') }),\n ]\n }\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = readRam(accessor, first)\n const meta = await metadata(raw)\n const duration = meta.duration ?? 0\n const start = Math.max(0, duration - n)\n const out: ByteSource = transcribe(raw, start)\n return [out, new IOResult({ reads: { [first.original]: raw }, cache: [first.original] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as wav: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_LOCAL_AUDIO_TAIL_WAV = command({\n name: 'tail',\n resource: ResourceName.RAM,\n spec: specOf('tail'),\n filetype: '.wav',\n fn: tailWavCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RegisteredCommand } from '@struktoai/mirage-core'\nimport { RAM_LOCAL_AUDIO_CAT_MP3 } from './cat_mp3.ts'\nimport { RAM_LOCAL_AUDIO_CAT_OGG } from './cat_ogg.ts'\nimport { RAM_LOCAL_AUDIO_CAT_WAV } from './cat_wav.ts'\nimport { RAM_LOCAL_AUDIO_GREP_MP3 } from './grep_mp3.ts'\nimport { RAM_LOCAL_AUDIO_GREP_OGG } from './grep_ogg.ts'\nimport { RAM_LOCAL_AUDIO_GREP_WAV } from './grep_wav.ts'\nimport { RAM_LOCAL_AUDIO_HEAD_MP3 } from './head_mp3.ts'\nimport { RAM_LOCAL_AUDIO_HEAD_OGG } from './head_ogg.ts'\nimport { RAM_LOCAL_AUDIO_HEAD_WAV } from './head_wav.ts'\nimport { RAM_LOCAL_AUDIO_STAT_MP3 } from './stat_mp3.ts'\nimport { RAM_LOCAL_AUDIO_STAT_OGG } from './stat_ogg.ts'\nimport { RAM_LOCAL_AUDIO_STAT_WAV } from './stat_wav.ts'\nimport { RAM_LOCAL_AUDIO_TAIL_MP3 } from './tail_mp3.ts'\nimport { RAM_LOCAL_AUDIO_TAIL_OGG } from './tail_ogg.ts'\nimport { RAM_LOCAL_AUDIO_TAIL_WAV } from './tail_wav.ts'\n\nexport const RAM_LOCAL_AUDIO_COMMANDS: readonly RegisteredCommand[] = [\n ...RAM_LOCAL_AUDIO_CAT_WAV,\n ...RAM_LOCAL_AUDIO_CAT_MP3,\n ...RAM_LOCAL_AUDIO_CAT_OGG,\n ...RAM_LOCAL_AUDIO_HEAD_WAV,\n ...RAM_LOCAL_AUDIO_HEAD_MP3,\n ...RAM_LOCAL_AUDIO_HEAD_OGG,\n ...RAM_LOCAL_AUDIO_TAIL_WAV,\n ...RAM_LOCAL_AUDIO_TAIL_MP3,\n ...RAM_LOCAL_AUDIO_TAIL_OGG,\n ...RAM_LOCAL_AUDIO_GREP_WAV,\n ...RAM_LOCAL_AUDIO_GREP_MP3,\n ...RAM_LOCAL_AUDIO_GREP_OGG,\n ...RAM_LOCAL_AUDIO_STAT_WAV,\n ...RAM_LOCAL_AUDIO_STAT_MP3,\n ...RAM_LOCAL_AUDIO_STAT_OGG,\n]\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RegisteredCommand } from '@struktoai/mirage-core'\nimport { DISK_LOCAL_AUDIO_COMMANDS } from './disk/index.ts'\nimport { RAM_LOCAL_AUDIO_COMMANDS } from './ram/index.ts'\n\nexport {\n configure,\n getConfig,\n transcribe,\n metadata,\n estimateByteRange,\n formatDuration,\n formatMetadata,\n type LocalAudioMetadata,\n type LocalAudioConfig,\n type LocalAudioTranscriber,\n} from './utils.ts'\n\nexport { DISK_LOCAL_AUDIO_COMMANDS } from './disk/index.ts'\nexport { RAM_LOCAL_AUDIO_COMMANDS } from './ram/index.ts'\n\nexport const LOCAL_AUDIO_COMMANDS: {\n ram: readonly RegisteredCommand[]\n disk: readonly RegisteredCommand[]\n} = {\n ram: RAM_LOCAL_AUDIO_COMMANDS,\n disk: DISK_LOCAL_AUDIO_COMMANDS,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,cAAc;;;ACAd,SAAS,oBAAoB;AA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AAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;;;ACbO,IAAM,uBAGT;AAAA,EACF,KAAK;AAAA,EACL,MAAM;AACR;","names":["ExecuteResult","command","command","ExecuteResult","Buffer","createRequire","FileType","requireCjs","stat","HttpSSCholarDriver","PathSpec","RAMIndexCacheStore","ResourceName","SSCholarAccessor","resolveSSCholarConfig","PathSpec","RAMIndexCacheStore","ResourceName","PathSpec","RAMIndexCacheStore","ResourceName","_config","DiskResource","norm","RedisResource","S3Resource","GCSResource","OCIResource","R2Resource","SupabaseResource","PostgresResource","MongoDBResource","SlackResource","normalizeSlackConfig","SSHResource","normalizeSshConfig","DiscordResource","normalizeDiscordConfig","TrelloResource","normalizeTrelloConfig","LinearResource","normalizeLinearConfig","LangfuseResource","normalizeLangfuseConfig","GitHubResource","normalizeGitHubConfig","GitHubCIResource","normalizeGitHubCIConfig","GDocsResource","normalizeGDocsConfig","GSheetsResource","normalizeGSheetsConfig","GSlidesResource","normalizeGSlidesConfig","GDriveResource","normalizeGDriveConfig","DropboxResource","normalizeDropboxConfig","BoxResource","normalizeBoxConfig","GmailResource","normalizeGmailConfig","EmailResource","normalizeEmailConfig","ResourceName","createRequire","join","require","stream","ENC","ResourceName","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","fs","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","fs","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","fs","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","catMp3Command","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","catOggCommand","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","catWavCommand","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","grepMp3Command","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","grepOggCommand","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","grepWavCommand","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","headMp3Command","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","headOggCommand","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","headWavCommand","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","statMp3Command","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","statOggCommand","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","statWavCommand","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","tailMp3Command","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","tailOggCommand","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","tailWavCommand","IOResult","command","ResourceName","specOf"]}