AlpineSandbox

class AlpineSandbox(context: Context, workspace: File, image: RootfsImage? = RootfsImage.forDevice(), home: File = File(context.filesDir, "sandbox/alpine")) : ShellRuntime(source)

A Linux sandbox for the agent's shell: PRoot (bundled, built from upstream termux/proot) runs an Alpine Linux root filesystem as an unprivileged user-space "container". The agent gets a real /bin/sh, BusyBox and apk, so it can install Python, git, compilers… without root and without touching the rest of the app.

The root filesystem is downloaded (pinned, checksum-verified) on first use into app storage; state reports progress. workspace is mounted at /workspace (the working directory), so files the agent edits with the file tools and the shell are the same.

The app must package native libraries extracted (packaging.jniLibs.useLegacyPackaging = true): Android only lets apps execute files in their native library directory.

Constructors

Link copied to clipboard
constructor(context: Context, workspace: File, image: RootfsImage? = RootfsImage.forDevice(), home: File = File(context.filesDir, "sandbox/alpine"))

Types

Link copied to clipboard
sealed interface State

Properties

Link copied to clipboard
open override val description: String
Link copied to clipboard
open override val isolated: Boolean = true
Link copied to clipboard
val state: StateFlow<AlpineSandbox.State>

Functions

Link copied to clipboard
open suspend override fun prepare()
Link copied to clipboard
suspend fun reset()

Remove the root filesystem (everything installed with apk is lost; the workspace is kept).

Link copied to clipboard
open override fun start(command: String): Process