Skip to main content

Crate synheart_sensor_agent

Crate synheart_sensor_agent 

Source
Expand description

§Synheart Sensor Agent

Privacy-first PC background sensor for behavioral research.

This library captures keyboard and mouse interaction timing for behavioral research with strong privacy guarantees. It is a pure collector — raw events are emitted via a channel for downstream processing by synheart-session-runtime via synheart-core-rust.

§Privacy Guarantees

  • No key content — only timing and category (typing vs. navigation)
  • No coordinates — only mouse movement magnitude/speed
  • No raw storage — events are emitted and discarded immediately
  • Transparency — all collection is logged and auditable via TransparencyLog

§Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Synheart Sensor Agent                     │
├─────────────────────────────────────────────────────────────┤
│  ┌─────────────┐                     ┌─────────────┐       │
│  │  Collector  │────────────────────▶│ Raw Events  │       │
│  │ (platform)  │                     │  (channel)  │       │
│  └─────────────┘                     └─────────────┘       │
│         │                                                  │
│         ▼                                                  │
│  ┌─────────────┐                                           │
│  │Transparency │                                           │
│  │    Log      │                                           │
│  └─────────────┘                                           │
└─────────────────────────────────────────────────────────────┘
   Pure sensor — windowing, features, and sessions handled by
   synheart-session-runtime via synheart-core-rust orchestration

§Quick Start

use synheart_sensor_agent::{collector, transparency};

// Create a collector (requires Input Monitoring permission on macOS)
let config = collector::CollectorConfig::default();
let mut collector = collector::Collector::new(config);

// Start collection
collector.start().expect("Failed to start collector");

// Events can be received from collector.receiver()

§Platform Support

The collector module adapts to the build target:

  • macOS — CoreGraphics event tap + NSWorkspace for foreground app detection
  • Windows — Windows Hooks API for keyboard/mouse + foreground window detection
  • Other — No-op collector (compiles but does not capture events)

Re-exports§

pub use collector::Collector;
pub use collector::CollectorConfig;
pub use collector::CollectorError;
pub use collector::SensorEvent;
pub use config::Config;
pub use config::SourceConfig;
pub use transparency::SharedTransparencyLog;
pub use transparency::TransparencyLog;
pub use transparency::TransparencyStats;
pub use server::run as run_server;server
pub use server::ServerConfig;server

Modules§

collector
Platform-specific event collection (keyboard, mouse, shortcuts). Event collection module for the Synheart Sensor Agent.
config
Agent configuration and persistence. Configuration for the Synheart Sensor Agent.
serverserver
HTTP server for receiving behavioral data from the Chrome extension. HTTP server for receiving behavioral data from Chrome extension.
transparency
Transparency logging for auditable data collection. Transparency module for the Synheart Sensor Agent.

Constants§

PRIVACY_DECLARATION
Privacy declaration that can be displayed to users.
VERSION
Library version string sourced from Cargo.toml.