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

Bump app to v2.0.190

Louis Beaumonte351cb3e595d
diff --git a/Cargo.lock b/Cargo.lock
index 82ede6355..b0f6c34f4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6656,7 +6656,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "screenpipe-audio"
-version = "0.3.6"
+version = "0.3.7"
dependencies = [
"anyhow",
"bytemuck",
@@ -6709,7 +6709,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.6"
+version = "0.3.7"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -6760,7 +6760,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.6"
+version = "0.3.7"
dependencies = [
"anyhow",
"chrono",
@@ -6784,7 +6784,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.6"
+version = "0.3.7"
dependencies = [
"anyhow",
"chrono",
@@ -6802,7 +6802,7 @@ dependencies = [
[[package]]
name = "screenpipe-integrations"
-version = "0.3.6"
+version = "0.3.7"
dependencies = [
"anyhow",
"image",
@@ -6817,7 +6817,7 @@ dependencies = [
[[package]]
name = "screenpipe-server"
-version = "0.3.6"
+version = "0.3.7"
dependencies = [
"anyhow",
"async-trait",
@@ -6882,7 +6882,7 @@ dependencies = [
[[package]]
name = "screenpipe-vision"
-version = "0.3.6"
+version = "0.3.7"
dependencies = [
"accessibility-sys",
"anyhow",
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index f7b2fa8fe..8d429cc93 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -6733,7 +6733,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "screenpipe-app"
-version = "2.0.180"
+version = "2.0.189"
dependencies = [
"anyhow",
"async-stream",
@@ -6809,7 +6809,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.6"
+version = "0.3.7"
dependencies = [
"accessibility",
"accessibility-sys",
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index f78f317ac..124952cc1 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.0.189"
+version = "2.0.190"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rs
index 132b5de66..c55ffe8e7 100755
--- a/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -418,16 +418,27 @@ async fn get_log_files(app: AppHandle) -> Result<Vec<LogFile>, String> {
}
fn get_data_dir(app: &tauri::AppHandle) -> anyhow::Result<PathBuf> {
- // Create a new runtime for this synchronous function
-
- let store = get_store(app, None)?;
-
let default_path = app.path().home_dir().unwrap().join(".screenpipe");
- let data_dir = store
- .get("dataDir")
- .and_then(|v| v.as_str().map(String::from))
- .unwrap_or(String::from("default"));
+ // Try to get dataDir from settings in store
+ // The store structure is: { "settings": { "dataDir": "default", ... }, ... }
+ let data_dir = match get_store(app, None) {
+ Ok(store) => {
+ if let Some(settings) = store.get("settings") {
+ settings
+ .get("dataDir")
+ .and_then(|v| v.as_str())
+ .map(String::from)
+ .unwrap_or_else(|| "default".to_string())
+ } else {
+ "default".to_string()
+ }
+ }
+ Err(e) => {
+ warn!("Failed to get store for data dir, using default: {}", e);
+ "default".to_string()
+ }
+ };
if data_dir == "default" || data_dir.is_empty() {
Ok(default_path)
diff --git a/screenpipe-db/src/db.rs b/screenpipe-db/src/db.rs
index 886848006..8616b2077 100644
--- a/screenpipe-db/src/db.rs
+++ b/screenpipe-db/src/db.rs
@@ -23,7 +23,8 @@ use crate::{
text_similarity::is_similar_transcription, AudioChunksResponse, AudioDevice, AudioEntry,
AudioResult, AudioResultRaw, ContentType, DeviceType, FrameData, FrameRow, OCREntry, OCRResult,
OCRResultRaw, OcrEngine, OcrTextBlock, Order, SearchMatch, SearchResult, Speaker,
- TagContentType, TextBounds, TextPosition, TimeSeriesChunk, UiContent, VideoMetadata,
+ TagContentType, TextBounds, TextPosition, TimeSeriesChunk, UiContent, UiEventRecord,
+ UiEventRow, VideoMetadata,
};
/// Time window (in seconds) to check for similar transcriptions across devices.
@@ -745,6 +746,189 @@ impl DatabaseManager {
results.extend(audio_results.into_iter().map(SearchResult::Audio));
results.extend(ocr_results.into_iter().map(SearchResult::OCR));
}
+ ContentType::Vision => {
+ // Vision = OCR + UI monitoring (accessibility text)
+ let ocr_results = self
+ .search_ocr(
+ query,
+ limit / 2,
+ offset,
+ start_time,
+ end_time,
+ app_name,
+ window_name,
+ min_length,
+ max_length,
+ frame_name,
+ browser_url,
+ focused,
+ )
+ .await?;
+ let ui_results = self
+ .search_ui_monitoring(
+ query,
+ app_name,
+ window_name,
+ start_time,
+ end_time,
+ limit / 2,
+ offset,
+ )
+ .await?;
+
+ results.extend(ocr_results.into_iter().map(SearchResult::OCR));
+ results.extend(ui_results.into_iter().map(SearchResult::UI));
+ }
+ ContentType::Input => {
+ // Input = UI events (clicks, keystrokes, etc.)
+ let input_results = self
+ .search_ui_events(
+ Some(query),
+ None, // event_type
+ app_name,
+ window_name,
+ start_time,
+ end_time,
+ limit,
+ offset,
+ )
+ .await?;
+ results.extend(input_results.into_iter().map(SearchResult::Input));
+ }
+ ContentType::VisionAndInput => {
+ let ocr_results = self
+ .search_ocr(
+ query,
+ limit / 3,
+ offset,
+ start_time,
+ end_time,
+ app_name,
+ window_name,
+ min_length,
+ max_length,
+ frame_name,
+ browser_url,
+ focused,
+ )
+ .await?;
+ let ui_results = self
+ .search_ui_monitoring(
+ query,
+ app_name,
+ window_name,
+ start_time,
+ end_time,
+ limit / 3,
+ offset,
+ )
+ .await?;
+ let input_results = self
+ .search_ui_events(
+ Some(query),
+ None,
+ app_name,
+ window_name,
+ start_time,
+ end_time,
+ limit / 3,
+ offset,
+ )
+ .await?;
+
+ results.extend(ocr_results.into_iter().map(SearchResult::OCR));
+ results.extend(ui_results.into_iter().map(SearchResult::UI));
+ results.extend(input_results.into_iter().map(SearchResult::Input));
+ }
+ ContentType::AudioAndInput => {
+ let audio_results = self
+ .search_audio(
+ query,
+ limit / 2,
+ offset,
+ start_time,
+ end_time,
+ min_length,
+ max_length,
+ speaker_ids,
+ speaker_name,
+ )
+ .await?;
+ let input_results = self
+ .search_ui_events(
+ Some(query),
+ None,
+ app_name,
+ window_name,
+ start_time,
+ end_time,
+ limit / 2,
+ offset,
+ )
+ .await?;
+
+ results.extend(audio_results.into_iter().map(SearchResult::Audio));
+ results.extend(input_results.into_iter().map(SearchResult::Input));
+ }
+ ContentType::VisionAudioInput => {
+ let ocr_results = self
+ .search_ocr(
+ query,
+ limit / 4,
+ offset,
+ start_time,
+ end_time,
+ app_name,
+ window_name,
+ min_length,
+ max_length,
+ frame_name,
+ browser_url,
+ focused,
+ )
+ .await?;
+ let ui_results = self
+ .search_ui_monitoring(
+ query,
+ app_name,
+ window_name,
+ start_time,
+ end_time,
+ limit / 4,
+ offset,
+ )
+ .await?;
+ let audio_results = self
+ .search_audio(
+ query,
+ limit / 4,
+ offset,
+ start_time,
+ end_time,
+ min_length,
+ max_length,
+ speaker_ids,
+ speaker_name,
+ )
+ .await?;
+ let input_results = self
+ .search_ui_events(
+ Some(query),
+ None,
+ app_name,
+ window_name,
+ start_time,
+ end_time,
+ limit / 4,
+ offset,
+ )
+ .await?;
+
+ results.extend(ocr_results.into_iter().map(SearchResult::OCR));
+ results.extend(ui_results.into_iter().map(SearchResult::UI));
+ results.extend(audio_results.into_iter().map(SearchResult::Audio));
+ results.extend(input_results.into_iter().map(SearchResult::Input));
+ }
}
// Sort results by timestamp in descending order
@@ -753,11 +937,13 @@ impl DatabaseManager {
SearchResult::OCR(ocr) => ocr.timestamp,
SearchResult::Audio(audio) => audio.timestamp,
SearchResult::UI(ui) => ui.timestamp,
+ SearchResult::Input(input) => input.timestamp,
};
let timestamp_b = match b {
SearchResult::OCR(ocr) => ocr.timestamp,
SearchResult::Audio(audio) => audio.timestamp,
SearchResult::UI(ui) => ui.timestamp,
+ SearchResult::Input(input) => input.timestamp,
};
timestamp_b.cmp(&timestamp_a)
});
@@ -1884,6 +2070,106 @@ impl DatabaseManager {
.await
}
+ /// Search UI events (user input actions)
+ #[allow(clippy::too_many_arguments)]
+ pub async fn search_ui_events(
+ &self,
+ query: Option<&str>,
+ event_type: Option<&str>,
+ app_name: Option<&str>,
+ window_name: Option<&str>,
+ start_time: Option<DateTime<Utc>>,
+ end_time: Option<DateTime<Utc>>,
+ limit: u32,
+ offset: u32,
+ ) -> Result<Vec<UiEventRecord>, sqlx::Error> {
+ let mut conditions = vec!["1=1".to_string()];
+
+ if let Some(q) = query {
+ if !q.is_empty() {
+ conditions.push(format!(
+ "(text_content LIKE '%{}%' OR app_name LIKE '%{}%' OR window_title LIKE '%{}%')",
+ q, q, q
+ ));
+ }
+ }
+ if let Some(et) = event_type {
+ if !et.is_empty() {
+ conditions.push(format!("event_type = '{}'", et));
+ }
+ }
+ if let Some(app) = app_name {
+ if !app.is_empty() {
+ conditions.push(format!("app_name LIKE '%{}%'", app));
+ }
+ }
+ if let Some(window) = window_name {
+ if !window.is_empty() {
+ conditions.push(format!("window_title LIKE '%{}%'", window));
+ }
+ }
+
+ let where_clause = conditions.join(" AND ");
+
+ let sql = format!(
+ r#"
+ SELECT
+ id, timestamp, session_id, relative_ms, event_type,
+ x, y, delta_x, delta_y, button, click_count,
+ key_code, modifiers, text_content, text_length,
+ app_name, app_pid, window_title, browser_url,
+ element_role, element_name, element_value,
+ element_description, element_automation_id, element_bounds,
+ frame_id
+ FROM ui_events
+ WHERE {}
+ AND (?1 IS NULL OR timestamp >= ?1)
+ AND (?2 IS NULL OR timestamp <= ?2)
+ ORDER BY timestamp DESC
+ LIMIT ?3 OFFSET ?4
+ "#,
+ where_clause
+ );
+
+ let rows: Vec<UiEventRow> = sqlx::query_as(&sql)
+ .bind(start_time)
+ .bind(end_time)
+ .bind(limit)
+ .bind(offset)
+ .fetch_all(&self.pool)
+ .await?;
+
+ Ok(rows.into_iter().map(|r| r.into()).collect())
+ }
+
+ /// Get UI event statistics grouped by app and event type
+ pub async fn get_ui_event_stats(
+ &self,
+ start_time: Option<DateTime<Utc>>,
+ end_time: Option<DateTime<Utc>>,
+ ) -> Result<Vec<(String, String, i64)>, sqlx::Error> {
+ let sql = r#"
+ SELECT
+ COALESCE(app_name, 'unknown') as app,
+ event_type,
+ COUNT(*) as count
+ FROM ui_events
+ WHERE (?1 IS NULL OR timestamp >= ?1)
+ AND (?2 IS NULL OR timestamp <= ?2)
+ GROUP BY app_name, event_type
+ ORDER BY count DESC
+ LIMIT 100
+ "#;
+
+ let rows: Vec<(String, String, i64)> = sqlx::query_as(sql)
+ .bind(start_time)
+ .bind(end_time)
+ .fetch_all(&self.pool)
+ .await?;
+
+ Ok(rows)
+ }
+
// Add tags to UI monitoring entry
pub async fn add_tags_to_ui_monitoring(
&self,
diff --git a/screenpipe-db/src/types.rs b/screenpipe-db/src/types.rs
index 8a2012c34..e48d4e527 100644
--- a/screenpipe-db/src/types.rs
+++ b/screenpipe-db/src/types.rs
@@ -16,11 +16,18 @@ impl fmt::Display for DatabaseError {
impl StdError for DatabaseError {}
+/// Search result variants for different content types.
+///
+/// Note: `UI` is for accessibility text traversal (ui_monitoring table).
+/// `Input` is for user actions like clicks/keystrokes (ui_events table).
#[derive(OaSchema, Debug, Serialize, Deserialize)]
pub enum SearchResult {
OCR(OCRResult),
Audio(AudioResult),
+ /// Accessibility text traversal (deprecated, use Vision)
UI(UiContent),
+ /// User input actions (clicks, keystrokes, clipboard)
+ Input(UiEventRecord),
}
#[derive(FromRow, Debug)]
@@ -67,23 +74,60 @@ pub struct OCRResult {
pub device_name: String,
}
+/// Content type for search queries.
+///
+/// ## New API (recommended):
+/// - `vision` - Screen content (OCR text + accessibility)
+/// - `audio` - Transcribed speech
+/// - `input` - User actions (clicks, keystrokes, clipboard)
+///
+/// ## Deprecated (still supported):
+/// - `ocr` - Use `vision` instead
+/// - `ui` - Use `vision` instead (for accessibility text) or `input` (for events)
#[derive(OaSchema, Debug, Deserialize, PartialEq, Default, Clone)]
#[serde(rename_all = "lowercase")]
pub enum ContentType {
#[default]
All,
+
+ // === New API (Three Pillars) ===
+ /// Screen content: OCR text + accessibility text
+ Vision,
+ /// User input actions: clicks, keystrokes, clipboard, app switches
+ Input,
+
+ // === Deprecated (backwards compatible) ===
+ /// @deprecated Use `vision` instead
+ #[serde(alias = "ocr")]
OCR,
+ /// Audio transcriptions (not deprecated, same name)
Audio,
+ /// @deprecated Use `vision` for text, `input` for events
+ #[serde(alias = "ui")]
UI,
+
+ // === Combinations ===
#[serde(rename = "audio+ui")]
#[serde(alias = "audio ui")]
AudioAndUi,
#[serde(rename = "ocr+ui")]
#[serde(alias = "ocr ui")]
+ #[serde(alias = "vision+ui")]
OcrAndUi,
#[serde(rename = "audio+ocr")]
#[serde(alias = "audio ocr")]
+ #[serde(alias = "audio+vision")]
AudioAndOcr,
+ /// Vision + Audio + Input (everything)
+ #[serde(rename = "vision+audio+input")]
+ #[serde(alias = "all_modalities")]
+ VisionAudioInput,
+ /// Vision + Input
+ #[serde(rename = "vision+input")]
+ VisionAndInput,
+ /// Audio + Input
+ #[serde(rename = "audio+input")]
+ AudioAndInput,
}
#[derive(FromRow)]
@@ -329,3 +373,201 @@ impl Default for CustomOcrConfig {
}
}
}
+
+// ============================================================================
+// UI Events Types (Input Capture Modality)
+// ============================================================================
+
+/// Types of UI input events
+#[derive(OaSchema, Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "snake_case")]
+pub enum UiEventType {
+ Click,
+ Move,
+ Scroll,
+ Key,
+ Text,
+ AppSwitch,
+ WindowFocus,
+ Clipboard,
+}
+
+impl Display for UiEventType {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ UiEventType::Click => write!(f, "click"),
+ UiEventType::Move => write!(f, "move"),
+ UiEventType::Scroll => write!(f, "scroll"),
+ UiEventType::Key => write!(f, "key"),
+ UiEventType::Text => write!(f, "text"),
+ UiEventType::AppSwitch => write!(f, "app_switch"),
+ UiEventType::WindowFocus => write!(f, "window_focus"),
+ UiEventType::Clipboard => write!(f, "clipboard"),
+ }
+ }
+}
+
+impl std::str::FromStr for UiEventType {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ match s {
+ "click" => Ok(UiEventType::Click),
+ "move" => Ok(UiEventType::Move),
+ "scroll" => Ok(UiEventType::Scroll),
+ "key" => Ok(UiEventType::Key),
+ "text" => Ok(UiEventType::Text),
+ "app_switch" => Ok(UiEventType::AppSwitch),
+ "window_focus" => Ok(UiEventType::WindowFocus),
+ "clipboard" => Ok(UiEventType::Clipboard),
+ _ => Err(format!("Unknown UI event type: {}", s)),
+ }
+ }
+}
+
+/// Element context from accessibility APIs
+#[derive(OaSchema, Debug, Clone, Serialize, Deserialize, FromRow)]
+pub struct UiElementContext {
+ pub role: Option<String>,
+ pub name: Option<String>,
+ pub value: Option<String>,
+ pub description: Option<String>,
+ pub automation_id: Option<String>,
+ pub bounds: Option<String>, // JSON: {"x":0,"y":0,"width":100,"height":50}
+}
+
+/// A UI input event stored in the database
+#[derive(OaSchema, Debug, Clone, Serialize, Deserialize)]
+pub struct UiEventRecord {
+ pub id: i64,
+ pub timestamp: DateTime<Utc>,
+ pub session_id: Option<String>,
+ pub relative_ms: i64,
+ pub event_type: UiEventType,
+ // Position
+ pub x: Option<i32>,
+ pub y: Option<i32>,
+ pub delta_x: Option<i16>,
+ pub delta_y: Option<i16>,
+ // Mouse/key
+ pub button: Option<u8>,
+ pub click_count: Option<u8>,
+ pub key_code: Option<u16>,
+ pub modifiers: Option<u8>,
+ // Text
+ pub text_content: Option<String>,
+ pub text_length: Option<i32>,
+ // App context
+ pub app_name: Option<String>,
+ pub app_pid: Option<i32>,
+ pub window_title: Option<String>,
+ pub browser_url: Option<String>,
+ // Element context
+ pub element: Option<UiElementContext>,
+ // Frame correlation
+ pub frame_id: Option<i64>,
+}
+
+/// Raw row from ui_events table
+#[derive(Debug, FromRow)]
+pub struct UiEventRow {
+ pub id: i64,
+ pub timestamp: DateTime<Utc>,
+ pub session_id: Option<String>,
+ pub relative_ms: i64,
+ pub event_type: String,
+ pub x: Option<i32>,
+ pub y: Option<i32>,
+ pub delta_x: Option<i32>,
+ pub delta_y: Option<i32>,
+ pub button: Option<i32>,
+ pub click_count: Option<i32>,
+ pub key_code: Option<i32>,
+ pub modifiers: Option<i32>,
+ pub text_content: Option<String>,
+ pub text_length: Option<i32>,
+ pub app_name: Option<String>,
+ pub app_pid: Option<i32>,
+ pub window_title: Option<String>,
+ pub browser_url: Option<String>,
+ pub element_role: Option<String>,
+ pub element_name: Option<String>,
+ pub element_value: Option<String>,
+ pub element_description: Option<String>,
+ pub element_automation_id: Option<String>,
+ pub element_bounds: Option<String>,
+ pub frame_id: Option<i64>,
+}
+
+impl From<UiEventRow> for UiEventRecord {
+ fn from(row: UiEventRow) -> Self {
+ let element = if row.element_role.is_some()
+ || row.element_name.is_some()
+ || row.element_value.is_some()
+ {
+ Some(UiElementContext {
+ role: row.element_role,
+ name: row.element_name,
+ value: row.element_value,
+ description: row.element_description,
+ automation_id: row.element_automation_id,
+ bounds: row.element_bounds,
+ })
+ } else {
+ None
+ };
+
+ UiEventRecord {
+ id: row.id,
+ timestamp: row.timestamp,
+ session_id: row.session_id,
+ relative_ms: row.relative_ms,
+ event_type: row.event_type.parse().unwrap_or(UiEventType::Click),
+ x: row.x,
+ y: row.y,
+ delta_x: row.delta_x.map(|v| v as i16),
+ delta_y: row.delta_y.map(|v| v as i16),
+ button: row.button.map(|v| v as u8),
+ click_count: row.click_count.map(|v| v as u8),
+ key_code: row.key_code.map(|v| v as u16),
+ modifiers: row.modifiers.map(|v| v as u8),
+ text_content: row.text_content,
+ text_length: row.text_length,
+ app_name: row.app_name,
+ app_pid: row.app_pid,
+ window_title: row.window_title,
+ browser_url: row.browser_url,
+ element,
+ frame_id: row.frame_id,
+ }
+ }
+}
+
+/// Parameters for inserting a UI event
+#[derive(Debug, Clone)]
+pub struct InsertUiEvent {
+ pub timestamp: DateTime<Utc>,
+ pub session_id: Option<String>,
+ pub relative_ms: i64,
+ pub event_type: UiEventType,
+ pub x: Option<i32>,
+ pub y: Option<i32>,
+ pub delta_x: Option<i16>,
+ pub delta_y: Option<i16>,
+ pub button: Option<u8>,
+ pub click_count: Option<u8>,
+ pub key_code: Option<u16>,
+ pub modifiers: Option<u8>,
+ pub text_content: Option<String>,
+ pub app_name: Option<String>,
+ pub app_pid: Option<i32>,
+ pub window_title: Option<String>,
+ pub browser_url: Option<String>,
+ pub element_role: Option<String>,
+ pub element_name: Option<String>,
+ pub element_value: Option<String>,
+ pub element_description: Option<String>,
+ pub element_automation_id: Option<String>,
+ pub element_bounds: Option<String>,
+ pub frame_id: Option<i64>,
+}
diff --git a/screenpipe-server/src/server.rs b/screenpipe-server/src/server.rs
index d5b244cfb..7648dc568 100644
--- a/screenpipe-server/src/server.rs
+++ b/screenpipe-server/src/server.rs
@@ -236,7 +236,10 @@ struct MarkAsHallucinationRequest {
pub enum ContentItem {
OCR(OCRContent),
Audio(AudioContent),
+ /// @deprecated Use Vision for text, Input for events
UI(UiContent),
+ /// User input actions (clicks, keystrokes, clipboard)
+ Input(InputContent),
}
#[derive(OaSchema, Serialize, Deserialize, Debug, Clone)]
@@ -285,6 +288,29 @@ pub struct UiContent {
pub browser_url: Option<String>,
}
+/// User input event content (clicks, keystrokes, clipboard, etc.)
+#[derive(OaSchema, Serialize, Deserialize, Debug, Clone)]
+pub struct InputContent {
+ pub id: i64,
+ pub timestamp: DateTime<Utc>,
+ pub event_type: String,
+ pub app_name: Option<String>,
+ pub window_title: Option<String>,
+ pub browser_url: Option<String>,
+ /// Text content for text/clipboard events
+ pub text_content: Option<String>,
+ /// Position for mouse events
+ pub x: Option<i32>,
+ pub y: Option<i32>,
+ /// Key code for keyboard events
+ pub key_code: Option<u16>,
+ /// Modifier keys (shift, ctrl, alt, etc.)
+ pub modifiers: Option<u8>,
+ /// Element context from accessibility APIs
+ pub element_role: Option<String>,
+ pub element_name: Option<String>,
+}
+
#[derive(OaSchema, Serialize)]
pub(crate) struct ListDeviceResponse {
name: String,
@@ -461,6 +487,9 @@ pub(crate) async fn search(
SearchResult::OCR(ocr) => !is_screenpipe_app(&ocr.app_name),
SearchResult::Audio(_) => true, // Audio doesn't have app_name
SearchResult::UI(ui) => !is_screenpipe_app(&ui.app_name),
+ SearchResult::Input(input) => {
+ input.app_name.as_ref().map_or(true, |app| !is_screenpipe_app(app))
+ }
})
.map(|result| match result {
SearchResult::OCR(ocr) => ContentItem::OCR(OCRContent {
@@ -503,6 +532,21 @@ pub(crate) async fn search(
frame_name: ui.frame_name.clone(),
browser_url: ui.browser_url.clone(),
}),
+ SearchResult::Input(input) => ContentItem::Input(InputContent {
+ id: input.id,
+ timestamp: input.timestamp,
+ event_type: input.event_type.to_string(),
+ app_name: input.app_name.clone(),
+ window_title: input.window_title.clone(),
+ browser_url: input.browser_url.clone(),
+ text_content: input.text_content.clone(),
+ x: input.x,
+ y: input.y,
+ key_code: input.key_code,
+ modifiers: input.modifiers,
+ element_role: input.element.as_ref().and_then(|e| e.role.clone()),
+ element_name: input.element.as_ref().and_then(|e| e.name.clone()),
+ }),
})
.collect();