@edihasaj/recall 2.0.17 → 2.0.19

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 (81) hide show
  1. package/README.md +12 -0
  2. package/dist/{chunk-VUVFQJWZ.js → chunk-3SI2FCYS.js} +2 -2
  3. package/dist/{chunk-Q22B7YDQ.js → chunk-5VIPRV3V.js} +5 -5
  4. package/dist/{chunk-22AJZ7UQ.js → chunk-673NQIZX.js} +2 -2
  5. package/dist/{chunk-UDLRBKC3.js → chunk-6B7YHOGI.js} +3 -3
  6. package/dist/{chunk-YIVOTIDF.js → chunk-FH2XQDYL.js} +5 -5
  7. package/dist/{chunk-KLERXJ47.js → chunk-GENJNVHG.js} +3 -3
  8. package/dist/{chunk-2COJXGP4.js → chunk-GTHCX5LX.js} +4 -3
  9. package/dist/{chunk-2COJXGP4.js.map → chunk-GTHCX5LX.js.map} +1 -1
  10. package/dist/{chunk-EY6HIDG2.js → chunk-J4IWU2BE.js} +9 -9
  11. package/dist/{chunk-Q7254IPO.js → chunk-J6YBL72P.js} +193 -15
  12. package/dist/chunk-J6YBL72P.js.map +1 -0
  13. package/dist/{chunk-YIUBD27J.js → chunk-M4JG3HMA.js} +30 -37
  14. package/dist/chunk-M4JG3HMA.js.map +1 -0
  15. package/dist/{chunk-CSBXI3ET.js → chunk-NSXTH2B4.js} +8 -4
  16. package/dist/chunk-NSXTH2B4.js.map +1 -0
  17. package/dist/{chunk-ZT67CYDS.js → chunk-QDCIXULL.js} +2 -2
  18. package/dist/{chunk-ZT67CYDS.js.map → chunk-QDCIXULL.js.map} +1 -1
  19. package/dist/{chunk-FNIIUNW6.js → chunk-QDONEJJG.js} +2 -2
  20. package/dist/{chunk-QQ6YHR7I.js → chunk-R5CG3RC4.js} +231 -26
  21. package/dist/chunk-R5CG3RC4.js.map +1 -0
  22. package/dist/{chunk-KVZN35JF.js → chunk-WDUYM3NZ.js} +7 -7
  23. package/dist/{chunk-RAQT2OBR.js → chunk-WPHCCQOC.js} +7 -7
  24. package/dist/{chunk-GK7OWVRQ.js → chunk-X3EF5QHV.js} +3 -3
  25. package/dist/{chunk-XRKUJ5B4.js → chunk-ZHJRYVOD.js} +2 -2
  26. package/dist/{cleanup-4TXIHTJT.js → cleanup-FOGHMRL5.js} +11 -11
  27. package/dist/cli.js +39 -191
  28. package/dist/cli.js.map +1 -1
  29. package/dist/{codex-trust-2JIY66CP.js → codex-trust-C2GOV764.js} +4 -4
  30. package/dist/daemon.js +143 -39
  31. package/dist/daemon.js.map +1 -1
  32. package/dist/dispatcher-OIINFHQU.js +22 -0
  33. package/dist/{embeddings-AAS7NKGB.js → embeddings-6Y7KXV5L.js} +5 -5
  34. package/dist/ingest-QFX3ZEM6.js +20 -0
  35. package/dist/{keychain-SHRO7W6J.js → keychain-DHS6XKIQ.js} +3 -3
  36. package/dist/mcp.js +15 -15
  37. package/dist/{memory-value-R2C7ZSDF.js → memory-value-U6TGLBZB.js} +11 -11
  38. package/dist/{provenance-I5GIAP7N.js → provenance-PLISLH2V.js} +9 -9
  39. package/dist/quality-AYWNSDIU.js +25 -0
  40. package/dist/retrieval-B2DYBYAJ.js +15 -0
  41. package/dist/{store-X2B6MRBH.js → store-OLSM63EZ.js} +4 -4
  42. package/dist/sync-server.js +2 -2
  43. package/dist/{tasks-H4NIS6QO.js → tasks-S5ZMXA5K.js} +11 -11
  44. package/dist/{usage-35HSDMNT.js → usage-RWS6VQBY.js} +4 -4
  45. package/package.json +1 -1
  46. package/vendor/recall-cloud-sync/PROVENANCE.md +18 -5
  47. package/vendor/recall-cloud-sync/recall-sync-local.mjs +19 -10
  48. package/vendor/recall-cloud-sync/recall-sync.mjs +40 -6
  49. package/dist/chunk-CSBXI3ET.js.map +0 -1
  50. package/dist/chunk-Q7254IPO.js.map +0 -1
  51. package/dist/chunk-QQ6YHR7I.js.map +0 -1
  52. package/dist/chunk-YIUBD27J.js.map +0 -1
  53. package/dist/dispatcher-O6NGADCQ.js +0 -22
  54. package/dist/ingest-DW3AG4M5.js +0 -20
  55. package/dist/quality-32MAXPNJ.js +0 -25
  56. package/dist/retrieval-RKYWWNWC.js +0 -15
  57. /package/dist/{chunk-VUVFQJWZ.js.map → chunk-3SI2FCYS.js.map} +0 -0
  58. /package/dist/{chunk-Q22B7YDQ.js.map → chunk-5VIPRV3V.js.map} +0 -0
  59. /package/dist/{chunk-22AJZ7UQ.js.map → chunk-673NQIZX.js.map} +0 -0
  60. /package/dist/{chunk-UDLRBKC3.js.map → chunk-6B7YHOGI.js.map} +0 -0
  61. /package/dist/{chunk-YIVOTIDF.js.map → chunk-FH2XQDYL.js.map} +0 -0
  62. /package/dist/{chunk-KLERXJ47.js.map → chunk-GENJNVHG.js.map} +0 -0
  63. /package/dist/{chunk-EY6HIDG2.js.map → chunk-J4IWU2BE.js.map} +0 -0
  64. /package/dist/{chunk-FNIIUNW6.js.map → chunk-QDONEJJG.js.map} +0 -0
  65. /package/dist/{chunk-KVZN35JF.js.map → chunk-WDUYM3NZ.js.map} +0 -0
  66. /package/dist/{chunk-RAQT2OBR.js.map → chunk-WPHCCQOC.js.map} +0 -0
  67. /package/dist/{chunk-GK7OWVRQ.js.map → chunk-X3EF5QHV.js.map} +0 -0
  68. /package/dist/{chunk-XRKUJ5B4.js.map → chunk-ZHJRYVOD.js.map} +0 -0
  69. /package/dist/{cleanup-4TXIHTJT.js.map → cleanup-FOGHMRL5.js.map} +0 -0
  70. /package/dist/{codex-trust-2JIY66CP.js.map → codex-trust-C2GOV764.js.map} +0 -0
  71. /package/dist/{dispatcher-O6NGADCQ.js.map → dispatcher-OIINFHQU.js.map} +0 -0
  72. /package/dist/{embeddings-AAS7NKGB.js.map → embeddings-6Y7KXV5L.js.map} +0 -0
  73. /package/dist/{ingest-DW3AG4M5.js.map → ingest-QFX3ZEM6.js.map} +0 -0
  74. /package/dist/{keychain-SHRO7W6J.js.map → keychain-DHS6XKIQ.js.map} +0 -0
  75. /package/dist/{memory-value-R2C7ZSDF.js.map → memory-value-U6TGLBZB.js.map} +0 -0
  76. /package/dist/{provenance-I5GIAP7N.js.map → provenance-PLISLH2V.js.map} +0 -0
  77. /package/dist/{quality-32MAXPNJ.js.map → quality-AYWNSDIU.js.map} +0 -0
  78. /package/dist/{retrieval-RKYWWNWC.js.map → retrieval-B2DYBYAJ.js.map} +0 -0
  79. /package/dist/{store-X2B6MRBH.js.map → store-OLSM63EZ.js.map} +0 -0
  80. /package/dist/{tasks-H4NIS6QO.js.map → tasks-S5ZMXA5K.js.map} +0 -0
  81. /package/dist/{usage-35HSDMNT.js.map → usage-RWS6VQBY.js.map} +0 -0
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  resolveCodexHomes
3
- } from "./chunk-GK7OWVRQ.js";
4
- import "./chunk-VUVFQJWZ.js";
3
+ } from "./chunk-X3EF5QHV.js";
4
+ import "./chunk-3SI2FCYS.js";
5
5
  import {
6
6
  init_define_RECALL_BUILD_INFO
7
- } from "./chunk-ZT67CYDS.js";
7
+ } from "./chunk-QDCIXULL.js";
8
8
 
