@cortexkit/opencode-magic-context 0.49.34 → 0.49.36
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/README.md +1 -1
- package/dist/auto-search-worker.js +163 -155
- package/dist/chunk-embedding-write-worker.js +70 -66
- package/dist/{compaction-marker-candidates-31h86ph0.js → compaction-marker-candidates-5p1qkve9.js} +5 -2
- package/dist/compaction-marker-candidates-worker.js +24 -23
- package/dist/{compartment-chunk-embedding-5q5gj67r.js → compartment-chunk-embedding-ypktm0tk.js} +10 -8
- package/dist/{conflict-warning-hook-xgskea1v.js → conflict-warning-hook-b75jn458.js} +11 -9
- package/dist/{context-p3xrarzt.js → context-969z683s.js} +1839 -746
- package/dist/{derive-budgets-pqybnx09.js → derive-budgets-htj16n4x.js} +3 -2
- package/dist/embedding-backfill-rma0v2ct.js +28 -0
- package/dist/embedding-worker-process.js +2 -1
- package/dist/embedding-worker.js +6 -5
- package/dist/expand-attachments-h33jbgyz.js +21 -0
- package/dist/features/magic-context/auto-search-diagnostics.d.ts +21 -0
- package/dist/features/magic-context/auto-search-diagnostics.d.ts.map +1 -0
- package/dist/features/magic-context/compaction-marker-candidates.d.ts.map +1 -1
- package/dist/features/magic-context/compaction-marker.d.ts +5 -3
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-gate.d.ts +2 -0
- package/dist/features/magic-context/dreamer/verify-gate.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-state.d.ts +9 -0
- package/dist/features/magic-context/dreamer/verify-state.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/verify.d.ts +2 -1
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/migration-worker-client.d.ts +3 -0
- package/dist/features/magic-context/migration-worker-client.d.ts.map +1 -1
- package/dist/features/magic-context/migration-worker.d.ts +15 -0
- package/dist/features/magic-context/migration-worker.d.ts.map +1 -1
- package/dist/features/magic-context/overflow-detection.d.ts +2 -2
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- 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/storage-meta-persisted.d.ts +1 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +4 -0
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/store-generation-rebase-labels.d.ts +6 -0
- package/dist/features/magic-context/store-generation-rebase-labels.d.ts.map +1 -0
- package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -1
- package/dist/features/magic-context/work-metrics-carry-storage.d.ts +10 -0
- package/dist/features/magic-context/work-metrics-carry-storage.d.ts.map +1 -0
- package/dist/{history-owner-36wp3mkb.js → history-owner-0z620wgz.js} +3 -2
- package/dist/hooks/magic-context/apply-operations.d.ts +20 -3
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-observation.d.ts +13 -0
- package/dist/hooks/magic-context/auto-search-observation.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts +10 -2
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-publication.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-commit-hashes.d.ts +4 -0
- package/dist/hooks/magic-context/compartment-commit-hashes.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts +1 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-completeness.d.ts +15 -0
- package/dist/hooks/magic-context/final-wire-completeness.d.ts.map +1 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/issue-423-fixture.d.ts +1 -1
- package/dist/hooks/magic-context/issue-423-fixture.d.ts.map +1 -1
- package/dist/hooks/magic-context/issue-424-fixture.d.ts +1 -1
- package/dist/hooks/magic-context/issue-424-fixture.d.ts.map +1 -1
- package/dist/hooks/magic-context/project-structural-sentinels.d.ts +25 -0
- package/dist/hooks/magic-context/project-structural-sentinels.d.ts.map +1 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +8 -1
- package/dist/hooks/magic-context/protected-tail-boundary.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/read-session-chunk.d.ts +11 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-formatting.d.ts +2 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts +2 -0
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/release-recovery-prefix.d.ts +9 -0
- package/dist/hooks/magic-context/release-recovery-prefix.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-structural-noise.d.ts +6 -3
- package/dist/hooks/magic-context/strip-structural-noise.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts +3 -0
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +3 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-cpjk5jd2.js → index-1d042x6w.js} +16 -14
- package/dist/{index-2743x98y.js → index-21fgrfrf.js} +35 -142
- package/dist/index-2amn2s73.js +123 -0
- package/dist/{index-c7phnbvk.js → index-2p37txes.js} +1 -1
- package/dist/index-2qbtqg1w.js +529 -0
- package/dist/{index-9gpw8hrm.js → index-2rs7912w.js} +4 -4
- package/dist/{index-m1x9ghk5.js → index-4ks89h5a.js} +37 -7
- package/dist/{index-b88dwwrh.js → index-4xyjr62e.js} +1 -1
- package/dist/index-4y35msh5.js +531 -0
- package/dist/index-66a50f3e.js +777 -0
- package/dist/index-72czy45z.js +4557 -0
- package/dist/index-7v05d9b7.js +58 -0
- package/dist/{index-qgh1qwjj.js → index-850vthn3.js} +9 -3
- package/dist/{index-np3rgfw4.js → index-8jjjmhab.js} +15 -4
- package/dist/index-96ztjvkn.js +204 -0
- package/dist/{index-fm36bjv4.js → index-9fgmkfaf.js} +22 -277
- package/dist/{index-atekmqef.js → index-9tdvbdv1.js} +508 -5547
- package/dist/{index-xrnsygfq.js → index-9wnbnx8f.js} +1 -1
- package/dist/{index-waktfbjy.js → index-ae1ar4v1.js} +4 -4
- package/dist/{index-v15ne3a3.js → index-b1ydbp95.js} +2 -2
- package/dist/{index-nxrsns5x.js → index-c5dzns43.js} +75 -75
- package/dist/{index-v7287tzq.js → index-dcjkw41m.js} +19 -8
- package/dist/{index-hbx7m8he.js → index-dfdg2cgg.js} +338 -86
- package/dist/{index-spwjbkc7.js → index-dnqqqc5f.js} +1 -1
- package/dist/{index-04z754rd.js → index-dz48h1wx.js} +33 -5
- package/dist/{index-rrv26qjz.js → index-fw42ms3m.js} +1 -1
- package/dist/{index-t5pck3ss.js → index-fxbk7gk3.js} +1 -1
- package/dist/{index-wfybj1dw.js → index-g4t7850m.js} +2 -2
- package/dist/{index-97spytxq.js → index-gnmhbyyc.js} +583 -474
- package/dist/{index-4pnsgvfk.js → index-hacf2tyx.js} +1 -1
- package/dist/index-j105mf16.js +270 -0
- package/dist/{index-gkee6p4g.js → index-jggt5gf2.js} +3 -3
- package/dist/{index-s1n8dd2n.js → index-jkanybgq.js} +2 -2
- package/dist/{index-h7tgn49j.js → index-jrfre9ah.js} +5 -222
- package/dist/{index-kfyb3k6n.js → index-jz5bk7xd.js} +2 -2
- package/dist/{index-7kkphb6c.js → index-nj360hcs.js} +4 -4
- package/dist/{index-07vskjn8.js → index-pp8vdn01.js} +15 -13
- package/dist/index-prw8apnc.js +194 -0
- package/dist/{index-rverk2vz.js → index-r2epb000.js} +34 -4
- package/dist/{index-7g9dr8gy.js → index-tn9drm1a.js} +125 -143
- package/dist/{index-kq5w68dp.js → index-txs8tce6.js} +1 -1
- package/dist/{index-rfxzazzy.js → index-ty4vhe4n.js} +5 -5
- package/dist/{index-y1qwzvxn.js → index-vd2ywmfe.js} +2 -2
- package/dist/{index-0677w9sd.js → index-wcwhhtdh.js} +58 -23
- package/dist/index-wh9fxds5.js +265 -0
- package/dist/{index-51rdvtkz.js → index-xd2p95m7.js} +3 -3
- package/dist/{index-as2amvn3.js → index-xnm0wq1r.js} +6 -531
- package/dist/{index-ftr84kkv.js → index-ys7j6679.js} +7 -5
- package/dist/index-z4p0ry94.js +222 -0
- package/dist/index-z9zygwse.js +89 -0
- package/dist/index.js +86 -74
- package/dist/{logger-94kew5wm.js → logger-qwnbcfj9.js} +2 -1
- package/dist/{message-fts-rowid-map-va36knh4.js → message-fts-rowid-map-t6qsyg9s.js} +7 -5
- package/dist/{message-index-bounded-qh91fdr3.js → message-index-bounded-wfk6aqxk.js} +15 -13
- package/dist/{message-time-backfill-4qva0b4f.js → message-time-backfill-39bm498k.js} +3 -2
- package/dist/migration-worker.js +55 -48
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{project-embedding-registry-6yex0r9f.js → project-embedding-registry-3yyegjma.js} +16 -13
- package/dist/raw-ordinal-warmup-worker.js +114 -113
- package/dist/{read-session-chunk-kaghtr75.js → read-session-chunk-26yrrhyz.js} +18 -12
- package/dist/{read-session-raw-b2sd67v4.js → read-session-raw-j7c9w57v.js} +5 -3
- package/dist/recomp-orchestrator-wk509qkp.js +69 -0
- package/dist/render-h1qarr8a.js +44 -0
- package/dist/{safe-notification-target-mkr9yzvr.js → safe-notification-target-wztd7bgk.js} +3 -2
- package/dist/search-5h9fydyq.js +54 -0
- package/dist/search-archive-q79hyqxs.js +29 -0
- package/dist/{send-session-notification-vz86nt79.js → send-session-notification-14p3yje4.js} +9 -7
- package/dist/shared/model-suggestion-retry.d.ts +7 -0
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/prompt-async-transport.d.ts.map +1 -1
- package/dist/shared/reusable-worker-entry.d.ts +4 -0
- package/dist/shared/reusable-worker-entry.d.ts.map +1 -0
- package/dist/shared/reusable-worker.d.ts +6 -0
- package/dist/shared/reusable-worker.d.ts.map +1 -0
- package/dist/shared/reusable-worker.fixture.d.ts +2 -0
- package/dist/shared/reusable-worker.fixture.d.ts.map +1 -0
- package/dist/shared/worker-shutdown.d.ts +1 -1
- package/dist/shared/worker-shutdown.d.ts.map +1 -1
- package/dist/{storage-tags-6hvkk01c.js → storage-tags-vj0yj7ed.js} +5 -4
- package/dist/store-reader-yh19h38c.js +14 -0
- package/dist/store-s3eykdjt.js +21 -0
- package/dist/tools/ctx-expand/render.d.ts +5 -3
- package/dist/tools/ctx-expand/render.d.ts.map +1 -1
- package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -1
- package/dist/tools/ctx-expand/tools.d.ts +2 -0
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/tools/ctx-expand/v2-archive-reader.d.ts +33 -0
- package/dist/tools/ctx-expand/v2-archive-reader.d.ts.map +1 -0
- package/dist/{transform-postprocess-phase-ph38mhrs.js → transform-postprocess-phase-4gj0mtcg.js} +39 -32
- package/dist/v2/auto-search-worker.js +163 -155
- package/dist/v2/chunk-embedding-write-worker.js +71 -67
- package/dist/v2/compaction-marker-candidates-worker.js +24 -23
- package/dist/v2/{compaction-marker-candidates-m4vmye3w.js → compaction-marker-candidates-yeb2ky46.js} +6 -3
- package/dist/v2/{compartment-chunk-embedding-rc31e6md.js → compartment-chunk-embedding-qfk791bd.js} +11 -9
- package/dist/v2/{context-s60hcatx.js → context-bxr039be.js} +2678 -1246
- package/dist/v2/{derive-budgets-knf763tt.js → derive-budgets-sa0v7bz0.js} +4 -3
- package/dist/v2/embedding-backfill-00tw59rx.js +27 -0
- package/dist/v2/embedding-worker-process.js +2 -1
- package/dist/v2/embedding-worker.js +6 -5
- package/dist/v2/expand-attachments-h33jbgyz.js +21 -0
- package/dist/v2/fold/code-mode-catalog.d.ts +3 -0
- package/dist/v2/fold/code-mode-catalog.d.ts.map +1 -0
- package/dist/v2/fold/idle.d.ts +16 -0
- package/dist/v2/fold/idle.d.ts.map +1 -0
- package/dist/v2/fold/manual-baseline.d.ts +8 -0
- package/dist/v2/fold/manual-baseline.d.ts.map +1 -0
- package/dist/v2/fold/native-replay-v3.d.ts +75 -0
- package/dist/v2/fold/native-replay-v3.d.ts.map +1 -0
- package/dist/v2/fold/native-replay.d.ts +81 -8
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/fold/policy.d.ts +2 -1
- package/dist/v2/fold/policy.d.ts.map +1 -1
- package/dist/v2/fold/restore.d.ts.map +1 -1
- package/dist/v2/fold/summary.d.ts +4 -0
- package/dist/v2/fold/summary.d.ts.map +1 -0
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/{history-owner-ad0crnrn.js → history-owner-fpka43cn.js} +3 -2
- package/dist/v2/hooks/channel2.d.ts +6 -0
- package/dist/v2/hooks/channel2.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/expand-attachments.d.ts +8 -0
- package/dist/v2/hooks/expand-attachments.d.ts.map +1 -0
- package/dist/v2/hooks/overflow-recovery.d.ts +45 -0
- package/dist/v2/hooks/overflow-recovery.d.ts.map +1 -0
- package/dist/v2/hooks/restore-rows.d.ts +12 -2
- package/dist/v2/hooks/restore-rows.d.ts.map +1 -1
- package/dist/v2/hooks/store.d.ts +7 -2
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/hooks/synthetic-admission.d.ts +7 -0
- package/dist/v2/hooks/synthetic-admission.d.ts.map +1 -0
- package/dist/v2/hooks/usage-persist.d.ts.map +1 -1
- package/dist/v2/{logger-p34mjtja.js → logger-4cj6d03m.js} +2 -1
- package/dist/v2/{message-fts-rowid-map-78awh03v.js → message-fts-rowid-map-z86avy0n.js} +8 -6
- package/dist/v2/{message-index-bounded-4htdr1j6.js → message-index-bounded-w14496s9.js} +16 -14
- package/dist/v2/{message-time-backfill-zvthw6xb.js → message-time-backfill-0c4h7sg6.js} +3 -2
- package/dist/v2/migration-worker.js +56 -49
- package/dist/v2/ordinal-range.fixture.d.ts +7 -0
- package/dist/v2/ordinal-range.fixture.d.ts.map +1 -0
- package/dist/v2/{project-embedding-registry-1x5qe2fy.js → project-embedding-registry-jqq2qeqb.js} +17 -14
- package/dist/v2/raw-ordinal-warmup-worker.js +114 -113
- package/dist/v2/{read-session-chunk-1fa9qzwb.js → read-session-chunk-tqnh1ret.js} +18 -12
- package/dist/v2/{read-session-raw-5x088amc.js → read-session-raw-qpp6x9kg.js} +6 -4
- package/dist/v2/recomp-orchestrator-9cjk6aej.js +68 -0
- package/dist/v2/render-5dz1knf2.js +43 -0
- package/dist/v2/{safe-notification-target-khnzg57c.js → safe-notification-target-gphhast7.js} +3 -2
- package/dist/v2/search-8yfet25y.js +52 -0
- package/dist/v2/search-archive-z6z9jqwf.js +28 -0
- package/dist/v2/{send-session-notification-x5nzy34v.js → send-session-notification-kxp47tsw.js} +9 -7
- package/dist/v2/{server-cpjk5jd2.js → server-1d042x6w.js} +16 -14
- package/dist/v2/server-2amn2s73.js +123 -0
- package/dist/v2/{server-6g98c227.js → server-3schkz95.js} +4 -4
- package/dist/v2/server-468mya5v.js +209 -0
- package/dist/v2/{server-z2wft9zv.js → server-5by3vdzs.js} +562 -5560
- package/dist/v2/{server-qjvk4a9t.js → server-69m30b21.js} +1 -1
- package/dist/v2/server-6emy0v9a.js +531 -0
- package/dist/v2/{server-vr4szghm.js → server-6vzh6wej.js} +3 -3
- package/dist/v2/{server-ajxhrgjv.js → server-7094pk3w.js} +80 -19
- package/dist/v2/{server-ab8017gw.js → server-7acq7815.js} +34 -141
- package/dist/v2/server-7v05d9b7.js +58 -0
- package/dist/v2/{server-24g8r2d0.js → server-7zacmty5.js} +75 -75
- package/dist/v2/{server-3mz2qh5a.js → server-969cdpmg.js} +1 -1
- package/dist/v2/server-96ztjvkn.js +204 -0
- package/dist/v2/{server-grakwy1v.js → server-a9w5f0yw.js} +37 -7
- package/dist/v2/{server-835q39kd.js → server-avdveykk.js} +3 -3
- package/dist/v2/{server-qc915kw2.js → server-bez34e60.js} +4 -4
- package/dist/v2/{server-h1byrhwx.js → server-cp1a03vc.js} +19 -8
- package/dist/v2/{server-bsgd4dk1.js → server-dcws5831.js} +2 -2
- package/dist/v2/{server-m1pfg2d4.js → server-dfq5vb8j.js} +4 -4
- package/dist/v2/server-e51xmr4d.js +194 -0
- package/dist/v2/server-ef1mskas.js +777 -0
- package/dist/v2/{server-1bw1wcbp.js → server-f0j864ma.js} +1 -1
- package/dist/v2/{server-jw5qe9y8.js → server-g3gqq4ac.js} +18 -217
- package/dist/v2/{server-2aasmpsp.js → server-gkse1wyz.js} +5 -5
- package/dist/v2/{server-6495nmn9.js → server-jb6tjyeb.js} +5 -222
- package/dist/v2/{server-qvy4qavp.js → server-jd7vzwn4.js} +125 -143
- package/dist/v2/{server-a7x00tw8.js → server-mfn1yf9d.js} +1 -1
- package/dist/v2/{server-awr8qa4c.js → server-nmyganc8.js} +2 -2
- package/dist/v2/{server-tkdabx8q.js → server-nq3cb7be.js} +5 -530
- package/dist/v2/server-qjyp27vf.js +270 -0
- package/dist/v2/{server-gyy4k6mf.js → server-qmmkhz2z.js} +1 -1
- package/dist/v2/{server-29qp8nz4.js → server-qxzbmtqt.js} +1 -1
- package/dist/v2/{server-806rzhs6.js → server-r4430x9m.js} +10 -4
- package/dist/v2/{server-53eh1r8r.js → server-sd8hvzte.js} +2 -2
- package/dist/v2/{server-k3t06fxr.js → server-sefxj8k1.js} +1 -1
- package/dist/v2/server-t8y64xj7.js +4513 -0
- package/dist/v2/{server-6vd2n183.js → server-tnzbk64q.js} +35 -5
- package/dist/v2/{server-v77xa5wj.js → server-tpt7bwq8.js} +1 -1
- package/dist/v2/{server-51779zs2.js → server-v0p37hm2.js} +4 -1
- package/dist/v2/{server-nxas8v1d.js → server-xfjjbrkt.js} +15 -4
- package/dist/v2/{server-cqjvxyrp.js → server-xy7w7hrd.js} +2 -2
- package/dist/v2/server-ypf1ap0v.js +529 -0
- package/dist/v2/server-z4p0ry94.js +222 -0
- package/dist/v2/server-z9zygwse.js +89 -0
- package/dist/v2/{server-ab1g0wn9.js → server-zzgtgqmd.js} +2 -2
- package/dist/v2/server.js +7 -6
- package/dist/v2/{storage-tags-18nbaanf.js → storage-tags-cw07ky67.js} +5 -4
- package/dist/v2/store-reader-cgx47zkp.js +14 -0
- package/dist/v2/store-reader.d.ts +9 -2
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/store-z3qe67cg.js +21 -0
- package/dist/v2/v2-archive-reader-z7wr42ry.js +11 -0
- package/dist/v2/{wrapup-orchestrator-wxf7n5k6.js → wrapup-orchestrator-j1v62bkj.js} +50 -42
- package/dist/v2-archive-reader-028z6kck.js +11 -0
- package/dist/wrapup-orchestrator-xg9avt2p.js +56 -0
- package/package.json +1 -1
- package/src/shared/model-suggestion-retry.ts +1 -1
- package/src/shared/prompt-async-transport.test.ts +64 -3
- package/src/shared/prompt-async-transport.ts +61 -16
- package/src/shared/reusable-worker-entry.ts +58 -0
- package/src/shared/reusable-worker-reset.test.ts +108 -0
- package/src/shared/reusable-worker.fixture.ts +35 -0
- package/src/shared/reusable-worker.test.ts +253 -0
- package/src/shared/reusable-worker.ts +240 -0
- package/src/shared/sqlite-transaction-mode-guard.test.ts +2 -0
- package/src/shared/worker-shutdown.ts +21 -17
- package/dist/embedding-backfill-0jgtqxen.js +0 -25
- package/dist/recomp-orchestrator-0y983w7h.js +0 -62
- package/dist/search-archive-1kw2rp19.js +0 -26
- package/dist/search-p684j8ww.js +0 -50
- package/dist/v2/embedding-backfill-f43hd8y6.js +0 -24
- package/dist/v2/recomp-orchestrator-7q9nvxte.js +0 -61
- package/dist/v2/search-archive-xfp51s0g.js +0 -25
- package/dist/v2/search-wf8rqxhm.js +0 -48
- package/dist/wrapup-orchestrator-ys2nrkkb.js +0 -49
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
getTemporalDecisions,
|
|
8
8
|
freezeTemporalDecisions,
|
|
9
9
|
stableStringify
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-9wnbnx8f.js";
|
|
11
11
|
import {
|
|
12
12
|
protectedToolTagNumbers,
|
|
13
13
|
stripPersistedAssistantText,
|
|
@@ -74,19 +74,19 @@ import {
|
|
|
74
74
|
adoptNullOwnerToolTag2,
|
|
75
75
|
getCandidateToolOwners2,
|
|
76
76
|
pickNearestPriorOwner2
|
|
77
|
-
} from "./index-
|
|
77
|
+
} from "./index-8jjjmhab.js";
|
|
78
78
|
import {
|
|
79
79
|
textMentionsRecentCommit,
|
|
80
80
|
hasMeaningfulUserText2,
|
|
81
81
|
estimateTokens
|
|
82
|
-
} from "./index-
|
|
82
|
+
} from "./index-4xyjr62e.js";
|
|
83
83
|
import {
|
|
84
84
|
getMagicContextStorageDir
|
|
85
85
|
} from "./index-g2q4htwp.js";
|
|
86
86
|
import {
|
|
87
87
|
log2,
|
|
88
88
|
sessionLog2
|
|
89
|
-
} from "./index-
|
|
89
|
+
} from "./index-jrfre9ah.js";
|
|
90
90
|
import {
|
|
91
91
|
inRootAsyncContext2,
|
|
92
92
|
getTagIdentityWriteGeneration2,
|
|
@@ -95,16 +95,14 @@ import {
|
|
|
95
95
|
isTransientSqliteError2
|
|
96
96
|
} from "./index-gzy5w8ya.js";
|
|
97
97
|
import {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
embedBatchForProject2
|
|
101
|
-
} from "./index-2743x98y.js";
|
|
98
|
+
reuseWorker
|
|
99
|
+
} from "./index-96ztjvkn.js";
|
|
102
100
|
import {
|
|
103
101
|
createWorkerShutdown
|
|
104
|
-
} from "./index-
|
|
102
|
+
} from "./index-1d042x6w.js";
|
|
105
103
|
import {
|
|
106
104
|
runSessionWarmupWorker
|
|
107
|
-
} from "./index-
|
|
105
|
+
} from "./index-r2epb000.js";
|
|
108
106
|
import {
|
|
109
107
|
getMaxM0MutationId,
|
|
110
108
|
getLastCompartmentEndMessage,
|
|
@@ -121,30 +119,12 @@ import {
|
|
|
121
119
|
clearPendingMaterialization,
|
|
122
120
|
saveSourceContent,
|
|
123
121
|
replaceSourceContent,
|
|
124
|
-
getSourceContents
|
|
125
|
-
|
|
126
|
-
prepareCompactionMarkerCandidates,
|
|
127
|
-
MARKER_SUMMARY_TEXT,
|
|
128
|
-
applyDeferredCompactionMarker,
|
|
129
|
-
injectTemporalMarkers,
|
|
130
|
-
clearInjectionCache,
|
|
131
|
-
getVisibleMemoryIds,
|
|
132
|
-
renderCompartmentInjection,
|
|
133
|
-
MaterializeContentionError,
|
|
134
|
-
mustMaterialize,
|
|
135
|
-
hydrateCachedM0Mural,
|
|
136
|
-
prepareCachedM0M1Replay,
|
|
137
|
-
hasCompleteCachedM0M1,
|
|
138
|
-
injectM0M1,
|
|
139
|
-
observeNoteNudgeServe,
|
|
140
|
-
peekNoteNudgeText,
|
|
141
|
-
markNoteNudgeDelivered,
|
|
142
|
-
getActiveCompartmentRun
|
|
143
|
-
} from "./index-atekmqef.js";
|
|
122
|
+
getSourceContents
|
|
123
|
+
} from "./index-72czy45z.js";
|
|
144
124
|
import {
|
|
145
125
|
cleanSearchText,
|
|
146
126
|
matchedSearchSnippet
|
|
147
|
-
} from "./index-
|
|
127
|
+
} from "./index-2rs7912w.js";
|
|
148
128
|
import {
|
|
149
129
|
stripSystemInjection,
|
|
150
130
|
isTextPart,
|
|
@@ -242,10 +222,15 @@ import {
|
|
|
242
222
|
extractToolCallObservation,
|
|
243
223
|
ToolMutationBatch,
|
|
244
224
|
createToolDropTarget
|
|
245
|
-
} from "./index-
|
|
225
|
+
} from "./index-tn9drm1a.js";
|
|
246
226
|
import {
|
|
247
227
|
isValidLanguageCode
|
|
248
|
-
} from "./index-
|
|
228
|
+
} from "./index-c5dzns43.js";
|
|
229
|
+
import {
|
|
230
|
+
getProjectEmbeddingSnapshot2,
|
|
231
|
+
embedTextForProject2,
|
|
232
|
+
embedBatchForProject2
|
|
233
|
+
} from "./index-21fgrfrf.js";
|
|
249
234
|
import {
|
|
250
235
|
isEmbeddingHostBusy2
|
|
251
236
|
} from "./index-qt1qqasc.js";
|
|
@@ -253,17 +238,38 @@ import {
|
|
|
253
238
|
openCodeDbExists,
|
|
254
239
|
withReadOnlySessionDb,
|
|
255
240
|
getMessageTimesFromOpenCodeDb
|
|
256
|
-
} from "./index-
|
|
241
|
+
} from "./index-vd2ywmfe.js";
|
|
257
242
|
import {
|
|
258
243
|
BoundedSessionMap
|
|
259
|
-
} from "./index-
|
|
244
|
+
} from "./index-jkanybgq.js";
|
|
260
245
|
import {
|
|
261
246
|
getMessageIndexEpoch,
|
|
262
|
-
isMessageIndexSearchable
|
|
263
|
-
|
|
247
|
+
isMessageIndexSearchable,
|
|
248
|
+
createAutoSearchDiagnostics
|
|
249
|
+
} from "./index-dz48h1wx.js";
|
|
250
|
+
import {
|
|
251
|
+
compareOpenCodeMessagesByCanonicalOrder,
|
|
252
|
+
prepareCompactionMarkerCandidates,
|
|
253
|
+
MARKER_SUMMARY_TEXT,
|
|
254
|
+
applyDeferredCompactionMarker,
|
|
255
|
+
injectTemporalMarkers,
|
|
256
|
+
clearInjectionCache,
|
|
257
|
+
getVisibleMemoryIds,
|
|
258
|
+
renderCompartmentInjection,
|
|
259
|
+
MaterializeContentionError,
|
|
260
|
+
mustMaterialize,
|
|
261
|
+
hydrateCachedM0Mural,
|
|
262
|
+
prepareCachedM0M1Replay,
|
|
263
|
+
hasCompleteCachedM0M1,
|
|
264
|
+
injectM0M1,
|
|
265
|
+
observeNoteNudgeServe,
|
|
266
|
+
peekNoteNudgeText,
|
|
267
|
+
markNoteNudgeDelivered,
|
|
268
|
+
getActiveCompartmentRun
|
|
269
|
+
} from "./index-9tdvbdv1.js";
|
|
264
270
|
import {
|
|
265
271
|
userFacingFailureCode
|
|
266
|
-
} from "./index-
|
|
272
|
+
} from "./index-xnm0wq1r.js";
|
|
267
273
|
import {
|
|
268
274
|
normalizeProtectedToolName,
|
|
269
275
|
mergeProtectedTools
|
|
@@ -273,7 +279,7 @@ import {
|
|
|
273
279
|
} from "./index-y8v6yerm.js";
|
|
274
280
|
import {
|
|
275
281
|
logSlowWriteTransaction
|
|
276
|
-
} from "./index-
|
|
282
|
+
} from "./index-fxbk7gk3.js";
|
|
277
283
|
|
|
278
284
|
// src/features/magic-context/tagger.ts
|
|
279
285
|
var TOOL_COMPOSITE_KEY_SEP = "\x00";
|
|
@@ -1262,6 +1268,32 @@ function selectAutoSearchResults(results, threshold) {
|
|
|
1262
1268
|
return results.filter((result) => relevance(result) >= threshold).sort((left, right) => relevance(right) - relevance(left));
|
|
1263
1269
|
}
|
|
1264
1270
|
|
|
1271
|
+
// src/hooks/magic-context/auto-search-observation.ts
|
|
1272
|
+
var disabledTurns = new WeakMap;
|
|
1273
|
+
function logDisabledAutoSearch(db, sessionId, messageId, threshold, startedAt) {
|
|
1274
|
+
const sessions = disabledTurns.get(db) ?? new Map;
|
|
1275
|
+
disabledTurns.set(db, sessions);
|
|
1276
|
+
if (sessions.get(sessionId) === messageId)
|
|
1277
|
+
return;
|
|
1278
|
+
sessions.set(sessionId, messageId);
|
|
1279
|
+
observeAutoSearch(sessionId, threshold, startedAt).finish("disabled");
|
|
1280
|
+
}
|
|
1281
|
+
function observeAutoSearch(sessionId, threshold, startedAt) {
|
|
1282
|
+
const diagnostics = createAutoSearchDiagnostics(threshold);
|
|
1283
|
+
let logged = false;
|
|
1284
|
+
return {
|
|
1285
|
+
diagnostics,
|
|
1286
|
+
finish(outcome, reason) {
|
|
1287
|
+
if (logged)
|
|
1288
|
+
return;
|
|
1289
|
+
logged = true;
|
|
1290
|
+
const lanes = Object.entries(diagnostics.lanes).map(([lane, value]) => `${lane}:${value.top?.toFixed(3) ?? "none"}`).join(",");
|
|
1291
|
+
const nearMisses = Object.values(diagnostics.lanes).reduce((sum, lane) => sum + lane.nearMisses, 0);
|
|
1292
|
+
sessionLog2(sessionId, `auto-search: decision outcome=${outcome}${reason ? ` reason=${reason}` : ""} lanes=${lanes || "none"} nearMisses=${nearMisses} threshold=${threshold} pool=${diagnostics.pool} rows=${diagnostics.poolRows ?? "unknown"} workerStarted=${diagnostics.workerStarted ?? "unknown"} peek=${diagnostics.peek} elapsedMs=${Math.round(performance.now() - startedAt)}`);
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1265
1297
|
// src/hooks/magic-context/auto-search-worker-client.ts
|
|
1266
1298
|
import { Worker } from "node:worker_threads";
|
|
1267
1299
|
var pendingRegistrations = new WeakMap;
|
|
@@ -1408,7 +1440,7 @@ async function acquireSearchWorker(db, key, entry, input, signal) {
|
|
|
1408
1440
|
}
|
|
1409
1441
|
const fresh = !slot;
|
|
1410
1442
|
if (!slot) {
|
|
1411
|
-
const worker = inRootAsyncContext2(() => new Worker(entry, { workerData: { ...input, persistent: true } }));
|
|
1443
|
+
const worker = inRootAsyncContext2(() => input.job === "backfill" && entry.href === defaultAutoSearchWorkerEntry().href ? reuseWorker(entry, { workerData: input }) : new Worker(entry, { workerData: { ...input, persistent: true } }));
|
|
1412
1444
|
const shutdown = createWorkerShutdown(worker, "auto-search", AUTO_SEARCH_WORKER_CLOSE_DEADLINE_MS);
|
|
1413
1445
|
slot = {
|
|
1414
1446
|
worker,
|
|
@@ -1486,6 +1518,7 @@ function queueAutoSearchBackfill(db, sessionId, projectPath, query) {
|
|
|
1486
1518
|
pending.set(key, work);
|
|
1487
1519
|
return work;
|
|
1488
1520
|
}
|
|
1521
|
+
var nextSearchJobId = 0;
|
|
1489
1522
|
async function executeAutoSearchWorker(db, sessionId, projectPath, query, options, entry, job) {
|
|
1490
1523
|
if (options.signal?.aborted)
|
|
1491
1524
|
return [];
|
|
@@ -1499,12 +1532,14 @@ async function executeAutoSearchWorker(db, sessionId, projectPath, query, option
|
|
|
1499
1532
|
readMessages: _readMessages,
|
|
1500
1533
|
searchMessageHistory: _searchMessageHistory,
|
|
1501
1534
|
stepTimings: _stepTimings,
|
|
1535
|
+
onAutoSearchDiagnostics: _onAutoSearchDiagnostics,
|
|
1502
1536
|
...serializable
|
|
1503
1537
|
} = options;
|
|
1504
1538
|
const lifecycle = registerAutoSearchWork(sessionId);
|
|
1505
1539
|
const signal = deadlineSignal ? AbortSignal.any([deadlineSignal, lifecycle.signal]) : lifecycle.signal;
|
|
1506
1540
|
const snapshot = getProjectEmbeddingSnapshot2(projectPath);
|
|
1507
1541
|
const input = {
|
|
1542
|
+
jobId: ++nextSearchJobId,
|
|
1508
1543
|
job,
|
|
1509
1544
|
path,
|
|
1510
1545
|
harness: getHarness2(),
|
|
@@ -1540,6 +1575,11 @@ async function executeAutoSearchWorker(db, sessionId, projectPath, query, option
|
|
|
1540
1575
|
throw new AutoSearchBusyError;
|
|
1541
1576
|
}
|
|
1542
1577
|
const { slot, fresh } = lease;
|
|
1578
|
+
if (options.autoSearchDiagnostics) {
|
|
1579
|
+
options.autoSearchDiagnostics.workerStarted = fresh;
|
|
1580
|
+
if (fresh)
|
|
1581
|
+
options.autoSearchDiagnostics.pool = "cold";
|
|
1582
|
+
}
|
|
1543
1583
|
const worker = slot.worker;
|
|
1544
1584
|
const detachable = job === "search" && entry.href === defaultAutoSearchWorkerEntry().href;
|
|
1545
1585
|
const startedAt = performance.now();
|
|
@@ -1619,6 +1659,17 @@ async function executeAutoSearchWorker(db, sessionId, projectPath, query, option
|
|
|
1619
1659
|
const onMessage = async (reply) => {
|
|
1620
1660
|
if (released)
|
|
1621
1661
|
return;
|
|
1662
|
+
if (entry.href === defaultAutoSearchWorkerEntry().href && reply.jobId !== input.jobId)
|
|
1663
|
+
return;
|
|
1664
|
+
if (reply.kind === "diagnostics") {
|
|
1665
|
+
if (!settled && options.autoSearchDiagnostics) {
|
|
1666
|
+
const workerStarted = options.autoSearchDiagnostics.workerStarted;
|
|
1667
|
+
Object.assign(options.autoSearchDiagnostics, reply.diagnostics, {
|
|
1668
|
+
workerStarted
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
return;
|
|
1672
|
+
}
|
|
1622
1673
|
if (reply.kind === "result" || reply.kind === "error") {
|
|
1623
1674
|
if (detachedAt !== undefined) {
|
|
1624
1675
|
logLateSearch(sessionId, performance.now() - detachedAt, detachedAt - startedAt, ownerVectorMs, reply.kind === "result" ? reply.timings : undefined, reply.kind === "error");
|
|
@@ -1637,7 +1688,7 @@ async function executeAutoSearchWorker(db, sessionId, projectPath, query, option
|
|
|
1637
1688
|
}
|
|
1638
1689
|
if (reply.kind === "messages" || reply.kind === "accepted")
|
|
1639
1690
|
return;
|
|
1640
|
-
const response = { id: reply.id };
|
|
1691
|
+
const response = { id: reply.id, jobId: input.jobId };
|
|
1641
1692
|
if (!signal.aborted) {
|
|
1642
1693
|
const requestedAt = performance.now();
|
|
1643
1694
|
try {
|
|
@@ -1766,7 +1817,7 @@ function searchMessageHistoryOffThread(db, request, entry = defaultAutoSearchWor
|
|
|
1766
1817
|
deadline.unref?.();
|
|
1767
1818
|
};
|
|
1768
1819
|
try {
|
|
1769
|
-
worker = inRootAsyncContext2(() => new Worker(entry, { workerData: input }));
|
|
1820
|
+
worker = inRootAsyncContext2(() => entry.href === defaultAutoSearchWorkerEntry().href ? reuseWorker(entry, { workerData: input }) : new Worker(entry, { workerData: input }));
|
|
1770
1821
|
shutdown = createWorkerShutdown(worker, "message-search", MESSAGE_SEARCH_WORKER_CLOSE_DEADLINE_MS);
|
|
1771
1822
|
} catch (error) {
|
|
1772
1823
|
finish(null, "start-failed", error);
|
|
@@ -1954,8 +2005,12 @@ function findLatestMeaningfulUserMessage(messages) {
|
|
|
1954
2005
|
async function runAutoSearchHint(args) {
|
|
1955
2006
|
const startedAt = performance.now();
|
|
1956
2007
|
const { sessionId, db, messages, options } = args;
|
|
1957
|
-
if (!options.enabled)
|
|
2008
|
+
if (!options.enabled) {
|
|
2009
|
+
const tail = findLatestMeaningfulUserMessage(messages);
|
|
2010
|
+
if (tail && typeof tail.info.id === "string" && messages.at(-1) === tail)
|
|
2011
|
+
logDisabledAutoSearch(db, sessionId, tail.info.id, options.scoreThreshold, startedAt);
|
|
1958
2012
|
return AUTO_SEARCH_OK;
|
|
2013
|
+
}
|
|
1959
2014
|
const userMsg = findLatestMeaningfulUserMessage(messages);
|
|
1960
2015
|
if (!userMsg || typeof userMsg.info.id !== "string")
|
|
1961
2016
|
return AUTO_SEARCH_OK;
|
|
@@ -1979,10 +2034,12 @@ async function runAutoSearchHint(args) {
|
|
|
1979
2034
|
if (messages.length === 0 || messages[messages.length - 1].info.id !== userMsgId) {
|
|
1980
2035
|
return AUTO_SEARCH_OK;
|
|
1981
2036
|
}
|
|
2037
|
+
const observation = observeAutoSearch(sessionId, options.scoreThreshold, startedAt);
|
|
1982
2038
|
const embeddingSnapshot = getProjectEmbeddingSnapshot2(options.projectPath);
|
|
1983
2039
|
if (!embeddingSnapshot) {
|
|
1984
2040
|
queueAutoSearchRegistration(db, options.projectPath, options.directory && options.ensureProjectRegistered ? () => options.ensureProjectRegistered?.(options.directory, db) ?? Promise.resolve() : undefined);
|
|
1985
2041
|
persistAutoSearchSkip(db, sessionId, userMsgId, "empty");
|
|
2042
|
+
observation.finish("no-candidates", "unregistered");
|
|
1986
2043
|
return AUTO_SEARCH_OK;
|
|
1987
2044
|
}
|
|
1988
2045
|
const writeNoHintAndReconcile = async (reason) => {
|
|
@@ -1993,21 +2050,24 @@ async function runAutoSearchHint(args) {
|
|
|
1993
2050
|
}, startedAt);
|
|
1994
2051
|
if (outcome === null) {
|
|
1995
2052
|
persistAutoSearchSkip(db, sessionId, userMsgId);
|
|
2053
|
+
observation.finish("timeout");
|
|
1996
2054
|
return { ok: false, kind: "timeout" };
|
|
1997
2055
|
}
|
|
1998
|
-
if (!outcome.ok)
|
|
2056
|
+
if (!outcome.ok) {
|
|
2057
|
+
observation.finish("error", outcome.kind);
|
|
1999
2058
|
return {
|
|
2000
2059
|
ok: false,
|
|
2001
2060
|
kind: outcome.kind === "storage-busy" ? "storage-busy" : "cas-exhaustion"
|
|
2002
2061
|
};
|
|
2062
|
+
}
|
|
2003
2063
|
if (outcome.kind === "already-present" && outcome.decision.decision === "hint") {
|
|
2004
2064
|
appendReminderToUserMessageById(messages, userMsgId, outcome.decision.text);
|
|
2005
2065
|
}
|
|
2066
|
+
observation.finish(outcome.decision.decision === "hint" ? "attached" : reason === "below-threshold" ? "below-threshold" : reason === "error" ? "error" : "no-candidates", reason);
|
|
2006
2067
|
return AUTO_SEARCH_OK;
|
|
2007
2068
|
};
|
|
2008
2069
|
const rawPartsText = collectUserPromptParts(userMsg);
|
|
2009
2070
|
if (hasStackedAugmentation(rawPartsText)) {
|
|
2010
|
-
sessionLog2(sessionId, "auto-search: skipping — user message already carries augmentation/hint");
|
|
2011
2071
|
return writeNoHintAndReconcile("stacked");
|
|
2012
2072
|
}
|
|
2013
2073
|
const rawPrompt = extractUserPromptText(userMsg);
|
|
@@ -2023,6 +2083,7 @@ async function runAutoSearchHint(args) {
|
|
|
2023
2083
|
const embeddingEnabled = embeddingSnapshot ? embeddingSnapshot.historyEnabled : options.embeddingEnabled;
|
|
2024
2084
|
const gitCommitsEnabled = embeddingSnapshot?.gitCommitEnabled ?? options.gitCommitsEnabled ?? false;
|
|
2025
2085
|
const searchOptions = {
|
|
2086
|
+
autoSearchDiagnostics: observation.diagnostics,
|
|
2026
2087
|
limit: 10,
|
|
2027
2088
|
maxMessageOrdinal: Math.max(0, getLastCompartmentEndMessage(db, sessionId)),
|
|
2028
2089
|
excludeMessageId: userMsgId,
|
|
@@ -2049,11 +2110,10 @@ async function runAutoSearchHint(args) {
|
|
|
2049
2110
|
if (lifecycleSignal.aborted)
|
|
2050
2111
|
return AUTO_SEARCH_OK;
|
|
2051
2112
|
if (error instanceof AutoSearchBusyError) {
|
|
2052
|
-
|
|
2113
|
+
observation.finish("timeout", "worker-busy");
|
|
2053
2114
|
persistAutoSearchSkip(db, sessionId, userMsgId);
|
|
2054
2115
|
return { ok: false, kind: "timeout" };
|
|
2055
2116
|
}
|
|
2056
|
-
log2(`[auto-search] unified search failed for session ${sessionId} (no-hint frozen for this turn): ${error instanceof Error ? error.message : String(error)}`);
|
|
2057
2117
|
const outcome = await writeNoHintAndReconcile("error");
|
|
2058
2118
|
return outcome.ok ? { ok: false, kind: "search-failure" } : outcome;
|
|
2059
2119
|
}
|
|
@@ -2061,9 +2121,8 @@ async function runAutoSearchHint(args) {
|
|
|
2061
2121
|
return AUTO_SEARCH_OK;
|
|
2062
2122
|
try {
|
|
2063
2123
|
if (results === null) {
|
|
2064
|
-
|
|
2124
|
+
observation.finish("timeout");
|
|
2065
2125
|
persistAutoSearchSkip(db, sessionId, userMsgId);
|
|
2066
|
-
sessionLog2(sessionId, "auto-search: skip frozen; retries for this turn are replay-only");
|
|
2067
2126
|
return { ok: false, kind: "timeout" };
|
|
2068
2127
|
}
|
|
2069
2128
|
if (results.length === 0) {
|
|
@@ -2071,7 +2130,6 @@ async function runAutoSearchHint(args) {
|
|
|
2071
2130
|
}
|
|
2072
2131
|
results = selectAutoSearchResults(results, options.scoreThreshold);
|
|
2073
2132
|
if (results.length === 0) {
|
|
2074
|
-
sessionLog2(sessionId, `auto-search: no fragment meets relevance threshold ${options.scoreThreshold}`);
|
|
2075
2133
|
return writeNoHintAndReconcile("below-threshold");
|
|
2076
2134
|
}
|
|
2077
2135
|
const hintText = buildAutoSearchHint(results, {
|
|
@@ -2091,18 +2149,19 @@ ${hintText}`;
|
|
|
2091
2149
|
}, startedAt);
|
|
2092
2150
|
if (outcome === null) {
|
|
2093
2151
|
persistAutoSearchSkip(db, sessionId, userMsgId);
|
|
2152
|
+
observation.finish("timeout");
|
|
2094
2153
|
return { ok: false, kind: "timeout" };
|
|
2095
2154
|
}
|
|
2096
2155
|
if (!outcome.ok) {
|
|
2156
|
+
observation.finish("error", outcome.kind);
|
|
2097
2157
|
if (outcome.kind === "storage-busy")
|
|
2098
2158
|
return { ok: false, kind: "storage-busy" };
|
|
2099
|
-
sessionLog2(sessionId, `auto-search: CAS exhausted for ${userMsgId}; skipping wire append`);
|
|
2100
2159
|
return { ok: false, kind: "cas-exhaustion" };
|
|
2101
2160
|
}
|
|
2102
2161
|
if (outcome.decision.decision === "hint") {
|
|
2103
2162
|
appendReminderToUserMessageById(messages, userMsgId, outcome.decision.text);
|
|
2104
2163
|
}
|
|
2105
|
-
|
|
2164
|
+
observation.finish(outcome.decision.decision === "hint" ? "attached" : "no-candidates");
|
|
2106
2165
|
return AUTO_SEARCH_OK;
|
|
2107
2166
|
} finally {
|
|
2108
2167
|
if (!lifecycleSignal.aborted && results !== null)
|
|
@@ -3308,6 +3367,130 @@ function degradedPassError(site, error) {
|
|
|
3308
3367
|
return new DegradedPassRefusalError(site, { cause: error });
|
|
3309
3368
|
}
|
|
3310
3369
|
|
|
3370
|
+
// src/hooks/magic-context/strip-structural-noise.ts
|
|
3371
|
+
var STRUCTURAL_PART_TYPES = new Set(["meta", "step-start", "step-finish", "reasoning"]);
|
|
3372
|
+
var structuralSentinels = new WeakSet;
|
|
3373
|
+
function isStructuralNoiseSentinel(part) {
|
|
3374
|
+
return isRecord(part) && structuralSentinels.has(part);
|
|
3375
|
+
}
|
|
3376
|
+
function isStructuralNoisePart(part) {
|
|
3377
|
+
if (!isRecord(part) || typeof part.type !== "string") {
|
|
3378
|
+
return false;
|
|
3379
|
+
}
|
|
3380
|
+
if (!STRUCTURAL_PART_TYPES.has(part.type)) {
|
|
3381
|
+
return false;
|
|
3382
|
+
}
|
|
3383
|
+
if (part.type === "reasoning" && typeof part.text === "string" && part.text !== "[cleared]") {
|
|
3384
|
+
return false;
|
|
3385
|
+
}
|
|
3386
|
+
return true;
|
|
3387
|
+
}
|
|
3388
|
+
function stripStructuralNoise(messages) {
|
|
3389
|
+
let strippedParts = 0;
|
|
3390
|
+
for (const message of messages) {
|
|
3391
|
+
if (!Array.isArray(message.parts)) {
|
|
3392
|
+
continue;
|
|
3393
|
+
}
|
|
3394
|
+
for (let i = 0;i < message.parts.length; i++) {
|
|
3395
|
+
const part = message.parts[i];
|
|
3396
|
+
if (isSentinel(part))
|
|
3397
|
+
continue;
|
|
3398
|
+
if (!isStructuralNoisePart(part))
|
|
3399
|
+
continue;
|
|
3400
|
+
message.parts[i] = makeSentinel(part);
|
|
3401
|
+
if (isRecord(part) && part.type !== "reasoning") {
|
|
3402
|
+
structuralSentinels.add(message.parts[i]);
|
|
3403
|
+
}
|
|
3404
|
+
strippedParts++;
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
return strippedParts;
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3410
|
+
// src/hooks/magic-context/project-structural-sentinels.ts
|
|
3411
|
+
function readOmissions(value) {
|
|
3412
|
+
if (value === undefined)
|
|
3413
|
+
return new Set;
|
|
3414
|
+
if (!Array.isArray(value) || value.some((id) => typeof id !== "string" || !id))
|
|
3415
|
+
throw new Error("Invalid structural-sentinel replay decisions");
|
|
3416
|
+
return new Set(value);
|
|
3417
|
+
}
|
|
3418
|
+
function hasSignedReasoning(message) {
|
|
3419
|
+
return message.info.role === "assistant" && message.parts.some((part) => {
|
|
3420
|
+
if (!isRecord(part) || part.type !== "reasoning" || !isRecord(part.metadata))
|
|
3421
|
+
return false;
|
|
3422
|
+
const anthropic = part.metadata.anthropic;
|
|
3423
|
+
return isRecord(anthropic) && typeof anthropic.signature === "string";
|
|
3424
|
+
});
|
|
3425
|
+
}
|
|
3426
|
+
function readKeepIds(document) {
|
|
3427
|
+
const value = document.structuralSentinelUpgrade;
|
|
3428
|
+
if (value === undefined)
|
|
3429
|
+
return;
|
|
3430
|
+
if (!isRecord(value) || !Array.isArray(value.keep) || value.keep.some((id) => typeof id !== "string" || !id))
|
|
3431
|
+
throw new Error("Invalid structural-sentinel upgrade");
|
|
3432
|
+
return new Set(value.keep);
|
|
3433
|
+
}
|
|
3434
|
+
function prepareStructuralSentinelChoices(args) {
|
|
3435
|
+
const document = readReplayEnvelope(args.db, args.sessionId);
|
|
3436
|
+
if (readKeepIds(document))
|
|
3437
|
+
return document;
|
|
3438
|
+
const prior = !!args.db.prepare(`SELECT 1 WHERE
|
|
3439
|
+
EXISTS (SELECT 1 FROM session_meta WHERE session_id = ? AND trailing_blank_decisions <> '')
|
|
3440
|
+
OR EXISTS (SELECT 1 FROM session_replay_decisions WHERE session_id = ?)
|
|
3441
|
+
OR EXISTS (SELECT 1 FROM tags WHERE session_id = ?)
|
|
3442
|
+
OR EXISTS (SELECT 1 FROM lkg_slots WHERE session_id = ?)`).get(args.sessionId, args.sessionId, args.sessionId, args.sessionId);
|
|
3443
|
+
try {
|
|
3444
|
+
const persisted = updateReplayDocument(args.db, args.sessionId, (current) => {
|
|
3445
|
+
if (readKeepIds(current))
|
|
3446
|
+
return false;
|
|
3447
|
+
current.version = 2;
|
|
3448
|
+
current.structuralSentinelUpgrade = {
|
|
3449
|
+
keep: prior ? args.messages.flatMap((message) => message.info.id && hasSignedReasoning(message) ? [message.info.id] : []) : []
|
|
3450
|
+
};
|
|
3451
|
+
return true;
|
|
3452
|
+
});
|
|
3453
|
+
if (!persisted)
|
|
3454
|
+
throw new Error("Cannot persist structural-sentinel upgrade");
|
|
3455
|
+
} catch (error) {
|
|
3456
|
+
sessionLog2(args.sessionId, `structural-sentinel upgrade deferred: ${String(error)}`);
|
|
3457
|
+
return document;
|
|
3458
|
+
}
|
|
3459
|
+
return readReplayEnvelope(args.db, args.sessionId);
|
|
3460
|
+
}
|
|
3461
|
+
function projectStructuralSentinels(args) {
|
|
3462
|
+
const structuralMessages = args.messages.filter((message) => message.parts.some(isStructuralNoiseSentinel));
|
|
3463
|
+
if (structuralMessages.length === 0)
|
|
3464
|
+
return 0;
|
|
3465
|
+
const document = args.deferUpgrade ? readReplayEnvelope(args.db, args.sessionId) : prepareStructuralSentinelChoices(args);
|
|
3466
|
+
const keepIds = args.deferUpgrade ? undefined : readKeepIds(document);
|
|
3467
|
+
let omittedIds = readOmissions(document.structuralSentinelOmissions);
|
|
3468
|
+
const candidates = structuralMessages.filter((message) => typeof message.info.id === "string" && message.info.id !== "" && hasSignedReasoning(message));
|
|
3469
|
+
const selected = keepIds && args.rebuilding ? candidates.filter((message) => keepIds.has(message.info.id ?? "") && !omittedIds.has(message.info.id ?? "")) : [];
|
|
3470
|
+
if (selected.length) {
|
|
3471
|
+
if (!updateReplayDocument(args.db, args.sessionId, (document) => {
|
|
3472
|
+
const ids = readOmissions(document.structuralSentinelOmissions);
|
|
3473
|
+
for (const message of selected) {
|
|
3474
|
+
ids.add(message.info.id);
|
|
3475
|
+
}
|
|
3476
|
+
document.version = 2;
|
|
3477
|
+
document.structuralSentinelOmissions = [...ids];
|
|
3478
|
+
return true;
|
|
3479
|
+
}))
|
|
3480
|
+
throw new Error("Cannot persist structural-sentinel omissions");
|
|
3481
|
+
omittedIds = readOmissions(readReplayEnvelope(args.db, args.sessionId).structuralSentinelOmissions);
|
|
3482
|
+
}
|
|
3483
|
+
let removed = 0;
|
|
3484
|
+
for (const message of candidates) {
|
|
3485
|
+
if (!omittedIds.has(message.info.id ?? "") && (!keepIds || keepIds.has(message.info.id ?? "")))
|
|
3486
|
+
continue;
|
|
3487
|
+
const parts = message.parts.filter((part) => !isStructuralNoiseSentinel(part));
|
|
3488
|
+
removed += message.parts.length - parts.length;
|
|
3489
|
+
message.parts = parts;
|
|
3490
|
+
}
|
|
3491
|
+
return removed;
|
|
3492
|
+
}
|
|
3493
|
+
|
|
3311
3494
|
// src/features/magic-context/storage-host-instruction-retention.ts
|
|
3312
3495
|
var NAMESPACE3 = "hostInstructionRetention";
|
|
3313
3496
|
var enabled = true;
|
|
@@ -3473,6 +3656,50 @@ function renderConvertedToolSkeletons(targets, converted) {
|
|
|
3473
3656
|
}
|
|
3474
3657
|
return didMutate;
|
|
3475
3658
|
}
|
|
3659
|
+
function prepareAgedToolSkeletonConversions(db, sessionId, targets, options = {}) {
|
|
3660
|
+
const candidates = [...targets.keys()].sort((a, b) => a - b);
|
|
3661
|
+
const readRows = (connection) => {
|
|
3662
|
+
const window = getNewestToolTagNumbers2(connection, sessionId, RECENT_TOOL_SKELETON_WINDOW);
|
|
3663
|
+
const recent = new Set(window);
|
|
3664
|
+
const statement = connection.prepare(`SELECT tag_number AS tagNumber, drop_mode AS dropMode, message_id AS callId
|
|
3665
|
+
FROM tags WHERE session_id = ? AND tag_number = ?
|
|
3666
|
+
AND type = 'tool' AND status = 'dropped'
|
|
3667
|
+
AND drop_mode IN ('truncated', 'skeleton_real', 'skeleton_stripped')`);
|
|
3668
|
+
const rows = candidates.filter((id) => !recent.has(id)).flatMap((id) => {
|
|
3669
|
+
const row = statement.get(sessionId, id);
|
|
3670
|
+
return row ? [row] : [];
|
|
3671
|
+
});
|
|
3672
|
+
return { window, rows };
|
|
3673
|
+
};
|
|
3674
|
+
const snapshot = readRows(db);
|
|
3675
|
+
options.prepareRemovals?.(snapshot.rows);
|
|
3676
|
+
const converted = new Map;
|
|
3677
|
+
const plannedRemovals = new Set;
|
|
3678
|
+
for (const row of snapshot.rows) {
|
|
3679
|
+
const target = targets.get(row.tagNumber);
|
|
3680
|
+
if (target?.thinkingDropProtected || target?.thinkingRewriteProtected || target?.identityRepairProtected)
|
|
3681
|
+
continue;
|
|
3682
|
+
if (target?.canDrop?.() !== true || target.prepareDrop?.() === false)
|
|
3683
|
+
continue;
|
|
3684
|
+
if (target.requiresToolArcSkeleton) {
|
|
3685
|
+
const owners = target.mutationParts ? target.mutationParts.map(({ message }) => message).filter((message) => message.info.role === "assistant") : target.message ? [target.message] : [];
|
|
3686
|
+
if (owners.length === 0 || owners.some((message) => !options.thinkingStrippedIds?.has(message.info.id ?? "")))
|
|
3687
|
+
continue;
|
|
3688
|
+
}
|
|
3689
|
+
if (target.cannotRemove?.() === true || target.wouldStrandConversationEnd?.(plannedRemovals) === true)
|
|
3690
|
+
continue;
|
|
3691
|
+
converted.set(row.tagNumber, "full");
|
|
3692
|
+
target.notePlannedRemoval?.(plannedRemovals);
|
|
3693
|
+
}
|
|
3694
|
+
return {
|
|
3695
|
+
converted,
|
|
3696
|
+
isCurrent: (connection) => JSON.stringify(readRows(connection)) === JSON.stringify(snapshot),
|
|
3697
|
+
persist: (connection) => {
|
|
3698
|
+
for (const tagNumber of converted.keys())
|
|
3699
|
+
updateTagDropMode2(connection, sessionId, tagNumber, "full");
|
|
3700
|
+
}
|
|
3701
|
+
};
|
|
3702
|
+
}
|
|
3476
3703
|
var PENDING_OPERATION_CHUNK_SIZE = 64;
|
|
3477
3704
|
function applyPendingOperations(sessionId, db, targets, protectedTagIds, preloadedTags, preloadedPendingOps, syntheticPendingOps = [], editMarkerTagIds = new Set, onTagReduced, onBatchComplete, onEligibilitySnapshot) {
|
|
3478
3705
|
let didMutateMessage = false;
|
|
@@ -4548,38 +4775,6 @@ ${typeof state?.output === "string" ? state.output : JSON.stringify(state?.outpu
|
|
|
4548
4775
|
text: typeof part.text === "string" ? part.text : typeof part.thinking === "string" ? part.thinking : undefined
|
|
4549
4776
|
};
|
|
4550
4777
|
}
|
|
4551
|
-
// src/hooks/magic-context/strip-structural-noise.ts
|
|
4552
|
-
var STRUCTURAL_PART_TYPES = new Set(["meta", "step-start", "step-finish", "reasoning"]);
|
|
4553
|
-
function isStructuralNoisePart(part) {
|
|
4554
|
-
if (!isRecord(part) || typeof part.type !== "string") {
|
|
4555
|
-
return false;
|
|
4556
|
-
}
|
|
4557
|
-
if (!STRUCTURAL_PART_TYPES.has(part.type)) {
|
|
4558
|
-
return false;
|
|
4559
|
-
}
|
|
4560
|
-
if (part.type === "reasoning" && typeof part.text === "string" && part.text !== "[cleared]") {
|
|
4561
|
-
return false;
|
|
4562
|
-
}
|
|
4563
|
-
return true;
|
|
4564
|
-
}
|
|
4565
|
-
function stripStructuralNoise(messages) {
|
|
4566
|
-
let strippedParts = 0;
|
|
4567
|
-
for (const message of messages) {
|
|
4568
|
-
if (!Array.isArray(message.parts)) {
|
|
4569
|
-
continue;
|
|
4570
|
-
}
|
|
4571
|
-
for (let i = 0;i < message.parts.length; i++) {
|
|
4572
|
-
const part = message.parts[i];
|
|
4573
|
-
if (isSentinel(part))
|
|
4574
|
-
continue;
|
|
4575
|
-
if (!isStructuralNoisePart(part))
|
|
4576
|
-
continue;
|
|
4577
|
-
message.parts[i] = makeSentinel(part);
|
|
4578
|
-
strippedParts++;
|
|
4579
|
-
}
|
|
4580
|
-
}
|
|
4581
|
-
return strippedParts;
|
|
4582
|
-
}
|
|
4583
4778
|
// src/hooks/magic-context/foreign-text-parts.ts
|
|
4584
4779
|
function hasStringId(part) {
|
|
4585
4780
|
return part !== null && typeof part === "object" && typeof part.id === "string";
|
|
@@ -6070,6 +6265,9 @@ async function runPostTransformPhase2(args) {
|
|
|
6070
6265
|
}
|
|
6071
6266
|
};
|
|
6072
6267
|
const trailingBlankSourceDecisions = args.trailingBlankSourceDecisions ?? snapshotTrailingBlankSourceDecisions(args.messages);
|
|
6268
|
+
let structuralSentinelUpgradeFailed = args.structuralSentinelUpgradeFailed ?? false;
|
|
6269
|
+
if (!structuralSentinelUpgradeFailed && args.opencode1 && !compactionOff && modelAcceptsEmptyContent(args.resolvedProviderID))
|
|
6270
|
+
structuralSentinelUpgradeFailed = prepareStructuralSentinelChoices(args).structuralSentinelUpgrade === undefined;
|
|
6073
6271
|
if (!modelAcceptsEmptyContent(args.resolvedProviderID) && !compactionOff)
|
|
6074
6272
|
captureInlineThinkingRepairs(args.messages, args.messageTagNumbers, args.sessionMeta?.clearedReasoningThroughTag ?? 0);
|
|
6075
6273
|
const servedShapeRepair = prepareServedShapeRepair(args.db, args.sessionId, args.messages, args.readLastServedMessages, compactionOff ? undefined : postprocessReplaySnapshot(args.db, args.sessionId));
|
|
@@ -6188,6 +6386,8 @@ async function runPostTransformPhase2(args) {
|
|
|
6188
6386
|
const servedBeforeFirstRender = firstRenderBust ? args.readLastServedMessages?.() : null;
|
|
6189
6387
|
let foldExecutedThisPass = false;
|
|
6190
6388
|
let foldBustsServedPrefixThisPass = false;
|
|
6389
|
+
let foldChangesHeadThisPass = false;
|
|
6390
|
+
let recoveryExternalFoldCause = null;
|
|
6191
6391
|
let publishedM1RefreshedThisPass = false;
|
|
6192
6392
|
let prefixPreflightFailed = false;
|
|
6193
6393
|
const softRefreshOpportunity = !freezeM0M1 && (args.schedulerDecision === "execute" || deferredMaterialize || servedShapeRepair.needsRebuild);
|
|
@@ -6266,9 +6466,16 @@ async function runPostTransformPhase2(args) {
|
|
|
6266
6466
|
prefixPreflightFailed = foldResult.materializationContentionRetryExhausted === true;
|
|
6267
6467
|
foldExecutedThisPass = foldExecutesThisPass(foldDueDecision.value || softRefreshOpportunity, foldResult.m0RematerializedThisPass);
|
|
6268
6468
|
foldBustsServedPrefixThisPass = foldExecutedThisPass && (committedFoldBustsServedPrefix ?? true);
|
|
6469
|
+
foldChangesHeadThisPass = foldExecutedThisPass && committedFoldChangesHead === true;
|
|
6269
6470
|
publishedM1RefreshedThisPass = !foldResult.materializationContentionRetryExhausted && previousM1 !== args.sessionMeta.cachedM1Bytes?.toString("utf8");
|
|
6270
6471
|
m0RematerializedThisPass = foldResult.m0RematerializedThisPass;
|
|
6271
6472
|
m0MaterializeReason = foldResult.decision.reason;
|
|
6473
|
+
if (!prefixPreflightFailed && foldExecutedThisPass) {
|
|
6474
|
+
const decision = foldResult.decision;
|
|
6475
|
+
if (decision.reason === "system_hash" && decision.systemHashPrev && decision.systemHashPrev !== "0" || decision.reason === "model_change" && decision.m0ModelKeyPrev || decision.reason === "tool_definitions") {
|
|
6476
|
+
recoveryExternalFoldCause = decision.reason;
|
|
6477
|
+
}
|
|
6478
|
+
}
|
|
6272
6479
|
if (foldResult.m0RematerializedThisPass && convertedToolSkeletons.size > 0) {
|
|
6273
6480
|
convertedToolSkeletonsDidMutate = renderConvertedToolSkeletons(args.targets, convertedToolSkeletons);
|
|
6274
6481
|
sessionLog2(args.sessionId, `HARD fold converted ${convertedToolSkeletons.size} legacy dropped-tool skeleton(s) to real-or-absent`);
|
|
@@ -6371,8 +6578,14 @@ async function runPostTransformPhase2(args) {
|
|
|
6371
6578
|
newTargets = args.targets;
|
|
6372
6579
|
}
|
|
6373
6580
|
}
|
|
6581
|
+
const recoveryHasHistoryHead = m0M1EnabledForFold || (args.pendingCompartmentInjection?.compartmentCount ?? 0) > 0;
|
|
6582
|
+
const recoveryHeadChangedThisPass = !prefixPreflightFailed && (foldChangesHeadThisPass || !firstRenderBust && publishedM1RefreshedThisPass || !m0M1EnabledForFold && legacyPublishedHeadChanged(args));
|
|
6583
|
+
const recoveryHeadlessRebuild = !recoveryHasHistoryHead && (args.schedulerDecision === "execute" || isExplicitFlush || forceMaterialization || emergencyDropEligible);
|
|
6584
|
+
const recoveredShapeRewriteProof = recoveryHeadChangedThisPass ? "head_bytes" : recoveryExternalFoldCause ?? (recoveryHeadlessRebuild ? "headless_rebuild" : null);
|
|
6585
|
+
const canNormalizeRecoveredShape = isCacheBustingPass && !activeThinkingPrefixHold && recoveredShapeRewriteProof !== null;
|
|
6586
|
+
sessionLog2(args.sessionId, `rewrite permission: allowed=${isCacheBustingPass} ${reclaimRideLabel(rideSignals)} served_shape_repair=${servedShapeRepair.needsRebuild} signed_prefix_release=${rewritingSignedPrefix} fold_prefix_loss=${foldBustsServedPrefixThisPass} first_render=${firstRenderBust} idle_expiry=${idleExpiryRebuild} thinking_hold=${activeThinkingPrefixHold} recovery_has_head=${recoveryHasHistoryHead} recovery_head_changed=${recoveryHeadChangedThisPass} recovery_headless_rebuild=${recoveryHeadlessRebuild} proven_external_fold=${recoveryExternalFoldCause ?? "none"} recovered_shape_proof=${recoveredShapeRewriteProof ?? "none"}`);
|
|
6374
6587
|
let recoveryTailNormalizedThisPass = false;
|
|
6375
|
-
if (args.normalizeRecoveryTail &&
|
|
6588
|
+
if (args.normalizeRecoveryTail && canNormalizeRecoveredShape) {
|
|
6376
6589
|
args.normalizeRecoveryTail();
|
|
6377
6590
|
recoveryTailNormalizedThisPass = true;
|
|
6378
6591
|
args.tags = getTagsBySession2(args.db, args.sessionId);
|
|
@@ -6771,6 +6984,20 @@ async function runPostTransformPhase2(args) {
|
|
|
6771
6984
|
}
|
|
6772
6985
|
}
|
|
6773
6986
|
}
|
|
6987
|
+
if (!args.fullFeatureMode && canEditWholePrefix && !compactionOff) {
|
|
6988
|
+
const thinkingStrippedIds = new Set([...bindingThinking, ...removedReasoningIds]);
|
|
6989
|
+
for (const id of getMergedReasoningStrippedIds(args.db, args.sessionId)) {
|
|
6990
|
+
if (id.startsWith(THINKING_BINDING_RECOVERY_FROZEN_PREFIX))
|
|
6991
|
+
thinkingStrippedIds.add(id.slice(THINKING_BINDING_RECOVERY_FROZEN_PREFIX.length));
|
|
6992
|
+
}
|
|
6993
|
+
const conversions = prepareAgedToolSkeletonConversions(args.db, args.sessionId, newTargets, { thinkingStrippedIds });
|
|
6994
|
+
args.db.transaction(() => {
|
|
6995
|
+
if (!conversions.isCurrent(args.db))
|
|
6996
|
+
throw new Error("Subagent skeleton candidates changed before commit");
|
|
6997
|
+
conversions.persist(args.db);
|
|
6998
|
+
}).immediate();
|
|
6999
|
+
convertedToolSkeletonsDidMutate = renderConvertedToolSkeletons(newTargets, conversions.converted) || convertedToolSkeletonsDidMutate;
|
|
7000
|
+
}
|
|
6774
7001
|
const tBatchFinalize = performance.now();
|
|
6775
7002
|
args.batch?.finalize();
|
|
6776
7003
|
if (toolReclaimApplicationOpportunity) {
|
|
@@ -7181,6 +7408,18 @@ async function runPostTransformPhase2(args) {
|
|
|
7181
7408
|
}
|
|
7182
7409
|
autoSearchHintAppendedThisPass = autoSearchCompletedThisPass && countAutoSearchHints(args.db, args.sessionId) !== autoSearchHintsBefore;
|
|
7183
7410
|
logTransformTiming(args.sessionId, "pp.autoSearchHint", tAutoSearch);
|
|
7411
|
+
} else if (args.fullFeatureMode && args.autoSearch && !args.autoSearch.enabled && args.projectPath) {
|
|
7412
|
+
await runAutoSearchHint({
|
|
7413
|
+
sessionId: args.sessionId,
|
|
7414
|
+
db: args.db,
|
|
7415
|
+
messages: args.messages,
|
|
7416
|
+
options: {
|
|
7417
|
+
enabled: false,
|
|
7418
|
+
scoreThreshold: args.autoSearch.scoreThreshold,
|
|
7419
|
+
minPromptChars: args.autoSearch.minPromptChars,
|
|
7420
|
+
projectPath: args.projectPath
|
|
7421
|
+
}
|
|
7422
|
+
});
|
|
7184
7423
|
}
|
|
7185
7424
|
if (args.fullFeatureMode && canEditWholePrefix) {
|
|
7186
7425
|
const visibleIds = new Set;
|
|
@@ -7464,6 +7703,19 @@ async function runPostTransformPhase2(args) {
|
|
|
7464
7703
|
if (reasoningRemovalEnabled)
|
|
7465
7704
|
removeReasoningParts(args.messages, removedReasoningIds, args.resolvedProviderID);
|
|
7466
7705
|
}
|
|
7706
|
+
const releaseRecoveryThisPass = canEditWholePrefix;
|
|
7707
|
+
if (releaseRecoveryThisPass)
|
|
7708
|
+
args.releaseRecoveryPrefix?.();
|
|
7709
|
+
sessionLog2(args.sessionId, `recovery projection: case=${canNormalizeRecoveredShape ? recoveredShapeRewriteProof : releaseRecoveryThisPass ? "conversation_only" : "defer"} released=${releaseRecoveryThisPass} normalized=${recoveryTailNormalizedThisPass}`);
|
|
7710
|
+
if (canUseEmptySentinels && args.opencode1) {
|
|
7711
|
+
projectStructuralSentinels({
|
|
7712
|
+
db: args.db,
|
|
7713
|
+
sessionId: args.sessionId,
|
|
7714
|
+
messages: args.messages,
|
|
7715
|
+
rebuilding: canNormalizeRecoveredShape && bustedThisPass,
|
|
7716
|
+
deferUpgrade: structuralSentinelUpgradeFailed
|
|
7717
|
+
});
|
|
7718
|
+
}
|
|
7467
7719
|
sessionLog2(args.sessionId, `final representation: clearedParts=${finalRepresentation.clearedParts} mergedReasoningParts=${finalRepresentation.mergedReasoningParts} removedReasoningParts=${removedReasoningParts} settledDroppedReasoning=${settledDroppedReasoning}`);
|
|
7468
7720
|
logTransformTiming(args.sessionId, "finalizeMessageRepresentation", tFinalRepresentation, `clearedParts=${finalRepresentation.clearedParts} mergedReasoningParts=${finalRepresentation.mergedReasoningParts}`);
|
|
7469
7721
|
const tTailBaseline = performance.now();
|
|
@@ -7601,4 +7853,4 @@ function checkM0MutationDriftAndSignal2(args) {
|
|
|
7601
7853
|
return false;
|
|
7602
7854
|
}
|
|
7603
7855
|
|
|
7604
|
-
export { makeToolCompositeKey, createTagger, cavemanWordRulesForLanguage, searchMessageHistoryOffThread, findSessionId, findLastUserMessageId, clearAutoSearchForSession, setCtxReduceRegisteredGlobally, resolveCtxReduceAvailabilityFromMessages, resolveCtxReduceAvailability, primeCtxReduceSpawnPermission, ctxReduceSpawnPermissionReadNeeded, spawnAgentFromMessages, spawnAgentFromOpenCodeDb, todowritePermissionDenied, cachedToolPermissionDenied, clearToolPermissionDenied, resolveTodowriteAvailabilityFromMessages, resolveTodowriteAvailability, diagnosticStateChanged, clearDiagnosticLogState, canConsumeDeferredOnThisPass, hasReclaimRide, reclaimRidePermitted, reclaimRideLabel, pendingDropEligibilityKey, createPendingDropEligibilityCache, readExecuteReclaimState, writeExecuteReclaimState, maintainExecuteFloorMark, captureOpencodeReasoningBudgetStatus, reasoningBudgetStatusLine, ENGINE_RECONNECTING_USER_MESSAGE, ENGINE_BUSY_USER_MESSAGE, SIGNED_THINKING_RESET_FENCE_FAILED, contextRefusalError, protectedToolRefusal, outgoingContextRefusal, signedTurnContextRefusal, EmergencyFailClosedError, latestAssistantTurnStart, latestAssistantTurnMessages, hasActiveAnthropicThinkingTurn, replayCavemanCompression, DegradedPassRefusalError, degradedPassError, renderDroppedText, applyFlushedStatuses, prewarmTagOwners, waitForTagOwners,
|
|
7856
|
+
export { makeToolCompositeKey, createTagger, cavemanWordRulesForLanguage, searchMessageHistoryOffThread, findSessionId, findLastUserMessageId, clearAutoSearchForSession, setCtxReduceRegisteredGlobally, resolveCtxReduceAvailabilityFromMessages, resolveCtxReduceAvailability, primeCtxReduceSpawnPermission, ctxReduceSpawnPermissionReadNeeded, spawnAgentFromMessages, spawnAgentFromOpenCodeDb, todowritePermissionDenied, cachedToolPermissionDenied, clearToolPermissionDenied, resolveTodowriteAvailabilityFromMessages, resolveTodowriteAvailability, diagnosticStateChanged, clearDiagnosticLogState, canConsumeDeferredOnThisPass, hasReclaimRide, reclaimRidePermitted, reclaimRideLabel, pendingDropEligibilityKey, createPendingDropEligibilityCache, readExecuteReclaimState, writeExecuteReclaimState, maintainExecuteFloorMark, captureOpencodeReasoningBudgetStatus, reasoningBudgetStatusLine, ENGINE_RECONNECTING_USER_MESSAGE, ENGINE_BUSY_USER_MESSAGE, SIGNED_THINKING_RESET_FENCE_FAILED, contextRefusalError, protectedToolRefusal, outgoingContextRefusal, signedTurnContextRefusal, EmergencyFailClosedError, latestAssistantTurnStart, latestAssistantTurnMessages, hasActiveAnthropicThinkingTurn, replayCavemanCompression, DegradedPassRefusalError, degradedPassError, isStructuralNoiseSentinel, stripStructuralNoise, prepareStructuralSentinelChoices, renderDroppedText, applyFlushedStatuses, prewarmTagOwners, waitForTagOwners, collectForeignTextParts, isLegacyForeignTextTag, withTransformTimingSummary, logTransformTiming, hasRecentAssistantCommit, tagMessages, resetDegradedCacheCount2, isSyntheticHeadMessage2, applyTodoSynthesis2, freezeReasoningOnBustingPass2, servesThinkingBlock2, firstServedDivergenceIndex2, rustModeServedKeyAfterPersistedStrips2, replayRustModeBindingMismatchStrips2, RUST_MARKER_LOCK_SKIP_LOG2, applyRustModeDeferredCompactionMarker2, clearRustModeBoundaryRecord2, runRustModePostprocess2, reconcileMarkerRepresentation2, clearPendingCompactionMarkerAfterSuccessfulDrain2, defaultCompactionMarkerStrategy2, abortSessionFailClosed2, evaluateEmergencyFailClosed2, finalizeMessageRepresentation2, runPostTransformPhase2, checkM0MutationDriftAndSignal2 };
|