@edihasaj/recall 0.8.19 → 0.9.0

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 (71) hide show
  1. package/README.md +13 -0
  2. package/dist/{chunk-6I5U6KS3.js → chunk-5K2LTXNW.js} +17 -15
  3. package/dist/chunk-5K2LTXNW.js.map +1 -0
  4. package/dist/{chunk-O4KCMCJG.js → chunk-A27AP4NR.js} +21 -6
  5. package/dist/chunk-A27AP4NR.js.map +1 -0
  6. package/dist/{chunk-VT5VAEHY.js → chunk-CW3XJDH7.js} +2 -2
  7. package/dist/{chunk-K6AFGQWR.js → chunk-DRAOZ2RN.js} +4 -4
  8. package/dist/{chunk-M7OKBKKU.js → chunk-EAFRT7RX.js} +2 -2
  9. package/dist/{chunk-ZBIJDXA7.js → chunk-FPZ3GBXP.js} +5 -5
  10. package/dist/{chunk-4CV4JOE5.js → chunk-JYWURG5T.js} +8 -3
  11. package/dist/{chunk-55KCGAOX.js → chunk-LUIYWYOT.js} +2 -2
  12. package/dist/{chunk-S7FJMV5O.js → chunk-OADI5XD2.js} +8 -8
  13. package/dist/{chunk-KG7YFARS.js → chunk-PQJRYAVG.js} +92 -14
  14. package/dist/chunk-PQJRYAVG.js.map +1 -0
  15. package/dist/{chunk-QKN6IWJ3.js → chunk-SISLEKTR.js} +54 -68
  16. package/dist/chunk-SISLEKTR.js.map +1 -0
  17. package/dist/{chunk-DNFKAHS6.js → chunk-VYZSP23L.js} +95 -12
  18. package/dist/chunk-VYZSP23L.js.map +1 -0
  19. package/dist/{chunk-3Z6XZX7N.js → chunk-XRWHIL74.js} +76 -20
  20. package/dist/chunk-XRWHIL74.js.map +1 -0
  21. package/dist/{chunk-NAYZL5XI.js → chunk-YDSCPOIJ.js} +4 -4
  22. package/dist/{cleanup-HWQCVPY4.js → cleanup-3JDS7MHX.js} +9 -9
  23. package/dist/cli.js +950 -161
  24. package/dist/cli.js.map +1 -1
  25. package/dist/daemon.js +112 -56
  26. package/dist/daemon.js.map +1 -1
  27. package/dist/dispatcher-LV6WGHR2.js +20 -0
  28. package/dist/{embeddings-LNMNKWB7.js → embeddings-E362AC3R.js} +5 -5
  29. package/dist/ingest-7FAOX7YV.js +18 -0
  30. package/dist/{keychain-5QG52ANO.js → keychain-PWFWKTZW.js} +3 -3
  31. package/dist/mcp.js +12 -12
  32. package/dist/{memory-value-GH67CBQP.js → memory-value-V4MH2DYO.js} +9 -9
  33. package/dist/quality-5SB4S5G2.js +23 -0
  34. package/dist/retrieval-YU2PLBUS.js +13 -0
  35. package/dist/{store-OPRTGS73.js → store-5C7ZKKZF.js} +4 -4
  36. package/dist/sync-server.js +1 -1
  37. package/dist/{tasks-LOZ7XWON.js → tasks-DT6QPIKV.js} +9 -9
  38. package/dist/{usage-CAAACLUR.js → usage-VQ5LJCNH.js} +4 -4
  39. package/dist/webui/assets/{index-BODg2A9d.js → index-DAoAhOb4.js} +244 -244
  40. package/dist/webui/assets/{index-BODg2A9d.js.map → index-DAoAhOb4.js.map} +1 -1
  41. package/dist/webui/index.html +1 -1
  42. package/package.json +34 -2
  43. package/dist/chunk-3Z6XZX7N.js.map +0 -1
  44. package/dist/chunk-6I5U6KS3.js.map +0 -1
  45. package/dist/chunk-DNFKAHS6.js.map +0 -1
  46. package/dist/chunk-KG7YFARS.js.map +0 -1
  47. package/dist/chunk-O4KCMCJG.js.map +0 -1
  48. package/dist/chunk-QKN6IWJ3.js.map +0 -1
  49. package/dist/dispatcher-RU25CZK3.js +0 -20
  50. package/dist/ingest-QSOE5XJZ.js +0 -18
  51. package/dist/quality-PZ36JND4.js +0 -23
  52. package/dist/retrieval-HIE5MASN.js +0 -13
  53. /package/dist/{chunk-VT5VAEHY.js.map → chunk-CW3XJDH7.js.map} +0 -0
  54. /package/dist/{chunk-K6AFGQWR.js.map → chunk-DRAOZ2RN.js.map} +0 -0
  55. /package/dist/{chunk-M7OKBKKU.js.map → chunk-EAFRT7RX.js.map} +0 -0
  56. /package/dist/{chunk-ZBIJDXA7.js.map → chunk-FPZ3GBXP.js.map} +0 -0
  57. /package/dist/{chunk-4CV4JOE5.js.map → chunk-JYWURG5T.js.map} +0 -0
  58. /package/dist/{chunk-55KCGAOX.js.map → chunk-LUIYWYOT.js.map} +0 -0
  59. /package/dist/{chunk-S7FJMV5O.js.map → chunk-OADI5XD2.js.map} +0 -0
  60. /package/dist/{chunk-NAYZL5XI.js.map → chunk-YDSCPOIJ.js.map} +0 -0
  61. /package/dist/{cleanup-HWQCVPY4.js.map → cleanup-3JDS7MHX.js.map} +0 -0
  62. /package/dist/{dispatcher-RU25CZK3.js.map → dispatcher-LV6WGHR2.js.map} +0 -0
  63. /package/dist/{embeddings-LNMNKWB7.js.map → embeddings-E362AC3R.js.map} +0 -0
  64. /package/dist/{ingest-QSOE5XJZ.js.map → ingest-7FAOX7YV.js.map} +0 -0
  65. /package/dist/{keychain-5QG52ANO.js.map → keychain-PWFWKTZW.js.map} +0 -0
  66. /package/dist/{memory-value-GH67CBQP.js.map → memory-value-V4MH2DYO.js.map} +0 -0
  67. /package/dist/{quality-PZ36JND4.js.map → quality-5SB4S5G2.js.map} +0 -0
  68. /package/dist/{retrieval-HIE5MASN.js.map → retrieval-YU2PLBUS.js.map} +0 -0
  69. /package/dist/{store-OPRTGS73.js.map → store-5C7ZKKZF.js.map} +0 -0
  70. /package/dist/{tasks-LOZ7XWON.js.map → tasks-DT6QPIKV.js.map} +0 -0
  71. /package/dist/{usage-CAAACLUR.js.map → usage-VQ5LJCNH.js.map} +0 -0
