PRD 0003: Bottle Backend abstraction #5

Merged
didericis merged 44 commits from add-bottle-factory-abstraction into main 2026-05-11 14:49:43 -04:00
Showing only changes of commit 1b8d3bbb94 - Show all commits
+8 -7
View File
@@ -95,15 +95,13 @@ class DockerBottleBackend(BottleBackend):
env_file = stage_dir / "agent.env" env_file = stage_dir / "agent.env"
args_file = stage_dir / "docker-args" args_file = stage_dir / "docker-args"
prompt_file = stage_dir / "prompt.txt" prompt_file = stage_dir / "prompt.txt"
pipelock_yaml_filename = "pipelock.yaml"
pipelock_yaml = stage_dir / pipelock_yaml_filename
env_file.write_text("") env_file.write_text("")
env_file.chmod(0o600) env_file.chmod(0o600)
args_file.write_text("") args_file.write_text("")
prompt_file.write_text("") prompt_file.write_text("")
prompt_file.chmod(0o600) prompt_file.chmod(0o600)
self.prepare_proxy(spec, pipelock_yaml) pipelock_yaml = self.prepare_proxy(spec, stage_dir)
env_resolve(manifest, spec.agent_name, env_file, args_file) env_resolve(manifest, spec.agent_name, env_file, args_file)
prompt_file.write_text(agent.prompt) prompt_file.write_text(agent.prompt)
@@ -123,16 +121,19 @@ class DockerBottleBackend(BottleBackend):
args_file=args_file, args_file=args_file,
prompt_file=prompt_file, prompt_file=prompt_file,
pipelock_yaml_path=pipelock_yaml, pipelock_yaml_path=pipelock_yaml,
pipelock_yaml_filename=pipelock_yaml_filename, pipelock_yaml_filename=pipelock_yaml.name,
allowlist_summary=allowlist_summary, allowlist_summary=allowlist_summary,
use_runsc=use_runsc, use_runsc=use_runsc,
) )
def prepare_proxy(self, spec: BottleSpec, yaml_path: Path) -> None: def prepare_proxy(self, spec: BottleSpec, stage_dir: Path) -> Path:
"""Delegate to PipelockProxy to write the sidecar's yaml """Decide where the pipelock yaml lives in `stage_dir`, delegate
config. Stage-only: no Docker resources created yet.""" to PipelockProxy to write it, and return the resolved path.
Stage-only: no Docker resources created yet."""
yaml_path = stage_dir / "pipelock.yaml"
bottle_name = spec.manifest.agents[spec.agent_name].bottle bottle_name = spec.manifest.agents[spec.agent_name].bottle
self._proxy.prepare(spec.manifest, bottle_name, yaml_path) self._proxy.prepare(spec.manifest, bottle_name, yaml_path)
return yaml_path
@contextmanager @contextmanager
def launch(self, plan: BottlePlan) -> Iterator[DockerBottle]: def launch(self, plan: BottlePlan) -> Iterator[DockerBottle]: