#!/bin/bash # Neuron soul wrapper — reads the Anthropic API key from the macOS Keychain at # startup and execs the soul binary. API keys are NEVER stored in plists or on # disk in plaintext. The Keychain is the single source of truth. # # The install.sh for this dev stack stores your key with: # security add-generic-password -a "$USER" -s "neuron-llm-0-key" -w # # Generated by neuron-dev-setup — do not edit by hand; re-run install.sh instead. set -u # Primary inference key (Anthropic) — required. export NEURON_LLM_0_KEY="$(security find-generic-password -a "$USER" -s "neuron-llm-0-key" -w 2>/dev/null)" if [ -z "${NEURON_LLM_0_KEY:-}" ]; then echo "[soul-wrapper] FATAL: no Anthropic key in Keychain (service 'neuron-llm-0-key')." >&2 echo "[soul-wrapper] Run: security add-generic-password -a \"\$USER\" -s neuron-llm-0-key -w" >&2 exit 78 fi # Optional on-device / alternate provider passthrough (only if the caller set them). [ -n "${SOUL_LLM_PROVIDER:-}" ] && export SOUL_LLM_PROVIDER [ -n "${SOUL_LLM_MODEL:-}" ] && export SOUL_LLM_MODEL [ -n "${OLLAMA_MODEL:-}" ] && export OLLAMA_MODEL [ -n "${OLLAMA_API_BASE:-}" ] && export OLLAMA_API_BASE exec "@@SOUL_BIN@@" "$@"