diff --git a/image-recipe/_archived/build-auto-installer-iso.sh b/image-recipe/_archived/build-auto-installer-iso.sh index 1604c72f..7d3b7a49 100755 --- a/image-recipe/_archived/build-auto-installer-iso.sh +++ b/image-recipe/_archived/build-auto-installer-iso.sh @@ -1424,35 +1424,48 @@ fi # Include AIUI web app (Claude chat interface) AIUI_INCLUDED=0 -# Search multiple locations for a pre-built AIUI app. -# demo/aiui is the canonical AIUI bundle checked into the repo and is -# tried first so ISO builds on a fresh clone work without needing any -# external AIUI checkout. +# Pick the NEWEST valid AIUI build across the candidate locations, not the +# first: demo/aiui is the checked-in fallback so fresh clones can build an +# ISO, but on a dev box it is older than the tree's dist and silently won — +# 2026-08-07's RC1 shipped an index.html pointing at the stale demo bundle +# while the fresh one sat unused beside it. The merge also needs --delete, +# or yesterday's hashed assets linger next to today's forever. +AIUI_SRC="" +AIUI_NEWEST=0 for AIUI_DIR in \ - "$SCRIPT_DIR/../../demo/aiui" \ + "$SCRIPT_DIR/../../aiui/packages/app/dist" \ "$SCRIPT_DIR/../../AIUI/packages/app/dist" \ "$HOME/AIUI/packages/app/dist" \ "/home/archipelago/AIUI/packages/app/dist" \ "/opt/archipelago/web-ui/aiui" \ - "/home/archipelago/archy/AIUI/packages/app/dist"; do + "/home/archipelago/archy/AIUI/packages/app/dist" \ + "$SCRIPT_DIR/../../demo/aiui"; do if [ -d "$AIUI_DIR" ] && [ -f "$AIUI_DIR/index.html" ]; then - echo " Including AIUI from $AIUI_DIR..." - mkdir -p "$ARCH_DIR/web-ui/aiui" - # Use rsync to handle same-file (CI workspace == /opt/archipelago) gracefully - if command -v rsync >/dev/null 2>&1; then - rsync -a "$AIUI_DIR/" "$ARCH_DIR/web-ui/aiui/" - else - cp -r "$AIUI_DIR/"* "$ARCH_DIR/web-ui/aiui/" 2>/dev/null || true + m="$(stat -c %Y "$AIUI_DIR/index.html" 2>/dev/null || echo 0)" + if [ "$m" -gt "$AIUI_NEWEST" ]; then + AIUI_NEWEST="$m" + AIUI_SRC="$AIUI_DIR" fi - echo " ✅ AIUI included ($(du -sh "$ARCH_DIR/web-ui/aiui" | cut -f1))" - AIUI_INCLUDED=1 - break fi done +if [ -n "$AIUI_SRC" ]; then + echo " Including AIUI from $AIUI_SRC (newest of the candidates)..." + mkdir -p "$ARCH_DIR/web-ui/aiui" + # Use rsync to handle same-file (CI workspace == /opt/archipelago) gracefully + if command -v rsync >/dev/null 2>&1; then + rsync -a --delete "$AIUI_SRC/" "$ARCH_DIR/web-ui/aiui/" + else + rm -rf "${ARCH_DIR:?}/web-ui/aiui" + mkdir -p "$ARCH_DIR/web-ui/aiui" + cp -r "$AIUI_SRC/"* "$ARCH_DIR/web-ui/aiui/" 2>/dev/null || true + fi + echo " ✅ AIUI included ($(du -sh "$ARCH_DIR/web-ui/aiui" | cut -f1))" + AIUI_INCLUDED=1 +fi if [ "$AIUI_INCLUDED" = "0" ]; then echo " ⚠️ AIUI not found — build it first:" - echo " cd ~/AIUI/packages/app && VITE_BASE_PATH=/aiui/ npx vite build" - echo " Searched: demo/aiui, ~/AIUI, /home/archipelago/AIUI, /opt/archipelago/web-ui/aiui" + echo " cd aiui/packages/app && VITE_BASE_PATH=/aiui/ npx vite build" + echo " Searched: aiui/packages/app/dist, AIUI/packages/app/dist, ~/AIUI, /opt/archipelago/web-ui/aiui, demo/aiui" fi # Copy app manifests