@mastra/railway 0.8.0-alpha.0 → 0.8.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.
Files changed (2) hide show
  1. package/README.md +9 -99
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -4,25 +4,12 @@ Railway cloud sandbox provider for [Mastra](https://mastra.ai) workspaces.
4
4
 
5
5
  Implements the `WorkspaceSandbox` interface using [Railway Sandboxes](https://docs.railway.com/sandboxes) — ephemeral, isolated Linux VMs provisioned on demand through Railway's TypeScript SDK. Supports command execution with streaming output, command timeouts, configurable idle timeout, network isolation, and reattaching to an existing sandbox.
6
6
 
7
- > Railway Sandboxes are available through Priority Boarding and the SDK may change in breaking ways between releases.
8
-
9
- ## Install
7
+ ## Installation
10
8
 
11
9
  ```bash
12
- pnpm add @mastra/railway @mastra/core
10
+ npm install @mastra/railway
13
11
  ```
14
12
 
15
- ## Configuration
16
-
17
- The provider reads credentials from the environment by default:
18
-
19
- | Option | Environment variable |
20
- | --------------- | ------------------------ |
21
- | `token` | `RAILWAY_API_TOKEN` |
22
- | `environmentId` | `RAILWAY_ENVIRONMENT_ID` |
23
-
24
- Pass them explicitly to override the environment values.
25
-
26
13
  ## Usage
27
14
 
28
15
  ### Basic
@@ -45,92 +32,15 @@ console.log(result.stdout); // "Hello!"
45
32
  await workspace.destroy();
46
33
  ```
47
34
 
48
- ### Private networking
49
-
50
- Join the environment's private network to reach other services (for example
51
- `postgres.railway.internal`):
52
-
53
- ```typescript
54
- const sandbox = new RailwaySandbox({
55
- networkIsolation: 'PRIVATE',
56
- env: { NODE_ENV: 'production' },
57
- });
58
- ```
59
-
60
- ### Reattach to an existing sandbox
61
-
62
- A Railway sandbox outlives the process that created it. Reconnect by its
63
- Railway ID instead of provisioning a new one:
64
-
65
- ```typescript
66
- const sandbox = new RailwaySandbox({ sandboxId: 'existing-railway-sandbox-id' });
67
- ```
68
-
69
- ### Custom base image (templates)
70
-
71
- Pre-install packages and run setup steps so every sandbox starts ready. Pass a
72
- builder callback over the Railway template builder — Railway builds the image
73
- when the sandbox is created during `start()`:
74
-
75
- ```typescript
76
- const sandbox = new RailwaySandbox({
77
- template: t => t.withPackages('git', 'curl').run('npm i -g pnpm').workdir('/app'),
78
- });
79
- ```
80
-
81
- You can also pass a `SandboxTemplate` to reuse it across sandboxes. Railway
82
- builds the image during sandbox creation. Templates are ignored when
83
- `sandboxId` is set (reattach).
35
+ ## Documentation
84
36
 
85
- ### Fork a running sandbox
37
+ - [Railway integration guide](https://mastra.ai/integrations/sandboxes/railway)
38
+ - [Workspace documentation](https://mastra.ai/docs/mastra-platform/workspaces)
86
39
 
87
- Clone a running sandbox's filesystem into a new, independent sandbox (a fresh
88
- boot, not live processes). The returned `RailwaySandbox` is already started:
89
-
90
- ```typescript
91
- const child = await sandbox.fork({ idleTimeoutMinutes: 15 });
92
- const result = await child.executeCommand('cat', ['/app/state.json']);
93
- ```
94
-
95
- ### Long-running processes
96
-
97
- Use the process manager to spawn background commands and stream their output:
98
-
99
- ```typescript
100
- const handle = await sandbox.processes.spawn('npm run dev', {
101
- onStdout: chunk => process.stdout.write(chunk),
102
- });
40
+ ## Changelog
103
41
 
104
- // Later
105
- await handle.kill();
106
- ```
107
-
108
- ## Options
109
-
110
- | Option | Type | Description |
111
- | -------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------ |
112
- | `token` | `string` | Railway API token. Falls back to `RAILWAY_API_TOKEN`. |
113
- | `environmentId` | `string` | Railway environment ID. Falls back to `RAILWAY_ENVIRONMENT_ID`. |
114
- | `sandboxId` | `string` | Reattach to an existing Railway sandbox by ID instead of creating one. |
115
- | `idleTimeoutMinutes` | `number` | Minutes a sandbox can sit idle before Railway destroys it. Range/default depend on the plan. |
116
- | `networkIsolation` | `'ISOLATED' \| 'PRIVATE'` | Network mode. `ISOLATED` (default) is outbound-only; `PRIVATE` joins the private network. |
117
- | `env` | `Record<string, string>` | Environment variables baked into the sandbox. |
118
- | `template` | `SandboxTemplate \| (base) => SandboxTemplate` | Provision from a custom base image built with the Railway template builder. Ignored on reattach. |
119
- | `timeout` | `number` | Default command timeout in milliseconds. Commands run until they exit when omitted. |
120
- | `instructions` | `string \| (opts) => string` | Override the default agent instructions. |
121
-
122
- ## Editor provider
123
-
124
- Register the provider with `MastraEditor` to hydrate stored sandbox configs:
125
-
126
- ```typescript
127
- import { railwaySandboxProvider } from '@mastra/railway';
128
-
129
- const editor = new MastraEditor({
130
- sandboxes: { [railwaySandboxProvider.id]: railwaySandboxProvider },
131
- });
132
- ```
42
+ See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/workspaces/railway/CHANGELOG.md) for version history and release notes.
133
43
 
134
- ## License
44
+ ## Support
135
45
 
136
- Apache-2.0
46
+ We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/railway",
3
- "version": "0.8.0-alpha.0",
3
+ "version": "0.8.0",
4
4
  "description": "Railway cloud sandbox provider for Mastra workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,10 +31,10 @@
31
31
  "tsdown": "0.22.9",
32
32
  "typescript": "^7.0.2",
33
33
  "vitest": "4.1.10",
34
- "@internal/types-builder": "0.0.104",
35
- "@mastra/core": "1.64.0-alpha.2",
36
- "@internal/workspace-test-utils": "0.0.73",
37
- "@internal/lint": "0.0.129"
34
+ "@internal/lint": "0.0.130",
35
+ "@internal/types-builder": "0.0.105",
36
+ "@internal/workspace-test-utils": "0.0.74",
37
+ "@mastra/core": "1.64.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@mastra/core": ">=1.12.0-0 <2.0.0-0"