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: complete event-triggered pipe execution + UI visibility

Louis Beaumonte43780e42899
diff --git a/apps/screenpipe-app-tauri/components/pipe-monitor.tsx b/apps/screenpipe-app-tauri/components/pipe-monitor.tsx
index 0d074a27e..3e9f7bf60 100644
--- a/apps/screenpipe-app-tauri/components/pipe-monitor.tsx
+++ b/apps/screenpipe-app-tauri/components/pipe-monitor.tsx
@@ -275,12 +275,17 @@ function PipeRow({
</span>
)}
- {/* Schedule */}
+ {/* Schedule + event triggers */}
<span
- className="text-xs text-muted-foreground shrink-0 text-right font-mono truncate max-w-[100px]"
+ className="text-xs text-muted-foreground shrink-0 text-right font-mono truncate max-w-[140px]"
title={pipe.config.schedule || "manual"}
>
{humanizeSchedule(pipe.config.schedule)}
+ {pipe.config.trigger?.events?.length ? (
+ <span className="ml-1 text-[10px] text-primary/70" title={`events: ${pipe.config.trigger.events.join(", ")}`}>
+ ⚡{pipe.config.trigger.events.length}
+ </span>
+ ) : null}
</span>
{/* Last run */}
diff --git a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
index d066445de..3959d5866 100644
--- a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
@@ -276,6 +276,10 @@ interface PipeConfig {
preset?: string | string[];
history?: boolean;
connections?: string[];
+ trigger?: {
+ events?: string[];
+ custom?: string[];
+ };
// serde(flatten) merges extra YAML fields into this level at runtime
[key: string]: unknown;
}
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-device-monitor.ts b/apps/screenpipe-app-tauri/lib/hooks/use-device-monitor.ts
index ed2397e24..4c1482d7b 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-device-monitor.ts
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-device-monitor.ts
@@ -37,6 +37,10 @@ export interface RemotePipeStatus {
schedule: string;
enabled: boolean;
source_slug?: string;
+ trigger?: {
+ events?: string[];
+ custom?: string[];
+ };
};
is_running: boolean;
last_run?: string;
diff --git a/crates/screenpipe-core/src/pipes/mod.rs b/crates/screenpipe-core/src/pipes/mod.rs
index 2327a263e..8854fea3f 100644
--- a/crates/screenpipe-core/src/pipes/mod.rs
+++ b/crates/screenpipe-core/src/pipes/mod.rs
@@ -2569,7 +2569,11 @@ impl PipeManager {
.collect()
};
- // Drain pending workflow events and trigger matching pipes
+ // Drain pending workflow events and mark matching pipes for immediate execution.
+ // We reset their last_run to epoch so the existing should_run() check
+ // passes on this tick, reusing the full execution path without duplication.
+ let mut event_triggered: std::collections::HashSet<String> =
+ std::collections::HashSet::new();
{
use futures::FutureExt;
while let Some(event) =
@@ -2582,7 +2586,6 @@ impl PipeManager {
}
if let Some(ref trigger) = config.trigger {
if trigger.events.iter().any(|e| e == event_type) {
- // Check not already running
let already_running = {
let r = running.lock().await;
r.contains_key(name)
@@ -2600,11 +2603,9 @@ impl PipeManager {
event.data.confidence * 100.0,
name
);
- // Record last_run to prevent schedule from also firing immediately
- last_run.insert(name.clone(), Utc::now());
- if let Some(ref store) = store {
- let _ = store.upsert_scheduler_state(name, true).await;
- }
+ // Reset last_run so should_run() passes for "manual" pipes too
+ last_run.remove(name);
+ event_triggered.insert(name.clone());
}
}
}
@@ -2616,8 +2617,9 @@ impl PipeManager {
continue;
}
+ let triggered_by_event = event_triggered.contains(name);
let last = last_run.get(name).copied().unwrap_or(DateTime::UNIX_EPOCH);
- if !should_run(&config.schedule, last) {
+ if !triggered_by_event && !should_run(&config.schedule, last) {
continue;
}
@@ -2730,6 +2732,7 @@ impl PipeManager {
extra_context.as_deref(),
);
let pipe_name = name.clone();
+ let is_event_triggered = triggered_by_event;
let logs_ref = logs.clone();
let running_ref = running.clone();
let running_exec_ids_ref = running_execution_ids.clone();
@@ -2742,11 +2745,12 @@ impl PipeManager {
tokio::spawn(async move {
// Create DB execution row
+ let trigger = if is_event_triggered { "event" } else { "scheduled" };
let exec_id = if let Some(ref store) = store_ref {
match store
.create_execution(
&pipe_name,
- "scheduled",
+ trigger,
&model,
provider.as_deref(),
)