9
9
  // src/doctor/codex-trust.ts
10
10
  init_define_RECALL_BUILD_INFO();
@@ -71,4 +71,4 @@ function probeCodexHome(home) {
71
71
  export {
72
72
  inspectCodexTrust
73
73
  };
74
- //# sourceMappingURL=codex-trust-2JIY66CP.js.map
74
+ //# sourceMappingURL=codex-trust-C2GOV764.js.map
package/dist/daemon.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  computeQualityReport,
3
3
  listQualitySnapshots,
4
4
  recordQualitySnapshot
5
- } from "./chunk-YIVOTIDF.js";
5
+ } from "./chunk-FH2XQDYL.js";
6
6
  import {
7
7
  ensureDailyBackup,
8
8
  extractCodexSessionId,
@@ -16,21 +16,20 @@ import {
16
16
  handleSessionStartHook,
17
17
  handleToolHook,
18
18
  loadReliabilityVerdictConfigFromEnv,
19
- notifyMacOS,
20
19
  readReliabilityVerdict,
21
20
  reliabilityVerdictDataDir,
22
21
  resolveCodexSessionEndSessionId,
23
22
  runReliabilityVerdictCycle,
24
23
  toolOutcomeFromPayload,
25
24
  writeRepoContextArtifact
26
- } from "./chunk-YIUBD27J.js";
27
- import "./chunk-GK7OWVRQ.js";
25
+ } from "./chunk-M4JG3HMA.js";
26
+ import "./chunk-X3EF5QHV.js";
28
27
  import {
29
28
  createRecallMcpServer
30
- } from "./chunk-EY6HIDG2.js";
29
+ } from "./chunk-J4IWU2BE.js";
31
30
  import {
32
31
  graphQuery
33
- } from "./chunk-Q22B7YDQ.js";
32
+ } from "./chunk-5VIPRV3V.js";
34
33
  import {
35
34
  CloudError,
36
35
  DEFAULT_CLOUD_API,
@@ -88,7 +87,7 @@ import {
88
87
  validateApi,
89
88
  verifyHistoryEmbeddings,
90
89
  writePrivateFile
91
- } from "./chunk-Q7254IPO.js";
90
+ } from "./chunk-J6YBL72P.js";
92
91
  import {
93
92
  DEFAULT_ENQUEUE_CONFIG,
94
93
  autoResolveContradictions,
@@ -106,12 +105,12 @@ import {
106
105
  processReviewFeedback,
107
106
  resolveContradiction,
108
107
  runDeterministicCleanup
109
- } from "./chunk-QQ6YHR7I.js";
110
- import "./chunk-RAQT2OBR.js";
111
- import "./chunk-XRKUJ5B4.js";
108
+ } from "./chunk-R5CG3RC4.js";
109
+ import "./chunk-WPHCCQOC.js";
110
+ import "./chunk-ZHJRYVOD.js";
112
111
  import {
113
112
  Sentry
114
- } from "./chunk-22AJZ7UQ.js";
113
+ } from "./chunk-673NQIZX.js";
115
114
  import {
116
115
  confirmMemory,
117
116
  createMemory,
@@ -128,9 +127,9 @@ import {
128
127
  rollbackMemory,
129
128
  safeIngestMemoryById,
130
129
  statusFromConfidence
131
- } from "./chunk-KVZN35JF.js";
132
- import "./chunk-UDLRBKC3.js";
133
- import "./chunk-VUVFQJWZ.js";
130
+ } from "./chunk-WDUYM3NZ.js";
131
+ import "./chunk-6B7YHOGI.js";
132
+ import "./chunk-3SI2FCYS.js";
134
133
  import {
135
134
  bootstrapEmbeddings,
136
135
  getEmbeddingModelInfo,
@@ -138,12 +137,14 @@ import {
138
137
  loadEmbeddingConfigFromEnv,
139
138
  queueMemoryEmbeddingSync,
140
139
  rebuildEmbeddingIndexResponsive,
141
- verifyEmbeddings
142
- } from "./chunk-CSBXI3ET.js";
140
+ rebuildMemoryFtsIndexResponsive,
141
+ verifyEmbeddings,
142
+ verifyMemoryFtsIndex
143
+ } from "./chunk-NSXTH2B4.js";
143
144
  import {
144
145
  hasProviderConfigured,
145
146
  init_keychain
146
- } from "./chunk-FNIIUNW6.js";
147
+ } from "./chunk-QDONEJJG.js";
147
148
  import {
148
149
  clearGraph,
149
150
  countEntities,
@@ -154,7 +155,7 @@ import {
154
155
  listEntitiesForMemory,
155
156
  listMemoryIdsForEntity,
156
157
  neighborsOf
157
- } from "./chunk-KLERXJ47.js";
158
+ } from "./chunk-GENJNVHG.js";
158
159
  import {
159
160
  activityEvents,
160
161
  eq,
@@ -164,11 +165,11 @@ import {
164
165
  implicitSignals,
165
166
  lt,
166
167
  memories
167
- } from "./chunk-2COJXGP4.js";
168
+ } from "./chunk-GTHCX5LX.js";
168
169
  import {
169
170
  define_RECALL_BUILD_INFO_default,
170
171
  init_define_RECALL_BUILD_INFO
171
- } from "./chunk-ZT67CYDS.js";
172
+ } from "./chunk-QDCIXULL.js";
172
173
 
