@edihasaj/recall 1.4.1 → 1.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -7
- package/dist/{chunk-WZWXYBP6.js → chunk-2E7UCWNS.js} +6 -3
- package/dist/{chunk-WZWXYBP6.js.map → chunk-2E7UCWNS.js.map} +1 -1
- package/dist/{chunk-JYWURG5T.js → chunk-5W3CDNJ6.js} +12 -2
- package/dist/chunk-5W3CDNJ6.js.map +1 -0
- package/dist/chunk-ADWOKDF6.js +23 -0
- package/dist/chunk-ADWOKDF6.js.map +1 -0
- package/dist/{chunk-CW3XJDH7.js → chunk-FDIV6YFT.js} +6 -2
- package/dist/{chunk-CW3XJDH7.js.map → chunk-FDIV6YFT.js.map} +1 -1
- package/dist/{chunk-EAFRT7RX.js → chunk-GMRT5DJZ.js} +7 -2
- package/dist/{chunk-EAFRT7RX.js.map → chunk-GMRT5DJZ.js.map} +1 -1
- package/dist/{chunk-PUMEMKGF.js → chunk-IMCI2CLJ.js} +7 -1
- package/dist/{chunk-PUMEMKGF.js.map → chunk-IMCI2CLJ.js.map} +1 -1
- package/dist/{chunk-ZBQGZCFL.js → chunk-KF3EGZWM.js} +99 -9
- package/dist/chunk-KF3EGZWM.js.map +1 -0
- package/dist/{chunk-NAYFAUSM.js → chunk-LCIVSUQO.js} +61 -21
- package/dist/chunk-LCIVSUQO.js.map +1 -0
- package/dist/{chunk-LWY4Z626.js → chunk-MESKBXZZ.js} +8 -4
- package/dist/{chunk-LWY4Z626.js.map → chunk-MESKBXZZ.js.map} +1 -1
- package/dist/{chunk-FHEH6QDU.js → chunk-PQOGHXET.js} +6 -1
- package/dist/{chunk-FHEH6QDU.js.map → chunk-PQOGHXET.js.map} +1 -1
- package/dist/{chunk-ZXCKMEJA.js → chunk-RRNELZJV.js} +11 -6
- package/dist/{chunk-ZXCKMEJA.js.map → chunk-RRNELZJV.js.map} +1 -1
- package/dist/{chunk-7CFX774S.js → chunk-SWPXUPMX.js} +306 -167
- package/dist/chunk-SWPXUPMX.js.map +1 -0
- package/dist/{chunk-T274LVWB.js → chunk-TZ4EU4SW.js} +15 -11
- package/dist/chunk-TZ4EU4SW.js.map +1 -0
- package/dist/chunk-UTOM43G2.js +594 -0
- package/dist/chunk-UTOM43G2.js.map +1 -0
- package/dist/{chunk-AFD43EOE.js → chunk-UZ4GFLH6.js} +8 -4
- package/dist/{chunk-AFD43EOE.js.map → chunk-UZ4GFLH6.js.map} +1 -1
- package/dist/{chunk-LUIYWYOT.js → chunk-VI6NOUXB.js} +51 -3
- package/dist/chunk-VI6NOUXB.js.map +1 -0
- package/dist/{chunk-TA4WSV6A.js → chunk-VZ456OCO.js} +204 -13
- package/dist/chunk-VZ456OCO.js.map +1 -0
- package/dist/{chunk-4UHRAQFG.js → chunk-ZECQ2LQB.js} +376 -58
- package/dist/chunk-ZECQ2LQB.js.map +1 -0
- package/dist/{cleanup-RTL2UETA.js → cleanup-KXCEVJ7V.js} +11 -10
- package/dist/cli.js +639 -784
- package/dist/cli.js.map +1 -1
- package/dist/codex-trust-H7VKP4G3.js +74 -0
- package/dist/codex-trust-H7VKP4G3.js.map +1 -0
- package/dist/daemon.js +174 -54
- package/dist/daemon.js.map +1 -1
- package/dist/dispatcher-GHC6RX54.js +22 -0
- package/dist/{embeddings-MILTROKW.js → embeddings-GYQBZWBD.js} +7 -5
- package/dist/ingest-6GDZNYCY.js +20 -0
- package/dist/{keychain-5KXUHKMF.js → keychain-TKPVUZCH.js} +3 -3
- package/dist/mcp.js +18 -14
- package/dist/mcp.js.map +1 -1
- package/dist/{memory-value-WXI2Q6TO.js → memory-value-A4UCC3DY.js} +11 -10
- package/dist/provenance-M5YFD6DO.js +50 -0
- package/dist/provenance-M5YFD6DO.js.map +1 -0
- package/dist/quality-TQ7CVPRO.js +25 -0
- package/dist/retrieval-7R5LKJAM.js +15 -0
- package/dist/{store-5C7ZKKZF.js → store-QKP6HQ45.js} +4 -4
- package/dist/sync-server.js +5 -2
- package/dist/sync-server.js.map +1 -1
- package/dist/{tasks-7SE6VHSQ.js → tasks-M5HSQSWK.js} +11 -10
- package/dist/{usage-VQ5LJCNH.js → usage-TQTOHPL7.js} +7 -4
- package/dist/{usage-VQ5LJCNH.js.map → usage-TQTOHPL7.js.map} +1 -1
- package/drizzle/0011_compact_telemetry_dedupe_keys.sql +25 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +15 -12
- package/dist/chunk-4UHRAQFG.js.map +0 -1
- package/dist/chunk-7CFX774S.js.map +0 -1
- package/dist/chunk-LUIYWYOT.js.map +0 -1
- package/dist/chunk-NAYFAUSM.js.map +0 -1
- package/dist/chunk-T274LVWB.js.map +0 -1
- package/dist/chunk-TA4WSV6A.js.map +0 -1
- package/dist/chunk-ZBQGZCFL.js.map +0 -1
- package/dist/dispatcher-PP5OKOLS.js +0 -21
- package/dist/ingest-HEXVIAL6.js +0 -19
- package/dist/quality-VKQUCL66.js +0 -24
- package/dist/retrieval-4MEIABHC.js +0 -14
- package/dist/tasks-7SE6VHSQ.js.map +0 -1
- /package/dist/{chunk-JYWURG5T.js.map → cleanup-KXCEVJ7V.js.map} +0 -0
- /package/dist/{cleanup-RTL2UETA.js.map → dispatcher-GHC6RX54.js.map} +0 -0
- /package/dist/{dispatcher-PP5OKOLS.js.map → embeddings-GYQBZWBD.js.map} +0 -0
- /package/dist/{embeddings-MILTROKW.js.map → ingest-6GDZNYCY.js.map} +0 -0
- /package/dist/{ingest-HEXVIAL6.js.map → keychain-TKPVUZCH.js.map} +0 -0
- /package/dist/{keychain-5KXUHKMF.js.map → memory-value-A4UCC3DY.js.map} +0 -0
- /package/dist/{memory-value-WXI2Q6TO.js.map → quality-TQ7CVPRO.js.map} +0 -0
- /package/dist/{quality-VKQUCL66.js.map → retrieval-7R5LKJAM.js.map} +0 -0
- /package/dist/{retrieval-4MEIABHC.js.map → store-QKP6HQ45.js.map} +0 -0
- /package/dist/{store-5C7ZKKZF.js.map → tasks-M5HSQSWK.js.map} +0 -0
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
matchTokens,
|
|
3
3
|
textMatchScore
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PQOGHXET.js";
|
|
5
5
|
import {
|
|
6
6
|
appendEvidence,
|
|
7
7
|
countDistinctCorrectionSessions,
|
|
8
8
|
createMemory,
|
|
9
|
-
defineOwn,
|
|
10
9
|
demoteMemory,
|
|
11
10
|
getMemory,
|
|
11
|
+
hasNonDurableProvenance,
|
|
12
12
|
incrementMemoryRepetition,
|
|
13
|
+
isGeneratedCaptureContext,
|
|
14
|
+
isTaskLimitedRule,
|
|
13
15
|
listMemories,
|
|
14
16
|
memoryDedupeKey,
|
|
15
17
|
normalizeDedupeText,
|
|
@@ -17,12 +19,16 @@ import {
|
|
|
17
19
|
queryMemories,
|
|
18
20
|
recordAudit,
|
|
19
21
|
recordAuditWithSnapshot,
|
|
22
|
+
rejectMemory,
|
|
20
23
|
restoreAutoInject,
|
|
21
24
|
updateMemoryCaptureContext
|
|
22
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-LCIVSUQO.js";
|
|
23
26
|
import {
|
|
24
27
|
desc
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-FDIV6YFT.js";
|
|
29
|
+
import {
|
|
30
|
+
defineOwn
|
|
31
|
+
} from "./chunk-ADWOKDF6.js";
|
|
26
32
|
import {
|
|
27
33
|
CONFIDENCE,
|
|
28
34
|
LlmCredentialError,
|
|
@@ -32,11 +38,11 @@ import {
|
|
|
32
38
|
findSimilarRejectedExemplar,
|
|
33
39
|
loadEmbeddingConfigFromEnv,
|
|
34
40
|
queueMemoryEmbeddingSync
|
|
35
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-KF3EGZWM.js";
|
|
36
42
|
import {
|
|
37
43
|
hasProviderConfigured,
|
|
38
44
|
init_keychain
|
|
39
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-2E7UCWNS.js";
|
|
40
46
|
import {
|
|
41
47
|
activityEvents,
|
|
42
48
|
and,
|
|
@@ -57,16 +63,184 @@ import {
|
|
|
57
63
|
memoryMaintenanceTasks,
|
|
58
64
|
or,
|
|
59
65
|
sql
|
|
60
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-VI6NOUXB.js";
|
|
67
|
+
import {
|
|
68
|
+
init_define_RECALL_BUILD_INFO
|
|
69
|
+
} from "./chunk-5W3CDNJ6.js";
|
|
61
70
|
|
|
62
71
|
// src/maintenance/tasks.ts
|
|
72
|
+
init_define_RECALL_BUILD_INFO();
|
|
63
73
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
64
74
|
import { z } from "zod";
|
|
65
75
|
|
|
66
76
|
// src/maintenance/appliers.ts
|
|
77
|
+
init_define_RECALL_BUILD_INFO();
|
|
67
78
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
68
79
|
|
|
80
|
+
// src/contradictions/supersession.ts
|
|
81
|
+
init_define_RECALL_BUILD_INFO();
|
|
82
|
+
var TOOL_FAMILIES = {
|
|
83
|
+
js_package_manager: {
|
|
84
|
+
npm: ["npm", "npx"],
|
|
85
|
+
pnpm: ["pnpm"],
|
|
86
|
+
yarn: ["yarn"],
|
|
87
|
+
bun: ["bun", "bunx"]
|
|
88
|
+
},
|
|
89
|
+
python_package_manager: {
|
|
90
|
+
pip: ["pip", "pip3"],
|
|
91
|
+
uv: ["uv", "uvx"],
|
|
92
|
+
poetry: ["poetry"],
|
|
93
|
+
pipenv: ["pipenv"]
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var BOUNDARY_BEFORE = "(?<![\\w./@-])";
|
|
97
|
+
var BOUNDARY_AFTER = "(?![\\w-])";
|
|
98
|
+
var QUOTE = "[`'\"]?";
|
|
99
|
+
var PREFER_VERBS = "(?:use|uses|using|prefer|prefers|switch(?:ed)? to|migrate(?:d)? to|moved to|standardi[sz]e on)";
|
|
100
|
+
var FORBID_LEADS = "(?:never|don't|do not|avoid|stop|no longer)\\s+(?:use|using|run|running|call|calling)?\\s*";
|
|
101
|
+
var REPLACE_LEADS = "(?:instead of|rather than|over|not)\\s+(?:[`'\"]?[\\w.-]+[`'\"]?\\s*(?:,|/|\\bor\\b|\\band\\b)\\s*){0,3}";
|
|
102
|
+
function tokenRegex(token) {
|
|
103
|
+
return `${BOUNDARY_BEFORE}${QUOTE}${token}${QUOTE}${BOUNDARY_AFTER}`;
|
|
104
|
+
}
|
|
105
|
+
var SUBCOMMAND = /^\s*(?:run|install|i|add|ci|exec|test|build|dlx|x|publish|remove|rm|update|up|upgrade|sync|lint|start|dev|audit|link|pack|init|create|pip|-{1,2}\w)\b/i;
|
|
106
|
+
var QUALIFIER = /^\s*[`'"]?\s*(?:for|when|in|on|during|with)\s+([^.;\n]+)/i;
|
|
107
|
+
var GENERAL_QUALIFIER = /\b(?:package|dependenc|install|this (?:repo|repository|project)|the (?:repo|repository|project)|all\b|every|monorepo|workspace|python|node|javascript|js\b|typescript|tooling|backend|frontend)/i;
|
|
108
|
+
function insideCommandSpan(text, index) {
|
|
109
|
+
for (const span of text.matchAll(/`([^`]*)`/g)) {
|
|
110
|
+
const start = span.index ?? 0;
|
|
111
|
+
const end = start + span[0].length;
|
|
112
|
+
if (index > start && index < end && /\s/.test(span[1].trim())) return true;
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
function familyStance(text, family) {
|
|
117
|
+
const stance = { prefers: /* @__PURE__ */ new Set(), forbids: /* @__PURE__ */ new Set(), mentions: /* @__PURE__ */ new Set(), scoped: /* @__PURE__ */ new Set() };
|
|
118
|
+
for (const [tool, tokens2] of Object.entries(family)) {
|
|
119
|
+
for (const token of tokens2) {
|
|
120
|
+
const tok = tokenRegex(token);
|
|
121
|
+
if (!new RegExp(tok).test(text)) continue;
|
|
122
|
+
stance.mentions.add(tool);
|
|
123
|
+
const forbid = new RegExp(`\\b${FORBID_LEADS}${tok}`, "i");
|
|
124
|
+
const replaced = new RegExp(`\\b${REPLACE_LEADS}${tok}`, "i");
|
|
125
|
+
if (forbid.test(text) || replaced.test(text)) {
|
|
126
|
+
stance.forbids.add(tool);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const verb = new RegExp(`\\b${PREFER_VERBS}\\s+(?:the\\s+)?${tok}`, "gi");
|
|
130
|
+
const lead = new RegExp(`(?:^|[.;:!?]\\s*)${tok}\\s+(?:only|instead of|rather than|over|not)\\b`, "i");
|
|
131
|
+
for (const match of text.matchAll(verb)) {
|
|
132
|
+
const at = (match.index ?? 0) + match[0].length;
|
|
133
|
+
if (insideCommandSpan(text, at - 1)) continue;
|
|
134
|
+
const tail = text.slice(at);
|
|
135
|
+
if (SUBCOMMAND.test(tail)) continue;
|
|
136
|
+
const qualifier = tail.match(QUALIFIER);
|
|
137
|
+
if (qualifier && !GENERAL_QUALIFIER.test(qualifier[1])) {
|
|
138
|
+
stance.scoped.add(tool);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
stance.prefers.add(tool);
|
|
142
|
+
}
|
|
143
|
+
if (lead.test(text)) stance.prefers.add(tool);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
for (const tool of stance.forbids) stance.prefers.delete(tool);
|
|
147
|
+
return stance;
|
|
148
|
+
}
|
|
149
|
+
function preferred(stance) {
|
|
150
|
+
return stance.prefers.size === 1 ? [...stance.prefers][0] : null;
|
|
151
|
+
}
|
|
152
|
+
var HUMAN_SOURCES = /* @__PURE__ */ new Set(["user_correction", "user_reported_review"]);
|
|
153
|
+
var LIVE = ["active", "candidate"];
|
|
154
|
+
function scopeCovers(newer, older) {
|
|
155
|
+
const broad = (s) => s === "global" || s === "team";
|
|
156
|
+
if (broad(newer.scope)) return broad(older.scope);
|
|
157
|
+
if (broad(older.scope)) return false;
|
|
158
|
+
if (newer.repo && older.repo && newer.repo !== older.repo) return false;
|
|
159
|
+
if (newer.scope === "repo") return older.scope === "repo" || older.scope === "path";
|
|
160
|
+
if (newer.scope === "path") {
|
|
161
|
+
if (older.scope !== "path") return false;
|
|
162
|
+
const root = (newer.path_scope ?? "").replace(/\/?\*\*$/, "");
|
|
163
|
+
return !root || (older.path_scope ?? "").startsWith(root);
|
|
164
|
+
}
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
function supersessionVerdict(newer, older, rippleAllowed = true) {
|
|
168
|
+
for (const [familyName, family] of Object.entries(TOOL_FAMILIES)) {
|
|
169
|
+
const n = familyStance(newer.text, family);
|
|
170
|
+
const chosen = preferred(n);
|
|
171
|
+
const retired = new Set(n.forbids);
|
|
172
|
+
if (!chosen && retired.size === 0) continue;
|
|
173
|
+
const o = familyStance(older.text, family);
|
|
174
|
+
if (o.mentions.size === 0) continue;
|
|
175
|
+
const olderChoice = preferred(o);
|
|
176
|
+
const conflictsWithChoice = chosen && (olderChoice && olderChoice !== chosen || o.forbids.has(chosen));
|
|
177
|
+
const choosesRetired = olderChoice && retired.has(olderChoice);
|
|
178
|
+
if (conflictsWithChoice || choosesRetired) {
|
|
179
|
+
return {
|
|
180
|
+
action: "superseded",
|
|
181
|
+
family: familyName,
|
|
182
|
+
reason: `superseded by newer ${familyName} choice: ${chosen ?? `not ${[...retired].join("/")}`}`
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
if (!rippleAllowed) continue;
|
|
186
|
+
if (olderChoice || o.prefers.size > 0 || o.forbids.size > 0 || o.scoped.size > 0) continue;
|
|
187
|
+
const stale = [...o.mentions].filter(
|
|
188
|
+
(tool) => chosen ? tool !== chosen : retired.has(tool)
|
|
189
|
+
);
|
|
190
|
+
if (stale.length === o.mentions.size && stale.length > 0 && (!chosen || !o.mentions.has(chosen))) {
|
|
191
|
+
return {
|
|
192
|
+
action: "rippled",
|
|
193
|
+
family: familyName,
|
|
194
|
+
reason: `depends on ${stale.join("/")}, which a newer ${familyName} choice retired`
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
function applySupersession(db, newerId) {
|
|
201
|
+
const newer = getMemory(db, newerId);
|
|
202
|
+
if (!newer || !LIVE.includes(newer.status)) return [];
|
|
203
|
+
const newerIsHuman = HUMAN_SOURCES.has(newer.source);
|
|
204
|
+
const broad = newer.scope === "global" || newer.scope === "team";
|
|
205
|
+
const pool = (broad ? [...queryMemories(db, { scope: "global" }), ...queryMemories(db, { scope: "team" })] : newer.repo ? queryMemories(db, { repo: newer.repo }) : []).filter((m) => m.id !== newer.id && LIVE.includes(m.status));
|
|
206
|
+
const seen = /* @__PURE__ */ new Set();
|
|
207
|
+
const changes = [];
|
|
208
|
+
for (const older of pool) {
|
|
209
|
+
if (seen.has(older.id)) continue;
|
|
210
|
+
seen.add(older.id);
|
|
211
|
+
if (older.created_at > newer.created_at && older.updated_at > newer.updated_at) continue;
|
|
212
|
+
if (!scopeCovers(newer, older)) continue;
|
|
213
|
+
if (!newerIsHuman && older.source !== "config_parse") continue;
|
|
214
|
+
const verdict = supersessionVerdict(newer, older, newerIsHuman);
|
|
215
|
+
if (!verdict) continue;
|
|
216
|
+
const reason = `${verdict.reason} (by ${newer.id.slice(0, 8)}: "${newer.text.slice(0, 120)}")`;
|
|
217
|
+
if (verdict.action === "superseded") {
|
|
218
|
+
rejectMemory(db, older.id, "supersession");
|
|
219
|
+
recordAudit(db, older.id, "contradiction_resolved", "supersession", reason);
|
|
220
|
+
} else {
|
|
221
|
+
if (older.status !== "active") continue;
|
|
222
|
+
const before = getMemory(db, older.id);
|
|
223
|
+
demoteMemory(db, older.id, verdict.reason);
|
|
224
|
+
recordAuditWithSnapshot(db, older.id, "demoted", "supersession", reason, before ?? null, getMemory(db, older.id) ?? null);
|
|
225
|
+
}
|
|
226
|
+
changes.push({ memory_id: older.id, ...verdict });
|
|
227
|
+
}
|
|
228
|
+
const firstSuperseded = changes.find((c) => c.action === "superseded");
|
|
229
|
+
if (firstSuperseded && !newer.supersedes) {
|
|
230
|
+
db.update(memories).set({ supersedes: firstSuperseded.memory_id }).where(and(eq(memories.id, newer.id), inArray(memories.status, [...LIVE]))).run();
|
|
231
|
+
queueMemoryEmbeddingSync(db, newer.id);
|
|
232
|
+
}
|
|
233
|
+
return changes;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// src/capture/correction.ts
|
|
237
|
+
init_define_RECALL_BUILD_INFO();
|
|
238
|
+
|
|
239
|
+
// src/repo/quality.ts
|
|
240
|
+
init_define_RECALL_BUILD_INFO();
|
|
241
|
+
|
|
69
242
|
// src/health/scoring.ts
|
|
243
|
+
init_define_RECALL_BUILD_INFO();
|
|
70
244
|
var WEIGHTS = {
|
|
71
245
|
confidence: 0.4,
|
|
72
246
|
freshness: 0.25,
|
|
@@ -290,6 +464,7 @@ function clamp2(n, min = 0, max = 1) {
|
|
|
290
464
|
}
|
|
291
465
|
|
|
292
466
|
// src/maintenance/dispatcher.ts
|
|
467
|
+
init_define_RECALL_BUILD_INFO();
|
|
293
468
|
init_keychain();
|
|
294
469
|
var DISPATCH_AGENT = "recall:dispatcher";
|
|
295
470
|
var DEFAULT_LEASE_SECONDS = 120;
|
|
@@ -448,8 +623,8 @@ async function runSingle(db, task, provider, model) {
|
|
|
448
623
|
function hasAnyLlmProvider() {
|
|
449
624
|
return resolveProvider() != null;
|
|
450
625
|
}
|
|
451
|
-
function resolveProvider(
|
|
452
|
-
const candidates =
|
|
626
|
+
function resolveProvider(preferred2) {
|
|
627
|
+
const candidates = preferred2 ? [preferred2] : ["anthropic", "azure-openai", "openai"];
|
|
453
628
|
for (const provider of candidates) {
|
|
454
629
|
if (hasProviderConfigured(provider)) return provider;
|
|
455
630
|
}
|
|
@@ -675,6 +850,7 @@ function formatDispatchReport(report) {
|
|
|
675
850
|
import { createHash } from "crypto";
|
|
676
851
|
|
|
677
852
|
// src/capture/scope.ts
|
|
853
|
+
init_define_RECALL_BUILD_INFO();
|
|
678
854
|
import { existsSync, readFileSync } from "fs";
|
|
679
855
|
import { dirname, extname, basename, join } from "path";
|
|
680
856
|
var SCOPE_MARKERS = [
|
|
@@ -935,9 +1111,11 @@ function inferFromGitOwnership(filePath, repoPath) {
|
|
|
935
1111
|
}
|
|
936
1112
|
|
|
937
1113
|
// src/maintenance/cleanup.ts
|
|
1114
|
+
init_define_RECALL_BUILD_INFO();
|
|
938
1115
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
939
1116
|
|
|
940
1117
|
// src/contradictions/detector.ts
|
|
1118
|
+
init_define_RECALL_BUILD_INFO();
|
|
941
1119
|
import { randomUUID } from "crypto";
|
|
942
1120
|
function countContradictionCandidates(db, repo) {
|
|
943
1121
|
const conditions = [inArray(memories.status, ["active", "candidate"])];
|
|
@@ -1150,6 +1328,7 @@ function wordOverlap(a, b) {
|
|
|
1150
1328
|
}
|
|
1151
1329
|
|
|
1152
1330
|
// src/capture/context.ts
|
|
1331
|
+
init_define_RECALL_BUILD_INFO();
|
|
1153
1332
|
var SYSTEM_SCAFFOLD_RE = /(?:^\s*[⏺⎿❯✻※]|<\/?task-notification>|task-notification|hook activity|\[correction_summary\]|correction_summary|session(?:start| start| end) hook|stop hook|<system-reminder>|<\/?command-(?:name|message)>|recent_tool_calls|probeport qa agent contract|you extract durable memory candidates for a personal agent runtime|required schema_version:\s*memory_extraction|##\s*(?:run context|scout assignment|lead verifier assignment|available tool commands|mapped local files|allowed secret environment names))/i;
|
|
1154
1333
|
var NON_USER_CONTEXT_RE = /\b(?:sub-?agent (?:context|transcript|output|notification)|(?:during|after) compaction|compaction (?:context|summary|transcript)|compacting (?:the )?(?:context|conversation)|system repair (?:context|transcript)|self[- ]repair context|repair context|cron context)\b/i;
|
|
1155
1334
|
var INJECTION_ARTIFACT_RE = new RegExp(
|
|
@@ -1200,6 +1379,7 @@ function changeControlClauses(text) {
|
|
|
1200
1379
|
return text.split(/(?:\r?\n|[.!?;])+/).map((clause) => clause.trim()).filter((clause) => /\b(?:commit|push|committing|pushing)\b/i.test(clause));
|
|
1201
1380
|
}
|
|
1202
1381
|
function isEphemeralTaskConstraint(ruleText, rawPrompt) {
|
|
1382
|
+
if (isTaskLimitedRule(ruleText)) return true;
|
|
1203
1383
|
if (!GENERIC_CHANGE_CONTROL_RE.test(ruleText)) return false;
|
|
1204
1384
|
if (/\b(?:secret|credential|token|private key|\.env|config(?:uration)?|generated file|lockfile)s?\b/i.test(ruleText)) {
|
|
1205
1385
|
return false;
|
|
@@ -1226,10 +1406,11 @@ function looksLikeQuestionContext(text) {
|
|
|
1226
1406
|
return /\?\s*$/.test(text.trim()) || /(?:^|[.!?]\s+)(?:how|why|what|where|which|who|can|could|should|would|do|does|did|is|are|was|were|have|has)\b/i.test(text);
|
|
1227
1407
|
}
|
|
1228
1408
|
function isNonUserCaptureContext(text) {
|
|
1229
|
-
return SYSTEM_SCAFFOLD_RE.test(text) || NON_USER_CONTEXT_RE.test(text) || INJECTION_ARTIFACT_RE.test(text) || EPHEMERAL_TASK_CONTEXT_RE.test(text) || looksLikePastedOperationalReport(text) || LLM_WORKER_PROMPT_RE.test(text) || CODEX_INTERNAL_PROMPT_RE.test(text) || looksLikeQuestionContext(text);
|
|
1409
|
+
return isGeneratedCaptureContext(text) || SYSTEM_SCAFFOLD_RE.test(text) || NON_USER_CONTEXT_RE.test(text) || INJECTION_ARTIFACT_RE.test(text) || EPHEMERAL_TASK_CONTEXT_RE.test(text) || looksLikePastedOperationalReport(text) || LLM_WORKER_PROMPT_RE.test(text) || CODEX_INTERNAL_PROMPT_RE.test(text) || looksLikeQuestionContext(text);
|
|
1230
1410
|
}
|
|
1231
1411
|
|
|
1232
1412
|
// src/scanner/signal.ts
|
|
1413
|
+
init_define_RECALL_BUILD_INFO();
|
|
1233
1414
|
var ACTIVE_COMMAND_PATTERNS = [
|
|
1234
1415
|
/^use\b/i
|
|
1235
1416
|
];
|
|
@@ -1960,6 +2141,8 @@ function planPromoteRepeats(db) {
|
|
|
1960
2141
|
const out = [];
|
|
1961
2142
|
for (const row of rows) {
|
|
1962
2143
|
const text = row.text.trim();
|
|
2144
|
+
const memory = getMemory(db, row.id);
|
|
2145
|
+
if (!memory || hasNonDurableProvenance(memory)) continue;
|
|
1963
2146
|
if (row.scope === "session") continue;
|
|
1964
2147
|
if (qualityReasons(text).length > 0) continue;
|
|
1965
2148
|
if (isDestructiveRisky(text)) continue;
|
|
@@ -1971,7 +2154,7 @@ function planPromoteRepeats(db) {
|
|
|
1971
2154
|
}
|
|
1972
2155
|
function applyPromoteRepeat(db, runId, plan) {
|
|
1973
2156
|
const before = getMemory(db, plan.memory_id);
|
|
1974
|
-
if (!before || before.status !== "candidate") return;
|
|
2157
|
+
if (!before || before.status !== "candidate" || hasNonDurableProvenance(before)) return;
|
|
1975
2158
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1976
2159
|
db.update(memories).set({ status: "active", confidence: Math.max(before.confidence, 0.7), updated_at: now, last_validated_at: now }).where(eq(memories.id, plan.memory_id)).run();
|
|
1977
2160
|
const after = getMemory(db, plan.memory_id);
|
|
@@ -2312,6 +2495,7 @@ function truncate(s, n) {
|
|
|
2312
2495
|
}
|
|
2313
2496
|
|
|
2314
2497
|
// src/security/redaction.ts
|
|
2498
|
+
init_define_RECALL_BUILD_INFO();
|
|
2315
2499
|
var SECRET_PATTERNS = [
|
|
2316
2500
|
[/\b(Authorization\s*:\s*Bearer\s+)[^\s"'\\]+/gi, "$1[REDACTED]"],
|
|
2317
2501
|
[/\b(api-key\s*:\s*)[^\s"'\\]+/gi, "$1[REDACTED]"],
|
|
@@ -2607,6 +2791,7 @@ async function processCorrection(db, text, ctx) {
|
|
|
2607
2791
|
after ?? null
|
|
2608
2792
|
);
|
|
2609
2793
|
}
|
|
2794
|
+
applySupersession(db, duplicate.id);
|
|
2610
2795
|
ids.push(duplicate.id);
|
|
2611
2796
|
continue;
|
|
2612
2797
|
}
|
|
@@ -2636,6 +2821,7 @@ async function processCorrection(db, text, ctx) {
|
|
|
2636
2821
|
capture_context: captureContext
|
|
2637
2822
|
};
|
|
2638
2823
|
const id = createMemory(db, input);
|
|
2824
|
+
applySupersession(db, id);
|
|
2639
2825
|
enqueueVerifyCapture(db, {
|
|
2640
2826
|
id,
|
|
2641
2827
|
text: input.text,
|
|
@@ -3037,7 +3223,7 @@ function applyExtractRulesFromPrompt(db, task, result) {
|
|
|
3037
3223
|
const payload = task.payload;
|
|
3038
3224
|
const repo = payload.repo ?? null;
|
|
3039
3225
|
const profile = getRepoQualityProfile(db, repo ?? void 0);
|
|
3040
|
-
if (!result.rules || result.rules.length === 0) {
|
|
3226
|
+
if (!result.rules || result.rules.length === 0 || isNonUserCaptureContext(payload.raw_prompt ?? "")) {
|
|
3041
3227
|
return { audit_entry_id: null, target_id: task.id, changed_fields: [] };
|
|
3042
3228
|
}
|
|
3043
3229
|
const captureContext = {
|
|
@@ -3092,6 +3278,7 @@ function applyExtractRulesFromPrompt(db, task, result) {
|
|
|
3092
3278
|
after2 ?? null
|
|
3093
3279
|
);
|
|
3094
3280
|
}
|
|
3281
|
+
applySupersession(db, duplicate.id);
|
|
3095
3282
|
reinforcedIds.push(duplicate.id);
|
|
3096
3283
|
continue;
|
|
3097
3284
|
}
|
|
@@ -3108,6 +3295,7 @@ function applyExtractRulesFromPrompt(db, task, result) {
|
|
|
3108
3295
|
capture_context: captureContext
|
|
3109
3296
|
});
|
|
3110
3297
|
createdIds.push(id);
|
|
3298
|
+
applySupersession(db, id);
|
|
3111
3299
|
const after = getMemory(db, id);
|
|
3112
3300
|
recordAuditWithSnapshot(
|
|
3113
3301
|
db,
|
|
@@ -3945,6 +4133,9 @@ export {
|
|
|
3945
4133
|
formatHealthReport,
|
|
3946
4134
|
getRepoQualityProfile,
|
|
3947
4135
|
seedScannedConfidence,
|
|
4136
|
+
applySupersession,
|
|
4137
|
+
isEphemeralTaskConstraint,
|
|
4138
|
+
isNonUserCaptureContext,
|
|
3948
4139
|
DEFAULT_LEASE_SECONDS2 as DEFAULT_LEASE_SECONDS,
|
|
3949
4140
|
DEFAULT_PRIORITIES,
|
|
3950
4141
|
DEFAULT_ENQUEUE_CONFIG,
|
|
@@ -4009,4 +4200,4 @@ export {
|
|
|
4009
4200
|
processCorrection,
|
|
4010
4201
|
processReviewFeedback
|
|
4011
4202
|
};
|
|
4012
|
-
//# sourceMappingURL=chunk-
|
|
4203
|
+
//# sourceMappingURL=chunk-VZ456OCO.js.map
|