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

refactor: onboarding, fix: issue with mp4 files on macos being associated with screenpipe

Louis Beaumonta86cb530a120
diff --git a/.github/workflows/build-core-pipes.yml b/.github/workflows/build-core-pipes.yml
index 43d55bce1..ef470d164 100644
--- a/.github/workflows/build-core-pipes.yml
+++ b/.github/workflows/build-core-pipes.yml
@@ -40,10 +40,19 @@ jobs:
bun install
bun run build
- # create zip of dist folder
- cd dist
- zip -r ../../$pipe.zip .
- cd ../..
+ # create zip only if build succeeded and dist exists
+ if [ -d "dist" ]; then
+ cd dist
+ zip -r ../../$pipe.zip .
+ cd ../..
+ else
+ echo "warning: no dist directory found for $pipe"
+ fi
+
+ # go back to root for next iteration
+ cd ../../
+ else
+ echo "warning: pipe directory $pipe not found"
fi
done
diff --git a/screenpipe-app-tauri/app/page.tsx b/screenpipe-app-tauri/app/page.tsx
index 4d525570c..a65cebcef 100644
--- a/screenpipe-app-tauri/app/page.tsx
+++ b/screenpipe-app-tauri/app/page.tsx
@@ -1,15 +1,6 @@
"use client";
-import { Settings } from "@/components/settings";
import { getStore, useSettings } from "@/lib/hooks/use-settings";
-import {
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
-} from "@/components/ui/card";
-import { Skeleton } from "@/components/ui/skeleton";
import React, { useEffect } from "react";
import NotificationHandler from "@/components/notification-handler";
@@ -18,12 +9,9 @@ import { usePostHog } from "posthog-js/react";
import { useToast } from "@/components/ui/use-toast";
import Onboarding from "@/components/onboarding";
import { useOnboarding } from "@/lib/hooks/use-onboarding";
-import { registerShortcuts } from "@/lib/shortcuts";
import { ChangelogDialog } from "@/components/changelog-dialog";
import { BreakingChangesInstructionsDialog } from "@/components/breaking-changes-instructions-dialog";
-import { Button } from "@/components/ui/button";
-import { Plus } from "lucide-react";
import { platform } from "@tauri-apps/plugin-os";
import PipeStore from "@/components/pipe-store";
import { invoke } from "@tauri-apps/api/core";
@@ -31,6 +19,7 @@ import { listen } from "@tauri-apps/api/event";
import { useProfiles } from "@/lib/hooks/use-profiles";
import { relaunch } from "@tauri-apps/plugin-process";
import { PipeApi } from "@/lib/api";
+import localforage from "localforage";
export default function Home() {
const { settings } = useSettings();
@@ -106,7 +95,9 @@ export default function Home() {
const devices = await getAudioDevices();
const pipeApi = new PipeApi();
console.log("audio-devices", devices);
- await Promise.all(devices.map(device => pipeApi.startAudio(device)));
+ await Promise.all(
+ devices.map((device) => pipeApi.startAudio(device))
+ );
toast({
title: "audio started",
description: "audio has been started",
@@ -115,7 +106,8 @@ export default function Home() {
console.error("error starting audio:", error);
toast({
title: "error starting audio",
- description: error instanceof Error ? error.message : "unknown error occurred",
+ description:
+ error instanceof Error ? error.message : "unknown error occurred",
variant: "destructive",
});
} finally {
@@ -137,8 +129,9 @@ export default function Home() {
} catch (error) {
console.error("error stopping audio:", error);
toast({
- title: "error stopping audio",
- description: error instanceof Error ? error.message : "unknown error occurred",
+ title: "error stopping audio",
+ description:
+ error instanceof Error ? error.message : "unknown error occurred",
variant: "destructive",
});
}
@@ -160,17 +153,35 @@ export default function Home() {
}
}, [settings.userId, posthog]);
+ useEffect(() => {
+ const checkScreenPermissionRestart = async () => {
+ const restartPending = await localforage.getItem(
+ "screenPermissionRestartPending"
+ );
+ if (restartPending) {
+ setShowOnboarding(true);
+ }
+ };
+
+ checkScreenPermissionRestart();
+ }, [setShowOnboarding]);
+
return (
<div className="flex flex-col items-center flex-1">
<NotificationHandler />
- {showOnboarding && <Onboarding />}
- <ChangelogDialog />
- <BreakingChangesInstructionsDialog />
- <Header />
- <div className="h-[32px]" />
- <div className=" w-[90%]">
- <PipeStore />
- </div>
+ {showOnboarding ? (
+ <Onboarding />
+ ) : (
+ <>
+ <ChangelogDialog />
+ <BreakingChangesInstructionsDialog />
+ <Header />
+ <div className="h-[32px]" />
+ <div className=" w-[90%]">
+ <PipeStore />
+ </div>
+ </>
+ )}
</div>
);
}
diff --git a/screenpipe-app-tauri/components/onboarding.tsx b/screenpipe-app-tauri/components/onboarding.tsx
index 9f8994a37..45ef586e2 100644
--- a/screenpipe-app-tauri/components/onboarding.tsx
+++ b/screenpipe-app-tauri/components/onboarding.tsx
@@ -13,6 +13,9 @@ import OnboardingSelection from "@/components/onboarding/usecases-selection";
import OnboardingInstructions from "@/components/onboarding/explain-instructions";
import { useOnboarding } from "@/lib/hooks/use-onboarding";
import { useSettings } from "@/lib/hooks/use-settings";
+import OnboardingLogin from "./onboarding/login";
+import OnboardingPipeStore from "./onboarding/pipe-store";
+import posthog from "posthog-js";
const setFirstTimeUserFlag = async () => {
await localforage.setItem("isFirstTimeUser", false);
@@ -21,12 +24,14 @@ const setFirstTimeUserFlag = async () => {
type SlideKey =
| "intro"
| "status"
+ | "login"
| "selection"
| "personalize"
| "apiSetup"
| "devOrNonDev"
| "devConfig"
| "pipes"
+ | "pipeStore"
| "instructions";
const slideFlow: Record<
@@ -51,9 +56,14 @@ const slideFlow: Record<
},
status: {
// status of screenpipe (blockage or not)
- next: () => "selection",
+ next: () => "login",
prev: () => "intro",
},
+ login: {
+ // login
+ next: () => "apiSetup",
+ prev: () => "status",
+ },
selection: {
// selection (four options)
next: (selectedOptions) => {
@@ -78,16 +88,13 @@ const slideFlow: Record<
},
apiSetup: {
// api setup & validation
- next: () => "instructions",
- prev: (selectedOptions) => {
- if (
- selectedOptions?.length === 1 &&
- selectedOptions?.includes("professionalUse")
- ) {
- return "selection";
- }
- return "personalize";
- },
+ next: () => "pipeStore",
+ prev: () => "login",
+ },
+ pipeStore: {
+ // pipe store
+ next: () => null,
+ prev: () => "apiSetup",
},
devOrNonDev: {
// dev or no dev
@@ -127,6 +134,16 @@ const slideFlow: Record<
},
};
+const trackOnboardingStep = (
+ step: SlideKey | "completed",
+ properties?: Record<string, any>
+) => {
+ posthog.capture("onboarding_step", {
+ step,
+ ...properties,
+ });
+};
+
const Onboarding: React.FC = () => {
const { toast } = useToast();
const [currentSlide, setCurrentSlide] = useState<SlideKey>("intro");
@@ -174,6 +191,14 @@ const Onboarding: React.FC = () => {
selectedPreference,
selectedPersonalization
);
+
+ trackOnboardingStep(currentSlide, {
+ selectedOptions,
+ selectedPreference,
+ selectedPersonalization,
+ direction: "next",
+ });
+
if (
currentSlide === "selection" &&
(!selectedOptions || selectedOptions.length === 0)
@@ -202,6 +227,14 @@ const Onboarding: React.FC = () => {
const handlePrevSlide = () => {
setIsVisible(false);
+
+ trackOnboardingStep(currentSlide, {
+ selectedOptions,
+ selectedPreference,
+ selectedPersonalization,
+ direction: "back",
+ });
+
setTimeout(() => {
const prevSlide = slideFlow[currentSlide].prev(
selectedOptions,
@@ -231,6 +264,12 @@ const Onboarding: React.FC = () => {
};
const handleEnd = async () => {
+ trackOnboardingStep("completed", {
+ finalOptions: selectedOptions,
+ finalPreference: selectedPreference,
+ finalPersonalization: selectedPersonalization,
+ });
+
setShowOnboarding(false);
await setFirstTimeUserFlag();
updateSettings({
@@ -257,6 +296,14 @@ const Onboarding: React.FC = () => {
handleNextSlide={handleNextSlide}
/>
)}
+ {currentSlide === "login" && (
+ <OnboardingLogin
+ className={`transition-opacity duration-300
+ ${isVisible ? "opacity-100 ease-out" : "opacity-0 ease-in"}`}
+ handleNextSlide={handleNextSlide}
+ handlePrevSlide={handlePrevSlide}
+ />
+ )}
{currentSlide === "selection" && (
<OnboardingSelection
className={`transition-opacity duration-300 ease-in-out
@@ -285,6 +332,14 @@ const Onboarding: React.FC = () => {
handlePrevSlide={handlePrevSlide}
/>
)}
+ {currentSlide === "pipeStore" && (
+ <OnboardingPipeStore
+ className={`transition-opacity duration-300 ease-in-out
+ ${isVisible ? "opacity-100 ease-out" : "opacity-0 ease-in"}`}
+ handleNextSlide={handleEnd}
+ handlePrevSlide={handlePrevSlide}
+ />
+ )}
{currentSlide === "devOrNonDev" && (
<OnboardingDevOrNonDev
className={`transition-opacity duration-300 ease-in-out
diff --git a/screenpipe-app-tauri/components/onboarding/api-setup.tsx b/screenpipe-app-tauri/components/onboarding/api-setup.tsx
index 48521b645..7ff7fb411 100644
--- a/screenpipe-app-tauri/components/onboarding/api-setup.tsx
+++ b/screenpipe-app-tauri/components/onboarding/api-setup.tsx
@@ -22,6 +22,7 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
+import AISection from "../settings/ai-section";
interface OnboardingAPISetupProps {
className?: string;
@@ -54,12 +55,14 @@ const OnboardingAPISetup: React.FC<OnboardingAPISetupProps> = ({
useEffect(() => {
const { aiUrl, openaiApiKey, aiModel } = localSettings;
- const isApiKeyRequired = aiUrl !== "https://ai-proxy.i-f9f.workers.dev/v1" && aiUrl !== "http://localhost:11434/v1";
-
+ const isApiKeyRequired =
+ aiUrl !== "https://ai-proxy.i-f9f.workers.dev/v1" &&
+ aiUrl !== "http://localhost:11434/v1";
+
setAreAllInputsFilled(
- aiUrl.trim() !== "" &&
- aiModel.trim() !== "" &&
- (!isApiKeyRequired || openaiApiKey.trim() !== "")
+ aiUrl.trim() !== "" &&
+ aiModel.trim() !== "" &&
+ (!isApiKeyRequired || openaiApiKey.trim() !== "")
);
}, [localSettings]);
@@ -67,6 +70,11 @@ const OnboardingAPISetup: React.FC<OnboardingAPISetupProps> = ({
const { aiUrl, openaiApiKey, aiModel } = localSettings;
const newErrors: { [key: string]: string } = {};
try {
+ const t = toast({
+ title: "validating AI provider",
+ description: "please wait...",
+ duration: 10000,
+ });
const response = await fetch(`${aiUrl}/chat/completions`, {
method: "POST",
headers: {
@@ -83,7 +91,7 @@ const OnboardingAPISetup: React.FC<OnboardingAPISetupProps> = ({
{
role: "user",
content:
- "Tell me a short joke (1-2 sentences) about screen recording, answer in lower case only.",
+ "Tell me a very short joke (1-2 sentences) about screen recording, AI, and screenpipe, answer in lower case only.",
},
],
max_tokens: 60,
@@ -96,7 +104,8 @@ const OnboardingAPISetup: React.FC<OnboardingAPISetupProps> = ({
const joke = data.choices[0].message.content.trim();
console.log("ai is ready!", joke);
- toast({
+ t.update({
+ id: t.id,
title: "ai is ready!",
description: `here's a joke: ${joke}`,
duration: 5000,
@@ -288,11 +297,15 @@ const OnboardingAPISetup: React.FC<OnboardingAPISetupProps> = ({
</DialogTitle>
</DialogHeader>
<Card className="mt-4">
- <CardHeader>
- <CardTitle className="text-center">setup api key</CardTitle>
- </CardHeader>
- <CardContent className="flex flex-col items-center space-y-4">
- <div className="w-full max-w-md">
+ <CardContent className="flex flex-col items-center space-y-4 max-h-[60vh] overflow-y-auto ">
+ <AISection />
+ <div className="mb-16" />
+ <div className="mb-16" />
+ <div className="mb-16" />
+ <div className="mb-16" />
+ <div className="mb-16" />
+ <div className="mb-16" />
+ {/* <div className="w-full max-w-md">
<div className="flex items-center gap-2 mb-2">
<Label htmlFor="aiUrl" className="min-w-[100px] text-right">
ai provider
@@ -421,7 +434,7 @@ const OnboardingAPISetup: React.FC<OnboardingAPISetupProps> = ({
</Tooltip>
</TooltipProvider>
</div>
- </div>
+ </div> */}
</CardContent>
</Card>
<a
diff --git a/screenpipe-app-tauri/components/onboarding/login.tsx b/screenpipe-app-tauri/components/onboarding/login.tsx
new file mode 100644
index 000000000..bea305ae1
--- /dev/null
+++ b/screenpipe-app-tauri/components/onboarding/login.tsx
@@ -0,0 +1,136 @@
+import React, { useEffect } from "react";
+import { ExternalLinkIcon, UserCog, Coins } from "lucide-react";
+import { open } from "@tauri-apps/plugin-shell";
+import { Input } from "@/components/ui/input";
+import { Label } from "@/components/ui/label";
+import { Button } from "@/components/ui/button";
+import { Badge } from "@/components/ui/badge";
+import { useSettings } from "@/lib/hooks/use-settings";
+import { useUser } from "@/lib/hooks/use-user";
+import { toast } from "@/components/ui/use-toast";
+import { onOpenUrl } from "@tauri-apps/plugin-deep-link";
+import OnboardingNavigation from "./navigation";
+
+interface OnboardingLoginProps {
+ className?: string;
+ handlePrevSlide: () => void;
+ handleNextSlide: () => void;
+}
+
+const OnboardingLogin: React.FC<OnboardingLoginProps> = ({
+ className = "",
+ handlePrevSlide,
+ handleNextSlide,
+}) => {
+ const { user, loadUser } = useUser();
+ const { settings, updateSettings } = useSettings();
+
+ useEffect(() => {
+ const setupDeepLink = async () => {
+ const unsubscribeDeepLink = await onOpenUrl(async (urls) => {
+ console.log("urls", urls);
+ for (const url of urls) {
+ if (url.includes("api_key=")) {
+ const apiKey = new URL(url).searchParams.get("api_key");
+ if (apiKey) {
+ updateSettings({ user: { token: apiKey } });
+ toast({
+ title: "logged in!",
+ description: "your api key has been set",
+ });
+ // handleNextSlide();
+ }
+ }
+ }
+ });
+ return unsubscribeDeepLink;
+ };
+
+ let deepLinkUnsubscribe: (() => void) | undefined;
+ setupDeepLink().then((unsubscribe) => {
+ deepLinkUnsubscribe = unsubscribe;
+ });
+
+ return () => {
+ if (deepLinkUnsubscribe) deepLinkUnsubscribe();
+ };
+ }, [settings.user?.token, updateSettings, handleNextSlide]);
+
+ return (
+ <div className={`${className} w-full flex justify-center flex-col px-6`}>
+ <div className="flex flex-col items-center mb-8">
+ <img className="w-24 h-24" src="/128x128.png" alt="screenpipe-logo" />
+ <h1 className="text-2xl font-bold mt-4">welcome to screenpipe</h1>
+ </div>
+
+ <div className="space-y-6">
+ <div className="flex items-center gap-3">
+ <Coins className="w-4 h-4 text-muted-foreground" />
+ <h4 className="text-sm font-medium">credits & usage</h4>
+ <Badge variant="secondary" className="rounded-full px-2.5 py-0.5">
+ {user?.credits?.amount || 0} available
+ </Badge>
+ </div>
+
+ <div className="space-y-3">
+ <Label className="text-sm font-medium text-muted-foreground">
+ screenpipe api key
+ </Label>
+ <div className="flex gap-2">
+ <Input
+ value={settings.user?.token || ""}
+ onChange={(e) => {
+ updateSettings({
+ user: { token: e.target.value },
+ });
+ }}
+ placeholder="enter your api key"
+ className="font-mono text-sm bg-secondary/30"
+ />
+ <Button
+ variant="secondary"
+ size="sm"
+ onClick={async () => {
+ await loadUser(settings.user?.token || "");
+ toast({ title: "key verified" });
+ handleNextSlide();
+ }}
+ >
+ verify
+ </Button>
+ </div>
+ </div>
+
+ <div className="flex gap-2 justify-center mt-6">
+ {settings.user?.token && (
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => open("https://accounts.screenpi.pe/user")}
+ className="hover:bg-secondary/80"
+ >
+ manage account <UserCog className="w-4 h-4 ml-2" />
+ </Button>
+ )}
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => open("https://screenpi.pe/login")}
+ className="hover:bg-secondary/80"
+ >
+ login <ExternalLinkIcon className="w-4 h-4 ml-2" />
+ </Button>
+ <OnboardingNavigation
+ className="mt-6"
+ handlePrevSlide={handlePrevSlide}
+ handleNextSlide={handleNextSlide}
+ prevBtnText="previous"
+ nextBtnText="next"
+ />
+ </div>
+ </div>
+ </div>
+ );
+};
+
+export default OnboardingLogin;
diff --git a/screenpipe-app-tauri/components/onboarding/pipe-store.tsx b/screenpipe-app-tauri/components/onboarding/pipe-store.tsx
new file mode 100644
index 000000000..5ae8784df
--- /dev/null
+++ b/screenpipe-app-tauri/components/onboarding/pipe-store.tsx
@@ -0,0 +1,160 @@
+import React from "react";
+import { Button } from "@/components/ui/button";
+import { Search, Loader2 } from "lucide-react";
+import OnboardingNavigation from "./navigation";
+import { toast } from "@/components/ui/use-toast";
+import { invoke } from "@tauri-apps/api/core";
+import posthog from "posthog-js";
+
+interface OnboardingPipeStoreProps {
+ className?: string;
+ handlePrevSlide: () => void;
+ handleNextSlide: () => void;
+}
+
+const OnboardingPipeStore: React.FC<OnboardingPipeStoreProps> = ({
+ className = "",
+ handlePrevSlide,
+ handleNextSlide,
+}) => {
+ const [isLoading, setIsLoading] = React.useState(false);
+
+ const handleOpenSearchPipe = async () => {
+ setIsLoading(true);
+ try {
+ posthog.capture("open_search_pipe_from_onboarding");
+
+ // Create initial toast
+ const t = toast({
+ title: "opening search pipe",
+ description: "please wait...",
+ duration: 5000,
+ });
+
+ // Check if screenpipe is running, if not spawn it
+ try {
+ await fetch("http://localhost:3030/health");
+ } catch (error) {
+ // Screenpipe not running, try to spawn it
+ await invoke("kill_all_sreenpipes");
+ await new Promise((resolve) => setTimeout(resolve, 1_000));
+ await invoke("spawn_screenpipe");
+ await new Promise((resolve) => setTimeout(resolve, 5_000));
+ }
+
+ // Enable the search pipe if not already enabled
+ await fetch("http://localhost:3030/pipes/enable", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({ pipe_id: "search" }),
+ });
+
+ // Wait for pipe to initialize
+ await new Promise((resolve) => setTimeout(resolve, 2000));
+
+ // Get pipe info to find the port
+ const response = await fetch("http://localhost:3030/pipes/list");
+ const data = await response.json();
+ const searchPipe = data.data.find((p: any) => p.id === "search");
+
+ if (!searchPipe?.config?.port) {
+ throw new Error("search pipe not found or port not configured");
+ }
+
+ // Check if pipe is actually running by trying to connect to its port
+ try {
+ await fetch(`http://localhost:${searchPipe.config.port}`, {
+ mode: "no-cors",
+ });
+ } catch (error) {
+ throw new Error("search pipe failed to start");
+ }
+
+ // Open the pipe window
+ await invoke("open_pipe_window", {
+ port: searchPipe.config.port,
+ title: "search",
+ });
+
+ t.update({
+ id: t.id,
+ title: "search pipe ready",
+ description: "you can now search through your recordings",
+ duration: 2000,
+ });
+
+ // Move to next slide
+ // handleNextSlide();
+ } catch (error) {
+ console.error("failed to open search pipe:", error);
+ toast({
+ title: "error opening search pipe",
+ description: "please try again or check the logs",
+ variant: "destructive",
+ });
+ } finally {
+ setIsLoading(false);
+ }
+ };
+
+ return (
+ <div
+ className={`${className} w-full h-screen flex flex-col px-6 overflow-y-auto`}
+ >
+ <div className="flex-1 flex flex-col items-center">
+ <div className="flex flex-col items-center mb-8">
+ <img className="w-24 h-24" src="/128x128.png" alt="screenpipe-logo" />
+ <h1 className="text-2xl font-bold mt-4">welcome to the pipe store</h1>
+ </div>
+
+ <div className="space-y-8 max-w-2xl mx-auto w-full">
+ {/* Store preview image */}
+ <img
+ src="/pipe-store-preview.png"
+ alt="pipe store interface"
+ className="w-full rounded-lg border shadow-sm"
+ />
+
+ <div className="space-y-4 text-center">
+ <p className="text-muted-foreground my-2">
+ screenpipe records your screen and audio 24/7 and makes it easy
+ for AI to search through your recordings. developers can create
+ powerful apps on top of screenpipe. let&apos;s start with
+ &quot;search&quot; to explore your recordings.
+ once in the search pipe, you can use the &quot;search&quot;
+ button to search through your recordings and ask a summary to AI.
+ </p>
+
+ <Button
+ size="lg"
+ className="gap-2 my-8"
+ onClick={handleOpenSearchPipe}
+ disabled={isLoading}
+ >
+ {isLoading ? (
+ <Loader2 className="w-4 h-4 animate-spin" />
+ ) : (
+ <Search className="w-4 h-4" />
+ )}
+ {isLoading ? "opening search..." : "open search pipe"}
+ </Button>
+ </div>
+ </div>
+ </div>
+
+ <div className="my-8" />
+
+ <OnboardingNavigation
+ className="py-6"
+ handlePrevSlide={handlePrevSlide}
+ handleNextSlide={handleNextSlide}
+ prevBtnText="previous"
+ nextBtnText="end"
+ />
+ </div>
+ );
+};
+
+export default OnboardingPipeStore;
diff --git a/screenpipe-app-tauri/components/onboarding/status.tsx b/screenpipe-app-tauri/components/onboarding/status.tsx
index e2737c333..9a6930772 100644
--- a/screenpipe-app-tauri/components/onboarding/status.tsx
+++ b/screenpipe-app-tauri/components/onboarding/status.tsx
@@ -1,9 +1,5 @@
-{
- /*TODO: setup screenpipe status <10-10-24, @tribhuwan-kumar>*/
-}
-
-import React, { useState } from "react";
-import { ArrowUpRight, Check, HelpCircle } from "lucide-react";
+import React, { useState, useEffect } from "react";
+import { Check, HelpCircle, Lock, Video, X } from "lucide-react";
import { DialogHeader, DialogTitle } from "@/components/ui/dialog";
import OnboardingNavigation from "@/components/onboarding/navigation";
import { Command } from "@tauri-apps/plugin-shell";
@@ -17,7 +13,13 @@ import {
} from "../ui/tooltip";
import { useSettings } from "@/lib/hooks/use-settings";
import { Label } from "../ui/label";
-import { trackError } from "@/lib/opentelemetry";
+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";
interface OnboardingStatusProps {
className?: string;
@@ -25,6 +27,17 @@ 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,
@@ -34,48 +47,133 @@ 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 startSetup = async () => {
- setIsLoading(true);
- setStatus(null);
+ 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 handlePermissionButton = async (
+ type: "screen" | "audio" | "accessibility"
+ ) => {
+ const toastId = toast({
+ title: `checking ${type} permissions`,
+ description: "please wait...",
+ duration: Infinity,
+ });
try {
- const command = Command.sidecar("screenpipe", ["setup"]);
+ const os = platform();
+ const permissionType =
+ type === "screen"
+ ? "screenRecording"
+ : type === "audio"
+ ? "microphone"
+ : "accessibility";
- const timeoutPromise = new Promise(
- (_, reject) =>
- setTimeout(() => reject(new Error("status check timed out")), 900000) // 15 minutes
- );
+ await invoke("request_permission", {
+ permission: permissionType,
+ });
- const outputPromise = new Promise<string>((resolve, reject) => {
- command.on("close", (data) => {
- if (data.code !== 0) {
- reject(new Error(`command failed with code ${data.code}`));
- }
- });
- command.on("error", (error) => reject(new Error(error)));
- command.stdout.on("data", (line) => {
- console.log(line);
- if (line.includes("screenpipe setup complete")) {
- resolve("ok");
- }
+ 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;
+ }
+
+ const perms = await invoke<PermissionsStatus>("do_permissions_check", {
+ initialCheck: false,
});
+ setPermissions(perms);
- const child = await command.spawn();
+ toastId.update({
+ id: toastId.id,
+ title: "permission check complete",
+ description: `${type} permission check completed`,
+ 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,
+ });
+ }
+ };
- try {
- const result = await Promise.race([outputPromise, timeoutPromise]);
- setStatus(result as string);
- } catch (error) {
- console.error("error or timeout:", error);
- setStatus("error");
- } finally {
- setIsLoading(false);
- }
+ const handleStartScreenpipe = async () => {
+ posthog.capture("screenpipe_setup_start");
+ setIsLoading(true);
+ const toastId = toast({
+ title: "starting screenpipe",
+ description:
+ "please wait as we download AI models and start recording\nplease check logs if this is taking longer than expected (30s)",
+ duration: Infinity,
+ });
+ try {
+ await invoke("kill_all_sreenpipes");
+ await new Promise((resolve) => setTimeout(resolve, 1_000));
+
+ await invoke("spawn_screenpipe");
+ await new Promise((resolve) => setTimeout(resolve, 5_000));
+ toastId.update({
+ id: toastId.id,
+ title: "screenpipe started",
+ description: "screenpipe is now running.",
+ duration: 3000,
+ });
+ setStatus("ok");
} catch (error) {
- console.error("error checking status:", error);
- setStatus("error");
+ console.error("failed to start screenpipe:", error);
+ toastId.update({
+ id: toastId.id,
+ title: "error",
+ description: "failed to start screenpipe.",
+ variant: "destructive",
+ duration: 3000,
+ });
+ } finally {
+ toastId.dismiss();
setIsLoading(false);
}
};
@@ -95,92 +193,106 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
updateSettings({ useChineseMirror: checked });
};
- const runSetup = async () => {
- setIsLoading(true);
- setStatus(null);
-
- try {
- const command = Command.sidecar("screenpipe", ["setup"]);
-
- const timeoutPromise = new Promise(
- (_, reject) =>
- setTimeout(() => reject(new Error("setup timed out")), 900000) // 15 minutes
- );
-
- const outputPromise = new Promise<string>((resolve, reject) => {
- command.on("close", (data) => {
- if (data.code !== 0) {
- reject(new Error(`command failed with code ${data.code}`));
- }
- });
- command.on("error", (error) => reject(new Error(error)));
- command.stdout.on("data", (line) => {
- console.log(line);
- if (line.includes("screenpipe setup complete")) {
- resolve("ok");
- }
- });
- });
-
- const child = await command.spawn();
-
- try {
- const result = await Promise.race([outputPromise, timeoutPromise]);
- setStatus(result as string);
- } catch (error) {
- console.error("error or timeout:", error);
- setStatus("error");
- } finally {
- setIsLoading(false);
- }
- } catch (error) {
- console.error("error checking status:", error);
- setStatus("error");
- setIsLoading(false);
- trackError(error, {
- operation: "screenpipe-setup-failure",
- additionalAttributes: {
- useChineseMirror: String(useChineseMirror),
- },
- });
- }
- };
-
return (
<div
className={`${className} w-full flex justify-between flex-col items-center`}
>
<DialogHeader className="flex flex-col px-2 justify-center items-center">
- <img
- className="w-24 h-24 justify-center"
- src="/128x128.png"
- alt="screenpipe-logo"
- />
+ <img className="w-24 h-24 " src="/128x128.png" alt="screenpipe-logo" />
<DialogTitle className="text-center text-2xl">
setting up screenpipe
</DialogTitle>
- <h2 className="text-center text-sm">
- we need to download some ai models for you.
- <br />
- this may take a few minutes depending on your internet connection
- </h2>
</DialogHeader>
- <div className="mt-4 text-sm text-zinc-600 mx-auto">
+ {/* <div className="mt-4 text-sm text-zinc-600 mx-auto text-center flex flex-col items-center">
<p className="mb-2 text-center">how screenpipe works:</p>
<ul className="list-disc list-inside text-left">
- <li>core recording process runs in the background</li>
- <li>gui interface for easy interaction</li>
- <li>can also be used as a standalone cli tool</li>
- <li>captures screens & mics 24/7</li>
- <li>extracts text (ocr) & speech-to-text</li>
- <li>saves data locally for privacy</li>
+ <li>captures screens & mics 24/7 in the background</li>
+ <li>
+ extracts inforation from screens (ocr, accessibility API, etc.)
+ </li>
+ <li>
+ extracts information from mics (speech-to-text, voice
+ identification, etc.)
+ </li>
+ <li>
+ saves data locally for privacy (100% offline, no cloud storage)
+ </li>
</ul>
+ </div> */}
+
+ <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 === "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 === "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 === "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>
</div>
- <p className="text-xs text-center text-zinc-500 mt-2">
- if encountering any issues, you can proceed to the next step and it will
- setup screenpipe when starting the recording process
- </p>
+ <Separator className="w-full my-4" />
+
<div className="flex items-center space-x-2 mt-4">
<Switch
id="chinese-mirror-toggle"
@@ -213,7 +325,11 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
</Label>
</div>
{status === null ? (
- <Button onClick={startSetup} disabled={isLoading} className="mt-4">
+ <Button
+ onClick={handleStartScreenpipe}
+ disabled={isLoading}
+ className="mt-4"
+ >
{isLoading ? (
<svg
fill="none"
@@ -227,19 +343,25 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
>
<path d="M12 3v3m6.366-.366-2.12 2.12M21 12h-3m.366 6.366-2.12-2.12M12 21v-3m-6.366.366 2.12-2.12M3 12h3m-.366-6.366 2.12 2.12"></path>
</svg>
- ) : null}
- {isLoading ? "setting up..." : "start setup"}
+ ) : (
+ <Video className="h-4 w-4 mr-2" />
+ )}
+ {isLoading ? "starting..." : "start recording"}
</Button>
) : status === "ok" ? (
<div className="flex flex-col items-center mt-4">
<Check className="size-5 stroke-zinc-400" />
- <p className="text-sm text-zinc-600 mt-2">
- screenpipe setup complete. ai models downloaded.
+ <p className="text-sm text-zinc-600 mt-2 text-center">
+ screenpipe setup complete. <br />
+ AI models downloaded.
</p>
</div>
) : (
<p className="text-center mt-4">{status}</p>
)}
+ <Separator className="w-full my-4 " />
+ <LogFileButton />
+ <Separator className="w-full my-4 " />
<OnboardingNavigation
handlePrevSlide={handlePrev}
handleNextSlide={handleNext}
diff --git a/screenpipe-app-tauri/components/settings/ai-section.tsx b/screenpipe-app-tauri/components/settings/ai-section.tsx
index cfc7898ef..cf3f7e6d0 100644
--- a/screenpipe-app-tauri/components/settings/ai-section.tsx
+++ b/screenpipe-app-tauri/components/settings/ai-section.tsx
@@ -48,6 +48,7 @@ import {
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
+import posthog from "posthog-js";
interface AIProviderCardProps {
type: "screenpipe-cloud" | "openai" | "native-ollama" | "custom" | "embedded";
@@ -171,6 +172,7 @@ const AISection = () => {
};
const startOllamaSidecar = async () => {
+ posthog.capture("start_ollama_sidecar");
setOllamaStatus("running");
toast({
title: "starting ai",
@@ -236,10 +238,6 @@ const AISection = () => {
}
};
- const handleModelChange = (value: string) => {
- updateSettings({ aiModel: value });
- };
-
const handleCustomPromptChange = (
e: React.ChangeEvent<HTMLTextAreaElement>
) => {
@@ -254,10 +252,6 @@ const AISection = () => {
let newUrl = "";
let newModel = settings.aiModel;
- if (newValue === "screenpipe-cloud" && !credits?.amount) {
- openUrl("https://buy.stripe.com/5kA6p79qefweacg5kJ");
- return;
- }
switch (newValue) {
case "openai":
newUrl = "https://api.openai.com/v1";
@@ -340,16 +334,6 @@ const AISection = () => {
ai provider
</Label>
<div className="grid grid-cols-2 gap-4 mb-4 mt-4">
- <AIProviderCard
- type="screenpipe-cloud"
- title="screenpipe cloud"
- description="use openai, anthropic and google models without worrying about api keys or usage"
- imageSrc="/images/screenpipe.png"
- selected={settings.aiProviderType === "screenpipe-cloud"}
- onClick={() => handleAiProviderChange("screenpipe-cloud")}
- warningText={!credits?.amount ? "requires credits" : undefined}
- />
-
<AIProviderCard
type="openai"
title="openai"
@@ -359,6 +343,23 @@ const AISection = () => {
onClick={() => handleAiProviderChange("openai")}
/>
+ <AIProviderCard
+ type="screenpipe-cloud"
+ title="screenpipe cloud"
+ description="use openai, anthropic and google models without worrying about api keys or usage"
+ imageSrc="/images/screenpipe.png"
+ selected={settings.aiProviderType === "screenpipe-cloud"}
+ onClick={() => handleAiProviderChange("screenpipe-cloud")}
+ disabled={!user}
+ warningText={
+ !user
+ ? "login required"
+ : !credits?.amount
+ ? "requires credits"
+ : undefined
+ }
+ />
+
<AIProviderCard
type="native-ollama"
title="ollama"
diff --git a/screenpipe-app-tauri/package.json b/screenpipe-app-tauri/package.json
index 802233a6c..471e4c7f2 100644
--- a/screenpipe-app-tauri/package.json
+++ b/screenpipe-app-tauri/package.json
@@ -2,12 +2,12 @@
"name": "screenpipe-app",
"private": true,
"scripts": {
- "predev": "echo 'make sure to run cargo build --release and bun predev if you are using non dev mode in screenpipe UI'",
"dev": "next dev",
"build": "next build",
+ "predev": "bun scripts/pre_build.js",
"prebuild": "bun scripts/pre_build.js",
"tauri": "tauri",
- "clean": "rm -rf out && cargo clean && rm -rf src-tauri/{screenpipe-*,tesseract-*,ffmpeg} node_modules"
+ "clean": "rm -rf out && cargo clean && rm -rf src-tauri/{screenpipe-*,tesseract-*,ffmpeg*,bun*,ollama*,ui_monitor*} node_modules"
},
"dependencies": {
"@opentelemetry/api": "^1.9.0",
diff --git a/screenpipe-app-tauri/public/pipe-store-preview.png b/screenpipe-app-tauri/public/pipe-store-preview.png
new file mode 100644
index 000000000..c28dcbb22
Binary files /dev/null and b/screenpipe-app-tauri/public/pipe-store-preview.png differ
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index c1db1ee86..066ba1269 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -5165,7 +5165,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "0.24.9"
+version = "0.25.1"
dependencies = [
"anyhow",
"axum",
diff --git a/screenpipe-app-tauri/src-tauri/tauri.conf.json b/screenpipe-app-tauri/src-tauri/tauri.conf.json
index 6d31fe041..2bcf4f5ef 100644
--- a/screenpipe-app-tauri/src-tauri/tauri.conf.json
+++ b/screenpipe-app-tauri/src-tauri/tauri.conf.json
@@ -30,36 +30,8 @@
"icons/screenpipe-logo-tray-failed.png",
"icons/screenpipe-logo-tray-black.png"
],
- "longDescription": "",
"resources": [
"assets/*"
- ],
- "shortDescription": "",
- "fileAssociations": [
- {
- "description": "Video files",
- "ext": [
- "mp4",
- "mkv",
- "avi",
- "mov",
- "wmv",
- "webm"
- ]
- },
- {
- "description": "Audio files",
- "ext": [
- "mp3",
- "wav",
- "aac",
- "flac",
- "oga",
- "ogg",
- "opic",
- "opus"
- ]
- }
]
},
"productName": "screenpipe",
@@ -75,16 +47,22 @@
},
"deep-link": {
"desktop": {
- "schemes": ["screenpipe"]
+ "schemes": [
+ "screenpipe"
+ ]
},
"mobile": [
{
"host": "screenpi.pe",
- "pathPrefix": ["/auth"]
+ "pathPrefix": [
+ "/auth"
+ ]
},
{
"host": "screenpi.pe",
- "pathPrefix": ["/stripe-connect"]
+ "pathPrefix": [
+ "/stripe-connect"
+ ]
}
]
}