@cortexkit/pi-magic-context 0.49.38 → 0.49.40
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 +1 -1
- package/dist/{index-gqk9c626.js → index-g2j58qpq.js} +12 -6
- package/dist/{index-kj49vs41.js → index-j0h89gxy.js} +34 -1
- package/dist/{index-gxqmh9hq.js → index-k0csz6pb.js} +2 -2
- package/dist/{index-jnk24gvd.js → index-rtg4a0sg.js} +2 -2
- package/dist/index.js +5 -5
- package/dist/{message-index-bounded-82sergz7.js → message-index-bounded-39z2atfj.js} +1 -1
- package/dist/raw-ordinal-warmup-worker.js +3 -3
- package/dist/{render-2wan3bfh.js → render-6bhqgkpq.js} +1 -1
- package/dist/{search-t0pz6p13.js → search-45wknkb6.js} +2 -2
- package/dist/{search-archive-pgrv04gv.js → search-archive-yvdq2nfp.js} +1 -1
- package/dist/subagent-entry.js +4 -4
- package/dist/{v2-archive-reader-5zpj8hrg.js → v2-archive-reader-bd94n954.js} +1 -1
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ serveWorkerJobs(async (initial, port) => {
|
|
|
31
31
|
import("./embedding-cache-7rp4gqzr.js"),
|
|
32
32
|
import("./storage-memory-0ndn65fm.js"),
|
|
33
33
|
import("./project-embedding-registry-16pj4vyf.js"),
|
|
34
|
-
import("./search-
|
|
34
|
+
import("./search-45wknkb6.js"),
|
|
35
35
|
import("./compartment-chunk-embedding-jpcme6tz.js"),
|
|
36
36
|
import("./embedding-activity-ew6dshfd.js"),
|
|
37
37
|
import("./harness-9872e0ym.js"),
|
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
} from "./index-29nw7n1r.js";
|
|
81
81
|
import {
|
|
82
82
|
cleanSearchText,
|
|
83
|
-
|
|
83
|
+
hintKeywordRelevance,
|
|
84
84
|
matchedSearchSnippet,
|
|
85
85
|
getMessageIndexSourceIdentity,
|
|
86
86
|
isMessageIndexSourceCurrent,
|
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
clearIndexedMessages,
|
|
92
92
|
indexSingleMessage,
|
|
93
93
|
indexMessagesAfterOrdinal
|
|
94
|
-
} from "./index-
|
|
94
|
+
} from "./index-j0h89gxy.js";
|
|
95
95
|
import {
|
|
96
96
|
MESSAGE_FTS_SESSION_FILTER_SQL,
|
|
97
97
|
withMessageFtsSessionFilter
|
|
@@ -1697,6 +1697,11 @@ function invalidateIncrementalWork(sessionId) {
|
|
|
1697
1697
|
}
|
|
1698
1698
|
|
|
1699
1699
|
// ../plugin/src/features/magic-context/auto-search-diagnostics.ts
|
|
1700
|
+
var memoryHintContent = new WeakMap;
|
|
1701
|
+
function withMemoryHintContent(result, fullContent) {
|
|
1702
|
+
memoryHintContent.set(result, fullContent);
|
|
1703
|
+
return result;
|
|
1704
|
+
}
|
|
1700
1705
|
function createAutoSearchDiagnostics(threshold) {
|
|
1701
1706
|
return {
|
|
1702
1707
|
threshold,
|
|
@@ -1708,9 +1713,10 @@ function createAutoSearchDiagnostics(threshold) {
|
|
|
1708
1713
|
};
|
|
1709
1714
|
}
|
|
1710
1715
|
function autoSearchRelevance(query, result) {
|
|
1711
|
-
|
|
1716
|
+
const content = result.source === "memory" ? memoryHintContent.get(result) ?? result.content : result.source === "compartment" ? result.title : result.content;
|
|
1717
|
+
if (cleanSearchText(content).length === 0)
|
|
1712
1718
|
return 0;
|
|
1713
|
-
return result.source === "message" || "matchType" in result && result.source !== "compartment" && result.matchType !== "semantic" ?
|
|
1719
|
+
return result.source === "message" || "matchType" in result && result.source !== "compartment" && result.matchType !== "semantic" ? hintKeywordRelevance(query, content) : result.score;
|
|
1714
1720
|
}
|
|
1715
1721
|
function recordAutoSearchLane(diagnostics, lane, query, results) {
|
|
1716
1722
|
if (!diagnostics)
|
|
@@ -2674,7 +2680,7 @@ function mergeMemoryResults(args) {
|
|
|
2674
2680
|
suppressedVisibleIds.push(id);
|
|
2675
2681
|
continue;
|
|
2676
2682
|
}
|
|
2677
|
-
results.push({
|
|
2683
|
+
results.push(withMemoryHintContent({
|
|
2678
2684
|
source: "memory",
|
|
2679
2685
|
content: previewText(memory.content),
|
|
2680
2686
|
score,
|
|
@@ -2682,7 +2688,7 @@ function mergeMemoryResults(args) {
|
|
|
2682
2688
|
category: memory.category,
|
|
2683
2689
|
matchType,
|
|
2684
2690
|
sourceName: args.sourceNameByMemoryId?.get(memory.id)
|
|
2685
|
-
});
|
|
2691
|
+
}, memory.content));
|
|
2686
2692
|
}
|
|
2687
2693
|
return {
|
|
2688
2694
|
results: results.sort((left, right) => {
|
|
@@ -66,6 +66,39 @@ function keywordRelevance(query, content) {
|
|
|
66
66
|
const words = new Set(terms(cleanSearchText(content)));
|
|
67
67
|
return 0.8 * needles.filter((term) => words.has(term)).length / needles.length;
|
|
68
68
|
}
|
|
69
|
+
var CJK_RUN = /^[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]+$/u;
|
|
70
|
+
var CJK_RUN_SPLIT = /([\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]+)/u;
|
|
71
|
+
function hintTerms(text) {
|
|
72
|
+
return [
|
|
73
|
+
...new Set(terms(text).flatMap((term) => term.split(CJK_RUN_SPLIT)).filter((term) => term.length > 0 && !QUERY_STOP_WORDS.has(term)))
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
function characterBigrams(run) {
|
|
77
|
+
const characters = [...run];
|
|
78
|
+
return characters.length === 1 ? characters : characters.slice(1).map((character, index) => characters[index] + character);
|
|
79
|
+
}
|
|
80
|
+
function hintKeywordRelevance(query, content) {
|
|
81
|
+
const needles = hintTerms(query);
|
|
82
|
+
if (needles.length === 0)
|
|
83
|
+
return 0;
|
|
84
|
+
const words = new Set(hintTerms(cleanSearchText(content)));
|
|
85
|
+
const runs = [...words].filter((word) => CJK_RUN.test(word));
|
|
86
|
+
const bigrams = new Set(runs.flatMap(characterBigrams));
|
|
87
|
+
let matched = 0;
|
|
88
|
+
for (const needle of needles) {
|
|
89
|
+
if (!CJK_RUN.test(needle)) {
|
|
90
|
+
matched += Number(words.has(needle));
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const grams = characterBigrams(needle);
|
|
94
|
+
if ([...needle].length === 1) {
|
|
95
|
+
matched += Number(runs.some((run) => run.includes(needle)));
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
matched += Math.min(1, grams.filter((gram) => bigrams.has(gram)).length / Math.ceil(grams.length / 2));
|
|
99
|
+
}
|
|
100
|
+
return 0.8 * matched / needles.length;
|
|
101
|
+
}
|
|
69
102
|
function matchedSearchSnippet(content, query, cap = 220) {
|
|
70
103
|
const text = cleanSearchText(content);
|
|
71
104
|
const needles = new Set(terms(query));
|
|
@@ -546,4 +579,4 @@ function indexItemsAfterOrdinal(db, sessionId, items, finalWatermark, toSource)
|
|
|
546
579
|
return inserted;
|
|
547
580
|
}
|
|
548
581
|
|
|
549
|
-
export { clearCompressionDepth, clearCompressionDepthRange, cleanSearchText,
|
|
582
|
+
export { clearCompressionDepth, clearCompressionDepthRange, cleanSearchText, hintKeywordRelevance, matchedSearchSnippet, MESSAGE_INDEX_MAX_FTS_BYTES, messageIndexSkipKey, getMessageIndexSourceIdentity, isMessageIndexSourceCurrent, getLastIndexedOrdinal, getIndexedMessageCorpusSize, markMessageIndexDirty, getMessageIndexReconciliationStartOrdinal, isMessageIndexReconciledThrough, clearIndexedMessages, getIndexableContent, indexSingleMessage, indexMessagesAfterOrdinal };
|
|
@@ -140,8 +140,8 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
140
140
|
import("./store-reader-2m80zs5z.js"),
|
|
141
141
|
import("./store-v60q7dje.js"),
|
|
142
142
|
import("./read-session-chunk-jxq427v6.js"),
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
143
|
+
import("./render-6bhqgkpq.js"),
|
|
144
|
+
import("./search-archive-yvdq2nfp.js"),
|
|
145
145
|
import("./expand-attachments-8sxeyj26.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
} from "./index-p9jfa33t.js";
|
|
74
74
|
import {
|
|
75
75
|
getLastIndexedOrdinal
|
|
76
|
-
} from "./index-
|
|
76
|
+
} from "./index-j0h89gxy.js";
|
|
77
77
|
import {
|
|
78
78
|
setNoteLastReadAt,
|
|
79
79
|
getPersistedCompactionMarkerState,
|
|
@@ -133,7 +133,7 @@ import {
|
|
|
133
133
|
resolveMemoriesByIdsForSearch2,
|
|
134
134
|
unifiedSearch2,
|
|
135
135
|
formatSearchResults2
|
|
136
|
-
} from "./index-
|
|
136
|
+
} from "./index-g2j58qpq.js";
|
|
137
137
|
import {
|
|
138
138
|
TODO_STATUSES,
|
|
139
139
|
TODO_PRIORITIES,
|
package/dist/index.js
CHANGED
|
@@ -150,7 +150,7 @@ import {
|
|
|
150
150
|
registerTodoStateLifecycle,
|
|
151
151
|
syncCtxMemoryToolEnabled,
|
|
152
152
|
registerMagicContextTools
|
|
153
|
-
} from "./index-
|
|
153
|
+
} from "./index-rtg4a0sg.js";
|
|
154
154
|
import"./index-4knyh1kt.js";
|
|
155
155
|
import {
|
|
156
156
|
canonicalModelIdentity,
|
|
@@ -665,7 +665,7 @@ import {
|
|
|
665
665
|
clearCompressionDepthRange,
|
|
666
666
|
cleanSearchText,
|
|
667
667
|
matchedSearchSnippet
|
|
668
|
-
} from "./index-
|
|
668
|
+
} from "./index-j0h89gxy.js";
|
|
669
669
|
import {
|
|
670
670
|
rememberV1HiddenRun
|
|
671
671
|
} from "./index-6x556c2q.js";
|
|
@@ -797,7 +797,7 @@ import {
|
|
|
797
797
|
scheduleClearAndReindex,
|
|
798
798
|
clearSessionTracking,
|
|
799
799
|
createAutoSearchDiagnostics
|
|
800
|
-
} from "./index-
|
|
800
|
+
} from "./index-g2j58qpq.js";
|
|
801
801
|
import"./index-y90fxz4t.js";
|
|
802
802
|
import {
|
|
803
803
|
DREAMER_PRIMER_INVESTIGATOR_ALLOWED_TOOLS,
|
|
@@ -828,7 +828,7 @@ import {
|
|
|
828
828
|
} from "./index-wwsfevck.js";
|
|
829
829
|
import"./index-cq71g4dk.js";
|
|
830
830
|
import"./index-1cvyaw9a.js";
|
|
831
|
-
import"./index-
|
|
831
|
+
import"./index-k0csz6pb.js";
|
|
832
832
|
import"./index-ry84c8dr.js";
|
|
833
833
|
import {
|
|
834
834
|
__toESM
|
|
@@ -3584,7 +3584,7 @@ function startHostStallProfilerSwitch() {
|
|
|
3584
3584
|
// package.json
|
|
3585
3585
|
var package_default = {
|
|
3586
3586
|
name: "@cortexkit/pi-magic-context",
|
|
3587
|
-
version: "0.49.
|
|
3587
|
+
version: "0.49.40",
|
|
3588
3588
|
type: "module",
|
|
3589
3589
|
description: "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
|
|
3590
3590
|
main: "dist/index.js",
|
|
@@ -19,7 +19,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
19
19
|
await main();
|
|
20
20
|
async function main() {
|
|
21
21
|
if (input.v2ArchiveReader) {
|
|
22
|
-
const { serveV2ArchiveReads } = await import("./v2-archive-reader-
|
|
22
|
+
const { serveV2ArchiveReads } = await import("./v2-archive-reader-bd94n954.js");
|
|
23
23
|
await serveV2ArchiveReads(port, openConnections);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -51,7 +51,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
51
51
|
await runMessageFtsRowidMapBackfill(db);
|
|
52
52
|
reply = { kind: "fts-rowid-backfill" };
|
|
53
53
|
} else if (input.searchArchive) {
|
|
54
|
-
const { renderSearchArchive } = await import("./search-archive-
|
|
54
|
+
const { renderSearchArchive } = await import("./search-archive-yvdq2nfp.js");
|
|
55
55
|
const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-a9ntjqap.js");
|
|
56
56
|
const archive = input.searchArchive;
|
|
57
57
|
let raw;
|
|
@@ -81,7 +81,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
81
81
|
const { setHarness } = await import("./harness-9872e0ym.js");
|
|
82
82
|
setHarness(input.harness ?? "opencode");
|
|
83
83
|
const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
|
|
84
|
-
import("./message-index-bounded-
|
|
84
|
+
import("./message-index-bounded-39z2atfj.js"),
|
|
85
85
|
import("./sqlite-context-pragmas-gcgch6qz.js")
|
|
86
86
|
]);
|
|
87
87
|
configureContextDatabasePragmas(db);
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
resolveMemoriesByIdsForSearch2,
|
|
6
6
|
unifiedSearch2,
|
|
7
7
|
formatSearchResults2
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-g2j58qpq.js";
|
|
9
9
|
import"./index-w26zvs1q.js";
|
|
10
|
-
import"./index-
|
|
10
|
+
import"./index-j0h89gxy.js";
|
|
11
11
|
import"./index-1cvyaw9a.js";
|
|
12
12
|
import"./index-jbkwszd5.js";
|
|
13
13
|
import"./index-29nw7n1r.js";
|
package/dist/subagent-entry.js
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
ensureProjectRegisteredFromPiDirectory,
|
|
35
35
|
resolvePiHarnessKind,
|
|
36
36
|
registerMagicContextTools
|
|
37
|
-
} from "./index-
|
|
37
|
+
} from "./index-rtg4a0sg.js";
|
|
38
38
|
import"./index-ccanzg8p.js";
|
|
39
39
|
import"./index-rzfr7wdv.js";
|
|
40
40
|
import"./index-f9qet7y8.js";
|
|
@@ -46,16 +46,16 @@ import"./index-mp0gh04g.js";
|
|
|
46
46
|
import"./index-yhzhdp3m.js";
|
|
47
47
|
import"./index-jbkwszd5.js";
|
|
48
48
|
import"./index-p9jfa33t.js";
|
|
49
|
-
import"./index-
|
|
49
|
+
import"./index-j0h89gxy.js";
|
|
50
50
|
import"./index-pwp6zyx3.js";
|
|
51
51
|
import"./index-6x556c2q.js";
|
|
52
52
|
import"./index-ea37qn4x.js";
|
|
53
53
|
import"./index-w26zvs1q.js";
|
|
54
54
|
import"./index-1cvyaw9a.js";
|
|
55
|
-
import"./index-
|
|
55
|
+
import"./index-k0csz6pb.js";
|
|
56
56
|
import"./index-ry84c8dr.js";
|
|
57
57
|
import"./index-29nw7n1r.js";
|
|
58
|
-
import"./index-
|
|
58
|
+
import"./index-g2j58qpq.js";
|
|
59
59
|
import"./index-y90fxz4t.js";
|
|
60
60
|
import"./index-0wtm7g7f.js";
|
|
61
61
|
import {
|
package/package.json
CHANGED