Files
bot-bottle/bot_bottle/backend/smolmachines/freezer.py
T
didericis-claude cb321f7ad4 refactor(freezer): drop Bottle from commit signature
Freezer._freeze only ever used bottle.name, which is always
f"bot-bottle-{agent.slug}". Remove the Bottle parameter from
commit() and _freeze(), derive the container name from agent.slug
directly in each subclass, and delete the _NamedBottle stub that
existed solely to paper over this.
2026-06-23 16:53:41 -04:00

27 lines
939 B
Python

"""SmolmachinesFreezer — snapshot a smolmachines bottle via smolvm pack."""
from __future__ import annotations
from .. import ActiveAgent
from ..freeze import Freezer
from .smolvm import pack_create_from_vm
from ...bottle_state import bottle_state_dir
from ...log import info
class SmolmachinesFreezer(Freezer):
"""Freezes a smolmachines bottle via `smolvm pack create --from-vm`."""
backend_name = "smolmachines"
def _freeze(self, agent: ActiveAgent) -> str:
machine = f"bot-bottle-{agent.slug}"
output = bottle_state_dir(agent.slug) / "committed-smolmachine"
output.parent.mkdir(parents=True, exist_ok=True)
pack_create_from_vm(machine, output)
artifact = output.with_name(f"{output.name}.smolmachine")
return str(artifact)
def _export_hint(self, slug: str, image_ref: str) -> None:
info(f"to export for migration: cp {image_ref} {slug}.smolmachine")