From 51ee88121fdb2da686bf5dd6ad95d3ec499ebd9c Mon Sep 17 00:00:00 2001 From: Mahesh Sanikommmu Date: Sun, 19 Oct 2025 15:30:25 -0700 Subject: [PATCH 1/2] chore(browser-extension): t3 chat search memories --- .../entrypoints/content/t3.ts | 54 +++++++++---------- apps/browser-extension/wxt.config.ts | 2 +- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/apps/browser-extension/entrypoints/content/t3.ts b/apps/browser-extension/entrypoints/content/t3.ts index 4332076e..07a8781f 100644 --- a/apps/browser-extension/entrypoints/content/t3.ts +++ b/apps/browser-extension/entrypoints/content/t3.ts @@ -115,32 +115,35 @@ function setupT3RouteChangeDetection() { function addSupermemoryIconToT3Input() { const targetContainers = document.querySelectorAll( - ".flex.min-w-0.items-center.gap-2.overflow-hidden", + ".flex.min-w-0.items-center.gap-2", ) - targetContainers.forEach((container) => { - if (container.hasAttribute("data-supermemory-icon-added")) { - return - } + const container = targetContainers[0] + if (!container) { + return + } - const existingIcon = container.querySelector( - `#${ELEMENT_IDS.T3_INPUT_BAR_ELEMENT}`, - ) - if (existingIcon) { - container.setAttribute("data-supermemory-icon-added", "true") - return - } - - const supermemoryIcon = createT3InputBarElement(async () => { - await getRelatedMemoriesForT3(POSTHOG_EVENT_KEY.T3_CHAT_MEMORIES_SEARCHED) - }) - - supermemoryIcon.id = `${ELEMENT_IDS.T3_INPUT_BAR_ELEMENT}-${Date.now()}-${Math.random().toString(36).substring(2, 11)}` + if (container.hasAttribute("data-supermemory-icon-added")) { + return + } + const existingIcon = container.querySelector( + `#${ELEMENT_IDS.T3_INPUT_BAR_ELEMENT}`, + ) + if (existingIcon) { container.setAttribute("data-supermemory-icon-added", "true") + return + } - container.insertBefore(supermemoryIcon, container.firstChild) + const supermemoryIcon = createT3InputBarElement(async () => { + await getRelatedMemoriesForT3(POSTHOG_EVENT_KEY.T3_CHAT_MEMORIES_SEARCHED) }) + + supermemoryIcon.id = `${ELEMENT_IDS.T3_INPUT_BAR_ELEMENT}-${Date.now()}-${Math.random().toString(36).substring(2, 11)}` + + container.setAttribute("data-supermemory-icon-added", "true") + + container.insertBefore(supermemoryIcon, container.firstChild) } async function getRelatedMemoriesForT3(actionSource: string) { @@ -150,11 +153,9 @@ async function getRelatedMemoriesForT3(actionSource: string) { const supermemoryContainer = document.querySelector( '[data-supermemory-icon-added="true"]', ) - if ( - supermemoryContainer?.parentElement?.parentElement?.previousElementSibling - ) { + if (supermemoryContainer?.parentElement?.previousElementSibling) { const textareaElement = - supermemoryContainer.parentElement.parentElement.previousElementSibling.querySelector( + supermemoryContainer.parentElement.previousElementSibling.querySelector( "textarea", ) userQuery = textareaElement?.value || "" @@ -220,12 +221,9 @@ async function getRelatedMemoriesForT3(actionSource: string) { const supermemoryContainer = document.querySelector( '[data-supermemory-icon-added="true"]', ) - if ( - supermemoryContainer?.parentElement?.parentElement - ?.previousElementSibling - ) { + if (supermemoryContainer?.parentElement?.previousElementSibling) { textareaElement = - supermemoryContainer.parentElement.parentElement.previousElementSibling.querySelector( + supermemoryContainer.parentElement.previousElementSibling.querySelector( "textarea", ) } diff --git a/apps/browser-extension/wxt.config.ts b/apps/browser-extension/wxt.config.ts index 20435b6c..36c2863e 100644 --- a/apps/browser-extension/wxt.config.ts +++ b/apps/browser-extension/wxt.config.ts @@ -11,7 +11,7 @@ export default defineConfig({ manifest: { name: "supermemory", homepage_url: "https://supermemory.ai", - version: "6.0.100", + version: "6.0.101", permissions: ["contextMenus", "storage", "activeTab", "webRequest", "tabs"], host_permissions: [ "*://x.com/*", From 73c54ff2e4fedfdaeb18a46d767fc877256e92f2 Mon Sep 17 00:00:00 2001 From: Mahesh Sanikommmu Date: Sun, 19 Oct 2025 16:37:42 -0700 Subject: [PATCH 2/2] feat: auto capture disabled by default --- .../entrypoints/content/chatgpt.ts | 10 ++ .../entrypoints/content/claude.ts | 10 ++ .../entrypoints/content/t3.ts | 23 ++++ .../entrypoints/popup/App.tsx | 109 +++++++++++++++--- apps/browser-extension/utils/constants.ts | 1 + 5 files changed, 140 insertions(+), 13 deletions(-) diff --git a/apps/browser-extension/entrypoints/content/chatgpt.ts b/apps/browser-extension/entrypoints/content/chatgpt.ts index 73e0354f..20308728 100644 --- a/apps/browser-extension/entrypoints/content/chatgpt.ts +++ b/apps/browser-extension/entrypoints/content/chatgpt.ts @@ -640,6 +640,16 @@ function setupChatGPTPromptCapture() { document.body.setAttribute("data-chatgpt-prompt-capture-setup", "true") const capturePromptContent = async (source: string) => { + const result = await chrome.storage.local.get([ + STORAGE_KEYS.AUTO_CAPTURE_PROMPTS_ENABLED, + ]) + const autoCapturePromptsEnabled = + result[STORAGE_KEYS.AUTO_CAPTURE_PROMPTS_ENABLED] ?? false + + if (!autoCapturePromptsEnabled) { + console.log("Auto capture prompts is disabled, skipping prompt capture") + return + } const promptTextarea = document.getElementById("prompt-textarea") let promptContent = "" diff --git a/apps/browser-extension/entrypoints/content/claude.ts b/apps/browser-extension/entrypoints/content/claude.ts index e0853d41..88874a3f 100644 --- a/apps/browser-extension/entrypoints/content/claude.ts +++ b/apps/browser-extension/entrypoints/content/claude.ts @@ -488,6 +488,16 @@ function setupClaudePromptCapture() { } document.body.setAttribute("data-claude-prompt-capture-setup", "true") const captureClaudePromptContent = async (source: string) => { + const result = await chrome.storage.local.get([ + STORAGE_KEYS.AUTO_CAPTURE_PROMPTS_ENABLED, + ]) + const autoCapturePromptsEnabled = + result[STORAGE_KEYS.AUTO_CAPTURE_PROMPTS_ENABLED] ?? false + + if (!autoCapturePromptsEnabled) { + console.log("Auto capture prompts is disabled, skipping prompt capture") + return + } let promptContent = "" const contentEditableDiv = document.querySelector( diff --git a/apps/browser-extension/entrypoints/content/t3.ts b/apps/browser-extension/entrypoints/content/t3.ts index 07a8781f..d1229e6d 100644 --- a/apps/browser-extension/entrypoints/content/t3.ts +++ b/apps/browser-extension/entrypoints/content/t3.ts @@ -497,6 +497,16 @@ function setupT3PromptCapture() { document.body.setAttribute("data-t3-prompt-capture-setup", "true") const captureT3PromptContent = async (source: string) => { + const result = await chrome.storage.local.get([ + STORAGE_KEYS.AUTO_CAPTURE_PROMPTS_ENABLED, + ]) + const autoCapturePromptsEnabled = + result[STORAGE_KEYS.AUTO_CAPTURE_PROMPTS_ENABLED] ?? false + + if (!autoCapturePromptsEnabled) { + console.log("Auto capture prompts is disabled, skipping prompt capture") + return + } let promptContent = "" const textarea = document.querySelector("textarea") as HTMLTextAreaElement @@ -599,6 +609,19 @@ function setupT3PromptCapture() { if (promptContent.trim()) { console.log("T3 prompt submitted via Enter key:", promptContent) + const result = await chrome.storage.local.get([ + STORAGE_KEYS.AUTO_CAPTURE_PROMPTS_ENABLED, + ]) + const autoCapturePromptsEnabled = + result[STORAGE_KEYS.AUTO_CAPTURE_PROMPTS_ENABLED] ?? false + + if (!autoCapturePromptsEnabled) { + console.log( + "Auto capture prompts is disabled, skipping prompt capture", + ) + return + } + try { await browser.runtime.sendMessage({ action: MESSAGE_TYPES.CAPTURE_PROMPT, diff --git a/apps/browser-extension/entrypoints/popup/App.tsx b/apps/browser-extension/entrypoints/popup/App.tsx index c6e8468c..06aee4a4 100644 --- a/apps/browser-extension/entrypoints/popup/App.tsx +++ b/apps/browser-extension/entrypoints/popup/App.tsx @@ -11,6 +11,57 @@ import { } from "../../utils/query-hooks" import type { Project } from "../../utils/types" +const Tooltip = ({ + children, + content, +}: { + children: React.ReactNode + content: string +}) => { + const [isVisible, setIsVisible] = useState(false) + + return ( +
+ + + {isVisible && ( +
+ {content} +
+
+ )} +
+ ) +} + function App() { const [userSignedIn, setUserSignedIn] = useState(false) const [loading, setLoading] = useState(true) @@ -22,6 +73,8 @@ function App() { "save", ) const [autoSearchEnabled, setAutoSearchEnabled] = useState(false) + const [autoCapturePromptsEnabled, setAutoCapturePromptsEnabled] = + useState(false) const [authInvalidated, setAuthInvalidated] = useState(false) const queryClient = useQueryClient() @@ -43,6 +96,7 @@ function App() { const result = await chrome.storage.local.get([ STORAGE_KEYS.BEARER_TOKEN, STORAGE_KEYS.AUTO_SEARCH_ENABLED, + STORAGE_KEYS.AUTO_CAPTURE_PROMPTS_ENABLED, ]) const hasToken = !!result[STORAGE_KEYS.BEARER_TOKEN] @@ -70,6 +124,10 @@ function App() { const autoSearchSetting = result[STORAGE_KEYS.AUTO_SEARCH_ENABLED] ?? false setAutoSearchEnabled(autoSearchSetting) + + const autoCapturePromptsSetting = + result[STORAGE_KEYS.AUTO_CAPTURE_PROMPTS_ENABLED] ?? false + setAutoCapturePromptsEnabled(autoCapturePromptsSetting) } catch (error) { console.error("Error checking auth status:", error) setUserSignedIn(false) @@ -178,6 +236,17 @@ function App() { } } + const handleAutoCapturePromptsToggle = async (enabled: boolean) => { + try { + await chrome.storage.local.set({ + [STORAGE_KEYS.AUTO_CAPTURE_PROMPTS_ENABLED]: enabled, + }) + setAutoCapturePromptsEnabled(enabled) + } catch (error) { + console.error("Error updating auto capture prompts setting:", error) + } + } + const handleSignOut = async () => { try { await chrome.storage.local.remove([STORAGE_KEYS.BEARER_TOKEN]) @@ -457,15 +526,13 @@ function App() {

Chat Integration

-
-
- - Auto Search Memories - - - Automatically search your memories while typing in chat - apps - +
+
+ + + Auto Search Memories + +
-

- When enabled, supermemory will search your memories as you - type in ChatGPT, Claude, and T3.chat -

+
+
+ + + Auto Capture Prompts + + +
+
)} diff --git a/apps/browser-extension/utils/constants.ts b/apps/browser-extension/utils/constants.ts index d459a0f0..16baaabd 100644 --- a/apps/browser-extension/utils/constants.ts +++ b/apps/browser-extension/utils/constants.ts @@ -22,6 +22,7 @@ export const STORAGE_KEYS = { TWITTER_AUTH_TOKEN: "twitter-auth-token", DEFAULT_PROJECT: "sm-default-project", AUTO_SEARCH_ENABLED: "sm-auto-search-enabled", + AUTO_CAPTURE_PROMPTS_ENABLED: "sm-auto-capture-prompts-enabled", } as const /**