@cortexkit/opencode-magic-context 0.49.56 → 0.49.59
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-9pr71hd5.js → announcement-p41dde4h.js} +2 -2
- package/dist/auto-search-worker.js +5 -5
- package/dist/chunk-embedding-write-worker.js +13 -13
- package/dist/{compaction-marker-candidates-8hazqfvj.js → compaction-marker-candidates-1ndjqh9k.js} +2 -2
- package/dist/compaction-marker-candidates-worker.js +1 -1
- package/dist/{compartment-chunk-embedding-gfd093f8.js → compartment-chunk-embedding-ymc9mtwv.js} +7 -7
- package/dist/{conflict-warning-hook-56qpq7ws.js → conflict-warning-hook-m8yezwdj.js} +7 -7
- package/dist/{context-bejy30t5.js → context-aexc6pbs.js} +69 -44
- package/dist/{derive-budgets-z53424qx.js → derive-budgets-heypxqdz.js} +2 -2
- package/dist/{embedding-backfill-2dvf3rcn.js → embedding-backfill-sk7agn5v.js} +12 -12
- package/dist/embedding-worker-process.js +1 -1
- package/dist/embedding-worker.js +4 -4
- package/dist/features/magic-context/mural/render-mural.d.ts +17 -0
- package/dist/features/magic-context/mural/render-mural.d.ts.map +1 -1
- package/dist/features/magic-context/mural/render-trigger.d.ts +2 -1
- package/dist/features/magic-context/mural/render-trigger.d.ts.map +1 -1
- package/dist/features/magic-context/mural/resolve-mural.d.ts +8 -2
- package/dist/features/magic-context/mural/resolve-mural.d.ts.map +1 -1
- package/dist/features/magic-context/storage-historian-runs.d.ts +7 -0
- package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -1
- package/dist/{history-owner-n50e0e8y.js → history-owner-xqfsvf9k.js} +2 -2
- package/dist/hooks/magic-context/command-handler.d.ts +2 -0
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +9 -0
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts +7 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-failure-report.d.ts +112 -0
- package/dist/hooks/magic-context/historian-failure-report.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +11 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-5ptp2de1.js → index-0cz8bsyx.js} +9 -9
- package/dist/{index-r9agn061.js → index-1sq1krqw.js} +4 -4
- package/dist/{index-b6rdv8re.js → index-3hk445am.js} +4 -4
- package/dist/{index-by14cr73.js → index-3yyfftqq.js} +11 -11
- package/dist/{index-ffab4edg.js → index-575njz7q.js} +74 -50
- package/dist/{index-gapnh6tk.js → index-5ps3axh5.js} +1 -1
- package/dist/{index-0tz2fzpq.js → index-5vsk2cpp.js} +1 -1
- package/dist/{index-90z05d0p.js → index-832w615x.js} +1 -1
- package/dist/{index-sk6p6esd.js → index-8sc7vqt7.js} +4 -4
- package/dist/{index-cd3vp8xa.js → index-98qy103c.js} +1 -1
- package/dist/{index-3jeq08jv.js → index-a09sw9fx.js} +380 -93
- package/dist/{index-29ff546v.js → index-d0feqcs5.js} +6 -6
- package/dist/{index-gz001bx7.js → index-e6ncz7a6.js} +1 -1
- package/dist/{index-reyws9fy.js → index-esqcwes7.js} +1 -1
- package/dist/{index-h62j8z2r.js → index-ev2rrjfc.js} +4 -4
- package/dist/{index-sx1sppd6.js → index-gq1g9a3a.js} +8 -8
- package/dist/{index-ga5q492k.js → index-gqf8r04r.js} +1 -1
- package/dist/{index-5483ntzh.js → index-gth4t4ar.js} +5 -5
- package/dist/{index-pxfb7pp8.js → index-j4aeh6tx.js} +14 -14
- package/dist/{index-qperbvjn.js → index-jg7sbt3v.js} +2 -2
- package/dist/{index-9mggb1nv.js → index-jrj95cce.js} +2 -2
- package/dist/{index-12p4j9wa.js → index-kv4ntrr6.js} +5 -5
- package/dist/{index-tad3can2.js → index-m0pwswv9.js} +1 -1
- package/dist/{index-pdh4tdcq.js → index-n6aye6ny.js} +2 -2
- package/dist/{index-hsyczpn7.js → index-pxnzyvjc.js} +2 -2
- package/dist/{index-kn1bx21r.js → index-pzvdf7sr.js} +3 -3
- package/dist/{index-36wseasx.js → index-q7q6qp1f.js} +1 -1
- package/dist/{index-qfc1kjh4.js → index-s2jdky2x.js} +3 -3
- package/dist/{index-2ny9xwdn.js → index-s32f8y67.js} +2 -2
- package/dist/{index-3wmp1nb7.js → index-s3t4vk21.js} +7 -7
- package/dist/{index-hexdee98.js → index-snbpdpa3.js} +4 -4
- package/dist/{index-dhdv88e5.js → index-tebcx987.js} +1 -1
- package/dist/{index-5gqszjq9.js → index-tq20edcs.js} +3 -3
- package/dist/{index-0k283v27.js → index-tzy5h4x6.js} +1 -1
- package/dist/{index-em92bp7f.js → index-x40zr813.js} +2 -2
- package/dist/{index-sv5tn72j.js → index-xx05vta0.js} +4 -4
- package/dist/{index-82dfe8en.js → index-ywrz4wy2.js} +9 -4
- package/dist/{index-wgbp5zch.js → index-ywxvdwmj.js} +25 -10
- package/dist/{index-xstbytjn.js → index-zb4h9nrk.js} +2 -2
- package/dist/{index-2vsd5064.js → index-zxj39ba2.js} +4 -4
- package/dist/index.js +51 -50
- package/dist/{logger-sw7z6sjz.js → logger-d7c8akh9.js} +1 -1
- package/dist/{message-fts-rowid-map-kx1bsdyg.js → message-fts-rowid-map-0xx8ge09.js} +4 -4
- package/dist/{message-index-bounded-xav3h8qe.js → message-index-bounded-f6yz4xq8.js} +10 -10
- package/dist/{message-time-backfill-hp2jgn49.js → message-time-backfill-pz5981mf.js} +2 -2
- package/dist/migration-worker.js +10 -10
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/{project-embedding-registry-f2azrq24.js → project-embedding-registry-c2sfnamh.js} +11 -11
- package/dist/raw-ordinal-warmup-worker.js +8 -8
- package/dist/{read-session-chunk-70aam2c1.js → read-session-chunk-8b1g06nz.js} +8 -8
- package/dist/{read-session-raw-04ger9zt.js → read-session-raw-3sc9231y.js} +2 -2
- package/dist/{recomp-orchestrator-2tsjqbrm.js → recomp-orchestrator-zqn9zwxn.js} +29 -29
- package/dist/{render-fgxbcmnh.js → render-nrfbtkkw.js} +19 -19
- package/dist/{safe-notification-target-mx5khyxf.js → safe-notification-target-d21swr3n.js} +2 -2
- package/dist/{search-archive-0mz3p1g1.js → search-archive-1ppdjfm9.js} +10 -10
- package/dist/{search-jfwb4ms3.js → search-xha0r30f.js} +22 -22
- package/dist/{send-session-notification-gamjee2f.js → send-session-notification-ykvt5k2s.js} +5 -5
- package/dist/shared/data-path.d.ts +31 -36
- package/dist/shared/data-path.d.ts.map +1 -1
- package/dist/shared/test-temp-dir.d.ts +28 -0
- package/dist/shared/test-temp-dir.d.ts.map +1 -1
- package/dist/{storage-tags-arnkn5t1.js → storage-tags-spet01yb.js} +5 -5
- package/dist/{transform-postprocess-phase-64xtx439.js → transform-postprocess-phase-gxb3sp91.js} +30 -30
- package/dist/v2/auto-search-worker.js +5 -5
- package/dist/v2/chunk-embedding-write-worker.js +13 -13
- package/dist/v2/{compaction-marker-candidates-re14353a.js → compaction-marker-candidates-bp1bn579.js} +2 -2
- package/dist/v2/compaction-marker-candidates-worker.js +1 -1
- package/dist/v2/{compartment-chunk-embedding-0pxsrzrt.js → compartment-chunk-embedding-x6qw6mjk.js} +7 -7
- package/dist/v2/{context-5hhm89jw.js → context-wszt0gbq.js} +102 -57
- package/dist/v2/{derive-budgets-w0815q82.js → derive-budgets-gw030jzt.js} +3 -3
- package/dist/v2/{embedding-backfill-48qbnh7p.js → embedding-backfill-j2xj86zn.js} +12 -12
- package/dist/v2/embedding-worker-process.js +1 -1
- package/dist/v2/embedding-worker.js +4 -4
- package/dist/v2/{history-owner-ep91wgqj.js → history-owner-260djmv5.js} +2 -2
- package/dist/v2/hooks/claude-agent-instructions.d.ts +27 -0
- package/dist/v2/hooks/claude-agent-instructions.d.ts.map +1 -0
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts +15 -2
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/hooks/usage-persist.d.ts +7 -1
- package/dist/v2/hooks/usage-persist.d.ts.map +1 -1
- package/dist/v2/{logger-xnscpj6w.js → logger-zyf43np1.js} +1 -1
- package/dist/v2/{message-fts-rowid-map-57jh6xpb.js → message-fts-rowid-map-n8mcvcpz.js} +4 -4
- package/dist/v2/{message-index-bounded-sw8hyqw1.js → message-index-bounded-0w8eh8fc.js} +10 -10
- package/dist/v2/{message-time-backfill-baxebka0.js → message-time-backfill-ynb3vg6r.js} +2 -2
- package/dist/v2/migration-worker.js +10 -10
- package/dist/v2/{project-embedding-registry-kwahtjgg.js → project-embedding-registry-k0hjqt11.js} +11 -11
- package/dist/v2/raw-ordinal-warmup-worker.js +8 -8
- package/dist/v2/{read-session-chunk-nqkn0yb4.js → read-session-chunk-dxs1tgt9.js} +8 -8
- package/dist/v2/{read-session-raw-3e482h3c.js → read-session-raw-wg5zc29f.js} +2 -2
- package/dist/v2/{recomp-orchestrator-dzdxrgdt.js → recomp-orchestrator-76rv3b89.js} +30 -30
- package/dist/v2/{render-jfa3hj8z.js → render-9knrdrjs.js} +19 -19
- package/dist/v2/{safe-notification-target-9r79xnbt.js → safe-notification-target-y55z2zat.js} +2 -2
- package/dist/v2/{search-8dc9ex0a.js → search-a2a0qs3t.js} +21 -21
- package/dist/v2/{search-archive-p4s9q7a3.js → search-archive-2jmyvj69.js} +10 -10
- package/dist/v2/{send-session-notification-95p89k7q.js → send-session-notification-8g4r97bp.js} +5 -5
- package/dist/v2/{server-7vrtk78d.js → server-3ap5dmhc.js} +1 -1
- package/dist/v2/{server-avfc9ezb.js → server-4r86tcs2.js} +3 -3
- package/dist/v2/{server-np27dgyt.js → server-5sbsnpkn.js} +1 -1
- package/dist/v2/{server-rz5jnhnv.js → server-6ash6z8z.js} +1 -1
- package/dist/v2/{server-beydmd68.js → server-88n85n60.js} +4 -4
- package/dist/v2/{server-g61hgy1y.js → server-8pdfmc27.js} +4 -4
- package/dist/v2/{server-gge95a03.js → server-8ycacd59.js} +6 -6
- package/dist/v2/{server-8e5m2gre.js → server-9ab9jnpq.js} +3 -3
- package/dist/v2/{server-z6sxv6n3.js → server-9emfsa60.js} +382 -95
- package/dist/v2/{server-kyfj1090.js → server-9m5r04ws.js} +5 -5
- package/dist/v2/{server-3yk44ddz.js → server-afsz3cmx.js} +1 -1
- package/dist/v2/{server-c8z2grq0.js → server-at0v0z4t.js} +1 -1
- package/dist/v2/{server-v817sf79.js → server-d07yxksx.js} +2 -2
- package/dist/v2/{server-kwtnrhv3.js → server-d706s5xn.js} +2 -2
- package/dist/v2/{server-ycvqg2s3.js → server-d9aayyxk.js} +4 -4
- package/dist/v2/{server-966dq3pd.js → server-ds8vpfkr.js} +2 -2
- package/dist/v2/{server-bb6kf05j.js → server-j8376q08.js} +9 -4
- package/dist/v2/{server-7waad75d.js → server-ja6swvmb.js} +11 -11
- package/dist/v2/{server-tmf0ayqp.js → server-jdfe07mp.js} +1 -1
- package/dist/v2/{server-6k0rnwbd.js → server-jn4pktdk.js} +4 -4
- package/dist/v2/{server-qp5sj6n5.js → server-jtq03rkb.js} +2 -2
- package/dist/v2/{server-sa1fdt41.js → server-kc5kb9ya.js} +1 -1
- package/dist/v2/{server-91gb0vh8.js → server-npdey91q.js} +1 -1
- package/dist/v2/{server-vqq3g1t7.js → server-qjff96a6.js} +4 -4
- package/dist/v2/{server-4x0xq8a1.js → server-rbtx6q5v.js} +1 -1
- package/dist/v2/{server-jwydbwcx.js → server-svx20ra2.js} +4 -4
- package/dist/v2/{server-q02z0jq7.js → server-t8tmrtcg.js} +25 -10
- package/dist/v2/{server-0ayyh3mx.js → server-tzh55x6d.js} +9 -9
- package/dist/v2/{server-5p0bjk3y.js → server-v1s0cb4v.js} +2 -2
- package/dist/v2/{server-mxsy9h1d.js → server-x6fn9x8q.js} +2 -2
- package/dist/v2/{server-b0357as4.js → server-xepx8t43.js} +2 -2
- package/dist/v2/{server-3jc6qmdz.js → server-y8xjr8rx.js} +1 -1
- package/dist/v2/{server-5kgesxck.js → server-ypaat9rj.js} +2 -2
- package/dist/v2/{server-rpmkz5ta.js → server-z5255w05.js} +8 -8
- package/dist/v2/server.js +5 -5
- package/dist/v2/{storage-tags-19da4c0m.js → storage-tags-50wsqg3t.js} +5 -5
- package/dist/v2/{v2-archive-reader-jpdh0ktt.js → v2-archive-reader-ycjh6a2d.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-5dfj2mcs.js → wrapup-orchestrator-ejcx02g2.js} +30 -30
- package/dist/{v2-archive-reader-557b5dn3.js → v2-archive-reader-wec0a8fx.js} +1 -1
- package/dist/wrapup-orchestrator-e7mczz6e.js +54 -0
- package/package.json +1 -1
- package/src/shared/data-path.test.ts +27 -10
- package/src/shared/data-path.ts +39 -39
- package/src/shared/test-temp-dir.ts +59 -0
- package/dist/wrapup-orchestrator-21hgybdk.js +0 -54
|
@@ -35,17 +35,16 @@ import {
|
|
|
35
35
|
getRawSessionTagKeysThrough2,
|
|
36
36
|
getLegacyProtectedTailStartOrdinal2,
|
|
37
37
|
readSessionChunk2
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-d0feqcs5.js";
|
|
39
39
|
import {
|
|
40
40
|
getHarness2,
|
|
41
41
|
harnessOwnsOpenCodeStore2
|
|
42
42
|
} from "./index-pavzsdc6.js";
|
|
43
43
|
import {
|
|
44
|
-
|
|
45
|
-
getProjectMagicContextHistorianDir,
|
|
44
|
+
getMagicContextHistorianSessionDir,
|
|
46
45
|
log2,
|
|
47
46
|
sessionLog2
|
|
48
|
-
} from "./index-
|
|
47
|
+
} from "./index-ywrz4wy2.js";
|
|
49
48
|
import {
|
|
50
49
|
sanitizeDiagnosticText
|
|
51
50
|
} from "./index-z4p0ry94.js";
|
|
@@ -71,7 +70,7 @@ import {
|
|
|
71
70
|
deriveTriggerBudget2,
|
|
72
71
|
resolveHistorianProducerLimits2,
|
|
73
72
|
producerSourceLocalBudget2
|
|
74
|
-
} from "./index-
|
|
73
|
+
} from "./index-5ps3axh5.js";
|
|
75
74
|
import {
|
|
76
75
|
withContentLanguageDirective,
|
|
77
76
|
buildPrimaryLanguageDirective,
|
|
@@ -94,7 +93,7 @@ import {
|
|
|
94
93
|
hasMeaningfulUserText2,
|
|
95
94
|
estimateTokens,
|
|
96
95
|
estimateFixedPromptTokens
|
|
97
|
-
} from "./index-
|
|
96
|
+
} from "./index-5vsk2cpp.js";
|
|
98
97
|
import {
|
|
99
98
|
FAIL_CLOSED_DOCTOR_COMMAND
|
|
100
99
|
} from "./index-wh9fxds5.js";
|
|
@@ -108,13 +107,13 @@ import {
|
|
|
108
107
|
import {
|
|
109
108
|
shouldSkipHomeProjectMemory,
|
|
110
109
|
resolveProjectIdentity
|
|
111
|
-
} from "./index-
|
|
110
|
+
} from "./index-tzy5h4x6.js";
|
|
112
111
|
import {
|
|
113
112
|
getSchemaFenceRejection,
|
|
114
113
|
LATEST_SUPPORTED_VERSION,
|
|
115
114
|
getPersistedSchemaVersion,
|
|
116
115
|
openDatabase
|
|
117
|
-
} from "./index-
|
|
116
|
+
} from "./index-0cz8bsyx.js";
|
|
118
117
|
import {
|
|
119
118
|
areRustHistorianSyntheticParts2,
|
|
120
119
|
isStrictGapHealingMessage2,
|
|
@@ -122,7 +121,7 @@ import {
|
|
|
122
121
|
RawOrdinalsNotReady2,
|
|
123
122
|
dropRawSessionOrdinalCheckpoints2,
|
|
124
123
|
runSessionWarmupWorker
|
|
125
|
-
} from "./index-
|
|
124
|
+
} from "./index-q7q6qp1f.js";
|
|
126
125
|
import {
|
|
127
126
|
parseCompartmentOutput,
|
|
128
127
|
resolveWorkspaceShareCategories,
|
|
@@ -131,10 +130,10 @@ import {
|
|
|
131
130
|
resolveStoredPathWorkspaceIdentity,
|
|
132
131
|
sourceNameForMemory,
|
|
133
132
|
computeWorkspaceEpochFingerprint
|
|
134
|
-
} from "./index-
|
|
133
|
+
} from "./index-xx05vta0.js";
|
|
135
134
|
import {
|
|
136
135
|
BoundedSessionMap
|
|
137
|
-
} from "./index-
|
|
136
|
+
} from "./index-jrj95cce.js";
|
|
138
137
|
import {
|
|
139
138
|
V2_MEMORY_CATEGORIES,
|
|
140
139
|
CATEGORY_PRIORITY,
|
|
@@ -158,7 +157,7 @@ import {
|
|
|
158
157
|
replaceCompartmentChunkEmbeddings2,
|
|
159
158
|
deleteChunkEmbedBackoffForSession2,
|
|
160
159
|
chunkWindowSourceKey2
|
|
161
|
-
} from "./index-
|
|
160
|
+
} from "./index-snbpdpa3.js";
|
|
162
161
|
import {
|
|
163
162
|
COMPARTMENT_LEASE_RENEWAL_MS,
|
|
164
163
|
getCompartmentLeaseBlocker,
|
|
@@ -188,6 +187,7 @@ import {
|
|
|
188
187
|
readProjectDocsCanonical,
|
|
189
188
|
updateSessionMeta,
|
|
190
189
|
externalHistorianFailureReason,
|
|
190
|
+
getRecentFailedHistorianRunTimes,
|
|
191
191
|
recordHistorianRun,
|
|
192
192
|
summarizeImportance,
|
|
193
193
|
tallyFactsByCategory,
|
|
@@ -200,14 +200,14 @@ import {
|
|
|
200
200
|
getProjectState,
|
|
201
201
|
recordSubagentInvocation,
|
|
202
202
|
getLatestHistorianInvocationId
|
|
203
|
-
} from "./index-
|
|
203
|
+
} from "./index-ywxvdwmj.js";
|
|
204
204
|
import {
|
|
205
205
|
clearCompressionDepth,
|
|
206
206
|
clearCompressionDepthRange,
|
|
207
207
|
toMessageIndexSource,
|
|
208
208
|
clearIndexedMessagesInTransaction,
|
|
209
209
|
indexSourcesAfterOrdinal
|
|
210
|
-
} from "./index-
|
|
210
|
+
} from "./index-ev2rrjfc.js";
|
|
211
211
|
import {
|
|
212
212
|
stripWellFormedLeadingTagPrefix,
|
|
213
213
|
peelLeadingMcTagNotation,
|
|
@@ -218,6 +218,7 @@ import {
|
|
|
218
218
|
persistCachedM0,
|
|
219
219
|
clearCachedM0M1,
|
|
220
220
|
describeProtectedTailDrainBudgetSkip,
|
|
221
|
+
loadPersistedUsage,
|
|
221
222
|
loadProtectedTailMeta,
|
|
222
223
|
markProtectedTailPolicyV3Seeded,
|
|
223
224
|
recordProtectedTailPublicationFloor,
|
|
@@ -255,17 +256,17 @@ import {
|
|
|
255
256
|
foldShrunkPartTags2,
|
|
256
257
|
getTagNumberByMessageId2,
|
|
257
258
|
getActiveTagsBySession2
|
|
258
|
-
} from "./index-
|
|
259
|
+
} from "./index-8sc7vqt7.js";
|
|
259
260
|
import {
|
|
260
261
|
openCodeDbExists,
|
|
261
262
|
withReadOnlySessionDb,
|
|
262
263
|
getMessageTimesFromOpenCodeDb
|
|
263
|
-
} from "./index-
|
|
264
|
+
} from "./index-x40zr813.js";
|
|
264
265
|
import {
|
|
265
266
|
getSessionNotes,
|
|
266
267
|
getReadySmartNotes,
|
|
267
268
|
insertPrimerCandidates
|
|
268
|
-
} from "./index-
|
|
269
|
+
} from "./index-tebcx987.js";
|
|
269
270
|
import {
|
|
270
271
|
pushNotification2
|
|
271
272
|
} from "./index-x8a7jmkh.js";
|
|
@@ -283,13 +284,13 @@ import {
|
|
|
283
284
|
getProjectChunkEmbeddingModelId2,
|
|
284
285
|
getProjectEmbeddingMaxInputTokens2,
|
|
285
286
|
embedItemsWindowBounded2
|
|
286
|
-
} from "./index-
|
|
287
|
+
} from "./index-gq1g9a3a.js";
|
|
287
288
|
import {
|
|
288
289
|
renderUserFacingFailure,
|
|
289
290
|
userFacingFailureCode,
|
|
290
291
|
promoteSessionFactsDurable,
|
|
291
292
|
embedPromotedFacts
|
|
292
|
-
} from "./index-
|
|
293
|
+
} from "./index-n6aye6ny.js";
|
|
293
294
|
import {
|
|
294
295
|
isMarkerCandidateBasisCurrent2,
|
|
295
296
|
invalidateMarkerCandidateBasis2,
|
|
@@ -300,10 +301,10 @@ import {
|
|
|
300
301
|
certifiedMarkerReferenceFloor2,
|
|
301
302
|
readMarkerReferenceRows2,
|
|
302
303
|
readKnownMarkerReferenceRows2
|
|
303
|
-
} from "./index-
|
|
304
|
+
} from "./index-832w615x.js";
|
|
304
305
|
import {
|
|
305
306
|
sendStatusNotification2
|
|
306
|
-
} from "./index-
|
|
307
|
+
} from "./index-1sq1krqw.js";
|
|
307
308
|
import {
|
|
308
309
|
isCompactionEnabled,
|
|
309
310
|
migrateLegacyAgentEnabledInMemory
|
|
@@ -327,7 +328,7 @@ import {
|
|
|
327
328
|
import {
|
|
328
329
|
logSlowWriteTransaction,
|
|
329
330
|
WriteTransactionSteps
|
|
330
|
-
} from "./index-
|
|
331
|
+
} from "./index-m0pwswv9.js";
|
|
331
332
|
import {
|
|
332
333
|
ensureStorageDirectorySync,
|
|
333
334
|
writeStorageFileAtomicSync
|
|
@@ -4676,6 +4677,19 @@ function withoutHistorianTailCache(body) {
|
|
|
4676
4677
|
return body;
|
|
4677
4678
|
}
|
|
4678
4679
|
|
|
4680
|
+
// src/v2/hooks/claude-agent-instructions.ts
|
|
4681
|
+
var CLAUDE_AGENT_PROVIDER_ID = "claude-agent";
|
|
4682
|
+
function deliversInstructionsInUserMessage(providerID) {
|
|
4683
|
+
return providerID === CLAUDE_AGENT_PROVIDER_ID;
|
|
4684
|
+
}
|
|
4685
|
+
function claudeAgentInstructionsText(system) {
|
|
4686
|
+
return `Instructions for this task:
|
|
4687
|
+
|
|
4688
|
+
<instructions>
|
|
4689
|
+
${system}
|
|
4690
|
+
</instructions>`;
|
|
4691
|
+
}
|
|
4692
|
+
|
|
4679
4693
|
// src/v2/hooks/hidden-child.ts
|
|
4680
4694
|
var HIDDEN_HISTORIAN_AGENT = "historian";
|
|
4681
4695
|
var HIDDEN_DREAMER_AGENT = "dreamer-classifier";
|
|
@@ -4783,14 +4797,14 @@ class HiddenAgentStepLimit extends Error {
|
|
|
4783
4797
|
this.cap = cap;
|
|
4784
4798
|
}
|
|
4785
4799
|
}
|
|
4786
|
-
function
|
|
4787
|
-
const message = draft.messages.at(-1);
|
|
4800
|
+
function userTexts(message) {
|
|
4788
4801
|
if (!message || message.role !== undefined && message.role !== "user")
|
|
4789
|
-
return;
|
|
4802
|
+
return [];
|
|
4790
4803
|
const content = message.content;
|
|
4791
4804
|
if (typeof content === "string" && content.length > 0)
|
|
4792
|
-
return content;
|
|
4805
|
+
return [content];
|
|
4793
4806
|
const parts = Array.isArray(content) ? content : Array.isArray(message.parts) ? message.parts : [];
|
|
4807
|
+
const texts = [];
|
|
4794
4808
|
for (const part of parts) {
|
|
4795
4809
|
if (!part || typeof part !== "object")
|
|
4796
4810
|
continue;
|
|
@@ -4798,10 +4812,10 @@ function newestUserText(draft) {
|
|
|
4798
4812
|
if (typeof record.text !== "string" || record.text.length === 0)
|
|
4799
4813
|
continue;
|
|
4800
4814
|
if (record.type === undefined || record.type === "text" || record.type === "input_text") {
|
|
4801
|
-
|
|
4815
|
+
texts.push(record.text);
|
|
4802
4816
|
}
|
|
4803
4817
|
}
|
|
4804
|
-
return;
|
|
4818
|
+
return texts;
|
|
4805
4819
|
}
|
|
4806
4820
|
function authoredOptions(attempt) {
|
|
4807
4821
|
const cap = attempt.identity.maxOutputTokens;
|
|
@@ -4837,6 +4851,33 @@ function markerCandidates(text) {
|
|
|
4837
4851
|
const summary = hostCheckpointSummary(text);
|
|
4838
4852
|
return [text, stripped, ...summary === undefined ? [] : [summary]];
|
|
4839
4853
|
}
|
|
4854
|
+
function carriesMarker(texts, marker) {
|
|
4855
|
+
return texts.some((text) => markerCandidates(text).includes(marker));
|
|
4856
|
+
}
|
|
4857
|
+
function sharedPrefixBytes(a, b) {
|
|
4858
|
+
let offset = 0;
|
|
4859
|
+
while (offset < a.length && offset < b.length && a[offset] === b[offset])
|
|
4860
|
+
offset++;
|
|
4861
|
+
return offset;
|
|
4862
|
+
}
|
|
4863
|
+
function closestText(texts, markers) {
|
|
4864
|
+
let closest = texts[0];
|
|
4865
|
+
let best = 0;
|
|
4866
|
+
for (const text of texts) {
|
|
4867
|
+
for (const candidate of markerCandidates(text)) {
|
|
4868
|
+
const bytes = Buffer.from(candidate, "utf8");
|
|
4869
|
+
for (const marker of markers) {
|
|
4870
|
+
const shared = sharedPrefixBytes(bytes, Buffer.from(marker, "utf8"));
|
|
4871
|
+
if (shared > best) {
|
|
4872
|
+
best = shared;
|
|
4873
|
+
closest = text;
|
|
4874
|
+
}
|
|
4875
|
+
}
|
|
4876
|
+
}
|
|
4877
|
+
}
|
|
4878
|
+
return closest;
|
|
4879
|
+
}
|
|
4880
|
+
var REFUSAL_PART_DIGESTS = 8;
|
|
4840
4881
|
function textDigest(text) {
|
|
4841
4882
|
return {
|
|
4842
4883
|
length: text.length,
|
|
@@ -4846,9 +4887,7 @@ function textDigest(text) {
|
|
|
4846
4887
|
function firstDifference(a, b) {
|
|
4847
4888
|
const left = Buffer.from(a, "utf8");
|
|
4848
4889
|
const right = Buffer.from(b, "utf8");
|
|
4849
|
-
|
|
4850
|
-
while (offset < left.length && offset < right.length && left[offset] === right[offset])
|
|
4851
|
-
offset++;
|
|
4890
|
+
const offset = sharedPrefixBytes(left, right);
|
|
4852
4891
|
if (offset === left.length && offset === right.length)
|
|
4853
4892
|
return;
|
|
4854
4893
|
return {
|
|
@@ -4932,15 +4971,14 @@ class HiddenChildHook {
|
|
|
4932
4971
|
}
|
|
4933
4972
|
return marker;
|
|
4934
4973
|
}
|
|
4935
|
-
refuse(reason, draft,
|
|
4936
|
-
const
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
});
|
|
4974
|
+
refuse(reason, draft, texts, inFlight, code = "hidden_prompt_unrecognized") {
|
|
4975
|
+
const markers = [...this.attempts.values()].filter((attempt) => attempt.childSessionId === draft.sessionID && attempt.marker).map((attempt) => ({ attempt, marker: attempt.marker }));
|
|
4976
|
+
const raw = texts === undefined ? undefined : closestText(texts, markers.map(({ marker }) => marker));
|
|
4977
|
+
const registered = markers.map(({ attempt, marker }) => ({
|
|
4978
|
+
...textDigest(marker),
|
|
4979
|
+
shaped: attempt.shaped,
|
|
4980
|
+
...raw === undefined ? {} : { first_difference: firstDifference(raw, marker) }
|
|
4981
|
+
}));
|
|
4944
4982
|
const newest = draft.messages.at(-1);
|
|
4945
4983
|
const summary = raw === undefined ? undefined : hostCheckpointSummary(raw);
|
|
4946
4984
|
this.note(`[magic-context] hidden child refused: ${reason} ${JSON.stringify({
|
|
@@ -4948,6 +4986,7 @@ class HiddenChildHook {
|
|
|
4948
4986
|
messages: draft.messages.length,
|
|
4949
4987
|
newest_role: newest?.role ?? null,
|
|
4950
4988
|
received: raw === undefined ? null : textDigest(raw),
|
|
4989
|
+
...texts !== undefined && texts.length > 1 ? { received_parts: texts.slice(0, REFUSAL_PART_DIGESTS).map(textDigest) } : {},
|
|
4951
4990
|
checkpoint_summary: summary === undefined ? null : textDigest(summary),
|
|
4952
4991
|
registered,
|
|
4953
4992
|
active: this.active.has(draft.sessionID),
|
|
@@ -4960,40 +4999,50 @@ class HiddenChildHook {
|
|
|
4960
4999
|
}
|
|
4961
5000
|
throw refusal;
|
|
4962
5001
|
}
|
|
4963
|
-
|
|
5002
|
+
firstMessageParts(attempt, draft, texts, system) {
|
|
4964
5003
|
const parts = calibratedParts(attempt);
|
|
4965
5004
|
if (!parts)
|
|
4966
|
-
this.refuse("Hidden completion accepts text-only calibrated prompts", draft,
|
|
4967
|
-
|
|
5005
|
+
this.refuse("Hidden completion accepts text-only calibrated prompts", draft, texts);
|
|
5006
|
+
if (!deliversInstructionsInUserMessage(draft.model.providerID))
|
|
5007
|
+
return parts;
|
|
5008
|
+
return [{ type: "text", text: claudeAgentInstructionsText(system) }, ...parts];
|
|
4968
5009
|
}
|
|
4969
5010
|
apply(draft) {
|
|
4970
5011
|
if (!this.owns(draft.sessionID)) {
|
|
4971
5012
|
if (isChildOfDisposedInstance(draft.sessionID)) {
|
|
4972
|
-
this.refuse(`Refusing a turn of a Magic Context hidden child of a disposed plugin instance: ${HIDDEN_RUN_DISPOSED_REASON}`, draft,
|
|
5013
|
+
this.refuse(`Refusing a turn of a Magic Context hidden child of a disposed plugin instance: ${HIDDEN_RUN_DISPOSED_REASON}`, draft, userTexts(draft.messages.at(-1)), undefined, "hidden_instance_disposed");
|
|
4973
5014
|
}
|
|
4974
5015
|
if (hiddenAgentAllowedTools(draft.agent) !== undefined) {
|
|
4975
|
-
this.refuse("Refusing a Magic Context hidden-agent turn this instance did not register", draft,
|
|
5016
|
+
this.refuse("Refusing a Magic Context hidden-agent turn this instance did not register", draft, userTexts(draft.messages.at(-1)));
|
|
4976
5017
|
}
|
|
4977
5018
|
return false;
|
|
4978
5019
|
}
|
|
4979
|
-
const
|
|
4980
|
-
|
|
4981
|
-
for (const
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
5020
|
+
const texts = userTexts(draft.messages.at(-1));
|
|
5021
|
+
const named = new Set;
|
|
5022
|
+
for (const text of texts) {
|
|
5023
|
+
for (const candidate of markerCandidates(text)) {
|
|
5024
|
+
const registered = this.attempts.get(candidate);
|
|
5025
|
+
if (registered) {
|
|
5026
|
+
named.add(registered);
|
|
5027
|
+
break;
|
|
5028
|
+
}
|
|
5029
|
+
}
|
|
5030
|
+
}
|
|
5031
|
+
if (named.size > 1) {
|
|
5032
|
+
this.refuse("Refusing a prompt that names more than one Magic Context hidden run", draft, texts);
|
|
4985
5033
|
}
|
|
5034
|
+
const attempt = [...named][0];
|
|
4986
5035
|
const current = this.active.get(draft.sessionID);
|
|
4987
5036
|
const selected = attempt ?? current;
|
|
4988
5037
|
if (!selected || selected.childSessionId !== draft.sessionID || attempt && current && current !== attempt) {
|
|
4989
|
-
this.refuse("Refusing an unregistered prompt on a Magic Context hidden-run session", draft,
|
|
5038
|
+
this.refuse("Refusing an unregistered prompt on a Magic Context hidden-run session", draft, texts);
|
|
4990
5039
|
}
|
|
4991
5040
|
if (selected.request.signal?.aborted) {
|
|
4992
5041
|
throw new Error("Hidden completion prompt aborted");
|
|
4993
5042
|
}
|
|
4994
5043
|
if (!selected.shaped) {
|
|
4995
5044
|
if (!attempt)
|
|
4996
|
-
this.refuse("Hidden child first step requires a registered marker", draft,
|
|
5045
|
+
this.refuse("Hidden child first step requires a registered marker", draft, texts);
|
|
4997
5046
|
this.active.set(draft.sessionID, selected);
|
|
4998
5047
|
}
|
|
4999
5048
|
const steps = (selected.steps ?? 0) + 1;
|
|
@@ -5005,29 +5054,27 @@ class HiddenChildHook {
|
|
|
5005
5054
|
selected.steps = steps;
|
|
5006
5055
|
const system = typeof selected.request.body.system === "string" ? selected.request.body.system : selected.identity.system;
|
|
5007
5056
|
const blockedRead = needsBlockedRead(selected.identity.agent, draft.model.providerID) && draft.tools.read !== undefined;
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
type: "text",
|
|
5011
|
-
text: blockedRead ? withBlockedReadInstruction(system, selected.identity) : system
|
|
5012
|
-
}
|
|
5013
|
-
];
|
|
5057
|
+
const systemText = blockedRead ? withBlockedReadInstruction(system, selected.identity) : system;
|
|
5058
|
+
draft.system = [{ type: "text", text: systemText }];
|
|
5014
5059
|
if (!selected.shaped) {
|
|
5015
5060
|
draft.messages = [
|
|
5016
|
-
{
|
|
5061
|
+
{
|
|
5062
|
+
role: "user",
|
|
5063
|
+
content: this.firstMessageParts(selected, draft, texts, systemText)
|
|
5064
|
+
}
|
|
5017
5065
|
];
|
|
5018
5066
|
} else {
|
|
5019
5067
|
let start = -1;
|
|
5020
5068
|
draft.messages.forEach((message, index) => {
|
|
5021
|
-
|
|
5022
|
-
if (text !== undefined && selected.marker !== undefined && markerCandidates(text).includes(selected.marker))
|
|
5069
|
+
if (selected.marker !== undefined && carriesMarker(userTexts(message), selected.marker))
|
|
5023
5070
|
start = index;
|
|
5024
5071
|
});
|
|
5025
5072
|
const first = draft.messages[start];
|
|
5026
5073
|
if (!first) {
|
|
5027
|
-
this.refuse("Hidden child history does not contain this run's registered marker", draft,
|
|
5074
|
+
this.refuse("Hidden child history does not contain this run's registered marker", draft, texts);
|
|
5028
5075
|
}
|
|
5029
5076
|
draft.messages = [
|
|
5030
|
-
{ ...first, content: this.
|
|
5077
|
+
{ ...first, content: this.firstMessageParts(selected, draft, texts, systemText) },
|
|
5031
5078
|
...draft.messages.slice(start + 1)
|
|
5032
5079
|
];
|
|
5033
5080
|
}
|
|
@@ -7306,6 +7353,60 @@ function codepoints(value) {
|
|
|
7306
7353
|
function escapeText(value) {
|
|
7307
7354
|
return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
|
|
7308
7355
|
}
|
|
7356
|
+
var PUNCTUATION_FALLBACKS = {
|
|
7357
|
+
"‘": "'",
|
|
7358
|
+
"’": "'",
|
|
7359
|
+
"‚": "'",
|
|
7360
|
+
"‛": "'",
|
|
7361
|
+
"“": '"',
|
|
7362
|
+
"”": '"',
|
|
7363
|
+
"„": '"',
|
|
7364
|
+
"‟": '"',
|
|
7365
|
+
"–": "-",
|
|
7366
|
+
"—": "-",
|
|
7367
|
+
"…": "...",
|
|
7368
|
+
" ": " ",
|
|
7369
|
+
" ": " ",
|
|
7370
|
+
" ": " "
|
|
7371
|
+
};
|
|
7372
|
+
var REMOVABLE_COMBINING_MARK = /(?![\u0334-\u0338])\p{M}/gu;
|
|
7373
|
+
function hasGlyph(character) {
|
|
7374
|
+
return MURAL_FONT_GLYPHS[character] !== undefined;
|
|
7375
|
+
}
|
|
7376
|
+
function drawableMuralCue(cue) {
|
|
7377
|
+
const text = escapeText(cue);
|
|
7378
|
+
let normalized = "";
|
|
7379
|
+
let changed = false;
|
|
7380
|
+
for (const character of text) {
|
|
7381
|
+
if (hasGlyph(character)) {
|
|
7382
|
+
normalized += character;
|
|
7383
|
+
continue;
|
|
7384
|
+
}
|
|
7385
|
+
changed = true;
|
|
7386
|
+
const replacement = PUNCTUATION_FALLBACKS[character] ?? character.normalize("NFKD").replace(REMOVABLE_COMBINING_MARK, "");
|
|
7387
|
+
for (const part of replacement) {
|
|
7388
|
+
if (!hasGlyph(part))
|
|
7389
|
+
return null;
|
|
7390
|
+
}
|
|
7391
|
+
normalized += replacement;
|
|
7392
|
+
}
|
|
7393
|
+
if (!changed)
|
|
7394
|
+
return cue;
|
|
7395
|
+
const result = escapeText(normalized);
|
|
7396
|
+
return result.length > 0 ? result : null;
|
|
7397
|
+
}
|
|
7398
|
+
function partitionDrawableEntries(entries) {
|
|
7399
|
+
const drawable = [];
|
|
7400
|
+
const undrawableIds = [];
|
|
7401
|
+
for (const entry of entries) {
|
|
7402
|
+
const cue = drawableMuralCue(entry.cue);
|
|
7403
|
+
if (cue === null)
|
|
7404
|
+
undrawableIds.push(entry.id);
|
|
7405
|
+
else
|
|
7406
|
+
drawable.push(cue === entry.cue ? entry : { ...entry, cue });
|
|
7407
|
+
}
|
|
7408
|
+
return { drawable, undrawableIds };
|
|
7409
|
+
}
|
|
7309
7410
|
function banner(category, roomWidth) {
|
|
7310
7411
|
const label = ` <${category}> `;
|
|
7311
7412
|
if (codepoints(label) > roomWidth) {
|
|
@@ -7611,11 +7712,12 @@ function snapDimensionToVisionTile(contentPixels, maximum) {
|
|
|
7611
7712
|
return Math.min(maximum, Math.max(MURAL_VISION_TILE, Math.ceil(contentPixels / MURAL_VISION_TILE) * MURAL_VISION_TILE));
|
|
7612
7713
|
}
|
|
7613
7714
|
function planMuralRender(entries) {
|
|
7614
|
-
const
|
|
7615
|
-
const
|
|
7715
|
+
const { drawable, undrawableIds } = partitionDrawableEntries(entries);
|
|
7716
|
+
const roomWidth = chooseRoomWidth(drawable);
|
|
7717
|
+
const plan = planLines(drawable, roomWidth);
|
|
7616
7718
|
const candidates = Array.from({ length: MURAL_COLUMNS }, (_, index) => {
|
|
7617
7719
|
const requestedColumnCount = index + 1;
|
|
7618
|
-
const layout = renderLayout(
|
|
7720
|
+
const layout = renderLayout(drawable, plan, roomWidth, requestedColumnCount);
|
|
7619
7721
|
const contentWidth = layout.columnCount === 0 ? 0 : layout.columnCount * roomWidth * MURAL_CELL_WIDTH + MURAL_COLUMN_GAP * (layout.columnCount - 1) * MURAL_CELL_WIDTH;
|
|
7620
7722
|
const contentHeight = layout.rowCount * MURAL_LINE_PITCH;
|
|
7621
7723
|
const width = snapDimensionToVisionTile(contentWidth, MURAL_WIDTH);
|
|
@@ -7644,7 +7746,13 @@ function planMuralRender(entries) {
|
|
|
7644
7746
|
}
|
|
7645
7747
|
return candidate.requestedColumnCount < best.requestedColumnCount ? candidate : best;
|
|
7646
7748
|
}, firstCandidate);
|
|
7647
|
-
return {
|
|
7749
|
+
return {
|
|
7750
|
+
roomWidth,
|
|
7751
|
+
layout: selected.layout,
|
|
7752
|
+
width: selected.width,
|
|
7753
|
+
height: selected.height,
|
|
7754
|
+
undrawableIds
|
|
7755
|
+
};
|
|
7648
7756
|
}
|
|
7649
7757
|
function rasterMural(plan) {
|
|
7650
7758
|
const { roomWidth, layout, width, height } = plan;
|
|
@@ -7680,6 +7788,7 @@ function renderPlannedMural(plan) {
|
|
|
7680
7788
|
layoutItems: layout.layoutItems,
|
|
7681
7789
|
renderedIds: layout.renderedIds,
|
|
7682
7790
|
droppedIds: layout.droppedIds,
|
|
7791
|
+
undrawableIds: plan.undrawableIds,
|
|
7683
7792
|
categoryLineUsage: layout.usage,
|
|
7684
7793
|
filledLineCount: layout.filledLineCount,
|
|
7685
7794
|
width,
|
|
@@ -7711,13 +7820,17 @@ function poolContentHash(pool, memory) {
|
|
|
7711
7820
|
function getMuralCoverage(db, projectIdentity, pool) {
|
|
7712
7821
|
const { memories, cueState } = pool ?? readMuralPool(db, projectIdentity);
|
|
7713
7822
|
let cuedMemoryCount = 0;
|
|
7823
|
+
let undrawableCueCount = 0;
|
|
7714
7824
|
for (const memory of memories) {
|
|
7715
7825
|
const state = cueState.get(memory.id);
|
|
7716
7826
|
if (state && typeof state.cue === "string" && state.cue.trim() !== "" && state.hash !== null && state.hash === poolContentHash(pool, memory)) {
|
|
7717
|
-
|
|
7827
|
+
if (drawableMuralCue(state.cue) === null)
|
|
7828
|
+
undrawableCueCount += 1;
|
|
7829
|
+
else
|
|
7830
|
+
cuedMemoryCount += 1;
|
|
7718
7831
|
}
|
|
7719
7832
|
}
|
|
7720
|
-
return { activeMemoryCount: memories.length, cuedMemoryCount };
|
|
7833
|
+
return { activeMemoryCount: memories.length, cuedMemoryCount, undrawableCueCount };
|
|
7721
7834
|
}
|
|
7722
7835
|
function resolveMural(db, projectIdentity, budgetTokens = DEFAULT_MURAL_MEMORY_BUDGET, pool) {
|
|
7723
7836
|
const memories = pool?.memories ?? getMemoriesByProject2(db, projectIdentity, ["active", "permanent"]);
|
|
@@ -7835,7 +7948,8 @@ function ensureMuralRendered(db, projectIdentity, budgetTokens = DEFAULT_MURAL_M
|
|
|
7835
7948
|
const pool = readMuralPool(db, projectIdentity);
|
|
7836
7949
|
const coverage = getMuralCoverage(db, projectIdentity, pool);
|
|
7837
7950
|
if (coverage.activeMemoryCount === 0 || !muralCoverageGate(coverage.cuedMemoryCount, coverage.activeMemoryCount)) {
|
|
7838
|
-
const
|
|
7951
|
+
const undrawable = coverage.undrawableCueCount > 0 ? ` the mural font can draw (${coverage.undrawableCueCount} more use characters it has no glyph for)` : "";
|
|
7952
|
+
const skipReason = coverage.activeMemoryCount === 0 ? "no active memories" : `only ${coverage.cuedMemoryCount}/${coverage.activeMemoryCount} active memories have current cues${undrawable} (requires ${MIN_MURAL_CUED_MEMORIES} cues or ${MIN_MURAL_COVERAGE * 100}% coverage)`;
|
|
7839
7953
|
log2(`[mural] skipped for ${projectIdentity}: ${skipReason}`);
|
|
7840
7954
|
return { hasMural: false, rerendered: false, skipReason };
|
|
7841
7955
|
}
|
|
@@ -7850,6 +7964,11 @@ function ensureMuralRendered(db, projectIdentity, budgetTokens = DEFAULT_MURAL_M
|
|
|
7850
7964
|
return { ...cached.result };
|
|
7851
7965
|
}
|
|
7852
7966
|
const plan = planMuralRender(entries);
|
|
7967
|
+
if (plan.layout.renderedIds.length === 0) {
|
|
7968
|
+
const skipReason = `none of the ${entries.length} overflow cues can be drawn (${plan.undrawableIds.length} use characters the mural font has no glyph for)`;
|
|
7969
|
+
log2(`[mural] skipped for ${projectIdentity}: ${skipReason}`);
|
|
7970
|
+
return { hasMural: false, rerendered: false, skipReason };
|
|
7971
|
+
}
|
|
7853
7972
|
const textHash = createHash5("sha256").update(plan.layout.text).digest("hex");
|
|
7854
7973
|
if (existing && existing.contentHash === textHash && existing.width === plan.width && existing.height === plan.height) {
|
|
7855
7974
|
return rememberRender(db, projectIdentity, key, existing.image, {
|
|
@@ -7862,6 +7981,8 @@ function ensureMuralRendered(db, projectIdentity, budgetTokens = DEFAULT_MURAL_M
|
|
|
7862
7981
|
});
|
|
7863
7982
|
}
|
|
7864
7983
|
const rendered = renderPlannedMural(plan);
|
|
7984
|
+
if (rendered.undrawableIds.length > 0)
|
|
7985
|
+
log2(`[mural] rendered for ${projectIdentity}: ${rendered.renderedIds.length} cues drawn, ${rendered.droppedIds.length} left out for space, ${rendered.undrawableIds.length} left out because the mural font has no glyph for their characters`);
|
|
7865
7986
|
if (mode === "persist")
|
|
7866
7987
|
upsertMural(db, {
|
|
7867
7988
|
projectPath: projectIdentity,
|
|
@@ -14475,9 +14596,6 @@ function fitHistorianPrompt(args) {
|
|
|
14475
14596
|
}
|
|
14476
14597
|
|
|
14477
14598
|
// src/hooks/magic-context/compartment-runner-historian.ts
|
|
14478
|
-
function historianResponseDumpDir(directory) {
|
|
14479
|
-
return getProjectMagicContextHistorianDir(directory);
|
|
14480
|
-
}
|
|
14481
14599
|
var MAX_HISTORIAN_RETRIES = 2;
|
|
14482
14600
|
var unknownProducerWindows = new Set;
|
|
14483
14601
|
var HISTORIAN_REASONING_PART_TYPES = new Set(["reasoning", "thinking", "redacted_thinking"]);
|
|
@@ -14951,7 +15069,7 @@ async function runHistorianPrompt(args) {
|
|
|
14951
15069
|
invocationId: invocationId ?? undefined
|
|
14952
15070
|
};
|
|
14953
15071
|
}
|
|
14954
|
-
const dumpPath = dumpHistorianResponse(parentSessionId,
|
|
15072
|
+
const dumpPath = dumpHistorianResponse(parentSessionId, dumpLabel ?? "historian-response", result);
|
|
14955
15073
|
return { ok: true, result, dumpPath, invocationId: invocationId ?? undefined };
|
|
14956
15074
|
} catch (modelError) {
|
|
14957
15075
|
hiddenModelCooldowns.record(handle?.attemptedModel ?? toModelEntry(modelOverride)?.model, modelError);
|
|
@@ -15105,14 +15223,12 @@ function cleanupHistorianDump(sessionId, dumpPath) {
|
|
|
15105
15223
|
});
|
|
15106
15224
|
}
|
|
15107
15225
|
}
|
|
15108
|
-
function dumpHistorianResponse(sessionId,
|
|
15226
|
+
function dumpHistorianResponse(sessionId, label, text) {
|
|
15109
15227
|
try {
|
|
15110
|
-
const dumpDir =
|
|
15228
|
+
const dumpDir = getMagicContextHistorianSessionDir(sessionId);
|
|
15111
15229
|
mkdirSync(dumpDir, { recursive: true });
|
|
15112
|
-
ensureCortexKitArtifactGitignore(directory);
|
|
15113
|
-
const safeSessionId = sanitizeDumpName(sessionId);
|
|
15114
15230
|
const safeLabel = sanitizeDumpName(label);
|
|
15115
|
-
const dumpPath = join3(dumpDir, `${
|
|
15231
|
+
const dumpPath = join3(dumpDir, `${safeLabel}-${Date.now()}.xml`);
|
|
15116
15232
|
writeFileSync2(dumpPath, text, "utf8");
|
|
15117
15233
|
sessionLog2(sessionId, "compartment agent: historian response dumped", {
|
|
15118
15234
|
label,
|
|
@@ -15965,6 +16081,140 @@ function queueDropsForCompartmentalizedMessages(db, sessionId, upToMessageIndex,
|
|
|
15965
16081
|
queuePreparedCompartmentDrops(db, prepareCompartmentDrops(db, sessionId, upToMessageIndex, observedKeys, fromMessageIndex));
|
|
15966
16082
|
}
|
|
15967
16083
|
|
|
16084
|
+
// src/hooks/magic-context/historian-failure-report.ts
|
|
16085
|
+
var REPEATED_HISTORIAN_FAILURE_WARNING_STEP = 3;
|
|
16086
|
+
var REPEATED_HISTORIAN_FAILURE_WARNING_INTERVAL_MS = 30 * 60 * 1000;
|
|
16087
|
+
var ACTIONS = "What to do: run /ctx-status for detail; change the historian model or its fallback models in magic-context.jsonc (user or project config); or run /ctx-recomp to rebuild the history.";
|
|
16088
|
+
var REFUSAL_ERROR_MAX_CHARS = 500;
|
|
16089
|
+
var WARNING_ERROR_MAX_CHARS = 200;
|
|
16090
|
+
function readHistorianFailureStreak(db, sessionId, options = {}) {
|
|
16091
|
+
const state = getHistorianFailureState(db, sessionId);
|
|
16092
|
+
const count = state.failureCount;
|
|
16093
|
+
let since = null;
|
|
16094
|
+
if (count > 0) {
|
|
16095
|
+
const recorded = count - Math.max(0, options.unrecordedFailures ?? 0);
|
|
16096
|
+
if (recorded <= 0) {
|
|
16097
|
+
since = state.lastFailureAt;
|
|
16098
|
+
} else {
|
|
16099
|
+
const times = getRecentFailedHistorianRunTimes(db, sessionId, recorded);
|
|
16100
|
+
since = times.length === recorded ? times[recorded - 1] ?? null : null;
|
|
16101
|
+
}
|
|
16102
|
+
}
|
|
16103
|
+
return { count, lastError: state.lastError, lastFailureAt: state.lastFailureAt, since };
|
|
16104
|
+
}
|
|
16105
|
+
function formatHistorianClockTime(at, now = Date.now()) {
|
|
16106
|
+
const date = new Date(at);
|
|
16107
|
+
const pad = (value) => String(value).padStart(2, "0");
|
|
16108
|
+
const clock = `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
|
|
16109
|
+
const today = new Date(now);
|
|
16110
|
+
const sameDay = date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() && date.getDate() === today.getDate();
|
|
16111
|
+
return sameDay ? clock : `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${clock}`;
|
|
16112
|
+
}
|
|
16113
|
+
function formatHistorianSeconds(ms) {
|
|
16114
|
+
const seconds = Math.max(0, ms) / 1000;
|
|
16115
|
+
return String(Number(seconds.toFixed(seconds >= 10 ? 0 : 3)));
|
|
16116
|
+
}
|
|
16117
|
+
function singleLine(text) {
|
|
16118
|
+
return text.replace(/\s+/g, " ").trim();
|
|
16119
|
+
}
|
|
16120
|
+
function quoteError(error, maxChars) {
|
|
16121
|
+
const text = sanitizeDiagnosticText(singleLine(error));
|
|
16122
|
+
return text.length > maxChars ? `${text.slice(0, maxChars - 1).trimEnd()}…` : text;
|
|
16123
|
+
}
|
|
16124
|
+
function endSentence(text) {
|
|
16125
|
+
return /[.!?]$/.test(text) ? text : `${text}.`;
|
|
16126
|
+
}
|
|
16127
|
+
function usageClause(usagePercentage) {
|
|
16128
|
+
return typeof usagePercentage === "number" && Number.isFinite(usagePercentage) ? `context is at ${Math.round(usagePercentage)}% of the window` : "context is nearly full";
|
|
16129
|
+
}
|
|
16130
|
+
function capitalize(text) {
|
|
16131
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
16132
|
+
}
|
|
16133
|
+
function chunkLabel(chunk) {
|
|
16134
|
+
return chunk ? `messages ${chunk.start}-${chunk.end}` : "";
|
|
16135
|
+
}
|
|
16136
|
+
function streakSentence(failures, now) {
|
|
16137
|
+
if (failures.count <= 0)
|
|
16138
|
+
return null;
|
|
16139
|
+
const since = failures.since !== null ? `, since ${formatHistorianClockTime(failures.since, now)}` : "";
|
|
16140
|
+
return `Summary runs failed in a row: ${failures.count}${since}.`;
|
|
16141
|
+
}
|
|
16142
|
+
function failureBelongsToRun(failures, run) {
|
|
16143
|
+
return failures.count > 0 && failures.lastFailureAt !== null && run?.startedAt !== undefined && failures.lastFailureAt >= run.startedAt;
|
|
16144
|
+
}
|
|
16145
|
+
function describeHistorianJoinRefusal(input) {
|
|
16146
|
+
const now = input.now ?? Date.now();
|
|
16147
|
+
const { run, failures } = input;
|
|
16148
|
+
const sentences = [
|
|
16149
|
+
`This turn was not sent: ${usageClause(input.usagePercentage)}, and Magic Context waited ${formatHistorianSeconds(input.waitedMs)} s for a history summary that did not finish in time.`
|
|
16150
|
+
];
|
|
16151
|
+
const subject = run?.chunk ? `The summary of ${chunkLabel(run.chunk)}` : "The summary run";
|
|
16152
|
+
const ownFailure = failureBelongsToRun(failures, run);
|
|
16153
|
+
const lastError = failures.lastError ? quoteError(failures.lastError, REFUSAL_ERROR_MAX_CHARS) : "";
|
|
16154
|
+
if (ownFailure) {
|
|
16155
|
+
sentences.push(endSentence(`${subject} failed: ${lastError || "no reason recorded"}`));
|
|
16156
|
+
} else if (run && run.endedAt === undefined) {
|
|
16157
|
+
sentences.push(run.startedAt !== undefined ? `${subject} is still running after ${formatHistorianSeconds(now - run.startedAt)} s.` : `${subject} is still running.`);
|
|
16158
|
+
} else if (run) {
|
|
16159
|
+
sentences.push(`${subject} finished after the wait ended.`);
|
|
16160
|
+
}
|
|
16161
|
+
if (!ownFailure && failures.count > 0 && lastError && failures.lastFailureAt !== null) {
|
|
16162
|
+
sentences.push(endSentence(`The previous run failed at ${formatHistorianClockTime(failures.lastFailureAt, now)}: ${lastError}`));
|
|
16163
|
+
}
|
|
16164
|
+
const streak = streakSentence(failures, now);
|
|
16165
|
+
if (streak)
|
|
16166
|
+
sentences.push(streak);
|
|
16167
|
+
sentences.push(ACTIONS);
|
|
16168
|
+
return sentences.join(" ");
|
|
16169
|
+
}
|
|
16170
|
+
function describeRepeatedHistorianFailures(input) {
|
|
16171
|
+
const now = input.now ?? Date.now();
|
|
16172
|
+
const { failures } = input;
|
|
16173
|
+
const facts = [
|
|
16174
|
+
streakSentence(failures, now) ?? "Summary runs are failing.",
|
|
16175
|
+
...input.chunk ? [`Last chunk: ${chunkLabel(input.chunk)}.`] : [],
|
|
16176
|
+
...failures.lastError ? [
|
|
16177
|
+
endSentence(`Last error: ${quoteError(failures.lastError, WARNING_ERROR_MAX_CHARS)}`)
|
|
16178
|
+
] : [],
|
|
16179
|
+
`${capitalize(usageClause(input.usagePercentage))}; at 95% a turn can be refused if no summary finishes in time.`
|
|
16180
|
+
];
|
|
16181
|
+
return [
|
|
16182
|
+
"## Magic Context — History summaries keep failing",
|
|
16183
|
+
"",
|
|
16184
|
+
facts.join(" "),
|
|
16185
|
+
"",
|
|
16186
|
+
ACTIONS
|
|
16187
|
+
].join(`
|
|
16188
|
+
`);
|
|
16189
|
+
}
|
|
16190
|
+
var repeatedFailureWarnings = new Map;
|
|
16191
|
+
function shouldWarnRepeatedHistorianFailures(sessionId, failureCount, now = Date.now()) {
|
|
16192
|
+
const step = REPEATED_HISTORIAN_FAILURE_WARNING_STEP;
|
|
16193
|
+
if (failureCount < step || failureCount % step !== 0)
|
|
16194
|
+
return false;
|
|
16195
|
+
const last = repeatedFailureWarnings.get(sessionId);
|
|
16196
|
+
if (last && failureCount > last.count && now - last.at < REPEATED_HISTORIAN_FAILURE_WARNING_INTERVAL_MS) {
|
|
16197
|
+
return false;
|
|
16198
|
+
}
|
|
16199
|
+
repeatedFailureWarnings.set(sessionId, { count: failureCount, at: now });
|
|
16200
|
+
return true;
|
|
16201
|
+
}
|
|
16202
|
+
function takeRepeatedHistorianFailureWarning(input) {
|
|
16203
|
+
const now = input.now ?? Date.now();
|
|
16204
|
+
if (!shouldWarnRepeatedHistorianFailures(input.sessionId, input.failureCount, now)) {
|
|
16205
|
+
return null;
|
|
16206
|
+
}
|
|
16207
|
+
const failures = readHistorianFailureStreak(input.db, input.sessionId, {
|
|
16208
|
+
unrecordedFailures: input.unrecordedFailures
|
|
16209
|
+
});
|
|
16210
|
+
return describeRepeatedHistorianFailures({
|
|
16211
|
+
chunk: input.chunk,
|
|
16212
|
+
failures: { ...failures, count: input.failureCount },
|
|
16213
|
+
usagePercentage: loadPersistedUsage(input.db, input.sessionId)?.usage.percentage,
|
|
16214
|
+
now
|
|
16215
|
+
});
|
|
16216
|
+
}
|
|
16217
|
+
|
|
15968
16218
|
// src/hooks/magic-context/historian-history-wait.ts
|
|
15969
16219
|
var historyWaits = new Map;
|
|
15970
16220
|
function newestMessageId(snapshot) {
|
|
@@ -17393,6 +17643,28 @@ async function runCompartmentAgent(deps) {
|
|
|
17393
17643
|
}
|
|
17394
17644
|
await sendStatusNotification2(client, sessionId, message, getNotificationParams?.() ?? {});
|
|
17395
17645
|
};
|
|
17646
|
+
const notifyCountedFailure = async (failureCount, notice) => {
|
|
17647
|
+
let warning = null;
|
|
17648
|
+
try {
|
|
17649
|
+
warning = takeRepeatedHistorianFailureWarning({
|
|
17650
|
+
db,
|
|
17651
|
+
sessionId,
|
|
17652
|
+
failureCount,
|
|
17653
|
+
chunk: telemetry.chunkStartOrdinal != null && telemetry.chunkEndOrdinal != null ? { start: telemetry.chunkStartOrdinal, end: telemetry.chunkEndOrdinal } : undefined,
|
|
17654
|
+
unrecordedFailures: 1
|
|
17655
|
+
});
|
|
17656
|
+
} catch (error) {
|
|
17657
|
+
sessionLog2(sessionId, "historian repeated-failure warning failed:", error);
|
|
17658
|
+
}
|
|
17659
|
+
if (!warning) {
|
|
17660
|
+
await notifyHistorianIssue(notice);
|
|
17661
|
+
return;
|
|
17662
|
+
}
|
|
17663
|
+
issueNotified = true;
|
|
17664
|
+
lastHistorianAlertBySession.set(sessionId, Date.now());
|
|
17665
|
+
sessionLog2(sessionId, `historian repeated-failure warning sent: count=${failureCount}`);
|
|
17666
|
+
await sendStatusNotification2(client, sessionId, warning, getNotificationParams?.() ?? {});
|
|
17667
|
+
};
|
|
17396
17668
|
const truncateHistorianInputIfNeeded = (text, budget) => {
|
|
17397
17669
|
if (estimateTokens(text) <= budget)
|
|
17398
17670
|
return text;
|
|
@@ -17473,9 +17745,9 @@ async function runCompartmentAgent(deps) {
|
|
|
17473
17745
|
telemetry.failureReason = `existing-validation: ${existingValidationError}`;
|
|
17474
17746
|
retainDrainReservationForRetryThrottle = true;
|
|
17475
17747
|
if (unresolvedInvolved) {
|
|
17476
|
-
await
|
|
17748
|
+
await notifyCountedFailure(failCount, buildStoredCompartmentsInvalidNotice());
|
|
17477
17749
|
} else {
|
|
17478
|
-
await
|
|
17750
|
+
await notifyCountedFailure(failCount, buildHistorianFailureNotice(failCount, existingValidationError));
|
|
17479
17751
|
}
|
|
17480
17752
|
return;
|
|
17481
17753
|
}
|
|
@@ -17606,9 +17878,9 @@ async function runCompartmentAgent(deps) {
|
|
|
17606
17878
|
return;
|
|
17607
17879
|
}
|
|
17608
17880
|
sessionLog2(sessionId, `historian failure: source=prompt-fit reason="${promptFit.reason}"`);
|
|
17609
|
-
incrementHistorianFailure(db, sessionId, promptFit.reason);
|
|
17881
|
+
const failCount = incrementHistorianFailure(db, sessionId, promptFit.reason);
|
|
17610
17882
|
retainDrainReservationForRetryThrottle = true;
|
|
17611
|
-
await
|
|
17883
|
+
await notifyCountedFailure(failCount, buildHistorianWindowTooSmallNotice());
|
|
17612
17884
|
return;
|
|
17613
17885
|
}
|
|
17614
17886
|
const chunkTokens = promptFit.chunkTokens;
|
|
@@ -17648,6 +17920,7 @@ async function runCompartmentAgent(deps) {
|
|
|
17648
17920
|
const forceKeepLastCompartmentForChunk = deps.forceKeepLastCompartment === true && !chunk.hasMore;
|
|
17649
17921
|
telemetry.chunkStartOrdinal = chunk.startIndex;
|
|
17650
17922
|
telemetry.chunkEndOrdinal = chunk.endIndex;
|
|
17923
|
+
deps.onChunkSelected?.({ start: chunk.startIndex, end: chunk.endIndex });
|
|
17651
17924
|
if (!chunk.text || chunk.messageCount === 0) {
|
|
17652
17925
|
if (persistFilteredNoise(db, sessionId, chunk, eligibleEndOrdinal)) {
|
|
17653
17926
|
telemetry.status = "noop";
|
|
@@ -17708,7 +17981,7 @@ async function runCompartmentAgent(deps) {
|
|
|
17708
17981
|
telemetry.failureReason = `chunk-coverage: ${chunkCoverageError}`;
|
|
17709
17982
|
sessionLog2(sessionId, `historian failure: source=chunk-coverage reason="${chunkCoverageError}" chunkRange=${chunk.startIndex}-${chunk.endIndex}`);
|
|
17710
17983
|
const failCount = incrementHistorianFailure(db, sessionId, chunkCoverageError);
|
|
17711
|
-
await
|
|
17984
|
+
await notifyCountedFailure(failCount, buildHistorianFailureNotice(failCount, chunkCoverageError));
|
|
17712
17985
|
rollbackDrainReservation();
|
|
17713
17986
|
return;
|
|
17714
17987
|
}
|
|
@@ -17759,7 +18032,7 @@ ${chunkText}`,
|
|
|
17759
18032
|
sessionLog2(sessionId, `historian failure: source=validation reason="${validatedPass.error}" chunkRange=${chunk.startIndex}-${chunk.endIndex} fallbackModel=${deps.fallbackModelId ?? "<none>"} twoPass=${deps.historianTwoPass ? "true" : "false"}`);
|
|
17760
18033
|
const failCount = incrementHistorianFailure(db, sessionId, validatedPass.error);
|
|
17761
18034
|
telemetry.failureReason = validatedPass.failureReason ?? validatedPass.error;
|
|
17762
|
-
await
|
|
18035
|
+
await notifyCountedFailure(failCount, buildHistorianFailureNotice(failCount, validatedPass.error));
|
|
17763
18036
|
return;
|
|
17764
18037
|
}
|
|
17765
18038
|
retainDrainReservationForRetryThrottle = false;
|
|
@@ -17788,7 +18061,7 @@ ${chunkText}`,
|
|
|
17788
18061
|
sessionLog2(sessionId, "historian output discarded: reason=no_forward_progress");
|
|
17789
18062
|
const failCount = incrementHistorianFailure(db, sessionId, `no forward progress beyond raw message ${offset - 1}`);
|
|
17790
18063
|
try {
|
|
17791
|
-
await
|
|
18064
|
+
await notifyCountedFailure(failCount, buildHistorianFailureNotice(failCount, `historian made no forward progress beyond raw message ${offset - 1}`));
|
|
17792
18065
|
} finally {
|
|
17793
18066
|
recordHistorianNoProgress(boundarySnapshot, inEmergency);
|
|
17794
18067
|
}
|
|
@@ -17839,7 +18112,7 @@ ${chunkText}`,
|
|
|
17839
18112
|
sessionLog2(sessionId, `historian publish refused: sequence=${danglingBoundary.sequence} side=${danglingBoundary.side} missing_id=${danglingBoundary.messageId}; raw snapshot changed during the historian run`);
|
|
17840
18113
|
sessionLog2(sessionId, "historian output discarded: reason=dangling_boundary");
|
|
17841
18114
|
const failCount = incrementHistorianFailure(db, sessionId, reason);
|
|
17842
|
-
await
|
|
18115
|
+
await notifyCountedFailure(failCount, buildHistorianFailureNotice(failCount, reason));
|
|
17843
18116
|
rollbackDrainReservation();
|
|
17844
18117
|
return;
|
|
17845
18118
|
}
|
|
@@ -18047,7 +18320,7 @@ ${chunkText}`,
|
|
|
18047
18320
|
sessionLog2(sessionId, `historian failure: source=exception ${desc.brief}${desc.stackHead ? ` stackHead="${desc.stackHead}"` : ""}`);
|
|
18048
18321
|
if (!issueNotified) {
|
|
18049
18322
|
const failCount = incrementHistorianFailure(db, sessionId, desc.brief);
|
|
18050
|
-
await
|
|
18323
|
+
await notifyCountedFailure(failCount, buildHistorianFailureNotice(failCount, desc.brief));
|
|
18051
18324
|
}
|
|
18052
18325
|
} finally {
|
|
18053
18326
|
if (!completedSuccessfully) {
|
|
@@ -18871,10 +19144,12 @@ function registerActiveCompartmentRun(sessionId, promise, kind = "other") {
|
|
|
18871
19144
|
const activeRun = {
|
|
18872
19145
|
promise: Promise.resolve(),
|
|
18873
19146
|
published: false,
|
|
18874
|
-
kind
|
|
19147
|
+
kind,
|
|
19148
|
+
startedAt: Date.now()
|
|
18875
19149
|
};
|
|
18876
19150
|
const wrapped = promise.finally(() => {
|
|
18877
19151
|
activeRun.settled = true;
|
|
19152
|
+
activeRun.endedAt = Date.now();
|
|
18878
19153
|
if (activeRuns.get(sessionId)?.promise === wrapped) {
|
|
18879
19154
|
activeRuns.delete(sessionId);
|
|
18880
19155
|
}
|
|
@@ -18931,9 +19206,19 @@ function startBackgroundCompartmentAgent(deps, runAgent, prepareBoundary) {
|
|
|
18931
19206
|
return;
|
|
18932
19207
|
}
|
|
18933
19208
|
const renewal = startLeaseRenewal(deps, holderId);
|
|
19209
|
+
const activeRun = {
|
|
19210
|
+
promise: Promise.resolve(),
|
|
19211
|
+
published: false,
|
|
19212
|
+
kind: "incremental",
|
|
19213
|
+
startedAt: Date.now()
|
|
19214
|
+
};
|
|
18934
19215
|
const runnerDeps = withPublishedCallback({
|
|
18935
19216
|
...deps,
|
|
18936
|
-
compartmentLeaseHolderId: holderId
|
|
19217
|
+
compartmentLeaseHolderId: holderId,
|
|
19218
|
+
onChunkSelected: (chunk) => {
|
|
19219
|
+
activeRun.chunk = chunk;
|
|
19220
|
+
deps.onChunkSelected?.(chunk);
|
|
19221
|
+
}
|
|
18937
19222
|
});
|
|
18938
19223
|
const promise = new Promise((resolve) => setTimeout(resolve, 0)).then(() => withRawSessionMessageCache2(() => {
|
|
18939
19224
|
const snapshot = deps.boundarySnapshot;
|
|
@@ -18963,6 +19248,7 @@ function startBackgroundCompartmentAgent(deps, runAgent, prepareBoundary) {
|
|
|
18963
19248
|
updateSessionMeta(deps.db, deps.sessionId, { compartmentInProgress: false });
|
|
18964
19249
|
} catch {}
|
|
18965
19250
|
}).finally(() => {
|
|
19251
|
+
activeRun.endedAt = Date.now();
|
|
18966
19252
|
try {
|
|
18967
19253
|
clearInterval(renewal);
|
|
18968
19254
|
releaseCompartmentLeaseBestEffort(deps.db, deps.sessionId, holderId, sessionLog2);
|
|
@@ -18973,7 +19259,8 @@ function startBackgroundCompartmentAgent(deps, runAgent, prepareBoundary) {
|
|
|
18973
19259
|
sessionLog2(deps.sessionId, "compartment agent: finalizer failed:", err);
|
|
18974
19260
|
}
|
|
18975
19261
|
});
|
|
18976
|
-
|
|
19262
|
+
activeRun.promise = promise;
|
|
19263
|
+
activeRuns.set(deps.sessionId, activeRun);
|
|
18977
19264
|
}
|
|
18978
19265
|
async function executeContextRecompWithResult(deps, options = {}) {
|
|
18979
19266
|
const { sessionId } = deps;
|
|
@@ -19037,4 +19324,4 @@ async function executeContextRecomp(deps, options = {}) {
|
|
|
19037
19324
|
return (await executeContextRecompWithResult(deps, options)).message;
|
|
19038
19325
|
}
|
|
19039
19326
|
|
|
19040
|
-
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, 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, 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, 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, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
|
|
19327
|
+
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, 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, 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, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
|