refactor: replace runtime.dockerfile with AgentProvider.dockerfile property

Drop the `dockerfile` field from `AgentProviderRuntime` and replace it
with a convention-based `dockerfile` property on `AgentProvider`: the
base class looks for a `Dockerfile` file next to the provider's own
`agent_provider.py` module (via `inspect.getfile`), returning its path
or None. Built-in providers inherit the default automatically; custom
user providers work the same way by dropping a Dockerfile next to their
plugin file; any provider needing a non-standard path can override.

All callers (`docker/prepare.py`, `smolmachines/prepare.py`,
`capability_apply.py`) now resolve the provider object once and call
`.dockerfile` directly instead of reading `runtime.dockerfile`.
This commit is contained in:
2026-06-08 03:56:04 +00:00
committed by didericis
parent afe5d43a9a
commit ee0607f022
9 changed files with 44 additions and 39 deletions
+13 -1
View File
@@ -20,6 +20,7 @@ Per PRD 0050 the per-provider implementations live under
from __future__ import annotations
import importlib.util
import inspect
import os
import shlex
import tempfile
@@ -51,7 +52,6 @@ class AgentProviderRuntime:
template: str
command: str
image: str
dockerfile: str
prompt_mode: PromptMode
bypass_args: tuple[str, ...]
resume_args: tuple[str, ...]
@@ -127,6 +127,18 @@ class AgentProvider(ABC):
"""The static command / image / prompt-mode table for this
template."""
@property
def dockerfile(self) -> Path | None:
"""Path to the provider's Dockerfile, or None if no Dockerfile
is declared.
Default: looks for a `Dockerfile` file next to this provider's
`agent_provider.py` module. Override to point at a non-standard
path, or return None to signal that no Dockerfile exists (the
provider relies on a pre-built image)."""
path = Path(inspect.getfile(type(self))).parent / "Dockerfile"
return path if path.is_file() else None
@abstractmethod
def provision_plan(
self,