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.

fix(ui): artifact pages run their scripts again, the Autopilot Toasts switch does something, and every settings switch has a name

rubenluetke10-beep6f27d5cf5bcf
diff --git a/jarvis/ui/web/frontend/src/components/outputs/ArtifactViewer.test.tsx b/jarvis/ui/web/frontend/src/components/outputs/ArtifactViewer.test.tsx
index 19fadff8ea..b7ae928ab0 100644
--- a/jarvis/ui/web/frontend/src/components/outputs/ArtifactViewer.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/outputs/ArtifactViewer.test.tsx
@@ -134,6 +134,44 @@ describe("ArtifactViewer", () => {
});
});
+const HTML_PATH = "tasks/t1/artifacts/files/dash.html";
+const HTML_FILE: ArtifactSummary = {
+ path: HTML_PATH,
+ size: 64,
+ mtime: 3,
+ is_text: true,
+ preview: "<script>run()</script>",
+};
+
+function installHeadProbeMock(headStatus: number) {
+ const base = installFetchMock({});
+ const fetchMock = vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {
+ if (init?.method === "HEAD") {
+ return { ok: headStatus >= 200 && headStatus < 300, status: headStatus };
+ }
+ return base(input);
+ });
+ vi.stubGlobal("fetch", fetchMock);
+ return fetchMock;
+}
+
+describe("ArtifactViewer HTML page probe", () => {
+ it("frames the sandboxed /page when the backend answers HEAD with 405 (route present)", async () => {
+ installHeadProbeMock(405);
+ renderViewer([HTML_FILE]);
+ const frame = await waitFor(() => screen.getByTitle("dash.html") as HTMLIFrameElement);
+ expect(frame.getAttribute("src")).toContain("/page");
+ expect(frame.getAttribute("sandbox")).toBe("allow-scripts");
+ });
+
+ it("falls back to the no-script inline download when the route is missing (404)", async () => {
+ installHeadProbeMock(404);
+ renderViewer([HTML_FILE]);
+ const frame = await waitFor(() => screen.getByTitle("dash.html") as HTMLIFrameElement);
+ expect(frame.getAttribute("src")).toContain("/download?disposition=inline");
+ });
+});
+
describe("resolveSiblingPath", () => {
it("resolves relative links inside the archive and rejects escapes", () => {
expect(resolveSiblingPath("tasks/t/artifacts/files/report.md", "chart.png")).toBe(
diff --git a/jarvis/ui/web/frontend/src/components/outputs/ArtifactViewer.tsx b/jarvis/ui/web/frontend/src/components/outputs/ArtifactViewer.tsx
index 3308adcf6f..681893c207 100644
--- a/jarvis/ui/web/frontend/src/components/outputs/ArtifactViewer.tsx
+++ b/jarvis/ui/web/frontend/src/components/outputs/ArtifactViewer.tsx
@@ -609,7 +609,10 @@ function HtmlPage({ slug, path }: { slug: string; path: string }) {
queryFn: async () => {
try {
const r = await fetch(pageUrl, { method: "HEAD" });
- return r.ok;
+ // 405 is a backend that HAS the route but predates HEAD support on it
+ // (FastAPI registers GET alone): the page is served, so frame it. Only
+ // a 404 — no route at all — earns the no-script inline fallback.
+ return r.ok || r.status === 405;
} catch {
return false;
}
diff --git a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts b/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts
index 86ef1220cd..83f73cc4fb 100644
--- a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts
@@ -2,6 +2,7 @@ import { useEffect, useRef } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { WSClient } from "@/lib/ws";
+import { isAutopilotToastsEnabled } from "@/lib/autopilotToasts";
import {
deliverDictationText,
documentOwnsDictation,
@@ -406,7 +407,8 @@ export function useWebSocket(): void {
// would blank the very view the user split off to keep.
setActiveSection(section);
}
- if (!solo) {
+ // The Settings "Autopilot Toasts" switch owns this note.
+ if (!solo && isAutopilotToastsEnabled()) {
pushToast(
"info",
`${translate("use_web_socket.jarvis_opened")} ${SECTION_LABELS[section]}`,
diff --git a/jarvis/ui/web/frontend/src/lib/autopilotToasts.test.ts b/jarvis/ui/web/frontend/src/lib/autopilotToasts.test.ts
new file mode 100644
index 0000000000..8500f0d2bd
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/autopilotToasts.test.ts
@@ -0,0 +1,39 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+import {
+ isAutopilotToastsEnabled,
+ onAutopilotToastsChange,
+ setAutopilotToastsEnabled,
+} from "@/lib/autopilotToasts";
+
+describe("autopilotToasts preference", () => {
+ beforeEach(() => {
+ window.localStorage.clear();
+ });
+
+ it("defaults to on and persists off across reads", () => {
+ expect(isAutopilotToastsEnabled()).toBe(true);
+ setAutopilotToastsEnabled(false);
+ expect(isAutopilotToastsEnabled()).toBe(false);
+ setAutopilotToastsEnabled(true);
+ expect(isAutopilotToastsEnabled()).toBe(true);
+ });
+
+ it("notifies listeners in this window when the preference changes", () => {
+ const listener = vi.fn();
+ const off = onAutopilotToastsChange(listener);
+ setAutopilotToastsEnabled(false);
+ expect(listener).toHaveBeenCalledTimes(1);
+ off();
+ setAutopilotToastsEnabled(true);
+ expect(listener).toHaveBeenCalledTimes(1);
+ });
+
+ it("falls back to the default when storage is blocked", () => {
+ const spy = vi.spyOn(Storage.prototype, "getItem").mockImplementation(() => {
+ throw new Error("blocked");
+ });
+ expect(isAutopilotToastsEnabled()).toBe(true);
+ spy.mockRestore();
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/lib/autopilotToasts.ts b/jarvis/ui/web/frontend/src/lib/autopilotToasts.ts
new file mode 100644
index 0000000000..e9099c054e
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/autopilotToasts.ts
@@ -0,0 +1,37 @@
+/**
+ * "Autopilot toasts" — the "{name} opened X" note that appears when a spoken
+ * command drives the sidebar (the `NavigateSidebar` event in useWebSocket).
+ *
+ * A per-browser preference, not a backend setting: it only decides whether
+ * THIS window shows a note about something that already happened, so nothing
+ * on the server needs to know. Default ON — the note is the only feedback a
+ * user gets that "go to settings" was heard when they are not looking at the
+ * sidebar. Storage failures (private mode, blocked site data) fall back to
+ * the default silently; a missing preference must never break navigation.
+ */
+const STORAGE_KEY = "ui.autopilotToasts.v1";
+const CHANGE_EVENT = "autopilot-toasts-changed";
+
+export function isAutopilotToastsEnabled(): boolean {
+ try {
+ return window.localStorage.getItem(STORAGE_KEY) !== "off";
+ } catch {
+ return true;
+ }
+}
+
+export function setAutopilotToastsEnabled(enabled: boolean): void {
+ try {
+ if (enabled) window.localStorage.removeItem(STORAGE_KEY);
+ else window.localStorage.setItem(STORAGE_KEY, "off");
+ } catch {
+ /* storage blocked — the switch still reflects the choice for this render */
+ }
+ window.dispatchEvent(new Event(CHANGE_EVENT));
+}
+
+/** Subscribe to changes made in another component of this window. */
+export function onAutopilotToastsChange(listener: () => void): () => void {
+ window.addEventListener(CHANGE_EVENT, listener);
+ return () => window.removeEventListener(CHANGE_EVENT, listener);
+}
diff --git a/jarvis/ui/web/frontend/src/views/SettingsView.tsx b/jarvis/ui/web/frontend/src/views/SettingsView.tsx
index 75be109a24..74c70eaa18 100644
--- a/jarvis/ui/web/frontend/src/views/SettingsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/SettingsView.tsx
@@ -33,6 +33,7 @@ import { deriveAssistantName } from "@/lib/deriveAssistantName";
import { WAKE_ENGINES, WAKE_ENGINE_I18N_KEY } from "@/constants/wakeEngines";
import { useEventStore } from "@/store/events";
import { useT } from "@/i18n";
+import { isAutopilotToastsEnabled, setAutopilotToastsEnabled } from "@/lib/autopilotToasts";
// The wake-word language pin — its OWN setting ([trigger.wake_word] language),
// deliberately independent of both the app display language and the general
@@ -71,13 +72,25 @@ interface SettingRow {
export function SettingsView() {
const t = useT();
+ // The "{name} opened X" note after a spoken navigation. This switch used to
+ // be `<Switch defaultChecked />` with no handler — it toggled nothing.
+ const [autopilotToasts, setAutopilotToasts] = useState(isAutopilotToastsEnabled);
const rows: SettingRow[] = [
{
icon: Settings,
title: t("settings_view.rows.toasts_title"),
description: t("settings_view.rows.toasts_description"),
- control: <Switch defaultChecked />,
+ control: (
+ <Switch
+ checked={autopilotToasts}
+ aria-label={t("settings_view.rows.toasts_title")}
+ onCheckedChange={(next) => {
+ setAutopilotToasts(next);
+ setAutopilotToastsEnabled(next);
+ }}
+ />
+ ),
},
];
@@ -421,6 +434,7 @@ function WakeWordPanel() {
<Switch
checked={enabled}
disabled={loading || togglingActivation}
+ aria-label={t("settings_view.wake_word.activation_title")}
onCheckedChange={onToggleActivation}
/>
</div>
diff --git a/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx
index 1ad925bc45..ca770932f3 100644
--- a/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx
@@ -182,6 +182,7 @@ function AutostartRow() {
<Switch
checked={enabled}
disabled={loading || saving || !supported}
+ aria-label={t("settings_view.autostart.title")}
onCheckedChange={onToggle}
/>
</div>
diff --git a/jarvis/ui/web/frontend/src/views/settings/JarvisApiGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/JarvisApiGroup.tsx
index d58ff0ccf3..f793a121e7 100644
--- a/jarvis/ui/web/frontend/src/views/settings/JarvisApiGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/JarvisApiGroup.tsx
@@ -212,6 +212,7 @@ export function JarvisApiGroup() {
<Switch
checked={browserLock.enabled ?? false}
disabled={browserLock.loading || lockBusy}
+ aria-label={t("settings_view.jarvis_api.browser_lock_title")}
onCheckedChange={onToggleBrowserLock}
/>
</div>
diff --git a/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx
index e56709ccfb..737a45acdd 100644
--- a/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx
@@ -81,7 +81,12 @@ function ToggleRow({
<div className="font-medium">{title}</div>
<p className="mt-0.5 text-xs text-muted-foreground">{description}</p>
</div>
- <Switch checked={checked} disabled={disabled} onCheckedChange={onToggle} />
+ <Switch
+ checked={checked}
+ disabled={disabled}
+ aria-label={title}
+ onCheckedChange={onToggle}
+ />
</div>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/RealtimeVoiceGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/RealtimeVoiceGroup.tsx
index aa3f6e3d8f..aa2cc76327 100644
--- a/jarvis/ui/web/frontend/src/views/settings/RealtimeVoiceGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/RealtimeVoiceGroup.tsx
@@ -73,6 +73,7 @@ export function RealtimeVoiceGroup() {
<Switch
checked={on}
disabled={isLoading || isSaving || (!on && !realtimeAvailable)}
+ aria-label={t("settings_view.realtime_voice.title")}
onCheckedChange={(next) => setMode(next ? "realtime" : "pipeline")}
/>
</div>
diff --git a/jarvis/ui/web/frontend/src/views/settings/ScreenContextGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/ScreenContextGroup.tsx
index 0c826548a1..e83d56099a 100644
--- a/jarvis/ui/web/frontend/src/views/settings/ScreenContextGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/ScreenContextGroup.tsx
@@ -118,6 +118,7 @@ export function ScreenContextGroup() {
<Switch
checked={settings.enabled}
disabled={saving}
+ aria-label={t("settings_view.screen_context.title")}
onCheckedChange={(enabled) => void toggle(enabled)}
/>
)}
diff --git a/jarvis/ui/web/outputs_routes.py b/jarvis/ui/web/outputs_routes.py
index 6ae60bc9a7..743e11243b 100644
--- a/jarvis/ui/web/outputs_routes.py
+++ b/jarvis/ui/web/outputs_routes.py
@@ -1070,7 +1070,12 @@ async def download_output_artifact(
)
[email protected]("/{slug}/files/{path:path}/page")
+# GET and HEAD: the Artifacts section probes this route with a HEAD request
+# before framing the page (an older backend without the route falls back to the
+# no-script inline download). FastAPI registers only GET for ``@router.get``, so
+# the probe used to answer 405 on every backend and the fallback ALWAYS won —
+# the page's own scripts never ran. FileResponse sends headers only for HEAD.
[email protected]_route("/{slug}/files/{path:path}/page", methods=["GET", "HEAD"])
async def serve_artifact_page(slug: str, path: str, request: Request) -> FileResponse:
"""Serve an HTML deliverable as an ARTIFACT PAGE — scripts allowed, network shut.
diff --git a/tests/unit/ui/web/test_outputs_routes.py b/tests/unit/ui/web/test_outputs_routes.py
index b2fcaeb51c..b7526d4d5e 100644
--- a/tests/unit/ui/web/test_outputs_routes.py
+++ b/tests/unit/ui/web/test_outputs_routes.py
@@ -1350,6 +1350,21 @@ def test_artifact_page_allows_inline_scripts_but_no_network(app):
assert "document.title" in r.text
+def test_artifact_page_answers_head_probe(app):
+ """The frontend probes ``/page`` with HEAD before framing it. A 405 here
+ made the probe fail on every backend, so the sandboxed page never got its
+ scripts. HEAD must answer like GET — same status and headers, no body."""
+ root = Path(app.state.outputs_root)
+ slug = "mission_019ed2dfd0fab"
+ rel = _make_deliverable(root, "019ed2dfd0fab1234", "probe.html", "<b>probe</b>")
+ client = TestClient(app)
+ r = client.head(f"/api/outputs/{slug}/files/{rel}/page")
+ assert r.status_code == 200
+ assert r.headers["content-type"].startswith("text/html")
+ assert "script-src 'unsafe-inline'" in r.headers.get("content-security-policy", "")
+ assert r.content == b""
+
+
def test_artifact_page_refuses_non_html(app):
root = Path(app.state.outputs_root)
slug = "mission_019ed2dfd0fab"