Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (claude): fix Muse avatar size-pop + material leak, guard fallback clip
Adam Eivy3cbc41638b33
diff --git a/client/src/components/cos/MuseCoSAvatar.jsx b/client/src/components/cos/MuseCoSAvatar.jsxindex 2074e299ab..b50ae59d30 100644--- a/client/src/components/cos/MuseCoSAvatar.jsx+++ b/client/src/components/cos/MuseCoSAvatar.jsx@@ -8,6 +8,7 @@ import {MUSE_STATE_ANIMATIONS,MUSE_ANIMATION_FALLBACK,MUSE_SPEAKING_GESTURE,+ MUSE_ROOT_MOTION_CLIPS,} from './constants';import CoSAvatarOrbitControls from './CoSAvatarOrbitControls';import CoSAvatarFrame from './CoSAvatarFrame';@@ -36,9 +37,15 @@ function GLBAvatar({ color, state, speaking }) {// whole scene graph on every frame).const matsRef = useRef([]);- // Auto-fit to viewport + apply holographic material. Replacing the material- // does NOT affect skinning — the skeleton drives deformation regardless of- // the material bound to the SkinnedMesh, so clips still animate the body.+ // Apply the holographic material + fit the model to the viewport ONCE per+ // scene. Keyed on [scene] only — NOT color — because the fit is an absolute+ // `setScalar`, so re-measuring the already-scaled scene on a color change+ // would reset it toward native size (the avatar would pop between two sizes+ // on every state transition) and re-allocating materials each time would+ // leak GPU resources. Replacing the material does NOT affect skinning — the+ // skeleton drives deformation regardless of the bound material, so clips+ // still animate the body. The per-state emissive hue is handled separately+ // below so this heavy pass runs just once.useEffect(() => {const mats = [];scene.traverse((obj) => {@@ -50,7 +57,6 @@ function GLBAvatar({ color, state, speaking }) {obj.frustumCulled = false;const material = new THREE.MeshStandardMaterial({color: '#120820',- emissive: color,emissiveIntensity: 0.55,metalness: 0.55,roughness: 0.35,@@ -75,7 +81,14 @@ function GLBAvatar({ color, state, speaking }) {-center.y * scale + 0.05,-center.z * scale);- }, [scene, color]);+ return () => { for (const m of mats) m.dispose(); };+ }, [scene]);++ // Recolor the emissive hue in place when the CoS state changes — mutate the+ // materials created above rather than re-allocating them (see the fit effect).+ useEffect(() => {+ for (const m of matsRef.current) m.emissive.set(color);+ }, [color]);// --- Animation driving -------------------------------------------------// The base loop we should return to when idle (updated by the state effect),@@ -110,7 +123,10 @@ function GLBAvatar({ color, state, speaking }) {if (!hasClips) return null;if (baseCfg.clip && names.includes(baseCfg.clip)) return baseCfg.clip;if (names.includes(MUSE_ANIMATION_FALLBACK)) return MUSE_ANIMATION_FALLBACK;- return names[0];+ // Last resort for a custom GLB with clips but none mapped: prefer the first+ // in-place clip so a leading walk cycle can't drift the fixed-frame avatar+ // out of view; fall back to names[0] only if every clip is root-motion.+ return names.find((n) => !MUSE_ROOT_MOTION_CLIPS.includes(n)) || names[0];}, [hasClips, names, baseCfg.clip]);// Play / crossfade the base state loop.diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.jsindex 39d044d8c4..0cb1a080cf 100644--- a/client/src/components/cos/constants.js+++ b/client/src/components/cos/constants.js@@ -103,6 +103,13 @@ export const MUSE_ANIMATION_FALLBACK = 'Idle';// returns to its base state loop.export const MUSE_SPEAKING_GESTURE = 'Wave';+// RobotExpressive clips that carry root translation (they walk the model+// forward). Never used as a base loop for the fixed-frame avatar — the state+// map above avoids them, the constants test asserts it, and MuseCoSAvatar's+// "GLB has clips but none are mapped" fallback skips them so a custom GLB+// whose first clip happens to be a walk cycle can't drift out of view.+export const MUSE_ROOT_MOTION_CLIPS = ['Walking', 'Running', 'WalkJump'];+// Default messages shown when no specific event message is availableexport const STATE_MESSAGES = {sleeping: "Idle - waiting for tasks...",diff --git a/client/src/components/cos/constants.test.js b/client/src/components/cos/constants.test.jsindex bf8931676e..f9d723d629 100644--- a/client/src/components/cos/constants.test.js+++ b/client/src/components/cos/constants.test.js@@ -8,7 +8,8 @@ import {AGENT_STATES,MUSE_STATE_ANIMATIONS,MUSE_ANIMATION_FALLBACK,- MUSE_SPEAKING_GESTURE+ MUSE_SPEAKING_GESTURE,+ MUSE_ROOT_MOTION_CLIPS} from './constants';// These mirror the server's domainBudgets/domainAutonomy helpers so the UI's@@ -49,8 +50,7 @@ describe('getDomainBudget (client mirror)', () => {// The Cyber Muse avatar drives RobotExpressive's clips off CoS state. Two// invariants must hold or the fixed-frame avatar breaks: every agent state// needs a base clip, and no mapped clip may carry root translation (those-// walk the model out of view). RobotExpressive's root-motion clips:-const MUSE_ROOT_MOTION_CLIPS = ['Walking', 'Running', 'WalkJump'];+// walk the model out of view — enumerated in MUSE_ROOT_MOTION_CLIPS).describe('muse avatar animation triggers', () => {it('maps every agent state to a base clip', () => {