Files
chat/app
marauder-actual a783da7415 refactor: drop dead sidecar, cart becomes source of truth for persona
The sin:4098 sidecar service has been dead since the last reboot, and the
real binding mechanism is the chat-persona.ts opencode plugin (now in
madcat-plugin) that reads the operator cart file directly. The sidecar
HTTP round-trip was vestigial.

Changes:
- Remove SIDECAR_URL env, _sidecar_get_binding(), _sidecar_bind(),
  _session_id_for_user() — all dead code paths.
- Add _slug_from_cart(cart): derives canonical PERSONAS slug from a cart's
  persona_name (case-insensitive) or voice prefix fallback.
- Simplify _pick_system_prompt(cart): cart.system_prompt (calibrated) →
  BT default. No more sidecar override layer.
- / route: bound_slug from _slug_from_cart(cart) instead of sidecar lookup.
- /api/persona POST: mutates the cart file in-place (preserves calibrated
  UI prefs), creates a minimal cart for fresh operators. The opencode plugin
  re-reads the cart on every turn, so switches take effect on the very next
  message — no session reconnect.
- /api/persona/current GET: reads from cart, returns {slug, display, voice,
  bound}.
- WS handler: re-loads cart at the start of each turn for live persona
  switching; voice falls back cart.voice → TTS_VOICE.

Operator cart at /home/madcat/.local/share/chat-saiden/operators/<email>.json
is now the single source of truth.
2026-05-29 22:54:45 +02:00
..