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: persist tool calls & results in chat history

Louis Beaumontd1511e1f551a
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index 15aaa11c0..23f0da01e 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -619,11 +619,31 @@ export function StandaloneChat({ className }: { className?: string } = {}) {
.map((b: any) => b.text)
.join("\n") || "(tool result)";
}
+ // Persist contentBlocks so tool calls/results survive reload.
+ // Strip isRunning (stale) and cap result length to keep store small.
+ const blocks = m.contentBlocks?.map((b: any) => {
+ if (b.type === "tool") {
+ const { isRunning, ...rest } = b.toolCall;
+ return {
+ type: "tool",
+ toolCall: {
+ ...rest,
+ isRunning: false,
+ result: rest.result?.slice(0, 4000),
+ },
+ };
+ }
+ if (b.type === "thinking") {
+ return { ...b, isThinking: false };
+ }
+ return b;
+ });
return {
id: m.id,
role: m.role,
content,
timestamp: m.timestamp,
+ ...(blocks?.length ? { contentBlocks: blocks } : {}),
};
}),
createdAt: existingIndex >= 0 ? history.conversations[existingIndex].createdAt : Date.now(),
@@ -712,6 +732,7 @@ export function StandaloneChat({ className }: { className?: string } = {}) {
role: m.role,
content: m.content,
timestamp: m.timestamp,
+ ...(m.contentBlocks?.length ? { contentBlocks: m.contentBlocks } : {}),
})));
setConversationId(conv.id);
setShowHistory(false);
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
index fc2e7e244..2d1c8eeb2 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
@@ -63,6 +63,7 @@ export interface ChatMessage {
role: "user" | "assistant";
content: string;
timestamp: number;
+ contentBlocks?: any[];
}
export interface ChatConversation {
@@ -97,6 +98,21 @@ export type Settings = SettingsStore & {
userName?: string;
/** When true, screen capture continues but OCR text extraction is skipped (saves CPU) */
disableOcr?: boolean;
+ /** Filters pushed from team — merged with local filters for recording */
+ teamFilters?: {
+ ignoredWindows: string[];
+ includedWindows: string[];
+ ignoredUrls: string[];
+ };
+}
+
+export function getEffectiveFilters(settings: Settings) {
+ const team = settings.teamFilters || { ignoredWindows: [], includedWindows: [], ignoredUrls: [] };
+ return {
+ ignoredWindows: [...new Set([...settings.ignoredWindows, ...team.ignoredWindows])],
+ includedWindows: [...new Set([...settings.includedWindows, ...team.includedWindows])],
+ ignoredUrls: [...new Set([...(settings.ignoredUrls || []), ...team.ignoredUrls])],
+ };
}
export const DEFAULT_PROMPT = `Rules:
@@ -177,6 +193,7 @@ let DEFAULT_SETTINGS: Settings = {
],
includedWindows: [],
ignoredUrls: [],
+ teamFilters: { ignoredWindows: [], includedWindows: [], ignoredUrls: [] },
fps: 0.5,
vadSensitivity: "high",