Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(overlay): remove unused overlay attention bus

Steven Enamakel26cefc39587e
diff --git a/crates/openhuman-core/src/desktop/overlay/README.md b/crates/openhuman-core/src/desktop/overlay/README.md
deleted file mode 100644
index f570843718..0000000000
--- a/crates/openhuman-core/src/desktop/overlay/README.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# overlay
-
-Signals pushed from the core to the desktop **overlay surfaces**, separate WebViews ([`app/src/overlay/OverlayApp.tsx`](../../../../../app/src/overlay/OverlayApp.tsx) and the macOS notch pill [`app/src/notch/NotchApp.tsx`](../../../../../app/src/notch/NotchApp.tsx), hosted by [`crates/openhuman-app/src/notch_window.rs`](../../../../openhuman-app/src/notch_window.rs)) that render short, non-focus-stealing messages over the desktop. The standalone `overlay` window is currently disabled in [`crates/openhuman-app/tauri.conf.json`](../../../../openhuman-app/tauri.conf.json); the notch is the live consumer. Because these surfaces run in their own JS runtime they cannot share Redux state with the main window; each subscribes to its own Socket.IO connection and reacts to events the core broadcasts. This module owns a single fire-and-forget broadcast bus for **attention** events; the Socket.IO transport bridge ([`crates/openhuman-rpc/src/server/socketio.rs`](../../../../openhuman-rpc/src/server/socketio.rs)) subscribes and forwards them. It is deliberately light: export-focused, one broadcast channel, no persistence and no RPC.
-
-## Responsibilities
-
-- Define the `OverlayAttentionEvent` payload and its `OverlayAttentionTone` visual hint.
-- Provide a process-global broadcast channel so any core caller can surface a transient overlay message without threading a sender around.
-- Expose `publish_attention` (fire-and-forget producer) and `subscribe_attention_events` (consumed by the Socket.IO bridge).
-- (STT/dictation overlay activation is driven separately by `voice::dictation_listener`'s `dictation:toggle` / `dictation:transcription` events, not by this module.)
-
-## Key files
-
-| File | Role |
-| --- | --- |
-| [`crates/openhuman-core/src/desktop/overlay/mod.rs`](./mod.rs) | Module docstring + re-exports only (`publish_attention`, `subscribe_attention_events`, `OverlayAttentionEvent`, `OverlayAttentionTone`). |
-| [`crates/openhuman-core/src/desktop/overlay/types.rs`](./types.rs) | `OverlayAttentionEvent` (message + optional `id` / `tone` / `ttl_ms` / `source`) with builder helpers, and the `OverlayAttentionTone` enum (`neutral` / `accent` / `success`). |
-| [`crates/openhuman-core/src/desktop/overlay/bus.rs`](./bus.rs) | `Lazy` `tokio::sync::broadcast` channel (capacity 64) plus `publish_attention` / `subscribe_attention_events`; tests live in the sibling [`bus_tests.rs`](./bus_tests.rs). |
-
-## Public surface
-
-- `OverlayAttentionEvent`: `{ id: Option<String>, message: String, tone: OverlayAttentionTone, ttl_ms: Option<u32>, source: Option<String> }`. Builders: `new(message)`, `with_source(..)`, `with_tone(..)`, `with_ttl_ms(..)`. Only `message` is required.
-- `OverlayAttentionTone`: `Neutral` (default), `Accent`, `Success`; serialized lowercase. Frontend maps to bubble colours.
-- `publish_attention(event) -> usize`: broadcasts; returns the number of active subscribers that received it (`0` if none, event then dropped). Logs under `[overlay]`.
-- `subscribe_attention_events() -> broadcast::Receiver<OverlayAttentionEvent>`: receiver for the bus.
-
-## Events
-
-Not a `DomainEvent` / bus ([`crates/openhuman-core/src/core/bus.rs`](../../core/bus.rs), [`crates/openhuman-core/src/core/events.rs`](../../core/events.rs)) participant. It runs its own standalone `tokio::sync::broadcast` channel. The Socket.IO bridge in `crates/openhuman-rpc/src/server/socketio.rs` (`spawn_web_channel_bridge`, task #3) subscribes via `subscribe_attention_events()` and emits each event to the overlay socket as both `overlay:attention` and `overlay_attention`; it logs and continues on `Lagged` and breaks on `Closed`.
-
-## Persistence
-
-None. State is purely an in-memory broadcast channel; events not consumed when published are dropped.
-
-## Dependencies
-
-- External crates only: `serde` (types), `once_cell::sync::Lazy` + `tokio::sync::broadcast` (bus). No `crate::*` or `crate::core::*` imports in the module's own source.
-
-## Used by
-
-- `crates/openhuman-rpc/src/server/socketio.rs`: subscribes to the bus and forwards events to the overlay WebView over Socket.IO.
-- [`crates/openhuman-core/src/voice/always_on/processor.rs`](../../voice/always_on/processor.rs): `notch_status` publishes "Listening" / "Processing" status messages (`source: "voice"`, with a TTL) that the notch maps to icons. The only in-tree publisher today.
-- [`crates/openhuman-core/src/desktop/notifications/bus.rs`](../notifications/bus.rs): references this module's bus only as a documented pattern to mirror (no code dependency).
-
-## Notes / gotchas
-
-- **Fire-and-forget:** if the Socket.IO bridge hasn't started or the overlay socket is disconnected, `publish_attention` drops the event and returns `0`. There is no buffering/replay for late subscribers.
-- **Channel capacity is 64**: a slow/absent overlay consumer causes `Lagged` drops (logged as a warning by the bridge), not back-pressure.
-- Keep `message` short: the overlay types it out character-by-character and auto-dismisses after `ttl_ms` (frontend default when `None`). The notch treats the literal messages `Listening` and `Processing` as reserved status words.
-- The bridge emits two event names (`overlay:attention` and `overlay_attention`) for client compatibility.
-
-## Further reading
-
-- [Parent module README](../README.md)
-- [Tauri shell](../../../../../docs/gitbooks/en/developing/architecture/tauri-shell.md)
-- [The mascot](../../../../../docs/gitbooks/en/features/mascot/README.md)
diff --git a/crates/openhuman-core/src/desktop/overlay/bus.rs b/crates/openhuman-core/src/desktop/overlay/bus.rs
deleted file mode 100644
index b069c766e3..0000000000
--- a/crates/openhuman-core/src/desktop/overlay/bus.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-//! Broadcast bus for overlay attention events.
-//!
-//! Mirrors the pattern used by `voice::dictation_listener`: a single
-//! `tokio::sync::broadcast` channel wrapped in a `Lazy` static so any
-//! module in the core can publish without threading a sender around.
-//! The Socket.IO bridge in `openhuman_rpc::server::socketio::spawn_web_channel_bridge`
-//! subscribes here and forwards every event to the overlay window as
-//! an `overlay:attention` Socket.IO message.
-
-use once_cell::sync::Lazy;
-use tokio::sync::broadcast;
-
-use super::types::OverlayAttentionEvent;
-
-const LOG_PREFIX: &str = "[overlay]";
-
-static ATTENTION_BUS: Lazy<broadcast::Sender<OverlayAttentionEvent>> = Lazy::new(|| {
- let (tx, _rx) = broadcast::channel(64);
- tx
-});
-
-/// Subscribe to overlay attention events. Used by the Socket.IO bridge.
-pub fn subscribe_attention_events() -> broadcast::Receiver<OverlayAttentionEvent> {
- ATTENTION_BUS.subscribe()
-}
-
-/// Publish an attention event toward the overlay window.
-///
-/// Fire-and-forget: if nobody is currently subscribed (e.g. the bridge
-/// hasn't started yet, or the overlay socket is disconnected) the event
-/// is dropped. Returns the number of active subscribers that received
-/// the event for diagnostics.
-pub fn publish_attention(event: OverlayAttentionEvent) -> usize {
- log::debug!(
- "{LOG_PREFIX} publish attention source={:?} tone={:?} message_bytes={} ttl_ms={:?}",
- event.source,
- event.tone,
- event.message.len(),
- event.ttl_ms
- );
- match ATTENTION_BUS.send(event) {
- Ok(n) => n,
- Err(_) => {
- log::debug!("{LOG_PREFIX} no overlay subscribers — attention event dropped");
- 0
- }
- }
-}
-
-#[cfg(test)]
-#[path = "bus_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/desktop/overlay/bus_tests.rs b/crates/openhuman-core/src/desktop/overlay/bus_tests.rs
deleted file mode 100644
index b6610c4dcd..0000000000
--- a/crates/openhuman-core/src/desktop/overlay/bus_tests.rs
+++ /dev/null
@@ -1,40 +0,0 @@
-use super::*;
-use crate::desktop::overlay::types::OverlayAttentionTone;
-
-#[tokio::test]
-async fn publish_is_received_by_subscriber() {
- let mut rx = subscribe_attention_events();
- let delivered = publish_attention(
- OverlayAttentionEvent::new("hello overlay")
- .with_tone(OverlayAttentionTone::Accent)
- .with_source("test"),
- );
- assert!(delivered >= 1);
- // Under heavy parallelism (coverage builds), the broadcast
- // channel may have lagged events from other tests sharing
- // the process-global bus. Drain until we find our message.
- let mut found = false;
- for _ in 0..16 {
- match rx.try_recv() {
- Ok(event) if event.message == "hello overlay" => {
- assert_eq!(event.tone, OverlayAttentionTone::Accent);
- assert_eq!(event.source.as_deref(), Some("test"));
- found = true;
- break;
- }
- Ok(_) => continue,
- Err(broadcast::error::TryRecvError::Lagged(n)) => {
- log::debug!("overlay bus test: skipped {n} lagged messages");
- continue;
- }
- Err(_) => break,
- }
- }
- assert!(found, "expected 'hello overlay' event from broadcast bus");
-}
-
-#[test]
-fn publish_with_no_subscribers_is_safe() {
- // Drop any existing subscribers by not holding one.
- let _ = publish_attention(OverlayAttentionEvent::new("dropped"));
-}
diff --git a/crates/openhuman-core/src/desktop/overlay/mod.rs b/crates/openhuman-core/src/desktop/overlay/mod.rs
deleted file mode 100644
index 7afd48aaad..0000000000
--- a/crates/openhuman-core/src/desktop/overlay/mod.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-//! Overlay domain — signals pushed to the desktop overlay window.
-//!
-//! The Tauri desktop shell hosts a separate `overlay` window (see
-//! `crates/openhuman-app/tauri.conf.json`) that renders `OverlayApp.tsx`. Because
-//! the overlay runs in its own WebView with its own JS runtime, it cannot
-//! share Redux state with the main window. Instead it subscribes to a
-//! dedicated Socket.IO connection against the core process (same pattern
-//! `useDictationHotkey` uses) and reacts to events emitted here.
-//!
-//! Currently the overlay activates in two cases:
-//! 1. **STT / dictation** — driven by the existing `dictation:toggle`
-//! and `dictation:transcription` events (see `voice::dictation_listener`).
-//! 2. **Attention** — a short, user-visible message the core wants to
-//! surface without stealing focus. Any core-side caller (cron jobs and
-//! other background services) can publish an
-//! `OverlayAttentionEvent` via [`publish_attention`] and it will be
-//! broadcast to the overlay window as `overlay:attention`.
-//!
-//! Keep this module light: it is export-focused and owns one broadcast
-//! bus. The Socket.IO bridge lives in `crates/openhuman-rpc/src/server/socketio.rs`.
-
-pub mod bus;
-pub mod types;
-
-pub use bus::{publish_attention, subscribe_attention_events};
-pub use types::{OverlayAttentionEvent, OverlayAttentionTone};
diff --git a/crates/openhuman-core/src/desktop/overlay/types.rs b/crates/openhuman-core/src/desktop/overlay/types.rs
deleted file mode 100644
index f1ef2cea25..0000000000
--- a/crates/openhuman-core/src/desktop/overlay/types.rs
+++ /dev/null
@@ -1,73 +0,0 @@
-//! Types for the overlay attention bus.
-
-use serde::{Deserialize, Serialize};
-
-/// Visual tone hint for the overlay bubble. The frontend maps these to
-/// bubble colours (see `OverlayApp.tsx`).
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
-#[serde(rename_all = "lowercase")]
-pub enum OverlayAttentionTone {
- /// Informational / neutral (slate bubble).
- #[default]
- Neutral,
- /// Important / assistant-initiated (blue bubble).
- Accent,
- /// Positive confirmation (green bubble).
- Success,
-}
-
-/// A single attention message emitted toward the overlay window.
-///
-/// Only `message` is required. All other fields have sensible defaults
-/// so callers can do `OverlayAttentionEvent::new("Hey …")` and go.
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct OverlayAttentionEvent {
- /// Stable id for this message; if `None`, the frontend generates one.
- #[serde(default, skip_serializing_if = "Option::is_none")]
- pub id: Option<String>,
- /// The text to display. The overlay types it out character by
- /// character, so keep it short (a sentence or two).
- pub message: String,
- /// Visual tone for the bubble.
- #[serde(default)]
- pub tone: OverlayAttentionTone,
- /// How long the overlay should stay visible, in milliseconds, before
- /// auto-dismissing back to idle. `None` → frontend default.
- #[serde(default, skip_serializing_if = "Option::is_none")]
- pub ttl_ms: Option<u32>,
- /// Free-form source label for logging / debugging ("cron", …).
- /// Optional.
- #[serde(default, skip_serializing_if = "Option::is_none")]
- pub source: Option<String>,
-}
-
-impl OverlayAttentionEvent {
- /// Convenience constructor with neutral tone and default ttl.
- pub fn new(message: impl Into<String>) -> Self {
- Self {
- id: None,
- message: message.into(),
- tone: OverlayAttentionTone::default(),
- ttl_ms: None,
- source: None,
- }
- }
-
- /// Builder-style source setter for diagnostics.
- pub fn with_source(mut self, source: impl Into<String>) -> Self {
- self.source = Some(source.into());
- self
- }
-
- /// Builder-style tone setter.
- pub fn with_tone(mut self, tone: OverlayAttentionTone) -> Self {
- self.tone = tone;
- self
- }
-
- /// Builder-style ttl setter.
- pub fn with_ttl_ms(mut self, ttl_ms: u32) -> Self {
- self.ttl_ms = Some(ttl_ms);
- self
- }
-}
diff --git a/crates/openhuman-rpc/src/server/README.md b/crates/openhuman-rpc/src/server/README.md
index 9b9754c5ae..aaef69dcfd 100644
--- a/crates/openhuman-rpc/src/server/README.md
+++ b/crates/openhuman-rpc/src/server/README.md
@@ -183,7 +183,6 @@ Server to client, `spawn_web_channel_bridge` spawns one forwarding task per
source: web-chat events (`web_chat::subscribe_web_channel_events`, sent to
the initiating client's room and the `thread:<id>` room, not broadcast),
dictation hotkeys and transcription results (`voice::dictation_listener`),
-overlay attention bubbles (`desktop::overlay::subscribe_attention_events`),
core notifications (`desktop::notifications`), and companion state. It also
forwards a set of `DomainEvent`s read off `BUS`: session expiry, MCP setup
secret requests, memory sync and tree-build progress, channel listener
diff --git a/crates/openhuman-rpc/src/server/socketio.rs b/crates/openhuman-rpc/src/server/socketio.rs
index d6a116ee4b..5d1078c784 100644
--- a/crates/openhuman-rpc/src/server/socketio.rs
+++ b/crates/openhuman-rpc/src/server/socketio.rs
@@ -2,9 +2,7 @@
//!
//! `spawn_web_channel_bridge` spawns one forwarding task per source. Domain
//! broadcast channels: web-chat events (`openhuman::web_chat`), dictation hotkeys
-//! and transcription results (`openhuman::voice::dictation_listener`), overlay
-//! attention bubbles (`openhuman::desktop::overlay::subscribe_attention_events`,
-//! see `desktop/overlay/README.md`), core notifications
+//! and transcription results (`openhuman::voice::dictation_listener`), core notifications
//! (`openhuman::desktop::notifications`), and shell companion state
//! (`COMPANION_STATE_BUS`). `DomainEvent`s read off `openhuman::core::bus::BUS`:
//! session expiry, MCP setup secret requests, memory sync and tree-build
@@ -583,7 +581,6 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
log::debug!("[socketio] web_channel bridge stopped");
});
- let io_overlay = io.clone();
let io_notify = io.clone();
let io_transcription = io.clone();
let io_auth = io.clone();
@@ -642,31 +639,6 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
log::debug!("[socketio] companion state bridge stopped");
});
- // 3. Overlay attention events → broadcast to all clients.
- tokio::spawn(async move {
- let mut rx = crate::core_host::desktop::overlay::subscribe_attention_events();
- loop {
- let event = match rx.recv().await {
- Ok(event) => event,
- Err(tokio::sync::broadcast::error::RecvError::Lagged(skipped)) => {
- log::warn!("[socketio] dropped {skipped} events due to lag");
- continue;
- }
- Err(tokio::sync::broadcast::error::RecvError::Closed) => break,
- };
-
- if let Ok(payload) = serde_json::to_value(&event) {
- log::debug!(
- "[socketio] broadcast overlay:attention source={:?}",
- event.source
- );
- let _ = io_overlay.emit("overlay:attention", &payload);
- let _ = io_overlay.emit("overlay_attention", &payload);
- }
- }
- log::debug!("[socketio] overlay attention bridge stopped");
- });
-
// 4. Core notification events → broadcast to all connected clients so
// the in-app notification center picks them up regardless of which
// chat session is active. Pattern mirrors the overlay attention