fix(memory-v2): improve pgvector recall and WeChat memory injection

Add keyword fallback and dedupe for pgvector resolve, score personal vs episodic memories by relevance, record WeChat recall product events, and disable broken chatrecall on Postgres session storage.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-01 22:26:47 +08:00
parent dac06753ce
commit dcf83e9b6f
8 changed files with 286 additions and 16 deletions
+21
View File
@@ -17,6 +17,7 @@ import {
resolveSandboxMcpControlDbEnv,
sandboxDeveloperTools,
sandboxMcpTools,
isChatRecallExtensionSupported,
withoutSessionImageRead,
} from './capabilities.mjs';
import {
@@ -202,6 +203,26 @@ test('default user policy blocks dangerous capabilities', () => {
assert.equal(DEFAULT_USER_CAPABILITIES.openhands, false);
});
test('isChatRecallExtensionSupported disables chatrecall on postgres session storage', () => {
assert.equal(isChatRecallExtensionSupported({}), true);
assert.equal(
isChatRecallExtensionSupported({ GOOSE_SESSION_DB_URL: 'postgresql://john@127.0.0.1:5432/memind_sessions' }),
false,
);
});
test('buildAgentExtensionPolicy omits chatrecall when postgres session storage is configured', () => {
const previous = process.env.GOOSE_SESSION_DB_URL;
process.env.GOOSE_SESSION_DB_URL = 'postgresql://john@127.0.0.1:5432/memind_sessions';
try {
const policy = buildAgentExtensionPolicy(DEFAULT_USER_CAPABILITIES);
assert.equal(policy.extensionOverrides.some((ext) => ext.name === 'chatrecall'), false);
} finally {
if (previous == null) delete process.env.GOOSE_SESSION_DB_URL;
else process.env.GOOSE_SESSION_DB_URL = previous;
}
});
test('buildAgentExtensionPolicy returns null overrides and auto mode for unrestricted users', () => {
const policy = buildAgentExtensionPolicy({}, { unrestricted: true });
assert.equal(policy.extensionOverrides, null);