Skip to content

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

release-app improve onboarding - stream screenshots in the UI

Louis Beaumont0c89ae5f1ea3
diff --git a/screenpipe-app-tauri/app/globals.css b/screenpipe-app-tauri/app/globals.css
index 0168f7d2e..37c897218 100644
--- a/screenpipe-app-tauri/app/globals.css
+++ b/screenpipe-app-tauri/app/globals.css
@@ -116,7 +116,7 @@
*,
a,
button {
- cursor: default;
+ /* cursor: default; */
user-select: none;
}
:not(input):not(textarea),
@@ -126,7 +126,7 @@
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none;
- cursor: default;
+ /* cursor: default; */
}
}
diff --git a/screenpipe-app-tauri/bun.lockb b/screenpipe-app-tauri/bun.lockb
index 05f22a176..9892f7d08 100755
Binary files a/screenpipe-app-tauri/bun.lockb and b/screenpipe-app-tauri/bun.lockb differ
diff --git a/screenpipe-app-tauri/components/onboarding/status.tsx b/screenpipe-app-tauri/components/onboarding/status.tsx
index 2645a9ca4..28bcf59cd 100644
--- a/screenpipe-app-tauri/components/onboarding/status.tsx
+++ b/screenpipe-app-tauri/components/onboarding/status.tsx
@@ -1,5 +1,5 @@
-import React, { useState, useEffect } from "react";
-import { Check, HelpCircle, Lock, Video, X } from "lucide-react";
+import React, { useState, useEffect, useRef } from "react";
+import { Check, HelpCircle, Video, ChevronDown } from "lucide-react";
import { DialogHeader, DialogTitle } from "@/components/ui/dialog";
import OnboardingNavigation from "@/components/onboarding/navigation";
import { Button } from "../ui/button";
@@ -12,13 +12,16 @@ import {
} from "../ui/tooltip";
import { useSettings } from "@/lib/hooks/use-settings";
import { Label } from "../ui/label";
-import { platform } from "@tauri-apps/plugin-os";
import { LogFileButton } from "../log-file-button";
import { Separator } from "../ui/separator";
import { invoke } from "@tauri-apps/api/core";
import posthog from "posthog-js";
import { toast } from "@/components/ui/use-toast";
-import localforage from "localforage";
+import { PermissionButtons } from "../status/permission-buttons";
+import { usePlatform } from "@/lib/hooks/use-platform";
+import { pipe } from "@screenpipe/browser";
+import { VisionEvent } from "@screenpipe/browser";
+import Image from "next/image";
interface OnboardingStatusProps {
className?: string;
@@ -26,17 +29,6 @@ interface OnboardingStatusProps {
handleNextSlide: () => void;
}
-// Add PermissionsStatus type
-type PermissionsStatus = {
- screenRecording: string;
- microphone: string;
- accessibility: string;
-};
-
-const setRestartPending = async () => {
- await localforage.setItem("screenPermissionRestartPending", true);
-};
-
const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
className = "",
handlePrevSlide,
@@ -46,47 +38,14 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
const [isLoading, setIsLoading] = useState(false);
const [useChineseMirror, setUseChineseMirror] = useState(false);
const { updateSettings } = useSettings();
- const [permissions, setPermissions] = useState<PermissionsStatus | null>(
- null
- );
- const [isRestartNeeded, setIsRestartNeeded] = useState(false);
+ const { isMac: isMacOS } = usePlatform();
const [stats, setStats] = useState<{
screenshots: number;
audioSeconds: number;
} | null>(null);
- const [isMacOS, setIsMacOS] = useState(false);
-
- useEffect(() => {
- const checkRestartStatus = async () => {
- const restartPending = await localforage.getItem(
- "screenPermissionRestartPending"
- );
- if (restartPending) {
- // Clear the flag
- await localforage.removeItem("screenPermissionRestartPending");
- // Recheck permissions
- const perms = await invoke<PermissionsStatus>("do_permissions_check", {
- initialCheck: true,
- });
- setPermissions(perms);
- }
- };
- checkRestartStatus();
- }, []);
-
- useEffect(() => {
- const checkPermissions = async () => {
- try {
- const perms = await invoke<PermissionsStatus>("do_permissions_check", {
- initialCheck: true,
- });
- setPermissions(perms);
- } catch (error) {
- console.error("Failed to check permissions:", error);
- }
- };
- checkPermissions();
- }, []);
+ const [visionEvent, setVisionEvent] = useState<VisionEvent | null>(null);
+ const [showScrollButton, setShowScrollButton] = useState(false);
+ const containerRef = useRef<HTMLDivElement>(null);
useEffect(() => {
const fetchStats = async () => {
@@ -141,78 +100,89 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
return () => clearInterval(interval);
}, []);
+ // Add effect for streaming screenshots when recording starts
useEffect(() => {
- const checkPlatform = () => {
- const currentPlatform = platform();
- setIsMacOS(currentPlatform === "macos");
+ let isActive = false;
+
+ const streamVision = async () => {
+ if (status !== "ok" || isActive) return;
+
+ isActive = true;
+ try {
+ console.log("starting vision stream");
+ for await (const event of pipe.streamVision(true)) {
+ setVisionEvent(event.data);
+ console.log("vision event received");
+
+ // Scroll to bottom when new vision event is received
+ setTimeout(() => {
+ if (containerRef.current) {
+ // Only auto-scroll if already near the bottom
+ const { scrollTop, scrollHeight, clientHeight } =
+ containerRef.current;
+ const isNearBottom =
+ scrollHeight - scrollTop - clientHeight < 150;
+
+ if (isNearBottom) {
+ containerRef.current.scrollTo({
+ top: containerRef.current.scrollHeight,
+ behavior: "smooth",
+ });
+ } else if (!showScrollButton) {
+ setShowScrollButton(true);
+ }
+ }
+ }, 100);
+ }
+ } catch (error) {
+ console.error("vision stream error:", error);
+ } finally {
+ isActive = false;
+ }
};
- checkPlatform();
- }, []);
- const handlePermissionButton = async (
- type: "screen" | "audio" | "accessibility"
- ) => {
- const toastId = toast({
- title: `checking ${type} permissions`,
- description: "please wait...",
- duration: Infinity,
- });
+ streamVision();
- try {
- const os = platform();
- const permissionType =
- type === "screen"
- ? "screenRecording"
- : type === "audio"
- ? "microphone"
- : "accessibility";
-
- await invoke("request_permission", {
- permission: permissionType,
- });
+ return () => {
+ pipe.disconnect();
+ };
+ }, [status, showScrollButton]);
- // Only handle macOS screen recording special case after requesting permission
- if (os === "macos" && type === "screen") {
- setIsRestartNeeded(true);
- await setRestartPending();
- toast({
- title: "restart required",
- description:
- "please restart the app after enabling screen recording permission",
- duration: 10000,
- });
- return;
- }
+ // Add effect to scroll to bottom when status changes to "ok"
+ useEffect(() => {
+ if (status === "ok" && containerRef.current) {
+ setTimeout(() => {
+ if (containerRef.current) {
+ containerRef.current.scrollTo({
+ top: containerRef.current.scrollHeight,
+ behavior: "smooth",
+ });
+ }
+ }, 500); // Give time for the UI to render
+ }
+ }, [status]);
- // Immediately check permissions after granting
- const perms = await invoke<PermissionsStatus>("do_permissions_check", {
- initialCheck: false,
- });
- setPermissions(perms);
+ // Add scroll event listener to show/hide scroll button
+ useEffect(() => {
+ const container = containerRef.current;
+ if (!container) return;
+
+ const handleScroll = () => {
+ const { scrollTop, scrollHeight, clientHeight } = container;
+ // Show button if not at bottom (with some threshold)
+ const isAtBottom = scrollHeight - scrollTop - clientHeight < 50;
+ setShowScrollButton(!isAtBottom);
+ };
- const granted =
- type === "screen"
- ? perms.screenRecording.toLowerCase() === "granted"
- : type === "audio"
- ? perms.microphone.toLowerCase() === "granted"
- : perms.accessibility.toLowerCase() === "granted";
+ container.addEventListener("scroll", handleScroll);
+ return () => container.removeEventListener("scroll", handleScroll);
+ }, []);
- toastId.update({
- id: toastId.id,
- title: granted ? "permission granted" : "permission check complete",
- description: granted
- ? `${type} permission was successfully granted`
- : `please try granting ${type} permission again if needed`,
- duration: 3000,
- });
- } catch (error) {
- console.error(`failed to handle ${type} permission:`, error);
- toastId.update({
- id: toastId.id,
- title: "error",
- description: `failed to handle ${type} permission`,
- variant: "destructive",
- duration: 3000,
+ const scrollToBottom = () => {
+ if (containerRef.current) {
+ containerRef.current.scrollTo({
+ top: containerRef.current.scrollHeight,
+ behavior: "smooth",
});
}
};
@@ -271,9 +241,10 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
return (
<div
- className={`${className} w-full flex justify-between flex-col items-center`}
+ ref={containerRef}
+ className={`${className} w-full flex flex-col items-center overflow-y-auto max-h-[80vh] pb-4 relative`}
>
- <DialogHeader className="flex flex-col px-2 justify-center items-center">
+ <DialogHeader className="flex flex-col px-2 justify-center items-center sticky top-0 bg-background z-10 w-full pt-4 pb-2">
<img className="w-24 h-24" src="/128x128.png" alt="screenpipe-logo" />
<DialogTitle className="text-center text-2xl">
setting up screenpipe
@@ -284,74 +255,12 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
</DialogHeader>
{isMacOS && (
- <div className="w-3/4 space-y-4 mt-4 flex flex-col items-center">
- <div className="flex items-center justify-between mx-auto w-full">
- <div className="flex items-right gap-2">
- {permissions && (
- <span>
- {permissions.screenRecording.toLowerCase() === "granted" ? (
- <Check className="h-4 w-4 text-green-500" />
- ) : (
- <X className="h-4 w-4 text-red-500" />
- )}
- </span>
- )}
- <span className="text-sm">screen recording permission</span>
- </div>
- <Button
- variant="outline"
- className="w-[260px] text-sm justify-start"
- onClick={() => handlePermissionButton("screen")}
- >
- <Lock className="h-4 w-4 mr-2" />
- grant screen permission
- </Button>
- </div>
-
- <div className="flex items-center justify-between mx-auto w-full">
- <div className="flex items-center gap-2">
- {permissions && (
- <span>
- {permissions.microphone.toLowerCase() === "granted" ? (
- <Check className="h-4 w-4 text-green-500" />
- ) : (
- <X className="h-4 w-4 text-red-500" />
- )}
- </span>
- )}
- <span className="text-sm">audio recording permission</span>
- </div>
- <Button
- variant="outline"
- className="w-[260px] text-sm justify-start"
- onClick={() => handlePermissionButton("audio")}
- >
- <Lock className="h-4 w-4 mr-2" />
- grant audio permission
- </Button>
- </div>
-
- <div className="flex items-center justify-between mx-auto w-full">
- <div className="flex items-center gap-2">
- {permissions && (
- <span>
- {permissions.accessibility.toLowerCase() === "granted" ? (
- <Check className="h-4 w-4 text-green-500" />
- ) : (
- <X className="h-4 w-4 text-red-500" />
- )}
- </span>
- )}
- <span className="text-sm">accessibility permission</span>
- </div>
- <Button
- variant="outline"
- className="w-[260px] text-sm justify-start"
- onClick={() => handlePermissionButton("accessibility")}
- >
- <Lock className="h-4 w-4 mr-2" />
- grant accessibility permission
- </Button>
+ <div className="mt-6 pt-4 border-t w-full flex flex-col items-center">
+ <h4 className="text-sm font-medium mb-3">check permissions</h4>
+ <div className="space-y-2">
+ <PermissionButtons type="screen" />
+ <PermissionButtons type="audio" />
+ <PermissionButtons type="accessibility" />
</div>
</div>
)}
@@ -427,14 +336,59 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
<LogFileButton />
</div>
- <OnboardingNavigation
- handlePrevSlide={handlePrev}
- handleNextSlide={handleNext}
- prevBtnText="previous"
- nextBtnText="next"
- />
+ {/* Screenshot stream display */}
+ {status === "ok" && (
+ <div
+ className="w-full mt-4 p-4 space-y-3 rounded-lg border bg-card text-card-foreground shadow-sm"
+ id="screenshot-preview"
+ >
+ <div className="flex items-center justify-between">
+ <h3 className="text-sm font-medium">live preview</h3>
+ <span className="text-xs text-muted-foreground">
+ {visionEvent ? "streaming..." : "waiting for stream..."}
+ </span>
+ </div>
+
+ {visionEvent?.image ? (
+ <div className="space-y-3">
+ <div className="relative w-full h-[250px] overflow-hidden rounded-md">
+ <Image
+ src={`data:image/jpeg;base64,${visionEvent.image}`}
+ alt="screen capture"
+ fill
+ style={{ objectFit: "contain" }}
+ className="rounded-md"
+ priority
+ />
+ </div>
+ <div className="grid grid-cols-2 gap-2 text-xs text-muted-foreground">
+ <div>
+ <span className="font-medium">app:</span>{" "}
+ {visionEvent.app_name || "unknown"}
+ </div>
+ <div>
+ <span className="font-medium">window:</span>{" "}
+ {visionEvent.window_name || "unknown"}
+ </div>
+ <div>
+ <span className="font-medium">time:</span>{" "}
+ {new Date(visionEvent.timestamp).toLocaleTimeString()}
+ </div>
+ {visionEvent.browser_url && (
+ <div className="col-span-2 truncate">
+ <span className="font-medium">url:</span>{" "}
+ {visionEvent.browser_url}
+ </div>
+ )}
+ </div>
+ </div>
+ ) : (
+ <div className="animate-pulse bg-gray-200 rounded-md w-full h-[250px]" />
+ )}
+ </div>
+ )}
- {/* Replace stats display with better styling */}
+ {/* Stats display */}
{stats && (
<div className="w-full p-4 space-y-3 rounded-lg border bg-card text-card-foreground shadow-sm">
<div className="flex items-center justify-between">
@@ -457,6 +411,26 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
</div>
</div>
)}
+
+ {/* Scroll to bottom button */}
+ {showScrollButton && status === "ok" && visionEvent && (
+ <button
+ onClick={scrollToBottom}
+ className="fixed bottom-16 right-4 bg-primary text-primary-foreground rounded-full p-2 shadow-md hover:bg-primary/90 transition-opacity z-20"
+ aria-label="Scroll to bottom"
+ >
+ <ChevronDown className="h-4 w-4" />
+ </button>
+ )}
+
+ <div className="sticky bottom-0 bg-background pt-2 pb-1 w-full">
+ <OnboardingNavigation
+ handlePrevSlide={handlePrev}
+ handleNextSlide={handleNext}
+ prevBtnText="previous"
+ nextBtnText="next"
+ />
+ </div>
</div>
);
};
diff --git a/screenpipe-app-tauri/components/pipe-store.tsx b/screenpipe-app-tauri/components/pipe-store.tsx
index 4a311aa3e..e6c6d1be4 100644
--- a/screenpipe-app-tauri/components/pipe-store.tsx
+++ b/screenpipe-app-tauri/components/pipe-store.tsx
@@ -1017,9 +1017,9 @@ export const PipeStore: React.FC = () => {
<div className="mt-6 pt-4 border-t w-full flex flex-col items-center">
<h4 className="text-sm font-medium mb-3">check permissions</h4>
<div className="space-y-2">
- <PermissionButtons settings={settings} type="screen" />
- <PermissionButtons settings={settings} type="audio" />
- <PermissionButtons settings={settings} type="accessibility" />
+ <PermissionButtons type="screen" />
+ <PermissionButtons type="audio" />
+ <PermissionButtons type="accessibility" />
</div>
</div>
)}
diff --git a/screenpipe-app-tauri/components/screenpipe-status.tsx b/screenpipe-app-tauri/components/screenpipe-status.tsx
index 61cbc2f8b..b6bc72335 100644
--- a/screenpipe-app-tauri/components/screenpipe-status.tsx
+++ b/screenpipe-app-tauri/components/screenpipe-status.tsx
@@ -12,7 +12,7 @@ import { toast } from "./ui/use-toast";
import { Button } from "./ui/button";
import { Separator } from "./ui/separator";
import { useHealthCheck } from "@/lib/hooks/use-health-check";
-import { Lock, Folder, Power, Settings } from "lucide-react";
+import { Folder, Power, Settings } from "lucide-react";
import { open as openUrl } from "@tauri-apps/plugin-shell";
import { LogFileButton } from "./log-file-button";
@@ -178,7 +178,7 @@ const HealthStatus = ({ className }: { className?: string }) => {
</span>
</div>
<div className="flex-shrink-0">
- <PermissionButtons type="screen" settings={settings} />
+ <PermissionButtons type="screen" />
</div>
</div>
@@ -209,7 +209,7 @@ const HealthStatus = ({ className }: { className?: string }) => {
</span>
</div>
<div className="flex-shrink-0">
- <PermissionButtons type="audio" settings={settings} />
+ <PermissionButtons type="audio" />
</div>
</div>
@@ -233,10 +233,7 @@ const HealthStatus = ({ className }: { className?: string }) => {
</span>
</div>
<div className="flex-shrink-0">
- <PermissionButtons
- type="accessibility"
- settings={settings}
- />
+ <PermissionButtons type="accessibility" />
</div>
</div>
)}
diff --git a/screenpipe-app-tauri/components/status/permission-buttons.tsx b/screenpipe-app-tauri/components/status/permission-buttons.tsx
index 117635a96..b092eaeab 100644
--- a/screenpipe-app-tauri/components/status/permission-buttons.tsx
+++ b/screenpipe-app-tauri/components/status/permission-buttons.tsx
@@ -4,6 +4,8 @@ import { Check, Lock, Settings, X } from "lucide-react";
import { toast } from "@/components/ui/use-toast";
import { invoke } from "@tauri-apps/api/core";
import { usePlatform } from "@/lib/hooks/use-platform";
+import { useSettings } from "@/lib/hooks/use-settings";
+import localforage from "localforage";
// You can add this to a types.ts file in your lib directory
export enum OSPermissionStatus {
@@ -20,14 +22,13 @@ export interface OSPermissionsCheck {
}
interface PermissionButtonsProps {
- settings: any;
type: "screen" | "audio" | "accessibility";
}
export const PermissionButtons: React.FC<PermissionButtonsProps> = ({
- settings,
type,
}) => {
+ const { settings } = useSettings();
const [permissions, setPermissions] = useState<OSPermissionsCheck | null>(
null
);
@@ -80,6 +81,18 @@ export const PermissionButtons: React.FC<PermissionButtonsProps> = ({
initialCheck: false,
});
setPermissions(perms);
+
+ // If screen recording permission was requested, set flag and prompt for restart
+ if (type === "screen") {
+ await localforage.setItem("screenPermissionRestartPending", true);
+
+ toast({
+ title: "restart required",
+ description:
+ "please restart the app to apply screen recording permission",
+ duration: 5000,
+ });
+ }
} catch (error) {
console.error(`Failed to request ${type} permission:`, error);
toast({
diff --git a/screenpipe-app-tauri/package.json b/screenpipe-app-tauri/package.json
index ebf9719ff..e7e4573e4 100644
--- a/screenpipe-app-tauri/package.json
+++ b/screenpipe-app-tauri/package.json
@@ -30,6 +30,7 @@
"@radix-ui/react-tabs": "^1.1.0",
"@radix-ui/react-toast": "^1.2.1",
"@radix-ui/react-tooltip": "^1.1.3",
+ "@screenpipe/browser": "^0.1.34",
"@sentry/react": "^8.52.0",
"@supabase/supabase-js": "^2.47.3",
"@tanstack/react-virtual": "^3.11.0",
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index 81ae3dd10..b2c2aede8 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -5289,7 +5289,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "0.37.6"
+version = "0.37.7"
dependencies = [
"anyhow",
"async-stream",
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 204356b72..f3d59f657 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.37.7"
+version = "0.37.8"
description = ""
authors = ["you"]
license = ""