@cortexkit/pi-magic-context 0.49.34 → 0.49.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/auto-search-worker.js +163 -155
  2. package/dist/chunk-embedding-write-worker.js +71 -66
  3. package/dist/{compaction-marker-candidates-p1kqkqhq.js → compaction-marker-candidates-9fzqg6y0.js} +6 -3
  4. package/dist/compaction-marker-candidates-worker.js +24 -23
  5. package/dist/{compartment-chunk-embedding-8c85ebce.js → compartment-chunk-embedding-jpcme6tz.js} +11 -9
  6. package/dist/embedding-backfill-002vyexq.js +27 -0
  7. package/dist/embedding-worker-process.js +2 -1
  8. package/dist/embedding-worker.js +5 -4
  9. package/dist/expand-attachments-8sxeyj26.js +21 -0
  10. package/dist/historian-calibration-extension.js +2 -1
  11. package/dist/{index-hqw0rt9k.js → index-0wtm7g7f.js} +1 -1
  12. package/dist/{index-wqpjhx1p.js → index-2qqsnh1b.js} +2 -2
  13. package/dist/index-3bb24eb6.js +229 -0
  14. package/dist/{index-48twbev2.js → index-6pk49fc3.js} +37 -51
  15. package/dist/{index-399p688g.js → index-8sqebjzk.js} +4 -1
  16. package/dist/{index-np9ryr8y.js → index-a7sj2bam.js} +24 -241
  17. package/dist/index-by1bzjcd.js +24 -0
  18. package/dist/{index-6981g1xv.js → index-c1dqxr10.js} +35 -5
  19. package/dist/index-c6wbq66z.js +168 -0
  20. package/dist/{index-bvpar0bg.js → index-ck8wj35v.js} +2 -2
  21. package/dist/{index-jn44h81p.js → index-cq71g4dk.js} +1 -1
  22. package/dist/{index-pb3ea2tq.js → index-d107f484.js} +5 -5
  23. package/dist/{index-f4fz95fy.js → index-dgqjq8sg.js} +398 -4996
  24. package/dist/index-dnp1jjar.js +222 -0
  25. package/dist/index-ea37qn4x.js +777 -0
  26. package/dist/{index-g2tfayfc.js → index-f6y7mdq9.js} +98 -552
  27. package/dist/{index-0gymvr5j.js → index-f9qet7y8.js} +19 -8
  28. package/dist/index-gxqmh9hq.js +194 -0
  29. package/dist/{index-fgs78jyd.js → index-gymgz20n.js} +5 -222
  30. package/dist/index-hgd00nas.js +113 -0
  31. package/dist/{index-9xd7qveg.js → index-jbkwszd5.js} +4 -4
  32. package/dist/{index-e61zxfts.js → index-kj49vs41.js} +4 -4
  33. package/dist/{index-4zemngt7.js → index-mp0gh04g.js} +2 -2
  34. package/dist/{index-eenxm3t3.js → index-mx757f3g.js} +51 -32
  35. package/dist/{index-23t8ryqw.js → index-n0zjvs3h.js} +1 -168
  36. package/dist/index-nypgv96r.js +58 -0
  37. package/dist/index-p9jfa33t.js +4171 -0
  38. package/dist/{index-eqw9t2ty.js → index-pwp6zyx3.js} +15 -4
  39. package/dist/{index-cj3bkd16.js → index-ry84c8dr.js} +2 -2
  40. package/dist/{index-gwxaz0z5.js → index-rzfr7wdv.js} +2 -2
  41. package/dist/index-w26zvs1q.js +528 -0
  42. package/dist/index-wfqysrwq.js +204 -0
  43. package/dist/index-wrr9rp9a.js +16 -0
  44. package/dist/{index-my0dn413.js → index-wt7vmyj4.js} +1 -1
  45. package/dist/{index-0mc0vv97.js → index-wwsfevck.js} +8 -5
  46. package/dist/{index-54wmg4rj.js → index-x2n261wp.js} +16 -14
  47. package/dist/{index-6wdwv3a6.js → index-y90fxz4t.js} +10 -4
  48. package/dist/{index-c474g0gj.js → index-yacs388s.js} +1 -1
  49. package/dist/{index-xn5yh0pn.js → index-z7dktknj.js} +34 -131
  50. package/dist/index.js +1316 -488
  51. package/dist/{logger-shetp43v.js → logger-2j70hhz4.js} +2 -1
  52. package/dist/{message-fts-rowid-map-3mbvdgn9.js → message-fts-rowid-map-hmgyfxxa.js} +8 -6
  53. package/dist/{message-index-bounded-a6na71rg.js → message-index-bounded-82sergz7.js} +15 -12
  54. package/dist/{message-time-backfill-e3r8ddh1.js → message-time-backfill-x45573rs.js} +3 -2
  55. package/dist/migration-worker.js +56 -48
  56. package/dist/{project-embedding-registry-acqb6be4.js → project-embedding-registry-16pj4vyf.js} +16 -13
  57. package/dist/raw-ordinal-warmup-worker.js +114 -113
  58. package/dist/{read-session-chunk-2xcp6f40.js → read-session-chunk-jxq427v6.js} +17 -10
  59. package/dist/{read-session-raw-g9b1zdn5.js → read-session-raw-a9ntjqap.js} +6 -4
  60. package/dist/render-2wan3bfh.js +42 -0
  61. package/dist/{safe-notification-target-zcpchea6.js → safe-notification-target-jk69jxwp.js} +3 -2
  62. package/dist/search-3p18trsb.js +50 -0
  63. package/dist/search-archive-pgrv04gv.js +25 -0
  64. package/dist/{storage-tags-6409qq18.js → storage-tags-p9y3bnw7.js} +5 -4
  65. package/dist/store-reader-2m80zs5z.js +14 -0
  66. package/dist/store-v60q7dje.js +452 -0
  67. package/dist/subagent-entry.js +34 -25
  68. package/dist/tag-snapshot-worker-pi.js +218 -209
  69. package/dist/v2-archive-reader-5zpj8hrg.js +11 -0
  70. package/package.json +1 -1
  71. package/dist/embedding-backfill-rwfmyvze.js +0 -24
  72. package/dist/search-archive-jate39w5.js +0 -21
  73. package/dist/search-b6hp64hc.js +0 -45
