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
make pipe store technical preview only for now
Louis Beaumont5dd01699620b
diff --git a/screenpipe-app-tauri/components/pipe-store.tsx b/screenpipe-app-tauri/components/pipe-store.tsxindex 0041d3729..aa9122c7c 100644--- a/screenpipe-app-tauri/components/pipe-store.tsx+++ b/screenpipe-app-tauri/components/pipe-store.tsx@@ -258,20 +258,21 @@ const PipeDialog: React.FC = () => {return (<div className="flex flex-col items-center justify-center h-full"><p className="text-lg mb-4">no pipe selected</p>- <FeatureRequestLink />- {!health || health?.status === "error" && (- <p className="mt-4 text-sm text-gray-500 text-center">- screenpipe is not running.- <br />- please start screenpipe to use the pipe store.- </p>- )}+ {/* <FeatureRequestLink /> */}+ {!health ||+ (health?.status === "error" && (+ <p className="mt-4 text-sm text-gray-500 text-center">+ screenpipe is not running.+ <br />+ please start screenpipe to use the pipe store.+ </p>+ ))}</div>);}const isInstalled = installedPipes.includes(selectedPipe.name);- console.log("installedPipes", installedPipes);+ // console.log("installedPipes", installedPipes);return (<>@@ -430,7 +431,7 @@ const PipeDialog: React.FC = () => {</DialogTrigger><DialogContent className="max-w-[90vw] w-full max-h-[90vh] h-full"><DialogHeader>- <div className=" flex flex-col items-start">+ {/* <div className=" flex flex-col items-start"><Button size="sm" onClick={handleResetAllPipes}><Trash2 className="mr-2 h-4 w-4" />reset all pipes@@ -438,7 +439,7 @@ const PipeDialog: React.FC = () => {<span className="text-xs text-gray-500 mt-1">use this if running into issues with the pipe store</span>- </div>+ </div> */}<DialogTitle>pipe store<Badge variant="secondary" className="ml-2">@@ -454,18 +455,37 @@ const PipeDialog: React.FC = () => {screenpipe's data, or anything else you can imagine that helpyou get more out of your recordings.<br />- <a+ {/* <ahref="https://github.com/mediar-ai/screenpipe/tree/main/examples/typescript"className="text-blue-500 hover:underline"target="_blank"rel="noopener noreferrer">check out more examples on github- </a>+ </a> */}</DialogDescription>- {selectedPipe && <FeatureRequestLink className="w-80" />}+ {/* {selectedPipe && <FeatureRequestLink className="w-80" />} */}</DialogHeader>+ {/* center message in big */}+ <div className="flex flex-col justify-center items-center h-[500px]">+ <p className="text-center">+ currently you need to enable pipes through `screenpipe pipe`+ commands or `/pipes` api+ <br />+ we're going to make this nontechnical next week.+ </p>+ <br />+ <a+ href="https://github.com/mediar-ai/screenpipe/tree/main/examples/typescript"+ className="text-blue-500 hover:underline"+ target="_blank"+ rel="noopener noreferrer"+ >+ check out more examples on github+ </a>+ </div>+<div className="flex h-[500px]"><div className="w-1/3 pr-4 overflow-y-auto">{/* {pipes.length === 0 &&@@ -476,7 +496,7 @@ const PipeDialog: React.FC = () => {<Skeleton className="h-24 w-full" /></div>))} */}- {pipes.map((pipe: Pipe) => (+ {/* {pipes.map((pipe: Pipe) => (<Cardkey={pipe.name}className="cursor-pointer hover:bg-gray-100 mb-2 p-2"@@ -520,8 +540,8 @@ const PipeDialog: React.FC = () => {</p>)}</Card>- ))}- <Card className="mb-2 p-2">+ ))} */}+ {/* <Card className="mb-2 p-2"><Inputplaceholder="Enter repo URL"value={newRepoUrl}@@ -535,11 +555,11 @@ const PipeDialog: React.FC = () => {<Plus className="mr-2" size={16} />Add Your Own Pipe</Button>- </Card>+ </Card> */}</div>- <div className="w-full pl-4 border-l overflow-y-auto">+ {/* <div className="w-full pl-4 border-l overflow-y-auto">{renderPipeContent()}- </div>+ </div> */}</div></DialogContent></Dialog>diff --git a/screenpipe-core/src/pipes.rs b/screenpipe-core/src/pipes.rsindex 5f068956f..d4a72eee4 100644--- a/screenpipe-core/src/pipes.rs+++ b/screenpipe-core/src/pipes.rs@@ -9,6 +9,7 @@ mod pipes {use deno_core::op2;use deno_core::ModuleLoadResponse;use deno_core::ModuleSourceCode;+ use regex::Regex;use reqwest::header::HeaderMap;use reqwest::header::HeaderValue;use reqwest::header::CONTENT_TYPE;@@ -26,6 +27,12 @@ mod pipes {use tracing::{error, info};use url::Url;+ // Add this function near the top of the file, after the imports+ fn sanitize_pipe_name(name: &str) -> String {+ let re = Regex::new(r"[^a-zA-Z0-9_-]").unwrap();+ re.replace_all(name, "-").to_string()+ }+#[op2]#[string]fn op_get_env(#[string] key: String) -> Option<String> {@@ -357,13 +364,7 @@ mod pipes {let pipe_dir = match Url::parse(&pipe) {Ok(_) => {info!("Input appears to be a URL. Attempting to download...");- // match download_pipe(&pipe, screenpipe_dir).await {- // Ok(path) => path,- // Err(e) => {- // error!("Failed to download pipe: {}", e);- // anyhow::bail!("Failed to download pipe: {}", e);- // }- // }+PathBuf::from(&pipe)}Err(_) => {@@ -403,10 +404,12 @@ mod pipes {Some("github.com") => {let api_url = get_raw_github_url(source).map_err(|e| anyhow::anyhow!("Failed to parse GitHub URL: {}", e))?;- download_github_folder(&client, &api_url, screenpipe_dir).await+ let pipe_name = sanitize_pipe_name(Path::new(&api_url).file_name().unwrap().to_str().unwrap());+ download_github_folder(&client, &api_url, screenpipe_dir, &pipe_name).await}Some("raw.githubusercontent.com") => {- download_single_file(&client, source, screenpipe_dir).await+ let pipe_name = sanitize_pipe_name(Path::new(source).file_name().unwrap().to_str().unwrap());+ download_single_file(&client, source, screenpipe_dir, &pipe_name).await}_ => anyhow::bail!("Unsupported URL format"),}@@ -420,16 +423,11 @@ mod pipes {anyhow::bail!("Local source is not a directory");}- let pipe_name = source_path+ let pipe_name = sanitize_pipe_name(source_path.file_name().and_then(|name| name.to_str())- .unwrap_or("unknown_pipe");- let dest_dir = screenpipe_dir.join("pipes").join(pipe_name);-- // if dest_dir.exists() {- // info!("Pipe already exists: {:?}", dest_dir);- // return Ok(dest_dir);- // }+ .unwrap_or("unknown_pipe"));+ let dest_dir = screenpipe_dir.join("pipes").join(&pipe_name);tokio::fs::create_dir_all(&dest_dir).await?;copy_local_folder(source_path, &dest_dir).await?;@@ -467,6 +465,7 @@ mod pipes {client: &Client,api_url: &str,screenpipe_dir: PathBuf,+ pipe_name: &str,) -> anyhow::Result<PathBuf> {let response = client.get(api_url)@@ -481,13 +480,7 @@ mod pipes {anyhow::bail!("Invalid response from GitHub API");}- let pipe_name = Path::new(api_url)- .file_name()- .and_then(|name| name.to_str())- .unwrap_or("unknown_pipe")- .to_string();-- let pipe_dir = screenpipe_dir.join("pipes").join(&pipe_name);+ let pipe_dir = screenpipe_dir.join("pipes").join(pipe_name);// Check if the pipe directory already existsif pipe_dir.exists() {@@ -522,23 +515,11 @@ mod pipes {client: &Client,url: &str,screenpipe_dir: PathBuf,+ pipe_name: &str,) -> anyhow::Result<PathBuf> {let response = client.get(url).send().await?;let content = response.bytes().await?;- let file_name = Path::new(url)- .file_name()- .and_then(|name| name.to_str())- .unwrap_or("pipe.js")- .to_string();-- let pipe_name = Path::new(url)- .parent()- .and_then(|p| p.file_name())- .and_then(|name| name.to_str())- .unwrap_or("unknown_pipe")- .to_string();-let pipe_dir = screenpipe_dir.join("pipes").join(pipe_name);// Check if the pipe directory already exists@@ -549,7 +530,7 @@ mod pipes {tokio::fs::create_dir_all(&pipe_dir).await?;- let file_path = pipe_dir.join(file_name);+ let file_path = pipe_dir.join(pipe_name);tokio::fs::write(&file_path, &content).await?;info!("Downloaded single file: {:?}", file_path);diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rsindex ec6a94689..6b217ff53 100644--- a/screenpipe-server/src/bin/screenpipe-server.rs+++ b/screenpipe-server/src/bin/screenpipe-server.rs@@ -392,10 +392,6 @@ async fn main() -> anyhow::Result<()> {"│ VAD Engine │ {:<34} │",format!("{:?}", vad_engine_clone));- println!(- "│ Monitor IDs │ {:<34} │",- format_cell(&format!("{:?}", monitor_ids), VALUE_WIDTH)- );println!("│ Data Directory │ {:<34} │",local_data_dir_clone.display()@@ -426,10 +422,34 @@ async fn main() -> anyhow::Result<()> {}}- // In the main function, replace the audio devices section with:+ // Add monitors section+ println!("├─────────────────────┼────────────────────────────────────┤");+ println!("│ Monitors │ │");+ const MAX_ITEMS_TO_DISPLAY: usize = 5;++ if cli.disable_vision {+ println!("│ {:<19} │ {:<34} │", "", "Vision disabled");+ } else if all_monitors.is_empty() {+ println!("│ {:<19} │ {:<34} │", "", "No monitors available");+ } else {+ let total_monitors = all_monitors.len();+ for (_, monitor) in all_monitors.iter().enumerate().take(MAX_ITEMS_TO_DISPLAY) {+ let monitor_str = format!("ID: {}, {:?}", monitor.id(), monitor);+ let formatted_monitor = format_cell(&monitor_str, VALUE_WIDTH);+ println!("│ {:<19} │ {:<34} │", "", formatted_monitor);+ }+ if total_monitors > MAX_ITEMS_TO_DISPLAY {+ println!(+ "│ {:<19} │ {:<34} │",+ "",+ format!("... and {} more", total_monitors - MAX_ITEMS_TO_DISPLAY)+ );+ }+ }++ // Audio devices sectionprintln!("├─────────────────────┼────────────────────────────────────┤");println!("│ Audio Devices │ │");- const MAX_DEVICES_TO_DISPLAY: usize = 5;if cli.disable_audio {println!("│ {:<19} │ {:<34} │", "", "Disabled");@@ -437,21 +457,43 @@ async fn main() -> anyhow::Result<()> {println!("│ {:<19} │ {:<34} │", "", "No devices available");} else {let total_devices = audio_devices.len();- for (_, device) in audio_devices- .iter()- .enumerate()- .take(MAX_DEVICES_TO_DISPLAY)- {+ for (_, device) in audio_devices.iter().enumerate().take(MAX_ITEMS_TO_DISPLAY) {let device_str = device.deref().to_string();let formatted_device = format_cell(&device_str, VALUE_WIDTH);println!("│ {:<19} │ {:<34} │", "", formatted_device);}- if total_devices > MAX_DEVICES_TO_DISPLAY {+ if total_devices > MAX_ITEMS_TO_DISPLAY {+ println!(+ "│ {:<19} │ {:<34} │",+ "",+ format!("... and {} more", total_devices - MAX_ITEMS_TO_DISPLAY)+ );+ }+ }++ // Pipes section+ println!("├─────────────────────┼────────────────────────────────────┤");+ println!("│ Pipes │ │");+ let pipes = pipe_manager.list_pipes().await;+ if pipes.is_empty() {+ println!("│ {:<19} │ {:<34} │", "", "No pipes available");+ } else {+ let total_pipes = pipes.len();+ for (_, pipe) in pipes.iter().enumerate().take(MAX_ITEMS_TO_DISPLAY) {+ let pipe_str = format!(+ "{} ({})",+ pipe.id,+ if pipe.enabled { "Enabled" } else { "Disabled" }+ );+ let formatted_pipe = format_cell(&pipe_str, VALUE_WIDTH);+ println!("│ {:<19} │ {:<34} │", "", formatted_pipe);+ }+ if total_pipes > MAX_ITEMS_TO_DISPLAY {println!("│ {:<19} │ {:<34} │","",- format!("... and {} more", total_devices - MAX_DEVICES_TO_DISPLAY)+ format!("... and {} more", total_pipes - MAX_ITEMS_TO_DISPLAY));}}