@cortexkit/opencode-magic-context 0.49.93 → 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-rp4asvk0.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-jpxthqxg.js → context-gtjdrp8f.js} +237 -140
- 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/compartment-storage.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts +5 -2
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -1
- 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/history-gap-recovery.d.ts +42 -0
- package/dist/features/magic-context/history-gap-recovery.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-synapse.d.ts +18 -5
- package/dist/features/magic-context/memory/embedding-synapse.d.ts.map +1 -1
- package/dist/features/magic-context/message-visibility.d.ts +10 -0
- package/dist/features/magic-context/message-visibility.d.ts.map +1 -0
- 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 +4 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/session-decision-calibration.d.ts.map +1 -1
- package/dist/features/magic-context/session-project-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -1
- package/dist/{history-owner-xqfsvf9k.js → history-owner-74826t4n.js} +3 -3
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/history-boundary-repair.d.ts +2 -2
- package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -1
- 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/lkg-persist.d.ts +3 -1
- package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts +1 -0
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts +3 -0
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts +1 -0
- package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
- package/dist/hooks/magic-context/tail-hygiene-output-count.d.ts +4 -0
- package/dist/hooks/magic-context/tail-hygiene-output-count.d.ts.map +1 -1
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +2 -0
- package/dist/hooks/magic-context/tail-hygiene-walk.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-stage-logger.d.ts +6 -0
- package/dist/hooks/magic-context/transform-stage-logger.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-5zrzg8r1.js → index-0bjj9yf3.js} +2 -2
- package/dist/{index-g9qtxv87.js → index-0sqhg9nf.js} +132 -64
- package/dist/{index-nxxzeq4y.js → index-0ve29s6f.js} +1 -1
- package/dist/{index-g6y2wk32.js → index-2afrmgy3.js} +6 -6
- 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-n9kd68vc.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-pnawfv4e.js → index-89bkkgcn.js} +4 -4
- package/dist/{index-s32f8y67.js → index-89xg64wb.js} +2 -2
- package/dist/{index-hee64h6k.js → index-8sgv96kq.js} +7 -7
- package/dist/{index-ttdk2w0z.js → index-910gahfb.js} +6 -6
- package/dist/{index-kty5k23y.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-g5c67kay.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-j2w79s9r.js → index-e6ay1gez.js} +2 -2
- package/dist/{index-y2vshk67.js → index-f154w8m4.js} +229 -84
- package/dist/{index-6r99v53h.js → index-fgw241hh.js} +164 -62
- package/dist/{index-rz47hf2m.js → index-fvfnq8n6.js} +30 -14
- package/dist/{index-yqha238s.js → index-gnrwgvn7.js} +127 -17
- package/dist/{index-fpjnjxyx.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-dr6bd4c8.js → index-hp46xe93.js} +7 -7
- package/dist/{index-0twg41mh.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-mgy7g740.js +119 -0
- package/dist/{index-za1yx1m4.js → index-nqdwpdje.js} +154 -32
- package/dist/{index-hes3k87g.js → index-r1d45dsr.js} +4 -4
- package/dist/{index-y915t3ey.js → index-r3f85n7y.js} +5 -1
- package/dist/{index-1kem0xxx.js → index-t2e10rag.js} +5 -5
- package/dist/{index-m0pwswv9.js → index-tqtpgnhr.js} +1 -1
- package/dist/{index-01h7tqe3.js → index-tr4ep2ej.js} +21 -6
- package/dist/{index-xr1t0fxb.js → index-w7n7qkpf.js} +49 -13
- package/dist/{index-s7460efs.js → index-zfx7mtqa.js} +1 -1
- package/dist/{index-gqfy38m9.js → index-zkjx8gq3.js} +11 -11
- package/dist/{index-et39x9k3.js → index-zmgp0tr6.js} +3 -3
- package/dist/index.js +59 -56
- 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-vjrnptar.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-m8zcmrsg.js → project-embedding-registry-e566q4bg.js} +15 -15
- package/dist/raw-ordinal-warmup-worker.js +9 -9
- package/dist/{read-session-chunk-zkzdc0e5.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-d3rbpa59.js +69 -0
- package/dist/render-6cf1dgc4.js +43 -0
- package/dist/{safe-notification-target-d21swr3n.js → safe-notification-target-54ns7dv9.js} +3 -3
- package/dist/{search-e9bb9hpx.js → search-11aw8wpq.js} +27 -27
- package/dist/search-archive-s9m5szf0.js +29 -0
- 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/shared/storage-file-mutex.d.ts.map +1 -1
- package/dist/{storage-tags-gk7gjkqt.js → storage-tags-jq0c0zsn.js} +7 -7
- package/dist/{store-yr443ye8.js → store-29ksp6vy.js} +4 -4
- package/dist/{store-reader-qbq6q4v0.js → store-reader-dgh3ssxx.js} +1 -1
- package/dist/tools/ctx-expand/search-archive.d.ts +3 -2
- package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -1
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/tools/ctx-expand/v2-archive-reader.d.ts +2 -0
- package/dist/tools/ctx-expand/v2-archive-reader.d.ts.map +1 -1
- package/dist/tools/ctx-search/tools.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-neds90e3.js → transform-postprocess-phase-376xn40x.js} +35 -35
- 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-w7ht0t9v.js → compartment-chunk-embedding-jthtfhcd.js} +8 -8
- package/dist/v2/{context-ctsd80vc.js → context-vm09agrs.js} +426 -185
- 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/memory-cache.d.ts +2 -0
- package/dist/v2/fold/memory-cache.d.ts.map +1 -1
- package/dist/v2/fold/native-replay.d.ts +23 -5
- 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/hooks/revert-message-state.d.ts.map +1 -1
- package/dist/v2/hooks/session-project-backfill.d.ts +2 -1
- package/dist/v2/hooks/session-project-backfill.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-1vew9c37.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-je5jam7y.js → project-embedding-registry-z05xvckg.js} +15 -15
- package/dist/v2/raw-ordinal-warmup-worker.js +9 -9
- package/dist/v2/{read-session-chunk-09sre4xv.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-gmye6n25.js → search-35cz80x0.js} +26 -26
- package/dist/v2/search-archive-5dpxv0ck.js +29 -0
- package/dist/v2/{send-session-notification-v69y04f5.js → send-session-notification-8x146x5y.js} +6 -6
- package/dist/v2/{server-z9czv2vb.js → server-11ra1pmx.js} +49 -13
- 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-6chcnnhq.js → server-7h4gwphm.js} +4 -4
- package/dist/v2/{server-rkj44mez.js → server-7tj8yzrv.js} +2 -2
- 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-dgsjamm4.js → server-db91dxwc.js} +7 -7
- package/dist/v2/{server-z4p0ry94.js → server-dt7cyqfe.js} +2 -1
- package/dist/v2/{server-k1xc2bw1.js → server-ganavh75.js} +2 -2
- package/dist/v2/{server-6x40bnb7.js → server-gh2w75fn.js} +3 -3
- package/dist/v2/server-j1gxs1gj.js +119 -0
- package/dist/v2/{server-ps6zrzwj.js → server-k3ntgf6n.js} +164 -62
- 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-vc5fta6s.js → server-nnh81jqy.js} +6 -6
- package/dist/v2/{server-g53asaqt.js → server-pcq2d1wh.js} +30 -14
- package/dist/v2/{server-bnkc9kph.js → server-ppy2dj7g.js} +6 -6
- 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-2xm0gxke.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-4ecpanyn.js → server-vntc961c.js} +127 -17
- package/dist/v2/{server-btgnkr9z.js → server-vsx9tsks.js} +11 -11
- package/dist/v2/{server-vtgeyhq6.js → server-vtkbxzw1.js} +21 -6
- package/dist/v2/{server-cvp9w5gs.js → server-w35ep6wn.js} +192 -84
- package/dist/v2/{server-myp4pc6x.js → server-z2nv8jdv.js} +132 -64
- package/dist/v2/{server-pcarsvj2.js → server-z5cv5wm5.js} +10 -10
- package/dist/v2/{server-barj0mjz.js → server-zemnpv92.js} +4 -4
- package/dist/v2/server.js +9 -9
- package/dist/v2/{storage-tags-nccqr0kr.js → storage-tags-pcenytad.js} +7 -7
- package/dist/v2/{store-enef5jcn.js → store-gx19qc3a.js} +4 -4
- package/dist/v2/{store-reader-jbaqv1yp.js → store-reader-qt2msa8z.js} +1 -1
- package/dist/v2/store-reader.d.ts +1 -1
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{v2-archive-reader-7vmng8q7.js → v2-archive-reader-jqrwz7b8.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-7r4y0bf6.js → wrapup-orchestrator-kcq3cv7y.js} +35 -35
- package/dist/{v2-archive-reader-7s90gfax.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/src/shared/storage-file-mutex-review.test.ts +110 -0
- package/src/shared/storage-file-mutex.ts +12 -0
- package/dist/embedding-backfill-6wzc4p2n.js +0 -29
- package/dist/index-52x68mj4.js +0 -58
- package/dist/recomp-orchestrator-qb2hymj5.js +0 -69
- package/dist/render-34p0kek8.js +0 -43
- package/dist/search-archive-08ppk0q5.js +0 -27
- package/dist/v2/embedding-backfill-40g0anxh.js +0 -29
- package/dist/v2/recomp-orchestrator-mgcty3we.js +0 -69
- package/dist/v2/render-ygcmyn9x.js +0 -43
- package/dist/v2/search-archive-nrsqqmk5.js +0 -27
- package/dist/v2/server-52x68mj4.js +0 -58
- package/dist/wrapup-orchestrator-m2p89973.js +0 -56
|
@@ -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,22 +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
|
-
withMessageFtsSessionFilter
|
|
89
|
-
|
|
88
|
+
withMessageFtsSessionFilter,
|
|
89
|
+
messageTextVisibleInRequestSql
|
|
90
|
+
} from "./server-j1gxs1gj.js";
|
|
90
91
|
import {
|
|
91
92
|
resolveWorkspaceShareCategories,
|
|
92
93
|
resolveWorkspaceIdentitySet,
|
|
93
94
|
expandWorkspaceIdentitySetWithAliases,
|
|
94
95
|
resolveStoredPathWorkspaceIdentity,
|
|
95
96
|
sourceNameForMemory
|
|
96
|
-
} from "./server-
|
|
97
|
+
} from "./server-2sare4qg.js";
|
|
97
98
|
import {
|
|
98
99
|
getNotes,
|
|
99
100
|
getActivePrimers
|
|
100
|
-
} from "./server-
|
|
101
|
+
} from "./server-5t4nzfpt.js";
|
|
101
102
|
import {
|
|
102
103
|
isKnownAutocommit
|
|
103
104
|
} from "./server-8ajstryz.js";
|
|
@@ -1849,13 +1850,15 @@ function truncateUtf8(text, bytes) {
|
|
|
1849
1850
|
end--;
|
|
1850
1851
|
return buffer.subarray(0, end).toString("utf8");
|
|
1851
1852
|
}
|
|
1852
|
-
function candidateText(location, title, body) {
|
|
1853
|
+
function candidateText(location, title, body, historyQuery) {
|
|
1853
1854
|
const header = `${truncateUtf8(location.replaceAll(`
|
|
1854
1855
|
`, " "), 200)}
|
|
1855
1856
|
${truncateUtf8(title.replaceAll(`
|
|
1856
1857
|
`, " "), 120)}
|
|
1857
1858
|
`;
|
|
1858
|
-
|
|
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);
|
|
1859
1862
|
}
|
|
1860
1863
|
|
|
1861
1864
|
class RerankFailure extends Error {
|
|
@@ -2066,7 +2069,7 @@ async function rerankSearchResults(session, query, baseline, pool, texts, limit,
|
|
|
2066
2069
|
return baseline;
|
|
2067
2070
|
}
|
|
2068
2071
|
}
|
|
2069
|
-
function candidateTexts(db, sessionId, projectPath, pool) {
|
|
2072
|
+
function candidateTexts(db, sessionId, projectPath, pool, query) {
|
|
2070
2073
|
return pool.map((hit) => {
|
|
2071
2074
|
const id = searchResultKey(hit).split(":").slice(1).join(":");
|
|
2072
2075
|
let location = `${hit.source} ${id} ${projectPath}`;
|
|
@@ -2121,7 +2124,8 @@ Reason: ${row.reason}` : ""}`;
|
|
|
2121
2124
|
break;
|
|
2122
2125
|
}
|
|
2123
2126
|
}
|
|
2124
|
-
|
|
2127
|
+
const historyQuery = hit.source === "message" || hit.source === "compartment" ? query : undefined;
|
|
2128
|
+
return candidateText(location, title, body, historyQuery);
|
|
2125
2129
|
});
|
|
2126
2130
|
}
|
|
2127
2131
|
|
|
@@ -2146,6 +2150,7 @@ var messageSearchDiagnosticStatements = new WeakMap;
|
|
|
2146
2150
|
var sessionFirstMessageSearchDiagnosticStatements = new WeakMap;
|
|
2147
2151
|
var messageSearchDiagnosticStatementsWithDateRange = new WeakMap;
|
|
2148
2152
|
var batchedMessageSearchStatements = new WeakMap;
|
|
2153
|
+
var visibilityFtsStatements = new WeakMap;
|
|
2149
2154
|
var batchedFtsCountStatements = new WeakMap;
|
|
2150
2155
|
function createUnifiedSearchDiagnostics2() {
|
|
2151
2156
|
return {
|
|
@@ -2165,6 +2170,7 @@ function searchMessageHistory2(db, request) {
|
|
|
2165
2170
|
query: request.query,
|
|
2166
2171
|
limit: request.limit,
|
|
2167
2172
|
maxOrdinal: request.maxOrdinal,
|
|
2173
|
+
includeDroppedTailMessages: request.includeDroppedTailMessages,
|
|
2168
2174
|
probes: request.probes,
|
|
2169
2175
|
relaxedRecall: request.relaxedRecall,
|
|
2170
2176
|
diagnostics,
|
|
@@ -2404,6 +2410,46 @@ function getMessageSearchDiagnosticStatementWithDateRange(db) {
|
|
|
2404
2410
|
}
|
|
2405
2411
|
return statement;
|
|
2406
2412
|
}
|
|
2413
|
+
var MESSAGE_FTS_VISIBLE = messageTextVisibleInRequestSql("message_history_fts.session_id", "message_history_fts.message_id", "CAST(message_history_fts.message_ordinal AS INTEGER)", "?");
|
|
2414
|
+
function getVisibilityFtsStatement(db, sessionFirst, dated, diagnostics) {
|
|
2415
|
+
let statements = visibilityFtsStatements.get(db);
|
|
2416
|
+
if (!statements) {
|
|
2417
|
+
statements = new Map;
|
|
2418
|
+
visibilityFtsStatements.set(db, statements);
|
|
2419
|
+
}
|
|
2420
|
+
const key = `${sessionFirst}:${dated}:${diagnostics}`;
|
|
2421
|
+
let statement = statements.get(key);
|
|
2422
|
+
if (statement)
|
|
2423
|
+
return statement;
|
|
2424
|
+
const from = `FROM message_history_fts${dated ? `
|
|
2425
|
+
JOIN message_fts_rowid_map AS map
|
|
2426
|
+
ON map.session_id = message_history_fts.session_id
|
|
2427
|
+
AND map.fts_rowid = message_history_fts.rowid` : ""}
|
|
2428
|
+
WHERE ${sessionFirst || dated ? MESSAGE_FTS_SESSION_FILTER_SQL : ""}message_history_fts.session_id = ?
|
|
2429
|
+
AND message_history_fts MATCH ?${dated ? " AND map.message_time_ms BETWEEN ? AND ?" : ""}`;
|
|
2430
|
+
const columns = `message_history_fts.message_ordinal AS messageOrdinal,
|
|
2431
|
+
message_history_fts.message_id AS messageId, message_history_fts.role AS role,
|
|
2432
|
+
message_history_fts.content AS content, bm25(message_history_fts) AS ftsRank`;
|
|
2433
|
+
statement = db.prepare(diagnostics ? `
|
|
2434
|
+
WITH matches AS MATERIALIZED (
|
|
2435
|
+
SELECT ${columns}, ${MESSAGE_FTS_VISIBLE} AS visible ${from}
|
|
2436
|
+
), eligible AS (
|
|
2437
|
+
SELECT * FROM matches WHERE NOT visible
|
|
2438
|
+
ORDER BY ftsRank, CAST(messageOrdinal AS INTEGER) LIMIT ?
|
|
2439
|
+
), summary AS (
|
|
2440
|
+
SELECT COUNT(*) AS suppressedCount FROM matches WHERE visible
|
|
2441
|
+
)
|
|
2442
|
+
SELECT messageOrdinal, messageId, role, content, ftsRank, suppressedCount, 0 AS summaryOnly
|
|
2443
|
+
FROM eligible CROSS JOIN summary
|
|
2444
|
+
UNION ALL
|
|
2445
|
+
SELECT NULL, NULL, NULL, NULL, NULL, suppressedCount, 1 FROM summary
|
|
2446
|
+
WHERE NOT EXISTS (SELECT 1 FROM eligible)
|
|
2447
|
+
ORDER BY summaryOnly, ftsRank, messageOrdinal
|
|
2448
|
+
` : `SELECT ${columns} ${from} AND NOT (${MESSAGE_FTS_VISIBLE})
|
|
2449
|
+
ORDER BY ftsRank, CAST(messageOrdinal AS INTEGER) LIMIT ?`);
|
|
2450
|
+
statements.set(key, statement);
|
|
2451
|
+
return statement;
|
|
2452
|
+
}
|
|
2407
2453
|
function getBatchedFtsCountStatement(db, queryCount, cutoff, dateRange, sessionFirst) {
|
|
2408
2454
|
let statements = batchedFtsCountStatements.get(db);
|
|
2409
2455
|
if (!statements) {
|
|
@@ -2467,6 +2513,21 @@ function getMessageOrdinal(value) {
|
|
|
2467
2513
|
}
|
|
2468
2514
|
return null;
|
|
2469
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
|
+
}
|
|
2470
2531
|
async function getSemanticScores(args) {
|
|
2471
2532
|
const semanticScores = new Map;
|
|
2472
2533
|
if (!args.queryEmbedding || args.memories.length === 0 || !args.queryModelId || args.queryModelId === "off") {
|
|
@@ -2475,13 +2536,13 @@ async function getSemanticScores(args) {
|
|
|
2475
2536
|
const expectedEmbedding = { modelId: args.queryModelId, generation: args.queryGeneration };
|
|
2476
2537
|
if (!args.workspace?.isWorkspaced) {
|
|
2477
2538
|
const cachedEmbeddings = getProjectEmbeddings2(args.db, args.projectPath, args.queryModelId);
|
|
2478
|
-
const embeddings = args.backfillMemoryEmbeddings === false ? cachedEmbeddings : await
|
|
2539
|
+
const embeddings = args.backfillMemoryEmbeddings === false ? cachedEmbeddings : await waitForMemoryBackfill({
|
|
2479
2540
|
db: args.db,
|
|
2480
2541
|
projectIdentity: args.projectPath,
|
|
2481
2542
|
memories: args.memories,
|
|
2482
2543
|
existingEmbeddings: cachedEmbeddings,
|
|
2483
2544
|
expectedEmbedding
|
|
2484
|
-
});
|
|
2545
|
+
}, args.explicitSearch);
|
|
2485
2546
|
for (const memory of args.memories) {
|
|
2486
2547
|
const memoryEmbedding = embeddings.get(memory.id);
|
|
2487
2548
|
if (!memoryEmbedding || memoryEmbedding.modelId !== args.queryModelId) {
|
|
@@ -2504,13 +2565,13 @@ async function getSemanticScores(args) {
|
|
|
2504
2565
|
const ownMemories = memoriesByIdentity.get(args.projectPath) ?? [];
|
|
2505
2566
|
if (ownMemories.length > 0 && args.backfillMemoryEmbeddings !== false) {
|
|
2506
2567
|
const ownEmbeddings = getProjectEmbeddings2(args.db, args.projectPath, args.queryModelId);
|
|
2507
|
-
await
|
|
2568
|
+
await waitForMemoryBackfill({
|
|
2508
2569
|
db: args.db,
|
|
2509
2570
|
projectIdentity: args.projectPath,
|
|
2510
2571
|
memories: ownMemories,
|
|
2511
2572
|
existingEmbeddings: ownEmbeddings,
|
|
2512
2573
|
expectedEmbedding
|
|
2513
|
-
});
|
|
2574
|
+
}, args.explicitSearch);
|
|
2514
2575
|
}
|
|
2515
2576
|
for (const identity of workspace.identities) {
|
|
2516
2577
|
const memberMemories = memoriesByIdentity.get(identity) ?? [];
|
|
@@ -2556,11 +2617,12 @@ function selectSemanticCandidates(args) {
|
|
|
2556
2617
|
function mergeMemoryResults(args) {
|
|
2557
2618
|
const memoryById = new Map(args.memories.map((memory) => [memory.id, memory]));
|
|
2558
2619
|
const candidateIds = new Set([...args.semanticScores.keys(), ...args.ftsScores.keys()]);
|
|
2559
|
-
const
|
|
2560
|
-
const
|
|
2620
|
+
const ranked = [];
|
|
2621
|
+
const suppressionLimit = args.suppressionLimit ?? 0;
|
|
2622
|
+
const isVisible = (id) => args.visibleMemoryIds?.has(id) ?? false;
|
|
2561
2623
|
for (const id of candidateIds) {
|
|
2562
2624
|
const memory = memoryById.get(id);
|
|
2563
|
-
if (!memory) {
|
|
2625
|
+
if (!memory || suppressionLimit === 0 && isVisible(id)) {
|
|
2564
2626
|
continue;
|
|
2565
2627
|
}
|
|
2566
2628
|
const semanticScore = args.semanticScores.get(id);
|
|
@@ -2580,11 +2642,13 @@ function mergeMemoryResults(args) {
|
|
|
2580
2642
|
if (score <= 0) {
|
|
2581
2643
|
continue;
|
|
2582
2644
|
}
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2645
|
+
ranked.push({ memory, score, matchType });
|
|
2646
|
+
}
|
|
2647
|
+
ranked.sort((left, right) => right.score !== left.score ? right.score - left.score : left.memory.id - right.memory.id);
|
|
2648
|
+
const suppressedVisibleIds = ranked.slice(0, suppressionLimit).map(({ memory }) => memory.id).filter(isVisible);
|
|
2649
|
+
const hidden = suppressionLimit === 0 ? ranked : ranked.filter(({ memory }) => !isVisible(memory.id));
|
|
2650
|
+
return {
|
|
2651
|
+
results: hidden.slice(0, args.limit).map(({ memory, score, matchType }) => withMemoryHintContent({
|
|
2588
2652
|
source: "memory",
|
|
2589
2653
|
content: previewText(memory.content),
|
|
2590
2654
|
score,
|
|
@@ -2592,16 +2656,8 @@ function mergeMemoryResults(args) {
|
|
|
2592
2656
|
category: memory.category,
|
|
2593
2657
|
matchType,
|
|
2594
2658
|
sourceName: args.sourceNameByMemoryId?.get(memory.id)
|
|
2595
|
-
}, memory.content))
|
|
2596
|
-
|
|
2597
|
-
return {
|
|
2598
|
-
results: results.sort((left, right) => {
|
|
2599
|
-
if (right.score !== left.score) {
|
|
2600
|
-
return right.score - left.score;
|
|
2601
|
-
}
|
|
2602
|
-
return left.memoryId - right.memoryId;
|
|
2603
|
-
}).slice(0, args.limit),
|
|
2604
|
-
suppressedVisibleIds: suppressedVisibleIds.sort((left, right) => left - right)
|
|
2659
|
+
}, memory.content)),
|
|
2660
|
+
suppressedVisibleIds
|
|
2605
2661
|
};
|
|
2606
2662
|
}
|
|
2607
2663
|
async function searchMemories(args) {
|
|
@@ -2635,6 +2691,7 @@ async function searchMemories(args) {
|
|
|
2635
2691
|
projectPath: args.projectPath,
|
|
2636
2692
|
memories: semanticCandidates,
|
|
2637
2693
|
backfillMemoryEmbeddings: args.backfillMemoryEmbeddings,
|
|
2694
|
+
explicitSearch: args.explicitSearch,
|
|
2638
2695
|
queryEmbedding: args.queryEmbedding,
|
|
2639
2696
|
queryModelId: args.queryModelId,
|
|
2640
2697
|
queryGeneration: args.queryGeneration,
|
|
@@ -2677,6 +2734,7 @@ async function searchMemories(args) {
|
|
|
2677
2734
|
semanticScores,
|
|
2678
2735
|
ftsScores,
|
|
2679
2736
|
limit: args.limit,
|
|
2737
|
+
suppressionLimit: args.suppressionLimit,
|
|
2680
2738
|
visibleMemoryIds: args.visibleMemoryIds,
|
|
2681
2739
|
sourceNameByMemoryId
|
|
2682
2740
|
});
|
|
@@ -2686,12 +2744,12 @@ function linearDecayScore(rank, total) {
|
|
|
2686
2744
|
return 0;
|
|
2687
2745
|
return Math.max(0, 1 - rank / total);
|
|
2688
2746
|
}
|
|
2689
|
-
function normalizeMessageSearchRow(row, cutoff) {
|
|
2747
|
+
function normalizeMessageSearchRow(row, cutoff, includeDroppedTailMessages = false) {
|
|
2690
2748
|
const messageOrdinal = getMessageOrdinal(row.messageOrdinal);
|
|
2691
2749
|
if (messageOrdinal === null || typeof row.messageId !== "string" || typeof row.role !== "string" || typeof row.content !== "string") {
|
|
2692
2750
|
return null;
|
|
2693
2751
|
}
|
|
2694
|
-
if (cutoff !== null && messageOrdinal > cutoff)
|
|
2752
|
+
if (cutoff !== null && messageOrdinal > cutoff && !includeDroppedTailMessages)
|
|
2695
2753
|
return null;
|
|
2696
2754
|
return {
|
|
2697
2755
|
messageOrdinal,
|
|
@@ -2700,12 +2758,14 @@ function normalizeMessageSearchRow(row, cutoff) {
|
|
|
2700
2758
|
content: row.content
|
|
2701
2759
|
};
|
|
2702
2760
|
}
|
|
2703
|
-
function runMessageFtsQuery(db, sessionId, ftsQuery, fetchLimit, cutoff, dateRange, sessionFirst) {
|
|
2761
|
+
function runMessageFtsQuery(db, sessionId, ftsQuery, fetchLimit, cutoff, dateRange, sessionFirst, includeDroppedTailMessages) {
|
|
2704
2762
|
if (ftsQuery.length === 0)
|
|
2705
2763
|
return [];
|
|
2706
2764
|
let rawRows;
|
|
2707
2765
|
const matchQuery = contentOnlyMessageQuery(ftsQuery);
|
|
2708
|
-
if (
|
|
2766
|
+
if (cutoff !== null && includeDroppedTailMessages) {
|
|
2767
|
+
rawRows = getVisibilityFtsStatement(db, sessionFirst, dateRange !== null, false).all(...sessionFirst || dateRange !== null ? [sessionId, sessionId] : [sessionId], matchQuery, ...dateRange ? [dateRange.from, dateRange.to] : [], cutoff, fetchLimit);
|
|
2768
|
+
} else if (dateRange !== null) {
|
|
2709
2769
|
const bindings = [
|
|
2710
2770
|
sessionId,
|
|
2711
2771
|
sessionId,
|
|
@@ -2724,7 +2784,7 @@ function runMessageFtsQuery(db, sessionId, ftsQuery, fetchLimit, cutoff, dateRan
|
|
|
2724
2784
|
const rows = rawRows.map((row) => row);
|
|
2725
2785
|
const result = [];
|
|
2726
2786
|
for (const row of rows) {
|
|
2727
|
-
const normalized = normalizeMessageSearchRow(row, cutoff);
|
|
2787
|
+
const normalized = normalizeMessageSearchRow(row, cutoff, includeDroppedTailMessages);
|
|
2728
2788
|
if (normalized)
|
|
2729
2789
|
result.push(normalized);
|
|
2730
2790
|
}
|
|
@@ -2734,28 +2794,28 @@ function runMessageFtsQueryWithDiagnostics(args) {
|
|
|
2734
2794
|
if (args.ftsQuery.length === 0)
|
|
2735
2795
|
return { rows: [], suppressedCount: 0 };
|
|
2736
2796
|
const matchQuery = contentOnlyMessageQuery(args.ftsQuery);
|
|
2737
|
-
const rawRows = (args.dateRange === null ? getMessageSearchDiagnosticStatement(args.db, args.sessionFirst).all(...args.sessionFirst ? [args.sessionId, args.sessionId] : [args.sessionId], matchQuery, args.cutoff, args.fetchLimit, args.cutoff) : getMessageSearchDiagnosticStatementWithDateRange(args.db).all(args.sessionId, args.sessionId, matchQuery, args.dateRange.from, args.dateRange.to, args.cutoff, args.fetchLimit, args.cutoff)).map((row) => row);
|
|
2797
|
+
const rawRows = (args.includeDroppedTailMessages ? getVisibilityFtsStatement(args.db, args.sessionFirst, args.dateRange !== null, true).all(args.cutoff, ...args.sessionFirst || args.dateRange !== null ? [args.sessionId, args.sessionId] : [args.sessionId], matchQuery, ...args.dateRange ? [args.dateRange.from, args.dateRange.to] : [], args.fetchLimit) : args.dateRange === null ? getMessageSearchDiagnosticStatement(args.db, args.sessionFirst).all(...args.sessionFirst ? [args.sessionId, args.sessionId] : [args.sessionId], matchQuery, args.cutoff, args.fetchLimit, args.cutoff) : getMessageSearchDiagnosticStatementWithDateRange(args.db).all(args.sessionId, args.sessionId, matchQuery, args.dateRange.from, args.dateRange.to, args.cutoff, args.fetchLimit, args.cutoff)).map((row) => row);
|
|
2738
2798
|
const suppressedCount = rawRows[0]?.suppressedCount ?? 0;
|
|
2739
2799
|
const rows = [];
|
|
2740
2800
|
for (const row of rawRows) {
|
|
2741
2801
|
if (row.summaryOnly === 1)
|
|
2742
2802
|
continue;
|
|
2743
|
-
const normalized = normalizeMessageSearchRow(row, args.cutoff);
|
|
2803
|
+
const normalized = normalizeMessageSearchRow(row, args.cutoff, args.includeDroppedTailMessages);
|
|
2744
2804
|
if (normalized)
|
|
2745
2805
|
rows.push(normalized);
|
|
2746
2806
|
}
|
|
2747
2807
|
return { rows, suppressedCount };
|
|
2748
2808
|
}
|
|
2749
|
-
function getBatchedMessageSearchStatement(db, queryCount, cutoff, dateRange, sessionFirst) {
|
|
2809
|
+
function getBatchedMessageSearchStatement(db, queryCount, cutoff, dateRange, sessionFirst, includeDroppedTailMessages) {
|
|
2750
2810
|
let statements = batchedMessageSearchStatements.get(db);
|
|
2751
2811
|
if (!statements) {
|
|
2752
2812
|
statements = new Map;
|
|
2753
2813
|
batchedMessageSearchStatements.set(db, statements);
|
|
2754
2814
|
}
|
|
2755
|
-
const key = `${queryCount}:${cutoff === null ? "all" : "cutoff"}:${dateRange === null ? "all-dates" : "dated"}:${sessionFirst}`;
|
|
2815
|
+
const key = `${queryCount}:${cutoff === null ? "all" : "cutoff"}:${dateRange === null ? "all-dates" : "dated"}:${sessionFirst}:${includeDroppedTailMessages}`;
|
|
2756
2816
|
let statement = statements.get(key);
|
|
2757
2817
|
if (!statement) {
|
|
2758
|
-
const cutoffSql = cutoff === null ? "" : " AND CAST(message_history_fts.message_ordinal AS INTEGER) <= ?";
|
|
2818
|
+
const cutoffSql = cutoff === null ? "" : includeDroppedTailMessages ? ` AND NOT (${MESSAGE_FTS_VISIBLE})` : " AND CAST(message_history_fts.message_ordinal AS INTEGER) <= ?";
|
|
2759
2819
|
const joinSql = dateRange === null ? "" : ` JOIN message_fts_rowid_map AS map
|
|
2760
2820
|
ON map.session_id = message_history_fts.session_id
|
|
2761
2821
|
AND map.fts_rowid = message_history_fts.rowid`;
|
|
@@ -2781,7 +2841,7 @@ ORDER BY queryIndex ASC, ftsRank ASC`);
|
|
|
2781
2841
|
}
|
|
2782
2842
|
return statement;
|
|
2783
2843
|
}
|
|
2784
|
-
function runMessageFtsQueriesBatch(db, sessionId, ftsQueries, fetchLimit, cutoff, dateRange, sessionFirst) {
|
|
2844
|
+
function runMessageFtsQueriesBatch(db, sessionId, ftsQueries, fetchLimit, cutoff, dateRange, sessionFirst, includeDroppedTailMessages) {
|
|
2785
2845
|
if (ftsQueries.length === 0)
|
|
2786
2846
|
return [];
|
|
2787
2847
|
const bindings = [];
|
|
@@ -2795,13 +2855,13 @@ function runMessageFtsQueriesBatch(db, sessionId, ftsQueries, fetchLimit, cutoff
|
|
|
2795
2855
|
bindings.push(cutoff);
|
|
2796
2856
|
bindings.push(fetchLimit);
|
|
2797
2857
|
}
|
|
2798
|
-
const rows = getBatchedMessageSearchStatement(db, ftsQueries.length, cutoff, dateRange, sessionFirst).all(...bindings);
|
|
2858
|
+
const rows = getBatchedMessageSearchStatement(db, ftsQueries.length, cutoff, dateRange, sessionFirst, includeDroppedTailMessages).all(...bindings);
|
|
2799
2859
|
const result = Array.from({ length: ftsQueries.length }, () => []);
|
|
2800
2860
|
for (const row of rows) {
|
|
2801
2861
|
if (typeof row.queryIndex !== "number" || row.queryIndex < 0 || row.queryIndex >= result.length) {
|
|
2802
2862
|
continue;
|
|
2803
2863
|
}
|
|
2804
|
-
const normalized = normalizeMessageSearchRow(row, cutoff);
|
|
2864
|
+
const normalized = normalizeMessageSearchRow(row, cutoff, includeDroppedTailMessages);
|
|
2805
2865
|
if (normalized)
|
|
2806
2866
|
result[row.queryIndex].push(normalized);
|
|
2807
2867
|
}
|
|
@@ -2820,6 +2880,7 @@ function searchMessages(args) {
|
|
|
2820
2880
|
}
|
|
2821
2881
|
function searchMessagesInSnapshot(args, sessionFirst) {
|
|
2822
2882
|
const cutoff = args.maxOrdinal != null && args.maxOrdinal >= 0 ? args.maxOrdinal : null;
|
|
2883
|
+
const includeDroppedTailMessages = args.includeDroppedTailMessages === true;
|
|
2823
2884
|
const baselineFetchLimit = cutoff !== null ? args.limit * 3 : args.limit;
|
|
2824
2885
|
const captureFetchLimit = args.capture ? cutoff !== null ? args.capture.limit * 3 : args.capture.limit : 0;
|
|
2825
2886
|
const fetchLimit = Math.max(baselineFetchLimit, captureFetchLimit);
|
|
@@ -2833,15 +2894,16 @@ function searchMessagesInSnapshot(args, sessionFirst) {
|
|
|
2833
2894
|
fetchLimit,
|
|
2834
2895
|
cutoff,
|
|
2835
2896
|
dateRange: args.dateRange,
|
|
2836
|
-
sessionFirst
|
|
2897
|
+
sessionFirst,
|
|
2898
|
+
includeDroppedTailMessages
|
|
2837
2899
|
}) : {
|
|
2838
|
-
rows: runMessageFtsQuery(args.db, args.sessionId, baseQuery, fetchLimit, cutoff, args.dateRange, sessionFirst),
|
|
2900
|
+
rows: runMessageFtsQuery(args.db, args.sessionId, baseQuery, fetchLimit, cutoff, args.dateRange, sessionFirst, includeDroppedTailMessages),
|
|
2839
2901
|
suppressedCount: 0
|
|
2840
2902
|
};
|
|
2841
2903
|
if (args.diagnostics) {
|
|
2842
2904
|
args.diagnostics.suppressedLiveMessageMatches = outcome.suppressedCount;
|
|
2843
2905
|
}
|
|
2844
|
-
const rows = outcome.rows.length > 0 || !args.relaxedRecall ? outcome.rows : runMessageFtsQuery(args.db, args.sessionId, relaxedFtsQuery(args.query), fetchLimit, cutoff, args.dateRange, sessionFirst);
|
|
2906
|
+
const rows = outcome.rows.length > 0 || !args.relaxedRecall ? outcome.rows : runMessageFtsQuery(args.db, args.sessionId, relaxedFtsQuery(args.query), fetchLimit, cutoff, args.dateRange, sessionFirst, includeDroppedTailMessages);
|
|
2845
2907
|
const renderRows = (limit) => {
|
|
2846
2908
|
const filtered = rows.slice(0, limit);
|
|
2847
2909
|
return filtered.map((row, rank) => ({
|
|
@@ -2850,7 +2912,8 @@ function searchMessagesInSnapshot(args, sessionFirst) {
|
|
|
2850
2912
|
score: linearDecayScore(rank, filtered.length),
|
|
2851
2913
|
messageOrdinal: row.messageOrdinal,
|
|
2852
2914
|
messageId: row.messageId,
|
|
2853
|
-
role: row.role
|
|
2915
|
+
role: row.role,
|
|
2916
|
+
...includeDroppedTailMessages && cutoff !== null && row.messageOrdinal > cutoff ? { droppedFromContext: true } : {}
|
|
2854
2917
|
}));
|
|
2855
2918
|
};
|
|
2856
2919
|
if (args.capture)
|
|
@@ -2868,7 +2931,8 @@ function searchMessagesInSnapshot(args, sessionFirst) {
|
|
|
2868
2931
|
fetchLimit,
|
|
2869
2932
|
cutoff,
|
|
2870
2933
|
dateRange: args.dateRange,
|
|
2871
|
-
sessionFirst
|
|
2934
|
+
sessionFirst,
|
|
2935
|
+
includeDroppedTailMessages
|
|
2872
2936
|
}) : null;
|
|
2873
2937
|
if (args.diagnostics) {
|
|
2874
2938
|
args.diagnostics.suppressedLiveMessageMatches = baseOutcome?.suppressedCount ?? 0;
|
|
@@ -2877,7 +2941,7 @@ function searchMessagesInSnapshot(args, sessionFirst) {
|
|
|
2877
2941
|
...!collectBaseDiagnostics && baseQuery.length > 0 ? [baseQuery] : [],
|
|
2878
2942
|
...sanitizedProbes.map((entry) => entry.query)
|
|
2879
2943
|
];
|
|
2880
|
-
const rowsByQuery = runMessageFtsQueriesBatch(args.db, args.sessionId, searchQueries, fetchLimit, cutoff, args.dateRange, sessionFirst);
|
|
2944
|
+
const rowsByQuery = runMessageFtsQueriesBatch(args.db, args.sessionId, searchQueries, fetchLimit, cutoff, args.dateRange, sessionFirst, includeDroppedTailMessages);
|
|
2881
2945
|
const queryLists = [];
|
|
2882
2946
|
let queryIndex = 0;
|
|
2883
2947
|
if (baseQuery.length > 0) {
|
|
@@ -2927,7 +2991,8 @@ function searchMessagesInSnapshot(args, sessionFirst) {
|
|
|
2927
2991
|
score: linearDecayScore(rank, ranked.length),
|
|
2928
2992
|
messageOrdinal: entry.row.messageOrdinal,
|
|
2929
2993
|
messageId: entry.row.messageId,
|
|
2930
|
-
role: entry.row.role
|
|
2994
|
+
role: entry.row.role,
|
|
2995
|
+
...includeDroppedTailMessages && cutoff !== null && entry.row.messageOrdinal > cutoff ? { droppedFromContext: true } : {}
|
|
2931
2996
|
}));
|
|
2932
2997
|
};
|
|
2933
2998
|
if (args.capture)
|
|
@@ -3467,6 +3532,7 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
|
|
|
3467
3532
|
limit: tierLimit,
|
|
3468
3533
|
captureLimit: lanes ? 75 : undefined,
|
|
3469
3534
|
maxOrdinal: options.maxMessageOrdinal,
|
|
3535
|
+
includeDroppedTailMessages: options.includeDroppedTailMessages,
|
|
3470
3536
|
probes: messageProbes,
|
|
3471
3537
|
relaxedRecall: options.explicitSearch,
|
|
3472
3538
|
collectDiagnostics: options.diagnostics !== undefined,
|
|
@@ -3549,7 +3615,9 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
|
|
|
3549
3615
|
queryGeneration: queryContract?.generation ?? embeddingSnapshot?.generation,
|
|
3550
3616
|
workspace,
|
|
3551
3617
|
visibleMemoryIds: options.visibleMemoryIds,
|
|
3618
|
+
suppressionLimit: options.diagnostics && options.visibleMemoryIds?.size ? limit : undefined,
|
|
3552
3619
|
backfillMemoryEmbeddings: options.backfillMemoryEmbeddings,
|
|
3620
|
+
explicitSearch: options.explicitSearch,
|
|
3553
3621
|
lanes,
|
|
3554
3622
|
dateRange
|
|
3555
3623
|
}) : Promise.resolve({
|
|
@@ -3612,7 +3680,7 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
|
|
|
3612
3680
|
if (reranker && lanes) {
|
|
3613
3681
|
const pool = fuseSearchLanes(lanes).slice(0, "remote" in reranker ? reranker.remote.top_n : 20);
|
|
3614
3682
|
try {
|
|
3615
|
-
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);
|
|
3616
3684
|
} catch {
|
|
3617
3685
|
if ("remote" in reranker)
|
|
3618
3686
|
remoteRerankSkipped("candidate_validation", options.onRerankSkipped);
|
|
@@ -3718,10 +3786,10 @@ function formatUnifiedSearchResult(result, index, currentSessionId) {
|
|
|
3718
3786
|
].join(`
|
|
3719
3787
|
`);
|
|
3720
3788
|
}
|
|
3721
|
-
const expandStart = Math.max(1, result.messageOrdinal - 3);
|
|
3722
|
-
const expandEnd = result.messageOrdinal + 3;
|
|
3789
|
+
const expandStart = result.droppedFromContext ? result.messageOrdinal : Math.max(1, result.messageOrdinal - 3);
|
|
3790
|
+
const expandEnd = result.droppedFromContext ? result.messageOrdinal : result.messageOrdinal + 3;
|
|
3723
3791
|
return [
|
|
3724
|
-
`[${index}] [message] score=${result.score.toFixed(2)} ordinal=${result.messageOrdinal} range=${expandStart}-${expandEnd} role=${result.role}`,
|
|
3792
|
+
`[${index}] [message] score=${result.score.toFixed(2)} ordinal=${result.messageOrdinal} range=${expandStart}-${expandEnd} role=${result.role}${result.droppedFromContext ? ` (dropped from context; recover with ctx_expand(message=${result.messageOrdinal}))` : ""}`,
|
|
3725
3793
|
result.content
|
|
3726
3794
|
].join(`
|
|
3727
3795
|
`);
|
|
@@ -3730,7 +3798,7 @@ function formatSearchDiagnosticLines(results, diagnostics) {
|
|
|
3730
3798
|
if (!diagnostics)
|
|
3731
3799
|
return [];
|
|
3732
3800
|
const lines = [];
|
|
3733
|
-
const visibleIds =
|
|
3801
|
+
const visibleIds = diagnostics.suppressedVisibleMemoryIds;
|
|
3734
3802
|
if (visibleIds.length > 0) {
|
|
3735
3803
|
const count = visibleIds.length;
|
|
3736
3804
|
const noun = count === 1 ? "match" : "matches";
|
|
@@ -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";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTokenEstimatorFingerprint,
|
|
3
3
|
estimateTokens
|
|
4
|
-
} from "./server-
|
|
4
|
+
} from "./server-73bqw5c0.js";
|
|
5
5
|
import {
|
|
6
6
|
getHarness2
|
|
7
7
|
} from "./server-pavzsdc6.js";
|
|
8
8
|
import {
|
|
9
9
|
log2
|
|
10
|
-
} from "./server-
|
|
10
|
+
} from "./server-kzrrdjp5.js";
|
|
11
11
|
import {
|
|
12
12
|
isSynapseEmbeddingTruncated
|
|
13
|
-
} from "./server-
|
|
13
|
+
} from "./server-k3ntgf6n.js";
|
|
14
14
|
import {
|
|
15
15
|
messageFtsOrdinalRangeIsMapped2
|
|
16
|
-
} from "./server-
|
|
16
|
+
} from "./server-40vdz8sf.js";
|
|
17
17
|
import {
|
|
18
18
|
isKnownAutocommit
|
|
19
19
|
} from "./server-8ajstryz.js";
|
package/dist/v2/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadPluginConfigDetailed
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-vj0xbbrc.js";
|
|
4
4
|
import {
|
|
5
5
|
setHarness2
|
|
6
6
|
} from "./server-pavzsdc6.js";
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
registerStalePluginBuildHost,
|
|
12
12
|
log2,
|
|
13
13
|
flushLogger2
|
|
14
|
-
} from "./server-
|
|
15
|
-
import"./server-
|
|
16
|
-
import"./server-
|
|
17
|
-
import"./server-
|
|
18
|
-
import"./server-
|
|
14
|
+
} from "./server-kzrrdjp5.js";
|
|
15
|
+
import"./server-dt7cyqfe.js";
|
|
16
|
+
import"./server-2wz6y46g.js";
|
|
17
|
+
import"./server-n34vzyfm.js";
|
|
18
|
+
import"./server-rr5c0xcg.js";
|
|
19
19
|
import"./server-n5wn7d9b.js";
|
|
20
20
|
import {
|
|
21
21
|
string,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
union,
|
|
26
26
|
tuple,
|
|
27
27
|
record
|
|
28
|
-
} from "./server-
|
|
28
|
+
} from "./server-arfzfxe8.js";
|
|
29
29
|
import {
|
|
30
30
|
pushNotification2
|
|
31
31
|
} from "./server-y14pawe1.js";
|
|
@@ -7878,7 +7878,7 @@ var require_src2 = __commonJS(function(exports, module) {
|
|
|
7878
7878
|
// package.json
|
|
7879
7879
|
var package_default = {
|
|
7880
7880
|
name: "@cortexkit/opencode-magic-context",
|
|
7881
|
-
version: "0.49.
|
|
7881
|
+
version: "0.49.96",
|
|
7882
7882
|
type: "module",
|
|
7883
7883
|
description: "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
7884
7884
|
main: "dist/index.js",
|
|
@@ -8199,7 +8199,7 @@ async function setup(context) {
|
|
|
8199
8199
|
if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
|
|
8200
8200
|
log2(`[magic-context] Magic Context storage is at ${storageDir}, outside the folder Engram backs up (~/.local/share/cortexkit/magic-context). It is not included in CortexKit backups.`);
|
|
8201
8201
|
}
|
|
8202
|
-
const { registerContext } = await import("./context-
|
|
8202
|
+
const { registerContext } = await import("./context-vm09agrs.js");
|
|
8203
8203
|
setHarness2("opencode2");
|
|
8204
8204
|
bindStaleBuildNotice({}, import.meta.url, "opencode2");
|
|
8205
8205
|
const duties = await registerContext(context);
|