@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.
- package/dist/auto-search-worker.js +163 -155
- package/dist/chunk-embedding-write-worker.js +71 -66
- package/dist/{compaction-marker-candidates-p1kqkqhq.js → compaction-marker-candidates-9fzqg6y0.js} +6 -3
- package/dist/compaction-marker-candidates-worker.js +24 -23
- package/dist/{compartment-chunk-embedding-8c85ebce.js → compartment-chunk-embedding-jpcme6tz.js} +11 -9
- package/dist/embedding-backfill-002vyexq.js +27 -0
- package/dist/embedding-worker-process.js +2 -1
- package/dist/embedding-worker.js +5 -4
- package/dist/expand-attachments-8sxeyj26.js +21 -0
- package/dist/historian-calibration-extension.js +2 -1
- package/dist/{index-hqw0rt9k.js → index-0wtm7g7f.js} +1 -1
- package/dist/{index-wqpjhx1p.js → index-2qqsnh1b.js} +2 -2
- package/dist/index-3bb24eb6.js +229 -0
- package/dist/{index-48twbev2.js → index-6pk49fc3.js} +37 -51
- package/dist/{index-399p688g.js → index-8sqebjzk.js} +4 -1
- package/dist/{index-np9ryr8y.js → index-a7sj2bam.js} +24 -241
- package/dist/index-by1bzjcd.js +24 -0
- package/dist/{index-6981g1xv.js → index-c1dqxr10.js} +35 -5
- package/dist/index-c6wbq66z.js +168 -0
- package/dist/{index-bvpar0bg.js → index-ck8wj35v.js} +2 -2
- package/dist/{index-jn44h81p.js → index-cq71g4dk.js} +1 -1
- package/dist/{index-pb3ea2tq.js → index-d107f484.js} +5 -5
- package/dist/{index-f4fz95fy.js → index-dgqjq8sg.js} +398 -4996
- package/dist/index-dnp1jjar.js +222 -0
- package/dist/index-ea37qn4x.js +777 -0
- package/dist/{index-g2tfayfc.js → index-f6y7mdq9.js} +98 -552
- package/dist/{index-0gymvr5j.js → index-f9qet7y8.js} +19 -8
- package/dist/index-gxqmh9hq.js +194 -0
- package/dist/{index-fgs78jyd.js → index-gymgz20n.js} +5 -222
- package/dist/index-hgd00nas.js +113 -0
- package/dist/{index-9xd7qveg.js → index-jbkwszd5.js} +4 -4
- package/dist/{index-e61zxfts.js → index-kj49vs41.js} +4 -4
- package/dist/{index-4zemngt7.js → index-mp0gh04g.js} +2 -2
- package/dist/{index-eenxm3t3.js → index-mx757f3g.js} +51 -32
- package/dist/{index-23t8ryqw.js → index-n0zjvs3h.js} +1 -168
- package/dist/index-nypgv96r.js +58 -0
- package/dist/index-p9jfa33t.js +4171 -0
- package/dist/{index-eqw9t2ty.js → index-pwp6zyx3.js} +15 -4
- package/dist/{index-cj3bkd16.js → index-ry84c8dr.js} +2 -2
- package/dist/{index-gwxaz0z5.js → index-rzfr7wdv.js} +2 -2
- package/dist/index-w26zvs1q.js +528 -0
- package/dist/index-wfqysrwq.js +204 -0
- package/dist/index-wrr9rp9a.js +16 -0
- package/dist/{index-my0dn413.js → index-wt7vmyj4.js} +1 -1
- package/dist/{index-0mc0vv97.js → index-wwsfevck.js} +8 -5
- package/dist/{index-54wmg4rj.js → index-x2n261wp.js} +16 -14
- package/dist/{index-6wdwv3a6.js → index-y90fxz4t.js} +10 -4
- package/dist/{index-c474g0gj.js → index-yacs388s.js} +1 -1
- package/dist/{index-xn5yh0pn.js → index-z7dktknj.js} +34 -131
- package/dist/index.js +1316 -488
- package/dist/{logger-shetp43v.js → logger-2j70hhz4.js} +2 -1
- package/dist/{message-fts-rowid-map-3mbvdgn9.js → message-fts-rowid-map-hmgyfxxa.js} +8 -6
- package/dist/{message-index-bounded-a6na71rg.js → message-index-bounded-82sergz7.js} +15 -12
- package/dist/{message-time-backfill-e3r8ddh1.js → message-time-backfill-x45573rs.js} +3 -2
- package/dist/migration-worker.js +56 -48
- package/dist/{project-embedding-registry-acqb6be4.js → project-embedding-registry-16pj4vyf.js} +16 -13
- package/dist/raw-ordinal-warmup-worker.js +114 -113
- package/dist/{read-session-chunk-2xcp6f40.js → read-session-chunk-jxq427v6.js} +17 -10
- package/dist/{read-session-raw-g9b1zdn5.js → read-session-raw-a9ntjqap.js} +6 -4
- package/dist/render-2wan3bfh.js +42 -0
- package/dist/{safe-notification-target-zcpchea6.js → safe-notification-target-jk69jxwp.js} +3 -2
- package/dist/search-3p18trsb.js +50 -0
- package/dist/search-archive-pgrv04gv.js +25 -0
- package/dist/{storage-tags-6409qq18.js → storage-tags-p9y3bnw7.js} +5 -4
- package/dist/store-reader-2m80zs5z.js +14 -0
- package/dist/store-v60q7dje.js +452 -0
- package/dist/subagent-entry.js +34 -25
- package/dist/tag-snapshot-worker-pi.js +218 -209
- package/dist/v2-archive-reader-5zpj8hrg.js +11 -0
- package/package.json +1 -1
- package/dist/embedding-backfill-rwfmyvze.js +0 -24
- package/dist/search-archive-jate39w5.js +0 -21
- package/dist/search-b6hp64hc.js +0 -45
|
@@ -1,171 +1,179 @@
|
|
|
1
1
|
import {
|
|
2
2
|
exitOnWorkerClose
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-x2n261wp.js";
|
|
4
|
+
import {
|
|
5
|
+
serveWorkerJobs
|
|
6
|
+
} from "./index-nypgv96r.js";
|
|
4
7
|
|
|
5
8
|
// ../plugin/src/hooks/magic-context/auto-search-worker.ts
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (input.job === "messages") {
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
] = await Promise.all([
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
]);
|
|
38
|
-
setHarness(input.harness);
|
|
39
|
-
registerSqliteDiagnosticSink(log, getHarness);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
port.on("message", (reply) => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return new Promise((resolve, reject) => {
|
|
55
|
-
const id = ++nextId;
|
|
56
|
-
pending.set(id, (reply) => reply.error ? reject(new Error(reply.error)) : resolve(reply));
|
|
57
|
-
port?.postMessage({ ...message, id });
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
db = new Database(input.path, input.job === "backfill" ? undefined : { readonly: true });
|
|
61
|
-
db.exec("PRAGMA busy_timeout = 250");
|
|
62
|
-
var { closePort } = exitOnWorkerClose(port, () => db.close());
|
|
63
|
-
var CHUNK_POOL_MAINTENANCE_INTERVAL_MS = 5000;
|
|
64
|
-
var maintenanceTimer;
|
|
65
|
-
var maintaining = false;
|
|
66
|
-
function maintainChunkPools() {
|
|
67
|
-
if (maintaining)
|
|
68
|
-
return;
|
|
69
|
-
maintaining = true;
|
|
70
|
-
maintainCompartmentChunkSearchPools(db).catch(() => {}).finally(() => {
|
|
71
|
-
maintaining = false;
|
|
9
|
+
serveWorkerJobs(async (initial, port) => {
|
|
10
|
+
let input = initial;
|
|
11
|
+
function post(reply) {
|
|
12
|
+
port.postMessage({ ...reply, jobId: input.jobId });
|
|
13
|
+
}
|
|
14
|
+
const persistent = input.persistent === true;
|
|
15
|
+
if (input.job === "messages") {
|
|
16
|
+
post({ kind: "accepted" });
|
|
17
|
+
}
|
|
18
|
+
const [
|
|
19
|
+
{ ensureMemoryEmbeddings },
|
|
20
|
+
{ getProjectEmbeddings },
|
|
21
|
+
{ getMemoriesByProject },
|
|
22
|
+
{ installProjectEmbeddingSearchBridge },
|
|
23
|
+
{ searchMessageHistory, unifiedSearch },
|
|
24
|
+
{ getLastCompartmentChunkPoolWarm, maintainCompartmentChunkSearchPools },
|
|
25
|
+
{ setEmbeddingSessionBusy },
|
|
26
|
+
{ getHarness, setHarness },
|
|
27
|
+
{ Database, registerSqliteDiagnosticSink },
|
|
28
|
+
{ log }
|
|
29
|
+
] = await Promise.all([
|
|
30
|
+
import("./embedding-backfill-002vyexq.js"),
|
|
31
|
+
import("./embedding-cache-7rp4gqzr.js"),
|
|
32
|
+
import("./storage-memory-0ndn65fm.js"),
|
|
33
|
+
import("./project-embedding-registry-16pj4vyf.js"),
|
|
34
|
+
import("./search-3p18trsb.js"),
|
|
35
|
+
import("./compartment-chunk-embedding-jpcme6tz.js"),
|
|
36
|
+
import("./embedding-activity-ew6dshfd.js"),
|
|
37
|
+
import("./harness-9872e0ym.js"),
|
|
38
|
+
import("./sqlite-v89bj0yy.js"),
|
|
39
|
+
import("./logger-2j70hhz4.js")
|
|
40
|
+
]);
|
|
41
|
+
setHarness(input.harness);
|
|
42
|
+
registerSqliteDiagnosticSink(log, getHarness);
|
|
43
|
+
let nextId = 0;
|
|
44
|
+
const pending = new Map;
|
|
45
|
+
let queryDimensions = null;
|
|
46
|
+
let db;
|
|
47
|
+
port.on("message", (reply) => {
|
|
48
|
+
if (reply.jobId !== input.jobId)
|
|
49
|
+
return;
|
|
50
|
+
if (reply.embeddingHostBusy !== undefined)
|
|
51
|
+
setEmbeddingSessionBusy(input.sessionId, reply.embeddingHostBusy);
|
|
52
|
+
const vector = reply.result instanceof Float32Array ? reply.result : reply.result?.vector;
|
|
53
|
+
if (vector)
|
|
54
|
+
queryDimensions = vector.length;
|
|
55
|
+
pending.get(reply.id)?.(reply);
|
|
56
|
+
pending.delete(reply.id);
|
|
72
57
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
maintenanceTimer.unref?.();
|
|
58
|
+
function request(message) {
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
const id = ++nextId;
|
|
61
|
+
pending.set(id, (reply) => reply.error ? reject(new Error(reply.error)) : resolve(reply));
|
|
62
|
+
post({ ...message, id });
|
|
63
|
+
});
|
|
80
64
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
embed: async (text) => {
|
|
94
|
-
const result = (await request({ kind: "query", text })).result;
|
|
95
|
-
return result instanceof Float32Array ? result : result?.vector ?? null;
|
|
96
|
-
},
|
|
97
|
-
embedBatch: async (texts, _signal, purpose = "passage") => {
|
|
98
|
-
const passage = (await request({ kind: "batch", texts, purpose })).passage;
|
|
99
|
-
const captured = input.snapshot;
|
|
100
|
-
if (!passage || !captured || passage.generation !== captured.generation || passage.modelId !== captured.modelId || passage.providerIdentity !== captured.providerIdentity || passage.runtimeFingerprint !== captured.runtimeFingerprint || !queryDimensions || passage.dimensions !== queryDimensions || passage.vectors.length !== texts.length)
|
|
101
|
-
return texts.map(() => null);
|
|
102
|
-
return passage.vectors.map((vector) => vector && vector.length === queryDimensions && vector.every(Number.isFinite) ? vector : null);
|
|
103
|
-
}
|
|
65
|
+
db = new Database(input.path, input.job === "backfill" ? undefined : { readonly: true });
|
|
66
|
+
db.exec("PRAGMA busy_timeout = 250");
|
|
67
|
+
const { closePort } = exitOnWorkerClose(port, () => db.close());
|
|
68
|
+
const CHUNK_POOL_MAINTENANCE_INTERVAL_MS = 5000;
|
|
69
|
+
let maintenanceTimer;
|
|
70
|
+
let maintaining = false;
|
|
71
|
+
function maintainChunkPools() {
|
|
72
|
+
if (maintaining)
|
|
73
|
+
return;
|
|
74
|
+
maintaining = true;
|
|
75
|
+
maintainCompartmentChunkSearchPools(db).catch(() => {}).finally(() => {
|
|
76
|
+
maintaining = false;
|
|
104
77
|
});
|
|
105
78
|
}
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
79
|
+
function scheduleChunkPoolMaintenance() {
|
|
80
|
+
if (!persistent)
|
|
81
|
+
return;
|
|
82
|
+
if (!maintenanceTimer) {
|
|
83
|
+
maintenanceTimer = setInterval(maintainChunkPools, CHUNK_POOL_MAINTENANCE_INTERVAL_MS);
|
|
84
|
+
maintenanceTimer.unref?.();
|
|
85
|
+
}
|
|
86
|
+
setTimeout(maintainChunkPools, 0);
|
|
87
|
+
}
|
|
88
|
+
async function run(jobInput) {
|
|
89
|
+
input = jobInput;
|
|
90
|
+
queryDimensions = null;
|
|
91
|
+
setEmbeddingSessionBusy(input.sessionId, input.embeddingHostBusy === true);
|
|
92
|
+
if (input.snapshot) {
|
|
93
|
+
installProjectEmbeddingSearchBridge(input.snapshot, {
|
|
94
|
+
modelId: input.snapshot.modelId,
|
|
95
|
+
initialize: async () => true,
|
|
96
|
+
isLoaded: () => true,
|
|
97
|
+
dispose: async () => {},
|
|
98
|
+
embed: async (text) => {
|
|
99
|
+
const result = (await request({ kind: "query", text })).result;
|
|
100
|
+
return result instanceof Float32Array ? result : result?.vector ?? null;
|
|
101
|
+
},
|
|
102
|
+
embedBatch: async (texts, _signal, purpose = "passage") => {
|
|
103
|
+
const passage = (await request({ kind: "batch", texts, purpose })).passage;
|
|
104
|
+
const captured = input.snapshot;
|
|
105
|
+
if (!passage || !captured || passage.generation !== captured.generation || passage.modelId !== captured.modelId || passage.providerIdentity !== captured.providerIdentity || passage.runtimeFingerprint !== captured.runtimeFingerprint || !queryDimensions || passage.dimensions !== queryDimensions || passage.vectors.length !== texts.length)
|
|
106
|
+
return texts.map(() => null);
|
|
107
|
+
return passage.vectors.map((vector) => vector && vector.length === queryDimensions && vector.every(Number.isFinite) ? vector : null);
|
|
119
108
|
}
|
|
120
|
-
}
|
|
121
|
-
port.postMessage({ kind: "result", results: [] });
|
|
122
|
-
} else if (input.job === "messages") {
|
|
123
|
-
if (!input.messageRequest)
|
|
124
|
-
throw new Error("message search job carries no request");
|
|
125
|
-
const outcome = searchMessageHistory(db, input.messageRequest);
|
|
126
|
-
port.postMessage({ kind: "messages", outcome });
|
|
127
|
-
} else {
|
|
128
|
-
const jobStarted = performance.now();
|
|
129
|
-
const steps = {};
|
|
130
|
-
const results = await unifiedSearch(db, input.sessionId, input.projectPath, input.query, {
|
|
131
|
-
...input.options,
|
|
132
|
-
backfillMemoryEmbeddings: false,
|
|
133
|
-
countRetrievals: false,
|
|
134
|
-
measurementDisabled: true,
|
|
135
|
-
embedQuery: async (text) => (await request({ kind: "query", text })).result ?? null,
|
|
136
|
-
isEmbeddingRuntimeEnabled: () => input.embeddingRuntimeEnabled,
|
|
137
|
-
stepTimings: steps
|
|
138
109
|
});
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
if (input.job === "backfill") {
|
|
113
|
+
if (input.snapshot?.enabled && input.snapshot.features.memoryEnabled) {
|
|
114
|
+
await request({ kind: "query", text: input.query });
|
|
115
|
+
if (queryDimensions) {
|
|
116
|
+
const existingEmbeddings = getProjectEmbeddings(db, input.projectPath, input.snapshot.modelId);
|
|
117
|
+
const memories = getMemoriesByProject(db, input.projectPath).filter((memory) => !existingEmbeddings.has(memory.id)).slice(0, 50);
|
|
118
|
+
await ensureMemoryEmbeddings({
|
|
119
|
+
db,
|
|
120
|
+
projectIdentity: input.projectPath,
|
|
121
|
+
memories,
|
|
122
|
+
existingEmbeddings
|
|
123
|
+
});
|
|
124
|
+
}
|
|
146
125
|
}
|
|
126
|
+
post({ kind: "result", results: [] });
|
|
127
|
+
} else if (input.job === "messages") {
|
|
128
|
+
if (!input.messageRequest)
|
|
129
|
+
throw new Error("message search job carries no request");
|
|
130
|
+
const outcome = searchMessageHistory(db, input.messageRequest);
|
|
131
|
+
post({ kind: "messages", outcome });
|
|
132
|
+
} else {
|
|
133
|
+
const jobStarted = performance.now();
|
|
134
|
+
const steps = {};
|
|
135
|
+
const diagnostics = input.options.autoSearchDiagnostics;
|
|
136
|
+
const results = await unifiedSearch(db, input.sessionId, input.projectPath, input.query, {
|
|
137
|
+
...input.options,
|
|
138
|
+
backfillMemoryEmbeddings: false,
|
|
139
|
+
countRetrievals: false,
|
|
140
|
+
measurementDisabled: true,
|
|
141
|
+
embedQuery: async (text) => (await request({ kind: "query", text })).result ?? null,
|
|
142
|
+
isEmbeddingRuntimeEnabled: () => input.embeddingRuntimeEnabled,
|
|
143
|
+
stepTimings: steps,
|
|
144
|
+
onAutoSearchDiagnostics: diagnostics ? () => port.postMessage({
|
|
145
|
+
kind: "diagnostics",
|
|
146
|
+
diagnostics,
|
|
147
|
+
jobId: jobInput.jobId
|
|
148
|
+
}) : undefined
|
|
149
|
+
});
|
|
150
|
+
post({
|
|
151
|
+
kind: "result",
|
|
152
|
+
results,
|
|
153
|
+
timings: {
|
|
154
|
+
steps,
|
|
155
|
+
jobMs: performance.now() - jobStarted,
|
|
156
|
+
lastPoolWarm: getLastCompartmentChunkPoolWarm()
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
scheduleChunkPoolMaintenance();
|
|
160
|
+
}
|
|
161
|
+
} catch (error) {
|
|
162
|
+
post({
|
|
163
|
+
kind: "error",
|
|
164
|
+
error: error instanceof Error ? error.message : String(error)
|
|
147
165
|
});
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
});
|
|
155
|
-
} finally {
|
|
156
|
-
setEmbeddingSessionBusy(input.sessionId, false);
|
|
157
|
-
if (!persistent) {
|
|
158
|
-
db.close();
|
|
159
|
-
closePort();
|
|
166
|
+
} finally {
|
|
167
|
+
setEmbeddingSessionBusy(input.sessionId, false);
|
|
168
|
+
if (!persistent) {
|
|
169
|
+
db.close();
|
|
170
|
+
closePort();
|
|
171
|
+
}
|
|
160
172
|
}
|
|
161
173
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
run(message.input);
|
|
166
|
-
});
|
|
167
|
-
run(input).catch((error) => {
|
|
168
|
-
setTimeout(() => {
|
|
169
|
-
throw error;
|
|
174
|
+
port.on("message", (message) => {
|
|
175
|
+
if (message.kind === "run" && message.input)
|
|
176
|
+
run(message.input);
|
|
170
177
|
});
|
|
178
|
+
await run(input);
|
|
171
179
|
});
|
|
@@ -10,86 +10,91 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
isWorkerCloseMessage,
|
|
12
12
|
exitOnWorkerClose
|
|
13
|
-
} from "./index-
|
|
14
|
-
import"./index-
|
|
15
|
-
import"./index-
|
|
16
|
-
import"./index-
|
|
17
|
-
import"./index-
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
13
|
+
} from "./index-x2n261wp.js";
|
|
14
|
+
import"./index-wt7vmyj4.js";
|
|
15
|
+
import"./index-gymgz20n.js";
|
|
16
|
+
import"./index-dnp1jjar.js";
|
|
17
|
+
import"./index-rzfr7wdv.js";
|
|
18
|
+
import"./index-8sqebjzk.js";
|
|
19
|
+
import"./index-wfqysrwq.js";
|
|
20
|
+
import"./index-c1dqxr10.js";
|
|
21
|
+
import"./index-ck8wj35v.js";
|
|
20
22
|
import {
|
|
21
23
|
replaceCompartmentChunkEmbeddings2,
|
|
22
24
|
recordChunkEmbedBackoff2,
|
|
23
25
|
loadUnembeddedSessionChunkCandidates2,
|
|
24
26
|
countUnembeddedSessionCompartments2
|
|
25
|
-
} from "./index-
|
|
27
|
+
} from "./index-f9qet7y8.js";
|
|
26
28
|
import {
|
|
27
29
|
recordSessionProjectIdentity,
|
|
28
30
|
acquireGitSweepLease,
|
|
29
31
|
renewGitSweepLease,
|
|
30
32
|
releaseGitSweepLease
|
|
31
|
-
} from "./index-
|
|
32
|
-
import"./index-
|
|
33
|
+
} from "./index-mp0gh04g.js";
|
|
34
|
+
import"./index-6pk49fc3.js";
|
|
33
35
|
import {
|
|
34
36
|
LATEST_SUPPORTED_VERSION,
|
|
35
37
|
enforceSchemaFence
|
|
36
|
-
} from "./index-
|
|
37
|
-
import"./index-
|
|
38
|
-
import"./index-
|
|
38
|
+
} from "./index-a7sj2bam.js";
|
|
39
|
+
import"./index-3bb24eb6.js";
|
|
40
|
+
import"./index-d107f484.js";
|
|
41
|
+
import"./index-yacs388s.js";
|
|
39
42
|
import"./index-135e8hvg.js";
|
|
40
|
-
import"./index-
|
|
41
|
-
import"./index-
|
|
43
|
+
import"./index-n0zjvs3h.js";
|
|
44
|
+
import"./index-c6wbq66z.js";
|
|
45
|
+
import"./index-0wtm7g7f.js";
|
|
46
|
+
import {
|
|
47
|
+
serveWorkerJobs
|
|
48
|
+
} from "./index-nypgv96r.js";
|
|
42
49
|
|
|
43
50
|
// ../plugin/src/features/magic-context/chunk-embedding-write-worker.ts
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (!enforceSchemaFence(db, workerData.path, LATEST_SUPPORTED_VERSION)) {
|
|
51
|
-
db.close();
|
|
52
|
-
throw new Error("chunk embedding writer rejected an unsupported store schema");
|
|
53
|
-
}
|
|
54
|
-
var timeout = Math.max(0, Math.floor(workerData.timeout));
|
|
55
|
-
db.exec(`PRAGMA busy_timeout=${timeout}; PRAGMA foreign_keys=ON`);
|
|
56
|
-
configureContextDatabasePragmas2(db);
|
|
57
|
-
exitOnWorkerClose(port, () => db.close());
|
|
58
|
-
port.on("message", (input) => {
|
|
59
|
-
if (isWorkerCloseMessage(input))
|
|
60
|
-
return;
|
|
61
|
-
try {
|
|
62
|
-
let value;
|
|
63
|
-
switch (input.kind) {
|
|
64
|
-
case "replace":
|
|
65
|
-
replaceCompartmentChunkEmbeddings2(db, input.rows, input.sourceKey);
|
|
66
|
-
break;
|
|
67
|
-
case "project":
|
|
68
|
-
recordSessionProjectIdentity(db, input.session, input.project);
|
|
69
|
-
break;
|
|
70
|
-
case "count":
|
|
71
|
-
value = countUnembeddedSessionCompartments2(db, input.project, input.session, input.model, input.tokens);
|
|
72
|
-
break;
|
|
73
|
-
case "candidates":
|
|
74
|
-
value = loadUnembeddedSessionChunkCandidates2(db, input.project, input.session, input.model, input.limit, input.excluded, input.tokens, true);
|
|
75
|
-
break;
|
|
76
|
-
case "backoff":
|
|
77
|
-
recordChunkEmbedBackoff2(db, input.candidate, input.project, input.model);
|
|
78
|
-
break;
|
|
79
|
-
case "acquire":
|
|
80
|
-
value = acquireGitSweepLease(db, input.project, input.holder, {
|
|
81
|
-
ignoreCooldown: true
|
|
82
|
-
});
|
|
83
|
-
break;
|
|
84
|
-
case "renew":
|
|
85
|
-
value = renewGitSweepLease(db, input.project, input.holder);
|
|
86
|
-
break;
|
|
87
|
-
case "release":
|
|
88
|
-
releaseGitSweepLease(db, input.project, input.holder);
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
port.postMessage({ value });
|
|
92
|
-
} catch (error) {
|
|
93
|
-
port.postMessage({ error: error instanceof Error ? error.message : String(error) });
|
|
51
|
+
serveWorkerJobs((workerData, port) => {
|
|
52
|
+
setHarness2(workerData.harness);
|
|
53
|
+
const db = new Database2(workerData.path);
|
|
54
|
+
if (!enforceSchemaFence(db, workerData.path, LATEST_SUPPORTED_VERSION)) {
|
|
55
|
+
db.close();
|
|
56
|
+
throw new Error("chunk embedding writer rejected an unsupported store schema");
|
|
94
57
|
}
|
|
95
|
-
|
|
58
|
+
const timeout = Math.max(0, Math.floor(workerData.timeout));
|
|
59
|
+
db.exec(`PRAGMA busy_timeout=${timeout}; PRAGMA foreign_keys=ON`);
|
|
60
|
+
configureContextDatabasePragmas2(db);
|
|
61
|
+
exitOnWorkerClose(port, () => db.close(), false);
|
|
62
|
+
port.on("message", (input) => {
|
|
63
|
+
if (isWorkerCloseMessage(input))
|
|
64
|
+
return;
|
|
65
|
+
try {
|
|
66
|
+
let value;
|
|
67
|
+
switch (input.kind) {
|
|
68
|
+
case "replace":
|
|
69
|
+
replaceCompartmentChunkEmbeddings2(db, input.rows, input.sourceKey);
|
|
70
|
+
break;
|
|
71
|
+
case "project":
|
|
72
|
+
recordSessionProjectIdentity(db, input.session, input.project);
|
|
73
|
+
break;
|
|
74
|
+
case "count":
|
|
75
|
+
value = countUnembeddedSessionCompartments2(db, input.project, input.session, input.model, input.tokens);
|
|
76
|
+
break;
|
|
77
|
+
case "candidates":
|
|
78
|
+
value = loadUnembeddedSessionChunkCandidates2(db, input.project, input.session, input.model, input.limit, input.excluded, input.tokens, true);
|
|
79
|
+
break;
|
|
80
|
+
case "backoff":
|
|
81
|
+
recordChunkEmbedBackoff2(db, input.candidate, input.project, input.model);
|
|
82
|
+
break;
|
|
83
|
+
case "acquire":
|
|
84
|
+
value = acquireGitSweepLease(db, input.project, input.holder, {
|
|
85
|
+
ignoreCooldown: true
|
|
86
|
+
});
|
|
87
|
+
break;
|
|
88
|
+
case "renew":
|
|
89
|
+
value = renewGitSweepLease(db, input.project, input.holder);
|
|
90
|
+
break;
|
|
91
|
+
case "release":
|
|
92
|
+
releaseGitSweepLease(db, input.project, input.holder);
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
port.postMessage({ value });
|
|
96
|
+
} catch (error) {
|
|
97
|
+
port.postMessage({ error: error instanceof Error ? error.message : String(error) });
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}, false);
|
package/dist/{compaction-marker-candidates-p1kqkqhq.js → compaction-marker-candidates-9fzqg6y0.js}
RENAMED
|
@@ -4,11 +4,14 @@ import {
|
|
|
4
4
|
readMarkerCandidateBasis2,
|
|
5
5
|
prepareMarkerCandidateBasis2,
|
|
6
6
|
scanMarkerCandidateSnapshot2
|
|
7
|
-
} from "./index-
|
|
8
|
-
import"./index-
|
|
7
|
+
} from "./index-y90fxz4t.js";
|
|
8
|
+
import"./index-wfqysrwq.js";
|
|
9
|
+
import"./index-8sqebjzk.js";
|
|
9
10
|
import"./index-2qtx0q6h.js";
|
|
10
|
-
import"./index-
|
|
11
|
+
import"./index-gymgz20n.js";
|
|
11
12
|
import"./index-0h2mkab2.js";
|
|
13
|
+
import"./index-dnp1jjar.js";
|
|
14
|
+
import"./index-x2n261wp.js";
|
|
12
15
|
export {
|
|
13
16
|
invalidateMarkerCandidateBasis2 as invalidateMarkerCandidateBasis,
|
|
14
17
|
isMarkerCandidateBasisCurrent2 as isMarkerCandidateBasisCurrent,
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
serveWorkerJobs
|
|
3
|
+
} from "./index-nypgv96r.js";
|
|
4
|
+
|
|
1
5
|
// ../plugin/src/features/magic-context/compaction-marker-candidates-worker.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
port.postMessage(reply);
|
|
24
|
-
port.close();
|
|
6
|
+
serveWorkerJobs(async (input, port) => {
|
|
7
|
+
port.postMessage({ kind: "accepted" });
|
|
8
|
+
const [{ Database }, { scanMarkerCandidateSnapshot }] = await Promise.all([
|
|
9
|
+
import("./sqlite-v89bj0yy.js"),
|
|
10
|
+
import("./compaction-marker-candidates-9fzqg6y0.js")
|
|
11
|
+
]);
|
|
12
|
+
let db;
|
|
13
|
+
let reply;
|
|
14
|
+
try {
|
|
15
|
+
db = new Database(input.path, { readonly: true });
|
|
16
|
+
db.exec("PRAGMA busy_timeout=250");
|
|
17
|
+
reply = { kind: "candidates", snapshot: scanMarkerCandidateSnapshot(db, input.sessionId) };
|
|
18
|
+
} catch (error) {
|
|
19
|
+
reply = { kind: "error", error: error instanceof Error ? error.message : String(error) };
|
|
20
|
+
} finally {
|
|
21
|
+
db?.close();
|
|
22
|
+
}
|
|
23
|
+
port.postMessage(reply);
|
|
24
|
+
port.close();
|
|
25
|
+
});
|
package/dist/{compartment-chunk-embedding-8c85ebce.js → compartment-chunk-embedding-jpcme6tz.js}
RENAMED
|
@@ -24,17 +24,19 @@ import {
|
|
|
24
24
|
countSessionCompartmentEmbedCoverage2,
|
|
25
25
|
countSessionCompartmentEmbedCoveragePolite2,
|
|
26
26
|
countUnembeddedSessionCompartmentsPolite2
|
|
27
|
-
} from "./index-
|
|
28
|
-
import"./index-
|
|
29
|
-
import"./index-
|
|
30
|
-
import"./index-
|
|
31
|
-
import"./index-
|
|
32
|
-
import"./index-
|
|
33
|
-
import"./index-
|
|
27
|
+
} from "./index-f9qet7y8.js";
|
|
28
|
+
import"./index-rzfr7wdv.js";
|
|
29
|
+
import"./index-ck8wj35v.js";
|
|
30
|
+
import"./index-c1dqxr10.js";
|
|
31
|
+
import"./index-wfqysrwq.js";
|
|
32
|
+
import"./index-8sqebjzk.js";
|
|
33
|
+
import"./index-0wtm7g7f.js";
|
|
34
|
+
import"./index-wt7vmyj4.js";
|
|
34
35
|
import"./index-2qtx0q6h.js";
|
|
35
|
-
import"./index-
|
|
36
|
+
import"./index-gymgz20n.js";
|
|
36
37
|
import"./index-0h2mkab2.js";
|
|
37
|
-
import"./index-
|
|
38
|
+
import"./index-dnp1jjar.js";
|
|
39
|
+
import"./index-x2n261wp.js";
|
|
38
40
|
export {
|
|
39
41
|
CHUNK_WINDOW_SAFETY_RATIO2 as CHUNK_WINDOW_SAFETY_RATIO,
|
|
40
42
|
DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2 as DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ensureMemoryEmbeddings2
|
|
3
|
+
} from "./index-jbkwszd5.js";
|
|
4
|
+
import"./index-z7dktknj.js";
|
|
5
|
+
import"./index-9p40dgkm.js";
|
|
6
|
+
import"./index-hgd00nas.js";
|
|
7
|
+
import"./index-yhzhdp3m.js";
|
|
8
|
+
import"./index-mp0gh04g.js";
|
|
9
|
+
import"./index-f9qet7y8.js";
|
|
10
|
+
import"./index-2qqsnh1b.js";
|
|
11
|
+
import"./index-rzfr7wdv.js";
|
|
12
|
+
import"./index-ccanzg8p.js";
|
|
13
|
+
import"./index-6pk49fc3.js";
|
|
14
|
+
import"./index-ck8wj35v.js";
|
|
15
|
+
import"./index-c1dqxr10.js";
|
|
16
|
+
import"./index-wfqysrwq.js";
|
|
17
|
+
import"./index-8sqebjzk.js";
|
|
18
|
+
import"./index-0wtm7g7f.js";
|
|
19
|
+
import"./index-wt7vmyj4.js";
|
|
20
|
+
import"./index-2qtx0q6h.js";
|
|
21
|
+
import"./index-gymgz20n.js";
|
|
22
|
+
import"./index-0h2mkab2.js";
|
|
23
|
+
import"./index-dnp1jjar.js";
|
|
24
|
+
import"./index-x2n261wp.js";
|
|
25
|
+
export {
|
|
26
|
+
ensureMemoryEmbeddings2 as ensureMemoryEmbeddings
|
|
27
|
+
};
|
package/dist/embedding-worker.js
CHANGED
|
@@ -3,16 +3,17 @@ import {
|
|
|
3
3
|
} from "./index-0h2mkab2.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-gymgz20n.js";
|
|
7
|
+
import"./index-dnp1jjar.js";
|
|
7
8
|
import"./index-ccanzg8p.js";
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
9
|
+
import"./index-rzfr7wdv.js";
|
|
10
|
+
import"./index-wt7vmyj4.js";
|
|
10
11
|
import"./index-2qtx0q6h.js";
|
|
11
12
|
import {
|
|
12
13
|
resolveLocalEmbeddingWorkerRuntime,
|
|
13
14
|
getLocalEmbeddingNativeMemoryStats,
|
|
14
15
|
LocalEmbeddingProvider
|
|
15
|
-
} from "./index-
|
|
16
|
+
} from "./index-2qqsnh1b.js";
|
|
16
17
|
import {
|
|
17
18
|
setStoragePrivatePermissionEnforcement
|
|
18
19
|
} from "./index-81nthk8j.js";
|