{"_id":"@cogineai/mafs-browser","name":"@cogineai/mafs-browser","dist-tags":{"alpha":"0.1.0-alpha.0","latest":"0.1.0-alpha.0"},"versions":{"0.1.0-alpha.0":{"name":"@cogineai/mafs-browser","version":"0.1.0-alpha.0","description":"A Unified Virtual Filesystem For AI Agents","keywords":["bash","fuse","typescript","vfs","ai-agents","agent-sandbox","langchain","virtual-filesystem","llm-agents","agent-tools","claude-code","openai-agents"],"homepage":"https://github.com/cogine-ai/CogineX-mono#readme","bugs":{"url":"https://github.com/cogine-ai/CogineX-mono/issues"},"repository":{"type":"git","url":"git+https://github.com/cogine-ai/CogineX-mono.git","directory":"packages/mafs/typescript/packages/browser"},"license":"Apache-2.0","author":{"name":"lc708","email":"kiedis@foxmail.com"},"publishConfig":{"access":"public"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"dependencies":{"@neondatabase/serverless":"^1.0.0","@cogineai/mafs-core":"0.1.0-alpha.0"},"devDependencies":{"@modelcontextprotocol/sdk":"^1.0.0","@neondatabase/serverless":"^1.0.0","tree-sitter-bash":"^0.25.1","tsup":"^8.5.0","typescript":"^6.0.0","vitest":"^3.0.0","web-tree-sitter":"^0.26.8"},"scripts":{"build":"node scripts/embed-wasm.mjs && tsup","test":"vitest run","typecheck":"tsc --noEmit"},"_id":"@cogineai/mafs-browser@0.1.0-alpha.0","_integrity":"sha512-FtJDXXhhN0TUhOFz/nIjQ9MF0ns0wL1qrRH8zUlQsM+akLD5n0NpiiGuKS49PzrsSfgMs/JNpCr6EnOiUjtZQw==","_resolved":"/private/var/folders/w3/1jnv2n65319gjrn7xmghv87m0000gn/T/bc2a19e72fd0dd16503e7fcd3bf7a744/cogineai-mafs-browser-0.1.0-alpha.0.tgz","_from":"file:cogineai-mafs-browser-0.1.0-alpha.0.tgz","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-FtJDXXhhN0TUhOFz/nIjQ9MF0ns0wL1qrRH8zUlQsM+akLD5n0NpiiGuKS49PzrsSfgMs/JNpCr6EnOiUjtZQw==","shasum":"bb51f88ce598a570b54fadcc55116e2bd6bf698b","tarball":"https://registry.npmjs.org/@cogineai/mafs-browser/-/mafs-browser-0.1.0-alpha.0.tgz","fileCount":129,"unpackedSize":5343975,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGDxxJlD6lqZja5VNFCHjzOvIeU9TosHcizNuaAKwN1hAiEA3oE6z0E6+rW59CFDY8j2vT2w0IhOi3q6GgaUsuXPz6o="}]},"_npmUser":{"name":"lc708","email":"kiedis@foxmail.com"},"directories":{},"maintainers":[{"name":"lc708","email":"kiedis@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mafs-browser_0.1.0-alpha.0_1779464747329_0.5592500116936907"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-22T15:45:47.197Z","0.1.0-alpha.0":"2026-05-22T15:45:47.498Z","modified":"2026-05-22T15:45:47.711Z"},"maintainers":[{"name":"lc708","email":"kiedis@foxmail.com"}],"description":"A Unified Virtual Filesystem For AI Agents","homepage":"https://github.com/cogine-ai/CogineX-mono#readme","keywords":["bash","fuse","typescript","vfs","ai-agents","agent-sandbox","langchain","virtual-filesystem","llm-agents","agent-tools","claude-code","openai-agents"],"repository":{"type":"git","url":"git+https://github.com/cogine-ai/CogineX-mono.git","directory":"packages/mafs/typescript/packages/browser"},"author":{"name":"lc708","email":"kiedis@foxmail.com"},"bugs":{"url":"https://github.com/cogine-ai/CogineX-mono/issues"},"license":"Apache-2.0","readme":"# @cogineai/mafs-browser\n\n[![npm version](https://img.shields.io/npm/v/%40cogineai%2Fmafs-browser.svg)](https://www.npmjs.com/package/@cogineai/mafs-browser)\n[![License](https://img.shields.io/npm/l/%40cogineai%2Fmafs-browser.svg)](https://github.com/cogine-ai/CogineX-mono/blob/main/packages/mafs/LICENSE)\n\nBrowser / edge-runtime bundle for **MAFS — A Unified Virtual File System for AI Agents**.\n\nThis is the package to use in browser SPAs, Cloudflare Workers, Vercel Edge Functions, Deno Deploy, and other non-Node JavaScript runtimes. It re-exports everything from [`@cogineai/mafs-core`](../core) and adds:\n\n- **OPFS-backed durable storage** (`OPFSResource`) for in-browser persistence using the Origin Private File System.\n- **Browser-friendly cloud storage** through pre-signed URLs and Workers Driver patterns: `S3Resource`, `R2Resource`, `GCSResource`, `OCIResource`, `SupabaseResource` (use `S3BrowserPresignedUrlProvider` instead of long-lived credentials).\n- **HTTP transports for SaaS APIs**: Slack, Discord, Trello, Linear, Notion, Langfuse, GitHub, GitHub CI, GDocs/GSheets/GSlides/GDrive, Dropbox, Box, Gmail.\n- **Database resources via HTTP drivers**: `PostgresResource` (Neon Pg driver), `MongoDBResource` (`HttpMongoDriver`), `VercelResource`, `PostHogResource`, `SSCholarPaperResource`, `SSCholarAuthorResource`.\n\nNo native bindings, no FUSE, no `fs` — entirely portable. ~Zero Node-specific code paths in the bundle that ships to your users.\n\n## Install\n\n```bash\nnpm install @cogineai/mafs-browser\n```\n\nBundlers (Vite, Webpack, Rollup, esbuild, …) will pick the browser ESM entry automatically.\n\n## Quick start — in-memory agent sandbox\n\n```ts\nimport { MountMode, RAMResource, Workspace } from '@cogineai/mafs-browser'\n\nconst ws = new Workspace({ '/': new RAMResource() }, { mode: MountMode.WRITE })\n\nawait ws.fs.writeFile('/notes.md', '# scratchpad\\n')\nawait ws.execute('echo \"- bullet\" >> /notes.md')\nconst notes = await ws.fs.readFileText('/notes.md')\nconsole.log(notes)\n\nawait ws.close()\n```\n\n## Quick start — durable in-browser storage with OPFS\n\n```ts\nimport { MountMode, OPFSResource, Workspace } from '@cogineai/mafs-browser'\n\nconst ws = new Workspace({ '/': await OPFSResource.create() }, { mode: MountMode.WRITE })\n\n// Files written here survive page reloads.\nawait ws.fs.writeFile('/state.json', JSON.stringify({ ok: true }))\n\nawait ws.close()\n```\n\n## Quick start — read-only S3 via presigned URLs\n\nIn a browser you should never ship long-lived AWS credentials. Use a presigned-URL provider that fetches short-lived URLs from your backend:\n\n```ts\nimport {\n  MountMode,\n  S3Resource,\n  type S3BrowserPresignedUrlProvider,\n  Workspace,\n} from '@cogineai/mafs-browser'\n\nconst presigned: S3BrowserPresignedUrlProvider = {\n  async sign({ key, operation }) {\n    const res = await fetch('/api/s3/presign', {\n      method: 'POST',\n      body: JSON.stringify({ key, operation }),\n    })\n    return (await res.json()).url\n  },\n}\n\nconst ws = new Workspace(\n  {\n    '/s3': new S3Resource({\n      bucket: 'public-reports',\n      browser: { presigned },\n    }),\n  },\n  { mode: MountMode.READ },\n)\n\nconst lines = await ws.execute('grep alert /s3/2026/05/report.csv | wc -l')\nconsole.log(lines.stdoutText)\n```\n\n## What's exported beyond `mafs-core`\n\nThe full list lives in [`packages/mafs/typescript/packages/browser/src/index.ts`](https://github.com/cogine-ai/CogineX-mono/blob/main/packages/mafs/typescript/packages/browser/src/index.ts). Notable additions:\n\n- `OPFSResource`, `OPFSAccessor`, `OPFS_OPS`, `OPFS_COMMANDS`, `OPFS_PROMPT`\n- `S3Resource` with `S3_BROWSER_PROMPT` and `S3BrowserPresignedUrlProvider`\n- `R2Resource`, `R2_BROWSER_PROMPT`, plus the `r2ToS3Config()`, `ociToS3Config()`, `gcsToS3Config()`, `supabaseToS3Config()` adapters that let you route alternate S3-compatible providers through one resource implementation\n- `PostgresResource` + `NeonPgDriver` (HTTP-only Postgres driver — works in Workers / Edge)\n- `MongoDBResource` + `HttpMongoDriver`\n- `SSCholarPaperResource` + `HttpSSCholarDriver`\n- `VercelResource` + `HttpVercelDriver`\n- `PostHogResource` + `HttpPostHogDriver`\n- `NotionResource` (browser-friendly MCP transport)\n- All HTTP-only SaaS resources (Slack, Discord, Trello, Linear, Langfuse, GitHub, …)\n\nWhat's _not_ here (and lives in [`@cogineai/mafs-node`](../node) instead):\n\n- `DiskResource`, FUSE, native shell exec, native `RedisResource`/`RedisStore`, IMAP/SMTP `EmailResource`, local audio (`sherpa-onnx-node`), `node-postgres`-backed Postgres.\n\n## Companion packages\n\n- [`@cogineai/mafs-cli`](../cli) — `coginex` + `mafs` binaries.\n- [`@cogineai/mafs-core`](../core) — runtime-agnostic primitives.\n- [`@cogineai/mafs-node`](../node) — Node-specific bundle.\n- [`@cogineai/mafs-server`](../server) — `mafs-daemon` HTTP server (you can talk to it from a browser to access Node-only resources).\n- [`@cogineai/mafs-agents`](../agents) — agent framework adapters.\n\n## License & attribution\n\nApache-2.0. MAFS is a fork of [Mirage](https://github.com/strukto-ai/mirage); see the project-level [`NOTICE`](https://github.com/cogine-ai/CogineX-mono/blob/main/packages/mafs/NOTICE) for attribution and the relationship to upstream.\n","readmeFilename":"README.md","_rev":"1-3a7fc0249e4bf47349affd89cbce7b3b"}