@mastra/apple-container 0.4.1 → 0.5.0-alpha.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/LICENSE.md CHANGED
@@ -1,10 +1,12 @@
1
1
  Portions of this software are licensed as follows:
2
2
 
3
- - All content that resides under any directory named "ee/" within this
3
+ - All content that resides under any directory named `ee/` within this
4
4
  repository, including but not limited to:
5
- - `packages/core/src/auth/ee/`
6
- - `packages/server/src/server/auth/ee/`
7
- is licensed under the license defined in `ee/LICENSE`.
5
+ - `@mastra/core/auth/ee`
6
+ - `@mastra/core/agent-builder/ee`
7
+ - `@mastra/editor/ee`
8
+
9
+ is licensed under the license defined in [`ee/LICENSE`](https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE).
8
10
 
9
11
  - All third-party components incorporated into the Mastra Software are
10
12
  licensed under the original license provided by the owner of the
package/dist/index.cjs CHANGED
@@ -65,7 +65,6 @@ var AppleContainerSandbox = class AppleContainerSandbox extends _mastra_core_wor
65
65
  _userLabels;
66
66
  _labels;
67
67
  _configHash;
68
- _workingDir;
69
68
  _timeout;
70
69
  _deleteOnDestroy;
71
70
  _runner;
@@ -73,6 +72,14 @@ var AppleContainerSandbox = class AppleContainerSandbox extends _mastra_core_wor
73
72
  _createdAt;
74
73
  _constructorOptions;
75
74
  _containerId;
