@cortexkit/pi-magic-context 0.49.18 → 0.49.20

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 (59) hide show
  1. package/dist/auto-search-worker.js +53 -10
  2. package/dist/chunk-embedding-write-worker.js +29 -22
  3. package/dist/{compaction-marker-candidates-wjzqbspm.js → compaction-marker-candidates-fnm47jat.js} +3 -3
  4. package/dist/compaction-marker-candidates-worker.js +2 -2
  5. package/dist/compartment-chunk-embedding-81qesfjs.js +64 -0
  6. package/dist/embedding-backfill-56e871c6.js +24 -0
  7. package/dist/embedding-worker-process.js +2 -2
  8. package/dist/embedding-worker.js +5 -5
  9. package/dist/historian-calibration-extension.js +1 -1
  10. package/dist/index-54wmg4rj.js +82 -0
  11. package/dist/{index-xnch62s6.js → index-5n5zxs8e.js} +314 -127
  12. package/dist/{index-gdjv1nnd.js → index-5vgt1zeh.js} +6 -7
  13. package/dist/{index-qpq6w67c.js → index-6kb2xpw7.js} +2 -2
  14. package/dist/{index-d43hmn31.js → index-af9t637y.js} +68 -16
  15. package/dist/{index-z2rkv0mb.js → index-b8am7tns.js} +4 -4
  16. package/dist/{index-rhprywn6.js → index-bttctq07.js} +23 -5
  17. package/dist/{index-e1rza8gp.js → index-dzem6gn9.js} +1 -1
  18. package/dist/{index-2mmy81qt.js → index-e19qtjj0.js} +468 -18
  19. package/dist/{index-7bqrfyny.js → index-fgs78jyd.js} +12 -15
  20. package/dist/{index-d4dt19md.js → index-hqw0rt9k.js} +1 -1
  21. package/dist/{index-rrwv9y2k.js → index-hws5f0z9.js} +1 -1
  22. package/dist/{index-f18ec69t.js → index-jn44h81p.js} +1 -1
  23. package/dist/{index-xxn1tpnv.js → index-jt0g3hn0.js} +45 -28
  24. package/dist/{index-d8gc0112.js → index-jxjr7kz9.js} +3 -3
  25. package/dist/{index-4bv5bttd.js → index-kqb3d8bs.js} +9 -5
  26. package/dist/{index-gp928w10.js → index-mtvvhcw4.js} +10 -10
  27. package/dist/{index-1kcfwk9c.js → index-my0dn413.js} +1 -1
  28. package/dist/{index-apgwdby5.js → index-n4wyxcgr.js} +1 -1
  29. package/dist/{index-g7p75667.js → index-p63nwn5v.js} +2 -2
  30. package/dist/{index-svgkv4g2.js → index-qerzchrs.js} +2 -2
  31. package/dist/{index-vktahpdj.js → index-rfyvax95.js} +9 -3
  32. package/dist/{index-yygsh681.js → index-rgfb753z.js} +3 -3
  33. package/dist/{index-d21pdr8v.js → index-tb3d9trm.js} +2 -2
  34. package/dist/{index-vmcgew7x.js → index-v2epyzbm.js} +75 -57
  35. package/dist/{index-fvjthct0.js → index-vdy273xw.js} +107 -20
  36. package/dist/{index-jrap43gc.js → index-w1avzkdt.js} +1 -1
  37. package/dist/{index-r9f4f6s1.js → index-zhwwp8zz.js} +64 -8
  38. package/dist/index.js +1119 -247
  39. package/dist/{logger-dygt96rn.js → logger-shetp43v.js} +1 -1
  40. package/dist/{message-fts-rowid-map-cvpy2dmb.js → message-fts-rowid-map-bpexnsdj.js} +6 -5
  41. package/dist/{message-index-bounded-g9hgresf.js → message-index-bounded-d4r3weh0.js} +14 -13
  42. package/dist/{message-index-74qdqmq7.js → message-index-mvag9crh.js} +14 -13
  43. package/dist/{message-time-backfill-ssshbdy8.js → message-time-backfill-kc10yrcj.js} +3 -3
  44. package/dist/migration-worker.js +12 -11
  45. package/dist/{project-embedding-registry-vf1ncptn.js → project-embedding-registry-cfrg952x.js} +13 -12
  46. package/dist/raw-ordinal-warmup-worker.js +136 -101
  47. package/dist/{read-session-chunk-chepqmw5.js → read-session-chunk-7g4zvpd8.js} +9 -8
  48. package/dist/{read-session-raw-9s3xn7fc.js → read-session-raw-0fsjh10f.js} +4 -3
  49. package/dist/{safe-notification-target-2rkvkmw8.js → safe-notification-target-zcpchea6.js} +2 -2
  50. package/dist/search-archive-qbhp7e89.js +21 -0
  51. package/dist/{search-6ztbx25v.js → search-hp4g3g9v.js} +22 -21
  52. package/dist/{sqlite-fsp0sf3r.js → sqlite-d67n6dtr.js} +1 -1
  53. package/dist/{storage-memory-yxxc5v4n.js → storage-memory-9g882j7a.js} +2 -2
  54. package/dist/{storage-tags-1kets0q8.js → storage-tags-m2qcp1g2.js} +7 -5
  55. package/dist/subagent-entry.js +26 -25
  56. package/dist/tag-snapshot-worker-pi.js +66 -55
  57. package/package.json +1 -1
  58. package/dist/embedding-backfill-vwag34t0.js +0 -23
  59. package/dist/search-archive-jg4a1kcx.js +0 -20
