@cortexkit/pi-magic-context 0.49.34 → 0.49.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/auto-search-worker.js +163 -155
  2. package/dist/chunk-embedding-write-worker.js +71 -66
  3. package/dist/{compaction-marker-candidates-p1kqkqhq.js → compaction-marker-candidates-9fzqg6y0.js} +6 -3
  4. package/dist/compaction-marker-candidates-worker.js +24 -23
  5. package/dist/{compartment-chunk-embedding-8c85ebce.js → compartment-chunk-embedding-jpcme6tz.js} +11 -9
  6. package/dist/embedding-backfill-002vyexq.js +27 -0
  7. package/dist/embedding-worker-process.js +2 -1
  8. package/dist/embedding-worker.js +5 -4
  9. package/dist/expand-attachments-8sxeyj26.js +21 -0
  10. package/dist/historian-calibration-extension.js +2 -1
  11. package/dist/{index-hqw0rt9k.js → index-0wtm7g7f.js} +1 -1
  12. package/dist/{index-wqpjhx1p.js → index-2qqsnh1b.js} +2 -2
  13. package/dist/index-3bb24eb6.js +229 -0
  14. package/dist/{index-48twbev2.js → index-6pk49fc3.js} +37 -51
  15. package/dist/{index-399p688g.js → index-8sqebjzk.js} +4 -1
  16. package/dist/{index-np9ryr8y.js → index-a7sj2bam.js} +24 -241
  17. package/dist/index-by1bzjcd.js +24 -0
  18. package/dist/{index-6981g1xv.js → index-c1dqxr10.js} +35 -5
  19. package/dist/index-c6wbq66z.js +168 -0
  20. package/dist/{index-bvpar0bg.js → index-ck8wj35v.js} +2 -2
  21. package/dist/{index-jn44h81p.js → index-cq71g4dk.js} +1 -1
  22. package/dist/{index-pb3ea2tq.js → index-d107f484.js} +5 -5
  23. package/dist/{index-f4fz95fy.js → index-dgqjq8sg.js} +398 -4996
  24. package/dist/index-dnp1jjar.js +222 -0
  25. package/dist/index-ea37qn4x.js +777 -0
  26. package/dist/{index-g2tfayfc.js → index-f6y7mdq9.js} +98 -552
  27. package/dist/{index-0gymvr5j.js → index-f9qet7y8.js} +19 -8
  28. package/dist/index-gxqmh9hq.js +194 -0
  29. package/dist/{index-fgs78jyd.js → index-gymgz20n.js} +5 -222
  30. package/dist/index-hgd00nas.js +113 -0
  31. package/dist/{index-9xd7qveg.js → index-jbkwszd5.js} +4 -4
  32. package/dist/{index-e61zxfts.js → index-kj49vs41.js} +4 -4
  33. package/dist/{index-4zemngt7.js → index-mp0gh04g.js} +2 -2
  34. package/dist/{index-eenxm3t3.js → index-mx757f3g.js} +51 -32
  35. package/dist/{index-23t8ryqw.js → index-n0zjvs3h.js} +1 -168
  36. package/dist/index-nypgv96r.js +58 -0
  37. package/dist/index-p9jfa33t.js +4171 -0
  38. package/dist/{index-eqw9t2ty.js → index-pwp6zyx3.js} +15 -4
  39. package/dist/{index-cj3bkd16.js → index-ry84c8dr.js} +2 -2
  40. package/dist/{index-gwxaz0z5.js → index-rzfr7wdv.js} +2 -2
  41. package/dist/index-w26zvs1q.js +528 -0
  42. package/dist/index-wfqysrwq.js +204 -0
  43. package/dist/index-wrr9rp9a.js +16 -0
  44. package/dist/{index-my0dn413.js → index-wt7vmyj4.js} +1 -1
  45. package/dist/{index-0mc0vv97.js → index-wwsfevck.js} +8 -5
  46. package/dist/{index-54wmg4rj.js → index-x2n261wp.js} +16 -14
  47. package/dist/{index-6wdwv3a6.js → index-y90fxz4t.js} +10 -4
  48. package/dist/{index-c474g0gj.js → index-yacs388s.js} +1 -1
  49. package/dist/{index-xn5yh0pn.js → index-z7dktknj.js} +34 -131
  50. package/dist/index.js +1316 -488
  51. package/dist/{logger-shetp43v.js → logger-2j70hhz4.js} +2 -1
  52. package/dist/{message-fts-rowid-map-3mbvdgn9.js → message-fts-rowid-map-hmgyfxxa.js} +8 -6
  53. package/dist/{message-index-bounded-a6na71rg.js → message-index-bounded-82sergz7.js} +15 -12
  54. package/dist/{message-time-backfill-e3r8ddh1.js → message-time-backfill-x45573rs.js} +3 -2
  55. package/dist/migration-worker.js +56 -48
  56. package/dist/{project-embedding-registry-acqb6be4.js → project-embedding-registry-16pj4vyf.js} +16 -13
  57. package/dist/raw-ordinal-warmup-worker.js +114 -113
  58. package/dist/{read-session-chunk-2xcp6f40.js → read-session-chunk-jxq427v6.js} +17 -10
  59. package/dist/{read-session-raw-g9b1zdn5.js → read-session-raw-a9ntjqap.js} +6 -4
  60. package/dist/render-2wan3bfh.js +42 -0
  61. package/dist/{safe-notification-target-zcpchea6.js → safe-notification-target-jk69jxwp.js} +3 -2
  62. package/dist/search-3p18trsb.js +50 -0
  63. package/dist/search-archive-pgrv04gv.js +25 -0
  64. package/dist/{storage-tags-6409qq18.js → storage-tags-p9y3bnw7.js} +5 -4
  65. package/dist/store-reader-2m80zs5z.js +14 -0
  66. package/dist/store-v60q7dje.js +452 -0
  67. package/dist/subagent-entry.js +34 -25
  68. package/dist/tag-snapshot-worker-pi.js +218 -209
  69. package/dist/v2-archive-reader-5zpj8hrg.js +11 -0
  70. package/package.json +1 -1
  71. package/dist/embedding-backfill-rwfmyvze.js +0 -24
  72. package/dist/search-archive-jate39w5.js +0 -21
  73. package/dist/search-b6hp64hc.js +0 -45
