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(onboarding): make recommended setup one click
Louis Beaumont03892e28496b
diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/chat-main-pane.test.tsx b/apps/screenpipe-app-tauri/components/chat/standalone/chat-main-pane.test.tsxindex 046965c55..3517a43eb 100644--- a/apps/screenpipe-app-tauri/components/chat/standalone/chat-main-pane.test.tsx+++ b/apps/screenpipe-app-tauri/components/chat/standalone/chat-main-pane.test.tsx@@ -121,6 +121,7 @@ describe("ChatMainPane", () => {};const { rerender } = render(<ChatMainPane {...enabled} />);expect(screen.getByTestId("first-run-banner")).toBeInTheDocument();+ expect(screen.queryByTestId("summary-cards")).not.toBeInTheDocument();const sent: Message = {id: "sent-message",diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/chat-main-pane.tsx b/apps/screenpipe-app-tauri/components/chat/standalone/chat-main-pane.tsxindex 25d45dbc2..b522ee916 100644--- a/apps/screenpipe-app-tauri/components/chat/standalone/chat-main-pane.tsx+++ b/apps/screenpipe-app-tauri/components/chat/standalone/chat-main-pane.tsx@@ -116,6 +116,21 @@ export function ChatMainPane({firstRunUserToken,firstRunAiSettingsLoaded,}: ChatMainPaneProps) {+ const homeStarter =+ messages.length === 0 &&+ !pendingSend &&+ !isPreparingPrefill &&+ !activePipeExecution &&+ !isLoading &&+ !isStreaming &&+ hasPresets &&+ hasValidModel ? (+ <HomeStarterSurface+ summaryCardsProps={summaryCardsProps}+ {...homeStarterProps}+ />+ ) : null;+return (<div className="flex-1 flex overflow-hidden"><InlineChatHistory@@ -258,21 +273,10 @@ export function ChatMainPane({aiPreset={firstRunAiPreset}userToken={firstRunUserToken}aiSettingsLoaded={firstRunAiSettingsLoaded}+ fallback={homeStarter}/>)}- {messages.length === 0 &&- !pendingSend &&- !isPreparingPrefill &&- !activePipeExecution &&- !isLoading &&- !isStreaming &&- hasPresets &&- hasValidModel && (- <HomeStarterSurface- summaryCardsProps={summaryCardsProps}- {...homeStarterProps}- />- )}+ {!firstRunLearningEnabled && homeStarter}{/* The message the user just sent, shown from the send frame untilthe durable row replaces it. Same geometry as a real user row sonothing moves when the swap happens. */}diff --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 f21e35e47..f59f29c4e 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@@ -76,6 +76,27 @@ describe("first-run learning banner", () => {expect(done.container).toBeEmptyDOMElement();});+ it("renders the normal Home surface only when the learning card is absent", () => {+ mocks.view = view({ phase: "idle" });+ const { rerender } = render(+ <FirstRunLearningBanner+ fallback={<div data-testid="normal-home">How can I help today?</div>}+ />,+ );+ expect(screen.getByTestId("normal-home")).toBeInTheDocument();++ mocks.view = view({ phase: "ready", chatId: "ready-summary" });+ rerender(+ <FirstRunLearningBanner+ fallback={<div data-testid="normal-home">How can I help today?</div>}+ />,+ );+ expect(screen.queryByTestId("normal-home")).not.toBeInTheDocument();+ expect(+ screen.getByText("screenpipe learned enough to help"),+ ).toBeInTheDocument();+ });+it("shows the countdown while learning", () => {mocks.view = view({ remainingMs: 61_000 });render(<FirstRunLearningBanner />);@@ -126,13 +147,20 @@ describe("first-run learning banner", () => {});it("offers the state-aware daily setup after learning resolves", () => {- mocks.view = view({ phase: "ready", chatId: "first-run-steps" });+ const dismiss = vi.fn();+ mocks.view = view({+ phase: "ready",+ chatId: "first-run-steps",+ dismiss,+ });render(<FirstRunLearningBanner />);expect(screen.getByText("screenpipe learned enough to help"),).toBeInTheDocument();expect(screen.getByTestId("first-run-next-steps")).toBeInTheDocument();+ fireEvent.click(screen.getByRole("button", { name: "this is ready" }));+ expect(dismiss).toHaveBeenCalled();});it("keeps every empty result out of the interface", () => {diff --git a/apps/screenpipe-app-tauri/components/first-run/learning-banner.tsx b/apps/screenpipe-app-tauri/components/first-run/learning-banner.tsxindex a04c6d2ef..d736dc5c5 100644--- a/apps/screenpipe-app-tauri/components/first-run/learning-banner.tsx+++ b/apps/screenpipe-app-tauri/components/first-run/learning-banner.tsx@@ -105,8 +105,8 @@ export function FirstRunReadyPanel({<div className="flex items-center justify-between gap-4 border-t border-border px-4 py-3"><p className="text-[10px] leading-relaxed text-muted-foreground">- these are optional. you can set them up later from scheduled tasks and- connections.+ screenpipe is ready now. these optional setups remain available from+ scheduled tasks and connections.</p><Buttonsize="sm"@@ -114,7 +114,7 @@ export function FirstRunReadyPanel({className="h-7 shrink-0 px-2 text-[9px]"onClick={onDismiss}>- later+ this is ready</Button></div></div>@@ -127,9 +127,12 @@ export function FirstRunReadyPanel({* Renders nothing outside the window, so it is safe to mount unconditionally* on the surface the user lands on after onboarding.*/-export function FirstRunLearningBanner(props: LearningWindowOptions = {}) {+export function FirstRunLearningBanner(+ props: LearningWindowOptions & { fallback?: React.ReactNode } = {},+) {+ const { fallback, ...learningOptions } = props;const { phase, capturedApps, remainingMs, chatId, showProgress, dismiss } =- useLearningWindow(props);+ useLearningWindow(learningOptions);const { targets: handoffTargets, hint: handoffHint, askAgent } =useAgentHandoff(phase === "ready");@@ -143,7 +146,7 @@ export function FirstRunLearningBanner(props: LearningWindowOptions = {}) {(phase === "learning" || phase === "writing"))) {- return null;+ return fallback ? <>{fallback}</> : null;}const openSummary = async () => {@@ -166,7 +169,7 @@ export function FirstRunLearningBanner(props: LearningWindowOptions = {}) {data-testid="first-run-learning-banner"data-phase={phase}className={`mx-auto mb-4 w-full border border-border bg-background ${- phase === "ready" ? "max-w-4xl overflow-hidden" : "max-w-3xl p-4"+ phase === "ready" ? "max-w-3xl overflow-hidden" : "max-w-3xl p-4"}`}>{phase === "learning" && (@@ -244,7 +247,7 @@ export function FirstRunLearningBanner(props: LearningWindowOptions = {}) {onOpenSummary={() => void openSummary()}onPickAgent={(target) => void askAgent(target)}onDismiss={() => dismiss()}- nextSteps={<FirstRunNextSteps userToken={props.userToken} />}+ nextSteps={<FirstRunNextSteps userToken={learningOptions.userToken} />}/>)}</section>diff --git a/apps/screenpipe-app-tauri/components/first-run/next-steps.test.tsx b/apps/screenpipe-app-tauri/components/first-run/next-steps.test.tsxindex 47529e860..ff5e1627a 100644--- a/apps/screenpipe-app-tauri/components/first-run/next-steps.test.tsx+++ b/apps/screenpipe-app-tauri/components/first-run/next-steps.test.tsx@@ -4,37 +4,44 @@import "@testing-library/jest-dom/vitest";import React from "react";-import {- act,- fireEvent,- render,- screen,- waitFor,-} from "@testing-library/react";+import { fireEvent, render, screen, waitFor } from "@testing-library/react";import { beforeEach, describe, expect, it, vi } from "vitest";-import {- PIPE_INSTALL_CANCELLED_EVENT,- PIPE_INSTALLED_EVENT,-} from "@/lib/pipe-install-receipt";import { FirstRunNextSteps } from "./next-steps";const mocks = vi.hoisted(() => ({localFetch: vi.fn(),fetchComposioStatus: vi.fn(),+ authorizeComposioToolkit: vi.fn(),+ registerComposioMcpServer: vi.fn(),oauthStatus: vi.fn(),- emit: vi.fn(),+ oauthConnect: vi.fn(),+ openUrl: vi.fn(),+ foregroundAfterOAuth: vi.fn(),+ notifyConnectionsUpdated: vi.fn(),capture: vi.fn(),}));vi.mock("@/lib/api", () => ({ localFetch: mocks.localFetch }));vi.mock("@/lib/composio", () => ({fetchComposioStatus: mocks.fetchComposioStatus,+ authorizeComposioToolkit: mocks.authorizeComposioToolkit,+ registerComposioMcpServer: mocks.registerComposioMcpServer,}));+vi.mock("@/lib/connections-events", () => ({+ CONNECTIONS_UPDATED_EVENT: "connections-updated",+ notifyConnectionsUpdated: mocks.notifyConnectionsUpdated,+}));+vi.mock("@/lib/connections/foreground-oauth", () => ({+ foregroundAfterOAuth: mocks.foregroundAfterOAuth,+}));+vi.mock("@tauri-apps/plugin-opener", () => ({ openUrl: mocks.openUrl }));vi.mock("@/lib/utils/tauri", () => ({- commands: { oauthStatus: mocks.oauthStatus },+ commands: {+ oauthStatus: mocks.oauthStatus,+ oauthConnect: mocks.oauthConnect,+ },}));-vi.mock("@tauri-apps/api/event", () => ({ emit: mocks.emit }));vi.mock("posthog-js", () => ({default: { capture: mocks.capture },}));@@ -47,352 +54,257 @@ function response(body: unknown, ok = true): Response {} as Response;}-function setPipeStates(states: Record<string, boolean>) {+let pipeStates: Record<string, boolean>;+let gmailConnected: boolean;+let calendarConnected: boolean;+let installFailure: string | null;++function installLocalApiMock() {mocks.localFetch.mockImplementation(async (url: string, init?: RequestInit) => {+ if (url === "/pipes/store/install" && init?.method === "POST") {+ if (installFailure) return response({ error: installFailure }, false);+ const slug = JSON.parse(String(init.body)).slug as string;+ pipeStates[slug] = false;+ return response({ name: slug, connections: [] });+ }if (url.endsWith("/enable") && init?.method === "POST") {const slug = url.split("/").at(-2) ?? "";- states[slug] = true;+ pipeStates[slug] = true;return response({ success: true });}-const slug = url.split("/").pop() ?? "";- return slug in states- ? response({ data: { config: { name: slug, enabled: states[slug] } } })+ return slug in pipeStates+ ? response({ data: { config: { name: slug, enabled: pipeStates[slug] } } }): response({ error: `pipe '${slug}' not found` });},);}-function setInstalledPipes(installed: string[]) {- setPipeStates(Object.fromEntries(installed.map((slug) => [slug, true])));+function setPipeStates(states: Record<string, boolean>) {+ pipeStates = { ...states };+ installLocalApiMock();}beforeEach(() => {vi.clearAllMocks();- setInstalledPipes([]);- mocks.fetchComposioStatus.mockResolvedValue({- gmail: { connected: false, status: null },+ gmailConnected = false;+ calendarConnected = false;+ installFailure = null;+ setPipeStates({});+ mocks.fetchComposioStatus.mockImplementation(async () => ({+ gmail: { connected: gmailConnected, status: gmailConnected ? "ACTIVE" : null },+ }));+ mocks.authorizeComposioToolkit.mockResolvedValue(+ "https://auth.example.test/gmail",+ );+ mocks.openUrl.mockImplementation(async () => {+ gmailConnected = true;});- mocks.oauthStatus.mockResolvedValue({+ mocks.registerComposioMcpServer.mockResolvedValue(undefined);+ mocks.foregroundAfterOAuth.mockResolvedValue(undefined);+ mocks.oauthStatus.mockImplementation(async () => ({status: "ok",- data: { connected: false },+ data: { connected: calendarConnected },+ }));+ mocks.oauthConnect.mockImplementation(async () => {+ calendarConnected = true;+ return { status: "ok", data: { connected: true } };});- mocks.emit.mockResolvedValue(undefined);});describe("first-run next steps", () => {- it("offers two reviewed installs and a focused Calendar setup to a new user", async () => {+ it("installs, connects Gmail, and enables the daily summary from one app click", async () => {const openSettings = vi.fn();window.addEventListener("open-settings", openSettings);render(<FirstRunNextSteps userToken="user-token" />);- await waitFor(() =>- expect(- screen.getByTestId("first-run-next-step-daily-email"),- ).toHaveTextContent("install"),- );- expect(screen.getByText("gmail setup follows")).toBeInTheDocument();- expect(- screen.getByTestId("first-run-next-step-digital-clone"),- ).toHaveTextContent("install");- expect(- screen.getByTestId("first-run-next-step-google-calendar"),- ).toHaveTextContent("connect");+ const action = await screen.findByTestId("first-run-next-step-daily-email");+ await waitFor(() => expect(action).toHaveTextContent("install & connect"));+ fireEvent.click(action);- fireEvent.click(screen.getByTestId("first-run-next-step-daily-email"));- await waitFor(() =>- expect(mocks.emit).toHaveBeenCalledWith("install-pipe", {- url: "registry:daily-email-summary",+ await waitFor(() => expect(action).toHaveTextContent("ready"));+ expect(mocks.localFetch).toHaveBeenCalledWith(+ "/pipes/store/install",+ expect.objectContaining({+ method: "POST",+ body: JSON.stringify({ slug: "daily-email-summary" }),}),);-- act(() => {- window.dispatchEvent(- new CustomEvent(PIPE_INSTALL_CANCELLED_EVENT, {- detail: { url: "registry:daily-email-summary" },- }),- );- });- await waitFor(() =>- expect(- screen.getByTestId("first-run-next-step-digital-clone"),- ).toBeEnabled(),+ expect(mocks.authorizeComposioToolkit).toHaveBeenCalledWith(+ "user-token",+ "gmail",);-- fireEvent.click(screen.getByTestId("first-run-next-step-digital-clone"));- await waitFor(() =>- expect(mocks.emit).toHaveBeenCalledWith("install-pipe", {- url: "registry:digital-clone",- }),+ expect(mocks.openUrl).toHaveBeenCalledWith(+ "https://auth.example.test/gmail",);-- fireEvent.click(screen.getByTestId("first-run-next-step-google-calendar"));- expect(openSettings).toHaveBeenCalledWith(- expect.objectContaining({- detail: {- section: "connections",- connectionId: "google-calendar",- },- }),+ expect(mocks.registerComposioMcpServer).toHaveBeenCalledWith("user-token");+ expect(mocks.localFetch).toHaveBeenCalledWith(+ "/pipes/daily-email-summary/enable",+ expect.objectContaining({ method: "POST" }),);+ expect(openSettings).not.toHaveBeenCalled();window.removeEventListener("open-settings", openSettings);});- it("keeps completed steps disabled and asks only for Gmail when the Pipe is enabled", async () => {- setInstalledPipes(["daily-email-summary", "digital-clone"]);- mocks.oauthStatus.mockResolvedValue({- status: "ok",- data: { connected: true },- });- const openSettings = vi.fn();- window.addEventListener("open-settings", openSettings);+ it("skips Gmail setup when it is already connected", async () => {+ gmailConnected = true;render(<FirstRunNextSteps userToken="user-token" />);- await waitFor(() =>- expect(- screen.getByTestId("first-run-next-step-daily-email"),- ).toHaveTextContent("connect gmail"),- );- expect(screen.getByText("enabled, needs gmail")).toBeInTheDocument();- expect(- screen.getByTestId("first-run-next-step-digital-clone"),- ).toBeDisabled();- expect(- screen.getByTestId("first-run-next-step-google-calendar"),- ).toBeDisabled();+ const action = await screen.findByTestId("first-run-next-step-daily-email");+ await waitFor(() => expect(action).toHaveTextContent("install & enable"));+ fireEvent.click(action);- fireEvent.click(screen.getByTestId("first-run-next-step-daily-email"));- expect(openSettings).toHaveBeenCalledWith(- expect.objectContaining({- detail: { section: "connections", connectionId: "gmail" },- }),- );- expect(mocks.emit).not.toHaveBeenCalled();- window.removeEventListener("open-settings", openSettings);+ await waitFor(() => expect(action).toHaveTextContent("ready"));+ expect(mocks.authorizeComposioToolkit).not.toHaveBeenCalled();+ expect(mocks.openUrl).not.toHaveBeenCalled();});- it("continues into Gmail after the recommended email Pipe is installed", async () => {+ it("installs and enables Digital Clone without opening Scheduled Tasks", async () => {const openSettings = vi.fn();window.addEventListener("open-settings", openSettings);render(<FirstRunNextSteps userToken="user-token" />);- await waitFor(() =>- expect(- screen.getByTestId("first-run-next-step-daily-email"),- ).toHaveTextContent("install"),- );- fireEvent.click(screen.getByTestId("first-run-next-step-daily-email"));- await waitFor(() => expect(mocks.emit).toHaveBeenCalledTimes(1));-- act(() => {- window.dispatchEvent(- new CustomEvent(PIPE_INSTALLED_EVENT, {- detail: { pipeName: "daily-email-summary", connections: [] },- }),- );- });-- await waitFor(() =>- expect(openSettings).toHaveBeenCalledWith(- expect.objectContaining({- detail: { section: "connections", connectionId: "gmail" },- }),- ),+ const action = await screen.findByTestId(+ "first-run-next-step-digital-clone",);- window.removeEventListener("open-settings", openSettings);- });-- it("does not reopen Gmail when it was already connected before installation", async () => {- mocks.fetchComposioStatus.mockResolvedValue({- gmail: { connected: true, status: "active" },- });- const openSettings = vi.fn();- window.addEventListener("open-settings", openSettings);- render(<FirstRunNextSteps userToken="user-token" />);+ await waitFor(() => expect(action).toHaveTextContent("install & enable"));+ fireEvent.click(action);- await waitFor(() =>- expect(- screen.getByTestId("first-run-next-step-daily-email"),- ).toHaveTextContent("install"),+ await waitFor(() => expect(action).toHaveTextContent("ready"));+ expect(mocks.localFetch).toHaveBeenCalledWith(+ "/pipes/store/install",+ expect.objectContaining({+ body: JSON.stringify({ slug: "digital-clone" }),+ }),);- expect(screen.getByText("gmail connected")).toBeInTheDocument();- expect(screen.queryByText("gmail setup follows")).not.toBeInTheDocument();- fireEvent.click(screen.getByTestId("first-run-next-step-daily-email"));- await waitFor(() => expect(mocks.emit).toHaveBeenCalledTimes(1));- act(() => {- window.dispatchEvent(- new CustomEvent(PIPE_INSTALLED_EVENT, {- detail: { pipeName: "daily-email-summary", connections: [] },- }),- );- });-- await act(async () => {- await new Promise((resolve) => setTimeout(resolve, 5));- });expect(openSettings).not.toHaveBeenCalled();window.removeEventListener("open-settings", openSettings);});- it("does not guess that Gmail needs setup when its status is unavailable", async () => {- mocks.fetchComposioStatus.mockResolvedValue(null);+ it("connects Google Calendar in place", async () => {const openSettings = vi.fn();window.addEventListener("open-settings", openSettings);render(<FirstRunNextSteps userToken="user-token" />);- const action = await screen.findByTestId("first-run-next-step-daily-email");- await waitFor(() => expect(action).toHaveTextContent("install"));- expect(screen.getByText("gmail check unavailable")).toBeInTheDocument();-+ const action = await screen.findByTestId(+ "first-run-next-step-google-calendar",+ );+ await waitFor(() => expect(action).toHaveTextContent("connect"));fireEvent.click(action);- await waitFor(() => expect(mocks.emit).toHaveBeenCalledTimes(1));- act(() => {- window.dispatchEvent(- new CustomEvent(PIPE_INSTALLED_EVENT, {- detail: { pipeName: "daily-email-summary", connections: [] },- }),- );- });- await act(async () => {- await new Promise((resolve) => setTimeout(resolve, 5));- });+ await waitFor(() => expect(action).toHaveTextContent("connected"));+ expect(mocks.oauthConnect).toHaveBeenCalledWith(+ "google-calendar",+ null,+ null,+ );expect(openSettings).not.toHaveBeenCalled();window.removeEventListener("open-settings", openSettings);});- it("keeps the installer action locked until install or cancel", async () => {+ it("enables installed tasks without another install step", async () => {+ gmailConnected = true;+ setPipeStates({+ "daily-email-summary": false,+ "digital-clone": false,+ });render(<FirstRunNextSteps userToken="user-token" />);- const action = await screen.findByTestId("first-run-next-step-daily-email");- await waitFor(() => expect(action).toHaveTextContent("install"));- fireEvent.click(action);- fireEvent.click(action);- await waitFor(() => expect(mocks.emit).toHaveBeenCalledTimes(1));- expect(action).toBeDisabled();- expect(action).toHaveTextContent("reviewing install");+ const daily = await screen.findByTestId("first-run-next-step-daily-email");+ await waitFor(() => expect(daily).toHaveTextContent("enable summary"));+ fireEvent.click(daily);+ await waitFor(() => expect(daily).toHaveTextContent("ready"));- act(() => {- window.dispatchEvent(- new CustomEvent(PIPE_INSTALL_CANCELLED_EVENT, {- detail: { url: "registry:daily-email-summary" },- }),- );- });- await waitFor(() => expect(action).toBeEnabled());- fireEvent.click(action);- await waitFor(() => expect(mocks.emit).toHaveBeenCalledTimes(2));+ const clone = screen.getByTestId("first-run-next-step-digital-clone");+ fireEvent.click(clone);+ await waitFor(() => expect(clone).toHaveTextContent("ready"));+ expect(+ mocks.localFetch.mock.calls.filter(([url]) => url === "/pipes/store/install"),+ ).toHaveLength(0);});- it("reports partial status failures as unknown and retries instead of guessing", async () => {- mocks.localFetch.mockRejectedValue(new Error("engine offline"));- mocks.fetchComposioStatus.mockResolvedValue(null);- mocks.oauthStatus.mockResolvedValue({- status: "error",- error: "calendar status unavailable",+ it("locks the active setup so repeated clicks cannot install twice", async () => {+ gmailConnected = true;+ let finishInstall: (() => void) | null = null;+ mocks.localFetch.mockImplementation((url: string, init?: RequestInit) => {+ if (url === "/pipes/store/install") {+ return new Promise<Response>((resolve) => {+ finishInstall = () => {+ pipeStates["digital-clone"] = false;+ resolve(response({ name: "digital-clone", connections: [] }));+ };+ });+ }+ if (url.endsWith("/enable") && init?.method === "POST") {+ pipeStates["digital-clone"] = true;+ return Promise.resolve(response({ success: true }));+ }+ const slug = url.split("/").pop() ?? "";+ return Promise.resolve(+ slug in pipeStates+ ? response({ data: { config: { enabled: pipeStates[slug] } } })+ : response({ error: "not found" }),+ );});render(<FirstRunNextSteps userToken="user-token" />);- await waitFor(() =>- expect(screen.getAllByText("status unavailable")).toHaveLength(3),+ const action = await screen.findByTestId(+ "first-run-next-step-digital-clone",);+ await waitFor(() => expect(action).toHaveTextContent("install & enable"));+ fireEvent.click(action);+ fireEvent.click(action);+ await waitFor(() => expect(action).toHaveTextContent("installing"));+ expect(action).toBeDisabled();expect(- screen.getByText(- "some setup status could not be checked. nothing changed.",- ),- ).toBeInTheDocument();+ mocks.localFetch.mock.calls.filter(([url]) => url === "/pipes/store/install"),+ ).toHaveLength(1);- fireEvent.click(screen.getByTestId("first-run-next-step-daily-email"));- await waitFor(() =>- expect(mocks.localFetch.mock.calls.length).toBeGreaterThan(2),- );- expect(mocks.emit).not.toHaveBeenCalled();+ finishInstall?.();+ await waitFor(() => expect(action).toHaveTextContent("ready"));});- it("requires an explicit enable step before calling installed Pipes ready", async () => {- setPipeStates({- "daily-email-summary": false,- "digital-clone": false,- });- mocks.fetchComposioStatus.mockResolvedValue({- gmail: { connected: true, status: "active" },- });+ it("reports an install failure without claiming the task is ready", async () => {+ gmailConnected = true;+ installFailure = "engine busy";render(<FirstRunNextSteps userToken="user-token" />);- const dailyAction = await screen.findByTestId(- "first-run-next-step-daily-email",+ const action = await screen.findByTestId(+ "first-run-next-step-digital-clone",);- await waitFor(() =>- expect(dailyAction).toHaveTextContent("enable summary"),- );- expect(screen.getAllByText("installed, not active")).toHaveLength(2);-- fireEvent.click(dailyAction);- await waitFor(() =>- expect(mocks.localFetch).toHaveBeenCalledWith(- "/pipes/daily-email-summary/enable",- expect.objectContaining({- method: "POST",- body: JSON.stringify({ enabled: true }),- }),- ),- );- await waitFor(() => expect(dailyAction).toHaveTextContent("ready"));-- const cloneAction = screen.getByTestId("first-run-next-step-digital-clone");- fireEvent.click(cloneAction);- await waitFor(() => expect(cloneAction).toHaveTextContent("ready"));- });-- it("surfaces enable failure without claiming the scheduled task is ready", async () => {- setPipeStates({ "daily-email-summary": false });- mocks.fetchComposioStatus.mockResolvedValue({- gmail: { connected: true, status: "active" },- });- render(<FirstRunNextSteps userToken="user-token" />);-- const action = await screen.findByTestId("first-run-next-step-daily-email");- await waitFor(() => expect(action).toHaveTextContent("enable summary"));- mocks.localFetch.mockResolvedValue(response({ error: "engine busy" }));+ await waitFor(() => expect(action).toHaveTextContent("install & enable"));fireEvent.click(action);- expect(- await screen.findByText(- "could not enable the scheduled task. try again.",- ),- ).toBeInTheDocument();- expect(action).toHaveTextContent("enable summary");+ expect(await screen.findByText("engine busy")).toBeInTheDocument();+ expect(action).toHaveTextContent("install & enable");expect(action).toBeEnabled();});- it("clears a stale installer error when retry succeeds", async () => {- mocks.emit.mockRejectedValueOnce(new Error("event bus unavailable"));+ it("retries unknown connection state instead of navigating or guessing", async () => {+ mocks.fetchComposioStatus.mockResolvedValue(null);+ const openSettings = vi.fn();+ window.addEventListener("open-settings", openSettings);render(<FirstRunNextSteps userToken="user-token" />);const action = await screen.findByTestId("first-run-next-step-daily-email");- await waitFor(() => expect(action).toHaveTextContent("install"));+ await waitFor(() => expect(action).toHaveTextContent("retry"));fireEvent.click(action);- expect(- await screen.findByText("could not open the installer. try again."),- ).toBeInTheDocument();- fireEvent.click(screen.getByRole("button", { name: "retry" }));await waitFor(() =>- expect(- screen.queryByText("could not open the installer. try again."),- ).not.toBeInTheDocument(),+ expect(mocks.fetchComposioStatus.mock.calls.length).toBeGreaterThan(1),);+ expect(mocks.authorizeComposioToolkit).not.toHaveBeenCalled();+ expect(openSettings).not.toHaveBeenCalled();+ window.removeEventListener("open-settings", openSettings);});it("collapses fully completed recommendations into one quiet summary", async () => {- setInstalledPipes(["daily-email-summary", "digital-clone"]);- mocks.fetchComposioStatus.mockResolvedValue({- gmail: { connected: true, status: "active" },- });- mocks.oauthStatus.mockResolvedValue({- status: "ok",- data: { connected: true },+ gmailConnected = true;+ calendarConnected = true;+ setPipeStates({+ "daily-email-summary": true,+ "digital-clone": true,});render(<FirstRunNextSteps userToken="user-token" />);@@ -402,6 +314,5 @@ describe("first-run next steps", () => {expect(screen.queryByTestId("first-run-next-step-daily-email"),).not.toBeInTheDocument();- expect(screen.getByRole("status")).toHaveTextContent("daily setup ready");});});diff --git a/apps/screenpipe-app-tauri/components/first-run/next-steps.tsx b/apps/screenpipe-app-tauri/components/first-run/next-steps.tsxindex e580893a9..2170e86ae 100644--- a/apps/screenpipe-app-tauri/components/first-run/next-steps.tsx+++ b/apps/screenpipe-app-tauri/components/first-run/next-steps.tsx@@ -5,7 +5,7 @@"use client";import React, { useCallback, useEffect, useRef, useState } from "react";-import { emit } from "@tauri-apps/api/event";+import { openUrl } from "@tauri-apps/plugin-opener";import posthog from "posthog-js";import {BrainCircuit,@@ -18,18 +18,23 @@ import {import { Button } from "@/components/ui/button";import { localFetch } from "@/lib/api";-import { fetchComposioStatus } from "@/lib/composio";-import { CONNECTIONS_UPDATED_EVENT } from "@/lib/connections-events";import {- PIPE_INSTALL_CANCELLED_EVENT,- PIPE_INSTALLED_EVENT,- type PipeInstallCancelledReceipt,- type PipeInstalledReceipt,-} from "@/lib/pipe-install-receipt";+ authorizeComposioToolkit,+ fetchComposioStatus,+ registerComposioMcpServer,+} from "@/lib/composio";+import {+ CONNECTIONS_UPDATED_EVENT,+ notifyConnectionsUpdated,+} from "@/lib/connections-events";+import { foregroundAfterOAuth } from "@/lib/connections/foreground-oauth";+import { publishPipeInstalledReceipt } from "@/lib/pipe-install-receipt";import { commands } from "@/lib/utils/tauri";const DAILY_EMAIL_PIPE = "daily-email-summary";const DIGITAL_CLONE_PIPE = "digital-clone";+const GMAIL_POLL_INTERVAL_MS = 2_000;+const GMAIL_POLL_ATTEMPTS = 60;type SetupCheck = boolean | null;type PipeSetupState = "missing" | "disabled" | "enabled" | null;@@ -89,6 +94,27 @@ async function enablePipe(slug: string): Promise<void> {}}+async function installStorePipe(slug: string): Promise<void> {+ const response = await localFetch("/pipes/store/install", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ slug }),+ });+ const body = (await response.json().catch(() => null)) as {+ name?: string;+ connections?: string[];+ error?: string;+ } | null;+ if (!response.ok || body?.error) {+ throw new Error(body?.error ?? "scheduled task could not be installed");+ }++ publishPipeInstalledReceipt({+ pipeName: body?.name || slug,+ connections: Array.isArray(body?.connections) ? body.connections : [],+ });+}+async function checkGoogleCalendarConnected(): Promise<boolean> {const result = await commands.oauthStatus("google-calendar", null);if (result.status === "error") throw new Error(result.error);@@ -99,12 +125,35 @@ function settledValue<T>(result: PromiseSettledResult<T>): T | null {return result.status === "fulfilled" ? result.value : null;}-function openConnection(connectionId: "gmail" | "google-calendar") {- window.dispatchEvent(- new CustomEvent("open-settings", {- detail: { section: "connections", connectionId },- }),- );+function wait(ms: number, signal: AbortSignal): Promise<void> {+ return new Promise((resolve, reject) => {+ if (signal.aborted) {+ reject(new DOMException("cancelled", "AbortError"));+ return;+ }+ const timer = window.setTimeout(resolve, ms);+ signal.addEventListener(+ "abort",+ () => {+ window.clearTimeout(timer);+ reject(new DOMException("cancelled", "AbortError"));+ },+ { once: true },+ );+ });+}++async function waitForGmailConnection(+ token: string,+ signal: AbortSignal,+): Promise<boolean> {+ for (let attempt = 0; attempt < GMAIL_POLL_ATTEMPTS; attempt += 1) {+ if (signal.aborted) return false;+ const status = await fetchComposioStatus(token);+ if (status?.gmail?.connected === true) return true;+ await wait(GMAIL_POLL_INTERVAL_MS, signal);+ }+ return false;}function StatusLabel({@@ -128,7 +177,7 @@ function StatusLabel({);}-function NextStepCard({+function NextStepRow({icon,title,description,@@ -138,6 +187,7 @@ function NextStepCard({actionTestId,complete = false,busy = false,+ disabled = false,busyLabel = "checking",}: {icon: React.ReactNode;@@ -149,6 +199,7 @@ function NextStepCard({actionTestId: string;complete?: boolean;busy?: boolean;+ disabled?: boolean;busyLabel?: string;}) {const titleId = `${actionTestId}-title`;@@ -156,30 +207,32 @@ function NextStepCard({return (<articlearia-labelledby={titleId}- className="flex min-h-44 flex-col border border-border bg-background p-4"+ className="grid grid-cols-[2rem_minmax(0,1fr)] gap-x-3 gap-y-2 border-t border-border px-4 py-3 sm:grid-cols-[2rem_minmax(0,1fr)_auto] sm:items-center">- <div className="flex items-start justify-between gap-3">- <span className="flex h-8 w-8 items-center justify-center border border-border bg-muted/20">- {icon}- </span>- <StatusLabel ready={complete}>{status}</StatusLabel>+ <span className="row-span-2 flex h-8 w-8 items-center justify-center border border-border bg-muted/20">+ {icon}+ </span>+ <div className="min-w-0">+ <div className="flex flex-wrap items-center gap-x-2 gap-y-1">+ <h3+ id={titleId}+ className="font-mono text-xs font-semibold lowercase text-foreground"+ >+ {title}+ </h3>+ <StatusLabel ready={complete}>{status}</StatusLabel>+ </div>+ <p className="mt-1 text-[10px] leading-relaxed text-muted-foreground">+ {description}+ </p></div>- <h3- id={titleId}- className="mt-4 font-mono text-xs font-semibold lowercase text-foreground"- >- {title}- </h3>- <p className="mt-1.5 text-[11px] leading-relaxed text-muted-foreground">- {description}- </p><Buttontype="button"size="sm"variant={complete ? "ghost" : "outline"}data-testid={actionTestId}- className="mt-auto h-8 w-full justify-between px-2.5 text-[10px]"- disabled={complete || busy}+ className="col-start-2 h-8 w-full justify-between px-2.5 text-[10px] sm:col-start-3 sm:row-span-2 sm:row-start-1 sm:min-w-32"+ disabled={complete || busy || disabled}aria-busy={busy}onClick={action}>@@ -202,11 +255,9 @@ export function FirstRunNextStepsPanel({actionError,dailyEmailBusyLabel,digitalCloneBusyLabel,- onInstallDailyEmail,- onInstallDigitalClone,- onEnableDailyEmail,- onEnableDigitalClone,- onConnectGmail,+ calendarBusyLabel,+ onSetupDailyEmail,+ onSetupDigitalClone,onConnectGoogleCalendar,onRetry,}: {@@ -215,11 +266,9 @@ export function FirstRunNextStepsPanel({actionError?: string | null;dailyEmailBusyLabel?: string | null;digitalCloneBusyLabel?: string | null;- onInstallDailyEmail: () => void;- onInstallDigitalClone: () => void;- onEnableDailyEmail: () => void;- onEnableDigitalClone: () => void;- onConnectGmail: () => void;+ calendarBusyLabel?: string | null;+ onSetupDailyEmail: () => void;+ onSetupDigitalClone: () => void;onConnectGoogleCalendar: () => void;onRetry: () => void;}) {@@ -234,8 +283,7 @@ export function FirstRunNextStepsPanel({const dailyNeedsEnable = dailyDisabled && snapshot.gmailConnected === true;const dailyUnknown =snapshot.checked &&- (snapshot.dailyEmailState === null ||- (!dailyMissing && snapshot.gmailConnected === null));+ (snapshot.dailyEmailState === null || snapshot.gmailConnected === null);const cloneReady = snapshot.digitalCloneState === "enabled";const cloneDisabled = snapshot.digitalCloneState === "disabled";const cloneUnknown = snapshot.checked && snapshot.digitalCloneState === null;@@ -247,6 +295,10 @@ export function FirstRunNextStepsPanel({const allReady = dailyReady && cloneReady && calendarReady;const dailyBusy = checking || Boolean(dailyEmailBusyLabel);const cloneBusy = checking || Boolean(digitalCloneBusyLabel);+ const calendarBusy = checking || Boolean(calendarBusyLabel);+ const actionInProgress = Boolean(+ dailyEmailBusyLabel || digitalCloneBusyLabel || calendarBusyLabel,+ );const announcement = checking? "checking recommended setup status"@@ -281,8 +333,8 @@ export function FirstRunNextStepsPanel({</h2></div><p className="max-w-sm text-[10px] leading-relaxed text-muted-foreground sm:text-right">- each setup stays behind your review. nothing connects, installs, or- turns on by itself.+ setup runs from here. screenpipe only asks for a connection when one+ is missing.</p></div>@@ -305,8 +357,8 @@ export function FirstRunNextStepsPanel({</div></div>) : (- <div className="grid gap-2 px-4 pb-4 md:grid-cols-3">- <NextStepCard+ <div className="border-b border-border pb-1">+ <NextStepRowicon={<Mail className="h-4 w-4" aria-hidden="true" />}title="daily email summary"description="send one concise, source-backed recap to your own inbox every evening."@@ -329,37 +381,36 @@ export function FirstRunNextStepsPanel({? "gmail connected": gmailUnknown? "gmail check unavailable"- : "gmail setup follows"- }- action={- dailyUnknown- ? onRetry- : dailyNeedsGmail- ? onConnectGmail- : dailyNeedsEnable- ? onEnableDailyEmail- : onInstallDailyEmail+ : "gmail needed"}+ action={dailyUnknown ? onRetry : onSetupDailyEmail}actionLabel={dailyReady? "ready": dailyUnknown? "retry"- : dailyNeedsGmail- ? "connect gmail"+ : dailyMissing+ ? snapshot.gmailConnected === true+ ? "install & enable"+ : "install & connect"+ : dailyNeedsGmail+ ? dailyEnabled+ ? "connect gmail"+ : "connect & enable": dailyNeedsEnable? "enable summary"- : "install"+ : "set up"}actionTestId="first-run-next-step-daily-email"complete={dailyReady}busy={dailyBusy}+ disabled={actionInProgress}busyLabel={checking ? "checking" : (dailyEmailBusyLabel ?? "working")}/>- <NextStepCard+ <NextStepRowicon={<BrainCircuit className="h-4 w-4" aria-hidden="true" />}title="digital clone"description="build a structured memory of your work, meetings, and recurring people on this device."@@ -376,13 +427,7 @@ export function FirstRunNextStepsPanel({? "status unavailable": "no connection needed"}- action={- cloneUnknown- ? onRetry- : cloneDisabled- ? onEnableDigitalClone- : onInstallDigitalClone- }+ action={cloneUnknown ? onRetry : onSetupDigitalClone}actionLabel={cloneReady? "ready"@@ -390,17 +435,18 @@ export function FirstRunNextStepsPanel({? "retry": cloneDisabled? "enable"- : "install"+ : "install & enable"}actionTestId="first-run-next-step-digital-clone"complete={cloneReady}busy={cloneBusy}+ disabled={actionInProgress}busyLabel={checking ? "checking" : (digitalCloneBusyLabel ?? "working")}/>- <NextStepCard+ <NextStepRowicon={<CalendarDays className="h-4 w-4" aria-hidden="true" />}title="google calendar"description="add upcoming meeting context so calls are easier to prepare for."@@ -423,7 +469,11 @@ export function FirstRunNextStepsPanel({}actionTestId="first-run-next-step-google-calendar"complete={calendarReady}- busy={checking}+ busy={calendarBusy}+ disabled={actionInProgress}+ busyLabel={+ checking ? "checking" : (calendarBusyLabel ?? "connecting")+ }/></div>)}@@ -462,18 +512,13 @@ export function FirstRunNextSteps({useState<FirstRunNextStepsSnapshot>(INITIAL_SNAPSHOT);const [refreshing, setRefreshing] = useState(false);const [actionError, setActionError] = useState<string | null>(null);- const [installerPendingSlug, setInstallerPendingSlug] = useState<- string | null- >(null);- const [enablingPipe, setEnablingPipe] = useState<string | null>(null);+ const [busyAction, setBusyAction] = useState<{+ id: "daily-email" | "digital-clone" | "google-calendar";+ label: string;+ } | null>(null);const refreshIdRef = useRef(0);- const pendingDailyInstallRef = useRef(false);- const installerPendingSlugRef = useRef<string | null>(null);- const enablingPipeRef = useRef<string | null>(null);- const gmailConnectedRef = useRef<SetupCheck>(null);- const followUpTimerRef = useRef<number | null>(null);-- gmailConnectedRef.current = snapshot.gmailConnected;+ const busyActionRef = useRef<typeof busyAction>(null);+ const gmailConnectAbortRef = useRef<AbortController | null>(null);const refresh = useCallback(async () => {const refreshId = ++refreshIdRef.current;@@ -488,7 +533,7 @@ export function FirstRunNextSteps({if (!status) throw new Error("gmail status unavailable");return status.gmail?.connected === true;})- : Promise.resolve(false),+ : Promise.resolve(null),checkGoogleCalendarConnected(),]);@@ -511,117 +556,160 @@ export function FirstRunNextSteps({const refreshWhenVisible = () => {if (document.visibilityState === "visible") void refresh();};- const onInstalled = (event: Event) => {- const detail = (event as CustomEvent<PipeInstalledReceipt>).detail;- if (detail?.pipeName === installerPendingSlugRef.current) {- installerPendingSlugRef.current = null;- setInstallerPendingSlug(null);- }- void refresh();- if (- pendingDailyInstallRef.current &&- detail?.pipeName === DAILY_EMAIL_PIPE- ) {- pendingDailyInstallRef.current = false;- if (gmailConnectedRef.current === false) {- if (followUpTimerRef.current !== null) {- window.clearTimeout(followUpTimerRef.current);- }- // The global installer navigates to Scheduled Tasks after it emits- // this receipt. Run the focused Gmail handoff on the next task so it- // wins that harmless navigation race.- followUpTimerRef.current = window.setTimeout(() => {- posthog.capture("first_run_next_step_selected", {- step: "gmail",- source: "daily_email_install_follow_up",- });- openConnection("gmail");- }, 0);- }- }- };- const onInstallCancelled = (event: Event) => {- const detail = (event as CustomEvent<PipeInstallCancelledReceipt>).detail;- if (detail?.url !== `registry:${installerPendingSlugRef.current}`) return;- installerPendingSlugRef.current = null;- pendingDailyInstallRef.current = false;- setInstallerPendingSlug(null);- };window.addEventListener("focus", refresh);document.addEventListener("visibilitychange", refreshWhenVisible);window.addEventListener(CONNECTIONS_UPDATED_EVENT, refresh);- window.addEventListener(PIPE_INSTALLED_EVENT, onInstalled);- window.addEventListener(PIPE_INSTALL_CANCELLED_EVENT, onInstallCancelled);return () => {window.removeEventListener("focus", refresh);document.removeEventListener("visibilitychange", refreshWhenVisible);window.removeEventListener(CONNECTIONS_UPDATED_EVENT, refresh);- window.removeEventListener(PIPE_INSTALLED_EVENT, onInstalled);- window.removeEventListener(- PIPE_INSTALL_CANCELLED_EVENT,- onInstallCancelled,- );- if (followUpTimerRef.current !== null) {- window.clearTimeout(followUpTimerRef.current);- }+ gmailConnectAbortRef.current?.abort();};}, [refresh]);- const openInstaller = useCallback(- async (slug: string, followWithGmail = false) => {- if (installerPendingSlugRef.current) return;- installerPendingSlugRef.current = slug;- setInstallerPendingSlug(slug);- setActionError(null);- pendingDailyInstallRef.current = followWithGmail;- posthog.capture("first_run_next_step_selected", {- step: slug,- state: "not_installed",- });- try {- await emit("install-pipe", { url: `registry:${slug}` });- } catch {- installerPendingSlugRef.current = null;- pendingDailyInstallRef.current = false;- setInstallerPendingSlug(null);- setActionError("could not open the installer. try again.");- }+ const setActionLabel = useCallback(+ (+ id: "daily-email" | "digital-clone" | "google-calendar",+ label: string,+ ) => {+ setBusyAction({ id, label });},[],);- const enableRecommendedPipe = useCallback(- async (slug: string) => {- if (enablingPipeRef.current) return;- enablingPipeRef.current = slug;- setEnablingPipe(slug);- setActionError(null);- posthog.capture("first_run_next_step_selected", {- step: slug,- state: "installed_disabled",- });- try {- await enablePipe(slug);+ const connectGmail = useCallback(async () => {+ if (!userToken) {+ throw new Error("sign in to connect gmail, then try again.");+ }+ gmailConnectAbortRef.current?.abort();+ const controller = new AbortController();+ gmailConnectAbortRef.current = controller;+ const redirectUrl = await authorizeComposioToolkit(userToken, "gmail");+ await openUrl(redirectUrl);+ const connected = await waitForGmailConnection(+ userToken,+ controller.signal,+ );+ if (!connected) {+ throw new Error("gmail connection was not completed. try again.");+ }+ await registerComposioMcpServer(userToken);+ await foregroundAfterOAuth();+ notifyConnectionsUpdated();+ posthog.capture("connection_saved", {+ integration: "composio-gmail",+ source: "first_run_next_steps",+ });+ }, [userToken]);++ const setupDailyEmail = useCallback(async () => {+ if (busyActionRef.current) return;+ busyActionRef.current = { id: "daily-email", label: "starting" };+ setActionLabel("daily-email", "starting");+ setActionError(null);+ posthog.capture("first_run_next_step_selected", {+ step: DAILY_EMAIL_PIPE,+ state: snapshot.dailyEmailState,+ gmail_connected: snapshot.gmailConnected,+ });+ try {+ if (snapshot.dailyEmailState === "missing") {+ setActionLabel("daily-email", "installing");+ await installStorePipe(DAILY_EMAIL_PIPE);+ }+ if (snapshot.gmailConnected !== true) {+ setActionLabel("daily-email", "connecting gmail");+ await connectGmail();+ }+ if (snapshot.dailyEmailState !== "enabled") {+ setActionLabel("daily-email", "enabling");+ await enablePipe(DAILY_EMAIL_PIPE);+ }+ await refresh();+ } catch (error) {+ if (!(error instanceof DOMException && error.name === "AbortError")) {await refresh();- } catch {- setActionError("could not enable the scheduled task. try again.");- } finally {- enablingPipeRef.current = null;- setEnablingPipe(null);+ setActionError(+ error instanceof Error+ ? error.message+ : "could not finish the daily email setup. try again.",+ );}- },- [refresh],- );+ } finally {+ busyActionRef.current = null;+ setBusyAction(null);+ }+ }, [connectGmail, refresh, setActionLabel, snapshot]);- const connect = useCallback((connectionId: "gmail" | "google-calendar") => {+ const setupDigitalClone = useCallback(async () => {+ if (busyActionRef.current) return;+ busyActionRef.current = { id: "digital-clone", label: "starting" };+ setActionLabel("digital-clone", "starting");setActionError(null);posthog.capture("first_run_next_step_selected", {- step: connectionId,+ step: DIGITAL_CLONE_PIPE,+ state: snapshot.digitalCloneState,+ });+ try {+ if (snapshot.digitalCloneState === "missing") {+ setActionLabel("digital-clone", "installing");+ await installStorePipe(DIGITAL_CLONE_PIPE);+ }+ if (snapshot.digitalCloneState !== "enabled") {+ setActionLabel("digital-clone", "enabling");+ await enablePipe(DIGITAL_CLONE_PIPE);+ }+ await refresh();+ } catch (error) {+ await refresh();+ setActionError(+ error instanceof Error+ ? error.message+ : "could not finish the digital clone setup. try again.",+ );+ } finally {+ busyActionRef.current = null;+ setBusyAction(null);+ }+ }, [refresh, setActionLabel, snapshot.digitalCloneState]);++ const connectGoogleCalendar = useCallback(async () => {+ if (busyActionRef.current) return;+ busyActionRef.current = { id: "google-calendar", label: "connecting" };+ setActionLabel("google-calendar", "connecting");+ setActionError(null);+ posthog.capture("first_run_next_step_selected", {+ step: "google-calendar",state: "not_connected",});- openConnection(connectionId);- }, []);+ try {+ const result = await commands.oauthConnect(+ "google-calendar",+ null,+ null,+ );+ if (result.status === "error") throw new Error(result.error);+ if (!result.data.connected) {+ throw new Error("google calendar connection was not completed.");+ }+ notifyConnectionsUpdated();+ posthog.capture("google_calendar_connected", {+ source: "first_run_next_steps",+ });+ await refresh();+ } catch (error) {+ await refresh();+ setActionError(+ error instanceof Error+ ? error.message+ : "could not connect google calendar. try again.",+ );+ } finally {+ busyActionRef.current = null;+ setBusyAction(null);+ }+ }, [refresh, setActionLabel]);const retry = useCallback(() => {setActionError(null);@@ -634,29 +722,17 @@ export function FirstRunNextSteps({refreshing={refreshing}actionError={actionError}dailyEmailBusyLabel={- installerPendingSlug === DAILY_EMAIL_PIPE- ? "reviewing install"- : enablingPipe === DAILY_EMAIL_PIPE- ? "enabling"- : null+ busyAction?.id === "daily-email" ? busyAction.label : null}digitalCloneBusyLabel={- installerPendingSlug === DIGITAL_CLONE_PIPE- ? "reviewing install"- : enablingPipe === DIGITAL_CLONE_PIPE- ? "enabling"- : null- }- onInstallDailyEmail={() =>- void openInstaller(DAILY_EMAIL_PIPE, snapshot.gmailConnected === false)+ busyAction?.id === "digital-clone" ? busyAction.label : null}- onInstallDigitalClone={() => void openInstaller(DIGITAL_CLONE_PIPE)}- onEnableDailyEmail={() => void enableRecommendedPipe(DAILY_EMAIL_PIPE)}- onEnableDigitalClone={() =>- void enableRecommendedPipe(DIGITAL_CLONE_PIPE)+ calendarBusyLabel={+ busyAction?.id === "google-calendar" ? busyAction.label : null}- onConnectGmail={() => connect("gmail")}- onConnectGoogleCalendar={() => connect("google-calendar")}+ onSetupDailyEmail={() => void setupDailyEmail()}+ onSetupDigitalClone={() => void setupDigitalClone()}+ onConnectGoogleCalendar={() => void connectGoogleCalendar()}onRetry={retry}/>);diff --git a/apps/screenpipe-app-tauri/components/pipe-install-dialog.test.tsx b/apps/screenpipe-app-tauri/components/pipe-install-dialog.test.tsxindex f06b470ff..45a2759dd 100644--- a/apps/screenpipe-app-tauri/components/pipe-install-dialog.test.tsx+++ b/apps/screenpipe-app-tauri/components/pipe-install-dialog.test.tsx@@ -26,6 +26,7 @@ const mocks = vi.hoisted(() => ({toast: vi.fn(),capture: vi.fn(),openFeedback: vi.fn(),+ risk: "safe" as "safe" | "warning" | "high",}));vi.mock("@tauri-apps/api/event", () => ({@@ -48,7 +49,7 @@ vi.mock("@/components/ui/use-toast", () => ({useToast: () => ({ toast: mocks.toast }),}));vi.mock("@/components/pipe-store", () => ({- getPipeInstallRisk: () => "safe",+ getPipeInstallRisk: () => mocks.risk,InstallRiskSummary: () => <div>review requested access</div>,}));vi.mock("@/lib/stores/feedback-store", () => ({@@ -75,12 +76,13 @@ async function openRegistryInstall() {payload: { url: "registry:digital-clone" },});});- await screen.findByText("install scheduled task?");+ await screen.findByText("review scheduled task access");}beforeEach(() => {vi.clearAllMocks();mocks.installListener = null;+ mocks.risk = "safe";mocks.localFetch.mockResolvedValue(response({slug: "digital-clone",@@ -124,13 +126,13 @@ describe("pipe install dialog lifecycle", () => {});fireEvent.click(install);expect(await screen.findByText("installing...")).toBeInTheDocument();- expect(screen.getByText("install scheduled task?")).toBeInTheDocument();+ expect(screen.getByText("review scheduled task access")).toBeInTheDocument();expect(cancelled).not.toHaveBeenCalled();await act(async () => finishInstall?.());await waitFor(() =>expect(- screen.queryByText("install scheduled task?"),+ screen.queryByText("review scheduled task access"),).not.toBeInTheDocument(),);expect(installed).toHaveBeenCalledWith(@@ -139,6 +141,7 @@ describe("pipe install dialog lifecycle", () => {}),);expect(cancelled).not.toHaveBeenCalled();+ expect(mocks.setSection).not.toHaveBeenCalled();window.removeEventListener(PIPE_INSTALLED_EVENT, installed);window.removeEventListener(PIPE_INSTALL_CANCELLED_EVENT, cancelled);});@@ -152,7 +155,7 @@ describe("pipe install dialog lifecycle", () => {fireEvent.click(screen.getByRole("button", { name: "not now" }));await waitFor(() =>expect(- screen.queryByText("install scheduled task?"),+ screen.queryByText("review scheduled task access"),).not.toBeInTheDocument(),);expect(cancelled).toHaveBeenCalledWith(@@ -166,4 +169,40 @@ describe("pipe install dialog lifecycle", () => {);window.removeEventListener(PIPE_INSTALL_CANCELLED_EVENT, cancelled);});++ it("keeps one confirmation for high-risk links without an acknowledgement checkbox", async () => {+ mocks.risk = "high";+ render(<PipeInstallDialog />);+ await openRegistryInstall();++ expect(screen.queryByRole("checkbox")).not.toBeInTheDocument();+ expect(+ screen.getByRole("button", { name: "install scheduled task" }),+ ).toBeEnabled();+ });++ it("opens Scheduled Tasks only when the installed task declares connections", async () => {+ mocks.localFetch.mockImplementation((url: string) =>+ Promise.resolve(+ response(+ url === "/pipes/store/install"+ ? { name: "connected-task", connections: ["slack"] }+ : {+ slug: "digital-clone",+ title: "Digital Clone",+ author: "screenpipe",+ author_verified: true,+ permissions: {},+ },+ ),+ ),+ );+ render(<PipeInstallDialog />);+ await openRegistryInstall();+ fireEvent.click(+ screen.getByRole("button", { name: "install scheduled task" }),+ );++ await waitFor(() => expect(mocks.setSection).toHaveBeenCalledWith("pipes"));+ });});diff --git a/apps/screenpipe-app-tauri/components/pipe-install-dialog.tsx b/apps/screenpipe-app-tauri/components/pipe-install-dialog.tsxindex 9de1c79b0..21a970061 100644--- a/apps/screenpipe-app-tauri/components/pipe-install-dialog.tsx+++ b/apps/screenpipe-app-tauri/components/pipe-install-dialog.tsx@@ -54,7 +54,6 @@ export function PipeInstallDialog() {const [preview, setPreview] = useState<string | null>(null);const [loading, setLoading] = useState(false);const [installing, setInstalling] = useState(false);- const [installRiskAcknowledged, setInstallRiskAcknowledged] = useState(false);const [registryDetail, setRegistryDetail] = useState<RegistryPipeDetail | null>(null);const [, setSection] = useQueryState("section");const { toast } = useToast();@@ -66,7 +65,6 @@ export function PipeInstallDialog() {setRequest(event.payload);setPreview(null);setRegistryDetail(null);- setInstallRiskAcknowledged(false);setLoading(true);const url = event.payload.url;@@ -156,8 +154,9 @@ export function PipeInstallDialog() {});setRequest(null);- // Navigate to pipes tab so user sees installed pipe + connection modal- setSection("pipes");+ // Connection-aware tasks still need the existing post-install handoff.+ // Connection-free installs stay on the surface that initiated them.+ if (pipeConnections.length > 0) setSection("pipes");} catch (err: any) {toast({title: "failed to install scheduled task",@@ -185,7 +184,6 @@ export function PipeInstallDialog() {posthog.capture("pipe_install_cancelled", { url: request?.url });publishPipeInstallCancelledReceipt({ url: request.url });setRequest(null);- setInstallRiskAcknowledged(false);};// Strip frontmatter for display@@ -205,7 +203,7 @@ export function PipeInstallDialog() {<AlertDialog open={!!request} onOpenChange={(open) => !open && handleCancel()}><AlertDialogContent className="max-w-lg max-h-[80vh] overflow-y-auto"><AlertDialogHeader>- <AlertDialogTitle className="text-sm">install scheduled task?</AlertDialogTitle>+ <AlertDialogTitle className="text-sm">review scheduled task access</AlertDialogTitle><AlertDialogDescription className="text-xs">{isRegistry? registryRisk === "high"@@ -230,9 +228,6 @@ export function PipeInstallDialog() {author={registryDetail.author}authorVerified={registryDetail.author_verified}permissions={registryDetail.permissions as any}- acknowledgeId="registry-pipe-risk-ack"- acknowledged={installRiskAcknowledged}- onAcknowledgedChange={setInstallRiskAcknowledged}/>) : preview ? (<div className="border rounded overflow-hidden">@@ -260,7 +255,7 @@ export function PipeInstallDialog() {type="button"className="text-xs"onClick={handleInstall}- disabled={installing || (isRegistry && registryRisk === "high" && !installRiskAcknowledged)}+ disabled={installing}>{installing ? (<>diff --git a/apps/screenpipe-app-tauri/components/pipe-store.tsx b/apps/screenpipe-app-tauri/components/pipe-store.tsxindex dfb3813ec..7b5234a44 100644--- a/apps/screenpipe-app-tauri/components/pipe-store.tsx+++ b/apps/screenpipe-app-tauri/components/pipe-store.tsx@@ -13,8 +13,6 @@ import { Card, CardContent } from "@/components/ui/card";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";import { Badge } from "@/components/ui/badge";-import { Label } from "@/components/ui/label";-import { Checkbox } from "@/components/ui/checkbox";import { Skeleton } from "@/components/ui/skeleton";import {Dialog,@@ -468,7 +466,6 @@ function DiscoverView({ onInstalled }: { onInstalled?: () => void }) {// Install stateconst [installing, setInstalling] = useState<string | null>(null);const [pendingInstall, setPendingInstall] = useState<StorePipe | PipeDetail | null>(null);- const [installRiskAcknowledged, setInstallRiskAcknowledged] = useState(false);// Review stateconst [reviewExpanded, setReviewExpanded] = useState(false);@@ -654,7 +651,6 @@ function DiscoverView({ onInstalled }: { onInstalled?: () => void }) {return;}setPendingInstall(pipe);- setInstallRiskAcknowledged(false);};// Update an already-installed store pipe in place. Unlike install, this@@ -693,13 +689,10 @@ function DiscoverView({ onInstalled }: { onInstalled?: () => void }) {const closeInstallGate = () => {setPendingInstall(null);- setInstallRiskAcknowledged(false);};const confirmPendingInstall = () => {if (!pendingInstall) return;- const risk = getPipeInstallRisk(pendingInstall);- if (risk === "high" && !installRiskAcknowledged) return;const slug = pendingInstall.slug;closeInstallGate();void handleInstall(slug);@@ -868,9 +861,6 @@ function DiscoverView({ onInstalled }: { onInstalled?: () => void }) {authorVerified={pendingInstall.author_verified}permissions={pendingInstall.permissions}onReviewSource={reviewPendingInstallSource}- acknowledgeId="pipe-risk-ack"- acknowledged={installRiskAcknowledged}- onAcknowledgedChange={setInstallRiskAcknowledged}/>) : null}@@ -882,8 +872,7 @@ function DiscoverView({ onInstalled }: { onInstalled?: () => void }) {data-testid="pipe-risk-install-confirm"disabled={!pendingInstall ||- installing === pendingInstall.slug ||- (getPipeInstallRisk(pendingInstall) === "high" && !installRiskAcknowledged)+ installing === pendingInstall.slug}onClick={confirmPendingInstall}>@@ -1646,18 +1635,12 @@ export function InstallRiskSummary({authorVerified,permissions,onReviewSource,- acknowledgeId,- acknowledged,- onAcknowledgedChange,}: {title: string;author?: string;authorVerified: boolean;permissions?: PipePermissions;onReviewSource?: () => void;- acknowledgeId?: string;- acknowledged?: boolean;- onAcknowledgedChange?: (checked: boolean) => void;}) {const risk = getPipeInstallRisk({permissions,@@ -1703,20 +1686,6 @@ export function InstallRiskSummary({))}</div>)}-- {risk === "high" && acknowledgeId && onAcknowledgedChange ? (- <div className="flex items-start gap-2 pt-3 border-t border-border">- <Checkbox- id={acknowledgeId}- data-testid="pipe-risk-ack"- checked={acknowledged === true}- onCheckedChange={(value) => onAcknowledgedChange(value === true)}- />- <Label htmlFor={acknowledgeId} className="text-xs leading-relaxed">- I understand this scheduled task can access all my data.- </Label>- </div>- ) : null}</div></div>);