Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(society): a building clicked on the island opens its own card - the building in 3D, and what it does

rubenluetke10-beepbe88664540a4
diff --git a/jarvis/ui/web/frontend/src/components/society/card/BuildingCardOverlay.tsx b/jarvis/ui/web/frontend/src/components/society/card/BuildingCardOverlay.tsx
new file mode 100644
index 0000000000..86ed727d8c
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/card/BuildingCardOverlay.tsx
@@ -0,0 +1,167 @@
+/**
+ * The building card: what opens when a building on the island is clicked,
+ * the way an agent's card opens for a figure (maintainer, 2026-09-02).
+ *
+ * Two columns under one header. Left, the building itself, turned by hand,
+ * in the island's own look (BuildingViewer — the same GLB and toon ramp the
+ * map draws). Right, the explanation: what it does, how a person uses it,
+ * and — for a hub — what stands inside it right now, loaded from the same
+ * endpoints the hub drawer reads, so nothing is invented. The footer opens
+ * the app section the building stands for; the Foundry's also creates an
+ * agent.
+ *
+ * Same window as the agent card: inset over the world, the world still
+ * visible through the scrim, Esc and ✕ close.
+ */
+import * as Dialog from "@radix-ui/react-dialog";
+import { useQuery } from "@tanstack/react-query";
+import { ExternalLink, Plus, X } from "lucide-react";
+
+import { Badge } from "@/components/ui/badge";
+import { Button } from "@/components/ui/button";
+import { ScrollArea } from "@/components/ui/scroll-area";
+import { useLocaleChunk, useT } from "@/i18n";
+import { useEventStore } from "@/store/events";
+
+import { BuildingViewer } from "../figures/BuildingViewer";
+import { HUBS } from "../world/HubDrawer";
+import { BUILDING_CARDS, type BuildingPlace } from "./buildingCards";
+
+export interface BuildingCardOverlayProps {
+ place: BuildingPlace | null;
+ onClose: () => void;
+ /** The Foundry's card creates an agent through the section's creator. */
+ onCreateAgent?: () => void;
+}
+
+export function BuildingCardOverlay({ place, onClose, onCreateAgent }: BuildingCardOverlayProps) {
+ const t = useT();
+ const ready = useLocaleChunk("society");
+ const setActiveSection = useEventStore((s) => s.setActiveSection);
+ const card = place ? BUILDING_CARDS[place] : null;
+ const hub = card?.hub ? HUBS[card.hub] : null;
+ const inside = useQuery({
+ queryKey: ["society", "hub", card?.hub ?? ""],
+ queryFn: hub?.load ?? (async () => []),
+ enabled: Boolean(hub?.load) && place !== null,
+ staleTime: 60_000,
+ });
+ const total = inside.data ? inside.data.reduce((n, g) => n + g.items.length, 0) : 0;
+ const open = card !== null && ready;
+
+ return (
+ <Dialog.Root open={open} onOpenChange={(next) => (next ? undefined : onClose())}>
+ <Dialog.Portal>
+ <Dialog.Overlay className="fixed inset-0 z-40 bg-scrim/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-reduce:animate-none" />
+ <Dialog.Content
+ data-testid="building-card"
+ className="fixed inset-4 z-50 flex flex-col overflow-hidden rounded-lg border border-border bg-card shadow-float focus:outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 motion-reduce:animate-none lg:inset-10"
+ >
+ {card ? (
+ <>
+ <header className="flex shrink-0 items-center gap-3 border-b border-border px-5 py-3">
+ <div className="min-w-0 flex-1">
+ <Dialog.Title className="truncate font-display text-base font-semibold tracking-tight text-foreground">
+ {t(`society.world.${card.nameKey}`)}
+ </Dialog.Title>
+ <Dialog.Description className="truncate text-xs text-muted-foreground">
+ {t(`society.world.${card.taglineKey}`)}
+ </Dialog.Description>
+ </div>
+ <Badge variant="outline">{t("society.world.card_kind_building")}</Badge>
+ <Dialog.Close
+ aria-label={t("society.world.drawer_close")}
+ className="rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-strong"
+ >
+ <X className="h-4 w-4" aria-hidden />
+ </Dialog.Close>
+ </header>
+
+ <div className="grid min-h-0 flex-1 grid-cols-[minmax(360px,1.35fr)_minmax(300px,1fr)]">
+ {/* ---- left: the building, live ---- */}
+ <section className="relative min-h-0 border-r border-border" aria-label={t(`society.world.${card.nameKey}`)}>
+ <BuildingViewer model={card.model} />
+ </section>
+
+ {/* ---- right: what it does, how to use it, what is inside ---- */}
+ <section className="flex min-h-0 flex-col" aria-label={t("society.world.card_does_title")}>
+ <ScrollArea className="min-h-0 flex-1">
+ <div className="flex flex-col gap-5 p-5">
+ <div>
+ <h3 className="mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground">
+ {t("society.world.card_does_title")}
+ </h3>
+ <p className="text-sm leading-relaxed text-foreground">{t(`society.world.${card.doesKey}`)}</p>
+ </div>
+ <div>
+ <h3 className="mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground">
+ {t("society.world.card_how_title")}
+ </h3>
+ <p className="text-sm leading-relaxed text-foreground">{t(`society.world.${card.howKey}`)}</p>
+ </div>
+ {hub?.load ? (
+ <div data-testid="building-card-inside">
+ <h3 className="mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground">
+ {t("society.world.card_inside_title")}
+ </h3>
+ {inside.isLoading ? (
+ <p className="text-sm text-muted-foreground">{t("society.world.drawer_loading")}</p>
+ ) : inside.isError ? (
+ <p className="text-sm text-destructive">{String(inside.error)}</p>
+ ) : total === 0 ? (
+ <p className="text-sm text-muted-foreground">{t("society.world.drawer_empty")}</p>
+ ) : (
+ inside.data
+ ?.filter((g) => g.items.length > 0)
+ .map((g) => (
+ <div key={g.labelKey} className="mb-3">
+ <h4 className="mb-1.5 flex items-center gap-2 text-xs font-medium text-muted-foreground">
+ <span className="inline-block h-2.5 w-2.5 rounded-sm" style={{ background: g.color }} aria-hidden />
+ {t(`society.world.${g.labelKey}`)}
+ <span className="tabular-nums">{g.items.length}</span>
+ </h4>
+ <ul className="flex flex-wrap gap-1.5">
+ {g.items.map((n) => (
+ <li key={n} className="rounded-md bg-secondary px-2 py-1 font-mono text-xs text-foreground">
+ {n}
+ </li>
+ ))}
+ </ul>
+ </div>
+ ))
+ )}
+ </div>
+ ) : null}
+ </div>
+ </ScrollArea>
+ <footer className="flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-3">
+ {card.builds && onCreateAgent ? (
+ <Button type="button" size="sm" onClick={onCreateAgent} data-testid="building-card-create">
+ <Plus className="mr-1.5 h-3.5 w-3.5" aria-hidden />
+ {t("society.world.card_create_agent")}
+ </Button>
+ ) : null}
+ <Button
+ type="button"
+ variant="secondary"
+ size="sm"
+ onClick={() => {
+ setActiveSection(card.section);
+ onClose();
+ }}
+ >
+ <ExternalLink className="mr-1.5 h-3.5 w-3.5" aria-hidden />
+ {t("society.world.card_open_section")}
+ </Button>
+ </footer>
+ </section>
+ </div>
+ </>
+ ) : null}
+ </Dialog.Content>
+ </Dialog.Portal>
+ </Dialog.Root>
+ );
+}
+
+export default BuildingCardOverlay;
diff --git a/jarvis/ui/web/frontend/src/components/society/card/buildingCards.ts b/jarvis/ui/web/frontend/src/components/society/card/buildingCards.ts
new file mode 100644
index 0000000000..9ab6ad1296
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/card/buildingCards.ts
@@ -0,0 +1,102 @@
+/**
+ * What a building on the island IS, for its card: which model to draw, the
+ * strings that name and explain it, the app section it stands for, and — for
+ * a hub — whose live contents the card lists (HubDrawer's loaders, so the
+ * card and the drawer never disagree about what is installed).
+ *
+ * Only places with a model of their own have a card: the five kit hubs and
+ * the Memory House. The rest of the island is scenery (islandLayout.PlaceId).
+ */
+import type { SectionId } from "@/store/events";
+
+import type { BuildingModelId } from "../figures/BuildingViewer";
+import type { KitPlace, PlaceId } from "../world/islandLayout";
+
+export type BuildingPlace = KitPlace | "archive";
+
+export interface BuildingCard {
+ place: BuildingPlace;
+ model: BuildingModelId;
+ /** `society.world.<key>` — the place's name, the same the map label shows. */
+ nameKey: string;
+ /** `society.world.<key>` — one line on what it stands for (the drawer's hint). */
+ taglineKey: string;
+ /** `society.world.<key>` — what it does, a paragraph. */
+ doesKey: string;
+ /** `society.world.<key>` — how a person uses it, a paragraph. */
+ howKey: string;
+ /** The app section this building stands for. */
+ section: SectionId;
+ /** The hub whose live contents the card lists; null for a building that lists nothing. */
+ hub: KitPlace | null;
+ /** The Foundry builds agents: its card offers the creator. */
+ builds?: boolean;
+}
+
+export const BUILDING_CARDS: Record<BuildingPlace, BuildingCard> = {
+ plugins: {
+ place: "plugins",
+ model: "plugin-docks",
+ nameKey: "place_plugins",
+ taglineKey: "drawer_plugins_hint",
+ doesKey: "card_plugins_does",
+ howKey: "card_plugins_how",
+ section: "plugins",
+ hub: "plugins",
+ },
+ foundry: {
+ place: "foundry",
+ model: "agent-foundry",
+ nameKey: "place_foundry",
+ taglineKey: "drawer_foundry_hint",
+ doesKey: "card_foundry_does",
+ howKey: "card_foundry_how",
+ section: "agents",
+ hub: null,
+ builds: true,
+ },
+ skills: {
+ place: "skills",
+ model: "skill-forge",
+ nameKey: "place_skills",
+ taglineKey: "drawer_skills_hint",
+ doesKey: "card_skills_does",
+ howKey: "card_skills_how",
+ section: "skills",
+ hub: "skills",
+ },
+ mcp: {
+ place: "mcp",
+ model: "relay-tower",
+ nameKey: "place_mcp",
+ taglineKey: "drawer_mcp_hint",
+ doesKey: "card_mcp_does",
+ howKey: "card_mcp_how",
+ section: "mcps",
+ hub: "mcp",
+ },
+ cli: {
+ place: "cli",
+ model: "terminal-cantina",
+ nameKey: "place_cli",
+ taglineKey: "drawer_cli_hint",
+ doesKey: "card_cli_does",
+ howKey: "card_cli_how",
+ section: "clis",
+ hub: "cli",
+ },
+ archive: {
+ place: "archive",
+ model: "memory-house",
+ nameKey: "place_archive",
+ taglineKey: "drawer_memory_hint",
+ doesKey: "card_archive_does",
+ howKey: "card_archive_how",
+ section: "memory",
+ hub: null,
+ },
+};
+
+export function isBuildingPlace(place: PlaceId): place is BuildingPlace {
+ return place in BUILDING_CARDS;
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/figures/BuildingViewer.tsx b/jarvis/ui/web/frontend/src/components/society/figures/BuildingViewer.tsx
new file mode 100644
index 0000000000..a0568dcbf4
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/figures/BuildingViewer.tsx
@@ -0,0 +1,298 @@
+/**
+ * The building card's stage: one island building, turned by hand, in the
+ * island's own look — its GLB restyled to the world's toon ramp, the world's
+ * sky behind it, a patch of the island's grass under it — so the card shows
+ * the very building that stands on the map, not a render of something else.
+ *
+ * Drag turns it and tilts the camera (never under the ground), the wheel
+ * zooms, a double-click resets, and it turns slowly on its own while nobody
+ * touches it (not under `prefers-reduced-motion`). The camera frames the
+ * model by its bounding sphere, so a tower and a wide hall both fit.
+ *
+ * Mounts through `useWebglSurface` (AP-32) and renders only while on screen
+ * (`useCanvasAwake`), like every other society canvas.
+ */
+import { Component, Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react";
+import type { ErrorInfo, PointerEvent as ReactPointerEvent, ReactNode, WheelEvent } from "react";
+import { Canvas, useFrame, useThree } from "@react-three/fiber";
+import { useGLTF } from "@react-three/drei";
+import { useReducedMotion } from "framer-motion";
+import * as THREE from "three";
+import * as SkeletonUtils from "three/examples/jsm/utils/SkeletonUtils.js";
+
+import memoryHouseUrl from "@/assets/society/world/kit/memory-house.glb";
+import { useCanvasAwake } from "@/hooks/useCanvasAwake";
+import { useWebglSurface } from "@/hooks/useWebglSurface";
+import { useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+
+import { KIT_URLS, restyle, type KitId } from "../world/KitBuilding";
+import { createToonRamp } from "../world/worldMaterials";
+import { SKY, TILE_COLORS } from "../world/worldPalette";
+import { TileKind } from "../world/islandLayout";
+
+/** Every model a card can show: the five kit hubs and the Memory House. */
+export type BuildingModelId = KitId | "memory-house";
+
+const MODEL_URLS: Record<BuildingModelId, string> = {
+ ...KIT_URLS,
+ "memory-house": memoryHouseUrl,
+};
+
+const PITCH_MIN = (6 * Math.PI) / 180;
+const PITCH_MAX = (70 * Math.PI) / 180;
+const ZOOM_MIN = 0.6;
+const ZOOM_MAX = 2.2;
+const FOV = 30;
+/** Slow idle turn, radians per second. */
+const IDLE_TURN = 0.12;
+const REST_VIEW = { yaw: -0.7, pitch: 0.42, zoom: 1 };
+
+interface OrbitState {
+ yaw: number;
+ pitch: number;
+ zoom: number;
+}
+
+export interface BuildingViewerProps {
+ model: BuildingModelId;
+ className?: string;
+}
+
+export function BuildingViewer({ model, className }: BuildingViewerProps) {
+ const t = useT();
+ const hostRef = useRef<HTMLDivElement>(null);
+ const { generation } = useWebglSurface(hostRef);
+ const awake = useCanvasAwake(hostRef);
+ const reduced = useReducedMotion() ?? false;
+ const orbit = useRef<OrbitState>({ ...REST_VIEW });
+ const [orbitTick, setOrbitTick] = useState(0);
+ const drag = useRef<{ x: number; y: number; id: number } | null>(null);
+ // The idle turn pauses while a hand is on it and for a moment after.
+ const touchedAt = useRef(0);
+
+ const onPointerDown = useCallback((e: ReactPointerEvent<HTMLDivElement>) => {
+ if (e.button !== 0) return;
+ drag.current = { x: e.clientX, y: e.clientY, id: e.pointerId };
+ touchedAt.current = performance.now();
+ e.currentTarget.setPointerCapture(e.pointerId);
+ }, []);
+ const onPointerMove = useCallback((e: ReactPointerEvent<HTMLDivElement>) => {
+ const d = drag.current;
+ if (!d || d.id !== e.pointerId) return;
+ const dx = e.clientX - d.x;
+ const dy = e.clientY - d.y;
+ d.x = e.clientX;
+ d.y = e.clientY;
+ const o = orbit.current;
+ o.yaw += dx * 0.01;
+ o.pitch = Math.max(PITCH_MIN, Math.min(PITCH_MAX, o.pitch + dy * 0.008));
+ touchedAt.current = performance.now();
+ setOrbitTick((n) => n + 1);
+ }, []);
+ const onPointerUp = useCallback((e: ReactPointerEvent<HTMLDivElement>) => {
+ if (drag.current?.id === e.pointerId) drag.current = null;
+ }, []);
+ const onWheel = useCallback((e: WheelEvent<HTMLDivElement>) => {
+ const o = orbit.current;
+ o.zoom = Math.max(ZOOM_MIN, Math.min(ZOOM_MAX, o.zoom * (1 - e.deltaY * 0.0012)));
+ touchedAt.current = performance.now();
+ setOrbitTick((n) => n + 1);
+ }, []);
+ const onDoubleClick = useCallback(() => {
+ orbit.current = { ...REST_VIEW };
+ setOrbitTick((n) => n + 1);
+ }, []);
+
+ const frameloop = awake && !reduced ? "always" : "demand";
+
+ return (
+ <div
+ ref={hostRef}
+ data-testid="building-viewer"
+ className={cn(
+ "relative h-full min-h-0 w-full select-none overflow-hidden touch-none",
+ drag.current ? "cursor-grabbing" : "cursor-grab",
+ className,
+ )}
+ // The island's own sky, not the app's room: the building is shown as
+ // it stands on the map (worldPalette, nothing inside reads a token).
+ style={{ background: `linear-gradient(180deg, ${SKY.clear} 0%, ${SKY.hemiSky} 100%)` }}
+ onPointerDown={onPointerDown}
+ onPointerMove={onPointerMove}
+ onPointerUp={onPointerUp}
+ onPointerCancel={onPointerUp}
+ onWheel={onWheel}
+ onDoubleClick={onDoubleClick}
+ >
+ <ViewerErrorBoundary fallback={<Unavailable label={t("society.world.card_unavailable")} />}>
+ <Canvas
+ key={generation}
+ dpr={1}
+ flat
+ frameloop={frameloop}
+ gl={{ antialias: true, alpha: true, powerPreference: "low-power" }}
+ camera={{ fov: FOV, near: 0.5, far: 400, position: [0, 20, 60] }}
+ onCreated={({ gl }) => {
+ gl.setClearColor(0x000000, 0);
+ }}
+ >
+ <hemisphereLight args={[SKY.hemiSky, SKY.hemiGround, SKY.hemiIntensity]} />
+ <directionalLight position={[40, 70, 30]} intensity={0.9 * Math.PI} color="#fff6e0" />
+ <Suspense fallback={null}>
+ <BuildingScene
+ model={model}
+ orbit={orbit}
+ orbitTick={orbitTick}
+ idle={!reduced && awake}
+ touchedAt={touchedAt}
+ />
+ </Suspense>
+ <HostSizeSync />
+ </Canvas>
+ </ViewerErrorBoundary>
+ <p className="pointer-events-none absolute inset-x-0 bottom-2 text-center text-xs text-[#2f4a2a]/80">
+ {reduced ? t("society.world.card_reduced_motion") : t("society.world.card_drag_hint")}
+ </p>
+ </div>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// the scene: the restyled GLB on a patch of grass, camera framed by its bounds
+// ---------------------------------------------------------------------------
+
+function BuildingScene({
+ model,
+ orbit,
+ orbitTick,
+ idle,
+ touchedAt,
+}: {
+ model: BuildingModelId;
+ orbit: { current: OrbitState };
+ orbitTick: number;
+ idle: boolean;
+ touchedAt: { current: number };
+}) {
+ const { scene } = useGLTF(MODEL_URLS[model]);
+ const camera = useThree((s) => s.camera);
+ const invalidate = useThree((s) => s.invalidate);
+ const groupRef = useRef<THREE.Group>(null);
+ const ramp = useMemo(createToonRamp, []);
+ const instance = useMemo(() => {
+ const clone = SkeletonUtils.clone(scene);
+ restyle(clone, ramp);
+ return clone;
+ }, [scene, ramp]);
+
+ useEffect(
+ () => () => {
+ instance.traverse((o) => {
+ if (o instanceof THREE.Mesh) (o.material as THREE.Material).dispose();
+ });
+ ramp.dispose();
+ },
+ [instance, ramp],
+ );
+
+ // The building's footprint and reach decide the ground patch and the camera.
+ const bounds = useMemo(() => {
+ const box = new THREE.Box3().setFromObject(instance);
+ const size = box.getSize(new THREE.Vector3());
+ const centre = box.getCenter(new THREE.Vector3());
+ const radius = Math.max(size.x, size.z) * 0.5;
+ return { size, centre, radius, top: box.max.y, bottom: box.min.y };
+ }, [instance]);
+
+ const place = useCallback(() => {
+ const o = orbit.current;
+ const group = groupRef.current;
+ if (group) group.rotation.y = o.yaw;
+ // The sphere that holds the whole model, seen through the vertical fov.
+ const sphere = Math.hypot(bounds.radius, bounds.size.y * 0.5) * 1.12;
+ const distance = (sphere / Math.sin((FOV * Math.PI) / 360)) / o.zoom;
+ const mid = bounds.size.y * 0.42;
+ camera.position.set(0, mid + Math.sin(o.pitch) * distance, Math.cos(o.pitch) * distance);
+ camera.lookAt(0, mid, 0);
+ camera.updateProjectionMatrix();
+ }, [bounds, camera, orbit]);
+
+ useEffect(() => {
+ place();
+ invalidate();
+ }, [place, orbitTick, invalidate]);
+
+ useFrame((_, dt) => {
+ if (!idle) return;
+ if (performance.now() - touchedAt.current < 2500) return;
+ orbit.current.yaw += IDLE_TURN * Math.min(dt, 0.1);
+ place();
+ });
+
+ const grass = TILE_COLORS[TileKind.grass];
+ const patchR = bounds.radius * 1.6;
+
+ return (
+ <group ref={groupRef}>
+ {/* the model, centred on its footprint and set on the ground */}
+ <primitive object={instance} position={[-bounds.centre.x, -bounds.bottom, -bounds.centre.z]} />
+ {/* the patch of island under it: a grass top over an earth side */}
+ <mesh position={[0, -0.6, 0]}>
+ <cylinderGeometry args={[patchR, patchR * 0.92, 1.2, 40]} />
+ <meshToonMaterial attach="material-0" color={grass.side} gradientMap={ramp} />
+ <meshToonMaterial attach="material-1" color={grass.top[0]} gradientMap={ramp} />
+ <meshToonMaterial attach="material-2" color={grass.side} gradientMap={ramp} />
+ </mesh>
+ </group>
+ );
+}
+
+/** Keeps the renderer sized to its container (see AgentFigureViewer for why). */
+function HostSizeSync() {
+ const gl = useThree((s) => s.gl);
+ const setSize = useThree((s) => s.setSize);
+ const invalidate = useThree((s) => s.invalidate);
+ useEffect(() => {
+ const wrapper = gl.domElement.parentElement;
+ if (!wrapper || typeof ResizeObserver === "undefined") return;
+ const sync = () => {
+ const rect = wrapper.getBoundingClientRect();
+ if (rect.width > 0 && rect.height > 0) {
+ setSize(rect.width, rect.height);
+ invalidate();
+ }
+ };
+ sync();
+ const observer = new ResizeObserver(sync);
+ observer.observe(wrapper);
+ return () => observer.disconnect();
+ }, [gl, setSize, invalidate]);
+ return null;
+}
+
+function Unavailable({ label }: { label: string }) {
+ return (
+ <div className="flex h-full w-full items-center justify-center p-6">
+ <p className="max-w-[28ch] text-center text-xs text-muted-foreground">{label}</p>
+ </div>
+ );
+}
+
+class ViewerErrorBoundary extends Component<{ fallback: ReactNode; children: ReactNode }, { failed: boolean }> {
+ state = { failed: false };
+
+ static getDerivedStateFromError(): { failed: boolean } {
+ return { failed: true };
+ }
+
+ componentDidCatch(error: Error, info: ErrorInfo): void {
+ console.warn("[society] building viewer fell back:", error.message, info.componentStack);
+ }
+
+ render(): ReactNode {
+ return this.state.failed ? this.props.fallback : this.props.children;
+ }
+}
+
+export default BuildingViewer;
diff --git a/jarvis/ui/web/frontend/src/components/society/world/HubDrawer.tsx b/jarvis/ui/web/frontend/src/components/society/world/HubDrawer.tsx
index e1ff630a04..52f3bf8d5f 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/HubDrawer.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/HubDrawer.tsx
@@ -13,14 +13,14 @@ import { useT } from "@/i18n";
import { useEventStore, type SectionId } from "@/store/events";
import type { KitPlace } from "./islandLayout";
-interface Group {
+export interface Group {
/** Locale key suffix under `society.world.` */
labelKey: string;
color: string;
items: string[];
}
-interface HubConfig {
+export interface HubConfig {
titleKey: string;
hintKey: string;
section: SectionId;
@@ -46,7 +46,8 @@ async function getJson<T>(url: string): Promise<T> {
return (await res.json()) as T;
}
-const HUBS: Record<KitPlace, HubConfig> = {
+/** Per hub: strings, section and the loader — shared with the building card. */
+export const HUBS: Record<KitPlace, HubConfig> = {
plugins: {
titleKey: "drawer_plugins_title",
hintKey: "drawer_plugins_hint",
diff --git a/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx b/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx
index ebd313588f..5b805eaa25 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx
@@ -55,7 +55,12 @@ export const KIT_PLACEMENTS: ReadonlyArray<{ kit: KitId; place: KitPlace }> = [
/** Emission above this strength renders unlit (a lamp, a neon tube), below it stays a lit toon. */
const GLOW_STRENGTH = 1.5;
-function restyle(root: Object3D, ramp: ReturnType<typeof createToonRamp>): void {
+/**
+ * Restyle a kit GLB's Standard materials to the island's toon ramp. Shared
+ * with the building card's viewer, so a building looks the same on its card
+ * as on the island.
+ */
+export function restyle(root: Object3D, ramp: ReturnType<typeof createToonRamp>): void {
root.traverse((o) => {
if (!(o instanceof Mesh)) return;
const src = o.material as MeshStandardMaterial;
diff --git a/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx b/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx
index 7de27debad..fa64670f57 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx
@@ -67,11 +67,17 @@ export interface WorldStageProps {
onOpenLedger: () => void;
/** A figure was clicked (or the selection cleared). The model card hooks in here. */
onSelectAgent?: (agentId: string | null) => void;
+ /**
+ * A building with a card of its own was clicked (the kit hubs, the Memory
+ * House). When set, the building card opens instead of the drawer — the
+ * society view hooks in here; standalone, the drawers stay.
+ */
+ onSelectPlace?: (place: PlaceId) => void;
}
const CAMERA_START = cameraOffset();
-export function WorldStage({ topRight, onOpenLedger, onSelectAgent }: WorldStageProps) {
+export function WorldStage({ topRight, onOpenLedger, onSelectAgent, onSelectPlace }: WorldStageProps) {
const t = useT();
const ready = useLocaleChunk("society");
const hostRef = useRef<HTMLDivElement>(null);
@@ -171,6 +177,12 @@ export function WorldStage({ topRight, onOpenLedger, onSelectAgent }: WorldStage
paused={reduced}
onHubClick={(p) => {
setQuestOpen(false);
+ if (onSelectPlace && (isKitPlace(p) || p === "archive")) {
+ setOpenHub(null);
+ setMemoryOpen(false);
+ onSelectPlace(p);
+ return;
+ }
if (p === "archive") {
setOpenHub(null);
setMemoryOpen((cur) => !cur);
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
index 5670888372..fb5bed6965 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
@@ -34,6 +34,27 @@
"drawer_plugins_title": "Plugin-Docks",
"drawer_plugins_hint": "Alle in dieser App installierten Plugins, nach Familie. Ein Agent geht hierher, wenn sein Lauf auf ein Plugin setzt.",
"drawer_open_section": "Bereich Plugins öffnen",
+ "card_kind_building": "Gebäude",
+ "card_does_title": "Was es macht",
+ "card_how_title": "So nutzt du es",
+ "card_inside_title": "Gerade drin",
+ "card_open_section": "Bereich öffnen",
+ "card_create_agent": "Agent erstellen",
+ "card_drag_hint": "Ziehen zum Drehen · Rad zum Zoomen · Doppelklick setzt zurück",
+ "card_reduced_motion": "Reduzierte Bewegung: Ziehen dreht",
+ "card_unavailable": "Das Gebäude kann in diesem Fenster nicht gezeichnet werden.",
+ "card_plugins_does": "Die Plugin Docks beherbergen jedes Plugin, das in dieser App installiert ist — Gehirne, Werkzeuge, Sprache, Kanäle, Realtime, Weckwörter und Harnesses — nach Familie sortiert. Ein Agent geht hierher, sobald ein Lauf auf eines davon setzt.",
+ "card_plugins_how": "Plugins installierst oder entfernst du im Bereich Plugins; jeder Agent darf standardmäßig alle nutzen. Sag einem Agenten in seinem Chat, zu welchem Plugin er zuerst greifen soll.",
+ "card_foundry_does": "In der Agent Foundry entstehen neue Agenten. Ein frisch gebauter Agent tritt aus dem Portal und läuft hinunter zum Platz, um sich dem Team anzuschließen.",
+ "card_foundry_how": "Erstelle einen Agenten hier oder über „Neu“ in der Agentenleiste: Name, Bezeichnung, Beschreibung und der Sitz, auf dem er läuft. Alles Weitere sagst du ihm in seinem eigenen Chat.",
+ "card_skills_does": "Die Skill Forge bewahrt jeden Skill, den diese App kennt — eingebaute, deine eigenen und Entwürfe, die noch Form annehmen. Ein Skill ist ein wiederverwendbarer Ablauf, den ein Agent per Slash-Befehl ausführt.",
+ "card_skills_how": "Skills schreibst oder bearbeitest du im Bereich Skills; ein Agent kann auch aus einem Chat heraus einen entwerfen. Ein Entwurf bleibt Entwurf, bis du ihn freigibst.",
+ "card_mcp_does": "Der Relay Tower erreicht die MCP-Server, mit denen diese App verbunden ist — externe Werkzeuge, die ein Agent aufrufen kann. Die Schüssel dreht sich, solange ein Agent einen Aufruf macht.",
+ "card_mcp_how": "Server fügst du im Bereich MCPs hinzu oder entfernst sie dort. Jeder Agent erreicht jeden verbundenen Server.",
+ "card_cli_does": "In der Terminal Cantina sitzen die Coding-CLIs — Claude Code, Codex, Grok Build und die anderen — mit ihren Subscription-Logins. Ein Agent sitzt hier an einem Terminal, solange eine Coding-Sitzung läuft.",
+ "card_cli_how": "Verbinde ein CLI oder melde dich im Bereich CLIs bei einer Subscription an. Ein Agent kann dann auf diesem Sitz laufen statt über einen API-Key.",
+ "card_archive_does": "Das Memory House ist das gemeinsame Gedächtnis des Teams: geprüftes Teamwissen, das eigene Gedächtnis jedes Agenten und die Prüfliste. Ein Agent geht hierher, wenn er sich erinnert oder etwas nachschlägt.",
+ "card_archive_how": "Lies und ordne das Gedächtnis im Bereich Memory. Ein Fakt, den ein Agent vorschlägt, wartet in der Prüfliste, bis du ihn annimmst.",
"drawer_close": "Schließen",
"place_quests": "Questtafel",
"hud_quests": "Quests",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
index f8bcc2d120..e3ab37d660 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
@@ -34,6 +34,27 @@
"drawer_plugins_title": "Plugin Docks",
"drawer_plugins_hint": "Every plugin installed in this app, by family. An agent walks here when its run leans on a plugin.",
"drawer_open_section": "Open the Plugins section",
+ "card_kind_building": "Building",
+ "card_does_title": "What it does",
+ "card_how_title": "How to use it",
+ "card_inside_title": "Inside right now",
+ "card_open_section": "Open the section",
+ "card_create_agent": "Create an agent",
+ "card_drag_hint": "Drag to turn · wheel to zoom · double-click to reset",
+ "card_reduced_motion": "Reduced motion: drag to turn",
+ "card_unavailable": "The building cannot be drawn in this window.",
+ "card_plugins_does": "The Plugin Docks hold every plugin installed in this app — brains, tools, speech, channels, realtime, wake words and harnesses — sorted by family. An agent walks here whenever a run leans on one.",
+ "card_plugins_how": "Install or remove plugins in the Plugins section; every agent can use all of them by default. Tell an agent in its chat which plugin to reach for first.",
+ "card_foundry_does": "The Agent Foundry is where new agents are made. A freshly built agent steps out of the portal and walks down to the square to join the team.",
+ "card_foundry_how": "Create an agent here or with “New” in the agents rail: a name, a title, a description and the seat it runs on. Everything else you tell it in its own chat.",
+ "card_skills_does": "The Skill Forge keeps every skill this app knows — built-in ones, your own, and drafts still being shaped. A skill is a reusable procedure an agent runs with a slash command.",
+ "card_skills_how": "Write or edit skills in the Skills section; an agent can also draft one from a chat. A draft stays a draft until you approve it.",
+ "card_mcp_does": "The Relay Tower reaches the MCP servers this app is connected to — outside tools an agent can call. The dish turns while an agent is on a call.",
+ "card_mcp_how": "Add or remove servers in the MCPs section. Every agent can reach every connected server.",
+ "card_cli_does": "The Terminal Cantina seats the coding CLIs — Claude Code, Codex, Grok Build and the others — with their subscription logins. An agent sits at a terminal here while a coding session runs.",
+ "card_cli_how": "Connect a CLI or sign in to a subscription in the CLIs section. An agent can then run on that seat instead of an API key.",
+ "card_archive_does": "The Memory House is the team's shared memory: reviewed team knowledge, every agent's own memory and the review queue. An agent walks here when it remembers or looks something up.",
+ "card_archive_how": "Read and tidy the memory in the Memory section. A fact an agent proposes waits in the review queue until you accept it.",
"drawer_close": "Close",
"place_quests": "Quest Board",
"hud_quests": "Quests",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
index e92afe3726..12776eefff 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
@@ -34,6 +34,27 @@
"drawer_plugins_title": "Muelles de Plugins",
"drawer_plugins_hint": "Todos los plugins instalados en esta app, por familia. Un agente viene aquí cuando su tarea depende de un plugin.",
"drawer_open_section": "Abrir la sección Plugins",
+ "card_kind_building": "Edificio",
+ "card_does_title": "Qué hace",
+ "card_how_title": "Cómo usarlo",
+ "card_inside_title": "Dentro ahora mismo",
+ "card_open_section": "Abrir la sección",
+ "card_create_agent": "Crear un agente",
+ "card_drag_hint": "Arrastra para girar · rueda para acercar · doble clic para restablecer",
+ "card_reduced_motion": "Movimiento reducido: arrastra para girar",
+ "card_unavailable": "El edificio no se puede dibujar en esta ventana.",
+ "card_plugins_does": "Los Plugin Docks albergan cada plugin instalado en esta app — cerebros, herramientas, voz, canales, realtime, palabras de activación y harnesses — ordenados por familia. Un agente viene aquí cuando una ejecución se apoya en uno.",
+ "card_plugins_how": "Instala o quita plugins en la sección Plugins; todos los agentes pueden usarlos todos por defecto. Dile a un agente en su chat qué plugin debe usar primero.",
+ "card_foundry_does": "En la Agent Foundry nacen los agentes nuevos. Un agente recién construido sale del portal y baja a la plaza para unirse al equipo.",
+ "card_foundry_how": "Crea un agente aquí o con «Nuevo» en la barra de agentes: nombre, título, descripción y el asiento en el que corre. Todo lo demás se lo dices en su propio chat.",
+ "card_skills_does": "La Skill Forge guarda cada skill que conoce esta app — las integradas, las tuyas y los borradores que aún toman forma. Un skill es un procedimiento reutilizable que un agente ejecuta con un comando de barra.",
+ "card_skills_how": "Escribe o edita skills en la sección Skills; un agente también puede redactar uno desde un chat. Un borrador sigue siendo borrador hasta que lo apruebas.",
+ "card_mcp_does": "La Relay Tower alcanza los servidores MCP a los que esta app está conectada — herramientas externas que un agente puede llamar. La antena gira mientras un agente está en una llamada.",
+ "card_mcp_how": "Añade o quita servidores en la sección MCPs. Todos los agentes alcanzan todos los servidores conectados.",
+ "card_cli_does": "En la Terminal Cantina se sientan las CLIs de programación — Claude Code, Codex, Grok Build y las demás — con sus inicios de sesión de suscripción. Un agente se sienta aquí en un terminal mientras corre una sesión de código.",
+ "card_cli_how": "Conecta una CLI o inicia sesión en una suscripción en la sección CLIs. Un agente puede entonces correr en ese asiento en lugar de con una clave API.",
+ "card_archive_does": "La Memory House es la memoria compartida del equipo: conocimiento revisado, la memoria propia de cada agente y la cola de revisión. Un agente viene aquí cuando recuerda o consulta algo.",
+ "card_archive_how": "Lee y ordena la memoria en la sección Memory. Un hecho que propone un agente espera en la cola de revisión hasta que lo aceptas.",
"drawer_close": "Cerrar",
"place_quests": "Tablón de misiones",
"hud_quests": "Misiones",
diff --git a/jarvis/ui/web/frontend/src/i18n/society-i18n-parity.test.ts b/jarvis/ui/web/frontend/src/i18n/society-i18n-parity.test.ts
index 56c1febc13..ae0d15d29d 100644
--- a/jarvis/ui/web/frontend/src/i18n/society-i18n-parity.test.ts
+++ b/jarvis/ui/web/frontend/src/i18n/society-i18n-parity.test.ts
@@ -11,6 +11,11 @@ import { describe, expect, it } from "vitest";
import en from "./locales/en.json";
import de from "./locales/de.json";
import es from "./locales/es.json";
+// The island's strings live in the lazy `society` chunk (world README); a
+// key may come from either file, and the chunk mirrors across locales too.
+import enWorld from "./locales/society/en.json";
+import deWorld from "./locales/society/de.json";
+import esWorld from "./locales/society/es.json";
function flatten(obj: Record<string, unknown>, prefix = ""): string[] {
const out: string[] = [];
@@ -25,10 +30,14 @@ function flatten(obj: Record<string, unknown>, prefix = ""): string[] {
return out;
}
-function blockKeys(loc: Record<string, unknown>): Set<string> {
- const sub = loc.society;
- if (!sub || typeof sub !== "object") return new Set();
- return new Set(flatten(sub as Record<string, unknown>, "society"));
+function blockKeys(...locs: Record<string, unknown>[]): Set<string> {
+ const out = new Set<string>();
+ for (const loc of locs) {
+ const sub = loc.society;
+ if (!sub || typeof sub !== "object") continue;
+ for (const k of flatten(sub as Record<string, unknown>, "society")) out.add(k);
+ }
+ return out;
}
const SRC = join(__dirname, "..");
@@ -57,7 +66,7 @@ function usedKeys(): { literal: Set<string>; prefixes: Set<string> } {
}
describe("society i18n parity", () => {
- const enKeys = blockKeys(en as Record<string, unknown>);
+ const enKeys = blockKeys(en as Record<string, unknown>, enWorld as Record<string, unknown>);
it("en carries a society block", () => {
expect(enKeys.size).toBeGreaterThan(20);
@@ -79,11 +88,11 @@ describe("society i18n parity", () => {
});
it("de and es carry exactly the society keys en carries", () => {
- for (const [name, loc] of [
- ["de", de],
- ["es", es],
+ for (const [name, loc, world] of [
+ ["de", de, deWorld],
+ ["es", es, esWorld],
] as const) {
- const keys = blockKeys(loc as Record<string, unknown>);
+ const keys = blockKeys(loc as Record<string, unknown>, world as Record<string, unknown>);
const missing = [...enKeys].filter((k) => !keys.has(k));
const extra = [...keys].filter((k) => !enKeys.has(k));
expect({ locale: name, missing, extra }).toEqual({ locale: name, missing: [], extra: [] });
diff --git a/jarvis/ui/web/frontend/src/views/JarvisAgentsView.tsx b/jarvis/ui/web/frontend/src/views/JarvisAgentsView.tsx
index b90e2c97ff..c5f5592298 100644
--- a/jarvis/ui/web/frontend/src/views/JarvisAgentsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/JarvisAgentsView.tsx
@@ -31,6 +31,7 @@ import { useQuery } from "@tanstack/react-query";
import { useSubAgentStore, type SubAgentNode, type SubAgentTreeSnapshot } from "@/store/jarvisAgents";
import { useEventStore } from "@/store/events";
+import type { PlaceId } from "@/components/society/world/islandLayout";
import { DepartureBoard } from "./sub-agents/DepartureBoard";
import { AgentInsight } from "./sub-agents/AgentInsight";
import { selectTaskRows } from "./sub-agents/rows";
@@ -108,9 +109,11 @@ export interface JarvisAgentsViewProps {
* society view hooks its model card in here; standalone, nothing listens.
*/
onSelectAgent?: (agentId: string | null) => void;
+ /** A building with a card was clicked on the island; the society view opens its card. */
+ onSelectPlace?: (place: PlaceId) => void;
}
-export function JarvisAgentsView({ onSelectAgent }: JarvisAgentsViewProps = {}) {
+export function JarvisAgentsView({ onSelectAgent, onSelectPlace }: JarvisAgentsViewProps = {}) {
const { health } = useSectionHealth();
const subAgents = useSubAgentStore((s) => s.subAgents);
const sweepExpired = useSubAgentStore((s) => s.sweepExpired);
@@ -259,6 +262,7 @@ export function JarvisAgentsView({ onSelectAgent }: JarvisAgentsViewProps = {})
topRight={modeSwitch}
onOpenLedger={() => switchMode("ledger")}
onSelectAgent={onSelectAgent}
+ onSelectPlace={onSelectPlace}
/>
</Suspense>
</div>
diff --git a/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
index b7ecdba9fa..ad6125e9f6 100644
--- a/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
+++ b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
@@ -14,7 +14,10 @@ import { lazy, Suspense, useCallback, useMemo, useState } from "react";
import { useT } from "@/i18n";
import { AgentCardOverlay } from "@/components/society/card/AgentCardOverlay";
+import { BuildingCardOverlay } from "@/components/society/card/BuildingCardOverlay";
+import { isBuildingPlace, type BuildingPlace } from "@/components/society/card/buildingCards";
import { CreateAgentDialog } from "@/components/society/create/CreateAgentDialog";
+import type { PlaceId } from "@/components/society/world/islandLayout";
import { useSocietyRoster } from "@/components/society/data";
import { RosterRail } from "@/components/society/roster/RosterRail";
@@ -48,6 +51,13 @@ export function SocietyView() {
if (agentId) setOpenAgentId(agentId);
}, []);
+ // A building clicked on the island opens its own card: the building
+ // rendered as it stands on the map, and beside it what it does.
+ const [openPlace, setOpenPlace] = useState<BuildingPlace | null>(null);
+ const onIslandPlace = useCallback((place: PlaceId) => {
+ if (isBuildingPlace(place)) setOpenPlace(place);
+ }, []);
+
return (
<div className="flex h-full min-h-0 w-full" data-testid="society-view">
<div className="flex min-h-0 min-w-0 flex-1 flex-col">
@@ -60,7 +70,7 @@ export function SocietyView() {
</div>
<div className="relative min-h-0 flex-1">
<Suspense fallback={null}>
- <JarvisAgentsBoard onSelectAgent={onIslandSelect} />
+ <JarvisAgentsBoard onSelectAgent={onIslandSelect} onSelectPlace={onIslandPlace} />
</Suspense>
</div>
</div>
@@ -73,6 +83,14 @@ export function SocietyView() {
onCreate={() => setCreating(true)}
/>
<AgentCardOverlay agent={openAgent} roster={agents} onClose={() => setOpenAgentId(null)} />
+ <BuildingCardOverlay
+ place={openPlace}
+ onClose={() => setOpenPlace(null)}
+ onCreateAgent={() => {
+ setOpenPlace(null);
+ setCreating(true);
+ }}
+ />
<CreateAgentDialog open={creating} onClose={() => setCreating(false)} onCreated={onCreated} />
</div>
);