@cortexkit/opencode-magic-context 0.49.86 → 0.49.89
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/{announcement-fnyxaahs.js → announcement-4ynkaf0d.js} +2 -2
- package/dist/auto-search-worker.js +13 -7
- package/dist/chunk-embedding-write-worker.js +7 -7
- package/dist/{compartment-chunk-embedding-ymc9mtwv.js → compartment-chunk-embedding-fey2bsyf.js} +3 -1
- package/dist/{conflict-warning-hook-a0wrnzch.js → conflict-warning-hook-kbq6ppjf.js} +2 -2
- package/dist/{context-xesm7rj3.js → context-grdg1k2k.js} +132 -52
- package/dist/{derive-budgets-90869322.js → derive-budgets-hzzq71rm.js} +2 -2
- package/dist/{embedding-backfill-v6sw58m8.js → embedding-backfill-qjkaee9s.js} +8 -8
- package/dist/{v2/embedding-cache-mgyr73ef.js → embedding-cache-zn4r1c31.js} +5 -1
- package/dist/embedding-worker.js +2 -2
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -0
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/token-budget.d.ts +8 -3
- package/dist/features/magic-context/dreamer/token-budget.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-cache.d.ts +7 -0
- package/dist/features/magic-context/memory/embedding-cache.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +6 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/tool-definition-tokens.d.ts +2 -0
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-probe.fixture.d.ts +2 -0
- package/dist/hooks/magic-context/auto-search-worker-probe.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-recomp-carry.d.ts +4 -0
- package/dist/hooks/magic-context/compartment-runner-recomp-carry.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts +8 -2
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts +2 -0
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +3 -5
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts +11 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +1 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-s8ks5nz4.js → index-2pdgy88n.js} +5 -5
- package/dist/{index-7j2zv9nm.js → index-2qsca7h7.js} +47 -11
- package/dist/{index-1bqkqde0.js → index-39rzef89.js} +9 -7
- package/dist/{index-snbpdpa3.js → index-3pdknr07.js} +4 -4
- package/dist/{index-c5tmzym6.js → index-5df2fw5b.js} +108 -13
- package/dist/{index-7svecf3m.js → index-5pgyqgmx.js} +1 -1
- package/dist/{index-xrnhxkz7.js → index-60wnwcwz.js} +1 -1
- package/dist/{index-k50xhjw1.js → index-60x5d68t.js} +1 -1
- package/dist/{index-4ntnt8ee.js → index-61knrt52.js} +1 -1
- package/dist/{index-g6hfh4h4.js → index-6zewd2n5.js} +14 -8
- package/dist/{index-70cv85b0.js → index-78t37mcq.js} +2 -2
- package/dist/{index-stx8zd81.js → index-83qd3n7s.js} +2 -2
- package/dist/{index-nny4gm06.js → index-9d3qgwq0.js} +2 -2
- package/dist/{index-jjvbk92s.js → index-9emdjcb5.js} +1 -1
- package/dist/{index-05bm2ndp.js → index-chpzb6xy.js} +1 -1
- package/dist/{index-2kf73btc.js → index-cr483vx6.js} +1 -1
- package/dist/{index-d0rtbv0f.js → index-dk3hy2a2.js} +21 -14
- package/dist/{index-gxdc95cp.js → index-g0mb2kb4.js} +585 -82
- package/dist/{index-w6v4dw5f.js → index-h9hybzr5.js} +5 -5
- package/dist/{index-1pf5qrx4.js → index-jzfsnbmm.js} +3 -3
- package/dist/{index-jrj95cce.js → index-m6dnydf8.js} +9 -2
- package/dist/{index-xccywqdj.js → index-mrjat4eq.js} +77 -14
- package/dist/{index-022w6314.js → index-n1ty0vd3.js} +116 -512
- package/dist/{index-ttk3trse.js → index-q7msfgwz.js} +311 -111
- package/dist/{index-e32b3x4n.js → index-qfcjrnpe.js} +7 -6
- package/dist/{v2/server-4dhv7mqz.js → index-qjwpqvnf.js} +48 -1
- package/dist/{index-3dtzyred.js → index-r4y0dczp.js} +1 -1
- package/dist/{index-4w5rx7de.js → index-tt0vs4x5.js} +2 -2
- package/dist/{index-k0tb2z28.js → index-w51n3576.js} +2 -2
- package/dist/{index-25nktq8n.js → index-wmb2mcdw.js} +7 -7
- package/dist/{index-zmqx48vt.js → index-xsqw8kbd.js} +1 -1
- package/dist/{index-fzgyvsb1.js → index-y14pawe1.js} +3 -0
- package/dist/{index-798s7c8s.js → index-zxhev8ze.js} +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +68 -59
- package/dist/{message-index-bounded-6fr624zf.js → message-index-bounded-r1qys471.js} +4 -4
- package/dist/migration-worker.js +5 -5
- package/dist/plugin/messages-transform.d.ts +3 -4
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/refusal-notice.d.ts +3 -0
- package/dist/plugin/refusal-notice.d.ts.map +1 -0
- package/dist/{project-embedding-registry-q80scexh.js → project-embedding-registry-m3fp1pa4.js} +7 -7
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-6wedfths.js → read-session-chunk-xv9f0wgb.js} +3 -3
- package/dist/{recomp-orchestrator-7ecg8ryx.js → recomp-orchestrator-dgyb394j.js} +23 -23
- package/dist/{render-yqp7q79f.js → render-d014e603.js} +12 -12
- package/dist/{rpc-notifications-t9q0ynq7.js → rpc-notifications-ta2zsxpq.js} +1 -1
- package/dist/{search-bw22d7zc.js → search-9gceftb9.js} +18 -18
- package/dist/{search-archive-r4h96j2z.js → search-archive-gybn6q7s.js} +5 -5
- package/dist/{send-session-notification-7x518gew.js → send-session-notification-gzxz88vq.js} +1 -1
- package/dist/shared/assistant-message-extractor.d.ts +2 -0
- package/dist/shared/assistant-message-extractor.d.ts.map +1 -1
- package/dist/shared/prompt-async-transport.d.ts.map +1 -1
- package/dist/shared/recomp-outcome.d.ts +4 -0
- package/dist/shared/recomp-outcome.d.ts.map +1 -0
- package/dist/shared/rpc-notifications.d.ts +1 -1
- package/dist/shared/rpc-notifications.d.ts.map +1 -1
- package/dist/shared/storage-permissions.d.ts +16 -2
- package/dist/shared/storage-permissions.d.ts.map +1 -1
- package/dist/shared/user-facing-codes.d.ts +4 -1
- package/dist/shared/user-facing-codes.d.ts.map +1 -1
- package/dist/{storage-memory-e6a7mb0k.js → storage-memory-hhrvfw0x.js} +2 -2
- package/dist/{storage-tags-y2mrb8e6.js → storage-tags-f1ftvjpw.js} +2 -2
- package/dist/{transform-postprocess-phase-t99yj9vt.js → transform-postprocess-phase-34k1zwsy.js} +24 -24
- package/dist/v2/auto-search-worker.js +13 -7
- package/dist/v2/chunk-embedding-write-worker.js +7 -7
- package/dist/v2/{compartment-chunk-embedding-x6qw6mjk.js → compartment-chunk-embedding-knt2468v.js} +3 -1
- package/dist/v2/{context-k8sx1nyy.js → context-8bzydxfy.js} +227 -70
- package/dist/v2/{derive-budgets-ecjy1aqh.js → derive-budgets-hr4qqrnv.js} +3 -3
- package/dist/v2/{embedding-backfill-k8kqnwfq.js → embedding-backfill-0ar1bm97.js} +8 -8
- package/dist/{embedding-cache-mgyr73ef.js → v2/embedding-cache-zn4r1c31.js} +5 -1
- package/dist/v2/embedding-worker.js +2 -2
- package/dist/v2/fold/native-replay.d.ts +3 -1
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/hidden-child-record.d.ts +1 -0
- package/dist/v2/hidden-child-record.d.ts.map +1 -1
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-jqy7283g.js → message-index-bounded-b07r9cjv.js} +4 -4
- package/dist/v2/migration-worker.js +5 -5
- package/dist/v2/{project-embedding-registry-2jp1antr.js → project-embedding-registry-gx2waee8.js} +7 -7
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-n3nhfvd7.js → read-session-chunk-38wdy8nd.js} +3 -3
- package/dist/v2/{recomp-orchestrator-ssde9ft1.js → recomp-orchestrator-wq7gbkqa.js} +24 -24
- package/dist/v2/{render-fezgh7pa.js → render-2dan17xc.js} +12 -12
- package/dist/v2/{rpc-notifications-t9q0ynq7.js → rpc-notifications-ta2zsxpq.js} +1 -1
- package/dist/v2/{search-archive-zz1kza50.js → search-archive-89hdy0a2.js} +5 -5
- package/dist/v2/{search-m251amra.js → search-nyqykx7q.js} +17 -17
- package/dist/v2/{send-session-notification-p52rhjzy.js → send-session-notification-zazaxxpf.js} +1 -1
- package/dist/v2/{server-4wwwm2ya.js → server-09h2vyvs.js} +5 -5
- package/dist/v2/{server-r2es6zt7.js → server-0tv6kytx.js} +108 -13
- package/dist/v2/{server-rz4snd3x.js → server-1rrmxhd1.js} +1 -1
- package/dist/v2/{server-wdq85mxj.js → server-6250cxzs.js} +14 -8
- package/dist/v2/{server-xa8fefhw.js → server-96nm9vk4.js} +1 -1
- package/dist/v2/{server-jjvbk92s.js → server-9emdjcb5.js} +1 -1
- package/dist/v2/{server-ap81bk3c.js → server-9n2qgk29.js} +1 -1
- package/dist/v2/{server-ps6rz88g.js → server-a85j3kam.js} +2 -2
- package/dist/v2/{server-y31y6gws.js → server-add0j5n3.js} +9 -7
- package/dist/v2/{server-97w51d8n.js → server-b0a9h3ds.js} +3 -3
- package/dist/v2/{server-2k8tkbhz.js → server-c7awk5s2.js} +10 -4
- package/dist/v2/{server-hn8b7sfe.js → server-dgjqvpgd.js} +5 -5
- package/dist/v2/{server-fsw8kbng.js → server-dtcwkdqj.js} +314 -114
- package/dist/v2/{server-mbkwcwgw.js → server-f7tzvmzs.js} +2 -2
- package/dist/v2/{server-n5zr7190.js → server-fb5hvvfc.js} +77 -14
- package/dist/v2/{server-w7mpvkpj.js → server-fn4ky6mn.js} +1 -1
- package/dist/v2/{server-3p6b0qya.js → server-gqkdfdvw.js} +1 -1
- package/dist/v2/{server-cwtehwbb.js → server-j4jjtdc5.js} +1 -1
- package/dist/v2/{server-b93f0bqh.js → server-pjk9spbf.js} +1 -1
- package/dist/v2/{server-s15knz0w.js → server-pmws7we9.js} +1 -1
- package/dist/{index-4dhv7mqz.js → v2/server-qjwpqvnf.js} +48 -1
- package/dist/v2/{server-a2f1bhyj.js → server-stjy5dxv.js} +9 -2
- package/dist/v2/{server-ssg29wjg.js → server-ta4h0fch.js} +21 -14
- package/dist/v2/{server-e2k9mt86.js → server-tj65pgvg.js} +1 -1
- package/dist/v2/{server-brgandk4.js → server-vy0beygw.js} +2 -2
- package/dist/v2/{server-fzgyvsb1.js → server-y14pawe1.js} +3 -0
- package/dist/v2/{server-8pdfmc27.js → server-y17r5ryz.js} +4 -4
- package/dist/v2/{server-sxfbjdye.js → server-yx0nyj1q.js} +2 -2
- package/dist/v2/server.js +6 -6
- package/dist/v2/{storage-memory-e6a7mb0k.js → storage-memory-hhrvfw0x.js} +2 -2
- package/dist/v2/{storage-tags-xq81zgt2.js → storage-tags-pmw33chf.js} +2 -2
- package/dist/v2/{v2-archive-reader-e2w39c3p.js → v2-archive-reader-gh1jghf7.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-eg5b1p89.js → wrapup-orchestrator-2h7ayss9.js} +24 -24
- package/dist/{v2-archive-reader-8dsngf2j.js → v2-archive-reader-8158kyfd.js} +1 -1
- package/dist/{wrapup-orchestrator-nmk6yf7f.js → wrapup-orchestrator-ct59br0c.js} +24 -24
- package/package.json +1 -1
- package/src/shared/assistant-message-extractor.test.ts +22 -0
- package/src/shared/assistant-message-extractor.ts +13 -0
- package/src/shared/model-suggestion-retry.test.ts +43 -12
- package/src/shared/prompt-async-transport.test.ts +275 -8
- package/src/shared/prompt-async-transport.ts +41 -2
- package/src/shared/recomp-outcome.ts +8 -0
- package/src/shared/reusable-worker.fixture.ts +15 -3
- package/src/shared/reusable-worker.test.ts +20 -10
- package/src/shared/rpc-notifications.ts +4 -1
- package/src/shared/sqlite-foreground-wait.test.ts +2 -2
- package/src/shared/startup-maintenance-policy.test.ts +4 -2
- package/src/shared/storage-permissions-startup.test.ts +296 -6
- package/src/shared/storage-permissions.ts +143 -18
- package/src/shared/user-facing-codes.ts +5 -2
- package/src/tui/dialogs/status-dialog.tsx +3 -0
- package/src/tui/slots/sidebar-content.tsx +6 -2
- package/src/tui-compiled/dialogs/status-dialog.tsx +12 -0
- package/src/tui-compiled/slots/sidebar-content.tsx +7 -2
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
getRawSessionTagKeysThrough2,
|
|
36
36
|
getLegacyProtectedTailStartOrdinal2,
|
|
37
37
|
readSessionChunk2
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-2qsca7h7.js";
|
|
39
39
|
import {
|
|
40
40
|
getHarness2,
|
|
41
41
|
harnessOwnsOpenCodeStore2
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
import {
|
|
65
65
|
ensureStorageDirectorySync,
|
|
66
66
|
writeStorageFileAtomicSync
|
|
67
|
-
} from "./index-
|
|
67
|
+
} from "./index-5df2fw5b.js";
|
|
68
68
|
import {
|
|
69
69
|
catalogOutputReserve,
|
|
70
70
|
setOutputReserveConfig,
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
deriveTriggerBudget2,
|
|
75
75
|
resolveHistorianProducerLimits2,
|
|
76
76
|
producerSourceLocalBudget2
|
|
77
|
-
} from "./index-
|
|
77
|
+
} from "./index-xsqw8kbd.js";
|
|
78
78
|
import {
|
|
79
79
|
withContentLanguageDirective,
|
|
80
80
|
buildPrimaryLanguageDirective,
|
|
@@ -111,13 +111,13 @@ import {
|
|
|
111
111
|
import {
|
|
112
112
|
shouldSkipHomeProjectMemory,
|
|
113
113
|
resolveProjectIdentity
|
|
114
|
-
} from "./index-
|
|
114
|
+
} from "./index-5pgyqgmx.js";
|
|
115
115
|
import {
|
|
116
116
|
getSchemaFenceRejection,
|
|
117
117
|
LATEST_SUPPORTED_VERSION,
|
|
118
118
|
getPersistedSchemaVersion,
|
|
119
119
|
openDatabase
|
|
120
|
-
} from "./index-
|
|
120
|
+
} from "./index-mrjat4eq.js";
|
|
121
121
|
import {
|
|
122
122
|
areRustHistorianSyntheticParts2,
|
|
123
123
|
isStrictGapHealingMessage2,
|
|
@@ -134,10 +134,10 @@ import {
|
|
|
134
134
|
resolveStoredPathWorkspaceIdentity,
|
|
135
135
|
sourceNameForMemory,
|
|
136
136
|
computeWorkspaceEpochFingerprint
|
|
137
|
-
} from "./index-
|
|
137
|
+
} from "./index-tt0vs4x5.js";
|
|
138
138
|
import {
|
|
139
139
|
BoundedSessionMap
|
|
140
|
-
} from "./index-
|
|
140
|
+
} from "./index-m6dnydf8.js";
|
|
141
141
|
import {
|
|
142
142
|
V2_MEMORY_CATEGORIES,
|
|
143
143
|
CATEGORY_PRIORITY,
|
|
@@ -161,7 +161,7 @@ import {
|
|
|
161
161
|
replaceCompartmentChunkEmbeddings2,
|
|
162
162
|
deleteChunkEmbedBackoffForSession2,
|
|
163
163
|
chunkWindowSourceKey2
|
|
164
|
-
} from "./index-
|
|
164
|
+
} from "./index-3pdknr07.js";
|
|
165
165
|
import {
|
|
166
166
|
COMPARTMENT_LEASE_RENEWAL_MS,
|
|
167
167
|
getCompartmentLeaseBlocker,
|
|
@@ -206,14 +206,14 @@ import {
|
|
|
206
206
|
getProjectState,
|
|
207
207
|
recordSubagentInvocation,
|
|
208
208
|
getLatestHistorianInvocationId
|
|
209
|
-
} from "./index-
|
|
209
|
+
} from "./index-h9hybzr5.js";
|
|
210
210
|
import {
|
|
211
211
|
clearCompressionDepth,
|
|
212
212
|
clearCompressionDepthRange,
|
|
213
213
|
toMessageIndexSource,
|
|
214
214
|
clearIndexedMessagesInTransaction,
|
|
215
215
|
indexSourcesAfterOrdinal
|
|
216
|
-
} from "./index-
|
|
216
|
+
} from "./index-chpzb6xy.js";
|
|
217
217
|
import {
|
|
218
218
|
stripWellFormedLeadingTagPrefix,
|
|
219
219
|
peelLeadingMcTagNotation,
|
|
@@ -263,7 +263,7 @@ import {
|
|
|
263
263
|
foldShrunkPartTags2,
|
|
264
264
|
getTagNumberByMessageId2,
|
|
265
265
|
getActiveTagsBySession2
|
|
266
|
-
} from "./index-
|
|
266
|
+
} from "./index-60wnwcwz.js";
|
|
267
267
|
import {
|
|
268
268
|
openCodeDbExists,
|
|
269
269
|
withReadOnlySessionDb,
|
|
@@ -273,10 +273,10 @@ import {
|
|
|
273
273
|
getSessionNotes,
|
|
274
274
|
getReadySmartNotes,
|
|
275
275
|
insertPrimerCandidates
|
|
276
|
-
} from "./index-
|
|
276
|
+
} from "./index-61knrt52.js";
|
|
277
277
|
import {
|
|
278
278
|
pushNotification2
|
|
279
|
-
} from "./index-
|
|
279
|
+
} from "./index-y14pawe1.js";
|
|
280
280
|
import {
|
|
281
281
|
computeCueContentHash,
|
|
282
282
|
getMuralCueState,
|
|
@@ -284,20 +284,20 @@ import {
|
|
|
284
284
|
getMemoriesByProject2,
|
|
285
285
|
getMemoriesByProjects2,
|
|
286
286
|
getMaxMemoryIdForProjects2
|
|
287
|
-
} from "./index-
|
|
287
|
+
} from "./index-9emdjcb5.js";
|
|
288
288
|
import {
|
|
289
289
|
contentSha2562,
|
|
290
290
|
enqueueShadowEmbeddingItems2,
|
|
291
291
|
getProjectChunkEmbeddingModelId2,
|
|
292
292
|
getProjectEmbeddingMaxInputTokens2,
|
|
293
293
|
embedItemsWindowBounded2
|
|
294
|
-
} from "./index-
|
|
294
|
+
} from "./index-2pdgy88n.js";
|
|
295
295
|
import {
|
|
296
296
|
renderUserFacingFailure,
|
|
297
297
|
userFacingFailureCode,
|
|
298
298
|
promoteSessionFactsDurable,
|
|
299
299
|
embedPromotedFacts
|
|
300
|
-
} from "./index-
|
|
300
|
+
} from "./index-39rzef89.js";
|
|
301
301
|
import {
|
|
302
302
|
isMarkerCandidateBasisCurrent2,
|
|
303
303
|
invalidateMarkerCandidateBasis2,
|
|
@@ -311,7 +311,7 @@ import {
|
|
|
311
311
|
} from "./index-832w615x.js";
|
|
312
312
|
import {
|
|
313
313
|
sendStatusNotification2
|
|
314
|
-
} from "./index-
|
|
314
|
+
} from "./index-6zewd2n5.js";
|
|
315
315
|
import {
|
|
316
316
|
isCompactionEnabled,
|
|
317
317
|
migrateLegacyAgentEnabledInMemory
|
|
@@ -5243,6 +5243,10 @@ function hasLengthCappedOutput(value) {
|
|
|
5243
5243
|
}
|
|
5244
5244
|
return Object.values(value).some((item) => hasLengthCappedOutput(item));
|
|
5245
5245
|
}
|
|
5246
|
+
function isLatestAssistantLengthCapped(messages) {
|
|
5247
|
+
const latest = getLatestAssistantMessage(messages);
|
|
5248
|
+
return hasLengthCappedOutput(latest?.info?.finish ? { finish: latest.info.finish } : null) || Array.isArray(latest?.parts) && latest.parts.some((part) => isRecord(part) && part.type === "step-finish" && hasLengthCappedOutput(part));
|
|
5249
|
+
}
|
|
5246
5250
|
function describeAssistantSettlement(output) {
|
|
5247
5251
|
if (isRecord(output) && isRecord(output.tokenLog)) {
|
|
5248
5252
|
return `finish=${String(output.tokenLog.finish_reason ?? "unknown")}, reasoning=${typeof output.reasoning === "string" && output.reasoning.length > 0}`;
|
|
@@ -6259,6 +6263,24 @@ function messageId(message) {
|
|
|
6259
6263
|
const id = infoOf(message).id;
|
|
6260
6264
|
return typeof id === "string" ? id : null;
|
|
6261
6265
|
}
|
|
6266
|
+
function inFlightAtAbort(messages, initialBaseline) {
|
|
6267
|
+
const reply = messages.slice().reverse().find((message) => {
|
|
6268
|
+
const id = messageId(message);
|
|
6269
|
+
return id !== null && !initialBaseline.has(id) && infoOf(message).role === "assistant";
|
|
6270
|
+
});
|
|
6271
|
+
const parts = reply?.parts;
|
|
6272
|
+
const ids = new Set;
|
|
6273
|
+
if (Array.isArray(parts)) {
|
|
6274
|
+
for (const part of parts) {
|
|
6275
|
+
if (part?.type !== "tool" || typeof part.callID !== "string")
|
|
6276
|
+
continue;
|
|
6277
|
+
const state = part.state;
|
|
6278
|
+
if (state?.status === "pending" || state?.status === "running" || state?.status === "error" && state.error === "Tool execution aborted" && state.metadata?.interrupted === true)
|
|
6279
|
+
ids.add(part.callID);
|
|
6280
|
+
}
|
|
6281
|
+
}
|
|
6282
|
+
return ids;
|
|
6283
|
+
}
|
|
6262
6284
|
function recordedAssistantError(message) {
|
|
6263
6285
|
const info = infoOf(message);
|
|
6264
6286
|
if (info.error != null)
|
|
@@ -6483,7 +6505,7 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
6483
6505
|
finalizing = true;
|
|
6484
6506
|
sessionLog2(sessionId, "dreamer token budget: finalize fired", budget.snapshot());
|
|
6485
6507
|
budgetAbortedSessions.add(sessionId);
|
|
6486
|
-
registerBudgetFinalizeChild(sessionId, budget);
|
|
6508
|
+
const countRefusals = registerBudgetFinalizeChild(sessionId, budget);
|
|
6487
6509
|
if (!session.abort)
|
|
6488
6510
|
throw new DreamTokenBudgetExceeded(sessionId, budget.snapshot().spent);
|
|
6489
6511
|
await session.abort({ path: { id: sessionId } });
|
|
@@ -6497,7 +6519,14 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
6497
6519
|
if (await readStatus(session, sessionId, dir, signal) !== "idle") {
|
|
6498
6520
|
throw new DreamTokenBudgetExceeded(sessionId, budget.snapshot().spent);
|
|
6499
6521
|
}
|
|
6500
|
-
|
|
6522
|
+
const cancelled = await readMessages(session, sessionId, dir, signal);
|
|
6523
|
+
completionBaseline = new Set((cancelled.length ? cancelled : messages).map(messageId).filter((value) => value !== null));
|
|
6524
|
+
const exemptCallIds = inFlightAtAbort(cancelled, initialBaseline);
|
|
6525
|
+
countRefusals(exemptCallIds);
|
|
6526
|
+
sessionLog2(sessionId, "dreamer token budget: counting tool refusals", {
|
|
6527
|
+
snapshot: cancelled.length ? "read" : "unreadable",
|
|
6528
|
+
exemptCallIds: [...exemptCallIds]
|
|
6529
|
+
});
|
|
6501
6530
|
const finalizeResponse = await session.promptAsync?.({
|
|
6502
6531
|
...request,
|
|
6503
6532
|
body: {
|
|
@@ -15396,6 +15425,16 @@ function sanitizeDumpName(value) {
|
|
|
15396
15425
|
return value.replace(/[^a-zA-Z0-9._-]/g, "-");
|
|
15397
15426
|
}
|
|
15398
15427
|
|
|
15428
|
+
// src/shared/recomp-outcome.ts
|
|
15429
|
+
var RECOMP_PAUSED_HEADING = "## Magic Recomp — Paused";
|
|
15430
|
+
function pausedRecompReason(message) {
|
|
15431
|
+
const prefix = `${RECOMP_PAUSED_HEADING}
|
|
15432
|
+
`;
|
|
15433
|
+
if (!message?.startsWith(prefix))
|
|
15434
|
+
return null;
|
|
15435
|
+
return message.slice(prefix.length).replace(/\s+/g, " ").trim();
|
|
15436
|
+
}
|
|
15437
|
+
|
|
15399
15438
|
// src/features/magic-context/compartment-embedding.ts
|
|
15400
15439
|
async function embedAndStoreCompartmentChunks(db, sessionId, projectPath, compartments) {
|
|
15401
15440
|
if (compartments.length === 0)
|
|
@@ -18517,15 +18556,44 @@ ${chunkText}`,
|
|
|
18517
18556
|
}
|
|
18518
18557
|
}
|
|
18519
18558
|
|
|
18559
|
+
// src/hooks/magic-context/compartment-runner-recomp-carry.ts
|
|
18560
|
+
function compartmentToInput(c, sequence) {
|
|
18561
|
+
return {
|
|
18562
|
+
sequence,
|
|
18563
|
+
startMessage: c.startMessage,
|
|
18564
|
+
endMessage: c.endMessage,
|
|
18565
|
+
startMessageId: c.startMessageId,
|
|
18566
|
+
endMessageId: c.endMessageId,
|
|
18567
|
+
startBlockIndex: c.startBlockIndex,
|
|
18568
|
+
endBlockIndex: c.endBlockIndex,
|
|
18569
|
+
title: c.title,
|
|
18570
|
+
content: c.content,
|
|
18571
|
+
p1: c.p1,
|
|
18572
|
+
p2: c.p2,
|
|
18573
|
+
p3: c.p3,
|
|
18574
|
+
p4: c.p4,
|
|
18575
|
+
importance: c.importance,
|
|
18576
|
+
episodeType: c.episodeType
|
|
18577
|
+
};
|
|
18578
|
+
}
|
|
18579
|
+
|
|
18520
18580
|
// src/hooks/magic-context/compartment-runner-recomp.ts
|
|
18521
|
-
function insertRecompCompartmentRows(db, sessionId, compartments, now) {
|
|
18522
|
-
const stmt = db.prepare(
|
|
18581
|
+
function insertRecompCompartmentRows(db, sessionId, compartments, now, carriedRows) {
|
|
18582
|
+
const stmt = db.prepare(`INSERT INTO compartments (session_id, sequence, start_message, end_message,
|
|
18583
|
+
start_message_id, end_message_id, title, content, p1, p2, p3, p4, importance,
|
|
18584
|
+
episode_type, legacy, created_at, harness, start_block_index, end_block_index, rebase_status)
|
|
18585
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
18523
18586
|
for (const c of compartments) {
|
|
18524
18587
|
const hasTiers = typeof c.p1 === "string" && c.p1.length > 0;
|
|
18525
|
-
|
|
18588
|
+
const carried = carriedRows?.get(c.sequence);
|
|
18589
|
+
stmt.run(sessionId, c.sequence, c.startMessage, c.endMessage, c.startMessageId, c.endMessageId, c.title, c.content, c.p1 ?? null, c.p2 ?? null, c.p3 ?? null, c.p4 ?? null, typeof c.importance === "number" ? c.importance : 50, c.episodeType ?? null, carried?.legacy ?? (hasTiers ? 0 : 1), now, getHarness2(), c.startBlockIndex ?? null, c.endBlockIndex ?? null, carried?.rebaseStatus ?? "ok");
|
|
18526
18590
|
}
|
|
18527
18591
|
}
|
|
18528
|
-
function promoteRecompStagingWithM0Mutation(db, sessionId, holderId) {
|
|
18592
|
+
function promoteRecompStagingWithM0Mutation(db, sessionId, holderId, carriedRows) {
|
|
18593
|
+
const promoted = promoteRecompStaging(db, sessionId, holderId, undefined, carriedRows);
|
|
18594
|
+
return typeof promoted === "string" ? null : promoted;
|
|
18595
|
+
}
|
|
18596
|
+
function promoteRecompStaging(db, sessionId, holderId, stopped, carriedRows) {
|
|
18529
18597
|
const now = Date.now();
|
|
18530
18598
|
db.exec("BEGIN IMMEDIATE");
|
|
18531
18599
|
const transactionStartedAt = performance.now();
|
|
@@ -18534,18 +18602,40 @@ function promoteRecompStagingWithM0Mutation(db, sessionId, holderId) {
|
|
|
18534
18602
|
if (!isCompartmentLeaseHeld(db, sessionId, holderId)) {
|
|
18535
18603
|
db.exec("ROLLBACK");
|
|
18536
18604
|
finished = true;
|
|
18537
|
-
return
|
|
18605
|
+
return "lease-lost";
|
|
18538
18606
|
}
|
|
18539
18607
|
const staging = getRecompStaging(db, sessionId);
|
|
18540
|
-
|
|
18608
|
+
const staged = staging?.compartments.at(-1);
|
|
18609
|
+
if (!staging || !staged) {
|
|
18541
18610
|
db.exec("ROLLBACK");
|
|
18542
18611
|
finished = true;
|
|
18543
|
-
return
|
|
18612
|
+
return "staging-removed";
|
|
18613
|
+
}
|
|
18614
|
+
let carried = null;
|
|
18615
|
+
if (stopped) {
|
|
18616
|
+
const live = readLiveRanges(db, sessionId);
|
|
18617
|
+
const stagedEnd = resolvedOrdinal(sessionId, staged.endMessageId) ?? staged.endMessage;
|
|
18618
|
+
if (live.some((row) => row.end > stagedEnd)) {
|
|
18619
|
+
if (stopped.allowCarry)
|
|
18620
|
+
carried = readAlignedLiveTail(db, sessionId, live, staging, stagedEnd);
|
|
18621
|
+
if (!carried) {
|
|
18622
|
+
if (stopped.discardIfShort) {
|
|
18623
|
+
clearRecompStaging(db, sessionId);
|
|
18624
|
+
db.exec("COMMIT");
|
|
18625
|
+
finished = true;
|
|
18626
|
+
return "discarded";
|
|
18627
|
+
}
|
|
18628
|
+
db.exec("ROLLBACK");
|
|
18629
|
+
finished = true;
|
|
18630
|
+
return "would-shrink";
|
|
18631
|
+
}
|
|
18632
|
+
}
|
|
18544
18633
|
}
|
|
18634
|
+
const compartments = carried ? [...staging.compartments, ...carried.compartments] : staging.compartments;
|
|
18545
18635
|
deleteChunkEmbedBackoffForSession2(db, sessionId);
|
|
18546
18636
|
db.prepare("DELETE FROM compartments WHERE session_id = ?").run(sessionId);
|
|
18547
18637
|
db.prepare("DELETE FROM session_facts WHERE session_id = ?").run(sessionId);
|
|
18548
|
-
insertRecompCompartmentRows(db, sessionId,
|
|
18638
|
+
insertRecompCompartmentRows(db, sessionId, compartments, now, carried?.rows ?? carriedRows);
|
|
18549
18639
|
queueM0Mutation(db, {
|
|
18550
18640
|
sessionId,
|
|
18551
18641
|
mutationType: "recomp_boundary_change",
|
|
@@ -18559,7 +18649,12 @@ function promoteRecompStagingWithM0Mutation(db, sessionId, holderId) {
|
|
|
18559
18649
|
finished = true;
|
|
18560
18650
|
invalidateAutoEmbedSession(sessionId);
|
|
18561
18651
|
logSlowWriteTransaction("historian-publish:recomp", transactionStartedAt);
|
|
18562
|
-
return {
|
|
18652
|
+
return {
|
|
18653
|
+
compartments,
|
|
18654
|
+
facts: staging.facts,
|
|
18655
|
+
carriedCount: carried?.compartments.length ?? 0,
|
|
18656
|
+
carriedThrough: carried?.end ?? null
|
|
18657
|
+
};
|
|
18563
18658
|
} finally {
|
|
18564
18659
|
if (!finished) {
|
|
18565
18660
|
try {
|
|
@@ -18568,6 +18663,69 @@ function promoteRecompStagingWithM0Mutation(db, sessionId, holderId) {
|
|
|
18568
18663
|
}
|
|
18569
18664
|
}
|
|
18570
18665
|
}
|
|
18666
|
+
function resolvedOrdinal(sessionId, id) {
|
|
18667
|
+
return id ? readRawSessionMessageOrdinalById2(sessionId, id) : null;
|
|
18668
|
+
}
|
|
18669
|
+
function readLiveRanges(db, sessionId) {
|
|
18670
|
+
const rows = db.prepare(`SELECT sequence, start_message, start_message_id, end_message, end_message_id FROM compartments
|
|
18671
|
+
WHERE session_id = ? ORDER BY sequence`).all(sessionId);
|
|
18672
|
+
return rows.map((row) => {
|
|
18673
|
+
const resolvedEnd = resolvedOrdinal(sessionId, row.end_message_id);
|
|
18674
|
+
return { ...row, end: resolvedEnd ?? row.end_message, resolvedEnd };
|
|
18675
|
+
});
|
|
18676
|
+
}
|
|
18677
|
+
function readAlignedLiveTail(db, sessionId, live, staging, stagedEnd) {
|
|
18678
|
+
let next = 1;
|
|
18679
|
+
let seam;
|
|
18680
|
+
for (const row of live) {
|
|
18681
|
+
const start = resolvedOrdinal(sessionId, row.start_message_id);
|
|
18682
|
+
if ((start ?? row.start_message) !== next || row.end < next)
|
|
18683
|
+
return null;
|
|
18684
|
+
if (seam !== undefined && (start === null || row.resolvedEnd === null))
|
|
18685
|
+
return null;
|
|
18686
|
+
if (row.end === stagedEnd)
|
|
18687
|
+
seam = row.sequence;
|
|
18688
|
+
next = row.end + 1;
|
|
18689
|
+
}
|
|
18690
|
+
if (seam === undefined)
|
|
18691
|
+
return null;
|
|
18692
|
+
const seamSequence = seam;
|
|
18693
|
+
const tail = getCompartments(db, sessionId).filter((row) => row.sequence > seamSequence);
|
|
18694
|
+
if (!tail.length || tail.length !== live.filter((row) => row.sequence > seamSequence).length)
|
|
18695
|
+
return null;
|
|
18696
|
+
return {
|
|
18697
|
+
compartments: tail.map((row, index) => compartmentToInput(row, staging.compartments.length + index)),
|
|
18698
|
+
rows: new Map(tail.map((row, index) => [staging.compartments.length + index, row])),
|
|
18699
|
+
end: next - 1
|
|
18700
|
+
};
|
|
18701
|
+
}
|
|
18702
|
+
function getResumableFullStaging(db, sessionId, rawMessageCount) {
|
|
18703
|
+
const staging = getRecompStaging(db, sessionId);
|
|
18704
|
+
let reason = null;
|
|
18705
|
+
if (getRecompPartialRange(db, sessionId)) {
|
|
18706
|
+
reason = "the staged passes were for a range rebuild";
|
|
18707
|
+
} else if (staging) {
|
|
18708
|
+
reason = validateStoredCompartments(staging.compartments);
|
|
18709
|
+
if (!reason) {
|
|
18710
|
+
const ordinals = readRawSessionMessageIdOrdinalsForRange2(sessionId, 1, Math.min(rawMessageCount, staging.lastEndMessage));
|
|
18711
|
+
if (staging.compartments.some(({ startMessage, endMessage, startMessageId, endMessageId }) => ordinals.get(startMessageId) !== startMessage || ordinals.get(endMessageId) !== endMessage)) {
|
|
18712
|
+
reason = "staged endpoints no longer match the raw history";
|
|
18713
|
+
}
|
|
18714
|
+
}
|
|
18715
|
+
}
|
|
18716
|
+
if (!reason)
|
|
18717
|
+
return staging;
|
|
18718
|
+
clearRecompStaging(db, sessionId);
|
|
18719
|
+
sessionLog2(sessionId, `recomp discarded staging: ${reason}`);
|
|
18720
|
+
return null;
|
|
18721
|
+
}
|
|
18722
|
+
var PUBLISH_LEASE_LOST = `## Magic Recomp — Skipped
|
|
18723
|
+
|
|
18724
|
+
Another process acquired the compartment-state lease before recomp could publish. No state was written.`;
|
|
18725
|
+
var STAGING_REMOVED = `## Magic Recomp — Failed
|
|
18726
|
+
|
|
18727
|
+
The unfinished rebuild was removed because the session's history changed. Nothing was published.
|
|
18728
|
+
Run /ctx-recomp again.`;
|
|
18571
18729
|
async function executeContextRecompInternal(deps) {
|
|
18572
18730
|
const {
|
|
18573
18731
|
client,
|
|
@@ -18610,6 +18768,12 @@ Session ordinals are warming in the background. Retry shortly; no history was re
|
|
|
18610
18768
|
updateSessionMeta(db, sessionId, { compartmentInProgress: true });
|
|
18611
18769
|
try {
|
|
18612
18770
|
const rawMessageCount = getRawSessionMessageCount2(sessionId);
|
|
18771
|
+
const existingStaging = getResumableFullStaging(db, sessionId, rawMessageCount);
|
|
18772
|
+
if (rawMessageCount <= 0) {
|
|
18773
|
+
return `## Magic Recomp
|
|
18774
|
+
|
|
18775
|
+
No raw history exists, so nothing was rebuilt.`;
|
|
18776
|
+
}
|
|
18613
18777
|
const boundarySnapshot = resolveOpenCodeProtectedTailBoundary({
|
|
18614
18778
|
db,
|
|
18615
18779
|
sessionId,
|
|
@@ -18620,21 +18784,21 @@ Session ordinals are warming in the background. Retry shortly; no history was re
|
|
|
18620
18784
|
usageSource: "provisional-zero"
|
|
18621
18785
|
});
|
|
18622
18786
|
const protectedTailStart = Math.min(boundarySnapshot.protectedTailStart, rawMessageCount + 1);
|
|
18623
|
-
if (
|
|
18624
|
-
return `## Magic Recomp
|
|
18787
|
+
if (!existingStaging && protectedTailStart === 1) {
|
|
18788
|
+
return `## Magic Recomp — Skipped
|
|
18625
18789
|
|
|
18626
|
-
|
|
18790
|
+
Nothing to rebuild yet: every message is still in the recent part that is kept raw.`;
|
|
18627
18791
|
}
|
|
18628
18792
|
const parentSessionResponse = await client?.session.get({ path: { id: sessionId } }).catch(() => null);
|
|
18629
18793
|
const parentSession = normalizeSDKResponse(parentSessionResponse, null, { preferResponseOnMissingData: true });
|
|
18630
18794
|
const sessionDirectory = parentSession?.directory ?? directory;
|
|
18631
|
-
const existingStaging = getRecompStaging(db, sessionId);
|
|
18632
18795
|
let candidateCompartments = existingStaging?.compartments ?? [];
|
|
18633
18796
|
let candidateFacts = existingStaging?.facts ?? [];
|
|
18634
18797
|
let offset = existingStaging ? existingStaging.lastEndMessage + 1 : 1;
|
|
18635
18798
|
let passCount = existingStaging?.passCount ?? 0;
|
|
18636
18799
|
let currentTokenBudget = historianChunkTokens;
|
|
18637
18800
|
let passAttempt = 1;
|
|
18801
|
+
let hadModelFailureOrBudgetReduction = false;
|
|
18638
18802
|
const resumed = existingStaging !== null;
|
|
18639
18803
|
if (resumed) {
|
|
18640
18804
|
await sendStatusNotification2(client, sessionId, `## Magic Recomp — Resumed
|
|
@@ -18659,19 +18823,53 @@ Found ${existingStaging.compartments.length} staged compartment(s) from ${existi
|
|
|
18659
18823
|
} catch {}
|
|
18660
18824
|
};
|
|
18661
18825
|
emitProgress("Preparing…");
|
|
18662
|
-
async function promoteAndFinalize(reason) {
|
|
18826
|
+
async function promoteAndFinalize(reason, heading = "Partial", failure = "recomp_unavailable", sentence, deterministicStop = false) {
|
|
18663
18827
|
if (passCount === 0 || candidateCompartments.length === 0)
|
|
18664
18828
|
return null;
|
|
18665
18829
|
const mergedError = validateStoredCompartments(candidateCompartments);
|
|
18666
18830
|
if (mergedError)
|
|
18667
18831
|
return null;
|
|
18668
|
-
saveRecompStagingPass(db, sessionId, passCount, candidateCompartments, candidateFacts);
|
|
18669
18832
|
const lastCompartmentEnd = candidateCompartments[candidateCompartments.length - 1]?.endMessage ?? 0;
|
|
18670
18833
|
const compartmentTagKeys = lastCompartmentEnd > 0 ? await getRawSessionTagKeysThrough2(sessionId, lastCompartmentEnd, { db }) : null;
|
|
18671
|
-
const promoted =
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
|
|
18834
|
+
const promoted = promoteRecompStaging(db, sessionId, leaseHolderId, {
|
|
18835
|
+
allowCarry: heading === "Complete",
|
|
18836
|
+
discardIfShort: deterministicStop && passAttempt === 1 && !hadModelFailureOrBudgetReduction && resumed && passCount === existingStaging.passCount
|
|
18837
|
+
});
|
|
18838
|
+
if (promoted === "would-shrink" || promoted === "discarded") {
|
|
18839
|
+
const detail = renderUserFacingFailure(failure, "markdown", {
|
|
18840
|
+
sentence,
|
|
18841
|
+
...failure !== "historian_window_too_small" ? { action: "" } : {}
|
|
18842
|
+
});
|
|
18843
|
+
if (promoted === "discarded") {
|
|
18844
|
+
return [
|
|
18845
|
+
"## Magic Recomp — Failed",
|
|
18846
|
+
"",
|
|
18847
|
+
`The rebuild could not get past message ${offset}. ${detail}`,
|
|
18848
|
+
"The unfinished rebuild was discarded.",
|
|
18849
|
+
"Your current history is unchanged."
|
|
18850
|
+
].join(`
|
|
18851
|
+
`);
|
|
18852
|
+
}
|
|
18853
|
+
const continueFrom = `Run /ctx-recomp again to continue from message ${lastCompartmentEnd + 1}.`;
|
|
18854
|
+
return [
|
|
18855
|
+
RECOMP_PAUSED_HEADING,
|
|
18856
|
+
"",
|
|
18857
|
+
resumed ? `Messages 1-${lastCompartmentEnd} of ${totalMessages} are rebuilt and kept for the next run. ${detail}` : `Rebuilt messages 1-${lastCompartmentEnd} of ${totalMessages}, then stopped. ${detail}`,
|
|
18858
|
+
"Your current history is unchanged.",
|
|
18859
|
+
deterministicStop ? `${continueFrom} If it stops at the same place again, the unfinished rebuild is discarded and your history stays as it is.` : continueFrom
|
|
18860
|
+
].join(`
|
|
18861
|
+
`);
|
|
18862
|
+
}
|
|
18863
|
+
if (promoted === "lease-lost")
|
|
18864
|
+
return PUBLISH_LEASE_LOST;
|
|
18865
|
+
if (promoted === "staging-removed")
|
|
18866
|
+
return STAGING_REMOVED;
|
|
18867
|
+
afterPublish("compression-depth", () => {
|
|
18868
|
+
if (promoted.carriedCount > 0)
|
|
18869
|
+
clearCompressionDepthRange(db, sessionId, 1, lastCompartmentEnd);
|
|
18870
|
+
else
|
|
18871
|
+
clearCompressionDepth(db, sessionId);
|
|
18872
|
+
});
|
|
18675
18873
|
if (deps.preserveInjectionCacheUntilConsumed !== true) {
|
|
18676
18874
|
clearInjectionCache(sessionId);
|
|
18677
18875
|
}
|
|
@@ -18691,9 +18889,10 @@ Found ${existingStaging.compartments.length} staged compartment(s) from ${existi
|
|
|
18691
18889
|
afterPublish("drop-queue", () => queueDropsForCompartmentalizedMessages(db, sessionId, lastCompartmentEnd, compartmentTagKeys));
|
|
18692
18890
|
}
|
|
18693
18891
|
afterPublish("publication-signal", () => deps.onCompartmentStatePublished?.(sessionId));
|
|
18694
|
-
|
|
18892
|
+
const publishedEnd = promoted.carriedThrough ?? lastCompartmentEnd;
|
|
18893
|
+
if (publishedEnd > 0) {
|
|
18695
18894
|
afterPublish("compaction-marker", () => {
|
|
18696
|
-
const markerUpdated = (deps.compactionMarkerStrategy?.publish ?? updateCompactionMarkerAfterPublication)(db, sessionId,
|
|
18895
|
+
const markerUpdated = (deps.compactionMarkerStrategy?.publish ?? updateCompactionMarkerAfterPublication)(db, sessionId, publishedEnd, deps.directory);
|
|
18697
18896
|
if (markerUpdated) {
|
|
18698
18897
|
const stalePending = getPendingCompactionMarkerState(db, sessionId);
|
|
18699
18898
|
if (stalePending) {
|
|
@@ -18702,8 +18901,26 @@ Found ${existingStaging.compartments.length} staged compartment(s) from ${existi
|
|
|
18702
18901
|
}
|
|
18703
18902
|
});
|
|
18704
18903
|
}
|
|
18904
|
+
const rebuilt = promoted.compartments.length - promoted.carriedCount;
|
|
18905
|
+
const rebuiltThrough = `Rebuilt ${rebuilt} history block${rebuilt === 1 ? "" : "s"} through message ${lastCompartmentEnd}.`;
|
|
18906
|
+
if (promoted.carriedCount > 0) {
|
|
18907
|
+
return [
|
|
18908
|
+
"## Magic Recomp — Complete",
|
|
18909
|
+
"",
|
|
18910
|
+
rebuiltThrough,
|
|
18911
|
+
`Kept ${promoted.carriedCount} existing history block${promoted.carriedCount === 1 ? "" : "s"} through message ${publishedEnd}.`
|
|
18912
|
+
].join(`
|
|
18913
|
+
`);
|
|
18914
|
+
}
|
|
18915
|
+
if (heading === "Complete") {
|
|
18916
|
+
return `## Magic Recomp — Complete
|
|
18917
|
+
|
|
18918
|
+
${rebuiltThrough} Messages ${offset} to ${protectedTailStart - 1} have nothing to summarize and stay as they are.`;
|
|
18919
|
+
}
|
|
18705
18920
|
sessionLog2(sessionId, `recomp partial code=${userFacingFailureCode("recomp_unavailable")} reason="${reason}"`);
|
|
18706
18921
|
return [
|
|
18922
|
+
`## Magic Recomp — ${heading}`,
|
|
18923
|
+
"",
|
|
18707
18924
|
`Rebuilt ${promoted.compartments.length} history block${promoted.compartments.length === 1 ? "" : "s"} across ${passCount} successful pass${passCount === 1 ? "" : "es"}.`,
|
|
18708
18925
|
renderUserFacingFailure("recomp_unavailable")
|
|
18709
18926
|
].join(`
|
|
@@ -18733,12 +18950,9 @@ Found ${existingStaging.compartments.length} staged compartment(s) from ${existi
|
|
|
18733
18950
|
compartmentsProduced: 0
|
|
18734
18951
|
});
|
|
18735
18952
|
sessionLog2(sessionId, `recomp failed code=${userFacingFailureCode("historian_window_too_small")} reason="${promptFit.reason}"`);
|
|
18736
|
-
const partial = await promoteAndFinalize(`the history model's window cannot hold a historian prompt: ${promptFit.reason}
|
|
18737
|
-
if (partial)
|
|
18738
|
-
return
|
|
18739
|
-
|
|
18740
|
-
${partial}`;
|
|
18741
|
-
}
|
|
18953
|
+
const partial = await promoteAndFinalize(`the history model's window cannot hold a historian prompt: ${promptFit.reason}`, "Partial", "historian_window_too_small");
|
|
18954
|
+
if (partial)
|
|
18955
|
+
return partial;
|
|
18742
18956
|
return `## Magic Recomp — Failed
|
|
18743
18957
|
|
|
18744
18958
|
${renderUserFacingFailure("historian_window_too_small")}`;
|
|
@@ -18746,26 +18960,22 @@ ${renderUserFacingFailure("historian_window_too_small")}`;
|
|
|
18746
18960
|
if (promptFit.trimmed || promptFit.chunkTokens < currentTokenBudget) {
|
|
18747
18961
|
sessionLog2(sessionId, `recomp prompt fit: ${describeHistorianPromptTrim(promptFit)} requestedChunkTokens=${currentTokenBudget}`);
|
|
18748
18962
|
}
|
|
18963
|
+
if (promptFit.chunkTokens < currentTokenBudget)
|
|
18964
|
+
hadModelFailureOrBudgetReduction = true;
|
|
18749
18965
|
const chunk = readSessionChunk2(sessionId, promptFit.chunkTokens, offset, protectedTailStart, { expandTools: deps.historianExpandTools });
|
|
18750
18966
|
if (!chunk.text || chunk.messageCount === 0 || chunk.endIndex < offset) {
|
|
18751
|
-
const promoted = await promoteAndFinalize(`remaining messages ${offset}-${protectedTailStart - 1} were too few or all noise to form a historian chunk`);
|
|
18752
|
-
if (promoted)
|
|
18753
|
-
return
|
|
18754
|
-
|
|
18755
|
-
${promoted}`;
|
|
18756
|
-
}
|
|
18967
|
+
const promoted = await promoteAndFinalize(`remaining messages ${offset}-${protectedTailStart - 1} were too few or all noise to form a historian chunk`, "Complete", "recomp_unavailable", `Raw history ${offset}-${protectedTailStart - 1} could not be turned into a valid historian chunk.`, true);
|
|
18968
|
+
if (promoted)
|
|
18969
|
+
return promoted;
|
|
18757
18970
|
return `## Magic Recomp — Failed
|
|
18758
18971
|
|
|
18759
18972
|
Recomp stopped because raw history ${offset}-${protectedTailStart - 1} could not be turned into a valid historian chunk. Nothing was written.`;
|
|
18760
18973
|
}
|
|
18761
18974
|
const chunkCoverageError = validateChunkCoverage(chunk);
|
|
18762
18975
|
if (chunkCoverageError) {
|
|
18763
|
-
const partial = await promoteAndFinalize(`chunk could not be represented safely: ${chunkCoverageError}
|
|
18764
|
-
if (partial)
|
|
18765
|
-
return
|
|
18766
|
-
|
|
18767
|
-
${partial}`;
|
|
18768
|
-
}
|
|
18976
|
+
const partial = await promoteAndFinalize(`chunk could not be represented safely: ${chunkCoverageError}`, "Partial", "recomp_unavailable", "The next chunk could not be represented safely.", true);
|
|
18977
|
+
if (partial)
|
|
18978
|
+
return partial;
|
|
18769
18979
|
sessionLog2(sessionId, `recomp failed code=${userFacingFailureCode("recomp_unavailable")} reason="${chunkCoverageError}"`);
|
|
18770
18980
|
return `## Magic Recomp — Failed
|
|
18771
18981
|
|
|
@@ -18807,6 +19017,7 @@ Historian pass ${passCount + 1}, attempt ${passAttempt} started for messages ${c
|
|
|
18807
19017
|
language: deps.language,
|
|
18808
19018
|
callbacks: {
|
|
18809
19019
|
onRepairRetry: async (error) => {
|
|
19020
|
+
hadModelFailureOrBudgetReduction = true;
|
|
18810
19021
|
emitProgress(`Repair retry (pass ${passCount + 1})…`);
|
|
18811
19022
|
sessionLog2(sessionId, `recomp retry code=${userFacingFailureCode("recomp_unavailable")} reason="${error}"`);
|
|
18812
19023
|
await sendStatusNotification2(client, sessionId, `## Magic Recomp
|
|
@@ -18814,12 +19025,14 @@ Historian pass ${passCount + 1}, attempt ${passAttempt} started for messages ${c
|
|
|
18814
19025
|
History compression is retrying this pass. ${renderUserFacingFailure("recomp_unavailable")}`, notifParams());
|
|
18815
19026
|
},
|
|
18816
19027
|
onModelFallback: (modelId, index, total) => {
|
|
19028
|
+
hadModelFailureOrBudgetReduction = true;
|
|
18817
19029
|
const short = modelId.includes("/") ? modelId.split("/").pop() : modelId;
|
|
18818
19030
|
emitProgress(`Trying fallback ${short} (${index}/${total})…`);
|
|
18819
19031
|
}
|
|
18820
19032
|
}
|
|
18821
19033
|
});
|
|
18822
19034
|
if (!validatedPass.ok) {
|
|
19035
|
+
hadModelFailureOrBudgetReduction = true;
|
|
18823
19036
|
const reducedBudget = getReducedRecompTokenBudget(promptFit.chunkTokens);
|
|
18824
19037
|
if (reducedBudget !== null) {
|
|
18825
19038
|
const smallerChunk = readSessionChunk2(sessionId, reducedBudget, offset, protectedTailStart, { expandTools: deps.historianExpandTools });
|
|
@@ -18845,11 +19058,8 @@ History compression is retrying with a smaller set of messages. ${renderUserFaci
|
|
|
18845
19058
|
});
|
|
18846
19059
|
sessionLog2(sessionId, `recomp failed code=${userFacingFailureCode("recomp_unavailable")} reason="${validatedPass.error}" messageRange=${chunk.startIndex}-${chunk.endIndex}`);
|
|
18847
19060
|
const partial = await promoteAndFinalize(`history model response did not validate for messages ${chunk.startIndex}-${chunk.endIndex}`);
|
|
18848
|
-
if (partial)
|
|
18849
|
-
return
|
|
18850
|
-
|
|
18851
|
-
${partial}`;
|
|
18852
|
-
}
|
|
19061
|
+
if (partial)
|
|
19062
|
+
return partial;
|
|
18853
19063
|
return `## Magic Recomp — Failed
|
|
18854
19064
|
|
|
18855
19065
|
${renderUserFacingFailure("recomp_unavailable")}`;
|
|
@@ -18876,6 +19086,17 @@ ${renderUserFacingFailure("recomp_unavailable")}`;
|
|
|
18876
19086
|
importanceAvg: imp.avg
|
|
18877
19087
|
});
|
|
18878
19088
|
}
|
|
19089
|
+
const nextOffset = (validatedPass.compartments?.[validatedPass.compartments.length - 1]?.endMessage ?? chunk.endIndex) + 1;
|
|
19090
|
+
if (nextOffset <= offset) {
|
|
19091
|
+
const reason = `Recomp made no forward progress after messages ${chunk.startIndex}-${chunk.endIndex}.`;
|
|
19092
|
+
const partial = await promoteAndFinalize(reason, "Partial", "recomp_unavailable", reason, true);
|
|
19093
|
+
if (partial)
|
|
19094
|
+
return partial;
|
|
19095
|
+
return `## Magic Recomp — Failed
|
|
19096
|
+
|
|
19097
|
+
${reason} Nothing was written.`;
|
|
19098
|
+
}
|
|
19099
|
+
const hadStagedPrefix = candidateCompartments.length > 0;
|
|
18879
19100
|
candidateCompartments = [
|
|
18880
19101
|
...candidateCompartments,
|
|
18881
19102
|
...validatedPass.compartments ?? []
|
|
@@ -18884,19 +19105,14 @@ ${renderUserFacingFailure("recomp_unavailable")}`;
|
|
|
18884
19105
|
passCount += 1;
|
|
18885
19106
|
currentTokenBudget = historianChunkTokens;
|
|
18886
19107
|
passAttempt = 1;
|
|
18887
|
-
|
|
18888
|
-
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
|
|
18895
|
-
}
|
|
18896
|
-
return `## Magic Recomp — Failed
|
|
18897
|
-
|
|
18898
|
-
Recomp made no forward progress after messages ${chunk.startIndex}-${chunk.endIndex}. Nothing was written.`;
|
|
18899
|
-
}
|
|
19108
|
+
const saved = db.transaction(() => {
|
|
19109
|
+
if (hadStagedPrefix && !db.prepare("SELECT 1 FROM recomp_compartments WHERE session_id = ? LIMIT 1").get(sessionId))
|
|
19110
|
+
return false;
|
|
19111
|
+
saveRecompStagingPass(db, sessionId, passCount, candidateCompartments, candidateFacts);
|
|
19112
|
+
return true;
|
|
19113
|
+
}).immediate();
|
|
19114
|
+
if (!saved)
|
|
19115
|
+
return STAGING_REMOVED;
|
|
18900
19116
|
offset = nextOffset;
|
|
18901
19117
|
emitProgress();
|
|
18902
19118
|
}
|
|
@@ -18908,15 +19124,15 @@ Recomp made no forward progress after messages ${chunk.startIndex}-${chunk.endIn
|
|
|
18908
19124
|
|
|
18909
19125
|
${renderUserFacingFailure("recomp_unavailable")}`;
|
|
18910
19126
|
}
|
|
18911
|
-
saveRecompStagingPass(db, sessionId, passCount, candidateCompartments, candidateFacts);
|
|
18912
19127
|
const lastCompartmentEnd = candidateCompartments[candidateCompartments.length - 1]?.endMessage ?? 0;
|
|
18913
19128
|
const compartmentTagKeys = lastCompartmentEnd > 0 ? await getRawSessionTagKeysThrough2(sessionId, lastCompartmentEnd, { db }) : null;
|
|
18914
|
-
const promoted =
|
|
18915
|
-
if (
|
|
19129
|
+
const promoted = promoteRecompStaging(db, sessionId, leaseHolderId);
|
|
19130
|
+
if (promoted === "staging-removed") {
|
|
19131
|
+
return candidateCompartments.length > 0 ? STAGING_REMOVED : PUBLISH_LEASE_LOST;
|
|
19132
|
+
}
|
|
19133
|
+
if (typeof promoted === "string") {
|
|
18916
19134
|
sessionLog2(sessionId, "recomp publish skipped: compartment lease no longer held");
|
|
18917
|
-
return
|
|
18918
|
-
|
|
18919
|
-
Another process acquired the compartment-state lease before recomp could publish. No state was written.`;
|
|
19135
|
+
return PUBLISH_LEASE_LOST;
|
|
18920
19136
|
}
|
|
18921
19137
|
afterPublish("compression-depth", () => clearCompressionDepth(db, sessionId));
|
|
18922
19138
|
if (deps.preserveInjectionCacheUntilConsumed !== true) {
|
|
@@ -19009,25 +19225,6 @@ function snapRangeToCompartments(compartments, range) {
|
|
|
19009
19225
|
tailCompartments: sorted.slice(lastEnclosingIdx + 1)
|
|
19010
19226
|
};
|
|
19011
19227
|
}
|
|
19012
|
-
function compartmentToInput(c, newSequence) {
|
|
19013
|
-
return {
|
|
19014
|
-
sequence: newSequence,
|
|
19015
|
-
startMessage: c.startMessage,
|
|
19016
|
-
endMessage: c.endMessage,
|
|
19017
|
-
startMessageId: c.startMessageId,
|
|
19018
|
-
endMessageId: c.endMessageId,
|
|
19019
|
-
startBlockIndex: c.startBlockIndex,
|
|
19020
|
-
endBlockIndex: c.endBlockIndex,
|
|
19021
|
-
title: c.title,
|
|
19022
|
-
content: c.content,
|
|
19023
|
-
p1: c.p1,
|
|
19024
|
-
p2: c.p2,
|
|
19025
|
-
p3: c.p3,
|
|
19026
|
-
p4: c.p4,
|
|
19027
|
-
importance: c.importance,
|
|
19028
|
-
episodeType: c.episodeType
|
|
19029
|
-
};
|
|
19030
|
-
}
|
|
19031
19228
|
async function executePartialRecompInternal(deps, range) {
|
|
19032
19229
|
const {
|
|
19033
19230
|
client,
|
|
@@ -19047,6 +19244,7 @@ Could not acquire the compartment-state lease for this session.`;
|
|
|
19047
19244
|
}
|
|
19048
19245
|
const leaseHolderId = holderId;
|
|
19049
19246
|
updateSessionMeta(db, sessionId, { compartmentInProgress: true });
|
|
19247
|
+
let wroteStaging = false;
|
|
19050
19248
|
try {
|
|
19051
19249
|
let promoteFinal = function() {
|
|
19052
19250
|
const newBuilt = candidateCompartments.slice(priorCompartments.length);
|
|
@@ -19082,7 +19280,12 @@ Could not acquire the compartment-state lease for this session.`;
|
|
|
19082
19280
|
return null;
|
|
19083
19281
|
}
|
|
19084
19282
|
saveRecompStagingPass(db, sessionId, passCount + 1, merged, stagedFacts);
|
|
19085
|
-
|
|
19283
|
+
wroteStaging = true;
|
|
19284
|
+
const carriedRows = new Map([
|
|
19285
|
+
...priorCompartments.map((c, idx) => [idx, c]),
|
|
19286
|
+
...tailCompartments.map((c, idx) => [candidateCompartments.length + idx, c])
|
|
19287
|
+
]);
|
|
19288
|
+
const promoted = promoteRecompStagingWithM0Mutation(db, sessionId, leaseHolderId, carriedRows);
|
|
19086
19289
|
if (!promoted) {
|
|
19087
19290
|
log2("[magic-context] partial recomp promote returned null");
|
|
19088
19291
|
return null;
|
|
@@ -19131,8 +19334,7 @@ ${snapResult.error}`;
|
|
|
19131
19334
|
"",
|
|
19132
19335
|
`An unfinished partial recomp is already staged for range ${storedRange.start}-${storedRange.end}, which does not match the requested range ${snapStart}-${snapEnd}.`,
|
|
19133
19336
|
"",
|
|
19134
|
-
"
|
|
19135
|
-
"or cancel it by running `/ctx-flush` before starting a new partial recomp."
|
|
19337
|
+
"Finish that range by running `/ctx-recomp` with the same original arguments, or run `/ctx-recomp` without arguments to start a full rebuild."
|
|
19136
19338
|
].join(`
|
|
19137
19339
|
`);
|
|
19138
19340
|
}
|
|
@@ -19140,9 +19342,7 @@ ${snapResult.error}`;
|
|
|
19140
19342
|
return [
|
|
19141
19343
|
"## Magic Recomp — Failed",
|
|
19142
19344
|
"",
|
|
19143
|
-
|
|
19144
|
-
"Resume it by running `/ctx-recomp` without arguments,",
|
|
19145
|
-
"or cancel it before starting a partial recomp."
|
|
19345
|
+
`A full rebuild is paused at message ${existingStaging.lastEndMessage}. Run \`/ctx-recomp\` without arguments to continue it. A partial recomp can start when it completes or is discarded.`
|
|
19146
19346
|
].join(`
|
|
19147
19347
|
`);
|
|
19148
19348
|
}
|
|
@@ -19164,6 +19364,7 @@ ${snapResult.error}`;
|
|
|
19164
19364
|
passCount = 0;
|
|
19165
19365
|
offset = snapStart;
|
|
19166
19366
|
saveRecompStagingPass(db, sessionId, 0, candidateCompartments, stagedFacts);
|
|
19367
|
+
wroteStaging = true;
|
|
19167
19368
|
setRecompPartialRange(db, sessionId, { start: snapStart, end: snapEnd });
|
|
19168
19369
|
}
|
|
19169
19370
|
let currentTokenBudget = historianChunkTokens;
|
|
@@ -19273,6 +19474,7 @@ ${renderUserFacingFailure("recomp_unavailable")}`;
|
|
|
19273
19474
|
currentTokenBudget = historianChunkTokens;
|
|
19274
19475
|
passAttempt = 1;
|
|
19275
19476
|
saveRecompStagingPass(db, sessionId, passCount, candidateCompartments, stagedFacts);
|
|
19477
|
+
wroteStaging = true;
|
|
19276
19478
|
const nextOffset = (validatedPass.compartments?.[validatedPass.compartments.length - 1]?.endMessage ?? chunk.endIndex) + 1;
|
|
19277
19479
|
if (nextOffset <= offset) {
|
|
19278
19480
|
return `## Magic Recomp — Failed
|
|
@@ -19304,9 +19506,7 @@ Partial recomp completed historian passes but the final compartment set failed v
|
|
|
19304
19506
|
${renderUserFacingFailure("recomp_unavailable")}`;
|
|
19305
19507
|
} finally {
|
|
19306
19508
|
updateSessionMeta(db, sessionId, { compartmentInProgress: false });
|
|
19307
|
-
|
|
19308
|
-
const leftoverRange = getRecompPartialRange(db, sessionId);
|
|
19309
|
-
if (leftoverStaging && leftoverRange) {} else if (leftoverStaging && !leftoverRange) {
|
|
19509
|
+
if (wroteStaging && getRecompStaging(db, sessionId) && !getRecompPartialRange(db, sessionId)) {
|
|
19310
19510
|
log2(`[magic-context] partial recomp cleanup: clearing orphaned staging without range marker for session ${sessionId}`);
|
|
19311
19511
|
clearRecompStaging(db, sessionId);
|
|
19312
19512
|
}
|
|
@@ -19506,4 +19706,4 @@ async function executeContextRecomp(deps, options = {}) {
|
|
|
19506
19706
|
return (await executeContextRecompWithResult(deps, options)).message;
|
|
19507
19707
|
}
|
|
19508
19708
|
|
|
19509
|
-
export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildZenReadAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, isCommitRetentionPaused, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError, providerOutputFailureFromInvalidManifest, supportsQuietHiddenChildren, matchesHiddenRunLocation, hiddenRunPlacement, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, HIDDEN_RUN_DISPOSED_REASON, noteChildOfDisposedInstance, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, hiddenModelCooldowns, ModelProducedNoOutputError, noteModelActivityMonitored, noteModelOutputReceived, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, annotateSubagentInvocationError, failedInvocationStatus, emptyTokenTotals, sumTokensFromChildMessages, recordChildInvocation, recordPromptSessionError, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, setKeepSubagents, teardownChildSession, getCompartmentEvents, runTokenLog, formatRunTokenLog, validateStoredCompartments, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, v2ToolDefinitionsHash, v2RequestToolsFingerprint, classifyRequestToolsChange, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, stripMemoryMuralBlock, servedHeadTexts, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, headMessagesForSizing, rawTailAfterNewestCompartment, hasCompleteCachedM0M1, injectM0M1, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readCoordinateGeneration, readCoordinateRebaseNotice, formatCoordinateRebaseNotice, rebaseSessionCoordinatesAsync, readHistorianFailureStreak, describeHistorianJoinRefusal, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, nonNarrativeStoredGapRanges, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
|
|
19709
|
+
export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildZenReadAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, isCommitRetentionPaused, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError, providerOutputFailureFromInvalidManifest, supportsQuietHiddenChildren, matchesHiddenRunLocation, hiddenRunPlacement, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, HIDDEN_RUN_DISPOSED_REASON, noteChildOfDisposedInstance, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, isLatestAssistantLengthCapped, parseProviderModel, modelBodyField, toModelEntry, hiddenModelCooldowns, ModelProducedNoOutputError, noteModelActivityMonitored, noteModelOutputReceived, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, annotateSubagentInvocationError, failedInvocationStatus, emptyTokenTotals, sumTokensFromChildMessages, recordChildInvocation, recordPromptSessionError, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, setKeepSubagents, teardownChildSession, getCompartmentEvents, runTokenLog, formatRunTokenLog, validateStoredCompartments, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, v2ToolDefinitionsHash, v2RequestToolsFingerprint, classifyRequestToolsChange, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, stripMemoryMuralBlock, servedHeadTexts, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, headMessagesForSizing, rawTailAfterNewestCompartment, hasCompleteCachedM0M1, injectM0M1, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, pausedRecompReason, readCoordinateGeneration, readCoordinateRebaseNotice, formatCoordinateRebaseNotice, rebaseSessionCoordinatesAsync, readHistorianFailureStreak, describeHistorianJoinRefusal, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, nonNarrativeStoredGapRanges, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
|