@edihasaj/recall 2.0.17 → 2.0.18
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.
- package/README.md +12 -0
- package/dist/{chunk-RAQT2OBR.js → chunk-2YFC2U6M.js} +7 -7
- package/dist/{chunk-GK7OWVRQ.js → chunk-CGZP6FXD.js} +3 -3
- package/dist/{chunk-XRKUJ5B4.js → chunk-EJNIQVIJ.js} +2 -2
- package/dist/{chunk-QQ6YHR7I.js → chunk-HKA2KAB2.js} +231 -26
- package/dist/chunk-HKA2KAB2.js.map +1 -0
- package/dist/{chunk-Q7254IPO.js → chunk-JMAWDCQM.js} +193 -15
- package/dist/chunk-JMAWDCQM.js.map +1 -0
- package/dist/{chunk-FNIIUNW6.js → chunk-LGM46TRO.js} +2 -2
- package/dist/{chunk-Q22B7YDQ.js → chunk-MXF255YS.js} +5 -5
- package/dist/{chunk-2COJXGP4.js → chunk-OIIAMDOT.js} +4 -3
- package/dist/{chunk-2COJXGP4.js.map → chunk-OIIAMDOT.js.map} +1 -1
- package/dist/{chunk-ZT67CYDS.js → chunk-PVEH3GEI.js} +2 -2
- package/dist/{chunk-ZT67CYDS.js.map → chunk-PVEH3GEI.js.map} +1 -1
- package/dist/{chunk-YIVOTIDF.js → chunk-SARDP34D.js} +5 -5
- package/dist/{chunk-CSBXI3ET.js → chunk-SHS4CTN3.js} +8 -4
- package/dist/chunk-SHS4CTN3.js.map +1 -0
- package/dist/{chunk-VUVFQJWZ.js → chunk-SYYBKTWO.js} +2 -2
- package/dist/{chunk-22AJZ7UQ.js → chunk-UNKEHYFD.js} +2 -2
- package/dist/{chunk-KLERXJ47.js → chunk-VNKQBRLB.js} +3 -3
- package/dist/{chunk-EY6HIDG2.js → chunk-XBYAK7LC.js} +9 -9
- package/dist/{chunk-KVZN35JF.js → chunk-XOKSI4EY.js} +7 -7
- package/dist/{chunk-UDLRBKC3.js → chunk-YFK2AD34.js} +3 -3
- package/dist/{chunk-YIUBD27J.js → chunk-Z2NS4E63.js} +30 -37
- package/dist/chunk-Z2NS4E63.js.map +1 -0
- package/dist/{cleanup-4TXIHTJT.js → cleanup-PYF3MQXT.js} +11 -11
- package/dist/cli.js +39 -191
- package/dist/cli.js.map +1 -1
- package/dist/{codex-trust-2JIY66CP.js → codex-trust-JTJSVDJ4.js} +4 -4
- package/dist/daemon.js +143 -39
- package/dist/daemon.js.map +1 -1
- package/dist/dispatcher-JZKQYPLF.js +22 -0
- package/dist/{embeddings-AAS7NKGB.js → embeddings-3NAF5DFW.js} +5 -5
- package/dist/ingest-KWIQFV6X.js +20 -0
- package/dist/{keychain-SHRO7W6J.js → keychain-FLEYJZCO.js} +3 -3
- package/dist/mcp.js +15 -15
- package/dist/{memory-value-R2C7ZSDF.js → memory-value-DT5DNGJA.js} +11 -11
- package/dist/{provenance-I5GIAP7N.js → provenance-ZBYCDVTO.js} +9 -9
- package/dist/quality-UQME7OTQ.js +25 -0
- package/dist/retrieval-V7TY5HRU.js +15 -0
- package/dist/{store-X2B6MRBH.js → store-UQFDKVUA.js} +4 -4
- package/dist/sync-server.js +2 -2
- package/dist/{tasks-H4NIS6QO.js → tasks-2LMQ3ZXB.js} +11 -11
- package/dist/{usage-35HSDMNT.js → usage-ZXD4DO5J.js} +4 -4
- package/package.json +1 -1
- package/vendor/recall-cloud-sync/PROVENANCE.md +18 -5
- package/vendor/recall-cloud-sync/recall-sync-local.mjs +19 -10
- package/vendor/recall-cloud-sync/recall-sync.mjs +40 -6
- package/dist/chunk-CSBXI3ET.js.map +0 -1
- package/dist/chunk-Q7254IPO.js.map +0 -1
- package/dist/chunk-QQ6YHR7I.js.map +0 -1
- package/dist/chunk-YIUBD27J.js.map +0 -1
- package/dist/dispatcher-O6NGADCQ.js +0 -22
- package/dist/ingest-DW3AG4M5.js +0 -20
- package/dist/quality-32MAXPNJ.js +0 -25
- package/dist/retrieval-RKYWWNWC.js +0 -15
- /package/dist/{chunk-RAQT2OBR.js.map → chunk-2YFC2U6M.js.map} +0 -0
- /package/dist/{chunk-GK7OWVRQ.js.map → chunk-CGZP6FXD.js.map} +0 -0
- /package/dist/{chunk-XRKUJ5B4.js.map → chunk-EJNIQVIJ.js.map} +0 -0
- /package/dist/{chunk-FNIIUNW6.js.map → chunk-LGM46TRO.js.map} +0 -0
- /package/dist/{chunk-Q22B7YDQ.js.map → chunk-MXF255YS.js.map} +0 -0
- /package/dist/{chunk-YIVOTIDF.js.map → chunk-SARDP34D.js.map} +0 -0
- /package/dist/{chunk-VUVFQJWZ.js.map → chunk-SYYBKTWO.js.map} +0 -0
- /package/dist/{chunk-22AJZ7UQ.js.map → chunk-UNKEHYFD.js.map} +0 -0
- /package/dist/{chunk-KLERXJ47.js.map → chunk-VNKQBRLB.js.map} +0 -0
- /package/dist/{chunk-EY6HIDG2.js.map → chunk-XBYAK7LC.js.map} +0 -0
- /package/dist/{chunk-KVZN35JF.js.map → chunk-XOKSI4EY.js.map} +0 -0
- /package/dist/{chunk-UDLRBKC3.js.map → chunk-YFK2AD34.js.map} +0 -0
- /package/dist/{cleanup-4TXIHTJT.js.map → cleanup-PYF3MQXT.js.map} +0 -0
- /package/dist/{codex-trust-2JIY66CP.js.map → codex-trust-JTJSVDJ4.js.map} +0 -0
- /package/dist/{dispatcher-O6NGADCQ.js.map → dispatcher-JZKQYPLF.js.map} +0 -0
- /package/dist/{embeddings-AAS7NKGB.js.map → embeddings-3NAF5DFW.js.map} +0 -0
- /package/dist/{ingest-DW3AG4M5.js.map → ingest-KWIQFV6X.js.map} +0 -0
- /package/dist/{keychain-SHRO7W6J.js.map → keychain-FLEYJZCO.js.map} +0 -0
- /package/dist/{memory-value-R2C7ZSDF.js.map → memory-value-DT5DNGJA.js.map} +0 -0
- /package/dist/{provenance-I5GIAP7N.js.map → provenance-ZBYCDVTO.js.map} +0 -0
- /package/dist/{quality-32MAXPNJ.js.map → quality-UQME7OTQ.js.map} +0 -0
- /package/dist/{retrieval-RKYWWNWC.js.map → retrieval-V7TY5HRU.js.map} +0 -0
- /package/dist/{store-X2B6MRBH.js.map → store-UQFDKVUA.js.map} +0 -0
- /package/dist/{tasks-H4NIS6QO.js.map → tasks-2LMQ3ZXB.js.map} +0 -0
- /package/dist/{usage-35HSDMNT.js.map → usage-ZXD4DO5J.js.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveCodexHomes
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-CGZP6FXD.js";
|
|
4
|
+
import "./chunk-SYYBKTWO.js";
|
|
5
5
|
import {
|
|
6
6
|
init_define_RECALL_BUILD_INFO
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PVEH3GEI.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-
|
|
74
|
+
//# sourceMappingURL=codex-trust-JTJSVDJ4.js.map
|
package/dist/daemon.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
computeQualityReport,
|
|
3
3
|
listQualitySnapshots,
|
|
4
4
|
recordQualitySnapshot
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SARDP34D.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-
|
|
27
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-Z2NS4E63.js";
|
|
26
|
+
import "./chunk-CGZP6FXD.js";
|
|
28
27
|
import {
|
|
29
28
|
createRecallMcpServer
|
|
30
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-XBYAK7LC.js";
|
|
31
30
|
import {
|
|
32
31
|
graphQuery
|
|
33
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-MXF255YS.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-
|
|
90
|
+
} from "./chunk-JMAWDCQM.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-
|
|
110
|
-
import "./chunk-
|
|
111
|
-
import "./chunk-
|
|
108
|
+
} from "./chunk-HKA2KAB2.js";
|
|
109
|
+
import "./chunk-2YFC2U6M.js";
|
|
110
|
+
import "./chunk-EJNIQVIJ.js";
|
|
112
111
|
import {
|
|
113
112
|
Sentry
|
|
114
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-UNKEHYFD.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-
|
|
132
|
-
import "./chunk-
|
|
133
|
-
import "./chunk-
|
|
130
|
+
} from "./chunk-XOKSI4EY.js";
|
|
131
|
+
import "./chunk-YFK2AD34.js";
|
|
132
|
+
import "./chunk-SYYBKTWO.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
|
-
|
|
142
|
-
|
|
140
|
+
rebuildMemoryFtsIndexResponsive,
|
|
141
|
+
verifyEmbeddings,
|
|
142
|
+
verifyMemoryFtsIndex
|
|
143
|
+
} from "./chunk-SHS4CTN3.js";
|
|
143
144
|
import {
|
|
144
145
|
hasProviderConfigured,
|
|
145
146
|
init_keychain
|
|
146
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-LGM46TRO.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-
|
|
158
|
+
} from "./chunk-VNKQBRLB.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-
|
|
168
|
+
} from "./chunk-OIIAMDOT.js";
|
|
168
169
|
import {
|
|
169
170
|
define_RECALL_BUILD_INFO_default,
|
|
170
171
|
init_define_RECALL_BUILD_INFO
|
|
171
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-PVEH3GEI.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
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
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
|
|
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) {
|