@@ -6,8 +6,9 @@ import {
6
6
  getLoggerDiagnostics2,
7
7
  flushLogger2,
8
8
  getLogFilePath2
9
- } from "./index-fgs78jyd.js";
9
+ } from "./index-gymgz20n.js";
10
10
  import"./index-0h2mkab2.js";
11
+ import"./index-dnp1jjar.js";
11
12
  export {
12
13
  flushLogger2 as flushLogger,
13
14
  getLogFilePath2 as getLogFilePath,
@@ -5,14 +5,16 @@ import {
5
5
  startMessageFtsRowidMapBackfill2,
6
6
  messageFtsOrdinalRangeIsMapped2,
7
7
  deleteUnmappedMessageFtsRows2
8
- } from "./index-bvpar0bg.js";
9
- import"./index-6981g1xv.js";
10
- import"./index-399p688g.js";
11
- import"./index-hqw0rt9k.js";
8
+ } from "./index-ck8wj35v.js";
9
+ import"./index-c1dqxr10.js";
10
+ import"./index-wfqysrwq.js";
11
+ import"./index-8sqebjzk.js";
12
+ import"./index-0wtm7g7f.js";
12
13
  import"./index-2qtx0q6h.js";
13
- import"./index-fgs78jyd.js";
14
+ import"./index-gymgz20n.js";
14
15
  import"./index-0h2mkab2.js";
