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
feat(browser): clear owned browser data (#3780)
Divanshuf38d7e9af545
diff --git a/apps/screenpipe-app-tauri/components/browser-sidebar.tsx b/apps/screenpipe-app-tauri/components/browser-sidebar.tsxindex 412112b62..593287f15 100644--- a/apps/screenpipe-app-tauri/components/browser-sidebar.tsx+++ b/apps/screenpipe-app-tauri/components/browser-sidebar.tsx@@ -642,6 +642,21 @@ export function BrowserSidebar({ conversationId }: BrowserSidebarProps) {});}, [currentUrl]);+ const clearBrowserData = useCallback(async () => {+ try {+ // If browser login stays enabled, reload immediately re-injects cookies+ // from the user's real browser, making clear look like a no-op.+ await setCookieAccessGranted(false);+ await commands.ownedBrowserClearBrowsingData();+ if (currentUrl) {+ setLoading(true);+ await commands.ownedBrowserNavigate(currentUrl);+ }+ } catch (e) {+ console.error("clear owned-browser browsing data failed", e);+ }+ }, [currentUrl, setCookieAccessGranted]);+const enableAndRetryWithCookies = useCallback(async () => {await setCookieAccessGranted(true);await commands.confirmBrowserCookieAccessForSession();@@ -676,6 +691,13 @@ export function BrowserSidebar({ conversationId }: BrowserSidebarProps) {void retryWithCookies();},},+ {+ id: "browser-clear-data",+ text: "Clear browser data",+ action: () => {+ void clearBrowserData();+ },+ },],});await menu.popup(@@ -687,6 +709,7 @@ export function BrowserSidebar({ conversationId }: BrowserSidebarProps) {}},[+ clearBrowserData,currentUrl,enableAndRetryWithCookies,retryWithCookies,diff --git a/apps/screenpipe-app-tauri/lib/utils/tauri.ts b/apps/screenpipe-app-tauri/lib/utils/tauri.tsindex 296f0be85..539e19bab 100644--- a/apps/screenpipe-app-tauri/lib/utils/tauri.ts+++ b/apps/screenpipe-app-tauri/lib/utils/tauri.ts@@ -1006,6 +1006,19 @@ async openWindowsShellTarget(target: string) : Promise<Result<null, string>> {else return { status: "error", error: e as any };}},+/**+ * Clear all browsing data for the owned-browser webview: cookies, injected+ * cookies, site storage, and cache. This resets the current shared owned+ * browser slate; per-chat isolation belongs to the follow-up PR.+ */+async ownedBrowserClearBrowsingData() : Promise<Result<null, string>> {+ try {+ return { status: "ok", data: await TAURI_INVOKE("owned_browser_clear_browsing_data") };+} catch (e) {+ if(e instanceof Error) throw e;+ else return { status: "error", error: e as any };+}+},/*** Hide the embedded webview without destroying it. Equivalent to calling* `set_bounds` with zero dimensions, but more explicit at the call site.diff --git a/apps/screenpipe-app-tauri/src-tauri/src/owned_browser.rs b/apps/screenpipe-app-tauri/src-tauri/src/owned_browser.rsindex 614b36328..5eec00a03 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/owned_browser.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/owned_browser.rs@@ -1051,6 +1051,24 @@ pub async fn owned_browser_hide(app: AppHandle) -> Result<(), String> {Ok(())}+/// Clear all browsing data for the owned-browser webview: cookies, injected+/// cookies, site storage, and cache. This resets the current shared owned+/// browser slate; per-chat isolation belongs to the follow-up PR.+#[specta::specta]+#[tauri::command]+pub async fn owned_browser_clear_browsing_data(app: AppHandle) -> Result<(), String> {+ let _ = app;+ let state = browser_state();+ let Some(active) = state.active().await else {+ return Err("owned-browser child webview not attached".to_string());+ };+ active+ .clear_all_browsing_data()+ .map_err(|e| format!("owned-browser clear browsing data failed: {e}"))?;+ info!("owned-browser: cleared browsing data");+ Ok(())+}+/// E2E-only probe: whether the owned-browser native webview is currently shown./// Mirrors `e2e_main_overlay_visible` — internal visibility state stays hidden/// in production binaries and is only exposed under the `e2e` feature. Used by