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(onboarding): autostart toggle on the finish step (capability-gated)
Ruben Lütke5d45c0198310
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.test.tsxindex c447a5e783..a69615f029 100644--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.test.tsx+++ b/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.test.tsx@@ -1,8 +1,23 @@-import { cleanup, fireEvent, render, screen } from "@testing-library/react";-import { afterEach, expect, it, vi } from "vitest";+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { afterEach, beforeEach, expect, it, vi } from "vitest";vi.mock("@/i18n", () => ({ useT: () => (k: string) => k }));import { FinishStep } from "./FinishStep";-afterEach(cleanup);++// Default stub: capability probe answers "unsupported" so the legacy tests+// exercise the step without the autostart toggle.+beforeEach(() => {+ vi.stubGlobal(+ "fetch",+ vi.fn().mockResolvedValue({+ ok: true,+ json: () => Promise.resolve({ enabled: false, supported: false }),+ }),+ );+});+afterEach(() => {+ cleanup();+ vi.restoreAllMocks();+});it("calls goNext (= complete) on the start CTA", () => {const goNext = vi.fn();@@ -16,3 +31,55 @@ it("lists skipped steps", () => {expect(screen.getByText("api-keys")).toBeDefined();expect(screen.getByText("mic-test")).toBeDefined();});++const stepProps = {+ onb: { state: { skipped_steps: [] } } as never,+ goNext: vi.fn(),+ goBack: vi.fn(),+ skip: vi.fn(),+ isFirst: false,+ isLast: true,+};++it("shows the autostart toggle when supported and PUTs on change", async () => {+ const calls: Array<[string, RequestInit | undefined]> = [];+ vi.stubGlobal(+ "fetch",+ vi.fn().mockImplementation((url: string, init?: RequestInit) => {+ calls.push([url, init]);+ if (init?.method === "PUT") {+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ ok: true }) });+ }+ return Promise.resolve({+ ok: true,+ json: () => Promise.resolve({ enabled: true, supported: true }),+ });+ }),+ );+ render(<FinishStep {...stepProps} />);+ const toggle = (await screen.findByRole("checkbox")) as HTMLInputElement;+ expect(toggle.checked).toBe(true);++ fireEvent.click(toggle);+ await waitFor(() =>+ expect(+ calls.some(+ ([url, init]) =>+ url === "/api/settings/autostart" &&+ init?.method === "PUT" &&+ JSON.parse(init.body as string).enabled === false,+ ),+ ).toBe(true),+ );+});++it("hides the toggle when autostart is unsupported (headless)", async () => {+ render(<FinishStep {...stepProps} />);+ await waitFor(() => expect(screen.queryByRole("checkbox")).toBeNull());+});++it("hides the toggle when the capability probe fails (fail quiet)", async () => {+ vi.stubGlobal("fetch", vi.fn().mockRejectedValue(new Error("net")));+ render(<FinishStep {...stepProps} />);+ await waitFor(() => expect(screen.queryByRole("checkbox")).toBeNull());+});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.tsxindex a1d72bb63f..ac96cd9ab7 100644--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.tsx+++ b/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.tsx@@ -1,10 +1,47 @@+import { useEffect, useState } from "react";import { Button } from "@/components/ui/button";import { useT } from "@/i18n";import type { StepProps } from "../OnboardingFlow";+interface AutostartState {+ enabled: boolean;+ supported: boolean;+}+export function FinishStep({ onb, goNext }: StepProps) {const t = useT();const skipped = onb.state?.skipped_steps ?? [];++ // "Start Jarvis at login" toggle (formerly a terminal-wizard question).+ // Capability-gated: hidden on hosts where autostart is unsupported+ // (headless Linux) or when the probe fails — Settings stays the recovery+ // path either way.+ const [autostart, setAutostart] = useState<AutostartState | null>(null);++ useEffect(() => {+ void (async () => {+ try {+ const res = await fetch("/api/settings/autostart");+ if (res.ok) setAutostart((await res.json()) as AutostartState);+ } catch {+ // capability probe is best-effort — hide the toggle on failure+ }+ })();+ }, []);++ const toggleAutostart = async (enabled: boolean) => {+ setAutostart((s) => (s ? { ...s, enabled } : s));+ try {+ await fetch("/api/settings/autostart", {+ method: "PUT",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ enabled }),+ });+ } catch {+ // keep the optimistic value; the Settings view remains the recovery path+ }+ };+return (<div className="flex flex-col gap-4 text-center"><h2 className="font-display text-xl font-semibold">{t("onboarding.finish.title")}</h2>@@ -19,6 +56,16 @@ export function FinishStep({ onb, goNext }: StepProps) {</ul></div>)}+ {autostart?.supported && (+ <label className="flex items-center justify-between gap-2 rounded-lg border border-border px-3 py-2 text-left text-sm">+ <span>{t("onboarding.finish.autostart_label")}</span>+ <input+ type="checkbox"+ checked={autostart.enabled}+ onChange={(e) => void toggleAutostart(e.target.checked)}+ />+ </label>+ )}<div className="flex items-start gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2 text-left text-xs text-muted-foreground"><span aria-hidden className="mt-px text-primary">⏱</span><span>{t("onboarding.finish.boot_notice")}</span>diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 4c4c62bba3..de770e1d67 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -1542,7 +1542,8 @@"body": "Dein Assistent ist startklar. Sag dein Aktivierungswort oder tippe einen Befehl, um zu beginnen.","skipped_title": "Du hast übersprungen — jederzeit in den Einstellungen nachholbar:","start_cta": "Loslegen",- "boot_notice": "Hinweis: Der erste Start dauert etwa 10 Sekunden, während dein Assistent hochfährt — das ist völlig normal."+ "boot_notice": "Hinweis: Der erste Start dauert etwa 10 Sekunden, während dein Assistent hochfährt — das ist völlig normal.",+ "autostart_label": "Jarvis beim Anmelden automatisch starten"}},"languages_view": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 6941e51be6..f32155514d 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -1543,7 +1543,8 @@"body": "Your assistant is ready. Try saying your wake word, or type a command to begin.","skipped_title": "You skipped — set up anytime in Settings:","start_cta": "Get started",- "boot_notice": "Heads up: the first launch takes about 10 seconds while your assistant warms up — that's completely normal."+ "boot_notice": "Heads up: the first launch takes about 10 seconds while your assistant warms up — that's completely normal.",+ "autostart_label": "Start Jarvis automatically at login"}},"languages_view": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 6118e3cf3b..aa1843154f 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -1542,7 +1542,8 @@"body": "Tu asistente está listo. Di tu palabra de activación o escribe un comando para empezar.","skipped_title": "Omitiste — configúralo cuando quieras en Ajustes:","start_cta": "Empezar",- "boot_notice": "Nota: el primer inicio tarda unos 10 segundos mientras tu asistente se inicia — es completamente normal."+ "boot_notice": "Nota: el primer inicio tarda unos 10 segundos mientras tu asistente se inicia — es completamente normal.",+ "autostart_label": "Iniciar Jarvis automáticamente al iniciar sesión"}},"languages_view": {