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

Bump app to v2.0.567

Louis Beaumont21347e379cac
diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline/timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline/timeline.tsx
index 95bda09a0..b311e47ab 100644
--- a/apps/screenpipe-app-tauri/components/rewind/timeline/timeline.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/timeline/timeline.tsx
@@ -441,9 +441,14 @@ export const TimelineSlider = ({
return map;
}, [frames]);
+ // Whether the user is actively interacting (popover open, dragging, or has selection).
+ // When true we freeze the visible frames to prevent server pushes from
+ // recomputing groups and killing the popover / selection.
+ const isUserInteracting = isDragging || activePopoverGroup !== null || selectionRange !== null;
+
// Adjust visible frames based on zoom - zoomed out shows more frames
// Use a stable window size to prevent jumpy behavior
- const visibleFrames = useMemo(() => {
+ const latestVisibleFrames = useMemo(() => {
if (!frames || frames.length === 0) return [];
// Fixed window centered on current index - zoom affects frame SIZE, not count
// This prevents jumpy behavior when zooming
@@ -453,6 +458,14 @@ export const TimelineSlider = ({
return frames.slice(start, end);
}, [frames, currentIndex]);
+ // Freeze visible frames while user is interacting to prevent
+ // WebSocket pushes from recomputing appGroups and losing popover/selection
+ const frozenFramesRef = useRef(latestVisibleFrames);
+ if (!isUserInteracting) {
+ frozenFramesRef.current = latestVisibleFrames;
+ }
+ const visibleFrames = isUserInteracting ? frozenFramesRef.current : latestVisibleFrames;
+
// Dynamically compute app names from the current viewport, sorted by frequency
const viewportAppNames = useMemo(() => {
const counts = new Map<string, number>();
@@ -968,38 +981,35 @@ export const TimelineSlider = ({
>
{group.topDomains && group.topDomains.length > 0 ? (
// Browser group: show website favicons
- group.topDomains.slice(0, groupWidth > 60 ? 2 : 1).map((domain, idx) => {
- const iconSize = groupWidth > 60 ? 32 : 20;
- const wh = groupWidth > 60 ? 'w-8 h-8' : 'w-5 h-5';
- return (
- <motion.div
- key={`fav-${domain}-${idx}`}
- className={`${wh} rounded flex-shrink-0 overflow-hidden flex items-center justify-center bg-background/60`}
- style={{
- zIndex: 10 - idx,
- position: 'relative',
- }}
- variants={{
- collapsed: {
- marginTop: idx === 0 ? 0 : -10,
- scale: 1
- },
- expanded: {
- marginTop: idx === 0 ? 0 : 4,
- scale: 1.1
- }
- }}
- transition={{ type: "spring", stiffness: 400, damping: 25 }}
- >
- <FaviconImg
- domain={domain}
- fallbackAppName={group.appName}
- size={iconSize}
- className="rounded-sm object-contain"
- />
- </motion.div>
- );
- })
+ group.topDomains.slice(0, groupWidth > 60 ? 2 : 1).map((domain, idx) => (
+ <motion.div
+ key={`fav-${domain}-${idx}`}
+ className="w-8 h-8 rounded flex-shrink-0 overflow-hidden flex items-center justify-center"
+ style={{
+ zIndex: 10 - idx,
+ position: 'relative',
+ backgroundColor: appNameToColor(group.appName, 0.3),
+ }}
+ variants={{
+ collapsed: {
+ marginTop: idx === 0 ? 0 : -10,
+ scale: 1
+ },
+ expanded: {
+ marginTop: idx === 0 ? 0 : 4,
+ scale: 1.1
+ }
+ }}
+ transition={{ type: "spring", stiffness: 400, damping: 25 }}
+ >
+ <FaviconImg
+ domain={domain}
+ fallbackAppName={group.appName}
+ size={32}
+ className="w-full h-full rounded-sm object-contain"
+ />
+ </motion.div>
+ ))
) : (
// Non-browser group (or no URLs): show app icons
group.appNames.slice(0, 2).map((appName, idx) => (
diff --git a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
index 283b6fc9d..10b7b4a77 100644
--- a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
@@ -723,9 +723,9 @@ export function PipesSection() {
variant="outline"
size="sm"
className="h-6 text-[11px] px-2"
- onClick={() => setShowUpgrade(true)}
+ onClick={() => openUrl("https://screenpi.pe/billing")}
>
- get more queries →
+ buy credits →
</Button>
</div>
);
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index 6b652ecb4..ebe4ff03c 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -1036,11 +1036,14 @@ export function StandaloneChat({ className }: { className?: string } = {}) {
(async () => {
if (piInfo?.running) {
try {
- // Abort any in-flight message, then reset session
- if (piMessageIdRef.current) {
- await commands.piAbort();
- }
+ // Abort any in-flight processing, then reset session
+ // Always abort — Pi may be processing even if our ref was cleared
+ await commands.piAbort();
+ // Wait for Pi to process the abort before sending new_session
+ await new Promise(r => setTimeout(r, 500));
await commands.piNewSession();
+ // Wait for Pi to process the session reset before sending prompt
+ await new Promise(r => setTimeout(r, 500));
} catch (e) {
console.warn("[Pi] Failed to reset session:", e);
}
@@ -1064,7 +1067,6 @@ export function StandaloneChat({ className }: { className?: string } = {}) {
try {
const info = await commands.piInfo();
if (info.status === "ok" && info.data.running) {
- // Update React state so canChat becomes true before we send
setPiInfo(info.data);
return true;
}
@@ -1075,7 +1077,7 @@ export function StandaloneChat({ className }: { className?: string } = {}) {
};
const ready = piInfo?.running || await waitForPi(10000);
if (ready) {
- // Give React one tick to re-render with updated piInfo so sendMessage's canChat is true
+ // Give React a tick to re-render with updated piInfo so sendMessage's canChat is true
setTimeout(() => {
sendMessageRef.current?.(fullMessage);
}, 300);
@@ -1660,6 +1662,10 @@ export function StandaloneChat({ className }: { className?: string } = {}) {
setMessages((prev) =>
prev.map((m) => m.id === msgId ? { ...m, content: "This model requires an upgrade." } : m)
);
+ } else if (fullError.includes("already processing")) {
+ // Transient error — Pi was still busy when the prompt arrived.
+ // Don't show it; Pi will process the message once it's free.
+ console.warn("[Pi] Agent busy, waiting for it to finish:", fullError);
} else {
setMessages((prev) =>
prev.map((m) => m.id === msgId ? { ...m, content: `Error: ${fullError || "Something went wrong"}` } : m)
diff --git a/apps/screenpipe-app-tauri/components/upgrade-dialog.tsx b/apps/screenpipe-app-tauri/components/upgrade-dialog.tsx
index 761de559c..4b71adc3f 100644
--- a/apps/screenpipe-app-tauri/components/upgrade-dialog.tsx
+++ b/apps/screenpipe-app-tauri/components/upgrade-dialog.tsx
@@ -14,7 +14,7 @@ import { Badge } from "@/components/ui/badge";
import { open as openUrl } from "@tauri-apps/plugin-shell";
import { commands } from "@/lib/utils/tauri";
import { useSettings } from "@/lib/hooks/use-settings";
-import { Sparkles, Zap, Clock, Star } from "lucide-react";
+import { Sparkles, Zap, Clock, Star, CreditCard } from "lucide-react";
import posthog from "posthog-js";
interface UpgradeDialogProps {
@@ -151,6 +151,24 @@ export function UpgradeDialog({
</Button>
)}
+ <Button
+ variant="outline"
+ className="w-full justify-start gap-2.5 h-auto py-2.5 text-xs"
+ onClick={async () => {
+ trackAction("buy_credits");
+ await openUrl("https://screenpi.pe/billing");
+ onOpenChange(false);
+ }}
+ >
+ <CreditCard className="h-4 w-4 shrink-0" />
+ <div className="text-left flex-1 min-w-0">
+ <div className="font-medium">buy credits</div>
+ <div className="text-[11px] text-muted-foreground mt-0.5">
+ pay per query — no subscription needed
+ </div>
+ </div>
+ </Button>
+
<Button
variant="ghost"
className="w-full justify-start gap-2.5 h-auto py-2.5 text-xs"
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 7f476b5a6..4d217a5bc 100755
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -8097,7 +8097,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.0.566"
+version = "2.0.567"
dependencies = [
"anyhow",
"arboard",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index b75896d97..ea6a0dc58 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.0.566"
+version = "2.0.567"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
index 53655eee1..422d77160 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
@@ -57,37 +57,6 @@ fn build_command_for_path(path: &str) -> Command {
}
}
-/// Async version for tokio::process::Command
-#[cfg(windows)]
-fn build_async_command_for_path(path: &str) -> tokio::process::Command {
- if path.ends_with(".cmd") || path.ends_with(".bat") {
- let mut cmd = tokio::process::Command::new("cmd.exe");
- cmd.args(["/C", path]);
- cmd
- } else if path.ends_with(".exe") {
- tokio::process::Command::new(path)
- } else if let Some(bun) = find_bun_executable() {
- let mut cmd = tokio::process::Command::new(bun);
- cmd.arg(path);
- cmd
- } else {
- tokio::process::Command::new(path)
- }
-}
-
-/// On Unix, pi's shebang is `#!/usr/bin/env node` but screenpipe only bundles
-/// bun. Run `bun <pi_path>` so it works without node installed.
-#[cfg(not(windows))]
-fn build_async_command_for_path(path: &str) -> tokio::process::Command {
- if let Some(bun) = find_bun_executable() {
- let mut cmd = tokio::process::Command::new(bun);
- cmd.arg(path);
- cmd
- } else {
- tokio::process::Command::new(path)
- }
-}
-
const PI_PACKAGE: &str = "@mariozechner/[email protected]";
const SCREENPIPE_API_URL: &str = "https://api.screenpi.pe/v1";
@@ -1189,110 +1158,6 @@ pub async fn cleanup_pi(state: &PiState) {
}
}
-// ============================================================================
-// Legacy functions for obsidian sync (print mode)
-// ============================================================================
-
-/// Run pi with a prompt (non-interactive print mode)
-pub async fn run(
- prompt: &str,
- user_token: Option<&str>,
- working_dir: &str,
- pid_tx: Option<tokio::sync::oneshot::Sender<u32>>,
-) -> Result<String, String> {
- ensure_pi_config(user_token, None)?;
-
- let pi_path = match find_pi_executable() {
- Some(p) => p,
- None => {
- if !PI_INSTALL_DONE.load(Ordering::SeqCst) {
- info!("Pi not found yet, waiting for background install to finish...");
- for _ in 0..60 {
- tokio::time::sleep(std::time::Duration::from_secs(1)).await;
- if PI_INSTALL_DONE.load(Ordering::SeqCst) {
- break;
- }
- }
- }
- find_pi_executable()
- .ok_or_else(|| format!("Pi not found. Install with: bun add -g {}", PI_PACKAGE))?
- }
- };
-
- // Use cmd.exe /C wrapper for .cmd files on Windows (Rust 1.77+ CVE fix)
- let mut cmd = build_async_command_for_path(&pi_path);
- cmd.current_dir(working_dir);
- cmd.arg("-p").arg(prompt);
- cmd.arg("--provider").arg("screenpipe");
- cmd.arg("--model").arg("claude-haiku-4-5");
-
- // Ensure bun is discoverable by pi.exe shim (see pi_start_inner for details)
- if let Some(bun) = find_bun_executable() {
- if let Some(bun_dir) = std::path::Path::new(&bun).parent() {
- let current_path = std::env::var("PATH").unwrap_or_default();
- let sep = if cfg!(windows) { ";" } else { ":" };
- let new_path = format!("{}{}{}", bun_dir.display(), sep, current_path);
- cmd.env("PATH", new_path);
- }
- }
-
- if let Some(token) = user_token {
- cmd.env("SCREENPIPE_API_KEY", token);
- }
-
- cmd.stdout(std::process::Stdio::piped());
- cmd.stderr(std::process::Stdio::piped());
-
- // On Windows, prevent console window from appearing
- #[cfg(windows)]
- {
- #[allow(unused_imports)]
- use std::os::windows::process::CommandExt;
- const CREATE_NO_WINDOW: u32 = 0x08000000;
- cmd.creation_flags(CREATE_NO_WINDOW);
- }
-
- let child = cmd.spawn()
- .map_err(|e| format!("Failed to spawn pi: {}", e))?;
-
- if let Some(tx) = pid_tx {
- if let Some(pid) = child.id() {
- let _ = tx.send(pid);
- }
- }
-
- let output = child.wait_with_output().await
- .map_err(|e| format!("Failed to wait for pi: {}", e))?;
-
- let stdout = String::from_utf8_lossy(&output.stdout).to_string();
- let stderr = String::from_utf8_lossy(&output.stderr).to_string();
-
- if output.status.success() {
- Ok(stdout)
- } else {
- Err(if !stderr.is_empty() { stderr } else { format!("Pi exited with code {:?}", output.status.code()) })
- }
-}
-
-/// Kill a pi process by PID
-pub fn kill(pid: u32) -> Result<(), String> {
- #[cfg(unix)]
- {
- let _ = std::process::Command::new("kill")
- .args(["-TERM", &pid.to_string()])
- .output();
- }
- #[cfg(windows)]
- {
- use std::os::windows::process::CommandExt;
- const CREATE_NO_WINDOW: u32 = 0x08000000;
- let _ = std::process::Command::new("taskkill")
- .args(["/F", "/PID", &pid.to_string()])
- .creation_flags(CREATE_NO_WINDOW)
- .output();
- }
- Ok(())
-}
/// Find bun executable (shared by pi_install and ensure_pi_installed_background)
fn find_bun_executable() -> Option<String> {
diff --git a/packages/ai-gateway/src/services/usage-tracker.ts b/packages/ai-gateway/src/services/usage-tracker.ts
index a5c394316..ad0d302db 100644
--- a/packages/ai-gateway/src/services/usage-tracker.ts
+++ b/packages/ai-gateway/src/services/usage-tracker.ts
@@ -232,6 +232,17 @@ export async function trackUsage(
const credit = await tryDeductCredit(env, userId, 'ai_query');
if (credit.success) {
console.log(`credit deducted for ${userId}, remaining: ${credit.remaining}`);
+ // Trigger auto-reload check when balance is getting low
+ if (credit.remaining <= 10 && env.WEBSITE_URL && env.AUTO_RELOAD_SECRET) {
+ fetch(`${env.WEBSITE_URL}/api/billing/auto-reload-check`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${env.AUTO_RELOAD_SECRET}`,
+ },
+ body: JSON.stringify({ clerk_id: await resolveClerkId(env, userId), remaining_balance: credit.remaining }),
+ }).catch(() => {}); // fire-and-forget
+ }
return {
used: existing.daily_count,
limit: limits.dailyQueries,
diff --git a/packages/ai-gateway/src/types.ts b/packages/ai-gateway/src/types.ts
index a3d8883f7..2cec64efc 100644
--- a/packages/ai-gateway/src/types.ts
+++ b/packages/ai-gateway/src/types.ts
@@ -146,6 +146,9 @@ export interface Env {
DB: D1Database;
// Sentry error tracking
SENTRY_DSN: string;
+ // Auto-reload settings
+ WEBSITE_URL: string;
+ AUTO_RELOAD_SECRET: string;
}
// User tier for rate limiting and model access