- 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>
33 lines
1.5 KiB
TypeScript
33 lines
1.5 KiB
TypeScript
import type { ReactNode } from "react";
|
|
import { accountUsageForUser, getNotifyPrefs, isSuperadmin } from "@peppa/core";
|
|
import { db } from "@/lib/db";
|
|
import { requireUser } from "@/lib/auth";
|
|
import { navCounts } from "@/lib/queries";
|
|
import { Sidebar } from "@/components/Sidebar";
|
|
import { AttentionBadge } from "@/components/AttentionBadge";
|
|
import { CommandPalette } from "@/components/CommandPalette";
|
|
import { UsageStrip } from "@/components/Accounting";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
/** Console layout (PEP-38): navigation on the left, each page renders centre + right panel via <Workspace>. */
|
|
export default async function AppLayout({ children }: { children: ReactNode }) {
|
|
const user = await requireUser();
|
|
const counts = await navCounts(user.id);
|
|
const { sound } = await getNotifyPrefs(db, user.id);
|
|
const superadmin = await isSuperadmin(db, user);
|
|
// PEP-5: subscription limit windows over every page.
|
|
const accounts = await accountUsageForUser(db, user).catch(() => []);
|
|
return (
|
|
<div className="min-h-dvh md:grid md:grid-cols-[232px_minmax(0,1fr)]">
|
|
<AttentionBadge count={counts.questions + counts.waitingRunners} sound={sound} />
|
|
<Sidebar login={user.login} avatarUrl={user.avatarUrl} counts={counts} superadmin={superadmin} />
|
|
<div className="flex min-w-0 flex-col pb-16 md:pb-0">
|
|
<UsageStrip accounts={accounts} admin={superadmin} />
|
|
{children}
|
|
</div>
|
|
<CommandPalette />
|
|
</div>
|
|
);
|
|
}
|