Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
Gateway: the Overview page counts agents, users and rooms (CHOO-4077) (#1838)
Christian McDermottd5004d3d789d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 229ed7fef..376254f8f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -260,6 +260,11 @@ version of their own to them without also giving them a release of their own.being built, so turn it on for development and staging only. With it off,the dashboard is laid out as before, and the new URLs lead back to today'spages.+- **The new layout's Overview counts the workspace's agents, users and+ rooms.** Each card opens its list, and View graph opens the ecosystem+ graph, which leaves the new rail. A workspace's admins see its totals; a+ member sees the agents they own and the rooms they take part in, marked+ "Yours", and every user. A count that cannot be read shows a dash and why.- **The gateway says what the caller may do with every object it shows**, sono page works a permission out for itself. Alongside the room, template andagent flags already there:@@ -847,6 +852,12 @@ version of their own to them without also giving them a release of their own.token again; revocation is still checked on every request.#### Fixed+- **A room's detail says whether the caller takes part in it, and whether+ it is a Switch Console chat.** The gateway's `GET /rooms/{id}`, and the+ room it returns from a create or change, always answered+ `viewer_is_member: false` and `is_console_chat: false`, so Console's room+ settings named a Console chat's messaging app "None". Both now say what+ the room list says.- **`!list-documents` and `!list-references` answer again.** Since they beganlisting what a room's packages bring, both failed on the admin client thatruns them, and the channel got no answer at all.diff --git a/core/switch_core/gateway/rooms.py b/core/switch_core/gateway/rooms.pyindex 4bca3d88d..cd946a6e2 100644--- a/core/switch_core/gateway/rooms.py+++ b/core/switch_core/gateway/rooms.py@@ -255,6 +255,8 @@ async def _build_room_detail(write_visibility=room.write_visibility,created_at=str(room.created_at),archived=room.archived_at is not None,+ viewer_is_member=takes_part,+ is_console_chat=_is_console_chat(room),transport_room_id=room.transport_room_id,matrix_room_id=room.transport_room_id,external_channel_id=room.external_channel_id,@@ -283,6 +285,11 @@ async def _build_room_detail()+def _is_console_chat(room: Room) -> bool:+ """Whether `room` is a Switch Console chat, made through the chats API."""+ return "chat_operation_id" in (room.metadata_ or {})++def _can_change_members(principal: Principal, room: Room) -> bool:"""Whether `principal` may add and remove the room's agents and peoplethrough these routes: write access, unless it is a direct or group@@ -452,7 +459,7 @@ async def list_rooms(created_at=str(room.created_at),archived=room.archived_at is not None,viewer_is_member=room.id in involved,- is_console_chat="chat_operation_id" in (room.metadata_ or {}),+ is_console_chat=_is_console_chat(room),can_write=can(principal, "write", room),can_manage=can(principal, "delete", room),can_unlink=can_unlink_from_room(diff --git a/core/tests/switch_core/gateway/test_room_detail_access.py b/core/tests/switch_core/gateway/test_room_detail_access.pyindex 598c01ebf..2c0b388f0 100644--- a/core/tests/switch_core/gateway/test_room_detail_access.py+++ b/core/tests/switch_core/gateway/test_room_detail_access.py@@ -16,17 +16,21 @@ from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmakerfrom switch_core.bridges.resource.service import ResourceServicefrom switch_core.db.models import Room, Userfrom switch_core.db.stores.agent_store import AgentStore+from switch_core.db.stores.collaboration_bridge_store import CollaborationBridgeStorefrom switch_core.db.stores.decision_settings_store import DecisionSettingsStorefrom switch_core.db.stores.document_store import DocumentStore+from switch_core.db.stores.external_user_store import ExternalUserStorefrom switch_core.db.stores.package_store import PackageStorefrom switch_core.db.stores.reference_store import ReferenceStorefrom switch_core.db.stores.reference_type_store import ReferenceTypeStore+from switch_core.db.stores.room_group_store import RoomGroupStorefrom switch_core.db.stores.room_link_store import RoomLinkStorefrom switch_core.db.stores.room_role_store import RoomRoleStorefrom switch_core.db.stores.room_store import RoomStorefrom switch_core.db.stores.user_store import UserStorefrom switch_core.decision.settings import DecisionAvailability, ServerDefault-from switch_core.gateway.rooms import get_room+from switch_core.gateway.rooms import get_room, list_rooms+from switch_core.gateway.schemas import RoomSummary_ROOM_STORE = RoomStore()_USER_STORE = UserStore()@@ -110,3 +114,76 @@ class TestRoomDetailOwner:assert detail.owner_id == owner.idassert detail.owner_name == "owner"+++class TestDetailMatchesList:+ """A room's detail carries every field of its list entry with the same+ value. Clients read the two interchangeably: Console's room settings read+ `is_console_chat` from the detail, and the Overview's member counts and+ the lists narrow by `viewer_is_member`."""++ async def _detail_and_summary(+ self, session: AsyncSession, room: Room, viewer: User, is_admin: bool+ ) -> tuple[dict[str, object], dict[str, object]]:+ detail = await get_room(+ room.id,+ session,+ _ROOM_STORE,+ None, # type: ignore[arg-type] # bridge_store: the room has no bridge+ None, # type: ignore[arg-type] # external_user_store+ _protocol(),+ _NO_DECISIONS,+ viewer,+ is_admin,+ )+ listed = await list_rooms(+ session,+ _ROOM_STORE,+ RoomGroupStore(),+ CollaborationBridgeStore(),+ ExternalUserStore(),+ _USER_STORE,+ viewer,+ is_admin,+ )+ summary = next(r for r in listed if r.id == room.id)+ return detail.model_dump(+ include=set(RoomSummary.model_fields)+ ), summary.model_dump()++ async def test_the_detail_says_what_the_list_says_to_each_viewer(+ self, session_factory: async_sessionmaker[AsyncSession]+ ) -> None:+ async with session_factory() as session:+ owner = await _add_user(session, name="owner")+ reader = await _add_user(session, name="reader")+ admin = await _add_user(session, name="admin")+ room = await _add_room(+ session, name="r1", owner_id=owner.id, read_visibility="public"+ )++ for viewer, is_admin, takes_part in [+ (owner, False, True),+ (reader, False, False),+ (admin, True, False),+ ]:+ detail, summary = await self._detail_and_summary(+ session, room, viewer, is_admin+ )+ assert detail == summary+ assert detail["viewer_is_member"] is takes_part++ async def test_the_detail_names_a_console_chat(+ self, session_factory: async_sessionmaker[AsyncSession]+ ) -> None:+ async with session_factory() as session:+ owner = await _add_user(session, name="owner")+ chat = await _add_room(session, name="chat", owner_id=owner.id)+ chat.metadata_ = {"chat_operation_id": "op-1"}+ await session.flush()++ detail, summary = await self._detail_and_summary(+ session, chat, owner, False+ )+ assert detail == summary+ assert detail["is_console_chat"] is Truediff --git a/gateway/src/App.test.tsx b/gateway/src/App.test.tsxindex d38b9b80f..e0b6ce790 100644--- a/gateway/src/App.test.tsx+++ b/gateway/src/App.test.tsx@@ -423,7 +423,6 @@ describe("the new layout (gateway_v2)", () => {"Rooms","Templates","Resources",- "Ecosystem","Settings",]);});diff --git a/gateway/src/data/api.ts b/gateway/src/data/api.tsindex 11c7a0f42..28daddabb 100644--- a/gateway/src/data/api.ts+++ b/gateway/src/data/api.ts@@ -37,6 +37,9 @@ export interface RoomSummary {write_visibility: "public" | "private";created_at: string;archived: boolean;+ // The viewer takes part in it: owns it, is in it (in Switch Console or+ // through a platform account they claimed), or owns an agent in it.+ viewer_is_member: boolean;// What the viewer may do, as the server decides it. `can_write` covers the// room's settings, roles, links and attaching resources;// `can_change_members` covers adding and removing its agents and people,@@ -384,6 +387,12 @@ export async function fetchRooms(return fetchJson<RoomSummary[]>(`/rooms${q ? `?${q}` : ""}`);}+/** The rooms the Rooms list opens on (archived ones left out), throwing+ * rather than answering null so a failure can say why. */+export async function loadRooms(): Promise<RoomSummary[]> {+ return jsonRequest<RoomSummary[]>("/rooms", "GET");+}+export async function fetchRoom(roomId: string): Promise<RoomDetail | null> {return fetchJson<RoomDetail>(`/rooms/${roomId}`);}@@ -692,6 +701,12 @@ export async function fetchAgents(): Promise<AgentSummary[] | null> {return fetchJson<AgentSummary[]>("/agents");}+/** The agents the Agents list shows, throwing rather than answering null so+ * a failure can say why. */+export async function loadAgents(): Promise<AgentSummary[]> {+ return jsonRequest<AgentSummary[]>("/agents", "GET");+}+export async function fetchAgent(agentId: string): Promise<AgentDetail | null> {return fetchJson<AgentDetail>(`/agents/${agentId}`);}diff --git a/gateway/src/data/listScope.test.ts b/gateway/src/data/listScope.test.tsnew file mode 100644index 000000000..729c29c0e--- /dev/null+++ b/gateway/src/data/listScope.test.ts@@ -0,0 +1,77 @@+import { describe, expect, it } from "vitest";+import type { AgentSummary, CurrentTenant, RoomSummary, Session } from "./api";+import { capabilitiesOf } from "./capabilities";+import { ALL_OFF } from "./featureFlags";+import { agentsInScope, listScopeOf, roomsInScope } from "./listScope";++function capabilities(administers: boolean, isOperator = false) {+ const tenant = {+ id: "t1",+ slug: "acme",+ name: "Acme",+ role: "member" as const,+ organization_role: null,+ organization_id: null,+ };+ const session: Session = {+ user: { id: "u1", name: "Ada", email: "[email protected]", is_operator: isOperator },+ tenant,+ tenants: [tenant],+ state: "ready",+ can_create_workspace: false,+ can_add_workspace: false,+ invite_email_enabled: false,+ };+ const current: CurrentTenant = {+ id: "t1",+ slug: "acme",+ name: "Acme",+ role: "member",+ administers,+ can_delete: false,+ can_manage_data_protection: false,+ };+ return capabilitiesOf(session, current, ALL_OFF);+}++const agent = (id: string, ownerId: string | null, parentId: string | null = null) =>+ ({ id, owner_id: ownerId, parent_agent_id: parentId }) as unknown as AgentSummary;++const room = (id: string, viewerIsMember: boolean) =>+ ({ id, viewer_is_member: viewerIsMember }) as unknown as RoomSummary;++describe("listScopeOf", () => {+ it("shows whoever administers the workspace all of it, and a member their own", () => {+ expect(listScopeOf(capabilities(true))).toBe("workspace");+ expect(listScopeOf(capabilities(false))).toBe("yours");+ });++ it("goes by what the server says about administering, the operator included", () => {+ // The server's `administers` already counts the operator bit.+ expect(listScopeOf(capabilities(true, true))).toBe("workspace");+ });+});++describe("agentsInScope", () => {+ const agents = [agent("a1", "u1"), agent("a2", "u1", "a1"), agent("b1", "u2"), agent("c1", null)];++ it("keeps every agent for the workspace", () => {+ expect(agentsInScope(agents, "workspace", "u1")).toHaveLength(4);+ });++ it("keeps a member's own agents, their sub-agents included", () => {+ expect(agentsInScope(agents, "yours", "u1").map((a) => a.id)).toEqual(["a1", "a2"]);+ });+});++describe("roomsInScope", () => {+ const rooms = [room("r1", true), room("r2", false)];++ it("keeps every room for the workspace", () => {+ expect(roomsInScope(rooms, "workspace")).toHaveLength(2);+ });++ it("keeps the rooms a member takes part in", () => {+ expect(roomsInScope(rooms, "yours").map((r) => r.id)).toEqual(["r1"]);+ });+});diff --git a/gateway/src/data/listScope.ts b/gateway/src/data/listScope.tsnew file mode 100644index 000000000..6be888b13--- /dev/null+++ b/gateway/src/data/listScope.ts@@ -0,0 +1,33 @@+import type { AgentSummary, RoomSummary } from "./api";+import type { Capabilities } from "./capabilities";++/** How much of the workspace's agents and rooms someone is shown: all of+ * them to whoever administers it, and to a member only their own. The+ * Overview counts and the Agents and Rooms lists narrow by the same rule, so+ * a count is the number of rows its list shows. Users is never narrowed:+ * everyone in a workspace may see who else is in it. */+export type ListScope = "workspace" | "yours";++export function listScopeOf(caps: Capabilities): ListScope {+ return caps.administersWorkspace ? "workspace" : "yours";+}++/** A member's agents are the ones they own. A sub-agent is owned by whoever+ * added it, so theirs are counted with them. */+export function agentsInScope(+ agents: readonly AgentSummary[],+ scope: ListScope,+ userId: string,+): readonly AgentSummary[] {+ return scope === "workspace" ? agents : agents.filter((agent) => agent.owner_id === userId);+}++/** A member's rooms are the ones they take part in, as the server reports+ * it: they own the room, are in it, or own an agent in it. A public room+ * they only read is the workspace's, not theirs. */+export function roomsInScope(+ rooms: readonly RoomSummary[],+ scope: ListScope,+): readonly RoomSummary[] {+ return scope === "workspace" ? rooms : rooms.filter((room) => room.viewer_is_member);+}diff --git a/gateway/src/pages/overview/OverviewPage.test.tsx b/gateway/src/pages/overview/OverviewPage.test.tsxnew file mode 100644index 000000000..30f80b146--- /dev/null+++ b/gateway/src/pages/overview/OverviewPage.test.tsx@@ -0,0 +1,180 @@+import { cleanup, render, screen, waitFor, within } from "@testing-library/react";+import { MemoryRouter } from "react-router";+import { afterEach, describe, expect, it, vi } from "vitest";+import type { AgentSummary, Member, RoomSummary, Session } from "../../data/api";+import { useAuth } from "../../data/AuthContext";+import { capabilitiesOf } from "../../data/capabilities";+import { ALL_OFF } from "../../data/featureFlags";+import OverviewPage from "./OverviewPage";++vi.mock("../../data/AuthContext", () => ({ useAuth: vi.fn() }));++type Role = "member" | "workspace_admin" | "org_admin";++/** Ada, signed in to Acme as `role`. An organization admin holds only a+ * member's row here and administers it through the organization. */+function signedInAs(role: Role) {+ const tenant = {+ id: "t1",+ slug: "acme",+ name: "Acme",+ role: role === "workspace_admin" ? ("admin" as const) : ("member" as const),+ organization_role: role === "org_admin" ? ("org_admin" as const) : ("member" as const),+ organization_id: "o1",+ };+ const session: Session = {+ user: { id: "u1", name: "Ada", email: "[email protected]", is_operator: false },+ tenant,+ tenants: [tenant],+ state: "ready",+ can_create_workspace: false,+ can_add_workspace: false,+ invite_email_enabled: false,+ };+ vi.mocked(useAuth).mockReturnValue({+ session,+ capabilities: capabilitiesOf(+ session,+ {+ id: "t1",+ slug: "acme",+ name: "Acme",+ role: tenant.role,+ administers: role !== "member",+ can_delete: false,+ can_manage_data_protection: false,+ },+ ALL_OFF,+ ),+ } as unknown as ReturnType<typeof useAuth>);+}++const agent = (id: string, ownerId: string, parentId: string | null = null) =>+ ({ id, name: id, owner_id: ownerId, parent_agent_id: parentId }) as unknown as AgentSummary;++const room = (id: string, viewerIsMember: boolean) =>+ ({ id, name: id, archived: false, viewer_is_member: viewerIsMember }) as unknown as RoomSummary;++const member = (userId: string, viaOrganization = false) =>+ ({ user_id: userId, name: userId, via_organization: viaOrganization }) as unknown as Member;++/** Ada owns two agents (one a sub-agent) of four, and takes part in two+ * rooms of three. The workspace has two members and an org admin who is+ * there only through the organization. */+const WORKSPACE: Record<string, [number, unknown]> = {+ "/agents": [+ 200,+ [agent("a1", "u1"), agent("a2", "u1", "a1"), agent("b1", "u2"), agent("b2", "u2")],+ ],+ "/rooms": [200, [room("r1", true), room("r2", true), room("r3", false)]],+ "/tenants/t1/members": [200, [member("u1"), member("u2"), member("u3", true)]],+};++function answer(routes: Record<string, [number, unknown]>) {+ vi.stubGlobal(+ "fetch",+ vi.fn(async (input: RequestInfo | URL) => {+ const path = String(input).replace(/^\/gateway/, "").split("?")[0];+ const [status, body] = routes[path] ?? [404, { detail: `unmocked ${path}` }];+ return new Response(JSON.stringify(body), { status });+ }),+ );+}++function renderPage() {+ render(+ <MemoryRouter>+ <OverviewPage />+ </MemoryRouter>,+ );+}++function card(label: string): HTMLElement {+ return screen.getByRole("link", { name: new RegExp(`^${label}`) });+}++/** Each card's count once every one has loaded. */+async function counts(): Promise<Record<string, string>> {+ await waitFor(() => expect(screen.queryAllByRole("progressbar")).toHaveLength(0));+ return Object.fromEntries(+ ["Agents", "Users", "Rooms"].map((label) => [+ label,+ card(label).querySelector("p")?.textContent ?? "",+ ]),+ );+}++describe("OverviewPage", () => {+ afterEach(() => {+ cleanup();+ vi.unstubAllGlobals();+ });++ it("shows a workspace admin the workspace's totals", async () => {+ signedInAs("workspace_admin");+ answer(WORKSPACE);+ renderPage();+ expect(await counts()).toEqual({ Agents: "4", Users: "3", Rooms: "3" });+ expect(screen.queryByText("Yours")).toBeNull();+ });++ it("shows an organization admin the totals of a workspace they administer through it", async () => {+ signedInAs("org_admin");+ answer(WORKSPACE);+ renderPage();+ expect(await counts()).toEqual({ Agents: "4", Users: "3", Rooms: "3" });+ });++ it("shows a member their own agents and rooms, sub-agents included, and every user", async () => {+ signedInAs("member");+ answer(WORKSPACE);+ renderPage();+ expect(await counts()).toEqual({ Agents: "2", Users: "3", Rooms: "2" });+ expect(within(card("Agents")).getByText("Yours")).toBeTruthy();+ expect(within(card("Rooms")).getByText("Yours")).toBeTruthy();+ expect(within(card("Users")).queryByText("Yours")).toBeNull();+ });++ it("shows a dash and the reason for a count it could not read, never 0", async () => {+ signedInAs("workspace_admin");+ answer({ ...WORKSPACE, "/agents": [500, { detail: "database unavailable" }] });+ renderPage();+ expect(await counts()).toEqual({ Agents: "—", Users: "3", Rooms: "3" });+ expect(+ within(card("Agents")).getByText("Couldn't count agents: database unavailable"),+ ).toBeTruthy();+ });++ it("reads the counts again when the role changes while the page is open", async () => {+ signedInAs("member");+ // A member is not listed the private rooms they take no part in.+ answer({ ...WORKSPACE, "/rooms": [200, [room("r1", true), room("r2", true)]] });+ const page = () => (+ <MemoryRouter>+ <OverviewPage />+ </MemoryRouter>+ );+ const { rerender } = render(page());+ expect(await counts()).toEqual({ Agents: "2", Users: "3", Rooms: "2" });++ signedInAs("workspace_admin");+ answer(WORKSPACE);+ rerender(page());+ await waitFor(async () =>+ expect(await counts()).toEqual({ Agents: "4", Users: "3", Rooms: "3" }),+ );+ });++ it("opens each list from its card, and the graph from the page", async () => {+ signedInAs("member");+ answer(WORKSPACE);+ renderPage();+ await counts();+ expect(card("Agents").getAttribute("href")).toBe("/agents");+ expect(card("Users").getAttribute("href")).toBe("/settings/users");+ expect(card("Rooms").getAttribute("href")).toBe("/rooms");+ expect(screen.getByRole("link", { name: "View graph" }).getAttribute("href")).toBe(+ "/ecosystem",+ );+ });+});diff --git a/gateway/src/pages/overview/OverviewPage.tsx b/gateway/src/pages/overview/OverviewPage.tsxnew file mode 100644index 000000000..29e0ecdcf--- /dev/null+++ b/gateway/src/pages/overview/OverviewPage.tsx@@ -0,0 +1,157 @@+import AccountTreeOutlined from "@mui/icons-material/AccountTreeOutlined";+import ChevronRight from "@mui/icons-material/ChevronRight";+import {+ Box,+ Button,+ Card,+ CardActionArea,+ CircularProgress,+ Stack,+ Typography,+} from "@mui/material";+import { useCallback } from "react";+import { Link as RouterLink } from "react-router";+import { useAuth } from "../../data/AuthContext";+import { fetchMembers, loadAgents, loadRooms } from "../../data/api";+import { type ListScope, agentsInScope, listScopeOf, roomsInScope } from "../../data/listScope";+import { EM_DASH } from "../../theme/hootFormat";+import { useLoad } from "../workspace/useLoad";++interface Count {+ value: number | null;+ loading: boolean;+ error: string | null;+}++/** One count, and the way into the list behind it. A count that could not be+ * read shows a dash and the reason, never a 0 that would read as "none". */+function CountCard({+ label,+ to,+ count,+ caption,+}: {+ label: string;+ to: string;+ count: Count;+ caption: string | null;+}) {+ return (+ <Card sx={{ flex: "1 1 200px", minWidth: 200 }}>+ <CardActionArea component={RouterLink} to={to} sx={{ height: "100%", p: 2 }}>+ <Stack direction="row" alignItems="center" justifyContent="space-between">+ <Typography component="span" variant="subtitle1" sx={{ fontWeight: 600 }}>+ {label}+ </Typography>+ <ChevronRight fontSize="small" sx={{ color: "text.secondary" }} />+ </Stack>+ {count.loading ? (+ <Box sx={{ py: 0.75 }}>+ <CircularProgress size={24} aria-label={`Counting ${label.toLowerCase()}`} />+ </Box>+ ) : (+ <Typography+ component="p"+ variant="h1"+ className="tabular"+ sx={{ color: count.value === null ? "text.secondary" : "text.primary" }}+ >+ {count.value === null ? EM_DASH : count.value.toLocaleString("en-US")}+ </Typography>+ )}+ {count.error !== null ? (+ <Typography variant="body2" sx={{ color: "error.main" }}>+ Couldn't count {label.toLowerCase()}: {count.error}+ </Typography>+ ) : (+ caption !== null && (+ <Typography variant="body2" sx={{ color: "text.secondary" }}>+ {caption}+ </Typography>+ )+ )}+ </CardActionArea>+ </Card>+ );+}++function countOf<T>(+ loaded: { data: T | null; loading: boolean; error: string | null },+ count: (data: T) => number,+): Count {+ return {+ value: loaded.data === null || loaded.error !== null ? null : count(loaded.data),+ loading: loaded.loading,+ error: loaded.error,+ };+}++/** The three counts, each read from what its list page reads and narrowed by+ * the same rule, so a card and its list agree. */+function Counts({+ tenantId,+ userId,+ scope,+}: {+ tenantId: string;+ userId: string;+ scope: ListScope;+}) {+ const agents = useLoad(loadAgents);+ const rooms = useLoad(loadRooms);+ const loadMembers = useCallback(() => fetchMembers(tenantId), [tenantId]);+ const members = useLoad(loadMembers);+ const caption = scope === "yours" ? "Yours" : null;++ return (+ <Stack direction="row" useFlexGap sx={{ flexWrap: "wrap", gap: 3 }}>+ <CountCard+ label="Agents"+ to="/agents"+ caption={caption}+ count={countOf(agents, (data) => agentsInScope(data, scope, userId).length)}+ />+ <CountCard+ label="Users"+ to="/settings/users"+ caption={null}+ count={countOf(members, (data) => data.length)}+ />+ <CountCard+ label="Rooms"+ to="/rooms"+ caption={caption}+ count={countOf(rooms, (data) => roomsInScope(data, scope).length)}+ />+ </Stack>+ );+}++/** The workspace at a glance: how many agents, users and rooms it has, or,+ * for a member, how many agents and rooms are theirs. */+export default function OverviewPage() {+ const { session, capabilities } = useAuth();+ const tenant = session?.tenant;+ if (!session || !tenant) return <CircularProgress />;+ // A role can change while the page is open (the session is read again when+ // the tab comes back), and the server lists an admin rooms it hides from a+ // member, so the counts are read again under the new scope.+ const scope = listScopeOf(capabilities);++ return (+ <Box>+ <Stack direction="row" alignItems="center" justifyContent="space-between" mb={3}>+ <Typography variant="h5">Overview</Typography>+ <Button+ component={RouterLink}+ to="/ecosystem"+ variant="outlined"+ startIcon={<AccountTreeOutlined />}+ >+ View graph+ </Button>+ </Stack>+ <Counts key={scope} tenantId={tenant.id} userId={session.user.id} scope={scope} />+ </Box>+ );+}diff --git a/gateway/src/pages/rooms/RoomDetailPage.test.tsx b/gateway/src/pages/rooms/RoomDetailPage.test.tsxindex ba2190551..e3c12f8b3 100644--- a/gateway/src/pages/rooms/RoomDetailPage.test.tsx+++ b/gateway/src/pages/rooms/RoomDetailPage.test.tsx@@ -65,6 +65,7 @@ const room = {write_visibility: "public",created_at: "2026-10-01T00:00:00Z",archived: false,+ viewer_is_member: false,transport_room_id: "!r1:example.test",matrix_room_id: "!r1:example.test",external_channel_id: null,diff --git a/gateway/src/routes/routeTable.tsx b/gateway/src/routes/routeTable.tsxindex ac9579485..07efb3455 100644--- a/gateway/src/routes/routeTable.tsx+++ b/gateway/src/routes/routeTable.tsx@@ -46,6 +46,7 @@ import OrganizationPage, {OrganizationUsersPage,OrganizationWorkspacesPage,} from "../pages/organization/OrganizationPage";+import OverviewPage from "../pages/overview/OverviewPage";import RegistrationKeysPage from "../pages/registration-keys/RegistrationKeysPage";import DocumentDetailPage from "../pages/resources/DocumentDetailPage";import PackageDetailPage from "../pages/resources/PackageDetailPage";@@ -165,7 +166,7 @@ const orgConnectors = allOf(organizationAdminsOnly, serviceConnections, organizaexport const ROUTES: readonly AppRoute[] = [redirect("/", CURRENT, "/rooms"),redirect("/", V2, "/overview"),- page("/overview", V2, everyone, <PlannedPage title="Overview" />),+ page("/overview", V2, everyone, <OverviewPage />),redirect("/overview", CURRENT, "/"),page("/ecosystem", BOTH, everyone, <EcosystemGraphPage />),@@ -406,15 +407,16 @@ export const RAIL: Record<Layout, readonly RailItem[]> = {railItem("Users", "/users", PeopleOutlined),railItem("Connectors", "/connectors", PowerOutlined),],- // Ecosystem keeps a rail item until Overview links to the graph.+ // The ecosystem graph is opened from Overview, which shows as current there.v2: [- railItem("Overview", "/overview", DashboardOutlined),+ railItem("Overview", "/overview", DashboardOutlined, {+ activeFor: ["/overview", "/ecosystem"],+ }),railItem("Agents", "/agents", SmartToyOutlined),railItem("Rooms", "/rooms", MeetingRoomOutlined),railItem("Templates", "/templates", DescriptionOutlined),railItem("Connectors", "/connectors", PowerOutlined),railItem("Resources", "/resources", FolderOutlined),- railItem("Ecosystem", "/ecosystem", AccountTreeOutlined),railItem("Settings", "/settings", SettingsOutlined, {activeFor: ["/settings", "/usage"],bottom: true,