@edihasaj/recall 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/{chunk-EZUMD27V.js → chunk-AVK3HSTI.js} +60 -22
  2. package/dist/{chunk-EZUMD27V.js.map → chunk-AVK3HSTI.js.map} +1 -1
  3. package/dist/{chunk-3PPYB7BX.js → chunk-D4LBCVUU.js} +6 -6
  4. package/dist/{chunk-DWA2IO5N.js → chunk-FHEH6QDU.js} +12 -3
  5. package/dist/chunk-FHEH6QDU.js.map +1 -0
  6. package/dist/{chunk-GE5BPNHC.js → chunk-GRASHRKW.js} +6 -6
  7. package/dist/{chunk-A27AP4NR.js → chunk-HGZOF7YH.js} +16 -7
  8. package/dist/chunk-HGZOF7YH.js.map +1 -0
  9. package/dist/{chunk-G6YAXFT4.js → chunk-HJIUBQOH.js} +46 -7
  10. package/dist/chunk-HJIUBQOH.js.map +1 -0
  11. package/dist/{chunk-YDSCPOIJ.js → chunk-K5PIUKRM.js} +2 -2
  12. package/dist/{chunk-FNQABJTM.js → chunk-R7Z6GISJ.js} +2 -2
  13. package/dist/{chunk-4W4J7Z24.js → chunk-WZ7P5EFR.js} +3 -3
  14. package/dist/{cleanup-MBXKIGT6.js → cleanup-665SJZKN.js} +4 -4
  15. package/dist/cli.js +17 -17
  16. package/dist/daemon.js +9 -9
  17. package/dist/{dispatcher-YN6545TF.js → dispatcher-XAFET3PC.js} +4 -4
  18. package/dist/{ingest-7FAOX7YV.js → ingest-BLMXKKGP.js} +2 -2
  19. package/dist/mcp.js +7 -7
  20. package/dist/{memory-value-ZLVZTE5M.js → memory-value-5626VN6X.js} +4 -4
  21. package/dist/{quality-UUEBGSAQ.js → quality-SIPIGROF.js} +5 -5
  22. package/dist/{retrieval-YU2PLBUS.js → retrieval-FHCKFVXX.js} +3 -3
  23. package/dist/{tasks-AEKGKZZF.js → tasks-QH4HRHPR.js} +4 -4
  24. package/dist/webui/assets/{index-DAoAhOb4.js → index-2DR_ysOm.js} +391 -267
  25. package/dist/webui/assets/{index-DAoAhOb4.js.map → index-2DR_ysOm.js.map} +1 -1
  26. package/dist/webui/index.html +1 -1
  27. package/package.json +1 -1
  28. package/dist/chunk-A27AP4NR.js.map +0 -1
  29. package/dist/chunk-DWA2IO5N.js.map +0 -1
  30. package/dist/chunk-G6YAXFT4.js.map +0 -1
  31. /package/dist/{chunk-3PPYB7BX.js.map → chunk-D4LBCVUU.js.map} +0 -0
  32. /package/dist/{chunk-GE5BPNHC.js.map → chunk-GRASHRKW.js.map} +0 -0
  33. /package/dist/{chunk-YDSCPOIJ.js.map → chunk-K5PIUKRM.js.map} +0 -0
  34. /package/dist/{chunk-FNQABJTM.js.map → chunk-R7Z6GISJ.js.map} +0 -0
  35. /package/dist/{chunk-4W4J7Z24.js.map → chunk-WZ7P5EFR.js.map} +0 -0
  36. /package/dist/{cleanup-MBXKIGT6.js.map → cleanup-665SJZKN.js.map} +0 -0
  37. /package/dist/{dispatcher-YN6545TF.js.map → dispatcher-XAFET3PC.js.map} +0 -0
  38. /package/dist/{ingest-7FAOX7YV.js.map → ingest-BLMXKKGP.js.map} +0 -0
  39. /package/dist/{memory-value-ZLVZTE5M.js.map → memory-value-5626VN6X.js.map} +0 -0
  40. /package/dist/{quality-UUEBGSAQ.js.map → quality-SIPIGROF.js.map} +0 -0
  41. /package/dist/{retrieval-YU2PLBUS.js.map → retrieval-FHCKFVXX.js.map} +0 -0
  42. /package/dist/{tasks-AEKGKZZF.js.map → tasks-QH4HRHPR.js.map} +0 -0
