Skip to content

calternal_plugin::mcp_events

Trusted webhook producer bus (DESIGN §55, #491).

Bounded webhook producer bus and subscription interests (#491, DESIGN §55). Producers publish only after a durable write. The User comes from the authorized operation; subscribers cannot supply it. Interest changes wake scheduled producers so they can park when no matching grant exists.

Source: crates/calternal-plugin/src/mcp_events.rs

pub struct Interest

A verified subscription’s producer interest, never an authorization grant. Only the server replaces this snapshot; producers still emit owner-scoped occurrences and the server re-checks all live authority before delivery.

Fields

  • pub user_id: String
  • pub name: String
  • pub arguments: Value

Implements: Clone, PartialEq

Source: crates/calternal-plugin/src/mcp_events.rs:28

pub struct Occurrence

One trusted producer occurrence. IDs let receivers deduplicate retries.

Fields

  • pub user_id: String
  • pub event_id: String
  • pub name: String
  • pub data: Value

Implements: Clone, Debug

Source: crates/calternal-plugin/src/mcp_events.rs:11

pub fn bus() -> &'static tokio::sync::broadcast::Sender<Occurrence>

Share one bounded process bus; lag requires a gap notice, never silent replay.

Source: crates/calternal-plugin/src/mcp_events.rs:19

pub fn interests(name: &str) -> Vec<Interest>

Read the verified owner and arguments for one trusted scheduled producer.

Source: crates/calternal-plugin/src/mcp_events.rs:74

pub fn replace_interests(interests: Vec<Interest>)

Replace the server-owned, bounded active-subscription snapshot (§55, #491).

Source: crates/calternal-plugin/src/mcp_events.rs:47

pub fn subscribe_interest_changes() -> tokio::sync::watch::Receiver<u64>

Subscribe to changes so a scheduled producer sleeps while its event has no active grants instead of waking on an idle timer (#491, DESIGN §55).

Source: crates/calternal-plugin/src/mcp_events.rs:69