The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
store: marimo, MuJoCo, RDKit and text-to-cad install and run on a fresh machine
deee8bf6bd3e258
diff --git a/store/agents/autonomous-circuit/toolchain/runtimes.sh b/store/agents/autonomous-circuit/toolchain/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/agents/autonomous-circuit/toolchain/runtimes.sh+++ b/store/agents/autonomous-circuit/toolchain/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/agents/autonomous-circuit/toolchain/test_toolchain.py b/store/agents/autonomous-circuit/toolchain/test_toolchain.pyindex c9291ad93..0bad613fa 100644--- a/store/agents/autonomous-circuit/toolchain/test_toolchain.py+++ b/store/agents/autonomous-circuit/toolchain/test_toolchain.py@@ -342,8 +342,9 @@ esac''')self.node()self.uv()run = self.run_script("setup.sh", PIP_EXIT="2")- self.assertEqual(run.returncode, 2)- self.assertNotIn("numpy", run.stdout)+ self.assertEqual(run.returncode, 1)+ self.assertEqual(run.stdout.splitlines()[-1], "miss could not install numpy into .venv")+ self.assertNotIn("ok numpy", run.stdout)self.assertFalse((self.pkg / "upstream").exists())def test_setup_fails_with_the_projects_setup(self):diff --git a/store/agents/autonomous-workshop/toolchain/runtimes.sh b/store/agents/autonomous-workshop/toolchain/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/agents/autonomous-workshop/toolchain/runtimes.sh+++ b/store/agents/autonomous-workshop/toolchain/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/agents/blender/toolchain/runtimes.sh b/store/agents/blender/toolchain/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/agents/blender/toolchain/runtimes.sh+++ b/store/agents/blender/toolchain/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/agents/excalidraw/toolchain/runtimes.sh b/store/agents/excalidraw/toolchain/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/agents/excalidraw/toolchain/runtimes.sh+++ b/store/agents/excalidraw/toolchain/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/agents/manim/toolchain/runtimes.sh b/store/agents/manim/toolchain/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/agents/manim/toolchain/runtimes.sh+++ b/store/agents/manim/toolchain/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/agents/marimo/AGENTS.md b/store/agents/marimo/AGENTS.mdindex 24a517d29..de76bace8 100644--- a/store/agents/marimo/AGENTS.md+++ b/store/agents/marimo/AGENTS.md@@ -16,7 +16,8 @@ saves over your file. You never start a server, never print a URL, never open a- **The toolchain is one venv**, pinned: `$MARIMO_PYTHON` runs Python, `$MARIMO` is the CLI(`$MARIMO check notebook.py`, `$MARIMO export html notebook.py -o out/notebook.html`). numpy,pandas, polars, altair, matplotlib, duckdb, pyarrow are there; `"$MARIMO_PYTHON" -m pip install`- for anything else, and say so.+ for anything else, and say so. Where marimo's skills write `uv run marimo …` or `uv run python …`,+ run `$MARIMO …` or `"$MARIMO_PYTHON" …`: this machine may have no uv, and the venv is the toolchain.- **The verdict.** `.harness/verdict.json` is what the pane header shows. Write it after everychange: `"$MARIMO_PYTHON" "$MARIMO_TOOLCHAIN/verdict.py"`. It runs `marimo check` and then thenotebook top to bottom. Never edit it by hand.diff --git a/store/agents/marimo/toolchain/runtimes.sh b/store/agents/marimo/toolchain/runtimes.shnew file mode 100644index 000000000..51fefe3f9--- /dev/null+++ b/store/agents/marimo/toolchain/runtimes.sh@@ -0,0 +1,190 @@+# shellcheck shell=bash+# runtimes.sh — the interpreters a store package runs on, found on this machine or fetched, never+# asked of the person who pressed Get.+#+# Sourced (not run) by a package's setup, doctor and viewer scripts. A new Mac has Apple's Python 3.9,+# no Homebrew and, for most people, no Node on PATH; a package that answers "brew install [email protected]"+# has failed its install. So:+#+# harness_node 18 node >= 18 on PATH, with npm: the machine's own, else the Node Harness+# itself runs on (~/.harness/runtime/current-node, laid down with the CLI)+# harness_uv uv on PATH: the machine's own, else a pinned, checksummed release+# fetched into ~/.harness/runtime+# harness_venv DIR 3.12 [MIN [BELOW]]+# DIR is a venv on CPython 3.12, which uv downloads when the machine+# has none. A venv already there on a Python in [MIN, BELOW) is kept.+# harness_pip DIR PKG… install into that venv, through uv+# harness_micromamba micromamba, pinned and checksummed, for native libraries PyPI has+# no wheel for (pycairo on macOS)+# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages+#+# Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).+#+# ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package+# carries an identical copy (a package installs alone, so it cannot reach this one);+# `node store/tools/sync-runtimes.mjs` rewrites them and the CLI's store spec fails when one drifts.++HARNESS_RUNTIME="${ADAPTER_RUNTIME_DIR:-${HOME:-}/.harness/runtime}"+# The Pythons uv downloads live with Harness's other runtimes, not in uv's own ~/.local/share/uv:+# a package's venv points at its interpreter, and `uv python uninstall` there must not break it.+UV_PYTHON_INSTALL_DIR="${UV_PYTHON_INSTALL_DIR:-$HARNESS_RUNTIME/python}"+export UV_PYTHON_INSTALL_DIR+HARNESS_UV_VERSION=0.12.15+HARNESS_MICROMAMBA_VERSION=2.9.0-0++_harness_platform() {+ case "$(uname -s)-$(uname -m)" in+ Darwin-arm64) echo darwin-arm64 ;;+ Darwin-x86_64) echo darwin-x64 ;;+ Linux-x86_64) echo linux-x64 ;;+ Linux-aarch64 | Linux-arm64) echo linux-arm64 ;;+ *) return 1 ;;+ esac+}++_harness_sha256() {+ if command -v shasum >/dev/null 2>&1; then shasum -a 256 "$1" | cut -d' ' -f1+ else sha256sum "$1" | cut -d' ' -f1; fi+}++# _harness_fetch URL DEST SHA256 — DEST exists only if what arrived matches the pinned checksum.+_harness_fetch() {+ local part="$2.part.$$"+ if ! curl -fsSL --retry 3 --connect-timeout 20 --max-time 900 -o "$part" "$1"; then+ rm -f "$part"; echo "miss could not download $1 — check this machine's internet connection"; return 1+ fi+ if [ "$(_harness_sha256 "$part")" != "$3" ]; then+ rm -f "$part"; echo "miss $1 did not match its pinned checksum; nothing was installed"; return 1+ fi+ mv -f "$part" "$2"+}++_harness_node_at_least() {+ command -v node >/dev/null 2>&1 || return 1+ node -e '+ const [a, b = 0] = process.argv[1].split(".").map(Number)+ const [x, y] = process.versions.node.split(".").map(Number)+ process.exit(x > a || (x === a && y >= b) ? 0 : 1)+ ' "$1" >/dev/null 2>&1+}++harness_node() {+ local min="${1:-18}" recorded saved="$PATH" own=0+ _harness_node_at_least "$min" && own=1+ # A node without npm beside it (a distro's nodejs package) cannot run a setup's `npm ci`.+ if [ "$own" = 1 ] && command -v npm >/dev/null 2>&1; then return 0; fi+ recorded="$(cat "$HARNESS_RUNTIME/current-node" 2>/dev/null || true)"+ if [ -n "$recorded" ] && [ -x "${recorded%/*}/node" ]; then+ PATH="${recorded%/*}:$PATH"; export PATH; hash -r 2>/dev/null || true+ _harness_node_at_least "$min" && return 0+ PATH="$saved"; export PATH; hash -r 2>/dev/null || true+ [ "$own" = 1 ] && return 0+ echo "miss node >= $min — this machine's newest is $("${recorded%/*}/node" -v), Harness's own; update Harness"+ return 1+ fi+ [ "$own" = 1 ] && return 0+ echo "miss node >= $min, and Harness's own Node is not in $HARNESS_RUNTIME — run \`harness start\` once to lay it down"+ return 1+}++harness_uv() {+ local dir asset sum tmp+ command -v uv >/dev/null 2>&1 && return 0+ for dir in "${HOME:-}/.local/bin" "${HOME:-}/.cargo/bin"; do+ [ -n "${HOME:-}" ] || break+ if [ -x "$dir/uv" ]; then PATH="$dir:$PATH"; export PATH; return 0; fi+ done+ dir="$HARNESS_RUNTIME/uv-$HARNESS_UV_VERSION"+ if [ ! -x "$dir/uv" ]; then+ case "$(_harness_platform)" in+ darwin-arm64) asset=uv-aarch64-apple-darwin sum=dc304b9ed1b24174572290fba60ac3f6fe63c73a671f0439e62a91375841964d ;;+ darwin-x64) asset=uv-x86_64-apple-darwin sum=e9ca61775532368fe518ab03e7a354c7ecab8ccb3c7d941c775fcc4a362b801b ;;+ linux-x64) asset=uv-x86_64-unknown-linux-gnu sum=f97935763c04be3e692460a7aaeaaab8fc3b78fcf8b389da820b38ae7423a638 ;;+ linux-arm64) asset=uv-aarch64-unknown-linux-gnu sum=0e9a3499b0587d449c9ff684c0160da607826e4af1cee220bc87f378702d3e08 ;;+ *) echo "miss uv — there is no uv release for $(uname -s) $(uname -m); install it from https://docs.astral.sh/uv/"; return 1 ;;+ esac+ echo " fetching uv $HARNESS_UV_VERSION into $HARNESS_RUNTIME (it brings Python and the packages)"+ mkdir -p "$HARNESS_RUNTIME" || { echo "miss cannot write $HARNESS_RUNTIME"; return 1; }+ tmp="$(mktemp -d "$HARNESS_RUNTIME/.uv.XXXXXX")" || { echo "miss cannot write $HARNESS_RUNTIME"; return 1; }+ if ! _harness_fetch "https://github.com/astral-sh/uv/releases/download/$HARNESS_UV_VERSION/$asset.tar.gz" "$tmp/uv.tar.gz" "$sum"; then+ rm -rf "$tmp"; return 1+ fi+ tar -xzf "$tmp/uv.tar.gz" -C "$tmp" && chmod +x "$tmp/$asset/uv" "$tmp/$asset/uvx" \+ || { rm -rf "$tmp"; echo "miss the uv archive would not unpack"; return 1; }+ # Two installs at once both get here; whichever renames first wins and the other's copy goes.+ # (mv onto a directory that exists would nest the copy inside it, hence the test.)+ [ -e "$dir" ] || mv "$tmp/$asset" "$dir" 2>/dev/null || true+ rm -rf "$tmp"+ [ -x "$dir/uv" ] || { echo "miss uv did not land in $dir"; return 1; }+ fi+ PATH="$dir:$PATH"; export PATH+}++# harness_venv DIR VERSION [MIN [BELOW]] — MIN defaults to VERSION; BELOW is exclusive and optional.+harness_venv() {+ local dir="${1:?harness_venv needs a directory}" want="${2:?harness_venv needs a Python version}"+ local min="${3:-$2}" below="${4:-}"+ if [ -x "$dir/bin/python" ] && "$dir/bin/python" -c '+import sys+at = lambda s: tuple(int(p) for p in s.split("."))+v = sys.version_info[:2]+sys.exit(0 if v >= at(sys.argv[1]) and (not sys.argv[2] or v < at(sys.argv[2])) else 1)+' "$min" "$below" 2>/dev/null; then+ echo "ok $("$dir/bin/python" --version) in $dir"+ return 0+ fi+ harness_uv || return 1+ echo " python $want in $dir (uv downloads it when this machine has none)"+ rm -rf "$dir"+ # only-managed: the same python-build-standalone interpreter on every machine, so a package tested+ # once is tested everywhere — not whichever Homebrew or pyenv Python happened to be first on PATH.+ uv venv --quiet --seed --python "$want" --python-preference only-managed "$dir" \+ || { echo "miss could not make a Python $want environment in $dir"; return 1; }+ echo "ok $("$dir/bin/python" --version) in $dir"+}++harness_pip() {+ local dir="${1:?harness_pip needs a venv}"+ shift+ harness_uv || return 1+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }+}++harness_micromamba() {+ local dir asset sum+ dir="$HARNESS_RUNTIME/micromamba-$HARNESS_MICROMAMBA_VERSION"+ if [ ! -x "$dir/micromamba" ]; then+ case "$(_harness_platform)" in+ darwin-arm64) asset=micromamba-osx-arm64 sum=ec2a072f028e1a7cf20f3e2e74d5a8127cf5a5f27636375b5359811565f4e5be ;;+ darwin-x64) asset=micromamba-osx-64 sum=1e71054bb3ac9a076e21f7ec48acfef536f9b3f1408f371a942784bf5ef83d8a ;;+ linux-x64) asset=micromamba-linux-64 sum=366cd9cd8be14df1ab8ed50352a82111082a36686b2d389fdb79a92c3fafb3e3 ;;+ linux-arm64) asset=micromamba-linux-aarch64 sum=9f93b974adcb4d166996af969b6cd371287d1a3e52733704727884d9b74cb7a7 ;;+ *) echo "miss micromamba — there is no release for $(uname -s) $(uname -m)"; return 1 ;;+ esac+ echo " fetching micromamba $HARNESS_MICROMAMBA_VERSION into $HARNESS_RUNTIME (native libraries PyPI has no wheel for)"+ mkdir -p "$dir" || { echo "miss cannot write $dir"; return 1; }+ _harness_fetch "https://github.com/mamba-org/micromamba-releases/releases/download/$HARNESS_MICROMAMBA_VERSION/$asset" "$dir/micromamba.$$" "$sum" || return 1+ chmod +x "$dir/micromamba.$$" && mv -f "$dir/micromamba.$$" "$dir/micromamba" \+ || { rm -f "$dir/micromamba.$$"; echo "miss micromamba would not install into $dir"; return 1; }+ fi+ HARNESS_MICROMAMBA="$dir/micromamba"+ export HARNESS_MICROMAMBA+}++# harness_conda_env DIR SPEC… — conda-forge only, packages cached under ~/.harness/runtime/mamba.+harness_conda_env() {+ local dir="${1:?harness_conda_env needs a directory}"+ shift+ # micromamba takes a relative --prefix as a name under its root prefix and "succeeds" there.+ case "$dir" in /*) ;; *) dir="$PWD/$dir" ;; esac+ harness_micromamba || return 1+ MAMBA_ROOT_PREFIX="$HARNESS_RUNTIME/mamba" "$HARNESS_MICROMAMBA" create --yes --quiet \+ --prefix "$dir" --override-channels --channel conda-forge "$@" >/dev/null \+ && [ -d "$dir/conda-meta" ] \+ || { echo "miss could not make the conda-forge environment in $dir ($*)"; return 1; }+}diff --git a/store/agents/marimo/toolchain/setup.sh b/store/agents/marimo/toolchain/setup.shindex 3a4e67fa5..6da2fdbd7 100755--- a/store/agents/marimo/toolchain/setup.sh+++ b/store/agents/marimo/toolchain/setup.sh@@ -1,14 +1,14 @@#!/usr/bin/env bash# Runs once at install, cwd = the install dir. One venv with the pinned marimo and the libraries a-# notebook reaches for first (numpy, pandas, polars, altair, matplotlib, duckdb, pyarrow).+# notebook reaches for first (numpy, pandas, polars, altair, matplotlib, duckdb, pyarrow). marimo wants+# Python 3.10+ and duckdb and pyarrow have wheels up to 3.14, so the venv is on 3.12 whatever this+# machine has (uv downloads it when it is not here); a venv already on 3.10–3.14 is kept.set -euo pipefailcd "$(dirname "$0")/.."+# shellcheck source=runtimes.sh+. toolchain/runtimes.shVERSION="$(cat MARIMO_VERSION)"-PY=""; for c in python3.12 python3.13 python3.11 python3; do if command -v "$c" >/dev/null 2>&1 && "$c" -c 'import sys; raise SystemExit(0 if (3, 10) <= sys.version_info < (3, 14) else 1)' 2>/dev/null; then PY="$c"; break; fi; done-[ -n "$PY" ] || { echo "miss python 3.10–3.13 (brew install [email protected])"; exit 1; }-echo "ok $($PY --version)"-[ -x .venv/bin/python ] || "$PY" -m venv .venv-.venv/bin/python -m pip install --quiet --upgrade pip >/dev/null 2>&1 || true+harness_venv .venv 3.12 3.10 3.15 || exit 1echo " installing marimo ${VERSION} and the usual libraries (a minute or two)"-.venv/bin/python -m pip install --quiet "marimo==${VERSION}" numpy pandas polars altair matplotlib duckdb pyarrow+harness_pip .venv "marimo==${VERSION}" numpy pandas polars altair matplotlib duckdb pyarrowecho "ok marimo $(.venv/bin/marimo --version 2>/dev/null | tail -1)"diff --git a/store/agents/marimo/toolchain/test_scripts.py b/store/agents/marimo/toolchain/test_scripts.pyindex b7b1d22ea..2df78790a 100644--- a/store/agents/marimo/toolchain/test_scripts.py+++ b/store/agents/marimo/toolchain/test_scripts.py@@ -1,6 +1,7 @@"""setup.sh, doctor.sh, init-workspace.sh and viewer.sh, run for real against a scratch install whosePATH holds only stub commands (and the few coreutils the scripts use), so every ok / miss line is-reached without a network, a venv or a marimo on the machine:+reached without a network, a venv or a marimo on the machine. uv is a stub too: what runtimes.sh does+when uv is not on PATH at all is store/tools/test_runtimes.py's business.python3 -m unittest toolchain/test_scripts.py"""@@ -11,9 +12,17 @@ PACKAGE = Path(__file__).resolve().parent.parent# A bash line tracer (BASH_ENV sourcing a DEBUG trap that appends to SHCOV_OUT) is passed through when set.TRACER = {k: os.environ[k] for k in ("BASH_ENV", "SHCOV_OUT") if k in os.environ}BASH = "/bin/bash"-COREUTILS = ("dirname", "cat", "mkdir", "tail")+COREUTILS = ("dirname", "cat", "mkdir", "tail", "rm", "cp", "mktemp", "cut", "shasum")VERSION = (PACKAGE / "MARIMO_VERSION").read_text().strip()+# The venv's python: its version (VENV_PY; runtimes.sh's keep-or-replace probe answers VENV_PY_OK) and+# everything else (verdict.py, viewer.py) answers PIP_EXIT.+VENV_PYTHON = """case "$1" in+ --version) echo "Python ${VENV_PY:-3.12.9}" ;;+ -c) exit "${VENV_PY_OK:-0}" ;;+ *) exit "${PIP_EXIT:-0}" ;;+esac"""+class Sandbox:"""An install dir with the package's scripts, a bin/ of stubs as the whole PATH, and a log of@@ -40,16 +49,27 @@ class Sandbox:def stub(self, name: str, body: str = "", where: Path | None = None) -> Path:path = (where or self.bin) / namepath.parent.mkdir(parents=True, exist_ok=True)+ path.unlink(missing_ok=True) # never write through a link to a real commandpath.write_text(f'#!/bin/bash\necho "{name} $*" >> "$CALLS"\n{body}\n')path.chmod(0o755)return pathdef venv(self, root: Path | None = None) -> None:- """A .venv whose python logs pip and whose marimo prints a version the way marimo does."""+ """A .venv whose python answers the version probes and whose marimo prints a version the way+ marimo does."""bin_ = (root or self.install) / ".venv" / "bin"- self.stub("python", "exit ${PIP_EXIT:-0}", where=bin_)+ self.stub("python", VENV_PYTHON, where=bin_)self.stub("marimo", f'echo "{VERSION}"', where=bin_)+ def uv(self) -> None:+ """uv on PATH: `uv venv … DIR` makes a stub venv in DIR; `uv pip install` answers UV_PIP_EXIT."""+ self.venv(self.root / "template")+ template = self.root / "template" / ".venv" / "bin"+ self.stub("uv", f"""case "$1" in+ venv) for last in "$@"; do :; done; mkdir -p "$last/bin" && cp "{template}/python" "{template}/marimo" "$last/bin/" ;;+ pip) exit "${{UV_PIP_EXIT:-0}}" ;;+esac""")+def run(self, script: str, cwd: Path | None = None, **env: str) -> subprocess.CompletedProcess:return subprocess.run([BASH, str(self.install / script)], cwd=cwd or self.install,env={"PATH": str(self.bin), "CALLS": str(self.calls), **TRACER, **env},@@ -71,62 +91,52 @@ class Doctor(unittest.TestCase):self.assertEqual((r.returncode, r.stdout), (1, "miss .venv/bin/marimo — run toolchain/setup.sh\n"))-def python(version: str, fits: bool) -> str:- """A pythonX.Y stub: the version probe passes or not; `-m venv .venv` makes a stub venv."""- return (f'case "$1" in\n'- f' -c) exit {0 if fits else 1} ;;\n'- f' --version) echo "Python {version}" ;;\n'- f' -m) mkdir -p .venv/bin; cp "$STUB_VENV/python" "$STUB_VENV/marimo" .venv/bin/ ;;\n'- f'esac')--class Setup(unittest.TestCase):- def sandbox(self) -> Sandbox:+ def test_makes_a_3_12_venv_and_installs_marimo_into_it(self):box = Sandbox(self)- box.venv(box.root / "template") # what `python -m venv` copies in- (box.bin / "cp").symlink_to("/bin/cp")- return box-- def run_setup(self, box: Sandbox, **env: str) -> subprocess.CompletedProcess:- return box.run("toolchain/setup.sh", STUB_VENV=str(box.root / "template" / ".venv" / "bin"), **env)-- def test_the_first_python_that_fits_makes_the_venv(self):- box = self.sandbox()- box.stub("python3.12", python("3.12.9", fits=False)) # present but refused- box.stub("python3.11", python("3.11.4", fits=True))- box.stub("python3", python("3.9.6", fits=True)) # never reached- r = self.run_setup(box)+ box.uv()+ r = box.run("toolchain/setup.sh")self.assertEqual(r.returncode, 0, r.stderr)- self.assertEqual(r.stdout.splitlines(), ["ok Python 3.11.4",+ self.assertEqual(r.stdout.splitlines(), [" python 3.12 in .venv (uv downloads it when this machine has none)",+ "ok Python 3.12.9 in .venv",f" installing marimo {VERSION} and the usual libraries (a minute or two)",f"ok marimo {VERSION}"])- self.assertIn("python3.11 -m venv .venv", box.logged())- self.assertIn(f"python -m pip install --quiet marimo=={VERSION} numpy pandas polars altair matplotlib duckdb pyarrow", box.logged())- self.assertFalse(any(c.startswith("python3 ") for c in box.logged()))+ self.assertIn("uv venv --quiet --seed --python 3.12 --python-preference only-managed .venv", box.logged())+ self.assertIn(f"uv pip install --quiet --python .venv/bin/python marimo=={VERSION} numpy pandas polars altair matplotlib duckdb pyarrow",+ box.logged())- def test_an_existing_venv_is_reused_and_a_failed_pip_upgrade_is_not_fatal(self):- box = self.sandbox()- box.stub("python3.13", python("3.13.1", fits=True))+ def test_an_existing_venv_in_range_is_reused(self):+ box = Sandbox(self)+ box.uv()box.venv()- # pip upgrade fails, the install itself succeeds- box.stub("python", 'case "$*" in *--upgrade*) exit 1 ;; esac', where=box.install / ".venv" / "bin")- r = self.run_setup(box)+ r = box.run("toolchain/setup.sh", VENV_PY="3.13.1")self.assertEqual(r.returncode, 0, r.stderr)- self.assertNotIn("python3.13 -m venv .venv", box.logged())- self.assertIn("python -m pip install --quiet --upgrade pip", box.logged())- self.assertEqual(r.stdout.splitlines()[::2], ["ok Python 3.13.1", f"ok marimo {VERSION}"])+ self.assertEqual(r.stdout.splitlines()[0], "ok Python 3.13.1 in .venv")+ self.assertFalse(any(c.startswith("uv venv") for c in box.logged()))+ self.assertIn("python -c", "\n".join(box.logged()), "the venv's python was asked its version")- def test_no_python_that_fits_is_a_miss(self):- box = self.sandbox()- box.stub("python3", python("3.14.0", fits=False))- r = self.run_setup(box)- self.assertEqual((r.returncode, r.stdout), (1, "miss python 3.10–3.13 (brew install [email protected])\n"))+ def test_a_venv_on_a_python_out_of_range_is_replaced(self):+ box = Sandbox(self)+ box.uv()+ box.venv()+ r = box.run("toolchain/setup.sh", VENV_PY_OK="1")+ self.assertEqual(r.returncode, 0, r.stderr)+ self.assertIn("uv venv --quiet --seed --python 3.12 --python-preference only-managed .venv", box.logged())++ def test_no_uv_and_no_network_is_a_miss(self):+ box = Sandbox(self)+ box.stub("uname", 'case "$1" in -s) echo Darwin ;; -m) echo arm64 ;; esac')+ box.stub("curl", "exit 6")+ r = box.run("toolchain/setup.sh", ADAPTER_RUNTIME_DIR=str(box.root / "runtime"))+ self.assertEqual(r.returncode, 1)+ self.assertEqual(r.stdout.splitlines()[-1], "miss could not download https://github.com/astral-sh/uv/releases/download/"+ "0.12.15/uv-aarch64-apple-darwin.tar.gz — check this machine's internet connection")+ self.assertFalse((box.install / ".venv").exists())def test_a_failed_install_fails_setup(self):- box = self.sandbox()- box.stub("python3.12", python("3.12.9", fits=True))- box.stub("python", "exit 1", where=box.root / "template" / ".venv" / "bin")- r = self.run_setup(box)+ box = Sandbox(self)+ box.uv()+ r = box.run("toolchain/setup.sh", UV_PIP_EXIT="1")self.assertNotEqual(r.returncode, 0)self.assertNotIn("ok marimo", r.stdout)diff --git a/store/agents/mujoco/README.md b/store/agents/mujoco/README.mdindex b66777faf..628abf218 100644--- a/store/agents/mujoco/README.md+++ b/store/agents/mujoco/README.md@@ -8,8 +8,9 @@ frame by frame. Menagerie robots (Unitree Go2, G1, H1, Berkeley Humanoid, BoosteMJX and MuJoCo Playground are one script away for training. Runs on Claude Code.- `harness.json` — engine, template, skill, toolchain, `viewer.use: autonomous/mujoco-viewer`.-- `toolchain/setup.sh` — one venv with the pinned MuJoCo (`VERSIONS`) and a sparse checkout of the- Menagerie robots at a pinned commit; `install-training.sh` adds JAX, MJX and Playground;+- `toolchain/setup.sh` — one venv on Python 3.12 (uv brings it when the machine has none) with the+ pinned MuJoCo (`VERSIONS`), which has no Intel Mac build — Apple Silicon Macs and Linux — and a sparse+ checkout of the Menagerie robots at a pinned commit; `install-training.sh` adds JAX, MJX and Playground;`harness_mujoco.py` loads (`servos=` turns torque motors into position servos), records and holdsposes; `verdict.py` judges the rollout and names the trajectory as the artifact — never the video.- **What a rollout is** (`record`, all under `out/`): `rollout.qpos.json` — per frame `time`, `qpos`,diff --git a/store/agents/mujoco/toolchain/doctor.sh b/store/agents/mujoco/toolchain/doctor.shindex 26db92382..85f7e1511 100755--- a/store/agents/mujoco/toolchain/doctor.sh+++ b/store/agents/mujoco/toolchain/doctor.sh@@ -1,5 +1,8 @@#!/usr/bin/env bashset -u; cd "$(dirname "$0")/.."; bad=0+# shellcheck disable=SC1091+. ./VERSIONS+if [ "$(uname -s)-$(uname -m)" = Darwin-x86_64 ]; then echo "miss mujoco ${MUJOCO} has no Intel Mac build — this harness needs an Apple Silicon Mac, or Linux"; exit 1; fiif [ -x .venv/bin/python ] && .venv/bin/python -c 'import mujoco' 2>/dev/null; then echo "ok mujoco $(.venv/bin/python -c 'import mujoco; print(mujoco.__version__)')"; else echo "miss .venv with mujoco — run toolchain/setup.sh"; bad=1; fiif [ -f menagerie/unitree_go2/scene.xml ]; then echo "ok menagerie @ $(cat menagerie/.harness-commit 2>/dev/null)"; else echo "miss menagerie — run toolchain/setup.sh"; bad=1; fiif .venv/bin/python -c 'import jax, mujoco_playground' 2>/dev/null; then echo "ok training extras (jax, mjx, playground)"; else echo "warn training extras not installed — toolchain/install-training.sh when a policy is wanted"; fidiff --git a/store/agents/mujoco/toolchain/install-training.sh b/store/agents/mujoco/toolchain/install-training.shindex 26ce6935e..e3ad52335 100755--- a/store/agents/mujoco/toolchain/install-training.sh+++ b/store/agents/mujoco/toolchain/install-training.sh@@ -6,7 +6,11 @@ set -euo pipefailcd "$(dirname "$0")/.."# shellcheck disable=SC1091. ./VERSIONS+# shellcheck source=runtimes.sh+. toolchain/runtimes.sh+[ -x .venv/bin/python ] || { echo "miss .venv — run toolchain/setup.sh first"; exit 1; }# MJX releases with MuJoCo, version for version: pinned both, so the extras never move the MuJoCo# setup.sh installed (an unpinned mujoco-mjx pulls the newest mujoco along with it).-.venv/bin/python -m pip install --quiet "jax" "mujoco==${MUJOCO}" "mujoco-mjx==${MUJOCO}" "playground"-.venv/bin/python -c 'import jax; from mujoco import mjx; import mujoco_playground; print("ok jax", jax.__version__, "· mjx · playground", mujoco_playground.__version__, "· devices", jax.devices())'+harness_pip .venv "jax" "mujoco==${MUJOCO}" "mujoco-mjx==${MUJOCO}" "playground"+# mujoco_playground has no __version__: the version is the distribution's.+.venv/bin/python -c 'import jax; from mujoco import mjx; import mujoco_playground; from importlib.metadata import version; print("ok jax", jax.__version__, "· mjx · playground", version("playground"), "· devices", jax.devices())'diff --git a/store/agents/mujoco/toolchain/runtimes.sh b/store/agents/mujoco/toolchain/runtimes.shnew file mode 100644index 000000000..51fefe3f9--- /dev/null+++ b/store/agents/mujoco/toolchain/runtimes.sh@@ -0,0 +1,190 @@+# shellcheck shell=bash+# runtimes.sh — the interpreters a store package runs on, found on this machine or fetched, never+# asked of the person who pressed Get.+#+# Sourced (not run) by a package's setup, doctor and viewer scripts. A new Mac has Apple's Python 3.9,+# no Homebrew and, for most people, no Node on PATH; a package that answers "brew install [email protected]"+# has failed its install. So:+#+# harness_node 18 node >= 18 on PATH, with npm: the machine's own, else the Node Harness+# itself runs on (~/.harness/runtime/current-node, laid down with the CLI)+# harness_uv uv on PATH: the machine's own, else a pinned, checksummed release+# fetched into ~/.harness/runtime+# harness_venv DIR 3.12 [MIN [BELOW]]+# DIR is a venv on CPython 3.12, which uv downloads when the machine+# has none. A venv already there on a Python in [MIN, BELOW) is kept.+# harness_pip DIR PKG… install into that venv, through uv+# harness_micromamba micromamba, pinned and checksummed, for native libraries PyPI has+# no wheel for (pycairo on macOS)+# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages+#+# Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).+#+# ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package+# carries an identical copy (a package installs alone, so it cannot reach this one);+# `node store/tools/sync-runtimes.mjs` rewrites them and the CLI's store spec fails when one drifts.++HARNESS_RUNTIME="${ADAPTER_RUNTIME_DIR:-${HOME:-}/.harness/runtime}"+# The Pythons uv downloads live with Harness's other runtimes, not in uv's own ~/.local/share/uv:+# a package's venv points at its interpreter, and `uv python uninstall` there must not break it.+UV_PYTHON_INSTALL_DIR="${UV_PYTHON_INSTALL_DIR:-$HARNESS_RUNTIME/python}"+export UV_PYTHON_INSTALL_DIR+HARNESS_UV_VERSION=0.12.15+HARNESS_MICROMAMBA_VERSION=2.9.0-0++_harness_platform() {+ case "$(uname -s)-$(uname -m)" in+ Darwin-arm64) echo darwin-arm64 ;;+ Darwin-x86_64) echo darwin-x64 ;;+ Linux-x86_64) echo linux-x64 ;;+ Linux-aarch64 | Linux-arm64) echo linux-arm64 ;;+ *) return 1 ;;+ esac+}++_harness_sha256() {+ if command -v shasum >/dev/null 2>&1; then shasum -a 256 "$1" | cut -d' ' -f1+ else sha256sum "$1" | cut -d' ' -f1; fi+}++# _harness_fetch URL DEST SHA256 — DEST exists only if what arrived matches the pinned checksum.+_harness_fetch() {+ local part="$2.part.$$"+ if ! curl -fsSL --retry 3 --connect-timeout 20 --max-time 900 -o "$part" "$1"; then+ rm -f "$part"; echo "miss could not download $1 — check this machine's internet connection"; return 1+ fi+ if [ "$(_harness_sha256 "$part")" != "$3" ]; then+ rm -f "$part"; echo "miss $1 did not match its pinned checksum; nothing was installed"; return 1+ fi+ mv -f "$part" "$2"+}++_harness_node_at_least() {+ command -v node >/dev/null 2>&1 || return 1+ node -e '+ const [a, b = 0] = process.argv[1].split(".").map(Number)+ const [x, y] = process.versions.node.split(".").map(Number)+ process.exit(x > a || (x === a && y >= b) ? 0 : 1)+ ' "$1" >/dev/null 2>&1+}++harness_node() {+ local min="${1:-18}" recorded saved="$PATH" own=0+ _harness_node_at_least "$min" && own=1+ # A node without npm beside it (a distro's nodejs package) cannot run a setup's `npm ci`.+ if [ "$own" = 1 ] && command -v npm >/dev/null 2>&1; then return 0; fi+ recorded="$(cat "$HARNESS_RUNTIME/current-node" 2>/dev/null || true)"+ if [ -n "$recorded" ] && [ -x "${recorded%/*}/node" ]; then+ PATH="${recorded%/*}:$PATH"; export PATH; hash -r 2>/dev/null || true+ _harness_node_at_least "$min" && return 0+ PATH="$saved"; export PATH; hash -r 2>/dev/null || true+ [ "$own" = 1 ] && return 0+ echo "miss node >= $min — this machine's newest is $("${recorded%/*}/node" -v), Harness's own; update Harness"+ return 1+ fi+ [ "$own" = 1 ] && return 0+ echo "miss node >= $min, and Harness's own Node is not in $HARNESS_RUNTIME — run \`harness start\` once to lay it down"+ return 1+}++harness_uv() {+ local dir asset sum tmp+ command -v uv >/dev/null 2>&1 && return 0+ for dir in "${HOME:-}/.local/bin" "${HOME:-}/.cargo/bin"; do+ [ -n "${HOME:-}" ] || break+ if [ -x "$dir/uv" ]; then PATH="$dir:$PATH"; export PATH; return 0; fi+ done+ dir="$HARNESS_RUNTIME/uv-$HARNESS_UV_VERSION"+ if [ ! -x "$dir/uv" ]; then+ case "$(_harness_platform)" in+ darwin-arm64) asset=uv-aarch64-apple-darwin sum=dc304b9ed1b24174572290fba60ac3f6fe63c73a671f0439e62a91375841964d ;;+ darwin-x64) asset=uv-x86_64-apple-darwin sum=e9ca61775532368fe518ab03e7a354c7ecab8ccb3c7d941c775fcc4a362b801b ;;+ linux-x64) asset=uv-x86_64-unknown-linux-gnu sum=f97935763c04be3e692460a7aaeaaab8fc3b78fcf8b389da820b38ae7423a638 ;;+ linux-arm64) asset=uv-aarch64-unknown-linux-gnu sum=0e9a3499b0587d449c9ff684c0160da607826e4af1cee220bc87f378702d3e08 ;;+ *) echo "miss uv — there is no uv release for $(uname -s) $(uname -m); install it from https://docs.astral.sh/uv/"; return 1 ;;+ esac+ echo " fetching uv $HARNESS_UV_VERSION into $HARNESS_RUNTIME (it brings Python and the packages)"+ mkdir -p "$HARNESS_RUNTIME" || { echo "miss cannot write $HARNESS_RUNTIME"; return 1; }+ tmp="$(mktemp -d "$HARNESS_RUNTIME/.uv.XXXXXX")" || { echo "miss cannot write $HARNESS_RUNTIME"; return 1; }+ if ! _harness_fetch "https://github.com/astral-sh/uv/releases/download/$HARNESS_UV_VERSION/$asset.tar.gz" "$tmp/uv.tar.gz" "$sum"; then+ rm -rf "$tmp"; return 1+ fi+ tar -xzf "$tmp/uv.tar.gz" -C "$tmp" && chmod +x "$tmp/$asset/uv" "$tmp/$asset/uvx" \+ || { rm -rf "$tmp"; echo "miss the uv archive would not unpack"; return 1; }+ # Two installs at once both get here; whichever renames first wins and the other's copy goes.+ # (mv onto a directory that exists would nest the copy inside it, hence the test.)+ [ -e "$dir" ] || mv "$tmp/$asset" "$dir" 2>/dev/null || true+ rm -rf "$tmp"+ [ -x "$dir/uv" ] || { echo "miss uv did not land in $dir"; return 1; }+ fi+ PATH="$dir:$PATH"; export PATH+}++# harness_venv DIR VERSION [MIN [BELOW]] — MIN defaults to VERSION; BELOW is exclusive and optional.+harness_venv() {+ local dir="${1:?harness_venv needs a directory}" want="${2:?harness_venv needs a Python version}"+ local min="${3:-$2}" below="${4:-}"+ if [ -x "$dir/bin/python" ] && "$dir/bin/python" -c '+import sys+at = lambda s: tuple(int(p) for p in s.split("."))+v = sys.version_info[:2]+sys.exit(0 if v >= at(sys.argv[1]) and (not sys.argv[2] or v < at(sys.argv[2])) else 1)+' "$min" "$below" 2>/dev/null; then+ echo "ok $("$dir/bin/python" --version) in $dir"+ return 0+ fi+ harness_uv || return 1+ echo " python $want in $dir (uv downloads it when this machine has none)"+ rm -rf "$dir"+ # only-managed: the same python-build-standalone interpreter on every machine, so a package tested+ # once is tested everywhere — not whichever Homebrew or pyenv Python happened to be first on PATH.+ uv venv --quiet --seed --python "$want" --python-preference only-managed "$dir" \+ || { echo "miss could not make a Python $want environment in $dir"; return 1; }+ echo "ok $("$dir/bin/python" --version) in $dir"+}++harness_pip() {+ local dir="${1:?harness_pip needs a venv}"+ shift+ harness_uv || return 1+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }+}++harness_micromamba() {+ local dir asset sum+ dir="$HARNESS_RUNTIME/micromamba-$HARNESS_MICROMAMBA_VERSION"+ if [ ! -x "$dir/micromamba" ]; then+ case "$(_harness_platform)" in+ darwin-arm64) asset=micromamba-osx-arm64 sum=ec2a072f028e1a7cf20f3e2e74d5a8127cf5a5f27636375b5359811565f4e5be ;;+ darwin-x64) asset=micromamba-osx-64 sum=1e71054bb3ac9a076e21f7ec48acfef536f9b3f1408f371a942784bf5ef83d8a ;;+ linux-x64) asset=micromamba-linux-64 sum=366cd9cd8be14df1ab8ed50352a82111082a36686b2d389fdb79a92c3fafb3e3 ;;+ linux-arm64) asset=micromamba-linux-aarch64 sum=9f93b974adcb4d166996af969b6cd371287d1a3e52733704727884d9b74cb7a7 ;;+ *) echo "miss micromamba — there is no release for $(uname -s) $(uname -m)"; return 1 ;;+ esac+ echo " fetching micromamba $HARNESS_MICROMAMBA_VERSION into $HARNESS_RUNTIME (native libraries PyPI has no wheel for)"+ mkdir -p "$dir" || { echo "miss cannot write $dir"; return 1; }+ _harness_fetch "https://github.com/mamba-org/micromamba-releases/releases/download/$HARNESS_MICROMAMBA_VERSION/$asset" "$dir/micromamba.$$" "$sum" || return 1+ chmod +x "$dir/micromamba.$$" && mv -f "$dir/micromamba.$$" "$dir/micromamba" \+ || { rm -f "$dir/micromamba.$$"; echo "miss micromamba would not install into $dir"; return 1; }+ fi+ HARNESS_MICROMAMBA="$dir/micromamba"+ export HARNESS_MICROMAMBA+}++# harness_conda_env DIR SPEC… — conda-forge only, packages cached under ~/.harness/runtime/mamba.+harness_conda_env() {+ local dir="${1:?harness_conda_env needs a directory}"+ shift+ # micromamba takes a relative --prefix as a name under its root prefix and "succeeds" there.+ case "$dir" in /*) ;; *) dir="$PWD/$dir" ;; esac+ harness_micromamba || return 1+ MAMBA_ROOT_PREFIX="$HARNESS_RUNTIME/mamba" "$HARNESS_MICROMAMBA" create --yes --quiet \+ --prefix "$dir" --override-channels --channel conda-forge "$@" >/dev/null \+ && [ -d "$dir/conda-meta" ] \+ || { echo "miss could not make the conda-forge environment in $dir ($*)"; return 1; }+}diff --git a/store/agents/mujoco/toolchain/setup.sh b/store/agents/mujoco/toolchain/setup.shindex 1f498edaa..f06938f87 100755--- a/store/agents/mujoco/toolchain/setup.sh+++ b/store/agents/mujoco/toolchain/setup.sh@@ -2,17 +2,19 @@# Runs once at install, cwd = the install dir. One venv with the pinned MuJoCo and the pieces that# turn a simulation into a video; the MuJoCo Menagerie robots the skill names, at a pinned commit,# sparsely (their meshes are most of the repository). Training extras are a second script.+# MuJoCo has wheels for 3.10 on, the training extras (MuJoCo Playground) want 3.11+: the venv is on+# 3.12 whatever this machine has (uv downloads it when it is not here); one already on 3.11–3.14 is kept.set -euo pipefailcd "$(dirname "$0")/.."# shellcheck disable=SC1091. ./VERSIONS-PY=""; for c in python3.12 python3.11 python3.13 python3; do if command -v "$c" >/dev/null 2>&1 && "$c" -c 'import sys; raise SystemExit(0 if (3, 10) <= sys.version_info < (3, 14) else 1)' 2>/dev/null; then PY="$c"; break; fi; done-[ -n "$PY" ] || { echo "miss python 3.10–3.13 (brew install [email protected])"; exit 1; }-echo "ok $($PY --version)"-[ -x .venv/bin/python ] || "$PY" -m venv .venv-.venv/bin/python -m pip install --quiet --upgrade pip >/dev/null 2>&1 || true+# shellcheck source=runtimes.sh+. toolchain/runtimes.sh+# MuJoCo publishes no Intel Mac wheel since 3.10.0: say so before downloading anything, not in a resolver error.+if [ "$(uname -s)-$(uname -m)" = Darwin-x86_64 ]; then echo "miss mujoco ${MUJOCO} has no Intel Mac build — this harness needs an Apple Silicon Mac, or Linux"; exit 1; fi+harness_venv .venv 3.12 3.11 3.15 || exit 1echo " installing mujoco ${MUJOCO}"-.venv/bin/python -m pip install --quiet "mujoco==${MUJOCO}" numpy "imageio[ffmpeg]"+harness_pip .venv "mujoco==${MUJOCO}" numpy "imageio[ffmpeg]"echo "ok mujoco $(.venv/bin/python -c 'import mujoco; print(mujoco.__version__)')"if [ ! -f menagerie/.harness-commit ] || [ "$(cat menagerie/.harness-commit)" != "${MENAGERIE_COMMIT}" ]; thenecho " fetching MuJoCo Menagerie @ ${MENAGERIE_COMMIT} (${MENAGERIE_ROBOTS})"diff --git a/store/agents/mujoco/toolchain/test_scripts.py b/store/agents/mujoco/toolchain/test_scripts.pyindex 7ac3973b4..4a2ed9e99 100644--- a/store/agents/mujoco/toolchain/test_scripts.py+++ b/store/agents/mujoco/toolchain/test_scripts.py@@ -1,6 +1,7 @@"""setup.sh, doctor.sh, init-workspace.sh and install-training.sh, run for real against a scratchinstall whose PATH holds only stub commands (and the few coreutils the scripts use): every ok / miss /-warn line is reached with no network, no pip and no MuJoCo on the machine.+warn line is reached with no network, no pip and no MuJoCo on the machine. uv is a stub too: what+runtimes.sh does when uv is not on PATH at all is store/tools/test_runtimes.py's business.python3 -m unittest toolchain/test_scripts.py"""@@ -11,21 +12,20 @@ PACKAGE = Path(__file__).resolve().parent.parent# A bash line tracer (BASH_ENV sourcing a DEBUG trap that appends to SHCOV_OUT) is passed through when set.TRACER = {k: os.environ[k] for k in ("BASH_ENV", "SHCOV_OUT") if k in os.environ}BASH = "/bin/bash"-COREUTILS = ("dirname", "cat", "mkdir", "cp", "rm", "grep")+COREUTILS = ("dirname", "cat", "mkdir", "cp", "rm", "grep", "mktemp", "cut", "shasum")VERSIONS = dict(line.split("=", 1) for line in (PACKAGE / "VERSIONS").read_text().split("\n") if "=" in line)MUJOCO = VERSIONS["MUJOCO"]COMMIT = VERSIONS["MENAGERIE_COMMIT"]ROBOTS = VERSIONS["MENAGERIE_ROBOTS"].strip('"').split()-# The venv's python: pip succeeds unless told otherwise, `import mujoco` works, the training imports-# only when TRAINING=1, and the heredoc render check "renders" when it is the script it should be.+# The venv's python: its version (VENV_PY; runtimes.sh's keep-or-replace probe answers VENV_PY_OK),+# `import mujoco` works, the training imports only when TRAINING=1, and the heredoc render check+# "renders" when it is the script it should be.VENV_PYTHON = r'''case "$1" in- -m) case " $* " in- *" --upgrade pip "*) exit "${PIP_UPGRADE_EXIT:-0}" ;;- *) exit "${PIP_EXIT:-0}" ;;- esac ;;+ --version) echo "Python ${VENV_PY:-3.12.9}" ;;-c) case "$2" in+ *version_info*) exit "${VENV_PY_OK:-0}" ;;*jax*) [ "${TRAINING:-0}" = 1 ] || exit 1case "$2" in *print*) echo "ok jax 0.7.2 · mjx · playground 0.2.0 · devices [CpuDevice(id=0)]" ;; esac ;;*__version__*) echo "$MUJOCO_VERSION" ;;@@ -38,12 +38,12 @@ case "$1" inesac'''-# A system python: passes the version probe unless PROBE_EXIT says otherwise, and makes a venv.-SYSTEM_PYTHON = r'''+# uv, as far as runtimes.sh uses it: `uv venv … DIR` makes a venv of the stub above, `uv pip install`+# answers UV_PIP_EXIT.+UV = r'''case "$1" in- -c) exit "${PROBE_EXIT:-0}" ;;- --version) echo "Python ${VERSION:-3.12.4}" ;;- -m) mkdir -p "$3/bin" && cp "$VENV_TEMPLATE" "$3/bin/python" ;;+ venv) for last in "$@"; do :; done; mkdir -p "$last/bin" && cp "$VENV_TEMPLATE" "$last/bin/python" ;;+ pip) exit "${UV_PIP_EXIT:-0}" ;;esac'''@@ -80,10 +80,16 @@ class Sandbox:real = next(p for p in (Path("/bin") / name, Path("/usr/bin") / name) if p.exists())(self.bin / name).symlink_to(real)self.venv_template = self.stub("python", VENV_PYTHON, where=self.root / "templates")+ self.machine("Darwin", "arm64")++ def machine(self, system: str, arch: str) -> None:+ """What `uname -s` and `uname -m` answer."""+ self.stub("uname", f'case "$1" in -s) echo {system} ;; -m) echo {arch} ;; esac')def stub(self, name: str, body: str = "", where: Path | None = None) -> Path:path = (where or self.bin) / namepath.parent.mkdir(parents=True, exist_ok=True)+ path.unlink(missing_ok=True) # never write through a link to a real commandpath.write_text(f'#!/bin/bash\necho "{name} $*" >> "$CALLS"\n{body}\n')path.chmod(0o755)return path@@ -125,6 +131,12 @@ class Doctor(unittest.TestCase):self.assertEqual(r.returncode, 0, r.stderr)self.assertEqual(r.stdout.splitlines()[-1], "warn training extras not installed — toolchain/install-training.sh when a policy is wanted")+ def test_an_intel_mac_is_told_it_cannot_run_this_harness(self):+ box = Sandbox(self)+ box.machine("Darwin", "x86_64")+ r = box.run("doctor.sh")+ self.assertEqual((r.returncode, r.stdout), (1, f"miss mujoco {MUJOCO} has no Intel Mac build — this harness needs an Apple Silicon Mac, or Linux\n"))+def test_nothing_installed(self):r = Sandbox(self).run("doctor.sh")self.assertEqual(r.returncode, 1)@@ -144,18 +156,16 @@ class Setup(unittest.TestCase):def sandbox(self) -> Sandbox:box = Sandbox(self)box.stub("git", GIT)+ box.stub("uv", UV)return boxdef test_a_fresh_install(self):box = self.sandbox()- for name in ("python3", "python3.11", "python3.13"):- box.stub(name, SYSTEM_PYTHON)- # No python3.12: python3.11 comes next, before python3.13 and python3. A failing pip- # self-upgrade is not fatal.- r = box.run("setup.sh", VERSION="3.11.9", PIP_UPGRADE_EXIT="1")+ r = box.run("setup.sh")self.assertEqual(r.returncode, 0, r.stdout + r.stderr)self.assertEqual(r.stdout.splitlines(), [- "ok Python 3.11.9",+ " python 3.12 in .venv (uv downloads it when this machine has none)",+ "ok Python 3.12.9 in .venv",f" installing mujoco {MUJOCO}",f"ok mujoco {MUJOCO}",f" fetching MuJoCo Menagerie @ {COMMIT} ({' '.join(ROBOTS)})",@@ -164,30 +174,36 @@ class Setup(unittest.TestCase):"ok offscreen rendering works",])calls = box.logged()- self.assertIn("python3.11 -m venv .venv", calls)- self.assertIn(f'python -m pip install --quiet mujoco=={MUJOCO} numpy imageio[ffmpeg]', calls)+ self.assertIn("uv venv --quiet --seed --python 3.12 --python-preference only-managed .venv", calls)+ self.assertIn(f"uv pip install --quiet --python .venv/bin/python mujoco=={MUJOCO} numpy imageio[ffmpeg]", calls)self.assertIn(f"git sparse-checkout set {' '.join(ROBOTS)}", calls)self.assertIn(f"git fetch -q --depth 1 --filter=blob:none origin {COMMIT}", calls)- self.assertFalse(any(c.startswith("python3 ") for c in calls), "python3.11 is tried before python3")self.assertEqual((box.install / "menagerie" / ".harness-commit").read_text().strip(), COMMIT)for robot in ROBOTS:self.assertTrue((box.install / "menagerie" / robot / "scene.xml").is_file())def test_a_second_run_keeps_the_venv_and_the_menagerie(self):box = self.sandbox()- box.stub("python3.12", SYSTEM_PYTHON)box.venv()box.menagerie()- r = box.run("setup.sh")+ r = box.run("setup.sh", VENV_PY="3.11.9")self.assertEqual(r.returncode, 0, r.stdout + r.stderr)+ self.assertEqual(r.stdout.splitlines()[0], "ok Python 3.11.9 in .venv")self.assertNotIn(" fetching", r.stdout)calls = box.logged()self.assertFalse(any(c.startswith("git ") for c in calls))- self.assertNotIn("python3.12 -m venv .venv", calls)+ self.assertFalse(any(c.startswith("uv venv") for c in calls))++ def test_a_venv_on_a_python_out_of_range_is_replaced(self):+ box = self.sandbox()+ box.venv()+ box.menagerie()+ r = box.run("setup.sh", VENV_PY_OK="1")+ self.assertEqual(r.returncode, 0, r.stdout + r.stderr)+ self.assertIn("uv venv --quiet --seed --python 3.12 --python-preference only-managed .venv", box.logged())def test_a_menagerie_at_another_commit_is_fetched_again(self):box = self.sandbox()- box.stub("python3.12", SYSTEM_PYTHON)box.venv()box.menagerie(commit="0" * 40, robots=["old_robot"])r = box.run("setup.sh")@@ -195,24 +211,41 @@ class Setup(unittest.TestCase):self.assertIn(f" fetching MuJoCo Menagerie @ {COMMIT}", r.stdout)self.assertFalse((box.install / "menagerie" / "old_robot").exists(), "the old checkout is replaced, not added to")- def test_no_python_in_range_is_a_miss(self):+ def test_no_uv_and_no_network_is_a_miss(self):+ box = Sandbox(self)+ box.stub("curl", "exit 6")+ r = box.run("setup.sh", ADAPTER_RUNTIME_DIR=str(box.root / "runtime"))+ self.assertEqual(r.returncode, 1)+ self.assertEqual(r.stdout.splitlines()[-1], "miss could not download https://github.com/astral-sh/uv/releases/download/"+ "0.12.15/uv-aarch64-apple-darwin.tar.gz — check this machine's internet connection")+ self.assertFalse((box.install / ".venv").exists())++ def test_an_intel_mac_stops_before_downloading_anything(self):box = self.sandbox()- box.stub("python3", SYSTEM_PYTHON)- r = box.run("setup.sh", PROBE_EXIT="1")- self.assertEqual((r.returncode, r.stdout.strip()), (1, "miss python 3.10–3.13 (brew install [email protected])"))+ box.machine("Darwin", "x86_64")+ r = box.run("setup.sh")+ self.assertEqual((r.returncode, r.stdout), (1, f"miss mujoco {MUJOCO} has no Intel Mac build — this harness needs an Apple Silicon Mac, or Linux\n"))+ self.assertFalse(any(c.startswith(("uv ", "git ")) for c in box.logged()))+ self.assertFalse((box.install / ".venv").exists())++ def test_linux_on_either_architecture_installs(self):+ for arch in ("x86_64", "aarch64"):+ with self.subTest(arch=arch):+ box = self.sandbox()+ box.machine("Linux", arch)+ r = box.run("setup.sh")+ self.assertEqual((r.returncode, r.stdout.splitlines()[-1]), (0, "ok offscreen rendering works"), r.stderr)def test_a_robot_the_checkout_did_not_bring_is_a_miss(self):box = self.sandbox()- box.stub("python3.12", SYSTEM_PYTHON)r = box.run("setup.sh", SKIP_ROBOT=ROBOTS[-1])self.assertEqual(r.returncode, 1)self.assertEqual(r.stdout.splitlines()[-1], f"miss menagerie/{ROBOTS[-1]}/scene.xml")def test_failures_stop_setup(self):- for env, not_reached in (({"PIP_EXIT": "1"}, "ok mujoco"), ({"FETCH_EXIT": "128"}, "ok menagerie"), ({"GL": "0"}, "ok offscreen")):+ for env, not_reached in (({"UV_PIP_EXIT": "1"}, "ok mujoco"), ({"FETCH_EXIT": "128"}, "ok menagerie"), ({"GL": "0"}, "ok offscreen")):with self.subTest(**env):box = self.sandbox()- box.stub("python3.12", SYSTEM_PYTHON)r = box.run("setup.sh", **env)self.assertNotEqual(r.returncode, 0)self.assertNotIn(not_reached, r.stdout)@@ -221,28 +254,39 @@ class Setup(unittest.TestCase):class InstallTraining(unittest.TestCase):- def test_installs_mjx_pinned_to_the_mujoco_setup_installed(self):+ def sandbox(self) -> Sandbox:box = Sandbox(self)+ box.stub("uv", UV)box.venv()+ return box++ def test_installs_mjx_pinned_to_the_mujoco_setup_installed(self):+ box = self.sandbox()r = box.run("install-training.sh", TRAINING="1")self.assertEqual(r.returncode, 0, r.stderr)self.assertEqual(r.stdout.splitlines(), ["ok jax 0.7.2 · mjx · playground 0.2.0 · devices [CpuDevice(id=0)]"])# Before: an unpinned mujoco-mjx, which pulls the newest mujoco over the pinned one.- self.assertIn(f"python -m pip install --quiet jax mujoco=={MUJOCO} mujoco-mjx=={MUJOCO} playground", box.logged())+ self.assertIn(f"uv pip install --quiet --python .venv/bin/python jax mujoco=={MUJOCO} mujoco-mjx=={MUJOCO} playground", box.logged())def test_a_failed_install_fails(self):- box = Sandbox(self)- box.venv()- r = box.run("install-training.sh", PIP_EXIT="1", TRAINING="1")+ box = self.sandbox()+ r = box.run("install-training.sh", UV_PIP_EXIT="1", TRAINING="1")self.assertNotEqual(r.returncode, 0)- self.assertEqual(r.stdout, "")+ self.assertEqual(len(r.stdout.splitlines()), 1, r.stdout)+ self.assertTrue(r.stdout.startswith("miss could not install ") and r.stdout.rstrip().endswith(" into .venv"), r.stdout)def test_imports_that_do_not_work_after_install_fail(self):- box = Sandbox(self)- box.venv()+ box = self.sandbox()r = box.run("install-training.sh")self.assertNotEqual(r.returncode, 0)+ def test_no_venv_is_a_miss(self):+ box = Sandbox(self)+ box.stub("uv", UV)+ r = box.run("install-training.sh", TRAINING="1")+ self.assertEqual((r.returncode, r.stdout), (1, "miss .venv — run toolchain/setup.sh first\n"))+ self.assertEqual(box.logged(), [])+class InitWorkspace(unittest.TestCase):def test_a_first_rollout_and_the_verdict_even_when_both_fail(self):diff --git a/store/agents/phaser/toolchain/runtimes.sh b/store/agents/phaser/toolchain/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/agents/phaser/toolchain/runtimes.sh+++ b/store/agents/phaser/toolchain/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/agents/rdkit/README.md b/store/agents/rdkit/README.mdindex 6a89a0fd7..c5c90151f 100644--- a/store/agents/rdkit/README.md+++ b/store/agents/rdkit/README.md@@ -21,7 +21,9 @@ linked atom-for-atom, its properties and rule badges, and the series it belongs`design` works. PNG of the view, SVG, SDF (lowest or all conformers) and MOL export. Keyboard: `?`.The server reads `<name>.molecule.json`; for an SDF the toolchain did not write it asks a long-lived`harness_rdkit.py serve` worker, so older workspaces get the same pane.-- `toolchain/setup.sh` — one venv with the pinned RDKit, numpy and pandas (`VERSIONS`) plus `npm ci`;+- `toolchain/setup.sh` — one venv on Python 3.12 (uv brings it when the machine has none) with the+ pinned RDKit, numpy and pandas (`VERSIONS`), plus `npm ci` (on Harness's own Node when the machine has+ none) — Apple Silicon Macs and Linux, since the pinned RDKit has no Intel Mac build;`harness_rdkit.py` builds from SMILES, searches conformers (ETKDGv3 + MMFF94), describes the molecule(charges, groups, alerts, depiction, parent and change) and writes the SDFs, the depiction, therecord, the series, the properties and the report; `verdict.py` judges Design / Embed / Review.diff --git a/store/agents/rdkit/toolchain/doctor.sh b/store/agents/rdkit/toolchain/doctor.shindex 78b92c34e..a625d6f68 100755--- a/store/agents/rdkit/toolchain/doctor.sh+++ b/store/agents/rdkit/toolchain/doctor.sh@@ -1,8 +1,13 @@#!/usr/bin/env bashset -u; cd "$(dirname "$0")/.."; bad=0+# shellcheck disable=SC1091+. ./VERSIONS+# shellcheck source=runtimes.sh+. toolchain/runtimes.sh+if [ "$(uname -s)-$(uname -m)" = Darwin-x86_64 ]; then echo "miss rdkit ${RDKIT} has no Intel Mac build — this harness needs an Apple Silicon Mac, or Linux"; exit 1; fiif [ -x .venv/bin/python ] && .venv/bin/python -c 'import rdkit' 2>/dev/null; then echo "ok rdkit $(.venv/bin/python -c 'import rdkit; print(rdkit.__version__)')"; else echo "miss .venv with rdkit — run toolchain/setup.sh"; bad=1; fiif [ -x .venv/bin/python ] && .venv/bin/python -c 'import pandas' 2>/dev/null; then echo "ok pandas $(.venv/bin/python -c 'import pandas; print(pandas.__version__)') · numpy $(.venv/bin/python -c 'import numpy; print(numpy.__version__)')"; else echo "warn pandas/numpy missing — tables and enumerations need them"; fi-if command -v node >/dev/null 2>&1; then echo "ok node $(node --version) (the pane's server)"; else echo "miss node >= 18 on PATH — the pane cannot start"; bad=1; fi+if harness_node 18; then echo "ok node $(node --version) (the pane's server)"; else bad=1; fiif [ -f node_modules/3dmol/build/3Dmol-min.js ]; then echo "ok 3dmol $(node -p "require('3dmol/package.json').version") (the pane)"; else echo "miss node_modules — run toolchain/setup.sh"; bad=1; fiif [ -f pane/index.html ] && [ -f pane/app.js ]; then echo "ok pane (3D, 2D, properties, conformers, series)"; else echo "miss pane/ — reinstall the package"; bad=1; fiexit $baddiff --git a/store/agents/rdkit/toolchain/runtimes.sh b/store/agents/rdkit/toolchain/runtimes.shnew file mode 100644index 000000000..51fefe3f9--- /dev/null+++ b/store/agents/rdkit/toolchain/runtimes.sh@@ -0,0 +1,190 @@+# shellcheck shell=bash+# runtimes.sh — the interpreters a store package runs on, found on this machine or fetched, never+# asked of the person who pressed Get.+#+# Sourced (not run) by a package's setup, doctor and viewer scripts. A new Mac has Apple's Python 3.9,+# no Homebrew and, for most people, no Node on PATH; a package that answers "brew install [email protected]"+# has failed its install. So:+#+# harness_node 18 node >= 18 on PATH, with npm: the machine's own, else the Node Harness+# itself runs on (~/.harness/runtime/current-node, laid down with the CLI)+# harness_uv uv on PATH: the machine's own, else a pinned, checksummed release+# fetched into ~/.harness/runtime+# harness_venv DIR 3.12 [MIN [BELOW]]+# DIR is a venv on CPython 3.12, which uv downloads when the machine+# has none. A venv already there on a Python in [MIN, BELOW) is kept.+# harness_pip DIR PKG… install into that venv, through uv+# harness_micromamba micromamba, pinned and checksummed, for native libraries PyPI has+# no wheel for (pycairo on macOS)+# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages+#+# Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).+#+# ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package+# carries an identical copy (a package installs alone, so it cannot reach this one);+# `node store/tools/sync-runtimes.mjs` rewrites them and the CLI's store spec fails when one drifts.++HARNESS_RUNTIME="${ADAPTER_RUNTIME_DIR:-${HOME:-}/.harness/runtime}"+# The Pythons uv downloads live with Harness's other runtimes, not in uv's own ~/.local/share/uv:+# a package's venv points at its interpreter, and `uv python uninstall` there must not break it.+UV_PYTHON_INSTALL_DIR="${UV_PYTHON_INSTALL_DIR:-$HARNESS_RUNTIME/python}"+export UV_PYTHON_INSTALL_DIR+HARNESS_UV_VERSION=0.12.15+HARNESS_MICROMAMBA_VERSION=2.9.0-0++_harness_platform() {+ case "$(uname -s)-$(uname -m)" in+ Darwin-arm64) echo darwin-arm64 ;;+ Darwin-x86_64) echo darwin-x64 ;;+ Linux-x86_64) echo linux-x64 ;;+ Linux-aarch64 | Linux-arm64) echo linux-arm64 ;;+ *) return 1 ;;+ esac+}++_harness_sha256() {+ if command -v shasum >/dev/null 2>&1; then shasum -a 256 "$1" | cut -d' ' -f1+ else sha256sum "$1" | cut -d' ' -f1; fi+}++# _harness_fetch URL DEST SHA256 — DEST exists only if what arrived matches the pinned checksum.+_harness_fetch() {+ local part="$2.part.$$"+ if ! curl -fsSL --retry 3 --connect-timeout 20 --max-time 900 -o "$part" "$1"; then+ rm -f "$part"; echo "miss could not download $1 — check this machine's internet connection"; return 1+ fi+ if [ "$(_harness_sha256 "$part")" != "$3" ]; then+ rm -f "$part"; echo "miss $1 did not match its pinned checksum; nothing was installed"; return 1+ fi+ mv -f "$part" "$2"+}++_harness_node_at_least() {+ command -v node >/dev/null 2>&1 || return 1+ node -e '+ const [a, b = 0] = process.argv[1].split(".").map(Number)+ const [x, y] = process.versions.node.split(".").map(Number)+ process.exit(x > a || (x === a && y >= b) ? 0 : 1)+ ' "$1" >/dev/null 2>&1+}++harness_node() {+ local min="${1:-18}" recorded saved="$PATH" own=0+ _harness_node_at_least "$min" && own=1+ # A node without npm beside it (a distro's nodejs package) cannot run a setup's `npm ci`.+ if [ "$own" = 1 ] && command -v npm >/dev/null 2>&1; then return 0; fi+ recorded="$(cat "$HARNESS_RUNTIME/current-node" 2>/dev/null || true)"+ if [ -n "$recorded" ] && [ -x "${recorded%/*}/node" ]; then+ PATH="${recorded%/*}:$PATH"; export PATH; hash -r 2>/dev/null || true+ _harness_node_at_least "$min" && return 0+ PATH="$saved"; export PATH; hash -r 2>/dev/null || true+ [ "$own" = 1 ] && return 0+ echo "miss node >= $min — this machine's newest is $("${recorded%/*}/node" -v), Harness's own; update Harness"+ return 1+ fi+ [ "$own" = 1 ] && return 0+ echo "miss node >= $min, and Harness's own Node is not in $HARNESS_RUNTIME — run \`harness start\` once to lay it down"+ return 1+}++harness_uv() {+ local dir asset sum tmp+ command -v uv >/dev/null 2>&1 && return 0+ for dir in "${HOME:-}/.local/bin" "${HOME:-}/.cargo/bin"; do+ [ -n "${HOME:-}" ] || break+ if [ -x "$dir/uv" ]; then PATH="$dir:$PATH"; export PATH; return 0; fi+ done+ dir="$HARNESS_RUNTIME/uv-$HARNESS_UV_VERSION"+ if [ ! -x "$dir/uv" ]; then+ case "$(_harness_platform)" in+ darwin-arm64) asset=uv-aarch64-apple-darwin sum=dc304b9ed1b24174572290fba60ac3f6fe63c73a671f0439e62a91375841964d ;;+ darwin-x64) asset=uv-x86_64-apple-darwin sum=e9ca61775532368fe518ab03e7a354c7ecab8ccb3c7d941c775fcc4a362b801b ;;+ linux-x64) asset=uv-x86_64-unknown-linux-gnu sum=f97935763c04be3e692460a7aaeaaab8fc3b78fcf8b389da820b38ae7423a638 ;;+ linux-arm64) asset=uv-aarch64-unknown-linux-gnu sum=0e9a3499b0587d449c9ff684c0160da607826e4af1cee220bc87f378702d3e08 ;;+ *) echo "miss uv — there is no uv release for $(uname -s) $(uname -m); install it from https://docs.astral.sh/uv/"; return 1 ;;+ esac+ echo " fetching uv $HARNESS_UV_VERSION into $HARNESS_RUNTIME (it brings Python and the packages)"+ mkdir -p "$HARNESS_RUNTIME" || { echo "miss cannot write $HARNESS_RUNTIME"; return 1; }+ tmp="$(mktemp -d "$HARNESS_RUNTIME/.uv.XXXXXX")" || { echo "miss cannot write $HARNESS_RUNTIME"; return 1; }+ if ! _harness_fetch "https://github.com/astral-sh/uv/releases/download/$HARNESS_UV_VERSION/$asset.tar.gz" "$tmp/uv.tar.gz" "$sum"; then+ rm -rf "$tmp"; return 1+ fi+ tar -xzf "$tmp/uv.tar.gz" -C "$tmp" && chmod +x "$tmp/$asset/uv" "$tmp/$asset/uvx" \+ || { rm -rf "$tmp"; echo "miss the uv archive would not unpack"; return 1; }+ # Two installs at once both get here; whichever renames first wins and the other's copy goes.+ # (mv onto a directory that exists would nest the copy inside it, hence the test.)+ [ -e "$dir" ] || mv "$tmp/$asset" "$dir" 2>/dev/null || true+ rm -rf "$tmp"+ [ -x "$dir/uv" ] || { echo "miss uv did not land in $dir"; return 1; }+ fi+ PATH="$dir:$PATH"; export PATH+}++# harness_venv DIR VERSION [MIN [BELOW]] — MIN defaults to VERSION; BELOW is exclusive and optional.+harness_venv() {+ local dir="${1:?harness_venv needs a directory}" want="${2:?harness_venv needs a Python version}"+ local min="${3:-$2}" below="${4:-}"+ if [ -x "$dir/bin/python" ] && "$dir/bin/python" -c '+import sys+at = lambda s: tuple(int(p) for p in s.split("."))+v = sys.version_info[:2]+sys.exit(0 if v >= at(sys.argv[1]) and (not sys.argv[2] or v < at(sys.argv[2])) else 1)+' "$min" "$below" 2>/dev/null; then+ echo "ok $("$dir/bin/python" --version) in $dir"+ return 0+ fi+ harness_uv || return 1+ echo " python $want in $dir (uv downloads it when this machine has none)"+ rm -rf "$dir"+ # only-managed: the same python-build-standalone interpreter on every machine, so a package tested+ # once is tested everywhere — not whichever Homebrew or pyenv Python happened to be first on PATH.+ uv venv --quiet --seed --python "$want" --python-preference only-managed "$dir" \+ || { echo "miss could not make a Python $want environment in $dir"; return 1; }+ echo "ok $("$dir/bin/python" --version) in $dir"+}++harness_pip() {+ local dir="${1:?harness_pip needs a venv}"+ shift+ harness_uv || return 1+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }+}++harness_micromamba() {+ local dir asset sum+ dir="$HARNESS_RUNTIME/micromamba-$HARNESS_MICROMAMBA_VERSION"+ if [ ! -x "$dir/micromamba" ]; then+ case "$(_harness_platform)" in+ darwin-arm64) asset=micromamba-osx-arm64 sum=ec2a072f028e1a7cf20f3e2e74d5a8127cf5a5f27636375b5359811565f4e5be ;;+ darwin-x64) asset=micromamba-osx-64 sum=1e71054bb3ac9a076e21f7ec48acfef536f9b3f1408f371a942784bf5ef83d8a ;;+ linux-x64) asset=micromamba-linux-64 sum=366cd9cd8be14df1ab8ed50352a82111082a36686b2d389fdb79a92c3fafb3e3 ;;+ linux-arm64) asset=micromamba-linux-aarch64 sum=9f93b974adcb4d166996af969b6cd371287d1a3e52733704727884d9b74cb7a7 ;;+ *) echo "miss micromamba — there is no release for $(uname -s) $(uname -m)"; return 1 ;;+ esac+ echo " fetching micromamba $HARNESS_MICROMAMBA_VERSION into $HARNESS_RUNTIME (native libraries PyPI has no wheel for)"+ mkdir -p "$dir" || { echo "miss cannot write $dir"; return 1; }+ _harness_fetch "https://github.com/mamba-org/micromamba-releases/releases/download/$HARNESS_MICROMAMBA_VERSION/$asset" "$dir/micromamba.$$" "$sum" || return 1+ chmod +x "$dir/micromamba.$$" && mv -f "$dir/micromamba.$$" "$dir/micromamba" \+ || { rm -f "$dir/micromamba.$$"; echo "miss micromamba would not install into $dir"; return 1; }+ fi+ HARNESS_MICROMAMBA="$dir/micromamba"+ export HARNESS_MICROMAMBA+}++# harness_conda_env DIR SPEC… — conda-forge only, packages cached under ~/.harness/runtime/mamba.+harness_conda_env() {+ local dir="${1:?harness_conda_env needs a directory}"+ shift+ # micromamba takes a relative --prefix as a name under its root prefix and "succeeds" there.+ case "$dir" in /*) ;; *) dir="$PWD/$dir" ;; esac+ harness_micromamba || return 1+ MAMBA_ROOT_PREFIX="$HARNESS_RUNTIME/mamba" "$HARNESS_MICROMAMBA" create --yes --quiet \+ --prefix "$dir" --override-channels --channel conda-forge "$@" >/dev/null \+ && [ -d "$dir/conda-meta" ] \+ || { echo "miss could not make the conda-forge environment in $dir ($*)"; return 1; }+}diff --git a/store/agents/rdkit/toolchain/setup.sh b/store/agents/rdkit/toolchain/setup.shindex 7ec6db14c..b620fb1e7 100755--- a/store/agents/rdkit/toolchain/setup.sh+++ b/store/agents/rdkit/toolchain/setup.sh@@ -2,17 +2,20 @@# Runs once at install, cwd = the install dir. Two vendored toolchains, both inside this directory and# nothing on the user's machine: a venv with the pinned RDKit for the chemistry (the agent's toolchain,# and the pane's worker for SDFs the toolchain did not write), and node_modules with 3Dmol.js for the pane.+# The pinned numpy wants Python 3.12+ and pandas has wheels up to 3.14, so the venv is on 3.12 whatever+# this machine has (uv downloads it when it is not here); one already on 3.12–3.14 is kept. npm is the+# one beside the Node the pane runs on: this machine's, else Harness's own.set -euo pipefailcd "$(dirname "$0")/.."# shellcheck disable=SC1091. ./VERSIONS-PY=""; for c in python3.12 python3.11 python3.13 python3; do if command -v "$c" >/dev/null 2>&1 && "$c" -c 'import sys; raise SystemExit(0 if (3, 10) <= sys.version_info < (3, 14) else 1)' 2>/dev/null; then PY="$c"; break; fi; done-[ -n "$PY" ] || { echo "miss python 3.10–3.13 (brew install [email protected])"; exit 1; }-echo "ok $($PY --version)"-[ -x .venv/bin/python ] || "$PY" -m venv .venv-.venv/bin/python -m pip install --quiet --upgrade pip >/dev/null 2>&1 || true+# shellcheck source=runtimes.sh+. toolchain/runtimes.sh+# RDKit publishes no Intel Mac wheel since 2025.9.3: say so before downloading anything, not in a resolver error.+if [ "$(uname -s)-$(uname -m)" = Darwin-x86_64 ]; then echo "miss rdkit ${RDKIT} has no Intel Mac build — this harness needs an Apple Silicon Mac, or Linux"; exit 1; fi+harness_venv .venv 3.12 3.12 3.15 || exit 1echo " installing rdkit ${RDKIT}"-.venv/bin/python -m pip install --quiet "rdkit==${RDKIT}" "numpy==${NUMPY}" "pandas==${PANDAS}"+harness_pip .venv "rdkit==${RDKIT}" "numpy==${NUMPY}" "pandas==${PANDAS}"echo "ok rdkit $(.venv/bin/python -c 'import rdkit; print(rdkit.__version__)') · numpy $(.venv/bin/python -c 'import numpy; print(numpy.__version__)') · pandas $(.venv/bin/python -c 'import pandas; print(pandas.__version__)')"echo " chemistry check (build, conformers, depict, describe, series)"PYTHONPATH="$PWD/toolchain" .venv/bin/python - <<'PY'@@ -33,8 +36,8 @@ assert round(similarity("c1ccccc1O", "c1ccccc1O"), 3) == 1.0assert substructure(mol_from_smiles("c1ccccc1O"), "[OX2H]c1ccccc1")print("ok conformer search, MMFF minimisation, Gasteiger charges, 2D depiction and the series work")PY-command -v node >/dev/null 2>&1 || { echo "miss node >= 18 on PATH (the pane)"; exit 1; }-command -v npm >/dev/null 2>&1 || { echo "miss npm on PATH (the pane)"; exit 1; }+harness_node 18 || exit 1+command -v npm >/dev/null 2>&1 || { echo "miss npm beside $(command -v node) (the pane)"; exit 1; }echo " npm ci (3Dmol.js $(node -p "require('./package.json').dependencies['3dmol']"))"npm ci --silent --no-audit --no-fund[ -f node_modules/3dmol/build/3Dmol-min.js ] || { echo "miss the 3Dmol.js bundle after npm ci"; exit 1; }diff --git a/store/agents/rdkit/toolchain/test_scripts.py b/store/agents/rdkit/toolchain/test_scripts.pyindex daa88cbab..80e4a0abb 100644--- a/store/agents/rdkit/toolchain/test_scripts.py+++ b/store/agents/rdkit/toolchain/test_scripts.py@@ -2,8 +2,10 @@Each test builds a package root in a temp dir with this checkout's scripts symlinked in file by file andruns them with PATH set to a bin dir holding only what the test grants: a few system tools linked in, and-stubs written here for python, the venv's python, node and npm. So "miss node" is a PATH without node,-pip and npm never run, and nothing is written into this checkout.+stubs written here for uv, the venv's python, node and npm. HOME is the sandbox's own, so "miss node" is a+PATH without node and no Harness Node recorded in it; uv, pip and npm never run, and nothing is written+into this checkout. What runtimes.sh does when uv is not on PATH at all is store/tools/test_runtimes.py's+business.With RDKIT_PYTHON pointing at a Python that has RDKit, two more tests run the real chemistry: setup'sown check against this checkout's harness_rdkit.py, and init on the template (the starter molecule and@@ -24,15 +26,17 @@ PKG = HERE.parentVERSIONS = dict(line.split("=", 1) for line in (PKG / "VERSIONS").read_text().split() if "=" in line)REAL_PYTHON = os.environ.get("RDKIT_PYTHON", "")HAS_REAL_PYTHON = bool(REAL_PYTHON) and os.access(REAL_PYTHON, os.X_OK)-TOOLS = ("bash", "cat", "dirname", "ln", "mkdir")+TOOLS = ("bash", "cat", "dirname", "ln", "mkdir", "rm", "mktemp", "cut", "shasum")-# The venv's python: pip is logged and never run; the import probes answer from STUB_* variables; the-# chemistry check (a script on stdin) and file runs are logged, or handed to STUB_REAL_PYTHON.+# The venv's python: its version (STUB_VENV_PY; runtimes.sh's keep-or-replace probe answers+# STUB_VENV_PY_OK); the import probes answer from STUB_* variables; the chemistry check (a script on+# stdin) and file runs are logged, or handed to STUB_REAL_PYTHON.VENV_PYTHON = r"""#!/bin/bashlog() { printf '%s\n' "$*" >> "$STUB_LOG"; }-if [ "$1" = "-m" ] && [ "$2" = "pip" ]; then log "python $*"; [ "$4" = "--upgrade" ] && exit "${STUB_PIP_UPGRADE_EXIT:-0}"; exit "${STUB_PIP_EXIT:-0}"; fiif [ -n "${STUB_REAL_PYTHON:-}" ]; then exec "$STUB_REAL_PYTHON" "$@"; ficase "$1:$2" in+ --version:) echo "Python ${STUB_VENV_PY:-3.12.10}" ;;+ -c:*version_info*) exit "${STUB_VENV_PY_OK:-0}" ;;"-c:import rdkit") exit "${STUB_RDKIT_EXIT:-0}" ;;"-c:import pandas") exit "${STUB_PANDAS_EXIT:-0}" ;;"-c:import rdkit; print(rdkit.__version__)") echo 2026.03.6 ;;@@ -46,30 +50,37 @@ case "$1:$2" inesac"""+# node: VERSION and whether it passes runtimes.sh's `node -e` version check are baked in per stub, so+# the machine's node and Harness's own can differ.NODE = r"""#!/bin/bashcase "$1" in- --version) echo v22.1.0 ;;+ --version) echo VERSION ;;+ -e) exit OLD ;;-p) case "$2" in *"dependencies['3dmol']"*|*"3dmol/package.json"*) echo 2.5.5 ;; *) exit 9 ;; esac ;;*) printf 'node %s cwd=%s port=%s workspace=%s\n' "$*" "$PWD" "$HARNESS_VIEWER_PORT" "$HARNESS_WORKSPACE" ;;esac"""-NPM = r"""#!/bin/bash-printf 'npm %s\n' "$*" >> "$STUB_LOG"-[ -n "${STUB_NPM_NO_BUNDLE:-}" ] || { mkdir -p node_modules/3dmol/build; : > node_modules/3dmol/build/3Dmol-min.js; }-"""+def node(version: str = "v22.1.0", new_enough: bool = True) -> str:+ return NODE.replace("VERSION", version).replace("OLD", "0" if new_enough else "1")-def system_python(ok: bool) -> str:- """A python3.x on PATH: its version probe passes or fails; `-m venv` lays out the stub venv."""- return f"""#!/bin/bash++# uv, as far as runtimes.sh uses it: `uv venv … DIR` lays out the stub venv, `uv pip install` answers+# STUB_PIP_EXIT.+UV = r"""#!/bin/bash+printf 'uv %s\n' "$*" >> "$STUB_LOG"case "$1" in- -c) exit {0 if ok else 1} ;;- --version) echo "Python 3.12.10" ;;- -m) printf '%s\\n' "${{0##*/}} $*" >> "$STUB_LOG"; mkdir -p "$3/bin"; ln -s "$STUB_VENV_PYTHON" "$3/bin/python" ;;+ venv) for last in "$@"; do :; done; mkdir -p "$last/bin"; ln -s "$STUB_VENV_PYTHON" "$last/bin/python" ;;+ pip) exit "${STUB_PIP_EXIT:-0}" ;;esac"""+NPM = r"""#!/bin/bash+printf 'npm %s\n' "$*" >> "$STUB_LOG"+[ -n "${STUB_NPM_NO_BUNDLE:-}" ] || { mkdir -p node_modules/3dmol/build; : > node_modules/3dmol/build/3Dmol-min.js; }+"""+class Sandbox:def __init__(self, test: unittest.TestCase) -> None:@@ -79,6 +90,7 @@ class Sandbox:self.root = self.dir / "rdkit"self.bin = self.dir / "bin"self.stubs = self.dir / "stubs"+ self.home = self.dir / "home"self.log = self.dir / "log"for folder in (self.root / "toolchain", self.bin, self.stubs):folder.mkdir(parents=True)@@ -86,11 +98,16 @@ class Sandbox:for tool in TOOLS:self.grant(tool)self.venv_python = self.write(self.stubs / "venv-python", VENV_PYTHON)+ self.machine("Darwin", "arm64")++ def machine(self, system: str, arch: str) -> None:+ """What `uname -s` and `uname -m` answer."""+ self.stub("uname", f'#!/bin/bash\ncase "$1" in -s) echo {system} ;; -m) echo {arch} ;; esac\n')@staticmethoddef write(path: Path, text: str) -> Path:# Never through a link: a granted tool or a linked package file is the real one, not the sandbox's.- assert not path.is_symlink(), f"{path} is a link; writing or chmod-ing it would change what it points at"+ path.unlink(missing_ok=True)path.parent.mkdir(parents=True, exist_ok=True)path.write_text(text)path.chmod(0o755)@@ -109,6 +126,14 @@ class Sandbox:def stub(self, name: str, text: str) -> None:self.write(self.bin / name, text)+ def harness_node(self, version: str = "v22.23.2", new_enough: bool = True, npm: bool = True) -> Path:+ """Harness's own Node, recorded in the sandbox HOME the way the CLI records it."""+ path = self.write(self.dir / "harness-node" / "bin" / "node", node(version, new_enough))+ if npm:+ self.write(path.parent / "npm", NPM)+ self.write(self.home / ".harness" / "runtime" / "current-node", f"{path}\n")+ return path+def venv(self) -> None:(self.root / ".venv" / "bin").mkdir(parents=True)(self.root / ".venv" / "bin" / "python").symlink_to(self.venv_python)@@ -118,9 +143,9 @@ class Sandbox:self.write(self.root / rel, "")def run(self, rel: str, cwd: Path | None = None, **env: str) -> subprocess.CompletedProcess:- clean = {k: v for k, v in os.environ.items() if not k.startswith(("HARNESS_", "RDKIT_", "PYTHON"))}+ clean = {k: v for k, v in os.environ.items() if not k.startswith(("HARNESS_", "RDKIT_", "PYTHON", "ADAPTER_", "UV_"))}return subprocess.run([str(self.root / rel)], cwd=cwd or self.dir, capture_output=True, text=True, timeout=120,- env={**clean, "PATH": str(self.bin), "STUB_LOG": str(self.log),+ env={**clean, "PATH": str(self.bin), "HOME": str(self.home), "STUB_LOG": str(self.log),"STUB_VENV_PYTHON": str(self.venv_python), **env})def logged(self) -> list[str]:@@ -132,30 +157,25 @@ def lines(done: subprocess.CompletedProcess) -> list[str]:class Setup(unittest.TestCase):- def sandbox(self, pythons: dict[str, bool] | None = None, node: bool = True, npm: bool = True) -> Sandbox:+ def sandbox(self, uv: bool = True, node_on_path: bool = True, npm: bool = True) -> Sandbox:box = Sandbox(self)- box.link("toolchain/setup.sh", "VERSIONS", "package.json")+ box.link("toolchain/setup.sh", "toolchain/runtimes.sh", "VERSIONS", "package.json")box.touch("pane/index.html", "pane/app.js")- for name, ok in (pythons if pythons is not None else {"python3.12": True}).items():- box.stub(name, system_python(ok))- if node:- box.stub("node", NODE)+ if uv:+ box.stub("uv", UV)+ if node_on_path:+ box.stub("node", node())if npm:box.stub("npm", NPM)return box- def test_a_python_between_3_10_and_3_13_is_required(self) -> None:- done = self.sandbox(pythons={}).run("toolchain/setup.sh")- self.assertEqual((done.returncode, lines(done)), (1, ["miss python 3.10–3.13 (brew install [email protected])"]))- done = self.sandbox(pythons={"python3.12": False, "python3.13": False}).run("toolchain/setup.sh")- self.assertEqual((done.returncode, lines(done)), (1, ["miss python 3.10–3.13 (brew install [email protected])"]))-def test_everything_installs_into_the_package_and_is_checked(self) -> None:- box = self.sandbox(pythons={"python3.12": False, "python3": True})+ box = self.sandbox()done = box.run("toolchain/setup.sh")self.assertEqual(done.returncode, 0, done.stderr)self.assertEqual(lines(done), [- "ok Python 3.12.10",+ " python 3.12 in .venv (uv downloads it when this machine has none)",+ "ok Python 3.12.10 in .venv",f" installing rdkit {VERSIONS['RDKIT']}","ok rdkit 2026.03.6 · numpy 2.5.3 · pandas 3.0.5"," chemistry check (build, conformers, depict, describe, series)",@@ -164,33 +184,76 @@ class Setup(unittest.TestCase):"ok 3dmol 2.5.5",])self.assertEqual(box.logged(), [- "python3 -m venv .venv",- "python -m pip install --quiet --upgrade pip",- f"python -m pip install --quiet rdkit=={VERSIONS['RDKIT']} numpy=={VERSIONS['NUMPY']} pandas=={VERSIONS['PANDAS']}",+ "uv venv --quiet --seed --python 3.12 --python-preference only-managed .venv",+ f"uv pip install --quiet --python .venv/bin/python rdkit=={VERSIONS['RDKIT']} numpy=={VERSIONS['NUMPY']} pandas=={VERSIONS['PANDAS']}",f"python - PYTHONPATH={box.root}/toolchain","npm ci --silent --no-audit --no-fund",])- def test_an_existing_venv_is_kept_and_a_failed_pip_upgrade_is_not_fatal(self) -> None:+ def test_an_existing_venv_on_3_12_or_later_is_kept(self) -> None:+ box = self.sandbox()+ box.venv()+ done = box.run("toolchain/setup.sh", STUB_VENV_PY="3.13.2")+ self.assertEqual(done.returncode, 0, done.stderr)+ self.assertEqual(lines(done)[0], "ok Python 3.13.2 in .venv")+ self.assertFalse(any(c.startswith("uv venv") for c in box.logged()))++ def test_a_venv_on_a_python_the_pins_do_not_support_is_replaced(self) -> None:box = self.sandbox()box.venv()- done = box.run("toolchain/setup.sh", STUB_PIP_UPGRADE_EXIT="1")+ done = box.run("toolchain/setup.sh", STUB_VENV_PY_OK="1")self.assertEqual(done.returncode, 0, done.stderr)- self.assertNotIn("python3.12 -m venv .venv", box.logged())+ self.assertIn("uv venv --quiet --seed --python 3.12 --python-preference only-managed .venv", box.logged())++ def test_no_uv_and_no_network_is_a_miss(self) -> None:+ box = self.sandbox(uv=False)+ box.stub("curl", "#!/bin/bash\nexit 6\n")+ done = box.run("toolchain/setup.sh")+ self.assertEqual(done.returncode, 1)+ self.assertEqual(lines(done)[-1], "miss could not download https://github.com/astral-sh/uv/releases/download/"+ "0.12.15/uv-aarch64-apple-darwin.tar.gz — check this machine's internet connection")+ self.assertFalse((box.root / ".venv").exists())++ def test_an_intel_mac_stops_before_downloading_anything(self) -> None:+ box = self.sandbox()+ box.machine("Darwin", "x86_64")+ done = box.run("toolchain/setup.sh")+ self.assertEqual((done.returncode, lines(done)), (1, [f"miss rdkit {VERSIONS['RDKIT']} has no Intel Mac build — this harness needs an Apple Silicon Mac, or Linux"]))+ self.assertEqual(box.logged(), [])++ def test_linux_on_either_architecture_installs(self) -> None:+ for arch in ("x86_64", "aarch64"):+ with self.subTest(arch=arch):+ box = self.sandbox()+ box.machine("Linux", arch)+ done = box.run("toolchain/setup.sh")+ self.assertEqual((done.returncode, lines(done)[-1]), (0, "ok 3dmol 2.5.5"), done.stderr)def test_a_failed_install_or_chemistry_check_stops_setup(self) -> None:done = self.sandbox().run("toolchain/setup.sh", STUB_PIP_EXIT="1")self.assertNotEqual(done.returncode, 0)- self.assertEqual(lines(done)[-1], f" installing rdkit {VERSIONS['RDKIT']}")+ self.assertEqual(lines(done)[-2:], [f" installing rdkit {VERSIONS['RDKIT']}",+ f"miss could not install rdkit=={VERSIONS['RDKIT']} numpy=={VERSIONS['NUMPY']} pandas=={VERSIONS['PANDAS']} into .venv"])done = self.sandbox().run("toolchain/setup.sh", STUB_CHEM_EXIT="1")self.assertNotEqual(done.returncode, 0)self.assertEqual(lines(done)[-1], " chemistry check (build, conformers, depict, describe, series)")+ def test_with_no_node_on_path_the_pane_is_built_with_harnesss_own(self) -> None:+ box = self.sandbox(node_on_path=False, npm=False)+ harness_node = box.harness_node()+ done = box.run("toolchain/setup.sh")+ self.assertEqual(done.returncode, 0, done.stderr)+ self.assertEqual(lines(done)[-2:], [" npm ci (3Dmol.js 2.5.5)", "ok 3dmol 2.5.5"])+ self.assertTrue((box.root / "node_modules/3dmol/build/3Dmol-min.js").is_file(), f"the npm beside {harness_node} ran")+def test_the_pane_needs_node_npm_the_bundle_and_its_files(self) -> None:- done = self.sandbox(node=False).run("toolchain/setup.sh")- self.assertEqual((done.returncode, lines(done)[-1]), (1, "miss node >= 18 on PATH (the pane)"))- done = self.sandbox(npm=False).run("toolchain/setup.sh")- self.assertEqual((done.returncode, lines(done)[-1]), (1, "miss npm on PATH (the pane)"))+ box = self.sandbox(node_on_path=False)+ done = box.run("toolchain/setup.sh")+ self.assertEqual((done.returncode, lines(done)[-1]),+ (1, f"miss node >= 18, and Harness's own Node is not in {box.home}/.harness/runtime — run `harness start` once to lay it down"))+ box = self.sandbox(npm=False)+ done = box.run("toolchain/setup.sh")+ self.assertEqual((done.returncode, lines(done)[-1]), (1, f"miss npm beside {box.bin}/node (the pane)"))done = self.sandbox().run("toolchain/setup.sh", STUB_NPM_NO_BUNDLE="1")self.assertEqual((done.returncode, lines(done)[-1]), (1, "miss the 3Dmol.js bundle after npm ci"))box = self.sandbox()@@ -208,11 +271,21 @@ class Setup(unittest.TestCase):class Doctor(unittest.TestCase):- def test_a_complete_install_is_ready(self) -> None:+ def sandbox(self) -> Sandbox:box = Sandbox(self)- box.link("toolchain/doctor.sh")+ box.link("toolchain/doctor.sh", "toolchain/runtimes.sh", "VERSIONS")+ return box++ def test_an_intel_mac_is_told_it_cannot_run_this_harness(self) -> None:+ box = self.sandbox()+ box.machine("Darwin", "x86_64")+ done = box.run("toolchain/doctor.sh")+ self.assertEqual((done.returncode, lines(done)), (1, [f"miss rdkit {VERSIONS['RDKIT']} has no Intel Mac build — this harness needs an Apple Silicon Mac, or Linux"]))++ def test_a_complete_install_is_ready(self) -> None:+ box = self.sandbox()box.venv()- box.stub("node", NODE)+ box.stub("node", node())box.touch("node_modules/3dmol/build/3Dmol-min.js", "pane/index.html", "pane/app.js")done = box.run("toolchain/doctor.sh")self.assertEqual((done.returncode, lines(done)), (0, [@@ -223,21 +296,32 @@ class Doctor(unittest.TestCase):"ok pane (3D, 2D, properties, conformers, series)",]))+ def test_harnesss_own_node_serves_when_this_machines_is_missing_or_too_old(self) -> None:+ for on_path in (False, True):+ with self.subTest(machine_node=on_path):+ box = self.sandbox()+ box.venv()+ if on_path:+ box.stub("node", node("v16.20.2", new_enough=False))+ box.harness_node()+ box.touch("node_modules/3dmol/build/3Dmol-min.js", "pane/index.html", "pane/app.js")+ done = box.run("toolchain/doctor.sh")+ self.assertEqual(done.returncode, 0, done.stdout)+ self.assertIn("ok node v22.23.2 (the pane's server)", lines(done))+def test_an_empty_install_says_what_is_missing(self) -> None:- box = Sandbox(self)- box.link("toolchain/doctor.sh")+ box = self.sandbox()done = box.run("toolchain/doctor.sh")self.assertEqual((done.returncode, lines(done)), (1, ["miss .venv with rdkit — run toolchain/setup.sh","warn pandas/numpy missing — tables and enumerations need them",- "miss node >= 18 on PATH — the pane cannot start",+ f"miss node >= 18, and Harness's own Node is not in {box.home}/.harness/runtime — run `harness start` once to lay it down","miss node_modules — run toolchain/setup.sh","miss pane/ — reinstall the package",]))def test_a_venv_without_rdkit_or_pandas(self) -> None:- box = Sandbox(self)- box.link("toolchain/doctor.sh")+ box = self.sandbox()box.venv()done = box.run("toolchain/doctor.sh", STUB_RDKIT_EXIT="1", STUB_PANDAS_EXIT="1")self.assertEqual(lines(done)[:2], ["miss .venv with rdkit — run toolchain/setup.sh",@@ -281,9 +365,13 @@ class InitWorkspace(unittest.TestCase):class Viewer(unittest.TestCase):- def test_it_needs_the_port_and_the_workspace(self) -> None:+ def sandbox(self) -> Sandbox:box = Sandbox(self)- box.link("viewer.sh")+ box.link("viewer.sh", "toolchain/runtimes.sh")+ return box++ def test_it_needs_the_port_and_the_workspace(self) -> None:+ box = self.sandbox()done = box.run("viewer.sh", HARNESS_WORKSPACE=str(box.dir))self.assertNotEqual(done.returncode, 0)self.assertIn("HARNESS_VIEWER_PORT", done.stderr)@@ -292,13 +380,26 @@ class Viewer(unittest.TestCase):self.assertIn("HARNESS_WORKSPACE", done.stderr)def test_it_runs_the_server_beside_it(self) -> None:- box = Sandbox(self)- box.link("viewer.sh")- box.stub("node", NODE)+ box = self.sandbox()+ box.stub("node", node())done = box.run("viewer.sh", HARNESS_VIEWER_PORT="4100", HARNESS_WORKSPACE=str(box.dir))self.assertEqual(done.returncode, 0, done.stderr)self.assertEqual(lines(done), [f"node {box.root}/viewer.mjs cwd={box.dir} port=4100 workspace={box.dir}"])+ def test_a_login_shell_with_no_node_runs_it_on_harnesss_own(self) -> None:+ box = self.sandbox()+ harness_node = box.harness_node()+ box.write(harness_node, node().replace("printf 'node ", "printf 'harness-node "))+ done = box.run("viewer.sh", HARNESS_VIEWER_PORT="4100", HARNESS_WORKSPACE=str(box.dir))+ self.assertEqual(done.returncode, 0, done.stderr)+ self.assertEqual(lines(done), [f"harness-node {box.root}/viewer.mjs cwd={box.dir} port=4100 workspace={box.dir}"])++ def test_no_node_at_all_is_a_miss_and_nothing_starts(self) -> None:+ box = self.sandbox()+ done = box.run("viewer.sh", HARNESS_VIEWER_PORT="4100", HARNESS_WORKSPACE=str(box.dir))+ self.assertEqual((done.returncode, lines(done)), (1, [+ f"miss node >= 18, and Harness's own Node is not in {box.home}/.harness/runtime — run `harness start` once to lay it down"]))+if __name__ == "__main__":unittest.main()diff --git a/store/agents/rdkit/viewer.sh b/store/agents/rdkit/viewer.shindex 9a40a19cc..089d829be 100755--- a/store/agents/rdkit/viewer.sh+++ b/store/agents/rdkit/viewer.sh@@ -1,5 +1,10 @@#!/usr/bin/env bash-# The pane. Harness runs this here with HARNESS_VIEWER_PORT and HARNESS_WORKSPACE.+# The pane. Harness runs this here with HARNESS_VIEWER_PORT and HARNESS_WORKSPACE, through a login+# shell whose PATH may have no node: this machine's Node when it is new enough, else Harness's own.set -euo pipefail: "${HARNESS_VIEWER_PORT:?}"; : "${HARNESS_WORKSPACE:?}"-exec node "$(cd "$(dirname "$0")" && pwd)/viewer.mjs"+DIR="$(cd "$(dirname "$0")" && pwd)"+# shellcheck source=toolchain/runtimes.sh+. "$DIR/toolchain/runtimes.sh"+harness_node 18 || exit 1+exec node "$DIR/viewer.mjs"diff --git a/store/agents/strudel/toolchain/runtimes.sh b/store/agents/strudel/toolchain/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/agents/strudel/toolchain/runtimes.sh+++ b/store/agents/strudel/toolchain/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/agents/text-to-cad/.gitignore b/store/agents/text-to-cad/.gitignoreindex af213c67d..bbd518f8d 100644--- a/store/agents/text-to-cad/.gitignore+++ b/store/agents/text-to-cad/.gitignore@@ -1,4 +1,5 @@# What setup writes into this package on a linked install — never source..venv/+.playwright/__pycache__/template/tmp/diff --git a/store/agents/text-to-cad/AGENTS.md b/store/agents/text-to-cad/AGENTS.mdindex a8ce2ed61..bf2d15f97 100644--- a/store/agents/text-to-cad/AGENTS.md+++ b/store/agents/text-to-cad/AGENTS.md@@ -24,7 +24,9 @@ browser; the `cad-viewer` skill's launch step is already done for you.```Without activating, `"$TEXT_TO_CAD_PYTHON" src/part.py` and `"$CADGEN" …` are the same tools.- Install nothing; `pip` is not yours here.+ Install nothing; `pip` is not yours here. Where a skill wants Node on `PATH` or `playwright install+ chromium`, that is done: `$CADGEN_NODE` is the Node cadgen's mesh exports and DXF snapshots run on,+ `$PLAYWRIGHT_BROWSERS_PATH` holds the snapshot browser — even when `node` itself is not on `PATH`.- **The verdict.** `.harness/verdict.json` is what the pane header shows. Write it after everybuild: `"$TEXT_TO_CAD_PYTHON" "$TEXT_TO_CAD_TOOLCHAIN/verdict.py"` judges the newest STEP(validity, solids, size) and names it as the artifact the pane draws. Never edit it by hand.diff --git a/store/agents/text-to-cad/README.md b/store/agents/text-to-cad/README.mdindex c6f8ac68f..d3b36ba95 100644--- a/store/agents/text-to-cad/README.md+++ b/store/agents/text-to-cad/README.md@@ -9,8 +9,10 @@ Viewer pane beside the terminal. Runs on Claude Code; the skills are upstream's,- `skills/` — text-to-cad's eleven skills at the release in `PROVENANCE.md`, verbatim.- `AGENTS.md` — what the agent is told: where the toolchain is, build early, verdict after each build.- `template/` — a fresh workspace in the skill's own project layout, with a starter part.-- `toolchain/` — `setup.sh` (one venv: the pinned `cadgen`, the skills' extras, a browser for- snapshots), `doctor.sh`, `init-workspace.sh`, and `verdict.py`, the pane header.+- `toolchain/` — `setup.sh` (one venv on Python 3.12, which uv brings when the machine has none: the+ pinned `cadgen`, the skills' extras; a headless Chromium for snapshots in `.playwright/`), `doctor.sh`,+ `init-workspace.sh`, `node.sh` (the Node cadgen's mesh exports run on — this machine's, else Harness's+ own; `CADGEN_NODE` names it), and `verdict.py`, the pane header.- The pane is [`autonomous/cad-viewer`](https://github.com/autonomous-ai/openharness/tree/main/store/viewers/cad-viewer),installed with this package.@@ -30,5 +32,5 @@ wrapper belong here, and a newer release is a `skills/` swap and a `CADGEN_VERSIharness dsh check . # conformanceharness dsh install "$PWD" --link # this checkout as the installed agentpython3 -m unittest toolchain/test_verdict.py # the verdict, without cadgen-python3 -m unittest toolchain/test_scripts.py # setup, doctor and init, with fake interpreters+python3 -m unittest toolchain/test_scripts.py # setup, doctor, node.sh and init, with fake interpreters```diff --git a/store/agents/text-to-cad/harness.json b/store/agents/text-to-cad/harness.jsonindex 12446cc7d..d14f6ba7d 100644--- a/store/agents/text-to-cad/harness.json+++ b/store/agents/text-to-cad/harness.json@@ -20,7 +20,9 @@"CADGEN": "${dsh}/.venv/bin/cadgen","TEXT_TO_CAD_VENV": "${dsh}/.venv","TEXT_TO_CAD_PYTHON": "${dsh}/.venv/bin/python",- "TEXT_TO_CAD_TOOLCHAIN": "${dsh}/toolchain"+ "TEXT_TO_CAD_TOOLCHAIN": "${dsh}/toolchain",+ "CADGEN_NODE": "${dsh}/toolchain/node.sh",+ "PLAYWRIGHT_BROWSERS_PATH": "${dsh}/.playwright"}},"toolchain": {diff --git a/store/agents/text-to-cad/toolchain/doctor.sh b/store/agents/text-to-cad/toolchain/doctor.shindex 103e950fa..cfcfe6c4a 100755--- a/store/agents/text-to-cad/toolchain/doctor.sh+++ b/store/agents/text-to-cad/toolchain/doctor.sh@@ -6,6 +6,9 @@ bad=0if [ -x .venv/bin/cadgen ]; then echo "ok cadgen $(cat CADGEN_VERSION)"; else echo "miss .venv/bin/cadgen — run toolchain/setup.sh"; bad=1; fiif .venv/bin/cadgen doctor skills/cad >/dev/null 2>&1; then echo "ok cadgen matches the skills' pin"; else echo "miss cadgen does not match skills/cad/requirements.txt"; bad=1; fiif .venv/bin/python -c 'import build123d' >/dev/null 2>&1; then echo "ok build123d + OpenCascade"; else echo "miss build123d in the venv"; bad=1; fi+if node_version="$(toolchain/node.sh --version 2>&1)"; then echo "ok node $node_version (STL, 3MF and GLB exports)"; else echo "$node_version"; bad=1; fiif .venv/bin/python -c 'import trimesh, scipy, rtree, networkx, lxml' >/dev/null 2>&1; then echo "ok dfam-check extras"; else echo "warn dfam-check extras missing (trimesh, scipy, rtree, networkx, lxml)"; fi-if .venv/bin/python -c 'from playwright.sync_api import sync_playwright' >/dev/null 2>&1; then echo "ok playwright for snapshots"; else echo "warn playwright missing; snapshots will not render"; fi+if ! .venv/bin/python -c 'from playwright.sync_api import sync_playwright' >/dev/null 2>&1; then echo "warn playwright missing; snapshots will not render"+elif ! compgen -G '.playwright/chromium*' >/dev/null; then echo "warn chromium for snapshots missing; snapshots will not render until toolchain/setup.sh runs again"+else echo "ok playwright + chromium for snapshots"; fiexit $baddiff --git a/store/agents/text-to-cad/toolchain/init-workspace.sh b/store/agents/text-to-cad/toolchain/init-workspace.shindex 294425673..882ca19d8 100755--- a/store/agents/text-to-cad/toolchain/init-workspace.sh+++ b/store/agents/text-to-cad/toolchain/init-workspace.sh@@ -3,6 +3,9 @@# starter model so the pane has a part to show before the first prompt, and seeds the verdict.set -euo pipefail: "${HARNESS_DSH_DIR:?HARNESS_DSH_DIR is required}"+# The build below starts cadgen's warm daemon, and the agent's builds for the next hour run inside it,+# in this environment rather than theirs: give it the Node and the browser harness.json gives the agent.+export CADGEN_NODE="$HARNESS_DSH_DIR/toolchain/node.sh" PLAYWRIGHT_BROWSERS_PATH="$HARNESS_DSH_DIR/.playwright"mkdir -p .harness STEP tmp"$HARNESS_DSH_DIR/.venv/bin/python" src/part.py >/dev/null 2>&1 || true"$HARNESS_DSH_DIR/.venv/bin/python" "$HARNESS_DSH_DIR/toolchain/verdict.py" >/dev/null 2>&1 || truediff --git a/store/agents/text-to-cad/toolchain/node.sh b/store/agents/text-to-cad/toolchain/node.shnew file mode 100755index 000000000..ac5412efe--- /dev/null+++ b/store/agents/text-to-cad/toolchain/node.sh@@ -0,0 +1,9 @@+#!/usr/bin/env bash+# The node cadgen runs its STL/3MF/GLB exporter and DXF snapshots under: harness.json points CADGEN_NODE+# here, because the agent's shell may have no node on PATH at all. This machine's Node 20+, else the+# Node Harness itself runs on. A miss goes to stderr, which cadgen puts in its error.+DIR="$(cd "$(dirname "$0")" && pwd)"+# shellcheck source=runtimes.sh+. "$DIR/runtimes.sh"+harness_node 20 >&2 || exit 1+exec node "$@"diff --git a/store/agents/text-to-cad/toolchain/runtimes.sh b/store/agents/text-to-cad/toolchain/runtimes.shnew file mode 100644index 000000000..51fefe3f9--- /dev/null+++ b/store/agents/text-to-cad/toolchain/runtimes.sh@@ -0,0 +1,190 @@+# shellcheck shell=bash+# runtimes.sh — the interpreters a store package runs on, found on this machine or fetched, never+# asked of the person who pressed Get.+#+# Sourced (not run) by a package's setup, doctor and viewer scripts. A new Mac has Apple's Python 3.9,+# no Homebrew and, for most people, no Node on PATH; a package that answers "brew install [email protected]"+# has failed its install. So:+#+# harness_node 18 node >= 18 on PATH, with npm: the machine's own, else the Node Harness+# itself runs on (~/.harness/runtime/current-node, laid down with the CLI)+# harness_uv uv on PATH: the machine's own, else a pinned, checksummed release+# fetched into ~/.harness/runtime+# harness_venv DIR 3.12 [MIN [BELOW]]+# DIR is a venv on CPython 3.12, which uv downloads when the machine+# has none. A venv already there on a Python in [MIN, BELOW) is kept.+# harness_pip DIR PKG… install into that venv, through uv+# harness_micromamba micromamba, pinned and checksummed, for native libraries PyPI has+# no wheel for (pycairo on macOS)+# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages+#+# Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).+#+# ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package+# carries an identical copy (a package installs alone, so it cannot reach this one);+# `node store/tools/sync-runtimes.mjs` rewrites them and the CLI's store spec fails when one drifts.++HARNESS_RUNTIME="${ADAPTER_RUNTIME_DIR:-${HOME:-}/.harness/runtime}"+# The Pythons uv downloads live with Harness's other runtimes, not in uv's own ~/.local/share/uv:+# a package's venv points at its interpreter, and `uv python uninstall` there must not break it.+UV_PYTHON_INSTALL_DIR="${UV_PYTHON_INSTALL_DIR:-$HARNESS_RUNTIME/python}"+export UV_PYTHON_INSTALL_DIR+HARNESS_UV_VERSION=0.12.15+HARNESS_MICROMAMBA_VERSION=2.9.0-0++_harness_platform() {+ case "$(uname -s)-$(uname -m)" in+ Darwin-arm64) echo darwin-arm64 ;;+ Darwin-x86_64) echo darwin-x64 ;;+ Linux-x86_64) echo linux-x64 ;;+ Linux-aarch64 | Linux-arm64) echo linux-arm64 ;;+ *) return 1 ;;+ esac+}++_harness_sha256() {+ if command -v shasum >/dev/null 2>&1; then shasum -a 256 "$1" | cut -d' ' -f1+ else sha256sum "$1" | cut -d' ' -f1; fi+}++# _harness_fetch URL DEST SHA256 — DEST exists only if what arrived matches the pinned checksum.+_harness_fetch() {+ local part="$2.part.$$"+ if ! curl -fsSL --retry 3 --connect-timeout 20 --max-time 900 -o "$part" "$1"; then+ rm -f "$part"; echo "miss could not download $1 — check this machine's internet connection"; return 1+ fi+ if [ "$(_harness_sha256 "$part")" != "$3" ]; then+ rm -f "$part"; echo "miss $1 did not match its pinned checksum; nothing was installed"; return 1+ fi+ mv -f "$part" "$2"+}++_harness_node_at_least() {+ command -v node >/dev/null 2>&1 || return 1+ node -e '+ const [a, b = 0] = process.argv[1].split(".").map(Number)+ const [x, y] = process.versions.node.split(".").map(Number)+ process.exit(x > a || (x === a && y >= b) ? 0 : 1)+ ' "$1" >/dev/null 2>&1+}++harness_node() {+ local min="${1:-18}" recorded saved="$PATH" own=0+ _harness_node_at_least "$min" && own=1+ # A node without npm beside it (a distro's nodejs package) cannot run a setup's `npm ci`.+ if [ "$own" = 1 ] && command -v npm >/dev/null 2>&1; then return 0; fi+ recorded="$(cat "$HARNESS_RUNTIME/current-node" 2>/dev/null || true)"+ if [ -n "$recorded" ] && [ -x "${recorded%/*}/node" ]; then+ PATH="${recorded%/*}:$PATH"; export PATH; hash -r 2>/dev/null || true+ _harness_node_at_least "$min" && return 0+ PATH="$saved"; export PATH; hash -r 2>/dev/null || true+ [ "$own" = 1 ] && return 0+ echo "miss node >= $min — this machine's newest is $("${recorded%/*}/node" -v), Harness's own; update Harness"+ return 1+ fi+ [ "$own" = 1 ] && return 0+ echo "miss node >= $min, and Harness's own Node is not in $HARNESS_RUNTIME — run \`harness start\` once to lay it down"+ return 1+}++harness_uv() {+ local dir asset sum tmp+ command -v uv >/dev/null 2>&1 && return 0+ for dir in "${HOME:-}/.local/bin" "${HOME:-}/.cargo/bin"; do+ [ -n "${HOME:-}" ] || break+ if [ -x "$dir/uv" ]; then PATH="$dir:$PATH"; export PATH; return 0; fi+ done+ dir="$HARNESS_RUNTIME/uv-$HARNESS_UV_VERSION"+ if [ ! -x "$dir/uv" ]; then+ case "$(_harness_platform)" in+ darwin-arm64) asset=uv-aarch64-apple-darwin sum=dc304b9ed1b24174572290fba60ac3f6fe63c73a671f0439e62a91375841964d ;;+ darwin-x64) asset=uv-x86_64-apple-darwin sum=e9ca61775532368fe518ab03e7a354c7ecab8ccb3c7d941c775fcc4a362b801b ;;+ linux-x64) asset=uv-x86_64-unknown-linux-gnu sum=f97935763c04be3e692460a7aaeaaab8fc3b78fcf8b389da820b38ae7423a638 ;;+ linux-arm64) asset=uv-aarch64-unknown-linux-gnu sum=0e9a3499b0587d449c9ff684c0160da607826e4af1cee220bc87f378702d3e08 ;;+ *) echo "miss uv — there is no uv release for $(uname -s) $(uname -m); install it from https://docs.astral.sh/uv/"; return 1 ;;+ esac+ echo " fetching uv $HARNESS_UV_VERSION into $HARNESS_RUNTIME (it brings Python and the packages)"+ mkdir -p "$HARNESS_RUNTIME" || { echo "miss cannot write $HARNESS_RUNTIME"; return 1; }+ tmp="$(mktemp -d "$HARNESS_RUNTIME/.uv.XXXXXX")" || { echo "miss cannot write $HARNESS_RUNTIME"; return 1; }+ if ! _harness_fetch "https://github.com/astral-sh/uv/releases/download/$HARNESS_UV_VERSION/$asset.tar.gz" "$tmp/uv.tar.gz" "$sum"; then+ rm -rf "$tmp"; return 1+ fi+ tar -xzf "$tmp/uv.tar.gz" -C "$tmp" && chmod +x "$tmp/$asset/uv" "$tmp/$asset/uvx" \+ || { rm -rf "$tmp"; echo "miss the uv archive would not unpack"; return 1; }+ # Two installs at once both get here; whichever renames first wins and the other's copy goes.+ # (mv onto a directory that exists would nest the copy inside it, hence the test.)+ [ -e "$dir" ] || mv "$tmp/$asset" "$dir" 2>/dev/null || true+ rm -rf "$tmp"+ [ -x "$dir/uv" ] || { echo "miss uv did not land in $dir"; return 1; }+ fi+ PATH="$dir:$PATH"; export PATH+}++# harness_venv DIR VERSION [MIN [BELOW]] — MIN defaults to VERSION; BELOW is exclusive and optional.+harness_venv() {+ local dir="${1:?harness_venv needs a directory}" want="${2:?harness_venv needs a Python version}"+ local min="${3:-$2}" below="${4:-}"+ if [ -x "$dir/bin/python" ] && "$dir/bin/python" -c '+import sys+at = lambda s: tuple(int(p) for p in s.split("."))+v = sys.version_info[:2]+sys.exit(0 if v >= at(sys.argv[1]) and (not sys.argv[2] or v < at(sys.argv[2])) else 1)+' "$min" "$below" 2>/dev/null; then+ echo "ok $("$dir/bin/python" --version) in $dir"+ return 0+ fi+ harness_uv || return 1+ echo " python $want in $dir (uv downloads it when this machine has none)"+ rm -rf "$dir"+ # only-managed: the same python-build-standalone interpreter on every machine, so a package tested+ # once is tested everywhere — not whichever Homebrew or pyenv Python happened to be first on PATH.+ uv venv --quiet --seed --python "$want" --python-preference only-managed "$dir" \+ || { echo "miss could not make a Python $want environment in $dir"; return 1; }+ echo "ok $("$dir/bin/python" --version) in $dir"+}++harness_pip() {+ local dir="${1:?harness_pip needs a venv}"+ shift+ harness_uv || return 1+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }+}++harness_micromamba() {+ local dir asset sum+ dir="$HARNESS_RUNTIME/micromamba-$HARNESS_MICROMAMBA_VERSION"+ if [ ! -x "$dir/micromamba" ]; then+ case "$(_harness_platform)" in+ darwin-arm64) asset=micromamba-osx-arm64 sum=ec2a072f028e1a7cf20f3e2e74d5a8127cf5a5f27636375b5359811565f4e5be ;;+ darwin-x64) asset=micromamba-osx-64 sum=1e71054bb3ac9a076e21f7ec48acfef536f9b3f1408f371a942784bf5ef83d8a ;;+ linux-x64) asset=micromamba-linux-64 sum=366cd9cd8be14df1ab8ed50352a82111082a36686b2d389fdb79a92c3fafb3e3 ;;+ linux-arm64) asset=micromamba-linux-aarch64 sum=9f93b974adcb4d166996af969b6cd371287d1a3e52733704727884d9b74cb7a7 ;;+ *) echo "miss micromamba — there is no release for $(uname -s) $(uname -m)"; return 1 ;;+ esac+ echo " fetching micromamba $HARNESS_MICROMAMBA_VERSION into $HARNESS_RUNTIME (native libraries PyPI has no wheel for)"+ mkdir -p "$dir" || { echo "miss cannot write $dir"; return 1; }+ _harness_fetch "https://github.com/mamba-org/micromamba-releases/releases/download/$HARNESS_MICROMAMBA_VERSION/$asset" "$dir/micromamba.$$" "$sum" || return 1+ chmod +x "$dir/micromamba.$$" && mv -f "$dir/micromamba.$$" "$dir/micromamba" \+ || { rm -f "$dir/micromamba.$$"; echo "miss micromamba would not install into $dir"; return 1; }+ fi+ HARNESS_MICROMAMBA="$dir/micromamba"+ export HARNESS_MICROMAMBA+}++# harness_conda_env DIR SPEC… — conda-forge only, packages cached under ~/.harness/runtime/mamba.+harness_conda_env() {+ local dir="${1:?harness_conda_env needs a directory}"+ shift+ # micromamba takes a relative --prefix as a name under its root prefix and "succeeds" there.+ case "$dir" in /*) ;; *) dir="$PWD/$dir" ;; esac+ harness_micromamba || return 1+ MAMBA_ROOT_PREFIX="$HARNESS_RUNTIME/mamba" "$HARNESS_MICROMAMBA" create --yes --quiet \+ --prefix "$dir" --override-channels --channel conda-forge "$@" >/dev/null \+ && [ -d "$dir/conda-meta" ] \+ || { echo "miss could not make the conda-forge environment in $dir ($*)"; return 1; }+}diff --git a/store/agents/text-to-cad/toolchain/setup.sh b/store/agents/text-to-cad/toolchain/setup.shindex 2792b8966..bd95504f5 100755--- a/store/agents/text-to-cad/toolchain/setup.sh+++ b/store/agents/text-to-cad/toolchain/setup.sh@@ -1,22 +1,22 @@#!/usr/bin/env bash# Runs once at install, cwd = the install dir. One venv with the cadgen release every skill in-# skills/ pins (their requirements.txt), plus the extras dfam-check needs and the browser-# snapshots render with. Nothing is installed outside this directory.+# skills/ pins (their requirements.txt), plus the extras dfam-check needs and the browser snapshots+# render with (in .playwright, which harness.json hands the agent as PLAYWRIGHT_BROWSERS_PATH). Nothing+# is installed outside this directory and ~/.harness/runtime. cadgen wants Python 3.11+ and+# cadquery-ocp has wheels for 3.11–3.14, so the venv is on 3.12 whatever this machine has (uv downloads+# it when it is not here); a venv already on 3.11–3.14 is kept. cadgen's mesh exports run in Node:+# toolchain/node.sh finds one.set -euo pipefailcd "$(dirname "$0")/.."+# shellcheck source=runtimes.sh+. toolchain/runtimes.shCADGEN_VERSION="$(cat CADGEN_VERSION)"-PY=""-for candidate in python3.13 python3.12 python3.11 python3; do- if command -v "$candidate" >/dev/null 2>&1 && "$candidate" -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 11) else 1)' 2>/dev/null; then- PY="$candidate"; break- fi-done-[ -n "$PY" ] || { echo "miss python 3.11+ (brew install [email protected])"; exit 1; }-echo "ok $($PY --version)"-[ -x .venv/bin/python ] || "$PY" -m venv .venv-.venv/bin/python -m pip install --quiet --upgrade pip >/dev/null 2>&1 || true+harness_venv .venv 3.12 3.11 3.15 || exit 1echo " installing cadgen $CADGEN_VERSION and the skills' extras (OpenCascade comes with it; minutes the first time)"-.venv/bin/python -m pip install --quiet "cadgen[snapshot]==${CADGEN_VERSION}" trimesh numpy scipy rtree networkx lxml+harness_pip .venv "cadgen[snapshot]==${CADGEN_VERSION}" trimesh numpy scipy rtree networkx lxmlecho "ok cadgen $CADGEN_VERSION"+node_version="$(toolchain/node.sh --version 2>&1)" || { echo "$node_version"; exit 1; }+echo "ok node $node_version (STL, 3MF and GLB exports)"echo " installing the browser snapshots render with"-if .venv/bin/python -m playwright install chromium >/dev/null 2>&1; then echo "ok chromium for snapshots"; else echo "warn chromium for snapshots did not install; \`cadgen … snapshot\` will not render until \`.venv/bin/python -m playwright install chromium\` succeeds"; fi+# Headless shell only: cadgen launches Chromium headless, and the full browser is another 360 MB.+if PLAYWRIGHT_BROWSERS_PATH="$PWD/.playwright" .venv/bin/python -m playwright install --only-shell chromium >/dev/null 2>&1; then echo "ok chromium for snapshots"; else echo "warn chromium for snapshots did not install; \`cadgen … snapshot\` will not render until toolchain/setup.sh runs again"; fidiff --git a/store/agents/text-to-cad/toolchain/test_scripts.py b/store/agents/text-to-cad/toolchain/test_scripts.pyindex c200e470b..f1a3f1e0e 100644--- a/store/agents/text-to-cad/toolchain/test_scripts.py+++ b/store/agents/text-to-cad/toolchain/test_scripts.py@@ -1,8 +1,10 @@-"""python3 -m unittest toolchain/test_scripts.py — setup.sh, doctor.sh and init-workspace.sh, without cadgen.+"""python3 -m unittest toolchain/test_scripts.py — setup.sh, doctor.sh, node.sh and init-workspace.sh, without cadgen.-Each test lays out a throwaway install dir with the real scripts linked in and fake interpreters on a-PATH that holds nothing else, runs a script, and checks the lines Harness would show and the exit code.-Nothing is installed and nothing touches the network.+Each test lays out a throwaway install dir with the real scripts linked in and fake uv, node and venv+interpreters on a PATH that holds nothing else, with a HOME of its own (so Harness's own Node is only+there when a test records one), runs a script, and checks the lines Harness would show and the exit+code. Nothing is installed and nothing touches the network. What runtimes.sh does when uv is not on PATH+at all is store/tools/test_runtimes.py's business."""import jsonimport os@@ -16,29 +18,29 @@ from pathlib import PathTOOLCHAIN = Path(__file__).resolve().parentPACKAGE = TOOLCHAIN.parentCADGEN_VERSION = (PACKAGE / "CADGEN_VERSION").read_text().strip()-SYSTEM_TOOLS = ("bash", "dirname", "basename", "cat", "mkdir", "cp")+SYSTEM_TOOLS = ("bash", "dirname", "basename", "cat", "mkdir", "cp", "rm", "mktemp", "cut", "shasum")-# A python that answers the version probe with $OK, prints a version, and makes a venv holding the-# fake venv python below.-CANDIDATE = """#!/bin/sh-echo "$(basename "$0") $*" >> "$LOG"+# uv, as far as runtimes.sh uses it: `uv venv … DIR` makes a venv holding the fake venv python below;+# `uv pip install` answers PIP_EXIT.+UV = """#!/bin/sh+echo "uv $*" >> "$LOG"case "$1" in- -c) exit {status} ;;- --version) echo "Python {version}" ;;- -m) mkdir -p "$3/bin" && cp "$FAKE_VENV_PYTHON" "$3/bin/python" ;;+ venv) for last in "$@"; do :; done; mkdir -p "$last/bin" && cp "$FAKE_VENV_PYTHON" "$last/bin/python" ;;+ pip) exit "${PIP_EXIT:-0}" ;;esac"""-# The venv's python: every answer is an exit code the test sets in the environment.+# The venv's python: every answer is an exit code the test sets in the environment; its version is+# VENV_PY, and runtimes.sh's keep-or-replace probe answers VENV_PY_OK.VENV_PYTHON = """#!/bin/sh+case "$1" in --version) echo "Python ${VENV_PY:-3.12.9}"; exit 0 ;; esac+case "$*" in "-c "*version_info*) exit "${VENV_PY_OK:-0}" ;; esacecho "venv-python $*" >> "$LOG"case "$*" in- "-m pip install --quiet --upgrade pip") exit "${PIP_UPGRADE_EXIT:-0}" ;;- "-m pip install --quiet "*) exit "${PIP_EXIT:-0}" ;;- "-m playwright install chromium") exit "${PLAYWRIGHT_INSTALL_EXIT:-0}" ;;+ "-m playwright install --only-shell chromium") echo "PLAYWRIGHT_BROWSERS_PATH=$PLAYWRIGHT_BROWSERS_PATH" >> "$LOG"; exit "${PLAYWRIGHT_INSTALL_EXIT:-0}" ;;"-c import build123d") exit "${BUILD123D_EXIT:-0}" ;;"-c import trimesh, scipy, rtree, networkx, lxml") exit "${EXTRAS_EXIT:-0}" ;;"-c from playwright.sync_api import sync_playwright") exit "${PLAYWRIGHT_EXIT:-0}" ;;- *src/part.py) echo "cwd=$PWD" >> "$LOG"; exit "${PART_EXIT:-0}" ;;+ *src/part.py) echo "cwd=$PWD CADGEN_NODE=$CADGEN_NODE PLAYWRIGHT_BROWSERS_PATH=$PLAYWRIGHT_BROWSERS_PATH" >> "$LOG"; exit "${PART_EXIT:-0}" ;;*toolchain/verdict.py) echo "cwd=$PWD" >> "$LOG"; exit 1 ;;esacexit 99@@ -47,10 +49,20 @@ CADGEN = """#!/bin/shecho "cadgen $*" >> "$LOG"exit "${CADGEN_DOCTOR_EXIT:-0}""""+# node: its version, whether runtimes.sh's `node -e` version check passes, and what a run prints.+NODE = """#!/bin/sh+case "$1" in+ -e) exit {old} ;;+ --version) echo {version} ;;+ *) echo "{name} $*" ;;+esac+"""+HARNESS_NODE = "v22.23.2"def write_exe(path: Path, text: str) -> Path:path.parent.mkdir(parents=True, exist_ok=True)+ path.unlink(missing_ok=True) # never write through a link to a real commandpath.write_text(text)path.chmod(0o755)return path@@ -62,7 +74,7 @@ class Scripts(unittest.TestCase):self.addCleanup(shutil.rmtree, self.tmp)self.root = self.tmp / "text-to-cad"(self.root / "toolchain").mkdir(parents=True)- for name in ("setup.sh", "doctor.sh", "init-workspace.sh", "verdict.py"):+ for name in ("setup.sh", "doctor.sh", "node.sh", "runtimes.sh", "init-workspace.sh", "verdict.py"):(self.root / "toolchain" / name).symlink_to(TOOLCHAIN / name)shutil.copy(PACKAGE / "CADGEN_VERSION", self.root / "CADGEN_VERSION")self.bin = self.tmp / "bin"@@ -72,20 +84,31 @@ class Scripts(unittest.TestCase):self.assertIsNotNone(found, tool)(self.bin / tool).symlink_to(found)self.log = self.tmp / "log"+ self.home = self.tmp / "home"self.fake_venv_python = write_exe(self.tmp / "fake-venv-python", VENV_PYTHON)- def candidate(self, name, ok=True, version="3.12.9"):- write_exe(self.bin / name, CANDIDATE.format(status=0 if ok else 1, version=version))+ def uv(self):+ write_exe(self.bin / "uv", UV)++ def node(self, version="v22.1.0", new_enough=True):+ """node on PATH."""+ write_exe(self.bin / "node", NODE.format(old=0 if new_enough else 1, version=version, name="node"))++ def harness_node(self):+ """Harness's own Node, recorded in HOME the way the CLI records it."""+ node = write_exe(self.tmp / "harness-node" / "bin" / "node", NODE.format(old=0, version=HARNESS_NODE, name="harness-node"))+ write_exe(self.home / ".harness" / "runtime" / "current-node", f"{node}\n")def venv(self, cadgen=True):write_exe(self.root / ".venv" / "bin" / "python", VENV_PYTHON)if cadgen:write_exe(self.root / ".venv" / "bin" / "cadgen", CADGEN)- def run_script(self, name, cwd=None, **env):- clean = {k: v for k, v in os.environ.items() if not k.startswith(("HARNESS_", "CADGEN", "TEXT_TO_CAD_"))}- clean.update(PATH=str(self.bin), LOG=str(self.log), FAKE_VENV_PYTHON=str(self.fake_venv_python), **env)- return subprocess.run([str(self.root / "toolchain" / name)], cwd=cwd or self.tmp, env=clean,+ def run_script(self, name, *args, cwd=None, **env):+ clean = {k: v for k, v in os.environ.items()+ if not k.startswith(("HARNESS_", "CADGEN", "TEXT_TO_CAD_", "ADAPTER_", "UV_", "PLAYWRIGHT_"))}+ clean.update(PATH=str(self.bin), HOME=str(self.home), LOG=str(self.log), FAKE_VENV_PYTHON=str(self.fake_venv_python), **env)+ return subprocess.run([str(self.root / "toolchain" / name), *args], cwd=cwd or self.tmp, env=clean,capture_output=True, text=True, timeout=60)def calls(self):@@ -93,67 +116,102 @@ class Scripts(unittest.TestCase):# setup.sh- def test_setup_takes_the_first_python_that_is_3_11_or_newer_and_installs_the_pinned_cadgen(self):- self.candidate("python3.13", ok=False)- self.candidate("python3.12")- self.candidate("python3")+ def test_setup_makes_a_3_12_venv_and_installs_the_pinned_cadgen_and_the_snapshot_browser_into_the_package(self):+ self.uv()+ self.node()run = self.run_script("setup.sh")self.assertEqual(run.returncode, 0, run.stdout + run.stderr)self.assertEqual(run.stdout.splitlines(), [- "ok Python 3.12.9",+ " python 3.12 in .venv (uv downloads it when this machine has none)",+ "ok Python 3.12.9 in .venv",f" installing cadgen {CADGEN_VERSION} and the skills' extras (OpenCascade comes with it; minutes the first time)",f"ok cadgen {CADGEN_VERSION}",+ "ok node v22.1.0 (STL, 3MF and GLB exports)"," installing the browser snapshots render with","ok chromium for snapshots",])calls = self.calls()- self.assertIn("python3.12 -m venv .venv", calls)- self.assertFalse(any(c.startswith("python3 ") for c in calls), calls)- self.assertIn(f"venv-python -m pip install --quiet cadgen[snapshot]=={CADGEN_VERSION} trimesh numpy scipy rtree networkx lxml", calls)+ self.assertIn("uv venv --quiet --seed --python 3.12 --python-preference only-managed .venv", calls)+ self.assertIn(f"uv pip install --quiet --python .venv/bin/python cadgen[snapshot]=={CADGEN_VERSION} trimesh numpy scipy rtree networkx lxml", calls)+ self.assertEqual(calls[-2:], ["venv-python -m playwright install --only-shell chromium", f"PLAYWRIGHT_BROWSERS_PATH={self.root}/.playwright"])self.assertTrue((self.root / ".venv" / "bin" / "python").exists())- def test_setup_without_a_new_enough_python_says_so(self):- self.candidate("python3", ok=False, version="3.9.6")+ def test_setup_with_no_node_on_path_uses_harnesss_own(self):+ self.uv()+ self.harness_node()+ run = self.run_script("setup.sh")+ self.assertEqual(run.returncode, 0, run.stdout + run.stderr)+ self.assertIn(f"ok node {HARNESS_NODE} (STL, 3MF and GLB exports)", run.stdout.splitlines())++ def test_setup_with_no_node_at_all_says_so_and_stops(self):+ self.uv()run = self.run_script("setup.sh")self.assertEqual(run.returncode, 1)- self.assertEqual(run.stdout, "miss python 3.11+ (brew install [email protected])\n")- self.assertFalse((self.root / ".venv").exists())+ self.assertEqual(run.stdout.splitlines()[-1],+ f"miss node >= 20, and Harness's own Node is not in {self.home}/.harness/runtime — run `harness start` once to lay it down")+ self.assertNotIn("chromium", run.stdout)- def test_setup_reuses_a_venv_and_survives_a_pip_self_upgrade_failure(self):- self.candidate("python3")+ def test_setup_reuses_a_venv_on_a_python_cadgen_supports(self):+ self.uv()+ self.node()self.venv(cadgen=False)- run = self.run_script("setup.sh", PIP_UPGRADE_EXIT="1")+ run = self.run_script("setup.sh", VENV_PY="3.13.5")self.assertEqual(run.returncode, 0, run.stdout + run.stderr)- self.assertNotIn("python3 -m venv .venv", self.calls())+ self.assertEqual(run.stdout.splitlines()[0], "ok Python 3.13.5 in .venv")+ self.assertFalse(any(c.startswith("uv venv") for c in self.calls()))self.assertIn(f"ok cadgen {CADGEN_VERSION}", run.stdout)+ def test_setup_replaces_a_venv_on_a_python_cadgen_does_not_support(self):+ self.uv()+ self.node()+ self.venv(cadgen=False)+ run = self.run_script("setup.sh", VENV_PY_OK="1")+ self.assertEqual(run.returncode, 0, run.stdout + run.stderr)+ self.assertIn("uv venv --quiet --seed --python 3.12 --python-preference only-managed .venv", self.calls())++ def test_setup_without_uv_or_a_network_says_so(self):+ write_exe(self.bin / "uname", '#!/bin/sh\ncase "$1" in -s) echo Darwin ;; -m) echo arm64 ;; esac\n')+ write_exe(self.bin / "curl", "#!/bin/sh\nexit 6\n")+ run = self.run_script("setup.sh")+ self.assertEqual(run.returncode, 1)+ self.assertEqual(run.stdout.splitlines()[-1], "miss could not download https://github.com/astral-sh/uv/releases/download/"+ "0.12.15/uv-aarch64-apple-darwin.tar.gz — check this machine's internet connection")+ self.assertFalse((self.root / ".venv").exists())+def test_setup_stops_when_cadgen_does_not_install(self):- self.candidate("python3")+ self.uv()+ self.node()run = self.run_script("setup.sh", PIP_EXIT="1")self.assertNotEqual(run.returncode, 0)self.assertNotIn("ok cadgen", run.stdout)self.assertNotIn("chromium", run.stdout)def test_setup_warns_when_the_snapshot_browser_does_not_install(self):- self.candidate("python3")+ self.uv()+ self.node()run = self.run_script("setup.sh", PLAYWRIGHT_INSTALL_EXIT="1")self.assertEqual(run.returncode, 0)self.assertEqual(run.stdout.splitlines()[-1],- "warn chromium for snapshots did not install; `cadgen … snapshot` will not render until "- "`.venv/bin/python -m playwright install chromium` succeeds")+ "warn chromium for snapshots did not install; `cadgen … snapshot` will not render until toolchain/setup.sh runs again")# doctor.sh- def test_doctor_on_a_complete_install(self):+ def complete_install(self):self.venv()+ self.node()+ (self.root / ".playwright" / "chromium_headless_shell-1243").mkdir(parents=True)++ def test_doctor_on_a_complete_install(self):+ self.complete_install()run = self.run_script("doctor.sh")self.assertEqual(run.returncode, 0)self.assertEqual(run.stdout.splitlines(), [f"ok cadgen {CADGEN_VERSION}","ok cadgen matches the skills' pin","ok build123d + OpenCascade",+ "ok node v22.1.0 (STL, 3MF and GLB exports)","ok dfam-check extras",- "ok playwright for snapshots",+ "ok playwright + chromium for snapshots",])self.assertIn("cadgen doctor skills/cad", self.calls())@@ -164,24 +222,47 @@ class Scripts(unittest.TestCase):"miss .venv/bin/cadgen — run toolchain/setup.sh","miss cadgen does not match skills/cad/requirements.txt","miss build123d in the venv",+ f"miss node >= 20, and Harness's own Node is not in {self.home}/.harness/runtime — run `harness start` once to lay it down","warn dfam-check extras missing (trimesh, scipy, rtree, networkx, lxml)","warn playwright missing; snapshots will not render",])def test_doctor_fails_on_a_cadgen_that_does_not_match_the_pin(self):- self.venv()+ self.complete_install()run = self.run_script("doctor.sh", CADGEN_DOCTOR_EXIT="1")self.assertEqual(run.returncode, 1)self.assertIn("miss cadgen does not match skills/cad/requirements.txt", run.stdout.splitlines())def test_doctor_only_warns_for_the_extras_and_the_browser(self):- self.venv()+ self.complete_install()run = self.run_script("doctor.sh", EXTRAS_EXIT="1", PLAYWRIGHT_EXIT="1")self.assertEqual(run.returncode, 0)- self.assertEqual(run.stdout.splitlines()[3:], [+ self.assertEqual(run.stdout.splitlines()[4:], ["warn dfam-check extras missing (trimesh, scipy, rtree, networkx, lxml)","warn playwright missing; snapshots will not render",])+ shutil.rmtree(self.root / ".playwright")+ run = self.run_script("doctor.sh")+ self.assertEqual(run.returncode, 0)+ self.assertEqual(run.stdout.splitlines()[-1], "warn chromium for snapshots missing; snapshots will not render until toolchain/setup.sh runs again")++ # node.sh — what CADGEN_NODE names++ def test_node_is_this_machines_when_it_is_new_enough(self):+ self.node()+ run = self.run_script("node.sh", "builder.mjs", "--format", "stl")+ self.assertEqual((run.returncode, run.stdout, run.stderr), (0, "node builder.mjs --format stl\n", ""))++ def test_node_is_harnesss_own_when_this_machines_is_too_old(self):+ self.node("v18.20.0", new_enough=False)+ self.harness_node()+ run = self.run_script("node.sh", "builder.mjs")+ self.assertEqual((run.returncode, run.stdout, run.stderr), (0, "harness-node builder.mjs\n", ""))++ def test_no_node_at_all_is_a_miss_on_stderr(self):+ run = self.run_script("node.sh", "builder.mjs")+ self.assertEqual((run.returncode, run.stdout), (1, ""))+ self.assertEqual(run.stderr, f"miss node >= 20, and Harness's own Node is not in {self.home}/.harness/runtime — run `harness start` once to lay it down\n")# init-workspace.sh@@ -206,7 +287,8 @@ class Scripts(unittest.TestCase):for made in (".harness", "STEP", "tmp"):self.assertTrue((ws / made).is_dir(), made)self.assertEqual(self.calls(), [- "venv-python src/part.py", f"cwd={ws.resolve()}",+ # the daemon this build starts serves the agent's later builds: it needs the agent's Node and browser+ "venv-python src/part.py", f"cwd={ws.resolve()} CADGEN_NODE={self.root}/toolchain/node.sh PLAYWRIGHT_BROWSERS_PATH={self.root}/.playwright",f"venv-python {self.root}/toolchain/verdict.py", f"cwd={ws.resolve()}",])diff --git a/store/tools/runtimes.sh b/store/tools/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/tools/runtimes.sh+++ b/store/tools/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/tools/test_runtimes.py b/store/tools/test_runtimes.pyindex 89f578df1..52266cda6 100644--- a/store/tools/test_runtimes.py+++ b/store/tools/test_runtimes.py@@ -416,7 +416,8 @@ class Pip(unittest.TestCase):r = box.run('harness_pip .venv "rdkit==2025.3.1" numpy')self.assertEqual(r.returncode, 0, r.stderr)self.assertEqual(box.logged(), ["uv pip install --quiet --python .venv/bin/python rdkit==2025.3.1 numpy"])- self.assertEqual(box.run('harness_pip .venv x || echo "rc=$?"', PIP_EXIT="4").stdout.strip(), "rc=4")+ self.assertEqual(lines(box.run('harness_pip .venv x y || echo "rc=$?"', PIP_EXIT="4")),+ ["miss could not install x y into .venv", "rc=1"])def test_no_uv_to_be_had(self):box = Box(self)diff --git a/store/viewers/cad-viewer/runtimes.sh b/store/viewers/cad-viewer/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/viewers/cad-viewer/runtimes.sh+++ b/store/viewers/cad-viewer/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/viewers/doc-viewer/runtimes.sh b/store/viewers/doc-viewer/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/viewers/doc-viewer/runtimes.sh+++ b/store/viewers/doc-viewer/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/viewers/model-viewer/runtimes.sh b/store/viewers/model-viewer/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/viewers/model-viewer/runtimes.sh+++ b/store/viewers/model-viewer/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/viewers/mujoco-viewer/runtimes.sh b/store/viewers/mujoco-viewer/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/viewers/mujoco-viewer/runtimes.sh+++ b/store/viewers/mujoco-viewer/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/viewers/video-viewer/runtimes.sh b/store/viewers/video-viewer/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/viewers/video-viewer/runtimes.sh+++ b/store/viewers/video-viewer/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {diff --git a/store/viewers/web-viewer/runtimes.sh b/store/viewers/web-viewer/runtimes.shindex 4e21942d0..51fefe3f9 100644--- a/store/viewers/web-viewer/runtimes.sh+++ b/store/viewers/web-viewer/runtimes.sh@@ -19,8 +19,9 @@# harness_conda_env DIR SPEC… DIR is a conda-forge environment with those packages## Every function prints `miss …` and returns 1 when it cannot deliver, so `harness_node 18 || exit 1`-# reads like the rest of a setup script. Nothing here touches the user's shell profile or anything-# outside ~/.harness/runtime and the package's own directory.+# reads like the rest of a setup script. Nothing here touches the user's shell profile; what it+# installs lands in ~/.harness/runtime or the package's own directory (uv keeps its download cache+# where it always does, which a venv does not depend on).## ONE copy is written by hand: store/tools/runtimes.sh in the OpenHarness repository. Each package# carries an identical copy (a package installs alone, so it cannot reach this one);@@ -149,7 +150,9 @@ harness_pip() {local dir="${1:?harness_pip needs a venv}"shiftharness_uv || return 1- uv pip install --quiet --python "$dir/bin/python" "$@"+ # uv's own error comes first; the miss line is last, so it is the line the store shows.+ uv pip install --quiet --python "$dir/bin/python" "$@" \+ || { echo "miss could not install $* into $dir"; return 1; }}harness_micromamba() {