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): an on/off switch for the desktop pet on the My Pets page
rubenluetke10-beep6795d776e986
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex c877b3b0ff..4e6e9b125d 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -5812,6 +5812,8 @@"style_notice_body": "Dein Anzeige-Stil ist „{0}“. Wechsle zum Pet, um es auf deinem Desktop zu sehen. Das Pet, das du unten auswählst, bleibt so oder so gespeichert.","use_pet": "Pet auf dem Desktop nutzen","style_saved": "Das Pet ist jetzt auf deinem Desktop.",+ "enabled_label": "Pet auf dem Desktop",+ "style_off_saved": "Das Pet ist aus. Die Jarvis-Leiste ist wieder auf deinem Desktop.","restart_hint": "Gespeichert. Starte {name} neu, damit das Pet auf deinem Desktop erscheint.","load_error": "Deine Pets konnten nicht geladen werden: {0}","save_error": "Das wurde nicht gespeichert: {0}",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 3316e6458e..09557ebf77 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -5845,6 +5845,8 @@"style_notice_body": "Your display style is “{0}”. Switch to the pet to see it on your desktop. The pet you pick below is kept either way.","use_pet": "Use pet on desktop","style_saved": "The pet is now on your desktop.",+ "enabled_label": "Pet on desktop",+ "style_off_saved": "The pet is off. The Jarvis bar is back on your desktop.","restart_hint": "Saved. Restart {name} to bring the pet to your desktop.","load_error": "Your pets could not be loaded: {0}","save_error": "That did not save: {0}",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 2eb92c40f2..6b02de9c64 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -5812,6 +5812,8 @@"style_notice_body": "Tu estilo de visualización es «{0}». Cambia a la mascota para verla en tu escritorio. La mascota que elijas abajo se guarda de todos modos.","use_pet": "Usar mascota en el escritorio","style_saved": "La mascota ya está en tu escritorio.",+ "enabled_label": "Mascota en el escritorio",+ "style_off_saved": "La mascota está apagada. La barra de Jarvis vuelve a tu escritorio.","restart_hint": "Guardado. Reinicia {name} para ver la mascota en tu escritorio.","load_error": "No se pudieron cargar tus mascotas: {0}","save_error": "No se pudo guardar: {0}",diff --git a/jarvis/ui/web/frontend/src/views/PetsView.test.tsx b/jarvis/ui/web/frontend/src/views/PetsView.test.tsxindex 415a0b43e0..5d98822f33 100644--- a/jarvis/ui/web/frontend/src/views/PetsView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/PetsView.test.tsx@@ -201,6 +201,43 @@ describe("PetsView", () => {expect(screen.queryByTestId("pets-style-notice")).toBeNull();});+ it("turns the pet off from the header switch and keeps the chosen pet", async () => {+ const { calls } = stubServer();+ renderView();++ const toggle = await screen.findByTestId("pets-enabled");+ await waitFor(() => expect(toggle.getAttribute("aria-checked")).toBe("true"));+ fireEvent.click(toggle);++ await waitFor(() =>+ expect(calls).toContainEqual({+ method: "PUT",+ url: "/api/settings/overlay-style",+ body: { style: "jarvis_bar", persist: true },+ }),+ );+ expect(calls.some((call) => call.url === "/api/pets/active")).toBe(false);+ });++ it("turns the pet on from the header switch", async () => {+ const { calls } = stubServer({ style: "jarvis_bar" });+ renderView();++ const toggle = await screen.findByTestId("pets-enabled");+ await waitFor(() => expect((toggle as HTMLButtonElement).disabled).toBe(false));+ expect(toggle.getAttribute("aria-checked")).toBe("false");+ expect(screen.queryByTestId("pets-visibility")).toBeNull();+ fireEvent.click(toggle);++ await waitFor(() =>+ expect(calls).toContainEqual({+ method: "PUT",+ url: "/api/settings/overlay-style",+ body: { style: "pet", persist: true },+ }),+ );+ });+it("shows no style notice while the pet is already the display style", async () => {stubServer();renderView();diff --git a/jarvis/ui/web/frontend/src/views/PetsView.tsx b/jarvis/ui/web/frontend/src/views/PetsView.tsxindex 4d9aa0ff16..0be979aa10 100644--- a/jarvis/ui/web/frontend/src/views/PetsView.tsx+++ b/jarvis/ui/web/frontend/src/views/PetsView.tsx@@ -104,12 +104,17 @@ export function PetsView() {return localized !== key ? localized : pet.description;};- async function switchToPetStyle() {+ /**+ * The master switch: ON makes the pet the desktop overlay style, OFF hands+ * the desktop back to the default Jarvis bar. The chosen pet is kept either+ * way, so switching back on brings the same pet back.+ */+ async function setPetEnabled(enabled: boolean) {setSwitchingStyle(true);try {- const result = await overlay.saveStyle("pet");+ const result = await overlay.saveStyle(enabled ? "pet" : "jarvis_bar");if (result.applied_live) {- pushToast("success", t("pets.style_saved"));+ pushToast("success", t(enabled ? "pets.style_saved" : "pets.style_off_saved"));} else {setNeedsRestart(true);}@@ -162,17 +167,31 @@ export function PetsView() {: t("pets.subtitle_no_shortcut")}actions={- <Button- type="button"- variant="outline"- size="sm"- data-testid="pets-visibility"- disabled={!data || !styleIsPet || setVisible.isPending}- onClick={toggleVisible}- >- {data?.visible === false ? <Eye aria-hidden /> : <EyeOff aria-hidden />}- {data?.visible === false ? t("pets.show") : t("pets.hide")}- </Button>+ <div className="flex items-center gap-3">+ {styleIsPet && (+ <Button+ type="button"+ variant="outline"+ size="sm"+ data-testid="pets-visibility"+ disabled={!data || setVisible.isPending}+ onClick={toggleVisible}+ >+ {data?.visible === false ? <Eye aria-hidden /> : <EyeOff aria-hidden />}+ {data?.visible === false ? t("pets.show") : t("pets.hide")}+ </Button>+ )}+ <label className="flex items-center gap-2.5 rounded-lg border border-border bg-card px-3 py-1.5">+ <span className="text-sm font-medium text-foreground">{t("pets.enabled_label")}</span>+ <Switch+ data-testid="pets-enabled"+ checked={styleIsPet}+ disabled={!overlay.config || switchingStyle}+ aria-label={t("pets.enabled_label")}+ onCheckedChange={(next) => void setPetEnabled(next)}+ />+ </label>+ </div>}/>@@ -197,7 +216,7 @@ export function PetsView() {type="button"data-testid="pets-use-pet"disabled={switchingStyle}- onClick={() => void switchToPetStyle()}+ onClick={() => void setPetEnabled(true)}>{switchingStyle && <Loader2 className="animate-spin" aria-hidden />}{t("pets.use_pet")}