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
enterprise: honor admin PII policy on devices (backend + categories)
Louis Beaumont88f27b15ba1c
diff --git a/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx b/apps/screenpipe-app-tauri/components/settings/privacy-section.tsxindex 99f6f80a5..3b3ba6ef4 100644--- a/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx+++ b/apps/screenpipe-app-tauri/components/settings/privacy-section.tsx@@ -5,6 +5,7 @@import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";import { LockedSetting, ManagedSwitch } from "@/components/enterprise-locked-setting";+import { useEnterprisePolicy } from "@/lib/hooks/use-enterprise-policy";import {Eye,EyeOff,@@ -252,6 +253,11 @@ export function PrivacySection() {const { settings, updateSettings } = useSettings();const isEnterprise = useIsEnterpriseBuild();const { toast } = useToast();+ // when the admin forces the PII backend (local/cloud) we lock the radios so+ // the employee can't override it (the value itself is applied to settings by+ // useEnterprisePolicy.applyPiiPolicy on every policy poll).+ const { getManagedValue } = useEnterprisePolicy();+ const managedPiiBackend = getManagedValue("piiBackend");const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);const [isUpdating, setIsUpdating] = useState(false);@@ -1079,12 +1085,13 @@ export function PrivacySection() {{aiPiiRemovalEnabled && (<div className="mt-3 ml-6 space-y-2 border-l-2 border-border pl-3"><p className="text-xs font-medium text-foreground">Where it runs</p>- <label className="flex cursor-pointer items-start gap-2 text-xs">+ <label className={`flex items-start gap-2 text-xs ${managedPiiBackend ? "cursor-not-allowed opacity-60" : "cursor-pointer"}`}><inputtype="radio"name="piiBackend"className="mt-0.5"checked={piiBackend === "local"}+ disabled={!!managedPiiBackend}onChange={() => handlePiiBackendChange("local")}/><span>@@ -1094,12 +1101,13 @@ export function PrivacySection() {</span></span></label>- <label className="flex cursor-pointer items-start gap-2 text-xs">+ <label className={`flex items-start gap-2 text-xs ${managedPiiBackend ? "cursor-not-allowed opacity-60" : "cursor-pointer"}`}><inputtype="radio"name="piiBackend"className="mt-0.5"checked={piiBackend === "tinfoil"}+ disabled={!!managedPiiBackend}onChange={() => handlePiiBackendChange("tinfoil")}/><span>diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-enterprise-policy.ts b/apps/screenpipe-app-tauri/lib/hooks/use-enterprise-policy.tsindex 14c99a2e9..58507eae9 100644--- a/apps/screenpipe-app-tauri/lib/hooks/use-enterprise-policy.ts+++ b/apps/screenpipe-app-tauri/lib/hooks/use-enterprise-policy.ts@@ -158,6 +158,45 @@ async function applyAppUpdatePolicy(policy: EnterpriseAppUpdatePolicy): Promise<return metadata;}+/**+ * Apply enterprise-forced PII redaction settings to the local settings store so+ * the recording engine honors them. The admin sets these in the workspace+ * policy (lockedSettings.usePiiRemoval / piiBackend / piiRedactionLabels); we+ * write them into `settings` the same way the AI-preset + app-update policies+ * do, so the on-device ONNX + Tinfoil PII workers pick them up. The matching UI+ * controls are disabled separately so the employee can't override a forced+ * value. Keys map 1:1 to the engine's RecordingSettings fields+ * (use_pii_removal, pii_backend, pii_redaction_labels).+ */+async function applyPiiPolicy(lockedSettings: Record<string, unknown>): Promise<void> {+ const updates: Record<string, unknown> = {};++ const master = lockedSettings.usePiiRemoval;+ if (master === "true" || master === "false") {+ updates.usePiiRemoval = master === "true";+ }++ const backend = lockedSettings.piiBackend;+ if (backend === "local" || backend === "tinfoil") {+ updates.piiBackend = backend;+ }++ const labels = lockedSettings.piiRedactionLabels;+ if (Array.isArray(labels)) {+ // canonical SpanLabel snake_case names; `secret` is always redacted+ const clean = Array.from(new Set(labels.filter((l): l is string => typeof l === "string")));+ if (!clean.includes("secret")) clean.push("secret");+ updates.piiRedactionLabels = clean;+ }++ if (Object.keys(updates).length === 0) return;++ const store = await getStore();+ const settings = (await store.get<Record<string, unknown>>("settings")) || {};+ await store.set("settings", { ...settings, ...updates });+ await store.save();+}+/*** Fire-and-forget heartbeat to report device status to the enterprise API.* Called after a successful policy fetch. Never throws, never blocks.@@ -372,6 +411,17 @@ export function useEnterprisePolicy() {console.warn("[enterprise] failed to apply app update policy:", e);}+ // Apply enterprise-forced PII redaction (master / local-vs-cloud backend /+ // categories) to the settings store so the recording engine honors them.+ try {+ await applyPiiPolicy(result.lockedSettings);+ console.log(+ `[enterprise] applied PII policy: locked=[${["usePiiRemoval", "piiBackend", "piiRedactionLabels"].filter((k) => k in result.lockedSettings).join(",")}]`+ );+ } catch (e) {+ console.warn("[enterprise] failed to apply PII policy:", e);+ }+// Fire-and-forget heartbeatsendHeartbeat(licenseKey);