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(home): a waveform that fills the Jarvis bar, and no "Thought for 0s"
rubenluetke10-beep1270bd6e1b85
diff --git a/jarvis/ui/web/frontend/src/components/home/JarvisBar.tsx b/jarvis/ui/web/frontend/src/components/home/JarvisBar.tsxindex bb19d77371..ebf7945218 100644--- a/jarvis/ui/web/frontend/src/components/home/JarvisBar.tsx+++ b/jarvis/ui/web/frontend/src/components/home/JarvisBar.tsx@@ -2,7 +2,8 @@ import { useCallback, type KeyboardEvent, type MouseEvent } from "react";import { PhoneOff } from "lucide-react";import { useEventStore, type VoiceState } from "@/store/events";-import { VoiceWaveform, type WaveformPhase } from "@/components/overlay/VoiceWaveform";+import type { WaveformPhase } from "@/components/overlay/VoiceWaveform";+import { StageWaveform } from "@/components/home/StageWaveform";import { voiceInputLevelRef } from "@/lib/voiceInputLevel";import { useVoiceCall } from "@/components/agentic/useVoiceCall";import { useVoiceReadiness } from "@/hooks/useVoiceReadiness";@@ -10,17 +11,17 @@ import { useVoiceEngineDisplay } from "@/hooks/useVoiceEngineDisplay";import { useT } from "@/i18n";import { cn } from "@/lib/utils";-/** Bars across the card — wide enough to read as a waveform, not a meter. */-const BAR_COUNT = 40;-/*** The Jarvis bar — the front page's one voice control, drawn as a card in* the chat composer's language (components/ChatInput.tsx: rounded-2xl,* bg-card, a hairline border, the same soft shadow) so the two surfaces* read as siblings.*- * Top row: the live waveform, large. Bottom row: the state (dot + word) on- * the left; on the right the engine pill — provider and model, click to+ * Top row: the waveform, filling the card's width (components/home/+ * StageWaveform — breathing at rest, the microphone while listening).+ * Bottom row: the state (dot + word) and, in the same breath, what to do+ * or what is happening ("Say “Hey George” or tap to start", "Listening…")+ * on the left; on the right the engine pill — provider and model, click to* change it — and, only while a conversation is running, an End button.* The whole card is the start/stop control (maintainer, 2026-08-23: no* microphone button — you tap the bar or say the wake word); the pills stop@@ -31,7 +32,7 @@ const BAR_COUNT = 40;* contain the two inner buttons, and nesting them is how a screen reader* would announce one control three times.*/-export function JarvisBar({ phase }: { phase: WaveformPhase }) {+export function JarvisBar({ phase, hint }: { phase: WaveformPhase; hint: string }) {const t = useT();const voiceState = useEventStore((s) => s.voiceState);const setActiveSection = useEventStore((s) => s.setActiveSection);@@ -89,21 +90,17 @@ export function JarvisBar({ phase }: { phase: WaveformPhase }) {data-phase={phase}data-active={callActive || undefined}className={cn(- "group flex w-full cursor-pointer select-none flex-col gap-2 rounded-2xl border border-border bg-card p-3 text-left",+ "group flex w-full cursor-pointer select-none flex-col gap-2 rounded-2xl border border-border bg-card px-4 pb-2.5 pt-4 text-left","shadow-[0_1px_2px_rgb(var(--scrim-rgb)/0.05),0_8px_24px_rgb(var(--scrim-rgb)/0.06)] transition-[border-color,box-shadow]","hover:border-primary/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-disabled:cursor-default aria-disabled:opacity-80 aria-disabled:hover:border-border",callActive && "border-primary/50",)}>- <VoiceWaveform- levelRef={voiceInputLevelRef}- phase={phase}- count={BAR_COUNT}- frame={false}- className="h-14 w-full"- />- <div className="flex items-center gap-1.5">+ <div className="h-14 w-full">+ <StageWaveform levelRef={voiceInputLevelRef} phase={phase} />+ </div>+ <div className="flex items-center gap-2"><spanclassName={cn("flex min-w-0 items-center gap-2 px-1 font-mono text-[10px] uppercase tracking-[0.16em]",@@ -122,9 +119,14 @@ export function JarvisBar({ phase }: { phase: WaveformPhase }) {: "bg-muted-foreground/40",)}/>- <span className="truncate">{stateWord}</span>+ <span className="shrink-0">{stateWord}</span>+ </span>+ <span+ className="min-w-0 flex-1 truncate text-xs text-muted-foreground"+ data-testid="voice-hint"+ >+ {hint}</span>- <span className="flex-1" /><buttontype="button"onClick={onEngineClick}diff --git a/jarvis/ui/web/frontend/src/components/home/StageWaveform.tsx b/jarvis/ui/web/frontend/src/components/home/StageWaveform.tsxnew file mode 100644index 0000000000..6b1ea89c9f--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/home/StageWaveform.tsx@@ -0,0 +1,247 @@+import { useEffect, useRef, type MutableRefObject } from "react";++import type { WaveformPhase } from "@/components/overlay/VoiceWaveform";+import { ATTACK_TAU_S, COLUMN_MS, RELEASE_TAU_S, clamp01 } from "@/components/overlay/voiceBars";+import { cn } from "@/lib/utils";++/**+ * The front page's waveform — the heart of the Jarvis bar.+ *+ * The overlay's `VoiceWaveform` is an SVG drawn for a small pill: a fixed+ * row of bars inside a fixed view box, and "at rest nothing animates". On+ * the front page the same drawing read as a thin dotted line lost in a big+ * card (maintainer, 2026-08-23: "sieht komisch aus"). This one is built for+ * the stage instead:+ *+ * - it FILLS its container — bar count follows the width, bar height the+ * height, on any window size and DPI;+ * - at rest it breathes: a slow, low travelling wave, so the bar reads as+ * alive-and-waiting rather than switched off (that is what the person+ * sees most of the time);+ * - while listening the bars follow the microphone, spreading from the+ * centre outwards (the classic voice-visualiser shape), with the+ * overlay's own attack/release and scroll cadence;+ * - thinking and speaking are a sweep, connecting a pulse, error a+ * still red row.+ *+ * Canvas rather than DOM bars: sixty to ninety bars repainted every frame+ * are cheap on a 2D context and would be layout work as elements. Colours+ * are read from the theme tokens on the element itself, so the drawing+ * follows light/dark and the wallpaper floor without a single literal.+ * Reduced motion keeps the information (a level meter) and drops the+ * decoration (no breathing, no sweep, no scroll).+ */+export function StageWaveform({+ levelRef,+ phase,+ className,+}: {+ /** Normalised 0..1 microphone level, written by the audio callback. */+ levelRef: MutableRefObject<number>;+ phase: WaveformPhase;+ className?: string;+}) {+ const canvasRef = useRef<HTMLCanvasElement | null>(null);+ const phaseRef = useRef<WaveformPhase>(phase);+ phaseRef.current = phase;++ useEffect(() => {+ const canvas = canvasRef.current;+ if (!canvas) return;+ const ctx = canvas.getContext("2d");+ if (!ctx) return;++ const reduced =+ typeof window.matchMedia === "function" &&+ window.matchMedia("(prefers-reduced-motion: reduce)").matches;++ // Geometry follows the box; re-measured on every resize.+ let width = 0;+ let height = 0;+ let dpr = 1;+ let count = 0;+ const measure = () => {+ const rect = canvas.getBoundingClientRect();+ dpr = Math.max(1, window.devicePixelRatio || 1);+ width = Math.max(1, Math.floor(rect.width));+ height = Math.max(1, Math.floor(rect.height));+ canvas.width = Math.floor(width * dpr);+ canvas.height = Math.floor(height * dpr);+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);+ const next = Math.max(8, Math.floor((width + BAR_GAP) / (BAR_W + BAR_GAP)));+ if (next !== count) {+ count = next;+ history = new Array<number>(count).fill(0);+ head = 0;+ }+ };++ // Theme colours, read from the tokens on the canvas itself. Re-read+ // once a second — a theme flip is rare, a frame is not.+ let colors = readColors(canvas);+ let colorsAt = 0;++ let history: number[] = [];+ let head = 0;+ let level = 0;+ let carryMs = 0;+ let sweep = 0;+ let breath = 0;+ let last = performance.now();+ let raf = 0;++ const paint = (heights: number[], alphas: number[], fill: string) => {+ ctx.clearRect(0, 0, width, height);+ const pitch = BAR_W + BAR_GAP;+ const rowW = count * pitch - BAR_GAP;+ const x0 = (width - rowW) / 2;+ const mid = height / 2;+ for (let i = 0; i < count; i += 1) {+ const h = Math.max(BAR_MIN, Math.min(height, heights[i] ?? BAR_MIN));+ ctx.globalAlpha = alphas[i] ?? 1;+ ctx.fillStyle = fill;+ roundedBar(ctx, x0 + i * pitch, mid - h / 2, BAR_W, h);+ }+ ctx.globalAlpha = 1;+ };++ const frame = (now: number) => {+ raf = requestAnimationFrame(frame);+ const dt = Math.min((now - last) / 1000, 0.1);+ last = now;+ if (now - colorsAt > 1000) {+ colors = readColors(canvas);+ colorsAt = now;+ }+ const p = phaseRef.current;+ const maxH = height;+ const heights: number[] = new Array<number>(count);+ const alphas: number[] = new Array<number>(count);++ if (p === "error") {+ heights.fill(BAR_MIN + 2);+ alphas.fill(0.9);+ paint(heights, alphas, colors.error);+ return;+ }++ if (p === "idle") {+ // Breathing: a slow wave travelling across the row, low and quiet.+ breath += dt * (reduced ? 0 : 0.9);+ for (let i = 0; i < count; i += 1) {+ const t = i / Math.max(1, count - 1);+ const wave = reduced ? 0 : 0.5 + 0.5 * Math.sin(breath * 2 + t * 6.283 * 1.5);+ const env = 0.55 + 0.45 * Math.sin(t * Math.PI); // softer at the edges+ heights[i] = BAR_MIN + maxH * 0.12 * wave * env;+ alphas[i] = 0.35 + 0.3 * wave;+ }+ paint(heights, alphas, colors.muted);+ return;+ }++ if (p === "connecting") {+ breath += dt * 2.4;+ const pulse = reduced ? 0.5 : 0.5 + 0.5 * Math.sin(breath);+ heights.fill(BAR_MIN + maxH * 0.1 * pulse);+ alphas.fill(0.45 + 0.4 * pulse);+ paint(heights, alphas, colors.primary);+ return;+ }++ if (p === "working" || p === "speaking") {+ // A sweep: a bright band travelling the row, faster when speaking.+ const period = p === "speaking" ? 1.1 : 1.8;+ sweep = reduced ? 0.5 : (sweep + dt / period) % 1;+ for (let i = 0; i < count; i += 1) {+ const t = i / Math.max(1, count - 1);+ const d = Math.abs(((t - sweep + 1.5) % 1) - 0.5); // 0 at the band+ const gain = reduced ? 0.4 : Math.max(0, 1 - d / 0.22);+ const base = p === "speaking" ? 0.22 : 0.14;+ heights[i] = BAR_MIN + maxH * (base + 0.55 * gain);+ alphas[i] = 0.4 + 0.6 * gain;+ }+ paint(heights, alphas, colors.primary);+ return;+ }++ // listening: the microphone, spreading from the centre outwards.+ const target = clamp01(levelRef.current);+ const tau = target > level ? ATTACK_TAU_S : RELEASE_TAU_S;+ level += (target - level) * (1 - Math.exp(-dt / tau));+ carryMs += dt * 1000;+ while (carryMs >= COLUMN_MS) {+ carryMs -= COLUMN_MS;+ history[head] = level;+ head = (head + 1) % count;+ }+ const half = Math.floor(count / 2);+ for (let i = 0; i < count; i += 1) {+ // Distance from the centre decides how old a sample this bar shows:+ // the newest in the middle, older ones further out on both sides.+ const dist = Math.abs(i - (count - 1) / 2);+ const age = reduced ? 0 : Math.min(half, Math.round(dist));+ const idx = (head - 1 - age + count * 2) % count;+ const v = reduced ? level : Math.max(history[idx] ?? 0, age === 0 ? level : 0);+ heights[i] = BAR_MIN + maxH * (0.06 + 0.9 * v);+ alphas[i] = 0.55 + 0.45 * v;+ }+ paint(heights, alphas, colors.primary);+ };++ measure();+ const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(measure) : null;+ ro?.observe(canvas);+ raf = requestAnimationFrame(frame);+ return () => {+ cancelAnimationFrame(raf);+ ro?.disconnect();+ };+ }, [levelRef]);++ return (+ <canvas+ ref={canvasRef}+ aria-hidden+ data-testid="stage-waveform"+ data-phase={phase}+ className={cn("block h-full w-full", className)}+ />+ );+}++const BAR_W = 3;+const BAR_GAP = 3;+const BAR_MIN = 3;++function roundedBar(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number) {+ const r = Math.min(w / 2, h / 2);+ ctx.beginPath();+ ctx.moveTo(x + r, y);+ ctx.lineTo(x + w - r, y);+ ctx.arc(x + w - r, y + r, r, -Math.PI / 2, 0);+ ctx.lineTo(x + w, y + h - r);+ ctx.arc(x + w - r, y + h - r, r, 0, Math.PI / 2);+ ctx.lineTo(x + r, y + h);+ ctx.arc(x + r, y + h - r, r, Math.PI / 2, Math.PI);+ ctx.lineTo(x, y + r);+ ctx.arc(x + r, y + r, r, Math.PI, (3 * Math.PI) / 2);+ ctx.closePath();+ ctx.fill();+}++/**+ * The theme's channels as canvas colours. The tokens are `H S% L%` triples+ * (index.css); `hsl(H S% L%)` is what the CSS side builds from them too.+ */+function readColors(el: HTMLElement): { primary: string; muted: string; error: string } {+ const style = getComputedStyle(el);+ const token = (name: string, fallback: string) => {+ const raw = style.getPropertyValue(name).trim();+ return raw ? `hsl(${raw})` : fallback;+ };+ return {+ primary: token("--primary", "hsl(50 100% 52%)"),+ muted: token("--muted-foreground", "hsl(47 5% 59%)"),+ error: token("--destructive", "hsl(0 84% 60%)"),+ };+}diff --git a/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx b/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsxindex e107d7b5c8..5423a7abf8 100644--- a/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx+++ b/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx@@ -1,7 +1,7 @@import { cleanup, fireEvent, render, screen, within } from "@testing-library/react";import { afterEach, describe, expect, it } from "vitest";-import { TurnSteps, formatThoughtDuration } from "@/components/home/TurnSteps";+import { TurnSteps, formatThoughtDuration, traceWorthShowing } from "@/components/home/TurnSteps";import type { ThinkingStep } from "@/lib/thinkingSteps";function step(over: Partial<ThinkingStep> & Pick<ThinkingStep, "id" | "kind">): ThinkingStep {@@ -106,3 +106,25 @@ describe("formatThoughtDuration", () => {expect(formatThoughtDuration(65_000)).toBe("1m 05s");});});++describe("traceWorthShowing", () => {+ const brain: ThinkingStep = {+ id: "b1", kind: "brain", labelKey: "thinking.step_brain", status: "done", startedTs: 0, durationMs: 200,+ };+ const tool: ThinkingStep = {+ id: "t1", kind: "tool", labelKey: "thinking.step_tool", detail: "gmail_search", status: "done", startedTs: 0, durationMs: 400,+ };++ it("hides a finished sub-second brain-only turn — no 'Thought for 0s'", () => {+ expect(traceWorthShowing([brain], 200, false)).toBe(false);+ expect(traceWorthShowing([], 0, false)).toBe(false);+ const { container } = render(<TurnSteps steps={[brain]} durationMs={200} />);+ expect(container.firstChild).toBeNull();+ });++ it("keeps turns with a tool, a real thinking time, or that are still live", () => {+ expect(traceWorthShowing([brain, tool], 200, false)).toBe(true);+ expect(traceWorthShowing([brain], 3200, false)).toBe(true);+ expect(traceWorthShowing([], 0, true)).toBe(true);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/home/TurnSteps.tsx b/jarvis/ui/web/frontend/src/components/home/TurnSteps.tsxindex 641655008c..5112d642d6 100644--- a/jarvis/ui/web/frontend/src/components/home/TurnSteps.tsx+++ b/jarvis/ui/web/frontend/src/components/home/TurnSteps.tsx@@ -238,6 +238,25 @@ function StepRow({ step, compact }: { step: ThinkingStep; compact: boolean }) {);}+/**+ * Is a finished trace worth a line on screen?+ *+ * A turn that only saw the brain call come and go within a second — no tool,+ * no worker, no computer use — has nothing to show, and "Thought for 0s"+ * above an answer is noise, not information (maintainer, 2026-08-23). Live+ * traces are always shown: the person should see the assistant is working.+ */+export function traceWorthShowing(+ steps: ThinkingStep[],+ durationMs: number | undefined,+ live: boolean,+): boolean {+ if (live) return true;+ if (steps.length === 0) return false;+ const substantial = steps.some((s) => s.kind !== "brain" && s.kind !== "note");+ return substantial || (durationMs ?? 0) >= 1000;+}+export function TurnSteps({steps,live = false,@@ -252,7 +271,7 @@ export function TurnSteps({// A finished turn with nothing observed has nothing to say; a live one// still shows its header so the person sees the assistant is working.- if (!live && steps.length === 0) return null;+ if (!traceWorthShowing(steps, durationMs, live)) return null;const toolRows = steps.filter((s) => s.kind === "tool");const visible = open ? steps : toolRows;diff --git a/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx b/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsxindex 06821217bf..6ff8b73247 100644--- a/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx+++ b/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx@@ -11,7 +11,7 @@ import { fill, useT } from "@/i18n";import { cn } from "@/lib/utils";import { Greeting } from "@/components/home/Greeting";import { JarvisBar } from "@/components/home/JarvisBar";-import { TurnSteps } from "@/components/home/TurnSteps";+import { TurnSteps, traceWorthShowing } from "@/components/home/TurnSteps";/** How many finished lines the lane keeps above the bar. */const TRANSCRIPT_LINES = 8;@@ -46,7 +46,19 @@ export function VoiceStage() {const { config: wakeConfig } = useWakeWord();const wakePhrase = wakeConfig?.phrase.trim() || "";- const lines = useMemo(() => recentLines(transcript, TRANSCRIPT_LINES), [transcript]);+ // Steps blocks with nothing to show (a sub-second brain call, no tools)+ // are dropped BEFORE the lane is cut to its last lines, so an empty block+ // never takes a slot — or leaves a blank gap — in the lane.+ const lines = useMemo(+ () =>+ recentLines(+ transcript.filter(+ (m) => m.who !== "steps" || traceWorthShowing(m.steps, m.durationMs, m.live),+ ),+ TRANSCRIPT_LINES,+ ),+ [transcript],+ );const liveLine = transcription && !transcriptionFinal ? transcription : "";// A live turn keeps the lane pinned to its end as steps arrive.const liveSteps = lines.some((m) => m.who === "steps" && m.live);@@ -95,15 +107,7 @@ export function VoiceStage() {<div ref={laneEnd} /></div>- <div className="flex flex-col items-center gap-3">- <JarvisBar phase={phase} />- <p- className="font-mono text-[11px] tracking-[0.04em] text-muted-foreground"- data-testid="voice-hint"- >- {hint}- </p>- </div>+ <JarvisBar phase={phase} hint={hint} /></div></div>);