15
- import"./index-54wmg4rj.js";
16
+ import"./index-dnp1jjar.js";
17
+ import"./index-x2n261wp.js";
16
18
  export {
17
19
  deleteUnmappedMessageFtsRows2 as deleteUnmappedMessageFtsRows,
18
20
  messageFtsOrdinalRangeIsMapped2 as messageFtsOrdinalRangeIsMapped,
@@ -3,18 +3,21 @@ import {
3
3
  withIndexChunk2,
4
4
  yieldIndexChunk2
5
5
  } from "./index-2qtx0q6h.js";
6
- import"./index-eqw9t2ty.js";
7
- import"./index-my0dn413.js";
6
+ import"./index-pwp6zyx3.js";
7
+ import"./index-wt7vmyj4.js";
8
8
  import"./index-0h2mkab2.js";
9
- import"./index-fgs78jyd.js";
10
- import"./index-c474g0gj.js";
9
+ import"./index-gymgz20n.js";
10
+ import"./index-dnp1jjar.js";
11
+ import"./index-yacs388s.js";
11
12
  import"./index-ccanzg8p.js";
12
- import"./index-399p688g.js";
13
- import"./index-54wmg4rj.js";
14
- import"./index-6981g1xv.js";
15
- import"./index-23t8ryqw.js";
16
- import"./index-eenxm3t3.js";
13
+ import"./index-8sqebjzk.js";
14
+ import"./index-wfqysrwq.js";
15
+ import"./index-x2n261wp.js";
16
+ import"./index-c1dqxr10.js";
17
+ import"./index-n0zjvs3h.js";
18
+ import"./index-mx757f3g.js";
17
19
  import"./index-6x556c2q.js";
20
+ import"./index-c6wbq66z.js";
18
21
  import {
19
22
  MESSAGE_INDEX_MAX_FTS_BYTES,
20
23
  messageIndexSkipKey,
@@ -22,9 +25,9 @@ import {
22
25
  markMessageIndexDirty,
23
26
  getIndexableContent,
24
27
  indexSingleMessage
25
- } from "./index-e61zxfts.js";
26
- import"./index-bvpar0bg.js";
27
- import"./index-hqw0rt9k.js";
28
+ } from "./index-kj49vs41.js";
29
+ import"./index-ck8wj35v.js";
30
+ import"./index-0wtm7g7f.js";
28
31
 
29
32
  // ../plugin/src/features/magic-context/message-index-bounded.ts
30
33
  import { createHash } from "node:crypto";
@@ -3,10 +3,11 @@ import {
3
3
  withoutSqliteTransformPass2
4
4
  } from "./index-2qtx0q6h.js";
5
5
  import"./index-0h2mkab2.js";
6
- import"./index-fgs78jyd.js";
6
+ import"./index-gymgz20n.js";
7
+ import"./index-dnp1jjar.js";
7
8
  import {
8
9
  logSlowWriteTransaction
9
- } from "./index-hqw0rt9k.js";
10
+ } from "./index-0wtm7g7f.js";
10
11
 
11
12
  // ../plugin/src/features/magic-context/message-time-backfill.ts
12
13
  var MESSAGE_TIME_BACKFILL_BATCH_SIZE = 500;
@@ -2,67 +2,75 @@ import"./index-0h2mkab2.js";
2
2
  import {
3
3
  setLogLineForwarder2,
4
4
  log2
5
- } from "./index-fgs78jyd.js";
5
+ } from "./index-gymgz20n.js";
6
+ import"./index-dnp1jjar.js";
6
7
  import {
7
8
  Database2
8
9
  } from "./index-2qtx0q6h.js";
9
10
  import"./index-135e8hvg.js";
10
11
  import {
11
12
  runMigrationsWithRetry
12
- } from "./index-pb3ea2tq.js";
13
- import"./index-c474g0gj.js";
14
- import"./index-23t8ryqw.js";
15
- import"./index-48twbev2.js";
13
+ } from "./index-d107f484.js";
14
+ import"./index-yacs388s.js";
15
+ import"./index-n0zjvs3h.js";
16
+ import"./index-6pk49fc3.js";
16
17
  import {
17
18
  setSqlitePragmaConfig,
18
19
  initializeDatabase
19
- } from "./index-np9ryr8y.js";
20
+ } from "./index-a7sj2bam.js";
20
21
  import"./index-fapenpch.js";
