fix (memory/lancedb): require explicit opt-in for auto-capture

This commit is contained in:
Vignesh Natarajan
2026-02-14 18:20:48 -08:00
parent 3ca74f8e6d
commit ed7d83bcfc
2 changed files with 16 additions and 1 deletions

View File

@@ -121,7 +121,7 @@ export const memoryConfigSchema = {
apiKey: resolveEnvVars(embedding.apiKey),
},
dbPath: typeof cfg.dbPath === "string" ? cfg.dbPath : DEFAULT_DB_PATH,
autoCapture: cfg.autoCapture !== false,
autoCapture: cfg.autoCapture === true,
autoRecall: cfg.autoRecall !== false,
captureMaxChars: captureMaxChars ?? DEFAULT_CAPTURE_MAX_CHARS,
};

View File

@@ -120,6 +120,21 @@ describe("memory plugin e2e", () => {
expect(config?.captureMaxChars).toBe(1800);
});
test("config schema keeps autoCapture disabled by default", async () => {
const { default: memoryPlugin } = await import("./index.js");
const config = memoryPlugin.configSchema?.parse?.({
embedding: {
apiKey: OPENAI_API_KEY,
model: "text-embedding-3-small",
},
dbPath,
});
expect(config?.autoCapture).toBe(false);
expect(config?.autoRecall).toBe(true);
});
test("shouldCapture applies real capture rules", async () => {
const { shouldCapture } = await import("./index.js");