import { NextResponse } from 'next/server'; import fs from 'fs'; export async function POST(req) { try { const body = await req.json(); const { action, strategy } = body; // Write command file that worker polls const cmd = JSON.stringify({ action, strategy, ts: Date.now() }); fs.writeFileSync('/tmp/kalbot-live-cmd', cmd); return NextResponse.json({ success: true, message: `Command "${action}" sent.` }); } catch (e) { return NextResponse.json({ error: e.message }, { status: 500 }); } }