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: embedded server improvements

Louis Beaumont608b75282b2a
diff --git a/screenpipe-app-tauri/src-tauri/src/embedded_server.rs b/screenpipe-app-tauri/src-tauri/src/embedded_server.rs
index 818582656..460f98158 100644
--- a/screenpipe-app-tauri/src-tauri/src/embedded_server.rs
+++ b/screenpipe-app-tauri/src-tauri/src/embedded_server.rs
@@ -12,7 +12,7 @@ use screenpipe_audio::core::engine::AudioTranscriptionEngine;
use screenpipe_audio::vad::{VadEngineEnum, VadSensitivity};
use screenpipe_core::Language;
use screenpipe_db::DatabaseManager;
-use screenpipe_server::{PipeManager, ResourceMonitor, SCServer, start_continuous_recording};
+use screenpipe_server::{PipeManager, ResourceMonitor, SCServer, start_continuous_recording, start_ui_recording, UiRecorderConfig};
use screenpipe_vision::OcrEngine;
use tokio::sync::broadcast;
use tracing::{error, info, warn};
@@ -41,6 +41,7 @@ pub struct EmbeddedServerConfig {
pub deepgram_api_key: Option<String>,
pub enable_frame_cache: bool,
pub analytics_enabled: bool,
+ pub enable_ui_events: bool,
}
impl EmbeddedServerConfig {
@@ -76,6 +77,7 @@ impl EmbeddedServerConfig {
},
enable_frame_cache: store.enable_frame_cache,
analytics_enabled: store.analytics_enabled,
+ enable_ui_events: store.enable_ui_events,
}
}
}
@@ -347,6 +349,25 @@ pub async fn start_embedded_server(
});
}
+ // Start UI event recording (accessibility events)
+ if config.enable_ui_events {
+ let ui_config = UiRecorderConfig {
+ enabled: true,
+ ..Default::default()
+ };
+ let db_clone = db.clone();
+ tokio::spawn(async move {
+ match start_ui_recording(db_clone, ui_config).await {
+ Ok(_handle) => {
+ info!("UI event recording started successfully");
+ }
+ Err(e) => {
+ error!("Failed to start UI event recording: {}", e);
+ }
+ }
+ });
+ }
+
// Start resource monitor
let resource_monitor = ResourceMonitor::new(config.analytics_enabled);
resource_monitor.start_monitoring(Duration::from_secs(30), Some(Duration::from_secs(60)));
diff --git a/screenpipe-js/ai-proxy/src/providers/vertex.ts b/screenpipe-js/ai-proxy/src/providers/vertex.ts
index 780f77931..7bb13b2df 100644
--- a/screenpipe-js/ai-proxy/src/providers/vertex.ts
+++ b/screenpipe-js/ai-proxy/src/providers/vertex.ts
@@ -345,7 +345,25 @@ export class VertexAIProvider implements AIProvider {
// Handle assistant messages with potential tool calls
const content: any[] = [];
if (msg.content) {
- content.push({ type: 'text', text: msg.content });
+ // Handle content that could be string, array, or other format
+ if (typeof msg.content === 'string') {
+ content.push({ type: 'text', text: msg.content });
+ } else if (Array.isArray(msg.content)) {
+ // Content is already an array of content blocks
+ for (const block of msg.content) {
+ if (block.type === 'text') {
+ // Unwrap nested text if needed
+ content.push({ type: 'text', text: unwrapText(block.text) });
+ } else if (block.type === 'tool_use') {
+ content.push(block);
+ } else {
+ content.push(block);
+ }
+ }
+ } else {
+ // Fallback: stringify unknown content
+ content.push({ type: 'text', text: String(msg.content) });
+ }
}
if (msg.tool_calls) {
for (const tc of msg.tool_calls) {
@@ -382,7 +400,8 @@ export class VertexAIProvider implements AIProvider {
// Convert OpenAI-style content parts to Anthropic format
convertedContent = msg.content.map((part: any) => {
if (part.type === 'text') {
- return { type: 'text', text: part.text };
+ // Unwrap nested text if needed
+ return { type: 'text', text: unwrapText(part.text) };
} else if (part.type === 'image_url') {
// Convert OpenAI image_url format to Anthropic source format
const url = part.image_url?.url || '';