-- 20260502171044_neuron_config.sql -- -- Phase 1 of the runtime config store. Backs bl-6eb51893. -- -- Adds public.neuron_config: a (key, scope) -> jsonb runtime config table. -- The web tier reads it at request time with a 60s TTL cache and passes -- chat.model down to soul via the dharma envelope payload, so swapping -- models becomes a row update (not a Cloud Run revision rollout). -- -- Phase 2 will add Realtime subscription + write surface + admin UI. create table if not exists public.neuron_config ( key text primary key, value jsonb not null, scope text not null default 'prod', updated_at timestamptz not null default now(), updated_by text ); alter table public.neuron_config enable row level security; -- No policies. Service-role bypasses RLS. Public anon has no access. The -- table is server-side only; the web tier reads it with the service key. insert into public.neuron_config (key, value, scope, updated_by) values ('chat.model', '"claude-sonnet-4-5"'::jsonb, 'prod', 'system'), ('chat.format', '"anthropic"'::jsonb, 'prod', 'system'), ('chat.url', '"https://api.anthropic.com/v1/messages"'::jsonb, 'prod', 'system') on conflict (key) do nothing;