import { notFound } from "next/navigation";

import { ChainPage } from "@/components/chain/ChainPage";
import { fetchProject } from "@/lib/api/server";

interface PageProps {
  params: Promise<{ id: string }>;
}

// 多章工作流链页（Scope B B1）。Server Component 取项目；ChainPage（Client）承载
// 发起 → job 轮询进度 → interrupt 裁决 → resume 续跑交互。
export default async function ChainsRoutePage({ params }: PageProps) {
  const { id } = await params;
  try {
    const project = await fetchProject(id);
    return <ChainPage project={project} />;
  } catch {
    notFound();
  }
}
