@edihasaj/recall 2.0.16 → 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 +34 -4
- package/dist/{chunk-MLC3KO2O.js → chunk-2YFC2U6M.js} +7 -7
- package/dist/{chunk-YELXEWKH.js → chunk-CGZP6FXD.js} +3 -3
- package/dist/{chunk-LEOXFQJJ.js → chunk-EJNIQVIJ.js} +2 -2
- package/dist/{chunk-EKFOHVHS.js → chunk-HKA2KAB2.js} +233 -28
- package/dist/chunk-HKA2KAB2.js.map +1 -0
- package/dist/{chunk-VRAG5V66.js → chunk-JMAWDCQM.js} +1091 -48
- package/dist/chunk-JMAWDCQM.js.map +1 -0
- package/dist/{chunk-GDN44ZC7.js → chunk-LGM46TRO.js} +2 -2
- package/dist/{chunk-SEXZABB2.js → chunk-MXF255YS.js} +5 -5
- package/dist/{chunk-GCMP2YYN.js → chunk-OIIAMDOT.js} +4 -3
- package/dist/{chunk-GCMP2YYN.js.map → chunk-OIIAMDOT.js.map} +1 -1
- package/dist/{chunk-FYMMTODQ.js → chunk-PVEH3GEI.js} +2 -2
- package/dist/{chunk-FYMMTODQ.js.map → chunk-PVEH3GEI.js.map} +1 -1
- package/dist/{chunk-DAW6FUGL.js → chunk-SARDP34D.js} +5 -5
- package/dist/{chunk-SYSSACWJ.js → chunk-SHS4CTN3.js} +43 -20
- package/dist/chunk-SHS4CTN3.js.map +1 -0
- package/dist/{chunk-DOYTMHDI.js → chunk-SYYBKTWO.js} +2 -2
- package/dist/{chunk-Q2F7EQCA.js → chunk-UNKEHYFD.js} +2 -2
- package/dist/{chunk-7UWVXXTU.js → chunk-VNKQBRLB.js} +3 -3
- package/dist/{chunk-QPR77YXP.js → chunk-XBYAK7LC.js} +13 -11
- package/dist/chunk-XBYAK7LC.js.map +1 -0
- package/dist/{chunk-THC7QOAK.js → chunk-XOKSI4EY.js} +7 -7
- package/dist/{chunk-DVLQYARZ.js → chunk-YFK2AD34.js} +3 -3
- package/dist/{chunk-ZF23OPYV.js → chunk-Z2NS4E63.js} +31 -38
- package/dist/chunk-Z2NS4E63.js.map +1 -0
- package/dist/{cleanup-WJFE6IVP.js → cleanup-PYF3MQXT.js} +11 -11
- package/dist/cli.js +58 -191
- package/dist/cli.js.map +1 -1
- package/dist/{codex-trust-3BFTJFRD.js → codex-trust-JTJSVDJ4.js} +4 -4
- package/dist/daemon.js +1213 -188
- package/dist/daemon.js.map +1 -1
- package/dist/dispatcher-JZKQYPLF.js +22 -0
- package/dist/{embeddings-H352GFKD.js → embeddings-3NAF5DFW.js} +5 -5
- package/dist/ingest-KWIQFV6X.js +20 -0
- package/dist/{keychain-A2Z7D7YE.js → keychain-FLEYJZCO.js} +3 -3
- package/dist/mcp.js +15 -15
- package/dist/{memory-value-M3TA7SEK.js → memory-value-DT5DNGJA.js} +11 -11
- package/dist/{provenance-CXU6LZK7.js → provenance-ZBYCDVTO.js} +9 -9
- package/dist/quality-UQME7OTQ.js +25 -0
- package/dist/retrieval-V7TY5HRU.js +15 -0
- package/dist/{store-YCVWABSH.js → store-UQFDKVUA.js} +4 -4
- package/dist/sync-server.js +2 -2
- package/dist/{tasks-4UL2FIAQ.js → tasks-2LMQ3ZXB.js} +11 -11
- package/dist/{usage-HZ27RG53.js → usage-ZXD4DO5J.js} +4 -4
- package/package.json +2 -1
- package/vendor/recall-cloud-sync/PROVENANCE.md +40 -0
- package/vendor/recall-cloud-sync/managed-worker.mjs +48 -0
- package/vendor/recall-cloud-sync/private-token.mjs +95 -0
- package/vendor/recall-cloud-sync/recall-sync-local.mjs +415 -0
- package/vendor/recall-cloud-sync/recall-sync.mjs +1300 -0
- package/dist/chunk-EKFOHVHS.js.map +0 -1
- package/dist/chunk-QPR77YXP.js.map +0 -1
- package/dist/chunk-SYSSACWJ.js.map +0 -1
- package/dist/chunk-VRAG5V66.js.map +0 -1
- package/dist/chunk-ZF23OPYV.js.map +0 -1
- package/dist/dispatcher-5JVGZNWT.js +0 -22
- package/dist/ingest-NVYEOSVZ.js +0 -20
- package/dist/quality-4CG6U273.js +0 -25
- package/dist/retrieval-42CPYUDW.js +0 -15
- /package/dist/{chunk-MLC3KO2O.js.map → chunk-2YFC2U6M.js.map} +0 -0
- /package/dist/{chunk-YELXEWKH.js.map → chunk-CGZP6FXD.js.map} +0 -0
- /package/dist/{chunk-LEOXFQJJ.js.map → chunk-EJNIQVIJ.js.map} +0 -0
- /package/dist/{chunk-GDN44ZC7.js.map → chunk-LGM46TRO.js.map} +0 -0
- /package/dist/{chunk-SEXZABB2.js.map → chunk-MXF255YS.js.map} +0 -0
- /package/dist/{chunk-DAW6FUGL.js.map → chunk-SARDP34D.js.map} +0 -0
- /package/dist/{chunk-DOYTMHDI.js.map → chunk-SYYBKTWO.js.map} +0 -0
- /package/dist/{chunk-Q2F7EQCA.js.map → chunk-UNKEHYFD.js.map} +0 -0
- /package/dist/{chunk-7UWVXXTU.js.map → chunk-VNKQBRLB.js.map} +0 -0
- /package/dist/{chunk-THC7QOAK.js.map → chunk-XOKSI4EY.js.map} +0 -0
- /package/dist/{chunk-DVLQYARZ.js.map → chunk-YFK2AD34.js.map} +0 -0
- /package/dist/{cleanup-WJFE6IVP.js.map → cleanup-PYF3MQXT.js.map} +0 -0
- /package/dist/{codex-trust-3BFTJFRD.js.map → codex-trust-JTJSVDJ4.js.map} +0 -0
- /package/dist/{dispatcher-5JVGZNWT.js.map → dispatcher-JZKQYPLF.js.map} +0 -0
- /package/dist/{embeddings-H352GFKD.js.map → embeddings-3NAF5DFW.js.map} +0 -0
- /package/dist/{ingest-NVYEOSVZ.js.map → ingest-KWIQFV6X.js.map} +0 -0
- /package/dist/{keychain-A2Z7D7YE.js.map → keychain-FLEYJZCO.js.map} +0 -0
- /package/dist/{memory-value-M3TA7SEK.js.map → memory-value-DT5DNGJA.js.map} +0 -0
- /package/dist/{provenance-CXU6LZK7.js.map → provenance-ZBYCDVTO.js.map} +0 -0
- /package/dist/{quality-4CG6U273.js.map → quality-UQME7OTQ.js.map} +0 -0
- /package/dist/{retrieval-42CPYUDW.js.map → retrieval-V7TY5HRU.js.map} +0 -0
- /package/dist/{store-YCVWABSH.js.map → store-UQFDKVUA.js.map} +0 -0
- /package/dist/{tasks-4UL2FIAQ.js.map → tasks-2LMQ3ZXB.js.map} +0 -0
- /package/dist/{usage-HZ27RG53.js.map → usage-ZXD4DO5J.js.map} +0 -0
|
@@ -13,16 +13,16 @@ import {
|
|
|
13
13
|
qualityReasons,
|
|
14
14
|
revertCleanupRun,
|
|
15
15
|
runDeterministicCleanup
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-HKA2KAB2.js";
|
|
17
|
+
import "./chunk-EJNIQVIJ.js";
|
|
18
|
+
import "./chunk-XOKSI4EY.js";
|
|
19
|
+
import "./chunk-YFK2AD34.js";
|
|
20
|
+
import "./chunk-SYYBKTWO.js";
|
|
21
|
+
import "./chunk-SHS4CTN3.js";
|
|
22
|
+
import "./chunk-LGM46TRO.js";
|
|
23
|
+
import "./chunk-VNKQBRLB.js";
|
|
24
|
+
import "./chunk-OIIAMDOT.js";
|
|
25
|
+
import "./chunk-PVEH3GEI.js";
|
|
26
26
|
export {
|
|
27
27
|
formatCleanupReport,
|
|
28
28
|
isWorkspaceRootAlias,
|
|
@@ -39,4 +39,4 @@ export {
|
|
|
39
39
|
revertCleanupRun,
|
|
40
40
|
runDeterministicCleanup
|
|
41
41
|
};
|
|
42
|
-
//# sourceMappingURL=cleanup-
|
|
42
|
+
//# sourceMappingURL=cleanup-PYF3MQXT.js.map
|
package/dist/cli.js
CHANGED
|
@@ -55,21 +55,21 @@ import {
|
|
|
55
55
|
unregisterStrayApps,
|
|
56
56
|
verifyBackupIntegrity,
|
|
57
57
|
writeRepoContextArtifact
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-Z2NS4E63.js";
|
|
59
59
|
import {
|
|
60
60
|
hasCommand,
|
|
61
61
|
installCodexHooks,
|
|
62
62
|
resolveCodexHookTargets,
|
|
63
63
|
resolveUserHomeDir,
|
|
64
64
|
uninstallCodexHooks
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-CGZP6FXD.js";
|
|
66
66
|
import {
|
|
67
67
|
closeDb,
|
|
68
|
+
cloudQueryStatus,
|
|
68
69
|
compileContext,
|
|
69
70
|
compileContextHybrid,
|
|
70
71
|
computeMetrics,
|
|
71
72
|
createActivityEvent,
|
|
72
|
-
createLoopCoverageCache,
|
|
73
73
|
createPolicy,
|
|
74
74
|
deletePolicy,
|
|
75
75
|
discoverLocalRepos,
|
|
@@ -77,6 +77,7 @@ import {
|
|
|
77
77
|
evaluatePolicy,
|
|
78
78
|
formatMetricsReport,
|
|
79
79
|
formatPruneReport,
|
|
80
|
+
formatRestoreReport,
|
|
80
81
|
formatRetrievalEvalReport,
|
|
81
82
|
formatValueRetrievalEvalReport,
|
|
82
83
|
getDbPath,
|
|
@@ -89,23 +90,24 @@ import {
|
|
|
89
90
|
listHistorySnippets,
|
|
90
91
|
listPendingApprovals,
|
|
91
92
|
listPolicies,
|
|
92
|
-
loadInjectedMemoryIds,
|
|
93
93
|
loadRetrievalEvalFile,
|
|
94
|
-
loopRepoForMemory,
|
|
95
94
|
pruneMemories,
|
|
96
95
|
recordSignal,
|
|
97
96
|
requestApproval,
|
|
98
97
|
resetDb,
|
|
99
98
|
resolveApproval,
|
|
99
|
+
restoreUnmeasuredCandidates,
|
|
100
100
|
runRetrievalEval,
|
|
101
101
|
runValueRetrievalEval,
|
|
102
102
|
scanAndStore,
|
|
103
103
|
searchHistorySnippets,
|
|
104
|
+
setCloudQueryBackgroundEnabled,
|
|
105
|
+
setCloudQueryEnabled,
|
|
104
106
|
signalOutcomeFallback,
|
|
105
107
|
startEvalSession,
|
|
106
108
|
summarizeValueRetrievalEval,
|
|
107
109
|
togglePolicy
|
|
108
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-JMAWDCQM.js";
|
|
109
111
|
import {
|
|
110
112
|
autoResolveContradictions,
|
|
111
113
|
computeAllHealthScores,
|
|
@@ -114,16 +116,14 @@ import {
|
|
|
114
116
|
formatHealthReport,
|
|
115
117
|
getRepoQualityProfile,
|
|
116
118
|
inferScope,
|
|
117
|
-
isHighRiskRule,
|
|
118
|
-
isNonUserCaptureContext,
|
|
119
119
|
listContradictions,
|
|
120
120
|
processCorrection,
|
|
121
121
|
processReviewFeedback,
|
|
122
122
|
resolveContradiction
|
|
123
|
-
} from "./chunk-
|
|
124
|
-
import "./chunk-
|
|
125
|
-
import "./chunk-
|
|
126
|
-
import "./chunk-
|
|
123
|
+
} from "./chunk-HKA2KAB2.js";
|
|
124
|
+
import "./chunk-2YFC2U6M.js";
|
|
125
|
+
import "./chunk-EJNIQVIJ.js";
|
|
126
|
+
import "./chunk-UNKEHYFD.js";
|
|
127
127
|
import {
|
|
128
128
|
confirmMemory,
|
|
129
129
|
createMemory,
|
|
@@ -131,21 +131,16 @@ import {
|
|
|
131
131
|
getAuditTrail,
|
|
132
132
|
getMemory,
|
|
133
133
|
getRecentAudit,
|
|
134
|
-
hasNonDurableProvenance,
|
|
135
134
|
listMemories,
|
|
136
135
|
listRepos,
|
|
137
136
|
queryMemories,
|
|
138
137
|
recordAudit,
|
|
139
|
-
recordAuditWithSnapshot,
|
|
140
138
|
rejectMemory,
|
|
141
139
|
rollbackMemory
|
|
142
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-XOKSI4EY.js";
|
|
141
|
+
import "./chunk-YFK2AD34.js";
|
|
142
|
+
import "./chunk-SYYBKTWO.js";
|
|
143
143
|
import {
|
|
144
|
-
desc
|
|
145
|
-
} from "./chunk-DVLQYARZ.js";
|
|
146
|
-
import "./chunk-DOYTMHDI.js";
|
|
147
|
-
import {
|
|
148
|
-
CONFIDENCE,
|
|
149
144
|
bootstrapEmbeddings,
|
|
150
145
|
ensureEmbeddingProviderReady,
|
|
151
146
|
flushEmbeddingJobs,
|
|
@@ -158,27 +153,25 @@ import {
|
|
|
158
153
|
semanticSearch,
|
|
159
154
|
upsertMemoryFtsRow,
|
|
160
155
|
verifyEmbeddings
|
|
161
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-SHS4CTN3.js";
|
|
162
157
|
import {
|
|
163
158
|
deleteApiKey,
|
|
164
159
|
hasKeychainApiKey,
|
|
165
160
|
init_keychain,
|
|
166
161
|
init_outbound_url,
|
|
167
162
|
normalizeSyncRemoteUrl
|
|
168
|
-
} from "./chunk-
|
|
169
|
-
import "./chunk-
|
|
163
|
+
} from "./chunk-LGM46TRO.js";
|
|
164
|
+
import "./chunk-VNKQBRLB.js";
|
|
170
165
|
import {
|
|
171
166
|
and,
|
|
172
|
-
auditTrail,
|
|
173
167
|
eq,
|
|
174
168
|
gt,
|
|
175
169
|
memories,
|
|
176
|
-
sql,
|
|
177
170
|
syncState
|
|
178
|
-
} from "./chunk-
|
|
171
|
+
} from "./chunk-OIIAMDOT.js";
|
|
179
172
|
import {
|
|
180
173
|
init_define_RECALL_BUILD_INFO
|
|
181
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-PVEH3GEI.js";
|
|
182
175
|
|
|
183
176
|
// src/cli.ts
|
|
184
177
|
init_define_RECALL_BUILD_INFO();
|
|
@@ -434,6 +427,18 @@ To import: recall harness2 import ${JSON.stringify(file)} --repo ${JSON.stringif
|
|
|
434
427
|
});
|
|
435
428
|
}
|
|
436
429
|
|
|
430
|
+
// src/cli/cloud-query.ts
|
|
431
|
+
init_define_RECALL_BUILD_INFO();
|
|
432
|
+
function registerCloudQueryCommands(program2) {
|
|
433
|
+
program2.command("cloud-query [mode]").description("Online memory lookup defaults on for connected Cloud; off keeps retrieval local").action((mode = "status") => {
|
|
434
|
+
if (!["on", "off", "status"].includes(mode)) {
|
|
435
|
+
throw new Error("Use cloud-query on, off, or status");
|
|
436
|
+
}
|
|
437
|
+
if (mode !== "status") setCloudQueryEnabled(mode === "on");
|
|
438
|
+
console.log(JSON.stringify(cloudQueryStatus()));
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
|
|
437
442
|
// src/cli.ts
|
|
438
443
|
import { resolve as resolve4 } from "path";
|
|
439
444
|
import { writeFileSync, readFileSync as readFileSync3, realpathSync } from "fs";
|
|
@@ -1083,148 +1088,6 @@ async function joinTeam(config, teamId) {
|
|
|
1083
1088
|
if (!resp.ok) throw new Error(`Failed to join team: ${resp.statusText}`);
|
|
1084
1089
|
}
|
|
1085
1090
|
|
|
1086
|
-
// src/pruning/restore.ts
|
|
1087
|
-
init_define_RECALL_BUILD_INFO();
|
|
1088
|
-
var DAY_MS = 864e5;
|
|
1089
|
-
var CONFIDENCE_EPSILON = 1e-9;
|
|
1090
|
-
var RESTORE_ACTOR = "auto-pruner";
|
|
1091
|
-
var RESTORE_REASON_PREFIX = "Restored to auto-injection: demoted while the injection loop was inactive";
|
|
1092
|
-
function isRiskyToRestore(memory) {
|
|
1093
|
-
if (isHighRiskRule(memory.text) || isNonUserCaptureContext(memory.text) || hasNonDurableProvenance(memory)) return true;
|
|
1094
|
-
const contexts = memory.evidence.filter((entry) => entry.type === "session_correction" || entry.type === "review_feedback").map((entry) => entry.context?.trim()).filter((context) => Boolean(context));
|
|
1095
|
-
return contexts.length > 0 && contexts.every(isNonUserCaptureContext);
|
|
1096
|
-
}
|
|
1097
|
-
function prunerArchivalAt(db, memory) {
|
|
1098
|
-
const latest = db.select().from(auditTrail).where(eq(auditTrail.memory_id, memory.id)).orderBy(desc(auditTrail.timestamp), sql`rowid DESC`).limit(1).get();
|
|
1099
|
-
if (!latest || latest.action !== "demoted" || latest.actor !== RESTORE_ACTOR || !/^Archived (?:unconfirmed candidate after \d+(?:\.\d+)?d without selection or repetition|from auto-injection: no activity since )/.test(latest.reason ?? "") || !latest.after_snapshot) return null;
|
|
1100
|
-
try {
|
|
1101
|
-
const after = JSON.parse(latest.after_snapshot);
|
|
1102
|
-
if (!after || typeof after !== "object" || Array.isArray(after)) return null;
|
|
1103
|
-
const fields = [
|
|
1104
|
-
"id",
|
|
1105
|
-
"type",
|
|
1106
|
-
"text",
|
|
1107
|
-
"scope",
|
|
1108
|
-
"repo",
|
|
1109
|
-
"path_scope",
|
|
1110
|
-
"status",
|
|
1111
|
-
"confidence",
|
|
1112
|
-
"source",
|
|
1113
|
-
"created_at",
|
|
1114
|
-
"updated_at",
|
|
1115
|
-
"last_validated_at",
|
|
1116
|
-
"last_injected_at",
|
|
1117
|
-
"injection_count",
|
|
1118
|
-
"override_count",
|
|
1119
|
-
"repetition_count",
|
|
1120
|
-
"auto_inject",
|
|
1121
|
-
"evidence",
|
|
1122
|
-
"capture_context",
|
|
1123
|
-
"supersedes"
|
|
1124
|
-
];
|
|
1125
|
-
if (fields.some(
|
|
1126
|
-
(field) => JSON.stringify(after[field]) !== JSON.stringify(memory[field])
|
|
1127
|
-
) || (after.note ?? null) !== (memory.note ?? null)) return null;
|
|
1128
|
-
if (latest.before_snapshot) {
|
|
1129
|
-
const before = JSON.parse(latest.before_snapshot);
|
|
1130
|
-
if (!before || before.auto_inject !== true) return null;
|
|
1131
|
-
}
|
|
1132
|
-
return typeof after.updated_at === "string" && Number.isFinite(Date.parse(after.updated_at)) ? after.updated_at : null;
|
|
1133
|
-
} catch {
|
|
1134
|
-
return null;
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
function restoreUnmeasuredCandidates(db, options = {}) {
|
|
1138
|
-
const minConfidence = options.minConfidence ?? CONFIDENCE.ACTIVE_MIN;
|
|
1139
|
-
const lookbackDays = options.lookbackDays ?? 30;
|
|
1140
|
-
const dryRun = options.dryRun ?? false;
|
|
1141
|
-
if (!Number.isFinite(minConfidence) || minConfidence < 0 || minConfidence > 1) {
|
|
1142
|
-
throw new RangeError("minConfidence must be a number between 0 and 1");
|
|
1143
|
-
}
|
|
1144
|
-
if (!Number.isFinite(lookbackDays) || lookbackDays <= 0) {
|
|
1145
|
-
throw new RangeError("lookbackDays must be a positive number");
|
|
1146
|
-
}
|
|
1147
|
-
const now = options.now ?? Date.now();
|
|
1148
|
-
const nowIso = new Date(now).toISOString();
|
|
1149
|
-
const sinceIso = new Date(now - lookbackDays * DAY_MS).toISOString();
|
|
1150
|
-
const loopCovered = createLoopCoverageCache(db);
|
|
1151
|
-
const result = {
|
|
1152
|
-
restored: [],
|
|
1153
|
-
skipped_below_gate: 0,
|
|
1154
|
-
skipped_loop_active: 0,
|
|
1155
|
-
skipped_risky: 0,
|
|
1156
|
-
skipped_not_pruner_archived: 0,
|
|
1157
|
-
min_confidence: minConfidence,
|
|
1158
|
-
lookback_days: lookbackDays,
|
|
1159
|
-
dry_run: dryRun
|
|
1160
|
-
};
|
|
1161
|
-
const restore = () => {
|
|
1162
|
-
const selected = loadInjectedMemoryIds(db);
|
|
1163
|
-
const archived = queryMemories(db, {
|
|
1164
|
-
repo: options.repo,
|
|
1165
|
-
status: "candidate",
|
|
1166
|
-
auto_inject: false
|
|
1167
|
-
}).filter((memory) => memory.injection_count === 0 && !selected.has(memory.id));
|
|
1168
|
-
for (const before of archived) {
|
|
1169
|
-
if (before.confidence + CONFIDENCE_EPSILON < minConfidence) {
|
|
1170
|
-
result.skipped_below_gate++;
|
|
1171
|
-
continue;
|
|
1172
|
-
}
|
|
1173
|
-
if (isRiskyToRestore(before)) {
|
|
1174
|
-
result.skipped_risky++;
|
|
1175
|
-
continue;
|
|
1176
|
-
}
|
|
1177
|
-
const archivedAt = prunerArchivalAt(db, before);
|
|
1178
|
-
if (!archivedAt) {
|
|
1179
|
-
result.skipped_not_pruner_archived++;
|
|
1180
|
-
continue;
|
|
1181
|
-
}
|
|
1182
|
-
const archiveWindowStart = new Date(Date.parse(archivedAt) - lookbackDays * DAY_MS).toISOString();
|
|
1183
|
-
const repo = loopRepoForMemory(before);
|
|
1184
|
-
if (loopCovered(repo, archiveWindowStart, archivedAt) || loopCovered(repo, sinceIso, nowIso)) {
|
|
1185
|
-
result.skipped_loop_active++;
|
|
1186
|
-
continue;
|
|
1187
|
-
}
|
|
1188
|
-
result.restored.push(before.id);
|
|
1189
|
-
if (dryRun) continue;
|
|
1190
|
-
db.update(memories).set({ auto_inject: true, updated_at: nowIso }).where(eq(memories.id, before.id)).run();
|
|
1191
|
-
const reason = `${RESTORE_REASON_PREFIX} (no injection coverage in ${lookbackDays}d; archival ${archivedAt})`;
|
|
1192
|
-
recordAuditWithSnapshot(
|
|
1193
|
-
db,
|
|
1194
|
-
before.id,
|
|
1195
|
-
"policy_applied",
|
|
1196
|
-
RESTORE_ACTOR,
|
|
1197
|
-
reason,
|
|
1198
|
-
before,
|
|
1199
|
-
getMemory(db, before.id) ?? null
|
|
1200
|
-
);
|
|
1201
|
-
}
|
|
1202
|
-
};
|
|
1203
|
-
const transaction = db.$client.transaction(restore);
|
|
1204
|
-
if (dryRun) transaction();
|
|
1205
|
-
else transaction.immediate();
|
|
1206
|
-
return result;
|
|
1207
|
-
}
|
|
1208
|
-
function formatRestoreReport(result) {
|
|
1209
|
-
const prefix = result.dry_run ? "[DRY RUN] " : "";
|
|
1210
|
-
const lines = [
|
|
1211
|
-
`${prefix}Restore Unmeasured Candidates`,
|
|
1212
|
-
``,
|
|
1213
|
-
`Gate: confidence >= ${result.min_confidence.toFixed(2)}, loop window ${result.lookback_days}d`,
|
|
1214
|
-
`${result.dry_run ? "Would restore" : "Restored"}: ${result.restored.length}`,
|
|
1215
|
-
`Below gate: ${result.skipped_below_gate}`,
|
|
1216
|
-
`Loop active: ${result.skipped_loop_active}`,
|
|
1217
|
-
`Risky (confirm): ${result.skipped_risky}`,
|
|
1218
|
-
`No pruner proof: ${result.skipped_not_pruner_archived}`
|
|
1219
|
-
];
|
|
1220
|
-
if (result.restored.length > 0) {
|
|
1221
|
-
lines.push("", result.dry_run ? "Would restore:" : "Restored:");
|
|
1222
|
-
for (const id of result.restored.slice(0, 10)) lines.push(` ${id.slice(0, 8)}`);
|
|
1223
|
-
if (result.restored.length > 10) lines.push(` ... and ${result.restored.length - 10} more`);
|
|
1224
|
-
}
|
|
1225
|
-
return lines.join("\n");
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
1091
|
// src/reliability/canary.ts
|
|
1229
1092
|
init_define_RECALL_BUILD_INFO();
|
|
1230
1093
|
import { mkdtempSync, rmSync } from "fs";
|
|
@@ -1993,6 +1856,7 @@ function defaultRecallAppPath(platform = process.platform) {
|
|
|
1993
1856
|
}
|
|
1994
1857
|
program.name("recall").description("Cross-tool coding memory and instruction compiler").version(pkg.version);
|
|
1995
1858
|
registerHarness2Commands(program);
|
|
1859
|
+
registerCloudQueryCommands(program);
|
|
1996
1860
|
program.command("init").description("Initialize Recall database").action(() => {
|
|
1997
1861
|
initDb();
|
|
1998
1862
|
console.log("Recall initialized. Database ready.");
|
|
@@ -2039,7 +1903,7 @@ program.command("doctor").description("Show local Recall runtime, DB, embedding,
|
|
|
2039
1903
|
const finalReport = opts.fix ? getDoctorReport() : report;
|
|
2040
1904
|
const codexEntry = finalReport.agents.find((agent) => agent.agent === "codex" && agent.detected);
|
|
2041
1905
|
if (codexEntry) {
|
|
2042
|
-
const { inspectCodexTrust } = await import("./codex-trust-
|
|
1906
|
+
const { inspectCodexTrust } = await import("./codex-trust-JTJSVDJ4.js");
|
|
2043
1907
|
codexEntry.hook_trust = await inspectCodexTrust();
|
|
2044
1908
|
}
|
|
2045
1909
|
if (opts.json) {
|
|
@@ -2363,6 +2227,7 @@ hookCmd.command("stats").description("Inspect local hook call telemetry").option
|
|
|
2363
2227
|
}
|
|
2364
2228
|
});
|
|
2365
2229
|
program.command("ump").description("Serve the Universal Memory Protocol (UMP) over Recall's engine").option("--http <port>", "Serve the UMP HTTP binding on this port").option("--stdio", "Serve the UMP MCP binding over stdio (default)").option("--smart", "Route writes through Recall's capture/judgement pipeline").action(async (opts) => {
|
|
2230
|
+
setCloudQueryBackgroundEnabled(true);
|
|
2366
2231
|
await runUmpServer({
|
|
2367
2232
|
http: opts.http ? parseInt(opts.http, 10) : void 0,
|
|
2368
2233
|
stdio: opts.stdio,
|
|
@@ -2682,6 +2547,7 @@ historyCmd.command("search").description("Search history snippets with hybrid le
|
|
|
2682
2547
|
}
|
|
2683
2548
|
});
|
|
2684
2549
|
program.command("serve").description("Start the MCP server (stdio transport)").action(async () => {
|
|
2550
|
+
setCloudQueryBackgroundEnabled(true);
|
|
2685
2551
|
await import("./mcp.js");
|
|
2686
2552
|
});
|
|
2687
2553
|
var syncCmd = program.command("sync").description("Sync memories with remote server");
|
|
@@ -2766,7 +2632,7 @@ evalCmd.command("value-retrieval").description("Run retrieval eval cases synthes
|
|
|
2766
2632
|
});
|
|
2767
2633
|
let snapshot = null;
|
|
2768
2634
|
if (opts.snapshot) {
|
|
2769
|
-
const { computeQualityReport, recordQualitySnapshot } = await import("./quality-
|
|
2635
|
+
const { computeQualityReport, recordQualitySnapshot } = await import("./quality-UQME7OTQ.js");
|
|
2770
2636
|
const qualityReport = computeQualityReport(db, { sinceIso: report.since });
|
|
2771
2637
|
snapshot = recordQualitySnapshot(
|
|
2772
2638
|
db,
|
|
@@ -3295,15 +3161,15 @@ uiCmd.command("status").description("Show WebUI status").option("--daemon-port <
|
|
|
3295
3161
|
var graphCmd = program.command("graph").description("Inspect and rebuild the knowledge graph (entities + relations)");
|
|
3296
3162
|
graphCmd.command("stats").description("Show entity/relation counts").action(async () => {
|
|
3297
3163
|
const db = initDb();
|
|
3298
|
-
const { countEntities, countRelations } = await import("./store-
|
|
3164
|
+
const { countEntities, countRelations } = await import("./store-UQFDKVUA.js");
|
|
3299
3165
|
console.log(`entities: ${countEntities(db)}`);
|
|
3300
3166
|
console.log(`relations: ${countRelations(db)}`);
|
|
3301
3167
|
});
|
|
3302
3168
|
graphCmd.command("backfill").description("Run the heuristic extractor over every active memory (idempotent)").option("--repo <repo>", "Limit to a single repo").option("--limit <n>", "Cap rows processed", "10000").option("--rebuild", "Clear all existing entities/relations first, then re-extract").action(async (opts) => {
|
|
3303
3169
|
const db = initDb();
|
|
3304
|
-
const { ingestMemoryHeuristic } = await import("./ingest-
|
|
3170
|
+
const { ingestMemoryHeuristic } = await import("./ingest-KWIQFV6X.js");
|
|
3305
3171
|
if (opts.rebuild) {
|
|
3306
|
-
const { clearGraph } = await import("./store-
|
|
3172
|
+
const { clearGraph } = await import("./store-UQFDKVUA.js");
|
|
3307
3173
|
clearGraph(db);
|
|
3308
3174
|
console.log("Cleared existing graph entities and relations.");
|
|
3309
3175
|
}
|
|
@@ -3325,7 +3191,7 @@ graphCmd.command("backfill").description("Run the heuristic extractor over every
|
|
|
3325
3191
|
});
|
|
3326
3192
|
graphCmd.command("entities").description("List entities").option("--repo <repo>", "Filter by repo").option("--kind <kind>", "Filter by entity kind").option("--search <q>", "Substring filter on name").option("--limit <n>", "Max rows", "50").action(async (opts) => {
|
|
3327
3193
|
const db = initDb();
|
|
3328
|
-
const { listEntities } = await import("./store-
|
|
3194
|
+
const { listEntities } = await import("./store-UQFDKVUA.js");
|
|
3329
3195
|
const rows = listEntities(db, {
|
|
3330
3196
|
repo: opts.repo,
|
|
3331
3197
|
kind: opts.kind,
|
|
@@ -3344,8 +3210,8 @@ graphCmd.command("entities").description("List entities").option("--repo <repo>"
|
|
|
3344
3210
|
});
|
|
3345
3211
|
graphCmd.command("query <query...>").description("Run graph-aware retrieval for a query").option("--repo <repo>", "Restrict to repo").option("--hops <n>", "Graph hops", "2").option("--limit <n>", "Max hits", "10").action(async (queryTokens, opts) => {
|
|
3346
3212
|
const db = initDb();
|
|
3347
|
-
const { graphQuery } = await import("./retrieval-
|
|
3348
|
-
const { loadEmbeddingConfigFromEnv: loadEmbeddingConfigFromEnv2 } = await import("./embeddings-
|
|
3213
|
+
const { graphQuery } = await import("./retrieval-V7TY5HRU.js");
|
|
3214
|
+
const { loadEmbeddingConfigFromEnv: loadEmbeddingConfigFromEnv2 } = await import("./embeddings-3NAF5DFW.js");
|
|
3349
3215
|
const embeddingConfig = loadEmbeddingConfigFromEnv2();
|
|
3350
3216
|
const result = await graphQuery(db, queryTokens.join(" "), embeddingConfig, {
|
|
3351
3217
|
repo: opts.repo,
|
|
@@ -3361,7 +3227,7 @@ graphCmd.command("query <query...>").description("Run graph-aware retrieval for
|
|
|
3361
3227
|
});
|
|
3362
3228
|
var maintenanceCmd = program.command("maintenance").description("Inspect and manage the delegated maintenance task queue");
|
|
3363
3229
|
maintenanceCmd.command("stats").description("Show backlog counts, completion stats, and mean latency").action(async () => {
|
|
3364
|
-
const { getTaskStats } = await import("./tasks-
|
|
3230
|
+
const { getTaskStats } = await import("./tasks-2LMQ3ZXB.js");
|
|
3365
3231
|
const db = initDb();
|
|
3366
3232
|
const stats = getTaskStats(db);
|
|
3367
3233
|
console.log(`Total tasks: ${stats.total}`);
|
|
@@ -3387,7 +3253,7 @@ maintenanceCmd.command("stats").description("Show backlog counts, completion sta
|
|
|
3387
3253
|
}
|
|
3388
3254
|
});
|
|
3389
3255
|
maintenanceCmd.command("list").description("List tasks (default: pending)").option("-s, --status <status>", "pending|claimed|completed|abandoned", "pending").option("-k, --kind <kind>", "Filter by kind").option("-r, --repo <repo>", "Filter by repo").option("-n, --limit <n>", "Max entries", "20").action(async (opts) => {
|
|
3390
|
-
const { listTasks } = await import("./tasks-
|
|
3256
|
+
const { listTasks } = await import("./tasks-2LMQ3ZXB.js");
|
|
3391
3257
|
const db = initDb();
|
|
3392
3258
|
const tasks = listTasks(db, {
|
|
3393
3259
|
status: opts.status,
|
|
@@ -3409,7 +3275,7 @@ maintenanceCmd.command("list").description("List tasks (default: pending)").opti
|
|
|
3409
3275
|
}
|
|
3410
3276
|
});
|
|
3411
3277
|
maintenanceCmd.command("drop").description("Delete a task by id (or id prefix)").argument("<task-id>", "Task id or prefix").action(async (taskIdArg) => {
|
|
3412
|
-
const { deleteTask, listTasks } = await import("./tasks-
|
|
3278
|
+
const { deleteTask, listTasks } = await import("./tasks-2LMQ3ZXB.js");
|
|
3413
3279
|
const db = initDb();
|
|
3414
3280
|
const all = listTasks(db, { limit: 1e4 });
|
|
3415
3281
|
const matches = all.filter((t) => t.id === taskIdArg || t.id.startsWith(taskIdArg));
|
|
@@ -3428,7 +3294,7 @@ maintenanceCmd.command("drop").description("Delete a task by id (or id prefix)")
|
|
|
3428
3294
|
});
|
|
3429
3295
|
var credentialsCmd = maintenanceCmd.command("credentials").description("Manage LLM provider API keys in macOS Keychain (env fallback on other platforms)");
|
|
3430
3296
|
credentialsCmd.command("list", { isDefault: true }).description("Show which providers have credentials available").action(async () => {
|
|
3431
|
-
const { listCredentials } = await import("./keychain-
|
|
3297
|
+
const { listCredentials } = await import("./keychain-FLEYJZCO.js");
|
|
3432
3298
|
const creds = listCredentials();
|
|
3433
3299
|
if (creds.length === 0) {
|
|
3434
3300
|
console.log("No API keys configured. Set one with:");
|
|
@@ -3442,7 +3308,7 @@ credentialsCmd.command("list", { isDefault: true }).description("Show which prov
|
|
|
3442
3308
|
}
|
|
3443
3309
|
});
|
|
3444
3310
|
credentialsCmd.command("set").description("Store credentials for an LLM provider in the macOS Keychain").argument("<provider>", "openai|anthropic|azure").argument("[key]", "API key (prompts via stdin if omitted; required for openai/anthropic and for azure unless --stdin-json is used)").option("--endpoint <url>", "Azure OpenAI resource endpoint (e.g. https://myresource.openai.azure.com)").option("--deployment <name>", "Azure OpenAI deployment name").option("--api-version <version>", "Azure OpenAI api-version (e.g. 2024-10-21)").option("--stdin-json", "Read the azure config (endpoint/deployment/api_version/key) as a JSON object from stdin").action(async (providerArg, keyArg, opts) => {
|
|
3445
|
-
const { setApiKey, setAzureConfig } = await import("./keychain-
|
|
3311
|
+
const { setApiKey, setAzureConfig } = await import("./keychain-FLEYJZCO.js");
|
|
3446
3312
|
const provider = providerArg === "azure" ? "azure-openai" : providerArg;
|
|
3447
3313
|
if (provider === "openai" || provider === "anthropic") {
|
|
3448
3314
|
const key = keyArg ?? await readStdinKey();
|
|
@@ -3504,7 +3370,7 @@ credentialsCmd.command("set").description("Store credentials for an LLM provider
|
|
|
3504
3370
|
process.exit(1);
|
|
3505
3371
|
});
|
|
3506
3372
|
credentialsCmd.command("clear").description("Remove provider credentials from the macOS Keychain").argument("<provider>", "openai|anthropic|azure").action(async (providerArg) => {
|
|
3507
|
-
const { deleteApiKey: deleteApiKey2 } = await import("./keychain-
|
|
3373
|
+
const { deleteApiKey: deleteApiKey2 } = await import("./keychain-FLEYJZCO.js");
|
|
3508
3374
|
const provider = providerArg === "azure" ? "azure-openai" : providerArg;
|
|
3509
3375
|
if (provider !== "openai" && provider !== "anthropic" && provider !== "azure-openai") {
|
|
3510
3376
|
console.error(`Provider must be "openai", "anthropic", or "azure", got "${providerArg}".`);
|
|
@@ -3515,8 +3381,8 @@ credentialsCmd.command("clear").description("Remove provider credentials from th
|
|
|
3515
3381
|
else console.log(`No ${provider} credentials found in Keychain.`);
|
|
3516
3382
|
});
|
|
3517
3383
|
maintenanceCmd.command("dispatch").description("Run the daemon-owned dispatcher once against pending maintenance tasks (requires a configured LLM provider)").option("--provider <provider>", "openai|anthropic|azure-openai (defaults to whichever is configured)").option("--model <model>", "Model override").option("--kind <kind>", "Restrict to a single task kind (repeatable)", (value, acc = []) => [...acc, value], []).option("--repo <repo>", "Restrict to a single repo").option("--max <n>", "Max tasks to run this round", "5").option("--dry-run", "Show which tasks would be dispatched; do not call the LLM").option("--preview", "Show the actual prompts that would be sent (no provider needed; no LLM call)").option("--json", "Emit the raw JSON report").action(async (opts) => {
|
|
3518
|
-
const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-
|
|
3519
|
-
const { listTasks } = await import("./tasks-
|
|
3384
|
+
const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-JZKQYPLF.js");
|
|
3385
|
+
const { listTasks } = await import("./tasks-2LMQ3ZXB.js");
|
|
3520
3386
|
const db = initDb();
|
|
3521
3387
|
if (opts.preview) {
|
|
3522
3388
|
const pending = listTasks(db, {
|
|
@@ -3573,12 +3439,12 @@ ${p.prompt.max_output_tokens}
|
|
|
3573
3439
|
console.log(formatDispatchReport(report));
|
|
3574
3440
|
});
|
|
3575
3441
|
maintenanceCmd.command("quarantine-generated").description("Preview memories supported only by generated messages; preserve them outside injection").option("--apply", "Quarantine matching memories with reversible audit snapshots").action(async (opts) => {
|
|
3576
|
-
const { quarantineGeneratedMemories } = await import("./provenance-
|
|
3442
|
+
const { quarantineGeneratedMemories } = await import("./provenance-ZBYCDVTO.js");
|
|
3577
3443
|
const ids = quarantineGeneratedMemories(initDb(), Boolean(opts.apply));
|
|
3578
3444
|
console.log(JSON.stringify({ applied: Boolean(opts.apply), count: ids.length, memory_ids: ids }, null, 2));
|
|
3579
3445
|
});
|
|
3580
|
-
maintenanceCmd.command("cleanup").description("Run deterministic, LLM-free cleanup for duplicate, low-quality, stale, and mis-scoped memories").option("--apply", "Persist changes (default is dry-run)").option("--only <action>", "Restrict to one action: dedupe_exact_merge|reject_fragment_candidate|promote_repeat_correction|suppress_unproductive_command|globalize_cross_repo|reject_test_fixture_repo|reject_invalid_scope|reject_generic_scanned_tooling").option("--revert <run-id>", "Revert a previous cleanup run (id or 8-char prefix)").option("--list", "List recent cleanup runs").option("--json", "Emit the raw JSON report").action(async (opts) => {
|
|
3581
|
-
const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-
|
|
3446
|
+
maintenanceCmd.command("cleanup").description("Run deterministic, LLM-free cleanup for duplicate, low-quality, stale, and mis-scoped memories").option("--apply", "Persist changes (default is dry-run)").option("--only <action>", "Restrict to one action: dedupe_exact_merge|reject_fragment_candidate|promote_repeat_correction|suppress_unproductive_command|globalize_cross_repo|reject_test_fixture_repo|reject_invalid_scope|reject_generic_scanned_tooling|reject_agent_authored").option("--revert <run-id>", "Revert a previous cleanup run (id or 8-char prefix)").option("--list", "List recent cleanup runs").option("--json", "Emit the raw JSON report").action(async (opts) => {
|
|
3447
|
+
const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-PYF3MQXT.js");
|
|
3582
3448
|
const db = initDb();
|
|
3583
3449
|
if (opts.list) {
|
|
3584
3450
|
const runs = listCleanupRuns(db);
|
|
@@ -3632,7 +3498,7 @@ maintenanceCmd.command("quality").description("Show injection outcome distributi
|
|
|
3632
3498
|
recordQualitySnapshot,
|
|
3633
3499
|
listQualitySnapshots,
|
|
3634
3500
|
diffQualitySnapshots
|
|
3635
|
-
} = await import("./quality-
|
|
3501
|
+
} = await import("./quality-UQME7OTQ.js");
|
|
3636
3502
|
const db = initDb();
|
|
3637
3503
|
if (opts.history) {
|
|
3638
3504
|
const snaps = listQualitySnapshots(db);
|
|
@@ -3693,7 +3559,7 @@ maintenanceCmd.command("value-backfill").description("Backfill memory value even
|
|
|
3693
3559
|
const {
|
|
3694
3560
|
backfillMemoryValueEvents,
|
|
3695
3561
|
formatMemoryValueBackfillReport
|
|
3696
|
-
} = await import("./memory-value-
|
|
3562
|
+
} = await import("./memory-value-DT5DNGJA.js");
|
|
3697
3563
|
const db = initDb();
|
|
3698
3564
|
const report = backfillMemoryValueEvents(db, {
|
|
3699
3565
|
sinceIso: opts.since,
|
|
@@ -3706,7 +3572,7 @@ maintenanceCmd.command("value-backfill").description("Backfill memory value even
|
|
|
3706
3572
|
console.log(formatMemoryValueBackfillReport(report));
|
|
3707
3573
|
});
|
|
3708
3574
|
maintenanceCmd.command("usage").description("Summarize LLM API usage (tokens, cost) across recent maintenance runs").option("--since <iso>", "Window start (default: last 30 days)").option("--limit <n>", "Recent-call rows to show", "10").option("--json", "Emit raw JSON summary").action(async (opts) => {
|
|
3709
|
-
const { summarizeUsage, formatUsageReport } = await import("./usage-
|
|
3575
|
+
const { summarizeUsage, formatUsageReport } = await import("./usage-ZXD4DO5J.js");
|
|
3710
3576
|
const db = initDb();
|
|
3711
3577
|
const summary = summarizeUsage(db, {
|
|
3712
3578
|
sinceIso: opts.since,
|
|
@@ -3841,6 +3707,7 @@ function isDirectCliInvocation(moduleUrl, argvPath) {
|
|
|
3841
3707
|
}
|
|
3842
3708
|
}
|
|
3843
3709
|
if (isDirectCliInvocation(import.meta.url, process.argv[1])) {
|
|
3710
|
+
setCloudQueryBackgroundEnabled(false);
|
|
3844
3711
|
await program.parseAsync(process.argv);
|
|
3845
3712
|
}
|
|
3846
3713
|
export {
|