The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: remove obsolete Tauri webview bridge
Steven Enamakel51604ef06e6b
diff --git a/AGENTS.md b/AGENTS.mdindex 2f25a6ec24..1c9778595d 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -168,7 +168,7 @@ No `UserProvider`/`AIProvider`/`SkillProvider` — auth lives in `CoreStateProvi**State** (`store/`): Redux Toolkit slices — `accounts`, `agentProfile`, `announcement`, `channelConnections`, `chatRuntime`, `connectivity`, `coreMode`, `deepLinkAuth`, `layout`, `locale`, `mascot`, `notification`, `persona`, `providerSurface`, `ptt`, `socket`, `theme`, `thread`, `userErrors` (authoritative list: `store/index.ts`; persistence via `userScopedStorage`). Prefer Redux over ad-hoc `localStorage`.-**Services** (`services/`): `apiClient`, `socketService`, `coreRpcClient`, `coreCommandClient`, `chatService`, `analytics`, `notificationService`, `webviewAccountService`, `daemonHealthService`, plus domain `api/*` clients. Always use `coreRpcClient` (which invokes the `relay_http_rpc` Tauri command) for core RPC.+**Services** (`services/`): `apiClient`, `socketService`, `coreRpcClient`, `coreCommandClient`, `chatService`, `analytics`, `notificationService`, `daemonHealthService`, plus domain `api/*` clients. Always use `coreRpcClient` (which invokes the `relay_http_rpc` Tauri command) for core RPC.**Analytics**: use `Button analyticsId="stable-content-free-id"` for shared button interactions, `AnalyticsPageTracker` once inside the router, and `trackAnalyticsEvent` from `components/analytics` for successful domain outcomes (messages, automation runs, connections, etc.). Native controls and links may use `data-analytics-id` directly. Use privacy-safe dimensions only; never send user-authored text, entity IDs, filenames, credentials, or error messages. `services/analytics.ts` is the consent/provider implementation, not the feature-code API.@@ -180,7 +180,7 @@ No `UserProvider`/`AIProvider`/`SkillProvider` — auth lives in `CoreStateProvi## Tauri shell (`app/src-tauri/`)-Thin desktop host. Key modules: `core_process`, `core_rpc`, `cdp`, `dictation_hotkeys`, `file_logging`, `mascot_native_window`, `window_state`, `imessage_scanner`, `webview_apis`.+Thin desktop host. Key modules: `core_process`, `core_rpc`, `dictation_hotkeys`, `file_logging`, `mascot_native_window`, `window_state`, `imessage_scanner`.The CDP-driven provider scanners (`discord_scanner`, `slack_scanner`, `telegram_scanner`, `whatsapp_scanner`, `wechat_scanner`, `gmessages_scanner`), the `webview_accounts` surface they ran inside, and the in-app Meet call window (`meet_call`, `meet_audio`, `meet_video`, `meet_scanner`, `fake_camera`) were removed in #5478 — CDP only exists under a Chromium engine, and the app moved to Wry in #5456. `imessage_scanner` is unaffected: it reads `chat.db` natively and never used CDP. Meet has since been removed from the product entirely (see below), so the `src/openhuman/meet/` and `backend_bot` paths those notes referred to are gone.diff --git a/app/src-tauri/Cargo.lock b/app/src-tauri/Cargo.lockindex 34e1291500..d61e18a5b9 100644--- a/app/src-tauri/Cargo.lock+++ b/app/src-tauri/Cargo.lock@@ -8,12 +8,10 @@ version = "0.63.17"dependencies = ["anyhow","async-trait",- "base64 0.22.1","block2 0.6.2","chrono","cpal","directories 5.0.1",- "futures-util","hex","log","mac-notification-sys",@@ -48,7 +46,6 @@ dependencies = ["tinybox-host","tinybox-ssh","tokio",- "tokio-tungstenite 0.24.0","tokio-util","toml 0.8.2","url",diff --git a/app/src-tauri/Cargo.toml b/app/src-tauri/Cargo.tomlindex c24f39bb5d..4d4186e8a9 100644--- a/app/src-tauri/Cargo.toml+++ b/app/src-tauri/Cargo.toml@@ -61,23 +61,9 @@ directories = "5"# off + xdg-portal keeps Linux off GTK (the Downloads-copy fallback covers# headless CI where no portal is available); tokio drives the async backend.rfd = { version = "0.15", default-features = false, features = ["xdg-portal", "tokio"] }-# Used by gmail/cdp_fetch for decoding binary IO.read chunks. Base64 is-# only emitted by CDP IO.read when the stream contains non-UTF-8 bytes,-# but we opt into the feature to stay robust against unexpected responses.-base64 = "0.22"tokio = { version = "1", features = ["rt-multi-thread", "process", "sync", "time", "net"] }tokio-util = { version = "0.7", features = ["rt"] }-# WebSocket client + server for two uses:-# - Client: Chrome DevTools Protocol connections to the embedded CEF-# instance over `--remote-debugging-port=9222` (IndexedDB reads,-# `Runtime.evaluate` for the WhatsApp recipe, DOMSnapshot / Network-# calls for the Gmail connector).-# - Server: the `webview_apis` bridge at 127.0.0.1 that accepts-# JSON-RPC frames from the core sidecar so core-side handlers can-# reach the live-webview connectors via CDP.-tokio-tungstenite = { version = "0.24", default-features = false, features = ["connect", "handshake"] }url = "2"-futures-util = { version = "0.3", default-features = false, features = ["sink", "std"] }reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }rand = "0.9"diff --git a/app/src-tauri/capabilities/webview-accounts.json b/app/src-tauri/capabilities/webview-accounts.jsondeleted file mode 100644index 3d637bf4d9..0000000000--- a/app/src-tauri/capabilities/webview-accounts.json+++ /dev/null@@ -1,22 +0,0 @@-{- "$schema": "../gen/schemas/desktop-schema.json",- "identifier": "webview-accounts-recipes",- "description": "Permissions for embedded webview-account child webviews. The injected per-provider recipe runtime calls webview_recipe_event from inside untrusted third-party origins (e.g. web.whatsapp.com, meet.google.com), so this capability is intentionally scoped to ONLY that one command, and only on acct_* webview labels. remote.urls lists the third-party origins whose recipes are allowed to invoke the command.",- "platforms": ["linux", "macOS", "windows"],- "windows": [],- "webviews": ["acct_*"],- "remote": {- "urls": [- "https://web.whatsapp.com/*",- "https://web.telegram.org/*",- "https://www.linkedin.com/*",- "https://mail.google.com/*",- "https://app.slack.com/*",- "https://discord.com/*",- "https://meet.google.com/*",- "https://accounts.google.com/*",- "https://www.browserscan.net/*"- ]- },- "permissions": ["allow-webview-recipe"]-}diff --git a/app/src-tauri/permissions/allow-core-process.toml b/app/src-tauri/permissions/allow-core-process.tomlindex 6d9f7774f9..2054a64afc 100644--- a/app/src-tauri/permissions/allow-core-process.toml+++ b/app/src-tauri/permissions/allow-core-process.toml@@ -1,6 +1,6 @@[[permission]]identifier = "allow-core-process"-description = "Privileged desktop permissions for core process control, service management, dictation, account webview, window/UI, notifications, Gmail CDP, log access, Meet, and CEF/profile maintenance"+description = "Privileged desktop permissions for core process control, service management, dictation, window/UI, notifications, log access, and workspace integration"[permission.commands]@@ -109,18 +109,6 @@ allow = ["whatsapp_data_list_messages","whatsapp_data_search_messages",- # =========================- # ACCOUNT WEBVIEW- # =========================- "webview_account_open",- "webview_account_close",- "webview_account_show",- "webview_account_hide",- "webview_account_bounds",- "webview_account_reveal",- "webview_account_purge",- "webview_recipe_event",-# =========================# WINDOW / UI# =========================@@ -146,22 +134,6 @@ allow = ["notification_permission_request","show_native_notification",- # =========================- # GMAIL CDP- # =========================- # Gmail-CDP surface (see app/src-tauri/src/gmail/). Drives the- # logged-in Gmail webview through DOMSnapshot + Input events. Used- # by onboarding's LinkedIn-enrichment pipeline today and by future- # agent tools.- "gmail_list_labels",- "gmail_list_messages",- "gmail_search",- "gmail_get_message",- "gmail_send",- "gmail_trash",- "gmail_add_label",- "gmail_find_linkedin_profile_url",-# =========================# LOGS# =========================@@ -173,20 +145,6 @@ allow = ["logs_folder_path","reveal_logs_folder",- # =========================- # GOOGLE MEET- # =========================- # Meet call: open / close a dedicated CEF webview window pointed at a- # https://meet.google.com/<code> URL with an isolated per-call data- # directory. Surfaced from Intelligence > Calls. Without these allow- # entries the invoke is rejected with "Command not found".- "meet_call_open_window",- "meet_call_close_window",-- # =========================- # CEF / PROFILE- # =========================- "schedule_cef_profile_purge",]deny = []diff --git a/app/src-tauri/permissions/allow-webview-recipe.toml b/app/src-tauri/permissions/allow-webview-recipe.tomldeleted file mode 100644index 822394a835..0000000000--- a/app/src-tauri/permissions/allow-webview-recipe.toml+++ /dev/null@@ -1,9 +0,0 @@-[[permission]]-identifier = "allow-webview-recipe"-description = "Allow injected per-provider recipe code (running inside the third-party site's origin) to invoke the recipe ingest command back to Rust."--[permission.commands]-allow = [- "webview_recipe_event",-]-deny = []diff --git a/app/src-tauri/recipes/browserscan/icon.svg b/app/src-tauri/recipes/browserscan/icon.svgdeleted file mode 100644index 7539bedcc0..0000000000--- a/app/src-tauri/recipes/browserscan/icon.svg+++ /dev/null@@ -1,10 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">- <path d="M12 2v2"/>- <path d="M9 2h6"/>- <rect x="5" y="4" width="14" height="16" rx="3"/>- <path d="M9 10h.01"/>- <path d="M15 10h.01"/>- <path d="M9 15h6"/>- <path d="M3 13h2"/>- <path d="M19 13h2"/>-</svg>diff --git a/app/src-tauri/recipes/browserscan/manifest.json b/app/src-tauri/recipes/browserscan/manifest.jsondeleted file mode 100644index 57921a0e2f..0000000000--- a/app/src-tauri/recipes/browserscan/manifest.json+++ /dev/null@@ -1,7 +0,0 @@-{- "id": "browserscan",- "name": "BrowserScan (dev)",- "version": "0.1.0",- "serviceURL": "https://www.browserscan.net/bot-detection",- "icon": "icon.svg"-}diff --git a/app/src-tauri/recipes/discord/icon.svg b/app/src-tauri/recipes/discord/icon.svgdeleted file mode 100644index 0636ead52b..0000000000--- a/app/src-tauri/recipes/discord/icon.svg+++ /dev/null@@ -1,4 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">- <rect width="32" height="32" rx="6" fill="#5865F2"/>- <path fill="#fff" d="M23.1 9.2a15.2 15.2 0 0 0-3.8-1.2.06.06 0 0 0-.06.03c-.17.3-.36.69-.49 1a14 14 0 0 0-4.2 0 9.7 9.7 0 0 0-.5-1 .06.06 0 0 0-.06-.03 15.2 15.2 0 0 0-3.8 1.2.05.05 0 0 0-.03.02c-2.4 3.6-3.06 7.1-2.74 10.55 0 .02.02.04.04.05a15.3 15.3 0 0 0 4.6 2.33.06.06 0 0 0 .07-.02c.36-.5.68-1.02.95-1.57a.06.06 0 0 0-.03-.08 10 10 0 0 1-1.43-.68.06.06 0 0 1-.01-.1l.28-.22a.06.06 0 0 1 .06 0c3 1.37 6.24 1.37 9.22 0a.06.06 0 0 1 .06 0l.28.22a.06.06 0 0 1-.01.1c-.45.27-.93.5-1.43.68a.06.06 0 0 0-.03.08c.28.55.6 1.06.95 1.57.02.02.04.03.07.02a15.2 15.2 0 0 0 4.6-2.33.06.06 0 0 0 .04-.05c.39-4-.65-7.47-2.74-10.55a.05.05 0 0 0-.03-.02zM12.84 17.6c-.91 0-1.66-.84-1.66-1.86 0-1.03.73-1.87 1.66-1.87.94 0 1.68.85 1.66 1.87 0 1.02-.73 1.86-1.66 1.86zm6.16 0c-.91 0-1.66-.84-1.66-1.86 0-1.03.73-1.87 1.66-1.87.94 0 1.68.85 1.66 1.87 0 1.02-.72 1.86-1.66 1.86z"/>-</svg>diff --git a/app/src-tauri/recipes/discord/manifest.json b/app/src-tauri/recipes/discord/manifest.jsondeleted file mode 100644index 278d378ed0..0000000000--- a/app/src-tauri/recipes/discord/manifest.json+++ /dev/null@@ -1,7 +0,0 @@-{- "id": "discord",- "name": "Discord",- "version": "0.1.0",- "serviceURL": "https://discord.com/channels/@me",- "icon": "icon.svg"-}diff --git a/app/src-tauri/recipes/gmail/icon.svg b/app/src-tauri/recipes/gmail/icon.svgdeleted file mode 100644index 5b1726bf47..0000000000--- a/app/src-tauri/recipes/gmail/icon.svg+++ /dev/null@@ -1,10 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">- <rect width="32" height="32" rx="4" fill="#fff"/>- <g transform="translate(5 8)">- <path fill="#4285F4" d="M2 16h3V7L0 3v11a2 2 0 0 0 2 2z"/>- <path fill="#34A853" d="M17 16h3a2 2 0 0 0 2-2V3l-5 4v9z"/>- <path fill="#FBBC04" d="M17 2v5l5-4V2a2 2 0 0 0-3-1l-2 1z"/>- <path fill="#EA4335" d="M5 7V2l6 4 6-4v5l-6 4-6-4z"/>- <path fill="#C5221F" d="M0 3l5 4V2L3 1A2 2 0 0 0 0 3z"/>- </g>-</svg>diff --git a/app/src-tauri/recipes/gmail/manifest.json b/app/src-tauri/recipes/gmail/manifest.jsondeleted file mode 100644index cbd83f5ed6..0000000000--- a/app/src-tauri/recipes/gmail/manifest.json+++ /dev/null@@ -1,7 +0,0 @@-{- "id": "gmail",- "name": "Gmail",- "version": "0.1.0",- "serviceURL": "https://mail.google.com/mail/u/0/",- "icon": "icon.svg"-}diff --git a/app/src-tauri/recipes/google-meet/icon.svg b/app/src-tauri/recipes/google-meet/icon.svgdeleted file mode 100644index 2b27a433c3..0000000000--- a/app/src-tauri/recipes/google-meet/icon.svg+++ /dev/null@@ -1,8 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">- <rect width="32" height="32" rx="4" fill="#fff"/>- <path fill="#00832D" d="M18.5 16 22 19.2V12.8z"/>- <path fill="#0066DA" d="M5 11v10a1 1 0 0 0 1 1h12v-5l-4.5-3.2H8V11z"/>- <path fill="#E94235" d="M18 10H6a1 1 0 0 0-1 1v1.8l3 .2h5v3l5-.2z"/>- <path fill="#2684FC" d="M18 10v5.8l-4.5-.6V13H8v7.2l5-.2V22h5a1 1 0 0 0 1-1V11a1 1 0 0 0-1-1z"/>- <path fill="#FFBA00" d="M26 11.4 22 12.8v6.4l4 1.4a1 1 0 0 0 1-.9v-8.4a1 1 0 0 0-1-.9z"/>-</svg>diff --git a/app/src-tauri/recipes/google-meet/manifest.json b/app/src-tauri/recipes/google-meet/manifest.jsondeleted file mode 100644index 0b8603c1f3..0000000000--- a/app/src-tauri/recipes/google-meet/manifest.json+++ /dev/null@@ -1,7 +0,0 @@-{- "id": "google-meet",- "name": "Google Meet",- "version": "0.1.0",- "serviceURL": "https://meet.google.com/",- "icon": "icon.svg"-}diff --git a/app/src-tauri/recipes/google-meet/recipe.js b/app/src-tauri/recipes/google-meet/recipe.jsdeleted file mode 100644index 08ee1a0e61..0000000000--- a/app/src-tauri/recipes/google-meet/recipe.js+++ /dev/null@@ -1,535 +0,0 @@-// Google Meet recipe.-//-// Scope:-// * Track the meeting lifecycle (joined call → left call / navigated-// away) driven off the URL path.-// * Stream Meet's own live-caption text back to Rust so the host can-// accumulate a transcript. We do NOT run Whisper here — Meet's-// built-in captions are the source of truth. User must have-// "Turn on captions" enabled in Meet for this to yield anything.-//-// Event kinds emitted (on top of the runtime's standard set):-// meet_call_started { code, url, startedAt }-// meet_captions { code, captions:[{speaker,text}], ts }-// meet_call_ended { code, endedAt, reason }-//-// DOM anchors used — all are "stable-ish", meaning they've held for-// months at a time but are not contractual. Expect periodic maintenance-// when Meet ships a big redesign.-// * URL path `/xxx-xxxx-xxx` → meeting code / "am I in a call"-// * `[jsname="tgaKEf"]` → caption region container-// * within a caption row: first `img[alt]` or `[data-self-name]`-// for the speaker's display name; the rest of the text nodes for-// the rolling transcript line-(function (api) {- if (!api) return;- api.log('info', '[google-meet-recipe] starting');-- const MEETING_CODE_RE = /^\/([a-z]{3,4}-[a-z]{3,4}-[a-z]{3,4})(?:$|\/|\?)/i;-- // Current-call state, owned by the recipe. Transitions are the trigger- // for the started/ended lifecycle events.- let currentCode = null;- let startedAt = 0;-- // Meet SPA-navigates you off the meeting URL when you leave a call,- // which destroys this JS context before emitEnded can run. Persist the- // in-progress code to sessionStorage so the recipe on the next page- // can emit a synthetic ended event for the previous session. Keyed by- // origin (same-origin nav is guaranteed within meet.google.com).- const SS_CODE = 'openhuman_gmeet_currentCode';- const SS_STARTED_AT = 'openhuman_gmeet_startedAt';-- function ssGet(k) {- try { return window.sessionStorage.getItem(k); } catch (_) { return null; }- }- function ssSet(k, v) {- try { window.sessionStorage.setItem(k, v); } catch (_) {}- }- function ssDel(k) {- try { window.sessionStorage.removeItem(k); } catch (_) {}- }- // Last caption snapshot we sent up — compared each tick so we only- // emit when the on-screen captions actually changed.- let lastCaptionsKey = '';-- function textOf(el) {- return (el && el.textContent ? el.textContent : '').trim();- }-- function meetingCode() {- try {- const m = MEETING_CODE_RE.exec(window.location.pathname || '');- return m ? m[1] : null;- } catch (_) {- return null;- }- }-- // Pull the speaker name out of one caption row. Meet renders an avatar- // image whose `alt` is the speaker's display name; own-user rows carry- // a `data-self-name` attribute instead.- function rowSpeaker(row) {- try {- const img = row.querySelector('img[alt]');- if (img) {- const alt = (img.getAttribute('alt') || '').trim();- // Skip icon alts ("arrow_downward", "avatar", etc).- if (alt && alt.length > 1 && !looksLikeIconLigature(alt) &&- !/^avatar$/i.test(alt)) {- return alt;- }- }- const self = row.querySelector('[data-self-name]');- if (self) {- const name = (self.getAttribute('data-self-name') || '').trim();- if (name) return name;- }- // Current Meet layout: speaker display name is the first non-empty- // <span> inside the row (e.g. "You", "Alice"). Use it as a fallback- // as long as it doesn't look like icon/chrome text.- const spans = row.querySelectorAll('span');- for (let i = 0; i < spans.length; i++) {- const t = (spans[i].textContent || '').replace(/\s+/g, ' ').trim();- if (!t) continue;- if (looksLikeIconLigature(t)) continue;- if (t.length > 40) continue; // too long to be a display name- return t;- }- } catch (_) {}- return 'Unknown';- }-- // Pull the rolling transcript line for one caption row. We want the- // caption text only, not the speaker's name / timestamp chrome, so we- // collect text from nodes that DON'T live inside an img's parent block- // and aren't the `[data-self-name]` node.- function rowText(row) {- try {- // Current Meet layout (2026-04): the row's textContent concatenates- // the speaker display name (inside a <span>) and the live caption- // text (a sibling text node), with no separator — e.g.- // "YouMake a massive improvement...". Picking the longest span- // returns only "You"; we want the text AFTER the speaker span.- const full = (row.textContent || '').replace(/\s+/g, ' ').trim();- if (!full) return '';- // Prefer stripping the first non-empty span's text from the front.- const spans = row.querySelectorAll('span');- let prefix = '';- for (let i = 0; i < spans.length; i++) {- const t = (spans[i].textContent || '').replace(/\s+/g, ' ').trim();- if (t) {- prefix = t;- break;- }- }- let stripped = full;- if (prefix && full.toLowerCase().startsWith(prefix.toLowerCase())) {- stripped = full.slice(prefix.length).trim();- }- // Drop the "Jump to bottom" chrome if it trails the caption.- stripped = stripped.replace(/\s*arrow_downward\s*Jump to bottom\s*$/i, '').trim();- return stripped;- } catch (_) {- return textOf(row);- }- }-- // Reject text that's clearly a Material Icon ligature rather than real- // caption content. Meet's toolbar buttons (e.g. "closed_caption_off",- // "settings", "mic_off") render the icon name as textContent because the- // Material Symbols font turns ligatures into glyphs. Real captions are- // natural language, so anything that's a single snake_case token is noise.- function looksLikeIconLigature(text) {- if (!text) return true;- const t = text.trim();- if (!t) return true;- // Single token, all lowercase letters / digits / underscores: icon name.- if (/^[a-z0-9_]+$/.test(t) && t.length < 40) return true;- return false;- }-- // Heuristic: real caption lines look like natural language — they contain- // at least one whitespace separator once they're more than a word or two- // long, and they rarely contain the same token concatenated with itself- // (which is what Meet's IconButton tooltip + label fusion produces, e.g.- // "closeClose", "settingsSettings", "micMic off").- function looksLikeCaptionLine(text) {- if (!text) return false;- const t = text.trim();- if (t.length < 3) return false;- if (looksLikeIconLigature(t)) return false;- // Toast/snackbar patterns: short, no whitespace, PascalCase-ish.- if (t.length < 20 && !/\s/.test(t)) return false;- // Repeated-token pattern like "closeClose" or "settingsSettings".- if (/^([a-z]+)([A-Z][a-z]*)$/.test(t)) {- const m = /^([a-z]+)([A-Z][a-z]*)$/.exec(t);- if (m && m[2].toLowerCase() === m[1]) return false;- }- // Embedded Material icon ligature inside the text (e.g.- // "Your meeting is safe: content_copyCopy link", "mic_offMic off").- // Real caption lines never contain `foo_bar` tokens.- if (/\b[a-z]+_[a-z]+\b/.test(t)) return false;- // Known Meet snackbar / modal strings that slip through otherwise.- if (/Your meeting is safe|Your meeting's ready|Copy link|Meeting details|Add people|Add others|Jump to bottom|Jump to most recent/i.test(t)) return false;- // Repeated-token suffix like "closeClose" appearing anywhere.- if (/([a-z]{3,})\1/i.test(t)) return false;- return true;- }-- // Heuristic: a real caption region contains multiple speaker rows, each- // with an `img[alt]` avatar (or a `[data-self-name]` for the local user).- // A toolbar button labelled "caption" does not. Score a candidate region- // by how many plausible speaker rows live inside.- function scoreCaptionRegion(el) {- if (!el) return 0;- try {- const imgs = el.querySelectorAll('img[alt]');- const selves = el.querySelectorAll('[data-self-name]');- const spans = el.querySelectorAll('span');- let plausible = 0;- for (let i = 0; i < imgs.length; i++) {- const alt = (imgs[i].getAttribute('alt') || '').trim();- if (!alt || alt.length < 2) continue;- // Exclude Material icon alts (content_copy, mic_off, etc) — those- // are icons, not participant avatars.- if (looksLikeIconLigature(alt)) continue;- // Exclude generic labels like "Avatar" that some toasts use.- if (/^avatar$/i.test(alt)) continue;- plausible++;- }- for (let i = 0; i < selves.length; i++) {- const name = (selves[i].getAttribute('data-self-name') || '').trim();- if (name) plausible++;- }- // Needs speakers AND enough spans to host transcript text.- if (plausible === 0) return 0;- if (spans.length < 2) return 0;- return plausible * 10 + spans.length;- } catch (_) {- return 0;- }- }-- // Locate the live captions container. Try the stable jsname first, then- // fall back to *scored* candidates matching "captions" in aria-label or- // an aria-live polite region. We only accept a candidate that actually- // looks like a caption surface (see `scoreCaptionRegion`).- function findCaptionRegion() {- try {- const primary = document.querySelector('[jsname="tgaKEf"]');- if (primary && scoreCaptionRegion(primary) > 0) {- return { region: primary, how: 'jsname=tgaKEf' };- }- if (primary) {- api.log(- 'warn',- '[google-meet-recipe] primary [jsname=tgaKEf] matched but scored 0 — Meet DOM may have changed'- );- }- } catch (_) {}-- // Strong signal: Meet exposes the live captions container with- // role="region" and a localized "Captions" aria-label. Current DOM- // (as of 2026-04) no longer keeps participant avatars inside this- // container, so scoring by `img[alt]` speakers rejects it. Accept it- // directly as a high-confidence match.- try {- const labelled = document.querySelectorAll(- '[role="region"][aria-label],[aria-label]'- );- for (let i = 0; i < labelled.length; i++) {- const lbl = (labelled[i].getAttribute('aria-label') || '').trim();- if (/^(captions|sous-titres|untertitel|leyendas|字幕)$/i.test(lbl)) {- return {- region: labelled[i],- how: 'aria-label="' + lbl + '"',- };- }- }- } catch (_) {}-- // Candidate pool: aria-label containing "caption" (localized) OR- // aria-live="polite" regions (Meet marks the captions container as a- // live region so screen readers announce new lines).- const candidates = [];- try {- const labelled = document.querySelectorAll('[aria-label]');- for (let i = 0; i < labelled.length; i++) {- const label = labelled[i].getAttribute('aria-label') || '';- if (/caption|sous-titre|untertitel|leyenda|字幕/i.test(label)) {- candidates.push(labelled[i]);- }- }- const live = document.querySelectorAll('[aria-live="polite"]');- for (let i = 0; i < live.length; i++) {- candidates.push(live[i]);- }- } catch (_) {}-- let best = null;- let bestScore = 0;- let bestHow = '';- for (let i = 0; i < candidates.length; i++) {- const s = scoreCaptionRegion(candidates[i]);- if (s > bestScore) {- bestScore = s;- best = candidates[i];- const lbl = (candidates[i].getAttribute('aria-label') || '').slice(0, 40);- const live = candidates[i].getAttribute('aria-live') || '';- bestHow = 'fallback(aria-label="' + lbl + '",aria-live="' + live + '",score=' + s + ')';- }- }- if (best) return { region: best, how: bestHow };- return null;- }-- // Throttled diagnostic so we can see what the recipe is actually looking- // at inside a live call without spamming the log every tick.- let lastDiagAt = 0;- function maybeLogDiag(found, rows) {- const now = Date.now();- if (now - lastDiagAt < 5000) return;- lastDiagAt = now;- if (!found) {- // Verbose dump: describe candidate regions across several selector- // strategies so we can identify the renamed captions container.- let dump = '';- try {- const seen = new Set();- const regions = [];- const addAll = (nodes, tag) => {- for (let i = 0; i < nodes.length; i++) {- if (seen.has(nodes[i])) continue;- seen.add(nodes[i]);- regions.push({ el: nodes[i], tag: tag });- }- };- addAll(document.querySelectorAll('[aria-live="polite"]'), 'polite');- addAll(document.querySelectorAll('[aria-live="assertive"]'), 'assertive');- addAll(document.querySelectorAll('[role="log"]'), 'role=log');- addAll(document.querySelectorAll('[role="region"]'), 'role=region');- // aria-label containing "caption" in multiple locales- const labelled = document.querySelectorAll('[aria-label]');- for (let i = 0; i < labelled.length; i++) {- const lbl = labelled[i].getAttribute('aria-label') || '';- if (/caption|sous-titre|untertitel|leyenda|字幕/i.test(lbl)) {- if (!seen.has(labelled[i])) {- seen.add(labelled[i]);- regions.push({ el: labelled[i], tag: 'label~caption' });- }- }- }- for (let i = 0; i < regions.length; i++) {- const r = regions[i].el;- const tag = regions[i].tag;- const label = (r.getAttribute('aria-label') || '').slice(0, 40);- const role = r.getAttribute('role') || '';- const jsname = r.getAttribute('jsname') || '';- const cls = (r.className || '').toString().slice(0, 40);- const imgs = r.querySelectorAll('img[alt]').length;- const selves = r.querySelectorAll('[data-self-name]').length;- const spans = r.querySelectorAll('span').length;- const txt = (r.textContent || '').trim().slice(0, 60);- dump +=- ' || [' + i + ' ' + tag + '] label="' + label + '" role="' + role +- '" jsname="' + jsname + '" class="' + cls +- '" imgs=' + imgs + ' selves=' + selves + ' spans=' + spans +- ' text="' + txt.replace(/\n/g, ' ') + '"';- }- } catch (_) {}- api.log(- 'info',- '[google-meet-recipe] diag: no caption region found. jsname=' +- (document.querySelector('[jsname="tgaKEf"]') ? 'present' : 'absent') +- ' aria-live-polite=' +- document.querySelectorAll('[aria-live="polite"]').length +- dump- );- return;- }- let extra = '';- if (!rows.length && found.region) {- // No rows came through the filter — dump the region's child tree so- // we can see how Meet is laying out captions now.- try {- const region = found.region;- extra += ' children=' + region.children.length;- for (let i = 0; i < Math.min(region.children.length, 3); i++) {- const child = region.children[i];- const txt = (child.textContent || '').trim().slice(0, 60).replace(/\n/g, ' ');- const spans = child.querySelectorAll('span').length;- const imgs = child.querySelectorAll('img[alt]').length;- extra += ' ch[' + i + '](tag=' + child.tagName +- ' spans=' + spans + ' imgs=' + imgs + ' text="' + txt + '")';- }- } catch (_) {}- }- api.log(- 'info',- '[google-meet-recipe] diag: region found via ' +- found.how +- ' rows=' +- rows.length +- (rows.length- ? ' sample="' +- (rows[0].speaker + ': ' + rows[0].text).slice(0, 80) +- '"'- : '') +- extra- );- }-- function captionRows() {- const found = findCaptionRegion();- if (!found) {- maybeLogDiag(null, []);- return [];- }- const region = found.region;- const rows = [];- try {- const children = region.children;- for (let i = 0; i < children.length; i++) {- const row = children[i];- const speaker = rowSpeaker(row);- const text = rowText(row);- if (!text) continue;- // Reject toolbar icon ligatures, snackbar "closeClose" duplications,- // and other non-caption chrome.- if (!looksLikeCaptionLine(text)) continue;- // A row without a real speaker avatar AND short text is almost- // certainly chrome (tooltip, icon label). Keep it only if it has- // enough length to plausibly be a caption line.- if (speaker === 'Unknown' && text.length < 12) continue;- rows.push({ speaker: speaker, text: text });- }- } catch (_) {}- maybeLogDiag(found, rows);- return rows;- }-- function emitStarted(code) {- startedAt = Date.now();- api.log('info', '[google-meet-recipe] call started: ' + code);- ssSet(SS_CODE, code);- ssSet(SS_STARTED_AT, String(startedAt));- try {- api.emit('meet_call_started', {- code: code,- url: window.location.href,- startedAt: startedAt,- });- } catch (_) {}- }-- function emitEnded(code, reason) {- const endedAt = Date.now();- api.log(- 'info',- '[google-meet-recipe] call ended: ' +- code +- ' reason=' +- reason +- ' duration_s=' +- Math.round((endedAt - startedAt) / 1000)- );- ssDel(SS_CODE);- ssDel(SS_STARTED_AT);- try {- api.emit('meet_call_ended', {- code: code,- endedAt: endedAt,- reason: reason,- });- } catch (_) {}- }-- // Recovery path: if Meet destroyed the previous recipe context before- // we could emit call_ended (leave-call navigates the SPA), sessionStorage- // still has the code. On bootstrap, if we find a stale code AND the- // current page has no meeting code, flush the previous session.- (function recoverStaleSession() {- const staleCode = ssGet(SS_CODE);- if (!staleCode) return;- const liveCode = meetingCode();- if (liveCode === staleCode) {- // Page reload inside the same call — resume, don't flush.- const staleStarted = parseInt(ssGet(SS_STARTED_AT) || '0', 10);- startedAt = staleStarted || Date.now();- currentCode = staleCode;- return;- }- // Either the URL has no code (left the call) or a different code- // (switched meetings). Either way, close out the previous one.- const staleStarted = parseInt(ssGet(SS_STARTED_AT) || '0', 10);- if (staleStarted) startedAt = staleStarted;- emitEnded(staleCode, liveCode ? 'switched-on-reload' : 'navigated-away');- })();-- function emitCaptionsIfChanged(code, captions) {- const key = JSON.stringify(captions);- if (key === lastCaptionsKey) return;- lastCaptionsKey = key;- try {- api.emit('meet_captions', {- code: code,- captions: captions,- ts: Date.now(),- });- } catch (_) {}- }-- // Positive "we are in the call" signal. The URL keeps the meeting code- // in the lobby and on the post-leave screen too, so URL alone is not- // enough. Once you actually enter the meeting room, Meet renders one- // participant tile per attendee (including your own), marked with- // `[data-participant-id]` on the tile wrapper and `[data-self-name]`- // on the own-user tile. Neither attribute is present in the lobby or- // on the post-leave screen — their presence is the cleanest signal- // that we're fully joined.- function sawParticipantBubbles() {- try {- if (document.querySelector('[data-self-name]')) return true;- if (document.querySelector('[data-participant-id]')) return true;- } catch (_) {}- return false;- }-- function inCallNow() {- const code = meetingCode();- if (!code) return null;- return sawParticipantBubbles() ? code : null;- }-- api.loop(function () {- const activeCode = inCallNow();-- // End: we had an active call, and the "Leave call" button is gone- // (lobby page, post-leave screen, or SPA-nav to another route).- if (currentCode && activeCode !== currentCode) {- emitEnded(- currentCode,- activeCode ? 'switched' : 'leave-call-button-gone'- );- // If we jumped straight to a different meeting, fall through to- // emit the new start on the same tick.- currentCode = null;- lastCaptionsKey = '';- }-- // Start: we're in a call (URL matches AND Leave-call button visible)- // and we hadn't marked ourselves in-call yet.- if (activeCode && !currentCode) {- currentCode = activeCode;- lastCaptionsKey = '';- emitStarted(activeCode);- }-- if (!currentCode) return;- const captions = captionRows();- if (captions.length > 0) {- emitCaptionsIfChanged(currentCode, captions);- }- });-})(window.__openhumanRecipe);diff --git a/app/src-tauri/recipes/instagram/icon.svg b/app/src-tauri/recipes/instagram/icon.svgdeleted file mode 100644index aa5315b513..0000000000--- a/app/src-tauri/recipes/instagram/icon.svg+++ /dev/null@@ -1,14 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">- <defs>- <radialGradient id="ig" cx="0.3" cy="1" r="1.1">- <stop offset="0" stop-color="#FED576"/>- <stop offset="0.3" stop-color="#F47133"/>- <stop offset="0.6" stop-color="#BC3081"/>- <stop offset="1" stop-color="#4C63D2"/>- </radialGradient>- </defs>- <rect width="32" height="32" rx="8" fill="url(#ig)"/>- <rect x="8" y="8" width="16" height="16" rx="5" fill="none" stroke="#fff" stroke-width="2"/>- <circle cx="16" cy="16" r="4" fill="none" stroke="#fff" stroke-width="2"/>- <circle cx="21" cy="11" r="1.3" fill="#fff"/>-</svg>diff --git a/app/src-tauri/recipes/instagram/manifest.json b/app/src-tauri/recipes/instagram/manifest.jsondeleted file mode 100644index 34d325c8b7..0000000000--- a/app/src-tauri/recipes/instagram/manifest.json+++ /dev/null@@ -1,7 +0,0 @@-{- "id": "instagram",- "name": "Instagram",- "version": "0.1.0",- "serviceURL": "https://www.instagram.com/direct/inbox/",- "icon": "icon.svg"-}diff --git a/app/src-tauri/recipes/linkedin/icon.svg b/app/src-tauri/recipes/linkedin/icon.svgdeleted file mode 100644index 6c4681bb39..0000000000--- a/app/src-tauri/recipes/linkedin/icon.svg+++ /dev/null@@ -1,4 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">- <rect width="32" height="32" rx="4" fill="#0A66C2"/>- <path fill="#fff" d="M11.3 24.7H8V13.3h3.3v11.4zm-1.65-13c-1.06 0-1.92-.87-1.92-1.93 0-1.06.86-1.92 1.92-1.92s1.92.86 1.92 1.92c0 1.06-.86 1.93-1.92 1.93zM24.7 24.7h-3.3v-5.55c0-1.32-.03-3.02-1.84-3.02-1.84 0-2.12 1.44-2.12 2.92v5.65H14.14V13.3h3.17v1.55h.05c.44-.84 1.52-1.72 3.13-1.72 3.35 0 3.96 2.2 3.96 5.07v6.5z"/>-</svg>diff --git a/app/src-tauri/recipes/linkedin/manifest.json b/app/src-tauri/recipes/linkedin/manifest.jsondeleted file mode 100644index 2363066c08..0000000000--- a/app/src-tauri/recipes/linkedin/manifest.json+++ /dev/null@@ -1,7 +0,0 @@-{- "id": "linkedin",- "name": "LinkedIn Messaging",- "version": "0.3.0",- "serviceURL": "https://www.linkedin.com/messaging/",- "icon": "icon.svg"-}diff --git a/app/src-tauri/recipes/linkedin/recipe.js b/app/src-tauri/recipes/linkedin/recipe.jsdeleted file mode 100644index 259e46e3c2..0000000000--- a/app/src-tauri/recipes/linkedin/recipe.js+++ /dev/null@@ -1,317 +0,0 @@-// LinkedIn Messaging recipe v0.3-// Scrapes the conversation list, active thread, and connection requests.-// Emits per-conversation-per-day memory ingest events following the-// WhatsApp pattern so the recall pipeline gets stable, upsertable docs.-(function (api) {- if (!api) return;- api.log('info', '[linkedin-recipe] v0.3 starting');-- // ── helpers ────────────────────────────────────────────────────────────────-- function textOf(el) {- return (el && el.textContent ? el.textContent : '').trim();- }-- function isoDay(ms) {- return new Date(ms).toISOString().slice(0, 10);- }-- // Convert LinkedIn relative timestamps ("2h", "3d", "1w") to epoch ms.- function parseRelativeTime(text) {- if (!text) return null;- var t = text.trim().toLowerCase();- var m = t.match(/^(\d+)\s*([smhdw])/);- if (!m) return null;- var n = parseInt(m[1], 10);- var units = { s: 1000, m: 60000, h: 3600000, d: 86400000, w: 604800000 };- return Date.now() - n * (units[m[2]] || 0);- }-- // Extract a stable conversation ID from a LinkedIn href.- // Handles both /messaging/thread/2-xxx/ and /messaging/conversations/2-xxx- function chatIdFromHref(href) {- if (!href) return null;- var m = href.match(/(?:thread|conversation(?:s)?)[/=]([^/?#&]+)/i);- return m ? m[1] : null;- }-- // ── conversation list ──────────────────────────────────────────────────────-- var lastListKey = '';- var prevUnread = {}; // chatId -> last seen unread count-- function scrapeConversationList() {- var rows = document.querySelectorAll([- 'li.msg-conversation-listitem',- '.msg-conversations-container__pillar li',- '.scaffold-layout__list-container li[data-id]',- '.msg-conversations-container li',- ].join(', '));- if (!rows || rows.length === 0) return null;-- var items = [];- rows.forEach(function (row, idx) {- // Participant name — multiple fallbacks for selector churn resilience- var nameEl =- row.querySelector('.msg-conversation-listitem__participant-names') ||- row.querySelector('.msg-conversation-card__participant-names') ||- row.querySelector('.msg-conversation-card__title') ||- row.querySelector('[data-control-name="overlay.open_conversation"] span') ||- row.querySelector('h3') ||- row.querySelector('h4');-- // Message snippet / preview- var previewEl =- row.querySelector('.msg-conversation-card__message-snippet') ||- row.querySelector('.msg-conversation-listitem__message-snippet') ||- row.querySelector('.msg-conversation-card__message-snippet-body') ||- row.querySelector('[class*="conversation-card__message"]') ||- row.querySelector('[class*="message-snippet"]');-- // Unread badge- var unreadEl = row.querySelector([- '.notification-badge__count',- '.msg-conversation-card__unread-count',- '[class*="unread-count"]',- '[class*="badge__count"]',- ].join(', '));-- // Timestamp- var timeEl = row.querySelector([- '.msg-conversation-card__time-stamp',- '.msg-conversation-listitem__time-stamp',- 'time',- '[class*="time-stamp"]',- ].join(', '));-- // Conversation link → stable chat ID- var linkEl = row.querySelector('a[href*="messaging"], a[href*="conversation"]');- var href = linkEl ? linkEl.getAttribute('href') : null;- var chatId = chatIdFromHref(href);-- var name = textOf(nameEl);- var preview = textOf(previewEl);- var unreadNum = parseInt(textOf(unreadEl), 10);- var unread = Number.isNaN(unreadNum) ? 0 : unreadNum;- var timeText = textOf(timeEl);- var approxTs = parseRelativeTime(timeText);-- if (name || preview) {- items.push({- chatId: chatId || ('li:' + (name || idx)),- name: name || null,- preview: preview || null,- unread: unread,- timeText: timeText || null,- ts: approxTs,- });- }- });- return items;- }-- // ── active thread reading ──────────────────────────────────────────────────-- var lastThreadKey = '';-- function getActiveChatId() {- var m = location.href.match(/(?:thread|conversation(?:s)?)[/=]([^/?#&]+)/i);- return m ? m[1] : null;- }-- function scrapeActiveThread() {- var chatId = getActiveChatId();- if (!chatId) return null;-- var events = document.querySelectorAll([- '.msg-s-event-listitem',- '.msg-s-message-list__event',- '[class*="s-event-listitem"]',- ].join(', '));- if (!events || events.length === 0) return null;-- var msgs = [];- events.forEach(function (ev) {- var bodyEl =- ev.querySelector('.msg-s-event-listitem__body') ||- ev.querySelector('.msg-s-event-listitem__message-text') ||- ev.querySelector('[class*="event-listitem__body"]');- var senderEl =- ev.querySelector('.msg-s-event-listitem__sender') ||- ev.querySelector('.msg-s-event-listitem__author') ||- ev.querySelector('[class*="event-listitem__sender"]');- var timeEl =- ev.querySelector('.msg-s-message-list-content__timestamp') ||- ev.querySelector('time') ||- ev.querySelector('[class*="timestamp"]');-- var body = textOf(bodyEl);- if (!body) return;-- var sender = textOf(senderEl);- var timeAttr = timeEl ? (timeEl.getAttribute('datetime') || textOf(timeEl)) : null;- var tsMs = timeAttr ? new Date(timeAttr).getTime() : NaN;- var tsSec = Number.isNaN(tsMs) ? null : Math.floor(tsMs / 1000);-- // Own messages have a right-aligned or "own-message" CSS marker- var fromMe =- ev.classList.contains('msg-s-event-listitem--own-message') ||- ev.querySelector('[class*="own-message"]') !== null;-- msgs.push({- from: sender || null,- body: body,- timestamp: tsSec,- fromMe: fromMe,- });- });-- if (msgs.length === 0) return null;- return { chatId: chatId, msgs: msgs };- }-- // ── connection requests ────────────────────────────────────────────────────-- var lastRequestsKey = '';-- function scrapeConnectionRequests() {- if (!location.href.includes('invitation') && !location.href.includes('mynetwork')) return null;- var cards = document.querySelectorAll([- '.invitation-card',- '[data-view-name="manage-received-invitation"]',- '[class*="invitation-card"]',- ].join(', '));- if (!cards || cards.length === 0) return null;-- var requests = [];- cards.forEach(function (card) {- var nameEl = card.querySelector(- '.invitation-card__title, h3, [class*="invitation-card__title"]'- );- var subtitleEl = card.querySelector(- '.invitation-card__subtitle, [class*="invitation-card__subtitle"]'- );- var name = textOf(nameEl);- if (!name) return;- requests.push({ name: name, subtitle: textOf(subtitleEl) || null });- });- return requests.length > 0 ? requests : null;- }-- // ── main loop ──────────────────────────────────────────────────────────────-- api.loop(function () {- var today = isoDay(Date.now());-- // 1. Conversation list- var items = scrapeConversationList();- if (items && items.length > 0) {- // Unread delta check runs on EVERY poll tick, not just when the list- // structure changes. listKey only fingerprints name+preview of the first- // five rows, so an unread-count bump on row 6+ (or a count-only change)- // would never enter the listKey gate and the notification would be missed.- items.forEach(function (item) {- var prev = prevUnread[item.chatId] || 0;- if (item.unread > 0 && item.unread > prev) {- api.emit('notify', {- title: 'LinkedIn: ' + (item.name || 'New message'),- body: item.preview || '',- tag: 'linkedin:' + item.chatId,- silent: false,- });- }- prevUnread[item.chatId] = item.unread;- });-- var listKey = JSON.stringify({- n: items.length,- first: items.slice(0, 5).map(function (i) { return i.name + '|' + i.preview; }),- });-- if (listKey !== lastListKey) {- lastListKey = listKey;-- // Redux store snapshot (legacy flat ingest for the accounts pane)- api.ingest({- messages: items.map(function (i) {- return { id: i.chatId, from: i.name, body: i.preview, unread: i.unread };- }),- snapshotKey: listKey,- });-- // Per-conversation-per-day memory ingest (list-level snippet only;- // written to :preview key so a richer thread ingest is never overwritten).- items.forEach(function (item) {- if (!item.preview) return;- api.emit('linkedin_conversation', {- chatId: item.chatId,- chatName: item.name,- day: today,- messages: [{- from: item.name,- body: item.preview,- timestamp: item.ts ? Math.floor(item.ts / 1000) : null,- fromMe: false,- }],- isSeed: false,- });- });- }- }-- // 2. Active thread — richer per-message ingest when a conversation is open- var thread = scrapeActiveThread();- if (thread && thread.msgs.length > 0) {- var threadKey = JSON.stringify({- chatId: thread.chatId,- count: thread.msgs.length,- last: thread.msgs[thread.msgs.length - 1].body.slice(0, 40),- });- if (threadKey !== lastThreadKey) {- lastThreadKey = threadKey;- api.emit('linkedin_conversation', {- chatId: thread.chatId,- chatName: null, // resolved from list on the service side if available- day: today,- messages: thread.msgs,- isSeed: true,- });- }- }-- // 3. Connection requests (only fires when on /mynetwork pages)- var requests = scrapeConnectionRequests();- if (requests) {- var requestsKey = JSON.stringify(requests.map(function (r) { return r.name; }));- if (requestsKey !== lastRequestsKey) {- lastRequestsKey = requestsKey;- api.emit('linkedin_requests', { requests: requests });- api.log('info', '[linkedin-recipe] connection requests: ' + requests.length);- }- }- });-- // ── send-message helper (callable via CDP Runtime.evaluate) ───────────────- // Usage: window.__linkedinSend("Hello!") → { ok: true } | { ok: false, error: "..." }- window.__linkedinSend = function (text) {- var input = document.querySelector([- '.msg-form__contenteditable',- '[data-placeholder*="message"][contenteditable]',- '[contenteditable="true"][role="textbox"]',- ].join(', '));- var sendBtn = document.querySelector([- '.msg-form__send-btn',- 'button[type="submit"][class*="send"]',- 'button[class*="msg-form__send"]',- ].join(', '));- if (!input) return { ok: false, error: 'compose input not found' };- if (!sendBtn) return { ok: false, error: 'send button not found' };- input.focus();- document.execCommand('insertText', false, text);- input.dispatchEvent(new Event('input', { bubbles: true }));- setTimeout(function () { sendBtn.click(); }, 100);- return { ok: true };- };-- api.log('info', '[linkedin-recipe] v0.3 ready');-})(window.__openhumanRecipe);diff --git a/app/src-tauri/recipes/outlook/icon.svg b/app/src-tauri/recipes/outlook/icon.svgdeleted file mode 100644index 047ee60450..0000000000--- a/app/src-tauri/recipes/outlook/icon.svg+++ /dev/null@@ -1,9 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">- <rect width="32" height="32" rx="4" fill="#fff"/>- <g transform="translate(4 7)">- <rect x="11" y="2" width="13" height="14" rx="1" fill="#0F6CBD"/>- <path fill="#fff" d="M24 5l-6.5 4L11 5V4l6.5 4L24 4z" opacity=".85"/>- <rect x="0" y="0" width="12" height="18" rx="2" fill="#0A4A7A"/>- <ellipse cx="6" cy="9" rx="3.2" ry="3.8" fill="none" stroke="#fff" stroke-width="1.6"/>- </g>-</svg>diff --git a/app/src-tauri/recipes/outlook/manifest.json b/app/src-tauri/recipes/outlook/manifest.jsondeleted file mode 100644index 7373b5622b..0000000000--- a/app/src-tauri/recipes/outlook/manifest.json+++ /dev/null@@ -1,7 +0,0 @@-{- "id": "outlook",- "name": "Outlook",- "version": "0.1.0",- "serviceURL": "https://outlook.live.com/mail/",- "icon": "icon.svg"-}diff --git a/app/src-tauri/recipes/slack/icon.svg b/app/src-tauri/recipes/slack/icon.svgdeleted file mode 100644index c1a056ed82..0000000000--- a/app/src-tauri/recipes/slack/icon.svg+++ /dev/null@@ -1,9 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">- <rect width="32" height="32" rx="4" fill="#fff"/>- <g transform="translate(5 5)">- <path fill="#E01E5A" d="M6 13a2 2 0 1 1-2-2h2v2zm1 0a2 2 0 1 1 4 0v5a2 2 0 1 1-4 0v-5z"/>- <path fill="#36C5F0" d="M9 6a2 2 0 1 1 2-2v2H9zm0 1a2 2 0 1 1 0 4H4a2 2 0 1 1 0-4h5z"/>- <path fill="#2EB67D" d="M16 9a2 2 0 1 1 2 2h-2V9zm-1 0a2 2 0 1 1-4 0V4a2 2 0 1 1 4 0v5z"/>- <path fill="#ECB22E" d="M13 16a2 2 0 1 1-2 2v-2h2zm0-1a2 2 0 1 1 0-4h5a2 2 0 1 1 0 4h-5z"/>- </g>-</svg>diff --git a/app/src-tauri/recipes/slack/manifest.json b/app/src-tauri/recipes/slack/manifest.jsondeleted file mode 100644index 8ee68e5f4f..0000000000--- a/app/src-tauri/recipes/slack/manifest.json+++ /dev/null@@ -1,7 +0,0 @@-{- "id": "slack",- "name": "Slack",- "version": "0.1.0",- "serviceURL": "https://app.slack.com/client/",- "icon": "icon.svg"-}diff --git a/app/src-tauri/recipes/telegram/icon.svg b/app/src-tauri/recipes/telegram/icon.svgdeleted file mode 100644index 8eb6fae937..0000000000--- a/app/src-tauri/recipes/telegram/icon.svg+++ /dev/null@@ -1,4 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">- <circle cx="16" cy="16" r="16" fill="#229ED9"/>- <path fill="#fff" d="M23.3 10.3 20 22.9c-.3 1-.9 1.2-1.8.8l-4.6-3.4-2.3 2.2c-.2.2-.4.5-1 .5l.4-4.8 8.5-7.7c.4-.3-.1-.5-.6-.2l-10.5 6.6-4.5-1.4c-1-.3-1-1 .2-1.5l17.6-6.8c.8-.3 1.5.2 1.8 1.4z"/>-</svg>diff --git a/app/src-tauri/recipes/telegram/manifest.json b/app/src-tauri/recipes/telegram/manifest.jsondeleted file mode 100644index 8d468c2a83..0000000000--- a/app/src-tauri/recipes/telegram/manifest.json+++ /dev/null@@ -1,7 +0,0 @@-{- "id": "telegram",- "name": "Telegram Web",- "version": "0.1.0",- "serviceURL": "https://web.telegram.org/k/",- "icon": "icon.svg"-}diff --git a/app/src-tauri/recipes/twitter/icon.svg b/app/src-tauri/recipes/twitter/icon.svgdeleted file mode 100644index 9fc8c5bf09..0000000000--- a/app/src-tauri/recipes/twitter/icon.svg+++ /dev/null@@ -1,4 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">- <rect width="32" height="32" rx="4" fill="#000"/>- <path fill="#fff" d="M18.9 14.5L25.1 7h-2.3l-5 6.1L13.6 7H7.5l6.5 9.5L7.5 25h2.3l5.4-6.5 4.3 6.5h6.1l-6.7-10zm-1.9 2.3l-.9-1.3-4.7-6.9h2.1l3.8 5.6.9 1.3 5 7.3h-2.1l-4-5.9z"/>-</svg>diff --git a/app/src-tauri/recipes/twitter/manifest.json b/app/src-tauri/recipes/twitter/manifest.jsondeleted file mode 100644index 2357fe9215..0000000000--- a/app/src-tauri/recipes/twitter/manifest.json+++ /dev/null@@ -1,7 +0,0 @@-{- "id": "twitter",- "name": "X (Twitter)",- "version": "0.1.0",- "serviceURL": "https://x.com/messages/",- "icon": "icon.svg"-}diff --git a/app/src-tauri/recipes/whatsapp/icon.svg b/app/src-tauri/recipes/whatsapp/icon.svgdeleted file mode 100644index 1948b0321d..0000000000--- a/app/src-tauri/recipes/whatsapp/icon.svg+++ /dev/null@@ -1,4 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">- <circle cx="16" cy="16" r="16" fill="#25D366"/>- <path d="M16 7.2c-4.86 0-8.8 3.94-8.8 8.8 0 1.55.41 3.07 1.18 4.4L7.2 24.8l4.5-1.18a8.78 8.78 0 0 0 4.3 1.1c4.86 0 8.8-3.94 8.8-8.8S20.86 7.2 16 7.2zm5.18 12.42c-.22.62-1.28 1.18-1.78 1.25-.46.06-1.04.09-1.68-.1-.39-.13-.88-.3-1.52-.57-2.67-1.15-4.42-3.84-4.55-4.02-.13-.18-1.09-1.45-1.09-2.77s.69-1.96.94-2.23c.25-.27.55-.34.74-.34s.37 0 .53.01c.17.01.4-.06.62.47.22.55.76 1.9.83 2.04.07.14.11.3.02.47-.09.18-.13.29-.27.45-.13.16-.28.36-.4.49-.13.13-.27.27-.12.54.15.27.66 1.09 1.42 1.77.97.86 1.79 1.13 2.06 1.27.27.13.42.11.58-.07.16-.18.66-.77.84-1.04.18-.27.36-.22.6-.13.25.09 1.55.73 1.82.86.27.13.45.2.51.31.06.11.06.66-.16 1.28z" fill="#fff"/>-</svg>diff --git a/app/src-tauri/recipes/whatsapp/manifest.json b/app/src-tauri/recipes/whatsapp/manifest.jsondeleted file mode 100644index 42f0aefb11..0000000000--- a/app/src-tauri/recipes/whatsapp/manifest.json+++ /dev/null@@ -1,8 +0,0 @@-{- "id": "whatsapp",- "name": "WhatsApp Web",- "version": "0.1.0",- "serviceURL": "https://web.whatsapp.com/",- "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",- "icon": "icon.svg"-}diff --git a/app/src-tauri/recipes/zoom/icon.svg b/app/src-tauri/recipes/zoom/icon.svgdeleted file mode 100644index c971be981b..0000000000--- a/app/src-tauri/recipes/zoom/icon.svg+++ /dev/null@@ -1,4 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">- <path d="M24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12z" fill="#2D8CFF"/>- <path d="M4 8.8h8.4c.88 0 1.6.72 1.6 1.6V15.2c0 .88-.72 1.6-1.6 1.6H4a.8.8 0 01-.8-.8V9.6c0-.44.36-.8.8-.8zm16.72-.4a.8.8 0 00-.8 0l-4.32 2.6a.8.8 0 00-.4.68v2.64c0 .28.16.56.4.68l4.32 2.6a.8.8 0 001.2-.68V9.08a.8.8 0 00-.4-.68z" fill="#fff"/>-</svg>diff --git a/app/src-tauri/recipes/zoom/manifest.json b/app/src-tauri/recipes/zoom/manifest.jsondeleted file mode 100644index d807e199b8..0000000000--- a/app/src-tauri/recipes/zoom/manifest.json+++ /dev/null@@ -1,7 +0,0 @@-{- "id": "zoom",- "name": "Zoom",- "version": "0.1.0",- "serviceURL": "https://zoom.us/",- "icon": "icon.svg"-}diff --git a/app/src-tauri/src/lib.rs b/app/src-tauri/src/lib.rsindex fc802f91fe..5f9a0895d6 100644--- a/app/src-tauri/src/lib.rs+++ b/app/src-tauri/src/lib.rs@@ -65,7 +65,6 @@ mod mcp_commands;mod native_notifications;#[cfg(target_os = "macos")]mod notch_window;-mod notification_settings;mod process_kill;mod process_recovery;mod ptt_hotkeys;@@ -73,7 +72,6 @@ mod ptt_overlay;#[cfg(target_os = "windows")]mod reset_reboot_schedule;mod stderr_panic_hook;-mod webview_apis;mod whatsapp_data;mod window_state;mod workspace_paths;@@ -1723,8 +1721,6 @@ fn perform_early_teardown_sync(app_handle: &AppHandle<AppRuntime>) {#[cfg(feature = "gateways")]tauri::async_runtime::block_on(gateway::registry::shutdown());- webview_apis::server::stop();-if let Some(core) = app_handle.try_state::<core_process::CoreProcessHandle>() {let core = core.inner().clone();// Aborts the embedded server task. Synchronous and safe on@@ -1762,8 +1758,6 @@ async fn perform_early_teardown_async(app_handle: &AppHandle<AppRuntime>) {#[cfg(feature = "gateways")]gateway::registry::shutdown().await;- webview_apis::server::stop();-if let Some(core) = app_handle.try_state::<core_process::CoreProcessHandle>() {let core = core.inner().clone();core.send_terminate_signal().await;@@ -2942,7 +2936,6 @@ pub fn run() {std::sync::Mutex::new(Vec::new()),)).manage(ptt_hotkeys::PttHotkeyState::new())- .manage(notification_settings::NotificationSettingsState::new()).manage(PendingAppUpdateState::default());let builder = builder.manage(std::sync::Arc::new(imessage_scanner::ScannerRegistry::new()));builder@@ -3036,32 +3029,6 @@ pub fn run() {deep_link_ipc::drain_pending_urls(app.app_handle());}- // Start the webview_apis WebSocket bridge BEFORE spawning core —- // core reads OPENHUMAN_WEBVIEW_APIS_PORT on first connect, and- // connects lazily, so the env var must be set before the spawn.- //- // If the bridge fails to bind we clear any inherited port env so- // the core child can't accidentally connect to whichever loopback- // process already owns that port, then abort setup — the bridge- // is load-bearing for every webview_apis RPC method.- let bridge_ok = tauri::async_runtime::block_on(async {- match webview_apis::start().await {- Ok(port) => {- std::env::set_var(webview_apis::server::PORT_ENV, port.to_string());- log::info!("[webview_apis] bridge ready on port {port}");- true- }- Err(err) => {- log::error!("[webview_apis] failed to start bridge: {err}");- std::env::remove_var(webview_apis::server::PORT_ENV);- false- }- }- });- if !bridge_ok {- return Err("webview_apis bridge failed to start — aborting setup".into());- }-// Purge stray LaunchAgent left over from a prior worktree's// `service install`. KeepAlive=true on the plist re-spawns the// daemon after every SIGKILL, fighting `ensure_running`'s@@ -3394,8 +3361,6 @@ pub fn run() {register_ptt_hotkey,unregister_ptt_hotkey,ptt_overlay::show_ptt_overlay,- notification_settings::notification_settings_get,- notification_settings::notification_settings_set,native_notifications::notification_permission_state,native_notifications::notification_permission_request,activate_main_window,@@ -3533,23 +3498,9 @@ pub fn run() {if let Some(window) = app_handle.get_webview_window("main") {window_state::save_main(&window);}- // Run our cleanup BEFORE CEF's own Exit handler does- // `close_all_windows() → cef::shutdown()`. Doing this in- // RunEvent::Exit instead races CEF's teardown and the- // `browser_count == 0` CHECK in `cef::shutdown` panics on- // macOS Cmd+Q (issue #920). The order matters:- // 1. close our child webviews so CEF processes the- // close requests during the Exit-phase message pump- // (gives them time to settle before cef::shutdown).- // 2. abort our long-lived tokio tasks so they're not- // driving CDP traffic against CEF as it tears down.- // 3. stop the webview_apis WS listener so its accept- // loop releases the loopback port.- // 4. SIGTERM the core sidecar (non-blocking). Tauri- // spawned the child so we own its lifecycle, but we- // do not wait — that would block the main thread- // and starve CEF's UI loop. The kernel reaps the- // child after Tauri exits.+ // Run cleanup during ExitRequested so the embedded core and+ // long-lived scanner tasks stop before the runtime exits.+ // Teardown stays non-blocking on the main thread.perform_early_teardown_sync_once(app_handle, "exit_requested");}RunEvent::Exit => {diff --git a/app/src-tauri/src/notification_settings/mod.rs b/app/src-tauri/src/notification_settings/mod.rsdeleted file mode 100644index 63fd6967b0..0000000000--- a/app/src-tauri/src/notification_settings/mod.rs+++ /dev/null@@ -1,85 +0,0 @@-//! Shell-side runtime toggle for webview-originated OS notifications.-//!-//! The embedded webviews (Slack, Discord, Telegram, …) can fire native OS-//! notifications via the CEF IPC hook in `webview_accounts`. This domain-//! owns the on/off switch. Default is ON so embedded SaaS webviews like-//! Slack behave like a normal browser session and surface native-//! notifications immediately after connection.-//!-//! State lives in the Tauri shell rather than the core sidecar so the-//! settings UI can flip it without a JSON-RPC round-trip. Persistence is-//! frontend-side (Redux/localStorage) — on boot the React side reads its-//! persisted value and pushes it down via `notification_settings_set`.--use std::sync::atomic::{AtomicBool, Ordering};--use serde::{Deserialize, Serialize};--/// Tauri-managed state holding the current feature-flag value.-///-/// Wrapped in an `AtomicBool` so reads from the CEF notification-/// callback (which runs on a CEF thread, not the Tauri runtime thread)-/// stay lock-free.-pub struct NotificationSettingsState {- enabled: AtomicBool,-}--impl NotificationSettingsState {- /// Construct the initial state. Embedded webview notifications default- /// to **enabled** so provider permission grant immediately results in- /// visible OS toasts unless the user later opts into DND/muting.- pub fn new() -> Self {- Self {- enabled: AtomicBool::new(true),- }- }-- /// Current feature-flag value.- pub fn enabled(&self) -> bool {- self.enabled.load(Ordering::Relaxed)- }-- /// Update the feature-flag value. Returns the previous value so- /// callers can log a single line about the transition if they want.- pub fn set_enabled(&self, value: bool) -> bool {- self.enabled.swap(value, Ordering::Relaxed)- }-}--impl Default for NotificationSettingsState {- fn default() -> Self {- Self::new()- }-}--/// Payload returned to the frontend.-#[derive(Debug, Clone, Copy, Serialize, Deserialize)]-pub struct NotificationSettingsPayload {- pub enabled: bool,-}--/// Read the current notification feature-flag value.-#[tauri::command]-pub fn notification_settings_get(- state: tauri::State<'_, NotificationSettingsState>,-) -> NotificationSettingsPayload {- NotificationSettingsPayload {- enabled: state.enabled(),- }-}--/// Update the current notification feature-flag value. Returns the new-/// value so the caller can round-trip confirm.-#[tauri::command]-pub fn notification_settings_set(- state: tauri::State<'_, NotificationSettingsState>,- enabled: bool,-) -> NotificationSettingsPayload {- let prev = state.set_enabled(enabled);- log::info!(- "[notify-settings] feature-flag transition enabled={} (was {})",- enabled,- prev- );- NotificationSettingsPayload { enabled }-}diff --git a/app/src-tauri/src/webview_apis/mod.rs b/app/src-tauri/src/webview_apis/mod.rsdeleted file mode 100644index 1b82f5efa1..0000000000--- a/app/src-tauri/src/webview_apis/mod.rs+++ /dev/null@@ -1,47 +0,0 @@-//! Webview APIs bridge — Tauri side (server).-//!-//! Exposes the connector APIs that live in the Tauri shell (future:-//! Notion, Slack, …) to the core sidecar over a local WebSocket on-//! `127.0.0.1`. Core-side handlers in `src/openhuman/webview_apis/`-//! connect as a client and proxy JSON-RPC calls through this bridge-//! so curl against the core's RPC port reaches the live webview-//! session. The bridge currently has no registered methods; the-//! Gmail embedded-webview connector that previously lived here has-//! been retired so the webview-account flow can stay focused on-//! social / messaging surfaces.-//!-//! ## Protocol-//!-//! JSON text frames, one envelope per frame:-//!-//! ```text-//! request: { "kind": "request", "id": "...", "method": "<connector>.<action>",-//! "params": { "account_id": "…" } }-//! response: { "kind": "response", "id": "...", "ok": true, "result": <json> }-//! response: { "kind": "response", "id": "...", "ok": false, "error": "…" }-//! ```-//!-//! The server is permissive: it accepts requests from any connection on-//! loopback (the spawned core process is the only one expected, but we-//! don't authenticate — the port is never bound to a public interface).-//!-//! ## Startup / port coordination-//!-//! The server always binds `127.0.0.1:0` and lets the OS pick an-//! ephemeral port. The resolved port is exposed via [`resolved_port`]-//! and pushed into the core sidecar's environment as-//! `OPENHUMAN_WEBVIEW_APIS_PORT` by `core_process::spawn_core` so the-//! client side can find it.-//!-//! `OPENHUMAN_WEBVIEW_APIS_PORT` is an **output** of the bridge — it is-//! intentionally never read as input. Honouring a pre-existing value-//! was the cause of Sentry OPENHUMAN-TAURI-82 on Windows: a stale env-//! value left over from a prior run (or inherited from a parent-//! process) led the next launch to re-bind the exact same port and-//! fail with WSAEADDRINUSE (`os error 10048`).--pub mod router;-pub mod server;--#[allow(unused_imports)]-pub use server::{resolved_port, start};diff --git a/app/src-tauri/src/webview_apis/router.rs b/app/src-tauri/src/webview_apis/router.rsdeleted file mode 100644index b3ab93dc6d..0000000000--- a/app/src-tauri/src/webview_apis/router.rs+++ /dev/null@@ -1,43 +0,0 @@-//! Method dispatch for webview_apis requests.-//!-//! Maps a protocol method name to the Rust function that handles it.-//! Currently empty — the only consumer was the Gmail embedded-webview-//! bridge, which has been retired so the webview-account flow can stay-//! focused on social / messaging surfaces. Future connectors that want-//! to expose CDP-driven actions through the bridge plug their handlers-//! into [`dispatch_inner`] here.--use serde_json::{Map, Value};--/// Dispatch a single webview_apis request to its handler. Returns the-/// `result` JSON on success or a string error that the server relays-/// back as `{ ok: false, error }`.-///-/// Outcome logging lives here so the bridge has a single chokepoint-/// for success/failure traces — callers (tests, the WS server) keep-/// their own entry/exit logs but rely on this function to summarise-/// each dispatch decision.-pub async fn dispatch(method: &str, params: Map<String, Value>) -> Result<Value, String> {- log::debug!("[webview_apis] dispatch method={method}");- let out = dispatch_inner(method, params).await;- match &out {- Ok(_) => log::debug!("[webview_apis] dispatch ok method={method}"),- Err(e) => log::warn!("[webview_apis] dispatch err method={method} error={e}"),- }- out-}--async fn dispatch_inner(method: &str, _params: Map<String, Value>) -> Result<Value, String> {- Err(format!("unknown webview_apis method: {method}"))-}--#[cfg(test)]-mod tests {- use super::*;-- #[tokio::test]- async fn unknown_method_is_rejected() {- let err = dispatch("something.else", Map::new()).await.unwrap_err();- assert!(err.contains("unknown webview_apis method"));- }-}diff --git a/app/src-tauri/src/webview_apis/server.rs b/app/src-tauri/src/webview_apis/server.rsdeleted file mode 100644index a538fe9f1a..0000000000--- a/app/src-tauri/src/webview_apis/server.rs+++ /dev/null@@ -1,334 +0,0 @@-//! WebSocket server for the webview_apis bridge.-//!-//! Binds a loopback TCP socket, accepts incoming connections (one per-//! core sidecar instance), and for each frame: decode → route → encode-//! response. Any number of concurrent requests per connection: each is-//! spawned as its own task and the responses are serialised back over-//! the shared sink via an mpsc.--use std::net::SocketAddr;-use std::sync::atomic::{AtomicU16, Ordering};-use std::sync::{Mutex, OnceLock};-use std::time::Duration;--use futures_util::{SinkExt, StreamExt};-use serde::{Deserialize, Serialize};-use serde_json::{Map, Value};-use tokio::net::TcpListener;-use tokio::sync::mpsc;-use tokio::task::JoinHandle;-use tokio_tungstenite::tungstenite::Message;--use super::router;--/// Env var the Tauri host writes (before spawning core) and core reads-/// (in `src/openhuman/webview_apis/client.rs`) so both agree on the-/// port without a discovery round-trip.-pub const PORT_ENV: &str = "OPENHUMAN_WEBVIEW_APIS_PORT";--/// The port the server is bound to. `0` before `start()` resolves it.-static RESOLVED_PORT: AtomicU16 = AtomicU16::new(0);-static STARTED: OnceLock<()> = OnceLock::new();-/// Handle to the accept loop spawned by `start()`. Held so `stop()` can-/// abort the loop on app shutdown — without this the loop owns the-/// `TcpListener` and keeps the loopback port bound past tokio runtime-/// drop, which on macOS contributes to the "abnormal exit" the OS-/// reports against the app process (issue #920).-static ACCEPT_LOOP: OnceLock<Mutex<Option<JoinHandle<()>>>> = OnceLock::new();--pub fn resolved_port() -> u16 {- RESOLVED_PORT.load(Ordering::SeqCst)-}--/// Start the server. Idempotent: after the first successful call any-/// subsequent call is a no-op. Returns the bound port.-///-/// Port selection: always bind `127.0.0.1:0` and let the OS pick an-/// ephemeral port. The resolved port is then exported via `PORT_ENV`-/// (by the caller in `lib.rs`) so the core sidecar can discover it.-///-/// We deliberately ignore any pre-existing `PORT_ENV` value here:-/// honouring it caused Sentry OPENHUMAN-TAURI-82 on Windows — if a-/// previous run wrote `PORT_ENV=49342` into the user's environment-/// (or the env was inherited from a parent process / leftover dev-/// session), the next launch would attempt to re-bind that exact-/// port and fail with WSAEADDRINUSE / os error 10048 whenever the-/// socket was still held by another process or stuck in TIME_WAIT.-/// `PORT_ENV` is an *output* of the bridge, not an input.-pub async fn start() -> Result<u16, String> {- if STARTED.get().is_some() {- return Ok(resolved_port());- }-- let addr: SocketAddr = "127.0.0.1:0"- .parse()- .map_err(|e| format!("[webview_apis] bad addr: {e}"))?;- let listener = TcpListener::bind(addr)- .await- .map_err(|e| format!("[webview_apis] bind {addr} failed: {e}"))?;- let bound = listener- .local_addr()- .map_err(|e| format!("[webview_apis] local_addr: {e}"))?;- let port = bound.port();- RESOLVED_PORT.store(port, Ordering::SeqCst);- let _ = STARTED.set(());-- log::info!("[webview_apis] server listening on {bound} (OS-assigned ephemeral)");-- let accept_handle = tokio::spawn(async move {- loop {- match listener.accept().await {- Ok((stream, peer)) => {- log::info!("[webview_apis] accepted connection from {peer}");- tokio::spawn(async move {- if let Err(e) = handle_connection(stream).await {- log::warn!("[webview_apis] connection {peer} ended: {e}");- } else {- log::info!("[webview_apis] connection {peer} closed cleanly");- }- });- }- Err(e) => {- log::warn!("[webview_apis] accept failed: {e}");- tokio::time::sleep(Duration::from_millis(200)).await;- }- }- }- });- let slot = ACCEPT_LOOP.get_or_init(|| Mutex::new(None));- if let Ok(mut g) = slot.lock() {- *g = Some(accept_handle);- }-- Ok(port)-}--/// Abort the accept loop and release the loopback port. Idempotent.-///-/// Called from the app's `RunEvent::Exit` shutdown path so the listener-/// task doesn't outlive the tokio runtime / surrounding `AppHandle` —-/// see issue #920.-pub fn stop() {- let Some(slot) = ACCEPT_LOOP.get() else {- return;- };- let handle = match slot.lock() {- Ok(mut g) => g.take(),- Err(_) => return,- };- if let Some(h) = handle {- h.abort();- log::info!("[webview_apis] accept loop aborted");- }-}--async fn handle_connection(stream: tokio::net::TcpStream) -> Result<(), String> {- let ws = tokio_tungstenite::accept_async(stream)- .await- .map_err(|e| format!("ws handshake: {e}"))?;- let (mut sink, mut stream) = ws.split();-- // Responses from per-request tasks fan in here and are written back- // in order. 32 is plenty — the core sidecar issues one request at a- // time per op in the common path.- let (tx, mut rx) = mpsc::channel::<String>(32);-- let writer = tokio::spawn(async move {- while let Some(msg) = rx.recv().await {- if let Err(e) = sink.send(Message::Text(msg)).await {- log::warn!("[webview_apis] ws send failed: {e}");- break;- }- }- });-- while let Some(msg) = stream.next().await {- match msg {- Ok(Message::Text(text)) => {- let tx = tx.clone();- tokio::spawn(async move {- let reply = handle_frame(&text).await;- if let Err(_e) = tx.send(reply).await {- log::warn!("[webview_apis] response channel closed before send");- }- });- }- Ok(Message::Binary(_)) => {- log::debug!("[webview_apis] ignoring binary frame");- }- Ok(Message::Ping(p)) => {- // tungstenite auto-responds to Ping at the protocol layer;- // log for visibility.- log::trace!("[webview_apis] ping {} bytes", p.len());- }- Ok(Message::Close(_)) => {- log::debug!("[webview_apis] peer requested close");- break;- }- Ok(_) => {}- Err(e) => {- return Err(format!("ws recv: {e}"));- }- }- }-- drop(tx);- let _ = writer.await;- Ok(())-}--async fn handle_frame(text: &str) -> String {- let envelope: Request = match serde_json::from_str(text) {- Ok(v) => v,- Err(e) => {- log::warn!("[webview_apis] bad request frame: {e}");- return encode_response(Response::error("<unknown>", format!("bad frame: {e}")));- }- };- if envelope.kind != "request" {- return encode_response(Response::error(- &envelope.id,- format!("unsupported envelope kind '{}'", envelope.kind),- ));- }- let params = envelope.params.unwrap_or_default();- let started = std::time::Instant::now();- let result = router::dispatch(&envelope.method, params).await;- let ms = started.elapsed().as_millis();- match result {- Ok(value) => {- log::debug!(- "[webview_apis] {} id={} ok in {ms}ms",- envelope.method,- envelope.id- );- encode_response(Response::ok(&envelope.id, value))- }- Err(e) => {- log::warn!(- "[webview_apis] {} id={} err in {ms}ms: {e}",- envelope.method,- envelope.id- );- encode_response(Response::error(&envelope.id, e))- }- }-}--fn encode_response(resp: Response) -> String {- serde_json::to_string(&resp).unwrap_or_else(|e| {- format!(- r#"{{"kind":"response","id":"{}","ok":false,"error":"response encode failed: {}"}}"#,- resp.id,- e.to_string().replace('"', "\\\"")- )- })-}--// ── envelope types ──────────────────────────────────────────────────────--#[derive(Debug, Deserialize)]-struct Request {- kind: String,- id: String,- method: String,- #[serde(default)]- params: Option<Map<String, Value>>,-}--#[derive(Debug, Serialize)]-struct Response {- kind: &'static str,- id: String,- ok: bool,- #[serde(skip_serializing_if = "Option::is_none")]- result: Option<Value>,- #[serde(skip_serializing_if = "Option::is_none")]- error: Option<String>,-}--impl Response {- fn ok(id: &str, result: Value) -> Self {- Self {- kind: "response",- id: id.to_string(),- ok: true,- result: Some(result),- error: None,- }- }-- fn error(id: &str, error: impl Into<String>) -> Self {- Self {- kind: "response",- id: id.to_string(),- ok: false,- result: None,- error: Some(error.into()),- }- }-}--#[cfg(test)]-mod tests {- use super::*;-- /// Regression test for Sentry OPENHUMAN-TAURI-82.- ///- /// If `PORT_ENV` carries a stale value pointing at a port that is- /// already in use (the failure mode reported on Windows: a previous- /// run wrote `49342` into the env, then the same port was held by- /// another process / stuck in TIME_WAIT), `start()` must still- /// succeed by binding a fresh OS-assigned ephemeral port instead of- /// trying to re-bind the stale port.- // Single-threaded runtime: `std::env::set_var` mutates process-global- // state and is not thread-safe in Rust. Under the default multi-threaded- // tokio test runtime, threads spawned by the same test could observe- // the env between `set_var` and the restore. `current_thread` eliminates- // that intra-test window (cross-test races between OS threads from- // OTHER tests are still possible — see the save/restore pattern below- // for that part). Per graycyrus review on PR #1543.- #[tokio::test(flavor = "current_thread")]- async fn start_ignores_stale_port_env_and_binds_ephemeral() {- // Occupy a port so `PORT_ENV` points at something that would- // definitely fail if `start()` honoured it.- let blocker = TcpListener::bind("127.0.0.1:0")- .await- .expect("blocker bind");- let stale_port = blocker.local_addr().expect("blocker addr").port();- // Save+restore `PORT_ENV` so parallel tests in the same process- // don't see this test's mutation. (Per CodeRabbit feedback on PR- // #1543.) `std::env::set_var` is process-global; without the- // restore, an unrelated test asserting on `PORT_ENV` could observe- // `stale_port` and flake.- let prev_port_env = std::env::var(PORT_ENV).ok();- std::env::set_var(PORT_ENV, stale_port.to_string());-- let bound = start()- .await- .expect("start should succeed despite stale PORT_ENV");-- assert_ne!(- bound, stale_port,- "start() must pick a fresh ephemeral port, not the stale one in PORT_ENV"- );- assert_eq!(resolved_port(), bound);-- // Hold `blocker` until after `start()` so the kernel definitely- // can't satisfy a bind on `stale_port` — defends against the- // exact race the Sentry issue describes.- drop(blocker);- // Note: `stop()` only aborts the accept loop — it does NOT (and- // cannot) reset the `STARTED` OnceLock. If a second test in this- // binary later calls `start()` it'll hit the idempotency- // early-return and silently observe this test's port. A future- // refactor to `AtomicBool`-based singleton would let `stop()`- // fully tear down. Tracked as graycyrus feedback on PR #1543;- // currently inert because this is the only test in the module.- stop();- match prev_port_env {- Some(v) => std::env::set_var(PORT_ENV, v),- None => std::env::remove_var(PORT_ENV),- }- }-}diff --git a/app/src-tauri/tauri.conf.json b/app/src-tauri/tauri.conf.jsonindex e14e31ce8f..2d95e5f55a 100644--- a/app/src-tauri/tauri.conf.json+++ b/app/src-tauri/tauri.conf.json@@ -46,10 +46,7 @@"icons/icon.icns","icons/icon.ico"],- "resources": [- "../../src/openhuman/agent/prompts",- "recipes/**/*"- ],+ "resources": ["../../src/openhuman/agent/prompts"],"linux": {"deb": {"depends": [