#!/bin/sh
set -eu

script_url='https://gitlab.com/comluojian/agent-tools/-/raw/main/codex/macos/common/restore_codex.py'
script_path="$(mktemp -t codex-official-restore.XXXXXX.py)"
trap 'rm -f "$script_path"' EXIT

command -v curl >/dev/null 2>&1 || { echo 'ERROR: curl is required.' >&2; exit 1; }
command -v python3 >/dev/null 2>&1 || { echo 'ERROR: python3 is required.' >&2; exit 1; }
official_model="${CODEX_OFFICIAL_MODEL:-gpt-5.5}"
curl -fsSL "$script_url" -o "$script_path"
python3 "$script_path" --mode desktop --official-model "$official_model"
