Documentation Index
Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Two companion packages to the core SDK:@struktoai/mirage-server, a Fastify daemon that owns workspaces in-process and exposes them over HTTP (/v1/workspaces,/v1/jobs, …).@struktoai/mirage-cli, acommanderCLI that speaks to the daemon. Mirrors Python’smirageCLI 1:1.
mirage workspace create if none is running.
Install
@struktoai/mirage-server transitively (the CLI spawns the daemon from the server package’s installed bin/daemon.js).
Create a workspace
Write a YAML config:- Validates the YAML + interpolates
${VAR}env references (fails fast if any are missing). - Auto-spawns a daemon on
127.0.0.1:8765if none is reachable. - Sends
POST /v1/workspacesand prints the returned detail as JSON.
Run commands in a workspace
Workspace lifecycle
| Command | Purpose |
|---|---|
mirage workspace create <config.yaml> | Create; auto-spawns daemon if needed. |
mirage workspace list | List active workspaces. |
mirage workspace get <id> [--verbose] | Show one workspace’s detail. |
mirage workspace delete <id> | Stop and remove. |
mirage workspace clone <id> [--id NEW] [--override over.json] | Clone; fresh local resources, reused remote ones. |
mirage workspace snapshot <id> <out.tar> | Snapshot to tar. |
Sessions
Daemon lifecycle
Configuration
Precedence (highest first):MIRAGE_DAEMON_URLenv var, e.g.http://127.0.0.1:9000.MIRAGE_TOKENenv var, bearer token passed asAuthorization: Bearer <token>.~/.mirage/config.toml[daemon]table:
Python parity
The daemon speaks the same/v1/... protocol as Python’s mirage CLI. A Python CLI client can talk to a Node daemon and vice versa. The CLI subcommand tree matches Python’s mirage/cli/*.py file-for-file.
Where things live
| File | Purpose |
|---|---|
packages/server/src/app.ts | Fastify app factory. |
packages/server/src/routers/ | health / workspaces / sessions / execute / jobs. |
packages/server/src/bin/daemon.ts | mirage-daemon bin. |
packages/cli/src/main.ts | CLI program wiring. |
packages/cli/src/{workspace,session,execute,provision,job,daemon}.ts | Per-subcommand modules. |
packages/cli/src/client.ts | HTTP client + auto-spawn. |