@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
|
@@ -19,13 +19,13 @@ import {
|
|
|
19
19
|
cortexKitProjectConfigBasePath,
|
|
20
20
|
resolveLegacyConfigSourcesForHarness,
|
|
21
21
|
loadPluginConfigDetailed
|
|
22
|
-
} from "./server-
|
|
22
|
+
} from "./server-tj65pgvg.js";
|
|
23
23
|
import {
|
|
24
24
|
catalogOutputReserve,
|
|
25
25
|
getSdkContextLimit,
|
|
26
26
|
modelSupportsVision,
|
|
27
27
|
getSdkOutputLimit
|
|
28
|
-
} from "./server-
|
|
28
|
+
} from "./server-96nm9vk4.js";
|
|
29
29
|
import {
|
|
30
30
|
withContentLanguageDirective,
|
|
31
31
|
buildPrimaryLanguageDirective,
|
|
@@ -101,7 +101,7 @@ import {
|
|
|
101
101
|
foldShrunkPartTags2,
|
|
102
102
|
getTagNumberByMessageId2,
|
|
103
103
|
getActiveTagsBySession2
|
|
104
|
-
} from "./server-
|
|
104
|
+
} from "./server-pmws7we9.js";
|
|
105
105
|
import {
|
|
106
106
|
hasMeaningfulUserText2,
|
|
107
107
|
estimateTokens,
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
} from "./server-y8xjr8rx.js";
|
|
110
110
|
import {
|
|
111
111
|
BoundedSessionMap
|
|
112
|
-
} from "./server-
|
|
112
|
+
} from "./server-stjy5dxv.js";
|
|
113
113
|
import {
|
|
114
114
|
resolveOpenCodeDbPath,
|
|
115
115
|
assertOpenCodeStoreGeneration,
|
|
@@ -156,14 +156,14 @@ import {
|
|
|
156
156
|
getRawSessionTagKeysThrough2,
|
|
157
157
|
getLegacyProtectedTailStartOrdinal2,
|
|
158
158
|
readSessionChunk2
|
|
159
|
-
} from "./server-
|
|
159
|
+
} from "./server-c7awk5s2.js";
|
|
160
160
|
import {
|
|
161
161
|
clearCompressionDepth,
|
|
162
162
|
clearCompressionDepthRange,
|
|
163
163
|
toMessageIndexSource,
|
|
164
164
|
clearIndexedMessagesInTransaction,
|
|
165
165
|
indexSourcesAfterOrdinal
|
|
166
|
-
} from "./server-
|
|
166
|
+
} from "./server-9n2qgk29.js";
|
|
167
167
|
import {
|
|
168
168
|
COMPARTMENT_LEASE_RENEWAL_MS,
|
|
169
169
|
getCompartmentLeaseBlocker,
|
|
@@ -210,7 +210,7 @@ import {
|
|
|
210
210
|
getProjectState,
|
|
211
211
|
recordSubagentInvocation,
|
|
212
212
|
getLatestHistorianInvocationId
|
|
213
|
-
} from "./server-
|
|
213
|
+
} from "./server-09h2vyvs.js";
|
|
214
214
|
import {
|
|
215
215
|
invalidateAutoEmbedSession
|
|
216
216
|
} from "./server-2amn2s73.js";
|
|
@@ -223,7 +223,7 @@ import {
|
|
|
223
223
|
replaceCompartmentChunkEmbeddings2,
|
|
224
224
|
deleteChunkEmbedBackoffForSession2,
|
|
225
225
|
chunkWindowSourceKey2
|
|
226
|
-
} from "./server-
|
|
226
|
+
} from "./server-y17r5ryz.js";
|
|
227
227
|
import {
|
|
228
228
|
isMarkerCandidateBasisCurrent2,
|
|
229
229
|
invalidateMarkerCandidateBasis2,
|
|
@@ -238,14 +238,14 @@ import {
|
|
|
238
238
|
import {
|
|
239
239
|
shouldSkipHomeProjectMemory,
|
|
240
240
|
resolveProjectIdentity
|
|
241
|
-
} from "./server-
|
|
241
|
+
} from "./server-1rrmxhd1.js";
|
|
242
242
|
import {
|
|
243
243
|
contentSha2562,
|
|
244
244
|
enqueueShadowEmbeddingItems2,
|
|
245
245
|
getProjectChunkEmbeddingModelId2,
|
|
246
246
|
getProjectEmbeddingMaxInputTokens2,
|
|
247
247
|
embedItemsWindowBounded2
|
|
248
|
-
} from "./server-
|
|
248
|
+
} from "./server-dgjqvpgd.js";
|
|
249
249
|
import {
|
|
250
250
|
V2_MEMORY_CATEGORIES,
|
|
251
251
|
CATEGORY_PRIORITY,
|
|
@@ -256,7 +256,7 @@ import {
|
|
|
256
256
|
userFacingFailureCode,
|
|
257
257
|
promoteSessionFactsDurable,
|
|
258
258
|
embedPromotedFacts
|
|
259
|
-
} from "./server-
|
|
259
|
+
} from "./server-add0j5n3.js";
|
|
260
260
|
import {
|
|
261
261
|
computeCueContentHash,
|
|
262
262
|
getMuralCueState,
|
|
@@ -264,13 +264,13 @@ import {
|
|
|
264
264
|
getMemoriesByProject2,
|
|
265
265
|
getMemoriesByProjects2,
|
|
266
266
|
getMaxMemoryIdForProjects2
|
|
267
|
-
} from "./server-
|
|
267
|
+
} from "./server-9emdjcb5.js";
|
|
268
268
|
import {
|
|
269
269
|
getSchemaFenceRejection,
|
|
270
270
|
LATEST_SUPPORTED_VERSION,
|
|
271
271
|
getPersistedSchemaVersion,
|
|
272
272
|
openDatabase
|
|
273
|
-
} from "./server-
|
|
273
|
+
} from "./server-fb5hvvfc.js";
|
|
274
274
|
import {
|
|
275
275
|
parseCompartmentOutput,
|
|
276
276
|
resolveWorkspaceShareCategories,
|
|
@@ -279,7 +279,7 @@ import {
|
|
|
279
279
|
resolveStoredPathWorkspaceIdentity,
|
|
280
280
|
sourceNameForMemory,
|
|
281
281
|
computeWorkspaceEpochFingerprint
|
|
282
|
-
} from "./server-
|
|
282
|
+
} from "./server-a85j3kam.js";
|
|
283
283
|
import {
|
|
284
284
|
FAIL_CLOSED_DOCTOR_COMMAND
|
|
285
285
|
} from "./server-39bcszk4.js";
|
|
@@ -287,18 +287,18 @@ import {
|
|
|
287
287
|
getSessionNotes,
|
|
288
288
|
getReadySmartNotes,
|
|
289
289
|
insertPrimerCandidates
|
|
290
|
-
} from "./server-
|
|
290
|
+
} from "./server-fn4ky6mn.js";
|
|
291
291
|
import {
|
|
292
292
|
pushNotification2
|
|
293
|
-
} from "./server-
|
|
293
|
+
} from "./server-y14pawe1.js";
|
|
294
294
|
import {
|
|
295
295
|
deriveTriggerBudget2,
|
|
296
296
|
resolveHistorianProducerLimits2,
|
|
297
297
|
producerSourceLocalBudget2
|
|
298
|
-
} from "./server-
|
|
298
|
+
} from "./server-j4jjtdc5.js";
|
|
299
299
|
import {
|
|
300
300
|
sendStatusNotification2
|
|
301
|
-
} from "./server-
|
|
301
|
+
} from "./server-6250cxzs.js";
|
|
302
302
|
import {
|
|
303
303
|
retreatPastHostUnservedRows,
|
|
304
304
|
snapTerminalCompartmentToServedRow,
|
|
@@ -3269,6 +3269,10 @@ function hasLengthCappedOutput(value) {
|
|
|
3269
3269
|
}
|
|
3270
3270
|
return Object.values(value).some((item) => hasLengthCappedOutput(item));
|
|
3271
3271
|
}
|
|
3272
|
+
function isLatestAssistantLengthCapped(messages) {
|
|
3273
|
+
const latest = getLatestAssistantMessage(messages);
|
|
3274
|
+
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));
|
|
3275
|
+
}
|
|
3272
3276
|
function describeAssistantSettlement(output) {
|
|
3273
3277
|
if (isRecord(output) && isRecord(output.tokenLog)) {
|
|
3274
3278
|
return `finish=${String(output.tokenLog.finish_reason ?? "unknown")}, reasoning=${typeof output.reasoning === "string" && output.reasoning.length > 0}`;
|
|
@@ -4415,6 +4419,24 @@ function messageId(message) {
|
|
|
4415
4419
|
const id = infoOf(message).id;
|
|
4416
4420
|
return typeof id === "string" ? id : null;
|
|
4417
4421
|
}
|
|
4422
|
+
function inFlightAtAbort(messages, initialBaseline) {
|
|
4423
|
+
const reply = messages.slice().reverse().find((message) => {
|
|
4424
|
+
const id = messageId(message);
|
|
4425
|
+
return id !== null && !initialBaseline.has(id) && infoOf(message).role === "assistant";
|
|
4426
|
+
});
|
|
4427
|
+
const parts = reply?.parts;
|
|
4428
|
+
const ids = new Set;
|
|
4429
|
+
if (Array.isArray(parts)) {
|
|
4430
|
+
for (const part of parts) {
|
|
4431
|
+
if (part?.type !== "tool" || typeof part.callID !== "string")
|
|
4432
|
+
continue;
|
|
4433
|
+
const state = part.state;
|
|
4434
|
+
if (state?.status === "pending" || state?.status === "running" || state?.status === "error" && state.error === "Tool execution aborted" && state.metadata?.interrupted === true)
|
|
4435
|
+
ids.add(part.callID);
|
|
4436
|
+
}
|
|
4437
|
+
}
|
|
4438
|
+
return ids;
|
|
4439
|
+
}
|
|
4418
4440
|
function recordedAssistantError(message) {
|
|
4419
4441
|
const info = infoOf(message);
|
|
4420
4442
|
if (info.error != null)
|
|
@@ -4639,7 +4661,7 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
4639
4661
|
finalizing = true;
|
|
4640
4662
|
sessionLog2(sessionId, "dreamer token budget: finalize fired", budget.snapshot());
|
|
4641
4663
|
budgetAbortedSessions.add(sessionId);
|
|
4642
|
-
registerBudgetFinalizeChild(sessionId, budget);
|
|
4664
|
+
const countRefusals = registerBudgetFinalizeChild(sessionId, budget);
|
|
4643
4665
|
if (!session.abort)
|
|
4644
4666
|
throw new DreamTokenBudgetExceeded(sessionId, budget.snapshot().spent);
|
|
4645
4667
|
await session.abort({ path: { id: sessionId } });
|
|
@@ -4653,7 +4675,14 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
4653
4675
|
if (await readStatus(session, sessionId, dir, signal) !== "idle") {
|
|
4654
4676
|
throw new DreamTokenBudgetExceeded(sessionId, budget.snapshot().spent);
|
|
4655
4677
|
}
|
|
4656
|
-
|
|
4678
|
+
const cancelled = await readMessages(session, sessionId, dir, signal);
|
|
4679
|
+
completionBaseline = new Set((cancelled.length ? cancelled : messages).map(messageId).filter((value) => value !== null));
|
|
4680
|
+
const exemptCallIds = inFlightAtAbort(cancelled, initialBaseline);
|
|
4681
|
+
countRefusals(exemptCallIds);
|
|
4682
|
+
sessionLog2(sessionId, "dreamer token budget: counting tool refusals", {
|
|
4683
|
+
snapshot: cancelled.length ? "read" : "unreadable",
|
|
4684
|
+
exemptCallIds: [...exemptCallIds]
|
|
4685
|
+
});
|
|
4657
4686
|
const finalizeResponse = await session.promptAsync?.({
|
|
4658
4687
|
...request,
|
|
4659
4688
|
body: {
|
|
@@ -15634,15 +15663,54 @@ ${chunkText}`,
|
|
|
15634
15663
|
}
|
|
15635
15664
|
}
|
|
15636
15665
|
|
|
15666
|
+
// src/shared/recomp-outcome.ts
|
|
15667
|
+
var RECOMP_PAUSED_HEADING = "## Magic Recomp — Paused";
|
|
15668
|
+
function pausedRecompReason(message) {
|
|
15669
|
+
const prefix = `${RECOMP_PAUSED_HEADING}
|
|
15670
|
+
`;
|
|
15671
|
+
if (!message?.startsWith(prefix))
|
|
15672
|
+
return null;
|
|
15673
|
+
return message.slice(prefix.length).replace(/\s+/g, " ").trim();
|
|
15674
|
+
}
|
|
15675
|
+
|
|
15676
|
+
// src/hooks/magic-context/compartment-runner-recomp-carry.ts
|
|
15677
|
+
function compartmentToInput(c, sequence) {
|
|
15678
|
+
return {
|
|
15679
|
+
sequence,
|
|
15680
|
+
startMessage: c.startMessage,
|
|
15681
|
+
endMessage: c.endMessage,
|
|
15682
|
+
startMessageId: c.startMessageId,
|
|
15683
|
+
endMessageId: c.endMessageId,
|
|
15684
|
+
startBlockIndex: c.startBlockIndex,
|
|
15685
|
+
endBlockIndex: c.endBlockIndex,
|
|
15686
|
+
title: c.title,
|
|
15687
|
+
content: c.content,
|
|
15688
|
+
p1: c.p1,
|
|
15689
|
+
p2: c.p2,
|
|
15690
|
+
p3: c.p3,
|
|
15691
|
+
p4: c.p4,
|
|
15692
|
+
importance: c.importance,
|
|
15693
|
+
episodeType: c.episodeType
|
|
15694
|
+
};
|
|
15695
|
+
}
|
|
15696
|
+
|
|
15637
15697
|
// src/hooks/magic-context/compartment-runner-recomp.ts
|
|
15638
|
-
function insertRecompCompartmentRows(db, sessionId, compartments, now) {
|
|
15639
|
-
const stmt = db.prepare(
|
|
15698
|
+
function insertRecompCompartmentRows(db, sessionId, compartments, now, carriedRows) {
|
|
15699
|
+
const stmt = db.prepare(`INSERT INTO compartments (session_id, sequence, start_message, end_message,
|
|
15700
|
+
start_message_id, end_message_id, title, content, p1, p2, p3, p4, importance,
|
|
15701
|
+
episode_type, legacy, created_at, harness, start_block_index, end_block_index, rebase_status)
|
|
15702
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
15640
15703
|
for (const c of compartments) {
|
|
15641
15704
|
const hasTiers = typeof c.p1 === "string" && c.p1.length > 0;
|
|
15642
|
-
|
|
15705
|
+
const carried = carriedRows?.get(c.sequence);
|
|
15706
|
+
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");
|
|
15643
15707
|
}
|
|
15644
15708
|
}
|
|
15645
|
-
function promoteRecompStagingWithM0Mutation(db, sessionId, holderId) {
|
|
15709
|
+
function promoteRecompStagingWithM0Mutation(db, sessionId, holderId, carriedRows) {
|
|
15710
|
+
const promoted = promoteRecompStaging(db, sessionId, holderId, undefined, carriedRows);
|
|
15711
|
+
return typeof promoted === "string" ? null : promoted;
|
|
15712
|
+
}
|
|
15713
|
+
function promoteRecompStaging(db, sessionId, holderId, stopped, carriedRows) {
|
|
15646
15714
|
const now = Date.now();
|
|
15647
15715
|
db.exec("BEGIN IMMEDIATE");
|
|
15648
15716
|
const transactionStartedAt = performance.now();
|
|
@@ -15651,18 +15719,40 @@ function promoteRecompStagingWithM0Mutation(db, sessionId, holderId) {
|
|
|
15651
15719
|
if (!isCompartmentLeaseHeld(db, sessionId, holderId)) {
|
|
15652
15720
|
db.exec("ROLLBACK");
|
|
15653
15721
|
finished = true;
|
|
15654
|
-
return
|
|
15722
|
+
return "lease-lost";
|
|
15655
15723
|
}
|
|
15656
15724
|
const staging = getRecompStaging(db, sessionId);
|
|
15657
|
-
|
|
15725
|
+
const staged = staging?.compartments.at(-1);
|
|
15726
|
+
if (!staging || !staged) {
|
|
15658
15727
|
db.exec("ROLLBACK");
|
|
15659
15728
|
finished = true;
|
|
15660
|
-
return
|
|
15729
|
+
return "staging-removed";
|
|
15730
|
+
}
|
|
15731
|
+
let carried = null;
|
|
15732
|
+
if (stopped) {
|
|
15733
|
+
const live = readLiveRanges(db, sessionId);
|
|
15734
|
+
const stagedEnd = resolvedOrdinal(sessionId, staged.endMessageId) ?? staged.endMessage;
|
|
15735
|
+
if (live.some((row) => row.end > stagedEnd)) {
|
|
15736
|
+
if (stopped.allowCarry)
|
|
15737
|
+
carried = readAlignedLiveTail(db, sessionId, live, staging, stagedEnd);
|
|
15738
|
+
if (!carried) {
|
|
15739
|
+
if (stopped.discardIfShort) {
|
|
15740
|
+
clearRecompStaging(db, sessionId);
|
|
15741
|
+
db.exec("COMMIT");
|
|
15742
|
+
finished = true;
|
|
15743
|
+
return "discarded";
|
|
15744
|
+
}
|
|
15745
|
+
db.exec("ROLLBACK");
|
|
15746
|
+
finished = true;
|
|
15747
|
+
return "would-shrink";
|
|
15748
|
+
}
|
|
15749
|
+
}
|
|
15661
15750
|
}
|
|
15751
|
+
const compartments = carried ? [...staging.compartments, ...carried.compartments] : staging.compartments;
|
|
15662
15752
|
deleteChunkEmbedBackoffForSession2(db, sessionId);
|
|
15663
15753
|
db.prepare("DELETE FROM compartments WHERE session_id = ?").run(sessionId);
|
|
15664
15754
|
db.prepare("DELETE FROM session_facts WHERE session_id = ?").run(sessionId);
|
|
15665
|
-
insertRecompCompartmentRows(db, sessionId,
|
|
15755
|
+
insertRecompCompartmentRows(db, sessionId, compartments, now, carried?.rows ?? carriedRows);
|
|
15666
15756
|
queueM0Mutation(db, {
|
|
15667
15757
|
sessionId,
|
|
15668
15758
|
mutationType: "recomp_boundary_change",
|
|
@@ -15676,7 +15766,12 @@ function promoteRecompStagingWithM0Mutation(db, sessionId, holderId) {
|
|
|
15676
15766
|
finished = true;
|
|
15677
15767
|
invalidateAutoEmbedSession(sessionId);
|
|
15678
15768
|
logSlowWriteTransaction("historian-publish:recomp", transactionStartedAt);
|
|
15679
|
-
return {
|
|
15769
|
+
return {
|
|
15770
|
+
compartments,
|
|
15771
|
+
facts: staging.facts,
|
|
15772
|
+
carriedCount: carried?.compartments.length ?? 0,
|
|
15773
|
+
carriedThrough: carried?.end ?? null
|
|
15774
|
+
};
|
|
15680
15775
|
} finally {
|
|
15681
15776
|
if (!finished) {
|
|
15682
15777
|
try {
|
|
@@ -15685,6 +15780,69 @@ function promoteRecompStagingWithM0Mutation(db, sessionId, holderId) {
|
|
|
15685
15780
|
}
|
|
15686
15781
|
}
|
|
15687
15782
|
}
|
|
15783
|
+
function resolvedOrdinal(sessionId, id) {
|
|
15784
|
+
return id ? readRawSessionMessageOrdinalById2(sessionId, id) : null;
|
|
15785
|
+
}
|
|
15786
|
+
function readLiveRanges(db, sessionId) {
|
|
15787
|
+
const rows = db.prepare(`SELECT sequence, start_message, start_message_id, end_message, end_message_id FROM compartments
|
|
15788
|
+
WHERE session_id = ? ORDER BY sequence`).all(sessionId);
|
|
15789
|
+
return rows.map((row) => {
|
|
15790
|
+
const resolvedEnd = resolvedOrdinal(sessionId, row.end_message_id);
|
|
15791
|
+
return { ...row, end: resolvedEnd ?? row.end_message, resolvedEnd };
|
|
15792
|
+
});
|
|
15793
|
+
}
|
|
15794
|
+
function readAlignedLiveTail(db, sessionId, live, staging, stagedEnd) {
|
|
15795
|
+
let next = 1;
|
|
15796
|
+
let seam;
|
|
15797
|
+
for (const row of live) {
|
|
15798
|
+
const start = resolvedOrdinal(sessionId, row.start_message_id);
|
|
15799
|
+
if ((start ?? row.start_message) !== next || row.end < next)
|
|
15800
|
+
return null;
|
|
15801
|
+
if (seam !== undefined && (start === null || row.resolvedEnd === null))
|
|
15802
|
+
return null;
|
|
15803
|
+
if (row.end === stagedEnd)
|
|
15804
|
+
seam = row.sequence;
|
|
15805
|
+
next = row.end + 1;
|
|
15806
|
+
}
|
|
15807
|
+
if (seam === undefined)
|
|
15808
|
+
return null;
|
|
15809
|
+
const seamSequence = seam;
|
|
15810
|
+
const tail = getCompartments(db, sessionId).filter((row) => row.sequence > seamSequence);
|
|
15811
|
+
if (!tail.length || tail.length !== live.filter((row) => row.sequence > seamSequence).length)
|
|
15812
|
+
return null;
|
|
15813
|
+
return {
|
|
15814
|
+
compartments: tail.map((row, index) => compartmentToInput(row, staging.compartments.length + index)),
|
|
15815
|
+
rows: new Map(tail.map((row, index) => [staging.compartments.length + index, row])),
|
|
15816
|
+
end: next - 1
|
|
15817
|
+
};
|
|
15818
|
+
}
|
|
15819
|
+
function getResumableFullStaging(db, sessionId, rawMessageCount) {
|
|
15820
|
+
const staging = getRecompStaging(db, sessionId);
|
|
15821
|
+
let reason = null;
|
|
15822
|
+
if (getRecompPartialRange(db, sessionId)) {
|
|
15823
|
+
reason = "the staged passes were for a range rebuild";
|
|
15824
|
+
} else if (staging) {
|
|
15825
|
+
reason = validateStoredCompartments(staging.compartments);
|
|
15826
|
+
if (!reason) {
|
|
15827
|
+
const ordinals = readRawSessionMessageIdOrdinalsForRange2(sessionId, 1, Math.min(rawMessageCount, staging.lastEndMessage));
|
|
15828
|
+
if (staging.compartments.some(({ startMessage, endMessage, startMessageId, endMessageId }) => ordinals.get(startMessageId) !== startMessage || ordinals.get(endMessageId) !== endMessage)) {
|
|
15829
|
+
reason = "staged endpoints no longer match the raw history";
|
|
15830
|
+
}
|
|
15831
|
+
}
|
|
15832
|
+
}
|
|
15833
|
+
if (!reason)
|
|
15834
|
+
return staging;
|
|
15835
|
+
clearRecompStaging(db, sessionId);
|
|
15836
|
+
sessionLog2(sessionId, `recomp discarded staging: ${reason}`);
|
|
15837
|
+
return null;
|
|
15838
|
+
}
|
|
15839
|
+
var PUBLISH_LEASE_LOST = `## Magic Recomp — Skipped
|
|
15840
|
+
|
|
15841
|
+
Another process acquired the compartment-state lease before recomp could publish. No state was written.`;
|
|
15842
|
+
var STAGING_REMOVED = `## Magic Recomp — Failed
|
|
15843
|
+
|
|
15844
|
+
The unfinished rebuild was removed because the session's history changed. Nothing was published.
|
|
15845
|
+
Run /ctx-recomp again.`;
|
|
15688
15846
|
async function executeContextRecompInternal(deps) {
|
|
15689
15847
|
const {
|
|
15690
15848
|
client,
|
|
@@ -15727,6 +15885,12 @@ Session ordinals are warming in the background. Retry shortly; no history was re
|
|
|
15727
15885
|
updateSessionMeta(db, sessionId, { compartmentInProgress: true });
|
|
15728
15886
|
try {
|
|
15729
15887
|
const rawMessageCount = getRawSessionMessageCount2(sessionId);
|
|
15888
|
+
const existingStaging = getResumableFullStaging(db, sessionId, rawMessageCount);
|
|
15889
|
+
if (rawMessageCount <= 0) {
|
|
15890
|
+
return `## Magic Recomp
|
|
15891
|
+
|
|
15892
|
+
No raw history exists, so nothing was rebuilt.`;
|
|
15893
|
+
}
|
|
15730
15894
|
const boundarySnapshot = resolveOpenCodeProtectedTailBoundary({
|
|
15731
15895
|
db,
|
|
15732
15896
|
sessionId,
|
|
@@ -15737,21 +15901,21 @@ Session ordinals are warming in the background. Retry shortly; no history was re
|
|
|
15737
15901
|
usageSource: "provisional-zero"
|
|
15738
15902
|
});
|
|
15739
15903
|
const protectedTailStart = Math.min(boundarySnapshot.protectedTailStart, rawMessageCount + 1);
|
|
15740
|
-
if (
|
|
15741
|
-
return `## Magic Recomp
|
|
15904
|
+
if (!existingStaging && protectedTailStart === 1) {
|
|
15905
|
+
return `## Magic Recomp — Skipped
|
|
15742
15906
|
|
|
15743
|
-
|
|
15907
|
+
Nothing to rebuild yet: every message is still in the recent part that is kept raw.`;
|
|
15744
15908
|
}
|
|
15745
15909
|
const parentSessionResponse = await client?.session.get({ path: { id: sessionId } }).catch(() => null);
|
|
15746
15910
|
const parentSession = normalizeSDKResponse(parentSessionResponse, null, { preferResponseOnMissingData: true });
|
|
15747
15911
|
const sessionDirectory = parentSession?.directory ?? directory;
|
|
15748
|
-
const existingStaging = getRecompStaging(db, sessionId);
|
|
15749
15912
|
let candidateCompartments = existingStaging?.compartments ?? [];
|
|
15750
15913
|
let candidateFacts = existingStaging?.facts ?? [];
|
|
15751
15914
|
let offset = existingStaging ? existingStaging.lastEndMessage + 1 : 1;
|
|
15752
15915
|
let passCount = existingStaging?.passCount ?? 0;
|
|
15753
15916
|
let currentTokenBudget = historianChunkTokens;
|
|
15754
15917
|
let passAttempt = 1;
|
|
15918
|
+
let hadModelFailureOrBudgetReduction = false;
|
|
15755
15919
|
const resumed = existingStaging !== null;
|
|
15756
15920
|
if (resumed) {
|
|
15757
15921
|
await sendStatusNotification2(client, sessionId, `## Magic Recomp — Resumed
|
|
@@ -15776,19 +15940,53 @@ Found ${existingStaging.compartments.length} staged compartment(s) from ${existi
|
|
|
15776
15940
|
} catch {}
|
|
15777
15941
|
};
|
|
15778
15942
|
emitProgress("Preparing…");
|
|
15779
|
-
async function promoteAndFinalize(reason) {
|
|
15943
|
+
async function promoteAndFinalize(reason, heading = "Partial", failure = "recomp_unavailable", sentence, deterministicStop = false) {
|
|
15780
15944
|
if (passCount === 0 || candidateCompartments.length === 0)
|
|
15781
15945
|
return null;
|
|
15782
15946
|
const mergedError = validateStoredCompartments(candidateCompartments);
|
|
15783
15947
|
if (mergedError)
|
|
15784
15948
|
return null;
|
|
15785
|
-
saveRecompStagingPass(db, sessionId, passCount, candidateCompartments, candidateFacts);
|
|
15786
15949
|
const lastCompartmentEnd = candidateCompartments[candidateCompartments.length - 1]?.endMessage ?? 0;
|
|
15787
15950
|
const compartmentTagKeys = lastCompartmentEnd > 0 ? await getRawSessionTagKeysThrough2(sessionId, lastCompartmentEnd, { db }) : null;
|
|
15788
|
-
const promoted =
|
|
15789
|
-
|
|
15790
|
-
|
|
15791
|
-
|
|
15951
|
+
const promoted = promoteRecompStaging(db, sessionId, leaseHolderId, {
|
|
15952
|
+
allowCarry: heading === "Complete",
|
|
15953
|
+
discardIfShort: deterministicStop && passAttempt === 1 && !hadModelFailureOrBudgetReduction && resumed && passCount === existingStaging.passCount
|
|
15954
|
+
});
|
|
15955
|
+
if (promoted === "would-shrink" || promoted === "discarded") {
|
|
15956
|
+
const detail = renderUserFacingFailure(failure, "markdown", {
|
|
15957
|
+
sentence,
|
|
15958
|
+
...failure !== "historian_window_too_small" ? { action: "" } : {}
|
|
15959
|
+
});
|
|
15960
|
+
if (promoted === "discarded") {
|
|
15961
|
+
return [
|
|
15962
|
+
"## Magic Recomp — Failed",
|
|
15963
|
+
"",
|
|
15964
|
+
`The rebuild could not get past message ${offset}. ${detail}`,
|
|
15965
|
+
"The unfinished rebuild was discarded.",
|
|
15966
|
+
"Your current history is unchanged."
|
|
15967
|
+
].join(`
|
|
15968
|
+
`);
|
|
15969
|
+
}
|
|
15970
|
+
const continueFrom = `Run /ctx-recomp again to continue from message ${lastCompartmentEnd + 1}.`;
|
|
15971
|
+
return [
|
|
15972
|
+
RECOMP_PAUSED_HEADING,
|
|
15973
|
+
"",
|
|
15974
|
+
resumed ? `Messages 1-${lastCompartmentEnd} of ${totalMessages} are rebuilt and kept for the next run. ${detail}` : `Rebuilt messages 1-${lastCompartmentEnd} of ${totalMessages}, then stopped. ${detail}`,
|
|
15975
|
+
"Your current history is unchanged.",
|
|
15976
|
+
deterministicStop ? `${continueFrom} If it stops at the same place again, the unfinished rebuild is discarded and your history stays as it is.` : continueFrom
|
|
15977
|
+
].join(`
|
|
15978
|
+
`);
|
|
15979
|
+
}
|
|
15980
|
+
if (promoted === "lease-lost")
|
|
15981
|
+
return PUBLISH_LEASE_LOST;
|
|
15982
|
+
if (promoted === "staging-removed")
|
|
15983
|
+
return STAGING_REMOVED;
|
|
15984
|
+
afterPublish("compression-depth", () => {
|
|
15985
|
+
if (promoted.carriedCount > 0)
|
|
15986
|
+
clearCompressionDepthRange(db, sessionId, 1, lastCompartmentEnd);
|
|
15987
|
+
else
|
|
15988
|
+
clearCompressionDepth(db, sessionId);
|
|
15989
|
+
});
|
|
15792
15990
|
if (deps.preserveInjectionCacheUntilConsumed !== true) {
|
|
15793
15991
|
clearInjectionCache(sessionId);
|
|
15794
15992
|
}
|
|
@@ -15808,9 +16006,10 @@ Found ${existingStaging.compartments.length} staged compartment(s) from ${existi
|
|
|
15808
16006
|
afterPublish("drop-queue", () => queueDropsForCompartmentalizedMessages(db, sessionId, lastCompartmentEnd, compartmentTagKeys));
|
|
15809
16007
|
}
|
|
15810
16008
|
afterPublish("publication-signal", () => deps.onCompartmentStatePublished?.(sessionId));
|
|
15811
|
-
|
|
16009
|
+
const publishedEnd = promoted.carriedThrough ?? lastCompartmentEnd;
|
|
16010
|
+
if (publishedEnd > 0) {
|
|
15812
16011
|
afterPublish("compaction-marker", () => {
|
|
15813
|
-
const markerUpdated = (deps.compactionMarkerStrategy?.publish ?? updateCompactionMarkerAfterPublication)(db, sessionId,
|
|
16012
|
+
const markerUpdated = (deps.compactionMarkerStrategy?.publish ?? updateCompactionMarkerAfterPublication)(db, sessionId, publishedEnd, deps.directory);
|
|
15814
16013
|
if (markerUpdated) {
|
|
15815
16014
|
const stalePending = getPendingCompactionMarkerState(db, sessionId);
|
|
15816
16015
|
if (stalePending) {
|
|
@@ -15819,8 +16018,26 @@ Found ${existingStaging.compartments.length} staged compartment(s) from ${existi
|
|
|
15819
16018
|
}
|
|
15820
16019
|
});
|
|
15821
16020
|
}
|
|
16021
|
+
const rebuilt = promoted.compartments.length - promoted.carriedCount;
|
|
16022
|
+
const rebuiltThrough = `Rebuilt ${rebuilt} history block${rebuilt === 1 ? "" : "s"} through message ${lastCompartmentEnd}.`;
|
|
16023
|
+
if (promoted.carriedCount > 0) {
|
|
16024
|
+
return [
|
|
16025
|
+
"## Magic Recomp — Complete",
|
|
16026
|
+
"",
|
|
16027
|
+
rebuiltThrough,
|
|
16028
|
+
`Kept ${promoted.carriedCount} existing history block${promoted.carriedCount === 1 ? "" : "s"} through message ${publishedEnd}.`
|
|
16029
|
+
].join(`
|
|
16030
|
+
`);
|
|
16031
|
+
}
|
|
16032
|
+
if (heading === "Complete") {
|
|
16033
|
+
return `## Magic Recomp — Complete
|
|
16034
|
+
|
|
16035
|
+
${rebuiltThrough} Messages ${offset} to ${protectedTailStart - 1} have nothing to summarize and stay as they are.`;
|
|
16036
|
+
}
|
|
15822
16037
|
sessionLog2(sessionId, `recomp partial code=${userFacingFailureCode("recomp_unavailable")} reason="${reason}"`);
|
|
15823
16038
|
return [
|
|
16039
|
+
`## Magic Recomp — ${heading}`,
|
|
16040
|
+
"",
|
|
15824
16041
|
`Rebuilt ${promoted.compartments.length} history block${promoted.compartments.length === 1 ? "" : "s"} across ${passCount} successful pass${passCount === 1 ? "" : "es"}.`,
|
|
15825
16042
|
renderUserFacingFailure("recomp_unavailable")
|
|
15826
16043
|
].join(`
|
|
@@ -15850,12 +16067,9 @@ Found ${existingStaging.compartments.length} staged compartment(s) from ${existi
|
|
|
15850
16067
|
compartmentsProduced: 0
|
|
15851
16068
|
});
|
|
15852
16069
|
sessionLog2(sessionId, `recomp failed code=${userFacingFailureCode("historian_window_too_small")} reason="${promptFit.reason}"`);
|
|
15853
|
-
const partial = await promoteAndFinalize(`the history model's window cannot hold a historian prompt: ${promptFit.reason}
|
|
15854
|
-
if (partial)
|
|
15855
|
-
return
|
|
15856
|
-
|
|
15857
|
-
${partial}`;
|
|
15858
|
-
}
|
|
16070
|
+
const partial = await promoteAndFinalize(`the history model's window cannot hold a historian prompt: ${promptFit.reason}`, "Partial", "historian_window_too_small");
|
|
16071
|
+
if (partial)
|
|
16072
|
+
return partial;
|
|
15859
16073
|
return `## Magic Recomp — Failed
|
|
15860
16074
|
|
|
15861
16075
|
${renderUserFacingFailure("historian_window_too_small")}`;
|
|
@@ -15863,26 +16077,22 @@ ${renderUserFacingFailure("historian_window_too_small")}`;
|
|
|
15863
16077
|
if (promptFit.trimmed || promptFit.chunkTokens < currentTokenBudget) {
|
|
15864
16078
|
sessionLog2(sessionId, `recomp prompt fit: ${describeHistorianPromptTrim(promptFit)} requestedChunkTokens=${currentTokenBudget}`);
|
|
15865
16079
|
}
|
|
16080
|
+
if (promptFit.chunkTokens < currentTokenBudget)
|
|
16081
|
+
hadModelFailureOrBudgetReduction = true;
|
|
15866
16082
|
const chunk = readSessionChunk2(sessionId, promptFit.chunkTokens, offset, protectedTailStart, { expandTools: deps.historianExpandTools });
|
|
15867
16083
|
if (!chunk.text || chunk.messageCount === 0 || chunk.endIndex < offset) {
|
|
15868
|
-
const promoted = await promoteAndFinalize(`remaining messages ${offset}-${protectedTailStart - 1} were too few or all noise to form a historian chunk`);
|
|
15869
|
-
if (promoted)
|
|
15870
|
-
return
|
|
15871
|
-
|
|
15872
|
-
${promoted}`;
|
|
15873
|
-
}
|
|
16084
|
+
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);
|
|
16085
|
+
if (promoted)
|
|
16086
|
+
return promoted;
|
|
15874
16087
|
return `## Magic Recomp — Failed
|
|
15875
16088
|
|
|
15876
16089
|
Recomp stopped because raw history ${offset}-${protectedTailStart - 1} could not be turned into a valid historian chunk. Nothing was written.`;
|
|
15877
16090
|
}
|
|
15878
16091
|
const chunkCoverageError = validateChunkCoverage(chunk);
|
|
15879
16092
|
if (chunkCoverageError) {
|
|
15880
|
-
const partial = await promoteAndFinalize(`chunk could not be represented safely: ${chunkCoverageError}
|
|
15881
|
-
if (partial)
|
|
15882
|
-
return
|
|
15883
|
-
|
|
15884
|
-
${partial}`;
|
|
15885
|
-
}
|
|
16093
|
+
const partial = await promoteAndFinalize(`chunk could not be represented safely: ${chunkCoverageError}`, "Partial", "recomp_unavailable", "The next chunk could not be represented safely.", true);
|
|
16094
|
+
if (partial)
|
|
16095
|
+
return partial;
|
|
15886
16096
|
sessionLog2(sessionId, `recomp failed code=${userFacingFailureCode("recomp_unavailable")} reason="${chunkCoverageError}"`);
|
|
15887
16097
|
return `## Magic Recomp — Failed
|
|
15888
16098
|
|
|
@@ -15924,6 +16134,7 @@ Historian pass ${passCount + 1}, attempt ${passAttempt} started for messages ${c
|
|
|
15924
16134
|
language: deps.language,
|
|
15925
16135
|
callbacks: {
|
|
15926
16136
|
onRepairRetry: async (error) => {
|
|
16137
|
+
hadModelFailureOrBudgetReduction = true;
|
|
15927
16138
|
emitProgress(`Repair retry (pass ${passCount + 1})…`);
|
|
15928
16139
|
sessionLog2(sessionId, `recomp retry code=${userFacingFailureCode("recomp_unavailable")} reason="${error}"`);
|
|
15929
16140
|
await sendStatusNotification2(client, sessionId, `## Magic Recomp
|
|
@@ -15931,12 +16142,14 @@ Historian pass ${passCount + 1}, attempt ${passAttempt} started for messages ${c
|
|
|
15931
16142
|
History compression is retrying this pass. ${renderUserFacingFailure("recomp_unavailable")}`, notifParams());
|
|
15932
16143
|
},
|
|
15933
16144
|
onModelFallback: (modelId, index, total) => {
|
|
16145
|
+
hadModelFailureOrBudgetReduction = true;
|
|
15934
16146
|
const short = modelId.includes("/") ? modelId.split("/").pop() : modelId;
|
|
15935
16147
|
emitProgress(`Trying fallback ${short} (${index}/${total})…`);
|
|
15936
16148
|
}
|
|
15937
16149
|
}
|
|
15938
16150
|
});
|
|
15939
16151
|
if (!validatedPass.ok) {
|
|
16152
|
+
hadModelFailureOrBudgetReduction = true;
|
|
15940
16153
|
const reducedBudget = getReducedRecompTokenBudget(promptFit.chunkTokens);
|
|
15941
16154
|
if (reducedBudget !== null) {
|
|
15942
16155
|
const smallerChunk = readSessionChunk2(sessionId, reducedBudget, offset, protectedTailStart, { expandTools: deps.historianExpandTools });
|
|
@@ -15962,11 +16175,8 @@ History compression is retrying with a smaller set of messages. ${renderUserFaci
|
|
|
15962
16175
|
});
|
|
15963
16176
|
sessionLog2(sessionId, `recomp failed code=${userFacingFailureCode("recomp_unavailable")} reason="${validatedPass.error}" messageRange=${chunk.startIndex}-${chunk.endIndex}`);
|
|
15964
16177
|
const partial = await promoteAndFinalize(`history model response did not validate for messages ${chunk.startIndex}-${chunk.endIndex}`);
|
|
15965
|
-
if (partial)
|
|
15966
|
-
return
|
|
15967
|
-
|
|
15968
|
-
${partial}`;
|
|
15969
|
-
}
|
|
16178
|
+
if (partial)
|
|
16179
|
+
return partial;
|
|
15970
16180
|
return `## Magic Recomp — Failed
|
|
15971
16181
|
|
|
15972
16182
|
${renderUserFacingFailure("recomp_unavailable")}`;
|
|
@@ -15993,6 +16203,17 @@ ${renderUserFacingFailure("recomp_unavailable")}`;
|
|
|
15993
16203
|
importanceAvg: imp.avg
|
|
15994
16204
|
});
|
|
15995
16205
|
}
|
|
16206
|
+
const nextOffset = (validatedPass.compartments?.[validatedPass.compartments.length - 1]?.endMessage ?? chunk.endIndex) + 1;
|
|
16207
|
+
if (nextOffset <= offset) {
|
|
16208
|
+
const reason = `Recomp made no forward progress after messages ${chunk.startIndex}-${chunk.endIndex}.`;
|
|
16209
|
+
const partial = await promoteAndFinalize(reason, "Partial", "recomp_unavailable", reason, true);
|
|
16210
|
+
if (partial)
|
|
16211
|
+
return partial;
|
|
16212
|
+
return `## Magic Recomp — Failed
|
|
16213
|
+
|
|
16214
|
+
${reason} Nothing was written.`;
|
|
16215
|
+
}
|
|
16216
|
+
const hadStagedPrefix = candidateCompartments.length > 0;
|
|
15996
16217
|
candidateCompartments = [
|
|
15997
16218
|
...candidateCompartments,
|
|
15998
16219
|
...validatedPass.compartments ?? []
|
|
@@ -16001,19 +16222,14 @@ ${renderUserFacingFailure("recomp_unavailable")}`;
|
|
|
16001
16222
|
passCount += 1;
|
|
16002
16223
|
currentTokenBudget = historianChunkTokens;
|
|
16003
16224
|
passAttempt = 1;
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
}
|
|
16013
|
-
return `## Magic Recomp — Failed
|
|
16014
|
-
|
|
16015
|
-
Recomp made no forward progress after messages ${chunk.startIndex}-${chunk.endIndex}. Nothing was written.`;
|
|
16016
|
-
}
|
|
16225
|
+
const saved = db.transaction(() => {
|
|
16226
|
+
if (hadStagedPrefix && !db.prepare("SELECT 1 FROM recomp_compartments WHERE session_id = ? LIMIT 1").get(sessionId))
|
|
16227
|
+
return false;
|
|
16228
|
+
saveRecompStagingPass(db, sessionId, passCount, candidateCompartments, candidateFacts);
|
|
16229
|
+
return true;
|
|
16230
|
+
}).immediate();
|
|
16231
|
+
if (!saved)
|
|
16232
|
+
return STAGING_REMOVED;
|
|
16017
16233
|
offset = nextOffset;
|
|
16018
16234
|
emitProgress();
|
|
16019
16235
|
}
|
|
@@ -16025,15 +16241,15 @@ Recomp made no forward progress after messages ${chunk.startIndex}-${chunk.endIn
|
|
|
16025
16241
|
|
|
16026
16242
|
${renderUserFacingFailure("recomp_unavailable")}`;
|
|
16027
16243
|
}
|
|
16028
|
-
saveRecompStagingPass(db, sessionId, passCount, candidateCompartments, candidateFacts);
|
|
16029
16244
|
const lastCompartmentEnd = candidateCompartments[candidateCompartments.length - 1]?.endMessage ?? 0;
|
|
16030
16245
|
const compartmentTagKeys = lastCompartmentEnd > 0 ? await getRawSessionTagKeysThrough2(sessionId, lastCompartmentEnd, { db }) : null;
|
|
16031
|
-
const promoted =
|
|
16032
|
-
if (
|
|
16246
|
+
const promoted = promoteRecompStaging(db, sessionId, leaseHolderId);
|
|
16247
|
+
if (promoted === "staging-removed") {
|
|
16248
|
+
return candidateCompartments.length > 0 ? STAGING_REMOVED : PUBLISH_LEASE_LOST;
|
|
16249
|
+
}
|
|
16250
|
+
if (typeof promoted === "string") {
|
|
16033
16251
|
sessionLog2(sessionId, "recomp publish skipped: compartment lease no longer held");
|
|
16034
|
-
return
|
|
16035
|
-
|
|
16036
|
-
Another process acquired the compartment-state lease before recomp could publish. No state was written.`;
|
|
16252
|
+
return PUBLISH_LEASE_LOST;
|
|
16037
16253
|
}
|
|
16038
16254
|
afterPublish("compression-depth", () => clearCompressionDepth(db, sessionId));
|
|
16039
16255
|
if (deps.preserveInjectionCacheUntilConsumed !== true) {
|
|
@@ -16126,25 +16342,6 @@ function snapRangeToCompartments(compartments, range) {
|
|
|
16126
16342
|
tailCompartments: sorted.slice(lastEnclosingIdx + 1)
|
|
16127
16343
|
};
|
|
16128
16344
|
}
|
|
16129
|
-
function compartmentToInput(c, newSequence) {
|
|
16130
|
-
return {
|
|
16131
|
-
sequence: newSequence,
|
|
16132
|
-
startMessage: c.startMessage,
|
|
16133
|
-
endMessage: c.endMessage,
|
|
16134
|
-
startMessageId: c.startMessageId,
|
|
16135
|
-
endMessageId: c.endMessageId,
|
|
16136
|
-
startBlockIndex: c.startBlockIndex,
|
|
16137
|
-
endBlockIndex: c.endBlockIndex,
|
|
16138
|
-
title: c.title,
|
|
16139
|
-
content: c.content,
|
|
16140
|
-
p1: c.p1,
|
|
16141
|
-
p2: c.p2,
|
|
16142
|
-
p3: c.p3,
|
|
16143
|
-
p4: c.p4,
|
|
16144
|
-
importance: c.importance,
|
|
16145
|
-
episodeType: c.episodeType
|
|
16146
|
-
};
|
|
16147
|
-
}
|
|
16148
16345
|
async function executePartialRecompInternal(deps, range) {
|
|
16149
16346
|
const {
|
|
16150
16347
|
client,
|
|
@@ -16164,6 +16361,7 @@ Could not acquire the compartment-state lease for this session.`;
|
|
|
16164
16361
|
}
|
|
16165
16362
|
const leaseHolderId = holderId;
|
|
16166
16363
|
updateSessionMeta(db, sessionId, { compartmentInProgress: true });
|
|
16364
|
+
let wroteStaging = false;
|
|
16167
16365
|
try {
|
|
16168
16366
|
let promoteFinal = function() {
|
|
16169
16367
|
const newBuilt = candidateCompartments.slice(priorCompartments.length);
|
|
@@ -16199,7 +16397,12 @@ Could not acquire the compartment-state lease for this session.`;
|
|
|
16199
16397
|
return null;
|
|
16200
16398
|
}
|
|
16201
16399
|
saveRecompStagingPass(db, sessionId, passCount + 1, merged, stagedFacts);
|
|
16202
|
-
|
|
16400
|
+
wroteStaging = true;
|
|
16401
|
+
const carriedRows = new Map([
|
|
16402
|
+
...priorCompartments.map((c, idx) => [idx, c]),
|
|
16403
|
+
...tailCompartments.map((c, idx) => [candidateCompartments.length + idx, c])
|
|
16404
|
+
]);
|
|
16405
|
+
const promoted = promoteRecompStagingWithM0Mutation(db, sessionId, leaseHolderId, carriedRows);
|
|
16203
16406
|
if (!promoted) {
|
|
16204
16407
|
log2("[magic-context] partial recomp promote returned null");
|
|
16205
16408
|
return null;
|
|
@@ -16248,8 +16451,7 @@ ${snapResult.error}`;
|
|
|
16248
16451
|
"",
|
|
16249
16452
|
`An unfinished partial recomp is already staged for range ${storedRange.start}-${storedRange.end}, which does not match the requested range ${snapStart}-${snapEnd}.`,
|
|
16250
16453
|
"",
|
|
16251
|
-
"
|
|
16252
|
-
"or cancel it by running `/ctx-flush` before starting a new partial recomp."
|
|
16454
|
+
"Finish that range by running `/ctx-recomp` with the same original arguments, or run `/ctx-recomp` without arguments to start a full rebuild."
|
|
16253
16455
|
].join(`
|
|
16254
16456
|
`);
|
|
16255
16457
|
}
|
|
@@ -16257,9 +16459,7 @@ ${snapResult.error}`;
|
|
|
16257
16459
|
return [
|
|
16258
16460
|
"## Magic Recomp — Failed",
|
|
16259
16461
|
"",
|
|
16260
|
-
|
|
16261
|
-
"Resume it by running `/ctx-recomp` without arguments,",
|
|
16262
|
-
"or cancel it before starting a partial recomp."
|
|
16462
|
+
`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.`
|
|
16263
16463
|
].join(`
|
|
16264
16464
|
`);
|
|
16265
16465
|
}
|
|
@@ -16281,6 +16481,7 @@ ${snapResult.error}`;
|
|
|
16281
16481
|
passCount = 0;
|
|
16282
16482
|
offset = snapStart;
|
|
16283
16483
|
saveRecompStagingPass(db, sessionId, 0, candidateCompartments, stagedFacts);
|
|
16484
|
+
wroteStaging = true;
|
|
16284
16485
|
setRecompPartialRange(db, sessionId, { start: snapStart, end: snapEnd });
|
|
16285
16486
|
}
|
|
16286
16487
|
let currentTokenBudget = historianChunkTokens;
|
|
@@ -16390,6 +16591,7 @@ ${renderUserFacingFailure("recomp_unavailable")}`;
|
|
|
16390
16591
|
currentTokenBudget = historianChunkTokens;
|
|
16391
16592
|
passAttempt = 1;
|
|
16392
16593
|
saveRecompStagingPass(db, sessionId, passCount, candidateCompartments, stagedFacts);
|
|
16594
|
+
wroteStaging = true;
|
|
16393
16595
|
const nextOffset = (validatedPass.compartments?.[validatedPass.compartments.length - 1]?.endMessage ?? chunk.endIndex) + 1;
|
|
16394
16596
|
if (nextOffset <= offset) {
|
|
16395
16597
|
return `## Magic Recomp — Failed
|
|
@@ -16421,9 +16623,7 @@ Partial recomp completed historian passes but the final compartment set failed v
|
|
|
16421
16623
|
${renderUserFacingFailure("recomp_unavailable")}`;
|
|
16422
16624
|
} finally {
|
|
16423
16625
|
updateSessionMeta(db, sessionId, { compartmentInProgress: false });
|
|
16424
|
-
|
|
16425
|
-
const leftoverRange = getRecompPartialRange(db, sessionId);
|
|
16426
|
-
if (leftoverStaging && leftoverRange) {} else if (leftoverStaging && !leftoverRange) {
|
|
16626
|
+
if (wroteStaging && getRecompStaging(db, sessionId) && !getRecompPartialRange(db, sessionId)) {
|
|
16427
16627
|
log2(`[magic-context] partial recomp cleanup: clearing orphaned staging without range marker for session ${sessionId}`);
|
|
16428
16628
|
clearRecompStaging(db, sessionId);
|
|
16429
16629
|
}
|
|
@@ -16629,7 +16829,7 @@ function resolveLiveModelKey(liveSessionState, sessionId) {
|
|
|
16629
16829
|
return model ? `${model.providerID}/${model.modelID}` : undefined;
|
|
16630
16830
|
}
|
|
16631
16831
|
function isRecompFailure2(message) {
|
|
16632
|
-
return /—\s*(Failed|Skipped)/.test(message);
|
|
16832
|
+
return /—\s*(Failed|Skipped|Paused)/.test(message);
|
|
16633
16833
|
}
|
|
16634
16834
|
function isRecompSkip2(message) {
|
|
16635
16835
|
return /—\s*Skipped|already mutating compartment state|already running/i.test(message);
|
|
@@ -16736,7 +16936,7 @@ async function runManagedRecomp2(ctx, sessionId, options) {
|
|
|
16736
16936
|
clearEmergencyRecovery(ctx.db, sessionId);
|
|
16737
16937
|
} catch {}
|
|
16738
16938
|
}
|
|
16739
|
-
setRecompTerminal2(ctx.liveSessionState, sessionId, terminalPhase, extractRecompReason2(message));
|
|
16939
|
+
setRecompTerminal2(ctx.liveSessionState, sessionId, terminalPhase, pausedRecompReason(message) === null ? extractRecompReason2(message) : message);
|
|
16740
16940
|
return message;
|
|
16741
16941
|
} catch (error) {
|
|
16742
16942
|
const failure = renderUserFacingFailure("recomp_unavailable");
|
|
@@ -16748,4 +16948,4 @@ ${failure}`;
|
|
|
16748
16948
|
}
|
|
16749
16949
|
}
|
|
16750
16950
|
|
|
16751
|
-
export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, v2ToolDefinitionsHash, v2RequestToolsFingerprint, classifyRequestToolsChange, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, 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, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, teardownChildSession, runTokenLog, formatRunTokenLog, createChildSessionWithFence, validateStoredCompartments, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, 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, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readHistorianFailureStreak, describeHistorianJoinRefusal, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, nonNarrativeStoredGapRanges, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };
|
|
16951
|
+
export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, v2ToolDefinitionsHash, v2RequestToolsFingerprint, classifyRequestToolsChange, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, 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, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, teardownChildSession, runTokenLog, formatRunTokenLog, createChildSessionWithFence, validateStoredCompartments, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, 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, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readHistorianFailureStreak, describeHistorianJoinRefusal, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, nonNarrativeStoredGapRanges, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };
|