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
Add optional Workflows chat sharing with strict Tinfoil redaction (#7187)
Louis Beaumont361f596f9d65
diff --git a/.github/pr-assets/workflow-sharing/README.md b/.github/pr-assets/workflow-sharing/README.mdnew file mode 100644index 000000000..a5fa5cc22--- /dev/null+++ b/.github/pr-assets/workflow-sharing/README.md@@ -0,0 +1,23 @@+# Workflow sharing visual evidence++Actual React components in an isolated Chromium preview with synthetic account/settings data and mocked native/backend operations. External network traffic is intercepted. No production collection or customer data is used.++## Sources++- `entry-before-*` and `settings-before-off`: recreated original baseline from `558ffda349ca3553c9dabf5cc0fbaaa5a92e2357`.+- `before-combined`: previous combined-dialog implementation, unchanged visually through `cd6d691730549e5c2c0a3e6bee3c01e44e56e125`.+- Remaining images: refreshed from two-step implementation `4d13358c23e66acab950047e4bffd10b4d180097`, using actual `WorkflowTasksPrompt`, `WorkflowSharingControls`, `PrivacySection`, UI primitives and global styles.++## Capture conditions++Desktop viewport 1100 × 1000 CSS pixels at device scale 1. Dialog crops retain 24 pixels of surrounding overlay, with the same content width and scale. Historical baseline images were cropped with the same padding; their content is unchanged. Narrow dialog viewport 600 × 760. Settings excerpts preserve the same 786-pixel content width and show sharing through the existing cloud-redaction explanation; lower recording-category controls are outside the excerpt. Additional settings states show the sharing card.++The modal intentionally retains its white surface in both themes, with a light native color scheme for checkbox readability. Settings respect the app theme. All 30 PNGs were inspected. Temporary preview code and synthetic ports are outside the repository.++## Coverage++Two-step entry: daily updates first; either explicit daily-update choice leads to optional sharing. Training starts unchecked and applies only to Screenpipe's own models. Captures include both themes, expanded details, training selected, narrow layout, pending saves and recoverable failures. Browser assertions also verified successful sharing closes the dialog.++Privacy settings: before/after, sharing off/on, cloud backend locked, first-party training, expanded details, deletion confirmation/completion with Local restored, saving, enable/stop/status failures, unavailable/managed accounts, dark mode, and recording redaction staying off while sharing still requires cloud.++Focused tests additionally verify no implicit consent, remembered per-account dismissal, signed-out/already-sharing cases, repeat submission prevention, and failed saves preserving the prompt. Native redaction and deployed backend behavior are outside this visual preview.diff --git a/.github/pr-assets/workflow-sharing/before-combined.png b/.github/pr-assets/workflow-sharing/before-combined.pngnew file mode 100644index 000000000..b86685670Binary files /dev/null and b/.github/pr-assets/workflow-sharing/before-combined.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-before-dark.png b/.github/pr-assets/workflow-sharing/entry-before-dark.pngnew file mode 100644index 000000000..7970af06bBinary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-before-dark.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-before-light.png b/.github/pr-assets/workflow-sharing/entry-before-light.pngnew file mode 100644index 000000000..4557ab7d9Binary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-before-light.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-daily-details.png b/.github/pr-assets/workflow-sharing/entry-daily-details.pngnew file mode 100644index 000000000..0505943a5Binary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-daily-details.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-daily-error.png b/.github/pr-assets/workflow-sharing/entry-daily-error.pngnew file mode 100644index 000000000..3bfd8ff10Binary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-daily-error.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-daily-saving.png b/.github/pr-assets/workflow-sharing/entry-daily-saving.pngnew file mode 100644index 000000000..229c3ca2aBinary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-daily-saving.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-daily-updates-dark.png b/.github/pr-assets/workflow-sharing/entry-daily-updates-dark.pngnew file mode 100644index 000000000..3d78d0c9cBinary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-daily-updates-dark.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-daily-updates-light.png b/.github/pr-assets/workflow-sharing/entry-daily-updates-light.pngnew file mode 100644index 000000000..cb1165f5bBinary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-daily-updates-light.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-narrow.png b/.github/pr-assets/workflow-sharing/entry-narrow.pngnew file mode 100644index 000000000..3d4a21fccBinary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-narrow.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-sharing-before-refinement.png b/.github/pr-assets/workflow-sharing/entry-sharing-before-refinement.pngnew file mode 100644index 000000000..d684cb6b0Binary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-sharing-before-refinement.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-sharing-dark.png b/.github/pr-assets/workflow-sharing/entry-sharing-dark.pngnew file mode 100644index 000000000..84a903645Binary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-sharing-dark.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-sharing-details.png b/.github/pr-assets/workflow-sharing/entry-sharing-details.pngnew file mode 100644index 000000000..157122d6cBinary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-sharing-details.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-sharing-error.png b/.github/pr-assets/workflow-sharing/entry-sharing-error.pngnew file mode 100644index 000000000..c3a199cf7Binary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-sharing-error.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-sharing-light.png b/.github/pr-assets/workflow-sharing/entry-sharing-light.pngnew file mode 100644index 000000000..536222356Binary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-sharing-light.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-sharing-saving.png b/.github/pr-assets/workflow-sharing/entry-sharing-saving.pngnew file mode 100644index 000000000..2fde65ecbBinary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-sharing-saving.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-training-keyboard.png b/.github/pr-assets/workflow-sharing/entry-training-keyboard.pngnew file mode 100644index 000000000..8a95b4108Binary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-training-keyboard.png differdiff --git a/.github/pr-assets/workflow-sharing/entry-training-on.png b/.github/pr-assets/workflow-sharing/entry-training-on.pngnew file mode 100644index 000000000..f24a41728Binary files /dev/null and b/.github/pr-assets/workflow-sharing/entry-training-on.png differdiff --git a/.github/pr-assets/workflow-sharing/in-app-sharing-preview.png b/.github/pr-assets/workflow-sharing/in-app-sharing-preview.pngnew file mode 100644index 000000000..689a1ffd5Binary files /dev/null and b/.github/pr-assets/workflow-sharing/in-app-sharing-preview.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-after-off.png b/.github/pr-assets/workflow-sharing/settings-after-off.pngnew file mode 100644index 000000000..1bcb23bc1Binary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-after-off.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-before-off.png b/.github/pr-assets/workflow-sharing/settings-before-off.pngnew file mode 100644index 000000000..1bef883ebBinary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-before-off.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-before-refinement.png b/.github/pr-assets/workflow-sharing/settings-before-refinement.pngnew file mode 100644index 000000000..edbbfe36eBinary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-before-refinement.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-delete-confirmation.png b/.github/pr-assets/workflow-sharing/settings-delete-confirmation.pngnew file mode 100644index 000000000..161bd0001Binary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-delete-confirmation.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-deleted-local-restored.png b/.github/pr-assets/workflow-sharing/settings-deleted-local-restored.pngnew file mode 100644index 000000000..48f263401Binary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-deleted-local-restored.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-details-expanded.png b/.github/pr-assets/workflow-sharing/settings-details-expanded.pngnew file mode 100644index 000000000..27da044f0Binary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-details-expanded.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-enable-error.png b/.github/pr-assets/workflow-sharing/settings-enable-error.pngnew file mode 100644index 000000000..4946f390bBinary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-enable-error.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-load-error.png b/.github/pr-assets/workflow-sharing/settings-load-error.pngnew file mode 100644index 000000000..00b11941dBinary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-load-error.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-managed.png b/.github/pr-assets/workflow-sharing/settings-managed.pngnew file mode 100644index 000000000..2eccd685cBinary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-managed.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-recording-redaction-off.png b/.github/pr-assets/workflow-sharing/settings-recording-redaction-off.pngnew file mode 100644index 000000000..d47a4cc2bBinary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-recording-redaction-off.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-saving.png b/.github/pr-assets/workflow-sharing/settings-saving.pngnew file mode 100644index 000000000..1879a3dbbBinary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-saving.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-sharing-on-dark.png b/.github/pr-assets/workflow-sharing/settings-sharing-on-dark.pngnew file mode 100644index 000000000..402e92f6aBinary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-sharing-on-dark.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-sharing-on.png b/.github/pr-assets/workflow-sharing/settings-sharing-on.pngnew file mode 100644index 000000000..caa2aa985Binary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-sharing-on.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-stop-network-error.png b/.github/pr-assets/workflow-sharing/settings-stop-network-error.pngnew file mode 100644index 000000000..079f4490dBinary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-stop-network-error.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-training-on.png b/.github/pr-assets/workflow-sharing/settings-training-on.pngnew file mode 100644index 000000000..b3f05e583Binary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-training-on.png differdiff --git a/.github/pr-assets/workflow-sharing/settings-unavailable.png b/.github/pr-assets/workflow-sharing/settings-unavailable.pngnew file mode 100644index 000000000..fbb695a2cBinary files /dev/null and b/.github/pr-assets/workflow-sharing/settings-unavailable.png differdiff --git a/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx b/apps/screenpipe-app-tauri/components/settings/privacy-section.tsxindex 93ed4d4f7..cbfaaea68 100644--- a/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx+++ b/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx@@ -1,4 +1,5 @@"use client";+import { WorkflowSharingControls } from "@/components/workflows/workflow-sharing-controls";// screenpipe — AI that knows everything you've seen, said, or heard// https://screenpipe.com@@ -21,6 +22,7 @@ export const searchIndex: SettingsField[] = [label: msg("Ignore incognito windows", {}),keywords: ["private", "browser", "enhanced", "automation"],},+ { label: msg("Help improve Workflows", {}), keywords: ["sharing", "training", "consent", "delete shared chats"] },{ label: msg("PII masking", {}), keywords: ["mask", "redact", "columns", "url", "fields"] },{label: msg("Remote support logs", {}),@@ -382,6 +384,7 @@ export function PrivacySection() {// The managed policy runtime reapplies PII policy on every policy poll.const { getManagedValue, isManagedDeployment } = useManagedPolicy();const managedPiiBackend = getManagedValue("piiBackend");+ const sharingRequiresCloud = !!settings.workflowSharing;// Same idea for input capture: the admin can force keyboard/click rows on// or off org-wide (applied by the managed policy runtime).// These settings are inverted ("disable…"), so ManagedSwitch — which assumes@@ -591,6 +594,7 @@ export function PrivacySection() {// Where the AI workers run — one switch covers both modalities.const piiBackend = (settings.piiBackend as "local" | "tinfoil" | undefined) ?? "local";const handlePiiBackendChange = (next: "local" | "tinfoil") => {+ if (sharingRequiresCloud) return;handleSettingsChange({ piiBackend: next } as any, true);};@@ -1350,6 +1354,7 @@ export function PrivacySection() {</div>{/* Data Protection */}+ <WorkflowSharingControls /><LockedSetting settingKey="pii_removal"><div className="space-y-2"><h2 className="text-xs font-semibold text-muted-foreground normal-case tracking-wider px-1">@@ -1479,8 +1484,8 @@ export function PrivacySection() {</div></div>)}- {aiPiiRemovalEnabled && (- <div className="mt-3 ml-6 space-y-2 border-l-2 border-border pl-3">+ {(aiPiiRemovalEnabled || sharingRequiresCloud) && (+ <div id="workflow-cloud-redaction" className="mt-3 ml-6 space-y-2 border-l-2 border-border pl-3"><div className="flex flex-wrap items-center gap-x-4 gap-y-1 text-xs"><span className="font-medium text-foreground">Where it runs</span><label className={`flex items-center gap-1.5 ${managedPiiBackend ? "cursor-not-allowed opacity-60" : "cursor-pointer"}`}>@@ -1488,7 +1493,7 @@ export function PrivacySection() {type="radio"name="piiBackend"checked={piiBackend === "local"}- disabled={!!managedPiiBackend}+ disabled={!!managedPiiBackend || sharingRequiresCloud}onChange={() => handlePiiBackendChange("local")}/><span className="text-foreground">Local</span>@@ -1498,13 +1503,14 @@ export function PrivacySection() {type="radio"name="piiBackend"checked={piiBackend === "tinfoil"}- disabled={!!managedPiiBackend}+ disabled={!!managedPiiBackend || sharingRequiresCloud}onChange={() => handlePiiBackendChange("tinfoil")}/><span className="text-foreground">Cloud (enclave)</span></label></div><p className="text-[11px] text-muted-foreground">+ {sharingRequiresCloud && <span className="block font-medium">Required while Workflows sharing is on. Turn off sharing above to change it. Shared chats always redact all sensitive categories; the choices below apply to recordings.</span>}Local stays on-device — strongest privacy, slower on weakhardware. Cloud uses screenpipe's attestedconfidential-compute enclave — fast everywhere; your devicediff --git a/apps/screenpipe-app-tauri/components/workflows/workflow-sharing-controls.test.tsx b/apps/screenpipe-app-tauri/components/workflows/workflow-sharing-controls.test.tsxnew file mode 100644index 000000000..5993d61c9--- /dev/null+++ b/apps/screenpipe-app-tauri/components/workflows/workflow-sharing-controls.test.tsx@@ -0,0 +1,131 @@+// screenpipe — AI that knows everything you've seen, said, or heard+// https://screenpipe.com+import React from "react";+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+const f = vi.hoisted(() => ({ settings: {} as any, update: vi.fn(), token: "token", managed: false }));+vi.mock("@/lib/hooks/use-settings", () => ({ useSettings: () => ({ settings: f.settings, updateSettings: f.update }) }));+vi.mock("@/lib/hooks/use-managed-policy", () => ({ useManagedPolicy: () => ({ isManagedDeployment: f.managed }) }));+vi.mock("@/lib/utils/tauri", () => ({ commands: { getCloudToken: async () => f.token } }));+import { WorkflowSharingControls } from "./workflow-sharing-controls";+let remote: any;+let requests: Array<{ method: string; body: any }>;+let offline: boolean;+beforeEach(() => {+ f.settings = { user: { id: "internal-id" }, piiBackend: "local", workflowSharing: null };+ f.managed = false; f.token = "token";+ f.update.mockReset().mockImplementation(async (updates: any) => { f.settings = { ...f.settings, ...updates }; });+ remote = { accountId: "user_one", available: true, sharing: false, training: false, epoch: null, revision: 0, noticeVersion: "2026-09-21" };+ requests = []; offline = false;+ vi.stubGlobal("fetch", vi.fn(async (_url, init) => {+ if (offline) throw new Error("offline");+ const body = init.body ? JSON.parse(init.body) : null;+ requests.push({ method: init.method, body });+ if (init.method === "PUT") remote = { ...remote, ...body, epoch: `epoch-${++remote.revision}` };+ if (init.method === "DELETE") remote = { ...remote, sharing: false, training: false, epoch: "deleted" };+ return { ok: true, json: async () => ({ ...remote }) };+ }));+});+afterEach(() => { cleanup(); vi.unstubAllGlobals(); });+async function ready() {+ await waitFor(() => expect(screen.getByRole("switch")).toBeEnabled());+}+describe("sharing consent UI", () => {+ it("defaults off; enabling explicitly selects cloud without changing recording flags", async () => {+ render(<WorkflowSharingControls />); await ready();+ expect(screen.getByRole("switch")).not.toBeChecked();+ expect(requests.every(r => r.method === "GET")).toBe(true);+ fireEvent.click(screen.getByRole("switch"));+ await waitFor(() => expect(screen.getByRole("switch")).toBeChecked());+ expect(f.update).toHaveBeenCalledWith({ piiBackend: "tinfoil", workflowSharing: { accountId: "user_one", epoch: "epoch-1", enabledAt: expect.any(Number), priorBackend: "local" } });+ expect(requests.find(r => r.method === "PUT")!.body).toMatchObject({ sharing: true, training: false });+ expect(screen.getByRole("checkbox")).not.toBeChecked();+ });+ it("requires a separate training choice and restores the prior backend on off", async () => {+ render(<WorkflowSharingControls />); await ready();+ fireEvent.click(screen.getByRole("switch"));+ await waitFor(() => expect(screen.getByRole("checkbox")).toBeEnabled());+ fireEvent.click(screen.getByRole("checkbox"));+ await waitFor(() => expect(screen.getByRole("checkbox")).toBeChecked());+ expect(requests.filter(r => r.method === "PUT").at(-1)!.body.training).toBe(true);+ fireEvent.click(screen.getByRole("button", { name: "Turn off sharing" }));+ await waitFor(() => expect(f.settings.workflowSharing).toBeNull());+ expect(f.settings.piiBackend).toBe("local");+ });+ it("stops locally when the server is offline and states the remaining uncertainty", async () => {+ render(<WorkflowSharingControls />); await ready(); fireEvent.click(screen.getByRole("switch"));+ await waitFor(() => expect(screen.getByRole("switch")).toBeChecked());+ offline = true;+ fireEvent.click(screen.getByRole("button", { name: "Turn off sharing" }));+ await waitFor(() => expect(screen.getByRole("alert")).toHaveTextContent("Stopped on this device. Account changes are unconfirmed"));+ expect(f.settings.workflowSharing).toBeNull();+ });+ it("deletes only after the explicit second click, and stops sharing", async () => {+ render(<WorkflowSharingControls />); await ready();+ fireEvent.click(screen.getByRole("button", { name: "Delete shared chats" }));+ expect(requests.some(r => r.method === "DELETE")).toBe(false);+ fireEvent.click(screen.getByRole("button", { name: "Confirm deletion and stop sharing" }));+ await waitFor(() => expect(requests.some(r => r.method === "DELETE")).toBe(true));+ expect(f.settings.workflowSharing).toBeNull();+ });+ it("hides the optional entry control when rollout is unavailable", async () => {+ remote.available = false;+ render(<WorkflowSharingControls compact />);+ await waitFor(() => expect(requests.length).toBe(1));+ expect(screen.queryByRole("switch")).toBeNull();+ });+ it("does not enable sharing for managed deployments", async () => {+ f.managed = true; render(<WorkflowSharingControls />);+ await waitFor(() => expect(requests.length).toBe(1));+ expect(screen.getByRole("switch")).toBeDisabled();+ });+ it("keeps training unchecked and submits sharing only after the explicit prompt action", async () => {+ const done = vi.fn();+ render(<WorkflowSharingControls compact onDone={done} />);+ await waitFor(() => expect(screen.getByRole("button", { name: "Share chats" })).toBeEnabled());+ expect(screen.getByRole("checkbox")).not.toBeChecked();+ expect(screen.getByText("Optional. Never external providers’ models.")).toBeVisible();+ expect(requests.every(r => r.method === "GET")).toBe(true);+ fireEvent.click(screen.getByRole("button", { name: "Share chats" }));+ await waitFor(() => expect(done).toHaveBeenCalledOnce());+ expect(requests.find(r => r.method === "PUT")!.body).toMatchObject({ sharing: true, training: false });+ });+ it("submits separate first-party training consent only when the checkbox was selected", async () => {+ render(<WorkflowSharingControls compact />);+ await waitFor(() => expect(screen.getByRole("checkbox")).toBeEnabled());+ fireEvent.click(screen.getByRole("checkbox"));+ expect(requests.every(r => r.method === "GET")).toBe(true);+ fireEvent.click(screen.getByRole("button", { name: "Share chats" }));+ await waitFor(() => expect(requests.find(r => r.method === "PUT")!.body.training).toBe(true));+ });+ it("skips the sharing prompt without saving consent", async () => {+ const done = vi.fn();+ render(<WorkflowSharingControls compact onDone={done} />);+ fireEvent.click(screen.getByRole("button", { name: "Don’t share" }));+ expect(done).toHaveBeenCalledOnce();+ expect(f.update).not.toHaveBeenCalled();+ expect(requests.every(r => r.method === "GET")).toBe(true);+ });+ it("keeps the prompt open when saving fails", async () => {+ const done = vi.fn();+ render(<WorkflowSharingControls compact onDone={done} />);+ await waitFor(() => expect(screen.getByRole("button", { name: "Share chats" })).toBeEnabled());+ offline = true;+ fireEvent.click(screen.getByRole("button", { name: "Share chats" }));+ expect(await screen.findByRole("alert")).toHaveTextContent("Could not enable sharing");+ expect(done).not.toHaveBeenCalled();+ expect(f.update).not.toHaveBeenCalled();+ });++ it("clears an unsubmitted training choice when the signed-in account changes", async () => {+ const view = render(<WorkflowSharingControls compact />);+ await waitFor(() => expect(screen.getByRole("checkbox")).toBeEnabled());+ fireEvent.click(screen.getByRole("checkbox"));+ expect(screen.getByRole("checkbox")).toBeChecked();+ f.settings = { ...f.settings, user: { id: "different-account" } };+ view.rerender(<WorkflowSharingControls compact />);+ await waitFor(() => expect(screen.getByRole("checkbox")).not.toBeChecked());+ expect(requests.every(r => r.method === "GET")).toBe(true);+ });++});diff --git a/apps/screenpipe-app-tauri/components/workflows/workflow-sharing-controls.tsx b/apps/screenpipe-app-tauri/components/workflows/workflow-sharing-controls.tsxnew file mode 100644index 000000000..78e0ccf5e--- /dev/null+++ b/apps/screenpipe-app-tauri/components/workflows/workflow-sharing-controls.tsx@@ -0,0 +1,131 @@+// screenpipe — AI that knows everything you've seen, said, or heard+// https://screenpipe.com+"use client";+import { PROD_WEB_BASE, screenpipeWebUrl } from "@/lib/web-url";+import { useEffect, useRef, useState } from "react";+import { useSettings } from "@/lib/hooks/use-settings";+import { useManagedPolicy } from "@/lib/hooks/use-managed-policy";+import { commands } from "@/lib/utils/tauri";+import { Button } from "@/components/ui/button";+import { Loader2, MessageSquare, ShieldCheck } from "lucide-react";+import { Switch } from "@/components/ui/switch";+import { SHARING_NOTICE_VERSION, sharingRequest, trajectoryCollector, type SharingStatus } from "@/lib/trajectories/collector";++export function WorkflowSharingControls({ compact = false, onDone, onUnavailable, onBusyChange }: {+ compact?: boolean;+ onDone?: () => void;+ onUnavailable?: () => void;+ onBusyChange?: (busy: boolean) => void;+}) {+ const { settings, updateSettings } = useSettings();+ const { isManagedDeployment } = useManagedPolicy();+ const [status, setStatus] = useState<SharingStatus | null>(null);+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState("");+ const [confirmDelete, setConfirmDelete] = useState(false);+ const [reload, setReload] = useState(0);+ const [trainingChoice, setTrainingChoice] = useState(false);+ useEffect(() => { setTrainingChoice(false); }, [settings.user?.id]);+ useEffect(() => { onBusyChange?.(busy); return () => onBusyChange?.(false); }, [busy, onBusyChange]);+ const current = useRef(settings);+ current.current = settings;+ const mounted = useRef(true);+ useEffect(() => { mounted.current = true; return () => { mounted.current = false; }; }, []);+ useEffect(() => {+ let cancelled = false;+ setStatus(null);+ void sharingRequest("GET").then(value => {+ if (!cancelled) setStatus(value);+ }).catch(() => { if (!cancelled) setError(current => current || "Sharing is unavailable. Sign in or try again."); });+ return () => { cancelled = true; };+ }, [settings.user?.id, settings.workflowSharing?.epoch, reload, compact]);+ const local = settings.workflowSharing;+ const enabled = !!local && status?.sharing === true && status.accountId === local.accountId && status.epoch === local.epoch;+ const available = !!status?.available && !isManagedDeployment && status.noticeVersion === SHARING_NOTICE_VERSION;++ useEffect(() => {+ if (compact && status && !available && !local) onUnavailable?.();+ }, [compact, status, available, local, onUnavailable]);++ async function change(sharing: boolean, training: boolean, remove = false) {+ if (busy || (sharing && !available)) return;+ setBusy(true); setError("");+ const before = current.current;+ let stoppedLocally = false;+ try {+ const token = await commands.getCloudToken();+ if (!sharing) {+ trajectoryCollector.stop();+ // Persist refusal before making a fallible network request.+ await updateSettings({ workflowSharing: null,+ ...(before.workflowSharing ? { piiBackend: before.workflowSharing.priorBackend } : {}) });+ stoppedLocally = true;+ }+ if (!token) throw new Error("Sign in to update account sharing.");+ const result = await sharingRequest(remove ? "DELETE" : "PUT", remove ? undefined : {+ sharing, training, noticeVersion: SHARING_NOTICE_VERSION, revision: status?.revision ?? 0,+ }, token);+ if (!mounted.current || await commands.getCloudToken() !== token || current.current.user?.id !== before.user?.id) return;+ if (sharing) {+ if (!result.epoch || !result.sharing || result.accountId !== status?.accountId) throw new Error("Sharing could not be enabled.");+ await updateSettings({ piiBackend: "tinfoil", workflowSharing: {+ accountId: result.accountId, epoch: result.epoch, enabledAt: Date.now(),+ priorBackend: before.workflowSharing?.priorBackend ?? (before.piiBackend === "tinfoil" ? "tinfoil" : "local"),+ } });+ }+ setStatus(result); setConfirmDelete(false);+ if (compact && sharing) onDone?.();+ } catch {+ if (mounted.current) setError(sharing ? "Could not enable sharing. Try again." : !stoppedLocally ? "Could not save your choice. Sharing may still be on; try again." :+ "Stopped on this device. Account changes are unconfirmed; retry to stop other devices or delete shared chats.");+ } finally { if (mounted.current) setBusy(false); }+ }+ const trainingLabel = <span className="font-medium">Also train Screenpipe’s own models<span className="mt-1 block text-xs font-normal text-muted-foreground">Optional. Never external providers’ models.</span></span>;+ return <section id="workflow-sharing" className={compact ? "space-y-5 text-foreground" : "space-y-3 rounded-lg border p-4 text-foreground"}>+ {!compact && <div className="flex items-center justify-between gap-4">+ <div><label htmlFor="workflow-sharing-setting" className="text-sm font-medium">Help improve Workflows</label>+ <p className="text-xs text-muted-foreground">Share new Workflows chats to improve skills and evaluations.</p></div>+ <Switch id="workflow-sharing-setting" checked={enabled} disabled={busy || (!available && !local)} onCheckedChange={value => void change(value, false)} />+ </div>}+ {compact ? <div className="space-y-4">+ <div className="flex gap-3"><MessageSquare className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" aria-hidden="true" /><div>+ <p className="text-sm font-medium">Workflows chats only</p>+ <p className="mt-1 text-xs text-muted-foreground">No recordings, main Chat, or other apps’ chats. Replies may quote private context.</p>+ </div></div>+ <div className="flex gap-3"><ShieldCheck className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" aria-hidden="true" /><div>+ <p className="text-sm font-medium">Redacted before sharing</p>+ <p className="mt-1 text-xs text-muted-foreground">AI removes sensitive details in Tinfoil’s secure cloud. It can miss details.</p>+ </div></div>+ </div> : <>+ <p className="text-xs text-muted-foreground">Only chats inside Workflows. No raw recordings, main Chat conversations, or other apps’ chat history.</p>+ <p className="text-xs text-muted-foreground">AI redacts sensitive information in Tinfoil’s secure cloud before sharing. Redaction can miss details.</p>+ </>}+ <label className={`flex items-start gap-3 text-sm ${compact ? "rounded-lg border p-4 transition-colors focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 " + (trainingChoice ? "border-foreground/40 bg-foreground/[0.03]" : "border-border") : ""}`}>+ <input type="checkbox" className="mt-0.5 h-4 w-4 shrink-0 accent-foreground" checked={compact ? trainingChoice : enabled && status?.training === true} disabled={busy || (compact ? !available : !enabled)} onChange={event => compact ? setTrainingChoice(event.target.checked) : void change(true, event.target.checked)} />+ {trainingLabel}+ </label>+ {enabled && !compact && <a href="#workflow-cloud-redaction" className="block text-xs underline">Cloud redaction is on. View settings</a>}+ <details className="text-xs text-muted-foreground"><summary className="cursor-pointer rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground">Sharing details</summary>+ <p className="mt-2">Replies may quote your private context. Screenpipe keeps shared text for up to 30 days, plus the next hourly cleanup. Cloud redaction is required while sharing is on. Recording settings remain separate. You can stop sharing and delete shared copies in Privacy settings. Model training requires separate permission and an eligibility review; no training export is enabled in this version.</p>+ <a href={screenpipeWebUrl("/privacy", PROD_WEB_BASE)} target="_blank" rel="noreferrer" className="mt-2 inline-block underline">Privacy policy</a>+ </details>+ {!compact && <div className="flex flex-wrap gap-2">+ {!!local && <Button size="sm" variant="outline" disabled={busy} onClick={() => void change(false, false)}>Turn off sharing</Button>}+ <Button size="sm" variant="outline" disabled={busy || !settings.user?.id} onClick={() => confirmDelete ? void change(false, false, true) : setConfirmDelete(true)}>{confirmDelete ? "Confirm deletion and stop sharing" : "Delete shared chats"}</Button>+ {confirmDelete && <Button size="sm" variant="ghost" disabled={busy} onClick={() => setConfirmDelete(false)}>Cancel</Button>}+ {!available && <span className="text-xs text-muted-foreground">Sharing is not available for this account.</span>}+ {confirmDelete && <p className="w-full text-xs text-muted-foreground">Deletes shared copies for this account and stops sharing on all devices. Your local chats stay on this device.</p>}+ </div>}+ {compact && <>+ {!status && !error && <p role="status" className="text-xs text-muted-foreground">Checking sharing availability…</p>}+ <p className="text-xs text-muted-foreground">Stop sharing or delete shared chats in Privacy settings.</p>+ <div className="grid grid-cols-2 gap-3">+ <Button variant="outline" disabled={busy} onClick={onDone}>Don’t share</Button>+ <Button disabled={busy || !available} onClick={() => void change(true, trainingChoice)}>+ {busy && <Loader2 className="mr-2 h-4 w-4 animate-spin" aria-hidden="true" />}{busy ? "Saving…" : "Share chats"}+ </Button>+ </div>+ </>}+ {error && <p role="alert" className="text-xs text-destructive">{error} <button className="underline" onClick={() => { setError(""); setReload(value => value + 1); }}>Refresh</button></p>}+ </section>;+}diff --git a/apps/screenpipe-app-tauri/components/workflows/workflow-tasks-prompt.test.tsx b/apps/screenpipe-app-tauri/components/workflows/workflow-tasks-prompt.test.tsxindex 9c6f498ea..87a6b5120 100644--- a/apps/screenpipe-app-tauri/components/workflows/workflow-tasks-prompt.test.tsx+++ b/apps/screenpipe-app-tauri/components/workflows/workflow-tasks-prompt.test.tsx@@ -2,9 +2,17 @@// https://screenpipe.comimport React from "react";import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";-import { describe, expect, it, vi } from "vitest";+import { beforeEach, describe, expect, it, vi } from "vitest";import { WorkflowTasksPrompt } from "./workflow-tasks-prompt";+const f = vi.hoisted(() => ({ settings: {} as any, update: vi.fn() }));+vi.mock("@/lib/hooks/use-settings", () => ({ useSettings: () => ({ settings: f.settings, updateSettings: f.update }) }));+vi.mock("./workflow-sharing-controls", () => ({ WorkflowSharingControls: ({ onDone }: { onDone: () => void }) => <div data-testid="sharing-controls"><button onClick={onDone}>Not now</button></div> }));+beforeEach(() => {+ f.settings = { user: { id: "fixture-user" }, workflowSharing: null };+ f.update.mockReset().mockImplementation(async patch => { f.settings = { ...f.settings, ...patch }; });+});+const setup = { enabled: false, title: "Update my workflows", schedule: "every 24h" };function service(enabled = false) {return { load: vi.fn().mockResolvedValue({ ...setup, enabled }), enable: vi.fn().mockResolvedValue(undefined) };@@ -20,14 +28,20 @@ describe("workflow task opt-in", () => {it("shows the task on entry, allows dismissal, and checks again on the next switch", async () => {const tasks = service();const view = render(<WorkflowTasksPrompt active tasks={tasks} />);- expect(await screen.findByText("every 24h")).toBeVisible();+ expect(await screen.findByText(/every 24h/)).toBeVisible();+ fireEvent.click(screen.getByText("How daily updates work"));expect(screen.getByText(/Chat → Scheduled tasks/)).toBeVisible();fireEvent.click(screen.getByRole("button", { name: "Not now" }));- expect(screen.queryByRole("dialog")).not.toBeInTheDocument();+ expect(screen.getByTestId("sharing-controls")).toBeVisible();expect(tasks.enable).not.toHaveBeenCalled();+ fireEvent.click(screen.getByRole("button", { name: "Not now" }));+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();+ await waitFor(() => expect(f.settings.workflowSharingPromptSeen).toEqual({ "fixture-user": "2026-09-21" }));view.rerender(<WorkflowTasksPrompt active={false} tasks={tasks} />);view.rerender(<WorkflowTasksPrompt active tasks={tasks} />);expect(await screen.findByRole("dialog")).toBeVisible();+ fireEvent.click(screen.getByRole("button", { name: "Not now" }));+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();});it("does not prompt or mutate an already enabled task", async () => {const tasks = service(true);@@ -36,36 +50,56 @@ describe("workflow task opt-in", () => {expect(screen.queryByRole("dialog")).not.toBeInTheDocument();expect(tasks.enable).not.toHaveBeenCalled();});- it("enables once after confirmation and closes only on success", async () => {+ it("enables once then offers sharing only on success", async () => {const tasks = service();let finish!: () => void;tasks.enable.mockImplementation(() => new Promise<void>(resolve => { finish = resolve; }));render(<WorkflowTasksPrompt active tasks={tasks} />);- const button = await screen.findByRole("button", { name: "Enable tasks" });+ expect(screen.queryByTestId("sharing-controls")).not.toBeInTheDocument();+ const button = await screen.findByRole("button", { name: "Enable daily updates" });fireEvent.click(button);fireEvent.click(button);expect(tasks.enable).toHaveBeenCalledOnce();expect(screen.getByRole("button", { name: "Enabling…" })).toBeDisabled();finish();- await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());+ await waitFor(() => expect(screen.getByTestId("sharing-controls")).toBeVisible());});it("keeps an enable failure recoverable", async () => {const tasks = service();tasks.enable.mockRejectedValueOnce(new Error("offline"));render(<WorkflowTasksPrompt active tasks={tasks} />);- fireEvent.click(await screen.findByRole("button", { name: "Enable tasks" }));+ fireEvent.click(await screen.findByRole("button", { name: "Enable daily updates" }));expect(await screen.findByRole("alert")).toHaveTextContent("Could not enable");- fireEvent.click(screen.getByRole("button", { name: "Enable tasks" }));- await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());+ fireEvent.click(screen.getByRole("button", { name: "Enable daily updates" }));+ await waitFor(() => expect(screen.getByTestId("sharing-controls")).toBeVisible());expect(tasks.enable).toHaveBeenCalledTimes(2);});+ it("skips sharing for signed-out users", async () => {+ f.settings.user = null;+ render(<WorkflowTasksPrompt active tasks={service()} />);+ fireEvent.click(await screen.findByRole("button", { name: "Not now" }));+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();+ expect(f.update).not.toHaveBeenCalled();+ });+ it("does not ask again when sharing is already enabled", async () => {+ f.settings.workflowSharing = { epoch: "existing" };+ render(<WorkflowTasksPrompt active tasks={service()} />);+ fireEvent.click(await screen.findByRole("button", { name: "Not now" }));+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();+ });+ it("does not reuse another account's dismissal", async () => {+ f.settings.workflowSharingPromptSeen = { "different-user": "2026-09-21" };+ render(<WorkflowTasksPrompt active tasks={service()} />);+ fireEvent.click(await screen.findByRole("button", { name: "Not now" }));+ expect(screen.getByTestId("sharing-controls")).toBeVisible();+ });it("retries recorder startup quietly without opening a false consent dialog", async () => {vi.useFakeTimers();const tasks = service(); tasks.load.mockRejectedValueOnce(new Error("offline"));render(<WorkflowTasksPrompt active tasks={tasks} />);await act(async () => { await vi.advanceTimersByTimeAsync(1600); });expect(tasks.load).toHaveBeenCalledTimes(2);- expect(screen.getByRole("button", {name:"Enable tasks"})).toBeVisible();+ expect(screen.getByRole("button", {name:"Enable daily updates"})).toBeVisible();vi.useRealTimers();});});diff --git a/apps/screenpipe-app-tauri/components/workflows/workflow-tasks-prompt.tsx b/apps/screenpipe-app-tauri/components/workflows/workflow-tasks-prompt.tsxindex f562de17b..885001a2a 100644--- a/apps/screenpipe-app-tauri/components/workflows/workflow-tasks-prompt.tsx+++ b/apps/screenpipe-app-tauri/components/workflows/workflow-tasks-prompt.tsx@@ -2,7 +2,10 @@// https://screenpipe.com"use client";-import { useEffect, useRef, useState } from "react";+import { WorkflowSharingControls } from "./workflow-sharing-controls";+import { useCallback, useEffect, useRef, useState, type CSSProperties } from "react";+import { useSettings } from "@/lib/hooks/use-settings";+import { SHARING_NOTICE_VERSION } from "@/lib/trajectories/collector";import { Clock3, Loader2 } from "lucide-react";import { Button } from "@/components/ui/button";import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";@@ -18,6 +21,11 @@ export function WorkflowTasksPrompt({ active, tasks = desktopTasks }: {}) {const ui = useGT();+ const { settings, updateSettings } = useSettings();+ const current = useRef(settings);+ current.current = settings;+ const [step, setStep] = useState<"tasks" | "sharing">("tasks");+ const title = useRef<HTMLHeadingElement>(null);const [open, setOpen] = useState(false);const [setup, setSetup] = useState<WorkflowTaskSetup | null>(null);const [error, setError] = useState("");@@ -25,10 +33,25 @@ export function WorkflowTasksPrompt({ active, tasks = desktopTasks }: {const [retry, setRetry] = useState(0);const enabling = useRef(false);+ const close = useCallback(() => setOpen(false), []);+ const finishSharing = useCallback(() => {+ const account = current.current.user?.id;+ if (account) void updateSettings({ workflowSharingPromptSeen: { ...current.current.workflowSharingPromptSeen, [account]: SHARING_NOTICE_VERSION } }).catch(() => {});+ setOpen(false);+ }, [updateSettings]);+ function nextStep() {+ const value = current.current;+ if (value.user?.id && !value.workflowSharing && value.workflowSharingPromptSeen?.[value.user.id] !== SHARING_NOTICE_VERSION) {+ setError(""); setStep("sharing");+ } else setOpen(false);+ }+ useEffect(() => { if (open) title.current?.focus(); }, [step, open]);+useEffect(() => {let cancelled = false;setOpen(false);setSetup(null);+ setStep("tasks");setError("");let timer: ReturnType<typeof setTimeout> | undefined;let attempts = 0;@@ -57,7 +80,7 @@ export function WorkflowTasksPrompt({ active, tasks = desktopTasks }: {setError("");try {await tasks.enable();- setOpen(false);+ nextStep();} catch {setError(ui("Could not enable all tasks. Please try again."));} finally {@@ -67,24 +90,40 @@ export function WorkflowTasksPrompt({ active, tasks = desktopTasks }: {}if (active && error && !setup) return <div role="status" className="mx-6 mt-4 flex items-center justify-between gap-3 rounded-lg border p-3 text-sm"><span>{error}</span><Button variant="outline" onClick={() => setRetry(value => value + 1)}>Try again</Button></div>;- return <Dialog open={active && open} onOpenChange={value => { if (!enabling.current) setOpen(value); }}>- <DialogContent style={{ background: "#fff", color: "#171815", fontFamily: "Inter, -apple-system, BlinkMacSystemFont, sans-serif" }} className="max-w-md" overlayClassName="bg-black/30" hideCloseButton={busy}>- <DialogHeader>- <DialogTitle style={{ fontFamily: "inherit", letterSpacing: 0 }} className="font-sans text-xl normal-case">Keep your workflows up to date?</DialogTitle>- <DialogDescription style={{ color: "#73766d" }}>Enable four agents to discover workflows, investigate evidence, review drafts, and maintain accuracy.</DialogDescription>+ return <Dialog open={active && open} onOpenChange={value => {+ if (enabling.current || busy) return;+ if (!value && step === "sharing") finishSharing(); else setOpen(value);+ }}>+ <DialogContent onOpenAutoFocus={event => { event.preventDefault(); title.current?.focus(); }} style={{+ "--foreground": "0 0% 9%", "--background": "0 0% 100%", "--muted-foreground": "80 4% 42%",+ "--border": "70 10% 85%", "--primary": "0 0% 9%", "--primary-foreground": "0 0% 100%",+ "--accent": "70 10% 95%", "--accent-foreground": "0 0% 9%",+ colorScheme: "light", background: "#fff", color: "#171815", fontFamily: "Inter, -apple-system, BlinkMacSystemFont, sans-serif",+ } as CSSProperties} className="max-w-md [&_button]:normal-case [&_button]:tracking-normal [&_button]:font-[inherit]" overlayClassName="bg-black/30" hideCloseButton={busy}>+ <DialogHeader className="text-left">+ <DialogTitle ref={title} tabIndex={-1} style={{ fontFamily: "inherit", letterSpacing: 0 }} className="text-xl normal-case outline-none">+ {step === "tasks" ? "Keep your workflows up to date?" : "Help improve Workflows?"}+ </DialogTitle>+ <DialogDescription className="text-muted-foreground">+ {step === "tasks" ? "Discover workflows and keep them accurate with daily updates." : "Share new Workflows chats to improve skills and evaluations."}+ </DialogDescription></DialogHeader>- {setup && <div style={{ borderColor: "#dedfd8" }} className="flex items-center gap-3 rounded-lg border border-border p-4">- <Clock3 className="h-4 w-4 shrink-0 text-muted-foreground" aria-hidden="true" />- <div className="min-w-0"><p className="text-sm font-medium">{setup.title}</p><p className="text-xs text-muted-foreground">{setup.schedule}</p></div>- </div>}- <p style={{ color: "#73766d" }} className="text-sm text-muted-foreground">Uses your AI allowance and sends selected captured text and screenshots to Screenpipe’s AI provider. Recording exclusions apply; personal content may still be included.</p>- <p style={{ color: "#73766d" }} className="text-sm text-muted-foreground">Runs daily and resumes dependent work in both Chat and Workflows while Screenpipe is open. Turn it off anytime in <span style={{ color: "#171815" }} className="font-medium text-foreground">Chat → Scheduled tasks</span>.</p>- {error && <p role="alert" className="text-sm text-destructive">{error}</p>}- <DialogFooter className="gap-2 sm:gap-0">- <Button style={{ background: "#fff", borderColor: "#dedfd8", color: "#171815", fontFamily: "inherit", textTransform: "none", letterSpacing: 0 }} variant="outline" disabled={busy} onClick={() => setOpen(false)}>Not now</Button>- {setup ? <Button style={{ background: "#171815", color: "#fff", fontFamily: "inherit", textTransform: "none", letterSpacing: 0 }} disabled={busy} onClick={enable}>{busy && <Loader2 className="mr-2 h-4 w-4 animate-spin" />} {busy ? ui("Enabling…") : ui("Enable tasks")}</Button>- : <Button onClick={() => setRetry(value => value + 1)}>Try again</Button>}- </DialogFooter>+ {step === "sharing" ? <WorkflowSharingControls compact onDone={finishSharing} onUnavailable={close} onBusyChange={setBusy} /> : <>+ {setup && <div className="flex items-center gap-3 rounded-lg border p-4">+ <Clock3 className="h-4 w-4 shrink-0 text-muted-foreground" aria-hidden="true" />+ <div className="min-w-0"><p className="text-sm font-medium">{setup.title}</p><p className="text-xs text-muted-foreground">{setup.schedule} · While Screenpipe is open</p></div>+ </div>}+ <p className="text-xs text-muted-foreground">Uses your AI allowance. Selected screen text and screenshots go to Screenpipe’s AI provider. Recording exclusions apply; personal content may be included.</p>+ <details className="text-xs text-muted-foreground"><summary className="cursor-pointer rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground">How daily updates work</summary>+ <p className="mt-2">Four agents discover workflows, investigate evidence, review drafts, and maintain accuracy. Dependent tasks resume in both Chat and Workflows.</p>+ <p className="mt-2">Turn updates off in <span className="font-medium text-foreground">Chat → Scheduled tasks</span>.</p>+ </details>+ {error && <p role="alert" className="text-sm text-destructive">{error}</p>}+ <DialogFooter className="gap-2 sm:gap-0">+ <Button variant="outline" disabled={busy} onClick={nextStep}>Not now</Button>+ <Button disabled={busy || !setup} onClick={enable}>{busy && <Loader2 className="mr-2 h-4 w-4 animate-spin" aria-hidden="true" />} {busy ? ui("Enabling…") : ui("Enable daily updates")}</Button>+ </DialogFooter>+ </>}</DialogContent></Dialog>;}diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsxindex a5906a3d6..7ebb03137 100644--- a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx+++ b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx@@ -295,6 +295,9 @@ export interface ChatHistoryStore {// Extend SettingsStore with fields added before Rust types are regeneratedexport type Settings = SettingsStore & {+ /** Explicit consent on this device. Content is never stored in this field. */+ workflowSharingPromptSeen?: Record<string, string>;+ workflowSharing?: { accountId: string; epoch: string; enabledAt: number; priorBackend: "local" | "tinfoil" } | null;/** Enable account data sync for this device. Default false. */dataSyncEnabled?: boolean;/** Friendly name used to partition this device's synced data. */@@ -1432,6 +1435,9 @@ function createSettingsStore() {const store = await getStore();const current = await get();const managedValues = await activeManagedValues(current);+ if (current.workflowSharing && value.workflowSharing !== null && value.piiBackend !== undefined && value.piiBackend !== "tinfoil") {+ throw new Error("Turn off Workflows sharing before changing cloud redaction.");+ }let newSettings = { ...current, ...value } as Settings;if ("user" in value) {// On logout / Pro→non-Pro transition, clear the V2 marker so a future@@ -1861,6 +1867,10 @@ export const SettingsProvider: React.FC<{ children: React.ReactNode }> = ({ chil}, [settings.fontSize]);const updateSettings = async (updates: Partial<Settings>) => {+ if (settingsRef.current.workflowSharing && updates.workflowSharing !== null &&+ updates.piiBackend !== undefined && updates.piiBackend !== "tinfoil") {+ throw new Error("Turn off Workflows sharing before changing cloud redaction.");+ }assertValidAiPresetUpdate(updates);const updateGeneration = ++settingsUpdateGenerationRef.current;const settingsBeforeUpdate = settingsRef.current;diff --git a/apps/screenpipe-app-tauri/lib/trajectories/collector.test.ts b/apps/screenpipe-app-tauri/lib/trajectories/collector.test.tsnew file mode 100644index 000000000..f94cd1d90--- /dev/null+++ b/apps/screenpipe-app-tauri/lib/trajectories/collector.test.ts@@ -0,0 +1,73 @@+// screenpipe — AI that knows everything you've seen, said, or heard+// https://screenpipe.com+import { describe, it, expect, vi } from "vitest";+import { createTrajectoryCollector, type LocalSharing, type SharingStatus } from "./collector";+function fixture() {+ let local: LocalSharing | null = { accountId: "user_one", epoch: "epoch-one", enabledAt: 0, priorBackend: "local" };+ let token: string | null = "token-one";+ const status: SharingStatus = { accountId: "user_one", epoch: "epoch-one", available: true, sharing: true, training: false, revision: 1, noticeVersion: "2026-09-21" };+ const request = vi.fn(async (_method: string, _body?: unknown, _token?: string, _signal?: AbortSignal) => status);+ const redact = vi.fn(async (_text: string) => "[REDACTED]");+ const collector = createTrajectoryCollector({ local: async () => local, token: async () => token, request, redact });+ return { collector, request, redact, status, setLocal: (value: LocalSharing | null) => { local = value; }, setToken: (value: string | null) => { token = value; } };+}+describe("Trajectory collection boundary", () => {+ it("makes no network or redaction calls without a local opt-in", async () => {+ const f = fixture(); f.setLocal(null);+ await f.collector.complete(await f.collector.begin(), "private question", "private answer");+ expect(f.request).not.toHaveBeenCalled(); expect(f.redact).not.toHaveBeenCalled();+ });+ it("only uploads strict-redacted question and answer after checking current consent", async () => {+ const f = fixture(); const ticket = await f.collector.begin();+ await f.collector.complete(ticket, "private question", "private answer");+ expect(f.request.mock.calls[0][0]).toBe("GET");+ expect(f.request).toHaveBeenLastCalledWith("POST", {+ id: ticket!.id, epoch: "epoch-one", source: "workflows-assistant", redaction: "tinfoil-strict-v1",+ question: "[REDACTED]", answer: "[REDACTED]",+ }, "token-one", expect.any(AbortSignal));+ expect(JSON.stringify(f.request.mock.calls)).not.toContain("private question");+ });+ it.each(["available", "sharing"] as const)("fails closed when server %s is false", async key => {+ const f = fixture(); f.status[key] = false;+ await f.collector.complete(await f.collector.begin(), "question", "answer");+ expect(f.redact).not.toHaveBeenCalled(); expect(f.request).toHaveBeenCalledTimes(1);+ });+ it.each(["accountId", "epoch", "noticeVersion"] as const)("refuses a stale %s", async key => {+ const f = fixture(); f.status[key] = "changed";+ await f.collector.complete(await f.collector.begin(), "question", "answer");+ expect(f.redact).not.toHaveBeenCalled();+ });+ it("rejects consent granted while the initial store read was pending", async () => {+ vi.spyOn(Date, "now").mockReturnValueOnce(10);+ const f = fixture(); f.setLocal({ accountId: "user_one", epoch: "new", enabledAt: 11, priorBackend: "local" });+ expect(await f.collector.begin()).toBeNull();+ vi.restoreAllMocks();+ });+ it("does not retroactively include turns that began before opt-in", async () => {+ const f = fixture(); f.setLocal(null); const ticket = await f.collector.begin();+ f.setLocal({ accountId: "user_one", epoch: "new", enabledAt: 0, priorBackend: "local" });+ await f.collector.complete(ticket, "question", "answer"); expect(f.request).not.toHaveBeenCalled();+ });+ it("does not upload when either redaction fails", async () => {+ const f = fixture(); f.redact.mockResolvedValueOnce("safe").mockRejectedValueOnce(new Error("private failure"));+ await f.collector.complete(await f.collector.begin(), "question", "answer");+ expect(f.request).toHaveBeenCalledTimes(1);+ });+ it.each(["revoke", "logout", "stop", "reoptin"])("stops an in-flight turn on %s", async action => {+ const f = fixture(); const ticket = await f.collector.begin();+ f.redact.mockImplementationOnce(async () => {+ if (action === "revoke") f.setLocal(null);+ if (action === "logout") f.setToken(null);+ if (action === "stop") f.collector.stop();+ if (action === "reoptin") f.setLocal({ ...ticket!.local, epoch: "new-epoch" });+ return "safe";+ });+ await f.collector.complete(ticket, "question", "answer");+ expect(f.request).toHaveBeenCalledTimes(1); expect(f.redact).toHaveBeenCalledTimes(1);+ });+ it("drops oversized UTF-8 or empty messages without truncating identifiers", async () => {+ const f = fixture(); const ticket = await f.collector.begin();+ await f.collector.complete(ticket, "💬".repeat(500), "answer");+ await f.collector.complete(ticket, "question", " "); expect(f.request).not.toHaveBeenCalled();+ });+});diff --git a/apps/screenpipe-app-tauri/lib/trajectories/collector.ts b/apps/screenpipe-app-tauri/lib/trajectories/collector.tsnew file mode 100644index 000000000..2ed40f5cd--- /dev/null+++ b/apps/screenpipe-app-tauri/lib/trajectories/collector.ts@@ -0,0 +1,106 @@+// screenpipe — AI that knows everything you've seen, said, or heard+// https://screenpipe.com+import { PROD_WEB_BASE, screenpipeWebUrl } from "@/lib/web-url";+import { commands } from "@/lib/utils/tauri";++export const SHARING_NOTICE_VERSION = "2026-09-21";+const endpoint = screenpipeWebUrl("/api/trajectories", PROD_WEB_BASE);+export type LocalSharing = { accountId: string; epoch: string; enabledAt: number; priorBackend: "local" | "tinfoil" };+export type SharingStatus = {+ accountId: string; available: boolean; sharing: boolean; training: boolean;+ epoch: string | null; revision: number; noticeVersion: string;+};+export async function sharingRequest(method: string, body?: unknown, token?: string, signal?: AbortSignal): Promise<SharingStatus> {+ const bearer = token ?? await commands.getCloudToken();+ if (!bearer) throw new Error("Sign in to manage sharing.");+ const controller = new AbortController();+ const abort = () => controller.abort();+ signal?.addEventListener("abort", abort, { once: true });+ if (signal?.aborted) controller.abort();+ const timer = setTimeout(abort, 10000);+ try {+ const response = await fetch(endpoint, {+ method, headers: { Authorization: `Bearer ${bearer}`, "Content-Type": "application/json" },+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),+ signal: controller.signal, cache: "no-store", credentials: "omit",+ });+ if (!response.ok) throw new Error("Could not update sharing. Refresh and try again.");+ return await response.json();+ } finally { clearTimeout(timer); signal?.removeEventListener("abort", abort); }+}++export type TrajectoryTicket = { local: LocalSharing; token: string; id: string };+type Ports = {+ local: () => Promise<LocalSharing | null>;+ token: () => Promise<string | null>;+ request: typeof sharingRequest;+ redact: (text: string) => Promise<string>;+};+// No raw-content queue, disk writes, retries, telemetry, or error logging.+// Ports let tests prove that revoked/failed turns never cross the upload boundary.+export function createTrajectoryCollector(ports: Ports) {+ const pending = new Set<AbortController>();+ const current = async (ticket: TrajectoryTicket) => {+ const local = await ports.local();+ return local?.epoch === ticket.local.epoch && local.accountId === ticket.local.accountId &&+ await ports.token() === ticket.token;+ };+ return {+ stop() { for (const controller of pending) controller.abort(); },+ async begin(): Promise<TrajectoryTicket | null> {+ const startedAt = Date.now();+ let timer: ReturnType<typeof setTimeout> | undefined;+ try {+ return await Promise.race([+ (async () => {+ const local = await ports.local();+ if (!local || !Number.isFinite(local.enabledAt) || local.enabledAt >= startedAt) return null;+ const token = await ports.token();+ return token ? { local, token, id: crypto.randomUUID() } : null;+ })(),+ new Promise<null>(resolve => { timer = setTimeout(() => resolve(null), 1000); }),+ ]);+ } catch { return null; }+ finally { clearTimeout(timer); }+ },+ async complete(ticket: TrajectoryTicket | null, question: string, answer: string): Promise<void> {+ if (!ticket || pending.size >= 2 || !question.trim() || !answer.trim() ||+ new TextEncoder().encode(question).length > 1800 || new TextEncoder().encode(answer).length > 1800) return;+ const controller = new AbortController();+ pending.add(controller);+ const timer = setTimeout(() => controller.abort(), 60000);+ try {+ if (!await current(ticket) || controller.signal.aborted) return;+ const consent = await ports.request("GET", undefined, ticket.token, controller.signal);+ if (!consent.available || !consent.sharing || consent.accountId !== ticket.local.accountId ||+ consent.epoch !== ticket.local.epoch || consent.noticeVersion !== SHARING_NOTICE_VERSION ||+ controller.signal.aborted || !await current(ticket)) return;+ const redactedQuestion = await ports.redact(question);+ if (controller.signal.aborted || !await current(ticket)) return;+ const redactedAnswer = await ports.redact(answer);+ if (controller.signal.aborted || !await current(ticket)) return;+ await ports.request("POST", {+ id: ticket.id, epoch: ticket.local.epoch, source: "workflows-assistant",+ redaction: "tinfoil-strict-v1", question: redactedQuestion, answer: redactedAnswer,+ }, ticket.token, controller.signal);+ } catch { /* Drop the turn. Trajectory collection failure must not affect the chat. */ }+ finally { clearTimeout(timer); pending.delete(controller); }+ },+ };+}+export const trajectoryCollector = createTrajectoryCollector({+ async local() {+ const { getStore } = await import("@/lib/hooks/use-settings");+ const settings = await (await getStore()).get<import("@/lib/hooks/use-settings").Settings>("settings");+ // Managed deployments never contribute, even if an old local preference exists.+ if (settings?.enterpriseManagedSettings || settings?.piiBackend !== "tinfoil") return null;+ return settings?.workflowSharing ?? null;+ },+ token: () => commands.getCloudToken(),+ request: sharingRequest,+ async redact(text) {+ const result = await commands.redactWorkflowContribution(text);+ if (result.status === "error") throw new Error("Redaction unavailable");+ return result.data;+ },+});diff --git a/apps/screenpipe-app-tauri/lib/utils/tauri.ts b/apps/screenpipe-app-tauri/lib/utils/tauri.tsindex b8799a913..08c9cefb9 100644--- a/apps/screenpipe-app-tauri/lib/utils/tauri.ts+++ b/apps/screenpipe-app-tauri/lib/utils/tauri.ts@@ -2072,6 +2072,18 @@ async redactPiiForFeedback(text: string, settingsJson: string) : Promise<Result<else return { status: "error", error: e as any };}},+/**+ * Strict contribution redaction. No regex-only fallback, no content-bearing+ * errors, no capture settings, and no chunk boundaries through identifiers.+ */+async redactWorkflowContribution(text: string) : Promise<Result<string, string>> {+ try {+ return { status: "ok", data: await TAURI_INVOKE("redact_workflow_contribution", { text }) };+} catch (e) {+ if(e instanceof Error) throw e;+ else return { status: "error", error: e as any };+}+},/*** Tauri command: re-encrypt store.bin after frontend saves.*diff --git a/apps/screenpipe-app-tauri/lib/workflows/assistant.test.ts b/apps/screenpipe-app-tauri/lib/workflows/assistant.test.tsindex 08d068570..11acc9bf6 100644--- a/apps/screenpipe-app-tauri/lib/workflows/assistant.test.ts+++ b/apps/screenpipe-app-tauri/lib/workflows/assistant.test.ts@@ -1,9 +1,12 @@// screenpipe — AI that knows everything you've seen, said, or heard// https://screenpipe.com+import { trajectoryCollector } from "@/lib/trajectories/collector";import { beforeEach, describe, expect, it, vi } from "vitest";import type { AgentEventEnvelope } from "@/lib/events/types";+vi.mock("@/lib/trajectories/collector", () => ({ trajectoryCollector: { begin: vi.fn(async () => null), complete: vi.fn() } }));+const mocks = vi.hoisted(() => ({handlers: new Map<string, (e: AgentEventEnvelope) => void>(),start: vi.fn(), prompt: vi.fn(), stop: vi.fn(), save: vi.fn(), token: vi.fn(),@@ -44,6 +47,7 @@ describe("workflow assistant agent transport", () => {expect(ASSISTANT_TOOLS).toContain("bash");expect(ASSISTANT_TOOLS).not.toContain("search-content");expect(progress).toHaveBeenCalledWith({ text: "", activity: "searching" });+ expect(trajectoryCollector.complete).toHaveBeenCalledWith(null, "Find yesterday’s review", "Found a moment.");expect(mocks.stop).toHaveBeenCalled(); expect(mocks.handlers.size).toBe(0);});it("still rejects tools outside this run's configured scope", async () => {@@ -53,6 +57,7 @@ describe("workflow assistant agent transport", () => {});await expect(desktopAssistant.ask({ question: "Find yesterday", context: null, history: [], signal: new AbortController().signal, onProgress: vi.fn() })).rejects.toThrow("unexpected tool");expect(mocks.stop).toHaveBeenCalled();+ expect(trajectoryCollector.complete).not.toHaveBeenCalled();});it("authenticates Context tool calls with the current account on every run", async () => {mocks.token.mockResolvedValueOnce("first-account-token").mockResolvedValueOnce("refreshed-account-token");diff --git a/apps/screenpipe-app-tauri/lib/workflows/assistant.ts b/apps/screenpipe-app-tauri/lib/workflows/assistant.tsindex f91c62518..bb893809e 100644--- a/apps/screenpipe-app-tauri/lib/workflows/assistant.ts+++ b/apps/screenpipe-app-tauri/lib/workflows/assistant.ts@@ -1,6 +1,7 @@// screenpipe — AI that knows everything you've seen, said, or heard// https://screenpipe.com+import { trajectoryCollector } from "@/lib/trajectories/collector";import type { WorkflowsAssistantPlatform } from "@screenpipe/workflows-ui";import { type PiProviderConfig } from "@/lib/utils/tauri";import { loadAssistantFromDisk, saveAssistantToDisk } from "./disk-storage";@@ -26,6 +27,7 @@ export const desktopAssistant: WorkflowsAssistantPlatform = {load: loadAssistantFromDisk,save: saveAssistantToDisk,async ask({ question, context, history, signal, onProgress }) {+ const trajectory = trajectoryCollector.begin();const feedback = context?.purpose === "feedback" && context.workflow?.id && history.length > 0;if (feedback) {const latest = (await loadScheduledCatalog())?.analysis.workflows.find(w => w.id === context!.workflow!.id);@@ -47,8 +49,10 @@ export const desktopAssistant: WorkflowsAssistantPlatform = {const updated = await applyWorkflowFeedback(context.workflow, learning, changes);onProgress({ text, activity: "writing", workflow: updated });window.dispatchEvent(new CustomEvent("workflows:refined", { detail: updated }));+ void trajectory.then(ticket => { if (!signal.aborted) return trajectoryCollector.complete(ticket, question, text); });return `${text}\n\n${Object.keys(changes).length ? "Workflow updated. " : ""}Feedback remembered for future updates and skill drafts.`;}+ void trajectory.then(ticket => { if (!signal.aborted) return trajectoryCollector.complete(ticket, question, text); });return text;},};diff --git a/apps/screenpipe-app-tauri/src-tauri/src/feedback_redact.rs b/apps/screenpipe-app-tauri/src-tauri/src/feedback_redact.rsindex 362fc3d3a..58fd94aed 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/feedback_redact.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/feedback_redact.rs@@ -452,3 +452,174 @@ mod tests {assert!(redacted.contains("request 42"));}}++/// Strict contribution redaction. No regex-only fallback, no content-bearing+/// errors, no capture settings, and no chunk boundaries through identifiers.+#[tauri::command]+#[specta::specta]+pub async fn redact_workflow_contribution(text: String) -> Result<String, String> {+ if text.trim().is_empty() || text.len() > 1800 {+ return Err("Message is outside the contribution size limit".into());+ }+ let redactor = TinfoilRedactor::new(TinfoilConfig {+ // Pin the production attestation identity; do not honor local overrides.+ enclave: Some("pii.screenpipe.containers.tinfoil.dev".into()),+ repo: Some("screenpipe/privacy-filter".into()),+ labels: [+ "person",+ "email",+ "phone",+ "address",+ "url",+ "company",+ "repo",+ "handle",+ "channel",+ "id",+ "date",+ "secret",+ "sensitive",+ ]+ .iter()+ .map(|label| (*label).to_owned())+ .collect(),+ timeout: Some(Duration::from_secs(20)),+ ..Default::default()+ });+ strict_workflow_redaction(&redactor, &text, Duration::from_secs(25)).await+}++async fn strict_workflow_redaction(+ redactor: &dyn Redactor,+ text: &str,+ budget: Duration,+) -> Result<String, String> {+ // The common adapter bypasses very short input. A fixed context prefix+ // ensures even a short name is submitted to the enclave for classification.+ let input = format!("Workflow message:\n{text}");+ let output = tokio::time::timeout(budget, redactor.redact(&input))+ .await+ .map_err(|_| "Redaction timed out".to_string())?+ .map_err(|_| "Redaction unavailable".to_string())?;+ let redacted = output+ .redacted+ .strip_prefix("Workflow message:\n")+ .unwrap_or(&output.redacted)+ .trim();+ if redacted.is_empty() || redacted.len() > 8000 {+ return Err("Invalid redaction result".into());+ }+ Ok(redacted.to_owned())+}++#[cfg(test)]+mod workflow_contribution_tests {+ use super::*;+ use async_trait::async_trait;+ use screenpipe_redact::{RedactError, RedactionOutput};+ struct FakeRedactor(&'static str);+ #[async_trait]+ impl Redactor for FakeRedactor {+ fn name(&self) -> &str {+ "fake"+ }+ fn version(&self) -> u32 {+ 1+ }+ async fn redact_batch(+ &self,+ texts: &[String],+ ) -> Result<Vec<RedactionOutput>, RedactError> {+ assert!(texts[0].starts_with("Workflow message:\n"));+ assert!(texts[0].chars().count() >= 8);+ if self.0 == "fail" {+ return Err(RedactError::Runtime("private input in error".into()));+ }+ if self.0 == "hang" {+ return std::future::pending().await;+ }+ Ok(texts+ .iter()+ .map(|text| RedactionOutput {+ input: text.clone(),+ redacted: self.0.into(),+ spans: vec![],+ })+ .collect())+ }+ }+ #[tokio::test]+ async fn short_names_are_redacted_without_the_adapters_short_input_bypass() {+ let result = strict_workflow_redaction(+ &FakeRedactor("Workflow message:\n[PERSON]"),+ "Alice",+ Duration::from_secs(1),+ )+ .await;+ assert_eq!(result.unwrap(), "[PERSON]");+ }+ #[tokio::test]+ async fn failure_never_returns_raw_or_regex_fallback_or_sensitive_errors() {+ let result =+ strict_workflow_redaction(&FakeRedactor("fail"), "Alice", Duration::from_secs(1)).await;+ assert_eq!(result.unwrap_err(), "Redaction unavailable");+ assert!(+ strict_workflow_redaction(&FakeRedactor(""), "Alice", Duration::from_secs(1))+ .await+ .is_err()+ );+ }+ #[tokio::test]+ async fn deadline_is_fail_closed() {+ let result =+ strict_workflow_redaction(&FakeRedactor("hang"), "Alice", Duration::from_millis(10))+ .await;+ assert_eq!(result.unwrap_err(), "Redaction timed out");+ }+ #[tokio::test]+ async fn oversized_and_empty_messages_never_contact_the_enclave() {+ assert!(redact_workflow_contribution(" ".into()).await.is_err());+ assert!(redact_workflow_contribution("a".repeat(1801))+ .await+ .is_err());+ }++ /// Bounded synthetic-data smoke eval through the exact production command.+ /// Run explicitly; ordinary tests never depend on the live enclave.+ #[tokio::test]+ #[ignore = "requires the live attested Tinfoil enclave"]+ async fn live_workflow_contribution_redaction_eval() {+ let cases: &[(&str, &[&str])] = &[+ ("Alice", &["Alice"]),+ (+ "Send the invoice to [email protected] or call 415-555-0142.",+ &["[email protected]", "415-555-0142"],+ ),+ (+ "The customer Marcus Chen lives at 123 Maple Street, Springfield.",+ &["Marcus Chen", "123 Maple Street"],+ ),+ (+ "My password is hunter2 and my API key is sk-test-synthetic-0123456789abcdef.",+ &["hunter2", "sk-test-synthetic-0123456789abcdef"],+ ),+ (+ "Contact Zoë Martin at [email protected] to review the workflow.",+ &["Zoë Martin", "[email protected]"],+ ),+ ];+ for (index, (input, sensitive)) in cases.iter().enumerate() {+ let output = redact_workflow_contribution((*input).into())+ .await+ .unwrap_or_else(|error| panic!("live case {index}: {error}"));+ assert!(!output.trim().is_empty(), "empty live case {index}");+ for value in *sensitive {+ assert!(+ !output.to_lowercase().contains(&value.to_lowercase()),+ "sensitive value survived live case {index}"+ );+ }+ println!("live workflow redaction case {index}: passed");+ }+ }+}diff --git a/docs/COVERAGE.md b/docs/COVERAGE.mdindex 62b5c62ad..4138823f2 100644--- a/docs/COVERAGE.md+++ b/docs/COVERAGE.md@@ -37,16 +37,16 @@ results and `cargo llvm-cov` data on top when judging release confidence.### Core Engine- Mapped suites: 34-- Mapped Rust files: 366-- Active test blocks: 3585+- Mapped Rust files: 367+- Active test blocks: 3586- Ignored/manual test blocks: 150-- Weighted coverage points: 2964.2+- Weighted coverage points: 2964.9| Platform | Suites | Active tests | Ignored tests | Weighted points | Layers | Flows | Critical score || --- | --- | --- | --- | --- | --- | --- | --- |-| windows | 31 | 3441 | 144 | 2898.7 | 21 | 11 | 100% |-| macos | 31 | 3501 | 124 | 2911.0 | 22 | 11 | 100% |-| linux | 27 | 3060 | 116 | 2547.9 | 20 | 11 | 100% |+| windows | 31 | 3442 | 144 | 2899.4 | 21 | 11 | 100% |+| macos | 31 | 3502 | 124 | 2911.7 | 22 | 11 | 100% |+| linux | 27 | 3061 | 116 | 2548.6 | 20 | 11 | 100% |## Refreshdiff --git a/docs/coverage/CORE.md b/docs/coverage/CORE.mdindex 749f8e446..52419c927 100644--- a/docs/coverage/CORE.md+++ b/docs/coverage/CORE.md@@ -8,11 +8,11 @@ confidence, and criticality.- Manifest: `docs/coverage/core-engine-map.json`- Tracked crates: screenpipe-engine, screenpipe-db, screenpipe-sqlite-coordinator, screenpipe-audio, screenpipe-screen, screenpipe-a11y, screenpipe-fs- Mapped suites: 34-- Mapped Rust files: 366-- Active test blocks: 3585+- Mapped Rust files: 367+- Active test blocks: 3586- Ignored/manual test blocks: 150-- Declared test blocks: 3735-- Weighted coverage points: 2964.2+- Declared test blocks: 3736+- Weighted coverage points: 2964.9Confidence weights: strong=1.0, partial=0.7, conditional=0.4, smoke=0.3.Criticality weights: high=1.0, medium=0.7, low=0.4.@@ -23,15 +23,15 @@ are explicitly enabled in a runtime lane.| Platform | Suites | Active tests | Ignored tests | Weighted points | Layers | Flows | Critical score || --- | --- | --- | --- | --- | --- | --- | --- |-| windows | 31 | 3441 | 144 | 2898.7 | 21 | 11 | 100% |-| macos | 31 | 3501 | 124 | 2911.0 | 22 | 11 | 100% |-| linux | 27 | 3060 | 116 | 2547.9 | 20 | 11 | 100% |+| windows | 31 | 3442 | 144 | 2899.4 | 21 | 11 | 100% |+| macos | 31 | 3502 | 124 | 2911.7 | 22 | 11 | 100% |+| linux | 27 | 3061 | 116 | 2548.6 | 20 | 11 | 100% |## Crate Summary| Crate | Suites | Integration files | Source unit files | Active tests | Ignored tests | Weighted points | Flows || --- | --- | --- | --- | --- | --- | --- | --- |-| screenpipe-engine | 11 | 20 | 121 | 1743 | 43 | 1343.6 | 10 |+| screenpipe-engine | 11 | 21 | 121 | 1744 | 43 | 1344.3 | 10 || screenpipe-db | 5 | 62 | 24 | 572 | 25 | 545.0 | 9 || screenpipe-sqlite-coordinator | 1 | 0 | 3 | 27 | 0 | 27.0 | 2 || screenpipe-audio | 6 | 25 | 51 | 625 | 44 | 549.6 | 5 |@@ -69,7 +69,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| database | 7 suites / 523 active / 21 ignored / 496.0 pts | 7 suites / 523 active / 21 ignored / 496.0 pts | 7 suites / 523 active / 21 ignored / 496.0 pts || db-search | 2 suites / 113 active / 9 ignored / 113.0 pts | 2 suites / 113 active / 9 ignored / 113.0 pts | 2 suites / 113 active / 9 ignored / 113.0 pts || engine-lifecycle | 6 suites / 244 active / 1 ignored / 219.0 pts | 6 suites / 244 active / 1 ignored / 219.0 pts | 5 suites / 238 active / 1 ignored / 217.3 pts |-| local-api | 3 suites / 443 active / 10 ignored / 312.5 pts | 3 suites / 443 active / 10 ignored / 312.5 pts | 3 suites / 443 active / 10 ignored / 312.5 pts |+| local-api | 3 suites / 444 active / 10 ignored / 313.2 pts | 3 suites / 444 active / 10 ignored / 313.2 pts | 3 suites / 444 active / 10 ignored / 313.2 pts || meeting | 6 suites / 1638 active / 21 ignored / 1338.3 pts | 6 suites / 1638 active / 21 ignored / 1338.3 pts | 4 suites / 1293 active / 17 ignored / 1015.8 pts || ocr | 4 suites / 125 active / 7 ignored / 119.0 pts | 4 suites / 129 active / 7 ignored / 124.5 pts | 3 suites / 120 active / 6 ignored / 115.5 pts || os-integration | 1 suites / 6 active / 0 ignored / 1.7 pts | 1 suites / 6 active / 0 ignored / 1.7 pts | - |@@ -78,7 +78,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| privacy | 5 suites / 946 active / 37 ignored / 766.6 pts | 5 suites / 1002 active / 17 ignored / 773.4 pts | 5 suites / 921 active / 14 ignored / 743.4 pts || real-app | - | 1 suites / 108 active / 4 ignored / 43.2 pts | - || speaker | 2 suites / 369 active / 9 ignored / 369.0 pts | 2 suites / 369 active / 9 ignored / 369.0 pts | 2 suites / 369 active / 9 ignored / 369.0 pts |-| storage | 4 suites / 646 active / 38 ignored / 537.1 pts | 4 suites / 646 active / 38 ignored / 537.1 pts | 4 suites / 646 active / 38 ignored / 537.1 pts |+| storage | 4 suites / 647 active / 38 ignored / 537.8 pts | 4 suites / 647 active / 38 ignored / 537.8 pts | 4 suites / 647 active / 38 ignored / 537.8 pts || sync | 1 suites / 512 active / 3 ignored / 358.4 pts | 1 suites / 512 active / 3 ignored / 358.4 pts | 1 suites / 512 active / 3 ignored / 358.4 pts || timeline | 4 suites / 1187 active / 43 ignored / 973.1 pts | 4 suites / 1187 active / 43 ignored / 973.1 pts | 4 suites / 1187 active / 43 ignored / 973.1 pts || transcription | 5 suites / 815 active / 42 ignored / 638.5 pts | 5 suites / 815 active / 42 ignored / 638.5 pts | 5 suites / 815 active / 42 ignored / 638.5 pts |@@ -144,7 +144,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| engine-meeting-watcher | screenpipe-engine | windows, macos | meeting | meeting-live-notes | high | strong | mixed | 10 | 270 | 3 | Successor of src/meeting_detector.rs and src/meeting_telemetry.rs. Audio-process and UI-scan backend state machines, candidate resolution, shared telemetry, and a scored trajectory eval. ui_scan/macos.rs and ui_scan/windows.rs are cfg-gated and only execute on their target OS; both backends are null on Linux. || engine-retention-storage | screenpipe-engine | windows, macos, linux | storage, engine-lifecycle, performance | engine-health-lifecycle, performance-liveness | medium | strong | mixed | 5 | 39 | 0 | Local retention deletion (including lean-mode heavy-text stripping), cloud archive watermarking, atomic state-file replacement, and the low-disk capture monitor. || engine-telemetry-observability | screenpipe-engine | windows, macos, linux | engine-lifecycle, performance | engine-health-lifecycle, performance-liveness | medium | strong | unit | 6 | 30 | 0 | PostHog capture gating, telemetry context shaping, piggyback telemetry forwarding, crash-log helpers, resource monitoring, and the recording-coverage reliability metric. |-| engine-workflows | screenpipe-engine | windows, macos, linux | local-api, storage | local-api-search | high | partial | mixed | 5 | 23 | 0 | Catalog identity and persistence, revision-scoped feedback, workflow evidence and pipeline contracts, and denial of agent-granted rollout access. Does not assert live cloud discovery quality. |+| engine-workflows | screenpipe-engine | windows, macos, linux | local-api, storage | local-api-search | high | partial | mixed | 6 | 24 | 0 | Catalog identity and persistence, revision-scoped feedback, workflow evidence and pipeline contracts, and denial of agent-granted rollout access. Does not assert live cloud discovery quality. || filesystem-durable-sync | screenpipe-fs | macos, linux, windows | database, vision-capture, audio | capture-ocr-pipeline, audio-record-transcribe, engine-health-lifecycle | high | strong | unit | 1 | 3 | 0 | Durable flushes preserve local full-sync behavior, fall back to fsync only for macOS ENOTSUP, and propagate real I/O or fallback failures. Real SMB migration and continued recording are covered by the marked-volume integration test. || screen-capture-ocr-contract | screenpipe-screen | windows, macos, linux | vision-capture, ocr | capture-ocr-pipeline | high | partial | unit | 3 | 15 | 0 | Cross-platform cached-OCR unit coverage for RawCaptureResult to CaptureResult metadata, browser URL, focus state, window-to-screen OCR coordinate transformation, Tesseract output parsing, and contour-based text-region detection for the meeting OCR gate. || screen-capture-windowing | screenpipe-screen | windows, macos, linux | vision-capture, timeline, performance, privacy | capture-ocr-pipeline, timeline-streaming, privacy-and-redaction, performance-liveness | high | strong | mixed | 14 | 191 | 0 | Window filtering, empty-window regressions, retry policy, URL timing, monitor cache, OCR cache, snapshots, and image comparison. |@@ -493,6 +493,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| engine-capture-timeline | screenpipe-engine | tests/video_utils_test.rs | integration | 1 | 3 | 4 || engine-api-routes | screenpipe-engine | tests/websockets_test.rs | integration | 0 | 1 | 1 || engine-workflows | screenpipe-engine | tests/workflow_catalog_contract_test.rs | integration | 2 | 0 | 2 |+| engine-workflows | screenpipe-engine | tests/workflow_timing_e2e.rs | integration | 1 | 0 | 1 || filesystem-durable-sync | screenpipe-fs | src/lib.rs | source | 3 | 0 | 3 || screen-macos-ocr | screenpipe-screen | src/apple.rs | source | 7 | 1 | 8 || screen-capture-windowing | screenpipe-screen | src/browser_utils/mod.rs | source | 13 | 0 | 13 |diff --git a/docs/coverage/core-engine-map.json b/docs/coverage/core-engine-map.jsonindex 972f90b42..c1fd9d9c4 100644--- a/docs/coverage/core-engine-map.json+++ b/docs/coverage/core-engine-map.json@@ -1375,7 +1375,8 @@"src/routes/workflow_edits.rs","src/routes/workflow_pipeline.rs","src/routes/workflows.rs",- "tests/workflow_catalog_contract_test.rs"+ "tests/workflow_catalog_contract_test.rs",+ "tests/workflow_timing_e2e.rs"],"platforms": ["windows",diff --git a/docs/workflow-contributions.md b/docs/workflow-contributions.mdnew file mode 100644index 000000000..f99877f9b--- /dev/null+++ b/docs/workflow-contributions.md@@ -0,0 +1,64 @@+<!-- screenpipe — AI that knows everything you've seen, said, or heard -->+<!-- https://screenpipe.com -->++# Optional Workflows chat sharing++<!-- doc-covers: none -->++Sharing is off by default. The existing Workflows scheduled-task dialog offers+an independent optional switch. Settings → Privacy offers the same control,+a separate training permission, and deletion. Enabling scheduled tasks alone+never grants sharing permission.++Only `desktopAssistant.ask` captures a completed future user question and final+assistant text. No prompt, history array, workflow document, tool result,+attachment, screenshot, audio, or main Chat conversation is added to the payload.+The answer may quote private context; the notice says so. Saved conversations+are never backfilled. Cancelled/failed turns are excluded.++An opt-in saves server consent plus a local account/epoch binding, sets the+existing `piiBackend` preference to Tinfoil, and remembers the previous backend.+Turning off stops pending uploads, clears the local binding before calling the+server, and restores the previous backend. An unconfirmed server update is+shown as such. Other devices cannot upload after server revocation, even with+an old local setting. Changing the cloud backend is blocked while a local+binding exists. This does not turn on the recording text/image workers or+change their selected categories. Shared chats always use all sensitive classes.++The contribution redactor pins the production Tinfoil enclave and attestation+repository. Every message, including very short names, reaches its AI filter.+No regex-only fallback is permitted. Redaction/attestation failure, timeout,+account change, consent-epoch change or rollout unavailability drops the turn.+This is best-effort data minimization, not a guarantee of anonymization.++V1 intentionally skips an entire turn if either message exceeds 1,800 UTF-8+bytes. It never truncates text or splits through identifiers to fit the filter.+Only two contributions can be pending at once. Raw text is never queued on disk,+logged by this collector, or retried. The redaction command has a 25-second+budget per message; upload requests include bounded response-body reads.++The companion website PR defines `/api/workflow-contributions`: authenticated+consent, upload and deletion; service-role-only Postgres tables; account/epoch+checks and deduplication under the consent row lock; a 100-turn/account/day cap;+30-day expiry and hourly cleanup. Small text rows live in Supabase Postgres so+consent, ingestion and deletion remain one transaction without Storage orphans.++Model-training permission is recorded separately. All rows are currently+`training_eligible = false`: neither consent nor PII redaction proves rights or+provenance. No training/export/Langfuse integration is included. Unknown or+Google-derived content must not be exported for generalized model training.+Managed desktop deployments and known organization accounts are excluded.++## Deployment and review++Apply the companion migration and deploy the backend before enabling the+`WORKFLOW_CONTRIBUTIONS_ENABLED` server flag. It defaults off. The desktop control+is unavailable if the backend/migration cannot be reached. Review the versioned+in-app collection notice against the existing privacy policy and data processor+terms before activation; this PR does not establish legal approval or alter the+published policy. No production migration, deployment, model training, real-chat+collection, app restart, or release is part of this PR.++Native unit tests use fictional text and a fake redactor. UI/transport tests+mock external services. They do not establish the live enclave's redaction+accuracy or an installed-app end-to-end result.