@groundbox/mastra 0.0.0-stage → 0.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sandbox.ts","../src/computer.ts","../src/filesystem.ts","../src/utils.ts","../src/process-manager.ts","../src/provider.ts"],"sourcesContent":["/**\n * Groundbox sandbox provider for Mastra workspaces.\n *\n * A Groundbox sandbox is a Firecracker microVM with its own cores: Linux, a 20 GB disk by\n * default, user `runner` with passwordless sudo on Groundbox's own image (root on a Docker image\n * passed as `image`). This class plugs it into Mastra's `WorkspaceSandbox` interface.\n *\n * @see https://groundbox.dev/docs/sandboxes\n */\nimport { randomUUID } from 'node:crypto';\n\nimport { Groundbox } from '@groundbox/sdk';\nimport type { CreateSandboxRequest, Sandbox, Snapshot } from '@groundbox/sdk';\nimport type { RequestContext } from '@mastra/core/di';\nimport {\n MastraSandbox,\n SandboxAbortError,\n SandboxNotReadyError,\n validateSandboxFileMode,\n} from '@mastra/core/workspace';\nimport type {\n CommandResult,\n ExecuteCommandOptions,\n MastraSandboxOptions,\n ProviderStatus,\n SandboxCloneOptions,\n SandboxComputer,\n SandboxFileInput,\n SandboxInfo,\n SandboxNetworking,\n WriteFilesOptions,\n} from '@mastra/core/workspace';\n\nimport { createGroundboxComputer } from './computer.js';\nimport { GroundboxSandboxFilesystem } from './filesystem.js';\nimport { GroundboxProcessManager } from './process-manager.js';\nimport { definedEnv, errorCode, retainNewest, shellQuote, sleep, toAbsolute, toSeconds } from './utils.js';\n\nconst LOG_PREFIX = '[@groundbox/mastra]';\n\n/** Metadata key that ties a Groundbox sandbox to this sandbox's logical id. */\nexport const MASTRA_ID_METADATA_KEY = 'mastra-sandbox-id';\n/** Kept snapshots written by `snapshot()` are labelled `mastra:<checkpoint name>`. */\nconst CHECKPOINT_LABEL_PREFIX = 'mastra:';\n\nconst DEFAULT_COMMAND_TIMEOUT_MS = 300_000;\n/** `POST /exec` waits for at most an hour; longer commands go over the stream. */\nconst MAX_RUN_COMMAND_MS = 3_600_000;\nconst DEFAULT_MAX_RETAINED_BYTES = 1_048_576;\n/** Statuses a sandbox passes through on its way somewhere else. */\nconst TRANSITIONAL: ReadonlySet<string> = new Set(['queued', 'starting', 'resuming', 'pausing', 'shutting_down']);\n/** Statuses of a sandbox that has ended for good. */\nconst ENDED: ReadonlySet<string> = new Set(['stopping', 'stopped', 'failed']);\nconst SETTLE_TIMEOUT_MS = 300_000;\nconst SETTLE_POLL_MS = 1_000;\n\ntype InstructionsOption =\n | string\n | ((opts: { defaultInstructions: string; requestContext?: RequestContext }) => string);\n\n/** A Groundbox volume to attach at creation. */\nexport interface GroundboxVolumeMount {\n /** Volume id (`vol_...`) or name. */\n volume: string;\n /** Absolute path in the sandbox. */\n path: string;\n /** Read-only, so other sandboxes can attach it too. */\n readOnly?: boolean;\n}\n\n/** A Linux desktop with Chrome, for computer use. */\nexport interface GroundboxDesktopOptions {\n width?: number;\n height?: number;\n /** Page Chrome opens at start. */\n startUrl?: string;\n /** Record the session. */\n recording?: boolean;\n}\n\nexport interface GroundboxSandboxOptions extends Omit<MastraSandboxOptions, 'processes'> {\n /**\n * Logical id of this sandbox. A Groundbox sandbox started for it carries the id in its\n * metadata (`mastra-sandbox-id`), so a later `start()` with the same id, in this process or\n * another, reconnects to it (resuming it when paused) instead of creating a new one.\n */\n id?: string;\n /** Reattach to this Groundbox sandbox (`sbx_...`) first, when it is still there. */\n sandboxId?: string;\n /** API key. Defaults to the GROUNDBOX_API_KEY environment variable. */\n apiKey?: string;\n /** API base URL, ending in /v1. Defaults to GROUNDBOX_API_URL, then https://api.groundbox.dev/v1. */\n baseUrl?: string;\n /** A Groundbox client to use instead of making one (tests, a custom fetch or WebSocket). */\n client?: Groundbox;\n /**\n * Default timeout for a command, in milliseconds.\n * @default 300_000 (5 minutes)\n */\n timeout?: number;\n /** vCPUs, 1 to 16. @default 2 */\n cpus?: number;\n /** Memory in GB, up to 4 per vCPU. @default 2 per vCPU */\n memoryGb?: number;\n /** Disk in GB (a minimum: never smaller than the image's disk). @default 20 */\n diskGb?: number;\n /** Start from a public Docker image (`python:3.12-slim`) or one in your Groundbox registry. Commands then run as root. */\n image?: string;\n /** Start from a Groundbox template (id or name), built ahead with `create_template`. */\n template?: string;\n /** Start from a kept Groundbox snapshot (`snap_...`): its memory, disk and processes. */\n snapshotId?: string;\n /**\n * Environment for every command: set on the Groundbox sandbox at creation, and kept as\n * Mastra's runtime overlay (change it later with `setEnv`).\n */\n env?: Record<string, string>;\n /** Metadata pairs on the Groundbox sandbox (list and filter sandboxes by them). */\n metadata?: Record<string, string>;\n /** Names of team secrets to expose as environment variables of the same names. */\n secrets?: string[];\n /** Environment variable name to team secret name. */\n envFromSecrets?: Record<string, string>;\n /** Hosts the sandbox may reach; everything else is blocked. Names, `*.wildcards`, IPv4 addresses and networks. */\n allowHosts?: string[];\n /** Hosts the sandbox may not reach. */\n denyHosts?: string[];\n /** Volumes to attach at creation. A sandbox with volumes cannot be paused, so `stop()` shuts it down instead. */\n volumes?: GroundboxVolumeMount[];\n /**\n * How long the Groundbox sandbox may live, in minutes, from its last start or wake (up to\n * 43,200). What happens then is `onTimeout`.\n * @default 60\n */\n timeoutMinutes?: number;\n /**\n * What the sandbox's timeout does: delete it, shut it down keeping its disk, or pause it.\n * `stop` and `pause` need the paid plan.\n * @default 'delete'\n */\n onTimeout?: 'delete' | 'stop' | 'pause';\n /** Pause the sandbox after this many seconds with nothing using it (at least 30); the next request wakes it. */\n idleTimeoutSeconds?: number;\n /** Half price for work that can wait: it starts when a machine has spare room. */\n flex?: boolean;\n /** Start a Linux desktop with Chrome and expose Mastra's computer-use tools. */\n desktop?: boolean | GroundboxDesktopOptions;\n /**\n * Make port previews (`networking.getPortUrl`) public. Private previews open only for\n * members of your Groundbox team who are signed in.\n * @default false\n */\n publicPreviews?: boolean;\n /** Kept-snapshot name `snapshot()` writes to and the next start boots from. Defaults to the sandbox's id. */\n checkpointName?: string;\n /** Kept-snapshot name to boot from when `checkpointName` has none yet. */\n seedCheckpointName?: string;\n /** Replace or extend the instructions the agent gets about this sandbox. */\n instructions?: InstructionsOption;\n}\n\n/**\n * Groundbox sandbox provider for Mastra workspaces.\n *\n * @example\n * ```typescript\n * import { Workspace } from '@mastra/core/workspace';\n * import { GroundboxSandbox } from '@groundbox/mastra';\n *\n * const workspace = new Workspace({ sandbox: new GroundboxSandbox({ cpus: 2 }) });\n * ```\n */\nexport class GroundboxSandbox extends MastraSandbox<Sandbox> {\n readonly id: string;\n readonly name = 'GroundboxSandbox';\n readonly provider = 'groundbox';\n status: ProviderStatus = 'pending';\n declare readonly processes: GroundboxProcessManager;\n declare readonly computer?: SandboxComputer;\n readonly supportsCheckpoints = true;\n\n /**\n * Public HTTPS URLs for ports in the sandbox, through Groundbox previews\n * (`https://<slug>-<port>.groundbox.page`). The app must listen on 0.0.0.0. Private unless\n * `publicPreviews` is set. Previews are on the paid plan.\n */\n readonly networking: SandboxNetworking = {\n getPortUrl: async (port: number) => {\n try {\n const id = this._sandboxId ?? (await this.lookup())?.id;\n if (!id) return null;\n const preview = await this.client.expose_port(id, port, this.publicPreviews ? { public: true } : {});\n return preview.url;\n } catch (error) {\n this.logger.debug(`${LOG_PREFIX} No preview for port ${port}`, { error });\n return null;\n }\n },\n };\n\n private readonly client: Groundbox;\n private readonly commandTimeout: number;\n private readonly options: GroundboxSandboxOptions;\n private readonly publicPreviews: boolean;\n private readonly checkpointName: string;\n private _sandbox: Sandbox | null = null;\n private _sandboxId: string | undefined;\n private _preferredSandboxId: string | undefined;\n private _createdAt: Date | null = null;\n private _isRetrying = false;\n private _filesystem: GroundboxSandboxFilesystem | undefined;\n /** The `workingDirectory` option as given, apart from the detected home folder. */\n private readonly explicitWorkingDirectory: string | undefined;\n\n constructor(options: GroundboxSandboxOptions = {}) {\n const commandTimeout = options.timeout ?? DEFAULT_COMMAND_TIMEOUT_MS;\n super({\n ...options,\n name: 'GroundboxSandbox',\n processes: new GroundboxProcessManager(),\n });\n this.options = { ...options };\n this.id = options.id ?? `groundbox-sandbox-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;\n this.client =\n options.client ??\n new Groundbox({\n ...(options.apiKey !== undefined && { apiKey: options.apiKey }),\n ...(options.baseUrl !== undefined && { baseUrl: options.baseUrl }),\n userAgent: 'groundbox-mastra',\n });\n this.commandTimeout = commandTimeout;\n this.defaultCommandTimeout = commandTimeout;\n this.publicPreviews = options.publicPreviews ?? false;\n this.checkpointName = options.checkpointName ?? this.id;\n this._preferredSandboxId = options.sandboxId;\n this.explicitWorkingDirectory = options.workingDirectory;\n if (options.desktop) this.computer = createGroundboxComputer(this);\n }\n\n /** The Groundbox client this sandbox uses, for any API call this class does not wrap. */\n get groundbox(): Groundbox {\n return this.client;\n }\n\n /** The Groundbox sandbox id (`sbx_...`), once started. Persist it to reattach with `sandboxId`. */\n get sandboxId(): string | undefined {\n return this._sandboxId;\n }\n\n /** The Groundbox sandbox as last read. */\n get instance(): Sandbox {\n if (!this._sandbox) throw new SandboxNotReadyError(this.id);\n return this._sandbox;\n }\n\n /** The sandbox's disk through Groundbox's files API. Pass it as the workspace `filesystem` to give the agent file tools on it. */\n get filesystem(): GroundboxSandboxFilesystem {\n if (!this._filesystem) this._filesystem = new GroundboxSandboxFilesystem(this);\n return this._filesystem;\n }\n\n /** @internal The Groundbox sandbox id; throws when the sandbox has not been started. */\n requireSandboxId(): string {\n if (!this._sandboxId || !this._sandbox) throw new SandboxNotReadyError(this.id);\n return this._sandboxId;\n }\n\n /**\n * A sibling sandbox with this one's settings and per-instance overrides. No I/O: it creates\n * (or reconnects to the sandbox for its `id`, or reattaches to `sandboxId`) on its own start.\n * `idleTimeoutMinutes` becomes Groundbox's idle pause.\n */\n clone(options: SandboxCloneOptions = {}): GroundboxSandbox {\n const { id: _id, sandboxId: _sandboxId, checkpointName: _cp, seedCheckpointName: _seed, ...base } = this.options;\n return new GroundboxSandbox({\n ...base,\n client: this.client,\n ...(options.id !== undefined && { id: options.id }),\n ...(options.sandboxId !== undefined && { sandboxId: options.sandboxId }),\n ...(options.env !== undefined && { env: options.env }),\n ...(options.workingDirectory !== undefined && { workingDirectory: options.workingDirectory }),\n ...(options.idleTimeoutMinutes !== undefined && { idleTimeoutSeconds: Math.max(30, Math.round(options.idleTimeoutMinutes * 60)) }),\n ...(options.checkpointName !== undefined && { checkpointName: options.checkpointName }),\n ...(options.seedCheckpointName !== undefined && { seedCheckpointName: options.seedCheckpointName }),\n });\n }\n\n // ---------------------------------------------------------------------------\n // Start: find / connect / create (the base class orchestrates them)\n // ---------------------------------------------------------------------------\n\n /**\n * The Groundbox sandbox for this logical id: the one named by `sandboxId` (or the last one\n * this instance had) when it is still there, else the newest live sandbox whose metadata\n * carries this id. Errors other than not-found propagate: making a duplicate on an auth or\n * network error would be worse than failing.\n */\n protected async find(): Promise<Sandbox | undefined> {\n if (this._sandbox) return this._sandbox;\n if (this._preferredSandboxId) {\n try {\n const sandbox = await this.client.get_sandbox(this._preferredSandboxId);\n if (!ENDED.has(sandbox.status)) return sandbox;\n } catch (error) {\n if (errorCode(error) !== 'not_found') throw error;\n }\n this._preferredSandboxId = undefined;\n }\n return this.lookup();\n }\n\n /** The newest live sandbox for this logical id, without starting or resuming it. */\n private async lookup(): Promise<Sandbox | undefined> {\n const list = await this.client.list_sandboxes({ live: true, metadata: { [MASTRA_ID_METADATA_KEY]: this.id }, limit: 10 });\n return list.data.find((sandbox) => !ENDED.has(sandbox.status));\n }\n\n /** Bring an existing sandbox to `running`: wait out a transition, resume a paused one, start a shut-down one. */\n protected async connect(existing: Sandbox): Promise<void> {\n if (existing === this._sandbox && existing.status === 'running') return;\n let sandbox = await this.settle(existing);\n if (sandbox.status === 'paused') {\n this.logger.debug(`${LOG_PREFIX} Resuming ${sandbox.id} for ${this.id}`);\n sandbox = await this.client.resume_sandbox(sandbox.id);\n } else if (sandbox.status === 'shut_down') {\n this.logger.debug(`${LOG_PREFIX} Starting ${sandbox.id} for ${this.id}`);\n sandbox = await this.client.start_sandbox(sandbox.id);\n }\n if (sandbox.status !== 'running') sandbox = await this.client.wait_for_sandbox(sandbox.id);\n if (sandbox.status !== 'running') {\n throw new Error(`${LOG_PREFIX} Groundbox sandbox ${sandbox.id} is ${sandbox.status}${sandbox.error ? `: ${sandbox.error}` : ''}`);\n }\n await this.adopt(sandbox);\n this.logger.debug(`${LOG_PREFIX} Reconnected to ${sandbox.id} for ${this.id}`);\n }\n\n protected async create(): Promise<void> {\n const spec = await this.createSpec();\n this.logger.debug(`${LOG_PREFIX} Creating a sandbox for ${this.id}`);\n let sandbox = await this.client.create_sandbox(spec, { idempotencyKey: randomUUID() });\n if (sandbox.status !== 'running') sandbox = await this.client.wait_for_sandbox(sandbox.id);\n if (sandbox.status !== 'running') {\n await this.client.delete_sandbox(sandbox.id).catch(() => undefined);\n throw new Error(`${LOG_PREFIX} Groundbox sandbox ${sandbox.id} did not start (${sandbox.status})${sandbox.error ? `: ${sandbox.error}` : ''}`);\n }\n await this.adopt(sandbox);\n this.logger.debug(`${LOG_PREFIX} Created ${sandbox.id} for ${this.id}`);\n }\n\n /** The create request: this sandbox's settings, booted from a checkpoint when one is kept. */\n private async createSpec(): Promise<CreateSandboxRequest> {\n const o = this.options;\n const env = definedEnv(o.env);\n const common: CreateSandboxRequest = {\n metadata: { ...o.metadata, [MASTRA_ID_METADATA_KEY]: this.id },\n ...(Object.keys(env).length > 0 && { env }),\n ...(o.secrets && { secrets: o.secrets }),\n ...(o.envFromSecrets && { env_from_secrets: o.envFromSecrets }),\n ...(o.allowHosts && { allow_hosts: o.allowHosts }),\n ...(o.denyHosts && { deny_hosts: o.denyHosts }),\n ...(o.timeoutMinutes !== undefined && { timeout_minutes: o.timeoutMinutes }),\n ...(o.onTimeout && { on_timeout: o.onTimeout }),\n ...(o.idleTimeoutSeconds !== undefined && { idle_timeout_seconds: o.idleTimeoutSeconds }),\n ...(o.flex && { flex: true }),\n };\n const checkpoint =\n o.snapshotId === undefined\n ? ((await this.findCheckpoint(this.checkpointName)) ??\n (o.seedCheckpointName ? await this.findCheckpoint(o.seedCheckpointName) : undefined))\n : undefined;\n const snapshotId = o.snapshotId ?? checkpoint?.id;\n if (snapshotId) {\n // A sandbox from a snapshot has the snapshot's size and disk.\n return { ...common, snapshot_id: snapshotId };\n }\n const desktop =\n o.desktop === undefined || o.desktop === false\n ? undefined\n : o.desktop === true\n ? true\n : {\n ...(o.desktop.width !== undefined && { width: o.desktop.width }),\n ...(o.desktop.height !== undefined && { height: o.desktop.height }),\n ...(o.desktop.startUrl !== undefined && { start_url: o.desktop.startUrl }),\n ...(o.desktop.recording !== undefined && { recording: o.desktop.recording }),\n };\n return {\n ...common,\n ...(o.cpus !== undefined && { cpus: o.cpus }),\n ...(o.memoryGb !== undefined && { memory_gb: o.memoryGb }),\n ...(o.diskGb !== undefined && { disk_gb: o.diskGb }),\n ...(o.image !== undefined && { image: o.image }),\n ...(o.template !== undefined && { template: o.template }),\n ...(o.volumes && { volumes: o.volumes.map((v) => ({ volume: v.volume, path: v.path, read_only: v.readOnly ?? false })) }),\n ...(desktop !== undefined && { desktop }),\n };\n }\n\n /** Wait while the sandbox is between states (queued, pausing, shutting down, ...). */\n private async settle(sandbox: Sandbox): Promise<Sandbox> {\n const deadline = Date.now() + SETTLE_TIMEOUT_MS;\n let current = sandbox;\n while (TRANSITIONAL.has(current.status) && Date.now() < deadline) {\n if (current.status === 'queued' || current.status === 'starting' || current.status === 'resuming') {\n current = await this.client.wait_for_sandbox(current.id);\n continue;\n }\n await sleep(SETTLE_POLL_MS);\n current = await this.client.get_sandbox(current.id);\n }\n return current;\n }\n\n private async adopt(sandbox: Sandbox): Promise<void> {\n this._sandbox = sandbox;\n this._sandboxId = sandbox.id;\n this._preferredSandboxId = sandbox.id;\n this._createdAt = new Date(sandbox.created_at);\n await this.detectWorkingDirectory();\n }\n\n /**\n * Groundbox's own image starts commands in /home/runner. On a Docker image, a template or a\n * snapshot the home folder can differ, so it is read from the sandbox once.\n */\n private async detectWorkingDirectory(): Promise<void> {\n if (this.explicitWorkingDirectory !== undefined || !this._sandboxId) return;\n const o = this.options;\n if (!o.image && !o.template && !o.snapshotId && !this._sandbox?.snapshot_id && !this._sandbox?.template) {\n this.setWorkingDirectory('/home/runner');\n return;\n }\n try {\n const result = await this.client.run_command(this._sandboxId, 'pwd', { timeout_s: 30 });\n const dir = result.stdout.trim();\n if (result.exit_code === 0 && dir.startsWith('/')) this.setWorkingDirectory(dir);\n } catch (error) {\n this.logger.debug(`${LOG_PREFIX} Could not read the working directory`, { error });\n }\n }\n\n /** Read the Groundbox sandbox again and keep it. */\n async refresh(): Promise<Sandbox | undefined> {\n if (!this._sandboxId) return undefined;\n const sandbox = await this.client.get_sandbox(this._sandboxId);\n if (this._sandbox) this._sandbox = sandbox;\n return sandbox;\n }\n\n // ---------------------------------------------------------------------------\n // Stop / destroy\n // ---------------------------------------------------------------------------\n\n /**\n * Pause the Groundbox sandbox: memory, processes and disk are kept and only storage is\n * billed. The next start resumes it. A sandbox with volumes cannot be paused, so it is shut\n * down instead (disk kept, a cold boot on the next start).\n */\n async stop(): Promise<void> {\n const sandbox = this._sandbox ?? (await this.lookup().catch(() => undefined)) ?? null;\n // Paused processes keep running after a resume; stop following them now so their handles\n // do not report an exit. `processes.get(id)` attaches to one again after the next start.\n this.processes.detachAll();\n if (sandbox) {\n const current = await this.settle(await this.client.get_sandbox(sandbox.id).catch(() => sandbox));\n if (current.status === 'running') {\n if (this.options.volumes?.length) await this.client.stop_sandbox(current.id);\n else await this.client.pause_sandbox(current.id);\n this.logger.debug(`${LOG_PREFIX} ${this.options.volumes?.length ? 'Shut down' : 'Paused'} ${current.id} for ${this.id}`);\n }\n this._preferredSandboxId = current.id;\n }\n this._sandbox = null;\n }\n\n /** Delete the Groundbox sandbox for good. Billing stops. */\n async destroy(): Promise<void> {\n const id = this._sandboxId ?? this._preferredSandboxId ?? (await this.lookup().catch(() => undefined))?.id;\n this.processes.detachAll();\n if (id) {\n try {\n await this.client.delete_sandbox(id);\n this.logger.debug(`${LOG_PREFIX} Deleted ${id} for ${this.id}`);\n } catch (error) {\n if (errorCode(error) !== 'not_found') throw error;\n }\n }\n this._sandbox = null;\n this._sandboxId = undefined;\n this._preferredSandboxId = undefined;\n }\n\n async isReady(): Promise<boolean> {\n return this.status === 'running' && this._sandbox !== null;\n }\n\n async getInfo(): Promise<SandboxInfo> {\n const s = this._sandbox;\n return {\n id: this.id,\n name: this.name,\n provider: this.provider,\n status: this.status,\n createdAt: this._createdAt ?? new Date(),\n ...(s?.expires_at && { timeoutAt: new Date(s.expires_at) }),\n mounts: [],\n ...(s && { resources: { cpuCores: s.cpus, memoryMB: s.memory_gb * 1024, diskMB: s.disk_gb * 1024 } }),\n metadata: {\n ...(this._sandboxId && { sandboxId: this._sandboxId }),\n ...(s && { groundboxStatus: s.status }),\n ...(this.options.image && { image: this.options.image }),\n ...(this.options.template && { template: this.options.template }),\n ...(s?.snapshot_id && { snapshotId: s.snapshot_id }),\n ...(s?.desktop && { desktop: { width: s.desktop.width, height: s.desktop.height } }),\n },\n };\n }\n\n getInstructions(opts?: { requestContext?: RequestContext }): string {\n const defaultInstructions = this.defaultInstructions();\n const custom = this.options.instructions;\n if (custom === undefined) return defaultInstructions;\n if (typeof custom === 'string') return custom;\n return custom({ defaultInstructions, ...(opts?.requestContext && { requestContext: opts.requestContext }) });\n }\n\n private defaultInstructions(): string {\n const o = this.options;\n const parts: string[] = [];\n if (o.image) {\n parts.push(`Groundbox sandbox: an isolated Linux microVM started from the Docker image ${o.image}. Commands run as root.`);\n } else {\n parts.push(\n 'Groundbox sandbox: an isolated Linux (Ubuntu) microVM. Commands run as user `runner`, who has passwordless sudo, so `sudo apt-get install` works.',\n );\n }\n if (this.workingDirectory) parts.push(`Default working directory: ${this.workingDirectory}.`);\n parts.push(`Command timeout: ${Math.ceil(this.commandTimeout / 1000)}s; use background processes for servers and long jobs.`);\n if (o.allowHosts) parts.push(`Network: only these hosts are reachable: ${o.allowHosts.join(', ')}.`);\n else if (o.denyHosts) parts.push(`Network: these hosts are blocked: ${o.denyHosts.join(', ')}.`);\n if (o.desktop) parts.push('A Linux desktop with Chrome is running for computer use.');\n if (o.volumes?.length) parts.push(`Volumes: ${o.volumes.map((v) => `${v.path}${v.readOnly ? ' (read-only)' : ''}`).join(', ')}.`);\n return parts.join(' ');\n }\n\n // ---------------------------------------------------------------------------\n // Commands and files\n // ---------------------------------------------------------------------------\n\n /**\n * Run a command and wait for it. Without streaming callbacks or an abort signal this is one\n * `POST /exec` call; otherwise it is a background command followed over the exec stream.\n */\n async executeCommand(command: string, args?: string[], options: ExecuteCommandOptions = {}): Promise<CommandResult> {\n const fullCommand = args?.length ? `${command} ${args.map(shellQuote).join(' ')}` : command;\n const timeout = options.timeout ?? this.defaultCommandTimeout ?? this.commandTimeout;\n const maxRetainedBytes = options.maxRetainedBytes ?? DEFAULT_MAX_RETAINED_BYTES;\n const streamed = options.onStdout || options.onStderr || options.abortSignal || timeout > MAX_RUN_COMMAND_MS;\n if (streamed) {\n const handle = await this.processes.spawn(fullCommand, {\n ...options,\n timeout,\n maxRetainedBytes,\n stdinMode: 'ignore',\n ...(args?.length && { originalInvocation: { command, args: [...args] } }),\n });\n try {\n const result = await handle.wait();\n if (handle.exitCode === undefined) await handle.kill();\n return { ...result, command: fullCommand, ...(args && { args }) };\n } finally {\n this.processes.release(handle.pid);\n }\n }\n\n await this.ensureRunning();\n const env = definedEnv({ ...this.getEnv(), ...options.env });\n const cwd = options.cwd ?? this.workingDirectory;\n const start = Date.now();\n const result = await this.retryOnDead(async () =>\n this.client.run_command(this.requireSandboxId(), fullCommand, {\n ...(cwd !== undefined && { cwd }),\n ...(Object.keys(env).length > 0 && { env }),\n timeout_s: toSeconds(timeout),\n }),\n );\n const stdout = retainNewest(result.stdout, maxRetainedBytes);\n const stderr = retainNewest(result.stderr, maxRetainedBytes);\n return {\n success: result.exit_code === 0 && !result.timed_out,\n exitCode: result.exit_code,\n stdout: stdout.text,\n stderr: stderr.text,\n executionTimeMs: Date.now() - start,\n ...(result.timed_out && { timedOut: true, killed: true }),\n ...(stdout.dropped > 0 && { stdoutTruncated: true, stdoutDroppedBytes: stdout.dropped }),\n ...(stderr.dropped > 0 && { stderrTruncated: true, stderrDroppedBytes: stderr.dropped }),\n command: fullCommand,\n ...(args && { args }),\n };\n }\n\n /**\n * Write many files at once: they go up as one tar.gz and are unpacked in the sandbox. Modes are\n * kept. A relative path is resolved against the working directory. Files are written as the\n * sandbox user (`runner` on Groundbox's image), so a path it cannot write to fails.\n */\n async writeFiles(files: SandboxFileInput[], options?: WriteFilesOptions): Promise<void> {\n for (const file of files) if (file.mode !== undefined) validateSandboxFileMode(file.mode);\n if (options?.abortSignal?.aborted) throw new SandboxAbortError('writeFiles', options.abortSignal.reason);\n if (files.length === 0) return;\n await this.ensureRunning();\n const base = this.workingDirectory ?? '/';\n const entries = files.map((file) => {\n const abs = toAbsolute(file.path, base);\n if (abs === '/') throw new Error(`${LOG_PREFIX} Cannot write a file at /`);\n return {\n path: abs.slice(1),\n content: typeof file.content === 'string' ? file.content : new Uint8Array(file.content),\n ...(file.mode !== undefined && { mode: file.mode }),\n };\n });\n try {\n await this.retryOnDead(() =>\n this.client.upload_files(this.requireSandboxId(), '/', entries, options?.abortSignal ? { signal: options.abortSignal } : {}),\n );\n } catch (error) {\n if (options?.abortSignal?.aborted) throw new SandboxAbortError('writeFiles', options.abortSignal.reason);\n throw error;\n }\n }\n\n // ---------------------------------------------------------------------------\n // Checkpoints (Groundbox kept snapshots)\n // ---------------------------------------------------------------------------\n\n /**\n * Keep the sandbox as it is now (memory, disk and processes) as a Groundbox snapshot named\n * `checkpointName`, replacing the previous one of that name. The next sandbox started for this\n * checkpoint boots from it. Kept snapshots are on the paid plan.\n */\n async snapshot(): Promise<void> {\n if (!this._sandbox || !this._sandboxId) return;\n const label = CHECKPOINT_LABEL_PREFIX + this.checkpointName;\n const kept = await this.client.keep_snapshot({ sandbox_id: this._sandboxId, label });\n if (kept.status !== 'ready') throw new Error(`${LOG_PREFIX} Snapshot ${kept.id} is ${kept.status}${kept.error ? `: ${kept.error}` : ''}`);\n for (const old of await this.listCheckpoints(label)) {\n if (old.id !== kept.id) await this.client.delete_snapshot(old.id).catch(() => undefined);\n }\n }\n\n private async listCheckpoints(label: string): Promise<Snapshot[]> {\n const list = await this.client.list_snapshots({ limit: 100 });\n return list.data.filter((snapshot) => snapshot.label === label);\n }\n\n private async findCheckpoint(name: string): Promise<Snapshot | undefined> {\n try {\n const snapshots = await this.listCheckpoints(CHECKPOINT_LABEL_PREFIX + name);\n return snapshots\n .filter((snapshot) => snapshot.status === 'ready')\n .sort((a, b) => Date.parse(b.created_at) - Date.parse(a.created_at))[0];\n } catch (error) {\n // Kept snapshots are a paid-plan feature; a trial key just boots fresh.\n this.logger.debug(`${LOG_PREFIX} Could not list snapshots`, { error });\n return undefined;\n }\n }\n\n // ---------------------------------------------------------------------------\n // A sandbox that went away under us\n // ---------------------------------------------------------------------------\n\n /** Whether `error` came from the sandbox not running, as opposed to the call itself. */\n private async isSandboxGone(error: unknown): Promise<boolean> {\n const code = errorCode(error);\n if (code !== 'conflict' && code !== 'not_found') return false;\n if (!this._sandboxId) return false;\n try {\n const sandbox = await this.client.get_sandbox(this._sandboxId);\n if (sandbox.status === 'running') return false;\n if (ENDED.has(sandbox.status)) this._preferredSandboxId = undefined;\n return true;\n } catch (lookupError) {\n if (errorCode(lookupError) === 'not_found') {\n this._preferredSandboxId = undefined;\n return true;\n }\n return false;\n }\n }\n\n /**\n * Run `fn`; when it fails because the sandbox stopped, was paused or timed out, start it again\n * (resuming it, or making a new one when it ended) and run `fn` once more.\n */\n async retryOnDead<T>(fn: () => Promise<T>): Promise<T> {\n try {\n return await fn();\n } catch (error) {\n if (this._isRetrying || !(await this.isSandboxGone(error))) throw error;\n this.logger.debug(`${LOG_PREFIX} Sandbox ${this._sandboxId} is not running; starting it again`);\n this._isRetrying = true;\n try {\n this._sandbox = null;\n this._sandboxId = undefined;\n this.status = 'stopped';\n await this.ensureRunning();\n return await fn();\n } finally {\n this._isRetrying = false;\n }\n }\n }\n}\n","/**\n * Mastra's computer-use capability over a Groundbox agent computer (a sandbox started with\n * `desktop`): a Linux desktop with Chrome, driven through Groundbox's computer API.\n */\nimport type { ComputerActionInput } from '@groundbox/sdk';\nimport type { ComputerPosition, ComputerScreenSize, ComputerScreenshot, SandboxComputer } from '@mastra/core/workspace';\n\nimport type { GroundboxSandbox } from './sandbox.js';\n\n/** Browser-style key names to the X keysym names the desktop takes. */\nconst KEY_NAMES: Record<string, string> = {\n enter: 'Return',\n return: 'Return',\n escape: 'Escape',\n esc: 'Escape',\n backspace: 'BackSpace',\n tab: 'Tab',\n space: 'space',\n ' ': 'space',\n delete: 'Delete',\n del: 'Delete',\n insert: 'Insert',\n home: 'Home',\n end: 'End',\n pageup: 'Page_Up',\n pagedown: 'Page_Down',\n arrowup: 'Up',\n arrowdown: 'Down',\n arrowleft: 'Left',\n arrowright: 'Right',\n up: 'Up',\n down: 'Down',\n left: 'Left',\n right: 'Right',\n control: 'ctrl',\n ctrl: 'ctrl',\n shift: 'shift',\n alt: 'alt',\n option: 'alt',\n meta: 'super',\n cmd: 'super',\n command: 'super',\n super: 'super',\n win: 'super',\n capslock: 'Caps_Lock',\n};\n\n/** One key name as the desktop takes it: `Enter` is `Return`, `ArrowUp` is `Up`, F-keys and letters pass through. */\nexport function toKeysym(key: string): string {\n const mapped = KEY_NAMES[key.toLowerCase()];\n if (mapped) return mapped;\n if (/^f\\d{1,2}$/i.test(key)) return key.toUpperCase();\n return key;\n}\n\n/** A key or a chord (`['ctrl', 's']`) as one `key` action: `ctrl+s`. */\nexport function toKeyCombo(key: string | string[]): string {\n const keys = Array.isArray(key) ? key : [key];\n return keys.map(toKeysym).join('+');\n}\n\nexport function createGroundboxComputer(sandbox: GroundboxSandbox): SandboxComputer {\n const act = async (action: ComputerActionInput) =>\n sandbox.retryOnDead(async () => {\n await sandbox.ensureRunning();\n return sandbox.groundbox.computer(sandbox.requireSandboxId(), action);\n });\n return {\n async screenshot(): Promise<ComputerScreenshot> {\n const shot = await sandbox.retryOnDead(async () => {\n await sandbox.ensureRunning();\n return sandbox.groundbox.computer_screenshot(sandbox.requireSandboxId(), { format: 'png' });\n });\n return { data: new Uint8Array(Buffer.from(shot.data, 'base64')), mediaType: 'image/png' };\n },\n async leftClick(x, y) {\n await act({ action: 'left_click', coordinate: [x, y] });\n },\n async rightClick(x, y) {\n await act({ action: 'right_click', coordinate: [x, y] });\n },\n async doubleClick(x, y) {\n await act({ action: 'double_click', coordinate: [x, y] });\n },\n async moveMouse(x, y) {\n await act({ action: 'mouse_move', coordinate: [x, y] });\n },\n async drag(from: ComputerPosition, to: ComputerPosition) {\n await act({ action: 'left_click_drag', start_coordinate: [from.x, from.y], coordinate: [to.x, to.y] });\n },\n async scroll(direction, amount) {\n await act({ action: 'scroll', scroll_direction: direction, scroll_amount: Math.max(1, Math.round(amount)) });\n },\n async type(text) {\n await act({ action: 'type', text });\n },\n async press(key) {\n await act({ action: 'key', text: toKeyCombo(key) });\n },\n async getScreenSize(): Promise<ComputerScreenSize> {\n const info = await sandbox.refresh();\n if (info?.desktop) return { width: info.desktop.width, height: info.desktop.height };\n const shot = await sandbox.groundbox.computer_screenshot(sandbox.requireSandboxId(), { format: 'jpeg', max_width: 64 });\n return { width: shot.screen.width, height: shot.screen.height };\n },\n async getCursorPosition(): Promise<ComputerPosition> {\n const response = await act({ action: 'cursor_position' });\n if (!response.cursor) throw new Error('Groundbox did not return a cursor position');\n return { x: response.cursor.x, y: response.cursor.y };\n },\n async streamUrl(): Promise<string | null> {\n try {\n const link = await sandbox.retryOnDead(async () => {\n await sandbox.ensureRunning();\n return sandbox.groundbox.create_desktop_link(sandbox.requireSandboxId(), { control: false });\n });\n return link.url;\n } catch {\n return null;\n }\n },\n };\n}\n","/**\n * The disk of a Groundbox sandbox as a Mastra filesystem.\n *\n * Reads, writes, listings, stat, mkdir and deletes go through Groundbox's files API, which works\n * on any image (Groundbox adds its own tools under /opt/groundbox). Copy, move and append run as\n * one `sh` command in the sandbox, with the paths passed as arguments (never interpolated), so\n * file bytes do not round-trip through the host.\n *\n * Paths are absolute inside the sandbox. A relative path is resolved against the sandbox's\n * working directory (the home folder unless `workingDirectory` is set). Nothing is confined to a\n * root: the agent can reach every path the sandbox user can.\n */\nimport type { FileEntry as GroundboxFileEntry } from '@groundbox/sdk';\nimport {\n DirectoryNotEmptyError,\n DirectoryNotFoundError,\n FileExistsError,\n FileNotFoundError,\n IsDirectoryError,\n MastraFilesystem,\n NotDirectoryError,\n StaleFileError,\n} from '@mastra/core/workspace';\nimport type {\n CopyOptions,\n FileContent,\n FileEntry,\n FileStat,\n ListOptions,\n ProviderStatus,\n ReadOptions,\n RemoveOptions,\n WriteOptions,\n} from '@mastra/core/workspace';\nimport { posix } from 'node:path';\n\nimport type { GroundboxSandbox } from './sandbox.js';\nimport { errorCode, errorMessage, toAbsolute, toBytes } from './utils.js';\n\n/** Exit codes of the in-sandbox file scripts. */\nconst EXIT = { notFound: 20, isDirectory: 21, exists: 22, notDirectory: 23, destIsDirectory: 24 } as const;\n\nconst DEFAULT_MAX_DEPTH = 100;\nconst LIST_CONCURRENCY = 8;\n\n/** Copy `$1` to `$2`. `$3`: 1 to copy a directory's contents. `$4`: 0 to refuse an existing `$2`. */\nconst COPY_SCRIPT = `src=$1 dest=$2 recursive=$3 overwrite=$4\n[ -e \"$src\" ] || exit ${EXIT.notFound}\nif [ -d \"$src\" ]; then\n [ \"$recursive\" = 1 ] || exit ${EXIT.isDirectory}\n if [ \"$overwrite\" = 0 ] && { [ -e \"$dest\" ] || [ -L \"$dest\" ]; }; then exit ${EXIT.exists}; fi\n mkdir -p \"$dest\" && cp -R -P \"$src\"/. \"$dest\"/\n exit $?\nfi\nif [ -e \"$dest\" ] || [ -L \"$dest\" ]; then\n [ \"$overwrite\" = 0 ] && exit ${EXIT.exists}\n [ -d \"$dest\" ] && exit ${EXIT.destIsDirectory}\nfi\nmkdir -p \"$(dirname \"$dest\")\" && cp \"$src\" \"$dest\"`;\n\n/** Move `$1` to `$2`. `$3`: 0 to refuse an existing `$2`. */\nconst MOVE_SCRIPT = `src=$1 dest=$2 overwrite=$3\n{ [ -e \"$src\" ] || [ -L \"$src\" ]; } || exit ${EXIT.notFound}\nif [ -e \"$dest\" ] || [ -L \"$dest\" ]; then\n [ \"$overwrite\" = 0 ] && exit ${EXIT.exists}\n if [ -d \"$dest\" ] && [ ! -L \"$dest\" ]; then exit ${EXIT.destIsDirectory}; fi\nfi\nmkdir -p \"$(dirname \"$dest\")\" && mv -f \"$src\" \"$dest\"`;\n\n/** Append stdin to `$1`, making it and its parent when missing. */\nconst APPEND_SCRIPT = `[ -d \"$1\" ] && exit ${EXIT.isDirectory}\nmkdir -p \"$(dirname \"$1\")\" && cat >> \"$1\"`;\n\n/** For each argument: its target's type (d, f or x when broken) and the link's target. */\nconst RESOLVE_LINKS_SCRIPT = `for p do\n if [ -d \"$p\" ]; then t=d; elif [ -e \"$p\" ]; then t=f; else t=x; fi\n printf '%s\\\\t%s\\\\n' \"$t\" \"$(readlink \"$p\")\"\ndone`;\n\n/** Print the path a symlink finally points at. */\nconst REALPATH_SCRIPT = `readlink -f -- \"$1\"`;\n\nexport class GroundboxSandboxFilesystem extends MastraFilesystem {\n readonly id: string;\n readonly name = 'GroundboxSandboxFilesystem';\n readonly provider = 'groundbox';\n status: ProviderStatus = 'pending';\n\n constructor(private readonly sandbox: GroundboxSandbox) {\n super({ name: 'GroundboxSandboxFilesystem' });\n this.id = `${sandbox.id}-fs`;\n }\n\n get basePath(): string | undefined {\n return this.sandbox.workingDirectory;\n }\n\n getInstructions(): string {\n return `The disk of a Groundbox sandbox. Paths are absolute inside the sandbox; a relative path is resolved against ${this.sandbox.workingDirectory ?? 'the home folder'}.`;\n }\n\n async getCommandCwd(): Promise<string | undefined> {\n return this.sandbox.workingDirectory;\n }\n\n resolveAbsolutePath(path: string): string {\n return this.abs(path);\n }\n\n private abs(path: string): string {\n return toAbsolute(path, this.sandbox.workingDirectory ?? '/');\n }\n\n /** Run `fn` with the sandbox started, retrying once when it died under us. */\n private run<T>(fn: (id: string) => Promise<T>): Promise<T> {\n return this.sandbox.retryOnDead(async () => {\n await this.sandbox.ensureRunning();\n return fn(this.sandbox.requireSandboxId());\n });\n }\n\n private async script(script: string, args: string[], stdin?: Uint8Array): Promise<{ exitCode: number; stdout: string; stderr: string }> {\n const result = await this.run((id) =>\n this.sandbox.groundbox.run_command(id, ['sh', '-c', script, 'sh', ...args], stdin ? { stdin } : {}),\n );\n return { exitCode: result.exit_code, stdout: result.stdout, stderr: result.stderr };\n }\n\n /** The entry itself (a symlink is described, not followed), or undefined when nothing is there. */\n private async lstat(abs: string): Promise<GroundboxFileEntry | undefined> {\n try {\n return await this.run((id) => this.sandbox.groundbox.stat_file(id, abs));\n } catch (error) {\n if (errorCode(error) === 'not_found') return undefined;\n throw error;\n }\n }\n\n async readFile(path: string, options?: ReadOptions): Promise<string | Buffer> {\n const abs = this.abs(path);\n let bytes: Uint8Array;\n try {\n bytes = await this.run((id) => this.sandbox.groundbox.read_file(id, abs));\n } catch (error) {\n throw this.fileError(error, path);\n }\n const buffer = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n return options?.encoding ? buffer.toString(options.encoding) : buffer;\n }\n\n async writeFile(path: string, content: FileContent, options?: WriteOptions): Promise<void> {\n const abs = this.abs(path);\n if (options?.overwrite === false || options?.expectedMtime) {\n const current = await this.lstat(abs);\n if (current && options?.overwrite === false) throw new FileExistsError(path);\n if (options?.expectedMtime && current) {\n const actual = new Date(current.modified_at);\n if (actual.getTime() !== options.expectedMtime.getTime()) throw new StaleFileError(path, options.expectedMtime, actual);\n }\n }\n if (options?.recursive === false) await this.assertParentDirectory(abs, path);\n try {\n await this.run((id) => this.sandbox.groundbox.write_file(id, abs, toBytes(content)));\n } catch (error) {\n throw this.fileError(error, path);\n }\n }\n\n async appendFile(path: string, content: FileContent): Promise<void> {\n const abs = this.abs(path);\n const result = await this.script(APPEND_SCRIPT, [abs], toBytes(content));\n this.check(result, 'appendFile', path, { isDirectory: () => new IsDirectoryError(path) });\n }\n\n async deleteFile(path: string, options?: RemoveOptions): Promise<void> {\n const abs = this.abs(path);\n const entry = await this.lstat(abs);\n if (!entry) {\n if (options?.force) return;\n throw new FileNotFoundError(path);\n }\n if (entry.type === 'dir') throw new IsDirectoryError(path);\n await this.run((id) => this.sandbox.groundbox.delete_file(id, abs));\n }\n\n async copyFile(src: string, dest: string, options?: CopyOptions): Promise<void> {\n const result = await this.script(COPY_SCRIPT, [\n this.abs(src),\n this.abs(dest),\n options?.recursive ? '1' : '0',\n options?.overwrite === false ? '0' : '1',\n ]);\n this.check(result, 'copyFile', `${src} -> ${dest}`, {\n notFound: () => new FileNotFoundError(src),\n isDirectory: () => new IsDirectoryError(src),\n exists: () => new FileExistsError(dest),\n destIsDirectory: () => new IsDirectoryError(dest),\n });\n }\n\n async moveFile(src: string, dest: string, options?: CopyOptions): Promise<void> {\n const result = await this.script(MOVE_SCRIPT, [this.abs(src), this.abs(dest), options?.overwrite === false ? '0' : '1']);\n this.check(result, 'moveFile', `${src} -> ${dest}`, {\n notFound: () => new FileNotFoundError(src),\n exists: () => new FileExistsError(dest),\n destIsDirectory: () => new IsDirectoryError(dest),\n });\n }\n\n async mkdir(path: string, options?: { recursive?: boolean }): Promise<void> {\n const abs = this.abs(path);\n if (options?.recursive === false) {\n await this.assertParentDirectory(abs, path);\n if (await this.lstat(abs)) throw new FileExistsError(path);\n }\n try {\n await this.run((id) => this.sandbox.groundbox.make_dir(id, abs));\n } catch (error) {\n if (errorCode(error) === 'bad_request') {\n const entry = await this.lstat(abs);\n if (entry && entry.type !== 'dir') throw new FileExistsError(path);\n throw new NotDirectoryError(posix.dirname(path));\n }\n throw error;\n }\n }\n\n async rmdir(path: string, options?: RemoveOptions): Promise<void> {\n const abs = this.abs(path);\n const entry = await this.lstat(abs);\n if (!entry) {\n if (options?.force) return;\n throw new DirectoryNotFoundError(path);\n }\n if (entry.type !== 'dir') throw new NotDirectoryError(path);\n try {\n await this.run((id) => this.sandbox.groundbox.delete_file(id, abs, { recursive: options?.recursive ?? false }));\n } catch (error) {\n if (errorCode(error) === 'conflict') throw new DirectoryNotEmptyError(path);\n throw error;\n }\n }\n\n async readdir(path: string, options?: ListOptions): Promise<FileEntry[]> {\n const root = this.abs(path);\n const maxDepth = options?.recursive ? (options.maxDepth ?? DEFAULT_MAX_DEPTH) : 1;\n const result: FileEntry[] = [];\n let level: string[] = [root];\n for (let depth = 1; depth <= maxDepth && level.length > 0; depth++) {\n const next: string[] = [];\n for (let i = 0; i < level.length; i += LIST_CONCURRENCY) {\n const batch = level.slice(i, i + LIST_CONCURRENCY);\n const listed = await Promise.all(batch.map((dir) => this.listOne(dir, dir === root ? path : posix.relative(root, dir))));\n for (const entries of listed) {\n const links = entries.filter((entry) => entry.type === 'symlink');\n const resolved = links.length > 0 ? await this.resolveLinks(links.map((entry) => entry.path)) : [];\n const linkInfo = new Map(links.map((entry, index) => [entry.path, resolved[index]]));\n for (const entry of entries) {\n if (entry.type === 'other') continue;\n const name = posix.relative(root, entry.path);\n if (entry.type === 'symlink') {\n const info = linkInfo.get(entry.path);\n if (!info || info.type === 'x') continue;\n const type = info.type === 'd' ? 'directory' : 'file';\n if (type === 'file' && !matchesExtension(name, options?.extension)) continue;\n result.push({ name, type, isSymlink: true, ...(info.target && { symlinkTarget: info.target }) });\n continue;\n }\n if (entry.type === 'dir') {\n result.push({ name, type: 'directory' });\n next.push(entry.path);\n continue;\n }\n if (!matchesExtension(name, options?.extension)) continue;\n result.push({ name, type: 'file', size: entry.size_bytes });\n }\n }\n }\n level = next;\n }\n return result;\n }\n\n private async listOne(abs: string, shown: string): Promise<GroundboxFileEntry[]> {\n try {\n const listing = await this.run((id) => this.sandbox.groundbox.list_files(id, abs));\n return listing.entries;\n } catch (error) {\n const code = errorCode(error);\n if (code === 'not_found') throw new DirectoryNotFoundError(shown);\n if (code === 'bad_request') throw new NotDirectoryError(shown);\n throw error;\n }\n }\n\n private async resolveLinks(paths: string[]): Promise<Array<{ type: 'd' | 'f' | 'x'; target: string }>> {\n const result = await this.script(RESOLVE_LINKS_SCRIPT, paths);\n const lines = result.stdout.split('\\n');\n return paths.map((_, index) => {\n const [type, ...rest] = (lines[index] ?? 'x\\t').split('\\t');\n return { type: type === 'd' || type === 'f' ? type : 'x', target: rest.join('\\t') };\n });\n }\n\n async exists(path: string): Promise<boolean> {\n const abs = this.abs(path);\n return this.run((id) => this.sandbox.groundbox.file_exists(id, abs));\n }\n\n async stat(path: string): Promise<FileStat> {\n const abs = this.abs(path);\n let entry = await this.lstat(abs);\n if (entry?.type === 'symlink') {\n const target = (await this.script(REALPATH_SCRIPT, [abs])).stdout.trim();\n entry = target ? await this.lstat(target) : undefined;\n }\n if (!entry || entry.type === 'symlink') throw new FileNotFoundError(path);\n const modifiedAt = new Date(entry.modified_at);\n const isDir = entry.type === 'dir';\n return {\n name: posix.basename(abs),\n path: abs,\n type: isDir ? 'directory' : 'file',\n size: isDir ? 0 : entry.size_bytes,\n createdAt: modifiedAt,\n modifiedAt,\n };\n }\n\n private async assertParentDirectory(abs: string, path: string): Promise<void> {\n const parent = await this.lstat(posix.dirname(abs));\n if (!parent) throw new DirectoryNotFoundError(posix.dirname(path));\n if (parent.type !== 'dir') throw new NotDirectoryError(posix.dirname(path));\n }\n\n /** A files API error about one path, as the Mastra error it means. */\n private fileError(error: unknown, path: string): unknown {\n const code = errorCode(error);\n if (code === 'not_found') return new FileNotFoundError(path);\n if (code === 'bad_request') {\n const message = errorMessage(error);\n if (/is a folder|is a directory/i.test(message)) return new IsDirectoryError(path);\n if (/not a (folder|directory)/i.test(message)) return new NotDirectoryError(posix.dirname(path));\n }\n return error;\n }\n\n private check(\n result: { exitCode: number; stderr: string },\n operation: string,\n subject: string,\n errors: Partial<Record<keyof typeof EXIT, () => Error>>,\n ): void {\n if (result.exitCode === 0) return;\n for (const [outcome, code] of Object.entries(EXIT) as Array<[keyof typeof EXIT, number]>) {\n const make = errors[outcome];\n if (code === result.exitCode && make) throw make();\n }\n throw new Error(`${operation} ${subject} failed (exit ${result.exitCode}): ${result.stderr.trim()}`);\n }\n}\n\nfunction matchesExtension(name: string, extension: string | string[] | undefined): boolean {\n if (!extension) return true;\n const ext = posix.extname(name);\n return (Array.isArray(extension) ? extension : [extension]).some((e) => e === ext || e === ext.slice(1) || `.${e}` === ext);\n}\n","import { posix } from 'node:path';\n\nimport { GroundboxError } from '@groundbox/sdk';\n\n/** Quote one argument for POSIX `sh`. */\nexport function shellQuote(value: string): string {\n if (value !== '' && /^[A-Za-z0-9_\\-./=:@%+,]+$/.test(value)) return value;\n return `'${value.replace(/'/g, `'\\\\''`)}'`;\n}\n\n/** Drop undefined values from an env record. */\nexport function definedEnv(env: Record<string, string | undefined> | NodeJS.ProcessEnv | undefined): Record<string, string> {\n const out: Record<string, string> = {};\n if (!env) return out;\n for (const [key, value] of Object.entries(env)) {\n if (value !== undefined) out[key] = value;\n }\n return out;\n}\n\n/** Milliseconds to the whole seconds the Groundbox API takes, at least 1. */\nexport function toSeconds(ms: number): number {\n return Math.max(1, Math.ceil(ms / 1000));\n}\n\n/** Absolute path inside the sandbox; a relative one is resolved against `base`. */\nexport function toAbsolute(path: string, base = '/'): string {\n return posix.resolve(base, path);\n}\n\n/** The API's error code when `error` is a GroundboxError. */\nexport function errorCode(error: unknown): string | undefined {\n if (error instanceof GroundboxError) return error.code;\n if (error && typeof error === 'object' && 'code' in error && typeof (error as { code: unknown }).code === 'string') {\n return (error as { code: string }).code;\n }\n return undefined;\n}\n\nexport function errorStatus(error: unknown): number | undefined {\n if (error && typeof error === 'object' && 'status' in error && typeof (error as { status: unknown }).status === 'number') {\n return (error as { status: number }).status;\n }\n return undefined;\n}\n\nexport function errorMessage(error: unknown): string {\n if (error instanceof Error) return error.message;\n return String(error);\n}\n\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Keep the newest `maxBytes` UTF-8 bytes of `text`, as the process handles do.\n * Infinity keeps everything; 0 keeps nothing.\n */\nexport function retainNewest(text: string, maxBytes: number): { text: string; dropped: number } {\n if (!Number.isFinite(maxBytes)) return { text, dropped: 0 };\n const bytes = Buffer.from(text, 'utf8');\n if (bytes.length <= maxBytes) return { text, dropped: 0 };\n const dropped = bytes.length - maxBytes;\n let start = dropped;\n // Do not start in the middle of a multi-byte character.\n while (start < bytes.length && (bytes[start]! & 0xc0) === 0x80) start++;\n return { text: bytes.subarray(start).toString('utf8'), dropped: start };\n}\n\n/** Bytes of a FileContent. */\nexport function toBytes(content: string | Buffer | Uint8Array): Uint8Array {\n if (typeof content === 'string') return Buffer.from(content, 'utf8');\n return content;\n}\n","/**\n * Groundbox process manager.\n *\n * Every spawn is a Groundbox background command (`POST /sandboxes/{id}/commands`), so it runs on\n * in the sandbox with nobody connected and has an id (`ex_...`) at once. Its output is followed\n * over the exec stream (`attach_command`), which reconnects by itself and reads on from where it\n * was, so a dropped connection loses no output. Kill, stdin and close-stdin go through the same\n * command id. A command started in another process can be picked up again with `get(id)`.\n */\nimport type { CommandStream, Groundbox, SandboxCommand } from '@groundbox/sdk';\nimport { ProcessHandle, SandboxProcessManager } from '@mastra/core/workspace';\nimport type { CommandResult, ProcessInfo, SpawnProcessOptions } from '@mastra/core/workspace';\n\nimport type { GroundboxSandbox } from './sandbox.js';\nimport { definedEnv, errorCode, sleep, toSeconds } from './utils.js';\n\n/** Exit code Groundbox reports for a command it killed (SIGKILL), also on a timeout. */\nconst KILLED_EXIT_CODE = 137;\n/**\n * A spawn with no timeout (a dev server, a watcher) gets the longest the API allows, 30 days, so\n * it runs for as long as the sandbox does instead of stopping at the API's default.\n */\nconst NO_TIMEOUT_S = 2_592_000;\n/** How often a command is read when its output stream failed and only its state is left. */\nconst POLL_MS = 1000;\n\nexport interface GroundboxProcessManagerOptions {\n /** Default timeout in milliseconds for commands that don't specify one. Unset: no timeout (the sandbox's lifetime). */\n defaultTimeout?: number;\n}\n\ntype Ended = { exit_code: number; duration_ms: number; timed_out: boolean };\n\n/** A Groundbox command, as Mastra's ProcessHandle. */\nexport class GroundboxProcessHandle extends ProcessHandle {\n readonly pid: string;\n private _exitCode: number | undefined;\n private _timedOut = false;\n private _killed = false;\n private _detached = false;\n private _waitPromise: Promise<CommandResult> | undefined;\n private readonly _ended: Promise<Ended>;\n\n constructor(\n pid: string,\n private readonly client: Groundbox,\n private readonly sandboxId: string,\n private readonly stream: CommandStream | undefined,\n private readonly startTime: number,\n private readonly stdinOpen: boolean,\n options?: SpawnProcessOptions,\n ended?: Ended,\n ) {\n super(options);\n this.pid = pid;\n if (ended) {\n this._ended = Promise.resolve(ended);\n this.settle(ended);\n } else if (stream) {\n this._ended = stream.done.then(\n (result) => {\n this.settle(result);\n return result;\n },\n (error: unknown) => {\n if (this._detached) throw error;\n return this.pollUntilEnded();\n },\n );\n } else {\n this._ended = this.pollUntilEnded();\n }\n // Never leave an unhandled rejection behind when nobody calls wait().\n this._ended.catch(() => undefined);\n }\n\n get exitCode(): number | undefined {\n return this._exitCode;\n }\n\n private settle(result: Ended): void {\n if (this._exitCode !== undefined) return;\n this._exitCode = result.exit_code;\n this._timedOut = result.timed_out;\n }\n\n /** The output stream failed for good: read the command's state until it ends. */\n private async pollUntilEnded(): Promise<Ended> {\n for (;;) {\n let command: SandboxCommand;\n try {\n command = await this.client.get_command(this.sandboxId, this.pid);\n } catch (error) {\n const code = errorCode(error);\n if (code === 'not_found' || code === 'conflict') {\n const ended = { exit_code: this._killed ? KILLED_EXIT_CODE : 1, duration_ms: Date.now() - this.startTime, timed_out: false };\n this.settle(ended);\n return ended;\n }\n throw error;\n }\n if (command.state !== 'running') {\n const ended = {\n exit_code: command.exit_code ?? (command.state === 'lost' ? KILLED_EXIT_CODE : 1),\n duration_ms: command.duration_ms ?? Date.now() - this.startTime,\n timed_out: command.timed_out,\n };\n this.settle(ended);\n return ended;\n }\n await sleep(POLL_MS);\n }\n }\n\n async wait(): Promise<CommandResult> {\n if (!this._waitPromise) this._waitPromise = this.doWait();\n return this._waitPromise;\n }\n\n private async doWait(): Promise<CommandResult> {\n const ended = await this._ended;\n // Output that arrived with the exit message has been emitted by now.\n const exitCode = this._exitCode ?? ended.exit_code;\n const timedOut = this._timedOut;\n const result: CommandResult = {\n success: exitCode === 0 && !timedOut,\n exitCode,\n stdout: this.stdout,\n stderr: this.stderr,\n executionTimeMs: Date.now() - this.startTime,\n ...(timedOut && { timedOut: true }),\n ...((this._killed || timedOut) && { killed: true }),\n ...(this.stdoutTruncated && { stdoutTruncated: true, stdoutDroppedBytes: this.stdoutDroppedBytes }),\n ...(this.stderrTruncated && { stderrTruncated: true, stderrDroppedBytes: this.stderrDroppedBytes }),\n };\n return result;\n }\n\n async kill(): Promise<boolean> {\n if (this._exitCode !== undefined) return false;\n this._killed = true;\n try {\n const command = await this.client.kill_command(this.sandboxId, this.pid);\n if (command.state !== 'running' && command.exit_code !== null) {\n this.settle({ exit_code: command.exit_code, duration_ms: command.duration_ms ?? 0, timed_out: command.timed_out });\n }\n } catch (error) {\n const code = errorCode(error);\n if (code === 'not_found' || code === 'conflict') return false;\n throw error;\n }\n return true;\n }\n\n async sendStdin(data: string): Promise<void> {\n if (this._exitCode !== undefined) throw new Error(`Process ${this.pid} has already exited with code ${this._exitCode}`);\n if (!this.stdinOpen || !this.stream) throw new Error(`Process ${this.pid} was started without stdin (stdinMode: 'ignore')`);\n this.stream.write(data);\n }\n\n async closeStdin(): Promise<void> {\n if (this._exitCode !== undefined) return;\n if (!this.stdinOpen || !this.stream) throw new Error(`Process ${this.pid} was started without stdin (stdinMode: 'ignore')`);\n this.stream.end();\n }\n\n /** Stop following the output; the command runs on in the sandbox. */\n detach(): void {\n if (this._exitCode !== undefined || this._detached) return;\n this._detached = true;\n this.stream?.detach();\n }\n}\n\n/**\n * Mastra process manager over Groundbox background commands.\n */\nexport class GroundboxProcessManager extends SandboxProcessManager<GroundboxSandbox> {\n private readonly defaultTimeout: number | undefined;\n\n constructor(options: GroundboxProcessManagerOptions = {}) {\n super();\n this.defaultTimeout = options.defaultTimeout;\n }\n\n async spawn(command: string, options: SpawnProcessOptions = {}): Promise<ProcessHandle> {\n const timeout = options.timeout ?? this.defaultTimeout;\n const cwd = options.cwd ?? this.sandbox.workingDirectory;\n const env = definedEnv(options.env);\n const stdinOpen = options.stdinMode !== 'ignore';\n return this.sandbox.retryOnDead(async () => {\n const client = this.sandbox.groundbox;\n const sandboxId = this.sandbox.requireSandboxId();\n const startTime = Date.now();\n const started = await client.start_command(sandboxId, command, {\n ...(cwd !== undefined && { cwd }),\n ...(Object.keys(env).length > 0 && { env }),\n timeout_s: timeout !== undefined ? Math.min(toSeconds(timeout), NO_TIMEOUT_S) : NO_TIMEOUT_S,\n stdin: stdinOpen,\n });\n let handle: GroundboxProcessHandle | undefined;\n const early: Array<['stdout' | 'stderr', string]> = [];\n const stream = client.attach_command(sandboxId, started.id, { seq: 0 }, {\n onStdout: (text) => (handle ? handle.emitStdout(text) : early.push(['stdout', text])),\n onStderr: (text) => (handle ? handle.emitStderr(text) : early.push(['stderr', text])),\n });\n handle = new GroundboxProcessHandle(started.id, client, sandboxId, stream, startTime, stdinOpen, options);\n for (const [kind, text] of early.splice(0)) {\n if (kind === 'stdout') handle.emitStdout(text);\n else handle.emitStderr(text);\n }\n this._tracked.set(handle.pid, handle);\n return handle;\n });\n }\n\n async list(): Promise<ProcessInfo[]> {\n const result: ProcessInfo[] = [];\n for (const [pid, handle] of this._tracked) {\n result.push({\n pid,\n ...(handle.command !== undefined && { command: handle.command }),\n running: handle.exitCode === undefined,\n ...(handle.exitCode !== undefined && { exitCode: handle.exitCode }),\n });\n }\n return result;\n }\n\n /**\n * A tracked process, or a Groundbox command this manager did not start (by its `ex_...` id),\n * attached from the start of its kept output.\n */\n async get(pid: string, options?: { release?: boolean }): Promise<ProcessHandle | undefined> {\n const tracked = this._tracked.get(pid);\n if (tracked) return tracked;\n if (!pid.startsWith('ex_')) return undefined;\n const client = this.sandbox.groundbox;\n const sandboxId = this.sandbox.sandboxId;\n if (!sandboxId) return undefined;\n let command: SandboxCommand;\n try {\n command = await client.get_command(sandboxId, pid);\n } catch (error) {\n if (errorCode(error) === 'not_found') return undefined;\n throw error;\n }\n const startTime = command.started_at ? Date.parse(command.started_at) : Date.now();\n let handle: GroundboxProcessHandle | undefined;\n const early: Array<['stdout' | 'stderr', string]> = [];\n const stream = command.output_kept || command.state === 'running'\n ? client.attach_command(sandboxId, pid, { seq: 0 }, {\n onStdout: (text) => (handle ? handle.emitStdout(text) : early.push(['stdout', text])),\n onStderr: (text) => (handle ? handle.emitStderr(text) : early.push(['stderr', text])),\n })\n : undefined;\n handle = new GroundboxProcessHandle(pid, client, sandboxId, stream, startTime, command.stdin);\n for (const [kind, text] of early.splice(0)) {\n if (kind === 'stdout') handle.emitStdout(text);\n else handle.emitStderr(text);\n }\n const commandLine = command.cmd ?? command.args?.join(' ');\n if (commandLine) handle.command = commandLine;\n // The base class releases an exited process after this read unless `release: false`.\n void options;\n this._tracked.set(pid, handle);\n return handle;\n }\n\n /** Stop following every tracked process's output and forget them (the sandbox is going away). */\n detachAll(): void {\n for (const pid of [...this._tracked.keys()]) this.release(pid);\n }\n\n /** Release a process and stop following its output. */\n release(pid: string): void {\n const handle = this._tracked.get(pid);\n if (handle instanceof GroundboxProcessHandle) handle.detach();\n super.release(pid);\n }\n}\n","/**\n * Groundbox sandbox provider descriptor for the Mastra editor.\n *\n * @example\n * ```typescript\n * import { MastraEditor } from '@mastra/editor';\n * import { groundboxSandboxProvider } from '@groundbox/mastra';\n *\n * const editor = new MastraEditor({ sandboxes: [groundboxSandboxProvider] });\n * ```\n */\nimport type { SandboxProvider } from '@mastra/core/editor';\n\nimport { GroundboxSandbox } from './sandbox.js';\n\n/** The serializable subset of GroundboxSandboxOptions the editor stores. */\nexport interface GroundboxProviderConfig {\n cpus?: number;\n memoryGb?: number;\n diskGb?: number;\n image?: string;\n template?: string;\n timeout?: number;\n timeoutMinutes?: number;\n idleTimeoutSeconds?: number;\n env?: Record<string, string>;\n metadata?: Record<string, string>;\n allowHosts?: string[];\n denyHosts?: string[];\n desktop?: boolean;\n publicPreviews?: boolean;\n apiKey?: string;\n baseUrl?: string;\n}\n\nexport const groundboxSandboxProvider: SandboxProvider<GroundboxProviderConfig> = {\n id: 'groundbox',\n name: 'Groundbox Sandbox',\n description: 'Firecracker microVM Linux sandbox from Groundbox',\n configSchema: {\n type: 'object',\n properties: {\n cpus: { type: 'number', description: 'vCPUs, 1 to 16', default: 2 },\n memoryGb: { type: 'number', description: 'Memory in GB, up to 4 per vCPU' },\n diskGb: { type: 'number', description: 'Disk in GB', default: 20 },\n image: { type: 'string', description: 'Docker image to start from (commands then run as root)' },\n template: { type: 'string', description: 'Groundbox template id or name' },\n timeout: { type: 'number', description: 'Command timeout in milliseconds', default: 300_000 },\n timeoutMinutes: { type: 'number', description: 'Sandbox lifetime in minutes', default: 60 },\n idleTimeoutSeconds: { type: 'number', description: 'Pause after this many idle seconds (at least 30)' },\n env: { type: 'object', description: 'Environment variables', additionalProperties: { type: 'string' } },\n metadata: { type: 'object', description: 'Metadata pairs', additionalProperties: { type: 'string' } },\n allowHosts: { type: 'array', items: { type: 'string' }, description: 'Hosts the sandbox may reach' },\n denyHosts: { type: 'array', items: { type: 'string' }, description: 'Hosts the sandbox may not reach' },\n desktop: { type: 'boolean', description: 'Start a Linux desktop with Chrome for computer use', default: false },\n publicPreviews: { type: 'boolean', description: 'Make port previews public', default: false },\n apiKey: { type: 'string', description: 'Groundbox API key (defaults to GROUNDBOX_API_KEY)' },\n baseUrl: { type: 'string', description: 'Groundbox API URL' },\n },\n },\n createSandbox: (config) => new GroundboxSandbox(config),\n};\n"],"mappings":";AASA,SAAS,kBAAkB;AAE3B,SAAS,iBAAiB;AAG1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACTP,IAAM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,yDAAyD;AAAA,MAC/F,UAAU,EAAE,MAAM,UAAU,aAAa,gCAAgC;AAAA,MACzE,SAAS,EAAE,MAAM,UAAU,aAAa,mCAAmC,SAAS,IAAQ;AAAA,MAC5F,gBAAgB,EAAE,MAAM,UAAU,aAAa,+BAA+B,SAAS,GAAG;AAAA,MAC1F,oBAAoB,EAAE,MAAM,UAAU,aAAa,mDAAmD;AAAA,MACtG,KAAK,EAAE,MAAM,UAAU,aAAa,yBAAyB,sBAAsB,EAAE,MAAM,SAAS,EAAE;AAAA,MACtG,UAAU,EAAE,MAAM,UAAU,aAAa,kBAAkB,sBAAsB,EAAE,MAAM,SAAS,EAAE;AAAA,MACpG,YAAY,EAAE,MAAM,SAAS,OAAO,EAAE,MAAM,SAAS,GAAG,aAAa,8BAA8B;AAAA,MACnG,WAAW,EAAE,MAAM,SAAS,OAAO,EAAE,MAAM,SAAS,GAAG,aAAa,kCAAkC;AAAA,MACtG,SAAS,EAAE,MAAM,WAAW,aAAa,sDAAsD,SAAS,MAAM;AAAA,MAC9G,gBAAgB,EAAE,MAAM,WAAW,aAAa,6BAA6B,SAAS,MAAM;AAAA,MAC5F,QAAQ,EAAE,MAAM,UAAU,aAAa,oDAAoD;AAAA,MAC3F,SAAS,EAAE,MAAM,UAAU,aAAa,oBAAoB;AAAA,IAC9D;AAAA,EACF;AAAA,EACA,eAAe,CAAC,WAAW,IAAI,iBAAiB,MAAM;AACxD;","names":["posix","posix","result"]}
package/package.json CHANGED
@@ -1,6 +1,72 @@
1
1
  {
2
2
  "name": "@groundbox/mastra",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Groundbox sandbox provider for Mastra workspaces: Firecracker microVM Linux sandboxes for agents.",
5
+ "keywords": [
6
+ "mastra",
7
+ "workspace",
8
+ "sandbox",
9
+ "groundbox",
10
+ "agents",
11
+ "microvm"
12
+ ],
13
+ "license": "MIT",
14
+ "homepage": "https://github.com/Ground-box/groundbox-integrations/tree/main/packages/mastra",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/Ground-box/groundbox-integrations.git",
18
+ "directory": "packages/mastra"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/Ground-box/groundbox-integrations/issues"
22
+ },
23
+ "type": "module",
24
+ "main": "./dist/index.cjs",
25
+ "module": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "import": {
30
+ "types": "./dist/index.d.ts",
31
+ "default": "./dist/index.js"
32
+ },
33
+ "require": {
34
+ "types": "./dist/index.d.cts",
35
+ "default": "./dist/index.cjs"
36
+ }
37
+ },
38
+ "./package.json": "./package.json"
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "README.md",
43
+ "LICENSE"
44
+ ],
45
+ "sideEffects": false,
46
+ "engines": {
47
+ "node": ">=22.13.0"
48
+ },
49
+ "scripts": {
50
+ "build": "tsup",
51
+ "typecheck": "tsc --noEmit",
52
+ "test": "vitest run test/unit",
53
+ "test:live": "vitest run test/live",
54
+ "prepublishOnly": "npm run build"
55
+ },
56
+ "dependencies": {
57
+ "@groundbox/sdk": "^0.4.2"
58
+ },
59
+ "peerDependencies": {
60
+ "@mastra/core": ">=1.80.0-0 <2.0.0-0"
61
+ },
62
+ "devDependencies": {
63
+ "@mastra/core": "1.85.0",
64
+ "@types/node": "22.20.5",
65
+ "tsup": "8.5.1",
66
+ "typescript": "5.9.3",
67
+ "vitest": "4.1.12"
68
+ },
69
+ "publishConfig": {
70
+ "access": "public"
71
+ }
72
+ }