@struktoai/mirage-browser 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 (129) hide show
  1. package/README.md +230 -0
  2. package/dist/box-Y2SJWAAO.js +8 -0
  3. package/dist/box-Y2SJWAAO.js.map +1 -0
  4. package/dist/chunk-27UVUTJH.js +126 -0
  5. package/dist/chunk-27UVUTJH.js.map +1 -0
  6. package/dist/chunk-33SBWNB4.js +103 -0
  7. package/dist/chunk-33SBWNB4.js.map +1 -0
  8. package/dist/chunk-3PWPFOPS.js +88 -0
  9. package/dist/chunk-3PWPFOPS.js.map +1 -0
  10. package/dist/chunk-5Q5GJUAF.js +88 -0
  11. package/dist/chunk-5Q5GJUAF.js.map +1 -0
  12. package/dist/chunk-7GZXXXAS.js +24 -0
  13. package/dist/chunk-7GZXXXAS.js.map +1 -0
  14. package/dist/chunk-B4SYG2FD.js +24 -0
  15. package/dist/chunk-B4SYG2FD.js.map +1 -0
  16. package/dist/chunk-BIZONEJC.js +24 -0
  17. package/dist/chunk-BIZONEJC.js.map +1 -0
  18. package/dist/chunk-CQJTW45B.js +92 -0
  19. package/dist/chunk-CQJTW45B.js.map +1 -0
  20. package/dist/chunk-CZOTICOC.js +93 -0
  21. package/dist/chunk-CZOTICOC.js.map +1 -0
  22. package/dist/chunk-DDM2Z7YA.js +94 -0
  23. package/dist/chunk-DDM2Z7YA.js.map +1 -0
  24. package/dist/chunk-DPC7QRYO.js +99 -0
  25. package/dist/chunk-DPC7QRYO.js.map +1 -0
  26. package/dist/chunk-FL7YLP7D.js +107 -0
  27. package/dist/chunk-FL7YLP7D.js.map +1 -0
  28. package/dist/chunk-GFWWDQUZ.js +24 -0
  29. package/dist/chunk-GFWWDQUZ.js.map +1 -0
  30. package/dist/chunk-LG6GVNOL.js +94 -0
  31. package/dist/chunk-LG6GVNOL.js.map +1 -0
  32. package/dist/chunk-LSSB3AEW.js +94 -0
  33. package/dist/chunk-LSSB3AEW.js.map +1 -0
  34. package/dist/chunk-LUDXUYIA.js +89 -0
  35. package/dist/chunk-LUDXUYIA.js.map +1 -0
  36. package/dist/chunk-LZRPA2P7.js +99 -0
  37. package/dist/chunk-LZRPA2P7.js.map +1 -0
  38. package/dist/chunk-ML57VOCK.js +7590 -0
  39. package/dist/chunk-ML57VOCK.js.map +1 -0
  40. package/dist/chunk-MSNVGH6T.js +92 -0
  41. package/dist/chunk-MSNVGH6T.js.map +1 -0
  42. package/dist/chunk-NBWTZXH2.js +27 -0
  43. package/dist/chunk-NBWTZXH2.js.map +1 -0
  44. package/dist/chunk-ONQ5JGPR.js +96 -0
  45. package/dist/chunk-ONQ5JGPR.js.map +1 -0
  46. package/dist/chunk-OPROOV6J.js +24 -0
  47. package/dist/chunk-OPROOV6J.js.map +1 -0
  48. package/dist/chunk-QARIHW3I.js +23 -0
  49. package/dist/chunk-QARIHW3I.js.map +1 -0
  50. package/dist/chunk-QYFCHCGX.js +144 -0
  51. package/dist/chunk-QYFCHCGX.js.map +1 -0
  52. package/dist/chunk-SQQI4A6Y.js +94 -0
  53. package/dist/chunk-SQQI4A6Y.js.map +1 -0
  54. package/dist/chunk-UFXEZ56G.js +79 -0
  55. package/dist/chunk-UFXEZ56G.js.map +1 -0
  56. package/dist/chunk-UW3D2AF6.js +94 -0
  57. package/dist/chunk-UW3D2AF6.js.map +1 -0
  58. package/dist/chunk-UZWJ462U.js +93 -0
  59. package/dist/chunk-UZWJ462U.js.map +1 -0
  60. package/dist/chunk-VLFE4FGD.js +178 -0
  61. package/dist/chunk-VLFE4FGD.js.map +1 -0
  62. package/dist/chunk-XIURBEVZ.js +24 -0
  63. package/dist/chunk-XIURBEVZ.js.map +1 -0
  64. package/dist/chunk-ZJ6ROCTP.js +114 -0
  65. package/dist/chunk-ZJ6ROCTP.js.map +1 -0
  66. package/dist/config-4FABMWVK.js +9 -0
  67. package/dist/config-4FABMWVK.js.map +1 -0
  68. package/dist/config-DGIUMGBB.js +9 -0
  69. package/dist/config-DGIUMGBB.js.map +1 -0
  70. package/dist/config-G3TTNXLY.js +9 -0
  71. package/dist/config-G3TTNXLY.js.map +1 -0
  72. package/dist/config-GPCEEKCB.js +9 -0
  73. package/dist/config-GPCEEKCB.js.map +1 -0
  74. package/dist/config-KQ5VR2KZ.js +9 -0
  75. package/dist/config-KQ5VR2KZ.js.map +1 -0
  76. package/dist/config-LPMMVXLS.js +9 -0
  77. package/dist/config-LPMMVXLS.js.map +1 -0
  78. package/dist/config-U4UI4OKA.js +9 -0
  79. package/dist/config-U4UI4OKA.js.map +1 -0
  80. package/dist/config-VZGK63Z5.js +9 -0
  81. package/dist/config-VZGK63Z5.js.map +1 -0
  82. package/dist/discord-RG6URXXS.js +7 -0
  83. package/dist/discord-RG6URXXS.js.map +1 -0
  84. package/dist/dropbox-P7SOL7GN.js +8 -0
  85. package/dist/dropbox-P7SOL7GN.js.map +1 -0
  86. package/dist/gcs-2QHB4CBT.js +8 -0
  87. package/dist/gcs-2QHB4CBT.js.map +1 -0
  88. package/dist/gdocs-JNZTOZ33.js +8 -0
  89. package/dist/gdocs-JNZTOZ33.js.map +1 -0
  90. package/dist/gdrive-6MEIVN2F.js +8 -0
  91. package/dist/gdrive-6MEIVN2F.js.map +1 -0
  92. package/dist/github-M7WODJR2.js +7 -0
  93. package/dist/github-M7WODJR2.js.map +1 -0
  94. package/dist/github_ci-4XELEFSZ.js +8 -0
  95. package/dist/github_ci-4XELEFSZ.js.map +1 -0
  96. package/dist/gmail-AO6A3URH.js +8 -0
  97. package/dist/gmail-AO6A3URH.js.map +1 -0
  98. package/dist/gsheets-RFOKXMOJ.js +8 -0
  99. package/dist/gsheets-RFOKXMOJ.js.map +1 -0
  100. package/dist/gslides-GTVZPLLB.js +8 -0
  101. package/dist/gslides-GTVZPLLB.js.map +1 -0
  102. package/dist/index.d.ts +1127 -0
  103. package/dist/index.js +743 -0
  104. package/dist/index.js.map +1 -0
  105. package/dist/langfuse-CDOLELMB.js +7 -0
  106. package/dist/langfuse-CDOLELMB.js.map +1 -0
  107. package/dist/linear-SXOQGG6B.js +7 -0
  108. package/dist/linear-SXOQGG6B.js.map +1 -0
  109. package/dist/mongodb-HA7FAKDJ.js +7 -0
  110. package/dist/mongodb-HA7FAKDJ.js.map +1 -0
  111. package/dist/notion-ANZNMM3L.js +7 -0
  112. package/dist/notion-ANZNMM3L.js.map +1 -0
  113. package/dist/oci-ML5ZRVZ2.js +8 -0
  114. package/dist/oci-ML5ZRVZ2.js.map +1 -0
  115. package/dist/opfs-57XFMWWE.js +7 -0
  116. package/dist/opfs-57XFMWWE.js.map +1 -0
  117. package/dist/postgres-CK4HWZSL.js +7 -0
  118. package/dist/postgres-CK4HWZSL.js.map +1 -0
  119. package/dist/r2-56O4Q2J4.js +8 -0
  120. package/dist/r2-56O4Q2J4.js.map +1 -0
  121. package/dist/s3-A4XFE6QV.js +9 -0
  122. package/dist/s3-A4XFE6QV.js.map +1 -0
  123. package/dist/slack-QA7H7WLM.js +7 -0
  124. package/dist/slack-QA7H7WLM.js.map +1 -0
  125. package/dist/supabase-NNK2RWG3.js +8 -0
  126. package/dist/supabase-NNK2RWG3.js.map +1 -0
  127. package/dist/trello-H6PZT2IT.js +7 -0
  128. package/dist/trello-H6PZT2IT.js.map +1 -0
  129. package/package.json +74 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resource/opfs/opfs.ts","../src/accessor/opfs.ts","../src/commands/builtin/opfs/awk.ts","../src/core/opfs/stream.ts","../src/core/opfs/utils.ts","../src/commands/builtin/opfs/base64_cmd.ts","../src/commands/builtin/opfs/basename.ts","../src/commands/builtin/opfs/cat/cat.ts","../src/core/opfs/stat.ts","../src/commands/builtin/opfs/cat/cat_feather.ts","../src/commands/builtin/opfs/cat/cat_hdf5.ts","../src/commands/builtin/opfs/cat/cat_parquet.ts","../src/commands/builtin/opfs/cmp.ts","../src/commands/builtin/opfs/column.ts","../src/commands/builtin/opfs/comm.ts","../src/commands/builtin/opfs/cp.ts","../src/core/opfs/write.ts","../src/core/opfs/read.ts","../src/commands/builtin/opfs/csplit.ts","../src/commands/builtin/opfs/cut/cut.ts","../src/commands/builtin/opfs/cut/cut_feather.ts","../src/commands/builtin/opfs/cut/cut_hdf5.ts","../src/commands/builtin/opfs/cut/cut_parquet.ts","../src/commands/builtin/opfs/diff.ts","../src/commands/builtin/opfs/dirname.ts","../src/commands/builtin/opfs/du.ts","../src/core/opfs/du.ts","../src/commands/builtin/opfs/expand.ts","../src/commands/builtin/opfs/file/file.ts","../src/commands/builtin/opfs/file/file_feather.ts","../src/commands/builtin/opfs/file/file_hdf5.ts","../src/commands/builtin/opfs/file/file_parquet.ts","../src/commands/builtin/opfs/find.ts","../src/core/opfs/find.ts","../src/commands/builtin/opfs/fmt.ts","../src/commands/builtin/opfs/fold.ts","../src/commands/builtin/opfs/grep/grep.ts","../src/commands/builtin/opfs/grep/grep_feather.ts","../src/commands/builtin/opfs/grep/grep_hdf5.ts","../src/commands/builtin/opfs/grep/grep_parquet.ts","../src/commands/builtin/opfs/gunzip.ts","../src/core/opfs/unlink.ts","../src/commands/builtin/opfs/gzip.ts","../src/commands/builtin/opfs/head/head.ts","../src/commands/builtin/opfs/head/head_feather.ts","../src/commands/builtin/opfs/head/head_hdf5.ts","../src/commands/builtin/opfs/head/head_parquet.ts","../src/commands/builtin/opfs/iconv.ts","../src/commands/builtin/opfs/join.ts","../src/commands/builtin/opfs/jq.ts","../src/commands/builtin/opfs/ln.ts","../src/core/opfs/exists.ts","../src/commands/builtin/opfs/look.ts","../src/commands/builtin/opfs/ls/ls.ts","../src/core/opfs/readdir.ts","../src/commands/builtin/opfs/ls/ls_feather.ts","../src/commands/builtin/opfs/ls/ls_hdf5.ts","../src/commands/builtin/opfs/ls/ls_parquet.ts","../src/commands/builtin/opfs/md5.ts","../src/commands/builtin/opfs/mkdir.ts","../src/core/opfs/mkdir.ts","../src/commands/builtin/opfs/mktemp.ts","../src/commands/builtin/opfs/mv.ts","../src/core/opfs/rename.ts","../src/commands/builtin/opfs/nl.ts","../src/commands/builtin/opfs/paste.ts","../src/commands/builtin/opfs/patch.ts","../src/commands/builtin/opfs/readlink.ts","../src/commands/builtin/opfs/realpath.ts","../src/commands/builtin/opfs/rev.ts","../src/commands/builtin/opfs/rg.ts","../src/commands/builtin/opfs/rm.ts","../src/core/opfs/rmdir.ts","../src/core/opfs/rm.ts","../src/commands/builtin/opfs/sed.ts","../src/commands/builtin/opfs/sha256sum.ts","../src/commands/builtin/opfs/shuf.ts","../src/commands/builtin/opfs/sort.ts","../src/commands/builtin/opfs/split.ts","../src/commands/builtin/opfs/stat/stat.ts","../src/commands/builtin/opfs/stat/stat_feather.ts","../src/commands/builtin/opfs/stat/stat_hdf5.ts","../src/commands/builtin/opfs/stat/stat_parquet.ts","../src/commands/builtin/opfs/strings.ts","../src/commands/builtin/opfs/tac.ts","../src/commands/builtin/opfs/tail/tail.ts","../src/commands/builtin/opfs/tail/tail_feather.ts","../src/commands/builtin/opfs/tail/tail_hdf5.ts","../src/commands/builtin/opfs/tail/tail_parquet.ts","../src/commands/builtin/opfs/tar.ts","../src/commands/builtin/opfs/tee.ts","../src/commands/builtin/opfs/touch.ts","../src/commands/builtin/opfs/tr.ts","../src/commands/builtin/opfs/tree.ts","../src/commands/builtin/opfs/tsort.ts","../src/commands/builtin/opfs/unexpand.ts","../src/commands/builtin/opfs/uniq.ts","../src/commands/builtin/opfs/unzip.ts","../src/commands/builtin/opfs/wc/wc.ts","../src/commands/builtin/opfs/wc/wc_feather.ts","../src/commands/builtin/opfs/wc/wc_hdf5.ts","../src/commands/builtin/opfs/wc/wc_parquet.ts","../src/commands/builtin/opfs/xxd.ts","../src/commands/builtin/opfs/zcat.ts","../src/commands/builtin/opfs/zgrep.ts","../src/commands/builtin/opfs/zip_cmd.ts","../src/commands/builtin/opfs/index.ts","../src/core/opfs/append.ts","../src/core/opfs/copy.ts","../src/core/opfs/glob.ts","../src/core/opfs/constants.ts","../src/core/opfs/truncate.ts","../src/ops/opfs/append.ts","../src/ops/opfs/create.ts","../src/core/opfs/create.ts","../src/ops/opfs/mkdir.ts","../src/ops/opfs/read.ts","../src/ops/opfs/readdir.ts","../src/ops/opfs/rename.ts","../src/ops/opfs/rmdir.ts","../src/ops/opfs/stat.ts","../src/ops/opfs/truncate.ts","../src/ops/opfs/unlink.ts","../src/ops/opfs/write.ts","../src/ops/opfs/index.ts","../src/resource/opfs/prompt.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type FileStat,\n type FindOptions,\n type PathSpec,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n} from '@struktoai/mirage-core'\nimport { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { OPFS_COMMANDS } from '../../commands/builtin/opfs/index.ts'\nimport { appendBytes as appendCore } from '../../core/opfs/append.ts'\nimport { copy as copyCore } from '../../core/opfs/copy.ts'\nimport { du as duCore } from '../../core/opfs/du.ts'\nimport { exists as existsCore } from '../../core/opfs/exists.ts'\nimport { find as findCore, type FindOptions as OPFSFindOptions } from '../../core/opfs/find.ts'\nimport { resolveGlob as globCore } from '../../core/opfs/glob.ts'\nimport { mkdir as mkdirCore } from '../../core/opfs/mkdir.ts'\nimport { read as readCoreFn } from '../../core/opfs/read.ts'\nimport { readdir as readdirCore } from '../../core/opfs/readdir.ts'\nimport { rename as renameCore } from '../../core/opfs/rename.ts'\nimport { rmR as rmRCore } from '../../core/opfs/rm.ts'\nimport { rmdir as rmdirCore } from '../../core/opfs/rmdir.ts'\nimport { stat as statCore } from '../../core/opfs/stat.ts'\nimport { stream as streamCore } from '../../core/opfs/stream.ts'\nimport { truncate as truncateCore } from '../../core/opfs/truncate.ts'\nimport { unlink as unlinkCore } from '../../core/opfs/unlink.ts'\nimport { iterEntries, toWritableChunk } from '../../core/opfs/utils.ts'\nimport { writeBytes as writeCore } from '../../core/opfs/write.ts'\nimport { OPFS_OPS } from '../../ops/opfs/index.ts'\nimport { OPFS_PROMPT } from './prompt.ts'\n\nexport interface OPFSResourceOptions {\n root?: string\n}\n\nexport interface OPFSResourceState {\n type: string\n needsOverride: boolean\n files: Record<string, Uint8Array>\n dirs: string[]\n}\n\nasync function walkFiles(\n dir: FileSystemDirectoryHandle,\n currentPath: string,\n files: Record<string, Uint8Array>,\n): Promise<void> {\n for await (const [name, handle] of iterEntries(dir)) {\n const childPath = currentPath === '' ? name : `${currentPath}/${name}`\n if (handle.kind === 'file') {\n const fh = await dir.getFileHandle(name, { create: false })\n const file = await fh.getFile()\n files[childPath] = new Uint8Array(await file.arrayBuffer())\n } else {\n const child = await dir.getDirectoryHandle(name, { create: false })\n await walkFiles(child, childPath, files)\n }\n }\n}\n\nasync function walkDirs(\n dir: FileSystemDirectoryHandle,\n currentPath: string,\n dirs: string[],\n): Promise<void> {\n for await (const [name, handle] of iterEntries(dir)) {\n if (handle.kind !== 'directory') continue\n const childPath = currentPath === '' ? `/${name}` : `${currentPath}/${name}`\n dirs.push(childPath)\n const child = await dir.getDirectoryHandle(name, { create: false })\n await walkDirs(child, childPath, dirs)\n }\n}\n\nasync function splitAndCreate(\n root: FileSystemDirectoryHandle,\n relativePath: string,\n): Promise<FileSystemDirectoryHandle> {\n let handle = root\n for (const seg of relativePath.split('/')) {\n if (seg === '' || seg === '.') continue\n handle = await handle.getDirectoryHandle(seg, { create: true })\n }\n return handle\n}\n\nexport class OPFSResource implements Resource {\n readonly kind = ResourceName.OPFS\n readonly prompt = OPFS_PROMPT\n readonly rootName: string\n readonly accessor: OPFSAccessor\n private rootHandle: FileSystemDirectoryHandle | null = null\n private openPromise: Promise<FileSystemDirectoryHandle> | null = null\n\n constructor(options: OPFSResourceOptions = {}) {\n this.rootName = options.root ?? ''\n this.accessor = new OPFSAccessor(this)\n }\n\n open(): Promise<void> {\n return this.ensureOpen().then(() => undefined)\n }\n\n close(): Promise<void> {\n this.rootHandle = null\n this.openPromise = null\n return Promise.resolve()\n }\n\n /**\n * Lazily resolve to a usable root handle. Memoizes `navigator.storage`\n * traversal so the resource self-initializes on first method call without\n * relying on an external orchestrator.\n */\n private ensureOpen(): Promise<FileSystemDirectoryHandle> {\n if (this.rootHandle !== null) return Promise.resolve(this.rootHandle)\n this.openPromise ??= (async () => {\n const origin = await navigator.storage.getDirectory()\n let handle = origin\n for (const seg of this.rootName.split('/')) {\n if (seg === '' || seg === '.') continue\n handle = await handle.getDirectoryHandle(seg, { create: true })\n }\n this.rootHandle = handle\n return handle\n })()\n return this.openPromise\n }\n\n requireHandle(): FileSystemDirectoryHandle {\n if (this.rootHandle === null) {\n throw new Error('OPFSResource is not open — call open() first')\n }\n return this.rootHandle\n }\n\n ops(): readonly RegisteredOp[] {\n return OPFS_OPS\n }\n\n commands(): readonly RegisteredCommand[] {\n return OPFS_COMMANDS\n }\n\n async *streamPath(p: PathSpec): AsyncIterable<Uint8Array> {\n yield* streamCore(await this.ensureOpen(), p)\n }\n\n async readFile(p: PathSpec): Promise<Uint8Array> {\n return readCoreFn(await this.ensureOpen(), p)\n }\n\n async writeFile(p: PathSpec, data: Uint8Array): Promise<void> {\n return writeCore(await this.ensureOpen(), p, data)\n }\n\n async appendFile(p: PathSpec, data: Uint8Array): Promise<void> {\n return appendCore(await this.ensureOpen(), p, data)\n }\n\n async readdir(p: PathSpec): Promise<string[]> {\n return readdirCore(await this.ensureOpen(), p)\n }\n\n async stat(p: PathSpec): Promise<FileStat> {\n return statCore(await this.ensureOpen(), p)\n }\n\n async exists(p: PathSpec): Promise<boolean> {\n return existsCore(await this.ensureOpen(), p)\n }\n\n async mkdir(p: PathSpec, options?: { recursive?: boolean }): Promise<void> {\n return mkdirCore(await this.ensureOpen(), p, options?.recursive === true)\n }\n\n async rmdir(p: PathSpec): Promise<void> {\n return rmdirCore(await this.ensureOpen(), p)\n }\n\n async unlink(p: PathSpec): Promise<void> {\n return unlinkCore(await this.ensureOpen(), p)\n }\n\n async rename(src: PathSpec, dst: PathSpec): Promise<void> {\n return renameCore(await this.ensureOpen(), src, dst)\n }\n\n async truncate(p: PathSpec, length: number): Promise<void> {\n return truncateCore(await this.ensureOpen(), p, length)\n }\n\n async copy(src: PathSpec, dst: PathSpec): Promise<void> {\n return copyCore(await this.ensureOpen(), src, dst)\n }\n\n async rmR(p: PathSpec): Promise<void> {\n return rmRCore(await this.ensureOpen(), p)\n }\n\n async du(p: PathSpec): Promise<number> {\n return duCore(await this.ensureOpen(), p)\n }\n\n async find(p: PathSpec, options: FindOptions = {}): Promise<string[]> {\n return findCore(await this.ensureOpen(), p, options as OPFSFindOptions)\n }\n\n async glob(paths: readonly PathSpec[]): Promise<PathSpec[]> {\n return globCore(await this.ensureOpen(), paths)\n }\n\n async getState(): Promise<OPFSResourceState> {\n const handle = await this.ensureOpen()\n const files: Record<string, Uint8Array> = {}\n await walkFiles(handle, '', files)\n const dirs: string[] = []\n await walkDirs(handle, '', dirs)\n dirs.sort()\n return {\n type: this.kind,\n needsOverride: false,\n files,\n dirs,\n }\n }\n\n async loadState(state: OPFSResourceState): Promise<void> {\n const handle = await this.ensureOpen()\n for (const dir of state.dirs) {\n const rel = dir.replace(/^\\/+/, '')\n if (rel === '') continue\n await splitAndCreate(handle, rel)\n }\n for (const [rel, data] of Object.entries(state.files)) {\n const segs = rel.split('/').filter((s) => s !== '' && s !== '.')\n const fileName = segs.pop()\n if (fileName === undefined) continue\n let dir = handle\n for (const seg of segs) {\n dir = await dir.getDirectoryHandle(seg, { create: true })\n }\n const fh = await dir.getFileHandle(fileName, { create: true })\n const writable = await fh.createWritable()\n await writable.write(toWritableChunk(data))\n await writable.close()\n }\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { Accessor } from '@struktoai/mirage-core'\n\nexport interface OPFSHandleProvider {\n requireHandle(): FileSystemDirectoryHandle\n}\n\nexport class OPFSAccessor extends Accessor {\n private readonly provider: OPFSHandleProvider\n\n constructor(provider: OPFSHandleProvider) {\n super()\n this.provider = provider\n }\n\n get rootHandle(): FileSystemDirectoryHandle {\n return this.provider.requireHandle()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n materialize,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction escapeRegex(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\nfunction splitFields(line: string, fs: string): string[] {\n if (fs === '') return line.split(/\\s+/).filter((s) => s !== '')\n const re = fs.length === 1 ? new RegExp(escapeRegex(fs)) : new RegExp(fs)\n return line.split(re)\n}\n\nfunction parseProgram(program: string): [string, string] {\n const trimmed = program.trim()\n if (trimmed.startsWith('{')) return ['', trimmed.slice(1).replace(/\\}$/, '')]\n if (trimmed.includes('{')) {\n const idx = trimmed.indexOf('{')\n const condition = trimmed.slice(0, idx).trim()\n const action = trimmed\n .slice(idx + 1)\n .replace(/\\}$/, '')\n .trim()\n return [condition, action]\n }\n return ['', trimmed]\n}\n\nfunction evalCondition(condition: string, fieldMap: Record<string, string>): boolean {\n const cond = condition.trim()\n if (cond === 'BEGIN' || cond === 'END') return false\n const patterns = [\n /(\\$\\d+|NR|NF)\\s*==\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*!=\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*>\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*<\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*>=\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*<=\\s*(.+)/,\n ]\n for (const pat of patterns) {\n const m = pat.exec(cond)\n if (m !== null) {\n const lhsKey = m[1] ?? ''\n const rhsRaw = (m[2] ?? '').trim().replace(/^\"|\"$/g, '')\n const lhs = fieldMap[lhsKey] ?? ''\n const opMatch = /(==|!=|>=|<=|>|<)/.exec(cond)\n const op = opMatch !== null ? opMatch[1] : ''\n const lhsNum = Number.parseFloat(lhs)\n const rhsNum = Number.parseFloat(rhsRaw)\n if (!Number.isNaN(lhsNum) && !Number.isNaN(rhsNum)) {\n if (op === '==') return lhsNum === rhsNum\n if (op === '!=') return lhsNum !== rhsNum\n if (op === '>') return lhsNum > rhsNum\n if (op === '<') return lhsNum < rhsNum\n if (op === '>=') return lhsNum >= rhsNum\n if (op === '<=') return lhsNum <= rhsNum\n }\n if (op === '==') return lhs === rhsRaw\n if (op === '!=') return lhs !== rhsRaw\n return false\n }\n }\n if (cond.startsWith('/') && cond.endsWith('/')) {\n return new RegExp(cond.slice(1, -1)).test(fieldMap.$0 ?? '')\n }\n return true\n}\n\nfunction evalAction(action: string, fieldMap: Record<string, string>): string {\n const parts: string[] = []\n for (const rawStmt of action.split(';')) {\n const stmt = rawStmt.trim()\n if (stmt === '') continue\n if (stmt.startsWith('print')) {\n const args = stmt.slice(5).trim()\n if (args === '') {\n parts.push(fieldMap.$0 ?? '')\n } else {\n const tokens = args.split(/,\\s*/)\n const vals: string[] = []\n for (const raw of tokens) {\n const tok = raw.trim().replace(/^\"|\"$/g, '')\n vals.push(fieldMap[tok] ?? tok)\n }\n parts.push(vals.join(' '))\n }\n }\n }\n return parts.join('\\n')\n}\n\nfunction awkEvalLine(\n line: string,\n program: string,\n fs: string,\n variables: Record<string, string>,\n nr: number,\n): string | null {\n const fields = splitFields(line, fs)\n const fieldMap: Record<string, string> = {\n $0: line,\n NR: String(nr),\n NF: String(fields.length),\n }\n for (let i = 0; i < fields.length; i++) fieldMap[`$${String(i + 1)}`] = fields[i] ?? ''\n for (const [k, v] of Object.entries(variables)) fieldMap[k] = v\n const [condition, action] = parseProgram(program)\n if (condition !== '' && !evalCondition(condition, fieldMap)) return null\n if (action === '') return line\n return evalAction(action, fieldMap)\n}\n\nfunction parseBlocks(program: string): [string, string, string] {\n let begin = ''\n let end = ''\n let main = program\n const beginMatch = /^BEGIN\\s*\\{([^}]*)\\}\\s*([\\s\\S]*)/.exec(program)\n if (beginMatch !== null) {\n begin = (beginMatch[1] ?? '').trim()\n main = (beginMatch[2] ?? '').trim()\n }\n const endMatch = /END\\s*\\{([^}]*)\\}\\s*$/.exec(main)\n if (endMatch !== null) {\n end = (endMatch[1] ?? '').trim()\n main = main.slice(0, endMatch.index).trim()\n }\n return [begin, main, end]\n}\n\nfunction evalAccumulator(\n action: string,\n fieldMap: Record<string, string>,\n accum: Record<string, number>,\n): void {\n for (const rawStmt of action.split(';')) {\n const stmt = rawStmt.trim()\n const m = /(\\w+)\\s*\\+=\\s*(.+)/.exec(stmt)\n if (m !== null) {\n const variable = m[1] ?? ''\n const expr = (m[2] ?? '').trim()\n const val = fieldMap[expr] ?? expr\n const n = Number.parseFloat(val)\n if (!Number.isNaN(n)) accum[variable] = (accum[variable] ?? 0) + n\n }\n }\n}\n\nfunction evalEndAction(action: string, accum: Record<string, number>): string {\n const parts: string[] = []\n for (const rawStmt of action.split(';')) {\n const stmt = rawStmt.trim()\n if (!stmt.startsWith('print')) continue\n const args = stmt.slice(5).trim()\n if (args === '') continue\n const tokens = args.split(/,\\s*/)\n const vals: string[] = []\n for (const raw of tokens) {\n const tok = raw.trim().replace(/^\"|\"$/g, '')\n if (tok in accum) {\n const v = accum[tok] ?? 0\n vals.push(Number.isInteger(v) ? String(v) : String(v))\n } else {\n vals.push(tok)\n }\n }\n parts.push(vals.join(' '))\n }\n return parts.join('\\n')\n}\n\nasync function* awkStream(\n source: AsyncIterable<Uint8Array>,\n program: string,\n fs: string,\n variables: Record<string, string>,\n): AsyncIterable<Uint8Array> {\n const [, main, end] = parseBlocks(program)\n const accum: Record<string, number> = {}\n let nr = 0\n const iter = new AsyncLineIterator(source)\n for await (const lineBytes of iter) {\n nr += 1\n const line = DEC.decode(lineBytes)\n if (main !== '') {\n const fields = splitFields(line, fs)\n const fieldMap: Record<string, string> = {\n $0: line,\n NR: String(nr),\n NF: String(fields.length),\n }\n for (let i = 0; i < fields.length; i++) fieldMap[`$${String(i + 1)}`] = fields[i] ?? ''\n const [condition, action] = parseProgram(main)\n if (condition !== '' && !evalCondition(condition, fieldMap)) continue\n evalAccumulator(action, fieldMap, accum)\n const result = awkEvalLine(line, main, fs, variables, nr)\n if (result !== null && result !== '') yield ENC.encode(result + '\\n')\n }\n }\n if (end !== '') {\n const result = evalEndAction(end, accum)\n if (result !== '') yield ENC.encode(result + '\\n')\n }\n}\n\nfunction stripMount(virtualPath: string, prefix: string): string {\n if (prefix !== '' && virtualPath.startsWith(prefix + '/')) {\n return '/' + virtualPath.slice(prefix.length).replace(/^\\/+/, '')\n }\n return virtualPath\n}\n\nasync function readFile(accessor: OPFSAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(opfsStream(accessor.rootHandle, p))\n}\n\nasync function awkCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const fFlag = typeof opts.flags.f === 'string' ? opts.flags.f : null\n let program: string\n let dataPaths: string[]\n if (fFlag !== null) {\n const programPath = fFlag\n const programSpec: PathSpec = { original: programPath, stripPrefix: programPath } as PathSpec\n try {\n program = DEC.decode(await readFile(accessor, programSpec)).trim()\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const mountPrefix = paths[0]?.prefix ?? ''\n dataPaths = [\n ...texts.map((t) => stripMount(t, mountPrefix)),\n ...paths.map((p) => p.stripPrefix),\n ]\n } else if (texts.length > 0 && texts[0] !== undefined) {\n program = texts[0]\n dataPaths = paths.map((p) => p.stripPrefix)\n } else {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`awk: usage: awk [-F fs] [-v var=val] 'program' [file ...]\\n`),\n }),\n ]\n }\n const fs = typeof opts.flags.F === 'string' ? opts.flags.F : ' '\n const variables: Record<string, string> = {}\n if (typeof opts.flags.v === 'string' && opts.flags.v.includes('=')) {\n const [key, val] = opts.flags.v.split('=', 2)\n if (key !== undefined && val !== undefined) variables[key] = val\n }\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (dataPaths.length > 0) {\n const firstPath = dataPaths[0]\n if (firstPath === undefined) return [null, new IOResult()]\n const spec: PathSpec = { original: firstPath, stripPrefix: firstPath } as PathSpec\n source = opfsStream(accessor.rootHandle, spec)\n cache.push(firstPath)\n } else {\n try {\n source = resolveSource(opts.stdin, 'awk: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n return [awkStream(source, program, fs, variables), new IOResult({ cache })]\n}\n\nexport const OPFS_AWK = command({\n name: 'awk',\n resource: ResourceName.OPFS,\n spec: specOf('awk'),\n fn: awkCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { type PathSpec, recordStream, ResourceName } from '@struktoai/mirage-core'\nimport { isNotFound, resolveFileHandle } from './utils.ts'\n\nexport async function* stream(\n root: FileSystemDirectoryHandle,\n path: PathSpec,\n): AsyncIterable<Uint8Array> {\n const virtual = path.stripPrefix\n let handle: FileSystemFileHandle\n try {\n handle = await resolveFileHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) throw new Error(`file not found: ${virtual}`)\n throw err\n }\n const file = await handle.getFile()\n const rec = recordStream('read', virtual, ResourceName.OPFS)\n const reader = file.stream().getReader()\n for (;;) {\n const { value, done } = await reader.read()\n if (done) break\n if (rec !== null) rec.bytes += value.byteLength\n yield value\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport function norm(p: string): string {\n return `/${p.replace(/^\\/+|\\/+$/g, '')}`\n}\n\nexport function parent(p: string): string {\n const i = p.lastIndexOf('/')\n if (i <= 0) return '/'\n return p.slice(0, i)\n}\n\nexport function basename(p: string): string {\n const tail = p.split('/').pop()\n return tail !== undefined && tail.length > 0 ? tail : '/'\n}\n\nexport function dirname(p: string): string {\n const i = p.lastIndexOf('/')\n if (i < 0) return ''\n if (i === 0) return '/'\n return p.slice(0, i)\n}\n\nexport function splitSegments(virtual: string): string[] {\n const parts: string[] = []\n for (const seg of virtual.split('/')) {\n if (seg === '' || seg === '.') continue\n if (seg === '..') {\n if (parts.length === 0) {\n throw new Error(`path escapes root: ${virtual}`)\n }\n parts.pop()\n continue\n }\n parts.push(seg)\n }\n return parts\n}\n\nexport async function resolveDirHandle(\n root: FileSystemDirectoryHandle,\n virtual: string,\n options: { create?: boolean } = {},\n): Promise<FileSystemDirectoryHandle> {\n const segs = splitSegments(virtual)\n let handle = root\n for (const seg of segs) {\n handle = await handle.getDirectoryHandle(seg, { create: options.create ?? false })\n }\n return handle\n}\n\nexport async function resolveFileHandle(\n root: FileSystemDirectoryHandle,\n virtual: string,\n options: { create?: boolean } = {},\n): Promise<FileSystemFileHandle> {\n const segs = splitSegments(virtual)\n const fileName = segs.pop()\n if (fileName === undefined) {\n throw new Error(`not a file: ${virtual}`)\n }\n let dir = root\n for (const seg of segs) {\n dir = await dir.getDirectoryHandle(seg, { create: options.create ?? false })\n }\n return dir.getFileHandle(fileName, { create: options.create ?? false })\n}\n\nexport async function resolveParentDirHandle(\n root: FileSystemDirectoryHandle,\n virtual: string,\n options: { create?: boolean } = {},\n): Promise<[FileSystemDirectoryHandle, string]> {\n const segs = splitSegments(virtual)\n const name = segs.pop()\n if (name === undefined) {\n throw new Error(`no parent directory: ${virtual}`)\n }\n let dir = root\n for (const seg of segs) {\n dir = await dir.getDirectoryHandle(seg, { create: options.create ?? false })\n }\n return [dir, name]\n}\n\nexport function isNotFound(err: unknown): boolean {\n if (err instanceof DOMException) {\n return err.name === 'NotFoundError'\n }\n return false\n}\n\nexport function isTypeMismatch(err: unknown): boolean {\n if (err instanceof DOMException) {\n return err.name === 'TypeMismatchError'\n }\n return false\n}\n\ninterface DirEntryIter {\n entries(): AsyncIterableIterator<[string, FileSystemHandle]>\n}\n\nexport function toWritableChunk(data: Uint8Array): Blob {\n const copy = new Uint8Array(data.byteLength)\n copy.set(data)\n return new Blob([copy])\n}\n\nexport async function* iterEntries(\n dir: FileSystemDirectoryHandle,\n): AsyncIterable<[string, FileSystemHandle]> {\n const iter = (dir as unknown as DirEntryIter).entries()\n for await (const [name, handle] of iter) {\n yield [name, handle]\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n decodeBase64,\n encodeBase64,\n materialize,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nasync function* base64EncodeStream(\n source: AsyncIterable<Uint8Array>,\n wrap: number | null,\n): AsyncIterable<Uint8Array> {\n const buf = await materialize(source)\n const encoded = encodeBase64(buf)\n if (wrap !== null && wrap === 0) {\n yield ENC.encode(encoded + '\\n')\n return\n }\n const lineLen = wrap ?? 76\n const lines: string[] = []\n for (let i = 0; i < encoded.length; i += lineLen) {\n lines.push(encoded.slice(i, i + lineLen))\n }\n yield ENC.encode(lines.join('\\n') + '\\n')\n}\n\nasync function* base64DecodeStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n const buf = await materialize(source)\n const text = DEC.decode(buf).replace(/[\\r\\n ]/g, '')\n yield decodeBase64(text)\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function base64Command(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const decode = opts.flags.d === true || opts.flags.D === true\n const wrap = typeof opts.flags.w === 'string' ? Number.parseInt(opts.flags.w, 10) : null\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = opfsStream(accessor.rootHandle, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'base64: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n const out = decode ? base64DecodeStream(source) : base64EncodeStream(source, wrap)\n return [out, new IOResult({ cache })]\n}\n\nexport const RAM_BASE64 = command({\n name: 'base64',\n resource: ResourceName.OPFS,\n spec: specOf('base64'),\n fn: base64Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type Accessor,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\n\nfunction basenameCommand(\n _accessor: Accessor,\n paths: PathSpec[],\n texts: string[],\n _opts: CommandOpts,\n): CommandFnResult {\n const arg = texts[0] ?? paths[0]?.original ?? ''\n const stripped = arg.replace(/\\/+$/, '')\n const idx = stripped.lastIndexOf('/')\n const base = idx >= 0 ? stripped.slice(idx + 1) : stripped\n const out: ByteSource = new TextEncoder().encode(`${base}\\n`)\n return [out, new IOResult()]\n}\n\nexport const OPFS_BASENAME = command({\n name: 'basename',\n resource: ResourceName.OPFS,\n spec: specOf('basename'),\n fn: basenameCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n CachableAsyncIterator,\n IOResult,\n ProvisionResult,\n ResourceName,\n command,\n concatAggregate,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport { stat as opfsStat } from '../../../../core/opfs/stat.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function* numberLinesStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n let num = 1\n const lineIter = new AsyncLineIterator(source)\n for await (const line of lineIter) {\n yield ENC.encode(` ${String(num)}\\t`)\n yield line\n yield ENC.encode('\\n')\n num += 1\n }\n}\n\nexport async function catProvision(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<ProvisionResult> {\n const [first] = paths\n if (first === undefined) return new ProvisionResult({ command: 'cat' })\n try {\n const s = await opfsStat(accessor.rootHandle, first)\n return new ProvisionResult({\n command: `cat ${first.original}`,\n networkReadLow: s.size ?? 0,\n networkReadHigh: s.size ?? 0,\n readOps: 1,\n })\n } catch {\n return new ProvisionResult({ command: 'cat' })\n }\n}\n\nasync function* chainStreams(\n streams: readonly AsyncIterable<Uint8Array>[],\n): AsyncIterable<Uint8Array> {\n for (const s of streams) {\n for await (const chunk of s) yield chunk\n }\n}\n\nasync function catCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nFlag = opts.flags.n === true\n if (paths.length > 0) {\n for (const p of paths) await opfsStat(accessor.rootHandle, p)\n const reads: Record<string, ByteSource> = {}\n const cacheKeys: string[] = []\n const outputs: AsyncIterable<Uint8Array>[] = []\n for (const p of paths) {\n const cachable = new CachableAsyncIterator(opfsStream(accessor.rootHandle, p))\n reads[p.stripPrefix] = cachable\n cacheKeys.push(p.stripPrefix)\n outputs.push(cachable)\n }\n const merged = chainStreams(outputs)\n const out: ByteSource = nFlag ? numberLinesStream(merged) : merged\n return [out, new IOResult({ reads, cache: cacheKeys })]\n }\n try {\n const source = resolveSource(opts.stdin, 'cat: missing operand')\n const out: ByteSource = nFlag ? numberLinesStream(source) : source\n return [out, new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const OPFS_CAT = command({\n name: 'cat',\n resource: ResourceName.OPFS,\n spec: specOf('cat'),\n fn: catCommand,\n provision: catProvision,\n aggregate: concatAggregate,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { FileStat, FileType, guessType, type PathSpec } from '@struktoai/mirage-core'\nimport { isNotFound, resolveDirHandle, resolveParentDirHandle, splitSegments } from './utils.ts'\n\nexport async function stat(root: FileSystemDirectoryHandle, p: PathSpec): Promise<FileStat> {\n const virtual = p.stripPrefix\n const segs = splitSegments(virtual)\n const last = segs.at(-1)\n if (last === undefined) {\n return new FileStat({\n name: '/',\n size: null,\n modified: null,\n type: FileType.DIRECTORY,\n })\n }\n const name = last\n let parentDir: FileSystemDirectoryHandle\n let entryName: string\n try {\n ;[parentDir, entryName] = await resolveParentDirHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) throw new Error(`file not found: ${virtual}`)\n throw err\n }\n try {\n const fileHandle = await parentDir.getFileHandle(entryName, { create: false })\n const file = await fileHandle.getFile()\n const modified = new Date(file.lastModified).toISOString()\n return new FileStat({\n name,\n size: file.size,\n modified,\n fingerprint: modified,\n type: guessType(name),\n })\n } catch (err) {\n if (!isNotFound(err) && !(err instanceof DOMException && err.name === 'TypeMismatchError')) {\n throw err\n }\n }\n try {\n await resolveDirHandle(root, virtual, { create: false })\n return new FileStat({\n name,\n size: null,\n modified: null,\n type: FileType.DIRECTORY,\n })\n } catch (err) {\n if (isNotFound(err)) throw new Error(`file not found: ${virtual}`)\n throw err\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n featherCat,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function catFeatherCommand(\n accessor: OPFSAccessor,\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(opfsStream(accessor.rootHandle, first))\n const result = featherCat(raw)\n const out: ByteSource = result\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_CAT_FEATHER = command({\n name: 'cat',\n resource: ResourceName.OPFS,\n spec: specOf('cat'),\n filetype: '.feather',\n fn: catFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n hdf5Cat,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function catHdf5Command(\n accessor: OPFSAccessor,\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(opfsStream(accessor.rootHandle, first))\n const result = await hdf5Cat(raw)\n const out: ByteSource = result\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_CAT_HDF5 = command({\n name: 'cat',\n resource: ResourceName.OPFS,\n spec: specOf('cat'),\n filetype: '.h5',\n fn: catHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n parquetCat,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function catParquetCommand(\n accessor: OPFSAccessor,\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(opfsStream(accessor.rootHandle, first))\n const result = await parquetCat(raw)\n const out: ByteSource = result\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_CAT_PARQUET = command({\n name: 'cat',\n resource: ResourceName.OPFS,\n spec: specOf('cat'),\n filetype: '.parquet',\n fn: catParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nfunction octal(n: number): string {\n return '0o' + n.toString(8)\n}\n\nfunction arraysEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.byteLength !== b.byteLength) return false\n for (let i = 0; i < a.byteLength; i++) if (a[i] !== b[i]) return false\n return true\n}\n\nasync function cmpCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [null, new IOResult({ exitCode: 2, stderr: ENC.encode('cmp: requires two paths\\n') })]\n }\n const p0 = paths[0]\n const p1 = paths[1]\n if (p0 === undefined || p1 === undefined) return [null, new IOResult()]\n let data1 = await materialize(opfsStream(accessor.rootHandle, p0))\n let data2 = await materialize(opfsStream(accessor.rootHandle, p1))\n if (typeof opts.flags.i === 'string') {\n const skip = Number.parseInt(opts.flags.i, 10)\n data1 = data1.slice(skip)\n data2 = data2.slice(skip)\n }\n if (typeof opts.flags.n === 'string') {\n const limit = Number.parseInt(opts.flags.n, 10)\n data1 = data1.slice(0, limit)\n data2 = data2.slice(0, limit)\n }\n if (arraysEqual(data1, data2)) return [null, new IOResult()]\n if (opts.flags.s === true) return [null, new IOResult({ exitCode: 1 })]\n if (opts.flags.args_l === true) {\n const outLines: string[] = []\n const limit = Math.min(data1.byteLength, data2.byteLength)\n for (let idx = 0; idx < limit; idx++) {\n if (data1[idx] !== data2[idx]) {\n outLines.push(`${String(idx + 1)} ${octal(data1[idx] ?? 0)} ${octal(data2[idx] ?? 0)}`)\n }\n }\n const out: ByteSource = ENC.encode(outLines.join('\\n'))\n return [out, new IOResult({ exitCode: 1 })]\n }\n const limit = Math.min(data1.byteLength, data2.byteLength)\n for (let idx = 0; idx < limit; idx++) {\n if (data1[idx] !== data2[idx]) {\n let line = 1\n for (let k = 0; k < idx; k++) if (data1[k] === 0x0a) line += 1\n let msg = `${p0.original} ${p1.original} differ: byte ${String(idx + 1)}, line ${String(line)}`\n if (opts.flags.b === true) {\n msg += ` is ${octal(data1[idx] ?? 0)} ${String.fromCharCode(data1[idx] ?? 0)} ${octal(data2[idx] ?? 0)} ${String.fromCharCode(data2[idx] ?? 0)}`\n }\n return [ENC.encode(msg), new IOResult({ exitCode: 1 })]\n }\n }\n const shorter = data1.byteLength < data2.byteLength ? p0 : p1\n return [ENC.encode(`cmp: EOF on ${shorter.original}`), new IOResult({ exitCode: 1 })]\n}\n\nexport const OPFS_CMP = command({\n name: 'cmp',\n resource: ResourceName.OPFS,\n spec: specOf('cmp'),\n fn: cmpCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction padRight(s: string, width: number): string {\n if (s.length >= width) return s\n return s + ' '.repeat(width - s.length)\n}\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction tableFormat(text: string, separator: string | null, outputSep: string): string {\n const lines = splitLinesNoTrailing(text)\n if (lines.length === 0) return ''\n const rows: string[][] = []\n for (const line of lines) {\n if (separator !== null && separator !== '') {\n rows.push(line.split(separator))\n } else {\n rows.push(line.split(/\\s+/).filter((s) => s !== ''))\n }\n }\n if (rows.length === 0) return ''\n let maxCols = 0\n for (const r of rows) {\n if (r.length > maxCols) maxCols = r.length\n }\n const widths = new Array(maxCols).fill(0) as number[]\n for (const row of rows) {\n for (let idx = 0; idx < row.length; idx++) {\n const cell = row[idx] ?? ''\n if (cell.length > (widths[idx] ?? 0)) widths[idx] = cell.length\n }\n }\n const out: string[] = []\n for (const row of rows) {\n const parts: string[] = []\n for (let idx = 0; idx < row.length; idx++) {\n const cell = row[idx] ?? ''\n if (idx < row.length - 1) parts.push(padRight(cell, widths[idx] ?? 0))\n else parts.push(cell)\n }\n out.push(parts.join(outputSep))\n }\n return out.join('\\n') + '\\n'\n}\n\nasync function columnCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const tMode = opts.flags.t === true\n const sFlag = typeof opts.flags.s === 'string' ? opts.flags.s : null\n const oFlag = typeof opts.flags.o === 'string' ? opts.flags.o : ' '\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(opfsStream(accessor.rootHandle, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('column: missing input\\n') })]\n }\n raw = stdinData\n }\n const text = DEC.decode(raw)\n const output = tMode ? tableFormat(text, sFlag, oFlag) : text\n const result: ByteSource = ENC.encode(output)\n return [result, new IOResult()]\n}\n\nexport const OPFS_COLUMN = command({\n name: 'column',\n resource: ResourceName.OPFS,\n spec: specOf('column'),\n fn: columnCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\ntype MergeEntry = [number, string]\n\nfunction commMerge(lines1: readonly string[], lines2: readonly string[]): MergeEntry[] {\n const result: MergeEntry[] = []\n let i = 0\n let j = 0\n while (i < lines1.length && j < lines2.length) {\n const a = lines1[i] ?? ''\n const b = lines2[j] ?? ''\n if (a < b) {\n result.push([1, a])\n i += 1\n } else if (a > b) {\n result.push([2, b])\n j += 1\n } else {\n result.push([3, a])\n i += 1\n j += 1\n }\n }\n while (i < lines1.length) {\n result.push([1, lines1[i] ?? ''])\n i += 1\n }\n while (j < lines2.length) {\n result.push([2, lines2[j] ?? ''])\n j += 1\n }\n return result\n}\n\nfunction formatComm(\n merged: readonly MergeEntry[],\n suppress1: boolean,\n suppress2: boolean,\n suppress3: boolean,\n): string {\n const out: string[] = []\n for (const [col, text] of merged) {\n if (col === 1 && !suppress1) {\n out.push(text)\n } else if (col === 2 && !suppress2) {\n const prefix = suppress1 ? '' : '\\t'\n out.push(prefix + text)\n } else if (col === 3 && !suppress3) {\n let prefix = ''\n if (!suppress1) prefix += '\\t'\n if (!suppress2) prefix += '\\t'\n out.push(prefix + text)\n }\n }\n return out.length > 0 ? out.join('\\n') + '\\n' : ''\n}\n\nfunction isSorted(lines: readonly string[]): boolean {\n for (let i = 1; i < lines.length; i++) {\n if ((lines[i - 1] ?? '') > (lines[i] ?? '')) return false\n }\n return true\n}\n\nasync function commCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('comm: requires two paths\\n') })]\n }\n const p1 = paths[0]\n const p2 = paths[1]\n if (p1 === undefined || p2 === undefined) return [null, new IOResult()]\n const data1 = DEC.decode(await materialize(opfsStream(accessor.rootHandle, p1)))\n const data2 = DEC.decode(await materialize(opfsStream(accessor.rootHandle, p2)))\n const lines1 = splitLinesNoTrailing(data1)\n const lines2 = splitLinesNoTrailing(data2)\n let stderr = ''\n if (opts.flags['check-order'] === true) {\n if (!isSorted(lines1)) stderr = 'comm: file 1 is not in sorted order\\n'\n else if (!isSorted(lines2)) stderr = 'comm: file 2 is not in sorted order\\n'\n }\n const suppress1 = opts.flags['1'] === true\n const suppress2 = opts.flags['2'] === true\n const suppress3 = opts.flags['3'] === true\n const merged = commMerge(lines1, lines2)\n const output = formatComm(merged, suppress1, suppress2, suppress3)\n const result: ByteSource = ENC.encode(output)\n return [result, new IOResult({ stderr: stderr !== '' ? ENC.encode(stderr) : null })]\n}\n\nexport const OPFS_COMM = command({\n name: 'comm',\n resource: ResourceName.OPFS,\n spec: specOf('comm'),\n fn: commCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { read as opfsRead } from '../../../core/opfs/read.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nasync function cpCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('cp: missing operand\\n'),\n }),\n ]\n }\n const sources = paths.slice(0, -1)\n const dst = paths[paths.length - 1]\n if (dst === undefined) return [null, new IOResult()]\n for (const src of sources) {\n const data = await opfsRead(accessor.rootHandle, src)\n await opfsWrite(accessor.rootHandle, dst, data)\n }\n return [null, new IOResult()]\n}\n\nexport const OPFS_CP = command({\n name: 'cp',\n resource: ResourceName.OPFS,\n spec: specOf('cp'),\n fn: cpCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { type PathSpec, record, ResourceName } from '@struktoai/mirage-core'\nimport { resolveFileHandle, toWritableChunk } from './utils.ts'\n\nexport async function writeBytes(\n root: FileSystemDirectoryHandle,\n p: PathSpec,\n data: Uint8Array,\n): Promise<void> {\n const start = performance.now()\n const virtual = p.stripPrefix\n const handle = await resolveFileHandle(root, virtual, { create: true })\n const writable = await handle.createWritable()\n await writable.write(toWritableChunk(data))\n await writable.close()\n record('write', virtual, ResourceName.OPFS, data.byteLength, start)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { type PathSpec, record, ResourceName } from '@struktoai/mirage-core'\nimport { isNotFound, resolveFileHandle } from './utils.ts'\n\nexport async function read(root: FileSystemDirectoryHandle, path: PathSpec): Promise<Uint8Array> {\n const start = performance.now()\n const virtual = path.stripPrefix\n let handle: FileSystemFileHandle\n try {\n handle = await resolveFileHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) throw new Error(`file not found: ${virtual}`)\n throw err\n }\n const file = await handle.getFile()\n const bytes = new Uint8Array(await file.arrayBuffer())\n record('read', virtual, ResourceName.OPFS, bytes.byteLength, start)\n return bytes\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction splitByPatterns(lines: readonly string[], patterns: readonly string[]): string[][] {\n const parts: string[][] = []\n let currentStart = 0\n for (const pat of patterns) {\n if (pat.startsWith('/') && pat.endsWith('/')) {\n const regex = new RegExp(pat.slice(1, -1))\n for (let idx = currentStart; idx < lines.length; idx++) {\n if (regex.test(lines[idx] ?? '')) {\n parts.push(lines.slice(currentStart, idx))\n currentStart = idx\n break\n }\n }\n } else {\n const lineNum = Number.parseInt(pat, 10)\n const splitAt = lineNum - 1\n if (splitAt > currentStart) {\n parts.push(lines.slice(currentStart, splitAt))\n currentStart = splitAt\n }\n }\n }\n if (currentStart < lines.length) {\n parts.push(lines.slice(currentStart))\n }\n return parts\n}\n\nfunction padNum(n: number, digits: number): string {\n const s = String(n)\n return s.length >= digits ? s : '0'.repeat(digits - s.length) + s\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function writePart(\n accessor: OPFSAccessor,\n filename: string,\n data: Uint8Array,\n writes: Record<string, Uint8Array>,\n): Promise<void> {\n await opfsWrite(accessor.rootHandle, makePathSpec(filename), data)\n writes[filename] = data\n}\n\nasync function csplitCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const prefix = typeof opts.flags.f === 'string' ? opts.flags.f : 'xx'\n const digits = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 2\n const quiet = opts.flags.s === true\n const keep = opts.flags.k === true\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(opfsStream(accessor.rootHandle, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('csplit: missing input\\n') })]\n }\n raw = stdinData\n }\n const text = DEC.decode(raw)\n const lines = splitLinesNoTrailing(text)\n const parts = splitByPatterns(lines, texts)\n const writes: Record<string, Uint8Array> = {}\n const sizes: string[] = []\n try {\n for (let idx = 0; idx < parts.length; idx++) {\n const part = parts[idx] ?? []\n const filename = prefix + padNum(idx, digits)\n const data = part.length > 0 ? ENC.encode(part.join('\\n') + '\\n') : new Uint8Array(0)\n await writePart(accessor, filename, data, writes)\n sizes.push(String(data.byteLength))\n }\n } catch (err) {\n if (!keep) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`csplit: ${msg}\\n`) })]\n }\n }\n const output = quiet ? '' : sizes.join('\\n') + '\\n'\n const result: ByteSource = ENC.encode(output)\n return [result, new IOResult({ writes })]\n}\n\nexport const OPFS_CSPLIT = command({\n name: 'csplit',\n resource: ResourceName.OPFS,\n spec: specOf('csplit'),\n fn: csplitCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction parseRangeSpec(spec: string): number[] {\n const out: number[] = []\n for (const part of spec.split(',')) {\n if (part.includes('-')) {\n const [loStr, hiStr] = part.split('-', 2) as [string, string]\n const lo = Number.parseInt(loStr, 10)\n const hi = Number.parseInt(hiStr, 10)\n for (let i = lo; i <= hi; i++) out.push(i)\n } else {\n out.push(Number.parseInt(part, 10))\n }\n }\n return out\n}\n\nfunction parseCharRanges(spec: string): [number, number][] {\n const ranges: [number, number][] = []\n for (const part of spec.split(',')) {\n if (part.includes('-')) {\n const [loStr, hiStr] = part.split('-', 2) as [string, string]\n ranges.push([Number.parseInt(loStr, 10), Number.parseInt(hiStr, 10)])\n } else {\n const val = Number.parseInt(part, 10)\n ranges.push([val, val])\n }\n }\n return ranges\n}\n\nasync function* cutStream(\n source: AsyncIterable<Uint8Array>,\n delimiter: string,\n fields: number[] | null,\n chars: [number, number][] | null,\n complement: boolean,\n zeroTerminated: boolean,\n): AsyncIterable<Uint8Array> {\n const raw = await materialize(source)\n const sep = zeroTerminated ? 0 : 0x0a\n const sepStr = zeroTerminated ? '\\x00' : '\\n'\n // Split raw bytes on sep, drop trailing empty record if present\n const records: Uint8Array[] = []\n let start = 0\n for (let i = 0; i < raw.byteLength; i++) {\n if (raw[i] === sep) {\n records.push(raw.subarray(start, i))\n start = i + 1\n }\n }\n if (start < raw.byteLength) {\n records.push(raw.subarray(start))\n }\n for (const rec of records) {\n const line = DEC.decode(rec)\n if (chars !== null) {\n if (complement) {\n const selectedIndices = new Set<number>()\n for (const [s, e] of chars) {\n for (let i = s - 1; i < e; i++) selectedIndices.add(i)\n }\n const parts: string[] = []\n for (let i = 0; i < line.length; i++) {\n if (!selectedIndices.has(i)) {\n const ch = line.charAt(i)\n if (ch !== '') parts.push(ch)\n }\n }\n yield ENC.encode(parts.join('') + sepStr)\n } else {\n const parts: string[] = []\n for (const [s, e] of chars) {\n parts.push(line.slice(s - 1, e))\n }\n yield ENC.encode(parts.join('') + sepStr)\n }\n } else if (fields !== null && fields.length > 0) {\n const partsF = line.split(delimiter)\n let selected: string[]\n if (complement) {\n const fieldSet = new Set(fields)\n selected = partsF.filter((_, i) => !fieldSet.has(i + 1))\n } else {\n selected = []\n for (const f of fields) {\n const part = partsF[f - 1]\n if (part !== undefined) selected.push(part)\n }\n }\n yield ENC.encode(selected.join(delimiter) + sepStr)\n } else {\n const out = new Uint8Array(rec.byteLength + 1)\n out.set(rec, 0)\n out[rec.byteLength] = sep\n yield out\n }\n }\n}\n\nfunction cutCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): CommandFnResult {\n const f = typeof opts.flags.f === 'string' ? opts.flags.f : null\n const d = typeof opts.flags.d === 'string' ? opts.flags.d : null\n const c = typeof opts.flags.c === 'string' ? opts.flags.c : null\n const complement = opts.flags.complement === true\n const z = opts.flags.z === true\n const fields = f !== null ? parseRangeSpec(f) : null\n const chars = c !== null ? parseCharRanges(c) : null\n const delim = d ?? '\\t'\n\n let source: AsyncIterable<Uint8Array>\n const cache: string[] = []\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = opfsStream(accessor.rootHandle, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'cut: missing operand')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n const out: ByteSource = cutStream(source, delim, fields, chars, complement, z)\n return [out, new IOResult({ cache })]\n}\n\nexport const OPFS_CUT = command({\n name: 'cut',\n resource: ResourceName.OPFS,\n spec: specOf('cut'),\n fn: cutCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherCut,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function cutFeatherCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const fSpec = typeof opts.flags.f === 'string' ? opts.flags.f : ''\n const columns = fSpec.split(',').filter((c) => c.length > 0)\n if (columns.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: -f required\\n') })]\n }\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = featherCut(raw, columns)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cut: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_CUT_FEATHER = command({\n name: 'cut',\n resource: ResourceName.OPFS,\n spec: specOf('cut'),\n filetype: '.feather',\n fn: cutFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Cut,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function cutHdf5Command(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const fSpec = typeof opts.flags.f === 'string' ? opts.flags.f : ''\n const columns = fSpec.split(',').filter((c) => c.length > 0)\n if (columns.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: -f required\\n') })]\n }\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = await hdf5Cut(raw, columns)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cut: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_CUT_HDF5 = command({\n name: 'cut',\n resource: ResourceName.OPFS,\n spec: specOf('cut'),\n filetype: '.h5',\n fn: cutHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetCut,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function cutParquetCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const fSpec = typeof opts.flags.f === 'string' ? opts.flags.f : ''\n const columns = fSpec.split(',').filter((c) => c.length > 0)\n if (columns.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: -f required\\n') })]\n }\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = await parquetCut(raw, columns)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cut: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_CUT_PARQUET = command({\n name: 'cut',\n resource: ResourceName.OPFS,\n spec: specOf('cut'),\n filetype: '.parquet',\n fn: cutParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n edScript,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n unifiedDiff,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\ninterface DiffFlags {\n i: boolean\n w: boolean\n b: boolean\n e: boolean\n q: boolean\n}\n\nfunction splitLinesKeepEnds(text: string): string[] {\n const lines: string[] = []\n let start = 0\n for (let i = 0; i < text.length; i++) {\n if (text[i] === '\\n') {\n lines.push(text.slice(start, i + 1))\n start = i + 1\n }\n }\n if (start < text.length) lines.push(text.slice(start))\n return lines\n}\n\nasync function readFile(accessor: OPFSAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(opfsStream(accessor.rootHandle, p))\n}\n\nasync function diffPair(\n accessor: OPFSAccessor,\n path1: PathSpec,\n path2: PathSpec,\n flags: DiffFlags,\n): Promise<Uint8Array> {\n const dataA = await readFile(accessor, path1)\n const dataB = await readFile(accessor, path2)\n let textA = DEC.decode(dataA)\n let textB = DEC.decode(dataB)\n if (flags.i) {\n textA = textA.toLowerCase()\n textB = textB.toLowerCase()\n }\n if (flags.w) {\n textA = textA.replace(/\\s+/g, '')\n textB = textB.replace(/\\s+/g, '')\n }\n if (flags.b) {\n textA = textA.replace(/[ \\t]+/g, ' ')\n textB = textB.replace(/[ \\t]+/g, ' ')\n }\n if (flags.q) {\n if (textA !== textB) return ENC.encode(`Files ${path1.original} and ${path2.original} differ\\n`)\n return new Uint8Array(0)\n }\n const aLines = splitLinesKeepEnds(textA)\n const bLines = splitLinesKeepEnds(textB)\n const result = flags.e\n ? edScript(aLines, bLines)\n : unifiedDiff(aLines, bLines, path1.original, path2.original)\n return ENC.encode(result.join(''))\n}\n\nasync function diffCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [null, new IOResult({ exitCode: 2, stderr: ENC.encode('diff: requires two paths\\n') })]\n }\n const flags: DiffFlags = {\n i: opts.flags.i === true,\n w: opts.flags.w === true,\n b: opts.flags.b === true,\n e: opts.flags.e === true,\n q: opts.flags.q === true,\n }\n const p0 = paths[0]\n const p1 = paths[1]\n if (p0 === undefined || p1 === undefined) return [null, new IOResult()]\n const output = await diffPair(accessor, p0, p1, flags)\n const exitCode = output.byteLength > 0 ? 1 : 0\n const out: ByteSource = output\n return [out, new IOResult({ exitCode, cache: [p0.stripPrefix, p1.stripPrefix] })]\n}\n\nexport const OPFS_DIFF = command({\n name: 'diff',\n resource: ResourceName.OPFS,\n spec: specOf('diff'),\n fn: diffCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type Accessor,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\n\nfunction dirnameCommand(\n _accessor: Accessor,\n paths: PathSpec[],\n texts: string[],\n _opts: CommandOpts,\n): CommandFnResult {\n const arg = texts[0] ?? paths[0]?.original ?? ''\n const stripped = arg.replace(/\\/+$/, '')\n const idx = stripped.lastIndexOf('/')\n const dir = idx > 0 ? stripped.slice(0, idx) : idx === 0 ? '/' : '.'\n const out: ByteSource = new TextEncoder().encode(`${dir}\\n`)\n return [out, new IOResult()]\n}\n\nexport const OPFS_DIRNAME = command({\n name: 'dirname',\n resource: ResourceName.OPFS,\n spec: specOf('dirname'),\n fn: dirnameCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { du as opfsDu } from '../../../core/opfs/du.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nfunction humanSize(n: number): string {\n const units = ['', 'K', 'M', 'G', 'T']\n let v = n\n let i = 0\n while (v >= 1024 && i < units.length - 1) {\n v /= 1024\n i += 1\n }\n const s = v >= 10 || i === 0 ? Math.round(v).toString() : v.toFixed(1)\n return `${s}${units[i] ?? ''}`\n}\n\nasync function duCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const human = opts.flags.h === true\n const targets =\n paths.length > 0 ? paths : [new PathSpec({ original: '/', directory: '/', resolved: false })]\n const lines: string[] = []\n for (const root of targets) {\n let total = 0\n try {\n total = await opfsDu(accessor.rootHandle, root)\n } catch {\n total = 0\n }\n const sizeStr = human ? humanSize(total) : String(total)\n lines.push(`${sizeStr}\\t${root.original}`)\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const OPFS_DU = command({\n name: 'du',\n resource: ResourceName.OPFS,\n spec: specOf('du'),\n fn: duCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { isNotFound, iterEntries, norm, resolveDirHandle, resolveParentDirHandle } from './utils.ts'\n\nasync function walkSizes(dir: FileSystemDirectoryHandle): Promise<number> {\n let total = 0\n for await (const [name, handle] of iterEntries(dir)) {\n if (handle.kind === 'file') {\n try {\n const fh = await dir.getFileHandle(name, { create: false })\n const file = await fh.getFile()\n total += file.size\n } catch {\n // ignore\n }\n } else {\n try {\n const child = await dir.getDirectoryHandle(name, { create: false })\n total += await walkSizes(child)\n } catch {\n // ignore\n }\n }\n }\n return total\n}\n\nasync function walkAll(\n dir: FileSystemDirectoryHandle,\n currentPath: string,\n entries: [string, number][],\n): Promise<number> {\n let total = 0\n for await (const [name, handle] of iterEntries(dir)) {\n const childPath = currentPath === '/' ? `/${name}` : `${currentPath}/${name}`\n if (handle.kind === 'file') {\n try {\n const fh = await dir.getFileHandle(name, { create: false })\n const file = await fh.getFile()\n entries.push([childPath, file.size])\n total += file.size\n } catch {\n // ignore\n }\n } else {\n try {\n const child = await dir.getDirectoryHandle(name, { create: false })\n total += await walkAll(child, childPath, entries)\n } catch {\n // ignore\n }\n }\n }\n return total\n}\n\nasync function sizeOfPath(root: FileSystemDirectoryHandle, virtual: string): Promise<number> {\n try {\n const [parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n try {\n const fh = await parentDir.getFileHandle(name, { create: false })\n const file = await fh.getFile()\n return file.size\n } catch (err) {\n if (!isNotFound(err) && !(err instanceof DOMException && err.name === 'TypeMismatchError')) {\n throw err\n }\n }\n const dir = await parentDir.getDirectoryHandle(name, { create: false })\n return await walkSizes(dir)\n } catch (err) {\n if (isNotFound(err)) return 0\n if (err instanceof Error && err.message.startsWith('no parent directory')) {\n try {\n const rootDir = await resolveDirHandle(root, virtual, { create: false })\n return await walkSizes(rootDir)\n } catch {\n return 0\n }\n }\n throw err\n }\n}\n\nexport async function du(root: FileSystemDirectoryHandle, p: PathSpec): Promise<number> {\n return sizeOfPath(root, p.stripPrefix)\n}\n\nexport async function duAll(\n root: FileSystemDirectoryHandle,\n p: PathSpec,\n): Promise<[entries: [string, number][], total: number]> {\n const virtual = norm(p.stripPrefix)\n const entries: [string, number][] = []\n try {\n const [parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n try {\n const fh = await parentDir.getFileHandle(name, { create: false })\n const file = await fh.getFile()\n entries.push([virtual, file.size])\n return [entries, file.size]\n } catch (err) {\n if (!isNotFound(err) && !(err instanceof DOMException && err.name === 'TypeMismatchError')) {\n throw err\n }\n }\n const dir = await parentDir.getDirectoryHandle(name, { create: false })\n const total = await walkAll(dir, virtual, entries)\n entries.sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0))\n return [entries, total]\n } catch (err) {\n if (isNotFound(err)) return [entries, 0]\n if (err instanceof Error && err.message.startsWith('no parent directory')) {\n try {\n const rootDir = await resolveDirHandle(root, virtual, { create: false })\n const total = await walkAll(rootDir, virtual, entries)\n entries.sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0))\n return [entries, total]\n } catch {\n return [entries, 0]\n }\n }\n throw err\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction expandTabs(text: string, tabsize: number): string {\n const out: string[] = []\n let col = 0\n for (const ch of text) {\n if (ch === '\\t') {\n const spaces = tabsize - (col % tabsize)\n out.push(' '.repeat(spaces))\n col += spaces\n } else if (ch === '\\n') {\n out.push(ch)\n col = 0\n } else {\n out.push(ch)\n col += 1\n }\n }\n return out.join('')\n}\n\nfunction expandLeadingTabs(text: string, tabsize: number): string {\n const lines = text.split('\\n')\n const result: string[] = []\n for (const line of lines) {\n let i = 0\n while (i < line.length && line[i] === '\\t') i += 1\n if (i === 0) {\n result.push(line)\n } else {\n const leading = line.slice(0, i)\n const rest = line.slice(i)\n result.push(expandTabs(leading, tabsize) + rest)\n }\n }\n return result.join('\\n')\n}\n\nasync function expandCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const tabsize = typeof opts.flags.t === 'string' ? Number.parseInt(opts.flags.t, 10) : 8\n const leadingOnly = opts.flags.i === true\n const expander = (txt: string) =>\n leadingOnly ? expandLeadingTabs(txt, tabsize) : expandTabs(txt, tabsize)\n if (paths.length > 0) {\n const parts: string[] = []\n for (const p of paths) {\n const data = DEC.decode(await materialize(opfsStream(accessor.rootHandle, p)))\n parts.push(expander(data))\n }\n const result: ByteSource = ENC.encode(parts.join(''))\n return [result, new IOResult()]\n }\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('expand: missing operand\\n') })]\n }\n const text = DEC.decode(stdinData)\n const result: ByteSource = ENC.encode(expander(text))\n return [result, new IOResult()]\n}\n\nexport const OPFS_EXPAND = command({\n name: 'expand',\n resource: ResourceName.OPFS,\n spec: specOf('expand'),\n fn: expandCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n ResourceName,\n command,\n detectFileType,\n formatFileResult,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stat as opfsStat } from '../../../../core/opfs/stat.ts'\nimport { read as opfsRead } from '../../../../core/opfs/read.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function fileCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('file: missing operand\\n') })]\n }\n const brief = opts.flags.b === true\n const mime = opts.flags.i === true\n const lines: string[] = []\n for (const p of paths) {\n const s = await opfsStat(accessor.rootHandle, p)\n if (s.type === FileType.DIRECTORY) {\n lines.push(formatFileResult(p.original, FileType.DIRECTORY, brief, mime))\n continue\n }\n let header: Uint8Array\n try {\n const raw = await opfsRead(accessor.rootHandle, p)\n header = raw.subarray(0, 512)\n } catch {\n header = new Uint8Array(0)\n }\n const result = detectFileType(header, s)\n lines.push(formatFileResult(p.original, result, brief, mime))\n }\n const out: ByteSource = ENC.encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const OPFS_FILE = command({\n name: 'file',\n resource: ResourceName.OPFS,\n spec: specOf('file'),\n fn: fileCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherDescribe,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function fileFeatherCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('file: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = featherDescribe(raw)\n const out: ByteSource = ENC.encode(result)\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`file: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_FILE_FEATHER = command({\n name: 'file',\n resource: ResourceName.OPFS,\n spec: specOf('file'),\n filetype: '.feather',\n fn: fileFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Describe,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function fileHdf5Command(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('file: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = await hdf5Describe(raw)\n const out: ByteSource = ENC.encode(result)\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`file: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_FILE_HDF5 = command({\n name: 'file',\n resource: ResourceName.OPFS,\n spec: specOf('file'),\n filetype: '.h5',\n fn: fileHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetDescribe,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function fileParquetCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('file: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = parquetDescribe(raw)\n const out: ByteSource = ENC.encode(result)\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`file: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_FILE_PARQUET = command({\n name: 'file',\n resource: ResourceName.OPFS,\n spec: specOf('file'),\n filetype: '.parquet',\n fn: fileParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { find as opfsFind } from '../../../core/opfs/find.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\n/**\n * Parse a `-size` argument (e.g. `+1M`, `-100c`, `512`) into [min, max] bytes.\n * `+N` → larger than N; `-N` → smaller; bare N → exactly N.\n * Suffixes: c=byte, k=KB, M=MB, G=GB. Mirrors Python `_parse_size`.\n */\nfunction parseSize(spec: string): [number | null, number | null] {\n const suffixes: Record<string, number> = { c: 1, k: 1024, M: 1024 ** 2, G: 1024 ** 3 }\n const sign = spec.startsWith('+') ? '+' : spec.startsWith('-') ? '-' : ''\n const raw = sign === '' ? spec : spec.slice(1)\n const lastChar = raw.slice(-1)\n const mult = suffixes[lastChar] ?? 1\n const numPart = lastChar in suffixes ? raw.slice(0, -1) : raw\n const num = Number.parseInt(numPart, 10) * mult\n if (sign === '+') return [num, null]\n if (sign === '-') return [null, num]\n return [num, num]\n}\n\n/**\n * Parse a `-mtime` argument (e.g. `+7`, `-1`) into [minTimestamp, maxTimestamp].\n * Days are 86400-second buckets relative to now. Mirrors Python `_parse_mtime`.\n */\nfunction parseMtime(spec: string): [number | null, number | null] {\n const now = Date.now() / 1000\n const day = 86_400\n const n = Number.parseInt(spec.replace(/^[+-]/, ''), 10)\n if (spec.startsWith('+')) return [null, now - n * day]\n if (spec.startsWith('-')) return [now - n * day, null]\n return [now - (n + 1) * day, now - n * day]\n}\n\n/**\n * Extract `-not -name PATTERN` from positional args. Mirrors Python\n * `_extract_not_name`.\n */\nfunction extractNotName(texts: readonly string[]): string | null {\n for (let i = 0; i < texts.length; i++) {\n const pat = texts[i + 2]\n if (texts[i] === '-not' && texts[i + 1] === '-name' && pat !== undefined) {\n return pat\n }\n }\n return null\n}\n\n/**\n * Extract `-or -name PATTERN` repeated entries. Mirrors Python\n * `_extract_or_names`. Always includes the primary `-name` if given.\n */\nfunction extractOrNames(name: string | null, texts: readonly string[]): string[] {\n const names: string[] = []\n if (name !== null) names.push(name)\n let i = 0\n while (i < texts.length) {\n const pat = texts[i + 2]\n if (texts[i] === '-or' && texts[i + 1] === '-name' && pat !== undefined) {\n names.push(pat)\n i += 3\n } else {\n i += 1\n }\n }\n return names\n}\n\nasync function findCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nameFlag = typeof opts.flags.name === 'string' ? opts.flags.name : null\n const inameFlag = typeof opts.flags.iname === 'string' ? opts.flags.iname : null\n const typeFlag = typeof opts.flags.type === 'string' ? opts.flags.type : null\n const pathFlag = typeof opts.flags.path === 'string' ? opts.flags.path : null\n const maxDepthFlag = typeof opts.flags.maxdepth === 'string' ? opts.flags.maxdepth : null\n const minDepthFlag = typeof opts.flags.mindepth === 'string' ? opts.flags.mindepth : null\n const sizeFlag = typeof opts.flags.size === 'string' ? opts.flags.size : null\n const mtimeFlag = typeof opts.flags.mtime === 'string' ? opts.flags.mtime : null\n const targets =\n paths.length > 0 ? paths : [new PathSpec({ original: '/', directory: '/', resolved: false })]\n const findType: 'f' | 'd' | null = typeFlag === 'f' ? 'f' : typeFlag === 'd' ? 'd' : null\n const maxDepth = maxDepthFlag !== null ? Number.parseInt(maxDepthFlag, 10) : null\n const minDepth = minDepthFlag !== null ? Number.parseInt(minDepthFlag, 10) : null\n const [minSize, maxSize] = sizeFlag !== null ? parseSize(sizeFlag) : [null, null]\n const [mtimeMin, mtimeMax] = mtimeFlag !== null ? parseMtime(mtimeFlag) : [null, null]\n const nameExclude = extractNotName(texts)\n const orNames = extractOrNames(nameFlag, texts)\n const matches: string[] = []\n for (const root of targets) {\n let keys: string[]\n try {\n keys = await opfsFind(accessor.rootHandle, root, {\n name: nameFlag,\n iname: inameFlag,\n type: findType,\n ...(maxDepth !== null ? { maxDepth } : {}),\n ...(minDepth !== null ? { minDepth } : {}),\n ...(minSize !== null ? { minSize } : {}),\n ...(maxSize !== null ? { maxSize } : {}),\n ...(mtimeMin !== null ? { mtimeMin } : {}),\n ...(mtimeMax !== null ? { mtimeMax } : {}),\n ...(nameExclude !== null ? { nameExclude } : {}),\n ...(pathFlag !== null ? { pathPattern: pathFlag } : {}),\n ...(orNames.length > 1 ? { orNames } : {}),\n })\n } catch {\n continue\n }\n const rootKey = root.stripPrefix.replace(/\\/+$/, '') || '/'\n for (const key of keys) {\n const displayPath =\n root.original === '/'\n ? key\n : root.original.replace(/\\/+$/, '') + key.slice(rootKey === '/' ? 0 : rootKey.length)\n matches.push(displayPath)\n }\n }\n matches.sort()\n const out: ByteSource = new TextEncoder().encode(matches.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const OPFS_FIND = command({\n name: 'find',\n resource: ResourceName.OPFS,\n spec: specOf('find'),\n fn: findCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { isNotFound, iterEntries, norm, resolveDirHandle } from './utils.ts'\n\nexport interface FindOptions {\n name?: string | null\n type?: 'f' | 'd' | null\n minSize?: number | null\n maxSize?: number | null\n maxDepth?: number | null\n minDepth?: number | null\n nameExclude?: string | null\n orNames?: string[] | null\n iname?: string | null\n pathPattern?: string | null\n mtimeMin?: number | null\n mtimeMax?: number | null\n}\n\nfunction fnmatch(name: string, pattern: string): boolean {\n let re = '^'\n for (const ch of pattern) {\n if (ch === '*') re += '.*'\n else if (ch === '?') re += '.'\n else if (/[.+^${}()|[\\]\\\\]/.test(ch)) re += '\\\\' + ch\n else re += ch\n }\n re += '$'\n return new RegExp(re).test(name)\n}\n\ninterface WalkCtx {\n options: FindOptions\n results: string[]\n}\n\nasync function walk(\n ctx: WalkCtx,\n dir: FileSystemDirectoryHandle,\n current: string,\n depth: number,\n): Promise<void> {\n const opts = ctx.options\n if (opts.maxDepth !== null && opts.maxDepth !== undefined && depth > opts.maxDepth) return\n let iter: AsyncIterable<[string, FileSystemHandle]>\n try {\n iter = iterEntries(dir)\n } catch {\n return\n }\n for await (const [entryName, handle] of iter) {\n const kind: 'f' | 'd' = handle.kind === 'directory' ? 'd' : 'f'\n const entryPath = current === '/' ? `/${entryName}` : `${current}/${entryName}`\n if (opts.type === 'f' && kind !== 'f') {\n if (handle.kind === 'directory') {\n try {\n const child = await dir.getDirectoryHandle(entryName, { create: false })\n await walk(ctx, child, entryPath, depth + 1)\n } catch {\n // ignore\n }\n }\n continue\n }\n if (opts.type === 'd' && kind !== 'd') continue\n const entryDepth = depth + 1\n\n let accept = true\n if (opts.orNames !== null && opts.orNames !== undefined && opts.orNames.length > 0) {\n if (!opts.orNames.some((pat) => fnmatch(entryName, pat))) accept = false\n } else if (opts.name !== null && opts.name !== undefined) {\n if (!fnmatch(entryName, opts.name)) accept = false\n }\n if (\n accept &&\n opts.iname !== null &&\n opts.iname !== undefined &&\n !fnmatch(entryName.toLowerCase(), opts.iname.toLowerCase())\n ) {\n accept = false\n }\n if (\n accept &&\n opts.pathPattern !== null &&\n opts.pathPattern !== undefined &&\n !fnmatch(entryPath, opts.pathPattern)\n ) {\n accept = false\n }\n if (\n accept &&\n opts.nameExclude !== null &&\n opts.nameExclude !== undefined &&\n fnmatch(entryName, opts.nameExclude)\n ) {\n accept = false\n }\n if (\n accept &&\n opts.maxDepth !== null &&\n opts.maxDepth !== undefined &&\n entryDepth > opts.maxDepth\n ) {\n accept = false\n }\n if (\n accept &&\n opts.minDepth !== null &&\n opts.minDepth !== undefined &&\n entryDepth < opts.minDepth\n ) {\n accept = false\n }\n\n if (\n accept &&\n kind === 'f' &&\n (opts.minSize !== null ||\n opts.maxSize !== null ||\n opts.mtimeMin !== null ||\n opts.mtimeMax !== null)\n ) {\n try {\n const fh = await dir.getFileHandle(entryName, { create: false })\n const file = await fh.getFile()\n if (opts.minSize !== null && opts.minSize !== undefined && file.size < opts.minSize)\n accept = false\n if (opts.maxSize !== null && opts.maxSize !== undefined && file.size > opts.maxSize)\n accept = false\n if (accept && (opts.mtimeMin !== undefined || opts.mtimeMax !== undefined)) {\n const mtime = file.lastModified / 1000\n if (opts.mtimeMin !== null && opts.mtimeMin !== undefined && mtime < opts.mtimeMin)\n accept = false\n if (opts.mtimeMax !== null && opts.mtimeMax !== undefined && mtime > opts.mtimeMax)\n accept = false\n }\n } catch {\n accept = false\n }\n }\n\n if (accept) ctx.results.push(entryPath)\n\n if (kind === 'd') {\n try {\n const child = await dir.getDirectoryHandle(entryName, { create: false })\n await walk(ctx, child, entryPath, depth + 1)\n } catch {\n // ignore\n }\n }\n }\n}\n\nexport async function find(\n root: FileSystemDirectoryHandle,\n p: PathSpec,\n options: FindOptions = {},\n): Promise<string[]> {\n const virtual = norm(p.stripPrefix)\n const results: string[] = []\n let dir: FileSystemDirectoryHandle\n try {\n dir = await resolveDirHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) return results\n throw err\n }\n await walk({ options, results }, dir, virtual, 0)\n results.sort()\n return results\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction wrapText(text: string, width: number): string {\n const words = text.split(/\\s+/).filter((w) => w !== '')\n if (words.length === 0) return ''\n const lines: string[] = []\n let current = ''\n for (const w of words) {\n if (current === '') {\n current = w\n } else if (current.length + 1 + w.length <= width) {\n current = current + ' ' + w\n } else {\n lines.push(current)\n current = w\n }\n }\n if (current !== '') lines.push(current)\n return lines.join('\\n')\n}\n\nfunction fmtText(text: string, width: number): string {\n const paragraphs = text.split('\\n\\n')\n const formatted: string[] = []\n for (const para of paragraphs) {\n const trimmed = para.trim()\n if (trimmed !== '') formatted.push(wrapText(trimmed, width))\n else formatted.push('')\n }\n return formatted.join('\\n\\n') + '\\n'\n}\n\nasync function fmtCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const width = typeof opts.flags.w === 'string' ? Number.parseInt(opts.flags.w, 10) : 75\n if (paths.length > 0) {\n const parts: string[] = []\n for (const p of paths) {\n parts.push(DEC.decode(await materialize(opfsStream(accessor.rootHandle, p))))\n }\n const result: ByteSource = ENC.encode(fmtText(parts.join(''), width))\n return [result, new IOResult()]\n }\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('fmt: missing operand\\n') })]\n }\n const text = DEC.decode(stdinData)\n const result: ByteSource = ENC.encode(fmtText(text, width))\n return [result, new IOResult()]\n}\n\nexport const OPFS_FMT = command({\n name: 'fmt',\n resource: ResourceName.OPFS,\n spec: specOf('fmt'),\n fn: fmtCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction foldLine(line: string, width: number, breakSpaces: boolean): string {\n if (line.length <= width) return line\n const parts: string[] = []\n let rest = line\n while (rest.length > width) {\n if (breakSpaces) {\n const idx = rest.lastIndexOf(' ', width - 1)\n if (idx > 0) {\n parts.push(rest.slice(0, idx + 1))\n rest = rest.slice(idx + 1)\n } else {\n parts.push(rest.slice(0, width))\n rest = rest.slice(width)\n }\n } else {\n parts.push(rest.slice(0, width))\n rest = rest.slice(width)\n }\n }\n if (rest !== '') parts.push(rest)\n return parts.join('\\n')\n}\n\nasync function foldCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const width = typeof opts.flags.w === 'string' ? Number.parseInt(opts.flags.w, 10) : 80\n const breakSpaces = opts.flags.s === true\n if (paths.length > 0) {\n const allLines: string[] = []\n for (const p of paths) {\n const data = DEC.decode(await materialize(opfsStream(accessor.rootHandle, p)))\n for (const line of splitLinesNoTrailing(data)) {\n allLines.push(foldLine(line, width, breakSpaces))\n }\n }\n const result: ByteSource = ENC.encode(allLines.join('\\n') + '\\n')\n return [result, new IOResult()]\n }\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('fold: missing operand\\n') })]\n }\n const lines = splitLinesNoTrailing(DEC.decode(stdinData))\n const result: ByteSource = ENC.encode(\n lines.map((ln) => foldLine(ln, width, breakSpaces)).join('\\n') + '\\n',\n )\n return [result, new IOResult()]\n}\n\nexport const OPFS_FOLD = command({\n name: 'fold',\n resource: ResourceName.OPFS,\n spec: specOf('fold'),\n fn: foldCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n compilePattern,\n exitOnEmpty,\n grepLines,\n grepStream,\n materialize,\n prefixAggregate,\n quietMatch,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport { stat as opfsStat } from '../../../../core/opfs/stat.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction getPattern(texts: readonly string[], flags: Record<string, string | boolean>): string {\n if (typeof flags.e === 'string') return flags.e\n if (texts.length > 0 && texts[0] !== undefined) return texts[0]\n throw new Error('grep: usage: grep [flags] pattern [path]')\n}\n\ninterface FlagSet {\n ignoreCase: boolean\n invert: boolean\n lineNumbers: boolean\n countOnly: boolean\n filesOnly: boolean\n wholeWord: boolean\n fixedString: boolean\n onlyMatching: boolean\n maxCount: number | null\n quiet: boolean\n afterContext: number\n beforeContext: number\n}\n\nfunction parseFlags(flags: Record<string, string | boolean>): FlagSet {\n const toInt = (v: string | boolean | undefined): number | null =>\n typeof v === 'string' ? Number.parseInt(v, 10) : null\n const aCtx = toInt(flags.A)\n const bCtx = toInt(flags.B)\n const cCtx = toInt(flags.C)\n return {\n ignoreCase: flags.i === true,\n invert: flags.v === true,\n lineNumbers: flags.n === true,\n countOnly: flags.c === true,\n filesOnly: flags.args_l === true || flags.l === true,\n wholeWord: flags.w === true,\n fixedString: flags.F === true,\n onlyMatching: flags.o === true,\n maxCount: toInt(flags.m),\n quiet: flags.q === true,\n afterContext: aCtx ?? cCtx ?? 0,\n beforeContext: bCtx ?? cCtx ?? 0,\n }\n}\n\nasync function readFile(accessor: OPFSAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(opfsStream(accessor.rootHandle, p))\n}\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nasync function grepImpl(\n name: string,\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n let pattern: string\n try {\n pattern = getPattern(texts, opts.flags)\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 2, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const f = parseFlags(opts.flags)\n\n if (paths.length > 0) {\n const pat = compilePattern(pattern, f.ignoreCase, f.fixedString, f.wholeWord)\n\n if (paths.length > 1) {\n const allResults: string[] = []\n for (const p of paths) {\n const data = splitLinesNoTrailing(DEC.decode(await readFile(accessor, p)))\n const hits = grepLines(p.original, data, pat, f)\n if (f.countOnly) {\n if (hits.length > 0) allResults.push(`${p.original}:${hits[0] ?? ''}`)\n } else if (f.filesOnly) {\n for (const h of hits) allResults.push(h)\n } else {\n for (const h of hits) allResults.push(`${p.original}:${h}`)\n }\n }\n if (allResults.length === 0) return [new Uint8Array(0), new IOResult({ exitCode: 1 })]\n const out: ByteSource = ENC.encode(allResults.join('\\n'))\n return [out, new IOResult()]\n }\n\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n await opfsStat(accessor.rootHandle, first)\n if (f.filesOnly) {\n const data = splitLinesNoTrailing(DEC.decode(await readFile(accessor, first)))\n const hits = grepLines(first.original, data, pat, f)\n if (hits.length === 0) return [new Uint8Array(0), new IOResult({ exitCode: 1 })]\n return [ENC.encode(hits.join('\\n')), new IOResult()]\n }\n const source = opfsStream(accessor.rootHandle, first)\n const stream = grepStream(source, pat, f)\n if (f.quiet) {\n const io = new IOResult({ exitCode: 1 })\n return [quietMatch(stream, io), io]\n }\n const io = new IOResult()\n return [exitOnEmpty(stream, io), io]\n }\n\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, `${name}: usage: ${name} [flags] pattern [path]`)\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 2, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const pat = compilePattern(pattern, f.ignoreCase, f.fixedString, f.wholeWord)\n const stream = grepStream(source, pat, f)\n if (f.quiet) {\n const io = new IOResult({ exitCode: 1 })\n return [quietMatch(stream, io), io]\n }\n const io = new IOResult()\n return [exitOnEmpty(stream, io), io]\n}\n\nconst grepFn = (\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> => {\n return grepImpl('grep', accessor, paths, texts, opts)\n}\n\nexport const OPFS_GREP = command({\n name: 'grep',\n resource: ResourceName.OPFS,\n spec: specOf('grep'),\n fn: grepFn,\n aggregate: prefixAggregate,\n})\n\nexport { grepImpl }\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherGrep,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function grepFeatherCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = featherGrep(raw, pattern, ignoreCase)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_GREP_FEATHER = command({\n name: 'grep',\n resource: ResourceName.OPFS,\n spec: specOf('grep'),\n filetype: '.feather',\n fn: grepFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Grep,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function grepHdf5Command(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = await hdf5Grep(raw, pattern, ignoreCase)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_GREP_HDF5 = command({\n name: 'grep',\n resource: ResourceName.OPFS,\n spec: specOf('grep'),\n filetype: '.h5',\n fn: grepHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetGrep,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function grepParquetCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = await parquetGrep(raw, pattern, ignoreCase)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_GREP_PARQUET = command({\n name: 'grep',\n resource: ResourceName.OPFS,\n spec: specOf('grep'),\n filetype: '.parquet',\n fn: grepParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n gunzip,\n materialize,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { unlink as opfsUnlink } from '../../../core/opfs/unlink.ts'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function gunzipCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const keep = opts.flags.k === true\n const stdoutMode = opts.flags.c === true\n const testMode = opts.flags.t === true\n\n if (paths.length === 0) {\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, 'gunzip: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const data = await materialize(source)\n const out = await gunzip(data)\n const result: ByteSource = out\n return [result, new IOResult()]\n }\n\n if (testMode) {\n for (const p of paths) {\n const raw = await materialize(opfsStream(accessor.rootHandle, p))\n await gunzip(raw)\n }\n return [null, new IOResult()]\n }\n\n if (stdoutMode) {\n const chunks: Uint8Array[] = []\n for (const p of paths) {\n const raw = await materialize(opfsStream(accessor.rootHandle, p))\n chunks.push(await gunzip(raw))\n }\n return [concat(chunks), new IOResult()]\n }\n\n const writes: Record<string, Uint8Array> = {}\n for (const p of paths) {\n const raw = await materialize(opfsStream(accessor.rootHandle, p))\n const pStripped = p.stripPrefix\n const outPath = pStripped.endsWith('.gz') ? pStripped.slice(0, -3) : pStripped + '.out'\n const outData = await gunzip(raw)\n await opfsWrite(accessor.rootHandle, makePathSpec(outPath), outData)\n writes[outPath] = outData\n if (!keep) await opfsUnlink(accessor.rootHandle, p)\n }\n return [null, new IOResult({ writes })]\n}\n\nfunction concat(chunks: Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nexport const OPFS_GUNZIP = command({\n name: 'gunzip',\n resource: ResourceName.OPFS,\n spec: specOf('gunzip'),\n fn: gunzipCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { isNotFound, resolveParentDirHandle } from './utils.ts'\n\nexport async function unlink(root: FileSystemDirectoryHandle, path: PathSpec): Promise<void> {\n const virtual = path.stripPrefix\n let parentDir: FileSystemDirectoryHandle\n let name: string\n try {\n ;[parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) return\n if (err instanceof Error && err.message.startsWith('no parent directory')) return\n throw err\n }\n try {\n await parentDir.removeEntry(name)\n } catch (err) {\n if (isNotFound(err)) return\n throw err\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n gunzip,\n gzip,\n materialize,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { unlink as opfsUnlink } from '../../../core/opfs/unlink.ts'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function gzipCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const decompress = opts.flags.d === true\n const keep = opts.flags.k === true\n const stdoutMode = opts.flags.c === true\n\n if (paths.length === 0) {\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, 'gzip: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const data = await materialize(source)\n const out = decompress ? await gunzip(data) : await gzip(data)\n const result: ByteSource = out\n return [result, new IOResult()]\n }\n\n if (stdoutMode) {\n const chunks: Uint8Array[] = []\n for (const p of paths) {\n const raw = await materialize(opfsStream(accessor.rootHandle, p))\n const out = decompress ? await gunzip(raw) : await gzip(raw)\n chunks.push(out)\n }\n return [concat(chunks), new IOResult()]\n }\n\n const writes: Record<string, Uint8Array> = {}\n for (const p of paths) {\n const raw = await materialize(opfsStream(accessor.rootHandle, p))\n const pStripped = p.stripPrefix\n let outPath: string\n let outData: Uint8Array\n if (decompress) {\n outPath = pStripped.endsWith('.gz') ? pStripped.slice(0, -3) : pStripped + '.out'\n outData = await gunzip(raw)\n } else {\n outPath = pStripped + '.gz'\n outData = await gzip(raw)\n }\n await opfsWrite(accessor.rootHandle, makePathSpec(outPath), outData)\n writes[outPath] = outData\n if (!keep) await opfsUnlink(accessor.rootHandle, p)\n }\n return [null, new IOResult({ writes })]\n}\n\nfunction concat(chunks: Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nexport const OPFS_GZIP = command({\n name: 'gzip',\n resource: ResourceName.OPFS,\n spec: specOf('gzip'),\n fn: gzipCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n Precision,\n ProvisionResult,\n ResourceName,\n command,\n headerAggregate,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport { stat as opfsStat } from '../../../../core/opfs/stat.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function* headStream(\n source: AsyncIterable<Uint8Array>,\n lines: number,\n bytesMode: number | null,\n): AsyncIterable<Uint8Array> {\n if (bytesMode !== null) {\n let remaining = bytesMode\n for await (const chunk of source) {\n if (chunk.byteLength <= remaining) {\n yield chunk\n remaining -= chunk.byteLength\n if (remaining <= 0) return\n } else {\n yield chunk.slice(0, remaining)\n return\n }\n }\n return\n }\n let count = 0\n const lineIter = new AsyncLineIterator(source)\n for await (const line of lineIter) {\n const out = new Uint8Array(line.byteLength + 1)\n out.set(line, 0)\n out[line.byteLength] = 0x0a\n yield out\n count += 1\n if (count >= lines) return\n }\n}\n\nasync function* headMulti(\n accessor: OPFSAccessor,\n paths: readonly PathSpec[],\n lines: number,\n bytesMode: number | null,\n): AsyncIterable<Uint8Array> {\n for (let i = 0; i < paths.length; i++) {\n const p = paths[i]\n if (p === undefined) continue\n if (paths.length > 1) {\n const prefix = i > 0 ? '\\n' : ''\n yield ENC.encode(`${prefix}==> ${p.original} <==\\n`)\n }\n const source = opfsStream(accessor.rootHandle, p)\n for await (const chunk of headStream(source, lines, bytesMode)) yield chunk\n }\n}\n\nexport async function headProvision(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<ProvisionResult> {\n const [first] = paths\n if (first === undefined) return new ProvisionResult({ command: 'head' })\n try {\n const s = await opfsStat(accessor.rootHandle, first)\n const fileSize = s.size ?? 0\n const nFlag = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : null\n const lines = nFlag !== null && Number.isFinite(nFlag) ? nFlag : 10\n const avgLine = 80\n const low = Math.min(lines * avgLine, fileSize)\n return new ProvisionResult({\n command: `head ${first.original}`,\n networkReadLow: low,\n networkReadHigh: fileSize,\n readOps: 1,\n precision: Precision.RANGE,\n })\n } catch {\n return new ProvisionResult({ command: 'head' })\n }\n}\n\nasync function headCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nRaw = typeof opts.flags.n === 'string' ? opts.flags.n : null\n const cRaw = typeof opts.flags.c === 'string' ? opts.flags.c : null\n const lineCount = nRaw !== null ? Number.parseInt(nRaw, 10) : 10\n const byteCount = cRaw !== null ? Number.parseInt(cRaw, 10) : null\n if (paths.length > 0) {\n for (const p of paths) await opfsStat(accessor.rootHandle, p)\n return [headMulti(accessor, paths, lineCount, byteCount), new IOResult()]\n }\n try {\n const source = resolveSource(opts.stdin, 'head: missing operand')\n return [headStream(source, lineCount, byteCount), new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const OPFS_HEAD = command({\n name: 'head',\n resource: ResourceName.OPFS,\n spec: specOf('head'),\n fn: headCommand,\n provision: headProvision,\n aggregate: headerAggregate,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherHead,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function headFeatherCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = featherHead(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_HEAD_FEATHER = command({\n name: 'head',\n resource: ResourceName.OPFS,\n spec: specOf('head'),\n filetype: '.feather',\n fn: headFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Head,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function headHdf5Command(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = await hdf5Head(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_HEAD_HDF5 = command({\n name: 'head',\n resource: ResourceName.OPFS,\n spec: specOf('head'),\n filetype: '.h5',\n fn: headHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetHead,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function headParquetCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = await parquetHead(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_HEAD_PARQUET = command({\n name: 'head',\n resource: ResourceName.OPFS,\n spec: specOf('head'),\n filetype: '.parquet',\n fn: headParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\ntype EncodingId = 'utf-8' | 'utf-16le' | 'utf-16be' | 'latin1' | 'ascii'\n\nconst ENCODING_ALIASES: Record<string, EncodingId> = {\n 'utf-8': 'utf-8',\n utf8: 'utf-8',\n 'utf-16le': 'utf-16le',\n utf16le: 'utf-16le',\n ucs2: 'utf-16le',\n 'ucs-2': 'utf-16le',\n 'utf-16be': 'utf-16be',\n utf16be: 'utf-16be',\n latin1: 'latin1',\n iso88591: 'latin1',\n 'iso-8859-1': 'latin1',\n ascii: 'ascii',\n}\n\nfunction normalizeEncoding(name: string): EncodingId | null {\n const lower = name.toLowerCase().replace(/_/g, '-')\n return ENCODING_ALIASES[lower] ?? ENCODING_ALIASES[lower.replace(/-/g, '')] ?? null\n}\n\nfunction decodeUtf16BE(data: Uint8Array): string {\n const view = new DataView(data.buffer, data.byteOffset, data.byteLength)\n const chars: string[] = []\n for (let i = 0; i + 1 < data.byteLength; i += 2) {\n chars.push(String.fromCharCode(view.getUint16(i, false)))\n }\n return chars.join('')\n}\n\nfunction encodeUtf16BE(text: string): Uint8Array {\n const out = new Uint8Array(text.length * 2)\n const view = new DataView(out.buffer)\n for (let i = 0; i < text.length; i++) {\n view.setUint16(i * 2, text.charCodeAt(i), false)\n }\n return out\n}\n\nfunction decodeLatin1(data: Uint8Array): string {\n let s = ''\n for (let i = 0; i < data.byteLength; i++) s += String.fromCharCode(data[i] ?? 0)\n return s\n}\n\nfunction encodeLatin1(text: string): Uint8Array {\n const out = new Uint8Array(text.length)\n for (let i = 0; i < text.length; i++) out[i] = text.charCodeAt(i) & 0xff\n return out\n}\n\nfunction decodeAscii(data: Uint8Array): string {\n let s = ''\n for (let i = 0; i < data.byteLength; i++) s += String.fromCharCode((data[i] ?? 0) & 0x7f)\n return s\n}\n\nfunction encodeAscii(text: string): Uint8Array {\n const out = new Uint8Array(text.length)\n for (let i = 0; i < text.length; i++) out[i] = text.charCodeAt(i) & 0x7f\n return out\n}\n\nfunction decodeBytes(data: Uint8Array, enc: EncodingId): string {\n if (enc === 'utf-8') return new TextDecoder('utf-8', { fatal: false }).decode(data)\n if (enc === 'utf-16le') return new TextDecoder('utf-16le', { fatal: false }).decode(data)\n if (enc === 'utf-16be') return decodeUtf16BE(data)\n if (enc === 'latin1') return decodeLatin1(data)\n return decodeAscii(data)\n}\n\nfunction encodeText(text: string, enc: EncodingId): Uint8Array {\n if (enc === 'utf-8') return new TextEncoder().encode(text)\n if (enc === 'utf-16le') {\n const out = new Uint8Array(text.length * 2)\n const view = new DataView(out.buffer)\n for (let i = 0; i < text.length; i++) view.setUint16(i * 2, text.charCodeAt(i), true)\n return out\n }\n if (enc === 'utf-16be') return encodeUtf16BE(text)\n if (enc === 'latin1') return encodeLatin1(text)\n return encodeAscii(text)\n}\n\nasync function iconvCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const fromName = typeof opts.flags.f === 'string' ? opts.flags.f : 'utf-8'\n const toName = typeof opts.flags.t === 'string' ? opts.flags.t : 'utf-8'\n const fromEnc = normalizeEncoding(fromName)\n const toEnc = normalizeEncoding(toName)\n if (fromEnc === null) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`iconv: unsupported encoding: ${fromName}\\n`),\n }),\n ]\n }\n if (toEnc === null) {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode(`iconv: unsupported encoding: ${toName}\\n`) }),\n ]\n }\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(opfsStream(accessor.rootHandle, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('iconv: missing input\\n') })]\n }\n raw = stdinData\n }\n const decoded = decodeBytes(raw, fromEnc)\n const encoded = encodeText(decoded, toEnc)\n const outPath = typeof opts.flags.o === 'string' ? opts.flags.o : null\n if (outPath !== null) {\n const spec = new PathSpec({ original: outPath, directory: outPath, resolved: true })\n await opfsWrite(accessor.rootHandle, spec, encoded)\n return [null, new IOResult({ writes: { [outPath]: encoded } })]\n }\n const result: ByteSource = encoded\n return [result, new IOResult()]\n}\n\nexport const OPFS_ICONV = command({\n name: 'iconv',\n resource: ResourceName.OPFS,\n spec: specOf('iconv'),\n fn: iconvCommand,\n write: true,\n})\n\nexport type { EncodingId as SupportedEncoding }\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction splitFields(line: string, delimiter: string | null): string[] {\n if (delimiter !== null && delimiter !== '') return line.split(delimiter)\n return line.split(/\\s+/).filter((s) => s !== '')\n}\n\nfunction buildJoinMap(\n lines: readonly string[],\n fieldIdx: number,\n delimiter: string | null,\n): Map<string, string[][]> {\n const result = new Map<string, string[][]>()\n for (const line of lines) {\n const parts = splitFields(line, delimiter)\n if (fieldIdx < parts.length) {\n const key = parts[fieldIdx] ?? ''\n const rest = parts.slice(0, fieldIdx).concat(parts.slice(fieldIdx + 1))\n const list = result.get(key)\n if (list === undefined) result.set(key, [rest])\n else list.push(rest)\n }\n }\n return result\n}\n\nfunction formatRow(\n key: string,\n rest1: readonly string[],\n rest2: readonly string[],\n oFmt: string | null,\n outSep: string,\n): string {\n if (oFmt === null) return [key, ...rest1, ...rest2].join(outSep)\n const fields: string[] = []\n for (const spec of oFmt.split(',')) {\n const trimmed = spec.trim()\n if (trimmed === '0') {\n fields.push(key)\n } else {\n const parts = trimmed.split('.')\n const fileN = Number.parseInt(parts[0] ?? '', 10)\n const fieldM = Number.parseInt(parts[1] ?? '', 10) - 1\n const src = fileN === 1 ? rest1 : rest2\n if (fieldM >= 0 && fieldM < src.length) fields.push(src[fieldM] ?? '')\n else fields.push('')\n }\n }\n return fields.join(outSep)\n}\n\nfunction firstValue<K, V>(map: Map<K, V>): V | undefined {\n for (const v of map.values()) return v\n return undefined\n}\n\nfunction joinLines(\n lines1: readonly string[],\n lines2: readonly string[],\n field1: number,\n field2: number,\n sep: string | null,\n aFlag: string | null,\n vFlag: string | null,\n eFlag: string | null,\n oFlag: string | null,\n): string[] {\n const map1 = buildJoinMap(lines1, field1, sep)\n const map2 = buildJoinMap(lines2, field2, sep)\n const outSep = sep !== null && sep !== '' ? sep : ' '\n const outLines: string[] = []\n const matchedKeys2 = new Set<string>()\n\n for (const line of lines1) {\n const parts = splitFields(line, sep)\n if (field1 >= parts.length) continue\n const key = parts[field1] ?? ''\n const rest1 = parts.slice(0, field1).concat(parts.slice(field1 + 1))\n const hit = map2.get(key)\n if (hit !== undefined) {\n matchedKeys2.add(key)\n if (vFlag === null) {\n for (const rest2 of hit) {\n outLines.push(formatRow(key, rest1, rest2, oFlag, outSep))\n }\n }\n } else {\n if (vFlag === '1' || aFlag === '1') {\n let placeholder: string[] = []\n if (oFlag !== null && eFlag !== null && map2.size > 0) {\n const sample = firstValue(map2)?.[0]\n if (sample !== undefined) placeholder = sample.map(() => eFlag)\n }\n outLines.push(formatRow(key, rest1, placeholder, oFlag, outSep))\n }\n }\n }\n\n if (aFlag === '2' || vFlag === '2') {\n for (const line of lines2) {\n const parts = splitFields(line, sep)\n if (field2 >= parts.length) continue\n const key = parts[field2] ?? ''\n if (!matchedKeys2.has(key)) {\n const rest2 = parts.slice(0, field2).concat(parts.slice(field2 + 1))\n let placeholder: string[] = []\n if (oFlag !== null && eFlag !== null && map1.size > 0) {\n const sample = firstValue(map1)?.[0]\n if (sample !== undefined) placeholder = sample.map(() => eFlag)\n }\n outLines.push(formatRow(key, placeholder, rest2, oFlag, outSep))\n }\n }\n }\n\n return outLines\n}\n\nasync function joinCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('join: requires two paths\\n') })]\n }\n const p1 = paths[0]\n const p2 = paths[1]\n if (p1 === undefined || p2 === undefined) return [null, new IOResult()]\n const field1 =\n (typeof opts.flags['1'] === 'string' ? Number.parseInt(opts.flags['1'], 10) : 1) - 1\n const field2 =\n (typeof opts.flags['2'] === 'string' ? Number.parseInt(opts.flags['2'], 10) : 1) - 1\n const sep = typeof opts.flags.t === 'string' ? opts.flags.t : null\n const aFlag = typeof opts.flags.a === 'string' ? opts.flags.a : null\n const vFlag = typeof opts.flags.v === 'string' ? opts.flags.v : null\n const eFlag = typeof opts.flags.e === 'string' ? opts.flags.e : null\n const oFlag = typeof opts.flags.o === 'string' ? opts.flags.o : null\n const data1 = DEC.decode(await materialize(opfsStream(accessor.rootHandle, p1)))\n const data2 = DEC.decode(await materialize(opfsStream(accessor.rootHandle, p2)))\n const lines1 = splitLinesNoTrailing(data1)\n const lines2 = splitLinesNoTrailing(data2)\n const out = joinLines(lines1, lines2, field1, field2, sep, aFlag, vFlag, eFlag, oFlag)\n if (out.length === 0) return [null, new IOResult()]\n const result: ByteSource = ENC.encode(out.join('\\n') + '\\n')\n return [result, new IOResult()]\n}\n\nexport const OPFS_JOIN = command({\n name: 'join',\n resource: ResourceName.OPFS,\n spec: specOf('join'),\n fn: joinCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n Precision,\n ProvisionResult,\n ResourceName,\n command,\n evalJsonlStream,\n isJsonlPath,\n isStreamableJsonlExpr,\n jqEval,\n materialize,\n parseJsonAuto,\n parseJsonPath,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport { stat as opfsStat } from '../../../core/opfs/stat.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nexport async function jqProvision(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n _opts: CommandOpts,\n): Promise<ProvisionResult> {\n const [first] = paths\n const [expr] = texts\n if (first === undefined || expr === undefined) return new ProvisionResult({ command: 'jq' })\n try {\n const s = await opfsStat(accessor.rootHandle, first)\n const fileSize = s.size ?? 0\n if (isJsonlPath(first.original) && isStreamableJsonlExpr(expr)) {\n return new ProvisionResult({\n command: `jq '${expr}' ${first.original}`,\n networkReadLow: 0,\n networkReadHigh: fileSize,\n readOps: 1,\n precision: Precision.RANGE,\n })\n }\n return new ProvisionResult({\n command: `jq '${expr}' ${first.original}`,\n networkReadLow: fileSize,\n networkReadHigh: fileSize,\n readOps: 1,\n precision: Precision.EXACT,\n })\n } catch {\n return new ProvisionResult({ command: 'jq' })\n }\n}\n\nfunction formatResult(result: unknown, raw: boolean, compact: boolean): Uint8Array {\n if (raw && typeof result === 'string') return ENC.encode(result + '\\n')\n const json = compact ? JSON.stringify(result) : JSON.stringify(result, null, 2)\n return ENC.encode(json + '\\n')\n}\n\nfunction formatResults(\n result: unknown,\n raw: boolean,\n compact: boolean,\n spread: boolean,\n): Uint8Array {\n if (spread && Array.isArray(result)) {\n const parts: Uint8Array[] = []\n for (const item of result) parts.push(formatResult(item, raw, compact))\n return concat(parts)\n }\n return formatResult(result, raw, compact)\n}\n\nfunction concat(chunks: Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nasync function readFile(accessor: OPFSAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(opfsStream(accessor.rootHandle, p))\n}\n\nasync function jqCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const expression = texts[0]\n if (expression === undefined) {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('jq: usage: jq EXPRESSION [path]\\n') }),\n ]\n }\n const raw = opts.flags.r === true\n const compact = opts.flags.c === true\n const slurp = opts.flags.s === true\n\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (isJsonlPath(first.original) && isStreamableJsonlExpr(expression)) {\n return [evalJsonlStream(opfsStream(accessor.rootHandle, first), expression), new IOResult()]\n }\n const outputs: Uint8Array[] = []\n for (const p of paths) {\n const bytes = await readFile(accessor, p)\n let data = parseJsonPath(bytes, p.original)\n if (slurp) data = Array.isArray(data) ? data : [data]\n const result = await jqEval(data, expression.trim())\n const spread = expression.includes('[]')\n outputs.push(formatResults(result, raw, compact, spread))\n }\n const out: ByteSource = concat(outputs)\n return [out, new IOResult()]\n }\n\n const bytes = await readStdinAsync(opts.stdin)\n if (bytes === null) return [null, new IOResult()]\n let data = parseJsonAuto(bytes)\n if (slurp && !Array.isArray(data)) data = [data]\n const result = await jqEval(data, expression.trim())\n const spread = expression.includes('[]')\n return [formatResults(result, raw, compact, spread), new IOResult()]\n}\n\nexport const OPFS_JQ = command({\n name: 'jq',\n resource: ResourceName.OPFS,\n spec: specOf('jq'),\n fn: jqCommand,\n provision: jqProvision,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { exists as opfsExists } from '../../../core/opfs/exists.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function lnCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('ln: usage: ln [-s] [-f] source dest\\n') }),\n ]\n }\n const source = paths[0]\n const dest = paths[1]\n if (source === undefined || dest === undefined) return [null, new IOResult()]\n if (opts.flags.n === true && (await opfsExists(accessor.rootHandle, dest))) {\n return [null, new IOResult()]\n }\n const data = await materialize(opfsStream(accessor.rootHandle, source))\n await opfsWrite(accessor.rootHandle, dest, data)\n const out: ByteSource | null =\n opts.flags.v === true ? ENC.encode(`'${source.original}' -> '${dest.original}'\\n`) : null\n return [out, new IOResult({ writes: { [dest.stripPrefix]: data } })]\n}\n\nexport const OPFS_LN = command({\n name: 'ln',\n resource: ResourceName.OPFS,\n spec: specOf('ln'),\n fn: lnCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { isNotFound, resolveDirHandle, resolveParentDirHandle } from './utils.ts'\n\nexport async function exists(root: FileSystemDirectoryHandle, path: PathSpec): Promise<boolean> {\n const virtual = path.stripPrefix\n if (virtual === '/' || virtual === '') return true\n try {\n const [parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n try {\n await parentDir.getFileHandle(name, { create: false })\n return true\n } catch (err) {\n if (!isNotFound(err) && !(err instanceof DOMException && err.name === 'TypeMismatchError')) {\n throw err\n }\n }\n try {\n await parentDir.getDirectoryHandle(name, { create: false })\n return true\n } catch (err) {\n if (isNotFound(err) || (err instanceof DOMException && err.name === 'TypeMismatchError')) {\n return false\n }\n throw err\n }\n } catch (err) {\n if (isNotFound(err)) return false\n if (err instanceof Error && err.message.startsWith('path escapes root')) return false\n if (err instanceof Error && err.message.startsWith('no parent directory')) {\n try {\n await resolveDirHandle(root, virtual, { create: false })\n return true\n } catch {\n return false\n }\n }\n throw err\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nasync function lookCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (texts.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('look: missing prefix\\n') })]\n }\n const prefix = texts[0] ?? ''\n const caseInsensitive = opts.flags.f === true\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(opfsStream(accessor.rootHandle, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('look: missing input\\n') })]\n }\n raw = stdinData\n }\n const lines = splitLinesNoTrailing(DEC.decode(raw))\n const cmpPrefix = caseInsensitive ? prefix.toLowerCase() : prefix\n const matched: string[] = []\n for (const line of lines) {\n const cmpLine = caseInsensitive ? line.toLowerCase() : line\n if (cmpLine.startsWith(cmpPrefix)) matched.push(line)\n }\n if (matched.length === 0) return [null, new IOResult({ exitCode: 1 })]\n const result: ByteSource = ENC.encode(matched.join('\\n') + '\\n')\n return [result, new IOResult()]\n}\n\nexport const OPFS_LOOK = command({\n name: 'look',\n resource: ResourceName.OPFS,\n spec: specOf('look'),\n fn: lookCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n PathSpec,\n ResourceName,\n command,\n formatLsLong,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { stat as opfsStat } from '../../../../core/opfs/stat.ts'\nimport { readdir as opfsReaddir } from '../../../../core/opfs/readdir.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nasync function lsCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const targets: PathSpec[] =\n paths.length > 0\n ? paths\n : [\n new PathSpec({\n original: opts.cwd,\n directory: opts.cwd,\n resolved: false,\n prefix: opts.mountPrefix ?? '',\n }),\n ]\n const long = opts.flags.args_l === true\n const all = opts.flags.a === true || opts.flags.A === true\n const human = opts.flags.h === true\n const reverse = opts.flags.r === true\n const classify = opts.flags.F === true\n const sortBy = opts.flags.t === true ? 'time' : opts.flags.S === true ? 'size' : 'name'\n const warnings: string[] = []\n const lines: string[] = []\n for (const p of targets) {\n let stats\n try {\n const entries = await opfsReaddir(accessor.rootHandle, p)\n stats = await Promise.all(\n entries.map((entryPath) =>\n opfsStat(\n accessor.rootHandle,\n new PathSpec({\n original: entryPath,\n directory: entryPath,\n resolved: false,\n prefix: p.prefix,\n }),\n ),\n ),\n )\n } catch (err) {\n // not a directory — try treating it as a single entry (matches real `ls foo.txt`)\n try {\n stats = [await opfsStat(accessor.rootHandle, p)]\n } catch {\n const msg = err instanceof Error ? err.message : String(err)\n warnings.push(`ls: cannot access '${p.original}': ${msg}`)\n continue\n }\n }\n let filtered = stats\n if (!all) filtered = filtered.filter((s) => !s.name.startsWith('.'))\n filtered.sort((a, b) => {\n if (sortBy === 'time') {\n return (b.modified ?? '').localeCompare(a.modified ?? '')\n }\n if (sortBy === 'size') {\n return (b.size ?? 0) - (a.size ?? 0)\n }\n return a.name.localeCompare(b.name)\n })\n if (reverse) filtered.reverse()\n if (long) {\n for (const line of formatLsLong(filtered, { human })) lines.push(line)\n } else {\n for (const s of filtered) {\n const suffix = classify && s.type === FileType.DIRECTORY ? '/' : ''\n lines.push(`${s.name}${suffix}`)\n }\n }\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n const exitCode = warnings.length > 0 && lines.length === 0 ? 1 : 0\n if (warnings.length > 0) {\n const stderr = new TextEncoder().encode(warnings.join('\\n'))\n return [out, new IOResult({ stderr, exitCode })]\n }\n return [out, new IOResult({ exitCode })]\n}\n\nexport const OPFS_LS = command({\n name: 'ls',\n resource: ResourceName.OPFS,\n spec: specOf('ls'),\n fn: lsCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { isNotFound, iterEntries, norm, resolveDirHandle } from './utils.ts'\n\nexport async function readdir(root: FileSystemDirectoryHandle, path: PathSpec): Promise<string[]> {\n const virtual = path.pattern !== null ? path.directory : path.stripPrefix\n let dir: FileSystemDirectoryHandle\n try {\n dir = await resolveDirHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) throw new Error(`not a directory: ${virtual}`)\n if (err instanceof DOMException && err.name === 'TypeMismatchError') {\n throw new Error(`not a directory: ${virtual}`)\n }\n throw err\n }\n const names: string[] = []\n for await (const [name] of iterEntries(dir)) {\n names.push(name)\n }\n const base = norm(virtual)\n const dirPrefix = base === '/' ? '/' : `${base}/`\n const mountPrefix = path.prefix\n return names.map((n) => `${mountPrefix}${dirPrefix}${n}`).sort()\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherLs,\n featherLsFallback,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport { stat as opfsStat } from '../../../../core/opfs/stat.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function lsFeatherCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n const [first] = paths\n if (first === undefined) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('ls: missing operand\\n') })]\n }\n const stat = await opfsStat(accessor.rootHandle, first)\n const meta = { size: stat.size ?? 0, modified: stat.modified, name: stat.name }\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const out: ByteSource = featherLs(raw, meta)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch {\n return [featherLsFallback(meta), new IOResult()]\n }\n}\n\nexport const OPFS_LS_FEATHER = [\n ...command({\n name: 'ls',\n resource: ResourceName.OPFS,\n spec: specOf('ls'),\n filetype: '.arrow',\n fn: lsFeatherCommand,\n }),\n ...command({\n name: 'ls',\n resource: ResourceName.OPFS,\n spec: specOf('ls'),\n filetype: '.ipc',\n fn: lsFeatherCommand,\n }),\n ...command({\n name: 'ls',\n resource: ResourceName.OPFS,\n spec: specOf('ls'),\n filetype: '.feather',\n fn: lsFeatherCommand,\n }),\n]\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Ls,\n hdf5LsFallback,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport { stat as opfsStat } from '../../../../core/opfs/stat.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function lsHdf5Command(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n const [first] = paths\n if (first === undefined) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('ls: missing operand\\n') })]\n }\n const stat = await opfsStat(accessor.rootHandle, first)\n const meta = { size: stat.size ?? 0, modified: stat.modified, name: stat.name }\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const out: ByteSource = await hdf5Ls(raw, meta)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch {\n return [hdf5LsFallback(meta), new IOResult()]\n }\n}\n\nexport const RAM_LS_HDF5 = [\n ...command({\n name: 'ls',\n resource: ResourceName.OPFS,\n spec: specOf('ls'),\n filetype: '.hdf5',\n fn: lsHdf5Command,\n }),\n ...command({\n name: 'ls',\n resource: ResourceName.OPFS,\n spec: specOf('ls'),\n filetype: '.h5',\n fn: lsHdf5Command,\n }),\n]\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetLs,\n parquetLsFallback,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport { stat as opfsStat } from '../../../../core/opfs/stat.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function lsParquetCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n const [first] = paths\n if (first === undefined) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('ls: missing operand\\n') })]\n }\n const stat = await opfsStat(accessor.rootHandle, first)\n const meta = { size: stat.size ?? 0, modified: stat.modified, name: stat.name }\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const out: ByteSource = parquetLs(raw, meta)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch {\n return [parquetLsFallback(meta), new IOResult()]\n }\n}\n\nexport const OPFS_LS_PARQUET = command({\n name: 'ls',\n resource: ResourceName.OPFS,\n spec: specOf('ls'),\n filetype: '.parquet',\n fn: lsParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n md5Hex,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { read as opfsRead } from '../../../core/opfs/read.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nasync function md5Command(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const lines: string[] = []\n if (paths.length > 0) {\n for (const p of paths) {\n const data = await opfsRead(accessor.rootHandle, p)\n lines.push(`${md5Hex(data)} ${p.original}`)\n }\n } else if (opts.stdin !== null) {\n const data = await materialize(opts.stdin)\n lines.push(md5Hex(data))\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const RAM_MD5 = command({\n name: 'md5',\n resource: ResourceName.OPFS,\n spec: specOf('md5'),\n fn: md5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { mkdir as opfsMkdir } from '../../../core/opfs/mkdir.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nasync function mkdirCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const parents = opts.flags.p === true\n if (paths.length === 0) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('mkdir: missing operand\\n'),\n }),\n ]\n }\n for (const p of paths) {\n await opfsMkdir(accessor.rootHandle, p, parents)\n }\n return [null, new IOResult()]\n}\n\nexport const OPFS_MKDIR = command({\n name: 'mkdir',\n resource: ResourceName.OPFS,\n spec: specOf('mkdir'),\n fn: mkdirCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { isNotFound, resolveDirHandle, resolveParentDirHandle, splitSegments } from './utils.ts'\n\nexport async function mkdir(\n root: FileSystemDirectoryHandle,\n path: PathSpec,\n parents = false,\n): Promise<void> {\n const virtual = path.stripPrefix\n const segs = splitSegments(virtual)\n if (segs.length === 0) return\n if (parents) {\n await resolveDirHandle(root, virtual, { create: true })\n return\n }\n let parentDir: FileSystemDirectoryHandle\n let name: string\n try {\n ;[parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) {\n throw new Error(`parent directory does not exist: ${virtual}`)\n }\n throw err\n }\n try {\n await parentDir.getDirectoryHandle(name, { create: false })\n return\n } catch (err) {\n if (!isNotFound(err)) {\n if (err instanceof DOMException && err.name === 'TypeMismatchError') {\n throw new Error(`path exists and is not a directory: ${virtual}`)\n }\n throw err\n }\n }\n await parentDir.getDirectoryHandle(name, { create: true })\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { mkdir as opfsMkdir } from '../../../core/opfs/mkdir.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nfunction randomSuffix(): string {\n const chars = 'abcdefghijklmnopqrstuvwxyz0123456789'\n let out = ''\n for (let i = 0; i < 8; i++) {\n out += chars[Math.floor(Math.random() * chars.length)] ?? ''\n }\n return out\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function mktempCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const tFlag = opts.flags.t === true\n const parent = tFlag ? '/tmp' : typeof opts.flags.p === 'string' ? opts.flags.p : '/tmp'\n const suffix = randomSuffix()\n const templateArg = texts[0]\n const template = templateArg !== undefined && templateArg !== '' ? templateArg : 'tmp.XXXXXXXXXX'\n const xRun = /X+$/.exec(template)\n let name: string\n if (xRun !== null) {\n name = template.slice(0, xRun.index) + suffix\n } else {\n name = `${template}.${suffix}`\n }\n const path = `${parent.replace(/\\/+$/, '')}/${name}`\n await opfsMkdir(accessor.rootHandle, makePathSpec(parent), true)\n if (opts.flags.d === true) {\n await opfsMkdir(accessor.rootHandle, makePathSpec(path))\n } else {\n await opfsWrite(accessor.rootHandle, makePathSpec(path), new Uint8Array(0))\n }\n const result: ByteSource = ENC.encode(path + '\\n')\n return [result, new IOResult()]\n}\n\nexport const OPFS_MKTEMP = command({\n name: 'mktemp',\n resource: ResourceName.OPFS,\n spec: specOf('mktemp'),\n fn: mktempCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { rename as opfsRename } from '../../../core/opfs/rename.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nasync function mvCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('mv: missing operand\\n'),\n }),\n ]\n }\n const sources = paths.slice(0, -1)\n const dst = paths[paths.length - 1]\n if (dst === undefined) return [null, new IOResult()]\n for (const src of sources) {\n await opfsRename(accessor.rootHandle, src, dst)\n }\n return [null, new IOResult()]\n}\n\nexport const OPFS_MV = command({\n name: 'mv',\n resource: ResourceName.OPFS,\n spec: specOf('mv'),\n fn: mvCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport {\n isNotFound,\n iterEntries,\n resolveDirHandle,\n resolveFileHandle,\n resolveParentDirHandle,\n toWritableChunk,\n} from './utils.ts'\n\nasync function copyDirRecursive(\n root: FileSystemDirectoryHandle,\n srcPath: string,\n dstPath: string,\n): Promise<void> {\n const srcDir = await resolveDirHandle(root, srcPath, { create: false })\n const dstDir = await resolveDirHandle(root, dstPath, { create: true })\n for await (const [name, handle] of iterEntries(srcDir)) {\n if (handle.kind === 'file') {\n const srcFile = await srcDir.getFileHandle(name, { create: false })\n const file = await srcFile.getFile()\n const data = new Uint8Array(await file.arrayBuffer())\n const dstFile = await dstDir.getFileHandle(name, { create: true })\n const writable = await dstFile.createWritable()\n await writable.write(toWritableChunk(data))\n await writable.close()\n } else {\n await copyDirRecursive(root, `${srcPath}/${name}`, `${dstPath}/${name}`)\n }\n }\n}\n\nexport async function rename(\n root: FileSystemDirectoryHandle,\n src: PathSpec,\n dst: PathSpec,\n): Promise<void> {\n const srcPath = src.stripPrefix\n const dstPath = dst.stripPrefix\n let srcParent: FileSystemDirectoryHandle\n let srcName: string\n try {\n ;[srcParent, srcName] = await resolveParentDirHandle(root, srcPath, { create: false })\n } catch (err) {\n if (isNotFound(err)) throw new Error(`file or directory not found: ${srcPath}`)\n throw err\n }\n let isFile = false\n try {\n await srcParent.getFileHandle(srcName, { create: false })\n isFile = true\n } catch (err) {\n if (!isNotFound(err) && !(err instanceof DOMException && err.name === 'TypeMismatchError')) {\n throw err\n }\n }\n if (!isFile) {\n try {\n await srcParent.getDirectoryHandle(srcName, { create: false })\n } catch (err) {\n if (isNotFound(err)) throw new Error(`file or directory not found: ${srcPath}`)\n throw err\n }\n }\n if (isFile) {\n const srcFile = await resolveFileHandle(root, srcPath, { create: false })\n const file = await srcFile.getFile()\n const data = new Uint8Array(await file.arrayBuffer())\n const dstFile = await resolveFileHandle(root, dstPath, { create: true })\n const writable = await dstFile.createWritable()\n await writable.write(toWritableChunk(data))\n await writable.close()\n await srcParent.removeEntry(srcName)\n return\n }\n await copyDirRecursive(root, srcPath, dstPath)\n await srcParent.removeEntry(srcName, { recursive: true })\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction shouldNumber(line: string, bodyNumbering: string, pattern: RegExp | null): boolean {\n if (bodyNumbering === 'n') return false\n if (bodyNumbering === 'a') return true\n if (bodyNumbering === 'p' && pattern !== null) return pattern.test(line)\n return line.trim() !== ''\n}\n\nfunction padLeft(value: string, width: number): string {\n return value.length >= width ? value : ' '.repeat(width - value.length) + value\n}\n\ninterface NlOptions {\n bodyNumbering: string\n start: number\n increment: number\n width: number\n separator: string\n pattern: RegExp | null\n}\n\nasync function* nlStream(\n source: AsyncIterable<Uint8Array>,\n opts: NlOptions,\n): AsyncIterable<Uint8Array> {\n let num = opts.start\n const iter = new AsyncLineIterator(source)\n for await (const raw of iter) {\n const line = DEC.decode(raw)\n if (shouldNumber(line, opts.bodyNumbering, opts.pattern)) {\n yield ENC.encode(`${padLeft(String(num), opts.width)}${opts.separator}${line}\\n`)\n num += opts.increment\n } else {\n yield ENC.encode(`${' '.repeat(opts.width)}${opts.separator}${line}\\n`)\n }\n }\n}\n\nasync function* nlMulti(\n accessor: OPFSAccessor,\n paths: readonly PathSpec[],\n opts: NlOptions,\n): AsyncIterable<Uint8Array> {\n for (const p of paths) {\n for await (const chunk of nlStream(opfsStream(accessor.rootHandle, p), opts)) yield chunk\n }\n}\n\nfunction parseOptions(flags: Record<string, string | boolean>): NlOptions {\n const b = typeof flags.b === 'string' ? flags.b : 't'\n let bodyNumbering = b\n let pattern: RegExp | null = null\n if (b.startsWith('p')) {\n bodyNumbering = 'p'\n pattern = new RegExp(b.slice(1))\n }\n const parseIntFlag = (key: 'v' | 'i' | 'w', fallback: number): number =>\n typeof flags[key] === 'string' ? Number.parseInt(flags[key], 10) : fallback\n return {\n bodyNumbering,\n start: parseIntFlag('v', 1),\n increment: parseIntFlag('i', 1),\n width: parseIntFlag('w', 6),\n separator: typeof flags.s === 'string' ? flags.s : '\\t',\n pattern,\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function nlCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nlOpts = parseOptions(opts.flags)\n if (paths.length > 0) {\n return [nlMulti(accessor, paths, nlOpts), new IOResult()]\n }\n try {\n const source = resolveSource(opts.stdin, 'nl: missing operand')\n return [nlStream(source, nlOpts), new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const OPFS_NL = command({\n name: 'nl',\n resource: ResourceName.OPFS,\n spec: specOf('nl'),\n fn: nlCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoEnds(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nasync function pasteCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const delimiter = typeof opts.flags.d === 'string' ? opts.flags.d : '\\t'\n const serial = opts.flags.s === true\n const fileLines: string[][] = []\n let stdinConsumed = false\n for (const p of paths) {\n if (p.original === '-') {\n const raw = stdinConsumed ? null : await readStdinAsync(opts.stdin)\n stdinConsumed = true\n fileLines.push(splitLinesNoEnds(raw !== null ? DEC.decode(raw) : ''))\n } else {\n const data = await materialize(opfsStream(accessor.rootHandle, p))\n fileLines.push(splitLinesNoEnds(DEC.decode(data)))\n }\n }\n if (fileLines.length === 0 && !stdinConsumed) {\n const raw = await readStdinAsync(opts.stdin)\n if (raw !== null) fileLines.push(splitLinesNoEnds(DEC.decode(raw)))\n }\n if (fileLines.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('paste: missing operand\\n') })]\n }\n let outLines: string[]\n if (serial) {\n outLines = fileLines.map((lines) => lines.join(delimiter))\n } else {\n const maxLen = Math.max(...fileLines.map((l) => l.length))\n outLines = []\n for (let i = 0; i < maxLen; i++) {\n outLines.push(fileLines.map((lines) => lines[i] ?? '').join(delimiter))\n }\n }\n const out: ByteSource = ENC.encode(outLines.join('\\n') + '\\n')\n return [out, new IOResult()]\n}\n\nexport const OPFS_PASTE = command({\n name: 'paste',\n resource: ResourceName.OPFS,\n spec: specOf('paste'),\n fn: pasteCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\ntype Hunk = [number, string[]]\n\nfunction stripPath(path: string, stripCount: number): string {\n const parts = path.split('/')\n if (stripCount < parts.length) return parts.slice(stripCount).join('/')\n return parts[parts.length - 1] ?? ''\n}\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nfunction applyHunks(\n originalLines: readonly string[],\n hunks: readonly Hunk[],\n forwardOnly: boolean,\n): string[] {\n // Walk through each hunk in order, tracking the output position as we go.\n // Each hunk's leading context copies lines verbatim from the original;\n // `-` drops a source line; `+` inserts; trailing context copies too.\n const result: string[] = []\n let srcIdx = 0\n for (const [startLine, hunkLines] of hunks) {\n const hunkStart = startLine - 1\n while (srcIdx < hunkStart && srcIdx < originalLines.length) {\n result.push(originalLines[srcIdx] ?? '')\n srcIdx += 1\n }\n if (forwardOnly) {\n const expected: string[] = []\n for (const hl of hunkLines) {\n if (hl.startsWith(' ') || hl.startsWith('-')) expected.push(hl.slice(1))\n }\n const actual = originalLines.slice(srcIdx, srcIdx + expected.length)\n let mismatch = expected.length !== actual.length\n if (!mismatch) {\n for (let i = 0; i < expected.length; i++) {\n if (expected[i] !== actual[i]) {\n mismatch = true\n break\n }\n }\n }\n if (mismatch) {\n // Skip this hunk, copy the lines it expected verbatim\n for (const _ of expected) {\n void _\n if (srcIdx < originalLines.length) {\n result.push(originalLines[srcIdx] ?? '')\n srcIdx += 1\n }\n }\n continue\n }\n }\n for (const hl of hunkLines) {\n if (hl.startsWith(' ')) {\n result.push(hl.slice(1))\n srcIdx += 1\n } else if (hl.startsWith('-')) {\n srcIdx += 1\n } else if (hl.startsWith('+')) {\n result.push(hl.slice(1))\n }\n }\n }\n while (srcIdx < originalLines.length) {\n result.push(originalLines[srcIdx] ?? '')\n srcIdx += 1\n }\n return result\n}\n\nfunction parsePatch(patchText: string, stripCount: number): Map<string, Hunk[]> {\n const files = new Map<string, Hunk[]>()\n let currentFile: string | null = null\n let currentHunks: Hunk[] = []\n let currentHunkLines: string[] = []\n let currentStart = 0\n\n for (const line of patchText.split('\\n')) {\n if (line.startsWith('--- ')) continue\n if (line.startsWith('+++ ')) {\n if (currentFile !== null && currentHunkLines.length > 0) {\n currentHunks.push([currentStart, currentHunkLines])\n }\n if (currentFile !== null) files.set(currentFile, currentHunks)\n const rawPath = (line.slice(4).split('\\t')[0] ?? '').trim()\n currentFile = '/' + stripPath(rawPath, stripCount).replace(/^\\/+/, '')\n currentHunks = []\n currentHunkLines = []\n continue\n }\n const m = /^@@ -(\\d+)/.exec(line)\n if (m !== null) {\n if (currentHunkLines.length > 0) {\n currentHunks.push([currentStart, currentHunkLines])\n }\n currentStart = Number.parseInt(m[1] ?? '0', 10)\n currentHunkLines = []\n continue\n }\n if (\n currentFile !== null &&\n (line.startsWith('+') || line.startsWith('-') || line.startsWith(' '))\n ) {\n currentHunkLines.push(line)\n }\n }\n\n if (currentFile !== null && currentHunkLines.length > 0) {\n currentHunks.push([currentStart, currentHunkLines])\n }\n if (currentFile !== null) files.set(currentFile, currentHunks)\n\n return files\n}\n\nasync function patchCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const stripCount = typeof opts.flags.p === 'string' ? Number.parseInt(opts.flags.p, 10) : 0\n const reverseMode = opts.flags.R === true\n const forwardOnly = opts.flags.N === true\n const iFlag = typeof opts.flags.i === 'string' ? opts.flags.i : null\n const mountPrefix = opts.mountPrefix ?? ''\n const stripMount = (p: string): string =>\n mountPrefix !== '' && p.startsWith(mountPrefix + '/')\n ? p.slice(mountPrefix.length)\n : p === mountPrefix\n ? '/'\n : p\n let patchData: Uint8Array | null = null\n if (iFlag !== null) {\n const resolved = stripMount(iFlag)\n const spec = new PathSpec({\n original: resolved,\n directory: resolved,\n resolved: true,\n prefix: mountPrefix,\n })\n patchData = await materialize(opfsStream(accessor.rootHandle, spec))\n } else if (paths.length > 0) {\n const first = paths[0]\n if (first !== undefined) patchData = await materialize(opfsStream(accessor.rootHandle, first))\n } else {\n patchData = await readStdinAsync(opts.stdin)\n }\n if (patchData === null || patchData.byteLength === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('patch: missing input\\n') })]\n }\n\n const patchText = DEC.decode(patchData)\n const fileHunks = parsePatch(patchText, stripCount)\n const writes: Record<string, Uint8Array> = {}\n\n for (const [filePath, hunks] of fileHunks) {\n let original = ''\n try {\n const spec = new PathSpec({ original: filePath, directory: filePath, resolved: true })\n original = DEC.decode(await materialize(opfsStream(accessor.rootHandle, spec)))\n } catch (err) {\n if (!(err instanceof Error) || !/not found/i.test(err.message)) throw err\n }\n const originalLines = splitLinesNoTrailing(original)\n\n let effective = hunks\n if (reverseMode) {\n const reversed: Hunk[] = []\n for (const [start, hunkLines] of hunks) {\n const reversedLines: string[] = []\n for (const hl of hunkLines) {\n if (hl.startsWith('+')) reversedLines.push('-' + hl.slice(1))\n else if (hl.startsWith('-')) reversedLines.push('+' + hl.slice(1))\n else reversedLines.push(hl)\n }\n reversed.push([start, reversedLines])\n }\n effective = reversed\n }\n\n const patched = applyHunks(originalLines, effective, forwardOnly)\n const patchedData = ENC.encode(patched.join('\\n') + '\\n')\n await opfsWrite(accessor.rootHandle, makePathSpec(filePath), patchedData)\n writes[filePath] = patchedData\n }\n\n return [null, new IOResult({ writes })]\n}\n\nexport const OPFS_PATCH = command({\n name: 'patch',\n resource: ResourceName.OPFS,\n spec: specOf('patch'),\n fn: patchCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type Accessor,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\n\nconst ENC = new TextEncoder()\n\nfunction normPath(p: string): string {\n const parts = p.split('/')\n const out: string[] = []\n for (const seg of parts) {\n if (seg === '' || seg === '.') continue\n if (seg === '..') {\n if (out.length > 0) out.pop()\n continue\n }\n out.push(seg)\n }\n const leading = p.startsWith('/') ? '/' : ''\n return leading + out.join('/') || (leading !== '' ? '/' : '.')\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function readlinkCommand(\n _accessor: Accessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('readlink: missing operand\\n') })]\n }\n const normalize = opts.flags.f === true || opts.flags.e === true || opts.flags.m === true\n const noNewline = opts.flags.n === true\n const results: string[] = []\n for (const p of paths) {\n let vp = p.prefix !== '' ? p.prefix + '/' + p.original.replace(/^\\/+/, '') : p.original\n if (normalize) vp = normPath(vp)\n results.push(vp)\n }\n let text = results.join('\\n')\n if (!noNewline) text += '\\n'\n const out: ByteSource = ENC.encode(text)\n return [out, new IOResult()]\n}\n\nexport const OPFS_READLINK = command({\n name: 'readlink',\n resource: ResourceName.OPFS,\n spec: specOf('readlink'),\n fn: readlinkCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type Accessor,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\n\nfunction normalize(p: string, cwd: string): string {\n const path = p.startsWith('/') ? p : `${cwd.replace(/\\/+$/, '')}/${p}`\n const parts = path.split('/').filter((s) => s !== '' && s !== '.')\n const out: string[] = []\n for (const part of parts) {\n if (part === '..') out.pop()\n else out.push(part)\n }\n return '/' + out.join('/')\n}\n\nfunction realpathCommand(\n _accessor: Accessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): CommandFnResult {\n const args = paths.length > 0 ? paths.map((p) => p.original) : texts\n const lines = args.map((a) => normalize(a, opts.cwd))\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n') + '\\n')\n return [out, new IOResult()]\n}\n\nexport const OPFS_REALPATH = command({\n name: 'realpath',\n resource: ResourceName.OPFS,\n spec: specOf('realpath'),\n fn: realpathCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction reverseString(s: string): string {\n return Array.from(s).reverse().join('')\n}\n\nasync function* revStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n const iter = new AsyncLineIterator(source)\n for await (const line of iter) {\n yield ENC.encode(reverseString(DEC.decode(line)) + '\\n')\n }\n}\n\nasync function* revMulti(\n accessor: OPFSAccessor,\n paths: readonly PathSpec[],\n): AsyncIterable<Uint8Array> {\n for (const p of paths) {\n for await (const chunk of revStream(opfsStream(accessor.rootHandle, p))) yield chunk\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function revCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length > 0) {\n return [revMulti(accessor, paths), new IOResult()]\n }\n try {\n const source = resolveSource(opts.stdin, 'rev: missing operand')\n return [revStream(source), new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const OPFS_REV = command({\n name: 'rev',\n resource: ResourceName.OPFS,\n spec: specOf('rev'),\n fn: revCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n PathSpec,\n ResourceName,\n command,\n compilePattern,\n exitOnEmpty,\n grepStream,\n materialize,\n resolveSource,\n rgFolderFiletype,\n rgFull,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type FileStat,\n} from '@struktoai/mirage-core'\nimport { readdir as opfsReaddir } from '../../../core/opfs/readdir.ts'\nimport { stat as opfsStat } from '../../../core/opfs/stat.ts'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport { find as opfsFind } from '../../../core/opfs/find.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\nimport { grepImpl } from './grep/grep.ts'\n\nconst ENC = new TextEncoder()\n\ninterface RgFlags {\n ignoreCase: boolean\n invert: boolean\n lineNumbers: boolean\n countOnly: boolean\n filesOnly: boolean\n wholeWord: boolean\n fixedString: boolean\n onlyMatching: boolean\n maxCount: number | null\n afterContext: number\n beforeContext: number\n fileType: string | null\n globPattern: string | null\n hidden: boolean\n}\n\nfunction parseRgFlags(flags: Record<string, string | boolean>): RgFlags {\n const toInt = (v: string | boolean | undefined): number | null =>\n typeof v === 'string' ? Number.parseInt(v, 10) : null\n const a = toInt(flags.A)\n const b = toInt(flags.B)\n const c = toInt(flags.C)\n return {\n ignoreCase: flags.i === true,\n invert: flags.v === true,\n lineNumbers: flags.n === true,\n countOnly: flags.c === true,\n filesOnly: flags.args_l === true,\n wholeWord: flags.w === true,\n fixedString: flags.F === true,\n onlyMatching: flags.o === true,\n maxCount: toInt(flags.m),\n afterContext: a ?? c ?? 0,\n beforeContext: b ?? c ?? 0,\n fileType: typeof flags.type === 'string' ? flags.type : null,\n globPattern: typeof flags.glob === 'string' ? flags.glob : null,\n hidden: flags.hidden === true,\n }\n}\n\nasync function rgCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const [exprText] = texts\n if (exprText === undefined) {\n return [\n null,\n new IOResult({ exitCode: 2, stderr: ENC.encode('rg: usage: rg [flags] pattern [path]\\n') }),\n ]\n }\n const flags = parseRgFlags(opts.flags)\n const [first] = paths\n\n if (first === undefined) {\n // stdin mode\n const source = resolveSource(opts.stdin, 'rg: usage: rg [flags] pattern [path]')\n const pat = compilePattern(exprText, flags.ignoreCase, flags.fixedString, flags.wholeWord)\n const stream = grepStream(source, pat, {\n invert: flags.invert,\n lineNumbers: flags.lineNumbers,\n countOnly: flags.countOnly,\n onlyMatching: flags.onlyMatching,\n maxCount: flags.maxCount,\n afterContext: flags.afterContext,\n beforeContext: flags.beforeContext,\n })\n const io = new IOResult()\n return [exitOnEmpty(stream, io), io]\n }\n\n // Detect directory vs file\n let isDir = false\n try {\n const s = await opfsStat(accessor.rootHandle, first)\n isDir = s.type === FileType.DIRECTORY\n } catch {\n try {\n await opfsReaddir(accessor.rootHandle, first)\n isDir = true\n } catch {\n // not readable\n }\n }\n\n if (isDir && opts.filetypeFns !== null && Object.keys(opts.filetypeFns).length > 0) {\n // Directory recursion with filetype-specific extraction\n const readdirFn = async (p: string): Promise<string[]> => {\n const keys = await opfsFind(accessor.rootHandle, makeSpec(p, first), { type: null })\n return keys\n }\n const statFn = (p: string): Promise<FileStat> =>\n opfsStat(accessor.rootHandle, makeSpec(p, first))\n const readBytesFn = (p: string): Promise<Uint8Array> =>\n materialize(opfsStream(accessor.rootHandle, makeSpec(p, first)))\n const warnings: string[] = []\n const results = await rgFolderFiletype(\n readdirFn,\n statFn,\n readBytesFn,\n first.original,\n exprText,\n {},\n {\n ignoreCase: flags.ignoreCase,\n invert: flags.invert,\n lineNumbers: flags.lineNumbers,\n countOnly: flags.countOnly,\n filesOnly: flags.filesOnly,\n onlyMatching: flags.onlyMatching,\n maxCount: flags.maxCount,\n fixedString: flags.fixedString,\n wholeWord: flags.wholeWord,\n fileType: flags.fileType,\n globPattern: flags.globPattern,\n hidden: flags.hidden,\n },\n warnings,\n )\n const stderr = warnings.length > 0 ? ENC.encode(warnings.join('\\n')) : undefined\n if (results.length === 0) {\n const io = new IOResult({ exitCode: 1, ...(stderr !== undefined ? { stderr } : {}) })\n return [new Uint8Array(0), io]\n }\n const out: ByteSource = ENC.encode(results.join('\\n'))\n const io = new IOResult(stderr !== undefined ? { stderr } : {})\n return [out, io]\n }\n\n const needsFull =\n flags.filesOnly ||\n flags.beforeContext > 0 ||\n flags.afterContext > 0 ||\n flags.fileType !== null ||\n flags.globPattern !== null\n if (needsFull) {\n const readdirFn = async (p: string): Promise<string[]> => {\n const keys = await opfsFind(accessor.rootHandle, makeSpec(p, first), { type: null })\n return keys\n }\n const statFn = (p: string): Promise<FileStat> =>\n opfsStat(accessor.rootHandle, makeSpec(p, first))\n const readBytesFn = (p: string): Promise<Uint8Array> =>\n materialize(opfsStream(accessor.rootHandle, makeSpec(p, first)))\n const warnings: string[] = []\n const results = await rgFull(\n readdirFn,\n statFn,\n readBytesFn,\n first.original,\n exprText,\n {\n ignoreCase: flags.ignoreCase,\n invert: flags.invert,\n lineNumbers: flags.lineNumbers,\n countOnly: flags.countOnly,\n filesOnly: flags.filesOnly,\n fixedString: flags.fixedString,\n onlyMatching: flags.onlyMatching,\n maxCount: flags.maxCount,\n wholeWord: flags.wholeWord,\n contextBefore: flags.beforeContext,\n contextAfter: flags.afterContext,\n fileType: flags.fileType,\n globPattern: flags.globPattern,\n hidden: flags.hidden,\n },\n warnings,\n )\n const stderr = warnings.length > 0 ? ENC.encode(warnings.join('\\n')) : undefined\n if (results.length === 0) {\n const io = new IOResult({ exitCode: 1, ...(stderr !== undefined ? { stderr } : {}) })\n return [new Uint8Array(0), io]\n }\n const out: ByteSource = ENC.encode(results.join('\\n'))\n const io = new IOResult(stderr !== undefined ? { stderr } : {})\n return [out, io]\n }\n\n // Fall back to single-file grep semantics for plain file mode.\n return grepImpl('rg', accessor, paths, texts, opts)\n}\n\nfunction makeSpec(path: string, template: PathSpec): PathSpec {\n // Reuse prefix from the first scope so downstream fs helpers treat the\n // absolute path as a normal mount-relative path.\n return new PathSpec({\n original: path,\n directory: path,\n resolved: false,\n prefix: template.prefix,\n })\n}\n\nexport const OPFS_RG = command({\n name: 'rg',\n resource: ResourceName.OPFS,\n spec: specOf('rg'),\n fn: rgCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { rmdir as opfsRmdir } from '../../../core/opfs/rmdir.ts'\nimport { stat as opfsStat } from '../../../core/opfs/stat.ts'\nimport { unlink as opfsUnlink } from '../../../core/opfs/unlink.ts'\nimport { rmR as opfsRmR } from '../../../core/opfs/rm.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nasync function rmCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('rm: missing operand\\n'),\n }),\n ]\n }\n const recursive = opts.flags.r === true || opts.flags.R === true\n for (const p of paths) {\n let isDir = false\n try {\n const st = await opfsStat(accessor.rootHandle, p)\n isDir = st.type === FileType.DIRECTORY\n } catch {\n isDir = false\n }\n if (isDir) {\n if (recursive) {\n await opfsRmR(accessor.rootHandle, p)\n } else {\n await opfsRmdir(accessor.rootHandle, p)\n }\n } else {\n await opfsUnlink(accessor.rootHandle, p)\n }\n }\n return [null, new IOResult()]\n}\n\nexport const OPFS_RM = command({\n name: 'rm',\n resource: ResourceName.OPFS,\n spec: specOf('rm'),\n fn: rmCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { isNotFound, resolveParentDirHandle } from './utils.ts'\n\nexport async function rmdir(root: FileSystemDirectoryHandle, path: PathSpec): Promise<void> {\n const virtual = path.stripPrefix\n let parentDir: FileSystemDirectoryHandle\n let name: string\n try {\n ;[parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) return\n if (err instanceof Error && err.message.startsWith('no parent directory')) return\n throw err\n }\n try {\n await parentDir.removeEntry(name, { recursive: false })\n } catch (err) {\n if (isNotFound(err)) return\n throw err\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { isNotFound, resolveParentDirHandle } from './utils.ts'\n\nexport async function rmR(root: FileSystemDirectoryHandle, path: PathSpec): Promise<void> {\n const virtual = path.stripPrefix\n let parentDir: FileSystemDirectoryHandle\n let name: string\n try {\n ;[parentDir, name] = await resolveParentDirHandle(root, virtual, { create: false })\n } catch (err) {\n if (isNotFound(err)) return\n if (err instanceof Error && err.message.startsWith('no parent directory')) return\n throw err\n }\n try {\n await parentDir.removeEntry(name, { recursive: true })\n } catch (err) {\n if (isNotFound(err)) return\n throw err\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n executeProgram,\n materialize,\n parseOneCommand,\n parseProgram,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type SedCommand,\n} from '@struktoai/mirage-core'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nasync function readFile(accessor: OPFSAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(opfsStream(accessor.rootHandle, p))\n}\n\nasync function sedCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const script = texts[0]\n if (script === undefined) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('sed: missing script\\n') })]\n }\n const suppress = opts.flags.n === true\n const inPlace = opts.flags.i === true\n let commands: SedCommand[]\n try {\n if (script.includes(';') || script.includes('{')) {\n commands = parseProgram(script)\n } else {\n commands = [parseOneCommand(script)[0]]\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const first = commands[0]\n const isSimpleSub =\n commands.length === 1 &&\n first?.cmd === 's' &&\n (first.addrStart === null || first.addrStart === undefined) &&\n !suppress\n\n if (paths.length > 0) {\n if (isSimpleSub) {\n const pat = first.pattern ?? ''\n const repl = first.replacement ?? ''\n const ef = first.exprFlags ?? ''\n const ignoreCase = ef.includes('i')\n const global = ef.includes('g')\n const flags = (ignoreCase ? 'i' : '') + (global ? 'g' : '')\n if (inPlace) {\n const writes: Record<string, Uint8Array> = {}\n for (const p of paths) {\n const data = await readFile(accessor, p)\n const text = DEC.decode(data)\n const newText = text.replace(new RegExp(pat, flags), repl)\n const newData = ENC.encode(newText)\n await opfsWrite(accessor.rootHandle, p, newData)\n writes[p.stripPrefix] = newData\n }\n return [null, new IOResult({ writes, cache: paths.map((p) => p.stripPrefix) })]\n }\n const outputs: string[] = []\n for (const p of paths) {\n const data = await readFile(accessor, p)\n const text = DEC.decode(data)\n outputs.push(text.replace(new RegExp(pat, flags), repl))\n }\n const out: ByteSource = ENC.encode(outputs.join(''))\n return [out, new IOResult({ cache: paths.map((p) => p.stripPrefix) })]\n }\n\n const modifying = inPlace && commands.some((c) => c.cmd === 's' || c.cmd === 'd')\n const allOutputs: string[] = []\n const writes: Record<string, Uint8Array> = {}\n for (const p of paths) {\n const data = await readFile(accessor, p)\n const text = DEC.decode(data)\n const result = executeProgram(text, commands, suppress)\n if (modifying) {\n const newData = ENC.encode(result)\n await opfsWrite(accessor.rootHandle, p, newData)\n writes[p.stripPrefix] = newData\n } else {\n allOutputs.push(result)\n }\n }\n if (modifying) {\n return [null, new IOResult({ writes, cache: paths.map((p) => p.stripPrefix) })]\n }\n const out: ByteSource = ENC.encode(allOutputs.join('\\n'))\n return [out, new IOResult()]\n }\n\n const raw = await readStdinAsync(opts.stdin)\n if (raw === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('sed: missing operand\\n') })]\n }\n const text = DEC.decode(raw)\n const result = executeProgram(text, commands, suppress)\n return [ENC.encode(result), new IOResult()]\n}\n\nexport const OPFS_SED = command({\n name: 'sed',\n resource: ResourceName.OPFS,\n spec: specOf('sed'),\n fn: sedCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n resolveSource,\n sha256Hex,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nasync function hashStream(source: AsyncIterable<Uint8Array>): Promise<string> {\n const data = await materialize(source)\n return sha256Hex(data)\n}\n\nasync function* sha256SingleStream(\n source: AsyncIterable<Uint8Array>,\n label: string,\n): AsyncIterable<Uint8Array> {\n const digest = await hashStream(source)\n yield ENC.encode(`${digest} ${label}\\n`)\n}\n\nasync function* sha256Multi(\n accessor: OPFSAccessor,\n paths: readonly PathSpec[],\n): AsyncIterable<Uint8Array> {\n for (const p of paths) {\n const digest = await hashStream(opfsStream(accessor.rootHandle, p))\n yield ENC.encode(`${digest} ${p.stripPrefix}\\n`)\n }\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function sha256Check(accessor: OPFSAccessor, p: PathSpec): Promise<[Uint8Array, number]> {\n const data = DEC.decode(await materialize(opfsStream(accessor.rootHandle, p)))\n const lines: string[] = []\n let failed = false\n for (const line of data.split('\\n')) {\n if (line.trim() === '') continue\n const idx = line.indexOf(' ')\n if (idx < 0) continue\n const expected = line.slice(0, idx)\n const filename = line.slice(idx + 2)\n const digest = await hashStream(opfsStream(accessor.rootHandle, makePathSpec(filename)))\n if (digest === expected) lines.push(`${filename}: OK`)\n else {\n lines.push(`${filename}: FAILED`)\n failed = true\n }\n }\n return [ENC.encode(lines.join('\\n') + '\\n'), failed ? 1 : 0]\n}\n\nasync function sha256sumCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const check = opts.flags.c === true\n if (check && paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const [out, exitCode] = await sha256Check(accessor, first)\n const result: ByteSource = out\n return [result, new IOResult({ exitCode })]\n }\n if (paths.length > 0) {\n return [sha256Multi(accessor, paths), new IOResult({ cache: paths.map((p) => p.stripPrefix) })]\n }\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, 'sha256sum: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n return [sha256SingleStream(source, '-'), new IOResult()]\n}\n\nexport const RAM_SHA256SUM = command({\n name: 'sha256sum',\n resource: ResourceName.OPFS,\n spec: specOf('sha256sum'),\n fn: sha256sumCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction shuffleInPlace(arr: string[]): void {\n for (let i = arr.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1))\n const tmp = arr[i] ?? ''\n arr[i] = arr[j] ?? ''\n arr[j] = tmp\n }\n}\n\nfunction choicesWithReplacement(items: readonly string[], k: number): string[] {\n if (items.length === 0) return []\n const out: string[] = []\n for (let i = 0; i < k; i++) {\n out.push(items[Math.floor(Math.random() * items.length)] ?? '')\n }\n return out\n}\n\nasync function shufCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nFlag = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : null\n const echoMode = opts.flags.e === true\n const zeroSep = opts.flags.z === true\n const repeat = opts.flags.r === true\n const sep = zeroSep ? '\\x00' : '\\n'\n\n const processItems = (items: string[]): string[] => {\n if (repeat) {\n const count = nFlag ?? items.length\n return choicesWithReplacement(items, count)\n }\n shuffleInPlace(items)\n if (nFlag !== null) return items.slice(0, nFlag)\n return items\n }\n\n if (echoMode) {\n const base = paths.length > 0 ? paths.map((p) => p.stripPrefix) : [...texts]\n const out = processItems(base)\n const result: ByteSource = ENC.encode(out.join(sep) + sep)\n return [result, new IOResult()]\n }\n\n if (paths.length > 0) {\n const allLines: string[] = []\n for (const p of paths) {\n const data = DEC.decode(await materialize(opfsStream(accessor.rootHandle, p)))\n if (zeroSep) for (const l of data.split('\\x00')) allLines.push(l)\n else for (const l of splitLinesNoTrailing(data)) allLines.push(l)\n }\n const out = processItems(allLines)\n const result: ByteSource = ENC.encode(out.join(sep) + sep)\n return [result, new IOResult()]\n }\n\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('shuf: missing operand\\n') })]\n }\n const text = DEC.decode(stdinData)\n const lines = zeroSep ? text.split('\\x00') : splitLinesNoTrailing(text)\n const out = processItems(lines)\n const result: ByteSource = ENC.encode(out.join(sep) + sep)\n return [result, new IOResult()]\n}\n\nexport const OPFS_SHUF = command({\n name: 'shuf',\n resource: ResourceName.OPFS,\n spec: specOf('shuf'),\n fn: shufCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n compareKeys,\n materialize,\n readStdinAsync,\n sortKey,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type SortKeyOptions,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction parseKeyOptions(flags: Record<string, string | boolean>): SortKeyOptions {\n return {\n keyField: typeof flags.k === 'string' ? Number.parseInt(flags.k, 10) : null,\n fieldSep: typeof flags.t === 'string' ? flags.t : null,\n ignoreCase: flags.f === true,\n numeric: flags.n === true,\n humanNumeric: flags.h === true,\n version: flags.V === true,\n month: flags.M === true,\n }\n}\n\nfunction sortAndDedupe(\n lines: string[],\n opts: SortKeyOptions,\n reverse: boolean,\n unique: boolean,\n): string[] {\n const keyed = lines.map((l) => ({ l, k: sortKey(l, opts) }))\n keyed.sort((a, b) => compareKeys(a.k, b.k))\n let sorted = keyed.map((x) => x.l)\n if (reverse) sorted.reverse()\n if (unique) {\n const seen = new Set<string>()\n sorted = sorted.filter((l) => {\n if (seen.has(l)) return false\n seen.add(l)\n return true\n })\n }\n return sorted\n}\n\nfunction splitLinesNoEnds(text: string): string[] {\n if (text === '') return []\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped.split('\\n')\n}\n\nasync function readFile(accessor: OPFSAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(opfsStream(accessor.rootHandle, p))\n}\n\nasync function sortCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const keyOpts = parseKeyOptions(opts.flags)\n const reverse = opts.flags.r === true\n const unique = opts.flags.u === true\n let allLines: string[] = []\n if (paths.length > 0) {\n for (const p of paths) {\n const data = DEC.decode(await readFile(accessor, p))\n allLines = allLines.concat(splitLinesNoEnds(data))\n }\n } else {\n const raw = await readStdinAsync(opts.stdin)\n if (raw === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('sort: missing operand\\n') })]\n }\n allLines = splitLinesNoEnds(DEC.decode(raw))\n }\n const sorted = sortAndDedupe(allLines, keyOpts, reverse, unique)\n const output = sorted.join('\\n')\n const out: ByteSource = output === '' ? new Uint8Array(0) : ENC.encode(output + '\\n')\n return [out, new IOResult()]\n}\n\nexport const OPFS_SORT = command({\n name: 'sort',\n resource: ResourceName.OPFS,\n spec: specOf('sort'),\n fn: sortCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n PathSpec,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nfunction alphaSuffix(index: number, length: number): string {\n const chars: string[] = []\n let n = index\n for (let i = 0; i < length; i++) {\n chars.push(String.fromCharCode('a'.charCodeAt(0) + (n % 26)))\n n = Math.floor(n / 26)\n }\n return chars.reverse().join('')\n}\n\nfunction numericSuffix(index: number, length: number): string {\n const s = String(index)\n return s.length >= length ? s : '0'.repeat(length - s.length) + s\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function splitCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const prefixPath = paths.length >= 2 && paths[1] !== undefined ? paths[1].stripPrefix : 'x'\n const linesFlag = typeof opts.flags.l === 'string' ? opts.flags.l : null\n const bFlag = typeof opts.flags.b === 'string' ? opts.flags.b : null\n const nFlag = typeof opts.flags.n === 'string' ? opts.flags.n : null\n const aFlag = typeof opts.flags.a === 'string' ? opts.flags.a : null\n const dFlag = opts.flags.d === true\n const linesPerFile =\n linesFlag !== null\n ? Number.parseInt(linesFlag, 10)\n : bFlag === null && nFlag === null\n ? 1000\n : 0\n const byteLimit = bFlag !== null ? Number.parseInt(bFlag, 10) : 0\n const nChunks = nFlag !== null ? Number.parseInt(nFlag, 10) : 0\n const suffixLen = aFlag !== null ? Number.parseInt(aFlag, 10) : 2\n const suffixFn = dFlag ? numericSuffix : alphaSuffix\n\n let source: AsyncIterable<Uint8Array>\n const first = paths[0]\n if (first !== undefined) {\n source = opfsStream(accessor.rootHandle, first)\n } else {\n try {\n source = resolveSource(opts.stdin, 'split: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n\n const writes: Record<string, Uint8Array> = {}\n let fileIdx = 0\n\n if (nChunks > 0) {\n const chunks: Uint8Array[] = []\n let total = 0\n for await (const c of source) {\n chunks.push(c)\n total += c.byteLength\n }\n const allData = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n allData.set(c, offset)\n offset += c.byteLength\n }\n const chunkSize = Math.max(1, Math.ceil(total / nChunks))\n offset = 0\n for (let i = 0; i < nChunks; i++) {\n const part = allData.slice(offset, offset + chunkSize)\n if (part.byteLength === 0) break\n const outPath = prefixPath + suffixFn(i, suffixLen)\n await opfsWrite(accessor.rootHandle, makePathSpec(outPath), part)\n writes[outPath] = part\n offset += chunkSize\n }\n } else if (byteLimit > 0) {\n let buf = new Uint8Array(0)\n for await (const c of source) {\n const merged = new Uint8Array(buf.byteLength + c.byteLength)\n merged.set(buf, 0)\n merged.set(c, buf.byteLength)\n buf = merged\n while (buf.byteLength >= byteLimit) {\n const outPath = prefixPath + suffixFn(fileIdx, suffixLen)\n const data = buf.slice(0, byteLimit)\n await opfsWrite(accessor.rootHandle, makePathSpec(outPath), data)\n writes[outPath] = data\n buf = buf.slice(byteLimit)\n fileIdx += 1\n }\n }\n if (buf.byteLength > 0) {\n const outPath = prefixPath + suffixFn(fileIdx, suffixLen)\n await opfsWrite(accessor.rootHandle, makePathSpec(outPath), buf)\n writes[outPath] = buf\n }\n } else {\n const lineBuf: Uint8Array[] = []\n const iter = new AsyncLineIterator(source)\n for await (const line of iter) {\n lineBuf.push(line)\n if (lineBuf.length >= linesPerFile) {\n const outPath = prefixPath + suffixFn(fileIdx, suffixLen)\n const data = joinLines(lineBuf)\n await opfsWrite(accessor.rootHandle, makePathSpec(outPath), data)\n writes[outPath] = data\n lineBuf.length = 0\n fileIdx += 1\n }\n }\n if (lineBuf.length > 0) {\n const outPath = prefixPath + suffixFn(fileIdx, suffixLen)\n const data = joinLines(lineBuf)\n await opfsWrite(accessor.rootHandle, makePathSpec(outPath), data)\n writes[outPath] = data\n }\n }\n return [null, new IOResult({ writes })]\n}\n\nfunction joinLines(lines: readonly Uint8Array[]): Uint8Array {\n let total = 0\n for (const l of lines) total += l.byteLength + 1\n const out = new Uint8Array(total)\n let offset = 0\n for (const l of lines) {\n out.set(l, offset)\n offset += l.byteLength\n out[offset] = 0x0a\n offset += 1\n }\n return out\n}\n\nexport const OPFS_SPLIT = command({\n name: 'split',\n resource: ResourceName.OPFS,\n spec: specOf('split'),\n fn: splitCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n ProvisionResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type FileStat,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stat as opfsStat } from '../../../../core/opfs/stat.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst TYPE_LABELS: Record<string, string> = {\n [FileType.DIRECTORY]: 'directory',\n [FileType.TEXT]: 'regular file',\n [FileType.BINARY]: 'regular file',\n [FileType.JSON]: 'regular file',\n [FileType.CSV]: 'regular file',\n}\n\nfunction formatStat(fmt: string, s: FileStat): string {\n return fmt.replace(/%(.)/g, (_, spec: string) => {\n if (spec === 'n') return s.name\n if (spec === 's') return String(s.size ?? 0)\n if (spec === 'F') return s.type ? (TYPE_LABELS[s.type] ?? 'regular file') : 'regular file'\n if (spec === 'y') return s.modified ?? ''\n return '?'\n })\n}\n\nexport function statProvision(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): ProvisionResult {\n const [first] = paths\n return new ProvisionResult({\n command: first !== undefined ? `stat ${first.original}` : 'stat',\n })\n}\n\nasync function statCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('stat: missing operand\\n'),\n }),\n ]\n }\n const fmt =\n typeof opts.flags.c === 'string'\n ? opts.flags.c\n : typeof opts.flags.f === 'string'\n ? opts.flags.f\n : null\n const lines: string[] = []\n for (const p of paths) {\n const s = await opfsStat(accessor.rootHandle, p)\n if (fmt !== null) {\n lines.push(formatStat(fmt, s))\n } else {\n const sizeStr = s.size === null ? 'None' : String(s.size)\n const modStr = s.modified ?? 'None'\n const typeStr = s.type ?? 'None'\n lines.push(`name=${s.name} size=${sizeStr} modified=${modStr} type=${typeStr}`)\n }\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const OPFS_STAT = command({\n name: 'stat',\n resource: ResourceName.OPFS,\n spec: specOf('stat'),\n fn: statCommand,\n provision: statProvision,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n featherStat,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statFeatherCommand(\n accessor: OPFSAccessor,\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(opfsStream(accessor.rootHandle, first))\n const out: ByteSource = featherStat(raw)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_STAT_FEATHER = command({\n name: 'stat',\n resource: ResourceName.OPFS,\n spec: specOf('stat'),\n filetype: '.feather',\n fn: statFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n hdf5Stat,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statHdf5Command(\n accessor: OPFSAccessor,\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(opfsStream(accessor.rootHandle, first))\n const out: ByteSource = await hdf5Stat(raw)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_STAT_HDF5 = command({\n name: 'stat',\n resource: ResourceName.OPFS,\n spec: specOf('stat'),\n filetype: '.h5',\n fn: statHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n parquetStat,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statParquetCommand(\n accessor: OPFSAccessor,\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(opfsStream(accessor.rootHandle, first))\n const out: ByteSource = parquetStat(raw)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_STAT_PARQUET = command({\n name: 'stat',\n resource: ResourceName.OPFS,\n spec: specOf('stat'),\n filetype: '.parquet',\n fn: statParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nfunction extractStrings(data: Uint8Array, minLen: number): string[] {\n const out: string[] = []\n let current: number[] = []\n for (let i = 0; i < data.byteLength; i++) {\n const b = data[i] ?? 0\n if (b >= 0x20 && b <= 0x7e) {\n current.push(b)\n } else {\n if (current.length >= minLen) {\n out.push(String.fromCharCode(...current))\n }\n current = []\n }\n }\n if (current.length >= minLen) {\n out.push(String.fromCharCode(...current))\n }\n return out\n}\n\nasync function stringsCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const minLen = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 4\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(opfsStream(accessor.rootHandle, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('strings: missing input\\n') })]\n }\n raw = stdinData\n }\n const matches = extractStrings(raw, minLen)\n const output = matches.length > 0 ? matches.join('\\n') + '\\n' : ''\n const result: ByteSource = ENC.encode(output)\n return [result, new IOResult()]\n}\n\nexport const OPFS_STRINGS = command({\n name: 'strings',\n resource: ResourceName.OPFS,\n spec: specOf('strings'),\n fn: stringsCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function collectLines(source: AsyncIterable<Uint8Array>): Promise<Uint8Array[]> {\n const lines: Uint8Array[] = []\n const iter = new AsyncLineIterator(source)\n for await (const line of iter) lines.push(line)\n return lines\n}\n\nasync function tacCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = opfsStream(accessor.rootHandle, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'tac: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n const lines = await collectLines(source)\n lines.reverse()\n let total = 0\n for (const l of lines) total += l.byteLength + 1\n const out = new Uint8Array(total)\n let offset = 0\n for (const l of lines) {\n out.set(l, offset)\n offset += l.byteLength\n out[offset] = 0x0a\n offset += 1\n }\n const result: ByteSource = out\n return [result, new IOResult({ cache })]\n}\n\nexport const OPFS_TAC = command({\n name: 'tac',\n resource: ResourceName.OPFS,\n spec: specOf('tac'),\n fn: tacCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n countNewlines,\n headerAggregate,\n materialize,\n parseN,\n readStdinAsync,\n specOf,\n tailBytes,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function readFile(accessor: OPFSAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(opfsStream(accessor.rootHandle, p))\n}\n\nasync function tailCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nRaw = typeof opts.flags.n === 'string' ? opts.flags.n : null\n const cRaw = typeof opts.flags.c === 'string' ? opts.flags.c : null\n const qFlag = opts.flags.q === true\n const vFlag = opts.flags.v === true\n const [lines, plusMode] = parseN(nRaw)\n const bytesMode = cRaw !== null ? Number.parseInt(cRaw, 10) : null\n\n if (paths.length > 0) {\n const chunks: Uint8Array[] = []\n const cache: string[] = []\n const showHeaders = (vFlag || paths.length > 1) && !qFlag\n for (let i = 0; i < paths.length; i++) {\n const p = paths[i]\n if (p === undefined) continue\n const raw = await readFile(accessor, p)\n if (showHeaders) {\n const header = i > 0 ? `\\n==> ${p.original} <==\\n` : `==> ${p.original} <==\\n`\n chunks.push(ENC.encode(header))\n }\n if (bytesMode !== null) {\n chunks.push(bytesMode === 0 ? new Uint8Array(0) : raw.slice(-bytesMode))\n if (bytesMode >= raw.byteLength) cache.push(p.original)\n } else {\n chunks.push(tailBytes(raw, lines, null, plusMode))\n if (!plusMode && lines >= countNewlines(raw)) cache.push(p.original)\n }\n }\n const out: ByteSource = concat(chunks)\n return [out, new IOResult({ cache })]\n }\n const raw = await readStdinAsync(opts.stdin)\n if (raw === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n if (bytesMode !== null) {\n const out: ByteSource = bytesMode === 0 ? new Uint8Array(0) : raw.slice(-bytesMode)\n return [out, new IOResult()]\n }\n return [tailBytes(raw, lines, null, plusMode), new IOResult()]\n}\n\nfunction concat(chunks: Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nexport const OPFS_TAIL = command({\n name: 'tail',\n resource: ResourceName.OPFS,\n spec: specOf('tail'),\n fn: tailCommand,\n aggregate: headerAggregate,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n featherTail,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailFeatherCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = featherTail(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_TAIL_FEATHER = command({\n name: 'tail',\n resource: ResourceName.OPFS,\n spec: specOf('tail'),\n filetype: '.feather',\n fn: tailFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n hdf5Tail,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailHdf5Command(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = await hdf5Tail(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_TAIL_HDF5 = command({\n name: 'tail',\n resource: ResourceName.OPFS,\n spec: specOf('tail'),\n filetype: '.h5',\n fn: tailHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n parquetTail,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailParquetCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const result = await parquetTail(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_TAIL_PARQUET = command({\n name: 'tail',\n resource: ResourceName.OPFS,\n spec: specOf('tail'),\n filetype: '.parquet',\n fn: tailParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n gunzip,\n gzip,\n materialize,\n readTar,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type TarEntry,\n writeTar,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { mkdir as opfsMkdir } from '../../../core/opfs/mkdir.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function compress(data: Uint8Array, z: boolean): Promise<Uint8Array> {\n if (!z) return data\n return gzip(data)\n}\n\nasync function decompress(data: Uint8Array, z: boolean): Promise<Uint8Array> {\n if (!z) return data\n return gunzip(data)\n}\n\nasync function tarCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const create = opts.flags.c === true\n const extract = opts.flags.x === true\n const list = opts.flags.t === true\n const z = opts.flags.z === true\n if (opts.flags.j === true || opts.flags.J === true) {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('tar: bzip2/xz not supported\\n') }),\n ]\n }\n const fFlag = typeof opts.flags.f === 'string' ? opts.flags.f : null\n const CFlag = typeof opts.flags.C === 'string' ? opts.flags.C : null\n const stripN =\n typeof opts.flags.strip_components === 'string'\n ? Number.parseInt(opts.flags.strip_components, 10)\n : 0\n const exclude = typeof opts.flags.exclude === 'string' ? opts.flags.exclude : null\n const archivePath = fFlag\n const destPath = CFlag ?? '/'\n\n if (create) {\n if (archivePath === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tar: -f is required\\n') })]\n }\n const filtered =\n exclude !== null\n ? paths.filter((p) => !p.original.split('/').pop()?.includes(exclude))\n : paths\n const entries: TarEntry[] = []\n for (const p of filtered) {\n const data = await materialize(opfsStream(accessor.rootHandle, p))\n entries.push({ name: p.original.replace(/^\\/+/, ''), data, isFile: true })\n }\n const archive = await compress(writeTar(entries), z)\n await opfsWrite(accessor.rootHandle, makePathSpec(archivePath), archive)\n return [null, new IOResult({ writes: { [archivePath]: archive } })]\n }\n\n if (list) {\n if (archivePath === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tar: -f is required\\n') })]\n }\n const raw = await materialize(opfsStream(accessor.rootHandle, makePathSpec(archivePath)))\n const data = await decompress(raw, z)\n const entries = readTar(data)\n const out: ByteSource = ENC.encode(entries.map((e) => e.name).join('\\n') + '\\n')\n return [out, new IOResult()]\n }\n\n if (extract) {\n if (archivePath === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tar: -f is required\\n') })]\n }\n const raw = await materialize(opfsStream(accessor.rootHandle, makePathSpec(archivePath)))\n const data = await decompress(raw, z)\n const writes: Record<string, Uint8Array> = {}\n for (const entry of readTar(data)) {\n if (!entry.isFile) continue\n const nameParts = entry.name.split('/')\n const stripped = stripN > 0 ? nameParts.slice(stripN) : nameParts\n if (stripped.length === 0) continue\n const outPath = destPath.replace(/\\/+$/, '') + '/' + stripped.join('/')\n const parts = outPath.replace(/^\\/+|\\/+$/g, '').split('/')\n for (let pi = 1; pi < parts.length; pi++) {\n const d = '/' + parts.slice(0, pi).join('/')\n try {\n await opfsMkdir(accessor.rootHandle, makePathSpec(d))\n } catch {\n // already exists\n }\n }\n await opfsWrite(accessor.rootHandle, makePathSpec(outPath), entry.data)\n writes[outPath] = entry.data\n }\n return [null, new IOResult({ writes })]\n }\n\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('tar: must specify -c, -x, or -t\\n') }),\n ]\n}\n\nexport const OPFS_TAR = command({\n name: 'tar',\n resource: ResourceName.OPFS,\n spec: specOf('tar'),\n fn: tarCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function teeCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tee: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const stdinData = await readStdinAsync(opts.stdin)\n const raw: Uint8Array = stdinData ?? ENC.encode(texts.join(' '))\n let writeData = raw\n if (opts.flags.a === true) {\n try {\n const existing = await materialize(opfsStream(accessor.rootHandle, first))\n writeData = new Uint8Array(existing.byteLength + raw.byteLength)\n writeData.set(existing, 0)\n writeData.set(raw, existing.byteLength)\n } catch (err) {\n if (!(err instanceof Error) || !/not found/i.test(err.message)) throw err\n }\n }\n await opfsWrite(accessor.rootHandle, first, writeData)\n const out: ByteSource = raw\n return [\n out,\n new IOResult({\n writes: { [first.stripPrefix]: writeData },\n cache: [first.stripPrefix],\n }),\n ]\n}\n\nexport const OPFS_TEE = command({\n name: 'tee',\n resource: ResourceName.OPFS,\n spec: specOf('tee'),\n fn: teeCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { exists as opfsExists } from '../../../core/opfs/exists.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function touchCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('touch: missing operand\\n') })]\n }\n const createOnly = opts.flags.c === true\n for (const p of paths) {\n if (createOnly) continue\n if (!(await opfsExists(accessor.rootHandle, p))) {\n await opfsWrite(accessor.rootHandle, p, new Uint8Array(0))\n }\n }\n return [null, new IOResult()]\n}\n\nexport const OPFS_TOUCH = command({\n name: 'touch',\n resource: ResourceName.OPFS,\n spec: specOf('touch'),\n fn: touchCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n interpretEscapes,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction expandRanges(s: string): string {\n let out = ''\n let i = 0\n while (i < s.length) {\n if (i + 2 < s.length && s[i + 1] === '-') {\n const start = s.charCodeAt(i)\n const end = s.charCodeAt(i + 2)\n for (let c = start; c <= end; c++) out += String.fromCharCode(c)\n i += 3\n } else {\n out += s[i] ?? ''\n i += 1\n }\n }\n return out\n}\n\ninterface TrOptions {\n set1: string\n set2: string\n del: boolean\n squeeze: boolean\n table: Map<string, string> | null\n}\n\nasync function* trStream(\n source: AsyncIterable<Uint8Array>,\n opts: TrOptions,\n): AsyncIterable<Uint8Array> {\n const squeezeSet: Set<string> =\n opts.squeeze && opts.set2 !== ''\n ? new Set(opts.set2)\n : opts.squeeze\n ? new Set(opts.set1)\n : new Set()\n let prevChar = ''\n for await (const chunk of source) {\n const text = DEC.decode(chunk)\n let result: string\n if (opts.del) {\n const set1Set = new Set(opts.set1)\n result = Array.from(text)\n .filter((c) => !set1Set.has(c))\n .join('')\n } else if (opts.table !== null) {\n result = Array.from(text)\n .map((c) => opts.table?.get(c) ?? c)\n .join('')\n } else {\n result = text\n }\n if (squeezeSet.size > 0) {\n const squeezed: string[] = []\n for (const c of result) {\n if (squeezeSet.has(c) && c === prevChar) continue\n squeezed.push(c)\n prevChar = c\n }\n result = squeezed.join('')\n } else if (result.length > 0) {\n prevChar = result[result.length - 1] ?? ''\n }\n yield ENC.encode(result)\n }\n}\n\nfunction buildOptions(\n texts: readonly string[],\n flags: Record<string, string | boolean>,\n): TrOptions {\n if (texts.length === 0) throw new Error('tr: usage: tr [-d] [-s] [-c] set1 [set2] [path]')\n let set1 = expandRanges(interpretEscapes(texts[0] ?? ''))\n if (flags.c === true) {\n let allChars = ''\n for (let i = 0; i < 128; i++) allChars += String.fromCharCode(i)\n const s1 = new Set(set1)\n set1 = Array.from(allChars)\n .filter((c) => !s1.has(c))\n .join('')\n }\n let set2 = texts.length >= 2 ? expandRanges(interpretEscapes(texts[1] ?? '')) : ''\n if (set2 !== '' && set2.length < set1.length) {\n const last = set2[set2.length - 1] ?? ''\n set2 = set2 + last.repeat(set1.length - set2.length)\n }\n const del = flags.d === true\n const squeeze = flags.s === true\n let table: Map<string, string> | null = null\n if (!del && set2 !== '') {\n table = new Map<string, string>()\n for (let i = 0; i < set1.length; i++) {\n const from = set1[i]\n const to = set2[i]\n if (from !== undefined && to !== undefined) table.set(from, to)\n }\n } else if (!del && set2 === '' && !squeeze) {\n throw new Error('tr: usage: tr set1 set2')\n }\n return { set1, set2, del, squeeze, table }\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function trCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n let trOpts: TrOptions\n try {\n trOpts = buildOptions(texts, opts.flags)\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = opfsStream(accessor.rootHandle, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'tr: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n return [trStream(source, trOpts), new IOResult({ cache })]\n}\n\nexport const OPFS_TR = command({\n name: 'tr',\n resource: ResourceName.OPFS,\n spec: specOf('tr'),\n fn: trCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { readdir as opfsReaddir } from '../../../core/opfs/readdir.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nasync function walkTree(\n accessor: OPFSAccessor,\n path: PathSpec,\n prefix: string,\n lines: string[],\n): Promise<void> {\n let entries: string[]\n try {\n entries = await opfsReaddir(accessor.rootHandle, path)\n } catch {\n return\n }\n entries.sort()\n for (let i = 0; i < entries.length; i++) {\n const childPath = entries[i]\n if (childPath === undefined) continue\n const last = i === entries.length - 1\n const connector = last ? '└── ' : '├── '\n const displayName = childPath.slice(childPath.lastIndexOf('/') + 1)\n lines.push(`${prefix}${connector}${displayName}`)\n const sub = new PathSpec({\n original: childPath,\n directory: childPath,\n resolved: false,\n prefix: path.prefix,\n })\n const nextPrefix = prefix + (last ? ' ' : '│ ')\n await walkTree(accessor, sub, nextPrefix, lines)\n }\n}\n\nasync function treeCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const targets =\n paths.length > 0\n ? paths\n : [\n new PathSpec({\n original: opts.cwd,\n directory: opts.cwd,\n resolved: false,\n prefix: opts.mountPrefix ?? '',\n }),\n ]\n const lines: string[] = []\n for (const p of targets) {\n await walkTree(accessor, p, '', lines)\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const OPFS_TREE = command({\n name: 'tree',\n resource: ResourceName.OPFS,\n spec: specOf('tree'),\n fn: treeCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction topologicalSort(pairs: readonly (readonly [string, string])[]): [string[], boolean] {\n const graph = new Map<string, Set<string>>()\n const inDegree = new Map<string, number>()\n const getOrCreate = (node: string): Set<string> => {\n const existing = graph.get(node)\n if (existing !== undefined) return existing\n const created = new Set<string>()\n graph.set(node, created)\n inDegree.set(node, 0)\n return created\n }\n for (const [a, b] of pairs) {\n const adj = getOrCreate(a)\n getOrCreate(b)\n if (!adj.has(b)) {\n adj.add(b)\n inDegree.set(b, (inDegree.get(b) ?? 0) + 1)\n }\n }\n const queue: string[] = []\n for (const [node, deg] of inDegree) {\n if (deg === 0) queue.push(node)\n }\n const result: string[] = []\n let head = 0\n while (head < queue.length) {\n const node = queue[head] ?? ''\n head += 1\n result.push(node)\n const neighbors = [...(graph.get(node) ?? new Set<string>())].sort()\n for (const nb of neighbors) {\n const d = (inDegree.get(nb) ?? 0) - 1\n inDegree.set(nb, d)\n if (d === 0) queue.push(nb)\n }\n }\n const hasCycle = result.length !== graph.size\n return [result, hasCycle]\n}\n\nasync function tsortCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(opfsStream(accessor.rootHandle, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tsort: missing input\\n') })]\n }\n raw = stdinData\n }\n const text = DEC.decode(raw)\n const tokens = text.split(/\\s+/).filter((s) => s !== '')\n if (tokens.length % 2 !== 0) {\n const out: ByteSource = ENC.encode('tsort: odd number of tokens\\n')\n return [out, new IOResult({ exitCode: 1 })]\n }\n const pairs: [string, string][] = []\n for (let i = 0; i < tokens.length; i += 2) {\n pairs.push([tokens[i] ?? '', tokens[i + 1] ?? ''])\n }\n const [sorted, hasCycle] = topologicalSort(pairs)\n if (hasCycle) {\n const out: ByteSource = ENC.encode('tsort: cycle detected\\n')\n return [out, new IOResult({ exitCode: 1 })]\n }\n const result: ByteSource = ENC.encode(sorted.join('\\n') + '\\n')\n return [result, new IOResult()]\n}\n\nexport const OPFS_TSORT = command({\n name: 'tsort',\n resource: ResourceName.OPFS,\n spec: specOf('tsort'),\n fn: tsortCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesKeepEnds(text: string): string[] {\n const lines: string[] = []\n let start = 0\n for (let i = 0; i < text.length; i++) {\n if (text[i] === '\\n') {\n lines.push(text.slice(start, i + 1))\n start = i + 1\n }\n }\n if (start < text.length) lines.push(text.slice(start))\n return lines\n}\n\nfunction unexpandLine(line: string, tabsize: number, allSpaces: boolean): string {\n if (allSpaces) {\n const result: string[] = []\n let i = 0\n while (i < line.length) {\n let count = 0\n while (i + count < line.length && line[i + count] === ' ') count += 1\n if (count >= tabsize) {\n const tabs = Math.floor(count / tabsize)\n const remainder = count % tabsize\n result.push('\\t'.repeat(tabs) + ' '.repeat(remainder))\n i += count\n } else if (count > 0) {\n result.push(' '.repeat(count))\n i += count\n } else {\n result.push(line[i] ?? '')\n i += 1\n }\n }\n return result.join('')\n }\n let leading = 0\n while (leading < line.length && line[leading] === ' ') leading += 1\n if (leading >= tabsize) {\n const tabs = Math.floor(leading / tabsize)\n const remainder = leading % tabsize\n return '\\t'.repeat(tabs) + ' '.repeat(remainder) + line.slice(leading)\n }\n return line\n}\n\nasync function unexpandCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const tabsize = typeof opts.flags.t === 'string' ? Number.parseInt(opts.flags.t, 10) : 8\n const allSpaces = opts.flags.a === true\n if (paths.length > 0) {\n const parts: string[] = []\n for (const p of paths) {\n const data = DEC.decode(await materialize(opfsStream(accessor.rootHandle, p)))\n for (const ln of splitLinesKeepEnds(data)) parts.push(unexpandLine(ln, tabsize, allSpaces))\n }\n const result: ByteSource = ENC.encode(parts.join(''))\n return [result, new IOResult()]\n }\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('unexpand: missing operand\\n') })]\n }\n const text = DEC.decode(stdinData)\n const lines = splitLinesKeepEnds(text)\n const result: ByteSource = ENC.encode(\n lines.map((ln) => unexpandLine(ln, tabsize, allSpaces)).join(''),\n )\n return [result, new IOResult()]\n}\n\nexport const OPFS_UNEXPAND = command({\n name: 'unexpand',\n resource: ResourceName.OPFS,\n spec: specOf('unexpand'),\n fn: unexpandCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\ninterface UniqOptions {\n count: boolean\n duplicatesOnly: boolean\n uniqueOnly: boolean\n skipFields: number\n skipChars: number\n checkChars: number\n ignoreCase: boolean\n}\n\nfunction comparisonKey(line: Uint8Array, opts: UniqOptions): string {\n let text = DEC.decode(line)\n if (opts.skipFields > 0) {\n const parts = text.split(/\\s+/).filter((s) => s !== '')\n const remaining = opts.skipFields < parts.length ? parts.slice(opts.skipFields) : []\n text = remaining.join(' ')\n }\n if (opts.skipChars > 0) text = text.slice(opts.skipChars)\n if (opts.checkChars > 0) text = text.slice(0, opts.checkChars)\n if (opts.ignoreCase) text = text.toLowerCase()\n return text\n}\n\nfunction padLeft(value: string, width: number): string {\n return value.length >= width ? value : ' '.repeat(width - value.length) + value\n}\n\nfunction emitLine(line: Uint8Array, count: number, opts: UniqOptions): Uint8Array | null {\n if (opts.duplicatesOnly && count === 1) return null\n if (opts.uniqueOnly && count > 1) return null\n if (opts.count) {\n const prefix = ENC.encode(`${padLeft(String(count), 7)} `)\n const out = new Uint8Array(prefix.byteLength + line.byteLength + 1)\n out.set(prefix, 0)\n out.set(line, prefix.byteLength)\n out[out.byteLength - 1] = 0x0a\n return out\n }\n const out = new Uint8Array(line.byteLength + 1)\n out.set(line, 0)\n out[line.byteLength] = 0x0a\n return out\n}\n\nasync function* uniqStream(\n source: AsyncIterable<Uint8Array>,\n opts: UniqOptions,\n): AsyncIterable<Uint8Array> {\n let prevLine: Uint8Array | null = null\n let prevKey: string | null = null\n let prevCount = 0\n const iter = new AsyncLineIterator(source)\n for await (const rawLine of iter) {\n const key = comparisonKey(rawLine, opts)\n if (key === prevKey) {\n prevCount += 1\n } else {\n if (prevLine !== null) {\n const chunk = emitLine(prevLine, prevCount, opts)\n if (chunk !== null) yield chunk\n }\n prevLine = rawLine\n prevKey = key\n prevCount = 1\n }\n }\n if (prevLine !== null) {\n const chunk = emitLine(prevLine, prevCount, opts)\n if (chunk !== null) yield chunk\n }\n}\n\nfunction parseOptions(flags: Record<string, string | boolean>): UniqOptions {\n const intFlag = (key: 'f' | 's' | 'w'): number =>\n typeof flags[key] === 'string' ? Number.parseInt(flags[key], 10) : 0\n return {\n count: flags.c === true,\n duplicatesOnly: flags.d === true,\n uniqueOnly: flags.u === true,\n skipFields: intFlag('f'),\n skipChars: intFlag('s'),\n checkChars: intFlag('w'),\n ignoreCase: flags.i === true,\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function uniqCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const uniqOpts = parseOptions(opts.flags)\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n return [\n uniqStream(opfsStream(accessor.rootHandle, first), uniqOpts),\n new IOResult({ cache: [first.stripPrefix] }),\n ]\n }\n try {\n const source = resolveSource(opts.stdin, 'uniq: missing operand')\n return [uniqStream(source, uniqOpts), new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const OPFS_UNIQ = command({\n name: 'uniq',\n resource: ResourceName.OPFS,\n spec: specOf('uniq'),\n fn: uniqCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n inflateRaw,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { mkdir as opfsMkdir } from '../../../core/opfs/mkdir.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\ninterface ZipEntry {\n name: string\n size: number\n data: Uint8Array\n}\n\nfunction readU16LE(data: Uint8Array, offset: number): number {\n return (data[offset] ?? 0) | ((data[offset + 1] ?? 0) << 8)\n}\n\nfunction readU32LE(data: Uint8Array, offset: number): number {\n return (\n ((data[offset] ?? 0) |\n ((data[offset + 1] ?? 0) << 8) |\n ((data[offset + 2] ?? 0) << 16) |\n ((data[offset + 3] ?? 0) << 24)) >>>\n 0\n )\n}\n\nasync function readZipEntries(data: Uint8Array): Promise<ZipEntry[]> {\n const entries: ZipEntry[] = []\n let offset = 0\n while (offset + 4 <= data.byteLength) {\n const sig = readU32LE(data, offset)\n if (sig !== 0x04034b50) break\n const compressionMethod = readU16LE(data, offset + 8)\n const compressedSize = readU32LE(data, offset + 18)\n const uncompressedSize = readU32LE(data, offset + 22)\n const nameLen = readU16LE(data, offset + 26)\n const extraLen = readU16LE(data, offset + 28)\n const headerEnd = offset + 30 + nameLen + extraLen\n const nameBytes = data.subarray(offset + 30, offset + 30 + nameLen)\n const name = DEC.decode(nameBytes)\n const body = data.subarray(headerEnd, headerEnd + compressedSize)\n let content: Uint8Array\n if (compressionMethod === 0) {\n content = body.slice()\n } else if (compressionMethod === 8) {\n content = await inflateRaw(body)\n } else {\n throw new Error(`unzip: unsupported compression method: ${String(compressionMethod)}`)\n }\n entries.push({ name, size: uncompressedSize, data: content })\n offset = headerEnd + compressedSize\n }\n return entries\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function ensureParents(accessor: OPFSAccessor, path: string): Promise<void> {\n const idx = path.lastIndexOf('/')\n if (idx <= 0) return\n const dir = path.slice(0, idx)\n if (dir === '' || dir === '/') return\n await opfsMkdir(accessor.rootHandle, makePathSpec(dir), true)\n}\n\nasync function unzipCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('unzip: missing operand\\n') })]\n }\n const archivePath = paths[0]\n if (archivePath === undefined) return [null, new IOResult()]\n const data = await materialize(opfsStream(accessor.rootHandle, archivePath))\n const entries = await readZipEntries(data)\n\n const listMode = opts.flags.args_l === true\n const testMode = opts.flags.t === true\n const pipeMode = opts.flags.p === true\n const quiet = opts.flags.q === true\n const mountPrefix = archivePath.prefix\n const destRaw = typeof opts.flags.d === 'string' ? opts.flags.d : '/'\n const dest =\n mountPrefix !== '' && destRaw.startsWith(mountPrefix + '/')\n ? destRaw.slice(mountPrefix.length)\n : destRaw === mountPrefix\n ? '/'\n : destRaw\n\n if (listMode) {\n const lines = [' Length Name', '--------- ----']\n for (const e of entries) {\n lines.push(`${String(e.size).padStart(9, ' ')} ${e.name}`)\n }\n const out: ByteSource = ENC.encode(lines.join('\\n') + '\\n')\n return [out, new IOResult()]\n }\n\n if (testMode) {\n const msg = `No errors detected in ${archivePath.original}\\n`\n const out: ByteSource = ENC.encode(msg)\n return [out, new IOResult()]\n }\n\n if (pipeMode) {\n const chunks: Uint8Array[] = []\n for (const e of entries) {\n if (!e.name.endsWith('/')) chunks.push(e.data)\n }\n let total = 0\n for (const c of chunks) total += c.byteLength\n const merged = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n merged.set(c, offset)\n offset += c.byteLength\n }\n const out: ByteSource = merged\n return [out, new IOResult()]\n }\n\n const writes: Record<string, Uint8Array> = {}\n const outputLines: string[] = []\n for (const e of entries) {\n if (e.name.endsWith('/')) continue\n const entryName = e.name.replace(/^\\/+/, '')\n const outPath = dest.replace(/\\/+$/, '') + '/' + entryName\n await ensureParents(accessor, outPath)\n await opfsWrite(accessor.rootHandle, makePathSpec(outPath), e.data)\n const reportPath = mountPrefix !== '' ? mountPrefix + outPath : outPath\n writes[reportPath] = e.data\n if (!quiet) outputLines.push(` inflating: ${reportPath}`)\n }\n const stdout: ByteSource | null =\n outputLines.length > 0 ? ENC.encode(outputLines.join('\\n') + '\\n') : null\n return [stdout, new IOResult({ writes })]\n}\n\nexport const OPFS_UNZIP = command({\n name: 'unzip',\n resource: ResourceName.OPFS,\n spec: specOf('unzip'),\n fn: unzipCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n wcAggregate,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nasync function* wcLinesStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n let count = 0\n for await (const chunk of source) {\n for (let i = 0; i < chunk.byteLength; i++) if (chunk[i] === 0x0a) count += 1\n }\n yield ENC.encode(String(count))\n}\n\nasync function readStream(accessor: OPFSAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(opfsStream(accessor.rootHandle, p))\n}\n\nasync function wcCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const f = opts.flags\n const lFlag = f.args_l === true\n const wFlag = f.w === true\n const cFlag = f.c === true\n const mFlag = f.m === true\n const LFlag = f.L === true\n if (paths.length > 0) {\n const outputs: string[] = []\n let totalLines = 0\n let totalWords = 0\n let totalBytes = 0\n for (const p of paths) {\n const data = await readStream(accessor, p)\n const text = DEC.decode(data)\n const lineCount = countChar(text, '\\n')\n const wordCount = text.split(/\\s+/).filter((s) => s !== '').length\n const byteCount = data.byteLength\n if (LFlag) {\n const maxLen = text.split(/\\r?\\n/).reduce((m, l) => Math.max(m, l.length), 0)\n outputs.push(`${String(maxLen)}\\t${p.original}`)\n } else if (lFlag) {\n outputs.push(`${String(lineCount)}\\t${p.original}`)\n totalLines += lineCount\n } else if (wFlag) {\n outputs.push(`${String(wordCount)}\\t${p.original}`)\n totalWords += wordCount\n } else if (cFlag) {\n outputs.push(`${String(byteCount)}\\t${p.original}`)\n totalBytes += byteCount\n } else if (mFlag) {\n const charCount = text.length\n outputs.push(`${String(charCount)}\\t${p.original}`)\n totalBytes += charCount\n } else {\n outputs.push(\n `${String(lineCount)}\\t${String(wordCount)}\\t${String(byteCount)}\\t${p.original}`,\n )\n totalLines += lineCount\n totalWords += wordCount\n totalBytes += byteCount\n }\n }\n if (paths.length > 1) {\n if (lFlag) outputs.push(`${String(totalLines)}\\ttotal`)\n else if (wFlag) outputs.push(`${String(totalWords)}\\ttotal`)\n else if (cFlag) outputs.push(`${String(totalBytes)}\\ttotal`)\n else if (mFlag) outputs.push(`${String(totalBytes)}\\ttotal`)\n else\n outputs.push(`${String(totalLines)}\\t${String(totalWords)}\\t${String(totalBytes)}\\ttotal`)\n }\n const out: ByteSource = ENC.encode(outputs.join('\\n'))\n return [out, new IOResult()]\n }\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, 'wc: missing operand')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n if (lFlag) return [wcLinesStream(source), new IOResult()]\n const raw = await materialize(source)\n const text = DEC.decode(raw)\n const lc = countChar(text, '\\n')\n const wcVal = text.split(/\\s+/).filter((s) => s !== '').length\n const bc = raw.byteLength\n const cc = text.length\n if (LFlag) {\n const maxLen = text.split(/\\r?\\n/).reduce((m, l) => Math.max(m, l.length), 0)\n return [ENC.encode(String(maxLen)), new IOResult()]\n }\n if (wFlag) return [ENC.encode(String(wcVal)), new IOResult()]\n if (mFlag) return [ENC.encode(String(cc)), new IOResult()]\n if (cFlag) return [ENC.encode(String(bc)), new IOResult()]\n return [ENC.encode(`${String(lc)}\\t${String(wcVal)}\\t${String(bc)}`), new IOResult()]\n}\n\nfunction countChar(text: string, ch: string): number {\n let n = 0\n for (const c of text) if (c === ch) n += 1\n return n\n}\n\nexport const OPFS_WC = command({\n name: 'wc',\n resource: ResourceName.OPFS,\n spec: specOf('wc'),\n fn: wcCommand,\n aggregate: wcAggregate,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n featherWc,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function wcFeatherCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('wc: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const rows = featherWc(raw)\n const out: ByteSource = ENC.encode(`${String(rows)}\\t${first.original}\\n`)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`wc: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_WC_FEATHER = command({\n name: 'wc',\n resource: ResourceName.OPFS,\n spec: specOf('wc'),\n filetype: '.feather',\n fn: wcFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n hdf5Wc,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function wcHdf5Command(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('wc: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const rows = await hdf5Wc(raw)\n const out: ByteSource = ENC.encode(`${String(rows)}\\t${first.original}\\n`)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`wc: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_WC_HDF5 = command({\n name: 'wc',\n resource: ResourceName.OPFS,\n spec: specOf('wc'),\n filetype: '.h5',\n fn: wcHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n parquetWc,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function wcParquetCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('wc: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(opfsStream(accessor.rootHandle, first))\n const rows = parquetWc(raw)\n const out: ByteSource = ENC.encode(`${String(rows)}\\t${first.original}\\n`)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`wc: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const OPFS_WC_PARQUET = command({\n name: 'wc',\n resource: ResourceName.OPFS,\n spec: specOf('wc'),\n filetype: '.parquet',\n fn: wcParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction padLeft(s: string, width: number, ch = ' '): string {\n return s.length >= width ? s : ch.repeat(width - s.length) + s\n}\n\nfunction padRight(s: string, width: number, ch = ' '): string {\n return s.length >= width ? s : s + ch.repeat(width - s.length)\n}\n\nfunction hexByte(b: number, uppercase: boolean): string {\n const h = b.toString(16).padStart(2, '0')\n return uppercase ? h.toUpperCase() : h\n}\n\nfunction hexOffset(offset: number, uppercase: boolean): string {\n const h = offset.toString(16).padStart(8, '0')\n return uppercase ? h.toUpperCase() : h\n}\n\nasync function* xxdDumpStream(\n source: AsyncIterable<Uint8Array>,\n cols: number,\n group: number,\n uppercase: boolean,\n): AsyncIterable<Uint8Array> {\n let offset = 0\n let leftover = new Uint8Array(0)\n const hexColumnWidth = cols * 2 + Math.floor(cols / group) - 1\n const emitRow = (row: Uint8Array): Uint8Array => {\n const hexParts: string[] = []\n for (let g = 0; g < row.byteLength; g += group) {\n let seg = ''\n const end = Math.min(g + group, row.byteLength)\n for (let k = g; k < end; k++) seg += hexByte(row[k] ?? 0, uppercase)\n hexParts.push(seg)\n }\n const hexPart = hexParts.join(' ')\n let asciiPart = ''\n for (const b of row) asciiPart += b >= 32 && b < 127 ? String.fromCharCode(b) : '.'\n const line = `${hexOffset(offset, uppercase)}: ${padRight(hexPart, hexColumnWidth)} ${asciiPart}\\n`\n return ENC.encode(line)\n }\n for await (const chunk of source) {\n const merged = new Uint8Array(leftover.byteLength + chunk.byteLength)\n merged.set(leftover, 0)\n merged.set(chunk, leftover.byteLength)\n let i = 0\n while (i + cols <= merged.byteLength) {\n yield emitRow(merged.subarray(i, i + cols))\n offset += cols\n i += cols\n }\n leftover = merged.subarray(i)\n }\n if (leftover.byteLength > 0) {\n yield emitRow(leftover)\n }\n}\n\nasync function* xxdPlainStream(\n source: AsyncIterable<Uint8Array>,\n uppercase: boolean,\n): AsyncIterable<Uint8Array> {\n for await (const chunk of source) {\n let hex = ''\n for (const b of chunk) hex += hexByte(b, uppercase)\n yield ENC.encode(hex)\n }\n yield ENC.encode('\\n')\n}\n\nasync function* xxdReverseStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n const chunks: Uint8Array[] = []\n for await (const c of source) chunks.push(c)\n let total = 0\n for (const c of chunks) total += c.byteLength\n const buf = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n buf.set(c, offset)\n offset += c.byteLength\n }\n const text = DEC.decode(buf).replace(/[\\n ]/g, '')\n const out = new Uint8Array(text.length / 2)\n for (let i = 0; i < out.byteLength; i++)\n out[i] = Number.parseInt(text.slice(i * 2, i * 2 + 2), 16)\n yield out\n}\n\nasync function* applyLimits(\n source: AsyncIterable<Uint8Array>,\n skip: number,\n limit: number,\n): AsyncIterable<Uint8Array> {\n let pos = 0\n let remaining = limit\n for await (let chunk of source) {\n const len = chunk.byteLength\n if (pos + len <= skip) {\n pos += len\n continue\n }\n if (pos < skip) {\n chunk = chunk.subarray(skip - pos)\n pos = skip\n }\n if (remaining <= 0) break\n if (chunk.byteLength > remaining) chunk = chunk.subarray(0, remaining)\n yield chunk\n remaining -= chunk.byteLength\n pos += chunk.byteLength\n }\n}\n\nvoid padLeft\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function xxdCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = opfsStream(accessor.rootHandle, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'xxd: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n const toInt = (v: string | boolean | undefined): number =>\n typeof v === 'string' ? Number.parseInt(v, 10) : 0\n const skip = toInt(opts.flags.s)\n const limitFlag = toInt(opts.flags.l)\n if (skip > 0 || limitFlag > 0) {\n const limit = limitFlag > 0 ? limitFlag : Number.MAX_SAFE_INTEGER\n source = applyLimits(source, skip, limit)\n }\n const uppercase = opts.flags.u === true\n if (opts.flags.r === true) return [xxdReverseStream(source), new IOResult({ cache })]\n if (opts.flags.p === true) return [xxdPlainStream(source, uppercase), new IOResult({ cache })]\n const cols = toInt(opts.flags.c) > 0 ? toInt(opts.flags.c) : 16\n const group = toInt(opts.flags.g) > 0 ? toInt(opts.flags.g) : 2\n return [xxdDumpStream(source, cols, group, uppercase), new IOResult({ cache })]\n}\n\nexport const OPFS_XXD = command({\n name: 'xxd',\n resource: ResourceName.OPFS,\n spec: specOf('xxd'),\n fn: xxdCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n gunzip,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nasync function zcatCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n let raw: Uint8Array\n if (paths.length > 0 && paths[0] !== undefined) {\n raw = await materialize(opfsStream(accessor.rootHandle, paths[0]))\n } else {\n const stdinBytes = await readStdinAsync(opts.stdin)\n if (stdinBytes === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('zcat: missing input\\n') })]\n }\n raw = stdinBytes\n }\n const out = await gunzip(raw)\n const result: ByteSource = out\n return [result, new IOResult()]\n}\n\nexport const OPFS_ZCAT = command({\n name: 'zcat',\n resource: ResourceName.OPFS,\n spec: specOf('zcat'),\n fn: zcatCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n compilePattern,\n gunzip,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\ninterface ZgrepOpts {\n ignoreCase: boolean\n invert: boolean\n count: boolean\n lineNumbers: boolean\n onlyMatching: boolean\n maxCount: number | null\n}\n\nfunction zgrepSearch(\n data: Uint8Array,\n pattern: RegExp,\n opts: ZgrepOpts,\n filename: string | null,\n): [string[], boolean] {\n const text = DEC.decode(data)\n const lines = splitLinesNoTrailing(text)\n const reGlobal = opts.onlyMatching\n ? new RegExp(pattern.source, pattern.flags.includes('g') ? pattern.flags : pattern.flags + 'g')\n : null\n const matched: [number, string][] = []\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? ''\n if (opts.onlyMatching && !opts.invert && reGlobal !== null) {\n reGlobal.lastIndex = 0\n let m: RegExpExecArray | null\n const hits: RegExpExecArray[] = []\n while ((m = reGlobal.exec(line)) !== null) {\n hits.push(m)\n if (m[0] === '') reGlobal.lastIndex += 1\n }\n if (hits.length > 0) {\n for (const h of hits) {\n matched.push([i + 1, h[0]])\n if (opts.maxCount !== null && matched.length >= opts.maxCount) break\n }\n }\n } else {\n let hit = pattern.test(line)\n if (opts.invert) hit = !hit\n if (hit) matched.push([i + 1, line])\n }\n if (opts.maxCount !== null && matched.length >= opts.maxCount) break\n }\n if (opts.count) return [[String(matched.length)], matched.length > 0]\n const result: string[] = []\n for (const [idx, line] of matched) {\n let prefix = ''\n if (filename !== null) prefix = filename + ':'\n if (opts.lineNumbers) prefix += String(idx) + ':'\n result.push(prefix + line)\n }\n return [result, matched.length > 0]\n}\n\nasync function zgrepCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const rawPattern =\n typeof opts.flags.e === 'string'\n ? opts.flags.e\n : texts.length > 0 && texts[0] !== undefined\n ? texts[0]\n : ''\n const extendedRegex = opts.flags.E === true\n const fixedString = opts.flags.F === true\n const wholeWord = opts.flags.w === true\n const ignoreCase = opts.flags.i === true\n const invert = opts.flags.v === true\n const countOnly = opts.flags.c === true\n const lineNumbers = opts.flags.n === true\n const onlyMatching = opts.flags.o === true\n const quiet = opts.flags.q === true\n const filesOnly = opts.flags.args_l === true\n const forceH = opts.flags.H === true\n const hideH = opts.flags.h === true\n const maxCount = typeof opts.flags.m === 'string' ? Number.parseInt(opts.flags.m, 10) : null\n void extendedRegex\n const pattern = compilePattern(rawPattern, ignoreCase, fixedString, wholeWord)\n\n const multi = paths.length > 1\n const showFilename = forceH || (multi && !hideH)\n let anyMatch = false\n const allResults: string[] = []\n\n if (paths.length > 0) {\n for (const p of paths) {\n const compressed = await materialize(opfsStream(accessor.rootHandle, p))\n const data = await gunzip(compressed)\n const fname = showFilename ? p.original : null\n if (filesOnly) {\n const text = DEC.decode(data)\n const lines = splitLinesNoTrailing(text)\n for (const line of lines) {\n let hit = pattern.test(line)\n if (invert) hit = !hit\n if (hit) {\n allResults.push(p.original)\n anyMatch = true\n break\n }\n }\n } else {\n const [result, hadMatch] = zgrepSearch(\n data,\n pattern,\n {\n ignoreCase,\n invert,\n count: countOnly,\n lineNumbers,\n onlyMatching,\n maxCount,\n },\n fname,\n )\n if (hadMatch) anyMatch = true\n for (const r of result) allResults.push(r)\n }\n }\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('zgrep: missing input\\n') })]\n }\n const data = await gunzip(stdinData)\n if (filesOnly) {\n const text = DEC.decode(data)\n const lines = splitLinesNoTrailing(text)\n for (const line of lines) {\n let hit = pattern.test(line)\n if (invert) hit = !hit\n if (hit) {\n allResults.push('(standard input)')\n anyMatch = true\n break\n }\n }\n } else {\n const [result, hadMatch] = zgrepSearch(\n data,\n pattern,\n { ignoreCase, invert, count: countOnly, lineNumbers, onlyMatching, maxCount },\n null,\n )\n if (hadMatch) anyMatch = true\n for (const r of result) allResults.push(r)\n }\n }\n\n if (quiet) return [null, new IOResult({ exitCode: anyMatch ? 0 : 1 })]\n if (!anyMatch) return [null, new IOResult({ exitCode: 1 })]\n const result: ByteSource = ENC.encode(allResults.join('\\n') + '\\n')\n return [result, new IOResult()]\n}\n\nexport const OPFS_ZGREP = command({\n name: 'zgrep',\n resource: ResourceName.OPFS,\n spec: specOf('zgrep'),\n fn: zgrepCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n deflateRaw,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { writeBytes as opfsWrite } from '../../../core/opfs/write.ts'\nimport { stream as opfsStream } from '../../../core/opfs/stream.ts'\nimport type { OPFSAccessor } from '../../../accessor/opfs.ts'\n\nconst ENC = new TextEncoder()\n\nconst CRC_TABLE = (() => {\n const table = new Uint32Array(256)\n for (let n = 0; n < 256; n++) {\n let c = n\n for (let k = 0; k < 8; k++) {\n c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1\n }\n table[n] = c >>> 0\n }\n return table\n})()\n\nfunction crc32(data: Uint8Array): number {\n let c = 0xffffffff\n for (let i = 0; i < data.byteLength; i++) {\n c = (CRC_TABLE[((c ^ (data[i] ?? 0)) & 0xff) >>> 0] ?? 0) ^ (c >>> 8)\n }\n return (c ^ 0xffffffff) >>> 0\n}\n\nfunction writeU16LE(buf: Uint8Array, offset: number, value: number): void {\n buf[offset] = value & 0xff\n buf[offset + 1] = (value >>> 8) & 0xff\n}\n\nfunction writeU32LE(buf: Uint8Array, offset: number, value: number): void {\n buf[offset] = value & 0xff\n buf[offset + 1] = (value >>> 8) & 0xff\n buf[offset + 2] = (value >>> 16) & 0xff\n buf[offset + 3] = (value >>> 24) & 0xff\n}\n\ninterface ZipItem {\n name: string\n data: Uint8Array\n compressed: Uint8Array\n crc: number\n method: number\n localOffset: number\n}\n\nfunction basename(path: string): string {\n const idx = path.lastIndexOf('/')\n return idx >= 0 ? path.slice(idx + 1) : path\n}\n\nfunction concat(chunks: readonly Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nfunction buildZip(items: ZipItem[]): Uint8Array {\n const parts: Uint8Array[] = []\n let offset = 0\n for (const item of items) {\n item.localOffset = offset\n const nameBytes = ENC.encode(item.name)\n const header = new Uint8Array(30 + nameBytes.byteLength)\n writeU32LE(header, 0, 0x04034b50)\n writeU16LE(header, 4, 20)\n writeU16LE(header, 6, 0)\n writeU16LE(header, 8, item.method)\n writeU16LE(header, 10, 0)\n writeU16LE(header, 12, 0)\n writeU32LE(header, 14, item.crc)\n writeU32LE(header, 18, item.compressed.byteLength)\n writeU32LE(header, 22, item.data.byteLength)\n writeU16LE(header, 26, nameBytes.byteLength)\n writeU16LE(header, 28, 0)\n header.set(nameBytes, 30)\n parts.push(header)\n parts.push(item.compressed)\n offset += header.byteLength + item.compressed.byteLength\n }\n const centralStart = offset\n for (const item of items) {\n const nameBytes = ENC.encode(item.name)\n const central = new Uint8Array(46 + nameBytes.byteLength)\n writeU32LE(central, 0, 0x02014b50)\n writeU16LE(central, 4, 20)\n writeU16LE(central, 6, 20)\n writeU16LE(central, 8, 0)\n writeU16LE(central, 10, item.method)\n writeU16LE(central, 12, 0)\n writeU16LE(central, 14, 0)\n writeU32LE(central, 16, item.crc)\n writeU32LE(central, 20, item.compressed.byteLength)\n writeU32LE(central, 24, item.data.byteLength)\n writeU16LE(central, 28, nameBytes.byteLength)\n writeU16LE(central, 30, 0)\n writeU16LE(central, 32, 0)\n writeU16LE(central, 34, 0)\n writeU16LE(central, 36, 0)\n writeU32LE(central, 38, 0)\n writeU32LE(central, 42, item.localOffset)\n central.set(nameBytes, 46)\n parts.push(central)\n offset += central.byteLength\n }\n const centralSize = offset - centralStart\n const end = new Uint8Array(22)\n writeU32LE(end, 0, 0x06054b50)\n writeU16LE(end, 4, 0)\n writeU16LE(end, 6, 0)\n writeU16LE(end, 8, items.length)\n writeU16LE(end, 10, items.length)\n writeU32LE(end, 12, centralSize)\n writeU32LE(end, 16, centralStart)\n writeU16LE(end, 20, 0)\n parts.push(end)\n return concat(parts)\n}\n\nasync function zipCommand(\n accessor: OPFSAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode('zip: usage: zip archive.zip file1 [file2 ...]\\n'),\n }),\n ]\n }\n const archivePath = paths[0]\n const filePaths = paths.slice(1)\n if (archivePath === undefined) return [null, new IOResult()]\n const junkPaths = opts.flags.j === true\n const quiet = opts.flags.q === true\n\n const items: ZipItem[] = []\n const outputLines: string[] = []\n for (const p of filePaths) {\n const raw = await materialize(opfsStream(accessor.rootHandle, p))\n const data = new Uint8Array(raw.byteLength)\n data.set(raw)\n const arcname = junkPaths ? basename(p.original) : p.original.replace(/^\\/+/, '')\n const compressed = await deflateRaw(data)\n items.push({\n name: arcname,\n data,\n compressed,\n crc: crc32(data),\n method: 8,\n localOffset: 0,\n })\n if (!quiet) outputLines.push(` adding: ${arcname}`)\n }\n const archive = buildZip(items)\n await opfsWrite(accessor.rootHandle, archivePath, archive)\n const stdout: ByteSource | null =\n outputLines.length > 0 ? ENC.encode(outputLines.join('\\n') + '\\n') : null\n return [stdout, new IOResult({ writes: { [archivePath.stripPrefix]: archive } })]\n}\n\nexport const OPFS_ZIP = command({\n name: 'zip',\n resource: ResourceName.OPFS,\n spec: specOf('zip'),\n fn: zipCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RegisteredCommand } from '@struktoai/mirage-core'\nimport { OPFS_AWK } from './awk.ts'\nimport { RAM_BASE64 } from './base64_cmd.ts'\nimport { OPFS_BASENAME } from './basename.ts'\nimport { OPFS_CAT } from './cat/cat.ts'\nimport { OPFS_CAT_FEATHER } from './cat/cat_feather.ts'\nimport { RAM_CAT_HDF5 } from './cat/cat_hdf5.ts'\nimport { OPFS_CAT_PARQUET } from './cat/cat_parquet.ts'\nimport { OPFS_CMP } from './cmp.ts'\nimport { OPFS_COLUMN } from './column.ts'\nimport { OPFS_COMM } from './comm.ts'\nimport { OPFS_CP } from './cp.ts'\nimport { OPFS_CSPLIT } from './csplit.ts'\nimport { OPFS_CUT } from './cut/cut.ts'\nimport { OPFS_CUT_FEATHER } from './cut/cut_feather.ts'\nimport { RAM_CUT_HDF5 } from './cut/cut_hdf5.ts'\nimport { OPFS_CUT_PARQUET } from './cut/cut_parquet.ts'\nimport { OPFS_DIFF } from './diff.ts'\nimport { OPFS_DIRNAME } from './dirname.ts'\nimport { OPFS_DU } from './du.ts'\nimport { OPFS_EXPAND } from './expand.ts'\nimport { OPFS_FILE } from './file/file.ts'\nimport { OPFS_FILE_FEATHER } from './file/file_feather.ts'\nimport { RAM_FILE_HDF5 } from './file/file_hdf5.ts'\nimport { OPFS_FILE_PARQUET } from './file/file_parquet.ts'\nimport { OPFS_FIND } from './find.ts'\nimport { OPFS_FMT } from './fmt.ts'\nimport { OPFS_FOLD } from './fold.ts'\nimport { OPFS_GREP } from './grep/grep.ts'\nimport { OPFS_GREP_FEATHER } from './grep/grep_feather.ts'\nimport { RAM_GREP_HDF5 } from './grep/grep_hdf5.ts'\nimport { OPFS_GREP_PARQUET } from './grep/grep_parquet.ts'\nimport { OPFS_GUNZIP } from './gunzip.ts'\nimport { OPFS_GZIP } from './gzip.ts'\nimport { OPFS_HEAD } from './head/head.ts'\nimport { OPFS_HEAD_FEATHER } from './head/head_feather.ts'\nimport { RAM_HEAD_HDF5 } from './head/head_hdf5.ts'\nimport { OPFS_HEAD_PARQUET } from './head/head_parquet.ts'\nimport { OPFS_ICONV } from './iconv.ts'\nimport { OPFS_JOIN } from './join.ts'\nimport { OPFS_JQ } from './jq.ts'\nimport { OPFS_LN } from './ln.ts'\nimport { OPFS_LOOK } from './look.ts'\nimport { OPFS_LS } from './ls/ls.ts'\nimport { OPFS_LS_FEATHER } from './ls/ls_feather.ts'\nimport { RAM_LS_HDF5 } from './ls/ls_hdf5.ts'\nimport { OPFS_LS_PARQUET } from './ls/ls_parquet.ts'\nimport { RAM_MD5 } from './md5.ts'\nimport { OPFS_MKDIR } from './mkdir.ts'\nimport { OPFS_MKTEMP } from './mktemp.ts'\nimport { OPFS_MV } from './mv.ts'\nimport { OPFS_NL } from './nl.ts'\nimport { OPFS_PASTE } from './paste.ts'\nimport { OPFS_PATCH } from './patch.ts'\nimport { OPFS_READLINK } from './readlink.ts'\nimport { OPFS_REALPATH } from './realpath.ts'\nimport { OPFS_REV } from './rev.ts'\nimport { OPFS_RG } from './rg.ts'\nimport { OPFS_RM } from './rm.ts'\nimport { OPFS_SED } from './sed.ts'\nimport { RAM_SHA256SUM } from './sha256sum.ts'\nimport { OPFS_SHUF } from './shuf.ts'\nimport { OPFS_SORT } from './sort.ts'\nimport { OPFS_SPLIT } from './split.ts'\nimport { OPFS_STAT } from './stat/stat.ts'\nimport { OPFS_STAT_FEATHER } from './stat/stat_feather.ts'\nimport { RAM_STAT_HDF5 } from './stat/stat_hdf5.ts'\nimport { OPFS_STAT_PARQUET } from './stat/stat_parquet.ts'\nimport { OPFS_STRINGS } from './strings.ts'\nimport { OPFS_TAC } from './tac.ts'\nimport { OPFS_TAIL } from './tail/tail.ts'\nimport { OPFS_TAIL_FEATHER } from './tail/tail_feather.ts'\nimport { RAM_TAIL_HDF5 } from './tail/tail_hdf5.ts'\nimport { OPFS_TAIL_PARQUET } from './tail/tail_parquet.ts'\nimport { OPFS_TAR } from './tar.ts'\nimport { OPFS_TEE } from './tee.ts'\nimport { OPFS_TOUCH } from './touch.ts'\nimport { OPFS_TR } from './tr.ts'\nimport { OPFS_TREE } from './tree.ts'\nimport { OPFS_TSORT } from './tsort.ts'\nimport { OPFS_UNEXPAND } from './unexpand.ts'\nimport { OPFS_UNIQ } from './uniq.ts'\nimport { OPFS_UNZIP } from './unzip.ts'\nimport { OPFS_WC } from './wc/wc.ts'\nimport { OPFS_WC_FEATHER } from './wc/wc_feather.ts'\nimport { RAM_WC_HDF5 } from './wc/wc_hdf5.ts'\nimport { OPFS_WC_PARQUET } from './wc/wc_parquet.ts'\nimport { OPFS_XXD } from './xxd.ts'\nimport { OPFS_ZCAT } from './zcat.ts'\nimport { OPFS_ZGREP } from './zgrep.ts'\nimport { OPFS_ZIP } from './zip_cmd.ts'\n\nexport const OPFS_COMMANDS: readonly RegisteredCommand[] = [\n ...OPFS_AWK,\n ...RAM_BASE64,\n ...OPFS_BASENAME,\n ...OPFS_CAT,\n ...OPFS_CAT_FEATHER,\n ...RAM_CAT_HDF5,\n ...OPFS_CAT_PARQUET,\n ...OPFS_CMP,\n ...OPFS_COLUMN,\n ...OPFS_COMM,\n ...OPFS_CP,\n ...OPFS_CSPLIT,\n ...OPFS_CUT,\n ...OPFS_CUT_FEATHER,\n ...RAM_CUT_HDF5,\n ...OPFS_CUT_PARQUET,\n ...OPFS_DIFF,\n ...OPFS_DIRNAME,\n ...OPFS_DU,\n ...OPFS_EXPAND,\n ...OPFS_FILE,\n ...OPFS_FILE_FEATHER,\n ...RAM_FILE_HDF5,\n ...OPFS_FILE_PARQUET,\n ...OPFS_FIND,\n ...OPFS_FMT,\n ...OPFS_FOLD,\n ...OPFS_GREP,\n ...OPFS_GREP_FEATHER,\n ...RAM_GREP_HDF5,\n ...OPFS_GREP_PARQUET,\n ...OPFS_GUNZIP,\n ...OPFS_GZIP,\n ...OPFS_HEAD,\n ...OPFS_HEAD_FEATHER,\n ...RAM_HEAD_HDF5,\n ...OPFS_HEAD_PARQUET,\n ...OPFS_ICONV,\n ...OPFS_JOIN,\n ...OPFS_JQ,\n ...OPFS_LN,\n ...OPFS_LOOK,\n ...OPFS_LS,\n ...OPFS_LS_FEATHER,\n ...RAM_LS_HDF5,\n ...OPFS_LS_PARQUET,\n ...RAM_MD5,\n ...OPFS_MKDIR,\n ...OPFS_MKTEMP,\n ...OPFS_MV,\n ...OPFS_NL,\n ...OPFS_PASTE,\n ...OPFS_PATCH,\n ...OPFS_READLINK,\n ...OPFS_REALPATH,\n ...OPFS_REV,\n ...OPFS_RG,\n ...OPFS_RM,\n ...OPFS_SED,\n ...RAM_SHA256SUM,\n ...OPFS_SHUF,\n ...OPFS_SORT,\n ...OPFS_SPLIT,\n ...OPFS_STAT,\n ...OPFS_STAT_FEATHER,\n ...RAM_STAT_HDF5,\n ...OPFS_STAT_PARQUET,\n ...OPFS_STRINGS,\n ...OPFS_TAC,\n ...OPFS_TAIL,\n ...OPFS_TAIL_FEATHER,\n ...RAM_TAIL_HDF5,\n ...OPFS_TAIL_PARQUET,\n ...OPFS_TAR,\n ...OPFS_TEE,\n ...OPFS_TOUCH,\n ...OPFS_TR,\n ...OPFS_TREE,\n ...OPFS_TSORT,\n ...OPFS_UNEXPAND,\n ...OPFS_UNIQ,\n ...OPFS_UNZIP,\n ...OPFS_WC,\n ...OPFS_WC_FEATHER,\n ...RAM_WC_HDF5,\n ...OPFS_WC_PARQUET,\n ...OPFS_XXD,\n ...OPFS_ZCAT,\n ...OPFS_ZGREP,\n ...OPFS_ZIP,\n]\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { type PathSpec, record, ResourceName } from '@struktoai/mirage-core'\nimport { resolveFileHandle, toWritableChunk } from './utils.ts'\n\nexport async function appendBytes(\n root: FileSystemDirectoryHandle,\n p: PathSpec,\n data: Uint8Array,\n): Promise<void> {\n const start = performance.now()\n const virtual = p.stripPrefix\n const handle = await resolveFileHandle(root, virtual, { create: true })\n const existing = await handle.getFile()\n const existingBytes = new Uint8Array(await existing.arrayBuffer())\n const merged = new Uint8Array(existingBytes.byteLength + data.byteLength)\n merged.set(existingBytes, 0)\n merged.set(data, existingBytes.byteLength)\n const writable = await handle.createWritable()\n await writable.write(toWritableChunk(merged))\n await writable.close()\n record('append', virtual, ResourceName.OPFS, data.byteLength, start)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { isNotFound, resolveFileHandle, toWritableChunk } from './utils.ts'\n\nexport async function copy(\n root: FileSystemDirectoryHandle,\n src: PathSpec,\n dst: PathSpec,\n): Promise<void> {\n let srcHandle: FileSystemFileHandle\n try {\n srcHandle = await resolveFileHandle(root, src.stripPrefix, { create: false })\n } catch (err) {\n if (isNotFound(err)) throw new Error(`file not found: ${src.stripPrefix}`)\n throw err\n }\n const file = await srcHandle.getFile()\n const data = new Uint8Array(await file.arrayBuffer())\n const dstHandle = await resolveFileHandle(root, dst.stripPrefix, { create: true })\n const writable = await dstHandle.createWritable()\n await writable.write(toWritableChunk(data))\n await writable.close()\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { PathSpec } from '@struktoai/mirage-core'\nimport { SCOPE_ERROR } from './constants.ts'\nimport { readdir } from './readdir.ts'\n\nfunction fnmatch(name: string, pattern: string): boolean {\n let re = '^'\n for (const ch of pattern) {\n if (ch === '*') re += '.*'\n else if (ch === '?') re += '.'\n else if (/[.+^${}()|[\\]\\\\]/.test(ch)) re += '\\\\' + ch\n else re += ch\n }\n re += '$'\n return new RegExp(re).test(name)\n}\n\nfunction basenameOf(p: string): string {\n return p.slice(p.lastIndexOf('/') + 1)\n}\n\nexport async function resolveGlob(\n root: FileSystemDirectoryHandle,\n paths: readonly PathSpec[],\n): Promise<PathSpec[]> {\n const result: PathSpec[] = []\n for (const p of paths) {\n if (p.resolved) {\n result.push(p)\n } else if (p.pattern !== null) {\n const dirSpec = new PathSpec({\n original: p.directory,\n directory: p.directory,\n resolved: true,\n prefix: p.prefix,\n })\n const entries = await readdir(root, dirSpec)\n const matched: PathSpec[] = []\n for (const e of entries) {\n if (fnmatch(basenameOf(e), p.pattern)) {\n matched.push(\n new PathSpec({\n original: e,\n directory: p.directory,\n resolved: true,\n prefix: p.prefix,\n }),\n )\n }\n }\n if (matched.length > SCOPE_ERROR) matched.length = SCOPE_ERROR\n result.push(...matched)\n } else {\n result.push(p)\n }\n }\n return result\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport const SCOPE_WARN = 5000\nexport const SCOPE_ERROR = 50000\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { isNotFound, resolveFileHandle, toWritableChunk } from './utils.ts'\n\nexport async function truncate(\n root: FileSystemDirectoryHandle,\n path: PathSpec,\n length: number,\n): Promise<void> {\n const virtual = path.stripPrefix\n let handle: FileSystemFileHandle\n let existing: Uint8Array\n try {\n handle = await resolveFileHandle(root, virtual, { create: false })\n const file = await handle.getFile()\n existing = new Uint8Array(await file.arrayBuffer())\n } catch (err) {\n if (isNotFound(err)) {\n handle = await resolveFileHandle(root, virtual, { create: true })\n existing = new Uint8Array()\n } else {\n throw err\n }\n }\n const out = new Uint8Array(length)\n out.set(existing.subarray(0, Math.min(existing.byteLength, length)))\n const writable = await handle.createWritable()\n await writable.write(toWritableChunk(out))\n await writable.close()\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { appendBytes as coreAppend } from '../../core/opfs/append.ts'\n\nexport const appendOp: RegisteredOp = {\n name: 'append',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec, args: readonly unknown[]) => {\n const data = args[0]\n if (!(data instanceof Uint8Array)) {\n throw new TypeError('append op requires a Uint8Array as the first arg')\n }\n return coreAppend(accessor.rootHandle, path, data)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { create as coreCreate } from '../../core/opfs/create.ts'\n\nexport const createOp: RegisteredOp = {\n name: 'create',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreCreate(accessor.rootHandle, path),\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { writeBytes } from './write.ts'\n\nexport function create(root: FileSystemDirectoryHandle, path: PathSpec): Promise<void> {\n return writeBytes(root, path, new Uint8Array())\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { mkdir as coreMkdir } from '../../core/opfs/mkdir.ts'\n\nexport const mkdirOp: RegisteredOp = {\n name: 'mkdir',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreMkdir(accessor.rootHandle, path, true),\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { read as coreRead } from '../../core/opfs/read.ts'\n\nexport const readOp: RegisteredOp = {\n name: 'read',\n resource: ResourceName.OPFS,\n filetype: null,\n write: false,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreRead(accessor.rootHandle, path),\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { readdir as coreReaddir } from '../../core/opfs/readdir.ts'\n\nexport const readdirOp: RegisteredOp = {\n name: 'readdir',\n resource: ResourceName.OPFS,\n filetype: null,\n write: false,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreReaddir(accessor.rootHandle, path),\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { rename as coreRename } from '../../core/opfs/rename.ts'\n\nexport const renameOp: RegisteredOp = {\n name: 'rename',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec, args: readonly unknown[]) => {\n const dst = args[0]\n if (dst === undefined || dst === null || typeof dst !== 'object' || !('original' in dst)) {\n throw new TypeError('rename op requires a PathSpec destination as the first arg')\n }\n return coreRename(accessor.rootHandle, path, dst as PathSpec)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { rmdir as coreRmdir } from '../../core/opfs/rmdir.ts'\n\nexport const rmdirOp: RegisteredOp = {\n name: 'rmdir',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreRmdir(accessor.rootHandle, path),\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { stat as coreStat } from '../../core/opfs/stat.ts'\n\nexport const statOp: RegisteredOp = {\n name: 'stat',\n resource: ResourceName.OPFS,\n filetype: null,\n write: false,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreStat(accessor.rootHandle, path),\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { truncate as coreTruncate } from '../../core/opfs/truncate.ts'\n\nexport const truncateOp: RegisteredOp = {\n name: 'truncate',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec, args: readonly unknown[]) => {\n const length = args[0]\n if (typeof length !== 'number') {\n throw new TypeError('truncate op requires a number length as the first arg')\n }\n return coreTruncate(accessor.rootHandle, path, length)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { unlink as coreUnlink } from '../../core/opfs/unlink.ts'\n\nexport const unlinkOp: RegisteredOp = {\n name: 'unlink',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec) => coreUnlink(accessor.rootHandle, path),\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { OPFSAccessor } from '../../accessor/opfs.ts'\nimport { writeBytes } from '../../core/opfs/write.ts'\n\nexport const writeOp: RegisteredOp = {\n name: 'write',\n resource: ResourceName.OPFS,\n filetype: null,\n write: true,\n fn: (accessor: OPFSAccessor, path: PathSpec, args: readonly unknown[]) => {\n const data = args[0]\n if (!(data instanceof Uint8Array)) {\n throw new TypeError('write op requires a Uint8Array as the first arg')\n }\n return writeBytes(accessor.rootHandle, path, data)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RegisteredOp } from '@struktoai/mirage-core'\nimport { appendOp } from './append.ts'\nimport { createOp } from './create.ts'\nimport { mkdirOp } from './mkdir.ts'\nimport { readOp } from './read.ts'\nimport { readdirOp } from './readdir.ts'\nimport { renameOp } from './rename.ts'\nimport { rmdirOp } from './rmdir.ts'\nimport { statOp } from './stat.ts'\nimport { truncateOp } from './truncate.ts'\nimport { unlinkOp } from './unlink.ts'\nimport { writeOp } from './write.ts'\n\nexport const OPFS_OPS: readonly RegisteredOp[] = [\n appendOp,\n createOp,\n mkdirOp,\n readOp,\n readdirOp,\n renameOp,\n rmdirOp,\n statOp,\n truncateOp,\n unlinkOp,\n writeOp,\n]\n\nexport {\n appendOp,\n createOp,\n mkdirOp,\n readOp,\n readdirOp,\n renameOp,\n rmdirOp,\n statOp,\n truncateOp,\n unlinkOp,\n writeOp,\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport const OPFS_PROMPT = `{prefix}\n Browser Origin Private File System. Persistent per-origin storage that survives page reloads.\n Standard commands: ls, cat, head, tail, grep, wc, find, tree, mkdir, touch, cp, mv, rm, tee.`\n"],"mappings":";AAcA;AAAA,EAOE,gBAAAA;AAAA,OACK;;;ACRP,SAAS,gBAAgB;AAMlB,IAAM,eAAN,cAA2B,SAAS;AAAA,EACxB;AAAA,EAEjB,YAAY,UAA8B;AACxC,UAAM;AACN,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,IAAI,aAAwC;AAC1C,WAAO,KAAK,SAAS,cAAc;AAAA,EACrC;AACF;;;ACjBA;AAAA,EACE;AAAA,EACA;AAAA,EACA,gBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;;;ACXP,SAAwB,cAAc,oBAAoB;;;ACAnD,SAAS,KAAK,GAAmB;AACtC,SAAO,IAAI,EAAE,QAAQ,cAAc,EAAE,CAAC;AACxC;AAoBO,SAAS,cAAc,SAA2B;AACvD,QAAM,QAAkB,CAAC;AACzB,aAAW,OAAO,QAAQ,MAAM,GAAG,GAAG;AACpC,QAAI,QA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AG,GAAG,OAA0B;AAAA,EACxE;AAAA,EAEA,MAAM,KAAK,OAAiD;AAC1D,WAAO,YAAS,MAAM,KAAK,WAAW,GAAG,KAAK;AAAA,EAChD;AAAA,EAEA,MAAM,WAAuC;AAC3C,UAAM,SAAS,MAAM,KAAK,WAAW;AACrC,UAAM,QAAoC,CAAC;AAC3C,UAAM,UAAU,QAAQ,IAAI,KAAK;AACjC,UAAM,OAAiB,CAAC;AACxB,UAAM,SAAS,QAAQ,IAAI,IAAI;AAC/B,SAAK,KAAK;AACV,WAAO;AAAA,MACL,MAAM,KAAK;AAAA,MACX,eAAe;AAAA,MACf;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,UAAU,OAAyC;AACvD,UAAM,SAAS,MAAM,KAAK,WAAW;AACrC,eAAW,OAAO,MAAM,MAAM;AAC5B,YAAM,MAAM,IAAI,QAAQ,QAAQ,EAAE;AAClC,UAAI,QAAQ,GAAI;AAChB,YAAM,eAAe,QAAQ,GAAG;AAAA,IAClC;AACA,eAAW,CAAC,KAAK,IAAI,KAAK,OAAO,QAAQ,MAAM,KAAK,GAAG;AACrD,YAAM,OAAO,IAAI,MAAM,GAAG,EAAE,OAAO,CAAC,MAAM,MAAM,MAAM,MAAM,GAAG;AAC/D,YAAM,WAAW,KAAK,IAAI;AAC1B,UAAI,aAAa,OAAW;AAC5B,UAAI,MAAM;AACV,iBAAW,OAAO,MAAM;AACtB,cAAM,MAAM,IAAI,mBAAmB,KAAK,EAAE,QAAQ,KAAK,CAAC;AAAA,MAC1D;AACA,YAAM,KAAK,MAAM,IAAI,cAAc,UAAU,EAAE,QAAQ,KAAK,CAAC;AAC7D,YAAM,WAAW,MAAM,GAAG,eAAe;AACzC,YAAM,SAAS,MAAM,gBAAgB,IAAI,CAAC;AAC1C,YAAM,SAAS,MAAM;AAAA,IACvB;AAAA,EACF;AACF;","names":["ResourceName","ResourceName","copy","ResourceName","IOResult","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","materialize","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","AsyncLineIterator","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","limit","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","splitLinesNoTrailing","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ResourceName","ResourceName","record","ResourceName","record","ResourceName","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","materialize","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","readFile","materialize","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","IOResult","PathSpec","ResourceName","command","specOf","PathSpec","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","materialize","result","IOResult","readStdinAsync","command","ResourceName","specOf","FileType","IOResult","ResourceName","command","specOf","ENC","IOResult","FileType","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","specOf","PathSpec","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","materialize","result","IOResult","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","materialize","result","IOResult","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","readFile","materialize","splitLinesNoTrailing","IOResult","pat","source","stream","io","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","resolveSource","specOf","ENC","makePathSpec","PathSpec","resolveSource","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","gunzip","materialize","resolveSource","specOf","ENC","makePathSpec","PathSpec","decompress","resolveSource","IOResult","materialize","gunzip","concat","command","ResourceName","specOf","AsyncLineIterator","IOResult","ProvisionResult","ResourceName","command","resolveSource","specOf","ENC","AsyncLineIterator","ProvisionResult","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","readStdinAsync","specOf","ENC","IOResult","materialize","readStdinAsync","PathSpec","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","splitLinesNoTrailing","splitFields","IOResult","materialize","command","ResourceName","specOf","IOResult","Precision","ProvisionResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","ProvisionResult","Precision","concat","readFile","materialize","IOResult","bytes","data","result","spread","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","FileType","IOResult","PathSpec","ResourceName","command","specOf","PathSpec","FileType","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","stat","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","stat","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","stat","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","materialize","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","IOResult","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","specOf","ENC","makePathSpec","PathSpec","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","IOResult","command","ResourceName","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","AsyncLineIterator","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","readStdinAsync","materialize","IOResult","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","makePathSpec","PathSpec","stripMount","materialize","readStdinAsync","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","normalize","IOResult","ResourceName","command","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","AsyncLineIterator","IOResult","resolveSource","command","ResourceName","specOf","FileType","IOResult","PathSpec","ResourceName","command","compilePattern","exitOnEmpty","grepStream","materialize","resolveSource","specOf","ENC","IOResult","resolveSource","compilePattern","stream","grepStream","exitOnEmpty","FileType","materialize","io","PathSpec","command","ResourceName","specOf","FileType","IOResult","ResourceName","command","specOf","IOResult","FileType","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","parseProgram","readStdinAsync","specOf","ENC","DEC","readFile","materialize","IOResult","parseProgram","writes","text","out","result","readStdinAsync","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","materialize","makePathSpec","PathSpec","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","out","result","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoEnds","readFile","materialize","readStdinAsync","IOResult","command","ResourceName","specOf","AsyncLineIterator","IOResult","PathSpec","ResourceName","command","resolveSource","specOf","ENC","makePathSpec","PathSpec","resolveSource","IOResult","AsyncLineIterator","joinLines","command","ResourceName","specOf","FileType","IOResult","ProvisionResult","ResourceName","command","specOf","FileType","ProvisionResult","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","AsyncLineIterator","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","headerAggregate","materialize","readStdinAsync","specOf","ENC","readFile","materialize","raw","concat","IOResult","readStdinAsync","command","ResourceName","specOf","headerAggregate","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","gunzip","gzip","materialize","specOf","ENC","makePathSpec","PathSpec","gzip","gunzip","create","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","IOResult","readStdinAsync","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","IOResult","resolveSource","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","specOf","PathSpec","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesKeepEnds","materialize","result","IOResult","readStdinAsync","command","ResourceName","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","padLeft","out","AsyncLineIterator","parseOptions","IOResult","resolveSource","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","specOf","ENC","DEC","makePathSpec","PathSpec","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","materialize","text","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","padRight","ENC","DEC","IOResult","resolveSource","ENC","command","ResourceName","specOf","IOResult","ResourceName","command","gunzip","materialize","readStdinAsync","specOf","ENC","materialize","readStdinAsync","IOResult","gunzip","command","ResourceName","specOf","IOResult","ResourceName","command","compilePattern","gunzip","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","compilePattern","materialize","gunzip","result","readStdinAsync","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","concat","IOResult","materialize","command","ResourceName","specOf","record","ResourceName","record","ResourceName","PathSpec","fnmatch","PathSpec","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName","ResourceName"]}