@cortexkit/pi-magic-context 0.49.34 → 0.49.36

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 (73) hide show
  1. package/dist/auto-search-worker.js +163 -155
  2. package/dist/chunk-embedding-write-worker.js +71 -66
  3. package/dist/{compaction-marker-candidates-p1kqkqhq.js → compaction-marker-candidates-9fzqg6y0.js} +6 -3
  4. package/dist/compaction-marker-candidates-worker.js +24 -23
  5. package/dist/{compartment-chunk-embedding-8c85ebce.js → compartment-chunk-embedding-jpcme6tz.js} +11 -9
  6. package/dist/embedding-backfill-002vyexq.js +27 -0
  7. package/dist/embedding-worker-process.js +2 -1
  8. package/dist/embedding-worker.js +5 -4
  9. package/dist/expand-attachments-8sxeyj26.js +21 -0
  10. package/dist/historian-calibration-extension.js +2 -1
  11. package/dist/{index-hqw0rt9k.js → index-0wtm7g7f.js} +1 -1
  12. package/dist/{index-wqpjhx1p.js → index-2qqsnh1b.js} +2 -2
  13. package/dist/index-3bb24eb6.js +229 -0
  14. package/dist/{index-48twbev2.js → index-6pk49fc3.js} +37 -51
  15. package/dist/{index-399p688g.js → index-8sqebjzk.js} +4 -1
  16. package/dist/{index-np9ryr8y.js → index-a7sj2bam.js} +24 -241
  17. package/dist/index-by1bzjcd.js +24 -0
  18. package/dist/{index-6981g1xv.js → index-c1dqxr10.js} +35 -5
  19. package/dist/index-c6wbq66z.js +168 -0
  20. package/dist/{index-bvpar0bg.js → index-ck8wj35v.js} +2 -2
  21. package/dist/{index-jn44h81p.js → index-cq71g4dk.js} +1 -1
  22. package/dist/{index-pb3ea2tq.js → index-d107f484.js} +5 -5
  23. package/dist/{index-f4fz95fy.js → index-dgqjq8sg.js} +398 -4996
  24. package/dist/index-dnp1jjar.js +222 -0
  25. package/dist/index-ea37qn4x.js +777 -0
  26. package/dist/{index-g2tfayfc.js → index-f6y7mdq9.js} +98 -552
  27. package/dist/{index-0gymvr5j.js → index-f9qet7y8.js} +19 -8
  28. package/dist/index-gxqmh9hq.js +194 -0
  29. package/dist/{index-fgs78jyd.js → index-gymgz20n.js} +5 -222
  30. package/dist/index-hgd00nas.js +113 -0
  31. package/dist/{index-9xd7qveg.js → index-jbkwszd5.js} +4 -4
  32. package/dist/{index-e61zxfts.js → index-kj49vs41.js} +4 -4
  33. package/dist/{index-4zemngt7.js → index-mp0gh04g.js} +2 -2
  34. package/dist/{index-eenxm3t3.js → index-mx757f3g.js} +51 -32
  35. package/dist/{index-23t8ryqw.js → index-n0zjvs3h.js} +1 -168
  36. package/dist/index-nypgv96r.js +58 -0
  37. package/dist/index-p9jfa33t.js +4171 -0
  38. package/dist/{index-eqw9t2ty.js → index-pwp6zyx3.js} +15 -4
  39. package/dist/{index-cj3bkd16.js → index-ry84c8dr.js} +2 -2
  40. package/dist/{index-gwxaz0z5.js → index-rzfr7wdv.js} +2 -2
  41. package/dist/index-w26zvs1q.js +528 -0
  42. package/dist/index-wfqysrwq.js +204 -0
  43. package/dist/index-wrr9rp9a.js +16 -0
  44. package/dist/{index-my0dn413.js → index-wt7vmyj4.js} +1 -1
  45. package/dist/{index-0mc0vv97.js → index-wwsfevck.js} +8 -5
  46. package/dist/{index-54wmg4rj.js → index-x2n261wp.js} +16 -14
  47. package/dist/{index-6wdwv3a6.js → index-y90fxz4t.js} +10 -4
  48. package/dist/{index-c474g0gj.js → index-yacs388s.js} +1 -1
  49. package/dist/{index-xn5yh0pn.js → index-z7dktknj.js} +34 -131
  50. package/dist/index.js +1316 -488
  51. package/dist/{logger-shetp43v.js → logger-2j70hhz4.js} +2 -1
  52. package/dist/{message-fts-rowid-map-3mbvdgn9.js → message-fts-rowid-map-hmgyfxxa.js} +8 -6
  53. package/dist/{message-index-bounded-a6na71rg.js → message-index-bounded-82sergz7.js} +15 -12
  54. package/dist/{message-time-backfill-e3r8ddh1.js → message-time-backfill-x45573rs.js} +3 -2
  55. package/dist/migration-worker.js +56 -48
  56. package/dist/{project-embedding-registry-acqb6be4.js → project-embedding-registry-16pj4vyf.js} +16 -13
  57. package/dist/raw-ordinal-warmup-worker.js +114 -113
  58. package/dist/{read-session-chunk-2xcp6f40.js → read-session-chunk-jxq427v6.js} +17 -10
  59. package/dist/{read-session-raw-g9b1zdn5.js → read-session-raw-a9ntjqap.js} +6 -4
  60. package/dist/render-2wan3bfh.js +42 -0
  61. package/dist/{safe-notification-target-zcpchea6.js → safe-notification-target-jk69jxwp.js} +3 -2
  62. package/dist/search-3p18trsb.js +50 -0
  63. package/dist/search-archive-pgrv04gv.js +25 -0
  64. package/dist/{storage-tags-6409qq18.js → storage-tags-p9y3bnw7.js} +5 -4
  65. package/dist/store-reader-2m80zs5z.js +14 -0
  66. package/dist/store-v60q7dje.js +452 -0
  67. package/dist/subagent-entry.js +34 -25
  68. package/dist/tag-snapshot-worker-pi.js +218 -209
  69. package/dist/v2-archive-reader-5zpj8hrg.js +11 -0
  70. package/package.json +1 -1
  71. package/dist/embedding-backfill-rwfmyvze.js +0 -24
  72. package/dist/search-archive-jate39w5.js +0 -21
  73. package/dist/search-b6hp64hc.js +0 -45
