feat(memory-v2): close Phase A with auto-review, product events, and H5 recall UI.

Add candidate auto-review pipeline, shadow audit tooling, admin metrics page,
and user-visible memory recall hints in chat with phase-a readiness checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-01 17:14:06 +08:00
parent 666db0b939
commit 6f3e53a56a
50 changed files with 3730 additions and 38 deletions
+26
View File
@@ -1461,11 +1461,37 @@ export function createAgentRunGateway({
memoryCount: Array.isArray(agentMemoryContext.memories)
? agentMemoryContext.memories.length
: 0,
memoryPreviews: buildMemoryRecallPreviews(agentMemoryContext.memories),
skipped: Boolean(agentMemoryContext.skipped),
degraded: Boolean(agentMemoryContext.degraded),
reason: agentMemoryContext.reason ?? null,
latencyMs: Number(agentMemoryContext.latencyMs ?? 0),
});
if (agentMemoryContext.injectionEnabled) {
const memoryCount = Array.isArray(agentMemoryContext.memories)
? agentMemoryContext.memories.length
: 0;
void recordMemoryV2ProductEvent(pool, {
eventType: MEMORY_V2_PRODUCT_EVENT_TYPES.RESOLVED_INJECTED,
userId: row.user_id,
sessionId: row.agent_session_id ?? null,
runId,
data: {
mode: agentMemoryContext.mode,
memoryCount,
source: agentMemoryContext.source ?? null,
},
}).catch(() => {});
if (memoryCount > 0) {
void recordMemoryV2ProductEvent(pool, {
eventType: MEMORY_V2_PRODUCT_EVENT_TYPES.RECALL_HIT,
userId: row.user_id,
sessionId: row.agent_session_id ?? null,
runId,
data: { memoryCount, mode: agentMemoryContext.mode },
}).catch(() => {});
}
}
}
} catch (err) {
console.warn(