21
- import"./index-399p688g.js";
22
- import"./index-54wmg4rj.js";
23
- import"./index-6981g1xv.js";
24
- import"./index-bvpar0bg.js";
25
- import"./index-my0dn413.js";
22
+ import"./index-3bb24eb6.js";
23
+ import"./index-8sqebjzk.js";
24
+ import"./index-wfqysrwq.js";
25
+ import"./index-x2n261wp.js";
26
+ import"./index-c1dqxr10.js";
27
+ import"./index-ck8wj35v.js";
28
+ import"./index-wt7vmyj4.js";
29
+ import"./index-c6wbq66z.js";
26
30
  import {
27
31
  closeQuietly
28
32
  } from "./index-nrzkqte4.js";
29
- import"./index-hqw0rt9k.js";
33
+ import"./index-0wtm7g7f.js";
34
+ import {
35
+ serveWorkerJobs
36
+ } from "./index-nypgv96r.js";
30
37
 
31
38
  // ../plugin/src/features/magic-context/migration-worker.ts
32
- import { parentPort, workerData } from "node:worker_threads";
33
- function post(message) {
34
- parentPort?.postMessage(message);
35
- }
36
- async function main() {
37
- const data = workerData;
38
- setLogLineForwarder2((line) => post({ type: "log", line }));
39
- setSqlitePragmaConfig(data.sqlitePragmaConfig);
40
- post({ type: "ready" });
41
- let db;
42
- try {
43
- db = new Database2(data.dbPath);
44
- initializeDatabase(db, data.busyTimeoutMs);
45
- await runMigrationsWithRetry(db, {
46
- sleep: async (delayMs) => {
47
- post({ type: "lock-wait", waiting: true });
48
- await new Promise((resolve) => setTimeout(resolve, delayMs));
49
- post({ type: "lock-wait", waiting: false });
50
- }
51
- });
52
- const finished = db;
53
- db = undefined;
54
- finished.close();
55
- log2(`[migrations] migration worker connection closed: ${data.dbPath}`);
56
- post({ type: "done" });
57
- } catch (error) {
58
- post({
59
- type: "failed",
60
- message: error instanceof Error ? error.message : String(error)
61
- });
62
- } finally {
63
- if (db)
64
- closeQuietly(db);
65
- setLogLineForwarder2(null);
39
+ serveWorkerJobs(async (data, port) => {
40
+ function post(message) {
41
+ port.postMessage(message);
42
+ }
43
+ async function main() {
44
+ setLogLineForwarder2((line) => post({ type: "log", line }));
45
+ setSqlitePragmaConfig(data.sqlitePragmaConfig);
46
+ post({ type: "ready" });
47
+ let db;
48
+ try {
49
+ db = new Database2(data.dbPath);
50
+ initializeDatabase(db, data.busyTimeoutMs);
51
+ await runMigrationsWithRetry(db, {
52
+ sleep: async (delayMs) => {
53
+ post({ type: "lock-wait", waiting: true });
54
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
55
+ post({ type: "lock-wait", waiting: false });
56
+ }
57
+ });
58
+ const finished = db;
59
+ db = undefined;
60
+ finished.close();
61
+ log2(`[migrations] migration worker connection closed: ${data.dbPath}`);
62
+ post({ type: "done" });
63
+ } catch (error) {
64
+ post({
65
+ type: "failed",
66
+ message: error instanceof Error ? error.message : String(error)
67
+ });
68
+ } finally {
69
+ if (db)
70
+ closeQuietly(db);
71
+ setLogLineForwarder2(null);
72
+ }
66
73
  }
67
- }
68
- main();
74
+ await main();
75
+ port.close();
76
+ });
@@ -33,24 +33,27 @@ import {
33
33
  sweepAllRegisteredProjects2,
34
34
  _setTestProviderFactoryForProject2,
35
35
  _resetProjectEmbeddingRegistryForTests2
36
- } from "./index-xn5yh0pn.js";
36
+ } from "./index-z7dktknj.js";
37
37
  import"./index-9p40dgkm.js";
