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

release-app fix: cli gen dialog too verbose, remove cancel sub button sub not rdy, make installing pipes faster, removing redundant log ui, make bun prioritize the one installed by app instead of PATH

Louis Beaumont79e35380aabf
diff --git a/screenpipe-app-tauri/components/cli-command-dialog.tsx b/screenpipe-app-tauri/components/cli-command-dialog.tsx
index 9ea84af4f..767dddc4c 100644
--- a/screenpipe-app-tauri/components/cli-command-dialog.tsx
+++ b/screenpipe-app-tauri/components/cli-command-dialog.tsx
@@ -29,7 +29,7 @@ export function CliCommandDialog({ settings }: CliCommandDialogProps) {
let args = [];
let envVars = [];
- if (settings.user?.credits) {
+ if (settings.user?.credits && !settings.audioTranscriptionEngine.includes("whisper")) {
envVars.push(
'DEEPGRAM_API_URL="https://ai-proxy.i-f9f.workers.dev/v1/listen"'
);
diff --git a/screenpipe-app-tauri/components/pipe-store.tsx b/screenpipe-app-tauri/components/pipe-store.tsx
index ca6f5b7e5..7d142e1c3 100644
--- a/screenpipe-app-tauri/components/pipe-store.tsx
+++ b/screenpipe-app-tauri/components/pipe-store.tsx
@@ -269,24 +269,6 @@ const DEFAULT_PIPES = [
"identify-speakers",
];
-const checkSubscription = async (pipeId: string, userId: string) => {
- try {
- console.log("checking subscription for pipe:", pipeId, userId);
- const { data, error } = await supabase
- .from("subscriptions")
- .select("*")
- .eq("pipe_id", pipeId)
- .eq("user_id", userId)
- .single();
-
- if (error) throw error;
- return data;
- } catch (error) {
- console.error("failed to check subscription:", error);
- return null;
- }
-};
-
const PipeStore: React.FC = () => {
const [newRepoUrl, setNewRepoUrl] = useState("");
const [selectedPipe, setSelectedPipe] = useState<Pipe | null>(null);
@@ -361,7 +343,7 @@ const PipeStore: React.FC = () => {
const pipe = corePipes.find((p) => p.id === pipeId);
if (pipe?.url) {
try {
- await handleDownloadPipe(pipe.url);
+ await handleDownloadPipe(pipe.url, pipe.id);
} catch (error) {
console.error(`Failed to install ${pipeId}:`, error);
}
@@ -443,7 +425,7 @@ const PipeStore: React.FC = () => {
}
};
- const handleDownloadPipe = async (url: string) => {
+ const handleDownloadPipe = async (url: string, id: string) => {
try {
posthog.capture("download_pipe", {
pipe_id: url,
@@ -506,6 +488,15 @@ const PipeStore: React.FC = () => {
duration: 2000,
});
+ // enable now
+ await fetch("http://localhost:3030/pipes/enable", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({ pipe_id: id }),
+ });
+
await fetchInstalledPipes();
const freshPipe = pipes.find(
@@ -945,7 +936,7 @@ const PipeStore: React.FC = () => {
duration: 100000,
});
- await handleDownloadPipe(pipe.source);
+ await handleDownloadPipe(pipe.source, pipe.id);
}
t.update({
@@ -1073,9 +1064,6 @@ const PipeStore: React.FC = () => {
if (!selectedPipe) return null;
const isPipeRunning = runningPipes[selectedPipe.id];
- const startupAttempt = startupAttempts[selectedPipe.id] || 0;
- const brokenPipe = brokenPipes.find((p) => p.id === selectedPipe.id);
- const isStartupFailing = startupAttempt > 0;
return (
<div className="fixed inset-0 bg-background transform transition-transform duration-200 ease-in-out flex flex-col">
@@ -1202,113 +1190,26 @@ const PipeStore: React.FC = () => {
</TooltipProvider>
)}
<div className="flex items-center gap-2">
- {user?.id &&
- corePipes.find((cp) => cp.id === selectedPipe.id)
- ?.paid && (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- onClick={async () => {
- try {
- const sub = await checkSubscription(
- selectedPipe.id,
- user!.id!
- );
- if (!sub) {
- toast({
- title: "no active subscription found",
- variant: "destructive",
- });
- return;
- }
-
- const res = await fetch(
- "https://screenpi.pe/api/subscription-end",
- {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- subscription_id: sub.id,
- }),
- }
- );
-
- if (!res.ok)
- throw new Error(
- "failed to end subscription"
- );
-
- // Remove the pipe completely
- await fetch(
- "http://localhost:3030/pipes/delete",
- {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- pipe_id: selectedPipe.id,
- }),
- }
- );
-
- toast({
- title: "subscription ended",
- description:
- "access will continue for 30 days",
- });
-
- await reloadPipeConfig(selectedPipe);
- } catch (error) {
- console.error(
- "failed to end subscription:",
- error
- );
- toast({
- title: "error ending subscription",
- description:
- "please try again or contact support",
- variant: "destructive",
- });
- }
- }}
- variant="outline"
- size="icon"
- className="h-8 w-8"
- >
- <BanknoteIcon className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <p>end subscription</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- )}
-
{/* Only show delete button for non-core pipes */}
- {!corePipes.some((cp) => cp.id === selectedPipe.id) && (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- onClick={() => handleDeletePipe(selectedPipe)}
- variant="outline"
- size="icon"
- className="h-8 w-8"
- >
- <Trash2 className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <p>delete pipe</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- )}
+ {/* {!corePipes.some((cp) => cp.id === selectedPipe.id) && ( */}
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ onClick={() => handleDeletePipe(selectedPipe)}
+ variant="outline"
+ size="icon"
+ className="h-8 w-8"
+ >
+ <Trash2 className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>delete pipe</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ {/* )} */}
</div>
</div>
@@ -1357,6 +1258,8 @@ const PipeStore: React.FC = () => {
? "initializing..."
: isPipeRunning
? "open in browser"
+ : brokenPipes.some((p) => p.id === selectedPipe.id)
+ ? "pipe is broken"
: "initializing..."}
</Button>
<Button
@@ -1383,6 +1286,8 @@ const PipeStore: React.FC = () => {
? "initializing..."
: isPipeRunning
? "open as app"
+ : brokenPipes.some((p) => p.id === selectedPipe.id)
+ ? "pipe is broken"
: "initializing..."}
</Button>
</div>
@@ -1449,7 +1354,7 @@ const PipeStore: React.FC = () => {
const isInstalled = pipes.some((p) => p.id === pipe.id);
if (!isInstalled && pipe.source) {
try {
- await handleDownloadPipe(pipe.source);
+ await handleDownloadPipe(pipe.source, pipe.id);
// Fetch the updated pipe data and wait for it
const response = await fetch("http://localhost:3030/pipes/list");
const data = await response.json();
@@ -1668,7 +1573,7 @@ const PipeStore: React.FC = () => {
variant="outline"
onClick={(e) => {
e.stopPropagation();
- handleDownloadPipe(pipe.source);
+ handleDownloadPipe(pipe.source, pipe.id);
}}
>
<Download className="h-3.5 w-3.5" />
diff --git a/screenpipe-app-tauri/components/recording-settings.tsx b/screenpipe-app-tauri/components/recording-settings.tsx
index 7e5b29700..6e3cf37cf 100644
--- a/screenpipe-app-tauri/components/recording-settings.tsx
+++ b/screenpipe-app-tauri/components/recording-settings.tsx
@@ -165,7 +165,26 @@ export function RecordingSettings() {
title: "settings changed",
description: "restart required to apply changes",
action: (
- <ToastAction altText="restart now" onClick={handleUpdate}>
+ <ToastAction
+ altText="restart now"
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ // Wrap in setTimeout to ensure event handling is complete
+ setTimeout(() => {
+ handleUpdate();
+ }, 0);
+ return false;
+ }}
+ onMouseDown={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ }}
+ onMouseUp={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ }}
+ >
restart now
</ToastAction>
),
diff --git a/screenpipe-app-tauri/components/screenpipe-status.tsx b/screenpipe-app-tauri/components/screenpipe-status.tsx
index a5b126259..2c187d172 100644
--- a/screenpipe-app-tauri/components/screenpipe-status.tsx
+++ b/screenpipe-app-tauri/components/screenpipe-status.tsx
@@ -392,24 +392,6 @@ const HealthStatus = ({ className }: { className?: string }) => {
<Separator className="my-12" />
<DevModeSettings localDataDir={localDataDir} />
-
- {!isMac ? null : (
- <Collapsible
- open={isLogOpen}
- onOpenChange={setIsLogOpen}
- className="w-full mt-4"
- >
- <div className="flex items-center justify-between w-full">
- <CollapsibleTrigger className="flex items-center justify-between p-2 flex-grow border-b border-gray-200">
- recorder logs
- <span>{isLogOpen ? "▲" : "▼"}</span>
- </CollapsibleTrigger>
- </div>
- <CollapsibleContent>
- <LogViewer className="mt-2" />
- </CollapsibleContent>
- </Collapsible>
- )}
</div>
</DialogContent>
</Dialog>
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index 7eb94e1a6..c2ca45a85 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -5165,7 +5165,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "0.24.6"
+version = "0.24.7"
dependencies = [
"anyhow",
"axum",
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 314787324..2cb2a35c7 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 = "0.24.7"
+version = "0.24.8"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-core/src/pipes.rs b/screenpipe-core/src/pipes.rs
index 9737f96ff..c76ee8caa 100644
--- a/screenpipe-core/src/pipes.rs
+++ b/screenpipe-core/src/pipes.rs
@@ -30,20 +30,19 @@ mod pipes {
use once_cell::sync::Lazy;
// Add near other imports
+ use http_cache_reqwest::{CACacheManager, Cache, CacheMode, HttpCache, HttpCacheOptions};
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
- use std::str::FromStr;
- use reqwest_middleware::reqwest::Client;
use reqwest_middleware::reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION};
+ use reqwest_middleware::reqwest::Client;
use reqwest_middleware::ClientBuilder;
- use http_cache_reqwest::{CACacheManager, Cache, CacheMode, HttpCache, HttpCacheOptions};
+ use std::str::FromStr;
#[derive(Clone, Debug, Copy)]
pub enum PipeState {
Port(u16),
Pid(i32),
}
-
pub struct CronHandle {
shutdown: watch::Sender<bool>,
@@ -80,7 +79,10 @@ mod pipes {
.to_string()
}
- pub async fn run_pipe(pipe: &str, screenpipe_dir: PathBuf) -> Result<(tokio::process::Child, PipeState)> {
+ pub async fn run_pipe(
+ pipe: &str,
+ screenpipe_dir: PathBuf,
+ ) -> Result<(tokio::process::Child, PipeState)> {
let bun_path = find_bun_path().ok_or_else(|| anyhow::anyhow!("bun not found"))?;
let pipe_dir = screenpipe_dir.join("pipes").join(pipe);
let pipe_json_path = pipe_dir.join("pipe.json");
@@ -138,9 +140,9 @@ mod pipes {
"setting up next.js specific configuration for pipe: {}",
pipe
);
-
+
let mut assigned_port = None;
-
+
// Handle Next.js specific setup including crons
if pipe_json_path.exists() {
debug!("reading pipe.json for next.js configuration");
@@ -155,12 +157,16 @@ mod pipes {
assigned_port = Some(user_port as u16);
debug!("user-configured port {} is available", user_port);
} else {
- debug!("user-configured port {} is in use, will assign random port", user_port);
+ debug!(
+ "user-configured port {} is in use, will assign random port",
+ user_port
+ );
}
}
// Fallback to random port if needed
- let port = assigned_port.unwrap_or_else(|| pick_unused_port().expect("No ports free"));
+ let port =
+ assigned_port.unwrap_or_else(|| pick_unused_port().expect("No ports free"));
info!("using port {} for next.js pipe", port);
// Update pipe.json with the actual port being used
@@ -240,13 +246,16 @@ mod pipes {
debug!("successfully installed dependencies for next.js pipe");
} else {
let port = pick_unused_port().expect("No ports free");
- debug!("no pipe.json found, using random port {} for next.js pipe", port);
+ debug!(
+ "no pipe.json found, using random port {} for next.js pipe",
+ port
+ );
env_vars.push(("PORT".to_string(), port.to_string()));
}
// Try to build the Next.js project
let build_success = try_build_nextjs(&pipe_dir, &bun_path).await?;
-
+
let port = env_vars
.iter()
.find(|(k, _)| k == "PORT")
@@ -258,13 +267,15 @@ mod pipes {
// Run the Next.js project
info!(
"starting next.js project in {} mode",
- if build_success { "production" } else { "development" }
+ if build_success {
+ "production"
+ } else {
+ "development"
+ }
);
-
+
let mut command = Command::new(&bun_path);
- command
- .arg("run")
- .arg("--bun");
+ command.arg("run").arg("--bun");
if build_success {
command.arg("start");
@@ -619,7 +630,10 @@ mod pipes {
.with(Cache(HttpCache {
mode: CacheMode::Default,
manager: CACacheManager {
- path: home_dir().unwrap().join(".screenpipe").join(".http-cacache"),
+ path: home_dir()
+ .unwrap()
+ .join(".screenpipe")
+ .join(".http-cacache"),
},
options: HttpCacheOptions::default(),
}))
@@ -635,7 +649,10 @@ mod pipes {
.send()
.await?;
- debug!("GitHub API cache hit: {:?}", response.headers().get("x-cache"));
+ debug!(
+ "GitHub API cache hit: {:?}",
+ response.headers().get("x-cache")
+ );
let contents: Value = response.text().await?.parse()?;
let tree = contents["tree"]
@@ -652,7 +669,8 @@ mod pipes {
);
// Extract the base path for subfolder downloads
- let base_path = url.path_segments()
+ let base_path = url
+ .path_segments()
.and_then(|segments| {
let segments: Vec<_> = segments.collect();
if segments.len() >= 5 && segments[2] == "tree" {
@@ -791,25 +809,7 @@ mod pipes {
fn find_bun_path_internal() -> Option<PathBuf> {
debug!("starting search for bun executable");
- // Check if bun is in PATH
- if let Ok(path) = which(BUN_EXECUTABLE_NAME) {
- debug!("found bun in PATH: {:?}", path);
- return Some(path);
- }
- debug!("bun not found in PATH");
-
- // Check in current working directory
- if let Ok(cwd) = std::env::current_dir() {
- debug!("current working directory: {:?}", cwd);
- let bun_in_cwd = cwd.join(BUN_EXECUTABLE_NAME);
- if bun_in_cwd.is_file() && bun_in_cwd.exists() {
- debug!("found bun in current working directory: {:?}", bun_in_cwd);
- return Some(bun_in_cwd);
- }
- debug!("bun not found in current working directory");
- }
-
- // Check in executable directory
+ // Check in executable directory (eg tauri etc.)
if let Ok(exe_path) = std::env::current_exe() {
if let Some(exe_folder) = exe_path.parent() {
debug!("executable folder: {:?}", exe_folder);
@@ -847,6 +847,24 @@ mod pipes {
}
}
+ // Check if bun is in PATH
+ if let Ok(path) = which(BUN_EXECUTABLE_NAME) {
+ debug!("found bun in PATH: {:?}", path);
+ return Some(path);
+ }
+ debug!("bun not found in PATH");
+
+ // Check in current working directory
+ if let Ok(cwd) = std::env::current_dir() {
+ debug!("current working directory: {:?}", cwd);
+ let bun_in_cwd = cwd.join(BUN_EXECUTABLE_NAME);
+ if bun_in_cwd.is_file() && bun_in_cwd.exists() {
+ debug!("found bun in current working directory: {:?}", bun_in_cwd);
+ return Some(bun_in_cwd);
+ }
+ debug!("bun not found in current working directory");
+ }
+
error!("bun not found");
None
}
@@ -1023,8 +1041,8 @@ mod pipes {
}
async fn try_build_nextjs(pipe_dir: &Path, bun_path: &Path) -> Result<bool> {
- debug!("attempting to build next.js project in: {:?}", pipe_dir);
-
+ info!("attempting to build next.js project in: {:?}", pipe_dir);
+
// Check if build already exists and is valid
let build_dir = pipe_dir.join(".next");
if build_dir.exists() {