Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(onboarding): persist Terms acceptance from the risk gate + view full terms

Ruben Lütkec71c682c1bb7
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx
index aa2dc1f3a0..98f1dfb7f4 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx
@@ -45,6 +45,33 @@ it("fails open (renders nothing) on a fetch error", async () => {
await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull(), { timeout: 500 });
});
+it("persists terms acceptance when the risk gate is accepted", async () => {
+ const calls: Array<[string, RequestInit | undefined]> = [];
+ vi.stubGlobal(
+ "fetch",
+ vi.fn().mockImplementation((url: string, init?: RequestInit) => {
+ calls.push([url, init]);
+ return Promise.resolve({
+ ok: true,
+ json: () => Promise.resolve({ ...base, completed: false, ok: true }),
+ });
+ }),
+ );
+ render(<OnboardingGate />);
+ await waitFor(() => expect(screen.getByRole("dialog")).toBeDefined());
+
+ fireEvent.click(screen.getByRole("checkbox"));
+ fireEvent.click(screen.getByRole("button", { name: /continue/i }));
+
+ await waitFor(() =>
+ expect(
+ calls.some(
+ ([url, init]) => url === "/api/onboarding/accept-terms" && init?.method === "POST",
+ ),
+ ).toBe(true),
+ );
+});
+
it("shows the tutorial video after the risk gate, then the step flow", async () => {
stub({ ...base, completed: false });
render(<OnboardingGate />);
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx
index 364610c081..181cfd7b0c 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx
@@ -57,7 +57,15 @@ export function OnboardingGate() {
className="fixed inset-0 z-50 flex items-center justify-center bg-background/90 backdrop-blur-sm"
>
{!riskAck ? (
- <RiskGate onAccept={() => setRiskAck(true)} />
+ <RiskGate
+ onAccept={() => {
+ // Persist the Terms record (fail-open: a warming/erroring backend
+ // must never block the gate; the fast-boot path usually answers
+ // immediately). The ack itself stays local-state-only by design.
+ void onb.acceptTerms().catch(() => undefined);
+ setRiskAck(true);
+ }}
+ />
) : showVideo ? (
<IntroVideoScreen onContinue={() => setVideoSeen(true)} />
) : (
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/RiskGate.tsx b/jarvis/ui/web/frontend/src/components/onboarding/RiskGate.tsx
index f2d7cae11e..11ccd65565 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/RiskGate.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/RiskGate.tsx
@@ -12,6 +12,25 @@ import { useT } from "@/i18n";
export function RiskGate({ onAccept }: { onAccept: () => void }) {
const t = useT();
const [accepted, setAccepted] = useState(false);
+ // Full Terms text, fetched lazily on first expand — proceeding through this
+ // gate records the acceptance (see OnboardingGate), so the text must be
+ // reachable right here.
+ const [terms, setTerms] = useState<string | null>(null);
+ const [showTerms, setShowTerms] = useState(false);
+
+ const toggleTerms = async () => {
+ setShowTerms((v) => !v);
+ if (terms === null) {
+ try {
+ const res = await fetch("/api/onboarding/terms");
+ if (res.ok) setTerms(((await res.json()) as { text: string }).text);
+ else setTerms("");
+ } catch {
+ setTerms("");
+ }
+ }
+ };
+
return (
<div className="flex w-full max-w-lg flex-col gap-5 rounded-2xl border border-primary/40 bg-card p-8 shadow-2xl">
<div className="flex items-center gap-3">
@@ -23,6 +42,18 @@ export function RiskGate({ onAccept }: { onAccept: () => void }) {
<p className="text-sm font-semibold text-foreground">{t("onboarding.risk.lead")}</p>
<p className="text-sm leading-relaxed text-muted-foreground">{t("onboarding.risk.body")}</p>
<p className="text-sm leading-relaxed text-muted-foreground">{t("onboarding.risk.liability")}</p>
+ <button
+ type="button"
+ className="self-start text-xs text-muted-foreground underline"
+ onClick={() => void toggleTerms()}
+ >
+ {t("onboarding.risk.view_terms")}
+ </button>
+ {showTerms && (
+ <pre className="max-h-40 overflow-y-auto whitespace-pre-wrap rounded-md border border-border bg-muted/30 p-3 text-xs text-muted-foreground">
+ {terms ?? t("onboarding.risk.terms_loading")}
+ </pre>
+ )}
<label className="flex items-start gap-2 text-sm">
<input
type="checkbox"
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 55f660c000..4c4c62bba3 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -1459,7 +1459,9 @@
"body": "Sie kann deinen Computer steuern, Befehle ausführen, Apps öffnen, Nachrichten senden und Dateien in deinem Namen verändern — und sie kann Fehler machen. Sie kann ungewollte oder sogar zerstörerische Dinge tun.",
"liability": "Die Nutzung erfolgt vollständig auf eigenes Risiko. Die Entwickler übernehmen keine Haftung für Schäden, Datenverlust oder andere Folgen. Fahre nur fort, wenn du das verstehst und akzeptierst.",
"accept_label": "Ich verstehe die Risiken und akzeptiere, dass ich Personal Jarvis auf eigenes Risiko nutze.",
- "proceed": "Verstanden — fortfahren"
+ "proceed": "Verstanden — fortfahren",
+ "view_terms": "Vollständige Nutzungsbedingungen anzeigen",
+ "terms_loading": "Bedingungen werden geladen…"
},
"intro": {
"scene_1": "Triff deinen sprachgesteuerten Assistenten.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 8d59198803..6941e51be6 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -1460,7 +1460,9 @@
"body": "It can control your computer, run commands, open apps, send messages, and change files on your behalf — and it can make mistakes. It may do unintended or even destructive things.",
"liability": "You use it entirely at your own risk. The developers accept no liability for any damage, data loss, or other consequences. Only continue if you understand and accept this.",
"accept_label": "I understand the risks and accept that I use Personal Jarvis at my own risk.",
- "proceed": "I understand — continue"
+ "proceed": "I understand — continue",
+ "view_terms": "View the full Terms of Use",
+ "terms_loading": "Loading terms…"
},
"intro": {
"scene_1": "Meet your voice-first assistant.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 349680c77a..6118e3cf3b 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -1459,7 +1459,9 @@
"body": "Puede controlar tu ordenador, ejecutar comandos, abrir aplicaciones, enviar mensajes y modificar archivos en tu nombre, y puede cometer errores. Podría hacer cosas no deseadas o incluso destructivas.",
"liability": "Lo usas completamente bajo tu propia responsabilidad. Los desarrolladores no aceptan responsabilidad alguna por daños, pérdida de datos u otras consecuencias. Continúa solo si lo entiendes y lo aceptas.",
"accept_label": "Entiendo los riesgos y acepto que uso Personal Jarvis bajo mi propia responsabilidad.",
- "proceed": "Lo entiendo — continuar"
+ "proceed": "Lo entiendo — continuar",
+ "view_terms": "Ver los Términos de uso completos",
+ "terms_loading": "Cargando los términos…"
},
"intro": {
"scene_1": "Te presentamos a tu asistente de voz.",