Skip to content

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.

feat(pets): add the Dodaios pet, show it as the Mascot style and give it a voxel model in the Verse (#542)

Ruben Lütke618596aab5cb
diff --git a/art/studies/dodaios-pet-companions/brief.md b/art/studies/dodaios-pet-companions/brief.md
index e975f6e468..39fdb5f728 100644
--- a/art/studies/dodaios-pet-companions/brief.md
+++ b/art/studies/dodaios-pet-companions/brief.md
@@ -24,6 +24,7 @@ and personality come from their idle rows; no external assets are used.
| `brew` | Teal teapot with a gold knob, spout and handle, a face on its belly | hopping |
| `mochi` | Pink jelly blob | squash-and-stretch bouncing |
| `shelly` | Green snail with an orange spiral shell and eyes on stalks | crawling |
+| `dodaios` | The hooded figure of the logo built of cubes, one per pixel of the pet: black with white trim (face lining, collar, cape hem, soles) | walking upright on two legs, cape streaming |
A pet the person drew themselves (a single uploaded sheet) has no authored
model. It is extruded in the runtime into a voxel figure from its own idle
@@ -34,6 +35,9 @@ frames and floats low, so every choice still shows in 3D.
- Matches the office's toy style (`docs/agent-society/office-map.md` §2):
chunky rounded primitives, flat matte colours, dot eyes with one glint, no
textures. Colours are taken from the pixel pets' palettes.
+ `dodaios` is the one exception to the rounded primitives: it is built of
+ flat-shaded cubes, so the figure keeps the pixel look of its sprite and of
+ the logo it comes from.
- Blender master: metres, Z up, -Y forward (glTF +Z forward), bottom-centred
pivot per pet. Animated parts hang under named pivot empties
(`<pet>_Head`, `<pet>_Leg_FL`, `<pet>_Wing_L`, …) so the runtime can drive
diff --git a/art/studies/dodaios-pet-companions/exports/dodaios.glb b/art/studies/dodaios-pet-companions/exports/dodaios.glb
new file mode 100644
index 0000000000..5f51240d40
Binary files /dev/null and b/art/studies/dodaios-pet-companions/exports/dodaios.glb differ
diff --git a/art/studies/dodaios-pet-companions/source/build-report.json b/art/studies/dodaios-pet-companions/source/build-report.json
index 9ac3f12ac9..e9771ac22c 100644
--- a/art/studies/dodaios-pet-companions/source/build-report.json
+++ b/art/studies/dodaios-pet-companions/source/build-report.json
@@ -58,6 +58,14 @@
"length_m": 0.607,
"triangles": 11584,
"glb_bytes": 243176
+ },
+ "dodaios": {
+ "height_m": 0.587,
+ "bottom_m": 0.0,
+ "width_m": 0.325,
+ "length_m": 0.325,
+ "triangles": 5004,
+ "glb_bytes": 258112
}
}
}
diff --git a/art/studies/dodaios-pet-companions/study.json b/art/studies/dodaios-pet-companions/study.json
index 8926f464fb..cf75031199 100644
--- a/art/studies/dodaios-pet-companions/study.json
+++ b/art/studies/dodaios-pet-companions/study.json
@@ -44,6 +44,13 @@
"source": "source/pets.blend",
"collection": "Pet_bolt",
"export": "exports/bolt.glb"
+ },
+ {
+ "id": "dodaios",
+ "kind": "character",
+ "source": "source/pets.blend",
+ "collection": "Pet_dodaios",
+ "export": "exports/dodaios.glb"
}
],
"runtime_evidence": [],
diff --git a/docs/pets.md b/docs/pets.md
index 03fc8771c4..4de52e8952 100644
--- a/docs/pets.md
+++ b/docs/pets.md
@@ -2,9 +2,16 @@
A desktop pet is an animated pixel-art companion that floats on the desktop
while Jarvis runs. It is the overlay style `pet`, an alternative to the slim
-Jarvis bar (`jarvis_bar`), the Gigi mascot (`mascot`) and the voice orb
-(`voice_orb`). Users pick the style and the pet under
-**Settings → My Pets**.
+Jarvis bar (`jarvis_bar`) and the voice orb (`voice_orb`). Users pick the
+style and the pet under **Settings → My Pets**.
+
+The style `mascot` is a pet as well: it always shows the built-in `dodaios`
+pet, the hooded figure of the logo (`MASCOT_PET_ID` in
+`dodaios/ui/overlay_styles.py`), with everything on this page: the states, the
+control strip, the thought bubble and the cards. The pet chosen under My Pets
+is kept and shows again once the style is `pet`. Only an own picture
+(`[ui] orb_mascot_path`) makes the mascot a still image that pops up for a
+conversation.
The pet sits in the same frameless, always-on-top window as the mascot and the
voice orb (`ui/orb/overlay.py`, `OrbOverlay`). Switching between those three
@@ -54,7 +61,8 @@ one click.
cards without a figure.
- **In the Dodaios Verse.** Aboard the capital ship the chosen pet is the
commander's companion drone: it hovers at the commander's heel
- (`docs/verse/README.md`).
+ (`docs/verse/README.md`). While the mascot is the display style, the
+ mascot's pet is that companion.
- **Worn by an agent.** In an agent's look dialog (*Companion → Look →
Pet*) any pet from My Pets can replace the agent's shape. It is stored as
`companion.pet` in the agent's avatar JSON (`dodaios/society/companion.py`,
@@ -284,6 +292,7 @@ committed PNGs match the script). User-created pets live in
| `shelly` | Shelly | A snail: the shell spins while thinking, it withdraws to sleep |
| `ember` | Ember | A baby dragon: smoke rings while thinking, a fire breath on success, a sooty cough on errors, naps in its eggshell |
| `cocoa` | Cocoa | A chocolate Labrador puppy: tilts its head to listen, digs while it works, sniffs along a scent trail while searching, does zoomies on success, droops its ears on errors and naps in its dog bed |
+| `dodaios` | Dodaios | The hooded figure of the logo in black and white: the hood's tip perks up to listen and droops asleep, three dots hop beside it while it thinks, the cape trails a hop on success, it types on a laptop at its feet, and hangs by the hood with dangling feet when it is carried |
## Adding a pet
diff --git a/dodaios.toml.example b/dodaios.toml.example
index 54eef31d8b..b9850d18f4 100644
--- a/dodaios.toml.example
+++ b/dodaios.toml.example
@@ -199,8 +199,9 @@ tray_enabled = true
admin_api_port = 47821
startup_chime = true
# On-screen overlay shown by default on a desktop install: the slim
-# "jarvis_bar" (the Dodaios Bar). Alternatives: "mascot" (the Gigi mascot),
-# "voice_orb" (the procedural voice orb), "pet" (a desktop pet) or "none".
+# "jarvis_bar" (the Dodaios Bar). Alternatives: "mascot" (the hooded figure
+# of the logo, as a desktop pet), "voice_orb" (the procedural voice orb),
+# "pet" (the desktop pet chosen under My Pets) or "none".
# This mirrors the built-in default — listed here so the bar is the obvious,
# self-documented out-of-the-box choice and never silently disappears.
orb_style = "jarvis_bar"
diff --git a/dodaios/core/config.py b/dodaios/core/config.py
index 9822fa08de..de69a57fb6 100644
--- a/dodaios/core/config.py
+++ b/dodaios/core/config.py
@@ -2191,11 +2191,14 @@ class UIConfig(BaseModel):
# (see surface_security.open_access_granted). Toggled live from
# Settings → API Keys → Control Key.
require_browser_login: bool = False
- # On-screen overlay style: "jarvis_bar" (slim default), "mascot" (the ghost
- # mascot), "voice_orb" (the procedural weather sphere — the desktop twin of
- # the in-app orb), or "none". One list: dodaios.ui.overlay_styles.
+ # On-screen overlay style: "jarvis_bar" (slim default), "mascot" (the
+ # hooded figure of the logo, shown as the built-in Dodaios pet), "pet" (the
+ # pet chosen under My Pets), "voice_orb" (the procedural weather sphere —
+ # the desktop twin of the in-app orb), or "none". One list:
+ # dodaios.ui.overlay_styles.
orb_style: str = "jarvis_bar"
- # Optional explicit path to the mascot PNG. Empty = search for default asset.
+ # Optional own mascot PNG. Set, the mascot style shows that still picture
+ # for a conversation instead of the pet. Empty = the pet.
orb_mascot_path: str = ""
# Jarvis bar: persistent (always-visible dots pill) vs only-when-active.
bar_persistent: bool = True
diff --git a/dodaios/ui/desktop_app.py b/dodaios/ui/desktop_app.py
index fe88876af0..ae2783ece9 100644
--- a/dodaios/ui/desktop_app.py
+++ b/dodaios/ui/desktop_app.py
@@ -3870,14 +3870,16 @@ class DesktopApp:
def _hide_on_idle_for(self, style: str) -> bool:
"""The bridge's idle regime for one overlay style.
- The bar follows "show at all times"; a persistent orb style (the pet)
- stays up while idle; the mascot and the voice orb pop up per session.
+ The bar follows "show at all times"; a persistent orb style (the pet,
+ and the mascot, which is one) stays up while idle; the voice orb pops
+ up per session.
"""
- from dodaios.ui.overlay_styles import PERSISTENT_ORB_STYLES
+ from dodaios.ui.overlay_styles import stays_while_idle
if style == "jarvis_bar":
return not bool(getattr(self.cfg.ui, "bar_persistent", True))
- return style not in PERSISTENT_ORB_STYLES
+ mascot_image = str(getattr(self.cfg.ui, "orb_mascot_path", "") or "")
+ return not stays_while_idle(style, mascot_image=mascot_image)
def _pet_call(self, method: str, *args: object) -> bool:
"""Call a pet surface method on the live overlay. True when it ran."""
@@ -4077,7 +4079,6 @@ class DesktopApp:
HIDDEN_STYLE,
ORB_STYLES,
OVERLAY_STYLES,
- PERSISTENT_ORB_STYLES,
)
style = (style or "jarvis_bar").strip()
@@ -4106,13 +4107,13 @@ class DesktopApp:
if style in ORB_STYLES and old is not None and hasattr(old, "set_style"):
old.set_style(style)
_recache_surface(cache, old, style)
- # The idle regime travels with the look: the pet stays up
- # while idle, the mascot and the voice orb pop up per session.
+ # The idle regime travels with the look: a pet (the mascot
+ # is one) stays up while idle, the voice orb pops up per session.
bridge._hide_on_idle = self._hide_on_idle_for(style)
mode = str(getattr(old, "_mode", "idle") or "idle")
- if style in PERSISTENT_ORB_STYLES:
+ if not bridge._hide_on_idle:
old.show(mode)
- elif previous in PERSISTENT_ORB_STYLES and mode == "idle":
+ elif not self._hide_on_idle_for(previous) and mode == "idle":
old.hide()
self._note_live_overlay_style(style)
logger.info("Orb window re-styled live to {}.", style)
@@ -4149,7 +4150,7 @@ class DesktopApp:
try:
if (
style == "jarvis_bar" and self.cfg.ui.bar_persistent
- ) or style in PERSISTENT_ORB_STYLES:
+ ) or (style in ORB_STYLES and not bridge._hide_on_idle):
new.show("idle")
except Exception: # noqa: BLE001
logger.debug("post-swap show failed", exc_info=True)
diff --git a/dodaios/ui/dodaiosbar/subprocess_overlay.py b/dodaios/ui/dodaiosbar/subprocess_overlay.py
index 3267f24d86..f7df62b481 100644
--- a/dodaios/ui/dodaiosbar/subprocess_overlay.py
+++ b/dodaios/ui/dodaiosbar/subprocess_overlay.py
@@ -44,6 +44,7 @@ from typing import IO, Any
# hand-copied predecessor is precisely why ``show("dictate")`` was a silent
# no-op on the macOS surface for weeks (AP-4 / BUG-008).
from dodaios.ui.dodaiosbar.modes import MODES as _MODES
+from dodaios.ui.overlay_styles import PERSISTENT_ORB_STYLES
log = logging.getLogger("dodaios.ui.dodaiosbar")
@@ -621,7 +622,7 @@ class SubprocessBarOverlay:
# Same source names as the in-process orb window, so the pipeline's
# VoiceSpeakerMuteChanged says which control the user pressed.
- source = "pet" if getattr(self, "_style", "") == "pet" else "orb"
+ source = "pet" if self._shows_pet() else "orb"
result = toggle_speaker_mute(source=source)
if result is None:
log.debug("orb speaker toggle had no live pipeline in the parent")
@@ -767,13 +768,19 @@ class SubprocessMascotOverlay(SubprocessBarOverlay):
@property
def wants_status_lines(self) -> bool:
- """True when the hosted window is the pet, which shows status lines."""
- return self._style == "pet"
+ """True when the hosted window is a pet (the mascot is one): it shows status lines."""
+ return self._shows_pet()
@property
def keeps_visible_when_idle(self) -> bool:
- """True when the hosted window is the pet, which stays up while idle."""
- return self._style == "pet"
+ """True when the hosted window is a pet (the mascot is one): it stays up at idle."""
+ return self._shows_pet()
+
+ def _shows_pet(self) -> bool:
+ """Mirror of ``OrbOverlay``: a configured mascot image stays the still picture."""
+ if self._style == "mascot" and self._mascot_path:
+ return False
+ return self._style in PERSISTENT_ORB_STYLES
@property
def pet_user_hidden(self) -> bool:
diff --git a/dodaios/ui/overlay_styles.py b/dodaios/ui/overlay_styles.py
index 5bb2327318..5d2d1f87fa 100644
--- a/dodaios/ui/overlay_styles.py
+++ b/dodaios/ui/overlay_styles.py
@@ -19,16 +19,33 @@ from __future__ import annotations
BAR_STYLE = "jarvis_bar"
#: Styles drawn by the floating orb window (``ui.orb.overlay.OrbOverlay``):
-#: ``mascot`` is the Gigi ghost, ``voice_orb`` the procedural weather sphere —
-#: the desktop twin of the in-app orb — and ``pet`` an animated pixel-art
-#: companion with its own control strip (``dodaios.ui.pets``). All three live in
-#: the SAME frameless, always-on-top window, so all can be dragged onto any
-#: monitor and swapped live without a restart.
+#: ``mascot`` is the hooded figure of the logo, ``voice_orb`` the procedural
+#: weather sphere — the desktop twin of the in-app orb — and ``pet`` an
+#: animated pixel-art companion with its own control strip
+#: (``dodaios.ui.pets``). All three live in the SAME frameless, always-on-top
+#: window, so all can be dragged onto any monitor and swapped live without a
+#: restart.
ORB_STYLES: tuple[str, ...] = ("mascot", "voice_orb", "pet")
+#: The built-in pet the ``mascot`` style shows: the mascot is that pet, with
+#: the pet's animations, control strip and cards, whatever pet is chosen under
+#: My Pets for the ``pet`` style.
+MASCOT_PET_ID = "dodaios"
+
#: Orb-window styles that stay on screen while Jarvis is idle. The others pop
#: up only for a conversation.
-PERSISTENT_ORB_STYLES: tuple[str, ...] = ("pet",)
+PERSISTENT_ORB_STYLES: tuple[str, ...] = ("mascot", "pet")
+
+
+def stays_while_idle(style: str, *, mascot_image: str = "") -> bool:
+ """True for an orb-window style that stays on screen while Jarvis is idle.
+
+ A configured mascot image (``[ui] orb_mascot_path``) is shown as the still
+ picture it is, which pops up only for a conversation.
+ """
+ if style == "mascot" and mascot_image.strip():
+ return False
+ return style in PERSISTENT_ORB_STYLES
#: No on-screen overlay at all.
HIDDEN_STYLE = "none"
diff --git a/dodaios/ui/pets/builtin/dodaios/acts.png b/dodaios/ui/pets/builtin/dodaios/acts.png
new file mode 100644
index 0000000000..f825a0bd20
Binary files /dev/null and b/dodaios/ui/pets/builtin/dodaios/acts.png differ
diff --git a/dodaios/ui/pets/builtin/dodaios/pet.json b/dodaios/ui/pets/builtin/dodaios/pet.json
new file mode 100644
index 0000000000..2d8e7edbce
--- /dev/null
+++ b/dodaios/ui/pets/builtin/dodaios/pet.json
@@ -0,0 +1,105 @@
+{
+ "format": "jarvis-pet/1",
+ "id": "dodaios",
+ "name": "Dodaios",
+ "description": "The hooded figure of the logo: its hood tip perks up to listen, its cape flies on a hop.",
+ "frame_size": 48,
+ "sheet": "sheet.png",
+ "animations": {
+ "idle": {
+ "row": 0,
+ "frames": 8,
+ "fps": 6,
+ "loop": true,
+ "accent_frames": 1,
+ "accent_every": 3
+ },
+ "listening": {
+ "row": 1,
+ "frames": 6,
+ "fps": 8,
+ "loop": true
+ },
+ "thinking": {
+ "row": 2,
+ "frames": 8,
+ "fps": 8,
+ "loop": true
+ },
+ "talking": {
+ "row": 3,
+ "frames": 4,
+ "fps": 10,
+ "loop": true
+ },
+ "success": {
+ "row": 4,
+ "frames": 8,
+ "fps": 10,
+ "loop": false
+ },
+ "error": {
+ "row": 5,
+ "frames": 6,
+ "fps": 9,
+ "loop": false
+ },
+ "sleeping": {
+ "row": 6,
+ "frames": 6,
+ "fps": 3,
+ "loop": true
+ },
+ "working": {
+ "row": 7,
+ "frames": 8,
+ "fps": 8,
+ "loop": true
+ },
+ "searching": {
+ "row": 8,
+ "frames": 8,
+ "fps": 8,
+ "loop": true
+ },
+ "held": {
+ "row": 9,
+ "frames": 6,
+ "fps": 10,
+ "loop": true
+ }
+ },
+ "acts_sheet": "acts.png",
+ "acts": {
+ "cape_gust": {
+ "row": 0,
+ "frames": 8,
+ "fps": 9,
+ "loop": false
+ },
+ "peekaboo": {
+ "row": 1,
+ "frames": 8,
+ "fps": 6,
+ "loop": false
+ },
+ "look_around": {
+ "row": 2,
+ "frames": 8,
+ "fps": 5,
+ "loop": false
+ },
+ "smoke_bomb": {
+ "row": 3,
+ "frames": 8,
+ "fps": 8,
+ "loop": false
+ },
+ "nod_off": {
+ "row": 4,
+ "frames": 8,
+ "fps": 5,
+ "loop": false
+ }
+ }
+}
diff --git a/dodaios/ui/pets/builtin/dodaios/sheet.png b/dodaios/ui/pets/builtin/dodaios/sheet.png
new file mode 100644
index 0000000000..da224afb88
Binary files /dev/null and b/dodaios/ui/pets/builtin/dodaios/sheet.png differ
diff --git a/dodaios/ui/web/dist/assets/dodaios-CSiw0A2M.glb b/dodaios/ui/web/dist/assets/dodaios-CSiw0A2M.glb
new file mode 100644
index 0000000000..5f51240d40
Binary files /dev/null and b/dodaios/ui/web/dist/assets/dodaios-CSiw0A2M.glb differ
diff --git a/dodaios/ui/web/frontend/src/assets/society/companions/pets/dodaios.glb b/dodaios/ui/web/frontend/src/assets/society/companions/pets/dodaios.glb
new file mode 100644
index 0000000000..5f51240d40
Binary files /dev/null and b/dodaios/ui/web/frontend/src/assets/society/companions/pets/dodaios.glb differ
diff --git a/dodaios/ui/web/frontend/src/components/society/companion/companionPetStore.ts b/dodaios/ui/web/frontend/src/components/society/companion/companionPetStore.ts
index 2e43023071..d4e2435e52 100644
--- a/dodaios/ui/web/frontend/src/components/society/companion/companionPetStore.ts
+++ b/dodaios/ui/web/frontend/src/components/society/companion/companionPetStore.ts
@@ -1,7 +1,8 @@
/**
* The pets the Jarvis Verse draws, shared by every place in the scene that
- * shows one: Jarvis's own companion (the pet chosen in My Pets) and the pets
- * agents wear instead of their shape (`companion.pet`). The stages feed it
+ * shows one: Jarvis's own companion (the pet chosen in My Pets, or the
+ * mascot's pet while the mascot is the display style) and the pets agents
+ * wear instead of their shape (`companion.pet`). The stages feed it
* from the pets query outside the WebGL canvas; the flyer, the lead walker
* and every agent follower read it inside. An entry only changes when its
* pet does, so a refetch never reloads a model or a sprite sheet.
@@ -9,6 +10,7 @@
import { useEffect } from "react";
import { useQuery } from "@tanstack/react-query";
import { create } from "zustand";
+import { MASCOT_PET_ID, useOverlayStyle } from "@/hooks/useOverlayStyle";
import { pickActivePet, petKeys } from "@/hooks/usePets";
import { fetchPets } from "@/lib/petsApi";
import { companionFor, GIGI_COMPANION, type CompanionPet } from "./petCompanions";
@@ -58,17 +60,20 @@ export function useSyncCompanionPet(): void {
const { data } = useQuery({ queryKey: petKeys.all, queryFn: fetchPets, staleTime: Infinity });
const setPet = useCompanionPet((s) => s.setPet);
const setCatalog = useCompanionPet((s) => s.setCatalog);
+ const mascot = useOverlayStyle().config?.style === "mascot";
// Until the pets answer arrives the last known companion stays (Gigi on a cold start).
useEffect(() => {
if (!data) return;
- const active = pickActivePet(data);
+ const pets = Array.isArray(data.pets) ? data.pets : [];
+ // The mascot style shows its own pet on the desktop; the same one walks here.
+ const active = (mascot ? pets.find((pet) => pet.id === MASCOT_PET_ID) : undefined) ?? pickActivePet(data);
if (active) setPet(companionFor(active));
const catalog: Record<string, CompanionPet> = {};
- for (const pet of Array.isArray(data.pets) ? data.pets : []) {
+ for (const pet of pets) {
// A drawn pet without a usable sheet would come back as Gigi; leave it out so the agent keeps its shape.
const companion = companionFor(pet);
if (companion.id === pet.id) catalog[pet.id] = companion;
}
setCatalog(catalog);
- }, [data, setPet, setCatalog]);
+ }, [data, mascot, setPet, setCatalog]);
}
diff --git a/dodaios/ui/web/frontend/src/components/society/companion/petCompanions.ts b/dodaios/ui/web/frontend/src/components/society/companion/petCompanions.ts
index 257964f2d8..a9775faa1b 100644
--- a/dodaios/ui/web/frontend/src/components/society/companion/petCompanions.ts
+++ b/dodaios/ui/web/frontend/src/components/society/companion/petCompanions.ts
@@ -5,7 +5,8 @@
* Built-in pets have an authored Blender model
* (`art/studies/dodaios-pet-companions`, `scripts/art/build_pet_companions.py`)
* and a way of moving that fits them: the dragon and Gigi fly, the cat walks,
- * the snail crawls. A pet the person drew themselves has only its sprite
+ * the snail crawls, the hooded Dodaios figure (built of cubes, like its
+ * pixels) stands up and walks on its two legs. A pet the person drew themselves has only its sprite
* sheet, so it becomes a voxel figure extruded from its idle frames and
* floats low beside them.
*/
@@ -44,6 +45,7 @@ export const BUILTIN_COMPANIONS: Readonly<Record<string, BuiltinSpec>> = {
mochi: { kind: "model", gait: "bounce", heightM: 0.28, modelHeightM: 0.25, strideM: 0.45 },
shelly: { kind: "model", gait: "crawl", heightM: 0.36, modelHeightM: 0.4, strideM: 0.28 },
cocoa: { kind: "model", gait: "walk", heightM: 0.4, modelHeightM: 0.483, strideM: 0.3 },
+ dodaios: { kind: "model", gait: "walk", heightM: 0.5, modelHeightM: 0.587, strideM: 0.2 },
};
/** A drawn pet floats at this height (its voxel figure), metres. */
diff --git a/dodaios/ui/web/frontend/src/components/society/companion/petRig.test.ts b/dodaios/ui/web/frontend/src/components/society/companion/petRig.test.ts
index b8f6757650..0f61fc7f7d 100644
--- a/dodaios/ui/web/frontend/src/components/society/companion/petRig.test.ts
+++ b/dodaios/ui/web/frontend/src/components/society/companion/petRig.test.ts
@@ -39,6 +39,21 @@ describe("pet rig", () => {
expect(pose.get("miso_Leg_FL")!.rx).toBeCloseTo(-pose.get("miso_Leg_FR")!.rx);
});
+ it("walks the hooded figure upright: its two legs swing against each other and rest when it stands", () => {
+ const dodaios = spec("dodaios");
+ const state = createRigState();
+ let maxSwing = 0;
+ for (let i = 0; i < 120; i++) {
+ stepRig(state, dodaios, { dt: DT, speed: 1, mood: "idle", reduced: false });
+ const pose = rigPose(dodaios, state, "idle");
+ expect(pose.get("dodaios_Leg_L")!.rx).toBeCloseTo(-pose.get("dodaios_Leg_R")!.rx);
+ maxSwing = Math.max(maxSwing, Math.abs(pose.get("dodaios_Leg_L")!.rx));
+ }
+ expect(maxSwing).toBeGreaterThan(0.3);
+ for (let i = 0; i < 240; i++) stepRig(state, dodaios, { dt: DT, speed: 0, mood: "idle", reduced: false });
+ expect(Math.abs(rigPose(dodaios, state, "idle").get("dodaios_Leg_L")!.rx)).toBeLessThan(0.05);
+ });
+
it("beats the dragon's wings in mirror image", () => {
const ember = spec("ember");
const state = createRigState();
diff --git a/dodaios/ui/web/frontend/src/components/society/companion/petRig.ts b/dodaios/ui/web/frontend/src/components/society/companion/petRig.ts
index b08c3b3b43..0506b3047c 100644
--- a/dodaios/ui/web/frontend/src/components/society/companion/petRig.ts
+++ b/dodaios/ui/web/frontend/src/components/society/companion/petRig.ts
@@ -273,6 +273,33 @@ export function rigPose(pet: CompanionPet, state: RigState, mood: PetMood, out:
eyes(out, "cocoa", state.blink);
break;
}
+ case "dodaios": {
+ // Upright on two legs: each leg swings from the hip and lifts on its way
+ // forward; the body rises as it passes over the standing leg.
+ const step = Math.sin(p);
+ const left = part(out, "dodaios_Leg_L"), right = part(out, "dodaios_Leg_R");
+ left.rx = 0.6 * s * step; left.dy = 0.02 * s * Math.max(0, Math.cos(p));
+ right.rx = -0.6 * s * step; right.dy = 0.02 * s * Math.max(0, -Math.cos(p));
+ const body = part(out, "dodaios_Body");
+ body.rz = 0.05 * s * step;
+ body.dy = 0.012 * s * Math.abs(Math.cos(p)) - 0.015 * sleep;
+ body.sy = 1 + 0.02 * Math.sin(t * 1.7) * (1 - s);
+ // The head looks around at rest, nods over its work and droops asleep.
+ const head = part(out, "dodaios_Head");
+ head.rx = 0.05 * s * Math.sin(2 * p) + 0.16 * sleep + 0.1 * work;
+ head.ry = 0.3 * Math.sin(t * 0.45) * (1 - s) * (1 - sleep) * (1 - work);
+ head.rz = 0.12 * talk * Math.sin(t * 3.2);
+ // The cape streams out behind while walking and stirs a little at rest.
+ const cape = part(out, "dodaios_Cape");
+ cape.rx = 0.5 * s + 0.05 * Math.sin(t * 2.3) + 0.1 * s * Math.sin(2 * p);
+ cape.rz = 0.08 * s * step;
+ // The hood's point bobs a beat behind every step and flicks while it talks.
+ const tip = part(out, "dodaios_Tip");
+ tip.rz = 0.14 * Math.sin(t * 1.9) * (1 - sleep) + 0.2 * s * Math.sin(2 * p - 1.2) - 0.3 * sleep;
+ tip.rx = 0.25 * talk * Math.sin(t * 6);
+ eyes(out, "dodaios", state.blink);
+ break;
+ }
default:
break;
}
diff --git a/dodaios/ui/web/frontend/src/hooks/useOverlayStyle.ts b/dodaios/ui/web/frontend/src/hooks/useOverlayStyle.ts
index b67d8f4d7f..63d5d63299 100644
--- a/dodaios/ui/web/frontend/src/hooks/useOverlayStyle.ts
+++ b/dodaios/ui/web/frontend/src/hooks/useOverlayStyle.ts
@@ -2,9 +2,9 @@ import { useCallback, useEffect, useState } from "react";
/**
* On-screen overlay style from GET /api/settings/overlay-style.
- * "jarvis_bar" = blue-orb control strip (default), "mascot" = ghost mascot, "voice_orb" = the
- * procedural voice orb, "pet" = an animated pixel-art pet with its control
- * strip (Settings → My Pets), "none" = hidden.
+ * "jarvis_bar" = blue-orb control strip (default), "mascot" = the hooded figure of the logo
+ * (the built-in pet `MASCOT_PET_ID`), "voice_orb" = the procedural voice orb, "pet" = the
+ * animated pixel-art pet chosen under Settings → My Pets, "none" = hidden.
*
* Mirror of the backend's one list (``dodaios/ui/overlay_styles.py``); the two
* are pinned together by tests/unit/ui/test_overlay_style_parity.py, which
@@ -13,6 +13,9 @@ import { useCallback, useEffect, useState } from "react";
*/
export type OverlayStyle = "jarvis_bar" | "mascot" | "voice_orb" | "pet" | "none";
+/** The built-in pet the "mascot" style shows (`MASCOT_PET_ID` in the backend's list). */
+export const MASCOT_PET_ID = "dodaios";
+
/** Client-side fallback while GET is in flight (same order as the backend). */
export const OVERLAY_STYLES: OverlayStyle[] = [
"jarvis_bar",
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/de.json b/dodaios/ui/web/frontend/src/i18n/locales/de.json
index a2c1d200c4..d61a32e3bd 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/de.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/de.json
@@ -8875,6 +8875,9 @@
},
"cocoa": {
"description": "Ein schokobrauner Labrador-Welpe: legt beim Zuhören den Kopf schief, buddelt beim Arbeiten, flitzt bei Erfolg im Kreis."
+ },
+ "dodaios": {
+ "description": "Die Kapuzenfigur aus dem Logo: Die Kapuzenspitze richtet sich beim Zuhören auf, der Umhang fliegt beim Hüpfen."
}
},
"create_dialog": {
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/en.json b/dodaios/ui/web/frontend/src/i18n/locales/en.json
index 6cd2208ceb..c0805df647 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/en.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/en.json
@@ -8875,6 +8875,9 @@
},
"cocoa": {
"description": "A chocolate Labrador puppy: tilts its head to listen, digs while it works, does zoomies on success."
+ },
+ "dodaios": {
+ "description": "The hooded figure of the logo: the hood's tip perks up to listen, the cape flies on a hop."
}
},
"create_dialog": {
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/es.json b/dodaios/ui/web/frontend/src/i18n/locales/es.json
index 7690101430..f8343cc9f8 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/es.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/es.json
@@ -8875,6 +8875,9 @@
},
"cocoa": {
"description": "Un cachorro de labrador chocolate: ladea la cabeza al escuchar, escarba al trabajar y corre en círculos al acertar."
+ },
+ "dodaios": {
+ "description": "La figura encapuchada del logotipo: la punta de la capucha se levanta al escuchar y la capa vuela al saltar."
}
},
"create_dialog": {
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/pt.json b/dodaios/ui/web/frontend/src/i18n/locales/pt.json
index 063421704d..65843f1a4d 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/pt.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/pt.json
@@ -8875,6 +8875,9 @@
},
"cocoa": {
"description": "Um cachorro Labrador chocolate: inclina a cabeça para ouvir, escava quando trabalha, corre às voltas no sucesso."
+ },
+ "dodaios": {
+ "description": "A figura encapuzada do logótipo: a ponta do capuz levanta-se para ouvir e a capa voa num salto."
}
},
"create_dialog": {
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/zh.json b/dodaios/ui/web/frontend/src/i18n/locales/zh.json
index 64beef1c46..684b04a17b 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/zh.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/zh.json
@@ -8875,6 +8875,9 @@
},
"cocoa": {
"description": "一只巧克力色拉布拉多幼犬:倾听时歪着头,工作时刨土,成功时兴奋地狂奔。"
+ },
+ "dodaios": {
+ "description": "标志里的兜帽小人:倾听时帽尖竖起,跳跃时披风飞扬。"
}
},
"create_dialog": {
diff --git a/scripts/art/build_pet_companions.py b/scripts/art/build_pet_companions.py
index 4d13e865a4..b09b8d55d1 100644
--- a/scripts/art/build_pet_companions.py
+++ b/scripts/art/build_pet_companions.py
@@ -807,6 +807,248 @@ def build_cocoa(root):
)
+#: Edge of one Dodaios voxel in metres: the figure is the pixel pet made solid,
+#: about as many cubes tall as the sprite is pixels.
+DODAIOS_VOXEL = 0.0125
+_DODAIOS_INK, _DODAIOS_WHITE = 0, 1
+Voxels = dict[tuple[int, int, int], int]
+
+
+def _voxel_ellipsoid(centre, radii, floor: int | None = None) -> set[tuple[int, int, int]]:
+ """Voxels whose centre lies inside the ellipsoid, at or above ``floor``."""
+ out = set()
+ lo = [math.floor(c - r) - 1 for c, r in zip(centre, radii, strict=True)]
+ hi = [math.ceil(c + r) + 1 for c, r in zip(centre, radii, strict=True)]
+ for x in range(lo[0], hi[0]):
+ for y in range(lo[1], hi[1]):
+ for z in range(lo[2], hi[2]):
+ if floor is not None and z < floor:
+ continue
+ d = sum(
+ ((p + 0.5 - c) / r) ** 2
+ for p, c, r in zip((x, y, z), centre, radii, strict=True)
+ )
+ if d <= 1.0:
+ out.add((x, y, z))
+ return out
+
+
+def _voxel_front(solid, x: int, z: int) -> int | None:
+ """The y of the front-most voxel (-Y is forward) in the column ``(x, z)``."""
+ ys = [y for (vx, y, vz) in solid if vx == x and vz == z]
+ return min(ys) if ys else None
+
+
+def voxel_mesh(name: str, voxels: Voxels, pivot, materials, parent):
+ """A cube mesh of ``voxels`` (grid coordinates) around ``pivot`` (grid coordinates).
+
+ Only the faces that show are built, and same-coloured faces in one plane
+ are merged into rectangles, so a figure of a few thousand cubes stays a
+ small mesh. Shading is flat: the cubes are the look.
+ """
+ verts: dict[tuple[int, int, int], int] = {}
+ faces: list[tuple[int, ...]] = []
+ face_materials: list[int] = []
+ for axis in range(3):
+ u_axis, v_axis = (a for a in range(3) if a != axis)
+ for sign in (-1, 1):
+ layers: dict[int, dict[tuple[int, int], int]] = {}
+ for pos, mat in voxels.items():
+ beyond = list(pos)
+ beyond[axis] += sign
+ if tuple(beyond) not in voxels:
+ layers.setdefault(pos[axis], {})[(pos[u_axis], pos[v_axis])] = mat
+ for layer in sorted(layers):
+ cells = layers[layer]
+ done: set[tuple[int, int]] = set()
+ for u, v in sorted(cells):
+ if (u, v) in done:
+ continue
+ mat = cells[(u, v)]
+ w = 1
+ while cells.get((u + w, v)) == mat and (u + w, v) not in done:
+ w += 1
+ h = 1
+ while all(
+ cells.get((u + i, v + h)) == mat and (u + i, v + h) not in done
+ for i in range(w)
+ ):
+ h += 1
+ done.update((u + i, v + j) for i in range(w) for j in range(h))
+ plane = layer + (1 if sign > 0 else 0)
+ corners = [(u, v), (u + w, v), (u + w, v + h), (u, v + h)]
+ # (u, v) winds towards +axis for x and z, towards -y for y.
+ if (axis == 1) == (sign > 0):
+ corners.reverse()
+ quad = []
+ for cu, cv in corners:
+ point = [0, 0, 0]
+ point[axis], point[u_axis], point[v_axis] = plane, cu, cv
+ quad.append(verts.setdefault(tuple(point), len(verts)))
+ faces.append(tuple(quad))
+ face_materials.append(mat)
+ mesh = bpy.data.meshes.new(name)
+ mesh.from_pydata(
+ [tuple((p[i] - pivot[i]) * DODAIOS_VOXEL for i in range(3)) for p in verts],
+ [],
+ faces,
+ )
+ for mat in materials:
+ mesh.materials.append(mat)
+ for polygon, mat in zip(mesh.polygons, face_materials, strict=True):
+ polygon.material_index = mat
+ polygon.use_smooth = False
+ mesh.update()
+ obj = bpy.data.objects.new(name, mesh)
+ bpy.context.collection.objects.link(obj)
+ obj.parent = parent
+ return obj
+
+
+def build_dodaios(root):
+ """The hooded figure of the logo as a voxel toy: the pixel pet made solid.
+
+ Black cubes with white trim where the logo draws its lines: the lining
+ around the face, the collar, the hems of robe and cape and the toes. In
+ the world it stands up and walks on its two legs, each a pivot at the
+ hip; the cape, the hood's tip and the head are pivots of their own.
+ """
+ mats = (
+ material("dodaios.Ink", "#111114", 0.82),
+ material("dodaios.White", "#f4f4f6", 0.7),
+ )
+ v = DODAIOS_VOXEL
+ #: How far the standing figure's upper body sits above the ground (grid).
+ lift = 7
+
+ def at(point):
+ return tuple(c * v for c in point)
+
+ def pivot(name, point, parent, parent_point=(0, 0, 0)):
+ local = tuple(p - q for p, q in zip(point, parent_point, strict=True))
+ return empty(name, at(local), parent)
+
+ def exposed(solid, cell):
+ x, y, z = cell
+ return any(
+ n not in solid for n in ((x + 1, y, z), (x - 1, y, z), (x, y + 1, z), (x, y - 1, z))
+ )
+
+ # Robe: a short round body with a white hem, clear of the ground.
+ body_at = (0, 0, lift)
+ body = pivot("dodaios_Body", body_at, root)
+ robe_solid = _voxel_ellipsoid((0, 1, lift + 7), (9.5, 8.5, 7.5), floor=lift)
+ robe: Voxels = dict.fromkeys(robe_solid, _DODAIOS_INK)
+ for cell in robe_solid:
+ if cell[2] <= lift + 1 and exposed(robe_solid, cell):
+ robe[cell] = _DODAIOS_WHITE
+ voxel_mesh("dodaios_Robe", robe, body_at, mats, body)
+
+ # Hood: a round head with a cone that leans back to its point.
+ head_at = (0, 0, lift + 12)
+ head = pivot("dodaios_Head", head_at, body, body_at)
+ solid = _voxel_ellipsoid((0, 0, lift + 21.5), (13, 11.5, 10.5))
+ for z in range(lift + 27, lift + 40):
+ t = (z + 0.5 - (lift + 27)) / 13
+ radius = max(1.2, 10 * (1 - t) ** 0.85)
+ centre_y = 1 + 4 * t
+ for x in range(-12, 12):
+ for y in range(-12, 18):
+ if (x + 0.5) ** 2 + (y + 0.5 - centre_y) ** 2 <= radius**2:
+ solid.add((x, y, z))
+ hood: Voxels = dict.fromkeys(solid, _DODAIOS_INK)
+ # The collar: the hood's lower edge in white.
+ for cell in solid:
+ if cell[2] <= lift + 13 and exposed(solid, cell):
+ hood[cell] = _DODAIOS_WHITE
+ # The face: an oval carved two cubes deep, with the white lining around it.
+ for x in range(-12, 12):
+ for z in range(lift + 11, lift + 33):
+ front = _voxel_front(solid, x, z)
+ if front is None:
+ continue
+ face = ((x + 0.5) / 8.8) ** 2 + ((z + 0.5 - (lift + 21)) / 7.2) ** 2
+ lining = ((x + 0.5) / 10.8) ** 2 + ((z + 0.5 - (lift + 21.7)) / 9.3) ** 2
+ if face <= 1:
+ hood.pop((x, front, z), None)
+ hood.pop((x, front + 1, z), None)
+ elif lining <= 1:
+ hood[(x, front, z)] = _DODAIOS_WHITE
+ if (x, front + 1, z) in hood:
+ hood[(x, front + 1, z)] = _DODAIOS_WHITE
+ voxel_mesh("dodaios_Hood", hood, head_at, mats, head)
+
+ # Eyes: white ovals set into the face, each on its own pivot so it can blink.
+ for side, sign in (("L", -1), ("R", 1)):
+ x0 = -7 if sign < 0 else 4
+ eye_front = _voxel_front(set(hood), x0 + 1, lift + 20)
+ eye_y = (eye_front if eye_front is not None else -9) - 1
+ eye_at = (x0 + 1.5, eye_y + 0.5, lift + 20.5)
+ eye = pivot(f"dodaios_Eye_{side}", eye_at, head, head_at)
+ cells = {
+ (x0 + i, eye_y, lift + 18 + j)
+ for i in range(3)
+ for j in range(6)
+ if not (i in (0, 2) and j in (0, 5))
+ }
+ voxel_mesh(
+ f"dodaios_EyeWhite_{side}", dict.fromkeys(cells, _DODAIOS_WHITE), eye_at, mats, eye
+ )
+
+ # The hood's point: a short flick out to one side and back.
+ tip_at = (0, 5, lift + 38)
+ tip = pivot("dodaios_Tip", tip_at, head, head_at)
+ flick: set[tuple[int, int, int]] = set()
+ path = ((0, 5, 38.4), (3, 7.5, 38.6), (6.5, 9.5, 37.4), (9.5, 10.5, 35.2))
+ for (ax, ay, az), (bx, by, bz) in zip(path, path[1:], strict=False):
+ for k in range(9):
+ f = k / 8
+ centre = (ax + (bx - ax) * f, ay + (by - ay) * f, lift + az + (bz - az) * f)
+ reach = 1.9 - 0.9 * (centre[0] / 9.5)
+ flick |= _voxel_ellipsoid(centre, (reach, reach, reach))
+ voxel_mesh("dodaios_Flick", dict.fromkeys(flick - solid, _DODAIOS_INK), tip_at, mats, tip)
+
+ # Cape: a thin sheet from the neck that flares and drifts back, hemmed in white.
+ top = lift + 16
+ cape_at = (0, 9, top)
+ cape = pivot("dodaios_Cape", cape_at, body, body_at)
+ sheet: Voxels = {}
+ for z in range(4, top + 1):
+ half = int(5 + (top - z) * 0.45)
+ back = 9 + round((top - z) * 0.35)
+ for x in range(-half, half):
+ hem = 4 + abs(x + 0.5) * 0.25
+ if z < hem:
+ continue
+ edge = z < hem + 1.5 or x in (-half, half - 1)
+ for y in (back, back + 1):
+ sheet[(x, y, z)] = _DODAIOS_WHITE if edge else _DODAIOS_INK
+ voxel_mesh("dodaios_CapeSheet", sheet, cape_at, mats, cape)
+
+ # Legs: a short leg and a round shoe each, swinging from the hip under the
+ # robe; the toes are capped in white like the logo's outlined feet.
+ for side, sign in (("L", -1), ("R", 1)):
+ hip_at = (sign * 5, 0, lift + 2)
+ leg = pivot(f"dodaios_Leg_{side}", hip_at, root)
+ limb: Voxels = {}
+ for z in range(2, lift + 3):
+ for x in range(-3, 3):
+ for y in range(-3, 3):
+ if (x + 0.5) ** 2 + (y + 0.5) ** 2 <= 2.6**2:
+ limb[(sign * 5 + x, y, z)] = _DODAIOS_INK
+ centre = (sign * 5, -2, 2.4)
+ shoe_solid = _voxel_ellipsoid(centre, (3.6, 5.2, 2.6), floor=0)
+ for cell in shoe_solid:
+ limb[cell] = _DODAIOS_INK
+ for x, y, z in shoe_solid:
+ if y != _voxel_front(shoe_solid, x, z):
+ continue
+ ring = ((x + 0.5 - centre[0]) / 3.6) ** 2 + ((z + 0.5 - centre[2]) / 2.6) ** 2
+ if ring >= 0.4:
+ limb[(x, y, z)] = _DODAIOS_WHITE
+ voxel_mesh(f"dodaios_LegMesh_{side}", limb, hip_at, mats, leg)
+
+
PETS = {
"miso": build_miso,
"ember": build_ember,
@@ -815,6 +1057,7 @@ PETS = {
"brew": build_brew,
"bolt": build_bolt,
"cocoa": build_cocoa,
+ "dodaios": build_dodaios,
}
diff --git a/scripts/pets/build_pets.py b/scripts/pets/build_pets.py
index c548a3df6f..b063eb42ad 100644
--- a/scripts/pets/build_pets.py
+++ b/scripts/pets/build_pets.py
@@ -8655,7 +8655,381 @@ COCOA = PetDesign(
)
-PETS: tuple[PetDesign, ...] = (GIGI, MISO, BREW, BOLT, MOCHI, SHELLY, EMBER, COCOA)
+# -- Dodaios: the hooded figure -------------------------------------------------
+#
+# Drawn after the logo (``assets/brand/dodaios-logo.svg``, docs/BRAND.md): a
+# small figure sitting on the ground in black and white, a big pointed hood
+# whose tip flicks out to the right, a dark face with two white oval eyes
+# turned a little to the left, two round feet in front and a cape blown out
+# behind it. The logo has no mouth, so one shows only while it talks, cheers
+# or frets. The hood's tip and the cape carry the body language: the tip
+# perks up to listen and droops asleep, the cape flies on a hop and hangs
+# when the figure is carried.
+
+DODAIOS_INK = hexc("#111114")
+DODAIOS_WHITE = hexc("#f4f4f6")
+DODAIOS_SMOKE = hexc("#c9cdd6")
+DODAIOS_SMOKE_DARK = hexc("#8d95a6")
+#: The left eye is the far one of a face turned a little away: a pixel shorter.
+DODAIOS_EYE_FAR = EyeStyle(w=3, h=5, iris=DODAIOS_WHITE, glint=None, lid=DODAIOS_WHITE)
+DODAIOS_EYE_NEAR = EyeStyle(w=4, h=6, iris=DODAIOS_WHITE, glint=None, lid=DODAIOS_WHITE)
+_DODAIOS_EYE_FAR_AT = (13, 21)
+_DODAIOS_EYE_NEAR_AT = (20, 20)
+#: Brand sparkles: white with a bright core instead of the shared gold.
+DODAIOS_SPARK = {"#": hexc("#d9dbe2"), "o": hexc("#ffffff")}
+
+#: The dark face inside the hood and the white lining around it. The face sits
+#: a touch low and right, so the lining shows as the logo's crescent: widest
+#: at the top left, running out along the top and down the left side.
+_DODAIOS_FACE = frozenset(ellipse(20.3, 23.4, 8.6, 7.0))
+_DODAIOS_LINING = frozenset(
+ p for p in ellipse(19.5, 22.5, 10.2, 8.4) - _DODAIOS_FACE if p[0] <= 22 or p[1] <= 18
+)
+_DODAIOS_GROUND = 44
+_DODAIOS_TORSO = frozenset(p for p in ellipse(22, 38.5, 12.5, 7.5) if p[1] <= _DODAIOS_GROUND)
+_DODAIOS_FEET = (13.0, 21.0)
+
+#: Eyes without pupils look by moving: (dx, dy) of both eyes per look.
+_DODAIOS_LOOKS = {
+ "look_left": (-1, 0),
+ "look_right": (1, 0),
+ "up_left": (-1, -1),
+ "up_right": (1, -1),
+ "down": (-1, 1),
+}
+
+#: Idle over the seven loop cells: the hood's tip twitches, the cape stirs.
+_DODAIOS_IDLE_TIP = (0, 0, 0, -1, -1, 0, 0)
+_DODAIOS_IDLE_CAPE = (0, 0, 1, 1, 0, -1, 0)
+#: Listening: the tip perks up towards the sound and holds.
+_DODAIOS_LISTEN_TIP = (-1, -2, -3, -3, -2, -2)
+#: Thinking: the tip wags slowly up and down.
+_DODAIOS_THINK_TIP = (0, -1, -2, -1, 0, 1, 2, 1)
+#: Success: a lower hop than the shared one (the hood is tall), and the cape
+#: trails it: still rising while the body falls, flapping down on landing.
+_DODAIOS_HOP = (0, -2, -3, -4, -3, -2, 0, 0)
+_DODAIOS_HOP_STRETCH = (-1, 1, 0, 0, 0, 0, -1, 0)
+_DODAIOS_HOP_CAPE = (0, -2, -4, -6, -6, -4, 1, 0)
+#: Talking: the cape lifts a little with the louder mouths.
+_DODAIOS_TALK_CAPE = (0, 0, -1, -2)
+
+
+def dodaios_pose(state: str, i: int) -> Pose:
+ pose = base_pose(state, i)
+ if state in ("thinking", "sleeping", "searching"):
+ return replace(pose, mouth="rest")
+ if state == "success":
+ return Pose(
+ state,
+ i,
+ dy=_DODAIOS_HOP[i],
+ eyes="happy",
+ mouth="smile",
+ stretch=_DODAIOS_HOP_STRETCH[i],
+ )
+ if state == "working":
+ # Shifted right to make room for its laptop; eyes down on the screen.
+ return Pose(state, i, dx=3, dy=WORK_BOB[i], eyes="down", mouth="rest")
+ if state == "held":
+ return Pose(state, i, dx=HELD_SWAY[i], dy=-3, eyes="wide", mouth="open")
+ return pose
+
+
+def _dodaios_hood(tip: int) -> Mask:
+ """The hood; ``tip`` lifts (negative) or droops the flick at its point."""
+ return polygon(
+ [
+ (24, 6),
+ (27.5, 8),
+ (30, 11),
+ (33.5, 12.5 + tip / 2),
+ (39, 11 + tip),
+ (35.5, 14.5 + tip / 2),
+ (32.5, 16.5),
+ (33.5, 21),
+ (32.5, 27),
+ (29, 31.5),
+ (20, 33.5),
+ (11, 31.5),
+ (6, 26),
+ (5.5, 21.5),
+ (7.5, 18.5),
+ (13, 13),
+ (19, 8.5),
+ ]
+ )
+
+
+def _dodaios_cape(lift: int, reach: int) -> Mask:
+ """The cape behind the body; ``lift`` raises its point, ``reach`` pulls it in."""
+ return polygon(
+ [
+ (28, 28),
+ (35, 29 + lift / 2),
+ (43 + reach, 32 + lift),
+ (38.5 + reach / 2, 35.5 + lift / 2),
+ (37, 38.5),
+ (36, 43),
+ (29, 41),
+ ]
+ )
+
+
+def _dodaios_foot(cx: float, drop: int) -> Mask:
+ foot = ellipse(cx, 40.5 + drop, 3.8, 4.4)
+ return {p for p in foot if p[1] <= _DODAIOS_GROUND + drop}
+
+
+def _dodaios_look(pose: Pose) -> tuple[int, int, int, int]:
+ """(hood tip, cape lift, cape reach, feet drop) for this frame."""
+ i = pose.i
+ if pose.act:
+ tips = _DODAIOS_ACT_TIP.get(pose.act)
+ lift = _DODAIOS_GUST_LIFT[i] if pose.act == "cape_gust" else 0
+ return (tips[i] if tips else 0, lift, 0, 0)
+ if pose.state == "idle":
+ if i >= len(_DODAIOS_IDLE_TIP):
+ return (0, 0, 0, 0)
+ return (_DODAIOS_IDLE_TIP[i], _DODAIOS_IDLE_CAPE[i], 0, 0)
+ if pose.state == "listening":
+ return (_DODAIOS_LISTEN_TIP[i], 0, 0, 0)
+ if pose.state == "thinking":
+ return (_DODAIOS_THINK_TIP[i], 0, 0, 0)
+ if pose.state == "talking":
+ return (0, _DODAIOS_TALK_CAPE[i], 0, 0)
+ if pose.state == "success":
+ return (-2 if 1 <= i <= 5 else 0, _DODAIOS_HOP_CAPE[i], 0, 0)
+ if pose.state == "error":
+ return (3, i % 2, 0, 0)
+ if pose.state == "sleeping":
+ return (3, 2, -1, 0)
+ if pose.state == "working":
+ return (0, 1, -3, 0)
+ if pose.state == "held":
+ # Picked up by the hood: the tip is pulled up, cape and feet hang.
+ return (-3, 5, -4, 2)
+ return (0, 0, 0, 0)
+
+
+def _dodaios_eyes(f: Frame, style: str) -> None:
+ if style == "hidden":
+ return
+ dx, dy = _DODAIOS_LOOKS.get(style, (0, 0))
+ shape = "open" if style in _DODAIOS_LOOKS or style == "peek" else style
+ near_x, near_y = _DODAIOS_EYE_NEAR_AT
+ draw_eye(f, shape, near_x + dx, near_y + dy, DODAIOS_EYE_NEAR, right=True)
+ if style == "peek":
+ return # one eye out from under the hood
+ far_x, far_y = _DODAIOS_EYE_FAR_AT
+ draw_eye(f, shape, far_x + dx, far_y + dy, DODAIOS_EYE_FAR, right=False)
+
+
+_DODAIOS_MOUTHS = {
+ "closed": ("####",),
+ "half": (".##.", ".##."),
+ "open": (".##.", "#..#", ".##."),
+ "wide": ("####", "#..#", "####"),
+ "smile": ("#..#", ".##."),
+ "frown": (".##.", "#..#"),
+}
+
+
+def _dodaios_mouth(f: Frame, style: str) -> None:
+ """White on the dark face, between the eyes; the resting face has none."""
+ if style == "rest":
+ return
+ rows = _DODAIOS_MOUTHS[style]
+ f.paint(from_rows(16, 30 - len(rows), rows), DODAIOS_WHITE)
+
+
+def draw_dodaios(f: Frame, pose: Pose) -> None:
+ tip, lift, reach, drop = _dodaios_look(pose)
+ with f.offset(pose.dx, pose.dy):
+ parts = [_dodaios_cape(lift, reach), set(_DODAIOS_TORSO)]
+ parts += [_dodaios_foot(cx, drop) for cx in _DODAIOS_FEET]
+ parts.append(_dodaios_hood(tip))
+ for mask in parts:
+ f.part(mask, shade(mask, DODAIOS_INK, rim=DODAIOS_WHITE))
+ f.paint(_DODAIOS_LINING, DODAIOS_WHITE)
+ _dodaios_eyes(f, pose.eyes)
+ _dodaios_mouth(f, pose.mouth)
+
+
+def _dodaios_thinking_fx(f: Frame, pose: Pose) -> None:
+ """Three dots beside the hood, hopping up one after the other."""
+ up = pose.i // 2
+ for k in range(3):
+ x, y = 37 + 4 * k, 22 - (2 if k == up else 0)
+ f.part(rect(x, y, x + 1, y + 1), FX_WHITE if k == up else FX_DIM)
+
+
+def _dodaios_success_fx(f: Frame, pose: Pose) -> None:
+ fx_sparkles(f, pose.i, DODAIOS_ANCHORS.sparkles, DODAIOS_SPARK)
+
+
+def _dodaios_working_fx(f: Frame, pose: Pose) -> None:
+ """A laptop at the figure's feet: key ticks above it, code chips rising beside it."""
+ i = pose.i
+ x, y = 4, 34
+ lid = rounded_rect(x, y, x + 11, y + 7, 1)
+ f.part(lid, shade(lid, LAPTOP_LID, light=LAPTOP_LID_LIGHT, dark=LAPTOP_LID, dark_depth=1))
+ f.paint(rect(x + 5, y + 3, x + 6, y + 4), LAPTOP_LOGO if i % 4 != 3 else LAPTOP_LID_LIGHT)
+ base = rect(x - 2, y + 8, x + 13, y + 9)
+ f.part(base, {p: (LAPTOP_BASE if p[1] == y + 8 else LAPTOP_BASE_DARK) for p in base})
+ ticks = _KEY_TICKS[i % len(_KEY_TICKS)]
+ if ticks:
+ f.paint(rect(x + 2, y - 1, x + 9, y - 1), SCREEN_GLOW)
+ for dx, dy in ticks:
+ tx = x + min(dx, 10)
+ f.paint({(tx, y + dy - 1), (tx, y + dy - 2)}, FX_WHITE)
+ glyph = _CODE_GLYPHS[(i // 4) % len(_CODE_GLYPHS)]
+ f.glyph(1, y - 5 - 2 * (i % 4), glyph, {"#": CODE_CHIP})
+
+
+def _dodaios_held_fx(f: Frame, pose: Pose) -> None:
+ """Swing streaks on the side the dangling figure just left."""
+ moving = HELD_SWAY[pose.i] - HELD_SWAY[pose.i - 1]
+ if not moving:
+ return
+ x, step = (4, -2) if moving > 0 else (44, 2)
+ f.paint(line(x, 28, x, 33) | line(x + step, 29, x + step, 32), ARC_FADE)
+
+
+# Dodaios's idle acts: a gust takes the cape, the hood comes down over the
+# eyes, a look around, a smoke bomb, and nodding off for a second.
+
+_DODAIOS_GUST_LIFT = (0, -2, -5, -7, -7, -5, -2, 0)
+#: Hood tip per act frame.
+_DODAIOS_ACT_TIP = {
+ "cape_gust": (0, -1, -2, -3, -3, -2, -1, 0),
+ "peekaboo": (0, 1, 2, 2, 2, 1, -2, 0),
+ "look_around": (1, 1, 0, -1, -1, -2, -2, 0),
+ "nod_off": (0, 1, 2, 3, 4, -3, -1, 0),
+}
+_DODAIOS_PEEK_EYES = ("open", "closed", "hidden", "hidden", "peek", "peek", "wide", "open")
+_DODAIOS_PEEK_STRETCH = (0, -1, -1, -1, -1, 0, 1, 0)
+_DODAIOS_AROUND_EYES = (
+ "look_left",
+ "look_left",
+ "open",
+ "look_right",
+ "look_right",
+ "up_right",
+ "up_left",
+ "open",
+)
+_DODAIOS_AROUND_DX = (-1, -1, 0, 1, 1, 0, 0, 0)
+_DODAIOS_NOD_EYES = ("open", "down", "closed", "sleep", "sleep", "wide", "open", "open")
+_DODAIOS_NOD_STRETCH = (0, 0, -1, -1, -1, 1, 0, 0)
+#: Smoke bomb: how far the figure has dithered away per frame (16 = gone).
+_DODAIOS_VANISH = (0, 0, 6, 12, 20, 12, 6, 0)
+#: The smoke per frame as (cx, cy, r) puffs: it bursts at the feet, swallows
+#: the figure, then thins out upwards.
+_DODAIOS_PUFFS: dict[int, tuple[tuple[float, float, float], ...]] = {
+ 1: ((22, 40, 3.0),),
+ 2: ((14, 38, 4.0), (28, 37, 4.5), (21, 32, 4.0)),
+ 3: ((11, 34, 5.0), (30, 33, 5.5), (20, 26, 6.0), (22, 40, 5.0)),
+ 4: ((8, 30, 3.5), (34, 28, 4.0), (20, 20, 4.5)),
+ 5: ((6, 26, 2.0), (37, 23, 2.5), (20, 15, 2.5)),
+}
+#: Wind streaks of the gust as (y, first x, last x, frames it shows in): one
+#: in front of the figure, two that have passed it.
+_DODAIOS_GUSTS = ((9, 1, 12, (1, 2, 3)), (33, 1, 7, (2, 3, 4)), (22, 36, 46, (3, 4, 5, 6)))
+
+
+def _dodaios_gust_pose(i: int) -> Pose:
+ return Pose("idle", i, eyes="look_right" if 2 <= i <= 5 else "open")
+
+
+def _dodaios_gust_fx(f: Frame, pose: Pose) -> None:
+ for y, x0, x1, frames in _DODAIOS_GUSTS:
+ if pose.i not in frames:
+ continue
+ head = x0 + (x1 - x0) * frames.index(pose.i) // (len(frames) - 1)
+ f.paint(rect(max(x0, head - 4), y, head, y), FX_DIM)
+
+
+def _dodaios_peek_pose(i: int) -> Pose:
+ return Pose("idle", i, eyes=_DODAIOS_PEEK_EYES[i], stretch=_DODAIOS_PEEK_STRETCH[i])
+
+
+def _dodaios_around_pose(i: int) -> Pose:
+ return Pose("idle", i, dx=_DODAIOS_AROUND_DX[i], eyes=_DODAIOS_AROUND_EYES[i])
+
+
+def _dodaios_smoke_pose(i: int) -> Pose:
+ return Pose("idle", i, eyes="wide" if i in (1, 6) else "open")
+
+
+def _dodaios_smoke_fx(f: Frame, pose: Pose) -> None:
+ for cx, cy, r in _DODAIOS_PUFFS.get(pose.i, ()):
+ puff = ellipse(cx, cy, r, r)
+ f.part(
+ puff, shade(puff, DODAIOS_SMOKE, light=FX_WHITE, dark=DODAIOS_SMOKE_DARK, dark_depth=1)
+ )
+
+
+def _dodaios_nod_pose(i: int) -> Pose:
+ return Pose("idle", i, eyes=_DODAIOS_NOD_EYES[i], stretch=_DODAIOS_NOD_STRETCH[i])
+
+
+def _dodaios_nod_fx(f: Frame, pose: Pose) -> None:
+ """A single z while it dozes, a start when it catches itself."""
+ if pose.i in (3, 4):
+ f.glyph(38, 24 - 3 * (pose.i - 3), _Z_SMALL, _Z_PALETTE)
+ elif pose.i == 5:
+ f.paint(line(38, 21, 41, 19) | line(38, 25, 42, 25), ARC)
+
+
+def dodaios_post(img: Image.Image, pose: Pose) -> Image.Image:
+ if pose.act == "smoke_bomb" and _DODAIOS_VANISH[pose.i]:
+ return gigi_vanish(img, _DODAIOS_VANISH[pose.i])
+ return img
+
+
+DODAIOS_ACTS = (
+ IdleAct("cape_gust", 8, 9, _dodaios_gust_pose, _dodaios_gust_fx),
+ IdleAct("peekaboo", 8, 6, _dodaios_peek_pose),
+ IdleAct("look_around", 8, 5, _dodaios_around_pose),
+ IdleAct("smoke_bomb", 8, 8, _dodaios_smoke_pose, _dodaios_smoke_fx),
+ IdleAct("nod_off", 8, 5, _dodaios_nod_pose, _dodaios_nod_fx),
+)
+
+DODAIOS_ANCHORS = Anchors(
+ arcs_left=(9, 12),
+ arcs_right=(36, 22),
+ dots=(19, 4),
+ zzz=(2, 14),
+ bang=(41, 2),
+ sweat=(4, 9),
+ sparkles=((4, 12, 1), (43, 22, 2), (5, 36, 3), (44, 42, 3)),
+ magnifier=(21, 35),
+)
+
+DODAIOS = PetDesign(
+ id="dodaios",
+ name="Dodaios",
+ description=(
+ "The hooded figure of the logo: its hood tip perks up to listen, its cape flies on a hop."
+ ),
+ draw=draw_dodaios,
+ pose=dodaios_pose,
+ anchors=DODAIOS_ANCHORS,
+ # Between the hood's lower edge and the feet: a breath lifts the head and
+ # leaves the feet planted.
+ waist=36,
+ post=dodaios_post,
+ fx={
+ "thinking": _dodaios_thinking_fx,
+ "success": _dodaios_success_fx,
+ "working": _dodaios_working_fx,
+ "held": _dodaios_held_fx,
+ },
+ acts=DODAIOS_ACTS,
+)
+
+
+PETS: tuple[PetDesign, ...] = (GIGI, MISO, BREW, BOLT, MOCHI, SHELLY, EMBER, COCOA, DODAIOS)
# ---------------------------------------------------------------------------
diff --git a/tests/unit/ui/conftest.py b/tests/unit/ui/conftest.py
new file mode 100644
index 0000000000..da740e0f0f
--- /dev/null
+++ b/tests/unit/ui/conftest.py
@@ -0,0 +1,19 @@
+"""Fixtures shared by the desktop overlay tests."""
+
+from __future__ import annotations
+
+from pathlib import Path
+
+import pytest
+
+_MASCOT_IMAGE = Path(__file__).resolve().parents[3] / "assets" / "icons" / "jarvis-gigi-256.png"
+
+
+def still_picture_mascot(monkeypatch: pytest.MonkeyPatch) -> None:
+ """Make the mascot style the still picture, as a configured image does.
+
+ Without one the mascot is a pet (``MASCOT_PET_ID``); the tests of the
+ picture's own window, drag and boot behaviour ask for it by name.
+ """
+ monkeypatch.setenv("JARVIS_ORB_MASCOT_PATH", str(_MASCOT_IMAGE))
diff --git a/tests/unit/ui/pets/test_builtin_pets.py b/tests/unit/ui/pets/test_builtin_pets.py
index 848cd1506d..683e49849e 100644
--- a/tests/unit/ui/pets/test_builtin_pets.py
+++ b/tests/unit/ui/pets/test_builtin_pets.py
@@ -17,7 +17,17 @@ from dodaios.ui.pets.states import DEFAULT_PET_ID, PET_STATES
REPO_ROOT = Path(__file__).resolve().parents[4]
BUILD_SCRIPT = REPO_ROOT / "scripts" / "pets" / "build_pets.py"
PACKAGE_DIR = REPO_ROOT / "dodaios" / "ui" / "pets"
-EXPECTED_PETS = ("gigi", "miso", "brew", "bolt", "mochi", "shelly", "ember", "cocoa")
+EXPECTED_PETS = (
+ "gigi",
+ "miso",
+ "brew",
+ "bolt",
+ "mochi",
+ "shelly",
+ "ember",
+ "cocoa",
+ "dodaios",
+)
def _builder() -> ModuleType:
diff --git a/tests/unit/ui/test_desktop_minimize_to_tray_overlay.py b/tests/unit/ui/test_desktop_minimize_to_tray_overlay.py
index efe035ffac..d61bca8d27 100644
--- a/tests/unit/ui/test_desktop_minimize_to_tray_overlay.py
+++ b/tests/unit/ui/test_desktop_minimize_to_tray_overlay.py
@@ -128,13 +128,13 @@ def test_restore_is_noop_without_overlay() -> None:
app._restore_overlay_for_visible_window()
-def test_restore_keeps_mascot_hide_on_idle() -> None:
- """The mascot is hide-at-idle regardless of bar_persistent (which only
- governs the jarvis bar). Restoring must not pin the mascot on screen."""
+def test_restore_keeps_voice_orb_hide_on_idle() -> None:
+ """The voice orb is hide-at-idle regardless of bar_persistent (which only
+ governs the jarvis bar). Restoring must not pin the orb on screen."""
bar = FakeBar()
bridge = SimpleNamespace(_hide_on_idle=True)
app = _app(persistent=True, orb=bar, bridge=bridge)
- app.cfg.ui.orb_style = "mascot"
+ app.cfg.ui.orb_style = "voice_orb"
app._restore_overlay_for_visible_window()
diff --git a/tests/unit/ui/test_desktop_swap_overlay.py b/tests/unit/ui/test_desktop_swap_overlay.py
index 09fa3c984e..faa7fb2ed5 100644
--- a/tests/unit/ui/test_desktop_swap_overlay.py
+++ b/tests/unit/ui/test_desktop_swap_overlay.py
@@ -180,11 +180,15 @@ class FakeOrbWindow(FakeOld):
def set_style(self, style):
self.style = style
+ def show(self, mode="listen"):
+ self.hidden = False
+
def test_mascot_to_voice_orb_restyles_live_without_a_new_root():
# Both orb looks live in ONE window, so this transition needs no second Tk
# root and must not send the user through a restart.
bridge, orb = FakeBridge(), FakeOrbWindow("mascot")
+ orb._mode = "listen" # mid-conversation; an idle mascot would make way
app = _app(orb_style="mascot", bridge=bridge, orb=orb)
app._surfaces = {"mascot": orb}
@@ -205,6 +209,7 @@ def test_voice_orb_back_to_mascot_also_applies_live():
assert app.swap_overlay("mascot")["applied_live"] is True
assert orb.style == "mascot"
+ assert orb.hidden is False # the mascot is a pet: it is on screen at once
def test_bar_to_voice_orb_starts_the_orb_window_hosted():
@@ -218,10 +223,10 @@ def test_bar_to_voice_orb_starts_the_orb_window_hosted():
assert bridge.surface is built[0]
-def test_pet_to_mascot_hides_the_idle_window_although_the_route_prewrote_cfg():
+def test_pet_to_voice_orb_hides_the_idle_window_although_the_route_prewrote_cfg():
# The settings route stores the NEW style in cfg before calling
# swap_overlay, so "what was on screen" must not be read from cfg: an idle
- # pet turned mascot has to go off the screen (the mascot pops per session).
+ # pet turned voice orb has to go off the screen (the orb pops per session).
class Window(FakeOrbWindow):
_mode = "idle"
@@ -229,9 +234,9 @@ def test_pet_to_mascot_hides_the_idle_window_although_the_route_prewrote_cfg():
self.hidden = False
bridge, window = FakeBridge(), Window("pet")
- app = _app(orb_style="mascot", bridge=bridge, orb=window)
+ app = _app(orb_style="voice_orb", bridge=bridge, orb=window)
app._surfaces = {"pet": window}
app._live_overlay_style = "pet"
- assert app.swap_overlay("mascot")["applied_live"] is True
+ assert app.swap_overlay("voice_orb")["applied_live"] is True
assert window.hidden is True
diff --git a/tests/unit/ui/test_orb_drag_handlers.py b/tests/unit/ui/test_orb_drag_handlers.py
index 389649906a..26b52e5e0f 100644
--- a/tests/unit/ui/test_orb_drag_handlers.py
+++ b/tests/unit/ui/test_orb_drag_handlers.py
@@ -21,6 +21,9 @@ if sys.platform != "win32":
from ui.orb.drag_persistence import _ScreenSnapshot
from ui.orb.overlay import DRAG_THRESHOLD_PX, OrbOverlay, _DragState
+# The still-picture mascot; without a configured image the mascot is a pet.
+pytestmark = pytest.mark.usefixtures("still_picture_mascot")
+
def _make_overlay_with_fakes(tmp_path: Path, monkeypatch):
ov = OrbOverlay()
diff --git a/tests/unit/ui/test_orb_mascot_dictation_look.py b/tests/unit/ui/test_orb_mascot_dictation_look.py
index 51993fdcd6..c7c0a035e6 100644
--- a/tests/unit/ui/test_orb_mascot_dictation_look.py
+++ b/tests/unit/ui/test_orb_mascot_dictation_look.py
@@ -67,6 +67,9 @@ from dodaios.ui.dodaiosbar.modes import ( # noqa: E402
VOICE_MODES,
)
+# The still-picture mascot; without a configured image the mascot is a pet.
+pytestmark = pytest.mark.usefixtures("still_picture_mascot")
+
class _FakeBus:
def subscribe(self, *_a, **_k) -> None:
diff --git a/tests/unit/ui/test_orb_no_legacy_renderer.py b/tests/unit/ui/test_orb_no_legacy_renderer.py
index f9708dab77..46b20fc8eb 100644
--- a/tests/unit/ui/test_orb_no_legacy_renderer.py
+++ b/tests/unit/ui/test_orb_no_legacy_renderer.py
@@ -7,6 +7,9 @@ import ui.orb.overlay as overlay_mod
from dodaios.core.config import UIConfig
from ui.orb.overlay import OrbOverlay
+# The still-picture mascot; without a configured image the mascot is a pet.
+pytestmark = pytest.mark.usefixtures("still_picture_mascot")
+
def test_ui_config_default_is_jarvis_bar_not_legacy_orb() -> None:
# Default flipped to the slim jarvis bar; the legacy procedural "orb" is
@@ -48,6 +51,8 @@ def test_missing_mascot_asset_does_not_fallback_to_legacy_orb(
tmp_path,
) -> None:
monkeypatch.delenv("JARVIS_ORB_STYLE", raising=False)
+ # The image passed below selects the still picture; no other one may be found.
+ monkeypatch.delenv("JARVIS_ORB_MASCOT_PATH", raising=False)
monkeypatch.setattr(
overlay_mod,
"DEFAULT_MASCOT_REL",
diff --git a/tests/unit/ui/test_orb_show_window_gesture.py b/tests/unit/ui/test_orb_show_window_gesture.py
index 2d31a7d7ed..870f39bb3e 100644
--- a/tests/unit/ui/test_orb_show_window_gesture.py
+++ b/tests/unit/ui/test_orb_show_window_gesture.py
@@ -13,6 +13,9 @@ from pathlib import Path
import pytest
+# The still-picture mascot; without a configured image the mascot is a pet.
+pytestmark = pytest.mark.usefixtures("still_picture_mascot")
+
_REPO_ROOT = Path(__file__).resolve().parents[3]
if str(_REPO_ROOT) in sys.path:
sys.path.remove(str(_REPO_ROOT))
diff --git a/tests/unit/ui/test_orb_style_dispatch.py b/tests/unit/ui/test_orb_style_dispatch.py
index fa0b7bcf69..83275def07 100644
--- a/tests/unit/ui/test_orb_style_dispatch.py
+++ b/tests/unit/ui/test_orb_style_dispatch.py
@@ -18,6 +18,9 @@ from dodaios.ui.overlay_styles import ORB_STYLES
from ui.orb.overlay import MascotRenderer, OrbOverlay, _apply_color_key, _coerce_style
from ui.orb.voice_orb import VoiceOrbRenderer
+# The still-picture mascot; without a configured image the mascot is a pet.
+pytestmark = pytest.mark.usefixtures("still_picture_mascot")
+
@pytest.fixture(autouse=True)
def _no_env_style(monkeypatch: pytest.MonkeyPatch) -> None:
diff --git a/tests/unit/ui/test_orb_style_surface_parity.py b/tests/unit/ui/test_orb_style_surface_parity.py
index a0f2a89392..886ed5fb28 100644
--- a/tests/unit/ui/test_orb_style_surface_parity.py
+++ b/tests/unit/ui/test_orb_style_surface_parity.py
@@ -16,6 +16,9 @@ import pytest
from ui.orb import overlay
+# The still-picture mascot; without a configured image the mascot is a pet.
+pytestmark = pytest.mark.usefixtures("still_picture_mascot")
+
# --- no bubble at all on the sphere -----------------------------------------
diff --git a/tests/unit/ui/test_orb_visibility_contract.py b/tests/unit/ui/test_orb_visibility_contract.py
index fa9524897e..f14191afce 100644
--- a/tests/unit/ui/test_orb_visibility_contract.py
+++ b/tests/unit/ui/test_orb_visibility_contract.py
@@ -45,6 +45,9 @@ from ui.orb.drag_persistence import (
resolve_placement,
)
+# The still-picture mascot; without a configured image the mascot is a pet.
+pytestmark = pytest.mark.usefixtures("still_picture_mascot")
+
# ---------------------------------------------------------------------------
# Helpers
diff --git a/tests/unit/ui/test_overlay_style_parity.py b/tests/unit/ui/test_overlay_style_parity.py
index 51c0ecb00f..b21ad505c6 100644
--- a/tests/unit/ui/test_overlay_style_parity.py
+++ b/tests/unit/ui/test_overlay_style_parity.py
@@ -24,6 +24,7 @@ import pytest
from dodaios.ui.overlay_styles import (
LEGACY_STYLE_ALIASES,
+ MASCOT_PET_ID,
ORB_STYLES,
OVERLAY_STYLES,
normalize_overlay_style,
@@ -53,6 +54,14 @@ def test_typescript_union_matches_python() -> None:
assert union == list(OVERLAY_STYLES)
+def test_typescript_mascot_pet_matches_python() -> None:
+ """The desktop and the Jarvis Verse must show the same pet as the mascot."""
+ source = _ts("hooks/useOverlayStyle.ts")
+ match = re.search(r'export const MASCOT_PET_ID = "([a-z0-9-]+)";', source)
+ assert match, "MASCOT_PET_ID not found in the overlay style hook"
+ assert match.group(1) == MASCOT_PET_ID
+
+
def test_typescript_fallback_array_matches_python() -> None:
source = _ts("hooks/useOverlayStyle.ts")
match = re.search(r"OVERLAY_STYLES: OverlayStyle\[\] = \[([^\]]+)\]", source)
diff --git a/tests/unit/ui/test_pet_overlay_surface.py b/tests/unit/ui/test_pet_overlay_surface.py
index 276c92e530..c4f7df03e8 100644
--- a/tests/unit/ui/test_pet_overlay_surface.py
+++ b/tests/unit/ui/test_pet_overlay_surface.py
@@ -18,6 +18,8 @@ from dodaios.core import runtime_refs
from dodaios.ui.desktop_app import DesktopApp
from dodaios.ui.dodaiosbar.null_overlay import NullOverlay
from dodaios.ui.dodaiosbar.subprocess_overlay import SubprocessMascotOverlay
+from dodaios.ui.overlay_styles import MASCOT_PET_ID
+from dodaios.ui.pets.loader import builtin_root, load_pet
from ui.orb import controls
from ui.orb.overlay import OrbOverlay
from ui.orb.pet_renderer import PetRenderer
@@ -37,22 +39,47 @@ def test_wake_wave_reaches_the_pet_renderer(monkeypatch: pytest.MonkeyPatch) ->
assert calls == ["frame"]
-def test_only_the_pet_stays_visible_while_idle_and_wants_status_lines() -> None:
- pet = OrbOverlay(style="pet")
- assert pet.keeps_visible_when_idle is True
- assert pet.wants_status_lines is True
- for style in ("mascot", "voice_orb"):
- other = OrbOverlay(style=style)
- assert other.keeps_visible_when_idle is False
- assert other.wants_status_lines is False
+def test_only_a_pet_stays_visible_while_idle_and_wants_status_lines() -> None:
+ for style in ("pet", "mascot"): # the mascot is a pet
+ pet = OrbOverlay(style=style)
+ assert pet.keeps_visible_when_idle is True
+ assert pet.wants_status_lines is True
+ orb = OrbOverlay(style="voice_orb")
+ assert orb.keeps_visible_when_idle is False
+ assert orb.wants_status_lines is False
+
+
+def test_the_mascot_shows_its_own_pet_whatever_pet_is_chosen() -> None:
+ mascot = OrbOverlay(style="mascot", pet_id="miso")
+ assert mascot._figure_id() == MASCOT_PET_ID
+ mascot.set_pet("ember") # a pick under My Pets while the mascot is up
+ assert mascot._figure_id() == MASCOT_PET_ID
+ mascot.set_style("pet") # before start(): remembered for the boot
+ assert mascot._figure_id() == "ember"
+ mascot.set_style("mascot")
+ assert mascot._figure_id() == MASCOT_PET_ID
+
+
+def test_the_mascot_pet_ships() -> None:
+ """A missing pack would quietly show the default pet instead."""
+ assert load_pet(builtin_root() / MASCOT_PET_ID, builtin=True).manifest.id == MASCOT_PET_ID
+
+
+def test_a_configured_mascot_image_keeps_the_still_picture(tmp_path) -> None:
+ picture = OrbOverlay(style="mascot", mascot_path=str(tmp_path / "mine.png"))
+ assert picture._style == "mascot"
+ assert picture.keeps_visible_when_idle is False
+ assert picture.wants_status_lines is False
def test_the_idle_regime_follows_a_style_change() -> None:
- surface = OrbOverlay(style="mascot")
+ surface = OrbOverlay(style="voice_orb")
surface.set_style("pet") # before start(): remembered for the boot
assert surface.keeps_visible_when_idle is True
surface.set_style("voice_orb")
assert surface.keeps_visible_when_idle is False
+ surface.set_style("mascot")
+ assert surface.keeps_visible_when_idle is True
def test_the_user_hidden_flag_is_set_synchronously() -> None:
@@ -88,9 +115,15 @@ def test_the_macos_proxy_reports_the_same_pet_attributes() -> None:
assert proxy.keeps_visible_when_idle is True
assert proxy.wants_status_lines is True
assert proxy.pet_user_hidden is False
- mascot = SubprocessMascotOverlay(style="mascot")
- assert mascot.keeps_visible_when_idle is False
- assert mascot.wants_status_lines is False
+ mascot = SubprocessMascotOverlay(style="mascot") # the mascot is a pet
+ assert mascot.keeps_visible_when_idle is True
+ assert mascot.wants_status_lines is True
+ for other in (
+ SubprocessMascotOverlay(style="voice_orb"),
+ SubprocessMascotOverlay(style="mascot", mascot_path="mine.png"),
+ ):
+ assert other.keeps_visible_when_idle is False
+ assert other.wants_status_lines is False
def test_the_macos_proxy_forwards_the_hidden_flag() -> None:
@@ -229,25 +262,29 @@ def test_pet_visible_reports_the_runtime_hide() -> None:
def test_the_idle_regime_per_style() -> None:
app = _app()
assert app._hide_on_idle_for("pet") is False
- assert app._hide_on_idle_for("mascot") is True
+ assert app._hide_on_idle_for("mascot") is False # the mascot is a pet
assert app._hide_on_idle_for("voice_orb") is True
+ app.cfg.ui.orb_mascot_path = "mine.png" # a still picture pops up per session
+ assert app._hide_on_idle_for("mascot") is True
+ app.cfg.ui.orb_mascot_path = ""
assert app._hide_on_idle_for("jarvis_bar") is False # bar_persistent=True
app.cfg.ui.bar_persistent = False
assert app._hide_on_idle_for("jarvis_bar") is True
-def test_a_live_swap_to_the_pet_keeps_it_up_and_back_lets_the_mascot_hide() -> None:
+def test_a_live_swap_to_a_pet_keeps_it_up_and_back_lets_the_voice_orb_hide() -> None:
surface, bridge = _PetSurface(), _Bridge()
- app = _app(orb=surface, bridge=bridge, orb_style="mascot")
- app._surfaces = {"mascot": surface}
- result = app.swap_overlay("pet")
- assert result == {"ok": True, "applied_live": True, "style": "pet"}
- assert bridge._hide_on_idle is False
- assert ("show", "idle") in surface.calls
- surface.calls.clear()
- app.swap_overlay("mascot")
+ app = _app(orb=surface, bridge=bridge, orb_style="voice_orb")
+ app._surfaces = {"voice_orb": surface}
+ for style in ("pet", "mascot"): # the mascot is a pet
+ result = app.swap_overlay(style)
+ assert result == {"ok": True, "applied_live": True, "style": style}
+ assert bridge._hide_on_idle is False
+ assert ("show", "idle") in surface.calls
+ surface.calls.clear()
+ app.swap_overlay("voice_orb")
assert bridge._hide_on_idle is True
- assert ("hide",) in surface.calls # an idle pet does not linger as a mascot
+ assert ("hide",) in surface.calls # an idle pet does not linger as a voice orb
def test_the_pet_shortcut_is_read_stripped_and_empty_when_unset() -> None:
diff --git a/ui/orb/overlay.py b/ui/orb/overlay.py
index e93f7e02be..73cd3a1eae 100644
--- a/ui/orb/overlay.py
+++ b/ui/orb/overlay.py
@@ -21,7 +21,7 @@ Rendering pipeline:
into a PhotoImage that Tkinter renders onto a Canvas.
Public API:
- overlay = OrbOverlay(style="mascot") # SWG/Gigi PNG
+ overlay = OrbOverlay(style="mascot") # the mascot pet (or a custom PNG)
overlay = OrbOverlay(style="voice_orb") # procedural weather sphere
overlay.start() # blocks until mainloop exit
overlay.show(mode="listen") # voice modes: idle/listen/speak/think
@@ -68,7 +68,7 @@ from PIL import Image, ImageDraw, ImageFilter, ImageTk
from dodaios.core.config import DEFAULT_CONFIG_FILE as JARVIS_TOML_PATH
from dodaios.core.win32_dpi import ensure_dpi_awareness as _ensure_dpi_awareness
from dodaios.ui.dodaiosbar.modes import ACTIVE_VOICE_MODES, MODES
-from dodaios.ui.overlay_styles import LEGACY_STYLE_ALIASES, ORB_STYLES, PERSISTENT_ORB_STYLES
+from dodaios.ui.overlay_styles import LEGACY_STYLE_ALIASES, MASCOT_PET_ID, ORB_STYLES
from dodaios.ui.pets.states import ACTION_STATES, DEFAULT_PET_ID, NO_PET_ID, ONE_SHOT_STATES
from ui.orb import controls as orb_controls
from ui.orb.animations import (
@@ -2372,8 +2372,11 @@ class OrbOverlay:
# do not crash, but never render the removed legacy orb.
env_style = (os.environ.get("JARVIS_ORB_STYLE") or "").strip().lower()
requested_style = env_style or (style or DEFAULT_ORB_STYLE).lower()
- self._style = _coerce_style(requested_style)
self._mascot_path_hint = str(mascot_path) if mascot_path else None
+ #: The look is the pet's, showing the mascot figure instead of the
+ #: pet chosen under My Pets (see ``_adopt_style``).
+ self._mascot_figure = False
+ self._style = self._adopt_style(_coerce_style(requested_style))
# Window size belongs to the style, not to the module: the voice orb is
# half again as large as the mascot (see VOICE_ORB_WIN_W).
self._win_w, self._win_h = window_size_for_style(self._style)
@@ -3019,7 +3022,7 @@ class OrbOverlay:
pointer is on the figure or the strip, or the pet is "None" (the strip
is all there is, so hiding it would leave nothing to hover).
"""
- if self._pet_strip_always or self._pet_id == NO_PET_ID:
+ if self._pet_strip_always or self._figure_id() == NO_PET_ID:
return True
if self._mode in ACTIVE_VOICE_MODES + PET_VOICE_MODES + PET_THINK_MODES:
return True
@@ -3810,11 +3813,11 @@ class OrbOverlay:
def keeps_visible_when_idle(self) -> bool:
"""True while the look is the pet: the bridge shows ``idle`` instead of hiding.
- Read on every idle edge, so a live swap between the pet and the
- mascot / voice orb changes the idle regime at once. ``hide()`` itself
- stays a real withdraw for every look.
+ Read on every idle edge, so a live swap between the pet (or the
+ mascot, which is a pet) and the voice orb changes the idle regime at
+ once. ``hide()`` itself stays a real withdraw for every look.
"""
- return self._style in PERSISTENT_ORB_STYLES
+ return self._style == "pet"
@property
def pet_user_hidden(self) -> bool:
@@ -3960,11 +3963,15 @@ class OrbOverlay:
return self._thought
def set_pet(self, pet_id: str) -> None:
- """Swap the figure live; ``"none"`` keeps the strip without a figure. Thread-safe."""
+ """Swap the figure live; ``"none"`` keeps the strip without a figure. Thread-safe.
+
+ The choice is kept while the mascot is the style and shows again once
+ the style is the pet.
+ """
pet = str(pet_id or "").strip() or NO_PET_ID
self._pet_id = pet
self._note_activity()
- self._enqueue_ui(lambda: self._apply_pet(pet))
+ self._enqueue_ui(self._apply_pet)
def set_pet_look(
self,
@@ -4104,11 +4111,28 @@ class OrbOverlay:
if renderer.state() != before:
self._kick_frame()
- def _apply_pet(self, pet_id: str) -> None:
+ def _figure_id(self) -> str:
+ """The pet on screen: the mascot's own, or the one chosen under My Pets."""
+ return MASCOT_PET_ID if self._mascot_figure else self._pet_id
+
+ def _custom_mascot_image(self) -> bool:
+ """True when a mascot image was configured: that picture is shown as it is."""
+ return bool(self._mascot_path_hint or os.environ.get("JARVIS_ORB_MASCOT_PATH"))
+
+ def _adopt_style(self, style: str) -> str:
+ """Record what ``style`` shows and return the look that draws it.
+
+ The mascot is the built-in ``MASCOT_PET_ID`` pet, so it is drawn by the
+ pet look. Only a configured mascot image keeps the still picture.
+ """
+ self._mascot_figure = style == "mascot" and not self._custom_mascot_image()
+ return "pet" if self._mascot_figure else style
+
+ def _apply_pet(self) -> None:
renderer = self._renderer
if self._style != "pet" or not isinstance(renderer, PetRenderer):
return
- renderer.load(pet_id)
+ renderer.load(self._figure_id())
self._refit_pet_window()
# "None" keeps its strip up; a figure lets it rest hidden again.
self._sync_controls_visibility()
@@ -4361,15 +4385,18 @@ class OrbOverlay:
style = _coerce_style(style)
if self._root is None:
# Not started yet → remember the style, start() picks it up
- self._style = style
+ self._style = self._adopt_style(style)
return
self._enqueue_ui(lambda: self._apply_style(style))
def _apply_style(self, style: str) -> None:
+ was_mascot_figure = self._mascot_figure
+ style = self._adopt_style(style)
if style == "pet":
# The pet is the other way round: its size comes FROM its renderer.
new_renderer = self._build_renderer(style)
if new_renderer is None:
+ self._mascot_figure = was_mascot_figure
return # already logged in _build_renderer
new_size = window_size_for_style(style, new_renderer)
else:
@@ -4382,6 +4409,7 @@ class OrbOverlay:
if new_renderer is None:
# Undo the resize — the old renderer is still the one painting.
self._win_w, self._win_h = old_size
+ self._mascot_figure = was_mascot_figure
return # The fallback case was already logged in _build_renderer
self._renderer = new_renderer
self._style = style
@@ -4427,7 +4455,7 @@ class OrbOverlay:
if style == "pet":
try:
renderer = PetRenderer(
- self._pet_id,
+ self._figure_id(),
pet_scale=self._pet_scale,
dpi_ratio=self._dpi_ratio,
color_key=(int(COLOR_KEY_RGB[0]), int(COLOR_KEY_RGB[1]), int(COLOR_KEY_RGB[2])),