feat(runtime): pluggable sandbox backend registry
``STRIX_RUNTIME_BACKEND`` was already declared on ``Config`` but never read — ``session_manager`` hard-coded ``StrixDockerSandboxClient`` plus ``DockerSandboxClientOptions`` plus ``docker.from_env()`` directly into the call site. Adding a second backend would have meant retrofitting every Docker-specific import. Move all of that behind a registry: - ``strix/runtime/backends.py``: maps backend names to async factories ``(image, manifest, exposed_ports) -> (client, session)``. Ships with ``"docker"``; ``register_backend`` lets downstream users plug in Daytona / K8s / Modal / etc. without forking. - Each backend's deps are imported lazily inside its factory, so a K8s-only deployment doesn't need ``docker-py`` installed (and vice-versa). - ``session_manager`` reads the config name, looks up the backend, calls it. Zero Docker imports remain. - Unknown backend name raises ``ValueError`` with the supported list, so ``STRIX_RUNTIME_BACKEND=docke`` typos surface immediately. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -204,6 +204,9 @@ ignore = [
|
||||
"TC003", # collections.abc.AsyncIterator imported for return type
|
||||
]
|
||||
# Custom Docker subclass duplicates parent body; some imports are for annotations.
|
||||
# Backend factories import their backend's deps lazily so deployments
|
||||
# that pick a different backend don't need every backend's libs installed.
|
||||
"strix/runtime/backends.py" = ["PLC0415"]
|
||||
"strix/runtime/docker_client.py" = [
|
||||
"TC002", # Manifest, Container imported for annotations
|
||||
"TC003", # uuid imported for annotation
|
||||
|
||||
Reference in New Issue
Block a user