Large World graph, agent platform, brain stack & dashboard rebuild

Frontend
- Large World: collapse org/company/team tiers into one expandable React Flow
  hierarchy (WorldFlow) with per-click expand, persisted node positions, a
  compact tree sidebar, wrench multi-select delete across levels, and a sized
  right slide-out (phone/tablet/full) showing an agent summary + drill button.
- Agent page: GitHub-style animated contribution grid (VitalsCard), collapsible
  System Prompt + Personality cards, restructured anatomy cards, bigger avatar
  with name/title header row, Markdown/JSON-aware rendering, brain registry +
  history, avatar generate/upload.
- User-icon menu (Infrastructure/Brains/Tools/Profile/Credits) + ToolPanel;
  Master Planner deploy wizard (Specialists/Swarm/Scheduled/Triggered);
  Team Runs view; reap-progress modal; dashboard is the single live interface.

Backend
- cm-brain crate (.brain as the agent definition) + brain apply/history.
- Hard-purge reap (FK-ordered) + sandbox release + SSE batch-delete.
- Swarm self-verifying loop, mode-aware planner, web.search tool, webhooks
  (migration 0013), org/company/team delete endpoints, scheduler sweeps.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
Omar Sobh
2026-06-22 23:21:54 -07:00
co-authored by Claude Opus 4.8
parent 9f266d5806
commit 34f744734b
123 changed files with 9591 additions and 1098 deletions
+6 -91
View File
@@ -1,93 +1,8 @@
import { Sparkles } from "lucide-react";
import { z } from "zod";
import { redirect } from "next/navigation";
import { BuyCredits } from "@/components/global/BuyCredits";
import { PageChrome } from "@/components/global/PageChrome";
import { PromoRedeem } from "@/components/global/PromoRedeem";
import { apiFetch } from "@/lib/api/http";
import { fetchCredits } from "@/lib/api/team";
import { Card } from "@/components/ui/Card";
const UsageSchema = z.object({
tokens_in: z.number(),
tokens_out: z.number(),
credits: z.number(),
});
// Credits page (§8.4): balance + usage meter, promo redemption, and the
// sales card — three cards per the reference layout.
export default async function CreditsPage() {
const [credits, usage] = await Promise.all([
fetchCredits(),
apiFetch(UsageSchema, "/api/team/usage"),
]);
const burn = usage.credits;
const runwayDays =
burn > 0 ? Math.floor((credits.available / burn) * 7) : null;
return (
<PageChrome
title="Credits"
description="Manage your balance, subscriptions, and usage history."
>
<div className="flex flex-col gap-4">
<Card className="flex flex-wrap items-end justify-between gap-4 shadow-card">
<div>
<p className="text-xs tracking-wide text-muted-foreground uppercase">
Available credits
</p>
<p
data-testid="credit-balance"
className={`pt-2 font-mono text-xxxl font-semibold ${
credits.available < 0 ? "text-coral" : ""
}`}
>
{credits.available.toLocaleString("en-US")}
</p>
<p className="pt-2 text-xs text-muted-foreground">
Credits never expire.
</p>
</div>
<BuyCredits />
</Card>
<Card data-testid="usage-card">
<p className="text-xs tracking-wide text-muted-foreground uppercase">
Usage · last 7 days
</p>
<p className="pt-2 text-sm">
{usage.credits.toLocaleString("en-US")} credits ·{" "}
{(usage.tokens_in + usage.tokens_out).toLocaleString("en-US")}{" "}
tokens ({usage.tokens_in.toLocaleString("en-US")} in /{" "}
{usage.tokens_out.toLocaleString("en-US")} out)
</p>
<p className="pt-1 text-xs text-muted-foreground">
{runwayDays !== null
? `~${runwayDays} days of runway at this pace.`
: "No usage yet this week."}
</p>
</Card>
<PromoRedeem />
<Card className="flex items-center gap-4">
<span className="flex size-10 shrink-0 items-center justify-center rounded-2xl bg-surface-warm-muted">
<Sparkles aria-hidden size={18} className="text-coral" />
</span>
<div className="min-w-0 flex-1">
<p className="text-sm font-medium">Scaling beyond self-serve?</p>
<p className="text-xs text-muted-foreground">
Volume pricing, SSO, and dedicated support for larger teams.
</p>
</div>
<a
href="mailto:[email protected]"
className="rounded-full border border-border px-4 py-2 text-sm text-foreground transition-colors duration-(--duration-normal) ease-app hover:bg-hover-bg"
>
Talk to sales
</a>
</Card>
</div>
</PageChrome>
);
// Retired as a standalone page: this tool now opens as an in-dashboard panel
// (the four-square launcher). Kept as a redirect so old links/bookmarks land in
// the new interface. The tool's content component is reused inside ToolPanel.
export default function Page() {
redirect("/");
}