@cortexkit/opencode-magic-context 0.49.53 → 0.49.54
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/{context-p6r0bk7a.js → context-vx5gw5h2.js} +43 -45
- package/dist/{embedding-backfill-qes2kf1c.js → embedding-backfill-2dvf3rcn.js} +4 -4
- package/dist/embedding-worker.js +2 -2
- package/dist/hooks/magic-context/emergency-drop.d.ts +75 -2
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +14 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts +12 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +2 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/index-29ff546v.js +2747 -0
- package/dist/{index-85chg6fw.js → index-2vsd5064.js} +3 -3
- package/dist/{index-pgbmbtdq.js → index-567xsm72.js} +7 -5
- package/dist/{index-wpab17w4.js → index-5gqszjq9.js} +4 -4
- package/dist/{index-a6bxwv4a.js → index-5ptp2de1.js} +6 -8
- package/dist/{index-jjy5a5w0.js → index-6nqz8hsz.js} +16 -5
- package/dist/{index-a6aqpfp6.js → index-9mggb1nv.js} +403 -1
- package/dist/{index-p7ssfv6p.js → index-9n6mdfqy.js} +88 -90
- package/dist/{index-esm4farg.js → index-a3n2dczz.js} +2 -2
- package/dist/{index-7wasafnb.js → index-b6rdv8re.js} +1 -1
- package/dist/{index-3b5k5vma.js → index-by14cr73.js} +8 -8
- package/dist/{index-25tm250q.js → index-dhdv88e5.js} +1 -1
- package/dist/{index-5684dzbv.js → index-eyr425dx.js} +186 -123
- package/dist/{index-3hhq18q0.js → index-h62j8z2r.js} +1 -1
- package/dist/{index-kwpweqzs.js → index-pdh4tdcq.js} +1 -1
- package/dist/{index-n3rxwtwt.js → index-sk6p6esd.js} +3726 -2526
- package/dist/{index-pb8ysnq2.js → index-sv5tn72j.js} +1 -1
- package/dist/{index-2m54t4g1.js → index-sx1sppd6.js} +2 -2
- package/dist/{index-2ctn7q09.js → index-tx8nfw85.js} +9 -13
- package/dist/{index-chjsdqg6.js → index-xj5bap1r.js} +50 -50
- package/dist/{index-rbs27k1d.js → index-xstbytjn.js} +1 -1
- package/dist/{index-3h0wyv22.js → index-xvtjwhm6.js} +3 -3
- package/dist/{index-fbs0f5ch.js → index-yamsmkmh.js} +4 -4
- package/dist/index.js +55 -57
- package/dist/{message-index-bounded-7p3064st.js → message-index-bounded-xav3h8qe.js} +5 -6
- package/dist/migration-worker.js +3 -4
- package/dist/{project-embedding-registry-m8t547fb.js → project-embedding-registry-f2azrq24.js} +3 -3
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-cyks9yx4.js → read-session-chunk-70aam2c1.js} +4 -5
- package/dist/{recomp-orchestrator-d4nks9da.js → recomp-orchestrator-wbm4kpq9.js} +15 -16
- package/dist/{render-gc1fn4nz.js → render-73vrt30h.js} +10 -11
- package/dist/{search-archive-hdrfjgv8.js → search-archive-ew4c3bsw.js} +6 -7
- package/dist/{search-1bjy7yhc.js → search-jfwb4ms3.js} +13 -14
- package/dist/{storage-tags-kdb4qsyq.js → storage-tags-arnkn5t1.js} +4 -2
- package/dist/{transform-postprocess-phase-9e53b1dr.js → transform-postprocess-phase-mt4dcbhd.js} +16 -17
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/chunk-embedding-write-worker.js +3 -4
- package/dist/v2/{context-1p22880w.js → context-13er940g.js} +200 -137
- package/dist/v2/{embedding-backfill-bwcmw1te.js → embedding-backfill-48qbnh7p.js} +4 -4
- package/dist/v2/embedding-worker.js +2 -2
- package/dist/v2/{message-index-bounded-mjpxz7wp.js → message-index-bounded-sw8hyqw1.js} +5 -6
- package/dist/v2/migration-worker.js +3 -4
- package/dist/v2/{project-embedding-registry-7qcs8c61.js → project-embedding-registry-kwahtjgg.js} +3 -3
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-cxk2kssy.js → read-session-chunk-nqkn0yb4.js} +4 -5
- package/dist/v2/{recomp-orchestrator-e560ryjm.js → recomp-orchestrator-cdkfynz4.js} +15 -16
- package/dist/v2/{render-rk17pvy0.js → render-a7j6fqbd.js} +10 -11
- package/dist/v2/{search-kvzyj2mf.js → search-8dc9ex0a.js} +12 -13
- package/dist/v2/{search-archive-a51g9sp7.js → search-archive-3a36887a.js} +6 -7
- package/dist/v2/{server-28g1b00j.js → server-0ayyh3mx.js} +5 -7
- package/dist/v2/{server-t8n27rbt.js → server-4x0xq8a1.js} +1 -1
- package/dist/v2/{server-71bg2psk.js → server-578pc4tf.js} +3 -3
- package/dist/v2/{server-sb55ddgn.js → server-5p0bjk3y.js} +1 -1
- package/dist/v2/{server-58h6rrnx.js → server-6k0rnwbd.js} +1 -1
- package/dist/v2/{server-e37d2zt4.js → server-79tbtk5w.js} +2 -2
- package/dist/v2/{server-zq704789.js → server-7rmf6a57.js} +8 -12
- package/dist/v2/{server-jmrd7vwc.js → server-7waad75d.js} +7 -7
- package/dist/v2/{server-fh6dhx8c.js → server-96g41nad.js} +50 -50
- package/dist/v2/{server-ah1j996f.js → server-avfc9ezb.js} +4 -4
- package/dist/v2/{server-ww7xbxxf.js → server-b0357as4.js} +357 -1
- package/dist/v2/{server-77rvx3wn.js → server-beydmd68.js} +3734 -2474
- package/dist/v2/server-gge95a03.js +2687 -0
- package/dist/v2/{server-bzh1fkvd.js → server-jwydbwcx.js} +1 -1
- package/dist/v2/{server-brsx45r6.js → server-kwtnrhv3.js} +1 -1
- package/dist/v2/{server-k3vtc89v.js → server-rpmkz5ta.js} +2 -2
- package/dist/v2/{server-0ms13pc8.js → server-rz6g5xne.js} +16 -5
- package/dist/v2/{server-bjsmb6zs.js → server-v817sf79.js} +1 -1
- package/dist/v2/{server-d5zgah57.js → server-ycvqg2s3.js} +3 -3
- package/dist/v2/server.js +4 -4
- package/dist/v2/{storage-tags-rzv7y0n3.js → storage-tags-19da4c0m.js} +4 -2
- package/dist/v2/{v2-archive-reader-hsvddme0.js → v2-archive-reader-jm3d7ccj.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-ckpj1yvj.js → wrapup-orchestrator-xnqq81c4.js} +18 -18
- package/dist/{v2-archive-reader-qgqrxgrq.js → v2-archive-reader-9bbfh131.js} +1 -1
- package/dist/{wrapup-orchestrator-6189f37j.js → wrapup-orchestrator-svhee0fn.js} +16 -17
- package/package.json +1 -1
- package/dist/index-bkg4hdyh.js +0 -3865
- package/dist/index-d9vfe7xq.js +0 -16
- package/dist/index-hsv31e69.js +0 -405
- package/dist/v2/server-d9vfe7xq.js +0 -16
- package/dist/v2/server-kgq2e2hh.js +0 -361
- package/dist/v2/server-rcchadw0.js +0 -3865
|
@@ -2,12 +2,13 @@ import {
|
|
|
2
2
|
getHarness2
|
|
3
3
|
} from "./index-pavzsdc6.js";
|
|
4
4
|
import {
|
|
5
|
+
BoundedSessionMap,
|
|
5
6
|
tagRevisionKey,
|
|
6
7
|
tagIdentityRevisionKey,
|
|
7
8
|
getTemporalDecisions,
|
|
8
9
|
freezeTemporalDecisions,
|
|
9
10
|
stableStringify
|
|
10
|
-
} from "./index-
|
|
11
|
+
} from "./index-9mggb1nv.js";
|
|
11
12
|
import {
|
|
12
13
|
protectedToolTagNumbers,
|
|
13
14
|
stripPersistedAssistantText,
|
|
@@ -29,9 +30,105 @@ import {
|
|
|
29
30
|
effectiveTailHygiene,
|
|
30
31
|
assertTailHygieneContentUnchangedIfEnabled,
|
|
31
32
|
CHANNEL1_FLOOR_TOKENS,
|
|
33
|
+
decodeMergedReasoningParts,
|
|
34
|
+
readFrozenMergedReasoningParts,
|
|
35
|
+
escalationBands,
|
|
36
|
+
HYGIENE_PROVIDER_UNITS_VERSION,
|
|
37
|
+
sessionDecisionCalibration,
|
|
38
|
+
transitionSessionHygieneUnits,
|
|
39
|
+
readEpochFloorSnapshot,
|
|
40
|
+
ensureSessionMetaRow,
|
|
41
|
+
ReplayDocumentError,
|
|
42
|
+
readReplayEnvelope,
|
|
43
|
+
updateReplayDocument,
|
|
44
|
+
loadProtectedTailMeta,
|
|
45
|
+
getEmergencyInputSample,
|
|
46
|
+
setEmergencyDropSample,
|
|
47
|
+
clearEmergencyDropSample,
|
|
48
|
+
getChannel1NudgeState,
|
|
49
|
+
captureChannel1PostReduceGraceBaseline,
|
|
50
|
+
casChannel2NudgeState,
|
|
51
|
+
getNoteNudgeAnchors,
|
|
52
|
+
getAutoSearchHintDecisions,
|
|
53
|
+
appendAutoSearchHintDecision,
|
|
54
|
+
pruneNoteNudgeAnchors,
|
|
55
|
+
flushAutoSearchHintDecisionRetirement,
|
|
56
|
+
getPersistedTodoPermissionDenied,
|
|
57
|
+
setPersistedTodoPermissionDenied,
|
|
58
|
+
getPersistedTodoSyntheticAnchor,
|
|
59
|
+
setPersistedTodoSyntheticAnchor,
|
|
60
|
+
clearPersistedTodoSyntheticAnchor,
|
|
61
|
+
getPersistedCompactionMarkerState,
|
|
62
|
+
setPersistedCompactionMarkerState,
|
|
63
|
+
getDeferredClearedCompactionMarkerState,
|
|
64
|
+
retireDeferredClearedCompactionMarkerState,
|
|
65
|
+
applyStrippedPlaceholderDelta,
|
|
66
|
+
THINKING_BINDING_RECOVERY_FROZEN_PREFIX,
|
|
67
|
+
thinkingBindingRecoveryFrozenId,
|
|
68
|
+
compactionOffThinkingFrozenId,
|
|
69
|
+
compactionOffFrozenThinkingIds,
|
|
70
|
+
getThinkingBindingRecoveryTarget,
|
|
71
|
+
armThinkingBindingRecovery,
|
|
72
|
+
getMergedReasoningStrippedIds,
|
|
73
|
+
addMergedReasoningStrippedIds,
|
|
74
|
+
getTrailingBlankDecisions,
|
|
75
|
+
addTrailingBlankDecisions,
|
|
76
|
+
demoteTrailingBlankKeepDecisions,
|
|
77
|
+
addStaleReduceStrippedIds,
|
|
78
|
+
getProcessedImageMarkers,
|
|
79
|
+
addProcessedImageStrippedIds,
|
|
80
|
+
getPendingCompactionMarkerState,
|
|
81
|
+
loadPostprocessReplaySnapshot,
|
|
82
|
+
setPendingCompactionMarkerState,
|
|
83
|
+
replacePendingCompactionMarkerStateIf,
|
|
84
|
+
clearPendingCompactionMarkerStateIf,
|
|
85
|
+
getReasoningRemovalState,
|
|
86
|
+
addRemovedReasoningIds,
|
|
87
|
+
markDropLeavesReasoning,
|
|
88
|
+
detectThinkingBindingMismatch,
|
|
89
|
+
detectLatestTurnThinkingMismatch,
|
|
90
|
+
isPrefixBoundThinkingModel,
|
|
91
|
+
modelAcceptsEmptyContent,
|
|
92
|
+
isAnthropicFamilyRoute,
|
|
93
|
+
neutralizeDroppedReasoningPart,
|
|
94
|
+
restoreNeutralizedReasoningPart,
|
|
95
|
+
isNeutralizedReasoningPart,
|
|
96
|
+
makeSentinel,
|
|
97
|
+
makeWholeMessageSentinel,
|
|
98
|
+
isSentinel,
|
|
99
|
+
replaySentinelByMessageIds,
|
|
100
|
+
isInActiveAnthropicTurn,
|
|
101
|
+
hasAnthropicReasoning,
|
|
102
|
+
prepareServedShapeRepair,
|
|
103
|
+
stripSystemInjectedMessages,
|
|
104
|
+
stripDroppedPlaceholderMessages,
|
|
105
|
+
replayClearedReasoning,
|
|
106
|
+
replayStrippedInlineThinking,
|
|
107
|
+
clearOldReasoning,
|
|
108
|
+
stripClearedReasoning,
|
|
109
|
+
captureInlineThinkingRepairs,
|
|
110
|
+
stripInlineThinking,
|
|
111
|
+
findReasoningBearingAssistantIds,
|
|
112
|
+
findLatestAssistantReasoningMutationExemptMessage,
|
|
113
|
+
snapshotTrailingBlankSourceDecisions,
|
|
114
|
+
findTrailingBlankDecisionCandidates,
|
|
115
|
+
applyFrozenTrailingBlankDecisions,
|
|
116
|
+
stripReasoningFromAssistantIds,
|
|
117
|
+
findMergedReasoningStripDecisions,
|
|
118
|
+
stripReasoningFromMergedAssistants,
|
|
119
|
+
stripProcessedImages,
|
|
120
|
+
DEFAULT_KEEP_REASONING_TOKENS,
|
|
121
|
+
reasoningStepCost,
|
|
122
|
+
reasoningTextAndOpaque,
|
|
123
|
+
opencodeReasoningBudgetCutoff,
|
|
124
|
+
estimatePartImageTokens,
|
|
125
|
+
openCode2ThinkingPayload,
|
|
32
126
|
estimateEmergencyDropReclaimTokens,
|
|
33
127
|
planEmergencyDrop,
|
|
34
128
|
measureEmergencyTag,
|
|
129
|
+
snapshotEmergencyServedMass,
|
|
130
|
+
tagsSinceReading,
|
|
131
|
+
emergencyServedMassRemovedSince,
|
|
35
132
|
getPendingOps,
|
|
36
133
|
getPendingOpsCount,
|
|
37
134
|
removePendingOp,
|
|
@@ -74,7 +171,7 @@ import {
|
|
|
74
171
|
adoptNullOwnerToolTag2,
|
|
75
172
|
getCandidateToolOwners2,
|
|
76
173
|
pickNearestPriorOwner2
|
|
77
|
-
} from "./index-
|
|
174
|
+
} from "./index-sk6p6esd.js";
|
|
78
175
|
import {
|
|
79
176
|
textMentionsRecentCommit,
|
|
80
177
|
hasMeaningfulUserText2,
|
|
@@ -85,6 +182,11 @@ import {
|
|
|
85
182
|
log2,
|
|
86
183
|
sessionLog2
|
|
87
184
|
} from "./index-82dfe8en.js";
|
|
185
|
+
import {
|
|
186
|
+
isValidLanguageCode,
|
|
187
|
+
normalizeProtectedToolName,
|
|
188
|
+
mergeProtectedTools
|
|
189
|
+
} from "./index-6nqz8hsz.js";
|
|
88
190
|
import {
|
|
89
191
|
inRootAsyncContext2,
|
|
90
192
|
getTagIdentityWriteGeneration2,
|
|
@@ -122,123 +224,16 @@ import {
|
|
|
122
224
|
saveSourceContent,
|
|
123
225
|
replaceSourceContent,
|
|
124
226
|
getSourceContents
|
|
125
|
-
} from "./index-
|
|
227
|
+
} from "./index-tx8nfw85.js";
|
|
126
228
|
import {
|
|
127
229
|
cleanSearchText,
|
|
128
230
|
matchedSearchSnippet
|
|
129
|
-
} from "./index-
|
|
130
|
-
import {
|
|
131
|
-
stripSystemInjection,
|
|
132
|
-
isTextPart,
|
|
133
|
-
isToolPartWithOutput,
|
|
134
|
-
isFilePart,
|
|
135
|
-
toolPartHasUserAnswer,
|
|
136
|
-
isEditTool,
|
|
137
|
-
decodeMergedReasoningParts,
|
|
138
|
-
escalationBands,
|
|
139
|
-
HYGIENE_PROVIDER_UNITS_VERSION,
|
|
140
|
-
sessionDecisionCalibration,
|
|
141
|
-
transitionSessionHygieneUnits,
|
|
142
|
-
readEpochFloorSnapshot,
|
|
143
|
-
ensureSessionMetaRow,
|
|
144
|
-
ReplayDocumentError,
|
|
145
|
-
readReplayEnvelope,
|
|
146
|
-
updateReplayDocument,
|
|
147
|
-
loadProtectedTailMeta,
|
|
148
|
-
getEmergencyInputSample,
|
|
149
|
-
setEmergencyDropSample,
|
|
150
|
-
clearEmergencyDropSample,
|
|
151
|
-
getChannel1NudgeState,
|
|
152
|
-
captureChannel1PostReduceGraceBaseline,
|
|
153
|
-
casChannel2NudgeState,
|
|
154
|
-
getNoteNudgeAnchors,
|
|
155
|
-
getAutoSearchHintDecisions,
|
|
156
|
-
appendAutoSearchHintDecision,
|
|
157
|
-
pruneNoteNudgeAnchors,
|
|
158
|
-
flushAutoSearchHintDecisionRetirement,
|
|
159
|
-
getPersistedTodoPermissionDenied,
|
|
160
|
-
setPersistedTodoPermissionDenied,
|
|
161
|
-
getPersistedTodoSyntheticAnchor,
|
|
162
|
-
setPersistedTodoSyntheticAnchor,
|
|
163
|
-
clearPersistedTodoSyntheticAnchor,
|
|
164
|
-
getPersistedCompactionMarkerState,
|
|
165
|
-
setPersistedCompactionMarkerState,
|
|
166
|
-
getDeferredClearedCompactionMarkerState,
|
|
167
|
-
retireDeferredClearedCompactionMarkerState,
|
|
168
|
-
applyStrippedPlaceholderDelta,
|
|
169
|
-
THINKING_BINDING_RECOVERY_FROZEN_PREFIX,
|
|
170
|
-
thinkingBindingRecoveryFrozenId,
|
|
171
|
-
compactionOffThinkingFrozenId,
|
|
172
|
-
compactionOffFrozenThinkingIds,
|
|
173
|
-
getThinkingBindingRecoveryTarget,
|
|
174
|
-
armThinkingBindingRecovery,
|
|
175
|
-
getMergedReasoningStrippedIds,
|
|
176
|
-
addMergedReasoningStrippedIds,
|
|
177
|
-
getTrailingBlankDecisions,
|
|
178
|
-
addTrailingBlankDecisions,
|
|
179
|
-
demoteTrailingBlankKeepDecisions,
|
|
180
|
-
addStaleReduceStrippedIds,
|
|
181
|
-
getProcessedImageMarkers,
|
|
182
|
-
addProcessedImageStrippedIds,
|
|
183
|
-
getPendingCompactionMarkerState,
|
|
184
|
-
loadPostprocessReplaySnapshot,
|
|
185
|
-
setPendingCompactionMarkerState,
|
|
186
|
-
replacePendingCompactionMarkerStateIf,
|
|
187
|
-
clearPendingCompactionMarkerStateIf,
|
|
188
|
-
getReasoningRemovalState,
|
|
189
|
-
addRemovedReasoningIds,
|
|
190
|
-
markDropLeavesReasoning,
|
|
191
|
-
detectThinkingBindingMismatch,
|
|
192
|
-
detectLatestTurnThinkingMismatch,
|
|
193
|
-
isPrefixBoundThinkingModel,
|
|
194
|
-
modelAcceptsEmptyContent,
|
|
195
|
-
isAnthropicFamilyRoute,
|
|
196
|
-
neutralizeDroppedReasoningPart,
|
|
197
|
-
restoreNeutralizedReasoningPart,
|
|
198
|
-
isNeutralizedReasoningPart,
|
|
199
|
-
makeSentinel,
|
|
200
|
-
makeWholeMessageSentinel,
|
|
201
|
-
isSentinel,
|
|
202
|
-
replaySentinelByMessageIds,
|
|
203
|
-
isInActiveAnthropicTurn,
|
|
204
|
-
hasAnthropicReasoning,
|
|
205
|
-
prepareServedShapeRepair,
|
|
206
|
-
stripSystemInjectedMessages,
|
|
207
|
-
stripDroppedPlaceholderMessages,
|
|
208
|
-
replayClearedReasoning,
|
|
209
|
-
replayStrippedInlineThinking,
|
|
210
|
-
clearOldReasoning,
|
|
211
|
-
stripClearedReasoning,
|
|
212
|
-
captureInlineThinkingRepairs,
|
|
213
|
-
stripInlineThinking,
|
|
214
|
-
findReasoningBearingAssistantIds,
|
|
215
|
-
findLatestAssistantReasoningMutationExemptMessage,
|
|
216
|
-
snapshotTrailingBlankSourceDecisions,
|
|
217
|
-
findTrailingBlankDecisionCandidates,
|
|
218
|
-
applyFrozenTrailingBlankDecisions,
|
|
219
|
-
stripReasoningFromAssistantIds,
|
|
220
|
-
findMergedReasoningStripDecisions,
|
|
221
|
-
stripReasoningFromMergedAssistants,
|
|
222
|
-
stripProcessedImages,
|
|
223
|
-
DEFAULT_KEEP_REASONING_TOKENS,
|
|
224
|
-
reasoningStepCost,
|
|
225
|
-
reasoningTextAndOpaque,
|
|
226
|
-
opencodeReasoningBudgetCutoff,
|
|
227
|
-
estimatePartImageTokens,
|
|
228
|
-
SKELETON_REAL_INPUT_MAX_BYTES,
|
|
229
|
-
partHasCompletedResult,
|
|
230
|
-
extractToolCallObservation,
|
|
231
|
-
ToolMutationBatch,
|
|
232
|
-
createToolDropTarget
|
|
233
|
-
} from "./index-n3rxwtwt.js";
|
|
234
|
-
import {
|
|
235
|
-
isValidLanguageCode
|
|
236
|
-
} from "./index-jjy5a5w0.js";
|
|
231
|
+
} from "./index-h62j8z2r.js";
|
|
237
232
|
import {
|
|
238
233
|
getProjectEmbeddingSnapshot2,
|
|
239
234
|
embedTextForProject2,
|
|
240
235
|
embedBatchForProject2
|
|
241
|
-
} from "./index-
|
|
236
|
+
} from "./index-sx1sppd6.js";
|
|
242
237
|
import {
|
|
243
238
|
isEmbeddingHostBusy2
|
|
244
239
|
} from "./index-qt1qqasc.js";
|
|
@@ -246,15 +241,25 @@ import {
|
|
|
246
241
|
getMessageIndexEpoch,
|
|
247
242
|
isMessageIndexSearchable,
|
|
248
243
|
createAutoSearchDiagnostics
|
|
249
|
-
} from "./index-
|
|
244
|
+
} from "./index-b6rdv8re.js";
|
|
250
245
|
import {
|
|
251
246
|
openCodeDbExists,
|
|
252
247
|
withReadOnlySessionDb,
|
|
253
248
|
getMessageTimesFromOpenCodeDb
|
|
254
249
|
} from "./index-em92bp7f.js";
|
|
255
250
|
import {
|
|
256
|
-
|
|
257
|
-
|
|
251
|
+
stripSystemInjection,
|
|
252
|
+
isTextPart,
|
|
253
|
+
isToolPartWithOutput,
|
|
254
|
+
isFilePart,
|
|
255
|
+
toolPartHasUserAnswer,
|
|
256
|
+
isEditTool,
|
|
257
|
+
SKELETON_REAL_INPUT_MAX_BYTES,
|
|
258
|
+
partHasCompletedResult,
|
|
259
|
+
extractToolCallObservation,
|
|
260
|
+
ToolMutationBatch,
|
|
261
|
+
createToolDropTarget
|
|
262
|
+
} from "./index-29ff546v.js";
|
|
258
263
|
import {
|
|
259
264
|
compareOpenCodeMessagesByCanonicalOrder,
|
|
260
265
|
startCompactionMarkerCandidatePreparation,
|
|
@@ -276,14 +281,10 @@ import {
|
|
|
276
281
|
peekNoteNudgeText,
|
|
277
282
|
markNoteNudgeDelivered,
|
|
278
283
|
getActiveCompartmentRun
|
|
279
|
-
} from "./index-
|
|
284
|
+
} from "./index-xj5bap1r.js";
|
|
280
285
|
import {
|
|
281
286
|
userFacingFailureCode
|
|
282
|
-
} from "./index-
|
|
283
|
-
import {
|
|
284
|
-
normalizeProtectedToolName,
|
|
285
|
-
mergeProtectedTools
|
|
286
|
-
} from "./index-d9vfe7xq.js";
|
|
287
|
+
} from "./index-pdh4tdcq.js";
|
|
287
288
|
import {
|
|
288
289
|
getErrorMessage
|
|
289
290
|
} from "./index-y8v6yerm.js";
|
|
@@ -4766,6 +4767,10 @@ function foldExecutesThisPass(foldDue, materialized) {
|
|
|
4766
4767
|
}
|
|
4767
4768
|
|
|
4768
4769
|
// src/hooks/magic-context/heuristic-cleanup.ts
|
|
4770
|
+
var NOTHING_SERVED_BEFORE_PASS = {
|
|
4771
|
+
tags: new Map,
|
|
4772
|
+
reasoning: new Map
|
|
4773
|
+
};
|
|
4769
4774
|
var DEDUP_SAFE_TOOLS = new Set([
|
|
4770
4775
|
"grep",
|
|
4771
4776
|
"read",
|
|
@@ -4802,8 +4807,12 @@ function applyHeuristicCleanup(sessionId, db, targets, messageTagNumbers, config
|
|
|
4802
4807
|
const candidateTags = tags.filter((t) => t.status === "active" && t.type === "tool" && targets.get(t.tagNumber)?.canDrop?.());
|
|
4803
4808
|
const recentTags = new Set(candidateTags.slice().sort((a, b) => b.tagNumber - a.tagNumber).slice(0, 20).map((tag) => tag.tagNumber));
|
|
4804
4809
|
const calibration = sessionDecisionCalibration(db, sessionId);
|
|
4805
|
-
const activeTags = tags.filter((t) => t.status === "active").map((tag) =>
|
|
4810
|
+
const activeTags = tags.filter((t) => t.status === "active").map((tag) => {
|
|
4811
|
+
const measured = measureEmergencyTag(tag, targets.get(tag.tagNumber), calibration, targets.get(tag.tagNumber)?.requiresToolArcSkeleton === true || (emergency.usagePercentage ?? 0) < 95 && recentTags.has(tag.tagNumber) && hasSmallToolInput(targets.get(tag.tagNumber)));
|
|
4812
|
+
return emergency.sinceReading?.has(tag.tagNumber) ? { ...measured, sinceReading: true } : measured;
|
|
4813
|
+
});
|
|
4806
4814
|
const measuredByTag = new Map(activeTags.map((tag) => [tag.tagNumber, tag]));
|
|
4815
|
+
const removedThisPassTokens = emergencyServedMassRemovedSince(emergency.servedBeforePass ?? NOTHING_SERVED_BEFORE_PASS, targets, calibration, measuredByTag);
|
|
4807
4816
|
const droppableTags = candidateTags.flatMap((tag) => {
|
|
4808
4817
|
const measured = measuredByTag.get(tag.tagNumber);
|
|
4809
4818
|
return measured ? [measured] : [];
|
|
@@ -4814,6 +4823,7 @@ function applyHeuristicCleanup(sessionId, db, targets, messageTagNumbers, config
|
|
|
4814
4823
|
maxTag,
|
|
4815
4824
|
protectedCutoff: config.protectedCutoff,
|
|
4816
4825
|
currentTotalInputTokens: emergency.currentTotalInputTokens,
|
|
4826
|
+
removedThisPassTokens,
|
|
4817
4827
|
ceilingTokens: emergency.ceilingTokens,
|
|
4818
4828
|
usagePercentage: emergency.usagePercentage,
|
|
4819
4829
|
priorInputSample,
|
|
@@ -6361,6 +6371,38 @@ function proactiveStripStartIndex(args) {
|
|
|
6361
6371
|
return divergence;
|
|
6362
6372
|
return divergence ?? lastServed.messages.length;
|
|
6363
6373
|
}
|
|
6374
|
+
function messagesAfterReplayedThinkingStrips(args, owners, compactionOff, compactionOffFrozenThinking) {
|
|
6375
|
+
const mergedIds = compactionOff ? new Set : new Set(getMergedReasoningStrippedIds(args.db, args.sessionId));
|
|
6376
|
+
const bindingIds = compactionOff ? new Set(compactionOffFrozenThinking) : new Set([...mergedIds].filter((id) => id.startsWith(THINKING_BINDING_RECOVERY_FROZEN_PREFIX)).map((id) => id.slice(THINKING_BINDING_RECOVERY_FROZEN_PREFIX.length)));
|
|
6377
|
+
const mergedReplays = args.resolvedProviderID === "anthropic";
|
|
6378
|
+
const exactParts = mergedReplays ? readFrozenMergedReasoningParts(mergedIds) : new Map;
|
|
6379
|
+
const reasoningType = (part) => isRecord(part) && ["reasoning", "thinking", "redacted_thinking"].includes(String(part.type));
|
|
6380
|
+
const copies = [];
|
|
6381
|
+
for (const message of new Set(owners)) {
|
|
6382
|
+
const id = typeof message.info.id === "string" ? message.info.id : undefined;
|
|
6383
|
+
if (id === undefined || args.restoreThinkingMessageIds?.has(id)) {
|
|
6384
|
+
copies.push(message);
|
|
6385
|
+
continue;
|
|
6386
|
+
}
|
|
6387
|
+
const legacy = mergedReplays && mergedIds.has(id);
|
|
6388
|
+
const whole = bindingIds.has(id) || legacy;
|
|
6389
|
+
const exact = exactParts.get(id);
|
|
6390
|
+
copies.push({
|
|
6391
|
+
...message,
|
|
6392
|
+
parts: message.parts.filter((part, index) => {
|
|
6393
|
+
if (!reasoningType(part))
|
|
6394
|
+
return true;
|
|
6395
|
+
if (whole)
|
|
6396
|
+
return false;
|
|
6397
|
+
if (!exact)
|
|
6398
|
+
return true;
|
|
6399
|
+
const partId = isRecord(part) && typeof part.id === "string" ? part.id : undefined;
|
|
6400
|
+
return !exact.includes(index) && !(partId !== undefined && exact.includes(partId));
|
|
6401
|
+
})
|
|
6402
|
+
});
|
|
6403
|
+
}
|
|
6404
|
+
return copies;
|
|
6405
|
+
}
|
|
6364
6406
|
function servesThinkingBlock2(messages, providerID, modelID) {
|
|
6365
6407
|
const familyRoute = isAnthropicFamilyRoute(providerID, modelID);
|
|
6366
6408
|
for (const message of messages) {
|
|
@@ -6376,6 +6418,8 @@ function servesThinkingBlock2(messages, providerID, modelID) {
|
|
|
6376
6418
|
const records = isRecord(part.metadata) ? Object.values(part.metadata) : [];
|
|
6377
6419
|
if (records.some((record) => isRecord(record) && record.redactedData !== undefined))
|
|
6378
6420
|
return true;
|
|
6421
|
+
if (openCode2ThinkingPayload(part) !== undefined)
|
|
6422
|
+
return true;
|
|
6379
6423
|
}
|
|
6380
6424
|
}
|
|
6381
6425
|
return false;
|
|
@@ -7501,6 +7545,23 @@ async function runPostTransformPhase2(args) {
|
|
|
7501
7545
|
}
|
|
7502
7546
|
}
|
|
7503
7547
|
let autoReclaimDidMutateThisPass = false;
|
|
7548
|
+
const emergencyPlannerMayRun = shouldRunHeuristics && forceBandConfirmed && args.emergencyCeilingTokens !== undefined && args.emergencyCeilingTokens > 0;
|
|
7549
|
+
const tagsNewerThanReading = emergencyPlannerMayRun ? tagsSinceReading(args.messages, newTargets) : undefined;
|
|
7550
|
+
let servedBeforeRemovals;
|
|
7551
|
+
if (emergencyPlannerMayRun && shouldApplyPendingOps && pendingOps.length > 0) {
|
|
7552
|
+
const queued = new Set(pendingOps.map((op) => op.tagId));
|
|
7553
|
+
const owners = new Set;
|
|
7554
|
+
for (const tagNumber of queued) {
|
|
7555
|
+
const target = newTargets.get(tagNumber);
|
|
7556
|
+
if (!target?.dropReasoningParts?.length)
|
|
7557
|
+
continue;
|
|
7558
|
+
for (const { message } of target.mutationParts ?? [])
|
|
7559
|
+
owners.add(message);
|
|
7560
|
+
if (target.message)
|
|
7561
|
+
owners.add(target.message);
|
|
7562
|
+
}
|
|
7563
|
+
servedBeforeRemovals = snapshotEmergencyServedMass(args.tags.filter((tag) => queued.has(tag.tagNumber) && !tagsNewerThanReading?.has(tag.tagNumber)), newTargets, sessionDecisionCalibration(args.db, args.sessionId), messagesAfterReplayedThinkingStrips(args, owners, compactionOff, compactionOffFrozenThinking));
|
|
7564
|
+
}
|
|
7504
7565
|
logTransformTiming(args.sessionId, "pp.passDecisions", tPassDecisions, `pendingOps=${pendingOps.length}`);
|
|
7505
7566
|
try {
|
|
7506
7567
|
if (shouldApplyPendingOps) {
|
|
@@ -7552,7 +7613,9 @@ async function runPostTransformPhase2(args) {
|
|
|
7552
7613
|
currentTotalInputTokens: args.contextUsage.inputTokens,
|
|
7553
7614
|
ceilingTokens: args.emergencyCeilingTokens,
|
|
7554
7615
|
usagePercentage: args.contextUsage.percentage,
|
|
7555
|
-
passAlreadyPriced: emergencyRewriteAlreadyPriced
|
|
7616
|
+
passAlreadyPriced: emergencyRewriteAlreadyPriced,
|
|
7617
|
+
servedBeforePass: servedBeforeRemovals,
|
|
7618
|
+
sinceReading: tagsNewerThanReading
|
|
7556
7619
|
} : undefined,
|
|
7557
7620
|
routine: routineCleanupApplied,
|
|
7558
7621
|
caveman: cavemanConfig
|