@edihasaj/recall 1.3.1 → 1.4.1

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 (44) hide show
  1. package/dist/{chunk-ZXLAD4CS.js → chunk-4UHRAQFG.js} +47 -16
  2. package/dist/{chunk-ZXLAD4CS.js.map → chunk-4UHRAQFG.js.map} +1 -1
  3. package/dist/{chunk-427VWTG6.js → chunk-7CFX774S.js} +9 -9
  4. package/dist/{chunk-VP25EEOH.js → chunk-AFD43EOE.js} +2 -2
  5. package/dist/{chunk-6FE2IKPF.js → chunk-LWY4Z626.js} +3 -3
  6. package/dist/{chunk-FUDWE6KW.js → chunk-NAYFAUSM.js} +149 -10
  7. package/dist/chunk-NAYFAUSM.js.map +1 -0
  8. package/dist/{chunk-ZPAXZDWJ.js → chunk-T274LVWB.js} +107 -21
  9. package/dist/chunk-T274LVWB.js.map +1 -0
  10. package/dist/{chunk-THX57BL4.js → chunk-TA4WSV6A.js} +114 -184
  11. package/dist/chunk-TA4WSV6A.js.map +1 -0
  12. package/dist/{chunk-JKWK73GY.js → chunk-ZBQGZCFL.js} +3 -3
  13. package/dist/chunk-ZBQGZCFL.js.map +1 -0
  14. package/dist/{chunk-MPWXWBSG.js → chunk-ZXCKMEJA.js} +7 -7
  15. package/dist/{cleanup-PE3BFDMV.js → cleanup-RTL2UETA.js} +4 -4
  16. package/dist/cli.js +34 -32
  17. package/dist/cli.js.map +1 -1
  18. package/dist/daemon.js +20 -18
  19. package/dist/daemon.js.map +1 -1
  20. package/dist/{dispatcher-YCWDNYU3.js → dispatcher-PP5OKOLS.js} +4 -4
  21. package/dist/{embeddings-HDNAGCOS.js → embeddings-MILTROKW.js} +2 -2
  22. package/dist/{ingest-LZXTAMEZ.js → ingest-HEXVIAL6.js} +4 -3
  23. package/dist/mcp.js +8 -8
  24. package/dist/{memory-value-L4VZNKK5.js → memory-value-WXI2Q6TO.js} +4 -4
  25. package/dist/{quality-MEI6N7IW.js → quality-VKQUCL66.js} +5 -5
  26. package/dist/{retrieval-WDZXSBKB.js → retrieval-4MEIABHC.js} +5 -4
  27. package/dist/{tasks-6EJMXJQV.js → tasks-7SE6VHSQ.js} +4 -4
  28. package/package.json +1 -1
  29. package/dist/chunk-FUDWE6KW.js.map +0 -1
  30. package/dist/chunk-JKWK73GY.js.map +0 -1
  31. package/dist/chunk-THX57BL4.js.map +0 -1
  32. package/dist/chunk-ZPAXZDWJ.js.map +0 -1
  33. /package/dist/{chunk-427VWTG6.js.map → chunk-7CFX774S.js.map} +0 -0
  34. /package/dist/{chunk-VP25EEOH.js.map → chunk-AFD43EOE.js.map} +0 -0
  35. /package/dist/{chunk-6FE2IKPF.js.map → chunk-LWY4Z626.js.map} +0 -0
  36. /package/dist/{chunk-MPWXWBSG.js.map → chunk-ZXCKMEJA.js.map} +0 -0
  37. /package/dist/{cleanup-PE3BFDMV.js.map → cleanup-RTL2UETA.js.map} +0 -0
  38. /package/dist/{dispatcher-YCWDNYU3.js.map → dispatcher-PP5OKOLS.js.map} +0 -0
  39. /package/dist/{embeddings-HDNAGCOS.js.map → embeddings-MILTROKW.js.map} +0 -0
  40. /package/dist/{ingest-LZXTAMEZ.js.map → ingest-HEXVIAL6.js.map} +0 -0
  41. /package/dist/{memory-value-L4VZNKK5.js.map → memory-value-WXI2Q6TO.js.map} +0 -0
  42. /package/dist/{quality-MEI6N7IW.js.map → quality-VKQUCL66.js.map} +0 -0
  43. /package/dist/{retrieval-WDZXSBKB.js.map → retrieval-4MEIABHC.js.map} +0 -0
  44. /package/dist/{tasks-6EJMXJQV.js.map → tasks-7SE6VHSQ.js.map} +0 -0
