feat(sbx,ai): snapshot all backends w/ local export; robust AI + rejoin

- /sbx save [--local] and new /sbx vmsave/vmsnaps: snapshot Docker,
  Multipass, and VirtualBox; --local also writes a portable artifact
  (docker .tar / VBox .ova) under hh-snapshots/ that survives pruning.
- sandbox reappears for anyone who leaves and rejoins (host replays
  status + screen snapshot + ACL on Joined); SbxStatus ready handler is
  now idempotent so it never wipes scrollback.
- received files auto-bridge into the hosted sandbox (ft::tar_path).
- AI agent: translate Ollama's cryptic 404 into model/host/fix guidance.
- bootstrap installs the AI layer (Ollama + default model) by default,
  with consent gates; --no-ai opts out, --yes skips prompts.
- help menu lists the new save/vm flags.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
leetcrypt
2026-06-06 16:47:57 -07:00
parent 70245cbd9d
commit d6d44128c0
7 changed files with 467 additions and 37 deletions
+28 -3
View File
@@ -5,11 +5,18 @@
# for the server, installs its dependencies, and builds the Rust client.
#
# usage:
# ./bootstrap.sh # full setup (venv + deps + cargo build)
# ./bootstrap.sh # full setup (venv + deps + client + AI layer)
# ./bootstrap.sh --release # build the client in release mode
# ./bootstrap.sh --no-ai # skip the AI layer (no Ollama install / model pull)
# ./bootstrap.sh --yes # don't prompt during the AI layer (install / pull)
# ./bootstrap.sh --check # only report what's installed; change nothing
# ./bootstrap.sh -h | --help # this help
#
# The AI layer (local Ollama + a default model for the /ai agent) is set up by
# default so the agent works out of the box and nobody hits "model not found".
# It still prompts before installing/pulling on an interactive terminal — skip
# the whole thing with --no-ai, or skip the prompts with --yes.
#
# After it finishes, spin up a local test session with: cd hh && ./lets-hack.sh
set -uo pipefail
@@ -19,12 +26,16 @@ HH_DIR="$ROOT/hh"
RELEASE=0
CHECK_ONLY=0
DO_AI=1
ASSUME_YES=0
for arg in "$@"; do
case "$arg" in
--release) RELEASE=1 ;;
--check) CHECK_ONLY=1 ;;
--no-ai) DO_AI=0 ;;
--yes|-y) ASSUME_YES=1 ;;
-h|--help|-help) grep '^#' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
*) echo "✖ unknown arg: $arg (try --release / --check / --help)" >&2; exit 2 ;;
*) echo "✖ unknown arg: $arg (try --release / --no-ai / --yes / --check / --help)" >&2; exit 2 ;;
esac
done
@@ -73,8 +84,22 @@ else
echo " ✓ client built: hh/target/debug/hack-house"
fi
# 4. AI layer (on by default): install Ollama + pull the default model so the
# /ai agent works out of the box and nobody hits "model not found" later. The
# logic lives in bootstrap-ai.sh; --ai-only skips its baseline re-run (we just
# did it). Declining/failing here is non-fatal — the baseline setup still
# stands and the AI layer can be added later with ./bootstrap-ai.sh.
if [[ $DO_AI -eq 1 ]]; then
ai_args=(--ai-only)
[[ $ASSUME_YES -eq 1 ]] && ai_args+=(--yes)
"$ROOT/bootstrap-ai.sh" "${ai_args[@]}" \
|| echo "⚠ AI layer not completed — re-run ./bootstrap-ai.sh when ready" >&2
fi
echo
echo "ready. next steps:"
echo " cd hh && ./lets-hack.sh # local test session (server + clients in tmux)"
echo " # or run the server + client by hand — see README.MD"
echo " # want the local AI agent? ./bootstrap-ai.sh (installs Ollama + a model)"
if [[ $DO_AI -eq 0 ]]; then
echo " # AI layer skipped (--no-ai); add it later with ./bootstrap-ai.sh"
fi