Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

feat(memory): health auto-check, enable toggle, sqlite-vec hint (Phase 3)

diegosouzapw8eacd78be49c
diff --git a/src/app/(dashboard)/dashboard/memory/components/MemoryEngineStatus.tsx b/src/app/(dashboard)/dashboard/memory/components/MemoryEngineStatus.tsx
index 3a6f0d2116..ba1b1a052a 100644
--- a/src/app/(dashboard)/dashboard/memory/components/MemoryEngineStatus.tsx
+++ b/src/app/(dashboard)/dashboard/memory/components/MemoryEngineStatus.tsx
@@ -85,7 +85,12 @@ export default function MemoryEngineStatus({ status, onConfigure }: Props) {
: "red",
reason: status.vectorStore.reason,
cta:
- status.vectorStore.needsReindex > 0 ? (
+ status.vectorStore.backend === "none" ? (
+ <span className="text-xs text-amber-400 flex items-center gap-1">
+ <span className="material-symbols-outlined text-[12px]">terminal</span>
+ {t("engine.vectorStoreInstallHint")}
+ </span>
+ ) : status.vectorStore.needsReindex > 0 ? (
<span className="text-xs text-amber-400 flex items-center gap-1">
<span className="material-symbols-outlined text-[12px]">warning</span>
{t("engine.needsReindex", { count: status.vectorStore.needsReindex })}
diff --git a/src/app/(dashboard)/dashboard/memory/components/tabs/MemoriesTab.tsx b/src/app/(dashboard)/dashboard/memory/components/tabs/MemoriesTab.tsx
index 458c45c453..5df03c94b2 100644
--- a/src/app/(dashboard)/dashboard/memory/components/tabs/MemoriesTab.tsx
+++ b/src/app/(dashboard)/dashboard/memory/components/tabs/MemoriesTab.tsx
@@ -236,6 +236,16 @@ export default function MemoriesTab() {
}
};
+ // Auto-run health check on mount + poll every 30s, so the indicator reflects
+ // engine health without requiring a manual click.
+ useEffect(() => {
+ void checkHealth();
+ const id = setInterval(() => {
+ void checkHealth();
+ }, 30_000);
+ return () => clearInterval(id);
+ }, []);
+
const openEdit = (m: Memory) => {
setEditTarget(m);
setEditOpen(true);
diff --git a/src/app/(dashboard)/dashboard/memory/page.tsx b/src/app/(dashboard)/dashboard/memory/page.tsx
index ced7fd8b36..cf228ede40 100644
--- a/src/app/(dashboard)/dashboard/memory/page.tsx
+++ b/src/app/(dashboard)/dashboard/memory/page.tsx
@@ -7,6 +7,7 @@ import MemoryConceptCard from "./components/MemoryConceptCard";
import MemoriesTab from "./components/tabs/MemoriesTab";
import PlaygroundTab from "./components/tabs/PlaygroundTab";
import EngineTab from "./components/tabs/EngineTab";
+import { useMemorySettings } from "./hooks/useMemorySettings";
type TabId = "memories" | "playground" | "engine";
@@ -16,6 +17,8 @@ function MemoryPageContent() {
const t = useTranslations("memory");
const searchParams = useSearchParams();
const router = useRouter();
+ const { settings, save } = useMemorySettings();
+ const memoryEnabled = settings?.enabled ?? true;
const rawTab = searchParams.get("tab") ?? "";
const activeTab: TabId = TABS.includes(rawTab as TabId) ? (rawTab as TabId) : "memories";
@@ -31,23 +34,44 @@ function MemoryPageContent() {
{/* Concept card */}
<MemoryConceptCard />
- {/* Tab navigation */}
- <div className="flex gap-1 p-1 rounded-lg bg-surface/50 border border-border/60 w-fit">
- {TABS.map((tab) => (
+ {/* Tab navigation + memory enable toggle */}
+ <div className="flex items-center justify-between gap-4 flex-wrap">
+ <div className="flex gap-1 p-1 rounded-lg bg-surface/50 border border-border/60 w-fit">
+ {TABS.map((tab) => (
+ <button
+ key={tab}
+ type="button"
+ data-testid={`tab-${tab}`}
+ onClick={() => setTab(tab)}
+ className={`px-4 py-2 rounded-md text-sm font-medium transition-all ${
+ activeTab === tab
+ ? "bg-bg text-text-main shadow-sm"
+ : "text-text-muted hover:text-text-main"
+ }`}
+ >
+ {t(`tabs.${tab}`)}
+ </button>
+ ))}
+ </div>
+ <label className="flex items-center gap-2 cursor-pointer select-none">
+ <span className="text-sm font-medium text-text-muted">{t("memoryEnabled")}</span>
<button
- key={tab}
type="button"
- data-testid={`tab-${tab}`}
- onClick={() => setTab(tab)}
- className={`px-4 py-2 rounded-md text-sm font-medium transition-all ${
- activeTab === tab
- ? "bg-bg text-text-main shadow-sm"
- : "text-text-muted hover:text-text-main"
+ role="switch"
+ aria-checked={memoryEnabled}
+ data-testid="memory-enabled-toggle"
+ onClick={() => void save({ enabled: !memoryEnabled })}
+ className={`relative w-11 h-6 rounded-full transition-colors ${
+ memoryEnabled ? "bg-violet-500" : "bg-border"
}`}
>
- {t(`tabs.${tab}`)}
+ <span
+ className={`absolute top-1 left-1 w-4 h-4 bg-white rounded-full transition-transform ${
+ memoryEnabled ? "translate-x-5" : "translate-x-0"
+ }`}
+ />
</button>
- ))}
+ </label>
</div>
{/* Tab content */}
diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json
index 836b719b41..a8cf4cdbca 100644
--- a/src/i18n/messages/en.json
+++ b/src/i18n/messages/en.json
@@ -3292,7 +3292,8 @@
"qdrantOk": "Healthy ({latencyMs}ms)",
"qdrantError": "Connection error",
"needsReindex": "{count} memory(ies) need reindexing",
- "configureCta": "Configure"
+ "configureCta": "Configure",
+ "vectorStoreInstallHint": "To enable vector search: npm install sqlite-vec (needs native Node.js, not WASM), then restart."
},
"episodic": "Episodic",
"export": "Export",
@@ -3403,7 +3404,8 @@
"semantic": "Concepts, preferences, and domain knowledge"
},
"totalEntries": "Total Entries",
- "type": "Type"
+ "type": "Type",
+ "memoryEnabled": "Memory enabled"
},
"skills": {
"title": "Skills",
diff --git a/src/i18n/messages/pt-BR.json b/src/i18n/messages/pt-BR.json
index 464724d88e..561439fe28 100644
--- a/src/i18n/messages/pt-BR.json
+++ b/src/i18n/messages/pt-BR.json
@@ -3879,7 +3879,8 @@
"qdrantOk": "Saudável ({latencyMs}ms)",
"qdrantError": "Erro de conexão",
"needsReindex": "{count} memória(s) precisam de reindexação",
- "configureCta": "Configurar"
+ "configureCta": "Configurar",
+ "vectorStoreInstallHint": "Para ativar a busca vetorial: npm install sqlite-vec (requer Node.js nativo, não WASM) e reinicie."
},
"episodic": "Episódica",
"export": "Exportar",
@@ -3990,7 +3991,8 @@
"semantic": "Conceitos, preferências e conhecimento de domínio"
},
"totalEntries": "Total de Entradas",
- "type": "Tipo"
+ "type": "Tipo",
+ "memoryEnabled": "Memória ativada"
},
"miniPlayground": {
"endpoint": "Endpoint",
diff --git a/tests/unit/v388-phase3-memory.test.ts b/tests/unit/v388-phase3-memory.test.ts
new file mode 100644
index 0000000000..56622455d9
--- /dev/null
+++ b/tests/unit/v388-phase3-memory.test.ts
@@ -0,0 +1,37 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+
+// Regression guards for v3.8.8 Memory screen fixes (Phase 3).
+const root = join(import.meta.dirname, "../..");
+const read = (p: string) => readFileSync(join(root, p), "utf8");
+const en = JSON.parse(read("src/i18n/messages/en.json"));
+const pt = JSON.parse(read("src/i18n/messages/pt-BR.json"));
+
+test("memory: health auto-checks on mount + 30s polling", () => {
+ const src = read("src/app/(dashboard)/dashboard/memory/components/tabs/MemoriesTab.tsx");
+ assert.ok(src.includes("void checkHealth();"), "calls checkHealth from an effect");
+ assert.ok(src.includes("setInterval"), "polls health periodically");
+});
+
+test("memory: page wires enable/disable toggle via useMemorySettings", () => {
+ const src = read("src/app/(dashboard)/dashboard/memory/page.tsx");
+ assert.ok(src.includes("useMemorySettings"), "uses the settings hook");
+ assert.ok(/role="switch"/.test(src), "renders a switch control");
+ assert.ok(src.includes("save({ enabled:"), "persists enabled via save()");
+});
+
+test("memory: vector store shows install hint when backend is none", () => {
+ const src = read("src/app/(dashboard)/dashboard/memory/components/MemoryEngineStatus.tsx");
+ assert.ok(src.includes('status.vectorStore.backend === "none"'), "branches on backend none");
+ assert.ok(src.includes("engine.vectorStoreInstallHint"), "renders the install-hint key");
+});
+
+test("memory i18n: memoryEnabled + engine.vectorStoreInstallHint present in en + pt-BR", () => {
+ assert.ok(en.memory?.memoryEnabled && pt.memory?.memoryEnabled, "memoryEnabled in both locales");
+ assert.ok(
+ en.memory?.engine?.vectorStoreInstallHint && pt.memory?.engine?.vectorStoreInstallHint,
+ "vectorStoreInstallHint in both locales"
+ );
+});