@@ -6,16 +6,16 @@ import {
6
6
  recordAudit,
7
7
  redactSensitiveValue,
8
8
  seedScannedConfidence
9
- } from "./chunk-G6YAXFT4.js";
9
+ } from "./chunk-HJIUBQOH.js";
10
10
  import {
11
11
  recordInjectionValueEvents,
12
12
  recordMemoryInjections,
13
13
  recordOutcomeValueEvent,
14
14
  resolveMemoryInjectionOutcome
15
- } from "./chunk-4W4J7Z24.js";
15
+ } from "./chunk-WZ7P5EFR.js";
16
16
  import {
17
17
  textMatchScore
18
- } from "./chunk-DWA2IO5N.js";
18
+ } from "./chunk-FHEH6QDU.js";
19
19
  import {
20
20
  asc,
21
21
  desc
@@ -34,7 +34,7 @@ import {
34
34
  recordFeedback,
35
35
  rejectMemory,
36
36
  statusFromConfidence
37
- } from "./chunk-A27AP4NR.js";
37
+ } from "./chunk-HGZOF7YH.js";
38
38
  import {
39
39
  CONFIDENCE,
40
40
  RetrievalEvalCase,
@@ -4864,6 +4864,7 @@ var QUERY_VECTOR_RELEVANCE_FLOOR = 0.7;
4864
4864
  var QUERY_TEXT_MATCH_FLOOR = 0.45;
4865
4865
  var HISTORY_VECTOR_RELEVANCE_FLOOR = 0.7;
4866
4866
  var HISTORY_LEXICAL_RELEVANCE_FLOOR = 0.01;
4867
+ var CONFIDENCE_EPSILON = 1e-9;
4867
4868
  function normalizeQueryForRetrieval(text) {
4868
4869
  if (!text) return "";
4869
4870
  let out = text;
@@ -4895,10 +4896,10 @@ function compileContext(db, req) {
4895
4896
  const allActive = dedupeById([...repoActive, ...globalActive]);
4896
4897
  const scoped = req.path ? allActive.filter((m) => pathMatches(m, req.path)) : allActive;
4897
4898
  const passing = scoped.filter(
4898
- (m) => m.confidence >= config.confidence_threshold
4899
+ (m) => m.confidence + CONFIDENCE_EPSILON >= config.confidence_threshold
4899
4900
  );
4900
4901
  const dropped = scoped.filter(
4901
- (m) => m.confidence < config.confidence_threshold
4902
+ (m) => m.confidence + CONFIDENCE_EPSILON < config.confidence_threshold
4902
4903
  );
4903
4904
  if (passing.length === 0 && selectedHistory.length === 0) {
4904
4905
  return {
@@ -4996,7 +4997,7 @@ async function compileContextHybrid(db, req) {
4996
4997
  const candidateConfidenceFloor = Math.min(config.confidence_threshold, 0.45);
4997
4998
  const passing = scoped.filter((memory) => {
4998
4999
  if (memory.status === "active") {
4999
- return memory.confidence >= config.confidence_threshold;
5000
+ return memory.confidence + CONFIDENCE_EPSILON >= config.confidence_threshold;
5000
5001
  }
5001
5002
  if (memory.status === "candidate" && config.include_candidates) {
5002
5003
  return memory.confidence >= candidateConfidenceFloor;
@@ -5022,15 +5023,22 @@ async function compileContextHybrid(db, req) {
5022
5023
  );
5023
5024
  if (effectiveQuery) {
5024
5025
  for (const memory of passing) {
5025
- if (retrievalById.has(memory.id)) continue;
5026
5026
  const lexical = textMatchScore(effectiveQuery, memory.text);
5027
5027
  if (lexical.score < QUERY_TEXT_MATCH_FLOOR) continue;
5028
- retrievalById.set(memory.id, {
5029
- memory,
5030
- score: lexical.score,
5031
- similarity: 0,
5032
- lexical_score: lexical.score
5033
- });
5028
+ const existing = retrievalById.get(memory.id);
5029
+ retrievalById.set(
5030
+ memory.id,
5031
+ existing ? {
5032
+ ...existing,
5033
+ score: Math.max(existing.score, lexical.score),
5034
+ lexical_score: Math.max(existing.lexical_score, lexical.score)
5035
+ } : {
5036
+ memory,
5037
+ score: lexical.score,
5038
+ similarity: 0,
5039
+ lexical_score: lexical.score
5040
+ }
5041
+ );
5034
5042
  }
5035
5043
  }
5036
5044
  const summaries = getMemoryFeedbackSummaries(db, passing.map((m) => m.id));
@@ -5182,13 +5190,26 @@ function dedupeMemoriesForInjection(memories4) {
5182
5190
  }
5183
5191
  function dedupeRankedMemoriesForInjection(ranked) {
5184
5192
  const seen = /* @__PURE__ */ new Set();
5185
- return ranked.filter((item) => {
5193
+ const selected = [];
5194
+ for (const item of ranked) {
5186
5195
  const key = canonicalInjectionText(item.memory);
5187
- if (!key) return false;
5188
- if (seen.has(key)) return false;
5196
+ if (!key || seen.has(key)) continue;
5197
+ const scopedOverrideIndex = selected.findIndex(
5198
+ (existing) => existing.memory.scope === "global" && item.memory.scope !== "global" && existing.memory.type === item.memory.type && textMatchScore(existing.memory.text, item.memory.text).score >= 0.6
5199
+ );
5200
+ if (scopedOverrideIndex >= 0) {
5201
+ seen.add(key);
5202
+ selected[scopedOverrideIndex] = item;
5203
+ continue;
5204
+ }
5205
+ const hasNarrowerEquivalent = selected.some(
5206
+ (existing) => existing.memory.scope !== "global" && item.memory.scope === "global" && existing.memory.type === item.memory.type && textMatchScore(existing.memory.text, item.memory.text).score >= 0.6
5207
+ );
5208
+ if (hasNarrowerEquivalent) continue;
5189
5209
  seen.add(key);
5190
- return true;
5191
- });
5210
+ selected.push(item);
5211
+ }
5212
+ return selected;
5192
5213
  }
5193
5214
  function canonicalInjectionText(memory) {
5194
5215
  return renderMemoryText(memory).toLowerCase().replace(/[`*_]/g, "").replace(/\s+/g, " ").trim();
@@ -5767,16 +5788,29 @@ async function runRetrievalEval(db, input, options = {}) {
5767
5788
  }
5768
5789
  async function runValueRetrievalEval(db, options = {}) {
5769
5790
  const since = options.sinceIso ?? new Date(Date.now() - 14 * 864e5).toISOString();
5791
+ const caseLimit = options.limit ?? 50;
5770
5792
  const conditions = [
5771
5793
  gte(memoryValueEvents.created_at, since),
5772
- inArray(memoryValueEvents.event_type, ["retrieval_miss", "used"])
5794
+ inArray(memoryValueEvents.event_type, ["retrieval_miss", "used"]),
5795
+ eq(memories.auto_inject, true),
5796
+ or(
5797
+ and(
5798
+ eq(memoryValueEvents.event_type, "retrieval_miss"),
5799
+ inArray(memories.status, ["active", "candidate"])
5800
+ ),
5801
+ and(
5802
+ eq(memoryValueEvents.event_type, "used"),
5803
+ eq(memories.status, "active")
5804
+ )
5805
+ )
5773
5806
  ];
5774
5807
  if (options.repo) conditions.push(eq(memoryValueEvents.repo, options.repo));
5775
- const rows = db.select().from(memoryValueEvents).where(and(...conditions)).orderBy(desc(memoryValueEvents.created_at)).limit(options.limit ?? 50).all();
5808
+ const rows = db.select({ ...getTableColumns(memoryValueEvents) }).from(memoryValueEvents).innerJoin(memories, eq(memoryValueEvents.memory_id, memories.id)).where(and(...conditions)).orderBy(desc(memoryValueEvents.created_at)).limit(Math.max(caseLimit * 10, 500)).all();
5776
5809
  let skippedEvents = 0;
5777
5810
  const sourceEvents = { retrieval_miss: 0, used: 0 };
5778
5811
  const cases = [];
5779
5812
  for (const row of rows) {
5813
+ if (cases.length >= caseLimit) break;
5780
5814
  if (row.event_type === "retrieval_miss") sourceEvents.retrieval_miss += 1;
5781
5815
  if (row.event_type === "used") sourceEvents.used += 1;
5782
5816
  const memory = row.memory_id ? getMemory(db, row.memory_id) : null;
@@ -5796,6 +5830,10 @@ async function runValueRetrievalEval(db, options = {}) {
5796
5830
  skippedEvents += 1;
5797
5831
  continue;
5798
5832
  }
5833
+ if (row.event_type === "used" && textMatchScore(queryText, memory.text).score < 0.45 && !(typeof evidence.semantic_similarity === "number" && evidence.semantic_similarity >= 0.78)) {
5834
+ skippedEvents += 1;
5835
+ continue;
5836
+ }
5799
5837
  const repo = memory.repo ?? row.repo;
5800
5838
  if (!repo) {
5801
5839
  skippedEvents += 1;
@@ -6497,4 +6535,4 @@ export {
6497
6535
  pruneMemories,
6498
6536
  formatPruneReport
6499
6537
  };
6500
- //# sourceMappingURL=chunk-EZUMD27V.js.map
6538
+ //# sourceMappingURL=chunk-AVK3HSTI.js.map