import { addMemory, deleteMemory, listMemory } from '../../../lib/agent-memory.js';
export const dynamic='force-dynamic'; export const runtime='nodejs';
export async function GET(request){ const u=new URL(request.url); return Response.json({ memories:listMemory({agent_id:u.searchParams.get('agent_id'),project_id:u.searchParams.get('project_id'),engine:u.searchParams.get('engine')||'ollama'}) }); }
export async function POST(request){ try{return Response.json({memory:addMemory(await request.json())},{status:201});}catch(e){return Response.json({error:e.message},{status:400});} }
export async function DELETE(request){ const u=new URL(request.url); return Response.json({deleted:deleteMemory(u.searchParams.get('id'))}); }
