bcbd1bdb22
Integ / changes (push) Has been skipped
Pre-commit / pre-commit (push) Failing after 1s
CLI exit codes / changes (push) Has been skipped
Test (Install) / changes (push) Has been skipped
Test (Python) / changes (push) Has been skipped
Test (TypeScript) / changes (push) Has been skipped
CLI exit codes / cli-gate (push) Has been cancelled
Test (Install) / test-install-gate (push) Has been cancelled
Integ / integ-gate (push) Has been cancelled
Test (Python) / test-python-gate (push) Has been cancelled
Test (TypeScript) / test-typescript-gate (push) Has been cancelled
Test (Install) / python-minimal (3.12) (push) Has been cancelled
Test (Install) / python-minimal (3.11) (push) Has been cancelled
Test (Install) / python-extra (agno, mirage.agents.agno) (push) Has been cancelled
Test (Install) / python-extra (chroma, mirage.resource.chroma) (push) Has been cancelled
Test (Install) / python-extra (pdf, mirage.core.filetype.pdf) (push) Has been cancelled
Integ / integ (push) Has been cancelled
Integ / integ-database (push) Has been cancelled
Integ / integ-database-ts (push) Has been cancelled
Integ / integ-data (push) Has been cancelled
Integ / integ-ssh (push) Has been cancelled
Integ / integ-ssh-ts (push) Has been cancelled
Test (Python) / audit (push) Has been cancelled
Test (TypeScript) / test (push) Has been cancelled
Test (TypeScript) / python-fs-shim (push) Has been cancelled
CLI exit codes / Python CLI (push) Has been cancelled
CLI exit codes / TypeScript CLI (push) Has been cancelled
CLI exit codes / Cross-language snapshot interop (push) Has been cancelled
Test (Python) / test (push) Has been cancelled
Test (Python) / import-isolation (deepagents, openai, mirage.agents.openai_agents) (push) Has been cancelled
Test (Python) / import-isolation (deepagents, pydantic-ai, mirage.agents.pydantic_ai) (push) Has been cancelled
Integ / integ-ts (push) Has been cancelled
Integ / integ-fuse (push) Has been cancelled
Test (Install) / python-extra (databricks, mirage.resource.databricks_volume) (push) Has been cancelled
Test (Install) / python-extra (deepagents, mirage.agents.langchain) (push) Has been cancelled
Test (Install) / python-extra (email, mirage.resource.email) (push) Has been cancelled
Test (Install) / python-extra (fuse, mirage.fuse.mount) (push) Has been cancelled
Test (Install) / python-extra (hdf5, mirage.core.filetype.hdf5) (push) Has been cancelled
Test (Install) / python-extra (hf, mirage.resource.hf_buckets) (push) Has been cancelled
Test (Install) / python-extra (lancedb, mirage.resource.lancedb) (push) Has been cancelled
Test (Install) / python-extra (langfuse, mirage.resource.langfuse) (push) Has been cancelled
Test (Install) / python-extra (mongodb, mirage.resource.mongodb) (push) Has been cancelled
Test (Install) / python-extra (nextcloud, mirage.resource.nextcloud) (push) Has been cancelled
Test (Install) / python-extra (openai, mirage.agents.openai_agents) (push) Has been cancelled
Test (Install) / python-extra (openhands, mirage.agents.openhands, 3.12) (push) Has been cancelled
Test (Install) / python-extra (parquet, mirage.core.filetype.parquet) (push) Has been cancelled
Test (Install) / python-extra (postgres, mirage.resource.postgres) (push) Has been cancelled
Test (Install) / python-extra (pydantic-ai, mirage.agents.pydantic_ai) (push) Has been cancelled
Test (Install) / python-extra (qdrant, mirage.resource.qdrant) (push) Has been cancelled
Test (Install) / python-extra (redis, mirage.resource.redis) (push) Has been cancelled
Test (Install) / python-extra (s3, mirage.resource.s3) (push) Has been cancelled
Test (Install) / python-extra (ssh, mirage.resource.ssh) (push) Has been cancelled
Test (Install) / ts-minimal (push) Has been cancelled
114 lines
2.8 KiB
Plaintext
114 lines
2.8 KiB
Plaintext
---
|
|
title: Installation
|
|
description: Install the Mirage TypeScript SDK and add the optional native peers only if you need them.
|
|
icon: download
|
|
---
|
|
|
|
## Quick Install
|
|
|
|
Install the Node package:
|
|
|
|
```bash
|
|
pnpm add @struktoai/mirage-node
|
|
```
|
|
|
|
This ships the base runtime (Workspace, RAM resource, Disk resource, the shell executor) and is enough to follow the [TypeScript Quickstart](/typescript/quickstart).
|
|
|
|
`npm install` and `yarn add` work identically; examples below use pnpm because the FUSE binding's install script needs pnpm's `onlyBuiltDependencies` allow-list.
|
|
|
|
## Optional Peer Dependencies
|
|
|
|
Mirage keeps native and network-heavy dependencies as **optional peers** so consumers who don't use those features don't pay the download or build cost. Mirage imports each library lazily, so unused peers cost nothing at runtime either.
|
|
|
|
<Tabs>
|
|
<Tab title="FUSE">
|
|
Expose a workspace as a real OS filesystem.
|
|
|
|
```bash
|
|
pnpm add @zkochan/fuse-native
|
|
```
|
|
|
|
Then follow the [TypeScript FUSE setup](/typescript/setup/fuse) for the pnpm `onlyBuiltDependencies` allow-list and the macOS 4+ symlink workaround.
|
|
</Tab>
|
|
<Tab title="Redis">
|
|
Required for `RedisResource`, `RedisFileCacheStore`, and `RedisIndexCacheStore`.
|
|
|
|
```bash
|
|
pnpm add redis
|
|
```
|
|
|
|
Any `redis@^5` client works.
|
|
</Tab>
|
|
<Tab title="Postgres">
|
|
Required for `PostgresResource`.
|
|
|
|
```bash
|
|
pnpm add pg
|
|
```
|
|
</Tab>
|
|
<Tab title="MongoDB">
|
|
Required for `MongoDBResource`.
|
|
|
|
```bash
|
|
pnpm add mongodb
|
|
```
|
|
</Tab>
|
|
<Tab title="LanceDB">
|
|
Required for `LanceDBResource`.
|
|
|
|
```bash
|
|
pnpm add @lancedb/lancedb
|
|
```
|
|
</Tab>
|
|
<Tab title="Qdrant">
|
|
Required for `QdrantResource`.
|
|
|
|
```bash
|
|
pnpm add @qdrant/js-client-rest
|
|
```
|
|
</Tab>
|
|
<Tab title="SSH">
|
|
Required for `SSHResource`.
|
|
|
|
```bash
|
|
pnpm add ssh2
|
|
```
|
|
</Tab>
|
|
<Tab title="Email">
|
|
Required for `EmailResource` (IMAP read, SMTP send, MIME parsing).
|
|
|
|
```bash
|
|
pnpm add imapflow mailparser nodemailer
|
|
```
|
|
</Tab>
|
|
</Tabs>
|
|
|
|
## Verify
|
|
|
|
```ts
|
|
import { MountMode, RAMResource, Workspace } from '@struktoai/mirage-node'
|
|
|
|
const ws = new Workspace(
|
|
{ '/data': new RAMResource() },
|
|
{ mode: MountMode.WRITE },
|
|
)
|
|
const res = await ws.execute('echo "hello" | tee /data/x.txt')
|
|
console.log(res.stdoutText) // hello
|
|
await ws.close()
|
|
```
|
|
|
|
If this prints `hello`, the base install is wired up correctly.
|
|
|
|
## Install From Source
|
|
|
|
Contributing to Mirage or exploring the examples directly:
|
|
|
|
```bash
|
|
git clone https://github.com/strukto-ai/mirage.git
|
|
cd mirage/typescript
|
|
pnpm install
|
|
pnpm -r build
|
|
```
|
|
|
|
The examples in `examples/typescript/` link to the workspace packages via pnpm's workspace protocol, so changes in `packages/core` or `packages/node` are picked up on the next `pnpm build`.
|