24 lines
903 B
TypeScript
24 lines
903 B
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
import { auth } from "@/app/(auth)/auth";
|
|
import { getCanvasAgentFeatureFlagsFromSystemSettings } from "@/lib/canvas/agent-feature-settings";
|
|
import { applyCanvasOperationPlan } from "@/lib/canvas/agent-mutations";
|
|
import { handleCanvasAgentOperationRouteRequest } from "@/lib/canvas/agent-operation-route";
|
|
|
|
export async function POST(
|
|
request: NextRequest,
|
|
{ params }: { params: Promise<{ id: string }> }
|
|
) {
|
|
const session = await auth();
|
|
const { id } = await params;
|
|
const response = await handleCanvasAgentOperationRouteRequest({
|
|
userId: session?.user?.id,
|
|
projectId: id,
|
|
readBody: () => request.json(),
|
|
features: await getCanvasAgentFeatureFlagsFromSystemSettings(),
|
|
applyOperation: applyCanvasOperationPlan,
|
|
logger: console,
|
|
});
|
|
|
|
return NextResponse.json(response.body, { status: response.status });
|
|
}
|