@cortexkit/opencode-magic-context 0.49.27 → 0.49.29
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 +1 -1
- package/dist/config/commit-retention-recovery.d.ts +9 -0
- package/dist/config/commit-retention-recovery.d.ts.map +1 -0
- package/dist/config/index.d.ts +2 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/live-child-output-cap.d.ts.map +1 -1
- package/dist/config/live-run-config.d.ts.map +1 -1
- package/dist/config/project-security.d.ts +1 -0
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-tgnw019g.js → conflict-warning-hook-xgskea1v.js} +3 -3
- package/dist/{context-t2k97d6v.js → context-836j3vte.js} +63 -27
- package/dist/{embedding-backfill-cwnyr4fj.js → embedding-backfill-mms9nb0h.js} +2 -2
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts +2 -2
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-diff.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/indexer.d.ts +2 -0
- package/dist/features/magic-context/git-commits/indexer.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +3 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
- package/dist/features/magic-context/work-metrics.d.ts +5 -3
- package/dist/features/magic-context/work-metrics.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts +2 -0
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +5 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts +3 -1
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts +7 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +3 -2
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/replay-committed-drops.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-n8qmmd7f.js → index-093c4g1c.js} +3 -3
- package/dist/{index-89k1w6x2.js → index-a1h316s9.js} +2 -2
- package/dist/{index-fq2p158w.js → index-bps8vn9r.js} +13 -7
- package/dist/{index-tvzvjggy.js → index-gkee6p4g.js} +1 -1
- package/dist/{index-a2fz9hpa.js → index-gxkhzmjq.js} +4 -2
- package/dist/{index-4cpc59jv.js → index-h4s5jk7f.js} +1 -1
- package/dist/{index-t3rbb8wr.js → index-pe6b4bhs.js} +1 -1
- package/dist/{index-dcqk0y27.js → index-q9zvphbq.js} +104 -24
- package/dist/{index-7gbcg8xv.js → index-tx68g9nc.js} +1 -1
- package/dist/{index-4ypqzvhf.js → index-vnn5405n.js} +1 -1
- package/dist/{index-077ht5cq.js → index-waktfbjy.js} +1 -1
- package/dist/{index-qzbpbnqt.js → index-wpcdk76y.js} +343 -252
- package/dist/{index-dzfevacx.js → index-wvffze8y.js} +10 -6
- package/dist/{index-31y1mznz.js → index-wyt5m81v.js} +4 -4
- package/dist/{index-v0dhhxsq.js → index-y1qwzvxn.js} +5 -5
- package/dist/{index-yzjhx10y.js → index-zhgqgxtt.js} +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -30
- package/dist/{message-index-bounded-7ayzb2ah.js → message-index-bounded-7qsn4fd3.js} +3 -3
- package/dist/migration-worker.js +1 -1
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/embedding-bootstrap-helpers.d.ts +5 -1
- package/dist/plugin/embedding-bootstrap-helpers.d.ts.map +1 -1
- 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-94nncs5g.js → project-embedding-registry-cg281d9j.js} +1 -1
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{read-session-chunk-jzb6w9w5.js → read-session-chunk-a5d0q3m0.js} +2 -2
- package/dist/{recomp-orchestrator-02sa2ngr.js → recomp-orchestrator-na34m4c5.js} +10 -10
- package/dist/{search-spq6nfyf.js → search-0cd6hx7a.js} +7 -7
- package/dist/{search-archive-q1vw7zg4.js → search-archive-66pm17gm.js} +3 -3
- package/dist/{send-session-notification-afzzqy5b.js → send-session-notification-vz86nt79.js} +2 -2
- package/dist/{transform-postprocess-phase-6menyyxc.js → transform-postprocess-phase-27we33af.js} +10 -10
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/chunk-embedding-write-worker.js +1 -1
- package/dist/v2/{context-na0esngr.js → context-g4ptae4x.js} +215 -83
- package/dist/v2/{embedding-backfill-rh5dgsva.js → embedding-backfill-35k6czrr.js} +2 -2
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hooks/dream-timer.d.ts.map +1 -1
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-n09b74vr.js → message-index-bounded-7363502m.js} +3 -3
- package/dist/v2/migration-worker.js +1 -1
- package/dist/v2/{project-embedding-registry-6pak822h.js → project-embedding-registry-p1p10ks7.js} +1 -1
- package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
- package/dist/v2/{read-session-chunk-vpt69tw9.js → read-session-chunk-kkppfhft.js} +2 -2
- package/dist/v2/{recomp-orchestrator-txsmbnvw.js → recomp-orchestrator-f1df1gb8.js} +10 -10
- package/dist/v2/{search-dcy9b6gd.js → search-2v3xyzse.js} +7 -7
- package/dist/v2/{search-archive-t9bcz4ht.js → search-archive-v07jpw25.js} +3 -3
- package/dist/v2/{send-session-notification-vdsgnf4c.js → send-session-notification-x5nzy34v.js} +2 -2
- package/dist/v2/{server-e3hc93wk.js → server-77gznpmf.js} +1 -1
- package/dist/v2/{server-94wk1ey3.js → server-835q39kd.js} +45 -5
- package/dist/v2/{server-txbc3czn.js → server-976dxaxh.js} +10 -6
- package/dist/v2/{server-3vhxy2k5.js → server-a7x00tw8.js} +5 -5
- package/dist/v2/{server-z2n2xaeh.js → server-k9je35ev.js} +1 -1
- package/dist/v2/{server-xkvxss5g.js → server-mxzj3r0y.js} +5 -1
- package/dist/v2/{server-6avtp9jp.js → server-p0snacz3.js} +1 -1
- package/dist/v2/{server-z3mk9jdc.js → server-ph300d6m.js} +1 -1
- package/dist/v2/{server-jj9qye8y.js → server-q50ttc2g.js} +62 -21
- package/dist/v2/{server-6v3cdzsx.js → server-qc915kw2.js} +1 -1
- package/dist/v2/{server-zmcrvpm3.js → server-w79f8ejn.js} +2 -2
- package/dist/v2/{server-yqek3s4k.js → server-zh3esb0z.js} +4 -2
- package/dist/v2/server.js +3 -3
- package/dist/v2/{wrapup-orchestrator-gjkszser.js → wrapup-orchestrator-jq33fda8.js} +10 -10
- package/dist/{wrapup-orchestrator-n5h5sr1x.js → wrapup-orchestrator-f0xr7pft.js} +11 -11
- package/package.json +1 -1
- package/src/config/commit-retention-recovery.ts +34 -0
- package/src/config/index.ts +22 -2
- package/src/config/live-child-output-cap.test.ts +28 -0
- package/src/config/live-child-output-cap.ts +2 -0
- package/src/config/live-run-config.test.ts +44 -1
- package/src/config/live-run-config.ts +8 -1
- package/src/config/project-config-trust-boundary.test.ts +57 -0
- package/src/config/project-security.ts +6 -2
- package/src/shared/windows-hidden-spawns.test.ts +133 -23
|
@@ -82,6 +82,191 @@ import {
|
|
|
82
82
|
parkGitSweepNonIndexable,
|
|
83
83
|
releaseGitSweepLease
|
|
84
84
|
} from "./index-kfyb3k6n.js";
|
|
85
|
+
import {
|
|
86
|
+
getMagicContextBuiltinCommands,
|
|
87
|
+
formatConfigParseStatusLine,
|
|
88
|
+
isCommitRetentionPaused,
|
|
89
|
+
cortexKitUserConfigBasePath,
|
|
90
|
+
cortexKitProjectConfigBasePath,
|
|
91
|
+
resolveLegacyConfigSources,
|
|
92
|
+
loadPluginConfigDetailed,
|
|
93
|
+
historianRunConfig,
|
|
94
|
+
currentPluginConfigReader,
|
|
95
|
+
clampProducerAtomChars,
|
|
96
|
+
producerInputTokenLimit,
|
|
97
|
+
historianProducerReserve,
|
|
98
|
+
producerPromptFailureReason,
|
|
99
|
+
DREAMER_AGENT,
|
|
100
|
+
DREAMER_RETROSPECTIVE_AGENT,
|
|
101
|
+
DREAMER_PRIMER_INVESTIGATOR_AGENT,
|
|
102
|
+
DREAMER_MEMORY_MAPPER_AGENT,
|
|
103
|
+
DREAMER_CLASSIFIER_AGENT,
|
|
104
|
+
DREAMER_DOCS_AGENT,
|
|
105
|
+
DREAMER_REVIEWER_AGENT,
|
|
106
|
+
getCompartments,
|
|
107
|
+
getLastCompartmentEndMessage,
|
|
108
|
+
getLastCompartmentEndMessageId,
|
|
109
|
+
providerResponseFailed,
|
|
110
|
+
LkgRecoveryFenceError,
|
|
111
|
+
lkgServedArrayDigest,
|
|
112
|
+
hasCleanLkgRecoveryFence,
|
|
113
|
+
dirtyLkgRecoveryRevision,
|
|
114
|
+
ownsLkgDirtyFence,
|
|
115
|
+
invalidateCleanLkgRecoveryFence,
|
|
116
|
+
prepareLkgCaptureFence,
|
|
117
|
+
certifyCommittedLkgCapture,
|
|
118
|
+
markLkgRecoveryDirty,
|
|
119
|
+
getOrCreateSessionMeta,
|
|
120
|
+
updateSessionMeta,
|
|
121
|
+
retryPendingSessionCleanups,
|
|
122
|
+
retryPendingRustSessionCleanupsForProject,
|
|
123
|
+
requestPendingMaterialization,
|
|
124
|
+
hasPendingMaterializationOrigin,
|
|
125
|
+
clearPendingMaterialization,
|
|
126
|
+
recordSystemPromptForRequest,
|
|
127
|
+
recordHeldHeadForRequest,
|
|
128
|
+
isHeldHeadForRequest,
|
|
129
|
+
deferDeliveredSystemRefresh,
|
|
130
|
+
retirePendingSystemPromptDelivery,
|
|
131
|
+
claimLkgRequestIdentity,
|
|
132
|
+
currentLkgRequestIdentity,
|
|
133
|
+
noteCapturedLkgRequest,
|
|
134
|
+
measuredLkgPrefix,
|
|
135
|
+
saveLkgSlotToDb,
|
|
136
|
+
clearPersistedLkgSlotStrict,
|
|
137
|
+
loadPersistedLkgSlot,
|
|
138
|
+
drainStaleLkgSlots,
|
|
139
|
+
resolveLkgModelKeys,
|
|
140
|
+
createLkgEntryProjector,
|
|
141
|
+
captureLkgSlot,
|
|
142
|
+
validateAnthropicReasoningRuns,
|
|
143
|
+
validateLkgSeam,
|
|
144
|
+
replayLkg,
|
|
145
|
+
coldStartRawServedIndex,
|
|
146
|
+
coldStartUncapturedReplay,
|
|
147
|
+
noteUncertifiedNormalLkg,
|
|
148
|
+
hasProcessLocalLkgProof,
|
|
149
|
+
lkgDirtyRevision,
|
|
150
|
+
rememberLkgDirtyRevision,
|
|
151
|
+
readPersistedLkgUntaggedInputIds,
|
|
152
|
+
persistLkgUntaggedInputIds,
|
|
153
|
+
noteLkgRecoveryPrefix,
|
|
154
|
+
readLkgRecoveryPrefix,
|
|
155
|
+
noteLkgHealthyPrefix,
|
|
156
|
+
lkgRecoveryReplayUnproven,
|
|
157
|
+
lkgRecoveryEntryUnproven,
|
|
158
|
+
lkgInputIdentity,
|
|
159
|
+
beginLkgPass,
|
|
160
|
+
visitMessageContentFields,
|
|
161
|
+
contentSnapshotValue,
|
|
162
|
+
messageContentFields,
|
|
163
|
+
signatureForFields,
|
|
164
|
+
exactReusablePrefix,
|
|
165
|
+
incrementalLkgContentDigests,
|
|
166
|
+
lkgSlotRejection,
|
|
167
|
+
captureSlot,
|
|
168
|
+
getInMemorySlot,
|
|
169
|
+
getSlot,
|
|
170
|
+
forgetInMemorySlot,
|
|
171
|
+
dropSlot,
|
|
172
|
+
noteEntry,
|
|
173
|
+
getLkgSlotHeapStats,
|
|
174
|
+
TOOL_SWEEP_SCOPED_MARKER,
|
|
175
|
+
useScopedToolSweep,
|
|
176
|
+
createPreAdoptionToolSweepResolver,
|
|
177
|
+
queueMemoryMutation,
|
|
178
|
+
getMaxMemoryMutationIdForProjects,
|
|
179
|
+
GLOBAL_USER_PROFILE_PROJECT_PATH,
|
|
180
|
+
getProjectState,
|
|
181
|
+
bumpProjectUserProfileVersion,
|
|
182
|
+
createChildSessionWithFence,
|
|
183
|
+
HiddenCompletionRefusal,
|
|
184
|
+
DreamerProviderOutputFailureError,
|
|
185
|
+
withDreamerModelCooldown,
|
|
186
|
+
providerOutputFailureFromInvalidManifest,
|
|
187
|
+
extractLatestAssistantText,
|
|
188
|
+
hasLengthCappedOutput,
|
|
189
|
+
parseProviderModel,
|
|
190
|
+
modelBodyField,
|
|
191
|
+
toModelEntry,
|
|
192
|
+
isPromptTimeoutError,
|
|
193
|
+
getPromptFailureDetail,
|
|
194
|
+
raceWithSignal,
|
|
195
|
+
promptSyncWithValidatedOutputRetry,
|
|
196
|
+
normalizeSDKResponse,
|
|
197
|
+
annotateSubagentInvocationError,
|
|
198
|
+
failedInvocationStatus,
|
|
199
|
+
emptyTokenTotals,
|
|
200
|
+
sumTokensFromChildMessages,
|
|
201
|
+
recordChildInvocation,
|
|
202
|
+
createPromptAsyncTransport,
|
|
203
|
+
systemPromptFingerprint,
|
|
204
|
+
createPromptSurfaceRuntime,
|
|
205
|
+
createPromptSurfaceGuidanceEpochCache,
|
|
206
|
+
teardownChildSession,
|
|
207
|
+
getCompartmentEvents,
|
|
208
|
+
runTokenLog,
|
|
209
|
+
formatRunTokenLog,
|
|
210
|
+
buildMagicContextSection,
|
|
211
|
+
getMuralIdentity,
|
|
212
|
+
getMural,
|
|
213
|
+
modelKeyAcceptsImages,
|
|
214
|
+
resolveMuralWire,
|
|
215
|
+
USER_MEMORY_CANDIDATE_TTL_MS,
|
|
216
|
+
insertUserMemoryCandidates,
|
|
217
|
+
getUserMemoryCandidates,
|
|
218
|
+
deleteUserMemoryCandidates,
|
|
219
|
+
pruneExpiredUserMemoryCandidates,
|
|
220
|
+
insertUserMemory,
|
|
221
|
+
getActiveUserMemories,
|
|
222
|
+
updateUserMemoryContent,
|
|
223
|
+
dismissUserMemory,
|
|
224
|
+
getOpenCodeDbPath,
|
|
225
|
+
prepareCompactionMarkerCandidates,
|
|
226
|
+
removeMcOwnedCompactionMarkers,
|
|
227
|
+
MARKER_SUMMARY_TEXT,
|
|
228
|
+
markerUpdateDefinitelyDidNotCut,
|
|
229
|
+
extractM0Block,
|
|
230
|
+
formatDate,
|
|
231
|
+
TEMPORAL_MARKER_REPLAY_PATTERN,
|
|
232
|
+
collectTemporalCandidates,
|
|
233
|
+
injectTemporalMarkers,
|
|
234
|
+
getVisibleMemoryIds,
|
|
235
|
+
selectHiddenMessagesAtCompactionSeam,
|
|
236
|
+
prepareCompartmentInjection,
|
|
237
|
+
mustMaterialize,
|
|
238
|
+
trimMemoriesToBudgetV2,
|
|
239
|
+
renderMemoryBlockV2,
|
|
240
|
+
findHostCompactionWindow,
|
|
241
|
+
capturePrefixTrimSourceOrder,
|
|
242
|
+
resolveHiddenCompletionExecutor,
|
|
243
|
+
createV1HiddenCompletionExecutor,
|
|
244
|
+
readCoordinateGeneration,
|
|
245
|
+
readCoordinateRebaseNotice,
|
|
246
|
+
formatCoordinateRebaseNotice,
|
|
247
|
+
rebaseSessionCoordinatesAsync,
|
|
248
|
+
shouldWaitForNewHistorianHistory,
|
|
249
|
+
EMPTY_READ_REPLY,
|
|
250
|
+
noteTouchedAt,
|
|
251
|
+
renderGlance,
|
|
252
|
+
renderNotesById,
|
|
253
|
+
formatWriteReply,
|
|
254
|
+
onNoteTrigger,
|
|
255
|
+
clearNoteNudgeTriggerAndCooldown,
|
|
256
|
+
resetNoteNudgeCooldownOnly,
|
|
257
|
+
omitIncompleteFileTokenTotals,
|
|
258
|
+
RECOVERY_NO_HEAD_LIMIT,
|
|
259
|
+
deriveProtectedTailTokenTarget,
|
|
260
|
+
selectPerRunCap,
|
|
261
|
+
resolveOpenCodeProtectedTailBoundary,
|
|
262
|
+
getRawHistoryEligibility,
|
|
263
|
+
hasRunnableCompartmentWindow,
|
|
264
|
+
recordHighPressureNoEligibleHead,
|
|
265
|
+
noteTransformPassForExactOrdinalReads,
|
|
266
|
+
snapRangeToCompartments,
|
|
267
|
+
getActiveCompartmentRun,
|
|
268
|
+
startCompartmentAgent
|
|
269
|
+
} from "./index-q9zvphbq.js";
|
|
85
270
|
import {
|
|
86
271
|
hasTrustedAbsoluteWall,
|
|
87
272
|
applyProvenInputFloor,
|
|
@@ -177,7 +362,7 @@ import {
|
|
|
177
362
|
latestPersistedMessageForRecovery,
|
|
178
363
|
latestRealUserTurnIdFromOpenCodeDb,
|
|
179
364
|
findLastAssistantModelFromOpenCodeDb
|
|
180
|
-
} from "./index-
|
|
365
|
+
} from "./index-y1qwzvxn.js";
|
|
181
366
|
import {
|
|
182
367
|
expandToolPart,
|
|
183
368
|
askAnswerLines,
|
|
@@ -302,7 +487,7 @@ import {
|
|
|
302
487
|
readRawSessionMessageById2,
|
|
303
488
|
readSessionChunk2,
|
|
304
489
|
readRawSessionSeedTail2
|
|
305
|
-
} from "./index-
|
|
490
|
+
} from "./index-zhgqgxtt.js";
|
|
306
491
|
import {
|
|
307
492
|
BoundedSessionMap,
|
|
308
493
|
getMeasuredToolDefinitionTokens
|
|
@@ -320,7 +505,7 @@ import {
|
|
|
320
505
|
runSqliteOptimize,
|
|
321
506
|
openDatabase,
|
|
322
507
|
openCurrentDatabase
|
|
323
|
-
} from "./index-
|
|
508
|
+
} from "./index-h4s5jk7f.js";
|
|
324
509
|
import {
|
|
325
510
|
registerOwnRpcServerInstance,
|
|
326
511
|
rpcPortDir,
|
|
@@ -344,188 +529,6 @@ import {
|
|
|
344
529
|
V2_MEMORY_CATEGORIES,
|
|
345
530
|
CATEGORY_PRIORITY
|
|
346
531
|
} from "./index-fr0wbhdn.js";
|
|
347
|
-
import {
|
|
348
|
-
getMagicContextBuiltinCommands,
|
|
349
|
-
formatConfigParseStatusLine,
|
|
350
|
-
cortexKitUserConfigBasePath,
|
|
351
|
-
cortexKitProjectConfigBasePath,
|
|
352
|
-
resolveLegacyConfigSources,
|
|
353
|
-
loadPluginConfigDetailed,
|
|
354
|
-
historianRunConfig,
|
|
355
|
-
currentPluginConfigReader,
|
|
356
|
-
clampProducerAtomChars,
|
|
357
|
-
producerInputTokenLimit,
|
|
358
|
-
historianProducerReserve,
|
|
359
|
-
producerPromptFailureReason,
|
|
360
|
-
DREAMER_AGENT,
|
|
361
|
-
DREAMER_RETROSPECTIVE_AGENT,
|
|
362
|
-
DREAMER_PRIMER_INVESTIGATOR_AGENT,
|
|
363
|
-
DREAMER_MEMORY_MAPPER_AGENT,
|
|
364
|
-
DREAMER_CLASSIFIER_AGENT,
|
|
365
|
-
DREAMER_DOCS_AGENT,
|
|
366
|
-
DREAMER_REVIEWER_AGENT,
|
|
367
|
-
getCompartments,
|
|
368
|
-
getLastCompartmentEndMessage,
|
|
369
|
-
getLastCompartmentEndMessageId,
|
|
370
|
-
providerResponseFailed,
|
|
371
|
-
LkgRecoveryFenceError,
|
|
372
|
-
lkgServedArrayDigest,
|
|
373
|
-
hasCleanLkgRecoveryFence,
|
|
374
|
-
dirtyLkgRecoveryRevision,
|
|
375
|
-
ownsLkgDirtyFence,
|
|
376
|
-
invalidateCleanLkgRecoveryFence,
|
|
377
|
-
prepareLkgCaptureFence,
|
|
378
|
-
certifyCommittedLkgCapture,
|
|
379
|
-
markLkgRecoveryDirty,
|
|
380
|
-
getOrCreateSessionMeta,
|
|
381
|
-
updateSessionMeta,
|
|
382
|
-
retryPendingSessionCleanups,
|
|
383
|
-
retryPendingRustSessionCleanupsForProject,
|
|
384
|
-
requestPendingMaterialization,
|
|
385
|
-
hasPendingMaterializationOrigin,
|
|
386
|
-
clearPendingMaterialization,
|
|
387
|
-
recordSystemPromptForRequest,
|
|
388
|
-
recordHeldHeadForRequest,
|
|
389
|
-
isHeldHeadForRequest,
|
|
390
|
-
deferDeliveredSystemRefresh,
|
|
391
|
-
retirePendingSystemPromptDelivery,
|
|
392
|
-
claimLkgRequestIdentity,
|
|
393
|
-
currentLkgRequestIdentity,
|
|
394
|
-
noteCapturedLkgRequest,
|
|
395
|
-
measuredLkgPrefix,
|
|
396
|
-
saveLkgSlotToDb,
|
|
397
|
-
clearPersistedLkgSlotStrict,
|
|
398
|
-
loadPersistedLkgSlot,
|
|
399
|
-
drainStaleLkgSlots,
|
|
400
|
-
resolveLkgModelKeys,
|
|
401
|
-
createLkgEntryProjector,
|
|
402
|
-
captureLkgSlot,
|
|
403
|
-
validateAnthropicReasoningRuns,
|
|
404
|
-
validateLkgSeam,
|
|
405
|
-
replayLkg,
|
|
406
|
-
coldStartRawServedIndex,
|
|
407
|
-
coldStartUncapturedReplay,
|
|
408
|
-
noteUncertifiedNormalLkg,
|
|
409
|
-
hasProcessLocalLkgProof,
|
|
410
|
-
lkgDirtyRevision,
|
|
411
|
-
rememberLkgDirtyRevision,
|
|
412
|
-
readPersistedLkgUntaggedInputIds,
|
|
413
|
-
persistLkgUntaggedInputIds,
|
|
414
|
-
noteLkgRecoveryPrefix,
|
|
415
|
-
readLkgRecoveryPrefix,
|
|
416
|
-
noteLkgHealthyPrefix,
|
|
417
|
-
lkgRecoveryReplayUnproven,
|
|
418
|
-
lkgRecoveryEntryUnproven,
|
|
419
|
-
beginLkgPass,
|
|
420
|
-
visitMessageContentFields,
|
|
421
|
-
contentSnapshotValue,
|
|
422
|
-
messageContentFields,
|
|
423
|
-
signatureForFields,
|
|
424
|
-
exactReusablePrefix,
|
|
425
|
-
incrementalLkgContentDigests,
|
|
426
|
-
lkgSlotRejection,
|
|
427
|
-
captureSlot,
|
|
428
|
-
getInMemorySlot,
|
|
429
|
-
getSlot,
|
|
430
|
-
forgetInMemorySlot,
|
|
431
|
-
dropSlot,
|
|
432
|
-
noteEntry,
|
|
433
|
-
getLkgSlotHeapStats,
|
|
434
|
-
TOOL_SWEEP_SCOPED_MARKER,
|
|
435
|
-
useScopedToolSweep,
|
|
436
|
-
createPreAdoptionToolSweepResolver,
|
|
437
|
-
queueMemoryMutation,
|
|
438
|
-
getMaxMemoryMutationIdForProjects,
|
|
439
|
-
GLOBAL_USER_PROFILE_PROJECT_PATH,
|
|
440
|
-
getProjectState,
|
|
441
|
-
bumpProjectUserProfileVersion,
|
|
442
|
-
createChildSessionWithFence,
|
|
443
|
-
HiddenCompletionRefusal,
|
|
444
|
-
DreamerProviderOutputFailureError,
|
|
445
|
-
withDreamerModelCooldown,
|
|
446
|
-
providerOutputFailureFromInvalidManifest,
|
|
447
|
-
extractLatestAssistantText,
|
|
448
|
-
hasLengthCappedOutput,
|
|
449
|
-
parseProviderModel,
|
|
450
|
-
modelBodyField,
|
|
451
|
-
toModelEntry,
|
|
452
|
-
isPromptTimeoutError,
|
|
453
|
-
getPromptFailureDetail,
|
|
454
|
-
raceWithSignal,
|
|
455
|
-
promptSyncWithValidatedOutputRetry,
|
|
456
|
-
normalizeSDKResponse,
|
|
457
|
-
annotateSubagentInvocationError,
|
|
458
|
-
failedInvocationStatus,
|
|
459
|
-
sumTokensFromChildMessages,
|
|
460
|
-
recordChildInvocation,
|
|
461
|
-
createPromptAsyncTransport,
|
|
462
|
-
systemPromptFingerprint,
|
|
463
|
-
createPromptSurfaceRuntime,
|
|
464
|
-
createPromptSurfaceGuidanceEpochCache,
|
|
465
|
-
teardownChildSession,
|
|
466
|
-
getCompartmentEvents,
|
|
467
|
-
runTokenLog,
|
|
468
|
-
formatRunTokenLog,
|
|
469
|
-
buildMagicContextSection,
|
|
470
|
-
getMuralIdentity,
|
|
471
|
-
getMural,
|
|
472
|
-
modelKeyAcceptsImages,
|
|
473
|
-
resolveMuralWire,
|
|
474
|
-
USER_MEMORY_CANDIDATE_TTL_MS,
|
|
475
|
-
insertUserMemoryCandidates,
|
|
476
|
-
getUserMemoryCandidates,
|
|
477
|
-
deleteUserMemoryCandidates,
|
|
478
|
-
pruneExpiredUserMemoryCandidates,
|
|
479
|
-
insertUserMemory,
|
|
480
|
-
getActiveUserMemories,
|
|
481
|
-
updateUserMemoryContent,
|
|
482
|
-
dismissUserMemory,
|
|
483
|
-
getOpenCodeDbPath,
|
|
484
|
-
prepareCompactionMarkerCandidates,
|
|
485
|
-
removeMcOwnedCompactionMarkers,
|
|
486
|
-
MARKER_SUMMARY_TEXT,
|
|
487
|
-
markerUpdateDefinitelyDidNotCut,
|
|
488
|
-
extractM0Block,
|
|
489
|
-
formatDate,
|
|
490
|
-
TEMPORAL_MARKER_REPLAY_PATTERN,
|
|
491
|
-
collectTemporalCandidates,
|
|
492
|
-
injectTemporalMarkers,
|
|
493
|
-
getVisibleMemoryIds,
|
|
494
|
-
selectHiddenMessagesAtCompactionSeam,
|
|
495
|
-
prepareCompartmentInjection,
|
|
496
|
-
mustMaterialize,
|
|
497
|
-
trimMemoriesToBudgetV2,
|
|
498
|
-
renderMemoryBlockV2,
|
|
499
|
-
findHostCompactionWindow,
|
|
500
|
-
capturePrefixTrimSourceOrder,
|
|
501
|
-
resolveHiddenCompletionExecutor,
|
|
502
|
-
createV1HiddenCompletionExecutor,
|
|
503
|
-
readCoordinateGeneration,
|
|
504
|
-
readCoordinateRebaseNotice,
|
|
505
|
-
formatCoordinateRebaseNotice,
|
|
506
|
-
rebaseSessionCoordinatesAsync,
|
|
507
|
-
shouldWaitForNewHistorianHistory,
|
|
508
|
-
EMPTY_READ_REPLY,
|
|
509
|
-
noteTouchedAt,
|
|
510
|
-
renderGlance,
|
|
511
|
-
renderNotesById,
|
|
512
|
-
formatWriteReply,
|
|
513
|
-
onNoteTrigger,
|
|
514
|
-
clearNoteNudgeTriggerAndCooldown,
|
|
515
|
-
resetNoteNudgeCooldownOnly,
|
|
516
|
-
omitIncompleteFileTokenTotals,
|
|
517
|
-
RECOVERY_NO_HEAD_LIMIT,
|
|
518
|
-
deriveProtectedTailTokenTarget,
|
|
519
|
-
selectPerRunCap,
|
|
520
|
-
resolveOpenCodeProtectedTailBoundary,
|
|
521
|
-
getRawHistoryEligibility,
|
|
522
|
-
hasRunnableCompartmentWindow,
|
|
523
|
-
recordHighPressureNoEligibleHead,
|
|
524
|
-
noteTransformPassForExactOrdinalReads,
|
|
525
|
-
snapRangeToCompartments,
|
|
526
|
-
getActiveCompartmentRun,
|
|
527
|
-
startCompartmentAgent
|
|
528
|
-
} from "./index-dcqk0y27.js";
|
|
529
532
|
import {
|
|
530
533
|
embedPauseBySession,
|
|
531
534
|
embedRunStateBySession,
|
|
@@ -553,7 +556,7 @@ import {
|
|
|
553
556
|
embedSessionCompartmentChunks2,
|
|
554
557
|
getEmbeddingCoverageStatus2,
|
|
555
558
|
getAutoEmbeddingSessionCoverage2
|
|
556
|
-
} from "./index-
|
|
559
|
+
} from "./index-gxkhzmjq.js";
|
|
557
560
|
import {
|
|
558
561
|
SubcClient,
|
|
559
562
|
connectionFileExists,
|
|
@@ -571,7 +574,7 @@ import {
|
|
|
571
574
|
clearIndexedMessages,
|
|
572
575
|
indexSingleMessage,
|
|
573
576
|
indexMessagesAfterOrdinal
|
|
574
|
-
} from "./index-
|
|
577
|
+
} from "./index-tx68g9nc.js";
|
|
575
578
|
import {
|
|
576
579
|
renderUserFacingFailure,
|
|
577
580
|
userFacingFailureCode,
|
|
@@ -615,7 +618,7 @@ import {
|
|
|
615
618
|
readGitFileChangeTimesSince,
|
|
616
619
|
verificationFileExists,
|
|
617
620
|
normalizeVerificationFiles
|
|
618
|
-
} from "./index-
|
|
621
|
+
} from "./index-pe6b4bhs.js";
|
|
619
622
|
import {
|
|
620
623
|
registerNotificationSink2,
|
|
621
624
|
pushNotification2,
|
|
@@ -635,7 +638,7 @@ import {
|
|
|
635
638
|
} from "./index-4dhv7mqz.js";
|
|
636
639
|
import {
|
|
637
640
|
cosineSimilarity
|
|
638
|
-
} from "./index-
|
|
641
|
+
} from "./index-vnn5405n.js";
|
|
639
642
|
import {
|
|
640
643
|
computeCueContentHash,
|
|
641
644
|
hasMuralCueColumns,
|
|
@@ -681,17 +684,17 @@ import {
|
|
|
681
684
|
resolveMemoriesByIdsForSearch2,
|
|
682
685
|
unifiedSearch2,
|
|
683
686
|
formatSearchResults2
|
|
684
|
-
} from "./index-
|
|
687
|
+
} from "./index-wvffze8y.js";
|
|
685
688
|
import {
|
|
686
689
|
flushIgnoredMessages2,
|
|
687
690
|
clearIgnoredMessages2,
|
|
688
691
|
observeIgnoredNotificationEvent2,
|
|
689
692
|
sendStatusNotification2
|
|
690
|
-
} from "./index-
|
|
693
|
+
} from "./index-waktfbjy.js";
|
|
691
694
|
import {
|
|
692
695
|
setRecompStarting2,
|
|
693
696
|
setRecompTerminal2
|
|
694
|
-
} from "./index-
|
|
697
|
+
} from "./index-093c4g1c.js";
|
|
695
698
|
import {
|
|
696
699
|
makeToolCompositeKey,
|
|
697
700
|
searchMessageHistoryOffThread,
|
|
@@ -735,6 +738,7 @@ import {
|
|
|
735
738
|
replayCavemanCompression,
|
|
736
739
|
DegradedPassRefusalError,
|
|
737
740
|
degradedPassError,
|
|
741
|
+
renderDroppedText,
|
|
738
742
|
applyFlushedStatuses,
|
|
739
743
|
prewarmTagOwners,
|
|
740
744
|
waitForTagOwners,
|
|
@@ -753,7 +757,7 @@ import {
|
|
|
753
757
|
abortSessionFailClosed2,
|
|
754
758
|
evaluateEmergencyFailClosed2,
|
|
755
759
|
runPostTransformPhase2
|
|
756
|
-
} from "./index-
|
|
760
|
+
} from "./index-bps8vn9r.js";
|
|
757
761
|
import {
|
|
758
762
|
ANNOUNCEMENT_VERSION2,
|
|
759
763
|
ANNOUNCEMENT_FEATURES2,
|
|
@@ -766,7 +770,7 @@ import {
|
|
|
766
770
|
} from "./index-fmsr7v69.js";
|
|
767
771
|
import {
|
|
768
772
|
renderSearchArchiveOffThread2
|
|
769
|
-
} from "./index-
|
|
773
|
+
} from "./index-a1h316s9.js";
|
|
770
774
|
import {
|
|
771
775
|
COMPACTION_ENABLED_PATH,
|
|
772
776
|
isDreamerRunnable,
|
|
@@ -2952,7 +2956,7 @@ async function runHiddenSingleShotPrompt(args) {
|
|
|
2952
2956
|
let timer;
|
|
2953
2957
|
try {
|
|
2954
2958
|
const completion = await Promise.race([
|
|
2955
|
-
args.executor.collect(handle, 200),
|
|
2959
|
+
args.executor.collectPartial?.(handle, 200) ?? args.executor.collect(handle, 200),
|
|
2956
2960
|
new Promise((resolve) => {
|
|
2957
2961
|
timer = setTimeout(() => resolve(null), 5000);
|
|
2958
2962
|
})
|
|
@@ -5598,6 +5602,7 @@ Remember: output only the JSON object described by the system prompt.`;
|
|
|
5598
5602
|
let childSessionId = null;
|
|
5599
5603
|
let promptSettled = false;
|
|
5600
5604
|
let invocationRecorded = false;
|
|
5605
|
+
let completionUsage;
|
|
5601
5606
|
const recordInvocation = (params) => {
|
|
5602
5607
|
if (!args.db || !args.parentSessionId || invocationRecorded)
|
|
5603
5608
|
return;
|
|
@@ -5611,6 +5616,7 @@ Remember: output only the JSON object described by the system prompt.`;
|
|
|
5611
5616
|
startedAt,
|
|
5612
5617
|
status: params.status,
|
|
5613
5618
|
messages: params.messages,
|
|
5619
|
+
tokens: args.hiddenCompletionExecutor?.capabilities.harness === "opencode2" ? completionUsage : undefined,
|
|
5614
5620
|
attemptedModel: args.model,
|
|
5615
5621
|
configuredModels: args.fallbackModels,
|
|
5616
5622
|
error: params.error
|
|
@@ -5635,11 +5641,15 @@ Remember: output only the JSON object described by the system prompt.`;
|
|
|
5635
5641
|
timeoutMs: remainingMs,
|
|
5636
5642
|
signal: args.signal,
|
|
5637
5643
|
metadata: { task: "evaluate-smart-notes" },
|
|
5644
|
+
onFailureOutput: (completion) => {
|
|
5645
|
+
completionUsage = completion.usage;
|
|
5646
|
+
},
|
|
5638
5647
|
parse: parseCompilerOutput
|
|
5639
5648
|
});
|
|
5640
5649
|
promptSettled = true;
|
|
5641
5650
|
response = carried.validated;
|
|
5642
5651
|
outputMessages = carried.completion.messages;
|
|
5652
|
+
completionUsage = carried.completion.usage;
|
|
5643
5653
|
} else {
|
|
5644
5654
|
const client = args.client;
|
|
5645
5655
|
if (!client) {
|
|
@@ -6599,6 +6609,7 @@ async function confirmReadOnly(args, noteId, content, surfaceCondition, leaseSig
|
|
|
6599
6609
|
startedAt,
|
|
6600
6610
|
status: params.status,
|
|
6601
6611
|
messages: params.messages,
|
|
6612
|
+
tokens: args.hiddenCompletionExecutor?.capabilities.harness === "opencode2" ? params.tokens : undefined,
|
|
6602
6613
|
attemptedModel: args.model,
|
|
6603
6614
|
configuredModels: args.fallbackModels,
|
|
6604
6615
|
error: params.error
|
|
@@ -6626,7 +6637,11 @@ async function confirmReadOnly(args, noteId, content, surfaceCondition, leaseSig
|
|
|
6626
6637
|
parse: parseConfirmationVerdict
|
|
6627
6638
|
});
|
|
6628
6639
|
promptSettled = true;
|
|
6629
|
-
recordInvocation({
|
|
6640
|
+
recordInvocation({
|
|
6641
|
+
status: "completed",
|
|
6642
|
+
messages: run.completion.messages,
|
|
6643
|
+
tokens: run.completion.usage
|
|
6644
|
+
});
|
|
6630
6645
|
return run.validated;
|
|
6631
6646
|
} finally {
|
|
6632
6647
|
promptSignal.cleanup();
|
|
@@ -7184,8 +7199,8 @@ async function mapMemories(args) {
|
|
|
7184
7199
|
result.failureStage = outcome.failure.stage;
|
|
7185
7200
|
}
|
|
7186
7201
|
const committed = outcome.mapped + outcome.independent;
|
|
7202
|
+
const committedIds = new Set(outcome.committedIds);
|
|
7187
7203
|
runLeaseGuardedWrite(args.db, args.holderId, args.leaseKey, () => {
|
|
7188
|
-
const committedIds = new Set(outcome.committedIds);
|
|
7189
7204
|
for (const memory of batch.inputs) {
|
|
7190
7205
|
if (committedIds.has(memory.id)) {
|
|
7191
7206
|
delete retries[memory.id];
|
|
@@ -7220,7 +7235,22 @@ async function mapMemories(args) {
|
|
|
7220
7235
|
log2(`[dreamer] map-memories: targeted retry still omitted ${outcome.requeue.length} id(s); leaving them unmapped for the next run`);
|
|
7221
7236
|
}
|
|
7222
7237
|
}
|
|
7223
|
-
if (outcome.failure?.class === "timeout" &&
|
|
7238
|
+
if (outcome.failure?.class === "timeout" && batch.inputs.length > 1) {
|
|
7239
|
+
const unmapped = batch.inputs.filter((memory) => !committedIds.has(memory.id));
|
|
7240
|
+
const splitSize = Math.floor(batch.inputs.length / 2);
|
|
7241
|
+
const splits = [];
|
|
7242
|
+
for (let offset = 0;offset < unmapped.length; offset += splitSize) {
|
|
7243
|
+
splits.push({
|
|
7244
|
+
inputs: unmapped.slice(offset, offset + splitSize),
|
|
7245
|
+
isOmissionRetry: batch.isOmissionRetry
|
|
7246
|
+
});
|
|
7247
|
+
}
|
|
7248
|
+
if (splits.length > 0) {
|
|
7249
|
+
batches.splice(i + 1, 0, ...splits);
|
|
7250
|
+
log2(`[dreamer] map-memories: splitting batch [${batch.inputs.map((memory) => memory.id).join(",")}] into ${splits.map((split) => split.inputs.length).join("+")} after timeout; retrying ${unmapped.length} uncommitted mapping(s)`);
|
|
7251
|
+
}
|
|
7252
|
+
}
|
|
7253
|
+
if (outcome.failure?.class === "timeout" && batch.inputs.length === 1 && committed === 0) {
|
|
7224
7254
|
consecutiveTimeouts += 1;
|
|
7225
7255
|
timeoutStreakElapsedMs.push(outcome.failure.elapsedMs);
|
|
7226
7256
|
if (consecutiveTimeouts >= CONSECUTIVE_TIMEOUT_LIMIT2) {
|
|
@@ -7228,7 +7258,7 @@ async function mapMemories(args) {
|
|
|
7228
7258
|
log2(`[dreamer] map-memories starvation: circuit breaker tripped after ${consecutiveTimeouts} consecutive batch timeouts with no committed mappings (investigation made no durable progress); per-batch elapsed [${timeoutStreakElapsedMs.join("ms, ")}ms] vs ${sliceMs}ms slice; stopping with ${result.remaining} mapping(s) remaining`);
|
|
7229
7259
|
break;
|
|
7230
7260
|
}
|
|
7231
|
-
} else {
|
|
7261
|
+
} else if (committed > 0 || outcome.failure?.class !== "timeout") {
|
|
7232
7262
|
consecutiveTimeouts = 0;
|
|
7233
7263
|
timeoutStreakElapsedMs = [];
|
|
7234
7264
|
}
|
|
@@ -7279,7 +7309,8 @@ async function mapOneBatch(args, batch, sliceMs, signal) {
|
|
|
7279
7309
|
});
|
|
7280
7310
|
recordInvocation2(args, startedAt, {
|
|
7281
7311
|
status: "completed",
|
|
7282
|
-
messages: run.completion.messages ?? []
|
|
7312
|
+
messages: run.completion.messages ?? [],
|
|
7313
|
+
tokens: run.completion.usage
|
|
7283
7314
|
});
|
|
7284
7315
|
stage = "apply";
|
|
7285
7316
|
const outcome = await applyParsedBatchMappings(args, batch, run.validated, budgetFinalized, true);
|
|
@@ -7354,7 +7385,8 @@ async function mapOneBatch(args, batch, sliceMs, signal) {
|
|
|
7354
7385
|
recordInvocation2(args, startedAt, {
|
|
7355
7386
|
status: failedInvocationStatus(error),
|
|
7356
7387
|
error,
|
|
7357
|
-
messages
|
|
7388
|
+
messages,
|
|
7389
|
+
tokens: failedCompletion?.usage
|
|
7358
7390
|
});
|
|
7359
7391
|
if (error instanceof DreamerModuleFailureError)
|
|
7360
7392
|
throw error;
|
|
@@ -7521,6 +7553,7 @@ function recordInvocation2(args, startedAt, params) {
|
|
|
7521
7553
|
startedAt,
|
|
7522
7554
|
status: params.status,
|
|
7523
7555
|
messages: params.messages,
|
|
7556
|
+
tokens: args.hiddenCompletionExecutor?.capabilities.harness === "opencode2" ? params.tokens : undefined,
|
|
7524
7557
|
attemptedModel: args.model,
|
|
7525
7558
|
configuredModels: args.fallbackModels,
|
|
7526
7559
|
error: params.error
|
|
@@ -8655,7 +8688,8 @@ async function git2(root, args) {
|
|
|
8655
8688
|
cwd: root,
|
|
8656
8689
|
timeout: 1e4,
|
|
8657
8690
|
maxBuffer: MAX_DIFF_BYTES,
|
|
8658
|
-
encoding: "utf8"
|
|
8691
|
+
encoding: "utf8",
|
|
8692
|
+
windowsHide: true
|
|
8659
8693
|
});
|
|
8660
8694
|
return stdout;
|
|
8661
8695
|
}
|
|
@@ -9297,7 +9331,8 @@ async function verifyOneBatch(args, batch, sliceMs, signal) {
|
|
|
9297
9331
|
});
|
|
9298
9332
|
recordInvocation4(args, startedAt, {
|
|
9299
9333
|
status: "completed",
|
|
9300
|
-
messages: run.completion.messages ?? []
|
|
9334
|
+
messages: run.completion.messages ?? [],
|
|
9335
|
+
tokens: run.completion.usage
|
|
9301
9336
|
});
|
|
9302
9337
|
reportUsage(run.completion.messages ?? [], run.childSessionId, run.completion.usage.input + (run.completion.usage.cacheRead ?? 0) + (run.completion.usage.cacheWrite ?? 0));
|
|
9303
9338
|
return await applyParsedVerifyManifest(args, batch, run.validated, evidence?.head ?? headAtPrompt, budgetFinalized);
|
|
@@ -9371,7 +9406,8 @@ async function verifyOneBatch(args, batch, sliceMs, signal) {
|
|
|
9371
9406
|
recordInvocation4(args, startedAt, {
|
|
9372
9407
|
status: failedInvocationStatus(error),
|
|
9373
9408
|
error,
|
|
9374
|
-
messages
|
|
9409
|
+
messages,
|
|
9410
|
+
tokens: failedCompletion?.usage
|
|
9375
9411
|
});
|
|
9376
9412
|
if (error instanceof DreamerModuleFailureError || signal.aborted)
|
|
9377
9413
|
throw error;
|
|
@@ -9630,6 +9666,7 @@ function recordInvocation4(args, startedAt, params) {
|
|
|
9630
9666
|
startedAt,
|
|
9631
9667
|
status: params.status,
|
|
9632
9668
|
messages: params.messages,
|
|
9669
|
+
tokens: args.hiddenCompletionExecutor?.capabilities.harness === "opencode2" ? params.tokens : undefined,
|
|
9633
9670
|
attemptedModel: args.model,
|
|
9634
9671
|
configuredModels: args.fallbackModels,
|
|
9635
9672
|
error: params.error
|
|
@@ -9699,6 +9736,15 @@ function classifyFailure(error) {
|
|
|
9699
9736
|
const transient = explicitTransient || name === "AbortError" || /abort|lease|timeout|timed out|econn|socket|network|rate.?limit|429|503|overloaded|sqlite_busy|database is locked/.test(combined);
|
|
9700
9737
|
return { transient, brief };
|
|
9701
9738
|
}
|
|
9739
|
+
function sumCompletionUsages(usages) {
|
|
9740
|
+
return usages.reduce((total, usage) => ({
|
|
9741
|
+
input: total.input + usage.input,
|
|
9742
|
+
output: total.output + usage.output,
|
|
9743
|
+
cacheRead: total.cacheRead + usage.cacheRead,
|
|
9744
|
+
cacheWrite: total.cacheWrite + usage.cacheWrite,
|
|
9745
|
+
...total.reasoning !== undefined || usage.reasoning !== undefined ? { reasoning: (total.reasoning ?? 0) + (usage.reasoning ?? 0) } : {}
|
|
9746
|
+
}), emptyTokenTotals());
|
|
9747
|
+
}
|
|
9702
9748
|
function newIds(beforeIds, afterIds) {
|
|
9703
9749
|
const before = new Set(beforeIds);
|
|
9704
9750
|
const out = [];
|
|
@@ -10506,6 +10552,7 @@ async function runRetrospectiveTask(config, ctx, helpers) {
|
|
|
10506
10552
|
}, ctx.leaseAcquisition);
|
|
10507
10553
|
let childSessionId = null;
|
|
10508
10554
|
let hiddenHandle = null;
|
|
10555
|
+
const hiddenUsages = [];
|
|
10509
10556
|
let promptSettled = false;
|
|
10510
10557
|
let invocationRecorded = false;
|
|
10511
10558
|
const recordInvocation = (status, messages, error) => {
|
|
@@ -10521,6 +10568,7 @@ async function runRetrospectiveTask(config, ctx, helpers) {
|
|
|
10521
10568
|
startedAt: helpers.invocationStartedAt,
|
|
10522
10569
|
status,
|
|
10523
10570
|
messages,
|
|
10571
|
+
tokens: deps.hiddenCompletionExecutor?.capabilities.harness === "opencode2" && hiddenUsages.length ? sumCompletionUsages(hiddenUsages) : undefined,
|
|
10524
10572
|
attemptedModel: config.model,
|
|
10525
10573
|
configuredModels: config.fallbackModels,
|
|
10526
10574
|
error
|
|
@@ -10606,6 +10654,8 @@ async function runRetrospectiveTask(config, ctx, helpers) {
|
|
|
10606
10654
|
}
|
|
10607
10655
|
});
|
|
10608
10656
|
promptSettled = true;
|
|
10657
|
+
if (hiddenHandle)
|
|
10658
|
+
hiddenUsages.push(run.output.usage);
|
|
10609
10659
|
const output = hiddenHandle ? run.output.messages ?? [] : run.output;
|
|
10610
10660
|
return { ...run, output };
|
|
10611
10661
|
};
|
|
@@ -10776,6 +10826,7 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
10776
10826
|
let childSessionId = null;
|
|
10777
10827
|
let promptSettled = false;
|
|
10778
10828
|
let expiredArchived = 0;
|
|
10829
|
+
const hiddenUsages = [];
|
|
10779
10830
|
let invocationRecorded = false;
|
|
10780
10831
|
const recordInvocation = (status, messages, error) => {
|
|
10781
10832
|
if (!parent || !childSessionId || invocationRecorded)
|
|
@@ -10790,6 +10841,7 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
10790
10841
|
startedAt: invocationStartedAt,
|
|
10791
10842
|
status,
|
|
10792
10843
|
messages,
|
|
10844
|
+
tokens: deps.hiddenCompletionExecutor?.capabilities.harness === "opencode2" && hiddenUsages.length ? sumCompletionUsages(hiddenUsages) : undefined,
|
|
10793
10845
|
attemptedModel: config.model,
|
|
10794
10846
|
configuredModels: config.fallbackModels,
|
|
10795
10847
|
error
|
|
@@ -10907,6 +10959,7 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
10907
10959
|
}
|
|
10908
10960
|
});
|
|
10909
10961
|
childSessionId = hidden.childSessionId;
|
|
10962
|
+
hiddenUsages.push(hidden.completion.usage);
|
|
10910
10963
|
run = { output: hidden.completion.messages ?? [], validated: hidden.validated };
|
|
10911
10964
|
promptSettled = true;
|
|
10912
10965
|
} else {
|
|
@@ -11895,7 +11948,8 @@ async function sweepGitCommits(args) {
|
|
|
11895
11948
|
try {
|
|
11896
11949
|
const result = await indexCommitsForProject(db, projectIdentity, directory, {
|
|
11897
11950
|
sinceDays: gitCommitIndexing.since_days,
|
|
11898
|
-
maxCommits: gitCommitIndexing.max_commits
|
|
11951
|
+
maxCommits: gitCommitIndexing.max_commits,
|
|
11952
|
+
skipRetention: isCommitRetentionPaused(gitCommitIndexing)
|
|
11899
11953
|
});
|
|
11900
11954
|
if (result.nonIndexable) {
|
|
11901
11955
|
if (!parkGitSweepNonIndexable(db, projectIdentity, holderId)) {
|
|
@@ -11958,28 +12012,28 @@ var EMBEDDING_AFFECTING_KEYS = new Set([
|
|
|
11958
12012
|
"embedding.query_instruction",
|
|
11959
12013
|
"embedding.document_prefix",
|
|
11960
12014
|
"embedding.fallback_provider",
|
|
11961
|
-
"
|
|
12015
|
+
"embedding.local_runtime",
|
|
12016
|
+
"embedding.local_dtype",
|
|
11962
12017
|
"subc.connection_file",
|
|
11963
|
-
"shadow_embedding"
|
|
12018
|
+
"shadow_embedding.enabled",
|
|
12019
|
+
"memory.enabled",
|
|
12020
|
+
"memory.git_commit_indexing.enabled",
|
|
12021
|
+
"allow_home_project"
|
|
11964
12022
|
]);
|
|
11965
12023
|
var LITERAL_CONFIG_TOKEN_RE = /\{(?:env|file):[^}]+\}/;
|
|
11966
|
-
function
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
12024
|
+
function affectsEmbeddingRegistration(path) {
|
|
12025
|
+
return [...EMBEDDING_AFFECTING_KEYS].some((field) => field === path || field.startsWith(`${path}.`));
|
|
12026
|
+
}
|
|
12027
|
+
function untrustedConfigFieldPaths(detailed) {
|
|
12028
|
+
const paths = (detailed.recoveredFieldPaths ?? detailed.recoveredTopLevelKeys).filter(affectsEmbeddingRegistration);
|
|
12029
|
+
paths.push(...detailed.substitutionFailures.map((failure) => failure.keyPath).filter(affectsEmbeddingRegistration));
|
|
12030
|
+
for (const [key, value] of Object.entries(detailed.config.embedding)) {
|
|
11970
12031
|
if (typeof value === "string" && LITERAL_CONFIG_TOKEN_RE.test(value)) {
|
|
11971
|
-
|
|
12032
|
+
paths.push(`embedding.${key}`);
|
|
11972
12033
|
}
|
|
11973
12034
|
}
|
|
11974
|
-
return
|
|
12035
|
+
return [...new Set(paths)].sort();
|
|
11975
12036
|
}
|
|
11976
|
-
var EMBEDDING_AFFECTING_TOP_LEVEL_KEYS = new Set([
|
|
11977
|
-
"embedding",
|
|
11978
|
-
"memory",
|
|
11979
|
-
"experimental",
|
|
11980
|
-
"subc",
|
|
11981
|
-
"shadow_embedding"
|
|
11982
|
-
]);
|
|
11983
12037
|
var EMBEDDING_WARNING_TERMS = [
|
|
11984
12038
|
"api_key",
|
|
11985
12039
|
"endpoint",
|
|
@@ -12004,21 +12058,12 @@ function isConfigLoadUntrusted(detailed) {
|
|
|
12004
12058
|
return true;
|
|
12005
12059
|
}
|
|
12006
12060
|
for (const failure of detailed.substitutionFailures) {
|
|
12007
|
-
if (EMBEDDING_AFFECTING_KEYS.has(failure.keyPath)) {
|
|
12008
|
-
return true;
|
|
12009
|
-
}
|
|
12010
12061
|
if (failure.keyPath === "<unknown>" && warningLooksEmbeddingRelated(failure.message)) {
|
|
12011
12062
|
return true;
|
|
12012
12063
|
}
|
|
12013
12064
|
}
|
|
12014
|
-
|
|
12015
|
-
if (EMBEDDING_AFFECTING_TOP_LEVEL_KEYS.has(recoveredKey)) {
|
|
12016
|
-
return true;
|
|
12017
|
-
}
|
|
12018
|
-
}
|
|
12019
|
-
if (embeddingConfigHasLiteralTokens(detailed.config.embedding)) {
|
|
12065
|
+
if (untrustedConfigFieldPaths(detailed).length > 0)
|
|
12020
12066
|
return true;
|
|
12021
|
-
}
|
|
12022
12067
|
return false;
|
|
12023
12068
|
}
|
|
12024
12069
|
function describeFailure(detailed) {
|
|
@@ -12031,8 +12076,9 @@ function describeFailure(detailed) {
|
|
|
12031
12076
|
if (detailed.substitutionFailures.length > 0) {
|
|
12032
12077
|
parts.push(`substitution=${detailed.substitutionFailures.map((failure) => `${failure.source}:${failure.keyPath}`).join(",")}`);
|
|
12033
12078
|
}
|
|
12034
|
-
|
|
12035
|
-
|
|
12079
|
+
const recovered = detailed.recoveredFieldPaths ?? detailed.recoveredTopLevelKeys;
|
|
12080
|
+
if (recovered.length > 0) {
|
|
12081
|
+
parts.push(`recovered=${recovered.join(",")}`);
|
|
12036
12082
|
}
|
|
12037
12083
|
return parts.length > 0 ? parts.join("; ") : detailed.loadOutcome;
|
|
12038
12084
|
}
|
|
@@ -12040,7 +12086,8 @@ function logConfigFailureOnce(projectIdentity, detailed) {
|
|
|
12040
12086
|
const signature = sha256Prefix(JSON.stringify({
|
|
12041
12087
|
outcomes: detailed.sources,
|
|
12042
12088
|
substitutions: detailed.substitutionFailures.map((failure) => `${failure.source}:${failure.keyPath}:${failure.message}`).sort(),
|
|
12043
|
-
recoveredTopLevelKeys: [...detailed.recoveredTopLevelKeys].sort()
|
|
12089
|
+
recoveredTopLevelKeys: [...detailed.recoveredTopLevelKeys].sort(),
|
|
12090
|
+
recoveredFieldPaths: detailed.recoveredFieldPaths?.slice().sort()
|
|
12044
12091
|
}));
|
|
12045
12092
|
const existing = loggedFailureSignatures.get(projectIdentity) ?? new Set;
|
|
12046
12093
|
if (existing.has(signature))
|
|
@@ -12056,9 +12103,14 @@ function handleUntrustedLoad(db, projectIdentity, directory, detailed) {
|
|
|
12056
12103
|
logConfigFailureOnce(projectIdentity, detailed);
|
|
12057
12104
|
return true;
|
|
12058
12105
|
}
|
|
12059
|
-
registerProjectInObservationMode2(db, projectIdentity, directory, detailed.config.embedding, describeFailure(detailed));
|
|
12106
|
+
registerProjectInObservationMode2(db, projectIdentity, directory, detailed.config.embedding, describeFailure(detailed), untrustedConfigMemoryMessage(detailed));
|
|
12060
12107
|
return true;
|
|
12061
12108
|
}
|
|
12109
|
+
function untrustedConfigMemoryMessage(detailed) {
|
|
12110
|
+
const fields = untrustedConfigFieldPaths(detailed);
|
|
12111
|
+
const cause = fields.length > 0 ? `has invalid embedding or project identity settings: ${fields.join(", ")}` : Object.values(detailed.sources).includes("legacy-config-unmigrated") ? "is awaiting config migration" : Object.values(detailed.sources).some((source) => source === "project-file-parse-error" || source === "project-file-io-error") ? "could not be read or parsed" : "has invalid embedding settings";
|
|
12112
|
+
return `Cross-session memory is off for this project because magic-context.jsonc ${cause}.`;
|
|
12113
|
+
}
|
|
12062
12114
|
|
|
12063
12115
|
// src/plugin/embedding-routing.ts
|
|
12064
12116
|
var SYNAPSE_PROBE_TTL_MS = 60000;
|
|
@@ -13221,8 +13273,23 @@ WHERE session_id = ?
|
|
|
13221
13273
|
AND data IS NOT NULL
|
|
13222
13274
|
AND (time_created > ? OR (time_created = ? AND id > ?))
|
|
13223
13275
|
ORDER BY time_created, id`;
|
|
13224
|
-
|
|
13225
|
-
|
|
13276
|
+
var V2_ASSISTANT_USAGE_ROWS_AFTER_SQL = `
|
|
13277
|
+
SELECT
|
|
13278
|
+
json_extract(data, '$.agent') AS agent,
|
|
13279
|
+
seq AS time_created,
|
|
13280
|
+
id AS id,
|
|
13281
|
+
COALESCE(json_extract(data, '$.tokens.input'), 0)
|
|
13282
|
+
+ COALESCE(json_extract(data, '$.tokens.cache.read'), 0)
|
|
13283
|
+
+ COALESCE(json_extract(data, '$.tokens.cache.write'), 0) AS prompt,
|
|
13284
|
+
COALESCE(json_extract(data, '$.tokens.output'), 0) AS output
|
|
13285
|
+
FROM session_message
|
|
13286
|
+
WHERE session_id = ?
|
|
13287
|
+
AND type = 'assistant'
|
|
13288
|
+
AND data IS NOT NULL
|
|
13289
|
+
AND (seq > ? OR (seq = ? AND id > ?))
|
|
13290
|
+
ORDER BY seq, id`;
|
|
13291
|
+
function readAssistantUsageRowsAfter(openCodeDb, sessionId, afterTimeCreated, afterId, generation = "v1") {
|
|
13292
|
+
const rows = openCodeDb.prepare(generation === "v2" ? V2_ASSISTANT_USAGE_ROWS_AFTER_SQL : ASSISTANT_USAGE_ROWS_AFTER_SQL).all(sessionId, afterTimeCreated, afterTimeCreated, afterId);
|
|
13226
13293
|
return rows.map((r) => ({
|
|
13227
13294
|
agent: r.agent ?? null,
|
|
13228
13295
|
timeCreated: Number(r.time_created ?? 0),
|
|
@@ -13231,8 +13298,8 @@ function readAssistantUsageRowsAfter(openCodeDb, sessionId, afterTimeCreated, af
|
|
|
13231
13298
|
output: Number(r.output ?? 0)
|
|
13232
13299
|
}));
|
|
13233
13300
|
}
|
|
13234
|
-
function computeOpenCodeWorkMetricsIncremental(openCodeDb, sessionId, carry) {
|
|
13235
|
-
const rows = readAssistantUsageRowsAfter(openCodeDb, sessionId, carry.lastTimeCreated, carry.lastId);
|
|
13301
|
+
function computeOpenCodeWorkMetricsIncremental(openCodeDb, sessionId, carry, generation = "v1") {
|
|
13302
|
+
const rows = readAssistantUsageRowsAfter(openCodeDb, sessionId, carry.lastTimeCreated, carry.lastId, generation);
|
|
13236
13303
|
if (rows.length === 0) {
|
|
13237
13304
|
return { carry, metrics: metricsFromCarry(carry) };
|
|
13238
13305
|
}
|
|
@@ -15547,13 +15614,15 @@ function runnerStatusFromModule(status) {
|
|
|
15547
15614
|
}
|
|
15548
15615
|
var rustStatusInFlight = new Map;
|
|
15549
15616
|
function resolveSidebarWorkMetrics(db, sessionId, persistedNewWork, persistedTotalInput) {
|
|
15550
|
-
|
|
15617
|
+
const generation = getHarness2() === "opencode2" ? "v2" : "v1";
|
|
15618
|
+
if (!openCodeDbExists(generation)) {
|
|
15551
15619
|
return { newWorkTokens: persistedNewWork, totalInputTokens: persistedTotalInput };
|
|
15552
15620
|
}
|
|
15553
15621
|
try {
|
|
15554
|
-
const
|
|
15555
|
-
const
|
|
15556
|
-
|
|
15622
|
+
const carryKey = `${generation}:${sessionId}`;
|
|
15623
|
+
const carry = workMetricsCarryBySession.get(carryKey) ?? emptyWorkMetricsCarry();
|
|
15624
|
+
const { carry: nextCarry, metrics } = withReadOnlySessionDb((openCodeDb) => computeOpenCodeWorkMetricsIncremental(openCodeDb, sessionId, carry, generation), generation);
|
|
15625
|
+
workMetricsCarryBySession.set(carryKey, nextCarry);
|
|
15557
15626
|
try {
|
|
15558
15627
|
setSessionWorkMetrics(db, sessionId, metrics.newWorkTokens, metrics.totalInputTokens);
|
|
15559
15628
|
} catch {}
|
|
@@ -16454,8 +16523,8 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16454
16523
|
const db = readDatabase();
|
|
16455
16524
|
if (!db)
|
|
16456
16525
|
return { ok: false, error: "db unavailable" };
|
|
16457
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16458
|
-
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-
|
|
16526
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-na34m4c5.js"));
|
|
16527
|
+
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-vz86nt79.js"));
|
|
16459
16528
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
16460
16529
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
16461
16530
|
return {
|
|
@@ -16539,7 +16608,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16539
16608
|
const db = readDatabase();
|
|
16540
16609
|
if (!db)
|
|
16541
16610
|
return { ok: false, error: "db unavailable" };
|
|
16542
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16611
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-f0xr7pft.js"));
|
|
16543
16612
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
16544
16613
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
16545
16614
|
const ctx = {
|
|
@@ -24390,8 +24459,21 @@ function createTransform(deps) {
|
|
|
24390
24459
|
const temporalReplayIds = temporalCandidates ? messages.flatMap((message) => message.info.id ? [message.info.id] : []) : undefined;
|
|
24391
24460
|
logTransformTiming(sessionId, "findSessionId", tSessionId, `messages=${messages.length}`);
|
|
24392
24461
|
const tLkgEntry = performance.now();
|
|
24393
|
-
const lkgInput = deps.transformMode === "rust" ? [] : projectEntry(sessionId,
|
|
24462
|
+
const lkgInput = deps.transformMode === "rust" ? [] : projectEntry(sessionId, entryOrderForThinkingFit);
|
|
24394
24463
|
const recovery = deps.compactionOff || deps.transformMode === "rust" ? {} : readLkgRecoveryPrefix(sessionId, lkgInput, messages, deps.db);
|
|
24464
|
+
const recoveryTailSources = [];
|
|
24465
|
+
if (recovery.prefix) {
|
|
24466
|
+
const priorIdentities = new Set(recovery.prefix.inputs.map((input) => input.id));
|
|
24467
|
+
lkgInput.forEach((input, index) => {
|
|
24468
|
+
const identity = lkgInputIdentity(input.id, input.role, index);
|
|
24469
|
+
if (!identity || priorIdentities.has(identity))
|
|
24470
|
+
return;
|
|
24471
|
+
recoveryTailSources.push({
|
|
24472
|
+
identity,
|
|
24473
|
+
pristineSystem: input.id === null && input.role === "system" ? structuredClone(entryOrderForThinkingFit[index]) : undefined
|
|
24474
|
+
});
|
|
24475
|
+
});
|
|
24476
|
+
}
|
|
24395
24477
|
const persistedUntaggedInputIds = deps.compactionOff || deps.transformMode === "rust" ? [] : readPersistedLkgUntaggedInputIds(deps.db, sessionId);
|
|
24396
24478
|
const untaggedReplayIds = new Set([
|
|
24397
24479
|
...recovery.prefix?.untaggedInputIds ?? [],
|
|
@@ -25428,9 +25510,15 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25428
25510
|
});
|
|
25429
25511
|
compactionModeTransitionPending.delete(sessionId);
|
|
25430
25512
|
if (recovery.prefix && !recoveryNormalized) {
|
|
25431
|
-
const
|
|
25432
|
-
|
|
25433
|
-
|
|
25513
|
+
const renderedById = new Map;
|
|
25514
|
+
for (const message of messages) {
|
|
25515
|
+
if (!message.info.id)
|
|
25516
|
+
continue;
|
|
25517
|
+
const group = renderedById.get(message.info.id) ?? [];
|
|
25518
|
+
group.push(message);
|
|
25519
|
+
renderedById.set(message.info.id, group);
|
|
25520
|
+
}
|
|
25521
|
+
const suffix = recoveryTailSources.flatMap(({ identity, pristineSystem }) => pristineSystem ? [pristineSystem] : renderedById.get(identity) ?? []);
|
|
25434
25522
|
messages.splice(0, messages.length, ...JSON.parse(recovery.prefix.json), ...suffix);
|
|
25435
25523
|
}
|
|
25436
25524
|
const recoveryReleaseReason = recovery.rebuildReason ?? (recoveryNormalized ? "recovery_tail_normalized" : undefined);
|
|
@@ -26373,6 +26461,8 @@ function replayCommittedDrops(db, sessionId, messages) {
|
|
|
26373
26461
|
const toolThinking = new Map;
|
|
26374
26462
|
const batch = new ToolMutationBatch(messages);
|
|
26375
26463
|
for (const message of messages) {
|
|
26464
|
+
if (message.info.syntheticHead === true)
|
|
26465
|
+
continue;
|
|
26376
26466
|
if (message.info.role === "user")
|
|
26377
26467
|
precedingThinking = [];
|
|
26378
26468
|
const thinking = message.parts.filter(isThinkingPart);
|
|
@@ -26406,9 +26496,10 @@ function replayCommittedDrops(db, sessionId, messages) {
|
|
|
26406
26496
|
message,
|
|
26407
26497
|
setContent(content) {
|
|
26408
26498
|
if (isTextPart(part)) {
|
|
26409
|
-
|
|
26499
|
+
const rendered = renderDroppedText(tag.tagNumber, part.text);
|
|
26500
|
+
if (part.text === rendered)
|
|
26410
26501
|
return false;
|
|
26411
|
-
part.text =
|
|
26502
|
+
part.text = rendered;
|
|
26412
26503
|
} else
|
|
26413
26504
|
message.parts[p] = { type: "text", text: content };
|
|
26414
26505
|
return true;
|
|
@@ -27725,7 +27816,7 @@ function createCtxMemoryTool(deps) {
|
|
|
27725
27816
|
const memoryOwnedByTool = (memory) => visibility.owned(memory);
|
|
27726
27817
|
const embeddingSnapshot = getProjectEmbeddingSnapshot2(projectPath);
|
|
27727
27818
|
if (embeddingSnapshot ? !embeddingSnapshot.features.memoryEnabled : deps.memoryEnabled === false) {
|
|
27728
|
-
return getDisabledMessage();
|
|
27819
|
+
return embeddingSnapshot?.memoryDisabledReason ?? getDisabledMessage();
|
|
27729
27820
|
}
|
|
27730
27821
|
if (args.action === "write") {
|
|
27731
27822
|
const content = args.content?.trim();
|