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
@ fix(dictation): export the routing predicate useWebSocket already imports
Ruben Lütkecd28e0a9fb7c
diff --git a/jarvis/ui/web/frontend/src/lib/dictationTarget.test.ts b/jarvis/ui/web/frontend/src/lib/dictationTarget.test.tsindex f43c075610..afcc5f2f72 100644--- a/jarvis/ui/web/frontend/src/lib/dictationTarget.test.ts+++ b/jarvis/ui/web/frontend/src/lib/dictationTarget.test.ts@@ -4,6 +4,7 @@ import { attachTerminalBridge } from "./editActions";import {deliverDictationText,installDictationFocusTracker,+ isForThisWindow,resetDictationTarget,} from "./dictationTarget";@@ -126,6 +127,36 @@ describe("deliverDictationText", () => {});});+describe("isForThisWindow", () => {+ /* The dangerous direction: the same event fires for a dictation the backend+ * is pasting into ANOTHER program. Treating that one as ours would duplicate+ * it into a Jarvis field nobody is looking at. */+ it("refuses a transcript the backend is pasting elsewhere", () => {+ expect(isForThisWindow({ text: "for notepad", target: "insert" }, false)).toBe(+ false,+ );+ });++ it("refuses a transcript from a backend too old to say", () => {+ expect(isForThisWindow({ text: "unknown route" }, false)).toBe(false);+ });++ it("accepts a transcript meant for this window", () => {+ expect(isForThisWindow({ text: "for us", target: "chat" }, false)).toBe(true);+ });++ it("refuses the empty final an aborted dictation publishes", () => {+ expect(isForThisWindow({ text: "", target: "chat" }, false)).toBe(false);+ expect(isForThisWindow({ text: " ", target: "chat" }, false)).toBe(false);+ });++ it("leaves the composer's own microphone button to the composer", () => {+ expect(isForThisWindow({ text: "typed live", target: "chat" }, true)).toBe(+ false,+ );+ });+});+describe("installDictationFocusTracker", () => {it("stops remembering once removed", () => {removeTracker?.();diff --git a/jarvis/ui/web/frontend/src/lib/dictationTarget.ts b/jarvis/ui/web/frontend/src/lib/dictationTarget.tsindex 5568a1189b..6dc9baff6e 100644--- a/jarvis/ui/web/frontend/src/lib/dictationTarget.ts+++ b/jarvis/ui/web/frontend/src/lib/dictationTarget.ts@@ -96,6 +96,41 @@ export function resetDictationTarget(): void {lastEditable = null;}+/** The final-transcript half of a `DictationTranscript` event. */+export interface FinalTranscript {+ text?: string;+ /** The route the pipeline resolved: `insert` (foreign app) or `chat` (here). */+ target?: string;+}++/**+ * May this transcript be written into a field of this window?+ *+ * A predicate rather than an inline condition because getting it wrong is+ * invisible in both directions, and each clause guards a different way of+ * being wrong:+ *+ * - **`target === "chat"`.** The event fires on BOTH routes. A dictation the+ * backend is already pasting into another program would otherwise ALSO be+ * written into whatever Jarvis field last had focus — a duplicate in a+ * section the user is not even looking at. A backend too old to send a+ * target says nothing, which reads as "not for us" and leaves that install+ * behaving exactly as it did before.+ * - **Words.** An aborted dictation publishes an empty final transcript purely+ * to end the live tail; there is nothing to insert and nothing to report.+ * - **The composer is not recording.** Its microphone button mirrors every+ * partial into itself and owns the commit, so inserting here as well would+ * deliver the same sentence twice.+ */+export function isForThisWindow(+ payload: FinalTranscript,+ composerIsRecording: boolean,+): boolean {+ if (payload.target !== "chat") return false;+ if (!(payload.text ?? "").trim()) return false;+ return !composerIsRecording;+}+/*** Write `text` wherever the user was typing. Never throws.*