/**
 * POST /api/chat/temper-ping
 *
 * Reachability probe for the chat memory backend. If Temper URL+key are
 * configured, pings Temper at /v1/memory/blocks?pinned=true. Otherwise
 * pings the LocalMemoryStore (SQLite). Returns { ok, message, pinned,
 * backend } — `backend` is 'temper' | 'local' so the settings UI can
 * label which one is active.
 */

import { NextResponse } from 'next/server';
import { getMemoryStore } from '@/lib/chat/memory-store';

export async function POST() {
  const store = getMemoryStore();
  const r = await store.ping();
  return NextResponse.json({ ...r, backend: store.kind });
}
