소스 검색

fix(companion): use intro for unknown agents

WZHBAK 2 주 전
부모
커밋
e0d605e6fa
1개의 변경된 파일27개의 추가작업 그리고 2개의 파일을 삭제
  1. 27 2
      companion/src/gifs.rs

+ 27 - 2
companion/src/gifs.rs

@@ -95,7 +95,7 @@ impl Gifs {
         self.sheets
             .get_key_value(agent)
             .map(|(name, _)| *name)
-            .unwrap_or("orchestrator")
+            .unwrap_or("intro")
     }
 }
 
@@ -151,7 +151,32 @@ fn decode_sprite_sheet(bytes: &[u8]) -> Result<ColorImage, image::ImageError> {
 
 #[cfg(test)]
 mod tests {
-    use super::{frame_index, frame_uv, normalized_speed, FRAME_COUNT};
+    use super::{frame_index, frame_uv, normalized_speed, Gifs, FRAME_COUNT};
+
+    #[test]
+    fn unknown_agents_use_the_neutral_intro_animation() {
+        let gifs = Gifs::new();
+
+        for agent in ["plan", "build", "general", "explore", "custom-agent"] {
+            assert_eq!(gifs.resolve_name(agent, "default"), "intro");
+        }
+    }
+
+    #[test]
+    fn known_agents_keep_their_own_animations() {
+        let gifs = Gifs::new();
+
+        for agent in [
+            "orchestrator",
+            "explorer",
+            "librarian",
+            "oracle",
+            "designer",
+            "fixer",
+        ] {
+            assert_eq!(gifs.resolve_name(agent, "default"), agent);
+        }
+    }
 
     #[test]
     fn speed_is_clamped_and_defaults_fast() {