75
+ /**
76
+ * The effective container working directory. Narrowed to `string`: the
77
+ * constructor always resolves a value (option, deprecated alias, or the
78
+ * default), so unlike the base getter this never returns `undefined`.
79
+ */
80
+ get workingDirectory() {
81
+ return this._workingDirectory;
82
+ }
76
83
  constructor(options = {}) {
77
84
  super({
78
85
  ...options,
@@ -106,7 +113,7 @@ var AppleContainerSandbox = class AppleContainerSandbox extends _mastra_core_wor
106
113
  this._dns = options.dns ?? [];
107
114
  this._dnsSearch = options.dnsSearch ?? [];
108
115
  this._noDns = options.noDns ?? false;
109
- this._workingDir = options.workingDir ?? DEFAULT_WORKING_DIR;
116
+ this.setWorkingDirectory(options.workingDirectory ?? options.workingDir ?? DEFAULT_WORKING_DIR);
110
117
  this._userLabels = options.labels ?? {};
111
118
  this._configHash = hashConfig(this._runtimeConfigForHash());
112
119
  this._labels = {
@@ -212,7 +219,7 @@ var AppleContainerSandbox = class AppleContainerSandbox extends _mastra_core_wor
212
219
  "exec",
213
220
  ...env.args,
214
221
  "--workdir",
215
- options.cwd ?? this._workingDir,
222
+ options.cwd ?? this.workingDirectory,
216
223
  this.containerId,
217
224
  "sh",
218
225
  "-lc",
@@ -264,7 +271,7 @@ var AppleContainerSandbox = class AppleContainerSandbox extends _mastra_core_wor
264
271
  return defaultInstructions;
265
272
  }
266
273
  _buildDefaultInstructions() {
267
- const parts = [`Apple container sandbox: commands run inside a local OCI Linux container from image ${this._image}.`, `Working directory: ${this._workingDir}.`];
274
+ const parts = [`Apple container sandbox: commands run inside a local OCI Linux container from image ${this._image}.`, `Working directory: ${this.workingDirectory}.`];
268
275
  const volumeCount = Object.keys(this._volumes).length + this._mounts.length;
269
276
  if (volumeCount > 0) parts.push(`${volumeCount} host mount(s) are configured.`);
270
277
  if (this._timeout > 0) parts.push(`Default command timeout: ${Math.ceil(this._timeout / 1e3)}s.`);
@@ -302,7 +309,7 @@ var AppleContainerSandbox = class AppleContainerSandbox extends _mastra_core_wor
302
309
  "--name",
303
310
  this._containerName,
304
311
  "--workdir",
305
- this._workingDir
312
+ this.workingDirectory
306
313
  ];
307
314
  args.push(...envArgs);
308
315
  for (const [hostPath, containerPath] of Object.entries(this._volumes)) args.push("--volume", `${hostPath}:${containerPath}`);
@@ -390,7 +397,7 @@ var AppleContainerSandbox = class AppleContainerSandbox extends _mastra_core_wor
390
397
  dnsSearch: this._dnsSearch,
391
398
  noDns: this._noDns,
392
399
  labels: this._userLabels,
393
- workingDir: this._workingDir
400
+ workingDir: this.workingDirectory
394
401
  };
395
402
  }
396
403
  _serializableConfig() {
@@ -422,7 +429,7 @@ var AppleContainerSandbox = class AppleContainerSandbox extends _mastra_core_wor
422
429
  dnsSearch: this._dnsSearch,
423
430
  noDns: this._noDns,
424
431
  labels: this._userLabels,
425
- workingDir: this._workingDir,
432
+ workingDir: this.workingDirectory,
426
433
  timeout: this._timeout,
427
434
  deleteOnDestroy: this._deleteOnDestroy
428
435
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["MastraSandbox","SandboxExecutionError","ProcessHandle","StringDecoder","UnsupportedStdinCloseError"],"sources":["../src/sandbox/index.ts","../src/provider.ts"],"sourcesContent":["/**\n * Apple container CLI sandbox provider.\n *\n * This provider maps Mastra's WorkspaceSandbox command execution contract to\n * Apple's `container` CLI. It starts a long-lived OCI Linux container and uses\n * `container exec` for commands.\n *\n * @see https://github.com/apple/container\n */\n\nimport { spawn } from 'node:child_process';\nimport type { ChildProcessByStdio } from 'node:child_process';\nimport { createHash } from 'node:crypto';\nimport type { Readable } from 'node:stream';\nimport { StringDecoder } from 'node:string_decoder';\nimport type { RequestContext } from '@mastra/core/di';\nimport type {\n CommandResult,\n ExecuteCommandOptions,\n InstructionsOption,\n MastraSandboxOptions,\n ProviderStatus,\n SandboxCloneOptions,\n SandboxInfo,\n} from '@mastra/core/workspace';\nimport {\n MastraSandbox,\n ProcessHandle,\n UnsupportedStdinCloseError,\n SandboxExecutionError,\n} from '@mastra/core/workspace';\n\nconst DEFAULT_COMMAND_TIMEOUT_MS = 300_000;\nconst DEFAULT_IMAGE = 'node:22-slim';\nconst DEFAULT_COMMAND = ['sleep', 'infinity'];\nconst DEFAULT_WORKING_DIR = '/workspace';\nconst APPLE_CONTAINER_CLI_GRACE_TIMEOUT_MS = 10_000;\nconst APPLE_CONTAINER_READY_TIMEOUT_MS = 10_000;\nconst APPLE_CONTAINER_READY_EXEC_TIMEOUT_MS = 5_000;\nconst APPLE_CONTAINER_TIMEOUT_EXIT_CODE = 124;\nconst APPLE_CONTAINER_TIMEOUT_MARKER = '__MASTRA_APPLE_CONTAINER_TIMEOUT__';\n\nexport interface AppleContainerCliResult {\n success: boolean;\n exitCode: number;\n stdout: string;\n stderr: string;\n executionTimeMs: number;\n timedOut?: boolean;\n killed?: boolean;\n stdoutTruncated?: boolean;\n stderrTruncated?: boolean;\n stdoutDroppedBytes?: number;\n stderrDroppedBytes?: number;\n}\n\nexport interface AppleContainerCommandRunnerOptions {\n timeout?: number;\n env?: Record<string, string>;\n abortSignal?: AbortSignal;\n onStdout?: (data: string) => void;\n onStderr?: (data: string) => void;\n maxRetainedBytes?: number;\n}\n\nexport interface AppleContainerCommandRunner {\n run(args: string[], options?: AppleContainerCommandRunnerOptions): Promise<AppleContainerCliResult>;\n}\n\nexport class DefaultAppleContainerCommandRunner implements AppleContainerCommandRunner {\n constructor(private readonly binary = 'container') {}\n\n run(args: string[], options: AppleContainerCommandRunnerOptions = {}): Promise<AppleContainerCliResult> {\n return runAppleContainerCli(this.binary, args, options);\n }\n}\n\ninterface AppleContainerInspectResult {\n id?: string;\n status?:\n | string\n | {\n state?: string;\n networks?: Array<Record<string, unknown>>;\n };\n configuration?: {\n id?: string;\n hostname?: string;\n labels?: Record<string, string>;\n networks?: Array<Record<string, unknown>>;\n resources?: {\n cpus?: number;\n memoryInBytes?: number;\n };\n mounts?: unknown[];\n };\n}\n\nexport interface AppleContainerSandboxOptions extends Omit<MastraSandboxOptions, 'processes'> {\n /** Unique identifier for this sandbox instance. */\n id?: string;\n /** Apple container name passed to `container run --name`. Defaults to the sandbox id. */\n name?: string;\n /** OCI image to use. */\n image?: string;\n /** Container init command. Must keep the container alive for exec-based command execution. */\n command?: string[];\n /** Environment variables available to the container and every command exec. */\n env?: Record<string, string>;\n /** Host-to-container bind mounts. */\n volumes?: Record<string, string>;\n /** Raw `container run --mount` specs. */\n mounts?: string[];\n /** Apple container network attachment spec. */\n network?: string;\n /** Published port specs passed to `container run --publish`. */\n publishedPorts?: string[];\n /** Published socket specs passed to `container run --publish-socket`. */\n publishedSockets?: string[];\n /** Number of CPUs to allocate. */\n cpus?: number | string;\n /** Memory allocation, for example `1G`. */\n memory?: string;\n /** OCI platform, for example `linux/arm64`. */\n platform?: string;\n /** Image architecture when selecting a multi-arch image. */\n arch?: string;\n /** Operating system when selecting a multi-platform image. */\n os?: string;\n /** Enable Rosetta in the container. */\n rosetta?: boolean;\n /** Mount the container root filesystem as read-only. */\n readonlyRootfs?: boolean;\n /** Forward the host SSH agent socket. */\n ssh?: boolean;\n /** Enable Apple's init process in the container. */\n init?: boolean;\n /** Expose virtualization capabilities to the container. */\n virtualization?: boolean;\n /** Linux capabilities to add. */\n capAdd?: string[];\n /** Linux capabilities to drop. */\n capDrop?: string[];\n /** tmpfs destination paths. */\n tmpfs?: string[];\n /** DNS nameserver IPs. */\n dns?: string[];\n /** DNS search domains. */\n dnsSearch?: string[];\n /** Do not configure DNS in the container. */\n noDns?: boolean;\n /** Container labels. Mastra labels are always added. */\n labels?: Record<string, string>;\n /** Working directory inside the container. */\n workingDir?: string;\n /** Default command timeout in milliseconds. */\n timeout?: number;\n /** Delete the container on destroy. Defaults to true. */\n deleteOnDestroy?: boolean;\n /** Path or name for the Apple container CLI. */\n containerBinary?: string;\n /** Custom command runner, primarily for tests. */\n runner?: AppleContainerCommandRunner;\n /** Custom instructions for getInstructions(). String replaces the default; function receives it. */\n instructions?: InstructionsOption;\n}\n\nexport class AppleContainerSandbox extends MastraSandbox {\n readonly id: string;\n readonly name = 'AppleContainerSandbox';\n readonly provider = 'apple-container';\n status: ProviderStatus = 'pending';\n\n private readonly _containerName: string;\n private readonly _configuredName?: string;\n private readonly _image: string;\n private readonly _command: string[];\n private readonly _env: Record<string, string>;\n private readonly _volumes: Record<string, string>;\n private readonly _mounts: string[];\n private readonly _network?: string;\n private readonly _publishedPorts: string[];\n private readonly _publishedSockets: string[];\n private readonly _cpus?: number | string;\n private readonly _memory?: string;\n private readonly _platform?: string;\n private readonly _arch?: string;\n private readonly _os?: string;\n private readonly _rosetta: boolean;\n private readonly _readonlyRootfs: boolean;\n private readonly _ssh: boolean;\n private readonly _init: boolean;\n private readonly _virtualization: boolean;\n private readonly _capAdd: string[];\n private readonly _capDrop: string[];\n private readonly _tmpfs: string[];\n private readonly _dns: string[];\n private readonly _dnsSearch: string[];\n private readonly _noDns: boolean;\n private readonly _userLabels: Record<string, string>;\n private readonly _labels: Record<string, string>;\n private readonly _configHash: string;\n private readonly _workingDir: string;\n private readonly _timeout: number;\n private readonly _deleteOnDestroy: boolean;\n private readonly _runner: AppleContainerCommandRunner;\n private readonly _instructionsOverride?: InstructionsOption;\n private readonly _createdAt: Date;\n private readonly _constructorOptions: AppleContainerSandboxOptions;\n\n private _containerId?: string;\n\n constructor(options: AppleContainerSandboxOptions = {}) {\n super({\n ...options,\n name: 'AppleContainerSandbox',\n });\n\n this.id = options.id ?? generateId();\n this._configuredName = options.name;\n this._containerName = sanitizeContainerName(options.name ?? this.id);\n this._image = options.image ?? DEFAULT_IMAGE;\n this._command = options.command ?? DEFAULT_COMMAND;\n this._env = options.env ?? {};\n this._volumes = options.volumes ?? {};\n this._mounts = options.mounts ?? [];\n this._network = options.network;\n this._publishedPorts = options.publishedPorts ?? [];\n this._publishedSockets = options.publishedSockets ?? [];\n this._cpus = options.cpus;\n this._memory = options.memory;\n this._platform = options.platform;\n this._arch = options.arch;\n this._os = options.os;\n this._rosetta = options.rosetta ?? false;\n this._readonlyRootfs = options.readonlyRootfs ?? false;\n this._ssh = options.ssh ?? false;\n this._init = options.init ?? true;\n this._virtualization = options.virtualization ?? false;\n this._capAdd = options.capAdd ?? [];\n this._capDrop = options.capDrop ?? [];\n this._tmpfs = options.tmpfs ?? [];\n validateTmpfsPaths(this._tmpfs);\n this._dns = options.dns ?? [];\n this._dnsSearch = options.dnsSearch ?? [];\n this._noDns = options.noDns ?? false;\n this._workingDir = options.workingDir ?? DEFAULT_WORKING_DIR;\n this._userLabels = options.labels ?? {};\n this._configHash = hashConfig(this._runtimeConfigForHash());\n this._labels = {\n ...this._userLabels,\n 'mastra.sandbox': 'true',\n 'mastra.sandbox.id': this.id,\n 'mastra.sandbox.config-hash': this._configHash,\n };\n this._timeout = options.timeout ?? DEFAULT_COMMAND_TIMEOUT_MS;\n this._deleteOnDestroy = options.deleteOnDestroy ?? true;\n this._runner = options.runner ?? new DefaultAppleContainerCommandRunner(options.containerBinary);\n this._instructionsOverride = options.instructions;\n this._createdAt = new Date();\n this._constructorOptions = { ...options };\n }\n\n /**\n * Construct a sibling `AppleContainerSandbox` that inherits this sandbox's\n * configuration (image, resources, network, security options, labels) with\n * per-instance overrides.\n *\n * Performs no I/O — the sandbox clone provisions (or reconnects to an\n * existing container labelled with the same logical `id`) on its own\n * `start()`. Use it when one configured sandbox acts as the template for a\n * fleet of independent sandboxes (e.g. one per project).\n *\n * `options.idleTimeoutMinutes` is ignored (Apple containers have no\n * provider-side idle teardown; `timeout` here is a command timeout), and\n * `options.sandboxId` is ignored because reconnection is by logical `id`.\n */\n clone(options: SandboxCloneOptions = {}): AppleContainerSandbox {\n const { id: _id, name: _name, ...base } = this._constructorOptions;\n return new AppleContainerSandbox({\n ...base,\n ...(options.id !== undefined && { id: options.id }),\n ...(options.env !== undefined && { env: options.env }),\n });\n }\n\n get containerId(): string {\n return this._containerId ?? this._containerName;\n }\n\n async start(): Promise<void> {\n await this._runPlainLifecycle('starting', 'running', () => this._startContainer());\n }\n\n async stop(): Promise<void> {\n await this._runPlainLifecycle('stopping', 'stopped', () => this._stopContainer());\n }\n\n async destroy(): Promise<void> {\n await this._runPlainLifecycle('destroying', 'destroyed', () => this._destroyContainer());\n }\n\n private async _startContainer(): Promise<void> {\n const existing = await this._inspectContainer();\n if (existing) {\n this._assertMastraOwned(existing);\n this._assertCompatibleConfig(existing);\n this._containerId = existing.configuration?.id ?? this._containerName;\n if (!isRunning(existing)) {\n const result = await this._runCli(['start', this.containerId]);\n this._assertSuccess(result, `start Apple container ${this.containerId}`);\n await this._waitUntilContainerReady(`start Apple container ${this.containerId}`);\n }\n return;\n }\n\n const env = envFlags(this._env);\n const result = await this._runCli(this._buildRunArgs(env.args), { env: env.env });\n this._assertSuccess(result, `create Apple container ${this._containerName}`);\n this._containerId = this._containerName;\n try {\n await this._waitUntilContainerReady(`create Apple container ${this._containerName}`);\n } catch (error) {\n if (this._deleteOnDestroy) {\n await this._deleteContainerIgnoringMissing();\n }\n throw error;\n }\n }\n\n private async _stopContainer(): Promise<void> {\n const existing = await this._inspectContainer();\n if (!existing) {\n return;\n }\n this._assertMastraOwned(existing);\n if (!isRunning(existing)) {\n return;\n }\n\n const result = await this._runCli(['stop', this.containerId]);\n if (!result.success && !isMissingContainerMessage(result.stderr)) {\n this._assertSuccess(result, `stop Apple container ${this.containerId}`);\n }\n }\n\n private async _destroyContainer(): Promise<void> {\n if (!this._deleteOnDestroy) {\n await this._stopContainer();\n return;\n }\n\n const existing = await this._inspectContainer();\n if (!existing) {\n return;\n }\n this._assertMastraOwned(existing);\n\n await this._deleteContainerIgnoringMissing();\n }\n\n async executeCommand(\n command: string,\n args: string[] = [],\n options: ExecuteCommandOptions = {},\n ): Promise<CommandResult> {\n await this.ensureRunning();\n\n const commandTimeout = options.timeout ?? this._timeout;\n const hasCommandTimeout = Number.isFinite(commandTimeout) && commandTimeout > 0;\n const fullCommand = buildShellCommand(command, args);\n const shellCommand = hasCommandTimeout ? buildTimeoutShellCommand(fullCommand, commandTimeout) : fullCommand;\n // Constructor env seeds the sandbox env, so getEnv() covers it plus any setEnv updates\n const env = envFlags({ ...this.getEnv(), ...options.env });\n const cliArgs = [\n 'exec',\n ...env.args,\n '--workdir',\n options.cwd ?? this._workingDir,\n this.containerId,\n 'sh',\n '-lc',\n shellCommand,\n ];\n\n const result = await this._runner.run(cliArgs, {\n timeout: hasCommandTimeout ? commandTimeout + APPLE_CONTAINER_CLI_GRACE_TIMEOUT_MS : undefined,\n env: env.env,\n abortSignal: options.abortSignal,\n onStdout: options.onStdout,\n onStderr: options.onStderr,\n maxRetainedBytes: options.maxRetainedBytes,\n });\n\n const timedOut =\n result.exitCode === APPLE_CONTAINER_TIMEOUT_EXIT_CODE && result.stderr.includes(APPLE_CONTAINER_TIMEOUT_MARKER);\n const stderr = timedOut ? stripTimeoutMarker(result.stderr) : result.stderr;\n\n return {\n ...result,\n stderr,\n ...(timedOut && { timedOut: true, killed: true }),\n command: fullCommand,\n args,\n };\n }\n\n async getInfo(): Promise<SandboxInfo> {\n const inspect = this._containerId ? await this._inspectContainer() : undefined;\n const resources = inspect?.configuration?.resources;\n\n return {\n id: this.id,\n name: this.name,\n provider: this.provider,\n status: this.status,\n createdAt: this._createdAt,\n resources: resources\n ? {\n cpuCores: resources.cpus,\n memoryMB: resources.memoryInBytes ? Math.round(resources.memoryInBytes / 1024 / 1024) : undefined,\n }\n : undefined,\n metadata: {\n ...this._serializableConfig(),\n },\n };\n }\n\n getInstructions(opts?: { requestContext?: RequestContext }): string {\n const defaultInstructions = this._buildDefaultInstructions();\n if (typeof this._instructionsOverride === 'string') {\n return this._instructionsOverride;\n }\n if (typeof this._instructionsOverride === 'function') {\n return this._instructionsOverride({ defaultInstructions, requestContext: opts?.requestContext });\n }\n return defaultInstructions;\n }\n\n private _buildDefaultInstructions(): string {\n const parts = [\n `Apple container sandbox: commands run inside a local OCI Linux container from image ${this._image}.`,\n `Working directory: ${this._workingDir}.`,\n ];\n\n const volumeCount = Object.keys(this._volumes).length + this._mounts.length;\n if (volumeCount > 0) {\n parts.push(`${volumeCount} host mount(s) are configured.`);\n }\n if (this._timeout > 0) {\n parts.push(`Default command timeout: ${Math.ceil(this._timeout / 1000)}s.`);\n }\n\n return parts.join(' ');\n }\n\n private async _runPlainLifecycle(\n activeStatus: ProviderStatus,\n completeStatus: ProviderStatus,\n operation: () => Promise<void>,\n ): Promise<void> {\n const managedByBaseWrapper = this.status === activeStatus;\n if (!managedByBaseWrapper) {\n this.status = activeStatus;\n }\n\n try {\n await operation();\n if (!managedByBaseWrapper) {\n this.status = completeStatus;\n }\n } catch (error) {\n if (!managedByBaseWrapper) {\n this.status = 'error';\n }\n throw error;\n }\n }\n\n private async _inspectContainer(): Promise<AppleContainerInspectResult | undefined> {\n const result = await this._runCli(['inspect', this.containerId]);\n if (!result.success) {\n if (isMissingContainerMessage(result.stderr)) return undefined;\n this._assertSuccess(result, `inspect Apple container ${this.containerId}`);\n return undefined;\n }\n\n try {\n const parsed = JSON.parse(result.stdout) as AppleContainerInspectResult[] | AppleContainerInspectResult;\n return Array.isArray(parsed) ? parsed[0] : parsed;\n } catch (error) {\n throw new SandboxExecutionError(\n `Failed to parse Apple container inspect output for ${this.containerId}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n 1,\n result.stdout,\n result.stderr,\n );\n }\n }\n\n private _buildRunArgs(envArgs: string[]): string[] {\n const args = ['run', '-d', '--name', this._containerName, '--workdir', this._workingDir];\n\n args.push(...envArgs);\n for (const [hostPath, containerPath] of Object.entries(this._volumes)) {\n args.push('--volume', `${hostPath}:${containerPath}`);\n }\n for (const mount of this._mounts) args.push('--mount', mount);\n for (const [key, value] of Object.entries(this._labels)) args.push('--label', `${key}=${value}`);\n for (const port of this._publishedPorts) args.push('--publish', port);\n for (const socket of this._publishedSockets) args.push('--publish-socket', socket);\n for (const cap of this._capAdd) args.push('--cap-add', cap);\n for (const cap of this._capDrop) args.push('--cap-drop', cap);\n for (const tmpfs of this._tmpfs) args.push('--tmpfs', tmpfs);\n for (const dns of this._dns) args.push('--dns', dns);\n for (const domain of this._dnsSearch) args.push('--dns-search', domain);\n\n if (this._network) args.push('--network', this._network);\n if (this._cpus !== undefined) args.push('--cpus', String(this._cpus));\n if (this._memory !== undefined) args.push('--memory', this._memory);\n if (this._platform) args.push('--platform', this._platform);\n if (this._arch) args.push('--arch', this._arch);\n if (this._os) args.push('--os', this._os);\n if (this._rosetta) args.push('--rosetta');\n if (this._readonlyRootfs) args.push('--read-only');\n if (this._ssh) args.push('--ssh');\n if (this._init) args.push('--init');\n if (this._virtualization) args.push('--virtualization');\n if (this._noDns) args.push('--no-dns');\n\n args.push(this._image, ...this._command);\n return args;\n }\n\n private async _waitUntilContainerReady(action: string): Promise<void> {\n const deadline = Date.now() + APPLE_CONTAINER_READY_TIMEOUT_MS;\n let lastResult: AppleContainerCliResult | undefined;\n\n while (Date.now() < deadline) {\n const inspect = await this._inspectContainer();\n if (!inspect) {\n throw new SandboxExecutionError(\n `${action} failed because Apple container ${this.containerId} disappeared`,\n 1,\n '',\n '',\n );\n }\n\n this._assertMastraOwned(inspect);\n this._assertCompatibleConfig(inspect);\n\n if (!isRunning(inspect)) {\n const state = getContainerState(inspect) ?? 'not running';\n throw new SandboxExecutionError(\n `${action} failed because Apple container ${this.containerId} is ${state}`,\n 1,\n '',\n '',\n );\n }\n\n lastResult = await this._runCli(['exec', this.containerId, 'sh', '-lc', 'true'], {\n timeout: APPLE_CONTAINER_READY_EXEC_TIMEOUT_MS,\n });\n if (lastResult.success) return;\n\n if (!isMissingContainerMessage(lastResult.stderr) && !/not running|not yet running/i.test(lastResult.stderr)) {\n break;\n }\n\n await delay(100);\n }\n\n throw new SandboxExecutionError(\n `${action} failed because Apple container ${this.containerId} did not become ready for exec`,\n lastResult?.exitCode ?? 1,\n lastResult?.stdout ?? '',\n lastResult?.stderr ?? '',\n );\n }\n\n private async _deleteContainerIgnoringMissing(): Promise<void> {\n const result = await this._runCli(['delete', '--force', this.containerId]);\n if (!result.success && !isMissingContainerMessage(result.stderr)) {\n this._assertSuccess(result, `delete Apple container ${this.containerId}`);\n }\n }\n\n private _runtimeConfigForHash(): Record<string, unknown> {\n return {\n image: this._image,\n command: this._command,\n env: this._env,\n volumes: this._volumes,\n mounts: this._mounts,\n network: this._network,\n publishedPorts: this._publishedPorts,\n publishedSockets: this._publishedSockets,\n cpus: this._cpus,\n memory: this._memory,\n platform: this._platform,\n arch: this._arch,\n os: this._os,\n rosetta: this._rosetta,\n readonlyRootfs: this._readonlyRootfs,\n ssh: this._ssh,\n init: this._init,\n virtualization: this._virtualization,\n capAdd: this._capAdd,\n capDrop: this._capDrop,\n tmpfs: this._tmpfs,\n dns: this._dns,\n dnsSearch: this._dnsSearch,\n noDns: this._noDns,\n labels: this._userLabels,\n workingDir: this._workingDir,\n };\n }\n\n private _serializableConfig(): Record<string, unknown> {\n return compactConfig({\n id: this.id,\n name: this._configuredName,\n image: this._image,\n command: this._command,\n env: this._env,\n volumes: this._volumes,\n mounts: this._mounts,\n network: this._network,\n publishedPorts: this._publishedPorts,\n publishedSockets: this._publishedSockets,\n cpus: this._cpus,\n memory: this._memory,\n platform: this._platform,\n arch: this._arch,\n os: this._os,\n rosetta: this._rosetta,\n readonlyRootfs: this._readonlyRootfs,\n ssh: this._ssh,\n init: this._init,\n virtualization: this._virtualization,\n capAdd: this._capAdd,\n capDrop: this._capDrop,\n tmpfs: this._tmpfs,\n dns: this._dns,\n dnsSearch: this._dnsSearch,\n noDns: this._noDns,\n labels: this._userLabels,\n workingDir: this._workingDir,\n timeout: this._timeout,\n deleteOnDestroy: this._deleteOnDestroy,\n });\n }\n\n private _assertSuccess(result: AppleContainerCliResult, action: string): void {\n if (result.success) return;\n throw new SandboxExecutionError(\n `${action} failed with exit code ${result.exitCode}: ${result.stderr}`,\n result.exitCode,\n result.stdout,\n result.stderr,\n );\n }\n\n private _assertMastraOwned(inspect: AppleContainerInspectResult): void {\n if (isMastraOwned(inspect, this.id)) return;\n throw new SandboxExecutionError(\n `Refusing to manage Apple container ${this.containerId} because it is not labeled as Mastra sandbox ${this.id}`,\n 1,\n '',\n '',\n );\n }\n\n private _assertCompatibleConfig(inspect: AppleContainerInspectResult): void {\n const existingHash = inspect.configuration?.labels?.['mastra.sandbox.config-hash'];\n if (!existingHash || existingHash === this._configHash) return;\n throw new SandboxExecutionError(\n `Refusing to manage Apple container ${this.containerId} because its immutable configuration does not match sandbox ${this.id}`,\n 1,\n '',\n '',\n );\n }\n\n private _runCli(args: string[], options: AppleContainerCommandRunnerOptions = {}): Promise<AppleContainerCliResult> {\n return this._runner.run(args, {\n timeout: this._timeout,\n ...options,\n });\n }\n}\n\nexport function runAppleContainerCli(\n binary: string,\n args: string[],\n options: AppleContainerCommandRunnerOptions = {},\n): Promise<AppleContainerCliResult> {\n const handle = new AppleContainerCliProcess(binary, args, options);\n return handle.wait() as Promise<AppleContainerCliResult>;\n}\n\nclass AppleContainerCliProcess extends ProcessHandle {\n readonly pid: string;\n exitCode: number | undefined;\n\n private readonly child: ChildProcessByStdio<null, Readable, Readable>;\n private readonly waitPromise: Promise<AppleContainerCliResult>;\n private readonly startedAt = Date.now();\n private killed = false;\n private timedOut = false;\n private forceKillTimeout: NodeJS.Timeout | undefined;\n\n constructor(binary: string, args: string[], options: AppleContainerCommandRunnerOptions = {}) {\n super({\n maxRetainedBytes: options.maxRetainedBytes,\n onStdout: options.onStdout,\n onStderr: options.onStderr,\n });\n\n this.child = spawn(binary, args, {\n stdio: ['ignore', 'pipe', 'pipe'],\n env: options.env ? { ...process.env, ...options.env } : process.env,\n });\n this.pid = this.child.pid ? String(this.child.pid) : `${binary}:${args.join(' ')}`;\n\n let settled = false;\n const stdoutDecoder = new StringDecoder();\n const stderrDecoder = new StringDecoder();\n let stdoutDecoderEnded = false;\n let stderrDecoderEnded = false;\n let timeout: NodeJS.Timeout | undefined;\n const onAbort = (): void => {\n void this.kill();\n };\n\n const flushStdout = (): void => {\n if (stdoutDecoderEnded) return;\n stdoutDecoderEnded = true;\n const data = stdoutDecoder.end();\n if (data) this.emitStdout(data);\n };\n const flushStderr = (): void => {\n if (stderrDecoderEnded) return;\n stderrDecoderEnded = true;\n const data = stderrDecoder.end();\n if (data) this.emitStderr(data);\n };\n\n const finish = (exitCode: number): AppleContainerCliResult => {\n this.exitCode = exitCode;\n return {\n success: exitCode === 0,\n exitCode,\n stdout: this.stdout,\n stderr: this.stderr,\n executionTimeMs: Date.now() - this.startedAt,\n killed: this.killed,\n timedOut: this.timedOut,\n };\n };\n\n const cleanup = (): void => {\n if (timeout) clearTimeout(timeout);\n if (this.forceKillTimeout) clearTimeout(this.forceKillTimeout);\n options.abortSignal?.removeEventListener('abort', onAbort);\n };\n\n this.waitPromise = new Promise((resolve, reject) => {\n const settle = (callback: () => void): void => {\n if (settled) return;\n settled = true;\n cleanup();\n callback();\n };\n\n this.child.stdout.on('data', (chunk: Buffer) => {\n const data = stdoutDecoder.write(chunk);\n if (data) this.emitStdout(data);\n });\n this.child.stderr.on('data', (chunk: Buffer) => {\n const data = stderrDecoder.write(chunk);\n if (data) this.emitStderr(data);\n });\n\n this.child.stdout.on('end', flushStdout);\n this.child.stderr.on('end', flushStderr);\n\n this.child.on('error', error => {\n settle(() => {\n flushStdout();\n flushStderr();\n reject(\n error instanceof Error && 'code' in error && error.code === 'ENOENT'\n ? new SandboxExecutionError(`Apple container CLI not found: ${binary}`, 127, this.stdout, error.message)\n : error,\n );\n });\n });\n\n this.child.on('close', code => {\n settle(() => {\n flushStdout();\n flushStderr();\n resolve(finish(code ?? (this.killed ? 137 : 1)));\n });\n });\n });\n\n timeout =\n options.timeout && options.timeout > 0\n ? setTimeout(() => {\n this.timedOut = true;\n void this.kill();\n }, options.timeout)\n : undefined;\n if (options.abortSignal) {\n if (options.abortSignal.aborted) {\n void this.kill();\n } else {\n options.abortSignal.addEventListener('abort', onAbort, { once: true });\n }\n }\n }\n\n async wait(): Promise<AppleContainerCliResult> {\n return this.waitPromise;\n }\n\n async kill(): Promise<boolean> {\n if (this.exitCode !== undefined || this.child.killed) return false;\n this.killed = true;\n this.child.kill('SIGTERM');\n this.forceKillTimeout = setTimeout(() => {\n if (this.exitCode === undefined && this.child.exitCode === null && this.child.signalCode === null) {\n this.child.kill('SIGKILL');\n }\n }, 1000);\n this.forceKillTimeout.unref();\n return true;\n }\n\n async sendStdin(): Promise<void> {\n throw new Error('Apple container CLI runner does not support stdin');\n }\n\n async closeStdin(): Promise<void> {\n throw new UnsupportedStdinCloseError('Apple container CLI runner does not support closing stdin');\n }\n}\n\nfunction generateId(): string {\n return `apple-container-sandbox-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;\n}\n\nfunction sanitizeContainerName(name: string): string {\n const sanitized = name.replace(/[^a-zA-Z0-9_.-]/g, '-');\n return /^[a-zA-Z0-9]/.test(sanitized) ? sanitized : `c-${sanitized}`;\n}\n\nfunction buildShellCommand(command: string, args: string[]): string {\n return args.length > 0 ? [command, ...args].map(shellQuote).join(' ') : command;\n}\n\nfunction buildTimeoutShellCommand(command: string, timeoutMs: number): string {\n const timeoutSeconds = formatTimeoutSeconds(timeoutMs);\n const innerScript = [\n `sh -lc ${shellQuote(command)} & child=$!`,\n `trap 'kill -TERM \"$child\" 2>/dev/null; wait \"$child\" 2>/dev/null; exit ${APPLE_CONTAINER_TIMEOUT_EXIT_CODE}' TERM INT`,\n 'wait \"$child\"; code=$?',\n 'trap - TERM INT',\n 'printf \"%s\" \"$code\" > \"$MASTRA_TIMEOUT_RESULT_FILE\"',\n 'exit \"$code\"',\n ].join('; ');\n return [\n 'result_file=\"/tmp/.mastra-apple-container-exit-$$\"',\n 'rm -f \"$result_file\"',\n `MASTRA_TIMEOUT_RESULT_FILE=\"$result_file\" timeout ${timeoutSeconds}s sh -lc ${shellQuote(innerScript)}`,\n 'timeout_code=$?',\n 'if [ -f \"$result_file\" ]; then code=\"$(cat \"$result_file\")\"; rm -f \"$result_file\"; exit \"$code\"; fi',\n 'rm -f \"$result_file\"',\n `case \"$timeout_code\" in 124|137|143) printf '%s\\\\n' ${shellQuote(APPLE_CONTAINER_TIMEOUT_MARKER)} >&2; exit ${APPLE_CONTAINER_TIMEOUT_EXIT_CODE};; *) exit \"$timeout_code\";; esac`,\n ].join('; ');\n}\n\nfunction formatTimeoutSeconds(timeoutMs: number): string {\n return Math.max(timeoutMs / 1000, 0.001)\n .toFixed(3)\n .replace(/0+$/, '')\n .replace(/\\.$/, '');\n}\n\nfunction shellQuote(arg: string): string {\n if (/^[a-zA-Z0-9._\\-\\/=:@]+$/.test(arg)) return arg;\n return `'${arg.replace(/'/g, \"'\\\\''\")}'`;\n}\n\nfunction stripTimeoutMarker(stderr: string): string {\n return stderr\n .split('\\n')\n .filter(line => line.trim() !== APPLE_CONTAINER_TIMEOUT_MARKER)\n .join('\\n')\n .replace(/^\\n+|\\n+$/g, '');\n}\n\nfunction envFlags(env: Record<string, string | undefined>): { args: string[]; env: Record<string, string> } {\n const args: string[] = [];\n const childEnv: Record<string, string> = {};\n for (const [key, value] of Object.entries(env)) {\n if (value === undefined) continue;\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {\n throw new Error(`Invalid environment variable name for Apple container command: ${key}`);\n }\n args.push('--env', key);\n childEnv[key] = value;\n }\n return { args, env: childEnv };\n}\n\nfunction isRunning(inspect: AppleContainerInspectResult): boolean {\n return getContainerState(inspect) === 'running';\n}\n\nfunction getContainerState(inspect: AppleContainerInspectResult): string | undefined {\n return typeof inspect.status === 'string' ? inspect.status : inspect.status?.state;\n}\n\nfunction isMastraOwned(inspect: AppleContainerInspectResult, sandboxId: string): boolean {\n const labels = inspect.configuration?.labels;\n return labels?.['mastra.sandbox'] === 'true' && labels['mastra.sandbox.id'] === sandboxId;\n}\n\nfunction isMissingContainerMessage(message: string): boolean {\n return /not found|no such|does not exist|unknown container/i.test(message);\n}\n\nfunction validateTmpfsPaths(tmpfs: string[]): void {\n for (const entry of tmpfs) {\n if (!entry.startsWith('/') || /[:,]/.test(entry)) {\n throw new Error(\n `Invalid Apple container tmpfs path \"${entry}\". Apple container --tmpfs accepts container paths only, for example \"/tmp\".`,\n );\n }\n }\n}\n\nfunction compactConfig(config: Record<string, unknown>): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(config)) {\n if (value === undefined) continue;\n if (Array.isArray(value) && value.length === 0) continue;\n if (isPlainRecord(value) && Object.keys(value).length === 0) continue;\n result[key] = value;\n }\n return result;\n}\n\nfunction hashConfig(config: Record<string, unknown>): string {\n return createHash('sha256')\n .update(stableStringify(compactConfig(config)))\n .digest('hex')\n .slice(0, 16);\n}\n\nfunction stableStringify(value: unknown): string {\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(',')}]`;\n }\n if (isPlainRecord(value)) {\n return `{${Object.keys(value)\n .sort()\n .map(key => `${JSON.stringify(key)}:${stableStringify(value[key])}`)\n .join(',')}}`;\n }\n return JSON.stringify(value);\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction delay(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n","/**\n * Apple container sandbox provider descriptor for MastraEditor.\n */\n\nimport type { SandboxProvider } from '@mastra/core/editor';\nimport { AppleContainerSandbox } from './sandbox';\nimport type { AppleContainerSandboxOptions } from './sandbox';\n\nexport type AppleContainerProviderConfig = Pick<\n AppleContainerSandboxOptions,\n | 'id'\n | 'image'\n | 'name'\n | 'command'\n | 'env'\n | 'volumes'\n | 'mounts'\n | 'network'\n | 'publishedPorts'\n | 'publishedSockets'\n | 'cpus'\n | 'memory'\n | 'platform'\n | 'arch'\n | 'os'\n | 'rosetta'\n | 'readonlyRootfs'\n | 'ssh'\n | 'init'\n | 'virtualization'\n | 'capAdd'\n | 'capDrop'\n | 'tmpfs'\n | 'dns'\n | 'dnsSearch'\n | 'noDns'\n | 'labels'\n | 'workingDir'\n | 'timeout'\n | 'deleteOnDestroy'\n>;\n\nexport const appleContainerSandboxProvider: SandboxProvider<AppleContainerProviderConfig> = {\n id: 'apple-container',\n name: 'Apple Container Sandbox',\n description: 'Local OCI Linux container sandbox powered by Apple container',\n configSchema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n description: 'Stable sandbox ID used for reconnecting to the same Apple container.',\n },\n image: {\n type: 'string',\n description: 'OCI image to use',\n default: 'node:22-slim',\n },\n name: {\n type: 'string',\n description: 'Apple container name. Defaults to the sandbox ID.',\n },\n command: {\n type: 'array',\n description: 'Container init command. Must keep the container alive for exec-based command execution.',\n items: { type: 'string' },\n },\n env: {\n type: 'object',\n description: 'Environment variables',\n additionalProperties: { type: 'string' },\n },\n volumes: {\n type: 'object',\n description: 'Host-to-container bind mounts (host path -> container path)',\n additionalProperties: { type: 'string' },\n },\n mounts: {\n type: 'array',\n description: 'Raw Apple container --mount specs',\n items: { type: 'string' },\n },\n network: {\n type: 'string',\n description: 'Apple container network attachment spec',\n },\n publishedPorts: {\n type: 'array',\n description: 'Port publish specs',\n items: { type: 'string' },\n },\n publishedSockets: {\n type: 'array',\n description: 'Socket publish specs',\n items: { type: 'string' },\n },\n cpus: {\n anyOf: [{ type: 'number' }, { type: 'string' }],\n description: 'Number of CPUs to allocate',\n },\n memory: {\n type: 'string',\n description: 'Memory allocation, for example 1G',\n },\n platform: {\n type: 'string',\n description: 'OCI platform, for example linux/arm64',\n },\n arch: {\n type: 'string',\n description: 'Image architecture for multi-arch images',\n },\n os: {\n type: 'string',\n description: 'Operating system for multi-platform images',\n },\n rosetta: {\n type: 'boolean',\n description: 'Enable Rosetta in the container',\n default: false,\n },\n readonlyRootfs: {\n type: 'boolean',\n description: 'Mount the container root filesystem as read-only',\n default: false,\n },\n ssh: {\n type: 'boolean',\n description: 'Forward the host SSH agent socket',\n default: false,\n },\n init: {\n type: 'boolean',\n description: \"Enable Apple's init process in the container\",\n default: true,\n },\n virtualization: {\n type: 'boolean',\n description: 'Expose virtualization capabilities to the container',\n default: false,\n },\n capAdd: {\n type: 'array',\n description: 'Linux capabilities to add',\n items: { type: 'string' },\n },\n capDrop: {\n type: 'array',\n description: 'Linux capabilities to drop',\n items: { type: 'string' },\n },\n tmpfs: {\n type: 'array',\n description: 'tmpfs destination paths',\n items: { type: 'string' },\n },\n dns: {\n type: 'array',\n description: 'DNS nameserver IPs',\n items: { type: 'string' },\n },\n dnsSearch: {\n type: 'array',\n description: 'DNS search domains',\n items: { type: 'string' },\n },\n noDns: {\n type: 'boolean',\n description: 'Do not configure DNS in the container',\n default: false,\n },\n labels: {\n type: 'object',\n description: 'Container labels',\n additionalProperties: { type: 'string' },\n },\n workingDir: {\n type: 'string',\n description: 'Working directory inside the container',\n default: '/workspace',\n },\n timeout: {\n type: 'number',\n description: 'Default command timeout in milliseconds',\n default: 300_000,\n },\n deleteOnDestroy: {\n type: 'boolean',\n description: 'Delete the Apple container on destroy',\n default: true,\n },\n },\n },\n createSandbox: config => {\n const {\n id,\n image,\n name,\n command,\n env,\n volumes,\n mounts,\n network,\n publishedPorts,\n publishedSockets,\n cpus,\n memory,\n platform,\n arch,\n os,\n rosetta,\n readonlyRootfs,\n ssh,\n init,\n virtualization,\n capAdd,\n capDrop,\n tmpfs,\n dns,\n dnsSearch,\n noDns,\n labels,\n workingDir,\n timeout,\n deleteOnDestroy,\n } = config;\n\n return new AppleContainerSandbox({\n id,\n image,\n name,\n command,\n env,\n volumes,\n mounts,\n network,\n publishedPorts,\n publishedSockets,\n cpus,\n memory,\n platform,\n arch,\n os,\n rosetta,\n readonlyRootfs,\n ssh,\n init,\n virtualization,\n capAdd,\n capDrop,\n tmpfs,\n dns,\n dnsSearch,\n noDns,\n labels,\n workingDir,\n timeout,\n deleteOnDestroy,\n });\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;AAgCA,MAAM,6BAA6B;AACnC,MAAM,gBAAgB;AACtB,MAAM,kBAAkB,CAAC,SAAS,UAAU;AAC5C,MAAM,sBAAsB;AAC5B,MAAM,uCAAuC;AAC7C,MAAM,mCAAmC;AACzC,MAAM,wCAAwC;AAC9C,MAAM,oCAAoC;AAC1C,MAAM,iCAAiC;AA6BvC,IAAa,qCAAb,MAAuF;CACxD;CAA7B,YAAY,SAA0B,aAAa;EAAtB,KAAA,SAAA;CAAuB;CAEpD,IAAI,MAAgB,UAA8C,CAAC,GAAqC;EACtG,OAAO,qBAAqB,KAAK,QAAQ,MAAM,OAAO;CACxD;AACF;AA4FA,IAAa,wBAAb,MAAa,8BAA8BA,uBAAAA,cAAc;CACvD;CACA,OAAgB;CAChB,WAAoB;CACpB,SAAyB;CAEzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA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,kBACA,MACA,QACA,UACA,MACA,IACA,SACA,gBACA,KACA,MACA,gBACA,QACA,SACA,OACA,KACA,WACA,OACA,QACA,YACA,SACA,oBACE;EAEJ,OAAO,IAAI,sBAAsB;GAC/B;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"index.cjs","names":["MastraSandbox","SandboxExecutionError","ProcessHandle","StringDecoder","UnsupportedStdinCloseError"],"sources":["../src/sandbox/index.ts","../src/provider.ts"],"sourcesContent":["/**\n * Apple container CLI sandbox provider.\n *\n * This provider maps Mastra's WorkspaceSandbox command execution contract to\n * Apple's `container` CLI. It starts a long-lived OCI Linux container and uses\n * `container exec` for commands.\n *\n * @see https://github.com/apple/container\n */\n\nimport { spawn } from 'node:child_process';\nimport type { ChildProcessByStdio } from 'node:child_process';\nimport { createHash } from 'node:crypto';\nimport type { Readable } from 'node:stream';\nimport { StringDecoder } from 'node:string_decoder';\nimport type { RequestContext } from '@mastra/core/di';\nimport type {\n CommandResult,\n ExecuteCommandOptions,\n InstructionsOption,\n MastraSandboxOptions,\n ProviderStatus,\n SandboxCloneOptions,\n SandboxInfo,\n} from '@mastra/core/workspace';\nimport {\n MastraSandbox,\n ProcessHandle,\n UnsupportedStdinCloseError,\n SandboxExecutionError,\n} from '@mastra/core/workspace';\n\nconst DEFAULT_COMMAND_TIMEOUT_MS = 300_000;\nconst DEFAULT_IMAGE = 'node:22-slim';\nconst DEFAULT_COMMAND = ['sleep', 'infinity'];\nconst DEFAULT_WORKING_DIR = '/workspace';\nconst APPLE_CONTAINER_CLI_GRACE_TIMEOUT_MS = 10_000;\nconst APPLE_CONTAINER_READY_TIMEOUT_MS = 10_000;\nconst APPLE_CONTAINER_READY_EXEC_TIMEOUT_MS = 5_000;\nconst APPLE_CONTAINER_TIMEOUT_EXIT_CODE = 124;\nconst APPLE_CONTAINER_TIMEOUT_MARKER = '__MASTRA_APPLE_CONTAINER_TIMEOUT__';\n\nexport interface AppleContainerCliResult {\n success: boolean;\n exitCode: number;\n stdout: string;\n stderr: string;\n executionTimeMs: number;\n timedOut?: boolean;\n killed?: boolean;\n stdoutTruncated?: boolean;\n stderrTruncated?: boolean;\n stdoutDroppedBytes?: number;\n stderrDroppedBytes?: number;\n}\n\nexport interface AppleContainerCommandRunnerOptions {\n timeout?: number;\n env?: Record<string, string>;\n abortSignal?: AbortSignal;\n onStdout?: (data: string) => void;\n onStderr?: (data: string) => void;\n maxRetainedBytes?: number;\n}\n\nexport interface AppleContainerCommandRunner {\n run(args: string[], options?: AppleContainerCommandRunnerOptions): Promise<AppleContainerCliResult>;\n}\n\nexport class DefaultAppleContainerCommandRunner implements AppleContainerCommandRunner {\n constructor(private readonly binary = 'container') {}\n\n run(args: string[], options: AppleContainerCommandRunnerOptions = {}): Promise<AppleContainerCliResult> {\n return runAppleContainerCli(this.binary, args, options);\n }\n}\n\ninterface AppleContainerInspectResult {\n id?: string;\n status?:\n | string\n | {\n state?: string;\n networks?: Array<Record<string, unknown>>;\n };\n configuration?: {\n id?: string;\n hostname?: string;\n labels?: Record<string, string>;\n networks?: Array<Record<string, unknown>>;\n resources?: {\n cpus?: number;\n memoryInBytes?: number;\n };\n mounts?: unknown[];\n };\n}\n\nexport interface AppleContainerSandboxOptions extends Omit<MastraSandboxOptions, 'processes'> {\n /** Unique identifier for this sandbox instance. */\n id?: string;\n /** Apple container name passed to `container run --name`. Defaults to the sandbox id. */\n name?: string;\n /** OCI image to use. */\n image?: string;\n /** Container init command. Must keep the container alive for exec-based command execution. */\n command?: string[];\n /** Environment variables available to the container and every command exec. */\n env?: Record<string, string>;\n /** Host-to-container bind mounts. */\n volumes?: Record<string, string>;\n /** Raw `container run --mount` specs. */\n mounts?: string[];\n /** Apple container network attachment spec. */\n network?: string;\n /** Published port specs passed to `container run --publish`. */\n publishedPorts?: string[];\n /** Published socket specs passed to `container run --publish-socket`. */\n publishedSockets?: string[];\n /** Number of CPUs to allocate. */\n cpus?: number | string;\n /** Memory allocation, for example `1G`. */\n memory?: string;\n /** OCI platform, for example `linux/arm64`. */\n platform?: string;\n /** Image architecture when selecting a multi-arch image. */\n arch?: string;\n /** Operating system when selecting a multi-platform image. */\n os?: string;\n /** Enable Rosetta in the container. */\n rosetta?: boolean;\n /** Mount the container root filesystem as read-only. */\n readonlyRootfs?: boolean;\n /** Forward the host SSH agent socket. */\n ssh?: boolean;\n /** Enable Apple's init process in the container. */\n init?: boolean;\n /** Expose virtualization capabilities to the container. */\n virtualization?: boolean;\n /** Linux capabilities to add. */\n capAdd?: string[];\n /** Linux capabilities to drop. */\n capDrop?: string[];\n /** tmpfs destination paths. */\n tmpfs?: string[];\n /** DNS nameserver IPs. */\n dns?: string[];\n /** DNS search domains. */\n dnsSearch?: string[];\n /** Do not configure DNS in the container. */\n noDns?: boolean;\n /** Container labels. Mastra labels are always added. */\n labels?: Record<string, string>;\n /** Working directory inside the container.\n * @deprecated Use `workingDirectory` (the base sandbox option) instead.\n * When both are set, `workingDirectory` wins.\n */\n workingDir?: string;\n /** Default command timeout in milliseconds. */\n timeout?: number;\n /** Delete the container on destroy. Defaults to true. */\n deleteOnDestroy?: boolean;\n /** Path or name for the Apple container CLI. */\n containerBinary?: string;\n /** Custom command runner, primarily for tests. */\n runner?: AppleContainerCommandRunner;\n /** Custom instructions for getInstructions(). String replaces the default; function receives it. */\n instructions?: InstructionsOption;\n}\n\nexport class AppleContainerSandbox extends MastraSandbox {\n readonly id: string;\n readonly name = 'AppleContainerSandbox';\n readonly provider = 'apple-container';\n status: ProviderStatus = 'pending';\n\n private readonly _containerName: string;\n private readonly _configuredName?: string;\n private readonly _image: string;\n private readonly _command: string[];\n private readonly _env: Record<string, string>;\n private readonly _volumes: Record<string, string>;\n private readonly _mounts: string[];\n private readonly _network?: string;\n private readonly _publishedPorts: string[];\n private readonly _publishedSockets: string[];\n private readonly _cpus?: number | string;\n private readonly _memory?: string;\n private readonly _platform?: string;\n private readonly _arch?: string;\n private readonly _os?: string;\n private readonly _rosetta: boolean;\n private readonly _readonlyRootfs: boolean;\n private readonly _ssh: boolean;\n private readonly _init: boolean;\n private readonly _virtualization: boolean;\n private readonly _capAdd: string[];\n private readonly _capDrop: string[];\n private readonly _tmpfs: string[];\n private readonly _dns: string[];\n private readonly _dnsSearch: string[];\n private readonly _noDns: boolean;\n private readonly _userLabels: Record<string, string>;\n private readonly _labels: Record<string, string>;\n private readonly _configHash: string;\n private readonly _timeout: number;\n private readonly _deleteOnDestroy: boolean;\n private readonly _runner: AppleContainerCommandRunner;\n private readonly _instructionsOverride?: InstructionsOption;\n private readonly _createdAt: Date;\n private readonly _constructorOptions: AppleContainerSandboxOptions;\n\n private _containerId?: string;\n\n /**\n * The effective container working directory. Narrowed to `string`: the\n * constructor always resolves a value (option, deprecated alias, or the\n * default), so unlike the base getter this never returns `undefined`.\n */\n override get workingDirectory(): string {\n return this._workingDirectory!;\n }\n\n constructor(options: AppleContainerSandboxOptions = {}) {\n super({\n ...options,\n name: 'AppleContainerSandbox',\n });\n\n this.id = options.id ?? generateId();\n this._configuredName = options.name;\n this._containerName = sanitizeContainerName(options.name ?? this.id);\n this._image = options.image ?? DEFAULT_IMAGE;\n this._command = options.command ?? DEFAULT_COMMAND;\n this._env = options.env ?? {};\n this._volumes = options.volumes ?? {};\n this._mounts = options.mounts ?? [];\n this._network = options.network;\n this._publishedPorts = options.publishedPorts ?? [];\n this._publishedSockets = options.publishedSockets ?? [];\n this._cpus = options.cpus;\n this._memory = options.memory;\n this._platform = options.platform;\n this._arch = options.arch;\n this._os = options.os;\n this._rosetta = options.rosetta ?? false;\n this._readonlyRootfs = options.readonlyRootfs ?? false;\n this._ssh = options.ssh ?? false;\n this._init = options.init ?? true;\n this._virtualization = options.virtualization ?? false;\n this._capAdd = options.capAdd ?? [];\n this._capDrop = options.capDrop ?? [];\n this._tmpfs = options.tmpfs ?? [];\n validateTmpfsPaths(this._tmpfs);\n this._dns = options.dns ?? [];\n this._dnsSearch = options.dnsSearch ?? [];\n this._noDns = options.noDns ?? false;\n this.setWorkingDirectory(options.workingDirectory ?? options.workingDir ?? DEFAULT_WORKING_DIR);\n this._userLabels = options.labels ?? {};\n this._configHash = hashConfig(this._runtimeConfigForHash());\n this._labels = {\n ...this._userLabels,\n 'mastra.sandbox': 'true',\n 'mastra.sandbox.id': this.id,\n 'mastra.sandbox.config-hash': this._configHash,\n };\n this._timeout = options.timeout ?? DEFAULT_COMMAND_TIMEOUT_MS;\n this._deleteOnDestroy = options.deleteOnDestroy ?? true;\n this._runner = options.runner ?? new DefaultAppleContainerCommandRunner(options.containerBinary);\n this._instructionsOverride = options.instructions;\n this._createdAt = new Date();\n this._constructorOptions = { ...options };\n }\n\n /**\n * Construct a sibling `AppleContainerSandbox` that inherits this sandbox's\n * configuration (image, resources, network, security options, labels) with\n * per-instance overrides.\n *\n * Performs no I/O — the sandbox clone provisions (or reconnects to an\n * existing container labelled with the same logical `id`) on its own\n * `start()`. Use it when one configured sandbox acts as the template for a\n * fleet of independent sandboxes (e.g. one per project).\n *\n * `options.idleTimeoutMinutes` is ignored (Apple containers have no\n * provider-side idle teardown; `timeout` here is a command timeout), and\n * `options.sandboxId` is ignored because reconnection is by logical `id`.\n */\n clone(options: SandboxCloneOptions = {}): AppleContainerSandbox {\n const { id: _id, name: _name, ...base } = this._constructorOptions;\n return new AppleContainerSandbox({\n ...base,\n ...(options.id !== undefined && { id: options.id }),\n ...(options.env !== undefined && { env: options.env }),\n });\n }\n\n get containerId(): string {\n return this._containerId ?? this._containerName;\n }\n\n async start(): Promise<void> {\n await this._runPlainLifecycle('starting', 'running', () => this._startContainer());\n }\n\n async stop(): Promise<void> {\n await this._runPlainLifecycle('stopping', 'stopped', () => this._stopContainer());\n }\n\n async destroy(): Promise<void> {\n await this._runPlainLifecycle('destroying', 'destroyed', () => this._destroyContainer());\n }\n\n private async _startContainer(): Promise<void> {\n const existing = await this._inspectContainer();\n if (existing) {\n this._assertMastraOwned(existing);\n this._assertCompatibleConfig(existing);\n this._containerId = existing.configuration?.id ?? this._containerName;\n if (!isRunning(existing)) {\n const result = await this._runCli(['start', this.containerId]);\n this._assertSuccess(result, `start Apple container ${this.containerId}`);\n await this._waitUntilContainerReady(`start Apple container ${this.containerId}`);\n }\n return;\n }\n\n const env = envFlags(this._env);\n const result = await this._runCli(this._buildRunArgs(env.args), { env: env.env });\n this._assertSuccess(result, `create Apple container ${this._containerName}`);\n this._containerId = this._containerName;\n try {\n await this._waitUntilContainerReady(`create Apple container ${this._containerName}`);\n } catch (error) {\n if (this._deleteOnDestroy) {\n await this._deleteContainerIgnoringMissing();\n }\n throw error;\n }\n }\n\n private async _stopContainer(): Promise<void> {\n const existing = await this._inspectContainer();\n if (!existing) {\n return;\n }\n this._assertMastraOwned(existing);\n if (!isRunning(existing)) {\n return;\n }\n\n const result = await this._runCli(['stop', this.containerId]);\n if (!result.success && !isMissingContainerMessage(result.stderr)) {\n this._assertSuccess(result, `stop Apple container ${this.containerId}`);\n }\n }\n\n private async _destroyContainer(): Promise<void> {\n if (!this._deleteOnDestroy) {\n await this._stopContainer();\n return;\n }\n\n const existing = await this._inspectContainer();\n if (!existing) {\n return;\n }\n this._assertMastraOwned(existing);\n\n await this._deleteContainerIgnoringMissing();\n }\n\n async executeCommand(\n command: string,\n args: string[] = [],\n options: ExecuteCommandOptions = {},\n ): Promise<CommandResult> {\n await this.ensureRunning();\n\n const commandTimeout = options.timeout ?? this._timeout;\n const hasCommandTimeout = Number.isFinite(commandTimeout) && commandTimeout > 0;\n const fullCommand = buildShellCommand(command, args);\n const shellCommand = hasCommandTimeout ? buildTimeoutShellCommand(fullCommand, commandTimeout) : fullCommand;\n // Constructor env seeds the sandbox env, so getEnv() covers it plus any setEnv updates\n const env = envFlags({ ...this.getEnv(), ...options.env });\n const cliArgs = [\n 'exec',\n ...env.args,\n '--workdir',\n options.cwd ?? this.workingDirectory,\n this.containerId,\n 'sh',\n '-lc',\n shellCommand,\n ];\n\n const result = await this._runner.run(cliArgs, {\n timeout: hasCommandTimeout ? commandTimeout + APPLE_CONTAINER_CLI_GRACE_TIMEOUT_MS : undefined,\n env: env.env,\n abortSignal: options.abortSignal,\n onStdout: options.onStdout,\n onStderr: options.onStderr,\n maxRetainedBytes: options.maxRetainedBytes,\n });\n\n const timedOut =\n result.exitCode === APPLE_CONTAINER_TIMEOUT_EXIT_CODE && result.stderr.includes(APPLE_CONTAINER_TIMEOUT_MARKER);\n const stderr = timedOut ? stripTimeoutMarker(result.stderr) : result.stderr;\n\n return {\n ...result,\n stderr,\n ...(timedOut && { timedOut: true, killed: true }),\n command: fullCommand,\n args,\n };\n }\n\n async getInfo(): Promise<SandboxInfo> {\n const inspect = this._containerId ? await this._inspectContainer() : undefined;\n const resources = inspect?.configuration?.resources;\n\n return {\n id: this.id,\n name: this.name,\n provider: this.provider,\n status: this.status,\n createdAt: this._createdAt,\n resources: resources\n ? {\n cpuCores: resources.cpus,\n memoryMB: resources.memoryInBytes ? Math.round(resources.memoryInBytes / 1024 / 1024) : undefined,\n }\n : undefined,\n metadata: {\n ...this._serializableConfig(),\n },\n };\n }\n\n getInstructions(opts?: { requestContext?: RequestContext }): string {\n const defaultInstructions = this._buildDefaultInstructions();\n if (typeof this._instructionsOverride === 'string') {\n return this._instructionsOverride;\n }\n if (typeof this._instructionsOverride === 'function') {\n return this._instructionsOverride({ defaultInstructions, requestContext: opts?.requestContext });\n }\n return defaultInstructions;\n }\n\n private _buildDefaultInstructions(): string {\n const parts = [\n `Apple container sandbox: commands run inside a local OCI Linux container from image ${this._image}.`,\n `Working directory: ${this.workingDirectory}.`,\n ];\n\n const volumeCount = Object.keys(this._volumes).length + this._mounts.length;\n if (volumeCount > 0) {\n parts.push(`${volumeCount} host mount(s) are configured.`);\n }\n if (this._timeout > 0) {\n parts.push(`Default command timeout: ${Math.ceil(this._timeout / 1000)}s.`);\n }\n\n return parts.join(' ');\n }\n\n private async _runPlainLifecycle(\n activeStatus: ProviderStatus,\n completeStatus: ProviderStatus,\n operation: () => Promise<void>,\n ): Promise<void> {\n const managedByBaseWrapper = this.status === activeStatus;\n if (!managedByBaseWrapper) {\n this.status = activeStatus;\n }\n\n try {\n await operation();\n if (!managedByBaseWrapper) {\n this.status = completeStatus;\n }\n } catch (error) {\n if (!managedByBaseWrapper) {\n this.status = 'error';\n }\n throw error;\n }\n }\n\n private async _inspectContainer(): Promise<AppleContainerInspectResult | undefined> {\n const result = await this._runCli(['inspect', this.containerId]);\n if (!result.success) {\n if (isMissingContainerMessage(result.stderr)) return undefined;\n this._assertSuccess(result, `inspect Apple container ${this.containerId}`);\n return undefined;\n }\n\n try {\n const parsed = JSON.parse(result.stdout) as AppleContainerInspectResult[] | AppleContainerInspectResult;\n return Array.isArray(parsed) ? parsed[0] : parsed;\n } catch (error) {\n throw new SandboxExecutionError(\n `Failed to parse Apple container inspect output for ${this.containerId}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n 1,\n result.stdout,\n result.stderr,\n );\n }\n }\n\n private _buildRunArgs(envArgs: string[]): string[] {\n const args = ['run', '-d', '--name', this._containerName, '--workdir', this.workingDirectory];\n\n args.push(...envArgs);\n for (const [hostPath, containerPath] of Object.entries(this._volumes)) {\n args.push('--volume', `${hostPath}:${containerPath}`);\n }\n for (const mount of this._mounts) args.push('--mount', mount);\n for (const [key, value] of Object.entries(this._labels)) args.push('--label', `${key}=${value}`);\n for (const port of this._publishedPorts) args.push('--publish', port);\n for (const socket of this._publishedSockets) args.push('--publish-socket', socket);\n for (const cap of this._capAdd) args.push('--cap-add', cap);\n for (const cap of this._capDrop) args.push('--cap-drop', cap);\n for (const tmpfs of this._tmpfs) args.push('--tmpfs', tmpfs);\n for (const dns of this._dns) args.push('--dns', dns);\n for (const domain of this._dnsSearch) args.push('--dns-search', domain);\n\n if (this._network) args.push('--network', this._network);\n if (this._cpus !== undefined) args.push('--cpus', String(this._cpus));\n if (this._memory !== undefined) args.push('--memory', this._memory);\n if (this._platform) args.push('--platform', this._platform);\n if (this._arch) args.push('--arch', this._arch);\n if (this._os) args.push('--os', this._os);\n if (this._rosetta) args.push('--rosetta');\n if (this._readonlyRootfs) args.push('--read-only');\n if (this._ssh) args.push('--ssh');\n if (this._init) args.push('--init');\n if (this._virtualization) args.push('--virtualization');\n if (this._noDns) args.push('--no-dns');\n\n args.push(this._image, ...this._command);\n return args;\n }\n\n private async _waitUntilContainerReady(action: string): Promise<void> {\n const deadline = Date.now() + APPLE_CONTAINER_READY_TIMEOUT_MS;\n let lastResult: AppleContainerCliResult | undefined;\n\n while (Date.now() < deadline) {\n const inspect = await this._inspectContainer();\n if (!inspect) {\n throw new SandboxExecutionError(\n `${action} failed because Apple container ${this.containerId} disappeared`,\n 1,\n '',\n '',\n );\n }\n\n this._assertMastraOwned(inspect);\n this._assertCompatibleConfig(inspect);\n\n if (!isRunning(inspect)) {\n const state = getContainerState(inspect) ?? 'not running';\n throw new SandboxExecutionError(\n `${action} failed because Apple container ${this.containerId} is ${state}`,\n 1,\n '',\n '',\n );\n }\n\n lastResult = await this._runCli(['exec', this.containerId, 'sh', '-lc', 'true'], {\n timeout: APPLE_CONTAINER_READY_EXEC_TIMEOUT_MS,\n });\n if (lastResult.success) return;\n\n if (!isMissingContainerMessage(lastResult.stderr) && !/not running|not yet running/i.test(lastResult.stderr)) {\n break;\n }\n\n await delay(100);\n }\n\n throw new SandboxExecutionError(\n `${action} failed because Apple container ${this.containerId} did not become ready for exec`,\n lastResult?.exitCode ?? 1,\n lastResult?.stdout ?? '',\n lastResult?.stderr ?? '',\n );\n }\n\n private async _deleteContainerIgnoringMissing(): Promise<void> {\n const result = await this._runCli(['delete', '--force', this.containerId]);\n if (!result.success && !isMissingContainerMessage(result.stderr)) {\n this._assertSuccess(result, `delete Apple container ${this.containerId}`);\n }\n }\n\n private _runtimeConfigForHash(): Record<string, unknown> {\n return {\n image: this._image,\n command: this._command,\n env: this._env,\n volumes: this._volumes,\n mounts: this._mounts,\n network: this._network,\n publishedPorts: this._publishedPorts,\n publishedSockets: this._publishedSockets,\n cpus: this._cpus,\n memory: this._memory,\n platform: this._platform,\n arch: this._arch,\n os: this._os,\n rosetta: this._rosetta,\n readonlyRootfs: this._readonlyRootfs,\n ssh: this._ssh,\n init: this._init,\n virtualization: this._virtualization,\n capAdd: this._capAdd,\n capDrop: this._capDrop,\n tmpfs: this._tmpfs,\n dns: this._dns,\n dnsSearch: this._dnsSearch,\n noDns: this._noDns,\n labels: this._userLabels,\n workingDir: this.workingDirectory,\n };\n }\n\n private _serializableConfig(): Record<string, unknown> {\n return compactConfig({\n id: this.id,\n name: this._configuredName,\n image: this._image,\n command: this._command,\n env: this._env,\n volumes: this._volumes,\n mounts: this._mounts,\n network: this._network,\n publishedPorts: this._publishedPorts,\n publishedSockets: this._publishedSockets,\n cpus: this._cpus,\n memory: this._memory,\n platform: this._platform,\n arch: this._arch,\n os: this._os,\n rosetta: this._rosetta,\n readonlyRootfs: this._readonlyRootfs,\n ssh: this._ssh,\n init: this._init,\n virtualization: this._virtualization,\n capAdd: this._capAdd,\n capDrop: this._capDrop,\n tmpfs: this._tmpfs,\n dns: this._dns,\n dnsSearch: this._dnsSearch,\n noDns: this._noDns,\n labels: this._userLabels,\n workingDir: this.workingDirectory,\n timeout: this._timeout,\n deleteOnDestroy: this._deleteOnDestroy,\n });\n }\n\n private _assertSuccess(result: AppleContainerCliResult, action: string): void {\n if (result.success) return;\n throw new SandboxExecutionError(\n `${action} failed with exit code ${result.exitCode}: ${result.stderr}`,\n result.exitCode,\n result.stdout,\n result.stderr,\n );\n }\n\n private _assertMastraOwned(inspect: AppleContainerInspectResult): void {\n if (isMastraOwned(inspect, this.id)) return;\n throw new SandboxExecutionError(\n `Refusing to manage Apple container ${this.containerId} because it is not labeled as Mastra sandbox ${this.id}`,\n 1,\n '',\n '',\n );\n }\n\n private _assertCompatibleConfig(inspect: AppleContainerInspectResult): void {\n const existingHash = inspect.configuration?.labels?.['mastra.sandbox.config-hash'];\n if (!existingHash || existingHash === this._configHash) return;\n throw new SandboxExecutionError(\n `Refusing to manage Apple container ${this.containerId} because its immutable configuration does not match sandbox ${this.id}`,\n 1,\n '',\n '',\n );\n }\n\n private _runCli(args: string[], options: AppleContainerCommandRunnerOptions = {}): Promise<AppleContainerCliResult> {\n return this._runner.run(args, {\n timeout: this._timeout,\n ...options,\n });\n }\n}\n\nexport function runAppleContainerCli(\n binary: string,\n args: string[],\n options: AppleContainerCommandRunnerOptions = {},\n): Promise<AppleContainerCliResult> {\n const handle = new AppleContainerCliProcess(binary, args, options);\n return handle.wait() as Promise<AppleContainerCliResult>;\n}\n\nclass AppleContainerCliProcess extends ProcessHandle {\n readonly pid: string;\n exitCode: number | undefined;\n\n private readonly child: ChildProcessByStdio<null, Readable, Readable>;\n private readonly waitPromise: Promise<AppleContainerCliResult>;\n private readonly startedAt = Date.now();\n private killed = false;\n private timedOut = false;\n private forceKillTimeout: NodeJS.Timeout | undefined;\n\n constructor(binary: string, args: string[], options: AppleContainerCommandRunnerOptions = {}) {\n super({\n maxRetainedBytes: options.maxRetainedBytes,\n onStdout: options.onStdout,\n onStderr: options.onStderr,\n });\n\n this.child = spawn(binary, args, {\n stdio: ['ignore', 'pipe', 'pipe'],\n env: options.env ? { ...process.env, ...options.env } : process.env,\n });\n this.pid = this.child.pid ? String(this.child.pid) : `${binary}:${args.join(' ')}`;\n\n let settled = false;\n const stdoutDecoder = new StringDecoder();\n const stderrDecoder = new StringDecoder();\n let stdoutDecoderEnded = false;\n let stderrDecoderEnded = false;\n let timeout: NodeJS.Timeout | undefined;\n const onAbort = (): void => {\n void this.kill();\n };\n\n const flushStdout = (): void => {\n if (stdoutDecoderEnded) return;\n stdoutDecoderEnded = true;\n const data = stdoutDecoder.end();\n if (data) this.emitStdout(data);\n };\n const flushStderr = (): void => {\n if (stderrDecoderEnded) return;\n stderrDecoderEnded = true;\n const data = stderrDecoder.end();\n if (data) this.emitStderr(data);\n };\n\n const finish = (exitCode: number): AppleContainerCliResult => {\n this.exitCode = exitCode;\n return {\n success: exitCode === 0,\n exitCode,\n stdout: this.stdout,\n stderr: this.stderr,\n executionTimeMs: Date.now() - this.startedAt,\n killed: this.killed,\n timedOut: this.timedOut,\n };\n };\n\n const cleanup = (): void => {\n if (timeout) clearTimeout(timeout);\n if (this.forceKillTimeout) clearTimeout(this.forceKillTimeout);\n options.abortSignal?.removeEventListener('abort', onAbort);\n };\n\n this.waitPromise = new Promise((resolve, reject) => {\n const settle = (callback: () => void): void => {\n if (settled) return;\n settled = true;\n cleanup();\n callback();\n };\n\n this.child.stdout.on('data', (chunk: Buffer) => {\n const data = stdoutDecoder.write(chunk);\n if (data) this.emitStdout(data);\n });\n this.child.stderr.on('data', (chunk: Buffer) => {\n const data = stderrDecoder.write(chunk);\n if (data) this.emitStderr(data);\n });\n\n this.child.stdout.on('end', flushStdout);\n this.child.stderr.on('end', flushStderr);\n\n this.child.on('error', error => {\n settle(() => {\n flushStdout();\n flushStderr();\n reject(\n error instanceof Error && 'code' in error && error.code === 'ENOENT'\n ? new SandboxExecutionError(`Apple container CLI not found: ${binary}`, 127, this.stdout, error.message)\n : error,\n );\n });\n });\n\n this.child.on('close', code => {\n settle(() => {\n flushStdout();\n flushStderr();\n resolve(finish(code ?? (this.killed ? 137 : 1)));\n });\n });\n });\n\n timeout =\n options.timeout && options.timeout > 0\n ? setTimeout(() => {\n this.timedOut = true;\n void this.kill();\n }, options.timeout)\n : undefined;\n if (options.abortSignal) {\n if (options.abortSignal.aborted) {\n void this.kill();\n } else {\n options.abortSignal.addEventListener('abort', onAbort, { once: true });\n }\n }\n }\n\n async wait(): Promise<AppleContainerCliResult> {\n return this.waitPromise;\n }\n\n async kill(): Promise<boolean> {\n if (this.exitCode !== undefined || this.child.killed) return false;\n this.killed = true;\n this.child.kill('SIGTERM');\n this.forceKillTimeout = setTimeout(() => {\n if (this.exitCode === undefined && this.child.exitCode === null && this.child.signalCode === null) {\n this.child.kill('SIGKILL');\n }\n }, 1000);\n this.forceKillTimeout.unref();\n return true;\n }\n\n async sendStdin(): Promise<void> {\n throw new Error('Apple container CLI runner does not support stdin');\n }\n\n async closeStdin(): Promise<void> {\n throw new UnsupportedStdinCloseError('Apple container CLI runner does not support closing stdin');\n }\n}\n\nfunction generateId(): string {\n return `apple-container-sandbox-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;\n}\n\nfunction sanitizeContainerName(name: string): string {\n const sanitized = name.replace(/[^a-zA-Z0-9_.-]/g, '-');\n return /^[a-zA-Z0-9]/.test(sanitized) ? sanitized : `c-${sanitized}`;\n}\n\nfunction buildShellCommand(command: string, args: string[]): string {\n return args.length > 0 ? [command, ...args].map(shellQuote).join(' ') : command;\n}\n\nfunction buildTimeoutShellCommand(command: string, timeoutMs: number): string {\n const timeoutSeconds = formatTimeoutSeconds(timeoutMs);\n const innerScript = [\n `sh -lc ${shellQuote(command)} & child=$!`,\n `trap 'kill -TERM \"$child\" 2>/dev/null; wait \"$child\" 2>/dev/null; exit ${APPLE_CONTAINER_TIMEOUT_EXIT_CODE}' TERM INT`,\n 'wait \"$child\"; code=$?',\n 'trap - TERM INT',\n 'printf \"%s\" \"$code\" > \"$MASTRA_TIMEOUT_RESULT_FILE\"',\n 'exit \"$code\"',\n ].join('; ');\n return [\n 'result_file=\"/tmp/.mastra-apple-container-exit-$$\"',\n 'rm -f \"$result_file\"',\n `MASTRA_TIMEOUT_RESULT_FILE=\"$result_file\" timeout ${timeoutSeconds}s sh -lc ${shellQuote(innerScript)}`,\n 'timeout_code=$?',\n 'if [ -f \"$result_file\" ]; then code=\"$(cat \"$result_file\")\"; rm -f \"$result_file\"; exit \"$code\"; fi',\n 'rm -f \"$result_file\"',\n `case \"$timeout_code\" in 124|137|143) printf '%s\\\\n' ${shellQuote(APPLE_CONTAINER_TIMEOUT_MARKER)} >&2; exit ${APPLE_CONTAINER_TIMEOUT_EXIT_CODE};; *) exit \"$timeout_code\";; esac`,\n ].join('; ');\n}\n\nfunction formatTimeoutSeconds(timeoutMs: number): string {\n return Math.max(timeoutMs / 1000, 0.001)\n .toFixed(3)\n .replace(/0+$/, '')\n .replace(/\\.$/, '');\n}\n\nfunction shellQuote(arg: string): string {\n if (/^[a-zA-Z0-9._\\-\\/=:@]+$/.test(arg)) return arg;\n return `'${arg.replace(/'/g, \"'\\\\''\")}'`;\n}\n\nfunction stripTimeoutMarker(stderr: string): string {\n return stderr\n .split('\\n')\n .filter(line => line.trim() !== APPLE_CONTAINER_TIMEOUT_MARKER)\n .join('\\n')\n .replace(/^\\n+|\\n+$/g, '');\n}\n\nfunction envFlags(env: Record<string, string | undefined>): { args: string[]; env: Record<string, string> } {\n const args: string[] = [];\n const childEnv: Record<string, string> = {};\n for (const [key, value] of Object.entries(env)) {\n if (value === undefined) continue;\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {\n throw new Error(`Invalid environment variable name for Apple container command: ${key}`);\n }\n args.push('--env', key);\n childEnv[key] = value;\n }\n return { args, env: childEnv };\n}\n\nfunction isRunning(inspect: AppleContainerInspectResult): boolean {\n return getContainerState(inspect) === 'running';\n}\n\nfunction getContainerState(inspect: AppleContainerInspectResult): string | undefined {\n return typeof inspect.status === 'string' ? inspect.status : inspect.status?.state;\n}\n\nfunction isMastraOwned(inspect: AppleContainerInspectResult, sandboxId: string): boolean {\n const labels = inspect.configuration?.labels;\n return labels?.['mastra.sandbox'] === 'true' && labels['mastra.sandbox.id'] === sandboxId;\n}\n\nfunction isMissingContainerMessage(message: string): boolean {\n return /not found|no such|does not exist|unknown container/i.test(message);\n}\n\nfunction validateTmpfsPaths(tmpfs: string[]): void {\n for (const entry of tmpfs) {\n if (!entry.startsWith('/') || /[:,]/.test(entry)) {\n throw new Error(\n `Invalid Apple container tmpfs path \"${entry}\". Apple container --tmpfs accepts container paths only, for example \"/tmp\".`,\n );\n }\n }\n}\n\nfunction compactConfig(config: Record<string, unknown>): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(config)) {\n if (value === undefined) continue;\n if (Array.isArray(value) && value.length === 0) continue;\n if (isPlainRecord(value) && Object.keys(value).length === 0) continue;\n result[key] = value;\n }\n return result;\n}\n\nfunction hashConfig(config: Record<string, unknown>): string {\n return createHash('sha256')\n .update(stableStringify(compactConfig(config)))\n .digest('hex')\n .slice(0, 16);\n}\n\nfunction stableStringify(value: unknown): string {\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(',')}]`;\n }\n if (isPlainRecord(value)) {\n return `{${Object.keys(value)\n .sort()\n .map(key => `${JSON.stringify(key)}:${stableStringify(value[key])}`)\n .join(',')}}`;\n }\n return JSON.stringify(value);\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction delay(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n","/**\n * Apple container sandbox provider descriptor for MastraEditor.\n */\n\nimport type { SandboxProvider } from '@mastra/core/editor';\nimport { AppleContainerSandbox } from './sandbox';\nimport type { AppleContainerSandboxOptions } from './sandbox';\n\nexport type AppleContainerProviderConfig = Pick<\n AppleContainerSandboxOptions,\n | 'id'\n | 'image'\n | 'name'\n | 'command'\n | 'env'\n | 'volumes'\n | 'mounts'\n | 'network'\n | 'publishedPorts'\n | 'publishedSockets'\n | 'cpus'\n | 'memory'\n | 'platform'\n | 'arch'\n | 'os'\n | 'rosetta'\n | 'readonlyRootfs'\n | 'ssh'\n | 'init'\n | 'virtualization'\n | 'capAdd'\n | 'capDrop'\n | 'tmpfs'\n | 'dns'\n | 'dnsSearch'\n | 'noDns'\n | 'labels'\n | 'workingDir'\n | 'timeout'\n | 'deleteOnDestroy'\n>;\n\nexport const appleContainerSandboxProvider: SandboxProvider<AppleContainerProviderConfig> = {\n id: 'apple-container',\n name: 'Apple Container Sandbox',\n description: 'Local OCI Linux container sandbox powered by Apple container',\n configSchema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n description: 'Stable sandbox ID used for reconnecting to the same Apple container.',\n },\n image: {\n type: 'string',\n description: 'OCI image to use',\n default: 'node:22-slim',\n },\n name: {\n type: 'string',\n description: 'Apple container name. Defaults to the sandbox ID.',\n },\n command: {\n type: 'array',\n description: 'Container init command. Must keep the container alive for exec-based command execution.',\n items: { type: 'string' },\n },\n env: {\n type: 'object',\n description: 'Environment variables',\n additionalProperties: { type: 'string' },\n },\n volumes: {\n type: 'object',\n description: 'Host-to-container bind mounts (host path -> container path)',\n additionalProperties: { type: 'string' },\n },\n mounts: {\n type: 'array',\n description: 'Raw Apple container --mount specs',\n items: { type: 'string' },\n },\n network: {\n type: 'string',\n description: 'Apple container network attachment spec',\n },\n publishedPorts: {\n type: 'array',\n description: 'Port publish specs',\n items: { type: 'string' },\n },\n publishedSockets: {\n type: 'array',\n description: 'Socket publish specs',\n items: { type: 'string' },\n },\n cpus: {\n anyOf: [{ type: 'number' }, { type: 'string' }],\n description: 'Number of CPUs to allocate',\n },\n memory: {\n type: 'string',\n description: 'Memory allocation, for example 1G',\n },\n platform: {\n type: 'string',\n description: 'OCI platform, for example linux/arm64',\n },\n arch: {\n type: 'string',\n description: 'Image architecture for multi-arch images',\n },\n os: {\n type: 'string',\n description: 'Operating system for multi-platform images',\n },\n rosetta: {\n type: 'boolean',\n description: 'Enable Rosetta in the container',\n default: false,\n },\n readonlyRootfs: {\n type: 'boolean',\n description: 'Mount the container root filesystem as read-only',\n default: false,\n },\n ssh: {\n type: 'boolean',\n description: 'Forward the host SSH agent socket',\n default: false,\n },\n init: {\n type: 'boolean',\n description: \"Enable Apple's init process in the container\",\n default: true,\n },\n virtualization: {\n type: 'boolean',\n description: 'Expose virtualization capabilities to the container',\n default: false,\n },\n capAdd: {\n type: 'array',\n description: 'Linux capabilities to add',\n items: { type: 'string' },\n },\n capDrop: {\n type: 'array',\n description: 'Linux capabilities to drop',\n items: { type: 'string' },\n },\n tmpfs: {\n type: 'array',\n description: 'tmpfs destination paths',\n items: { type: 'string' },\n },\n dns: {\n type: 'array',\n description: 'DNS nameserver IPs',\n items: { type: 'string' },\n },\n dnsSearch: {\n type: 'array',\n description: 'DNS search domains',\n items: { type: 'string' },\n },\n noDns: {\n type: 'boolean',\n description: 'Do not configure DNS in the container',\n default: false,\n },\n labels: {\n type: 'object',\n description: 'Container labels',\n additionalProperties: { type: 'string' },\n },\n workingDir: {\n type: 'string',\n description: 'Working directory inside the container',\n default: '/workspace',\n },\n timeout: {\n type: 'number',\n description: 'Default command timeout in milliseconds',\n default: 300_000,\n },\n deleteOnDestroy: {\n type: 'boolean',\n description: 'Delete the Apple container on destroy',\n default: true,\n },\n },\n },\n createSandbox: config => {\n const {\n id,\n image,\n name,\n command,\n env,\n volumes,\n mounts,\n network,\n publishedPorts,\n publishedSockets,\n cpus,\n memory,\n platform,\n arch,\n os,\n rosetta,\n readonlyRootfs,\n ssh,\n init,\n virtualization,\n capAdd,\n capDrop,\n tmpfs,\n dns,\n dnsSearch,\n noDns,\n labels,\n workingDir,\n timeout,\n deleteOnDestroy,\n } = config;\n\n return new AppleContainerSandbox({\n id,\n image,\n name,\n command,\n env,\n volumes,\n mounts,\n network,\n publishedPorts,\n publishedSockets,\n cpus,\n memory,\n platform,\n arch,\n os,\n rosetta,\n readonlyRootfs,\n ssh,\n init,\n virtualization,\n capAdd,\n capDrop,\n tmpfs,\n dns,\n dnsSearch,\n noDns,\n labels,\n workingDir,\n timeout,\n deleteOnDestroy,\n });\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;AAgCA,MAAM,6BAA6B;AACnC,MAAM,gBAAgB;AACtB,MAAM,kBAAkB,CAAC,SAAS,UAAU;AAC5C,MAAM,sBAAsB;AAC5B,MAAM,uCAAuC;AAC7C,MAAM,mCAAmC;AACzC,MAAM,wCAAwC;AAC9C,MAAM,oCAAoC;AAC1C,MAAM,iCAAiC;AA6BvC,IAAa,qCAAb,MAAuF;CACxD;CAA7B,YAAY,SAA0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AM;IACN,aAAa;IACb,OAAO,EAAE,MAAM,SAAS;GAC1B;GACA,OAAO;IACL,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,QAAQ;IACN,MAAM;IACN,aAAa;IACb,sBAAsB,EAAE,MAAM,SAAS;GACzC;GACA,YAAY;IACV,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,SAAS;IACP,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,iBAAiB;IACf,MAAM;IACN,aAAa;IACb,SAAS;GACX;EACF;CACF;CACA,gBAAe,WAAU;EACvB,MAAM,EACJ,IACA,OACA,MACA,SACA,KACA,SACA,QACA,SACA,gBACA,kBACA,MACA,QACA,UACA,MACA,IACA,SACA,gBACA,KACA,MACA,gBACA,QACA,SACA,OACA,KACA,WACA,OACA,QACA,YACA,SACA,oBACE;EAEJ,OAAO,IAAI,sBAAsB;GAC/B;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAAC;CACH;AACF"}
package/dist/index.js CHANGED
@@ -64,7 +64,6 @@ var AppleContainerSandbox = class AppleContainerSandbox extends MastraSandbox {
64
64
  _userLabels;
65
65
  _labels;
66
66
  _configHash;
67
- _workingDir;
68
67
  _timeout;
69
68
  _deleteOnDestroy;
70
69
  _runner;
@@ -72,6 +71,14 @@ var AppleContainerSandbox = class AppleContainerSandbox extends MastraSandbox {
72
71
  _createdAt;
73
72
  _constructorOptions;
74
73
  _containerId;
74
+ /**
75
+ * The effective container working directory. Narrowed to `string`: the
76
+ * constructor always resolves a value (option, deprecated alias, or the
77
+ * default), so unlike the base getter this never returns `undefined`.
78
+ */
79
+ get workingDirectory() {
80
+ return this._workingDirectory;
81
+ }
75
82
  constructor(options = {}) {
76
83
  super({
77
84
  ...options,
@@ -105,7 +112,7 @@ var AppleContainerSandbox = class AppleContainerSandbox extends MastraSandbox {
105
112
  this._dns = options.dns ?? [];
106
113
  this._dnsSearch = options.dnsSearch ?? [];
107
114
  this._noDns = options.noDns ?? false;
108
- this._workingDir = options.workingDir ?? DEFAULT_WORKING_DIR;
115
+ this.setWorkingDirectory(options.workingDirectory ?? options.workingDir ?? DEFAULT_WORKING_DIR);
109
116
  this._userLabels = options.labels ?? {};
110
117
  this._configHash = hashConfig(this._runtimeConfigForHash());
111
118
  this._labels = {
@@ -211,7 +218,7 @@ var AppleContainerSandbox = class AppleContainerSandbox extends MastraSandbox {
211
218
  "exec",
212
219
  ...env.args,
213
220
  "--workdir",
214
- options.cwd ?? this._workingDir,
221
+ options.cwd ?? this.workingDirectory,
215
222
  this.containerId,
216
223
  "sh",
217
224
  "-lc",
@@ -263,7 +270,7 @@ var AppleContainerSandbox = class AppleContainerSandbox extends MastraSandbox {
263
270
  return defaultInstructions;
264
271
  }
265
272
  _buildDefaultInstructions() {
266
- const parts = [`Apple container sandbox: commands run inside a local OCI Linux container from image ${this._image}.`, `Working directory: ${this._workingDir}.`];
273
+ const parts = [`Apple container sandbox: commands run inside a local OCI Linux container from image ${this._image}.`, `Working directory: ${this.workingDirectory}.`];
267
274
  const volumeCount = Object.keys(this._volumes).length + this._mounts.length;
268
275
  if (volumeCount > 0) parts.push(`${volumeCount} host mount(s) are configured.`);
269
276
  if (this._timeout > 0) parts.push(`Default command timeout: ${Math.ceil(this._timeout / 1e3)}s.`);
@@ -301,7 +308,7 @@ var AppleContainerSandbox = class AppleContainerSandbox extends MastraSandbox {
301
308
  "--name",
302
309
  this._containerName,
303
310
  "--workdir",
304
- this._workingDir
311
+ this.workingDirectory
305
312
  ];
306
313
  args.push(...envArgs);
307
314
  for (const [hostPath, containerPath] of Object.entries(this._volumes)) args.push("--volume", `${hostPath}:${containerPath}`);
@@ -389,7 +396,7 @@ var AppleContainerSandbox = class AppleContainerSandbox extends MastraSandbox {
389
396
  dnsSearch: this._dnsSearch,
390
397
  noDns: this._noDns,
391
398
  labels: this._userLabels,
392
- workingDir: this._workingDir
399
+ workingDir: this.workingDirectory
393
400
  };
394
401
  }
395
402
  _serializableConfig() {
@@ -421,7 +428,7 @@ var AppleContainerSandbox = class AppleContainerSandbox extends MastraSandbox {
421
428
  dnsSearch: this._dnsSearch,
422
429
  noDns: this._noDns,
423
430
  labels: this._userLabels,
424
- workingDir: this._workingDir,
431
+ workingDir: this.workingDirectory,
425
432
  timeout: this._timeout,
426
433
  deleteOnDestroy: this._deleteOnDestroy
427
434
  });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/sandbox/index.ts","../src/provider.ts"],"sourcesContent":["/**\n * Apple container CLI sandbox provider.\n *\n * This provider maps Mastra's WorkspaceSandbox command execution contract to\n * Apple's `container` CLI. It starts a long-lived OCI Linux container and uses\n * `container exec` for commands.\n *\n * @see https://github.com/apple/container\n */\n\nimport { spawn } from 'node:child_process';\nimport type { ChildProcessByStdio } from 'node:child_process';\nimport { createHash } from 'node:crypto';\nimport type { Readable } from 'node:stream';\nimport { StringDecoder } from 'node:string_decoder';\nimport type { RequestContext } from '@mastra/core/di';\nimport type {\n CommandResult,\n ExecuteCommandOptions,\n InstructionsOption,\n MastraSandboxOptions,\n ProviderStatus,\n SandboxCloneOptions,\n SandboxInfo,\n} from '@mastra/core/workspace';\nimport {\n MastraSandbox,\n ProcessHandle,\n UnsupportedStdinCloseError,\n SandboxExecutionError,\n} from '@mastra/core/workspace';\n\nconst DEFAULT_COMMAND_TIMEOUT_MS = 300_000;\nconst DEFAULT_IMAGE = 'node:22-slim';\nconst DEFAULT_COMMAND = ['sleep', 'infinity'];\nconst DEFAULT_WORKING_DIR = '/workspace';\nconst APPLE_CONTAINER_CLI_GRACE_TIMEOUT_MS = 10_000;\nconst APPLE_CONTAINER_READY_TIMEOUT_MS = 10_000;\nconst APPLE_CONTAINER_READY_EXEC_TIMEOUT_MS = 5_000;\nconst APPLE_CONTAINER_TIMEOUT_EXIT_CODE = 124;\nconst APPLE_CONTAINER_TIMEOUT_MARKER = '__MASTRA_APPLE_CONTAINER_TIMEOUT__';\n\nexport interface AppleContainerCliResult {\n success: boolean;\n exitCode: number;\n stdout: string;\n stderr: string;\n executionTimeMs: number;\n timedOut?: boolean;\n killed?: boolean;\n stdoutTruncated?: boolean;\n stderrTruncated?: boolean;\n stdoutDroppedBytes?: number;\n stderrDroppedBytes?: number;\n}\n\nexport interface AppleContainerCommandRunnerOptions {\n timeout?: number;\n env?: Record<string, string>;\n abortSignal?: AbortSignal;\n onStdout?: (data: string) => void;\n onStderr?: (data: string) => void;\n maxRetainedBytes?: number;\n}\n\nexport interface AppleContainerCommandRunner {\n run(args: string[], options?: AppleContainerCommandRunnerOptions): Promise<AppleContainerCliResult>;\n}\n\nexport class DefaultAppleContainerCommandRunner implements AppleContainerCommandRunner {\n constructor(private readonly binary = 'container') {}\n\n run(args: string[], options: AppleContainerCommandRunnerOptions = {}): Promise<AppleContainerCliResult> {\n return runAppleContainerCli(this.binary, args, options);\n }\n}\n\ninterface AppleContainerInspectResult {\n id?: string;\n status?:\n | string\n | {\n state?: string;\n networks?: Array<Record<string, unknown>>;\n };\n configuration?: {\n id?: string;\n hostname?: string;\n labels?: Record<string, string>;\n networks?: Array<Record<string, unknown>>;\n resources?: {\n cpus?: number;\n memoryInBytes?: number;\n };\n mounts?: unknown[];\n };\n}\n\nexport interface AppleContainerSandboxOptions extends Omit<MastraSandboxOptions, 'processes'> {\n /** Unique identifier for this sandbox instance. */\n id?: string;\n /** Apple container name passed to `container run --name`. Defaults to the sandbox id. */\n name?: string;\n /** OCI image to use. */\n image?: string;\n /** Container init command. Must keep the container alive for exec-based command execution. */\n command?: string[];\n /** Environment variables available to the container and every command exec. */\n env?: Record<string, string>;\n /** Host-to-container bind mounts. */\n volumes?: Record<string, string>;\n /** Raw `container run --mount` specs. */\n mounts?: string[];\n /** Apple container network attachment spec. */\n network?: string;\n /** Published port specs passed to `container run --publish`. */\n publishedPorts?: string[];\n /** Published socket specs passed to `container run --publish-socket`. */\n publishedSockets?: string[];\n /** Number of CPUs to allocate. */\n cpus?: number | string;\n /** Memory allocation, for example `1G`. */\n memory?: string;\n /** OCI platform, for example `linux/arm64`. */\n platform?: string;\n /** Image architecture when selecting a multi-arch image. */\n arch?: string;\n /** Operating system when selecting a multi-platform image. */\n os?: string;\n /** Enable Rosetta in the container. */\n rosetta?: boolean;\n /** Mount the container root filesystem as read-only. */\n readonlyRootfs?: boolean;\n /** Forward the host SSH agent socket. */\n ssh?: boolean;\n /** Enable Apple's init process in the container. */\n init?: boolean;\n /** Expose virtualization capabilities to the container. */\n virtualization?: boolean;\n /** Linux capabilities to add. */\n capAdd?: string[];\n /** Linux capabilities to drop. */\n capDrop?: string[];\n /** tmpfs destination paths. */\n tmpfs?: string[];\n /** DNS nameserver IPs. */\n dns?: string[];\n /** DNS search domains. */\n dnsSearch?: string[];\n /** Do not configure DNS in the container. */\n noDns?: boolean;\n /** Container labels. Mastra labels are always added. */\n labels?: Record<string, string>;\n /** Working directory inside the container. */\n workingDir?: string;\n /** Default command timeout in milliseconds. */\n timeout?: number;\n /** Delete the container on destroy. Defaults to true. */\n deleteOnDestroy?: boolean;\n /** Path or name for the Apple container CLI. */\n containerBinary?: string;\n /** Custom command runner, primarily for tests. */\n runner?: AppleContainerCommandRunner;\n /** Custom instructions for getInstructions(). String replaces the default; function receives it. */\n instructions?: InstructionsOption;\n}\n\nexport class AppleContainerSandbox extends MastraSandbox {\n readonly id: string;\n readonly name = 'AppleContainerSandbox';\n readonly provider = 'apple-container';\n status: ProviderStatus = 'pending';\n\n private readonly _containerName: string;\n private readonly _configuredName?: string;\n private readonly _image: string;\n private readonly _command: string[];\n private readonly _env: Record<string, string>;\n private readonly _volumes: Record<string, string>;\n private readonly _mounts: string[];\n private readonly _network?: string;\n private readonly _publishedPorts: string[];\n private readonly _publishedSockets: string[];\n private readonly _cpus?: number | string;\n private readonly _memory?: string;\n private readonly _platform?: string;\n private readonly _arch?: string;\n private readonly _os?: string;\n private readonly _rosetta: boolean;\n private readonly _readonlyRootfs: boolean;\n private readonly _ssh: boolean;\n private readonly _init: boolean;\n private readonly _virtualization: boolean;\n private readonly _capAdd: string[];\n private readonly _capDrop: string[];\n private readonly _tmpfs: string[];\n private readonly _dns: string[];\n private readonly _dnsSearch: string[];\n private readonly _noDns: boolean;\n private readonly _userLabels: Record<string, string>;\n private readonly _labels: Record<string, string>;\n private readonly _configHash: string;\n private readonly _workingDir: string;\n private readonly _timeout: number;\n private readonly _deleteOnDestroy: boolean;\n private readonly _runner: AppleContainerCommandRunner;\n private readonly _instructionsOverride?: InstructionsOption;\n private readonly _createdAt: Date;\n private readonly _constructorOptions: AppleContainerSandboxOptions;\n\n private _containerId?: string;\n\n constructor(options: AppleContainerSandboxOptions = {}) {\n super({\n ...options,\n name: 'AppleContainerSandbox',\n });\n\n this.id = options.id ?? generateId();\n this._configuredName = options.name;\n this._containerName = sanitizeContainerName(options.name ?? this.id);\n this._image = options.image ?? DEFAULT_IMAGE;\n this._command = options.command ?? DEFAULT_COMMAND;\n this._env = options.env ?? {};\n this._volumes = options.volumes ?? {};\n this._mounts = options.mounts ?? [];\n this._network = options.network;\n this._publishedPorts = options.publishedPorts ?? [];\n this._publishedSockets = options.publishedSockets ?? [];\n this._cpus = options.cpus;\n this._memory = options.memory;\n this._platform = options.platform;\n this._arch = options.arch;\n this._os = options.os;\n this._rosetta = options.rosetta ?? false;\n this._readonlyRootfs = options.readonlyRootfs ?? false;\n this._ssh = options.ssh ?? false;\n this._init = options.init ?? true;\n this._virtualization = options.virtualization ?? false;\n this._capAdd = options.capAdd ?? [];\n this._capDrop = options.capDrop ?? [];\n this._tmpfs = options.tmpfs ?? [];\n validateTmpfsPaths(this._tmpfs);\n this._dns = options.dns ?? [];\n this._dnsSearch = options.dnsSearch ?? [];\n this._noDns = options.noDns ?? false;\n this._workingDir = options.workingDir ?? DEFAULT_WORKING_DIR;\n this._userLabels = options.labels ?? {};\n this._configHash = hashConfig(this._runtimeConfigForHash());\n this._labels = {\n ...this._userLabels,\n 'mastra.sandbox': 'true',\n 'mastra.sandbox.id': this.id,\n 'mastra.sandbox.config-hash': this._configHash,\n };\n this._timeout = options.timeout ?? DEFAULT_COMMAND_TIMEOUT_MS;\n this._deleteOnDestroy = options.deleteOnDestroy ?? true;\n this._runner = options.runner ?? new DefaultAppleContainerCommandRunner(options.containerBinary);\n this._instructionsOverride = options.instructions;\n this._createdAt = new Date();\n this._constructorOptions = { ...options };\n }\n\n /**\n * Construct a sibling `AppleContainerSandbox` that inherits this sandbox's\n * configuration (image, resources, network, security options, labels) with\n * per-instance overrides.\n *\n * Performs no I/O — the sandbox clone provisions (or reconnects to an\n * existing container labelled with the same logical `id`) on its own\n * `start()`. Use it when one configured sandbox acts as the template for a\n * fleet of independent sandboxes (e.g. one per project).\n *\n * `options.idleTimeoutMinutes` is ignored (Apple containers have no\n * provider-side idle teardown; `timeout` here is a command timeout), and\n * `options.sandboxId` is ignored because reconnection is by logical `id`.\n */\n clone(options: SandboxCloneOptions = {}): AppleContainerSandbox {\n const { id: _id, name: _name, ...base } = this._constructorOptions;\n return new AppleContainerSandbox({\n ...base,\n ...(options.id !== undefined && { id: options.id }),\n ...(options.env !== undefined && { env: options.env }),\n });\n }\n\n get containerId(): string {\n return this._containerId ?? this._containerName;\n }\n\n async start(): Promise<void> {\n await this._runPlainLifecycle('starting', 'running', () => this._startContainer());\n }\n\n async stop(): Promise<void> {\n await this._runPlainLifecycle('stopping', 'stopped', () => this._stopContainer());\n }\n\n async destroy(): Promise<void> {\n await this._runPlainLifecycle('destroying', 'destroyed', () => this._destroyContainer());\n }\n\n private async _startContainer(): Promise<void> {\n const existing = await this._inspectContainer();\n if (existing) {\n this._assertMastraOwned(existing);\n this._assertCompatibleConfig(existing);\n this._containerId = existing.configuration?.id ?? this._containerName;\n if (!isRunning(existing)) {\n const result = await this._runCli(['start', this.containerId]);\n this._assertSuccess(result, `start Apple container ${this.containerId}`);\n await this._waitUntilContainerReady(`start Apple container ${this.containerId}`);\n }\n return;\n }\n\n const env = envFlags(this._env);\n const result = await this._runCli(this._buildRunArgs(env.args), { env: env.env });\n this._assertSuccess(result, `create Apple container ${this._containerName}`);\n this._containerId = this._containerName;\n try {\n await this._waitUntilContainerReady(`create Apple container ${this._containerName}`);\n } catch (error) {\n if (this._deleteOnDestroy) {\n await this._deleteContainerIgnoringMissing();\n }\n throw error;\n }\n }\n\n private async _stopContainer(): Promise<void> {\n const existing = await this._inspectContainer();\n if (!existing) {\n return;\n }\n this._assertMastraOwned(existing);\n if (!isRunning(existing)) {\n return;\n }\n\n const result = await this._runCli(['stop', this.containerId]);\n if (!result.success && !isMissingContainerMessage(result.stderr)) {\n this._assertSuccess(result, `stop Apple container ${this.containerId}`);\n }\n }\n\n private async _destroyContainer(): Promise<void> {\n if (!this._deleteOnDestroy) {\n await this._stopContainer();\n return;\n }\n\n const existing = await this._inspectContainer();\n if (!existing) {\n return;\n }\n this._assertMastraOwned(existing);\n\n await this._deleteContainerIgnoringMissing();\n }\n\n async executeCommand(\n command: string,\n args: string[] = [],\n options: ExecuteCommandOptions = {},\n ): Promise<CommandResult> {\n await this.ensureRunning();\n\n const commandTimeout = options.timeout ?? this._timeout;\n const hasCommandTimeout = Number.isFinite(commandTimeout) && commandTimeout > 0;\n const fullCommand = buildShellCommand(command, args);\n const shellCommand = hasCommandTimeout ? buildTimeoutShellCommand(fullCommand, commandTimeout) : fullCommand;\n // Constructor env seeds the sandbox env, so getEnv() covers it plus any setEnv updates\n const env = envFlags({ ...this.getEnv(), ...options.env });\n const cliArgs = [\n 'exec',\n ...env.args,\n '--workdir',\n options.cwd ?? this._workingDir,\n this.containerId,\n 'sh',\n '-lc',\n shellCommand,\n ];\n\n const result = await this._runner.run(cliArgs, {\n timeout: hasCommandTimeout ? commandTimeout + APPLE_CONTAINER_CLI_GRACE_TIMEOUT_MS : undefined,\n env: env.env,\n abortSignal: options.abortSignal,\n onStdout: options.onStdout,\n onStderr: options.onStderr,\n maxRetainedBytes: options.maxRetainedBytes,\n });\n\n const timedOut =\n result.exitCode === APPLE_CONTAINER_TIMEOUT_EXIT_CODE && result.stderr.includes(APPLE_CONTAINER_TIMEOUT_MARKER);\n const stderr = timedOut ? stripTimeoutMarker(result.stderr) : result.stderr;\n\n return {\n ...result,\n stderr,\n ...(timedOut && { timedOut: true, killed: true }),\n command: fullCommand,\n args,\n };\n }\n\n async getInfo(): Promise<SandboxInfo> {\n const inspect = this._containerId ? await this._inspectContainer() : undefined;\n const resources = inspect?.configuration?.resources;\n\n return {\n id: this.id,\n name: this.name,\n provider: this.provider,\n status: this.status,\n createdAt: this._createdAt,\n resources: resources\n ? {\n cpuCores: resources.cpus,\n memoryMB: resources.memoryInBytes ? Math.round(resources.memoryInBytes / 1024 / 1024) : undefined,\n }\n : undefined,\n metadata: {\n ...this._serializableConfig(),\n },\n };\n }\n\n getInstructions(opts?: { requestContext?: RequestContext }): string {\n const defaultInstructions = this._buildDefaultInstructions();\n if (typeof this._instructionsOverride === 'string') {\n return this._instructionsOverride;\n }\n if (typeof this._instructionsOverride === 'function') {\n return this._instructionsOverride({ defaultInstructions, requestContext: opts?.requestContext });\n }\n return defaultInstructions;\n }\n\n private _buildDefaultInstructions(): string {\n const parts = [\n `Apple container sandbox: commands run inside a local OCI Linux container from image ${this._image}.`,\n `Working directory: ${this._workingDir}.`,\n ];\n\n const volumeCount = Object.keys(this._volumes).length + this._mounts.length;\n if (volumeCount > 0) {\n parts.push(`${volumeCount} host mount(s) are configured.`);\n }\n if (this._timeout > 0) {\n parts.push(`Default command timeout: ${Math.ceil(this._timeout / 1000)}s.`);\n }\n\n return parts.join(' ');\n }\n\n private async _runPlainLifecycle(\n activeStatus: ProviderStatus,\n completeStatus: ProviderStatus,\n operation: () => Promise<void>,\n ): Promise<void> {\n const managedByBaseWrapper = this.status === activeStatus;\n if (!managedByBaseWrapper) {\n this.status = activeStatus;\n }\n\n try {\n await operation();\n if (!managedByBaseWrapper) {\n this.status = completeStatus;\n }\n } catch (error) {\n if (!managedByBaseWrapper) {\n this.status = 'error';\n }\n throw error;\n }\n }\n\n private async _inspectContainer(): Promise<AppleContainerInspectResult | undefined> {\n const result = await this._runCli(['inspect', this.containerId]);\n if (!result.success) {\n if (isMissingContainerMessage(result.stderr)) return undefined;\n this._assertSuccess(result, `inspect Apple container ${this.containerId}`);\n return undefined;\n }\n\n try {\n const parsed = JSON.parse(result.stdout) as AppleContainerInspectResult[] | AppleContainerInspectResult;\n return Array.isArray(parsed) ? parsed[0] : parsed;\n } catch (error) {\n throw new SandboxExecutionError(\n `Failed to parse Apple container inspect output for ${this.containerId}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n 1,\n result.stdout,\n result.stderr,\n );\n }\n }\n\n private _buildRunArgs(envArgs: string[]): string[] {\n const args = ['run', '-d', '--name', this._containerName, '--workdir', this._workingDir];\n\n args.push(...envArgs);\n for (const [hostPath, containerPath] of Object.entries(this._volumes)) {\n args.push('--volume', `${hostPath}:${containerPath}`);\n }\n for (const mount of this._mounts) args.push('--mount', mount);\n for (const [key, value] of Object.entries(this._labels)) args.push('--label', `${key}=${value}`);\n for (const port of this._publishedPorts) args.push('--publish', port);\n for (const socket of this._publishedSockets) args.push('--publish-socket', socket);\n for (const cap of this._capAdd) args.push('--cap-add', cap);\n for (const cap of this._capDrop) args.push('--cap-drop', cap);\n for (const tmpfs of this._tmpfs) args.push('--tmpfs', tmpfs);\n for (const dns of this._dns) args.push('--dns', dns);\n for (const domain of this._dnsSearch) args.push('--dns-search', domain);\n\n if (this._network) args.push('--network', this._network);\n if (this._cpus !== undefined) args.push('--cpus', String(this._cpus));\n if (this._memory !== undefined) args.push('--memory', this._memory);\n if (this._platform) args.push('--platform', this._platform);\n if (this._arch) args.push('--arch', this._arch);\n if (this._os) args.push('--os', this._os);\n if (this._rosetta) args.push('--rosetta');\n if (this._readonlyRootfs) args.push('--read-only');\n if (this._ssh) args.push('--ssh');\n if (this._init) args.push('--init');\n if (this._virtualization) args.push('--virtualization');\n if (this._noDns) args.push('--no-dns');\n\n args.push(this._image, ...this._command);\n return args;\n }\n\n private async _waitUntilContainerReady(action: string): Promise<void> {\n const deadline = Date.now() + APPLE_CONTAINER_READY_TIMEOUT_MS;\n let lastResult: AppleContainerCliResult | undefined;\n\n while (Date.now() < deadline) {\n const inspect = await this._inspectContainer();\n if (!inspect) {\n throw new SandboxExecutionError(\n `${action} failed because Apple container ${this.containerId} disappeared`,\n 1,\n '',\n '',\n );\n }\n\n this._assertMastraOwned(inspect);\n this._assertCompatibleConfig(inspect);\n\n if (!isRunning(inspect)) {\n const state = getContainerState(inspect) ?? 'not running';\n throw new SandboxExecutionError(\n `${action} failed because Apple container ${this.containerId} is ${state}`,\n 1,\n '',\n '',\n );\n }\n\n lastResult = await this._runCli(['exec', this.containerId, 'sh', '-lc', 'true'], {\n timeout: APPLE_CONTAINER_READY_EXEC_TIMEOUT_MS,\n });\n if (lastResult.success) return;\n\n if (!isMissingContainerMessage(lastResult.stderr) && !/not running|not yet running/i.test(lastResult.stderr)) {\n break;\n }\n\n await delay(100);\n }\n\n throw new SandboxExecutionError(\n `${action} failed because Apple container ${this.containerId} did not become ready for exec`,\n lastResult?.exitCode ?? 1,\n lastResult?.stdout ?? '',\n lastResult?.stderr ?? '',\n );\n }\n\n private async _deleteContainerIgnoringMissing(): Promise<void> {\n const result = await this._runCli(['delete', '--force', this.containerId]);\n if (!result.success && !isMissingContainerMessage(result.stderr)) {\n this._assertSuccess(result, `delete Apple container ${this.containerId}`);\n }\n }\n\n private _runtimeConfigForHash(): Record<string, unknown> {\n return {\n image: this._image,\n command: this._command,\n env: this._env,\n volumes: this._volumes,\n mounts: this._mounts,\n network: this._network,\n publishedPorts: this._publishedPorts,\n publishedSockets: this._publishedSockets,\n cpus: this._cpus,\n memory: this._memory,\n platform: this._platform,\n arch: this._arch,\n os: this._os,\n rosetta: this._rosetta,\n readonlyRootfs: this._readonlyRootfs,\n ssh: this._ssh,\n init: this._init,\n virtualization: this._virtualization,\n capAdd: this._capAdd,\n capDrop: this._capDrop,\n tmpfs: this._tmpfs,\n dns: this._dns,\n dnsSearch: this._dnsSearch,\n noDns: this._noDns,\n labels: this._userLabels,\n workingDir: this._workingDir,\n };\n }\n\n private _serializableConfig(): Record<string, unknown> {\n return compactConfig({\n id: this.id,\n name: this._configuredName,\n image: this._image,\n command: this._command,\n env: this._env,\n volumes: this._volumes,\n mounts: this._mounts,\n network: this._network,\n publishedPorts: this._publishedPorts,\n publishedSockets: this._publishedSockets,\n cpus: this._cpus,\n memory: this._memory,\n platform: this._platform,\n arch: this._arch,\n os: this._os,\n rosetta: this._rosetta,\n readonlyRootfs: this._readonlyRootfs,\n ssh: this._ssh,\n init: this._init,\n virtualization: this._virtualization,\n capAdd: this._capAdd,\n capDrop: this._capDrop,\n tmpfs: this._tmpfs,\n dns: this._dns,\n dnsSearch: this._dnsSearch,\n noDns: this._noDns,\n labels: this._userLabels,\n workingDir: this._workingDir,\n timeout: this._timeout,\n deleteOnDestroy: this._deleteOnDestroy,\n });\n }\n\n private _assertSuccess(result: AppleContainerCliResult, action: string): void {\n if (result.success) return;\n throw new SandboxExecutionError(\n `${action} failed with exit code ${result.exitCode}: ${result.stderr}`,\n result.exitCode,\n result.stdout,\n result.stderr,\n );\n }\n\n private _assertMastraOwned(inspect: AppleContainerInspectResult): void {\n if (isMastraOwned(inspect, this.id)) return;\n throw new SandboxExecutionError(\n `Refusing to manage Apple container ${this.containerId} because it is not labeled as Mastra sandbox ${this.id}`,\n 1,\n '',\n '',\n );\n }\n\n private _assertCompatibleConfig(inspect: AppleContainerInspectResult): void {\n const existingHash = inspect.configuration?.labels?.['mastra.sandbox.config-hash'];\n if (!existingHash || existingHash === this._configHash) return;\n throw new SandboxExecutionError(\n `Refusing to manage Apple container ${this.containerId} because its immutable configuration does not match sandbox ${this.id}`,\n 1,\n '',\n '',\n );\n }\n\n private _runCli(args: string[], options: AppleContainerCommandRunnerOptions = {}): Promise<AppleContainerCliResult> {\n return this._runner.run(args, {\n timeout: this._timeout,\n ...options,\n });\n }\n}\n\nexport function runAppleContainerCli(\n binary: string,\n args: string[],\n options: AppleContainerCommandRunnerOptions = {},\n): Promise<AppleContainerCliResult> {\n const handle = new AppleContainerCliProcess(binary, args, options);\n return handle.wait() as Promise<AppleContainerCliResult>;\n}\n\nclass AppleContainerCliProcess extends ProcessHandle {\n readonly pid: string;\n exitCode: number | undefined;\n\n private readonly child: ChildProcessByStdio<null, Readable, Readable>;\n private readonly waitPromise: Promise<AppleContainerCliResult>;\n private readonly startedAt = Date.now();\n private killed = false;\n private timedOut = false;\n private forceKillTimeout: NodeJS.Timeout | undefined;\n\n constructor(binary: string, args: string[], options: AppleContainerCommandRunnerOptions = {}) {\n super({\n maxRetainedBytes: options.maxRetainedBytes,\n onStdout: options.onStdout,\n onStderr: options.onStderr,\n });\n\n this.child = spawn(binary, args, {\n stdio: ['ignore', 'pipe', 'pipe'],\n env: options.env ? { ...process.env, ...options.env } : process.env,\n });\n this.pid = this.child.pid ? String(this.child.pid) : `${binary}:${args.join(' ')}`;\n\n let settled = false;\n const stdoutDecoder = new StringDecoder();\n const stderrDecoder = new StringDecoder();\n let stdoutDecoderEnded = false;\n let stderrDecoderEnded = false;\n let timeout: NodeJS.Timeout | undefined;\n const onAbort = (): void => {\n void this.kill();\n };\n\n const flushStdout = (): void => {\n if (stdoutDecoderEnded) return;\n stdoutDecoderEnded = true;\n const data = stdoutDecoder.end();\n if (data) this.emitStdout(data);\n };\n const flushStderr = (): void => {\n if (stderrDecoderEnded) return;\n stderrDecoderEnded = true;\n const data = stderrDecoder.end();\n if (data) this.emitStderr(data);\n };\n\n const finish = (exitCode: number): AppleContainerCliResult => {\n this.exitCode = exitCode;\n return {\n success: exitCode === 0,\n exitCode,\n stdout: this.stdout,\n stderr: this.stderr,\n executionTimeMs: Date.now() - this.startedAt,\n killed: this.killed,\n timedOut: this.timedOut,\n };\n };\n\n const cleanup = (): void => {\n if (timeout) clearTimeout(timeout);\n if (this.forceKillTimeout) clearTimeout(this.forceKillTimeout);\n options.abortSignal?.removeEventListener('abort', onAbort);\n };\n\n this.waitPromise = new Promise((resolve, reject) => {\n const settle = (callback: () => void): void => {\n if (settled) return;\n settled = true;\n cleanup();\n callback();\n };\n\n this.child.stdout.on('data', (chunk: Buffer) => {\n const data = stdoutDecoder.write(chunk);\n if (data) this.emitStdout(data);\n });\n this.child.stderr.on('data', (chunk: Buffer) => {\n const data = stderrDecoder.write(chunk);\n if (data) this.emitStderr(data);\n });\n\n this.child.stdout.on('end', flushStdout);\n this.child.stderr.on('end', flushStderr);\n\n this.child.on('error', error => {\n settle(() => {\n flushStdout();\n flushStderr();\n reject(\n error instanceof Error && 'code' in error && error.code === 'ENOENT'\n ? new SandboxExecutionError(`Apple container CLI not found: ${binary}`, 127, this.stdout, error.message)\n : error,\n );\n });\n });\n\n this.child.on('close', code => {\n settle(() => {\n flushStdout();\n flushStderr();\n resolve(finish(code ?? (this.killed ? 137 : 1)));\n });\n });\n });\n\n timeout =\n options.timeout && options.timeout > 0\n ? setTimeout(() => {\n this.timedOut = true;\n void this.kill();\n }, options.timeout)\n : undefined;\n if (options.abortSignal) {\n if (options.abortSignal.aborted) {\n void this.kill();\n } else {\n options.abortSignal.addEventListener('abort', onAbort, { once: true });\n }\n }\n }\n\n async wait(): Promise<AppleContainerCliResult> {\n return this.waitPromise;\n }\n\n async kill(): Promise<boolean> {\n if (this.exitCode !== undefined || this.child.killed) return false;\n this.killed = true;\n this.child.kill('SIGTERM');\n this.forceKillTimeout = setTimeout(() => {\n if (this.exitCode === undefined && this.child.exitCode === null && this.child.signalCode === null) {\n this.child.kill('SIGKILL');\n }\n }, 1000);\n this.forceKillTimeout.unref();\n return true;\n }\n\n async sendStdin(): Promise<void> {\n throw new Error('Apple container CLI runner does not support stdin');\n }\n\n async closeStdin(): Promise<void> {\n throw new UnsupportedStdinCloseError('Apple container CLI runner does not support closing stdin');\n }\n}\n\nfunction generateId(): string {\n return `apple-container-sandbox-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;\n}\n\nfunction sanitizeContainerName(name: string): string {\n const sanitized = name.replace(/[^a-zA-Z0-9_.-]/g, '-');\n return /^[a-zA-Z0-9]/.test(sanitized) ? sanitized : `c-${sanitized}`;\n}\n\nfunction buildShellCommand(command: string, args: string[]): string {\n return args.length > 0 ? [command, ...args].map(shellQuote).join(' ') : command;\n}\n\nfunction buildTimeoutShellCommand(command: string, timeoutMs: number): string {\n const timeoutSeconds = formatTimeoutSeconds(timeoutMs);\n const innerScript = [\n `sh -lc ${shellQuote(command)} & child=$!`,\n `trap 'kill -TERM \"$child\" 2>/dev/null; wait \"$child\" 2>/dev/null; exit ${APPLE_CONTAINER_TIMEOUT_EXIT_CODE}' TERM INT`,\n 'wait \"$child\"; code=$?',\n 'trap - TERM INT',\n 'printf \"%s\" \"$code\" > \"$MASTRA_TIMEOUT_RESULT_FILE\"',\n 'exit \"$code\"',\n ].join('; ');\n return [\n 'result_file=\"/tmp/.mastra-apple-container-exit-$$\"',\n 'rm -f \"$result_file\"',\n `MASTRA_TIMEOUT_RESULT_FILE=\"$result_file\" timeout ${timeoutSeconds}s sh -lc ${shellQuote(innerScript)}`,\n 'timeout_code=$?',\n 'if [ -f \"$result_file\" ]; then code=\"$(cat \"$result_file\")\"; rm -f \"$result_file\"; exit \"$code\"; fi',\n 'rm -f \"$result_file\"',\n `case \"$timeout_code\" in 124|137|143) printf '%s\\\\n' ${shellQuote(APPLE_CONTAINER_TIMEOUT_MARKER)} >&2; exit ${APPLE_CONTAINER_TIMEOUT_EXIT_CODE};; *) exit \"$timeout_code\";; esac`,\n ].join('; ');\n}\n\nfunction formatTimeoutSeconds(timeoutMs: number): string {\n return Math.max(timeoutMs / 1000, 0.001)\n .toFixed(3)\n .replace(/0+$/, '')\n .replace(/\\.$/, '');\n}\n\nfunction shellQuote(arg: string): string {\n if (/^[a-zA-Z0-9._\\-\\/=:@]+$/.test(arg)) return arg;\n return `'${arg.replace(/'/g, \"'\\\\''\")}'`;\n}\n\nfunction stripTimeoutMarker(stderr: string): string {\n return stderr\n .split('\\n')\n .filter(line => line.trim() !== APPLE_CONTAINER_TIMEOUT_MARKER)\n .join('\\n')\n .replace(/^\\n+|\\n+$/g, '');\n}\n\nfunction envFlags(env: Record<string, string | undefined>): { args: string[]; env: Record<string, string> } {\n const args: string[] = [];\n const childEnv: Record<string, string> = {};\n for (const [key, value] of Object.entries(env)) {\n if (value === undefined) continue;\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {\n throw new Error(`Invalid environment variable name for Apple container command: ${key}`);\n }\n args.push('--env', key);\n childEnv[key] = value;\n }\n return { args, env: childEnv };\n}\n\nfunction isRunning(inspect: AppleContainerInspectResult): boolean {\n return getContainerState(inspect) === 'running';\n}\n\nfunction getContainerState(inspect: AppleContainerInspectResult): string | undefined {\n return typeof inspect.status === 'string' ? inspect.status : inspect.status?.state;\n}\n\nfunction isMastraOwned(inspect: AppleContainerInspectResult, sandboxId: string): boolean {\n const labels = inspect.configuration?.labels;\n return labels?.['mastra.sandbox'] === 'true' && labels['mastra.sandbox.id'] === sandboxId;\n}\n\nfunction isMissingContainerMessage(message: string): boolean {\n return /not found|no such|does not exist|unknown container/i.test(message);\n}\n\nfunction validateTmpfsPaths(tmpfs: string[]): void {\n for (const entry of tmpfs) {\n if (!entry.startsWith('/') || /[:,]/.test(entry)) {\n throw new Error(\n `Invalid Apple container tmpfs path \"${entry}\". Apple container --tmpfs accepts container paths only, for example \"/tmp\".`,\n );\n }\n }\n}\n\nfunction compactConfig(config: Record<string, unknown>): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(config)) {\n if (value === undefined) continue;\n if (Array.isArray(value) && value.length === 0) continue;\n if (isPlainRecord(value) && Object.keys(value).length === 0) continue;\n result[key] = value;\n }\n return result;\n}\n\nfunction hashConfig(config: Record<string, unknown>): string {\n return createHash('sha256')\n .update(stableStringify(compactConfig(config)))\n .digest('hex')\n .slice(0, 16);\n}\n\nfunction stableStringify(value: unknown): string {\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(',')}]`;\n }\n if (isPlainRecord(value)) {\n return `{${Object.keys(value)\n .sort()\n .map(key => `${JSON.stringify(key)}:${stableStringify(value[key])}`)\n .join(',')}}`;\n }\n return JSON.stringify(value);\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction delay(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n","/**\n * Apple container sandbox provider descriptor for MastraEditor.\n */\n\nimport type { SandboxProvider } from '@mastra/core/editor';\nimport { AppleContainerSandbox } from './sandbox';\nimport type { AppleContainerSandboxOptions } from './sandbox';\n\nexport type AppleContainerProviderConfig = Pick<\n AppleContainerSandboxOptions,\n | 'id'\n | 'image'\n | 'name'\n | 'command'\n | 'env'\n | 'volumes'\n | 'mounts'\n | 'network'\n | 'publishedPorts'\n | 'publishedSockets'\n | 'cpus'\n | 'memory'\n | 'platform'\n | 'arch'\n | 'os'\n | 'rosetta'\n | 'readonlyRootfs'\n | 'ssh'\n | 'init'\n | 'virtualization'\n | 'capAdd'\n | 'capDrop'\n | 'tmpfs'\n | 'dns'\n | 'dnsSearch'\n | 'noDns'\n | 'labels'\n | 'workingDir'\n | 'timeout'\n | 'deleteOnDestroy'\n>;\n\nexport const appleContainerSandboxProvider: SandboxProvider<AppleContainerProviderConfig> = {\n id: 'apple-container',\n name: 'Apple Container Sandbox',\n description: 'Local OCI Linux container sandbox powered by Apple container',\n configSchema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n description: 'Stable sandbox ID used for reconnecting to the same Apple container.',\n },\n image: {\n type: 'string',\n description: 'OCI image to use',\n default: 'node:22-slim',\n },\n name: {\n type: 'string',\n description: 'Apple container name. Defaults to the sandbox ID.',\n },\n command: {\n type: 'array',\n description: 'Container init command. Must keep the container alive for exec-based command execution.',\n items: { type: 'string' },\n },\n env: {\n type: 'object',\n description: 'Environment variables',\n additionalProperties: { type: 'string' },\n },\n volumes: {\n type: 'object',\n description: 'Host-to-container bind mounts (host path -> container path)',\n additionalProperties: { type: 'string' },\n },\n mounts: {\n type: 'array',\n description: 'Raw Apple container --mount specs',\n items: { type: 'string' },\n },\n network: {\n type: 'string',\n description: 'Apple container network attachment spec',\n },\n publishedPorts: {\n type: 'array',\n description: 'Port publish specs',\n items: { type: 'string' },\n },\n publishedSockets: {\n type: 'array',\n description: 'Socket publish specs',\n items: { type: 'string' },\n },\n cpus: {\n anyOf: [{ type: 'number' }, { type: 'string' }],\n description: 'Number of CPUs to allocate',\n },\n memory: {\n type: 'string',\n description: 'Memory allocation, for example 1G',\n },\n platform: {\n type: 'string',\n description: 'OCI platform, for example linux/arm64',\n },\n arch: {\n type: 'string',\n description: 'Image architecture for multi-arch images',\n },\n os: {\n type: 'string',\n description: 'Operating system for multi-platform images',\n },\n rosetta: {\n type: 'boolean',\n description: 'Enable Rosetta in the container',\n default: false,\n },\n readonlyRootfs: {\n type: 'boolean',\n description: 'Mount the container root filesystem as read-only',\n default: false,\n },\n ssh: {\n type: 'boolean',\n description: 'Forward the host SSH agent socket',\n default: false,\n },\n init: {\n type: 'boolean',\n description: \"Enable Apple's init process in the container\",\n default: true,\n },\n virtualization: {\n type: 'boolean',\n description: 'Expose virtualization capabilities to the container',\n default: false,\n },\n capAdd: {\n type: 'array',\n description: 'Linux capabilities to add',\n items: { type: 'string' },\n },\n capDrop: {\n type: 'array',\n description: 'Linux capabilities to drop',\n items: { type: 'string' },\n },\n tmpfs: {\n type: 'array',\n description: 'tmpfs destination paths',\n items: { type: 'string' },\n },\n dns: {\n type: 'array',\n description: 'DNS nameserver IPs',\n items: { type: 'string' },\n },\n dnsSearch: {\n type: 'array',\n description: 'DNS search domains',\n items: { type: 'string' },\n },\n noDns: {\n type: 'boolean',\n description: 'Do not configure DNS in the container',\n default: false,\n },\n labels: {\n type: 'object',\n description: 'Container labels',\n additionalProperties: { type: 'string' },\n },\n workingDir: {\n type: 'string',\n description: 'Working directory inside the container',\n default: '/workspace',\n },\n timeout: {\n type: 'number',\n description: 'Default command timeout in milliseconds',\n default: 300_000,\n },\n deleteOnDestroy: {\n type: 'boolean',\n description: 'Delete the Apple container on destroy',\n default: true,\n },\n },\n },\n createSandbox: config => {\n const {\n id,\n image,\n name,\n command,\n env,\n volumes,\n mounts,\n network,\n publishedPorts,\n publishedSockets,\n cpus,\n memory,\n platform,\n arch,\n os,\n rosetta,\n readonlyRootfs,\n ssh,\n init,\n virtualization,\n capAdd,\n capDrop,\n tmpfs,\n dns,\n dnsSearch,\n noDns,\n labels,\n workingDir,\n timeout,\n deleteOnDestroy,\n } = config;\n\n return new AppleContainerSandbox({\n id,\n image,\n name,\n command,\n env,\n volumes,\n mounts,\n network,\n publishedPorts,\n publishedSockets,\n cpus,\n memory,\n platform,\n arch,\n os,\n rosetta,\n readonlyRootfs,\n ssh,\n init,\n virtualization,\n capAdd,\n capDrop,\n tmpfs,\n dns,\n dnsSearch,\n noDns,\n labels,\n workingDir,\n timeout,\n deleteOnDestroy,\n });\n },\n};\n"],"mappings":";;;;;;;;;;;;;;AAgCA,MAAM,6BAA6B;AACnC,MAAM,gBAAgB;AACtB,MAAM,kBAAkB,CAAC,SAAS,UAAU;AAC5C,MAAM,sBAAsB;AAC5B,MAAM,uCAAuC;AAC7C,MAAM,mCAAmC;AACzC,MAAM,wCAAwC;AAC9C,MAAM,oCAAoC;AAC1C,MAAM,iCAAiC;AA6BvC,IAAa,qCAAb,MAAuF;CACxD;CAA7B,YAAY,SAA0B,aAAa;EAAtB,KAAA,SAAA;CAAuB;CAEpD,IAAI,MAAgB,UAA8C,CAAC,GAAqC;EACtG,OAAO,qBAAqB,KAAK,QAAQ,MAAM,OAAO;CACxD;AACF;AA4FA,IAAa,wBAAb,MAAa,8BAA8B,cAAc;CACvD;CACA,OAAgB;CAChB,WAAoB;CACpB,SAAyB;CAEzB;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,OAAO,CAAC,EAAE,MAAM,SAAS,GAAG,EAAE,MAAM,SAAS,CAAC;IAC9C,aAAa;GACf;GACA,QAAQ;IACN,MAAM;IACN,aAAa;GACf;GACA,UAAU;IACR,MAAM;IACN,aAAa;GACf;GACA,MAAM;IACJ,MAAM;IACN,aAAa;GACf;GACA,IAAI;IACF,MAAM;IACN,aAAa;GACf;GACA,SAAS;IACP,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,gBAAgB;IACd,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,KAAK;IACH,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,MAAM;IACJ,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,gBAAgB;IACd,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,QAAQ;IACN,MAAM;IACN,aAAa;IACb,OAAO,EAAE,MAAM,SAAS;GAC1B;GACA,SAAS;IACP,MAAM;IACN,aAAa;IACb,OAAO,EAAE,MAAM,SAAS;GAC1B;GACA,OAAO;IACL,MAAM;IACN,aAAa;IACb,OAAO,EAAE,MAAM,SAAS;GAC1B;GACA,KAAK;IACH,MAAM;IACN,aAAa;IACb,OAAO,EAAE,MAAM,SAAS;GAC1B;GACA,WAAW;IACT,MAAM;IACN,aAAa;IACb,OAAO,EAAE,MAAM,SAAS;GAC1B;GACA,OAAO;IACL,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,QAAQ;IACN,MAAM;IACN,aAAa;IACb,sBAAsB,EAAE,MAAM,SAAS;GACzC;GACA,YAAY;IACV,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,SAAS;IACP,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,iBAAiB;IACf,MAAM;IACN,aAAa;IACb,SAAS;GACX;EACF;CACF;CACA,gBAAe,WAAU;EACvB,MAAM,EACJ,IACA,OACA,MACA,SACA,KACA,SACA,QACA,SACA,gBACA,kBACA,MACA,QACA,UACA,MACA,IACA,SACA,gBACA,KACA,MACA,gBACA,QACA,SACA,OACA,KACA,WACA,OACA,QACA,YACA,SACA,oBACE;EAEJ,OAAO,IAAI,sBAAsB;GAC/B;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/sandbox/index.ts","../src/provider.ts"],"sourcesContent":["/**\n * Apple container CLI sandbox provider.\n *\n * This provider maps Mastra's WorkspaceSandbox command execution contract to\n * Apple's `container` CLI. It starts a long-lived OCI Linux container and uses\n * `container exec` for commands.\n *\n * @see https://github.com/apple/container\n */\n\nimport { spawn } from 'node:child_process';\nimport type { ChildProcessByStdio } from 'node:child_process';\nimport { createHash } from 'node:crypto';\nimport type { Readable } from 'node:stream';\nimport { StringDecoder } from 'node:string_decoder';\nimport type { RequestContext } from '@mastra/core/di';\nimport type {\n CommandResult,\n ExecuteCommandOptions,\n InstructionsOption,\n MastraSandboxOptions,\n ProviderStatus,\n SandboxCloneOptions,\n SandboxInfo,\n} from '@mastra/core/workspace';\nimport {\n MastraSandbox,\n ProcessHandle,\n UnsupportedStdinCloseError,\n SandboxExecutionError,\n} from '@mastra/core/workspace';\n\nconst DEFAULT_COMMAND_TIMEOUT_MS = 300_000;\nconst DEFAULT_IMAGE = 'node:22-slim';\nconst DEFAULT_COMMAND = ['sleep', 'infinity'];\nconst DEFAULT_WORKING_DIR = '/workspace';\nconst APPLE_CONTAINER_CLI_GRACE_TIMEOUT_MS = 10_000;\nconst APPLE_CONTAINER_READY_TIMEOUT_MS = 10_000;\nconst APPLE_CONTAINER_READY_EXEC_TIMEOUT_MS = 5_000;\nconst APPLE_CONTAINER_TIMEOUT_EXIT_CODE = 124;\nconst APPLE_CONTAINER_TIMEOUT_MARKER = '__MASTRA_APPLE_CONTAINER_TIMEOUT__';\n\nexport interface AppleContainerCliResult {\n success: boolean;\n exitCode: number;\n stdout: string;\n stderr: string;\n executionTimeMs: number;\n timedOut?: boolean;\n killed?: boolean;\n stdoutTruncated?: boolean;\n stderrTruncated?: boolean;\n stdoutDroppedBytes?: number;\n stderrDroppedBytes?: number;\n}\n\nexport interface AppleContainerCommandRunnerOptions {\n timeout?: number;\n env?: Record<string, string>;\n abortSignal?: AbortSignal;\n onStdout?: (data: string) => void;\n onStderr?: (data: string) => void;\n maxRetainedBytes?: number;\n}\n\nexport interface AppleContainerCommandRunner {\n run(args: string[], options?: AppleContainerCommandRunnerOptions): Promise<AppleContainerCliResult>;\n}\n\nexport class DefaultAppleContainerCommandRunner implements AppleContainerCommandRunner {\n constructor(private readonly binary = 'container') {}\n\n run(args: string[], options: AppleContainerCommandRunnerOptions = {}): Promise<AppleContainerCliResult> {\n return runAppleContainerCli(this.binary, args, options);\n }\n}\n\ninterface AppleContainerInspectResult {\n id?: string;\n status?:\n | string\n | {\n state?: string;\n networks?: Array<Record<string, unknown>>;\n };\n configuration?: {\n id?: string;\n hostname?: string;\n labels?: Record<string, string>;\n networks?: Array<Record<string, unknown>>;\n resources?: {\n cpus?: number;\n memoryInBytes?: number;\n };\n mounts?: unknown[];\n };\n}\n\nexport interface AppleContainerSandboxOptions extends Omit<MastraSandboxOptions, 'processes'> {\n /** Unique identifier for this sandbox instance. */\n id?: string;\n /** Apple container name passed to `container run --name`. Defaults to the sandbox id. */\n name?: string;\n /** OCI image to use. */\n image?: string;\n /** Container init command. Must keep the container alive for exec-based command execution. */\n command?: string[];\n /** Environment variables available to the container and every command exec. */\n env?: Record<string, string>;\n /** Host-to-container bind mounts. */\n volumes?: Record<string, string>;\n /** Raw `container run --mount` specs. */\n mounts?: string[];\n /** Apple container network attachment spec. */\n network?: string;\n /** Published port specs passed to `container run --publish`. */\n publishedPorts?: string[];\n /** Published socket specs passed to `container run --publish-socket`. */\n publishedSockets?: string[];\n /** Number of CPUs to allocate. */\n cpus?: number | string;\n /** Memory allocation, for example `1G`. */\n memory?: string;\n /** OCI platform, for example `linux/arm64`. */\n platform?: string;\n /** Image architecture when selecting a multi-arch image. */\n arch?: string;\n /** Operating system when selecting a multi-platform image. */\n os?: string;\n /** Enable Rosetta in the container. */\n rosetta?: boolean;\n /** Mount the container root filesystem as read-only. */\n readonlyRootfs?: boolean;\n /** Forward the host SSH agent socket. */\n ssh?: boolean;\n /** Enable Apple's init process in the container. */\n init?: boolean;\n /** Expose virtualization capabilities to the container. */\n virtualization?: boolean;\n /** Linux capabilities to add. */\n capAdd?: string[];\n /** Linux capabilities to drop. */\n capDrop?: string[];\n /** tmpfs destination paths. */\n tmpfs?: string[];\n /** DNS nameserver IPs. */\n dns?: string[];\n /** DNS search domains. */\n dnsSearch?: string[];\n /** Do not configure DNS in the container. */\n noDns?: boolean;\n /** Container labels. Mastra labels are always added. */\n labels?: Record<string, string>;\n /** Working directory inside the container.\n * @deprecated Use `workingDirectory` (the base sandbox option) instead.\n * When both are set, `workingDirectory` wins.\n */\n workingDir?: string;\n /** Default command timeout in milliseconds. */\n timeout?: number;\n /** Delete the container on destroy. Defaults to true. */\n deleteOnDestroy?: boolean;\n /** Path or name for the Apple container CLI. */\n containerBinary?: string;\n /** Custom command runner, primarily for tests. */\n runner?: AppleContainerCommandRunner;\n /** Custom instructions for getInstructions(). String replaces the default; function receives it. */\n instructions?: InstructionsOption;\n}\n\nexport class AppleContainerSandbox extends MastraSandbox {\n readonly id: string;\n readonly name = 'AppleContainerSandbox';\n readonly provider = 'apple-container';\n status: ProviderStatus = 'pending';\n\n private readonly _containerName: string;\n private readonly _configuredName?: string;\n private readonly _image: string;\n private readonly _command: string[];\n private readonly _env: Record<string, string>;\n private readonly _volumes: Record<string, string>;\n private readonly _mounts: string[];\n private readonly _network?: string;\n private readonly _publishedPorts: string[];\n private readonly _publishedSockets: string[];\n private readonly _cpus?: number | string;\n private readonly _memory?: string;\n private readonly _platform?: string;\n private readonly _arch?: string;\n private readonly _os?: string;\n private readonly _rosetta: boolean;\n private readonly _readonlyRootfs: boolean;\n private readonly _ssh: boolean;\n private readonly _init: boolean;\n private readonly _virtualization: boolean;\n private readonly _capAdd: string[];\n private readonly _capDrop: string[];\n private readonly _tmpfs: string[];\n private readonly _dns: string[];\n private readonly _dnsSearch: string[];\n private readonly _noDns: boolean;\n private readonly _userLabels: Record<string, string>;\n private readonly _labels: Record<string, string>;\n private readonly _configHash: string;\n private readonly _timeout: number;\n private readonly _deleteOnDestroy: boolean;\n private readonly _runner: AppleContainerCommandRunner;\n private readonly _instructionsOverride?: InstructionsOption;\n private readonly _createdAt: Date;\n private readonly _constructorOptions: AppleContainerSandboxOptions;\n\n private _containerId?: string;\n\n /**\n * The effective container working directory. Narrowed to `string`: the\n * constructor always resolves a value (option, deprecated alias, or the\n * default), so unlike the base getter this never returns `undefined`.\n */\n override get workingDirectory(): string {\n return this._workingDirectory!;\n }\n\n constructor(options: AppleContainerSandboxOptions = {}) {\n super({\n ...options,\n name: 'AppleContainerSandbox',\n });\n\n this.id = options.id ?? generateId();\n this._configuredName = options.name;\n this._containerName = sanitizeContainerName(options.name ?? this.id);\n this._image = options.image ?? DEFAULT_IMAGE;\n this._command = options.command ?? DEFAULT_COMMAND;\n this._env = options.env ?? {};\n this._volumes = options.volumes ?? {};\n this._mounts = options.mounts ?? [];\n this._network = options.network;\n this._publishedPorts = options.publishedPorts ?? [];\n this._publishedSockets = options.publishedSockets ?? [];\n this._cpus = options.cpus;\n this._memory = options.memory;\n this._platform = options.platform;\n this._arch = options.arch;\n this._os = options.os;\n this._rosetta = options.rosetta ?? false;\n this._readonlyRootfs = options.readonlyRootfs ?? false;\n this._ssh = options.ssh ?? false;\n this._init = options.init ?? true;\n this._virtualization = options.virtualization ?? false;\n this._capAdd = options.capAdd ?? [];\n this._capDrop = options.capDrop ?? [];\n this._tmpfs = options.tmpfs ?? [];\n validateTmpfsPaths(this._tmpfs);\n this._dns = options.dns ?? [];\n this._dnsSearch = options.dnsSearch ?? [];\n this._noDns = options.noDns ?? false;\n this.setWorkingDirectory(options.workingDirectory ?? options.workingDir ?? DEFAULT_WORKING_DIR);\n this._userLabels = options.labels ?? {};\n this._configHash = hashConfig(this._runtimeConfigForHash());\n this._labels = {\n ...this._userLabels,\n 'mastra.sandbox': 'true',\n 'mastra.sandbox.id': this.id,\n 'mastra.sandbox.config-hash': this._configHash,\n };\n this._timeout = options.timeout ?? DEFAULT_COMMAND_TIMEOUT_MS;\n this._deleteOnDestroy = options.deleteOnDestroy ?? true;\n this._runner = options.runner ?? new DefaultAppleContainerCommandRunner(options.containerBinary);\n this._instructionsOverride = options.instructions;\n this._createdAt = new Date();\n this._constructorOptions = { ...options };\n }\n\n /**\n * Construct a sibling `AppleContainerSandbox` that inherits this sandbox's\n * configuration (image, resources, network, security options, labels) with\n * per-instance overrides.\n *\n * Performs no I/O — the sandbox clone provisions (or reconnects to an\n * existing container labelled with the same logical `id`) on its own\n * `start()`. Use it when one configured sandbox acts as the template for a\n * fleet of independent sandboxes (e.g. one per project).\n *\n * `options.idleTimeoutMinutes` is ignored (Apple containers have no\n * provider-side idle teardown; `timeout` here is a command timeout), and\n * `options.sandboxId` is ignored because reconnection is by logical `id`.\n */\n clone(options: SandboxCloneOptions = {}): AppleContainerSandbox {\n const { id: _id, name: _name, ...base } = this._constructorOptions;\n return new AppleContainerSandbox({\n ...base,\n ...(options.id !== undefined && { id: options.id }),\n ...(options.env !== undefined && { env: options.env }),\n });\n }\n\n get containerId(): string {\n return this._containerId ?? this._containerName;\n }\n\n async start(): Promise<void> {\n await this._runPlainLifecycle('starting', 'running', () => this._startContainer());\n }\n\n async stop(): Promise<void> {\n await this._runPlainLifecycle('stopping', 'stopped', () => this._stopContainer());\n }\n\n async destroy(): Promise<void> {\n await this._runPlainLifecycle('destroying', 'destroyed', () => this._destroyContainer());\n }\n\n private async _startContainer(): Promise<void> {\n const existing = await this._inspectContainer();\n if (existing) {\n this._assertMastraOwned(existing);\n this._assertCompatibleConfig(existing);\n this._containerId = existing.configuration?.id ?? this._containerName;\n if (!isRunning(existing)) {\n const result = await this._runCli(['start', this.containerId]);\n this._assertSuccess(result, `start Apple container ${this.containerId}`);\n await this._waitUntilContainerReady(`start Apple container ${this.containerId}`);\n }\n return;\n }\n\n const env = envFlags(this._env);\n const result = await this._runCli(this._buildRunArgs(env.args), { env: env.env });\n this._assertSuccess(result, `create Apple container ${this._containerName}`);\n this._containerId = this._containerName;\n try {\n await this._waitUntilContainerReady(`create Apple container ${this._containerName}`);\n } catch (error) {\n if (this._deleteOnDestroy) {\n await this._deleteContainerIgnoringMissing();\n }\n throw error;\n }\n }\n\n private async _stopContainer(): Promise<void> {\n const existing = await this._inspectContainer();\n if (!existing) {\n return;\n }\n this._assertMastraOwned(existing);\n if (!isRunning(existing)) {\n return;\n }\n\n const result = await this._runCli(['stop', this.containerId]);\n if (!result.success && !isMissingContainerMessage(result.stderr)) {\n this._assertSuccess(result, `stop Apple container ${this.containerId}`);\n }\n }\n\n private async _destroyContainer(): Promise<void> {\n if (!this._deleteOnDestroy) {\n await this._stopContainer();\n return;\n }\n\n const existing = await this._inspectContainer();\n if (!existing) {\n return;\n }\n this._assertMastraOwned(existing);\n\n await this._deleteContainerIgnoringMissing();\n }\n\n async executeCommand(\n command: string,\n args: string[] = [],\n options: ExecuteCommandOptions = {},\n ): Promise<CommandResult> {\n await this.ensureRunning();\n\n const commandTimeout = options.timeout ?? this._timeout;\n const hasCommandTimeout = Number.isFinite(commandTimeout) && commandTimeout > 0;\n const fullCommand = buildShellCommand(command, args);\n const shellCommand = hasCommandTimeout ? buildTimeoutShellCommand(fullCommand, commandTimeout) : fullCommand;\n // Constructor env seeds the sandbox env, so getEnv() covers it plus any setEnv updates\n const env = envFlags({ ...this.getEnv(), ...options.env });\n const cliArgs = [\n 'exec',\n ...env.args,\n '--workdir',\n options.cwd ?? this.workingDirectory,\n this.containerId,\n 'sh',\n '-lc',\n shellCommand,\n ];\n\n const result = await this._runner.run(cliArgs, {\n timeout: hasCommandTimeout ? commandTimeout + APPLE_CONTAINER_CLI_GRACE_TIMEOUT_MS : undefined,\n env: env.env,\n abortSignal: options.abortSignal,\n onStdout: options.onStdout,\n onStderr: options.onStderr,\n maxRetainedBytes: options.maxRetainedBytes,\n });\n\n const timedOut =\n result.exitCode === APPLE_CONTAINER_TIMEOUT_EXIT_CODE && result.stderr.includes(APPLE_CONTAINER_TIMEOUT_MARKER);\n const stderr = timedOut ? stripTimeoutMarker(result.stderr) : result.stderr;\n\n return {\n ...result,\n stderr,\n ...(timedOut && { timedOut: true, killed: true }),\n command: fullCommand,\n args,\n };\n }\n\n async getInfo(): Promise<SandboxInfo> {\n const inspect = this._containerId ? await this._inspectContainer() : undefined;\n const resources = inspect?.configuration?.resources;\n\n return {\n id: this.id,\n name: this.name,\n provider: this.provider,\n status: this.status,\n createdAt: this._createdAt,\n resources: resources\n ? {\n cpuCores: resources.cpus,\n memoryMB: resources.memoryInBytes ? Math.round(resources.memoryInBytes / 1024 / 1024) : undefined,\n }\n : undefined,\n metadata: {\n ...this._serializableConfig(),\n },\n };\n }\n\n getInstructions(opts?: { requestContext?: RequestContext }): string {\n const defaultInstructions = this._buildDefaultInstructions();\n if (typeof this._instructionsOverride === 'string') {\n return this._instructionsOverride;\n }\n if (typeof this._instructionsOverride === 'function') {\n return this._instructionsOverride({ defaultInstructions, requestContext: opts?.requestContext });\n }\n return defaultInstructions;\n }\n\n private _buildDefaultInstructions(): string {\n const parts = [\n `Apple container sandbox: commands run inside a local OCI Linux container from image ${this._image}.`,\n `Working directory: ${this.workingDirectory}.`,\n ];\n\n const volumeCount = Object.keys(this._volumes).length + this._mounts.length;\n if (volumeCount > 0) {\n parts.push(`${volumeCount} host mount(s) are configured.`);\n }\n if (this._timeout > 0) {\n parts.push(`Default command timeout: ${Math.ceil(this._timeout / 1000)}s.`);\n }\n\n return parts.join(' ');\n }\n\n private async _runPlainLifecycle(\n activeStatus: ProviderStatus,\n completeStatus: ProviderStatus,\n operation: () => Promise<void>,\n ): Promise<void> {\n const managedByBaseWrapper = this.status === activeStatus;\n if (!managedByBaseWrapper) {\n this.status = activeStatus;\n }\n\n try {\n await operation();\n if (!managedByBaseWrapper) {\n this.status = completeStatus;\n }\n } catch (error) {\n if (!managedByBaseWrapper) {\n this.status = 'error';\n }\n throw error;\n }\n }\n\n private async _inspectContainer(): Promise<AppleContainerInspectResult | undefined> {\n const result = await this._runCli(['inspect', this.containerId]);\n if (!result.success) {\n if (isMissingContainerMessage(result.stderr)) return undefined;\n this._assertSuccess(result, `inspect Apple container ${this.containerId}`);\n return undefined;\n }\n\n try {\n const parsed = JSON.parse(result.stdout) as AppleContainerInspectResult[] | AppleContainerInspectResult;\n return Array.isArray(parsed) ? parsed[0] : parsed;\n } catch (error) {\n throw new SandboxExecutionError(\n `Failed to parse Apple container inspect output for ${this.containerId}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n 1,\n result.stdout,\n result.stderr,\n );\n }\n }\n\n private _buildRunArgs(envArgs: string[]): string[] {\n const args = ['run', '-d', '--name', this._containerName, '--workdir', this.workingDirectory];\n\n args.push(...envArgs);\n for (const [hostPath, containerPath] of Object.entries(this._volumes)) {\n args.push('--volume', `${hostPath}:${containerPath}`);\n }\n for (const mount of this._mounts) args.push('--mount', mount);\n for (const [key, value] of Object.entries(this._labels)) args.push('--label', `${key}=${value}`);\n for (const port of this._publishedPorts) args.push('--publish', port);\n for (const socket of this._publishedSockets) args.push('--publish-socket', socket);\n for (const cap of this._capAdd) args.push('--cap-add', cap);\n for (const cap of this._capDrop) args.push('--cap-drop', cap);\n for (const tmpfs of this._tmpfs) args.push('--tmpfs', tmpfs);\n for (const dns of this._dns) args.push('--dns', dns);\n for (const domain of this._dnsSearch) args.push('--dns-search', domain);\n\n if (this._network) args.push('--network', this._network);\n if (this._cpus !== undefined) args.push('--cpus', String(this._cpus));\n if (this._memory !== undefined) args.push('--memory', this._memory);\n if (this._platform) args.push('--platform', this._platform);\n if (this._arch) args.push('--arch', this._arch);\n if (this._os) args.push('--os', this._os);\n if (this._rosetta) args.push('--rosetta');\n if (this._readonlyRootfs) args.push('--read-only');\n if (this._ssh) args.push('--ssh');\n if (this._init) args.push('--init');\n if (this._virtualization) args.push('--virtualization');\n if (this._noDns) args.push('--no-dns');\n\n args.push(this._image, ...this._command);\n return args;\n }\n\n private async _waitUntilContainerReady(action: string): Promise<void> {\n const deadline = Date.now() + APPLE_CONTAINER_READY_TIMEOUT_MS;\n let lastResult: AppleContainerCliResult | undefined;\n\n while (Date.now() < deadline) {\n const inspect = await this._inspectContainer();\n if (!inspect) {\n throw new SandboxExecutionError(\n `${action} failed because Apple container ${this.containerId} disappeared`,\n 1,\n '',\n '',\n );\n }\n\n this._assertMastraOwned(inspect);\n this._assertCompatibleConfig(inspect);\n\n if (!isRunning(inspect)) {\n const state = getContainerState(inspect) ?? 'not running';\n throw new SandboxExecutionError(\n `${action} failed because Apple container ${this.containerId} is ${state}`,\n 1,\n '',\n '',\n );\n }\n\n lastResult = await this._runCli(['exec', this.containerId, 'sh', '-lc', 'true'], {\n timeout: APPLE_CONTAINER_READY_EXEC_TIMEOUT_MS,\n });\n if (lastResult.success) return;\n\n if (!isMissingContainerMessage(lastResult.stderr) && !/not running|not yet running/i.test(lastResult.stderr)) {\n break;\n }\n\n await delay(100);\n }\n\n throw new SandboxExecutionError(\n `${action} failed because Apple container ${this.containerId} did not become ready for exec`,\n lastResult?.exitCode ?? 1,\n lastResult?.stdout ?? '',\n lastResult?.stderr ?? '',\n );\n }\n\n private async _deleteContainerIgnoringMissing(): Promise<void> {\n const result = await this._runCli(['delete', '--force', this.containerId]);\n if (!result.success && !isMissingContainerMessage(result.stderr)) {\n this._assertSuccess(result, `delete Apple container ${this.containerId}`);\n }\n }\n\n private _runtimeConfigForHash(): Record<string, unknown> {\n return {\n image: this._image,\n command: this._command,\n env: this._env,\n volumes: this._volumes,\n mounts: this._mounts,\n network: this._network,\n publishedPorts: this._publishedPorts,\n publishedSockets: this._publishedSockets,\n cpus: this._cpus,\n memory: this._memory,\n platform: this._platform,\n arch: this._arch,\n os: this._os,\n rosetta: this._rosetta,\n readonlyRootfs: this._readonlyRootfs,\n ssh: this._ssh,\n init: this._init,\n virtualization: this._virtualization,\n capAdd: this._capAdd,\n capDrop: this._capDrop,\n tmpfs: this._tmpfs,\n dns: this._dns,\n dnsSearch: this._dnsSearch,\n noDns: this._noDns,\n labels: this._userLabels,\n workingDir: this.workingDirectory,\n };\n }\n\n private _serializableConfig(): Record<string, unknown> {\n return compactConfig({\n id: this.id,\n name: this._configuredName,\n image: this._image,\n command: this._command,\n env: this._env,\n volumes: this._volumes,\n mounts: this._mounts,\n network: this._network,\n publishedPorts: this._publishedPorts,\n publishedSockets: this._publishedSockets,\n cpus: this._cpus,\n memory: this._memory,\n platform: this._platform,\n arch: this._arch,\n os: this._os,\n rosetta: this._rosetta,\n readonlyRootfs: this._readonlyRootfs,\n ssh: this._ssh,\n init: this._init,\n virtualization: this._virtualization,\n capAdd: this._capAdd,\n capDrop: this._capDrop,\n tmpfs: this._tmpfs,\n dns: this._dns,\n dnsSearch: this._dnsSearch,\n noDns: this._noDns,\n labels: this._userLabels,\n workingDir: this.workingDirectory,\n timeout: this._timeout,\n deleteOnDestroy: this._deleteOnDestroy,\n });\n }\n\n private _assertSuccess(result: AppleContainerCliResult, action: string): void {\n if (result.success) return;\n throw new SandboxExecutionError(\n `${action} failed with exit code ${result.exitCode}: ${result.stderr}`,\n result.exitCode,\n result.stdout,\n result.stderr,\n );\n }\n\n private _assertMastraOwned(inspect: AppleContainerInspectResult): void {\n if (isMastraOwned(inspect, this.id)) return;\n throw new SandboxExecutionError(\n `Refusing to manage Apple container ${this.containerId} because it is not labeled as Mastra sandbox ${this.id}`,\n 1,\n '',\n '',\n );\n }\n\n private _assertCompatibleConfig(inspect: AppleContainerInspectResult): void {\n const existingHash = inspect.configuration?.labels?.['mastra.sandbox.config-hash'];\n if (!existingHash || existingHash === this._configHash) return;\n throw new SandboxExecutionError(\n `Refusing to manage Apple container ${this.containerId} because its immutable configuration does not match sandbox ${this.id}`,\n 1,\n '',\n '',\n );\n }\n\n private _runCli(args: string[], options: AppleContainerCommandRunnerOptions = {}): Promise<AppleContainerCliResult> {\n return this._runner.run(args, {\n timeout: this._timeout,\n ...options,\n });\n }\n}\n\nexport function runAppleContainerCli(\n binary: string,\n args: string[],\n options: AppleContainerCommandRunnerOptions = {},\n): Promise<AppleContainerCliResult> {\n const handle = new AppleContainerCliProcess(binary, args, options);\n return handle.wait() as Promise<AppleContainerCliResult>;\n}\n\nclass AppleContainerCliProcess extends ProcessHandle {\n readonly pid: string;\n exitCode: number | undefined;\n\n private readonly child: ChildProcessByStdio<null, Readable, Readable>;\n private readonly waitPromise: Promise<AppleContainerCliResult>;\n private readonly startedAt = Date.now();\n private killed = false;\n private timedOut = false;\n private forceKillTimeout: NodeJS.Timeout | undefined;\n\n constructor(binary: string, args: string[], options: AppleContainerCommandRunnerOptions = {}) {\n super({\n maxRetainedBytes: options.maxRetainedBytes,\n onStdout: options.onStdout,\n onStderr: options.onStderr,\n });\n\n this.child = spawn(binary, args, {\n stdio: ['ignore', 'pipe', 'pipe'],\n env: options.env ? { ...process.env, ...options.env } : process.env,\n });\n this.pid = this.child.pid ? String(this.child.pid) : `${binary}:${args.join(' ')}`;\n\n let settled = false;\n const stdoutDecoder = new StringDecoder();\n const stderrDecoder = new StringDecoder();\n let stdoutDecoderEnded = false;\n let stderrDecoderEnded = false;\n let timeout: NodeJS.Timeout | undefined;\n const onAbort = (): void => {\n void this.kill();\n };\n\n const flushStdout = (): void => {\n if (stdoutDecoderEnded) return;\n stdoutDecoderEnded = true;\n const data = stdoutDecoder.end();\n if (data) this.emitStdout(data);\n };\n const flushStderr = (): void => {\n if (stderrDecoderEnded) return;\n stderrDecoderEnded = true;\n const data = stderrDecoder.end();\n if (data) this.emitStderr(data);\n };\n\n const finish = (exitCode: number): AppleContainerCliResult => {\n this.exitCode = exitCode;\n return {\n success: exitCode === 0,\n exitCode,\n stdout: this.stdout,\n stderr: this.stderr,\n executionTimeMs: Date.now() - this.startedAt,\n killed: this.killed,\n timedOut: this.timedOut,\n };\n };\n\n const cleanup = (): void => {\n if (timeout) clearTimeout(timeout);\n if (this.forceKillTimeout) clearTimeout(this.forceKillTimeout);\n options.abortSignal?.removeEventListener('abort', onAbort);\n };\n\n this.waitPromise = new Promise((resolve, reject) => {\n const settle = (callback: () => void): void => {\n if (settled) return;\n settled = true;\n cleanup();\n callback();\n };\n\n this.child.stdout.on('data', (chunk: Buffer) => {\n const data = stdoutDecoder.write(chunk);\n if (data) this.emitStdout(data);\n });\n this.child.stderr.on('data', (chunk: Buffer) => {\n const data = stderrDecoder.write(chunk);\n if (data) this.emitStderr(data);\n });\n\n this.child.stdout.on('end', flushStdout);\n this.child.stderr.on('end', flushStderr);\n\n this.child.on('error', error => {\n settle(() => {\n flushStdout();\n flushStderr();\n reject(\n error instanceof Error && 'code' in error && error.code === 'ENOENT'\n ? new SandboxExecutionError(`Apple container CLI not found: ${binary}`, 127, this.stdout, error.message)\n : error,\n );\n });\n });\n\n this.child.on('close', code => {\n settle(() => {\n flushStdout();\n flushStderr();\n resolve(finish(code ?? (this.killed ? 137 : 1)));\n });\n });\n });\n\n timeout =\n options.timeout && options.timeout > 0\n ? setTimeout(() => {\n this.timedOut = true;\n void this.kill();\n }, options.timeout)\n : undefined;\n if (options.abortSignal) {\n if (options.abortSignal.aborted) {\n void this.kill();\n } else {\n options.abortSignal.addEventListener('abort', onAbort, { once: true });\n }\n }\n }\n\n async wait(): Promise<AppleContainerCliResult> {\n return this.waitPromise;\n }\n\n async kill(): Promise<boolean> {\n if (this.exitCode !== undefined || this.child.killed) return false;\n this.killed = true;\n this.child.kill('SIGTERM');\n this.forceKillTimeout = setTimeout(() => {\n if (this.exitCode === undefined && this.child.exitCode === null && this.child.signalCode === null) {\n this.child.kill('SIGKILL');\n }\n }, 1000);\n this.forceKillTimeout.unref();\n return true;\n }\n\n async sendStdin(): Promise<void> {\n throw new Error('Apple container CLI runner does not support stdin');\n }\n\n async closeStdin(): Promise<void> {\n throw new UnsupportedStdinCloseError('Apple container CLI runner does not support closing stdin');\n }\n}\n\nfunction generateId(): string {\n return `apple-container-sandbox-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;\n}\n\nfunction sanitizeContainerName(name: string): string {\n const sanitized = name.replace(/[^a-zA-Z0-9_.-]/g, '-');\n return /^[a-zA-Z0-9]/.test(sanitized) ? sanitized : `c-${sanitized}`;\n}\n\nfunction buildShellCommand(command: string, args: string[]): string {\n return args.length > 0 ? [command, ...args].map(shellQuote).join(' ') : command;\n}\n\nfunction buildTimeoutShellCommand(command: string, timeoutMs: number): string {\n const timeoutSeconds = formatTimeoutSeconds(timeoutMs);\n const innerScript = [\n `sh -lc ${shellQuote(command)} & child=$!`,\n `trap 'kill -TERM \"$child\" 2>/dev/null; wait \"$child\" 2>/dev/null; exit ${APPLE_CONTAINER_TIMEOUT_EXIT_CODE}' TERM INT`,\n 'wait \"$child\"; code=$?',\n 'trap - TERM INT',\n 'printf \"%s\" \"$code\" > \"$MASTRA_TIMEOUT_RESULT_FILE\"',\n 'exit \"$code\"',\n ].join('; ');\n return [\n 'result_file=\"/tmp/.mastra-apple-container-exit-$$\"',\n 'rm -f \"$result_file\"',\n `MASTRA_TIMEOUT_RESULT_FILE=\"$result_file\" timeout ${timeoutSeconds}s sh -lc ${shellQuote(innerScript)}`,\n 'timeout_code=$?',\n 'if [ -f \"$result_file\" ]; then code=\"$(cat \"$result_file\")\"; rm -f \"$result_file\"; exit \"$code\"; fi',\n 'rm -f \"$result_file\"',\n `case \"$timeout_code\" in 124|137|143) printf '%s\\\\n' ${shellQuote(APPLE_CONTAINER_TIMEOUT_MARKER)} >&2; exit ${APPLE_CONTAINER_TIMEOUT_EXIT_CODE};; *) exit \"$timeout_code\";; esac`,\n ].join('; ');\n}\n\nfunction formatTimeoutSeconds(timeoutMs: number): string {\n return Math.max(timeoutMs / 1000, 0.001)\n .toFixed(3)\n .replace(/0+$/, '')\n .replace(/\\.$/, '');\n}\n\nfunction shellQuote(arg: string): string {\n if (/^[a-zA-Z0-9._\\-\\/=:@]+$/.test(arg)) return arg;\n return `'${arg.replace(/'/g, \"'\\\\''\")}'`;\n}\n\nfunction stripTimeoutMarker(stderr: string): string {\n return stderr\n .split('\\n')\n .filter(line => line.trim() !== APPLE_CONTAINER_TIMEOUT_MARKER)\n .join('\\n')\n .replace(/^\\n+|\\n+$/g, '');\n}\n\nfunction envFlags(env: Record<string, string | undefined>): { args: string[]; env: Record<string, string> } {\n const args: string[] = [];\n const childEnv: Record<string, string> = {};\n for (const [key, value] of Object.entries(env)) {\n if (value === undefined) continue;\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {\n throw new Error(`Invalid environment variable name for Apple container command: ${key}`);\n }\n args.push('--env', key);\n childEnv[key] = value;\n }\n return { args, env: childEnv };\n}\n\nfunction isRunning(inspect: AppleContainerInspectResult): boolean {\n return getContainerState(inspect) === 'running';\n}\n\nfunction getContainerState(inspect: AppleContainerInspectResult): string | undefined {\n return typeof inspect.status === 'string' ? inspect.status : inspect.status?.state;\n}\n\nfunction isMastraOwned(inspect: AppleContainerInspectResult, sandboxId: string): boolean {\n const labels = inspect.configuration?.labels;\n return labels?.['mastra.sandbox'] === 'true' && labels['mastra.sandbox.id'] === sandboxId;\n}\n\nfunction isMissingContainerMessage(message: string): boolean {\n return /not found|no such|does not exist|unknown container/i.test(message);\n}\n\nfunction validateTmpfsPaths(tmpfs: string[]): void {\n for (const entry of tmpfs) {\n if (!entry.startsWith('/') || /[:,]/.test(entry)) {\n throw new Error(\n `Invalid Apple container tmpfs path \"${entry}\". Apple container --tmpfs accepts container paths only, for example \"/tmp\".`,\n );\n }\n }\n}\n\nfunction compactConfig(config: Record<string, unknown>): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(config)) {\n if (value === undefined) continue;\n if (Array.isArray(value) && value.length === 0) continue;\n if (isPlainRecord(value) && Object.keys(value).length === 0) continue;\n result[key] = value;\n }\n return result;\n}\n\nfunction hashConfig(config: Record<string, unknown>): string {\n return createHash('sha256')\n .update(stableStringify(compactConfig(config)))\n .digest('hex')\n .slice(0, 16);\n}\n\nfunction stableStringify(value: unknown): string {\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(',')}]`;\n }\n if (isPlainRecord(value)) {\n return `{${Object.keys(value)\n .sort()\n .map(key => `${JSON.stringify(key)}:${stableStringify(value[key])}`)\n .join(',')}}`;\n }\n return JSON.stringify(value);\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction delay(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n","/**\n * Apple container sandbox provider descriptor for MastraEditor.\n */\n\nimport type { SandboxProvider } from '@mastra/core/editor';\nimport { AppleContainerSandbox } from './sandbox';\nimport type { AppleContainerSandboxOptions } from './sandbox';\n\nexport type AppleContainerProviderConfig = Pick<\n AppleContainerSandboxOptions,\n | 'id'\n | 'image'\n | 'name'\n | 'command'\n | 'env'\n | 'volumes'\n | 'mounts'\n | 'network'\n | 'publishedPorts'\n | 'publishedSockets'\n | 'cpus'\n | 'memory'\n | 'platform'\n | 'arch'\n | 'os'\n | 'rosetta'\n | 'readonlyRootfs'\n | 'ssh'\n | 'init'\n | 'virtualization'\n | 'capAdd'\n | 'capDrop'\n | 'tmpfs'\n | 'dns'\n | 'dnsSearch'\n | 'noDns'\n | 'labels'\n | 'workingDir'\n | 'timeout'\n | 'deleteOnDestroy'\n>;\n\nexport const appleContainerSandboxProvider: SandboxProvider<AppleContainerProviderConfig> = {\n id: 'apple-container',\n name: 'Apple Container Sandbox',\n description: 'Local OCI Linux container sandbox powered by Apple container',\n configSchema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n description: 'Stable sandbox ID used for reconnecting to the same Apple container.',\n },\n image: {\n type: 'string',\n description: 'OCI image to use',\n default: 'node:22-slim',\n },\n name: {\n type: 'string',\n description: 'Apple container name. Defaults to the sandbox ID.',\n },\n command: {\n type: 'array',\n description: 'Container init command. Must keep the container alive for exec-based command execution.',\n items: { type: 'string' },\n },\n env: {\n type: 'object',\n description: 'Environment variables',\n additionalProperties: { type: 'string' },\n },\n volumes: {\n type: 'object',\n description: 'Host-to-container bind mounts (host path -> container path)',\n additionalProperties: { type: 'string' },\n },\n mounts: {\n type: 'array',\n description: 'Raw Apple container --mount specs',\n items: { type: 'string' },\n },\n network: {\n type: 'string',\n description: 'Apple container network attachment spec',\n },\n publishedPorts: {\n type: 'array',\n description: 'Port publish specs',\n items: { type: 'string' },\n },\n publishedSockets: {\n type: 'array',\n description: 'Socket publish specs',\n items: { type: 'string' },\n },\n cpus: {\n anyOf: [{ type: 'number' }, { type: 'string' }],\n description: 'Number of CPUs to allocate',\n },\n memory: {\n type: 'string',\n description: 'Memory allocation, for example 1G',\n },\n platform: {\n type: 'string',\n description: 'OCI platform, for example linux/arm64',\n },\n arch: {\n type: 'string',\n description: 'Image architecture for multi-arch images',\n },\n os: {\n type: 'string',\n description: 'Operating system for multi-platform images',\n },\n rosetta: {\n type: 'boolean',\n description: 'Enable Rosetta in the container',\n default: false,\n },\n readonlyRootfs: {\n type: 'boolean',\n description: 'Mount the container root filesystem as read-only',\n default: false,\n },\n ssh: {\n type: 'boolean',\n description: 'Forward the host SSH agent socket',\n default: false,\n },\n init: {\n type: 'boolean',\n description: \"Enable Apple's init process in the container\",\n default: true,\n },\n virtualization: {\n type: 'boolean',\n description: 'Expose virtualization capabilities to the container',\n default: false,\n },\n capAdd: {\n type: 'array',\n description: 'Linux capabilities to add',\n items: { type: 'string' },\n },\n capDrop: {\n type: 'array',\n description: 'Linux capabilities to drop',\n items: { type: 'string' },\n },\n tmpfs: {\n type: 'array',\n description: 'tmpfs destination paths',\n items: { type: 'string' },\n },\n dns: {\n type: 'array',\n description: 'DNS nameserver IPs',\n items: { type: 'string' },\n },\n dnsSearch: {\n type: 'array',\n description: 'DNS search domains',\n items: { type: 'string' },\n },\n noDns: {\n type: 'boolean',\n description: 'Do not configure DNS in the container',\n default: false,\n },\n labels: {\n type: 'object',\n description: 'Container labels',\n additionalProperties: { type: 'string' },\n },\n workingDir: {\n type: 'string',\n description: 'Working directory inside the container',\n default: '/workspace',\n },\n timeout: {\n type: 'number',\n description: 'Default command timeout in milliseconds',\n default: 300_000,\n },\n deleteOnDestroy: {\n type: 'boolean',\n description: 'Delete the Apple container on destroy',\n default: true,\n },\n },\n },\n createSandbox: config => {\n const {\n id,\n image,\n name,\n command,\n env,\n volumes,\n mounts,\n network,\n publishedPorts,\n publishedSockets,\n cpus,\n memory,\n platform,\n arch,\n os,\n rosetta,\n readonlyRootfs,\n ssh,\n init,\n virtualization,\n capAdd,\n capDrop,\n tmpfs,\n dns,\n dnsSearch,\n noDns,\n labels,\n workingDir,\n timeout,\n deleteOnDestroy,\n } = config;\n\n return new AppleContainerSandbox({\n id,\n image,\n name,\n command,\n env,\n volumes,\n mounts,\n network,\n publishedPorts,\n publishedSockets,\n cpus,\n memory,\n platform,\n arch,\n os,\n rosetta,\n readonlyRootfs,\n ssh,\n init,\n virtualization,\n capAdd,\n capDrop,\n tmpfs,\n dns,\n dnsSearch,\n noDns,\n labels,\n workingDir,\n timeout,\n deleteOnDestroy,\n });\n },\n};\n"],"mappings":";;;;;;;;;;;;;;AAgCA,MAAM,6BAA6B;AACnC,MAAM,gBAAgB;AACtB,MAAM,kBAAkB,CAAC,SAAS,UAAU;AAC5C,MAAM,sBAAsB;AAC5B,MAAM,uCAAuC;AAC7C,MAAM,mCAAmC;AACzC,MAAM,wCAAwC;AAC9C,MAAM,oCAAoC;AAC1C,MAAM,iCAAiC;AA6BvC,IAAa,qCAAb,MAAuF;CACxD;CAA7B,YAAY,SAA0B,aAAa;EAAtB,KAAA,SAAA;CAAuB;CAEpD,IAAI,MAAgB,UAA8C,CAAC,GAAqC;EACtG,OAAO,qBAAqB,KAAK,QAAQ,MAAM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AAiB;IACf,MAAM;IACN,aAAa;IACb,SAAS;GACX;EACF;CACF;CACA,gBAAe,WAAU;EACvB,MAAM,EACJ,IACA,OACA,MACA,SACA,KACA,SACA,QACA,SACA,gBACA,kBACA,MACA,QACA,UACA,MACA,IACA,SACA,gBACA,KACA,MACA,gBACA,QACA,SACA,OACA,KACA,WACA,OACA,QACA,YACA,SACA,oBACE;EAEJ,OAAO,IAAI,sBAAsB;GAC/B;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAAC;CACH;AACF"}
@@ -94,7 +94,10 @@ export interface AppleContainerSandboxOptions extends Omit<MastraSandboxOptions,
94
94
  noDns?: boolean;
95
95
  /** Container labels. Mastra labels are always added. */
96
96
  labels?: Record<string, string>;
97
- /** Working directory inside the container. */
97
+ /** Working directory inside the container.
98
+ * @deprecated Use `workingDirectory` (the base sandbox option) instead.
99
+ * When both are set, `workingDirectory` wins.
100
+ */
98
101
  workingDir?: string;
99
102
  /** Default command timeout in milliseconds. */
100
103
  timeout?: number;
@@ -141,7 +144,6 @@ export declare class AppleContainerSandbox extends MastraSandbox {
141
144
  private readonly _userLabels;
142
145
  private readonly _labels;
143
146
  private readonly _configHash;
144
- private readonly _workingDir;
145
147
  private readonly _timeout;
146
148
  private readonly _deleteOnDestroy;
147
149
  private readonly _runner;
@@ -149,6 +151,12 @@ export declare class AppleContainerSandbox extends MastraSandbox {
149
151
  private readonly _createdAt;
150
152
  private readonly _constructorOptions;
151
153
  private _containerId?;
154
+ /**
155
+ * The effective container working directory. Narrowed to `string`: the
156
+ * constructor always resolves a value (option, deprecated alias, or the
157
+ * default), so unlike the base getter this never returns `undefined`.
158
+ */
159
+ get workingDirectory(): string;
152
160
  constructor(options?: AppleContainerSandboxOptions);
153
161
  /**
154
162
  * Construct a sibling `AppleContainerSandbox` that inherits this sand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AAc;IAUtB,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,OAAO;CAMhB;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,kCAAuC,GAC/C,OAAO,CAAC,uBAAuB,CAAC,CAGlC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/apple-container",
3
- "version": "0.4.1",
3
+ "version": "0.5.0-alpha.0",
4
4
  "description": "Apple container CLI sandbox provider for Mastra workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,19 +26,18 @@
26
26
  "dotenv": "^17.4.2",
27
27
  "eslint": "^10.7.0",
28
28
  "tsdown": "0.22.9",
29
- "typescript": "^6.0.3",
29
+ "typescript": "^7.0.2",
30
30
  "vitest": "4.1.10",
31
- "@internal/lint": "0.0.126",
32
- "@internal/workspace-test-utils": "0.0.70",
33
- "@internal/types-builder": "0.0.101",
34
- "@mastra/core": "1.62.0"
31
+ "@internal/lint": "0.0.129",
32
+ "@mastra/core": "1.64.0-alpha.2",
33
+ "@internal/workspace-test-utils": "0.0.73",
34
+ "@internal/types-builder": "0.0.104"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@mastra/core": ">=1.12.0-0 <2.0.0-0"
38
38
  },
39
39
  "files": [
40
- "dist",
41
- "CHANGELOG.md"
40
+ "dist"
42
41
  ],
43
42
  "homepage": "https://mastra.ai",
44
43
  "repository": {
package/CHANGELOG.md DELETED
@@ -1,145 +0,0 @@
1
- # @mastra/apple-container
2
-
3
- ## 0.4.1
4
-
5
- ### Patch Changes
6
-
7
- - Honor the sandbox runtime environment (`setEnv()`/`getEnv()` from `@mastra/core`) in every workspace sandbox provider. Environment variables set after construction now reach subsequent commands on all providers: ([#22250](https://github.com/mastra-ai/mastra/pull/22250))
8
-
9
- - Process-manager-routed providers (E2B, Blaxel, Cloudflare, Daytona, Docker, Modal, Vercel microVM spawns) inherit the merge from the core spawn wrapper; their duplicated per-manager env plumbing is removed.
10
- - Providers with their own exec transports (AgentCore, Apple Container, Railway, Vercel microVM and serverless `executeCommand`, Platform's private-network, WebSocket lease, and E2B lease paths) now merge `getEnv()` under per-call env.
11
-
12
- Constructor `env` continues to behave as before: it seeds the sandbox runtime environment, and providers that bake env into the VM or container at creation time (Docker, Modal, Railway, Apple Container, Vercel, Platform) still do so. Per-call `env` on `executeCommand` still takes precedence for that command only.
13
-
14
- Removed exported types (minor bump for these two packages): `BlaxelProcessManagerOptions` from `@mastra/blaxel` and `RailwayProcessManagerOptions` from `@mastra/railway`. Both existed only to pass `env` into a process manager constructed by hand; the core spawn wrapper now owns that merge, so the option and its type are gone.
15
-
16
- - Updated dependencies [[`79f04a7`](https://github.com/mastra-ai/mastra/commit/79f04a7f6c6829da541139f638f2f1d267916e08), [`65edab1`](https://github.com/mastra-ai/mastra/commit/65edab1c233d17b8f163bad12fca410d0e6f16b1), [`1e47b75`](https://github.com/mastra-ai/mastra/commit/1e47b7520cab4cfaa8daed52f17e2e6d14ff7539), [`ab20a38`](https://github.com/mastra-ai/mastra/commit/ab20a38d0275f8d85e0f3833bd87ef487bcc609f), [`fd4d5fe`](https://github.com/mastra-ai/mastra/commit/fd4d5fe4f943699b85db5e74404f190d5a6b8c2a), [`ae8790c`](https://github.com/mastra-ai/mastra/commit/ae8790c4bfaa088d2ab279d1dcc06f326b9fd109), [`2c85f42`](https://github.com/mastra-ai/mastra/commit/2c85f428e04ccd63ea31a7ec80b5b327afdad555), [`11bbeb9`](https://github.com/mastra-ai/mastra/commit/11bbeb9b108ef2264e05acefc6dafb9cbb342921), [`48ef1f1`](https://github.com/mastra-ai/mastra/commit/48ef1f1d24eedafbb07f64e659a81b52b67b8bf6), [`aa3a85d`](https://github.com/mastra-ai/mastra/commit/aa3a85daf094c683bb97efdf4b6a696d2e474af5), [`d29d06f`](https://github.com/mastra-ai/mastra/commit/d29d06fe00bbd35b4571150ea04c59d2ed783c71), [`e6516df`](https://github.com/mastra-ai/mastra/commit/e6516dfcdae4f4ac0e7971d84359a81385ee602f), [`1a485f3`](https://github.com/mastra-ai/mastra/commit/1a485f3538f5ec64d58bd8b5e1e99de0c695c87b), [`0d37487`](https://github.com/mastra-ai/mastra/commit/0d37487d9f349388a3f1cef6a536cf9dcc4b6273), [`8661d7d`](https://github.com/mastra-ai/mastra/commit/8661d7d7179f0a024456aabdd8679bcecd09ac28), [`dbbfeb8`](https://github.com/mastra-ai/mastra/commit/dbbfeb85ec949dc9ebc0755e1ad262e4f5eba8db), [`575e343`](https://github.com/mastra-ai/mastra/commit/575e343900451021d96110916497d334af7bc252), [`0b2a3d1`](https://github.com/mastra-ai/mastra/commit/0b2a3d1783875c5b97b7b36ab3d03d7360e0dde7), [`6bb5d71`](https://github.com/mastra-ai/mastra/commit/6bb5d7193fe9166b219f0fccae17db7a5ae86e65), [`3cc9d00`](https://github.com/mastra-ai/mastra/commit/3cc9d00b2b4333e0377a5e9df5eff92c17ce7630), [`cacb839`](https://github.com/mastra-ai/mastra/commit/cacb8392d9e74189b56d857290b0615f98a2683d), [`57de7d6`](https://github.com/mastra-ai/mastra/commit/57de7d644ba7146edb4e9e6111ec4fa98c3a59e9), [`c8e4cea`](https://github.com/mastra-ai/mastra/commit/c8e4ceac9a390d78c8327dff3cdb2861dd71957f), [`ed01e9a`](https://github.com/mastra-ai/mastra/commit/ed01e9a807514a904374bf687a7b8f18750f6f78), [`b47b26e`](https://github.com/mastra-ai/mastra/commit/b47b26e6fe95cb8a3482be2c5e52de157fe59d0b), [`0d37487`](https://github.com/mastra-ai/mastra/commit/0d37487d9f349388a3f1cef6a536cf9dcc4b6273), [`733a537`](https://github.com/mastra-ai/mastra/commit/733a537489a858b5880b2e98809334fba895a221), [`e8e299c`](https://github.com/mastra-ai/mastra/commit/e8e299cc6abdfc39947e2fec25803493015d3882), [`edfc548`](https://github.com/mastra-ai/mastra/commit/edfc548886bc7bae17b681f8b6b41a47eb32bcd2), [`b05f486`](https://github.com/mastra-ai/mastra/commit/b05f48612984d5fe2447ea2d6cdd5c604d285b97), [`a8a4871`](https://github.com/mastra-ai/mastra/commit/a8a4871215f51da95c47129602157ce5372f634a), [`eb9ecaa`](https://github.com/mastra-ai/mastra/commit/eb9ecaa89c36e889749e3b825cfc507ce7f7980b), [`4ff3ee2`](https://github.com/mastra-ai/mastra/commit/4ff3ee2bff7ed07528b4817f8f49639031c72a4d), [`9207dfa`](https://github.com/mastra-ai/mastra/commit/9207dfab8062e5fc68b751684797ff86fe0b4e70), [`5165cdc`](https://github.com/mastra-ai/mastra/commit/5165cdcdcf50e144bb8113278535196cc9b07065), [`e737014`](https://github.com/mastra-ai/mastra/commit/e737014e0fc7035759762bb5b48baef1d6c0f6a7), [`6bb5d71`](https://github.com/mastra-ai/mastra/commit/6bb5d7193fe9166b219f0fccae17db7a5ae86e65), [`f591643`](https://github.com/mastra-ai/mastra/commit/f591643becdf0be9bddce6ba1748e64bc30d77f1), [`63796ba`](https://github.com/mastra-ai/mastra/commit/63796ba0fda60253be17535e68f6bbbf1e6ffa09), [`b1ad324`](https://github.com/mastra-ai/mastra/commit/b1ad324d657f3544b0701332aef7eb10e9a36258), [`61c566d`](https://github.com/mastra-ai/mastra/commit/61c566dd2f2cde2b23ed8f139924e530d4202214), [`c24754c`](https://github.com/mastra-ai/mastra/commit/c24754c1fb6fe144e5051e536e98c8a18b0214ac), [`12c61d2`](https://github.com/mastra-ai/mastra/commit/12c61d280c8cb208bc3c8dbcbe5dcc60cf9d1cd0), [`c46eb09`](https://github.com/mastra-ai/mastra/commit/c46eb09ce4987509af57a0ac582c61241a6dd2f1), [`9ee8120`](https://github.com/mastra-ai/mastra/commit/9ee8120ce17f76b9f617489e05a283353742690a), [`d975e92`](https://github.com/mastra-ai/mastra/commit/d975e924d4936f46c386bd3dee39c671720289f6), [`45dd6ee`](https://github.com/mastra-ai/mastra/commit/45dd6ee089bd7df0d0c98a10098e483fd388e04a), [`4e9a228`](https://github.com/mastra-ai/mastra/commit/4e9a2283d5fd6ed1b70a2751eb3dc2cbf82ada20), [`d6ce34a`](https://github.com/mastra-ai/mastra/commit/d6ce34aeceb06ddf3d595a1eed5cc74f481a46a1), [`f95f468`](https://github.com/mastra-ai/mastra/commit/f95f468cf1e7c2b924a13826494f98b8f2ccd581), [`30ed33e`](https://github.com/mastra-ai/mastra/commit/30ed33ee14084a26019aba15fceadda6d6ddefaf), [`04a815f`](https://github.com/mastra-ai/mastra/commit/04a815fc8971d29e97fcdcc5008a1eb472fc00ff), [`1cfa878`](https://github.com/mastra-ai/mastra/commit/1cfa8784d8da0dfaa0317e5048bc48b6084a5ea5), [`9a12ef3`](https://github.com/mastra-ai/mastra/commit/9a12ef3fccf3f4186db0f294f4ee1f02cf4d8db2), [`32d3583`](https://github.com/mastra-ai/mastra/commit/32d358332cb8ac2306b83b73cf3536e74dbd435e), [`7960688`](https://github.com/mastra-ai/mastra/commit/7960688828e04eaf3106e34f7758fa580257eef6), [`91ad69d`](https://github.com/mastra-ai/mastra/commit/91ad69d64994c89199b0c55399e64ed91c61df2f), [`8dc408d`](https://github.com/mastra-ai/mastra/commit/8dc408d34438f9e13297f792c11a5cfd6cf952e1), [`c92def1`](https://github.com/mastra-ai/mastra/commit/c92def10a13c822972c96f0a4ca6ffc1f4258aed), [`63041eb`](https://github.com/mastra-ai/mastra/commit/63041eb4c50b520a0a80e03d4cd6ea99f67715a0), [`c118318`](https://github.com/mastra-ai/mastra/commit/c1183181c9804303db4b511c2e2648f8b714712b), [`c5eaec5`](https://github.com/mastra-ai/mastra/commit/c5eaec5a860d80d0e3805e67db0414b87ac8cbed), [`fc07c64`](https://github.com/mastra-ai/mastra/commit/fc07c6465043e08e99193a6751a01c56ffc2e7a1), [`cced745`](https://github.com/mastra-ai/mastra/commit/cced745a056ec2225c5bc702e32d848847aa8b65), [`542dee2`](https://github.com/mastra-ai/mastra/commit/542dee254167f974ff8cbbbfc0ce10f9a2616a7b), [`3c19dce`](https://github.com/mastra-ai/mastra/commit/3c19dcef8e73062a80627a4927eae3ec11145afd), [`aca2869`](https://github.com/mastra-ai/mastra/commit/aca2869b2031982f3c4a2f52525c9be7cf123ef8), [`a58483c`](https://github.com/mastra-ai/mastra/commit/a58483cff1a9d41fce7c931843f48cb0ac450f64), [`a58483c`](https://github.com/mastra-ai/mastra/commit/a58483cff1a9d41fce7c931843f48cb0ac450f64), [`e6f8450`](https://github.com/mastra-ai/mastra/commit/e6f845074d478527026b18d85031b23353e1d0a4), [`895e9df`](https://github.com/mastra-ai/mastra/commit/895e9dfc17d6f34299eca64e317ded9e5f5e5ef8), [`e66b2ba`](https://github.com/mastra-ai/mastra/commit/e66b2ba100db63eaeab6e21e1ea34b113f2ec781), [`3e8727e`](https://github.com/mastra-ai/mastra/commit/3e8727e11ec1a5d733acedb5c872896394be18c1)]:
17
- - @mastra/core@1.62.0
18
-
19
- ## 0.4.1-alpha.0
20
-
21
- ### Patch Changes
22
-
23
- - Honor the sandbox runtime environment (`setEnv()`/`getEnv()` from `@mastra/core`) in every workspace sandbox provider. Environment variables set after construction now reach subsequent commands on all providers: ([#22250](https://github.com/mastra-ai/mastra/pull/22250))
24
-
25
- - Process-manager-routed providers (E2B, Blaxel, Cloudflare, Daytona, Docker, Modal, Vercel microVM spawns) inherit the merge from the core spawn wrapper; their duplicated per-manager env plumbing is removed.
26
- - Providers with their own exec transports (AgentCore, Apple Container, Railway, Vercel microVM and serverless `executeCommand`, Platform's private-network, WebSocket lease, and E2B lease paths) now merge `getEnv()` under per-call env.
27
-
28
- Constructor `env` continues to behave as before: it seeds the sandbox runtime environment, and providers that bake env into the VM or container at creation time (Docker, Modal, Railway, Apple Container, Vercel, Platform) still do so. Per-call `env` on `executeCommand` still takes precedence for that command only.
29
-
30
- Removed exported types (minor bump for these two packages): `BlaxelProcessManagerOptions` from `@mastra/blaxel` and `RailwayProcessManagerOptions` from `@mastra/railway`. Both existed only to pass `env` into a process manager constructed by hand; the core spawn wrapper now owns that merge, so the option and its type are gone.
31
-
32
- - Updated dependencies [[`aa3a85d`](https://github.com/mastra-ai/mastra/commit/aa3a85daf094c683bb97efdf4b6a696d2e474af5), [`d29d06f`](https://github.com/mastra-ai/mastra/commit/d29d06fe00bbd35b4571150ea04c59d2ed783c71), [`e6516df`](https://github.com/mastra-ai/mastra/commit/e6516dfcdae4f4ac0e7971d84359a81385ee602f), [`0b2a3d1`](https://github.com/mastra-ai/mastra/commit/0b2a3d1783875c5b97b7b36ab3d03d7360e0dde7), [`6bb5d71`](https://github.com/mastra-ai/mastra/commit/6bb5d7193fe9166b219f0fccae17db7a5ae86e65), [`57de7d6`](https://github.com/mastra-ai/mastra/commit/57de7d644ba7146edb4e9e6111ec4fa98c3a59e9), [`e8e299c`](https://github.com/mastra-ai/mastra/commit/e8e299cc6abdfc39947e2fec25803493015d3882), [`edfc548`](https://github.com/mastra-ai/mastra/commit/edfc548886bc7bae17b681f8b6b41a47eb32bcd2), [`a8a4871`](https://github.com/mastra-ai/mastra/commit/a8a4871215f51da95c47129602157ce5372f634a), [`5165cdc`](https://github.com/mastra-ai/mastra/commit/5165cdcdcf50e144bb8113278535196cc9b07065), [`6bb5d71`](https://github.com/mastra-ai/mastra/commit/6bb5d7193fe9166b219f0fccae17db7a5ae86e65), [`9ee8120`](https://github.com/mastra-ai/mastra/commit/9ee8120ce17f76b9f617489e05a283353742690a), [`d975e92`](https://github.com/mastra-ai/mastra/commit/d975e924d4936f46c386bd3dee39c671720289f6), [`1cfa878`](https://github.com/mastra-ai/mastra/commit/1cfa8784d8da0dfaa0317e5048bc48b6084a5ea5), [`c118318`](https://github.com/mastra-ai/mastra/commit/c1183181c9804303db4b511c2e2648f8b714712b), [`fc07c64`](https://github.com/mastra-ai/mastra/commit/fc07c6465043e08e99193a6751a01c56ffc2e7a1), [`542dee2`](https://github.com/mastra-ai/mastra/commit/542dee254167f974ff8cbbbfc0ce10f9a2616a7b), [`a58483c`](https://github.com/mastra-ai/mastra/commit/a58483cff1a9d41fce7c931843f48cb0ac450f64), [`a58483c`](https://github.com/mastra-ai/mastra/commit/a58483cff1a9d41fce7c931843f48cb0ac450f64), [`895e9df`](https://github.com/mastra-ai/mastra/commit/895e9dfc17d6f34299eca64e317ded9e5f5e5ef8)]:
33
- - @mastra/core@1.62.0-alpha.8
34
-
35
- ## 0.4.0
36
-
37
- ### Minor Changes
38
-
39
- - Added `ProcessHandle.closeStdin()` to signal end-of-file to background processes. Local and Docker sandboxes support closing stdin, while providers without an available stdin-close API return a provider-specific unsupported-operation error. Providers signal the unsupported case with the new `UnsupportedStdinCloseError`, and the base class supplies that behavior by default so existing `ProcessHandle` subclasses keep compiling. Calling `handle.writer.end()` also closes stdin, and finishes without an error when the provider cannot close stdin. ([#21606](https://github.com/mastra-ai/mastra/pull/21606))
40
-
41
- ### Patch Changes
42
-
43
- - Updated dependencies [[`587f6ef`](https://github.com/mastra-ai/mastra/commit/587f6efcfc25880b93760a8607d1cd381ec612fe), [`7e096f0`](https://github.com/mastra-ai/mastra/commit/7e096f02f0dddbf09b85d306458351245ed2f886), [`d7e6745`](https://github.com/mastra-ai/mastra/commit/d7e67456954863c55440ea9c49bc6ceb9949972d), [`6223446`](https://github.com/mastra-ai/mastra/commit/6223446ddce6166e96e0ba5e00d628b615dee8ca), [`15101bb`](https://github.com/mastra-ai/mastra/commit/15101bb53c0d934f31af6b8813b88191e382a5e5), [`4e7a421`](https://github.com/mastra-ai/mastra/commit/4e7a421dce8a48742f785d1e93ad2f43a572b282), [`c2c3deb`](https://github.com/mastra-ai/mastra/commit/c2c3debcf670c7082d0a5e553aa99818a864698c), [`d8308a2`](https://github.com/mastra-ai/mastra/commit/d8308a2be3c07e777393d1017a381dcae3890d30), [`b0a2a07`](https://github.com/mastra-ai/mastra/commit/b0a2a07800d42bd9823292e7db832374ed084c9c), [`74e5bd3`](https://github.com/mastra-ai/mastra/commit/74e5bd315b8b3a1e04cb6cf480bb0f5fc4951dc8), [`242e324`](https://github.com/mastra-ai/mastra/commit/242e3241e73cbd5c9bb86a31ebb49ca0256488d4), [`217e967`](https://github.com/mastra-ai/mastra/commit/217e9672d8b3160eb729d8e9f0044949e88da239), [`d774e89`](https://github.com/mastra-ai/mastra/commit/d774e8930c781df8c9effe3763e6b501c099b6cc), [`9c27a53`](https://github.com/mastra-ai/mastra/commit/9c27a53cd9d3de4f3f025bc387d94ce371c33f95), [`8f0a332`](https://github.com/mastra-ai/mastra/commit/8f0a3321bf180368d76fe7b36aa1a8f60f00b6de), [`0b4f108`](https://github.com/mastra-ai/mastra/commit/0b4f1089aa8d92e67c2a8e99726822c5ee410784), [`9acb50f`](https://github.com/mastra-ai/mastra/commit/9acb50f71cec9c362f06820033f90ae6b1f8282f), [`46e9e3f`](https://github.com/mastra-ai/mastra/commit/46e9e3f73babe1bc70080a596cf2ac0b9da48519), [`3f9a190`](https://github.com/mastra-ai/mastra/commit/3f9a19057c027155867b9317294ee4ca7bd0581a), [`dff25a1`](https://github.com/mastra-ai/mastra/commit/dff25a1103fa72ee082a9b6f805ebeb5ce400753), [`6db7a5d`](https://github.com/mastra-ai/mastra/commit/6db7a5dd3dd2b6f7ef75dcd804fcffef5fa83963), [`217e967`](https://github.com/mastra-ai/mastra/commit/217e9672d8b3160eb729d8e9f0044949e88da239), [`583e235`](https://github.com/mastra-ai/mastra/commit/583e23519c13af16c1746f9c49722d011216611b), [`b098de9`](https://github.com/mastra-ai/mastra/commit/b098de9d7cb9f672e0883a5c716465a3a689693d), [`e8808e3`](https://github.com/mastra-ai/mastra/commit/e8808e3d8eb585a2565be53e56a7e0e1477352a4), [`a77f8d4`](https://github.com/mastra-ai/mastra/commit/a77f8d4740d2178a74c41e4bf678b4fcd8fa0bb2), [`7f78585`](https://github.com/mastra-ai/mastra/commit/7f785857e401570e2ffb316911f126ed363aa537), [`33374ba`](https://github.com/mastra-ai/mastra/commit/33374ba359e4fb13eaa918ae925fe167a3c55414), [`940bf5c`](https://github.com/mastra-ai/mastra/commit/940bf5ccf04f2c9ebd8a1390431733222a03b1cd), [`c549e2f`](https://github.com/mastra-ai/mastra/commit/c549e2f40edc1cac5d9e74e82f90da22b48df084), [`58c43d3`](https://github.com/mastra-ai/mastra/commit/58c43d3f7cb2eeaeb8ac733ae71dde822348e588), [`ef6e295`](https://github.com/mastra-ai/mastra/commit/ef6e295b59bc25a5b61b633a89c97bcfce9fb465), [`208e1b3`](https://github.com/mastra-ai/mastra/commit/208e1b39f30f4b386e494394e9d71d96f0f90241), [`c938d34`](https://github.com/mastra-ai/mastra/commit/c938d34739936c8ecbabd67ad6a4a4396f41c4c6), [`88ddc7c`](https://github.com/mastra-ai/mastra/commit/88ddc7ce01d40175f13a3228b789a906779680bd), [`f2a4afd`](https://github.com/mastra-ai/mastra/commit/f2a4afd7e37e809669001ed17724b341a5c1f45e), [`d438148`](https://github.com/mastra-ai/mastra/commit/d438148e222c1e2fb3c652725ce75680962ebec4), [`ba05fe0`](https://github.com/mastra-ai/mastra/commit/ba05fe0738f70cb686777546e968237d09269142), [`40d358e`](https://github.com/mastra-ai/mastra/commit/40d358e29d55543803e64b49241122f598ffabc7), [`d26a8d4`](https://github.com/mastra-ai/mastra/commit/d26a8d4281f28414715b333c85bedaf70d0b2890), [`e80cd7e`](https://github.com/mastra-ai/mastra/commit/e80cd7e7683e7d732e1cc6784bcac1d2640d2ce3), [`ccbbcd9`](https://github.com/mastra-ai/mastra/commit/ccbbcd974eedff4367a54ed0e24c9ee742ab2f61), [`1d9a0ea`](https://github.com/mastra-ai/mastra/commit/1d9a0ea4a9901baee6cd56737243bd6d1f631ac0), [`677cdc6`](https://github.com/mastra-ai/mastra/commit/677cdc6af564dec29a13464d12b7ab2a4efc22e9), [`c549e2f`](https://github.com/mastra-ai/mastra/commit/c549e2f40edc1cac5d9e74e82f90da22b48df084), [`a7dd322`](https://github.com/mastra-ai/mastra/commit/a7dd32247d95afc539f483ca37f4594af0387f59), [`3f5c6f7`](https://github.com/mastra-ai/mastra/commit/3f5c6f728ea35da344248de9aa070f12849f3aa0), [`a318490`](https://github.com/mastra-ai/mastra/commit/a318490e17da32f338d50929c770d901a9b3dd72), [`b860493`](https://github.com/mastra-ai/mastra/commit/b86049391100e665d579f700c8a2034c036defc3), [`d4be8c1`](https://github.com/mastra-ai/mastra/commit/d4be8c1739d22d621e3f78790e1dd5eb5ecc3589), [`a5d2eb1`](https://github.com/mastra-ai/mastra/commit/a5d2eb10347eade1ae2816d88f466c25186c54a5), [`3667679`](https://github.com/mastra-ai/mastra/commit/3667679db057edfb086846d13369fdda4902ad65), [`49696e8`](https://github.com/mastra-ai/mastra/commit/49696e8e42f870674a0a58f5abcd22cc54dd2864), [`2ef2f23`](https://github.com/mastra-ai/mastra/commit/2ef2f230a7aed342e7dc3b2000cd42e4c43e08a7), [`763e0c6`](https://github.com/mastra-ai/mastra/commit/763e0c61e04d76ad9a9efd301aa57525ca0cbea9), [`20504b2`](https://github.com/mastra-ai/mastra/commit/20504b2ecebd0e077acda3d457ab57480a98ed3e), [`77e6b1b`](https://github.com/mastra-ai/mastra/commit/77e6b1bc4c46ce94fe501023fb4393c812ec6be3), [`c5f964d`](https://github.com/mastra-ai/mastra/commit/c5f964d3f77064e978f8066ec506eed77ba5c63c), [`23e0be2`](https://github.com/mastra-ai/mastra/commit/23e0be261381e49534b4ff3101c60ee64a946cbf), [`7fc8806`](https://github.com/mastra-ai/mastra/commit/7fc880627d3cbf995d31ea0e8b807bf15417e651), [`0e02eac`](https://github.com/mastra-ai/mastra/commit/0e02eacdb2e30e1697a41910b41163742a181dc1), [`4df174c`](https://github.com/mastra-ai/mastra/commit/4df174c32bddf093a82f273070b8380aef7c9e90), [`f7c25b5`](https://github.com/mastra-ai/mastra/commit/f7c25b5106ddfb48e591f98df7a51e0f2dd01dba), [`7aad631`](https://github.com/mastra-ai/mastra/commit/7aad631b43bc10db77d5b8c66b200d7a49d18bf2), [`512100a`](https://github.com/mastra-ai/mastra/commit/512100a7d8b7e9c920f2590c6b3612f5de0d3cff), [`e81744c`](https://github.com/mastra-ai/mastra/commit/e81744cd13c46619c142dc521dc0baac47607a84), [`f8f653f`](https://github.com/mastra-ai/mastra/commit/f8f653f10980d01a73706cc3c8689ca5e40ce808), [`dc09cc1`](https://github.com/mastra-ai/mastra/commit/dc09cc1083d861cde192c1cd235324dc75b8c731), [`9ef432b`](https://github.com/mastra-ai/mastra/commit/9ef432b6faa534b57b0d182a610e13dd9a7123ff), [`36b4649`](https://github.com/mastra-ai/mastra/commit/36b4649045a3a380cbab8ceca866db4086223aff), [`b9cf308`](https://github.com/mastra-ai/mastra/commit/b9cf30846f97f99ac1906ee8a68f4f2d117b0378), [`2e1d098`](https://github.com/mastra-ai/mastra/commit/2e1d0984e325fd319d32ea182f596b3170be3847), [`377eb81`](https://github.com/mastra-ai/mastra/commit/377eb81ce43b964e3a6b541df172da74a8ff3716), [`1794a79`](https://github.com/mastra-ai/mastra/commit/1794a79178c418004a7261b1ad9114066f7ef01d), [`0cdc5dc`](https://github.com/mastra-ai/mastra/commit/0cdc5dc69024957815da4f51acc4119eb4f447d7), [`5740ec6`](https://github.com/mastra-ai/mastra/commit/5740ec60c760ffdfbfaa59d603d03b847c864e05)]:
44
- - @mastra/core@1.60.0
45
-
46
- ## 0.4.0-alpha.0
47
-
48
- ### Minor Changes
49
-
50
- - Added `ProcessHandle.closeStdin()` to signal end-of-file to background processes. Local and Docker sandboxes support closing stdin, while providers without an available stdin-close API return a provider-specific unsupported-operation error. Providers signal the unsupported case with the new `UnsupportedStdinCloseError`, and the base class supplies that behavior by default so existing `ProcessHandle` subclasses keep compiling. Calling `handle.writer.end()` also closes stdin, and finishes without an error when the provider cannot close stdin. ([#21606](https://github.com/mastra-ai/mastra/pull/21606))
51
-
52
- ### Patch Changes
53
-
54
- - Updated dependencies [[`4e7a421`](https://github.com/mastra-ai/mastra/commit/4e7a421dce8a48742f785d1e93ad2f43a572b282), [`242e324`](https://github.com/mastra-ai/mastra/commit/242e3241e73cbd5c9bb86a31ebb49ca0256488d4), [`217e967`](https://github.com/mastra-ai/mastra/commit/217e9672d8b3160eb729d8e9f0044949e88da239), [`d774e89`](https://github.com/mastra-ai/mastra/commit/d774e8930c781df8c9effe3763e6b501c099b6cc), [`9c27a53`](https://github.com/mastra-ai/mastra/commit/9c27a53cd9d3de4f3f025bc387d94ce371c33f95), [`dff25a1`](https://github.com/mastra-ai/mastra/commit/dff25a1103fa72ee082a9b6f805ebeb5ce400753), [`217e967`](https://github.com/mastra-ai/mastra/commit/217e9672d8b3160eb729d8e9f0044949e88da239), [`7f78585`](https://github.com/mastra-ai/mastra/commit/7f785857e401570e2ffb316911f126ed363aa537), [`f2a4afd`](https://github.com/mastra-ai/mastra/commit/f2a4afd7e37e809669001ed17724b341a5c1f45e), [`d438148`](https://github.com/mastra-ai/mastra/commit/d438148e222c1e2fb3c652725ce75680962ebec4), [`ba05fe0`](https://github.com/mastra-ai/mastra/commit/ba05fe0738f70cb686777546e968237d09269142), [`d26a8d4`](https://github.com/mastra-ai/mastra/commit/d26a8d4281f28414715b333c85bedaf70d0b2890), [`677cdc6`](https://github.com/mastra-ai/mastra/commit/677cdc6af564dec29a13464d12b7ab2a4efc22e9), [`a318490`](https://github.com/mastra-ai/mastra/commit/a318490e17da32f338d50929c770d901a9b3dd72), [`763e0c6`](https://github.com/mastra-ai/mastra/commit/763e0c61e04d76ad9a9efd301aa57525ca0cbea9), [`23e0be2`](https://github.com/mastra-ai/mastra/commit/23e0be261381e49534b4ff3101c60ee64a946cbf), [`7fc8806`](https://github.com/mastra-ai/mastra/commit/7fc880627d3cbf995d31ea0e8b807bf15417e651), [`0e02eac`](https://github.com/mastra-ai/mastra/commit/0e02eacdb2e30e1697a41910b41163742a181dc1), [`4df174c`](https://github.com/mastra-ai/mastra/commit/4df174c32bddf093a82f273070b8380aef7c9e90), [`f7c25b5`](https://github.com/mastra-ai/mastra/commit/f7c25b5106ddfb48e591f98df7a51e0f2dd01dba), [`dc09cc1`](https://github.com/mastra-ai/mastra/commit/dc09cc1083d861cde192c1cd235324dc75b8c731), [`36b4649`](https://github.com/mastra-ai/mastra/commit/36b4649045a3a380cbab8ceca866db4086223aff), [`377eb81`](https://github.com/mastra-ai/mastra/commit/377eb81ce43b964e3a6b541df172da74a8ff3716)]:
55
- - @mastra/core@1.60.0-alpha.8
56
-
57
- ## 0.3.0
58
-
59
- ### Minor Changes
60
-
61
- - Added `clone()` support to the sandbox providers. `clone()` constructs an unstarted sibling sandbox that inherits the template's configuration (credentials, image, resources) with per-instance overrides for `id` and `env`, so one configured sandbox can act as a template for a fleet of sandbox clones (for example, one per project). ([#19616](https://github.com/mastra-ai/mastra/pull/19616))
62
-
63
- ```ts
64
- const template = new E2BSandbox({ apiKey, template: 'base' });
65
-
66
- const projectSandbox = template.clone({
67
- id: 'mc-project-42',
68
- env: { GITHUB_TOKEN: token },
69
- idleTimeoutMinutes: 30,
70
- });
71
- await projectSandbox.start();
72
- ```
73
-
74
- `idleTimeoutMinutes` is a best-effort hint that maps to each provider's native lifetime knob (Railway `idleTimeoutMinutes`, E2B/Modal/Vercel timeout in milliseconds, Daytona `autoStopInterval`, Blaxel TTL duration). Docker and Apple Container ignore it since they have no provider-side idle teardown.
75
-
76
- ### Patch Changes
77
-
78
- - Updated dependencies [[`ec857fc`](https://github.com/mastra-ai/mastra/commit/ec857fc79c264b53b38e16478c789b7177f2ad59), [`d7385ad`](https://github.com/mastra-ai/mastra/commit/d7385ad9e88f9e4f33d15c0ec0bfebedde0cbc2e), [`41a5392`](https://github.com/mastra-ai/mastra/commit/41a5392d9f6c5e18d6b227f0fc0ddf49c50774e9), [`3d6e539`](https://github.com/mastra-ai/mastra/commit/3d6e539272eb2ea0407034605ee1906b3be06b39), [`1426af2`](https://github.com/mastra-ai/mastra/commit/1426af24975879c000d13ac75673f630fcc970c1), [`a40adeb`](https://github.com/mastra-ai/mastra/commit/a40adeb222b961a56a58af56a106106525721b74), [`8a0d145`](https://github.com/mastra-ai/mastra/commit/8a0d145aadbdf7278665aceaaec364b35dd9bd94), [`bd2f1d2`](https://github.com/mastra-ai/mastra/commit/bd2f1d274d05e60e2366f005ea0d94d5cea0d5ff), [`e1f2fae`](https://github.com/mastra-ai/mastra/commit/e1f2faebaf048c3d4c2e2c01d293767c195d5794), [`63aa799`](https://github.com/mastra-ai/mastra/commit/63aa799c6b44eacc7806cda6846b7c5bbee06b37), [`b7e79c3`](https://github.com/mastra-ai/mastra/commit/b7e79c3c02ac5cd415db34ba0975ceafc1464333), [`675fbff`](https://github.com/mastra-ai/mastra/commit/675fbff84d3274391b33e852f76083c38a5514e5), [`da009e1`](https://github.com/mastra-ai/mastra/commit/da009e1aacd89ed94b8d1b2af09c9d4fe7c4db49), [`3b77e77`](https://github.com/mastra-ai/mastra/commit/3b77e7704936522e4769d29de1b5ea6901f302bd), [`c7d30cd`](https://github.com/mastra-ai/mastra/commit/c7d30cd86009c407df91105591f03cd6e3d2854d), [`21a0eb8`](https://github.com/mastra-ai/mastra/commit/21a0eb86746ba0b703acea360d4f84c6a5a493f2), [`8b20926`](https://github.com/mastra-ai/mastra/commit/8b20926cd59e2ba3d66458e062fa0e6e2ada3e68), [`975295d`](https://github.com/mastra-ai/mastra/commit/975295d418552f0d46a59edfef4c3ee555f9930a), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`6b1bf3b`](https://github.com/mastra-ai/mastra/commit/6b1bf3b9494bd51aa8f654c68c9355d6046fa2a1), [`35c2181`](https://github.com/mastra-ai/mastra/commit/35c2181e6a50e47c90ba36260db7c9723d54696f), [`0a2c22c`](https://github.com/mastra-ai/mastra/commit/0a2c22c902604439ec490319e14c17f331e0c84c), [`4cfdd64`](https://github.com/mastra-ai/mastra/commit/4cfdd645794feaea0c4ea711e70ecdfbef0c5b8e), [`b75d749`](https://github.com/mastra-ai/mastra/commit/b75d749621ff5d17e86bcb4ee809d301fb4f7cf3), [`821648b`](https://github.com/mastra-ai/mastra/commit/821648bf2871ef840100c7bacbecf676010bd12a), [`de86fd7`](https://github.com/mastra-ai/mastra/commit/de86fd7119f0438381d1a642e3d258143c0b9c29), [`2745031`](https://github.com/mastra-ai/mastra/commit/2745031d1d4a4978f037092da371428c32e2842a), [`b4b7ea8`](https://github.com/mastra-ai/mastra/commit/b4b7ea8733f033fc441ea47ed03f6afb17ec2248), [`3a8024c`](https://github.com/mastra-ai/mastra/commit/3a8024ce615f8aa89479c0d71fe61d10bb0040be), [`35865a5`](https://github.com/mastra-ai/mastra/commit/35865a53e194aa9634d6a70a97010e7a6b9d58b1), [`74faf8b`](https://github.com/mastra-ai/mastra/commit/74faf8bd9c1018f2492653c06b1e25fc8300e9e6), [`ef03fbc`](https://github.com/mastra-ai/mastra/commit/ef03fbcc556bcbc04c9b3d06fab88771ecaa043c), [`675fbff`](https://github.com/mastra-ai/mastra/commit/675fbff84d3274391b33e852f76083c38a5514e5), [`70687f7`](https://github.com/mastra-ai/mastra/commit/70687f7e495a322a02070b4a67cb0c77a5ca91ec), [`1fadac4`](https://github.com/mastra-ai/mastra/commit/1fadac44537caeefe81f9f775ae2f2f3d94e9069), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`76b7181`](https://github.com/mastra-ai/mastra/commit/76b71810366e6d90b9d3973149d1c7ba3659ffb9), [`792ec9a`](https://github.com/mastra-ai/mastra/commit/792ec9a0869bab8274cf5e0ed2840738737a1607), [`712b864`](https://github.com/mastra-ai/mastra/commit/712b864aa1ed12b14c54390ec17b69de163c37f7), [`85e4fb5`](https://github.com/mastra-ai/mastra/commit/85e4fb50087a81c74df3a762f53b56373db0b912), [`0c0e8d7`](https://github.com/mastra-ai/mastra/commit/0c0e8d7becd4d1445c656b78d5d845f606c1ff9d), [`a7bbe77`](https://github.com/mastra-ai/mastra/commit/a7bbe773577f60bc4761b534ef7ec6b476332dad), [`72e437c`](https://github.com/mastra-ai/mastra/commit/72e437c515942c80b9def5b026e0bdee61b469d9), [`8f7a5de`](https://github.com/mastra-ai/mastra/commit/8f7a5dedc246cdc938bb65516703cf9b27b03756), [`a7bbe77`](https://github.com/mastra-ai/mastra/commit/a7bbe773577f60bc4761b534ef7ec6b476332dad), [`11f6cd9`](https://github.com/mastra-ai/mastra/commit/11f6cd96fe42582403416608beb212cc1a2cc79e), [`ef03c0c`](https://github.com/mastra-ai/mastra/commit/ef03c0cfc62367a458e4cc56462e2148b35681c5), [`4fb4d88`](https://github.com/mastra-ai/mastra/commit/4fb4d881bc107acee13890ad4d78661016c510ed), [`4e68363`](https://github.com/mastra-ai/mastra/commit/4e683634f94ebd062d26a3bb6093a8dfc7263d37), [`c328769`](https://github.com/mastra-ai/mastra/commit/c3287698ff8ef98dba86d415faa566fa3e5f4d56), [`9f7c67a`](https://github.com/mastra-ai/mastra/commit/9f7c67abeeb52c41c51a9b5edee60b62afe7cd8d), [`3b65e68`](https://github.com/mastra-ai/mastra/commit/3b65e68d7f1c771c7a70eea42d83fefdd28cad88), [`4eba27a`](https://github.com/mastra-ai/mastra/commit/4eba27adcf60f991df0e62f94b3e75b4e67f3b4b), [`c701be3`](https://github.com/mastra-ai/mastra/commit/c701be32d7d9aa94a66da8c6cc38dcac6856f464), [`db650ce`](https://github.com/mastra-ai/mastra/commit/db650ce490348914e85b93651d83acdf8f2a4c31), [`232fcbc`](https://github.com/mastra-ai/mastra/commit/232fcbc14fce625dd672ba043329c0b732c62be2), [`6354eeb`](https://github.com/mastra-ai/mastra/commit/6354eeb32efa9f5f68f51dda394e90e2ee76f1fb), [`a8799bb`](https://github.com/mastra-ai/mastra/commit/a8799bb8e44f4a60d01e4e2acd3448ff80bf14f8), [`3d6e539`](https://github.com/mastra-ai/mastra/commit/3d6e539272eb2ea0407034605ee1906b3be06b39), [`e3868e2`](https://github.com/mastra-ai/mastra/commit/e3868e22babfffd0133771669ca724501c2dd58e), [`9251370`](https://github.com/mastra-ai/mastra/commit/9251370ad413af464aa22d7566338bec5613e8de), [`3491666`](https://github.com/mastra-ai/mastra/commit/34916663c4fdd43b48c21f4ab2d5fb6dcccc94f9), [`c0bec73`](https://github.com/mastra-ai/mastra/commit/c0bec732c93d1a22ae5e51ed66cf8cacca8bd6a6)]:
79
- - @mastra/core@1.52.0
80
-
81
- ## 0.3.0-alpha.0
82
-
83
- ### Minor Changes
84
-
85
- - Added `clone()` support to the sandbox providers. `clone()` constructs an unstarted sibling sandbox that inherits the template's configuration (credentials, image, resources) with per-instance overrides for `id` and `env`, so one configured sandbox can act as a template for a fleet of sandbox clones (for example, one per project). ([#19616](https://github.com/mastra-ai/mastra/pull/19616))
86
-
87
- ```ts
88
- const template = new E2BSandbox({ apiKey, template: 'base' });
89
-
90
- const projectSandbox = template.clone({
91
- id: 'mc-project-42',
92
- env: { GITHUB_TOKEN: token },
93
- idleTimeoutMinutes: 30,
94
- });
95
- await projectSandbox.start();
96
- ```
97
-
98
- `idleTimeoutMinutes` is a best-effort hint that maps to each provider's native lifetime knob (Railway `idleTimeoutMinutes`, E2B/Modal/Vercel timeout in milliseconds, Daytona `autoStopInterval`, Blaxel TTL duration). Docker and Apple Container ignore it since they have no provider-side idle teardown.
99
-
100
- ### Patch Changes
101
-
102
- - Updated dependencies [[`ec857fc`](https://github.com/mastra-ai/mastra/commit/ec857fc79c264b53b38e16478c789b7177f2ad59), [`e1f2fae`](https://github.com/mastra-ai/mastra/commit/e1f2faebaf048c3d4c2e2c01d293767c195d5794), [`63aa799`](https://github.com/mastra-ai/mastra/commit/63aa799c6b44eacc7806cda6846b7c5bbee06b37), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`76b7181`](https://github.com/mastra-ai/mastra/commit/76b71810366e6d90b9d3973149d1c7ba3659ffb9), [`0c0e8d7`](https://github.com/mastra-ai/mastra/commit/0c0e8d7becd4d1445c656b78d5d845f606c1ff9d), [`9f7c67a`](https://github.com/mastra-ai/mastra/commit/9f7c67abeeb52c41c51a9b5edee60b62afe7cd8d), [`3b65e68`](https://github.com/mastra-ai/mastra/commit/3b65e68d7f1c771c7a70eea42d83fefdd28cad88), [`e3868e2`](https://github.com/mastra-ai/mastra/commit/e3868e22babfffd0133771669ca724501c2dd58e)]:
103
- - @mastra/core@1.52.0-alpha.5
104
-
105
- ## 0.2.0
106
-
107
- ### Minor Changes
108
-
109
- - Add an Apple container CLI workspace sandbox provider. ([#18643](https://github.com/mastra-ai/mastra/pull/18643))
110
-
111
- ```ts
112
- import { AppleContainerSandbox } from '@mastra/apple-container';
113
-
114
- const sandbox = new AppleContainerSandbox({
115
- id: 'local-apple-container',
116
- image: 'node:22-slim',
117
- volumes: { [process.cwd()]: '/workspace' },
118
- });
119
- ```
120
-
121
- ### Patch Changes
122
-
123
- - Updated dependencies [[`700619b`](https://github.com/mastra-ai/mastra/commit/700619b61d572e592cbaaf758121d168844ca4d2), [`0f69865`](https://github.com/mastra-ai/mastra/commit/0f69865aced225d98eac812e22699dc445ee18cb), [`9250acd`](https://github.com/mastra-ai/mastra/commit/9250acd1357f0f1f33d0dcca16f9655084c58eca), [`0c3d4bc`](https://github.com/mastra-ai/mastra/commit/0c3d4bcae13ea3699d379403e6f350d5cf4efe9f), [`cc440a3`](https://github.com/mastra-ai/mastra/commit/cc440a39400d8ce06655462b26c1666a1b3d4320), [`6a61846`](https://github.com/mastra-ai/mastra/commit/6a61846eeda29fb714549b70f1bee2bf6b141c44), [`215f9b0`](https://github.com/mastra-ai/mastra/commit/215f9b0f3f3f6fc165edad360582dd4d3d7ea748), [`17369b2`](https://github.com/mastra-ai/mastra/commit/17369b25250561e9ed994ae509be1d15bfb33bcb), [`c64c2a8`](https://github.com/mastra-ai/mastra/commit/c64c2a8503a50252f9ca6b8e8c54cadee31b92a2), [`bcae929`](https://github.com/mastra-ai/mastra/commit/bcae929945cbf265bd9f327cc715ecafa072b5b9), [`ea6327b`](https://github.com/mastra-ai/mastra/commit/ea6327ba2d63ca647804bc97b347e03a58617162), [`3439fa8`](https://github.com/mastra-ai/mastra/commit/3439fa836ecfcaa257b40c20b30ac2a8be22e9ea), [`85107f2`](https://github.com/mastra-ai/mastra/commit/85107f2758b527147fccbedff962961927c2d3b8), [`b33822e`](https://github.com/mastra-ai/mastra/commit/b33822e8d470884954b02f7b0745407ee4ef74b1), [`06e2680`](https://github.com/mastra-ai/mastra/commit/06e26806b51d2cbd858afdc66daa2b86ff3ba64a), [`06ff9e0`](https://github.com/mastra-ai/mastra/commit/06ff9e0befd1d642ab87ff749285ee4091205c7e), [`d5c11e3`](https://github.com/mastra-ai/mastra/commit/d5c11e3ba5045969caa7272a7bd1fd141c93ab6c), [`7f5e1ff`](https://github.com/mastra-ai/mastra/commit/7f5e1ff695a92f672bb3976363925d1e9136b54a), [`ff80671`](https://github.com/mastra-ai/mastra/commit/ff8067185e208b27198b4e5b71803013175c3643), [`b8375c1`](https://github.com/mastra-ai/mastra/commit/b8375c1f8fe905df8ae2ae9a893bb365f17aec4e), [`dab1257`](https://github.com/mastra-ai/mastra/commit/dab1257b64e4ed576dc5038bb7a3f7072338bc9f), [`1240f05`](https://github.com/mastra-ai/mastra/commit/1240f051c8e5371f1c014448bf37b1a1b9a05e47), [`705ff39`](https://github.com/mastra-ai/mastra/commit/705ff3969e57214ff2fdaf3815d751dd558886ed), [`e6fbd5b`](https://github.com/mastra-ai/mastra/commit/e6fbd5bfdc28e92c0c0433f29aa1bc152d3430f6), [`215f9b0`](https://github.com/mastra-ai/mastra/commit/215f9b0f3f3f6fc165edad360582dd4d3d7ea748), [`24c10d3`](https://github.com/mastra-ai/mastra/commit/24c10d333e6649ac06075903aeeee13a933db3b3), [`24c10d3`](https://github.com/mastra-ai/mastra/commit/24c10d333e6649ac06075903aeeee13a933db3b3), [`24c10d3`](https://github.com/mastra-ai/mastra/commit/24c10d333e6649ac06075903aeeee13a933db3b3), [`6f2026c`](https://github.com/mastra-ai/mastra/commit/6f2026cdf114ff1e21e49133ca774ec7d5085059), [`24c10d3`](https://github.com/mastra-ai/mastra/commit/24c10d333e6649ac06075903aeeee13a933db3b3), [`215f9b0`](https://github.com/mastra-ai/mastra/commit/215f9b0f3f3f6fc165edad360582dd4d3d7ea748), [`215f9b0`](https://github.com/mastra-ai/mastra/commit/215f9b0f3f3f6fc165edad360582dd4d3d7ea748), [`003f35d`](https://github.com/mastra-ai/mastra/commit/003f35d19e07b23b4bacc591c8bc0c59b42124ae), [`f890eda`](https://github.com/mastra-ai/mastra/commit/f890eda2c8a2ae83d9b30bc6d85842f93b6c266b), [`1340fb7`](https://github.com/mastra-ai/mastra/commit/1340fb76262a3ca062130aa71859f07257a0a5a4)]:
124
- - @mastra/core@1.49.0
125
-
126
- ## 0.2.0-alpha.0
127
-
128
- ### Minor Changes
129
-
130
- - Add an Apple container CLI workspace sandbox provider. ([#18643](https://github.com/mastra-ai/mastra/pull/18643))
131
-
132
- ```ts
133
- import { AppleContainerSandbox } from '@mastra/apple-container';
134
-
135
- const sandbox = new AppleContainerSandbox({
136
- id: 'local-apple-container',
137
- image: 'node:22-slim',
138
- volumes: { [process.cwd()]: '/workspace' },
139
- });
140
- ```
141
-
142
- ### Patch Changes
143
-
144
- - Updated dependencies [[`cc440a3`](https://github.com/mastra-ai/mastra/commit/cc440a39400d8ce06655462b26c1666a1b3d4320), [`ea6327b`](https://github.com/mastra-ai/mastra/commit/ea6327ba2d63ca647804bc97b347e03a58617162), [`3439fa8`](https://github.com/mastra-ai/mastra/commit/3439fa836ecfcaa257b40c20b30ac2a8be22e9ea), [`85107f2`](https://github.com/mastra-ai/mastra/commit/85107f2758b527147fccbedff962961927c2d3b8), [`06ff9e0`](https://github.com/mastra-ai/mastra/commit/06ff9e0befd1d642ab87ff749285ee4091205c7e), [`7f5e1ff`](https://github.com/mastra-ai/mastra/commit/7f5e1ff695a92f672bb3976363925d1e9136b54a), [`b8375c1`](https://github.com/mastra-ai/mastra/commit/b8375c1f8fe905df8ae2ae9a893bb365f17aec4e), [`003f35d`](https://github.com/mastra-ai/mastra/commit/003f35d19e07b23b4bacc591c8bc0c59b42124ae)]:
145
- - @mastra/core@1.49.0-alpha.1