@@ -3,23 +3,18 @@ import {
3
3
  evaluateScannedMemory,
4
4
  getRepoQualityProfile,
5
5
  processCorrection,
6
- recordAudit,
7
6
  redactSensitiveValue,
8
7
  seedScannedConfidence
9
- } from "./chunk-THX57BL4.js";
8
+ } from "./chunk-TA4WSV6A.js";
10
9
  import {
11
10
  recordInjectionValueEvents,
12
11
  recordMemoryInjections,
13
12
  recordOutcomeValueEvent,
14
13
  resolveMemoryInjectionOutcome
15
- } from "./chunk-MPWXWBSG.js";
14
+ } from "./chunk-ZXCKMEJA.js";
16
15
  import {
17
16
  textMatchScore
18
17
  } from "./chunk-FHEH6QDU.js";
19
- import {
20
- asc,
21
- desc
22
- } from "./chunk-CW3XJDH7.js";
23
18
  import {
24
19
  activityEventDedupeKey,
25
20
  confirmMemory,
@@ -31,10 +26,15 @@ import {
31
26
  historySnippetDedupeKey,
32
27
  promoteMemory,
33
28
  queryMemories,
29
+ recordAudit,
34
30
  recordFeedback,
35
31
  rejectMemory,
36
32
  statusFromConfidence
37
- } from "./chunk-FUDWE6KW.js";
33
+ } from "./chunk-NAYFAUSM.js";
34
+ import {
35
+ asc,
36
+ desc
37
+ } from "./chunk-CW3XJDH7.js";
38
38
  import {
39
39
  BACKGROUND_INDEX_BATCH_SIZE,
40
40
  CONFIDENCE,
@@ -54,7 +54,7 @@ import {
54
54
  readUtf8FileIfExists,
55
55
  resolveProvider,
56
56
  tagActivitySource
57
- } from "./chunk-JKWK73GY.js";
57
+ } from "./chunk-ZBQGZCFL.js";
58
58
  import {
59
59
  Column,
60
60
  Columns,
@@ -4970,6 +4970,12 @@ function normalizeQueryForRetrieval(text) {
4970
4970
  }
4971
4971
  return out;
4972
4972
  }