@@ -6,7 +6,7 @@ import {
6
6
  getLoggerDiagnostics2,
7
7
  flushLogger2,
8
8
  getLogFilePath2
9
- } from "./index-7bqrfyny.js";
9
+ } from "./index-fgs78jyd.js";
10
10
  import"./index-0h2mkab2.js";
11
11
  export {
12
12
  flushLogger2 as flushLogger,
@@ -6,13 +6,14 @@ import {
6
6
  messageFtsOrdinalRangeIsMapped2,
7
7
  getMessageFtsRowidMapBackfillProgress2,
8
8
  deleteUnmappedMessageFtsRows2
9
- } from "./index-yygsh681.js";
10
- import"./index-vktahpdj.js";
9
+ } from "./index-rgfb753z.js";
10
+ import"./index-rfyvax95.js";
11
11
  import"./index-399p688g.js";
12
- import"./index-d4dt19md.js";
13
- import"./index-rrwv9y2k.js";
14
- import"./index-7bqrfyny.js";
12
+ import"./index-hqw0rt9k.js";
13
+ import"./index-hws5f0z9.js";
14
+ import"./index-fgs78jyd.js";
15
15
  import"./index-0h2mkab2.js";
16
+ import"./index-54wmg4rj.js";
16
17
  export {
17
18
  deleteUnmappedMessageFtsRows2 as deleteUnmappedMessageFtsRows,
18
19
  getMessageFtsRowidMapBackfillProgress2 as getMessageFtsRowidMapBackfillProgress,
@@ -2,10 +2,10 @@ import {
2
2
  withSqliteBackgroundWriter2,
3
3
  withIndexChunk2,
4
4
  yieldIndexChunk2
5
- } from "./index-rrwv9y2k.js";
5
+ } from "./index-hws5f0z9.js";
6
6
  import"./index-0h2mkab2.js";
7
- import"./index-7bqrfyny.js";
8
- import"./index-apgwdby5.js";
7
+ import"./index-fgs78jyd.js";
8
+ import"./index-n4wyxcgr.js";
9
9
  import {
10
10
  MESSAGE_INDEX_MAX_FTS_BYTES2,
11
11
  messageIndexSkipKey2,
@@ -13,20 +13,21 @@ import {
13
13
  markMessageIndexDirty2,
14
14
  getIndexableContent2,
15
15
  indexSingleMessage2
16
- } from "./index-fvjthct0.js";
17
- import"./index-rhprywn6.js";
18
- import"./index-1kcfwk9c.js";
19
- import"./index-jrap43gc.js";
16
+ } from "./index-vdy273xw.js";
17
+ import"./index-bttctq07.js";
18
+ import"./index-my0dn413.js";
19
+ import"./index-w1avzkdt.js";
20
20
  import"./index-bxmf4dhr.js";
21
21
  import"./index-399p688g.js";
22
- import"./index-vktahpdj.js";
22
+ import"./index-54wmg4rj.js";
23
+ import"./index-rfyvax95.js";
23
24
  import"./index-8976mezv.js";
24
- import"./index-r9f4f6s1.js";
25
+ import"./index-zhwwp8zz.js";
25
26
  import"./index-6x556c2q.js";
26
- import"./index-yygsh681.js";
27
- import"./index-d8gc0112.js";
28
- import"./index-xnch62s6.js";
29
- import"./index-d4dt19md.js";
27
+ import"./index-rgfb753z.js";
28
+ import"./index-jxjr7kz9.js";
29
+ import"./index-5n5zxs8e.js";
30
+ import"./index-hqw0rt9k.js";
30
31
 
