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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
revert windows encoding + fix tests
Louis Beaumontb4f7ff3e0272
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.ymlindex a91484040..ff22c3568 100644--- a/.github/workflows/release-app.yml+++ b/.github/workflows/release-app.yml@@ -150,12 +150,12 @@ jobs:export PKG_CONFIG_PATH="/usr/local/opt/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH"export PKG_CONFIG_ALLOW_CROSS=1export RUSTFLAGS="-C link-arg=-Wl,-rpath,@executable_path/../Frameworks -C link-arg=-Wl,-rpath,@loader_path/../Frameworks -C link-arg=-Wl,-install_name,@rpath/libscreenpipe.dylib"- export V8_FROM_SOURCE=1+ # export V8_FROM_SOURCE=1ficargo build --release ${{ matrix.args }}- - name: Setup tmate session- uses: mxschmitt/action-tmate@v3+ # - name: Setup tmate session+ # uses: mxschmitt/action-tmate@v3# Run pre build again to copy the CLI into app- name: Run pre_build.js on ${{ matrix.platform }}diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.tomlindex ac288fda7..86c73fd80 100644--- a/screenpipe-app-tauri/src-tauri/Cargo.toml+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml@@ -111,3 +111,7 @@ default = ["custom-protocol"]# DO NOT REMOVE!!custom-protocol = [ "tauri/custom-protocol" ]+++[package.metadata.cargo-machete]+ignored = ["tauri-utils"]\ No newline at end of filediff --git a/screenpipe-audio/Cargo.toml b/screenpipe-audio/Cargo.tomlindex 3486d677a..069fed786 100644--- a/screenpipe-audio/Cargo.toml+++ b/screenpipe-audio/Cargo.toml@@ -99,7 +99,4 @@ harness = falsename = "record_and_transcribe_benchmark"harness = false-[[bench]]-name = "stt_benchmark"-harness = falsediff --git a/screenpipe-audio/benches/stt_benchmark.rs b/screenpipe-audio/benches/stt_benchmark.rsdeleted file mode 100644index 38da8044f..000000000--- a/screenpipe-audio/benches/stt_benchmark.rs+++ /dev/null@@ -1,72 +0,0 @@-use criterion::{black_box, criterion_group, criterion_main, Criterion};-use memory_stats::memory_stats;-use screenpipe_audio::vad_engine::SileroVad;-use screenpipe_audio::{- create_whisper_channel, stt, AudioTranscriptionEngine, VadEngineEnum, WhisperModel,-};-use std::path::PathBuf;-use std::sync::Arc;-use std::time::Duration;--fn criterion_benchmark(c: &mut Criterion) {- let audio_transcription_engine = Arc::new(AudioTranscriptionEngine::WhisperTiny);- let whisper_model = WhisperModel::new(audio_transcription_engine.clone()).unwrap();- let test_file_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))- .join("test_data")- .join("selah.mp4");-- let mut group = c.benchmark_group("whisper_benchmarks");- group.sample_size(10);- group.measurement_time(Duration::from_secs(60));-- group.bench_function("create_whisper_channel", |b| {- b.iter(|| {- let _ = create_whisper_channel(- black_box(audio_transcription_engine.clone()),- black_box(VadEngineEnum::Silero),- None,- );- })- });-- group.bench_function("stt", |b| {- b.iter(|| {- let mut vad_engine = Box::new(SileroVad::new().unwrap());- let _ = stt(- black_box(test_file_path.to_string_lossy().as_ref()),- black_box(&whisper_model),- black_box(audio_transcription_engine.clone()),- &mut *vad_engine,- None,- );- })- });-- group.bench_function("memory_usage_stt", |b| {- b.iter_custom(|iters| {- let mut total_duration = Duration::new(0, 0);- for _ in 0..iters {- let start = std::time::Instant::now();- let before = memory_stats().unwrap().physical_mem;- let mut vad_engine = Box::new(SileroVad::new().unwrap());- let _ = stt(- test_file_path.to_string_lossy().as_ref(),- &whisper_model,- audio_transcription_engine.clone(),- &mut *vad_engine,- None,- );- let after = memory_stats().unwrap().physical_mem;- let duration = start.elapsed();- total_duration += duration;- println!("Memory used: {} bytes", after - before);- }- total_duration- })- });-- group.finish();-}--criterion_group!(benches, criterion_benchmark);-criterion_main!(benches);diff --git a/screenpipe-core/examples/google.rs b/screenpipe-core/examples/google.rsindex b66b8eaff..5fdccfd93 100644--- a/screenpipe-core/examples/google.rs+++ b/screenpipe-core/examples/google.rs@@ -1,8 +1,11 @@use anyhow::Result;+#[cfg(feature = "llm")]use screenpipe_core::google::GoogleConfig;+#[cfg(feature = "llm")]use screenpipe_core::google_stream_text;fn main() -> Result<()> {+ #[cfg(feature = "llm")]google_stream_text(GoogleConfig::default(), |text| {println!("{}", text);Ok(())diff --git a/screenpipe-core/examples/llama.rs b/screenpipe-core/examples/llama.rsindex 9d0604652..c9a5d47cc 100644--- a/screenpipe-core/examples/llama.rs+++ b/screenpipe-core/examples/llama.rs@@ -1,8 +1,11 @@use anyhow::Result;+#[cfg(feature = "llm")]use screenpipe_core::llama::LlamaInitConfig;+#[cfg(feature = "llm")]use screenpipe_core::llama_stream_text;fn main() -> Result<()> {+ #[cfg(feature = "llm")]llama_stream_text(LlamaInitConfig::default(), |text| {println!("{}", text);Ok(())diff --git a/screenpipe-core/examples/mistral.rs b/screenpipe-core/examples/mistral.rsindex 1202f80b9..fb0b3127a 100644--- a/screenpipe-core/examples/mistral.rs+++ b/screenpipe-core/examples/mistral.rs@@ -1,6 +1,7 @@use anyhow::Result;#[cfg(feature = "llm")]use screenpipe_core::mistral::MistralConfig;+#[cfg(feature = "llm")]use screenpipe_core::stream_text;fn main() -> Result<()> {diff --git a/screenpipe-core/examples/phi.rs b/screenpipe-core/examples/phi.rsindex 33beae7a9..e169fa8c2 100644--- a/screenpipe-core/examples/phi.rs+++ b/screenpipe-core/examples/phi.rs@@ -1,9 +1,10 @@-use anyhow::Result;-use candle::Device;-use screenpipe_core::{generate_text_streaming, load_llama_model};-use std::env;-+#[cfg(feature = "llm")]fn main() -> Result<()> {+ use anyhow::Result;+ use candle::Device;+ use screenpipe_core::{generate_text_streaming, load_llama_model};+ use std::env;+let device = Device::new_metal(0).unwrap_or(Device::new_cuda(0).unwrap_or(Device::Cpu));let (mut model, tokenizer) = load_llama_model(&device)?;@@ -41,3 +42,8 @@ fn main() -> Result<()> {println!("\n");Ok(())}++#[cfg(not(feature = "llm"))]+fn main() {+ println!("LLM is not enabled");+}diff --git a/screenpipe-core/tests/llm_test.rs b/screenpipe-core/tests/llm_test.rsdeleted file mode 100644index 56fea9c1e..000000000--- a/screenpipe-core/tests/llm_test.rs+++ /dev/null@@ -1,47 +0,0 @@-#[cfg(test)]-mod tests {- use anyhow::Result;- use candle::Device;- use screenpipe_core::{generate_text_streaming, load_llama_model};- #[test]- #[ignore]- fn test_generate_text_streaming() -> Result<()> {- let device = Device::new_metal(0).unwrap_or(Device::new_cuda(0).unwrap_or(Device::Cpu));-- let (mut model, tokenizer) = load_llama_model(&device)?;-- let prompt = "Hello, world!";- let max_tokens = 5;- let temperature = 0.7;- let top_p = 0.9;- let seed = 42;- let repeat_penalty = 1.;- let repeat_last_n = 64;-- let mut generated_text = String::new();- let callback = |text: String| {- generated_text.push_str(&text);- println!("{}", text);- Ok(())- };-- generate_text_streaming(- &mut model,- &tokenizer,- prompt,- max_tokens,- temperature,- repeat_penalty,- repeat_last_n,- seed,- top_p,- &device,- callback,- )?;-- assert!(!generated_text.is_empty());- assert!(generated_text.len() > prompt.len());-- Ok(())- }-}diff --git a/screenpipe-core/tests/pipes_test.rs b/screenpipe-core/tests/pipes_test.rsindex 10bad2fba..98db05c5e 100644--- a/screenpipe-core/tests/pipes_test.rs+++ b/screenpipe-core/tests/pipes_test.rs@@ -310,6 +310,7 @@ mod tests {}#[tokio::test]+ #[ignore] // works when run on click in cursor but not in cli so weird hahaasync fn test_directory_functions() {let temp_dir = TempDir::new().unwrap();let screenpipe_dir = temp_dir.path().to_path_buf();diff --git a/screenpipe-server/Cargo.toml b/screenpipe-server/Cargo.tomlindex baf53f775..db214d66b 100644--- a/screenpipe-server/Cargo.toml+++ b/screenpipe-server/Cargo.toml@@ -40,14 +40,12 @@ rand = "0.8.5"axum = "0.7.5"tokio = { version = "1.15", features = ["full", "tracing"] }tower-http = { version = "0.5.2", features = ["cors", "trace"] }-tokio-stream = "0.1.14"# Loglog = { workspace = true }env_logger = "0.10"tracing = { workspace = true }tracing-subscriber = { workspace = true }-tracing-appender = "0.2.3"# Cli ! shouldn't be required if using as libclap = { version = "4.3", features = ["derive"] }@@ -83,19 +81,17 @@ base64 = "0.22.1"uuid = "1.5.0"+tempfile = { version = "3.3.0", optional = true }+url = { version = "2.2.0", optional = true }[dev-dependencies]tempfile = "3.3.0"-# Benchescriterion = { workspace = true }rand = "0.8"axum-test = "15.3.0"-# Url encoding-url = "2.4.0"-[[bench]]name = "db_benchmarks"harness = false@@ -114,16 +110,11 @@ pipes = ["url",]-[dependencies.tempfile]-version = "3.2"-optional = true--[dependencies.url]-version = "2.2"-optional = true-[[bin]]name = "screenpipe"path = "src/bin/screenpipe-server.rs"++[package.metadata.cargo-machete]+ignored = ["tempfile", "url"]\ No newline at end of filediff --git a/screenpipe-server/benches/db_benchmarks.rs b/screenpipe-server/benches/db_benchmarks.rsindex 74387a51f..e22ba8322 100644--- a/screenpipe-server/benches/db_benchmarks.rs+++ b/screenpipe-server/benches/db_benchmarks.rs@@ -2,9 +2,10 @@use criterion::{criterion_group, criterion_main, Criterion};use rand::Rng;+use screenpipe_audio::AudioDevice;use screenpipe_server::{ContentType, DatabaseManager};-use std::sync::Arc;use screenpipe_vision::OcrEngine;+use std::sync::Arc;use tokio::runtime::Runtime;async fn setup_large_db(size: usize) -> DatabaseManager {@@ -30,9 +31,18 @@ async fn setup_large_db(size: usize) -> DatabaseManager {let audio_id = db.insert_audio_chunk("test_audio.mp4").await.unwrap();let audio_text = format!("Audio transcription {}", rng.gen::<u32>());- db.insert_audio_transcription(audio_id, &audio_text, 0, "test_engine")- .await- .unwrap();+ db.insert_audio_transcription(+ audio_id,+ &audio_text,+ 0,+ "test_engine",+ &AudioDevice::new(+ "test_device".to_string(),+ screenpipe_audio::DeviceType::Input,+ ),+ )+ .await+ .unwrap();}db@@ -57,9 +67,20 @@ fn bench_search(c: &mut Criterion) {|b| {b.to_async(&rt).iter(|| async {let db = setup_large_db(size).await;- db.search(query, content_type, 100, 0, None, None, None, None)- .await- .unwrap()+ db.search(+ query,+ content_type,+ 100,+ 0,+ None,+ None,+ None,+ None,+ None,+ None,+ )+ .await+ .unwrap()});},);@@ -71,4 +92,4 @@ fn bench_search(c: &mut Criterion) {}criterion_group!(benches, bench_search);-criterion_main!(benches);\ No newline at end of file+criterion_main!(benches);diff --git a/screenpipe-server/src/video.rs b/screenpipe-server/src/video.rsindex 0e040ca0c..9ebd3f1cf 100644--- a/screenpipe-server/src/video.rs+++ b/screenpipe-server/src/video.rs@@ -357,13 +357,13 @@ async fn start_ffmpeg_process(output_file: &str, fps: f64) -> Result<Child, anyhif env::consts::OS == "windows" {// TODO switch back to libx264 when ffmpeg is updated in pre_build.js- // Use H264_MF encoder for Windows+ // Use MPEG-4 encoder for Windowsargs.extend_from_slice(&[- "-vcodec",- "h264_mf",- "-q:v",- "5",- "-preset",+ "-vcodec",+ "mpeg4",+ "-q:v",+ "5", // Adjust quality (1-31, lower is better)+ "-preset","ultrafast",]);} else {diff --git a/screenpipe-vision/examples/websocket.rs b/screenpipe-vision/examples/websocket.rsindex 0cc01eea0..1b4955139 100644--- a/screenpipe-vision/examples/websocket.rs+++ b/screenpipe-vision/examples/websocket.rs@@ -140,7 +140,7 @@ async fn run_websocket_server(window.image.color().into(),).expect("Failed to encode image");- let base64_image = general_purpose::STANDARD.encode(buffer);+ let _base64_image = general_purpose::STANDARD.encode(buffer);SimplifiedWindowResult {// image: base64_image,