@mastra/apple-container 0.5.0-alpha.0 → 0.5.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 +10 -81
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -4,16 +4,10 @@ Apple container CLI sandbox provider for [Mastra](https://mastra.ai) workspaces.
|
|
|
4
4
|
|
|
5
5
|
Implements the `WorkspaceSandbox` interface with Apple's [`container`](https://github.com/apple/container) CLI. The provider starts a long-lived OCI Linux container and runs workspace commands through `container exec`.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Requires Apple silicon, macOS 26 or newer, and the Apple `container` CLI. Start Apple's container system before using the provider:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
container system start
|
|
10
|
+
npm install @mastra/apple-container
|
|
17
11
|
```
|
|
18
12
|
|
|
19
13
|
## Usage
|
|
@@ -39,80 +33,15 @@ console.log(result?.stdout);
|
|
|
39
33
|
await workspace.destroy();
|
|
40
34
|
```
|
|
41
35
|
|
|
42
|
-
##
|
|
43
|
-
|
|
44
|
-
| Option | Type | Description |
|
|
45
|
-
| ------------------ | ---------------------------- | ------------------------------------------------------------------ |
|
|
46
|
-
| `id` | `string` | Unique sandbox ID. |
|
|
47
|
-
| `name` | `string` | Apple container name. Defaults to the sandbox ID. |
|
|
48
|
-
| `image` | `string` | OCI image to run. Defaults to `node:22-slim`. |
|
|
49
|
-
| `command` | `string[]` | Container init command. Defaults to `['sleep', 'infinity']`. |
|
|
50
|
-
| `env` | `Record<string, string>` | Environment variables applied to the container and command execs. |
|
|
51
|
-
| `volumes` | `Record<string, string>` | Host-to-container bind mounts. |
|
|
52
|
-
| `mounts` | `string[]` | Raw `--mount` specs passed to `container run`. |
|
|
53
|
-
| `network` | `string` | Apple container network attachment spec. |
|
|
54
|
-
| `publishedPorts` | `string[]` | Port publish specs passed as `--publish`. |
|
|
55
|
-
| `publishedSockets` | `string[]` | Socket publish specs passed as `--publish-socket`. |
|
|
56
|
-
| `cpus` | `number \| string` | Number of CPUs allocated to the container. |
|
|
57
|
-
| `memory` | `string` | Memory allocation, for example `1G`. |
|
|
58
|
-
| `platform` | `string` | OCI platform, for example `linux/arm64`. |
|
|
59
|
-
| `arch` | `string` | Image architecture when selecting multi-arch images. |
|
|
60
|
-
| `os` | `string` | Operating system when selecting multi-platform images. |
|
|
61
|
-
| `rosetta` | `boolean` | Enable Rosetta in the container. |
|
|
62
|
-
| `readonlyRootfs` | `boolean` | Start the container with a read-only root filesystem. |
|
|
63
|
-
| `ssh` | `boolean` | Forward the host SSH agent socket. |
|
|
64
|
-
| `init` | `boolean` | Enable Apple's init process in the container. |
|
|
65
|
-
| `virtualization` | `boolean` | Expose virtualization capabilities to the container. |
|
|
66
|
-
| `capAdd` | `string[]` | Linux capabilities to add. |
|
|
67
|
-
| `capDrop` | `string[]` | Linux capabilities to drop. |
|
|
68
|
-
| `tmpfs` | `string[]` | tmpfs destination paths, for example `/tmp`. |
|
|
69
|
-
| `dns` | `string[]` | DNS nameserver IPs. |
|
|
70
|
-
| `dnsSearch` | `string[]` | DNS search domains. |
|
|
71
|
-
| `noDns` | `boolean` | Do not configure DNS in the container. |
|
|
72
|
-
| `labels` | `Record<string, string>` | Container labels. Mastra labels are always added. |
|
|
73
|
-
| `workingDir` | `string` | Working directory inside the container. Defaults to `/workspace`. |
|
|
74
|
-
| `timeout` | `number` | Default command timeout in milliseconds. |
|
|
75
|
-
| `deleteOnDestroy` | `boolean` | Delete the Apple container on destroy. Defaults to `true`. |
|
|
76
|
-
| `containerBinary` | `string` | Path or name for the Apple container CLI. Defaults to `container`. |
|
|
77
|
-
| `onStart` | `({ sandbox }) => unknown` | Lifecycle hook called after the sandbox reaches `running`. |
|
|
78
|
-
| `onStop` | `({ sandbox }) => unknown` | Lifecycle hook called before the sandbox stops. |
|
|
79
|
-
| `onDestroy` | `({ sandbox }) => unknown` | Lifecycle hook called before the sandbox is destroyed. |
|
|
80
|
-
| `instructions` | `string \| (opts) => string` | Override or extend the default workspace sandbox instructions. |
|
|
81
|
-
|
|
82
|
-
Apple `--tmpfs` accepts container paths only, such as `/tmp`; it does not accept Docker-style option specs like `/tmp:rw,size=256m`.
|
|
83
|
-
When `readonlyRootfs` is enabled, make sure `workingDir` points to a path supplied by the image, a bind mount, or a writable tmpfs.
|
|
84
|
-
|
|
85
|
-
## Security model
|
|
86
|
-
|
|
87
|
-
This provider runs local containers through the host Apple `container` service. Treat constructor options as trusted server-side configuration:
|
|
88
|
-
|
|
89
|
-
- `volumes`, `mounts`, and `publishedSockets` can expose host paths to containerized code.
|
|
90
|
-
- `publishedPorts` can expose in-container services on the host or network; bind to `127.0.0.1` when only local access is intended.
|
|
91
|
-
- `ssh` forwards the host SSH agent socket.
|
|
92
|
-
- `capAdd` and `virtualization` can expand what containerized code can do.
|
|
93
|
-
- `containerBinary` is intentionally a constructor-only escape hatch for trusted code and is not part of the serializable editor provider schema.
|
|
94
|
-
|
|
95
|
-
Use the narrowest mounts and capabilities your workload needs. Existing containers are only reconnected when they carry Mastra ownership labels for the sandbox ID. Containers created by this provider also include a config-hash label; when that label is present, reconnect fails if immutable runtime options such as image, command, mounts, ports, capabilities, or working directory changed.
|
|
96
|
-
|
|
97
|
-
## Limitations
|
|
98
|
-
|
|
99
|
-
`AppleContainerSandbox` implements foreground workspace command execution with `executeCommand()`. It does not yet expose a `SandboxProcessManager` for background processes or LSP sessions.
|
|
100
|
-
|
|
101
|
-
Command timeouts are enforced inside the container so timed-out commands are cleaned up by the container runtime. Abort signals cancel the host CLI wait path and should not be used as a substitute for command timeouts when in-container cleanup matters.
|
|
102
|
-
|
|
103
|
-
## Editor provider
|
|
104
|
-
|
|
105
|
-
Register the provider with `MastraEditor` to hydrate stored sandbox configs:
|
|
36
|
+
## Documentation
|
|
106
37
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
import { appleContainerSandboxProvider } from '@mastra/apple-container';
|
|
38
|
+
- [Apple Container integration guide](https://mastra.ai/integrations/sandboxes/apple-container)
|
|
39
|
+
- [Workspace documentation](https://mastra.ai/docs/mastra-platform/workspaces)
|
|
110
40
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
```
|
|
41
|
+
## Changelog
|
|
42
|
+
|
|
43
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/workspaces/apple-container/CHANGELOG.md) for version history and release notes.
|
|
115
44
|
|
|
116
|
-
##
|
|
45
|
+
## Support
|
|
117
46
|
|
|
118
|
-
|
|
47
|
+
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/apple-container",
|
|
3
|
-
"version": "0.5.0
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Apple container CLI sandbox provider for Mastra workspaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"tsdown": "0.22.9",
|
|
29
29
|
"typescript": "^7.0.2",
|
|
30
30
|
"vitest": "4.1.10",
|
|
31
|
-
"@internal/lint": "0.0.
|
|
32
|
-
"@
|
|
33
|
-
"@internal/workspace-test-utils": "0.0.
|
|
34
|
-
"@
|
|
31
|
+
"@internal/lint": "0.0.130",
|
|
32
|
+
"@internal/types-builder": "0.0.105",
|
|
33
|
+
"@internal/workspace-test-utils": "0.0.74",
|
|
34
|
+
"@mastra/core": "1.64.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@mastra/core": ">=1.12.0-0 <2.0.0-0"
|