@cortexkit/opencode-magic-context 0.49.10 → 0.49.11
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/dist/auto-search-worker.js +3 -3
- package/dist/{conflict-warning-hook-w3crzrar.js → conflict-warning-hook-xwkfncav.js} +3 -3
- package/dist/{context-ey3ap3cc.js → context-twz3s0cg.js} +220 -43
- package/dist/{embedding-backfill-3h2m5n0q.js → embedding-backfill-fjbfh1dt.js} +3 -3
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +12 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/memory-enabled.d.ts +5 -0
- package/dist/features/magic-context/memory-enabled.d.ts.map +1 -0
- package/dist/features/magic-context/search-pool-fixture.d.ts +39 -0
- package/dist/features/magic-context/search-pool-fixture.d.ts.map +1 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +57 -2
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-prompt-fit.d.ts +12 -2
- package/dist/hooks/magic-context/historian-prompt-fit.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/producer-window-guard.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +5 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/render-options.d.ts +21 -0
- package/dist/hooks/magic-context/render-options.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +4 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +1 -7
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-pgy3h49n.js → index-0abg88h2.js} +1 -1
- package/dist/{index-0x9cn9w1.js → index-0j6crjgh.js} +2 -2
- package/dist/{index-a43xq1pg.js → index-4ccdr7yw.js} +1 -1
- package/dist/{index-4hb8nt93.js → index-4jkhhpn1.js} +1 -1
- package/dist/{index-ffa8x2as.js → index-84j7jq8a.js} +13 -8
- package/dist/{index-7bjgyaj1.js → index-9159kk15.js} +238 -130
- package/dist/{index-q76br5zn.js → index-bzp9s8z2.js} +24 -19
- package/dist/{index-21919gcq.js → index-g40wgxxt.js} +3 -3
- package/dist/{index-x57ep4fp.js → index-hqnggmxn.js} +215 -75
- package/dist/{index-6k86es2p.js → index-kkvxnbt8.js} +6 -6
- package/dist/{index-nenz4gpb.js → index-q3qck7j2.js} +4 -4
- package/dist/{index-wpwpn7nj.js → index-qr1mkc2y.js} +1 -1
- package/dist/{index-rg1cezmj.js → index-se1w3v2m.js} +1 -1
- package/dist/{index-swgpe402.js → index-xztdf9t7.js} +1 -1
- package/dist/{index-16vwdyy5.js → index-yhrrx7qa.js} +1 -1
- package/dist/{index-3403gbzj.js → index-z7avx6rw.js} +100 -38
- package/dist/index.js +27 -34
- package/dist/{message-index-bounded-fskdyc81.js → message-index-bounded-0rbbg9rd.js} +4 -4
- package/dist/{message-index-6r1x9cqh.js → message-index-ct5x2kwa.js} +4 -4
- package/dist/migration-worker.js +1 -1
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/{project-embedding-registry-vy7sv9jt.js → project-embedding-registry-ft9gh2e2.js} +2 -2
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{read-session-chunk-zgpvs423.js → read-session-chunk-y3hhsbzw.js} +2 -2
- package/dist/{recomp-orchestrator-77xc8wpe.js → recomp-orchestrator-67k45s0b.js} +11 -11
- package/dist/{search-72fkjwk2.js → search-jd8xh721.js} +8 -8
- package/dist/{send-session-notification-q8ngbap3.js → send-session-notification-vzhj8bsg.js} +2 -2
- package/dist/shared/prompt-surface-runtime.d.ts +5 -0
- package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-r8d406j0.js → transform-postprocess-phase-pmqxfq4q.js} +11 -11
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/{context-z2yagwy4.js → context-p1zfcw41.js} +599 -225
- package/dist/v2/{embedding-backfill-vr7wdtrf.js → embedding-backfill-xcw3t6hp.js} +5 -5
- package/dist/v2/embedding-worker.js +2 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/dream-manual.d.ts +1 -0
- package/dist/v2/hooks/dream-manual.d.ts.map +1 -1
- package/dist/v2/hooks/dream-timer.d.ts +3 -1
- package/dist/v2/hooks/dream-timer.d.ts.map +1 -1
- package/dist/v2/hooks/dream-trigger.d.ts +5 -0
- package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
- package/dist/v2/hooks/payload.d.ts +1 -1
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/transform-decision-binding.d.ts +15 -0
- package/dist/v2/hooks/transform-decision-binding.d.ts.map +1 -0
- package/dist/v2/hooks/transform-features.d.ts +39 -0
- package/dist/v2/hooks/transform-features.d.ts.map +1 -0
- package/dist/v2/{message-index-bounded-rqc603f2.js → message-index-bounded-7wcbp975.js} +5 -5
- package/dist/v2/{message-index-9ezq6wze.js → message-index-cjhv92m2.js} +5 -5
- package/dist/v2/migration-worker.js +1 -1
- package/dist/v2/{project-embedding-registry-ja23aygk.js → project-embedding-registry-g34gcf74.js} +6 -4
- package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
- package/dist/v2/{read-session-chunk-7f87tg2q.js → read-session-chunk-8d3v87vr.js} +3 -3
- package/dist/v2/{recomp-orchestrator-s5tdpsbs.js → recomp-orchestrator-n0pq36f0.js} +13 -13
- package/dist/v2/{search-2td1b1wy.js → search-a1acjwf8.js} +10 -10
- package/dist/v2/{send-session-notification-6n7chhyp.js → send-session-notification-z5mcjdea.js} +2 -2
- package/dist/v2/{server-4qr18rfg.js → server-5x7kmyz8.js} +1 -1
- package/dist/v2/{server-c9w52qss.js → server-7fvmt15t.js} +109 -38
- package/dist/v2/{server-44ryn9rb.js → server-83d71zab.js} +1 -1
- package/dist/v2/{server-z0rjemg1.js → server-d3f4g62c.js} +2 -2
- package/dist/v2/{server-zrwaj29a.js → server-d6t16r89.js} +24 -19
- package/dist/v2/{server-23znwjqk.js → server-erfp0xb6.js} +5 -2
- package/dist/v2/{server-9a6bwc12.js → server-ewqshbs8.js} +251 -131
- package/dist/v2/{server-ak7w74j9.js → server-h3wc20sv.js} +1 -1
- package/dist/v2/{server-7e087rvk.js → server-jc8v585p.js} +1 -1
- package/dist/v2/{server-4zwx20yg.js → server-kn7skz9r.js} +1 -1
- package/dist/v2/{server-2hxypdx5.js → server-pbpp8r8h.js} +13 -8
- package/dist/v2/{server-4rs8sm06.js → server-rxcq4t50.js} +3 -3
- package/dist/v2/{server-4easnf78.js → server-sg68np13.js} +13 -4
- package/dist/v2/{server-gc8x2xdb.js → server-wkhfyzpg.js} +2 -2
- package/dist/v2/server.js +4 -4
- package/dist/v2/store-reader.d.ts +4 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{wrapup-orchestrator-wg8dmmm9.js → wrapup-orchestrator-87q9d5e2.js} +13 -13
- package/dist/{wrapup-orchestrator-b1z99yg5.js → wrapup-orchestrator-jqapepw0.js} +12 -12
- package/package.json +1 -1
- package/src/shared/chunk-vector-writer-guard.test.ts +72 -0
- package/src/shared/prompt-surface-runtime.test.ts +15 -0
- package/src/shared/prompt-surface-runtime.ts +12 -0
|
@@ -106,6 +106,27 @@ function recursiveCharacterSplit(text, options) {
|
|
|
106
106
|
// src/features/magic-context/compartment-chunk-embedding.ts
|
|
107
107
|
var DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS = 512;
|
|
108
108
|
var CHUNK_WINDOW_SAFETY_RATIO = 0.9;
|
|
109
|
+
var SEARCH_SCOPE_METADATA_FIELDS = [
|
|
110
|
+
"rowId",
|
|
111
|
+
"compartmentId",
|
|
112
|
+
"sessionId",
|
|
113
|
+
"projectPath",
|
|
114
|
+
"harness",
|
|
115
|
+
"windowIndex",
|
|
116
|
+
"windowStart",
|
|
117
|
+
"windowEnd",
|
|
118
|
+
"chunkHash",
|
|
119
|
+
"modelId",
|
|
120
|
+
"dims",
|
|
121
|
+
"createdAt",
|
|
122
|
+
"vectorBytes",
|
|
123
|
+
"compartmentSessionId",
|
|
124
|
+
"title",
|
|
125
|
+
"compartmentStart",
|
|
126
|
+
"compartmentEnd",
|
|
127
|
+
"startTime",
|
|
128
|
+
"endTime"
|
|
129
|
+
];
|
|
109
130
|
var MESSAGE_FTS_CHUNK_LOAD_SQL = `SELECT map.message_ordinal AS messageOrdinal, fts.role, fts.content
|
|
110
131
|
FROM message_fts_rowid_map AS map
|
|
111
132
|
CROSS JOIN message_history_fts AS fts
|
|
@@ -115,7 +136,7 @@ var MESSAGE_FTS_CHUNK_LOAD_SQL = `SELECT map.message_ordinal AS messageOrdinal,
|
|
|
115
136
|
AND fts.role IN ('user', 'assistant')
|
|
116
137
|
ORDER BY map.message_ordinal ASC`;
|
|
117
138
|
var loadFtsRowsStatements = new WeakMap;
|
|
118
|
-
var
|
|
139
|
+
var searchPoolDates = new WeakMap;
|
|
119
140
|
var existingHashStatements = new WeakMap;
|
|
120
141
|
var existingHashByProjectStatements = new WeakMap;
|
|
121
142
|
var deleteByCompartmentStatements = new WeakMap;
|
|
@@ -123,14 +144,15 @@ var insertEmbeddingStatements = new WeakMap;
|
|
|
123
144
|
var renumberEmbeddingWindowStatements = new WeakMap;
|
|
124
145
|
var searchRowsStatements = new WeakMap;
|
|
125
146
|
var searchRowsByModelStatements = new WeakMap;
|
|
126
|
-
var datedSearchRowsByModelStatements = new WeakMap;
|
|
127
147
|
var searchPoolProbeStatements = new WeakMap;
|
|
148
|
+
var pendingSearchPools = new WeakMap;
|
|
128
149
|
var backfillCandidateStatements = new WeakMap;
|
|
129
150
|
var shadowBackfillCandidateStatements = new WeakMap;
|
|
130
151
|
var DECODED_SEARCH_POOL_CACHE_MAX_BYTES = 256 * 1024 * 1024;
|
|
131
152
|
var decodedSearchPools = new WeakMap;
|
|
132
153
|
var decodedSearchPoolLru = new Map;
|
|
133
154
|
var decodedSearchPoolBytes = 0;
|
|
155
|
+
var searchPoolStats = { fullRebuilds: 0, appends: 0, probes: 0, probeMs: 0, probePages: 0 };
|
|
134
156
|
function getLoadFtsRowsStatement(db) {
|
|
135
157
|
let stmt = loadFtsRowsStatements.get(db);
|
|
136
158
|
if (!stmt) {
|
|
@@ -188,49 +210,120 @@ function getRenumberEmbeddingWindowStatement(db) {
|
|
|
188
210
|
function getSearchPoolProbeStatement(db) {
|
|
189
211
|
let stmt = searchPoolProbeStatements.get(db);
|
|
190
212
|
if (!stmt) {
|
|
191
|
-
stmt = db.prepare(`SELECT
|
|
192
|
-
|
|
193
|
-
|
|
213
|
+
stmt = db.prepare(`SELECT e.id AS rowId, e.compartment_id AS compartmentId,
|
|
214
|
+
e.session_id AS sessionId, e.project_path AS projectPath, e.harness AS harness,
|
|
215
|
+
e.window_index AS windowIndex, e.start_ordinal AS windowStart,
|
|
216
|
+
e.end_ordinal AS windowEnd, e.chunk_hash AS chunkHash,
|
|
217
|
+
e.model_id AS modelId, e.dims AS dims, e.created_at AS createdAt,
|
|
218
|
+
length(e.vector) AS vectorBytes,
|
|
219
|
+
c.session_id AS compartmentSessionId, c.title AS title,
|
|
220
|
+
c.start_message AS compartmentStart, c.end_message AS compartmentEnd,
|
|
221
|
+
start_map.message_time_ms AS startTime, end_map.message_time_ms AS endTime
|
|
222
|
+
FROM compartment_chunk_embeddings e
|
|
223
|
+
LEFT JOIN compartments c ON c.id = e.compartment_id
|
|
224
|
+
LEFT JOIN message_fts_rowid_map start_map
|
|
225
|
+
ON start_map.session_id = c.session_id AND start_map.message_ordinal = c.start_message
|
|
226
|
+
LEFT JOIN message_fts_rowid_map end_map
|
|
227
|
+
ON end_map.session_id = c.session_id AND end_map.message_ordinal = c.end_message
|
|
228
|
+
WHERE e.session_id = ? AND e.project_path = ? AND e.model_id = ? AND e.id > ?
|
|
229
|
+
ORDER BY e.id ASC LIMIT 512`);
|
|
194
230
|
searchPoolProbeStatements.set(db, stmt);
|
|
195
231
|
}
|
|
196
232
|
return stmt;
|
|
197
233
|
}
|
|
198
|
-
function
|
|
199
|
-
let
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
WHERE id IN (
|
|
204
|
-
SELECT compartment_id FROM compartment_chunk_embeddings
|
|
205
|
-
WHERE session_id = ? AND project_path = ? AND model_id = ?
|
|
206
|
-
)`);
|
|
207
|
-
searchPoolCompartmentStatements.set(db, stmt);
|
|
208
|
-
}
|
|
209
|
-
return stmt;
|
|
210
|
-
}
|
|
211
|
-
function refreshPoolCompartmentFields(db, sessionId, projectPath, modelId, rows) {
|
|
212
|
-
const current = new Map;
|
|
213
|
-
for (const row of getSearchPoolCompartmentStatement(db).all(sessionId, projectPath, modelId)) {
|
|
214
|
-
current.set(row.id, row);
|
|
234
|
+
function sameScopeMetadata(left, right) {
|
|
235
|
+
for (let index = 0;index < SEARCH_SCOPE_METADATA_FIELDS.length; index++) {
|
|
236
|
+
const key = SEARCH_SCOPE_METADATA_FIELDS[index];
|
|
237
|
+
if (left[key] !== right[key])
|
|
238
|
+
return false;
|
|
215
239
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
async function probeSearchScope(db, sessionId, projectPath, modelId, previous) {
|
|
243
|
+
const started = performance.now();
|
|
244
|
+
searchPoolStats.probes++;
|
|
245
|
+
const probe = {
|
|
246
|
+
rowCount: 0,
|
|
247
|
+
maxRowId: 0,
|
|
248
|
+
rowIdSum: 0,
|
|
249
|
+
metadata: previous?.metadata ?? new Map,
|
|
250
|
+
ids: previous?.ids ?? []
|
|
251
|
+
};
|
|
252
|
+
let copied = previous === undefined;
|
|
253
|
+
let oldIndex = 0;
|
|
254
|
+
const writable = () => {
|
|
255
|
+
if (!copied) {
|
|
256
|
+
probe.metadata = new Map(probe.metadata);
|
|
257
|
+
copied = true;
|
|
222
258
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
259
|
+
return probe.metadata;
|
|
260
|
+
};
|
|
261
|
+
await yieldSearchPool();
|
|
262
|
+
for (;; ) {
|
|
263
|
+
const rows = getSearchPoolProbeStatement(db).all(sessionId, projectPath, modelId, probe.maxRowId);
|
|
264
|
+
searchPoolStats.probePages++;
|
|
265
|
+
if (rows.length === 0) {
|
|
266
|
+
if (previous) {
|
|
267
|
+
while (oldIndex < previous.ids.length)
|
|
268
|
+
writable().delete(previous.ids[oldIndex++]);
|
|
269
|
+
}
|
|
270
|
+
if (copied)
|
|
271
|
+
probe.ids = [...probe.metadata.keys()].sort((a, b) => a - b);
|
|
272
|
+
searchPoolStats.probeMs += performance.now() - started;
|
|
273
|
+
return probe;
|
|
274
|
+
}
|
|
275
|
+
for (const row of rows) {
|
|
276
|
+
probe.rowCount++;
|
|
277
|
+
probe.maxRowId = row.rowId;
|
|
278
|
+
probe.rowIdSum += row.rowId;
|
|
279
|
+
if (previous) {
|
|
280
|
+
while (oldIndex < previous.ids.length && previous.ids[oldIndex] < row.rowId) {
|
|
281
|
+
writable().delete(previous.ids[oldIndex++]);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (previous && previous.ids[oldIndex] === row.rowId) {
|
|
285
|
+
const old = previous.metadata.get(row.rowId);
|
|
286
|
+
if (!old || !sameScopeMetadata(old, row)) {
|
|
287
|
+
writable().set(row.rowId, row);
|
|
288
|
+
}
|
|
289
|
+
oldIndex++;
|
|
290
|
+
} else
|
|
291
|
+
writable().set(row.rowId, row);
|
|
292
|
+
}
|
|
293
|
+
await yieldSearchPool();
|
|
226
294
|
}
|
|
227
|
-
|
|
295
|
+
}
|
|
296
|
+
function sameSearchScope(left, right) {
|
|
297
|
+
return left.rowCount === right.rowCount && left.maxRowId === right.maxRowId && left.rowIdSum === right.rowIdSum && (left.metadata === right.metadata || [...left.metadata].every(([id, value]) => right.metadata.get(id) === value));
|
|
298
|
+
}
|
|
299
|
+
function scopeOnlyAppended(cached, probe) {
|
|
300
|
+
if (probe.rowCount <= cached.rowCount)
|
|
301
|
+
return false;
|
|
302
|
+
let addedCount = 0;
|
|
303
|
+
let addedSum = 0;
|
|
304
|
+
for (const [id, fingerprint] of probe.metadata) {
|
|
305
|
+
if (id > cached.maxRowId) {
|
|
306
|
+
addedCount++;
|
|
307
|
+
addedSum += id;
|
|
308
|
+
} else if (cached.metadata.get(id) !== fingerprint)
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
return addedCount === probe.rowCount - cached.rowCount && cached.rowIdSum + addedSum === probe.rowIdSum;
|
|
312
|
+
}
|
|
313
|
+
function filterSearchPoolDates(rows, dateRange) {
|
|
314
|
+
if (dateRange === null)
|
|
315
|
+
return rows;
|
|
316
|
+
return rows.filter((row) => {
|
|
317
|
+
const compartment = searchPoolDates.get(row);
|
|
318
|
+
return compartment !== undefined && compartment.startTime !== null && compartment.endTime !== null && compartment.startTime <= dateRange.to && compartment.endTime >= dateRange.from;
|
|
319
|
+
});
|
|
228
320
|
}
|
|
229
321
|
function getSearchRowsStatement(db, withModel) {
|
|
230
322
|
const map = withModel ? searchRowsByModelStatements : searchRowsStatements;
|
|
231
323
|
let stmt = map.get(db);
|
|
232
324
|
if (!stmt) {
|
|
233
|
-
stmt = db.prepare(`SELECT e.compartment_id AS compartmentId,
|
|
325
|
+
stmt = db.prepare(`SELECT e.id AS rowId, e.compartment_id AS compartmentId,
|
|
326
|
+
start_map.message_time_ms AS startTime, end_map.message_time_ms AS endTime,
|
|
234
327
|
e.session_id AS sessionId,
|
|
235
328
|
c.title AS title,
|
|
236
329
|
c.start_message AS compartmentStart,
|
|
@@ -243,48 +336,20 @@ function getSearchRowsStatement(db, withModel) {
|
|
|
243
336
|
e.dims AS dims,
|
|
244
337
|
e.vector AS vector
|
|
245
338
|
FROM compartment_chunk_embeddings e
|
|
246
|
-
|
|
339
|
+
JOIN compartments c ON c.id = e.compartment_id
|
|
340
|
+
LEFT JOIN message_fts_rowid_map start_map
|
|
341
|
+
ON start_map.session_id = c.session_id AND start_map.message_ordinal = c.start_message
|
|
342
|
+
LEFT JOIN message_fts_rowid_map end_map
|
|
343
|
+
ON end_map.session_id = c.session_id AND end_map.message_ordinal = c.end_message
|
|
247
344
|
WHERE e.session_id = ?
|
|
248
345
|
AND e.project_path = ?
|
|
249
|
-
|
|
250
|
-
|
|
346
|
+
${withModel ? "AND e.model_id = ?" : ""}
|
|
347
|
+
AND e.id > ? AND e.id <= ?
|
|
348
|
+
ORDER BY e.id ASC LIMIT 16`);
|
|
251
349
|
map.set(db, stmt);
|
|
252
350
|
}
|
|
253
351
|
return stmt;
|
|
254
352
|
}
|
|
255
|
-
function getDatedSearchRowsByModelStatement(db) {
|
|
256
|
-
let statement = datedSearchRowsByModelStatements.get(db);
|
|
257
|
-
if (!statement) {
|
|
258
|
-
statement = db.prepare(`SELECT e.compartment_id AS compartmentId,
|
|
259
|
-
e.session_id AS sessionId,
|
|
260
|
-
c.title AS title,
|
|
261
|
-
c.start_message AS compartmentStart,
|
|
262
|
-
c.end_message AS compartmentEnd,
|
|
263
|
-
e.window_index AS windowIndex,
|
|
264
|
-
e.start_ordinal AS windowStart,
|
|
265
|
-
e.end_ordinal AS windowEnd,
|
|
266
|
-
e.chunk_hash AS chunkHash,
|
|
267
|
-
e.model_id AS modelId,
|
|
268
|
-
e.dims AS dims,
|
|
269
|
-
e.vector AS vector
|
|
270
|
-
FROM compartment_chunk_embeddings e
|
|
271
|
-
JOIN compartments c ON c.id = e.compartment_id
|
|
272
|
-
JOIN message_fts_rowid_map AS start_map
|
|
273
|
-
ON start_map.session_id = c.session_id
|
|
274
|
-
AND start_map.message_ordinal = c.start_message
|
|
275
|
-
JOIN message_fts_rowid_map AS end_map
|
|
276
|
-
ON end_map.session_id = c.session_id
|
|
277
|
-
AND end_map.message_ordinal = c.end_message
|
|
278
|
-
WHERE e.session_id = ?
|
|
279
|
-
AND e.project_path = ?
|
|
280
|
-
AND e.model_id = ?
|
|
281
|
-
AND start_map.message_time_ms <= ?
|
|
282
|
-
AND end_map.message_time_ms >= ?
|
|
283
|
-
ORDER BY e.compartment_id ASC, e.window_index ASC`);
|
|
284
|
-
datedSearchRowsByModelStatements.set(db, statement);
|
|
285
|
-
}
|
|
286
|
-
return statement;
|
|
287
|
-
}
|
|
288
353
|
function getBackfillCandidateStatement(db) {
|
|
289
354
|
let stmt = backfillCandidateStatements.get(db);
|
|
290
355
|
if (!stmt) {
|
|
@@ -358,22 +423,30 @@ function touchDecodedSearchPoolEntry(entry) {
|
|
|
358
423
|
function estimateDecodedSearchPoolBytes(rows) {
|
|
359
424
|
let bytes = 0;
|
|
360
425
|
for (const row of rows) {
|
|
361
|
-
bytes += row.vector.byteLength +
|
|
426
|
+
bytes += row.vector.byteLength + 384 + 2 * (row.sessionId.length + row.title.length + row.chunkHash.length + row.modelId.length);
|
|
362
427
|
}
|
|
363
428
|
return bytes;
|
|
364
429
|
}
|
|
365
|
-
function cacheDecodedSearchPool(pool, key,
|
|
430
|
+
function cacheDecodedSearchPool(pool, key, probe, rows) {
|
|
366
431
|
const existing = pool.get(key);
|
|
367
432
|
if (existing)
|
|
368
433
|
removeDecodedSearchPoolEntry(existing);
|
|
369
434
|
const entry = {
|
|
370
435
|
pool,
|
|
371
436
|
key,
|
|
372
|
-
|
|
373
|
-
maxRowId,
|
|
437
|
+
...probe,
|
|
374
438
|
rows,
|
|
375
439
|
byteSize: estimateDecodedSearchPoolBytes(rows)
|
|
376
440
|
};
|
|
441
|
+
entry.byteSize += probe.ids.length * 8;
|
|
442
|
+
for (const metadata of probe.metadata.values()) {
|
|
443
|
+
entry.byteSize += 320;
|
|
444
|
+
for (const key of SEARCH_SCOPE_METADATA_FIELDS) {
|
|
445
|
+
const value = metadata[key];
|
|
446
|
+
if (typeof value === "string")
|
|
447
|
+
entry.byteSize += 2 * value.length;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
377
450
|
pool.set(key, entry);
|
|
378
451
|
decodedSearchPoolLru.set(entry, true);
|
|
379
452
|
decodedSearchPoolBytes += entry.byteSize;
|
|
@@ -384,16 +457,6 @@ function cacheDecodedSearchPool(pool, key, rowCount, maxRowId, rows) {
|
|
|
384
457
|
removeDecodedSearchPoolEntry(oldest);
|
|
385
458
|
}
|
|
386
459
|
}
|
|
387
|
-
function invalidateDecodedSearchPools(db, predicate) {
|
|
388
|
-
const pool = decodedSearchPools.get(db);
|
|
389
|
-
if (!pool)
|
|
390
|
-
return;
|
|
391
|
-
for (const [key, entry] of [...pool.entries()]) {
|
|
392
|
-
const parsed = JSON.parse(key);
|
|
393
|
-
if (predicate(parsed))
|
|
394
|
-
removeDecodedSearchPoolEntry(entry);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
460
|
function isFinitePositiveInteger(value) {
|
|
398
461
|
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
399
462
|
}
|
|
@@ -692,58 +755,104 @@ function replaceCompartmentChunkEmbeddings(db, rows, windowSourceKey) {
|
|
|
692
755
|
recordChunkWindowSource(db, compartmentId, windowSourceKey, rows.map((row) => [row.window.windowIndex, row.window.chunkHash]));
|
|
693
756
|
}
|
|
694
757
|
}).immediate();
|
|
695
|
-
invalidateDecodedSearchPools(db, ([sessionId, projectPath, cachedModelId]) => sessionId === rows[0].sessionId && projectPath === rows[0].projectPath && cachedModelId === modelId);
|
|
696
758
|
}
|
|
697
|
-
|
|
759
|
+
var yieldSearchPool = () => new Promise((resolve) => setImmediate(resolve));
|
|
760
|
+
function searchPoolInTransaction(db) {
|
|
761
|
+
const connection = db;
|
|
762
|
+
return connection.inTransaction === true || connection.isTransaction === true;
|
|
763
|
+
}
|
|
764
|
+
async function refreshDecodedSearchPool(db, sessionId, projectPath, modelId) {
|
|
765
|
+
const key = searchPoolKey(sessionId, projectPath, modelId);
|
|
766
|
+
const pool = getDecodedSearchPool(db);
|
|
767
|
+
for (;; ) {
|
|
768
|
+
const inTransaction = searchPoolInTransaction(db);
|
|
769
|
+
const previous = pool.get(key);
|
|
770
|
+
const probe = await probeSearchScope(db, sessionId, projectPath, modelId, previous);
|
|
771
|
+
const rowCount = probe.rowCount;
|
|
772
|
+
const maxRowId = probe.maxRowId;
|
|
773
|
+
const cached = pool.get(key);
|
|
774
|
+
if (!inTransaction && cached && sameSearchScope(cached, probe)) {
|
|
775
|
+
touchDecodedSearchPoolEntry(cached);
|
|
776
|
+
return cached.rows;
|
|
777
|
+
}
|
|
778
|
+
const append = !inTransaction && cached && scopeOnlyAppended(cached, probe);
|
|
779
|
+
if (append)
|
|
780
|
+
searchPoolStats.appends++;
|
|
781
|
+
else
|
|
782
|
+
searchPoolStats.fullRebuilds++;
|
|
783
|
+
let afterId = append ? cached.maxRowId : 0;
|
|
784
|
+
const added = [];
|
|
785
|
+
let appendedCount = 0;
|
|
786
|
+
await yieldSearchPool();
|
|
787
|
+
for (;; ) {
|
|
788
|
+
const rows = getSearchRowsStatement(db, true).all(sessionId, projectPath, modelId, afterId, maxRowId);
|
|
789
|
+
if (rows.length === 0)
|
|
790
|
+
break;
|
|
791
|
+
afterId = rows[rows.length - 1].rowId;
|
|
792
|
+
appendedCount += rows.length;
|
|
793
|
+
for (const row of rows) {
|
|
794
|
+
if (typeof row.compartmentId !== "number" || typeof row.sessionId !== "string" || typeof row.title !== "string" || typeof row.compartmentStart !== "number" || typeof row.compartmentEnd !== "number" || typeof row.windowIndex !== "number" || typeof row.windowStart !== "number" || typeof row.windowEnd !== "number" || typeof row.chunkHash !== "string" || typeof row.modelId !== "string" || typeof row.dims !== "number" || !(row.vector instanceof Uint8Array || row.vector instanceof ArrayBuffer))
|
|
795
|
+
continue;
|
|
796
|
+
added.push({
|
|
797
|
+
compartmentId: row.compartmentId,
|
|
798
|
+
sessionId: row.sessionId,
|
|
799
|
+
title: row.title,
|
|
800
|
+
startOrdinal: row.compartmentStart,
|
|
801
|
+
endOrdinal: row.compartmentEnd,
|
|
802
|
+
windowIndex: row.windowIndex,
|
|
803
|
+
windowStartOrdinal: row.windowStart,
|
|
804
|
+
windowEndOrdinal: row.windowEnd,
|
|
805
|
+
chunkHash: row.chunkHash,
|
|
806
|
+
modelId: row.modelId,
|
|
807
|
+
dims: row.dims,
|
|
808
|
+
vector: toFloat32Array(row.vector)
|
|
809
|
+
});
|
|
810
|
+
searchPoolDates.set(added[added.length - 1], {
|
|
811
|
+
startTime: row.startTime,
|
|
812
|
+
endTime: row.endTime
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
await yieldSearchPool();
|
|
816
|
+
}
|
|
817
|
+
const endProbe = await probeSearchScope(db, sessionId, projectPath, modelId, probe);
|
|
818
|
+
if (!sameSearchScope(probe, endProbe) || searchPoolInTransaction(db) !== inTransaction) {
|
|
819
|
+
continue;
|
|
820
|
+
}
|
|
821
|
+
if (append && appendedCount !== rowCount - cached.rowCount) {
|
|
822
|
+
removeDecodedSearchPoolEntry(cached);
|
|
823
|
+
continue;
|
|
824
|
+
}
|
|
825
|
+
const decoded = append ? cached.rows.concat(added) : added;
|
|
826
|
+
decoded.sort((a, b) => a.compartmentId - b.compartmentId || a.windowIndex - b.windowIndex);
|
|
827
|
+
if (!inTransaction)
|
|
828
|
+
cacheDecodedSearchPool(pool, key, probe, decoded);
|
|
829
|
+
return decoded;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
async function loadCompartmentChunkEmbeddingsForSearch(db, sessionId, projectPath, modelId, dateRange = null) {
|
|
698
833
|
if (!modelId) {
|
|
699
834
|
throw new Error("loadCompartmentChunkEmbeddingsForSearch requires a current model id");
|
|
700
835
|
}
|
|
701
|
-
if (dateRange !== null) {
|
|
702
|
-
const rows = getDatedSearchRowsByModelStatement(db).all(sessionId, projectPath, modelId, dateRange.to, dateRange.from);
|
|
703
|
-
return rows.filter((row) => typeof row.compartmentId === "number" && typeof row.sessionId === "string" && typeof row.title === "string" && typeof row.compartmentStart === "number" && typeof row.compartmentEnd === "number" && typeof row.windowIndex === "number" && typeof row.windowStart === "number" && typeof row.windowEnd === "number" && typeof row.chunkHash === "string" && typeof row.modelId === "string" && typeof row.dims === "number" && (row.vector instanceof Uint8Array || row.vector instanceof ArrayBuffer)).map((row) => ({
|
|
704
|
-
compartmentId: row.compartmentId,
|
|
705
|
-
sessionId: row.sessionId,
|
|
706
|
-
title: row.title,
|
|
707
|
-
startOrdinal: row.compartmentStart,
|
|
708
|
-
endOrdinal: row.compartmentEnd,
|
|
709
|
-
windowIndex: row.windowIndex,
|
|
710
|
-
windowStartOrdinal: row.windowStart,
|
|
711
|
-
windowEndOrdinal: row.windowEnd,
|
|
712
|
-
chunkHash: row.chunkHash,
|
|
713
|
-
modelId: row.modelId,
|
|
714
|
-
dims: row.dims,
|
|
715
|
-
vector: toFloat32Array(row.vector)
|
|
716
|
-
}));
|
|
717
|
-
}
|
|
718
836
|
const key = searchPoolKey(sessionId, projectPath, modelId);
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
837
|
+
let pending = pendingSearchPools.get(db);
|
|
838
|
+
if (!pending) {
|
|
839
|
+
pending = new Map;
|
|
840
|
+
pendingSearchPools.set(db, pending);
|
|
841
|
+
}
|
|
842
|
+
for (;; ) {
|
|
843
|
+
while (pending.has(key))
|
|
844
|
+
await pending.get(key);
|
|
845
|
+
const operation = refreshDecodedSearchPool(db, sessionId, projectPath, modelId);
|
|
846
|
+
const completion = operation.then(() => {});
|
|
847
|
+
pending.set(key, completion);
|
|
848
|
+
try {
|
|
849
|
+
const rows = await operation;
|
|
850
|
+
return filterSearchPoolDates(rows, dateRange);
|
|
851
|
+
} finally {
|
|
852
|
+
pending.delete(key);
|
|
853
|
+
completion.catch(() => {});
|
|
854
|
+
}
|
|
727
855
|
}
|
|
728
|
-
if (cached)
|
|
729
|
-
removeDecodedSearchPoolEntry(cached);
|
|
730
|
-
const rows = getSearchRowsStatement(db, true).all(sessionId, projectPath, modelId);
|
|
731
|
-
const decodedRows = rows.filter((row) => typeof row.compartmentId === "number" && typeof row.sessionId === "string" && typeof row.title === "string" && typeof row.compartmentStart === "number" && typeof row.compartmentEnd === "number" && typeof row.windowIndex === "number" && typeof row.windowStart === "number" && typeof row.windowEnd === "number" && typeof row.chunkHash === "string" && typeof row.modelId === "string" && typeof row.dims === "number" && (row.vector instanceof Uint8Array || row.vector instanceof ArrayBuffer)).map((row) => ({
|
|
732
|
-
compartmentId: row.compartmentId,
|
|
733
|
-
sessionId: row.sessionId,
|
|
734
|
-
title: row.title,
|
|
735
|
-
startOrdinal: row.compartmentStart,
|
|
736
|
-
endOrdinal: row.compartmentEnd,
|
|
737
|
-
windowIndex: row.windowIndex,
|
|
738
|
-
windowStartOrdinal: row.windowStart,
|
|
739
|
-
windowEndOrdinal: row.windowEnd,
|
|
740
|
-
chunkHash: row.chunkHash,
|
|
741
|
-
modelId: row.modelId,
|
|
742
|
-
dims: row.dims,
|
|
743
|
-
vector: toFloat32Array(row.vector)
|
|
744
|
-
}));
|
|
745
|
-
cacheDecodedSearchPool(pool, key, rowCount, maxRowId, decodedRows);
|
|
746
|
-
return decodedRows;
|
|
747
856
|
}
|
|
748
857
|
function loadUnembeddedShadowChunkCandidates(db, projectPath, primaryModelId, shadowModelId, limit, shadowMaxInputTokens) {
|
|
749
858
|
const rows = getShadowBackfillCandidateStatement(db).all(projectPath, projectPath, primaryModelId);
|
|
@@ -928,7 +1037,6 @@ function renumberOneBasedChunkWindows(db, candidate, projectPath, modelId, windo
|
|
|
928
1037
|
recordChunkWindowSource(db, candidate.id, sourceKey, windows.map((window) => [window.windowIndex, window.chunkHash]));
|
|
929
1038
|
}
|
|
930
1039
|
}).immediate();
|
|
931
|
-
invalidateDecodedSearchPools(db, ([sessionId, cachedProjectPath, cachedModelId]) => sessionId === candidate.sessionId && cachedProjectPath === projectPath && cachedModelId === modelId);
|
|
932
1040
|
}
|
|
933
1041
|
function classifyChunkCoverageDefect(db, projectPath, modelId, candidate, maxInputTokens) {
|
|
934
1042
|
const mappedText = buildCanonicalChunkTextFromFts(db, candidate.sessionId, candidate.startMessage, candidate.endMessage);
|
|
@@ -1032,6 +1140,18 @@ function getSessionBackfillRows(db, projectPath, sessionId) {
|
|
|
1032
1140
|
ORDER BY c.start_message ASC, c.id ASC`).all(projectPath, sessionId);
|
|
1033
1141
|
return mapBackfillCandidateRows(rows);
|
|
1034
1142
|
}
|
|
1143
|
+
async function countSessionCompartmentEmbedCoveragePolite(db, projectPath, sessionId, modelId, maxInputTokens = DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS) {
|
|
1144
|
+
const candidates = getSessionBackfillRows(db, projectPath, sessionId);
|
|
1145
|
+
let embedded = 0;
|
|
1146
|
+
let started = performance.now();
|
|
1147
|
+
for (const candidate of candidates) {
|
|
1148
|
+
const { defect } = classifyChunkCoverageDefect(db, projectPath, modelId, candidate, maxInputTokens);
|
|
1149
|
+
if (defect === null || defect === "renumber")
|
|
1150
|
+
embedded++;
|
|
1151
|
+
started = await yieldCoverageSlice(started);
|
|
1152
|
+
}
|
|
1153
|
+
return { embedded, total: candidates.length };
|
|
1154
|
+
}
|
|
1035
1155
|
async function countUnembeddedSessionCompartmentsPolite(db, projectPath, sessionId, modelId, maxInputTokens = DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS) {
|
|
1036
1156
|
const candidates = getSessionBackfillRows(db, projectPath, sessionId);
|
|
1037
1157
|
let count = 0;
|
|
@@ -1045,4 +1165,4 @@ async function countUnembeddedSessionCompartmentsPolite(db, projectPath, session
|
|
|
1045
1165
|
return count;
|
|
1046
1166
|
}
|
|
1047
1167
|
|
|
1048
|
-
export { CHUNK_WINDOW_SAFETY_RATIO, normalizeCompartmentChunkMaxInputTokens, buildCanonicalChunkTextFromFts, buildCompartmentSummaryFallbackText, canonicalizeInMemoryChunkTextForEmbedding, chunkCanonicalText, chunkEmbeddingWindowsAreCurrent, replaceCompartmentChunkEmbeddings, loadCompartmentChunkEmbeddingsForSearch, loadUnembeddedShadowChunkCandidates, loadUnembeddedCompartmentChunkCandidatesPolite, deleteChunkEmbedBackoffForSession, recordChunkEmbedBackoff, chunkWindowSourceKey, loadUnembeddedSessionChunkCandidatesPolite, countSessionCompartmentEmbedCoverage, countUnembeddedSessionCompartmentsPolite };
|
|
1168
|
+
export { CHUNK_WINDOW_SAFETY_RATIO, normalizeCompartmentChunkMaxInputTokens, buildCanonicalChunkTextFromFts, buildCompartmentSummaryFallbackText, canonicalizeInMemoryChunkTextForEmbedding, chunkCanonicalText, chunkEmbeddingWindowsAreCurrent, replaceCompartmentChunkEmbeddings, loadCompartmentChunkEmbeddingsForSearch, loadUnembeddedShadowChunkCandidates, loadUnembeddedCompartmentChunkCandidatesPolite, deleteChunkEmbedBackoffForSession, recordChunkEmbedBackoff, chunkWindowSourceKey, loadUnembeddedSessionChunkCandidatesPolite, countSessionCompartmentEmbedCoverage, countSessionCompartmentEmbedCoveragePolite, countUnembeddedSessionCompartmentsPolite };
|
|
@@ -6001,4 +6001,4 @@ function deriveDefaultProtectedTokens(usableSoft) {
|
|
|
6001
6001
|
return Math.min(64000, Math.max(lowerBound, target));
|
|
6002
6002
|
}
|
|
6003
6003
|
|
|
6004
|
-
export { string, unknown, array, object, union, tuple, record, withContentLanguageDirective, buildPrimaryLanguageDirective, parseCron, nextOccurrence, nextDueAtMs, renderToolTemplate, promptSurfaceConfigIdentity, resolveModelConfigValue, resolvePromptSurface, DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE, DEFAULT_HISTORIAN_TIMEOUT_MS, PROTECTED_TOKENS_MIN, DEFAULT_LOCAL_EMBEDDING_MODEL, PER_HARNESS_MIGRATION_INVENTORY, PER_HARNESS_MODEL_KEYS, ConfigProfilesSchema, DREAM_TASK_PROMOTION_DEFAULTS, MagicContextConfigSchema, LIVE_RELOAD_CONFIG_PATHS, deriveDefaultProtectedTokens };
|
|
6004
|
+
export { string, unknown, array, object, union, tuple, record, isValidLanguageCode, withContentLanguageDirective, buildPrimaryLanguageDirective, parseCron, nextOccurrence, nextDueAtMs, renderToolTemplate, promptSurfaceConfigIdentity, resolveModelConfigValue, resolvePromptSurface, DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE, DEFAULT_HISTORIAN_TIMEOUT_MS, PROTECTED_TOKENS_MIN, DEFAULT_LOCAL_EMBEDDING_MODEL, PER_HARNESS_MIGRATION_INVENTORY, PER_HARNESS_MODEL_KEYS, ConfigProfilesSchema, DREAM_TASK_PROMOTION_DEFAULTS, MagicContextConfigSchema, LIVE_RELOAD_CONFIG_PATHS, deriveDefaultProtectedTokens };
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
buildCanonicalChunkTextFromFts,
|
|
22
22
|
loadCompartmentChunkEmbeddingsForSearch
|
|
23
|
-
} from "./server-
|
|
23
|
+
} from "./server-ewqshbs8.js";
|
|
24
24
|
import {
|
|
25
25
|
recordEmbeddingMeasurement,
|
|
26
26
|
saveCommitEmbedding,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
enqueueShadowEmbeddingItems2,
|
|
38
38
|
getProjectEmbeddingSnapshot2,
|
|
39
39
|
embedItemsForProject2
|
|
40
|
-
} from "./server-
|
|
40
|
+
} from "./server-sg68np13.js";
|
|
41
41
|
import {
|
|
42
42
|
getProjectEmbeddings2
|
|
43
43
|
} from "./server-4dhv7mqz.js";
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
isEmbeddingEnabled,
|
|
47
47
|
embedText,
|
|
48
48
|
ensureMemoryEmbeddings2
|
|
49
|
-
} from "./server-
|
|
49
|
+
} from "./server-rxcq4t50.js";
|
|
50
50
|
import {
|
|
51
51
|
ModuleMemoryAuthorityError2,
|
|
52
52
|
getMemoriesByProject2,
|
|
@@ -61,13 +61,13 @@ import {
|
|
|
61
61
|
sanitizeFtsQuery,
|
|
62
62
|
searchMemoriesFTS,
|
|
63
63
|
searchMemoriesFTSUnion
|
|
64
|
-
} from "./server-
|
|
64
|
+
} from "./server-kn7skz9r.js";
|
|
65
65
|
import {
|
|
66
66
|
isRecord
|
|
67
67
|
} from "./server-kmapq3v0.js";
|
|
68
68
|
import {
|
|
69
69
|
getIndexedMessageCorpusSize2
|
|
70
|
-
} from "./server-
|
|
70
|
+
} from "./server-d3f4g62c.js";
|
|
71
71
|
import {
|
|
72
72
|
resolveWorkspaceShareCategories,
|
|
73
73
|
resolveWorkspaceIdentitySet,
|
|
@@ -2656,15 +2656,20 @@ function searchNotes(args) {
|
|
|
2656
2656
|
sourceSessionId: entry.entry.note.sessionId
|
|
2657
2657
|
}));
|
|
2658
2658
|
}
|
|
2659
|
-
function searchCompartmentChunks(args) {
|
|
2659
|
+
async function searchCompartmentChunks(args) {
|
|
2660
2660
|
if (!args.queryEmbedding || args.limit <= 0 || !args.modelId || args.modelId === "off")
|
|
2661
2661
|
return [];
|
|
2662
2662
|
const cutoff = args.maxOrdinal != null && args.maxOrdinal >= 0 ? args.maxOrdinal : null;
|
|
2663
|
-
const rows = loadCompartmentChunkEmbeddingsForSearch(args.db, args.sessionId, args.projectPath, args.modelId, args.dateRange);
|
|
2663
|
+
const rows = await loadCompartmentChunkEmbeddingsForSearch(args.db, args.sessionId, args.projectPath, args.modelId, args.dateRange);
|
|
2664
2664
|
if (rows.length === 0)
|
|
2665
2665
|
return [];
|
|
2666
2666
|
const byCompartment = new Map;
|
|
2667
|
+
let sliceStarted = performance.now();
|
|
2667
2668
|
for (const row of rows) {
|
|
2669
|
+
if (performance.now() - sliceStarted >= 4) {
|
|
2670
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
2671
|
+
sliceStarted = performance.now();
|
|
2672
|
+
}
|
|
2668
2673
|
if (cutoff !== null && row.endOrdinal > cutoff) {
|
|
2669
2674
|
continue;
|
|
2670
2675
|
}
|
|
@@ -3020,7 +3025,7 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
|
|
|
3020
3025
|
const workspace = resolveSearchWorkspaceContext(db, projectPath);
|
|
3021
3026
|
const embeddingModelId = queryContract?.modelId ?? options.embeddingModelIdOverride ?? embeddingSnapshot?.modelId;
|
|
3022
3027
|
const chunkModelId = queryContract?.chunkModelId ?? options.chunkModelIdOverride ?? embeddingSnapshot?.chunkModelId;
|
|
3023
|
-
const compartmentResults = runCompartmentChunks ? searchCompartmentChunks({
|
|
3028
|
+
const compartmentResults = runCompartmentChunks ? await searchCompartmentChunks({
|
|
3024
3029
|
db,
|
|
3025
3030
|
sessionId,
|
|
3026
3031
|
projectPath,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-jc8v585p.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
6
|
} from "./server-9e5r8y60.js";
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
} from "./server-988cqjme.js";
|
|
11
11
|
import {
|
|
12
12
|
LocalEmbeddingProvider
|
|
13
|
-
} from "./server-
|
|
13
|
+
} from "./server-83d71zab.js";
|
|
14
14
|
import {
|
|
15
15
|
OpenAICompatibleEmbeddingProvider,
|
|
16
16
|
getProjectEmbeddingSnapshot2,
|
|
17
17
|
embedBatchForProject2
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-sg68np13.js";
|
|
19
19
|
import {
|
|
20
20
|
isEmbeddingHostBusy2
|
|
21
21
|
} from "./server-qt1qqasc.js";
|