@edihasaj/recall 1.4.14 → 1.4.15

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 (73) hide show
  1. package/dist/{chunk-XCFTE74H.js → chunk-2E7UCWNS.js} +2 -2
  2. package/dist/{chunk-CYAODQOH.js → chunk-5W3CDNJ6.js} +2 -2
  3. package/dist/{chunk-CYAODQOH.js.map → chunk-5W3CDNJ6.js.map} +1 -1
  4. package/dist/{chunk-AQOI4FCW.js → chunk-ADWOKDF6.js} +2 -2
  5. package/dist/{chunk-RWEX4VJE.js → chunk-FDIV6YFT.js} +3 -3
  6. package/dist/{chunk-22KM2YEO.js → chunk-GMRT5DJZ.js} +3 -3
  7. package/dist/{chunk-47CB7PKL.js → chunk-IMCI2CLJ.js} +2 -2
  8. package/dist/{chunk-BWKFROGW.js → chunk-KF3EGZWM.js} +4 -4
  9. package/dist/{chunk-HFHNPOBW.js → chunk-LCIVSUQO.js} +7 -7
  10. package/dist/{chunk-DJNJQA7L.js → chunk-MESKBXZZ.js} +5 -5
  11. package/dist/{chunk-7Z3CCCS2.js → chunk-PQOGHXET.js} +2 -2
  12. package/dist/{chunk-HRUNR5JJ.js → chunk-RRNELZJV.js} +7 -7
  13. package/dist/{chunk-JFUMA4WV.js → chunk-SWPXUPMX.js} +10 -10
  14. package/dist/{chunk-GGUWKT6I.js → chunk-TZ4EU4SW.js} +9 -9
  15. package/dist/{chunk-Q2KCBLJO.js → chunk-UTOM43G2.js} +3 -3
  16. package/dist/{chunk-KOBZIF2X.js → chunk-UZ4GFLH6.js} +5 -5
  17. package/dist/{chunk-VSEAVK7X.js → chunk-VI6NOUXB.js} +2 -2
  18. package/dist/{chunk-HUMJTWWT.js → chunk-VZ456OCO.js} +173 -11
  19. package/dist/chunk-VZ456OCO.js.map +1 -0
  20. package/dist/{chunk-M3ASNCVM.js → chunk-ZECQ2LQB.js} +178 -24
  21. package/dist/chunk-ZECQ2LQB.js.map +1 -0
  22. package/dist/{cleanup-YCYA6BJB.js → cleanup-KXCEVJ7V.js} +11 -11
  23. package/dist/cli.js +36 -36
  24. package/dist/{codex-trust-Z7LNNRVT.js → codex-trust-H7VKP4G3.js} +4 -4
  25. package/dist/daemon.js +17 -17
  26. package/dist/dispatcher-GHC6RX54.js +22 -0
  27. package/dist/{embeddings-VZPCFCEY.js → embeddings-GYQBZWBD.js} +5 -5
  28. package/dist/ingest-6GDZNYCY.js +20 -0
  29. package/dist/{keychain-2PXI2EGF.js → keychain-TKPVUZCH.js} +3 -3
  30. package/dist/mcp.js +15 -15
  31. package/dist/{memory-value-XSPRH6KY.js → memory-value-A4UCC3DY.js} +11 -11
  32. package/dist/{provenance-GJR7S7VA.js → provenance-M5YFD6DO.js} +9 -9
  33. package/dist/quality-TQ7CVPRO.js +25 -0
  34. package/dist/retrieval-7R5LKJAM.js +15 -0
  35. package/dist/{store-HIM5US7B.js → store-QKP6HQ45.js} +4 -4
  36. package/dist/sync-server.js +2 -2
  37. package/dist/{tasks-TAXJSUKB.js → tasks-M5HSQSWK.js} +11 -11
  38. package/dist/{usage-XMYRFJBJ.js → usage-TQTOHPL7.js} +4 -4
  39. package/package.json +1 -1
  40. package/dist/chunk-HUMJTWWT.js.map +0 -1
  41. package/dist/chunk-M3ASNCVM.js.map +0 -1
  42. package/dist/dispatcher-FP3WS74F.js +0 -22
  43. package/dist/ingest-QEKMNVL7.js +0 -20
  44. package/dist/quality-TWOC3UMF.js +0 -25
  45. package/dist/retrieval-RW6YBQ6P.js +0 -15
  46. /package/dist/{chunk-XCFTE74H.js.map → chunk-2E7UCWNS.js.map} +0 -0
  47. /package/dist/{chunk-AQOI4FCW.js.map → chunk-ADWOKDF6.js.map} +0 -0
  48. /package/dist/{chunk-RWEX4VJE.js.map → chunk-FDIV6YFT.js.map} +0 -0
  49. /package/dist/{chunk-22KM2YEO.js.map → chunk-GMRT5DJZ.js.map} +0 -0
  50. /package/dist/{chunk-47CB7PKL.js.map → chunk-IMCI2CLJ.js.map} +0 -0
  51. /package/dist/{chunk-BWKFROGW.js.map → chunk-KF3EGZWM.js.map} +0 -0
  52. /package/dist/{chunk-HFHNPOBW.js.map → chunk-LCIVSUQO.js.map} +0 -0
  53. /package/dist/{chunk-DJNJQA7L.js.map → chunk-MESKBXZZ.js.map} +0 -0
  54. /package/dist/{chunk-7Z3CCCS2.js.map → chunk-PQOGHXET.js.map} +0 -0
  55. /package/dist/{chunk-HRUNR5JJ.js.map → chunk-RRNELZJV.js.map} +0 -0
  56. /package/dist/{chunk-JFUMA4WV.js.map → chunk-SWPXUPMX.js.map} +0 -0
  57. /package/dist/{chunk-GGUWKT6I.js.map → chunk-TZ4EU4SW.js.map} +0 -0
  58. /package/dist/{chunk-Q2KCBLJO.js.map → chunk-UTOM43G2.js.map} +0 -0
  59. /package/dist/{chunk-KOBZIF2X.js.map → chunk-UZ4GFLH6.js.map} +0 -0
  60. /package/dist/{chunk-VSEAVK7X.js.map → chunk-VI6NOUXB.js.map} +0 -0
  61. /package/dist/{cleanup-YCYA6BJB.js.map → cleanup-KXCEVJ7V.js.map} +0 -0
  62. /package/dist/{codex-trust-Z7LNNRVT.js.map → codex-trust-H7VKP4G3.js.map} +0 -0
  63. /package/dist/{dispatcher-FP3WS74F.js.map → dispatcher-GHC6RX54.js.map} +0 -0
  64. /package/dist/{embeddings-VZPCFCEY.js.map → embeddings-GYQBZWBD.js.map} +0 -0
  65. /package/dist/{ingest-QEKMNVL7.js.map → ingest-6GDZNYCY.js.map} +0 -0
  66. /package/dist/{keychain-2PXI2EGF.js.map → keychain-TKPVUZCH.js.map} +0 -0
  67. /package/dist/{memory-value-XSPRH6KY.js.map → memory-value-A4UCC3DY.js.map} +0 -0
  68. /package/dist/{provenance-GJR7S7VA.js.map → provenance-M5YFD6DO.js.map} +0 -0
  69. /package/dist/{quality-TWOC3UMF.js.map → quality-TQ7CVPRO.js.map} +0 -0
  70. /package/dist/{retrieval-RW6YBQ6P.js.map → retrieval-7R5LKJAM.js.map} +0 -0
  71. /package/dist/{store-HIM5US7B.js.map → store-QKP6HQ45.js.map} +0 -0
  72. /package/dist/{tasks-TAXJSUKB.js.map → tasks-M5HSQSWK.js.map} +0 -0
  73. /package/dist/{usage-XMYRFJBJ.js.map → usage-TQTOHPL7.js.map} +0 -0