31
32
  // ../plugin/src/features/magic-context/message-index-bounded.ts
32
33
  import { createHash } from "node:crypto";
@@ -17,24 +17,25 @@ import {
17
17
  indexMessagesAfterOrdinal2,
18
18
  indexSourcesAfterOrdinal2,
19
19
  sweepOrphanedOpenCodeMessageIndexesCooperatively2
20
- } from "./index-fvjthct0.js";
21
- import"./index-xnch62s6.js";
22
- import"./index-r9f4f6s1.js";
23
- import"./index-rhprywn6.js";
20
+ } from "./index-vdy273xw.js";
21
+ import"./index-5n5zxs8e.js";
22
+ import"./index-zhwwp8zz.js";
23
+ import"./index-bttctq07.js";
24
24
  import"./index-6x556c2q.js";
25
- import"./index-d8gc0112.js";
25
+ import"./index-jxjr7kz9.js";
26
26
  import"./index-bxmf4dhr.js";
27
- import"./index-apgwdby5.js";
28
- import"./index-yygsh681.js";
27
+ import"./index-n4wyxcgr.js";
28
+ import"./index-rgfb753z.js";
29
29
  import"./index-8976mezv.js";
30
- import"./index-jrap43gc.js";
31
- import"./index-vktahpdj.js";
30
+ import"./index-w1avzkdt.js";
31
+ import"./index-rfyvax95.js";
32
32
  import"./index-399p688g.js";
33
- import"./index-d4dt19md.js";
34
- import"./index-1kcfwk9c.js";
35
- import"./index-rrwv9y2k.js";
36
- import"./index-7bqrfyny.js";
33
+ import"./index-hqw0rt9k.js";
34
+ import"./index-my0dn413.js";
35
+ import"./index-hws5f0z9.js";
36
+ import"./index-fgs78jyd.js";
37
37
  import"./index-0h2mkab2.js";
38
+ import"./index-54wmg4rj.js";
38
39
  export {
39
40
  MESSAGE_INDEX_MAX_FTS_BYTES2 as MESSAGE_INDEX_MAX_FTS_BYTES,
40
41
  clearIndexedMessages2 as clearIndexedMessages,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  withSqliteBackgroundWriter2,
3
3
  withoutSqliteTransformPass2
4
- } from "./index-rrwv9y2k.js";
4
+ } from "./index-hws5f0z9.js";
5
5
  import"./index-0h2mkab2.js";
6
- import"./index-7bqrfyny.js";
6
+ import"./index-fgs78jyd.js";
7
7
  import {
8
8
  logSlowWriteTransaction
9
- } from "./index-d4dt19md.js";
9
+ } from "./index-hqw0rt9k.js";
10
10
 
11
11
  // ../plugin/src/features/magic-context/message-time-backfill.ts
12
12
  var MESSAGE_TIME_BACKFILL_BATCH_SIZE = 500;
@@ -2,30 +2,31 @@ import"./index-0h2mkab2.js";
2
2
  import {
3
3
  setLogLineForwarder2,
4
4
  log2
5
- } from "./index-7bqrfyny.js";
5
+ } from "./index-fgs78jyd.js";
6
6
  import {
7
7
  Database2
8
- } from "./index-rrwv9y2k.js";
8
+ } from "./index-hws5f0z9.js";
9
9
  import"./index-135e8hvg.js";
10
10
  import {
11
11
  runMigrationsWithRetry
12
- } from "./index-gdjv1nnd.js";
12
+ } from "./index-5vgt1zeh.js";
13
13
  import {
14
14
  closeQuietly
15
- } from "./index-jrap43gc.js";
15
+ } from "./index-w1avzkdt.js";
16
16
  import"./index-8976mezv.js";
17
- import"./index-g7p75667.js";
18
- import"./index-apgwdby5.js";
17
+ import"./index-p63nwn5v.js";
18
+ import"./index-n4wyxcgr.js";
19
19
  import"./index-fapenpch.js";
20
20
  import {
21
21
  setSqlitePragmaConfig,
22
22
  initializeDatabase
23
- } from "./index-gp928w10.js";
23
+ } from "./index-mtvvhcw4.js";
24
24
  import"./index-399p688g.js";
25
- import"./index-vktahpdj.js";
26
- import"./index-yygsh681.js";
27
- import"./index-1kcfwk9c.js";
28
- import"./index-d4dt19md.js";
25
+ import"./index-54wmg4rj.js";
26
+ import"./index-rfyvax95.js";
27
+ import"./index-rgfb753z.js";
28
+ import"./index-my0dn413.js";
29
+ import"./index-hqw0rt9k.js";
29
30
 