@@ -1,48 +1,37 @@
1
1
  import {
2
- getHarness2
3
- } from "./index-0h2mkab2.js";
4
- import {
5
- inRootAsyncContext2,
6
- getSqliteDatabasePath2,
7
- withSqliteBackgroundWriter2,
8
- isTransientSqliteError2,
9
- indexCoordinationInput2
10
- } from "./index-2qtx0q6h.js";
2
+ sanitizeDiagnosticText
3
+ } from "./index-dnp1jjar.js";
11
4
  import {
12
5
  PROMOTABLE_CATEGORIES,
13
6
  CATEGORY_DEFAULT_TTL
14
7
  } from "./index-135e8hvg.js";
8
+ import {
9
+ getHarness2
10
+ } from "./index-0h2mkab2.js";
15
11
  import {
16
12
  getDataDir,
17
- sanitizeDiagnosticText,
18
13
  log2,
19
14
  sessionLog2
20
- } from "./index-fgs78jyd.js";
21
- import {
22
- resolveWorkspaceShareCategories,
23
- resolveWorkspaceIdentitySet,
24
- expandWorkspaceIdentitySetWithAliases,
25
- resolveStoredPathWorkspaceIdentity,
26
- sourceNameForMemory,
27
- managedAuthorityNoteRow
28
- } from "./index-pb3ea2tq.js";
29
- import {
30
- scheduleAfterBootQuiet
31
- } from "./index-48twbev2.js";
15
+ } from "./index-gymgz20n.js";
32
16
  import {
33
17
  SubcClient
34
- } from "./index-gwxaz0z5.js";
18
+ } from "./index-rzfr7wdv.js";
19
+ import {
20
+ inRootAsyncContext2,
21
+ getSqliteDatabasePath2,
22
+ withSqliteBackgroundWriter2,
23
+ indexCoordinationInput2
24
+ } from "./index-2qtx0q6h.js";
35
25
  import {
36
26
  runSessionWarmupWorker
37
- } from "./index-6981g1xv.js";
27
+ } from "./index-c1dqxr10.js";
38
28
  import {
39
29
  buildCanonicalChunkTextFromFts2,
40
30
  loadCompartmentChunkEmbeddingsForSearch2,
41
31
  peekCompartmentChunkSearchPool2,
42
32
  warmCompartmentChunkSearchPool2
43
- } from "./index-0gymvr5j.js";
33
+ } from "./index-f9qet7y8.js";
44
34
  import {
45
- recordEmbeddingMeasurement,
46
35
  saveCommitEmbedding,
47
36
  loadProjectCommitEmbeddings,
48
37
  loadUnembeddedCommits,
@@ -58,7 +47,13 @@ import {
58
47
  getProjectEmbeddingSnapshot2,
59
48
  embedTextForProject2,
60
49
  embedItemsForProject2
61
- } from "./index-xn5yh0pn.js";
50
+ } from "./index-z7dktknj.js";
51
+ import {
52
+ recordEmbeddingMeasurement
53
+ } from "./index-hgd00nas.js";
54
+ import {
55
+ scheduleAfterBootQuiet
56
+ } from "./index-6pk49fc3.js";
62
57
  import {
63
58
  saveEmbeddingIfHashMatches,
64
59
  getProjectEmbeddings2
@@ -68,7 +63,7 @@ import {
68
63
  isEmbeddingEnabled,
69
64
  embedText,
70
65
  ensureMemoryEmbeddings2
71
- } from "./index-9xd7qveg.js";
66
+ } from "./index-jbkwszd5.js";
72
67
  import {
73
68
  getMemorySelectColumns2,
74
69
  isMemoryRow2,
@@ -96,11 +91,22 @@ import {
96
91
  clearIndexedMessages,
97
92
  indexSingleMessage,
98
93
  indexMessagesAfterOrdinal
99
- } from "./index-e61zxfts.js";
94
+ } from "./index-kj49vs41.js";
100
95
  import {
101
96
  MESSAGE_FTS_SESSION_FILTER_SQL,
102
97
  withMessageFtsSessionFilter
103
98
  } from "./index-1cvyaw9a.js";
99
+ import {
100
+ resolveWorkspaceShareCategories,
101
+ resolveWorkspaceIdentitySet,
102
+ expandWorkspaceIdentitySetWithAliases,
103
+ resolveStoredPathWorkspaceIdentity,
104
+ sourceNameForMemory
105
+ } from "./index-d107f484.js";
106
+ import {
107
+ getNotes,
108
+ getActivePrimers
109
+ } from "./index-w26zvs1q.js";
104
110
  import {
105
111
  computeNormalizedHash
106
112
  } from "./index-9x1f96r8.js";
@@ -108,523 +114,6 @@ import {
108
114
  isKnownAutocommit
109
115
  } from "./index-nrzkqte4.js";
110
116
 
