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
@@ -1,20 +1,8 @@
import { ApprovalQueue } from "@/components/safety/ApprovalQueue";
import { fetchPendingApprovals } from "@/lib/api/approvals";
import { redirect } from "next/navigation";
// The approvals queue (§10): every gated action waiting on a human.
export default async function ApprovalsPage() {
const approvals = await fetchPendingApprovals();
return (
<section className="mx-auto max-w-3xl px-8 py-12">
<h1 className="text-2xl font-semibold tracking-tight">Approvals</h1>
<p className="pt-1 text-sm text-muted-foreground">
{approvals.length === 0
? "All clear — no actions awaiting review."
: `${approvals.length} ${
approvals.length === 1 ? "action awaits" : "actions await"
} your review. Nothing runs until you decide.`}
</p>
<ApprovalQueue approvals={approvals} />
</section>
);
// 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("/");
}
+6 -27
View File
@@ -1,29 +1,8 @@
import { z } from "zod";
import { redirect } from "next/navigation";
import { AppsDirectory } from "@/components/global/AppsDirectory";
import { PageChrome } from "@/components/global/PageChrome";
import { apiFetch } from "@/lib/api/http";
const DirectoryAppSchema = z.object({
id: z.string(),
name: z.string(),
description: z.string(),
category: z.string(),
connected: z.boolean(),
});
// The global Apps directory (§8.2): workspace-wide connections.
export default async function AppsPage() {
const apps = await apiFetch(
z.array(DirectoryAppSchema),
"/api/apps?workspace=true",
);
return (
<PageChrome
title="Apps"
description="Connect the tools your claws can use. Connections here are available to your whole workspace."
>
<AppsDirectory apps={apps} />
</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("/");
}
@@ -12,13 +12,16 @@ export default async function ClawHome({
searchParams,
}: {
params: Promise<{ clawId: string }>;
searchParams: Promise<{ app?: string }>;
searchParams: Promise<{ app?: string; embed?: string }>;
}) {
const { clawId } = await params;
const { app } = await searchParams;
const { app, embed } = await searchParams;
const sessions = await fetchSessions(clawId);
const target = sessions[0] ?? (await createSession(clawId));
const suffix = app ? `?app=${encodeURIComponent(app)}` : "";
const q = new URLSearchParams();
if (app) q.set("app", app);
if (embed) q.set("embed", embed); // keep the chrome-less flag for in-dashboard chat
const suffix = q.toString() ? `?${q.toString()}` : "";
redirect(
`/claws/${clawId}/chat/${encodeSessionKeyParam(target.sessionKey)}${suffix}`,
);
@@ -1,6 +1,8 @@
import { StructureCanvas } from "@/components/structure/StructureCanvas";
import { redirect } from "next/navigation";
export default async function CompanyPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
return <StructureCanvas level="company" id={id} />;
// Retired: the org / company / team structure browser now lives in the
// integrated dashboard at "/" (the new interface). Kept as a redirect so old
// links and bookmarks land in the right place.
export default function Page() {
redirect("/");
}
@@ -1,63 +1,8 @@
"use client";
import { redirect } from "next/navigation";
import { useEffect, useState } from "react";
import Link from "next/link";
interface GroupSummary {
id: string;
name: string;
kind: string;
status: string;
}
export default function CompaniesPage() {
const [companies, setCompanies] = useState<GroupSummary[]>([]);
useEffect(() => {
void (async () => {
try {
const r = await fetch("/api/companies");
if (r.ok) setCompanies((await r.json()) as GroupSummary[]);
} catch {
/* ignore */
}
})();
}, []);
return (
<div className="mx-auto flex w-full max-w-3xl flex-col gap-4 p-6">
<div className="flex items-center justify-between">
<h1 className="text-xl font-semibold tracking-tight">Companies</h1>
<Link
href="/claws/new"
className="rounded-full bg-coral px-4 py-2 text-sm font-medium text-white"
>
Deploy a company
</Link>
</div>
{companies.length === 0 ? (
<p className="text-sm text-muted-foreground">
No companies yet a company is a topology of teams.
</p>
) : (
<ul className="flex flex-col gap-2">
{companies.map((c) => (
<li key={c.id}>
<Link
href={`/companies/${c.id}`}
className="flex items-center gap-3 rounded-lg border border-border p-3 hover:bg-muted/30"
>
<span className="text-sm font-medium text-foreground">{c.name}</span>
<span className="rounded-full bg-muted px-2 py-0.5 text-xs capitalize text-muted-foreground">
{c.kind}
</span>
<span className="text-xs text-muted-foreground">{c.status}</span>
</Link>
</li>
))}
</ul>
)}
</div>
);
// Retired: the org / company / team structure browser now lives in the
// integrated dashboard at "/" (the new interface). Kept as a redirect so old
// links and bookmarks land in the right place.
export default function Page() {
redirect("/");
}
+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("/");
}
@@ -1,6 +1,8 @@
import { StructureCanvas } from "@/components/structure/StructureCanvas";
import { redirect } from "next/navigation";
export default async function OrgPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
return <StructureCanvas level="org" id={id} />;
// Retired: the org / company / team structure browser now lives in the
// integrated dashboard at "/" (the new interface). Kept as a redirect so old
// links and bookmarks land in the right place.
export default function Page() {
redirect("/");
}
+6 -61
View File
@@ -1,63 +1,8 @@
"use client";
import { redirect } from "next/navigation";
import { useEffect, useState } from "react";
import Link from "next/link";
interface GroupSummary {
id: string;
name: string;
kind: string;
status: string;
}
export default function OrgsPage() {
const [orgs, setOrgs] = useState<GroupSummary[]>([]);
useEffect(() => {
void (async () => {
try {
const r = await fetch("/api/orgs");
if (r.ok) setOrgs((await r.json()) as GroupSummary[]);
} catch {
/* ignore */
}
})();
}, []);
return (
<div className="mx-auto flex w-full max-w-3xl flex-col gap-4 p-6">
<div className="flex items-center justify-between">
<h1 className="text-xl font-semibold tracking-tight">Organizations</h1>
<Link
href="/claws/new"
className="rounded-full bg-coral px-4 py-2 text-sm font-medium text-white"
>
Deploy an org
</Link>
</div>
{orgs.length === 0 ? (
<p className="text-sm text-muted-foreground">
No organizations yet an org is a topology of companies.
</p>
) : (
<ul className="flex flex-col gap-2">
{orgs.map((o) => (
<li key={o.id}>
<Link
href={`/orgs/${o.id}`}
className="flex items-center gap-3 rounded-lg border border-border p-3 hover:bg-muted/30"
>
<span className="text-sm font-medium text-foreground">{o.name}</span>
<span className="rounded-full bg-muted px-2 py-0.5 text-xs capitalize text-muted-foreground">
{o.kind}
</span>
<span className="text-xs text-muted-foreground">{o.status}</span>
</Link>
</li>
))}
</ul>
)}
</div>
);
// Retired: the org / company / team structure browser now lives in the
// integrated dashboard at "/" (the new interface). Kept as a redirect so old
// links and bookmarks land in the right place.
export default function Page() {
redirect("/");
}
+8 -4
View File
@@ -3,17 +3,21 @@ import { redirect } from "next/navigation";
import { Dashboard } from "@/components/dashboard/Dashboard";
import { ApiAuthError } from "@/lib/api/http";
import { fetchMe } from "@/lib/api/team";
import type { User } from "@/lib/api/schemas";
import { loadWorkspace } from "@/lib/dashboard-data";
import type { Agent, User } from "@/lib/api/schemas";
import type { DemoOrg } from "@/lib/dashboard-demo";
// Workspace home = the integrated dashboard (tier rail → topology canvas →
// agent computer slide-out).
// agent computer slide-out), now driven by the live workspace (real claws +
// org/company/team structure).
export default async function WorkspaceHome() {
let user: User;
let workspace: { orgs: DemoOrg[]; claws: Agent[] };
try {
user = await fetchMe();
[user, workspace] = await Promise.all([fetchMe(), loadWorkspace()]);
} catch (error) {
if (error instanceof ApiAuthError) redirect("/login");
throw error;
}
return <Dashboard user={{ display_name: user.display_name, email: user.email }} />;
return <Dashboard user={{ display_name: user.display_name, email: user.email }} orgs={workspace.orgs} claws={workspace.claws} />;
}
+6 -48
View File
@@ -1,50 +1,8 @@
import { z } from "zod";
import { redirect } from "next/navigation";
import { PageChrome } from "@/components/global/PageChrome";
import { apiFetch } from "@/lib/api/http";
import { Card } from "@/components/ui/Card";
const SkillSchema = z.object({
id: z.string().uuid(),
title: z.string(),
author: z.string(),
description: z.string(),
installs: z.number(),
});
// The Skill Library (§8.1): catalog + workspace skills, two-column cards.
export default async function SkillsPage() {
const skills = await apiFetch(z.array(SkillSchema), "/api/skills");
return (
<PageChrome
title="Skill Library"
description="Browse skills published by your team and the catalog. Install them on a claw from its Computer → Skills app."
>
{skills.length === 0 ? (
<p className="text-sm text-muted-foreground">
No skills published yet.
</p>
) : (
<ul className="grid grid-cols-1 gap-4 sm:grid-cols-2">
{skills.map((skill) => (
<li key={skill.id}>
<Card className="h-full">
<p className="text-lg font-semibold">{skill.title}</p>
<p className="text-xxs text-muted-foreground">
by {skill.author}
</p>
<p className="pt-3 text-xs text-muted-foreground">
{skill.description}
</p>
<p className="pt-4 text-xxs text-muted-foreground">
{skill.installs}{" "}
{skill.installs === 1 ? "install" : "installs"} on your team
</p>
</Card>
</li>
))}
</ul>
)}
</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("/");
}
+6 -26
View File
@@ -1,28 +1,8 @@
import { PageChrome } from "@/components/global/PageChrome";
import { TeamTabs } from "@/components/global/TeamTabs";
import {
fetchLeaderboard,
fetchMembers,
fetchOrgChart,
} from "@/lib/api/team";
import { redirect } from "next/navigation";
// Team page (§8.3): members, the claw org chart, and the usage leaderboard.
export default async function TeamPage() {
const [members, orgchart, leaderboard] = await Promise.all([
fetchMembers(),
fetchOrgChart(),
fetchLeaderboard(),
]);
return (
<PageChrome
title="Team"
description={`${members.length} ${members.length === 1 ? "member" : "members"} in your workspace`}
>
<TeamTabs
members={members}
orgchart={orgchart}
leaderboard={leaderboard}
/>
</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("/");
}
@@ -1,6 +1,8 @@
import { StructureCanvas } from "@/components/structure/StructureCanvas";
import { redirect } from "next/navigation";
export default async function TeamPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
return <StructureCanvas level="team" id={id} />;
// Retired: the org / company / team structure browser now lives in the
// integrated dashboard at "/" (the new interface). Kept as a redirect so old
// links and bookmarks land in the right place.
export default function Page() {
redirect("/");
}
+6 -62
View File
@@ -1,64 +1,8 @@
"use client";
import { redirect } from "next/navigation";
import { useEffect, useState } from "react";
import Link from "next/link";
interface TeamSummary {
id: string;
name: string;
kind: string;
status: string;
created_at: string;
}
export default function TeamsPage() {
const [teams, setTeams] = useState<TeamSummary[]>([]);
useEffect(() => {
void (async () => {
try {
const r = await fetch("/api/teams");
if (r.ok) setTeams((await r.json()) as TeamSummary[]);
} catch {
/* ignore */
}
})();
}, []);
return (
<div className="mx-auto flex w-full max-w-3xl flex-col gap-4 p-6">
<div className="flex items-center justify-between">
<h1 className="text-xl font-semibold tracking-tight">Teams</h1>
<Link
href="/claws/new"
className="rounded-full bg-coral px-4 py-2 text-sm font-medium text-white"
>
Deploy a team
</Link>
</div>
{teams.length === 0 ? (
<p className="text-sm text-muted-foreground">
No teams yet deploy a baseline topology staffed with claws.
</p>
) : (
<ul className="flex flex-col gap-2">
{teams.map((t) => (
<li key={t.id}>
<Link
href={`/teams/${t.id}`}
className="flex items-center gap-3 rounded-lg border border-border p-3 hover:bg-muted/30"
>
<span className="text-sm font-medium text-foreground">{t.name}</span>
<span className="rounded-full bg-muted px-2 py-0.5 text-xs capitalize text-muted-foreground">
{t.kind}
</span>
<span className="text-xs text-muted-foreground">{t.status}</span>
</Link>
</li>
))}
</ul>
)}
</div>
);
// Retired: the org / company / team structure browser now lives in the
// integrated dashboard at "/" (the new interface). Kept as a redirect so old
// links and bookmarks land in the right place.
export default function Page() {
redirect("/");
}
@@ -1,16 +1,8 @@
import { PageChrome } from "@/components/global/PageChrome";
import { TopologyWorkbench } from "@/components/topology/TopologyWorkbench";
import { fetchTopologyCatalog } from "@/lib/api/topology";
import { redirect } from "next/navigation";
// Topologies page: browse the catalog and build/visualize a topology.
export default async function TopologiesPage() {
const catalog = await fetchTopologyCatalog();
return (
<PageChrome
title="Topologies"
description={`${catalog.length} organizational patterns to run your agents in`}
>
<TopologyWorkbench catalog={catalog} />
</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("/");
}