30
31
  // ../plugin/src/features/magic-context/migration-worker.ts
31
32
  import { parentPort, workerData } from "node:worker_threads";
@@ -33,23 +33,24 @@ import {
33
33
  sweepAllRegisteredProjects2,
34
34
  _setTestProviderFactoryForProject2,
35
35
  _resetProjectEmbeddingRegistryForTests2
36
- } from "./index-vmcgew7x.js";
36
+ } from "./index-v2epyzbm.js";
37
37
  import"./index-9p40dgkm.js";
38
38
  import"./index-yhzhdp3m.js";
39
- import"./index-svgkv4g2.js";
40
- import"./index-xnch62s6.js";
41
- import"./index-2mmy81qt.js";
42
- import"./index-d8gc0112.js";
39
+ import"./index-qerzchrs.js";
40
+ import"./index-5n5zxs8e.js";
41
+ import"./index-e19qtjj0.js";
42
+ import"./index-jxjr7kz9.js";
43
43
  import"./index-bxmf4dhr.js";
44
- import"./index-g7p75667.js";
45
- import"./index-yygsh681.js";
46
- import"./index-vktahpdj.js";
44
+ import"./index-p63nwn5v.js";
45
+ import"./index-rgfb753z.js";
46
+ import"./index-rfyvax95.js";
47
47
  import"./index-399p688g.js";
48
- import"./index-d4dt19md.js";
49
- import"./index-1kcfwk9c.js";
50
- import"./index-rrwv9y2k.js";
51
- import"./index-7bqrfyny.js";
48
+ import"./index-hqw0rt9k.js";
49
+ import"./index-my0dn413.js";
50
+ import"./index-hws5f0z9.js";
51
+ import"./index-fgs78jyd.js";
52
52
  import"./index-0h2mkab2.js";
