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
fix: resolve merge conflicts, accept upstream changes
Louis Beaumont7185b4895ea9
diff --git a/Cargo.lock b/Cargo.lockindex fd45993e9..7348569d7 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -6414,7 +6414,7 @@ dependencies = [[[package]]name = "screenpipe-audio"-version = "0.3.225"+version = "0.3.223"dependencies = ["anyhow","audiopipe",@@ -6472,7 +6472,7 @@ dependencies = [[[package]]name = "screenpipe-config"-version = "0.3.225"+version = "0.3.223"dependencies = ["dirs 6.0.0","serde",@@ -6484,7 +6484,7 @@ dependencies = [[[package]]name = "screenpipe-connect"-version = "0.3.225"+version = "0.3.223"dependencies = ["anyhow","async-trait",@@ -6510,7 +6510,7 @@ dependencies = [[[package]]name = "screenpipe-core"-version = "0.3.225"+version = "0.3.223"dependencies = ["accessibility","accessibility-sys",@@ -6553,7 +6553,7 @@ dependencies = [[[package]]name = "screenpipe-db"-version = "0.3.225"+version = "0.3.223"dependencies = ["anyhow","chrono",@@ -6565,7 +6565,6 @@ dependencies = ["once_cell","rand 0.8.5","regex",- "screenpipe-core","serde","serde_json","sqlite-vec",@@ -6578,7 +6577,7 @@ dependencies = [[[package]]name = "screenpipe-engine"-version = "0.3.225"+version = "0.3.223"dependencies = ["anyhow","async-trait",@@ -6646,7 +6645,7 @@ dependencies = [[[package]]name = "screenpipe-events"-version = "0.3.225"+version = "0.3.223"dependencies = ["anyhow","chrono",@@ -6664,7 +6663,7 @@ dependencies = [[[package]]name = "screenpipe-screen"-version = "0.3.225"+version = "0.3.223"dependencies = ["accessibility-sys","anyhow",@@ -6704,7 +6703,7 @@ dependencies = [[[package]]name = "screenpipe-vault"-version = "0.3.225"+version = "0.3.223"dependencies = ["argon2","chacha20poly1305",diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsxindex ea5b09e06..a5808e539 100644--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx@@ -10,7 +10,7 @@ import { Input } from "@/components/ui/input";import { Button } from "@/components/ui/button";import { useSettings, ChatMessage, ChatConversation } from "@/lib/hooks/use-settings";import { cn } from "@/lib/utils";-import { Loader2, Send, Square, User, Settings, ExternalLink, X, ImageIcon, Zap, History, Search, Trash2, ChevronLeft, ChevronRight, ChevronDown, ChevronUp, Plus, Copy, Check, Clock, Paperclip, Filter } from "lucide-react";+import { Loader2, Send, Square, User, Settings, ExternalLink, X, ImageIcon, History, Search, Trash2, ChevronLeft, ChevronRight, ChevronDown, ChevronUp, Plus, Copy, Check, Clock, Paperclip, Filter } from "lucide-react";import { SchedulePromptDialog } from "@/components/chat/schedule-prompt-dialog";import { toast } from "@/components/ui/use-toast";import { motion, AnimatePresence } from "framer-motion";@@ -36,7 +36,6 @@ import { usePlatform } from "@/lib/hooks/use-platform";import { useSqlAutocomplete } from "@/lib/hooks/use-sql-autocomplete";import { homeDir, join } from "@tauri-apps/api/path";import { useTimelineStore } from "@/lib/hooks/use-timeline-store";-import { UpgradeDialog } from "@/components/upgrade-dialog";import { Dialog, DialogContent } from "@/components/ui/dialog";import {parseMentions,@@ -112,16 +111,6 @@ function buildDailyLimitMessage(errorStr: string): string {}/** Extract the gateway-reported tier from an error string, if present. */-function extractTierFromError(errorStr: string): "anonymous" | "logged_in" | "subscribed" | undefined {- try {- const match = errorStr.match(/"tier":\s*"([^"]+)"/);- if (match?.[1] === "subscribed" || match?.[1] === "logged_in" || match?.[1] === "anonymous") {- return match[1] as "anonymous" | "logged_in" | "subscribed";- }- } catch {}- return undefined;-}-// Helper to get timezone offset string (e.g., "+1" or "-5")function getTimezoneOffsetString(): string {const offsetMinutes = new Date().getTimezoneOffset();@@ -905,10 +894,6 @@ export function StandaloneChat({ className }: { className?: string } = {}) {const inputRef = useRef<HTMLTextAreaElement>(null);const dropdownRef = useRef<HTMLDivElement>(null);- const [showUpgradeDialog, setShowUpgradeDialog] = useState(false);- const [upgradeReason, setUpgradeReason] = useState<"daily_limit" | "model_not_allowed" | "rate_limit">("daily_limit");- const [upgradeResetsAt, setUpgradeResetsAt] = useState<string | undefined>();- const [upgradeTier, setUpgradeTier] = useState<"anonymous" | "logged_in" | "subscribed" | undefined>();const [scheduleDialogMessage, setScheduleDialogMessage] = useState<{ prompt: string; response: string } | null>(null);const [prefillContext, setPrefillContext] = useState<string | null>(null);const [prefillSource, setPrefillSource] = useState<string>("search");@@ -1770,20 +1755,8 @@ export function StandaloneChat({ className }: { className?: string } = {}) {const isDailyLimit = errorStr.includes("daily_limit_exceeded") || errorStr.includes("daily_cost_limit_exceeded");const isPerMinuteRate = errorStr.includes("rate limit exceeded") || errorStr.includes("requests per minute");- // Extract reset time if available- try {- const resetMatch = errorStr.match(/"reset_in":\s*(\d+)/);- const resetsAtMatch = errorStr.match(/"resets_at":\s*"([^"]+)"/);- if (resetsAtMatch) setUpgradeResetsAt(resetsAtMatch[1]);- else if (resetMatch) setUpgradeResetsAt(`${resetMatch[1]} seconds`);- } catch {}-if (isDailyLimit) {- setUpgradeReason("daily_limit");- setUpgradeTier(extractTierFromError(errorStr));posthog.capture("wall_hit", { reason: "daily_limit", source: "chat" });- } else {- setUpgradeReason("rate_limit");}if (piMessageIdRef.current) {@@ -1805,7 +1778,6 @@ export function StandaloneChat({ className }: { className?: string } = {}) {}// Don't clear refs yet — agent_end will follow} else if (errorStr.includes("model_not_allowed")) {- setUpgradeReason("model_not_allowed");if (piMessageIdRef.current) {const msgId = piMessageIdRef.current;setMessages((prev) =>@@ -1829,16 +1801,12 @@ export function StandaloneChat({ className }: { className?: string } = {}) {if (isDailyLimit) {try {const match = fullError.match(/"resets_at":\s*"([^"]+)"/);- if (match) setUpgradeResetsAt(match[1]);} catch {}- setUpgradeReason("daily_limit");- setUpgradeTier(extractTierFromError(fullError));- setMessages((prev) =>+ setMessages((prev) =>prev.map((m) => m.id === msgId ? { ...m, content: buildDailyLimitMessage(fullError) } : m));} else {- setUpgradeReason("rate_limit");- const waitMatch = fullError.match(/wait (\d+) seconds/i);+ const waitMatch = fullError.match(/wait (\d+) seconds/i);const waitTime = waitMatch ? waitMatch[1] : "a moment";const content = isPerMinuteRate? `Rate limited — please wait ${waitTime} seconds and try again.`@@ -1848,8 +1816,7 @@ export function StandaloneChat({ className }: { className?: string } = {}) {);}} else if (fullError.includes("model_not_allowed")) {- setUpgradeReason("model_not_allowed");- setMessages((prev) =>+ setMessages((prev) =>prev.map((m) => m.id === msgId ? { ...m, content: "This model requires an upgrade." } : m));} else if (fullError.includes("already processing")) {@@ -1874,16 +1841,12 @@ export function StandaloneChat({ className }: { className?: string } = {}) {if (errMsg.includes("credits_exhausted") || errMsg.includes("daily_limit_exceeded") || errMsg.includes("daily_cost_limit_exceeded") || errMsg.includes("429")) {try {const resetsAtMatch = errMsg.match(/"resets_at":\s*"([^"]+)"/);- if (resetsAtMatch) setUpgradeResetsAt(resetsAtMatch[1]);- } catch {}- setUpgradeReason("daily_limit");- setUpgradeTier(extractTierFromError(errMsg));- posthog.capture("wall_hit", { reason: "daily_limit", source: "chat" });+ } catch {}+ posthog.capture("wall_hit", { reason: "daily_limit", source: "chat" });setMessages((prev) =>prev.map((m) => m.id === msgId ? { ...m, content: buildDailyLimitMessage(errMsg) } : m));} else if (errMsg.includes("rate limit") || errMsg.includes("rate_limit")) {- setUpgradeReason("rate_limit");setMessages((prev) =>prev.map((m) => m.id === msgId ? { ...m, content: "Rate limited — try again in a moment." } : m));@@ -1933,14 +1896,10 @@ export function StandaloneChat({ className }: { className?: string } = {}) {if (errStr.includes("credits_exhausted") || errStr.includes("daily_limit_exceeded") || errStr.includes("daily_cost_limit_exceeded") || errStr.includes("429")) {try {const resetsAtMatch = errStr.match(/"resets_at":\s*"([^"]+)"/);- if (resetsAtMatch) setUpgradeResetsAt(resetsAtMatch[1]);- } catch {}- setUpgradeReason("daily_limit");- setUpgradeTier(extractTierFromError(errStr));- content = buildDailyLimitMessage(errStr);+ } catch {}+ content = buildDailyLimitMessage(errStr);} else if (errStr.includes("rate limit")) {- setUpgradeReason("rate_limit");- content = "Rate limited — try again in a moment.";+ content = "Rate limited — try again in a moment.";} else {content = `Error: ${errStr}`;}@@ -2034,16 +1993,12 @@ export function StandaloneChat({ className }: { className?: string } = {}) {if (isDailyLimit) {try {const match = errorStr.match(/"resets_at":\s*"([^"]+)"/);- if (match) setUpgradeResetsAt(match[1]);} catch {}- setUpgradeReason("daily_limit");- setUpgradeTier(extractTierFromError(errorStr));- setMessages((prev) =>+ setMessages((prev) =>prev.map((m) => m.id === msgId ? { ...m, content: buildDailyLimitMessage(errorStr) } : m));} else {- setUpgradeReason("rate_limit");- const waitMatch = errorStr.match(/wait (\d+) seconds/i);+ const waitMatch = errorStr.match(/wait (\d+) seconds/i);const waitTime = waitMatch ? waitMatch[1] : "a moment";const content = isPerMinuteRate? `Rate limited — please wait ${waitTime} seconds and try again.`@@ -2053,8 +2008,7 @@ export function StandaloneChat({ className }: { className?: string } = {}) {);}} else if (errorStr.includes("model_not_allowed")) {- setUpgradeReason("model_not_allowed");- setMessages((prev) =>+ setMessages((prev) =>prev.map((m) => m.id === msgId ? { ...m, content: "This model requires an upgrade." } : m));} else {@@ -2212,7 +2166,6 @@ export function StandaloneChat({ className }: { className?: string } = {}) {const line = event.payload;if (line.includes("model_not_allowed") || line.includes("403")) {const msgId = piMessageIdRef.current;- setUpgradeReason("model_not_allowed");if (msgId) {setMessages((prev) =>prev.map((m) => m.id === msgId ? { ...m, content: "This model requires an upgrade — try a different model in your AI preset." } : m)@@ -3146,22 +3099,6 @@ export function StandaloneChat({ className }: { className?: string } = {}) {)}><MessageContent message={message} onImageClick={(images, index) => setImageViewer({ images, index })} />- {/* Upgrade button for daily limit errors (not shown for free model suggestions) */}- {message.role === "assistant" &&- !message.content.includes("Switch to a free model") &&- !message.content.includes("temporarily overloaded") &&- (message.content.includes("free queries") ||- message.content.includes("daily Pro limit") ||- message.content.includes("daily query limit") ||- message.content.includes("requires an upgrade")) && (- <button- onClick={() => setShowUpgradeDialog(true)}- className="mt-3 inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-foreground text-background text-sm font-medium hover:bg-background hover:text-foreground transition-colors duration-150"- >- <Zap className="h-4 w-4" />- upgrade now- </button>- )}</div>{/* Action buttons - appear on hover, outside the message box */}<div className="flex items-center gap-0.5 self-end mt-1 opacity-0 group-hover/message:opacity-100 transition-all duration-200">@@ -3745,14 +3682,6 @@ export function StandaloneChat({ className }: { className?: string } = {}) {</div> {/* End of max-w-4xl input wrapper */}</div>- <UpgradeDialog- open={showUpgradeDialog}- onOpenChange={setShowUpgradeDialog}- reason={upgradeReason}- resetsAt={upgradeResetsAt}- source="chat"- gatewayTier={upgradeTier}- />{scheduleDialogMessage && (<SchedulePromptDialogdiff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lockindex bdbe2b37a..612f27096 100644--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -9289,7 +9289,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "2.2.226"+version = "2.2.223"dependencies = ["anyhow","arboard",@@ -9390,7 +9390,7 @@ dependencies = [[[package]]name = "screenpipe-audio"-version = "0.3.225"+version = "0.3.223"dependencies = ["anyhow","audiopipe",@@ -9443,7 +9443,7 @@ dependencies = [[[package]]name = "screenpipe-config"-version = "0.3.225"+version = "0.3.223"dependencies = ["dirs 6.0.0","serde",@@ -9454,7 +9454,7 @@ dependencies = [[[package]]name = "screenpipe-connect"-version = "0.3.225"+version = "0.3.223"dependencies = ["anyhow","async-trait",@@ -9480,7 +9480,7 @@ dependencies = [[[package]]name = "screenpipe-core"-version = "0.3.225"+version = "0.3.223"dependencies = ["accessibility","accessibility-sys",@@ -9522,7 +9522,7 @@ dependencies = [[[package]]name = "screenpipe-db"-version = "0.3.225"+version = "0.3.223"dependencies = ["anyhow","chrono",@@ -9546,7 +9546,7 @@ dependencies = [[[package]]name = "screenpipe-engine"-version = "0.3.225"+version = "0.3.223"dependencies = ["anyhow","async-trait",@@ -9609,7 +9609,7 @@ dependencies = [[[package]]name = "screenpipe-events"-version = "0.3.225"+version = "0.3.223"dependencies = ["anyhow","chrono",@@ -9625,7 +9625,7 @@ dependencies = [[[package]]name = "screenpipe-screen"-version = "0.3.225"+version = "0.3.223"dependencies = ["accessibility-sys","anyhow",@@ -9661,7 +9661,7 @@ dependencies = [[[package]]name = "screenpipe-vault"-version = "0.3.225"+version = "0.3.223"dependencies = ["argon2","chacha20poly1305",diff --git a/crates/screenpipe-engine/src/archive.rs b/crates/screenpipe-engine/src/archive.rsindex 60a0b2032..35ef1741b 100644--- a/crates/screenpipe-engine/src/archive.rs+++ b/crates/screenpipe-engine/src/archive.rs@@ -156,8 +156,10 @@ pub async fn archive_init(let machine_id = screenpipe_core::sync::get_or_create_machine_id();// Reuse the sync manager if sync is already initialized (same encryption keys).- // This avoids the AEAD decryption failure that occurs when archive derives a- // different password than what sync used to encrypt the master key.+ // If sync is not initialized, derive a deterministic password from the token.+ // This works for archive-only users but will fail if sync was set up on another+ // device with a different (random) password — in that case the user must enable+ // sync first so archive can reuse its manager.let manager = {let sync_guard = state.sync_state.read().await;if let Some(ref sync_rt) = *sync_guard {@@ -186,21 +188,31 @@ pub async fn archive_init()})?;- // Derive encryption password from the token (only used when sync is not active)+ // Derive encryption password from the token (deterministic across devices)let password = format!("screenpipe-archive-{:x}",md5::compute(request.token.as_bytes()));- mgr.initialize(&password).await.map_err(|e| {- error!("archive: failed to initialize encryption: {}", e);- (- StatusCode::INTERNAL_SERVER_ERROR,- Json(json!({"error": format!("failed to initialize encryption: {}", e)})),- )- })?;-- Arc::new(mgr)+ match mgr.initialize(&password).await {+ Ok(_) => Arc::new(mgr),+ Err(e) => {+ let err_str = e.to_string();+ if err_str.contains("decryption failed") || err_str.contains("authentication error") {+ // Keys exist on server but were created with a different password+ // (likely from cloud sync setup). User needs to enable sync first.+ warn!("archive: encryption keys exist but password doesn't match (likely set up via cloud sync on another device)");+ return Err((+ StatusCode::PRECONDITION_FAILED,+ Json(json!({"error": "encryption keys were set up on another device via cloud sync. please enable cloud sync first in Settings → Sync, then try archive again."})),+ ));+ }+ return Err((+ StatusCode::INTERNAL_SERVER_ERROR,+ Json(json!({"error": format!("failed to initialize encryption: {}", e)})),+ ));+ }+ }}};diff --git a/crates/screenpipe-engine/src/event_driven_capture.rs b/crates/screenpipe-engine/src/event_driven_capture.rsindex 1bc307c76..065ca0d65 100644--- a/crates/screenpipe-engine/src/event_driven_capture.rs+++ b/crates/screenpipe-engine/src/event_driven_capture.rs@@ -325,6 +325,7 @@ pub async fn event_driven_capture_loop(continue;}+ // Skip capture while DRM streaming content is focusedif crate::drm_detector::drm_content_paused() {tokio::time::sleep(poll_interval).await;continue;@@ -799,8 +800,9 @@ async fn do_capture(});}- // DRM content detection: set global pause flag so monitor watcher- // stops all monitors and releases SCK handles.+ // DRM content detection: check if the focused app/URL is a streaming service.+ // When detected, set the global pause flag so ALL monitors stop capture+ // and the monitor watcher releases all SCK handles.if crate::drm_detector::check_and_update_drm_state(pause_on_drm_content,app_name_owned.as_deref(),diff --git a/crates/screenpipe-engine/src/recording_config.rs b/crates/screenpipe-engine/src/recording_config.rsindex 18827a145..8e1d349fc 100644--- a/crates/screenpipe-engine/src/recording_config.rs+++ b/crates/screenpipe-engine/src/recording_config.rs@@ -49,6 +49,7 @@ pub struct RecordingConfig {pub ignored_urls: Vec<String>,/// Automatically detect and skip incognito / private browsing windows.pub ignore_incognito_windows: bool,+ /// Pause all screen capture when a DRM streaming app (Netflix, etc.) is focused.pub pause_on_drm_content: bool,pub languages: Vec<Language>,diff --git a/crates/screenpipe-engine/src/vision_manager/manager.rs b/crates/screenpipe-engine/src/vision_manager/manager.rsindex 9ac6d8cf3..b58f57f00 100644--- a/crates/screenpipe-engine/src/vision_manager/manager.rs+++ b/crates/screenpipe-engine/src/vision_manager/manager.rs@@ -35,6 +35,7 @@ pub struct VisionManagerConfig {pub use_all_monitors: bool,/// Automatically detect and skip incognito / private browsing windows.pub ignore_incognito_windows: bool,+ /// Pause all screen capture when a DRM streaming app (Netflix, etc.) is focused.pub pause_on_drm_content: bool,/// Languages for OCR recognition.pub languages: Vec<screenpipe_core::Language>,diff --git a/crates/screenpipe-engine/src/vision_manager/monitor_watcher.rs b/crates/screenpipe-engine/src/vision_manager/monitor_watcher.rsindex 29139607c..b093f935d 100644--- a/crates/screenpipe-engine/src/vision_manager/monitor_watcher.rs+++ b/crates/screenpipe-engine/src/vision_manager/monitor_watcher.rs@@ -56,16 +56,14 @@ pub async fn start_monitor_watcher(vision_manager: Arc<VisionManager>) -> anyhow// When DRM content is focused, we must:// 1. Stop all monitors (release SCK capture handles)// 2. NOT call list_monitors_detailed() (avoids touching SCK APIs)- // 3. Only poll the focused app via Accessibility APIs (not SCK)+ // 3. Only poll the focused app via Accessibility APIs// This ensures macOS DRM sees no active ScreenCaptureKit usage.if drm_detector::drm_content_paused() {if !drm_stopped {- info!("DRM content focused — stopping vision + UI recorder to release screen capture");+ info!("DRM content focused — stopping all vision monitors to release SCK handles");if let Err(e) = vision_manager.stop().await {warn!("failed to stop vision manager for DRM pause: {:?}", e);}- // Also stop UI recorder — its native event taps keep Screen Recording active- drm_detector::stop_ui_recorder();drm_stopped = true;}// Poll focused app (Accessibility API only, no SCK) to detect@@ -85,8 +83,6 @@ pub async fn start_monitor_watcher(vision_manager: Arc<VisionManager>) -> anyhowif let Err(e) = vision_manager.start().await {warn!("failed to restart vision manager after DRM pause: {:?}", e);}- // Note: UI recorder cannot be restarted (one-shot design).- // It will resume on next app restart. Vision capture resumes immediately.drm_stopped = false;// Re-populate known_monitors after restartif let Ok(monitors) = list_monitors_detailed().await {diff --git a/packages/ai-gateway/src/providers/vertex-maas.ts b/packages/ai-gateway/src/providers/vertex-maas.tsindex 2ff59318e..0c4c395db 100644--- a/packages/ai-gateway/src/providers/vertex-maas.ts+++ b/packages/ai-gateway/src/providers/vertex-maas.ts@@ -19,11 +19,11 @@ import { AIProvider } from './base';import { Message, RequestBody, ResponseFormat } from '../types';import { VertexAIProvider } from './vertex';-// Vertex MaaS model IDs — {publisher}/{model-id} format, global region+// Vertex MaaS model IDs — model names without publisher prefix, all on global endpointconst VERTEX_MAAS_MODELS: Record<string, { vertexId: string; region: string }> = {- 'glm-4.7': { vertexId: 'zai-org/glm-4.7-maas', region: 'global' },- 'glm-5': { vertexId: 'zai-org/glm-5-maas', region: 'global' },- 'kimi-k2.5': { vertexId: 'moonshot-ai/kimi-k2-thinking-maas', region: 'global' },+ 'glm-4.7': { vertexId: 'zhipuai/glm-4.7-maas', region: 'global' },+ 'glm-5': { vertexId: 'zhipuai/glm-5-maas', region: 'global' },+ 'kimi-k2.5': { vertexId: 'moonshotai/kimi-k2-thinking-maas', region: 'global' },};export function isVertexMaasModel(model: string): boolean {diff --git a/packages/ai-gateway/wrangler.toml b/packages/ai-gateway/wrangler.tomlindex 71133db65..b94434c2d 100644--- a/packages/ai-gateway/wrangler.toml+++ b/packages/ai-gateway/wrangler.toml@@ -37,8 +37,8 @@ enabled = trueVERTEX_REGION = "us-east5"# Self-hosted Whisper A/B testSELF_HOSTED_TRANSCRIPTION_URL = "https://way-blessed-vegetation-engineer.trycloudflare.com"-WHISPER_TRAFFIC_PCT = "40"-WHISPER_DUAL_SEND_PCT = "0"+WHISPER_TRAFFIC_PCT = "10"+WHISPER_DUAL_SEND_PCT = "1"# Secrets (set via `wrangler secret put <NAME>`):# - VERTEX_SERVICE_ACCOUNT_JSON: GCP service account JSON for Vertex AI