@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
|
@@ -25,13 +25,15 @@ import {
|
|
|
25
25
|
} from "./index-g2q4htwp.js";
|
|
26
26
|
import {
|
|
27
27
|
sanitizeDiagnosticText,
|
|
28
|
-
hasShareabilitySensitiveText
|
|
28
|
+
hasShareabilitySensitiveText
|
|
29
|
+
} from "./index-z4p0ry94.js";
|
|
30
|
+
import {
|
|
29
31
|
classifyStalePluginBuild,
|
|
30
32
|
importPluginModule,
|
|
31
33
|
log2,
|
|
32
34
|
sessionLog2,
|
|
33
35
|
getLoggerDiagnostics2
|
|
34
|
-
} from "./index-
|
|
36
|
+
} from "./index-jrfre9ah.js";
|
|
35
37
|
import {
|
|
36
38
|
resolveOpenCodeDbPath,
|
|
37
39
|
assertOpenCodeStoreGeneration,
|
|
@@ -46,6 +48,7 @@ import {
|
|
|
46
48
|
import {
|
|
47
49
|
inRootAsyncContext2,
|
|
48
50
|
Database2,
|
|
51
|
+
getSqliteDatabasePath2,
|
|
49
52
|
getSqliteMemoryStats2,
|
|
50
53
|
withSqliteBackgroundWriter2,
|
|
51
54
|
withSqliteTransformPass2,
|
|
@@ -69,7 +72,7 @@ import {
|
|
|
69
72
|
storedPathBelongsToIdentity,
|
|
70
73
|
beginBootQuietPeriod,
|
|
71
74
|
scheduleAfterBootQuiet
|
|
72
|
-
} from "./index-
|
|
75
|
+
} from "./index-txs8tce6.js";
|
|
73
76
|
import {
|
|
74
77
|
recordSessionProjectIdentity,
|
|
75
78
|
hasRecordedSessionProjectIdentity,
|
|
@@ -79,7 +82,7 @@ import {
|
|
|
79
82
|
markGitSweepSuccessAndRelease,
|
|
80
83
|
parkGitSweepNonIndexable,
|
|
81
84
|
releaseGitSweepLease
|
|
82
|
-
} from "./index-
|
|
85
|
+
} from "./index-jz5bk7xd.js";
|
|
83
86
|
import {
|
|
84
87
|
getMagicContextBuiltinCommands,
|
|
85
88
|
formatConfigParseStatusLine,
|
|
@@ -101,82 +104,6 @@ import {
|
|
|
101
104
|
DREAMER_CLASSIFIER_AGENT,
|
|
102
105
|
DREAMER_DOCS_AGENT,
|
|
103
106
|
DREAMER_REVIEWER_AGENT,
|
|
104
|
-
getCompartments,
|
|
105
|
-
getLastCompartmentEndMessage,
|
|
106
|
-
getLastCompartmentEndMessageId,
|
|
107
|
-
providerResponseFailed,
|
|
108
|
-
LkgRecoveryFenceError,
|
|
109
|
-
lkgServedArrayDigest,
|
|
110
|
-
hasCleanLkgRecoveryFence,
|
|
111
|
-
dirtyLkgRecoveryRevision,
|
|
112
|
-
ownsLkgDirtyFence,
|
|
113
|
-
invalidateCleanLkgRecoveryFence,
|
|
114
|
-
prepareLkgCaptureFence,
|
|
115
|
-
certifyCommittedLkgCapture,
|
|
116
|
-
markLkgRecoveryDirty,
|
|
117
|
-
getOrCreateSessionMeta,
|
|
118
|
-
updateSessionMeta,
|
|
119
|
-
retryPendingSessionCleanups,
|
|
120
|
-
retryPendingRustSessionCleanupsForProject,
|
|
121
|
-
requestPendingMaterialization,
|
|
122
|
-
hasPendingMaterializationOrigin,
|
|
123
|
-
clearPendingMaterialization,
|
|
124
|
-
recordSystemPromptForRequest,
|
|
125
|
-
recordHeldHeadForRequest,
|
|
126
|
-
isHeldHeadForRequest,
|
|
127
|
-
deferDeliveredSystemRefresh,
|
|
128
|
-
retirePendingSystemPromptDelivery,
|
|
129
|
-
claimLkgRequestIdentity,
|
|
130
|
-
currentLkgRequestIdentity,
|
|
131
|
-
noteCapturedLkgRequest,
|
|
132
|
-
measuredLkgPrefix,
|
|
133
|
-
saveLkgSlotToDb,
|
|
134
|
-
clearPersistedLkgSlotStrict,
|
|
135
|
-
loadPersistedLkgSlot,
|
|
136
|
-
drainStaleLkgSlots,
|
|
137
|
-
resolveLkgModelKeys,
|
|
138
|
-
createLkgEntryProjector,
|
|
139
|
-
captureLkgSlot,
|
|
140
|
-
validateAnthropicReasoningRuns,
|
|
141
|
-
validateLkgSeam,
|
|
142
|
-
replayLkg,
|
|
143
|
-
coldStartRawServedIndex,
|
|
144
|
-
coldStartUncapturedReplay,
|
|
145
|
-
noteUncertifiedNormalLkg,
|
|
146
|
-
hasProcessLocalLkgProof,
|
|
147
|
-
lkgDirtyRevision,
|
|
148
|
-
rememberLkgDirtyRevision,
|
|
149
|
-
readPersistedLkgUntaggedInputIds,
|
|
150
|
-
persistLkgUntaggedInputIds,
|
|
151
|
-
noteLkgRecoveryPrefix,
|
|
152
|
-
readLkgRecoveryPrefix,
|
|
153
|
-
noteLkgHealthyPrefix,
|
|
154
|
-
lkgRecoveryReplayUnproven,
|
|
155
|
-
lkgRecoveryEntryUnproven,
|
|
156
|
-
lkgInputIdentity,
|
|
157
|
-
beginLkgPass,
|
|
158
|
-
visitMessageContentFields,
|
|
159
|
-
contentSnapshotValue,
|
|
160
|
-
messageContentFields,
|
|
161
|
-
signatureForFields,
|
|
162
|
-
exactReusablePrefix,
|
|
163
|
-
incrementalLkgContentDigests,
|
|
164
|
-
lkgSlotRejection,
|
|
165
|
-
captureSlot,
|
|
166
|
-
getInMemorySlot,
|
|
167
|
-
getSlot,
|
|
168
|
-
forgetInMemorySlot,
|
|
169
|
-
dropSlot,
|
|
170
|
-
noteEntry,
|
|
171
|
-
getLkgSlotHeapStats,
|
|
172
|
-
TOOL_SWEEP_SCOPED_MARKER,
|
|
173
|
-
useScopedToolSweep,
|
|
174
|
-
createPreAdoptionToolSweepResolver,
|
|
175
|
-
queueMemoryMutation,
|
|
176
|
-
getMaxMemoryMutationIdForProjects,
|
|
177
|
-
GLOBAL_USER_PROFILE_PROJECT_PATH,
|
|
178
|
-
getProjectState,
|
|
179
|
-
bumpProjectUserProfileVersion,
|
|
180
107
|
createChildSessionWithFence,
|
|
181
108
|
HiddenCompletionRefusal,
|
|
182
109
|
DreamerProviderOutputFailureError,
|
|
@@ -264,7 +191,7 @@ import {
|
|
|
264
191
|
snapRangeToCompartments,
|
|
265
192
|
getActiveCompartmentRun,
|
|
266
193
|
startCompartmentAgent
|
|
267
|
-
} from "./index-
|
|
194
|
+
} from "./index-9tdvbdv1.js";
|
|
268
195
|
import {
|
|
269
196
|
hasTrustedAbsoluteWall,
|
|
270
197
|
applyProvenInputFloor,
|
|
@@ -276,7 +203,7 @@ import {
|
|
|
276
203
|
deriveTriggerBudget2,
|
|
277
204
|
resolveKnownHistorianContextLimit2,
|
|
278
205
|
resolveHistorianProducerLimits2
|
|
279
|
-
} from "./index-
|
|
206
|
+
} from "./index-dnqqqc5f.js";
|
|
280
207
|
import {
|
|
281
208
|
resolveModelCalibration,
|
|
282
209
|
calibrateBuckets,
|
|
@@ -290,7 +217,7 @@ import {
|
|
|
290
217
|
estimateTokens,
|
|
291
218
|
estimateFixedPromptTokens,
|
|
292
219
|
normalizeText
|
|
293
|
-
} from "./index-
|
|
220
|
+
} from "./index-4xyjr62e.js";
|
|
294
221
|
import {
|
|
295
222
|
protectedToolTokenCount,
|
|
296
223
|
peelLeadingMcTagNotation,
|
|
@@ -298,6 +225,7 @@ import {
|
|
|
298
225
|
currentReclaimableToolOutputCount,
|
|
299
226
|
isRecord,
|
|
300
227
|
contentTagOwnerMessageId,
|
|
228
|
+
providerVisiblePart,
|
|
301
229
|
normalizeTodoStateJson,
|
|
302
230
|
computeSyntheticCallId,
|
|
303
231
|
CHANNEL1_SENTINEL,
|
|
@@ -325,15 +253,21 @@ import {
|
|
|
325
253
|
getDroppedTagsBySession2,
|
|
326
254
|
getTagsByNumbers2,
|
|
327
255
|
getDroppedTagsByNumbers2,
|
|
328
|
-
getMaxDroppedTagNumber2
|
|
329
|
-
|
|
330
|
-
} from "./index-np3rgfw4.js";
|
|
256
|
+
getMaxDroppedTagNumber2
|
|
257
|
+
} from "./index-8jjjmhab.js";
|
|
331
258
|
import {
|
|
332
259
|
observeTemporalDecisions,
|
|
333
260
|
stableStringify
|
|
334
|
-
} from "./index-
|
|
261
|
+
} from "./index-9wnbnx8f.js";
|
|
335
262
|
import {
|
|
336
263
|
withContentLanguageDirective,
|
|
264
|
+
string,
|
|
265
|
+
number,
|
|
266
|
+
boolean,
|
|
267
|
+
array,
|
|
268
|
+
object,
|
|
269
|
+
tuple,
|
|
270
|
+
literal,
|
|
337
271
|
parseCron,
|
|
338
272
|
nextOccurrence,
|
|
339
273
|
nextDueAtMs,
|
|
@@ -344,14 +278,14 @@ import {
|
|
|
344
278
|
DEFAULT_HISTORIAN_TIMEOUT_MS,
|
|
345
279
|
DEFAULT_LOCAL_EMBEDDING_MODEL,
|
|
346
280
|
DREAM_TASK_PROMOTION_DEFAULTS
|
|
347
|
-
} from "./index-
|
|
281
|
+
} from "./index-c5dzns43.js";
|
|
348
282
|
import {
|
|
349
283
|
areRustHistorianSyntheticParts2,
|
|
350
284
|
isRawCompactionSummaryInfo2,
|
|
351
285
|
extractInMemoryMessageViews2,
|
|
352
286
|
buildInMemoryTailRawMessages2,
|
|
353
287
|
RawOrdinalsNotReady2
|
|
354
|
-
} from "./index-
|
|
288
|
+
} from "./index-r2epb000.js";
|
|
355
289
|
import {
|
|
356
290
|
openCodeDbExists,
|
|
357
291
|
withReadOnlySessionDb,
|
|
@@ -359,17 +293,15 @@ import {
|
|
|
359
293
|
latestPersistedMessageForRecovery,
|
|
360
294
|
latestRealUserTurnIdFromOpenCodeDb,
|
|
361
295
|
findLastAssistantModelFromOpenCodeDb
|
|
362
|
-
} from "./index-
|
|
296
|
+
} from "./index-vd2ywmfe.js";
|
|
363
297
|
import {
|
|
364
|
-
expandToolPart,
|
|
365
298
|
askAnswerLines,
|
|
366
|
-
takeCoveredInstructionRows,
|
|
367
|
-
cloneKeepingCoveredInstructionMarks,
|
|
368
299
|
estimateTrueRawMessageTokens,
|
|
369
300
|
isTextPart,
|
|
370
301
|
toolPartHasUserAnswer,
|
|
371
302
|
DreamTokenBudgetExceeded,
|
|
372
303
|
isEditTool,
|
|
304
|
+
createFinalWireIncompleteLogger,
|
|
373
305
|
decodeMergedReasoningParts,
|
|
374
306
|
MAX_EXECUTE_THRESHOLD,
|
|
375
307
|
escalationBands,
|
|
@@ -437,7 +369,6 @@ import {
|
|
|
437
369
|
getPendingCompactionMarkerState,
|
|
438
370
|
getCompactionMarkerHealth,
|
|
439
371
|
clearPendingCompactionMarkerStateIf,
|
|
440
|
-
setSessionWorkMetrics,
|
|
441
372
|
getObservedEpochFloor,
|
|
442
373
|
resolveEpochFloorForPass,
|
|
443
374
|
detectLatestTurnThinkingMismatch,
|
|
@@ -466,6 +397,7 @@ import {
|
|
|
466
397
|
extractToolCallObservation,
|
|
467
398
|
ToolMutationBatch,
|
|
468
399
|
createToolDropTarget,
|
|
400
|
+
rawMessageWorkerSource2,
|
|
469
401
|
setRawMessageProvider2,
|
|
470
402
|
cleanUserText2,
|
|
471
403
|
withRawSessionMessageCache2,
|
|
@@ -484,35 +416,37 @@ import {
|
|
|
484
416
|
readRawSessionMessageById2,
|
|
485
417
|
readSessionChunk2,
|
|
486
418
|
readRawSessionSeedTail2
|
|
487
|
-
} from "./index-
|
|
419
|
+
} from "./index-tn9drm1a.js";
|
|
488
420
|
import {
|
|
489
421
|
BoundedSessionMap,
|
|
490
422
|
getMeasuredToolDefinitionTokens
|
|
491
|
-
} from "./index-
|
|
423
|
+
} from "./index-jkanybgq.js";
|
|
492
424
|
import {
|
|
493
425
|
isFailClosedBlockingError,
|
|
494
426
|
shouldBypassFailClosedBlock,
|
|
495
|
-
resolveAgentNameFromMessages
|
|
496
|
-
|
|
497
|
-
getSchemaFenceRejection,
|
|
498
|
-
getMigrationOnOpenRefusal,
|
|
499
|
-
LATEST_SUPPORTED_VERSION,
|
|
500
|
-
getDatabasePath,
|
|
501
|
-
getPersistedSchemaVersion,
|
|
502
|
-
runSqliteOptimize,
|
|
503
|
-
openDatabase,
|
|
504
|
-
openCurrentDatabase
|
|
505
|
-
} from "./index-fm36bjv4.js";
|
|
427
|
+
resolveAgentNameFromMessages
|
|
428
|
+
} from "./index-wh9fxds5.js";
|
|
506
429
|
import {
|
|
507
430
|
registerOwnRpcServerInstance,
|
|
508
431
|
rpcPortDir,
|
|
509
432
|
rpcPortFilePath,
|
|
510
433
|
parseRpcPortFile,
|
|
511
434
|
inspectProcessesAsync
|
|
512
|
-
} from "./index-
|
|
435
|
+
} from "./index-2p37txes.js";
|
|
513
436
|
import {
|
|
514
437
|
configureContextDatabasePragmas2
|
|
515
438
|
} from "./index-fb3zxn06.js";
|
|
439
|
+
import {
|
|
440
|
+
getUnconfirmedMigrationHolders,
|
|
441
|
+
getSchemaFenceRejection,
|
|
442
|
+
getMigrationOnOpenRefusal,
|
|
443
|
+
LATEST_SUPPORTED_VERSION,
|
|
444
|
+
getDatabasePath,
|
|
445
|
+
getPersistedSchemaVersion,
|
|
446
|
+
runSqliteOptimize,
|
|
447
|
+
openDatabase,
|
|
448
|
+
openCurrentDatabase
|
|
449
|
+
} from "./index-9fgmkfaf.js";
|
|
516
450
|
import {
|
|
517
451
|
unescapeXml,
|
|
518
452
|
resolveWorkspaceShareCategories,
|
|
@@ -521,7 +455,7 @@ import {
|
|
|
521
455
|
resolveStoredPathWorkspaceIdentity,
|
|
522
456
|
storedPathBelongsToWorkspace,
|
|
523
457
|
computeWorkspaceEpochFingerprint
|
|
524
|
-
} from "./index-
|
|
458
|
+
} from "./index-nj360hcs.js";
|
|
525
459
|
import {
|
|
526
460
|
V2_MEMORY_CATEGORIES,
|
|
527
461
|
CATEGORY_PRIORITY
|
|
@@ -534,26 +468,8 @@ import {
|
|
|
534
468
|
autoEmbedIdentityBySession,
|
|
535
469
|
autoEmbedRetryAfterBySession,
|
|
536
470
|
invalidateAutoEmbedSession,
|
|
537
|
-
getEmbedDrainUiStatus
|
|
538
|
-
|
|
539
|
-
markProjectLoadUntrusted2,
|
|
540
|
-
drainProjectEmbeddingIdentityMaintenance2,
|
|
541
|
-
drainStaleEmbeddingIdentitiesForProject2,
|
|
542
|
-
registerProjectEmbedding2,
|
|
543
|
-
registerProjectShadowEmbedding2,
|
|
544
|
-
enqueueShadowEmbeddingItems2,
|
|
545
|
-
registerProjectInObservationMode2,
|
|
546
|
-
unregisterProjectShadowEmbedding2,
|
|
547
|
-
getProjectEmbeddingSnapshot2,
|
|
548
|
-
embedTextForProject2,
|
|
549
|
-
embedBatchForProject2,
|
|
550
|
-
embedUnembeddedMemoriesForProject2,
|
|
551
|
-
embedUnembeddedMemoriesForProjectOutcome2,
|
|
552
|
-
drainCommitBacklogForProject2,
|
|
553
|
-
embedSessionCompartmentChunks2,
|
|
554
|
-
getEmbeddingCoverageStatus2,
|
|
555
|
-
getAutoEmbeddingSessionCoverage2
|
|
556
|
-
} from "./index-2743x98y.js";
|
|
471
|
+
getEmbedDrainUiStatus
|
|
472
|
+
} from "./index-2amn2s73.js";
|
|
557
473
|
import {
|
|
558
474
|
SubcClient,
|
|
559
475
|
connectionFileExists,
|
|
@@ -561,18 +477,89 @@ import {
|
|
|
561
477
|
toSynapseLaneDescriptor,
|
|
562
478
|
formatSynapseLaneDescriptor,
|
|
563
479
|
SynapseEmbeddingProvider
|
|
564
|
-
} from "./index-
|
|
480
|
+
} from "./index-g4t7850m.js";
|
|
481
|
+
import {
|
|
482
|
+
getCompartments,
|
|
483
|
+
getLastCompartmentEndMessage,
|
|
484
|
+
getLastCompartmentEndMessageId,
|
|
485
|
+
providerResponseFailed,
|
|
486
|
+
LkgRecoveryFenceError,
|
|
487
|
+
lkgServedArrayDigest,
|
|
488
|
+
hasCleanLkgRecoveryFence,
|
|
489
|
+
dirtyLkgRecoveryRevision,
|
|
490
|
+
ownsLkgDirtyFence,
|
|
491
|
+
invalidateCleanLkgRecoveryFence,
|
|
492
|
+
prepareLkgCaptureFence,
|
|
493
|
+
certifyCommittedLkgCapture,
|
|
494
|
+
markLkgRecoveryDirty,
|
|
495
|
+
getOrCreateSessionMeta,
|
|
496
|
+
updateSessionMeta,
|
|
497
|
+
retryPendingSessionCleanups,
|
|
498
|
+
retryPendingRustSessionCleanupsForProject,
|
|
499
|
+
requestPendingMaterialization,
|
|
500
|
+
hasPendingMaterializationOrigin,
|
|
501
|
+
clearPendingMaterialization,
|
|
502
|
+
recordSystemPromptForRequest,
|
|
503
|
+
recordHeldHeadForRequest,
|
|
504
|
+
isHeldHeadForRequest,
|
|
505
|
+
deferDeliveredSystemRefresh,
|
|
506
|
+
retirePendingSystemPromptDelivery,
|
|
507
|
+
claimLkgRequestIdentity,
|
|
508
|
+
currentLkgRequestIdentity,
|
|
509
|
+
noteCapturedLkgRequest,
|
|
510
|
+
measuredLkgPrefix,
|
|
511
|
+
saveLkgSlotToDb,
|
|
512
|
+
clearPersistedLkgSlotStrict,
|
|
513
|
+
loadPersistedLkgSlot,
|
|
514
|
+
drainStaleLkgSlots,
|
|
515
|
+
resolveLkgModelKeys,
|
|
516
|
+
createLkgEntryProjector,
|
|
517
|
+
captureLkgSlot,
|
|
518
|
+
validateAnthropicReasoningRuns,
|
|
519
|
+
validateLkgSeam,
|
|
520
|
+
replayLkg,
|
|
521
|
+
coldStartRawServedIndex,
|
|
522
|
+
coldStartUncapturedReplay,
|
|
523
|
+
noteUncertifiedNormalLkg,
|
|
524
|
+
hasProcessLocalLkgProof,
|
|
525
|
+
lkgDirtyRevision,
|
|
526
|
+
rememberLkgDirtyRevision,
|
|
527
|
+
readPersistedLkgUntaggedInputIds,
|
|
528
|
+
persistLkgUntaggedInputIds,
|
|
529
|
+
noteLkgRecoveryPrefix,
|
|
530
|
+
readLkgRecoveryPrefix,
|
|
531
|
+
noteLkgHealthyPrefix,
|
|
532
|
+
lkgRecoveryReplayUnproven,
|
|
533
|
+
lkgRecoveryEntryUnproven,
|
|
534
|
+
lkgInputIdentity,
|
|
535
|
+
beginLkgPass,
|
|
536
|
+
visitMessageContentFields,
|
|
537
|
+
contentSnapshotValue,
|
|
538
|
+
messageContentFields,
|
|
539
|
+
signatureForFields,
|
|
540
|
+
exactReusablePrefix,
|
|
541
|
+
incrementalLkgContentDigests,
|
|
542
|
+
lkgSlotRejection,
|
|
543
|
+
captureSlot,
|
|
544
|
+
getInMemorySlot,
|
|
545
|
+
getSlot,
|
|
546
|
+
forgetInMemorySlot,
|
|
547
|
+
dropSlot,
|
|
548
|
+
noteEntry,
|
|
549
|
+
getLkgSlotHeapStats,
|
|
550
|
+
TOOL_SWEEP_SCOPED_MARKER,
|
|
551
|
+
useScopedToolSweep,
|
|
552
|
+
createPreAdoptionToolSweepResolver,
|
|
553
|
+
queueMemoryMutation,
|
|
554
|
+
getMaxMemoryMutationIdForProjects,
|
|
555
|
+
GLOBAL_USER_PROFILE_PROJECT_PATH,
|
|
556
|
+
getProjectState,
|
|
557
|
+
bumpProjectUserProfileVersion
|
|
558
|
+
} from "./index-72czy45z.js";
|
|
565
559
|
import {
|
|
566
560
|
getLastIndexedOrdinal
|
|
567
|
-
} from "./index-
|
|
561
|
+
} from "./index-2rs7912w.js";
|
|
568
562
|
import {
|
|
569
|
-
renderUserFacingFailure,
|
|
570
|
-
userFacingFailureCode,
|
|
571
|
-
renderCapabilityRefusal,
|
|
572
|
-
capabilityRefusalCode,
|
|
573
|
-
renderDreamFailure,
|
|
574
|
-
dreamFailureCode,
|
|
575
|
-
renderEmbeddingFailure,
|
|
576
563
|
SESSION_NOTE_CONDITION_ERROR,
|
|
577
564
|
getNoteByIdInScope,
|
|
578
565
|
getNotes,
|
|
@@ -596,19 +583,8 @@ import {
|
|
|
596
583
|
getActivePrimers,
|
|
597
584
|
createPrimer,
|
|
598
585
|
updatePrimerSupport,
|
|
599
|
-
updatePrimerAnswer
|
|
600
|
-
|
|
601
|
-
recordMemoryVerifications,
|
|
602
|
-
getUnmappedMemoryIds,
|
|
603
|
-
clearMemoryVerifications,
|
|
604
|
-
getMemoryVerifications,
|
|
605
|
-
resolveGitTopLevel,
|
|
606
|
-
readGitHead,
|
|
607
|
-
readGitChangedFilesSince,
|
|
608
|
-
readGitFileChangeTimesSince,
|
|
609
|
-
verificationFileExists,
|
|
610
|
-
normalizeVerificationFiles
|
|
611
|
-
} from "./index-as2amvn3.js";
|
|
586
|
+
updatePrimerAnswer
|
|
587
|
+
} from "./index-2qbtqg1w.js";
|
|
612
588
|
import {
|
|
613
589
|
registerNotificationSink2,
|
|
614
590
|
pushNotification2,
|
|
@@ -620,7 +596,27 @@ import {
|
|
|
620
596
|
getCachedLocalEmbeddingPooling,
|
|
621
597
|
preflightLocalEmbeddingPooling,
|
|
622
598
|
getLocalEmbeddingNativeMemoryStats
|
|
623
|
-
} from "./index-
|
|
599
|
+
} from "./index-xd2p95m7.js";
|
|
600
|
+
import {
|
|
601
|
+
describeShadowBackfillWriteRefusal2,
|
|
602
|
+
markProjectLoadUntrusted2,
|
|
603
|
+
drainProjectEmbeddingIdentityMaintenance2,
|
|
604
|
+
drainStaleEmbeddingIdentitiesForProject2,
|
|
605
|
+
registerProjectEmbedding2,
|
|
606
|
+
registerProjectShadowEmbedding2,
|
|
607
|
+
enqueueShadowEmbeddingItems2,
|
|
608
|
+
registerProjectInObservationMode2,
|
|
609
|
+
unregisterProjectShadowEmbedding2,
|
|
610
|
+
getProjectEmbeddingSnapshot2,
|
|
611
|
+
embedTextForProject2,
|
|
612
|
+
embedBatchForProject2,
|
|
613
|
+
embedUnembeddedMemoriesForProject2,
|
|
614
|
+
embedUnembeddedMemoriesForProjectOutcome2,
|
|
615
|
+
drainCommitBacklogForProject2,
|
|
616
|
+
embedSessionCompartmentChunks2,
|
|
617
|
+
getEmbeddingCoverageStatus2,
|
|
618
|
+
getAutoEmbeddingSessionCoverage2
|
|
619
|
+
} from "./index-21fgrfrf.js";
|
|
624
620
|
import {
|
|
625
621
|
saveEmbeddingIfHashMatches,
|
|
626
622
|
invalidateProject2,
|
|
@@ -628,7 +624,7 @@ import {
|
|
|
628
624
|
} from "./index-4dhv7mqz.js";
|
|
629
625
|
import {
|
|
630
626
|
cosineSimilarity
|
|
631
|
-
} from "./index-
|
|
627
|
+
} from "./index-ty4vhe4n.js";
|
|
632
628
|
import {
|
|
633
629
|
computeCueContentHash,
|
|
634
630
|
hasMuralCueColumns,
|
|
@@ -648,12 +644,33 @@ import {
|
|
|
648
644
|
getMemoryById2,
|
|
649
645
|
getMemoriesByIds2,
|
|
650
646
|
updateMemorySeenCount2,
|
|
647
|
+
updateMemoryVerification2,
|
|
651
648
|
setMemoryClassification2,
|
|
652
649
|
supersededMemory2,
|
|
653
650
|
mergeMemoryStats2,
|
|
654
651
|
archiveMemory2,
|
|
655
652
|
getMemoryCountsByStatus2
|
|
656
653
|
} from "./index-jjvbk92s.js";
|
|
654
|
+
import {
|
|
655
|
+
renderUserFacingFailure,
|
|
656
|
+
userFacingFailureCode,
|
|
657
|
+
renderCapabilityRefusal,
|
|
658
|
+
capabilityRefusalCode,
|
|
659
|
+
renderDreamFailure,
|
|
660
|
+
dreamFailureCode,
|
|
661
|
+
renderEmbeddingFailure,
|
|
662
|
+
recordMemoryMapping,
|
|
663
|
+
recordMemoryVerifications,
|
|
664
|
+
getUnmappedMemoryIds,
|
|
665
|
+
clearMemoryVerifications,
|
|
666
|
+
getMemoryVerifications,
|
|
667
|
+
resolveGitTopLevel,
|
|
668
|
+
readGitHead,
|
|
669
|
+
readGitChangedFilesSince,
|
|
670
|
+
readGitFileChangeTimesSince,
|
|
671
|
+
verificationFileExists,
|
|
672
|
+
normalizeVerificationFiles
|
|
673
|
+
} from "./index-xnm0wq1r.js";
|
|
657
674
|
import {
|
|
658
675
|
renderSingleStoreMigrationRequiredRefusal,
|
|
659
676
|
SingleStoreMigrationRequiredError,
|
|
@@ -674,23 +691,23 @@ import {
|
|
|
674
691
|
resolveMemoriesByIdsForSearch2,
|
|
675
692
|
unifiedSearch2,
|
|
676
693
|
formatSearchResults2
|
|
677
|
-
} from "./index-
|
|
694
|
+
} from "./index-wcwhhtdh.js";
|
|
678
695
|
import {
|
|
679
696
|
scheduleReconciliation,
|
|
680
697
|
scheduleIncrementalIndex,
|
|
681
698
|
getMessageIndexQueueHeapStats,
|
|
682
699
|
clearSessionTracking
|
|
683
|
-
} from "./index-
|
|
700
|
+
} from "./index-dz48h1wx.js";
|
|
684
701
|
import {
|
|
685
702
|
flushIgnoredMessages2,
|
|
686
703
|
clearIgnoredMessages2,
|
|
687
704
|
observeIgnoredNotificationEvent2,
|
|
688
705
|
sendStatusNotification2
|
|
689
|
-
} from "./index-
|
|
706
|
+
} from "./index-ae1ar4v1.js";
|
|
690
707
|
import {
|
|
691
708
|
setRecompStarting2,
|
|
692
709
|
setRecompTerminal2
|
|
693
|
-
} from "./index-
|
|
710
|
+
} from "./index-ys7j6679.js";
|
|
694
711
|
import {
|
|
695
712
|
makeToolCompositeKey,
|
|
696
713
|
searchMessageHistoryOffThread,
|
|
@@ -734,11 +751,13 @@ import {
|
|
|
734
751
|
replayCavemanCompression,
|
|
735
752
|
DegradedPassRefusalError,
|
|
736
753
|
degradedPassError,
|
|
754
|
+
isStructuralNoiseSentinel,
|
|
755
|
+
stripStructuralNoise,
|
|
756
|
+
prepareStructuralSentinelChoices,
|
|
737
757
|
renderDroppedText,
|
|
738
758
|
applyFlushedStatuses,
|
|
739
759
|
prewarmTagOwners,
|
|
740
760
|
waitForTagOwners,
|
|
741
|
-
stripStructuralNoise,
|
|
742
761
|
isLegacyForeignTextTag,
|
|
743
762
|
withTransformTimingSummary,
|
|
744
763
|
logTransformTiming,
|
|
@@ -753,7 +772,7 @@ import {
|
|
|
753
772
|
abortSessionFailClosed2,
|
|
754
773
|
evaluateEmergencyFailClosed2,
|
|
755
774
|
runPostTransformPhase2
|
|
756
|
-
} from "./index-
|
|
775
|
+
} from "./index-dfdg2cgg.js";
|
|
757
776
|
import {
|
|
758
777
|
ANNOUNCEMENT_VERSION2,
|
|
759
778
|
ANNOUNCEMENT_FEATURES2,
|
|
@@ -764,14 +783,26 @@ import {
|
|
|
764
783
|
import {
|
|
765
784
|
resolvePromptContext2
|
|
766
785
|
} from "./index-fmsr7v69.js";
|
|
786
|
+
import {
|
|
787
|
+
renderMessageByOrdinal2,
|
|
788
|
+
renderVerboseRangeForTool2,
|
|
789
|
+
renderItemByTag2
|
|
790
|
+
} from "./index-j105mf16.js";
|
|
791
|
+
import {
|
|
792
|
+
readV2ArchiveOffThread2
|
|
793
|
+
} from "./index-prw8apnc.js";
|
|
767
794
|
import {
|
|
768
795
|
renderSearchArchiveOffThread2
|
|
769
|
-
} from "./index-
|
|
796
|
+
} from "./index-4ks89h5a.js";
|
|
770
797
|
import {
|
|
771
798
|
COMPACTION_ENABLED_PATH,
|
|
772
799
|
isDreamerRunnable,
|
|
773
800
|
isCompactionEnabled
|
|
774
801
|
} from "./index-ksdyrrav.js";
|
|
802
|
+
import {
|
|
803
|
+
takeCoveredInstructionRows,
|
|
804
|
+
cloneKeepingCoveredInstructionMarks
|
|
805
|
+
} from "./index-z9zygwse.js";
|
|
775
806
|
import {
|
|
776
807
|
__toESM
|
|
777
808
|
} from "./index-22jkk6wg.js";
|
|
@@ -796,7 +827,7 @@ import {
|
|
|
796
827
|
} from "./index-8ajstryz.js";
|
|
797
828
|
import {
|
|
798
829
|
logSlowWriteTransaction
|
|
799
|
-
} from "./index-
|
|
830
|
+
} from "./index-fxbk7gk3.js";
|
|
800
831
|
import {
|
|
801
832
|
shouldEnforcePrivateStoragePermissions,
|
|
802
833
|
ensureStorageDirectorySync,
|
|
@@ -2340,7 +2371,7 @@ function recordRetrospectiveWindowProcessed(db, projectPath, windowKey) {
|
|
|
2340
2371
|
}
|
|
2341
2372
|
|
|
2342
2373
|
// src/features/magic-context/dreamer/task-executor.ts
|
|
2343
|
-
import { createHash as
|
|
2374
|
+
import { createHash as createHash8 } from "node:crypto";
|
|
2344
2375
|
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "node:fs";
|
|
2345
2376
|
|
|
2346
2377
|
// src/features/magic-context/mural/compress-cues.ts
|
|
@@ -8378,12 +8409,17 @@ function countCompartmentsSince(db, projectPath, since) {
|
|
|
8378
8409
|
return row?.cnt ?? 0;
|
|
8379
8410
|
}
|
|
8380
8411
|
function countProjectSessionsSince(db, projectPath, since) {
|
|
8381
|
-
const
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8412
|
+
const scope = `FROM session_projects sp
|
|
8413
|
+
LEFT JOIN session_meta m ON m.session_id = sp.session_id
|
|
8414
|
+
WHERE sp.project_path = ? AND sp.harness = ?
|
|
8415
|
+
AND COALESCE(m.is_subagent, 0) = 0`;
|
|
8416
|
+
const row = since === null ? db.prepare(`SELECT COUNT(*) AS cnt ${scope}`).get(projectPath, getHarness2()) : db.prepare(`SELECT COUNT(*) AS cnt ${scope}
|
|
8417
|
+
AND COALESCE(
|
|
8418
|
+
(SELECT CAST(value AS INTEGER) FROM schema_migrations_meta
|
|
8419
|
+
WHERE key = 'retrospective_activity:' || sp.session_id),
|
|
8420
|
+
(SELECT updated_at FROM message_history_index
|
|
8421
|
+
WHERE session_id = sp.session_id AND harness = sp.harness)
|
|
8422
|
+
) > ?`).get(projectPath, getHarness2(), since);
|
|
8387
8423
|
return row?.cnt ?? 0;
|
|
8388
8424
|
}
|
|
8389
8425
|
function countMappedMemories(db, projectPath) {
|
|
@@ -8396,6 +8432,10 @@ function countMappedMemories(db, projectPath) {
|
|
|
8396
8432
|
AND v.file_path <> ''`).get(projectPath, Date.now());
|
|
8397
8433
|
return row?.cnt ?? 0;
|
|
8398
8434
|
}
|
|
8435
|
+
var CURRENT_VERIFY_SKIP_SQL = `COALESCE(CASE WHEN json_valid(m.metadata_json) THEN
|
|
8436
|
+
json_extract(m.metadata_json, '$.dreamerVerifySkip.contentHash') = m.normalized_hash
|
|
8437
|
+
AND json_type(m.metadata_json, '$.dreamerVerifySkip.fingerprint') = 'text'
|
|
8438
|
+
ELSE 0 END, 0)`;
|
|
8399
8439
|
function countUnverifiedMappedMemories(db, projectPath) {
|
|
8400
8440
|
const row = db.prepare(`SELECT COUNT(DISTINCT m.id) AS cnt
|
|
8401
8441
|
FROM memories m
|
|
@@ -8404,7 +8444,8 @@ function countUnverifiedMappedMemories(db, projectPath) {
|
|
|
8404
8444
|
AND m.status IN ('active','permanent')
|
|
8405
8445
|
AND (m.expires_at IS NULL OR m.expires_at > ?)
|
|
8406
8446
|
AND v.file_path <> ''
|
|
8407
|
-
AND v.verified_at = 0
|
|
8447
|
+
AND v.verified_at = 0
|
|
8448
|
+
AND NOT (${CURRENT_VERIFY_SKIP_SQL})`).get(projectPath, Date.now());
|
|
8408
8449
|
return row?.cnt ?? 0;
|
|
8409
8450
|
}
|
|
8410
8451
|
function countBroadCycleCandidates(db, projectPath, cycleStartAt) {
|
|
@@ -8413,6 +8454,7 @@ function countBroadCycleCandidates(db, projectPath, cycleStartAt) {
|
|
|
8413
8454
|
WHERE m.project_path = ?
|
|
8414
8455
|
AND m.status IN ('active','permanent')
|
|
8415
8456
|
AND (m.expires_at IS NULL OR m.expires_at > ?)
|
|
8457
|
+
AND NOT (${CURRENT_VERIFY_SKIP_SQL})
|
|
8416
8458
|
AND (
|
|
8417
8459
|
SELECT MAX(v.verified_at)
|
|
8418
8460
|
FROM memory_verifications v
|
|
@@ -8521,7 +8563,7 @@ function getDreamTaskBacklog(db, projectPath, task, options = {}) {
|
|
|
8521
8563
|
case "verify-broad": {
|
|
8522
8564
|
const total = countMappedMemories(db, projectPath);
|
|
8523
8565
|
const cycleStartAt = getTaskScheduleState(db, projectPath, "verify-broad")?.lastBroadRunAt;
|
|
8524
|
-
const pending =
|
|
8566
|
+
const pending = countBroadCycleCandidates(db, projectPath, cycleStartAt ?? Number.MAX_SAFE_INTEGER);
|
|
8525
8567
|
return { pending, total };
|
|
8526
8568
|
}
|
|
8527
8569
|
case "curate": {
|
|
@@ -8648,6 +8690,7 @@ function getDreamTaskBacklogs(db, projectPath, tasks = CANONICAL_DREAM_TASKS, op
|
|
|
8648
8690
|
}
|
|
8649
8691
|
const optionKey = (value) => value === undefined ? "omitted" : value === null ? "null" : `number:${value}`;
|
|
8650
8692
|
const key = JSON.stringify([
|
|
8693
|
+
getHarness2(),
|
|
8651
8694
|
projectPath,
|
|
8652
8695
|
tasks,
|
|
8653
8696
|
optionKey(options.lastRunAt),
|
|
@@ -8701,7 +8744,7 @@ function evaluateTaskGate(task, ctx) {
|
|
|
8701
8744
|
}
|
|
8702
8745
|
|
|
8703
8746
|
// src/features/magic-context/dreamer/verify.ts
|
|
8704
|
-
import { createHash as
|
|
8747
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
8705
8748
|
|
|
8706
8749
|
// src/features/magic-context/dreamer/verify-diff.ts
|
|
8707
8750
|
import { execFile as execFile3 } from "node:child_process";
|
|
@@ -8822,7 +8865,56 @@ Read only these changed line ranges if they may affect the claim.`
|
|
|
8822
8865
|
}
|
|
8823
8866
|
|
|
8824
8867
|
// src/features/magic-context/dreamer/verify-gate.ts
|
|
8868
|
+
import path5 from "node:path";
|
|
8869
|
+
|
|
8870
|
+
// src/features/magic-context/dreamer/verify-state.ts
|
|
8871
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
8872
|
+
import { readFile, realpath as realpath2 } from "node:fs/promises";
|
|
8825
8873
|
import path4 from "node:path";
|
|
8874
|
+
function verificationMetadata(memory) {
|
|
8875
|
+
try {
|
|
8876
|
+
const parsed = JSON.parse(memory.metadataJson ?? "{}");
|
|
8877
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed))
|
|
8878
|
+
return parsed;
|
|
8879
|
+
} catch {}
|
|
8880
|
+
return {};
|
|
8881
|
+
}
|
|
8882
|
+
async function verificationFilesFingerprint(directory, files) {
|
|
8883
|
+
const root = await resolveGitTopLevel(directory) ?? path4.resolve(directory);
|
|
8884
|
+
const hash = createHash6("sha256");
|
|
8885
|
+
for (const file of [...new Set(files)].sort()) {
|
|
8886
|
+
const absolute = path4.resolve(root, file);
|
|
8887
|
+
const withinRoot = (candidate) => {
|
|
8888
|
+
const relative = path4.relative(root, candidate);
|
|
8889
|
+
return relative !== ".." && !relative.startsWith(`..${path4.sep}`) && !path4.isAbsolute(relative);
|
|
8890
|
+
};
|
|
8891
|
+
if (!withinRoot(absolute))
|
|
8892
|
+
return null;
|
|
8893
|
+
hash.update(JSON.stringify(file));
|
|
8894
|
+
try {
|
|
8895
|
+
if (!withinRoot(await realpath2(absolute)))
|
|
8896
|
+
return null;
|
|
8897
|
+
hash.update(createHash6("sha256").update(await readFile(absolute)).digest("hex"));
|
|
8898
|
+
} catch (error) {
|
|
8899
|
+
if (error.code !== "ENOENT")
|
|
8900
|
+
return null;
|
|
8901
|
+
hash.update("missing");
|
|
8902
|
+
}
|
|
8903
|
+
}
|
|
8904
|
+
return hash.digest("hex");
|
|
8905
|
+
}
|
|
8906
|
+
function recordVerificationVerdict(db, memory, verdict, at, fingerprint = null) {
|
|
8907
|
+
const metadata = verificationMetadata(memory);
|
|
8908
|
+
delete metadata.dreamerVerifySkip;
|
|
8909
|
+
if (verdict === "skip" && fingerprint) {
|
|
8910
|
+
metadata.dreamerVerifySkip = { contentHash: memory.normalizedHash, fingerprint, at };
|
|
8911
|
+
}
|
|
8912
|
+
metadata.dreamerVerifyVerdict = verdict;
|
|
8913
|
+
metadata.dreamerVerifyAttemptedAt = at;
|
|
8914
|
+
db.prepare("UPDATE memories SET metadata_json = ? WHERE id = ?").run(JSON.stringify(metadata), memory.id);
|
|
8915
|
+
}
|
|
8916
|
+
|
|
8917
|
+
// src/features/magic-context/dreamer/verify-gate.ts
|
|
8826
8918
|
function minOf(values) {
|
|
8827
8919
|
return values.reduce((acc, v) => v < acc ? v : acc, Number.POSITIVE_INFINITY);
|
|
8828
8920
|
}
|
|
@@ -8854,7 +8946,22 @@ async function partitionVerifyScope(args) {
|
|
|
8854
8946
|
const runStartedAt = args.now ?? Date.now();
|
|
8855
8947
|
const active = getMemoriesByProject2(args.db, args.projectIdentity);
|
|
8856
8948
|
const verById = getMemoryVerifications(args.db, active.map((m) => m.id));
|
|
8857
|
-
const candidates =
|
|
8949
|
+
const candidates = [];
|
|
8950
|
+
const unchangedSkippedIds = [];
|
|
8951
|
+
const changedSkippedIds = new Set;
|
|
8952
|
+
for (const memory of active) {
|
|
8953
|
+
const files = verById.get(memory.id)?.files ?? [];
|
|
8954
|
+
if (!files.length)
|
|
8955
|
+
continue;
|
|
8956
|
+
const skip = verificationMetadata(memory).dreamerVerifySkip;
|
|
8957
|
+
if (skip && skip.contentHash === memory.normalizedHash && typeof skip.fingerprint === "string" && skip.fingerprint === await verificationFilesFingerprint(args.projectDirectory, files)) {
|
|
8958
|
+
unchangedSkippedIds.push(memory.id);
|
|
8959
|
+
} else {
|
|
8960
|
+
candidates.push(memory);
|
|
8961
|
+
if (skip)
|
|
8962
|
+
changedSkippedIds.add(memory.id);
|
|
8963
|
+
}
|
|
8964
|
+
}
|
|
8858
8965
|
const toPrompt = (m) => {
|
|
8859
8966
|
const verifiedAt = verById.get(m.id)?.verifiedAt ?? 0;
|
|
8860
8967
|
let verifiedCommit = null;
|
|
@@ -8881,7 +8988,7 @@ async function partitionVerifyScope(args) {
|
|
|
8881
8988
|
leaseKey: args.leaseKey,
|
|
8882
8989
|
runStartedAt
|
|
8883
8990
|
});
|
|
8884
|
-
const broadCandidates = candidates.filter((m) => (verById.get(m.id)?.verifiedAt ?? 0) < broadCycleStartAt).sort((a, b) => {
|
|
8991
|
+
const broadCandidates = candidates.filter((m) => changedSkippedIds.has(m.id) || (verById.get(m.id)?.verifiedAt ?? 0) < broadCycleStartAt).sort((a, b) => {
|
|
8885
8992
|
const verifiedAtA = verById.get(a.id)?.verifiedAt ?? 0;
|
|
8886
8993
|
const verifiedAtB = verById.get(b.id)?.verifiedAt ?? 0;
|
|
8887
8994
|
return verifiedAtA - verifiedAtB || a.id - b.id;
|
|
@@ -8892,7 +8999,10 @@ async function partitionVerifyScope(args) {
|
|
|
8892
8999
|
mode: "broad",
|
|
8893
9000
|
inScope: broadCandidates.map(toPrompt),
|
|
8894
9001
|
inScopeIds: broadCandidates.map((m) => m.id),
|
|
8895
|
-
skippedIds:
|
|
9002
|
+
skippedIds: [
|
|
9003
|
+
...unchangedSkippedIds,
|
|
9004
|
+
...candidates.filter((m) => !broadIds.has(m.id)).map((m) => m.id)
|
|
9005
|
+
],
|
|
8896
9006
|
broadCycleStartAt,
|
|
8897
9007
|
reason: `broad cycle (${broadCandidates.length} remain; started ${broadCycleStartAt})`
|
|
8898
9008
|
};
|
|
@@ -8903,7 +9013,7 @@ async function partitionVerifyScope(args) {
|
|
|
8903
9013
|
mode: "incremental",
|
|
8904
9014
|
inScope: [],
|
|
8905
9015
|
inScopeIds: [],
|
|
8906
|
-
skippedIds:
|
|
9016
|
+
skippedIds: unchangedSkippedIds,
|
|
8907
9017
|
reason: "no file-mapped memories in scope"
|
|
8908
9018
|
};
|
|
8909
9019
|
}
|
|
@@ -8912,11 +9022,11 @@ async function partitionVerifyScope(args) {
|
|
|
8912
9022
|
mode,
|
|
8913
9023
|
inScope: candidates.map(toPrompt),
|
|
8914
9024
|
inScopeIds: candidates.map((m) => m.id),
|
|
8915
|
-
skippedIds:
|
|
9025
|
+
skippedIds: unchangedSkippedIds,
|
|
8916
9026
|
reason
|
|
8917
9027
|
});
|
|
8918
9028
|
const resolvedGitRoot = await resolveGitTopLevel(args.projectDirectory);
|
|
8919
|
-
const gitRoot = resolvedGitRoot ??
|
|
9029
|
+
const gitRoot = resolvedGitRoot ?? path5.resolve(args.projectDirectory);
|
|
8920
9030
|
const verifiedTimes = candidates.map((m) => verById.get(m.id)?.verifiedAt ?? 0).filter((t) => t > 0);
|
|
8921
9031
|
const sinceMs = verifiedTimes.length > 0 ? minOf(verifiedTimes) : runStartedAt;
|
|
8922
9032
|
const changeTimes = await readGitFileChangeTimesSince(args.projectDirectory, sinceMs, resolvedGitRoot ?? undefined);
|
|
@@ -8926,11 +9036,11 @@ async function partitionVerifyScope(args) {
|
|
|
8926
9036
|
const head = await readGitHead(args.projectDirectory);
|
|
8927
9037
|
const uncommitted = head ? await readGitChangedFilesSince(args.projectDirectory, head, resolvedGitRoot ?? undefined) ?? new Set : new Set;
|
|
8928
9038
|
const inScope = [];
|
|
8929
|
-
const skippedIds = [];
|
|
9039
|
+
const skippedIds = [...unchangedSkippedIds];
|
|
8930
9040
|
for (const m of candidates) {
|
|
8931
9041
|
const v = verById.get(m.id);
|
|
8932
9042
|
const verifiedAt = v?.verifiedAt ?? 0;
|
|
8933
|
-
if (verifiedAt === 0) {
|
|
9043
|
+
if (verifiedAt === 0 || changedSkippedIds.has(m.id)) {
|
|
8934
9044
|
inScope.push(toPrompt(m));
|
|
8935
9045
|
continue;
|
|
8936
9046
|
}
|
|
@@ -9300,6 +9410,7 @@ async function verifyOneBatch(args, batch, sliceMs, signal) {
|
|
|
9300
9410
|
let budgetFinalized = false;
|
|
9301
9411
|
let failedCompletion;
|
|
9302
9412
|
let headAtPrompt = null;
|
|
9413
|
+
const skipSnapshots = new Map;
|
|
9303
9414
|
const onBudgetUpdate = (state) => {
|
|
9304
9415
|
budgetFinalized ||= state.finalizeFired;
|
|
9305
9416
|
args.onBudgetUpdate?.({
|
|
@@ -9316,6 +9427,11 @@ async function verifyOneBatch(args, batch, sliceMs, signal) {
|
|
|
9316
9427
|
});
|
|
9317
9428
|
};
|
|
9318
9429
|
try {
|
|
9430
|
+
if (!args.moduleRoute) {
|
|
9431
|
+
for (const memory of batch) {
|
|
9432
|
+
skipSnapshots.set(memory.id, await raceWithSignal(verificationFilesFingerprint(args.sessionDirectory, memory.mappedFiles), batchSignal));
|
|
9433
|
+
}
|
|
9434
|
+
}
|
|
9319
9435
|
headAtPrompt = await raceWithSignal(readGitHead(args.sessionDirectory), batchSignal);
|
|
9320
9436
|
const evidence = !args.forceBroad && batch.every((m) => m.verifiedAt) ? await raceWithSignal(buildVerifyDiffEvidence(args.sessionDirectory, batch), batchSignal) : null;
|
|
9321
9437
|
const prompt = buildVerifyPrompt(args.projectIdentity, await raceWithSignal(seedVerifyCandidates(batch, args.sessionDirectory), batchSignal), evidence);
|
|
@@ -9357,7 +9473,7 @@ async function verifyOneBatch(args, batch, sliceMs, signal) {
|
|
|
9357
9473
|
tokens: run.completion.usage
|
|
9358
9474
|
});
|
|
9359
9475
|
reportUsage(run.completion.messages ?? [], run.childSessionId, run.completion.usage.input + (run.completion.usage.cacheRead ?? 0) + (run.completion.usage.cacheWrite ?? 0));
|
|
9360
|
-
return await applyParsedVerifyManifest(args, batch, run.validated, evidence?.head ?? headAtPrompt, budgetFinalized);
|
|
9476
|
+
return await applyParsedVerifyManifest(args, batch, run.validated, evidence?.head ?? headAtPrompt, budgetFinalized, skipSnapshots);
|
|
9361
9477
|
}
|
|
9362
9478
|
const client = args.client;
|
|
9363
9479
|
if (!client)
|
|
@@ -9417,7 +9533,7 @@ async function verifyOneBatch(args, batch, sliceMs, signal) {
|
|
|
9417
9533
|
promptSettled = true;
|
|
9418
9534
|
recordInvocation4(args, startedAt, { status: "completed", messages: run.output });
|
|
9419
9535
|
reportUsage(run.output, agentSessionId);
|
|
9420
|
-
return await applyParsedVerifyManifest(args, batch, run.validated, evidence?.head ?? headAtPrompt, budgetFinalized);
|
|
9536
|
+
return await applyParsedVerifyManifest(args, batch, run.validated, evidence?.head ?? headAtPrompt, budgetFinalized, skipSnapshots);
|
|
9421
9537
|
} catch (error) {
|
|
9422
9538
|
const desc = describeError(error);
|
|
9423
9539
|
const providerFailure = error instanceof DreamerProviderOutputFailureError ? error : undefined;
|
|
@@ -9437,7 +9553,7 @@ async function verifyOneBatch(args, batch, sliceMs, signal) {
|
|
|
9437
9553
|
if (interrupted) {
|
|
9438
9554
|
const text = verifyAssistantText(messages) ?? failedCompletion?.text ?? "";
|
|
9439
9555
|
const recovered = parsePartialVerifyManifest(text, new Set(batch.map((m) => m.id)));
|
|
9440
|
-
const counts = await applyParsedVerifyManifest(args, batch, recovered, headAtPrompt, true);
|
|
9556
|
+
const counts = await applyParsedVerifyManifest(args, batch, recovered, headAtPrompt, true, skipSnapshots);
|
|
9441
9557
|
return {
|
|
9442
9558
|
...counts,
|
|
9443
9559
|
timedOut: !(error instanceof DreamTokenBudgetExceeded),
|
|
@@ -9469,7 +9585,7 @@ async function verifyOneBatch(args, batch, sliceMs, signal) {
|
|
|
9469
9585
|
signal.removeEventListener("abort", abort);
|
|
9470
9586
|
}
|
|
9471
9587
|
}
|
|
9472
|
-
async function applyParsedVerifyManifest(args, batch, parsed, headAtPrompt, budgetFinalized = false) {
|
|
9588
|
+
async function applyParsedVerifyManifest(args, batch, parsed, headAtPrompt, budgetFinalized = false, skipSnapshots) {
|
|
9473
9589
|
const batchIds = new Set(batch.map((m) => m.id));
|
|
9474
9590
|
const batchById = new Map(batch.map((memory) => [memory.id, memory]));
|
|
9475
9591
|
const valid = {
|
|
@@ -9548,6 +9664,15 @@ async function applyParsedVerifyManifest(args, batch, parsed, headAtPrompt, budg
|
|
|
9548
9664
|
}
|
|
9549
9665
|
writes.push({ kind: "archive", id: a.id, reason: a.reason });
|
|
9550
9666
|
}
|
|
9667
|
+
if (!args.moduleRoute) {
|
|
9668
|
+
for (const entry of valid.skipped) {
|
|
9669
|
+
const original = batchById.get(entry.id);
|
|
9670
|
+
if (!original)
|
|
9671
|
+
continue;
|
|
9672
|
+
const fingerprint = skipSnapshots ? skipSnapshots.get(entry.id) ?? null : await verificationFilesFingerprint(args.sessionDirectory, original.mappedFiles);
|
|
9673
|
+
writes.push({ kind: "skip", id: entry.id, fingerprint });
|
|
9674
|
+
}
|
|
9675
|
+
}
|
|
9551
9676
|
let verified = 0;
|
|
9552
9677
|
let updated = 0;
|
|
9553
9678
|
let archived = 0;
|
|
@@ -9577,7 +9702,7 @@ async function applyParsedVerifyManifest(args, batch, parsed, headAtPrompt, budg
|
|
|
9577
9702
|
name: "memory.set_verification",
|
|
9578
9703
|
arguments: {
|
|
9579
9704
|
memory_project: args.projectIdentity,
|
|
9580
|
-
command_id: `${args.moduleRoute.moduleCommandId}:${
|
|
9705
|
+
command_id: `${args.moduleRoute.moduleCommandId}:${createHash7("sha256").update(rows.map((row) => row.memory_id).join(",")).digest("hex").slice(0, 16)}`,
|
|
9581
9706
|
rows
|
|
9582
9707
|
}
|
|
9583
9708
|
}
|
|
@@ -9609,9 +9734,17 @@ async function applyParsedVerifyManifest(args, batch, parsed, headAtPrompt, budg
|
|
|
9609
9734
|
continue;
|
|
9610
9735
|
if (w.kind === "verify") {
|
|
9611
9736
|
recordMemoryVerifications(args.db, w.id, w.files, now);
|
|
9612
|
-
|
|
9613
|
-
|
|
9737
|
+
updateMemoryVerification2(args.db, w.id, "verified");
|
|
9738
|
+
recordVerificationVerdict(args.db, memory, "verified", now);
|
|
9739
|
+
const verifiedMemory = getMemoryById2(args.db, w.id);
|
|
9740
|
+
if (verifiedHead && verifiedMemory)
|
|
9741
|
+
recordVerifiedCommit(args.db, verifiedMemory, now, verifiedHead);
|
|
9614
9742
|
verified += 1;
|
|
9743
|
+
} else if (w.kind === "skip") {
|
|
9744
|
+
if (memory.content !== batchById.get(w.id)?.content)
|
|
9745
|
+
continue;
|
|
9746
|
+
updateMemoryVerification2(args.db, w.id, "unverified");
|
|
9747
|
+
recordVerificationVerdict(args.db, memory, "skip", now, w.fingerprint);
|
|
9615
9748
|
} else if (w.kind === "update") {
|
|
9616
9749
|
const duplicate = getMemoryByHash2(args.db, memory.projectPath, memory.category, w.hash);
|
|
9617
9750
|
if (duplicate && duplicate.id !== memory.id) {
|
|
@@ -9620,6 +9753,8 @@ async function applyParsedVerifyManifest(args, batch, parsed, headAtPrompt, budg
|
|
|
9620
9753
|
continue;
|
|
9621
9754
|
}
|
|
9622
9755
|
rewriteMemoryContent(args.db, memory, w.content, w.hash);
|
|
9756
|
+
updateMemoryVerification2(args.db, w.id, "unverified");
|
|
9757
|
+
recordVerificationVerdict(args.db, memory, "update", now);
|
|
9623
9758
|
queueMemoryMutation(args.db, {
|
|
9624
9759
|
projectPath: args.projectIdentity,
|
|
9625
9760
|
mutationType: "update",
|
|
@@ -9630,6 +9765,8 @@ async function applyParsedVerifyManifest(args, batch, parsed, headAtPrompt, budg
|
|
|
9630
9765
|
updated += 1;
|
|
9631
9766
|
} else {
|
|
9632
9767
|
archiveMemory2(args.db, w.id, w.reason);
|
|
9768
|
+
updateMemoryVerification2(args.db, w.id, "stale");
|
|
9769
|
+
recordVerificationVerdict(args.db, memory, "archive", now);
|
|
9633
9770
|
queueMemoryMutation(args.db, {
|
|
9634
9771
|
projectPath: args.projectIdentity,
|
|
9635
9772
|
mutationType: "archive",
|
|
@@ -10423,7 +10560,7 @@ function parseFrictionGateVerdict(verdict) {
|
|
|
10423
10560
|
}
|
|
10424
10561
|
function computeRetrospectiveWindowKey(flagged) {
|
|
10425
10562
|
const anchors = flagged.map((message) => `${message.sessionId}:${message.ts}`).sort().join("|");
|
|
10426
|
-
return
|
|
10563
|
+
return createHash8("sha256").update(anchors).digest("hex").slice(0, 32);
|
|
10427
10564
|
}
|
|
10428
10565
|
function renderFrictionWindow(messages, flaggedOrdinals, radius = 2) {
|
|
10429
10566
|
const flagged = new Set(flaggedOrdinals);
|
|
@@ -12021,7 +12158,7 @@ function createDreamTimerModuleClient(moduleClient) {
|
|
|
12021
12158
|
import { readFileSync as readFileSync4, statSync as statSync3 } from "node:fs";
|
|
12022
12159
|
|
|
12023
12160
|
// src/plugin/embedding-bootstrap-helpers.ts
|
|
12024
|
-
import { createHash as
|
|
12161
|
+
import { createHash as createHash9 } from "node:crypto";
|
|
12025
12162
|
var EMBEDDING_AFFECTING_KEYS = new Set([
|
|
12026
12163
|
"embedding.api_key",
|
|
12027
12164
|
"embedding.endpoint",
|
|
@@ -12069,7 +12206,7 @@ var EMBEDDING_WARNING_TERMS = [
|
|
|
12069
12206
|
];
|
|
12070
12207
|
var loggedFailureSignatures = new Map;
|
|
12071
12208
|
function sha256Prefix(value, length = 16) {
|
|
12072
|
-
return
|
|
12209
|
+
return createHash9("sha256").update(value).digest("hex").slice(0, length);
|
|
12073
12210
|
}
|
|
12074
12211
|
function warningLooksEmbeddingRelated(message) {
|
|
12075
12212
|
const lower = message.toLowerCase();
|
|
@@ -12433,13 +12570,19 @@ function modelMatchedPersistedUsage(db, sessionID, modelKey) {
|
|
|
12433
12570
|
return;
|
|
12434
12571
|
}
|
|
12435
12572
|
function modelMatchedProvenContextLimit(db, sessionID, modelKey) {
|
|
12436
|
-
|
|
12437
|
-
|
|
12573
|
+
if (!db || !sessionID || !modelKey)
|
|
12574
|
+
return;
|
|
12575
|
+
try {
|
|
12576
|
+
const provenLimit = resolveOpenCodeProvenInputFloor(db, sessionID, modelKey);
|
|
12577
|
+
return isSaneLimit(provenLimit) ? provenLimit : undefined;
|
|
12578
|
+
} catch {
|
|
12579
|
+
return;
|
|
12580
|
+
}
|
|
12438
12581
|
}
|
|
12439
|
-
function applySessionProvenFloor(geometry,
|
|
12440
|
-
const provenLimit = isSaneLimit(persisted?.observedSafeInputTokens) ? persisted.observedSafeInputTokens : undefined;
|
|
12582
|
+
function applySessionProvenFloor(geometry, provenLimit, ctx) {
|
|
12441
12583
|
const result = applyProvenInputFloor(geometry, provenLimit);
|
|
12442
12584
|
if (result.refused && ctx?.db && ctx.sessionID) {
|
|
12585
|
+
const persisted = loadPersistedUsage(ctx.db, ctx.sessionID);
|
|
12443
12586
|
const impossiblePressure = persisted?.usage.inputTokens ? persisted.usage.inputTokens > result.refused.absoluteWall : false;
|
|
12444
12587
|
updateSessionMeta(ctx.db, ctx.sessionID, {
|
|
12445
12588
|
observedSafeInputTokens: 0,
|
|
@@ -12473,7 +12616,7 @@ function resolveContextWindowGeometry(providerID, modelID, ctx) {
|
|
|
12473
12616
|
});
|
|
12474
12617
|
if (!geometry || detected !== undefined)
|
|
12475
12618
|
return geometry;
|
|
12476
|
-
return applySessionProvenFloor(geometry,
|
|
12619
|
+
return applySessionProvenFloor(geometry, modelMatchedProvenContextLimit(ctx?.db, ctx?.sessionID, modelKey), ctx);
|
|
12477
12620
|
}
|
|
12478
12621
|
function resolveContextLimit(providerID, modelID, ctx) {
|
|
12479
12622
|
const modelKey = resolveModelKey(providerID, modelID);
|
|
@@ -12991,6 +13134,78 @@ function computeOpenCodeWorkMetricsIncremental(openCodeDb, sessionId, carry, gen
|
|
|
12991
13134
|
return { carry, metrics: metricsFromCarry(view) };
|
|
12992
13135
|
}
|
|
12993
13136
|
|
|
13137
|
+
// src/features/magic-context/work-metrics-carry-storage.ts
|
|
13138
|
+
var STATE_KEY = "magicContextWorkMetrics";
|
|
13139
|
+
var storedCarry = object({
|
|
13140
|
+
version: literal(1),
|
|
13141
|
+
source: string(),
|
|
13142
|
+
newWorkSum: number(),
|
|
13143
|
+
lastTimeCreated: number(),
|
|
13144
|
+
lastId: string(),
|
|
13145
|
+
perAgent: array(tuple([
|
|
13146
|
+
string(),
|
|
13147
|
+
object({
|
|
13148
|
+
prevPrompt: number(),
|
|
13149
|
+
phaseId: number(),
|
|
13150
|
+
phasePeak: number(),
|
|
13151
|
+
phaseHasQualifying: boolean(),
|
|
13152
|
+
closedPhaseSum: number(),
|
|
13153
|
+
lastOutput: number(),
|
|
13154
|
+
seen: boolean()
|
|
13155
|
+
})
|
|
13156
|
+
]))
|
|
13157
|
+
});
|
|
13158
|
+
function readState2(db, sessionId) {
|
|
13159
|
+
const row = db.prepare("SELECT deferred_execute_state, new_work_tokens, total_input_tokens FROM session_meta WHERE session_id = ?").get(sessionId);
|
|
13160
|
+
let root = {};
|
|
13161
|
+
try {
|
|
13162
|
+
const value = JSON.parse(row?.deferred_execute_state ?? "null");
|
|
13163
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value))
|
|
13164
|
+
root = value;
|
|
13165
|
+
} catch {}
|
|
13166
|
+
return { root, newWorkTokens: row?.new_work_tokens, totalInputTokens: row?.total_input_tokens };
|
|
13167
|
+
}
|
|
13168
|
+
function matchesStoredState(state, source, carry, metrics) {
|
|
13169
|
+
const parsed = storedCarry.safeParse(state.root[STATE_KEY]);
|
|
13170
|
+
if (!parsed.success)
|
|
13171
|
+
return false;
|
|
13172
|
+
const previous = parsed.data;
|
|
13173
|
+
if (previous.source !== source || previous.newWorkSum !== carry.newWorkSum || previous.lastTimeCreated !== carry.lastTimeCreated || previous.lastId !== carry.lastId || previous.perAgent.length !== carry.perAgent.size || state.newWorkTokens !== metrics.newWorkTokens || state.totalInputTokens !== metrics.totalInputTokens)
|
|
13174
|
+
return false;
|
|
13175
|
+
return previous.perAgent.every(([key, agent]) => {
|
|
13176
|
+
const current = carry.perAgent.get(key);
|
|
13177
|
+
return current !== undefined && agent.prevPrompt === current.prevPrompt && agent.phaseId === current.phaseId && agent.phasePeak === current.phasePeak && agent.phaseHasQualifying === current.phaseHasQualifying && agent.closedPhaseSum === current.closedPhaseSum && agent.lastOutput === current.lastOutput && agent.seen === current.seen;
|
|
13178
|
+
});
|
|
13179
|
+
}
|
|
13180
|
+
function readSessionWorkMetricsCarry(db, sessionId, source) {
|
|
13181
|
+
const parsed = storedCarry.safeParse(readState2(db, sessionId).root[STATE_KEY]);
|
|
13182
|
+
if (!parsed.success || parsed.data.source !== source)
|
|
13183
|
+
return;
|
|
13184
|
+
return {
|
|
13185
|
+
perAgent: new Map(parsed.data.perAgent),
|
|
13186
|
+
newWorkSum: parsed.data.newWorkSum,
|
|
13187
|
+
lastTimeCreated: parsed.data.lastTimeCreated,
|
|
13188
|
+
lastId: parsed.data.lastId
|
|
13189
|
+
};
|
|
13190
|
+
}
|
|
13191
|
+
function setSessionWorkMetricsCarry(db, sessionId, source, carry, metrics) {
|
|
13192
|
+
const normalized = {
|
|
13193
|
+
newWorkTokens: Math.max(0, Math.floor(metrics.newWorkTokens)),
|
|
13194
|
+
totalInputTokens: Math.max(0, Math.floor(metrics.totalInputTokens))
|
|
13195
|
+
};
|
|
13196
|
+
if (matchesStoredState(readState2(db, sessionId), source, carry, normalized))
|
|
13197
|
+
return;
|
|
13198
|
+
db.transaction(() => {
|
|
13199
|
+
const state = readState2(db, sessionId);
|
|
13200
|
+
if (matchesStoredState(state, source, carry, normalized))
|
|
13201
|
+
return;
|
|
13202
|
+
ensureSessionMetaRow(db, sessionId);
|
|
13203
|
+
const { root } = state;
|
|
13204
|
+
root[STATE_KEY] = { ...carry, version: 1, source, perAgent: [...carry.perAgent] };
|
|
13205
|
+
db.prepare("UPDATE session_meta SET deferred_execute_state = ?, new_work_tokens = ?, total_input_tokens = ? WHERE session_id = ?").run(JSON.stringify(root), normalized.newWorkTokens, normalized.totalInputTokens, sessionId);
|
|
13206
|
+
}).immediate();
|
|
13207
|
+
}
|
|
13208
|
+
|
|
12994
13209
|
// src/hooks/magic-context/format-embed-failure.ts
|
|
12995
13210
|
function formatEmbedFailureSummary(embedded, remaining, failure, style = "markdown") {
|
|
12996
13211
|
const historyBlocks = `history block${embedded === 1 ? "" : "s"}`;
|
|
@@ -15261,7 +15476,6 @@ function pluginPackageVersion(moduleUrl = import.meta.url) {
|
|
|
15261
15476
|
}
|
|
15262
15477
|
|
|
15263
15478
|
// src/plugin/rpc-handlers.ts
|
|
15264
|
-
var workMetricsCarryBySession = new Map;
|
|
15265
15479
|
async function executeRustRecompRpc(moduleClient, sessionId, projectRoot) {
|
|
15266
15480
|
if (!moduleClient)
|
|
15267
15481
|
return { ok: false, error: "Rust module client is unavailable" };
|
|
@@ -15301,12 +15515,11 @@ function resolveSidebarWorkMetrics(db, sessionId, persistedNewWork, persistedTot
|
|
|
15301
15515
|
return { newWorkTokens: persistedNewWork, totalInputTokens: persistedTotalInput };
|
|
15302
15516
|
}
|
|
15303
15517
|
try {
|
|
15304
|
-
const
|
|
15305
|
-
const carry =
|
|
15518
|
+
const source = `${generation}:${resolveOpenCodeDbPath(generation).path}`;
|
|
15519
|
+
const carry = readSessionWorkMetricsCarry(db, sessionId, source) ?? emptyWorkMetricsCarry();
|
|
15306
15520
|
const { carry: nextCarry, metrics } = withReadOnlySessionDb((openCodeDb) => computeOpenCodeWorkMetricsIncremental(openCodeDb, sessionId, carry, generation), generation);
|
|
15307
|
-
workMetricsCarryBySession.set(carryKey, nextCarry);
|
|
15308
15521
|
try {
|
|
15309
|
-
|
|
15522
|
+
setSessionWorkMetricsCarry(db, sessionId, source, nextCarry, metrics);
|
|
15310
15523
|
} catch {}
|
|
15311
15524
|
return metrics;
|
|
15312
15525
|
} catch {
|
|
@@ -16153,7 +16366,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16153
16366
|
return { count: buildCompartmentCount(db, sessionId, moduleStatus) };
|
|
16154
16367
|
});
|
|
16155
16368
|
const buildManagedCtx = async (db) => {
|
|
16156
|
-
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-
|
|
16369
|
+
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-htj16n4x.js"));
|
|
16157
16370
|
const { resolveHistorianModel } = await importPluginModule(() => import("./model-resolution-280gmqvd.js"));
|
|
16158
16371
|
const { userObservationCollectionEnabled, userObservationsRequested } = await importPluginModule(() => import("./task-config-t6bpyka7.js"));
|
|
16159
16372
|
const DEFAULT_HISTORIAN_TIMEOUT_MS = 10 * 60 * 1000;
|
|
@@ -16186,7 +16399,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16186
16399
|
return { ok: false, error: "no session" };
|
|
16187
16400
|
const readDirectory = args.readSessionDirectory;
|
|
16188
16401
|
if (readDirectory) {
|
|
16189
|
-
const { handoffHistoryWork } = await import("./history-owner-
|
|
16402
|
+
const { handoffHistoryWork } = await import("./history-owner-0z620wgz.js");
|
|
16190
16403
|
const handed = await handoffHistoryWork({
|
|
16191
16404
|
storageDir: args.storageDir ?? getMagicContextStorageDir(),
|
|
16192
16405
|
directory,
|
|
@@ -16205,8 +16418,8 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16205
16418
|
const db = readDatabase();
|
|
16206
16419
|
if (!db)
|
|
16207
16420
|
return { ok: false, error: "db unavailable" };
|
|
16208
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16209
|
-
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-
|
|
16421
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-wk509qkp.js"));
|
|
16422
|
+
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-14p3yje4.js"));
|
|
16210
16423
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
16211
16424
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
16212
16425
|
return {
|
|
@@ -16264,7 +16477,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16264
16477
|
rpcServer.handle("wrapup", async (params) => {
|
|
16265
16478
|
const readDirectory = args.readSessionDirectory;
|
|
16266
16479
|
if (readDirectory && params.sessionId) {
|
|
16267
|
-
const { handoffHistoryWork } = await import("./history-owner-
|
|
16480
|
+
const { handoffHistoryWork } = await import("./history-owner-0z620wgz.js");
|
|
16268
16481
|
const sessionId = String(params.sessionId);
|
|
16269
16482
|
const handed = await handoffHistoryWork({
|
|
16270
16483
|
storageDir: args.storageDir ?? getMagicContextStorageDir(),
|
|
@@ -16290,7 +16503,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16290
16503
|
const db = readDatabase();
|
|
16291
16504
|
if (!db)
|
|
16292
16505
|
return { ok: false, error: "db unavailable" };
|
|
16293
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16506
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-xg9avt2p.js"));
|
|
16294
16507
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
16295
16508
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
16296
16509
|
const ctx = {
|
|
@@ -17261,6 +17474,44 @@ function createPassOutcome() {
|
|
|
17261
17474
|
};
|
|
17262
17475
|
}
|
|
17263
17476
|
|
|
17477
|
+
// src/hooks/magic-context/release-recovery-prefix.ts
|
|
17478
|
+
function groups(messages) {
|
|
17479
|
+
const result = new Map;
|
|
17480
|
+
for (const message of messages) {
|
|
17481
|
+
if (!message.info.id)
|
|
17482
|
+
continue;
|
|
17483
|
+
const group = result.get(message.info.id) ?? [];
|
|
17484
|
+
group.push(message);
|
|
17485
|
+
result.set(message.info.id, group);
|
|
17486
|
+
}
|
|
17487
|
+
return result;
|
|
17488
|
+
}
|
|
17489
|
+
function visibleGroup(group) {
|
|
17490
|
+
return JSON.stringify(group.map((message) => ({
|
|
17491
|
+
role: message.info.role,
|
|
17492
|
+
parts: message.parts.filter((part) => !isStructuralNoiseSentinel(part) && !(isRecord(part) && (part.type === "step-start" || part.type === "step-finish" || part.type === "meta"))).map(providerVisiblePart)
|
|
17493
|
+
})));
|
|
17494
|
+
}
|
|
17495
|
+
function snapshotRecoveryMessages(messages) {
|
|
17496
|
+
return new Map([...groups(messages)].map(([id, group]) => [id, visibleGroup(group)]));
|
|
17497
|
+
}
|
|
17498
|
+
function releaseRecoveryPrefix(args) {
|
|
17499
|
+
const frozen = groups(args.frozen);
|
|
17500
|
+
const rendered = groups(args.after);
|
|
17501
|
+
const emitted = new Set;
|
|
17502
|
+
return args.after.flatMap((message) => {
|
|
17503
|
+
const id = message.info.id;
|
|
17504
|
+
if (!id)
|
|
17505
|
+
return [message];
|
|
17506
|
+
if (emitted.has(id))
|
|
17507
|
+
return [];
|
|
17508
|
+
emitted.add(id);
|
|
17509
|
+
const group = rendered.get(id) ?? [message];
|
|
17510
|
+
const previous = frozen.get(id);
|
|
17511
|
+
return previous && args.before.get(id) === visibleGroup(group) ? previous : group;
|
|
17512
|
+
});
|
|
17513
|
+
}
|
|
17514
|
+
|
|
17264
17515
|
// src/hooks/magic-context/render-options.ts
|
|
17265
17516
|
function createM0RenderOptions(controls, contextUsage, modelKey, resolvedContextLimit, projectPath) {
|
|
17266
17517
|
return {
|
|
@@ -17292,7 +17543,7 @@ function resolveHistoryBudgetTokens(historyBudgetPercentage, contextUsage, execu
|
|
|
17292
17543
|
}
|
|
17293
17544
|
|
|
17294
17545
|
// src/hooks/magic-context/rust-mode-transform.ts
|
|
17295
|
-
import { createHash as
|
|
17546
|
+
import { createHash as createHash13, randomUUID as randomUUID6 } from "node:crypto";
|
|
17296
17547
|
|
|
17297
17548
|
// src/features/magic-context/memory/single-store-embedding-drain.ts
|
|
17298
17549
|
function isWatermarkRow(row) {
|
|
@@ -17356,7 +17607,7 @@ function advanceEmbeddedWatermark(db, projectPath, upTo) {
|
|
|
17356
17607
|
}
|
|
17357
17608
|
|
|
17358
17609
|
// src/features/magic-context/mural/source-revision.ts
|
|
17359
|
-
import { createHash as
|
|
17610
|
+
import { createHash as createHash10 } from "node:crypto";
|
|
17360
17611
|
var statements = new WeakMap;
|
|
17361
17612
|
function muralSourceRevision(db, projectPath) {
|
|
17362
17613
|
let statement = statements.get(db);
|
|
@@ -17373,7 +17624,7 @@ function muralSourceRevision(db, projectPath) {
|
|
|
17373
17624
|
statements.set(db, statement);
|
|
17374
17625
|
}
|
|
17375
17626
|
const row = statement.get(projectPath, Date.now());
|
|
17376
|
-
return
|
|
17627
|
+
return createHash10("sha256").update(row.revision).digest("hex");
|
|
17377
17628
|
}
|
|
17378
17629
|
|
|
17379
17630
|
// src/features/magic-context/install-instance-id.ts
|
|
@@ -19834,7 +20085,7 @@ function noteExternalLkgReplay(participant, sessionId, inputMessages, servedMess
|
|
|
19834
20085
|
}
|
|
19835
20086
|
|
|
19836
20087
|
// src/hooks/magic-context/rust-served-raw.ts
|
|
19837
|
-
import { createHash as
|
|
20088
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
19838
20089
|
class RustServedRawConflict extends EmergencyFailClosedError {
|
|
19839
20090
|
reason;
|
|
19840
20091
|
messageIds;
|
|
@@ -19848,7 +20099,7 @@ class RustServedRawConflict extends EmergencyFailClosedError {
|
|
|
19848
20099
|
}
|
|
19849
20100
|
function partDigest(part) {
|
|
19850
20101
|
const serialized = JSON.stringify(part);
|
|
19851
|
-
return
|
|
20102
|
+
return createHash12("sha256").update(stableStringify(serialized === undefined ? undefined : JSON.parse(serialized))).digest("hex");
|
|
19852
20103
|
}
|
|
19853
20104
|
function records(doc) {
|
|
19854
20105
|
if (doc.rustServedRaw === undefined)
|
|
@@ -20082,6 +20333,32 @@ class StorageBusyRefusalError extends Error {
|
|
|
20082
20333
|
}
|
|
20083
20334
|
|
|
20084
20335
|
// src/hooks/magic-context/transform-context-state.ts
|
|
20336
|
+
var usageRefusals = new WeakMap;
|
|
20337
|
+
function recordUsageRefusal(db, sessionId, refusedAt = Date.now()) {
|
|
20338
|
+
let sessions = usageRefusals.get(db);
|
|
20339
|
+
if (!sessions) {
|
|
20340
|
+
sessions = new Map;
|
|
20341
|
+
usageRefusals.set(db, sessions);
|
|
20342
|
+
}
|
|
20343
|
+
if (!sessions.has(sessionId))
|
|
20344
|
+
sessions.set(sessionId, refusedAt);
|
|
20345
|
+
}
|
|
20346
|
+
function shouldResetRefusedUsage(db, sessionId, meta, liveReading) {
|
|
20347
|
+
const refusals = usageRefusals.get(db);
|
|
20348
|
+
const refusedAt = refusals?.get(sessionId);
|
|
20349
|
+
if (refusedAt === undefined)
|
|
20350
|
+
return false;
|
|
20351
|
+
const readingAt = liveReading?.hasUsageTokens ? liveReading.updatedAt : meta.lastResponseTime;
|
|
20352
|
+
if (readingAt > refusedAt) {
|
|
20353
|
+
refusals?.delete(sessionId);
|
|
20354
|
+
return false;
|
|
20355
|
+
}
|
|
20356
|
+
const now = Date.now();
|
|
20357
|
+
const foldedAt = meta.cachedM0MaterializedAt ?? 0;
|
|
20358
|
+
if (foldedAt > refusedAt && foldedAt <= now)
|
|
20359
|
+
return true;
|
|
20360
|
+
return !!db.prepare("SELECT 1 FROM compartments WHERE session_id = ? AND harness = ? AND created_at > ? AND created_at <= ? LIMIT 1").get(sessionId, getHarness2(), refusedAt, now);
|
|
20361
|
+
}
|
|
20085
20362
|
function loadPersistedUsageWatermark(db, sessionId) {
|
|
20086
20363
|
const result = db.prepare("SELECT last_response_time FROM session_meta WHERE session_id = ?").get(sessionId);
|
|
20087
20364
|
if (result === null || typeof result !== "object")
|
|
@@ -20521,10 +20798,10 @@ function messageCacheSignature(message) {
|
|
|
20521
20798
|
const parts = Array.isArray(message.parts) ? message.parts : [];
|
|
20522
20799
|
const serializedParts = JSON.stringify(parts) ?? "null";
|
|
20523
20800
|
const serializedMessage = JSON.stringify(message) ?? "null";
|
|
20524
|
-
return `${messageIdOf(message) ?? ""}:${parts.length}:${Buffer.byteLength(serializedParts)}:${
|
|
20801
|
+
return `${messageIdOf(message) ?? ""}:${parts.length}:${Buffer.byteLength(serializedParts)}:${createHash13("sha256").update(serializedMessage).digest("hex")}`;
|
|
20525
20802
|
}
|
|
20526
20803
|
function advanceWireFingerprint(previous, encoded) {
|
|
20527
|
-
return
|
|
20804
|
+
return createHash13("sha256").update(previous).update("\\0").update(JSON.stringify(encoded) ?? "null").digest("hex");
|
|
20528
20805
|
}
|
|
20529
20806
|
function buildWireFingerprint(encoded) {
|
|
20530
20807
|
let fingerprint = "rust-wire-v1";
|
|
@@ -22316,7 +22593,7 @@ function createRustModeTransform(deps, options) {
|
|
|
22316
22593
|
const id = messageIdOf(message) ?? `index:${todoStart + offset}`;
|
|
22317
22594
|
const parts = message.parts?.filter((part) => isRecord3(part) && part.type === "tool" && part.tool === "todowrite");
|
|
22318
22595
|
if (parts?.length) {
|
|
22319
|
-
todoCalls.set(id,
|
|
22596
|
+
todoCalls.set(id, createHash13("sha256").update(JSON.stringify(parts)).digest("hex"));
|
|
22320
22597
|
} else {
|
|
22321
22598
|
todoCalls.delete(id);
|
|
22322
22599
|
}
|
|
@@ -23930,7 +24207,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
23930
24207
|
awaitedCompartmentRun = true;
|
|
23931
24208
|
compartmentInProgress = false;
|
|
23932
24209
|
} else {
|
|
23933
|
-
sessionLog2(args.sessionId, "transform:
|
|
24210
|
+
sessionLog2(args.sessionId, "transform: historian join timed out — reclaim and final fit checks continue; historian keeps running in the background");
|
|
23934
24211
|
}
|
|
23935
24212
|
}
|
|
23936
24213
|
}
|
|
@@ -24183,6 +24460,7 @@ function createTransform(deps) {
|
|
|
24183
24460
|
return;
|
|
24184
24461
|
throw degradedPassError(site, error);
|
|
24185
24462
|
};
|
|
24463
|
+
const structuralSentinelUpgradeFailed = deps.storeGeneration === "v1" && !deps.compactionOff && deps.transformMode !== "rust" && prepareStructuralSentinelChoices({ db, sessionId, messages }).structuralSentinelUpgrade === undefined;
|
|
24186
24464
|
if (deps.storeGeneration !== undefined) {
|
|
24187
24465
|
try {
|
|
24188
24466
|
if (rustModeTransform && readCoordinateGeneration(db, sessionId) !== deps.storeGeneration) {
|
|
@@ -24404,10 +24682,13 @@ function createTransform(deps) {
|
|
|
24404
24682
|
loadedSessions.add(sessionId);
|
|
24405
24683
|
const earlyStateSnapshot = loadTransformPassStateSnapshot(db, sessionId);
|
|
24406
24684
|
const historianFailureState = earlyStateSnapshot.historianFailure;
|
|
24407
|
-
|
|
24685
|
+
const liveUsageBeforeReset = deps.contextUsageMap.get(sessionId);
|
|
24686
|
+
const usageResetAfterRefusal = shouldResetRefusedUsage(db, sessionId, sessionMeta, liveUsageBeforeReset);
|
|
24687
|
+
if ((isFirstTransformPassForSession || usageResetAfterRefusal) && sessionMeta) {
|
|
24408
24688
|
const persistedPct = sessionMeta.lastContextPercentage ?? 0;
|
|
24409
|
-
if (persistedPct > 0) {
|
|
24410
|
-
|
|
24689
|
+
if (persistedPct > 0 || usageResetAfterRefusal && (sessionMeta.lastInputTokens > 0 || deps.contextUsageMap.has(sessionId))) {
|
|
24690
|
+
const resetPct = persistedPct || liveUsageBeforeReset?.usage.percentage || 0;
|
|
24691
|
+
sessionLog2(sessionId, `transform: ${isFirstTransformPassForSession ? "first pass" : "refused turn recovery"} reset — percentage=${resetPct.toFixed(1)}% — clearing stale usage state`);
|
|
24411
24692
|
updateSessionMeta(db, sessionId, {
|
|
24412
24693
|
lastContextPercentage: 0,
|
|
24413
24694
|
lastInputTokens: 0
|
|
@@ -24816,10 +25097,15 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24816
25097
|
let taggingSucceeded = false;
|
|
24817
25098
|
let recoveryBatch = null;
|
|
24818
25099
|
let recoveryNormalized = false;
|
|
25100
|
+
let recoveryReleased = false;
|
|
24819
25101
|
const untaggedReplayTailServed = !!recovery.prefix || untaggedReplayIds.size > 0 && messages.some((message) => untaggedReplayIds.has(message.info.id ?? ""));
|
|
25102
|
+
const releaseRecoveryReplay = untaggedReplayTailServed ? () => {
|
|
25103
|
+
recoveryReleased = true;
|
|
25104
|
+
} : undefined;
|
|
24820
25105
|
const normalizeRecoveryTail = untaggedReplayTailServed ? () => {
|
|
24821
25106
|
if (recoveryNormalized)
|
|
24822
25107
|
return;
|
|
25108
|
+
recoveryReleased = true;
|
|
24823
25109
|
const tail = messages.filter((message) => untaggedReplayIds.has(message.info.id ?? ""));
|
|
24824
25110
|
const tagged = tagMessages(sessionId, tail, deps.tagger, db, {
|
|
24825
25111
|
skipPrefixInjection: !ctxReduceCallable,
|
|
@@ -24895,6 +25181,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24895
25181
|
const targetTagNumbers = [...targets.keys()];
|
|
24896
25182
|
const targetsSliceTags = compactionOff ? [] : getDroppedTagsByNumbers2(db, sessionId, targetTagNumbers);
|
|
24897
25183
|
logTransformTiming(sessionId, "getDroppedTagsByNumbers", t1b, `targets=${targetTagNumbers.length} fetched=${targetsSliceTags.length}`);
|
|
25184
|
+
const recoveryBeforePostprocess = recovery.prefix ? snapshotRecoveryMessages(messages) : undefined;
|
|
24898
25185
|
let didMutateFromFlushedStatuses = false;
|
|
24899
25186
|
if (taggingSucceeded) {
|
|
24900
25187
|
try {
|
|
@@ -25039,7 +25326,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25039
25326
|
let contextUsageFromEstimate = hostOverWindow;
|
|
25040
25327
|
if (contextUsage.inputTokens <= 0 && protectionCacheBustingPass) {
|
|
25041
25328
|
const overflowRecoveryPass = usagePercentageSynthetic || emergencyRecoveryArmed;
|
|
25042
|
-
const savedProviderReading = overflowRecoveryPass ? null : savedProviderReadingForPass({
|
|
25329
|
+
const savedProviderReading = overflowRecoveryPass || usageResetAfterRefusal ? null : savedProviderReadingForPass({
|
|
25043
25330
|
persisted: persistedUsageBeforeResets,
|
|
25044
25331
|
currentModelKey: currentModelKeyForBoundary ?? (hardModelKey || undefined),
|
|
25045
25332
|
contextLimit: resolvedContextLimit,
|
|
@@ -25106,7 +25393,10 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25106
25393
|
const tPostProcess = performance.now();
|
|
25107
25394
|
dropProjectionEmergency = contextUsage.percentage >= 95;
|
|
25108
25395
|
const postTransformResult = await runPostTransformPhase2({
|
|
25396
|
+
opencode1: deps.storeGeneration === "v1",
|
|
25109
25397
|
opencode2: deps.storeGeneration === "v2",
|
|
25398
|
+
structuralSentinelUpgradeFailed,
|
|
25399
|
+
releaseRecoveryPrefix: releaseRecoveryReplay,
|
|
25110
25400
|
normalizeRecoveryTail,
|
|
25111
25401
|
compactionMarkerStrategy: deps.compactionMarkerStrategy ?? defaultCompactionMarkerStrategy2,
|
|
25112
25402
|
sessionId,
|
|
@@ -25201,7 +25491,17 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25201
25491
|
}
|
|
25202
25492
|
});
|
|
25203
25493
|
compactionModeTransitionPending.delete(sessionId);
|
|
25204
|
-
if (recovery.prefix && !recoveryNormalized) {
|
|
25494
|
+
if (recovery.prefix && recoveryReleased && !recoveryNormalized) {
|
|
25495
|
+
if (!recoveryBeforePostprocess)
|
|
25496
|
+
throw new Error("Cannot release recovery without its pre-edit snapshot");
|
|
25497
|
+
const released = releaseRecoveryPrefix({
|
|
25498
|
+
frozen: JSON.parse(recovery.prefix.json),
|
|
25499
|
+
before: recoveryBeforePostprocess,
|
|
25500
|
+
after: messages
|
|
25501
|
+
});
|
|
25502
|
+
messages.splice(0, messages.length, ...released);
|
|
25503
|
+
}
|
|
25504
|
+
if (recovery.prefix && !recoveryReleased) {
|
|
25205
25505
|
const renderedById = new Map;
|
|
25206
25506
|
for (const message of messages) {
|
|
25207
25507
|
if (!message.info.id)
|
|
@@ -25213,11 +25513,12 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25213
25513
|
const suffix = recoveryTailSources.flatMap(({ identity, pristineSystem }) => pristineSystem ? [pristineSystem] : renderedById.get(identity) ?? []);
|
|
25214
25514
|
messages.splice(0, messages.length, ...JSON.parse(recovery.prefix.json), ...suffix);
|
|
25215
25515
|
}
|
|
25216
|
-
const recoveryReleaseReason = recovery.rebuildReason ?? (recoveryNormalized ? "recovery_tail_normalized" : undefined);
|
|
25516
|
+
const recoveryReleaseReason = recovery.rebuildReason ?? (recoveryNormalized ? "recovery_tail_normalized" : recoveryReleased ? "recovery_prefix_released" : undefined);
|
|
25217
25517
|
if (recoveryReleaseReason)
|
|
25218
25518
|
postTransformResult.bustedThisPass = true;
|
|
25219
25519
|
passOutcome.markFinalized();
|
|
25220
25520
|
const finalWireTail = describeFinalWireTail(messages);
|
|
25521
|
+
const logIncompleteFinalWire = createFinalWireIncompleteLogger(sessionId);
|
|
25221
25522
|
const signedFitPreviouslyRefused = !compactionOff && activeThinkingPrefixHold && getMergedReasoningStrippedIds(db, sessionId).has(SIGNED_FIT_REFUSED_MARKER);
|
|
25222
25523
|
let finalWireEstimate;
|
|
25223
25524
|
if (postTransformResult.bustedThisPass) {
|
|
@@ -25247,6 +25548,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25247
25548
|
systemPromptHash: sessionMeta.systemPromptHash
|
|
25248
25549
|
}, boundaryContextLimit) : undefined);
|
|
25249
25550
|
if (finalWireEstimate) {
|
|
25551
|
+
logIncompleteFinalWire(finalWireEstimate, messages);
|
|
25250
25552
|
sessionLog2(sessionId, `transform: final-wire telemetry estimate=${finalWireEstimate.tokens} trusted=${finalWireEstimate.trusted} conversation=${finalWireEstimate.messageTokens.conversation} tools=${finalWireEstimate.messageTokens.toolCall} system=${finalWireEstimate.systemTokens} toolDefinitions=${finalWireEstimate.toolDefinitionTokens ?? "unknown"} tail=${finalWireTail}`);
|
|
25251
25553
|
}
|
|
25252
25554
|
if ((finalWireEstimate?.refusalGrade || finalWireEstimate?.refusalBasis === "byte-bound" && finalWireEstimate.refusalTokens !== undefined) && boundaryContextLimit > 0 && (finalWireEstimate.refusalTokens ?? finalWireEstimate.tokens) > boundaryContextLimit) {
|
|
@@ -25346,6 +25648,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25346
25648
|
}
|
|
25347
25649
|
try {
|
|
25348
25650
|
await host.hostRefuse(deps.client, sessionId);
|
|
25651
|
+
recordUsageRefusal(db, sessionId);
|
|
25349
25652
|
} catch (error) {
|
|
25350
25653
|
sessionLog2(sessionId, "transform: emergency fail-closed abort failed; refusing to return a sendable prompt:", getErrorMessage(error));
|
|
25351
25654
|
throw new EmergencyFailClosedError("Emergency recovery abort failed", {
|
|
@@ -25385,6 +25688,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25385
25688
|
}
|
|
25386
25689
|
}
|
|
25387
25690
|
}
|
|
25691
|
+
logIncompleteFinalWire(finalWireEstimate, messages);
|
|
25388
25692
|
if (!finalWireEstimate) {
|
|
25389
25693
|
sessionLog2(sessionId, `transform: final-wire telemetry estimate=unavailable trusted=false conversation=unknown tools=unknown system=unknown toolDefinitions=unknown tail=${finalWireTail}`);
|
|
25390
25694
|
}
|
|
@@ -25592,7 +25896,16 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25592
25896
|
});
|
|
25593
25897
|
deps.onPassPermission?.(sessionId, postTransformResult.prefixMutationPermitted);
|
|
25594
25898
|
};
|
|
25595
|
-
const timedTransform = (input, output) => withTransformTimingSummary(() =>
|
|
25899
|
+
const timedTransform = (input, output) => withTransformTimingSummary(async () => {
|
|
25900
|
+
const sessionId = findSessionId(output.messages);
|
|
25901
|
+
try {
|
|
25902
|
+
await transform(input, output);
|
|
25903
|
+
} catch (error) {
|
|
25904
|
+
if (sessionId && !deps.compactionOff && error instanceof EmergencyFailClosedError)
|
|
25905
|
+
recordUsageRefusal(deps.db, sessionId);
|
|
25906
|
+
throw error;
|
|
25907
|
+
}
|
|
25908
|
+
});
|
|
25596
25909
|
return Object.assign(timedTransform, {
|
|
25597
25910
|
clearSessionLogState,
|
|
25598
25911
|
invalidateRustWireState(sessionId) {
|
|
@@ -25815,12 +26128,12 @@ function systemPromptDates(prompt, sticky) {
|
|
|
25815
26128
|
}
|
|
25816
26129
|
|
|
25817
26130
|
// src/hooks/magic-context/system-prompt-diagnostics.ts
|
|
25818
|
-
import { createHash as
|
|
26131
|
+
import { createHash as createHash14 } from "node:crypto";
|
|
25819
26132
|
function snapshotSystemPrompt(system, preset) {
|
|
25820
26133
|
return { elements: system.map((element) => Buffer.from(element)), preset };
|
|
25821
26134
|
}
|
|
25822
26135
|
function describeSystemPromptChange(previous, current) {
|
|
25823
|
-
const metadata = (element) => element === undefined ? "absent" : `bytes=${element.length},md5=${
|
|
26136
|
+
const metadata = (element) => element === undefined ? "absent" : `bytes=${element.length},md5=${createHash14("md5").update(element).digest("hex")}`;
|
|
25824
26137
|
const elements = [];
|
|
25825
26138
|
for (let index = 0;index < Math.max(previous?.elements.length ?? 0, current.elements.length); index++) {
|
|
25826
26139
|
const before = previous?.elements[index];
|
|
@@ -26844,236 +27157,6 @@ function resolveCtxExpandMode(args, domain) {
|
|
|
26844
27157
|
return { kind: "error", message: rangeError(domain) };
|
|
26845
27158
|
}
|
|
26846
27159
|
|
|
26847
|
-
// src/tools/ctx-expand/render.ts
|
|
26848
|
-
import { createHash as createHash14 } from "node:crypto";
|
|
26849
|
-
function isRecord4(value) {
|
|
26850
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
26851
|
-
}
|
|
26852
|
-
function roleLabel(role) {
|
|
26853
|
-
if (role === "assistant")
|
|
26854
|
-
return "A (assistant)";
|
|
26855
|
-
if (role === "user")
|
|
26856
|
-
return "U (user)";
|
|
26857
|
-
return role;
|
|
26858
|
-
}
|
|
26859
|
-
function verboseRoleLabel(msg) {
|
|
26860
|
-
if (msg.role === "user" && msg.parts.length > 0 && msg.parts.every((part) => {
|
|
26861
|
-
if (!isRecord4(part))
|
|
26862
|
-
return false;
|
|
26863
|
-
if (part.type === "tool_result")
|
|
26864
|
-
return true;
|
|
26865
|
-
return part.type === "tool" && asToolPart(part)?.output != null;
|
|
26866
|
-
}))
|
|
26867
|
-
return "tool results";
|
|
26868
|
-
return roleLabel(msg.role);
|
|
26869
|
-
}
|
|
26870
|
-
function truncate2(value, max) {
|
|
26871
|
-
const t = value.trim();
|
|
26872
|
-
return t.length <= max ? t : `${t.slice(0, max)}…`;
|
|
26873
|
-
}
|
|
26874
|
-
function keyArg(input) {
|
|
26875
|
-
if (!input)
|
|
26876
|
-
return "";
|
|
26877
|
-
for (const k of ["filePath", "path", "pattern", "query", "symbol", "module", "action"]) {
|
|
26878
|
-
const v = input[k];
|
|
26879
|
-
if (typeof v === "string" && v.length > 0)
|
|
26880
|
-
return truncate2(v, 60);
|
|
26881
|
-
}
|
|
26882
|
-
if (typeof input.description === "string")
|
|
26883
|
-
return truncate2(input.description, 60);
|
|
26884
|
-
return "";
|
|
26885
|
-
}
|
|
26886
|
-
function asToolPart(part) {
|
|
26887
|
-
const type = typeof part.type === "string" ? part.type : "";
|
|
26888
|
-
if (type === "tool") {
|
|
26889
|
-
const state = isRecord4(part.state) ? part.state : null;
|
|
26890
|
-
const output = state && typeof state.output === "string" ? state.output : state && state.output != null ? JSON.stringify(state.output) : null;
|
|
26891
|
-
const metadata = state && isRecord4(state.metadata) ? state.metadata : null;
|
|
26892
|
-
const title = state && typeof state.title === "string" && state.title || metadata && typeof metadata.title === "string" && metadata.title || null;
|
|
26893
|
-
return {
|
|
26894
|
-
name: typeof part.tool === "string" ? part.tool : "tool",
|
|
26895
|
-
callId: typeof part.callID === "string" ? part.callID : "",
|
|
26896
|
-
title,
|
|
26897
|
-
input: state && isRecord4(state.input) ? state.input : null,
|
|
26898
|
-
output
|
|
26899
|
-
};
|
|
26900
|
-
}
|
|
26901
|
-
if (type === "tool_use") {
|
|
26902
|
-
return {
|
|
26903
|
-
name: typeof part.name === "string" ? part.name : "tool",
|
|
26904
|
-
callId: typeof part.id === "string" ? part.id : "",
|
|
26905
|
-
title: null,
|
|
26906
|
-
input: isRecord4(part.input) ? part.input : null,
|
|
26907
|
-
output: null
|
|
26908
|
-
};
|
|
26909
|
-
}
|
|
26910
|
-
if (type === "tool_result") {
|
|
26911
|
-
const content = part.content;
|
|
26912
|
-
const output = typeof content === "string" ? content : content != null ? JSON.stringify(content) : null;
|
|
26913
|
-
return {
|
|
26914
|
-
name: "tool_result",
|
|
26915
|
-
callId: typeof part.tool_use_id === "string" ? part.tool_use_id : "",
|
|
26916
|
-
title: null,
|
|
26917
|
-
input: null,
|
|
26918
|
-
output
|
|
26919
|
-
};
|
|
26920
|
-
}
|
|
26921
|
-
return null;
|
|
26922
|
-
}
|
|
26923
|
-
function textOf(part) {
|
|
26924
|
-
if (part.type === "text" && typeof part.text === "string")
|
|
26925
|
-
return part.text;
|
|
26926
|
-
return null;
|
|
26927
|
-
}
|
|
26928
|
-
function reasoningOf(part) {
|
|
26929
|
-
if ((part.type === "reasoning" || part.type === "thinking") && typeof part.text === "string") {
|
|
26930
|
-
return part.text;
|
|
26931
|
-
}
|
|
26932
|
-
return null;
|
|
26933
|
-
}
|
|
26934
|
-
function renderPartPreview(part, expandTools) {
|
|
26935
|
-
if (!isRecord4(part))
|
|
26936
|
-
return null;
|
|
26937
|
-
const expansion = expandToolPart(part, expandTools, true);
|
|
26938
|
-
if (expansion !== null)
|
|
26939
|
-
return ` • tool ${part.tool}: ${expansion}`;
|
|
26940
|
-
const text = textOf(part);
|
|
26941
|
-
if (text !== null) {
|
|
26942
|
-
const t = truncate2(text, 200);
|
|
26943
|
-
return t.length > 0 ? ` • ${t}` : null;
|
|
26944
|
-
}
|
|
26945
|
-
const tool = asToolPart(part);
|
|
26946
|
-
if (tool) {
|
|
26947
|
-
const arg = keyArg(tool.input);
|
|
26948
|
-
const head = arg ? `${tool.name}(${arg})` : tool.name;
|
|
26949
|
-
return tool.output !== null ? ` • tool ${head} → output ~${estimateTokens(tool.output)} tok` : ` • tool ${head}`;
|
|
26950
|
-
}
|
|
26951
|
-
const reasoning = reasoningOf(part);
|
|
26952
|
-
if (reasoning !== null)
|
|
26953
|
-
return ` • [reasoning] ${truncate2(reasoning, 120)}`;
|
|
26954
|
-
const type = typeof part.type === "string" ? part.type : "part";
|
|
26955
|
-
if (type === "file")
|
|
26956
|
-
return " • [file]";
|
|
26957
|
-
if (type === "step-start" || type === "step-finish")
|
|
26958
|
-
return null;
|
|
26959
|
-
return ` • [${type}]`;
|
|
26960
|
-
}
|
|
26961
|
-
function renderPartFull(part) {
|
|
26962
|
-
if (!isRecord4(part))
|
|
26963
|
-
return null;
|
|
26964
|
-
const text = textOf(part);
|
|
26965
|
-
if (text !== null) {
|
|
26966
|
-
return text.trim().length > 0 ? ` [text]
|
|
26967
|
-
${text}` : null;
|
|
26968
|
-
}
|
|
26969
|
-
const tool = asToolPart(part);
|
|
26970
|
-
if (tool) {
|
|
26971
|
-
const lines = [];
|
|
26972
|
-
const idSuffix = tool.callId ? ` #${tool.callId}` : "";
|
|
26973
|
-
lines.push(` [tool: ${tool.name}${idSuffix}]`);
|
|
26974
|
-
if (tool.title && tool.title.trim().length > 0) {
|
|
26975
|
-
lines.push(` description: ${tool.title.trim()}`);
|
|
26976
|
-
}
|
|
26977
|
-
if (tool.input)
|
|
26978
|
-
lines.push(` input: ${JSON.stringify(tool.input)}`);
|
|
26979
|
-
if (tool.output !== null)
|
|
26980
|
-
lines.push(` output:
|
|
26981
|
-
${tool.output}`);
|
|
26982
|
-
return lines.join(`
|
|
26983
|
-
`);
|
|
26984
|
-
}
|
|
26985
|
-
const type = typeof part.type === "string" ? part.type : "part";
|
|
26986
|
-
if (type === "file") {
|
|
26987
|
-
const name = typeof part.filename === "string" && part.filename || typeof part.url === "string" && part.url || "";
|
|
26988
|
-
return ` [file]${name ? ` ${name}` : ""}`;
|
|
26989
|
-
}
|
|
26990
|
-
return null;
|
|
26991
|
-
}
|
|
26992
|
-
function renderMessageByOrdinal(sessionId, ordinal) {
|
|
26993
|
-
const found = [];
|
|
26994
|
-
visitRawSessionMessages2(sessionId, ordinal, ordinal, (m) => {
|
|
26995
|
-
if (m.ordinal === ordinal)
|
|
26996
|
-
found.push(m);
|
|
26997
|
-
return false;
|
|
26998
|
-
});
|
|
26999
|
-
const msg = found[0];
|
|
27000
|
-
if (!msg) {
|
|
27001
|
-
return `No message at ordinal ${ordinal} in this session's stored history — it was deleted ` + `(session prune/revert) or the ordinal is wrong, so it can't be recovered. ` + `Re-run the tool if you still need the data.`;
|
|
27002
|
-
}
|
|
27003
|
-
const rendered = msg.parts.map(renderPartFull).filter((l) => l !== null);
|
|
27004
|
-
const lines = [`[${msg.ordinal}] ${roleLabel(msg.role)} — full recovery:`, ""];
|
|
27005
|
-
if (rendered.length === 0) {
|
|
27006
|
-
lines.push(" (no recoverable content — message had only structural/reasoning parts)");
|
|
27007
|
-
} else {
|
|
27008
|
-
lines.push(...rendered);
|
|
27009
|
-
}
|
|
27010
|
-
return lines.join(`
|
|
27011
|
-
`);
|
|
27012
|
-
}
|
|
27013
|
-
function renderVerboseRange(sessionId, start, end, tokenBudget, expandTools) {
|
|
27014
|
-
const out = [];
|
|
27015
|
-
let usedTokens = 0;
|
|
27016
|
-
let lastOrdinal = start - 1;
|
|
27017
|
-
let truncated = false;
|
|
27018
|
-
visitRawSessionMessages2(sessionId, start, end, (msg) => {
|
|
27019
|
-
const header = `[${msg.ordinal}] ${verboseRoleLabel(msg)}`;
|
|
27020
|
-
const partLines = msg.parts.map((part) => renderPartPreview(part, expandTools)).filter((l) => l !== null);
|
|
27021
|
-
const block = partLines.length > 0 ? `${header}
|
|
27022
|
-
${partLines.join(`
|
|
27023
|
-
`)}` : header;
|
|
27024
|
-
const blockTokens = estimateTokens(block);
|
|
27025
|
-
if (usedTokens + blockTokens > tokenBudget && out.length > 0) {
|
|
27026
|
-
truncated = true;
|
|
27027
|
-
return false;
|
|
27028
|
-
}
|
|
27029
|
-
out.push(block);
|
|
27030
|
-
usedTokens += blockTokens;
|
|
27031
|
-
lastOrdinal = msg.ordinal;
|
|
27032
|
-
return true;
|
|
27033
|
-
});
|
|
27034
|
-
return { text: out.join(`
|
|
27035
|
-
|
|
27036
|
-
`), lastOrdinal, truncated };
|
|
27037
|
-
}
|
|
27038
|
-
function renderItemByTag(db, sessionId, number, textIndexDomain = "part") {
|
|
27039
|
-
const tag = getTagById2(db, sessionId, number);
|
|
27040
|
-
if (!tag)
|
|
27041
|
-
return `no tag ${number} in this session; if ${number} came from a <session-history> heading or a ctx_search hit, it is an ordinal: use message=${number}`;
|
|
27042
|
-
if (tag.type === "tool") {
|
|
27043
|
-
const owner = tag.toolOwnerMessageId;
|
|
27044
|
-
if (!owner)
|
|
27045
|
-
return `Tag ${number}'s tool owner is unknown; its original call cannot be resolved safely.`;
|
|
27046
|
-
const message = readRawSessionMessageById2(sessionId, owner);
|
|
27047
|
-
if (!message)
|
|
27048
|
-
return `Tag ${number}'s original tool owner is no longer in stored history.`;
|
|
27049
|
-
const parts = message?.parts.filter((part) => isRecord4(part) && asToolPart(part)?.callId === tag.messageId) ?? [];
|
|
27050
|
-
if (!parts.some((part) => isRecord4(part) && asToolPart(part)?.output !== null)) {
|
|
27051
|
-
visitRawSessionMessages2(sessionId, message.ordinal + 1, Number.MAX_SAFE_INTEGER, (candidate) => {
|
|
27052
|
-
const matching = candidate.parts.filter((part) => isRecord4(part) && asToolPart(part)?.callId === tag.messageId);
|
|
27053
|
-
if (matching.some((part) => isRecord4(part) && part.type === "tool_use"))
|
|
27054
|
-
return false;
|
|
27055
|
-
parts.push(...matching);
|
|
27056
|
-
return matching.length === 0;
|
|
27057
|
-
});
|
|
27058
|
-
}
|
|
27059
|
-
const rendered = parts.map(renderPartFull).filter((part) => part !== null);
|
|
27060
|
-
return rendered.length ? rendered.join(`
|
|
27061
|
-
`) : `Tag ${number}'s original tool call is no longer in stored history.`;
|
|
27062
|
-
}
|
|
27063
|
-
const scoped = /^(.*):p(\d+)$/.exec(tag.messageId);
|
|
27064
|
-
const derived = /^(.*):mc-text-v1:([a-f0-9]+):([a-f0-9]+):o(\d+)$/.exec(tag.messageId);
|
|
27065
|
-
const owner = scoped?.[1] ?? derived?.[1] ?? tag.messageId;
|
|
27066
|
-
const message = readRawSessionMessageById2(sessionId, owner);
|
|
27067
|
-
if (!message)
|
|
27068
|
-
return `Tag ${number}'s original text is no longer in stored history.`;
|
|
27069
|
-
const index = scoped ? Number(scoped[2]) : 0;
|
|
27070
|
-
const piText = message.parts.filter((part) => isRecord4(part) && part.type === "text");
|
|
27071
|
-
const part = message.parts[index];
|
|
27072
|
-
const matching = derived ? piText.filter((part) => isRecord4(part) && typeof part.text === "string" && createHash14("sha256").update(part.text).digest("hex") === derived[3]) : [];
|
|
27073
|
-
const selected = derived ? matching[Number(derived[4])] : textIndexDomain === "text" ? piText[index] : part;
|
|
27074
|
-
return selected ? renderPartFull(selected) ?? "" : `Tag ${number}'s original text part is no longer in stored history.`;
|
|
27075
|
-
}
|
|
27076
|
-
|
|
27077
27160
|
// src/tools/ctx-expand/tools.ts
|
|
27078
27161
|
var CTX_EXPAND_RUST_TAG_REFUSAL = "Tag lookup isn't available on this session: its §N§ tags are numbered by the Rust transform engine and ctx_expand cannot resolve those numbers, so no content was returned. Expand by message instead: ctx_expand(message=<ordinal>) or ctx_expand(start=<ordinal>, end=<ordinal>), using ordinals from a <session-history> heading or a ctx_search hit.";
|
|
27079
27162
|
var ctxExpandArgsShape = {
|
|
@@ -27107,11 +27190,36 @@ function createCtxExpandTool(deps) {
|
|
|
27107
27190
|
if (mode.kind === "error") {
|
|
27108
27191
|
return mode.message;
|
|
27109
27192
|
}
|
|
27193
|
+
const source = rawMessageWorkerSource2(sessionId);
|
|
27194
|
+
const path = getSqliteDatabasePath2(deps.db);
|
|
27110
27195
|
if (mode.kind === "tag") {
|
|
27111
|
-
|
|
27196
|
+
if (source) {
|
|
27197
|
+
if (!path)
|
|
27198
|
+
throw new Error("Search archive worker unavailable: private archive has no off-thread source");
|
|
27199
|
+
const text = await readV2ArchiveOffThread2(path, source.path, sessionId, {
|
|
27200
|
+
kind: "tag",
|
|
27201
|
+
tag: mode.tag
|
|
27202
|
+
});
|
|
27203
|
+
if (text === null)
|
|
27204
|
+
throw new Error("Search archive worker unavailable: unexpected tag reply");
|
|
27205
|
+
return text;
|
|
27206
|
+
}
|
|
27207
|
+
return renderItemByTag2(deps.db, sessionId, mode.tag, "part", deps.recoveryAttachments);
|
|
27112
27208
|
}
|
|
27113
27209
|
if (mode.kind === "message") {
|
|
27114
|
-
|
|
27210
|
+
if (source) {
|
|
27211
|
+
if (!path)
|
|
27212
|
+
throw new Error("Search archive worker unavailable: private archive has no off-thread source");
|
|
27213
|
+
const text = await readV2ArchiveOffThread2(path, source.path, sessionId, {
|
|
27214
|
+
kind: "message",
|
|
27215
|
+
message: mode.message,
|
|
27216
|
+
tokenBudget: CTX_EXPAND_TOKEN_BUDGET
|
|
27217
|
+
});
|
|
27218
|
+
if (text === null)
|
|
27219
|
+
throw new Error("Search archive worker unavailable: unexpected message reply");
|
|
27220
|
+
return text;
|
|
27221
|
+
}
|
|
27222
|
+
return await renderSearchArchiveOffThread2(deps.db, sessionId, mode.message, mode.message, CTX_EXPAND_TOKEN_BUDGET) ?? renderMessageByOrdinal2(sessionId, mode.message, deps.recoveryAttachments);
|
|
27115
27223
|
}
|
|
27116
27224
|
const { start, end, verbose } = mode;
|
|
27117
27225
|
const lastCompartmentEnd = getLastCompartmentEndMessage(deps.db, sessionId);
|
|
@@ -27119,24 +27227,25 @@ function createCtxExpandTool(deps) {
|
|
|
27119
27227
|
return `Range ${start}-${end} is entirely within the live tail (after the last compacted message ${lastCompartmentEnd}); those messages are already visible in context.`;
|
|
27120
27228
|
}
|
|
27121
27229
|
const effectiveEnd = lastCompartmentEnd >= 0 ? Math.min(end, lastCompartmentEnd) : end;
|
|
27230
|
+
if (verbose && source) {
|
|
27231
|
+
if (!path)
|
|
27232
|
+
throw new Error("Search archive worker unavailable: private archive has no off-thread source");
|
|
27233
|
+
const text = await readV2ArchiveOffThread2(path, source.path, sessionId, {
|
|
27234
|
+
kind: "verbose",
|
|
27235
|
+
start,
|
|
27236
|
+
end: effectiveEnd,
|
|
27237
|
+
tokenBudget: CTX_EXPAND_TOKEN_BUDGET,
|
|
27238
|
+
expandTools: deps.expandTools
|
|
27239
|
+
});
|
|
27240
|
+
if (text === null)
|
|
27241
|
+
throw new Error("Search archive worker unavailable: unexpected verbose reply");
|
|
27242
|
+
return text;
|
|
27243
|
+
}
|
|
27122
27244
|
const archived = await renderSearchArchiveOffThread2(deps.db, sessionId, start, effectiveEnd, CTX_EXPAND_TOKEN_BUDGET);
|
|
27123
27245
|
if (archived)
|
|
27124
27246
|
return archived;
|
|
27125
27247
|
if (verbose) {
|
|
27126
|
-
|
|
27127
|
-
if (!v.text) {
|
|
27128
|
-
return `No messages found in range ${start}-${effectiveEnd}. The range may be outside this session's history.`;
|
|
27129
|
-
}
|
|
27130
|
-
const out = [
|
|
27131
|
-
`Messages ${start}-${v.lastOrdinal} (verbose). Recover any one in full with ctx_expand(message=<ordinal>):`,
|
|
27132
|
-
"",
|
|
27133
|
-
v.text
|
|
27134
|
-
];
|
|
27135
|
-
if (v.truncated) {
|
|
27136
|
-
out.push("", `Truncated at message ${v.lastOrdinal} (budget: ~${CTX_EXPAND_TOKEN_BUDGET} tokens). Call again with start=${v.lastOrdinal + 1} end=${effectiveEnd} verbose=true for more.`);
|
|
27137
|
-
}
|
|
27138
|
-
return out.join(`
|
|
27139
|
-
`);
|
|
27248
|
+
return renderVerboseRangeForTool2(sessionId, start, effectiveEnd, CTX_EXPAND_TOKEN_BUDGET, deps.expandTools, deps.recoveryAttachments);
|
|
27140
27249
|
}
|
|
27141
27250
|
const chunk = readSessionChunk2(sessionId, CTX_EXPAND_TOKEN_BUDGET, start, effectiveEnd + 1, { expand: false });
|
|
27142
27251
|
if (!chunk.text || chunk.messageCount === 0) {
|
|
@@ -27855,7 +27964,7 @@ import { existsSync as existsSync8 } from "node:fs";
|
|
|
27855
27964
|
import { isAbsolute as isAbsolute2 } from "node:path";
|
|
27856
27965
|
|
|
27857
27966
|
// ../retina-local-fs/src/path-fence.ts
|
|
27858
|
-
import { lstat as lstat2, realpath as
|
|
27967
|
+
import { lstat as lstat2, realpath as realpath3 } from "node:fs/promises";
|
|
27859
27968
|
import { homedir } from "node:os";
|
|
27860
27969
|
import { basename, dirname as dirname2, isAbsolute, join as join6, relative, resolve, sep } from "node:path";
|
|
27861
27970
|
|
|
@@ -27885,7 +27994,7 @@ async function resolveFenceRoots(options) {
|
|
|
27885
27994
|
const configuredHomePath = resolve(options.homeDirectory ?? process.env.HOME ?? homedir());
|
|
27886
27995
|
let home;
|
|
27887
27996
|
try {
|
|
27888
|
-
home = await
|
|
27997
|
+
home = await realpath3(configuredHomePath);
|
|
27889
27998
|
} catch (error) {
|
|
27890
27999
|
throw fsError(configuredHomePath, error);
|
|
27891
28000
|
}
|
|
@@ -27915,7 +28024,7 @@ function fenceCandidates(canonical, aliases) {
|
|
|
27915
28024
|
}
|
|
27916
28025
|
async function canonicalPath(path, allowMissing) {
|
|
27917
28026
|
try {
|
|
27918
|
-
return await
|
|
28027
|
+
return await realpath3(path);
|
|
27919
28028
|
} catch (error) {
|
|
27920
28029
|
if (!allowMissing || !isMissingError(error)) {
|
|
27921
28030
|
throw fsError(path, error);
|
|
@@ -27940,7 +28049,7 @@ async function canonicalPath(path, allowMissing) {
|
|
|
27940
28049
|
suffix.unshift(basename(candidate));
|
|
27941
28050
|
candidate = parent;
|
|
27942
28051
|
try {
|
|
27943
|
-
return join6(await
|
|
28052
|
+
return join6(await realpath3(candidate), ...suffix);
|
|
27944
28053
|
} catch (parentError) {
|
|
27945
28054
|
if (!isMissingError(parentError)) {
|
|
27946
28055
|
throw fsError(path, parentError);
|
|
@@ -29555,4 +29664,4 @@ function applyHiddenSubagentTemperature(input, output, log) {
|
|
|
29555
29664
|
output.temperature = temperature;
|
|
29556
29665
|
}
|
|
29557
29666
|
|
|
29558
|
-
export { logConfigDependencyNotesOnce, openOpenCodeDb, DREAMER_SYSTEM_PROMPT, runSessionProjectBackfill, SMART_NOTE_COMPILER_SYSTEM_PROMPT, createLiveSessionState, RETROSPECTIVE_MAX_USER_MESSAGE_CHARS, RETROSPECTIVE_MESSAGE_TRUNCATION_MARKER, OpenCodeRetrospectiveRawProvider, createDreamTaskExecutor, runManualDream, runDueTasksForProject, startDreamScheduleTimer, createDreamTimerModuleClient, ensureProjectRegisteredFromOpenCodeDirectory, recordOpenCodeProvenInputFloor, resolveOpenCodeProvenInputFloor, resolveContextWindowGeometry, resolveContextLimit, resolveExecuteThresholdDetail, resolveModelKey, resolveSessionId, createScheduler, describeStorageUnavailability, resolveSessionCacheTtl, runEmbedHistoryDrain, pauseEmbedHistoryDrain, formatEmbedStatusText, getSessionProperties, getSessionCreatedInfo, getMessageUpdatedAssistantInfo, getMessageUpdatedInfo, getSessionErrorInfo, getMessageRemovedInfo, summarizeManualDream, createMagicContextCommandHandler, getLiveNotificationParams, createChatMessageHook, createEventHook, createCommandExecuteBeforeHook, createToolExecuteAfterHook, recordHiddenVariantWarning, buildStatusDetail, isDebugRpcEnabled, registerRpcHandlers, maybeAutoEmbedSessionBackfill, clearTransformDecisionSession, scheduleOpenCodeTransformDecisionWrite, stageOpenCodeV2TransformDecision, bindOpenCodeV2TransformDecision, maybeDeliverChannel2, armLatestThinkingRecovery, armBindingRecoverySafely, armLatestThinkingRecoveryFromError, createM0RenderOptions, lkgReplayLimit, measureLkgReplay, STORAGE_BUSY_MESSAGE, StorageBusyRefusalError, bindSystemDateRequestIdentity, bindSystemDateOutput, registerSystemDateRefresh, rustWrapupHistorianFields, UnmanagedOverWindowError, UnresolvedHistoryBoundaryError, clearMessageTokensCache, createTransform, createSubcModuleClient, createModuleToolBackends, createRustRefusalRecovery, createSystemPromptHashHandler, tryMessagesTransformLkgReplay, createMessagesTransformHandler, primaryOnlyToolIds, subagentToolRefusal, guardSubagentTools, hideSubagentTools, removePrimaryOnlyTools, storedSubagentMode, createCtxExpandTools, CTX_MEMORY_LIST_TOOL_NAME, CTX_MEMORY_ACTIONS, createCtxMemoryTools, createCtxMemoryListTools, CTX_NOTE_DESCRIPTION, withoutSmartNoteText, createCtxNoteTools, createCtxReduceTools, createCtxSearchTools, parameterDescriptionsFor, applyJsonSchemaParameterDescriptions, MagicContextRpcServer, subagentTemperature, applyHiddenSubagentTemperature };
|
|
29667
|
+
export { logConfigDependencyNotesOnce, openOpenCodeDb, DREAMER_SYSTEM_PROMPT, runSessionProjectBackfill, SMART_NOTE_COMPILER_SYSTEM_PROMPT, createLiveSessionState, RETROSPECTIVE_MAX_USER_MESSAGE_CHARS, RETROSPECTIVE_MESSAGE_TRUNCATION_MARKER, OpenCodeRetrospectiveRawProvider, createDreamTaskExecutor, runManualDream, runDueTasksForProject, startDreamScheduleTimer, createDreamTimerModuleClient, ensureProjectRegisteredFromOpenCodeDirectory, recordOpenCodeProvenInputFloor, resolveOpenCodeProvenInputFloor, resolveContextWindowGeometry, resolveContextLimit, resolveExecuteThresholdDetail, resolveModelKey, resolveSessionId, parseCacheTtl, createScheduler, computeHardCacheExpired, describeStorageUnavailability, resolveSessionCacheTtl, runEmbedHistoryDrain, pauseEmbedHistoryDrain, formatEmbedStatusText, getSessionProperties, getSessionCreatedInfo, getMessageUpdatedAssistantInfo, getMessageUpdatedInfo, getSessionErrorInfo, getMessageRemovedInfo, summarizeManualDream, createMagicContextCommandHandler, getLiveNotificationParams, createChatMessageHook, createEventHook, createCommandExecuteBeforeHook, createToolExecuteAfterHook, recordHiddenVariantWarning, buildStatusDetail, isDebugRpcEnabled, registerRpcHandlers, maybeAutoEmbedSessionBackfill, clearTransformDecisionSession, scheduleOpenCodeTransformDecisionWrite, stageOpenCodeV2TransformDecision, bindOpenCodeV2TransformDecision, maybeDeliverChannel2, armLatestThinkingRecovery, armBindingRecoverySafely, armLatestThinkingRecoveryFromError, createM0RenderOptions, lkgReplayLimit, measureLkgReplay, STORAGE_BUSY_MESSAGE, StorageBusyRefusalError, bindSystemDateRequestIdentity, bindSystemDateOutput, registerSystemDateRefresh, rustWrapupHistorianFields, UnmanagedOverWindowError, UnresolvedHistoryBoundaryError, clearMessageTokensCache, createTransform, createSubcModuleClient, createModuleToolBackends, createRustRefusalRecovery, createSystemPromptHashHandler, tryMessagesTransformLkgReplay, createMessagesTransformHandler, primaryOnlyToolIds, subagentToolRefusal, guardSubagentTools, hideSubagentTools, removePrimaryOnlyTools, storedSubagentMode, createCtxExpandTools, CTX_MEMORY_LIST_TOOL_NAME, CTX_MEMORY_ACTIONS, createCtxMemoryTools, createCtxMemoryListTools, CTX_NOTE_DESCRIPTION, withoutSmartNoteText, createCtxNoteTools, createCtxReduceTools, createCtxSearchTools, parameterDescriptionsFor, applyJsonSchemaParameterDescriptions, MagicContextRpcServer, subagentTemperature, applyHiddenSubagentTemperature };
|