38
+ import"./index-hgd00nas.js";
38
39
  import"./index-yhzhdp3m.js";
39
- import"./index-4zemngt7.js";
40
- import"./index-0gymvr5j.js";
41
- import"./index-wqpjhx1p.js";
42
- import"./index-gwxaz0z5.js";
40
+ import"./index-mp0gh04g.js";
41
+ import"./index-f9qet7y8.js";
42
+ import"./index-2qqsnh1b.js";
43
+ import"./index-rzfr7wdv.js";
43
44
  import"./index-ccanzg8p.js";
44
- import"./index-48twbev2.js";
45
- import"./index-bvpar0bg.js";
46
- import"./index-6981g1xv.js";
47
- import"./index-399p688g.js";
48
- import"./index-hqw0rt9k.js";
49
- import"./index-my0dn413.js";
45
+ import"./index-6pk49fc3.js";
46
+ import"./index-ck8wj35v.js";
47
+ import"./index-c1dqxr10.js";
48
+ import"./index-wfqysrwq.js";
49
+ import"./index-8sqebjzk.js";
50
+ import"./index-0wtm7g7f.js";
51
+ import"./index-wt7vmyj4.js";
50
52
  import"./index-2qtx0q6h.js";
51
- import"./index-fgs78jyd.js";
53
+ import"./index-gymgz20n.js";
52
54
  import"./index-0h2mkab2.js";
53
- import"./index-54wmg4rj.js";
55
+ import"./index-dnp1jjar.js";
56
+ import"./index-x2n261wp.js";
54
57
  export {
55
58
  _resetProjectEmbeddingRegistryForTests2 as _resetProjectEmbeddingRegistryForTests,
56
59
  _setTestProviderFactoryForProject2 as _setTestProviderFactoryForProject,
@@ -1,126 +1,127 @@
1
1
  import {
2
2
  exitOnWorkerClose
3
- } from "./index-54wmg4rj.js";
3
+ } from "./index-x2n261wp.js";
4
+ import {
5
+ serveWorkerJobs
6
+ } from "./index-nypgv96r.js";
4
7
 
5
8
  // ../plugin/src/hooks/magic-context/raw-ordinal-warmup-worker.ts
