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

feat(onboarding): add send logs and book call link when stuck

Louis Beaumont9da0d3b9dbd2
diff --git a/screenpipe-app-tauri/components/onboarding/status.tsx b/screenpipe-app-tauri/components/onboarding/status.tsx
index f26e49fec..d838e3697 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, useRef } from "react";
-import { Check, Monitor, Mic, AlertTriangle } from "lucide-react";
+import { Check, Monitor, Mic, AlertTriangle, Upload, Loader, Calendar } from "lucide-react";
import { Button } from "../ui/button";
import { invoke } from "@tauri-apps/api/core";
import posthog from "posthog-js";
@@ -7,10 +7,13 @@ import { usePlatform } from "@/lib/hooks/use-platform";
import { commands, type OSPermissionsCheck } from "@/lib/utils/tauri";
import { motion } from "framer-motion";
import { useSettings, DEFAULT_PROMPT } from "@/lib/hooks/use-settings";
-import { open as openPath } from "@tauri-apps/plugin-shell";
+import { open as openPath, open as openUrl } from "@tauri-apps/plugin-shell";
import { homeDir, join } from "@tauri-apps/api/path";
import { scheduleFirstRunNotification } from "@/lib/notifications";
import { TimelineAIDemo } from "./timeline-ai-demo";
+import { 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";
// Format shortcut for display (platform-aware)
function formatShortcut(shortcut: string, isMac: boolean): string {
@@ -47,11 +50,94 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
const [setupState, setSetupState] = useState<SetupState>("checking");
const [permissions, setPermissions] = useState<OSPermissionsCheck | null>(null);
const [isStuck, setIsStuck] = useState(false);
+ const [isSendingLogs, setIsSendingLogs] = useState(false);
+ const [logsSent, setLogsSent] = useState(false);
const { isMac: isMacOS } = usePlatform();
const { settings, updateSettings } = useSettings();
const hasStartedRef = useRef(false);
const stuckTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
+ const sendLogs = async () => {
+ setIsSendingLogs(true);
+ try {
+ 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 files
+ const 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 logContents = await Promise.all(
+ logFiles.map(async (file) => {
+ try {
+ const content = await readTextFile(file.path);
+ const truncated = content.length > MAX_LOG_SIZE
+ ? `... [truncated] ...\n` + content.slice(-MAX_LOG_SIZE)
+ : content;
+ return { name: file.name, content: truncated };
+ } catch {
+ return { name: file.name, content: "[Error reading file]" };
+ }
+ })
+ );
+
+ // Get signed URL
+ const 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();
+
+ // Upload logs
+ const combinedLogs = logContents
+ .map((log) => `\n=== ${log.name} ===\n${log.content}`)
+ .join("\n\n") + "\n\n=== Onboarding Stuck ===\nUser experienced startup issues during onboarding.";
+
+ await fetch(signedUrl, {
+ method: "PUT",
+ body: combinedLogs,
+ headers: { "Content-Type": "text/plain" },
+ });
+
+ // Confirm upload
+ 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",
+ }),
+ });
+
+ setLogsSent(true);
+ } catch (err) {
+ console.error("Failed to send logs:", err);
+ } finally {
+ setIsSendingLogs(false);
+ }
+ };
+
+ const openBookingLink = () => {
+ openUrl("https://cal.com/louis030195/screenpipe-onboarding");
+ };
+
// Create default screenpipe-cloud preset if none exists
const ensureDefaultPreset = async () => {
if (settings.aiPresets.length === 0) {
@@ -284,14 +370,42 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
this might be due to missing permissions or a startup issue.
{isMacOS && " try granting screen recording & microphone access in system settings."}
</p>
- <Button
- variant="outline"
- size="sm"
- onClick={openLogsFolder}
- className="font-mono text-xs"
- >
- open logs folder
- </Button>
+ <div className="flex flex-col items-center space-y-2 w-full">
+ <div className="flex items-center space-x-2">
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={openLogsFolder}
+ className="font-mono text-xs"
+ >
+ open logs folder
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={sendLogs}
+ disabled={isSendingLogs || logsSent}
+ className="font-mono text-xs"
+ >
+ {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</>
+ )}
+ </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>
+ </div>
</motion.div>
)}
</motion.div>
@@ -384,24 +498,52 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
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 items-center space-x-2">
- {isMacOS && (
+ <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={() => openSystemPreferences("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">
<Button
variant="outline"
size="sm"
- onClick={() => openSystemPreferences("screen")}
+ onClick={sendLogs}
+ disabled={isSendingLogs || logsSent}
className="font-mono text-xs"
>
- check permissions
+ {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</>
+ )}
</Button>
- )}
+ </div>
<Button
- variant="outline"
+ variant="link"
size="sm"
- onClick={openLogsFolder}
- className="font-mono text-xs"
+ onClick={openBookingLink}
+ className="font-mono text-xs text-primary"
>
- open logs folder
+ <Calendar className="w-3 h-3 mr-1" />
+ book a call for help
</Button>
</div>
</motion.div>