111
- // ../plugin/src/features/magic-context/storage-notes.ts
112
- var NOTE_TYPES = new Set(["session", "smart"]);
113
- var NOTE_STATUSES = new Set(["active", "pending", "ready", "dismissed"]);
114
- var NOTE_CHECK_STATUSES = new Set([
115
- "uncompiled",
116
- "compiled",
117
- "failing",
118
- "fallback",
119
- "parked"
120
- ]);
121
- var CONDITION_COMPILE_STATUSES = new Set([
122
- "compiled",
123
- "plain",
124
- "refused"
125
- ]);
126
- var DEFAULT_SMART_STATUSES = ["pending", "ready"];
127
- function toNullableString(value) {
128
- return typeof value === "string" && value.length > 0 ? value : null;
129
- }
130
- function toNullableNumber(value) {
131
- return typeof value === "number" ? value : null;
132
- }
133
- function isNoteRow(row) {
134
- if (row === null || typeof row !== "object")
135
- return false;
136
- const candidate = row;
137
- return typeof candidate.id === "number" && typeof candidate.type === "string" && NOTE_TYPES.has(candidate.type) && typeof candidate.status === "string" && NOTE_STATUSES.has(candidate.status) && typeof candidate.content === "string" && (candidate.session_id === null || typeof candidate.session_id === "string") && (candidate.project_path === null || typeof candidate.project_path === "string") && (candidate.surface_condition === null || typeof candidate.surface_condition === "string") && typeof candidate.created_at === "number" && typeof candidate.updated_at === "number" && (candidate.last_checked_at === null || typeof candidate.last_checked_at === "number") && (candidate.ready_at === null || typeof candidate.ready_at === "number") && (candidate.ready_reason === null || typeof candidate.ready_reason === "string");
138
- }
139
- function toNote(row) {
140
- return {
141
- id: row.id,
142
- type: row.type,
143
- status: row.status,
144
- content: row.content,
145
- sessionId: toNullableString(row.session_id),
146
- projectPath: toNullableString(row.project_path),
147
- surfaceCondition: toNullableString(row.surface_condition),
148
- compiledProvider: toNullableString(row.compiled_provider),
149
- compiledConfig: toNullableString(row.compiled_config),
150
- compiledAt: toNullableNumber(row.compiled_at),
151
- compileStatus: typeof row.compile_status === "string" && CONDITION_COMPILE_STATUSES.has(row.compile_status) ? row.compile_status : null,
152
- createdAt: row.created_at,
153
- updatedAt: row.updated_at,
154
- lastCheckedAt: toNullableNumber(row.last_checked_at),
155
- readyAt: toNullableNumber(row.ready_at),
156
- readyReason: toNullableString(row.ready_reason),
157
- anchorOrdinal: toNullableNumber(row.anchor_ordinal),
158
- compiledCheck: toNullableString(row.compiled_check),
159
- manifestJson: toNullableString(row.manifest_json),
160
- checkHash: toNullableString(row.check_hash),
161
- checkCron: toNullableString(row.check_cron),
162
- checkVersion: toNullableNumber(row.check_version),
163
- checkStatus: typeof row.check_status === "string" && NOTE_CHECK_STATUSES.has(row.check_status) ? row.check_status : null,
164
- checkFailureCount: toNullableNumber(row.check_failure_count) ?? 0,
165
- checkNetworkFailureCount: toNullableNumber(row.check_network_failure_count) ?? 0,
166
- checkQuarantinedUntil: toNullableNumber(row.check_quarantined_until),
167
- checkNextDueAt: toNullableNumber(row.check_next_due_at),
168
- checkCompiledAt: toNullableNumber(row.check_compiled_at),
169
- checkFalseSinceAt: toNullableNumber(row.check_false_since_at),
170
- checkLastLivenessAt: toNullableNumber(row.check_last_liveness_at),
171
- policyVersion: toNullableNumber(row.policy_version)
172
- };
173
- }
174
- function noteCheckColumnsExist(db) {
175
- try {
176
- const rows = db.prepare("PRAGMA table_info(notes)").all();
177
- return rows.some((row) => row.name === "compiled_check");
178
- } catch {
179
- return false;
180
- }
181
- }
182
- var PENDING_SESSION_NOTE_PREDICATE = "type = 'session' AND status = 'pending' AND surface_condition IS NOT NULL";
183
- function healPendingSessionNotes(db) {
184
- let predicate = `${PENDING_SESSION_NOTE_PREDICATE} AND NOT ${managedAuthorityNoteRow("notes")}`;
185
- let healable;
186
- try {
187
- healable = db.prepare(`SELECT 1 FROM notes WHERE ${predicate} LIMIT 1`).get();
188
- } catch (error) {
189
- if (!(error instanceof Error) || !error.message.includes("no such table"))
190
- throw error;
191
- predicate = PENDING_SESSION_NOTE_PREDICATE;
192
- healable = db.prepare(`SELECT 1 FROM notes WHERE ${predicate} LIMIT 1`).get();
193
- }
194
- if (healable == null)
195
- return;
196
- try {
197
- db.prepare(`UPDATE notes SET status = 'active', surface_condition = NULL WHERE ${predicate}`).run();
198
- } catch (error) {
199
- if (!isTransientSqliteError2(error))
200
- throw error;
201
- }
202
- }
203
- function getNoteById(db, noteId) {
204
- healPendingSessionNotes(db);
205
- const row = db.prepare("SELECT * FROM notes WHERE id = ?").get(noteId);
206
- return isNoteRow(row) ? toNote(row) : null;
207
- }
208
- function getNoteByIdInScope(db, noteId, scope) {
209
- const note = getNoteById(db, noteId);
210
- return note && noteBelongsToScope(note, scope) ? note : null;
211
- }
212
- function noteBelongsToScope(note, scope) {
213
- if (note.type === "session") {
214
- return note.sessionId === scope.sessionId;
215
- }
216
- return note.projectPath === scope.projectPath;
217
- }
218
- function buildStatusClause(status) {
219
- if (status === undefined) {
220
- return null;
221
- }
222
- const statuses = Array.isArray(status) ? status : [status];
223
- if (statuses.length === 0) {
224
- return null;
225
- }
226
- const placeholders = statuses.map(() => "?").join(", ");
227
- return {
228
- sql: `status IN (${placeholders})`,
229
- params: statuses
230
- };
231
- }
232
- function getNotes(db, options = {}) {
233
- healPendingSessionNotes(db);
234
- const clauses = [];
235
- const params = [];
236
- if (options.sessionId !== undefined) {
237
- clauses.push("session_id = ?");
238
- params.push(options.sessionId);
239
- }
240
- if (options.projectPath !== undefined) {
241
- clauses.push("project_path = ?");
242
- params.push(options.projectPath);
243
- }
244
- if (options.type !== undefined) {
245
- clauses.push("type = ?");
246
- params.push(options.type);
247
- }
248
- const statusClause = buildStatusClause(options.status);
249
- if (statusClause) {
250
- clauses.push(statusClause.sql);
251
- params.push(...statusClause.params);
252
- }
253
- const where = clauses.length > 0 ? ` WHERE ${clauses.join(" AND ")}` : "";
254
- return db.prepare(`SELECT * FROM notes${where} ORDER BY created_at ASC, id ASC`).all(...params).filter(isNoteRow).map(toNote);
255
- }
256
- function addNote(db, type, options) {
257
- const now = Date.now();
258
- const result = type === "session" ? db.prepare("INSERT INTO notes (type, status, content, session_id, created_at, updated_at, harness, anchor_ordinal) VALUES ('session', 'active', ?, ?, ?, ?, ?, ?) RETURNING *").get(options.content, options.sessionId, now, now, getHarness2(), options.anchorOrdinal ?? null) : db.prepare("INSERT INTO notes (type, status, content, session_id, project_path, surface_condition, compiled_provider, compiled_config, compiled_at, compile_status, created_at, updated_at, harness, anchor_ordinal) VALUES ('smart', 'pending', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *").get(options.content, options.sessionId ?? null, options.projectPath, options.surfaceCondition, options.compiledProvider ?? null, options.compiledConfig ?? null, options.compiledAt ?? null, options.compileStatus ?? null, now, now, getHarness2(), options.anchorOrdinal ?? null);
259
- if (!isNoteRow(result)) {
260
- throw new Error("[notes] failed to insert note");
261
- }
262
- return toNote(result);
263
- }
264
- function getSessionNotes(db, sessionId) {
265
- return getNotes(db, { sessionId, type: "session", status: "active" });
266
- }
267
- function getSmartNotes(db, projectPath, status) {
268
- return getNotes(db, {
269
- projectPath,
270
- type: "smart",
271
- status: status ?? DEFAULT_SMART_STATUSES
272
- });
273
- }
274
- function getPendingSmartNotes(db, projectPath) {
275
- return getSmartNotes(db, projectPath, "pending");
276
- }
277
- function getReadySmartNotes(db, projectPath) {
278
- return getSmartNotes(db, projectPath, "ready");
279
- }
280
- function updateNote(db, noteId, updates, scope) {
281
- const existing = getNoteByIdInScope(db, noteId, scope);
282
- if (!existing) {
283
- return null;
284
- }
285
- if (updates.surfaceCondition !== undefined && existing.type !== "smart") {
286
- return null;
287
- }
288
- const now = Date.now();
289
- const sets = ["updated_at = ?"];
290
- const params = [now];
291
- if (updates.content !== undefined) {
292
- sets.push("content = ?");
293
- params.push(updates.content);
294
- }
295
- if (updates.sessionId !== undefined) {
296
- sets.push("session_id = ?");
297
- params.push(updates.sessionId);
298
- }
299
- const smartConditionChanged = existing.type === "smart" && updates.surfaceCondition !== undefined && updates.surfaceCondition !== existing.surfaceCondition;
300
- if (updates.status !== undefined && !smartConditionChanged) {
301
- sets.push("status = ?");
302
- params.push(updates.status);
303
- }
304
- if (existing.type === "smart") {
305
- if (updates.projectPath !== undefined) {
306
- sets.push("project_path = ?");
307
- params.push(updates.projectPath);
308
- }
309
- if (updates.surfaceCondition !== undefined) {
310
- sets.push("surface_condition = ?");
311
- params.push(updates.surfaceCondition);
312
- }
313
- if (smartConditionChanged) {
314
- sets.push("status = 'pending'", "last_checked_at = NULL", "ready_at = NULL", "ready_reason = NULL");
315
- sets.push("compiled_provider = ?", "compiled_config = ?", "compiled_at = ?", "compile_status = ?");
316
- params.push(updates.compiledProvider ?? null, updates.compiledConfig ?? null, updates.compiledAt ?? null, updates.compileStatus ?? null);
317
- if (noteCheckColumnsExist(db)) {
318
- sets.push("compiled_check = NULL", "manifest_json = NULL", "check_hash = NULL", "check_cron = NULL", "check_version = 0", "check_status = 'uncompiled'", "check_failure_count = 0", "check_network_failure_count = 0", "check_quarantined_until = NULL", "check_next_due_at = NULL", "check_compiled_at = NULL", "check_false_since_at = NULL", "check_last_liveness_at = NULL");
319
- }
320
- } else {
321
- if (updates.lastCheckedAt !== undefined) {
322
- sets.push("last_checked_at = ?");
323
- params.push(updates.lastCheckedAt);
324
- }
325
- if (updates.readyAt !== undefined) {
326
- sets.push("ready_at = ?");
327
- params.push(updates.readyAt);
328
- }
329
- if (updates.readyReason !== undefined) {
330
- sets.push("ready_reason = ?");
331
- params.push(updates.readyReason);
332
- }
333
- }
334
- }
335
- if (sets.length === 1) {
336
- return null;
337
- }
338
- params.push(noteId);
339
- const result = db.prepare(`UPDATE notes SET ${sets.join(", ")} WHERE id = ? RETURNING *`).get(...params);
340
- return isNoteRow(result) ? toNote(result) : null;
341
- }
342
- function dismissNotes(db, noteIds, scope) {
343
- const now = Date.now();
344
- return db.transaction(() => noteIds.map((noteId) => {
345
- const existing = getNoteById(db, noteId);
346
- if (!existing)
347
- return { noteId, outcome: "not_found" };
348
- if (!noteBelongsToScope(existing, scope)) {
349
- return { noteId, outcome: "not_owned" };
350
- }
351
- if (existing.status === "dismissed") {
352
- return { noteId, outcome: "already_dismissed" };
353
- }
354
- const result = db.prepare("UPDATE notes SET status = 'dismissed', updated_at = ? WHERE id = ? AND status != 'dismissed'").run(now, noteId);
355
- return {
356
- noteId,
357
- outcome: result.changes > 0 ? "dismissed" : "already_dismissed"
358
- };
359
- })).immediate();
360
- }
361
- function dismissNote(db, noteId, scope) {
362
- return dismissNotes(db, [noteId], scope)[0]?.outcome === "dismissed";
363
- }
364
- function markNoteReady(db, noteId, reason) {
365
- const now = Date.now();
366
- db.prepare("UPDATE notes SET status = 'ready', ready_at = ?, ready_reason = ?, updated_at = ?, last_checked_at = ? WHERE id = ? AND type = 'smart'").run(now, reason ?? null, now, now, noteId);
367
- }
368
- function markNoteChecked(db, noteId) {
369
- const now = Date.now();
370
- db.prepare("UPDATE notes SET last_checked_at = ?, updated_at = ? WHERE id = ? AND type = 'smart'").run(now, now, noteId);
371
- }
372
-
373
- // ../plugin/src/features/magic-context/storage-primers.ts
374
- var PRIMER_CANDIDATE_TTL_MS = 90 * 24 * 60 * 60 * 1000;
375
- var PRIMER_CANDIDATE_MAX_AGE_MS = 180 * 24 * 60 * 60 * 1000;
376
- function normalizePrimerQuestion(question) {
377
- return question.trim().toLowerCase().replace(/[“”]/g, '"').replace(/[’]/g, "'").replace(/\s+/g, " ").replace(/[?.!]+$/g, "").trim();
378
- }
379
- function primerOccurrenceKey(candidate) {
380
- return [
381
- candidate.projectPath,
382
- candidate.harness,
383
- candidate.sessionId,
384
- candidate.sourceStartMessageId,
385
- candidate.sourceEndMessageId
386
- ].join("\x1F");
387
- }
388
- function primerOccurrenceUtcDay(sourceMessageTime) {
389
- return new Date(sourceMessageTime).toISOString().slice(0, 10);
390
- }
391
- function vectorBlob(vector) {
392
- if (!vector)
393
- return null;
394
- return new Uint8Array(vector.buffer, vector.byteOffset, vector.byteLength);
395
- }
396
- function blobToFloat32Array(value) {
397
- if (!value)
398
- return null;
399
- const bytes = value instanceof ArrayBuffer ? new Uint8Array(value) : value;
400
- return new Float32Array(bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength));
401
- }
402
- function parseCandidateIds(raw) {
403
- if (!raw)
404
- return [];
405
- try {
406
- const parsed = JSON.parse(raw);
407
- return Array.isArray(parsed) ? parsed.filter((id) => typeof id === "number" && Number.isFinite(id)) : [];
408
- } catch {
409
- return [];
410
- }
411
- }
412
- function parsePrimerSourceProvenance(raw) {
413
- if (raw === null)
414
- return null;
415
- try {
416
- const parsed = JSON.parse(raw);
417
- if (!Array.isArray(parsed))
418
- return null;
419
- const provenance = [];
420
- for (const value of parsed) {
421
- if (!value || typeof value !== "object")
422
- return null;
423
- const source = value;
424
- if (typeof source.candidate_id !== "number" || !Number.isFinite(source.candidate_id) || typeof source.project_path !== "string" || typeof source.harness !== "string" || typeof source.session_id !== "string" || source.source_compartment_start !== null && typeof source.source_compartment_start !== "number" || source.source_compartment_end !== null && typeof source.source_compartment_end !== "number" || typeof source.source_start_message_id !== "string" || typeof source.source_end_message_id !== "string") {
425
- return null;
426
- }
427
- provenance.push({
428
- candidateId: source.candidate_id,
429
- projectPath: source.project_path,
430
- harness: source.harness,
431
- sessionId: source.session_id,
432
- sourceCompartmentStart: source.source_compartment_start,
433
- sourceCompartmentEnd: source.source_compartment_end,
434
- sourceStartMessageId: source.source_start_message_id,
435
- sourceEndMessageId: source.source_end_message_id
436
- });
437
- }
438
- return provenance;
439
- } catch {
440
- return null;
441
- }
442
- }
443
- function loadPrimerSourceProvenance(db, candidateIds) {
444
- const ids = [...new Set(candidateIds)].sort((a, b) => a - b);
445
- if (ids.length === 0)
446
- return [];
447
- const placeholders = ids.map(() => "?").join(",");
448
- const rows = db.prepare(`SELECT id, project_path, harness, session_id,
449
- source_compartment_start, source_compartment_end,
450
- source_start_message_id, source_end_message_id
451
- FROM primer_candidates
452
- WHERE id IN (${placeholders})
453
- ORDER BY id ASC`).all(...ids);
454
- return rows.map((row) => ({
455
- candidateId: row.id,
456
- projectPath: row.project_path,
457
- harness: row.harness,
458
- sessionId: row.session_id,
459
- sourceCompartmentStart: row.source_compartment_start,
460
- sourceCompartmentEnd: row.source_compartment_end,
461
- sourceStartMessageId: row.source_start_message_id,
462
- sourceEndMessageId: row.source_end_message_id
463
- }));
464
- }
465
- function serializePrimerSourceProvenance(provenance, sourceCandidateIds) {
466
- if (provenance.length === 0 && sourceCandidateIds.length > 0)
467
- return null;
468
- return JSON.stringify(provenance.map((source) => ({
469
- candidate_id: source.candidateId,
470
- project_path: source.projectPath,
471
- harness: source.harness,
472
- session_id: source.sessionId,
473
- source_compartment_start: source.sourceCompartmentStart,
474
- source_compartment_end: source.sourceCompartmentEnd,
475
- source_start_message_id: source.sourceStartMessageId,
476
- source_end_message_id: source.sourceEndMessageId
477
- })));
478
- }
479
- function normalizedCandidateIds(candidateIds) {
480
- return [...new Set(candidateIds)].sort((a, b) => a - b);
481
- }
482
- function toCandidate(row) {
483
- return {
484
- id: row.id,
485
- projectPath: row.project_path,
486
- harness: row.harness,
487
- sessionId: row.session_id,
488
- question: row.question,
489
- normalizedQuestion: row.normalized_question,
490
- sourceCompartmentStart: row.source_compartment_start,
491
- sourceCompartmentEnd: row.source_compartment_end,
492
- sourceStartMessageId: row.source_start_message_id,
493
- sourceEndMessageId: row.source_end_message_id,
494
- sourceMessageTime: row.source_message_time,
495
- questionEmbedding: blobToFloat32Array(row.question_embedding),
496
- questionEmbeddingModelId: row.question_embedding_model_id,
497
- createdAt: row.created_at
498
- };
499
- }
500
- function toPrimer(row) {
501
- const status = row.status === "archived" ? "archived" : "active";
502
- return {
503
- id: row.id,
504
- projectPath: row.project_path,
505
- question: row.question,
506
- questionEmbedding: blobToFloat32Array(row.question_embedding),
507
- questionEmbeddingModelId: row.question_embedding_model_id,
508
- answer: row.answer,
509
- status,
510
- totalSupport: row.total_support,
511
- lastObservedAt: row.last_observed_at,
512
- answerRefreshedAt: row.answer_refreshed_at,
513
- sourceCandidateIds: parseCandidateIds(row.source_candidate_ids),
514
- sourceProvenance: parsePrimerSourceProvenance(row.source_candidate_provenance),
515
- createdAt: row.created_at,
516
- updatedAt: row.updated_at
517
- };
518
- }
519
- function insertPrimerCandidates(db, candidates) {
520
- const ids = [];
521
- const stmt = db.prepare(`
522
- INSERT INTO primer_candidates (
523
- project_path, harness, session_id, question, normalized_question,
524
- source_compartment_start, source_compartment_end,
525
- source_start_message_id, source_end_message_id, source_message_time,
526
- question_embedding, question_embedding_model_id, created_at
527
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
528
- ON CONFLICT(project_path, harness, session_id, source_start_message_id, source_end_message_id)
529
- DO UPDATE SET
530
- question = excluded.question,
531
- normalized_question = excluded.normalized_question,
532
- source_compartment_start = excluded.source_compartment_start,
533
- source_compartment_end = excluded.source_compartment_end,
534
- source_message_time = excluded.source_message_time,
535
- question_embedding = COALESCE(excluded.question_embedding, primer_candidates.question_embedding),
536
- question_embedding_model_id = COALESCE(excluded.question_embedding_model_id, primer_candidates.question_embedding_model_id),
537
- created_at = MIN(primer_candidates.created_at, excluded.created_at)
538
- `);
539
- const select = db.prepare(`
540
- SELECT id FROM primer_candidates
541
- WHERE project_path = ? AND harness = ? AND session_id = ?
542
- AND source_start_message_id = ? AND source_end_message_id = ?
543
- `);
544
- db.transaction(() => {
545
- for (const candidate of candidates) {
546
- const question = candidate.question.trim();
547
- if (!question)
548
- continue;
549
- const normalized = candidate.normalizedQuestion ?? normalizePrimerQuestion(question);
550
- stmt.run(candidate.projectPath, candidate.harness || "opencode", candidate.sessionId, question, normalized, candidate.sourceCompartmentStart ?? null, candidate.sourceCompartmentEnd ?? null, candidate.sourceStartMessageId, candidate.sourceEndMessageId, candidate.sourceMessageTime, vectorBlob(candidate.questionEmbedding), candidate.questionEmbeddingModelId ?? null, candidate.createdAt ?? Date.now());
551
- const row = select.get(candidate.projectPath, candidate.harness || "opencode", candidate.sessionId, candidate.sourceStartMessageId, candidate.sourceEndMessageId);
552
- if (typeof row?.id === "number")
553
- ids.push(row.id);
554
- }
555
- }).immediate();
556
- return ids;
557
- }
558
- function updatePrimerCandidateEmbedding(db, candidateId, vector, modelId) {
559
- db.prepare("UPDATE primer_candidates SET question_embedding = ?, question_embedding_model_id = ? WHERE id = ?").run(vectorBlob(vector), modelId, candidateId);
560
- }
561
- function getPrimerCandidatesByIds(db, ids) {
562
- if (ids.length === 0)
563
- return [];
564
- const placeholders = ids.map(() => "?").join(",");
565
- const rows = db.prepare(`SELECT * FROM primer_candidates WHERE id IN (${placeholders})`).all(...ids);
566
- return rows.map(toCandidate);
567
- }
568
- function getPrimerCandidatesForPromotion(db, projectPath, now = Date.now(), ttlMs = PRIMER_CANDIDATE_TTL_MS) {
569
- const cutoff = now - ttlMs;
570
- const rows = db.prepare(`SELECT * FROM primer_candidates
571
- WHERE project_path = ? AND source_message_time >= ?
572
- ORDER BY project_path ASC, harness ASC, session_id ASC, source_start_message_id ASC, source_end_message_id ASC, id ASC`).all(projectPath, cutoff);
573
- return rows.map(toCandidate);
574
- }
575
- function countPrimerCandidatesForProject(db, projectPath) {
576
- const row = db.prepare("SELECT COUNT(*) AS count FROM primer_candidates WHERE project_path = ?").get(projectPath);
577
- return row?.count ?? 0;
578
- }
579
- function getActivePrimers(db, projectPath) {
580
- const rows = db.prepare(`SELECT * FROM primers
581
- WHERE project_path = ? AND status = 'active'
582
- ORDER BY COALESCE(last_observed_at, created_at) DESC, id ASC`).all(projectPath);
583
- return rows.map(toPrimer);
584
- }
585
- function createPrimer(db, input) {
586
- return db.transaction(() => {
587
- const now = input.now ?? Date.now();
588
- const sourceCandidateIds = normalizedCandidateIds(input.sourceCandidateIds);
589
- const sourceProvenance = loadPrimerSourceProvenance(db, sourceCandidateIds);
590
- const info = db.prepare(`INSERT INTO primers (
591
- project_path, question, question_embedding, question_embedding_model_id, answer,
592
- status, total_support, last_observed_at, answer_refreshed_at,
593
- source_candidate_ids, source_candidate_provenance, created_at, updated_at
594
- ) VALUES (?, ?, ?, ?, ?, 'active', ?, ?, NULL, ?, ?, ?, ?)`).run(input.projectPath, input.question, vectorBlob(input.questionEmbedding), input.questionEmbeddingModelId ?? null, input.answer ?? "", input.totalSupport, input.lastObservedAt, JSON.stringify(sourceCandidateIds), serializePrimerSourceProvenance(sourceProvenance, sourceCandidateIds), now, now);
595
- return Number(info.lastInsertRowid);
596
- }).immediate();
597
- }
598
- function updatePrimerSupport(db, input) {
599
- db.transaction(() => {
600
- const sourceCandidateIds = normalizedCandidateIds(input.sourceCandidateIds);
601
- const allowedIds = new Set(sourceCandidateIds);
602
- const existingRow = db.prepare("SELECT source_candidate_provenance FROM primers WHERE id = ?").get(input.primerId);
603
- const provenanceByCandidateId = new Map;
604
- for (const source of parsePrimerSourceProvenance(existingRow?.source_candidate_provenance ?? null) ?? []) {
605
- if (allowedIds.has(source.candidateId)) {
606
- provenanceByCandidateId.set(source.candidateId, source);
607
- }
608
- }
609
- for (const source of loadPrimerSourceProvenance(db, sourceCandidateIds)) {
610
- provenanceByCandidateId.set(source.candidateId, source);
611
- }
612
- const sourceProvenance = [...provenanceByCandidateId.values()].sort((a, b) => a.candidateId - b.candidateId);
613
- db.prepare(`UPDATE primers
614
- SET question_embedding = COALESCE(?, question_embedding),
615
- question_embedding_model_id = COALESCE(?, question_embedding_model_id),
616
- total_support = ?,
617
- last_observed_at = ?,
618
- source_candidate_ids = ?,
619
- source_candidate_provenance = ?,
620
- updated_at = ?
621
- WHERE id = ?`).run(vectorBlob(input.questionEmbedding), input.questionEmbeddingModelId ?? null, input.totalSupport, input.lastObservedAt, JSON.stringify(sourceCandidateIds), serializePrimerSourceProvenance(sourceProvenance, sourceCandidateIds), input.now ?? Date.now(), input.primerId);
622
- }).immediate();
623
- }
624
- function updatePrimerAnswer(db, primerId, answer, refreshedAt = Date.now()) {
625
- db.prepare("UPDATE primers SET answer = ?, answer_refreshed_at = ?, updated_at = ? WHERE id = ?").run(answer, refreshedAt, refreshedAt, primerId);
626
- }
627
-
628
117
  // ../plugin/src/shared/user-facing-codes.ts
