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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(society): the Agents section as the society — rail, model card with the 3D figure, creator
rubenluetke10-beepe0d5a4049f77
diff --git a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx b/jarvis/ui/web/frontend/src/components/layout/MainView.tsxindex 304fc599ab..565ca72492 100644--- a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/MainView.tsx@@ -83,9 +83,12 @@ function lazyPropView<P>(const SettingsView = lazyView(() =>import("@/views/SettingsView").then((m) => ({ default: m.SettingsView })),);-const JarvisAgentsView = lazyView(() =>- import("@/views/JarvisAgentsView").then((m) => ({- default: m.JarvisAgentsView,+// The Agents section is the society (MASTERPLAN §4.1): stage + agents rail ++// model cards. The board it replaced is the society's stage until the island+// lands, loaded by SocietyView itself.+const SocietyView = lazyView(() =>+ import("@/views/society/SocietyView").then((m) => ({+ default: m.SocietyView,})),);const WikiView = lazyView(() =>@@ -489,7 +492,7 @@ function SwitchOnActiveSection({ active }: { active: string }) {case "chats":return <ChatsSurface />;case "agents":- return <JarvisAgentsView />;+ return <SocietyView />;// Skills + Plugins + MCPs are merged behind the "Skills & Tools" entry with// an in-view tab switcher; the active id doubles as the tab state.case "skills":diff --git a/jarvis/ui/web/frontend/src/components/society/AgentSwatch.tsx b/jarvis/ui/web/frontend/src/components/society/AgentSwatch.tsxnew file mode 100644index 0000000000..f9c2198f76--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/AgentSwatch.tsx@@ -0,0 +1,47 @@+/**+ * The flat stand-in for an agent's face wherever a 3D canvas would be+ * wasteful — roster rows, card headers, chips. Skin over the primary+ * garment, the accent as a ring: the same colours the figure wears, so a+ * row and its character read as one agent.+ */+import { cn } from "@/lib/utils";++import type { SocietyAgent } from "./data";+import { resolvePalette } from "./figures/figureRecipe";++export function AgentSwatch({+ agent,+ size = 36,+ className,+}: {+ agent: Pick<SocietyAgent, "figure" | "palette" | "name">;+ size?: number;+ className?: string;+}) {+ const palette = resolvePalette(agent.figure);+ const primary = agent.figure ? palette.primary : agent.palette.primary;+ const accent = agent.figure ? palette.accent : agent.palette.accent;+ return (+ <span+ aria-hidden+ className={cn("relative inline-flex shrink-0 items-end justify-center overflow-hidden rounded-full", className)}+ style={{+ width: size,+ height: size,+ background: `linear-gradient(170deg, ${primary}, ${palette.primary_shade})`,+ boxShadow: `inset 0 0 0 2px ${accent}55`,+ }}+ >+ <span+ className="rounded-full"+ style={{+ width: size * 0.42,+ height: size * 0.42,+ marginBottom: size * 0.12,+ background: palette.skin,+ boxShadow: `0 ${-size * 0.12}px 0 0 ${palette.hair}`,+ }}+ />+ </span>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentCardOverlay.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentCardOverlay.tsxnew file mode 100644index 0000000000..a2074520bf--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/card/AgentCardOverlay.tsx@@ -0,0 +1,84 @@+/**+ * The agent model card: a near-full-screen window above the world, the+ * world still visible through a dimmed, blurred scrim (MASTERPLAN §4.2).+ * Three columns, in this order: Specs | 3D figure | Chat. Esc and ✕ close.+ *+ * Radix Dialog gives the focus trap and Escape for free; the content is an+ * inset window rather than a centred box so the stage shows around it.+ * `components/layout/overlay-stacking.test.ts` guards the shell so a fixed+ * overlay like this one is never trapped under the nav column.+ *+ * The chat column is the ordinary agent chat once the roster row carries a+ * session (M2). A sample row carries none, and the column says so instead+ * of inventing a transcript.+ */+import * as Dialog from "@radix-ui/react-dialog";+import { MessageSquareDashed, X } from "lucide-react";++import { Badge } from "@/components/ui/badge";+import { useT } from "@/i18n";++import { AgentSwatch } from "../AgentSwatch";+import type { SocietyAgent } from "../data";+import { AgentFigureViewer } from "../figures/AgentFigureViewer";+import { AgentSpecSheet } from "./AgentSpecSheet";++export interface AgentCardOverlayProps {+ agent: SocietyAgent | null;+ onClose: () => void;+}++export function AgentCardOverlay({ agent, onClose }: AgentCardOverlayProps) {+ const t = useT();+ const open = agent !== null;+ 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="agent-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"+ >+ {agent ? (+ <>+ <header className="flex shrink-0 items-center gap-3 border-b border-border px-5 py-3">+ <AgentSwatch agent={agent} size={40} />+ <div className="min-w-0 flex-1">+ <Dialog.Title className="truncate font-display text-base font-semibold tracking-tight text-foreground">+ {agent.name}+ </Dialog.Title>+ <Dialog.Description className="truncate text-xs text-muted-foreground">+ {agent.title}+ </Dialog.Description>+ </div>+ <Badge variant="outline">{t(`society.state.${agent.state}`)}</Badge>+ <Dialog.Close+ aria-label={t("society.card.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(260px,1fr)_minmax(320px,1.2fr)_minmax(300px,1fr)]">+ <section className="min-h-0 border-r border-border" aria-label={t("society.card.specs")}>+ <AgentSpecSheet agent={agent} />+ </section>+ <section className="society-figure-column relative min-h-0" aria-label={t("society.card.figure")}>+ <AgentFigureViewer recipe={agent.figure} />+ </section>+ <section+ className="flex min-h-0 flex-col items-center justify-center gap-2 border-l border-border p-6 text-center"+ aria-label={t("society.card.chat")}+ >+ <MessageSquareDashed className="h-6 w-6 text-muted-foreground" aria-hidden />+ <p className="text-sm font-medium text-foreground">{t("society.card.chat_empty_title")}</p>+ <p className="max-w-[30ch] text-xs text-muted-foreground">{t("society.card.chat_empty_hint")}</p>+ </section>+ </div>+ </>+ ) : null}+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog.Root>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentSpecSheet.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentSpecSheet.tsxnew file mode 100644index 0000000000..5d771788d7--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/card/AgentSpecSheet.tsx@@ -0,0 +1,105 @@+/**+ * The model card's left column: what the agent IS, as a spec sheet —+ * brain, tier, permissions, budget, tools, routines, lifetime stats, and+ * its standing instructions (MASTERPLAN §4.2, agent-definition §2).+ * Ink & Paper chrome; every string through the locale files.+ */+import { Badge } from "@/components/ui/badge";+import { ScrollArea } from "@/components/ui/scroll-area";+import { useT } from "@/i18n";++import type { SocietyAgent } from "../data";++function formatDate(ms: number | null, fallback: string): string {+ if (ms === null) return fallback;+ return new Date(ms).toLocaleDateString(undefined, { day: "2-digit", month: "short", year: "numeric" });+}++export function AgentSpecSheet({ agent }: { agent: SocietyAgent }) {+ const t = useT();+ return (+ <ScrollArea className="h-full min-h-0">+ <div className="flex flex-col gap-5 p-5">+ <section>+ <h3 className="mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">+ {t("society.card.brain")}+ </h3>+ <div className="flex flex-wrap items-center gap-1.5">+ <Badge>{agent.providerLabel}</Badge>+ <Badge variant="secondary" className="font-mono text-[11px]">+ {agent.model}+ </Badge>+ <Badge variant="outline">{t(`society.tier.${agent.tier}`)}</Badge>+ </div>+ </section>++ <section>+ <h3 className="mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">+ {t("society.card.description")}+ </h3>+ <p className="whitespace-pre-line text-[13px] leading-relaxed text-foreground">{agent.description}</p>+ </section>++ <section className="grid grid-cols-2 gap-x-4 gap-y-3">+ <Fact label={t("society.card.permission")} value={t(`society.ceiling.${agent.permissionCeiling}`)} />+ <Fact label={t("society.card.budget")} value={`$${agent.dailyBudgetUsd.toFixed(2)}`} />+ <Fact label={t("society.card.grant_mode")} value={t(`society.grant.${agent.grantMode}`)} />+ <Fact label={t("society.card.place")} value={t(`society.checkpoint.${agent.checkpoint}`)} />+ </section>++ <section>+ <h3 className="mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">+ {t("society.card.tools")}+ </h3>+ {agent.toolGrants.length === 0 ? (+ <p className="text-xs text-muted-foreground">{t("society.card.no_tools")}</p>+ ) : (+ <div className="flex flex-wrap gap-1.5">+ {agent.toolGrants.map((tool) => (+ <Badge key={tool} variant="secondary" className="font-mono text-[11px]">+ {tool}+ </Badge>+ ))}+ </div>+ )}+ </section>++ <section>+ <h3 className="mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">+ {t("society.card.routines")}+ </h3>+ {agent.routines.length === 0 ? (+ <p className="text-xs text-muted-foreground">{t("society.card.no_routines")}</p>+ ) : (+ <ul className="flex flex-col gap-1.5">+ {agent.routines.map((routine) => (+ <li key={routine.id} className="flex items-baseline justify-between gap-3 text-[13px]">+ <span className="truncate text-foreground">{routine.label}</span>+ <span className="shrink-0 text-xs text-muted-foreground">{routine.schedule}</span>+ </li>+ ))}+ </ul>+ )}+ </section>++ <section className="grid grid-cols-3 gap-3">+ <Fact label={t("society.card.runs")} value={String(agent.stats.runs)} />+ <Fact label={t("society.card.cost")} value={`$${agent.stats.totalCostUsd.toFixed(2)}`} />+ <Fact+ label={t("society.card.last_active")}+ value={formatDate(agent.stats.lastActiveMs, t("society.card.never"))}+ />+ </section>+ </div>+ </ScrollArea>+ );+}++function Fact({ label, value }: { label: string; value: string }) {+ return (+ <div className="min-w-0">+ <div className="text-[11px] text-muted-foreground">{label}</div>+ <div className="truncate text-[13px] font-medium text-foreground">{value}</div>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsx b/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsxnew file mode 100644index 0000000000..bed43d3762--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsx@@ -0,0 +1,467 @@+/**+ * Create an agent: three fields and an Advanced disclosure on the left, the+ * character on the right — live, turnable, from above and below — with the+ * look editor under it (MASTERPLAN §4.2, agent-definition §6: no wizard).+ *+ * Everything a person changes is visible in the preview the same frame: a+ * preset, a colour, the build, the height. What is not built yet is shown+ * disabled with the reason (the small/large builds), never hidden.+ *+ * Until the society backend is bound, "Create" appends a sample row to this+ * window's roster (data.ts, the single swap point) and opens its card.+ */+import { useEffect, useMemo, useState } from "react";+import * as Collapsible from "@radix-ui/react-collapsible";+import * as Dialog from "@radix-ui/react-dialog";+import { useQuery } from "@tanstack/react-query";+import { ChevronDown, Shuffle, X } from "lucide-react";++import { Button } from "@/components/ui/button";+import { Combobox } from "@/components/ui/combobox";+import { ScrollArea } from "@/components/ui/scroll-area";+import { useT } from "@/i18n";+import { fetchAgentChatCatalog, type AgentChatProvider } from "@/lib/agentChatApi";+import { cn } from "@/lib/utils";++import { useCreateAgent, type GrantMode, type PermissionCeiling } from "../data";+import { AgentFigureViewer } from "../figures/AgentFigureViewer";+import {+ EDITABLE_CELLS,+ PALETTE_PRESETS,+ defaultRecipe,+ resolvePalette,+ shufflePalette,+ type FigureRecipe,+ type PaletteCell,+} from "../figures/figureRecipe";+import { AVAILABLE_BASES } from "../figures/figureRegistry";++const BASES = ["small", "medium", "large"] as const;+const CEILINGS: readonly PermissionCeiling[] = ["safe", "monitor", "ask"];+const GRANTS: readonly GrantMode[] = ["all", "allowlist"];+const HEIGHT_MIN = 1.5;+const HEIGHT_MAX = 2.1;++export interface CreateAgentDialogProps {+ open: boolean;+ onClose: () => void;+ onCreated: (agentId: string) => void;+}++export function CreateAgentDialog({ open, onClose, onCreated }: CreateAgentDialogProps) {+ const t = useT();+ const createAgent = useCreateAgent();+ const [name, setName] = useState("");+ const [title, setTitle] = useState("");+ const [description, setDescription] = useState("");+ const [recipe, setRecipe] = useState<FigureRecipe>(() => defaultRecipe("ranger"));+ const [providerId, setProviderId] = useState("");+ const [model, setModel] = useState("");+ const [ceiling, setCeiling] = useState<PermissionCeiling>("monitor");+ const [grantMode, setGrantMode] = useState<GrantMode>("all");+ const [budget, setBudget] = useState("2");+ const [advanced, setAdvanced] = useState(false);+ const [submitting, setSubmitting] = useState(false);+ const [error, setError] = useState<string | null>(null);++ // The same catalog the typed chat offers — API families, CLI seats, local+ // models — filtered by the society surface on the backend.+ const catalog = useQuery({+ queryKey: ["agent-chat", "catalog", "society"],+ queryFn: () => fetchAgentChatCatalog("society"),+ enabled: open,+ staleTime: 60_000,+ });+ const providers: AgentChatProvider[] = catalog.data?.providers ?? [];+ const provider = providers.find((p) => p.id === providerId) ?? providers[0] ?? null;++ useEffect(() => {+ if (!providerId && provider) {+ setProviderId(provider.id);+ setModel(provider.default_model || provider.curated_models[0]?.id || "");+ }+ }, [provider, providerId]);++ useEffect(() => {+ if (!open) return;+ setName("");+ setTitle("");+ setDescription("");+ setRecipe(defaultRecipe("ranger"));+ setError(null);+ setSubmitting(false);+ }, [open]);++ const palette = useMemo(() => resolvePalette(recipe), [recipe]);++ const setCell = (cell: PaletteCell, value: string) =>+ setRecipe((r) => ({ ...r, palette: { ...r.palette, [cell]: value } }));+ const applyPreset = (id: string) => {+ const preset = PALETTE_PRESETS.find((p) => p.id === id);+ if (preset) setRecipe((r) => ({ ...r, palette: { ...preset.palette } }));+ };++ const submit = async () => {+ if (!name.trim()) {+ setError(t("society.create.name_required"));+ return;+ }+ setSubmitting(true);+ setError(null);+ try {+ const agent = await createAgent({+ name,+ title: title.trim() || t("society.create.title_fallback"),+ description,+ figure: recipe,+ palette: { primary: palette.primary, secondary: palette.secondary, accent: palette.accent },+ provider: provider?.id ?? "",+ providerLabel: provider?.label ?? t("society.create.provider_unknown"),+ model,+ grantMode,+ permissionCeiling: ceiling,+ dailyBudgetUsd: Math.max(0, Number.parseFloat(budget) || 0),+ });+ onCreated(agent.agentId);+ } catch (err) {+ setError(err instanceof Error ? err.message : t("society.create.error"));+ setSubmitting(false);+ }+ };++ const fieldClass =+ "w-full rounded-md border border-border bg-background px-3 py-2 text-[13px] text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-strong";+ const labelClass = "mb-1 block text-[11px] font-semibold uppercase tracking-wide text-muted-foreground";++ 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="create-agent-dialog"+ 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-y-8 lg:inset-x-16"+ >+ <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="font-display text-base font-semibold tracking-tight text-foreground">+ {t("society.create.title")}+ </Dialog.Title>+ <Dialog.Description className="text-xs text-muted-foreground">+ {t("society.create.subtitle")}+ </Dialog.Description>+ </div>+ <Dialog.Close+ aria-label={t("society.card.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(320px,1fr)_minmax(360px,1.1fr)]">+ {/* ---- left: the three fields + Advanced ---- */}+ <ScrollArea className="min-h-0 border-r border-border">+ <form+ className="flex flex-col gap-4 p-5"+ onSubmit={(e) => {+ e.preventDefault();+ void submit();+ }}+ >+ <div>+ <label htmlFor="society-create-name" className={labelClass}>+ {t("society.create.name")}+ </label>+ <input+ id="society-create-name"+ className={fieldClass}+ value={name}+ onChange={(e) => setName(e.target.value)}+ placeholder={t("society.create.name_placeholder")}+ autoComplete="off"+ autoFocus+ />+ </div>+ <div>+ <label htmlFor="society-create-title" className={labelClass}>+ {t("society.create.title_field")}+ </label>+ <input+ id="society-create-title"+ className={fieldClass}+ value={title}+ onChange={(e) => setTitle(e.target.value)}+ placeholder={t("society.create.title_placeholder")}+ autoComplete="off"+ />+ </div>+ <div>+ <label htmlFor="society-create-description" className={labelClass}>+ {t("society.create.description")}+ </label>+ <textarea+ id="society-create-description"+ className={cn(fieldClass, "min-h-[140px] resize-y leading-relaxed")}+ value={description}+ onChange={(e) => setDescription(e.target.value)}+ placeholder={t("society.create.description_placeholder")}+ />+ <p className="mt-1 text-[11px] text-muted-foreground">{t("society.create.description_hint")}</p>+ </div>++ <Collapsible.Root open={advanced} onOpenChange={setAdvanced}>+ <Collapsible.Trigger asChild>+ <button+ type="button"+ className="flex w-full items-center justify-between rounded-md border border-border px-3 py-2 text-[13px] font-medium text-foreground hover:bg-secondary"+ >+ {t("society.create.advanced")}+ <ChevronDown+ className={cn("h-4 w-4 transition-transform", advanced && "rotate-180")}+ aria-hidden+ />+ </button>+ </Collapsible.Trigger>+ <Collapsible.Content className="flex flex-col gap-4 pt-4">+ <div>+ <span className={labelClass}>{t("society.create.provider")}</span>+ {providers.length > 0 ? (+ <Combobox+ value={provider?.id ?? ""}+ groups={[+ {+ id: "providers",+ options: providers.map((p) => ({ value: p.id, label: p.label })),+ },+ ]}+ onChange={(id) => {+ setProviderId(id);+ const next = providers.find((p) => p.id === id);+ setModel(next?.default_model || next?.curated_models[0]?.id || "");+ }}+ ariaLabel={t("society.create.provider")}+ />+ ) : (+ <p className="text-xs text-muted-foreground">+ {catalog.isLoading ? t("society.create.catalog_loading") : t("society.create.provider_unknown")}+ </p>+ )}+ </div>+ <div>+ <label htmlFor="society-create-model" className={labelClass}>+ {t("society.create.model")}+ </label>+ {provider && provider.curated_models.length > 0 ? (+ <Combobox+ id="society-create-model"+ value={model}+ groups={[+ {+ id: "models",+ options: provider.curated_models.map((m) => ({+ value: m.id,+ label: m.label,+ hint: m.note,+ })),+ },+ ]}+ onChange={setModel}+ ariaLabel={t("society.create.model")}+ />+ ) : (+ <input+ id="society-create-model"+ className={cn(fieldClass, "font-mono")}+ value={model}+ onChange={(e) => setModel(e.target.value)}+ placeholder={t("society.create.model_placeholder")}+ autoComplete="off"+ />+ )}+ </div>+ <div>+ <span className={labelClass}>{t("society.create.ceiling")}</span>+ <Segmented+ value={ceiling}+ options={CEILINGS.map((c) => ({ value: c, label: t(`society.ceiling.${c}`) }))}+ onChange={(v) => setCeiling(v as PermissionCeiling)}+ />+ </div>+ <div>+ <span className={labelClass}>{t("society.create.grant_mode")}</span>+ <Segmented+ value={grantMode}+ options={GRANTS.map((g) => ({ value: g, label: t(`society.grant.${g}`) }))}+ onChange={(v) => setGrantMode(v as GrantMode)}+ />+ </div>+ <div>+ <label htmlFor="society-create-budget" className={labelClass}>+ {t("society.create.budget")}+ </label>+ <input+ id="society-create-budget"+ type="number"+ min={0}+ step={0.5}+ inputMode="decimal"+ className={cn(fieldClass, "w-32 font-mono")}+ value={budget}+ onChange={(e) => setBudget(e.target.value)}+ />+ </div>+ </Collapsible.Content>+ </Collapsible.Root>++ {error ? (+ <p role="alert" className="text-xs text-destructive">+ {error}+ </p>+ ) : null}+ <div className="flex items-center justify-end gap-2 pt-2">+ <Button type="button" variant="ghost" size="sm" onClick={onClose}>+ {t("society.create.cancel")}+ </Button>+ <Button type="submit" size="sm" disabled={submitting} data-testid="society-create-submit">+ {t("society.create.submit")}+ </Button>+ </div>+ </form>+ </ScrollArea>++ {/* ---- right: the character, live ---- */}+ <div className="flex min-h-0 flex-col">+ <div className="society-figure-column relative min-h-[240px] flex-1">+ <AgentFigureViewer recipe={recipe} quiet />+ </div>+ <div className="shrink-0 border-t border-border p-4">+ <div className="mb-3 flex items-center justify-between">+ <span className={labelClass}>{t("society.create.look")}</span>+ <button+ type="button"+ onClick={() => setRecipe((r) => ({ ...r, palette: shufflePalette() }))}+ className="flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-secondary hover:text-foreground"+ >+ <Shuffle className="h-3.5 w-3.5" aria-hidden />+ {t("society.create.shuffle")}+ </button>+ </div>+ <div className="flex flex-col gap-3">+ <div className="flex items-center gap-3">+ <span className="w-16 text-[11px] text-muted-foreground">{t("society.create.base")}</span>+ <Segmented+ value={recipe.base}+ options={BASES.map((b) => ({+ value: b,+ label: t(`society.base.${b}`),+ disabled: !AVAILABLE_BASES.biped.includes(b),+ hint: AVAILABLE_BASES.biped.includes(b) ? undefined : t("society.create.base_soon"),+ }))}+ onChange={(base) => setRecipe((r) => ({ ...r, base }))}+ />+ </div>+ <div className="flex items-center gap-3">+ <span className="w-16 text-[11px] text-muted-foreground">{t("society.create.presets")}</span>+ <div className="flex flex-wrap gap-1.5">+ {PALETTE_PRESETS.map((preset) => {+ const p = resolvePalette({ palette: preset.palette });+ return (+ <button+ key={preset.id}+ type="button"+ title={t(`society.presets.${preset.labelKey}`)}+ aria-label={t(`society.presets.${preset.labelKey}`)}+ onClick={() => applyPreset(preset.id)}+ className="flex h-7 items-center gap-0.5 rounded-md border border-border px-1.5 hover:bg-secondary"+ >+ <span className="h-3.5 w-3.5 rounded-sm" style={{ background: p.primary }} />+ <span className="h-3.5 w-3.5 rounded-sm" style={{ background: p.secondary }} />+ <span className="h-3.5 w-3.5 rounded-sm" style={{ background: p.accent }} />+ </button>+ );+ })}+ </div>+ </div>+ <div className="flex items-start gap-3">+ <span className="w-16 pt-1 text-[11px] text-muted-foreground">{t("society.create.colours")}</span>+ <div className="grid flex-1 grid-cols-3 gap-x-3 gap-y-1.5 sm:grid-cols-6">+ {EDITABLE_CELLS.map((cell) => (+ <label key={cell} className="flex flex-col items-start gap-0.5 text-[10px] text-muted-foreground">+ <input+ type="color"+ value={palette[cell]}+ onChange={(e) => setCell(cell, e.target.value)}+ aria-label={t(`society.cell.${cell}`)}+ className="h-6 w-full cursor-pointer rounded border border-border bg-transparent p-0"+ />+ {t(`society.cell.${cell}`)}+ </label>+ ))}+ </div>+ </div>+ <div className="flex items-center gap-3">+ <label htmlFor="society-create-height" className="w-16 text-[11px] text-muted-foreground">+ {t("society.create.height")}+ </label>+ <input+ id="society-create-height"+ type="range"+ min={HEIGHT_MIN}+ max={HEIGHT_MAX}+ step={0.01}+ value={recipe.heightM ?? 1.75}+ onChange={(e) => setRecipe((r) => ({ ...r, heightM: Number.parseFloat(e.target.value) }))}+ className="flex-1"+ />+ <span className="w-14 text-right font-mono text-[11px] text-muted-foreground">+ {(recipe.heightM ?? 1.75).toFixed(2)} m+ </span>+ </div>+ </div>+ </div>+ </div>+ </div>+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog.Root>+ );+}++interface SegmentedOption {+ value: string;+ label: string;+ disabled?: boolean;+ hint?: string;+}++function Segmented({+ value,+ options,+ onChange,+}: {+ value: string;+ options: SegmentedOption[];+ onChange: (value: string) => void;+}) {+ return (+ <div role="radiogroup" className="inline-flex rounded-md border border-border bg-background p-0.5">+ {options.map((option) => (+ <button+ key={option.value}+ type="button"+ role="radio"+ aria-checked={option.value === value}+ disabled={option.disabled}+ title={option.hint}+ onClick={() => onChange(option.value)}+ className={cn(+ "rounded px-2.5 py-1 text-xs transition-colors disabled:cursor-not-allowed disabled:opacity-40",+ option.value === value ? "bg-secondary text-foreground" : "text-muted-foreground hover:text-foreground",+ )}+ >+ {option.label}+ </button>+ ))}+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/data.ts b/jarvis/ui/web/frontend/src/components/society/data.tsnew file mode 100644index 0000000000..861b49970e--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/data.ts@@ -0,0 +1,198 @@+/**+ * The society frontend's data seam — every card, roster row and world walker+ * reads agents through the hooks in this file and nothing else.+ *+ * The M1 backend (docs/agent-society/MASTERPLAN.md §3.1: society.db roster ++ * /api/society routes) is being built in a parallel session. Until the two+ * sides are wired, `fetchSocietyRoster` resolves the clearly-labeled sample+ * roster from ./mockRoster plus whatever this window created — the ONE swap+ * point. Nothing else in the society components may know where agents come+ * from.+ *+ * The enums here mirror the roster schema (MASTERPLAN §3.1, agent-definition.md+ * §2) and cross Python ↔ SQL ↔ Pydantic ↔ TS ↔ UI once the backend is bound —+ * at that point they join the five-layer parity tests (AP-4). Keep names in+ * lockstep with the plan, not with what reads nicely in TS.+ */+import { useCallback } from "react";+import { useQuery, useQueryClient } from "@tanstack/react-query";++import type { FigureRecipe } from "./figures/figureRecipe";+import { SAMPLE_ROSTER } from "./mockRoster";++/** MASTERPLAN §2.5 — exactly one lead (Jarvis), orchestrators may ASSIGN. */+export type AgentTier = "lead" | "orchestrator" | "specialist";++/** Semantic place in the world (§2.7) — the backend owns this, never pixels. */+export type AgentCheckpoint = "desk" | "meeting" | "archive" | "gate" | "idle";++/** Coarse run state for rows and badges; the event log holds the detail. */+export type AgentRunState = "idle" | "working" | "waiting" | "paused";++/** §6.2 — the unattended ceiling; "block" never appears (block is block). */+export type PermissionCeiling = "safe" | "monitor" | "ask";++/** agent-definition.md §3.2 — everything the tiers allow, or only an allow-list. */+export type GrantMode = "all" | "allowlist";++/**+ * Per-agent accent colours for flat UI (roster swatch, chat avatar ring).+ * The figure's own colours live in `figure.palette`; these three are derived+ * from it so the rail and the character always agree.+ */+export interface AgentPalette {+ primary: string;+ secondary: string;+ accent: string;+}++export interface AgentRoutine {+ id: string;+ label: string;+ /** Human-readable schedule ("daily 07:00"), not a cron string. */+ schedule: string;+ /** ISO timestamp of the next fire, when the scheduler knows one. */+ nextFire: string | null;+}++export interface AgentStats {+ runs: number;+ totalCostUsd: number;+ /** Epoch ms of the last completed run; null for a fresh agent. */+ lastActiveMs: number | null;+}++/** One roster row — the model card's whole world (MASTERPLAN §3.1, agent-definition §2). */+export interface SocietyAgent {+ agentId: string;+ name: string;+ /** One job line ("Research scout"). */+ title: string;+ /** Standing instructions, Markdown — the agent's own rulebook. */+ description: string;+ tier: AgentTier;+ /** Provider id as the agent-chat catalog knows it (e.g. "anthropic"). */+ provider: string;+ /** Display label for the provider, until the catalog lookup is wired. */+ providerLabel: string;+ model: string;+ /** The character: archetype, base, parts, palette. null = the palette tile. */+ figure: FigureRecipe | null;+ palette: AgentPalette;+ grantMode: GrantMode;+ toolGrants: string[];+ permissionCeiling: PermissionCeiling;+ dailyBudgetUsd: number;+ checkpoint: AgentCheckpoint;+ state: AgentRunState;+ createdMs: number;+ /**+ * The canonical agent_chat session bound to this agent (M2). Sample rows+ * carry null — the card then shows the honest empty state instead of an+ * invented transcript.+ */+ chatSessionId: string | null;+ routines: AgentRoutine[];+ stats: AgentStats;+}++/** What the creator hands over; everything else is derived or defaulted. */+export interface NewAgentInput {+ name: string;+ title: string;+ description: string;+ figure: FigureRecipe;+ palette: AgentPalette;+ provider: string;+ providerLabel: string;+ model: string;+ grantMode: GrantMode;+ permissionCeiling: PermissionCeiling;+ dailyBudgetUsd: number;+}++/** Agents created in THIS window before the backend exists — sample data, not persisted. */+const LOCAL_ROSTER: SocietyAgent[] = [];++/**+ * THE swap point: replace the sample resolve with+ * `fetch("/api/society/agents")` once the M1 routes are bound. Async already,+ * so the swap touches no caller.+ */+async function fetchSocietyRoster(): Promise<SocietyAgent[]> {+ return [...SAMPLE_ROSTER, ...LOCAL_ROSTER];+}++const ROSTER_QUERY_KEY = ["society", "roster"] as const;++export function useSocietyRoster() {+ return useQuery({+ queryKey: ROSTER_QUERY_KEY,+ queryFn: fetchSocietyRoster,+ staleTime: 30_000,+ });+}++/** One agent by id, riding the roster query so both share one fetch. */+export function useSocietyAgent(agentId: string | null) {+ const roster = useSocietyRoster();+ const agent =+ agentId === null ? null : (roster.data?.find((a) => a.agentId === agentId) ?? null);+ return { ...roster, agent };+}++/** A URL-safe id from a display name, unique against the rows already known. */+export function slugifyAgentName(name: string, taken: ReadonlySet<string>): string {+ const base =+ name+ .toLowerCase()+ .normalize("NFKD")+ .replace(/[̀-ͯ]/g, "")+ .replace(/[^a-z0-9]+/g, "-")+ .replace(/^-+|-+$/g, "") || "agent";+ let candidate = base;+ let n = 2;+ while (taken.has(candidate)) candidate = `${base}-${n++}`;+ return candidate;+}++/**+ * Create an agent. Today this appends a sample row for this window and+ * refreshes the roster; the swap to `POST /api/society/agents` changes only+ * the body of `create`.+ */+export function useCreateAgent() {+ const client = useQueryClient();+ const { data } = useSocietyRoster();+ return useCallback(+ async (input: NewAgentInput): Promise<SocietyAgent> => {+ const taken = new Set((data ?? []).map((a) => a.agentId));+ const agent: SocietyAgent = {+ agentId: slugifyAgentName(input.name, taken),+ name: input.name.trim(),+ title: input.title.trim(),+ description: input.description.trim(),+ tier: "specialist",+ provider: input.provider,+ providerLabel: input.providerLabel,+ model: input.model,+ figure: input.figure,+ palette: input.palette,+ grantMode: input.grantMode,+ toolGrants: [],+ permissionCeiling: input.permissionCeiling,+ dailyBudgetUsd: input.dailyBudgetUsd,+ checkpoint: "idle",+ state: "idle",+ createdMs: Date.now(),+ chatSessionId: null,+ routines: [],+ stats: { runs: 0, totalCostUsd: 0, lastActiveMs: null },+ };+ LOCAL_ROSTER.push(agent);+ await client.invalidateQueries({ queryKey: ROSTER_QUERY_KEY });+ return agent;+ },+ [client, data],+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/figures/AgentFigureViewer.tsx b/jarvis/ui/web/frontend/src/components/society/figures/AgentFigureViewer.tsxnew file mode 100644index 0000000000..1d8a12f9ef--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/figures/AgentFigureViewer.tsx@@ -0,0 +1,309 @@+/**+ * The model card's centre column: one agent's figure, rendered through the+ * same pixelated pass the island uses, turned by hand.+ *+ * Drag turns the figure and tilts the camera — all the way to a view from+ * above and one from below — the wheel zooms, a double-click resets. The+ * figure idles; on open it waves once. Under `prefers-reduced-motion` it+ * holds its pose and still turns under the pointer (a person asked for+ * that). Every canvas here mounts through `useWebglSurface` (AP-32: the+ * context is handed back on unmount and rebuilt when the browser takes it)+ * and renders only while on screen (`useCanvasAwake`, never `document.hidden`).+ *+ * Without a recipe or without WebGL the column shows the palette tile — a+ * declared fallback, not an empty box (docs/agent-society/character-pipeline.md §9).+ */+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 { EffectComposer } from "three/examples/jsm/postprocessing/EffectComposer.js";+import { OutputPass } from "three/examples/jsm/postprocessing/OutputPass.js";+import { RenderPixelatedPass } from "three/examples/jsm/postprocessing/RenderPixelatedPass.js";++import { useCanvasAwake } from "@/hooks/useCanvasAwake";+import { useWebglSurface } from "@/hooks/useWebglSurface";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";++import { assembleFigure, playClip, type AssembledFigure, type LoadedGltf } from "./assembleFigure";+import { recipeKey, resolvePalette, type FigureRecipe } from "./figureRecipe";+import { figureAssetFor } from "./figureRegistry";++/** Target resolution the pixel pass renders the column at (docs §9.3). */+const PIXEL_TARGET_WIDTH = 240;++/** Camera pitch limits: straight down is +90°, straight up −90°; stop short of the poles. */+const PITCH_LIMIT = (80 * Math.PI) / 180;++const ZOOM_MIN = 0.55;+const ZOOM_MAX = 2.4;++/** The look a fresh open starts from: a little above eye level, three-quarter turned. */+const REST_VIEW = { yaw: -0.45, pitch: 0.18, zoom: 1 };++interface OrbitState {+ yaw: number;+ pitch: number;+ zoom: number;+}++export interface AgentFigureViewerProps {+ recipe: FigureRecipe | null;+ /** The clip to hold; the viewer waves once on mount and returns to it. */+ clip?: string;+ /** Skip the opening wave (the creator re-renders often). */+ quiet?: boolean;+ className?: string;+}++export function AgentFigureViewer({ recipe, clip = "idle", quiet = false, className }: AgentFigureViewerProps) {+ 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 });+ // Bumped on every pointer change so a demand-mode canvas draws the new view.+ const [orbitTick, setOrbitTick] = useState(0);+ const drag = useRef<{ x: number; y: number; id: number } | null>(null);++ const asset = recipe ? figureAssetFor(recipe) : null;+ const palette = useMemo(() => resolvePalette(recipe), [recipe]);+ const heightM = recipe?.heightM ?? asset?.defaultHeightM ?? 1.75;+ const look = recipe ? recipeKey(recipe) : "";++ const onPointerDown = useCallback((e: ReactPointerEvent<HTMLDivElement>) => {+ if (e.button !== 0) return;+ drag.current = { x: e.clientX, y: e.clientY, id: e.pointerId };+ 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.012;+ o.pitch = Math.max(-PITCH_LIMIT, Math.min(PITCH_LIMIT, o.pitch + dy * 0.01));+ 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)));+ 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="agent-figure-viewer"+ className={cn(+ "society-figure-stage relative h-full min-h-0 w-full select-none overflow-hidden touch-none",+ drag.current ? "cursor-grabbing" : "cursor-grab",+ className,+ )}+ onPointerDown={onPointerDown}+ onPointerMove={onPointerMove}+ onPointerUp={onPointerUp}+ onPointerCancel={onPointerUp}+ onWheel={onWheel}+ onDoubleClick={onDoubleClick}+ >+ {asset && recipe ? (+ <FigureErrorBoundary fallback={<PaletteTile palette={palette} label={t("society.figure.unavailable")} />}>+ <Canvas+ key={generation}+ dpr={1}+ frameloop={frameloop}+ gl={{ antialias: false, alpha: true, powerPreference: "low-power" }}+ camera={{ fov: 26, near: 0.1, far: 40, position: [0, heightM * 0.55, heightM * 2.6] }}+ onCreated={({ gl }) => {+ gl.setClearColor(0x000000, 0);+ }}+ >+ <Suspense fallback={null}>+ <FigureScene+ url={asset.url}+ look={look}+ palette={palette}+ heightM={heightM}+ clip={clip}+ quiet={quiet}+ paused={reduced || !awake}+ orbit={orbit}+ orbitTick={orbitTick}+ />+ </Suspense>+ <PixelPass />+ </Canvas>+ </FigureErrorBoundary>+ ) : (+ <PaletteTile palette={palette} label={t("society.figure.no_figure")} />+ )}+ <p className="pointer-events-none absolute inset-x-0 bottom-2 text-center text-[11px] text-white/70 [text-shadow:0_1px_2px_rgba(0,0,0,.45)]">+ {reduced ? t("society.figure.reduced_motion") : t("society.figure.drag_hint")}+ </p>+ </div>+ );+}++// ---------------------------------------------------------------------------+// the scene: figure, lights, ground blob, camera rig+// ---------------------------------------------------------------------------++interface SceneProps {+ url: string;+ look: string;+ palette: ReturnType<typeof resolvePalette>;+ heightM: number;+ clip: string;+ quiet: boolean;+ paused: boolean;+ orbit: { current: OrbitState };+ orbitTick: number;+}++function FigureScene({ url, look, palette, heightM, clip, quiet, paused, orbit, orbitTick }: SceneProps) {+ const gltf = useGLTF(url) as unknown as LoadedGltf;+ const camera = useThree((s) => s.camera);+ const invalidate = useThree((s) => s.invalidate);+ const groupRef = useRef<THREE.Group>(null);+ const figureRef = useRef<AssembledFigure | null>(null);++ // One assembled figure per look; the previous one is disposed first.+ useEffect(() => {+ const figure = assembleFigure(gltf, palette, heightM);+ figureRef.current = figure;+ const group = groupRef.current;+ if (figure && group) group.add(figure.root);+ if (figure) {+ if (!quiet && figure.actions.wave) playClip(figure, "wave", clip);+ else playClip(figure, clip, clip, 0);+ if (paused) figure.mixer.update(0.001);+ }+ invalidate();+ return () => {+ if (figure && group) group.remove(figure.root);+ figure?.dispose();+ figureRef.current = null;+ };+ // `look` stands in for the palette object identity; heightM and the+ // gltf are part of the same identity.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [gltf, look, heightM]);++ useEffect(() => {+ const figure = figureRef.current;+ if (figure) playClip(figure, clip, clip);+ invalidate();+ }, [clip, invalidate]);++ // The camera orbits the figure's middle: yaw turns the figure itself (so+ // the light stays put), pitch and zoom move the camera.+ useEffect(() => {+ const group = groupRef.current;+ const o = orbit.current;+ if (group) group.rotation.y = o.yaw;+ const mid = heightM * 0.52;+ const distance = (heightM * 2.6) / o.zoom;+ camera.position.set(0, mid + Math.sin(o.pitch) * distance, Math.cos(o.pitch) * distance);+ camera.lookAt(0, mid, 0);+ camera.updateProjectionMatrix();+ invalidate();+ }, [orbitTick, heightM, camera, invalidate, orbit]);++ useFrame((_, dt) => {+ if (paused) return;+ figureRef.current?.mixer.update(Math.min(dt, 0.1));+ });++ return (+ <>+ <hemisphereLight args={[0xffffff, 0x8fa0b3, 1.15]} />+ <directionalLight position={[2.2, 4.5, 3.2]} intensity={1.9} />+ <directionalLight position={[-3, 2, -2]} intensity={0.45} />+ <group ref={groupRef} />+ {/* A soft blob under the feet reads better than a shadow map at 22 px. */}+ <mesh rotation={[-Math.PI / 2, 0, 0]} position={[0, 0.005, 0]}>+ <circleGeometry args={[heightM * 0.26, 24]} />+ <meshBasicMaterial color={0x1a2230} transparent opacity={0.22} depthWrite={false} />+ </mesh>+ </>+ );+}++/** The island's look, in the card: the scene through a low-resolution, nearest-filtered target. */+function PixelPass() {+ const { gl, scene, camera, size } = useThree();+ const composer = useMemo(() => {+ const c = new EffectComposer(gl);+ const pass = new RenderPixelatedPass(2, scene, camera, { normalEdgeStrength: 0.3, depthEdgeStrength: 0.4 });+ c.addPass(pass);+ c.addPass(new OutputPass());+ return { composer: c, pass };+ }, [gl, scene, camera]);++ useEffect(() => {+ const pixelSize = Math.max(2, Math.round(size.width / PIXEL_TARGET_WIDTH));+ composer.pass.setPixelSize(pixelSize);+ composer.composer.setSize(size.width, size.height);+ }, [composer, size]);++ useEffect(() => () => composer.composer.dispose(), [composer]);++ useFrame(() => composer.composer.render(), 1);+ return null;+}++// ---------------------------------------------------------------------------+// fallbacks+// ---------------------------------------------------------------------------++/** The declared stand-in: the agent's colours as a tile, never an empty box. */+function PaletteTile({ palette, label }: { palette: ReturnType<typeof resolvePalette>; label: string }) {+ return (+ <div className="flex h-full w-full flex-col items-center justify-center gap-3 p-6">+ <div+ aria-hidden+ className="flex h-24 w-24 items-end justify-center rounded-2xl"+ style={{ background: `linear-gradient(160deg, ${palette.primary}, ${palette.primary_shade})` }}+ >+ <div className="mb-3 h-9 w-9 rounded-full" style={{ background: palette.skin, boxShadow: `0 -10px 0 0 ${palette.hair}` }} />+ </div>+ <p className="max-w-[26ch] text-center text-xs text-muted-foreground">{label}</p>+ </div>+ );+}++class FigureErrorBoundary extends Component<{ fallback: ReactNode; children: ReactNode }, { failed: boolean }> {+ state = { failed: false };++ static getDerivedStateFromError(): { failed: boolean } {+ return { failed: true };+ }++ componentDidCatch(error: Error, info: ErrorInfo): void {+ // A WebGL that cannot be created is a stated fallback, not a silent one.+ console.warn("[society] figure viewer fell back to the palette tile:", error.message, info.componentStack);+ }++ render(): ReactNode {+ return this.state.failed ? this.props.fallback : this.props.children;+ }+}++export default AgentFigureViewer;diff --git a/jarvis/ui/web/frontend/src/components/society/figures/assembleFigure.ts b/jarvis/ui/web/frontend/src/components/society/figures/assembleFigure.tsnew file mode 100644index 0000000000..140a8fa4d9--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/figures/assembleFigure.ts@@ -0,0 +1,176 @@+/**+ * From one loaded base GLB to one agent's figure: a real skinned clone, the+ * recipe's palette painted into the sheet's strip, a Lambert material over+ * it, the mixer and its actions, and the scale that renders the source at+ * the recipe's height (docs/agent-society/character-pipeline.md §9.2).+ *+ * Pure with respect to React: the viewer and, later, the island's walkers+ * call this and own the result's lifetime (`dispose()`).+ */+import * as THREE from "three";+import { clone as cloneSkeleton } from "three/examples/jsm/utils/SkeletonUtils.js";++import { PALETTE_CELLS, type Palette } from "./figureRecipe";++/** `asset.extras.jarvis_figure`, as the build writes it. */+export interface FigureExtras {+ contract: number;+ archetype: string;+ variant: string;+ forward: string;+ /** Native height of the source mesh, metres. */+ height_m: number;+ target_height_m: number;+ clips: Record<string, { duration: number; loop: boolean; stride_m?: number }>;+}++/** The sheet layout the build wrote — mirrors scripts/figures/contract.json. */+export const SHEET = { size: 128, cellWidth: 8, cellHeight: 16 } as const;++export interface LoadedGltf {+ scene: THREE.Object3D;+ animations: THREE.AnimationClip[];+ parser: { json: { asset?: { extras?: { jarvis_figure?: FigureExtras } } } };+}++export function readFigureExtras(gltf: LoadedGltf): FigureExtras | null {+ return gltf.parser.json.asset?.extras?.jarvis_figure ?? null;+}++/** Pixel sheets sample nearest, carry no mipmaps and live in sRGB — re-asserted on every load. */+export function prepareSheetTexture(texture: THREE.Texture): void {+ texture.magFilter = THREE.NearestFilter;+ texture.minFilter = THREE.NearestFilter;+ texture.generateMipmaps = false;+ texture.colorSpace = THREE.SRGBColorSpace;+ texture.needsUpdate = true;+}++/**+ * The recipe's sixteen colours painted over the strip of the base sheet;+ * face and detail area stay untouched. One 128×128 upload per look.+ */+export function paintPalette(source: THREE.Texture, palette: Palette): THREE.CanvasTexture {+ const image = source.image as CanvasImageSource & { width: number; height: number };+ const canvas = document.createElement("canvas");+ canvas.width = image.width || SHEET.size;+ canvas.height = image.height || SHEET.size;+ const ctx = canvas.getContext("2d");+ if (ctx) {+ ctx.imageSmoothingEnabled = false;+ ctx.drawImage(image, 0, 0);+ PALETTE_CELLS.forEach((cell, index) => {+ ctx.fillStyle = palette[cell];+ ctx.fillRect(index * SHEET.cellWidth, 0, SHEET.cellWidth, SHEET.cellHeight);+ });+ }+ const painted = new THREE.CanvasTexture(canvas);+ painted.flipY = false; // glTF textures are top-down; the source was too+ prepareSheetTexture(painted);+ return painted;+}++export interface AssembledFigure {+ root: THREE.Group;+ mixer: THREE.AnimationMixer;+ actions: Record<string, THREE.AnimationAction>;+ extras: FigureExtras;+ /** Source units → rendered metres. */+ scale: number;+ dispose(): void;+}++/**+ * Clone the base for one agent. `SkeletonUtils.clone` is the only clone that+ * keeps a skinned mesh bound to ITS OWN skeleton copy; `Object3D.clone`+ * would leave every agent sharing one set of bones — and one pose.+ */+export function assembleFigure(+ gltf: LoadedGltf,+ palette: Palette,+ heightM: number,+): AssembledFigure | null {+ const extras = readFigureExtras(gltf);+ if (!extras) return null;+ const root = new THREE.Group();+ root.name = "figure";+ const body = cloneSkeleton(gltf.scene);+ const scale = extras.height_m > 0 ? heightM / extras.height_m : 1;+ body.scale.setScalar(scale);+ root.add(body);++ const owned: Array<{ dispose(): void }> = [];+ let painted: THREE.CanvasTexture | null = null;+ body.traverse((node) => {+ if (node.name === "FWD") node.visible = false;+ if (!(node instanceof THREE.Mesh)) return;+ const original = (Array.isArray(node.material) ? node.material[0] : node.material) as+ | THREE.MeshStandardMaterial+ | THREE.MeshBasicMaterial;+ const map = original.map ?? null;+ if (map && !painted) painted = paintPalette(map, palette);+ const material = new THREE.MeshLambertMaterial({+ map: painted ?? map,+ color: 0xffffff,+ });+ node.material = material;+ // A skinned mesh's bounds ignore its bones; culling it by the rest pose+ // hides a figure whose arms leave the box. Two draw calls are cheaper.+ node.frustumCulled = false;+ node.castShadow = false;+ node.receiveShadow = false;+ owned.push(material);+ });+ if (painted) owned.push(painted);++ const mixer = new THREE.AnimationMixer(body);+ const actions: Record<string, THREE.AnimationAction> = {};+ for (const clip of gltf.animations) {+ const action = mixer.clipAction(clip, body);+ const facts = extras.clips[clip.name];+ action.loop = facts && !facts.loop ? THREE.LoopOnce : THREE.LoopRepeat;+ action.clampWhenFinished = true;+ actions[clip.name] = action;+ }++ return {+ root,+ mixer,+ actions,+ extras,+ scale,+ dispose() {+ mixer.stopAllAction();+ mixer.uncacheRoot(body);+ for (const item of owned) item.dispose();+ root.clear();+ },+ };+}++/** Cross-fade to a clip; a one-shot clip returns to `fallback` when it ends. */+export function playClip(+ figure: AssembledFigure,+ name: string,+ fallback = "idle",+ fadeSeconds = 0.2,+): THREE.AnimationAction | null {+ const next = figure.actions[name] ?? figure.actions[fallback];+ if (!next) return null;+ for (const [clipName, action] of Object.entries(figure.actions)) {+ if (action === next) continue;+ if (action.isRunning()) action.fadeOut(fadeSeconds);+ void clipName;+ }+ next.reset().fadeIn(fadeSeconds).play();+ if (next.loop === THREE.LoopOnce) {+ const mixer = figure.mixer;+ const onFinished = (event: { action: THREE.AnimationAction }) => {+ if (event.action !== next) return;+ mixer.removeEventListener("finished", onFinished);+ playClip(figure, fallback, fallback, fadeSeconds);+ };+ mixer.addEventListener("finished", onFinished);+ }+ return next;+}diff --git a/jarvis/ui/web/frontend/src/components/society/figures/figureRecipe.ts b/jarvis/ui/web/frontend/src/components/society/figures/figureRecipe.tsnew file mode 100644index 0000000000..10292e2f7f--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/figures/figureRecipe.ts@@ -0,0 +1,220 @@+/**+ * A figure recipe is everything that tells one agent's character apart from+ * the next — archetype, base, parts and a 16-cell palette — without a byte of+ * new geometry (docs/agent-society/character-pipeline.md §9.1). It is the+ * JSON the roster row will carry as `figure_json`; until the backend lands,+ * the sample roster carries it inline.+ *+ * The cell order is the contract's (`scripts/figures/contract.json`): the+ * sheet's top strip holds these sixteen colours, 8 px wide each, and the+ * runtime repaints exactly those cells to recolour a figure.+ */++export const PALETTE_CELLS = [+ "skin",+ "skin_shade",+ "hair",+ "eyes",+ "primary",+ "primary_shade",+ "secondary",+ "secondary_shade",+ "accent",+ "metal",+ "leather",+ "fur",+ "fur_shade",+ "shoes",+ "eye_white",+ "emissive",+] as const;++export type PaletteCell = (typeof PALETTE_CELLS)[number];+export type Palette = Record<PaletteCell, string>;++export type FigureArchetype = "biped" | "quadruped" | "spirit";++export interface FigureRecipe {+ contract: 1;+ archetype: FigureArchetype;+ /** Base id: "small" | "medium" | "large" for a biped; an animal id for a quadruped. */+ base: string;+ /** slot → part id; an empty object is a complete, plainly dressed figure. */+ parts: Record<string, string>;+ /** Cells to repaint; every cell missing here keeps the archetype default. */+ palette?: Partial<Palette>;+ /** Rendered height in metres; the archetype/base default when absent. */+ heightM?: number;+}++/** The biped's default look — the built sheet's own strip, for a natural first figure. */+export const BIPED_DEFAULT_PALETTE: Palette = {+ skin: "#f4b68f",+ skin_shade: "#d99a75",+ hair: "#9e5d47",+ eyes: "#1b2427",+ primary: "#096153",+ primary_shade: "#07483d",+ secondary: "#b16f51",+ secondary_shade: "#008c55",+ accent: "#e8c46b",+ metal: "#919da2",+ leather: "#9a5944",+ fur: "#b87556",+ fur_shade: "#8d4c39",+ shoes: "#4a2e22",+ eye_white: "#e6ecef",+ emissive: "#ffd166",+};++/** The cells a person edits by hand; the shades derive from them. */+export const EDITABLE_CELLS: readonly PaletteCell[] = [+ "skin",+ "hair",+ "primary",+ "secondary",+ "accent",+ "shoes",+];++export interface PalettePreset {+ id: string;+ /** i18n key under `society.presets` */+ labelKey: string;+ palette: Partial<Palette>;+}++/** Hand-picked looks; a preset fills the editable cells, the rest derives. */+export const PALETTE_PRESETS: readonly PalettePreset[] = [+ {+ id: "executive",+ labelKey: "executive",+ palette: {+ skin: "#f1c4a0",+ hair: "#3b2a20",+ primary: "#1f2a44",+ secondary: "#f2f2ee",+ accent: "#c9a227",+ shoes: "#1a1a1a",+ leather: "#2b2b2b",+ metal: "#c9a227",+ },+ },+ {+ id: "ranger",+ labelKey: "ranger",+ palette: {+ skin: "#f4b68f",+ hair: "#9e5d47",+ primary: "#096153",+ secondary: "#b16f51",+ accent: "#e8c46b",+ shoes: "#4a2e22",+ },+ },+ {+ id: "archivist",+ labelKey: "archivist",+ palette: {+ skin: "#e9c3a3",+ hair: "#6b6b6b",+ primary: "#5a7a4f",+ secondary: "#e8dcc4",+ accent: "#e8c46b",+ shoes: "#3a2a1e",+ },+ },+ {+ id: "scout",+ labelKey: "scout",+ palette: {+ skin: "#d8a37c",+ hair: "#2a1d15",+ primary: "#c05b3c",+ secondary: "#efe0cd",+ accent: "#8fd0a0",+ shoes: "#2b2b2b",+ },+ },+ {+ id: "mage",+ labelKey: "mage",+ palette: {+ skin: "#f5ba95",+ hair: "#252124",+ primary: "#4a4673",+ secondary: "#b25729",+ accent: "#54b56b",+ shoes: "#201e3c",+ },+ },+];++/** Darken a hex colour by `amount` (0..1) for the derived shade cells. */+export function shade(hex: string, amount: number): string {+ const [r, g, b] = hexToRgb(hex);+ const f = 1 - amount;+ return rgbToHex(r * f, g * f, b * f);+}++export function hexToRgb(hex: string): [number, number, number] {+ const v = hex.replace("#", "");+ const n = parseInt(v.length === 3 ? v.split("").map((c) => c + c).join("") : v, 16);+ return [(n >> 16) & 255, (n >> 8) & 255, n & 255];+}++export function rgbToHex(r: number, g: number, b: number): string {+ const to = (x: number) => Math.round(Math.min(255, Math.max(0, x))).toString(16).padStart(2, "0");+ return `#${to(r)}${to(g)}${to(b)}`;+}++/**+ * The full 16-cell palette a recipe renders with: archetype defaults, the+ * recipe's cells on top, and the shade cells derived from their base cell+ * unless the recipe set them explicitly.+ */+export function resolvePalette(recipe: Pick<FigureRecipe, "palette"> | null | undefined): Palette {+ const explicit = recipe?.palette ?? {};+ const out: Palette = { ...BIPED_DEFAULT_PALETTE, ...explicit };+ if (!explicit.skin_shade && explicit.skin) out.skin_shade = shade(explicit.skin, 0.18);+ if (!explicit.primary_shade && explicit.primary) out.primary_shade = shade(explicit.primary, 0.22);+ if (!explicit.secondary_shade && explicit.secondary) {+ out.secondary_shade = shade(explicit.secondary, 0.22);+ }+ if (!explicit.fur_shade && explicit.fur) out.fur_shade = shade(explicit.fur, 0.2);+ return out;+}++/** A stable key for caching painted sheets and face crops per look. */+export function recipeKey(recipe: FigureRecipe): string {+ const palette = PALETTE_CELLS.map((c) => recipe.palette?.[c] ?? "").join(",");+ const parts = Object.entries(recipe.parts)+ .sort(([a], [b]) => a.localeCompare(b))+ .map(([k, v]) => `${k}=${v}`)+ .join(";");+ return `${recipe.archetype}/${recipe.base}|${parts}|${palette}|${recipe.heightM ?? ""}`;+}++/** The recipe a brand-new biped starts from: the default base, one preset, no parts. */+export function defaultRecipe(presetId = "ranger"): FigureRecipe {+ const preset = PALETTE_PRESETS.find((p) => p.id === presetId) ?? PALETTE_PRESETS[0];+ return { contract: 1, archetype: "biped", base: "medium", parts: {}, palette: { ...preset.palette } };+}++/** The three legacy roster colours (primary/secondary/accent) as recipe cells. */+export function paletteFromLegacy(p: { primary: string; secondary: string; accent: string }): Partial<Palette> {+ return { primary: p.primary, secondary: p.secondary, accent: p.accent };+}++/** A different but plausible look — for the "shuffle" button in the creator. */+export function shufflePalette(seed = Math.random()): Partial<Palette> {+ const pick = (list: readonly string[], k: number) => list[Math.floor(((seed * 9301 + k * 49297) % 233280) / 233280 * list.length)];+ return {+ skin: pick(["#f4b68f", "#e9c3a3", "#d8a37c", "#b87556", "#8d5b3f", "#f1c4a0"], 1),+ hair: pick(["#3b2a20", "#9e5d47", "#252124", "#6b6b6b", "#e0b989", "#c0392b"], 2),+ primary: pick(["#1f2a44", "#096153", "#5a7a4f", "#c05b3c", "#4a4673", "#7d3620", "#2f6f8f"], 3),+ secondary: pick(["#f2f2ee", "#b16f51", "#e8dcc4", "#efe0cd", "#b25729", "#8fd0a0"], 4),+ accent: pick(["#c9a227", "#e8c46b", "#8fd0a0", "#ffd166", "#54b56b", "#d22227"], 5),+ shoes: pick(["#1a1a1a", "#4a2e22", "#3a2a1e", "#2b2b2b", "#201e3c"], 6),+ };+}diff --git a/jarvis/ui/web/frontend/src/components/society/figures/figureRegistry.ts b/jarvis/ui/web/frontend/src/components/society/figures/figureRegistry.tsnew file mode 100644index 0000000000..10a0040a9b--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/figures/figureRegistry.ts@@ -0,0 +1,42 @@+/**+ * The only module that names figure files. Everything else asks it for the+ * asset behind a recipe (docs/agent-society/character-pipeline.md §9.2).+ *+ * Every GLB here is produced by `scripts/figures/build_figures.py` and+ * validated by `scripts/ci/check_society_figures.py`; importing it through+ * Vite yields a fingerprinted URL, so a rebuilt figure never serves stale.+ */+import bipedMediumUrl from "@/assets/society/figures/biped-medium.glb";++import type { FigureArchetype, FigureRecipe } from "./figureRecipe";++export interface FigureAsset {+ url: string;+ archetype: FigureArchetype;+ base: string;+ /** Rendered height when the recipe names none. */+ defaultHeightM: number;+}++export const FIGURE_BASES: Readonly<Record<string, FigureAsset>> = {+ "biped/medium": {+ url: bipedMediumUrl,+ archetype: "biped",+ base: "medium",+ defaultHeightM: 1.75,+ },+};++/** Bases a person can pick today, per archetype — the creator disables the rest. */+export const AVAILABLE_BASES: Readonly<Record<FigureArchetype, readonly string[]>> = {+ biped: ["medium"],+ quadruped: [],+ spirit: [],+};++export function figureAssetFor(recipe: Pick<FigureRecipe, "archetype" | "base">): FigureAsset | null {+ return FIGURE_BASES[`${recipe.archetype}/${recipe.base}`] ?? null;+}++/** Every asset URL, for preloading the moment the section opens. */+export const FIGURE_URLS: readonly string[] = Object.values(FIGURE_BASES).map((a) => a.url);diff --git a/jarvis/ui/web/frontend/src/components/society/mockRoster.ts b/jarvis/ui/web/frontend/src/components/society/mockRoster.tsnew file mode 100644index 0000000000..5af5e53259--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/mockRoster.ts@@ -0,0 +1,169 @@+/**+ * Sample roster — stands in for society.db until the M1 backend is bound.+ *+ * Every value is deliberately static sample data (fixed timestamps, no chat+ * sessions) and the roster rail shows a "sample data" badge, so the preview+ * never pretends to be live state (the loading-states rule: an empty or+ * mocked surface must say so, not invent numbers).+ *+ * The first row is the demo of the lead: Jarvis as the society's chief+ * executive — a human figure in a dark suit who owns the whole team and+ * delegates everything (maintainer direction 2026-09-01). Every row carries+ * a figure recipe so the card, the rail and the island agree on the look.+ */+import type { SocietyAgent } from "./data";+import type { FigureRecipe } from "./figures/figureRecipe";++/** 2026-08-20 12:00 UTC — a stable "recently active" anchor for sample rows. */+const SAMPLE_LAST_ACTIVE_MS = Date.UTC(2026, 7, 20, 12, 0, 0);+const SAMPLE_CREATED_MS = Date.UTC(2026, 7, 1, 9, 0, 0);++const LEAD_FIGURE: FigureRecipe = {+ contract: 1,+ archetype: "biped",+ base: "medium",+ parts: {},+ palette: {+ skin: "#f1c4a0",+ hair: "#3b2a20",+ primary: "#1f2a44",+ secondary: "#f2f2ee",+ accent: "#c9a227",+ metal: "#c9a227",+ leather: "#2b2b2b",+ shoes: "#1a1a1a",+ },+ heightM: 1.82,+};++const SCOUT_FIGURE: FigureRecipe = {+ contract: 1,+ archetype: "biped",+ base: "medium",+ parts: {},+ palette: {+ skin: "#d8a37c",+ hair: "#2a1d15",+ primary: "#c05b3c",+ secondary: "#efe0cd",+ accent: "#8fd0a0",+ shoes: "#2b2b2b",+ },+};++const ARCHIVIST_FIGURE: FigureRecipe = {+ contract: 1,+ archetype: "biped",+ base: "medium",+ parts: {},+ palette: {+ skin: "#e9c3a3",+ hair: "#6b6b6b",+ primary: "#5a7a4f",+ secondary: "#e8dcc4",+ accent: "#e8c46b",+ shoes: "#3a2a1e",+ },+ heightM: 1.7,+};++export const SAMPLE_ROSTER: SocietyAgent[] = [+ {+ agentId: "jarvis",+ name: "Jarvis",+ title: "Chief executive — leads and delegates the whole team",+ description: [+ "You are the lead of this agent society: its chief executive.",+ "You own the goals, not the tasks. Every request that reaches you is triaged,",+ "shaped into a clear assignment and handed to the orchestrator or specialist",+ "whose title fits; you never do a specialist's work yourself.",+ "You keep the team small, the hand-offs written (what was done, evidence, what",+ "remains, who owns the next step) and the spend inside the daily budget.",+ "Ask-tier actions always wait for the person; you never route around an approval.",+ "You speak for the team in the person's language and report outcomes, not activity.",+ ].join(" "),+ tier: "lead",+ provider: "anthropic",+ providerLabel: "Anthropic",+ model: "claude-sonnet-5",+ figure: LEAD_FIGURE,+ palette: { primary: "#1f2a44", secondary: "#f2f2ee", accent: "#c9a227" },+ grantMode: "all",+ toolGrants: ["delegate-to-agent", "society-status", "approvals"],+ permissionCeiling: "ask",+ dailyBudgetUsd: 10,+ checkpoint: "idle",+ state: "idle",+ createdMs: SAMPLE_CREATED_MS,+ chatSessionId: null,+ routines: [+ {+ id: "jarvis-daily-standup",+ label: "Morning stand-up digest",+ schedule: "daily 08:00",+ nextFire: "2026-09-02T08:00:00Z",+ },+ ],+ stats: { runs: 42, totalCostUsd: 6.1, lastActiveMs: SAMPLE_LAST_ACTIVE_MS },+ },+ {+ agentId: "scout",+ name: "Scout",+ title: "Research orchestrator",+ description:+ "You own research. You break a question into sources, read broadly, keep evidence links and hand back a brief with what remains open.",+ tier: "orchestrator",+ provider: "anthropic",+ providerLabel: "Anthropic",+ model: "claude-sonnet-5",+ figure: SCOUT_FIGURE,+ palette: { primary: "#c05b3c", secondary: "#efe0cd", accent: "#8fd0a0" },+ grantMode: "all",+ toolGrants: ["web_search", "web_fetch", "files_read", "knowledge_write"],+ permissionCeiling: "monitor",+ dailyBudgetUsd: 5,+ checkpoint: "desk",+ state: "working",+ createdMs: SAMPLE_CREATED_MS,+ chatSessionId: null,+ routines: [+ {+ id: "scout-morning-brief",+ label: "Morning research brief",+ schedule: "daily 07:00",+ nextFire: "2026-09-02T07:00:00Z",+ },+ ],+ stats: { runs: 128, totalCostUsd: 14.7, lastActiveMs: SAMPLE_LAST_ACTIVE_MS },+ },+ {+ agentId: "archivist",+ name: "Archivist",+ title: "Knowledge curator",+ description:+ "You own the shared memory. You turn finished work into short, sourced wiki notes under your namespace and propose what deserves promotion to shared knowledge.",+ tier: "specialist",+ provider: "ollama",+ providerLabel: "Ollama (local)",+ model: "qwen3:8b",+ figure: ARCHIVIST_FIGURE,+ palette: { primary: "#5a7a4f", secondary: "#e8dcc4", accent: "#e8c46b" },+ grantMode: "allowlist",+ toolGrants: ["knowledge_write", "knowledge_search", "files_read"],+ permissionCeiling: "safe",+ dailyBudgetUsd: 0.5,+ checkpoint: "archive",+ state: "waiting",+ createdMs: SAMPLE_CREATED_MS,+ chatSessionId: null,+ routines: [+ {+ id: "archivist-nightly-curation",+ label: "Nightly curation pass",+ schedule: "daily 23:30",+ nextFire: "2026-09-01T23:30:00Z",+ },+ ],+ stats: { runs: 311, totalCostUsd: 0.9, lastActiveMs: SAMPLE_LAST_ACTIVE_MS },+ },+];diff --git a/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.tsx b/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.tsxnew file mode 100644index 0000000000..e48ce9b0cc--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/roster/RosterRail.tsx@@ -0,0 +1,137 @@+/**+ * The fixed agents rail beside the stage (MASTERPLAN §4.1): one row per+ * agent — swatch, name, title, state dot — a search field and the "+" that+ * opens the creator. One click on a row opens the model card (the row-click+ * doctrine: open and activate in one click, never a double-click split).+ *+ * The rail is app chrome: Ink & Paper tokens, both modes. The world beside+ * it carries its own branding; nothing here leaks into the viewport.+ */+import { useMemo, useState } from "react";+import { Plus, Search } from "lucide-react";++import { Badge } from "@/components/ui/badge";+import { Button } from "@/components/ui/button";+import { ScrollArea } from "@/components/ui/scroll-area";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";++import { AgentSwatch } from "../AgentSwatch";+import type { AgentRunState, SocietyAgent } from "../data";++const STATE_DOT: Record<AgentRunState, string> = {+ idle: "bg-muted-foreground/50",+ working: "bg-success",+ waiting: "bg-warning",+ paused: "bg-muted-foreground/30",+};++export interface RosterRailProps {+ agents: SocietyAgent[];+ loading: boolean;+ /** True while rows come from the sample roster rather than society.db. */+ sample: boolean;+ activeAgentId: string | null;+ onOpen: (agentId: string) => void;+ onCreate: () => void;+}++export function RosterRail({ agents, loading, sample, activeAgentId, onOpen, onCreate }: RosterRailProps) {+ const t = useT();+ const [query, setQuery] = useState("");++ const rows = useMemo(() => {+ const q = query.trim().toLowerCase();+ const list = q+ ? agents.filter((a) => `${a.name} ${a.title}`.toLowerCase().includes(q))+ : agents;+ // Lead first, then orchestrators, then specialists; stable within a tier.+ const rank = { lead: 0, orchestrator: 1, specialist: 2 } as const;+ return [...list].sort((a, b) => rank[a.tier] - rank[b.tier]);+ }, [agents, query]);++ return (+ <aside+ data-testid="society-roster-rail"+ className="flex h-full w-[300px] shrink-0 flex-col border-l border-border bg-sidebar"+ >+ <div className="flex items-center justify-between gap-2 px-3 pt-3">+ <div className="flex min-w-0 items-center gap-2">+ <h2 className="font-display text-sm font-semibold tracking-tight text-foreground">+ {t("society.roster.title")}+ </h2>+ {sample ? (+ <Badge variant="outline" className="text-[10px]">+ {t("society.sample_badge")}+ </Badge>+ ) : null}+ </div>+ <Button+ size="sm"+ variant="secondary"+ className="h-8 gap-1 px-2.5"+ onClick={onCreate}+ data-testid="society-create-button"+ >+ <Plus className="h-3.5 w-3.5" aria-hidden />+ {t("society.roster.create")}+ </Button>+ </div>+ <label className="relative mx-3 mt-3 block">+ <Search+ className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"+ aria-hidden+ />+ <input+ type="search"+ value={query}+ onChange={(e) => setQuery(e.target.value)}+ placeholder={t("society.roster.search")}+ aria-label={t("society.roster.search")}+ className="h-8 w-full rounded-md border border-border bg-background pl-8 pr-2 text-[13px] text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-strong"+ />+ </label>+ <ScrollArea className="mt-2 min-h-0 flex-1">+ <ul className="flex flex-col gap-0.5 px-2 pb-3">+ {loading && rows.length === 0 ? (+ <li className="px-2 py-3 text-xs text-muted-foreground">{t("society.roster.loading")}</li>+ ) : null}+ {!loading && rows.length === 0 ? (+ <li className="px-2 py-3 text-xs text-muted-foreground">{t("society.roster.empty")}</li>+ ) : null}+ {rows.map((agent) => (+ <li key={agent.agentId}>+ <button+ type="button"+ onClick={() => onOpen(agent.agentId)}+ aria-current={agent.agentId === activeAgentId ? "true" : undefined}+ className={cn(+ "flex w-full items-center gap-2.5 rounded-md px-2 py-2 text-left transition-colors hover:bg-secondary",+ agent.agentId === activeAgentId && "bg-secondary",+ )}+ >+ <AgentSwatch agent={agent} size={34} />+ <span className="min-w-0 flex-1">+ <span className="flex items-center gap-1.5">+ <span className="truncate text-[13px] font-medium text-foreground">{agent.name}</span>+ {agent.tier === "lead" ? (+ <Badge variant="secondary" className="px-1.5 py-0 text-[10px]">+ {t("society.tier.lead")}+ </Badge>+ ) : null}+ </span>+ <span className="block truncate text-[11px] text-muted-foreground">{agent.title}</span>+ </span>+ <span+ className={cn("h-2 w-2 shrink-0 rounded-full", STATE_DOT[agent.state])}+ title={t(`society.state.${agent.state}`)}+ aria-label={t(`society.state.${agent.state}`)}+ />+ </button>+ </li>+ ))}+ </ul>+ </ScrollArea>+ </aside>+ );+}diff --git a/jarvis/ui/web/frontend/src/glb-assets.d.ts b/jarvis/ui/web/frontend/src/glb-assets.d.tsnew file mode 100644index 0000000000..4d58092391--- /dev/null+++ b/jarvis/ui/web/frontend/src/glb-assets.d.ts@@ -0,0 +1,9 @@+/**+ * A `.glb` import resolves to its fingerprinted asset URL — Vite treats the+ * extension as a known asset type, TypeScript does not know it until told.+ * The society's figures ride this (docs/agent-society/character-pipeline.md §4.2).+ */+declare module "*.glb" {+ const src: string;+ export default src;+}diff --git a/jarvis/ui/web/frontend/src/hooks/useCanvasAwake.ts b/jarvis/ui/web/frontend/src/hooks/useCanvasAwake.tsnew file mode 100644index 0000000000..687f88b32b--- /dev/null+++ b/jarvis/ui/web/frontend/src/hooks/useCanvasAwake.ts@@ -0,0 +1,35 @@+/**+ * Should a canvas be rendering frames right now?+ *+ * Answered with an IntersectionObserver on the canvas host — the ONLY signal+ * this shell can be trusted on. `document.hidden` is explicitly not consulted:+ * the WebView2 host reports an on-screen window as hidden for minutes at a+ * time (docs/BUGS.md, the visibility class), so gating on it parks scenes the+ * user is looking at. `display: none` and scrolled-out-of-view both read as+ * non-intersecting, which covers section switches and hidden sticky views.+ *+ * The society README mandates this pattern for every world/card canvas.+ */+import { useEffect, useState, type RefObject } from "react";++export function useCanvasAwake(hostRef: RefObject<HTMLElement | null>): boolean {+ const [awake, setAwake] = useState(true);++ useEffect(() => {+ const host = hostRef.current;+ if (!host) return;+ if (typeof IntersectionObserver === "undefined") return; // old shells: stay awake+ const observer = new IntersectionObserver(+ (entries) => {+ for (const entry of entries) setAwake(entry.isIntersecting);+ },+ { threshold: 0.05 },+ );+ observer.observe(host);+ return () => observer.disconnect();+ }, [hostRef]);++ return awake;+}++export default useCanvasAwake;diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex afebdd927b..c9047a84d3 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -5087,5 +5087,127 @@"go": "Los geht's","mode_realtime": "Live-Stimme","mode_pipeline": "Stimme rein und raus"+ },+ "society": {+ "sample_badge": "Beispieldaten",+ "roster": {+ "title": "Agenten",+ "create": "Neu",+ "search": "Agenten suchen",+ "loading": "Agenten werden geladen…",+ "empty": "Kein Agent passt."+ },+ "tier": {+ "lead": "Leitung",+ "orchestrator": "Orchestrator",+ "specialist": "Spezialist"+ },+ "state": {+ "idle": "Untätig",+ "working": "Arbeitet",+ "waiting": "Wartet",+ "paused": "Pausiert"+ },+ "ceiling": {+ "safe": "Sicher",+ "monitor": "Beobachten",+ "ask": "Erst fragen"+ },+ "grant": {+ "all": "Alle verbundenen Werkzeuge",+ "allowlist": "Nur Erlaubnisliste"+ },+ "checkpoint": {+ "desk": "Werkstatt-Tisch",+ "meeting": "Besprechungspavillon",+ "archive": "Archiv",+ "gate": "Hafentor",+ "idle": "Unterwegs"+ },+ "card": {+ "specs": "Daten",+ "figure": "Figur",+ "chat": "Chat",+ "close": "Schließen",+ "brain": "Gehirn",+ "description": "Ständige Anweisungen",+ "permission": "Berechtigungsgrenze",+ "budget": "Tagesbudget",+ "grant_mode": "Werkzeuge",+ "place": "In der Welt",+ "tools": "Freigegebene Werkzeuge",+ "no_tools": "Noch keine Werkzeuge freigegeben.",+ "routines": "Routinen",+ "no_routines": "Noch keine Routinen.",+ "runs": "Läufe",+ "cost": "Ausgegeben",+ "last_active": "Zuletzt aktiv",+ "never": "nie",+ "chat_empty_title": "Noch kein Gespräch",+ "chat_empty_hint": "Der Chat des Agenten öffnet sich hier, sobald das Society-Backend seine Sitzung anbindet."+ },+ "figure": {+ "drag_hint": "Ziehen zum Drehen und Kippen · Rad zum Zoomen · Doppelklick setzt zurück",+ "reduced_motion": "Reduzierte Bewegung: Die Figur hält ihre Pose. Ziehen dreht sie weiterhin.",+ "unavailable": "3D ist hier nicht verfügbar — die Farben des Agenten stehen ein.",+ "no_figure": "Dieser Agent hat noch keine Figur."+ },+ "strip": {+ "title": "Gesellschaft",+ "active": "{0} aktiv",+ "world_pending": "Die Insel kommt mit dem nächsten Meilenstein; bis dahin bleibt die Tafel."+ },+ "presets": {+ "executive": "Vorstand",+ "ranger": "Waldläufer",+ "archivist": "Archivar",+ "scout": "Späher",+ "mage": "Magier"+ },+ "base": {+ "small": "Klein",+ "medium": "Mittel",+ "large": "Groß"+ },+ "cell": {+ "skin": "Haut",+ "hair": "Haar",+ "primary": "Kleidung",+ "secondary": "Besatz",+ "accent": "Akzent",+ "shoes": "Schuhe"+ },+ "create": {+ "title": "Agent erstellen",+ "subtitle": "Name, Aufgabe und Regelwerk — die Figur rechts ist, wie das Team ihn sehen wird.",+ "name": "Name",+ "name_placeholder": "Späher",+ "title_field": "Titel",+ "title_placeholder": "Recherche-Späher",+ "title_fallback": "Spezialist",+ "description": "Beschreibung",+ "description_placeholder": "Was dieser Agent verantwortet, wie er arbeitet und wo er zuerst fragen muss.",+ "description_hint": "Ständige Anweisungen — das eigene Regelwerk des Agenten. Einzelaufgaben gehören in den Chat.",+ "advanced": "Erweitert",+ "provider": "Anbieter",+ "provider_unknown": "Kein Anbieterkatalog erreichbar — der Agent behält das Standardgehirn von Jarvis.",+ "catalog_loading": "Anbieterkatalog wird geladen…",+ "model": "Modell",+ "model_placeholder": "Anbieter-Standard",+ "ceiling": "Berechtigungsgrenze",+ "grant_mode": "Werkzeuge",+ "budget": "Tagesbudget (USD)",+ "look": "Aussehen",+ "base": "Statur",+ "base_soon": "Kommt mit dem nächsten Figurenbau",+ "presets": "Vorlagen",+ "colours": "Farben",+ "shuffle": "Mischen",+ "height": "Größe",+ "cancel": "Abbrechen",+ "submit": "Agent erstellen",+ "name_required": "Gib dem Agenten zuerst einen Namen.",+ "error": "Der Agent konnte nicht erstellt werden."+ }}}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex a73eb8bdcc..1ee1d166dc 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -5087,5 +5087,127 @@"go": "Let's go","mode_realtime": "live voice","mode_pipeline": "voice in and out"+ },+ "society": {+ "sample_badge": "Sample data",+ "roster": {+ "title": "Agents",+ "create": "New",+ "search": "Search agents",+ "loading": "Loading agents…",+ "empty": "No agent matches."+ },+ "tier": {+ "lead": "Lead",+ "orchestrator": "Orchestrator",+ "specialist": "Specialist"+ },+ "state": {+ "idle": "Idle",+ "working": "Working",+ "waiting": "Waiting",+ "paused": "Paused"+ },+ "ceiling": {+ "safe": "Safe",+ "monitor": "Monitor",+ "ask": "Ask first"+ },+ "grant": {+ "all": "All connected tools",+ "allowlist": "Allow-list only"+ },+ "checkpoint": {+ "desk": "Workshop desk",+ "meeting": "Meeting pavilion",+ "archive": "Archive",+ "gate": "Harbor gate",+ "idle": "Wandering"+ },+ "card": {+ "specs": "Specs",+ "figure": "Figure",+ "chat": "Chat",+ "close": "Close",+ "brain": "Brain",+ "description": "Standing instructions",+ "permission": "Permission ceiling",+ "budget": "Daily budget",+ "grant_mode": "Tools",+ "place": "In the world",+ "tools": "Granted tools",+ "no_tools": "No tools granted yet.",+ "routines": "Routines",+ "no_routines": "No routines yet.",+ "runs": "Runs",+ "cost": "Spent",+ "last_active": "Last active",+ "never": "never",+ "chat_empty_title": "No conversation yet",+ "chat_empty_hint": "The agent's chat opens here once the society backend binds its session."+ },+ "figure": {+ "drag_hint": "Drag to turn and tilt · wheel to zoom · double-click to reset",+ "reduced_motion": "Motion reduced: the figure holds its pose. Drag still turns it.",+ "unavailable": "3D is unavailable here — the agent's colours stand in.",+ "no_figure": "This agent has no figure yet."+ },+ "strip": {+ "title": "Society",+ "active": "{0} active",+ "world_pending": "The island arrives with the next milestone; the board stays until then."+ },+ "presets": {+ "executive": "Executive",+ "ranger": "Ranger",+ "archivist": "Archivist",+ "scout": "Scout",+ "mage": "Mage"+ },+ "base": {+ "small": "Small",+ "medium": "Medium",+ "large": "Large"+ },+ "cell": {+ "skin": "Skin",+ "hair": "Hair",+ "primary": "Outfit",+ "secondary": "Trim",+ "accent": "Accent",+ "shoes": "Shoes"+ },+ "create": {+ "title": "Create an agent",+ "subtitle": "Name, job and rulebook — the character on the right is how the team will see it.",+ "name": "Name",+ "name_placeholder": "Scout",+ "title_field": "Title",+ "title_placeholder": "Research scout",+ "title_fallback": "Specialist",+ "description": "Description",+ "description_placeholder": "What this agent owns, how it works, and where it must ask first.",+ "description_hint": "Standing instructions — the agent's own rulebook. One-off tasks go in the chat.",+ "advanced": "Advanced",+ "provider": "Provider",+ "provider_unknown": "No provider catalog reachable — the agent keeps Jarvis' default brain.",+ "catalog_loading": "Loading the provider catalog…",+ "model": "Model",+ "model_placeholder": "provider default",+ "ceiling": "Permission ceiling",+ "grant_mode": "Tools",+ "budget": "Daily budget (USD)",+ "look": "Look",+ "base": "Build",+ "base_soon": "Arrives with the next figure build",+ "presets": "Presets",+ "colours": "Colours",+ "shuffle": "Shuffle",+ "height": "Height",+ "cancel": "Cancel",+ "submit": "Create agent",+ "name_required": "Give the agent a name first.",+ "error": "The agent could not be created."+ }}}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 9c26eb9a90..e378d352ce 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -5087,5 +5087,127 @@"go": "Vamos","mode_realtime": "voz en vivo","mode_pipeline": "voz de entrada y salida"+ },+ "society": {+ "sample_badge": "Datos de ejemplo",+ "roster": {+ "title": "Agentes",+ "create": "Nuevo",+ "search": "Buscar agentes",+ "loading": "Cargando agentes…",+ "empty": "Ningún agente coincide."+ },+ "tier": {+ "lead": "Líder",+ "orchestrator": "Orquestador",+ "specialist": "Especialista"+ },+ "state": {+ "idle": "Inactivo",+ "working": "Trabajando",+ "waiting": "Esperando",+ "paused": "En pausa"+ },+ "ceiling": {+ "safe": "Seguro",+ "monitor": "Supervisar",+ "ask": "Preguntar primero"+ },+ "grant": {+ "all": "Todas las herramientas conectadas",+ "allowlist": "Solo lista permitida"+ },+ "checkpoint": {+ "desk": "Mesa del taller",+ "meeting": "Pabellón de reuniones",+ "archive": "Archivo",+ "gate": "Puerta del puerto",+ "idle": "Paseando"+ },+ "card": {+ "specs": "Ficha",+ "figure": "Figura",+ "chat": "Chat",+ "close": "Cerrar",+ "brain": "Cerebro",+ "description": "Instrucciones permanentes",+ "permission": "Límite de permisos",+ "budget": "Presupuesto diario",+ "grant_mode": "Herramientas",+ "place": "En el mundo",+ "tools": "Herramientas concedidas",+ "no_tools": "Aún no hay herramientas concedidas.",+ "routines": "Rutinas",+ "no_routines": "Aún no hay rutinas.",+ "runs": "Ejecuciones",+ "cost": "Gastado",+ "last_active": "Última actividad",+ "never": "nunca",+ "chat_empty_title": "Aún no hay conversación",+ "chat_empty_hint": "El chat del agente se abre aquí cuando el backend de la sociedad vincule su sesión."+ },+ "figure": {+ "drag_hint": "Arrastra para girar e inclinar · rueda para acercar · doble clic restablece",+ "reduced_motion": "Movimiento reducido: la figura mantiene su pose. Arrastrar sigue girándola.",+ "unavailable": "El 3D no está disponible aquí — los colores del agente lo sustituyen.",+ "no_figure": "Este agente aún no tiene figura."+ },+ "strip": {+ "title": "Sociedad",+ "active": "{0} activos",+ "world_pending": "La isla llega con el próximo hito; hasta entonces queda el tablero."+ },+ "presets": {+ "executive": "Ejecutivo",+ "ranger": "Guardabosques",+ "archivist": "Archivista",+ "scout": "Explorador",+ "mage": "Mago"+ },+ "base": {+ "small": "Pequeño",+ "medium": "Mediano",+ "large": "Grande"+ },+ "cell": {+ "skin": "Piel",+ "hair": "Pelo",+ "primary": "Ropa",+ "secondary": "Ribete",+ "accent": "Acento",+ "shoes": "Zapatos"+ },+ "create": {+ "title": "Crear un agente",+ "subtitle": "Nombre, cargo y reglas — la figura de la derecha es como lo verá el equipo.",+ "name": "Nombre",+ "name_placeholder": "Explorador",+ "title_field": "Cargo",+ "title_placeholder": "Explorador de investigación",+ "title_fallback": "Especialista",+ "description": "Descripción",+ "description_placeholder": "Qué posee este agente, cómo trabaja y dónde debe preguntar primero.",+ "description_hint": "Instrucciones permanentes — el reglamento propio del agente. Las tareas puntuales van al chat.",+ "advanced": "Avanzado",+ "provider": "Proveedor",+ "provider_unknown": "No hay catálogo de proveedores — el agente conserva el cerebro predeterminado de Jarvis.",+ "catalog_loading": "Cargando el catálogo de proveedores…",+ "model": "Modelo",+ "model_placeholder": "predeterminado del proveedor",+ "ceiling": "Límite de permisos",+ "grant_mode": "Herramientas",+ "budget": "Presupuesto diario (USD)",+ "look": "Aspecto",+ "base": "Complexión",+ "base_soon": "Llega con la próxima construcción de figuras",+ "presets": "Plantillas",+ "colours": "Colores",+ "shuffle": "Mezclar",+ "height": "Altura",+ "cancel": "Cancelar",+ "submit": "Crear agente",+ "name_required": "Primero dale un nombre al agente.",+ "error": "No se pudo crear el agente."+ }}}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.tsnew file mode 100644index 0000000000..56c1febc13--- /dev/null+++ b/jarvis/ui/web/frontend/src/i18n/society-i18n-parity.test.ts@@ -0,0 +1,92 @@+/**+ * Every `society.*` key the society surfaces ask for must exist in en — and+ * de/es must carry exactly the keys en carries in that block. The keys are+ * read from the source files themselves, so a roster, card or creator string+ * added without its translations fails here, not in front of a person.+ * Modelled on agent-chat-i18n-parity.test.ts.+ */+import { readFileSync, readdirSync, statSync } from "node:fs";+import { join } from "node:path";+import { describe, expect, it } from "vitest";+import en from "./locales/en.json";+import de from "./locales/de.json";+import es from "./locales/es.json";++function flatten(obj: Record<string, unknown>, prefix = ""): string[] {+ const out: string[] = [];+ for (const [k, v] of Object.entries(obj)) {+ const key = prefix ? `${prefix}.${k}` : k;+ if (v && typeof v === "object" && !Array.isArray(v)) {+ out.push(...flatten(v as Record<string, unknown>, key));+ } else {+ out.push(key);+ }+ }+ 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"));+}++const SRC = join(__dirname, "..");+const ROOTS = [join(SRC, "components", "society"), join(SRC, "views", "society")];++function walk(dir: string): string[] {+ const out: string[] = [];+ for (const entry of readdirSync(dir)) {+ const full = join(dir, entry);+ if (statSync(full).isDirectory()) out.push(...walk(full));+ else if (/\.tsx?$/.test(entry) && !/\.test\.tsx?$/.test(entry)) out.push(full);+ }+ return out;+}++/** Literal keys (`t("society.x.y")`) plus the enum-driven prefixes (`t(\`society.state.${…}\`)`). */+function usedKeys(): { literal: Set<string>; prefixes: Set<string> } {+ const literal = new Set<string>();+ const prefixes = new Set<string>();+ for (const file of ROOTS.flatMap(walk)) {+ const text = readFileSync(file, "utf8");+ for (const m of text.matchAll(/t\(\s*"(society\.[a-z0-9_.]+)"\s*\)/g)) literal.add(m[1]);+ for (const m of text.matchAll(/t\(\s*`(society\.[a-z0-9_.]+)\.\$\{/g)) prefixes.add(m[1]);+ }+ return { literal, prefixes };+}++describe("society i18n parity", () => {+ const enKeys = blockKeys(en as Record<string, unknown>);++ it("en carries a society block", () => {+ expect(enKeys.size).toBeGreaterThan(20);+ });++ it("every literal key the society surfaces use exists in en", () => {+ const { literal } = usedKeys();+ expect(literal.size).toBeGreaterThan(10);+ const missing = [...literal].filter((k) => !enKeys.has(k));+ expect(missing).toEqual([]);+ });++ it("every enum-driven prefix has at least one key in en", () => {+ const { prefixes } = usedKeys();+ for (const prefix of prefixes) {+ const hit = [...enKeys].some((k) => k.startsWith(`${prefix}.`));+ expect(hit, `no keys under ${prefix}`).toBe(true);+ }+ });++ it("de and es carry exactly the society keys en carries", () => {+ for (const [name, loc] of [+ ["de", de],+ ["es", es],+ ] as const) {+ const keys = blockKeys(loc 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/society/SocietyView.tsx b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsxnew file mode 100644index 0000000000..144030300d--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx@@ -0,0 +1,72 @@+/**+ * The Agents section as the society (MASTERPLAN §4.1): left, the app's own+ * sidebar (unchanged, outside this view); centre, the stage; right, the fixed+ * agents rail. A thin strip above the stage carries the counts. Clicking a+ * row in the rail opens the model card above the stage; "+" opens the creator.+ *+ * The stage is the existing Jarvis-Agents board until the island (M3, built in+ * a parallel session under components/society/world/) mounts here — the+ * board then moves to the Ledger tab. The section keeps its id "agents", so+ * deep links, the navigate tool and the section parity tests are untouched.+ */+import { lazy, Suspense, useCallback, useMemo, useState } from "react";++import { useT } from "@/i18n";+import { AgentCardOverlay } from "@/components/society/card/AgentCardOverlay";+import { CreateAgentDialog } from "@/components/society/create/CreateAgentDialog";+import { useSocietyRoster } from "@/components/society/data";+import { RosterRail } from "@/components/society/roster/RosterRail";++const JarvisAgentsBoard = lazy(() =>+ import("@/views/JarvisAgentsView").then((m) => ({ default: m.JarvisAgentsView })),+);++export function SocietyView() {+ const t = useT();+ const roster = useSocietyRoster();+ const agents = useMemo(() => roster.data ?? [], [roster.data]);+ const [openAgentId, setOpenAgentId] = useState<string | null>(null);+ const [creating, setCreating] = useState(false);++ const openAgent = useMemo(+ () => agents.find((a) => a.agentId === openAgentId) ?? null,+ [agents, openAgentId],+ );+ const activeCount = agents.filter((a) => a.state === "working" || a.state === "waiting").length;++ const onCreated = useCallback((agentId: string) => {+ setCreating(false);+ setOpenAgentId(agentId);+ }, []);++ 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">+ <div className="flex h-9 shrink-0 items-center gap-3 border-b border-border px-4 text-xs text-muted-foreground">+ <span className="font-medium text-foreground">{t("society.strip.title")}</span>+ <span aria-live="polite">+ {t("society.strip.active").replace("{0}", String(activeCount))}+ </span>+ <span className="ml-auto">{t("society.strip.world_pending")}</span>+ </div>+ <div className="relative min-h-0 flex-1">+ <Suspense fallback={null}>+ <JarvisAgentsBoard />+ </Suspense>+ </div>+ </div>+ <RosterRail+ agents={agents}+ loading={roster.isLoading}+ sample+ activeAgentId={openAgentId}+ onOpen={setOpenAgentId}+ onCreate={() => setCreating(true)}+ />+ <AgentCardOverlay agent={openAgent} onClose={() => setOpenAgentId(null)} />+ <CreateAgentDialog open={creating} onClose={() => setCreating(false)} onCreated={onCreated} />+ </div>+ );+}++export default SocietyView;diff --git a/jarvis/ui/web/frontend/vite.config.ts b/jarvis/ui/web/frontend/vite.config.tsindex 4b6fc0e8d4..b0d5b4f333 100644--- a/jarvis/ui/web/frontend/vite.config.ts+++ b/jarvis/ui/web/frontend/vite.config.ts@@ -68,6 +68,9 @@ function materialIconAssets(): Plugin {export default defineConfig({plugins: [react(), materialIconAssets(), missingNameGate(__dirname)],+ // The society's figures are binary glTF; Vite serves them as fingerprinted+ // assets (docs/agent-society/character-pipeline.md §4.2).+ assetsInclude: ["**/*.glb"],resolve: {alias: {"@": path.resolve(__dirname, "./src"),