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.

feat(voice): keep the voice glow moving while the assistant thinks

rubenluetke10-beep2bd69dc672a6
diff --git a/jarvis/ui/web/frontend/src/components/home/VoiceGlow.test.tsx b/jarvis/ui/web/frontend/src/components/home/VoiceGlow.test.tsx
index 9f88bd7b5d..afb588af31 100644
--- a/jarvis/ui/web/frontend/src/components/home/VoiceGlow.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/VoiceGlow.test.tsx
@@ -13,6 +13,11 @@ describe("VoiceGlow", () => {
expect(glow.children).toHaveLength(3);
});
+ it("keeps the light up while the assistant thinks", () => {
+ render(<VoiceGlow active thinking />);
+ expect(screen.getByTestId("voice-glow").children).toHaveLength(3);
+ });
+
it("rests as a faint, still wash while no call is open", () => {
render(<VoiceGlow active={false} />);
for (const pool of Array.from(screen.getByTestId("voice-glow").children) as HTMLElement[]) {
diff --git a/jarvis/ui/web/frontend/src/components/home/VoiceGlow.tsx b/jarvis/ui/web/frontend/src/components/home/VoiceGlow.tsx
index ae80b1b104..866d742816 100644
--- a/jarvis/ui/web/frontend/src/components/home/VoiceGlow.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/VoiceGlow.tsx
@@ -19,7 +19,9 @@ import { createVoiceFollower } from "@/components/home/voiceFollower";
* playback level), whichever is louder — the light stands taller, flows
* faster and its core flares with each syllable
* (components/home/voiceFollower turns the raw level into those smooth
- * signals). Levels are read on animation frames — no React state, no
+ * signals). While the assistant thinks, nobody speaks — so the light does
+ * not go dark: it breathes, and two beams glide along the bottom edge,
+ * part and meet again. Levels are read on animation frames — no React state, no
* re-render per frame — and the loop stops once the light has settled after
* a call. Reduced motion keeps the light and drops the movement.
*
@@ -28,7 +30,7 @@ import { createVoiceFollower } from "@/components/home/voiceFollower";
*
* Purely decorative: no pointer events, hidden from screen readers.
*/
-export function VoiceGlow({ active }: { active: boolean }) {
+export function VoiceGlow({ active, thinking = false }: { active: boolean; thinking?: boolean }) {
const [webgl, setWebgl] = useState(webglAvailable);
return (
<div
@@ -38,9 +40,9 @@ export function VoiceGlow({ active }: { active: boolean }) {
className="pointer-events-none absolute inset-x-0 bottom-0 h-[38vh] overflow-hidden"
>
{webgl ? (
- <ShaderGlow active={active} onUnavailable={() => setWebgl(false)} />
+ <ShaderGlow active={active} thinking={thinking} onUnavailable={() => setWebgl(false)} />
) : (
- <CssGlow active={active} />
+ <CssGlow active={active} thinking={thinking} />
)}
</div>
);
@@ -64,6 +66,17 @@ function currentVoiceLevel(now: number): number {
/** How long the light takes to come up when a call opens and to settle after. */
const POWER_TAU_S = 0.5;
+/** How long the thinking beams take to fade in and out. */
+const THINK_TAU_S = 0.35;
+/** Radians per second of the beams' glide: one there-and-back every ~4.5 s. */
+const SWEEP_SPEED = 1.4;
+/** Radians per second of the light's breathing while it thinks (~3 s a breath). */
+const BREATH_SPEED = 2.1;
+
+/** How high the light stands while thinking: a calm, breathing middle height. */
+function thinkingLevel(think: number, breath: number): number {
+ return think * (0.24 + 0.08 * Math.sin(breath));
+}
/**
* Contexts handed back one task after an unmount, so React's development
@@ -72,9 +85,18 @@ const POWER_TAU_S = 0.5;
*/
const pendingReleases = new Map<HTMLCanvasElement, number>();
-function ShaderGlow({ active, onUnavailable }: { active: boolean; onUnavailable: () => void }) {
+function ShaderGlow({
+ active,
+ thinking,
+ onUnavailable,
+}: {
+ active: boolean;
+ thinking: boolean;
+ onUnavailable: () => void;
+}) {
const canvasRef = useRef<HTMLCanvasElement | null>(null);
const activeRef = useRef(active);
+ const thinkingRef = useRef(thinking);
const wakeRef = useRef<() => void>(() => {});
const unavailableRef = useRef(onUnavailable);
@@ -84,8 +106,9 @@ function ShaderGlow({ active, onUnavailable }: { active: boolean; onUnavailable:
useEffect(() => {
activeRef.current = active;
+ thinkingRef.current = thinking;
wakeRef.current();
- }, [active]);
+ }, [active, thinking]);
useEffect(() => {
const canvas = canvasRef.current;
@@ -109,6 +132,9 @@ function ShaderGlow({ active, onUnavailable }: { active: boolean; onUnavailable:
// loudness into a jump of the whole pattern.
let time = 12;
let power = 0;
+ let think = 0;
+ let sweepPhase = 0;
+ let breathPhase = 0;
let color: [number, number, number] = [61, 139, 255];
let light = false;
let sinceTheme = 0;
@@ -128,7 +154,17 @@ function ShaderGlow({ active, onUnavailable }: { active: boolean; onUnavailable:
light = canvas.closest(".dark") === null;
};
const draw = () =>
- renderer.render({ time, level: signals.level, pulse: signals.pulse, power, light, color });
+ renderer.render({
+ time,
+ level: Math.max(signals.level, thinkingLevel(think, breathPhase)),
+ pulse: signals.pulse,
+ think,
+ // The beams start together in the middle and part from there.
+ sweep: Math.sin(sweepPhase),
+ power,
+ light,
+ color,
+ });
const tick = (now: number) => {
const dt = last < 0 ? 0 : Math.min(0.1, (now - last) / 1000);
@@ -136,13 +172,22 @@ function ShaderGlow({ active, onUnavailable }: { active: boolean; onUnavailable:
const live = activeRef.current;
signals = follower.step(dt, live ? currentVoiceLevel(now) : 0);
power += ((live ? 1 : 0) - power) * (1 - Math.exp(-dt / POWER_TAU_S));
- time += dt * (0.55 + signals.level * 1.4);
+ const thinkingNow = live && thinkingRef.current;
+ think += ((thinkingNow ? 1 : 0) - think) * (1 - Math.exp(-dt / THINK_TAU_S));
+ if (think < 0.002 && !thinkingNow) {
+ think = 0;
+ sweepPhase = 0;
+ } else {
+ sweepPhase += dt * SWEEP_SPEED;
+ breathPhase += dt * BREATH_SPEED;
+ }
+ time += dt * (0.55 + Math.max(signals.level, think * 0.3) * 1.4);
sinceTheme += dt;
if (sinceTheme > 0.5) {
sinceTheme = 0;
readTheme();
}
- if (!live && power < 0.002 && signals.level < 0.002 && signals.pulse < 0.002) {
+ if (!live && power < 0.002 && think === 0 && signals.level < 0.002 && signals.pulse < 0.002) {
// Settled after a call: one last resting frame, then no loop at all.
power = 0;
signals = { level: 0, pulse: 0 };
@@ -157,6 +202,8 @@ function ShaderGlow({ active, onUnavailable }: { active: boolean; onUnavailable:
const wake = () => {
if (reduced || typeof requestAnimationFrame === "undefined") {
power = activeRef.current ? 1 : 0;
+ // Reduced motion: the beams stand still, together in the middle.
+ think = activeRef.current && thinkingRef.current ? 1 : 0;
readTheme();
draw();
return;
@@ -226,7 +273,7 @@ function ShaderGlow({ active, onUnavailable }: { active: boolean; onUnavailable:
}
/** The fallback: three pools of accent light that move with the same signals. */
-function CssGlow({ active }: { active: boolean }) {
+function CssGlow({ active, thinking }: { active: boolean; thinking: boolean }) {
const blobRefs = useRef<(HTMLDivElement | null)[]>([]);
useEffect(() => {
@@ -245,10 +292,15 @@ function CssGlow({ active }: { active: boolean }) {
// shader's flow time: the voice changes how fast it travels, never where.
const sway = BLOBS.map((b) => b.phase);
const breath = BLOBS.map((b) => b.phase * 2);
+ let thinkBreath = 0;
const tick = (now: number) => {
const dt = last < 0 ? 0 : Math.min(0.1, (now - last) / 1000);
last = now;
- const voice = follower.step(dt, currentVoiceLevel(now)).level;
+ thinkBreath += dt * BREATH_SPEED;
+ const voice = Math.max(
+ follower.step(dt, currentVoiceLevel(now)).level,
+ thinkingLevel(thinking ? 1 : 0, thinkBreath),
+ );
BLOBS.forEach((b, i) => {
const el = blobs[i];
if (!el) return;
@@ -265,7 +317,7 @@ function CssGlow({ active }: { active: boolean }) {
};
frame = requestAnimationFrame(tick);
return () => cancelAnimationFrame(frame);
- }, [active]);
+ }, [active, thinking]);
return (
<>
diff --git a/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx b/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx
index 38fe8ff197..f065a91f2f 100644
--- a/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/VoiceStage.tsx
@@ -28,7 +28,8 @@ import { traceModel } from "@/lib/thinkingSteps";
* the bottom a composer-shaped card (components/home/VoiceComposer) that
* says what is happening and carries Start / Stop. Behind it a soft light
* rises from the bottom edge and breathes with the voices
- * (components/home/VoiceGlow); while the assistant thinks or speaks, its
+ * (components/home/VoiceGlow) — and keeps moving while the assistant
+ * thinks, so a silent turn never looks dead; while it thinks or speaks, its
* mark pulses under the last line. While the answer is being spoken, the
* words not yet said stay grey and light up as the voice reaches them
* (components/home/useSpokenCursor — an estimate from the playback level,
@@ -108,7 +109,7 @@ export function VoiceStage({ onExit }: { onExit?: () => void } = {}) {
data-testid="voice-stage"
data-empty="true"
>
- <VoiceGlow active={active} />
+ <VoiceGlow active={active} thinking={voiceState === "thinking"} />
<div className="relative flex w-full max-w-[680px] flex-1 flex-col justify-center gap-7 px-6 pb-[14vh]">
<Greeting subtitle={t("home.voice_subtitle")} />
<VoiceComposer hint={hint} onExit={onExit} />
@@ -123,7 +124,7 @@ export function VoiceStage({ onExit }: { onExit?: () => void } = {}) {
data-testid="voice-stage"
data-empty="false"
>
- <VoiceGlow active={active} />
+ <VoiceGlow active={active} thinking={voiceState === "thinking"} />
<ScrollArea ref={rootRef} className="relative min-h-0 w-full flex-1" data-testid="voice-transcript">
<div
ref={contentRef}
diff --git a/jarvis/ui/web/frontend/src/components/home/voiceGlowRenderer.ts b/jarvis/ui/web/frontend/src/components/home/voiceGlowRenderer.ts
index c6a1ad0864..7491386870 100644
--- a/jarvis/ui/web/frontend/src/components/home/voiceGlowRenderer.ts
+++ b/jarvis/ui/web/frontend/src/components/home/voiceGlowRenderer.ts
@@ -8,7 +8,10 @@
* and sinking toward the sides; the voice lifts it;
* - soft vertical CURTAINS drifting upward through the haze — the shimmer;
* - a hot CORE hugging the bottom edge that flares with each syllable
- * (`pulse`, the fast envelope) while the haze follows the slower `level`.
+ * (`pulse`, the fast envelope) while the haze follows the slower `level`;
+ * - while the assistant THINKS, two beams of light glide along the bottom
+ * edge in opposite directions, part and meet again in the middle — the
+ * light keeps working while nobody speaks.
*
* Colour is the theme's accent: deep in the haze, lifted toward white in the
* core. On paper (light themes) the lift is smaller and the whole light
@@ -47,6 +50,8 @@ uniform float uPulse;
uniform float uPower;
uniform float uLight;
uniform float uSpan;
+uniform float uThink;
+uniform float uSweep;
uniform vec3 uColor;
float hash(vec2 p) {
@@ -97,7 +102,15 @@ void main() {
float dx = (uv.x - 0.5) / uSpan;
float dome = exp(-dx * dx * 1.4);
- float h = (0.34 + 0.42 * uLevel) * (0.6 + 0.8 * crest) * (0.3 + 0.7 * dome);
+ // Thinking: two beams mirrored about the middle. Screen-blended, not
+ // summed, so where they meet the light swells instead of blowing out.
+ float beamWidth = uSpan * 0.32;
+ float b1 = exp(-pow((uv.x - (0.5 + uSpan * 0.95 * uSweep)) / beamWidth, 2.0));
+ float b2 = exp(-pow((uv.x - (0.5 - uSpan * 0.95 * uSweep)) / beamWidth, 2.0));
+ float beams = (1.0 - (1.0 - b1) * (1.0 - b2)) * uThink;
+ float beam = beams * (exp(-y / 0.13) + 0.4 * exp(-y / 0.4));
+
+ float h = (1.0 + 0.7 * beams) * (0.34 + 0.42 * uLevel) * (0.6 + 0.8 * crest) * (0.3 + 0.7 * dome);
float body = exp(-pow(y / max(h, 0.02), 1.35) * 1.7);
float rays = smoothstep(0.2, 0.85, fbm(vec2(x * 2.6 + q.x * 2.2, y * 0.9 - t * 0.35)));
@@ -105,11 +118,11 @@ void main() {
float core = exp(-y / (0.05 + 0.1 * uPulse)) * dome;
- float a = body * shimmer * (0.3 + 0.7 * dome) + core * (0.2 + 0.6 * uPulse);
+ float a = body * shimmer * (0.3 + 0.7 * dome) + core * (0.2 + 0.6 * uPulse) + beam * 0.9;
a *= (0.3 + 0.7 * uPower) * (0.65 + 0.55 * uLevel);
a *= smoothstep(0.0, 0.12, uv.x) * (1.0 - smoothstep(0.88, 1.0, uv.x)) * (1.0 - smoothstep(0.45, 1.0, y));
- float lift = clamp(core * 0.8 + rays * body * 0.35, 0.0, 1.0);
+ float lift = clamp(core * 0.8 + beam * 0.7 + rays * body * 0.35, 0.0, 1.0);
vec3 deep = uColor * (0.75 + 0.25 * uLight);
vec3 bright = mix(uColor, vec3(1.0), 0.55 - 0.35 * uLight);
vec3 col = mix(deep, bright, lift);
@@ -128,6 +141,10 @@ export interface GlowFrame {
level: number;
/** Fast voice envelope 0..1: how hard the core flares. */
pulse: number;
+ /** 0..1: how far the thinking beams have faded in. */
+ think: number;
+ /** -1..1: where the thinking beams stand (mirrored about the middle). */
+ sweep: number;
/** 0 = resting wash, 1 = call open. */
power: number;
/** True on a light theme. */
@@ -220,6 +237,8 @@ export function createGlowRenderer(canvas: HTMLCanvasElement): GlowRenderer | nu
const uLight = u("uLight");
const uSpan = u("uSpan");
const uColor = u("uColor");
+ const uThink = u("uThink");
+ const uSweep = u("uSweep");
let cssWidth = 1;
let cssHeight = 1;
@@ -248,6 +267,8 @@ export function createGlowRenderer(canvas: HTMLCanvasElement): GlowRenderer | nu
gl.uniform1f(uLevel, frame.level);
gl.uniform1f(uPulse, frame.pulse);
gl.uniform1f(uPower, frame.power);
+ gl.uniform1f(uThink, frame.think);
+ gl.uniform1f(uSweep, frame.sweep);
gl.uniform1f(uLight, frame.light ? 1 : 0);
gl.uniform1f(uSpan, Math.min(0.45, SPAN_PX / cssWidth));
gl.uniform3f(uColor, frame.color[0] / 255, frame.color[1] / 255, frame.color[2] / 255);