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(ui): route dictation to the right surface and localize the new copy
Ruben Lütkef6ceed890db8
diff --git a/jarvis/ui/web/frontend/src/App.tsx b/jarvis/ui/web/frontend/src/App.tsxindex 5e723c3874..aaada94f09 100644--- a/jarvis/ui/web/frontend/src/App.tsx+++ b/jarvis/ui/web/frontend/src/App.tsx@@ -1,3 +1,5 @@+import { useEffect } from "react";+import { useWebSocket } from "@/hooks/useWebSocket";import { useBrainStatus } from "@/hooks/useBrainStatus";import { useVoiceStatus } from "@/hooks/useVoiceStatus";@@ -20,6 +22,7 @@ import { EditContextMenu } from "@/components/EditContextMenu";import { JarvisDock } from "@/components/JarvisDock";import { CliConnectPoller } from "@/components/CliConnectPoller";import { OnboardingGate } from "@/components/onboarding/OnboardingGate";+import { installDictationFocusTracker } from "@/lib/dictationTarget";export default function App() {useWebSocket();@@ -28,6 +31,18 @@ export default function App() {useAssistantNameSeed();useCodingMode();+ /*+ * Remember which field the user is typing in, app-wide.+ *+ * A dictation into Jarvis's own window is delivered inside the page rather+ * than by synthetic keystrokes, and the target is decided when the transcript+ * arrives — by which time a dictation started from a button has already moved+ * focus onto that button. Tracking focus here is what lets the text still+ * land where the caret was. Mounted at the shell so it spans every section,+ * including the terminals of the Agentic IDE.+ */+ useEffect(() => installDictationFocusTracker(), []);+/** The sidebar is draggable, app-wide.*diff --git a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts b/jarvis/ui/web/frontend/src/hooks/useWebSocket.tsindex 79efa95e48..6f9823d2d3 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 { deliverDictationText, isForThisWindow } from "@/lib/dictationTarget";import {SECTION_LABELS,isSectionId,@@ -215,16 +216,44 @@ export function useWebSocket(): void {}if (env.event_name === "DictationTranscript") {- // Chat mic-dictation — transcribe-only. Interim partials overwrite the- // live tail; the final one is committed (appended to the chat input).- // Separate from TranscriptionUpdate so live-voice transcripts never- // leak into the text box. Uses getState() to stay out of the deps array.- const p = env.payload as { text?: string; is_final?: boolean };+ // In-app dictation. Interim partials overwrite the live tail; the+ // final one is delivered. Separate from TranscriptionUpdate so+ // live-voice transcripts never leak into a text box. Uses getState()+ // to stay out of the deps array.+ const p = env.payload as {+ text?: string;+ is_final?: boolean;+ target?: string;+ };const text = typeof p.text === "string" ? p.text : "";- if (p.is_final) {- useEventStore.getState().commitDictation(text);- } else {+ if (!p.is_final) {useEventStore.getState().setDictationInterim(text);+ } else {+ const store = useEventStore.getState();+ const forThisWindow = isForThisWindow(p, store.dictating);+ const delivered = forThisWindow+ ? deliverDictationText(text)+ : "none";+ if (delivered !== "none") {+ // Straight into the field or terminal, so no sequence bump for+ // the composer — just drop the live tail.+ store.setDictationInterim("");+ } else {+ // The composer is the historical sink and still the right+ // fallback. It only exists on the Chats section, though, and+ // handing a transcript to a component that is not there is+ // exactly how a dictation used to vanish without a word (see+ // lib/dictationTarget.ts). So when the words were meant for this+ // window and nothing at all could take them, say so rather than+ // reporting a delivery that did not happen.+ store.commitDictation(text);+ if (+ forThisWindow &&+ !document.querySelector("[data-jarvis-chat-input]")+ ) {+ pushToast("info", translate("use_web_socket.dictation_nowhere"));+ }+ }}}diff --git a/jarvis/ui/web/frontend/src/i18n/index.ts b/jarvis/ui/web/frontend/src/i18n/index.tsindex 029f40897e..15419d7eee 100644--- a/jarvis/ui/web/frontend/src/i18n/index.ts+++ b/jarvis/ui/web/frontend/src/i18n/index.ts@@ -28,16 +28,23 @@ export type UiLanguage = "en" | "de" | "es";// "auto" mirrors the user's input language; the rest hard-pin the reply language.// Mirrors jarvis/brain/manager.py::SUPPORTED_REPLY_LANGUAGES (single source of truth).export type ReplyLanguage = "auto" | "en" | "de" | "es";-// "auto" lets Whisper detect the spoken language per utterance (bilingual-// default); a concrete code forces what the recogniser transcribes into.-// Mirrors jarvis/ui/web/settings_routes.py::_STT_LANGUAGES.-export type SttLanguage = "auto" | "en" | "de" | "es";+// "auto" lets the recogniser detect the spoken language per utterance (the+// default); a concrete code forces what it transcribes into. Deliberately a+// plain string, not a union: the accepted set is every language the recogniser+// understands (jarvis/core/config.py::RECOGNITION_LANGUAGE_CHOICES) and the+// backend ships it with the GET response, so a hand-mirrored union here would be+// the classic drift trap (AP-4) — and a short one would silently reject a+// perfectly valid language the backend accepts.+export type SttLanguage = string;++// The choices shown until the backend's list arrives. Kept tiny on purpose: it+// is a placeholder for one render, not a second source of truth.+const STT_FALLBACK_OPTIONS: readonly string[] = ["auto"];const REPLY_LANGUAGE_ENDPOINT = "/api/settings/reply-language";const UI_LANGUAGE_ENDPOINT = "/api/settings/ui-language";const STT_LANGUAGE_ENDPOINT = "/api/settings/stt-language";const REPLY_VALUES: readonly ReplyLanguage[] = ["auto", "en", "de", "es"];-const STT_VALUES: readonly SttLanguage[] = ["auto", "en", "de", "es"];function isUiLanguage(v: unknown): v is UiLanguage {return v === "en" || v === "de" || v === "es";@@ -47,8 +54,12 @@ function isReplyLanguage(v: unknown): v is ReplyLanguage {return typeof v === "string" && (REPLY_VALUES as readonly string[]).includes(v);}+// A shape check, not a membership check: the authoritative set lives on the+// backend and is fetched, so anything that looks like a language code is kept.+const STT_CODE_RE = /^[a-z]{2,3}(-[a-z0-9]{2,8})*$/i;+function isSttLanguage(v: unknown): v is SttLanguage {- return typeof v === "string" && (STT_VALUES as readonly string[]).includes(v);+ return typeof v === "string" && (v === "auto" || STT_CODE_RE.test(v));}const RESOURCES: Record<UiLanguage, Record<string, unknown>> = {@@ -149,15 +160,24 @@ function pushStt(lang: SttLanguage): void {}/**- * Pull the persisted STT recognition language from the backend and reflect it so- * the UI shows the real boot default. Call once on the Languages view mount. On- * failure the localStorage value (already in the store) stands.+ * Pull the persisted STT recognition language AND the list of languages the+ * recogniser accepts from the backend, and reflect both so the UI shows the real+ * boot default. Call once on the Languages view mount. On failure the+ * localStorage value (already in the store) stands.+ *+ * The option list is fetched rather than hardcoded: it is every language the+ * recogniser understands, and a copy kept here would drift from the backend's+ * (AP-4) the first time one is added.*/export async function hydrateSttLanguage(): Promise<void> {try {const res = await fetch(STT_LANGUAGE_ENDPOINT);if (!res.ok) return;- const body = (await res.json()) as { language?: unknown };+ const body = (await res.json()) as { language?: unknown; options?: unknown };+ if (Array.isArray(body.options)) {+ const options = body.options.filter(isSttLanguage);+ if (options.length) useI18nStore.getState().setSttOptions(options);+ }if (isSttLanguage(body.language)) {useI18nStore.getState().setStt(body.language, { push: false });}@@ -207,15 +227,20 @@ interface I18nState {ui: UiLanguage;reply: ReplyLanguage;stt: SttLanguage;+ /** Languages the recogniser accepts, as reported by the backend. */+ sttOptions: readonly string[];setUi: (lang: UiLanguage, opts?: { push?: boolean }) => void;setReply: (lang: ReplyLanguage, opts?: { push?: boolean }) => void;setStt: (lang: SttLanguage, opts?: { push?: boolean }) => void;+ setSttOptions: (options: readonly string[]) => void;}export const useI18nStore = create<I18nState>((set) => ({ui: readUi(),reply: readReply(),stt: readStt(),+ sttOptions: STT_FALLBACK_OPTIONS,+ setSttOptions: (options) => set({ sttOptions: options }),setUi: (lang, opts) => {try {localStorage.setItem(UI_KEY, lang);@@ -329,6 +354,11 @@ export function useSttLanguage(): SttLanguage {return useI18nStore((s) => s.stt);}+/** Languages the recogniser accepts (from the backend; "auto" until it loads). */+export function useSttLanguageOptions(): readonly string[] {+ return useI18nStore((s) => s.sttOptions);+}+export function setUiLanguage(lang: UiLanguage): void {useI18nStore.getState().setUi(lang);}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 6c9061dad1..1ea0e14ff0 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -286,7 +286,7 @@"paste_sent": "Einfügen gesendet","clipboard_only": "In die Zwischenablage kopiert","unavailable": "Einfügen nicht möglich",- "chat": "An den Chat geschickt",+ "chat": "An die App übergeben","partial": "Teilweise übertragen","empty": "Nichts gehört","cancelled": "Abgebrochen",@@ -2628,7 +2628,8 @@"use_web_socket": {"jarvis_opened": "{name} öffnete","prompt_sent": "Prompt gesendet an",- "prompt_not_submitted": "der Prompt steht im Eingabefeld, abgeschickt wurde er nicht"+ "prompt_not_submitted": "der Prompt steht im Eingabefeld, abgeschickt wurde er nicht",+ "dictation_nowhere": "Es war kein Textfeld aktiv, deshalb wurde das Diktat nicht eingefügt. Es steht in der Diktat-Historie."},"chat_thread": {"message_to": "Nachricht an",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 124c0dcaa9..5eff9d5f83 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -286,7 +286,7 @@"paste_sent": "Paste sent","clipboard_only": "Copied to clipboard","unavailable": "Could not insert",- "chat": "Sent to chat",+ "chat": "Sent to the app","partial": "Partly transcribed","empty": "Nothing heard","cancelled": "Cancelled",@@ -2629,7 +2629,8 @@"use_web_socket": {"jarvis_opened": "{name} opened","prompt_sent": "Prompt sent to",- "prompt_not_submitted": "the prompt is in its input box, not sent"+ "prompt_not_submitted": "the prompt is in its input box, not sent",+ "dictation_nowhere": "No text field had focus, so the dictation was not inserted. It is in the dictation history."},"chat_thread": {"message_to": "Message to",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex ee49ce5809..f613776df3 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -286,7 +286,7 @@"paste_sent": "Pegado enviado","clipboard_only": "Copiado al portapapeles","unavailable": "No se pudo insertar",- "chat": "Enviado al chat",+ "chat": "Enviado a la app","partial": "Transcrito parcialmente","empty": "No se oyó nada","cancelled": "Cancelado",@@ -2628,7 +2628,8 @@"use_web_socket": {"jarvis_opened": "{name} abrió","prompt_sent": "Prompt enviado a",- "prompt_not_submitted": "el prompt está en su campo de entrada, no se envió"+ "prompt_not_submitted": "el prompt está en su campo de entrada, no se envió",+ "dictation_nowhere": "Ningún campo de texto tenía el foco, así que el dictado no se insertó. Está en el historial de dictados."},"chat_thread": {"message_to": "Mensaje a",diff --git a/jarvis/ui/web/frontend/src/views/PatConnectDialog.test.tsx b/jarvis/ui/web/frontend/src/views/PatConnectDialog.test.tsxindex d85cfe58a3..cc1d8b206e 100644--- a/jarvis/ui/web/frontend/src/views/PatConnectDialog.test.tsx+++ b/jarvis/ui/web/frontend/src/views/PatConnectDialog.test.tsx@@ -46,7 +46,9 @@ describe("PatConnectDialog owner lock", () => {fireEvent.change(idField, { target: { value: "4242" } });fireEvent.click(screen.getByRole("button", { name: /^Connect/i }));- expect(onSubmit).toHaveBeenCalledWith("bot-token", 4242);+ // The third argument is the self-hosted server address, null for a plugin+ // whose auth config declares no instance_url field.+ expect(onSubmit).toHaveBeenCalledWith("bot-token", 4242, null);});it("omits the owner-id field for non-channel plugins and submits null", () => {@@ -67,7 +69,7 @@ describe("PatConnectDialog owner lock", () => {});fireEvent.click(screen.getByRole("button", { name: /^Connect/i }));- expect(onSubmit).toHaveBeenCalledWith("ghp_x", null);+ expect(onSubmit).toHaveBeenCalledWith("ghp_x", null, null);});it("forwards null when the owner-id field is left blank", () => {@@ -87,6 +89,6 @@ describe("PatConnectDialog owner lock", () => {});fireEvent.click(screen.getByRole("button", { name: /^Connect/i }));- expect(onSubmit).toHaveBeenCalledWith("123:ABC", null);+ expect(onSubmit).toHaveBeenCalledWith("123:ABC", null, null);});});