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(overlay): offer the voice orb as a free-floating desktop display style
rubenluetke10-beep66c405722f1f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 977406066c..4fd637bfec 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,15 @@ versioning per [SemVer](https://semver.org/).## [Unreleased]+### Added++- Added the voice orb as a fourth on-screen display style: the glowing sphere+ from the Agentic IDE now also runs as a free-floating desktop window, so it+ can be dragged onto any monitor instead of living inside the app. Switching+ between the mascot and the voice orb applies immediately, without a restart.+ On a Linux session without per-pixel transparency the orb window stays hidden+ with one actionable log line rather than showing an opaque square.+---## [1.2.2] — 2026-08-04diff --git a/docs/os-parity.md b/docs/os-parity.mdindex 387b6c6a1a..e29809da37 100644--- a/docs/os-parity.md+++ b/docs/os-parity.md@@ -202,6 +202,7 @@ experiences today.| P-18 | Low | Agent accounts | Multi-subscription switching gives each account its own CLI config directory (`CLAUDE_CONFIG_DIR` / `CODEX_HOME`) — the CLIs' own documented override. On macOS, Claude Code keeps its credentials in the **Keychain** rather than in that directory, and whether a second config dir earns a second Keychain entry is UNVERIFIED on this hardware (everything here was measured on Windows) | `jarvis/agent_accounts.py::describe`, `env_overrides` | Windows/Linux: a second Claude seat works as designed (its `.credentials.json` lives in its own folder). macOS: the added account may come back reporting **"Not signed in"** after a completed sign-in — which is the honest outcome, not a crash: the switcher never claims a login it cannot read, so a pane is never silently routed to the first account's credentials. Codex is unaffected on all three OSes (`auth.json` is a plain file). Next Mac session: add a second Claude account, sign in, and check whether `describe()` reports it connected || P-20 | Low | Coding-CLI panes | Kimi Code panes deliberately ship WITHOUT multi-subscription switching, unlike Claude Code and Codex. Three independent reasons, all recorded on the registry entry: the wound-down Python generation ignores `KIMI_CODE_HOME` entirely, so seats created on a machine that has it would all silently resolve to one login; its configuration and its credentials share a single `config.toml`, so no setup can be carried to a new seat without carrying the key with it; and its credential layout is unverified against a live install of the current generation | `jarvis/workspace/agents.py` (the `kimi` entry), `jarvis/agent_accounts.py::platforms` | All OSes: one Kimi login, and the account switcher honestly does not offer the CLI at all rather than showing a switch that does nothing. Unblocked by verifying the current generation's credential layout and gating the override on the generation probe |+| P-22 | Low | Orb window | The floating orb window (both looks: the Gigi mascot and the procedural **voice orb**) is a Tk window whose transparency comes from a colour key. Windows keys it out natively; macOS uses Aqua-Tk's `-transparent` in the companion host; on Linux the attribute is accepted only under a **compositing** window manager, and not at all on Wayland | `ui/orb/overlay.py::_apply_color_key`, `_build_renderer`, `jarvis/ui/jarvisbar/host.py::_build_surface` | Windows/macOS: full parity, including drag-to-any-monitor and the live mascot↔voice-orb switch. Linux with a compositor (GNOME/KDE/picom): works. Linux without one, and Wayland: the window would be an opaque magenta square, so it is NOT shown — the surface logs one actionable English line and stays hidden; voice, tray and the app window are unaffected. Note the Jarvis Bar degrades DIFFERENTLY on such a session (it keeps drawing and shows its key colour — pre-existing, `jarvis/ui/jarvisbar/overlay.py:738`), so "None (hidden)" is the honest display style on a non-compositing Linux desktop until the bar adopts the same gate || P-21 | Low | Coding-CLI panes | OpenCode panes ship single-login for the same class of reason: the only variable that moves its credentials and session database is `XDG_DATA_HOME`, which is a SHARED variable rather than a dedicated override — redirecting it per pane would also redirect any other XDG-aware tool the agent spawns inside that pane | `jarvis/workspace/agents.py` (the `opencode` entry) | All OSes: one OpenCode login. Verified on Windows that `XDG_DATA_HOME` does move `auth.json` and the session database; the blast radius on macOS and Linux has not been measured, which is why it is not wired up || P-22 | Low | Coding-CLI panes | Kimi Code uses the bundled Git Bash as its shell environment on Windows, so without Git for Windows installed the binary answers `--version` correctly and the agent then cannot run a single shell command | Kimi vendor docs; `jarvis/workspace/agents.py` (the `kimi` entry) | Windows without Git for Windows: the pane opens, the CLI reports a healthy version, and shell commands fail inside it. macOS/Linux unaffected. `KIMI_SHELL_PATH` points at a non-standard `bash.exe`. An install check that only runs `--version` cannot see this || P-23 | Info | Coding-CLI panes | Kimi Code's alternate screen cannot be disabled (an open upstream request notes it is the outlier versus Claude Code, Codex and the Gemini CLI), so it may conflict with the pane's own scrollback the way a Claude Code pane once did | Upstream issue; `jarvis/agentic_ide/screen.py` | All OSes equally — not an OS gap, recorded here because it is the same class of pane defect and is expected to need the same kind of fix |diff --git a/jarvis.toml.example b/jarvis.toml.exampleindex 3e7825ea7b..dd01029496 100644--- a/jarvis.toml.example+++ b/jarvis.toml.example@@ -148,7 +148,8 @@ tray_enabled = trueadmin_api_port = 47821startup_chime = true# On-screen overlay shown by default on a desktop install: the slim-# "jarvis_bar" (the Jarvis bar). Alternatives: "mascot" (Gigi orb) or "none".+# "jarvis_bar" (the Jarvis bar). Alternatives: "mascot" (the Gigi mascot),+# "voice_orb" (the procedural voice orb) 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/jarvis/core/config.py b/jarvis/core/config.pyindex fbee1c2531..d22cf6f041 100644--- a/jarvis/core/config.py+++ b/jarvis/core/config.py@@ -1551,8 +1551,9 @@ 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" (ghost- # orb), or "none". The mascot remains fully selectable.+ # 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: jarvis.ui.overlay_styles.orb_style: str = "jarvis_bar"# Optional explicit path to the mascot PNG. Empty = search for default asset.orb_mascot_path: str = ""@@ -2403,16 +2404,26 @@ class WikiContextConfig(BaseModel):enabled: bool = Truemax_chars: int = 1500- latency_budget_ms: int = 80+ # 150 (was 80): the vault search opens its SQLite connection lazily+ # inside this budget, so the first qualifying turn of a process regularly+ # timed out. The factory warms the connection at boot; the wider budget+ # covers a lost warm-up race and stays inaudible next to the brain call.+ latency_budget_ms: int = 150min_keyword_length: int = 4# Relevance gate (jarvis/brain/wiki_relevance.py). Retrieval always# returns a ranked list, so without a gate every unrelated question gets# a personal note welded onto its answer. ``relevance_gate = false``- # restores the pre-gate behaviour: search every turn, inject every hit.+ # restores the ungated behaviour: search every turn, inject every hit.+ # With the gate on, every turn beyond greeting length is SEARCHED+ # (retrieval-first); the gate grades how strictly the hits are filtered.relevance_gate: bool = True# Share of the question's content terms a hit must cover to be injected.min_coverage: float = 0.5+ # The stricter bar applied when the turn has no personal anchor (world-+ # shaped questions, statements): a page must cover nearly the whole+ # question before it may ride along uninvited.+ strict_min_coverage: float = 0.75# Share of the best hit's score (within the SAME search call) a hit must# reach. Relative by design — the vault's scores are only comparable# within one call, so an absolute cutoff would be noise.diff --git a/jarvis/core/config_writer.py b/jarvis/core/config_writer.pyindex 7808adcde2..df3a5e9174 100644--- a/jarvis/core/config_writer.py+++ b/jarvis/core/config_writer.py@@ -1191,7 +1191,8 @@ def set_ultrawiki_slot(key: str, value: str, *, path: Path = DEFAULT_CONFIG_FILEdef set_overlay_style(style: str, *, path: Path = DEFAULT_CONFIG_FILE) -> None:"""Persist the on-screen overlay style to ``[ui] orb_style`` in jarvis.toml.- ``style`` is one of ``"jarvis_bar"`` / ``"mascot"`` / ``"none"``. TOML-only+ ``style`` is one of ``jarvis.ui.overlay_styles.OVERLAY_STYLES``+ (``"jarvis_bar"`` / ``"mascot"`` / ``"voice_orb"`` / ``"none"``). TOML-onlyby design: ``ui.orb_style`` is NOT in the drift-guard's reference snapshot, so thedrift-guard never reverts it (same rationale as :func:`set_autostart`). TheSettings route applies the change live; this persists the boot default.diff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.pyindex c7fe188316..937679d2e1 100644--- a/jarvis/ui/desktop_app.py+++ b/jarvis/ui/desktop_app.py@@ -2475,16 +2475,18 @@ class DesktopApp:surface = SubprocessMascotOverlay(mascot_path=self.cfg.ui.orb_mascot_path or None,+ style=style,)surface.start_in_thread()logger.info(- "Mascot orb hosted out-of-process on macOS "- "(jarvis.ui.jarvisbar.host)."+ "Orb window hosted out-of-process on macOS "+ "(jarvis.ui.jarvisbar.host, style={}).",+ style,)return surfaceexcept Exception: # noqa: BLE001 — cosmetic; never block bootlogger.opt(exception=True).warning(- "macOS mascot host failed to start — falling back "+ "macOS orb host failed to start — falling back ""to the no-op surface.")from jarvis.ui.jarvisbar import NullOverlay@@ -2508,7 +2510,7 @@ class DesktopApp:self.cfg.ui, "bar_follow_cursor_monitor", True),)- else: # "mascot" (and any legacy style value)+ else: # an orb style ("mascot" / "voice_orb"), or any legacy valuefrom ui.orb.overlay import OrbOverlaysurface = OrbOverlay(@@ -2642,8 +2644,10 @@ class DesktopApp:"""from loguru import logger+ from jarvis.ui.overlay_styles import ORB_STYLES, OVERLAY_STYLES+style = (style or "jarvis_bar").strip()- if style not in ("jarvis_bar", "mascot", "none"):+ if style not in OVERLAY_STYLES:return {"ok": False, "applied_live": False, "style": style}bridge = getattr(self, "_bridge", None)if bridge is None:@@ -2655,6 +2659,23 @@ class DesktopApp:cache = self._surfaces = {}old = getattr(self, "_orb", None)+ # Mascot <-> voice orb is a RENDERER swap inside one window, not a+ # new surface: the orb window stays, only what it paints changes. So+ # this transition applies live even though every other first-time+ # transition needs a restart (a second tk.Tk() root would abort the+ # process — BUG-031).+ if style in ORB_STYLES and old is not None and hasattr(old, "set_style"):+ old.set_style(style)+ for key in [k for k, v in cache.items() if v is old]:+ cache.pop(key, None)+ cache[style] = old+ try:+ self.cfg.ui.orb_style = style # best-effort in-memory+ except Exception: # noqa: BLE001+ logger.debug("in-memory orb_style update skipped", exc_info=True)+ logger.info("Orb window re-styled live to {}.", style)+ return {"ok": True, "applied_live": True, "style": style}+if style == "none":new = cache.get("none")if new is None:diff --git a/jarvis/ui/jarvisbar/host.py b/jarvis/ui/jarvisbar/host.pyindex 6eefae5ff2..5ed2f929e5 100644--- a/jarvis/ui/jarvisbar/host.py+++ b/jarvis/ui/jarvisbar/host.py@@ -15,8 +15,9 @@ Protocol (UTF-8, one JSON object per line):(optional ``opacity``); every further line is a surface command mirroringthe ``OrbBusBridge`` surface API (``show``, ``hide``, ``set_level``, ...).An optional ``"surface"`` key selects what the host renders:- ``"jarvis_bar"`` (default) or ``"mascot"`` (the OrbOverlay mascot, with an- optional ``"mascot_path"`` passthrough).+ ``"jarvis_bar"`` (default) or ``"mascot"`` (the OrbOverlay window, whose look+ comes from the optional ``"style"`` key — ``"mascot"`` or ``"voice_orb"`` —+ plus an optional ``"mascot_path"`` passthrough).stdin EOF means the parent died or shut down → the host stops the bar andexits, so no ownerless bar can linger on the user's desktop.- child → parent (stdout): events — ``{"event": "ready"}`` once the surface@@ -133,6 +134,10 @@ def dispatch(surface: Any, msg: dict[str, Any]) -> bool:)elif op == "hide_comment":_call(surface, "hide_comment")+ elif op == "set_style":+ # Live re-style of the orb window (mascot <-> voice orb). The bar has+ # no styles, so there the op degrades to the no-op _call() logs.+ _call(surface, "set_style", str(msg.get("style", "mascot")))elif op == "start_mouth_animation":_call(surface, "start_mouth_animation", int(msg.get("duration_ms", 60000)))elif op == "stop_mouth_animation":@@ -318,7 +323,10 @@ def _build_surface(cfg: dict[str, Any]) -> Any:return orb_overlay_cls(sticky=False,mic_reactive=False,- style="mascot",+ # The look inside the orb window (mascot / voice_orb). Forwarded+ # verbatim; OrbOverlay owns the one list of known styles and falls+ # back to the mascot for anything it does not recognise.+ style=str(cfg.get("style") or "mascot"),mascot_path=cfg.get("mascot_path") or None,)kwargs = {diff --git a/jarvis/ui/jarvisbar/subprocess_overlay.py b/jarvis/ui/jarvisbar/subprocess_overlay.pyindex 2969600bb4..49f0a37a42 100644--- a/jarvis/ui/jarvisbar/subprocess_overlay.py+++ b/jarvis/ui/jarvisbar/subprocess_overlay.py@@ -612,22 +612,24 @@ class SubprocessBarOverlay:class SubprocessMascotOverlay(SubprocessBarOverlay):- """Surface proxy driving the mascot ``OrbOverlay`` in the same host.+ """Surface proxy driving the orb window (``OrbOverlay``) in the same host.Same spawn / ready / EOF-degrade plumbing as the bar proxy — the host- process picks the surface from the init line's ``"surface"`` key. Unlike- the bar (which draws no text bubble and no mouth), the mascot renders- all of them, so the text/mouth/animation ops are FORWARDED over stdio- instead of no-opped locally.+ process picks the surface from the init line's ``"surface"`` key and the+ look from ``"style"`` (``mascot`` or ``voice_orb``). Unlike the bar (which+ draws no text bubble and no mouth), the orb window renders all of them, so+ the text/mouth/animation ops are FORWARDED over stdio instead of no-opped+ locally."""_EVENTS_THREAD_NAME = "orb-host-events"_STDERR_THREAD_NAME = "orb-host-stderr"_RESPAWN_THREAD_NAME = "orb-host-respawn"- def __init__(self, mascot_path: str | None = None) -> None:+ def __init__(self, mascot_path: str | None = None, style: str = "mascot") -> None:super().__init__()self._mascot_path = mascot_path+ self._style = str(style or "mascot")# OrbOverlay(sticky=False) always starts withdrawn. The base proxy's# persistent-bar visibility default does not apply to this surface.self._visible = False@@ -636,9 +638,19 @@ class SubprocessMascotOverlay(SubprocessBarOverlay):return {"op": "init","surface": "mascot",+ "style": self._style,"mascot_path": self._mascot_path,}+ def set_style(self, style: str) -> None:+ """Re-style the hosted orb window live (mascot <-> voice orb).++ Remembered locally as well: a host respawn re-sends the init line, and+ without this the window would come back wearing the OLD look.+ """+ self._style = str(style or "mascot")+ self._send({"op": "set_style", "style": self._style})+# The mascot draws the comment bubble and the mouth — forward the ops the# bar proxy no-ops locally (wire shapes match host.dispatch()).def play_animation(self, name: str, **params: Any) -> None:diff --git a/jarvis/ui/overlay_styles.py b/jarvis/ui/overlay_styles.pynew file mode 100644index 0000000000..0eda858d69--- /dev/null+++ b/jarvis/ui/overlay_styles.py@@ -0,0 +1,54 @@+"""The on-screen overlay's style vocabulary — ONE definition, imported everywhere.++A display style answers "what does Jarvis look like on the desktop while it is+listening?". It is a value that crosses Python, the REST payload, TypeScript and+four user-visible surfaces (Settings, onboarding, the config file, the CLI), so+it is exactly the five-layer enum this repo has been bitten by four times+(AP-4 / BUG-008). Same remedy as ``jarvis.ui.jarvisbar.modes``: the tuple lives+in a module with NO imports at all, every layer imports these names instead of+restating them, and ``tests/unit/ui/test_overlay_style_parity.py`` fails the+build when a layer drifts — including the TypeScript union and the i18n labels.++Adding a style = add it here, teach the surface factory+(``DesktopApp._build_overlay_surface``) how to build it, add the label to every+locale, and give it a preview graphic. Nothing else needs touching.+"""+from __future__ import annotations++#: The slim always-available bar (the default).+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. Both live in the SAME frameless,+#: always-on-top window, so both can be dragged onto any monitor.+ORB_STYLES: tuple[str, ...] = ("mascot", "voice_orb")++#: No on-screen overlay at all.+HIDDEN_STYLE = "none"++#: Every style the settings axis offers, in the order the pickers show them.+OVERLAY_STYLES: tuple[str, ...] = (BAR_STYLE, *ORB_STYLES, HIDDEN_STYLE)++#: Values older installs may still carry in ``jarvis.toml`` (or an old frontend+#: bundle may still PUT), mapped onto what they mean today. ``whisper_bar`` was+#: renamed to drop a trademarked word; ``orb`` was the removed procedural+#: renderer, whose selection the mascot inherited.+LEGACY_STYLE_ALIASES: dict[str, str] = {+ "whisper_bar": BAR_STYLE,+ "orb": "mascot",+}+++def normalize_overlay_style(style: object) -> str | None:+ """Map any inbound value onto a known style, or ``None`` if there is none.++ Callers decide what an unknown style means: the REST layer rejects it, the+ boot path falls back to a default. Returning ``None`` keeps that decision+ out of here.+ """+ if not isinstance(style, str):+ return None+ candidate = style.strip().lower()+ candidate = LEGACY_STYLE_ALIASES.get(candidate, candidate)+ return candidate if candidate in OVERLAY_STYLES else Nonediff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/SystemStyleStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/SystemStyleStep.tsxindex b198cf8192..ba0c3a7873 100644--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/SystemStyleStep.tsx+++ b/jarvis/ui/web/frontend/src/components/onboarding/steps/SystemStyleStep.tsx@@ -1,6 +1,10 @@import { useEffect, useState } from "react";import { Button } from "@/components/ui/button";-import { useOverlayStyle, type OverlayStyle } from "@/hooks/useOverlayStyle";+import {+ useOverlayStyle,+ OVERLAY_STYLES,+ type OverlayStyle,+} from "@/hooks/useOverlayStyle";import { StylePreview } from "@/components/overlay/OverlayStylePreviews";import { useT } from "@/i18n";import { cn } from "@/lib/utils";@@ -39,7 +43,7 @@ export function SystemStyleStep({ goNext, skip }: StepProps) {if (config) setStyle(config.style);}, [config]);- const options = config?.options ?? (["jarvis_bar", "mascot", "none"] as OverlayStyle[]);+ const options = config?.options ?? OVERLAY_STYLES;async function onPick(opt: OverlayStyle) {if (saving || restarting) return;@@ -101,7 +105,7 @@ export function SystemStyleStep({ goNext, skip }: StepProps) {</p></div>- <div className="grid grid-cols-3 gap-3">+ <div className="grid grid-cols-2 gap-3 sm:grid-cols-4">{options.map((opt) => (<buttonkey={opt}diff --git a/jarvis/ui/web/frontend/src/components/overlay/OverlayStylePreviews.tsx b/jarvis/ui/web/frontend/src/components/overlay/OverlayStylePreviews.tsxindex 5120bdbbce..b192e3242a 100644--- a/jarvis/ui/web/frontend/src/components/overlay/OverlayStylePreviews.tsx+++ b/jarvis/ui/web/frontend/src/components/overlay/OverlayStylePreviews.tsx@@ -1,4 +1,5 @@import { MascotGigi } from "@/components/MascotGigi";+import { VoiceOrb } from "@/components/agentic/VoiceOrb";import type { OverlayStyle } from "@/hooks/useOverlayStyle";import {PREVIEW_BAR_SPAN,@@ -16,7 +17,8 @@ import {} from "./voiceBars";/**- * Shared visual previews for the on-screen overlay styles (Bar / Mascot / None).+ * Shared visual previews for the on-screen overlay styles (Bar / Mascot /+ * Voice orb / None).** Lifted out of ``views/settings/OverlayTaskbarGroup.tsx`` so both the Settings* panel and the onboarding "System Style" step can render the same graphics@@ -43,6 +45,10 @@ export function StylePreview({ style }: { style: OverlayStyle }) {if (style === "mascot") {return <MascotGigi size={46} reactToVoice={false} enableComments={false} />;}+ // The voice orb is its own portrait: the very renderer the desktop overlay+ // runs, at thumbnail size. Held at "idle" so the picker shows the calm+ // resting look rather than pretending a session is live.+ if (style === "voice_orb") return <VoiceOrb state="idle" size={46} />;if (style === "jarvis_bar") return <BarPreview />;return <NonePreview />;}diff --git a/jarvis/ui/web/frontend/src/hooks/useOverlayStyle.ts b/jarvis/ui/web/frontend/src/hooks/useOverlayStyle.tsindex f7a686f810..9c5a630847 100644--- a/jarvis/ui/web/frontend/src/hooks/useOverlayStyle.ts+++ b/jarvis/ui/web/frontend/src/hooks/useOverlayStyle.ts@@ -2,9 +2,23 @@ import { useCallback, useEffect, useState } from "react";/*** On-screen overlay style from GET /api/settings/overlay-style.- * "jarvis_bar" = slim default bar, "mascot" = ghost orb, "none" = hidden.+ * "jarvis_bar" = slim default bar, "mascot" = ghost mascot, "voice_orb" = the+ * procedural voice orb, "none" = hidden.+ *+ * Mirror of the backend's one list (``jarvis/ui/overlay_styles.py``); the two+ * are pinned together by tests/unit/ui/test_overlay_style_parity.py, which+ * reads THIS union and the i18n labels. Keep the order identical — it is the+ * order both pickers render.*/-export type OverlayStyle = "jarvis_bar" | "mascot" | "none";+export type OverlayStyle = "jarvis_bar" | "mascot" | "voice_orb" | "none";++/** Client-side fallback while GET is in flight (same order as the backend). */+export const OVERLAY_STYLES: OverlayStyle[] = [+ "jarvis_bar",+ "mascot",+ "voice_orb",+ "none",+];export interface OverlayStyleConfig {style: OverlayStyle;@@ -59,7 +73,7 @@ export function useOverlayStyle() {setConfig((prev) =>prev? { ...prev, style: result.style }- : { style: result.style, options: ["jarvis_bar", "mascot", "none"] },+ : { style: result.style, options: [...OVERLAY_STYLES] },);return result;},diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 7d2dd90b2f..0466dc932a 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -92,6 +92,7 @@"feedback": "Feedback","agent_instructions": "{name}.md","agentic_ide": "Agentic IDE",+ "agentic_ide_beta": "Beta","voice": "{name} Stimme","voice_shortcuts": "Tastenkürzel","voice_language": "Sprache",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex f900b2d4e8..5228825636 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -92,6 +92,7 @@"feedback": "Feedback","agent_instructions": "{name}.md","agentic_ide": "Agentic IDE",+ "agentic_ide_beta": "Beta","voice": "{name} Voice","voice_shortcuts": "Shortcuts","voice_language": "Language",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 81c0c22dd0..a483044ea3 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -92,6 +92,7 @@"feedback": "Comentarios","agent_instructions": "{name}.md","agentic_ide": "IDE agéntico",+ "agentic_ide_beta": "Beta","voice": "Voz de {name}","voice_shortcuts": "Atajos","voice_language": "Idioma",diff --git a/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsxindex 6a83044109..e56709ccfb 100644--- a/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx+++ b/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx@@ -1,7 +1,11 @@import { useEffect, useState } from "react";import { Monitor, Eye, Volume2, Bell, MousePointer } from "lucide-react";import { Switch } from "@/components/ui/switch";-import { useOverlayStyle, type OverlayStyle } from "@/hooks/useOverlayStyle";+import {+ useOverlayStyle,+ OVERLAY_STYLES,+ type OverlayStyle,+} from "@/hooks/useOverlayStyle";import { StylePreview } from "@/components/overlay/OverlayStylePreviews";import { useBarPersistent } from "@/hooks/useBarPersistent";import { useBarFollowCursor } from "@/hooks/useBarFollowCursor";@@ -275,7 +279,7 @@ function OverlayStylePanel() {}}- const options = config?.options ?? (["jarvis_bar", "mascot", "none"] as OverlayStyle[]);+ const options = config?.options ?? OVERLAY_STYLES;async function onPick(opt: OverlayStyle) {if (saving) return;@@ -309,8 +313,10 @@ function OverlayStylePanel() {{t("settings_view.overlay_style.description")}</p>- {/* Visual preview cards — click to apply (no dropdown). */}- <div className="mt-4 grid grid-cols-3 gap-3">+ {/* Visual preview cards — click to apply (no dropdown). Two columns+ on a narrow window so a fourth style never squeezes the previews+ into unreadable slivers. */}+ <div className="mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4">{options.map((opt) => (<buttonkey={opt}diff --git a/jarvis/ui/web/settings_routes.py b/jarvis/ui/web/settings_routes.pyindex eabcf288f8..d967d4772d 100644--- a/jarvis/ui/web/settings_routes.py+++ b/jarvis/ui/web/settings_routes.py@@ -38,6 +38,7 @@ from jarvis.brain.manager import SUPPORTED_REPLY_LANGUAGESfrom jarvis.core.config import RECOGNITION_LANGUAGE_CHOICESfrom jarvis.memory.wiki.integration import get_running_curatorfrom jarvis.speech.local_models import FASTER_WHISPER_PACKAGE+from jarvis.ui.overlay_styles import OVERLAY_STYLES, normalize_overlay_styleif TYPE_CHECKING:from jarvis.core.config import WikiCuratorConfig@@ -1897,7 +1898,7 @@ async def put_autostart(body: AutostartBody, request: Request) -> dict[str, obje}-_OVERLAY_STYLES = ("jarvis_bar", "mascot", "none")+_OVERLAY_STYLES = OVERLAY_STYLESclass OverlayStyleBody(BaseModel):@@ -1916,19 +1917,21 @@ async def get_overlay_style(request: Request) -> dict[str, object]:@router.put("/overlay-style")async def put_overlay_style(body: OverlayStyleBody, request: Request) -> dict[str, object]:- """Switch the on-screen overlay (jarvis_bar / mascot / none).+ """Switch the on-screen overlay (see ``jarvis.ui.overlay_styles``).Persists [ui].orb_style and live-swaps the running surface via theDesktopApp (app.state.desktop_app.swap_overlay). When no live app isreachable (headless), the choice is persisted and applies on restart.++ Legacy values from a not-yet-rebuilt client (``whisper_bar`` before the+ rename, ``orb`` before the procedural renderer was removed) are normalized+ rather than rejected."""- style = body.style.strip()- # Backwards-compat: accept the legacy "whisper_bar" value (renamed to- # "jarvis_bar" to drop a trademarked name) from any not-yet-rebuilt client.- if style == "whisper_bar":- style = "jarvis_bar"- if style not in _OVERLAY_STYLES:- raise HTTPException(status_code=400, detail=f"Unknown overlay style '{style}'")+ style = normalize_overlay_style(body.style)+ if style is None:+ raise HTTPException(+ status_code=400, detail=f"Unknown overlay style '{body.style.strip()}'"+ )# Best-effort in-memory cfg update so a later read agrees pre-restart.cfg = _config(request)diff --git a/tests/unit/ui/jarvisbar/test_subprocess_overlay.py b/tests/unit/ui/jarvisbar/test_subprocess_overlay.pyindex 1ad390085c..ce94ae05ae 100644--- a/tests/unit/ui/jarvisbar/test_subprocess_overlay.py+++ b/tests/unit/ui/jarvisbar/test_subprocess_overlay.py@@ -511,11 +511,33 @@ def _started_mascot(monkeypatch, **kwargs) -> tuple[SubprocessMascotOverlay, _Fadef test_mascot_init_line_declares_surface_and_mascot_path(monkeypatch) -> None:surface, proc = _started_mascot(monkeypatch, mascot_path="assets/m.png")init = proc.sent()[0]- assert init == {"op": "init", "surface": "mascot", "mascot_path": "assets/m.png"}+ assert init == {+ "op": "init",+ "surface": "mascot",+ "style": "mascot",+ "mascot_path": "assets/m.png",+ }assert surface._ready.is_set() # scripted ready event consumedassert surface._visible is False # sticky=False mascot starts withdrawn+def test_voice_orb_style_reaches_the_host(monkeypatch) -> None:+ surface, proc = _started_mascot(monkeypatch, style="voice_orb")+ assert proc.sent()[0]["style"] == "voice_orb"+++def test_set_style_is_forwarded_and_survives_a_respawn(monkeypatch) -> None:+ # The host may be respawned after a crash; it is re-initialized from the+ # init line, so a live re-style has to update the remembered style too —+ # otherwise the window comes back wearing the look the user just left.+ surface, proc = _started_mascot(monkeypatch, style="mascot")++ surface.set_style("voice_orb")++ assert {"op": "set_style", "style": "voice_orb"} in proc.sent()+ assert surface._init_payload()["style"] == "voice_orb"++def test_bar_init_payload_is_unchanged_by_the_mascot_variant(monkeypatch) -> None:"""Regression: the bar proxy's init line keeps its exact pre-mascot shape."""surface, proc = _started_proxy(diff --git a/tests/unit/ui/test_desktop_swap_overlay.py b/tests/unit/ui/test_desktop_swap_overlay.pyindex 1e47f305be..b244daf608 100644--- a/tests/unit/ui/test_desktop_swap_overlay.py+++ b/tests/unit/ui/test_desktop_swap_overlay.py@@ -92,3 +92,55 @@ def test_swap_without_bridge_is_persisted_only():def test_swap_rejects_unknown_style():app = _app(bridge=FakeBridge(), orb=FakeOld())assert app.swap_overlay("bogus")["ok"] is False+++class FakeOrbWindow(FakeOld):+ """An orb surface: one window that can change what it paints."""++ def __init__(self, style="mascot"):+ super().__init__()+ self.style = style++ def set_style(self, style):+ self.style = style+++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")+ app = _app(orb_style="mascot", bridge=bridge, orb=orb)+ app._surfaces = {"mascot": orb}++ result = app.swap_overlay("voice_orb")++ assert result == {"ok": True, "applied_live": True, "style": "voice_orb"}+ assert orb.style == "voice_orb"+ assert orb.hidden is False # same window — never hidden mid-swap+ assert app.cfg.ui.orb_style == "voice_orb"+ # Re-keyed, not duplicated: swapping back must find the same live window.+ assert app._surfaces == {"voice_orb": orb}+++def test_voice_orb_back_to_mascot_also_applies_live():+ bridge, orb = FakeBridge(), FakeOrbWindow("voice_orb")+ app = _app(orb_style="voice_orb", bridge=bridge, orb=orb)+ app._surfaces = {"voice_orb": orb}++ assert app.swap_overlay("mascot")["applied_live"] is True+ assert orb.style == "mascot"+++def test_bar_to_voice_orb_still_needs_a_restart():+ # The bar surface has no orb window behind it, so this one really does need+ # a fresh root — the restart path must stay intact.+ bridge = FakeBridge()+ app = _app(orb_style="jarvis_bar", bridge=bridge, orb=FakeOld())+ app._surfaces = {}++ assert app.swap_overlay("voice_orb") == {+ "ok": True,+ "applied_live": False,+ "style": "voice_orb",+ }+ assert bridge.surface is Nonediff --git a/tests/unit/ui/test_orb_style_dispatch.py b/tests/unit/ui/test_orb_style_dispatch.pynew file mode 100644index 0000000000..e025ba6d08--- /dev/null+++ b/tests/unit/ui/test_orb_style_dispatch.py@@ -0,0 +1,101 @@+"""The orb window paints the style it was asked for, and never a magenta box.++Both looks — the Gigi mascot and the procedural voice orb — share ONE frameless+always-on-top window, which is what makes the voice orb draggable to any+monitor instead of being trapped inside the app. These tests pin that seam:+style in, right renderer out, unknown values recovered rather than fatal, and a+desktop session without per-pixel transparency degrading to nothing visible+instead of an opaque key-coloured square.+"""+from __future__ import annotations++import tkinter as tk++import pytest++import ui.orb.overlay as overlay_mod+from jarvis.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++[email protected](autouse=True)+def _no_env_style(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.delenv("JARVIS_ORB_STYLE", raising=False)+++def test_voice_orb_style_builds_the_voice_orb_renderer() -> None:+ overlay = OrbOverlay(style="voice_orb")++ assert overlay._style == "voice_orb"+ assert isinstance(overlay._build_renderer("voice_orb"), VoiceOrbRenderer)+++def test_mascot_style_still_builds_the_mascot_renderer() -> None:+ overlay = OrbOverlay(style="mascot")++ assert overlay._style == "mascot"+ assert isinstance(overlay._build_renderer("mascot"), MascotRenderer)+++def test_env_can_select_the_voice_orb(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setenv("JARVIS_ORB_STYLE", "voice_orb")++ assert OrbOverlay(style="mascot")._style == "voice_orb"+++def test_style_switch_before_start_is_remembered() -> None:+ overlay = OrbOverlay(style="mascot")++ overlay.set_style("voice_orb")++ assert overlay._style == "voice_orb"+++def test_unknown_style_recovers_to_the_mascot_instead_of_raising() -> None:+ # A jarvis.toml written by a NEWER build must not leave an older one with no+ # overlay at all — and set_style() is called from a REST route, where an+ # exception would surface as a 500 on a cosmetic setting.+ assert _coerce_style("nonsense") == "mascot"+ assert _coerce_style(None) == "mascot"+ assert OrbOverlay(style="nonsense")._style == "mascot"+ OrbOverlay(style="mascot").set_style("nonsense") # no raise+++def test_every_orb_style_maps_to_a_renderer() -> None:+ overlay = OrbOverlay(style="mascot")+ for style in ORB_STYLES:+ assert overlay._build_renderer(style) is not None, style+++class _FakeRoot:+ """Minimal Tk stand-in: refuses the colour key like a bare X11 session."""++ def __init__(self, *, supported: bool) -> None:+ self.supported = supported+ self.background: str | None = None++ def wm_attributes(self, name: str, value: str) -> None:+ if not self.supported:+ raise tk.TclError(f"bad attribute {name}")++ def configure(self, **kwargs: object) -> None:+ self.background = str(kwargs.get("bg"))+++def test_color_key_applied_when_the_session_supports_it() -> None:+ root = _FakeRoot(supported=True)++ assert _apply_color_key(root) is True+ assert root.background == overlay_mod.COLOR_KEY_HEX+++def test_color_key_refusal_is_reported_not_raised(caplog: pytest.LogCaptureFixture) -> None:+ root = _FakeRoot(supported=False)++ with caplog.at_level("WARNING", logger="jarvis.orb"):+ supported = _apply_color_key(root)++ assert supported is False+ # AP-30: the window will not appear, so the reason has to be visible.+ assert any("colour key" in record.message for record in caplog.records)diff --git a/tests/unit/ui/test_overlay_style_parity.py b/tests/unit/ui/test_overlay_style_parity.pynew file mode 100644index 0000000000..f6781c9649--- /dev/null+++ b/tests/unit/ui/test_overlay_style_parity.py@@ -0,0 +1,101 @@+"""The display-style value must mean the same thing in every layer.++``orb_style`` crosses Python, the REST payload, the TypeScript union and four+user-visible surfaces. That is the five-layer enum this repo has been bitten by+four times (AP-4 / BUG-008): the classic symptom is a style the backend offers+that the picker renders as an unlabelled, previewless card — or worse, a style+the UI can select and the surface factory silently drops.++So this pins the layers to ``jarvis.ui.overlay_styles``:++* the REST options list,+* the TypeScript ``OverlayStyle`` union and its client-side fallback array,+* the Settings labels and the onboarding labels + captions, in EVERY locale,+* the preview graphic (no style may fall through to the "hidden" thumbnail),+* the surface factory (every style must map to a surface).+"""+from __future__ import annotations++import json+import re+from pathlib import Path++import pytest++from jarvis.ui.overlay_styles import (+ LEGACY_STYLE_ALIASES,+ ORB_STYLES,+ OVERLAY_STYLES,+ normalize_overlay_style,+)++_FRONTEND = Path(__file__).resolve().parents[3] / "jarvis/ui/web/frontend/src"+_LOCALES = _FRONTEND / "i18n/locales"+++def _ts(relative: str) -> str:+ return (_FRONTEND / relative).read_text(encoding="utf-8")+++def _locale(name: str) -> dict:+ return json.loads((_LOCALES / f"{name}.json").read_text(encoding="utf-8"))+++def _locale_names() -> list[str]:+ return sorted(path.stem for path in _LOCALES.glob("*.json"))+++def test_typescript_union_matches_python() -> None:+ source = _ts("hooks/useOverlayStyle.ts")+ match = re.search(r"export type OverlayStyle =([^;]+);", source)+ assert match, "OverlayStyle union not found — did the hook move?"+ union = re.findall(r'"([a-z_]+)"', match.group(1))+ assert union == list(OVERLAY_STYLES)+++def test_typescript_fallback_array_matches_python() -> None:+ source = _ts("hooks/useOverlayStyle.ts")+ match = re.search(r"OVERLAY_STYLES: OverlayStyle\[\] = \[([^\]]+)\]", source)+ assert match, "OVERLAY_STYLES fallback array not found"+ assert re.findall(r'"([a-z_]+)"', match.group(1)) == list(OVERLAY_STYLES)++[email protected]("locale", _locale_names())+def test_settings_labels_cover_every_style(locale: str) -> None:+ options = _locale(locale)["settings_view"]["overlay_style"]["options"]+ assert sorted(options) == sorted(OVERLAY_STYLES)+ assert all(str(label).strip() for label in options.values())++[email protected]("locale", _locale_names())+def test_onboarding_labels_and_captions_cover_every_style(locale: str) -> None:+ step = _locale(locale)["onboarding"]["system_style"]+ assert sorted(step["options"]) == sorted(OVERLAY_STYLES)+ assert sorted(step["captions"]) == sorted(OVERLAY_STYLES)+ assert all(str(text).strip() for text in step["captions"].values())+++def test_every_style_has_its_own_preview_graphic() -> None:+ # StylePreview falls THROUGH to the "hidden" thumbnail, so a style nobody+ # taught it renders as a crossed-out box that claims the overlay is off.+ source = _ts("components/overlay/OverlayStylePreviews.tsx")+ for style in OVERLAY_STYLES:+ if style == "none":+ continue+ assert f'"{style}"' in source, f"{style} has no preview branch"+++def test_surface_factory_knows_every_style() -> None:+ # The factory branches on "none" / "jarvis_bar" and treats everything else+ # as an orb style, so the check is that the leftovers really ARE orb styles.+ leftovers = set(OVERLAY_STYLES) - {"none", "jarvis_bar"}+ assert leftovers == set(ORB_STYLES)+++def test_legacy_values_still_resolve() -> None:+ for legacy, current in LEGACY_STYLE_ALIASES.items():+ assert normalize_overlay_style(legacy) == current+ assert current in OVERLAY_STYLES+ assert normalize_overlay_style(" MASCOT ") == "mascot"+ assert normalize_overlay_style("bogus") is None+ assert normalize_overlay_style(None) is Nonediff --git a/tests/unit/ui/test_overlay_style_route.py b/tests/unit/ui/test_overlay_style_route.pyindex 65adb6ed8b..9c8f482e66 100644--- a/tests/unit/ui/test_overlay_style_route.py+++ b/tests/unit/ui/test_overlay_style_route.py@@ -7,6 +7,7 @@ import pytestfrom fastapi import FastAPIfrom fastapi.testclient import TestClient+from jarvis.ui.overlay_styles import OVERLAY_STYLESfrom jarvis.ui.web.settings_routes import router@@ -26,7 +27,7 @@ def test_get_returns_current_and_options():assert r.status_code == 200body = r.json()assert body["style"] == "mascot"- assert set(body["options"]) == {"jarvis_bar", "mascot", "none"}+ assert body["options"] == list(OVERLAY_STYLES)def test_put_rejects_unknown_style():@@ -34,6 +35,21 @@ def test_put_rejects_unknown_style():assert r.status_code == 400+ ("sent", "stored"),+ [("whisper_bar", "jarvis_bar"), ("orb", "mascot"), ("Voice_Orb", "voice_orb")],+)+def test_put_normalizes_legacy_and_cased_values(monkeypatch, sent, stored):+ # An old frontend bundle (or an old jarvis.toml round-trip) must not get a+ # 400 for a value that still has a meaning today.+ import jarvis.core.config_writer as cw++ monkeypatch.setattr(cw, "set_overlay_style", lambda style, **k: None)+ r = _client().put("/api/settings/overlay-style", json={"style": sent})+ assert r.status_code == 200+ assert r.json()["style"] == stored++def test_put_persists_and_live_applies(monkeypatch):persisted = {}import jarvis.core.config_writer as cwdiff --git a/tests/unit/ui/test_voice_orb_renderer.py b/tests/unit/ui/test_voice_orb_renderer.pynew file mode 100644index 0000000000..b2b70b4962--- /dev/null+++ b/tests/unit/ui/test_voice_orb_renderer.py@@ -0,0 +1,110 @@+"""The desktop voice orb renders a colour-keyed sphere that reacts to modes.++Pixel-exactness against the in-app canvas is not something a test can assert+(different rasterizers), so these pin the properties the overlay depends on: a+binary silhouette on the exact key colour, a palette that stays in the product's+ivory/gold range, and per-mode motion that actually differs.+"""+from __future__ import annotations++import numpy as np+import pytest++from jarvis.ui.jarvisbar.modes import MODES+from ui.orb.voice_orb import MOTIONS, VoiceOrbRenderer++KEY = (255, 0, 255)+++def _frame(renderer: VoiceOrbRenderer, t: float, mode: str, level=None) -> np.ndarray:+ return np.asarray(renderer.render(t, mode, level), dtype=np.int16)+++def test_every_surface_mode_has_motion() -> None:+ # A mode the surface accepts but the renderer does not know would silently+ # freeze the orb on its previous look (AP-4 / BUG-008 shape).+ assert set(MOTIONS) == set(MODES)+++def test_frame_is_key_coloured_outside_a_solid_circle() -> None:+ renderer = VoiceOrbRenderer(size=108, color_key=KEY)+ frame = _frame(renderer, 0.0, "listen")++ assert frame.shape == (108, 108, 3)+ # Corners are outside any inscribed circle → must be the exact key colour,+ # or Windows leaves an opaque square on the desktop.+ for y, x in ((0, 0), (0, 107), (107, 0), (107, 107)):+ assert tuple(frame[y, x]) == KEY+ # The centre is orb, not key.+ assert tuple(frame[54, 54]) != KEY+++def test_no_blended_edge_pixels_survive_the_colour_key() -> None:+ """Every pixel is either orb or exactly the key colour — no pink fringe."""+ renderer = VoiceOrbRenderer(size=108, color_key=KEY)+ frame = _frame(renderer, 0.0, "speak")++ r, g, b = frame[..., 0], frame[..., 1], frame[..., 2]+ # A blend of the gold palette with magenta shows up as a high-red,+ # low-green, high-blue pixel that is NOT the key itself.+ keyed = (r == 255) & (g == 0) & (b == 255)+ magenta_ish = (r > 180) & (g < 90) & (b > 140) & ~keyed+ assert not magenta_ish.any()+++def test_palette_stays_in_the_product_range() -> None:+ renderer = VoiceOrbRenderer(size=108, color_key=KEY)+ frame = _frame(renderer, 0.0, "idle")+ keyed = (frame[..., 0] == 255) & (frame[..., 1] == 0) & (frame[..., 2] == 255)+ orb = frame[~keyed]++ assert orb.size > 0+ # Warm: red >= green >= blue holds across the whole ivory→amber ramp.+ assert (orb[:, 0] >= orb[:, 1]).mean() > 0.98+ assert (orb[:, 1] >= orb[:, 2]).mean() > 0.98+++def test_modes_look_different() -> None:+ listening = VoiceOrbRenderer(size=108, color_key=KEY)+ thinking = VoiceOrbRenderer(size=108, color_key=KEY)+ # Same clock, different mode: the fields diverge because pace, turbulence+ # and energy differ, not because time moved on.+ for t in (0.0, 0.2, 0.4, 0.6, 0.8, 1.0):+ left = _frame(listening, t, "listen")+ right = _frame(thinking, t, "think")+ assert np.abs(left - right).mean() > 1.0+++def test_only_listening_modes_react_to_the_live_level() -> None:+ assert VoiceOrbRenderer._input_level("listen", 0.7) == pytest.approx(0.7)+ # Recording keeps a floor so a quiet moment never reads as a dead orb.+ assert VoiceOrbRenderer._input_level("dictate", 0.0) > 0.0+ # Transcribing has no live feed; a stale sample must not animate the orb.+ assert VoiceOrbRenderer._input_level("dictate_transcribing", 0.9) == 0.0+ assert VoiceOrbRenderer._input_level("think", 0.9) == 0.0+ assert VoiceOrbRenderer._input_level("listen", None) == 0.0+++def test_field_is_recomputed_at_a_capped_rate() -> None:+ """The overlay paints at ~60 fps; the procedural field must not follow."""+ renderer = VoiceOrbRenderer(size=108, color_key=KEY)+ calls = {"n": 0}+ original = renderer._paint_weather++ def counted(impact):+ calls["n"] += 1+ return original(impact)++ renderer._paint_weather = counted # type: ignore[method-assign]+ for step in range(60): # one second of 60 fps frames+ renderer.render(step / 60.0, "listen", 0.4)+ assert calls["n"] <= 22 # 20 fps + the initial frame, with slack+++def test_mouth_ops_are_accepted_and_do_nothing() -> None:+ # The shared surface drives these for the mascot; the orb must answer them+ # rather than make the surface special-case renderers.+ renderer = VoiceOrbRenderer(size=48, color_key=KEY)+ renderer.start_mouth_anim(1.0, 0.0)+ renderer.stop_mouth_anim()+ assert renderer.render(0.0, "speak", None).size == (48, 48)diff --git a/ui/orb/overlay.py b/ui/orb/overlay.pyindex 3316ac93a9..6049cb672f 100644--- a/ui/orb/overlay.py+++ b/ui/orb/overlay.py@@ -22,6 +22,7 @@ Rendering pipeline:Public API:overlay = OrbOverlay(style="mascot") # SWG/Gigi PNG+ overlay = OrbOverlay(style="voice_orb") # procedural weather sphereoverlay.start() # blocks until mainloop exitoverlay.show(mode="listen") # voice modes: idle/listen/speak/thinkoverlay.show(mode="speak")@@ -32,13 +33,14 @@ Public API:overlay.set_style("mascot") # runtime switch, no restartENV overrides:- JARVIS_ORB_STYLE=mascot # legacy "orb" requests are ignored+ JARVIS_ORB_STYLE=mascot|voice_orb # legacy "orb" requests are ignoredJARVIS_ORB_MASCOT_PATH=<path.png> # alternative mascot pathStandalone test:python -m ui.orb.overlay # demo sequence (mascot)python -m ui.orb.overlay --sticky # permanently visible (preview)python -m ui.orb.overlay --sticky --mascot # SWG mascot, static+ python -m ui.orb.overlay --sticky --voice-orb # procedural voice orbpython -m ui.orb.overlay --mic --mascot # SWG + mic-reactive"""@@ -64,6 +66,7 @@ from PIL import Image, ImageDraw, ImageFilter, ImageTkfrom jarvis.core.config import DEFAULT_CONFIG_FILE as JARVIS_TOML_PATHfrom jarvis.core.win32_dpi import ensure_dpi_awareness as _ensure_dpi_awarenessfrom jarvis.ui.jarvisbar.modes import MODES+from jarvis.ui.overlay_styles import LEGACY_STYLE_ALIASES, ORB_STYLESfrom ui.orb.animations import (ANIMATION_REGISTRY,Animation,@@ -89,6 +92,14 @@ from ui.orb.taskbar import (get_taskbar_info,get_tray_notify_rect,)+from ui.orb.voice_orb import VoiceOrbRenderer++#: The looks this window can wear (ONE definition, in jarvis.ui.overlay_styles):+#: ``mascot`` is the Gigi ghost, ``voice_orb`` the procedural weather sphere —+#: the desktop twin of the in-app orb. Both share this window, so both are+#: always on top and draggable to any monitor. The removed legacy procedural+#: "orb" style is coerced to the mascot.+DEFAULT_ORB_STYLE = "mascot"@dataclass@@ -340,6 +351,54 @@ def _apply_jarvis_icon_to_tk_root(root: tk.Tk) -> None:)+def _coerce_style(style: str | None) -> str:+ """Return a style this window can actually render.++ Unknown values (the removed legacy ``"orb"``, a typo, a value written by a+ newer build into an older ``jarvis.toml``) fall back to the mascot with one+ warning rather than leaving the desktop without any overlay at all.+ """+ candidate = (style or "").strip().lower()+ candidate = LEGACY_STYLE_ALIASES.get(candidate, candidate)+ if candidate in ORB_STYLES:+ return candidate+ import logging++ logging.getLogger("jarvis.orb").warning(+ "Unknown orb style %r — falling back to %r (known: %s).",+ style,+ DEFAULT_ORB_STYLE,+ ", ".join(ORB_STYLES),+ )+ return DEFAULT_ORB_STYLE+++def _apply_color_key(root: tk.Tk) -> bool:+ """Make the key colour transparent on this Tk root. False = not supported.++ Windows keys the magenta out natively on the layered window. On Linux the+ same attribute is accepted only under a compositing window manager; under a+ bare X11 session (and on Wayland) Tk raises, and the honest outcome is "no+ overlay" rather than an opaque magenta square parked on the desktop. The+ caller degrades; this never raises.+ """+ try:+ root.wm_attributes("-transparentcolor", COLOR_KEY_HEX)+ root.configure(bg=COLOR_KEY_HEX)+ return True+ except tk.TclError:+ import logging++ logging.getLogger("jarvis.orb").warning(+ "This desktop session does not support Tk's transparent colour key "+ "(typical for Wayland or X11 without a compositor) — the on-screen "+ "orb stays hidden. Voice, the tray icon and the app window are "+ "unaffected; pick 'None (hidden)' as the display style to silence "+ "this."+ )+ return False++def _hide_tk_window_from_task_switcher(root: tk.Tk) -> None:"""Marks the orb window as a toolwindow so it doesn't count as an app."""if sys.platform != "win32":@@ -1423,18 +1482,19 @@ class OrbOverlay:mascot_path: str | Path | None = None,) -> None:"""- style: only ``"mascot"`` is accepted. Legacy ``"orb"`` requests are- coerced to ``"mascot"``.+ style: one of :data:`ORB_STYLES` — ``"mascot"`` (the Gigi ghost) or+ ``"voice_orb"`` (the procedural weather sphere). Anything else,+ including the legacy ``"orb"``, is coerced to ``"mascot"``.mascot_path: optional explicit path, otherwise via ENV or the default asset.- ENV-Override: ``JARVIS_ORB_STYLE=mascot`` may request mascot explicitly;- legacy ``orb`` values are ignored.+ ENV-Override: ``JARVIS_ORB_STYLE=mascot|voice_orb`` selects the look;+ unknown values are ignored."""self._sticky = stickyself._mic_reactive = mic_reactiveself._root: tk.Tk | None = Noneself._canvas: tk.Canvas | None = Noneself._comment_bubble: OrbCommentBubble | None = None- self._renderer: MascotRenderer | None = None+ self._renderer: MascotRenderer | VoiceOrbRenderer | None = None# Cached mascot anchor + min-show-time guard.self._mascot_x: int = 0self._mascot_y: int = 0@@ -1480,18 +1540,11 @@ class OrbOverlay:# (mic-reactive mode is optional).self._mic = None- # Style resolution: mascot-only. Keep accepting the old knobs so- # existing launchers do not crash, but never render the legacy orb.+ # Style resolution. Keep accepting the old knobs so existing launchers+ # 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 "mascot").lower()- if requested_style != "mascot":- import logging-- logging.getLogger("jarvis.orb").warning(- "Ignoring legacy orb style request %r; using mascot.",- requested_style,- )- self._style = "mascot"+ 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# --- Public API ----------------------------------------------------@@ -1537,8 +1590,18 @@ class OrbOverlay:)self._root.configure(bg=COLOR_KEY_HEX)else:- self._root.wm_attributes("-transparentcolor", COLOR_KEY_HEX)- self._root.configure(bg=COLOR_KEY_HEX)+ if not _apply_color_key(self._root):+ # No per-pixel transparency on this session: showing the window+ # would put an opaque magenta square on the user's desktop.+ # Tear the root down and report started, so the caller's+ # start_in_thread() unblocks instead of timing out.+ try:+ self._root.destroy()+ except tk.TclError:+ pass+ self._root = None+ self._started.set()+ return# The colour key belongs to THIS window only. Once this Tk loop# stops pumping — any long GIL-holding stretch on another thread# does it — Windows paints an unlayered ``Ghost`` stand-in over the@@ -2363,23 +2426,13 @@ class OrbOverlay:return self._renderer.active_animation_names()def set_style(self, style: str) -> None:- """Switches the renderer at runtime (``"orb"`` or ``"mascot"``).+ """Switches the renderer at runtime (see :data:`ORB_STYLES`).Thread-safe — queued via root.after. If ``"mascot"`` is requested butthe PNG is not found, the current renderer stays unchanged(the caller learns about it via the logger warning entry)."""- style = (style or "").lower()- if style == "orb":- import logging-- logging.getLogger("jarvis.orb").warning(- "Ignoring legacy orb style request %r; using mascot.",- style,- )- style = "mascot"- if style != "mascot":- raise ValueError(f"Unknown style: {style!r} (allowed: mascot)")+ style = _coerce_style(style)if self._root is None:# Not started yet → remember the style, start() picks it upself._style = style@@ -2393,7 +2446,21 @@ class OrbOverlay:self._renderer = new_rendererself._style = style- def _build_renderer(self, style: str) -> MascotRenderer | None:+ def _build_renderer(self, style: str) -> MascotRenderer | VoiceOrbRenderer | None:+ if style == "voice_orb":+ try:+ return VoiceOrbRenderer(+ size=WIN_W, color_key=(int(COLOR_KEY_RGB[0]), int(COLOR_KEY_RGB[1]),+ int(COLOR_KEY_RGB[2]))+ )+ except Exception as exc: # noqa: BLE001+ import logging++ logging.getLogger("jarvis.orb").warning(+ "VoiceOrbRenderer init failed (%s); overlay will stay hidden.",+ exc,+ )+ return Noneif style == "mascot":mascot_path = _resolve_mascot_path(self._mascot_path_hint)if mascot_path is None:@@ -2564,6 +2631,11 @@ def main() -> int:action="store_true",help="Uses the SWG/Gigi mascot.",)+ parser.add_argument(+ "--voice-orb",+ action="store_true",+ help="Uses the procedural voice orb (the desktop twin of the in-app orb).",+ )parser.add_argument("--mascot-path",type=str,@@ -2597,7 +2669,7 @@ def main() -> int:use_mascot = args.mascot or bool(args.animation) or args.all_animationssticky = args.sticky or args.mic or bool(args.animation) or args.all_animations- style = "mascot" if use_mascot else "orb"+ style = "voice_orb" if args.voice_orb and not use_mascot else "mascot"overlay = OrbOverlay(sticky=sticky,diff --git a/ui/orb/voice_orb.py b/ui/orb/voice_orb.pynew file mode 100644index 0000000000..0228083c15--- /dev/null+++ b/ui/orb/voice_orb.py@@ -0,0 +1,437 @@+"""Procedural "voice orb" renderer for the free-floating desktop overlay.++This is the desktop twin of the in-app orb (``components/agentic/VoiceOrb.tsx``):+a luminous, cloud-filled sphere made of softly evolving procedural weather+rather than a glossy gradient ball. A low-resolution fractal field is colour+mapped through the product's ivory / gold / amber palette and enlarged with+interpolation, which is what produces organic depth without visible bands,+outlines, rotating particles or image assets. Voice states change pace,+breathing, turbulence and highlight energy; the colour identity stays stable.++Why a port instead of hosting the web canvas: the browser orb can only ever+live inside the app window. A user who wants the orb ON the desktop — dragged+to whichever monitor they like, above every other window — needs the same+frameless, always-on-top surface the mascot and the Jarvis Bar already use, and+that surface is fed by ``render(t, mode, ext_level) -> PIL.Image``. So the field+is reproduced here in numpy against the SAME constants as the TypeScript+version; the two are meant to look alike, and the guard test pins the palette+and the per-mode motion table rather than a pixel hash.++Two properties are load-bearing for the overlay, not cosmetic:++* **Hard circular edge.** The Windows surface keys out one exact colour+ (magenta) to make a pixel transparent. Any pixel that is a *blend* of orb and+ key colour survives as a pink fringe, so the silhouette is a binary mask — no+ alpha feathering outward. macOS derives its alpha from the same exact-match+ key (``overlay.key_to_alpha``), so the rule holds there too.+* **Capped field cadence.** The overlay's frame loop runs at ~60 fps; the+ procedural field is recomputed at 20 fps (the web orb's rate) and re-composed+ cheaply in between. Breathing still moves every frame, because that is a+ geometry change, not a field change.+"""++from __future__ import annotations++import math++import numpy as np+from PIL import Image++# --- Palette (identical to the in-app orb) ---------------------------------+IVORY = (255.0, 250.0, 235.0)+PALE_GOLD = (248.0, 226.0, 151.0)+SIGNAL_GOLD = (231.0, 196.0, 110.0)+AMBER = (210.0, 147.0, 24.0)+DEEP_AMBER = (126.0, 66.0, 2.0)+CLOUD_LIGHT = (255.0, 249.0, 216.0)++#: Field resolution. 48² samples is what keeps the whole renderer affordable+#: next to speech; the sphere gets its softness from the upscale, not from+#: resolution.+TEXTURE_SIZE = 48+#: Side length of the tiled pseudo-random grid the value noise samples.+NOISE_SIZE = 64+#: Recompute cadence of the procedural field (the web orb's 20 fps).+FIELD_INTERVAL_S = 1.0 / 20.0+++class Motion:+ """How one coarse mode moves. Mirrors the ``Motion`` record of the web orb."""++ __slots__ = (+ "flow_x",+ "flow_y",+ "breath_amp",+ "breath_hz",+ "turbulence",+ "energy",+ "voice_impact",+ )++ def __init__(+ self,+ flow_x: float,+ flow_y: float,+ breath_amp: float,+ breath_hz: float,+ turbulence: float,+ energy: float,+ voice_impact: float,+ ) -> None:+ self.flow_x = flow_x+ self.flow_y = flow_y+ self.breath_amp = breath_amp+ self.breath_hz = breath_hz+ self.turbulence = turbulence+ self.energy = energy+ self.voice_impact = voice_impact++ def copy(self) -> Motion:+ return Motion(+ self.flow_x,+ self.flow_y,+ self.breath_amp,+ self.breath_hz,+ self.turbulence,+ self.energy,+ self.voice_impact,+ )+++#: Per-mode motion, keyed by the surface's coarse modes+#: (``jarvis.ui.jarvisbar.modes.MODES``) rather than the web orb's voice states.+#:+#: * ``dictate`` reuses the listening weather: dictation feeds the very same live+#: microphone level, so the orb reacts to the user's voice exactly as it does+#: in a conversation.+#: * ``dictate_transcribing`` is the thinking weather: the key is released, the+#: microphone feed has stopped, and a stale level must not keep the orb+#: shimmering as though it were still hearing something.+#: * ``notice`` — something the user asked for did not happen. Quiet and dim,+#: clearly awake but clearly not listening.+MOTIONS: dict[str, Motion] = {+ "idle": Motion(0.025, 0.008, 0.004, 0.14, 0.8, 0.86, 0.0),+ "listen": Motion(0.11, 0.035, 0.016, 0.72, 1.02, 0.98, 0.0),+ "think": Motion(0.42, -0.19, 0.009, 0.32, 1.28, 1.02, 0.0),+ "speak": Motion(0.34, 0.085, 0.016, 0.82, 1.02, 1.0, 0.045),+ "dictate": Motion(0.11, 0.035, 0.016, 0.72, 1.02, 0.98, 0.0),+ "dictate_transcribing": Motion(0.42, -0.19, 0.009, 0.32, 1.28, 1.02, 0.0),+ "notice": Motion(0.012, 0.0, 0.003, 0.12, 0.7, 0.72, 0.0),+}++#: Modes that react to the live microphone / output level. Everything else+#: ignores ``ext_level`` outright, so a stale sample cannot animate the orb+#: while nothing is being heard.+_LEVEL_REACTIVE = frozenset({"listen", "dictate"})++#: Floor under the dictation level: a quiet moment while recording must still+#: read as "I am listening", never as a dead orb.+_DICTATE_LEVEL_FLOOR = 0.18+++def _mix(a, b, amount):+ return a + (b - a) * amount+++def _clamp(value, lo=0.0, hi=1.0):+ return np.clip(value, lo, hi)+++def _smoothstep(edge0: float, edge1: float, value):+ position = np.clip((value - edge0) / (edge1 - edge0), 0.0, 1.0)+ return position * position * (3.0 - 2.0 * position)+++def _smoothstep_scalar(edge0: float, edge1: float, value: float) -> float:+ position = min(1.0, max(0.0, (value - edge0) / (edge1 - edge0)))+ return position * position * (3.0 - 2.0 * position)+++def speech_envelope(elapsed: float) -> float:+ """Irregular syllable-like movement without pretending it is measured audio."""+ cadence = 0.5 + 0.5 * math.sin(elapsed * math.pi * 5.4 + math.sin(elapsed * 1.7) * 0.8)+ articulation = 0.5 + 0.5 * math.sin(elapsed * math.pi * 9.2 + 1.3)+ return _smoothstep_scalar(0.38, 0.86, cadence * 0.74 + articulation * 0.26)+++def speaking_onset(age: float) -> float:+ """One soft outward beat when assistant speech begins."""+ if age < 0 or age >= 0.24:+ return 0.0+ return math.sin((age / 0.24) * math.pi) * math.exp(-age * 2.4)+++def _build_noise_grid() -> np.ndarray:+ """A stable tile of pseudo-random values (same LCG stream as the web orb)."""+ grid = np.empty(NOISE_SIZE * NOISE_SIZE, dtype=np.float64)+ seed = np.uint32(0x51F15E)+ mul = np.uint32(1_664_525)+ add = np.uint32(1_013_904_223)+ with np.errstate(over="ignore"):+ for index in range(grid.size):+ seed = np.uint32(seed * mul + add)+ grid[index] = float(seed) / float(0xFFFFFFFF)+ return grid.reshape(NOISE_SIZE, NOISE_SIZE)+++_NOISE_GRID = _build_noise_grid()+++def _grid_value(ix: np.ndarray, iy: np.ndarray) -> np.ndarray:+ return _NOISE_GRID[iy & (NOISE_SIZE - 1), ix & (NOISE_SIZE - 1)]+++def _noise_at(x: np.ndarray, y: np.ndarray) -> np.ndarray:+ left = np.floor(x)+ top = np.floor(y)+ tx = x - left+ ty = y - top+ sx = tx * tx * (3.0 - 2.0 * tx)+ sy = ty * ty * (3.0 - 2.0 * ty)+ li = left.astype(np.int64)+ ti = top.astype(np.int64)+ upper = _mix(_grid_value(li, ti), _grid_value(li + 1, ti), sx)+ lower = _mix(_grid_value(li, ti + 1), _grid_value(li + 1, ti + 1), sx)+ return _mix(upper, lower, sy)+++def _fractal_noise(x: np.ndarray, y: np.ndarray) -> np.ndarray:+ value = np.zeros_like(x)+ amplitude = 0.54+ normalizer = 0.0+ for _ in range(3):+ value += _noise_at(x, y) * amplitude+ normalizer += amplitude+ x = x * 2.03 + 11.7+ y = y * 2.01 - 7.9+ amplitude *= 0.5+ return value / normalizer+++class VoiceOrbRenderer:+ """Renders the procedural voice orb as a colour-keyed RGB frame.++ Implements the overlay's render seam — ``render(t, mode, ext_level) ->+ Image`` — so it drops into the same Tk surface the mascot uses and inherits+ its window: frameless, always on top, draggable to any monitor.+ """++ def __init__(+ self,+ *,+ size: int = 108,+ color_key: tuple[int, int, int] = (255, 0, 255),+ ) -> None:+ self._size = int(size)+ self._color_key = (int(color_key[0]), int(color_key[1]), int(color_key[2]))++ axis = (np.arange(TEXTURE_SIZE, dtype=np.float64) / (TEXTURE_SIZE - 1)) * 2.0 - 1.0+ self._ny, self._nx = np.meshgrid(axis, axis, indexing="ij")+ self._radius_field = np.sqrt(self._nx * self._nx + self._ny * self._ny)+ # Deterministic sub-LSB dither prevents broad 8-bit colour contours.+ xs, ys = np.meshgrid(+ np.arange(TEXTURE_SIZE), np.arange(TEXTURE_SIZE), indexing="xy"+ )+ self._dither = ((((xs * 73 + ys * 151) & 255) / 255.0) - 0.5) * 0.8++ self._live = MOTIONS["idle"].copy()+ self._active_mode = "idle"+ self._last_t: float | None = None+ self._phase_x = 0.0+ self._phase_y = 0.0+ self._breath_phase = 0.0+ self._activity_elapsed = 0.0+ self._speaking_age = math.inf+ self._live_impact = 0.0+ self._live_input = 0.0+ self._field_due_t = -math.inf+ self._texture: Image.Image | None = None+ self._masks: dict[int, Image.Image] = {}++ # -- public seam ---------------------------------------------------++ def render(self, t: float, mode: str, ext_level: float | None) -> Image.Image:+ motion = MOTIONS.get(mode) or MOTIONS["idle"]+ dt = 0.0 if self._last_t is None else min(0.1, max(0.0, t - self._last_t))+ self._last_t = t++ if mode != self._active_mode:+ self._active_mode = mode+ self._speaking_age = 0.0 if mode == "speak" else math.inf++ ease = 1.0 - math.exp(-dt * 3.2)+ live = self._live+ live.flow_x = _mix(live.flow_x, motion.flow_x, ease)+ live.flow_y = _mix(live.flow_y, motion.flow_y, ease)+ live.breath_amp = _mix(live.breath_amp, motion.breath_amp, ease)+ live.breath_hz = _mix(live.breath_hz, motion.breath_hz, ease)+ live.turbulence = _mix(live.turbulence, motion.turbulence, ease)+ live.energy = _mix(live.energy, motion.energy, ease)+ live.voice_impact = _mix(live.voice_impact, motion.voice_impact, ease)++ self._phase_x += dt * live.flow_x+ self._phase_y += dt * live.flow_y+ self._breath_phase += dt * live.breath_hz * math.pi * 2.0+ self._activity_elapsed += dt+ if math.isfinite(self._speaking_age):+ self._speaking_age += dt++ # The surface receives lifecycle modes on every platform but no reliable+ # normalized TTS output level, so speech choreography reacts to the+ # truthful speaking mode instead of masquerading as a measured waveform.+ speech = speech_envelope(self._activity_elapsed) if mode == "speak" else 0.0+ onset = speaking_onset(self._speaking_age) if mode == "speak" else 0.0+ impact_target = live.voice_impact * speech + 0.032 * onset+ impact_ease = 1.0 - math.exp(-dt * (22.0 if impact_target > self._live_impact else 8.0))+ self._live_impact = _mix(self._live_impact, impact_target, impact_ease)++ # A quick attack makes consonants feel immediate; the softer release+ # prevents a nervous flicker between syllables.+ input_target = self._input_level(mode, ext_level)+ input_ease = 1.0 - math.exp(-dt * (24.0 if input_target > self._live_input else 9.0))+ self._live_input = _mix(self._live_input, input_target, input_ease)+ visual_impact = self._live_impact + self._live_input * 0.055++ if t >= self._field_due_t or self._texture is None:+ self._texture = self._paint_weather(visual_impact)+ self._field_due_t = t + FIELD_INTERVAL_S++ breath = (+ 0.965+ - live.breath_amp * 0.65+ + live.breath_amp * 0.52 * math.sin(self._breath_phase)+ + live.breath_amp * 0.13 * math.sin(self._breath_phase * 2.05 + 1.4)+ + visual_impact+ )+ half = self._size / 2.0+ radius = (half - 1.0) * min(1.0, breath)+ return self._compose(self._texture, radius)++ # Compatibility no-ops: the overlay drives mascot-only expressions through+ # these. Answering them here (instead of leaving them to fail) keeps the+ # shared surface free of per-renderer special cases.+ def start_mouth_anim(self, duration_s: float, t_now: float) -> None:+ """The orb has no mouth — speaking is expressed by the field itself."""++ def stop_mouth_anim(self) -> None:+ """Counterpart to :meth:`start_mouth_anim`; nothing to stop."""++ # -- internals -----------------------------------------------------++ @staticmethod+ def _input_level(mode: str, ext_level: float | None) -> float:+ """The live level this mode is allowed to react to (0..1)."""+ if mode not in _LEVEL_REACTIVE:+ return 0.0+ level = 0.0 if ext_level is None else min(1.0, max(0.0, float(ext_level)))+ if mode == "dictate":+ return max(level, _DICTATE_LEVEL_FLOOR)+ return level++ def _paint_weather(self, impact: float) -> Image.Image:+ motion = self._live+ # Speech briefly compresses the material while the silhouette expands.+ sample_x = self._nx * (1.0 + impact * 0.055)+ sample_y = self._ny * (1.0 - impact * 0.035)++ warp_x = _fractal_noise(+ sample_x * 1.3 + self._phase_x + 8.2,+ sample_y * 1.22 + self._phase_y + 3.4,+ )+ warp_y = _fractal_noise(+ sample_x * 1.18 - self._phase_x * 0.55 + 19.7,+ sample_y * 1.35 + self._phase_y * 0.8 + 12.1,+ )+ cloud_field = _fractal_noise(+ sample_x * 1.85 + warp_x * motion.turbulence * 1.35 + self._phase_x,+ sample_y * 1.72 + warp_y * motion.turbulence * 1.2 + self._phase_y,+ )+ detail = _fractal_noise(+ sample_x * 3.15 - self._phase_x * 0.45 + 31.2,+ sample_y * 2.9 + self._phase_y * 0.35,+ )+ weather = cloud_field * 0.76 + detail * 0.24++ # Warping the vertical colour position removes the synthetic horizon band.+ vertical = _clamp((self._ny + 1.0) * 0.5 + (weather - 0.5) * 0.28)+ red, green, blue = self._palette(vertical)++ shadow = _smoothstep(0.48, 0.66, 1.0 - weather) * _smoothstep(0.28, 0.95, vertical) * 0.18+ red = _mix(red, DEEP_AMBER[0], shadow)+ green = _mix(green, DEEP_AMBER[1], shadow)+ blue = _mix(blue, DEEP_AMBER[2], shadow)++ # Large cream masses form the soft, irregular clouds.+ cloud = _smoothstep(0.46, 0.64, weather) * (1.0 - vertical * 0.32)+ cloud_mix = cloud * 0.78 * motion.energy+ red = _mix(red, CLOUD_LIGHT[0], cloud_mix)+ green = _mix(green, CLOUD_LIGHT[1], cloud_mix)+ blue = _mix(blue, CLOUD_LIGHT[2], cloud_mix)++ # A second, quieter field breaks up any remaining uniform areas.+ shimmer = _smoothstep(0.58, 0.76, warp_x * 0.55 + detail * 0.45)+ shimmer_mix = shimmer * 0.24 * motion.energy+ red = _mix(red, PALE_GOLD[0], shimmer_mix)+ green = _mix(green, PALE_GOLD[1], shimmer_mix)+ blue = _mix(blue, PALE_GOLD[2], shimmer_mix)++ # Restrained spherical shading, with no dark outline or glossy rim.+ edge_shade = _smoothstep(0.7, 1.0, self._radius_field) * 0.1+ volume_light = 1.02 + (1.0 - np.minimum(1.0, self._radius_field)) * 0.05 - edge_shade++ stacked = np.stack(+ (+ red * volume_light + self._dither,+ green * volume_light + self._dither,+ blue * volume_light + self._dither,+ ),+ axis=-1,+ )+ return Image.fromarray(np.clip(np.round(stacked), 0, 255).astype(np.uint8), "RGB")++ @staticmethod+ def _palette(vertical: np.ndarray):+ """Four-stop vertical ramp: ivory → pale gold → signal gold → amber → deep."""+ stops = (+ (0.0, 0.22, IVORY, PALE_GOLD),+ (0.22, 0.5, PALE_GOLD, SIGNAL_GOLD),+ (0.5, 0.76, SIGNAL_GOLD, AMBER),+ (0.76, 1.0, AMBER, DEEP_AMBER),+ )+ red = np.empty_like(vertical)+ green = np.empty_like(vertical)+ blue = np.empty_like(vertical)+ remaining = np.ones_like(vertical, dtype=bool)+ for lo, hi, start, end in stops:+ band = remaining & (vertical < hi) if hi < 1.0 else remaining+ if not band.any():+ continue+ amount = (vertical[band] - lo) / (hi - lo)+ red[band] = _mix(start[0], end[0], amount)+ green[band] = _mix(start[1], end[1], amount)+ blue[band] = _mix(start[2], end[2], amount)+ remaining &= ~band+ return red, green, blue++ def _circle_mask(self, diameter: int) -> Image.Image:+ """Binary disc mask, cached per diameter.++ Binary — never anti-aliased: a half-blended edge pixel would survive the+ colour key as a pink fringe around the orb (see the module docstring).+ """+ mask = self._masks.get(diameter)+ if mask is None:+ axis = np.arange(diameter, dtype=np.float64) - (diameter - 1) / 2.0+ yy, xx = np.meshgrid(axis, axis, indexing="ij")+ inside = (xx * xx + yy * yy) <= ((diameter / 2.0) ** 2)+ mask = Image.fromarray((inside * 255).astype(np.uint8), "L")+ self._masks[diameter] = mask+ return mask++ def _compose(self, texture: Image.Image, radius: float) -> Image.Image:+ diameter = max(2, int(round(radius * 2.0)))+ frame = Image.new("RGB", (self._size, self._size), self._color_key)+ scaled = texture.resize((diameter, diameter), Image.Resampling.BICUBIC)+ offset = (self._size - diameter) // 2+ frame.paste(scaled, (offset, offset), self._circle_mask(diameter))+ return frame