#!/bin/bash set -euo pipefail cd -- "$(dirname -- "$0")" source scripts/common.sh if [[ "$(uname -s)" != Darwin || "$(uname -m)" != arm64 ]]; then printf '%s\n' 'This installer targets native macOS Apple Silicon. Use an ARM terminal, without Rosetta.' >&2 exit 1 fi nanojev_macos_version="$(sw_vers -productVersion)" if (( ${nanojev_macos_version%%.*} < 14 )); then printf '%s\n' 'macOS 14 or newer is required by the pinned PyTorch build.' >&2 exit 1 fi if ! command -v uv >/dev/null; then printf '%s\n' 'Install uv first (for example: brew install uv), then run setup.command again.' >&2 exit 1 fi command -v npm >/dev/null || { printf '%s\n' 'npm is required; install Node.js with npm.' >&2; exit 1; } export UV_PYTHON_INSTALL_DIR="$nanojev_root/.runtime/python" export UV_CACHE_DIR="${NANOJEV_UV_CACHE:-$nanojev_root/.runtime/cache}" uv python install 3.12.13 --no-bin uv venv --clear --managed-python --python 3.12.13 "$nanojev_root/.venv" uv pip sync --python "$nanojev_root/.venv/bin/python" "$nanojev_root/requirements-lock.txt" if [[ -f package-lock.json ]]; then npm ci --no-audit --no-fund; else npm install --no-audit --no-fund; fi "$nanojev_root/node_modules/.bin/agent-browser" install "$nanojev_root/.venv/bin/python" "$nanojev_root/scripts/check-install.py" printf '%s\n' "$nanojev_node" > "$nanojev_root/.runtime/node-path" printf '%s\n' 'Ready. Start the model with ./start.command. To execute your page contract, run ./run.command --task your-task.json.'