@edihasaj/recall 0.9.0 → 0.9.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 (33) hide show
  1. package/dist/{chunk-OADI5XD2.js → chunk-3PPYB7BX.js} +4 -4
  2. package/dist/{chunk-FPZ3GBXP.js → chunk-4W4J7Z24.js} +13 -107
  3. package/dist/chunk-4W4J7Z24.js.map +1 -0
  4. package/dist/chunk-DWA2IO5N.js +105 -0
  5. package/dist/chunk-DWA2IO5N.js.map +1 -0
  6. package/dist/{chunk-SISLEKTR.js → chunk-EZUMD27V.js} +17 -7
  7. package/dist/{chunk-SISLEKTR.js.map → chunk-EZUMD27V.js.map} +1 -1
  8. package/dist/{chunk-DRAOZ2RN.js → chunk-FNQABJTM.js} +2 -2
  9. package/dist/{chunk-5K2LTXNW.js → chunk-G6YAXFT4.js} +54 -27
  10. package/dist/chunk-G6YAXFT4.js.map +1 -0
  11. package/dist/{chunk-XRWHIL74.js → chunk-GE5BPNHC.js} +7 -5
  12. package/dist/{chunk-XRWHIL74.js.map → chunk-GE5BPNHC.js.map} +1 -1
  13. package/dist/{cleanup-3JDS7MHX.js → cleanup-MBXKIGT6.js} +3 -2
  14. package/dist/cli.js +14 -13
  15. package/dist/cli.js.map +1 -1
  16. package/dist/daemon.js +7 -6
  17. package/dist/daemon.js.map +1 -1
  18. package/dist/{dispatcher-LV6WGHR2.js → dispatcher-YN6545TF.js} +3 -2
  19. package/dist/mcp.js +5 -4
  20. package/dist/mcp.js.map +1 -1
  21. package/dist/{memory-value-V4MH2DYO.js → memory-value-ZLVZTE5M.js} +3 -2
  22. package/dist/{quality-5SB4S5G2.js → quality-UUEBGSAQ.js} +4 -3
  23. package/dist/{tasks-DT6QPIKV.js → tasks-AEKGKZZF.js} +3 -2
  24. package/package.json +1 -1
  25. package/dist/chunk-5K2LTXNW.js.map +0 -1
  26. package/dist/chunk-FPZ3GBXP.js.map +0 -1
  27. /package/dist/{chunk-OADI5XD2.js.map → chunk-3PPYB7BX.js.map} +0 -0
  28. /package/dist/{chunk-DRAOZ2RN.js.map → chunk-FNQABJTM.js.map} +0 -0
  29. /package/dist/{cleanup-3JDS7MHX.js.map → cleanup-MBXKIGT6.js.map} +0 -0
  30. /package/dist/{dispatcher-LV6WGHR2.js.map → dispatcher-YN6545TF.js.map} +0 -0
  31. /package/dist/{memory-value-V4MH2DYO.js.map → memory-value-ZLVZTE5M.js.map} +0 -0
  32. /package/dist/{quality-5SB4S5G2.js.map → quality-UUEBGSAQ.js.map} +0 -0
  33. /package/dist/{tasks-DT6QPIKV.js.map → tasks-AEKGKZZF.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  computeMemoryValueReport
3
- } from "./chunk-FPZ3GBXP.js";
3
+ } from "./chunk-4W4J7Z24.js";
4
4
  import {
5
5
  desc
6
6
  } from "./chunk-CW3XJDH7.js";
@@ -180,4 +180,4 @@ export {
180
180
  diffQualitySnapshots,
181
181
  formatQualityReport
182
182
  };
183
- //# sourceMappingURL=chunk-DRAOZ2RN.js.map
183
+ //# sourceMappingURL=chunk-FNQABJTM.js.map
@@ -1,3 +1,7 @@
1
+ import {
2
+ matchTokens,
3
+ textMatchScore
4
+ } from "./chunk-DWA2IO5N.js";
1
5
  import {
2
6
  desc
3
7
  } from "./chunk-CW3XJDH7.js";
@@ -869,17 +873,18 @@ function inferPathScope(filePath) {
869
873
  return `${dir}/**`;
870
874
  }
