refactor: move feed enhancement into UserSession

Move enhancement logic from HTTP handler into UserSession so the
transport layer has no knowledge of enhancement. UserSession.feed()
handles refresh, enhancement, and caching in one place.

- UserSession subscribes to engine updates and re-enhances eagerly
- Enhancement cache tracks source identity to prevent stale results
- UserSessionManager accepts config object with optional enhancer
- HTTP handler simplified to just call session.feed()

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
2026-03-05 01:48:24 +00:00
parent bb92c9f227
commit 2b1a50349c
8 changed files with 278 additions and 120 deletions

View File

@@ -61,10 +61,7 @@ function partsEqual(a: unknown, b: unknown): boolean {
const bKeys = Object.keys(b)
if (aKeys.length !== bKeys.length) return false
return aKeys.every((key) =>
partsEqual(
(a as Record<string, unknown>)[key],
(b as Record<string, unknown>)[key],
),
partsEqual((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key]),
)
}
return false