629
118
  var USER_FACING_FAILURES = {
630
119
  historian_unavailable: {
@@ -2207,6 +1696,32 @@ function invalidateIncrementalWork(sessionId) {
2207
1696
  }
2208
1697
  }
2209
1698
 
1699
+ // ../plugin/src/features/magic-context/auto-search-diagnostics.ts
1700
+ function createAutoSearchDiagnostics(threshold) {
1701
+ return {
1702
+ threshold,
1703
+ lanes: {},
1704
+ pool: "unknown",
1705
+ poolRows: null,
1706
+ peek: "not-run",
1707
+ workerStarted: false
1708
+ };
1709
+ }
1710
+ function autoSearchRelevance(query, result) {
1711
+ if (cleanSearchText(result.source === "compartment" ? result.title : result.content).length === 0)
1712
+ return 0;
1713
+ return result.source === "message" || "matchType" in result && result.source !== "compartment" && result.matchType !== "semantic" ? keywordRelevance(query, result.content) : result.score;
1714
+ }
1715
+ function recordAutoSearchLane(diagnostics, lane, query, results) {
1716
+ if (!diagnostics)
1717
+ return;
1718
+ const scores = results.map((result) => result.relevanceScore ?? autoSearchRelevance(query, result));
1719
+ diagnostics.lanes[lane] = {
1720
+ top: scores.length ? Math.max(...scores) : null,
1721
+ nearMisses: scores.filter((score) => score >= 0.5 && score < diagnostics.threshold).length
1722
+ };
1723
+ }
1724
+
2210
1725
  // ../plugin/src/features/magic-context/literal-probes.ts
2211
1726
  var MAX_PROBES = 5;
2212
1727
  var MIN_PROBE_LENGTH = 3;
@@ -2371,6 +1886,7 @@ var RERANK_MODEL = "gte-reranker-modernbert-base-f32";
2371
1886
  var RERANK_LANE_LIMIT = 25;
2372
1887
  var DEADLINE_MS = 1500;
2373
1888
  var DOCUMENT_BYTES = 1024;
1889
+ var proseWordSegmenter = new Intl.Segmenter(undefined, { granularity: "word" });
2374
1890
  function isProseQuery(query) {
2375
1891
  const text = query.trim();
2376
1892
  if (!text || /[\n;]|^["'`]|["'`]$/.test(text))
@@ -2379,10 +1895,10 @@ function isProseQuery(query) {
2379
1895
  return false;
2380
1896
  if (/\b(?:[A-Z][A-Z_]+:|\w*(?:Error|Exception):)|\bat\s+\S+\s*\(/.test(text))
2381
1897
  return false;
2382
- const words = text.replace(/[?!.]$/, "").split(/\s+/);
1898
+ const words = /(?![a-zA-Z])\p{L}/u.test(text) ? [...proseWordSegmenter.segment(text)].filter((word) => word.isWordLike).map((word) => word.segment) : text.replace(/[?!.]$/, "").split(/\s+/);
2383
1899
  if (words.length < 3)
2384
1900
  return false;
2385
- const plain = words.filter((word) => /^[a-zA-Z]+(?:['’-][a-zA-Z]+)*$/.test(word));
1901
+ const plain = words.filter((word) => /^[\p{L}\p{M}]+(?:['’-][\p{L}\p{M}]+)*$/u.test(word));
2386
1902
  if (/^(?:how|why|what|where|when|which|who)\b/i.test(text))
2387
1903
  return plain.length >= 3;
2388
1904
  return words.length >= 4 && plain.length >= 3 && !/[\\/]|::|=/.test(text);
@@ -3644,11 +3160,17 @@ async function searchCompartmentChunks(args) {
3644
3160
  if (args.limit <= 0 || !args.modelId || args.modelId === "off") {
3645
3161
  if (args.timings)
3646
3162
  args.timings.chunkPool = "off";
3163
+ if (args.diagnostics)
3164
+ args.diagnostics.pool = "off";
3165
+ args.reportDiagnostics?.();
3647
3166
  return [];
3648
3167
  }
3649
3168
  if (!args.queryEmbedding) {
3650
3169
  if (args.timings)
3651
3170
  args.timings.chunkPool = "no-vector";
3171
+ if (args.diagnostics)
3172
+ args.diagnostics.pool = "no-vector";
3173
+ args.reportDiagnostics?.();
3652
3174
  if (args.warmOnly)
3653
3175
  warmCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId);
3654
3176
  return [];
@@ -3656,15 +3178,25 @@ async function searchCompartmentChunks(args) {
3656
3178
  const cutoff = args.maxOrdinal != null && args.maxOrdinal >= 0 ? args.maxOrdinal : null;
3657
3179
  let rows;
3658
3180
  if (args.warmOnly) {
3659
- const warm = peekCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId, args.dateRange);
3181
+ const warm = peekCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId, args.dateRange, args.diagnostics);
3660
3182
  if (warm === null) {
3661
3183
  if (args.timings)
3662
3184
  args.timings.chunkPool = "cold";
3185
+ if (args.diagnostics) {
3186
+ args.diagnostics.pool = "cold";
3187
+ args.diagnostics.poolRows = 0;
3188
+ }
3189
+ args.reportDiagnostics?.();
3663
3190
  warmCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId);
3664
3191
  return [];
3665
3192
  }
3666
3193
  if (args.timings)
3667
3194
  args.timings.chunkPool = "warm";
3195
+ if (args.diagnostics) {
3196
+ args.diagnostics.pool = "warm";
3197
+ args.diagnostics.poolRows = warm.length;
3198
+ }
3199
+ args.reportDiagnostics?.();
3668
3200
  rows = warm;
3669
3201
  } else {
3670
3202
  try {
@@ -4034,6 +3566,8 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
4034
3566
  lanes.message_fts = (outcome.laneResults ?? outcome.results).slice(0, 25);
4035
3567
  if (timings)
4036
3568
  timings.messageMs = performance.now() - stepStartedAt;
3569
+ recordAutoSearchLane(options.autoSearchDiagnostics, "messages", trimmedQuery, messageResults);
3570
+ options.onAutoSearchDiagnostics?.();
4037
3571
  }
4038
3572
  stepStartedAt = performance.now();
4039
3573
  const capturedQuery = await queryEmbeddingPromise;
@@ -4051,6 +3585,8 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
4051
3585
  stepStartedAt = performance.now();
4052
3586
  if (timings)
4053
3587
  timings.chunkPool = "off";
3588
+ if (options.autoSearchDiagnostics && !runCompartmentChunks)
3589
+ options.autoSearchDiagnostics.pool = "off";
4054
3590
  const compartmentResults = runCompartmentChunks ? await searchCompartmentChunks({
4055
3591
  db,
4056
3592
  sessionId,
@@ -4062,8 +3598,13 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
4062
3598
  dateRange,
4063
3599
  warmOnly: options.chunkPoolWarmOnly,
4064
3600
  signal: options.signal,
4065
- timings
3601
+ timings,
3602
+ diagnostics: options.autoSearchDiagnostics,
3603
+ reportDiagnostics: options.onAutoSearchDiagnostics
4066
3604
  }) : [];
3605
+ if (runCompartmentChunks)
3606
+ recordAutoSearchLane(options.autoSearchDiagnostics, "summaries", trimmedQuery, compartmentResults);
3607
+ options.onAutoSearchDiagnostics?.();
4067
3608
  if (timings && runCompartmentChunks)
4068
3609
  timings.chunkMs = performance.now() - stepStartedAt;
4069
3610
  stepStartedAt = performance.now();
@@ -4124,6 +3665,11 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
4124
3665
  ]);
4125
3666
  if (timings)
4126
3667
  timings.otherLanesMs = performance.now() - stepStartedAt;
3668
+ if (runMemory)
3669
+ recordAutoSearchLane(options.autoSearchDiagnostics, "memory", trimmedQuery, memoryOutcome.results);
3670
+ if (runGitCommits)
3671
+ recordAutoSearchLane(options.autoSearchDiagnostics, "git", trimmedQuery, gitCommitResults);
3672
+ options.onAutoSearchDiagnostics?.();
4127
3673
  if (options.diagnostics) {
4128
3674
  options.diagnostics.suppressedVisibleMemoryIds = memoryOutcome.suppressedVisibleIds;
4129
3675
  }
@@ -4186,7 +3732,7 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
4186
3732
  if (options.autoHint) {
4187
3733
  return results.map((result) => ({
4188
3734
  ...result,
4189
- relevanceScore: cleanSearchText(result.source === "compartment" ? result.title : result.content).length === 0 ? 0 : result.source === "message" || ("matchType" in result) && result.source !== "compartment" && result.matchType !== "semantic" ? keywordRelevance(trimmedQuery, result.content) : result.score
3735
+ relevanceScore: autoSearchRelevance(trimmedQuery, result)
4190
3736
  }));
4191
3737
  }
4192
3738
  return results;
@@ -4309,4 +3855,4 @@ ${bodyParts.join(`
4309
3855
  `)}`;
4310
3856
  }
4311
3857
 
4312
- export { getNoteByIdInScope, getNotes, addNote, getSessionNotes, getPendingSmartNotes, getReadySmartNotes, updateNote, dismissNotes, dismissNote, markNoteReady, markNoteChecked, PRIMER_CANDIDATE_TTL_MS, PRIMER_CANDIDATE_MAX_AGE_MS, primerOccurrenceKey, primerOccurrenceUtcDay, insertPrimerCandidates, updatePrimerCandidateEmbedding, getPrimerCandidatesByIds, getPrimerCandidatesForPromotion, countPrimerCandidatesForProject, getActivePrimers, createPrimer, updatePrimerSupport, updatePrimerAnswer, USER_FACING_FAILURES, renderUserFacingFailure, userFacingFailureCode, renderCapabilityRefusal, renderDreamFailure, dreamFailureCode, renderEmbeddingFailure, renderSingleStoreMigrationRequiredRefusal, SingleStoreMigrationRequiredError, projectNeedsSingleStoreMigration, promoteSessionFactsDurable, embedPromotedFacts, recordMemoryMapping, recordMemoryVerifications, getUnmappedMemoryIds, clearMemoryVerifications, getMemoryVerifications, resolveGitTopLevel, readGitHead, readGitChangedFilesSince, readGitFileChangeTimesSince, verificationFileExists, normalizeVerificationFiles, indexCommitsForProject, embedUnembeddedCommits, getMessageIndexEpoch, isMessageIndexSearchable, scheduleReconciliation, scheduleIncrementalIndex, scheduleClearAndReindex, clearSessionTracking, createUnifiedSearchDiagnostics2, searchMessageHistory2, parseIdShapedQuery2, resolveMemoriesByIdsForSearch2, unifiedSearch2, formatSearchResults2 };
3858
+ export { USER_FACING_FAILURES, renderUserFacingFailure, userFacingFailureCode, renderCapabilityRefusal, renderDreamFailure, dreamFailureCode, renderEmbeddingFailure, renderSingleStoreMigrationRequiredRefusal, SingleStoreMigrationRequiredError, projectNeedsSingleStoreMigration, promoteSessionFactsDurable, embedPromotedFacts, recordMemoryMapping, recordMemoryVerifications, getUnmappedMemoryIds, clearMemoryVerifications, getMemoryVerifications, resolveGitTopLevel, readGitHead, readGitChangedFilesSince, readGitFileChangeTimesSince, verificationFileExists, normalizeVerificationFiles, indexCommitsForProject, embedUnembeddedCommits, getMessageIndexEpoch, isMessageIndexSearchable, scheduleReconciliation, scheduleIncrementalIndex, scheduleClearAndReindex, clearSessionTracking, createAutoSearchDiagnostics, createUnifiedSearchDiagnostics2, searchMessageHistory2, parseIdShapedQuery2, resolveMemoriesByIdsForSearch2, unifiedSearch2, formatSearchResults2 };