871
875
  function hasSpecificFileReference(text) {
872
- return /\b[\w-]+\.(ts|js|py|rs|go|swift|java|rb|tsx|jsx|vue|svelte)\b/.test(text) || /\b(src|lib|app|components|utils|test|spec)\//.test(text);
876
+ return /\b[\w-]+\.(ts|js|py|rs|go|swift|java|rb|tsx|jsx|vue|svelte)\b/.test(text) || /\b(src|lib|components|utils|test|spec)\/[\w/.-]+/.test(text) || /\b(?:in|under|inside|path|file|directory|folder)\s+(?:the\s+)?app\/[\w/.-]+/i.test(text) || /`app\/[\w/.-]+`/.test(text);
873
877
  }
874
878
  function extractPathFromText(text) {
875
879
  const pathMatch = text.match(
876
- /\b((?:src|lib|app|components|utils|test|spec)\/[\w/.-]+)/
880
+ /\b((?:src|lib|components|utils|test|spec)\/[\w/.-]+)/
877
881
  );
878
882
  if (pathMatch) return `${pathMatch[1]}**`;
879
- const dirMatch = text.match(
880
- /\b((?:src|lib|app|components|utils|test|spec)\/[\w/-]*)/
883
+ const explicitAppPath = text.match(
884
+ /(?:`(app\/[\w/.-]+)`|\b(?:in|under|inside|path|file|directory|folder)\s+(?:the\s+)?(app\/[\w/.-]+))/i
881
885
  );
882
- if (dirMatch) return `${dirMatch[1]}/**`;
886
+ const appPath = explicitAppPath?.[1] ?? explicitAppPath?.[2];
887
+ if (appPath) return `${appPath}**`;
883
888
  return null;
884
889
  }
885
890
  var SOURCE_AWARE_TOOLS = /* @__PURE__ */ new Set([
@@ -1007,7 +1012,7 @@ function detectContradictions(db, repo) {
1007
1012
  ).get();
1008
1013
  if (!existing) {
1009
1014
  const id = randomUUID2();
1010
- const now = (/* @__PURE__ */ new Date()).toISOString();
1015
+ const now2 = (/* @__PURE__ */ new Date()).toISOString();
1011
1016
  db.insert(contradictions).values({
1012
1017
  id,
1013
1018
  memory_a_id: a.id,
@@ -1016,7 +1021,7 @@ function detectContradictions(db, repo) {
1016
1021
  severity: contradiction.severity,
1017
1022
  description: contradiction.description,
1018
1023
  resolved: false,
1019
- detected_at: now
1024
+ detected_at: now2
1020
1025
  }).run();
1021
1026
  recordAudit(db, a.id, "contradiction_detected", "system", contradiction.description);
1022
1027
  recordAudit(db, b.id, "contradiction_detected", "system", contradiction.description);
@@ -1029,13 +1034,27 @@ function detectContradictions(db, repo) {
1029
1034
  description: contradiction.description,
1030
1035
  resolved: false,
1031
1036
  resolution: null,
1032
- detected_at: now,
1037
+ detected_at: now2,
1033
1038
  resolved_at: null
1034
1039
  });
1035
1040
  }
1036
1041
  }
1037
1042
  }
1038
1043
  }
1044
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1045
+ const unresolved = db.select().from(contradictions).where(eq(contradictions.resolved, false)).all();
1046
+ for (const row of unresolved) {
1047
+ const a = getMemory(db, row.memory_a_id);
1048
+ const b = getMemory(db, row.memory_b_id);
1049
+ if (repo && a?.repo !== repo && b?.repo !== repo) continue;
1050
+ const eligible = a && b && (a.status === "active" || a.status === "candidate") && (b.status === "active" || b.status === "candidate");
1051
+ if (eligible && checkContradiction(a, b)) continue;
1052
+ db.update(contradictions).set({
1053
+ resolved: true,
1054
+ resolution: "Auto-resolved: pair no longer satisfies contradiction rules",
1055
+ resolved_at: now
1056
+ }).where(eq(contradictions.id, row.id)).run();
1057
+ }
1039
1058
  return found;
1040
1059
  }
