@cortexkit/pi-magic-context 0.49.20 → 0.49.21
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 +6 -6
- package/dist/chunk-embedding-write-worker.js +9 -9
- package/dist/{compaction-marker-candidates-fnm47jat.js → compaction-marker-candidates-p1kqkqhq.js} +2 -2
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/{compartment-chunk-embedding-81qesfjs.js → compartment-chunk-embedding-y01m95c2.js} +5 -5
- package/dist/{embedding-backfill-56e871c6.js → embedding-backfill-2vh6m3bg.js} +11 -11
- package/dist/embedding-worker-process.js +1 -1
- package/dist/embedding-worker.js +4 -4
- package/dist/{index-dzem6gn9.js → index-29nw7n1r.js} +1 -1
- package/dist/{index-hws5f0z9.js → index-2qtx0q6h.js} +213 -4
- package/dist/{index-5vgt1zeh.js → index-3c3ztwgc.js} +2 -2
- package/dist/{index-rgfb753z.js → index-579m1751.js} +2 -2
- package/dist/{index-kqb3d8bs.js → index-5j6vwg4z.js} +148 -11
- package/dist/{index-6kb2xpw7.js → index-6wdwv3a6.js} +1 -1
- package/dist/{index-rfyvax95.js → index-at6py2k3.js} +1 -1
- package/dist/{index-bxmf4dhr.js → index-ccanzg8p.js} +2367 -1243
- package/dist/{index-mtvvhcw4.js → index-dbgg6hsf.js} +24 -10
- package/dist/{index-af9t637y.js → index-ftvm2acc.js} +121 -38
- package/dist/{index-zhwwp8zz.js → index-gqjxy2p7.js} +14 -4
- package/dist/{index-jxjr7kz9.js → index-gwxaz0z5.js} +2 -4
- package/dist/{index-p63nwn5v.js → index-hxp6q5f8.js} +1 -1
- package/dist/{index-qerzchrs.js → index-j3pz3a1b.js} +1 -1
- package/dist/{index-bttctq07.js → index-n8e5e9fp.js} +6 -3
- package/dist/{index-b8am7tns.js → index-pe5gz5c4.js} +4 -4
- package/dist/{index-tb3d9trm.js → index-st4gwt64.js} +1 -1
- package/dist/{index-5n5zxs8e.js → index-vx6f7wff.js} +2 -2
- package/dist/{index-v2epyzbm.js → index-w1twp2kp.js} +9 -7
- package/dist/{index-jt0g3hn0.js → index-w6r3ggnp.js} +35 -17
- package/dist/{index-vdy273xw.js → index-wgmhk91m.js} +10 -4
- package/dist/{index-e19qtjj0.js → index-wqpjhx1p.js} +35 -4
- package/dist/index.js +224 -206
- package/dist/{message-fts-rowid-map-bpexnsdj.js → message-fts-rowid-map-59y476bk.js} +3 -3
- package/dist/{message-index-mvag9crh.js → message-index-3snxf11x.js} +9 -9
- package/dist/{message-index-bounded-d4r3weh0.js → message-index-bounded-4ngt600v.js} +9 -9
- package/dist/{message-time-backfill-kc10yrcj.js → message-time-backfill-e3r8ddh1.js} +1 -1
- package/dist/migration-worker.js +6 -6
- package/dist/{project-embedding-registry-cfrg952x.js → project-embedding-registry-hfyzs654.js} +10 -10
- package/dist/raw-ordinal-warmup-worker.js +8 -8
- package/dist/{read-session-chunk-7g4zvpd8.js → read-session-chunk-5dmc77q2.js} +5 -5
- package/dist/{read-session-raw-0fsjh10f.js → read-session-raw-yxv2fv34.js} +2 -2
- package/dist/{search-archive-qbhp7e89.js → search-archive-3daj5ttc.js} +6 -6
- package/dist/{search-hp4g3g9v.js → search-jhfh3tsj.js} +17 -17
- package/dist/{sqlite-d67n6dtr.js → sqlite-v89bj0yy.js} +7 -1
- package/dist/{storage-memory-9g882j7a.js → storage-memory-0ndn65fm.js} +2 -2
- package/dist/{storage-tags-m2qcp1g2.js → storage-tags-r48vxthe.js} +2 -2
- package/dist/subagent-entry.js +22 -21
- package/dist/tag-snapshot-worker-pi.js +8 -8
- package/package.json +5 -2
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
PER_HARNESS_MODEL_KEYS,
|
|
31
31
|
ConfigProfilesSchema,
|
|
32
32
|
MagicContextConfigSchema
|
|
33
|
-
} from "./index-
|
|
33
|
+
} from "./index-ccanzg8p.js";
|
|
34
34
|
import {
|
|
35
35
|
MERGED_REASONING_PARTS_PREFIX,
|
|
36
36
|
decodeMergedReasoningParts,
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
visitRawSessionMessages2,
|
|
68
68
|
readRawSessionMessageById2,
|
|
69
69
|
readSessionChunk2
|
|
70
|
-
} from "./index-
|
|
70
|
+
} from "./index-gqjxy2p7.js";
|
|
71
71
|
import {
|
|
72
72
|
isRecord,
|
|
73
73
|
providerVisibleMessage,
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
getTagNumberByMessageId2,
|
|
82
82
|
getTagsBySession2,
|
|
83
83
|
getTagById2
|
|
84
|
-
} from "./index-
|
|
84
|
+
} from "./index-n8e5e9fp.js";
|
|
85
85
|
import {
|
|
86
86
|
estimateTokens
|
|
87
87
|
} from "./index-my0dn413.js";
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
Database2,
|
|
91
91
|
withSqliteBackgroundWriter2,
|
|
92
92
|
withoutSqliteTransformPass2
|
|
93
|
-
} from "./index-
|
|
93
|
+
} from "./index-2qtx0q6h.js";
|
|
94
94
|
import {
|
|
95
95
|
stableStringify,
|
|
96
96
|
closeQuietly,
|
|
@@ -109,21 +109,21 @@ import {
|
|
|
109
109
|
V2StoreReader,
|
|
110
110
|
deleteSessionScopedRows,
|
|
111
111
|
getLastIndexedOrdinal2
|
|
112
|
-
} from "./index-
|
|
112
|
+
} from "./index-wgmhk91m.js";
|
|
113
113
|
import {
|
|
114
114
|
resolveOpenCodeDbPath,
|
|
115
115
|
assertOpenCodeStoreGeneration
|
|
116
116
|
} from "./index-8976mezv.js";
|
|
117
117
|
import {
|
|
118
118
|
noteRawSessionSummaryRowWritten2
|
|
119
|
-
} from "./index-
|
|
119
|
+
} from "./index-at6py2k3.js";
|
|
120
120
|
import {
|
|
121
121
|
SubcClient,
|
|
122
122
|
connectionFileExists,
|
|
123
123
|
SYNAPSE_DEFAULT_MODEL,
|
|
124
124
|
toSynapseLaneDescriptor,
|
|
125
125
|
SynapseEmbeddingProvider
|
|
126
|
-
} from "./index-
|
|
126
|
+
} from "./index-gwxaz0z5.js";
|
|
127
127
|
import {
|
|
128
128
|
invalidateAutoEmbedSession,
|
|
129
129
|
drainBackgroundBatches,
|
|
@@ -136,10 +136,10 @@ import {
|
|
|
136
136
|
unregisterProjectEmbedding2,
|
|
137
137
|
getProjectEmbeddingSnapshot2,
|
|
138
138
|
embedTextForProject2
|
|
139
|
-
} from "./index-
|
|
139
|
+
} from "./index-w1twp2kp.js";
|
|
140
140
|
import {
|
|
141
141
|
getErrorMessage
|
|
142
|
-
} from "./index-
|
|
142
|
+
} from "./index-dbgg6hsf.js";
|
|
143
143
|
import {
|
|
144
144
|
V2_MEMORY_CATEGORIES,
|
|
145
145
|
CATEGORY_PRIORITY,
|
|
@@ -153,13 +153,13 @@ import {
|
|
|
153
153
|
expandWorkspaceIdentitySetWithAliases,
|
|
154
154
|
resolveStoredPathWorkspaceIdentity,
|
|
155
155
|
storedPathBelongsToWorkspace
|
|
156
|
-
} from "./index-
|
|
156
|
+
} from "./index-3c3ztwgc.js";
|
|
157
157
|
import {
|
|
158
158
|
directoryHasGitMetadata,
|
|
159
159
|
resolveProjectIdentityForSession,
|
|
160
160
|
normalizeStoredProjectPath,
|
|
161
161
|
storedPathBelongsToIdentity
|
|
162
|
-
} from "./index-
|
|
162
|
+
} from "./index-hxp6q5f8.js";
|
|
163
163
|
import {
|
|
164
164
|
getNoteByIdInScope,
|
|
165
165
|
getNotes,
|
|
@@ -175,7 +175,7 @@ import {
|
|
|
175
175
|
resolveMemoriesByIdsForSearch2,
|
|
176
176
|
unifiedSearch2,
|
|
177
177
|
formatSearchResults2
|
|
178
|
-
} from "./index-
|
|
178
|
+
} from "./index-ftvm2acc.js";
|
|
179
179
|
import {
|
|
180
180
|
computeCueContentHash,
|
|
181
181
|
getMuralCueState,
|
|
@@ -191,22 +191,22 @@ import {
|
|
|
191
191
|
supersededMemory2,
|
|
192
192
|
mergeMemoryStats2,
|
|
193
193
|
archiveMemory2
|
|
194
|
-
} from "./index-
|
|
194
|
+
} from "./index-29nw7n1r.js";
|
|
195
195
|
import {
|
|
196
196
|
saveEmbedding,
|
|
197
197
|
invalidateMemory2
|
|
198
198
|
} from "./index-yhzhdp3m.js";
|
|
199
199
|
import {
|
|
200
200
|
preflightLocalEmbeddingPooling
|
|
201
|
-
} from "./index-
|
|
201
|
+
} from "./index-wqpjhx1p.js";
|
|
202
202
|
import {
|
|
203
203
|
isMarkerCandidateBasisCurrent2,
|
|
204
204
|
invalidateMarkerCandidateBasis2,
|
|
205
205
|
readMarkerCandidateBasis2
|
|
206
|
-
} from "./index-
|
|
206
|
+
} from "./index-6wdwv3a6.js";
|
|
207
207
|
import {
|
|
208
208
|
renderSearchArchive2
|
|
209
|
-
} from "./index-
|
|
209
|
+
} from "./index-st4gwt64.js";
|
|
210
210
|
import {
|
|
211
211
|
computeNormalizedHash
|
|
212
212
|
} from "./index-9x1f96r8.js";
|
|
@@ -1946,6 +1946,17 @@ function stripUnsafeProjectConfigFields(projectRaw) {
|
|
|
1946
1946
|
warnings.push(`Ignoring ${field} from project config (security: daemon routing and developer-only embedding traffic are user-level settings).`);
|
|
1947
1947
|
}
|
|
1948
1948
|
}
|
|
1949
|
+
if ("rerank" in projectRaw) {
|
|
1950
|
+
const rerank = projectRaw.rerank;
|
|
1951
|
+
const off = isPlainObject(rerank) && rerank.provider === "off";
|
|
1952
|
+
const removed = !isPlainObject(rerank) || Object.keys(rerank).some((key) => key !== "provider") || !off;
|
|
1953
|
+
if (off)
|
|
1954
|
+
projectRaw.rerank = { provider: "off" };
|
|
1955
|
+
else
|
|
1956
|
+
delete projectRaw.rerank;
|
|
1957
|
+
if (removed)
|
|
1958
|
+
warnings.push("Ignoring rerank settings from project config (security: projects may only set rerank.provider to off; hosted routing, credentials and limits are user-level only).");
|
|
1959
|
+
}
|
|
1949
1960
|
const embedding = projectRaw.embedding;
|
|
1950
1961
|
if (isPlainObject(embedding)) {
|
|
1951
1962
|
const removed = [];
|
|
@@ -12966,6 +12977,7 @@ function createCtxSearchTool(deps) {
|
|
|
12966
12977
|
};
|
|
12967
12978
|
}
|
|
12968
12979
|
}
|
|
12980
|
+
let rerankSkipped = "";
|
|
12969
12981
|
const results = await unifiedSearch2(deps.db, sessionId, projectIdentity, query, {
|
|
12970
12982
|
limit: normalizeLimit2(params.limit),
|
|
12971
12983
|
memoryEnabled,
|
|
@@ -12983,14 +12995,19 @@ function createCtxSearchTool(deps) {
|
|
|
12983
12995
|
gitRepositoryAvailable: directoryHasGitMetadata(ctx.cwd),
|
|
12984
12996
|
explicitSearch: true,
|
|
12985
12997
|
rerankConnectionFile: deps.rerankConnectionFile,
|
|
12998
|
+
rerankConfig: deps.rerankConfig,
|
|
12986
12999
|
signal,
|
|
13000
|
+
onRerankSkipped: (line) => {
|
|
13001
|
+
rerankSkipped = line;
|
|
13002
|
+
},
|
|
12987
13003
|
...dateRange
|
|
12988
13004
|
});
|
|
12989
13005
|
return {
|
|
12990
13006
|
content: [
|
|
12991
13007
|
{
|
|
12992
13008
|
type: "text",
|
|
12993
|
-
text: formatSearchResults2(query, results, sessionId, diagnostics)
|
|
13009
|
+
text: formatSearchResults2(query, results, sessionId, diagnostics) + (rerankSkipped ? `
|
|
13010
|
+
${rerankSkipped}` : "")
|
|
12994
13011
|
}
|
|
12995
13012
|
],
|
|
12996
13013
|
details: undefined
|
|
@@ -13564,6 +13581,7 @@ function registerMagicContextTools(pi, opts) {
|
|
|
13564
13581
|
embeddingEnabled: opts.embeddingEnabled,
|
|
13565
13582
|
gitCommitsEnabled: opts.gitCommitsEnabled,
|
|
13566
13583
|
rerankConnectionFile: opts.rerankConnectionFile,
|
|
13584
|
+
rerankConfig: opts.rerankConfig,
|
|
13567
13585
|
resolveProjectIdentity
|
|
13568
13586
|
})));
|
|
13569
13587
|
if (opts.memoryToolEnabled !== false) {
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
prepareCachedStatement2,
|
|
19
19
|
withSqliteBackgroundWriter2,
|
|
20
20
|
withoutSqliteTransformPass2
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-2qtx0q6h.js";
|
|
22
22
|
import {
|
|
23
23
|
removeSystemReminders,
|
|
24
24
|
removeNestedBlocks,
|
|
@@ -31,10 +31,10 @@ import {
|
|
|
31
31
|
messageFtsOrdinalRangeIsMapped2,
|
|
32
32
|
getMessageFtsRowidMapBackfillProgress2,
|
|
33
33
|
deleteUnmappedMessageFtsRows2
|
|
34
|
-
} from "./index-
|
|
34
|
+
} from "./index-579m1751.js";
|
|
35
35
|
import {
|
|
36
36
|
deleteChunkEmbedBackoffForSession2
|
|
37
|
-
} from "./index-
|
|
37
|
+
} from "./index-vx6f7wff.js";
|
|
38
38
|
import {
|
|
39
39
|
closeQuietly,
|
|
40
40
|
TAG_TOMBSTONE_OWNER_PREFIX,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
} from "./index-w1avzkdt.js";
|
|
47
47
|
import {
|
|
48
48
|
cleanUserText2
|
|
49
|
-
} from "./index-
|
|
49
|
+
} from "./index-gqjxy2p7.js";
|
|
50
50
|
import {
|
|
51
51
|
sameProjectDirectory
|
|
52
52
|
} from "./index-wrr9rp9a.js";
|
|
@@ -791,6 +791,12 @@ class V2StoreReader {
|
|
|
791
791
|
return typeof row?.count === "number" ? row.count : 0;
|
|
792
792
|
});
|
|
793
793
|
}
|
|
794
|
+
messageCountAfterSequence(sessionID, after, through) {
|
|
795
|
+
const rawTypes = RAW_MESSAGE_TYPES.map(() => "?").join(", ");
|
|
796
|
+
const row = this.prepare(`SELECT COUNT(*) AS count FROM session_message
|
|
797
|
+
WHERE session_id = ? AND seq > ? AND seq <= ? AND type IN (${rawTypes})`).get(sessionID, after, through, ...RAW_MESSAGE_TYPES);
|
|
798
|
+
return typeof row?.count === "number" ? row.count : 0;
|
|
799
|
+
}
|
|
794
800
|
sessionDirectoryPage(afterSessionID, limit) {
|
|
795
801
|
const rows = this.prepare(`SELECT id, COALESCE(directory, '') AS directory FROM session_v2
|
|
796
802
|
WHERE id > ? ORDER BY id ASC LIMIT ?`).all(afterSessionID ?? "", limit);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-ccanzg8p.js";
|
|
4
4
|
import {
|
|
5
5
|
getSynapseLaneIdentity
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-gwxaz0z5.js";
|
|
7
7
|
import {
|
|
8
8
|
getHarness2
|
|
9
9
|
} from "./index-0h2mkab2.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./index-fgs78jyd.js";
|
|
15
15
|
import {
|
|
16
16
|
inRootAsyncContext2
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-2qtx0q6h.js";
|
|
18
18
|
import {
|
|
19
19
|
computeNormalizedHash
|
|
20
20
|
} from "./index-9x1f96r8.js";
|
|
@@ -725,16 +725,20 @@ class EmbeddingWorkerClient {
|
|
|
725
725
|
entry;
|
|
726
726
|
timeoutMs;
|
|
727
727
|
prepareTelemetry;
|
|
728
|
+
idleMs;
|
|
728
729
|
worker = null;
|
|
729
730
|
startPromise = null;
|
|
730
731
|
nextId = 1;
|
|
731
732
|
pending = new Map;
|
|
732
733
|
disposed = false;
|
|
733
|
-
|
|
734
|
+
activeRequests = 0;
|
|
735
|
+
idleTimer = null;
|
|
736
|
+
constructor(data, entry = new URL(new URL(import.meta.url).pathname.endsWith(".ts") ? "./embedding-worker.ts" : "./embedding-worker.js", import.meta.url), timeoutMs = 5 * 60000, prepareTelemetry = prepareNativeOnnxTelemetry, idleMs = 10 * 60000) {
|
|
734
737
|
this.data = data;
|
|
735
738
|
this.entry = entry;
|
|
736
739
|
this.timeoutMs = timeoutMs;
|
|
737
740
|
this.prepareTelemetry = prepareTelemetry;
|
|
741
|
+
this.idleMs = idleMs;
|
|
738
742
|
}
|
|
739
743
|
start() {
|
|
740
744
|
if (this.startPromise)
|
|
@@ -800,6 +804,7 @@ class EmbeddingWorkerClient {
|
|
|
800
804
|
const fail = (error) => {
|
|
801
805
|
if (this.worker !== worker)
|
|
802
806
|
return;
|
|
807
|
+
this.clearIdleTimer();
|
|
803
808
|
this.worker = null;
|
|
804
809
|
for (const request of this.pending.values()) {
|
|
805
810
|
clearTimeout(request.timer);
|
|
@@ -824,6 +829,31 @@ class EmbeddingWorkerClient {
|
|
|
824
829
|
async request(texts, signal) {
|
|
825
830
|
if (signal?.aborted)
|
|
826
831
|
return Promise.reject(new Error("embedding request aborted"));
|
|
832
|
+
this.activeRequests++;
|
|
833
|
+
this.clearIdleTimer();
|
|
834
|
+
try {
|
|
835
|
+
return await this.requestOnWorker(texts, signal);
|
|
836
|
+
} finally {
|
|
837
|
+
this.activeRequests--;
|
|
838
|
+
this.armIdleTimer();
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
clearIdleTimer() {
|
|
842
|
+
if (this.idleTimer)
|
|
843
|
+
clearTimeout(this.idleTimer);
|
|
844
|
+
this.idleTimer = null;
|
|
845
|
+
}
|
|
846
|
+
armIdleTimer() {
|
|
847
|
+
if (this.disposed || this.activeRequests !== 0 || !this.worker)
|
|
848
|
+
return;
|
|
849
|
+
this.clearIdleTimer();
|
|
850
|
+
this.idleTimer = inRootAsyncContext2(() => setTimeout(() => {
|
|
851
|
+
this.idleTimer = null;
|
|
852
|
+
this.stop(new Error("embedding worker idle"));
|
|
853
|
+
}, this.idleMs));
|
|
854
|
+
this.idleTimer.unref();
|
|
855
|
+
}
|
|
856
|
+
async requestOnWorker(texts, signal) {
|
|
827
857
|
const worker = await this.start();
|
|
828
858
|
if (this.disposed)
|
|
829
859
|
throw new Error("embedding worker disposed");
|
|
@@ -875,6 +905,7 @@ class EmbeddingWorkerClient {
|
|
|
875
905
|
});
|
|
876
906
|
}
|
|
877
907
|
async stop(error) {
|
|
908
|
+
this.clearIdleTimer();
|
|
878
909
|
const worker = this.worker;
|
|
879
910
|
this.worker = null;
|
|
880
911
|
for (const request of this.pending.values()) {
|