Add User Model Service and Temporal Recall for MeMind V0.1.

Introduce UMS ingest/snapshot pipeline, Context Planner with multi-source recall, runtime context injection, canonical user mapping, and session snapshot loading on auth/me.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-09-03 23:25:18 +08:00
parent bf66fdf493
commit 212ff3ff80
47 changed files with 4534 additions and 6 deletions
@@ -0,0 +1,26 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {
resolveCanonicalUserId,
resetCanonicalUserMapCache,
} from './canonical-user.mjs';
test('resolveCanonicalUserId maps tang19821002 to wx 唐 by default', () => {
resetCanonicalUserMapCache();
assert.equal(
resolveCanonicalUserId('d0678bbc-2a50-4e08-8bf0-6b6c9301e2d6'),
'a70ff537-8908-486e-9b6c-042e07cc25db',
);
assert.equal(
resolveCanonicalUserId('a70ff537-8908-486e-9b6c-042e07cc25db'),
'a70ff537-8908-486e-9b6c-042e07cc25db',
);
});
test('resolveCanonicalUserId respects MEMIND_CANONICAL_USER_MAP env', () => {
process.env.MEMIND_CANONICAL_USER_MAP = 'user-a=user-b';
resetCanonicalUserMapCache();
assert.equal(resolveCanonicalUserId('user-a'), 'user-b');
delete process.env.MEMIND_CANONICAL_USER_MAP;
resetCanonicalUserMapCache();
});