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
Bump app to v2.4.224 - release-app
Louis Beaumont237d3853f5d6
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsxindex 3d3140c80..bda7ff450 100644--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx@@ -66,6 +66,7 @@ import { localFetch, getApiBaseUrl } from "@/lib/api";import { getFaviconUrl } from "@/components/rewind/timeline/favicon-utils";import {formatSteerShortcut,+ getComposerPrimaryAction,isComposerSteerShortcut,isQueuedItemCancelShortcut,isQueuedItemSteerShortcut,@@ -3030,10 +3031,8 @@ export function StandaloneChat({return;}- // Enter without shift submits the form. We intentionally don't gate on- // isLoading anymore — if a previous prompt is still streaming, the new- // one is enqueued at the rust level (see `pi_command_queue.rs`) and- // shown in the queued-cards rail under the transcript.+ // Enter without shift submits the form. While Pi is replying, submit maps+ // to native steering so the correction applies to the current answer.if (e.key === "Enter" && !e.shiftKey && !showMentionDropdown) {e.preventDefault();if (input.trim() || pastedImages.length > 0) {@@ -4475,6 +4474,17 @@ export function StandaloneChat({* the chat-store — same path used for any other message, just kicked off* after the queue drains.*/+ function imageDataUrlsToPiImages(images: string[]) {+ const piImages: Array<{ type: string; mimeType: string; data: string }> = [];+ for (const img of images) {+ const match = img.match(/^data:(image\/[^;]+);base64,(.+)$/);+ if (match) {+ piImages.push({ type: "image", mimeType: match[1], data: match[2] });+ }+ }+ return piImages;+ }+async function enqueuePiMessage(userMessage: string, displayLabel?: string) {if (!piInfo?.running) {// No Pi running → fall back to the normal start-and-send path.@@ -4534,13 +4544,7 @@ export function StandaloneChat({// Convert any data-URL pastes to the Pi image-content shape (same format// used by the normal send path further down in this file).- const piImages: Array<{ type: string; mimeType: string; data: string }> = [];- for (const img of pastedImages) {- const match = img.match(/^data:(image\/[^;]+);base64,(.+)$/);- if (match) {- piImages.push({ type: "image", mimeType: match[1], data: match[2] });- }- }+ const piImages = imageDataUrlsToPiImages(pastedImages);if (pastedImages.length > 0) setPastedImages([]);try {@@ -5006,20 +5010,22 @@ export function StandaloneChat({async function sendMessage(userMessage: string, displayLabel?: string) {if ((!canChat && !autoSendBypassRef.current) || (!activePreset && !autoSendBypassRef.current)) return;- // If a previous prompt is still streaming, enqueue this one at the rust- // level instead of going through sendPiMessage (which aborts the previous- // turn — exactly what we DON'T want when the user is queueing follow-ups).- // The rust queue's drain loop will pull this prompt and write it to stdin- // as soon as the in-flight prompt's `agent_end` arrives. The pi-event-router- // will append the new turn's user + assistant messages to the chat-store.+ // If Pi is mid-reply, the default composer action is native steering:+ // the new message should interrupt and redirect the current reply. Queued+ // follow-up is still available through the clock button.if (isLoading || isStreaming) {- return enqueuePiMessage(userMessage, displayLabel);+ return steerMessage(userMessage, displayLabel);}// All providers route through Pi agentreturn sendPiMessage(userMessage, displayLabel);}+ async function queueFollowUpMessage(userMessage: string, displayLabel?: string) {+ if ((!canChat && !autoSendBypassRef.current) || (!activePreset && !autoSendBypassRef.current)) return;+ return enqueuePiMessage(userMessage, displayLabel);+ }+function findLocalQueuedMessage(prompt: PiQueuedPrompt): Message | undefined {return messages.find((message) =>@@ -5119,6 +5125,10 @@ export function StandaloneChat({if (!trimmed && !hasImages) return;const hadActiveReply = isLoading || isStreaming || !!piMessageIdRef.current;+ if (!hadActiveReply || !piInfo?.running) {+ return sendPiMessage(trimmed, displayLabel, imageDataUrls);+ }+posthog.capture("chat_message_steered", {provider: activePreset?.provider,model: activePreset?.model,@@ -5126,7 +5136,77 @@ export function StandaloneChat({from_queue: !!imageDataUrls,});- return sendPiMessage(trimmed, displayLabel, imageDataUrls);+ const outgoingImages = imageDataUrls ?? pastedImages;+ const shouldClearPastedImages = imageDataUrls == null && pastedImages.length > 0;++ const newUserMessage: Message = {+ id: Date.now().toString(),+ role: "user",+ content: trimmed,+ ...(displayLabel ? { displayContent: displayLabel } : {}),+ ...(outgoingImages.length > 0 ? { images: [...outgoingImages] } : {}),+ timestamp: Date.now(),+ };++ setFollowUpSuggestions([]);+ followUpFiredRef.current = false;+ if (followUpAbortRef.current) {+ followUpAbortRef.current.abort();+ followUpAbortRef.current = null;+ }+ lastUserMessageRef.current = trimmed;++ setMessages((prev) => {+ const next = [...prev, newUserMessage];+ void saveConversation(next, {+ refreshHistory: false,+ syncActiveConversation: false,+ });+ return next;+ });+ setInput("");+ if (inputRef.current) inputRef.current.style.height = "auto";++ const sidNow = piSessionIdRef.current;+ if (sidNow) {+ const storeState = useChatStore.getState();+ if (!storeState.sessions[sidNow]) {+ storeState.actions.upsert({+ id: sidNow,+ title: "new chat",+ preview: "",+ status: "streaming",+ messageCount: 0,+ createdAt: Date.now(),+ updatedAt: Date.now(),+ pinned: false,+ unread: false,+ });+ }+ storeState.actions.appendMessage(sidNow, newUserMessage as any);+ storeState.actions.patch(sidNow, { lastUserMessageAt: Date.now() });+ }++ const piImages = imageDataUrlsToPiImages(outgoingImages);+ if (shouldClearPastedImages) setPastedImages([]);++ try {+ const result = await commands.piSteer(+ piSessionIdRef.current,+ trimmed,+ piImages.length > 0 ? piImages : null,+ );+ if (result.status !== "ok") {+ toast({ title: "failed to steer message", description: result.error, variant: "destructive" });+ }+ } catch (e) {+ console.warn("[Pi] failed to steer message:", e);+ toast({+ title: "failed to steer message",+ description: e instanceof Error ? e.message : String(e),+ variant: "destructive",+ });+ }}async function steerQueuedPrompt(prompt: PiQueuedPrompt) {@@ -6365,7 +6445,7 @@ export function StandaloneChat({type="button"disabled={isBusy}onClick={() => steerQueuedPrompt(p)}- className="h-7 px-2 rounded-md inline-flex items-center gap-1 text-xs text-foreground bg-muted/70 hover:bg-muted disabled:opacity-50 disabled:pointer-events-none transition-colors"+ className="h-7 w-7 rounded-md inline-flex items-center justify-center text-foreground bg-muted/70 hover:bg-muted disabled:opacity-50 disabled:pointer-events-none transition-colors"aria-label={`steer queued message ${i + 1}`}>{isBusy ? (@@ -6373,11 +6453,10 @@ export function StandaloneChat({) : (<CornerDownRight className="h-3 w-3" />)}- <span>Steer</span></button></TooltipTrigger><TooltipContent side="top">- Stop current reply and run this now ({formatSteerShortcut(isMac)})+ Steer current reply with this message ({formatSteerShortcut(isMac)})</TooltipContent></Tooltip><Tooltip>@@ -6423,7 +6502,7 @@ export function StandaloneChat({disabledReason? disabledReason: isLoading || isStreaming- ? "Ask for follow-up changes..."+ ? "Steer current reply...": "Ask about your screen... (type @ for filters, paste images)"}disabled={!canChat}@@ -6574,35 +6653,36 @@ export function StandaloneChat({<Paperclip className="h-4 w-4" /></Button>{(() => {- // Four button modes:- // 1. streaming + input empty → stop (square)- // 2. streaming + input has text → queue (chevron-up, submits, enqueues)- // 3. streaming + input has text → steer (explicit side button; aborts current turn)- // 4. not streaming → send (paper plane)const hasInput = input.trim().length > 0 || pastedImages.length > 0;- const isQueueMode = (isLoading || isStreaming) && hasInput;- const isStopMode = (isLoading || isStreaming) && !hasInput;+ const primaryAction = getComposerPrimaryAction(isLoading || isStreaming, hasInput);+ const isSteerMode = primaryAction === "steer";+ const isStopMode = primaryAction === "stop";return (<>- {isQueueMode && (+ {isSteerMode && (<TooltipProvider delayDuration={150}><Tooltip><TooltipTrigger asChild><Buttontype="button"- size="sm"+ size="icon"variant="ghost"disabled={!canChat}- onClick={() => steerMessage(input.trim())}- className="h-8 px-2.5 gap-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/60"- aria-label={`steer current message (${formatSteerShortcut(isMac)})`}+ onClick={() => queueFollowUpMessage(input.trim())}+ className="h-8 w-8 text-muted-foreground hover:text-foreground hover:bg-muted/60 relative"+ aria-label="queue follow-up after current reply"+ title="queue follow-up after current reply">- <CornerDownRight className="h-3.5 w-3.5" />- <span>Steer</span>+ <Clock className="h-3.5 w-3.5" />+ {queuedPrompts.length > 0 && (+ <span className="absolute -top-1.5 -right-1.5 min-w-[16px] h-[16px] px-1 rounded-full bg-muted text-foreground text-[9px] font-mono font-semibold flex items-center justify-center border border-background">+ {queuedPrompts.length}+ </span>+ )}</Button></TooltipTrigger><TooltipContent side="top">- Stop current reply and run this now ({formatSteerShortcut(isMac)})+ Queue follow-up after current reply</TooltipContent></Tooltip></TooltipProvider>@@ -6619,23 +6699,25 @@ export function StandaloneChat({title={isStopMode? "stop"- : isQueueMode- ? `queue with Enter (${queuedPrompts.length + 1} pending)`+ : isSteerMode+ ? "steer current reply": "send"}+ aria-label={+ isStopMode+ ? "stop reply"+ : isSteerMode+ ? "steer current reply"+ : "send message"+ }>{isStopMode ? (<Square className="h-4 w-4" />- ) : isQueueMode ? (- <ChevronUp className="h-4 w-4" />+ ) : isSteerMode ? (+ <CornerDownRight className="h-4 w-4" />) : (<Send className="h-4 w-4" />)}- {isQueueMode && queuedPrompts.length > 0 && (- <span className="absolute -top-1.5 -right-1.5 min-w-[16px] h-[16px] px-1 rounded-full bg-foreground text-background text-[9px] font-mono font-semibold flex items-center justify-center border border-background">- {queuedPrompts.length + 1}- </span>- )}</Button></>);diff --git a/apps/screenpipe-app-tauri/lib/__tests__/chat-queue-controls.test.ts b/apps/screenpipe-app-tauri/lib/__tests__/chat-queue-controls.test.tsindex f44e96e28..d0344a1d3 100644--- a/apps/screenpipe-app-tauri/lib/__tests__/chat-queue-controls.test.ts+++ b/apps/screenpipe-app-tauri/lib/__tests__/chat-queue-controls.test.ts@@ -5,6 +5,7 @@import { describe, expect, it } from "vitest";import {formatSteerShortcut,+ getComposerPrimaryAction,isComposerSteerShortcut,isQueuedItemCancelShortcut,isQueuedItemSteerShortcut,@@ -71,4 +72,11 @@ describe("chat queue controls", () => {expect(formatSteerShortcut(true)).toBe("Cmd+Enter");expect(formatSteerShortcut(false)).toBe("Ctrl+Enter");});++ it("makes the composer steer while Pi is replying and text is present", () => {+ expect(getComposerPrimaryAction(false, false)).toBe("send");+ expect(getComposerPrimaryAction(false, true)).toBe("send");+ expect(getComposerPrimaryAction(true, false)).toBe("stop");+ expect(getComposerPrimaryAction(true, true)).toBe("steer");+ });});diff --git a/apps/screenpipe-app-tauri/lib/chat-queue-controls.ts b/apps/screenpipe-app-tauri/lib/chat-queue-controls.tsindex b0e3d3ef1..c7d5ed06b 100644--- a/apps/screenpipe-app-tauri/lib/chat-queue-controls.ts+++ b/apps/screenpipe-app-tauri/lib/chat-queue-controls.ts@@ -81,6 +81,16 @@ export function formatSteerShortcut(isMac: boolean): string {return isMac ? "Cmd+Enter" : "Ctrl+Enter";}+export type ComposerPrimaryAction = "send" | "steer" | "stop";++export function getComposerPrimaryAction(+ isBusy: boolean,+ hasInput: boolean,+): ComposerPrimaryAction {+ if (!isBusy) return "send";+ return hasInput ? "steer" : "stop";+}+export function queuedPreviewMatchesText(preview: string, text: string): boolean {if (!preview) return text.length === 0;return text.startsWith(preview);diff --git a/apps/screenpipe-app-tauri/lib/utils/tauri.ts b/apps/screenpipe-app-tauri/lib/utils/tauri.tsindex 01f57e6e1..d035ea080 100644--- a/apps/screenpipe-app-tauri/lib/utils/tauri.ts+++ b/apps/screenpipe-app-tauri/lib/utils/tauri.ts@@ -886,6 +886,17 @@ async piPrompt(sessionId: string | null, message: string, images: PiImageContentelse return { status: "error", error: e as any };}},+/**+ * Steer the active Pi reply using Pi's native steering command.+ */+async piSteer(sessionId: string | null, message: string, images: PiImageContent[] | null) : Promise<Result<null, string>> {+ try {+ return { status: "ok", data: await TAURI_INVOKE("pi_steer", { sessionId, message, images }) };+} catch (e) {+ if(e instanceof Error) throw e;+ else return { status: "error", error: e as any };+}+},/*** Read the current queued-prompt list for a session. Useful for an initial* render before the first `pi-queue-changed` event arrives, and for newdiff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lockindex 88a45207c..1aeaf5111 100644--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -10580,7 +10580,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "2.4.223"+version = "2.4.224"dependencies = ["aes","anyhow",diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.tomlindex 6185e9b25..e5770de56 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.4.223"+version = "2.4.224"description = "24/7 memory for your desktop. 100% local."authors = ["you"]license = ""diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rsindex 7790cb926..81f115666 100755--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs@@ -808,6 +808,7 @@ async fn main() {pi::pi_check,pi::pi_install,pi::pi_prompt,+ pi::pi_steer,pi::pi_pending,pi::pi_cancel_queued,pi::pi_abort,@@ -1110,6 +1111,7 @@ async fn main() {pi::pi_check,pi::pi_install,pi::pi_prompt,+ pi::pi_steer,pi::pi_pending,pi::pi_cancel_queued,pi::pi_abort,diff --git a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs b/apps/screenpipe-app-tauri/src-tauri/src/pi.rsindex 3623e60f1..a78e908c5 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs@@ -1817,6 +1817,47 @@ pub async fn pi_prompt(.map_err(|_| "Pi command queue dropped".to_string())?}+/// Steer the active Pi reply using Pi's native steering command.+/// Unlike `pi_prompt`, this is intentionally not added to the follow-up queue:+/// Pi interrupts the current stream and resumes with the steering instruction.+#[tauri::command]+#[specta::specta]+pub async fn pi_steer(+ state: State<'_, PiState>,+ session_id: Option<String>,+ message: String,+ images: Option<Vec<PiImageContent>>,+) -> Result<(), String> {+ let sid = session_id.unwrap_or_else(|| "chat".to_string());+ let queue = {+ let mut pool = state.0.lock().await;+ let m = pool.sessions.get_mut(&sid).ok_or("Pi not initialized")?;+ if !m.is_running() {+ return Err("Pi is not running".to_string());+ }+ m.last_activity = std::time::Instant::now();+ m.queue_handle+ .clone()+ .ok_or("Pi command queue not initialized")?+ };++ let mut cmd = json!({+ "type": "steer",+ "message": message,+ });+ if let Some(imgs) = images {+ if !imgs.is_empty() {+ cmd["images"] = serde_json::to_value(imgs).map_err(|e| e.to_string())?;+ }+ }++ let rx = queue+ .send(cmd, crate::pi_command_queue::WaitMode::WriteOnly)+ .await?;+ rx.await+ .map_err(|_| "Pi command queue dropped".to_string())?+}+/// Cancel a single queued prompt. Returns true if it was still in the queue/// (and is now removed), false if it had already been pulled into the/// in-flight slot — at that point `pi_abort` is the right tool.