Files
oniagent/scripts/auto_repair.sh
root 0e17e8a6ac feat: complete ONI Agent project with full Mod API, Python toolchain, and development guide
- Implement all Mod API endpoints (buildings, research, geysers, alerts, critters, deconstruct, prioritize, research, schedule, wardrobe)
- Enhance Python tools with comprehensive CLI, analysis (O2/food/power/temp/water), and 7 blueprints (SPOM, toilet, ranch, farm, cooling, bedroom)
- Add utility scripts: auto_repair, auto_analyze, watch mode, setup
- Write Agent-Mod integration constraints and development guide
- Create skills directory with ONI agent skill definition
2026-05-22 08:44:56 +08:00

29 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# ONI Agent - Auto Repair Script
# Detects game connection issues and attempts to restart the Mod bridge.
set -euo pipefail
CONFIG_PATH="$(dirname "$0")/../config.json"
HOST=$(python3 -c "import json; print(json.load(open('$CONFIG_PATH'))['modHost'])")
PORT=$(python3 -c "import json; print(json.load(open('$CONFIG_PATH'))['modPort'])")
TIMEOUT=$(python3 -c "import json; print(json.load(open('$CONFIG_PATH'))['timeout'])")
check_health() {
curl -sf --max-time "$TIMEOUT" "http://$HOST:$PORT/health" > /dev/null 2>&1
}
echo "[ONI Agent] Checking Mod connection..."
if check_health; then
echo "[OK] Mod is running on $HOST:$PORT"
exit 0
else
echo "[!] Cannot reach Mod at $HOST:$PORT"
echo " Make sure Oxygen Not Included is running with the ONI Agent Bridge mod enabled."
echo " Steps:"
echo " 1. Launch Oxygen Not Included"
echo " 2. Enable 'ONI Agent Bridge' mod in the Mod menu"
echo " 3. Load a save or start a new game"
echo " 4. Run this script again"
exit 1
fi