From 5047ff8803598c65c0d25652df11fa31dde6b5a6 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Sat, 24 Oct 2026 12:38:47 +0200 Subject: [PATCH] refactor(sandbox): one crate per backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The seam crate carried every backend behind features — local, client, server — so a wasm worker linked the axum daemon and a host daemon linked reqwest it never dialed. The family mirrors the provider family now, as the design always said it would: rhema-sandbox keeps the contract, the ShellSandbox adapter, the wire protocol, the seeding helper, the scripted mock, and — behind the new `spawn` feature — the process family's shared machinery (exec_util, fsroot); the backends are sibling crates, rhema-sandbox-local, -docker, -ssh, each dependent only on the seam; the HTTPS client is rhema-sandbox-http (reqwest behind its `native` feature, off on wasm, whose worker brings its own HttpTransport over host fetch); the daemon is rhema-sandbox-server, and the rhema-sandboxd binary moves with it. Consumers rewire, semantics don't: rhema-code names its backends directly; rhema-cloud-agent keeps its transitional re-exports; rhema-cloudflare-code and rhema-vercel-agent take the HTTP client reqwest-free and native respectively; the sandboxd image builds -p rhema-sandbox-server. Cargo paths only — no behavior, no protocol, no spec change. --- deploy/docker/sandboxd.Dockerfile | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/deploy/docker/sandboxd.Dockerfile b/deploy/docker/sandboxd.Dockerfile index 9682712..59540bf 100644 --- a/deploy/docker/sandboxd.Dockerfile +++ b/deploy/docker/sandboxd.Dockerfile @@ -5,8 +5,8 @@ # The builder tag tracks rust-toolchain.toml: the pinned channel is what # every commit is tested against. The full image (not -slim) keeps this # builder identical to claw.Dockerfile's, though the graph is pure Rust: -# the bundled SQLite of rhema-identity stays out of `-p rhema-sandbox`'s -# dependency closure. +# the bundled SQLite of rhema-identity stays out of the daemon +# crate's dependency closure. FROM rust:1.98.1 AS builder WORKDIR /build @@ -32,7 +32,11 @@ COPY crates/rhema-provider-llama-cpp/Cargo.toml crates/rhema-provider-llama-cpp/ COPY crates/rhema-provider-openai-compatible/Cargo.toml crates/rhema-provider-openai-compatible/Cargo.toml COPY crates/rhema-provider-openrouter/Cargo.toml crates/rhema-provider-openrouter/Cargo.toml COPY crates/rhema-rsd/Cargo.toml crates/rhema-rsd/Cargo.toml -COPY crates/rhema-sandbox/Cargo.toml crates/rhema-sandbox/Cargo.toml +COPY crates/rhema-sandbox-docker/Cargo.toml crates/rhema-sandbox-docker/Cargo.toml +COPY crates/rhema-sandbox-http/Cargo.toml crates/rhema-sandbox-http/Cargo.toml +COPY crates/rhema-sandbox-local/Cargo.toml crates/rhema-sandbox-local/Cargo.toml +COPY crates/rhema-sandbox-server/Cargo.toml crates/rhema-sandbox-server/Cargo.toml +COPY crates/rhema-sandbox-ssh/Cargo.toml crates/rhema-sandbox-ssh/Cargo.toml COPY crates/rhema-subagents/Cargo.toml crates/rhema-subagents/Cargo.toml COPY crates/rhema-transcript/Cargo.toml crates/rhema-transcript/Cargo.toml COPY crates/rhema-vercel-agent/Cargo.toml crates/rhema-vercel-agent/Cargo.toml @@ -55,9 +59,10 @@ COPY vendor/ vendor/ # # No src/main.rs stub: most members have no default binary, the stub # would survive `COPY . .`, and the phantom autobin it creates fails -# E0601 the moment that member is the `-p` package (rhema-sandbox -# itself). Declared [[bin]] paths are never stubbed either — the awk -# stubs examples/tests/benches only — and fetch needs no bin to exist. +# E0601 the moment that member is the `-p` package — which is now +# rhema-sandbox-server, were the stub not skipped. Declared [[bin]] +# paths are never stubbed either — the awk stubs examples/tests/benches +# only — and fetch needs no bin to exist. RUN for crate in crates/*/ integrations/*/; do \ mkdir -p "$crate/src"; \ touch "$crate/src/lib.rs"; \ @@ -73,10 +78,11 @@ RUN for crate in crates/*/ integrations/*/; do \ # keeps them out of the context. COPY . . -# Feature `server` only: the daemon needs no local/mock/client code -# (server implies the local backend and tokio's rt/net, per the -# crate's feature graph). -RUN cargo build --release --locked -p rhema-sandbox --features server +# The daemon crate pulls only what it serves from: the seam with the +# process machinery (`spawn`) and the local backend — no mock, no HTTP +# client. The stub loop above already wrote its lib.rs; the declared +# [[bin]] path needs no stub for the fetch. +RUN cargo build --release --locked -p rhema-sandbox-server FROM debian:stable-slim