Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFactory ¶
func NewFactory(cfg Config) (sandboxpkg.Factory, error)
NewFactory returns a Factory backed by a Docker container-per-session strategy.
When cfg.StellaHome is non-empty, construction performs I/O:
- Runtime mode resolution: reads $STELLA_DOCKER_SANDBOX_MODE and the matching mode-specific env ($STELLA_HOME_HOST or $STELLA_HOME_VOLUME). No container runtime auto-detection is used.
- User tool resolution: loads the builtin and user plugin manifests ($STELLA_HOME/plugins.yaml) to populate UserToolBinaries.
Both steps are skipped when StellaHome is empty (e.g. unit tests), making construction cheap and infallible in that case.
func Preflight ¶
func Preflight(ctx context.Context, cfg PreflightConfig) error
Preflight checks daemon reachability and image availability. A missing image is pulled automatically; the caller is expected to have built or published the image ahead of time for dev builds (the pull will fail with a registry error in that case).
Types ¶
type Config ¶
type Config struct {
// Image is the container image to use. Required.
Image string
// StellaHome is the stella-process-view home directory. When stellad runs
// inside a container this is the in-container path; when it runs on the host
// this is the host path. Used for orphan cleanup scoping, preflight checks,
// DooD path translation, and resolving user tool binaries from the plugins
// manifest.
StellaHome string
// RuntimeMode declares how the Docker daemon can access STELLA_HOME. Normally
// auto-derived from STELLA_DOCKER_SANDBOX_MODE by NewFactory.
RuntimeMode DockerSandboxMode
// ContainerPathPrefix / HostPathPrefix enable bind-mount path alignment when
// stella runs inside a container and talks to the daemon on the host (DooD).
// Normally auto-derived from STELLA_HOME_HOST by NewFactory; only set
// explicitly in tests or when overriding the default detection.
ContainerPathPrefix string
HostPathPrefix string
// StellaHomeVolume is the Docker named volume that backs STELLA_HOME.
// Set this (via STELLA_HOME_VOLUME env) when stella runs inside a container
// whose STELLA_HOME is a Docker named volume. Sandbox sessions then use
// volume subpath mounts (requires Docker Engine 25+) instead of bind mounts,
// so the host daemon never needs a host-filesystem-visible path.
// Normally auto-derived from STELLA_HOME_VOLUME by NewFactory.
StellaHomeVolume string
// SandboxNetwork, when set, attaches sandbox containers to this Docker
// network instead of the daemon default bridge. Required in DooD setups
// where stellad and the sandbox are separate containers: without a shared
// network the sandbox cannot reach stellad, so server-backed CLI commands
// (stella task/goal, recally) fail with connection refused. Set via
// STELLA_SANDBOX_NETWORK, otherwise auto-detected by NewFactory from the
// network stellad's own container is on.
SandboxNetwork string
// ServerURL, when set, is injected into the sandbox as STELLA_SERVER_URL so
// CLI commands inside the sandbox reach stellad over SandboxNetwork instead
// of the default 127.0.0.1 loopback (which, inside a separate sandbox
// container, points at nothing). Set via STELLA_SANDBOX_SERVER_URL, otherwise
// auto-detected by NewFactory as stellad's address on SandboxNetwork.
ServerURL string
// UserToolBinaries are manifest-declared, user-configured CLIs that are not
// baked into the versioned sandbox image. They are installed in a Linux
// helper container and exposed to sessions through a Docker-managed tool
// cache, never through host $STELLA_HOME/bin.
// Normally auto-resolved by NewFactory from $STELLA_HOME/plugins.yaml.
UserToolBinaries []ToolBinary
}
Config configures the docker sandbox factory.
func (Config) TranslateToDaemonPath ¶
TranslateToDaemonPath rewrites a stella-process-view absolute path into the path the daemon will use as a bind-mount source. When prefix translation is not configured, the input is returned unchanged.
type DockerSandboxMode ¶ added in v0.44.1
type DockerSandboxMode string
DockerSandboxMode describes how the Docker daemon sees STELLA_HOME.
const ( // DockerSandboxModeHost means stellad runs on the same host namespace as the // Docker daemon, so stella-process paths are already daemon-visible. DockerSandboxModeHost DockerSandboxMode = "host" // DockerSandboxModeBind means stellad runs in a container and STELLA_HOME is a // host bind mount. STELLA_HOME_HOST provides the daemon-visible host path. DockerSandboxModeBind DockerSandboxMode = "bind" // DockerSandboxModeVolume means stellad runs in a container and STELLA_HOME is // backed by a Docker named volume. STELLA_HOME_VOLUME provides the volume name. DockerSandboxModeVolume DockerSandboxMode = "volume" )
type PreflightConfig ¶
PreflightConfig configures a Preflight check.
type ToolBinary ¶
type ToolBinary struct {
Name string
Tool string // mise tool key: uv, bun, github:owner/repo, pipx:pkg, npm:pkg, http:name
Version string
Options map[string]any // mise tool options, using the same names as mise.toml
}
ToolBinary describes a user-configured CLI that must be installed in a Linux container context before docker sandbox sessions can execute it. Fields mirror manifestplugins.ManifestBinary 1:1; keep them in sync.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dockerclient wraps the moby Go SDK (github.com/moby/moby/client) to manage sandbox containers for the docker sandbox backend.
|
Package dockerclient wraps the moby Go SDK (github.com/moby/moby/client) to manage sandbox containers for the docker sandbox backend. |