@@ -1,245 +1,254 @@
1
1
  import {
2
2
  Database2
3
3
  } from "./index-2qtx0q6h.js";
4
- import"./index-48twbev2.js";
4
+ import"./index-6pk49fc3.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
  LATEST_SUPPORTED_VERSION,
9
10
  getPersistedSchemaVersion
10
- } from "./index-np9ryr8y.js";
11
+ } from "./index-a7sj2bam.js";
11
12
  import"./index-fapenpch.js";
12
- import"./index-399p688g.js";
13
+ import"./index-3bb24eb6.js";
14
+ import"./index-8sqebjzk.js";
15
+ import"./index-wfqysrwq.js";
13
16
  import {
14
17
  exitOnWorkerClose
15
- } from "./index-54wmg4rj.js";
16
- import"./index-6981g1xv.js";
17
- import"./index-bvpar0bg.js";
18
- import"./index-pb3ea2tq.js";
18
+ } from "./index-x2n261wp.js";
19
+ import"./index-c1dqxr10.js";
20
+ import"./index-ck8wj35v.js";
21
+ import"./index-d107f484.js";
19
22
  import {
20
23
  tagRevisionKey
21
- } from "./index-c474g0gj.js";
24
+ } from "./index-yacs388s.js";
22
25
  import"./index-135e8hvg.js";
