Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

feat(frontend): refresh brain dump recording with an animated AutoPilot (#14463)

Abhimanyu Yadav213fb840b42c
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/brain-dump.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/brain-dump.test.tsx
index 9b2fc4959d..e4e437b745 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/brain-dump.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/brain-dump.test.tsx
@@ -105,6 +105,7 @@ vi.mock("posthog-js", () => ({
vi.mock("../steps/WelcomeStep", () => ({
WelcomeStep: () => <div data-testid="step-welcome" />,
}));
+
vi.mock("../steps/RoleStep", () => ({
RoleStep: () => <div data-testid="step-role" />,
}));
@@ -167,6 +168,8 @@ vi.mock("@/services/feature-flags/use-get-flag", () => ({
Flag: {
ENABLE_PLATFORM_PAYMENT: "enable-platform-payment",
ONBOARDING_BRAIN_DUMP: "onboarding-brain-dump",
+ ONBOARDING_EXPERT_TEAM: "onboarding-expert-team",
+ HIRE_EXPERTS: "hire-experts",
},
useGetFlag: (flag: string) => mockFlags[flag] ?? false,
}));
@@ -180,7 +183,8 @@ vi.mock("launchdarkly-react-client-sdk", () => ({
const STEP_STORAGE_KEY = "autogpt:onboarding-highest-step";
const INTRO_PATH_KEY = "autogpt:onboarding-intro-path";
const PILLBOX_HEADING = "What's eating your time?";
-const DUMP_HEADLINE = "What keeps stealing your week?";
+const DUMP_HEADLINE = "Talk to me about your work";
+const TYPING_HEADLINE = "Write to me about your work";
class FakeMediaRecorder {
static isTypeSupported() {
@@ -295,6 +299,12 @@ function recordBrainDumpTraffic() {
return HttpResponse.json({});
},
),
+ // Answered by default so the preparing step's team gate never stalls a
+ // wizard test; the section itself is exercised on the greeting page.
+ http.get(
+ "http://localhost:3000/api/proxy/api/onboarding/brain-dump/recommended-experts",
+ () => HttpResponse.json({ ready: true, team: null }),
+ ),
);
return calls;
}
@@ -360,39 +370,19 @@ describe("onboarding brain dump — flag gating", () => {
render(<OnboardingPage />);
expect(await screen.findByText(DUMP_HEADLINE)).toBeDefined();
- expect(screen.getByRole("button", { name: "Start talking" })).toBeDefined();
- expect(screen.queryByTestId("orb-progress-ring")).toBeNull();
+ expect(screen.getByRole("button", { name: "Talk" })).toBeDefined();
expect(screen.queryByText(PILLBOX_HEADING)).toBeNull();
});
- it("renders the original orb with reactive audio bars", async () => {
+ it("renders AutoPilot as the visual, waiting at rest", async () => {
mockFlags = { "onboarding-brain-dump": true };
landOnPainPointsStep();
render(<OnboardingPage />);
- expect(await screen.findByTestId("orb-current")).toBeDefined();
- expect(screen.getByTestId("orb-frame").style.width).toBe("184px");
- expect(screen.getByTestId("orb-decorative-ring")).toBeDefined();
- expect(screen.getByTestId("orb-audio-bars")).toBeDefined();
- const audioBars = screen.getAllByTestId("orb-audio-bar");
- expect(audioBars).toHaveLength(5);
- expect(audioBars.map((bar) => bar.style.height)).toEqual([
- "22px",
- "34px",
- "46px",
- "34px",
- "22px",
- ]);
- expect(audioBars.map((bar) => bar.style.transform)).toEqual([
- "scaleY(0.48)",
- "scaleY(0.58)",
- "scaleY(0.72)",
- "scaleY(0.58)",
- "scaleY(0.48)",
- ]);
- expect(screen.queryByRole("combobox", { name: "Orb style" })).toBeNull();
- expect(screen.getByRole("button", { name: "Start talking" })).toBeDefined();
+ const avatar = await screen.findByTestId("autopilot-avatar");
+ expect(avatar.dataset.screen).toBe("rest");
+ expect(screen.getByRole("button", { name: "Talk" })).toBeDefined();
});
it("leaves the pillboxes untouched and makes no brain-dump request when the flag is off", async () => {
@@ -407,7 +397,7 @@ describe("onboarding brain dump — flag gating", () => {
screen.getByText("Pick the tasks you'd love to hand off to AutoPilot"),
).toBeDefined();
expect(screen.queryByText(DUMP_HEADLINE)).toBeNull();
- expect(screen.queryByRole("button", { name: "Start talking" })).toBeNull();
+ expect(screen.queryByRole("button", { name: "Talk" })).toBeNull();
expect(screen.queryByText("Skip for now")).toBeNull();
// Give any stray effect a chance to fire before declaring silence.
@@ -434,7 +424,7 @@ describe("onboarding brain dump — flag gating", () => {
});
describe("onboarding brain dump — typed fallback", () => {
- it("opens the typed composer under the same headline when mic permission is denied", async () => {
+ it("opens the typed composer under a writing headline when mic permission is denied", async () => {
getUserMedia.mockRejectedValue(
new DOMException("denied", "NotAllowedError"),
);
@@ -444,24 +434,22 @@ describe("onboarding brain dump — typed fallback", () => {
render(<OnboardingPage />);
await screen.findByText(DUMP_HEADLINE);
- await userEvent.click(
- screen.getByRole("button", { name: "Start talking" }),
- );
+ await userEvent.click(screen.getByRole("button", { name: "Talk" }));
expect(
await screen.findByPlaceholderText(
"What repeats every week? What would you hand off first?",
),
).toBeDefined();
- // Same headline, not a dead end.
- expect(screen.getByText(DUMP_HEADLINE)).toBeDefined();
- expect(screen.queryByRole("button", { name: "Start talking" })).toBeNull();
+ // The headline turns to writing; the step itself is not a dead end.
+ expect(screen.getByText(TYPING_HEADLINE)).toBeDefined();
+ expect(screen.queryByRole("button", { name: "Talk" })).toBeNull();
// Offering a way back to the orb would be a dead end here: the browser
// has already refused the microphone.
expect(screen.queryByRole("button", { name: "record instead" })).toBeNull();
});
- it("opens the typed composer from the rest state via 'type instead'", async () => {
+ it("opens the typed composer from the rest state via Write", async () => {
mockFlags = { "onboarding-brain-dump": true };
landOnPainPointsStep();
@@ -473,7 +461,7 @@ describe("onboarding brain dump — typed fallback", () => {
),
).toBeNull();
- await userEvent.click(screen.getByRole("button", { name: "type instead" }));
+ await userEvent.click(screen.getByRole("button", { name: "Write" }));
expect(
await screen.findByPlaceholderText(
@@ -530,10 +518,12 @@ describe("onboarding brain dump — finishing a take", () => {
render(<OnboardingPage />);
await screen.findByText(DUMP_HEADLINE);
- await userEvent.click(
- screen.getByRole("button", { name: "Start talking" }),
+ await userEvent.click(screen.getByRole("button", { name: "Talk" }));
+ await waitFor(() =>
+ expect(screen.getByTestId("autopilot-avatar").dataset.screen).toBe(
+ "recording",
+ ),
);
- expect(await screen.findByTestId("orb-progress-ring")).toBeDefined();
await waitFor(() => expect(partUploads).toHaveLength(1));
await userEvent.click(
await screen.findByRole("button", { name: "Send recording" }),
@@ -577,9 +567,7 @@ describe("onboarding brain dump — finishing a take", () => {
await screen.findByText(DUMP_HEADLINE);
expect(screen.getByRole("button", { name: "Skip for now" })).toBeDefined();
- await userEvent.click(
- screen.getByRole("button", { name: "Start talking" }),
- );
+ await userEvent.click(screen.getByRole("button", { name: "Talk" }));
await waitFor(() => expect(partUploads).toHaveLength(1));
await userEvent.click(
await screen.findByRole("button", { name: "Send recording" }),
@@ -605,9 +593,7 @@ describe("onboarding brain dump — finishing a take", () => {
render(<OnboardingPage />);
await screen.findByText(DUMP_HEADLINE);
- await userEvent.click(
- screen.getByRole("button", { name: "Start talking" }),
- );
+ await userEvent.click(screen.getByRole("button", { name: "Talk" }));
await userEvent.click(
await screen.findByRole("button", { name: "Cancel recording" }),
);
@@ -669,9 +655,7 @@ describe("onboarding brain dump — finishing a take", () => {
await waitFor(() => expect(finishDiscard).toBeDefined());
finishDiscard!();
- expect(
- await screen.findByRole("button", { name: "Start talking" }),
- ).toBeDefined();
+ expect(await screen.findByRole("button", { name: "Talk" })).toBeDefined();
});
});
@@ -737,7 +721,7 @@ describe("onboarding brain dump — recovery", () => {
await waitFor(() =>
expect(screen.queryByText("Pick up where you left off?")).toBeNull(),
);
- expect(screen.getByRole("button", { name: "Start talking" })).toBeDefined();
+ expect(screen.getByRole("button", { name: "Talk" })).toBeDefined();
});
});
@@ -765,9 +749,7 @@ describe("onboarding brain dump — failure", () => {
render(<OnboardingPage />);
await screen.findByText(DUMP_HEADLINE);
- await userEvent.click(
- screen.getByRole("button", { name: "Start talking" }),
- );
+ await userEvent.click(screen.getByRole("button", { name: "Talk" }));
// Wait for the first chunk to reach the server so sending is not
// racing the upload queue.
await waitFor(() => expect(partUploads).toHaveLength(1));
@@ -819,9 +801,7 @@ describe("onboarding brain dump — insufficient content", () => {
render(<OnboardingPage />);
await screen.findByText(DUMP_HEADLINE);
- await userEvent.click(
- screen.getByRole("button", { name: "Start talking" }),
- );
+ await userEvent.click(screen.getByRole("button", { name: "Talk" }));
await waitFor(() => expect(partUploads).toHaveLength(1));
await userEvent.click(
await screen.findByRole("button", { name: "Send recording" }),
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/BrainDumpStep.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/BrainDumpStep.tsx
index e69d37618b..4c3a17efeb 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/BrainDumpStep.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/BrainDumpStep.tsx
@@ -1,25 +1,24 @@
"use client";
-import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
import { Button } from "@/components/atoms/Button/Button";
import { Text } from "@/components/atoms/Text/Text";
import { cn } from "@/lib/utils";
+import { ElapsedTime } from "./components/ElapsedTime";
import { FailureState } from "./components/FailureState";
import { InsufficientState } from "./components/InsufficientState";
-import { DEFAULT_GLASS_PARAMS } from "@/components/molecules/GlassOrb/GlassSurface";
-import { ElapsedTime } from "./components/ElapsedTime";
import { MicButton, OrbScreen } from "./components/MicButton";
import { PrivacyNote } from "./components/PrivacyNote";
import { RecordingControls } from "./components/RecordingControls/RecordingControls";
import { RecoveryPrompt } from "./components/RecoveryPrompt";
+import { RestActions } from "./components/RestActions";
import { RevealGroup, RevealItem } from "@/components/atoms/Reveal/Reveal";
import { SwapFade } from "@/components/atoms/SwapFade/SwapFade";
import { TypedFallback } from "./components/TypedFallback";
import { OrbControlButton } from "./components/OrbControlButton";
-import { ringProgress } from "./helpers";
import { ScreenState, useBrainDumpStep } from "./useBrainDumpStep";
const FAILURE_HEADLINE = "That didn't go through.";
+const TYPING_HEADLINE = "Write to me about your work";
// "Catch" fits a mishearing, not a typed answer — the typed reject asks
// for more instead of implying the system misheard.
const INSUFFICIENT_HEADLINES = {
@@ -31,12 +30,11 @@ const TIME_LIMIT_CAPTION =
export function BrainDumpStep() {
const dump = useBrainDumpStep();
- const prefersReducedMotion = useReducedMotion();
const isRecording = dump.screen === "recording";
const isProcessing = dump.screen === "processing";
const isMicScreen = dump.screen === "rest" || isRecording;
const isTyping = dump.screen === "typing";
- const showSubline =
+ const showPrivacyNote =
dump.screen !== "failed" &&
dump.screen !== "recovery" &&
dump.screen !== "insufficient";
@@ -52,35 +50,12 @@ export function BrainDumpStep() {
return (
<>
- <AnimatePresence>
- {isRecording && (
- <motion.div
- className="fixed inset-0 z-40 bg-[#F6F7F8]/90 backdrop-blur-xl"
- initial={{ opacity: 0 }}
- animate={{ opacity: 1 }}
- exit={{ opacity: 0 }}
- transition={{ duration: 0.2, ease: "easeOut" }}
- aria-hidden
- />
- )}
- </AnimatePresence>
-
<RevealGroup
- className={
- isRecording
- ? "fixed inset-0 z-50 flex w-full flex-col items-center justify-center px-4"
- : cn(
- "-mt-44 flex w-full flex-col items-center gap-12 px-4",
- isTyping ? "max-w-4xl" : "max-w-2xl",
- )
- }
- >
- {isRecording && (
- <div className="absolute left-1/2 top-8 -translate-x-1/2">
- <ElapsedTime seconds={dump.elapsedSeconds} />
- </div>
+ className={cn(
+ "-mt-44 flex w-full flex-col items-center gap-8 px-4",
+ isTyping ? "w-[calc(100vw-3rem)] max-w-3xl" : "max-w-2xl",
)}
-
+ >
<div
className={cn(
"absolute right-4 top-4 flex items-center gap-2 sm:right-6 sm:top-6 sm:gap-5",
@@ -91,76 +66,78 @@ export function BrainDumpStep() {
behind the finalize that is already in flight, landing past
the last step on a blank screen. */}
{!isProcessing && (
- <button
+ <Button
type="button"
+ variant="ghost"
+ size="xs"
onClick={dump.handleSkip}
- className="text-sm text-zinc-400 transition-colors hover:text-zinc-700"
+ className="text-zinc-400 hover:text-zinc-700"
>
Skip for now
- </button>
+ </Button>
)}
</div>
- <div
- className={cn(
- "mx-auto flex w-full max-w-2xl flex-col items-center gap-2 px-4 text-center",
- isRecording && "hidden",
- )}
- >
+ <div className="mx-auto flex w-full max-w-2xl flex-col items-center gap-2 px-4 text-center">
<RevealItem>
- <Text variant="h4">
- {stateHeadline(dump.screen, dump.headline, dump.insufficientMode)}
- </Text>
+ <SwapFade
+ swapKey={isRecording ? "timer" : "headline"}
+ className="flex h-10 items-center justify-center"
+ >
+ {isRecording ? (
+ <ElapsedTime seconds={dump.elapsedSeconds} />
+ ) : (
+ <Text variant="h4">
+ {stateHeadline(
+ dump.screen,
+ dump.headline,
+ dump.insufficientMode,
+ )}
+ </Text>
+ )}
+ </SwapFade>
</RevealItem>
- {showSubline && (
- <RevealItem>
- <Text
- variant="large"
- className="!text-zinc-500 md:whitespace-nowrap"
- >
- Just talk.{" "}
- <span className="bg-gradient-to-r from-purple-500 to-indigo-500 bg-clip-text text-transparent">
- AutoPilot
- </span>{" "}
- listens, remembers, and starts taking work off your plate.
- </Text>
- </RevealItem>
- )}
</div>
{orbScreen && (
- <RevealItem blur={false} className="flex flex-col items-center gap-4">
- <motion.div
- animate={{
- scale: isRecording ? (prefersReducedMotion ? 1.12 : 1.3) : 1,
- }}
- transition={{
- duration: prefersReducedMotion ? 0.15 : 0.28,
- ease: [0.32, 0.72, 0, 1],
- }}
- >
- <MicButton
- screen={orbScreen}
- progress={ringProgress(dump.elapsedSeconds)}
- audioStream={dump.audioStream}
- glassParams={DEFAULT_GLASS_PARAMS}
- />
- </motion.div>
- {orbScreen === "recording" ? (
- <RecordingControls
- onStop={dump.handleStop}
- onSend={dump.handleDone}
- onRetry={dump.handleRestart}
- elapsedSeconds={dump.elapsedSeconds}
- showSilenceNudge={dump.showSilenceNudge}
- isOffline={dump.isOffline}
- />
- ) : orbScreen !== "processing" ? (
- <OrbControlButton
- screen={orbScreen}
- onClick={orbClick(orbScreen)}
- />
- ) : null}
+ <RevealItem
+ blur={false}
+ className="flex w-full flex-col items-center gap-4"
+ >
+ <MicButton screen={orbScreen} audioStream={dump.audioStream} />
+ {/* One fixed-height slot holds whichever control the screen
+ needs, so switching between the mic, the recording controls
+ and the composer never moves the avatar or the headline. */}
+ <div className="flex min-h-[236px] w-full flex-col items-center">
+ {isTyping ? (
+ <TypedFallback
+ value={dump.typedText}
+ onChange={dump.setTypedText}
+ onSubmit={dump.handleSubmitTyped}
+ />
+ ) : isRecording ? (
+ <RecordingControls
+ onStop={dump.handleStop}
+ onSend={dump.handleDone}
+ onRetry={dump.handleRestart}
+ elapsedSeconds={dump.elapsedSeconds}
+ showSilenceNudge={dump.showSilenceNudge}
+ isOffline={dump.isOffline}
+ />
+ ) : orbScreen === "rest" ? (
+ <RestActions
+ onTalk={dump.handleStart}
+ onWrite={dump.showTyping}
+ />
+ ) : (
+ orbScreen === "failed" && (
+ <OrbControlButton
+ screen={orbScreen}
+ onClick={orbClick(orbScreen)}
+ />
+ )
+ )}
+ </div>
{/* Both slots keep their height across rest → recording →
processing, so advancing a screen swaps their contents without
nudging the orb or the headline. Failure has its own layout
@@ -214,16 +191,6 @@ export function BrainDumpStep() {
/>
</RevealItem>
)}
-
- {dump.screen === "typing" && (
- <RevealItem className="w-full">
- <TypedFallback
- value={dump.typedText}
- onChange={dump.setTypedText}
- onSubmit={dump.handleSubmitTyped}
- />
- </RevealItem>
- )}
</RevealGroup>
{/* Viewport-anchored, and kept outside the reveal group: an ancestor
@@ -236,10 +203,10 @@ export function BrainDumpStep() {
dump.screen === "recovery") && (
<div className="fixed inset-x-0 bottom-32 flex justify-center px-4">
<SwapFade swapKey={dump.screen}>
- {(dump.screen === "rest" || dump.screen === "failed") && (
+ {dump.screen === "failed" && (
<Button
variant="ghost"
- size="small"
+ size="xs"
onClick={dump.showTyping}
className="underline underline-offset-4"
>
@@ -249,7 +216,7 @@ export function BrainDumpStep() {
{isTyping && !dump.isMicBlocked && (
<Button
variant="ghost"
- size="small"
+ size="xs"
onClick={dump.showRecording}
className="underline underline-offset-4"
>
@@ -259,7 +226,7 @@ export function BrainDumpStep() {
{dump.screen === "recovery" && (
<Button
variant="ghost"
- size="small"
+ size="xs"
onClick={dump.handleTypeInsteadOfRecovered}
className="underline underline-offset-4"
>
@@ -270,7 +237,7 @@ export function BrainDumpStep() {
</div>
)}
- {showSubline && !isRecording && <PrivacyNote />}
+ {showPrivacyNote && !isRecording && <PrivacyNote />}
</>
);
}
@@ -278,8 +245,9 @@ export function BrainDumpStep() {
function toOrbScreen(screen: ScreenState): OrbScreen | null {
// "insufficient" gets no orb: the orb's failed state retries the same
// take, and re-submitting a rejected take can only be rejected again.
- if (screen === "typing" || screen === "recovery" || screen === "insufficient")
- return null;
+ // Typing keeps the resting avatar and swaps only the control under it.
+ if (screen === "recovery" || screen === "insufficient") return null;
+ if (screen === "typing") return "rest";
return screen;
}
@@ -289,6 +257,7 @@ function stateHeadline(
insufficientMode: "voice" | "typed",
) {
if (screen === "failed") return FAILURE_HEADLINE;
+ if (screen === "typing") return TYPING_HEADLINE;
if (screen === "insufficient")
return INSUFFICIENT_HEADLINES[insufficientMode];
return restHeadline;
@@ -303,7 +272,7 @@ function OrbCaption({
}) {
if (screen === "processing") {
return (
- <Text variant="lead" className="!text-base !text-zinc-500">
+ <Text variant="body" tone="muted">
{reachedTimeLimit ? TIME_LIMIT_CAPTION : "Got it. One second…"}
</Text>
);
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/__tests__/helpers.test.ts
index 60d24e1c6e..fcacf371c1 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/__tests__/helpers.test.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/__tests__/helpers.test.ts
@@ -2,25 +2,12 @@ import { afterEach, describe, expect, it, vi } from "vitest";
import {
encouragementAt,
formatElapsed,
- headline,
isInsufficientDump,
isPermissionDenied,
pickMimeType,
recordingFeedbackAt,
- RING_TARGET_SECONDS,
- ringProgress,
} from "../helpers";
-describe("headline", () => {
- it("greets by name and trims the stored value", () => {
- expect(headline(" Ada ")).toBe("What keeps stealing your week, Ada?");
- });
-
- it("drops the name when the wizard never collected one", () => {
- expect(headline(" ")).toBe("What keeps stealing your week?");
- });
-});
-
describe("encouragementAt", () => {
it("shows nothing before the first line is due", () => {
expect(encouragementAt(0)).toBeNull();
@@ -80,17 +67,6 @@ describe("formatElapsed", () => {
});
});
-describe("ringProgress", () => {
- // A depth meter, not a limit: the ring holds at full and recording
- // carries on past it.
- it("fills toward the target and then holds", () => {
- expect(ringProgress(0)).toBe(0);
- expect(ringProgress(RING_TARGET_SECONDS / 2)).toBeCloseTo(0.5, 5);
- expect(ringProgress(RING_TARGET_SECONDS)).toBe(1);
- expect(ringProgress(RING_TARGET_SECONDS * 10)).toBe(1);
- });
-});
-
describe("pickMimeType", () => {
afterEach(() => {
vi.unstubAllGlobals();
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/__tests__/useBrainDumpStep.test.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/__tests__/useBrainDumpStep.test.ts
index 1f4e2e3028..6f25dc8b2c 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/__tests__/useBrainDumpStep.test.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/__tests__/useBrainDumpStep.test.ts
@@ -144,12 +144,10 @@ afterEach(() => {
});
describe("useBrainDumpStep — headline", () => {
- it("uses the name the wizard already collected", async () => {
- useOnboardingWizardStore.getState().setName("Ada");
-
+ it("asks about the user's work", async () => {
const { result } = await renderStep();
- expect(result.current.headline).toBe("What keeps stealing your week, Ada?");
+ expect(result.current.headline).toBe("Talk to me about your work");
});
});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/FailureState.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/FailureState.tsx
index 1aa689041f..fae3291047 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/FailureState.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/FailureState.tsx
@@ -15,7 +15,7 @@ interface Props {
export function FailureState({ onDownload, onSkip }: Props) {
return (
<div className="flex flex-col items-center gap-4 text-center">
- <Text variant="lead" className="!text-base !text-zinc-500">
+ <Text variant="body" tone="muted">
Your recording is safe. Try again.
</Text>
<div className="flex items-center gap-3">
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/InsufficientState.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/InsufficientState.tsx
index 2489c4005a..85b14a1c2c 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/InsufficientState.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/InsufficientState.tsx
@@ -29,7 +29,7 @@ export function InsufficientState({
role="alert"
className="flex max-w-md flex-col items-center gap-4 text-center"
>
- <Text variant="lead" className="!text-base !text-zinc-500">
+ <Text variant="body" tone="muted">
{mode === "voice"
? "We heard you, but there wasn't enough about your work to " +
"personalize things yet. A few sentences about what you do — " +
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/MicButton.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/MicButton.tsx
index 8af6975bb6..9a71424e0f 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/MicButton.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/MicButton.tsx
@@ -1,27 +1,194 @@
-import { GlassParams } from "@/components/molecules/GlassOrb/GlassSurface";
-import { OrbFrame } from "./OrbFrame";
+"use client";
+
+import { BotAvatar } from "@/components/molecules/BotAvatar/BotAvatar";
+import {
+ AUTOPILOT_AVATAR,
+ type AvatarStatus,
+ findColor,
+ findShape,
+ VIEWBOX,
+} from "@/components/molecules/BotAvatar/helpers";
+import {
+ animate,
+ type AnimationPlaybackControls,
+ motion,
+ useMotionValue,
+ useReducedMotion,
+ useTransform,
+} from "framer-motion";
+import { useEffect, useState } from "react";
+import { useAudioBars } from "./useAudioBars";
+import { useSimulatedVoice } from "./useSimulatedVoice";
+import { VoiceAura } from "./VoiceAura";
+import { DOT, VoiceDots } from "./VoiceDots";
export type OrbScreen = "rest" | "recording" | "processing" | "failed";
+const AVATAR_SIZE = 160;
+const ANCHORS = findShape(AUTOPILOT_AVATAR.shape).anchors;
+const SCALE = AVATAR_SIZE / VIEWBOX;
+// The body collapses into, and grows back out of, its own centre.
+const CENTRE = {
+ x: ANCHORS.cx * SCALE,
+ y: ((ANCHORS.top + ANCHORS.bottom) / 2) * SCALE,
+};
+const DOT_COLOR = findColor(AUTOPILOT_AVATAR.color).body;
+// Quick and near-critically damped: fast in, a whisper of settle, no wobble.
+const COLLAPSE = {
+ type: "spring",
+ stiffness: 520,
+ damping: 32,
+ mass: 0.7,
+} as const;
+const SPLIT = {
+ type: "spring",
+ stiffness: 560,
+ damping: 30,
+ mass: 0.7,
+} as const;
+// A full tumble on the avatar's pitch axis, overlapping the fold so the
+// body is mid-flip as it becomes the dot.
+const TUMBLE = { duration: 0.45, ease: [0.32, 0.72, 0, 1] } as const;
+const REDUCED = { duration: 0.15 } as const;
+// The next stage starts this soon after the previous one begins, so the
+// stages overlap instead of waiting for each bounce to die down.
+const OVERLAP_MS = 120;
+
+const STATUS_BY_SCREEN: Record<OrbScreen, AvatarStatus> = {
+ rest: "idle",
+ recording: "idle",
+ processing: "working",
+ failed: "failed",
+};
+
interface Props {
screen: OrbScreen;
- progress: number;
audioStream: MediaStream | null;
- glassParams: GlassParams;
+ outline?: boolean;
+ // Fakes a voice so the dots can be seen moving without a microphone.
+ simulateVoice?: boolean;
}
+// AutoPilot is the whole visual. Opening the mic folds the body into a
+// single dot at its centre, with the comet wave orbiting only while it
+// folds; the dot then splits into a row of four that move with the voice.
+// Closing the mic runs it backwards: the dots merge, then the body grows
+// back with the wave around it.
export function MicButton({
screen,
- progress,
audioStream,
- glassParams,
+ outline = false,
+ simulateVoice = false,
}: Props) {
+ const isRecording = screen === "recording";
+ const reduceMotion = useReducedMotion() === true;
+ const micLevels = useAudioBars(isRecording ? audioStream : null);
+ const fakeLevels = useSimulatedVoice(isRecording && simulateVoice);
+ const levels = simulateVoice ? fakeLevels : micLevels;
+
+ const collapse = useMotionValue(0);
+ const split = useMotionValue(0);
+ const pitch = useMotionValue(0);
+ // The avatar re-projects its face from this on every frame of a tumble.
+ const [pitchOffset, setPitchOffset] = useState(0);
+ const [isFolding, setIsFolding] = useState(false);
+
+ useEffect(() => {
+ if (reduceMotion) {
+ pitch.set(0);
+ setPitchOffset(0);
+ }
+ const target = isRecording ? 1 : 0;
+ if (collapse.get() === target && split.get() === target) {
+ setIsFolding(false);
+ return;
+ }
+ let pauseTimer: ReturnType<typeof setTimeout> | undefined;
+ const running: AnimationPlaybackControls[] = [];
+ let cancelled = false;
+ const step = (value: typeof collapse, to: number, physics: object) => {
+ const controls = animate(value, to, reduceMotion ? REDUCED : physics);
+ running.push(controls);
+ return controls;
+ };
+ const tumble = (direction: 1 | -1) => {
+ if (reduceMotion) return;
+ running.push(
+ animate(pitch, direction === 1 ? Math.PI * 2 : 0, {
+ ...TUMBLE,
+ onUpdate: (value) => setPitchOffset(value),
+ }),
+ );
+ };
+ const pause = () =>
+ new Promise<void>((resolve) => {
+ pauseTimer = setTimeout(resolve, OVERLAP_MS);
+ });
+ async function fold() {
+ setIsFolding(true);
+ tumble(1);
+ step(collapse, 1, COLLAPSE).then(() => {
+ if (!cancelled) setIsFolding(false);
+ });
+ await pause();
+ if (cancelled) return;
+ step(split, 1, SPLIT);
+ }
+ async function unfold() {
+ step(split, 0, SPLIT);
+ await pause();
+ if (cancelled) return;
+ setIsFolding(true);
+ tumble(-1);
+ step(collapse, 0, COLLAPSE).then(() => {
+ if (!cancelled) setIsFolding(false);
+ });
+ }
+ void (isRecording ? fold() : unfold());
+ return () => {
+ cancelled = true;
+ clearTimeout(pauseTimer);
+ running.forEach((controls) => controls.stop());
+ };
+ }, [isRecording, reduceMotion, collapse, split, pitch]);
+
+ const bodyScale = useTransform(collapse, [0, 1], [1, DOT / AVATAR_SIZE]);
+ const bodyOpacity = useTransform(collapse, [0, 0.55, 1], [1, 1, 0]);
+
return (
- <OrbFrame
- glassParams={glassParams}
- audioStream={audioStream}
- progress={screen === "recording" ? progress : undefined}
- isLoading={screen === "processing"}
- />
+ <div data-testid="autopilot-avatar" data-screen={screen}>
+ <VoiceAura
+ config={AUTOPILOT_AVATAR}
+ size={AVATAR_SIZE}
+ levels={levels}
+ isActive={isFolding && !reduceMotion}
+ >
+ <motion.div
+ style={{
+ scale: bodyScale,
+ opacity: bodyOpacity,
+ transformOrigin: `${CENTRE.x}px ${CENTRE.y}px`,
+ willChange: "transform, opacity",
+ }}
+ >
+ <BotAvatar
+ config={AUTOPILOT_AVATAR}
+ status={STATUS_BY_SCREEN[screen]}
+ size={AVATAR_SIZE}
+ poseOffset={{ pitch: pitchOffset }}
+ outline={outline}
+ showBadge={false}
+ />
+ </motion.div>
+ <VoiceDots
+ levels={levels}
+ collapse={collapse}
+ split={split}
+ centre={CENTRE}
+ color={DOT_COLOR}
+ reduceMotion={reduceMotion}
+ />
+ </VoiceAura>
+ </div>
);
}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/OrbControlButton.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/OrbControlButton.tsx
index 1db9296f52..3de75ba861 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/OrbControlButton.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/OrbControlButton.tsx
@@ -8,13 +8,18 @@ import {
Mic01Icon,
} from "@hugeicons/core-free-icons";
+const LABELS = {
+ rest: "Start talking",
+ failed: "Try again",
+} as const;
+
interface Props {
- screen: "rest" | "failed";
+ screen: keyof typeof LABELS;
onClick?: () => void;
}
export function OrbControlButton({ screen, onClick }: Props) {
- const ariaLabel = screen === "failed" ? "Try again" : "Start talking";
+ const ariaLabel = LABELS[screen];
return (
<Button
@@ -22,7 +27,7 @@ export function OrbControlButton({ screen, onClick }: Props) {
size="icon"
onClick={onClick}
aria-label={ariaLabel}
- className="mt-4 border border-black/5 bg-white shadow-sm hover:border-black/5 hover:bg-zinc-50"
+ className="mt-4 border border-zinc-200 bg-white hover:border-zinc-300 hover:bg-zinc-50"
>
<SwapFade swapKey={screen} className="flex items-center justify-center">
{screen === "failed" ? (
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/OrbFrame.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/OrbFrame.tsx
deleted file mode 100644
index 745d5723ac..0000000000
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/OrbFrame.tsx
+++ /dev/null
@@ -1,105 +0,0 @@
-"use client";
-
-import { GlassParams } from "@/components/molecules/GlassOrb/GlassSurface";
-import { OrbVisual } from "./OrbVisual";
-import { useAudioBars } from "./useAudioBars";
-
-export const ORB_SIZE = 184;
-const STROKE = 6;
-const RADIUS = (ORB_SIZE - STROKE) / 2;
-const CIRCUMFERENCE = 2 * Math.PI * RADIUS;
-
-// A quarter of the ring, so the gap reads as motion rather than a dotted line.
-const LOADER_ARC = CIRCUMFERENCE * 0.25;
-
-interface Props {
- glassParams: GlassParams;
- audioStream: MediaStream | null;
- // Omitted when there is nothing to meter — the arc is not rendered at all.
- progress?: number;
- // Indeterminate: a single arc chasing the ring while work is in flight.
- isLoading?: boolean;
-}
-
-// The orb as it appears everywhere in this step: the same glass ball seated
-// in the same neumorphic ring, whether or not it is interactive.
-export function OrbFrame({
- glassParams,
- audioStream,
- progress,
- isLoading,
-}: Props) {
- const isRecording = progress !== undefined;
- const audioBars = useAudioBars(isRecording ? audioStream : null);
-
- return (
- <div
- data-testid="orb-frame"
- className="relative"
- style={{ width: ORB_SIZE, height: ORB_SIZE }}
- >
- <div
- data-testid="orb-decorative-ring"
- className="pointer-events-none absolute rounded-full bg-[#f1f1f4]"
- style={{
- inset: -glassParams.ringWidth,
- boxShadow: `${glassParams.ringDepth}px ${glassParams.ringDepth}px ${glassParams.ringDepth * 2.3}px rgba(166,171,189,${glassParams.ringDark}), -${glassParams.ringDepth}px -${glassParams.ringDepth}px ${glassParams.ringDepth * 2.3}px #ffffff, inset 1px 1px 3px rgba(255,255,255,0.95), inset -1px -1px 3px rgba(166,171,189,${glassParams.ringDark * 0.55})`,
- }}
- />
- {/* A depth meter, not a limit — the ring fills toward three minutes
- and then simply holds, so passing it reads as an achievement
- rather than a warning. */}
- {progress !== undefined && (
- <svg
- data-testid="orb-progress-ring"
- className="pointer-events-none absolute inset-0 -rotate-90"
- width={ORB_SIZE}
- height={ORB_SIZE}
- aria-hidden
- >
- <circle
- cx={ORB_SIZE / 2}
- cy={ORB_SIZE / 2}
- r={RADIUS}
- fill="none"
- stroke="#C084FC"
- strokeOpacity={0.95}
- strokeWidth={STROKE}
- strokeLinecap="round"
- strokeDasharray={CIRCUMFERENCE}
- strokeDashoffset={CIRCUMFERENCE * (1 - progress)}
- className="transition-[stroke-dashoffset] duration-500 ease-linear [filter:drop-shadow(0_0_6px_rgba(192,132,252,0.6))]"
- />
- </svg>
- )}
- {isLoading && (
- <svg
- className="absolute inset-0 motion-safe:animate-spin"
- width={ORB_SIZE}
- height={ORB_SIZE}
- aria-hidden
- >
- <circle
- cx={ORB_SIZE / 2}
- cy={ORB_SIZE / 2}
- r={RADIUS}
- fill="none"
- stroke="#C084FC"
- strokeOpacity={0.95}
- strokeWidth={STROKE}
- strokeLinecap="round"
- strokeDasharray={`${LOADER_ARC} ${CIRCUMFERENCE - LOADER_ARC}`}
- />
- </svg>
- )}
-
- <div className="absolute inset-[8px] rounded-full">
- <OrbVisual
- glassParams={glassParams}
- audioBars={audioBars}
- isRecording={isRecording}
- />
- </div>
- </div>
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/OrbVisual.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/OrbVisual.tsx
deleted file mode 100644
index 3e212b0ae7..0000000000
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/OrbVisual.tsx
+++ /dev/null
@@ -1,91 +0,0 @@
-"use client";
-
-import { GlassOrb } from "@/components/molecules/GlassOrb/GlassOrb";
-import { GlassParams } from "@/components/molecules/GlassOrb/GlassSurface";
-import {
- motion,
- type MotionValue,
- useReducedMotion,
- useTransform,
-} from "framer-motion";
-import { type AudioBarLevels } from "./useAudioBars";
-
-interface Props {
- glassParams: GlassParams;
- audioBars: AudioBarLevels;
- isRecording: boolean;
-}
-
-export function OrbVisual({ glassParams, audioBars, isRecording }: Props) {
- return (
- <div data-testid="orb-current" className="h-full w-full">
- <GlassOrb params={glassParams} showRim={false}>
- <AudioBars levels={audioBars} isRecording={isRecording} />
- </GlassOrb>
- </div>
- );
-}
-
-const AUDIO_BARS = [
- { id: "low", height: 22, idleScale: 0.48 },
- { id: "low-mid", height: 34, idleScale: 0.58 },
- { id: "mid", height: 46, idleScale: 0.72 },
- { id: "high-mid", height: 34, idleScale: 0.58 },
- { id: "high", height: 22, idleScale: 0.48 },
-];
-
-function AudioBars({
- levels,
- isRecording,
-}: {
- levels: AudioBarLevels;
- isRecording: boolean;
-}) {
- const prefersReducedMotion = useReducedMotion();
-
- return (
- <div
- data-testid="orb-audio-bars"
- className="flex h-12 items-center justify-center gap-1.5 drop-shadow-[0_2px_12px_rgba(90,40,180,0.5)]"
- >
- {AUDIO_BARS.map((bar, index) => (
- <AudioBar
- key={bar.id}
- level={levels[index]}
- height={bar.height}
- idleScale={bar.idleScale}
- isRecording={isRecording}
- prefersReducedMotion={prefersReducedMotion === true}
- />
- ))}
- </div>
- );
-}
-
-function AudioBar({
- level,
- height,
- idleScale,
- isRecording,
- prefersReducedMotion,
-}: {
- level: MotionValue<number>;
- height: number;
- idleScale: number;
- isRecording: boolean;
- prefersReducedMotion: boolean;
-}) {
- const reactiveScaleY = useTransform(level, [0, 1], [idleScale * 0.45, 1]);
-
- return (
- <motion.span
- data-testid="orb-audio-bar"
- className="block w-1.5 origin-center rounded-full bg-white/95"
- style={{
- height,
- scaleY:
- isRecording && !prefersReducedMotion ? reactiveScaleY : idleScale,
- }}
- />
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/PrivacyNote.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/PrivacyNote.tsx
index 6d151ecfff..90df342084 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/PrivacyNote.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/PrivacyNote.tsx
@@ -13,7 +13,7 @@ export function PrivacyNote() {
<Icon icon={LockIcon} size={14} className="shrink-0 text-zinc-400" />
<Text
variant="small"
- className="text-center !text-sm !text-zinc-400 sm:whitespace-nowrap"
+ className="text-center text-zinc-400 sm:whitespace-nowrap"
>
{PRIVACY_COPY}
</Text>
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecordingControls/CancelRecordingDialog.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecordingControls/CancelRecordingDialog.tsx
index 698ebbda92..695abbe19b 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecordingControls/CancelRecordingDialog.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecordingControls/CancelRecordingDialog.tsx
@@ -18,7 +18,7 @@ export function CancelRecordingDialog({
return (
<Dialog
title="Discard recording?"
- styling={{ maxWidth: "30rem", minWidth: "auto" }}
+ className="min-w-0 max-w-[30rem] rounded-2xl"
controlled={{ isOpen, set: onOpenChange }}
>
<Dialog.Content>
@@ -27,10 +27,20 @@ export function CancelRecordingDialog({
discard it and start again.
</Text>
<Dialog.Footer>
- <Button variant="secondary" onClick={() => onOpenChange(false)}>
+ <Button
+ variant="secondary"
+ size="small"
+ onClick={() => onOpenChange(false)}
+ className="h-10 rounded-xl"
+ >
Keep recording
</Button>
- <Button variant="destructive" onClick={onConfirm}>
+ <Button
+ variant="destructive"
+ size="small"
+ onClick={onConfirm}
+ className="h-10 rounded-xl"
+ >
Discard recording
</Button>
</Dialog.Footer>
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecordingControls/RecordingControls.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecordingControls/RecordingControls.tsx
index 2f4bc6abe1..56aaab1252 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecordingControls/RecordingControls.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecordingControls/RecordingControls.tsx
@@ -175,10 +175,10 @@ function RecordingControlButton({
aria-label={isLoading ? pendingLabel : label}
aria-busy={isLoading}
className={cn(
- "border shadow-sm transition-[transform,opacity,background-color] duration-150 ease-out active:scale-[0.97]",
+ "border transition-[transform,opacity,background-color] duration-150 ease-out active:scale-[0.97]",
primary
- ? "border-black/10 bg-zinc-950 text-white hover:bg-zinc-800"
- : "border-black/5 bg-white hover:bg-zinc-50",
+ ? "border-zinc-900 bg-zinc-900 text-white hover:bg-zinc-800"
+ : "border-zinc-200 bg-white hover:bg-zinc-50",
isInactive && "opacity-40",
)}
>
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecordingStatus.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecordingStatus.tsx
index e7b7aa4afc..5694b2dfb3 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecordingStatus.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecordingStatus.tsx
@@ -27,17 +27,14 @@ export function RecordingStatus({
<div className="flex flex-col items-center gap-2">
<div className="mt-2 h-6">
<SwapFade swapKey={feedback ?? "idle"} className="flex justify-center">
- <Text
- variant="small"
- className="text-center !text-sm !font-medium !text-purple-400"
- >
+ <Text variant="body-medium" tone="muted" className="text-center">
{feedback ?? ""}
</Text>
</SwapFade>
</div>
{showSilenceNudge && (
- <Text variant="small" className="max-w-sm text-center !text-zinc-500">
+ <Text variant="small" tone="muted" className="max-w-sm text-center">
{SILENCE_NUDGE_COPY}
</Text>
)}
@@ -45,13 +42,13 @@ export function RecordingStatus({
{/* A dropped connection is not a lost recording, and saying so is the
whole point of writing every chunk to the device first. */}
{isOffline && (
- <div className="flex items-center gap-2 rounded-full bg-zinc-100 px-3 py-1">
+ <div className="flex items-center gap-2 rounded-md bg-zinc-100 px-2.5 py-1">
<Icon
icon={CloudOffIcon}
size={14}
- className="shrink-0 text-zinc-500"
+ className="shrink-0 text-zinc-400"
/>
- <Text variant="small" className="!text-zinc-500">
+ <Text variant="small" tone="muted">
{OFFLINE_COPY}
</Text>
</div>
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecoveryPrompt.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecoveryPrompt.tsx
index 8757788bea..67e9b92532 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecoveryPrompt.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RecoveryPrompt.tsx
@@ -15,29 +15,20 @@ interface Props {
// whether the user wants it.
export function RecoveryPrompt({ durationSecs, onResume, onDiscard }: Props) {
return (
- <div className="flex w-full max-w-md flex-col items-center gap-6 text-center">
- <Text
- variant="h3"
- className="!text-[1.125rem] !leading-[1.625rem] md:!text-[1.25rem] md:!leading-[1.75rem]"
- >
- Pick up where you left off?
- </Text>
- <Text variant="lead" className="!text-base !text-zinc-500">
+ <div className="flex w-full max-w-md flex-col items-center gap-4 text-center">
+ <Text variant="h5">Pick up where you left off?</Text>
+ <Text variant="body" tone="muted">
We kept the{" "}
- <span className="text-purple-500">{formatElapsed(durationSecs)}</span>{" "}
- you already recorded.
+ <span className="text-zinc-900">{formatElapsed(durationSecs)}</span> you
+ already recorded.
</Text>
- <div className="flex w-full flex-col items-center gap-3">
- <Button onClick={onResume} className="w-full max-w-xs">
+ <div className="flex w-full flex-col items-center gap-2">
+ <Button size="small" onClick={onResume} className="w-full max-w-xs">
Use that recording
</Button>
- <button
- type="button"
- onClick={onDiscard}
- className="text-sm text-zinc-700 transition-colors hover:text-zinc-900"
- >
+ <Button variant="ghost" size="xs" onClick={onDiscard}>
Start over
- </button>
+ </Button>
</div>
</div>
);
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RestActions.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RestActions.tsx
new file mode 100644
index 0000000000..ac791ad14e
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/RestActions.tsx
@@ -0,0 +1,37 @@
+"use client";
+
+import { Button } from "@/components/atoms/Button/Button";
+import { Mic01Icon, PencilEdit01Icon } from "@hugeicons/core-free-icons";
+
+interface Props {
+ onTalk: () => void;
+ onWrite: () => void;
+}
+
+// The two ways to tell AutoPilot about your work, side by side, so neither
+// is hidden behind a link. Talking leads; writing is the equal alternative.
+export function RestActions({ onTalk, onWrite }: Props) {
+ return (
+ <div className="mt-4 flex items-center gap-3">
+ <Button
+ type="button"
+ size="small"
+ onClick={onTalk}
+ leadingIcon={Mic01Icon}
+ className="h-10 w-36 rounded-xl"
+ >
+ Talk
+ </Button>
+ <Button
+ type="button"
+ variant="secondary"
+ size="small"
+ onClick={onWrite}
+ leadingIcon={PencilEdit01Icon}
+ className="h-10 w-36 rounded-xl"
+ >
+ Write
+ </Button>
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/TypedFallback.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/TypedFallback.tsx
index ebb6693456..af5c402c31 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/TypedFallback.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/TypedFallback.tsx
@@ -13,20 +13,25 @@ interface Props {
export function TypedFallback({ value, onChange, onSubmit }: Props) {
return (
<FadeIn className="w-full">
- <div className="flex w-full flex-col items-center gap-6">
+ <div className="flex w-full flex-col items-center gap-3">
<Input
id="brain-dump-text"
type="textarea"
label="Your brain dump"
hideLabel
- rows={8}
- className="rounded-[1.5rem]"
+ rows={6}
+ className="rounded-xl border-zinc-200"
placeholder="What repeats every week? What would you hand off first?"
value={value}
onChange={(e) => onChange(e.target.value)}
autoFocus
/>
- <Button size="large" onClick={onSubmit} disabled={!value.trim()}>
+ <Button
+ size="small"
+ onClick={onSubmit}
+ disabled={!value.trim()}
+ className="h-10 w-56 rounded-xl"
+ >
I&apos;m done
</Button>
</div>
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/VoiceAura.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/VoiceAura.tsx
new file mode 100644
index 0000000000..ebafc92508
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/VoiceAura.tsx
@@ -0,0 +1,56 @@
+"use client";
+
+import type { AvatarConfig } from "@/components/molecules/BotAvatar/helpers";
+import type { MotionValue } from "framer-motion";
+import { type ReactNode, useRef } from "react";
+import {
+ createStreakField,
+ createStreakStore,
+ type StreakField,
+ type StreakStore,
+} from "./streaks";
+import { VoiceStreaks } from "./VoiceStreaks";
+
+interface Props {
+ config: AvatarConfig;
+ size: number;
+ levels: MotionValue<number>[];
+ isActive: boolean;
+ children: ReactNode;
+}
+
+// Wraps an avatar in its voice streaks: one canvas behind it, one in front,
+// so the comets orbit the body in depth. The avatar goes in as children.
+export function VoiceAura({ config, size, levels, isActive, children }: Props) {
+ const fieldRef = useRef<{ key: string; field: StreakField } | null>(null);
+ const key = `${config.shape}.${config.color}.${size}`;
+ if (fieldRef.current === null || fieldRef.current.key !== key) {
+ fieldRef.current = { key, field: createStreakField(config, size) };
+ }
+ const storeRef = useRef<StreakStore | null>(null);
+ if (storeRef.current === null) storeRef.current = createStreakStore();
+
+ return (
+ <div
+ data-testid="voice-aura"
+ className="relative flex items-center justify-center"
+ style={{ width: size, height: size }}
+ >
+ <VoiceStreaks
+ field={fieldRef.current.field}
+ levels={levels}
+ isActive={isActive}
+ layer="behind"
+ store={storeRef.current}
+ />
+ <div className="relative z-10">{children}</div>
+ <VoiceStreaks
+ field={fieldRef.current.field}
+ levels={levels}
+ isActive={isActive}
+ layer="front"
+ store={storeRef.current}
+ />
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/VoiceDots.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/VoiceDots.tsx
new file mode 100644
index 0000000000..f7d82cd49c
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/VoiceDots.tsx
@@ -0,0 +1,100 @@
+"use client";
+
+import { motion, type MotionValue, useTransform } from "framer-motion";
+
+export const DOT = 14;
+const GAP = 22;
+const BAR_HEIGHTS = [40, 64, 64, 40];
+// Which voice band each dot listens to, low to high.
+const BANDS = [0, 1, 3, 4];
+
+interface Props {
+ levels: MotionValue<number>[];
+ // 0: the body is whole; 1: it has collapsed into one dot.
+ collapse: MotionValue<number>;
+ // 0: one dot; 1: four dots spread into a row.
+ split: MotionValue<number>;
+ centre: { x: number; y: number };
+ color: string;
+ reduceMotion: boolean;
+}
+
+// The row of dots the body turns into while listening: they sit stacked as
+// one dot until `split` spreads them, then each stretches with its band of
+// the voice, like a voice-memo icon.
+export function VoiceDots({
+ levels,
+ collapse,
+ split,
+ centre,
+ color,
+ reduceMotion,
+}: Props) {
+ return (
+ <>
+ {BANDS.map((band, index) => (
+ <Dot
+ key={band}
+ level={levels[band]}
+ collapse={collapse}
+ split={split}
+ slot={index - (BANDS.length - 1) / 2}
+ barHeight={BAR_HEIGHTS[index]}
+ centre={centre}
+ color={color}
+ reduceMotion={reduceMotion}
+ />
+ ))}
+ </>
+ );
+}
+
+function Dot({
+ level,
+ collapse,
+ split,
+ slot,
+ barHeight,
+ centre,
+ color,
+ reduceMotion,
+}: {
+ level: MotionValue<number>;
+ collapse: MotionValue<number>;
+ split: MotionValue<number>;
+ slot: number;
+ barHeight: number;
+ centre: { x: number; y: number };
+ color: string;
+ reduceMotion: boolean;
+}) {
+ const x = useTransform(split, (spread) => slot * GAP * spread);
+ const opacity = useTransform(collapse, [0.45, 1], [0, 1]);
+ const scale = useTransform(collapse, [0.45, 1], [0.4, 1]);
+ const height = useTransform(
+ [level, split],
+ ([voice, spread]: number[]) =>
+ DOT + (reduceMotion ? 0 : voice * spread * (barHeight - DOT)),
+ );
+ const y = useTransform(height, (h) => (DOT - h) / 2);
+
+ return (
+ <motion.span
+ data-testid="voice-dot"
+ aria-hidden
+ className="absolute rounded-full"
+ style={{
+ width: DOT,
+ height,
+ left: centre.x - DOT / 2,
+ top: centre.y - DOT / 2,
+ x,
+ y,
+ scale,
+ opacity,
+ backgroundColor: color,
+ willChange: "transform, height",
+ }}
+ />
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/VoiceStreaks.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/VoiceStreaks.tsx
new file mode 100644
index 0000000000..597b79a452
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/VoiceStreaks.tsx
@@ -0,0 +1,142 @@
+"use client";
+
+import type { MotionValue } from "framer-motion";
+import { useEffect, useRef } from "react";
+import {
+ envelope,
+ headAngle,
+ hexToRgb,
+ makeStreakPair,
+ orbitPoint,
+ project,
+ advanceStreaks,
+ type StreakStore,
+ type Streak,
+ type StreakField,
+ tailSpan,
+} from "./streaks";
+
+const SAMPLES = 28;
+
+interface Props {
+ field: StreakField;
+ levels: MotionValue<number>[];
+ isActive: boolean;
+ layer: "behind" | "front";
+ // Shared between the two layers so both draw the same comets.
+ store: StreakStore;
+}
+
+// One canvas per depth layer. The behind layer sits under the avatar and the
+// front layer over it, so a comet on the far side of its orbit is hidden by
+// the body and reappears as it comes round. The front layer also owns the
+// spawner so streaks are only created once per frame.
+export function VoiceStreaks({ field, levels, isActive, layer, store }: Props) {
+ const canvasRef = useRef<HTMLCanvasElement>(null);
+ const levelsRef = useRef(levels);
+ useEffect(() => {
+ levelsRef.current = levels;
+ }, [levels]);
+
+ useEffect(() => {
+ const canvas = canvasRef.current;
+ const context = canvas?.getContext("2d");
+ if (!canvas || !context) return;
+ const ratio = window.devicePixelRatio || 1;
+ canvas.width = field.box * ratio;
+ canvas.height = field.box * ratio;
+ context.setTransform(ratio, 0, 0, ratio, 0, 0);
+
+ if (!isActive) {
+ context.clearRect(0, 0, field.box, field.box);
+ if (layer === "front") store.streaks = [];
+ return;
+ }
+
+ // Opening the mic answers with a wave straight away, before any sound,
+ // so the click is seen to land; silence then settles into dots.
+ if (layer === "front") {
+ store.streaks = makeStreakPair(
+ field,
+ store.nextId,
+ 0.8,
+ performance.now(),
+ );
+ store.nextId += 2;
+ store.lastTick = 0;
+ store.budget = 0;
+ }
+
+ let frame = 0;
+ const tick = (now: number) => {
+ if (layer === "front") {
+ const currentLevels = levelsRef.current;
+ const loudness = currentLevels.length
+ ? currentLevels.reduce((sum, level) => sum + level.get(), 0) /
+ currentLevels.length
+ : 0;
+ advanceStreaks(store, field, loudness, now);
+ }
+ draw(context, field, store.streaks, now, layer);
+ frame = requestAnimationFrame(tick);
+ };
+ frame = requestAnimationFrame(tick);
+ return () => cancelAnimationFrame(frame);
+ }, [field, isActive, layer, store]);
+
+ return (
+ <canvas
+ ref={canvasRef}
+ data-testid={`voice-streaks-${layer}`}
+ aria-hidden
+ className="pointer-events-none absolute"
+ style={{
+ inset: -field.pad,
+ width: field.box,
+ height: field.box,
+ zIndex: layer === "front" ? 20 : 0,
+ }}
+ />
+ );
+}
+
+function draw(
+ context: CanvasRenderingContext2D,
+ field: StreakField,
+ streaks: Streak[],
+ now: number,
+ layer: "behind" | "front",
+) {
+ context.clearRect(0, 0, field.box, field.box);
+ context.lineCap = "round";
+ for (const streak of streaks) {
+ const progress = (now - streak.bornAt) / streak.durationMs;
+ const visibility = envelope(progress);
+ if (visibility <= 0) continue;
+ const head = headAngle(streak, progress);
+ const direction = Math.sign(streak.sweep);
+ const tail = head - direction * tailSpan(streak, progress);
+ const [fromColor, toColor] = streak.colors.map(hexToRgb);
+
+ let previous = project(field, streak, orbitPoint(streak, tail));
+ for (let index = 1; index <= SAMPLES; index++) {
+ const along = index / SAMPLES;
+ const point = orbitPoint(streak, tail + (head - tail) * along);
+ const current = project(field, streak, point);
+ const onThisLayer = layer === "front" ? point.z >= 0 : point.z < 0;
+ if (onThisLayer) {
+ const [r, g, b] = fromColor.map((from, channel) =>
+ Math.round(from + (toColor[channel] - from) * along),
+ );
+ const depthAlpha = layer === "front" ? 1 : 0.8;
+ context.strokeStyle = `rgba(${r}, ${g}, ${b}, ${visibility * along * depthAlpha})`;
+ context.lineWidth = streak.width * current.scale;
+ context.beginPath();
+ context.moveTo(previous.x + field.pad, previous.y + field.pad);
+ context.lineTo(current.x + field.pad, current.y + field.pad);
+ context.stroke();
+ }
+ previous = current;
+ }
+ }
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/MicButton.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/MicButton.test.tsx
new file mode 100644
index 0000000000..b8d1b67a21
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/MicButton.test.tsx
@@ -0,0 +1,221 @@
+import { act, render, screen } from "@testing-library/react";
+import { motionValue, type MotionValue } from "framer-motion";
+import type { ReactNode } from "react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { MicButton, type OrbScreen } from "../MicButton";
+import { VoiceDots } from "../VoiceDots";
+
+interface Running {
+ value: MotionValue<number>;
+ target: number;
+ options: { duration?: number; onUpdate?: (value: number) => void };
+ finish: () => void;
+ stop: ReturnType<typeof vi.fn>;
+}
+const state = vi.hoisted(() => ({
+ reduced: false,
+ animations: [] as Running[],
+}));
+vi.mock("framer-motion", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("framer-motion")>()),
+ useReducedMotion: () => state.reduced,
+ animate: (
+ value: MotionValue<number>,
+ target: number,
+ options: Running["options"],
+ ) => {
+ let resolve = () => {};
+ const promise = new Promise<void>((done) => {
+ resolve = done;
+ });
+ const stop = vi.fn();
+ state.animations.push({
+ value,
+ target,
+ options,
+ stop,
+ finish() {
+ value.set(target);
+ options.onUpdate?.(target);
+ resolve();
+ },
+ });
+ return Object.assign(promise, { stop });
+ },
+}));
+vi.mock("../VoiceAura", () => ({
+ VoiceAura: ({
+ isActive,
+ children,
+ }: {
+ isActive: boolean;
+ children: ReactNode;
+ }) => (
+ <div data-testid="fold-wave" data-active={isActive ? "yes" : "no"}>
+ {children}
+ </div>
+ ),
+}));
+vi.mock("@/components/molecules/BotAvatar/BotAvatar", () => ({
+ BotAvatar: ({
+ status,
+ poseOffset,
+ }: {
+ status: string;
+ poseOffset: { pitch: number };
+ }) => (
+ <span
+ data-testid="face"
+ data-status={status}
+ data-pitch={poseOffset.pitch}
+ />
+ ),
+}));
+beforeEach(() => {
+ vi.useFakeTimers();
+ state.reduced = false;
+ state.animations = [];
+});
+afterEach(() => {
+ vi.clearAllTimers();
+ vi.useRealTimers();
+});
+
+async function overlap() {
+ await act(async () => {
+ vi.advanceTimersByTime(120);
+ });
+}
+async function finish(animations: Running[]) {
+ await act(async () => {
+ animations.forEach((animation) => animation.finish());
+ });
+}
+
+describe("microphone folding", () => {
+ it.each(["rest", "processing", "failed"] as OrbScreen[])(
+ "does not unfold on an initial %s screen",
+ async (screenName) => {
+ const { rerender } = render(
+ <MicButton screen={screenName} audioStream={null} />,
+ );
+ await overlap();
+ expect(state.animations).toHaveLength(0);
+ expect(screen.getByTestId("fold-wave").getAttribute("data-active")).toBe(
+ "no",
+ );
+ state.reduced = true;
+ rerender(<MicButton screen={screenName} audioStream={null} />);
+ state.reduced = false;
+ rerender(<MicButton screen={screenName} audioStream={null} />);
+ await overlap();
+ expect(state.animations).toHaveLength(0);
+ },
+ );
+
+ it("folds into listening dots and unfolds to a neutral face", async () => {
+ const { rerender } = render(<MicButton screen="rest" audioStream={null} />);
+ rerender(<MicButton screen="recording" audioStream={null} />);
+ expect(state.animations.map((item) => item.target)).toEqual([
+ Math.PI * 2,
+ 1,
+ ]);
+ expect(screen.getByTestId("fold-wave").getAttribute("data-active")).toBe(
+ "yes",
+ );
+ await overlap();
+ expect(state.animations).toHaveLength(3);
+ await finish(state.animations.slice(0, 2));
+ expect(screen.getByTestId("fold-wave").getAttribute("data-active")).toBe(
+ "no",
+ );
+ await finish(state.animations.slice(2));
+ expect(screen.getByTestId("fold-wave").getAttribute("data-active")).toBe(
+ "no",
+ );
+ rerender(<MicButton screen="rest" audioStream={null} />);
+ await overlap();
+ expect(state.animations.slice(3).map((item) => item.target)).toEqual([
+ 0, 0, 0,
+ ]);
+ await finish(state.animations.slice(3));
+ expect(screen.getByTestId("face").getAttribute("data-pitch")).toBe("0");
+ expect(screen.getByTestId("fold-wave").getAttribute("data-active")).toBe(
+ "no",
+ );
+ });
+
+ it("cancels a partial fold without starting its delayed split", async () => {
+ const { rerender, unmount } = render(
+ <MicButton screen="recording" audioStream={null} />,
+ );
+ const folding = [...state.animations];
+ act(() => folding[1].value.set(0.5));
+ rerender(<MicButton screen="rest" audioStream={null} />);
+ await overlap();
+ expect(folding.every((item) => item.stop.mock.calls.length === 1)).toBe(
+ true,
+ );
+ expect(state.animations.filter((item) => item.target === 1)).toHaveLength(
+ 1,
+ );
+ await finish(state.animations.slice(2));
+ expect(screen.getByTestId("face").getAttribute("data-pitch")).toBe("0");
+ unmount();
+ expect(
+ state.animations.every((item) => item.stop.mock.calls.length > 0),
+ ).toBe(true);
+ });
+
+ it("uses reduced-motion transitions and resets a partially turned face", async () => {
+ const { rerender } = render(
+ <MicButton screen="recording" audioStream={null} />,
+ );
+ act(() => {
+ state.animations[0].value.set(Math.PI);
+ state.animations[0].options.onUpdate?.(Math.PI);
+ state.animations[1].value.set(0.5);
+ });
+ state.reduced = true;
+ rerender(<MicButton screen="rest" audioStream={null} />);
+ await overlap();
+ expect(
+ state.animations.slice(2).every((item) => item.options.duration === 0.15),
+ ).toBe(true);
+ await finish(state.animations.slice(2));
+ expect(screen.getByTestId("face").getAttribute("data-pitch")).toBe("0");
+ rerender(<MicButton screen="recording" audioStream={null} />);
+ await overlap();
+ expect(
+ state.animations.slice(4).every((item) => item.options.duration === 0.15),
+ ).toBe(true);
+ await finish(state.animations.slice(4));
+ const count = state.animations.length;
+ state.reduced = false;
+ rerender(<MicButton screen="recording" audioStream={null} />);
+ expect(state.animations).toHaveLength(count);
+ });
+});
+
+it.each([false, true])(
+ "voice dots respect reduced motion: %s",
+ (reduceMotion) => {
+ render(
+ <VoiceDots
+ levels={Array.from({ length: 5 }, () => motionValue(1))}
+ collapse={motionValue(1)}
+ split={motionValue(1)}
+ centre={{ x: 80, y: 80 }}
+ color="#123456"
+ reduceMotion={reduceMotion}
+ />,
+ );
+ expect(
+ screen.getAllByTestId("voice-dot").map((dot) => dot.style.height),
+ ).toEqual(
+ reduceMotion
+ ? ["14px", "14px", "14px", "14px"]
+ : ["40px", "64px", "64px", "40px"],
+ );
+ },
+);
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/OrbFrame.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/OrbFrame.test.tsx
deleted file mode 100644
index c6912bd08b..0000000000
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/OrbFrame.test.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { render } from "@testing-library/react";
-import { beforeEach, describe, expect, it, vi } from "vitest";
-import { DEFAULT_GLASS_PARAMS } from "@/components/molecules/GlassOrb/GlassSurface";
-import { OrbFrame } from "../OrbFrame";
-
-const { useAudioBarsMock } = vi.hoisted(() => ({
- useAudioBarsMock: vi.fn(() =>
- Array.from({ length: 5 }, () => ({ get: () => 0 })),
- ),
-}));
-
-vi.mock("../useAudioBars", () => ({
- useAudioBars: useAudioBarsMock,
-}));
-
-vi.mock("../OrbVisual", () => ({
- OrbVisual: function OrbVisual() {
- return <div data-testid="orb-visual" />;
- },
-}));
-
-beforeEach(() => {
- useAudioBarsMock.mockClear();
-});
-
-describe("OrbFrame", () => {
- it("meters the audio stream only while recording", () => {
- const stream = {} as MediaStream;
- const { rerender } = render(
- <OrbFrame glassParams={DEFAULT_GLASS_PARAMS} audioStream={stream} />,
- );
-
- expect(useAudioBarsMock).toHaveBeenLastCalledWith(null);
-
- rerender(
- <OrbFrame
- glassParams={DEFAULT_GLASS_PARAMS}
- audioStream={stream}
- progress={0.5}
- />,
- );
-
- expect(useAudioBarsMock).toHaveBeenLastCalledWith(stream);
- });
-});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/VoiceStreaks.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/VoiceStreaks.test.tsx
new file mode 100644
index 0000000000..bee2522c51
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/VoiceStreaks.test.tsx
@@ -0,0 +1,205 @@
+import { act, render } from "@testing-library/react";
+import { motionValue } from "framer-motion";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { createStreakStore, type StreakField } from "../streaks";
+import { VoiceStreaks } from "../VoiceStreaks";
+import { VoiceAura } from "../VoiceAura";
+import { AUTOPILOT_AVATAR } from "@/components/molecules/BotAvatar/helpers";
+
+const field: StreakField = {
+ size: 160,
+ pad: 40,
+ box: 240,
+ centre: { x: 80, y: 80 },
+ profile: Array(72).fill(56),
+ clearanceMin: 12,
+ clearanceMax: 16,
+ colors: ["#112233", "#445566"],
+};
+let frames: Map<number, FrameRequestCallback>;
+let nextFrame: number;
+let context: CanvasRenderingContext2D;
+
+function tick(now: number) {
+ act(() => {
+ const pending = [...frames];
+ frames.clear();
+ for (const [, callback] of pending) callback(now);
+ });
+}
+
+beforeEach(() => {
+ frames = new Map();
+ nextFrame = 0;
+ context = {
+ setTransform: vi.fn(),
+ clearRect: vi.fn(),
+ beginPath: vi.fn(),
+ moveTo: vi.fn(),
+ lineTo: vi.fn(),
+ stroke: vi.fn(),
+ } as unknown as CanvasRenderingContext2D;
+ vi.spyOn(HTMLCanvasElement.prototype, "getContext").mockReturnValue(context);
+ vi.spyOn(performance, "now").mockReturnValue(100);
+ vi.stubGlobal(
+ "requestAnimationFrame",
+ vi.fn((callback: FrameRequestCallback) => {
+ frames.set(++nextFrame, callback);
+ return nextFrame;
+ }),
+ );
+ vi.stubGlobal(
+ "cancelAnimationFrame",
+ vi.fn((id: number) => frames.delete(id)),
+ );
+});
+afterEach(() => {
+ vi.restoreAllMocks();
+ vi.unstubAllGlobals();
+});
+
+describe("VoiceStreaks lifecycle", () => {
+ it("keeps its current comets when a rerender supplies a new levels array", () => {
+ const store = createStreakStore();
+ const props = { field, store, layer: "front" as const, isActive: true };
+ const { rerender, unmount } = render(
+ <VoiceStreaks {...props} levels={[motionValue(0)]} />,
+ );
+ const initialPair = store.streaks;
+ const loud = motionValue(1);
+ const readLoud = vi.spyOn(loud, "get");
+ rerender(<VoiceStreaks {...props} levels={[loud]} />);
+ expect(store.streaks).toBe(initialPair);
+ expect(store.nextId).toBe(2);
+ expect(cancelAnimationFrame).not.toHaveBeenCalled();
+ tick(200);
+ tick(300);
+ expect(readLoud).toHaveBeenCalled();
+ expect(store.streaks.length).toBeGreaterThan(2);
+ unmount();
+ expect(frames.size).toBe(0);
+ });
+
+ it("draws both depth layers, sizes the canvas and clears it on deactivation", () => {
+ const store = createStreakStore();
+ const levels = [motionValue(0)];
+ function Layers({ active }: { active: boolean }) {
+ return (
+ <>
+ <VoiceStreaks
+ field={field}
+ levels={levels}
+ store={store}
+ layer="behind"
+ isActive={active}
+ />
+ <VoiceStreaks
+ field={field}
+ levels={levels}
+ store={store}
+ layer="front"
+ isActive={active}
+ />
+ </>
+ );
+ }
+ const { container, rerender } = render(<Layers active />);
+ expect(container.querySelector("canvas")?.width).toBe(
+ 240 * (window.devicePixelRatio || 1),
+ );
+ tick(100);
+ tick(400);
+ tick(800);
+ tick(1200);
+ expect(context.stroke).toHaveBeenCalled();
+ expect(context.moveTo).toHaveBeenCalled();
+ rerender(<Layers active={false} />);
+ expect(store.streaks).toEqual([]);
+ expect(frames.size).toBe(0);
+ expect(context.clearRect).toHaveBeenCalledWith(0, 0, 240, 240);
+ });
+
+ it("accepts an empty level list and discards stale spawn budget on restart", () => {
+ const store = createStreakStore();
+ store.budget = 10000;
+ const { rerender } = render(
+ <VoiceStreaks
+ field={field}
+ levels={[]}
+ store={store}
+ layer="front"
+ isActive
+ />,
+ );
+ expect(store.budget).toBe(0);
+ tick(200);
+ tick(100000000);
+ expect(Number.isFinite(store.budget)).toBe(true);
+ rerender(
+ <VoiceStreaks
+ field={field}
+ levels={[]}
+ store={store}
+ layer="front"
+ isActive={false}
+ />,
+ );
+ rerender(
+ <VoiceStreaks
+ field={field}
+ levels={[]}
+ store={store}
+ layer="front"
+ isActive
+ />,
+ );
+ expect(store.streaks).toHaveLength(2);
+ });
+
+ it("does not schedule work when a canvas context is unavailable", () => {
+ vi.mocked(HTMLCanvasElement.prototype.getContext).mockReturnValue(null);
+ render(
+ <VoiceStreaks
+ field={field}
+ levels={[]}
+ store={createStreakStore()}
+ layer="front"
+ isActive
+ />,
+ );
+ expect(frames.size).toBe(0);
+ });
+});
+
+it("keeps the voice aura layers around their child and resizes with the avatar", () => {
+ const levels = [motionValue(0.5)];
+ const { container, rerender } = render(
+ <VoiceAura config={AUTOPILOT_AVATAR} size={160} levels={levels} isActive>
+ <span>Avatar</span>
+ </VoiceAura>,
+ );
+ expect(container.querySelectorAll("canvas")).toHaveLength(2);
+ rerender(
+ <VoiceAura
+ config={AUTOPILOT_AVATAR}
+ size={160}
+ levels={[...levels]}
+ isActive
+ >
+ <span>Avatar</span>
+ </VoiceAura>,
+ );
+ expect(container.textContent).toBe("Avatar");
+ rerender(
+ <VoiceAura
+ config={{ ...AUTOPILOT_AVATAR, color: "coral" }}
+ size={320}
+ levels={levels}
+ isActive
+ >
+ <span>Avatar</span>
+ </VoiceAura>,
+ );
+ expect(container.querySelector("canvas")?.style.width).toBe("480px");
+ tick(400);
+});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/streaks.test.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/streaks.test.ts
new file mode 100644
index 0000000000..b59409f930
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/streaks.test.ts
@@ -0,0 +1,143 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+import {
+ AUTOPILOT_AVATAR,
+ SHAPES,
+} from "@/components/molecules/BotAvatar/helpers";
+import {
+ advanceStreaks,
+ bodyRadiusAt,
+ createStreakField,
+ createStreakStore,
+ envelope,
+ headAngle,
+ hexToRgb,
+ makeStreakPair,
+ MAX_STREAKS,
+ measureBodyProfile,
+ orbitPoint,
+ project,
+ smoothProfile,
+ spawnRate,
+ tailFor,
+ tailSpan,
+} from "../streaks";
+
+afterEach(() => {
+ vi.restoreAllMocks();
+ vi.unstubAllGlobals();
+});
+
+describe("streak geometry", () => {
+ it.each(SHAPES)(
+ "fits a finite orbit around $id with a canvas-free fallback",
+ (shape) => {
+ vi.spyOn(HTMLCanvasElement.prototype, "getContext").mockReturnValue(null);
+ const field = createStreakField(
+ { ...AUTOPILOT_AVATAR, shape: shape.id },
+ 160,
+ );
+ expect(field.box).toBe(240);
+ expect(field.profile).toHaveLength(72);
+ expect(
+ field.profile.every((radius) => Number.isFinite(radius) && radius > 0),
+ ).toBe(true);
+ const [first, second] = makeStreakPair(field, 7, 0.8, 100, () => 0.25);
+ expect(first.id).toBe(7);
+ expect(second.id).toBe(8);
+ expect(first.sweep).toBe(-second.sweep);
+ expect(first.tilt).toBe(-second.tilt);
+ expect(first.bornAt).toBe(second.bornAt);
+ for (const streak of [first, second]) {
+ for (const angle of [0, Math.PI / 2, Math.PI, -Math.PI / 2]) {
+ const point = orbitPoint(streak, angle);
+ expect(Math.hypot(point.x, point.y, point.z)).toBeCloseTo(1);
+ const projected = project(field, streak, point);
+ expect(projected.scale).toBeGreaterThanOrEqual(0.75);
+ expect(projected.scale).toBeLessThanOrEqual(1.25);
+ expect(Number.isFinite(projected.x + projected.y)).toBe(true);
+ }
+ }
+ expect(bodyRadiusAt(field, 0)).toBeCloseTo(
+ bodyRadiusAt(field, Math.PI * 2),
+ );
+ expect(bodyRadiusAt(field, -0.2)).toBeCloseTo(
+ bodyRadiusAt(field, Math.PI * 2 - 0.2),
+ );
+ },
+ );
+
+ it("measures a path against its canvas outline", () => {
+ vi.stubGlobal("Path2D", class {});
+ const isPointInPath = vi.fn(
+ (_path: unknown, x: number, y: number) =>
+ Math.hypot(x - 60, y - 60) <= 30,
+ );
+ vi.spyOn(HTMLCanvasElement.prototype, "getContext").mockReturnValue({
+ isPointInPath,
+ } as unknown as CanvasRenderingContext2D);
+ const profile = measureBodyProfile(
+ "M0 0",
+ { x: 60, y: 60 },
+ { width: 80, top: 20, bottom: 100 },
+ );
+ expect(isPointInPath).toHaveBeenCalled();
+ for (const radius of profile) expect(radius).toBeCloseTo(30, 3);
+ expect(smoothProfile(Array(72).fill(30))).toEqual(Array(72).fill(30));
+ });
+
+ it("grows and fades the tail smoothly over a complete lap", () => {
+ const field = createStreakField(AUTOPILOT_AVATAR, 160);
+ const [streak] = makeStreakPair(field, 0, 1, 0, () => 0.75);
+ expect(headAngle(streak, 0)).toBe(streak.start);
+ expect(headAngle(streak, 1)).toBeCloseTo(streak.start + streak.sweep);
+ expect(headAngle(streak, 0.5)).toBeCloseTo(streak.start + streak.sweep / 2);
+ expect(tailSpan(streak, 0)).toBe(0);
+ expect(tailSpan(streak, 1)).toBe(0);
+ expect(tailSpan(streak, 0.09)).toBeCloseTo(streak.tailAngle / 2);
+ expect(tailSpan(streak, 0.5)).toBe(streak.tailAngle);
+ expect(tailSpan(streak, 0.9)).toBeCloseTo(streak.tailAngle / 2);
+ expect([-0.1, 0, 1, 1.1].map(envelope)).toEqual([0, 0, 0, 0]);
+ expect(envelope(0.04)).toBeCloseTo(0.5);
+ expect(envelope(0.5)).toBe(1);
+ expect(envelope(0.96)).toBeCloseTo(0.5);
+ expect(tailFor(0)).toBeLessThan(tailFor(0.5));
+ expect(tailFor(2)).toBe(tailFor(1));
+ expect(spawnRate(0)).toBeLessThan(spawnRate(0.5));
+ expect(spawnRate(2)).toBe(spawnRate(1));
+ expect(hexToRgb("#12abef")).toEqual([18, 171, 239]);
+ });
+});
+
+describe("streak spawning", () => {
+ it("bounds work after a long background pause and reclaims expired slots first", () => {
+ const field = createStreakField(AUTOPILOT_AVATAR, 160);
+ const store = createStreakStore();
+ for (let id = 0; id < MAX_STREAKS; id += 2)
+ store.streaks.push(...makeStreakPair(field, id, 1, 1));
+ store.nextId = MAX_STREAKS;
+ store.lastTick = 1;
+ advanceStreaks(store, field, 1, 100000000);
+ expect(store.streaks).toHaveLength(2);
+ expect(store.streaks.every((streak) => streak.bornAt === 100000000)).toBe(
+ true,
+ );
+ expect(store.nextId).toBe(MAX_STREAKS + 2);
+ expect(store.budget).toBeLessThan(1);
+ });
+
+ it("drops excess demand when full, never exceeds capacity, and handles backward time", () => {
+ const field = createStreakField(AUTOPILOT_AVATAR, 160);
+ const store = createStreakStore();
+ store.budget = 1e12;
+ advanceStreaks(store, field, 1, 1000);
+ expect(store.streaks).toHaveLength(MAX_STREAKS);
+ const nextId = store.nextId;
+ for (let now = 1010; now <= 2000; now += 10)
+ advanceStreaks(store, field, 1, now);
+ expect(store.nextId).toBe(nextId);
+ expect(store.budget).toBeLessThan(1);
+ advanceStreaks(store, field, 1, 1900);
+ expect(store.budget).toBeGreaterThanOrEqual(0);
+ expect(store.streaks).toHaveLength(MAX_STREAKS);
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/useSimulatedVoice.test.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/useSimulatedVoice.test.ts
new file mode 100644
index 0000000000..bebc04a294
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/__tests__/useSimulatedVoice.test.ts
@@ -0,0 +1,38 @@
+import { act, renderHook } from "@testing-library/react";
+import { afterEach, expect, it, vi } from "vitest";
+import { useSimulatedVoice } from "../useSimulatedVoice";
+
+afterEach(() => {
+ vi.useRealTimers();
+});
+
+it("keeps stable levels, emits varied speech, and clears levels and timers on stop", () => {
+ vi.useFakeTimers();
+ const { result, rerender, unmount } = renderHook(
+ ({ active }) => useSimulatedVoice(active),
+ { initialProps: { active: false } },
+ );
+ const levels = result.current;
+ expect(levels.map((level) => level.get())).toEqual([0, 0, 0, 0, 0]);
+ rerender({ active: true });
+ act(() => {
+ vi.advanceTimersByTime(1200);
+ });
+ expect(result.current).toBe(levels);
+ const speech = levels.map((level) => level.get());
+ expect(speech.every((level) => level > 0 && level <= 1)).toBe(true);
+ expect(new Set(speech).size).toBe(5);
+ act(() => {
+ vi.advanceTimersByTime(4800);
+ });
+ expect(levels.map((level) => level.get())).toEqual([0, 0, 0, 0, 0]);
+ rerender({ active: false });
+ expect(vi.getTimerCount()).toBe(0);
+ rerender({ active: true });
+ act(() => {
+ vi.advanceTimersByTime(600);
+ });
+ expect(levels.some((level) => level.get() > 0)).toBe(true);
+ unmount();
+ expect(vi.getTimerCount()).toBe(0);
+});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/streaks.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/streaks.ts
new file mode 100644
index 0000000000..d07869e7cd
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/streaks.ts
@@ -0,0 +1,352 @@
+// Geometry and colour for the voice streaks: thin gradient comets that orbit
+// an avatar in three dimensions while the user speaks. Each orbit is a
+// tilted circle around the body's centre; the comet passes behind the
+// avatar on the far side and in front on the near side.
+
+import {
+ type AvatarConfig,
+ findColor,
+ findShape,
+ VIEWBOX,
+} from "@/components/molecules/BotAvatar/helpers";
+
+export const MAX_STREAKS = 10;
+
+// Gap between the body's outline and the orbit, in viewBox units.
+const CLEARANCE_MIN = 9;
+const CLEARANCE_MAX = 13;
+// Directions sampled around the body when measuring its outline.
+const PROFILE_STEPS = 72;
+// Furthest a ray from the centre can travel and still be inside any shape.
+const PROFILE_REACH = 80;
+// Smoothing of the measured outline, in samples either side (5° each): the
+// orbit must clear a corner without copying its kink.
+const PROFILE_DILATE = 2;
+const PROFILE_BLUR = 3;
+const PROFILE_BLUR_PASSES = 2;
+// Projected ellipse is about 40% as wide as it is long.
+const ORBIT_TILT = 0.42;
+// How strongly depth changes apparent size: the near side reads about 25%
+// larger than the far side.
+const PERSPECTIVE = 0.25;
+// Orbit angle at which the comet is furthest behind the head.
+const BEHIND = (3 * Math.PI) / 2;
+
+// Everything about the space the comets fly in, derived from the avatar they
+// orbit: centred on the body itself (not the box — the dome sits low in its
+// viewBox), following the body's actual outline, scaled to the rendered
+// size, wearing the avatar's own lighter tones.
+export interface StreakField {
+ size: number;
+ pad: number;
+ box: number;
+ centre: { x: number; y: number };
+ // Distance from the centre to the body's edge, in px, for PROFILE_STEPS
+ // evenly spaced directions starting at 3 o'clock and going clockwise.
+ profile: number[];
+ clearanceMin: number;
+ clearanceMax: number;
+ colors: [string, string];
+}
+
+export function createStreakField(
+ config: AvatarConfig,
+ size: number,
+): StreakField {
+ const shape = findShape(config.shape);
+ const color = findColor(config.color);
+ const scale = size / VIEWBOX;
+ const centre = {
+ x: shape.anchors.cx,
+ y: (shape.anchors.top + shape.anchors.bottom) / 2,
+ };
+ const pad = size / 4;
+ return {
+ size,
+ pad,
+ box: size + pad * 2,
+ centre: { x: centre.x * scale, y: centre.y * scale },
+ profile: smoothProfile(
+ measureBodyProfile(shape.path, centre, shape.anchors),
+ ).map((radius) => radius * scale),
+ clearanceMin: CLEARANCE_MIN * scale,
+ clearanceMax: CLEARANCE_MAX * scale,
+ colors: [color.light, color.body],
+ };
+}
+
+// Casts a ray from the centre in each direction and finds where it leaves
+// the body, using the shape's own path. Without a canvas (server, tests) it
+// falls back to the ellipse the anchors describe.
+export function measureBodyProfile(
+ path: string,
+ centre: { x: number; y: number },
+ anchors: { width: number; top: number; bottom: number },
+): number[] {
+ const halfWidth = anchors.width / 2;
+ const halfHeight = (anchors.bottom - anchors.top) / 2;
+ const context =
+ typeof document === "undefined"
+ ? null
+ : document.createElement("canvas").getContext("2d");
+ const outline =
+ context && typeof Path2D !== "undefined" ? new Path2D(path) : null;
+
+ return Array.from({ length: PROFILE_STEPS }, (_, step) => {
+ const angle = (step / PROFILE_STEPS) * Math.PI * 2;
+ const cos = Math.cos(angle);
+ const sin = Math.sin(angle);
+ if (!context || !outline) {
+ return (
+ (halfWidth * halfHeight) / Math.hypot(halfHeight * cos, halfWidth * sin)
+ );
+ }
+ let inside = 0;
+ let outside = PROFILE_REACH;
+ for (let iteration = 0; iteration < 20; iteration++) {
+ const middle = (inside + outside) / 2;
+ const hit = context.isPointInPath(
+ outline,
+ centre.x + cos * middle,
+ centre.y + sin * middle,
+ );
+ if (hit) inside = middle;
+ else outside = middle;
+ }
+ return inside;
+ });
+}
+
+// Pushes the outline out to cover nearby corners, then rounds it off, so the
+// orbit is one smooth loop that still stays outside every part of the body.
+export function smoothProfile(profile: number[]): number[] {
+ const steps = profile.length;
+ const at = (values: number[], index: number) =>
+ values[((index % steps) + steps) % steps];
+ const dilated = profile.map((_, index) => {
+ let widest = 0;
+ for (let offset = -PROFILE_DILATE; offset <= PROFILE_DILATE; offset++) {
+ widest = Math.max(widest, at(profile, index + offset));
+ }
+ return widest;
+ });
+ let smoothed = dilated;
+ for (let pass = 0; pass < PROFILE_BLUR_PASSES; pass++) {
+ const source = smoothed;
+ smoothed = source.map((_, index) => {
+ let sum = 0;
+ for (let offset = -PROFILE_BLUR; offset <= PROFILE_BLUR; offset++) {
+ sum += at(source, index + offset);
+ }
+ return sum / (PROFILE_BLUR * 2 + 1);
+ });
+ }
+ return smoothed;
+}
+
+// Body edge distance in a direction, interpolated between measured samples.
+export function bodyRadiusAt(field: StreakField, angle: number) {
+ const steps = field.profile.length;
+ const turns = (((angle / (Math.PI * 2)) % 1) + 1) % 1;
+ const position = turns * steps;
+ const before = Math.floor(position) % steps;
+ const after = (before + 1) % steps;
+ const blend = position - Math.floor(position);
+ return field.profile[before] * (1 - blend) + field.profile[after] * blend;
+}
+
+export interface Streak {
+ id: number;
+ // Half the ellipse's long axis, in px.
+ axis: number;
+ // Where the ellipse is centred, relative to the body's centre, in px: it
+ // slides along its long axis so both ends clear the body by the same gap.
+ shift: { x: number; y: number };
+ // Tilt of the ring out of the horizontal (x/z) plane, in radians.
+ tilt: number;
+ // Roll of the ring about the viewing axis, in radians.
+ roll: number;
+ start: number;
+ sweep: number;
+ bornAt: number;
+ durationMs: number;
+ colors: [string, string];
+ width: number;
+ tailAngle: number;
+}
+
+export interface Point3 {
+ x: number;
+ y: number;
+ z: number;
+}
+
+function rand(min: number, max: number, random: () => number) {
+ return min + (max - min) * random();
+}
+
+// Comets always come as a mirrored pair, one on each ellipse, born in the
+// same frame with the same start, speed, length and lifetime, so the two
+// orbits light up together rather than at random.
+export function makeStreakPair(
+ field: StreakField,
+ firstId: number,
+ loudness: number,
+ now: number,
+ random: () => number = Math.random,
+): [Streak, Streak] {
+ const clearance = rand(field.clearanceMin, field.clearanceMax, random);
+ // Born at the deepest point behind the head, and one full lap brings the
+ // comet back there, so it appears and disappears out of sight.
+ const start = BEHIND + rand(-0.25, 0.25, random);
+ const sweep = Math.PI * 2 * (random() < 0.5 ? -1 : 1);
+ const tilt = ORBIT_TILT * (random() < 0.5 ? -1 : 1);
+ const widthScale = field.size / 160;
+ const shared = {
+ start,
+ bornAt: now,
+ durationMs: rand(1500, 2100, random),
+ width: rand(3, 5, random) * widthScale,
+ tailAngle: tailFor(loudness),
+ colors: field.colors,
+ };
+ const forward = fitEllipse(field, Math.PI / 4, clearance);
+ const backward = fitEllipse(field, -Math.PI / 4, clearance);
+ return [
+ { ...shared, ...forward, id: firstId, roll: Math.PI / 4, tilt, sweep },
+ {
+ ...shared,
+ ...backward,
+ id: firstId + 1,
+ roll: -Math.PI / 4,
+ tilt: -tilt,
+ sweep: -sweep,
+ },
+ ];
+}
+
+// Sizes one smooth ellipse whose long axis lies along `roll`: it reaches
+// `clearance` past the body at both ends, sliding its centre along the axis
+// when the body reaches further one way (a dome's square base) than the
+// other (its round top).
+function fitEllipse(field: StreakField, roll: number, clearance: number) {
+ const ahead = bodyRadiusAt(field, roll) + clearance;
+ const behind = bodyRadiusAt(field, roll + Math.PI) + clearance;
+ const offset = (ahead - behind) / 2;
+ return {
+ axis: (ahead + behind) / 2,
+ shift: { x: Math.cos(roll) * offset, y: Math.sin(roll) * offset },
+ };
+}
+
+// A point on the unit orbit at angle `theta`, z toward the viewer. The
+// orbit's real extent is applied in `project`, where it follows the body.
+export function orbitPoint(streak: Streak, theta: number): Point3 {
+ // Horizontal ring around the head, then tilted, then rolled.
+ const x0 = Math.cos(theta);
+ const z0 = Math.sin(theta);
+ const y1 = -z0 * Math.sin(streak.tilt);
+ const z1 = z0 * Math.cos(streak.tilt);
+ const x2 = x0 * Math.cos(streak.roll) - y1 * Math.sin(streak.roll);
+ const y2 = x0 * Math.sin(streak.roll) + y1 * Math.cos(streak.roll);
+ return { x: x2, y: y2, z: z1 };
+}
+
+// Places a unit-orbit point on screen: scaled to the comet's ellipse, moved
+// to the ellipse's centre, and pushed out or pulled in by depth.
+export function project(field: StreakField, streak: Streak, point: Point3) {
+ const scale = 1 + point.z * PERSPECTIVE;
+ return {
+ x: field.centre.x + streak.shift.x + point.x * streak.axis * scale,
+ y: field.centre.y + streak.shift.y + point.y * streak.axis * scale,
+ scale,
+ };
+}
+
+function easeInOut(t: number) {
+ return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
+}
+
+// Where the comet's head is, given how far through its life it is. The lap
+// starts slowly out of sight, speeds through the front and eases back in.
+export function headAngle(streak: Streak, progress: number) {
+ return streak.start + streak.sweep * easeInOut(progress);
+}
+
+// How much of the tail is drawn: it grows out of the head at the start and
+// is drawn back into the head at the end, both while still behind the body,
+// so the comet never cuts off in front.
+export function tailSpan(streak: Streak, progress: number) {
+ if (progress <= 0 || progress >= 1) return 0;
+ if (progress < 0.18) return streak.tailAngle * (progress / 0.18);
+ if (progress > 0.8) return streak.tailAngle * ((1 - progress) / 0.2);
+ return streak.tailAngle;
+}
+
+// Overall visibility: a short fade at either end, both spent behind the head.
+export function envelope(progress: number) {
+ if (progress <= 0 || progress >= 1) return 0;
+ if (progress < 0.08) return progress / 0.08;
+ if (progress > 0.92) return (1 - progress) / 0.08;
+ return 1;
+}
+
+const SILENCE = 0.06;
+// In silence a comet is just a dot; a voice stretches it into a wave.
+const DOT_TAIL = 0.06;
+
+export function tailFor(loudness: number) {
+ if (loudness < SILENCE) return DOT_TAIL;
+ return 1.4 + 0.8 * Math.min(1, loudness);
+}
+
+// Streaks per second for a given loudness: a slow trickle of dots in
+// silence, a few waves for a murmur, a shower for a raised voice.
+export function spawnRate(loudness: number) {
+ if (loudness < SILENCE) return 0.7;
+ return 2 + 12 * Math.min(1, loudness);
+}
+
+export function hexToRgb(hex: string): [number, number, number] {
+ const value = parseInt(hex.slice(1), 16);
+ return [(value >> 16) & 255, (value >> 8) & 255, value & 255];
+}
+
+export interface StreakStore {
+ streaks: Streak[];
+ nextId: number;
+ budget: number;
+ lastTick: number;
+}
+
+export function createStreakStore(): StreakStore {
+ return { streaks: [], nextId: 0, budget: 0, lastTick: 0 };
+}
+
+export function advanceStreaks(
+ store: StreakStore,
+ field: StreakField,
+ loudness: number,
+ now: number,
+) {
+ const seconds = store.lastTick
+ ? Math.min(0.1, Math.max(0, (now - store.lastTick) / 1000))
+ : 0;
+ store.lastTick = now;
+ store.streaks = store.streaks.filter(
+ (streak) => now - streak.bornAt < streak.durationMs,
+ );
+ store.budget = Math.min(
+ MAX_STREAKS / 2,
+ store.budget + seconds * spawnRate(loudness),
+ );
+ const pairs = Math.min(
+ Math.floor(store.budget),
+ Math.floor((MAX_STREAKS - store.streaks.length) / 2),
+ );
+ store.budget %= 1;
+ for (let index = 0; index < pairs; index++) {
+ store.streaks.push(...makeStreakPair(field, store.nextId, loudness, now));
+ store.nextId += 2;
+ }
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/useSimulatedVoice.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/useSimulatedVoice.ts
new file mode 100644
index 0000000000..8c21c1a522
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/components/useSimulatedVoice.ts
@@ -0,0 +1,30 @@
+import { type MotionValue, motionValue } from "framer-motion";
+import { useEffect, useRef } from "react";
+
+// A wandering loudness with pauses, close enough to speech for a preview.
+export function useSimulatedVoice(isActive: boolean) {
+ const levelsRef = useRef<MotionValue<number>[] | null>(null);
+ if (levelsRef.current === null) {
+ levelsRef.current = Array.from({ length: 5 }, () => motionValue(0));
+ }
+ const levels = levelsRef.current;
+
+ useEffect(() => {
+ if (!isActive) {
+ levels.forEach((level) => level.set(0));
+ return;
+ }
+ const start = performance.now();
+ const timer = setInterval(() => {
+ const t = (performance.now() - start) / 1000;
+ const phrase = Math.max(0, Math.sin(t * 0.9)) * 0.9;
+ levels.forEach((level, index) => {
+ const wobble = 0.5 + 0.5 * Math.sin(t * (5 + index * 1.7) + index);
+ level.set(phrase * (0.35 + 0.65 * wobble));
+ });
+ }, 60);
+ return () => clearInterval(timer);
+ }, [isActive, levels]);
+
+ return levels;
+}
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/helpers.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/helpers.ts
index c4908a0d27..1c28687986 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/helpers.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/helpers.ts
@@ -3,7 +3,6 @@
// A depth meter, not a limit: the ring fills toward 3:00 and then holds.
// Nothing stops at 3:00 — the longer someone talks, the better the dump.
-export const RING_TARGET_SECONDS = 180;
// Recording keeps going far past the ring: 30 min is the hard stop, and
// even then everything captured is kept.
@@ -76,10 +75,6 @@ export function formatElapsed(totalSeconds: number) {
return `${minutes}:${String(seconds).padStart(2, "0")}`;
}
-export function ringProgress(elapsedSeconds: number) {
- return Math.min(1, elapsedSeconds / RING_TARGET_SECONDS);
-}
-
// Chrome/Edge give us webm/opus; Safari only offers mp4. Mirrors the
// existing copilot recorder so both paths hit the same server allowlist.
export function pickMimeType() {
@@ -97,12 +92,7 @@ export function isPermissionDenied(error: unknown) {
return error instanceof DOMException && error.name === "NotAllowedError";
}
-export function headline(name: string) {
- const trimmed = name.trim();
- return trimmed
- ? `What keeps stealing your week, ${trimmed}?`
- : "What keeps stealing your week?";
-}
+export const BRAIN_DUMP_HEADLINE = "Talk to me about your work";
// The backend's quality gate rejects dumps with these codes when the
// transcription succeeded but carried nothing to personalize from —
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/useBrainDumpStep.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/useBrainDumpStep.ts
index d90deda1bd..42dde090a4 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/useBrainDumpStep.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/BrainDumpStep/useBrainDumpStep.ts
@@ -7,7 +7,11 @@ import { useEffect, useRef, useState } from "react";
import * as Sentry from "@sentry/nextjs";
import { useOnboardingWizardStore } from "../../store";
import { trackBrainDump } from "@/services/onboarding/brain-dump-analytics";
-import { headline, isInsufficientDump, SILENCE_NUDGE_SECONDS } from "./helpers";
+import {
+ BRAIN_DUMP_HEADLINE,
+ isInsufficientDump,
+ SILENCE_NUDGE_SECONDS,
+} from "./helpers";
import {
clearRecording,
getMetaById,
@@ -26,7 +30,6 @@ export type ScreenState =
| "insufficient";
export function useBrainDumpStep() {
- const name = useOnboardingWizardStore((s) => s.name);
const nextStep = useOnboardingWizardStore((s) => s.nextStep);
const setStepBusy = useOnboardingWizardStore((s) => s.setStepBusy);
const recorder = useBrainDumpRecorder();
@@ -453,7 +456,7 @@ export function useBrainDumpStep() {
}
return {
- headline: headline(name),
+ headline: BRAIN_DUMP_HEADLINE,
screen,
insufficientMode,
typedText,