53
+ import"./index-54wmg4rj.js";
53
54
  export {
54
55
  _resetProjectEmbeddingRegistryForTests2 as _resetProjectEmbeddingRegistryForTests,
55
56
  _setTestProviderFactoryForProject2 as _setTestProviderFactoryForProject,
@@ -1,114 +1,149 @@
1
+ import {
2
+ exitOnWorkerClose
3
+ } from "./index-54wmg4rj.js";
4
+
1
5
  // ../plugin/src/hooks/magic-context/raw-ordinal-warmup-worker.ts
2
6
  import { parentPort, workerData } from "node:worker_threads";
3
- var port = parentPort;
4
- if (!port)
7
+ if (!parentPort)
5
8
  throw new Error("raw ordinal warm-up worker requires a parent port");
9
+ var port = parentPort;
6
10
  var input = workerData;
7
11
  port.postMessage({ kind: "accepted" });
8
- var [
9
- { Database, registerSqliteDiagnosticSink },
10
- { readRawSessionMessageIdsAtOrdinalsFromDb, scanRawSessionSummaryRows },
11
- { getHarness, setHarness },
12
- { log }
13
- ] = await Promise.all([
14
- import("./sqlite-fsp0sf3r.js"),
15
- import("./read-session-raw-9s3xn7fc.js"),
16
- import("./harness-9872e0ym.js"),
17
- import("./logger-dygt96rn.js")
18
- ]);
19
- setHarness(input.harness ?? "opencode");
20
- registerSqliteDiagnosticSink(log, getHarness);
21
- var db;
22
- var reply;
23
- try {
24
- if (input.openCancellation && Atomics.load(new Int32Array(input.openCancellation), 0) !== 0) {
25
- throw new Error("warm-up owner closed before database open");
26
- }
27
- db = input.indexMessage || input.orphanSweep || input.ftsRowidBackfill ? new Database(input.path) : new Database(input.path, { readonly: true });
28
- db.exec("PRAGMA busy_timeout = 250");
29
- if (input.ftsRowidBackfill) {
30
- const { runMessageFtsRowidMapBackfill } = await import("./message-fts-rowid-map-cvpy2dmb.js");
31
- db.exec("PRAGMA busy_timeout = 0");
32
- await runMessageFtsRowidMapBackfill(db);
33
- reply = { kind: "fts-rowid-backfill" };
34
- } else if (input.searchArchive) {
35
- const { renderSearchArchive } = await import("./search-archive-jg4a1kcx.js");
36
- const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-9s3xn7fc.js");
37
- const archive = input.searchArchive;
38
- let raw;
12
+ var openConnections = new Set;
13
+ var { closePort } = exitOnWorkerClose(port, () => {
14
+ for (const connection of openConnections) {
39
15
  try {
16
+ connection.close();
17
+ } catch {}
18
+ }
19
+ });
20
+ main().catch((error) => {
21
+ setTimeout(() => {
22
+ throw error;
23
+ });
24
+ });
25
+ async function main() {
26
+ const [
27
+ { Database, registerSqliteDiagnosticSink },
28
+ { readRawSessionMessageIdsAtOrdinalsFromDb, scanRawSessionSummaryRows },
29
+ { getHarness, setHarness },
30
+ { log }
31
+ ] = await Promise.all([
32
+ import("./sqlite-d67n6dtr.js"),
33
+ import("./read-session-raw-0fsjh10f.js"),
34
+ import("./harness-9872e0ym.js"),
35
+ import("./logger-shetp43v.js")
36
+ ]);
37
+ setHarness(input.harness ?? "opencode");
38
+ registerSqliteDiagnosticSink(log, getHarness);
39
+ let db;
40
+ let reply;
41
+ try {
42
+ if (input.openCancellation && Atomics.load(new Int32Array(input.openCancellation), 0) !== 0) {
43
+ throw new Error("warm-up owner closed before database open");
44
+ }
45
+ db = input.indexMessage || input.orphanSweep || input.ftsRowidBackfill ? new Database(input.path) : new Database(input.path, { readonly: true });
46
+ openConnections.add(db);
47
+ db.exec("PRAGMA busy_timeout = 250");
48
+ if (input.ftsRowidBackfill) {
49
+ const { runMessageFtsRowidMapBackfill } = await import("./message-fts-rowid-map-bpexnsdj.js");
50
+ db.exec("PRAGMA busy_timeout = 0");
51
+ await runMessageFtsRowidMapBackfill(db);
52
+ reply = { kind: "fts-rowid-backfill" };
53
+ } else if (input.searchArchive) {
54
+ const { renderSearchArchive } = await import("./search-archive-qbhp7e89.js");
55
+ const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-0fsjh10f.js");
56
+ const archive = input.searchArchive;
57
+ let raw;
58
+ try {
59
+ reply = {
60
+ kind: "search-archive",
61
+ text: renderSearchArchive(db, input.sessionId, archive.start, archive.end, archive.tokenBudget, archive.archiveOnly, () => {
62
+ if (!archive.rawPath)
63
+ return new Map(archive.rawIds);
64
+ raw = new Database(archive.rawPath, { readonly: true });
65
+ openConnections.add(raw);
66
+ raw.exec("PRAGMA busy_timeout = 250");
67
+ return readRawSessionMessageIdOrdinalsForRangeFromDb(raw, input.sessionId, archive.start, archive.end);
68
+ })
69
+ };
70
+ } finally {
71
+ if (raw)
72
+ openConnections.delete(raw);
73
+ raw?.close();
74
+ }
75
+ } else if (input.exactOrdinalIds) {
76
+ reply = {
77
+ kind: "exact-ordinal-ids",
78
+ ids: readRawSessionMessageIdsAtOrdinalsFromDb(db, input.sessionId, input.exactOrdinalIds)
79
+ };
80
+ } else if (input.orphanSweep) {
81
+ const [
82
+ { setHarness },
83
+ { sweepOrphanedOpenCodeMessageIndexesCooperatively },
84
+ { configureContextDatabasePragmas }
85
+ ] = await Promise.all([
86
+ import("./harness-9872e0ym.js"),
87
+ import("./message-index-mvag9crh.js"),
88
+ import("./sqlite-context-pragmas-gcgch6qz.js")
89
+ ]);
90
+ setHarness(input.harness ?? "opencode");
91
+ configureContextDatabasePragmas(db);
92
+ const sourcePath = input.orphanSweep.sourcePath;
40
93
  reply = {
41
- kind: "search-archive",
42
- text: renderSearchArchive(db, input.sessionId, archive.start, archive.end, archive.tokenBudget, archive.archiveOnly, () => {
43
- if (!archive.rawPath)
44
- return new Map(archive.rawIds);
45
- raw = new Database(archive.rawPath, { readonly: true });
46
- raw.exec("PRAGMA busy_timeout = 250");
47
- return readRawSessionMessageIdOrdinalsForRangeFromDb(raw, input.sessionId, archive.start, archive.end);
48
- })
94
+ kind: "orphan-sweep",
95
+ result: await sweepOrphanedOpenCodeMessageIndexesCooperatively(db, () => {
96
+ if (!sourcePath)
97
+ return null;
98
+ const source = new Database(sourcePath, { readonly: true });
99
+ openConnections.add(source);
100
+ return source;
101
+ }, input.orphanSweep.options)
49
102
  };
50
- } finally {
51
- raw?.close();
103
+ } else if (input.indexMessage) {
104
+ const { setHarness } = await import("./harness-9872e0ym.js");
105
+ setHarness(input.harness ?? "opencode");
106
+ const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
107
+ import("./message-index-bounded-d4r3weh0.js"),
108
+ import("./sqlite-context-pragmas-gcgch6qz.js")
109
+ ]);
110
+ configureContextDatabasePragmas(db);
111
+ const writer = db;
112
+ const message = input.indexMessage;
113
+ const cancellation = input.indexCancellation ? new Int32Array(input.indexCancellation) : undefined;
114
+ const result = await indexMessageInShortChunks(writer, input.sessionId, message, input, () => !cancellation || Atomics.load(cancellation, 0) === 0);
115
+ reply = {
116
+ kind: "indexed",
117
+ inserted: result.inserted,
118
+ measurements: result.measurements
119
+ };
120
+ } else if (input.tagRatio !== undefined) {
121
+ const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-m2qcp1g2.js");
122
+ const delta = input.tagState ? scanTagOwnerDelta(db, input.sessionId, input.tagState) : null;
123
+ if (delta)
124
+ reply = { kind: "tag-delta", delta };
125
+ else
126
+ reply = {
127
+ kind: "tag-summary",
128
+ summary: scanTagOwnerSummary(db, input.sessionId, input.tagRatio, input.tagRatios)
129
+ };
130
+ } else {
131
+ const scan = scanRawSessionSummaryRows(db, input.sessionId, input.previous);
132
+ reply = { kind: "scan", scan };
52
133
  }
53
- } else if (input.exactOrdinalIds) {
54
- reply = {
55
- kind: "exact-ordinal-ids",
56
- ids: readRawSessionMessageIdsAtOrdinalsFromDb(db, input.sessionId, input.exactOrdinalIds)
57
- };
58
- } else if (input.orphanSweep) {
59
- const [
60
- { setHarness },
61
- { sweepOrphanedOpenCodeMessageIndexesCooperatively },
62
- { configureContextDatabasePragmas }
63
- ] = await Promise.all([
64
- import("./harness-9872e0ym.js"),
65
- import("./message-index-74qdqmq7.js"),
66
- import("./sqlite-context-pragmas-gcgch6qz.js")
67
- ]);
68
- setHarness(input.harness ?? "opencode");
69
- configureContextDatabasePragmas(db);
70
- const sourcePath = input.orphanSweep.sourcePath;
134
+ } catch (error) {
135
+ const sqliteError = error;
71
136
  reply = {
72
- kind: "orphan-sweep",
73
- result: await sweepOrphanedOpenCodeMessageIndexesCooperatively(db, () => sourcePath ? new Database(sourcePath, { readonly: true }) : null, input.orphanSweep.options)
137
+ kind: "error",
138
+ error: error instanceof Error ? error.stack ?? error.message : String(error),
139
+ code: typeof sqliteError?.code === "string" ? sqliteError.code : undefined,
140
+ errcode: typeof sqliteError?.errcode === "number" ? sqliteError.errcode : undefined
74
141
  };
75
- } else if (input.indexMessage) {
76
- const { setHarness } = await import("./harness-9872e0ym.js");
77
- setHarness(input.harness ?? "opencode");
78
- const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
79
- import("./message-index-bounded-g9hgresf.js"),
80
- import("./sqlite-context-pragmas-gcgch6qz.js")
81
- ]);
82
- configureContextDatabasePragmas(db);
83
- const writer = db;
84
- const message = input.indexMessage;
85
- const cancellation = input.indexCancellation ? new Int32Array(input.indexCancellation) : undefined;
86
- const result = await indexMessageInShortChunks(writer, input.sessionId, message, input, () => !cancellation || Atomics.load(cancellation, 0) === 0);
87
- reply = { kind: "indexed", inserted: result.inserted, measurements: result.measurements };
88
- } else if (input.tagRatio !== undefined) {
89
- const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-1kets0q8.js");
90
- const delta = input.tagState ? scanTagOwnerDelta(db, input.sessionId, input.tagState) : null;
91
- if (delta)
92
- reply = { kind: "tag-delta", delta };
93
- else
94
- reply = {
95
- kind: "tag-summary",
96
- summary: scanTagOwnerSummary(db, input.sessionId, input.tagRatio, input.tagRatios)
97
- };
98
- } else {
99
- const scan = scanRawSessionSummaryRows(db, input.sessionId, input.previous);
100
- reply = { kind: "scan", scan };
142
+ } finally {
143
+ if (db)
144
+ openConnections.delete(db);
145
+ db?.close();
101
146
  }