4973
+ var NEAR_MISS_BAND = 0.1;
4974
+ function collectNearMisses(candidates, threshold) {
4975
+ return candidates.filter(
4976
+ (m) => m.confidence + CONFIDENCE_EPSILON < threshold && m.confidence >= threshold - NEAR_MISS_BAND
4977
+ ).sort((a, b) => b.confidence - a.confidence).map((m) => ({ id: m.id, confidence: m.confidence, text: m.text }));
4978
+ }
4973
4979
  function compileContext(db, req) {
4974
4980
  const profile = getRepoQualityProfile(db, req.repo);
4975
4981
  const config = {
@@ -4989,15 +4995,19 @@ function compileContext(db, req) {
4989
4995
  auto_inject: true
4990
4996
  });
4991
4997
  const allActive = dedupeById([...repoActive, ...globalActive]);
4992
- const scoped = req.path ? allActive.filter((m) => pathMatches(m, req.path)) : allActive;
4998
+ const sessionScoped = filterSessionScoped(allActive, req.session_id);
4999
+ const scoped = req.path ? sessionScoped.filter((m) => pathMatches(m, req.path)) : sessionScoped;
4993
5000
  const passing = scoped.filter(
4994
5001
  (m) => m.confidence + CONFIDENCE_EPSILON >= config.confidence_threshold
4995
5002
  );
4996
5003
  const dropped = scoped.filter(
4997
5004
  (m) => m.confidence + CONFIDENCE_EPSILON < config.confidence_threshold
4998
5005
  );
5006
+ const nearMisses = collectNearMisses(scoped, config.confidence_threshold);
4999
5007
  if (passing.length === 0 && selectedHistory.length === 0) {
5000
5008
  return {
5009
+ confidence_threshold: config.confidence_threshold,
5010
+ near_misses: nearMisses,
5001
5011
  text: "",
5002
5012
  memories_included: [],
5003
5013
  memories_dropped: dropped.map((m) => m.id),
@@ -5062,6 +5072,8 @@ function compileContext(db, req) {
5062
5072
  repo: req.repo
5063
5073
  });
5064
5074
  return {
5075
+ confidence_threshold: config.confidence_threshold,
5076
+ near_misses: nearMisses,
5065
5077
  text: finalText,
5066
5078
  memories_included: selected.map((m) => m.id),
5067
5079
  memories_dropped: [
@@ -5091,7 +5103,8 @@ async function compileContextHybrid(db, req) {
5091
5103
  if (memory.auto_inject) return true;
5092
5104
  return Boolean(effectiveQuery) && memory.status === "active";
5093
5105
  });
5094
- const scoped = req.path ? allMemories.filter((memory) => pathMatches(memory, req.path)) : allMemories;
5106
+ const sessionScoped = filterSessionScoped(allMemories, req.session_id);
5107
+ const scoped = req.path ? sessionScoped.filter((memory) => pathMatches(memory, req.path)) : sessionScoped;
5095
5108
  const candidateConfidenceFloor = Math.min(config.confidence_threshold, 0.45);
5096
5109
  const passing = scoped.filter((memory) => {
5097
5110
  if (memory.status === "active") {
@@ -5104,8 +5117,11 @@ async function compileContextHybrid(db, req) {
5104
5117
  });
5105
5118
  const passingIds = new Set(passing.map((memory) => memory.id));
5106
5119
  const dropped = scoped.filter((memory) => !passingIds.has(memory.id));
5120
+ const hybridNearMisses = collectNearMisses(scoped, config.confidence_threshold);
5107
5121
  if (passing.length === 0 && selectedHistory.length === 0) {
5108
5122
  return {
5123
+ confidence_threshold: config.confidence_threshold,
5124
+ near_misses: hybridNearMisses,
5109
5125
  text: "",
5110
5126
  memories_included: [],
5111
5127
  memories_dropped: dropped.map((m) => m.id),
@@ -5187,6 +5203,8 @@ async function compileContextHybrid(db, req) {
5187
5203
  repo: req.repo
5188
5204
  });
5189
5205
  return {
5206
+ confidence_threshold: config.confidence_threshold,
5207
+ near_misses: hybridNearMisses,
5190
5208
  text: historyOnlyText,
5191
5209
  memories_included: [],
5192
5210
  memories_dropped: [...dropped, ...passing].map((m) => m.id),
@@ -5195,6 +5213,8 @@ async function compileContextHybrid(db, req) {
5195
5213
  };
5196
5214
  }
5197
5215
  return {
5216
+ confidence_threshold: config.confidence_threshold,
5217
+ near_misses: hybridNearMisses,
5198
5218
  text: "",
5199
5219
  memories_included: [],
5200
5220
  memories_dropped: [...dropped, ...passing].map((m) => m.id),
@@ -5224,6 +5244,8 @@ async function compileContextHybrid(db, req) {
5224
5244
  repo: req.repo
5225
5245
  });
5226
5246
  return {
5247
+ confidence_threshold: config.confidence_threshold,
5248
+ near_misses: hybridNearMisses,
5227
5249
  text: finalText,
5228
5250
  memories_included: selected.map((m) => m.id),
5229
5251
  memories_dropped: [
@@ -5418,6 +5440,13 @@ function dedupeById(memories4) {
5418
5440
  }
5419
5441
  return out;
5420
5442
  }
5443
+ function filterSessionScoped(memories4, sessionId) {
5444
+ return memories4.filter((memory) => {
5445
+ if (memory.scope !== "session") return true;
5446
+ if (!sessionId) return false;
5447
+ return memory.evidence.some((entry) => entry.type === "session_correction" && entry.session === sessionId);
5448
+ });
5449
+ }
5421
5450
 
5422
5451
  // src/adapters/markdown.ts
5423
5452
  function exportMarkdown(db, repo) {
@@ -6331,7 +6360,7 @@ function resolveApproval(db, approvalId, status, reviewedBy, reason) {
6331
6360
  if (status === "approved") {
6332
6361
  confirmMemory(db, row.memory_id);
6333
6362
  } else {
6334
- rejectMemory(db, row.memory_id);
6363
+ rejectMemory(db, row.memory_id, "policy");
6335
6364
  }
6336
6365
  recordAudit(db, row.memory_id, "approval_resolved", reviewedBy, reason ?? null);
6337
6366
  return true;
@@ -6495,13 +6524,14 @@ function formatPruneReport(result, dryRun) {
6495
6524
  // src/mcp/fallback.ts
6496
6525
  async function captureCorrectionFallback(db, input, source) {
6497
6526
  const sessionId = input.session_id ?? `${source}-capture`;
6498
- const { ids, pendingTaskId } = await processCorrection(db, input.text, {
6527
+ const { ids, pendingTaskId, blockedByRejectedExemplar } = await processCorrection(db, input.text, {
6499
6528
  sessionId,
6500
6529
  repo: input.repo,
6501
6530
  path: input.path,
6502
6531
  agent: input.agent,
6503
6532
  prev_assistant_turn: input.prev_assistant_turn,
6504
- recent_tool_calls: input.recent_tool_calls
6533
+ recent_tool_calls: input.recent_tool_calls,
6534
+ force_semantic_capture: true
6505
6535
  });
6506
6536
  createActivityEvent(db, {
6507
6537
  session_id: sessionId,
@@ -6525,7 +6555,8 @@ async function captureCorrectionFallback(db, input, source) {
6525
6555
  return {
6526
6556
  ids,
6527
6557
  session_id: sessionId,
6528
- pendingTaskId
6558
+ pendingTaskId,
6559
+ blockedByRejectedExemplar
6529
6560
  };
6530
6561
  }
6531
6562
  function signalOutcomeFallback(db, input, source) {
@@ -6657,4 +6688,4 @@ export {
6657
6688
  pruneMemories,
6658
6689
  formatPruneReport
6659
6690
  };
6660
- //# sourceMappingURL=chunk-ZXLAD4CS.js.map
6691
+ //# sourceMappingURL=chunk-4UHRAQFG.js.map