Files
OmniRoute/src/lib
Diego Rodrigues de Sa e Souza f60fd398b6 refactor(memory): extract pure scoring/conversion helpers from retrieval.ts (#5733)
retrieval.ts (1192 lines — ABOVE its 1171 frozen baseline) is the memory
retrieval engine (DB + vector + rerank network). Extract the pure, DB-free
scoring/conversion helpers (+ the MemoryRow row shape they share) verbatim into
a self-contained leaf, leaving all DB/vector/network code in the host:

  - retrieval/scoring.ts (104)  interface MemoryRow + estimateTokens,
    parseMetadata, rowToMemory, getRelevanceScore

Host retrieval.ts: 1192 -> 1072 — back UNDER the 1171 frozen baseline (the split
also repairs the pre-existing file-size drift). The leaf imports only ../types,
never the host, so check:cycles stays clean (no cycle). MemoryRow moved to the
leaf and imported back as a type by the host's DB row functions. The public
estimateTokens is re-exported from the leaf; the host also imports it for its
internal token-budget loops. The other three helpers were module-internal, so
the public API is unchanged (7 exports). Bodies moved byte-identical.

Behavior-preserving: 38 existing memory-retrieval consumer tests stay green
(rerank 5, hybrid 6, semantic 6, engine-status 9, stats-api 12); new
tests/unit/retrieval-scoring-split.test.ts (11 assertions) pins
estimateTokens (ceil(len/4)) + parseMetadata + rowToMemory mapping +
getRelevanceScore (+20 phrase / +3 token) and guards the public API.

Refs #3501.
2026-06-30 20:33:38 -03:00
..
2026-06-30 06:54:29 -03:00
2026-06-19 06:49:01 -03:00
2026-06-29 08:40:06 -03:00
2026-06-30 06:54:29 -03:00
2026-06-30 06:54:29 -03:00
2026-06-30 06:54:29 -03:00
2026-06-29 16:51:03 -03:00
2026-06-23 03:08:29 -03:00
2026-06-30 06:54:29 -03:00
2026-06-30 06:54:29 -03:00
2026-06-20 07:09:43 -03:00
2026-06-27 09:07:12 -03:00
2026-06-29 16:51:03 -03:00
2026-06-30 06:54:29 -03:00
2026-05-24 18:05:58 -03:00
2026-05-29 19:54:00 -03:00
2026-06-25 13:17:40 -03:00
2026-06-26 02:51:06 -03:00
2026-05-26 23:51:47 -03:00
2026-06-29 16:51:03 -03:00
2026-06-30 06:54:29 -03:00
2026-06-20 07:09:43 -03:00
2026-06-30 06:54:29 -03:00
2026-06-10 13:49:08 -03:00
2026-06-19 06:49:01 -03:00
2026-06-17 19:26:32 -03:00
2026-06-30 06:54:29 -03:00
2026-06-30 06:54:29 -03:00
2026-06-20 14:55:24 -03:00
2026-06-30 06:54:29 -03:00
2026-06-20 07:09:43 -03:00
2026-06-25 13:17:40 -03:00
2026-06-29 16:51:03 -03:00
2026-06-25 13:17:40 -03:00
2026-06-20 14:55:24 -03:00
2026-06-30 06:54:29 -03:00
2026-06-30 06:54:29 -03:00
2026-05-26 23:51:47 -03:00
2026-06-29 16:51:03 -03:00
2026-05-29 12:44:29 -03:00
2026-06-17 02:43:21 -03:00
2026-06-30 06:54:29 -03:00
2026-06-29 08:40:06 -03:00
2026-05-29 12:44:29 -03:00
2026-05-29 12:44:29 -03:00
2026-05-26 23:51:47 -03:00
2026-06-26 02:51:06 -03:00
2026-06-29 08:40:06 -03:00
2026-06-29 08:40:06 -03:00
2026-06-26 02:51:06 -03:00
2026-06-27 09:07:12 -03:00
2026-06-20 07:09:43 -03:00
2026-05-26 23:51:47 -03:00
2026-06-29 16:51:03 -03:00
2026-06-29 16:51:03 -03:00
2026-04-30 01:27:03 -03:00
2026-06-29 08:40:06 -03:00
2026-06-12 23:49:22 -03:00
2026-06-29 08:40:06 -03:00
2026-06-29 16:51:03 -03:00
2026-06-29 16:51:03 -03:00
2026-05-24 18:05:58 -03:00
2026-06-13 17:27:40 -03:00
2026-06-20 14:55:24 -03:00
2026-06-29 16:51:03 -03:00
2026-06-09 15:56:24 -03:00
2026-06-17 19:26:32 -03:00