@cortexkit/pi-magic-context 0.49.53 → 0.49.55
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 +3 -3
- package/dist/chunk-embedding-write-worker.js +3 -4
- package/dist/{embedding-backfill-ad4k8e3f.js → embedding-backfill-qde2zywg.js} +4 -4
- package/dist/embedding-worker.js +2 -2
- package/dist/{index-snrkpmpf.js → index-2pptpxq8.js} +1 -1
- package/dist/{index-8cgk0pyh.js → index-5n3e2gq5.js} +5080 -3919
- package/dist/{index-tv9pqeek.js → index-625kbnqd.js} +5 -7
- package/dist/{index-4cmj48mq.js → index-6ahmfva8.js} +3 -3
- package/dist/{index-nevbaezn.js → index-9kaj9ty1.js} +1 -1
- package/dist/{index-46wk0td0.js → index-awpx91y5.js} +1 -1
- package/dist/{index-1tk6065b.js → index-c3mms4dp.js} +5 -5
- package/dist/{index-zc6fdyx7.js → index-d40ecdbn.js} +1 -1
- package/dist/{index-2yjpxzga.js → index-erkb5dee.js} +2 -2
- package/dist/{index-38pf5bqw.js → index-hec3bwev.js} +1 -1
- package/dist/{index-njd3qa8e.js → index-jnh7a6a3.js} +3 -3
- package/dist/{index-f07s5m8x.js → index-k2z7r444.js} +21 -23
- package/dist/{index-pkg07s54.js → index-nhpvvdhw.js} +2 -2
- package/dist/index-rekymyxd.js +2287 -0
- package/dist/{index-a70dwgff.js → index-tn38he5d.js} +44 -31
- package/dist/{index-jxm4bvm4.js → index-v858d5d1.js} +168 -1
- package/dist/{index-aec63gtj.js → index-vcegxfwg.js} +16 -6
- package/dist/index.js +319 -220
- package/dist/{message-index-bounded-hwatm90p.js → message-index-bounded-ac4qg6aw.js} +5 -6
- package/dist/migration-worker.js +3 -4
- package/dist/{project-embedding-registry-d67axw7r.js → project-embedding-registry-qx2zjbgs.js} +3 -3
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-mj91mv8r.js → read-session-chunk-jyfcykg4.js} +4 -5
- package/dist/{render-js5tkc4g.js → render-bqqx15n8.js} +9 -10
- package/dist/{search-archive-159s0qp9.js → search-archive-31054zxj.js} +6 -7
- package/dist/{search-hyc5s9t0.js → search-w12nc025.js} +11 -12
- package/dist/{storage-tags-ahhwtfdq.js → storage-tags-g0328gwp.js} +4 -2
- package/dist/subagent-entry.js +38 -17
- package/dist/tag-snapshot-worker-pi.js +6 -6
- package/dist/{v2-archive-reader-5sc0rsh9.js → v2-archive-reader-hg4c36em.js} +1 -1
- package/package.json +1 -1
- package/dist/index-674f6qs2.js +0 -16
- package/dist/index-c6wbq66z.js +0 -168
- package/dist/index-qcsjj9m0.js +0 -3412
|
@@ -3,21 +3,20 @@ import {
|
|
|
3
3
|
withIndexChunk2,
|
|
4
4
|
yieldIndexChunk2
|
|
5
5
|
} from "./index-2qtx0q6h.js";
|
|
6
|
-
import"./index-
|
|
6
|
+
import"./index-5n3e2gq5.js";
|
|
7
7
|
import"./index-7y60kyea.js";
|
|
8
8
|
import"./index-0h2mkab2.js";
|
|
9
9
|
import"./index-yxeg8zaa.js";
|
|
10
10
|
import"./index-dnp1jjar.js";
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-
|
|
11
|
+
import"./index-v858d5d1.js";
|
|
12
|
+
import"./index-vcegxfwg.js";
|
|
13
13
|
import"./index-8sqebjzk.js";
|
|
14
14
|
import"./index-wfqysrwq.js";
|
|
15
15
|
import"./index-x2n261wp.js";
|
|
16
16
|
import"./index-szn2tac8.js";
|
|
17
17
|
import"./index-n0zjvs3h.js";
|
|
18
|
-
import"./index-
|
|
18
|
+
import"./index-rekymyxd.js";
|
|
19
19
|
import"./index-6x556c2q.js";
|
|
20
|
-
import"./index-c6wbq66z.js";
|
|
21
20
|
import {
|
|
22
21
|
MESSAGE_INDEX_MAX_FTS_BYTES,
|
|
23
22
|
messageIndexSkipKey,
|
|
@@ -25,7 +24,7 @@ import {
|
|
|
25
24
|
markMessageIndexDirty,
|
|
26
25
|
getIndexableContent,
|
|
27
26
|
indexSingleMessage
|
|
28
|
-
} from "./index-
|
|
27
|
+
} from "./index-2pptpxq8.js";
|
|
29
28
|
import"./index-6d0bby9d.js";
|
|
30
29
|
import"./index-j0eagxkz.js";
|
|
31
30
|
|
package/dist/migration-worker.js
CHANGED
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
import"./index-135e8hvg.js";
|
|
11
11
|
import {
|
|
12
12
|
runMigrationsWithRetry
|
|
13
|
-
} from "./index-
|
|
14
|
-
import"./index-
|
|
13
|
+
} from "./index-d40ecdbn.js";
|
|
14
|
+
import"./index-v858d5d1.js";
|
|
15
15
|
import"./index-n0zjvs3h.js";
|
|
16
16
|
import"./index-xx1911hb.js";
|
|
17
17
|
import {
|
|
18
18
|
setSqlitePragmaConfig,
|
|
19
19
|
initializeDatabase
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-625kbnqd.js";
|
|
21
21
|
import"./index-fapenpch.js";
|
|
22
22
|
import"./index-3bb24eb6.js";
|
|
23
23
|
import"./index-8sqebjzk.js";
|
|
@@ -26,7 +26,6 @@ import"./index-x2n261wp.js";
|
|
|
26
26
|
import"./index-szn2tac8.js";
|
|
27
27
|
import"./index-6d0bby9d.js";
|
|
28
28
|
import"./index-7y60kyea.js";
|
|
29
|
-
import"./index-c6wbq66z.js";
|
|
30
29
|
import {
|
|
31
30
|
closeQuietly
|
|
32
31
|
} from "./index-nrzkqte4.js";
|
package/dist/{project-embedding-registry-d67axw7r.js → project-embedding-registry-qx2zjbgs.js}
RENAMED
|
@@ -34,15 +34,15 @@ import {
|
|
|
34
34
|
sweepAllRegisteredProjects2,
|
|
35
35
|
_setTestProviderFactoryForProject2,
|
|
36
36
|
_resetProjectEmbeddingRegistryForTests2
|
|
37
|
-
} from "./index-
|
|
37
|
+
} from "./index-erkb5dee.js";
|
|
38
38
|
import"./index-9p40dgkm.js";
|
|
39
39
|
import"./index-hgd00nas.js";
|
|
40
40
|
import"./index-yhzhdp3m.js";
|
|
41
41
|
import"./index-zxm7ckvc.js";
|
|
42
42
|
import"./index-ndg15t3x.js";
|
|
43
|
-
import"./index-
|
|
43
|
+
import"./index-hec3bwev.js";
|
|
44
44
|
import"./index-qm139qq2.js";
|
|
45
|
-
import"./index-
|
|
45
|
+
import"./index-vcegxfwg.js";
|
|
46
46
|
import"./index-xx1911hb.js";
|
|
47
47
|
import"./index-6d0bby9d.js";
|
|
48
48
|
import"./index-szn2tac8.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-hg4c36em.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-31054zxj.js");
|
|
55
55
|
const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-75dcxtdy.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-ac4qg6aw.js"),
|
|
85
85
|
import("./sqlite-context-pragmas-gcgch6qz.js")
|
|
86
86
|
]);
|
|
87
87
|
configureContextDatabasePragmas(db);
|
|
@@ -95,7 +95,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
95
95
|
measurements: result.measurements
|
|
96
96
|
};
|
|
97
97
|
} else if (input.tagRatio !== undefined) {
|
|
98
|
-
const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-
|
|
98
|
+
const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-g0328gwp.js");
|
|
99
99
|
const delta = input.tagState ? scanTagOwnerDelta(db, input.sessionId, input.tagState) : null;
|
|
100
100
|
if (delta)
|
|
101
101
|
reply = { kind: "tag-delta", delta };
|
|
@@ -38,12 +38,11 @@ import {
|
|
|
38
38
|
readSessionChunk2,
|
|
39
39
|
getRawSessionMessageIdsThrough2,
|
|
40
40
|
readRawSessionSeedTail2
|
|
41
|
-
} from "./index-
|
|
42
|
-
import"./index-
|
|
41
|
+
} from "./index-rekymyxd.js";
|
|
42
|
+
import"./index-5n3e2gq5.js";
|
|
43
43
|
import"./index-6x556c2q.js";
|
|
44
|
-
import"./index-
|
|
45
|
-
import"./index-
|
|
46
|
-
import"./index-jxm4bvm4.js";
|
|
44
|
+
import"./index-vcegxfwg.js";
|
|
45
|
+
import"./index-v858d5d1.js";
|
|
47
46
|
import"./index-szn2tac8.js";
|
|
48
47
|
import"./index-wfqysrwq.js";
|
|
49
48
|
import"./index-8sqebjzk.js";
|
|
@@ -3,26 +3,25 @@ import {
|
|
|
3
3
|
renderVerboseRange2,
|
|
4
4
|
renderVerboseRangeForTool2,
|
|
5
5
|
renderItemByTag2
|
|
6
|
-
} from "./index-
|
|
7
|
-
import"./index-
|
|
8
|
-
import"./index-
|
|
6
|
+
} from "./index-k2z7r444.js";
|
|
7
|
+
import"./index-awpx91y5.js";
|
|
8
|
+
import"./index-2pptpxq8.js";
|
|
9
9
|
import"./index-hgd00nas.js";
|
|
10
10
|
import"./index-nvh6d3bz.js";
|
|
11
11
|
import"./index-ndg15t3x.js";
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
12
|
+
import"./index-rekymyxd.js";
|
|
13
|
+
import"./index-5n3e2gq5.js";
|
|
14
14
|
import"./index-6x556c2q.js";
|
|
15
15
|
import"./index-qm139qq2.js";
|
|
16
|
-
import"./index-
|
|
17
|
-
import"./index-
|
|
16
|
+
import"./index-vcegxfwg.js";
|
|
17
|
+
import"./index-625kbnqd.js";
|
|
18
18
|
import"./index-fapenpch.js";
|
|
19
|
-
import"./index-
|
|
19
|
+
import"./index-d40ecdbn.js";
|
|
20
20
|
import"./index-135e8hvg.js";
|
|
21
21
|
import"./index-xx1911hb.js";
|
|
22
22
|
import"./index-6d0bby9d.js";
|
|
23
23
|
import"./index-3bb24eb6.js";
|
|
24
|
-
import"./index-
|
|
25
|
-
import"./index-jxm4bvm4.js";
|
|
24
|
+
import"./index-v858d5d1.js";
|
|
26
25
|
import"./index-szn2tac8.js";
|
|
27
26
|
import"./index-wfqysrwq.js";
|
|
28
27
|
import"./index-8sqebjzk.js";
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
renderSearchArchive2
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
3
|
+
} from "./index-9kaj9ty1.js";
|
|
4
|
+
import"./index-6ahmfva8.js";
|
|
5
5
|
import"./index-8d2z6503.js";
|
|
6
|
-
import"./index-
|
|
7
|
-
import"./index-
|
|
6
|
+
import"./index-rekymyxd.js";
|
|
7
|
+
import"./index-5n3e2gq5.js";
|
|
8
8
|
import"./index-6x556c2q.js";
|
|
9
|
-
import"./index-
|
|
10
|
-
import"./index-
|
|
11
|
-
import"./index-jxm4bvm4.js";
|
|
9
|
+
import"./index-vcegxfwg.js";
|
|
10
|
+
import"./index-v858d5d1.js";
|
|
12
11
|
import"./index-szn2tac8.js";
|
|
13
12
|
import"./index-wfqysrwq.js";
|
|
14
13
|
import"./index-8sqebjzk.js";
|
|
@@ -5,30 +5,29 @@ import {
|
|
|
5
5
|
resolveMemoriesByIdsForSearch2,
|
|
6
6
|
unifiedSearch2,
|
|
7
7
|
formatSearchResults2
|
|
8
|
-
} from "./index-
|
|
9
|
-
import"./index-
|
|
10
|
-
import"./index-
|
|
8
|
+
} from "./index-c3mms4dp.js";
|
|
9
|
+
import"./index-awpx91y5.js";
|
|
10
|
+
import"./index-2pptpxq8.js";
|
|
11
11
|
import"./index-8d2z6503.js";
|
|
12
|
-
import"./index-
|
|
12
|
+
import"./index-jnh7a6a3.js";
|
|
13
13
|
import"./index-29nw7n1r.js";
|
|
14
|
-
import"./index-
|
|
14
|
+
import"./index-erkb5dee.js";
|
|
15
15
|
import"./index-9p40dgkm.js";
|
|
16
16
|
import"./index-hgd00nas.js";
|
|
17
17
|
import"./index-yhzhdp3m.js";
|
|
18
18
|
import"./index-zxm7ckvc.js";
|
|
19
19
|
import"./index-ndg15t3x.js";
|
|
20
|
-
import"./index-
|
|
21
|
-
import"./index-
|
|
20
|
+
import"./index-rekymyxd.js";
|
|
21
|
+
import"./index-5n3e2gq5.js";
|
|
22
22
|
import"./index-6x556c2q.js";
|
|
23
|
-
import"./index-
|
|
23
|
+
import"./index-hec3bwev.js";
|
|
24
24
|
import"./index-qm139qq2.js";
|
|
25
|
-
import"./index-
|
|
26
|
-
import"./index-
|
|
25
|
+
import"./index-vcegxfwg.js";
|
|
26
|
+
import"./index-d40ecdbn.js";
|
|
27
27
|
import"./index-135e8hvg.js";
|
|
28
28
|
import"./index-xx1911hb.js";
|
|
29
29
|
import"./index-6d0bby9d.js";
|
|
30
|
-
import"./index-
|
|
31
|
-
import"./index-jxm4bvm4.js";
|
|
30
|
+
import"./index-v858d5d1.js";
|
|
32
31
|
import"./index-szn2tac8.js";
|
|
33
32
|
import"./index-wfqysrwq.js";
|
|
34
33
|
import"./index-8sqebjzk.js";
|
|
@@ -61,8 +61,10 @@ import {
|
|
|
61
61
|
adoptNullOwnerToolTag2,
|
|
62
62
|
getCandidateToolOwners2,
|
|
63
63
|
pickNearestPriorOwner2
|
|
64
|
-
} from "./index-
|
|
65
|
-
import"./index-
|
|
64
|
+
} from "./index-5n3e2gq5.js";
|
|
65
|
+
import"./index-vcegxfwg.js";
|
|
66
|
+
import"./index-v858d5d1.js";
|
|
67
|
+
import"./index-j0eagxkz.js";
|
|
66
68
|
import"./index-7y60kyea.js";
|
|
67
69
|
import"./index-2qtx0q6h.js";
|
|
68
70
|
import"./index-yxeg8zaa.js";
|
package/dist/subagent-entry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TOKEN_BUDGET_TOOL_REFUSAL
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-rekymyxd.js";
|
|
4
4
|
import {
|
|
5
5
|
setHarness2
|
|
6
6
|
} from "./index-0h2mkab2.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import"./index-2qtx0q6h.js";
|
|
15
15
|
import {
|
|
16
16
|
openDatabase
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-625kbnqd.js";
|
|
18
18
|
import"./index-fapenpch.js";
|
|
19
19
|
import"./index-3bb24eb6.js";
|
|
20
20
|
import"./index-8sqebjzk.js";
|
|
@@ -22,40 +22,40 @@ import"./index-wfqysrwq.js";
|
|
|
22
22
|
import"./index-x2n261wp.js";
|
|
23
23
|
import"./index-szn2tac8.js";
|
|
24
24
|
import"./index-6d0bby9d.js";
|
|
25
|
-
import"./index-
|
|
26
|
-
import"./index-
|
|
25
|
+
import"./index-d40ecdbn.js";
|
|
26
|
+
import"./index-v858d5d1.js";
|
|
27
27
|
import"./index-135e8hvg.js";
|
|
28
28
|
import"./index-n0zjvs3h.js";
|
|
29
29
|
import"./index-7y60kyea.js";
|
|
30
|
-
import"./index-c6wbq66z.js";
|
|
31
30
|
import"./index-4knyh1kt.js";
|
|
32
31
|
import {
|
|
33
32
|
loadPiConfig,
|
|
34
33
|
ensureProjectRegisteredFromPiDirectory,
|
|
35
34
|
resolvePiHarnessKind,
|
|
35
|
+
reportSubagentStartupError,
|
|
36
36
|
registerMagicContextTools
|
|
37
|
-
} from "./index-
|
|
38
|
-
import"./index-
|
|
37
|
+
} from "./index-tn38he5d.js";
|
|
38
|
+
import"./index-vcegxfwg.js";
|
|
39
39
|
import"./index-qm139qq2.js";
|
|
40
40
|
import"./index-ndg15t3x.js";
|
|
41
|
-
import"./index-
|
|
42
|
-
import"./index-
|
|
41
|
+
import"./index-hec3bwev.js";
|
|
42
|
+
import"./index-erkb5dee.js";
|
|
43
43
|
import"./index-hgd00nas.js";
|
|
44
44
|
import"./index-9p40dgkm.js";
|
|
45
45
|
import"./index-zxm7ckvc.js";
|
|
46
46
|
import"./index-yhzhdp3m.js";
|
|
47
|
-
import"./index-
|
|
48
|
-
import"./index-
|
|
49
|
-
import"./index-
|
|
50
|
-
import"./index-
|
|
47
|
+
import"./index-jnh7a6a3.js";
|
|
48
|
+
import"./index-k2z7r444.js";
|
|
49
|
+
import"./index-2pptpxq8.js";
|
|
50
|
+
import"./index-5n3e2gq5.js";
|
|
51
51
|
import"./index-6x556c2q.js";
|
|
52
52
|
import"./index-nvh6d3bz.js";
|
|
53
|
-
import"./index-
|
|
53
|
+
import"./index-awpx91y5.js";
|
|
54
54
|
import"./index-8d2z6503.js";
|
|
55
|
-
import"./index-
|
|
56
|
-
import"./index-
|
|
55
|
+
import"./index-6ahmfva8.js";
|
|
56
|
+
import"./index-9kaj9ty1.js";
|
|
57
57
|
import"./index-29nw7n1r.js";
|
|
58
|
-
import"./index-
|
|
58
|
+
import"./index-c3mms4dp.js";
|
|
59
59
|
import"./index-xssjy4z9.js";
|
|
60
60
|
import"./index-j0eagxkz.js";
|
|
61
61
|
import {
|
|
@@ -67,6 +67,24 @@ import { readFileSync } from "node:fs";
|
|
|
67
67
|
var SUBAGENT_DREAMER_ACTIONS_FLAG = "magic-context-dreamer-actions";
|
|
68
68
|
var openedDb;
|
|
69
69
|
function magicContextSubagentExtension(pi) {
|
|
70
|
+
let startupComplete = false;
|
|
71
|
+
let startupError;
|
|
72
|
+
let failureReported = false;
|
|
73
|
+
const reportStartupFailure = async () => {
|
|
74
|
+
if (failureReported)
|
|
75
|
+
return;
|
|
76
|
+
failureReported = true;
|
|
77
|
+
await reportSubagentStartupError(startupError ?? "Magic Context child startup did not complete");
|
|
78
|
+
};
|
|
79
|
+
pi.on("context", async () => {
|
|
80
|
+
if (startupComplete)
|
|
81
|
+
return;
|
|
82
|
+
try {
|
|
83
|
+
await reportStartupFailure();
|
|
84
|
+
} finally {
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
70
88
|
setHarness2(resolvePiHarnessKind());
|
|
71
89
|
pi.registerFlag(SUBAGENT_DREAMER_ACTIONS_FLAG, {
|
|
72
90
|
description: "Register ctx_memory with dreamer actions for Magic Context subagents.",
|
|
@@ -114,10 +132,13 @@ function magicContextSubagentExtension(pi) {
|
|
|
114
132
|
promptSurface: registrationPromptSurface
|
|
115
133
|
});
|
|
116
134
|
log2(`[pi-subagent] registered tools: ctx_search${dreamerActionsEnabled ? ", ctx_memory" : ""}${cfg.todowrite.enabled ? ", todowrite" : ""}` + ` (ctx_note/ctx_expand omitted: --no-session child;` + ` memory=${cfg.memory.enabled}, embedding=${cfg.embedding.provider !== "off"},` + ` git_commits=${cfg.memory.git_commit_indexing.enabled}, dreamer_actions=${dreamerActionsEnabled})`);
|
|
135
|
+
startupComplete = true;
|
|
117
136
|
} catch (err) {
|
|
118
137
|
const message = err instanceof Error ? err.message : String(err);
|
|
138
|
+
startupError = `Magic Context child startup failed: ${message}`;
|
|
119
139
|
log2(`[pi-subagent] startup failed: ${message}`);
|
|
120
140
|
process.exitCode = 1;
|
|
141
|
+
await reportStartupFailure();
|
|
121
142
|
throw err;
|
|
122
143
|
}
|
|
123
144
|
});
|
|
@@ -8,7 +8,7 @@ import"./index-yxeg8zaa.js";
|
|
|
8
8
|
import {
|
|
9
9
|
LATEST_SUPPORTED_VERSION,
|
|
10
10
|
getPersistedSchemaVersion
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-625kbnqd.js";
|
|
12
12
|
import"./index-fapenpch.js";
|
|
13
13
|
import"./index-3bb24eb6.js";
|
|
14
14
|
import"./index-8sqebjzk.js";
|
|
@@ -18,24 +18,24 @@ import {
|
|
|
18
18
|
} from "./index-x2n261wp.js";
|
|
19
19
|
import"./index-szn2tac8.js";
|
|
20
20
|
import"./index-6d0bby9d.js";
|
|
21
|
-
import"./index-
|
|
21
|
+
import"./index-d40ecdbn.js";
|
|
22
22
|
import {
|
|
23
23
|
tagRevisionKey
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-v858d5d1.js";
|
|
25
25
|
import"./index-135e8hvg.js";
|
|
26
26
|
import"./index-n0zjvs3h.js";
|
|
27
27
|
import"./index-7y60kyea.js";
|
|
28
|
-
import"./index-c6wbq66z.js";
|
|
29
28
|
import {
|
|
30
29
|
normalizeTagSnapshotRow2,
|
|
31
30
|
TAG_SELECT_COLUMNS2
|
|
32
|
-
} from "./index-
|
|
31
|
+
} from "./index-5n3e2gq5.js";
|
|
32
|
+
import"./index-vcegxfwg.js";
|
|
33
33
|
import {
|
|
34
34
|
encodePiHydrationOperation,
|
|
35
35
|
projectPiPassTag,
|
|
36
36
|
PI_FALLBACK_ROW_COLUMNS,
|
|
37
37
|
PI_FALLBACK_ROW_PREDICATE
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-nhpvvdhw.js";
|
|
39
39
|
import"./index-j0eagxkz.js";
|
|
40
40
|
import {
|
|
41
41
|
serveWorkerJobs
|
package/package.json
CHANGED
package/dist/index-674f6qs2.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// ../plugin/src/shared/protected-tools-policy.ts
|
|
2
|
-
var DEFAULT_PROTECTED_TOOLS = {
|
|
3
|
-
todowrite: 1,
|
|
4
|
-
ctx_reduce: 3
|
|
5
|
-
};
|
|
6
|
-
function normalizeProtectedToolName(name) {
|
|
7
|
-
return (name ?? "").toLowerCase().replace(/^mcp_/, "");
|
|
8
|
-
}
|
|
9
|
-
function mergeProtectedTools(...maps) {
|
|
10
|
-
return Object.fromEntries([DEFAULT_PROTECTED_TOOLS, ...maps].flatMap((map) => Object.entries(map ?? {}).map(([name, count]) => [
|
|
11
|
-
normalizeProtectedToolName(name),
|
|
12
|
-
count
|
|
13
|
-
])));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { DEFAULT_PROTECTED_TOOLS, normalizeProtectedToolName, mergeProtectedTools };
|
package/dist/index-c6wbq66z.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
// ../plugin/src/shared/bounded-session-map.ts
|
|
2
|
-
class BoundedSessionMap {
|
|
3
|
-
maxEntries;
|
|
4
|
-
store = new Map;
|
|
5
|
-
constructor(maxEntries) {
|
|
6
|
-
if (!Number.isFinite(maxEntries) || maxEntries < 1) {
|
|
7
|
-
throw new Error(`BoundedSessionMap: maxEntries must be >= 1, got ${maxEntries}`);
|
|
8
|
-
}
|
|
9
|
-
this.maxEntries = maxEntries;
|
|
10
|
-
}
|
|
11
|
-
get(sessionId) {
|
|
12
|
-
const value = this.store.get(sessionId);
|
|
13
|
-
if (value === undefined)
|
|
14
|
-
return;
|
|
15
|
-
this.store.delete(sessionId);
|
|
16
|
-
this.store.set(sessionId, value);
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
19
|
-
peek(sessionId) {
|
|
20
|
-
return this.store.get(sessionId);
|
|
21
|
-
}
|
|
22
|
-
has(sessionId) {
|
|
23
|
-
return this.store.has(sessionId);
|
|
24
|
-
}
|
|
25
|
-
set(sessionId, value) {
|
|
26
|
-
if (this.store.has(sessionId)) {
|
|
27
|
-
this.store.delete(sessionId);
|
|
28
|
-
} else if (this.store.size >= this.maxEntries) {
|
|
29
|
-
const oldest = this.store.keys().next().value;
|
|
30
|
-
if (oldest !== undefined)
|
|
31
|
-
this.store.delete(oldest);
|
|
32
|
-
}
|
|
33
|
-
this.store.set(sessionId, value);
|
|
34
|
-
}
|
|
35
|
-
delete(sessionId) {
|
|
36
|
-
return this.store.delete(sessionId);
|
|
37
|
-
}
|
|
38
|
-
clear() {
|
|
39
|
-
this.store.clear();
|
|
40
|
-
}
|
|
41
|
-
get size() {
|
|
42
|
-
return this.store.size;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// ../plugin/src/features/magic-context/tool-definition-tokens.ts
|
|
47
|
-
var ACTIVITY_WINDOW_MS = 10 * 60000;
|
|
48
|
-
var MAX_ACTIVITY_GAP_MS = 60000;
|
|
49
|
-
var WINDOWED_SINCE_KEY = "tool_definition_measurements:windowed_since";
|
|
50
|
-
var routes = new Map;
|
|
51
|
-
var sessionFlights = new BoundedSessionMap(1000);
|
|
52
|
-
var persistenceDb = null;
|
|
53
|
-
var windowedSince;
|
|
54
|
-
var boundAt = 0;
|
|
55
|
-
var cachedInsertStmt = null;
|
|
56
|
-
var cachedDeleteStmt = null;
|
|
57
|
-
function agentKey(agentName) {
|
|
58
|
-
return agentName && agentName.length > 0 ? agentName : "default";
|
|
59
|
-
}
|
|
60
|
-
function keyFor(providerID, modelID, agentName) {
|
|
61
|
-
return `${providerID}/${modelID}/${agentKey(agentName)}`;
|
|
62
|
-
}
|
|
63
|
-
function routeFor(providerID, modelID, agentName) {
|
|
64
|
-
const key = keyFor(providerID, modelID, agentName);
|
|
65
|
-
let route = routes.get(key);
|
|
66
|
-
if (!route) {
|
|
67
|
-
route = {
|
|
68
|
-
providerID,
|
|
69
|
-
modelID,
|
|
70
|
-
agentName: agentKey(agentName),
|
|
71
|
-
tools: new Map,
|
|
72
|
-
live: false,
|
|
73
|
-
clock: 0,
|
|
74
|
-
lastWallAt: Date.now(),
|
|
75
|
-
oldestFireAt: Number.POSITIVE_INFINITY,
|
|
76
|
-
retired: new Map,
|
|
77
|
-
legacyRows: new Set
|
|
78
|
-
};
|
|
79
|
-
routes.set(key, route);
|
|
80
|
-
}
|
|
81
|
-
return { key, route };
|
|
82
|
-
}
|
|
83
|
-
function advanceClock(route) {
|
|
84
|
-
const now = Date.now();
|
|
85
|
-
const gap = Math.min(Math.max(now - route.lastWallAt, 0), MAX_ACTIVITY_GAP_MS);
|
|
86
|
-
route.clock += gap;
|
|
87
|
-
route.lastWallAt = Math.max(route.lastWallAt, now);
|
|
88
|
-
return route.clock;
|
|
89
|
-
}
|
|
90
|
-
function readWindowedSince(db) {
|
|
91
|
-
try {
|
|
92
|
-
const row = db.prepare("SELECT value FROM schema_migrations_meta WHERE key = ?").get(WINDOWED_SINCE_KEY);
|
|
93
|
-
if (!row)
|
|
94
|
-
return;
|
|
95
|
-
const value = Number(row.value);
|
|
96
|
-
return Number.isFinite(value) ? value : undefined;
|
|
97
|
-
} catch {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function markWindowed() {
|
|
102
|
-
if (windowedSince !== undefined || !persistenceDb)
|
|
103
|
-
return;
|
|
104
|
-
try {
|
|
105
|
-
persistenceDb.prepare("INSERT OR IGNORE INTO schema_migrations_meta (key, value) VALUES (?, ?)").run(WINDOWED_SINCE_KEY, String(boundAt));
|
|
106
|
-
windowedSince = readWindowedSince(persistenceDb);
|
|
107
|
-
} catch {}
|
|
108
|
-
}
|
|
109
|
-
function setDatabase(db) {
|
|
110
|
-
const rebound = persistenceDb !== null && persistenceDb !== db;
|
|
111
|
-
persistenceDb = db;
|
|
112
|
-
boundAt = Date.now();
|
|
113
|
-
cachedInsertStmt = null;
|
|
114
|
-
cachedDeleteStmt = null;
|
|
115
|
-
if (rebound) {
|
|
116
|
-
for (const route of routes.values()) {
|
|
117
|
-
for (const slot of route.tools.values()) {
|
|
118
|
-
slot.persisted = false;
|
|
119
|
-
slot.writeFailedAt = undefined;
|
|
120
|
-
}
|
|
121
|
-
for (const retired of route.retired.values())
|
|
122
|
-
retired.rowKept = false;
|
|
123
|
-
route.legacyRows.clear();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
windowedSince = readWindowedSince(db);
|
|
127
|
-
if (windowedSince !== undefined)
|
|
128
|
-
return;
|
|
129
|
-
try {
|
|
130
|
-
if (!db.prepare("SELECT 1 FROM tool_definition_measurements LIMIT 1").get())
|
|
131
|
-
markWindowed();
|
|
132
|
-
} catch {}
|
|
133
|
-
}
|
|
134
|
-
function loadToolDefinitionMeasurements(db) {
|
|
135
|
-
let rows = [];
|
|
136
|
-
try {
|
|
137
|
-
rows = db.prepare("SELECT provider_id, model_id, agent_name, tool_id, token_count, recorded_at FROM tool_definition_measurements").all();
|
|
138
|
-
} catch {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const since = readWindowedSince(db);
|
|
142
|
-
const loadedAt = new Map;
|
|
143
|
-
for (const row of rows) {
|
|
144
|
-
const { route } = routeFor(row.provider_id, row.model_id, row.agent_name);
|
|
145
|
-
if (route.live)
|
|
146
|
-
continue;
|
|
147
|
-
let now = loadedAt.get(route);
|
|
148
|
-
if (now === undefined) {
|
|
149
|
-
now = advanceClock(route);
|
|
150
|
-
loadedAt.set(route, now);
|
|
151
|
-
}
|
|
152
|
-
const legacy = since === undefined || !(Number(row.recorded_at) >= since);
|
|
153
|
-
route.tools.set(row.tool_id, {
|
|
154
|
-
tokens: row.token_count,
|
|
155
|
-
fingerprint: undefined,
|
|
156
|
-
lastFireAt: now,
|
|
157
|
-
legacy,
|
|
158
|
-
persisted: !legacy
|
|
159
|
-
});
|
|
160
|
-
route.oldestFireAt = Math.min(route.oldestFireAt, now);
|
|
161
|
-
if (legacy)
|
|
162
|
-
route.legacyRows.add(row.tool_id);
|
|
163
|
-
else
|
|
164
|
-
route.legacyRows.delete(row.tool_id);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export { BoundedSessionMap, setDatabase, loadToolDefinitionMeasurements };
|