The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(chatMascot): ignore viseme updates from superseded replay owners
Steven Enamakel4aaeb238e035
diff --git a/app/src/features/human/chatMascot/ChatMascotOverlay.test.tsx b/app/src/features/human/chatMascot/ChatMascotOverlay.test.tsxindex 57ff8903ea..cc604b8782 100644--- a/app/src/features/human/chatMascot/ChatMascotOverlay.test.tsx+++ b/app/src/features/human/chatMascot/ChatMascotOverlay.test.tsx@@ -209,14 +209,16 @@ describe('ChatMascotOverlay', () => {it('ignores cleanup from an older replay owner after another reply takes over', () => {renderOverlay(true);- const publish = (owner: string, active: boolean, viseme: string) =>+ const publish = (owner: string, active: boolean, viseme: string, claim = false) =>window.dispatchEvent(- new CustomEvent('voice-note-mascot', { detail: { owner, active, viseme } })+ new CustomEvent('voice-note-mascot', { detail: { owner, active, viseme, claim } }));- act(() => publish('reply-a', true, 'aa'));+ act(() => publish('reply-a', true, 'aa', true));expect(screen.getByTestId('mascot-rive')).toHaveAttribute('data-viseme', 'aa');- act(() => publish('reply-b', true, 'PP'));+ act(() => publish('reply-b', true, 'PP', true));+ expect(screen.getByTestId('mascot-rive')).toHaveAttribute('data-viseme', 'PP');+ act(() => publish('reply-a', true, 'oo'));expect(screen.getByTestId('mascot-rive')).toHaveAttribute('data-viseme', 'PP');act(() => publish('reply-a', false, 'sil'));expect(screen.getByTestId('mascot-rive')).toHaveAttribute('data-viseme', 'PP');diff --git a/app/src/features/human/chatMascot/ChatMascotOverlay.tsx b/app/src/features/human/chatMascot/ChatMascotOverlay.tsxindex f6b95ca524..e4e37c81bc 100644--- a/app/src/features/human/chatMascot/ChatMascotOverlay.tsx+++ b/app/src/features/human/chatMascot/ChatMascotOverlay.tsx@@ -83,8 +83,11 @@ const ChatMascotOverlay = () => {const replayOwnerRef = useRef<string | null>(null);useEffect(() => {const onPlayback = (event: Event) => {- const detail = (event as CustomEvent<{ owner: string; active: boolean; viseme: string }>)- .detail;+ const detail = (event as CustomEvent<{+ owner: string;+ active: boolean;+ viseme: string;+ }>).detail;if (!detail?.owner) return;if (detail.active) {replayOwnerRef.current = detail.owner;diff --git a/app/src/features/voiceNotes/VoiceNotePlayer.tsx b/app/src/features/voiceNotes/VoiceNotePlayer.tsxindex d51ba60b77..2c692f62ef 100644--- a/app/src/features/voiceNotes/VoiceNotePlayer.tsx+++ b/app/src/features/voiceNotes/VoiceNotePlayer.tsx@@ -67,7 +67,7 @@ function VoiceNotePlayerBody({framesRef.current = frames;const publishMascot = useCallback(- (active: boolean, atMs = 0) => {+ (active: boolean, atMs = 0, claim = false) => {if (!mascotPlayback) return;let viseme = 'sil';if (active) {@@ -75,7 +75,9 @@ function VoiceNotePlayerBody({viseme = frame?.viseme ?? 'sil';}window.dispatchEvent(- new CustomEvent('voice-note-mascot', { detail: { owner: playbackOwner, active, viseme } })+ new CustomEvent('voice-note-mascot', {+ detail: { owner: playbackOwner, active, viseme, claim },+ }));},[mascotPlayback, playbackOwner]@@ -120,10 +122,10 @@ function VoiceNotePlayerBody({}}const audio = new window.Audio(url);- const publishAtCurrentTime = () => {+ const publishAtCurrentTime = (claim = false) => {const atMs = audio.currentTime * 1000;setPositionMs(atMs);- publishMascot(!audio.paused && !audio.ended, atMs);+ publishMascot(!audio.paused && !audio.ended, atMs, claim);};const stopSampling = () => {if (playbackRafRef.current !== null) {@@ -158,7 +160,7 @@ function VoiceNotePlayerBody({});audio.addEventListener('play', () => {setPlaying(true);- publishAtCurrentTime();+ publishAtCurrentTime(true);stopSampling();playbackRafRef.current = window.requestAnimationFrame(sampleWhilePlaying);});