- PEP-5: statusLine hook (cost, context, 5h/7d limit windows), transcript tokens, sessions.usage, usage strip over every page, runner usage, bot /status, MCP get_usage - PEP-43: project/story budgets in settings, watchdog pause (Escape, question to the PM: extend x2 / remove limit / stop), start/resume guard, budget on the story card - PEP-47: project metrics tab (cycle time, first pass, review returns, questions, runner hours, PM wait, limits, spend by week/agent/epic), MCP get_metrics - PEP-48: event authors (actor columns, AsyncLocalStorage context), question_answered, /journal for superadmins, project journal tab, authors in the story feed - Migration 0007_usage_audit; OpenSpec changes archived Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.8 KiB
TypeScript
36 lines
1.8 KiB
TypeScript
import { notFound } from "next/navigation";
|
||
import { getProject, isSuperadmin, JOURNAL_NOISE, listJournal, listProjects, type ActorChannel, type ActorKind } from "@peppa/core";
|
||
import { JournalFilters, JournalList } from "@/components/Accounting";
|
||
import { PageHeader } from "@/components/common";
|
||
import { Workspace } from "@/components/Workspace";
|
||
import { requireUser } from "@/lib/auth";
|
||
import { db } from "@/lib/db";
|
||
|
||
/** Superadmin only (PEP-48): who did what — people (web, Telegram, MCP clients, CLI), agents, Peppa. */
|
||
export default async function Journal({ searchParams }: { searchParams: Promise<{ project?: string; actor?: string; channel?: string; all?: string }> }) {
|
||
const me = await requireUser();
|
||
if (!(await isSuperadmin(db, me))) notFound();
|
||
const { project, actor, channel, all } = await searchParams;
|
||
const projects = await listProjects(db);
|
||
const p = project ? await getProject(db, project).catch(() => null) : null;
|
||
const entries = await listJournal(db, {
|
||
projectId: p?.id ?? (project ? -1 : undefined),
|
||
actorKind: (actor || undefined) as ActorKind | undefined,
|
||
channel: (channel || undefined) as ActorChannel | undefined,
|
||
excludeTypes: all ? undefined : JOURNAL_NOISE,
|
||
limit: 300,
|
||
});
|
||
return (
|
||
<Workspace aside={null}>
|
||
<PageHeader title="Журнал действий">
|
||
Кто что сделал: люди (веб, Telegram, MCP-клиенты, CLI, терминал), агенты и сама Пеппа. Новые сверху, последние 300.
|
||
{!all && " Служебные события хуков скрыты."}
|
||
</PageHeader>
|
||
<div className="mb-4">
|
||
<JournalFilters action="/journal" projects={projects.map((x) => ({ key: x.key, name: x.name }))} value={{ project, actor, channel }} />
|
||
</div>
|
||
<JournalList entries={entries} />
|
||
</Workspace>
|
||
);
|
||
}
|