@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
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getMagicContextStorageDir,
|
|
11
11
|
log2,
|
|
12
12
|
sessionLog2
|
|
13
|
-
} from "./server-
|
|
13
|
+
} from "./server-kzrrdjp5.js";
|
|
14
14
|
import {
|
|
15
15
|
prepareCachedStatement2,
|
|
16
16
|
withSqliteBackgroundWriter2,
|
|
@@ -18,14 +18,14 @@ import {
|
|
|
18
18
|
} from "./server-gzy5w8ya.js";
|
|
19
19
|
import {
|
|
20
20
|
deleteUnmappedMessageFtsRows2
|
|
21
|
-
} from "./server-
|
|
21
|
+
} from "./server-40vdz8sf.js";
|
|
22
22
|
import {
|
|
23
23
|
deleteChunkEmbedBackoffForSession2
|
|
24
|
-
} from "./server-
|
|
24
|
+
} from "./server-zemnpv92.js";
|
|
25
25
|
import {
|
|
26
26
|
isPidAlive,
|
|
27
27
|
readProcessStartTime
|
|
28
|
-
} from "./server-
|
|
28
|
+
} from "./server-2wz6y46g.js";
|
|
29
29
|
import {
|
|
30
30
|
CACHED_TRIM_PARTIAL_SQL,
|
|
31
31
|
SESSION_META_SELECT_COLUMNS,
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
getPendingPiCompactionMarkerState,
|
|
59
59
|
logPiCompactionMarkerClear,
|
|
60
60
|
isPrefixBoundThinkingModel
|
|
61
|
-
} from "./server-
|
|
61
|
+
} from "./server-11ra1pmx.js";
|
|
62
62
|
import {
|
|
63
63
|
BoundedSessionMap,
|
|
64
64
|
getTableColumnNames,
|
|
@@ -68,25 +68,25 @@ import {
|
|
|
68
68
|
tagRevisionKey,
|
|
69
69
|
tagIdentityRevisionKey,
|
|
70
70
|
deleteTagIdentityRevisions
|
|
71
|
-
} from "./server-
|
|
71
|
+
} from "./server-4yrvbnnm.js";
|
|
72
72
|
import {
|
|
73
73
|
withReadOnlySessionDb
|
|
74
|
-
} from "./server-
|
|
74
|
+
} from "./server-bx5k66qc.js";
|
|
75
75
|
import {
|
|
76
76
|
layoutLkgPrefix,
|
|
77
77
|
assembleLkgPrefix
|
|
78
|
-
} from "./server-
|
|
78
|
+
} from "./server-2sare4qg.js";
|
|
79
79
|
import {
|
|
80
80
|
ensurePrivateStorageDirectorySync,
|
|
81
81
|
writeStorageFileSync,
|
|
82
82
|
writeStorageFileAtomicSync,
|
|
83
83
|
syncStorageDirectorySync,
|
|
84
84
|
writeStorageFileDurableAtomicSync
|
|
85
|
-
} from "./server-
|
|
85
|
+
} from "./server-n34vzyfm.js";
|
|
86
86
|
import {
|
|
87
87
|
gaDatabasePath2,
|
|
88
88
|
V2StoreReader2
|
|
89
|
-
} from "./server-
|
|
89
|
+
} from "./server-vtkbxzw1.js";
|
|
90
90
|
import {
|
|
91
91
|
markHostInstructionRow,
|
|
92
92
|
hostInstructionRowID,
|
|
@@ -99,7 +99,7 @@ import {
|
|
|
99
99
|
} from "./server-avwt563y.js";
|
|
100
100
|
import {
|
|
101
101
|
logSlowWriteTransaction
|
|
102
|
-
} from "./server-
|
|
102
|
+
} from "./server-tq523gj6.js";
|
|
103
103
|
|
|
104
104
|
// src/features/magic-context/compartment-lease.ts
|
|
105
105
|
var COMPARTMENT_LEASE_TTL_MS = 5 * 60 * 1000;
|
|
@@ -162,6 +162,86 @@ function isCompartmentLeaseHeld(db, sessionId, holderId) {
|
|
|
162
162
|
return row != null;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
// src/features/magic-context/history-gap-recovery.ts
|
|
166
|
+
var STATE = `CASE WHEN json_valid(deferred_execute_state)
|
|
167
|
+
AND json_type(deferred_execute_state) = 'object' THEN deferred_execute_state ELSE '{}' END`;
|
|
168
|
+
var PATH = "$.historyGapRecovery";
|
|
169
|
+
var MARK = `json_extract(${STATE}, '${PATH}')`;
|
|
170
|
+
var MARK_ID = `json_extract(${STATE}, '${PATH}.id')`;
|
|
171
|
+
var CHECKED_AT = `json_extract(${STATE}, '${PATH}.checkedAt')`;
|
|
172
|
+
function readSummaryCoverage(db, sessionId) {
|
|
173
|
+
return db.prepare(`SELECT id, sequence, end_message AS endOrdinal, end_message_id AS messageId
|
|
174
|
+
FROM compartments WHERE session_id = ? AND rebase_status != 'unresolved'
|
|
175
|
+
ORDER BY end_message DESC, sequence DESC LIMIT 1`).get(sessionId) ?? null;
|
|
176
|
+
}
|
|
177
|
+
function markHistoryGapAfterCoverageChange(db, sessionId, before, projectionChanged = false) {
|
|
178
|
+
if (!before)
|
|
179
|
+
return false;
|
|
180
|
+
const after = readSummaryCoverage(db, sessionId);
|
|
181
|
+
if (projectionChanged && after && before.messageId && before.messageId === after.messageId) {
|
|
182
|
+
if (before.endOrdinal !== after.endOrdinal) {
|
|
183
|
+
const pending = readHistoryGapMark(db, sessionId);
|
|
184
|
+
if (pending && pending.endOrdinal < before.endOrdinal) {
|
|
185
|
+
clearHistoryGapMark(db, sessionId, pending.id);
|
|
186
|
+
} else if (pending && pending.endOrdinal === before.endOrdinal) {
|
|
187
|
+
db.prepare(`UPDATE session_meta SET deferred_execute_state = json_set(${STATE}, '${PATH}.endOrdinal', ?)
|
|
188
|
+
WHERE session_id = ? AND ${MARK_ID} = ?`).run(after.endOrdinal, sessionId, pending.id);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
if (db.prepare("SELECT 1 FROM compartments WHERE id = ?").get(before.id))
|
|
194
|
+
return false;
|
|
195
|
+
if (after) {
|
|
196
|
+
if (before.messageId && before.messageId === after.messageId)
|
|
197
|
+
return false;
|
|
198
|
+
if (projectionChanged) {
|
|
199
|
+
if (after.sequence > before.sequence)
|
|
200
|
+
return false;
|
|
201
|
+
} else if (after.endOrdinal >= before.endOrdinal)
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
ensureSessionMetaRow(db, sessionId);
|
|
205
|
+
const mark = { id: crypto.randomUUID(), endOrdinal: after?.endOrdinal ?? -1 };
|
|
206
|
+
db.prepare(`UPDATE session_meta SET deferred_execute_state = json_set(${STATE}, '${PATH}', json(?))
|
|
207
|
+
WHERE session_id = ?`).run(JSON.stringify(mark), sessionId);
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
function settleHistoryGapAfterReplacement(db, sessionId, before, published) {
|
|
211
|
+
if (!markHistoryGapAfterCoverageChange(db, sessionId, before) && published) {
|
|
212
|
+
clearPublishedHistoryGapMark(db, sessionId);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function readHistoryGapMark(db, sessionId) {
|
|
216
|
+
const row = db.prepare(`SELECT ${MARK} AS mark FROM session_meta WHERE session_id = ?`).get(sessionId);
|
|
217
|
+
if (typeof row?.mark !== "string" || !row.mark.startsWith("{"))
|
|
218
|
+
return null;
|
|
219
|
+
const mark = JSON.parse(row.mark);
|
|
220
|
+
return typeof mark.id === "string" && Number.isInteger(mark.endOrdinal) ? mark : null;
|
|
221
|
+
}
|
|
222
|
+
function clearHistoryGapMark(db, sessionId, expected) {
|
|
223
|
+
db.prepare(`UPDATE session_meta SET deferred_execute_state = json_remove(${STATE}, '${PATH}')
|
|
224
|
+
WHERE session_id = ? AND ${MARK_ID} = ?`).run(sessionId, expected);
|
|
225
|
+
}
|
|
226
|
+
function clearPublishedHistoryGapMark(db, sessionId) {
|
|
227
|
+
const mark = readHistoryGapMark(db, sessionId);
|
|
228
|
+
if (!mark)
|
|
229
|
+
return;
|
|
230
|
+
const coverage = readSummaryCoverage(db, sessionId);
|
|
231
|
+
if (coverage && coverage.endOrdinal > mark.endOrdinal)
|
|
232
|
+
clearHistoryGapMark(db, sessionId, mark.id);
|
|
233
|
+
}
|
|
234
|
+
function claimHistoryGapCheck(db, sessionId, mark, now, inspectedCount) {
|
|
235
|
+
return db.prepare(`UPDATE session_meta SET deferred_execute_state = json_set(${STATE},
|
|
236
|
+
'${PATH}.checkedAt', ?, '${PATH}.inspectedCount', ?)
|
|
237
|
+
WHERE session_id = ? AND ${MARK_ID} = ? AND ${CHECKED_AT} IS ?`).run(now, inspectedCount, sessionId, mark.id, mark.checkedAt ?? null).changes > 0;
|
|
238
|
+
}
|
|
239
|
+
function recordHistoryGapAdmission(db, sessionId, admission) {
|
|
240
|
+
return db.prepare(`UPDATE session_meta SET deferred_execute_state = json_set(${STATE},
|
|
241
|
+
'${PATH}.admittedRuns', ?, '${PATH}.failureCountAtAdmission', ?)
|
|
242
|
+
WHERE session_id = ? AND ${MARK_ID} = ? AND ${CHECKED_AT} = ?`).run(admission.admittedRuns, admission.failureCount, sessionId, admission.id, admission.checkedAt).changes > 0;
|
|
243
|
+
}
|
|
244
|
+
|
|
165
245
|
// src/features/magic-context/no-content-compartment.ts
|
|
166
246
|
function isNoContentCompartment(row) {
|
|
167
247
|
return [row.title, row.content, row.p1, row.p2, row.p3, row.p4].every((value) => !value);
|
|
@@ -322,6 +402,8 @@ function appendCompartments(db, sessionId, compartments) {
|
|
|
322
402
|
const now = Date.now();
|
|
323
403
|
db.transaction(() => {
|
|
324
404
|
insertCompartmentRows(db, sessionId, compartments, now);
|
|
405
|
+
if (compartments.some((row) => !isNoContentCompartment(row)))
|
|
406
|
+
clearPublishedHistoryGapMark(db, sessionId);
|
|
325
407
|
}).immediate();
|
|
326
408
|
}
|
|
327
409
|
function buildCompartmentBlock(compartments, facts, memoryBlock, dateRanges) {
|
|
@@ -715,6 +797,11 @@ function withStorageFileMutex(directory, work, timeoutMs = 1000) {
|
|
|
715
797
|
writeStorageFileSync(ownPath, encodedTicket(), { flag: "wx", forcePrivate: true });
|
|
716
798
|
break;
|
|
717
799
|
} catch (error) {
|
|
800
|
+
try {
|
|
801
|
+
rmSync(ownPath, { force: true });
|
|
802
|
+
} catch (cleanupError) {
|
|
803
|
+
log2(`[magic-context] storage mutex could not remove its unwritten ticket ${ownPath}: ${String(cleanupError)}`);
|
|
804
|
+
}
|
|
718
805
|
const code = error.code;
|
|
719
806
|
if (code !== "ENOENT" && code !== "EEXIST" && code !== "EINVAL" || performance.now() >= deadline)
|
|
720
807
|
throw error;
|
|
@@ -1015,14 +1102,19 @@ function markLkgRecoveryDirty(args) {
|
|
|
1015
1102
|
});
|
|
1016
1103
|
}
|
|
1017
1104
|
function commitLkgWithRecoveryFence(args) {
|
|
1018
|
-
if (!durableFencesSupported())
|
|
1019
|
-
|
|
1105
|
+
if (!durableFencesSupported()) {
|
|
1106
|
+
const committed = args.commit();
|
|
1107
|
+
if (committed)
|
|
1108
|
+
args.onCommitted?.();
|
|
1109
|
+
return committed;
|
|
1110
|
+
}
|
|
1020
1111
|
const state = known(args.sessionId);
|
|
1021
1112
|
if (state.state === "clean" && !args.requiredRevision && !args.retainDirtyRevision) {
|
|
1022
1113
|
const committed = args.commit();
|
|
1023
1114
|
if (committed) {
|
|
1024
1115
|
observer?.("committed");
|
|
1025
1116
|
remember(args.sessionId, { state: "clean", record: null });
|
|
1117
|
+
args.onCommitted?.();
|
|
1026
1118
|
}
|
|
1027
1119
|
return committed;
|
|
1028
1120
|
}
|
|
@@ -1040,6 +1132,7 @@ function commitLkgWithRecoveryFence(args) {
|
|
|
1040
1132
|
if (!args.commit())
|
|
1041
1133
|
return false;
|
|
1042
1134
|
observer?.("committed");
|
|
1135
|
+
args.onCommitted?.();
|
|
1043
1136
|
const saved = args.load();
|
|
1044
1137
|
if (!saved || representationKey(saved) !== representationKey(args.slot))
|
|
1045
1138
|
throw new LkgRecoveryFenceError("Last-good commit did not match its certificate");
|
|
@@ -2043,11 +2136,12 @@ function persistLkgSlot(db, sessionId, slot, publishMetadata) {
|
|
|
2043
2136
|
}
|
|
2044
2137
|
}
|
|
2045
2138
|
function saveLkgSlotToDb(db, sessionId, slot, publishMetadata, fence = {}) {
|
|
2139
|
+
const { isLoadDeadline, ...publicationFence } = fence;
|
|
2046
2140
|
return commitLkgWithRecoveryFence({
|
|
2047
2141
|
sessionId,
|
|
2048
2142
|
slot,
|
|
2049
|
-
...
|
|
2050
|
-
load: () => loadPersistedLkgSlot(db, sessionId, true),
|
|
2143
|
+
...publicationFence,
|
|
2144
|
+
load: () => loadPersistedLkgSlot(db, sessionId, true, isLoadDeadline),
|
|
2051
2145
|
commit: () => persistLkgSlot(db, sessionId, slot, publishMetadata)
|
|
2052
2146
|
});
|
|
2053
2147
|
}
|
|
@@ -2065,7 +2159,7 @@ function clearPersistedLkgSlotStrict(db, sessionId) {
|
|
|
2065
2159
|
}).immediate());
|
|
2066
2160
|
persistedFingerprints.get(db)?.delete(sessionId);
|
|
2067
2161
|
}
|
|
2068
|
-
function loadPersistedLkgSlot(db, sessionId, forPublication = false) {
|
|
2162
|
+
function loadPersistedLkgSlot(db, sessionId, forPublication = false, isLoadDeadline) {
|
|
2069
2163
|
const rustHost = getHarness2() === "opencode" || getHarness2() === "opencode2";
|
|
2070
2164
|
if (rustHost && !forPublication && isRustMarkerAdmissionFenced(db, sessionId))
|
|
2071
2165
|
return;
|
|
@@ -2080,6 +2174,10 @@ function loadPersistedLkgSlot(db, sessionId, forPublication = false) {
|
|
|
2080
2174
|
return { row: slotRow, chunkRows: slices };
|
|
2081
2175
|
}).deferred());
|
|
2082
2176
|
} catch (error) {
|
|
2177
|
+
if (isLoadDeadline?.(error)) {
|
|
2178
|
+
sessionLog2(sessionId, "LKG snapshot durable load denied by outcome clock:", error);
|
|
2179
|
+
throw error;
|
|
2180
|
+
}
|
|
2083
2181
|
sessionLog2(sessionId, "LKG snapshot durable load failed:", error);
|
|
2084
2182
|
return;
|
|
2085
2183
|
}
|
|
@@ -2507,6 +2605,7 @@ function buildLkgPrefix(input, output, completeOutput = false) {
|
|
|
2507
2605
|
prefix.push(visible);
|
|
2508
2606
|
}
|
|
2509
2607
|
}
|
|
2608
|
+
canCountFromArray &&= canCountWithoutToJSON(prefix);
|
|
2510
2609
|
let jsonPrefix;
|
|
2511
2610
|
try {
|
|
2512
2611
|
jsonPrefix = JSON.stringify(prefix);
|
|
@@ -2727,10 +2826,19 @@ function validateLkgSeam(prefix, tail, providerKey) {
|
|
|
2727
2826
|
}
|
|
2728
2827
|
return true;
|
|
2729
2828
|
}
|
|
2829
|
+
function observeReplayStage(onStage, stage) {
|
|
2830
|
+
try {
|
|
2831
|
+
onStage?.(stage);
|
|
2832
|
+
} catch {}
|
|
2833
|
+
}
|
|
2730
2834
|
function replayLkg(args) {
|
|
2835
|
+
if (args.onStage)
|
|
2836
|
+
observeReplayStage(args.onStage, "savedRequestLoad");
|
|
2731
2837
|
const slot = getSlot(args.sessionId);
|
|
2732
2838
|
if (!slot)
|
|
2733
2839
|
return { ok: false, reason: "lkg_invalidated_reshape" };
|
|
2840
|
+
if (args.onStage)
|
|
2841
|
+
observeReplayStage(args.onStage, "identityCheck");
|
|
2734
2842
|
const requestedModelKeys = canonicalLkgModelKeys(args.modelKey, args.providerKey);
|
|
2735
2843
|
const capturedModelKeys = canonicalLkgModelKeys(slot.modelKey, slot.providerKey);
|
|
2736
2844
|
if (capturedModelKeys.modelKey !== requestedModelKeys.modelKey || capturedModelKeys.providerKey !== requestedModelKeys.providerKey) {
|
|
@@ -2746,6 +2854,8 @@ function replayLkg(args) {
|
|
|
2746
2854
|
dropSlot(args.sessionId, "lkg_content_mismatch");
|
|
2747
2855
|
return { ok: false, reason: "lkg_content_mismatch" };
|
|
2748
2856
|
}
|
|
2857
|
+
if (args.onStage)
|
|
2858
|
+
observeReplayStage(args.onStage, "replayRebuild");
|
|
2749
2859
|
let prefix;
|
|
2750
2860
|
try {
|
|
2751
2861
|
const parsed = JSON.parse(slot.jsonPrefix);
|
|
@@ -5200,4 +5310,4 @@ var ERROR_CLASSES = new Set([
|
|
|
5200
5310
|
"permission_denied",
|
|
5201
5311
|
"unknown"
|
|
5202
5312
|
]);
|
|
5203
|
-
export { COMPARTMENT_LEASE_RENEWAL_MS, getCompartmentLeaseBlocker, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, isNoContentCompartment, queueM0Mutation, getMaxM0MutationId, getCompartments, getNewestCompartmentIds, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, cachedHistoryCoversLatestCompartment, getCompartmentsByEndMessageId, appendCompartments, buildCompartmentBlock, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndsThrough, isPartialCompartmentEnd, readProjectDocsCanonical, readServerFallbackUsage, providerResponseFailed, isSuccessfulProviderCompletion, LkgRecoveryFenceError, lkgServedArrayDigest, hasCleanLkgRecoveryFence, dirtyLkgRecoveryRevision, ownsLkgDirtyFence, invalidateCleanLkgRecoveryFence, prepareLkgCaptureFence, certifyCommittedLkgCapture, markLkgRecoveryDirty, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, advanceSessionActivity, backfillSessionActivity, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, hasExplicitRefreshRequest, clearPendingMaterialization, clearReclaimedMaterialization, clearPendingMaterializationOrigin, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, readPersistedLkgUntaggedInputIds, persistLkgUntaggedInputIds, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginServedRequest, noteServedPassPermission, noteServedModel, noteServedReplay, noteServedHostInput, noteServedRefusal, countServedRefusal, dropServedRecord, forgetServedRecord, commitServedRequest, lkgInputIdentity, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgContentDigest, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, externalHistorianFailureReason, getRecentFailedHistorianRunTimes, recordHistorianRun, summarizeImportance, tallyFactsByCategory, MEMORY_VISIBILITY_MUTATION_CATEGORY, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId };
|
|
5313
|
+
export { COMPARTMENT_LEASE_RENEWAL_MS, getCompartmentLeaseBlocker, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, readSummaryCoverage, markHistoryGapAfterCoverageChange, settleHistoryGapAfterReplacement, readHistoryGapMark, clearHistoryGapMark, claimHistoryGapCheck, recordHistoryGapAdmission, isNoContentCompartment, queueM0Mutation, getMaxM0MutationId, getCompartments, getNewestCompartmentIds, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, cachedHistoryCoversLatestCompartment, getCompartmentsByEndMessageId, appendCompartments, buildCompartmentBlock, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndsThrough, isPartialCompartmentEnd, readProjectDocsCanonical, readServerFallbackUsage, providerResponseFailed, isSuccessfulProviderCompletion, LkgRecoveryFenceError, lkgServedArrayDigest, hasCleanLkgRecoveryFence, dirtyLkgRecoveryRevision, ownsLkgDirtyFence, invalidateCleanLkgRecoveryFence, prepareLkgCaptureFence, certifyCommittedLkgCapture, markLkgRecoveryDirty, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, advanceSessionActivity, backfillSessionActivity, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, hasExplicitRefreshRequest, clearPendingMaterialization, clearReclaimedMaterialization, clearPendingMaterializationOrigin, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, readPersistedLkgUntaggedInputIds, persistLkgUntaggedInputIds, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginServedRequest, noteServedPassPermission, noteServedModel, noteServedReplay, noteServedHostInput, noteServedRefusal, countServedRefusal, dropServedRecord, forgetServedRecord, commitServedRequest, lkgInputIdentity, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgContentDigest, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, externalHistorianFailureReason, getRecentFailedHistorianRunTimes, recordHistorianRun, summarizeImportance, tallyFactsByCategory, MEMORY_VISIBILITY_MUTATION_CATEGORY, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId };
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./server-gzy5w8ya.js";
|
|
14
14
|
import {
|
|
15
15
|
scheduleAfterBootQuiet
|
|
16
|
-
} from "./server-
|
|
16
|
+
} from "./server-n33hyq9t.js";
|
|
17
17
|
import {
|
|
18
18
|
getHarness2,
|
|
19
19
|
harnessOwnsOpenCodeStore2
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
importPluginModule,
|
|
25
25
|
writeForwardedLogLine2,
|
|
26
26
|
log2
|
|
27
|
-
} from "./server-
|
|
27
|
+
} from "./server-kzrrdjp5.js";
|
|
28
28
|
import {
|
|
29
29
|
isOwnRpcServerRecord,
|
|
30
30
|
isPidAlive,
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
parseRpcPortFile,
|
|
36
36
|
inspectProcessesAsync,
|
|
37
37
|
inspectWindowsProcessesSync
|
|
38
|
-
} from "./server-
|
|
38
|
+
} from "./server-2wz6y46g.js";
|
|
39
39
|
import {
|
|
40
40
|
configureContextDatabasePragmas2
|
|
41
41
|
} from "./server-fb3zxn06.js";
|
|
@@ -46,16 +46,16 @@ import {
|
|
|
46
46
|
copyStorageFileSync,
|
|
47
47
|
copyStorageTreeSync,
|
|
48
48
|
tightenStorageTreeSync
|
|
49
|
-
} from "./server-
|
|
49
|
+
} from "./server-n34vzyfm.js";
|
|
50
50
|
import {
|
|
51
51
|
attachFailClosedBlockingProcessEvidence
|
|
52
|
-
} from "./server-
|
|
52
|
+
} from "./server-2qvnr3t7.js";
|
|
53
53
|
import {
|
|
54
54
|
reuseWorker
|
|
55
55
|
} from "./server-96ztjvkn.js";
|
|
56
56
|
import {
|
|
57
57
|
startMessageFtsRowidMapBackfill2
|
|
58
|
-
} from "./server-
|
|
58
|
+
} from "./server-40vdz8sf.js";
|
|
59
59
|
import {
|
|
60
60
|
LKG_SLOT_CHUNKS_DDL,
|
|
61
61
|
SESSION_REPLAY_DECISIONS_DDL,
|
|
@@ -65,14 +65,14 @@ import {
|
|
|
65
65
|
hasPendingMigrations,
|
|
66
66
|
getMainThreadMigrationBodyCount,
|
|
67
67
|
runMigrations
|
|
68
|
-
} from "./server-
|
|
68
|
+
} from "./server-2sare4qg.js";
|
|
69
69
|
import {
|
|
70
70
|
ensureColumn,
|
|
71
71
|
setDatabase,
|
|
72
72
|
loadToolDefinitionMeasurements,
|
|
73
73
|
installV95PerfSchema,
|
|
74
74
|
installTagIdentityRevisionTrigger
|
|
75
|
-
} from "./server-
|
|
75
|
+
} from "./server-4yrvbnnm.js";
|
|
76
76
|
import {
|
|
77
77
|
resolveOpenCodeDbPath,
|
|
78
78
|
hasV1MessageTables
|
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
} from "./server-8ajstryz.js";
|
|
86
86
|
import {
|
|
87
87
|
logSlowWriteTransaction
|
|
88
|
-
} from "./server-
|
|
88
|
+
} from "./server-tq523gj6.js";
|
|
89
89
|
|
|
90
90
|
// src/features/magic-context/storage-db.ts
|
|
91
91
|
import {
|
|
@@ -1084,8 +1084,8 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1084
1084
|
state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
|
|
1085
1085
|
if (signal.aborted || !readsOpenCodeStore)
|
|
1086
1086
|
return;
|
|
1087
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1088
|
-
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-
|
|
1087
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-8tn2dbn1.js"));
|
|
1088
|
+
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-yj773saf.js"));
|
|
1089
1089
|
if (signal.aborted)
|
|
1090
1090
|
return;
|
|
1091
1091
|
await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
|
|
@@ -122,16 +122,32 @@ function decode(row) {
|
|
|
122
122
|
}
|
|
123
123
|
return { ...row, data };
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function fileIdentity(path) {
|
|
126
126
|
const stat = statSync(path);
|
|
127
|
-
|
|
127
|
+
return `${stat.dev}:${stat.ino}:${stat.birthtimeMs}`;
|
|
128
|
+
}
|
|
129
|
+
function openConfirmed(path, identity) {
|
|
128
130
|
const db = new Database2(path, { readonly: true, fileMustExist: true });
|
|
129
131
|
try {
|
|
130
|
-
|
|
132
|
+
if (fileIdentity(path) === identity) {
|
|
133
|
+
assertOpenCodeStoreGeneration(db, "v2", path);
|
|
134
|
+
return db;
|
|
135
|
+
}
|
|
131
136
|
} catch (error) {
|
|
132
137
|
db.close();
|
|
133
138
|
throw error;
|
|
134
139
|
}
|
|
140
|
+
db.close();
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
function connect(path, identity = fileIdentity(path)) {
|
|
144
|
+
let db = openConfirmed(path, identity);
|
|
145
|
+
if (!db) {
|
|
146
|
+
identity = fileIdentity(path);
|
|
147
|
+
db = openConfirmed(path, identity);
|
|
148
|
+
if (!db)
|
|
149
|
+
throw new Error("OpenCode database file changed during reader open");
|
|
150
|
+
}
|
|
135
151
|
const counters = debugCounters();
|
|
136
152
|
counters.openReaders += 1;
|
|
137
153
|
counters.readersOpened += 1;
|
|
@@ -139,7 +155,7 @@ function connect(path, identity = "") {
|
|
|
139
155
|
return {
|
|
140
156
|
db,
|
|
141
157
|
statements: new Map,
|
|
142
|
-
identity
|
|
158
|
+
identity,
|
|
143
159
|
leases: 0,
|
|
144
160
|
retired: false,
|
|
145
161
|
ordinalSequences: new Map
|
|
@@ -175,8 +191,7 @@ class V2StoreReaderPool2 {
|
|
|
175
191
|
if (this.closed)
|
|
176
192
|
throw new Error("Store reader pool is closed");
|
|
177
193
|
const key = resolve(path);
|
|
178
|
-
const
|
|
179
|
-
const identity = `${stat.dev}:${stat.ino}:${stat.birthtimeMs}`;
|
|
194
|
+
const identity = fileIdentity(key);
|
|
180
195
|
let connection = this.connections.get(key);
|
|
181
196
|
if (connection && connection.identity !== identity) {
|
|
182
197
|
this.connections.delete(key);
|