#!/command/with-contenv sh
set -eu
mkdir -p /opt/data /run/sellable-agent
chown -R hermes:hermes /opt/data /run/sellable-agent
chmod 0700 /opt/data /run/sellable-agent
# Plan sign-in add-ons: Hermes gets only the ones this machine is signed in to.
node --input-type=module -e 'import { machineSignins, placeModelProviderAddons } from "/usr/local/lib/sellable-agent/model-signins.mjs"; placeModelProviderAddons(machineSignins("/opt/data"));' \
  || echo '{"ok":false,"code":"model_provider_addons_not_placed"}'
exec python3 /usr/local/lib/sellable-agent/managed-auth-supervisor.py --kind CUSTOMER
