@cortexkit/opencode-magic-context 0.49.67 → 0.49.69
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/chunk-embedding-write-worker.js +1 -1
- package/dist/{context-1acz1d4x.js → context-rcts8w54.js} +15 -15
- package/dist/hooks/magic-context/final-wire-completeness.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/image-token-estimate.d.ts +2 -0
- package/dist/hooks/magic-context/image-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +13 -0
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
- package/dist/{index-nfvyraa3.js → index-0dbc9rxd.js} +4 -4
- package/dist/{index-m6cv2hv3.js → index-51anehwt.js} +3 -3
- package/dist/{index-2x46rnct.js → index-5hc4kjg0.js} +1 -1
- package/dist/{index-2t9e10mt.js → index-95475ngp.js} +15 -15
- package/dist/{index-8a1m48va.js → index-cdyhpdqx.js} +3 -3
- package/dist/{index-fybdhbd4.js → index-d0mb17q4.js} +2 -2
- package/dist/{index-g53qhdrb.js → index-fcrp1k8s.js} +1 -1
- package/dist/{index-q73yeb83.js → index-fm0bpxc6.js} +1 -1
- package/dist/{index-m47yte97.js → index-gvnt9yka.js} +5 -5
- package/dist/{index-gy33sq5h.js → index-mejvnav7.js} +6 -6
- package/dist/{index-3v5mfapn.js → index-mey1nc1v.js} +1 -1
- package/dist/{index-t20q6aj6.js → index-mxjdj2cz.js} +61 -6
- package/dist/{index-xmk2a6pq.js → index-n19pqsnh.js} +2 -2
- package/dist/{index-w6fh4v87.js → index-ng6gfs0y.js} +6 -3
- package/dist/{index-z10dryn5.js → index-rzxzap49.js} +5 -5
- package/dist/{index-ngrrs3yb.js → index-y664y8kq.js} +1 -1
- package/dist/index.js +18 -18
- package/dist/{message-index-bounded-f27039js.js → message-index-bounded-n2j33x8n.js} +3 -3
- package/dist/migration-worker.js +1 -1
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-4ma2vsva.js → read-session-chunk-6kdtfa7k.js} +2 -2
- package/dist/{recomp-orchestrator-p9c4jg9m.js → recomp-orchestrator-t9670x13.js} +7 -7
- package/dist/{render-h16ea0th.js → render-re3akx9j.js} +6 -6
- package/dist/{search-archive-km2ahm3e.js → search-archive-0q8rdnrd.js} +4 -4
- package/dist/{search-m9rpnh7m.js → search-rppmngr5.js} +5 -5
- package/dist/{storage-tags-ktp70q1e.js → storage-tags-rptkad9p.js} +1 -1
- package/dist/{store-h20ny8b8.js → store-h2a1g3wh.js} +1 -1
- package/dist/{transform-postprocess-phase-120s1ep8.js → transform-postprocess-phase-qtd2wr52.js} +8 -8
- package/dist/v2/auto-search-worker.js +1 -1
- package/dist/v2/chunk-embedding-write-worker.js +1 -1
- package/dist/v2/{context-p0z7mrsf.js → context-wv122q62.js} +13 -13
- package/dist/v2/fold/restore.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-td516y9c.js → message-index-bounded-hfnsznj0.js} +3 -3
- package/dist/v2/migration-worker.js +1 -1
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-6dz32wmh.js → read-session-chunk-qzd376gb.js} +2 -2
- package/dist/v2/{recomp-orchestrator-ayy7xzm3.js → recomp-orchestrator-rrsbcsmc.js} +6 -6
- package/dist/v2/{render-gqp4fwqn.js → render-qwy9ydnb.js} +6 -6
- package/dist/v2/{search-archive-qn82j8k0.js → search-archive-gewpafej.js} +4 -4
- package/dist/v2/{search-dhekqtfc.js → search-q3xcyyq8.js} +4 -4
- package/dist/v2/{server-q8ta10e5.js → server-07z334y6.js} +1 -1
- package/dist/v2/{server-77207nf4.js → server-0c7egkzr.js} +2 -2
- package/dist/v2/{server-5zzt9rah.js → server-474m6n9v.js} +6 -3
- package/dist/v2/{server-s1a0bwpc.js → server-axmk8rr2.js} +1 -1
- package/dist/v2/{server-34vhmd1d.js → server-fczyr89c.js} +2 -2
- package/dist/v2/{server-xwcg55a8.js → server-h8y2948e.js} +4 -4
- package/dist/v2/{server-jew1m85s.js → server-nc4qrjde.js} +1 -1
- package/dist/v2/{server-n6hdj0fn.js → server-ssdfdrpv.js} +5 -5
- package/dist/v2/{server-verzg5w8.js → server-vqkqv7ze.js} +61 -6
- package/dist/v2/{server-166m5nrw.js → server-vzrj39bj.js} +1 -1
- package/dist/v2/{server-s66wvkpf.js → server-xxy28mq5.js} +2 -2
- package/dist/v2/server.js +2 -2
- package/dist/v2/{storage-tags-qe8r1n9w.js → storage-tags-msa1qvk8.js} +1 -1
- package/dist/v2/{store-skkhh3rd.js → store-4se2a0n0.js} +1 -1
- package/dist/v2/{v2-archive-reader-tbjwxvc5.js → v2-archive-reader-nwaw9qph.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-ksdzyfby.js → wrapup-orchestrator-xyd3r2t1.js} +6 -6
- package/dist/{v2-archive-reader-j16k987e.js → v2-archive-reader-dv00gb2a.js} +1 -1
- package/dist/{wrapup-orchestrator-w09bkgmk.js → wrapup-orchestrator-fzygp85w.js} +8 -8
- package/package.json +1 -1
|
@@ -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-nwaw9qph.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-gewpafej.js");
|
|
55
55
|
const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-wg5zc29f.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-e4avh192.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-hfnsznj0.js"),
|
|
85
85
|
import("./sqlite-context-pragmas-mv9jqwjh.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-msa1qvk8.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,8 +38,8 @@ import {
|
|
|
38
38
|
readSessionChunk2,
|
|
39
39
|
getRawSessionMessageIdsThrough2,
|
|
40
40
|
readRawSessionSeedTail2
|
|
41
|
-
} from "./server-
|
|
42
|
-
import"./server-
|
|
41
|
+
} from "./server-axmk8rr2.js";
|
|
42
|
+
import"./server-vqkqv7ze.js";
|
|
43
43
|
import"./server-1zx87sdm.js";
|
|
44
44
|
import"./server-3ap5dmhc.js";
|
|
45
45
|
import"./server-rz6g5xne.js";
|
|
@@ -7,23 +7,23 @@ import {
|
|
|
7
7
|
setRecompTerminal2,
|
|
8
8
|
buildRecompDeps2,
|
|
9
9
|
runManagedRecomp2
|
|
10
|
-
} from "./server-
|
|
10
|
+
} from "./server-ssdfdrpv.js";
|
|
11
11
|
import"./server-at0v0z4t.js";
|
|
12
12
|
import"./server-d07yxksx.js";
|
|
13
13
|
import"./server-d9aayyxk.js";
|
|
14
14
|
import"./server-jjvbk92s.js";
|
|
15
15
|
import"./server-z5255w05.js";
|
|
16
16
|
import"./server-4dhv7mqz.js";
|
|
17
|
-
import"./server-
|
|
17
|
+
import"./server-vzrj39bj.js";
|
|
18
18
|
import"./server-rbtx6q5v.js";
|
|
19
|
-
import"./server-
|
|
19
|
+
import"./server-07z334y6.js";
|
|
20
20
|
import"./server-2amn2s73.js";
|
|
21
21
|
import"./server-rthnpmbp.js";
|
|
22
22
|
import"./server-aewxmvnf.js";
|
|
23
23
|
import"./server-qjff96a6.js";
|
|
24
24
|
import"./server-qt1qqasc.js";
|
|
25
|
-
import"./server-
|
|
26
|
-
import"./server-
|
|
25
|
+
import"./server-axmk8rr2.js";
|
|
26
|
+
import"./server-vqkqv7ze.js";
|
|
27
27
|
import"./server-1zx87sdm.js";
|
|
28
28
|
import"./server-3ap5dmhc.js";
|
|
29
29
|
import"./server-npdey91q.js";
|
|
@@ -35,7 +35,7 @@ import"./server-rz6g5xne.js";
|
|
|
35
35
|
import"./server-jtq03rkb.js";
|
|
36
36
|
import"./server-8pdfmc27.js";
|
|
37
37
|
import"./server-x6fn9x8q.js";
|
|
38
|
-
import"./server-
|
|
38
|
+
import"./server-nc4qrjde.js";
|
|
39
39
|
import"./server-fb3zxn06.js";
|
|
40
40
|
import"./server-jn4pktdk.js";
|
|
41
41
|
import"./server-fr0wbhdn.js";
|
|
@@ -2,20 +2,20 @@ import {
|
|
|
2
2
|
renderMessageByOrdinal2,
|
|
3
3
|
renderVerboseRangeForTool2,
|
|
4
4
|
renderItemByTag2
|
|
5
|
-
} from "./server-
|
|
6
|
-
import"./server-
|
|
5
|
+
} from "./server-0c7egkzr.js";
|
|
6
|
+
import"./server-vzrj39bj.js";
|
|
7
7
|
import"./server-rbtx6q5v.js";
|
|
8
|
-
import"./server-
|
|
8
|
+
import"./server-07z334y6.js";
|
|
9
9
|
import"./server-2amn2s73.js";
|
|
10
10
|
import"./server-rthnpmbp.js";
|
|
11
|
-
import"./server-
|
|
12
|
-
import"./server-
|
|
11
|
+
import"./server-axmk8rr2.js";
|
|
12
|
+
import"./server-vqkqv7ze.js";
|
|
13
13
|
import"./server-1zx87sdm.js";
|
|
14
14
|
import"./server-3ap5dmhc.js";
|
|
15
15
|
import"./server-rz6g5xne.js";
|
|
16
16
|
import"./server-8pdfmc27.js";
|
|
17
17
|
import"./server-x6fn9x8q.js";
|
|
18
|
-
import"./server-
|
|
18
|
+
import"./server-nc4qrjde.js";
|
|
19
19
|
import"./server-fb3zxn06.js";
|
|
20
20
|
import"./server-jn4pktdk.js";
|
|
21
21
|
import"./server-fr0wbhdn.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
renderSearchArchive2,
|
|
3
3
|
renderSearchArchiveOffThread2
|
|
4
|
-
} from "./server-
|
|
5
|
-
import"./server-
|
|
4
|
+
} from "./server-xxy28mq5.js";
|
|
5
|
+
import"./server-h8y2948e.js";
|
|
6
6
|
import"./server-52x68mj4.js";
|
|
7
|
-
import"./server-
|
|
8
|
-
import"./server-
|
|
7
|
+
import"./server-axmk8rr2.js";
|
|
8
|
+
import"./server-vqkqv7ze.js";
|
|
9
9
|
import"./server-1zx87sdm.js";
|
|
10
10
|
import"./server-3ap5dmhc.js";
|
|
11
11
|
import"./server-rz6g5xne.js";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
resolveMemoriesByIdsForSearch2,
|
|
6
6
|
unifiedSearch2,
|
|
7
7
|
formatSearchResults2
|
|
8
|
-
} from "./server-
|
|
8
|
+
} from "./server-fczyr89c.js";
|
|
9
9
|
import"./server-52x68mj4.js";
|
|
10
10
|
import"./server-d07yxksx.js";
|
|
11
11
|
import"./server-d9aayyxk.js";
|
|
@@ -13,11 +13,11 @@ import"./server-jjvbk92s.js";
|
|
|
13
13
|
import"./server-z5255w05.js";
|
|
14
14
|
import"./server-4dhv7mqz.js";
|
|
15
15
|
import"./server-rbtx6q5v.js";
|
|
16
|
-
import"./server-
|
|
16
|
+
import"./server-07z334y6.js";
|
|
17
17
|
import"./server-2amn2s73.js";
|
|
18
18
|
import"./server-qt1qqasc.js";
|
|
19
|
-
import"./server-
|
|
20
|
-
import"./server-
|
|
19
|
+
import"./server-axmk8rr2.js";
|
|
20
|
+
import"./server-vqkqv7ze.js";
|
|
21
21
|
import"./server-1zx87sdm.js";
|
|
22
22
|
import"./server-3ap5dmhc.js";
|
|
23
23
|
import"./server-d706s5xn.js";
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./server-y8xjr8rx.js";
|
|
4
4
|
import {
|
|
5
5
|
getTagById2
|
|
6
|
-
} from "./server-
|
|
6
|
+
} from "./server-vqkqv7ze.js";
|
|
7
7
|
import {
|
|
8
8
|
expandToolPart,
|
|
9
9
|
visitRawSessionMessages2,
|
|
10
10
|
readRawSessionMessageById2
|
|
11
|
-
} from "./server-
|
|
11
|
+
} from "./server-axmk8rr2.js";
|
|
12
12
|
|
|
13
13
|
// src/tools/ctx-expand/render.ts
|
|
14
14
|
import { createHash } from "node:crypto";
|
|
@@ -175,9 +175,12 @@ function restoreRow(row, model, media) {
|
|
|
175
175
|
}
|
|
176
176
|
if (row.type === "system")
|
|
177
177
|
return [{ role: "system", content: [{ type: "text", text: data.text ?? "" }] }];
|
|
178
|
-
if (row.type === "synthetic"
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
if (row.type === "synthetic") {
|
|
179
|
+
if (isStorageNoticeText(data.text))
|
|
180
|
+
return [];
|
|
181
|
+
return [make("user", [{ type: "text", text: data.text ?? "", synthetic: true }])];
|
|
182
|
+
}
|
|
183
|
+
if (row.type === "skill")
|
|
181
184
|
return [make("user", [{ type: "text", text: data.text ?? "" }])];
|
|
182
185
|
if (row.type === "location-switched")
|
|
183
186
|
return [
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./server-afsz3cmx.js";
|
|
16
16
|
import {
|
|
17
17
|
isRecord
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-vqkqv7ze.js";
|
|
19
19
|
import {
|
|
20
20
|
cleanSearchText,
|
|
21
21
|
hintKeywordRelevance,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
isMessageIndexReconciledThrough,
|
|
26
26
|
clearIndexedMessages,
|
|
27
27
|
indexMessagesAfterOrdinal
|
|
28
|
-
} from "./server-
|
|
28
|
+
} from "./server-07z334y6.js";
|
|
29
29
|
import {
|
|
30
30
|
Priority,
|
|
31
31
|
AdmissionClass,
|
|
@@ -138,10 +138,10 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
138
138
|
] = await Promise.all([
|
|
139
139
|
import("./sqlite-zdgm52sv.js"),
|
|
140
140
|
import("./store-reader-yaxtdy6f.js"),
|
|
141
|
-
import("./store-
|
|
142
|
-
import("./read-session-chunk-
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
141
|
+
import("./store-4se2a0n0.js"),
|
|
142
|
+
import("./read-session-chunk-qzd376gb.js"),
|
|
143
|
+
import("./render-qwy9ydnb.js"),
|
|
144
|
+
import("./search-archive-gewpafej.js"),
|
|
145
145
|
import("./expand-attachments-h33jbgyz.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
|
@@ -1021,7 +1021,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1021
1021
|
state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
|
|
1022
1022
|
if (signal.aborted || !readsOpenCodeStore)
|
|
1023
1023
|
return;
|
|
1024
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1024
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-qzd376gb.js"));
|
|
1025
1025
|
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-ynb3vg6r.js"));
|
|
1026
1026
|
if (signal.aborted)
|
|
1027
1027
|
return;
|
|
@@ -101,7 +101,7 @@ import {
|
|
|
101
101
|
foldShrunkPartTags2,
|
|
102
102
|
getTagNumberByMessageId2,
|
|
103
103
|
getActiveTagsBySession2
|
|
104
|
-
} from "./server-
|
|
104
|
+
} from "./server-vqkqv7ze.js";
|
|
105
105
|
import {
|
|
106
106
|
hasMeaningfulUserText2,
|
|
107
107
|
estimateTokens,
|
|
@@ -156,14 +156,14 @@ import {
|
|
|
156
156
|
getRawSessionTagKeysThrough2,
|
|
157
157
|
getLegacyProtectedTailStartOrdinal2,
|
|
158
158
|
readSessionChunk2
|
|
159
|
-
} from "./server-
|
|
159
|
+
} from "./server-axmk8rr2.js";
|
|
160
160
|
import {
|
|
161
161
|
clearCompressionDepth,
|
|
162
162
|
clearCompressionDepthRange,
|
|
163
163
|
toMessageIndexSource,
|
|
164
164
|
clearIndexedMessagesInTransaction,
|
|
165
165
|
indexSourcesAfterOrdinal
|
|
166
|
-
} from "./server-
|
|
166
|
+
} from "./server-07z334y6.js";
|
|
167
167
|
import {
|
|
168
168
|
COMPARTMENT_LEASE_RENEWAL_MS,
|
|
169
169
|
getCompartmentLeaseBlocker,
|
|
@@ -209,7 +209,7 @@ import {
|
|
|
209
209
|
getProjectState,
|
|
210
210
|
recordSubagentInvocation,
|
|
211
211
|
getLatestHistorianInvocationId
|
|
212
|
-
} from "./server-
|
|
212
|
+
} from "./server-vzrj39bj.js";
|
|
213
213
|
import {
|
|
214
214
|
invalidateAutoEmbedSession
|
|
215
215
|
} from "./server-2amn2s73.js";
|
|
@@ -269,7 +269,7 @@ import {
|
|
|
269
269
|
LATEST_SUPPORTED_VERSION,
|
|
270
270
|
getPersistedSchemaVersion,
|
|
271
271
|
openDatabase
|
|
272
|
-
} from "./server-
|
|
272
|
+
} from "./server-nc4qrjde.js";
|
|
273
273
|
import {
|
|
274
274
|
parseCompartmentOutput,
|
|
275
275
|
resolveWorkspaceShareCategories,
|
|
@@ -310,8 +310,9 @@ function estimateImageTokensFromDataUrl(url) {
|
|
|
310
310
|
const comma = url.indexOf(",");
|
|
311
311
|
if (comma < 0)
|
|
312
312
|
return IMAGE_FALLBACK_TOKENS;
|
|
313
|
-
|
|
314
|
-
|
|
313
|
+
return estimateImageTokensFromBase64(url.slice(0, comma), url.slice(comma + 1));
|
|
314
|
+
}
|
|
315
|
+
function estimateImageTokensFromBase64(header, payload) {
|
|
315
316
|
const sliceLen = Math.min(512, payload.length);
|
|
316
317
|
const preview = payload.slice(0, sliceLen);
|
|
317
318
|
let bytes;
|
|
@@ -320,12 +321,15 @@ function estimateImageTokensFromDataUrl(url) {
|
|
|
320
321
|
} catch {
|
|
321
322
|
return IMAGE_FALLBACK_TOKENS;
|
|
322
323
|
}
|
|
324
|
+
return estimateImageTokensFromHeader(header, bytes, () => createBase64ByteReader(payload, bytes));
|
|
325
|
+
}
|
|
326
|
+
function estimateImageTokensFromHeader(header, bytes, jpegReader) {
|
|
323
327
|
if (header.includes("image/png")) {
|
|
324
328
|
const dims = parsePngDimensions(bytes);
|
|
325
329
|
if (dims)
|
|
326
330
|
return clampImageTokens(Math.ceil(dims.w * dims.h / IMAGE_TOKEN_DIVISOR));
|
|
327
331
|
} else if (header.includes("image/jpeg") || header.includes("image/jpg")) {
|
|
328
|
-
const dims = parseJpegDimensions(
|
|
332
|
+
const dims = parseJpegDimensions(jpegReader());
|
|
329
333
|
if (dims)
|
|
330
334
|
return clampImageTokens(Math.ceil(dims.w * dims.h / IMAGE_TOKEN_DIVISOR));
|
|
331
335
|
} else if (header.includes("image/webp")) {
|
|
@@ -339,6 +343,36 @@ function estimateImageTokensFromDataUrl(url) {
|
|
|
339
343
|
}
|
|
340
344
|
return IMAGE_FALLBACK_TOKENS;
|
|
341
345
|
}
|
|
346
|
+
function nativeMediaImage(part) {
|
|
347
|
+
if (part.type !== "media" || !isRecord(part.media))
|
|
348
|
+
return;
|
|
349
|
+
const { mediaType, source } = part.media;
|
|
350
|
+
if (typeof mediaType !== "string" || !mediaType.startsWith("image/"))
|
|
351
|
+
return;
|
|
352
|
+
let inline;
|
|
353
|
+
if (isRecord(source)) {
|
|
354
|
+
const { type, data } = source;
|
|
355
|
+
if (type === "base64" && typeof data === "string" && data.length > 0)
|
|
356
|
+
inline = data;
|
|
357
|
+
if (type === "bytes" && data instanceof Uint8Array && data.byteLength > 0)
|
|
358
|
+
inline = data;
|
|
359
|
+
}
|
|
360
|
+
return { mediaType, inline };
|
|
361
|
+
}
|
|
362
|
+
function isInlineNativeMediaImage(part) {
|
|
363
|
+
return nativeMediaImage(part)?.inline !== undefined;
|
|
364
|
+
}
|
|
365
|
+
function estimateNativeMediaImageTokens(part) {
|
|
366
|
+
const image = nativeMediaImage(part);
|
|
367
|
+
if (!image)
|
|
368
|
+
return 0;
|
|
369
|
+
const { mediaType, inline } = image;
|
|
370
|
+
if (typeof inline === "string")
|
|
371
|
+
return estimateImageTokensFromBase64(mediaType, inline);
|
|
372
|
+
if (inline)
|
|
373
|
+
return estimateImageTokensFromHeader(mediaType, inline, () => (i) => inline[i]);
|
|
374
|
+
return IMAGE_FALLBACK_TOKENS;
|
|
375
|
+
}
|
|
342
376
|
function estimateToolAttachmentImageTokens(state) {
|
|
343
377
|
if (!state || typeof state !== "object")
|
|
344
378
|
return 0;
|
|
@@ -1066,12 +1100,21 @@ function buildTagAttribution(args) {
|
|
|
1066
1100
|
}
|
|
1067
1101
|
return { protectedNumbers, messageTags, toolTagsByPart };
|
|
1068
1102
|
}
|
|
1103
|
+
function reclaimableTailTokens(part) {
|
|
1104
|
+
return part.tagStatus === "active" && !part.protected && !part.queuedForDrop && part.kind !== "excluded" && part.kind !== "text" ? part.tokens : 0;
|
|
1105
|
+
}
|
|
1069
1106
|
function snapshot(args) {
|
|
1070
1107
|
const memo = memoizedContent(args.kind, args.content);
|
|
1071
1108
|
const tag = args.tag;
|
|
1072
1109
|
const isProtected = tag ? args.protectedNumbers.has(tag.tagNumber) : false;
|
|
1073
1110
|
const queuedForDrop = tag ? args.pendingDropTagNumbers.has(tag.tagNumber) : false;
|
|
1074
|
-
const uTokens =
|
|
1111
|
+
const uTokens = reclaimableTailTokens({
|
|
1112
|
+
kind: args.kind,
|
|
1113
|
+
tokens: args.tokens,
|
|
1114
|
+
tagStatus: tag?.status,
|
|
1115
|
+
protected: isProtected,
|
|
1116
|
+
queuedForDrop
|
|
1117
|
+
});
|
|
1075
1118
|
return {
|
|
1076
1119
|
key: args.key,
|
|
1077
1120
|
contentHash: memo.hash,
|
|
@@ -1235,7 +1278,13 @@ function measureWithReplay(input, replay) {
|
|
|
1235
1278
|
const tag = prior.kind === "text" ? attribution.messageTags.get(`${message.info.id}:p${partIndex}`) : prior.kind === "file" ? attribution.messageTags.get(`${message.info.id}:file${partIndex}`) : prior.kind === "toolInput" || prior.kind === "toolOutput" ? attribution.toolTagsByPart.get(message.parts[partIndex]) : undefined;
|
|
1236
1279
|
const protectedPart = tag ? attribution.protectedNumbers.has(tag.tagNumber) : false;
|
|
1237
1280
|
const queuedForDrop = tag ? pendingDropTagNumbers.has(tag.tagNumber) : false;
|
|
1238
|
-
const uTokens =
|
|
1281
|
+
const uTokens = reclaimableTailTokens({
|
|
1282
|
+
kind: prior.kind,
|
|
1283
|
+
tokens: prior.tokens,
|
|
1284
|
+
tagStatus: tag?.status,
|
|
1285
|
+
protected: protectedPart,
|
|
1286
|
+
queuedForDrop
|
|
1287
|
+
});
|
|
1239
1288
|
const measured = prior.tagNumber === (tag?.tagNumber ?? null) && prior.tagStatus === (tag?.status ?? null) && prior.protected === protectedPart && prior.queuedForDrop === queuedForDrop && prior.uTokens === uTokens ? prior : {
|
|
1240
1289
|
...prior,
|
|
1241
1290
|
tagNumber: tag?.tagNumber ?? null,
|
|
@@ -2008,9 +2057,12 @@ function incompleteWirePartFields(part) {
|
|
|
2008
2057
|
return missing(p.result !== undefined || p.content !== undefined || p.output !== undefined, "result");
|
|
2009
2058
|
case "step-start":
|
|
2010
2059
|
case "step-finish":
|
|
2060
|
+
case "effort":
|
|
2011
2061
|
return [];
|
|
2012
2062
|
case "file":
|
|
2013
2063
|
return missing(typeof p.url === "string" && p.url.startsWith("data:image/"), "url (data:image/)");
|
|
2064
|
+
case "media":
|
|
2065
|
+
return missing(isInlineNativeMediaImage(p), "media (inline image)");
|
|
2014
2066
|
default:
|
|
2015
2067
|
return ["supported type"];
|
|
2016
2068
|
}
|
|
@@ -6464,11 +6516,13 @@ function serializedTokens(value, bounded = false) {
|
|
|
6464
6516
|
return serialized ? wireTextTokens(serialized) : 0;
|
|
6465
6517
|
}
|
|
6466
6518
|
function estimatePartImageTokens(raw) {
|
|
6467
|
-
if (!raw
|
|
6519
|
+
if (!isRecord(raw))
|
|
6468
6520
|
return 0;
|
|
6469
6521
|
const part = raw;
|
|
6470
6522
|
if (part.ignored)
|
|
6471
6523
|
return 0;
|
|
6524
|
+
if (part.type === "media")
|
|
6525
|
+
return estimateNativeMediaImageTokens(raw);
|
|
6472
6526
|
if (part.type === "file" && part.mime?.startsWith("image/")) {
|
|
6473
6527
|
return typeof part.url === "string" && part.url.startsWith("data:") ? estimateImageTokensFromDataUrl(part.url) : 1200;
|
|
6474
6528
|
}
|
|
@@ -6531,6 +6585,7 @@ function visitWireContent(message, visit) {
|
|
|
6531
6585
|
opaque();
|
|
6532
6586
|
break;
|
|
6533
6587
|
case "file":
|
|
6588
|
+
case "media":
|
|
6534
6589
|
visit.image("conversation", estimatePartImageTokens(part));
|
|
6535
6590
|
break;
|
|
6536
6591
|
case "tool":
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
rawMessageWorkerSource2,
|
|
20
20
|
rawMessageOffThreadRangeReader2,
|
|
21
21
|
readRawSessionMessageIdOrdinalsForRange2
|
|
22
|
-
} from "./server-
|
|
22
|
+
} from "./server-axmk8rr2.js";
|
|
23
23
|
import {
|
|
24
24
|
readV2ArchiveOffThread2
|
|
25
|
-
} from "./server-
|
|
25
|
+
} from "./server-h8y2948e.js";
|
|
26
26
|
|
|
27
27
|
// src/tools/ctx-expand/search-archive.ts
|
|
28
28
|
var archiveReadsOnThisThread = 0;
|
package/dist/v2/server.js
CHANGED
|
@@ -7875,7 +7875,7 @@ var require_src2 = __commonJS(function(exports, module) {
|
|
|
7875
7875
|
// package.json
|
|
7876
7876
|
var package_default = {
|
|
7877
7877
|
name: "@cortexkit/opencode-magic-context",
|
|
7878
|
-
version: "0.49.
|
|
7878
|
+
version: "0.49.69",
|
|
7879
7879
|
type: "module",
|
|
7880
7880
|
description: "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
7881
7881
|
main: "dist/index.js",
|
|
@@ -8196,7 +8196,7 @@ async function setup(context) {
|
|
|
8196
8196
|
if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
|
|
8197
8197
|
log2(`[magic-context] Magic Context storage is at ${storageDir}, outside the folder Engram backs up (~/.local/share/cortexkit/magic-context). It is not included in CortexKit backups.`);
|
|
8198
8198
|
}
|
|
8199
|
-
const { registerContext } = await import("./context-
|
|
8199
|
+
const { registerContext } = await import("./context-wv122q62.js");
|
|
8200
8200
|
setHarness2("opencode2");
|
|
8201
8201
|
bindStaleBuildNotice({}, import.meta.url, "opencode2");
|
|
8202
8202
|
const duties = await registerContext(context);
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
readV2RawMessagePagesForConversion2,
|
|
6
6
|
createV2RawMessageReader2,
|
|
7
7
|
createV2RawMessageProvider2
|
|
8
|
-
} from "./server-
|
|
8
|
+
} from "./server-474m6n9v.js";
|
|
9
9
|
import"./server-rthnpmbp.js";
|
|
10
10
|
import"./server-468mya5v.js";
|
|
11
11
|
import"./server-2ra6pwf3.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
releaseCompartmentLeaseBestEffort,
|
|
12
12
|
getCompartments,
|
|
13
13
|
getLastCompartmentEndMessage
|
|
14
|
-
} from "./server-
|
|
14
|
+
} from "./server-vzrj39bj.js";
|
|
15
15
|
import"./server-2amn2s73.js";
|
|
16
16
|
import"./server-y8xjr8rx.js";
|
|
17
17
|
import"./server-x6fn9x8q.js";
|
|
@@ -24,7 +24,7 @@ import"./server-1d042x6w.js";
|
|
|
24
24
|
import"./server-6ash6z8z.js";
|
|
25
25
|
import"./server-ds8vpfkr.js";
|
|
26
26
|
import"./server-8pdfmc27.js";
|
|
27
|
-
import"./server-
|
|
27
|
+
import"./server-07z334y6.js";
|
|
28
28
|
import {
|
|
29
29
|
getWrapupInProgressState,
|
|
30
30
|
acquireWrapupInProgress,
|
|
@@ -32,16 +32,16 @@ import {
|
|
|
32
32
|
releaseWrapupInProgress,
|
|
33
33
|
getHistorianFailureState,
|
|
34
34
|
clearEmergencyRecovery
|
|
35
|
-
} from "./server-
|
|
35
|
+
} from "./server-vqkqv7ze.js";
|
|
36
36
|
import"./server-xepx8t43.js";
|
|
37
|
-
import"./server-
|
|
37
|
+
import"./server-nc4qrjde.js";
|
|
38
38
|
import"./server-1zx87sdm.js";
|
|
39
39
|
import"./server-rz6g5xne.js";
|
|
40
40
|
import"./server-2ra6pwf3.js";
|
|
41
41
|
import"./server-3ap5dmhc.js";
|
|
42
42
|
import {
|
|
43
43
|
prepareRawSessionOrdinals2
|
|
44
|
-
} from "./server-
|
|
44
|
+
} from "./server-axmk8rr2.js";
|
|
45
45
|
import"./server-fr0wbhdn.js";
|
|
46
46
|
import"./server-jn4pktdk.js";
|
|
47
47
|
import"./server-afsz3cmx.js";
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
registerActiveCompartmentRun,
|
|
64
64
|
setRecompStarting2,
|
|
65
65
|
setRecompTerminal2
|
|
66
|
-
} from "./server-
|
|
66
|
+
} from "./server-ssdfdrpv.js";
|
|
67
67
|
import"./server-qt1qqasc.js";
|
|
68
68
|
import"./server-z5255w05.js";
|
|
69
69
|
import"./server-jtq03rkb.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runManagedWrapup2
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
5
|
-
import"./index-
|
|
3
|
+
} from "./index-rzxzap49.js";
|
|
4
|
+
import"./index-cdyhpdqx.js";
|
|
5
|
+
import"./index-gvnt9yka.js";
|
|
6
6
|
import"./index-832w615x.js";
|
|
7
7
|
import"./index-sd3egckz.js";
|
|
8
8
|
import"./index-n6aye6ny.js";
|
|
@@ -10,16 +10,16 @@ import"./index-zxj39ba2.js";
|
|
|
10
10
|
import"./index-jjvbk92s.js";
|
|
11
11
|
import"./index-gq1g9a3a.js";
|
|
12
12
|
import"./index-4dhv7mqz.js";
|
|
13
|
-
import"./index-
|
|
13
|
+
import"./index-y664y8kq.js";
|
|
14
14
|
import"./index-tebcx987.js";
|
|
15
|
-
import"./index-
|
|
15
|
+
import"./index-5hc4kjg0.js";
|
|
16
16
|
import"./index-2amn2s73.js";
|
|
17
17
|
import"./index-6athgjba.js";
|
|
18
18
|
import"./index-ngwmx6nt.js";
|
|
19
19
|
import"./index-1sq1krqw.js";
|
|
20
20
|
import"./index-qt1qqasc.js";
|
|
21
|
-
import"./index-
|
|
22
|
-
import"./index-
|
|
21
|
+
import"./index-fm0bpxc6.js";
|
|
22
|
+
import"./index-mxjdj2cz.js";
|
|
23
23
|
import"./index-1zx87sdm.js";
|
|
24
24
|
import"./index-x40zr813.js";
|
|
25
25
|
import"./index-x8a7jmkh.js";
|
|
@@ -29,7 +29,7 @@ import"./index-6nqz8hsz.js";
|
|
|
29
29
|
import"./index-jg7sbt3v.js";
|
|
30
30
|
import"./index-snbpdpa3.js";
|
|
31
31
|
import"./index-pxnzyvjc.js";
|
|
32
|
-
import"./index-
|
|
32
|
+
import"./index-fcrp1k8s.js";
|
|
33
33
|
import"./index-fb3zxn06.js";
|
|
34
34
|
import"./index-xx05vta0.js";
|
|
35
35
|
import"./index-fr0wbhdn.js";
|
package/package.json
CHANGED