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(pets): three blue-white indicator strokes replace the talk orb
rubenluetke10-beepaea94ac021ff
diff --git a/docs/pets.md b/docs/pets.mdindex e1b9611c27..5eb6927cf3 100644--- a/docs/pets.md+++ b/docs/pets.md@@ -22,8 +22,11 @@ one click.- pen: raise the main window and open a new chat (`ComposeRequested`);- microphone: mute Jarvis's microphone (`VoiceMuteToggleRequested`, mirroredfrom `VoiceMuteChanged`);- - orb: start a conversation, or hang up the running one; it pulses with the- live audio level;+ - talk indicator (three blue-white strokes, the Jarvis bar's equalizer cut+ down to three): start a conversation, or hang up the running one. The+ strokes stand still and dimmed at rest, follow the live audio level while+ listening, dictating or talking, and carry a travelling highlight while+ thinking or transcribing;- speaker: silence the assistant's voice for this session (TTS volume 0,mirrored from `VoiceSpeakerMuteChanged`).- **The thinking card** under the strip: a rounded pill with a bold title@@ -259,6 +262,6 @@ The pet must cost next to nothing while idle:- the window repaints only when the frame key changes (frame index, plus thelevel bucket while talking), and the timer sleeps until the next frameboundary: 6 fps idle, 3 fps asleep, 8–10 fps active, nothing while hidden;-- the control strip's orb animates only while listening or talking.+- the control strip's indicator animates only while listening, talking or thinking.Target: an idle pet adds less than 1 % of one CPU core to the app process.diff --git a/tests/unit/ui/test_orb_controls_pet.py b/tests/unit/ui/test_orb_controls_pet.pyindex b8bf0bbbfa..c350696387 100644--- a/tests/unit/ui/test_orb_controls_pet.py+++ b/tests/unit/ui/test_orb_controls_pet.py@@ -137,19 +137,57 @@ def test_a_muted_speaker_carries_a_red_slash() -> None:assert _red_pixels(_frame(controls.PetStripState(speaker_muted=True)), box) > 5-def test_the_orb_is_bluish_and_swells_only_while_engaged() -> None:+def test_the_indicator_rests_still_and_grows_with_the_voice() -> None:box = _slot_box("orb")- def _blue(frame: Image.Image) -> int:- return sum(1 for (r, g, b) in frame.crop(box).getdata() if b > 180 and r < 150)+ def _lit(frame: Image.Image) -> int:+ return sum(1 for (r, g, b) in frame.crop(box).getdata() if b > 150 and b > r)- rest = _blue(_frame(controls.PetStripState(level=6))) # level ignored at rest+ rest = _lit(_frame(controls.PetStripState(level=6, phase=3))) # ignored at restassert rest > 20- assert rest == _blue(_frame(controls.PetStripState(level=0)))- loud = _blue(_frame(controls.PetStripState(active=True, level=6)))+ assert rest == _lit(_frame(controls.PetStripState()))+ quiet = _lit(_frame(controls.PetStripState(active=True, motion="voice", level=0)))+ loud = _lit(_frame(controls.PetStripState(active=True, motion="voice", level=6)))+ assert loud > quietassert loud > rest+def test_voice_strokes_wobble_but_stay_in_bounds() -> None:+ heights = {+ tuple(+ round(h, 3)+ for h, _ in controls.indicator_bars(+ controls.PetStripState(motion="voice", level=6, phase=p)+ )+ )+ for p in range(controls.PET_VOICE_PHASES)+ }+ assert len(heights) > 1 # the strokes move+ for row in heights:+ assert len(row) == 3+ assert all(controls.PET_INDICATOR_MIN_H <= h <= controls.PET_INDICATOR_MAX_H for h in row)+++def test_thinking_moves_a_highlight_across_the_strokes() -> None:+ brightest = []+ for p in range(controls.PET_THINK_PHASES):+ bars = controls.indicator_bars(controls.PetStripState(motion="think", phase=p))+ glows = [g for _h, g in bars]+ brightest.append(glows.index(max(glows)))+ # The lit stroke visits all three, left to right, then starts over.+ assert set(brightest) == {0, 1, 2}+ firsts = [brightest.index(i) for i in range(3)]+ assert firsts == sorted(firsts)+++def test_indicator_phase_follows_the_clock() -> None:+ assert controls.indicator_phase("rest", 12.3) == 0+ assert controls.indicator_phase("voice", 0.0) == 0+ assert controls.indicator_phase("voice", controls.PET_VOICE_STEP_S * 3 + 0.01) == 3+ half = controls.PET_THINK_PERIOD_S / 2+ assert controls.indicator_phase("think", half) == controls.PET_THINK_PHASES // 2++def test_a_resting_strip_is_one_cached_frame() -> None:state = controls.PetStripState(mic_muted=True)assert _frame(state) is _frame(controls.PetStripState(mic_muted=True))@@ -261,17 +299,16 @@ def test_the_pen_and_the_pill_are_filled_without_a_ring() -> None:assert frame.getpixel(((x0 + x1) // 2, y0 + 1)) == controls.PET_FILL-def test_the_orb_fills_most_of_the_pill_height() -> None:+def test_the_talk_control_is_three_strokes() -> None:frame = controls.render_pet_strip(controls.PetStripState(), 2.0)layout = controls.pet_strip_layout(2.0)action, sx0, sx1 = layout.slots[1]assert action == "orb"- x0, y0, x1, y1 = layout.pill- cx = (sx0 + sx1) // 2- column = [frame.getpixel((cx, y)) for y in range(y0, y1)]- blue = [px for px in column if px[2] > 150 and px[2] > px[0] + 40]- share = len(blue) / (y1 - y0)- assert 0.7 <= share <= 0.9+ _x0, y0, _x1, y1 = layout.pill+ row = [frame.getpixel((x, (y0 + y1) // 2)) for x in range(sx0, sx1)]+ lit = [sum(px) > 3 * 60 for px in row]+ runs = sum(1 for i, on in enumerate(lit) if on and (i == 0 or not lit[i - 1]))+ assert runs == controls.PET_INDICATOR_BARS == 3def test_the_strip_is_about_a_third_of_the_figure_tall() -> None:diff --git a/ui/orb/controls.py b/ui/orb/controls.pyindex f6849a94f7..eb0534543f 100644--- a/ui/orb/controls.py+++ b/ui/orb/controls.py@@ -395,13 +395,41 @@ PET_STRIP_GAP_FROM_FIGURE = 10#: 2 px stroke at 100 %).PET_ICON_BOX = 0.42PET_ICON_STROKE = 2.0-#: How many steps the orb's pulse is quantised into. A handful is enough to-#: read as "breathing with the voice" and bounds how often the strip repaints.+#: How many steps the indicator's voice level is quantised into. A handful is+#: enough to read as "moving with the voice" and bounds the cached frames.PET_LEVEL_STEPS = 6-#: The orb's diameter as a share of the pill's height: at rest, and the extra-#: it swells by at full level while listening or talking.-PET_ORB_REST_SHARE = 0.74-PET_ORB_PULSE_SHARE = 0.08++#: The talk control is three upright strokes — the Jarvis bar's equalizer+#: vocabulary, cut down to three. Geometry as shares of the pill's height:+#: stroke centre spacing, stroke half-width, and the shortest / tallest stroke.+PET_INDICATOR_BARS = 3+PET_INDICATOR_SPACING = 0.21+PET_INDICATOR_HALF_W = 0.052+PET_INDICATOR_MIN_H = 0.18+PET_INDICATOR_MAX_H = 0.64+#: At rest the strokes stand still and dimmed; the middle one a little taller,+#: so the three read as one control and not as three loose dots.+PET_INDICATOR_REST_H: tuple[float, ...] = (0.22, 0.32, 0.22)+PET_INDICATOR_REST_GLOW = 0.55+#: Animation steps per cycle. Voice: the strokes wobble around the level in+#: ``PET_VOICE_PHASES`` steps of ``PET_VOICE_STEP_S``. Thinking: a highlight+#: travels across the three in ``PET_THINK_PHASES`` steps per pass of+#: ``PET_THINK_PERIOD_S`` (the Jarvis bar's sweep period).+PET_VOICE_PHASES = 8+PET_VOICE_STEP_S = 0.1+PET_THINK_PHASES = 12+PET_THINK_PERIOD_S = 1.05+#: Sweep shape: gaussian width (row fractions), the unlit and the lit level.+PET_THINK_WIDTH = 0.2+PET_THINK_BASE_V = 0.21+PET_THINK_PEAK_V = 0.93+PET_THINK_DIM = 0.32++#: What the indicator is showing. ``rest``: nothing running. ``voice``: the+#: microphone or Jarvis's voice is live and the strokes follow its level.+#: ``think``: work is in flight with no signal to measure, so a highlight+#: travels — motion, never a fake level.+PET_MOTIONS: tuple[str, ...] = ("rest", "voice", "think")#: Fill of the pen disc and the pill: a blue-black only a breath away from a#: dark desktop, so the controls read as glyphs floating in a faint shadow@@ -413,11 +441,10 @@ PET_ICON = (232, 233, 238)PET_ICON_MUTED = (248, 113, 113)#: The divider between pill slots — barely above the fill, never a hard line.PET_DIVIDER = (24, 28, 37)-#: The talk orb: a matte sphere, deep blue at the top that brightens toward a-#: soft pale glow at the bottom — no gloss, no specular dot.-PET_ORB_TOP = (40, 88, 226)-PET_ORB_MID = (66, 114, 236)-PET_ORB_GLOW = (178, 204, 252)+#: The indicator strokes: near-white at the top fading into a clear blue at+#: the bottom, like the Jarvis bar's blue-white equalizer.+PET_INDICATOR_TOP = (236, 243, 255)+PET_INDICATOR_BOTTOM = (88, 140, 250)def _spx(value: float, scale: float) -> int:@@ -546,10 +573,14 @@ class PetStripState:mic_muted: bool = False#: The assistant's voice is muted for this session.speaker_muted: bool = False- #: A conversation is running — the orb hangs up instead of starting one.+ #: A conversation is running — the talk control hangs up instead of+ #: starting one.active: bool = False- #: The orb's pulse step (``quantize_level``); only drawn while ``active``.+ #: The voice level step (``quantize_level``); drawn only in ``voice``.level: int = 0+ #: What the indicator shows (``PET_MOTIONS``) and its animation step.+ motion: str = "rest"+ phase: int = 0#: Which control the pointer is over, if any.hovered: str | None = None@@ -662,52 +693,83 @@ def _lerp(a: _Rgb, b: _Rgb, t: float) -> _Rgb:)-def _draw_orb(- d: ImageDraw.ImageDraw,- cx: float,- cy: float,- radius: float,+def indicator_phase(motion: str, t: float) -> int:+ """The animation step for ``motion`` at clock time ``t`` (0 at rest)."""+ if motion == "voice":+ return int(t / PET_VOICE_STEP_S) % PET_VOICE_PHASES+ if motion == "think":+ cycle = (t % PET_THINK_PERIOD_S) / PET_THINK_PERIOD_S+ return int(cycle * PET_THINK_PHASES) % PET_THINK_PHASES+ return 0+++def _sweep_gain(index: int, phase: int) -> float:+ """Brightness of stroke ``index`` under the thinking highlight.++ Positions sit on a ring (``index / bars``), so the highlight leaves on+ the right and comes back on the left without a jump.+ """+ pos = index / PET_INDICATOR_BARS+ head = (phase % PET_THINK_PHASES) / PET_THINK_PHASES+ d = abs(pos - head)+ d = min(d, 1.0 - d)+ return math.exp(-(d * d) / (2.0 * PET_THINK_WIDTH * PET_THINK_WIDTH))+++def indicator_bars(state: PetStripState) -> list[tuple[float, float]]:+ """Each stroke as ``(height share of the pill, glow 0..1)``, left to right.++ Pure in the state, so every look is testable and cacheable.+ """+ lo, hi = PET_INDICATOR_MIN_H, PET_INDICATOR_MAX_H+ if state.motion == "voice":+ level = max(0.0, min(1.0, state.level / PET_LEVEL_STEPS))+ angle = 2.0 * math.pi * (state.phase % PET_VOICE_PHASES) / PET_VOICE_PHASES+ out = []+ for i in range(PET_INDICATOR_BARS):+ wobble = 0.55 + 0.45 * (0.5 + 0.5 * math.sin(angle + i * 2.1))+ out.append((lo + (hi - lo) * level * wobble, 0.62 + 0.38 * level))+ return out+ if state.motion == "think":+ out = []+ for i in range(PET_INDICATOR_BARS):+ g = _sweep_gain(i, state.phase)+ v = PET_THINK_BASE_V + (PET_THINK_PEAK_V - PET_THINK_BASE_V) * g+ out.append((lo + (hi - lo) * v, PET_THINK_DIM + (1.0 - PET_THINK_DIM) * g))+ return out+ return [(h, PET_INDICATOR_REST_GLOW) for h in PET_INDICATOR_REST_H]+++def _draw_indicator(+ d: ImageDraw.ImageDraw, cx: float, cy: float, pill_h: float, state: PetStripState) -> None:- """A matte sphere: a top-to-bottom gradient with a soft glow at the base.+ """Three rounded strokes with a white-to-blue gradient, dimmed by glow.- Each row of the disc gets one colour — deep blue at the top, brighter- blue through the middle — and the lowest fifth blends toward a pale glow- that is strongest at the bottom centre. PIL only — no numpy on this- import path.+ Drawn row by row so the gradient follows each stroke's own height; the+ frame is RGB (the colour key needs it), so "dim" is a mix toward the+ pill's fill — what an opacity would look like over it anyway."""- top, bottom = int(cy - radius), int(cy + radius) + 1- for y in range(top, bottom):- dy = (y + 0.5) - cy- if abs(dy) > radius:- continue- half = math.sqrt(radius * radius - dy * dy)- t = (dy + radius) / (2.0 * radius) # 0 at the top, 1 at the bottom- color = _lerp(PET_ORB_TOP, PET_ORB_MID, t / 0.6) if t < 0.6 else PET_ORB_MID- if t > 0.64:- # The glow fades in toward the base and toward the centre line,- # so the bottom reads as lit from below, not as a flat band.- rise = (t - 0.64) / 0.36- for x0, x1, share in _glow_segments(cx, half, rise):- d.line([(x0, y), (x1, y)], fill=_lerp(color, PET_ORB_GLOW, share))- continue- d.line([(cx - half, y), (cx + half, y)], fill=color)---def _glow_segments(cx: float, half: float, rise: float) -> list[tuple[float, float, float]]:- """Split one orb row into bands whose glow share falls off from the centre."""- bands = 6- out: list[tuple[float, float, float]] = []- for k in range(bands, 0, -1):- w = half * k / bands- centre = 1.0 - (k - 1) / bands # 1 for the innermost band- out.append((cx - w, cx + w, rise * rise * (0.25 + 0.6 * centre)))- return out---def _orb_radius(state: PetStripState, pill_height: float) -> float:- pulse = (state.level / PET_LEVEL_STEPS) if state.active else 0.0- share = PET_ORB_REST_SHARE + PET_ORB_PULSE_SHARE * max(0.0, min(1.0, pulse))- return pill_height * share / 2.0+ half_w = pill_h * PET_INDICATOR_HALF_W+ step = pill_h * PET_INDICATOR_SPACING+ first = cx - step * (PET_INDICATOR_BARS - 1) / 2.0+ for i, (share, glow) in enumerate(indicator_bars(state)):+ x = first + i * step+ h = max(2.0 * half_w, pill_h * share)+ top, bottom = cy - h / 2.0, cy + h / 2.0+ for y in range(int(top), int(bottom) + 1):+ yc = y + 0.5+ if yc < top or yc > bottom:+ continue+ # Round caps: a circle of radius half_w at each end.+ edge = min(yc - top, bottom - yc)+ if edge < half_w:+ dy = half_w - edge+ span = math.sqrt(max(0.0, half_w * half_w - dy * dy))+ else:+ span = half_w+ t = (yc - top) / h+ color = _lerp(PET_INDICATOR_TOP, PET_INDICATOR_BOTTOM, t)+ d.line([(x - span, y), (x + span, y)], fill=_lerp(PET_FILL, color, glow))def _render_pen_disc(state: PetStripState, diameter: int, scale: float) -> Image.Image:@@ -744,7 +806,7 @@ def _render_pill(state: PetStripState, layout: PetStripLayout, scale: float) ->for action, sx0, sx1 in layout.slots:cx = ((sx0 + sx1) / 2.0 - x0) * _SSif action == "orb":- _draw_orb(d, cx, cy, _orb_radius(state, h_ss))+ _draw_indicator(d, cx, cy, h_ss, state)else:_draw_glyph(action, d, cx, cy, box, stroke, state)return layer.resize((width, height), Image.Resampling.LANCZOS)@@ -759,7 +821,7 @@ def _binary_stadium_mask(width: int, height: int) -> Image.Image:return mask[email protected]_cache(maxsize=96)[email protected]_cache(maxsize=256)def render_pet_strip(state: PetStripState,scale: float = 1.0,diff --git a/ui/orb/overlay.py b/ui/orb/overlay.pyindex c61d6dbcac..a7dfbf46e0 100644--- a/ui/orb/overlay.py+++ b/ui/orb/overlay.py@@ -2468,6 +2468,8 @@ class PetControlStrip(OrbControlRow):can_attach: bool | None = None,mic_muted: bool | None = None,level: int | None = None,+ motion: str | None = None,+ phase: int | None = None,) -> None:"""Update what the strip says, repainting only on a real change."""_ = can_attach # the pet strip has no attach control@@ -2477,6 +2479,8 @@ class PetControlStrip(OrbControlRow):speaker_muted=current.speaker_muted if speaker_muted is None else bool(speaker_muted),active=current.active if active is None else bool(active),level=current.level if level is None else int(level),+ motion=current.motion if motion is None else str(motion),+ phase=current.phase if phase is None else int(phase),hovered=current.hovered,)if state == current:@@ -2535,11 +2539,17 @@ PET_PHOTO_CACHE_MAX = 64#: The mascot and voice orb repaint on a fixed ~60 fps timer.FRAME_INTERVAL_MS = 16-#: While the strip's orb pulses (listening / talking) the pet ticks at least-#: this often, so the pulse follows the voice even when the figure is slow.+#: While the strip's indicator moves (listening, talking, thinking) the pet+#: ticks at least this often, so the strokes follow the voice even when the+#: figure is slow.PET_PULSE_INTERVAL_MS = 100-#: A level older than this no longer moves the strip's orb (the voice stopped).+#: A level older than this no longer moves the strip's strokes (the voice stopped).PET_LEVEL_FRESH_S = 0.25+#: Overlay modes and what the strip's indicator shows for them. Dictation+#: while the key is held is a live microphone; once it is released and the+#: speech is being transcribed there is no signal left, only work.+PET_VOICE_MODES = ("listen", "speak", "dictate")+PET_THINK_MODES = ("think", "dictate_transcribing")class OrbOverlay:@@ -4578,19 +4588,30 @@ class OrbOverlay:self._canvas.itemconfig(self._image_id, image=photo)def _pump_strip_level(self) -> bool:- """Feed the strip's orb the audio level. True while it is pulsing.+ """Drive the strip's three strokes. True while they move.- Only while listening or talking; at rest the orb is static and the- strip is not repainted at all.+ Listening or talking: the strokes follow the live audio level.+ Thinking: a highlight travels across them. At rest they stand still+ and the strip is not repainted at all."""row = self._controlsif not isinstance(row, PetControlStrip):return False- pulsing = self._mode in ("listen", "speak", "dictate")- fresh = time.monotonic() - self._ext_level_at <= PET_LEVEL_FRESH_S- level = orb_controls.quantize_level(self._ext_level) if pulsing and fresh else 0- row.set_state(level=level)- return pulsing+ now = time.monotonic()+ if self._mode in PET_VOICE_MODES:+ motion = "voice"+ elif self._mode in PET_THINK_MODES:+ motion = "think"+ else:+ motion = "rest"+ fresh = now - self._ext_level_at <= PET_LEVEL_FRESH_S+ level = orb_controls.quantize_level(self._ext_level) if motion == "voice" and fresh else 0+ row.set_state(+ level=level,+ motion=motion,+ phase=orb_controls.indicator_phase(motion, now),+ )+ return motion != "rest"def _arm_frame(self, delay_ms: int) -> None:root = self._root