@cortexkit/opencode-magic-context 0.49.95 → 0.49.96
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-4ynkaf0d.js → announcement-8nj2jd87.js} +5 -5
- package/dist/auto-search-worker.js +5 -5
- package/dist/chunk-embedding-write-worker.js +16 -16
- package/dist/{compaction-marker-candidates-1ndjqh9k.js → compaction-marker-candidates-a4b0anvv.js} +3 -3
- package/dist/compaction-marker-candidates-worker.js +1 -1
- package/dist/{compartment-chunk-embedding-4nn3hsw2.js → compartment-chunk-embedding-re2cw7y3.js} +8 -8
- package/dist/config/removed-agent-config.d.ts +1 -1
- package/dist/config/removed-agent-config.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +0 -75
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-exf96bpt.js → conflict-warning-hook-wcq55y61.js} +8 -8
- package/dist/{context-h9x9m2p3.js → context-gtjdrp8f.js} +86 -104
- package/dist/{derive-budgets-hzzq71rm.js → derive-budgets-g1sy72e8.js} +5 -5
- package/dist/embedding-backfill-pdymqbnh.js +29 -0
- package/dist/embedding-worker-process.js +2 -2
- package/dist/embedding-worker.js +8 -8
- package/dist/features/magic-context/dreamer/token-budget.d.ts +2 -2
- package/dist/features/magic-context/dreamer/token-budget.d.ts.map +1 -1
- package/dist/features/magic-context/search-rerank.d.ts +2 -2
- package/dist/features/magic-context/search-rerank.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/{history-owner-xqfsvf9k.js → history-owner-74826t4n.js} +3 -3
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +6 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +2 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +1 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +2 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-3ywyr4zx.js → index-0bjj9yf3.js} +2 -2
- package/dist/{index-7skgrbsg.js → index-0sqhg9nf.js} +41 -21
- package/dist/{index-nxxzeq4y.js → index-0ve29s6f.js} +1 -1
- package/dist/{index-7dzaamqg.js → index-2afrmgy3.js} +4 -4
- package/dist/{index-ywrz4wy2.js → index-3fhb0j32.js} +1 -1
- package/dist/{index-gqf8r04r.js → index-3n4j5rqc.js} +1 -1
- package/dist/{index-xsqw8kbd.js → index-45qgkg8j.js} +2 -2
- package/dist/{index-5df2fw5b.js → index-6mryx739.js} +1 -1
- package/dist/{index-tedck05r.js → index-7m2tnk8q.js} +10 -10
- package/dist/{index-r4y0dczp.js → index-7sdns2ww.js} +2 -2
- package/dist/{index-mjy2k9jr.js → index-880a24vd.js} +1 -1
- package/dist/{index-esacb9d0.js → index-89bkkgcn.js} +4 -4
- package/dist/{index-s32f8y67.js → index-89xg64wb.js} +2 -2
- package/dist/{index-2v9qpmb3.js → index-8sgv96kq.js} +7 -7
- package/dist/{index-qmm8xpbc.js → index-910gahfb.js} +6 -6
- package/dist/{index-47hst5me.js → index-9jvxq5rt.js} +4 -4
- package/dist/{index-832w615x.js → index-azkfw78y.js} +1 -1
- package/dist/{index-wh9fxds5.js → index-c205x7xd.js} +1 -1
- package/dist/{index-mg9s2rc3.js → index-cpbr0xvk.js} +2 -2
- package/dist/{index-3tmbvn0z.js → index-cq8znmyw.js} +17 -17
- package/dist/{index-cr483vx6.js → index-dj64gzg5.js} +2 -2
- package/dist/{index-jba6ny4m.js → index-dnpcv1rg.js} +4 -4
- package/dist/{index-z4p0ry94.js → index-dt7cyqfe.js} +2 -1
- package/dist/{index-tm799pq7.js → index-e6ay1gez.js} +1 -1
- package/dist/{index-jm62g83a.js → index-f154w8m4.js} +71 -44
- package/dist/{index-j7n64sg4.js → index-fgw241hh.js} +2 -2
- package/dist/{index-wqwjawer.js → index-fvfnq8n6.js} +6 -6
- package/dist/{index-pc49a7zt.js → index-gnrwgvn7.js} +10 -10
- package/dist/{index-yzzxb5e1.js → index-h7kta6cn.js} +3 -3
- package/dist/{index-q7q6qp1f.js → index-hedgz8an.js} +1 -1
- package/dist/{index-5pgyqgmx.js → index-hj78hvhm.js} +2 -2
- package/dist/{index-7r11k4xr.js → index-hp46xe93.js} +7 -7
- package/dist/{index-ejgp0z9p.js → index-j4dcjb8t.js} +4 -4
- package/dist/{index-e6ncz7a6.js → index-jzrvdqb8.js} +1 -1
- package/dist/{index-sp5pvs95.js → index-k34hc455.js} +2 -2
- package/dist/{index-9ffntwyr.js → index-kj4bprep.js} +4 -4
- package/dist/{index-xe34pwb6.js → index-mgy7g740.js} +1 -1
- package/dist/{index-2gewejcz.js → index-nqdwpdje.js} +145 -32
- package/dist/{index-xjaf9g90.js → index-r1d45dsr.js} +4 -4
- package/dist/{index-y915t3ey.js → index-r3f85n7y.js} +5 -1
- package/dist/{index-ewta5h87.js → index-t2e10rag.js} +5 -5
- package/dist/{index-m0pwswv9.js → index-tqtpgnhr.js} +1 -1
- package/dist/{index-zk6gtf43.js → index-w7n7qkpf.js} +5 -5
- package/dist/{index-s7460efs.js → index-zfx7mtqa.js} +1 -1
- package/dist/{index-c81tggen.js → index-zkjx8gq3.js} +11 -11
- package/dist/{index-et39x9k3.js → index-zmgp0tr6.js} +3 -3
- package/dist/index.js +58 -55
- package/dist/{logger-d7c8akh9.js → logger-nmb2508f.js} +2 -2
- package/dist/{message-fts-rowid-map-0xx8ge09.js → message-fts-rowid-map-vcatdan0.js} +5 -5
- package/dist/{message-index-bounded-d3x8rhpz.js → message-index-bounded-abhwe610.js} +12 -12
- package/dist/{message-time-backfill-pz5981mf.js → message-time-backfill-zc5rsvhv.js} +3 -3
- package/dist/migration-worker.js +13 -13
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/{project-embedding-registry-az68q792.js → project-embedding-registry-e566q4bg.js} +15 -15
- package/dist/raw-ordinal-warmup-worker.js +8 -8
- package/dist/{read-session-chunk-70r1snq3.js → read-session-chunk-sde0wym3.js} +10 -10
- package/dist/{read-session-raw-3sc9231y.js → read-session-raw-trhdgc9z.js} +3 -3
- package/dist/{recomp-orchestrator-cn4r2gz6.js → recomp-orchestrator-d3rbpa59.js} +33 -33
- package/dist/render-6cf1dgc4.js +43 -0
- package/dist/{safe-notification-target-d21swr3n.js → safe-notification-target-54ns7dv9.js} +3 -3
- package/dist/{search-b0cb342r.js → search-11aw8wpq.js} +27 -27
- package/dist/{search-archive-s9t3exc1.js → search-archive-s9m5szf0.js} +13 -13
- package/dist/{send-session-notification-0779tyd9.js → send-session-notification-gxrj4w1r.js} +6 -6
- package/dist/shared/host-sqlite-runtime.d.ts +3 -0
- package/dist/shared/host-sqlite-runtime.d.ts.map +1 -0
- package/dist/shared/redaction.d.ts.map +1 -1
- package/dist/{storage-tags-xvbje7jm.js → storage-tags-jq0c0zsn.js} +7 -7
- package/dist/{store-91kawq9a.js → store-29ksp6vy.js} +3 -3
- package/dist/{transform-postprocess-phase-r1xhsjrh.js → transform-postprocess-phase-376xn40x.js} +34 -34
- package/dist/v2/auto-search-worker.js +5 -5
- package/dist/v2/chunk-embedding-write-worker.js +16 -16
- package/dist/v2/{compaction-marker-candidates-bp1bn579.js → compaction-marker-candidates-6nypmsr3.js} +3 -3
- package/dist/v2/compaction-marker-candidates-worker.js +1 -1
- package/dist/v2/{compartment-chunk-embedding-a7ddvz7v.js → compartment-chunk-embedding-jthtfhcd.js} +8 -8
- package/dist/v2/{context-2hssw26q.js → context-vm09agrs.js} +117 -109
- package/dist/v2/{derive-budgets-hr4qqrnv.js → derive-budgets-wj0q7s7d.js} +6 -6
- package/dist/v2/embedding-backfill-16b16m38.js +29 -0
- package/dist/v2/embedding-worker-process.js +2 -2
- package/dist/v2/embedding-worker.js +8 -8
- package/dist/v2/fold/native-replay.d.ts +2 -1
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/hidden-child-native.d.ts.map +1 -1
- package/dist/v2/hidden-child-record.d.ts +8 -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/hidden-run-holder.d.ts +8 -2
- package/dist/v2/hidden-run-holder.d.ts.map +1 -1
- package/dist/v2/{history-owner-260djmv5.js → history-owner-8pd5ax3n.js} +3 -3
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts +3 -0
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/{logger-zyf43np1.js → logger-58jfese9.js} +2 -2
- package/dist/v2/{message-fts-rowid-map-n8mcvcpz.js → message-fts-rowid-map-ax4vk78j.js} +5 -5
- package/dist/v2/{message-index-bounded-tbwrff24.js → message-index-bounded-qh794qxx.js} +12 -12
- package/dist/v2/{message-time-backfill-ynb3vg6r.js → message-time-backfill-yj773saf.js} +3 -3
- package/dist/v2/migration-worker.js +13 -13
- package/dist/v2/{project-embedding-registry-2zeycxek.js → project-embedding-registry-z05xvckg.js} +15 -15
- package/dist/v2/raw-ordinal-warmup-worker.js +8 -8
- package/dist/v2/{read-session-chunk-cvgsfsgr.js → read-session-chunk-8tn2dbn1.js} +10 -10
- package/dist/v2/{read-session-raw-wg5zc29f.js → read-session-raw-ywebck9q.js} +3 -3
- package/dist/v2/recomp-orchestrator-pfjpzdrb.js +69 -0
- package/dist/v2/render-7t5d7hkv.js +43 -0
- package/dist/v2/{safe-notification-target-y55z2zat.js → safe-notification-target-zrwbh6k7.js} +3 -3
- package/dist/v2/{search-x1cac8t6.js → search-35cz80x0.js} +26 -26
- package/dist/v2/{search-archive-k2yh0jj3.js → search-archive-5dpxv0ck.js} +13 -13
- package/dist/v2/{send-session-notification-v69y04f5.js → send-session-notification-8x146x5y.js} +6 -6
- package/dist/v2/{server-gj259dqy.js → server-11ra1pmx.js} +5 -5
- package/dist/v2/{server-gs2251jr.js → server-2cq3e1c1.js} +4 -4
- package/dist/v2/{server-39bcszk4.js → server-2qvnr3t7.js} +1 -1
- package/dist/v2/{server-jkj1dq6j.js → server-2sare4qg.js} +4 -4
- package/dist/v2/{server-jdfe07mp.js → server-2wz6y46g.js} +1 -1
- package/dist/v2/{server-at0v0z4t.js → server-379fd3n7.js} +1 -1
- package/dist/v2/{server-ds8vpfkr.js → server-40vdz8sf.js} +2 -2
- package/dist/v2/{server-qntmqaca.js → server-4yrvbnnm.js} +2 -2
- package/dist/v2/{server-x69fqsvz.js → server-5t4nzfpt.js} +1 -1
- package/dist/v2/{server-npdey91q.js → server-63ree5ns.js} +1 -1
- package/dist/v2/{server-gqkdfdvw.js → server-6qax5pds.js} +2 -2
- package/dist/v2/{server-qb3s0mnc.js → server-73bqw5c0.js} +1 -1
- package/dist/v2/{server-qy58c11s.js → server-7h4gwphm.js} +4 -4
- package/dist/v2/{server-476anw1w.js → server-7tj8yzrv.js} +1 -1
- package/dist/v2/{server-e6xneh68.js → server-arfzfxe8.js} +5 -1
- package/dist/v2/{server-6ash6z8z.js → server-av3p9c8k.js} +1 -1
- package/dist/v2/{server-5hwf5c7r.js → server-bx5k66qc.js} +1 -1
- package/dist/v2/{server-s81b3nct.js → server-db91dxwc.js} +7 -7
- package/dist/v2/{server-z4p0ry94.js → server-dt7cyqfe.js} +2 -1
- package/dist/v2/{server-zc8s06gx.js → server-ganavh75.js} +2 -2
- package/dist/v2/{server-cvm1qrqc.js → server-gh2w75fn.js} +3 -3
- package/dist/v2/{server-y0pd600x.js → server-j1gxs1gj.js} +1 -1
- package/dist/v2/{server-xepfjgv5.js → server-k3ntgf6n.js} +2 -2
- package/dist/v2/{server-j8376q08.js → server-kzrrdjp5.js} +1 -1
- package/dist/v2/{server-1rrmxhd1.js → server-n33hyq9t.js} +2 -2
- package/dist/v2/{server-0tv6kytx.js → server-n34vzyfm.js} +1 -1
- package/dist/v2/{server-prrx17q3.js → server-nnh81jqy.js} +6 -6
- package/dist/v2/{server-s8mk882p.js → server-pcq2d1wh.js} +6 -6
- package/dist/v2/{server-vbr1rdkg.js → server-ppy2dj7g.js} +4 -4
- package/dist/v2/{server-96nm9vk4.js → server-rr5c0xcg.js} +2 -2
- package/dist/v2/{server-j4jjtdc5.js → server-rt8t6s2a.js} +2 -2
- package/dist/v2/{server-srtq37nh.js → server-svccj9rd.js} +4 -4
- package/dist/v2/{server-5sbsnpkn.js → server-tq523gj6.js} +1 -1
- package/dist/v2/{server-00adcfjd.js → server-vj0xbbrc.js} +17 -3
- package/dist/v2/{server-cd93xyyx.js → server-vntc961c.js} +10 -10
- package/dist/v2/{server-88pjnecb.js → server-vsx9tsks.js} +11 -11
- package/dist/v2/{server-6nh36020.js → server-w35ep6wn.js} +132 -33
- package/dist/v2/{server-bfct1yvb.js → server-z2nv8jdv.js} +41 -21
- package/dist/v2/{server-6aj72z52.js → server-z5cv5wm5.js} +10 -10
- package/dist/v2/{server-5016ccyn.js → server-zemnpv92.js} +4 -4
- package/dist/v2/server.js +9 -9
- package/dist/v2/{storage-tags-y20j3jdp.js → storage-tags-pcenytad.js} +7 -7
- package/dist/v2/{store-b95snz31.js → store-gx19qc3a.js} +3 -3
- package/dist/v2/{v2-archive-reader-q92kwkr5.js → v2-archive-reader-jqrwz7b8.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-ydqkxkhj.js → wrapup-orchestrator-kcq3cv7y.js} +34 -34
- package/dist/{v2-archive-reader-x62hsr4c.js → v2-archive-reader-64h2gtam.js} +1 -1
- package/dist/wrapup-orchestrator-knyac7jp.js +56 -0
- package/package.json +1 -1
- package/src/config/index.test.ts +23 -5
- package/src/config/live-run-config.test.ts +7 -7
- package/src/config/removed-agent-config.ts +14 -1
- package/src/config/schema/magic-context.ts +5 -1
- package/src/shared/host-sqlite-runtime.test.ts +21 -0
- package/src/shared/host-sqlite-runtime.ts +32 -0
- package/src/shared/redaction.test.ts +11 -8
- package/src/shared/redaction.ts +5 -1
- package/dist/embedding-backfill-wdrqkw09.js +0 -29
- package/dist/render-g45k3gts.js +0 -43
- package/dist/v2/embedding-backfill-gveter8p.js +0 -29
- package/dist/v2/recomp-orchestrator-k4cj62f2.js +0 -69
- package/dist/v2/render-ys7a3zks.js +0 -43
- package/dist/wrapup-orchestrator-kt81d6et.js +0 -56
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
getMagicContextHistorianSessionDir,
|
|
7
7
|
log2,
|
|
8
8
|
sessionLog2
|
|
9
|
-
} from "./server-
|
|
9
|
+
} from "./server-kzrrdjp5.js";
|
|
10
10
|
import {
|
|
11
11
|
sanitizeDiagnosticText
|
|
12
|
-
} from "./server-
|
|
12
|
+
} from "./server-dt7cyqfe.js";
|
|
13
13
|
import {
|
|
14
14
|
parseTree,
|
|
15
15
|
parseJsoncRecovering,
|
|
@@ -19,20 +19,20 @@ import {
|
|
|
19
19
|
cortexKitProjectConfigBasePath,
|
|
20
20
|
resolveLegacyConfigSourcesForHarness,
|
|
21
21
|
loadPluginConfigDetailed
|
|
22
|
-
} from "./server-
|
|
22
|
+
} from "./server-vj0xbbrc.js";
|
|
23
23
|
import {
|
|
24
24
|
catalogOutputReserve,
|
|
25
25
|
getSdkContextLimit,
|
|
26
26
|
modelSupportsVision,
|
|
27
27
|
getSdkOutputLimit
|
|
28
|
-
} from "./server-
|
|
28
|
+
} from "./server-rr5c0xcg.js";
|
|
29
29
|
import {
|
|
30
30
|
withContentLanguageDirective,
|
|
31
31
|
buildPrimaryLanguageDirective,
|
|
32
32
|
resolvePromptSurface,
|
|
33
33
|
DEFAULT_HISTORIAN_TIMEOUT_MS,
|
|
34
34
|
LIVE_RELOAD_CONFIG_PATHS
|
|
35
|
-
} from "./server-
|
|
35
|
+
} from "./server-arfzfxe8.js";
|
|
36
36
|
import {
|
|
37
37
|
inRootAsyncContext2,
|
|
38
38
|
Database2,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
RawOrdinalsNotReady2,
|
|
48
48
|
dropRawSessionOrdinalCheckpoints2,
|
|
49
49
|
runSessionWarmupWorker
|
|
50
|
-
} from "./server-
|
|
50
|
+
} from "./server-av3p9c8k.js";
|
|
51
51
|
import {
|
|
52
52
|
CACHED_TRIM_PARTIAL_SQL,
|
|
53
53
|
ensureSessionMetaRow,
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
foldShrunkPartTags2,
|
|
98
98
|
getTagNumberByMessageId2,
|
|
99
99
|
getActiveTagsBySession2
|
|
100
|
-
} from "./server-
|
|
100
|
+
} from "./server-11ra1pmx.js";
|
|
101
101
|
import {
|
|
102
102
|
COMPARTMENT_LEASE_RENEWAL_MS,
|
|
103
103
|
getCompartmentLeaseBlocker,
|
|
@@ -147,7 +147,7 @@ import {
|
|
|
147
147
|
getProjectState,
|
|
148
148
|
recordSubagentInvocation,
|
|
149
149
|
getLatestHistorianInvocationId
|
|
150
|
-
} from "./server-
|
|
150
|
+
} from "./server-vntc961c.js";
|
|
151
151
|
import {
|
|
152
152
|
providerMass,
|
|
153
153
|
calibrationForModelKey,
|
|
@@ -156,11 +156,12 @@ import {
|
|
|
156
156
|
import {
|
|
157
157
|
hasMeaningfulUserText2,
|
|
158
158
|
estimateTokens,
|
|
159
|
+
createTokenCountMemo,
|
|
159
160
|
estimateFixedPromptTokens
|
|
160
|
-
} from "./server-
|
|
161
|
+
} from "./server-73bqw5c0.js";
|
|
161
162
|
import {
|
|
162
163
|
BoundedSessionMap
|
|
163
|
-
} from "./server-
|
|
164
|
+
} from "./server-4yrvbnnm.js";
|
|
164
165
|
import {
|
|
165
166
|
resolveOpenCodeDbPath,
|
|
166
167
|
assertOpenCodeStoreGeneration,
|
|
@@ -171,7 +172,7 @@ import {
|
|
|
171
172
|
openCodeDbExists,
|
|
172
173
|
withReadOnlySessionDb,
|
|
173
174
|
getMessageTimesFromOpenCodeDb
|
|
174
|
-
} from "./server-
|
|
175
|
+
} from "./server-bx5k66qc.js";
|
|
175
176
|
import {
|
|
176
177
|
removeUnsupportedCommitHashes,
|
|
177
178
|
completedToolArcCrossesBoundary,
|
|
@@ -207,14 +208,14 @@ import {
|
|
|
207
208
|
getRawSessionTagKeysThrough2,
|
|
208
209
|
getLegacyProtectedTailStartOrdinal2,
|
|
209
210
|
readSessionChunk2
|
|
210
|
-
} from "./server-
|
|
211
|
+
} from "./server-db91dxwc.js";
|
|
211
212
|
import {
|
|
212
213
|
clearCompressionDepth,
|
|
213
214
|
clearCompressionDepthRange,
|
|
214
215
|
toMessageIndexSource,
|
|
215
216
|
clearIndexedMessagesInTransaction,
|
|
216
217
|
indexSourcesAfterOrdinal
|
|
217
|
-
} from "./server-
|
|
218
|
+
} from "./server-svccj9rd.js";
|
|
218
219
|
import {
|
|
219
220
|
invalidateAutoEmbedSession
|
|
220
221
|
} from "./server-2amn2s73.js";
|
|
@@ -227,7 +228,7 @@ import {
|
|
|
227
228
|
replaceCompartmentChunkEmbeddings2,
|
|
228
229
|
deleteChunkEmbedBackoffForSession2,
|
|
229
230
|
chunkWindowSourceKey2
|
|
230
|
-
} from "./server-
|
|
231
|
+
} from "./server-zemnpv92.js";
|
|
231
232
|
import {
|
|
232
233
|
isMarkerCandidateBasisCurrent2,
|
|
233
234
|
invalidateMarkerCandidateBasis2,
|
|
@@ -238,18 +239,18 @@ import {
|
|
|
238
239
|
certifiedMarkerReferenceFloor2,
|
|
239
240
|
readMarkerReferenceRows2,
|
|
240
241
|
readKnownMarkerReferenceRows2
|
|
241
|
-
} from "./server-
|
|
242
|
+
} from "./server-379fd3n7.js";
|
|
242
243
|
import {
|
|
243
244
|
shouldSkipHomeProjectMemory,
|
|
244
245
|
resolveProjectIdentity
|
|
245
|
-
} from "./server-
|
|
246
|
+
} from "./server-n33hyq9t.js";
|
|
246
247
|
import {
|
|
247
248
|
contentSha2562,
|
|
248
249
|
enqueueShadowEmbeddingItems2,
|
|
249
250
|
getProjectChunkEmbeddingModelId2,
|
|
250
251
|
getProjectEmbeddingMaxInputTokens2,
|
|
251
252
|
embedItemsWindowBounded2
|
|
252
|
-
} from "./server-
|
|
253
|
+
} from "./server-z5cv5wm5.js";
|
|
253
254
|
import {
|
|
254
255
|
V2_MEMORY_CATEGORIES,
|
|
255
256
|
CATEGORY_PRIORITY,
|
|
@@ -260,7 +261,7 @@ import {
|
|
|
260
261
|
userFacingFailureCode,
|
|
261
262
|
promoteSessionFactsDurable,
|
|
262
263
|
embedPromotedFacts
|
|
263
|
-
} from "./server-
|
|
264
|
+
} from "./server-nnh81jqy.js";
|
|
264
265
|
import {
|
|
265
266
|
computeCueContentHash,
|
|
266
267
|
getMuralCueState,
|
|
@@ -274,7 +275,7 @@ import {
|
|
|
274
275
|
LATEST_SUPPORTED_VERSION,
|
|
275
276
|
getPersistedSchemaVersion,
|
|
276
277
|
openDatabase
|
|
277
|
-
} from "./server-
|
|
278
|
+
} from "./server-vsx9tsks.js";
|
|
278
279
|
import {
|
|
279
280
|
parseCompartmentOutput,
|
|
280
281
|
resolveWorkspaceShareCategories,
|
|
@@ -283,15 +284,15 @@ import {
|
|
|
283
284
|
resolveStoredPathWorkspaceIdentity,
|
|
284
285
|
sourceNameForMemory,
|
|
285
286
|
computeWorkspaceEpochFingerprint
|
|
286
|
-
} from "./server-
|
|
287
|
+
} from "./server-2sare4qg.js";
|
|
287
288
|
import {
|
|
288
289
|
FAIL_CLOSED_DOCTOR_COMMAND
|
|
289
|
-
} from "./server-
|
|
290
|
+
} from "./server-2qvnr3t7.js";
|
|
290
291
|
import {
|
|
291
292
|
getSessionNotes,
|
|
292
293
|
getReadySmartNotes,
|
|
293
294
|
insertPrimerCandidates
|
|
294
|
-
} from "./server-
|
|
295
|
+
} from "./server-5t4nzfpt.js";
|
|
295
296
|
import {
|
|
296
297
|
pushNotification2
|
|
297
298
|
} from "./server-y14pawe1.js";
|
|
@@ -299,10 +300,10 @@ import {
|
|
|
299
300
|
deriveTriggerBudget2,
|
|
300
301
|
resolveHistorianProducerLimits2,
|
|
301
302
|
producerSourceLocalBudget2
|
|
302
|
-
} from "./server-
|
|
303
|
+
} from "./server-rt8t6s2a.js";
|
|
303
304
|
import {
|
|
304
305
|
sendStatusNotification2
|
|
305
|
-
} from "./server-
|
|
306
|
+
} from "./server-2cq3e1c1.js";
|
|
306
307
|
import {
|
|
307
308
|
retreatPastHostUnservedRows,
|
|
308
309
|
snapTerminalCompartmentToServedRow,
|
|
@@ -322,7 +323,7 @@ import {
|
|
|
322
323
|
import {
|
|
323
324
|
logSlowWriteTransaction,
|
|
324
325
|
WriteTransactionSteps
|
|
325
|
-
} from "./server-
|
|
326
|
+
} from "./server-tq523gj6.js";
|
|
326
327
|
import {
|
|
327
328
|
sameProjectDirectory
|
|
328
329
|
} from "./server-knvkbfvh.js";
|
|
@@ -2748,8 +2749,92 @@ function withoutHistorianTailCache(body) {
|
|
|
2748
2749
|
// src/v2/hidden-run-holder.ts
|
|
2749
2750
|
import { createHash as createHash5, randomUUID } from "node:crypto";
|
|
2750
2751
|
import { stat } from "node:fs/promises";
|
|
2752
|
+
|
|
2753
|
+
// src/v2/hidden-child-record.ts
|
|
2754
|
+
function keptUnderRetention(keepSubagents, child) {
|
|
2755
|
+
return keepSubagents && (child.ever_settled === true || child.role === "historian");
|
|
2756
|
+
}
|
|
2757
|
+
function roleTitle(role) {
|
|
2758
|
+
return role === "historian" ? "Magic Context historian" : "Magic Context dreamer";
|
|
2759
|
+
}
|
|
2760
|
+
function roleAgent(role) {
|
|
2761
|
+
if (role === "historian")
|
|
2762
|
+
return HIDDEN_HISTORIAN_AGENT;
|
|
2763
|
+
return role === "dreamer-curate" ? HIDDEN_CURATE_AGENT : HIDDEN_DREAMER_AGENT;
|
|
2764
|
+
}
|
|
2765
|
+
function childCreateInput(identity, role, model) {
|
|
2766
|
+
const agent = hiddenToolLoop(identity) ? hiddenAgentFor(identity) : roleAgent(role);
|
|
2767
|
+
return {
|
|
2768
|
+
title: roleTitle(role),
|
|
2769
|
+
agent,
|
|
2770
|
+
model: {
|
|
2771
|
+
providerID: model.providerID,
|
|
2772
|
+
id: model.modelID,
|
|
2773
|
+
...model.variant ? { variant: model.variant } : {}
|
|
2774
|
+
},
|
|
2775
|
+
location: { directory: identity.directory },
|
|
2776
|
+
metadata: { magic_context: "hidden-run", role },
|
|
2777
|
+
permissions: hiddenChildPermissions(agent, model.providerID)
|
|
2778
|
+
};
|
|
2779
|
+
}
|
|
2780
|
+
function assistantOutcome(row) {
|
|
2781
|
+
const outcome = row?.data.outcome;
|
|
2782
|
+
return outcome === "succeeded" || outcome === "failed" || outcome === "interrupted" ? outcome : undefined;
|
|
2783
|
+
}
|
|
2784
|
+
function withReader(openReader, read) {
|
|
2785
|
+
const reader = openReader();
|
|
2786
|
+
try {
|
|
2787
|
+
return read(reader);
|
|
2788
|
+
} finally {
|
|
2789
|
+
reader.close?.();
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
function errorText(value) {
|
|
2793
|
+
if (value instanceof Error)
|
|
2794
|
+
return value.message;
|
|
2795
|
+
if (typeof value === "string")
|
|
2796
|
+
return value;
|
|
2797
|
+
try {
|
|
2798
|
+
return JSON.stringify(value);
|
|
2799
|
+
} catch {
|
|
2800
|
+
return String(value);
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2804
|
+
// src/v2/hidden-run-holder.ts
|
|
2751
2805
|
var HOLDER_PREFIX = "ses_mc_bg_";
|
|
2752
2806
|
var HOLDER_CANDIDATES = 3;
|
|
2807
|
+
var HOLDER_ARCHIVE_TIMEOUT_MS = 250;
|
|
2808
|
+
var archivingHolders = new Set;
|
|
2809
|
+
var loggedArchiveFailure = false;
|
|
2810
|
+
function supportsHolderArchive(version) {
|
|
2811
|
+
const release = version?.match(/^2\.(\d+)\.(\d+)$/);
|
|
2812
|
+
return !release || Number(release[1]) > 4 || Number(release[1]) === 4 && Number(release[2]) >= 3;
|
|
2813
|
+
}
|
|
2814
|
+
function archiveBackgroundHolder(id, archive) {
|
|
2815
|
+
if (archivingHolders.has(id))
|
|
2816
|
+
return;
|
|
2817
|
+
archivingHolders.add(id);
|
|
2818
|
+
(async () => {
|
|
2819
|
+
let timer;
|
|
2820
|
+
try {
|
|
2821
|
+
await Promise.race([
|
|
2822
|
+
Promise.resolve().then(() => archive.update({ sessionID: id, archived: true })),
|
|
2823
|
+
new Promise((_, reject) => {
|
|
2824
|
+
timer = setTimeout(() => reject(new Error(`session.update timed out after ${HOLDER_ARCHIVE_TIMEOUT_MS}ms`)), HOLDER_ARCHIVE_TIMEOUT_MS);
|
|
2825
|
+
})
|
|
2826
|
+
]);
|
|
2827
|
+
} catch (error) {
|
|
2828
|
+
if (!loggedArchiveFailure) {
|
|
2829
|
+
loggedArchiveFailure = true;
|
|
2830
|
+
archive.log(`[magic-context] could not archive background holder ${id}: ${errorText(error)}`);
|
|
2831
|
+
}
|
|
2832
|
+
} finally {
|
|
2833
|
+
clearTimeout(timer);
|
|
2834
|
+
archivingHolders.delete(id);
|
|
2835
|
+
}
|
|
2836
|
+
})();
|
|
2837
|
+
}
|
|
2753
2838
|
function isHiddenRunHolder(id) {
|
|
2754
2839
|
return id.startsWith(HOLDER_PREFIX);
|
|
2755
2840
|
}
|
|
@@ -2759,7 +2844,7 @@ function supportsQuietHiddenChildren(version) {
|
|
|
2759
2844
|
function matchesHiddenRunLocation(wanted, returned) {
|
|
2760
2845
|
return sameProjectDirectory(wanted, returned ?? "");
|
|
2761
2846
|
}
|
|
2762
|
-
async function hiddenRunPlacement(createHolder, directory, budget) {
|
|
2847
|
+
async function hiddenRunPlacement(createHolder, directory, budget, archive) {
|
|
2763
2848
|
const work = budget?.work ?? ((start) => start());
|
|
2764
2849
|
budget?.setStage("checking the holder directory");
|
|
2765
2850
|
if (!(await work(() => stat(directory))).isDirectory())
|
|
@@ -2778,6 +2863,8 @@ async function hiddenRunPlacement(createHolder, directory, budget) {
|
|
|
2778
2863
|
if (holder.id !== id || holder.parentID)
|
|
2779
2864
|
throw new Error(`OpenCode did not return the expected background holder ${id}`);
|
|
2780
2865
|
if (holder.metadata?.magic_context === "background-holder" && matchesHiddenRunLocation(directory, holder.location?.directory)) {
|
|
2866
|
+
if (archive && holder.time?.archived == null)
|
|
2867
|
+
archiveBackgroundHolder(id, archive);
|
|
2781
2868
|
return { id: `ses_aut_${randomUUID()}`, parentID: id };
|
|
2782
2869
|
}
|
|
2783
2870
|
displaced.push(id);
|
|
@@ -3225,6 +3312,12 @@ class HiddenChildHook {
|
|
|
3225
3312
|
onBudgetUpdate({ ...selected.budget.snapshot(), sessionId: draft.sessionID });
|
|
3226
3313
|
}
|
|
3227
3314
|
}
|
|
3315
|
+
if (selected.budget) {
|
|
3316
|
+
const count = selected.countRequestText ??= createTokenCountMemo(256, 2 * 1024 * 1024);
|
|
3317
|
+
const messageTokens = draft.messages.reduce((total, message) => total + count(JSON.stringify(message.content ?? message.parts) ?? ""), 0);
|
|
3318
|
+
const toolTokens = Object.values(draft.tools).reduce((total, tool) => total + count(tool.description) + count(JSON.stringify(tool.input) ?? ""), 0);
|
|
3319
|
+
(selected.requestTokenEstimates ??= []).push(count(systemText) + messageTokens + toolTokens);
|
|
3320
|
+
}
|
|
3228
3321
|
selected.observedMessages = draft.messages;
|
|
3229
3322
|
selected.shaped = true;
|
|
3230
3323
|
return true;
|
|
@@ -8239,11 +8332,12 @@ function clearDegradedRebuild(sessionId) {
|
|
|
8239
8332
|
degradedRebuildCountBySession.delete(sessionId);
|
|
8240
8333
|
reAnchorLoggedBySession.delete(sessionId);
|
|
8241
8334
|
}
|
|
8242
|
-
function logReanchorOnce(sessionId, message) {
|
|
8335
|
+
function logReanchorOnce(sessionId, message, quiet) {
|
|
8243
8336
|
if (reAnchorLoggedBySession.get(sessionId))
|
|
8244
8337
|
return;
|
|
8245
8338
|
reAnchorLoggedBySession.set(sessionId, true);
|
|
8246
|
-
|
|
8339
|
+
if (!quiet)
|
|
8340
|
+
sessionLog2(sessionId, message);
|
|
8247
8341
|
}
|
|
8248
8342
|
function findVisibleReanchorIndex(compartments, visibleMessageIds) {
|
|
8249
8343
|
for (let index = compartments.length - 1;index >= 0; index -= 1) {
|
|
@@ -8370,7 +8464,9 @@ function cutCoveredPrefix(messages, count, coveredInstructions) {
|
|
|
8370
8464
|
coveredInstructions.push(message);
|
|
8371
8465
|
}
|
|
8372
8466
|
}
|
|
8373
|
-
function prepareCompartmentInjection(db, sessionId, messages, isCacheBusting, coveredInstructions, projectPath, injectionBudgetTokens, temporalAwareness, frozenBaseline) {
|
|
8467
|
+
function prepareCompartmentInjection(db, sessionId, messages, isCacheBusting, coveredInstructions, projectPath, injectionBudgetTokens, temporalAwareness, frozenBaseline, restoredBoundaryDiagnostic) {
|
|
8468
|
+
if (restoredBoundaryDiagnostic)
|
|
8469
|
+
restoredBoundaryDiagnostic.expectedAbsence = false;
|
|
8374
8470
|
const cached = injectionCache.get(sessionId);
|
|
8375
8471
|
if (cached && cached.db !== db) {
|
|
8376
8472
|
clearInjectionCache(sessionId);
|
|
@@ -8516,6 +8612,9 @@ function prepareCompartmentInjection(db, sessionId, messages, isCacheBusting, co
|
|
|
8516
8612
|
resultEndMessageId = trimEndMessageId;
|
|
8517
8613
|
resultEndMessagePartial = trimEndMessagePartial;
|
|
8518
8614
|
} else {
|
|
8615
|
+
const quiet = restoredBoundaryDiagnostic?.restoredAfterId === trimEndMessageId;
|
|
8616
|
+
if (restoredBoundaryDiagnostic)
|
|
8617
|
+
restoredBoundaryDiagnostic.expectedAbsence = quiet;
|
|
8519
8618
|
const degradedCount = noteDegradedRebuild(sessionId);
|
|
8520
8619
|
if (isCacheBusting) {
|
|
8521
8620
|
reconcileForkOrphanedCompactionMarkers(db, sessionId, isCacheBusting);
|
|
@@ -8538,14 +8637,14 @@ function prepareCompartmentInjection(db, sessionId, messages, isCacheBusting, co
|
|
|
8538
8637
|
resultEndMessage = reAnchorCompartment.endMessage;
|
|
8539
8638
|
resultEndMessageId = reAnchorCompartment.endMessageId;
|
|
8540
8639
|
reAnchored = true;
|
|
8541
|
-
logReanchorOnce(sessionId, `compartment injection re-anchored: natural boundary ${trimEndMessageId} not visible for ${degradedCount} passes; splicing at visible compartment boundary ${resultEndMessageId} (ordinal ${resultEndMessage})
|
|
8640
|
+
logReanchorOnce(sessionId, `compartment injection re-anchored: natural boundary ${trimEndMessageId} not visible for ${degradedCount} passes; splicing at visible compartment boundary ${resultEndMessageId} (ordinal ${resultEndMessage})`, quiet);
|
|
8542
8641
|
}
|
|
8543
8642
|
}
|
|
8544
8643
|
if (!reAnchored) {
|
|
8545
8644
|
needsFreshMaterialization = true;
|
|
8546
|
-
logReanchorOnce(sessionId, `compartment injection degraded: boundary ${trimEndMessageId} not visible for ${degradedCount} passes and no compartment boundary is visible; requesting fresh materialization to re-cut the baseline
|
|
8645
|
+
logReanchorOnce(sessionId, `compartment injection degraded: boundary ${trimEndMessageId} not visible for ${degradedCount} passes and no compartment boundary is visible; requesting fresh materialization to re-cut the baseline`, quiet);
|
|
8547
8646
|
}
|
|
8548
|
-
} else {
|
|
8647
|
+
} else if (!quiet) {
|
|
8549
8648
|
sessionLog2(sessionId, `compartment injection entering degraded mode: boundary ${trimEndMessageId} not in visible messages (consecutive degraded passes: ${degradedCount})`);
|
|
8550
8649
|
}
|
|
8551
8650
|
}
|
|
@@ -17062,4 +17161,4 @@ ${failure}`;
|
|
|
17062
17161
|
}
|
|
17063
17162
|
}
|
|
17064
17163
|
|
|
17065
|
-
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,
|
|
17164
|
+
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, keptUnderRetention, roleTitle, childCreateInput, assistantOutcome, withReader, errorText, supportsHolderArchive, supportsQuietHiddenChildren, matchesHiddenRunLocation, hiddenRunPlacement, HIDDEN_CURATE_AGENT, hiddenToolLoop, HIDDEN_RUN_DISPOSED_REASON, noteChildOfDisposedInstance, noteTimedOutHiddenChild, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, isLatestAssistantLengthCapped, parseProviderModel, modelBodyField, toModelEntry, hiddenModelCooldowns, ModelProducedNoOutputError, promptTransportBudget, notePromptSetupTimeout, 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, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, reportProviderRecoveryDrainSkip, isHistorianDrainBudgetSpent, readHistorianFailureStreak, describeHistorianJoinRefusal, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, clearNoteNudgeTriggerOnly, noteTransformPassForExactOrdinalReads, nonNarrativeStoredGapRanges, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };
|
|
@@ -5,17 +5,17 @@ import {
|
|
|
5
5
|
getDataDir,
|
|
6
6
|
log2,
|
|
7
7
|
sessionLog2
|
|
8
|
-
} from "./server-
|
|
8
|
+
} from "./server-kzrrdjp5.js";
|
|
9
9
|
import {
|
|
10
10
|
inRootAsyncContext2,
|
|
11
11
|
withSqliteBackgroundWriter2
|
|
12
12
|
} from "./server-gzy5w8ya.js";
|
|
13
13
|
import {
|
|
14
14
|
scheduleAfterBootQuiet
|
|
15
|
-
} from "./server-
|
|
15
|
+
} from "./server-n33hyq9t.js";
|
|
16
16
|
import {
|
|
17
17
|
isRecord
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-11ra1pmx.js";
|
|
19
19
|
import {
|
|
20
20
|
cleanSearchText,
|
|
21
21
|
hintKeywordRelevance,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
isMessageIndexReconciledThrough,
|
|
26
26
|
clearIndexedMessages,
|
|
27
27
|
indexMessagesAfterOrdinal
|
|
28
|
-
} from "./server-
|
|
28
|
+
} from "./server-svccj9rd.js";
|
|
29
29
|
import {
|
|
30
30
|
Priority,
|
|
31
31
|
AdmissionClass,
|
|
@@ -34,14 +34,14 @@ import {
|
|
|
34
34
|
StaleRouteHandleError,
|
|
35
35
|
SubcClient,
|
|
36
36
|
isConsumerReconnectTransient
|
|
37
|
-
} from "./server-
|
|
37
|
+
} from "./server-k3ntgf6n.js";
|
|
38
38
|
import {
|
|
39
39
|
buildCanonicalChunkTextFromFts2,
|
|
40
40
|
loadCompartmentChunkEmbeddingsForSearch2,
|
|
41
41
|
trackCompartmentChunkSearchPool2,
|
|
42
42
|
peekCompartmentChunkSearchPool2,
|
|
43
43
|
warmCompartmentChunkSearchPool2
|
|
44
|
-
} from "./server-
|
|
44
|
+
} from "./server-zemnpv92.js";
|
|
45
45
|
import {
|
|
46
46
|
saveCommitEmbedding,
|
|
47
47
|
loadProjectCommitEmbeddings,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
enqueueShadowEmbeddingItems2,
|
|
58
58
|
getProjectEmbeddingSnapshot2,
|
|
59
59
|
embedItemsForProject2
|
|
60
|
-
} from "./server-
|
|
60
|
+
} from "./server-z5cv5wm5.js";
|
|
61
61
|
import {
|
|
62
62
|
recordEmbeddingMeasurement
|
|
63
63
|
} from "./server-2amn2s73.js";
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
sanitizeFtsQuery,
|
|
74
74
|
searchMemoriesFTS,
|
|
75
75
|
searchMemoriesFTSUnion
|
|
76
|
-
} from "./server-
|
|
76
|
+
} from "./server-nnh81jqy.js";
|
|
77
77
|
import {
|
|
78
78
|
ModuleMemoryAuthorityError2,
|
|
79
79
|
getMemoriesByProject2,
|
|
@@ -82,23 +82,23 @@ import {
|
|
|
82
82
|
} from "./server-9emdjcb5.js";
|
|
83
83
|
import {
|
|
84
84
|
ensureMemoryEmbeddings2
|
|
85
|
-
} from "./server-
|
|
85
|
+
} from "./server-ganavh75.js";
|
|
86
86
|
import {
|
|
87
87
|
MESSAGE_FTS_SESSION_FILTER_SQL,
|
|
88
88
|
withMessageFtsSessionFilter,
|
|
89
89
|
messageTextVisibleInRequestSql
|
|
90
|
-
} from "./server-
|
|
90
|
+
} from "./server-j1gxs1gj.js";
|
|
91
91
|
import {
|
|
92
92
|
resolveWorkspaceShareCategories,
|
|
93
93
|
resolveWorkspaceIdentitySet,
|
|
94
94
|
expandWorkspaceIdentitySetWithAliases,
|
|
95
95
|
resolveStoredPathWorkspaceIdentity,
|
|
96
96
|
sourceNameForMemory
|
|
97
|
-
} from "./server-
|
|
97
|
+
} from "./server-2sare4qg.js";
|
|
98
98
|
import {
|
|
99
99
|
getNotes,
|
|
100
100
|
getActivePrimers
|
|
101
|
-
} from "./server-
|
|
101
|
+
} from "./server-5t4nzfpt.js";
|
|
102
102
|
import {
|
|
103
103
|
isKnownAutocommit
|
|
104
104
|
} from "./server-8ajstryz.js";
|
|
@@ -1850,13 +1850,15 @@ function truncateUtf8(text, bytes) {
|
|
|
1850
1850
|
end--;
|
|
1851
1851
|
return buffer.subarray(0, end).toString("utf8");
|
|
1852
1852
|
}
|
|
1853
|
-
function candidateText(location, title, body) {
|
|
1853
|
+
function candidateText(location, title, body, historyQuery) {
|
|
1854
1854
|
const header = `${truncateUtf8(location.replaceAll(`
|
|
1855
1855
|
`, " "), 200)}
|
|
1856
1856
|
${truncateUtf8(title.replaceAll(`
|
|
1857
1857
|
`, " "), 120)}
|
|
1858
1858
|
`;
|
|
1859
|
-
|
|
1859
|
+
const bodyBytes = DOCUMENT_BYTES - Buffer.byteLength(header);
|
|
1860
|
+
const passage = historyQuery && Buffer.byteLength(body) > bodyBytes ? matchedSearchSnippet(body, historyQuery, bodyBytes) || body : body;
|
|
1861
|
+
return header + truncateUtf8(passage, bodyBytes);
|
|
1860
1862
|
}
|
|
1861
1863
|
|
|
1862
1864
|
class RerankFailure extends Error {
|
|
@@ -2067,7 +2069,7 @@ async function rerankSearchResults(session, query, baseline, pool, texts, limit,
|
|
|
2067
2069
|
return baseline;
|
|
2068
2070
|
}
|
|
2069
2071
|
}
|
|
2070
|
-
function candidateTexts(db, sessionId, projectPath, pool) {
|
|
2072
|
+
function candidateTexts(db, sessionId, projectPath, pool, query) {
|
|
2071
2073
|
return pool.map((hit) => {
|
|
2072
2074
|
const id = searchResultKey(hit).split(":").slice(1).join(":");
|
|
2073
2075
|
let location = `${hit.source} ${id} ${projectPath}`;
|
|
@@ -2122,7 +2124,8 @@ Reason: ${row.reason}` : ""}`;
|
|
|
2122
2124
|
break;
|
|
2123
2125
|
}
|
|
2124
2126
|
}
|
|
2125
|
-
|
|
2127
|
+
const historyQuery = hit.source === "message" || hit.source === "compartment" ? query : undefined;
|
|
2128
|
+
return candidateText(location, title, body, historyQuery);
|
|
2126
2129
|
});
|
|
2127
2130
|
}
|
|
2128
2131
|
|
|
@@ -2510,6 +2513,21 @@ function getMessageOrdinal(value) {
|
|
|
2510
2513
|
}
|
|
2511
2514
|
return null;
|
|
2512
2515
|
}
|
|
2516
|
+
var EXPLICIT_MEMORY_BACKFILL_WAIT_MS = 5000;
|
|
2517
|
+
async function waitForMemoryBackfill(args, explicitSearch) {
|
|
2518
|
+
const backfill = ensureMemoryEmbeddings2(args);
|
|
2519
|
+
if (!explicitSearch)
|
|
2520
|
+
return backfill;
|
|
2521
|
+
let timer;
|
|
2522
|
+
try {
|
|
2523
|
+
const deadline = new Promise((resolve) => {
|
|
2524
|
+
timer = setTimeout(() => resolve(args.existingEmbeddings), EXPLICIT_MEMORY_BACKFILL_WAIT_MS);
|
|
2525
|
+
});
|
|
2526
|
+
return await Promise.race([backfill, deadline]);
|
|
2527
|
+
} finally {
|
|
2528
|
+
clearTimeout(timer);
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2513
2531
|
async function getSemanticScores(args) {
|
|
2514
2532
|
const semanticScores = new Map;
|
|
2515
2533
|
if (!args.queryEmbedding || args.memories.length === 0 || !args.queryModelId || args.queryModelId === "off") {
|
|
@@ -2518,13 +2536,13 @@ async function getSemanticScores(args) {
|
|
|
2518
2536
|
const expectedEmbedding = { modelId: args.queryModelId, generation: args.queryGeneration };
|
|
2519
2537
|
if (!args.workspace?.isWorkspaced) {
|
|
2520
2538
|
const cachedEmbeddings = getProjectEmbeddings2(args.db, args.projectPath, args.queryModelId);
|
|
2521
|
-
const embeddings = args.backfillMemoryEmbeddings === false ? cachedEmbeddings : await
|
|
2539
|
+
const embeddings = args.backfillMemoryEmbeddings === false ? cachedEmbeddings : await waitForMemoryBackfill({
|
|
2522
2540
|
db: args.db,
|
|
2523
2541
|
projectIdentity: args.projectPath,
|
|
2524
2542
|
memories: args.memories,
|
|
2525
2543
|
existingEmbeddings: cachedEmbeddings,
|
|
2526
2544
|
expectedEmbedding
|
|
2527
|
-
});
|
|
2545
|
+
}, args.explicitSearch);
|
|
2528
2546
|
for (const memory of args.memories) {
|
|
2529
2547
|
const memoryEmbedding = embeddings.get(memory.id);
|
|
2530
2548
|
if (!memoryEmbedding || memoryEmbedding.modelId !== args.queryModelId) {
|
|
@@ -2547,13 +2565,13 @@ async function getSemanticScores(args) {
|
|
|
2547
2565
|
const ownMemories = memoriesByIdentity.get(args.projectPath) ?? [];
|
|
2548
2566
|
if (ownMemories.length > 0 && args.backfillMemoryEmbeddings !== false) {
|
|
2549
2567
|
const ownEmbeddings = getProjectEmbeddings2(args.db, args.projectPath, args.queryModelId);
|
|
2550
|
-
await
|
|
2568
|
+
await waitForMemoryBackfill({
|
|
2551
2569
|
db: args.db,
|
|
2552
2570
|
projectIdentity: args.projectPath,
|
|
2553
2571
|
memories: ownMemories,
|
|
2554
2572
|
existingEmbeddings: ownEmbeddings,
|
|
2555
2573
|
expectedEmbedding
|
|
2556
|
-
});
|
|
2574
|
+
}, args.explicitSearch);
|
|
2557
2575
|
}
|
|
2558
2576
|
for (const identity of workspace.identities) {
|
|
2559
2577
|
const memberMemories = memoriesByIdentity.get(identity) ?? [];
|
|
@@ -2673,6 +2691,7 @@ async function searchMemories(args) {
|
|
|
2673
2691
|
projectPath: args.projectPath,
|
|
2674
2692
|
memories: semanticCandidates,
|
|
2675
2693
|
backfillMemoryEmbeddings: args.backfillMemoryEmbeddings,
|
|
2694
|
+
explicitSearch: args.explicitSearch,
|
|
2676
2695
|
queryEmbedding: args.queryEmbedding,
|
|
2677
2696
|
queryModelId: args.queryModelId,
|
|
2678
2697
|
queryGeneration: args.queryGeneration,
|
|
@@ -3598,6 +3617,7 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
|
|
|
3598
3617
|
visibleMemoryIds: options.visibleMemoryIds,
|
|
3599
3618
|
suppressionLimit: options.diagnostics && options.visibleMemoryIds?.size ? limit : undefined,
|
|
3600
3619
|
backfillMemoryEmbeddings: options.backfillMemoryEmbeddings,
|
|
3620
|
+
explicitSearch: options.explicitSearch,
|
|
3601
3621
|
lanes,
|
|
3602
3622
|
dateRange
|
|
3603
3623
|
}) : Promise.resolve({
|
|
@@ -3660,7 +3680,7 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
|
|
|
3660
3680
|
if (reranker && lanes) {
|
|
3661
3681
|
const pool = fuseSearchLanes(lanes).slice(0, "remote" in reranker ? reranker.remote.top_n : 20);
|
|
3662
3682
|
try {
|
|
3663
|
-
results = await rerankSearchResults(reranker, trimmedQuery, results, pool, candidateTexts(db, sessionId, projectPath, pool), limit, options.signal, options.onRerankSkipped);
|
|
3683
|
+
results = await rerankSearchResults(reranker, trimmedQuery, results, pool, candidateTexts(db, sessionId, projectPath, pool, trimmedQuery), limit, options.signal, options.onRerankSkipped);
|
|
3664
3684
|
} catch {
|
|
3665
3685
|
if ("remote" in reranker)
|
|
3666
3686
|
remoteRerankSkipped("candidate_validation", options.onRerankSkipped);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-arfzfxe8.js";
|
|
4
4
|
import {
|
|
5
5
|
embedPauseBySession,
|
|
6
6
|
activeEmbeddingSessions,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./server-gzy5w8ya.js";
|
|
16
16
|
import {
|
|
17
17
|
setBootQuietPeriodForTests
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-n33hyq9t.js";
|
|
19
19
|
import {
|
|
20
20
|
isEmbeddingHostBusy2
|
|
21
21
|
} from "./server-qt1qqasc.js";
|
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
} from "./server-pavzsdc6.js";
|
|
25
25
|
import {
|
|
26
26
|
log2
|
|
27
|
-
} from "./server-
|
|
27
|
+
} from "./server-kzrrdjp5.js";
|
|
28
28
|
import {
|
|
29
29
|
sanitizeDiagnosticText
|
|
30
|
-
} from "./server-
|
|
30
|
+
} from "./server-dt7cyqfe.js";
|
|
31
31
|
import {
|
|
32
32
|
reuseWorker
|
|
33
33
|
} from "./server-96ztjvkn.js";
|
|
@@ -39,10 +39,10 @@ import {
|
|
|
39
39
|
isSynapseEmbeddingTruncated,
|
|
40
40
|
getSynapseBatchRequestKey,
|
|
41
41
|
SynapseEmbeddingProvider
|
|
42
|
-
} from "./server-
|
|
42
|
+
} from "./server-k3ntgf6n.js";
|
|
43
43
|
import {
|
|
44
44
|
estimateTokens
|
|
45
|
-
} from "./server-
|
|
45
|
+
} from "./server-73bqw5c0.js";
|
|
46
46
|
import {
|
|
47
47
|
DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2,
|
|
48
48
|
CHUNK_WINDOW_SAFETY_RATIO2,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
countSessionCompartmentEmbedCoverage2,
|
|
61
61
|
countSessionCompartmentEmbedCoveragePolite2,
|
|
62
62
|
countUnembeddedSessionCompartmentsPolite2
|
|
63
|
-
} from "./server-
|
|
63
|
+
} from "./server-zemnpv92.js";
|
|
64
64
|
import {
|
|
65
65
|
acquireGitSweepLease,
|
|
66
66
|
renewGitSweepLease,
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
findMisScopedCompartmentChunkEmbeddingIdsForProject,
|
|
69
69
|
recordSessionProjectIdentity,
|
|
70
70
|
repairMisScopedCompartmentChunkEmbeddingsForProject
|
|
71
|
-
} from "./server-
|
|
71
|
+
} from "./server-6qax5pds.js";
|
|
72
72
|
import {
|
|
73
73
|
saveEmbeddingIfHashMatches,
|
|
74
74
|
getMemoryEmbedCoverage,
|
|
@@ -83,13 +83,13 @@ import {
|
|
|
83
83
|
logLocalEmbeddingPoolingUnavailableOnce,
|
|
84
84
|
getEmbeddingProviderIdentity,
|
|
85
85
|
LocalEmbeddingProvider
|
|
86
|
-
} from "./server-
|
|
86
|
+
} from "./server-7h4gwphm.js";
|
|
87
87
|
import {
|
|
88
88
|
isKnownAutocommit
|
|
89
89
|
} from "./server-8ajstryz.js";
|
|
90
90
|
import {
|
|
91
91
|
logSlowWriteTransaction
|
|
92
|
-
} from "./server-
|
|
92
|
+
} from "./server-tq523gj6.js";
|
|
93
93
|
|
|
94
94
|
// src/features/magic-context/project-embedding-registry.ts
|
|
95
95
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|