@@ -6,18 +6,18 @@ import {
6
6
  recordAudit,
7
7
  redactSensitiveValue,
8
8
  seedScannedConfidence
9
- } from "./chunk-6I5U6KS3.js";
9
+ } from "./chunk-5K2LTXNW.js";
10
10
  import {
11
11
  recordInjectionValueEvents,
12
12
  recordMemoryInjections,
13
13
  recordOutcomeValueEvent,
14
14
  resolveMemoryInjectionOutcome,
15
15
  textMatchScore
16
- } from "./chunk-ZBIJDXA7.js";
16
+ } from "./chunk-FPZ3GBXP.js";
17
17
  import {
18
18
  asc,
19
19
  desc
20
- } from "./chunk-VT5VAEHY.js";
20
+ } from "./chunk-CW3XJDH7.js";
21
21
  import {
22
22
  activityEventDedupeKey,
23
23
  confirmMemory,
@@ -32,11 +32,12 @@ import {
32
32
  recordFeedback,
33
33
  rejectMemory,
34
34
  statusFromConfidence
35
- } from "./chunk-O4KCMCJG.js";
35
+ } from "./chunk-A27AP4NR.js";
36
36
  import {
37
37
  CONFIDENCE,
38
38
  RetrievalEvalCase,
39
39
  RetrievalEvalFile,
40
+ atomicWriteUtf8File,
40
41
  bootstrapEmbeddings,
41
42
  generateEmbedding,
42
43
  generateEmbeddings,
@@ -46,9 +47,10 @@ import {
46
47
  loadEmbeddingConfigFromEnv,
47
48
  projectEmbeddingToIndex,
48
49
  queueMemoryEmbeddingSync,
50
+ readUtf8FileIfExists,
49
51
  resolveProvider,
50
52
  tagActivitySource
51
- } from "./chunk-KG7YFARS.js";
53
+ } from "./chunk-PQJRYAVG.js";
52
54
  import {
53
55
  Column,
54
56
  Columns,
@@ -110,7 +112,7 @@ import {
110
112
  policyRules,
111
113
  schema_exports,
112
114
  sql
113
- } from "./chunk-55KCGAOX.js";
115
+ } from "./chunk-LUIYWYOT.js";
114
116
 