6
- import { parentPort, workerData } from "node:worker_threads";
7
- if (!parentPort)
8
- throw new Error("raw ordinal warm-up worker requires a parent port");
9
- var port = parentPort;
10
- var input = workerData;
11
- port.postMessage({ kind: "accepted" });
12
- var openConnections = new Set;
13
- var { closePort } = exitOnWorkerClose(port, () => {
14
- for (const connection of openConnections) {
15
- try {
16
- connection.close();
17
- } catch {}
18
- }
19
- });
20
- main().catch((error) => {
21
- setTimeout(() => {
22
- throw error;
9
+ serveWorkerJobs(async (input, port) => {
10
+ port.postMessage({ kind: "accepted" });
11
+ const openConnections = new Set;
12
+ const { closePort } = exitOnWorkerClose(port, () => {
13
+ for (const connection of openConnections) {
14
+ try {
15
+ connection.close();
16
+ } catch {}
17
+ }
23
18
  });
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-v89bj0yy.js"),
33
- import("./read-session-raw-g9b1zdn5.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");
19
+ await main();
20
+ async function main() {
21
+ if (input.v2ArchiveReader) {
22
+ const { serveV2ArchiveReads } = await import("./v2-archive-reader-5zpj8hrg.js");
23
+ await serveV2ArchiveReads(port, openConnections);
24
+ return;
44
25
  }
45
- db = input.indexMessage || 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-3mbvdgn9.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-jate39w5.js");
55
- const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-g9b1zdn5.js");
56
- const archive = input.searchArchive;
57
- let raw;
58
- try {
26
+ const [
27
+ { Database, registerSqliteDiagnosticSink },
28
+ { readRawSessionMessageIdsAtOrdinalsFromDb, scanRawSessionSummaryRows },
29
+ { getHarness, setHarness },
30
+ { log }
31
+ ] = await Promise.all([
32
+ import("./sqlite-v89bj0yy.js"),
33
+ import("./read-session-raw-a9ntjqap.js"),
34
+ import("./harness-9872e0ym.js"),
35
+ import("./logger-2j70hhz4.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.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-hmgyfxxa.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-pgrv04gv.js");
55
+ const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-a9ntjqap.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.indexMessage) {
81
+ const { setHarness } = await import("./harness-9872e0ym.js");
82
+ setHarness(input.harness ?? "opencode");
83
+ const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
84
+ import("./message-index-bounded-82sergz7.js"),
85
+ import("./sqlite-context-pragmas-gcgch6qz.js")
86
+ ]);
87
+ configureContextDatabasePragmas(db);
88
+ const writer = db;
89
+ const message = input.indexMessage;
90
+ const cancellation = input.indexCancellation ? new Int32Array(input.indexCancellation) : undefined;
91
+ const result = await indexMessageInShortChunks(writer, input.sessionId, message, input, () => !cancellation || Atomics.load(cancellation, 0) === 0);
59
92
  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
- })
93
+ kind: "indexed",
94
+ inserted: result.inserted,
95
+ measurements: result.measurements
69
96
  };
70
- } finally {
71
- if (raw)
72
- openConnections.delete(raw);
73
- raw?.close();
97
+ } else if (input.tagRatio !== undefined) {
98
+ const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-p9y3bnw7.js");
99
+ const delta = input.tagState ? scanTagOwnerDelta(db, input.sessionId, input.tagState) : null;
100
+ if (delta)
101
+ reply = { kind: "tag-delta", delta };
102
+ else
103
+ reply = {
104
+ kind: "tag-summary",
105
+ summary: scanTagOwnerSummary(db, input.sessionId, input.tagRatio, input.tagRatios)
106
+ };
107
+ } else {
108
+ const scan = scanRawSessionSummaryRows(db, input.sessionId, input.previous);
109
+ reply = { kind: "scan", scan };
74
110
  }
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.indexMessage) {
81
- const { setHarness } = await import("./harness-9872e0ym.js");
82
- setHarness(input.harness ?? "opencode");
83
- const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
84
- import("./message-index-bounded-a6na71rg.js"),
85
- import("./sqlite-context-pragmas-gcgch6qz.js")
86
- ]);
87
- configureContextDatabasePragmas(db);
88
- const writer = db;
89
- const message = input.indexMessage;
90
- const cancellation = input.indexCancellation ? new Int32Array(input.indexCancellation) : undefined;
91
- const result = await indexMessageInShortChunks(writer, input.sessionId, message, input, () => !cancellation || Atomics.load(cancellation, 0) === 0);
111
+ } catch (error) {
112
+ const sqliteError = error;
92
113
  reply = {
93
- kind: "indexed",
94
- inserted: result.inserted,
95
- measurements: result.measurements
114
+ kind: "error",
115
+ error: error instanceof Error ? error.stack ?? error.message : String(error),
116
+ code: typeof sqliteError?.code === "string" ? sqliteError.code : undefined,
117
+ errcode: typeof sqliteError?.errcode === "number" ? sqliteError.errcode : undefined
96
118
  };
97
- } else if (input.tagRatio !== undefined) {
98
- const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-6409qq18.js");
99
- const delta = input.tagState ? scanTagOwnerDelta(db, input.sessionId, input.tagState) : null;
100
- if (delta)
101
- reply = { kind: "tag-delta", delta };
102
- else
103
- reply = {
104
- kind: "tag-summary",
105
- summary: scanTagOwnerSummary(db, input.sessionId, input.tagRatio, input.tagRatios)
106
- };
107
- } else {
108
- const scan = scanRawSessionSummaryRows(db, input.sessionId, input.previous);
109
- reply = { kind: "scan", scan };
119
+ } finally {
120
+ if (db)
121
+ openConnections.delete(db);
122
+ db?.close();
110
123
  }
111
- } catch (error) {
112
- const sqliteError = error;
113
- reply = {
114
- kind: "error",
115
- error: error instanceof Error ? error.stack ?? error.message : String(error),
116
- code: typeof sqliteError?.code === "string" ? sqliteError.code : undefined,
117
- errcode: typeof sqliteError?.errcode === "number" ? sqliteError.errcode : undefined
118
- };
119
- } finally {
120
- if (db)
121
- openConnections.delete(db);
122
- db?.close();
124
+ port.postMessage(reply);
125
+ closePort();
123
126
  }
