@struktoai/mirage-browser 0.0.2-alpha.0 → 0.0.3-alpha.0
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.
- package/README.md +61 -127
- package/dist/aliyun-F2ORS3KZ.js +8 -0
- package/dist/backblaze-HOVWPSV7.js +8 -0
- package/dist/box-VJSE5N7P.js +8 -0
- package/dist/ceph-CQKQ4NWW.js +8 -0
- package/dist/chunk-2H4KUUFP.js +26 -0
- package/dist/chunk-2H4KUUFP.js.map +1 -0
- package/dist/chunk-32VC36P4.js +89 -0
- package/dist/chunk-32VC36P4.js.map +1 -0
- package/dist/{chunk-MSNVGH6T.js → chunk-4YJMDF2S.js} +2 -4
- package/dist/chunk-4YJMDF2S.js.map +1 -0
- package/dist/chunk-54NTYJEO.js +13 -0
- package/dist/chunk-54NTYJEO.js.map +1 -0
- package/dist/chunk-63GZEZW4.js +79 -0
- package/dist/chunk-63GZEZW4.js.map +1 -0
- package/dist/{chunk-UW3D2AF6.js → chunk-6K57U6CM.js} +2 -4
- package/dist/chunk-6K57U6CM.js.map +1 -0
- package/dist/chunk-72GY5B23.js +89 -0
- package/dist/chunk-72GY5B23.js.map +1 -0
- package/dist/{chunk-QYFCHCGX.js → chunk-ATLYBQSC.js} +14 -29
- package/dist/chunk-ATLYBQSC.js.map +1 -0
- package/dist/{chunk-ONQ5JGPR.js → chunk-BUXWUKN7.js} +9 -6
- package/dist/chunk-BUXWUKN7.js.map +1 -0
- package/dist/chunk-CAKSQ2LV.js +85 -0
- package/dist/chunk-CAKSQ2LV.js.map +1 -0
- package/dist/chunk-CO4FMKOF.js +89 -0
- package/dist/chunk-CO4FMKOF.js.map +1 -0
- package/dist/{chunk-5Q5GJUAF.js → chunk-D3JDGGKO.js} +19 -18
- package/dist/chunk-D3JDGGKO.js.map +1 -0
- package/dist/{chunk-DDM2Z7YA.js → chunk-D6HF462C.js} +2 -4
- package/dist/chunk-D6HF462C.js.map +1 -0
- package/dist/{chunk-27UVUTJH.js → chunk-EH2BN4JC.js} +34 -3
- package/dist/chunk-EH2BN4JC.js.map +1 -0
- package/dist/chunk-EUKHGXCE.js +89 -0
- package/dist/chunk-EUKHGXCE.js.map +1 -0
- package/dist/chunk-GHKX2BA3.js +89 -0
- package/dist/chunk-GHKX2BA3.js.map +1 -0
- package/dist/{chunk-FL7YLP7D.js → chunk-HGSTRD7H.js} +10 -8
- package/dist/chunk-HGSTRD7H.js.map +1 -0
- package/dist/chunk-HYUESAQS.js +24 -0
- package/dist/chunk-HYUESAQS.js.map +1 -0
- package/dist/{chunk-ZJ6ROCTP.js → chunk-INLL7LRM.js} +11 -14
- package/dist/chunk-INLL7LRM.js.map +1 -0
- package/dist/chunk-J54OBIJA.js +29 -0
- package/dist/chunk-J54OBIJA.js.map +1 -0
- package/dist/{chunk-DPC7QRYO.js → chunk-JCS5EG5A.js} +9 -6
- package/dist/chunk-JCS5EG5A.js.map +1 -0
- package/dist/chunk-JSAQMYPK.js +26 -0
- package/dist/chunk-JSAQMYPK.js.map +1 -0
- package/dist/{chunk-CZOTICOC.js → chunk-JVTKE6DB.js} +2 -4
- package/dist/chunk-JVTKE6DB.js.map +1 -0
- package/dist/{chunk-3PWPFOPS.js → chunk-MO5DGX42.js} +19 -18
- package/dist/chunk-MO5DGX42.js.map +1 -0
- package/dist/{chunk-LZRPA2P7.js → chunk-N43C6XFP.js} +9 -6
- package/dist/chunk-N43C6XFP.js.map +1 -0
- package/dist/chunk-NMZBJOFW.js +26 -0
- package/dist/chunk-NMZBJOFW.js.map +1 -0
- package/dist/chunk-O5ONB7QT.js +26 -0
- package/dist/chunk-O5ONB7QT.js.map +1 -0
- package/dist/{chunk-LSSB3AEW.js → chunk-RD7ED27I.js} +5 -12
- package/dist/chunk-RD7ED27I.js.map +1 -0
- package/dist/chunk-RJ4RR3BR.js +92 -0
- package/dist/chunk-RJ4RR3BR.js.map +1 -0
- package/dist/chunk-RJ5FBBL6.js +79 -0
- package/dist/chunk-RJ5FBBL6.js.map +1 -0
- package/dist/{chunk-SQQI4A6Y.js → chunk-RZRXEXHM.js} +2 -4
- package/dist/chunk-RZRXEXHM.js.map +1 -0
- package/dist/{chunk-CQJTW45B.js → chunk-SBAUYZJB.js} +2 -4
- package/dist/chunk-SBAUYZJB.js.map +1 -0
- package/dist/chunk-SJB2KXDM.js +2109 -0
- package/dist/chunk-SJB2KXDM.js.map +1 -0
- package/dist/{chunk-33SBWNB4.js → chunk-T43CZ3IZ.js} +9 -8
- package/dist/chunk-T43CZ3IZ.js.map +1 -0
- package/dist/{chunk-LG6GVNOL.js → chunk-TPFH5V4D.js} +2 -4
- package/dist/chunk-TPFH5V4D.js.map +1 -0
- package/dist/{chunk-LUDXUYIA.js → chunk-WEJGUCCL.js} +19 -18
- package/dist/chunk-WEJGUCCL.js.map +1 -0
- package/dist/{chunk-UFXEZ56G.js → chunk-WZ53HLH6.js} +18 -18
- package/dist/chunk-WZ53HLH6.js.map +1 -0
- package/dist/{chunk-VLFE4FGD.js → chunk-XFREXNA2.js} +2 -3
- package/dist/chunk-XFREXNA2.js.map +1 -0
- package/dist/chunk-YEDSFMWK.js +79 -0
- package/dist/chunk-YEDSFMWK.js.map +1 -0
- package/dist/chunk-YGRKFONX.js +26 -0
- package/dist/chunk-YGRKFONX.js.map +1 -0
- package/dist/config-7IZCGWKX.js +11 -0
- package/dist/config-AT74FARJ.js +11 -0
- package/dist/config-C2AYHACT.js +11 -0
- package/dist/{config-U4UI4OKA.js → config-ET26F632.js} +4 -2
- package/dist/config-GHJOYNM6.js +11 -0
- package/dist/config-L55UXIF4.js +11 -0
- package/dist/config-NV5WXP64.js +11 -0
- package/dist/config-V7BLK5WP.js +11 -0
- package/dist/digitalocean-KC7VIWZK.js +8 -0
- package/dist/discord-W3DSEXKN.js +7 -0
- package/dist/dropbox-GI273OVA.js +8 -0
- package/dist/gcs-WRQTU27E.js +8 -0
- package/dist/gdocs-EI2EFVKG.js +8 -0
- package/dist/gdrive-62HD67IP.js +8 -0
- package/dist/github-SWLYD3LS.js +7 -0
- package/dist/github_ci-7P7VGBKM.js +8 -0
- package/dist/gmail-B7HXHZ7D.js +8 -0
- package/dist/gsheets-OTBW2JWG.js +8 -0
- package/dist/gslides-MXSR4HRY.js +8 -0
- package/dist/index.d.ts +342 -166
- package/dist/index.js +264 -373
- package/dist/index.js.map +1 -1
- package/dist/langfuse-FWKU6E3F.js +7 -0
- package/dist/linear-SHVG3XVT.js +7 -0
- package/dist/minio-246KOHBJ.js +8 -0
- package/dist/mongodb-2ITJUDCF.js +7 -0
- package/dist/notion-BOBBSJSG.js +7 -0
- package/dist/oci-T7VREPQW.js +8 -0
- package/dist/opfs-3XNAXR5B.js +7 -0
- package/dist/qingstor-WIC27LS3.js +8 -0
- package/dist/qingstor-WIC27LS3.js.map +1 -0
- package/dist/r2-EAX6KHEI.js +8 -0
- package/dist/r2-EAX6KHEI.js.map +1 -0
- package/dist/{s3-A4XFE6QV.js → s3-GD2WKLWR.js} +2 -2
- package/dist/s3-GD2WKLWR.js.map +1 -0
- package/dist/scaleway-OVFRZBKW.js +8 -0
- package/dist/scaleway-OVFRZBKW.js.map +1 -0
- package/dist/seaweedfs-EOJVO432.js +8 -0
- package/dist/seaweedfs-EOJVO432.js.map +1 -0
- package/dist/slack-RNXMU5OC.js +7 -0
- package/dist/slack-RNXMU5OC.js.map +1 -0
- package/dist/supabase-VSUNLIJ6.js +8 -0
- package/dist/supabase-VSUNLIJ6.js.map +1 -0
- package/dist/tencent-YYM5WUVU.js +8 -0
- package/dist/tencent-YYM5WUVU.js.map +1 -0
- package/dist/trello-MNR3VPTT.js +7 -0
- package/dist/trello-MNR3VPTT.js.map +1 -0
- package/dist/wasabi-K5ANTZ2C.js +8 -0
- package/dist/wasabi-K5ANTZ2C.js.map +1 -0
- package/package.json +3 -3
- package/dist/box-Y2SJWAAO.js +0 -8
- package/dist/chunk-27UVUTJH.js.map +0 -1
- package/dist/chunk-33SBWNB4.js.map +0 -1
- package/dist/chunk-3PWPFOPS.js.map +0 -1
- package/dist/chunk-5Q5GJUAF.js.map +0 -1
- package/dist/chunk-7GZXXXAS.js +0 -24
- package/dist/chunk-7GZXXXAS.js.map +0 -1
- package/dist/chunk-B4SYG2FD.js +0 -24
- package/dist/chunk-B4SYG2FD.js.map +0 -1
- package/dist/chunk-BIZONEJC.js +0 -24
- package/dist/chunk-BIZONEJC.js.map +0 -1
- package/dist/chunk-CQJTW45B.js.map +0 -1
- package/dist/chunk-CZOTICOC.js.map +0 -1
- package/dist/chunk-DDM2Z7YA.js.map +0 -1
- package/dist/chunk-DPC7QRYO.js.map +0 -1
- package/dist/chunk-FL7YLP7D.js.map +0 -1
- package/dist/chunk-GFWWDQUZ.js +0 -24
- package/dist/chunk-GFWWDQUZ.js.map +0 -1
- package/dist/chunk-LG6GVNOL.js.map +0 -1
- package/dist/chunk-LSSB3AEW.js.map +0 -1
- package/dist/chunk-LUDXUYIA.js.map +0 -1
- package/dist/chunk-LZRPA2P7.js.map +0 -1
- package/dist/chunk-ML57VOCK.js +0 -7590
- package/dist/chunk-ML57VOCK.js.map +0 -1
- package/dist/chunk-MSNVGH6T.js.map +0 -1
- package/dist/chunk-NBWTZXH2.js +0 -27
- package/dist/chunk-NBWTZXH2.js.map +0 -1
- package/dist/chunk-ONQ5JGPR.js.map +0 -1
- package/dist/chunk-OPROOV6J.js +0 -24
- package/dist/chunk-OPROOV6J.js.map +0 -1
- package/dist/chunk-QARIHW3I.js +0 -23
- package/dist/chunk-QARIHW3I.js.map +0 -1
- package/dist/chunk-QYFCHCGX.js.map +0 -1
- package/dist/chunk-SQQI4A6Y.js.map +0 -1
- package/dist/chunk-UFXEZ56G.js.map +0 -1
- package/dist/chunk-UW3D2AF6.js.map +0 -1
- package/dist/chunk-VLFE4FGD.js.map +0 -1
- package/dist/chunk-XIURBEVZ.js +0 -24
- package/dist/chunk-XIURBEVZ.js.map +0 -1
- package/dist/chunk-ZJ6ROCTP.js.map +0 -1
- package/dist/config-4FABMWVK.js +0 -9
- package/dist/config-DGIUMGBB.js +0 -9
- package/dist/config-G3TTNXLY.js +0 -9
- package/dist/config-GPCEEKCB.js +0 -9
- package/dist/config-KQ5VR2KZ.js +0 -9
- package/dist/config-LPMMVXLS.js +0 -9
- package/dist/config-VZGK63Z5.js +0 -9
- package/dist/discord-RG6URXXS.js +0 -7
- package/dist/dropbox-P7SOL7GN.js +0 -8
- package/dist/gcs-2QHB4CBT.js +0 -8
- package/dist/gdocs-JNZTOZ33.js +0 -8
- package/dist/gdrive-6MEIVN2F.js +0 -8
- package/dist/github-M7WODJR2.js +0 -7
- package/dist/github_ci-4XELEFSZ.js +0 -8
- package/dist/gmail-AO6A3URH.js +0 -8
- package/dist/gsheets-RFOKXMOJ.js +0 -8
- package/dist/gslides-GTVZPLLB.js +0 -8
- package/dist/langfuse-CDOLELMB.js +0 -7
- package/dist/linear-SXOQGG6B.js +0 -7
- package/dist/mongodb-HA7FAKDJ.js +0 -7
- package/dist/notion-ANZNMM3L.js +0 -7
- package/dist/oci-ML5ZRVZ2.js +0 -8
- package/dist/opfs-57XFMWWE.js +0 -7
- package/dist/r2-56O4Q2J4.js +0 -8
- package/dist/slack-QA7H7WLM.js +0 -7
- package/dist/supabase-NNK2RWG3.js +0 -8
- package/dist/trello-H6PZT2IT.js +0 -7
- /package/dist/{box-Y2SJWAAO.js.map → aliyun-F2ORS3KZ.js.map} +0 -0
- /package/dist/{config-4FABMWVK.js.map → backblaze-HOVWPSV7.js.map} +0 -0
- /package/dist/{config-DGIUMGBB.js.map → box-VJSE5N7P.js.map} +0 -0
- /package/dist/{config-G3TTNXLY.js.map → ceph-CQKQ4NWW.js.map} +0 -0
- /package/dist/{config-GPCEEKCB.js.map → config-7IZCGWKX.js.map} +0 -0
- /package/dist/{config-KQ5VR2KZ.js.map → config-AT74FARJ.js.map} +0 -0
- /package/dist/{config-LPMMVXLS.js.map → config-C2AYHACT.js.map} +0 -0
- /package/dist/{config-U4UI4OKA.js.map → config-ET26F632.js.map} +0 -0
- /package/dist/{config-VZGK63Z5.js.map → config-GHJOYNM6.js.map} +0 -0
- /package/dist/{discord-RG6URXXS.js.map → config-L55UXIF4.js.map} +0 -0
- /package/dist/{dropbox-P7SOL7GN.js.map → config-NV5WXP64.js.map} +0 -0
- /package/dist/{gcs-2QHB4CBT.js.map → config-V7BLK5WP.js.map} +0 -0
- /package/dist/{gdocs-JNZTOZ33.js.map → digitalocean-KC7VIWZK.js.map} +0 -0
- /package/dist/{gdrive-6MEIVN2F.js.map → discord-W3DSEXKN.js.map} +0 -0
- /package/dist/{github-M7WODJR2.js.map → dropbox-GI273OVA.js.map} +0 -0
- /package/dist/{github_ci-4XELEFSZ.js.map → gcs-WRQTU27E.js.map} +0 -0
- /package/dist/{gmail-AO6A3URH.js.map → gdocs-EI2EFVKG.js.map} +0 -0
- /package/dist/{gsheets-RFOKXMOJ.js.map → gdrive-62HD67IP.js.map} +0 -0
- /package/dist/{gslides-GTVZPLLB.js.map → github-SWLYD3LS.js.map} +0 -0
- /package/dist/{langfuse-CDOLELMB.js.map → github_ci-7P7VGBKM.js.map} +0 -0
- /package/dist/{linear-SXOQGG6B.js.map → gmail-B7HXHZ7D.js.map} +0 -0
- /package/dist/{mongodb-HA7FAKDJ.js.map → gsheets-OTBW2JWG.js.map} +0 -0
- /package/dist/{notion-ANZNMM3L.js.map → gslides-MXSR4HRY.js.map} +0 -0
- /package/dist/{oci-ML5ZRVZ2.js.map → langfuse-FWKU6E3F.js.map} +0 -0
- /package/dist/{opfs-57XFMWWE.js.map → linear-SHVG3XVT.js.map} +0 -0
- /package/dist/{r2-56O4Q2J4.js.map → minio-246KOHBJ.js.map} +0 -0
- /package/dist/{s3-A4XFE6QV.js.map → mongodb-2ITJUDCF.js.map} +0 -0
- /package/dist/{slack-QA7H7WLM.js.map → notion-BOBBSJSG.js.map} +0 -0
- /package/dist/{supabase-NNK2RWG3.js.map → oci-T7VREPQW.js.map} +0 -0
- /package/dist/{trello-H6PZT2IT.js.map → opfs-3XNAXR5B.js.map} +0 -0
package/README.md
CHANGED
|
@@ -23,135 +23,125 @@
|
|
|
23
23
|
<img src="https://img.shields.io/npm/v/%40struktoai%2Fmirage-browser.svg?color=0C0C0C&labelColor=FAFAFA"/></a>
|
|
24
24
|
</p>
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
<p align="center">
|
|
27
|
+
<a href="https://github.com/strukto-ai/mirage#readme"><img alt="README in English" src="https://img.shields.io/badge/English-d9d9d9"></a>
|
|
28
|
+
<a href="https://github.com/strukto-ai/mirage/blob/main/readme/README.zh-CN.md"><img alt="简体中文 README" src="https://img.shields.io/badge/简体中文-d9d9d9"></a>
|
|
29
|
+
<a href="https://github.com/strukto-ai/mirage/blob/main/readme/README.zh-TW.md"><img alt="繁體中文 README" src="https://img.shields.io/badge/繁體中文-d9d9d9"></a>
|
|
30
|
+
<a href="https://github.com/strukto-ai/mirage/blob/main/readme/README.fr.md"><img alt="README en Français" src="https://img.shields.io/badge/Français-d9d9d9"></a>
|
|
31
|
+
<a href="https://github.com/strukto-ai/mirage/blob/main/readme/README.vi.md"><img alt="README Tiếng Việt" src="https://img.shields.io/badge/Ti%E1%BA%BFng%20Vi%E1%BB%87t-d9d9d9"></a>
|
|
32
|
+
<a href="https://github.com/strukto-ai/mirage/blob/main/readme/README.ko.md"><img alt="README 한국어" src="https://img.shields.io/badge/%ED%95%9C%EA%B5%AD%EC%96%B4-d9d9d9"></a>
|
|
33
|
+
</p>
|
|
27
34
|
|
|
28
|
-
|
|
35
|
+
Mirage is **a Unified Virtual File System for AI Agents**: it mounts services and data sources like S3, Google Drive, Slack, Gmail, and Redis side-by-side as one filesystem. Any LLM that already knows bash can read, grep, and pipe across every backend out of the box, with zero new vocabulary.
|
|
29
36
|
|
|
30
37
|
```ts
|
|
31
38
|
const ws = new Workspace({
|
|
32
|
-
'/data':
|
|
33
|
-
'/s3':
|
|
34
|
-
'/slack': new SlackResource({}),
|
|
35
|
-
'/github': new GitHubResource({}),
|
|
39
|
+
'/data': new RAMResource(),
|
|
40
|
+
'/s3': new S3Resource({ bucket: 'logs' }),
|
|
41
|
+
'/slack': new SlackResource({ token: process.env.SLACK_BOT_TOKEN! }),
|
|
36
42
|
})
|
|
37
43
|
|
|
38
|
-
await ws.execute('grep alert /slack/
|
|
39
|
-
await ws.execute('cat /github/mirage/README.md')
|
|
44
|
+
await ws.execute('grep -r alert /slack/channels/general__C04QX/ | wc -l')
|
|
40
45
|
await ws.execute('cp /s3/report.csv /data/local.csv')
|
|
46
|
+
await ws.execute('wc -l $(find /s3/data -name "*.jsonl")')
|
|
47
|
+
|
|
48
|
+
// Commands are extensible: register new commands, or override one per
|
|
49
|
+
// resource + filetype, e.g. `cat` on S3 Parquet renders rows as JSON.
|
|
50
|
+
ws.command('summarize', ...)
|
|
51
|
+
ws.command('cat', { resource: 's3', filetype: 'parquet' }, ...)
|
|
52
|
+
|
|
53
|
+
await ws.execute('summarize /data/local.csv')
|
|
54
|
+
await ws.execute('cat /s3/events/2026-05-06.parquet | jq .user')
|
|
41
55
|
```
|
|
42
56
|
|
|
43
57
|
## About
|
|
44
58
|
|
|
45
|
-
- **One
|
|
46
|
-
- **
|
|
47
|
-
- **
|
|
48
|
-
- **
|
|
49
|
-
- **
|
|
50
|
-
- **Works with major agent application frameworks:** OpenAI Agents SDK, Vercel AI SDK (TypeScript), LangChain, Pydantic AI, CAMEL, and OpenHands.
|
|
51
|
-
- **Lightweight CLI + daemon:** plugs into coding agents like Claude Code and Codex so they reach every mounted resource through familiar bash, getting more useful work done per turn.
|
|
59
|
+
- **One interface instead of N SDKs and M MCPs.** Every service speaks the same filesystem semantics, and pipelines compose across services as naturally as on a local disk.
|
|
60
|
+
- **Around 50 built-in backends:** RAM, Disk, Redis, S3 / R2 / OCI / Supabase / GCS, Gmail / GDrive / GDocs / GSheets / GSlides, GitHub / Linear / Notion / Trello, Slack / Discord / Telegram / Email, MongoDB / Postgres / LanceDB, SSH, and more, mounted side-by-side under a single root.
|
|
61
|
+
- **Portable workspaces:** clone, snapshot, and version a workspace; agent runs move between machines without restarting or reconfiguring the system.
|
|
62
|
+
- **Embeddable:** the Python and TypeScript SDKs run in-process inside FastAPI, Express, browser apps, or any async runtime; no separate process required.
|
|
63
|
+
- **Agent integrations:** OpenAI Agents SDK, Vercel AI SDK, LangChain, Pydantic AI, CAMEL, and OpenHands via the SDKs; coding agents like Claude Code and Codex via the lightweight CLI + daemon.
|
|
52
64
|
|
|
53
65
|
## Architecture
|
|
54
66
|
|
|
55
67
|
<p align="center">
|
|
56
68
|
<picture>
|
|
57
69
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/strukto-ai/mirage/main/assets/mirage-arch-dark.svg">
|
|
58
|
-
<img src="https://raw.githubusercontent.com/strukto-ai/mirage/main/assets/mirage-arch-light.svg" alt="Mirage architecture: AI Agent and Application → Mirage Bash and VFS → Dispatcher & Cache → Infrastructure and Remote" width="
|
|
70
|
+
<img src="https://raw.githubusercontent.com/strukto-ai/mirage/main/assets/mirage-arch-light.svg" alt="Mirage architecture: AI Agent and Application → Mirage Bash and VFS → Dispatcher & Cache → Infrastructure and Remote" width="720">
|
|
59
71
|
</picture>
|
|
60
72
|
</p>
|
|
61
73
|
|
|
62
74
|
## Installation
|
|
63
75
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
- **Python** ≥ 3.12 for the `mirage-ai` package and the `mirage` CLI
|
|
76
|
+
- **Python** ≥ 3.11 for the `mirage-ai` package and the `mirage` CLI
|
|
67
77
|
- **Node.js** ≥ 20 for the TypeScript SDK
|
|
68
78
|
- **macOS** or **Linux** (FUSE-based mounts require platform support)
|
|
69
79
|
|
|
70
80
|
### Python
|
|
71
81
|
|
|
72
82
|
```bash
|
|
73
|
-
uv add mirage-ai
|
|
83
|
+
uv add mirage-ai # installs the `mirage` library and the `mirage` CLI binary
|
|
74
84
|
```
|
|
75
85
|
|
|
76
|
-
This installs both the `mirage` library and the `mirage` CLI binary.
|
|
77
|
-
|
|
78
86
|
### TypeScript
|
|
79
87
|
|
|
80
|
-
Pick the package that matches your runtime:
|
|
81
|
-
|
|
82
88
|
```bash
|
|
83
89
|
npm install @struktoai/mirage-node # Node.js servers and CLIs
|
|
84
90
|
npm install @struktoai/mirage-browser # browser / edge runtimes
|
|
85
|
-
npm install @struktoai/mirage-
|
|
91
|
+
npm install @struktoai/mirage-agents # OpenAI / Vercel AI / LangChain / Mastra adapters
|
|
86
92
|
```
|
|
87
93
|
|
|
88
|
-
|
|
94
|
+
Both runtime packages pull in `@struktoai/mirage-core` automatically.
|
|
89
95
|
|
|
90
96
|
### CLI
|
|
91
97
|
|
|
92
98
|
```bash
|
|
93
99
|
curl -fsSL https://strukto.ai/mirage/install.sh | sh
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
Or via your package manager of choice:
|
|
97
|
-
|
|
98
|
-
```bash
|
|
100
|
+
# or
|
|
99
101
|
npm install -g @struktoai/mirage-cli
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
```bash
|
|
102
|
+
# or
|
|
103
103
|
uvx mirage-ai
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
```bash
|
|
104
|
+
# or
|
|
107
105
|
npx @struktoai/mirage-cli
|
|
108
106
|
```
|
|
109
107
|
|
|
110
|
-
## Quickstart
|
|
108
|
+
## Quickstart
|
|
109
|
+
|
|
110
|
+
### Python
|
|
111
111
|
|
|
112
112
|
```python
|
|
113
113
|
from mirage import Workspace
|
|
114
|
-
from mirage.resource.gdocs import GDocsConfig, GDocsResource
|
|
115
114
|
from mirage.resource.ram import RAMResource
|
|
116
115
|
from mirage.resource.s3 import S3Config, S3Resource
|
|
117
|
-
from mirage.resource.slack import SlackConfig, SlackResource
|
|
118
116
|
|
|
119
117
|
ws = Workspace({
|
|
120
|
-
"/data":
|
|
121
|
-
"/s3":
|
|
122
|
-
"/slack": SlackResource(SlackConfig()),
|
|
123
|
-
"/docs": GDocsResource(GDocsConfig()),
|
|
118
|
+
"/data": RAMResource(),
|
|
119
|
+
"/s3": S3Resource(S3Config(bucket="my-bucket")),
|
|
124
120
|
})
|
|
125
121
|
|
|
126
122
|
await ws.execute("cp /s3/report.csv /data/report.csv")
|
|
127
123
|
await ws.execute("grep alert /s3/data/log.jsonl | wc -l")
|
|
128
124
|
|
|
129
|
-
ws.snapshot("demo.tar")
|
|
125
|
+
await ws.snapshot("demo.tar")
|
|
130
126
|
```
|
|
131
127
|
|
|
132
|
-
|
|
128
|
+
### TypeScript
|
|
133
129
|
|
|
134
130
|
```ts
|
|
135
|
-
import {
|
|
136
|
-
Workspace,
|
|
137
|
-
RAMResource,
|
|
138
|
-
S3Resource,
|
|
139
|
-
SlackResource,
|
|
140
|
-
GDocsResource,
|
|
141
|
-
} from '@struktoai/mirage-browser'
|
|
131
|
+
import { Workspace, RAMResource, S3Resource } from '@struktoai/mirage-node'
|
|
142
132
|
|
|
143
133
|
const ws = new Workspace({
|
|
144
134
|
'/data': new RAMResource(),
|
|
145
135
|
'/s3': new S3Resource({ bucket: 'my-bucket' }),
|
|
146
|
-
'/slack': new SlackResource({}),
|
|
147
|
-
'/docs': new GDocsResource({}),
|
|
148
136
|
})
|
|
149
137
|
|
|
150
138
|
await ws.execute('cp /s3/report.csv /data/report.csv')
|
|
151
139
|
await ws.execute('grep alert /s3/data/log.jsonl | wc -l')
|
|
140
|
+
|
|
141
|
+
await ws.snapshot('demo.tar')
|
|
152
142
|
```
|
|
153
143
|
|
|
154
|
-
|
|
144
|
+
### CLI
|
|
155
145
|
|
|
156
146
|
```bash
|
|
157
147
|
mirage workspace create ws.yaml --id demo
|
|
@@ -163,89 +153,33 @@ mirage workspace load demo.tar --id demo-restored
|
|
|
163
153
|
|
|
164
154
|
## Agent Frameworks
|
|
165
155
|
|
|
166
|
-
Mirage
|
|
167
|
-
|
|
168
|
-
### OpenAI Agents SDK (Python)
|
|
156
|
+
Mirage plugs into agent frameworks as a sandbox or tool layer. POSIX operations such as `read` can also be customized per resource and filetype, e.g. reading a PDF returns parsed pages instead of raw bytes.
|
|
169
157
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
from agents.sandbox import SandboxAgent, SandboxRunConfig
|
|
176
|
-
|
|
177
|
-
from mirage.agents.openai_agents import MirageSandboxClient
|
|
178
|
-
|
|
179
|
-
client = MirageSandboxClient(ws)
|
|
180
|
-
agent = SandboxAgent(
|
|
181
|
-
name="Mirage Sandbox Agent",
|
|
182
|
-
model="gpt-5.4-nano",
|
|
183
|
-
instructions=ws.file_prompt,
|
|
184
|
-
)
|
|
185
|
-
|
|
186
|
-
result = await Runner.run(
|
|
187
|
-
agent,
|
|
188
|
-
"Summarize /s3/data/report.parquet into /report.txt.",
|
|
189
|
-
run_config=RunConfig(sandbox=SandboxRunConfig(client=client)),
|
|
190
|
-
)
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### Vercel AI SDK (TypeScript)
|
|
194
|
-
|
|
195
|
-
`mirageTools(ws)` exposes the workspace as a typed AI SDK tool set, so any model wired into the AI SDK can read and write across mounts, in Node or the browser.
|
|
196
|
-
|
|
197
|
-
```ts
|
|
198
|
-
import { generateText } from 'ai'
|
|
199
|
-
import { openai } from '@ai-sdk/openai'
|
|
200
|
-
import { mirageTools } from '@struktoai/mirage-agents/vercel'
|
|
201
|
-
import { buildSystemPrompt } from '@struktoai/mirage-agents/openai'
|
|
202
|
-
|
|
203
|
-
const { text } = await generateText({
|
|
204
|
-
model: openai('gpt-5.4-nano'),
|
|
205
|
-
system: buildSystemPrompt({ mountInfo: { '/': 'In-memory filesystem' } }),
|
|
206
|
-
prompt: "Use readFile to read /docs/paper.pdf, then describe what's in it.",
|
|
207
|
-
tools: mirageTools(ws),
|
|
208
|
-
})
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
LangChain, Pydantic AI, CAMEL, OpenHands, and Mastra adapters live alongside these.
|
|
158
|
+
| | Integrations |
|
|
159
|
+
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
160
|
+
| Python | [OpenAI Agents SDK](https://docs.mirage.strukto.ai/python/agents/openai-agents), [LangChain](https://docs.mirage.strukto.ai/python/agents/langchain), [Pydantic AI](https://docs.mirage.strukto.ai/python/agents/pydantic-ai), [CAMEL](https://docs.mirage.strukto.ai/python/agents/camel), [OpenHands](https://docs.mirage.strukto.ai/python/agents/openhands), [Agno](https://docs.mirage.strukto.ai/python/agents/agno) |
|
|
161
|
+
| TypeScript | [Vercel AI SDK](https://docs.mirage.strukto.ai/typescript/agents/vercel), [OpenAI Agents SDK](https://docs.mirage.strukto.ai/typescript/agents/openai), [LangChain](https://docs.mirage.strukto.ai/typescript/agents/langchain), [Mastra](https://docs.mirage.strukto.ai/typescript/agents/mastra) |
|
|
162
|
+
| Coding agents | [Claude Code](https://docs.mirage.strukto.ai/python/agents/claude-code), [Codex](https://docs.mirage.strukto.ai/python/agents/codex), [OpenCode](https://docs.mirage.strukto.ai/typescript/agents/opencode), [Pi](https://docs.mirage.strukto.ai/typescript/agents/pi) |
|
|
212
163
|
|
|
213
164
|
## Cache
|
|
214
165
|
|
|
215
|
-
Every `Workspace`
|
|
166
|
+
Every `Workspace` has a two-layer cache so repeated work against remote backends hits local state instead of the network:
|
|
216
167
|
|
|
217
|
-
- **Index cache
|
|
218
|
-
- **File cache
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
- **Redis**: shared across workers, processes, and machines. Best for serverless, multi-replica services, or when you want cache state to survive restarts.
|
|
168
|
+
- **Index cache:** listings and metadata. The first directory walk hits the API; later ones serve from the index until the TTL expires (default 10 minutes).
|
|
169
|
+
- **File cache:** object bytes. The first read streams from origin; later pipelines read from cache (default 512 MB).
|
|
170
|
+
|
|
171
|
+
Both layers default to in-process RAM with zero setup. A Redis store shares cache state across workers, processes, and machines:
|
|
222
172
|
|
|
223
173
|
```ts
|
|
224
|
-
import { RedisFileCacheStore,
|
|
174
|
+
import { RedisFileCacheStore, S3Resource, Workspace } from '@struktoai/mirage-node'
|
|
225
175
|
|
|
226
176
|
const ws = new Workspace(
|
|
227
177
|
{ '/s3': new S3Resource({ bucket: 'my-bucket' }) },
|
|
228
178
|
{
|
|
229
|
-
cache: new RedisFileCacheStore({ url: 'redis://localhost:6379/0',
|
|
230
|
-
index:
|
|
179
|
+
cache: new RedisFileCacheStore({ url: 'redis://localhost:6379/0', cacheLimit: '8GB' }),
|
|
180
|
+
index: { type: 'redis', url: 'redis://localhost:6379/0', ttl: 600 },
|
|
231
181
|
},
|
|
232
182
|
)
|
|
233
183
|
```
|
|
234
184
|
|
|
235
|
-
|
|
236
|
-
import { S3Resource, Workspace } from 'mirage/node'
|
|
237
|
-
|
|
238
|
-
const ws = new Workspace({ '/s3': new S3Resource({ bucket: 'my-bucket' }) })
|
|
239
|
-
|
|
240
|
-
// 1. Index miss → S3 LIST. Listing stored in index cache.
|
|
241
|
-
await ws.execute('ls /s3/data/')
|
|
242
|
-
|
|
243
|
-
// 2. Index hit → 0 network calls.
|
|
244
|
-
await ws.execute('find /s3/data/ -name "*.jsonl"')
|
|
245
|
-
|
|
246
|
-
// 3. File miss → S3 GET. Bytes stored in file cache.
|
|
247
|
-
await ws.execute('cat /s3/data/log.jsonl | wc -l')
|
|
248
|
-
|
|
249
|
-
// 4. File hit → 0 network calls.
|
|
250
|
-
await ws.execute('grep alert /s3/data/log.jsonl')
|
|
251
|
-
```
|
|
185
|
+
See the [cache docs](https://docs.mirage.strukto.ai/home/cache) for the full miss/hit lifecycle.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/resource/gdocs/config.ts
|
|
2
|
+
import { normalizeFields, redactConfigWithSchema, secretStr, z } from "@struktoai/mirage-core";
|
|
3
|
+
var GDocsConfigSchema = z.object({
|
|
4
|
+
clientId: z.string(),
|
|
5
|
+
clientSecret: secretStr().optional(),
|
|
6
|
+
refreshToken: secretStr()
|
|
7
|
+
});
|
|
8
|
+
function redactGDocsConfig(config) {
|
|
9
|
+
return redactConfigWithSchema(GDocsConfigSchema, config);
|
|
10
|
+
}
|
|
11
|
+
function normalizeGDocsConfig(input) {
|
|
12
|
+
return normalizeFields(input, {
|
|
13
|
+
rename: {
|
|
14
|
+
client_id: "clientId",
|
|
15
|
+
client_secret: "clientSecret",
|
|
16
|
+
refresh_token: "refreshToken"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
GDocsConfigSchema,
|
|
23
|
+
redactGDocsConfig,
|
|
24
|
+
normalizeGDocsConfig
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=chunk-2H4KUUFP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/gdocs/config.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { normalizeFields, redactConfigWithSchema, secretStr, z } from '@struktoai/mirage-core'\n\nexport interface GDocsConfig {\n clientId: string\n clientSecret?: string\n refreshToken: string\n refreshFn?: (refreshToken: string) => Promise<{ accessToken: string; expiresIn: number }>\n}\n\nexport interface GDocsConfigRedacted {\n clientId: string\n clientSecret?: '<REDACTED>'\n refreshToken: '<REDACTED>'\n}\n\nexport const GDocsConfigSchema = z.object({\n clientId: z.string(),\n clientSecret: secretStr().optional(),\n refreshToken: secretStr(),\n})\n\nexport function redactGDocsConfig(config: GDocsConfig): GDocsConfigRedacted {\n return redactConfigWithSchema(GDocsConfigSchema, config) as unknown as GDocsConfigRedacted\n}\n\nexport function normalizeGDocsConfig(input: Record<string, unknown>): GDocsConfig {\n return normalizeFields(input, {\n rename: {\n client_id: 'clientId',\n client_secret: 'clientSecret',\n refresh_token: 'refreshToken',\n },\n }) as unknown as GDocsConfig\n}\n"],"mappings":";AAcA,SAAS,iBAAiB,wBAAwB,WAAW,SAAS;AAe/D,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,UAAU,EAAE,OAAO;AAAA,EACnB,cAAc,UAAU,EAAE,SAAS;AAAA,EACnC,cAAc,UAAU;AAC1B,CAAC;AAEM,SAAS,kBAAkB,QAA0C;AAC1E,SAAO,uBAAuB,mBAAmB,MAAM;AACzD;AAEO,SAAS,qBAAqB,OAA6C;AAChF,SAAO,gBAAgB,OAAO;AAAA,IAC5B,QAAQ;AAAA,MACN,WAAW;AAAA,MACX,eAAe;AAAA,MACf,eAAe;AAAA,IACjB;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
S3Resource
|
|
3
|
+
} from "./chunk-XFREXNA2.js";
|
|
4
|
+
|
|
5
|
+
// src/resource/qingstor/qingstor.ts
|
|
6
|
+
import {
|
|
7
|
+
remapCommandsResource,
|
|
8
|
+
remapOpsResource,
|
|
9
|
+
ResourceName
|
|
10
|
+
} from "@struktoai/mirage-core";
|
|
11
|
+
|
|
12
|
+
// src/resource/qingstor/config.ts
|
|
13
|
+
import { redactConfigWithSchema, secretSchema, z } from "@struktoai/mirage-core";
|
|
14
|
+
var QingStorConfigSchema = z.object({
|
|
15
|
+
bucket: z.string(),
|
|
16
|
+
presignedUrlProvider: secretSchema(
|
|
17
|
+
z.custom((value) => typeof value === "function")
|
|
18
|
+
),
|
|
19
|
+
region: z.string().optional(),
|
|
20
|
+
endpoint: z.string().optional(),
|
|
21
|
+
defaultContentType: z.string().optional()
|
|
22
|
+
});
|
|
23
|
+
function resolvedQingStorEndpoint(config) {
|
|
24
|
+
if (config.endpoint !== void 0 && config.endpoint !== "") return config.endpoint;
|
|
25
|
+
if (config.region !== void 0 && config.region !== "") {
|
|
26
|
+
const region = config.region;
|
|
27
|
+
return `https://s3.${region}.qingstor.com`;
|
|
28
|
+
}
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
function qingStorToS3Config(config) {
|
|
32
|
+
const endpoint = resolvedQingStorEndpoint(config);
|
|
33
|
+
return {
|
|
34
|
+
bucket: config.bucket,
|
|
35
|
+
presignedUrlProvider: config.presignedUrlProvider,
|
|
36
|
+
...config.region !== void 0 ? { region: config.region } : {},
|
|
37
|
+
...endpoint !== void 0 ? { endpoint } : {},
|
|
38
|
+
...config.defaultContentType !== void 0 ? { defaultContentType: config.defaultContentType } : {}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function redactQingStorConfig(config) {
|
|
42
|
+
return redactConfigWithSchema(QingStorConfigSchema, config);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// src/resource/qingstor/prompt.ts
|
|
46
|
+
var QINGSTOR_BROWSER_PROMPT = `{prefix}
|
|
47
|
+
Remote QingStor bucket (S3-compatible) accessed via presigned URLs (browser runtime).
|
|
48
|
+
Supports the full filesystem command set: ls/tree/cat/grep/find/du/cp/mv/rm/etc.
|
|
49
|
+
Listing operations require the presigner to sign LIST/COPY operations in
|
|
50
|
+
addition to GET/PUT/HEAD/DELETE \u2014 see S3BrowserPresignedUrlProvider docs.`;
|
|
51
|
+
|
|
52
|
+
// src/resource/qingstor/qingstor.ts
|
|
53
|
+
var QingStorResource = class extends S3Resource {
|
|
54
|
+
kind = ResourceName.QINGSTOR;
|
|
55
|
+
prompt = QINGSTOR_BROWSER_PROMPT;
|
|
56
|
+
qingStorConfig;
|
|
57
|
+
qingStorOps;
|
|
58
|
+
qingStorCommands;
|
|
59
|
+
constructor(config) {
|
|
60
|
+
super(qingStorToS3Config(config));
|
|
61
|
+
this.qingStorConfig = config;
|
|
62
|
+
this.qingStorOps = remapOpsResource(super.ops(), ResourceName.QINGSTOR);
|
|
63
|
+
this.qingStorCommands = remapCommandsResource(super.commands(), ResourceName.QINGSTOR);
|
|
64
|
+
}
|
|
65
|
+
ops() {
|
|
66
|
+
return this.qingStorOps;
|
|
67
|
+
}
|
|
68
|
+
commands() {
|
|
69
|
+
return this.qingStorCommands;
|
|
70
|
+
}
|
|
71
|
+
getState() {
|
|
72
|
+
return Promise.resolve({
|
|
73
|
+
type: this.kind,
|
|
74
|
+
config: redactQingStorConfig(this.qingStorConfig)
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
loadState(_state) {
|
|
78
|
+
return Promise.resolve();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
resolvedQingStorEndpoint,
|
|
84
|
+
qingStorToS3Config,
|
|
85
|
+
redactQingStorConfig,
|
|
86
|
+
QINGSTOR_BROWSER_PROMPT,
|
|
87
|
+
QingStorResource
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=chunk-32VC36P4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/qingstor/qingstor.ts","../src/resource/qingstor/config.ts","../src/resource/qingstor/prompt.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n remapCommandsResource,\n remapOpsResource,\n ResourceName,\n type RegisteredCommand,\n type RegisteredOp,\n} from '@struktoai/mirage-core'\nimport { S3Resource } from '../s3/s3.ts'\nimport {\n qingStorToS3Config,\n redactQingStorConfig,\n type QingStorConfig,\n type QingStorConfigRedacted,\n} from './config.ts'\nimport { QINGSTOR_BROWSER_PROMPT } from './prompt.ts'\n\nexport interface QingStorResourceState {\n type: string\n config: QingStorConfigRedacted\n}\n\nexport class QingStorResource extends S3Resource {\n override readonly kind: string = ResourceName.QINGSTOR\n override readonly prompt: string = QINGSTOR_BROWSER_PROMPT\n readonly qingStorConfig: QingStorConfig\n private readonly qingStorOps: readonly RegisteredOp[]\n private readonly qingStorCommands: readonly RegisteredCommand[]\n\n constructor(config: QingStorConfig) {\n super(qingStorToS3Config(config))\n this.qingStorConfig = config\n this.qingStorOps = remapOpsResource(super.ops(), ResourceName.QINGSTOR)\n this.qingStorCommands = remapCommandsResource(super.commands(), ResourceName.QINGSTOR)\n }\n\n override ops(): readonly RegisteredOp[] {\n return this.qingStorOps\n }\n\n override commands(): readonly RegisteredCommand[] {\n return this.qingStorCommands\n }\n\n override getState(): Promise<QingStorResourceState> {\n return Promise.resolve({\n type: this.kind,\n config: redactQingStorConfig(this.qingStorConfig),\n })\n }\n\n override loadState(_state: QingStorResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { redactConfigWithSchema, secretSchema, z } from '@struktoai/mirage-core'\nimport type { S3BrowserPresignedUrlProvider, S3Config } from '../s3/config.ts'\n\nexport interface QingStorConfig {\n bucket: string\n presignedUrlProvider: S3BrowserPresignedUrlProvider\n region?: string\n endpoint?: string\n defaultContentType?: string\n}\n\nexport interface QingStorConfigRedacted extends Omit<QingStorConfig, 'presignedUrlProvider'> {\n presignedUrlProvider: '<REDACTED>'\n}\n\nexport const QingStorConfigSchema = z.object({\n bucket: z.string(),\n presignedUrlProvider: secretSchema(\n z.custom<S3BrowserPresignedUrlProvider>((value) => typeof value === 'function'),\n ),\n region: z.string().optional(),\n endpoint: z.string().optional(),\n defaultContentType: z.string().optional(),\n})\n\nexport function resolvedQingStorEndpoint(config: QingStorConfig): string | undefined {\n if (config.endpoint !== undefined && config.endpoint !== '') return config.endpoint\n if (config.region !== undefined && config.region !== '') {\n const region = config.region\n return `https://s3.${region}.qingstor.com`\n }\n return undefined\n}\n\nexport function qingStorToS3Config(config: QingStorConfig): S3Config {\n const endpoint = resolvedQingStorEndpoint(config)\n return {\n bucket: config.bucket,\n presignedUrlProvider: config.presignedUrlProvider,\n ...(config.region !== undefined ? { region: config.region } : {}),\n ...(endpoint !== undefined ? { endpoint } : {}),\n ...(config.defaultContentType !== undefined\n ? { defaultContentType: config.defaultContentType }\n : {}),\n }\n}\n\nexport function redactQingStorConfig(config: QingStorConfig): QingStorConfigRedacted {\n return redactConfigWithSchema(QingStorConfigSchema, config) as unknown as QingStorConfigRedacted\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// 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 QINGSTOR_BROWSER_PROMPT = `{prefix}\n Remote QingStor bucket (S3-compatible) accessed via presigned URLs (browser runtime).\n Supports the full filesystem command set: ls/tree/cat/grep/find/du/cp/mv/rm/etc.\n Listing operations require the presigner to sign LIST/COPY operations in\n addition to GET/PUT/HEAD/DELETE — see S3BrowserPresignedUrlProvider docs.`\n"],"mappings":";;;;;AAcA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;;;ACNP,SAAS,wBAAwB,cAAc,SAAS;AAejD,IAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,QAAQ,EAAE,OAAO;AAAA,EACjB,sBAAsB;AAAA,IACpB,EAAE,OAAsC,CAAC,UAAU,OAAO,UAAU,UAAU;AAAA,EAChF;AAAA,EACA,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,UAAU,EAAE,OAAO,EAAE,SAAS;AAAA,EAC9B,oBAAoB,EAAE,OAAO,EAAE,SAAS;AAC1C,CAAC;AAEM,SAAS,yBAAyB,QAA4C;AACnF,MAAI,OAAO,aAAa,UAAa,OAAO,aAAa,GAAI,QAAO,OAAO;AAC3E,MAAI,OAAO,WAAW,UAAa,OAAO,WAAW,IAAI;AACvD,UAAM,SAAS,OAAO;AACtB,WAAO,cAAc,MAAM;AAAA,EAC7B;AACA,SAAO;AACT;AAEO,SAAS,mBAAmB,QAAkC;AACnE,QAAM,WAAW,yBAAyB,MAAM;AAChD,SAAO;AAAA,IACL,QAAQ,OAAO;AAAA,IACf,sBAAsB,OAAO;AAAA,IAC7B,GAAI,OAAO,WAAW,SAAY,EAAE,QAAQ,OAAO,OAAO,IAAI,CAAC;AAAA,IAC/D,GAAI,aAAa,SAAY,EAAE,SAAS,IAAI,CAAC;AAAA,IAC7C,GAAI,OAAO,uBAAuB,SAC9B,EAAE,oBAAoB,OAAO,mBAAmB,IAChD,CAAC;AAAA,EACP;AACF;AAEO,SAAS,qBAAqB,QAAgD;AACnF,SAAO,uBAAuB,sBAAsB,MAAM;AAC5D;;;ACjDO,IAAM,0BAA0B;AAAA;AAAA;AAAA;AAAA;;;AFqBhC,IAAM,mBAAN,cAA+B,WAAW;AAAA,EAC7B,OAAe,aAAa;AAAA,EAC5B,SAAiB;AAAA,EAC1B;AAAA,EACQ;AAAA,EACA;AAAA,EAEjB,YAAY,QAAwB;AAClC,UAAM,mBAAmB,MAAM,CAAC;AAChC,SAAK,iBAAiB;AACtB,SAAK,cAAc,iBAAiB,MAAM,IAAI,GAAG,aAAa,QAAQ;AACtE,SAAK,mBAAmB,sBAAsB,MAAM,SAAS,GAAG,aAAa,QAAQ;AAAA,EACvF;AAAA,EAES,MAA+B;AACtC,WAAO,KAAK;AAAA,EACd;AAAA,EAES,WAAyC;AAChD,WAAO,KAAK;AAAA,EACd;AAAA,EAES,WAA2C;AAClD,WAAO,QAAQ,QAAQ;AAAA,MACrB,MAAM,KAAK;AAAA,MACX,QAAQ,qBAAqB,KAAK,cAAc;AAAA,IAClD,CAAC;AAAA,EACH;AAAA,EAES,UAAU,QAA8C;AAC/D,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
redactGDriveConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NMZBJOFW.js";
|
|
4
4
|
|
|
5
5
|
// src/resource/gdrive/gdrive.ts
|
|
6
6
|
import {
|
|
@@ -76,8 +76,6 @@ var GDriveResource = class {
|
|
|
76
76
|
getState() {
|
|
77
77
|
return Promise.resolve({
|
|
78
78
|
type: this.kind,
|
|
79
|
-
needsOverride: true,
|
|
80
|
-
redactedFields: ["clientSecret", "refreshToken"],
|
|
81
79
|
config: redactGDriveConfig(this.config)
|
|
82
80
|
});
|
|
83
81
|
}
|
|
@@ -89,4 +87,4 @@ var GDriveResource = class {
|
|
|
89
87
|
export {
|
|
90
88
|
GDriveResource
|
|
91
89
|
};
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-4YJMDF2S.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/gdrive/gdrive.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type FileStat,\n GDRIVE_COMMANDS,\n GDRIVE_PROMPT,\n GDRIVE_VFS_OPS,\n GDriveAccessor,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n TokenManager,\n gdriveRead,\n gdriveReaddir,\n gdriveResolveGlob,\n gdriveStat,\n} from '@struktoai/mirage-core'\nimport { redactGDriveConfig, type GDriveConfig, type GDriveConfigRedacted } from './config.ts'\n\nexport interface GDriveResourceState {\n type: string\n config: GDriveConfigRedacted\n}\n\nexport class GDriveResource implements Resource {\n readonly kind: string = ResourceName.GDRIVE\n readonly isRemote: boolean = true\n readonly indexTtl: number = 86_400\n readonly prompt: string = GDRIVE_PROMPT\n readonly config: GDriveConfig\n readonly accessor: GDriveAccessor\n readonly index: IndexCacheStore\n\n constructor(config: GDriveConfig) {\n this.config = config\n const tm = new TokenManager({\n clientId: config.clientId,\n ...(config.clientSecret !== undefined ? { clientSecret: config.clientSecret } : {}),\n refreshToken: config.refreshToken,\n ...(config.refreshFn !== undefined ? { refreshFn: config.refreshFn } : {}),\n })\n this.accessor = new GDriveAccessor({ tokenManager: tm })\n this.index = new RAMIndexCacheStore({ ttl: 86_400 })\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n close(): Promise<void> {\n return Promise.resolve()\n }\n\n commands(): readonly RegisteredCommand[] {\n return GDRIVE_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return GDRIVE_VFS_OPS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return gdriveRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return gdriveReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return gdriveStat(this.accessor, p, this.index)\n }\n\n async fingerprint(p: PathSpec): Promise<string | null> {\n const lookup = await this.index.get(p.original)\n return lookup.entry?.remoteTime ?? null\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n prefix !== ''\n ? paths.map((p) =>\n p.prefix !== ''\n ? p\n : new PathSpec({\n original: p.original,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n prefix,\n }),\n )\n : paths\n return gdriveResolveGlob(this.accessor, effective, this.index)\n }\n\n getState(): Promise<GDriveResourceState> {\n return Promise.resolve({\n type: this.kind,\n config: redactGDriveConfig(this.config),\n })\n }\n\n loadState(_state: GDriveResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n"],"mappings":";;;;;AAcA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQA,IAAM,iBAAN,MAAyC;AAAA,EACrC,OAAe,aAAa;AAAA,EAC5B,WAAoB;AAAA,EACpB,WAAmB;AAAA,EACnB,SAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAsB;AAChC,SAAK,SAAS;AACd,UAAM,KAAK,IAAI,aAAa;AAAA,MAC1B,UAAU,OAAO;AAAA,MACjB,GAAI,OAAO,iBAAiB,SAAY,EAAE,cAAc,OAAO,aAAa,IAAI,CAAC;AAAA,MACjF,cAAc,OAAO;AAAA,MACrB,GAAI,OAAO,cAAc,SAAY,EAAE,WAAW,OAAO,UAAU,IAAI,CAAC;AAAA,IAC1E,CAAC;AACD,SAAK,WAAW,IAAI,eAAe,EAAE,cAAc,GAAG,CAAC;AACvD,SAAK,QAAQ,IAAI,mBAAmB,EAAE,KAAK,MAAO,CAAC;AAAA,EACrD;AAAA,EAEA,OAAsB;AACpB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEA,QAAuB;AACrB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEA,WAAyC;AACvC,WAAO;AAAA,EACT;AAAA,EAEA,MAA+B;AAC7B,WAAO;AAAA,EACT;AAAA,EAEA,SAAS,GAAkC;AACzC,WAAO,WAAW,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EAChD;AAAA,EAEA,QAAQ,GAAgC;AACtC,WAAO,cAAc,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EACnD;AAAA,EAEA,KAAK,GAAgC;AACnC,WAAO,WAAW,KAAK,UAAU,GAAG,KAAK,KAAK;AAAA,EAChD;AAAA,EAEA,MAAM,YAAY,GAAqC;AACrD,UAAM,SAAS,MAAM,KAAK,MAAM,IAAI,EAAE,QAAQ;AAC9C,WAAO,OAAO,OAAO,cAAc;AAAA,EACrC;AAAA,EAEA,KAAK,OAA4B,SAAS,IAAyB;AACjE,UAAM,YACJ,WAAW,KACP,MAAM;AAAA,MAAI,CAAC,MACT,EAAE,WAAW,KACT,IACA,IAAI,SAAS;AAAA,QACX,UAAU,EAAE;AAAA,QACZ,WAAW,EAAE;AAAA,QACb,GAAI,EAAE,YAAY,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,CAAC;AAAA,QACnD,UAAU,EAAE;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACP,IACA;AACN,WAAO,kBAAkB,KAAK,UAAU,WAAW,KAAK,KAAK;AAAA,EAC/D;AAAA,EAEA,WAAyC;AACvC,WAAO,QAAQ,QAAQ;AAAA,MACrB,MAAM,KAAK;AAAA,MACX,QAAQ,mBAAmB,KAAK,MAAM;AAAA,IACxC,CAAC;AAAA,EACH;AAAA,EAEA,UAAU,QAA4C;AACpD,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/resource/gmail/config.ts
|
|
2
|
+
import {
|
|
3
|
+
GoogleConfigSchema,
|
|
4
|
+
normalizeGoogleConfig,
|
|
5
|
+
redactGoogleConfig
|
|
6
|
+
} from "@struktoai/mirage-core";
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
GoogleConfigSchema,
|
|
10
|
+
normalizeGoogleConfig,
|
|
11
|
+
redactGoogleConfig
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=chunk-54NTYJEO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/gmail/config.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport {\n GoogleConfigSchema as GmailConfigSchema,\n normalizeGoogleConfig as normalizeGmailConfig,\n redactGoogleConfig as redactGmailConfig,\n type GoogleConfig as GmailConfig,\n type GoogleConfigRedacted as GmailConfigRedacted,\n} from '@struktoai/mirage-core'\n"],"mappings":";AAcA;AAAA,EACwB;AAAA,EACG;AAAA,EACH;AAAA,OAGjB;","names":[]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
S3Resource
|
|
3
|
+
} from "./chunk-XFREXNA2.js";
|
|
4
|
+
|
|
5
|
+
// src/resource/seaweedfs/seaweedfs.ts
|
|
6
|
+
import {
|
|
7
|
+
remapCommandsResource,
|
|
8
|
+
remapOpsResource,
|
|
9
|
+
ResourceName
|
|
10
|
+
} from "@struktoai/mirage-core";
|
|
11
|
+
|
|
12
|
+
// src/resource/seaweedfs/config.ts
|
|
13
|
+
import { redactConfigWithSchema, secretSchema, z } from "@struktoai/mirage-core";
|
|
14
|
+
var SeaweedFSConfigSchema = z.object({
|
|
15
|
+
bucket: z.string(),
|
|
16
|
+
presignedUrlProvider: secretSchema(
|
|
17
|
+
z.custom((value) => typeof value === "function")
|
|
18
|
+
),
|
|
19
|
+
endpoint: z.string().optional(),
|
|
20
|
+
region: z.string().optional(),
|
|
21
|
+
defaultContentType: z.string().optional()
|
|
22
|
+
});
|
|
23
|
+
function seaweedfsToS3Config(config) {
|
|
24
|
+
return {
|
|
25
|
+
bucket: config.bucket,
|
|
26
|
+
presignedUrlProvider: config.presignedUrlProvider,
|
|
27
|
+
...config.region !== void 0 ? { region: config.region } : {},
|
|
28
|
+
...config.endpoint !== void 0 ? { endpoint: config.endpoint } : {},
|
|
29
|
+
...config.defaultContentType !== void 0 ? { defaultContentType: config.defaultContentType } : {}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function redactSeaweedFSConfig(config) {
|
|
33
|
+
return redactConfigWithSchema(SeaweedFSConfigSchema, config);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/resource/seaweedfs/prompt.ts
|
|
37
|
+
var SEAWEEDFS_BROWSER_PROMPT = `{prefix}
|
|
38
|
+
Remote SeaweedFS bucket (S3-compatible gateway) accessed via presigned URLs (browser runtime).
|
|
39
|
+
Supports the full filesystem command set: ls/tree/cat/grep/find/du/cp/mv/rm/etc.
|
|
40
|
+
Listing operations require the presigner to sign LIST/COPY operations in
|
|
41
|
+
addition to GET/PUT/HEAD/DELETE \u2014 see S3BrowserPresignedUrlProvider docs.`;
|
|
42
|
+
|
|
43
|
+
// src/resource/seaweedfs/seaweedfs.ts
|
|
44
|
+
var SeaweedFSResource = class extends S3Resource {
|
|
45
|
+
kind = ResourceName.SEAWEEDFS;
|
|
46
|
+
prompt = SEAWEEDFS_BROWSER_PROMPT;
|
|
47
|
+
seaweedfsConfig;
|
|
48
|
+
seaweedfsOps;
|
|
49
|
+
seaweedfsCommands;
|
|
50
|
+
constructor(config) {
|
|
51
|
+
super(seaweedfsToS3Config(config));
|
|
52
|
+
this.seaweedfsConfig = config;
|
|
53
|
+
this.seaweedfsOps = remapOpsResource(super.ops(), ResourceName.SEAWEEDFS);
|
|
54
|
+
this.seaweedfsCommands = remapCommandsResource(super.commands(), ResourceName.SEAWEEDFS);
|
|
55
|
+
}
|
|
56
|
+
ops() {
|
|
57
|
+
return this.seaweedfsOps;
|
|
58
|
+
}
|
|
59
|
+
commands() {
|
|
60
|
+
return this.seaweedfsCommands;
|
|
61
|
+
}
|
|
62
|
+
getState() {
|
|
63
|
+
return Promise.resolve({
|
|
64
|
+
type: this.kind,
|
|
65
|
+
config: redactSeaweedFSConfig(this.seaweedfsConfig)
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
loadState(_state) {
|
|
69
|
+
return Promise.resolve();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
seaweedfsToS3Config,
|
|
75
|
+
redactSeaweedFSConfig,
|
|
76
|
+
SEAWEEDFS_BROWSER_PROMPT,
|
|
77
|
+
SeaweedFSResource
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=chunk-63GZEZW4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/seaweedfs/seaweedfs.ts","../src/resource/seaweedfs/config.ts","../src/resource/seaweedfs/prompt.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n remapCommandsResource,\n remapOpsResource,\n ResourceName,\n type RegisteredCommand,\n type RegisteredOp,\n} from '@struktoai/mirage-core'\nimport { S3Resource } from '../s3/s3.ts'\nimport {\n redactSeaweedFSConfig,\n seaweedfsToS3Config,\n type SeaweedFSConfig,\n type SeaweedFSConfigRedacted,\n} from './config.ts'\nimport { SEAWEEDFS_BROWSER_PROMPT } from './prompt.ts'\n\nexport interface SeaweedFSResourceState {\n type: string\n config: SeaweedFSConfigRedacted\n}\n\nexport class SeaweedFSResource extends S3Resource {\n override readonly kind: string = ResourceName.SEAWEEDFS\n override readonly prompt: string = SEAWEEDFS_BROWSER_PROMPT\n readonly seaweedfsConfig: SeaweedFSConfig\n private readonly seaweedfsOps: readonly RegisteredOp[]\n private readonly seaweedfsCommands: readonly RegisteredCommand[]\n\n constructor(config: SeaweedFSConfig) {\n super(seaweedfsToS3Config(config))\n this.seaweedfsConfig = config\n this.seaweedfsOps = remapOpsResource(super.ops(), ResourceName.SEAWEEDFS)\n this.seaweedfsCommands = remapCommandsResource(super.commands(), ResourceName.SEAWEEDFS)\n }\n\n override ops(): readonly RegisteredOp[] {\n return this.seaweedfsOps\n }\n\n override commands(): readonly RegisteredCommand[] {\n return this.seaweedfsCommands\n }\n\n override getState(): Promise<SeaweedFSResourceState> {\n return Promise.resolve({\n type: this.kind,\n config: redactSeaweedFSConfig(this.seaweedfsConfig),\n })\n }\n\n override loadState(_state: SeaweedFSResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { redactConfigWithSchema, secretSchema, z } from '@struktoai/mirage-core'\nimport type { S3BrowserPresignedUrlProvider, S3Config } from '../s3/config.ts'\n\nexport interface SeaweedFSConfig {\n bucket: string\n presignedUrlProvider: S3BrowserPresignedUrlProvider\n endpoint?: string\n region?: string\n defaultContentType?: string\n}\n\nexport interface SeaweedFSConfigRedacted extends Omit<SeaweedFSConfig, 'presignedUrlProvider'> {\n presignedUrlProvider: '<REDACTED>'\n}\n\nexport const SeaweedFSConfigSchema = z.object({\n bucket: z.string(),\n presignedUrlProvider: secretSchema(\n z.custom<S3BrowserPresignedUrlProvider>((value) => typeof value === 'function'),\n ),\n endpoint: z.string().optional(),\n region: z.string().optional(),\n defaultContentType: z.string().optional(),\n})\n\nexport function seaweedfsToS3Config(config: SeaweedFSConfig): S3Config {\n return {\n bucket: config.bucket,\n presignedUrlProvider: config.presignedUrlProvider,\n ...(config.region !== undefined ? { region: config.region } : {}),\n ...(config.endpoint !== undefined ? { endpoint: config.endpoint } : {}),\n ...(config.defaultContentType !== undefined\n ? { defaultContentType: config.defaultContentType }\n : {}),\n }\n}\n\nexport function redactSeaweedFSConfig(config: SeaweedFSConfig): SeaweedFSConfigRedacted {\n return redactConfigWithSchema(SeaweedFSConfigSchema, config) as unknown as SeaweedFSConfigRedacted\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// 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 SEAWEEDFS_BROWSER_PROMPT = `{prefix}\n Remote SeaweedFS bucket (S3-compatible gateway) accessed via presigned URLs (browser runtime).\n Supports the full filesystem command set: ls/tree/cat/grep/find/du/cp/mv/rm/etc.\n Listing operations require the presigner to sign LIST/COPY operations in\n addition to GET/PUT/HEAD/DELETE — see S3BrowserPresignedUrlProvider docs.`\n"],"mappings":";;;;;AAcA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;;;ACNP,SAAS,wBAAwB,cAAc,SAAS;AAejD,IAAM,wBAAwB,EAAE,OAAO;AAAA,EAC5C,QAAQ,EAAE,OAAO;AAAA,EACjB,sBAAsB;AAAA,IACpB,EAAE,OAAsC,CAAC,UAAU,OAAO,UAAU,UAAU;AAAA,EAChF;AAAA,EACA,UAAU,EAAE,OAAO,EAAE,SAAS;AAAA,EAC9B,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,oBAAoB,EAAE,OAAO,EAAE,SAAS;AAC1C,CAAC;AAEM,SAAS,oBAAoB,QAAmC;AACrE,SAAO;AAAA,IACL,QAAQ,OAAO;AAAA,IACf,sBAAsB,OAAO;AAAA,IAC7B,GAAI,OAAO,WAAW,SAAY,EAAE,QAAQ,OAAO,OAAO,IAAI,CAAC;AAAA,IAC/D,GAAI,OAAO,aAAa,SAAY,EAAE,UAAU,OAAO,SAAS,IAAI,CAAC;AAAA,IACrE,GAAI,OAAO,uBAAuB,SAC9B,EAAE,oBAAoB,OAAO,mBAAmB,IAChD,CAAC;AAAA,EACP;AACF;AAEO,SAAS,sBAAsB,QAAkD;AACtF,SAAO,uBAAuB,uBAAuB,MAAM;AAC7D;;;ACvCO,IAAM,2BAA2B;AAAA;AAAA;AAAA;AAAA;;;AFqBjC,IAAM,oBAAN,cAAgC,WAAW;AAAA,EAC9B,OAAe,aAAa;AAAA,EAC5B,SAAiB;AAAA,EAC1B;AAAA,EACQ;AAAA,EACA;AAAA,EAEjB,YAAY,QAAyB;AACnC,UAAM,oBAAoB,MAAM,CAAC;AACjC,SAAK,kBAAkB;AACvB,SAAK,eAAe,iBAAiB,MAAM,IAAI,GAAG,aAAa,SAAS;AACxE,SAAK,oBAAoB,sBAAsB,MAAM,SAAS,GAAG,aAAa,SAAS;AAAA,EACzF;AAAA,EAES,MAA+B;AACtC,WAAO,KAAK;AAAA,EACd;AAAA,EAES,WAAyC;AAChD,WAAO,KAAK;AAAA,EACd;AAAA,EAES,WAA4C;AACnD,WAAO,QAAQ,QAAQ;AAAA,MACrB,MAAM,KAAK;AAAA,MACX,QAAQ,sBAAsB,KAAK,eAAe;AAAA,IACpD,CAAC;AAAA,EACH;AAAA,EAES,UAAU,QAA+C;AAChE,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
|