115
117
  // src/db/client.ts
116
118
  import Database from "better-sqlite3";
@@ -3785,9 +3787,9 @@ function rowToActivityEvent(row) {
3785
3787
  }
3786
3788
 
3787
3789
  // src/scanner/repo.ts
3788
- import { readFileSync, existsSync as existsSync2 } from "fs";
3790
+ import { existsSync as existsSync2 } from "fs";
3789
3791
  import { join as join2, basename } from "path";
3790
- import { execSync } from "child_process";
3792
+ import { execFileSync } from "child_process";
3791
3793
  function scanRepo(repoPath) {
3792
3794
  const repoName = inferRepoName(repoPath);
3793
3795
  const candidates = [];
@@ -3852,10 +3854,11 @@ function scanAndStore(db, repoPath) {
3852
3854
  }
3853
3855
  function scanPackageJson(repoPath, repo) {
3854
3856
  const pkgPath = join2(repoPath, "package.json");
3855
- if (!existsSync2(pkgPath)) return [];
3856
3857
  const results = [];
3857
3858
  try {
3858
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
3859
+ const raw = readUtf8FileIfExists(pkgPath);
3860
+ if (raw === null) return [];
3861
+ const pkg = JSON.parse(raw);
3859
3862
  if (pkg.packageManager) {
3860
3863
  const pm = pkg.packageManager.split("@")[0];
3861
3864
  results.push(makeCommand(
@@ -3903,10 +3906,10 @@ function scanPackageJson(repoPath, repo) {
3903
3906
  }
3904
3907
  function scanMakefile(repoPath, repo) {
3905
3908
  const mkPath = join2(repoPath, "Makefile");
3906
- if (!existsSync2(mkPath)) return [];
3907
3909
  const results = [];
3908
3910
  try {
3909
- const content = readFileSync(mkPath, "utf-8");
3911
+ const content = readUtf8FileIfExists(mkPath);
3912
+ if (content === null) return [];
3910
3913
  const targets = content.match(/^([a-zA-Z_-]+):/gm);
3911
3914
  if (targets) {
3912
3915
  const key = targets.map((t) => t.replace(":", "")).filter(
@@ -3957,9 +3960,9 @@ function scanInstructionFiles(repoPath, repo) {
3957
3960
  ];
3958
3961
  for (const file of instructionFiles) {
3959
3962
  const fPath = join2(repoPath, file);
3960
- if (!existsSync2(fPath)) continue;
3961
3963
  try {
3962
- const content = readFileSync(fPath, "utf-8");
3964
+ const content = readUtf8FileIfExists(fPath);
3965
+ if (content === null) continue;
3963
3966
  const rules = content.split("\n").filter(
3964
3967
  (line) => /\b(always|never|must|don't|do not|required|forbidden)\b/i.test(line)
3965
3968
  ).map((l) => l.replace(/^[-*#>\s]+/, "").trim()).filter((l) => l.length > 10 && l.length < 200);
@@ -4018,9 +4021,9 @@ function scanLinterConfigs(repoPath, repo) {
4018
4021
  function scanReadme(repoPath, repo) {
4019
4022
  const results = [];
4020
4023
  const readmePath = join2(repoPath, "README.md");
4021
- if (!existsSync2(readmePath)) return [];
4022
4024
  try {
4023
- const content = readFileSync(readmePath, "utf-8");
4025
+ const content = readUtf8FileIfExists(readmePath);
4026
+ if (content === null) return [];
4024
4027
  const setupMatch = content.match(
4025
4028
  /^##\s*(setup|install|getting.started|quick.start|development)\s*\n([\s\S]*?)(?=^##\s|\z)/im
4026
4029
  );
@@ -4065,7 +4068,7 @@ function now() {
4065
4068
  }
4066
4069
  function inferRepoName(repoPath) {
4067
4070
  try {
4068
- const remote = execSync("git remote get-url origin", {
4071
+ const remote = execFileSync("git", ["remote", "get-url", "origin"], {
4069
4072
  cwd: repoPath,
4070
4073
  encoding: "utf-8",
4071
4074
  stdio: ["pipe", "pipe", "pipe"]
@@ -4107,7 +4110,7 @@ function makeGotcha(text, repo, file) {
4107
4110
 
4108
4111
  // src/repo/discovery.ts
4109
4112
  import { existsSync as existsSync3, readdirSync } from "fs";
4110
- import { execFileSync } from "child_process";
4113
+ import { execFileSync as execFileSync2 } from "child_process";
4111
4114
  import { join as join3, resolve } from "path";
4112
4115
  var repoPathCache = /* @__PURE__ */ new Map();
4113
4116
  var SKIP_DIRS = /* @__PURE__ */ new Set([
@@ -4200,7 +4203,7 @@ function inferRepoSlugFromPath(repoPath) {
4200
4203
  const root = normalizeRepoPathHint(repoPath);
4201
4204
  if (!root) return null;
4202
4205
  try {
4203
- const remote = execFileSync(
4206
+ const remote = execFileSync2(
4204
4207
  "git",
4205
4208
  ["-C", root, "remote", "get-url", "origin"],
4206
4209
  { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
@@ -4232,7 +4235,7 @@ function normalizeRepoPathHint(repoPath) {
4232
4235
  if (!repoPath) return null;
4233
4236
  const expanded = repoPath.trim().replace(/^~(?=\/)/, process.env.HOME ?? "~");
4234
4237
  try {
4235
- const root = execFileSync(
4238
+ const root = execFileSync2(
4236
4239
  "git",
4237
4240
  ["-C", expanded, "rev-parse", "--show-toplevel"],
4238
4241
  { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
@@ -5321,9 +5324,9 @@ ${result.text}`;
5321
5324
  }
5322
5325
 
5323
5326
  // src/artifacts/context.ts
5324
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
5325
- import { join as join4 } from "path";
5326
- import { execFileSync as execFileSync2 } from "child_process";
5327
+ import { mkdirSync as mkdirSync2 } from "fs";
5328
+ import { isAbsolute, join as join4, resolve as resolve2 } from "path";
5329
+ import { execFileSync as execFileSync3 } from "child_process";
5327
5330
  function getRepoContextArtifactPath(repoPath) {
5328
5331
  return join4(repoPath, ".recall", "context.md");
5329
5332
  }
@@ -5359,9 +5362,9 @@ function writeRepoContextArtifact(db, input) {
5359
5362
  mkdirSync2(join4(repoPath, ".recall"), { recursive: true });
5360
5363
  ensureRepoContextExcluded(repoPath);
5361
5364
  const content = renderRepoContextArtifact(db, repo);
5362
- const existing = existsSync4(outputPath) ? readFileSync2(outputPath, "utf-8") : null;
5365
+ const existing = readUtf8FileIfExists(outputPath);
5363
5366
  if (existing !== content) {
5364
- writeFileSync(outputPath, content);
5367
+ atomicWriteUtf8File(outputPath, content);
5365
5368
  }
5366
5369
  return {
5367
5370
  repo,
@@ -5372,17 +5375,18 @@ function writeRepoContextArtifact(db, input) {
5372
5375
  }
5373
5376
  function ensureRepoContextExcluded(repoPath) {
5374
5377
  try {
5375
- const excludePath = execFileSync2(
5378
+ const excludePath = execFileSync3(
5376
5379
  "git",
5377
5380
  ["-C", repoPath, "rev-parse", "--git-path", "info/exclude"],
5378
5381
  { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
5379
5382
  ).trim();
5380
5383
  if (!excludePath) return;
5381
- const existing = existsSync4(excludePath) ? readFileSync2(excludePath, "utf-8") : "";
5384
+ const absoluteExcludePath = isAbsolute(excludePath) ? excludePath : resolve2(repoPath, excludePath);
5385
+ const existing = readUtf8FileIfExists(absoluteExcludePath) ?? "";
5382
5386
  if (existing.split("\n").some((line) => line.trim() === ".recall/")) return;
5383
5387
  const prefix = existing && !existing.endsWith("\n") ? "\n" : "";
5384
- writeFileSync(
5385
- excludePath,
5388
+ atomicWriteUtf8File(
5389
+ absoluteExcludePath,
5386
5390
  `${existing}${prefix}# Recall generated context
5387
5391
  .recall/
5388
5392
  `
@@ -5514,8 +5518,23 @@ function endEvalSession(db, sessionId) {
5514
5518
  db.update(evalSessions).set({ ended_at: (/* @__PURE__ */ new Date()).toISOString() }).where(eq(evalSessions.id, sessionId)).run();
5515
5519
  }
5516
5520
  function incrementEvalCounter(db, sessionId, field, amount = 1) {
5517
- const col = evalSessions[field];
5518
- db.update(evalSessions).set({ [field]: sql`${col} + ${amount}` }).where(eq(evalSessions.id, sessionId)).run();
5521
+ const update = (() => {
5522
+ switch (field) {
5523
+ case "memories_injected":
5524
+ return { memories_injected: sql`${evalSessions.memories_injected} + ${amount}` };
5525
+ case "memories_followed":
5526
+ return { memories_followed: sql`${evalSessions.memories_followed} + ${amount}` };
5527
+ case "memories_overridden":
5528
+ return { memories_overridden: sql`${evalSessions.memories_overridden} + ${amount}` };
5529
+ case "user_corrections":
5530
+ return { user_corrections: sql`${evalSessions.user_corrections} + ${amount}` };
5531
+ case "test_passes":
5532
+ return { test_passes: sql`${evalSessions.test_passes} + ${amount}` };
5533
+ case "test_failures":
5534
+ return { test_failures: sql`${evalSessions.test_failures} + ${amount}` };
5535
+ }
5536
+ })();
5537
+ db.update(evalSessions).set(update).where(eq(evalSessions.id, sessionId)).run();
5519
5538
  }
5520
5539
  function computeMetrics(db, options = {}) {
5521
5540
  const conditions = [];
@@ -5664,9 +5683,9 @@ function formatMetricsReport(metrics) {
5664
5683
  }
5665
5684
 
5666
5685
  // src/eval/retrieval.ts
5667
- import { readFileSync as readFileSync3 } from "fs";
5686
+ import { readFileSync } from "fs";
5668
5687
  function loadRetrievalEvalFile(path) {
5669
- return RetrievalEvalFile.parse(JSON.parse(readFileSync3(path, "utf8")));
5688
+ return RetrievalEvalFile.parse(JSON.parse(readFileSync(path, "utf8")));
5670
5689
  }
5671
5690
  async function runRetrievalEval(db, input, options = {}) {
5672
5691
  const providers = options.providers?.length ? options.providers : ["current"];
@@ -5979,7 +5998,7 @@ function embeddingConfigForProvider(provider) {
5979
5998
 
5980
5999
  // src/feedback/implicit.ts
5981
6000
  import { randomUUID as randomUUID5 } from "crypto";
5982
- import { execSync as execSync2 } from "child_process";
6001
+ import { execFileSync as execFileSync4 } from "child_process";
5983
6002
  var SIGNAL_WEIGHTS = {
5984
6003
  test_pass: 0.03,
5985
6004
  test_fail: -0.15,
@@ -6009,37 +6028,6 @@ function recordSignal(db, memoryId, sessionId, signalType, context) {
6009
6028
  function getSignals(db, memoryId) {
6010
6029
  return db.select().from(implicitSignals).where(eq(implicitSignals.memory_id, memoryId)).all();
6011
6030
  }
6012
- function runTests(repoPath, command) {
6013
- try {
6014
- const output = execSync2(command, {
6015
- cwd: repoPath,
6016
- encoding: "utf-8",
6017
- timeout: 12e4,
6018
- stdio: ["pipe", "pipe", "pipe"]
6019
- });
6020
- return { passed: true, output };
6021
- } catch (err) {
6022
- return {
6023
- passed: false,
6024
- output: err.stdout ?? err.stderr ?? err.message
6025
- };
6026
- }
6027
- }
6028
- function recordTestSignals(db, sessionId, injectedMemoryIds, testResult) {
6029
- const signalType = testResult.passed ? "test_pass" : "test_fail";
6030
- const ids = [];
6031
- for (const memId of injectedMemoryIds) {
6032
- const id = recordSignal(
6033
- db,
6034
- memId,
6035
- sessionId,
6036
- signalType,
6037
- testResult.output?.slice(0, 500)
6038
- );
6039
- ids.push(id);
6040
- }
6041
- return ids;
6042
- }
6043
6031
  function getSignalStats(db, memoryId) {
6044
6032
  const signals = getSignals(db, memoryId);
6045
6033
  const stats = {
@@ -6487,8 +6475,6 @@ export {
6487
6475
  formatRetrievalEvalReport,
6488
6476
  formatValueRetrievalEvalReport,
6489
6477
  recordSignal,
6490
- runTests,
6491
- recordTestSignals,
6492
6478
  getSignalStats,
6493
6479
  createPolicy,
6494
6480
  listPolicies,
@@ -6501,4 +6487,4 @@ export {
6501
6487
  pruneMemories,
6502
6488
  formatPruneReport
6503
6489
  };
6504
- //# sourceMappingURL=chunk-QKN6IWJ3.js.map
6490
+ //# sourceMappingURL=chunk-SISLEKTR.js.map