peppa/apps/web/app/api/connections/journal/route.ts
peppa-bot 10363f8592 PEP-270: задачи агентов — предложения, не больше 5 в сутки на проект
- MCP create_task агента: origin agent + «Предложено» (раньше — задача человека, диспетчер брал её сам)
- AgentLimits.perDay (5, скользящие 24 ч), proposalRoom/proposalsToday; сверх — отказ агенту,
  находки приёмки — в недельную сводку; событие proposal_limited
- CLI agent-limits perDay=N, правило агентам в template/RULES.md, тест proposal-daily-limit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 17:02:04 +00:00

26 lines
1.1 KiB
TypeScript

// PEP-254: the owner downloads their whole Access Hub journal with hashes (JSONL or CSV) to
// check it on their own. Only the signed-in user's own rows.
import { exportConnectionJournal } from "@peppa/core";
import { currentUser } from "@/lib/auth";
import { db } from "@/lib/db";
import { getT } from "@/lib/i18n";
export const dynamic = "force-dynamic";
export async function GET(req: Request) {
const t = await getT();
const me = await currentUser();
if (!me) return Response.json({ error: t("Нужен вход") }, { status: 401 });
const format = new URL(req.url).searchParams.get("format") === "csv" ? "csv" : "jsonl";
const body = await exportConnectionJournal(db, me.id, format);
const day = new Date().toISOString().slice(0, 10);
return new Response(body, {
headers: {
"content-type": format === "csv" ? "text/csv; charset=utf-8" : "application/x-ndjson; charset=utf-8",
"content-disposition": `attachment; filename="connections-journal-${day}.${format}"`,
"cache-control": "no-store",
"x-content-type-options": "nosniff",
},
});
}