# Whether this Mac runs the fleet's build policy (scripts/mac-build-policy.sh):## build_policy_state <scripts-dir> prints installed | fleet-missing | absent## installed the installer's marker is there (~/.cotton-agent/mac-build-policy/activated)# fleet-missing no marker, but the fleet file (<scripts-dir>/lane-macs.json) lists this# Mac by hostname: its install went missing, and the caller stops# absent neither: a Mac outside the fleet (a checkout of the public source),# where builds run without the policy## Sourced by with-build-lock.sh and disk-guard.sh, which decide the same way.build_policy_state() {if [ -f "${HOME:-}/.cotton-agent/mac-build-policy/activated" ]; then echo installedreturnfilocal fleet host fleet="$1/lane-macs.json" host="$(hostname -s 2>/dev/null | tr '[:upper:]' '[:lower:]')"if [ -f "$fleet" ] && python3 -I -c 'import json, sysmacs = json.load(open(sys.argv[1])).get("macs", {})names = {str(row.get("hostname") or name).lower() for name, row in macs.items() if isinstance(row, dict)}sys.exit(0if sys.argv[2] in names else1)' "$fleet" "$host" 2>/dev/null; then echo fleet-missingreturnfi echo absent}# The one message a caller prints for fleet-missing.build_policy_missing_message() { echo "$1: $(hostname -s) is a build Mac in the fleet file, but its build policy is not installed (no ~/.cotton-agent/mac-build-policy/activated). Run: pnpm mac-build-policy:install"}