mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-29 14:02:19 +00:00
* feat(webview_accounts): native OS notifications from embedded webviews (#714) Forward CEF notification intercept payloads to tauri-plugin-notification, prefixing the title with the provider label so the source of each toast is obvious at a glance. Honour `silent` (skip toast, still record route), `icon` (passed through to the native builder), and `tag` (used as the dedup key, with a monotonic timestamp fallback for untagged payloads). Record a NotificationRoute keyed by `{provider}:{account_id}:{tag_or_uuid}` so a future click hook (UNUserNotificationCenter / notify-rust on_response) can route the OS click back to the source account. Entries are cleared on webview_account_close / _purge to bound map growth. Expose webview_notification_permission_state / _request commands mapping tauri::plugin::PermissionState onto the web API triple. Non-cef stubs return "default" so the frontend can call the same invoke names on both runtimes. Wire notification:allow-* capabilities so the plugin can be invoked from the webview. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(accounts): wire notification permission + click bridge (#714) Round-trip the OS notification permission once per session on first account open via the new invoke pair. Attach a dormant notification:click listener that dispatches setActiveAccount and brings the main window to front when a platform click hook starts emitting the event — contract matches the Rust NotificationRoute shape so the emit side is a one-liner. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: sync Cargo.lock to 0.52.26 after version bump Lockfile picked up the pending 0.52.26 version bump from Cargo.toml while building the notification feature. No dependency graph change. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(notifications): add notification bypass for embedded webview apps (#679) - Add NotificationBypassPrefs (global DND, per-account mute, bypass-when-focused) to WebviewAccountsState with thread-safe AtomicBool window focus tracking - Evaluate all three bypass conditions inside forward_native_notification before showing OS toast; each suppression path logs at debug with [notify-bypass] prefix - Add four new Tauri commands: webview_notification_set_dnd, webview_notification_mute_account, webview_notification_get_bypass_prefs, webview_set_focused_account - Wire window focus tracking in setup hook via on_window_event Focused handler - Frontend: add setAccountMuted, setGlobalDnd, getBypassPrefs, setFocusedAccount helpers in webviewAccountService; sync focused account on open + click - Add NotificationsPanel settings page with Global DND toggle - Register NotificationsPanel at /settings/notifications Closes #679 * feat(notifications): integrate notifications feature into app - Added Notifications page and routing to AppRoutes. - Introduced NotificationRoutingPanel in Settings for managing notification settings. - Updated SettingsHome to include navigation for notification routing. - Integrated notifications reducer into the store for state management. - Enhanced Rust backend to support notification handling from embedded webviews. This commit lays the groundwork for a comprehensive notification system within the application. * refactor(notifications): clean up code formatting and structure - Simplified JSX structure in NotificationCard for better readability. - Consolidated fetchNotifications call in NotificationCenter for cleaner syntax. - Improved formatting in NotificationRoutingPanel and notificationsSlice for consistency. - Enhanced Rust code readability by streamlining function signatures and logic. These changes enhance code maintainability and readability across the notifications feature. * refactor(webview_accounts): simplify webview_notification_set_dnd function signature - Removed unnecessary line breaks in the webview_notification_set_dnd function for improved readability. * feat(notifications): implement provider-level notification settings management - Added `getNotificationSettings` and `setNotificationSettings` functions to manage notification settings for providers. - Enhanced `NotificationRoutingPanel` to display and update settings for Gmail, Slack, Discord, and WhatsApp. - Introduced new RPC endpoints for retrieving and updating notification settings. - Updated database schema to store notification settings persistently. This commit establishes a robust system for managing notification preferences, improving user control over notifications. * refactor(notifications): improve code formatting and readability - Enhanced formatting in NotificationRoutingPanel for better clarity. - Streamlined function signatures in notificationService and Rust backend. - Improved readability of assertions in tests by adjusting line breaks. These changes contribute to a more maintainable and comprehensible codebase for the notifications feature. * chore(vendor): bump tauri-cef to fix Slack notification permission banner Updates the tauri-cef submodule to 55db2d6 which adds a navigator.permissions.query shim in the CEF render process. Slack checks this API (not just Notification.permission) to decide whether to show its "needs your permission" banner — the shim returns "granted" for notifications queries so the banner no longer appears. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(vendor): bump tauri-cef for cargo fmt fixes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(vendor): bump tauri-cef — native V8 permissions.query shim Switches from context.eval() to a proper PermissionsQueryV8Handler so the navigator.permissions.query fix actually runs in on_context_created. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(notifications): patch navigator.permissions.query in ua_spoof.js The V8 set_value_bykey approach in cef-helper's on_context_created does not stick on CEF platform objects (Chromium's V8 binding layer silently ignores property writes on native wrappers like Permissions). The init script path via frame.execute_java_script runs in the fully-initialised JS context where navigator.permissions IS writable, matching how ua_spoof.js already overrides navigator.userAgent successfully. Slack checks navigator.permissions.query({ name: 'notifications' }) before showing its "needs permission" banner — patching it here to return "granted" removes the banner. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(notifications): use Object.defineProperty to shim navigator.permissions Two-layer fix for the Slack "needs permission to enable notifications" banner: 1. cef-helper (submodule update to 99a2686): context.eval() in on_context_created installs Object.defineProperty(navigator, 'permissions', ...) before any page JS runs. 2. ua_spoof.js: same Object.defineProperty pattern as belt-and-suspenders for frames that reload or trigger permission checks after on_load_end. Simple property assignment on Blink platform objects is silently ignored; Object.defineProperty on the navigator wrapper itself (the same mechanism already used for navigator.userAgent) works correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(notifications): address CodeRabbit review issues on PR #727 - Move raw_title out of log::info! (PII risk) — log title_chars at info, raw_title at debug only - Fix permissionChecked set before async invoke in ensureNotificationPermission so transient failures allow retry on next account open * fix(cef): enable webview-data-url feature for CEF placeholder URL The CEF backend uses a data: URL as the initial webview location so CDP can attach before the real provider URL loads. Tauri's add_child rejects data: URLs unless the webview-data-url feature is enabled. * fix(notifications): address remaining CodeRabbit issues on PR #727 - cdp/emulation: bump Chrome UA 124→136 to pass Slack browser check - cdp/session: inject Page.addScriptToEvaluateOnNewDocument to stub Notification.permission as "granted" and silence provider banners - notifications/mod.rs + core/all.rs: wire notifications domain into the controller registry (fixes unknown-method in json_rpc_e2e tests) - notifications/schemas: add skipped bool output to ingest schema - notifications/store: add tracing::warn on datetime parse failure - notificationService: union return type for ingestNotification - webviewAccountService: narrow union before accessing result.id - NotificationCenter: drive loading/error from fetch effect; track allProviders separately so filter pills don't collapse on selection - NotificationRoutingPanel: rollback optimistic update on save failure - useSettingsNavigation: add notifications/notification-routing routes - scripts/install.sh: remove silent dry-run exit 0 on asset failure - scripts/setup-dev-codesign.sh: remove unconditional -legacy flag - docs/SUMMARY.md: remove worktree path, fix macOS capitalisation, remove self-referential deletion note * chore: apply prettier + cargo fmt + fix useEffect dep warning Auto-apply formatting changes flagged by the pre-push hook: - prettier reformatted NotificationCenter.tsx and notificationService.ts - cargo fmt reformatted all.rs, openhuman/mod.rs, notifications/schemas.rs - NotificationRoutingPanel: move providers array to module scope so useEffect dependency array is satisfied without exhaustive-deps warning * feat(notifications): enhance notification management and permissions - Added new commands for managing notification preferences, including setting global Do Not Disturb (DND), muting specific accounts, and retrieving current bypass preferences. - Implemented a notification permission state handler to ensure consistent behavior across different environments. - Updated the JavaScript shim for notification permissions to handle both Notification and PushManager states, ensuring compatibility with various providers. - Refactored the WebviewAccountsState to include a new structure for managing notification bypass preferences, improving the overall notification handling logic. * update agents * fix(notifications): complete schema + navigation metadata for ingest/settings routes - app/src/components/settings/hooks/useSettingsNavigation.ts: resolve the new `/settings/notifications` and `/settings/notification-routing` URLs to their SettingsRoute values and feed them into breadcrumbs so the new panels don't silently fall through to `'home'`. Addresses CodeRabbit on useSettingsNavigation.ts:34. - src/openhuman/notifications/schemas.rs: add the optional `reason` output on `notification.ingest` (populated alongside `skipped=true` by the runtime) and the normalized `settings` output on `notification.settings_set` so schema-driven clients see the full response shape. Addresses CodeRabbit on schemas.rs:103 and schemas.rs:217. - src/core/all.rs: add a `notification` namespace_description so CLI help covers the new controllers, plus a test assertion. Addresses CodeRabbit on src/core/all.rs:149. * fix(notifications): trace DB entry, surface empty update matches, warn on bad scored_at - Add `tracing::trace!` checkpoints around the `with_connection` DB open and schema migration so notification-delivery issues are reconstructible from logs. - `update_triage` and `mark_read` now inspect `Connection::execute`'s affected-row count: log a `warn!` when the update matched zero rows (row deleted between ingest and scoring / client passed a stale id), `debug!` on the normal path. - `scored_at` parsing no longer silently drops malformed values — log a `warn!` with the raw value and parse error before treating the row as unscored, matching the existing behavior for `received_at`. Addresses CodeRabbit on store.rs (lines 72, 172, 294). * fix(webview): respect silent notifications, multi-host CDP fallback, shim idempotency - webview_accounts/mod.rs: honor the Web Notification `silent` flag. Previously we only logged it and still called `builder.show()`, so pages that marked a notification silent still produced an OS toast. Mirror event still fires so the in-app center updates; only the OS toast is suppressed. Also picks up a prior cargo-fmt rewrap. - cdp/target.rs: `browser_ws_url()` now continues the host loop when `resp.json()` fails instead of early-returning via `?`. A malformed response from the first host (CDP_HOST) no longer prevents the `localhost` fallback from being tried. - webview_accounts/ua_spoof.js: guard the Notification wrapper behind `window.__OH_NOTIF_SHIM` so repeated evaluations of the script (Page.addScriptToEvaluateOnNewDocument + frame-level re-injections) don't stack wrappers onto the same page globals or re-proxy `Function.prototype.toString`. Addresses CodeRabbit on webview_accounts/mod.rs:377, cdp/target.rs:33, and ua_spoof.js:176. * update agents * update --------- Co-authored-by: oxoxDev <nikhil@tinyhumans.ai> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
140 lines
6.0 KiB
TOML
140 lines
6.0 KiB
TOML
[package]
|
|
name = "OpenHuman"
|
|
version = "0.52.28"
|
|
description = "OpenHuman - AI-powered Super Assistant"
|
|
authors = ["OpenHuman"]
|
|
edition = "2021"
|
|
default-run = "OpenHuman"
|
|
autobins = false
|
|
|
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
|
|
[lib]
|
|
# The `_lib` suffix may seem redundant but it is necessary
|
|
# to make the lib name unique and wouldn't conflict with the bin name.
|
|
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
|
|
name = "openhuman"
|
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
|
|
|
[[bin]]
|
|
name = "OpenHuman"
|
|
path = "src/main.rs"
|
|
|
|
[build-dependencies]
|
|
tauri-build = { version = "2", features = [] }
|
|
serde_json = "1"
|
|
|
|
[dependencies]
|
|
# Tauri core and plugins.
|
|
#
|
|
# Default build uses the CEF (Chromium Embedded Framework) backend via
|
|
# `tauri-runtime-cef` — CI builds, release installers, and local `cargo tauri
|
|
# dev` all run against CEF. The `[patch.crates-io]` block at the bottom of this
|
|
# file pins every tauri crate and plugin to the `feat/cef` branch on github so
|
|
# CEF symbols are in scope, and `cef-dll-sys`'s build script auto-downloads the
|
|
# Chromium runtime for the current target on first build. Contributors who
|
|
# need the stock `wry` backend (WKWebView on macOS, WebView2 on Windows,
|
|
# WebKitGTK on Linux) can opt out with `--no-default-features --features wry`.
|
|
tauri = { version = "2.10", default-features = false, features = [
|
|
"common-controls-v6",
|
|
"macos-private-api",
|
|
"tray-icon",
|
|
"unstable",
|
|
"webview-data-url",
|
|
] }
|
|
tauri-plugin-deep-link = "2.0.0"
|
|
tauri-plugin-global-shortcut = "2"
|
|
tauri-plugin-notification = "2"
|
|
tauri-plugin-opener = "2"
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
tokio = { version = "1", features = ["rt-multi-thread", "process", "sync", "time", "net"] }
|
|
# WebSocket client for the Chrome DevTools Protocol (used to talk to the
|
|
# embedded CEF instance over `--remote-debugging-port=9222` and read
|
|
# IndexedDB / drive `Runtime.evaluate` for the WhatsApp recipe).
|
|
tokio-tungstenite = { version = "0.24", default-features = false, features = ["connect"] }
|
|
futures-util = { version = "0.3", default-features = false, features = ["sink", "std"] }
|
|
|
|
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
|
|
semver = "1"
|
|
|
|
log = "0.4"
|
|
env_logger = "0.11"
|
|
|
|
# Used by the imessage_scanner module.
|
|
anyhow = "1.0"
|
|
parking_lot = "0.12"
|
|
chrono = "0.4"
|
|
async-trait = "0.1"
|
|
# Direct CEF + tauri-runtime-cef dependencies (used only with `--features cef`).
|
|
# `tauri-runtime-cef::notification::register` is how we hook native Web
|
|
# Notification interception per webview, and `cef::Browser` is what we downcast
|
|
# from the boxed handle returned by `Webview::with_webview`. tauri-runtime-cef
|
|
# isn't published to crates.io — we vendor the whole tauri fork as a submodule
|
|
# at `vendor/tauri-cef` and reference the crate by path.
|
|
tauri-runtime-cef = { path = "vendor/tauri-cef/crates/tauri-runtime-cef", optional = true }
|
|
cef = { version = "=146.4.1", default-features = false, optional = true }
|
|
|
|
[target.'cfg(unix)'.dependencies]
|
|
nix = { version = "0.29", default-features = false, features = ["signal"] }
|
|
|
|
[target.'cfg(target_os = "macos")'.dependencies]
|
|
objc2 = "0.6"
|
|
objc2-app-kit = "0.3.2"
|
|
|
|
# iMessage scanner reads ~/Library/Messages/chat.db read-only on macOS.
|
|
rusqlite = { version = "0.37", features = ["bundled"] }
|
|
|
|
[features]
|
|
# Default runtime is CEF (bundled Chromium). The `wry` feature swaps in the
|
|
# OS-native webview backend. The two are mutually exclusive — the `feat/cef`
|
|
# branch re-exports `webview_version` from both runtime crates without cfg
|
|
# gates, so enabling both at once fails to compile. Users opt out of CEF with
|
|
# `--no-default-features --features wry`.
|
|
default = ["cef"]
|
|
wry = ["tauri/wry"]
|
|
cef = ["tauri/cef", "tauri/devtools", "dep:tauri-runtime-cef", "dep:cef"]
|
|
# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!!
|
|
custom-protocol = ["tauri/custom-protocol"]
|
|
sandbox-bubblewrap = []
|
|
|
|
[patch.crates-io]
|
|
# CEF support lives on the `feat/cef` branch of tauri-apps/tauri. We carry our
|
|
# own fork at tinyhumansai/tauri-cef on `feat/cef-notification-intercept` which
|
|
# adds native Web Notifications interception — `tauri-runtime-cef::notification`
|
|
# (browser-process callback registry) plus `cef-helper` patching `window.Notification`
|
|
# and `ServiceWorkerRegistration.prototype.showNotification` from the renderer
|
|
# side. The fork is vendored as a git submodule at `vendor/tauri-cef`; the
|
|
# submodule's recorded commit is the pin.
|
|
#
|
|
# Plugins still patch from upstream tauri-apps/plugins-workspace@feat/cef — the
|
|
# fork is tauri-only.
|
|
tauri = { path = "vendor/tauri-cef/crates/tauri" }
|
|
tauri-build = { path = "vendor/tauri-cef/crates/tauri-build" }
|
|
tauri-utils = { path = "vendor/tauri-cef/crates/tauri-utils" }
|
|
tauri-macros = { path = "vendor/tauri-cef/crates/tauri-macros" }
|
|
tauri-runtime = { path = "vendor/tauri-cef/crates/tauri-runtime" }
|
|
tauri-runtime-wry = { path = "vendor/tauri-cef/crates/tauri-runtime-wry" }
|
|
tauri-plugin = { path = "vendor/tauri-cef/crates/tauri-plugin" }
|
|
|
|
# Pinned to a specific commit on plugins-workspace@feat/cef so fresh
|
|
# dependency resolution (without Cargo.lock) is reproducible and doesn't
|
|
# silently drift when upstream pushes to the branch.
|
|
tauri-plugin-opener = { git = "https://github.com/tauri-apps/plugins-workspace", rev = "c6561ab6b4f9e7f650d4fc8c53fd8acc9b65b9b2" }
|
|
tauri-plugin-deep-link = { git = "https://github.com/tauri-apps/plugins-workspace", rev = "c6561ab6b4f9e7f650d4fc8c53fd8acc9b65b9b2" }
|
|
tauri-plugin-global-shortcut = { git = "https://github.com/tauri-apps/plugins-workspace", rev = "c6561ab6b4f9e7f650d4fc8c53fd8acc9b65b9b2" }
|
|
tauri-plugin-notification = { git = "https://github.com/tauri-apps/plugins-workspace", rev = "c6561ab6b4f9e7f650d4fc8c53fd8acc9b65b9b2" }
|
|
|
|
[dev-dependencies]
|
|
tokio = { version = "1", features = ["macros", "rt"] }
|
|
|
|
# Fast CI builds: trade runtime perf for compile speed
|
|
[profile.ci]
|
|
inherits = "release"
|
|
opt-level = 1
|
|
codegen-units = 16
|
|
lto = false
|
|
incremental = false
|
|
strip = true
|
|
debug = false
|