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

feat: pipe update tracking and one-click updates from store

Louis Beaumontc114a3cd14a7
diff --git a/apps/screenpipe-app-tauri/components/pipe-store.tsx b/apps/screenpipe-app-tauri/components/pipe-store.tsx
index bf26068c5..fec14e480 100644
--- a/apps/screenpipe-app-tauri/components/pipe-store.tsx
+++ b/apps/screenpipe-app-tauri/components/pipe-store.tsx
@@ -330,6 +330,9 @@ function DiscoverView() {
// Installed pipe names (for "Installed" badge)
const [installedNames, setInstalledNames] = useState<Set<string>>(new Set());
+ // Available updates from store
+ const [availableUpdates, setAvailableUpdates] = useState<Record<string, { latest_version: number; installed_version: number; locally_modified: boolean }>>({});
+
// Fetch installed pipes (cached 30s, invalidated on install)
useEffect(() => {
const cacheKey = "pipes/installed";
@@ -349,6 +352,21 @@ function DiscoverView() {
.catch(() => {});
}, [showDetail]);
+ // Check for pipe updates
+ useEffect(() => {
+ fetch("http://localhost:3030/pipes/store/check-updates")
+ .then((r) => r.ok ? r.json() : null)
+ .then((json) => {
+ if (!json) return;
+ const updates: Record<string, { latest_version: number; installed_version: number; locally_modified: boolean }> = {};
+ for (const u of json.data || []) {
+ updates[u.pipe_name] = { latest_version: u.latest_version, installed_version: u.installed_version, locally_modified: u.locally_modified };
+ }
+ setAvailableUpdates(updates);
+ })
+ .catch(() => {});
+ }, [showDetail]);
+
// Debounce search
const debounceRef = useRef<ReturnType<typeof setTimeout>>();
useEffect(() => {
@@ -560,6 +578,7 @@ function DiscoverView() {
onSourceReviewedChange={setSourceReviewed}
onInstall={handleInstall}
isInstalled={installedNames.has(selectedPipe.slug)}
+ hasUpdate={!!availableUpdates[selectedPipe.slug]}
reviewExpanded={reviewExpanded}
onToggleReview={() => setReviewExpanded(!reviewExpanded)}
reviewRating={reviewRating}
@@ -655,6 +674,7 @@ function DiscoverView() {
key={pipe.slug}
pipe={pipe}
isInstalled={installedNames.has(pipe.slug)}
+ hasUpdate={!!availableUpdates[pipe.slug]}
onInstall={() => handleInstall(pipe.slug)}
installing={installing === pipe.slug}
onClick={() => openDetail(pipe.slug)}
@@ -699,6 +719,7 @@ function DiscoverView() {
key={pipe.slug}
pipe={pipe}
isInstalled={installedNames.has(pipe.slug)}
+ hasUpdate={!!availableUpdates[pipe.slug]}
onInstall={() => handleInstall(pipe.slug)}
installing={installing === pipe.slug}
onClick={() => openDetail(pipe.slug)}
@@ -726,12 +747,14 @@ function DiscoverView() {
function FeaturedCard({
pipe,
isInstalled,
+ hasUpdate,
onInstall,
installing,
onClick,
}: {
pipe: StorePipe;
isInstalled: boolean;
+ hasUpdate?: boolean;
onInstall: () => void;
installing: boolean;
onClick: () => void;
@@ -761,12 +784,13 @@ function FeaturedCard({
</div>
<Button
size="sm"
- variant={isInstalled ? "outline" : "default"}
+ variant={isInstalled && !hasUpdate ? "outline" : "default"}
className={cn(
"h-7 px-3 text-xs font-semibold rounded-none uppercase tracking-wide flex-shrink-0",
- isInstalled && "pointer-events-none"
+ isInstalled && !hasUpdate && "pointer-events-none",
+ hasUpdate && "bg-amber-500 hover:bg-amber-600 text-white"
)}
- disabled={installing || isInstalled}
+ disabled={installing || (isInstalled && !hasUpdate)}
onClick={(e) => {
e.stopPropagation();
onInstall();
@@ -774,6 +798,8 @@ function FeaturedCard({
>
{installing ? (
<Loader2 className="h-3 w-3 animate-spin" />
+ ) : hasUpdate ? (
+ "UPDATE"
) : isInstalled ? (
"INSTALLED"
) : (
@@ -809,12 +835,14 @@ function FeaturedCard({
function PipeCard({
pipe,
isInstalled,
+ hasUpdate,
onInstall,
installing,
onClick,
}: {
pipe: StorePipe;
isInstalled: boolean;
+ hasUpdate?: boolean;
onInstall: () => void;
installing: boolean;
onClick: () => void;
@@ -846,12 +874,13 @@ function PipeCard({
</div>
<Button
size="sm"
- variant={isInstalled ? "outline" : "default"}
+ variant={isInstalled && !hasUpdate ? "outline" : "default"}
className={cn(
"h-7 px-3 text-xs font-semibold rounded-none uppercase tracking-wide flex-shrink-0",
- isInstalled && "pointer-events-none"
+ isInstalled && !hasUpdate && "pointer-events-none",
+ hasUpdate && "bg-amber-500 hover:bg-amber-600 text-white"
)}
- disabled={installing || isInstalled}
+ disabled={installing || (isInstalled && !hasUpdate)}
onClick={(e) => {
e.stopPropagation();
onInstall();
@@ -859,6 +888,8 @@ function PipeCard({
>
{installing ? (
<Loader2 className="h-3 w-3 animate-spin" />
+ ) : hasUpdate ? (
+ "UPDATE"
) : isInstalled ? (
"INSTALLED"
) : (
@@ -916,6 +947,7 @@ function PipeDetailPanel({
onSourceReviewedChange,
onInstall,
isInstalled,
+ hasUpdate,
reviewExpanded,
onToggleReview,
reviewRating,
@@ -937,6 +969,7 @@ function PipeDetailPanel({
onSourceReviewedChange: (v: boolean) => void;
onInstall: (slug: string) => void;
isInstalled: boolean;
+ hasUpdate?: boolean;
reviewExpanded: boolean;
onToggleReview: () => void;
reviewRating: number;
@@ -1036,21 +1069,24 @@ function PipeDetailPanel({
)}
<Button
size="sm"
- variant={isInstalled ? "outline" : "default"}
+ variant={isInstalled && !hasUpdate ? "outline" : "default"}
className={cn(
"h-9 px-5 text-sm font-semibold rounded-none uppercase tracking-wide flex-shrink-0",
- isInstalled && "pointer-events-none"
+ isInstalled && !hasUpdate && "pointer-events-none",
+ hasUpdate && "bg-amber-500 hover:bg-amber-600 text-white"
)}
disabled={
- installing === pipe.slug || isInstalled || (needsReview && !sourceReviewed)
+ installing === pipe.slug || (isInstalled && !hasUpdate) || (needsReview && !sourceReviewed)
}
onClick={() => onInstall(pipe.slug)}
>
{installing === pipe.slug ? (
<>
<Loader2 className="h-4 w-4 animate-spin mr-1.5" />
- INSTALLING...
+ {hasUpdate ? "UPDATING..." : "INSTALLING..."}
</>
+ ) : hasUpdate ? (
+ "UPDATE"
) : isInstalled ? (
"INSTALLED"
) : (
diff --git a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
index 082c98f4f..dab7dcbff 100644
--- a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
@@ -27,6 +27,7 @@ import {
Share2,
Link,
Upload,
+ ArrowUpCircle,
} from "lucide-react";
import { Textarea } from "@/components/ui/textarea";
import { Label } from "@/components/ui/label";
@@ -245,6 +246,9 @@ interface PipeStatus {
last_error: string | null;
current_execution_id: number | null;
consecutive_failures: number;
+ source_slug?: string;
+ installed_version?: number;
+ locally_modified?: boolean;
}
interface PipeRunLog {
@@ -612,6 +616,8 @@ export function PipesSection() {
});
const [searchQuery, setSearchQuery] = useState("");
const [availableConnections, setAvailableConnections] = useState<AvailableConnection[]>([]);
+ const [availableUpdates, setAvailableUpdates] = useState<Record<string, { latest_version: number; installed_version: number; locally_modified: boolean }>>({});
+ const [updatingPipe, setUpdatingPipe] = useState<string | null>(null);
const sharedPipeNames = new Set(
team.configs
.filter((c) => c.config_type === "pipe" && c.scope === "team")
@@ -754,9 +760,53 @@ export function PipesSection() {
} catch { /* server may not be running */ }
}, []);
+ const checkForUpdates = useCallback(async () => {
+ try {
+ const res = await fetch("http://localhost:3030/pipes/store/check-updates");
+ if (!res.ok) return;
+ const json = await res.json();
+ const updates: Record<string, { latest_version: number; installed_version: number; locally_modified: boolean }> = {};
+ for (const u of json.data || []) {
+ updates[u.pipe_name] = { latest_version: u.latest_version, installed_version: u.installed_version, locally_modified: u.locally_modified };
+ }
+ setAvailableUpdates(updates);
+ } catch {
+ // silently fail — not critical
+ }
+ }, []);
+
+ const updatePipe = async (pipeName: string, slug: string) => {
+ setUpdatingPipe(pipeName);
+ try {
+ const res = await fetch("http://localhost:3030/pipes/store/update", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ slug }),
+ });
+ if (!res.ok) {
+ const err = await res.json();
+ toast({ title: "update failed", description: err.error || "unknown error", variant: "destructive" });
+ return;
+ }
+ toast({ title: "pipe updated", description: `${pipeName} updated successfully` });
+ // Remove from updates map and refresh
+ setAvailableUpdates(prev => {
+ const next = { ...prev };
+ delete next[pipeName];
+ return next;
+ });
+ await fetchPipes();
+ } catch (e) {
+ toast({ title: "update failed", description: String(e), variant: "destructive" });
+ } finally {
+ setUpdatingPipe(null);
+ }
+ };
+
const trackedPipesView = useRef(false);
useEffect(() => {
fetchConnections();
+ checkForUpdates();
fetchPipes().then(() => {
if (!trackedPipesView.current) {
trackedPipesView.current = true;
@@ -1198,6 +1248,32 @@ export function PipesSection() {
{pipe.config.schedule}
</Badge>
+ {availableUpdates[pipe.config.name] && (
+ <Badge
+ variant="outline"
+ className="text-xs shrink-0 cursor-pointer border-amber-500/50 text-amber-600 dark:text-amber-400 hover:bg-amber-500/10 transition-colors"
+ onClick={(e) => {
+ e.stopPropagation();
+ const update = availableUpdates[pipe.config.name];
+ const slug = (pipe.config as any).config?.source_slug as string || pipe.source_slug || pipe.config.name;
+ if (update.locally_modified) {
+ if (confirm(`you have local changes to this pipe. updating to v${update.latest_version} will overwrite them. continue?`)) {
+ updatePipe(pipe.config.name, slug);
+ }
+ } else {
+ updatePipe(pipe.config.name, slug);
+ }
+ }}
+ >
+ {updatingPipe === pipe.config.name ? (
+ <Loader2 className="h-3 w-3 mr-1 animate-spin" />
+ ) : (
+ <ArrowUpCircle className="h-3 w-3 mr-1" />
+ )}
+ v{availableUpdates[pipe.config.name].installed_version} → v{availableUpdates[pipe.config.name].latest_version}
+ </Badge>
+ )}
+
{/* Run / Stop button */}
{isRunning ? (
<Button
@@ -1285,6 +1361,17 @@ export function PipesSection() {
</DropdownMenuItem>
</>
)}
+ {(pipe.source_slug || (pipe.config as any).config?.source_slug) && (
+ <DropdownMenuItem
+ onClick={() => {
+ checkForUpdates();
+ toast({ title: "checking for updates..." });
+ }}
+ >
+ <RefreshCw className="h-3.5 w-3.5 mr-2" />
+ check for updates
+ </DropdownMenuItem>
+ )}
<DropdownMenuItem
onClick={() => setPublishPipeName(pipe.config.name)}
>
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-pipes.ts b/apps/screenpipe-app-tauri/lib/hooks/use-pipes.ts
index 2a4d1b323..3072243e9 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-pipes.ts
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-pipes.ts
@@ -21,9 +21,15 @@ interface PipeStatus {
schedule: string;
enabled: boolean;
config: Record<string, unknown>;
+ source_slug?: string;
+ installed_version?: number;
+ source_hash?: string;
};
prompt_body: string;
is_running: boolean;
+ source_slug?: string;
+ installed_version?: number;
+ locally_modified?: boolean;
}
export function usePipes() {
diff --git a/crates/screenpipe-core/src/pipes/mod.rs b/crates/screenpipe-core/src/pipes/mod.rs
index e64b9bffc..631ecbc2c 100644
--- a/crates/screenpipe-core/src/pipes/mod.rs
+++ b/crates/screenpipe-core/src/pipes/mod.rs
@@ -131,6 +131,16 @@ pub struct PipeConfig {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub timeout: Option<u64>,
+ /// Store slug this pipe was installed from (set during store install).
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub source_slug: Option<String>,
+ /// Version at time of install from store.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub installed_version: Option<i64>,
+ /// SHA-256 hash of source_md at install time (to detect local edits).
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub source_hash: Option<String>,
+
/// Catches any extra fields from front-matter (backwards compat).
#[serde(default, flatten, skip_serializing_if = "HashMap::is_empty")]
pub config: HashMap<String, serde_json::Value>,
@@ -204,6 +214,16 @@ fn is_true(b: &bool) -> bool {
*b
}
+/// Simple FNV-1a 64-bit hash, sufficient for change detection.
+fn simple_hash(content: &str) -> String {
+ let mut hash: u64 = 0xcbf29ce484222325;
+ for byte in content.bytes() {
+ hash ^= byte as u64;
+ hash = hash.wrapping_mul(0x100000001b3);
+ }
+ format!("{:016x}", hash)
+}
+
/// Result of a single pipe run.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PipeRunLog {
@@ -232,6 +252,15 @@ pub struct PipeStatus {
pub current_execution_id: Option<i64>,
/// Consecutive scheduled failures from DB state.
pub consecutive_failures: i32,
+ /// Store slug if installed from registry.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub source_slug: Option<String>,
+ /// Version installed from store.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub installed_version: Option<i64>,
+ /// Whether the user has edited pipe.md since install (source_hash mismatch).
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub locally_modified: Option<bool>,
}
// ---------------------------------------------------------------------------
@@ -857,6 +886,15 @@ impl PipeManager {
let last_error = last_log.filter(|l| !l.success).map(|l| l.stderr.clone());
let mut cfg = config.clone();
cfg.name = name.clone();
+ let locally_modified = config.source_hash.as_ref().map(|expected_hash| {
+ let pipe_path = self.pipes_dir.join(name).join("pipe.md");
+ if let Ok(content) = std::fs::read_to_string(&pipe_path) {
+ let actual_hash = simple_hash(&content);
+ actual_hash != *expected_hash
+ } else {
+ false
+ }
+ });
let status = PipeStatus {
config: cfg,
last_run: last_log.map(|l| l.finished_at),
@@ -867,6 +905,9 @@ impl PipeManager {
last_error,
current_execution_id: exec_ids.get(name).copied(),
consecutive_failures: 0,
+ source_slug: config.source_slug.clone(),
+ installed_version: config.installed_version,
+ locally_modified,
};
(name.clone(), status)
})
@@ -906,6 +947,15 @@ impl PipeManager {
let last_error = last_log.filter(|l| !l.success).map(|l| l.stderr.clone());
let mut cfg = config.clone();
cfg.name = name.to_string();
+ let locally_modified = config.source_hash.as_ref().map(|expected_hash| {
+ let pipe_path = self.pipes_dir.join(name).join("pipe.md");
+ if let Ok(content) = std::fs::read_to_string(&pipe_path) {
+ let actual_hash = simple_hash(&content);
+ actual_hash != *expected_hash
+ } else {
+ false
+ }
+ });
PipeStatus {
config: cfg,
last_run: last_log.map(|l| l.finished_at),
@@ -916,6 +966,9 @@ impl PipeManager {
last_error,
current_execution_id: exec_ids.get(name).copied(),
consecutive_failures: 0,
+ source_slug: config.source_slug.clone(),
+ installed_version: config.installed_version,
+ locally_modified,
}
})
}?;
@@ -1951,6 +2004,74 @@ impl PipeManager {
))
}
+ /// Install a pipe from the store registry, tracking its origin for updates.
+ pub async fn install_pipe_from_store(
+ &self,
+ source_md: &str,
+ slug: &str,
+ version: i64,
+ ) -> Result<String> {
+ // Parse the source_md to get config + body
+ let (mut config, body) = parse_frontmatter(source_md)?;
+
+ // Set tracking fields
+ config.source_slug = Some(slug.to_string());
+ config.installed_version = Some(version);
+
+ // Hash the source_md content
+ let source_hash = simple_hash(source_md);
+ config.source_hash = Some(source_hash);
+
+ // Derive name from slug
+ let name = slug.to_string();
+ let dest_dir = self.pipes_dir.join(&name);
+ std::fs::create_dir_all(&dest_dir)?;
+
+ // Re-serialize with tracking fields included
+ let content = serialize_pipe(&config, &body)?;
+ std::fs::write(dest_dir.join("pipe.md"), &content)?;
+
+ self.load_pipes().await?;
+ info!("installed pipe '{}' from store (v{})", name, version);
+ Ok(name)
+ }
+
+ /// Update an installed pipe from the store with new content.
+ pub async fn update_pipe_from_store(
+ &self,
+ name: &str,
+ source_md: &str,
+ slug: &str,
+ version: i64,
+ ) -> Result<()> {
+ let dest_dir = self.pipes_dir.join(name);
+ if !dest_dir.exists() {
+ return Err(anyhow!("pipe '{}' not found", name));
+ }
+
+ let (mut config, body) = parse_frontmatter(source_md)?;
+
+ // Preserve user's enabled state and schedule from current config
+ let current_path = dest_dir.join("pipe.md");
+ if let Ok(current_content) = std::fs::read_to_string(&current_path) {
+ if let Ok((current_config, _)) = parse_frontmatter(&current_content) {
+ config.enabled = current_config.enabled;
+ config.preset = current_config.preset.clone();
+ }
+ }
+
+ config.source_slug = Some(slug.to_string());
+ config.installed_version = Some(version);
+ config.source_hash = Some(simple_hash(source_md));
+
+ let content = serialize_pipe(&config, &body)?;
+ std::fs::write(current_path, &content)?;
+
+ self.load_pipes().await?;
+ info!("updated pipe '{}' to store v{}", name, version);
+ Ok(())
+ }
+
/// Delete a pipe and its folder.
pub async fn delete_pipe(&self, name: &str) -> Result<()> {
let dir = self.pipes_dir.join(name);
@@ -3072,6 +3193,9 @@ mod tests {
config: HashMap::new(),
connections: vec![],
timeout: None,
+ source_slug: None,
+ installed_version: None,
+ source_hash: None,
};
let body = "Do something useful";
let serialized = serialize_pipe(&config, body).unwrap();
@@ -3168,6 +3292,9 @@ mod tests {
config: HashMap::new(),
connections: vec![],
timeout: None,
+ source_slug: None,
+ installed_version: None,
+ source_hash: None,
};
let prompt = render_prompt_with_port(&config, "body text", 3031, None, None);
assert!(prompt.contains("http://localhost:3031"));
@@ -3198,6 +3325,9 @@ mod tests {
config: HashMap::new(),
connections: vec![],
timeout: None,
+ source_slug: None,
+ installed_version: None,
+ source_hash: None,
};
let prompt = render_prompt_with_port(&config, "hello", 3030, None, None);
assert!(prompt.contains("http://localhost:3030"));
@@ -3226,6 +3356,9 @@ mod tests {
config: HashMap::new(),
connections: vec![],
timeout: None,
+ source_slug: None,
+ installed_version: None,
+ source_hash: None,
};
let prompt = render_prompt_with_port(
&config,
@@ -3262,6 +3395,9 @@ mod tests {
config: HashMap::new(),
connections: vec![],
timeout: None,
+ source_slug: None,
+ installed_version: None,
+ source_hash: None,
};
let prompt = render_prompt_with_port(&config, "body text", 3030, None, None);
assert!(!prompt.contains("System prompt:"));
@@ -3337,6 +3473,9 @@ mod tests {
config: HashMap::new(),
connections: vec![],
timeout: None,
+ source_slug: None,
+ installed_version: None,
+ source_hash: None,
},
last_run: None,
last_success: None,
@@ -3346,6 +3485,9 @@ mod tests {
last_error: None,
current_execution_id: Some(99),
consecutive_failures: 5,
+ source_slug: None,
+ installed_version: None,
+ locally_modified: None,
};
let json = serde_json::to_string(&status).unwrap();
assert!(json.contains("\"current_execution_id\":99"));
diff --git a/crates/screenpipe-core/src/pipes/permissions.rs b/crates/screenpipe-core/src/pipes/permissions.rs
index 66cb9fea8..7a85e7e89 100644
--- a/crates/screenpipe-core/src/pipes/permissions.rs
+++ b/crates/screenpipe-core/src/pipes/permissions.rs
@@ -451,6 +451,9 @@ mod tests {
allow_frames: true,
connections: vec![],
timeout: None,
+ source_slug: None,
+ installed_version: None,
+ source_hash: None,
};
let perms = PipePermissions::from_config(&config);
assert_eq!(perms.allow_apps, vec!["slack"]);
@@ -487,6 +490,9 @@ mod tests {
allow_frames: true,
connections: vec![],
timeout: None,
+ source_slug: None,
+ installed_version: None,
+ source_hash: None,
};
let perms = PipePermissions::from_config(&config);
// all permissions default to allow — no restrictions
diff --git a/crates/screenpipe-engine/src/routes/pipe_store.rs b/crates/screenpipe-engine/src/routes/pipe_store.rs
index 41af7c029..819b64481 100644
--- a/crates/screenpipe-engine/src/routes/pipe_store.rs
+++ b/crates/screenpipe-engine/src/routes/pipe_store.rs
@@ -237,9 +237,15 @@ pub async fn pipe_store_install(
}
};
- // 2. Install locally using PipeManager
+ // Extract version from registry response
+ let version = detail.get("version")
+ .or_else(|| detail.get("data").and_then(|d| d.get("version")))
+ .and_then(|v| v.as_i64())
+ .unwrap_or(1);
+
+ // 2. Install locally with store tracking
let mgr = pm.lock().await;
- let name = match mgr.install_pipe(&source_md).await {
+ let name = match mgr.install_pipe_from_store(&source_md, &body.slug, version).await {
Ok(name) => name,
Err(e) => return Json(json!({ "error": format!("failed to install pipe: {}", e) })),
};
@@ -251,6 +257,97 @@ pub async fn pipe_store_install(
Json(json!({ "success": true, "name": name, "slug": body.slug }))
}
+/// POST /pipes/store/update
+///
+/// Update an installed pipe to the latest version from the registry.
+pub async fn pipe_store_update(
+ State(pm): State<SharedPipeManager>,
+ Json(body): Json<StoreInstallRequest>,
+) -> Json<Value> {
+ let base = api_base_url();
+ let client = &*REGISTRY_CLIENT;
+
+ // 1. Fetch latest from registry
+ let detail_url = format!("{}/api/pipes/store/{}", base, body.slug);
+ let detail = match client.get(&detail_url).send().await {
+ Ok(resp) => match resp.json::<Value>().await {
+ Ok(body) => body,
+ Err(e) => return Json(json!({ "error": format!("failed to parse registry response: {}", e) })),
+ },
+ Err(e) => return Json(json!({ "error": format!("failed to reach registry: {}", e) })),
+ };
+
+ let source_md = match detail.get("source_md").or_else(|| detail.get("data").and_then(|d| d.get("source_md"))).and_then(|v| v.as_str()) {
+ Some(md) => md.to_string(),
+ None => return Json(json!({ "error": "pipe not found or missing source_md" })),
+ };
+
+ let version = detail.get("version")
+ .or_else(|| detail.get("data").and_then(|d| d.get("version")))
+ .and_then(|v| v.as_i64())
+ .unwrap_or(1);
+
+ // 2. Update locally
+ let mgr = pm.lock().await;
+ match mgr.update_pipe_from_store(&body.slug, &source_md, &body.slug, version).await {
+ Ok(()) => Json(json!({ "success": true, "slug": body.slug, "version": version })),
+ Err(e) => Json(json!({ "error": format!("failed to update pipe: {}", e) })),
+ }
+}
+
+/// GET /pipes/store/check-updates
+///
+/// Check for available updates for all store-installed pipes.
+/// Returns a map of slug -> latest_version for pipes that have updates.
+pub async fn pipe_store_check_updates(
+ State(pm): State<SharedPipeManager>,
+) -> Json<Value> {
+ let mgr = pm.lock().await;
+ let pipes = mgr.list_pipes().await;
+ drop(mgr);
+
+ let base = api_base_url();
+ let client = &*REGISTRY_CLIENT;
+
+ let mut updates: Vec<Value> = Vec::new();
+
+ for pipe in &pipes {
+ let slug = match &pipe.source_slug {
+ Some(s) => s.clone(),
+ None => continue,
+ };
+ let installed_version = pipe.installed_version.unwrap_or(0);
+
+ // Fetch latest version from registry
+ let detail_url = format!("{}/api/pipes/store/{}", base, slug);
+ let detail = match client.get(&detail_url).send().await {
+ Ok(resp) => match resp.json::<Value>().await {
+ Ok(v) => v,
+ Err(_) => continue,
+ },
+ Err(_) => continue,
+ };
+
+ let latest_version = detail
+ .get("version")
+ .or_else(|| detail.get("data").and_then(|d| d.get("version")))
+ .and_then(|v| v.as_i64())
+ .unwrap_or(0);
+
+ if latest_version > installed_version {
+ updates.push(json!({
+ "slug": slug,
+ "pipe_name": pipe.config.name,
+ "installed_version": installed_version,
+ "latest_version": latest_version,
+ "locally_modified": pipe.locally_modified.unwrap_or(false),
+ }));
+ }
+ }
+
+ Json(json!({ "data": updates }))
+}
+
/// POST /pipes/store/:slug/review
///
/// Submit a review for a pipe. Requires auth (Bearer token).
diff --git a/crates/screenpipe-engine/src/server.rs b/crates/screenpipe-engine/src/server.rs
index cc4e321c1..2f9770bac 100644
--- a/crates/screenpipe-engine/src/server.rs
+++ b/crates/screenpipe-engine/src/server.rs
@@ -640,6 +640,14 @@ impl SCServer {
"/store/install",
axum::routing::post(crate::routes::pipe_store::pipe_store_install),
)
+ .route(
+ "/store/update",
+ axum::routing::post(crate::routes::pipe_store::pipe_store_update),
+ )
+ .route(
+ "/store/check-updates",
+ axum::routing::get(crate::routes::pipe_store::pipe_store_check_updates),
+ )
.route(
"/store/:slug",
axum::routing::get(crate::routes::pipe_store::pipe_store_detail)