102
- } catch (error) {
103
- const sqliteError = error;
104
- reply = {
105
- kind: "error",
106
- error: error instanceof Error ? error.stack ?? error.message : String(error),
107
- code: typeof sqliteError?.code === "string" ? sqliteError.code : undefined,
108
- errcode: typeof sqliteError?.errcode === "number" ? sqliteError.errcode : undefined
109
- };
110
- } finally {
111
- db?.close();
147
+ port.postMessage(reply);
148
+ closePort();
112
149
  }
113
- port.postMessage(reply);
114
- port.close();
@@ -35,22 +35,23 @@ import {
35
35
  readSessionChunk2,
36
36
  getRawSessionMessageIdsThrough2,
37
37
  readRawSessionSeedTail2
38
- } from "./index-r9f4f6s1.js";
39
- import"./index-rhprywn6.js";
38
+ } from "./index-zhwwp8zz.js";
39
+ import"./index-bttctq07.js";
40
40
  import"./index-6x556c2q.js";
41
41
  import"./index-bxmf4dhr.js";
42
42
  import"./index-8976mezv.js";
43
- import"./index-jrap43gc.js";
44
- import"./index-vktahpdj.js";
43
+ import"./index-w1avzkdt.js";
44
+ import"./index-rfyvax95.js";
45
45
  import"./index-399p688g.js";
