Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(capture): checkpoint private clipboard and key actions

Louis Beaumont168c8f9dd7d1
diff --git a/Cargo.lock b/Cargo.lock
index 4833f3d56..0ba820f33 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8071,7 +8071,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"anyhow",
"audiopipe",
@@ -8133,7 +8133,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio-eval"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"anyhow",
"audiopipe",
@@ -8171,7 +8171,7 @@ dependencies = [
[[package]]
name = "screenpipe-config"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"dirs 6.0.0",
"serde",
@@ -8184,7 +8184,7 @@ dependencies = [
[[package]]
name = "screenpipe-connect"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"anyhow",
"async-trait",
@@ -8222,7 +8222,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -8274,7 +8274,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"anyhow",
"chrono",
@@ -8300,7 +8300,7 @@ dependencies = [
[[package]]
name = "screenpipe-engine"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"anyhow",
"arc-swap",
@@ -8376,7 +8376,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"anyhow",
"chrono",
@@ -8394,7 +8394,7 @@ dependencies = [
[[package]]
name = "screenpipe-meeting-eval"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"anyhow",
"clap",
@@ -8406,7 +8406,7 @@ dependencies = [
[[package]]
name = "screenpipe-redact"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"anyhow",
"async-trait",
@@ -8436,7 +8436,7 @@ dependencies = [
[[package]]
name = "screenpipe-rfdetr-mlx"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"image",
"mlx-rs",
@@ -8447,7 +8447,7 @@ dependencies = [
[[package]]
name = "screenpipe-screen"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"accessibility-sys",
"anyhow",
@@ -8505,7 +8505,7 @@ dependencies = [
[[package]]
name = "screenpipe-sync"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"async-trait",
"base64 0.22.1",
@@ -8527,7 +8527,7 @@ dependencies = [
[[package]]
name = "screenpipe-team-memory"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"serde",
"serde_yaml",
@@ -8536,7 +8536,7 @@ dependencies = [
[[package]]
name = "screenpipe-vault"
-version = "0.4.4"
+version = "0.4.5"
dependencies = [
"argon2",
"chacha20poly1305",
diff --git a/Cargo.toml b/Cargo.toml
index 9a84d2a72..578fd0f5b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,7 +10,7 @@ exclude = [
resolver = "2"
[workspace.package]
-version = "0.4.4"
+version = "0.4.5"
authors = ["louis030195 <[email protected]>"]
description = ""
repository = "https://github.com/screenpipe/screenpipe"
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 33843b5e0..814bf9e75 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "screenpipe-app"
-version = "2.5.7"
+version = "2.5.8"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/crates/screenpipe-a11y/src/platform/macos.rs b/crates/screenpipe-a11y/src/platform/macos.rs
index 19a41ea8a..21780b865 100644
--- a/crates/screenpipe-a11y/src/platform/macos.rs
+++ b/crates/screenpipe-a11y/src/platform/macos.rs
@@ -262,13 +262,13 @@ impl UiRecorder {
// actually wants clipboard capture; otherwise the recorder
// emits app_switch / window_focus events only.
if self.config.capture_clipboard {
- let clipboard_tx =
- spawn_clipboard_worker_thread(current_app.clone(), current_window.clone());
let stop_p = stop.clone();
let tx_p = tx.clone();
let config_p = self.config.clone();
+ let app_p = current_app.clone();
+ let window_p = current_window.clone();
threads.push(thread::spawn(move || {
- run_clipboard_poller(stop_p, clipboard_tx, tx_p, config_p, start_time);
+ run_clipboard_poller(stop_p, tx_p, config_p, start_time, app_p, window_p);
}));
}
}
@@ -406,27 +406,42 @@ fn spawn_clipboard_worker_thread(
} else {
None
};
- let event = UiEvent {
- id: None,
- timestamp: Utc::now(),
- relative_ms: req.start.elapsed().as_millis() as u64,
- data: EventData::Clipboard {
- operation: req.operation,
- content,
- },
- app_name: current_app.load().as_ref().clone(),
- window_title: current_window.load().as_ref().clone(),
- browser_url: None,
- element: None,
- frame_id: None,
- };
- let _ = req.tx.try_send(event);
+ let event = clipboard_event(
+ req.operation,
+ content,
+ req.start,
+ &current_app,
+ &current_window,
+ );
+ if let Err(err) = req.tx.try_send(event) {
+ debug!(?err, "clipboard worker dropped event");
+ }
}
})
.ok();
clipboard_tx
}
+fn clipboard_event(
+ operation: char,
+ content: Option<String>,
+ start: Instant,
+ current_app: &Arc<ArcSwap<Option<String>>>,
+ current_window: &Arc<ArcSwap<Option<String>>>,
+) -> UiEvent {
+ UiEvent {
+ id: None,
+ timestamp: Utc::now(),
+ relative_ms: start.elapsed().as_millis() as u64,
+ data: EventData::Clipboard { operation, content },
+ app_name: current_app.load().as_ref().clone(),
+ window_title: current_window.load().as_ref().clone(),
+ browser_url: None,
+ element: None,
+ frame_id: None,
+ }
+}
+
/// Poll interval for the clipboard fallback. 750ms balances detection
/// latency against wakeups; `changeCount` is cheap and does not read
/// clipboard contents.
@@ -458,10 +473,11 @@ const CLIPBOARD_OP_POLLED: char = 'p';
/// is a semantic checkpoint even if the bytes are identical.
fn run_clipboard_poller(
stop: Arc<AtomicBool>,
- clipboard_tx: Sender<ClipboardRequest>,
tx: Sender<UiEvent>,
config: UiCaptureConfig,
start: Instant,
+ current_app: Arc<ArcSwap<Option<String>>>,
+ current_window: Arc<ArcSwap<Option<String>>>,
) {
// Seed with the current pasteboard generation so we don't fire an event for
// pre-existing content copied before launching the recorder.
@@ -500,14 +516,31 @@ fn run_clipboard_poller(
last_seen = Some(current);
debug!("clipboard change-count poller detected a pasteboard mutation");
- let _ = clipboard_tx.try_send(ClipboardRequest {
- operation: CLIPBOARD_OP_POLLED,
- delay_ms: 0,
- capture_content: config.capture_clipboard_content,
- apply_pii: config.apply_pii_removal,
+ let content = if config.capture_clipboard_content {
+ let _pool = cidre::objc::AutoreleasePoolPage::push();
+ get_clipboard().map(|s| {
+ let truncated = truncate(&s, 1000);
+ if config.apply_pii_removal {
+ remove_pii(&truncated)
+ } else {
+ truncated
+ }
+ })
+ } else {
+ None
+ };
+ let event = clipboard_event(
+ CLIPBOARD_OP_POLLED,
+ content,
start,
- tx: tx.clone(),
- });
+ &current_app,
+ &current_window,
+ );
+ if let Err(err) = tx.try_send(event) {
+ debug!(?err, "clipboard poller dropped event");
+ } else {
+ debug!("clipboard poller emitted event");
+ }
}
}
@@ -664,16 +697,18 @@ fn run_event_tap(
let poller_stop = stop.clone();
let poller_tx = tx.clone();
let poller_config = config.clone();
- let poller_clipboard_tx = clipboard_tx.clone();
+ let poller_app = current_app.clone();
+ let poller_window = current_window.clone();
thread::Builder::new()
.name("clipboard-poller".into())
.spawn(move || {
run_clipboard_poller(
poller_stop,
- poller_clipboard_tx,
poller_tx,
poller_config,
start,
+ poller_app,
+ poller_window,
);
})
.ok();
diff --git a/crates/screenpipe-engine/src/event_driven_capture.rs b/crates/screenpipe-engine/src/event_driven_capture.rs
index 0a70d2300..c3792be5b 100644
--- a/crates/screenpipe-engine/src/event_driven_capture.rs
+++ b/crates/screenpipe-engine/src/event_driven_capture.rs
@@ -156,18 +156,19 @@ fn drain_pending_corr_ids(
/// Reduce a batch of drained triggers to (kind, correlation_ids).
///
-/// - `kind` is the most recent non-skipped trigger (most recent context
-/// wins for capture).
+/// - `kind` is the most recent workflow checkpoint trigger, if present.
+/// Otherwise it is the most recent non-skipped trigger. This keeps
+/// clipboard/key/focus checkpoints from being swallowed by trailing click or
+/// visual noise in the same drain.
/// - `correlation_ids` accumulates every non-skipped corr id, so when
/// the capture lands every triggering event row gets linked.
-/// - Skipped kinds (Clipboard/KeyPress under their off gates) drop
-/// both their corr id and their kind from consideration. This
-/// matters for mixed-kind drains: a tail Clipboard with the gate
-/// off must NOT clear the corr ids of valid earlier triggers.
+/// - The legacy skip booleans are ignored for key/clipboard privacy: those
+/// events may be trigger-only, but their workflow checkpoints should still
+/// land even when DB row/content storage is disabled.
fn reduce_drained_triggers<I>(
msgs: I,
- skip_clipboard: bool,
- skip_keypress: bool,
+ _skip_clipboard: bool,
+ _skip_keypress: bool,
) -> (
Option<CaptureTrigger>,
Vec<crate::frame_linker::CorrelationId>,
@@ -178,22 +179,26 @@ where
let mut trigger: Option<CaptureTrigger> = None;
let mut correlation_ids = Vec::new();
for msg in msgs {
- let should_skip = match &msg.trigger {
- CaptureTrigger::Clipboard => skip_clipboard,
- CaptureTrigger::KeyPress => skip_keypress,
- _ => false,
- };
- if should_skip {
- continue;
- }
if let Some(corr) = msg.correlation_id {
correlation_ids.push(corr);
}
- trigger = Some(msg.trigger);
+ let candidate_priority = trigger_reduce_priority(&msg.trigger);
+ let current_priority = trigger.as_ref().map(trigger_reduce_priority).unwrap_or(0);
+ if trigger.is_none() || candidate_priority >= current_priority {
+ trigger = Some(msg.trigger);
+ }
}
(trigger, correlation_ids)
}
+fn trigger_reduce_priority(trigger: &CaptureTrigger) -> u8 {
+ if is_workflow_checkpoint_trigger(trigger) {
+ 2
+ } else {
+ 1
+ }
+}
+
impl CaptureTrigger {
/// Get the trigger name for DB storage.
pub fn as_str(&self) -> &str {
@@ -1661,6 +1666,19 @@ fn is_workflow_checkpoint_trigger(trigger: &CaptureTrigger) -> bool {
)
}
+fn bypasses_capture_throttles(trigger: &CaptureTrigger) -> bool {
+ matches!(
+ trigger,
+ CaptureTrigger::AppSwitch { .. }
+ | CaptureTrigger::WindowFocus { .. }
+ | CaptureTrigger::TypingPause
+ | CaptureTrigger::ScrollStop
+ | CaptureTrigger::KeyPress
+ | CaptureTrigger::Clipboard
+ | CaptureTrigger::Manual
+ )
+}
+
/// Perform a single event-driven capture.
///
/// When `previous_content_hash` is `Some` and matches the current accessibility
@@ -1681,6 +1699,7 @@ async fn do_capture(
hd_active: bool,
) -> Result<CaptureOutput> {
let captured_at = Utc::now();
+ let bypass_capture_throttles = bypasses_capture_throttles(trigger);
// Resolve ignored windows to SCK window IDs so ScreenCaptureKit
// excludes them from the capture buffer (zero overhead, pixel-perfect).
@@ -1748,22 +1767,30 @@ async fn do_capture(
// every few seconds in an active terminal, so cap to 1 capture per 30s per app.
if let Some(ref app) = trigger_app {
if terminal_ocr_throttled(app) {
- debug!(
- "terminal OCR throttle: skipping {} capture (within 30s of previous)",
- app
- );
- return Ok(CaptureOutput {
- result: None,
- image,
- elements_deduped: false,
- });
+ if bypass_capture_throttles {
+ debug!(
+ "terminal OCR throttle: allowing checkpoint {} capture for {}",
+ trigger.as_str(),
+ app
+ );
+ } else {
+ debug!(
+ "terminal OCR throttle: skipping {} capture (within 30s of previous)",
+ app
+ );
+ return Ok(CaptureOutput {
+ result: None,
+ image,
+ elements_deduped: false,
+ });
+ }
}
}
use screenpipe_a11y::tree::TreeWalkResult;
if let Some(ref app) = trigger_app {
let decision = walk_budget.should_walk(app);
- if !decision.walk {
+ if !decision.walk && !bypass_capture_throttles {
debug!(
"walk budget: throttling tree walk for {} (tier={:?}) — skipping capture",
app, decision.tier
@@ -1778,6 +1805,13 @@ async fn do_capture(
image,
elements_deduped: false,
});
+ } else if !decision.walk {
+ debug!(
+ "walk budget: allowing checkpoint {} capture for {} despite tier={:?}",
+ trigger.as_str(),
+ app,
+ decision.tier
+ );
}
config.max_nodes_override = Some(decision.max_nodes);
config.walk_timeout_override = Some(decision.timeout);
@@ -2228,6 +2262,30 @@ mod tests {
assert!(!dedup_applies(&CaptureTrigger::VisualChange, false, stale));
}
+ #[test]
+ fn capture_throttle_bypass_classification() {
+ assert!(bypasses_capture_throttles(&CaptureTrigger::AppSwitch {
+ app_name: "Code".into(),
+ target: None,
+ }));
+ assert!(bypasses_capture_throttles(&CaptureTrigger::WindowFocus {
+ window_name: "main.rs".into(),
+ target: None,
+ }));
+ assert!(bypasses_capture_throttles(&CaptureTrigger::TypingPause));
+ assert!(bypasses_capture_throttles(&CaptureTrigger::ScrollStop));
+ assert!(bypasses_capture_throttles(&CaptureTrigger::KeyPress));
+ assert!(bypasses_capture_throttles(&CaptureTrigger::Clipboard));
+ assert!(bypasses_capture_throttles(&CaptureTrigger::Manual));
+
+ assert!(!bypasses_capture_throttles(&CaptureTrigger::Click {
+ x: 10,
+ y: 20,
+ }));
+ assert!(!bypasses_capture_throttles(&CaptureTrigger::VisualChange));
+ assert!(!bypasses_capture_throttles(&CaptureTrigger::Idle));
+ }
+
#[test]
fn default_config_captures_key_and_clipboard_triggers() {
let config = EventDrivenCaptureConfig::default();
@@ -2329,7 +2387,7 @@ mod tests {
}
#[test]
- fn reduce_drained_picks_last_kind_and_collects_corr_ids() {
+ fn reduce_drained_picks_latest_checkpoint_and_collects_corr_ids() {
let drained = vec![
CaptureTriggerMsg::with_correlation(CaptureTrigger::Click { x: 10, y: 20 }, 1),
CaptureTriggerMsg::with_correlation(
@@ -2348,16 +2406,43 @@ mod tests {
),
];
let (trigger, corrs) = reduce_drained_triggers(drained, false, false);
- // Last kind wins.
+ // Last workflow checkpoint wins.
assert!(matches!(trigger, Some(CaptureTrigger::WindowFocus { .. })));
// All three corr ids accumulate.
assert_eq!(corrs, vec![1, 2, 3]);
}
#[test]
- fn reduce_drained_skipped_clipboard_does_not_clear_earlier_corr_ids() {
- // The exact regression: a Clipboard tail with the gate OFF used
- // to clear valid Click corr_ids that drained alongside it.
+ fn reduce_drained_keeps_checkpoint_over_trailing_click() {
+ let drained = vec![
+ CaptureTriggerMsg::with_correlation(CaptureTrigger::Clipboard, 1),
+ CaptureTriggerMsg::with_correlation(CaptureTrigger::Click { x: 10, y: 20 }, 2),
+ ];
+ let (trigger, corrs) = reduce_drained_triggers(drained, false, false);
+ assert_eq!(trigger, Some(CaptureTrigger::Clipboard));
+ assert_eq!(corrs, vec![1, 2]);
+ }
+
+ #[test]
+ fn reduce_drained_latest_checkpoint_wins_among_checkpoints() {
+ let drained = vec![
+ CaptureTriggerMsg::with_correlation(CaptureTrigger::Clipboard, 1),
+ CaptureTriggerMsg::with_correlation(
+ CaptureTrigger::WindowFocus {
+ window_name: "main.rs".into(),
+ target: None,
+ },
+ 2,
+ ),
+ CaptureTriggerMsg::with_correlation(CaptureTrigger::KeyPress, 3),
+ ];
+ let (trigger, corrs) = reduce_drained_triggers(drained, false, false);
+ assert_eq!(trigger, Some(CaptureTrigger::KeyPress));
+ assert_eq!(corrs, vec![1, 2, 3]);
+ }
+
+ #[test]
+ fn reduce_drained_clipboard_checkpoint_wins_even_when_legacy_gate_off() {
let drained = vec![
CaptureTriggerMsg::with_correlation(CaptureTrigger::Click { x: 10, y: 20 }, 10),
CaptureTriggerMsg::with_correlation(CaptureTrigger::Click { x: 11, y: 21 }, 11),
@@ -2365,33 +2450,31 @@ mod tests {
];
let (trigger, corrs) =
reduce_drained_triggers(drained, /*skip_clipboard*/ true, false);
- // Clipboard dropped from kind decision — most recent non-skipped wins.
- assert_eq!(trigger, Some(CaptureTrigger::Click { x: 11, y: 21 }));
- // Only the two valid Click corr ids survive.
- assert_eq!(corrs, vec![10, 11]);
+ assert_eq!(trigger, Some(CaptureTrigger::Clipboard));
+ assert_eq!(corrs, vec![10, 11, 12]);
}
#[test]
- fn reduce_drained_skipped_keypress_filters_in_mixed_drain() {
+ fn reduce_drained_keypress_checkpoint_wins_even_when_legacy_gate_off() {
let drained = vec![
CaptureTriggerMsg::with_correlation(CaptureTrigger::KeyPress, 20),
CaptureTriggerMsg::with_correlation(CaptureTrigger::Click { x: 10, y: 20 }, 21),
CaptureTriggerMsg::with_correlation(CaptureTrigger::KeyPress, 22),
];
let (trigger, corrs) = reduce_drained_triggers(drained, false, /*skip_keypress*/ true);
- assert_eq!(trigger, Some(CaptureTrigger::Click { x: 10, y: 20 }));
- assert_eq!(corrs, vec![21]);
+ assert_eq!(trigger, Some(CaptureTrigger::KeyPress));
+ assert_eq!(corrs, vec![20, 21, 22]);
}
#[test]
- fn reduce_drained_all_skipped_returns_none() {
+ fn reduce_drained_legacy_gates_do_not_skip_key_or_clipboard() {
let drained = vec![
CaptureTriggerMsg::with_correlation(CaptureTrigger::Clipboard, 1),
CaptureTriggerMsg::with_correlation(CaptureTrigger::KeyPress, 2),
];
let (trigger, corrs) = reduce_drained_triggers(drained, true, true);
- assert!(trigger.is_none());
- assert!(corrs.is_empty());
+ assert_eq!(trigger, Some(CaptureTrigger::KeyPress));
+ assert_eq!(corrs, vec![1, 2]);
}
#[test]
diff --git a/crates/screenpipe-engine/src/ui_recorder.rs b/crates/screenpipe-engine/src/ui_recorder.rs
index b0ecfc289..0e1348a18 100644
--- a/crates/screenpipe-engine/src/ui_recorder.rs
+++ b/crates/screenpipe-engine/src/ui_recorder.rs
@@ -518,10 +518,7 @@ pub async fn start_ui_recording(
let record_input_events = config.record_input_events;
let record_keyboard_events = config.record_keyboard_events;
let record_clipboard_events = config.record_clipboard_events;
- let trigger_gates = TriggerGates {
- capture_on_keystroke: config.capture_on_keystroke,
- capture_on_clipboard: config.capture_on_clipboard,
- };
+ let trigger_gates = TriggerGates;
// Start the recording
let handle = match recorder.start() {
@@ -850,17 +847,12 @@ async fn flush_batch(
batch.clear();
}
-/// Trigger-side gate values mirrored from `EventDrivenCaptureConfig`.
-/// Used by [`capture_trigger_kind`] to suppress correlation_id minting
-/// for trigger kinds the capture loop is configured to drop. Without
-/// this the recorder would stash one `pending_event` per gated trigger
-/// in the frame linker — harmless functionally (they TTL-evict) but
-/// wasted work at high keystroke/clipboard rates.
+/// Marker for legacy trigger-side gates. Key and clipboard events are
+/// privacy-sensitive for storage, not for workflow checkpointing, so
+/// [`capture_trigger_kind`] intentionally lets them trigger even when older
+/// callers think these gates are off.
#[derive(Debug, Clone, Copy, Default)]
-struct TriggerGates {
- capture_on_keystroke: bool,
- capture_on_clipboard: bool,
-}
+struct TriggerGates;
fn event_target_point(db_event: &InsertUiEvent) -> Option<(i32, i32)> {
Some((db_event.x?, db_event.y?))
@@ -878,7 +870,7 @@ fn event_target_point(db_event: &InsertUiEvent) -> Option<(i32, i32)> {
fn capture_trigger_kind(
db_event: &InsertUiEvent,
ignored_patterns: &[WindowPattern],
- gates: TriggerGates,
+ _gates: TriggerGates,
) -> Option<crate::event_driven_capture::CaptureTrigger> {
use crate::event_driven_capture::CaptureTrigger;
// Both AppSwitch and WindowFocus events carry app_name (set by the
@@ -917,12 +909,8 @@ fn capture_trigger_kind(
.unwrap_or(CaptureTrigger::Manual),
),
// Clipboard operations can be trigger-only when DB persistence is
- // disabled. The capture-loop gate is still separate: when
- // `capture_on_clipboard` is off we skip the trigger entirely.
- screenpipe_db::UiEventType::Clipboard if gates.capture_on_clipboard => {
- Some(CaptureTrigger::Clipboard)
- }
- screenpipe_db::UiEventType::Clipboard => None,
+ // disabled. Storage privacy never suppresses the workflow checkpoint.
+ screenpipe_db::UiEventType::Clipboard => Some(CaptureTrigger::Clipboard),
// Text events are already burst-end-debounced by the a11y layer
// (`text_timeout_ms`, default 300ms) — one row per typing burst,
// so one TypingPause trigger per row is the correct semantic.
@@ -932,13 +920,9 @@ fn capture_trigger_kind(
// recent Scroll's correlation_id until the burst ends, then
// emits a single ScrollStop trigger.
screenpipe_db::UiEventType::Scroll => None,
- // Key events fire a KeyPress trigger when the capture loop is
- // configured to honor them. The caller may send this as trigger-only
- // if privacy settings suppress storing the key row.
- screenpipe_db::UiEventType::Key if gates.capture_on_keystroke => {
- Some(CaptureTrigger::KeyPress)
- }
- screenpipe_db::UiEventType::Key => None,
+ // Key events fire a KeyPress trigger even when privacy settings
+ // suppress storing the key row.
+ screenpipe_db::UiEventType::Key => Some(CaptureTrigger::KeyPress),
// Move/Idle never trigger.
_ => None,
}
@@ -1095,21 +1079,14 @@ mod capture_trigger_kind_tests {
}
}
- fn gates(keystroke: bool, clipboard: bool) -> TriggerGates {
- TriggerGates {
- capture_on_keystroke: keystroke,
- capture_on_clipboard: clipboard,
- }
+ fn gates(_keystroke: bool, _clipboard: bool) -> TriggerGates {
+ TriggerGates
}
#[test]
- fn key_event_suppressed_when_keystroke_gate_off() {
- // When `capture_on_keystroke` is false the capture loop drops
- // the trigger at the reducer — so we must also drop it here
- // and not mint a corr_id that would just TTL-evict in the
- // frame linker.
+ fn key_event_triggers_even_when_legacy_gate_off() {
let result = capture_trigger_kind(&evt(UiEventType::Key), &[], gates(false, true));
- assert!(result.is_none(), "Key with gate off must not trigger");
+ assert!(matches!(result, Some(CaptureTrigger::KeyPress)));
}
#[test]
@@ -1174,9 +1151,9 @@ mod capture_trigger_kind_tests {
}
#[test]
- fn clipboard_event_suppressed_when_clipboard_gate_off() {
+ fn clipboard_event_triggers_even_when_legacy_gate_off() {
let result = capture_trigger_kind(&evt(UiEventType::Clipboard), &[], gates(false, false));
- assert!(result.is_none(), "Clipboard with gate off must not trigger");
+ assert!(matches!(result, Some(CaptureTrigger::Clipboard)));
}
#[test]