23
- import"./index-23t8ryqw.js";
24
- import"./index-my0dn413.js";
26
+ import"./index-n0zjvs3h.js";
27
+ import"./index-wt7vmyj4.js";
28
+ import"./index-c6wbq66z.js";
25
29
  import {
26
30
  normalizeTagSnapshotRow2,
27
31
  TAG_SELECT_COLUMNS2
28
- } from "./index-eqw9t2ty.js";
32
+ } from "./index-pwp6zyx3.js";
29
33
  import {
30
34
  encodePiHydrationOperation,
31
35
  projectPiPassTag,
32
36
  PI_FALLBACK_ROW_COLUMNS,
33
37
  PI_FALLBACK_ROW_PREDICATE
34
- } from "./index-0mc0vv97.js";
35
- import"./index-hqw0rt9k.js";
38
+ } from "./index-wwsfevck.js";
39
+ import"./index-0wtm7g7f.js";
40
+ import {
41
+ serveWorkerJobs
42
+ } from "./index-nypgv96r.js";
36
43
 
37
44
  // src/tag-snapshot-worker-pi.ts
38
45
  import { setTimeout as delay } from "node:timers/promises";
39
- import { parentPort, workerData } from "node:worker_threads";
40
- var port = parentPort;
41
- if (!port)
42
- throw new Error("Pi tag hydration requires a worker port");
43
- var request = workerData;
44
- var db;
45
- var sequence = 0;
46
- var generation = { revision: "0", durable: 0 };
47
- var maxReadTransactionMs = 0;
48
- var packetCount = 0;
49
- var packetBytes = 0;
50
- var sampledGeneration = false;
51
- var generationStatement;
52
- var opened = false;
53
- var persistedVersion = 0;
54
- var { closePort } = exitOnWorkerClose(port, () => {
55
- const connection = db;
56
- db = undefined;
57
- connection?.close();
58
- });
46
+ serveWorkerJobs(async (request, port) => {
47
+ let db;
48
+ let sequence = 0;
49
+ let generation = { revision: "0", durable: 0 };
50
+ let maxReadTransactionMs = 0;
51
+ let packetCount = 0;
52
+ let packetBytes = 0;
53
+ let sampledGeneration = false;
54
+ let generationStatement;
55
+ let opened = false;
56
+ let persistedVersion = 0;
57
+ const { closePort } = exitOnWorkerClose(port, () => {
58
+ const connection = db;
59
+ db = undefined;
60
+ connection?.close();
61
+ });
59
62
 
60
- class StaleGeneration extends Error {
61
- }
63
+ class StaleGeneration extends Error {
64
+ }
62
65
 
63
- class UnsupportedSchema extends Error {
64
- }
65
- function sample(_connection) {
66
- return generationStatement.get(tagRevisionKey(request.sessionId), request.sessionId);
67
- }
68
- function envelope() {
69
- return {
70
- jobId: request.jobId,
71
- sessionId: request.sessionId,
72
- connectionEpoch: request.connectionEpoch,
73
- sessionEpoch: request.sessionEpoch,
74
- sequence: sequence++,
75
- generation
76
- };
77
- }
78
- async function send(message) {
79
- const ack = new Promise((resolve, reject) => {
80
- port?.once("message", (value) => {
81
- if (value.type !== "ack" || value.sequence !== message.sequence)
82
- reject(new Error("invalid packet credit"));
83
- else if (message.type === "packet" && (!(value.bytes instanceof ArrayBuffer) || value.bytes.byteLength !== 65536))
84
- reject(new Error("invalid returned packet buffer"));
85
- else
86
- resolve(value.bytes);
66
+ class UnsupportedSchema extends Error {
67
+ }
68
+ function sample(_connection) {
69
+ return generationStatement.get(tagRevisionKey(request.sessionId), request.sessionId);
70
+ }
71
+ function envelope() {
72
+ return {
73
+ jobId: request.jobId,
74
+ sessionId: request.sessionId,
75
+ connectionEpoch: request.connectionEpoch,
76
+ sessionEpoch: request.sessionEpoch,
77
+ sequence: sequence++,
78
+ generation
79
+ };
80
+ }
81
+ async function send(message) {
82
+ const ack = new Promise((resolve, reject) => {
83
+ port?.once("message", (value) => {
84
+ if (value.type !== "ack" || value.sequence !== message.sequence)
85
+ reject(new Error("invalid packet credit"));
86
+ else if (message.type === "packet" && (!(value.bytes instanceof ArrayBuffer) || value.bytes.byteLength !== 65536))
87
+ reject(new Error("invalid returned packet buffer"));
88
+ else
89
+ resolve(value.bytes);
90
+ });
87
91
  });
88
- });
89
- if (message.type === "packet")
90
- port?.postMessage(message, [message.bytes]);
91
- else
92
- port?.postMessage(message);
93
- return await ack;
94
- }
95
- function* operations(row) {
96
- if (Object.values(row).every((value) => !(typeof value === "string" && value.length > 2048) && !(value instanceof Uint8Array && value.length > 2048))) {
97
- yield { type: "row", value: row };
98
- return;
92
+ if (message.type === "packet")
93
+ port?.postMessage(message, [message.bytes]);
94
+ else
95
+ port?.postMessage(message);
96
+ return await ack;
99
97
  }
100
- for (const [key, value] of Object.entries(row)) {
101
- if (typeof value === "string" || value instanceof Uint8Array) {
102
- if (value.length === 0)
98
+ function* operations(row) {
99
+ if (Object.values(row).every((value) => !(typeof value === "string" && value.length > 2048) && !(value instanceof Uint8Array && value.length > 2048))) {
100
+ yield { type: "row", value: row };
101
+ return;
102
+ }
103
+ for (const [key, value] of Object.entries(row)) {
104
+ if (typeof value === "string" || value instanceof Uint8Array) {
105
+ if (value.length === 0)
106
+ yield { type: "field", key, value, append: false };
107
+ for (let start = 0;start < value.length; start += 2048)
108
+ yield {
109
+ type: "field",
110
+ key,
111
+ value: value.slice(start, start + 2048),
112
+ append: start !== 0,
113
+ totalLength: value instanceof Uint8Array ? value.length : undefined
114
+ };
115
+ } else
103
116
  yield { type: "field", key, value, append: false };
104
- for (let start = 0;start < value.length; start += 2048)
105
- yield {
106
- type: "field",
107
- key,
108
- value: value.slice(start, start + 2048),
109
- append: start !== 0,
110
- totalLength: value instanceof Uint8Array ? value.length : undefined
111
- };
112
- } else
113
- yield { type: "field", key, value, append: false };
114
- }
115
- yield { type: "row-end" };
116
- }
117
- async function stream(kind) {
118
- const connection = db;
119
- if (!connection)
120
- throw new Error("closed worker connection");
121
- let cursor;
122
- let rowsSent = 0;
123
- const columns = kind === "tags" ? TAG_SELECT_COLUMNS2 : PI_FALLBACK_ROW_COLUMNS;
124
- const fallback = kind === "fallback" ? `AND ${PI_FALLBACK_ROW_PREDICATE}` : "";
125
- const query = `SELECT ${columns} FROM tags WHERE session_id = ? ${fallback}`;
126
- const firstPage = connection.prepare(`${query} ORDER BY tag_number ASC, id ASC LIMIT 256`);
127
- const nextPage = connection.prepare(`${query} AND (tag_number, id) > (?, ?) ORDER BY tag_number ASC, id ASC LIMIT 256`);
128
- const nextNullPage = connection.prepare(`${query} AND ((tag_number IS NULL AND id > ?) OR tag_number IS NOT NULL) ORDER BY tag_number ASC, id ASC LIMIT 256`);
129
- let buffer = new Uint8Array(65536);
130
- for (;; ) {
131
- if (request.test?.pageDelayMs)
132
- await delay(request.test.pageDelayMs);
133
- const started = performance.now();
134
- let rows;
135
- connection.exec("BEGIN");
136
- try {
137
- const stamp = sample(connection);
138
- if (!sampledGeneration) {
139
- sampledGeneration = true;
140
- generation = stamp;
141
- } else if (stamp.revision !== generation.revision || stamp.durable !== generation.durable)
142
- throw new StaleGeneration("session tags changed between pages");
143
- rows = cursor ? cursor.tag_number === null ? nextNullPage.all(request.sessionId, cursor.id) : nextPage.all(request.sessionId, cursor.tag_number, cursor.id) : firstPage.all(request.sessionId);
144
- connection.exec("COMMIT");
145
- } catch (error) {
146
- connection.exec("ROLLBACK");
147
- throw error;
148
- } finally {
149
- maxReadTransactionMs = Math.max(maxReadTransactionMs, performance.now() - started);
150
117
  }
151
- let used = 0;
152
- let packetRows = 0;
153
- const flush = async () => {
154
- if (used === 0)
155
- return;
156
- const bytes = buffer.buffer;
157
- packetCount++;
158
- packetBytes += used;
159
- const returned = await send({
160
- ...envelope(),
161
- type: "packet",
162
- stream: kind,
163
- bytes,
164
- byteLength: used,
165
- rows: packetRows
166
- });
167
- buffer = new Uint8Array(returned);
168
- used = 0;
169
- packetRows = 0;
170
- };
171
- for (const raw of rows) {
172
- cursor = { tag_number: raw.tag_number, id: raw.id };
173
- const normalized = kind === "tags" ? normalizeTagSnapshotRow2(raw) : raw;
174
- const row = kind === "tags" && normalized && request.projection === "pass" ? projectPiPassTag(normalized) : normalized;
175
- if (!row)
176
- continue;
177
- for (const operation of operations(row)) {
178
- const encoded = encodePiHydrationOperation(operation);
179
- if (encoded.length + 4 > 65536)
180
- throw new Error("field fragment exceeds packet limit");
181
- if (used + encoded.length + 4 > buffer.length || packetRows === 256)
182
- await flush();
183
- new DataView(buffer.buffer).setUint32(used, encoded.length);
184
- used += 4;
185
- buffer.set(encoded, used);
186
- used += encoded.length;
187
- if (operation.type === "row" || operation.type === "row-end") {
188
- packetRows++;
189
- rowsSent++;
118
+ yield { type: "row-end" };
119
+ }
120
+ async function stream(kind) {
121
+ const connection = db;
122
+ if (!connection)
123
+ throw new Error("closed worker connection");
124
+ let cursor;
125
+ let rowsSent = 0;
126
+ const columns = kind === "tags" ? TAG_SELECT_COLUMNS2 : PI_FALLBACK_ROW_COLUMNS;
127
+ const fallback = kind === "fallback" ? `AND ${PI_FALLBACK_ROW_PREDICATE}` : "";
128
+ const query = `SELECT ${columns} FROM tags WHERE session_id = ? ${fallback}`;
129
+ const firstPage = connection.prepare(`${query} ORDER BY tag_number ASC, id ASC LIMIT 256`);
130
+ const nextPage = connection.prepare(`${query} AND (tag_number, id) > (?, ?) ORDER BY tag_number ASC, id ASC LIMIT 256`);
131
+ const nextNullPage = connection.prepare(`${query} AND ((tag_number IS NULL AND id > ?) OR tag_number IS NOT NULL) ORDER BY tag_number ASC, id ASC LIMIT 256`);
132
+ let buffer = new Uint8Array(65536);
133
+ for (;; ) {
134
+ if (request.test?.pageDelayMs)
135
+ await delay(request.test.pageDelayMs);
136
+ const started = performance.now();
137
+ let rows;
138
+ connection.exec("BEGIN");
139
+ try {
140
+ const stamp = sample(connection);
141
+ if (!sampledGeneration) {
142
+ sampledGeneration = true;
143
+ generation = stamp;
144
+ } else if (stamp.revision !== generation.revision || stamp.durable !== generation.durable)
145
+ throw new StaleGeneration("session tags changed between pages");
146
+ rows = cursor ? cursor.tag_number === null ? nextNullPage.all(request.sessionId, cursor.id) : nextPage.all(request.sessionId, cursor.tag_number, cursor.id) : firstPage.all(request.sessionId);
147
+ connection.exec("COMMIT");
148
+ } catch (error) {
149
+ connection.exec("ROLLBACK");
150
+ throw error;
151
+ } finally {
152
+ maxReadTransactionMs = Math.max(maxReadTransactionMs, performance.now() - started);
153
+ }
154
+ let used = 0;
155
+ let packetRows = 0;
156
+ const flush = async () => {
157
+ if (used === 0)
158
+ return;
159
+ const bytes = buffer.buffer;
160
+ packetCount++;
161
+ packetBytes += used;
162
+ const returned = await send({
163
+ ...envelope(),
164
+ type: "packet",
165
+ stream: kind,
166
+ bytes,
167
+ byteLength: used,
168
+ rows: packetRows
169
+ });
170
+ buffer = new Uint8Array(returned);
171
+ used = 0;
172
+ packetRows = 0;
173
+ };
174
+ for (const raw of rows) {
175
+ cursor = { tag_number: raw.tag_number, id: raw.id };
176
+ const normalized = kind === "tags" ? normalizeTagSnapshotRow2(raw) : raw;
177
+ const row = kind === "tags" && normalized && request.projection === "pass" ? projectPiPassTag(normalized) : normalized;
178
+ if (!row)
179
+ continue;
180
+ for (const operation of operations(row)) {
181
+ const encoded = encodePiHydrationOperation(operation);
182
+ if (encoded.length + 4 > 65536)
183
+ throw new Error("field fragment exceeds packet limit");
184
+ if (used + encoded.length + 4 > buffer.length || packetRows === 256)
185
+ await flush();
186
+ new DataView(buffer.buffer).setUint32(used, encoded.length);
187
+ used += 4;
188
+ buffer.set(encoded, used);
189
+ used += encoded.length;
190
+ if (operation.type === "row" || operation.type === "row-end") {
191
+ packetRows++;
192
+ rowsSent++;
193
+ }
190
194
  }
191
195
  }
196
+ await flush();
197
+ if (rows.length < 256)
198
+ break;
192
199
  }
193
- await flush();
194
- if (rows.length < 256)
195
- break;
200
+ await send({ ...envelope(), type: "end", stream: kind, rows: rowsSent });
196
201
  }
197
- await send({ ...envelope(), type: "end", stream: kind, rows: rowsSent });
198
- }
199
- var run = async () => {
200
- try {
201
- if (request.test?.openDelayMs)
202
- await delay(request.test.openDelayMs);
203
- db = new Database2(request.path, { readonly: true });
204
- opened = true;
205
- db.exec("PRAGMA query_only = ON; PRAGMA busy_timeout = 50; PRAGMA cache_size = -1024");
206
- generationStatement = db.prepare(`SELECT
202
+ const run = async () => {
203
+ try {
204
+ if (request.test?.openDelayMs)
205
+ await delay(request.test.openDelayMs);
206
+ db = new Database2(request.path, { readonly: true });
207
+ opened = true;
208
+ db.exec("PRAGMA query_only = ON; PRAGMA busy_timeout = 50; PRAGMA cache_size = -1024");
209
+ generationStatement = db.prepare(`SELECT
207
210
  COALESCE((SELECT value FROM schema_migrations_meta WHERE key = ?), '0') AS revision,
208
211
  COALESCE((SELECT tags_version FROM session_meta WHERE session_id = ?), 0) AS durable`);
209
- const version = getPersistedSchemaVersion(db);
210
- persistedVersion = version;
211
- if (version > LATEST_SUPPORTED_VERSION)
212
- throw new UnsupportedSchema(`shared database schema v${version} is newer than this build supports (v${LATEST_SUPPORTED_VERSION}); update and restart this host`);
213
- await stream("tags");
214
- await stream("fallback");
215
- if (request.test?.crash === "before-end")
216
- throw new Error("injected worker crash before completion");
217
- const final = sample(db);
218
- if (final.revision !== generation.revision || final.durable !== generation.durable)
219
- throw new StaleGeneration("session tags changed after final page");
220
- db.close();
221
- db = undefined;
222
- port.postMessage({
223
- ...envelope(),
224
- type: "done",
225
- maxReadTransactionMs,
226
- packetCount,
227
- packetBytes
228
- });
229
- if (request.test?.crash === "after-end")
230
- process.exitCode = 1;
231
- } catch (error) {
232
- port.postMessage({
233
- ...envelope(),
234
- type: "failed",
235
- code: error instanceof StaleGeneration ? "stale" : error instanceof UnsupportedSchema ? "schema" : opened ? "failed" : "open",
236
- persistedVersion,
237
- supportedVersion: LATEST_SUPPORTED_VERSION,
238
- reason: error instanceof Error ? error.message : String(error)
239
- });
240
- } finally {
241
- db?.close();
242
- closePort();
243
- }
244
- };
245
- run();
212
+ const version = getPersistedSchemaVersion(db);
213
+ persistedVersion = version;
214
+ if (version > LATEST_SUPPORTED_VERSION)
215
+ throw new UnsupportedSchema(`shared database schema v${version} is newer than this build supports (v${LATEST_SUPPORTED_VERSION}); update and restart this host`);
216
+ await stream("tags");
217
+ await stream("fallback");
218
+ if (request.test?.crash === "before-end")
219
+ throw new Error("injected worker crash before completion");
220
+ const final = sample(db);
221
+ if (final.revision !== generation.revision || final.durable !== generation.durable)
222
+ throw new StaleGeneration("session tags changed after final page");
223
+ db.close();
224
+ db = undefined;
225
+ port.postMessage({
226
+ ...envelope(),
227
+ type: "done",
228
+ maxReadTransactionMs,
229
+ packetCount,
230
+ packetBytes
231
+ });
232
+ if (request.test?.crash === "after-end")
233
+ process.exit(1);
234
+ } catch (error) {
235
+ port.postMessage({
236
+ ...envelope(),
237
+ type: "failed",
238
+ code: error instanceof StaleGeneration ? "stale" : error instanceof UnsupportedSchema ? "schema" : opened ? "failed" : "open",
239
+ persistedVersion,
240
+ supportedVersion: LATEST_SUPPORTED_VERSION,
241
+ reason: error instanceof Error ? error.message : String(error)
242
+ });
243
+ if (request.test?.crash === "before-end") {
244
+ db?.close();
245
+ db = undefined;
246
+ process.exit(1);
247
+ }
248
+ } finally {
249
+ db?.close();
250
+ closePort();
251
+ }
252
+ };
253
+ await run();
254
+ });
@@ -0,0 +1,11 @@
1
+ import {
2
+ readV2ArchiveOffThread2,
3
+ serveV2ArchiveReads2
4
+ } from "./index-gxqmh9hq.js";
5
+ import"./index-8sqebjzk.js";
6
+ import"./index-2qtx0q6h.js";
7
+ import"./index-x2n261wp.js";
8
+ export {
9
+ readV2ArchiveOffThread2 as readV2ArchiveOffThread,
10
+ serveV2ArchiveReads2 as serveV2ArchiveReads
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/pi-magic-context",
3
- "version": "0.49.34",
3
+ "version": "0.49.36",
4
4
  "type": "module",
5
5
  "description": "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
@@ -1,24 +0,0 @@
1
- import {
2
- ensureMemoryEmbeddings2
3
- } from "./index-9xd7qveg.js";
4
- import"./index-xn5yh0pn.js";
5
- import"./index-9p40dgkm.js";
6
- import"./index-yhzhdp3m.js";
7
- import"./index-4zemngt7.js";
8
- import"./index-0gymvr5j.js";
9
- import"./index-wqpjhx1p.js";
10
- import"./index-gwxaz0z5.js";
11
- import"./index-ccanzg8p.js";
12
- import"./index-48twbev2.js";
13
- import"./index-bvpar0bg.js";
14
- import"./index-6981g1xv.js";
15
- import"./index-399p688g.js";
16
- import"./index-hqw0rt9k.js";
17
- import"./index-my0dn413.js";
18
- import"./index-2qtx0q6h.js";
19
- import"./index-fgs78jyd.js";
20
- import"./index-0h2mkab2.js";
21
- import"./index-54wmg4rj.js";
22
- export {
23
- ensureMemoryEmbeddings2 as ensureMemoryEmbeddings
24
- };
@@ -1,21 +0,0 @@
1
- import {
2
- renderSearchArchive2
3
- } from "./index-cj3bkd16.js";
4
- import"./index-1cvyaw9a.js";
5
- import"./index-eenxm3t3.js";
6
- import"./index-eqw9t2ty.js";
7
- import"./index-6x556c2q.js";
8
- import"./index-ccanzg8p.js";
9
- import"./index-23t8ryqw.js";
10
- import"./index-c474g0gj.js";
11
- import"./index-6981g1xv.js";
12
- import"./index-399p688g.js";
13
- import"./index-hqw0rt9k.js";
14
- import"./index-my0dn413.js";
15
- import"./index-2qtx0q6h.js";
16
- import"./index-fgs78jyd.js";
17
- import"./index-0h2mkab2.js";
18
- import"./index-54wmg4rj.js";
19
- export {
20
- renderSearchArchive2 as renderSearchArchive
21
- };
@@ -1,45 +0,0 @@
1
- import {
2
- createUnifiedSearchDiagnostics2,
3
- searchMessageHistory2,
4
- parseIdShapedQuery2,
5
- resolveMemoriesByIdsForSearch2,
6
- unifiedSearch2,
7
- formatSearchResults2
8
- } from "./index-g2tfayfc.js";
9
- import"./index-1cvyaw9a.js";
10
- import"./index-e61zxfts.js";
11
- import"./index-9xd7qveg.js";
12
- import"./index-xn5yh0pn.js";
13
- import"./index-9p40dgkm.js";
14
- import"./index-29nw7n1r.js";
15
- import"./index-yhzhdp3m.js";
16
- import"./index-4zemngt7.js";
17
- import"./index-0gymvr5j.js";
18
- import"./index-eenxm3t3.js";
19
- import"./index-eqw9t2ty.js";
20
- import"./index-6x556c2q.js";
21
- import"./index-wqpjhx1p.js";
22
- import"./index-gwxaz0z5.js";
23
- import"./index-ccanzg8p.js";
24
- import"./index-pb3ea2tq.js";
25
- import"./index-48twbev2.js";
26
- import"./index-bvpar0bg.js";
27
- import"./index-135e8hvg.js";
28
- import"./index-23t8ryqw.js";
29
- import"./index-c474g0gj.js";
30
- import"./index-6981g1xv.js";
31
- import"./index-399p688g.js";
32
- import"./index-hqw0rt9k.js";
33
- import"./index-my0dn413.js";
34
- import"./index-2qtx0q6h.js";
35
- import"./index-fgs78jyd.js";
36
- import"./index-0h2mkab2.js";
37
- import"./index-54wmg4rj.js";
38
- export {
39
- createUnifiedSearchDiagnostics2 as createUnifiedSearchDiagnostics,
40
- formatSearchResults2 as formatSearchResults,
41
- parseIdShapedQuery2 as parseIdShapedQuery,
42
- resolveMemoriesByIdsForSearch2 as resolveMemoriesByIdsForSearch,
43
- searchMessageHistory2 as searchMessageHistory,
44
- unifiedSearch2 as unifiedSearch
45
- };