YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
feat: particle stream animation for onboarding loading
Louis Beaumontda62ed455aa0
diff --git a/apps/screenpipe-app-tauri/components/onboarding/particle-stream.tsx b/apps/screenpipe-app-tauri/components/onboarding/particle-stream.tsxnew file mode 100644index 000000000..fd3f2cec2--- /dev/null+++ b/apps/screenpipe-app-tauri/components/onboarding/particle-stream.tsx@@ -0,0 +1,308 @@+"use client";++import React, { useEffect, useRef, useMemo } from "react";+import { motion, useAnimation, AnimatePresence } from "framer-motion";++interface Particle {+ id: number;+ x: number;+ y: number;+ size: number;+ speed: number;+ opacity: number;+ delay: number;+}++interface ParticleStreamProps {+ /** 0 → 1 progress. Controls density, speed, glow intensity */+ progress: number;+ /** Width of the container */+ width?: number;+ /** Height of the container */+ height?: number;+ className?: string;+}++/**+ * Animated particle stream that flows through a pipe shape.+ * Particles are sparse at low progress, dense and fast at high progress.+ * The pipe glows brighter as progress increases.+ */+export function ParticleStream({+ progress,+ width = 400,+ height = 200,+ className = "",+}: ParticleStreamProps) {+ const canvasRef = useRef<HTMLCanvasElement>(null);+ const animFrameRef = useRef<number>(0);+ const particlesRef = useRef<Array<{+ x: number;+ y: number;+ vx: number;+ vy: number;+ size: number;+ opacity: number;+ life: number;+ maxLife: number;+ hue: number;+ }>>([]);+ const timeRef = useRef(0);+ const progressRef = useRef(progress);++ // Keep progress ref in sync+ useEffect(() => {+ progressRef.current = progress;+ }, [progress]);++ useEffect(() => {+ const canvas = canvasRef.current;+ if (!canvas) return;++ const ctx = canvas.getContext("2d");+ if (!ctx) return;++ // HiDPI support+ const dpr = window.devicePixelRatio || 1;+ canvas.width = width * dpr;+ canvas.height = height * dpr;+ ctx.scale(dpr, dpr);++ const pipeY = height / 2;+ const pipeHeight = 40;+ const pipeLeft = width * 0.1;+ const pipeRight = width * 0.9;+ const pipeWidth = pipeRight - pipeLeft;++ // Pipe entrance/exit shapes+ const capRadius = pipeHeight / 2;++ function spawnParticle() {+ const p = progressRef.current;+ // More particles at higher progress+ const baseCount = 2 + Math.floor(p * 8);+ const speed = 1.5 + p * 4;++ for (let i = 0; i < baseCount; i++) {+ // Spawn from left side with slight random spread+ const yOffset = (Math.random() - 0.5) * pipeHeight * 0.7;+ particlesRef.current.push({+ x: pipeLeft - 10 + Math.random() * 20,+ y: pipeY + yOffset,+ vx: speed * (0.7 + Math.random() * 0.6),+ vy: (Math.random() - 0.5) * 0.3,+ size: 1.5 + Math.random() * 2.5 + p * 1.5,+ opacity: 0.3 + Math.random() * 0.5 + p * 0.2,+ life: 0,+ maxLife: 100 + Math.random() * 60,+ hue: 200 + Math.random() * 40 + p * 20, // blue → cyan as progress increases+ });+ }+ }++ function draw() {+ const p = progressRef.current;+ timeRef.current += 1;++ // Clear canvas fully each frame (transparent background blends with page)+ ctx!.globalCompositeOperation = "source-over";+ ctx!.clearRect(0, 0, width, height);++ // Draw pipe body (subtle)+ const pipeOpacity = 0.06 + p * 0.08;+ ctx!.save();+ ctx!.beginPath();+ ctx!.roundRect(pipeLeft, pipeY - pipeHeight / 2, pipeWidth, pipeHeight, capRadius);+ ctx!.fillStyle = `rgba(120, 180, 255, ${pipeOpacity})`;+ ctx!.fill();++ // Pipe border glow+ ctx!.strokeStyle = `rgba(100, 160, 255, ${0.1 + p * 0.15})`;+ ctx!.lineWidth = 1;+ ctx!.stroke();+ ctx!.restore();++ // Center glow that intensifies with progress+ if (p > 0.3) {+ const glowIntensity = (p - 0.3) / 0.7;+ const gradient = ctx!.createRadialGradient(+ width / 2, pipeY, 0,+ width / 2, pipeY, pipeWidth * 0.4+ );+ gradient.addColorStop(0, `rgba(100, 180, 255, ${glowIntensity * 0.12})`);+ gradient.addColorStop(0.5, `rgba(80, 140, 255, ${glowIntensity * 0.05})`);+ gradient.addColorStop(1, "rgba(0, 0, 0, 0)");+ ctx!.fillStyle = gradient;+ ctx!.fillRect(0, 0, width, height);+ }++ // Spawn particles+ if (timeRef.current % Math.max(1, Math.floor(4 - p * 3)) === 0) {+ spawnParticle();+ }++ // Update & draw particles+ ctx!.globalCompositeOperation = "lighter";+ const particles = particlesRef.current;+ for (let i = particles.length - 1; i >= 0; i--) {+ const particle = particles[i];+ particle.life += 1;+ particle.x += particle.vx;+ particle.y += particle.vy;++ // Gentle sine wave motion+ particle.y += Math.sin(particle.life * 0.05 + particle.x * 0.01) * 0.3;++ // Constrain to pipe vertically (soft bounce)+ const distFromCenter = Math.abs(particle.y - pipeY);+ if (distFromCenter > pipeHeight * 0.4) {+ particle.vy -= (particle.y - pipeY) * 0.02;+ }++ // Fade in at start, fade out at end+ const lifeRatio = particle.life / particle.maxLife;+ const fadeIn = Math.min(1, particle.life / 10);+ const fadeOut = particle.x > pipeRight - 30 ? Math.max(0, (pipeRight - particle.x) / 30) : 1;+ const alpha = particle.opacity * fadeIn * fadeOut;++ if (particle.x > pipeRight + 20 || particle.life > particle.maxLife || alpha <= 0) {+ particles.splice(i, 1);+ continue;+ }++ // Draw particle with glow+ const glowSize = particle.size * 3;+ const gradient = ctx!.createRadialGradient(+ particle.x, particle.y, 0,+ particle.x, particle.y, glowSize+ );+ gradient.addColorStop(0, `hsla(${particle.hue}, 85%, 75%, ${alpha})`);+ gradient.addColorStop(0.3, `hsla(${particle.hue}, 75%, 65%, ${alpha * 0.6})`);+ gradient.addColorStop(0.6, `hsla(${particle.hue}, 65%, 55%, ${alpha * 0.2})`);+ gradient.addColorStop(1, `hsla(${particle.hue}, 60%, 50%, 0)`);++ ctx!.beginPath();+ ctx!.arc(particle.x, particle.y, glowSize, 0, Math.PI * 2);+ ctx!.fillStyle = gradient;+ ctx!.fill();++ // Core bright dot+ ctx!.beginPath();+ ctx!.arc(particle.x, particle.y, particle.size * 0.5, 0, Math.PI * 2);+ ctx!.fillStyle = `hsla(${particle.hue}, 90%, 85%, ${alpha})`;+ ctx!.fill();+ }++ // Draw entrance/exit caps with glow+ ctx!.globalCompositeOperation = "source-over";++ // Left cap (entrance) — brighter glow when particles enter+ const entranceGlow = ctx!.createRadialGradient(+ pipeLeft, pipeY, capRadius * 0.5,+ pipeLeft, pipeY, capRadius * 2.5+ );+ entranceGlow.addColorStop(0, `rgba(100, 180, 255, ${0.15 + p * 0.2})`);+ entranceGlow.addColorStop(1, "rgba(0, 0, 0, 0)");+ ctx!.fillStyle = entranceGlow;+ ctx!.fillRect(pipeLeft - capRadius * 2.5, pipeY - capRadius * 2.5, capRadius * 5, capRadius * 5);++ // Right cap (exit) — glows green when progress is high+ const exitHue = p > 0.7 ? 140 : 210; // blue → green+ const exitGlow = ctx!.createRadialGradient(+ pipeRight, pipeY, capRadius * 0.5,+ pipeRight, pipeY, capRadius * 2.5+ );+ exitGlow.addColorStop(0, `hsla(${exitHue}, 70%, 60%, ${0.1 + p * 0.25})`);+ exitGlow.addColorStop(1, "rgba(0, 0, 0, 0)");+ ctx!.fillStyle = exitGlow;+ ctx!.fillRect(pipeRight - capRadius * 2.5, pipeY - capRadius * 2.5, capRadius * 5, capRadius * 5);++ // "Ready" burst when progress reaches 1+ if (p >= 1) {+ const burstPhase = (timeRef.current % 120) / 120;+ const burstRadius = capRadius * 3 * burstPhase;+ const burstAlpha = (1 - burstPhase) * 0.3;+ const burstGradient = ctx!.createRadialGradient(+ pipeRight, pipeY, 0,+ pipeRight, pipeY, burstRadius+ );+ burstGradient.addColorStop(0, `rgba(100, 255, 150, ${burstAlpha})`);+ burstGradient.addColorStop(1, "rgba(100, 255, 150, 0)");+ ctx!.fillStyle = burstGradient;+ ctx!.beginPath();+ ctx!.arc(pipeRight, pipeY, burstRadius, 0, Math.PI * 2);+ ctx!.fill();+ }++ animFrameRef.current = requestAnimationFrame(draw);+ }++ draw();++ return () => {+ cancelAnimationFrame(animFrameRef.current);+ };+ }, [width, height]);++ return (+ <canvas+ ref={canvasRef}+ style={{ width, height }}+ className={`${className}`}+ />+ );+}++/**+ * Progress steps shown below the particle stream.+ * Minimal — just dots with tiny labels.+ */+export function ProgressSteps({+ steps,+ className = "",+}: {+ steps: Array<{ label: string; done: boolean; active: boolean }>;+ className?: string;+}) {+ return (+ <div className={`flex items-center justify-center gap-6 ${className}`}>+ {steps.map((step, i) => (+ <div key={i} className="flex items-center gap-2">+ <motion.div+ className={`w-2 h-2 rounded-full ${+ step.done+ ? "bg-green-400"+ : step.active+ ? "bg-blue-400"+ : "bg-muted-foreground/30"+ }`}+ animate={+ step.active+ ? {+ scale: [1, 1.4, 1],+ opacity: [0.7, 1, 0.7],+ }+ : {}+ }+ transition={+ step.active+ ? { duration: 1.5, repeat: Infinity, ease: "easeInOut" }+ : {}+ }+ />+ <span+ className={`font-mono text-[10px] ${+ step.done+ ? "text-green-400/80"+ : step.active+ ? "text-foreground/80"+ : "text-muted-foreground/40"+ }`}+ >+ {step.label}+ </span>+ </div>+ ))}+ </div>+ );+}diff --git a/apps/screenpipe-app-tauri/components/onboarding/status.tsx b/apps/screenpipe-app-tauri/components/onboarding/status.tsxindex 9c6f946e9..69c3c6a92 100644--- a/apps/screenpipe-app-tauri/components/onboarding/status.tsx+++ b/apps/screenpipe-app-tauri/components/onboarding/status.tsx@@ -1,76 +1,19 @@-import React, { useState, useEffect, useRef } from "react";+import React, { useState, useEffect, useRef, useCallback } from "react";import { Check, Monitor, Mic, Keyboard, AlertTriangle, Upload, Loader, Calendar } from "lucide-react";import { Button } from "../ui/button";import { invoke } from "@tauri-apps/api/core";import posthog from "posthog-js";import { usePlatform } from "@/lib/hooks/use-platform";import { commands, type OSPermissionsCheck } from "@/lib/utils/tauri";-import { motion } from "framer-motion";+import { motion, AnimatePresence } from "framer-motion";import { useSettings, DEFAULT_PROMPT } from "@/lib/hooks/use-settings";import { open as openUrl } from "@tauri-apps/plugin-shell";import { revealItemInDir } from "@tauri-apps/plugin-opener";import { homeDir, join } from "@tauri-apps/api/path";-// TimelineAIDemo removed — shortcut gate replaces itimport { readTextFile } from "@tauri-apps/plugin-fs";import { getVersion } from "@tauri-apps/api/app";import { version as osVersion, platform as osPlatform } from "@tauri-apps/plugin-os";-import Lottie from "lottie-react";-import pipeFlowAnimation from "@/public/animations/pipe-flow.json";--/**- * Format a shortcut string for display with consistent modifier ordering.- * On macOS: Command (⌘) → Control (⌃) → Option (⌥) → Shift (⇧) → Key- * On Windows/Linux: Ctrl → Alt → Shift → Key- */-function formatShortcut(shortcut: string, isMac: boolean): string {- if (!shortcut) return "";-- // Parse the shortcut into parts- const parts = shortcut.split("+").map(p => p.trim().toLowerCase());-- // Define modifier priorities (lower = comes first)- const modifierPriority: Record<string, number> = {- "super": 0, "command": 0, "cmd": 0,- "ctrl": 1, "control": 1,- "alt": 2, "option": 2,- "shift": 3,- };-- // Separate modifiers from the key- const modifiers: string[] = [];- let key = "";-- for (const part of parts) {- if (modifierPriority[part] !== undefined) {- modifiers.push(part);- } else {- key = part;- }- }-- // Sort modifiers by priority (Command first)- modifiers.sort((a, b) => (modifierPriority[a] ?? 99) - (modifierPriority[b] ?? 99));-- if (isMac) {- const macSymbols: Record<string, string> = {- "super": "⌘", "command": "⌘", "cmd": "⌘",- "ctrl": "⌃", "control": "⌃",- "alt": "⌥", "option": "⌥",- "shift": "⇧",- };- const formattedMods = modifiers.map(m => macSymbols[m] || m).join("");- return formattedMods + " " + key.toUpperCase();- } else {- const winNames: Record<string, string> = {- "super": "Win", "command": "Ctrl", "cmd": "Ctrl",- "ctrl": "Ctrl", "control": "Ctrl",- "alt": "Alt", "option": "Alt",- "shift": "Shift",- };- const formattedMods = modifiers.map(m => winNames[m] || m);- return [...formattedMods, key.toUpperCase()].join("+");- }-}+import { ParticleStream, ProgressSteps } from "./particle-stream";interface OnboardingStatusProps {className?: string;@@ -79,7 +22,14 @@ interface OnboardingStatusProps {type SetupState = "checking" | "needs-permissions" | "ready" | "starting" | "recording";-const STUCK_TIMEOUT_MS = 30000; // 30 seconds+interface SetupProgress {+ permissions: boolean;+ serverStarted: boolean;+ audioReady: boolean;+ visionReady: boolean;+}++const STUCK_TIMEOUT_MS = 30000;const OnboardingStatus: React.FC<OnboardingStatusProps> = ({className = "",@@ -99,16 +49,88 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({const hasAdvancedRef = useRef(false);const mountTimeRef = useRef(Date.now());- // Auto-advance to shortcut gate when recording starts (with min display time)+ // Progress tracking+ const [progress, setProgress] = useState<SetupProgress>({+ permissions: false,+ serverStarted: false,+ audioReady: false,+ visionReady: false,+ });+ const [animatedProgress, setAnimatedProgress] = useState(0);++ // Compute overall progress 0→1+ const computeProgress = useCallback((p: SetupProgress): number => {+ let val = 0;+ if (p.permissions) val += 0.25;+ if (p.serverStarted) val += 0.25;+ if (p.audioReady) val += 0.25;+ if (p.visionReady) val += 0.25;+ return val;+ }, []);++ // Smooth progress animation+ useEffect(() => {+ const target = computeProgress(progress);+ const step = () => {+ setAnimatedProgress((prev) => {+ const diff = target - prev;+ if (Math.abs(diff) < 0.005) return target;+ return prev + diff * 0.08;+ });+ };+ const interval = setInterval(step, 16);+ return () => clearInterval(interval);+ }, [progress, computeProgress]);++ // Poll health endpoint for real progress+ useEffect(() => {+ if (setupState !== "starting" && setupState !== "ready") return;++ const poll = async () => {+ try {+ const res = await fetch("http://localhost:3030/health", {+ signal: AbortSignal.timeout(2000),+ });+ if (res.ok) {+ const data = await res.json();+ setProgress((prev) => ({+ ...prev,+ serverStarted: true,+ audioReady:+ data.status === "healthy" ||+ (data.frame_status === "ok") ||+ (data.audio_status === "ok") ||+ prev.audioReady,+ visionReady:+ data.status === "healthy" ||+ (data.frame_status === "ok") ||+ prev.visionReady,+ }));++ // If health says healthy, we're recording+ if (data.status === "healthy") {+ setSetupState("recording");+ }+ }+ } catch {+ // Server not ready yet+ }+ };++ const interval = setInterval(poll, 1500);+ poll(); // immediate first check+ return () => clearInterval(interval);+ }, [setupState]);++ // Auto-advance to shortcut gate when recording startsuseEffect(() => {if (setupState === "recording" && !hasAdvancedRef.current) {hasAdvancedRef.current = true;const elapsed = Date.now() - mountTimeRef.current;- const minDisplay = 1500; // show branding for at least 1.5s+ const minDisplay = 1500;const delay = Math.max(0, minDisplay - elapsed);setTimeout(() => handleNextSlide(), delay);}- // eslint-disable-next-line react-hooks/exhaustive-deps}, [setupState]);const sendLogs = async () => {@@ -117,17 +139,12 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({const BASE_URL = "https://screenpi.pe";const machineId = localStorage.getItem("machineId") || crypto.randomUUID();localStorage.setItem("machineId", machineId);-const identifier = settings.user?.id || machineId;const type = settings.user?.id ? "user" : "machine";-- // Get log filesconst logFilesResult = await commands.getLogFiles();if (logFilesResult.status !== "ok") throw new Error("Failed to get log files");-- const logFiles = logFilesResult.data.slice(0, 3); // Last 3 log files- const MAX_LOG_SIZE = 50 * 1024; // 50KB per file for onboarding-+ const logFiles = logFilesResult.data.slice(0, 3);+ const MAX_LOG_SIZE = 50 * 1024;const logContents = await Promise.all(logFiles.map(async (file) => {try {@@ -141,50 +158,27 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({}}));-- // Get signed URLconst signedRes = await fetch(`${BASE_URL}/api/logs`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ identifier, type }),});const { data: { signedUrl, path } } = await signedRes.json();-- // Get browser console logs (same as share-logs-button.tsx)- const consoleLog = (localStorage.getItem("console_logs") || "").slice(-50000); // Last 50KB-- // Upload logs+ const consoleLog = (localStorage.getItem("console_logs") || "").slice(-50000);const combinedLogs = logContents.map((log) => `\n=== ${log.name} ===\n${log.content}`).join("\n\n") +"\n\n=== Browser Console Logs ===\n" + consoleLog +"\n\n=== Onboarding Stuck ===\nUser experienced startup issues during onboarding.";-- await fetch(signedUrl, {- method: "PUT",- body: combinedLogs,- headers: { "Content-Type": "text/plain" },- });-- // Confirm upload+ await fetch(signedUrl, { method: "PUT", body: combinedLogs, headers: { "Content-Type": "text/plain" } });const os = osPlatform();const os_version = osVersion();const app_version = await getVersion();-await fetch(`${BASE_URL}/api/logs/confirm`, {method: "POST",headers: { "Content-Type": "application/json" },- body: JSON.stringify({- path,- identifier,- type,- os,- os_version,- app_version,- feedback_text: "Onboarding stuck - automatic log submission",- }),+ body: JSON.stringify({ path, identifier, type, os, os_version, app_version, feedback_text: "Onboarding stuck - automatic log submission" }),});-setLogsSent(true);} catch (err) {console.error("Failed to send logs:", err);@@ -197,7 +191,6 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({openUrl("https://cal.com/louis030195/screenpipe-onboarding");};- // Create default Pi preset if none existsconst ensureDefaultPreset = async () => {if (settings.aiPresets.length === 0) {const defaultPreset = {@@ -214,92 +207,75 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({};const handleComplete = async () => {- // Try to ensure default preset, but don't block onboarding if it failstry {await ensureDefaultPreset();} catch (error) {console.error("Failed to ensure default preset:", error);- // Continue anyway - user can set up AI later}- // Note: Shortcut reminder and notification are shown after entire onboarding completes (in page.tsx)handleNextSlide();};- // Check screen permission once on mount (no polling - requires app restart)+ // Check screen permission once on mountconst screenPermissionRef = useRef<string | null>(null);useEffect(() => {const checkScreenPermissionOnce = async () => {if (!isMacOS || hasStartedRef.current) return;-try {const perms = await commands.doPermissionsCheck(true);screenPermissionRef.current = perms.screenRecording;setPermissions(perms);-const screenOk = perms.screenRecording === "granted" || perms.screenRecording === "notNeeded";const audioOk = perms.microphone === "granted" || perms.microphone === "notNeeded";const accessibilityOk = perms.accessibility === "granted" || perms.accessibility === "notNeeded";-if (screenOk && audioOk && accessibilityOk && !hasStartedRef.current) {+ setProgress((prev) => ({ ...prev, permissions: true }));setSetupState("ready");} else if (!hasStartedRef.current) {setSetupState("needs-permissions");}} catch (error) {console.error("Failed to check permissions:", error);- if (!hasStartedRef.current) {- setSetupState("ready");- }+ if (!hasStartedRef.current) setSetupState("ready");}};-if (!isMacOS) {+ setProgress((prev) => ({ ...prev, permissions: true }));setSetupState("ready");return;}-checkScreenPermissionOnce();}, [isMacOS]);- // Poll microphone and accessibility permissions (screen permission requires app restart)+ // Poll mic and accessibility permissionsuseEffect(() => {if (!isMacOS || screenPermissionRef.current === null) return;-const checkPermissions = async () => {if (hasStartedRef.current) return;-try {- // Use individual checks to avoid triggering screen capture permission dialogsconst [micStatus, accessibilityStatus] = await Promise.all([commands.checkMicrophonePermission(),commands.checkAccessibilityPermissionCmd(),]);-- setPermissions(prev => prev ? {- ...prev,- microphone: micStatus,- accessibility: accessibilityStatus,- } : null);-+ setPermissions((prev) =>+ prev ? { ...prev, microphone: micStatus, accessibility: accessibilityStatus } : null+ );const screenOk = screenPermissionRef.current === "granted" || screenPermissionRef.current === "notNeeded";const audioOk = micStatus === "granted" || micStatus === "notNeeded";const accessibilityOk = accessibilityStatus === "granted" || accessibilityStatus === "notNeeded";-if (screenOk && audioOk && accessibilityOk && !hasStartedRef.current) {+ setProgress((prev) => ({ ...prev, permissions: true }));setSetupState("ready");}} catch (error) {console.error("Failed to check permissions:", error);}};-const interval = setInterval(checkPermissions, 2000);return () => clearInterval(interval);- // eslint-disable-next-line react-hooks/exhaustive-deps}, [isMacOS]);- // Auto-start when ready (only once)+ // Auto-start when readyuseEffect(() => {if (setupState === "ready" && !hasStartedRef.current) {hasStartedRef.current = true;@@ -307,40 +283,30 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({}}, [setupState]);- // Show "continue anyway" button after 5 seconds on permission screen+ // Show "continue anyway" after 5s on permission screenconst continueAnywayTimerStarted = useRef(false);useEffect(() => {if (setupState === "needs-permissions" && !continueAnywayTimerStarted.current) {continueAnywayTimerStarted.current = true;- const timer = setTimeout(() => {- setShowContinueAnyway(true);- }, 5000);+ const timer = setTimeout(() => setShowContinueAnyway(true), 5000);return () => clearTimeout(timer);}}, [setupState]);- // Track stuck state with timeout+ // Track stuck stateuseEffect(() => {- // Clear any existing timeoutif (stuckTimeoutRef.current) {clearTimeout(stuckTimeoutRef.current);stuckTimeoutRef.current = null;}-- // Set timeout for "ready" or "starting" statesif (setupState === "ready" || setupState === "starting") {setIsStuck(false);- stuckTimeoutRef.current = setTimeout(() => {- setIsStuck(true);- }, STUCK_TIMEOUT_MS);+ stuckTimeoutRef.current = setTimeout(() => setIsStuck(true), STUCK_TIMEOUT_MS);} else {setIsStuck(false);}-return () => {- if (stuckTimeoutRef.current) {- clearTimeout(stuckTimeoutRef.current);- }+ if (stuckTimeoutRef.current) clearTimeout(stuckTimeoutRef.current);};}, [setupState]);@@ -355,39 +321,24 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({};const handleStartRecording = async () => {- // Prevent concurrent calls- if (isStartingRef.current) {- console.log("handleStartRecording already in progress, skipping");- return;- }+ if (isStartingRef.current) return;isStartingRef.current = true;-posthog.capture("screenpipe_setup_start");setSetupState("starting");-try {- // First check if server is already running and healthyconst healthCheck = await fetch("http://localhost:3030/health", {method: "GET",signal: AbortSignal.timeout(3000),}).catch(() => null);-if (healthCheck?.ok) {- // Server is already running, no need to restart- console.log("Server already running and healthy, skipping restart");- await new Promise((resolve) => setTimeout(resolve, 1000));+ setProgress({ permissions: true, serverStarted: true, audioReady: true, visionReady: true });+ await new Promise((resolve) => setTimeout(resolve, 500));setSetupState("recording");return;}-- // Server not running, start itawait invoke("spawn_screenpipe");- await new Promise((resolve) => setTimeout(resolve, 3000));- setSetupState("recording");} catch (error) {console.error("Failed to start screenpipe:", error);- // Don't reset to "ready" on error to prevent retry loops- // User can use the stuck timeout UI to retry or continuesetSetupState("starting");} finally {isStartingRef.current = false;@@ -396,13 +347,9 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({const requestPermission = async (type: "screen" | "audio" | "accessibility") => {try {- if (type === "screen") {- await commands.requestPermission("screenRecording");- } else if (type === "audio") {- await commands.requestPermission("microphone");- } else {- await commands.requestPermission("accessibility");- }+ if (type === "screen") await commands.requestPermission("screenRecording");+ else if (type === "audio") await commands.requestPermission("microphone");+ else await commands.requestPermission("accessibility");} catch (error) {console.error("Failed to request permission:", error);}@@ -412,104 +359,92 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({const audioGranted = permissions?.microphone === "granted" || permissions?.microphone === "notNeeded";const accessibilityGranted = permissions?.accessibility === "granted" || permissions?.accessibility === "notNeeded";+ const progressSteps = [+ { label: "permissions", done: progress.permissions, active: setupState === "needs-permissions" || setupState === "checking" },+ { label: "engine", done: progress.serverStarted, active: !progress.serverStarted && progress.permissions },+ { label: "audio", done: progress.audioReady, active: progress.serverStarted && !progress.audioReady },+ { label: "vision", done: progress.visionReady, active: progress.serverStarted && !progress.visionReady && progress.audioReady },+ ];+return (<div className={`${className} w-full flex flex-col items-center justify-center min-h-[400px]`}>- {/* Branding */}+ {/* Branding — always visible */}<motion.div- className="flex flex-col items-center mb-6"+ className="flex flex-col items-center mb-4"initial={{ opacity: 0, y: -10 }}animate={{ opacity: 1, y: 0 }}transition={{ duration: 0.4 }}>- <img className="w-14 h-14 mb-3" src="/128x128.png" alt="screenpipe" />- <h1 className="font-mono text-lg font-bold text-foreground">screenpipe</h1>- <p className="font-mono text-xs text-muted-foreground mt-1">AI memory for your screen</p>+ <img className="w-12 h-12 mb-2" src="/128x128.png" alt="screenpipe" />+ <h1 className="font-mono text-base font-bold text-foreground">screenpipe</h1></motion.div>- {/* Checking state */}+ {/* Checking state — particle stream at low progress */}{setupState === "checking" && (<motion.div- className="flex flex-col items-center space-y-4"+ className="flex flex-col items-center"initial={{ opacity: 0 }}animate={{ opacity: 1 }}>- <Lottie- animationData={pipeFlowAnimation}- loop={true}- className="w-24 h-10"- />- <p className="font-mono text-sm text-muted-foreground">checking permissions...</p>+ <ParticleStream progress={0.05} width={380} height={140} />+ <ProgressSteps steps={progressSteps} className="mt-2" /></motion.div>)}{/* Needs permissions */}{setupState === "needs-permissions" && (<motion.div- className="flex flex-col items-center space-y-8 max-w-md"+ className="flex flex-col items-center space-y-5 w-full max-w-sm"initial={{ opacity: 0, y: 20 }}animate={{ opacity: 1, y: 0 }}>- <div className="text-center space-y-2">- <h2 className="font-mono text-xl text-foreground">grant access</h2>- <p className="font-mono text-xs text-muted-foreground">- screenpipe needs these permissions to work- </p>- </div>+ <ParticleStream progress={0.1} width={380} height={100} />- <div className="space-y-3 w-full">+ <div className="space-y-2 w-full"><buttononClick={() => requestPermission("screen")}- className="w-full flex items-center justify-between p-4 border border-border hover:bg-foreground hover:text-background transition-all group"+ className="w-full flex items-center justify-between px-4 py-3 border border-border/50 hover:bg-foreground hover:text-background transition-all group"><div className="flex items-center space-x-3">- <Monitor className="w-5 h-5" strokeWidth={1.5} />- <div className="text-left">- <span className="font-mono text-sm block">screen recording</span>- <span className="font-mono text-xs text-muted-foreground group-hover:text-background/70">capture what's on screen</span>- </div>+ <Monitor className="w-4 h-4 opacity-60" strokeWidth={1.5} />+ <span className="font-mono text-xs">screen recording</span></div>{screenGranted ? (- <Check className="w-5 h-5 text-foreground group-hover:text-background" strokeWidth={1.5} />+ <Check className="w-4 h-4 text-green-400" strokeWidth={2} />) : (- <span className="font-mono text-xs text-muted-foreground group-hover:text-background/70">enable</span>+ <span className="font-mono text-[10px] text-muted-foreground group-hover:text-background/70">enable</span>)}</button><buttononClick={() => requestPermission("audio")}- className="w-full flex items-center justify-between p-4 border border-border hover:bg-foreground hover:text-background transition-all group"+ className="w-full flex items-center justify-between px-4 py-3 border border-border/50 hover:bg-foreground hover:text-background transition-all group"><div className="flex items-center space-x-3">- <Mic className="w-5 h-5" strokeWidth={1.5} />- <div className="text-left">- <span className="font-mono text-sm block">microphone</span>- <span className="font-mono text-xs text-muted-foreground group-hover:text-background/70">transcribe speech</span>- </div>+ <Mic className="w-4 h-4 opacity-60" strokeWidth={1.5} />+ <span className="font-mono text-xs">microphone</span></div>{audioGranted ? (- <Check className="w-5 h-5 text-foreground group-hover:text-background" strokeWidth={1.5} />+ <Check className="w-4 h-4 text-green-400" strokeWidth={2} />) : (- <span className="font-mono text-xs text-muted-foreground group-hover:text-background/70">enable</span>+ <span className="font-mono text-[10px] text-muted-foreground group-hover:text-background/70">enable</span>)}</button>{isMacOS && (<buttononClick={() => requestPermission("accessibility")}- className="w-full flex items-center justify-between p-4 border border-border hover:bg-foreground hover:text-background transition-all group"+ className="w-full flex items-center justify-between px-4 py-3 border border-border/50 hover:bg-foreground hover:text-background transition-all group"><div className="flex items-center space-x-3">- <Keyboard className="w-5 h-5" strokeWidth={1.5} />- <div className="text-left">- <span className="font-mono text-sm block">accessibility</span>- <span className="font-mono text-xs text-muted-foreground group-hover:text-background/70">keyboard shortcuts</span>- </div>+ <Keyboard className="w-4 h-4 opacity-60" strokeWidth={1.5} />+ <span className="font-mono text-xs">accessibility</span></div>{accessibilityGranted ? (- <Check className="w-5 h-5 text-foreground group-hover:text-background" strokeWidth={1.5} />+ <Check className="w-4 h-4 text-green-400" strokeWidth={2} />) : (- <span className="font-mono text-xs text-muted-foreground group-hover:text-background/70">enable</span>+ <span className="font-mono text-[10px] text-muted-foreground group-hover:text-background/70">enable</span>)}</button>)}@@ -520,9 +455,10 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({onClick={() => {posthog.capture("onboarding_permission_skipped");hasStartedRef.current = true;+ setProgress((prev) => ({ ...prev, permissions: true }));setSetupState("ready");}}- className="font-mono text-xs text-muted-foreground hover:text-foreground"+ className="font-mono text-[10px] text-muted-foreground/60 hover:text-foreground transition-colors">continue anyway →</button>@@ -530,180 +466,76 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({</motion.div>)}- {/* Starting state */}- {setupState === "starting" && (+ {/* Starting / Ready — the big particle animation */}+ {(setupState === "starting" || setupState === "ready") && (<motion.div- className="flex flex-col items-center space-y-6"+ className="flex flex-col items-center"initial={{ opacity: 0 }}animate={{ opacity: 1 }}+ transition={{ duration: 0.6 }}>- <Lottie- animationData={pipeFlowAnimation}- loop={true}- className="w-32 h-12"+ <ParticleStream+ progress={Math.max(0.15, animatedProgress)}+ width={420}+ height={180}/>- <div className="text-center space-y-2">- <p className="font-mono text-sm text-foreground">starting screenpipe...</p>- <p className="font-mono text-xs text-muted-foreground">downloading AI models</p>- </div>- {isStuck && (- <motion.div- className="flex flex-col items-center space-y-4 mt-4 p-4 border border-border bg-muted/50 rounded-lg max-w-md"- initial={{ opacity: 0, y: 10 }}- animate={{ opacity: 1, y: 0 }}- >- <div className="flex items-center space-x-2 text-muted-foreground">- <AlertTriangle className="w-4 h-4" />- <span className="font-mono text-sm">taking longer than expected</span>- </div>- <p className="font-mono text-xs text-muted-foreground text-center">- this might be due to missing permissions or a startup issue.- {isMacOS && " try granting screen recording & microphone access in system settings."}- </p>- <div className="flex flex-col items-center space-y-2 w-full">- <div className="flex items-center space-x-2">+ <ProgressSteps steps={progressSteps} className="mt-3" />++ {/* Stuck state — minimal */}+ <AnimatePresence>+ {isStuck && (+ <motion.div+ className="flex flex-col items-center space-y-3 mt-5"+ initial={{ opacity: 0, y: 10 }}+ animate={{ opacity: 1, y: 0 }}+ exit={{ opacity: 0, y: -10 }}+ >+ <div className="flex items-center gap-3"><Buttonvariant="outline"size="sm"onClick={openLogsFolder}- className="font-mono text-xs"+ className="font-mono text-[10px] h-7 px-2">- open logs folder+ logs</Button><Buttonvariant="outline"size="sm"onClick={sendLogs}disabled={isSendingLogs || logsSent}- className="font-mono text-xs"+ className="font-mono text-[10px] h-7 px-2">{isSendingLogs ? (- <><Loader className="w-3 h-3 mr-1 animate-spin" /> sending...</>+ <Loader className="w-3 h-3 animate-spin" />) : logsSent ? (- <><Check className="w-3 h-3 mr-1" /> logs sent</>+ <><Check className="w-3 h-3 mr-1" /> sent</>) : (<><Upload className="w-3 h-3 mr-1" /> send logs</>)}</Button>- </div>- <Button- variant="link"- size="sm"- onClick={openBookingLink}- className="font-mono text-xs text-primary"- >- <Calendar className="w-3 h-3 mr-1" />- book a call for help- </Button>- <Button- variant="default"- size="sm"- onClick={() => {- posthog.capture("onboarding_startup_skipped");- handleComplete();- }}- className="font-mono text-xs mt-2"- >- skip waiting →- </Button>- </div>- </motion.div>- )}- </motion.div>- )}-- {/* Recording state — auto-advances to shortcut gate via useEffect */}-- {/* Ready but not auto-started (fallback) */}- {setupState === "ready" && (- <motion.div- className="flex flex-col items-center space-y-6"- initial={{ opacity: 0 }}- animate={{ opacity: 1 }}- >- <Lottie- animationData={pipeFlowAnimation}- loop={true}- className="w-32 h-12"- />- <p className="font-mono text-sm text-muted-foreground">starting screenpipe...</p>-- {isStuck && (- <motion.div- className="flex flex-col items-center space-y-4 mt-4 p-4 border border-border bg-muted/50 rounded-lg max-w-md"- initial={{ opacity: 0, y: 10 }}- animate={{ opacity: 1, y: 0 }}- >- <div className="flex items-center space-x-2 text-muted-foreground">- <AlertTriangle className="w-4 h-4" />- <span className="font-mono text-sm">taking longer than expected</span>- </div>- <p className="font-mono text-xs text-muted-foreground text-center">- this might be due to missing permissions or a startup issue.- {isMacOS && " try granting screen recording & microphone access in system settings."}- </p>- <div className="flex flex-col items-center space-y-2 w-full">- <div className="flex items-center space-x-2">- {isMacOS && (- <Button- variant="outline"- size="sm"- onClick={() => requestPermission("screen")}- className="font-mono text-xs"- >- check permissions- </Button>- )}- <Button- variant="outline"- size="sm"- onClick={openLogsFolder}- className="font-mono text-xs"- >- open logs folder- </Button>- </div>- <div className="flex items-center space-x-2"><Buttonvariant="outline"size="sm"- onClick={sendLogs}- disabled={isSendingLogs || logsSent}- className="font-mono text-xs"+ onClick={openBookingLink}+ className="font-mono text-[10px] h-7 px-2">- {isSendingLogs ? (- <><Loader className="w-3 h-3 mr-1 animate-spin" /> sending...</>- ) : logsSent ? (- <><Check className="w-3 h-3 mr-1" /> logs sent</>- ) : (- <><Upload className="w-3 h-3 mr-1" /> send logs</>- )}+ <Calendar className="w-3 h-3 mr-1" /> help</Button></div>- <Button- variant="link"- size="sm"- onClick={openBookingLink}- className="font-mono text-xs text-primary"- >- <Calendar className="w-3 h-3 mr-1" />- book a call for help- </Button>- <Button- variant="default"- size="sm"+ <buttononClick={() => {posthog.capture("onboarding_startup_skipped");handleComplete();}}- className="font-mono text-xs mt-2"+ className="font-mono text-[10px] text-muted-foreground/60 hover:text-foreground transition-colors">- skip waiting →- </Button>- </div>- </motion.div>- )}+ skip →+ </button>+ </motion.div>+ )}+ </AnimatePresence></motion.div>)}</div>