@@ -1,4 +1,5 @@
1
1
  import {
2
+ applySupersession,
2
3
  computeHealthScore,
3
4
  evaluateScannedMemory,
4
5
  getRepoQualityProfile,
@@ -8,16 +9,16 @@ import {
8
9
  processCorrection,
9
10
  redactSensitiveValue,
10
11
  seedScannedConfidence
11
- } from "./chunk-HUMJTWWT.js";
12
+ } from "./chunk-VZ456OCO.js";
12
13
  import {
13
14
  recordInjectionValueEvents,
14
15
  recordMemoryInjections,
15
16
  recordOutcomeValueEvent,
16
17
  resolveMemoryInjectionOutcome
17
- } from "./chunk-HRUNR5JJ.js";
18
+ } from "./chunk-RRNELZJV.js";
18
19
  import {
19
20
  textMatchScore
20
- } from "./chunk-7Z3CCCS2.js";
21
+ } from "./chunk-PQOGHXET.js";
21
22
  import {
22
23
  activityEventDedupeKey,
23
24
  confirmMemory,
@@ -36,11 +37,11 @@ import {
36
37
  recordFeedback,
37
38
  rejectMemory,
38
39
  statusFromConfidence
39
- } from "./chunk-HFHNPOBW.js";
40
+ } from "./chunk-LCIVSUQO.js";
40
41
  import {
41
42
  asc,
42
43
  desc
43
- } from "./chunk-RWEX4VJE.js";
44
+ } from "./chunk-FDIV6YFT.js";
44
45
  import {
45
46
  BACKGROUND_INDEX_BATCH_SIZE,
46
47
  CONFIDENCE,
@@ -61,7 +62,7 @@ import {
61
62
  readUtf8FileIfExists,
62
63
  resolveProvider,
63
64
  tagActivitySource
64
- } from "./chunk-BWKFROGW.js";
65
+ } from "./chunk-KF3EGZWM.js";
65
66
  import {
66
67
  Column,
67
68
  Columns,
@@ -125,10 +126,10 @@ import {
125
126
  policyRules,
126
127
  schema_exports,
127
128
  sql
128
- } from "./chunk-VSEAVK7X.js";
129
+ } from "./chunk-VI6NOUXB.js";
129
130
  import {
130
131
  init_define_RECALL_BUILD_INFO
131
- } from "./chunk-CYAODQOH.js";
132
+ } from "./chunk-5W3CDNJ6.js";
132
133
 
