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(figures): four bases, fifteen parts, a generated catalog, and the figure on the island
rubenluetke10-beep29e46dc283e4
diff --git a/jarvis/ui/web/frontend/src/assets/society/figures/SOURCES.md b/jarvis/ui/web/frontend/src/assets/society/figures/SOURCES.mdindex e267a11450..7e8b6e73f9 100644--- a/jarvis/ui/web/frontend/src/assets/society/figures/SOURCES.md+++ b/jarvis/ui/web/frontend/src/assets/society/figures/SOURCES.md@@ -1,13 +1,37 @@# Figure assets — provenance ledger-One row per shipped file (docs/agent-society/character-pipeline.md §11, gate check 15). Every-GLB here is produced by `scripts/figures/build_figures.py` from the recorded source; nothing is-hand-exported. Sources are fetched by URL into `scripts/figures/cache/` and verified by sha256-before the build touches them (`scripts/figures/sources/*.json`).+GENERATED by `scripts/figures/build_figures.py` — one row per shipped file+(docs/agent-society/character-pipeline.md §11, gate check 15). Every GLB here is+produced from the recorded source; nothing is hand-exported. Sources are fetched by URL+into `scripts/figures/cache/` and verified by sha256 before the build touches them+(`scripts/figures/sources/*.json`).-| File | Source | License | Source sha256 | What the build changed |-|---|---|---|---|---|-| `biped-medium.glb` | KayKit Character Pack: Adventurers 1.0 — `Rogue.glb` (Kay Lousberg, kaylousberg.com) | CC0-1.0 | `e825437cd4d2ee9c1960b517a74a69101e33eb409ae7fa8cedc7134a998fbb7d` | kept the six body meshes, joined them into one; dropped 18 IK/control bones; renamed 23 deform bones to the contract; kept 9 of 76 clips, renamed, root XZ zeroed, loops closed; faces re-UV'd onto the 16-cell palette strip of a generated 128×128 sheet; `FWD` marker; extras |+| File | Source | License | What the build changed |+|---|---|---|---|+| `biped-barbarian.glb` | KayKit Character Pack: Adventurers 1.0 / Barbarian | CC0-1.0 | body meshes joined; IK/control bones dropped; 23 deform bones renamed; clips kept/renamed, root XZ zeroed, loops closed; faces re-UV'd onto the palette strip; hair as its own primitive; FWD marker; extras |+| `biped-knight.glb` | KayKit Character Pack: Adventurers 1.0 / Knight | CC0-1.0 | body meshes joined; IK/control bones dropped; 23 deform bones renamed; clips kept/renamed, root XZ zeroed, loops closed; faces re-UV'd onto the palette strip; hair as its own primitive; FWD marker; extras |+| `biped-mage.glb` | KayKit Character Pack: Adventurers 1.0 / Mage | CC0-1.0 | body meshes joined; IK/control bones dropped; 23 deform bones renamed; clips kept/renamed, root XZ zeroed, loops closed; faces re-UV'd onto the palette strip; hair as its own primitive; FWD marker; extras |+| `biped-rogue.glb` | KayKit Character Pack: Adventurers 1.0 / Rogue | CC0-1.0 | body meshes joined; IK/control bones dropped; 23 deform bones renamed; clips kept/renamed, root XZ zeroed, loops closed; faces re-UV'd onto the palette strip; hair as its own primitive; FWD marker; extras |+| `back-fur-cape.glb` | KayKit Character Pack: Adventurers 1.0 / Barbarian_Cape | CC0-1.0 | unparented at rest, skinned to `chest` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `back-knight-cape.glb` | KayKit Character Pack: Adventurers 1.0 / Knight_Cape | CC0-1.0 | unparented at rest, skinned to `chest` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `back-mage-cape.glb` | KayKit Character Pack: Adventurers 1.0 / Mage_Cape | CC0-1.0 | unparented at rest, skinned to `chest` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `back-rogue-cape.glb` | KayKit Character Pack: Adventurers 1.0 / Rogue_Cape | CC0-1.0 | unparented at rest, skinned to `chest` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `hand_l-round-shield.glb` | KayKit Character Pack: Adventurers 1.0 / Round_Shield | CC0-1.0 | unparented at rest, skinned to `handslot_l` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `hand_l-spellbook.glb` | KayKit Character Pack: Adventurers 1.0 / Spellbook | CC0-1.0 | unparented at rest, skinned to `handslot_l` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `hand_l-wooden-shield.glb` | KayKit Character Pack: Adventurers 1.0 / Barbarian_Round_Shield | CC0-1.0 | unparented at rest, skinned to `handslot_l` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `hand_r-axe.glb` | KayKit Character Pack: Adventurers 1.0 / 1H_Axe | CC0-1.0 | unparented at rest, skinned to `handslot_r` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `hand_r-knife.glb` | KayKit Character Pack: Adventurers 1.0 / Knife | CC0-1.0 | unparented at rest, skinned to `handslot_r` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `hand_r-mug.glb` | KayKit Character Pack: Adventurers 1.0 / Mug | CC0-1.0 | unparented at rest, skinned to `handslot_r` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `hand_r-staff.glb` | KayKit Character Pack: Adventurers 1.0 / 2H_Staff | CC0-1.0 | unparented at rest, skinned to `handslot_r` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `hand_r-sword.glb` | KayKit Character Pack: Adventurers 1.0 / 1H_Sword | CC0-1.0 | unparented at rest, skinned to `handslot_r` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `headgear-horned-hat.glb` | KayKit Character Pack: Adventurers 1.0 / Barbarian_Hat | CC0-1.0 | unparented at rest, skinned to `head` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `headgear-knight-helmet.glb` | KayKit Character Pack: Adventurers 1.0 / Knight_Helmet | CC0-1.0 | unparented at rest, skinned to `head` with weight 1; re-UV'd onto the palette strip; no clips; extras |+| `headgear-mage-hat.glb` | KayKit Character Pack: Adventurers 1.0 / Mage_Hat | CC0-1.0 | unparented at rest, skinned to `head` with weight 1; re-UV'd onto the palette strip; no clips; extras |-Licenses recorded at fetch time (2026-09-01): CC0 — free for personal, educational and commercial-use, no attribution required. Credit is given anyway: KayKit by Kay Lousberg.+- **KayKit Character Pack: Adventurers 1.0** — Kay Lousberg (kaylousberg.com), CC0-1.0 (https://github.com/KayKit-Game-Assets/KayKit-Character-Pack-Adventures-1.0/blob/main/LICENSE.txt); files:+ - `Rogue.glb` sha256 `e825437cd4d2ee9c1960b517a74a69101e33eb409ae7fa8cedc7134a998fbb7d`+ - `Knight.glb` sha256 `60428e3abc09ba83e595d256e3af8c5c976b46cdae599f0802fc82b4a3445168`+ - `Mage.glb` sha256 `cf898585da33fab50c724d31605fb931eb2912e6d2280092141e98ca81ad507d`+ - `Barbarian.glb` sha256 `cefc311a0e10c7858b6141f5ada7e33268727564fb8ac1347aab97d000669cc6`++Licenses recorded at fetch time. CC0 needs no attribution; credit is given anyway.diff --git a/jarvis/ui/web/frontend/src/assets/society/figures/biped-barbarian.glb b/jarvis/ui/web/frontend/src/assets/society/figures/biped-barbarian.glbnew file mode 100644index 0000000000..af20922178Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/biped-barbarian.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/biped-knight.glb b/jarvis/ui/web/frontend/src/assets/society/figures/biped-knight.glbnew file mode 100644index 0000000000..25680663ceBinary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/biped-knight.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/biped-mage.glb b/jarvis/ui/web/frontend/src/assets/society/figures/biped-mage.glbnew file mode 100644index 0000000000..f083f90370Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/biped-mage.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/biped-medium.glb b/jarvis/ui/web/frontend/src/assets/society/figures/biped-rogue.glbsimilarity index 58%rename from jarvis/ui/web/frontend/src/assets/society/figures/biped-medium.glbrename to jarvis/ui/web/frontend/src/assets/society/figures/biped-rogue.glbindex 1a69afebb4..3317035a7a 100644Binary files a/jarvis/ui/web/frontend/src/assets/society/figures/biped-medium.glb and b/jarvis/ui/web/frontend/src/assets/society/figures/biped-rogue.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/back-fur-cape.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/back-fur-cape.glbnew file mode 100644index 0000000000..673c9bf79aBinary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/back-fur-cape.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/back-knight-cape.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/back-knight-cape.glbnew file mode 100644index 0000000000..609f02f9deBinary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/back-knight-cape.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/back-mage-cape.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/back-mage-cape.glbnew file mode 100644index 0000000000..86480d2b81Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/back-mage-cape.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/back-rogue-cape.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/back-rogue-cape.glbnew file mode 100644index 0000000000..00e42a50deBinary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/back-rogue-cape.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_l-round-shield.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_l-round-shield.glbnew file mode 100644index 0000000000..c6260d2b9cBinary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_l-round-shield.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_l-spellbook.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_l-spellbook.glbnew file mode 100644index 0000000000..222d918481Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_l-spellbook.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_l-wooden-shield.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_l-wooden-shield.glbnew file mode 100644index 0000000000..6e2fdc34d8Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_l-wooden-shield.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-axe.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-axe.glbnew file mode 100644index 0000000000..a2d865c56cBinary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-axe.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-knife.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-knife.glbnew file mode 100644index 0000000000..7505847381Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-knife.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-mug.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-mug.glbnew file mode 100644index 0000000000..2ee7db460fBinary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-mug.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-staff.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-staff.glbnew file mode 100644index 0000000000..81745f10dcBinary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-staff.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-sword.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-sword.glbnew file mode 100644index 0000000000..843bae16c1Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/hand_r-sword.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/headgear-horned-hat.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/headgear-horned-hat.glbnew file mode 100644index 0000000000..296a5e70caBinary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/headgear-horned-hat.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/headgear-knight-helmet.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/headgear-knight-helmet.glbnew file mode 100644index 0000000000..68f8a1c87aBinary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/headgear-knight-helmet.glb differdiff --git a/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/headgear-mage-hat.glb b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/headgear-mage-hat.glbnew file mode 100644index 0000000000..254b8e91c4Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/figures/parts/biped/headgear-mage-hat.glb differdiff --git a/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsx b/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsxindex bed43d3762..e9e483dbe3 100644--- a/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsx+++ b/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsx@@ -34,9 +34,8 @@ import {type FigureRecipe,type PaletteCell,} from "../figures/figureRecipe";-import { AVAILABLE_BASES } from "../figures/figureRegistry";+import { basesForStyle, partsForSlot, slotsWithParts, stylesWithBases, CATALOG } 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;@@ -55,6 +54,7 @@ export function CreateAgentDialog({ open, onClose, onCreated }: CreateAgentDialoconst [title, setTitle] = useState("");const [description, setDescription] = useState("");const [recipe, setRecipe] = useState<FigureRecipe>(() => defaultRecipe("ranger"));+ const [style, setStyle] = useState<string>("modern");const [providerId, setProviderId] = useState("");const [model, setModel] = useState("");const [ceiling, setCeiling] = useState<PermissionCeiling>("monitor");@@ -347,19 +347,55 @@ export function CreateAgentDialog({ open, onClose, onCreated }: CreateAgentDialo</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.style")}</span>+ <Segmented+ value={style}+ options={Object.keys(CATALOG.styles).map((id) => ({+ value: id,+ label: t(`society.style.${id}`),+ disabled: !stylesWithBases().includes(id),+ hint: stylesWithBases().includes(id) ? undefined : t("society.create.style_soon"),+ }))}+ onChange={(next) => {+ setStyle(next);+ const first = basesForStyle(next)[0];+ if (first && !basesForStyle(next).some((b) => b.base === recipe.base)) {+ setRecipe((r) => ({ ...r, base: first.base, parts: {}, style: next }));+ }+ }}+ />+ </div><div className="flex items-center gap-3"><span className="w-16 text-[11px] text-muted-foreground">{t("society.create.base")}</span><Segmentedvalue={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 }))}+ options={basesForStyle(style).map((b) => ({ value: b.base, label: b.label }))}+ onChange={(base) => setRecipe((r) => ({ ...r, base, style }))}/></div>+ {slotsWithParts("biped").map((slot) => (+ <div key={slot} className="flex items-center gap-3">+ <span className="w-16 text-[11px] text-muted-foreground">{t(`society.slot.${slot}`)}</span>+ <div className="flex flex-wrap gap-1">+ <Segmented+ value={recipe.parts[slot] ?? ""}+ options={[+ { value: "", label: t("society.create.none") },+ ...partsForSlot(slot, "biped", null).map((part) => ({ value: part.id, label: part.label })),+ ]}+ onChange={(id) =>+ setRecipe((r) => {+ const parts = { ...r.parts };+ if (id) parts[slot] = id;+ else delete parts[slot];+ return { ...r, parts };+ })+ }+ />+ </div>+ </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">diff --git a/jarvis/ui/web/frontend/src/components/society/figures/AgentFigureViewer.tsx b/jarvis/ui/web/frontend/src/components/society/figures/AgentFigureViewer.tsxindex 1d8a12f9ef..2c5fd31621 100644--- a/jarvis/ui/web/frontend/src/components/society/figures/AgentFigureViewer.tsx+++ b/jarvis/ui/web/frontend/src/components/society/figures/AgentFigureViewer.tsx@@ -16,7 +16,6 @@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";@@ -28,9 +27,10 @@ import { useWebglSurface } from "@/hooks/useWebglSurface";import { useT } from "@/i18n";import { cn } from "@/lib/utils";-import { assembleFigure, playClip, type AssembledFigure, type LoadedGltf } from "./assembleFigure";+import { assembleFigure, playClip, type AssembledFigure } from "./assembleFigure";import { recipeKey, resolvePalette, type FigureRecipe } from "./figureRecipe";import { figureAssetFor } from "./figureRegistry";+import { useFigureAssets } from "./useFigureAssets";/** Target resolution the pixel pass renders the column at (docs §9.3). */const PIXEL_TARGET_WIDTH = 240;@@ -137,7 +137,7 @@ export function AgentFigureViewer({ recipe, clip = "idle", quiet = false, classN><Suspense fallback={null}><FigureScene- url={asset.url}+ recipe={recipe}look={look}palette={palette}heightM={heightM}@@ -166,7 +166,7 @@ export function AgentFigureViewer({ recipe, clip = "idle", quiet = false, classN// ---------------------------------------------------------------------------interface SceneProps {- url: string;+ recipe: FigureRecipe;look: string;palette: ReturnType<typeof resolvePalette>;heightM: number;@@ -177,8 +177,9 @@ interface SceneProps {orbitTick: number;}-function FigureScene({ url, look, palette, heightM, clip, quiet, paused, orbit, orbitTick }: SceneProps) {- const gltf = useGLTF(url) as unknown as LoadedGltf;+function FigureScene({ recipe, look, palette, heightM, clip, quiet, paused, orbit, orbitTick }: SceneProps) {+ const assets = useFigureAssets(recipe);+ const gltf = assets.base;const camera = useThree((s) => s.camera);const invalidate = useThree((s) => s.invalidate);const groupRef = useRef<THREE.Group>(null);@@ -186,7 +187,12 @@ function FigureScene({ url, look, palette, heightM, clip, quiet, paused, orbit,// One assembled figure per look; the previous one is disposed first.useEffect(() => {- const figure = assembleFigure(gltf, palette, heightM);+ const figure = assembleFigure(+ gltf,+ palette,+ heightM,+ assets.parts.map((p) => p.gltf),+ );figureRef.current = figure;const group = groupRef.current;if (figure && group) group.add(figure.root);diff --git a/jarvis/ui/web/frontend/src/components/society/figures/FigureRig.tsx b/jarvis/ui/web/frontend/src/components/society/figures/FigureRig.tsxnew file mode 100644index 0000000000..ada933b739--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/figures/FigureRig.tsx@@ -0,0 +1,122 @@+/**+ * One agent's figure as an R3F node — the piece the island's walkers and the+ * model card share (docs/agent-society/character-pipeline.md §9.2).+ *+ * It renders INSIDE someone else's Canvas and owns no WebGL context; the+ * mount (WorldStage, AgentFigureViewer) is what goes through `useWebglSurface`.+ *+ * Driving it: `drive.current` carries the wanted clip and the ground speed+ * every frame, without a React render on the way (the walker sim writes it+ * in `useFrame`). The rig picks walk/run by the figure's own stride+ * (`extras.clips.*.stride_m`), so the feet plant at any speed and any size.+ */+import { Suspense, useEffect, useRef } from "react";+import { useFrame } from "@react-three/fiber";+import type { Group } from "three";++import { assembleFigure, playClip, type AssembledFigure } from "./assembleFigure";+import { recipeKey, resolvePalette, type FigureRecipe } from "./figureRecipe";+import { figureAssetFor } from "./figureRegistry";+import { preloadFigureAssets, useFigureAssets } from "./useFigureAssets";++export type FigureMode = "idle" | "walk" | "work" | "talk" | "sit" | "sleep" | "celebrate" | "wave";++export interface FigureDrive {+ mode: FigureMode;+ /** Ground speed in m/s; only read while `mode === "walk"`. */+ speed: number;+}++/** Play the walk this much slower/faster at most before switching clips (§6.3). */+const TIME_SCALE_MIN = 0.7;+const TIME_SCALE_MAX = 1.4;++export interface FigureRigProps {+ recipe: FigureRecipe;+ drive: { current: FigureDrive };+ paused: boolean;+ /** Rendered height; the recipe's or the base default when absent. */+ heightM?: number;+ onReady?: (figure: AssembledFigure) => void;+}++export function FigureRig(props: FigureRigProps) {+ if (!figureAssetFor(props.recipe)) return null;+ return (+ <Suspense fallback={null}>+ <LoadedRig {...props} />+ </Suspense>+ );+}++function LoadedRig({ recipe, drive, paused, heightM, onReady }: FigureRigProps) {+ const assets = useFigureAssets(recipe);+ const height = heightM ?? recipe.heightM ?? assets.defaultHeightM;+ const groupRef = useRef<Group>(null);+ const figureRef = useRef<AssembledFigure | null>(null);+ const playing = useRef<{ clip: string; timeScale: number }>({ clip: "", timeScale: 1 });+ const look = recipeKey(recipe);++ useEffect(() => {+ const palette = resolvePalette(recipe);+ const figure = assembleFigure(+ assets.base,+ palette,+ height,+ assets.parts.map((p) => p.gltf),+ );+ const group = groupRef.current;+ figureRef.current = figure;+ playing.current = { clip: "", timeScale: 1 };+ if (figure && group) group.add(figure.root);+ if (figure) onReady?.(figure);+ return () => {+ if (figure && group) group.remove(figure.root);+ figure?.dispose();+ figureRef.current = null;+ };+ // `look` is the recipe's identity (base, parts, palette, height).+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [assets.base, look, height]);++ useFrame((_, dt) => {+ const figure = figureRef.current;+ if (!figure) return;+ const d = drive.current;+ let clip: string = d.mode;+ let timeScale = 1;+ if (d.mode === "walk") {+ const walk = figure.extras.clips.walk;+ const run = figure.extras.clips.run;+ const nominal = (walk?.stride_m ?? 0) > 0 ? ((walk.stride_m ?? 0) * figure.scale) / walk.duration : 0;+ const walkScale = nominal > 0 ? d.speed / nominal : 1;+ if (run && run.stride_m && walkScale > TIME_SCALE_MAX) {+ const runNominal = (run.stride_m * figure.scale) / run.duration;+ clip = "run";+ timeScale = clamp(d.speed / runNominal, TIME_SCALE_MIN, TIME_SCALE_MAX);+ } else {+ timeScale = clamp(walkScale, TIME_SCALE_MIN, TIME_SCALE_MAX);+ }+ if (d.speed <= 0.05) clip = "idle";+ }+ if (!figure.actions[clip]) clip = "idle";+ const current = playing.current;+ if (current.clip !== clip) {+ playClip(figure, clip, "idle");+ current.clip = clip;+ }+ if (Math.abs(current.timeScale - timeScale) > 0.01) {+ figure.actions[clip]?.setEffectiveTimeScale(timeScale);+ current.timeScale = timeScale;+ }+ if (!paused) figure.mixer.update(Math.min(dt, 0.1));+ });++ return <group ref={groupRef} />;+}++function clamp(value: number, lo: number, hi: number): number {+ return Math.min(hi, Math.max(lo, value));+}++export const preloadFigures = preloadFigureAssets;diff --git a/jarvis/ui/web/frontend/src/components/society/figures/assembleFigure.ts b/jarvis/ui/web/frontend/src/components/society/figures/assembleFigure.tsindex 140a8fa4d9..3143096a66 100644--- a/jarvis/ui/web/frontend/src/components/society/figures/assembleFigure.ts+++ b/jarvis/ui/web/frontend/src/components/society/figures/assembleFigure.ts@@ -27,16 +27,30 @@ export interface FigureExtras {/** The sheet layout the build wrote — mirrors scripts/figures/contract.json. */export const SHEET = { size: 128, cellWidth: 8, cellHeight: 16 } as const;+/** `asset.extras.jarvis_part`, as the build writes it. */+export interface PartExtras {+ contract: number;+ archetype: string;+ slot: string;+ attach: string;+ hides: string[];+ label: string;+}+export interface LoadedGltf {scene: THREE.Object3D;animations: THREE.AnimationClip[];- parser: { json: { asset?: { extras?: { jarvis_figure?: FigureExtras } } } };+ parser: { json: { asset?: { extras?: { jarvis_figure?: FigureExtras; jarvis_part?: PartExtras } } } };}export function readFigureExtras(gltf: LoadedGltf): FigureExtras | null {return gltf.parser.json.asset?.extras?.jarvis_figure ?? null;}+export function readPartExtras(gltf: LoadedGltf): PartExtras | null {+ return gltf.parser.json.asset?.extras?.jarvis_part ?? 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;@@ -89,6 +103,7 @@ export function assembleFigure(gltf: LoadedGltf,palette: Palette,heightM: number,+ parts: LoadedGltf[] = [],): AssembledFigure | null {const extras = readFigureExtras(gltf);if (!extras) return null;@@ -101,6 +116,8 @@ export function assembleFigure(const owned: Array<{ dispose(): void }> = [];let painted: THREE.CanvasTexture | null = null;+ const skinned: THREE.SkinnedMesh[] = [];+ const bodyMeshes: THREE.Mesh[] = [];body.traverse((node) => {if (node.name === "FWD") node.visible = false;if (!(node instanceof THREE.Mesh)) return;@@ -113,6 +130,7 @@ export function assembleFigure(map: painted ?? map,color: 0xffffff,});+ material.name = original.name;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.@@ -120,9 +138,35 @@ export function assembleFigure(node.castShadow = false;node.receiveShadow = false;owned.push(material);+ bodyMeshes.push(node);+ if (node instanceof THREE.SkinnedMesh) skinned.push(node);});if (painted) owned.push(painted);+ // Parts: skinned to the same 23 bones in the same order, so a part binds to+ // the body's skeleton with the body's bind matrix and follows every clip.+ const anchor = skinned[0] ?? null;+ const hidden = new Set<string>();+ for (const partGltf of parts) {+ const partExtras = readPartExtras(partGltf);+ if (!anchor || !partExtras) continue;+ partGltf.scene.traverse((node) => {+ if (!(node instanceof THREE.SkinnedMesh)) return;+ const material = new THREE.MeshLambertMaterial({ map: painted ?? undefined, color: 0xffffff });+ const mesh = new THREE.SkinnedMesh(node.geometry, material);+ mesh.name = `part:${partExtras.slot}`;+ mesh.frustumCulled = false;+ mesh.bind(anchor.skeleton, anchor.bindMatrix);+ anchor.parent?.add(mesh);+ owned.push(material);+ });+ for (const hide of partExtras.hides ?? []) hidden.add(hide);+ }+ for (const mesh of bodyMeshes) {+ const materialName = (mesh.material as THREE.Material).name ?? "";+ if (hidden.has("hair") && materialName.endsWith("-hair")) mesh.visible = false;+ }+const mixer = new THREE.AnimationMixer(body);const actions: Record<string, THREE.AnimationAction> = {};for (const clip of gltf.animations) {diff --git a/jarvis/ui/web/frontend/src/components/society/figures/catalog.json b/jarvis/ui/web/frontend/src/components/society/figures/catalog.jsonnew file mode 100644index 0000000000..7d71a4c283--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/figures/catalog.json@@ -0,0 +1,510 @@+{+ "contract": 1,+ "styles": {+ "modern": "Everyday people \u2014 offices, streets, workshops",+ "fantasy": "Knights, mages, rangers, barbarians, undead",+ "cartoon": "Chunky, big-headed, kart-racer proportions",+ "animal": "Four-legged companions",+ "scifi": "Robots, suits, visors",+ "spirit": "Ghosts and familiars",+ "custom": "Imported by the person"+ },+ "bases": [+ {+ "id": "biped/barbarian",+ "file": "biped-barbarian.glb",+ "archetype": "biped",+ "variant": "medium",+ "base": "barbarian",+ "label": "Barbarian",+ "styles": [+ "fantasy"+ ],+ "heightM": 1.75,+ "palette": {+ "skin": "#f6bf9a",+ "skin_shade": "#d9a37c",+ "hair": "#918880",+ "eyes": "#141a1c",+ "primary": "#4f6f86",+ "primary_shade": "#3a5266",+ "secondary": "#978f86",+ "secondary_shade": "#665850",+ "accent": "#e8c46b",+ "metal": "#7a8388",+ "leather": "#93523e",+ "fur": "#c5cfd3",+ "fur_shade": "#8e857d",+ "shoes": "#675950",+ "eye_white": "#e6ecef",+ "emissive": "#ffd166"+ },+ "source": "KayKit Character Pack: Adventurers 1.0 / Barbarian",+ "license": "CC0-1.0",+ "triangles": 4045,+ "clips": [+ "celebrate",+ "idle",+ "run",+ "sit",+ "sleep",+ "talk",+ "walk",+ "wave",+ "work"+ ],+ "height_m": 2.1863+ },+ {+ "id": "biped/knight",+ "file": "biped-knight.glb",+ "archetype": "biped",+ "variant": "medium",+ "base": "knight",+ "label": "Knight",+ "styles": [+ "fantasy"+ ],+ "heightM": 1.75,+ "palette": {+ "skin": "#f6c19d",+ "skin_shade": "#d9a37c",+ "hair": "#e0b989",+ "eyes": "#141a1c",+ "primary": "#c4212b",+ "primary_shade": "#3f4549",+ "secondary": "#95a1a7",+ "secondary_shade": "#b9c5c8",+ "accent": "#e8c46b",+ "metal": "#727c80",+ "leather": "#9c5b45",+ "fur": "#b87556",+ "fur_shade": "#8d4c39",+ "shoes": "#484f53",+ "eye_white": "#e6ecef",+ "emissive": "#ffd166"+ },+ "source": "KayKit Character Pack: Adventurers 1.0 / Knight",+ "license": "CC0-1.0",+ "triangles": 4148,+ "clips": [+ "celebrate",+ "idle",+ "run",+ "sit",+ "sleep",+ "talk",+ "walk",+ "wave",+ "work"+ ],+ "height_m": 2.3145+ },+ {+ "id": "biped/mage",+ "file": "biped-mage.glb",+ "archetype": "biped",+ "variant": "medium",+ "base": "mage",+ "label": "Mage",+ "styles": [+ "fantasy"+ ],+ "heightM": 1.75,+ "palette": {+ "skin": "#f5ba95",+ "skin_shade": "#d99a75",+ "hair": "#252124",+ "eyes": "#1b2427",+ "primary": "#4a4673",+ "primary_shade": "#242242",+ "secondary": "#b25729",+ "secondary_shade": "#cfd7da",+ "accent": "#2f6c73",+ "metal": "#8d989e",+ "leather": "#9a5944",+ "fur": "#b87556",+ "fur_shade": "#8d4c39",+ "shoes": "#995843",+ "eye_white": "#e6ecef",+ "emissive": "#ffd166"+ },+ "source": "KayKit Character Pack: Adventurers 1.0 / Mage",+ "license": "CC0-1.0",+ "triangles": 4029,+ "clips": [+ "celebrate",+ "idle",+ "run",+ "sit",+ "sleep",+ "talk",+ "walk",+ "wave",+ "work"+ ],+ "height_m": 2.2027+ },+ {+ "id": "biped/rogue",+ "file": "biped-rogue.glb",+ "archetype": "biped",+ "variant": "medium",+ "base": "rogue",+ "label": "Ranger",+ "styles": [+ "modern",+ "fantasy"+ ],+ "heightM": 1.75,+ "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"+ },+ "source": "KayKit Character Pack: Adventurers 1.0 / Rogue",+ "license": "CC0-1.0",+ "triangles": 4263,+ "clips": [+ "celebrate",+ "idle",+ "run",+ "sit",+ "sleep",+ "talk",+ "walk",+ "wave",+ "work"+ ],+ "height_m": 2.187+ }+ ],+ "parts": [+ {+ "id": "back-fur-cape",+ "file": "parts/biped/back-fur-cape.glb",+ "archetype": "biped",+ "slot": "back",+ "attach": "chest",+ "label": "Fur cape",+ "styles": [+ "fantasy"+ ],+ "hides": [],+ "from_base": "barbarian",+ "source": "KayKit Character Pack: Adventurers 1.0 / Barbarian_Cape",+ "license": "CC0-1.0",+ "palette_cells": {+ "secondary_shade": 78+ },+ "triangles": 78+ },+ {+ "id": "back-knight-cape",+ "file": "parts/biped/back-knight-cape.glb",+ "archetype": "biped",+ "slot": "back",+ "attach": "chest",+ "label": "Knight cape",+ "styles": [+ "fantasy"+ ],+ "hides": [],+ "from_base": "knight",+ "source": "KayKit Character Pack: Adventurers 1.0 / Knight_Cape",+ "license": "CC0-1.0",+ "palette_cells": {+ "primary": 84+ },+ "triangles": 84+ },+ {+ "id": "back-mage-cape",+ "file": "parts/biped/back-mage-cape.glb",+ "archetype": "biped",+ "slot": "back",+ "attach": "chest",+ "label": "Mage cape",+ "styles": [+ "fantasy"+ ],+ "hides": [],+ "from_base": "mage",+ "source": "KayKit Character Pack: Adventurers 1.0 / Mage_Cape",+ "license": "CC0-1.0",+ "palette_cells": {+ "metal": 84+ },+ "triangles": 84+ },+ {+ "id": "back-rogue-cape",+ "file": "parts/biped/back-rogue-cape.glb",+ "archetype": "biped",+ "slot": "back",+ "attach": "chest",+ "label": "Ranger cape",+ "styles": [+ "fantasy",+ "modern"+ ],+ "hides": [],+ "from_base": "rogue",+ "source": "KayKit Character Pack: Adventurers 1.0 / Rogue_Cape",+ "license": "CC0-1.0",+ "palette_cells": {+ "secondary_shade": 84+ },+ "triangles": 84+ },+ {+ "id": "hand_l-round-shield",+ "file": "parts/biped/hand_l-round-shield.glb",+ "archetype": "biped",+ "slot": "hand_l",+ "attach": "handslot_l",+ "label": "Round shield",+ "styles": [+ "fantasy"+ ],+ "hides": [],+ "from_base": "knight",+ "source": "KayKit Character Pack: Adventurers 1.0 / Round_Shield",+ "license": "CC0-1.0",+ "palette_cells": {+ "leather": 110,+ "metal": 174+ },+ "triangles": 284+ },+ {+ "id": "hand_l-spellbook",+ "file": "parts/biped/hand_l-spellbook.glb",+ "archetype": "biped",+ "slot": "hand_l",+ "attach": "handslot_l",+ "label": "Spellbook",+ "styles": [+ "fantasy",+ "modern"+ ],+ "hides": [],+ "from_base": "mage",+ "source": "KayKit Character Pack: Adventurers 1.0 / Spellbook",+ "license": "CC0-1.0",+ "palette_cells": {+ "accent": 82,+ "secondary_shade": 6,+ "leather": 132,+ "metal": 72+ },+ "triangles": 292+ },+ {+ "id": "hand_l-wooden-shield",+ "file": "parts/biped/hand_l-wooden-shield.glb",+ "archetype": "biped",+ "slot": "hand_l",+ "attach": "handslot_l",+ "label": "Wooden shield",+ "styles": [+ "fantasy"+ ],+ "hides": [],+ "from_base": "barbarian",+ "source": "KayKit Character Pack: Adventurers 1.0 / Barbarian_Round_Shield",+ "license": "CC0-1.0",+ "palette_cells": {+ "accent": 30,+ "secondary_shade": 30,+ "metal": 174,+ "leather": 50+ },+ "triangles": 284+ },+ {+ "id": "hand_r-axe",+ "file": "parts/biped/hand_r-axe.glb",+ "archetype": "biped",+ "slot": "hand_r",+ "attach": "handslot_r",+ "label": "Axe",+ "styles": [+ "fantasy"+ ],+ "hides": [],+ "from_base": "barbarian",+ "source": "KayKit Character Pack: Adventurers 1.0 / 1H_Axe",+ "license": "CC0-1.0",+ "palette_cells": {+ "leather": 80,+ "accent": 112,+ "metal": 82+ },+ "triangles": 274+ },+ {+ "id": "hand_r-knife",+ "file": "parts/biped/hand_r-knife.glb",+ "archetype": "biped",+ "slot": "hand_r",+ "attach": "handslot_r",+ "label": "Knife",+ "styles": [+ "fantasy"+ ],+ "hides": [],+ "from_base": "rogue",+ "source": "KayKit Character Pack: Adventurers 1.0 / Knife",+ "license": "CC0-1.0",+ "palette_cells": {+ "metal": 156,+ "leather": 16+ },+ "triangles": 172+ },+ {+ "id": "hand_r-mug",+ "file": "parts/biped/hand_r-mug.glb",+ "archetype": "biped",+ "slot": "hand_r",+ "attach": "handslot_r",+ "label": "Mug",+ "styles": [+ "modern",+ "fantasy"+ ],+ "hides": [],+ "from_base": "barbarian",+ "source": "KayKit Character Pack: Adventurers 1.0 / Mug",+ "license": "CC0-1.0",+ "palette_cells": {+ "leather": 144,+ "secondary": 84,+ "metal": 198+ },+ "triangles": 426+ },+ {+ "id": "hand_r-staff",+ "file": "parts/biped/hand_r-staff.glb",+ "archetype": "biped",+ "slot": "hand_r",+ "attach": "handslot_r",+ "label": "Staff",+ "styles": [+ "fantasy"+ ],+ "hides": [],+ "from_base": "mage",+ "source": "KayKit Character Pack: Adventurers 1.0 / 2H_Staff",+ "license": "CC0-1.0",+ "palette_cells": {+ "accent": 64,+ "leather": 216,+ "metal": 160+ },+ "triangles": 440+ },+ {+ "id": "hand_r-sword",+ "file": "parts/biped/hand_r-sword.glb",+ "archetype": "biped",+ "slot": "hand_r",+ "attach": "handslot_r",+ "label": "Sword",+ "styles": [+ "fantasy"+ ],+ "hides": [],+ "from_base": "knight",+ "source": "KayKit Character Pack: Adventurers 1.0 / 1H_Sword",+ "license": "CC0-1.0",+ "palette_cells": {+ "leather": 80,+ "metal": 220+ },+ "triangles": 300+ },+ {+ "id": "headgear-horned-hat",+ "file": "parts/biped/headgear-horned-hat.glb",+ "archetype": "biped",+ "slot": "headgear",+ "attach": "head",+ "label": "Horned hat",+ "styles": [+ "fantasy"+ ],+ "hides": [+ "hair"+ ],+ "from_base": "barbarian",+ "source": "KayKit Character Pack: Adventurers 1.0 / Barbarian_Hat",+ "license": "CC0-1.0",+ "palette_cells": {+ "eyes": 168,+ "secondary_shade": 392,+ "fur": 94+ },+ "triangles": 654+ },+ {+ "id": "headgear-knight-helmet",+ "file": "parts/biped/headgear-knight-helmet.glb",+ "archetype": "biped",+ "slot": "headgear",+ "attach": "head",+ "label": "Knight helmet",+ "styles": [+ "fantasy"+ ],+ "hides": [+ "hair"+ ],+ "from_base": "knight",+ "source": "KayKit Character Pack: Adventurers 1.0 / Knight_Helmet",+ "license": "CC0-1.0",+ "palette_cells": {+ "metal": 480+ },+ "triangles": 480+ },+ {+ "id": "headgear-mage-hat",+ "file": "parts/biped/headgear-mage-hat.glb",+ "archetype": "biped",+ "slot": "headgear",+ "attach": "head",+ "label": "Wizard hat",+ "styles": [+ "fantasy"+ ],+ "hides": [+ "hair"+ ],+ "from_base": "mage",+ "source": "KayKit Character Pack: Adventurers 1.0 / Mage_Hat",+ "license": "CC0-1.0",+ "palette_cells": {+ "primary": 260,+ "secondary": 72,+ "metal": 64+ },+ "triangles": 396+ }+ ]+}diff --git a/jarvis/ui/web/frontend/src/components/society/figures/figureRecipe.ts b/jarvis/ui/web/frontend/src/components/society/figures/figureRecipe.tsindex 10292e2f7f..22f960fc1d 100644--- a/jarvis/ui/web/frontend/src/components/society/figures/figureRecipe.ts+++ b/jarvis/ui/web/frontend/src/components/society/figures/figureRecipe.ts@@ -10,6 +10,8 @@* runtime repaints exactly those cells to recolour a figure.*/+import { catalogBaseFor } from "./figureRegistry";+export const PALETTE_CELLS = ["skin","skin_shade",@@ -37,14 +39,18 @@ 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. */+ /** Catalog base id: "rogue" | "knight" | "mage" | "barbarian" …; an animal id for a quadruped. */base: string;- /** slot → part id; an empty object is a complete, plainly dressed figure. */+ /** slot → catalog 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. */+ /** Cells to repaint; every cell missing here keeps the base's default. */palette?: Partial<Palette>;/** Rendered height in metres; the archetype/base default when absent. */heightM?: number;+ /** A person's own imported GLB (route C / the import lane): its URL replaces the catalog base. */+ model?: string;+ /** The style the look was picked from — metadata for the creator, never read by the runtime. */+ style?: string;}/** The biped's default look — the built sheet's own strip, for a natural first figure. */@@ -173,9 +179,15 @@ export function rgbToHex(r: number, g: number, b: number): string {* 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 {+export function resolvePalette(+ recipe: (Pick<FigureRecipe, "palette"> & Partial<Pick<FigureRecipe, "archetype" | "base">>) | null | undefined,+): Palette {const explicit = recipe?.palette ?? {};- const out: Palette = { ...BIPED_DEFAULT_PALETTE, ...explicit };+ const baseDefaults =+ recipe?.archetype && recipe.base+ ? (catalogBaseFor({ archetype: recipe.archetype, base: recipe.base })?.palette ?? null)+ : null;+ const out: Palette = { ...BIPED_DEFAULT_PALETTE, ...(baseDefaults ?? {}), ...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) {@@ -188,17 +200,18 @@ export function resolvePalette(recipe: Pick<FigureRecipe, "palette"> | null | un/** 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)+ const parts = Object.entries(recipe.parts ?? {})+ .filter(([, v]) => Boolean(v)).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => `${k}=${v}`).join(";");- return `${recipe.archetype}/${recipe.base}|${parts}|${palette}|${recipe.heightM ?? ""}`;+ return `${recipe.archetype}/${recipe.base}|${recipe.model ?? ""}|${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 {+/** The recipe a brand-new biped starts from: the ranger base, one preset, no parts. */+export function defaultRecipe(presetId = "ranger", base = "rogue"): FigureRecipe {const preset = PALETTE_PRESETS.find((p) => p.id === presetId) ?? PALETTE_PRESETS[0];- return { contract: 1, archetype: "biped", base: "medium", parts: {}, palette: { ...preset.palette } };+ return { contract: 1, archetype: "biped", base, parts: {}, palette: { ...preset.palette } };}/** The three legacy roster colours (primary/secondary/accent) as recipe cells. */diff --git a/jarvis/ui/web/frontend/src/components/society/figures/figureRegistry.ts b/jarvis/ui/web/frontend/src/components/society/figures/figureRegistry.tsindex 10a0040a9b..4bc62ccff4 100644--- a/jarvis/ui/web/frontend/src/components/society/figures/figureRegistry.ts+++ b/jarvis/ui/web/frontend/src/components/society/figures/figureRegistry.ts@@ -1,42 +1,175 @@/**- * 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).+ * The only module that knows where figure files are. Everything else asks it+ * for the asset behind a recipe or a part id (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.+ * `catalog.json` is GENERATED by `scripts/figures/build_figures.py` — every+ * base and part with its style tags, slot, attach bone, default palette and+ * source credit — and the GLBs beside it are imported through Vite, so each+ * resolves to a fingerprinted URL and a rebuilt figure never serves stale.*/-import bipedMediumUrl from "@/assets/society/figures/biped-medium.glb";+import catalogJson from "./catalog.json";-import type { FigureArchetype, FigureRecipe } from "./figureRecipe";+import type { FigureArchetype, FigureRecipe, Palette } from "./figureRecipe";++export interface CatalogBase {+ /** "biped/rogue" */+ id: string;+ file: string;+ archetype: FigureArchetype;+ variant: string;+ /** "rogue" — the value a recipe's `base` carries. */+ base: string;+ label: string;+ styles: string[];+ heightM: number;+ palette: Palette;+ source: string;+ license: string;+ triangles: number;+ clips: string[];+ height_m: number;+}++export interface CatalogPart {+ /** "headgear-knight-helmet" — the value a recipe's `parts[slot]` carries. */+ id: string;+ file: string;+ archetype: FigureArchetype;+ slot: string;+ attach: string;+ label: string;+ styles: string[];+ hides: string[];+ from_base: string;+ source: string;+ license: string;+ triangles: number;+}++export interface FigureCatalog {+ contract: number;+ styles: Record<string, string>;+ bases: CatalogBase[];+ parts: CatalogPart[];+}++export const CATALOG = catalogJson as FigureCatalog;++/** Every shipped GLB, keyed by its path under assets/society/figures/. */+const FILES = import.meta.glob("../../../assets/society/figures/**/*.glb", {+ query: "?url",+ import: "default",+ eager: true,+}) as Record<string, string>;++function urlForFile(file: string): string | null {+ const suffix = `/assets/society/figures/${file}`;+ for (const [key, url] of Object.entries(FILES)) {+ if (key.endsWith(suffix)) return url;+ }+ return null;+}++/** Base ids a recipe may still carry from before the catalog existed. */+const LEGACY_BASES: Record<string, string> = { medium: "rogue", small: "rogue", large: "rogue" };export interface FigureAsset {url: string;archetype: FigureArchetype;base: string;- /** Rendered height when the recipe names none. */defaultHeightM: number;+ palette: Palette | null;+ /** True when the base ships its hair as a second primitive that headgear may hide. */+ catalog: CatalogBase | null;}-export const FIGURE_BASES: Readonly<Record<string, FigureAsset>> = {- "biped/medium": {- url: bipedMediumUrl,- archetype: "biped",- base: "medium",- defaultHeightM: 1.75,- },-};+export function catalogBaseFor(recipe: Pick<FigureRecipe, "archetype" | "base">): CatalogBase | null {+ const base = LEGACY_BASES[recipe.base] ?? recipe.base;+ return CATALOG.bases.find((b) => b.archetype === recipe.archetype && b.base === base) ?? null;+}++/** The GLB behind a recipe: a catalog base, or the recipe's own imported model. */+export function figureAssetFor(+ recipe: Pick<FigureRecipe, "archetype" | "base"> & { model?: string; heightM?: number },+): FigureAsset | null {+ if (recipe.model) {+ return {+ url: recipe.model,+ archetype: recipe.archetype,+ base: recipe.base,+ defaultHeightM: recipe.heightM ?? 1.75,+ palette: null,+ catalog: null,+ };+ }+ const entry = catalogBaseFor(recipe);+ if (!entry) return null;+ const url = urlForFile(entry.file);+ if (!url) return null;+ return {+ url,+ archetype: entry.archetype,+ base: entry.base,+ defaultHeightM: entry.heightM,+ palette: entry.palette,+ catalog: entry,+ };+}++export interface PartAsset {+ url: string;+ part: CatalogPart;+}-/** Bases a person can pick today, per archetype — the creator disables the rest. */+export function partAssetFor(partId: string): PartAsset | null {+ const part = CATALOG.parts.find((p) => p.id === partId);+ if (!part) return null;+ const url = urlForFile(part.file);+ return url ? { url, part } : null;+}++/** The parts a recipe wears, resolved; unknown ids are dropped, not fatal. */+export function partAssetsFor(recipe: Pick<FigureRecipe, "parts">): PartAsset[] {+ return Object.values(recipe.parts ?? {})+ .map((id) => (id ? partAssetFor(id) : null))+ .filter((p): p is PartAsset => p !== null);+}++/** Styles that have at least one base today, in catalog order; the creator disables the rest. */+export function stylesWithBases(): string[] {+ const live = new Set(CATALOG.bases.flatMap((b) => b.styles));+ return Object.keys(CATALOG.styles).filter((s) => live.has(s));+}++export function basesForStyle(style: string | null, archetype: FigureArchetype = "biped"): CatalogBase[] {+ return CATALOG.bases.filter((b) => b.archetype === archetype && (!style || b.styles.includes(style)));+}++export function partsForSlot(slot: string, archetype: FigureArchetype = "biped", style: string | null = null): CatalogPart[] {+ return CATALOG.parts.filter(+ (p) => p.archetype === archetype && p.slot === slot && (!style || p.styles.includes(style)),+ );+}++/** Slots any catalog part fills for an archetype, in the contract's order of the parts list. */+export function slotsWithParts(archetype: FigureArchetype = "biped"): string[] {+ const seen: string[] = [];+ for (const p of CATALOG.parts) {+ if (p.archetype === archetype && !seen.includes(p.slot)) seen.push(p.slot);+ }+ return seen;+}++/** Every asset URL, for preloading the moment the section opens. */+export const FIGURE_URLS: readonly string[] = Object.values(FILES);++/**+ * Bases the creator can pick today, per archetype — keyed by the legacy+ * small/medium/large ids the dialog still offers. The catalog's own `base`+ * names (rogue, …) stay inside the catalog; this list is the dialog's.+ */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/figures/useFigureAssets.ts b/jarvis/ui/web/frontend/src/components/society/figures/useFigureAssets.tsnew file mode 100644index 0000000000..0af104f4e3--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/figures/useFigureAssets.ts@@ -0,0 +1,46 @@+/**+ * Load everything one recipe needs — the base GLB and each worn part — through+ * drei's cache, so thirty walkers wearing the same helmet parse it once.+ * Suspends until every file is in; callers wrap it in <Suspense>.+ */+import { useGLTF } from "@react-three/drei";++import type { LoadedGltf } from "./assembleFigure";+import type { FigureRecipe } from "./figureRecipe";+import { figureAssetFor, partAssetsFor, type CatalogPart } from "./figureRegistry";++export interface LoadedFigureAssets {+ base: LoadedGltf;+ parts: Array<{ gltf: LoadedGltf; part: CatalogPart }>;+ defaultHeightM: number;+}++export function figureUrls(recipe: FigureRecipe): { base: string; parts: ReturnType<typeof partAssetsFor> } | null {+ const asset = figureAssetFor(recipe);+ if (!asset) return null;+ return { base: asset.url, parts: partAssetsFor(recipe) };+}++/** Suspends. Call only when `figureAssetFor(recipe)` is non-null. */+export function useFigureAssets(recipe: FigureRecipe): LoadedFigureAssets {+ const asset = figureAssetFor(recipe);+ const parts = partAssetsFor(recipe);+ const urls = [asset?.url ?? "", ...parts.map((p) => p.url)].filter(Boolean);+ const loaded = useGLTF(urls) as unknown as LoadedGltf[];+ return {+ base: loaded[0],+ parts: parts.map((p, i) => ({ gltf: loaded[i + 1], part: p.part })),+ defaultHeightM: asset?.defaultHeightM ?? 1.75,+ };+}++/** Warm the cache for every base and part the roster wears, the moment the section opens. */+export function preloadFigureAssets(recipes: Array<FigureRecipe | null>): void {+ for (const recipe of recipes) {+ if (!recipe) continue;+ const urls = figureUrls(recipe);+ if (!urls) continue;+ useGLTF.preload(urls.base);+ for (const p of urls.parts) useGLTF.preload(p.url);+ }+}diff --git a/jarvis/ui/web/frontend/src/components/society/mockRoster.ts b/jarvis/ui/web/frontend/src/components/society/mockRoster.tsindex 5af5e53259..4b83fbcdce 100644--- a/jarvis/ui/web/frontend/src/components/society/mockRoster.ts+++ b/jarvis/ui/web/frontend/src/components/society/mockRoster.ts@@ -21,8 +21,8 @@ const SAMPLE_CREATED_MS = Date.UTC(2026, 7, 1, 9, 0, 0);const LEAD_FIGURE: FigureRecipe = {contract: 1,archetype: "biped",- base: "medium",- parts: {},+ base: "rogue",+ parts: { hand_r: "hand_r-mug" },palette: {skin: "#f1c4a0",hair: "#3b2a20",@@ -39,8 +39,8 @@ const LEAD_FIGURE: FigureRecipe = {const SCOUT_FIGURE: FigureRecipe = {contract: 1,archetype: "biped",- base: "medium",- parts: {},+ base: "rogue",+ parts: { back: "back-rogue-cape" },palette: {skin: "#d8a37c",hair: "#2a1d15",@@ -54,8 +54,8 @@ const SCOUT_FIGURE: FigureRecipe = {const ARCHIVIST_FIGURE: FigureRecipe = {contract: 1,archetype: "biped",- base: "medium",- parts: {},+ base: "mage",+ parts: { hand_l: "hand_l-spellbook" },palette: {skin: "#e9c3a3",hair: "#6b6b6b",diff --git a/jarvis/ui/web/frontend/src/components/society/world/WalkerFigure.tsx b/jarvis/ui/web/frontend/src/components/society/world/WalkerFigure.tsxindex 4710ef669f..62c70d68d9 100644--- a/jarvis/ui/web/frontend/src/components/society/world/WalkerFigure.tsx+++ b/jarvis/ui/web/frontend/src/components/society/world/WalkerFigure.tsx@@ -14,6 +14,9 @@ import { useFrame } from "@react-three/fiber";import type { Group } from "three";import type { AgentPalette } from "../data";+import { FigureRig, type FigureDrive, type FigureMode } from "../figures/FigureRig";+import type { FigureRecipe } from "../figures/figureRecipe";+import { figureAssetFor } from "../figures/figureRegistry";import { useKit } from "./WorldKit";/** A warm neutral for head and hands — a doll, not a skin tone. */@@ -32,9 +35,64 @@ interface Props {anim: { current: WalkerAnim };paused: boolean;selected: boolean;+ /** The agent's character; null keeps the box stand-in. */+ recipe?: FigureRecipe | null;}-export function WalkerFigure({ palette, anim, paused, selected }: Props) {+/**+ * Walkers are drawn larger than life: seen 50° from above at 64 m across the+ * stage a true-scale person is a 20 px sliver, and every isometric game with+ * readable characters cheats the same way. The card keeps true scale.+ */+export const WORLD_HERO_SCALE = 1.6;++const MODE_TO_CLIP: Record<WalkerMode, FigureMode> = {+ rest: "idle",+ walk: "walk",+ work: "work",+ sleep: "sleep",+};++/**+ * The shipped character when the roster row carries a recipe whose base is+ * built; the box stand-in otherwise. Both take the same sim-driven `anim`.+ */+export function WalkerFigure(props: Props) {+ const recipe = props.recipe ?? null;+ if (recipe && figureAssetFor(recipe)) {+ return <RiggedWalkerFigure {...props} recipe={recipe} />;+ }+ return <BoxWalkerFigure {...props} />;+}++function RiggedWalkerFigure({ palette, anim, paused, selected, recipe }: Props & { recipe: FigureRecipe }) {+ const kit = useKit();+ const ring = useRef<Group>(null);+ const drive = useRef<FigureDrive>({ mode: "idle", speed: 0 });++ useFrame(({ clock }) => {+ const a = anim.current;+ drive.current.mode = MODE_TO_CLIP[a.mode];+ drive.current.speed = a.speed;+ if (ring.current && !paused) {+ const s = 1 + Math.sin(clock.getElapsedTime() * 3) * 0.06;+ ring.current.scale.set(s, 1, s);+ }+ });++ return (+ <group>+ {selected && (+ <group ref={ring} position={[0, 0.04, 0]}>+ <mesh geometry={kit.g.ring} material={kit.m.glow(palette.accent)} rotation={[Math.PI / 2, 0, 0]} scale={[1.9, 1.9, 1.2]} />+ </group>+ )}+ <FigureRig recipe={recipe} drive={drive} paused={paused} heightM={(recipe.heightM ?? 1.75) * WORLD_HERO_SCALE} />+ </group>+ );+}++function BoxWalkerFigure({ palette, anim, paused, selected }: Props) {const kit = useKit();const body = useRef<Group>(null);const legL = useRef<Group>(null);diff --git a/jarvis/ui/web/frontend/src/components/society/world/Walkers.tsx b/jarvis/ui/web/frontend/src/components/society/world/Walkers.tsxindex 50f3ab2194..bc5ae8d5f0 100644--- a/jarvis/ui/web/frontend/src/components/society/world/Walkers.tsx+++ b/jarvis/ui/web/frontend/src/components/society/world/Walkers.tsx@@ -34,7 +34,7 @@ import {stepAlong,turnToward,} from "./walkerKinematics";-import { WalkerFigure, type WalkerAnim, type WalkerMode } from "./WalkerFigure";+import { WORLD_HERO_SCALE, WalkerFigure, type WalkerAnim, type WalkerMode } from "./WalkerFigure";import { clearWalkerPin, setWalkerPin } from "./walkerRegistry";import { mulberry32, nextBeat, seedFromString } from "./wander";@@ -223,8 +223,8 @@ function Walker({}}onPointerOut={() => setHover(false)}>- <WalkerFigure palette={agent.palette} anim={anim} paused={paused} selected={selected} />- <Html position={[0, 2.35, 0]} center zIndexRange={[30, 10]} style={{ pointerEvents: "none" }}>+ <WalkerFigure palette={agent.palette} anim={anim} paused={paused} selected={selected} recipe={agent.figure} />+ <Html position={[0, (agent.figure ? (agent.figure.heightM ?? 1.75) * WORLD_HERO_SCALE : 2.0) + 0.35, 0]} center zIndexRange={[30, 10]} style={{ pointerEvents: "none" }}><div className="sw-nameplate" data-state={agent.state} data-selected={selected || undefined}><span className="sw-nameplate-dot" style={{ background: agent.palette.accent }} />{agent.name}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex b442a3c00f..1aefe0ca79 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -5092,6 +5092,26 @@"mode_pipeline": "Stimme rein und raus"},"society": {+ "style": {+ "modern": "Modern",+ "fantasy": "Fantasy",+ "cartoon": "Cartoon",+ "animal": "Tier",+ "scifi": "Sci-Fi",+ "spirit": "Geist",+ "custom": "Importiert"+ },+ "slot": {+ "hair": "Haare",+ "headgear": "Kopfbedeckung",+ "face_extra": "Gesicht",+ "torso_over": "Überwurf",+ "belt": "Gürtel",+ "back": "Rücken",+ "hand_l": "Linke Hand",+ "hand_r": "Rechte Hand",+ "feet": "Füße"+ },"sample_badge": "Beispieldaten","roster": {"title": "Agenten",@@ -5181,6 +5201,9 @@"shoes": "Schuhe"},"create": {+ "style": "Stil",+ "style_soon": "Noch keine Figuren in diesem Stil — die Pipeline nimmt jeden Stil, der die Prüfung besteht",+ "none": "Keins","title": "Agent erstellen","subtitle": "Name, Aufgabe und Regelwerk — die Figur rechts ist, wie das Team ihn sehen wird.","name": "Name",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 29b3fb2d79..4be0f96a5b 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -5092,6 +5092,26 @@"mode_pipeline": "voice in and out"},"society": {+ "style": {+ "modern": "Modern",+ "fantasy": "Fantasy",+ "cartoon": "Cartoon",+ "animal": "Animal",+ "scifi": "Sci-fi",+ "spirit": "Spirit",+ "custom": "Imported"+ },+ "slot": {+ "hair": "Hair",+ "headgear": "Headgear",+ "face_extra": "Face",+ "torso_over": "Over",+ "belt": "Belt",+ "back": "Back",+ "hand_l": "Left hand",+ "hand_r": "Right hand",+ "feet": "Feet"+ },"sample_badge": "Sample data","roster": {"title": "Agents",@@ -5181,6 +5201,9 @@"shoes": "Shoes"},"create": {+ "style": "Style",+ "style_soon": "No figures in this style yet — the pipeline takes any style that passes the gate",+ "none": "None","title": "Create an agent","subtitle": "Name, job and rulebook — the character on the right is how the team will see it.","name": "Name",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 4a07831c99..ed6afb18a5 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -5092,6 +5092,26 @@"mode_pipeline": "voz de entrada y salida"},"society": {+ "style": {+ "modern": "Moderno",+ "fantasy": "Fantasía",+ "cartoon": "Caricatura",+ "animal": "Animal",+ "scifi": "Ciencia ficción",+ "spirit": "Espíritu",+ "custom": "Importado"+ },+ "slot": {+ "hair": "Pelo",+ "headgear": "Sombrero",+ "face_extra": "Cara",+ "torso_over": "Capa superior",+ "belt": "Cinturón",+ "back": "Espalda",+ "hand_l": "Mano izquierda",+ "hand_r": "Mano derecha",+ "feet": "Pies"+ },"sample_badge": "Datos de ejemplo","roster": {"title": "Agentes",@@ -5181,6 +5201,9 @@"shoes": "Zapatos"},"create": {+ "style": "Estilo",+ "style_soon": "Aún no hay figuras de este estilo — la canalización acepta cualquier estilo que pase la revisión",+ "none": "Ninguno","title": "Crear un agente","subtitle": "Nombre, cargo y reglas — la figura de la derecha es como lo verá el equipo.","name": "Nombre",diff --git a/scripts/figures/build_figures.py b/scripts/figures/build_figures.pyindex 35941ef5d2..db7f90540f 100644--- a/scripts/figures/build_figures.py+++ b/scripts/figures/build_figures.py@@ -1,23 +1,26 @@-"""Build every shipped figure GLB from its recorded source — inside Blender, headless.+"""Build every shipped figure GLB — bases and parts — from its recorded source, inside Blender.- blender -b --python scripts/figures/build_figures.py -- --out <dir> [--target biped-medium]+ blender -b --python scripts/figures/build_figures.py -- [--out <dir>] [--target biped-rogue]-The ONLY producer of the GLBs under ``src/assets/society/figures/``-(docs/agent-society/character-pipeline.md §7). What it does per target in-``contract.json``:+The ONLY producer of the GLBs under ``src/assets/society/figures/`` and of the+``catalog.json`` the creator reads (docs/agent-society/character-pipeline.md §7).+Per target in ``contract.json``:1. fetch the source file named in ``sources/<source>.json`` into ``cache/``(gitignored) and verify its sha256 — a build never touches an unverified byte;-2. import it, keep only the base body meshes, drop IK/control bones, rename the- deform bones to the archetype's contract names;+2. import it, keep the base body meshes and the listed accessories, drop+ IK/control bones, rename the deform bones to the archetype's contract names;3. keep only the clips the archetype needs, rename them, zero the root's XZmotion (locomotion is the runtime's job), close the loops;4. join the body into one mesh, re-UV every face onto the 16-cell palette strip- of a fresh 128×128 sheet (nearest-filtered), one material;-5. add the ``FWD`` marker, export a binary glTF;-6. finish it with stdlib tools: strip constant channels, prune, write the- ``asset.extras.jarvis_figure`` block with the measured height, feet and stride;-7. run the CI gate on the result — a failing figure fails the build.+ of a fresh 128×128 sheet (nearest-filtered); hair faces get their own+ material slot so headgear can hide them;+5. add the ``FWD`` marker, export the base as a binary glTF;+6. turn every accessory into a part: unparent it at rest, skin it to its+ attach bone with weight 1, re-UV, export it without clips;+7. finish each file with stdlib tools (strip constant channels, prune, write+ ``asset.extras``), run the CI gate on it, and regenerate ``catalog.json`` and+ ``SOURCES.md`` from what was built.Runs on Windows, macOS and Linux (Blender needs no display in ``-b`` mode). Itnever imports ``jarvis.*``: Blender ships its own interpreter.@@ -43,6 +46,8 @@ sys.path.insert(0, str(HERE))import glb_tools as gt # noqa: E402CONTRACT = json.loads((HERE / "contract.json").read_text(encoding="utf-8"))+DEFAULT_OUT = REPO / "jarvis/ui/web/frontend/src/assets/society/figures"+CATALOG_PATH = REPO / "jarvis/ui/web/frontend/src/components/society/figures/catalog.json"def log(msg: str) -> None:@@ -58,6 +63,10 @@ def load_source(name: str) -> dict:return json.loads((HERE / "sources" / f"{name}.json").read_text(encoding="utf-8"))+def source_slug(source: dict) -> str:+ return re.sub(r"[^a-z0-9]+", "-", source["name"].lower()).strip("-")++def fetch_source_file(source: dict, filename: str) -> Path:CACHE.mkdir(exist_ok=True)expected = source["files"][filename]@@ -73,25 +82,19 @@ def fetch_source_file(source: dict, filename: str) -> Path:return dest-def source_slug(source: dict) -> str:- return re.sub(r"[^a-z0-9]+", "-", source["name"].lower()).strip("-")--# ---------------------------------------------------------------------------# Blender helpers# ---------------------------------------------------------------------------def reset_scene() -> None:- # The scene keeps the source's frame rate: keys imported onto integer frames- # are sampled exactly on export, so a closed loop stays closed.bpy.ops.wm.read_factory_settings(use_empty=True)def import_glb(path: Path, fps: int) -> None:- # The importer lands keys on frames at the SCENE rate; at the source's own- # rate they sit on integer frames, so the export samples every key exactly- # and a loop closed on the last key stays closed after sampling.+ # Keys land on frames at the SCENE rate; at the source's own rate they sit+ # on integer frames, so the export samples every key exactly and a loop+ # closed on the last key stays closed after sampling.bpy.context.scene.render.fps = fpsbpy.ops.import_scene.gltf(filepath=str(path), import_shading="NORMALS")@@ -134,9 +137,16 @@ def remove_fcurve(action: bpy.types.Action, fc) -> None:return+def select_only(objects: list[bpy.types.Object], active: bpy.types.Object) -> None:+ for obj in bpy.data.objects:+ obj.select_set(False)+ for obj in objects:+ obj.select_set(True)+ bpy.context.view_layer.objects.active = active++def set_mode(obj: bpy.types.Object, mode: str) -> None:- bpy.context.view_layer.objects.active = obj- obj.select_set(True)+ select_only([obj], obj)bpy.ops.object.mode_set(mode=mode)@@ -146,24 +156,23 @@ def bone_name_of(data_path: str) -> str | None:# ----------------------------------------------------------------------------# build steps+# normalization steps# ----------------------------------------------------------------------------def keep_only_body(arm: bpy.types.Object, body_meshes: list[str]) -> list[bpy.types.Object]:- keep = set(body_meshes)- bodies = []+def keep_objects(arm: bpy.types.Object, names: set[str]) -> dict[str, bpy.types.Object]:+ kept: dict[str, bpy.types.Object] = {}for obj in list(bpy.data.objects):if obj is arm:continue- if obj.type == "MESH" and obj.name in keep:- bodies.append(obj)+ if obj.type == "MESH" and obj.name in names:+ kept[obj.name] = objcontinuebpy.data.objects.remove(obj, do_unlink=True)- missing = keep - {b.name for b in bodies}+ missing = names - set(kept)if missing:- raise SystemExit(f"body meshes not found in source: {sorted(missing)}")- return bodies+ raise SystemExit(f"objects not found in source: {sorted(missing)}")+ return keptdef drop_bones(arm: bpy.types.Object, patterns: list[str]) -> list[str]:@@ -176,8 +185,7 @@ def drop_bones(arm: bpy.types.Object, patterns: list[str]) -> list[str]:bpy.ops.object.mode_set(mode="OBJECT")for action in bpy.data.actions:for fc in list(iter_fcurves(action)):- bone = bone_name_of(fc.data_path)- if bone in victims:+ if bone_name_of(fc.data_path) in victims:remove_fcurve(action, fc)return victims@@ -228,12 +236,21 @@ def normalize_clip(action: bpy.types.Action, loop: bool) -> None:fc.update()+def tag_origin(objects: list[bpy.types.Object]) -> dict[str, str]:+ """Remember which source object each polygon came from (per-mesh cell overrides)."""+ names: dict[str, str] = {}+ for n, obj in enumerate(objects):+ attr = obj.data.attributes.get("jarvis_origin") or obj.data.attributes.new(+ "jarvis_origin", "INT", "FACE"+ )+ for poly in obj.data.polygons:+ attr.data[poly.index].value = n+ names[str(n)] = obj.name+ return names++def join_bodies(bodies: list[bpy.types.Object]) -> bpy.types.Object:- for obj in bpy.data.objects:- obj.select_set(False)- for obj in bodies:- obj.select_set(True)- bpy.context.view_layer.objects.active = bodies[0]+ select_only(bodies, bodies[0])if len(bodies) > 1:bpy.ops.object.join()body = bpy.context.view_layer.objects.active@@ -249,39 +266,49 @@ def cell_of(u: float, v_bottom_up: float, grid: dict) -> str:def reuv_to_palette(- body: bpy.types.Object, source_names: dict[str, str], cell_map: dict, grid: dict+ obj: bpy.types.Object,+ source_names: dict[str, str],+ cell_map: dict,+ grid: dict,+ fallback: dict | None = None,) -> dict:- """Move every face's UVs onto its semantic palette cell; report the mapping used."""+ """Move every face's UVs onto its semantic palette cell; tag hair faces; report."""sheet = CONTRACT["sheet"]cells = sheet["cells"]- mesh = body.data+ mesh = obj.datauv_layer = mesh.uv_layers.activeif uv_layer is None:- raise SystemExit("body has no UV layer")- # A joined mesh keeps no per-object identity; material index / original- # object is gone, so per-mesh overrides are resolved by the polygon's- # original object recorded before the join (see build_target).+ raise SystemExit(f"{obj.name} has no UV layer")origin = mesh.attributes.get("jarvis_origin")used: dict[str, int] = {}unmapped: dict[str, int] = {}+ hair_faces: list[int] = []for poly in mesh.polygons:us = [uv_layer.data[li].uv[0] for li in poly.loop_indices]vs = [uv_layer.data[li].uv[1] for li in poly.loop_indices]cell = cell_of(sum(us) / len(us), sum(vs) / len(vs), grid)obj_name = source_names.get(str(origin.data[poly.index].value), "*") if origin else "*"- semantic = cell_map.get(obj_name, {}).get(cell) or cell_map.get("*", {}).get(cell)+ semantic = (+ cell_map.get(obj_name, {}).get(cell)+ or cell_map.get("*", {}).get(cell)+ or (fallback or {}).get(cell)+ )if semantic is None:unmapped[cell] = unmapped.get(cell, 0) + 1semantic = "primary"idx = cells.index(semantic)used[semantic] = used.get(semantic, 0) + 1+ if semantic == "hair":+ hair_faces.append(poly.index)cu = (idx + 0.5) / len(cells)cv = 1.0 - (sheet["cell_height"] / 2) / sheet["size"]for li in poly.loop_indices:uv_layer.data[li].uv = (cu, cv)if unmapped:- log(f"WARNING unmapped atlas cells (painted primary): {unmapped}")- return {"used": used, "unmapped": unmapped}+ log(f"WARNING {obj.name}: unmapped atlas cells (painted primary): {unmapped}")+ if origin:+ mesh.attributes.remove(origin)+ return {"used": used, "unmapped": unmapped, "hair_faces": hair_faces}def hex_rgb(value: str) -> tuple[int, int, int]:@@ -307,9 +334,7 @@ def write_sheet(path: Path, palette: dict[str, str]) -> None:path.write_bytes(gt.encode_png(size, size, rows, 4))-def apply_sheet_material(body: bpy.types.Object, sheet_path: Path, name: str) -> None:- img = bpy.data.images.load(str(sheet_path))- img.colorspace_settings.name = "sRGB"+def sheet_material(name: str, img: bpy.types.Image) -> bpy.types.Material:mat = bpy.data.materials.new(name)mat.use_nodes = Truenodes = mat.node_tree.nodes@@ -321,11 +346,28 @@ def apply_sheet_material(body: bpy.types.Object, sheet_path: Path, name: str) ->links.new(tex.outputs["Color"], bsdf.inputs["Base Color"])bsdf.inputs["Roughness"].default_value = 1.0bsdf.inputs["Metallic"].default_value = 0.0- body.data.materials.clear()- body.data.materials.append(mat)+ return mat-def add_forward_marker(arm: bpy.types.Object) -> None:+def load_sheet(sheet_path: Path) -> bpy.types.Image:+ img = bpy.data.images.load(str(sheet_path))+ img.colorspace_settings.name = "sRGB"+ return img+++def apply_materials(+ obj: bpy.types.Object, img: bpy.types.Image, stem: str, hair_faces: list[int]+) -> None:+ obj.data.materials.clear()+ obj.data.materials.append(sheet_material(f"{stem}-sheet", img))+ if hair_faces:+ # A second slot, same sheet: exports as its own primitive so headgear can hide it.+ obj.data.materials.append(sheet_material(f"{stem}-hair", img))+ for index in hair_faces:+ obj.data.polygons[index].material_index = 1+++def add_forward_marker(arm: bpy.types.Object) -> bpy.types.Object:fwd = bpy.data.objects.new("FWD", None)fwd.empty_display_type = "ARROWS"fwd.empty_display_size = 0.2@@ -333,12 +375,15 @@ def add_forward_marker(arm: bpy.types.Object) -> None:fwd.location = (0.0, -1.0, 0.5)fwd.parent = armbpy.context.scene.collection.objects.link(fwd)+ return fwd-def export_glb(path: Path) -> None:+def export_glb(path: Path, selection: list[bpy.types.Object], animations: bool) -> None:+ select_only(selection, selection[0])bpy.ops.export_scene.gltf(filepath=str(path),export_format="GLB",+ use_selection=True,export_apply=True,export_yup=True,export_extras=True,@@ -350,23 +395,43 @@ def export_glb(path: Path) -> None:export_skins=True,export_def_bones=False,export_rest_position_armature=True,- export_animations=True,+ export_animations=animations,export_animation_mode="ACTIONS",export_force_sampling=True,export_frame_step=1,export_optimize_animation_size=True,export_leaf_bone=False,- use_selection=False,)+def skin_part_to_bone(part: bpy.types.Object, arm: bpy.types.Object, bone: str) -> None:+ """Unparent the accessory at rest and bind every vertex to its attach bone."""+ arm.data.pose_position = "REST"+ bpy.context.view_layer.update()+ with bpy.context.temp_override(+ active_object=part, object=part, selected_editable_objects=[part], selected_objects=[part]+ ):+ bpy.ops.object.parent_clear(type="CLEAR_KEEP_TRANSFORM")+ select_only([part], part)+ bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)+ for group in list(part.vertex_groups):+ part.vertex_groups.remove(group)+ vg = part.vertex_groups.new(name=bone)+ vg.add([v.index for v in part.data.vertices], 1.0, "REPLACE")+ for mod in list(part.modifiers):+ part.modifiers.remove(mod)+ mod = part.modifiers.new("Armature", "ARMATURE")+ mod.object = arm+ part.parent = arm+ part.matrix_parent_inverse.identity()++# ---------------------------------------------------------------------------# finish (stdlib): extras, samplers, pruning# ----------------------------------------------------------------------------def finish(glb_path: Path, target: dict, source: dict, archetype: dict, uv_report: dict) -> None:- glb = gt.read_glb(glb_path)+def finish_common(glb: gt.Glb) -> gt.Glb:doc = glb.docfor sampler in doc.get("samplers", []):sampler["magFilter"] = 9728@@ -380,8 +445,6 @@ def finish(glb_path: Path, target: dict, source: dict, archetype: dict, uv_reporfor mat in doc.get("materials", []):mat["alphaMode"] = "OPAQUE"mat.pop("doubleSided", None)-- # Strip constant scale channels (identity) — KayKit bakes one per bone.for anim in doc.get("animations", []):keep_channels = []for ch in anim["channels"]:@@ -396,15 +459,25 @@ def finish(glb_path: Path, target: dict, source: dict, archetype: dict, uv_reporanim["samplers"] = [anim["samplers"][i] for i in used]for ch in keep_channels:ch["sampler"] = remap[ch["sampler"]]+ gt.collapse_constant_channels(glb)+ return gt.prune_unused(glb)- collapsed = gt.collapse_constant_channels(glb)- glb = gt.prune_unused(glb)- doc = glb.doc- log(f"collapsed {collapsed} constant channels")- # Facts the runtime and the gate read.+def finish_base(+ glb_path: Path, target: dict, source: dict, archetype: dict, uv_report: dict+) -> dict:+ glb = finish_common(gt.read_glb(glb_path))+ doc = glb.docskinned = gt.skinned_mesh_nodes(doc)- lo, hi = gt.mesh_bounds(doc, doc["meshes"][doc["nodes"][skinned[0]]["mesh"]])+ lo = [1e9] * 3+ hi = [-1e9] * 3+ tris = 0+ for n in skinned:+ mesh = doc["meshes"][doc["nodes"][n]["mesh"]]+ mlo, mhi = gt.mesh_bounds(doc, mesh)+ lo = [min(a, b) for a, b in zip(lo, mlo, strict=True)]+ hi = [max(a, b) for a, b in zip(hi, mhi, strict=True)]+ tris += gt.triangle_count(doc, mesh)clips: dict[str, dict] = {}for name, spec in archetype["clips"].items():anim = gt.clip_by_name(doc, name)@@ -417,35 +490,72 @@ def finish(glb_path: Path, target: dict, source: dict, archetype: dict, uv_reporif spec.get("stride"):entry["stride_m"] = round(gt.measure_stride(glb, anim, archetype["feet"]), 4)clips[name] = entry- doc.setdefault("asset", {})["extras"] = {- "jarvis_figure": {- "contract": CONTRACT["contract"],- "archetype": target["archetype"],- "variant": target["variant"],- "forward": "+Z",- "height_m": round(hi[1] - lo[1], 4),- "target_height_m": archetype["variants"][target["variant"]]["height_m"],- "clips": clips,- "palette_cells": uv_report["used"],- "source": f"{source['name']} ({source['license']}) / {target['character']}",- }+ extras = {+ "contract": CONTRACT["contract"],+ "archetype": target["archetype"],+ "variant": target["variant"],+ "base": target["base"],+ "forward": "+Z",+ "height_m": round(hi[1] - lo[1], 4),+ "target_height_m": archetype["variants"][target["variant"]]["height_m"],+ "clips": clips,+ "palette_cells": uv_report["used"],+ "hair_primitive": bool(uv_report["hair_faces"]),+ "source": f"{source['name']} ({source['license']}) / {target['character']}",}+ doc.setdefault("asset", {})["extras"] = {"jarvis_figure": extras}doc["asset"]["generator"] = "Personal Jarvis build_figures.py"gt.write_glb(glb_path, doc, glb.blob)- log(f"finished {glb_path.name}: {glb_path.stat().st_size // 1024} KB, clips {clips}")+ log(+ f"finished {glb_path.name}: {glb_path.stat().st_size // 1024} KB, {tris} tris, clips {sorted(clips)}"+ )+ return {"triangles": tris, "clips": sorted(clips), "height_m": extras["height_m"]}-def run_gate(glb_path: Path) -> None:+def finish_part(glb_path: Path, spec: dict, target: dict, source: dict, attach: str) -> dict:+ glb = finish_common(gt.read_glb(glb_path))+ doc = glb.doc+ doc["animations"] = []+ glb = gt.prune_unused(glb)+ doc = glb.doc+ tris = sum(+ gt.triangle_count(doc, doc["meshes"][doc["nodes"][n]["mesh"]])+ for n in gt.skinned_mesh_nodes(doc)+ )+ extras = {+ "contract": CONTRACT["contract"],+ "archetype": target["archetype"],+ "slot": spec["slot"],+ "attach": attach,+ "hides": spec.get("hides", []),+ "label": spec["label"],+ "styles": spec.get("styles", []),+ "source": f"{source['name']} ({source['license']}) / {spec['object']}",+ }+ doc.setdefault("asset", {})["extras"] = {"jarvis_part": extras}+ doc["asset"]["generator"] = "Personal Jarvis build_figures.py"+ gt.write_glb(glb_path, doc, glb.blob)+ log(f"finished part {glb_path.name}: {glb_path.stat().st_size // 1024} KB, {tris} tris")+ return {"triangles": tris}+++_GATE = None+++def run_gate(glb_path: Path, sources_md: Path) -> None:+ global _GATEgate = REPO / "scripts" / "ci" / "check_society_figures.py"if not gate.exists():log("gate not present yet — skipping validation")return- spec = importlib.util.spec_from_file_location("check_society_figures", gate)- mod = importlib.util.module_from_spec(spec)- assert spec and spec.loader- sys.modules["check_society_figures"] = mod- spec.loader.exec_module(mod)- problems = mod.check_file(glb_path)+ if _GATE is None:+ spec = importlib.util.spec_from_file_location("check_society_figures", gate)+ mod = importlib.util.module_from_spec(spec)+ assert spec and spec.loader+ sys.modules["check_society_figures"] = mod+ spec.loader.exec_module(mod)+ _GATE = mod+ problems = _GATE.check_file(glb_path, sources_md=sources_md)if problems:for p in problems:log(f"GATE {glb_path.name}: {p}")@@ -454,31 +564,25 @@ def run_gate(glb_path: Path) -> None:# ----------------------------------------------------------------------------# one target+# one target = one base + its parts# ----------------------------------------------------------------------------def build_target(target: dict, out_dir: Path) -> Path:+def build_target(target: dict, out_dir: Path, ledger: Path) -> tuple[dict, list[dict]]:archetype = CONTRACT["archetypes"][target["archetype"]]source = load_source(target["source"])character = source["characters"][target["character"]]+ part_specs = character.get("parts", [])src_file = fetch_source_file(source, f"{target['character']}.glb")log(f"building {target['id']} from {src_file.name}")reset_scene()import_glb(src_file, int(source.get("fps", 30)))arm = find_armature()- bodies = keep_only_body(arm, character["body_meshes"])-- # Remember which source object each polygon came from (per-mesh cell overrides).- source_names: dict[str, str] = {}- for n, obj in enumerate(bodies):- attr = obj.data.attributes.get("jarvis_origin") or obj.data.attributes.new(- "jarvis_origin", "INT", "FACE"- )- for poly in obj.data.polygons:- attr.data[poly.index].value = n- source_names[str(n)] = obj.name+ wanted = set(character["body_meshes"]) | {p["object"] for p in part_specs}+ objects = keep_objects(arm, wanted)+ bodies = [objects[n] for n in character["body_meshes"]]+ source_names = tag_origin(bodies)dropped = drop_bones(arm, source["drop_bone_patterns"])log(f"dropped {len(dropped)} control bones")@@ -486,37 +590,159 @@ def build_target(target: dict, out_dir: Path) -> Path:kept = filter_clips(source["clip_map"], archetype["clips"])for name, action in kept.items():normalize_clip(action, archetype["clips"][name]["loop"])- log(f"clips: {sorted(kept)}")- body = join_bodies(bodies)- uv_report = reuv_to_palette(body, source_names, character["cell_map"], source["atlas_grid"])- body.data.attributes.remove(body.data.attributes["jarvis_origin"])sheet_path = CACHE / f"{target['id']}-sheet.png"write_sheet(sheet_path, character["default_palette"])- apply_sheet_material(body, sheet_path, f"{target['id']}-sheet")- add_forward_marker(arm)+ img = load_sheet(sheet_path)++ body = join_bodies(bodies)+ uv_report = reuv_to_palette(body, source_names, character["cell_map"], source["atlas_grid"])+ apply_materials(body, img, target["id"], uv_report["hair_faces"])+ fwd = add_forward_marker(arm)out_dir.mkdir(parents=True, exist_ok=True)- out = out_dir / f"{target['id']}.glb"- export_glb(out)- finish(out, target, source, archetype, uv_report)- run_gate(out)- return out+ base_path = out_dir / f"{target['id']}.glb"+ export_glb(base_path, [body, arm, fwd], animations=True)+ facts = finish_base(base_path, target, source, archetype, uv_report)+ base_entry = {+ "id": f"{target['archetype']}/{target['base']}",+ "file": base_path.name,+ "archetype": target["archetype"],+ "variant": target["variant"],+ "base": target["base"],+ "label": target["label"],+ "styles": target.get("styles", []),+ "heightM": archetype["variants"][target["variant"]]["height_m"],+ "palette": character["default_palette"],+ "source": f"{source['name']} / {target['character']}",+ "license": source["license"],+ **facts,+ }++ # Parts: the clips are gone, the FWD stays out of the selection.+ for action in list(bpy.data.actions):+ bpy.data.actions.remove(action)+ part_entries = []+ parts_dir = out_dir / "parts" / target["archetype"]+ parts_dir.mkdir(parents=True, exist_ok=True)+ for spec in part_specs:+ part = objects[spec["object"]]+ attach = archetype["slots"][spec["slot"]]["attach"]+ skin_part_to_bone(part, arm, attach)+ report = reuv_to_palette(+ part,+ {},+ {"*": character["cell_map"].get("*", {})},+ source["atlas_grid"],+ fallback=source.get("part_cell_map", {}),+ )+ apply_materials(part, img, spec["id"], [])+ part_path = parts_dir / f"{spec['id']}.glb"+ export_glb(part_path, [part, arm], animations=False)+ pfacts = finish_part(part_path, spec, target, source, attach)+ part_entries.append(+ {+ "id": spec["id"],+ "file": f"parts/{target['archetype']}/{part_path.name}",+ "archetype": target["archetype"],+ "slot": spec["slot"],+ "attach": attach,+ "label": spec["label"],+ "styles": spec.get("styles", []),+ "hides": spec.get("hides", []),+ "from_base": target["base"],+ "source": f"{source['name']} / {spec['object']}",+ "license": source["license"],+ "palette_cells": report["used"],+ **pfacts,+ }+ )+ return base_entry, part_entries+++def write_ledger(+ path: Path, bases: list[dict], parts: list[dict], sources: dict[str, dict]+) -> None:+ lines = [+ "# Figure assets — provenance ledger",+ "",+ "GENERATED by `scripts/figures/build_figures.py` — one row per shipped file",+ "(docs/agent-society/character-pipeline.md §11, gate check 15). Every GLB here is",+ "produced from the recorded source; nothing is hand-exported. Sources are fetched by URL",+ "into `scripts/figures/cache/` and verified by sha256 before the build touches them",+ "(`scripts/figures/sources/*.json`).",+ "",+ "| File | Source | License | What the build changed |",+ "|---|---|---|---|",+ ]+ for b in bases:+ lines.append(+ f"| `{b['file']}` | {b['source']} | {b['license']} | body meshes joined; IK/control bones "+ f"dropped; 23 deform bones renamed; clips kept/renamed, root XZ zeroed, loops closed; "+ f"faces re-UV'd onto the palette strip; hair as its own primitive; FWD marker; extras |"+ )+ for p in parts:+ lines.append(+ f"| `{p['file'].split('/')[-1]}` | {p['source']} | {p['license']} | unparented at rest, "+ f"skinned to `{p['attach']}` with weight 1; re-UV'd onto the palette strip; no clips; extras |"+ )+ lines.append("")+ for name, src in sources.items():+ lines.append(+ f"- **{src['name']}** — {src['author']}, {src['license']} ({src['license_url']}); files:"+ )+ for fname, sha in src["files"].items():+ lines.append(f" - `{fname}` sha256 `{sha}`")+ lines.append("")+ lines.append(+ "Licenses recorded at fetch time. CC0 needs no attribution; credit is given anyway."+ )+ path.write_text("\n".join(lines) + "\n", encoding="utf-8")def main() -> None:argv = sys.argv[sys.argv.index("--") + 1 :] if "--" in sys.argv else []parser = argparse.ArgumentParser()- parser.add_argument(- "--out", default=str(REPO / "jarvis/ui/web/frontend/src/assets/society/figures")- )+ parser.add_argument("--out", default=str(DEFAULT_OUT))parser.add_argument("--target", default=None)args = parser.parse_args(argv)+ out_dir = Path(args.out)targets = [t for t in CONTRACT["targets"] if args.target in (None, t["id"])]if not targets:raise SystemExit(f"no target named {args.target!r}")++ catalog: dict = {"contract": CONTRACT["contract"], "styles": {}, "bases": [], "parts": []}+ if CATALOG_PATH.exists() and args.target:+ catalog = json.loads(CATALOG_PATH.read_text(encoding="utf-8"))+ catalog["styles"] = {k: v for k, v in CONTRACT["styles"].items() if not k.startswith("$")}++ ledger = out_dir / "SOURCES.md"+ built_bases: list[dict] = []+ built_parts: list[dict] = []for target in targets:- build_target(target, Path(args.out))+ base, parts = build_target(target, out_dir, ledger)+ built_bases.append(base)+ built_parts.extend(parts)++ # Merge into the catalog (a single --target rebuild keeps the other entries).+ bases = {b["id"]: b for b in catalog.get("bases", [])}+ for b in built_bases:+ bases[b["id"]] = b+ parts = {p["id"]: p for p in catalog.get("parts", [])}+ for p in built_parts:+ parts[p["id"]] = p+ catalog["bases"] = sorted(bases.values(), key=lambda b: b["id"])+ catalog["parts"] = sorted(parts.values(), key=lambda p: p["id"])+ sources = {t["source"]: load_source(t["source"]) for t in CONTRACT["targets"]}+ write_ledger(ledger, catalog["bases"], catalog["parts"], sources)+ CATALOG_PATH.write_text(json.dumps(catalog, indent=2) + "\n", encoding="utf-8")+ log(f"catalog: {len(catalog['bases'])} bases, {len(catalog['parts'])} parts")++ # The gate runs last, against the regenerated ledger.+ for b in built_bases:+ run_gate(out_dir / b["file"], ledger)+ for p in built_parts:+ run_gate(out_dir / p["file"], ledger)if __name__ == "__main__":diff --git a/scripts/figures/contract.json b/scripts/figures/contract.jsonindex 755f1b8876..0f0d64c764 100644--- a/scripts/figures/contract.json+++ b/scripts/figures/contract.json@@ -1,5 +1,5 @@{- "$comment": "Figure asset contract v1 — docs/agent-society/character-pipeline.md §4/§5. The build (build_figures.py) and the CI gate (scripts/ci/check_society_figures.py) both read this file; the runtime reads the extras the build writes from it.",+ "$comment": "Figure asset contract v1 — docs/agent-society/character-pipeline.md §4/§5. The build (build_figures.py) and the CI gate (scripts/ci/check_society_figures.py) both read this file; the runtime reads the extras the build writes from it and the catalog.json the build generates.","contract": 1,"sheet": {"size": 128,@@ -24,6 +24,16 @@"emissive"]},+ "styles": {+ "$comment": "Every base and part carries one or more style tags; the creator filters by them. Keep the ids stable — recipes and the catalog reference them.",+ "modern": "Everyday people — offices, streets, workshops",+ "fantasy": "Knights, mages, rangers, barbarians, undead",+ "cartoon": "Chunky, big-headed, kart-racer proportions",+ "animal": "Four-legged companions",+ "scifi": "Robots, suits, visors",+ "spirit": "Ghosts and familiars",+ "custom": "Imported by the person"+ },"archetypes": {"biped": {"bones": [@@ -52,6 +62,17 @@"toes_r"],"feet": ["toes_l", "toes_r"],+ "slots": {+ "hair": { "attach": "head" },+ "headgear": { "attach": "head" },+ "face_extra": { "attach": "head" },+ "torso_over": { "attach": "chest" },+ "belt": { "attach": "hips" },+ "back": { "attach": "chest" },+ "hand_l": { "attach": "handslot_l" },+ "hand_r": { "attach": "handslot_r" },+ "feet": { "attach": "hips" }+ },"clips": {"idle": { "loop": true, "duration": [0.8, 6.0] },"walk": { "loop": true, "duration": [0.8, 1.2], "stride": true },@@ -68,7 +89,7 @@"medium": { "height_m": 1.75 },"large": { "height_m": 2.3 }},- "budget": { "triangles": 4500, "materials": 1, "primitives": 1 }+ "budget": { "triangles": 4500, "materials": 2, "primitives": 2 }},"quadruped": {"bones": [@@ -96,6 +117,12 @@],"optional_bones": ["ear_l", "ear_r", "wing_l", "wing_r"],"feet": ["foot_fl", "foot_fr", "foot_bl", "foot_br"],+ "slots": {+ "headgear": { "attach": "head" },+ "collar": { "attach": "neck" },+ "back": { "attach": "chest" },+ "tail_extra": { "attach": "tail_2" }+ },"clips": {"idle": { "loop": true, "duration": [0.8, 6.0] },"walk": { "loop": true, "duration": [0.6, 1.4], "stride": true },@@ -106,11 +133,16 @@"celebrate": { "loop": false, "duration": [0.5, 4.0] }},"variants": { "default": { "height_m": 0.9 } },- "budget": { "triangles": 4500, "materials": 1, "primitives": 1 }+ "budget": { "triangles": 4500, "materials": 2, "primitives": 2 }},"spirit": {"bones": ["root", "body", "face"],"feet": [],+ "slots": {+ "headgear": { "attach": "body" },+ "hand_l": { "attach": "body" },+ "hand_r": { "attach": "body" }+ },"clips": {"idle": { "loop": true, "duration": [0.8, 6.0] },"walk": { "loop": true, "duration": [0.6, 2.0], "stride": false },@@ -124,7 +156,7 @@}},"limits": {- "part_triangles": 600,+ "part_triangles": 900,"base_file_kb": 512,"part_file_kb": 120,"max_texture": 256,@@ -132,16 +164,49 @@"loop_epsilon": 0.002,"loop_epsilon_deg": 1.0,"origin_epsilon": 0.01,- "center_epsilon": 0.1,+ "center_epsilon": 0.2,"scale_epsilon": 0.0001},"targets": [{- "id": "biped-medium",+ "id": "biped-rogue",+ "archetype": "biped",+ "variant": "medium",+ "base": "rogue",+ "source": "kaykit-adventurers",+ "character": "Rogue",+ "label": "Ranger",+ "styles": ["modern", "fantasy"]+ },+ {+ "id": "biped-knight",+ "archetype": "biped",+ "variant": "medium",+ "base": "knight",+ "source": "kaykit-adventurers",+ "character": "Knight",+ "label": "Knight",+ "styles": ["fantasy"]+ },+ {+ "id": "biped-mage",+ "archetype": "biped",+ "variant": "medium",+ "base": "mage",+ "source": "kaykit-adventurers",+ "character": "Mage",+ "label": "Mage",+ "styles": ["fantasy"]+ },+ {+ "id": "biped-barbarian","archetype": "biped","variant": "medium",+ "base": "barbarian","source": "kaykit-adventurers",- "character": "Rogue"+ "character": "Barbarian",+ "label": "Barbarian",+ "styles": ["fantasy"]}]}diff --git a/scripts/figures/sources/kaykit-adventurers.json b/scripts/figures/sources/kaykit-adventurers.jsonindex 14ea901e69..c92f525c28 100644--- a/scripts/figures/sources/kaykit-adventurers.json+++ b/scripts/figures/sources/kaykit-adventurers.json@@ -1,5 +1,5 @@{- "$comment": "KayKit Character Pack: Adventurers 1.0 by Kay Lousberg — CC0 (LICENSE.txt in the repo). Used as the biped skeleton + clip base (character-pipeline.md §8 route A, §11). Every file is fetched by URL into scripts/figures/cache/ and verified by sha256 before the build touches it.",+ "$comment": "KayKit Character Pack: Adventurers 1.0 by Kay Lousberg — CC0 (LICENSE.txt in the repo). The biped skeleton + clip base and the first four bodies and fifteen parts (character-pipeline.md §8 route A, §11). Every file is fetched by URL into scripts/figures/cache/ and verified by sha256 before the build touches it.","name": "KayKit Character Pack: Adventurers 1.0","author": "Kay Lousberg (kaylousberg.com)","license": "CC0-1.0",@@ -8,7 +8,8 @@"files": {"Rogue.glb": "e825437cd4d2ee9c1960b517a74a69101e33eb409ae7fa8cedc7134a998fbb7d","Knight.glb": "60428e3abc09ba83e595d256e3af8c5c976b46cdae599f0802fc82b4a3445168",- "Mage.glb": "cf898585da33fab50c724d31605fb931eb2912e6d2280092141e98ca81ad507d"+ "Mage.glb": "cf898585da33fab50c724d31605fb931eb2912e6d2280092141e98ca81ad507d",+ "Barbarian.glb": "cefc311a0e10c7858b6141f5ada7e33268727564fb8ac1347aab97d000669cc6"},"atlas_grid": { "columns": 8, "rows": 4 },"fps": 30,@@ -49,6 +50,26 @@"celebrate": "Cheer","wave": "Interact"},+ "part_cell_map": {+ "$comment": "Weapons, shields, hats and capes share the atlas rows the bodies leave free.",+ "c3r1": "metal",+ "c2r1": "metal",+ "c4r1": "metal",+ "c5r1": "leather",+ "c6r1": "leather",+ "c2r2": "accent",+ "c0r2": "secondary_shade",+ "c1r2": "accent",+ "c1r3": "secondary",+ "c6r2": "leather",+ "c7r2": "fur_shade",+ "c0r1": "primary",+ "c1r1": "primary_shade",+ "c3r0": "metal",+ "c7r0": "metal",+ "c5r0": "accent",+ "c2r0": "eyes"+ },"characters": {"Rogue": {"body_meshes": [@@ -94,7 +115,163 @@"shoes": "#4a2e22","eye_white": "#e6ecef","emissive": "#ffd166"- }+ },+ "parts": [+ { "object": "Rogue_Cape", "id": "back-rogue-cape", "slot": "back", "label": "Ranger cape", "styles": ["fantasy", "modern"] },+ { "object": "Knife", "id": "hand_r-knife", "slot": "hand_r", "label": "Knife", "styles": ["fantasy"] }+ ]+ },+ "Knight": {+ "body_meshes": [+ "Knight_Body",+ "Knight_Head",+ "Knight_ArmLeft",+ "Knight_ArmRight",+ "Knight_LegLeft",+ "Knight_LegRight"+ ],+ "cell_map": {+ "*": {+ "c0r0": "skin",+ "c1r0": "hair",+ "c2r0": "eyes",+ "c3r0": "metal",+ "c7r0": "metal",+ "c4r0": "primary_shade",+ "c6r0": "leather",+ "c7r1": "primary_shade",+ "c2r1": "secondary",+ "c0r1": "primary",+ "c1r1": "secondary_shade"+ },+ "Knight_Head": { "c1r0": "hair" }+ },+ "default_palette": {+ "skin": "#f6c19d",+ "skin_shade": "#d9a37c",+ "hair": "#e0b989",+ "eyes": "#141a1c",+ "primary": "#c4212b",+ "primary_shade": "#3f4549",+ "secondary": "#95a1a7",+ "secondary_shade": "#b9c5c8",+ "accent": "#e8c46b",+ "metal": "#727c80",+ "leather": "#9c5b45",+ "fur": "#b87556",+ "fur_shade": "#8d4c39",+ "shoes": "#484f53",+ "eye_white": "#e6ecef",+ "emissive": "#ffd166"+ },+ "parts": [+ { "object": "Knight_Helmet", "id": "headgear-knight-helmet", "slot": "headgear", "label": "Knight helmet", "styles": ["fantasy"], "hides": ["hair"] },+ { "object": "Knight_Cape", "id": "back-knight-cape", "slot": "back", "label": "Knight cape", "styles": ["fantasy"] },+ { "object": "1H_Sword", "id": "hand_r-sword", "slot": "hand_r", "label": "Sword", "styles": ["fantasy"] },+ { "object": "Round_Shield", "id": "hand_l-round-shield", "slot": "hand_l", "label": "Round shield", "styles": ["fantasy"] }+ ]+ },+ "Mage": {+ "body_meshes": [+ "Mage_Body",+ "Mage_Head",+ "Mage_ArmLeft",+ "Mage_ArmRight",+ "Mage_LegLeft",+ "Mage_LegRight"+ ],+ "cell_map": {+ "*": {+ "c0r0": "skin",+ "c1r0": "hair",+ "c2r0": "eyes",+ "c1r1": "primary",+ "c0r1": "primary",+ "c3r0": "metal",+ "c4r0": "metal",+ "c5r0": "secondary",+ "c7r1": "primary_shade",+ "c2r2": "accent",+ "c0r2": "secondary_shade",+ "c7r2": "skin",+ "c3r2": "shoes"+ }+ },+ "default_palette": {+ "skin": "#f5ba95",+ "skin_shade": "#d99a75",+ "hair": "#252124",+ "eyes": "#1b2427",+ "primary": "#4a4673",+ "primary_shade": "#242242",+ "secondary": "#b25729",+ "secondary_shade": "#cfd7da",+ "accent": "#2f6c73",+ "metal": "#8d989e",+ "leather": "#9a5944",+ "fur": "#b87556",+ "fur_shade": "#8d4c39",+ "shoes": "#995843",+ "eye_white": "#e6ecef",+ "emissive": "#ffd166"+ },+ "parts": [+ { "object": "Mage_Hat", "id": "headgear-mage-hat", "slot": "headgear", "label": "Wizard hat", "styles": ["fantasy"], "hides": ["hair"] },+ { "object": "Mage_Cape", "id": "back-mage-cape", "slot": "back", "label": "Mage cape", "styles": ["fantasy"] },+ { "object": "2H_Staff", "id": "hand_r-staff", "slot": "hand_r", "label": "Staff", "styles": ["fantasy"] },+ { "object": "Spellbook", "id": "hand_l-spellbook", "slot": "hand_l", "label": "Spellbook", "styles": ["fantasy", "modern"] }+ ]+ },+ "Barbarian": {+ "body_meshes": [+ "Barbarian_Body",+ "Barbarian_Head",+ "Barbarian_ArmLeft",+ "Barbarian_ArmRight",+ "Barbarian_LegLeft",+ "Barbarian_LegRight"+ ],+ "cell_map": {+ "*": {+ "c0r0": "skin",+ "c1r0": "hair",+ "c2r0": "eyes",+ "c6r0": "leather",+ "c0r1": "primary",+ "c1r1": "primary",+ "c2r1": "fur",+ "c7r0": "secondary_shade",+ "c7r1": "secondary",+ "c3r0": "metal",+ "c7r2": "fur_shade",+ "c3r2": "shoes"+ }+ },+ "default_palette": {+ "skin": "#f6bf9a",+ "skin_shade": "#d9a37c",+ "hair": "#918880",+ "eyes": "#141a1c",+ "primary": "#4f6f86",+ "primary_shade": "#3a5266",+ "secondary": "#978f86",+ "secondary_shade": "#665850",+ "accent": "#e8c46b",+ "metal": "#7a8388",+ "leather": "#93523e",+ "fur": "#c5cfd3",+ "fur_shade": "#8e857d",+ "shoes": "#675950",+ "eye_white": "#e6ecef",+ "emissive": "#ffd166"+ },+ "parts": [+ { "object": "Barbarian_Hat", "id": "headgear-horned-hat", "slot": "headgear", "label": "Horned hat", "styles": ["fantasy"], "hides": ["hair"] },+ { "object": "Barbarian_Cape", "id": "back-fur-cape", "slot": "back", "label": "Fur cape", "styles": ["fantasy"] },+ { "object": "1H_Axe", "id": "hand_r-axe", "slot": "hand_r", "label": "Axe", "styles": ["fantasy"] },+ { "object": "Mug", "id": "hand_r-mug", "slot": "hand_r", "label": "Mug", "styles": ["modern", "fantasy"] },+ { "object": "Barbarian_Round_Shield", "id": "hand_l-wooden-shield", "slot": "hand_l", "label": "Wooden shield", "styles": ["fantasy"] }+ ]}}}