46
- import"./index-d4dt19md.js";
46
+ import"./index-hqw0rt9k.js";
47
47
  import {
48
48
  hasMeaningfulUserText2,
49
49
  extractTexts2
50
- } from "./index-1kcfwk9c.js";
51
- import"./index-rrwv9y2k.js";
52
- import"./index-7bqrfyny.js";
50
+ } from "./index-my0dn413.js";
51
+ import"./index-hws5f0z9.js";
52
+ import"./index-fgs78jyd.js";
53
53
  import"./index-0h2mkab2.js";
54
+ import"./index-54wmg4rj.js";
54
55
  export {
55
56
  RAW_MESSAGE_VISIT_PAGE_SIZE2 as RAW_MESSAGE_VISIT_PAGE_SIZE,
56
57
  RAW_SESSION_TAG_KEY_PAGE_SIZE2 as RAW_SESSION_TAG_KEY_PAGE_SIZE,
@@ -26,11 +26,12 @@ import {
26
26
  hasRawSessionMessageByIdFromDb2,
27
27
  readRawSeedTailFromDb2,
28
28
  readRawSessionBoundaryEndpointsFromDb2
29
- } from "./index-vktahpdj.js";
29
+ } from "./index-rfyvax95.js";
30
30
  import"./index-399p688g.js";
31
- import"./index-rrwv9y2k.js";
32
- import"./index-7bqrfyny.js";
31
+ import"./index-hws5f0z9.js";
32
+ import"./index-fgs78jyd.js";
33
33
  import"./index-0h2mkab2.js";
34
+ import"./index-54wmg4rj.js";
34
35
  export {
35
36
  RAW_SUMMARY_TEXT_MAX_CHARS2 as RAW_SUMMARY_TEXT_MAX_CHARS,
36
37
  RawOrdinalsNotReady2 as RawOrdinalsNotReady,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  isDefaultSessionTitle2,
3
3
  waitForSafeNotificationTarget2
4
- } from "./index-f18ec69t.js";
5
- import"./index-7bqrfyny.js";
4
+ } from "./index-jn44h81p.js";
5
+ import"./index-fgs78jyd.js";
6
6
  import"./index-0h2mkab2.js";