133
134
  // src/db/client.ts
134
135
  init_define_RECALL_BUILD_INFO();
@@ -3889,10 +3890,11 @@ function scanRepo(repoPath) {
3889
3890
  candidates.push(...scanPythonProject(repoPath, repoName));
3890
3891
  return { candidates, repo: repoName };
3891
3892
  }
3892
- function scanAndStore(db, repoPath) {
3893
- const { candidates, repo } = scanRepo(repoPath);
3893
+ function scanAndStore(db, repoPath, scan = scanRepo(repoPath)) {
3894
+ const { candidates, repo } = scan;
3894
3895
  const profile = getRepoQualityProfile(db, repo);
3895
3896
  const existing = queryMemories(db, { repo }).filter((mem) => mem.status !== "rejected");
3897
+ const declined = declinedScanTexts(db, repo);
3896
3898
  const ids = [];
3897
3899
  for (const candidate of candidates) {
3898
3900
  const evaluated = evaluateScannedMemory({
@@ -3907,6 +3909,7 @@ function scanAndStore(db, repoPath) {
3907
3909
  if (evaluated.action === "reject") {
3908
3910
  continue;
3909
3911
  }
3912
+ if (declined.has(evaluated.text)) continue;
3910
3913
  const seededConfidence = evaluated.confidence;
3911
3914
  const normalizedCandidate = {
3912
3915
  ...candidate,
@@ -3931,14 +3934,154 @@ function scanAndStore(db, repoPath) {
3931
3934
  normalizedCandidate.confidence = seededConfidence;
3932
3935
  const id = createMemory(db, normalizedCandidate);
3933
3936
  ids.push(id);
3937
+ applySupersession(db, id);
3934
3938
  existing.push({
3935
3939
  ...queryMemories(db, { repo }).find((mem) => mem.id === id),
3936
3940
  confidence: seededConfidence,
3937
3941
  status: statusFromConfidence(seededConfidence)
3938
3942
  });
3939
3943
  }
3944
+ retractUnsupportedScanFacts(db, repoPath, repo, candidates);
3940
3945
  return ids;
3941
3946
  }
3947
+ function derivedScan(scan) {
3948
+ return {
3949
+ ...scan,
3950
+ candidates: scan.candidates.filter((candidate) => !(candidate.evidence ?? []).some((entry) => "file" in entry && INSTRUCTION_FILES.includes(String(entry.file))))
3951
+ };
3952
+ }
3953
+ function declinedScanTexts(db, repo) {
3954
+ const rejected = db.select({ id: memories.id, text: memories.text }).from(memories).where(and(
3955
+ eq(memories.repo, repo),
3956
+ eq(memories.status, "rejected"),
3957
+ inArray(memories.source, ["repo_scan", "config_parse"])
3958
+ )).all();
3959
+ if (rejected.length === 0) return /* @__PURE__ */ new Set();
3960
+ const retracted = new Set(
3961
+ db.select({ id: auditTrail.memory_id }).from(auditTrail).where(and(
3962
+ inArray(auditTrail.memory_id, rejected.map((row) => row.id)),
3963
+ eq(auditTrail.actor, "scan_retraction")
3964
+ )).all().map((row) => row.id)
3965
+ );
3966
+ return new Set(rejected.filter((row) => !retracted.has(row.id)).map((row) => row.text));
3967
+ }
3968
+ function scanDiffersFromStore(db, scan) {
3969
+ const live = new Set(
3970
+ db.select({ text: memories.text }).from(memories).where(and(
3971
+ eq(memories.repo, scan.repo),
3972
+ inArray(memories.status, ["active", "candidate"]),
3973
+ inArray(memories.source, ["repo_scan", "config_parse"])
3974
+ )).all().map((row) => row.text)
3975
+ );
3976
+ const declined = declinedScanTexts(db, scan.repo);
3977
+ const produced = /* @__PURE__ */ new Set();
3978
+ for (const candidate of scan.candidates) {
3979
+ produced.add(candidate.text);
3980
+ const evaluated = evaluateScannedMemory({
3981
+ text: candidate.text,
3982
+ type: candidate.type,
3983
+ source: candidate.source,
3984
+ confidence: candidate.confidence ?? 0.5
3985
+ });
3986
+ if (evaluated.action === "reject") continue;
3987
+ produced.add(evaluated.text);
3988
+ if (declined.has(evaluated.text)) continue;
3989
+ if (!live.has(evaluated.text) && !live.has(candidate.text)) return true;
3990
+ }
3991
+ for (const text of live) {
3992
+ if (!produced.has(text) && SCAN_TEMPLATES.some((template) => template.test(text))) return true;
3993
+ }
3994
+ return false;
3995
+ }
3996
+ var SCAN_SOURCES = /* @__PURE__ */ new Set(["repo_scan", "config_parse"]);
3997
+ var SCAN_TEMPLATES = [
3998
+ /^Use (?:npm|pnpm|yarn|bun) as the package manager(?: \(lockfile: [\w.-]+\))?$/,
3999
+ /^(?:test|build|lint|dev|start|typecheck|check): `[^`]*`$/,
4000
+ /^Makefile targets: /,
4001
+ /^CI: /,
4002
+ /^(?:Next\.js|Vue\.js|Svelte) project$/,
4003
+ /^React project \(no Next\.js\)$/,
4004
+ /^Server framework: \w+$/,
4005
+ /^Linting\/formatting: /,
4006
+ /^Setup commands from README:/,
4007
+ /^Use `(?:uv|poetry)` for Python dependency management$/,
4008
+ /^Uses Alembic for database migrations$/
4009
+ ];
4010
+ var HUMAN_TOUCH_ACTIONS = ["confirmed", "edited", "reactivated", "rolled_back"];
4011
+ function retractUnsupportedScanFacts(db, repoPath, repo, candidates) {
4012
+ const supported = /* @__PURE__ */ new Set();
4013
+ for (const candidate of candidates) {
4014
+ supported.add(candidate.text);
4015
+ const evaluated = evaluateScannedMemory({
4016
+ text: candidate.text,
4017
+ type: candidate.type,
4018
+ source: candidate.source,
4019
+ confidence: candidate.confidence ?? 0.5
4020
+ });
4021
+ supported.add(evaluated.text);
4022
+ }
4023
+ const packageJsonBroken = isUnparseableJson(join2(repoPath, "package.json"));
4024
+ const producedManager = candidates.some((candidate) => /^Use (?:npm|pnpm|yarn|bun) as the package manager/.test(candidate.text));
4025
+ const retracted = [];
4026
+ for (const mem of queryMemories(db, { repo })) {
4027
+ if (mem.status !== "active" && mem.status !== "candidate") continue;
4028
+ if (!SCAN_SOURCES.has(mem.source) || mem.scope !== "repo") continue;
4029
+ if (supported.has(mem.text)) continue;
4030
+ if (!SCAN_TEMPLATES.some((template) => template.test(mem.text))) continue;
4031
+ const named = mem.text.match(/^Use (npm|pnpm|yarn|bun) as the package manager/)?.[1];
4032
+ if (named && !producedManager && LOCKFILES.some(([manager, file]) => manager === named && existsSync2(join2(repoPath, file)))) continue;
4033
+ if (mem.evidence.length === 0 || mem.evidence.some((e) => e.type !== "repo_scan")) continue;
4034
+ const files = new Set(mem.evidence.map((e) => "file" in e ? String(e.file ?? "") : ""));
4035
+ if (packageJsonBroken && files.has("package.json")) continue;
4036
+ if ([...files].some((file) => INSTRUCTION_FILES.includes(file))) continue;
4037
+ const touched = db.select({ id: auditTrail.id }).from(auditTrail).where(and(eq(auditTrail.memory_id, mem.id), inArray(auditTrail.action, [...HUMAN_TOUCH_ACTIONS]))).get();
4038
+ if (touched) continue;
4039
+ rejectMemory(db, mem.id, "scan_retraction");
4040
+ recordAudit(
4041
+ db,
4042
+ mem.id,
4043
+ "pruned",
4044
+ "scan_retraction",
4045
+ `no longer found by repo scan in ${[...files].filter(Boolean).join(", ") || "repo files"}`
4046
+ );
4047
+ retracted.push(mem.id);
4048
+ }
4049
+ return retracted;
4050
+ }
4051
+ var LOCKFILES = [
4052
+ ["pnpm", "pnpm-lock.yaml"],
4053
+ ["yarn", "yarn.lock"],
4054
+ ["bun", "bun.lockb"],
4055
+ ["bun", "bun.lock"],
4056
+ ["npm", "package-lock.json"]
4057
+ ];
4058
+ function lockfileManager(repoPath) {
4059
+ const present = LOCKFILES.filter(([, file]) => existsSync2(join2(repoPath, file)));
4060
+ const managers = (files) => [...new Set(files.map(([manager]) => manager))];
4061
+ if (managers(present).length <= 1) return managers(present)[0] ?? null;
4062
+ let tracked;
4063
+ try {
4064
+ tracked = new Set(execFileSync("git", ["ls-files", "--", ...present.map(([, file]) => file)], {
4065
+ cwd: repoPath,
4066
+ encoding: "utf-8",
4067
+ stdio: ["ignore", "pipe", "ignore"]
4068
+ }).split("\n").filter(Boolean));
4069
+ } catch {
4070
+ return null;
4071
+ }
4072
+ const trackedManagers = managers(present.filter(([, file]) => tracked.has(file)));
4073
+ return trackedManagers.length === 1 ? trackedManagers[0] : null;
4074
+ }
4075
+ function isUnparseableJson(path) {
4076
+ try {
4077
+ const raw = readUtf8FileIfExists(path);
4078
+ if (raw === null) return false;
4079
+ JSON.parse(raw);
4080
+ return false;
4081
+ } catch {
4082
+ return true;
4083
+ }
4084
+ }
3942
4085
  function scanPackageJson(repoPath, repo) {
3943
4086
  const pkgPath = join2(repoPath, "package.json");
3944
4087
  const results = [];
@@ -3953,12 +4096,9 @@ function scanPackageJson(repoPath, repo) {
3953
4096
  repo,
3954
4097
  "package.json"
3955
4098
  ));
3956
- } else if (existsSync2(join2(repoPath, "pnpm-lock.yaml"))) {
3957
- results.push(makeCommand("Use pnpm as the package manager", repo, "package.json"));
3958
- } else if (existsSync2(join2(repoPath, "yarn.lock"))) {
3959
- results.push(makeCommand("Use yarn as the package manager", repo, "package.json"));
3960
- } else if (existsSync2(join2(repoPath, "bun.lockb")) || existsSync2(join2(repoPath, "bun.lock"))) {
3961
- results.push(makeCommand("Use bun as the package manager", repo, "package.json"));
4099
+ } else {
4100
+ const manager = lockfileManager(repoPath);
4101
+ if (manager) results.push(makeCommand(`Use ${manager} as the package manager`, repo, "package.json"));
3962
4102
  }
3963
4103
  const scripts = pkg.scripts ?? {};
3964
4104
  const importantScripts = ["test", "build", "lint", "dev", "start", "typecheck", "check"];
@@ -4037,15 +4177,15 @@ function scanCIConfig(repoPath, repo) {
4037
4177
  }
4038
4178
  return results;
4039
4179
  }
4180
+ var INSTRUCTION_FILES = [
4181
+ "CLAUDE.md",
4182
+ "AGENTS.md",
4183
+ ".github/copilot-instructions.md",
4184
+ ".cursorrules"
4185
+ ];
4040
4186
  function scanInstructionFiles(repoPath, repo) {
4041
4187
  const results = [];
4042
- const instructionFiles = [
4043
- "CLAUDE.md",
4044
- "AGENTS.md",
4045
- ".github/copilot-instructions.md",
4046
- ".cursorrules"
4047
- ];
4048
- for (const file of instructionFiles) {
4188
+ for (const file of INSTRUCTION_FILES) {
4049
4189
  const fPath = join2(repoPath, file);
4050
4190
  try {
4051
4191
  const content = readUtf8FileIfExists(fPath);
@@ -4299,6 +4439,14 @@ function resolveLocalRepoPath(repo, opts = {}) {
4299
4439
  repoPathCache.set(normalizedRepo, fallback);
4300
4440
  return fallback;
4301
4441
  }
4442
+ function refreshKnownRepoScan(db, repo, repoPathHint) {
4443
+ const normalizedRepo = normalizeRepoSlug(repo);
4444
+ const root = normalizeRepoPathHint(repoPathHint);
4445
+ if (!normalizedRepo || !root || !pathMatchesRepo(root, normalizedRepo)) return null;
4446
+ const scan = derivedScan(scanRepo(root));
4447
+ if (!scanDiffersFromStore(db, scan)) return { repo_path: root, ids: [] };
4448
+ return { repo_path: root, ids: scanAndStore(db, root, scan) };
4449
+ }
4302
4450
  function inferRepoSlugFromPath(repoPath) {
4303
4451
  const root = normalizeRepoPathHint(repoPath);
4304
4452
  if (!root) return null;
@@ -5708,6 +5856,12 @@ function startSessionLifecycle(db, input) {
5708
5856
  }
5709
5857
  });
5710
5858
  }
5859
+ if (bootstrap.status === "already_known" && bootstrap.repo && input.repo_path) {
5860
+ try {
5861
+ refreshKnownRepoScan(db, bootstrap.repo, input.repo_path);
5862
+ } catch {
5863
+ }
5864
+ }
5711
5865
  const artifact = writeRepoContextArtifact(db, {
5712
5866
  repo: bootstrap.repo,
5713
5867
  repo_path: bootstrap.repo_path ?? input.repo_path ?? null
@@ -6852,4 +7006,4 @@ export {
6852
7006
  pruneMemories,
6853
7007
  formatPruneReport
6854
7008
  };
6855
- //# sourceMappingURL=chunk-M3ASNCVM.js.map
7009
+ //# sourceMappingURL=chunk-ZECQ2LQB.js.map