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(chat): one recording strip, so a live microphone is visible in every composer
rubenluetke10-beepac341ec0bf75
diff --git a/jarvis/ui/web/frontend/src/components/ChatInput.tsx b/jarvis/ui/web/frontend/src/components/ChatInput.tsxindex 340614abbd..234e57e998 100644--- a/jarvis/ui/web/frontend/src/components/ChatInput.tsx+++ b/jarvis/ui/web/frontend/src/components/ChatInput.tsx@@ -6,6 +6,7 @@ import { useAutoGrowTextarea } from "@/hooks/useAutoGrowTextarea";import { useEventStore } from "@/store/events";import { cn } from "@/lib/utils";import { useT } from "@/i18n";+import { DictationStatus } from "@/components/agentchat/DictationStatus";// Safety net: if the brain doesn't respond within 60s (no reply, no error event),// we revert the indicator. A backend hang must not leave the UI stuck in the@@ -176,22 +177,9 @@ export function ChatInput() {"transition-[box-shadow] focus-within:ring-2 focus-within:ring-border-strong",)}>- {dictating && (- <div- className="flex items-center gap-row rounded-md bg-secondary px-3 py-1.5 text-meta text-foreground"- role="status"- aria-live="polite"- >- {/* Listening is a live state, and life is green. It used to be- --primary, which on near-black is pure white — the loudest mark- on the screen for a thing that is merely running. */}- <span className="relative flex h-2 w-2" aria-hidden>- <span className="absolute inline-flex h-full w-full animate-ping rounded-full bg-success/70" />- <span className="relative inline-flex h-2 w-2 rounded-full bg-success" />- </span>- <span>{t("chats_view.dictation_listening")}</span>- </div>- )}+ {/* Listening is a live state, and life is green — the shared strip owns+ that rule now, plus the clock and its own way out. */}+ <DictationStatus onStop={stopDictation} /><textarea// Marks the composer as the app's fallback dictation sink. The// delivery path needs to know whether it is on screen at all beforediff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsxindex 1bbb0571fc..77df723ef7 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx@@ -30,6 +30,7 @@ import { usePasteRescue } from "@/components/agentchat/usePasteRescue";import { useComposerTypeahead } from "@/components/agentchat/useComposerTypeahead";import { ComposerTypeahead } from "@/components/agentchat/ComposerTypeahead";import { ChatAttachmentStrip } from "@/components/agentchat/ChatAttachmentStrip";+import { DictationStatus } from "@/components/agentchat/DictationStatus";import { GigiMark } from "@/components/GigiMark";import { useAutoGrowTextarea } from "@/hooks/useAutoGrowTextarea";import { fill, useT } from "@/i18n";@@ -435,19 +436,9 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {{t("agent_chat.attach_drop_hint")}</div>)}- {dictating && (- <div- className="flex items-center gap-2 rounded-lg border border-primary/30 bg-primary/10 px-3 py-1.5 text-xs text-primary"- role="status"- aria-live="polite"- >- <span className="relative flex h-2 w-2" aria-hidden>- <span className="absolute inline-flex h-full w-full animate-ping rounded-full bg-primary/70" />- <span className="relative inline-flex h-2 w-2 rounded-full bg-foreground/70" />- </span>- <span className="font-medium">{t("chats_view.dictation_listening")}</span>- </div>- )}+ {/* The blue variant of this strip lived here; a running microphone is a+ live state, not the accent, so it now shares the one green strip. */}+ <DictationStatus onStop={stopDictation} /><ChatAttachmentStripattachments={files.attachments}analyzing={files.analyzing}@@ -659,7 +650,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {className={cn("inline-flex h-8 w-8 items-center justify-center rounded-lg border transition-colors disabled:opacity-50",dictating- ? "animate-jarvis-pulse border-primary/50 bg-primary/15 text-primary"+ ? "border-success/40 bg-success/10 text-success motion-safe:animate-jarvis-pulse": "border-transparent text-muted-foreground hover:bg-secondary hover:text-foreground",)}>diff --git a/jarvis/ui/web/frontend/src/components/agentchat/DictationStatus.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/DictationStatus.test.tsxnew file mode 100644index 0000000000..fb8787e6d1--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentchat/DictationStatus.test.tsx@@ -0,0 +1,68 @@+import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";++import { DictationStatus } from "@/components/agentchat/DictationStatus";+import { useEventStore } from "@/store/events";++describe("DictationStatus", () => {+ beforeEach(() => {+ vi.useFakeTimers();+ useEventStore.setState({ dictating: false });+ });+ afterEach(() => {+ cleanup();+ vi.useRealTimers();+ });++ test("stays out of the way until the microphone is actually open", () => {+ render(<DictationStatus />);+ expect(screen.queryByTestId("dictation-status")).toBeNull();+ });++ test("announces the live session and counts from the moment it started", () => {+ render(<DictationStatus />);+ act(() => {+ useEventStore.setState({ dictating: true });+ });++ const strip = screen.getByTestId("dictation-status");+ expect(strip.getAttribute("role")).toBe("status");+ expect(strip.textContent).toContain("Listening");+ expect(strip.textContent).toContain("0:00");++ act(() => {+ vi.advanceTimersByTime(7_000);+ });+ expect(screen.getByTestId("dictation-status").textContent).toContain("0:07");+ });++ test("the clock restarts with the next dictation instead of carrying over", () => {+ render(<DictationStatus />);+ act(() => {+ useEventStore.setState({ dictating: true });+ });+ act(() => {+ vi.advanceTimersByTime(65_000);+ });+ expect(screen.getByTestId("dictation-status").textContent).toContain("1:05");++ act(() => {+ useEventStore.setState({ dictating: false });+ });+ act(() => {+ useEventStore.setState({ dictating: true });+ });+ expect(screen.getByTestId("dictation-status").textContent).toContain("0:00");+ });++ test("carries its own way out when the composer hands one over", () => {+ const onStop = vi.fn();+ render(<DictationStatus onStop={onStop} />);+ act(() => {+ useEventStore.setState({ dictating: true });+ });++ fireEvent.click(screen.getByText("Stop dictation"));+ expect(onStop).toHaveBeenCalledTimes(1);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentchat/DictationStatus.tsx b/jarvis/ui/web/frontend/src/components/agentchat/DictationStatus.tsxnew file mode 100644index 0000000000..2d1a02caab--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentchat/DictationStatus.tsx@@ -0,0 +1,92 @@+/**+ * "The microphone is on" — the one recording strip every composer shows while+ * dictation runs.+ *+ * Three composers grew three different answers to the same question: the front+ * page drew a grey strip with a green dot, the agent composer a blue one, and+ * the society chat nothing at all beyond a faint tint on a 32px button. Someone+ * who pressed the mic and said nothing yet had no way to tell whether the app+ * was listening. This is that one answer, shared.+ *+ * Everything it shows is real. `dictating` is the live session flag from the+ * event bus, and the clock counts from the moment that flag went true — there+ * is no audio level in the frontend, so nothing here pretends to be a level+ * meter. The pulse means "running", not "loud".+ *+ * Green, not red: a live microphone is a state, not a fault, and the palette+ * keeps `--destructive` for faults (see components/VoiceIndicator.tsx).+ */+import { useEffect, useRef, useState } from "react";++import { useEventStore } from "@/store/events";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";++/** "0:07", "1:42" — mm:ss with no leading hour nobody dictates for. */+function formatElapsed(ms: number): string {+ const total = Math.max(0, Math.floor(ms / 1000));+ const minutes = Math.floor(total / 60);+ const seconds = total % 60;+ return `${minutes}:${String(seconds).padStart(2, "0")}`;+}++export interface DictationStatusProps {+ /**+ * Ends the dictation. Given one, the strip carries its own Stop — the+ * fastest way out is then the thing that just appeared, not the small icon+ * the user has to find again.+ */+ onStop?: () => void;+ className?: string;+}++export function DictationStatus({ onStop, className }: DictationStatusProps) {+ const t = useT();+ const dictating = useEventStore((s) => s.dictating);+ const startedRef = useRef(0);+ const [elapsed, setElapsed] = useState(0);++ useEffect(() => {+ if (!dictating) {+ startedRef.current = 0;+ setElapsed(0);+ return;+ }+ startedRef.current = Date.now();+ setElapsed(0);+ const id = window.setInterval(() => setElapsed(Date.now() - startedRef.current), 500);+ return () => window.clearInterval(id);+ }, [dictating]);++ if (!dictating) return null;++ return (+ <div+ role="status"+ aria-live="polite"+ data-testid="dictation-status"+ className={cn(+ "flex items-center gap-2 rounded-md border border-success/30 bg-success/10 px-3 py-1.5 text-meta text-foreground",+ className,+ )}+ >+ <span className="relative flex h-2 w-2 shrink-0" aria-hidden>+ <span className="absolute inline-flex h-full w-full rounded-full bg-success/70 motion-safe:animate-ping" />+ <span className="relative inline-flex h-2 w-2 rounded-full bg-success" />+ </span>+ <span className="min-w-0 truncate">{t("chats_view.dictation_listening")}</span>+ <span className="ml-auto shrink-0 font-mono tabular-nums text-muted-foreground">+ {formatElapsed(elapsed)}+ </span>+ {onStop ? (+ <button+ type="button"+ onClick={onStop}+ className="shrink-0 rounded px-1.5 py-0.5 font-medium text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-strong"+ >+ {t("chats_view.dictation_stop")}+ </button>+ ) : null}+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx b/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsxindex 877acba5c0..07d069ff19 100644--- a/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx+++ b/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx@@ -20,13 +20,14 @@* runner can drive. The header says so while voice is showing.*/import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";-import { Brain, ChevronRight, MessageSquare, Mic, MicOff, Paperclip, Plus, RotateCcw, Send, Square } from "lucide-react";+import { Brain, ChevronRight, MessageSquare, Mic, Paperclip, Plus, RotateCcw, Send, Square } from "lucide-react";import ReactMarkdown from "react-markdown";import remarkGfm from "remark-gfm";import { AgentChatStoreProvider, useAgentChat } from "@/components/agentchat/AgentChatStoreContext";import { ChatAttachmentStrip } from "@/components/agentchat/ChatAttachmentStrip";import { useChatAttachments } from "@/components/agentchat/useChatAttachments";+import { DictationStatus } from "@/components/agentchat/DictationStatus";import { useComposerDictation } from "@/components/agentchat/useComposerDictation";import type { ReasoningBlock, TimelineItem, ToolBlock, TurnItem, UserItem } from "@/components/agentchat/reduce";import { formatThoughtDuration } from "@/components/home/TurnSteps";@@ -909,11 +910,15 @@ function Composer({ agent, mentionable, busy, sessionId, cwd, provider, surface))}</ul>) : null}+ <DictationStatus onStop={dictation.stop} className={cn(CHAT_MEASURE, "mb-1.5")} /><divclassName={cn(CHAT_MEASURE,"relative flex items-end gap-1 rounded-[22px] border border-border bg-background px-1.5 py-1",attachments.dragging && "border-border-strong",+ // The whole composer reads as armed while the mic is open, not just+ // the 32px button someone has to go looking for.+ dictation.dictating && "border-success/40 ring-1 ring-success/25",)}{...attachments.dragHandlers}>@@ -988,11 +993,13 @@ function Composer({ agent, mentionable, busy, sessionId, cwd, provider, surfacearia-label={dictation.dictating ? t("society.chat.stop_recording") : t("society.chat.record")}aria-pressed={dictation.dictating}className={cn(- "flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground hover:bg-secondary hover:text-foreground",- dictation.dictating && "bg-destructive/15 text-destructive",+ "flex h-8 w-8 items-center justify-center rounded-full transition-colors",+ dictation.dictating+ ? "bg-secondary text-success motion-safe:animate-jarvis-pulse"+ : "text-muted-foreground hover:bg-secondary hover:text-foreground",)}>- {dictation.dictating ? <MicOff className="h-4 w-4" aria-hidden /> : <Mic className="h-4 w-4" aria-hidden />}+ {dictation.dictating ? <Square className="h-4 w-4" aria-hidden /> : <Mic className="h-4 w-4" aria-hidden />}</button>{busy ? (<button