@cortexkit/pi-magic-context 0.49.19 → 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.
- package/dist/auto-search-worker.js +48 -9
- package/dist/chunk-embedding-write-worker.js +29 -22
- package/dist/{compaction-marker-candidates-wjzqbspm.js → compaction-marker-candidates-fnm47jat.js} +3 -3
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/compartment-chunk-embedding-81qesfjs.js +64 -0
- package/dist/embedding-backfill-56e871c6.js +24 -0
- package/dist/embedding-worker-process.js +2 -2
- package/dist/embedding-worker.js +5 -5
- package/dist/historian-calibration-extension.js +1 -1
- package/dist/index-54wmg4rj.js +82 -0
- package/dist/{index-xnch62s6.js → index-5n5zxs8e.js} +314 -127
- package/dist/{index-msqrs4nf.js → index-5vgt1zeh.js} +5 -5
- package/dist/{index-qpq6w67c.js → index-6kb2xpw7.js} +2 -2
- package/dist/{index-58mj0dzc.js → index-af9t637y.js} +68 -16
- package/dist/{index-z2rkv0mb.js → index-b8am7tns.js} +4 -4
- package/dist/{index-rhprywn6.js → index-bttctq07.js} +23 -5
- package/dist/{index-e1rza8gp.js → index-dzem6gn9.js} +1 -1
- package/dist/{index-2mmy81qt.js → index-e19qtjj0.js} +468 -18
- package/dist/{index-7bqrfyny.js → index-fgs78jyd.js} +12 -15
- package/dist/{index-d4dt19md.js → index-hqw0rt9k.js} +1 -1
- package/dist/{index-rrwv9y2k.js → index-hws5f0z9.js} +1 -1
- package/dist/{index-f18ec69t.js → index-jn44h81p.js} +1 -1
- package/dist/{index-ek9zvs4f.js → index-jt0g3hn0.js} +37 -25
- package/dist/{index-d8gc0112.js → index-jxjr7kz9.js} +3 -3
- package/dist/{index-rc1dez8m.js → index-kqb3d8bs.js} +9 -5
- package/dist/{index-sqt2haap.js → index-mtvvhcw4.js} +10 -10
- package/dist/{index-1kcfwk9c.js → index-my0dn413.js} +1 -1
- package/dist/{index-apgwdby5.js → index-n4wyxcgr.js} +1 -1
- package/dist/{index-g7p75667.js → index-p63nwn5v.js} +2 -2
- package/dist/{index-svgkv4g2.js → index-qerzchrs.js} +2 -2
- package/dist/{index-vktahpdj.js → index-rfyvax95.js} +9 -3
- package/dist/{index-yygsh681.js → index-rgfb753z.js} +3 -3
- package/dist/{index-dtp1efvf.js → index-tb3d9trm.js} +2 -2
- package/dist/{index-vmcgew7x.js → index-v2epyzbm.js} +75 -57
- package/dist/{index-ym6nh2gk.js → index-vdy273xw.js} +107 -20
- package/dist/{index-jrap43gc.js → index-w1avzkdt.js} +1 -1
- package/dist/{index-wveb51es.js → index-zhwwp8zz.js} +63 -8
- package/dist/index.js +978 -235
- package/dist/{logger-dygt96rn.js → logger-shetp43v.js} +1 -1
- package/dist/{message-fts-rowid-map-cvpy2dmb.js → message-fts-rowid-map-bpexnsdj.js} +6 -5
- package/dist/{message-index-bounded-66saeq5j.js → message-index-bounded-d4r3weh0.js} +14 -13
- package/dist/{message-index-rc2x41k4.js → message-index-mvag9crh.js} +14 -13
- package/dist/{message-time-backfill-ssshbdy8.js → message-time-backfill-kc10yrcj.js} +3 -3
- package/dist/migration-worker.js +12 -11
- package/dist/{project-embedding-registry-vf1ncptn.js → project-embedding-registry-cfrg952x.js} +13 -12
- package/dist/raw-ordinal-warmup-worker.js +136 -101
- package/dist/{read-session-chunk-h5bzj91r.js → read-session-chunk-7g4zvpd8.js} +9 -8
- package/dist/{read-session-raw-9s3xn7fc.js → read-session-raw-0fsjh10f.js} +4 -3
- package/dist/{safe-notification-target-2rkvkmw8.js → safe-notification-target-zcpchea6.js} +2 -2
- package/dist/search-archive-qbhp7e89.js +21 -0
- package/dist/{search-wh7b9zht.js → search-hp4g3g9v.js} +22 -21
- package/dist/{sqlite-fsp0sf3r.js → sqlite-d67n6dtr.js} +1 -1
- package/dist/{storage-memory-yxxc5v4n.js → storage-memory-9g882j7a.js} +2 -2
- package/dist/{storage-tags-1kets0q8.js → storage-tags-m2qcp1g2.js} +7 -5
- package/dist/subagent-entry.js +26 -25
- package/dist/tag-snapshot-worker-pi.js +22 -14
- package/package.json +1 -1
- package/dist/embedding-backfill-vwag34t0.js +0 -23
- package/dist/search-archive-4817pqev.js +0 -20
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
exitOnWorkerClose
|
|
3
|
+
} from "./index-54wmg4rj.js";
|
|
4
|
+
|
|
1
5
|
// ../plugin/src/hooks/magic-context/auto-search-worker.ts
|
|
2
6
|
import { parentPort, workerData } from "node:worker_threads";
|
|
3
7
|
if (!parentPort)
|
|
@@ -14,20 +18,22 @@ var [
|
|
|
14
18
|
{ getMemoriesByProject },
|
|
15
19
|
{ installProjectEmbeddingSearchBridge },
|
|
16
20
|
{ searchMessageHistory, unifiedSearch },
|
|
21
|
+
{ getLastCompartmentChunkPoolWarm, maintainCompartmentChunkSearchPools },
|
|
17
22
|
{ setEmbeddingSessionBusy },
|
|
18
23
|
{ getHarness, setHarness },
|
|
19
24
|
{ Database, registerSqliteDiagnosticSink },
|
|
20
25
|
{ log }
|
|
21
26
|
] = await Promise.all([
|
|
22
|
-
import("./embedding-backfill-
|
|
27
|
+
import("./embedding-backfill-56e871c6.js"),
|
|
23
28
|
import("./embedding-cache-7rp4gqzr.js"),
|
|
24
|
-
import("./storage-memory-
|
|
25
|
-
import("./project-embedding-registry-
|
|
26
|
-
import("./search-
|
|
29
|
+
import("./storage-memory-9g882j7a.js"),
|
|
30
|
+
import("./project-embedding-registry-cfrg952x.js"),
|
|
31
|
+
import("./search-hp4g3g9v.js"),
|
|
32
|
+
import("./compartment-chunk-embedding-81qesfjs.js"),
|
|
27
33
|
import("./embedding-activity-ew6dshfd.js"),
|
|
28
34
|
import("./harness-9872e0ym.js"),
|
|
29
|
-
import("./sqlite-
|
|
30
|
-
import("./logger-
|
|
35
|
+
import("./sqlite-d67n6dtr.js"),
|
|
36
|
+
import("./logger-shetp43v.js")
|
|
31
37
|
]);
|
|
32
38
|
setHarness(input.harness);
|
|
33
39
|
registerSqliteDiagnosticSink(log, getHarness);
|
|
@@ -53,6 +59,27 @@ function request(message) {
|
|
|
53
59
|
}
|
|
54
60
|
db = new Database(input.path, input.job === "backfill" ? undefined : { readonly: true });
|
|
55
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;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function scheduleChunkPoolMaintenance() {
|
|
75
|
+
if (!persistent)
|
|
76
|
+
return;
|
|
77
|
+
if (!maintenanceTimer) {
|
|
78
|
+
maintenanceTimer = setInterval(maintainChunkPools, CHUNK_POOL_MAINTENANCE_INTERVAL_MS);
|
|
79
|
+
maintenanceTimer.unref?.();
|
|
80
|
+
}
|
|
81
|
+
setTimeout(maintainChunkPools, 0);
|
|
82
|
+
}
|
|
56
83
|
async function run(jobInput) {
|
|
57
84
|
input = jobInput;
|
|
58
85
|
queryDimensions = null;
|
|
@@ -98,15 +125,27 @@ async function run(jobInput) {
|
|
|
98
125
|
const outcome = searchMessageHistory(db, input.messageRequest);
|
|
99
126
|
port.postMessage({ kind: "messages", outcome });
|
|
100
127
|
} else {
|
|
128
|
+
const jobStarted = performance.now();
|
|
129
|
+
const steps = {};
|
|
101
130
|
const results = await unifiedSearch(db, input.sessionId, input.projectPath, input.query, {
|
|
102
131
|
...input.options,
|
|
103
132
|
backfillMemoryEmbeddings: false,
|
|
104
133
|
countRetrievals: false,
|
|
105
134
|
measurementDisabled: true,
|
|
106
135
|
embedQuery: async (text) => (await request({ kind: "query", text })).result ?? null,
|
|
107
|
-
isEmbeddingRuntimeEnabled: () => input.embeddingRuntimeEnabled
|
|
136
|
+
isEmbeddingRuntimeEnabled: () => input.embeddingRuntimeEnabled,
|
|
137
|
+
stepTimings: steps
|
|
138
|
+
});
|
|
139
|
+
port.postMessage({
|
|
140
|
+
kind: "result",
|
|
141
|
+
results,
|
|
142
|
+
timings: {
|
|
143
|
+
steps,
|
|
144
|
+
jobMs: performance.now() - jobStarted,
|
|
145
|
+
lastPoolWarm: getLastCompartmentChunkPoolWarm()
|
|
146
|
+
}
|
|
108
147
|
});
|
|
109
|
-
|
|
148
|
+
scheduleChunkPoolMaintenance();
|
|
110
149
|
}
|
|
111
150
|
} catch (error) {
|
|
112
151
|
port.postMessage({
|
|
@@ -117,7 +156,7 @@ async function run(jobInput) {
|
|
|
117
156
|
setEmbeddingSessionBusy(input.sessionId, false);
|
|
118
157
|
if (!persistent) {
|
|
119
158
|
db.close();
|
|
120
|
-
|
|
159
|
+
closePort();
|
|
121
160
|
}
|
|
122
161
|
}
|
|
123
162
|
}
|
|
@@ -3,39 +3,43 @@ import {
|
|
|
3
3
|
} from "./index-0h2mkab2.js";
|
|
4
4
|
import {
|
|
5
5
|
Database2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-hws5f0z9.js";
|
|
7
7
|
import {
|
|
8
8
|
configureContextDatabasePragmas2
|
|
9
9
|
} from "./index-fapenpch.js";
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
import {
|
|
11
|
+
isWorkerCloseMessage,
|
|
12
|
+
exitOnWorkerClose
|
|
13
|
+
} from "./index-54wmg4rj.js";
|
|
14
|
+
import"./index-my0dn413.js";
|
|
15
|
+
import"./index-fgs78jyd.js";
|
|
16
|
+
import"./index-jxjr7kz9.js";
|
|
13
17
|
import"./index-399p688g.js";
|
|
14
|
-
import"./index-
|
|
15
|
-
import"./index-
|
|
18
|
+
import"./index-rfyvax95.js";
|
|
19
|
+
import"./index-rgfb753z.js";
|
|
16
20
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from "./index-
|
|
21
|
+
replaceCompartmentChunkEmbeddings2,
|
|
22
|
+
recordChunkEmbedBackoff2,
|
|
23
|
+
loadUnembeddedSessionChunkCandidates2,
|
|
24
|
+
countUnembeddedSessionCompartments2
|
|
25
|
+
} from "./index-5n5zxs8e.js";
|
|
22
26
|
import {
|
|
23
27
|
recordSessionProjectIdentity,
|
|
24
28
|
acquireGitSweepLease,
|
|
25
29
|
renewGitSweepLease,
|
|
26
30
|
releaseGitSweepLease
|
|
27
|
-
} from "./index-
|
|
28
|
-
import"./index-
|
|
29
|
-
import"./index-
|
|
31
|
+
} from "./index-qerzchrs.js";
|
|
32
|
+
import"./index-p63nwn5v.js";
|
|
33
|
+
import"./index-n4wyxcgr.js";
|
|
30
34
|
import {
|
|
31
35
|
LATEST_SUPPORTED_VERSION,
|
|
32
36
|
enforceSchemaFence
|
|
33
|
-
} from "./index-
|
|
34
|
-
import"./index-
|
|
35
|
-
import"./index-
|
|
37
|
+
} from "./index-mtvvhcw4.js";
|
|
38
|
+
import"./index-5vgt1zeh.js";
|
|
39
|
+
import"./index-w1avzkdt.js";
|
|
36
40
|
import"./index-135e8hvg.js";
|
|
37
41
|
import"./index-8976mezv.js";
|
|
38
|
-
import"./index-
|
|
42
|
+
import"./index-hqw0rt9k.js";
|
|
39
43
|
|
|
40
44
|
// ../plugin/src/features/magic-context/chunk-embedding-write-worker.ts
|
|
41
45
|
import { parentPort, workerData } from "node:worker_threads";
|
|
@@ -51,24 +55,27 @@ if (!enforceSchemaFence(db, workerData.path, LATEST_SUPPORTED_VERSION)) {
|
|
|
51
55
|
var timeout = Math.max(0, Math.floor(workerData.timeout));
|
|
52
56
|
db.exec(`PRAGMA busy_timeout=${timeout}; PRAGMA foreign_keys=ON`);
|
|
53
57
|
configureContextDatabasePragmas2(db);
|
|
58
|
+
exitOnWorkerClose(port, () => db.close());
|
|
54
59
|
port.on("message", (input) => {
|
|
60
|
+
if (isWorkerCloseMessage(input))
|
|
61
|
+
return;
|
|
55
62
|
try {
|
|
56
63
|
let value;
|
|
57
64
|
switch (input.kind) {
|
|
58
65
|
case "replace":
|
|
59
|
-
|
|
66
|
+
replaceCompartmentChunkEmbeddings2(db, input.rows, input.sourceKey);
|
|
60
67
|
break;
|
|
61
68
|
case "project":
|
|
62
69
|
recordSessionProjectIdentity(db, input.session, input.project);
|
|
63
70
|
break;
|
|
64
71
|
case "count":
|
|
65
|
-
value =
|
|
72
|
+
value = countUnembeddedSessionCompartments2(db, input.project, input.session, input.model, input.tokens);
|
|
66
73
|
break;
|
|
67
74
|
case "candidates":
|
|
68
|
-
value =
|
|
75
|
+
value = loadUnembeddedSessionChunkCandidates2(db, input.project, input.session, input.model, input.limit, input.excluded, input.tokens, true);
|
|
69
76
|
break;
|
|
70
77
|
case "backoff":
|
|
71
|
-
|
|
78
|
+
recordChunkEmbedBackoff2(db, input.candidate, input.project, input.model);
|
|
72
79
|
break;
|
|
73
80
|
case "acquire":
|
|
74
81
|
value = acquireGitSweepLease(db, input.project, input.holder, {
|
package/dist/{compaction-marker-candidates-wjzqbspm.js → compaction-marker-candidates-fnm47jat.js}
RENAMED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
readMarkerCandidateBasis2,
|
|
5
5
|
prepareMarkerCandidateBasis2,
|
|
6
6
|
scanMarkerCandidateSnapshot2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-6kb2xpw7.js";
|
|
8
8
|
import"./index-399p688g.js";
|
|
9
|
-
import"./index-
|
|
10
|
-
import"./index-
|
|
9
|
+
import"./index-hws5f0z9.js";
|
|
10
|
+
import"./index-fgs78jyd.js";
|
|
11
11
|
import"./index-0h2mkab2.js";
|
|
12
12
|
export {
|
|
13
13
|
invalidateMarkerCandidateBasis2 as invalidateMarkerCandidateBasis,
|
|
@@ -5,8 +5,8 @@ if (!port)
|
|
|
5
5
|
throw new Error("marker candidate worker requires a parent port");
|
|
6
6
|
port.postMessage({ kind: "accepted" });
|
|
7
7
|
var [{ Database }, { scanMarkerCandidateSnapshot }] = await Promise.all([
|
|
8
|
-
import("./sqlite-
|
|
9
|
-
import("./compaction-marker-candidates-
|
|
8
|
+
import("./sqlite-d67n6dtr.js"),
|
|
9
|
+
import("./compaction-marker-candidates-fnm47jat.js")
|
|
10
10
|
]);
|
|
11
11
|
var input = workerData;
|
|
12
12
|
var db;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2,
|
|
3
|
+
CHUNK_WINDOW_SAFETY_RATIO2,
|
|
4
|
+
normalizeCompartmentChunkMaxInputTokens2,
|
|
5
|
+
buildCanonicalChunkTextFromFts2,
|
|
6
|
+
buildCompartmentSummaryFallbackText2,
|
|
7
|
+
canonicalizeInMemoryChunkTextForEmbedding2,
|
|
8
|
+
chunkCanonicalText2,
|
|
9
|
+
chunkEmbeddingWindowsAreCurrent2,
|
|
10
|
+
replaceCompartmentChunkEmbeddings2,
|
|
11
|
+
loadCompartmentChunkEmbeddingsForSearch2,
|
|
12
|
+
getLastCompartmentChunkPoolWarm2,
|
|
13
|
+
peekCompartmentChunkSearchPool2,
|
|
14
|
+
warmCompartmentChunkSearchPool2,
|
|
15
|
+
maintainCompartmentChunkSearchPools2,
|
|
16
|
+
loadUnembeddedShadowChunkCandidates2,
|
|
17
|
+
loadUnembeddedCompartmentChunkCandidatesPolite2,
|
|
18
|
+
deleteChunkEmbedBackoffForSession2,
|
|
19
|
+
recordChunkEmbedBackoff2,
|
|
20
|
+
chunkWindowSourceKey2,
|
|
21
|
+
loadUnembeddedSessionChunkCandidates2,
|
|
22
|
+
loadUnembeddedSessionChunkCandidatesPolite2,
|
|
23
|
+
countUnembeddedSessionCompartments2,
|
|
24
|
+
countSessionCompartmentEmbedCoverage2,
|
|
25
|
+
countSessionCompartmentEmbedCoveragePolite2,
|
|
26
|
+
countUnembeddedSessionCompartmentsPolite2
|
|
27
|
+
} from "./index-5n5zxs8e.js";
|
|
28
|
+
import"./index-jxjr7kz9.js";
|
|
29
|
+
import"./index-rgfb753z.js";
|
|
30
|
+
import"./index-rfyvax95.js";
|
|
31
|
+
import"./index-399p688g.js";
|
|
32
|
+
import"./index-hqw0rt9k.js";
|
|
33
|
+
import"./index-my0dn413.js";
|
|
34
|
+
import"./index-hws5f0z9.js";
|
|
35
|
+
import"./index-fgs78jyd.js";
|
|
36
|
+
import"./index-0h2mkab2.js";
|
|
37
|
+
import"./index-54wmg4rj.js";
|
|
38
|
+
export {
|
|
39
|
+
CHUNK_WINDOW_SAFETY_RATIO2 as CHUNK_WINDOW_SAFETY_RATIO,
|
|
40
|
+
DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2 as DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS,
|
|
41
|
+
buildCanonicalChunkTextFromFts2 as buildCanonicalChunkTextFromFts,
|
|
42
|
+
buildCompartmentSummaryFallbackText2 as buildCompartmentSummaryFallbackText,
|
|
43
|
+
canonicalizeInMemoryChunkTextForEmbedding2 as canonicalizeInMemoryChunkTextForEmbedding,
|
|
44
|
+
chunkCanonicalText2 as chunkCanonicalText,
|
|
45
|
+
chunkEmbeddingWindowsAreCurrent2 as chunkEmbeddingWindowsAreCurrent,
|
|
46
|
+
chunkWindowSourceKey2 as chunkWindowSourceKey,
|
|
47
|
+
countSessionCompartmentEmbedCoverage2 as countSessionCompartmentEmbedCoverage,
|
|
48
|
+
countSessionCompartmentEmbedCoveragePolite2 as countSessionCompartmentEmbedCoveragePolite,
|
|
49
|
+
countUnembeddedSessionCompartments2 as countUnembeddedSessionCompartments,
|
|
50
|
+
countUnembeddedSessionCompartmentsPolite2 as countUnembeddedSessionCompartmentsPolite,
|
|
51
|
+
deleteChunkEmbedBackoffForSession2 as deleteChunkEmbedBackoffForSession,
|
|
52
|
+
getLastCompartmentChunkPoolWarm2 as getLastCompartmentChunkPoolWarm,
|
|
53
|
+
loadCompartmentChunkEmbeddingsForSearch2 as loadCompartmentChunkEmbeddingsForSearch,
|
|
54
|
+
loadUnembeddedCompartmentChunkCandidatesPolite2 as loadUnembeddedCompartmentChunkCandidatesPolite,
|
|
55
|
+
loadUnembeddedSessionChunkCandidates2 as loadUnembeddedSessionChunkCandidates,
|
|
56
|
+
loadUnembeddedSessionChunkCandidatesPolite2 as loadUnembeddedSessionChunkCandidatesPolite,
|
|
57
|
+
loadUnembeddedShadowChunkCandidates2 as loadUnembeddedShadowChunkCandidates,
|
|
58
|
+
maintainCompartmentChunkSearchPools2 as maintainCompartmentChunkSearchPools,
|
|
59
|
+
normalizeCompartmentChunkMaxInputTokens2 as normalizeCompartmentChunkMaxInputTokens,
|
|
60
|
+
peekCompartmentChunkSearchPool2 as peekCompartmentChunkSearchPool,
|
|
61
|
+
recordChunkEmbedBackoff2 as recordChunkEmbedBackoff,
|
|
62
|
+
replaceCompartmentChunkEmbeddings2 as replaceCompartmentChunkEmbeddings,
|
|
63
|
+
warmCompartmentChunkSearchPool2 as warmCompartmentChunkSearchPool
|
|
64
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ensureMemoryEmbeddings2
|
|
3
|
+
} from "./index-b8am7tns.js";
|
|
4
|
+
import"./index-v2epyzbm.js";
|
|
5
|
+
import"./index-9p40dgkm.js";
|
|
6
|
+
import"./index-yhzhdp3m.js";
|
|
7
|
+
import"./index-qerzchrs.js";
|
|
8
|
+
import"./index-5n5zxs8e.js";
|
|
9
|
+
import"./index-e19qtjj0.js";
|
|
10
|
+
import"./index-jxjr7kz9.js";
|
|
11
|
+
import"./index-bxmf4dhr.js";
|
|
12
|
+
import"./index-p63nwn5v.js";
|
|
13
|
+
import"./index-rgfb753z.js";
|
|
14
|
+
import"./index-rfyvax95.js";
|
|
15
|
+
import"./index-399p688g.js";
|
|
16
|
+
import"./index-hqw0rt9k.js";
|
|
17
|
+
import"./index-my0dn413.js";
|
|
18
|
+
import"./index-hws5f0z9.js";
|
|
19
|
+
import"./index-fgs78jyd.js";
|
|
20
|
+
import"./index-0h2mkab2.js";
|
|
21
|
+
import"./index-54wmg4rj.js";
|
|
22
|
+
export {
|
|
23
|
+
ensureMemoryEmbeddings2 as ensureMemoryEmbeddings
|
|
24
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import"./index-0h2mkab2.js";
|
|
2
2
|
import {
|
|
3
3
|
log2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-fgs78jyd.js";
|
|
5
5
|
import {
|
|
6
6
|
inRootAsyncContext2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-hws5f0z9.js";
|
|
8
8
|
|
|
9
9
|
// ../plugin/src/features/magic-context/memory/embedding-worker-process.ts
|
|
10
10
|
import { Worker } from "node:worker_threads";
|
package/dist/embedding-worker.js
CHANGED
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
} from "./index-0h2mkab2.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-fgs78jyd.js";
|
|
7
7
|
import"./index-bxmf4dhr.js";
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
10
|
-
import"./index-
|
|
8
|
+
import"./index-jxjr7kz9.js";
|
|
9
|
+
import"./index-my0dn413.js";
|
|
10
|
+
import"./index-hws5f0z9.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveLocalEmbeddingWorkerRuntime,
|
|
13
13
|
getLocalEmbeddingNativeMemoryStats,
|
|
14
14
|
LocalEmbeddingProvider
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-e19qtjj0.js";
|
|
16
16
|
import {
|
|
17
17
|
setStoragePrivatePermissionEnforcement
|
|
18
18
|
} from "./index-81nthk8j.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./index-fa485mqs.js";
|
|
11
11
|
import"./index-4knyh1kt.js";
|
|
12
12
|
import"./index-6x556c2q.js";
|
|
13
|
-
import"./index-
|
|
13
|
+
import"./index-fgs78jyd.js";
|
|
14
14
|
import"./index-0h2mkab2.js";
|
|
15
15
|
export {
|
|
16
16
|
HISTORIAN_CACHE_TAIL_ENV2 as HISTORIAN_CACHE_TAIL_ENV,
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// ../plugin/src/shared/worker-shutdown.ts
|
|
2
|
+
var WORKER_CLOSE_MESSAGE = { kind: "close" };
|
|
3
|
+
function isWorkerCloseMessage(message) {
|
|
4
|
+
return typeof message === "object" && message !== null && message.kind === WORKER_CLOSE_MESSAGE.kind;
|
|
5
|
+
}
|
|
6
|
+
function exitOnWorkerClose(port, closeConnections) {
|
|
7
|
+
const listener = (message) => {
|
|
8
|
+
if (!isWorkerCloseMessage(message))
|
|
9
|
+
return;
|
|
10
|
+
try {
|
|
11
|
+
closeConnections();
|
|
12
|
+
} finally {
|
|
13
|
+
process.exit(0);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
if (!port)
|
|
17
|
+
return { closePort() {} };
|
|
18
|
+
port.on("message", listener);
|
|
19
|
+
let closed = false;
|
|
20
|
+
return {
|
|
21
|
+
closePort() {
|
|
22
|
+
if (closed)
|
|
23
|
+
return;
|
|
24
|
+
closed = true;
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
port.off("message", listener);
|
|
27
|
+
port.close();
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var outcomes = new Map;
|
|
33
|
+
function createWorkerShutdown(worker, site, deadlineMs) {
|
|
34
|
+
let exited = false;
|
|
35
|
+
let forced = false;
|
|
36
|
+
let closing;
|
|
37
|
+
const exit = new Promise((resolve) => {
|
|
38
|
+
worker.once("exit", () => {
|
|
39
|
+
exited = true;
|
|
40
|
+
resolve();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
const record = () => {
|
|
44
|
+
const counts = outcomes.get(site) ?? { graceful: 0, forced: 0 };
|
|
45
|
+
if (forced)
|
|
46
|
+
counts.forced += 1;
|
|
47
|
+
else
|
|
48
|
+
counts.graceful += 1;
|
|
49
|
+
outcomes.set(site, counts);
|
|
50
|
+
};
|
|
51
|
+
const terminate = () => {
|
|
52
|
+
forced = true;
|
|
53
|
+
worker.terminate().catch(() => {});
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
close() {
|
|
57
|
+
if (closing)
|
|
58
|
+
return closing;
|
|
59
|
+
if (exited) {
|
|
60
|
+
closing = Promise.resolve();
|
|
61
|
+
return closing;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
worker.postMessage(WORKER_CLOSE_MESSAGE);
|
|
65
|
+
} catch {
|
|
66
|
+
terminate();
|
|
67
|
+
}
|
|
68
|
+
const fallback = setTimeout(() => {
|
|
69
|
+
if (!exited)
|
|
70
|
+
terminate();
|
|
71
|
+
}, deadlineMs);
|
|
72
|
+
fallback.unref?.();
|
|
73
|
+
closing = exit.then(() => {
|
|
74
|
+
clearTimeout(fallback);
|
|
75
|
+
record();
|
|
76
|
+
});
|
|
77
|
+
return closing;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { isWorkerCloseMessage, exitOnWorkerClose, createWorkerShutdown };
|