#!/usr/bin/env bash # Fail closed if the running Comfy (or offline tree) is not the Power Pack keys-2k stack. set -euo pipefail OFFLINE=0 IP="${1:-127.0.0.1}" PORT="${H3_PORT:-8188}" if [[ "${1:-}" == "--offline" ]]; then OFFLINE=1; fi fail() { echo "FAIL: $*" >&2; exit 1; } ok() { echo "OK: $*"; } if [[ "$OFFLINE" == "1" ]]; then COMFY="${COMFY_DIR:-/opt/powerpack-h3/ComfyUI}" [[ -f "$COMFY/main.py" ]] || fail "no Comfy at $COMFY" grep -q '0.31.1' "$COMFY/comfyui_version.py" 2>/dev/null || fail "ComfyUI version not 0.31.1" [[ -d "$COMFY/custom_nodes/ComfyUI-Spectrum-MiniMax-H3" ]] || fail "Spectrum missing" grep -q '0.2.1' "$COMFY/custom_nodes/ComfyUI-Spectrum-MiniMax-H3/pyproject.toml" 2>/dev/null \ || fail "Spectrum not v0.2.1" [[ -d "$COMFY/custom_nodes/ComfyUI-MiniMaxH3-Contex-Loop" ]] || fail "Contex-Loop missing" ok "offline tree looks like keys-2k stack" exit 0 fi curl -sf -m 5 "http://${IP}:${PORT}/system_stats" >/dev/null || fail "Comfy down at ${IP}:${PORT}" curl -sf "http://${IP}:${PORT}/object_info" | python3 -c ' import sys,json d=json.load(sys.stdin) need=["PathchSageAttentionKJ","SolAttnPatch","SpectrumApplyMiniMaxH3","H3FirstBlockCache", "MiniMaxH3MotionContext","ImageUpscaleWithModel","UpscaleModelLoader","MiniMaxH3ImageToVideo"] miss=[n for n in need if n not in d] if miss: print("MISSING", miss); sys.exit(1) print("object_info nodes OK") ' curl -sf "http://${IP}:${PORT}/object_info/SpectrumApplyMiniMaxH3" | python3 -c ' import sys,json j=json.load(sys.stdin); k=next(iter(j)) bag=j[k]["input"].get("required",{})|j[k]["input"].get("optional",{}) f=bag.get("offline_smoothing_replay") d=f[1].get("default") if isinstance(f,list) and len(f)>1 and isinstance(f[1],dict) else None assert d is True, f"offline_smoothing_replay default={d} (want True)" print("Spectrum audio fix default OK") ' ok "live stack at ${IP}:${PORT} is keys-2k compatible"