124
- port.postMessage(reply);
125
- closePort();
126
- }
127
+ });
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  resolveHostServedBoundaryId2,
3
3
  hasRawMessageProvider2,
4
+ rawMessageWorkerSource2,
5
+ rawMessageOffThreadRangeReader2,
4
6
  setRawMessageProvider2,
5
7
  setBoundedRawMessageProvider2,
6
8
  withRawMessageProvider2,
@@ -36,23 +38,26 @@ import {
36
38
  readSessionChunk2,
37
39
  getRawSessionMessageIdsThrough2,
38
40
  readRawSessionSeedTail2
39
- } from "./index-eenxm3t3.js";
40
- import"./index-eqw9t2ty.js";
41
+ } from "./index-mx757f3g.js";
42
+ import"./index-pwp6zyx3.js";
41
43
  import"./index-6x556c2q.js";
42
44
  import"./index-ccanzg8p.js";
43
- import"./index-23t8ryqw.js";
44
- import"./index-c474g0gj.js";
45
- import"./index-6981g1xv.js";
46
- import"./index-399p688g.js";
47
- import"./index-hqw0rt9k.js";
45
+ import"./index-c6wbq66z.js";
46
+ import"./index-yacs388s.js";
47
+ import"./index-c1dqxr10.js";
48
+ import"./index-wfqysrwq.js";
49
+ import"./index-8sqebjzk.js";
50
+ import"./index-n0zjvs3h.js";
51
+ import"./index-0wtm7g7f.js";
48
52
  import {
49
53
  hasMeaningfulUserText2,
50
54
  extractTexts2
51
- } from "./index-my0dn413.js";
55
+ } from "./index-wt7vmyj4.js";
52
56
  import"./index-2qtx0q6h.js";
53
- import"./index-fgs78jyd.js";
57
+ import"./index-gymgz20n.js";
54
58
  import"./index-0h2mkab2.js";