7
7
  export {
8
8
  isDefaultSessionTitle2 as isDefaultSessionTitle,
@@ -0,0 +1,21 @@
1
+ import {
2
+ renderSearchArchive2
3
+ } from "./index-tb3d9trm.js";
4
+ import"./index-1cvyaw9a.js";
5
+ import"./index-zhwwp8zz.js";
6
+ import"./index-bttctq07.js";
7
+ import"./index-6x556c2q.js";
8
+ import"./index-bxmf4dhr.js";
9
+ import"./index-8976mezv.js";
10
+ import"./index-w1avzkdt.js";
11
+ import"./index-rfyvax95.js";
12
+ import"./index-399p688g.js";
13
+ import"./index-hqw0rt9k.js";
14
+ import"./index-my0dn413.js";
15
+ import"./index-hws5f0z9.js";
16
+ import"./index-fgs78jyd.js";
17
+ import"./index-0h2mkab2.js";
18
+ import"./index-54wmg4rj.js";
19
+ export {
20
+ renderSearchArchive2 as renderSearchArchive
21
+ };
@@ -5,36 +5,37 @@ import {
5
5
  resolveMemoriesByIdsForSearch2,
6
6
  unifiedSearch2,
7
7
  formatSearchResults2
8
- } from "./index-d43hmn31.js";
8
+ } from "./index-af9t637y.js";
9
9
  import"./index-1cvyaw9a.js";
10
- import"./index-fvjthct0.js";
11
- import"./index-z2rkv0mb.js";
12
- import"./index-vmcgew7x.js";
10
+ import"./index-vdy273xw.js";
11
+ import"./index-b8am7tns.js";
12
+ import"./index-v2epyzbm.js";
13
13
  import"./index-9p40dgkm.js";
14
- import"./index-e1rza8gp.js";
14
+ import"./index-dzem6gn9.js";
15
15
  import"./index-yhzhdp3m.js";
16
- import"./index-svgkv4g2.js";
17
- import"./index-xnch62s6.js";
18
- import"./index-r9f4f6s1.js";
19
- import"./index-rhprywn6.js";
16
+ import"./index-qerzchrs.js";
17
+ import"./index-5n5zxs8e.js";
18
+ import"./index-zhwwp8zz.js";
19
+ import"./index-bttctq07.js";
20
20
  import"./index-6x556c2q.js";
21
- import"./index-2mmy81qt.js";
22
- import"./index-d8gc0112.js";
21
+ import"./index-e19qtjj0.js";
22
+ import"./index-jxjr7kz9.js";
23
23
  import"./index-bxmf4dhr.js";
24
- import"./index-gdjv1nnd.js";
25
- import"./index-apgwdby5.js";
26
- import"./index-g7p75667.js";
27
- import"./index-yygsh681.js";
24
+ import"./index-5vgt1zeh.js";
25
+ import"./index-n4wyxcgr.js";
26
+ import"./index-p63nwn5v.js";
27
+ import"./index-rgfb753z.js";
28
28
  import"./index-135e8hvg.js";
29
29
  import"./index-8976mezv.js";
30
- import"./index-jrap43gc.js";
31
- import"./index-vktahpdj.js";
30
+ import"./index-w1avzkdt.js";
31
+ import"./index-rfyvax95.js";
32
32
  import"./index-399p688g.js";
33
- import"./index-d4dt19md.js";
34
- import"./index-1kcfwk9c.js";
35
- import"./index-rrwv9y2k.js";
36
- import"./index-7bqrfyny.js";
33
+ import"./index-hqw0rt9k.js";
34
+ import"./index-my0dn413.js";
35
+ import"./index-hws5f0z9.js";
36
+ import"./index-fgs78jyd.js";
37
37
  import"./index-0h2mkab2.js";
38
+ import"./index-54wmg4rj.js";
38
39
  export {
39
40
  createUnifiedSearchDiagnostics2 as createUnifiedSearchDiagnostics,
40
41
  formatSearchResults2 as formatSearchResults,
@@ -20,7 +20,7 @@ import {
20
20
  releaseIndexOwner2,
21
21
  withIndexChunk2,
22
22
  yieldIndexChunk2
23
- } from "./index-rrwv9y2k.js";
23
+ } from "./index-hws5f0z9.js";
24
24
  export {
25
25
  Database2 as Database,
26
26
  assertTransformWrite2 as assertTransformWrite,
@@ -31,10 +31,10 @@ import {
31
31
  deleteMemory2,
32
32
  getMemoryCount2,
33
33
  getMemoryCountsByStatus2
34
- } from "./index-e1rza8gp.js";
34
+ } from "./index-dzem6gn9.js";
35
35
  import"./index-yhzhdp3m.js";
36
36
  import"./index-135e8hvg.js";
37
- import"./index-rrwv9y2k.js";
37
+ import"./index-hws5f0z9.js";
38
38
  export {
39
39
  COLUMN_MAP2 as COLUMN_MAP,
40
40
  ModuleMemoryAuthorityError2 as ModuleMemoryAuthorityError,