#!/bin/bash # Stage the pinned Codex SDK and its Linux CLI package on shared storage. Run this from the login # environment, where registry.npmjs.org is reachable; compute nodes bind the result read-only. set -euo pipefail PTB_DATA_DIR="${PTB_DATA_DIR:-/home/jiaruiliu/ptb-data}" PTB_CODEX_SDK_DIR="${PTB_CODEX_SDK_DIR:-$PTB_DATA_DIR/tooling/codex-sdk-0.160.1}" scope="$PTB_CODEX_SDK_DIR/node_modules/@openai" if python3 - "$scope" <<'PY' import json import sys from pathlib import Path scope = Path(sys.argv[1]) expected = {"codex-sdk": "0.160.1", "codex": "0.160.1", "codex-linux-x64": "0.160.1-linux-x64"} for name, version in expected.items(): path = scope / name / "package.json" if not path.is_file() or json.loads(path.read_text()).get("version") != version: raise SystemExit(1) binary = scope / "codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin/codex" raise SystemExit(0 if binary.is_file() else 1) PY then echo "Codex SDK 0.160.1 is already ready at $PTB_CODEX_SDK_DIR" exit 0 fi mkdir -p "$scope/codex-sdk" "$scope/codex" "$scope/codex-linux-x64" curl -L -sS https://registry.npmjs.org/@openai/codex-sdk/-/codex-sdk-0.160.1.tgz \ | tar -xz --strip-components=1 -C "$scope/codex-sdk" curl -L -sS https://registry.npmjs.org/@openai/codex/-/codex-0.160.1.tgz \ | tar -xz --strip-components=1 -C "$scope/codex" curl -L -sS https://registry.npmjs.org/@openai/codex/-/codex-0.160.1-linux-x64.tgz \ | tar -xz --strip-components=1 -C "$scope/codex-linux-x64" echo "Codex SDK 0.160.1 staged at $PTB_CODEX_SDK_DIR"