55
- import"./index-54wmg4rj.js";
59
+ import"./index-dnp1jjar.js";
60
+ import"./index-x2n261wp.js";
56
61
  export {
57
62
  RAW_MESSAGE_VISIT_PAGE_SIZE2 as RAW_MESSAGE_VISIT_PAGE_SIZE,
58
63
  RAW_SESSION_TAG_KEY_PAGE_SIZE2 as RAW_SESSION_TAG_KEY_PAGE_SIZE,
@@ -73,6 +78,8 @@ export {
73
78
  prepareRawSessionOrdinals2 as prepareRawSessionOrdinals,
74
79
  primeInMemoryTailRawMessageCache2 as primeInMemoryTailRawMessageCache,
75
80
  primeTailRawMessageCache2 as primeTailRawMessageCache,
81
+ rawMessageOffThreadRangeReader2 as rawMessageOffThreadRangeReader,
82
+ rawMessageWorkerSource2 as rawMessageWorkerSource,
76
83
  readRawSessionBoundaryEndpoints2 as readRawSessionBoundaryEndpoints,
77
84
  readRawSessionMessageById2 as readRawSessionMessageById,
78
85
  readRawSessionMessageIdOrdinals2 as readRawSessionMessageIdOrdinals,
@@ -28,12 +28,14 @@ import {
28
28
  hasRawSessionMessageByIdFromDb2,
29
29
  readRawSeedTailFromDb2,
30
30
  readRawSessionBoundaryEndpointsFromDb2
31
- } from "./index-6981g1xv.js";
32
- import"./index-399p688g.js";
31
+ } from "./index-c1dqxr10.js";
32
+ import"./index-wfqysrwq.js";
33
+ import"./index-8sqebjzk.js";
33
34
  import"./index-2qtx0q6h.js";
34
- import"./index-fgs78jyd.js";
35
+ import"./index-gymgz20n.js";
35
36
  import"./index-0h2mkab2.js";
36
- import"./index-54wmg4rj.js";
37
+ import"./index-dnp1jjar.js";
38
+ import"./index-x2n261wp.js";
37
39
  export {
38
40
  RAW_SUMMARY_TEXT_MAX_CHARS2 as RAW_SUMMARY_TEXT_MAX_CHARS,
39
41
  RawOrdinalsNotReady2 as RawOrdinalsNotReady,
@@ -0,0 +1,42 @@
1
+ import {
2
+ renderMessageByOrdinal2,
3
+ renderVerboseRange2,
4
+ renderVerboseRangeForTool2,
5
+ renderItemByTag2
6
+ } from "./index-p9jfa33t.js";
7
+ import"./index-w26zvs1q.js";
8
+ import"./index-kj49vs41.js";
9
+ import"./index-hgd00nas.js";
10
+ import"./index-ea37qn4x.js";
11
+ import"./index-f9qet7y8.js";
12
+ import"./index-mx757f3g.js";
13
+ import"./index-pwp6zyx3.js";
14
+ import"./index-6x556c2q.js";
15
+ import"./index-rzfr7wdv.js";
16
+ import"./index-ccanzg8p.js";
17
+ import"./index-a7sj2bam.js";
18
+ import"./index-fapenpch.js";
19
+ import"./index-d107f484.js";
20
+ import"./index-135e8hvg.js";
21
+ import"./index-6pk49fc3.js";
22
+ import"./index-ck8wj35v.js";
23
+ import"./index-3bb24eb6.js";
24
+ import"./index-c6wbq66z.js";
25
+ import"./index-yacs388s.js";
26
+ import"./index-c1dqxr10.js";
27
+ import"./index-wfqysrwq.js";
28
+ import"./index-8sqebjzk.js";
29
+ import"./index-n0zjvs3h.js";
30
+ import"./index-0wtm7g7f.js";
31
+ import"./index-wt7vmyj4.js";
32
+ import"./index-2qtx0q6h.js";
33
+ import"./index-gymgz20n.js";
34
+ import"./index-0h2mkab2.js";
35
+ import"./index-dnp1jjar.js";
36
+ import"./index-x2n261wp.js";
37
+ export {
38
+ renderItemByTag2 as renderItemByTag,
39
+ renderMessageByOrdinal2 as renderMessageByOrdinal,
40
+ renderVerboseRange2 as renderVerboseRange,
41
+ renderVerboseRangeForTool2 as renderVerboseRangeForTool
42
+ };
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  isDefaultSessionTitle2,
3
3
  waitForSafeNotificationTarget2
4
- } from "./index-jn44h81p.js";
5
- import"./index-fgs78jyd.js";
4
+ } from "./index-cq71g4dk.js";
5
+ import"./index-gymgz20n.js";
6
6
  import"./index-0h2mkab2.js";
7
+ import"./index-dnp1jjar.js";
7
8
  export {
8
9
  isDefaultSessionTitle2 as isDefaultSessionTitle,
9
10
  waitForSafeNotificationTarget2 as waitForSafeNotificationTarget