Files
vhaudiquet 9ac559616c build: move the claw to rhema 0.5.0
The 0.5.0 line renames what the claw imports and deletes what it
wrapped. The autonomous agent is rhema-rsd now, driver and handler
trait included, so every import moves with the name. The MCP bridge is
gone outright: no crate, no socket, no generated bash functions. The
claw's mcp module stops proxying. It names the client's config file and
media directory in the shell env, runs `mcp prompt` once, and renders
that text as the prompt section. A session with no client on PATH
advertises no servers, which is the 0.5 rule.

The config follows. `host_agent.mcp_servers` is gone, `config.mcp` is
the client's rendered section, and the bare `claw mcp` subcommand gives
way to the standalone `mcp` binary. Secrets leave the OS keyring for
the encrypted file store the frontends write. The keyring is copied
into that store once, under the service name the claw used, so a
deployment that predates the file keeps its logins. rusqlite follows
rhema-identity to 0.43, because the framework links libsqlite3-sys 0.40
and two `links = "sqlite3"` packages cannot share a graph.

The image carries the toolbox the sessions' habits assume: ripgrep, fd,
jq, sd, python3, yq (the Go v4, not Debian's), the mcp client, and
lightpanda. Each release binary is pinned by version and by the
checksum of every arch's artifact, and the boot report inventories
them, so a session knows what it has. gob was already there.

0.5.0 is tagged but not on crates.io, since publishing is retried with
0.5.1, so the workspace carries a `[patch.crates-io]` onto the tag and
the lock pins its rev. Deleting the block and running `cargo update` is
the whole follow-up once 0.5.1 lands. The claw's own version travels
with the framework: the workspace and the chart become 0.5.0.

fmt, clippy with -D warnings over all features and targets, the
workspace tests, and the doc build pass.
2026-11-27 18:18:45 +01:00

157 lines
7.6 KiB
Docker

# rhema-claw: the resident forge-watching daemon.
# Build from the repo root (the context is the repo):
# docker build -f deploy/docker/claw.Dockerfile .
# The builder tag tracks rust-toolchain.toml: the pinned channel is what
# every commit is tested against. The full image (not -slim) carries the C
# toolchain rusqlite's bundled SQLite build needs.
FROM rust:1.98.1 AS builder
WORKDIR /build
# Manifests first: the registry cache this populates survives source edits.
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
COPY crates/rhema-claw/Cargo.toml crates/rhema-claw/Cargo.toml
COPY integrations/rhema-forge-integration/Cargo.toml integrations/rhema-forge-integration/Cargo.toml
COPY integrations/rhema-calendar-integration/Cargo.toml integrations/rhema-calendar-integration/Cargo.toml
COPY tools/Cargo.toml tools/Cargo.toml
COPY tools/contract/Cargo.toml tools/contract/Cargo.toml
COPY tools/common/Cargo.toml tools/common/Cargo.toml
COPY tools/notify/Cargo.toml tools/notify/Cargo.toml
# Cargo validates explicit target
# paths at manifest-parse time, so the fetch needs stub files at every
# declared target path: src/ for every member, plus examples/tests/benches
# as declared (default path from the target name, or the explicit `path`).
# The loop drives off the crates/*/ and integrations/*/ globs because
# neither glob's */src matches anything until the stub exists — an
# unmatched glob would hand mkdir a literal path. The real sources land
# below. (The awk program must stay on one line: a Dockerfile line not
# ending in a backslash ends the RUN.)
RUN for crate in crates/*/ integrations/*/ tools/*/; do \
mkdir -p "$crate/src"; \
touch "$crate/src/lib.rs" "$crate/src/main.rs"; \
awk -F'"' '/^\[/ { d = ""; p = 0; if ($0 == "[[example]]") { d = "examples" } else if ($0 == "[[test]]") { d = "tests" } else if ($0 == "[[bench]]") { d = "benches" }; next } d == "" { next } /^name = / && p == 0 { print d "/" $2 ".rs" } /^path = / { p = 1; print $2 }' "$crate/Cargo.toml" \
| while IFS= read -r target; do \
mkdir -p "$crate$(dirname "$target")"; \
touch "$crate$target"; \
done; \
done \
&& cargo fetch
# Sources. target/ and .git never land here: the repo-root .dockerignore
# keeps them out of the context.
COPY . .
RUN cargo build --release -p rhema-claw
FROM debian:stable-slim
# bash and git are load-bearing, not conveniences: the agent shells out
# via `bash -c` and clones/fetches in its per-thread workspaces. The rest
# is the toolbox the sessions' habits assume — ripgrep, fd (installed as
# `fdfind` on the Debian family; linked under the name the world types),
# jq, sd and python3 — so the agent reaches for `rg`/`jq`/`sd` and finds
# them instead of probing and falling back to grep and sed.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bash ca-certificates curl fd-find git jq procps python3 ripgrep sd tar \
&& ln -sf /usr/bin/fdfind /usr/local/bin/fd \
&& rm -rf /var/lib/apt/lists/*
# The single-file tools, each pinned by version *and* the checksum of
# every arch's artifact: a bump means re-reading the hashes, and no
# unverified download lands in the image.
#
# - gob (github.com/juanibiapina/gob): the agent's process manager. A turn
# starts a dev server or a build with `gob add`, and a later turn reads
# its logs, status and ports. Without it a long command either blocks
# the turn for its whole run or is backgrounded with `&`, which no later
# turn can find again. Its state lands under XDG_STATE_HOME
# (/data/state, the volume) and its socket under XDG_RUNTIME_DIR.
# - mcp (github.com/vhaudiquet/mcp-cli): the MCP client. The sessions call
# it as `mcp prompt | list | call` from their shell; its config file is
# the one the coding agent's settings page writes. Without the binary the
# prompt advertises no MCP servers at all, by design.
# - yq (github.com/mikefarah/yq, the Go v4): Debian's `yq` is the unrelated
# kislyuk v3, whose filters differ; the sessions' habits are v4.
# - lightpanda (github.com/lightpanda-io/browser): the headless browser the
# agent fetches pages with. It publishes no checksum file, so the version
# is the pin and the hash below was read off the release once.
#
# The image supports amd64 and arm64: every tool above publishes at least
# those, and a build for any other arch fails here rather than shipping a
# daemon with a half-empty toolbox.
ARG GOB_VERSION=3.9.0
ARG MCP_VERSION=0.1.0
ARG YQ_VERSION=4.54.3
ARG LIGHTPANDA_VERSION=1.0.6
RUN set -eu; \
arch="$(dpkg --print-architecture)"; \
case "$arch" in \
amd64) \
gob_sha=2d2ebfa584f42d63d3043b6a355ce61aaf5fae1d96a8e8ee6a85a848fcf9e790; \
mcp_sha=fe81ada6210fff737f97edc37624907dab15bc5907db6fdae7c32a61fbb65e4e; \
yq_sha=129534601871538efe0ba4c5e62a34fb1d5f469bcb975c4fddeb467d82974973; \
lightpanda=lightpanda-x86_64-linux; \
lightpanda_sha=a9bff4c0b8498433cd16d8165a5e5b47181e5690d4c8e1f011d601f1f2e8a467; \
;; \
arm64) \
gob_sha=0f03bf0531c50ae97e75a70a09b107d3c40f151ff9c83198ae1e56d13e8ddbfe; \
mcp_sha=599a2f8a54397b8a4acd3439e09090f47babd308bfa6e0cb420f5f48cd8572d8; \
yq_sha=89f69310b61b68d1245065a1241d1fc843f7a36cd6103ffd77ad987613bd1b67; \
lightpanda=lightpanda-aarch64-linux; \
lightpanda_sha=26e0042a52f493d8cc1b04faef42aea9b46bef9ccfcc86170098bd330c19a890; \
;; \
*) echo "no prebuilt gob/mcp/yq/lightpanda for $arch" >&2; exit 1 ;; \
esac; \
tmp="$(mktemp -d)"; \
trap 'rm -rf "$tmp"' EXIT; \
fetch() { \
curl -fsSL -o "$1" "$2"; \
printf '%s %s\n' "$3" "$1" | sha256sum -c - >/dev/null; \
}; \
fetch "$tmp/gob.tar.gz" \
"https://github.com/juanibiapina/gob/releases/download/v${GOB_VERSION}/gob_${GOB_VERSION}_linux_${arch}.tar.gz" \
"$gob_sha"; \
tar -xzf "$tmp/gob.tar.gz" -C "$tmp" gob; \
install -m 0755 "$tmp/gob" /usr/local/bin/gob; \
fetch "$tmp/mcp.tar.gz" \
"https://github.com/vhaudiquet/mcp-cli/releases/download/v${MCP_VERSION}/mcp_${MCP_VERSION}_linux_${arch}.tar.gz" \
"$mcp_sha"; \
mkdir "$tmp/mcp"; \
tar -xzf "$tmp/mcp.tar.gz" -C "$tmp/mcp"; \
install -m 0755 "$tmp/mcp/mcp" /usr/local/bin/mcp; \
fetch "$tmp/yq" \
"https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_${arch}" \
"$yq_sha"; \
install -m 0755 "$tmp/yq" /usr/local/bin/yq; \
fetch "$tmp/lightpanda" \
"https://github.com/lightpanda-io/browser/releases/download/${LIGHTPANDA_VERSION}/${lightpanda}" \
"$lightpanda_sha"; \
install -m 0755 "$tmp/lightpanda" /usr/local/bin/lightpanda; \
gob --version; \
mcp --version; \
yq --version; \
lightpanda version
# Numeric USER: Kubernetes cannot verify runAsNonRoot against a name.
RUN useradd --uid 1000 --user-group --create-home claw \
&& install -d -o 1000 -g 1000 /config /data
COPY --from=builder /build/target/release/rhema-claw /usr/local/bin/rhema-claw
# The chart passes --config /config/claw.yaml (the ConfigMap mount) and
# mounts the state PVC at /data; these defaults serve a bare `docker run`.
#
# XDG_RUNTIME_DIR is gob's socket directory. Left unset, gob looks in
# /run/user/1000, which nothing creates here, and its daemon dies with
# "socket not created". A socket does not belong on the volume (an NFS
# PVC cannot hold one), so it lives in the container's own /tmp.
ENV XDG_CONFIG_HOME=/config \
XDG_STATE_HOME=/data/state \
XDG_RUNTIME_DIR=/tmp/run
VOLUME /data
EXPOSE 7799
USER 1000:1000
ENTRYPOINT ["/usr/local/bin/rhema-claw"]