diff --git a/claude_bottle/backend/docker/backend.py b/claude_bottle/backend/docker/backend.py index b0e50ce..e47a82e 100644 --- a/claude_bottle/backend/docker/backend.py +++ b/claude_bottle/backend/docker/backend.py @@ -29,7 +29,11 @@ from . import util as docker_mod from .bottle import DockerBottle from .bottle_cleanup_plan import DockerBottleCleanupPlan from .bottle_plan import DockerBottlePlan -from .pipelock import DockerPipelockProxy +from .pipelock import ( + DockerPipelockProxy, + pipelock_proxy_host_port, + pipelock_proxy_url, +) # Where the repo root lives, for `docker build` context. Computed once. @@ -204,7 +208,7 @@ class DockerBottleBackend(BottleBackend): """Build the `docker run` argv and execute it, handling name-conflict races by incrementing the suffix (unless the name was user-pinned). Returns the resolved container name.""" - proxy_url = pipelock.pipelock_proxy_url(plan.slug) + proxy_url = pipelock_proxy_url(plan.slug) docker_args: list[str] = [ "--rm", "-d", "--name", plan.container_name, @@ -411,7 +415,7 @@ class DockerBottleBackend(BottleBackend): return container = target - proxy_host_port = pipelock.pipelock_proxy_host_port(plan.slug) + proxy_host_port = pipelock_proxy_host_port(plan.slug) container_home = os.environ.get("CLAUDE_BOTTLE_CONTAINER_HOME", "/home/node") container_ssh = f"{container_home}/.ssh" agent_socket = "/run/claude-bottle-agent.sock" diff --git a/claude_bottle/backend/docker/pipelock.py b/claude_bottle/backend/docker/pipelock.py index 82bcebd..0e0bdc1 100644 --- a/claude_bottle/backend/docker/pipelock.py +++ b/claude_bottle/backend/docker/pipelock.py @@ -12,10 +12,21 @@ from ...pipelock import ( PIPELOCK_PORT, PipelockProxy, PipelockProxyPlan, - pipelock_container_name, ) +def pipelock_container_name(slug: str) -> str: + return f"claude-bottle-pipelock-{slug}" + + +def pipelock_proxy_url(slug: str) -> str: + return f"http://{pipelock_container_name(slug)}:{PIPELOCK_PORT}" + + +def pipelock_proxy_host_port(slug: str) -> str: + return f"{pipelock_container_name(slug)}:{PIPELOCK_PORT}" + + class DockerPipelockProxy(PipelockProxy): """Brings the pipelock sidecar up and down via Docker.""" diff --git a/claude_bottle/pipelock.py b/claude_bottle/pipelock.py index 0835aca..9d799d8 100644 --- a/claude_bottle/pipelock.py +++ b/claude_bottle/pipelock.py @@ -42,18 +42,6 @@ DEFAULT_ALLOWLIST: tuple[str, ...] = ( ) -def pipelock_container_name(slug: str) -> str: - return f"claude-bottle-pipelock-{slug}" - - -def pipelock_proxy_url(slug: str) -> str: - return f"http://{pipelock_container_name(slug)}:{PIPELOCK_PORT}" - - -def pipelock_proxy_host_port(slug: str) -> str: - return f"{pipelock_container_name(slug)}:{PIPELOCK_PORT}" - - # --- Allowlist resolution -------------------------------------------------- diff --git a/tests/test_orphan_cleanup.py b/tests/test_orphan_cleanup.py index 40218e2..928fbf3 100644 --- a/tests/test_orphan_cleanup.py +++ b/tests/test_orphan_cleanup.py @@ -13,8 +13,10 @@ from claude_bottle.backend.docker.network import ( network_create_internal, network_remove, ) -from claude_bottle.backend.docker.pipelock import DockerPipelockProxy -from claude_bottle.pipelock import pipelock_container_name +from claude_bottle.backend.docker.pipelock import ( + DockerPipelockProxy, + pipelock_container_name, +) from tests._docker import skip_unless_docker