diff --git a/bootstrap.sh b/bootstrap.sh index 7f85c97..c460cd8 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -14,7 +14,7 @@ set -euo pipefail REPO_DIR="$(cd "$(dirname "$0")" && pwd)" OS="$(uname -s)" -GUTASK_DIR="${HOME}/gutasktool" +GUTASK_DIR="${REPO_DIR}/agent-zero-data/gutasktool" GITEA_HOST="ramanujan.glitch.university" GITEA_PORT=2222 VPS_HOST="glitch.university" @@ -48,6 +48,21 @@ fi info "Prerequisites OK" +# ── Credentials (collected upfront before any private repo clones) ───────────── +section "Credentials" + +echo "" +prompt "Enter CONTENT_API_KEY for glitch.university (find it in the VPS .env): " +read -r -s CONTENT_API_KEY +echo "" + +echo "" +prompt "Enter Gitea personal access token (needs repo read access — create at https://${GITEA_HOST}/user/settings/applications): " +read -r -s GITEA_TOKEN_BOOTSTRAP +echo "" + +info "Credentials collected" + # ── Ollama ──────────────────────────────────────────────────────────────────── section "Ollama" @@ -80,22 +95,66 @@ else fi fi +# Returns 0 if model is already pulled, 1 if not +model_installed() { + ollama list 2>/dev/null | awk 'NR>1 {print $1}' | grep -qx "$1" +} + +pull_model() { + local model="$1" + if model_installed "$model"; then + info "Already downloaded: $model" + else + info "Pulling $model..." + ollama pull "$model" + fi +} + echo "" -echo " Default models to pull (you can skip any):" -echo " [1] qwen2.5-coder:7b (~5 GB) — fast coding model" -echo " [2] qwen2.5-coder:32b (~20 GB) — strong coding model" -echo " [3] qwen2.5:72b (~45 GB) — general reasoning" -echo " [4] deepseek-r1:70b (~43 GB) — chain-of-thought" +echo " ── Coding ──────────────────────────────────────" +echo " [1] qwen2.5-coder:7b ~5 GB fast, good for quick tasks" +echo " [2] qwen2.5-coder:32b ~20 GB strong coding (recommended)" +echo " [3] qwen2.5-coder:72b ~45 GB best coding quality" +echo " [4] deepseek-coder-v2:16b ~9 GB strong alternative" echo "" -prompt "Which models to pull? (e.g. 1 2 or Enter to skip all): " +echo " ── General ─────────────────────────────────────" +echo " [5] llama3.1:8b ~5 GB fast general-purpose" +echo " [6] llama3.1:70b ~40 GB strong general-purpose" +echo " [7] mistral:7b ~4 GB fast, widely used" +echo " [8] mixtral:8x7b ~26 GB MoE, strong at instruction following" +echo " [9] gemma2:9b ~6 GB Google, good at reasoning" +echo " [10] gemma2:27b ~16 GB Google, stronger" +echo " [11] qwen2.5:72b ~45 GB strong general + multilingual" +echo "" +echo " ── Reasoning ───────────────────────────────────" +echo " [12] deepseek-r1:7b ~5 GB chain-of-thought, fast" +echo " [13] deepseek-r1:32b ~20 GB chain-of-thought, strong" +echo " [14] deepseek-r1:70b ~43 GB chain-of-thought, best" +echo "" +prompt "Which models to pull? (e.g. 1 3 7 or 'all' or Enter to skip): " read -r MODEL_CHOICES +# Expand 'all' to full list +if [[ "$MODEL_CHOICES" == "all" ]]; then + MODEL_CHOICES="1 2 3 4 5 6 7 8 9 10 11 12 13 14" +fi + for choice in $MODEL_CHOICES; do case "$choice" in - 1) info "Pulling qwen2.5-coder:7b..."; ollama pull qwen2.5-coder:7b ;; - 2) info "Pulling qwen2.5-coder:32b..."; ollama pull qwen2.5-coder:32b ;; - 3) info "Pulling qwen2.5:72b..."; ollama pull qwen2.5:72b ;; - 4) info "Pulling deepseek-r1:70b..."; ollama pull deepseek-r1:70b ;; + 1) pull_model "qwen2.5-coder:7b" ;; + 2) pull_model "qwen2.5-coder:32b" ;; + 3) pull_model "qwen2.5-coder:72b" ;; + 4) pull_model "deepseek-coder-v2:16b" ;; + 5) pull_model "llama3.1:8b" ;; + 6) pull_model "llama3.1:70b" ;; + 7) pull_model "mistral:7b" ;; + 8) pull_model "mixtral:8x7b" ;; + 9) pull_model "gemma2:9b" ;; + 10) pull_model "gemma2:27b" ;; + 11) pull_model "qwen2.5:72b" ;; + 12) pull_model "deepseek-r1:7b" ;; + 13) pull_model "deepseek-r1:32b" ;; + 14) pull_model "deepseek-r1:70b" ;; esac done @@ -149,12 +208,14 @@ fi # ── gutasktool ──────────────────────────────────────────────────────────────── section "gutasktool" +mkdir -p "${REPO_DIR}/agent-zero-data" + if [[ -d "$GUTASK_DIR" ]]; then info "gutasktool already at ${GUTASK_DIR}" else info "Cloning gutasktool..." git clone "ssh://git@${GITEA_HOST}:${GITEA_PORT}/glitch-university/gutasktool.git" "$GUTASK_DIR" \ - || git clone "https://${GITEA_HOST}/glitch-university/gutasktool.git" "$GUTASK_DIR" + || git clone "https://oauth2:${GITEA_TOKEN_BOOTSTRAP}@${GITEA_HOST}/glitch-university/gutasktool.git" "$GUTASK_DIR" fi info "Installing gutasktool..." @@ -162,13 +223,9 @@ info "Installing gutasktool..." info "gutask installed ($(gutask --version 2>/dev/null || echo 'ok'))" if [[ ! -f "${GUTASK_DIR}/.env" ]]; then - echo "" - prompt "Enter CONTENT_API_KEY for glitch.university (find it in the VPS .env): " - read -r -s API_KEY - echo "" cat > "${GUTASK_DIR}/.env" << EOF API_URL=https://glitch.university -CONTENT_API_KEY=${API_KEY} +CONTENT_API_KEY=${CONTENT_API_KEY} GITEA_URL=https://${GITEA_HOST} GITEA_OWNER=glitch-university # AGENT_ID, AGENT_NAME, AGENT_PASSWORD, and GITEA_TOKEN are per-agent. @@ -189,6 +246,9 @@ docker compose build --quiet info "Starting containers..." docker compose up -d +info "Installing gutasktool inside agent0 container..." +docker exec agent0 pip install -e /a0/usr/gutasktool --quiet + echo "" docker compose ps