1041
1060
  function checkContradiction(a, b) {
@@ -1083,15 +1102,15 @@ function checkDirectNegation(a, b) {
1083
1102
  function checkConflictingRules(a, b) {
1084
1103
  if (a.type !== b.type) return null;
1085
1104
  if (a.type !== "rule" && a.type !== "command") return null;
1086
- const useA = a.text.match(/\buse\s+(\S+)/i);
1087
- const useB = b.text.match(/\buse\s+(\S+)/i);
1105
+ const useA = extractAffirmativeUseDirective(a.text);
1106
+ const useB = extractAffirmativeUseDirective(b.text);
1088
1107
  if (useA && useB) {
1089
- const toolA = useA[1].toLowerCase().replace(/[,.:;]/g, "");
1090
- const toolB = useB[1].toLowerCase().replace(/[,.:;]/g, "");
1108
+ const toolA = useA.choice;
1109
+ const toolB = useB.choice;
1091
1110
  if (toolA !== toolB) {
1092
- const contextA = extractContext(a.text);
1093
- const contextB = extractContext(b.text);
1094
- if (contextA && contextB && wordOverlap(contextA, contextB) > 0.3) {
1111
+ const contextA = useA.context;
1112
+ const contextB = useB.context;
1113
+ if (matchTokens(contextA).length >= 2 && matchTokens(contextB).length >= 2 && textMatchScore(contextA, contextB).score >= 0.72) {
1095
1114
  return {
1096
1115
  type: "conflicting_rules",
1097
1116
  severity: "medium",
@@ -1100,14 +1119,6 @@ function checkConflictingRules(a, b) {
1100
1119
  }
1101
1120
  }
1102
1121
  }
1103
- const sim = wordOverlap(a.text, b.text);
1104
- if (sim > 0.6 && sim < 0.95 && a.text !== b.text) {
1105
- return {
1106
- type: "scope_overlap",
1107
- severity: "low",
1108
- description: `Very similar memories (${(sim * 100).toFixed(0)}% overlap): "${a.text.slice(0, 50)}" vs "${b.text.slice(0, 50)}"`
1109
- };
1110
- }
1111
1122
  return null;
1112
1123
  }
1113
1124
  function resolveContradiction(db, contradictionId, keepMemoryId, actor, resolution) {
@@ -1165,8 +1176,14 @@ function scopesOverlap(a, b) {
1165
1176
  function extractSubject(text) {
1166
1177
  return text.replace(/\b(always|never|must|do not|don't|use|do|run|call|import)\b/gi, "").trim().toLowerCase();
1167
1178
  }
1168
- function extractContext(text) {
1169
- return text.replace(/\buse\s+\S+/i, "").trim().toLowerCase();
1179
+ function extractAffirmativeUseDirective(text) {
1180
+ const match = text.trim().match(
1181
+ /^(?:always\s+|prefer\s+)?use\s+([a-z0-9][\w.+-]*)\s+(?:for|when|on|as)\s+(.+)$/i
1182
+ );
1183
+ if (!match) return null;
1184
+ const choice = match[1].toLowerCase();
1185
+ if (["a", "an", "the", "this", "that", "it"].includes(choice)) return null;
1186
+ return { choice, context: match[2].trim().toLowerCase() };
1170
1187
  }
1171
1188
  function wordOverlap(a, b) {
1172
1189
  const wordsA = new Set(a.toLowerCase().split(/\s+/).filter((w) => w.length > 2));
@@ -1581,6 +1598,16 @@ var VERB_HINTS = [
1581
1598
  "receive",
1582
1599
  "treat",
1583
1600
  "propose",
1601
+ "capture",
1602
+ "record",
1603
+ "report",
1604
+ "preserve",
1605
+ "inspect",
1606
+ "challenge",
1607
+ "invoke",
1608
+ "dispatch",
1609
+ "rerun",
1610
+ "cancel",
1584
1611
  "configure",
1585
1612
  "enable",
1586
1613
  "disable"
@@ -1611,7 +1638,7 @@ var ACTIVE_FRAGMENT_REASONS = /* @__PURE__ */ new Set([
1611
1638
  "e2e_verification_artifact",
1612
1639
  "embedded_question"
1613
1640
  ]);
1614
- var MAX_RULE_LENGTH = 300;
1641
+ var MAX_RULE_LENGTH = 500;
1615
1642
  var MIN_RULE_LENGTH = 20;
1616
1643
  function planRejectFragments(db) {
1617
1644
  const rows = db.select({
@@ -3858,4 +3885,4 @@ export {
3858
3885
  processCorrection,
3859
3886
  processReviewFeedback
3860
3887
  };
3861
- //# sourceMappingURL=chunk-5K2LTXNW.js.map
3888
+ //# sourceMappingURL=chunk-G6YAXFT4.js.map