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(agentic-ide): subtitle-style live transcript in the voice bubble

rubenluetke10-beep8f006671dd39
diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.test.tsx
index 4d7a32eaeb..449a614feb 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.test.tsx
@@ -372,6 +372,27 @@ describe("voice bubble", () => {
expect(screen.queryByTestId("voice-bubble-transcript")).toBeNull();
});
+ it("shows the streaming caret only while the sentence is provisional", () => {
+ storeState.voiceState = "listening";
+ storeState.transcription = "open the tests";
+ storeState.transcriptionFinal = false;
+ renderBubble();
+ expect(
+ screen
+ .getByTestId("voice-bubble-transcript")
+ .querySelector(".agentic-voice-transcript-caret"),
+ ).toBeTruthy();
+ cleanup();
+ // The recognizer committed — the "still writing" caret would be a lie.
+ storeState.transcriptionFinal = true;
+ renderBubble();
+ expect(
+ screen
+ .getByTestId("voice-bubble-transcript")
+ .querySelector(".agentic-voice-transcript-caret"),
+ ).toBeNull();
+ });
+
/*
* The bubble has no panel of its own. What that has to mean, mechanically, is
* that the space it spans keeps belonging to the terminals underneath — the
diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx
index bebc76f03d..16a0737e5e 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx
@@ -45,9 +45,11 @@
*/
import {
type DragEvent,
+ Fragment,
type PointerEvent as ReactPointerEvent,
useCallback,
useEffect,
+ useLayoutEffect,
useMemo,
useRef,
useState,
@@ -225,6 +227,10 @@ export function VoiceBubble({
const t = useT();
const { active, busy, connecting, toggleCall, voiceState } = useVoiceCall();
const transcription = useEventStore((s) => s.transcription) ?? "";
+ // Whether the recognizer has committed to the sentence. Partial text is
+ // provisional — the STT may still rewrite it — and the transcript styles the
+ // two honestly instead of pretending every intermediate guess is settled.
+ const transcriptionFinal = useEventStore((s) => s.transcriptionFinal !== false);
const assistantName =
(useEventStore((s) => s.assistantName) ?? "").trim() ||
t("agentic_grid.voice_bubble.assistant_fallback");
@@ -529,6 +535,50 @@ export function VoiceBubble({
[pushToast],
);
+ // ------------------------------------------------------------- transcript
+ // The transcript is shown only while a conversation runs and there is text —
+ // an idle bubble repeating the last sentence of a finished one would read as
+ // a stuck microphone. But a surface that BLINKS off the moment that stops
+ // being true reads as a glitch, so the last text is held as a ghost for one
+ // short fade-out and only then leaves the DOM. The ghost is a transition,
+ // not a memory: after ~250 ms the element is really gone.
+ const showTranscript = active && transcription.trim().length > 0;
+ const [transcriptGhost, setTranscriptGhost] = useState("");
+ useEffect(() => {
+ if (showTranscript) {
+ // Mirror while visible (a bail-out when unchanged), so the exact frame
+ // the transcript is dismissed already has the text to fade out with.
+ setTranscriptGhost(transcription);
+ return;
+ }
+ if (!transcriptGhost) return;
+ const timer = window.setTimeout(() => setTranscriptGhost(""), 260);
+ return () => window.clearTimeout(timer);
+ }, [showTranscript, transcription, transcriptGhost]);
+
+ const transcriptText = showTranscript ? transcription : transcriptGhost;
+ // Words carry their own spans so a NEW word can fade in while the already
+ // printed ones hold perfectly still — the word index keys them, and a word
+ // the recognizer revises re-mounts and visibly re-settles.
+ const transcriptWords = useMemo(
+ () => transcriptText.split(/\s+/).filter(Boolean),
+ [transcriptText],
+ );
+
+ // The window shows the TAIL of a long sentence, not the head: in a live
+ // transcript the newest words are the ones being listened for. An
+ // overflow-hidden block is still programmatically scrollable, so pinning
+ // scrollTop to the bottom is the whole mechanism — and the soft fade over
+ // the cropped top line exists only while something was actually cropped,
+ // measured here rather than guessed at in CSS.
+ const transcriptWindowRef = useRef<HTMLParagraphElement>(null);
+ useLayoutEffect(() => {
+ const el = transcriptWindowRef.current;
+ if (!el) return;
+ el.dataset.overflowing = el.scrollHeight > el.clientHeight + 1 ? "true" : "false";
+ el.scrollTop = el.scrollHeight;
+ }, [transcriptText]);
+
// After every hook: hooks must run in the same order on every render, so
// the bubble decides to be invisible down here, never above a hook.
if (!mounted || !pos) return null;
@@ -672,21 +722,41 @@ export function VoiceBubble({
</span>
</span>
- {/* What the microphone is hearing, as it hears it. Shown only while a
- conversation runs — an idle bubble repeating the last sentence of a
- finished one would read as a stuck microphone. */}
- {active && transcription && (
- <p
+ {/* What the microphone is hearing, as it hears it — set like a subtitle
+ under the orb. The pill spans the full column so the FRAME holds
+ still while words stream into it; only the text moves. Muted while
+ the recognizer is still guessing (plus a caret that says "still
+ writing"), brightening to foreground the moment the sentence is
+ final. Presence is animated both ways: see the ghost hooks above. */}
+ {transcriptText && (
+ <div
data-testid="voice-bubble-transcript"
data-drag-surface
+ data-leaving={showTranscript ? undefined : "true"}
className={cn(
BUBBLE_SURFACE,
- "line-clamp-3 max-w-full shrink-0 rounded-2xl px-3 py-2",
- "text-center text-[13px] leading-relaxed text-muted-foreground",
+ "agentic-voice-transcript w-full shrink-0 rounded-2xl px-3.5 py-2.5",
)}
>
- {transcription}
- </p>
+ <p
+ ref={transcriptWindowRef}
+ className={cn(
+ "agentic-voice-transcript-window break-words text-center text-[13px]",
+ "font-medium leading-relaxed transition-colors duration-300",
+ transcriptionFinal ? "text-foreground/90" : "text-muted-foreground",
+ )}
+ >
+ {transcriptWords.map((word, index) => (
+ <Fragment key={`${index}:${word}`}>
+ {index > 0 ? " " : null}
+ <span className="agentic-voice-transcript-word">{word}</span>
+ </Fragment>
+ ))}
+ {showTranscript && !transcriptionFinal && (
+ <span aria-hidden="true" className="agentic-voice-transcript-caret" />
+ )}
+ </p>
+ </div>
)}
{receipts.map((receipt) => (
diff --git a/jarvis/ui/web/frontend/src/index.css b/jarvis/ui/web/frontend/src/index.css
index b0f7fbfae2..2be38b1d0b 100644
--- a/jarvis/ui/web/frontend/src/index.css
+++ b/jarvis/ui/web/frontend/src/index.css
@@ -88,6 +88,56 @@
@apply bg-destructive;
}
+ /*
+ * The live transcript pill under the orb. Presence is animated both ways —
+ * it slides in from the status pill above it, and `data-leaving` (set while
+ * the ghost text fades, see VoiceBubble) plays the same move backwards
+ * before the element unmounts.
+ */
+ .agentic-voice-transcript {
+ animation: agentic-transcript-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
+ }
+
+ .agentic-voice-transcript[data-leaving="true"] {
+ animation: agentic-transcript-out 0.22s ease-out forwards;
+ }
+
+ /* A three-line window over the tail of the sentence. `lh` keeps the crop on
+ an exact line boundary whatever the font metrics resolve to; the fade mask
+ appears only when a line really was cropped (`data-overflowing` is
+ MEASURED in the component, CSS cannot know), so a short sentence keeps a
+ crisp top edge. */
+ .agentic-voice-transcript-window {
+ max-height: 3lh;
+ overflow: hidden;
+ }
+
+ .agentic-voice-transcript-window[data-overflowing="true"] {
+ -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1lh);
+ mask-image: linear-gradient(to bottom, transparent 0, #000 1lh);
+ }
+
+ /* inline-block, not inline: transforms do not apply to non-replaced inline
+ boxes, and an atomic box also stops a word from re-wrapping mid-animation. */
+ .agentic-voice-transcript-word {
+ display: inline-block;
+ animation: agentic-transcript-word 0.26s cubic-bezier(0.22, 1, 0.36, 1) backwards;
+ }
+
+ /* The "still writing" caret shown while the recognizer has not committed to
+ the sentence. App accent on purpose — same rule as the ring and the dot:
+ everything drawn around the sphere belongs to the interface. */
+ .agentic-voice-transcript-caret {
+ @apply bg-primary;
+ display: inline-block;
+ width: 2px;
+ height: 0.85em;
+ margin-left: 0.2em;
+ vertical-align: -0.08em;
+ border-radius: 9999px;
+ animation: agentic-transcript-caret 1.05s ease-in-out infinite;
+ }
+
@keyframes agentic-orb-wave {
0% {
opacity: 0.62;
@@ -136,9 +186,44 @@
}
}
+ @keyframes agentic-transcript-in {
+ from {
+ opacity: 0;
+ transform: translateY(-4px) scale(0.97);
+ }
+ }
+
+ @keyframes agentic-transcript-out {
+ to {
+ opacity: 0;
+ transform: translateY(-4px) scale(0.97);
+ }
+ }
+
+ @keyframes agentic-transcript-word {
+ from {
+ opacity: 0;
+ transform: translateY(3px);
+ filter: blur(3px);
+ }
+ }
+
+ @keyframes agentic-transcript-caret {
+ 0%,
+ 100% {
+ opacity: 1;
+ }
+ 50% {
+ opacity: 0.25;
+ }
+ }
+
@media (prefers-reduced-motion: reduce) {
.agentic-voice-orb-ring,
- .agentic-voice-state-dot {
+ .agentic-voice-state-dot,
+ .agentic-voice-transcript,
+ .agentic-voice-transcript-word,
+ .agentic-voice-transcript-caret {
animation: none !important;
}