f3566a3c1a
Co-Authored-By: Mira Rehfeld <noreply@anthropic.com>
72 lines
2.5 KiB
Bash
72 lines
2.5 KiB
Bash
#!/usr/bin/env bash
|
|
# Seed RS-01: Bot Standards Foundation (org) + APIX registry (service).
|
|
# Run once against a freshly started registry. Safe to re-run — 409s are ignored.
|
|
#
|
|
# Usage:
|
|
# REGISTRY_URL=http://localhost:8180 API_KEY=dev-insecure-key-change-in-prod ./scripts/seed-self-registration.sh
|
|
|
|
set -euo pipefail
|
|
|
|
REGISTRY_URL="${REGISTRY_URL:-http://localhost:8180}"
|
|
API_KEY="${API_KEY:-dev-insecure-key-change-in-prod}"
|
|
BSF_EMAIL="${BSF_EMAIL:-carsten@botstandards.org}"
|
|
|
|
echo "==> Registering Bot Standards Foundation (org) ..."
|
|
ORG_RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \
|
|
-X POST "${REGISTRY_URL}/organizations" \
|
|
-H "Content-Type: application/json" \
|
|
-H "X-Api-Key: ${API_KEY}" \
|
|
-d '{
|
|
"registrantName": "Bot Standards Foundation",
|
|
"registrantEmail": "'"${BSF_EMAIL}"'",
|
|
"registrantJurisdiction": "CH",
|
|
"registrantOrgType": "FOUNDATION",
|
|
"domain": "botstandards.org",
|
|
"targetOLevel": "IDENTITY_VERIFIED"
|
|
}')
|
|
|
|
if [ "${ORG_RESPONSE}" = "409" ]; then
|
|
echo " botstandards.org already registered — skipping."
|
|
elif [ "${ORG_RESPONSE}" = "201" ] || [ "${ORG_RESPONSE}" = "200" ]; then
|
|
echo " Registered. HTTP ${ORG_RESPONSE}"
|
|
else
|
|
echo " ERROR: HTTP ${ORG_RESPONSE}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "==> Registering APIX registry service (RS-01) ..."
|
|
SVC_RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \
|
|
-X POST "${REGISTRY_URL}/services" \
|
|
-H "Content-Type: application/json" \
|
|
-H "X-Api-Key: ${API_KEY}" \
|
|
-d '{
|
|
"name": "APIX Registry",
|
|
"description": "The open autonomous agent service discovery registry. Agents navigate here to find and invoke any registered service by capability — no hardcoded URLs required.",
|
|
"endpoint": "'"${REGISTRY_URL}"'/",
|
|
"capabilities": ["service.discovery", "service.query", "service.registration"],
|
|
"registrantEmail": "'"${BSF_EMAIL}"'",
|
|
"registrantName": "Bot Standards Foundation",
|
|
"registrantJurisdiction": "CH",
|
|
"registrantOrgType": "FOUNDATION",
|
|
"bsmVersion": "0.1",
|
|
"serviceStage": "DEVELOPMENT"
|
|
}')
|
|
|
|
if [ "${SVC_RESPONSE}" = "409" ]; then
|
|
echo " APIX registry service already registered — skipping."
|
|
elif [ "${SVC_RESPONSE}" = "201" ] || [ "${SVC_RESPONSE}" = "200" ]; then
|
|
echo " Registered. HTTP ${SVC_RESPONSE}"
|
|
else
|
|
echo " ERROR: HTTP ${SVC_RESPONSE}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "==> Verifying registry root ..."
|
|
curl -s "${REGISTRY_URL}/" | python3 -m json.tool 2>/dev/null || \
|
|
curl -s "${REGISTRY_URL}/"
|
|
|
|
echo ""
|
|
echo "Done. Registry root at ${REGISTRY_URL}/"
|