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
fix: verify first-run shortcut practice
Louis Beaumontfbb3ee0e979e
diff --git a/apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.test.tsx b/apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.test.tsxindex 90c10cd3a..2c716fa7f 100644--- a/apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.test.tsx+++ b/apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.test.tsx@@ -18,10 +18,18 @@ import {FirstRunChatShortcutPractice,} from "./chat-shortcut-practice";+type ShortcutOutcome = {+ action: "shown" | "hidden";+ success: boolean;+};+const mocks = vi.hoisted(() => ({capture: vi.fn(),- listener: null as (() => void) | null,+ listener: null as ((event: { payload: ShortcutOutcome }) => void) | null,unlisten: vi.fn(),+ openSettingsWindow: vi.fn().mockResolvedValue(undefined),+ listenerShouldFail: false,+ isSettingsLoaded: true,settings: {showChatShortcut: "Control+Super+L",disabledShortcuts: [] as string[],@@ -34,50 +42,75 @@ vi.mock("posthog-js", () => ({}));vi.mock("@tauri-apps/api/event", () => ({- listen: vi.fn(async (_event: string, listener: () => void) => {- mocks.listener = listener;- return mocks.unlisten;- }),+ listen: vi.fn(+ async (+ _event: string,+ listener: (event: { payload: ShortcutOutcome }) => void,+ ) => {+ if (mocks.listenerShouldFail) throw new Error("listener unavailable");+ mocks.listener = listener;+ return mocks.unlisten;+ },+ ),}));vi.mock("@/lib/hooks/use-settings", () => ({- useSettings: () => ({ settings: mocks.settings }),+ useSettings: () => ({+ settings: mocks.settings,+ isSettingsLoaded: mocks.isSettingsLoaded,+ }),+}));++vi.mock("@/lib/utils/window", () => ({+ openSettingsWindow: mocks.openSettingsWindow,}));+const emitOutcome = (outcome: ShortcutOutcome) => {+ act(() => mocks.listener?.({ payload: outcome }));+};++const waitUntilReady = async () => {+ await waitFor(() =>+ expect(screen.getByTestId("first-run-chat-shortcut-start")).toBeEnabled(),+ );+};+beforeEach(() => {vi.clearAllMocks();window.localStorage.clear();mocks.listener = null;+ mocks.listenerShouldFail = false;+ mocks.isSettingsLoaded = true;mocks.settings.showChatShortcut = "Control+Super+L";mocks.settings.disabledShortcuts = [];mocks.settings.platform = "macos";});describe("first-run chat shortcut practice", () => {- it("shows the saved shortcut only after the summary dock mounts", async () => {- render(<FirstRunChatShortcutPractice />);+ it("waits for loaded settings and a registered listener", async () => {+ mocks.isSettingsLoaded = false;+ const view = render(<FirstRunChatShortcutPractice />);++ expect(mocks.capture).not.toHaveBeenCalled();+ expect(screen.getByTestId("first-run-chat-shortcut-start")).toBeDisabled();- expect(screen.getByText("open chat from anywhere")).toBeInTheDocument();+ mocks.isSettingsLoaded = true;+ view.rerender(<FirstRunChatShortcutPractice />);+ await waitUntilReady();expect(screen.getByText("⌘⌃L")).toBeInTheDocument();- await waitFor(() =>- expect(mocks.capture).toHaveBeenCalledWith("shortcut_teach_shown", {- schema_version: 1,- surface: "first_run_summary",- shortcut_name: "show_chat",- exposure_number: 1,- }),- );+ expect(mocks.capture).toHaveBeenCalledWith("shortcut_teach_shown", {+ schema_version: 1,+ surface: "first_run_summary",+ shortcut_name: "show_chat",+ exposure_number: 1,+ });});- it("waits for the real native shortcut event before completing", async () => {+ it("completes only after native code verifies Chat was shown", async () => {render(<FirstRunChatShortcutPractice />);+ await waitUntilReady();fireEvent.click(screen.getByTestId("first-run-chat-shortcut-start"));-- expect(- screen.getByTestId("first-run-chat-shortcut-waiting"),- ).toBeInTheDocument();- await waitFor(() => expect(mocks.listener).not.toBeNull());- act(() => mocks.listener?.());+ emitOutcome({ action: "shown", success: true });expect(screen.getByTestId("first-run-chat-shortcut-complete"),@@ -87,19 +120,119 @@ describe("first-run chat shortcut practice", () => {window.localStorage.getItem(FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY) ||"{}",),- ).toMatchObject({ status: "completed", exposureCount: 1 });+ ).toMatchObject({+ status: "completed",+ exposureCount: 1,+ acknowledged: false,+ });expect(mocks.capture).toHaveBeenCalledWith("shortcut_practice_completed",expect.objectContaining({- surface: "first_run_summary",shortcut_name: "show_chat",practice_started: true,}),);});- it("honors not now and does not nag again during the snooze", () => {+ it("does not claim success when the shortcut hid an open Chat", async () => {+ render(<FirstRunChatShortcutPractice />);+ await waitUntilReady();+ fireEvent.click(screen.getByTestId("first-run-chat-shortcut-start"));+ emitOutcome({ action: "hidden", success: true });++ expect(+ screen.queryByTestId("first-run-chat-shortcut-complete"),+ ).not.toBeInTheDocument();+ expect(+ screen.getByTestId("first-run-chat-shortcut-issue"),+ ).toHaveTextContent("chat was already open");+ expect(screen.getByTestId("first-run-chat-shortcut-start")).toBeEnabled();+ });++ it("shows recovery when an already-open Chat could not be hidden", async () => {+ render(<FirstRunChatShortcutPractice />);+ await waitUntilReady();+ fireEvent.click(screen.getByTestId("first-run-chat-shortcut-start"));+ emitOutcome({ action: "hidden", success: false });++ expect(+ screen.getByTestId("first-run-chat-shortcut-issue"),+ ).toHaveTextContent("chat did not respond");+ expect(mocks.capture).toHaveBeenCalledWith("shortcut_practice_failed", {+ schema_version: 1,+ surface: "first_run_summary",+ shortcut_name: "show_chat",+ reason: "window_not_hidden",+ });+ });++ it("offers shortcut settings when Chat failed to open", async () => {+ render(<FirstRunChatShortcutPractice />);+ await waitUntilReady();+ fireEvent.click(screen.getByTestId("first-run-chat-shortcut-start"));+ emitOutcome({ action: "shown", success: false });++ expect(+ screen.getByTestId("first-run-chat-shortcut-issue"),+ ).toHaveTextContent("chat did not respond");+ fireEvent.click(screen.getByRole("button", { name: "change shortcut" }));+ expect(mocks.openSettingsWindow).toHaveBeenCalledWith("shortcuts");+ });++ it("records completion once when a held shortcut repeats", async () => {+ render(<FirstRunChatShortcutPractice />);+ await waitUntilReady();+ fireEvent.click(screen.getByTestId("first-run-chat-shortcut-start"));+ emitOutcome({ action: "shown", success: true });+ emitOutcome({ action: "shown", success: true });++ expect(+ mocks.capture.mock.calls.filter(+ ([event]) => event === "shortcut_practice_completed",+ ),+ ).toHaveLength(1);+ });++ it("keeps confirmation until the user returns and acknowledges it", async () => {+ const first = render(<FirstRunChatShortcutPractice />);+ await waitUntilReady();+ emitOutcome({ action: "shown", success: true });+ expect(+ screen.getByTestId("first-run-chat-shortcut-complete"),+ ).toBeInTheDocument();+ first.unmount();++ render(<FirstRunChatShortcutPractice />);+ expect(+ screen.getByTestId("first-run-chat-shortcut-complete"),+ ).toBeInTheDocument();+ fireEvent.click(screen.getByTestId("first-run-chat-shortcut-done"));+ expect(+ screen.queryByTestId("first-run-chat-shortcut-complete"),+ ).not.toBeInTheDocument();+ expect(+ JSON.parse(+ window.localStorage.getItem(FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY) ||+ "{}",+ ),+ ).toMatchObject({ status: "completed", acknowledged: true });+ });++ it("shows recovery when the native listener is unavailable", async () => {+ mocks.listenerShouldFail = true;+ render(<FirstRunChatShortcutPractice />);++ await waitFor(() =>+ expect(+ screen.getByTestId("first-run-chat-shortcut-issue"),+ ).toHaveTextContent("practice is unavailable"),+ );+ expect(screen.getByTestId("first-run-chat-shortcut-start")).toBeDisabled();+ });++ it("honors not now and does not nag again during the snooze", async () => {const first = render(<FirstRunChatShortcutPractice />);+ await waitUntilReady();fireEvent.click(screen.getByTestId("first-run-chat-shortcut-snooze"));expect(screen.queryByTestId("first-run-chat-shortcut-practice"),@@ -112,7 +245,7 @@ describe("first-run chat shortcut practice", () => {).not.toBeInTheDocument();});- it("stays absent when chat shortcuts are disabled", () => {+ it("stays absent when Chat shortcuts are disabled", () => {mocks.settings.disabledShortcuts = ["showChatShortcut"];render(<FirstRunChatShortcutPractice />);expect(@@ -124,9 +257,9 @@ describe("first-run chat shortcut practice", () => {it("keeps telemetry content-free", async () => {mocks.settings.showChatShortcut = "Private+Secret+L";render(<FirstRunChatShortcutPractice />);+ await waitUntilReady();fireEvent.click(screen.getByTestId("first-run-chat-shortcut-start"));- await waitFor(() => expect(mocks.listener).not.toBeNull());- act(() => mocks.listener?.());+ emitOutcome({ action: "shown", success: true });const serialized = JSON.stringify(mocks.capture.mock.calls);expect(serialized).not.toContain("Private");diff --git a/apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.tsx b/apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.tsxindex cf64c58bc..273425108 100644--- a/apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.tsx+++ b/apps/screenpipe-app-tauri/components/first-run/chat-shortcut-practice.tsx@@ -12,6 +12,7 @@ import posthog from "posthog-js";import { Button } from "@/components/ui/button";import { formatShortcutDisplay } from "@/lib/chat-utils";import { useSettings } from "@/lib/hooks/use-settings";+import { openSettingsWindow } from "@/lib/utils/window";export const FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY ="screenpipe.first-run.chat-shortcut.v1";@@ -23,9 +24,16 @@ type StoredPractice = {status: "available" | "snoozed" | "completed" | "dismissed";exposureCount: number;snoozedUntil?: number;+ acknowledged?: boolean;};type PracticePhase = "hidden" | "prompt" | "waiting" | "complete";+type ListenerState = "connecting" | "ready" | "failed";+type PracticeIssue = "already_hidden" | "failed" | "timeout" | "listener";+type ChatShortcutOutcome = {+ action: "shown" | "hidden";+ success: boolean;+};function readStoredPractice(): StoredPractice {if (typeof window === "undefined") {@@ -50,6 +58,9 @@ function readStoredPractice(): StoredPractice {...(typeof parsed.snoozedUntil === "number"? { snoozedUntil: parsed.snoozedUntil }: {}),+ ...(typeof parsed.acknowledged === "boolean"+ ? { acknowledged: parsed.acknowledged }+ : {}),};} catch {return { status: "available", exposureCount: 0 };@@ -69,7 +80,10 @@ function writeStoredPractice(value: StoredPractice): void {function initialPhase(now = Date.now()): PracticePhase {const stored = readStoredPractice();- if (stored.status === "completed" || stored.status === "dismissed") {+ if (stored.status === "completed") {+ return stored.acknowledged ? "hidden" : "complete";+ }+ if (stored.status === "dismissed") {return "hidden";}if (@@ -82,11 +96,34 @@ function initialPhase(now = Date.now()): PracticePhase {return "prompt";}+export function dismissFirstRunChatShortcutFromParent(): void {+ const stored = readStoredPractice();+ if (stored.status === "completed" || stored.status === "dismissed") return;+ writeStoredPractice({+ status: "dismissed",+ exposureCount: stored.exposureCount,+ });+ posthog.capture("shortcut_teach_dismissed", {+ schema_version: 1,+ surface: "first_run_summary",+ shortcut_name: "show_chat",+ dismissal_source: "parent_tips",+ final_dismissal: true,+ });+}+export function FirstRunChatShortcutPractice() {- const { settings } = useSettings();+ const { settings, isSettingsLoaded } = useSettings();const [phase, setPhase] = React.useState<PracticePhase>(() => initialPhase());+ const [listenerState, setListenerState] =+ React.useState<ListenerState>("connecting");+ const [issue, setIssue] = React.useState<PracticeIssue | null>(null);const phaseRef = React.useRef(phase);+ const shouldInstallListenerRef = React.useRef(+ phase === "prompt" || phase === "waiting",+ );const shownRef = React.useRef(false);+ const completionHandledRef = React.useRef(false);const practiceStartedAtRef = React.useRef<number | null>(null);phaseRef.current = phase;@@ -105,7 +142,13 @@ export function FirstRunChatShortcutPractice() {: formatShortcutDisplay(settings.showChatShortcut, isMac);React.useEffect(() => {- if (phase !== "prompt" || shownRef.current || !shortcut) return;+ if (+ phase !== "prompt" ||+ shownRef.current ||+ !shortcut ||+ !isSettingsLoaded+ )+ return;shownRef.current = true;const stored = readStoredPractice();const exposureCount = stored.exposureCount + 1;@@ -116,14 +159,56 @@ export function FirstRunChatShortcutPractice() {shortcut_name: "show_chat",exposure_number: Math.min(exposureCount, 2),});- }, [phase, shortcut]);+ }, [isSettingsLoaded, phase, shortcut]);React.useEffect(() => {- if ((phase !== "prompt" && phase !== "waiting") || !shortcut) return;+ if (+ !shouldInstallListenerRef.current ||+ !shortcut ||+ !isSettingsLoaded+ )+ return;let unlisten: (() => void) | undefined;let unmounted = false;+ setListenerState("connecting");- void listen("shortcut-show-chat", () => {+ void listen<ChatShortcutOutcome>("shortcut-show-chat", (event) => {+ if (+ phaseRef.current === "hidden" ||+ phaseRef.current === "complete" ||+ completionHandledRef.current+ )+ return;++ if (event.payload.action === "hidden") {+ practiceStartedAtRef.current = null;+ setIssue(event.payload.success ? "already_hidden" : "failed");+ setPhase("prompt");+ if (!event.payload.success) {+ posthog.capture("shortcut_practice_failed", {+ schema_version: 1,+ surface: "first_run_summary",+ shortcut_name: "show_chat",+ reason: "window_not_hidden",+ });+ }+ return;+ }++ if (!event.payload.success) {+ practiceStartedAtRef.current = null;+ setIssue("failed");+ setPhase("prompt");+ posthog.capture("shortcut_practice_failed", {+ schema_version: 1,+ surface: "first_run_summary",+ shortcut_name: "show_chat",+ reason: "window_not_shown",+ });+ return;+ }++ completionHandledRef.current = true;const stored = readStoredPractice();const elapsedMs = practiceStartedAtRef.current? Date.now() - practiceStartedAtRef.current@@ -131,6 +216,7 @@ export function FirstRunChatShortcutPractice() {writeStoredPractice({status: "completed",exposureCount: Math.max(1, stored.exposureCount),+ acknowledged: false,});posthog.capture("shortcut_practice_completed", {schema_version: 1,@@ -150,20 +236,28 @@ export function FirstRunChatShortcutPractice() {}).then((fn) => {if (unmounted) fn();- else unlisten = fn;+ else {+ unlisten = fn;+ setListenerState("ready");+ }})- .catch(() => {});+ .catch(() => {+ if (unmounted) return;+ setListenerState("failed");+ setIssue("listener");+ });return () => {unmounted = true;unlisten?.();};- }, [phase, shortcut]);+ }, [isSettingsLoaded, shortcut]);React.useEffect(() => {if (phase !== "waiting") return;const timer = window.setTimeout(() => {practiceStartedAtRef.current = null;+ setIssue("timeout");posthog.capture("shortcut_practice_timed_out", {schema_version: 1,surface: "first_run_summary",@@ -174,15 +268,24 @@ export function FirstRunChatShortcutPractice() {return () => window.clearTimeout(timer);}, [phase]);- React.useEffect(() => {- if (phase !== "complete") return;- const timer = window.setTimeout(() => setPhase("hidden"), 3_000);- return () => window.clearTimeout(timer);- }, [phase]);-if (!shortcut || phase === "hidden") return null;if (phase === "complete") {+ const acknowledge = () => {+ const stored = readStoredPractice();+ writeStoredPractice({+ status: "completed",+ exposureCount: Math.max(1, stored.exposureCount),+ acknowledged: true,+ });+ posthog.capture("shortcut_practice_acknowledged", {+ schema_version: 1,+ surface: "first_run_summary",+ shortcut_name: "show_chat",+ });+ setPhase("hidden");+ };+return (<divdata-testid="first-run-chat-shortcut-complete"@@ -192,7 +295,7 @@ export function FirstRunChatShortcutPractice() {<span className="flex h-8 w-8 shrink-0 items-center justify-center border border-signal text-signal"><Check className="h-4 w-4" aria-hidden="true" /></span>- <div>+ <div className="min-w-0 flex-1"><p className="font-mono text-xs font-semibold lowercase text-foreground">shortcut learned</p>@@ -201,12 +304,24 @@ export function FirstRunChatShortcutPractice() {again.</p></div>+ <Button+ type="button"+ size="sm"+ variant="ghost"+ data-testid="first-run-chat-shortcut-done"+ className="h-7 px-2 text-[9px]"+ onClick={acknowledge}+ >+ done+ </Button></div>);}const startPractice = () => {+ if (listenerState !== "ready") return;practiceStartedAtRef.current = Date.now();+ setIssue(null);setPhase("waiting");posthog.capture("shortcut_practice_started", {schema_version: 1,@@ -232,6 +347,17 @@ export function FirstRunChatShortcutPractice() {setPhase("hidden");};+ const issueCopy =+ issue === "already_hidden"+ ? "chat was already open and is now hidden. press the shortcut again."+ : issue === "timeout"+ ? "nothing happened. check the shortcut or try again."+ : issue === "listener"+ ? "shortcut practice is unavailable in this window."+ : issue === "failed"+ ? "chat did not respond. check the shortcut and try again."+ : null;+return (<divdata-testid="first-run-chat-shortcut-practice"@@ -253,6 +379,26 @@ export function FirstRunChatShortcutPractice() {? "now. screenpipe is waiting for the real shortcut.": "while screenpipe runs in the background."}</p>+ {issueCopy ? (+ <div className="mt-1 flex items-center gap-2">+ <p+ data-testid="first-run-chat-shortcut-issue"+ role="status"+ className="text-[9px] leading-relaxed text-muted-foreground"+ >+ {issueCopy}+ </p>+ {issue !== "already_hidden" ? (+ <button+ type="button"+ className="shrink-0 font-mono text-[9px] underline underline-offset-2"+ onClick={() => void openSettingsWindow("shortcuts")}+ >+ change shortcut+ </button>+ ) : null}+ </div>+ ) : null}</div><div className="flex shrink-0 items-center gap-1">{phase === "prompt" ? (@@ -263,8 +409,13 @@ export function FirstRunChatShortcutPractice() {data-testid="first-run-chat-shortcut-start"className="h-7 px-2 text-[9px]"onClick={startPractice}+ disabled={listenerState !== "ready"}>- try it now+ {listenerState === "connecting"+ ? "getting ready"+ : listenerState === "failed"+ ? "unavailable"+ : "try it now"}</Button>) : (<spandiff --git a/apps/screenpipe-app-tauri/components/first-run/learning-banner.test.tsx b/apps/screenpipe-app-tauri/components/first-run/learning-banner.test.tsxindex 3bf94d419..2c15c9be6 100644--- a/apps/screenpipe-app-tauri/components/first-run/learning-banner.test.tsx+++ b/apps/screenpipe-app-tauri/components/first-run/learning-banner.test.tsx@@ -7,6 +7,7 @@ import React from "react";import { fireEvent, render, screen, waitFor } from "@testing-library/react";import { beforeEach, describe, expect, it, vi } from "vitest";import { FirstRunLearningBanner } from "./learning-banner";+import { FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY } from "./chat-shortcut-practice";import type { LearningWindowView } from "@/lib/first-run/use-learning-window";const mocks = vi.hoisted(() => ({@@ -44,6 +45,7 @@ vi.mock("@/components/first-run/next-steps", () => ({vi.mock("@/lib/hooks/use-settings", () => ({useSettings: () => ({+ isSettingsLoaded: true,settings: {showChatShortcut: "Control+Super+L",disabledShortcuts: [],@@ -171,7 +173,7 @@ describe("first-run learning banner", () => {expect(dismiss).not.toHaveBeenCalled();});- it("keeps a compact expandable setup dock over the opened summary", () => {+ it("keeps a compact expandable setup dock over the opened summary", async () => {const dismiss = vi.fn();mocks.view = view({phase: "ready",@@ -181,6 +183,12 @@ describe("first-run learning banner", () => {});render(<FirstRunLearningBanner />);+ await waitFor(() =>+ expect(+ screen.getByTestId("first-run-chat-shortcut-start"),+ ).toBeEnabled(),+ );+expect(screen.getByTestId("first-run-setup-dock")).toBeInTheDocument();expect(screen.queryByText("screenpipe learned enough to help"),@@ -194,6 +202,12 @@ describe("first-run learning banner", () => {fireEvent.click(screen.getByTestId("first-run-hide-setup"));expect(dismiss).toHaveBeenCalledTimes(1);+ expect(+ JSON.parse(+ window.localStorage.getItem(FIRST_RUN_CHAT_SHORTCUT_STORAGE_KEY) ||+ "{}",+ ),+ ).toMatchObject({ status: "dismissed" });});it("offers the state-aware daily setup after learning resolves", () => {diff --git a/apps/screenpipe-app-tauri/components/first-run/learning-banner.tsx b/apps/screenpipe-app-tauri/components/first-run/learning-banner.tsxindex f76b905b9..31be68656 100644--- a/apps/screenpipe-app-tauri/components/first-run/learning-banner.tsx+++ b/apps/screenpipe-app-tauri/components/first-run/learning-banner.tsx@@ -21,7 +21,10 @@ import {type LearningWindowOptions,} from "@/lib/first-run/use-learning-window";import { FirstRunNextSteps } from "@/components/first-run/next-steps";-import { FirstRunChatShortcutPractice } from "@/components/first-run/chat-shortcut-practice";+import {+ dismissFirstRunChatShortcutFromParent,+ FirstRunChatShortcutPractice,+} from "@/components/first-run/chat-shortcut-practice";import type { AgentHandoffTarget } from "@/lib/first-run/agent-handoff";function CapturedAppIcon({ app }: { app: FirstRunCapturedApp }) {@@ -218,7 +221,7 @@ export function FirstRunSetupDock({data-testid="first-run-hide-setup"onClick={onDismiss}>- hide+ hide tips</Button></div></div>@@ -295,7 +298,10 @@ export function FirstRunLearningBanner(><FirstRunChatShortcutPractice /><FirstRunSetupDock- onDismiss={() => dismiss()}+ onDismiss={() => {+ dismissFirstRunChatShortcutFromParent();+ dismiss();+ }}nextSteps={<FirstRunNextSteps userToken={learningOptions.userToken} />}diff --git a/apps/screenpipe-app-tauri/e2e/COVERAGE.md b/apps/screenpipe-app-tauri/e2e/COVERAGE.mdindex f61de94a1..3da4eb16b 100644--- a/apps/screenpipe-app-tauri/e2e/COVERAGE.md+++ b/apps/screenpipe-app-tauri/e2e/COVERAGE.md@@ -153,7 +153,7 @@ pass/fail/skip counts.| first-run-agent-handoff.spec.ts | windows, macos, linux | onboarding, real-ui-e2e | onboarding, first-run-learning, mcp-registration | high | partial | real-user-flow | 4 | Agent handoff beside the first-run summary: the summary stays primary and clickable whether or not an agent is offered, an offered target is never nameless or unclickable, the filesystem probe cannot break the ready banner or the summary click-through, and the paste instruction appears only after the handoff runs. Waits for the async probe before concluding absence. Does not assert WHICH agent: detectAiTools resolves the real home in the webview (SCREENPIPE_E2E_AI_TOOLS_HOME is Rust-only), so selection is host-dependent and is covered in lib/first-run/agent-handoff.test.ts and use-agent-handoff.test.ts. || first-run-ai-summary.spec.ts | macos | onboarding, chat-ai, real-ui-e2e, tauri-command | onboarding, first-run-learning, chat | high | strong | real-user-flow | 1 | Opt-in hosted-AI lane for the post-setup summary: the real app starts its own Pi session through the Rust command and the production Worker under Miniflare, and the forwarded provider request is asserted to carry the screen and audio excerpts plus the browser URL, not just app names. Guards the regression where the summary was AI-written but built from containers only, so it read templated. The seeded chat must hold the model's text and never the deterministic opener. || first-run-guide.spec.ts | windows, macos, linux | onboarding, chat-ai, real-ui-e2e | onboarding, chat, first-run-guide | high | strong | real-user-flow | 3 | Replayed first-run guide verifies the composer remains focused and clickable above its scrim, fails open when stacking defeats the lift, and remembers decline across reloads. |-| first-run-learning-window.spec.ts | windows, macos, linux | onboarding, real-ui-e2e | onboarding, first-run-learning, shortcuts | high | strong | real-user-flow | 8 | Post-setup summary on Home under the authenticated seed: immediate runs show a live countdown, empty engine results settle silently with their diagnostic reason preserved, silent states stay silent across reloads, late returns retry in the background, ready summaries remain actionable, a real Tauri Chat-shortcut event completes the contextual practice lesson, and idle/done never render. |+| first-run-learning-window.spec.ts | windows, macos, linux | onboarding, real-ui-e2e | onboarding, first-run-learning, shortcuts | high | strong | real-user-flow | 8 | Post-setup summary on Home under the authenticated seed: immediate runs show a live countdown, empty engine results settle silently with their diagnostic reason preserved, silent states stay silent across reloads, late returns retry in the background, ready summaries remain actionable, a verified shown Chat-shortcut outcome completes the contextual practice lesson while a hidden outcome stays recoverable, and idle/done never render. || first-run-reset-learning-window.spec.ts | windows, macos, linux | onboarding, real-ui-e2e, tauri-command | onboarding, first-run-learning, settings-persistence | high | strong | real-user-flow | 2 | Home is the single first-summary lifecycle owner: reset events clear the mounted Home state, while the separate Chat webview neither renders nor claims a second learning window from the shared onboarding completion. || focus-server.spec.ts | windows, macos, linux | local-api, window-lifecycle, tauri-command | window-lifecycle, focus-server, deeplink | medium | partial | api | 2 | Focus server opens windows and forwards deeplink args. || hd-recording-pipeline.spec.ts | macos | capture-ocr, local-api, performance | capture-ocr, hd-recording, timeline | high | conditional | api | 1 | Opt-in macOS HD capture and OCR indexing. |diff --git a/apps/screenpipe-app-tauri/e2e/coverage-map.json b/apps/screenpipe-app-tauri/e2e/coverage-map.jsonindex 9e7533c24..43e64f587 100644--- a/apps/screenpipe-app-tauri/e2e/coverage-map.json+++ b/apps/screenpipe-app-tauri/e2e/coverage-map.json@@ -1388,7 +1388,7 @@"confidence": "strong","ux": "real-user-flow","tests": 8,- "notes": "Post-setup summary on Home under the authenticated seed: immediate runs show a live countdown, empty engine results settle silently with their diagnostic reason preserved, silent states stay silent across reloads, late returns retry in the background, ready summaries remain actionable, a real Tauri Chat-shortcut event completes the contextual practice lesson, and idle/done never render."+ "notes": "Post-setup summary on Home under the authenticated seed: immediate runs show a live countdown, empty engine results settle silently with their diagnostic reason preserved, silent states stay silent across reloads, late returns retry in the background, ready summaries remain actionable, a verified shown Chat-shortcut outcome completes the contextual practice lesson while a hidden outcome stays recoverable, and idle/done never render."},{"spec": "first-run-reset-learning-window.spec.ts",diff --git a/apps/screenpipe-app-tauri/e2e/specs/first-run-learning-window.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/first-run-learning-window.spec.tsindex 09d333853..409a9771a 100644--- a/apps/screenpipe-app-tauri/e2e/specs/first-run-learning-window.spec.ts+++ b/apps/screenpipe-app-tauri/e2e/specs/first-run-learning-window.spec.ts@@ -420,10 +420,9 @@ const learningState = (over: Record<string, unknown> = {}) => ({);expect(existsSync(teachScreenshot)).toBe(true);- const practice = await browser.$(- '[data-testid="first-run-chat-shortcut-start"]',- );- await practice.click();+ await (+ await browser.$('[data-testid="first-run-chat-shortcut-start"]')+ ).click();await browser.waitUntil(async () =>Boolean(@@ -444,7 +443,40 @@ const learningState = (over: Record<string, unknown> = {}) => ({);expect(existsSync(waitingScreenshot)).toBe(true);- await emitTauri("shortcut-show-chat", {});+ // A toggle that closes an already-visible Chat must not be mistaken for+ // learning the shortcut. The lesson explains the result and asks for one+ // more press, which will now show Chat.+ await emitTauri("shortcut-show-chat", {+ action: "hidden",+ success: true,+ });+ await browser.waitUntil(+ async () =>+ (+ (await browser.execute(+ () =>+ document.querySelector(+ '[data-testid="first-run-chat-shortcut-issue"]',+ )?.textContent ?? "",+ )) as string+ ).includes("already open"),+ {+ timeout: t(10_000),+ timeoutMsg: "hidden Chat outcome was incorrectly accepted",+ },+ );+ const hiddenScreenshot = await saveScreenshot(+ "first-run-summary-shortcut-already-open",+ );+ expect(existsSync(hiddenScreenshot)).toBe(true);++ await (+ await browser.$('[data-testid="first-run-chat-shortcut-start"]')+ ).click();+ await emitTauri("shortcut-show-chat", {+ action: "shown",+ success: true,+ });await browser.waitUntil(async () =>Boolean(@@ -467,9 +499,20 @@ const learningState = (over: Record<string, unknown> = {}) => ({expect(await browser.execute((key: string) => {const raw = window.localStorage.getItem(key);- return raw ? JSON.parse(raw).status : null;+ return raw ? JSON.parse(raw) : null;+ }, CHAT_SHORTCUT_STORAGE_KEY),+ ).toMatchObject({ status: "completed", acknowledged: false });++ const done = await browser.$(+ '[data-testid="first-run-chat-shortcut-done"]',+ );+ await done.click();+ expect(+ await browser.execute((key: string) => {+ const raw = window.localStorage.getItem(key);+ return raw ? JSON.parse(raw) : null;}, CHAT_SHORTCUT_STORAGE_KEY),- ).toBe("completed");+ ).toMatchObject({ status: "completed", acknowledged: true });const toggle = await browser.$('[data-testid="first-run-toggle-setup"]');await toggle.click();diff --git a/apps/screenpipe-app-tauri/src-tauri/src/shortcuts.rs b/apps/screenpipe-app-tauri/src-tauri/src/shortcuts.rsindex fe17edd6c..c0185bb08 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/shortcuts.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/shortcuts.rs@@ -6,6 +6,7 @@use std::collections::HashMap;+use serde::Serialize;use tauri::AppHandle;use tauri::Emitter;use tauri::Manager;@@ -18,6 +19,52 @@ use crate::commands::{hide_main_window, show_main_window};use crate::store::{get_store, SettingsStore};use crate::window::ShowRewindWindow;+#[derive(Clone, Serialize)]+struct ChatShortcutOutcome {+ action: &'static str,+ success: bool,+}++fn chat_transition_succeeded(action: &str, visible: bool) -> bool {+ match action {+ "shown" => visible,+ "hidden" => !visible,+ _ => false,+ }+}++fn emit_chat_shortcut_outcome_after_settle(app: &AppHandle, action: &'static str) {+ let app = app.clone();+ tauri::async_runtime::spawn(async move {+ tokio::time::sleep(tokio::time::Duration::from_millis(150)).await;+ let app_for_check = app.clone();+ if let Err(error) = app.run_on_main_thread(move || {+ #[cfg(target_os = "macos")]+ let visible = {+ use tauri_nspanel::ManagerExt;+ app_for_check+ .get_webview_panel("chat")+ .map(|panel| panel.is_visible())+ .unwrap_or(false)+ };++ #[cfg(not(target_os = "macos"))]+ let visible = app_for_check+ .get_webview_window("chat")+ .and_then(|window| window.is_visible().ok())+ .unwrap_or(false);++ let success = chat_transition_succeeded(action, visible);+ let _ = app_for_check.emit(+ "shortcut-show-chat",+ ChatShortcutOutcome { action, success },+ );+ }) {+ error!("failed to verify chat shortcut outcome: {}", error);+ }+ });+}+/// Record a physical global-shortcut press once, before any app-wide events/// are broadcast to webviews. This avoids duplicate analytics from multiple/// mounted listeners and covers native-only window paths.@@ -301,7 +348,6 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),let _ = app.run_on_main_thread(move || {let app = &app_for_closure;info!("show chat shortcut triggered");- let _ = app.emit("shortcut-show-chat", ());if let Some(_window) = app.get_webview_window("chat") {#[cfg(target_os = "macos")]{@@ -309,6 +355,7 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),if let Ok(panel) = app.get_webview_panel("chat") {if panel.is_visible() {panel.order_out(None);+ emit_chat_shortcut_outcome_after_settle(app, "hidden");return;}}@@ -317,11 +364,26 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),{if _window.is_visible().unwrap_or(false) {let _ = _window.hide();+ emit_chat_shortcut_outcome_after_settle(app, "hidden");return;}}}- let _ = ShowRewindWindow::Chat.show(app);+ #[cfg(target_os = "macos")]+ let existed = app.get_webview_window("chat").is_some();+ match ShowRewindWindow::Chat.show(app) {+ Ok(_) => {+ // A newly created macOS Chat panel starts hidden so it can+ // be configured safely. Reuse the normal existing-window+ // path once to bring that first panel to the foreground.+ #[cfg(target_os = "macos")]+ if !existed {+ let _ = ShowRewindWindow::Chat.show(app);+ }+ }+ Err(error) => error!("failed to show chat from shortcut: {}", error),+ }+ emit_chat_shortcut_outcome_after_settle(app, "shown");});},)@@ -438,3 +500,17 @@ pub fn parse_shortcut(shortcut_str: &str) -> Result<Shortcut, String> {Ok(Shortcut::new(Some(modifiers), code))}++#[cfg(test)]+mod tests {+ use super::chat_transition_succeeded;++ #[test]+ fn chat_shortcut_outcome_requires_the_requested_visibility() {+ assert!(chat_transition_succeeded("shown", true));+ assert!(!chat_transition_succeeded("shown", false));+ assert!(chat_transition_succeeded("hidden", false));+ assert!(!chat_transition_succeeded("hidden", true));+ assert!(!chat_transition_succeeded("unknown", true));+ }+}diff --git a/docs/pr-assets/shortcut-teach/first-run-learning.png b/docs/pr-assets/shortcut-teach/first-run-learning.pngindex 00f7800a8..458a2b337 100644Binary files a/docs/pr-assets/shortcut-teach/first-run-learning.png and b/docs/pr-assets/shortcut-teach/first-run-learning.png differdiff --git a/docs/pr-assets/shortcut-teach/first-run-ready-before-open.png b/docs/pr-assets/shortcut-teach/first-run-ready-before-open.pngindex 0fa973c18..c15a7e6b5 100644Binary files a/docs/pr-assets/shortcut-teach/first-run-ready-before-open.png and b/docs/pr-assets/shortcut-teach/first-run-ready-before-open.png differdiff --git a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-already-open.png b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-already-open.pngnew file mode 100644index 000000000..a8ca5621eBinary files /dev/null and b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-already-open.png differdiff --git a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-complete.png b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-complete.pngindex 7f25f6c6d..df5a24984 100644Binary files a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-complete.png and b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-complete.png differdiff --git a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-teach.png b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-teach.pngindex 0b4e2758c..13bdb1cfd 100644Binary files a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-teach.png and b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-teach.png differdiff --git a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-waiting.png b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-waiting.pngindex d4482a3c4..ed0cd0406 100644Binary files a/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-waiting.png and b/docs/pr-assets/shortcut-teach/first-run-summary-shortcut-waiting.png differ