173
174
  // src/daemon.ts
174
175
  init_define_RECALL_BUILD_INFO();
@@ -512,6 +513,9 @@ import { spawn as nodeSpawn } from "child_process";
512
513
  function classifyEngineOutput(line) {
513
514
  if (/failed (?:401|403)\b/i.test(line)) return "The cloud rejected this device's token";
514
515
  if (/failed (?:408|425|429|5\d\d)\b/i.test(line)) return "The cloud is temporarily unavailable";
516
+ if (/failed 409\b/i.test(line) && /encrypted|encryption|private|aliases/i.test(line)) {
517
+ return "Cloud encryption settings conflict. Use private sync with the original passphrase and check device aliases.";
518
+ }
515
519
  if (/failed \d{3}\b/i.test(line)) return "A cloud request failed";
516
520
  if (/fetch failed|network error|ENOTFOUND|ECONNREFUSED|ETIMEDOUT|aborted|timeout/i.test(line)) return "Network error while syncing";
517
521
  if (/database is locked|SQLITE_BUSY/i.test(line)) return "The local database was busy";
@@ -522,6 +526,7 @@ function classifyEngineOutput(line) {
522
526
  return null;
523
527
  }
524
528
  var CloudWorker = class {
529
+ onPull;
525
530
  spawnFn;
526
531
  startTimeoutMs;
527
532
  stopGraceMs;
@@ -546,6 +551,8 @@ var CloudWorker = class {
546
551
  waiters = [];
547
552
  buffer = "";
548
553
  constructor(options = {}) {
554
+ this.onPull = options.onPull ?? (() => {
555
+ });
549
556
  this.spawnFn = options.spawn ?? ((command, args, opts) => nodeSpawn(command, args, opts));
550
557
  this.startTimeoutMs = options.startTimeoutMs ?? 2e4;
551
558
  this.stopGraceMs = options.stopGraceMs ?? 3e3;
@@ -689,6 +696,7 @@ var CloudWorker = class {
689
696
  if (/\bpull ok fetched=/.test(line)) {
690
697
  this.lastSyncAt = (/* @__PURE__ */ new Date()).toISOString();
691
698
  this.lastError = null;
699
+ this.onPull();
692
700
  continue;
693
701
  }
694
702
  const reason = classifyEngineOutput(line);
@@ -760,7 +768,14 @@ var CloudService = class {
760
768
  this.paths = deps.paths ?? resolveCloudPaths(this.env);
761
769
  this.log = deps.log ?? (() => {
762
770
  });
763
- this.worker = deps.worker ?? new CloudWorker({ log: this.log });
771
+ this.worker = deps.worker ?? new CloudWorker({ log: this.log, onPull: () => {
772
+ try {
773
+ const config = loadCloudConfig(this.paths);
774
+ if (config?.enabled) deps.onPull?.(config.dbPath);
775
+ } catch {
776
+ this.log("[recall-cloud] local index notification failed");
777
+ }
778
+ } });
764
779
  this.legacy = deps.legacy ?? new LegacyLaunchd({ paths: this.paths });
765
780
  this.engineFn = deps.engine ?? (() => resolveEngineFiles());
766
781
  this.nodePath = deps.nodePath ?? process.execPath;
@@ -848,6 +863,12 @@ var CloudService = class {
848
863
  const typedPassphrase = input.e2eePassphrase == null || input.e2eePassphrase === "" ? null : normalizePassphrase(input.e2eePassphrase);
849
864
  const existing = loadCloudConfig(this.paths);
850
865
  this.assertNoLegacy();
866
+ if (input.privacyMode !== void 0 && input.privacyMode !== "private" && input.privacyMode !== "searchable") {
867
+ throw new CloudError("Choose private sync or Cloud-assisted search", "invalid");
868
+ }
869
+ if (input.privacyMode === "searchable" && (typedPassphrase || existing?.e2ee)) {
870
+ throw new CloudError("An encrypted device cannot switch to server-readable sync. Keep private sync and use the original passphrase.", "encryption-required", 409);
871
+ }
851
872
  let passphrase = typedPassphrase;
852
873
  if (!passphrase && existing?.e2ee) {
853
874
  try {
@@ -863,6 +884,19 @@ var CloudService = class {
863
884
  );
864
885
  }
865
886
  }
887
+ if (input.privacyMode === "private" && !passphrase) {
888
+ throw new CloudError("Private sync requires a saved passphrase. Use the same one on every device.", "encryption-required", 409);
889
+ }
890
+ if (typedPassphrase && existing?.e2ee && existing.passphraseFile) {
891
+ let saved = null;
892
+ try {
893
+ saved = readPrivatePassphrase(existing.passphraseFile);
894
+ } catch {
895
+ }
896
+ if (saved && typedPassphrase !== saved) {
897
+ throw new CloudError("Use the original private-sync passphrase. Changing it here would strand encrypted memories.", "encryption-required", 409);
898
+ }
899
+ }
866
900
  const api = validateApi(input.api ?? existing?.api ?? DEFAULT_CLOUD_API);
867
901
  const deviceId = String(input.deviceId ?? existing?.deviceId ?? this.defaultDeviceId()).trim();
868
902
  if (!deviceId || deviceId.includes(":") || deviceId.length > 200) {
@@ -1066,6 +1100,64 @@ var CloudService = class {
1066
1100
  }
1067
1101
  };
1068
1102
 
1103
+ // src/cloud/local-index.ts
1104
+ init_define_RECALL_BUILD_INFO();
1105
+ import { realpathSync } from "fs";
1106
+
1107
+ // src/embeddings/index-lock.ts
1108
+ init_define_RECALL_BUILD_INFO();
1109
+ var tails = /* @__PURE__ */ new WeakMap();
1110
+ async function withMemoryIndexLock(db2, operation) {
1111
+ const prior = tails.get(db2.$client) ?? Promise.resolve();
1112
+ let release;
1113
+ const current = new Promise((resolve4) => {
1114
+ release = resolve4;
1115
+ });
1116
+ tails.set(db2.$client, current);
1117
+ await prior;
1118
+ try {
1119
+ return await operation();
1120
+ } finally {
1121
+ release();
1122
+ if (tails.get(db2.$client) === current) tails.delete(db2.$client);
1123
+ }
1124
+ }
1125
+
1126
+ // src/cloud/local-index.ts
1127
+ function createCloudIndexRefresher(db2, onError = () => {
1128
+ }) {
1129
+ let pending = false;
1130
+ let running = null;
1131
+ return (dbPath) => {
1132
+ try {
1133
+ if (realpathSync(dbPath) !== realpathSync(db2.$client.name)) return Promise.resolve();
1134
+ } catch {
1135
+ return Promise.resolve();
1136
+ }
1137
+ pending = true;
1138
+ if (running) return running;
1139
+ running = (async () => {
1140
+ await new Promise((resolve4) => setImmediate(resolve4));
1141
+ do {
1142
+ pending = false;
1143
+ await withMemoryIndexLock(db2, async () => {
1144
+ if (verifyMemoryFtsIndex(db2).drift !== 0) await rebuildMemoryFtsIndexResponsive(db2);
1145
+ const config = loadEmbeddingConfigFromEnv();
1146
+ if (!config) return;
1147
+ const state = verifyEmbeddings(db2, config);
1148
+ if (state.stale > 0) await bootstrapEmbeddings(db2, config);
1149
+ else if (state.index_drift !== 0 || state.lexical_drift !== 0) {
1150
+ await rebuildEmbeddingIndexResponsive(db2, config);
1151
+ }
1152
+ });
1153
+ } while (pending);
1154
+ })().catch(onError).finally(() => {
1155
+ running = null;
1156
+ });
1157
+ return running;
1158
+ };
1159
+ }
1160
+
1069
1161
  // src/cloud/routes.ts
1070
1162
  init_define_RECALL_BUILD_INFO();
1071
1163
 
@@ -1562,6 +1654,7 @@ function loadMaintenanceConfigFromEnv() {
1562
1654
  interval_seconds: parseInt(process.env.RECALL_MAINTENANCE_INTERVAL_SECONDS ?? "3600", 10),
1563
1655
  stale_days: parseInt(process.env.RECALL_MAINTENANCE_STALE_DAYS ?? "90", 10),
1564
1656
  candidate_unconfirmed_days: parseInt(process.env.RECALL_CANDIDATE_UNCONFIRMED_DAYS ?? "30", 10),
1657
+ candidate_max_age_days: parseInt(process.env.RECALL_CANDIDATE_MAX_AGE_DAYS ?? "60", 10),
1565
1658
  min_health_score: parseFloat(process.env.RECALL_MAINTENANCE_MIN_HEALTH_SCORE ?? "0.2"),
1566
1659
  activity_retention_days: parseInt(process.env.RECALL_ACTIVITY_RETENTION_DAYS ?? "30", 10),
1567
1660
  hook_call_retention_days: parseInt(process.env.RECALL_HOOK_CALL_RETENTION_DAYS ?? "30", 10),
@@ -1602,6 +1695,7 @@ function loadMaintenanceConfigFromEnv() {
1602
1695
  async function runMaintenanceCycle(db2, config = loadMaintenanceConfigFromEnv()) {
1603
1696
  const prune = pruneMemories(db2, {
1604
1697
  candidate_unconfirmed_days: config.candidate_unconfirmed_days,
1698
+ candidate_max_age_days: config.candidate_max_age_days,
1605
1699
  stale_days: config.stale_days,
1606
1700
  min_health_score: config.min_health_score,
1607
1701
  rejected_retention_days: config.rejected_retention_days,
@@ -1628,18 +1722,20 @@ async function runMaintenanceCycle(db2, config = loadMaintenanceConfigFromEnv())
1628
1722
  let history_lexical_drift = 0;
1629
1723
  const embeddingConfig = loadEmbeddingConfigFromEnv();
1630
1724
  if (embeddingConfig) {
1631
- const verify = verifyEmbeddings(db2, embeddingConfig);
1632
- embedding_stale = verify.stale;
1633
- vector_drift = verify.index_drift;
1634
- lexical_drift = verify.lexical_drift;
1635
- if (embedding_stale > 0) {
1636
- embeddings_refreshed = await bootstrapEmbeddings(db2, embeddingConfig);
1637
- }
1638
- if (vector_drift !== 0 || lexical_drift !== 0) {
1639
- const rebuilt = await rebuildEmbeddingIndexResponsive(db2, embeddingConfig);
1640
- vector_rows_rebuilt = rebuilt.vector_rows;
1641
- lexical_rows_rebuilt = rebuilt.lexical_rows;
1642
- }
1725
+ await withMemoryIndexLock(db2, async () => {
1726
+ const verify = verifyEmbeddings(db2, embeddingConfig);
1727
+ embedding_stale = verify.stale;
1728
+ vector_drift = verify.index_drift;
1729
+ lexical_drift = verify.lexical_drift;
1730
+ if (embedding_stale > 0) {
1731
+ embeddings_refreshed = await bootstrapEmbeddings(db2, embeddingConfig);
1732
+ }
1733
+ if (vector_drift !== 0 || lexical_drift !== 0) {
1734
+ const rebuilt = await rebuildEmbeddingIndexResponsive(db2, embeddingConfig);
1735
+ vector_rows_rebuilt = rebuilt.vector_rows;
1736
+ lexical_rows_rebuilt = rebuilt.lexical_rows;
1737
+ }
1738
+ });
1643
1739
  const historyVerify = verifyHistoryEmbeddings(db2, embeddingConfig);
1644
1740
  history_vector_drift = historyVerify.index_drift;
1645
1741
  history_lexical_drift = historyVerify.lexical_drift;
@@ -2513,10 +2609,10 @@ function scheduleCleanupLoop() {
2513
2609
  try {
2514
2610
  const report = runDeterministicCleanup(db, { dryRun: false });
2515
2611
  const c = report.counts;
2516
- const total = c.dedupe_clusters + c.fragment_rejections + c.repeat_promotions + c.command_suppressions + c.globalizations + c.test_fixture_rejections + c.invalid_scope_rejections + c.generic_scanned_tooling_rejections;
2612
+ const total = c.dedupe_clusters + c.fragment_rejections + c.repeat_promotions + c.command_suppressions + c.globalizations + c.test_fixture_rejections + c.invalid_scope_rejections + c.generic_scanned_tooling_rejections + c.agent_authored_rejections;
2517
2613
  if (total > 0) {
2518
2614
  console.log(
2519
- `[recall] cleanup run=${report.run_id.slice(0, 8)} merges=${c.dedupe_clusters}/${c.dedupe_losers} fragments=${c.fragment_rejections} promotions=${c.repeat_promotions} suppress=${c.command_suppressions} globalize=${c.globalizations}/${c.globalize_losers} test_repos=${c.test_fixture_rejections} invalid_scope=${c.invalid_scope_rejections} generic_tooling=${c.generic_scanned_tooling_rejections}`
2615
+ `[recall] cleanup run=${report.run_id.slice(0, 8)} merges=${c.dedupe_clusters}/${c.dedupe_losers} fragments=${c.fragment_rejections} promotions=${c.repeat_promotions} suppress=${c.command_suppressions} globalize=${c.globalizations}/${c.globalize_losers} test_repos=${c.test_fixture_rejections} invalid_scope=${c.invalid_scope_rejections} generic_tooling=${c.generic_scanned_tooling_rejections} agent_authored=${c.agent_authored_rejections}`
2520
2616
  );
2521
2617
  emit("cleanup.tick", {
2522
2618
  run_id: report.run_id,
@@ -2616,19 +2712,19 @@ function scheduleReliabilityProbeLoop() {
2616
2712
  timer.unref?.();
2617
2713
  }
2618
2714
  var lastReliabilityVerdict = null;
2715
+ var reliabilityVerdictNotify = false;
2619
2716
  var reliabilityVerdictRunning = false;
2620
2717
  function scheduleReliabilityVerdictLoop() {
2621
2718
  const config = loadReliabilityVerdictConfigFromEnv();
2622
2719
  const dataDir = reliabilityVerdictDataDir();
2623
2720
  lastReliabilityVerdict = readReliabilityVerdict(dataDir);
2721
+ reliabilityVerdictNotify = config.enabled && config.notify;
2624
2722
  if (!config.enabled) return;
2625
2723
  const run = async () => {
2626
2724
  if (reliabilityVerdictRunning) return;
2627
2725
  reliabilityVerdictRunning = true;
2628
2726
  try {
2629
- lastReliabilityVerdict = await runReliabilityVerdictCycle(db, dataDir, {
2630
- notify: config.notify ? notifyMacOS : void 0
2631
- });
2727
+ lastReliabilityVerdict = await runReliabilityVerdictCycle(db, dataDir);
2632
2728
  console.log(
2633
2729
  `[recall] reliability verdict overall=${lastReliabilityVerdict.overall} fail_days=${lastReliabilityVerdict.consecutive_fail_days} sustained=${lastReliabilityVerdict.sustained_fail}`
2634
2730
  );
@@ -2668,7 +2764,13 @@ function runReliabilityProbeSubprocess(realEmbeddings) {
2668
2764
  });
2669
2765
  });
2670
2766
  }
2671
- var cloudService = new CloudService({ log: (message) => console.log(message) });
2767
+ var refreshCloudIndex;
2768
+ var cloudService = new CloudService({
2769
+ log: (message) => console.log(message),
2770
+ onPull: (dbPath) => {
2771
+ void refreshCloudIndex?.(dbPath);
2772
+ }
2773
+ });
2672
2774
  var server = createServer2(async (req, res) => {
2673
2775
  const url = new URL(req.url ?? "/", `http://localhost:${PORT}`);
2674
2776
  const path = url.pathname;
@@ -2692,6 +2794,7 @@ var server = createServer2(async (req, res) => {
2692
2794
  build: recallBuildInfo,
2693
2795
  reliability_probe: lastReliabilityProbe,
2694
2796
  reliability_verdict: lastReliabilityVerdict,
2797
+ reliability_verdict_notify: reliabilityVerdictNotify,
2695
2798
  embeddings: getEmbeddingModelInfo(),
2696
2799
  retrieval_mode: loadEmbeddingConfigFromEnv() ? "hybrid" : "lexical",
2697
2800
  embedding_unavailable_reason: getEmbeddingUnavailableReason()
@@ -3443,6 +3546,7 @@ async function startDaemon() {
3443
3546
  console.log(`[recall] backup created ${backup.created} (retained ${backup.retained.length})`);
3444
3547
  }
3445
3548
  db = initDb();
3549
+ refreshCloudIndex = createCloudIndexRefresher(db, () => console.error("[recall-cloud] local index refresh failed; maintenance will retry"));
3446
3550
  if (!backup.created && backup.retained.length === 0) {
3447
3551
  backup = ensureDailyBackup();
3448
3552
  if (backup.created) {