@cortexkit/opencode-magic-context 0.49.24 → 0.49.26
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 +4 -4
- package/dist/chunk-embedding-write-worker.js +5 -5
- package/dist/{compartment-chunk-embedding-eypvn607.js → compartment-chunk-embedding-96ec8a7h.js} +3 -3
- package/dist/{conflict-warning-hook-a27bhggg.js → conflict-warning-hook-dv8fdc2w.js} +4 -4
- package/dist/{context-tvrjhnmj.js → context-pjqa24nd.js} +30 -24
- package/dist/{embedding-backfill-vddgmem3.js → embedding-backfill-a91rvdf9.js} +5 -5
- package/dist/features/magic-context/tool-definition-tokens.d.ts +113 -57
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/caveman-cleanup.d.ts +14 -0
- package/dist/hooks/magic-context/caveman-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +11 -0
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +12 -4
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/foreign-text-parts.d.ts +47 -0
- package/dist/hooks/magic-context/foreign-text-parts.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-measured-request.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay-fit.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +21 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +20 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/signed-thinking-fit-snapshot.d.ts +42 -0
- package/dist/hooks/magic-context/signed-thinking-fit-snapshot.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-messages.d.ts +15 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +7 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-2haxh8h3.js → index-064v90e8.js} +1 -1
- package/dist/{index-p6evxfcc.js → index-40ma8m0c.js} +7 -49
- package/dist/{index-6g7tyb6e.js → index-56tfs78r.js} +96 -41
- package/dist/{index-jrjr58ez.js → index-6g1zq1sk.js} +3 -3
- package/dist/{index-3d5wnkq7.js → index-6tmf87w0.js} +1 -1
- package/dist/index-cfaet9cg.js +405 -0
- package/dist/{index-t1zk694n.js → index-dn2ke3b9.js} +30 -14
- package/dist/{index-t6j3qxnd.js → index-e5b61ty6.js} +1 -1
- package/dist/{index-dds7cxhz.js → index-hjnrp6vy.js} +67 -21
- package/dist/{index-c9zrgcnt.js → index-j43m40zd.js} +1 -1
- package/dist/{index-7tdtpqrg.js → index-m8va3mma.js} +39 -6
- package/dist/{index-z928hmnp.js → index-mphkpyap.js} +1 -1
- package/dist/{index-21bkd3m6.js → index-r3bteyev.js} +5 -5
- package/dist/{index-8e9qsnrw.js → index-rp78nqvr.js} +169 -11
- package/dist/{index-z05n7702.js → index-sgchhbvy.js} +1 -1
- package/dist/{index-jd0y50w3.js → index-va2g2q57.js} +3 -3
- package/dist/{index-jcr6pe7z.js → index-w55zp7kf.js} +1 -1
- package/dist/{index-szf8r0ba.js → index-xbbgcwd2.js} +1 -1
- package/dist/{index-7516anfj.js → index-xyx2ge2y.js} +4 -4
- package/dist/{index-57jf5ztp.js → index-zn2n24yr.js} +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -35
- package/dist/{message-fts-rowid-map-9e1getgs.js → message-fts-rowid-map-4ksatb6f.js} +2 -2
- package/dist/{message-index-bounded-k8pgrxad.js → message-index-bounded-whh5wv4a.js} +7 -7
- package/dist/{message-index-1sgzev6c.js → message-index-ywx53y30.js} +7 -7
- package/dist/migration-worker.js +4 -4
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{project-embedding-registry-rstzmb60.js → project-embedding-registry-t9fx6jwh.js} +4 -4
- package/dist/raw-ordinal-warmup-worker.js +6 -6
- package/dist/{read-session-chunk-q9z6s48t.js → read-session-chunk-mqmkgdx0.js} +6 -4
- package/dist/{read-session-raw-s4amywnh.js → read-session-raw-dy2xxafq.js} +3 -1
- package/dist/{recomp-orchestrator-hr8ddk8z.js → recomp-orchestrator-qwcz86r1.js} +14 -14
- package/dist/{search-archive-c00etw7k.js → search-archive-8md3twv2.js} +5 -5
- package/dist/{search-3zjjmc60.js → search-y2t97tbb.js} +11 -11
- package/dist/{send-session-notification-ygj4mja0.js → send-session-notification-kzazs7fy.js} +3 -3
- package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-rredw6bz.js → transform-postprocess-phase-ppm1tfa7.js} +14 -14
- package/dist/v2/auto-search-worker.js +4 -4
- package/dist/v2/chunk-embedding-write-worker.js +5 -5
- package/dist/v2/{compartment-chunk-embedding-tk6g4q80.js → compartment-chunk-embedding-5rmrn09z.js} +3 -3
- package/dist/v2/{context-zbydzq4g.js → context-10pj3bwd.js} +245 -45
- package/dist/v2/{embedding-backfill-w5qp7t28.js → embedding-backfill-r9mzt2eg.js} +5 -5
- package/dist/v2/hooks/context.d.ts +4 -0
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/{message-fts-rowid-map-pqk3a55v.js → message-fts-rowid-map-2s3ta05x.js} +2 -2
- package/dist/v2/{message-index-bounded-a9xa8wsq.js → message-index-bounded-f4269d3a.js} +6 -6
- package/dist/v2/{message-index-5gnnn64b.js → message-index-v6g8mgn7.js} +6 -6
- package/dist/v2/migration-worker.js +4 -4
- package/dist/v2/{project-embedding-registry-e7zftfvj.js → project-embedding-registry-tgtmart7.js} +4 -4
- package/dist/v2/raw-ordinal-warmup-worker.js +6 -6
- package/dist/v2/{read-session-chunk-qqvda7zv.js → read-session-chunk-ym5zvexn.js} +5 -3
- package/dist/v2/{read-session-raw-ppjxnqk4.js → read-session-raw-484g8kf2.js} +3 -1
- package/dist/v2/{recomp-orchestrator-nmt9y25j.js → recomp-orchestrator-b44s2snm.js} +11 -11
- package/dist/v2/{search-6dawx2gt.js → search-75tf953m.js} +10 -10
- package/dist/v2/{search-archive-dhqj1w31.js → search-archive-pmf2c1kb.js} +4 -4
- package/dist/v2/{send-session-notification-f8scq6ae.js → send-session-notification-gd21f5rq.js} +1 -1
- package/dist/v2/{server-y9ncq4ck.js → server-317f3x9y.js} +3 -3
- package/dist/v2/{server-wxrdher8.js → server-4frtg2z1.js} +1 -1
- package/dist/v2/server-7d6m1p2b.js +361 -0
- package/dist/v2/{server-pw21ypwb.js → server-7dpnt0ys.js} +1 -1
- package/dist/v2/{server-r209n2fk.js → server-9zh78t8y.js} +65 -19
- package/dist/v2/{server-swvhxhxz.js → server-erk2bvdf.js} +39 -6
- package/dist/v2/{server-q5z0gag0.js → server-hnmm8yzq.js} +1 -1
- package/dist/v2/{server-gwmshgx9.js → server-jcsw05aa.js} +29 -13
- package/dist/v2/{server-mefps930.js → server-k46ec388.js} +7 -49
- package/dist/v2/{server-9xbbaekh.js → server-nmwhe524.js} +1 -1
- package/dist/v2/{server-9e55n4wx.js → server-vjer2jdn.js} +5 -5
- package/dist/v2/{server-16dpnz56.js → server-w7x9wgm0.js} +2 -2
- package/dist/v2/{server-8j2e7t31.js → server-wj8h2q21.js} +1 -1
- package/dist/v2/server.js +2 -2
- package/dist/v2/{wrapup-orchestrator-9z81xj66.js → wrapup-orchestrator-gwww44st.js} +11 -11
- package/dist/{wrapup-orchestrator-dbnb530w.js → wrapup-orchestrator-a9r8r4sk.js} +15 -15
- package/package.json +1 -1
- package/dist/index-j76ah6d7.js +0 -120
- package/dist/v2/server-d1dzgvwd.js +0 -120
|
@@ -24,12 +24,12 @@ var [
|
|
|
24
24
|
{ Database, registerSqliteDiagnosticSink },
|
|
25
25
|
{ log }
|
|
26
26
|
] = await Promise.all([
|
|
27
|
-
import("./embedding-backfill-
|
|
27
|
+
import("./embedding-backfill-a91rvdf9.js"),
|
|
28
28
|
import("./embedding-cache-mgyr73ef.js"),
|
|
29
29
|
import("./storage-memory-e6a7mb0k.js"),
|
|
30
|
-
import("./project-embedding-registry-
|
|
31
|
-
import("./search-
|
|
32
|
-
import("./compartment-chunk-embedding-
|
|
30
|
+
import("./project-embedding-registry-t9fx6jwh.js"),
|
|
31
|
+
import("./search-y2t97tbb.js"),
|
|
32
|
+
import("./compartment-chunk-embedding-96ec8a7h.js"),
|
|
33
33
|
import("./embedding-activity-g1dhes6g.js"),
|
|
34
34
|
import("./harness-e4avh192.js"),
|
|
35
35
|
import("./sqlite-zdgm52sv.js"),
|
|
@@ -16,14 +16,14 @@ import"./index-g2q4htwp.js";
|
|
|
16
16
|
import"./index-h7tgn49j.js";
|
|
17
17
|
import"./index-wfybj1dw.js";
|
|
18
18
|
import"./index-v0p37hm2.js";
|
|
19
|
-
import"./index-
|
|
20
|
-
import"./index-
|
|
19
|
+
import"./index-m8va3mma.js";
|
|
20
|
+
import"./index-xbbgcwd2.js";
|
|
21
21
|
import {
|
|
22
22
|
replaceCompartmentChunkEmbeddings2,
|
|
23
23
|
recordChunkEmbedBackoff2,
|
|
24
24
|
loadUnembeddedSessionChunkCandidates2,
|
|
25
25
|
countUnembeddedSessionCompartments2
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-6tmf87w0.js";
|
|
27
27
|
import {
|
|
28
28
|
recordSessionProjectIdentity,
|
|
29
29
|
acquireGitSweepLease,
|
|
@@ -35,12 +35,12 @@ import"./index-c7phnbvk.js";
|
|
|
35
35
|
import {
|
|
36
36
|
LATEST_SUPPORTED_VERSION,
|
|
37
37
|
enforceSchemaFence
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-6g1zq1sk.js";
|
|
39
39
|
import"./index-9q1g3c5q.js";
|
|
40
40
|
import"./index-x9k3mqrf.js";
|
|
41
41
|
import"./index-fr0wbhdn.js";
|
|
42
42
|
import"./index-58e3y90n.js";
|
|
43
|
-
import"./index-
|
|
43
|
+
import"./index-cfaet9cg.js";
|
|
44
44
|
import"./index-t5pck3ss.js";
|
|
45
45
|
|
|
46
46
|
// src/features/magic-context/chunk-embedding-write-worker.ts
|
package/dist/{compartment-chunk-embedding-eypvn607.js → compartment-chunk-embedding-96ec8a7h.js}
RENAMED
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
countSessionCompartmentEmbedCoverage2,
|
|
25
25
|
countSessionCompartmentEmbedCoveragePolite2,
|
|
26
26
|
countUnembeddedSessionCompartmentsPolite2
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-6tmf87w0.js";
|
|
28
28
|
import"./index-wfybj1dw.js";
|
|
29
|
-
import"./index-
|
|
30
|
-
import"./index-
|
|
29
|
+
import"./index-xbbgcwd2.js";
|
|
30
|
+
import"./index-m8va3mma.js";
|
|
31
31
|
import"./index-v0p37hm2.js";
|
|
32
32
|
import"./index-t5pck3ss.js";
|
|
33
33
|
import"./index-b88dwwrh.js";
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
cleanupConflictWarnings2,
|
|
5
5
|
sendSchemaFenceWarning2,
|
|
6
6
|
sendStartupAnnouncement2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-064v90e8.js";
|
|
8
8
|
import"./index-4pnsgvfk.js";
|
|
9
9
|
import"./index-sd3egckz.js";
|
|
10
|
-
import"./index-
|
|
10
|
+
import"./index-w55zp7kf.js";
|
|
11
11
|
import"./index-qt1qqasc.js";
|
|
12
|
-
import"./index-
|
|
12
|
+
import"./index-j43m40zd.js";
|
|
13
13
|
import"./index-rrv26qjz.js";
|
|
14
14
|
import"./index-58e3y90n.js";
|
|
15
|
-
import"./index-
|
|
15
|
+
import"./index-m8va3mma.js";
|
|
16
16
|
import"./index-v0p37hm2.js";
|
|
17
17
|
import"./index-gzy5w8ya.js";
|
|
18
18
|
import"./index-h7tgn49j.js";
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
rebaseSessionCoordinatesAsync,
|
|
60
60
|
resolveOpenCodeProtectedTailBoundary,
|
|
61
61
|
getActiveCompartmentRun
|
|
62
|
-
} from "./index-
|
|
62
|
+
} from "./index-hjnrp6vy.js";
|
|
63
63
|
import"./index-sd3egckz.js";
|
|
64
64
|
import {
|
|
65
65
|
getHarness2
|
|
@@ -151,7 +151,7 @@ import {
|
|
|
151
151
|
applyJsonSchemaParameterDescriptions,
|
|
152
152
|
MagicContextRpcServer,
|
|
153
153
|
subagentTemperature
|
|
154
|
-
} from "./index-
|
|
154
|
+
} from "./index-56tfs78r.js";
|
|
155
155
|
import {
|
|
156
156
|
resolveHistorianModel2
|
|
157
157
|
} from "./index-5kym00ag.js";
|
|
@@ -166,7 +166,7 @@ import {
|
|
|
166
166
|
openDatabaseAsync,
|
|
167
167
|
isDatabasePersisted,
|
|
168
168
|
getDatabasePersistenceError
|
|
169
|
-
} from "./index-
|
|
169
|
+
} from "./index-6g1zq1sk.js";
|
|
170
170
|
import {
|
|
171
171
|
setHomeProjectPermission,
|
|
172
172
|
resolveProjectIdentityForSession,
|
|
@@ -174,14 +174,13 @@ import {
|
|
|
174
174
|
} from "./index-kq5w68dp.js";
|
|
175
175
|
import"./index-c7phnbvk.js";
|
|
176
176
|
import {
|
|
177
|
-
BoundedSessionMap,
|
|
178
177
|
advanceSessionActivity,
|
|
179
178
|
backfillSessionActivity,
|
|
180
179
|
gaDatabasePath,
|
|
181
180
|
RAW_MESSAGE_TYPES,
|
|
182
181
|
V2StoreReaderPool,
|
|
183
182
|
V2StoreReader
|
|
184
|
-
} from "./index-
|
|
183
|
+
} from "./index-40ma8m0c.js";
|
|
185
184
|
import"./index-v0p37hm2.js";
|
|
186
185
|
import {
|
|
187
186
|
inRootAsyncContext2,
|
|
@@ -191,7 +190,7 @@ import {
|
|
|
191
190
|
withAsyncPrivilegedWriter2
|
|
192
191
|
} from "./index-gzy5w8ya.js";
|
|
193
192
|
import"./index-cpjk5jd2.js";
|
|
194
|
-
import"./index-
|
|
193
|
+
import"./index-m8va3mma.js";
|
|
195
194
|
import"./index-58e3y90n.js";
|
|
196
195
|
import"./index-1zx87sdm.js";
|
|
197
196
|
import {
|
|
@@ -208,7 +207,7 @@ import {
|
|
|
208
207
|
estimateTokens
|
|
209
208
|
} from "./index-b88dwwrh.js";
|
|
210
209
|
import"./index-x9k3mqrf.js";
|
|
211
|
-
import"./index-
|
|
210
|
+
import"./index-j43m40zd.js";
|
|
212
211
|
import {
|
|
213
212
|
needsBlockedRead,
|
|
214
213
|
markHostUnservedRow,
|
|
@@ -244,28 +243,29 @@ import {
|
|
|
244
243
|
cleanUserText2,
|
|
245
244
|
readRawSessionMessageIdOrdinalsForRange2,
|
|
246
245
|
readRawSessionMessageOrdinalById2
|
|
247
|
-
} from "./index-
|
|
246
|
+
} from "./index-dn2ke3b9.js";
|
|
248
247
|
import {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
248
|
+
BoundedSessionMap,
|
|
249
|
+
recordToolDefinitionSet,
|
|
250
|
+
getCurrentToolSetHash
|
|
251
|
+
} from "./index-cfaet9cg.js";
|
|
252
|
+
import"./index-xbbgcwd2.js";
|
|
253
253
|
import"./index-wfybj1dw.js";
|
|
254
254
|
import {
|
|
255
255
|
deleteChunkEmbedBackoffForSession2
|
|
256
|
-
} from "./index-
|
|
256
|
+
} from "./index-6tmf87w0.js";
|
|
257
257
|
import {
|
|
258
258
|
invalidateAutoEmbedSession,
|
|
259
259
|
clearEmbedSessionState,
|
|
260
260
|
retainProjectEmbedding2
|
|
261
|
-
} from "./index-
|
|
261
|
+
} from "./index-sgchhbvy.js";
|
|
262
262
|
import"./index-fr0wbhdn.js";
|
|
263
263
|
import"./index-9q1g3c5q.js";
|
|
264
264
|
import"./index-fb3zxn06.js";
|
|
265
265
|
import {
|
|
266
266
|
renderUserFacingFailure,
|
|
267
267
|
userFacingFailureCode
|
|
268
|
-
} from "./index-
|
|
268
|
+
} from "./index-mphkpyap.js";
|
|
269
269
|
import {
|
|
270
270
|
createTagger,
|
|
271
271
|
cavemanWordRulesForLanguage,
|
|
@@ -274,29 +274,29 @@ import {
|
|
|
274
274
|
EmergencyFailClosedError,
|
|
275
275
|
DegradedPassRefusalError,
|
|
276
276
|
isSyntheticHeadMessage2
|
|
277
|
-
} from "./index-
|
|
277
|
+
} from "./index-rp78nqvr.js";
|
|
278
278
|
import"./index-qgh1qwjj.js";
|
|
279
279
|
import"./index-qt1qqasc.js";
|
|
280
280
|
import"./index-kfyb3k6n.js";
|
|
281
281
|
import"./index-4dhv7mqz.js";
|
|
282
282
|
import"./index-51rdvtkz.js";
|
|
283
|
-
import"./index-
|
|
283
|
+
import"./index-e5b61ty6.js";
|
|
284
284
|
import"./index-jjvbk92s.js";
|
|
285
285
|
import {
|
|
286
286
|
pushNotification2,
|
|
287
287
|
isTuiConnected2
|
|
288
288
|
} from "./index-x8a7jmkh.js";
|
|
289
289
|
import"./index-rrv26qjz.js";
|
|
290
|
-
import"./index-
|
|
291
|
-
import"./index-
|
|
292
|
-
import"./index-
|
|
290
|
+
import"./index-w55zp7kf.js";
|
|
291
|
+
import"./index-r3bteyev.js";
|
|
292
|
+
import"./index-va2g2q57.js";
|
|
293
293
|
import"./index-gp3kcpc4.js";
|
|
294
294
|
import {
|
|
295
295
|
detectConflicts
|
|
296
296
|
} from "./index-4pnsgvfk.js";
|
|
297
297
|
import"./index-fmsr7v69.js";
|
|
298
298
|
import"./index-kaqs6h31.js";
|
|
299
|
-
import"./index-
|
|
299
|
+
import"./index-zn2n24yr.js";
|
|
300
300
|
import {
|
|
301
301
|
isDreamerRunnable,
|
|
302
302
|
isSmartNoteSurfaceAvailable,
|
|
@@ -4985,12 +4985,18 @@ function applyV2PromptSurfaceTools(draft, runtime, config, smartNotesEnabled = t
|
|
|
4985
4985
|
function recordV2ToolDefinitions(draft) {
|
|
4986
4986
|
if (!draft.tools)
|
|
4987
4987
|
return;
|
|
4988
|
+
const tools = [];
|
|
4988
4989
|
for (const [id, tool] of Object.entries(draft.tools)) {
|
|
4989
4990
|
if (!tool)
|
|
4990
4991
|
continue;
|
|
4991
4992
|
recordToolParameters(id, tool.input);
|
|
4992
|
-
|
|
4993
|
+
tools.push({
|
|
4994
|
+
id,
|
|
4995
|
+
description: typeof tool.description === "string" ? tool.description : "",
|
|
4996
|
+
parameters: tool.input
|
|
4997
|
+
});
|
|
4993
4998
|
}
|
|
4999
|
+
recordToolDefinitionSet(draft.model.providerID, draft.model.id, draft.agent, tools, draft.sessionID);
|
|
4994
5000
|
}
|
|
4995
5001
|
async function applyV2SystemPrompt(systemPrompt, draft) {
|
|
4996
5002
|
resolveCtxReduceAvailabilityFromMessages(draft.sessionID, draft.messages.map((message) => ({
|
|
@@ -5643,7 +5649,7 @@ async function registerContext(context) {
|
|
|
5643
5649
|
projectDirectory: directory,
|
|
5644
5650
|
hardSignals: {
|
|
5645
5651
|
systemHash: state.systemPromptHash ?? "",
|
|
5646
|
-
toolSetHash: getCurrentToolSetHash(draft.model.providerID, draft.model.id, draft.agent),
|
|
5652
|
+
toolSetHash: getCurrentToolSetHash(draft.model.providerID, draft.model.id, draft.agent, draft.sessionID),
|
|
5647
5653
|
modelKey: `${draft.model.providerID}/${draft.model.id}`,
|
|
5648
5654
|
cacheExpired: false,
|
|
5649
5655
|
lastResponseTime: state.lastResponseTime
|
|
@@ -6031,7 +6037,7 @@ async function registerContext(context) {
|
|
|
6031
6037
|
const model = liveModels.get(sessionId);
|
|
6032
6038
|
if (!model)
|
|
6033
6039
|
return "";
|
|
6034
|
-
return getCurrentToolSetHash(model.providerID, model.modelID, agents.get(sessionId));
|
|
6040
|
+
return getCurrentToolSetHash(model.providerID, model.modelID, agents.get(sessionId), sessionId);
|
|
6035
6041
|
},
|
|
6036
6042
|
channel1StateBySession: channel1,
|
|
6037
6043
|
historyRefreshSessions,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureMemoryEmbeddings2
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
3
|
+
} from "./index-e5b61ty6.js";
|
|
4
|
+
import"./index-sgchhbvy.js";
|
|
5
5
|
import"./index-4dhv7mqz.js";
|
|
6
6
|
import"./index-qt1qqasc.js";
|
|
7
7
|
import"./index-51rdvtkz.js";
|
|
8
8
|
import"./index-nxrsns5x.js";
|
|
9
9
|
import"./index-kfyb3k6n.js";
|
|
10
|
-
import"./index-
|
|
10
|
+
import"./index-6tmf87w0.js";
|
|
11
11
|
import"./index-wfybj1dw.js";
|
|
12
12
|
import"./index-kq5w68dp.js";
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-
|
|
13
|
+
import"./index-xbbgcwd2.js";
|
|
14
|
+
import"./index-m8va3mma.js";
|
|
15
15
|
import"./index-v0p37hm2.js";
|
|
16
16
|
import"./index-t5pck3ss.js";
|
|
17
17
|
import"./index-b88dwwrh.js";
|
|
@@ -1,89 +1,145 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool-definition token measurement store.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Every provider request carries the definitions of the tools offered on it,
|
|
5
|
+
* and those definitions take room in the context window. This store measures
|
|
6
|
+
* them so estimates of a request's size can include them. Each tool's
|
|
7
|
+
* description + JSON-schema parameters is tokenized with the same Claude
|
|
8
|
+
* tokenizer used everywhere else in the plugin and stored per tool under a
|
|
9
|
+
* `${providerID}/${modelID}/${agentName}` route key.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* What a total counts: the tools of the current request. A tool the host
|
|
12
|
+
* stopped offering, or a tool another session was offered, must not add to it
|
|
13
|
+
* for long, and a tool the request does carry must never be left out. The
|
|
14
|
+
* totals feed the 95% size refusal and the replay fits as a trusted figure, so
|
|
15
|
+
* counting too few tools is the dangerous direction; counting a few too many
|
|
16
|
+
* for a while is the safe one. How the current request's tools are known
|
|
17
|
+
* depends on the host:
|
|
15
18
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* - OpenCode 1 fires its `tool.definition` hook once per tool per
|
|
20
|
+
* `ToolRegistry.tools()` call (once per request, all tools at once, before
|
|
21
|
+
* the messages transform of that request), with `{ toolID }` as input and
|
|
22
|
+
* no session and no "last tool" signal. Calls on one route can run at the
|
|
23
|
+
* same time and their fires interleave, so fires cannot be grouped into
|
|
24
|
+
* requests. Instead a route's total counts every tool fired within
|
|
25
|
+
* `ACTIVITY_WINDOW_MS` of the route's latest fire, measured on the route's
|
|
26
|
+
* own activity clock (see `advanceClock`): idle time does not age a tool,
|
|
27
|
+
* so an idle route keeps its whole set, and a tool leaves only after the
|
|
28
|
+
* route has gone on firing for ten minutes without it.
|
|
29
|
+
* - OpenCode 2 has no such hook, but each request draft carries its whole tool
|
|
30
|
+
* set, so `recordToolDefinitionSet` replaces the route's set with exactly
|
|
31
|
+
* that set and remembers it for the draft's session. A read with that
|
|
32
|
+
* session id returns that session's own set, even when another session on
|
|
33
|
+
* the same route was offered different tools since.
|
|
20
34
|
*
|
|
21
35
|
* Persistence (v9+): measurements are also written to SQLite so that a
|
|
22
|
-
* plugin restart can
|
|
23
|
-
*
|
|
24
|
-
* the
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
36
|
+
* plugin restart can show a "Tool Defs" figure before the first request of
|
|
37
|
+
* the new process. A row is deleted when its tool leaves the route's count,
|
|
38
|
+
* so the table holds each route's recent set. Rows loaded at startup count as
|
|
39
|
+
* if fired at load time: until the route's first live fire, and on OpenCode 1
|
|
40
|
+
* until the route has gone on firing for `ACTIVITY_WINDOW_MS` without them.
|
|
41
|
+
* The exception is rows an older version of this store wrote: it never
|
|
42
|
+
* deleted a row, so its rows can hold every tool a route was ever offered
|
|
43
|
+
* (the overcount reported in GitHub issue 797). Those "legacy" rows count
|
|
44
|
+
* only until the route's first live fire. Which rows are legacy is told by a
|
|
45
|
+
* marker in `schema_migrations_meta` (see `WINDOWED_SINCE_KEY`). If
|
|
46
|
+
* `setDatabase()` hasn't been called yet (cold path before openDatabase
|
|
47
|
+
* completes), measurements still update the in-memory map and are written
|
|
48
|
+
* once a database is bound.
|
|
28
49
|
*
|
|
29
50
|
* Hot-path optimization: `tool.definition` fires once per tool per LLM
|
|
30
51
|
* flight (~58 tools × 5–18ms SQLite write = ~1.4s of redundant work per
|
|
31
52
|
* flight on large MC databases). Tool descriptions and parameters almost
|
|
32
|
-
* never change between flights, so
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
53
|
+
* never change between flights, so each tool keeps the content fingerprint of
|
|
54
|
+
* its last measurement and an identical fire only refreshes its last-fire
|
|
55
|
+
* time, without tokenizing or writing. A tool that left the count keeps its
|
|
56
|
+
* fingerprint and token count in a small per-route cache, so when it comes
|
|
57
|
+
* back unchanged it is not tokenized again, and its row is written again only
|
|
58
|
+
* if it was actually deleted. Any tool whose description or schema actually
|
|
59
|
+
* changed (e.g. MCP server restart, OpenCode upgrade) is re-measured. Cached
|
|
60
|
+
* prepared statements avoid repeated `db.prepare()` compile cost.
|
|
39
61
|
*/
|
|
40
62
|
import type { Database } from "../../shared/sqlite";
|
|
41
|
-
/**
|
|
42
|
-
* Hash the observed names in the provider tool set for one model/agent route.
|
|
43
|
-
*
|
|
44
|
-
* Tool names alone identify the prefix change this marker explains. Schema
|
|
45
|
-
* fingerprints remain necessary for measurement de-duplication, but including
|
|
46
|
-
* them here would add cost without improving cache-bust attribution. An empty
|
|
47
|
-
* string means the route has not reported any tool definitions, not an empty
|
|
48
|
-
* provider `tools` array.
|
|
49
|
-
*/
|
|
50
|
-
export declare function getCurrentToolSetHash(providerID: string, modelID: string, agentName: string | undefined): string;
|
|
51
|
-
/** Hash observed tool IDs and full schemas so usage is reused only for the same definitions. */
|
|
52
|
-
export declare function getToolDefinitionMeasurementSignature(providerID: string, modelID: string, agentName: string | undefined): string | undefined;
|
|
53
63
|
/**
|
|
54
64
|
* Register the database used to persist measurements. Called by
|
|
55
65
|
* openDatabase() after runMigrations() has ensured the
|
|
56
|
-
* `tool_definition_measurements` table exists. Subsequent
|
|
57
|
-
*
|
|
66
|
+
* `tool_definition_measurements` table exists. Subsequent measurements will
|
|
67
|
+
* write through to SQLite.
|
|
58
68
|
*/
|
|
59
69
|
export declare function setDatabase(db: Database): void;
|
|
60
70
|
/**
|
|
61
|
-
* Populate the in-memory
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
71
|
+
* Populate the in-memory store from the `tool_definition_measurements` table.
|
|
72
|
+
* Called once at startup after setDatabase(), before the first sidebar
|
|
73
|
+
* snapshot or status query, so the sidebar's "Tool Defs" segment shows a
|
|
74
|
+
* figure immediately on restart instead of 0.
|
|
75
|
+
*
|
|
76
|
+
* Loaded rows count as if their tools fired at load time: they stand in for
|
|
77
|
+
* the route until its first live fire and then, on OpenCode 1, until the
|
|
78
|
+
* route has gone on firing for the activity window without them. A read in
|
|
79
|
+
* the middle of the first request after a restart therefore still counts the
|
|
80
|
+
* stored set. Legacy rows (written before `WINDOWED_SINCE_KEY`, or in a table
|
|
81
|
+
* without it) can hold every tool a route was ever offered, so they stop
|
|
82
|
+
* counting at the route's first live fire. Since this process never measured
|
|
83
|
+
* a loaded row's content, it carries no fingerprint.
|
|
66
84
|
*
|
|
67
85
|
* Idempotent: re-running over the same DB reapplies the same values; the
|
|
68
|
-
*
|
|
86
|
+
* per-route tool key ensures duplicates overwrite rather than accumulate.
|
|
87
|
+
* Routes already measured in this process are left alone.
|
|
69
88
|
*/
|
|
70
89
|
export declare function loadToolDefinitionMeasurements(db: Database): void;
|
|
71
90
|
/**
|
|
72
|
-
*
|
|
73
|
-
* from the `tool.definition` plugin hook once per tool per flight.
|
|
74
|
-
*
|
|
75
|
-
*
|
|
91
|
+
* OpenCode 1: measure one tool the host is offering on the current request.
|
|
92
|
+
* Called from the `tool.definition` plugin hook once per tool per flight.
|
|
93
|
+
* `sessionId` is the session the request is believed to belong to (the hook
|
|
94
|
+
* carries none); it only records which route that session last flew.
|
|
95
|
+
*/
|
|
96
|
+
export declare function recordToolDefinition(providerID: string, modelID: string, agentName: string | undefined, toolID: string, description: string, parameters: unknown, sessionId?: string): void;
|
|
97
|
+
/**
|
|
98
|
+
* OpenCode 2: record the exact tool set one request carries. The route's set
|
|
99
|
+
* becomes exactly `tools` (tools no longer offered are forgotten and their
|
|
100
|
+
* stored rows deleted), and `sessionId`'s figure becomes this set until its
|
|
101
|
+
* next request. Unchanged tools are not tokenized or written again.
|
|
102
|
+
*/
|
|
103
|
+
export declare function recordToolDefinitionSet(providerID: string, modelID: string, agentName: string | undefined, tools: Iterable<{
|
|
104
|
+
id: string;
|
|
105
|
+
description: string;
|
|
106
|
+
parameters: unknown;
|
|
107
|
+
}>, sessionId?: string): void;
|
|
108
|
+
/**
|
|
109
|
+
* Hash the tool names of the current tool set for one model/agent route.
|
|
110
|
+
*
|
|
111
|
+
* Tool names alone identify the prefix change this marker explains. Schema
|
|
112
|
+
* fingerprints remain necessary for measurement de-duplication, but including
|
|
113
|
+
* them here would add cost without improving cache-bust attribution. An empty
|
|
114
|
+
* string is returned both before any measurement and for a request that
|
|
115
|
+
* carried no tools; it does not tell those cases apart.
|
|
116
|
+
*/
|
|
117
|
+
export declare function getCurrentToolSetHash(providerID: string, modelID: string, agentName: string | undefined, sessionId?: string): string;
|
|
118
|
+
/**
|
|
119
|
+
* Hash the current tool set's IDs and full schemas so provider usage is reused
|
|
120
|
+
* only for the same definitions. Undefined when a counted tool's content was
|
|
121
|
+
* not measured in this process.
|
|
122
|
+
*/
|
|
123
|
+
export declare function getToolDefinitionMeasurementSignature(providerID: string, modelID: string, agentName: string | undefined, sessionId?: string): string | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Returns the measured tokens of the current tool set for a
|
|
126
|
+
* `{provider, model, agent}` route, or `undefined` when never measured (e.g.
|
|
127
|
+
* fresh session before first turn). With `sessionId`, an OpenCode 2 session
|
|
128
|
+
* whose last request flew this route gets that request's exact set.
|
|
76
129
|
*/
|
|
77
|
-
export declare function
|
|
130
|
+
export declare function getMeasuredToolDefinitionTokens(providerID: string, modelID: string, agentName: string | undefined, sessionId?: string): number | undefined;
|
|
78
131
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
132
|
+
* The tool-definition total of the route `sessionId` last flew: on OpenCode 2
|
|
133
|
+
* the exact set of that session's last request, on OpenCode 1 the route's
|
|
134
|
+
* recent-activity total. For a session whose current route has no
|
|
135
|
+
* measurement yet (for example right after a model switch), this is the best
|
|
136
|
+
* evidence of the tools it is offered; undefined when the session never had
|
|
137
|
+
* its tools measured.
|
|
81
138
|
*/
|
|
82
|
-
export declare function
|
|
83
|
-
export declare function getMeasuredToolDefinitionTokens(providerID: string, modelID: string, agentName: string | undefined): number | undefined;
|
|
139
|
+
export declare function getSessionToolDefinitionTokens(sessionId: string | undefined): number | undefined;
|
|
84
140
|
/** Test helper: reset the store so suites don't leak measurements. */
|
|
85
141
|
export declare function __resetToolDefinitionMeasurements(): void;
|
|
86
|
-
/** Inspection helper: snapshot
|
|
142
|
+
/** Inspection helper: snapshot each route's current set (for debug logging/tests). */
|
|
87
143
|
export declare function getToolDefinitionSnapshot(): Array<{
|
|
88
144
|
key: string;
|
|
89
145
|
totalTokens: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-definition-tokens.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/tool-definition-tokens.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool-definition-tokens.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/tool-definition-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAa,MAAM,qBAAqB,CAAC;AAqd/D;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CA4B9C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CA0CjE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,OAAO,EACnB,SAAS,CAAC,EAAE,MAAM,GACnB,IAAI,CAgCN;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACnC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,EAAE,QAAQ,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,EACzE,SAAS,CAAC,EAAE,MAAM,GACnB,IAAI,CAiCN;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,SAAS,CAAC,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,qCAAqC,CACjD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,SAAS,CAAC,EAAE,MAAM,GACnB,MAAM,GAAG,SAAS,CAEpB;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC3C,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,SAAS,CAAC,EAAE,MAAM,GACnB,MAAM,GAAG,SAAS,CAEpB;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAOhG;AAED,sEAAsE;AACtE,wBAAgB,iCAAiC,IAAI,IAAI,CAQxD;AAED,sFAAsF;AACtF,wBAAgB,yBAAyB,IAAI,KAAK,CAAC;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC,CASD"}
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
* (storage-caveman-rules.ts)
|
|
41
41
|
*/
|
|
42
42
|
import type { ContextDatabase } from "../../features/magic-context/storage";
|
|
43
|
+
import { type CavemanReplayState } from "../../features/magic-context/storage-caveman-rules";
|
|
43
44
|
import type { TagEntry } from "../../features/magic-context/types";
|
|
44
45
|
import { type CavemanWordRules } from "./caveman";
|
|
45
46
|
import type { TagTarget } from "./tag-messages";
|
|
@@ -74,6 +75,19 @@ export declare function computeTargetDepth(positionIndex: number, totalEligible:
|
|
|
74
75
|
export declare function applyCavemanCleanup(sessionId: string, db: ContextDatabase, targets: Map<number, TagTarget>, tags: TagEntry[], config: CavemanCleanupConfig & {
|
|
75
76
|
protectedCutoff: number | null;
|
|
76
77
|
}): CavemanCleanupResult;
|
|
78
|
+
/**
|
|
79
|
+
* The text `applyCompressedText` leaves on the wire for one tag, computed
|
|
80
|
+
* without a target, and whether one of its writes took the message's
|
|
81
|
+
* reasoning off the wire (the original-rule write is a drop). Null when it
|
|
82
|
+
* would leave the text unchanged. Used for a part that is no longer a target
|
|
83
|
+
* but must keep serving the bytes earlier passes served (another plugin's
|
|
84
|
+
* appended text that an older release compressed). cavemanCompress is pure
|
|
85
|
+
* in (text, level, rules, word rules), so equal input text gives equal bytes.
|
|
86
|
+
*/
|
|
87
|
+
export declare function cavemanReplayText(tagNumber: number, originalText: string, depth: number, state: CavemanReplayState, textPrefix: string): {
|
|
88
|
+
text: string;
|
|
89
|
+
dropsReasoning: boolean;
|
|
90
|
+
} | null;
|
|
77
91
|
/**
|
|
78
92
|
* Re-apply persisted caveman compression on every transform pass (defer
|
|
79
93
|
* included). This is the cache-stability counterpart to applyCavemanCleanup.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caveman-cleanup.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/caveman-cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"caveman-cleanup.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/caveman-cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EACH,KAAK,kBAAkB,EAG1B,MAAM,oDAAoD,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAEnE,OAAO,EAGH,KAAK,gBAAgB,EAGxB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAahD,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,mGAAmG;IACnG,SAAS,CAAC,EAA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uild or a repair, so retrying on every trigger could never succeed.
|
|
13
13
|
*/
|
|
14
14
|
export declare const STORED_COMPARTMENT_FAILURE_BACKOFF_MS: number;
|
|
15
|
+
/**
|
|
16
|
+
* Whether a stale-snapshot detail proves the serving thread's ordinal ranks
|
|
17
|
+
* disagree with the exact read on a check that never moves by itself: one of
|
|
18
|
+
* the `offset`, `protectedTailStart` or `eligibleEnd` boundary id checks found
|
|
19
|
+
* a different message id at its ordinal, or the session shrank (deleted rows
|
|
20
|
+
* shift every later ordinal). The `last` id moves every turn as the live tail
|
|
21
|
+
* grows, so a changed last id alone never proves drift. Other stale reasons —
|
|
22
|
+
* stored compartments moved, raw content changed, the model or limit changed
|
|
23
|
+
* — say nothing about the ranks.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isServingOrdinalDriftSignal(detail: string | undefined): boolean;
|
|
15
26
|
export interface DanglingPublicationBoundary {
|
|
16
27
|
sequence: number;
|
|
17
28
|
side: "start" | "end";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compartment-runner-incremental.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-incremental.ts"],"names":[],"mappings":"AAuEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"compartment-runner-incremental.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-incremental.ts"],"names":[],"mappings":"AAuEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAoF9E,wBAAgB,2BAA2B,CACvC,EAAE,EAAE,2BAA2B,CAAC,IAAI,CAAC,EACrC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,aAAa,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,GAC1E,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAwBvC;AAeD;;;;GAIG;AACH,eAAO,MAAM,qCAAqC,QAAiB,CAAC;AAwBpE;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAI/E;AA4BD,MAAM,WAAW,2BAA2B;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;+EAC+E;AAC/E,wBAAgB,+BAA+B,CAC3C,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC,EACF,aAAa,GAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAkC,GAC5F,2BAA2B,GAAG,IAAI,CAkBpC;AAED,+DAA+D;AAC/D,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGhE;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CA2yC1F"}
|
|
@@ -28,6 +28,13 @@ export interface FinalWireTokenEstimateInput {
|
|
|
28
28
|
providerID: string | undefined;
|
|
29
29
|
modelID: string | undefined;
|
|
30
30
|
agentName: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The session the request belongs to. On OpenCode 2 it selects the exact
|
|
33
|
+
* tool set this session's request carries. For a route with no measurement
|
|
34
|
+
* it names the session whose last known tool figure may stand in: its
|
|
35
|
+
* exact set on OpenCode 2, or its last route's activity total on OpenCode 1.
|
|
36
|
+
*/
|
|
37
|
+
sessionId?: string;
|
|
31
38
|
systemPromptHash?: string;
|
|
32
39
|
/** Bound tokenizer work for refusal checks; ordinary admission uses its
|
|
33
40
|
* separate fit estimator. */
|
|
@@ -44,8 +51,8 @@ export interface FinalWireTokenEstimateInput {
|
|
|
44
51
|
* No durable session aggregate or another route's usage can stand in for this.
|
|
45
52
|
*/
|
|
46
53
|
export declare function createFinalWireUsageTracker(): {
|
|
47
|
-
estimate(sessionId: string,
|
|
48
|
-
capture(sessionId: string,
|
|
54
|
+
estimate(sessionId: string, request: FinalWireTokenEstimateInput, limit?: number): FinalWireTokenEstimate;
|
|
55
|
+
capture(sessionId: string, request: FinalWireTokenEstimateInput): void;
|
|
49
56
|
};
|
|
50
57
|
export declare function opaqueThinkingFallbackSteps(messages: readonly MessageLike[]): number;
|
|
51
58
|
export interface FinalWireTokenEstimate {
|
|
@@ -62,7 +69,8 @@ export interface FinalWireTokenEstimate {
|
|
|
62
69
|
/**
|
|
63
70
|
* True when the tool-definition figure is this route's own measurement. When
|
|
64
71
|
* false, `toolDefinitionTokens` is either unknown or an upper envelope taken
|
|
65
|
-
* from
|
|
72
|
+
* from this session's last known tool figure (its exact set on OpenCode 2,
|
|
73
|
+
* its last route's activity total on OpenCode 1).
|
|
66
74
|
*/
|
|
67
75
|
toolDefinitionsMeasured?: boolean;
|
|
68
76
|
/** Unscaled transform-array/system/tool measurement; provider framing is unmeasured. */
|
|
@@ -76,7 +84,7 @@ export interface FinalWireTokenEstimate {
|
|
|
76
84
|
* Calibrated provider mass for reading context pressure, not for fit. A
|
|
77
85
|
* seeded model gets its measured ratios, an unseeded model counts at the
|
|
78
86
|
* neutral 1:1 ratio, and tool definitions this route has not measured count
|
|
79
|
-
* at the
|
|
87
|
+
* at the session's last known tool figure, without the fit envelope.
|
|
80
88
|
* `tokens` keeps the fit envelope for admission and must not be read as a
|
|
81
89
|
* pressure reading: for an unseeded model it doubles the whole request.
|
|
82
90
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"final-wire-token-estimate.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/final-wire-token-estimate.ts"],"names":[],"mappings":"AAmBA,OAAO,KA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