@cortexkit/pi-magic-context 0.49.24 → 0.49.26
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 +4 -4
- package/dist/chunk-embedding-write-worker.js +6 -6
- package/dist/{compartment-chunk-embedding-g9a977b8.js → compartment-chunk-embedding-vt6afvdm.js} +3 -3
- package/dist/{embedding-backfill-qxzjy5v2.js → embedding-backfill-jc5fqt5s.js} +5 -5
- package/dist/{index-3c3ztwgc.js → index-0dr64gsy.js} +1 -1
- package/dist/{index-8976mezv.js → index-23t8ryqw.js} +148 -12
- package/dist/{index-hf01gtz7.js → index-87xm7z44.js} +6 -50
- package/dist/{index-wb2t932e.js → index-dnadppqx.js} +1 -1
- package/dist/{index-8a2wvrda.js → index-g0d51qzc.js} +1 -1
- package/dist/{index-faz8bw8b.js → index-kbswhkc8.js} +1 -1
- package/dist/{index-3jde7hdr.js → index-r1hvaza0.js} +4 -4
- package/dist/{index-byh4rfe7.js → index-rjnc6kkf.js} +17 -3
- package/dist/{index-nxq2srg9.js → index-w5v0ntbw.js} +1 -1
- package/dist/{index-ygzh9xdg.js → index-wpy2rzb2.js} +1 -1
- package/dist/{index-8hmqdav2.js → index-z24d75tz.js} +39 -6
- package/dist/{index-00c5a49f.js → index-z6k6jsmh.js} +1 -1
- package/dist/{index-fbrxezw0.js → index-zpmz6x24.js} +10 -10
- package/dist/{index-rk8xef10.js → index-zz7dnyh6.js} +5 -5
- package/dist/index.js +35 -25
- package/dist/{message-fts-rowid-map-1tb3qjtc.js → message-fts-rowid-map-xe3ss2g3.js} +2 -2
- package/dist/{message-index-bounded-hjat9176.js → message-index-bounded-2zffszp9.js} +6 -6
- package/dist/{message-index-esykp965.js → message-index-jv1m3g8d.js} +6 -6
- package/dist/migration-worker.js +5 -5
- package/dist/{project-embedding-registry-9e82qsb6.js → project-embedding-registry-bn9ts1h0.js} +4 -4
- package/dist/raw-ordinal-warmup-worker.js +6 -6
- package/dist/{read-session-chunk-tzvv1kph.js → read-session-chunk-p0cexvvs.js} +5 -3
- package/dist/{read-session-raw-napqv76k.js → read-session-raw-mq03ws9v.js} +3 -1
- package/dist/{search-archive-enx1vd9n.js → search-archive-jw2wm4tw.js} +4 -4
- package/dist/{search-n3yqng95.js → search-vmcbbwm5.js} +10 -10
- package/dist/subagent-entry.js +13 -13
- package/dist/tag-snapshot-worker-pi.js +6 -6
- package/package.json +1 -1
|
@@ -24,12 +24,12 @@ var [
|
|
|
24
24
|
{ Database, registerSqliteDiagnosticSink },
|
|
25
25
|
{ log }
|
|
26
26
|
] = await Promise.all([
|
|
27
|
-
import("./embedding-backfill-
|
|
27
|
+
import("./embedding-backfill-jc5fqt5s.js"),
|
|
28
28
|
import("./embedding-cache-7rp4gqzr.js"),
|
|
29
29
|
import("./storage-memory-0ndn65fm.js"),
|
|
30
|
-
import("./project-embedding-registry-
|
|
31
|
-
import("./search-
|
|
32
|
-
import("./compartment-chunk-embedding-
|
|
30
|
+
import("./project-embedding-registry-bn9ts1h0.js"),
|
|
31
|
+
import("./search-vmcbbwm5.js"),
|
|
32
|
+
import("./compartment-chunk-embedding-vt6afvdm.js"),
|
|
33
33
|
import("./embedding-activity-ew6dshfd.js"),
|
|
34
34
|
import("./harness-9872e0ym.js"),
|
|
35
35
|
import("./sqlite-v89bj0yy.js"),
|
|
@@ -15,14 +15,14 @@ import"./index-my0dn413.js";
|
|
|
15
15
|
import"./index-fgs78jyd.js";
|
|
16
16
|
import"./index-gwxaz0z5.js";
|
|
17
17
|
import"./index-399p688g.js";
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
18
|
+
import"./index-z24d75tz.js";
|
|
19
|
+
import"./index-g0d51qzc.js";
|
|
20
20
|
import {
|
|
21
21
|
replaceCompartmentChunkEmbeddings2,
|
|
22
22
|
recordChunkEmbedBackoff2,
|
|
23
23
|
loadUnembeddedSessionChunkCandidates2,
|
|
24
24
|
countUnembeddedSessionCompartments2
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-dnadppqx.js";
|
|
26
26
|
import {
|
|
27
27
|
recordSessionProjectIdentity,
|
|
28
28
|
acquireGitSweepLease,
|
|
@@ -34,11 +34,11 @@ import"./index-n4wyxcgr.js";
|
|
|
34
34
|
import {
|
|
35
35
|
LATEST_SUPPORTED_VERSION,
|
|
36
36
|
enforceSchemaFence
|
|
37
|
-
} from "./index-
|
|
38
|
-
import"./index-
|
|
37
|
+
} from "./index-r1hvaza0.js";
|
|
38
|
+
import"./index-0dr64gsy.js";
|
|
39
39
|
import"./index-w1avzkdt.js";
|
|
40
40
|
import"./index-135e8hvg.js";
|
|
41
|
-
import"./index-
|
|
41
|
+
import"./index-23t8ryqw.js";
|
|
42
42
|
import"./index-hqw0rt9k.js";
|
|
43
43
|
|
|
44
44
|
// ../plugin/src/features/magic-context/chunk-embedding-write-worker.ts
|
package/dist/{compartment-chunk-embedding-g9a977b8.js → compartment-chunk-embedding-vt6afvdm.js}
RENAMED
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
countSessionCompartmentEmbedCoverage2,
|
|
25
25
|
countSessionCompartmentEmbedCoveragePolite2,
|
|
26
26
|
countUnembeddedSessionCompartmentsPolite2
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-dnadppqx.js";
|
|
28
28
|
import"./index-gwxaz0z5.js";
|
|
29
|
-
import"./index-
|
|
30
|
-
import"./index-
|
|
29
|
+
import"./index-g0d51qzc.js";
|
|
30
|
+
import"./index-z24d75tz.js";
|
|
31
31
|
import"./index-399p688g.js";
|
|
32
32
|
import"./index-hqw0rt9k.js";
|
|
33
33
|
import"./index-my0dn413.js";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureMemoryEmbeddings2
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
3
|
+
} from "./index-w5v0ntbw.js";
|
|
4
|
+
import"./index-z6k6jsmh.js";
|
|
5
5
|
import"./index-9p40dgkm.js";
|
|
6
6
|
import"./index-yhzhdp3m.js";
|
|
7
7
|
import"./index-j3pz3a1b.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-dnadppqx.js";
|
|
9
9
|
import"./index-wqpjhx1p.js";
|
|
10
10
|
import"./index-gwxaz0z5.js";
|
|
11
11
|
import"./index-ccanzg8p.js";
|
|
12
12
|
import"./index-hxp6q5f8.js";
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-
|
|
13
|
+
import"./index-g0d51qzc.js";
|
|
14
|
+
import"./index-z24d75tz.js";
|
|
15
15
|
import"./index-399p688g.js";
|
|
16
16
|
import"./index-hqw0rt9k.js";
|
|
17
17
|
import"./index-my0dn413.js";
|
|
@@ -1,3 +1,48 @@
|
|
|
1
|
+
// ../plugin/src/shared/bounded-session-map.ts
|
|
2
|
+
class BoundedSessionMap {
|
|
3
|
+
maxEntries;
|
|
4
|
+
store = new Map;
|
|
5
|
+
constructor(maxEntries) {
|
|
6
|
+
if (!Number.isFinite(maxEntries) || maxEntries < 1) {
|
|
7
|
+
throw new Error(`BoundedSessionMap: maxEntries must be >= 1, got ${maxEntries}`);
|
|
8
|
+
}
|
|
9
|
+
this.maxEntries = maxEntries;
|
|
10
|
+
}
|
|
11
|
+
get(sessionId) {
|
|
12
|
+
const value = this.store.get(sessionId);
|
|
13
|
+
if (value === undefined)
|
|
14
|
+
return;
|
|
15
|
+
this.store.delete(sessionId);
|
|
16
|
+
this.store.set(sessionId, value);
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
peek(sessionId) {
|
|
20
|
+
return this.store.get(sessionId);
|
|
21
|
+
}
|
|
22
|
+
has(sessionId) {
|
|
23
|
+
return this.store.has(sessionId);
|
|
24
|
+
}
|
|
25
|
+
set(sessionId, value) {
|
|
26
|
+
if (this.store.has(sessionId)) {
|
|
27
|
+
this.store.delete(sessionId);
|
|
28
|
+
} else if (this.store.size >= this.maxEntries) {
|
|
29
|
+
const oldest = this.store.keys().next().value;
|
|
30
|
+
if (oldest !== undefined)
|
|
31
|
+
this.store.delete(oldest);
|
|
32
|
+
}
|
|
33
|
+
this.store.set(sessionId, value);
|
|
34
|
+
}
|
|
35
|
+
delete(sessionId) {
|
|
36
|
+
return this.store.delete(sessionId);
|
|
37
|
+
}
|
|
38
|
+
clear() {
|
|
39
|
+
this.store.clear();
|
|
40
|
+
}
|
|
41
|
+
get size() {
|
|
42
|
+
return this.store.size;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
1
46
|
// ../plugin/src/shared/opencode-db-path.ts
|
|
2
47
|
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
3
48
|
import { homedir } from "node:os";
|
|
@@ -176,34 +221,125 @@ function claimOpenCodeDbDiagnosticOnce(surface, resolution) {
|
|
|
176
221
|
}
|
|
177
222
|
|
|
178
223
|
// ../plugin/src/features/magic-context/tool-definition-tokens.ts
|
|
179
|
-
var
|
|
180
|
-
var
|
|
224
|
+
var ACTIVITY_WINDOW_MS = 10 * 60000;
|
|
225
|
+
var MAX_ACTIVITY_GAP_MS = 60000;
|
|
226
|
+
var WINDOWED_SINCE_KEY = "tool_definition_measurements:windowed_since";
|
|
227
|
+
var routes = new Map;
|
|
228
|
+
var sessionFlights = new BoundedSessionMap(1000);
|
|
181
229
|
var persistenceDb = null;
|
|
230
|
+
var windowedSince;
|
|
231
|
+
var boundAt = 0;
|
|
182
232
|
var cachedInsertStmt = null;
|
|
233
|
+
var cachedDeleteStmt = null;
|
|
234
|
+
function agentKey(agentName) {
|
|
235
|
+
return agentName && agentName.length > 0 ? agentName : "default";
|
|
236
|
+
}
|
|
183
237
|
function keyFor(providerID, modelID, agentName) {
|
|
184
|
-
|
|
185
|
-
|
|
238
|
+
return `${providerID}/${modelID}/${agentKey(agentName)}`;
|
|
239
|
+
}
|
|
240
|
+
function routeFor(providerID, modelID, agentName) {
|
|
241
|
+
const key = keyFor(providerID, modelID, agentName);
|
|
242
|
+
let route = routes.get(key);
|
|
243
|
+
if (!route) {
|
|
244
|
+
route = {
|
|
245
|
+
providerID,
|
|
246
|
+
modelID,
|
|
247
|
+
agentName: agentKey(agentName),
|
|
248
|
+
tools: new Map,
|
|
249
|
+
live: false,
|
|
250
|
+
clock: 0,
|
|
251
|
+
lastWallAt: Date.now(),
|
|
252
|
+
oldestFireAt: Number.POSITIVE_INFINITY,
|
|
253
|
+
retired: new Map,
|
|
254
|
+
legacyRows: new Set
|
|
255
|
+
};
|
|
256
|
+
routes.set(key, route);
|
|
257
|
+
}
|
|
258
|
+
return { key, route };
|
|
259
|
+
}
|
|
260
|
+
function advanceClock(route) {
|
|
261
|
+
const now = Date.now();
|
|
262
|
+
const gap = Math.min(Math.max(now - route.lastWallAt, 0), MAX_ACTIVITY_GAP_MS);
|
|
263
|
+
route.clock += gap;
|
|
264
|
+
route.lastWallAt = Math.max(route.lastWallAt, now);
|
|
265
|
+
return route.clock;
|
|
266
|
+
}
|
|
267
|
+
function readWindowedSince(db) {
|
|
268
|
+
try {
|
|
269
|
+
const row = db.prepare("SELECT value FROM schema_migrations_meta WHERE key = ?").get(WINDOWED_SINCE_KEY);
|
|
270
|
+
if (!row)
|
|
271
|
+
return;
|
|
272
|
+
const value = Number(row.value);
|
|
273
|
+
return Number.isFinite(value) ? value : undefined;
|
|
274
|
+
} catch {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function markWindowed() {
|
|
279
|
+
if (windowedSince !== undefined || !persistenceDb)
|
|
280
|
+
return;
|
|
281
|
+
try {
|
|
282
|
+
persistenceDb.prepare("INSERT OR IGNORE INTO schema_migrations_meta (key, value) VALUES (?, ?)").run(WINDOWED_SINCE_KEY, String(boundAt));
|
|
283
|
+
windowedSince = readWindowedSince(persistenceDb);
|
|
284
|
+
} catch {}
|
|
186
285
|
}
|
|
187
286
|
function setDatabase(db) {
|
|
287
|
+
const rebound = persistenceDb !== null && persistenceDb !== db;
|
|
188
288
|
persistenceDb = db;
|
|
289
|
+
boundAt = Date.now();
|
|
189
290
|
cachedInsertStmt = null;
|
|
291
|
+
cachedDeleteStmt = null;
|
|
292
|
+
if (rebound) {
|
|
293
|
+
for (const route of routes.values()) {
|
|
294
|
+
for (const slot of route.tools.values()) {
|
|
295
|
+
slot.persisted = false;
|
|
296
|
+
slot.writeFailedAt = undefined;
|
|
297
|
+
}
|
|
298
|
+
for (const retired of route.retired.values())
|
|
299
|
+
retired.rowKept = false;
|
|
300
|
+
route.legacyRows.clear();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
windowedSince = readWindowedSince(db);
|
|
304
|
+
if (windowedSince !== undefined)
|
|
305
|
+
return;
|
|
306
|
+
try {
|
|
307
|
+
if (!db.prepare("SELECT 1 FROM tool_definition_measurements LIMIT 1").get())
|
|
308
|
+
markWindowed();
|
|
309
|
+
} catch {}
|
|
190
310
|
}
|
|
191
311
|
function loadToolDefinitionMeasurements(db) {
|
|
192
312
|
let rows = [];
|
|
193
313
|
try {
|
|
194
|
-
rows = db.prepare("SELECT provider_id, model_id, agent_name, tool_id, token_count FROM tool_definition_measurements").all();
|
|
314
|
+
rows = db.prepare("SELECT provider_id, model_id, agent_name, tool_id, token_count, recorded_at FROM tool_definition_measurements").all();
|
|
195
315
|
} catch {
|
|
196
316
|
return;
|
|
197
317
|
}
|
|
318
|
+
const since = readWindowedSince(db);
|
|
319
|
+
const loadedAt = new Map;
|
|
198
320
|
for (const row of rows) {
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
321
|
+
const { route } = routeFor(row.provider_id, row.model_id, row.agent_name);
|
|
322
|
+
if (route.live)
|
|
323
|
+
continue;
|
|
324
|
+
let now = loadedAt.get(route);
|
|
325
|
+
if (now === undefined) {
|
|
326
|
+
now = advanceClock(route);
|
|
327
|
+
loadedAt.set(route, now);
|
|
204
328
|
}
|
|
205
|
-
|
|
329
|
+
const legacy = since === undefined || !(Number(row.recorded_at) >= since);
|
|
330
|
+
route.tools.set(row.tool_id, {
|
|
331
|
+
tokens: row.token_count,
|
|
332
|
+
fingerprint: undefined,
|
|
333
|
+
lastFireAt: now,
|
|
334
|
+
legacy,
|
|
335
|
+
persisted: !legacy
|
|
336
|
+
});
|
|
337
|
+
route.oldestFireAt = Math.min(route.oldestFireAt, now);
|
|
338
|
+
if (legacy)
|
|
339
|
+
route.legacyRows.add(row.tool_id);
|
|
340
|
+
else
|
|
341
|
+
route.legacyRows.delete(row.tool_id);
|
|
206
342
|
}
|
|
207
343
|
}
|
|
208
344
|
|
|
209
|
-
export { resolveOpenCodeDbPath, hasV1MessageTables, assertOpenCodeStoreGeneration, openCodeDbPathExists, getOpenCodeDbProbeDescriptions, recordOpenCodeDbReadFailure, clearOpenCodeDbReadFailure, claimOpenCodeDbDiagnosticOnce, setDatabase, loadToolDefinitionMeasurements };
|
|
345
|
+
export { BoundedSessionMap, resolveOpenCodeDbPath, hasV1MessageTables, assertOpenCodeStoreGeneration, openCodeDbPathExists, getOpenCodeDbProbeDescriptions, recordOpenCodeDbReadFailure, clearOpenCodeDbReadFailure, claimOpenCodeDbDiagnosticOnce, setDatabase, loadToolDefinitionMeasurements };
|
|
@@ -9,9 +9,10 @@ import {
|
|
|
9
9
|
readProcessStartTime
|
|
10
10
|
} from "./index-n4wyxcgr.js";
|
|
11
11
|
import {
|
|
12
|
+
BoundedSessionMap,
|
|
12
13
|
resolveOpenCodeDbPath,
|
|
13
14
|
assertOpenCodeStoreGeneration
|
|
14
|
-
} from "./index-
|
|
15
|
+
} from "./index-23t8ryqw.js";
|
|
15
16
|
import {
|
|
16
17
|
Database2,
|
|
17
18
|
getSqliteDatabasePath2,
|
|
@@ -31,10 +32,10 @@ import {
|
|
|
31
32
|
messageFtsOrdinalRangeIsMapped2,
|
|
32
33
|
getMessageFtsRowidMapBackfillProgress2,
|
|
33
34
|
deleteUnmappedMessageFtsRows2
|
|
34
|
-
} from "./index-
|
|
35
|
+
} from "./index-g0d51qzc.js";
|
|
35
36
|
import {
|
|
36
37
|
deleteChunkEmbedBackoffForSession2
|
|
37
|
-
} from "./index-
|
|
38
|
+
} from "./index-dnadppqx.js";
|
|
38
39
|
import {
|
|
39
40
|
closeQuietly,
|
|
40
41
|
TAG_TOMBSTONE_OWNER_PREFIX,
|
|
@@ -46,7 +47,7 @@ import {
|
|
|
46
47
|
} from "./index-w1avzkdt.js";
|
|
47
48
|
import {
|
|
48
49
|
cleanUserText2
|
|
49
|
-
} from "./index-
|
|
50
|
+
} from "./index-rjnc6kkf.js";
|
|
50
51
|
import {
|
|
51
52
|
sameProjectDirectory
|
|
52
53
|
} from "./index-wrr9rp9a.js";
|
|
@@ -73,51 +74,6 @@ import {
|
|
|
73
74
|
} from "node:fs";
|
|
74
75
|
import { basename, dirname, join as join2 } from "node:path";
|
|
75
76
|
|
|
76
|
-
// ../plugin/src/shared/bounded-session-map.ts
|
|
77
|
-
class BoundedSessionMap {
|
|
78
|
-
maxEntries;
|
|
79
|
-
store = new Map;
|
|
80
|
-
constructor(maxEntries) {
|
|
81
|
-
if (!Number.isFinite(maxEntries) || maxEntries < 1) {
|
|
82
|
-
throw new Error(`BoundedSessionMap: maxEntries must be >= 1, got ${maxEntries}`);
|
|
83
|
-
}
|
|
84
|
-
this.maxEntries = maxEntries;
|
|
85
|
-
}
|
|
86
|
-
get(sessionId) {
|
|
87
|
-
const value = this.store.get(sessionId);
|
|
88
|
-
if (value === undefined)
|
|
89
|
-
return;
|
|
90
|
-
this.store.delete(sessionId);
|
|
91
|
-
this.store.set(sessionId, value);
|
|
92
|
-
return value;
|
|
93
|
-
}
|
|
94
|
-
peek(sessionId) {
|
|
95
|
-
return this.store.get(sessionId);
|
|
96
|
-
}
|
|
97
|
-
has(sessionId) {
|
|
98
|
-
return this.store.has(sessionId);
|
|
99
|
-
}
|
|
100
|
-
set(sessionId, value) {
|
|
101
|
-
if (this.store.has(sessionId)) {
|
|
102
|
-
this.store.delete(sessionId);
|
|
103
|
-
} else if (this.store.size >= this.maxEntries) {
|
|
104
|
-
const oldest = this.store.keys().next().value;
|
|
105
|
-
if (oldest !== undefined)
|
|
106
|
-
this.store.delete(oldest);
|
|
107
|
-
}
|
|
108
|
-
this.store.set(sessionId, value);
|
|
109
|
-
}
|
|
110
|
-
delete(sessionId) {
|
|
111
|
-
return this.store.delete(sessionId);
|
|
112
|
-
}
|
|
113
|
-
clear() {
|
|
114
|
-
this.store.clear();
|
|
115
|
-
}
|
|
116
|
-
get size() {
|
|
117
|
-
return this.store.size;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
77
|
// ../plugin/src/shared/storage-file-mutex.ts
|
|
122
78
|
import { execFileSync } from "node:child_process";
|
|
123
79
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -2141,4 +2097,4 @@ async function sweepOrphanedOpenCodeMessageIndexesCooperatively2(db, openSource,
|
|
|
2141
2097
|
}));
|
|
2142
2098
|
}
|
|
2143
2099
|
|
|
2144
|
-
export {
|
|
2100
|
+
export { LkgRecoveryFenceError, clearLkgFenceProcessState, takeLkgRecoveryLockSweepPage, lkgFenceRequiresRebuild, lkgRecoveryFenceUnclean, ownsLkgDirtyFence, invalidateCleanLkgRecoveryFence, markLkgRecoveryDirty, commitLkgWithRecoveryFence, clearLkgRecoveryFence, gaDatabasePath, V2StoreReader, readSessionActivity, observeSessionActivity, backfillSessionActivity, deleteSessionScopedRows, clearCompressionDepth, clearCompressionDepthRange, cleanSearchText, keywordRelevance, matchedSearchSnippet, MESSAGE_INDEX_MAX_FTS_BYTES2, messageIndexSkipKey2, toMessageIndexSource2, getMessageIndexSourceIdentity2, isMessageIndexSourceCurrent2, getLastIndexedOrdinal2, getIndexedMessageCorpusSize2, markMessageIndexDirty2, getMessageIndexReconciliationStartOrdinal2, isMessageIndexReconciledThrough2, deleteIndexedMessage2, clearIndexedMessagesInTransaction2, clearIndexedMessages2, getIndexableContent2, indexSingleMessage2, indexMessagesAfterOrdinal2, indexSourcesAfterOrdinal2, sweepOrphanedOpenCodeMessageIndexesCooperatively2 };
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./index-gwxaz0z5.js";
|
|
14
14
|
import {
|
|
15
15
|
messageFtsOrdinalRangeIsMapped2
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-g0d51qzc.js";
|
|
17
17
|
|
|
18
18
|
// ../plugin/src/features/magic-context/compartment-chunk-embedding.ts
|
|
19
19
|
import { createHash } from "node:crypto";
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
} from "./index-fapenpch.js";
|
|
43
43
|
import {
|
|
44
44
|
startMessageFtsRowidMapBackfill2
|
|
45
|
-
} from "./index-
|
|
45
|
+
} from "./index-g0d51qzc.js";
|
|
46
46
|
import {
|
|
47
47
|
LKG_SLOT_CHUNKS_DDL,
|
|
48
48
|
SESSION_REPLAY_DECISIONS_DDL,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
hasPendingMigrations,
|
|
53
53
|
getMainThreadMigrationBodyCount,
|
|
54
54
|
runMigrations
|
|
55
|
-
} from "./index-
|
|
55
|
+
} from "./index-0dr64gsy.js";
|
|
56
56
|
import {
|
|
57
57
|
closeQuietly,
|
|
58
58
|
ensureColumn,
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
hasV1MessageTables,
|
|
65
65
|
setDatabase,
|
|
66
66
|
loadToolDefinitionMeasurements
|
|
67
|
-
} from "./index-
|
|
67
|
+
} from "./index-23t8ryqw.js";
|
|
68
68
|
import {
|
|
69
69
|
logSlowWriteTransaction
|
|
70
70
|
} from "./index-hqw0rt9k.js";
|
|
@@ -1307,7 +1307,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1307
1307
|
state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
|
|
1308
1308
|
if (signal.aborted || !readsOpenCodeStore)
|
|
1309
1309
|
return;
|
|
1310
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1310
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-p0cexvvs.js"));
|
|
1311
1311
|
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-e3r8ddh1.js"));
|
|
1312
1312
|
if (signal.aborted)
|
|
1313
1313
|
return;
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
recordOpenCodeDbReadFailure,
|
|
56
56
|
clearOpenCodeDbReadFailure,
|
|
57
57
|
claimOpenCodeDbDiagnosticOnce
|
|
58
|
-
} from "./index-
|
|
58
|
+
} from "./index-23t8ryqw.js";
|
|
59
59
|
import {
|
|
60
60
|
prewarmRawSessionOrdinalsForDb,
|
|
61
61
|
readRawSessionMessagesFromDb2,
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
hasRawSessionMessageByIdFromDb2,
|
|
73
73
|
readRawSeedTailFromDb2,
|
|
74
74
|
readRawSessionBoundaryEndpointsFromDb2
|
|
75
|
-
} from "./index-
|
|
75
|
+
} from "./index-z24d75tz.js";
|
|
76
76
|
import {
|
|
77
77
|
logSlowWriteTransaction
|
|
78
78
|
} from "./index-hqw0rt9k.js";
|
|
@@ -4700,6 +4700,20 @@ function readRawSessionMessageOrdinalById2(sessionId, messageId) {
|
|
|
4700
4700
|
return null;
|
|
4701
4701
|
return withReadOnlySessionDb((db) => readRawSessionMessageOrdinalByIdFromDb2(db, sessionId, messageId));
|
|
4702
4702
|
}
|
|
4703
|
+
function resolveHistorianChunkStart2(sessionId, newest) {
|
|
4704
|
+
if (!newest)
|
|
4705
|
+
return 1;
|
|
4706
|
+
const fallback = newest.endMessage + 1;
|
|
4707
|
+
if (hasRawMessageProvider2(sessionId))
|
|
4708
|
+
return fallback;
|
|
4709
|
+
const endId = newest.endMessageId;
|
|
4710
|
+
if (typeof endId !== "string" || endId.length === 0)
|
|
4711
|
+
return fallback;
|
|
4712
|
+
const ordinal = readRawSessionMessageOrdinalById2(sessionId, endId);
|
|
4713
|
+
if (typeof ordinal !== "number" || !Number.isFinite(ordinal) || ordinal < 1)
|
|
4714
|
+
return fallback;
|
|
4715
|
+
return ordinal + 1;
|
|
4716
|
+
}
|
|
4703
4717
|
function readRawSessionMessageOrderPosition(sessionId, messageId) {
|
|
4704
4718
|
const provider = sessionProviders.get(sessionId)?.provider;
|
|
4705
4719
|
if (provider) {
|
|
@@ -5200,4 +5214,4 @@ function readRawSessionSeedTail2(sessionId, boundaryId, onQuery) {
|
|
|
5200
5214
|
});
|
|
5201
5215
|
}
|
|
5202
5216
|
|
|
5203
|
-
export { detectThinkingBindingMismatch, detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, MAX_EXECUTE_THRESHOLD, escalationBands, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, computeProtectionWindow, readEpochFloorSnapshot, getProtectionWindowForSession, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, isRustMarkerAdmissionFenced, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, EMERGENCY_DRAIN_FAILURE_BACKOFF_MS, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, recordOverflowDetected, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, COMPACTION_OFF_THINKING_FROZEN_PREFIX, getThinkingBindingRecoveryTarget, armThinkingBindingRecovery, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, loadPostprocessReplaySnapshot, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, setPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, getSessionsWithPendingPiMarker, setSessionWorkMetrics, getSessionWorkMetrics, resolveEpochFloorForPass, withReadOnlySessionDb, expandToolPart, askAnswerLines, retreatPastHostUnservedRows, isCoveredInstructionRow, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, stripSystemInjection, isFilePart, hasUserAnswerMetadata, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, TOKEN_BUDGET_TOOL_REFUSAL, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, droppedInputMarker, createDroppedInputGuard, isEditTool, applyEditMarkerToInput, modelAcceptsEmptyContent, isAnthropicFamilyRoute, variantChangeBustsProviderCache, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, findLatestAssistantReasoningMutationExemptMessage, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningStepCost, reasoningBudgetCutoff, reasoningTextAndOpaque, opaqueThinkingCost, estimatePartImageTokens, SKELETON_REAL_INPUT_MAX_BYTES, toolInputStringBytes, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, visitRawSessionMessagesAsync2, readRawSessionMessageRange2, prepareRawSessionOrdinals2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, readRawSessionBoundaryEndpoints2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
|
|
5217
|
+
export { detectThinkingBindingMismatch, detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, MAX_EXECUTE_THRESHOLD, escalationBands, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, computeProtectionWindow, readEpochFloorSnapshot, getProtectionWindowForSession, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, isRustMarkerAdmissionFenced, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, EMERGENCY_DRAIN_FAILURE_BACKOFF_MS, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, recordOverflowDetected, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, COMPACTION_OFF_THINKING_FROZEN_PREFIX, getThinkingBindingRecoveryTarget, armThinkingBindingRecovery, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, loadPostprocessReplaySnapshot, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, setPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, getSessionsWithPendingPiMarker, setSessionWorkMetrics, getSessionWorkMetrics, resolveEpochFloorForPass, withReadOnlySessionDb, expandToolPart, askAnswerLines, retreatPastHostUnservedRows, isCoveredInstructionRow, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, stripSystemInjection, isFilePart, hasUserAnswerMetadata, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, TOKEN_BUDGET_TOOL_REFUSAL, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, droppedInputMarker, createDroppedInputGuard, isEditTool, applyEditMarkerToInput, modelAcceptsEmptyContent, isAnthropicFamilyRoute, variantChangeBustsProviderCache, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, findLatestAssistantReasoningMutationExemptMessage, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningStepCost, reasoningBudgetCutoff, reasoningTextAndOpaque, opaqueThinkingCost, estimatePartImageTokens, SKELETON_REAL_INPUT_MAX_BYTES, toolInputStringBytes, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, visitRawSessionMessagesAsync2, readRawSessionMessageRange2, prepareRawSessionOrdinals2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, readRawSessionBoundaryEndpoints2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, resolveHistorianChunkStart2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
|
|
@@ -720,6 +720,20 @@ function survivingAnchor(db, set) {
|
|
|
720
720
|
}
|
|
721
721
|
var ordinalCheckpoints = new WeakMap;
|
|
722
722
|
var ordinalSummarySeeds = new WeakMap;
|
|
723
|
+
function hasLateCommitBehindCheckpoint(db, sessionId, scan) {
|
|
724
|
+
const tail = scan.checkpoints?.at(-1);
|
|
725
|
+
if (!tail || scan.maxRowid === undefined)
|
|
726
|
+
return false;
|
|
727
|
+
const row = db.prepare(`SELECT COUNT(*) AS count FROM message
|
|
728
|
+
WHERE rowid > ? AND +session_id = ?
|
|
729
|
+
AND (time_created, id) <= (?, ?)
|
|
730
|
+
AND NOT (${EXCLUDED_ROW_SQL})`).get(scan.maxRowid, sessionId, tail.timeCreated, tail.id);
|
|
731
|
+
return typeof row?.count === "number" && row.count > 0;
|
|
732
|
+
}
|
|
733
|
+
function discardRetainedOrdinalRanks(db, sessionId) {
|
|
734
|
+
ordinalCheckpoints.get(db)?.delete(sessionId);
|
|
735
|
+
ordinalSummarySeeds.get(db)?.delete(sessionId);
|
|
736
|
+
}
|
|
723
737
|
var ORDINAL_LOOKUP_LIMIT = 512;
|
|
724
738
|
function currentOrdinalCheckpoints(db, sessionId) {
|
|
725
739
|
const cached = ordinalCheckpoints.get(db)?.get(sessionId);
|
|
@@ -750,10 +764,16 @@ function extendOrdinalCheckpoints(db, sessionId, scan, limit) {
|
|
|
750
764
|
scan.sessionRows = points.at(-1)?.storedCount ?? 0;
|
|
751
765
|
}
|
|
752
766
|
const tail = points.at(-1);
|
|
753
|
-
const rows = db.prepare(`SELECT id, time_created AS timeCreated, ${EXCLUDED_ROW_SQL} AS excluded FROM message
|
|
767
|
+
const rows = db.prepare(`SELECT id, time_created AS timeCreated, rowid AS rowid, ${EXCLUDED_ROW_SQL} AS excluded FROM message
|
|
754
768
|
WHERE session_id=?${tail ? " AND (time_created,id) > (?,?)" : ""}
|
|
755
769
|
ORDER BY time_created,id${limit === undefined ? "" : ` LIMIT ${limit + 1}`}`).all(sessionId, ...tail ? [tail.timeCreated, tail.id] : []);
|
|
756
770
|
ordinalJsonRowsRead += rows.length;
|
|
771
|
+
if (hasLateCommitBehindCheckpoint(db, sessionId, scan)) {
|
|
772
|
+
discardRetainedOrdinalRanks(db, sessionId);
|
|
773
|
+
if (isMainThread)
|
|
774
|
+
forgetRawSessionSummaryRows2(sessionId);
|
|
775
|
+
return false;
|
|
776
|
+
}
|
|
757
777
|
if (limit !== undefined && rows.length > limit)
|
|
758
778
|
return false;
|
|
759
779
|
let total = scan.total ?? 0;
|
|
@@ -770,6 +790,13 @@ function extendOrdinalCheckpoints(db, sessionId, scan, limit) {
|
|
|
770
790
|
scan.checkpoints = points;
|
|
771
791
|
scan.sessionRows += rows.length;
|
|
772
792
|
scan.total = total;
|
|
793
|
+
if (rows.length > 0) {
|
|
794
|
+
let maxRowid = scan.maxRowid ?? -1;
|
|
795
|
+
for (const row of rows)
|
|
796
|
+
if (row.rowid > maxRowid)
|
|
797
|
+
maxRowid = row.rowid;
|
|
798
|
+
scan.maxRowid = maxRowid;
|
|
799
|
+
}
|
|
773
800
|
return true;
|
|
774
801
|
}
|
|
775
802
|
|
|
@@ -790,6 +817,10 @@ function rawOrdinalSummarySeed2(db, sessionId) {
|
|
|
790
817
|
ids: [...new Set([...seed.scan.ids, ...writtenSummaryIds.get(sessionId) ?? []])]
|
|
791
818
|
};
|
|
792
819
|
}
|
|
820
|
+
function dropRawSessionOrdinalCheckpoints2(db, sessionId) {
|
|
821
|
+
discardRetainedOrdinalRanks(db, sessionId);
|
|
822
|
+
forgetRawSessionSummaryRows2(sessionId);
|
|
823
|
+
}
|
|
793
824
|
function boundedOrdinalPrefix(db, sessionId, through) {
|
|
794
825
|
const cached = currentOrdinalCheckpoints(db, sessionId);
|
|
795
826
|
if (cached && through === null)
|
|
@@ -828,8 +859,7 @@ function boundedOrdinalPrefix(db, sessionId, through) {
|
|
|
828
859
|
}
|
|
829
860
|
function scanRawSessionSummaryRows2(db, sessionId, previous) {
|
|
830
861
|
return withReadSnapshot(db, () => {
|
|
831
|
-
if (previous?.checkpoints) {
|
|
832
|
-
extendOrdinalCheckpoints(db, sessionId, previous);
|
|
862
|
+
if (previous?.checkpoints && extendOrdinalCheckpoints(db, sessionId, previous)) {
|
|
833
863
|
return previous;
|
|
834
864
|
}
|
|
835
865
|
if (previous) {
|
|
@@ -861,12 +891,15 @@ function scanRawSessionSummaryRows2(db, sessionId, previous) {
|
|
|
861
891
|
}
|
|
862
892
|
anchors.sort((left, right) => right.rowid - left.rowid);
|
|
863
893
|
anchors.length = Math.min(anchors.length, SUMMARY_ANCHOR_LIMIT);
|
|
864
|
-
const keys = db.prepare(`SELECT id, time_created AS timeCreated, ${EXCLUDED_ROW_SQL} AS excluded FROM message WHERE session_id = ?
|
|
894
|
+
const keys = db.prepare(`SELECT id, time_created AS timeCreated, rowid AS rowid, ${EXCLUDED_ROW_SQL} AS excluded FROM message WHERE session_id = ?
|
|
865
895
|
ORDER BY time_created, id`).all(sessionId);
|
|
866
896
|
const checkpoints = [];
|
|
867
897
|
let total = 0;
|
|
898
|
+
let maxRowid;
|
|
868
899
|
for (let index = 0;index < keys.length; index++) {
|
|
869
900
|
const key = keys[index];
|
|
901
|
+
if (typeof key.rowid === "number")
|
|
902
|
+
maxRowid = maxRowid === undefined ? key.rowid : Math.max(maxRowid, key.rowid);
|
|
870
903
|
if (key.excluded !== 1)
|
|
871
904
|
total++;
|
|
872
905
|
if (index % 256 === 255 || index === keys.length - 1)
|
|
@@ -877,7 +910,7 @@ function scanRawSessionSummaryRows2(db, sessionId, previous) {
|
|
|
877
910
|
storedCount: index + 1
|
|
878
911
|
});
|
|
879
912
|
}
|
|
880
|
-
return { anchors, ids, sessionRows, checkpoints, total };
|
|
913
|
+
return { anchors, ids, sessionRows, checkpoints, total, maxRowid };
|
|
881
914
|
});
|
|
882
915
|
}
|
|
883
916
|
function getRawSessionSummaryEpoch2(sessionId) {
|
|
@@ -1285,4 +1318,4 @@ function readRawSessionBoundaryEndpointsFromDb2(db, sessionId, ids, blockIds = [
|
|
|
1285
1318
|
}
|
|
1286
1319
|
}
|
|
1287
1320
|
|
|
1288
|
-
export { runSessionWarmupWorker, prewarmRawSessionOrdinalsForDb, areRustHistorianSyntheticParts2, isStrictGapHealingMessage2, readRawSessionMessagesFromDb2, readRawSessionMessagePageFromDb2, RAW_SUMMARY_TEXT_MAX_CHARS2, readRawSessionMessageSummaryPageFromDb2, countRawSessionMessageOrdinalsFromDb2, readRawSessionMessageIdOrdinalsForRangeFromDb2, readRawSessionMessageIdsAtOrdinalsFromDb2, readRawSessionMessageOrdinalPageFromDb2, countStoredRawSessionMessagesFromDb2, readRawSessionTailFromDb2, buildInMemoryTailRawMessages2, readRawSessionMessagePartsByIdFromDb2, forgetRawSessionOrdinalWatermark2, forgetRawSessionSummaryRows2, noteRawSessionSummaryRowWritten2, RawOrdinalsNotReady2, rawOrdinalSummarySeed2, scanRawSessionSummaryRows2, getRawSessionSummaryEpoch2, installRawSessionSummaryScan2, isRawSessionSummaryWarm2, readRawSessionMessageOrdinalByIdFromDb2, readRawSessionMessageByIdFromDb2, hasRawSessionMessageByIdFromDb2, readRawSeedTailFromDb2, readRawSessionBoundaryEndpointsFromDb2 };
|
|
1321
|
+
export { runSessionWarmupWorker, prewarmRawSessionOrdinalsForDb, areRustHistorianSyntheticParts2, isStrictGapHealingMessage2, readRawSessionMessagesFromDb2, readRawSessionMessagePageFromDb2, RAW_SUMMARY_TEXT_MAX_CHARS2, readRawSessionMessageSummaryPageFromDb2, countRawSessionMessageOrdinalsFromDb2, readRawSessionMessageIdOrdinalsForRangeFromDb2, readRawSessionMessageIdsAtOrdinalsFromDb2, readRawSessionMessageOrdinalPageFromDb2, countStoredRawSessionMessagesFromDb2, readRawSessionTailFromDb2, buildInMemoryTailRawMessages2, readRawSessionMessagePartsByIdFromDb2, forgetRawSessionOrdinalWatermark2, forgetRawSessionSummaryRows2, noteRawSessionSummaryRowWritten2, RawOrdinalsNotReady2, rawOrdinalSummarySeed2, dropRawSessionOrdinalCheckpoints2, scanRawSessionSummaryRows2, getRawSessionSummaryEpoch2, installRawSessionSummaryScan2, isRawSessionSummaryWarm2, readRawSessionMessageOrdinalByIdFromDb2, readRawSessionMessageByIdFromDb2, hasRawSessionMessageByIdFromDb2, readRawSeedTailFromDb2, readRawSessionBoundaryEndpointsFromDb2 };
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
countSessionCompartmentEmbedCoverage2,
|
|
42
42
|
countSessionCompartmentEmbedCoveragePolite2,
|
|
43
43
|
countUnembeddedSessionCompartmentsPolite2
|
|
44
|
-
} from "./index-
|
|
44
|
+
} from "./index-dnadppqx.js";
|
|
45
45
|
import {
|
|
46
46
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
47
47
|
} from "./index-ccanzg8p.js";
|