@cortexkit/opencode-magic-context 0.49.19 → 0.49.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-search-worker.js +48 -9
- package/dist/chunk-embedding-write-worker.js +30 -23
- package/dist/{compaction-marker-candidates-n4krhat4.js → compaction-marker-candidates-31h86ph0.js} +3 -3
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/compartment-chunk-embedding-he60aaa2.js +65 -0
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +43 -9
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-4pmz879v.js → conflict-warning-hook-2r32hyx6.js} +9 -8
- package/dist/{context-j31m2dv7.js → context-j7hp43a0.js} +576 -185
- package/dist/{derive-budgets-zn7yzd2d.js → derive-budgets-pqybnx09.js} +2 -2
- package/dist/embedding-backfill-dtke6tck.js +25 -0
- package/dist/embedding-worker-process.js +2 -2
- package/dist/embedding-worker.js +6 -6
- package/dist/features/magic-context/chunk-embedding-writer.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +44 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts +1 -0
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +2 -0
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-local.d.ts +1 -0
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-synapse.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts +7 -1
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts.map +1 -1
- package/dist/features/magic-context/memory/local-embedding-pooling.d.ts +22 -0
- package/dist/features/magic-context/memory/local-embedding-pooling.d.ts.map +1 -0
- package/dist/features/magic-context/message-index-async.d.ts +7 -2
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +2 -0
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +2 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/search-rerank.d.ts +9 -2
- package/dist/features/magic-context/search-rerank.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +29 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +2 -0
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +2 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts +20 -0
- package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/{history-owner-xp3pngv7.js → history-owner-36wp3mkb.js} +2 -2
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-embed-session.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-hint.d.ts +7 -1
- package/dist/hooks/magic-context/auto-search-hint.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts +33 -6
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +6 -2
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/channel2-delivery.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +5 -0
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/diagnostic-log-state.d.ts +4 -0
- package/dist/hooks/magic-context/diagnostic-log-state.d.ts.map +1 -0
- package/dist/hooks/magic-context/execute-reclaim.d.ts +35 -0
- package/dist/hooks/magic-context/execute-reclaim.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +1 -3
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/latest-assistant-turn.d.ts +8 -0
- package/dist/hooks/magic-context/latest-assistant-turn.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts +5 -0
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -1
- package/dist/hooks/magic-context/nudge-evaluation-log.d.ts +3 -0
- package/dist/hooks/magic-context/nudge-evaluation-log.d.ts.map +1 -0
- package/dist/hooks/magic-context/pending-drop-eligibility.d.ts.map +1 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +4 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
- package/dist/hooks/magic-context/served-shape-repair.d.ts +19 -0
- package/dist/hooks/magic-context/served-shape-repair.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-content.d.ts +4 -2
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-date-refresh.d.ts +5 -5
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-sticky-date.d.ts +10 -0
- package/dist/hooks/magic-context/system-prompt-sticky-date.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-content-primitives.d.ts +1 -1
- package/dist/hooks/magic-context/tag-content-primitives.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +4 -1
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/text-complete.d.ts +1 -1
- package/dist/hooks/magic-context/text-complete.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +21 -6
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +2 -2
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-3esx8tkf.js → index-11gzxvf4.js} +394 -125
- package/dist/{index-jn12fvvh.js → index-1gtfne2c.js} +3 -3
- package/dist/{index-jhghdnsm.js → index-1kbznkft.js} +521 -214
- package/dist/{index-3h4dp9wb.js → index-3svaejkh.js} +5 -5
- package/dist/{index-kee4kn5j.js → index-4pnsgvfk.js} +1 -1
- package/dist/{index-bjcnntmz.js → index-51rdvtkz.js} +501 -20
- package/dist/{v2/server-8cd2j99z.js → index-5kym00ag.js} +32 -13
- package/dist/{index-s74zqahq.js → index-66eby7hx.js} +4 -4
- package/dist/{index-63k48rv9.js → index-9q1g3c5q.js} +5 -5
- package/dist/{index-jrr131e0.js → index-a9zvn5fe.js} +29 -15
- package/dist/{index-c5pytzne.js → index-b88dwwrh.js} +1 -1
- package/dist/{index-nj7yykkx.js → index-c7phnbvk.js} +1 -1
- package/dist/index-cpjk5jd2.js +82 -0
- package/dist/{index-c1p88z1y.js → index-ffzhwfzy.js} +4 -4
- package/dist/{v2/server-beht37jy.js → index-gzy5w8ya.js} +194 -5
- package/dist/{index-j75v2476.js → index-h7tgn49j.js} +12 -15
- package/dist/{index-edmpdxcw.js → index-j32jj2t8.js} +5 -5
- package/dist/{index-ke416mdc.js → index-j76ah6d7.js} +2 -2
- package/dist/{index-s734jcsr.js → index-jfem3dgz.js} +9 -3
- package/dist/{index-n37sebck.js → index-jjvbk92s.js} +1 -1
- package/dist/{index-4911rn0b.js → index-jmq8kfe7.js} +6 -6
- package/dist/{index-rr2bb45z.js → index-kfyb3k6n.js} +2 -2
- package/dist/{index-2vxtcb95.js → index-kq5w68dp.js} +2 -2
- package/dist/{index-kq82mtg0.js → index-ksq50rg0.js} +3 -3
- package/dist/{index-b5vqckbw.js → index-m32esgmj.js} +314 -127
- package/dist/{index-9zcsy3hh.js → index-mnhcdfxg.js} +161 -13
- package/dist/{index-se4m2g6w.js → index-mnnkgq0q.js} +111 -19
- package/dist/{index-p5y3k4g7.js → index-nda0zgna.js} +2 -1
- package/dist/{index-wgypt3cs.js → index-nxrsns5x.js} +2466 -1290
- package/dist/{index-4s3t0nd0.js → index-qgh1qwjj.js} +2 -2
- package/dist/{index-y9f76s3f.js → index-rrv26qjz.js} +1 -1
- package/dist/{index-24fezq97.js → index-rxqr723x.js} +5 -5
- package/dist/{index-v10f1rjv.js → index-spwjbkc7.js} +1 -1
- package/dist/{index-dxmq29t1.js → index-syaazvy2.js} +182 -47
- package/dist/{index-k29z4aqh.js → index-t5pck3ss.js} +1 -1
- package/dist/{index-6x57ar45.js → index-wfybj1dw.js} +4 -6
- package/dist/{index-cf74k5ak.js → index-whcgcfrv.js} +9 -6
- package/dist/{index-a6mc0v4d.js → index-x6cbrv9h.js} +3 -3
- package/dist/{index-bp5083x2.js → index-x9k3mqrf.js} +1 -1
- package/dist/{index-rpxdjkm0.js → index-y76rhsnr.js} +319 -61
- package/dist/{index-ze7mvk54.js → index-zy67whjr.js} +95 -59
- package/dist/index.js +58 -54
- package/dist/{logger-jm3sqqzr.js → logger-94kew5wm.js} +1 -1
- package/dist/{message-fts-rowid-map-17s0dfn4.js → message-fts-rowid-map-e79b7b6x.js} +6 -5
- package/dist/{message-index-gtpqnj8w.js → message-index-4q8ek2fc.js} +17 -16
- package/dist/{message-index-bounded-zyc8h32y.js → message-index-bounded-rydsg9r5.js} +17 -16
- package/dist/{message-time-backfill-73mmm76q.js → message-time-backfill-4qva0b4f.js} +3 -3
- package/dist/migration-worker.js +13 -12
- package/dist/{model-resolution-nx97z3x7.js → model-resolution-280gmqvd.js} +1 -1
- package/dist/plugin/embedding-bootstrap.d.ts +4 -1
- package/dist/plugin/embedding-bootstrap.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +1 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +8 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/subagent-tool-policy.d.ts +9 -0
- package/dist/plugin/subagent-tool-policy.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/{project-embedding-registry-z74mhqkf.js → project-embedding-registry-hn529988.js} +16 -13
- package/dist/raw-ordinal-warmup-worker.js +136 -101
- package/dist/{read-session-chunk-jjb48bt9.js → read-session-chunk-t039f0m5.js} +12 -11
- package/dist/{read-session-raw-rsc8c7qy.js → read-session-raw-aw6jgvwg.js} +4 -3
- package/dist/recomp-orchestrator-hbm53jj5.js +62 -0
- package/dist/{safe-notification-target-1szv1k5k.js → safe-notification-target-mkr9yzvr.js} +2 -2
- package/dist/search-archive-weh164mh.js +26 -0
- package/dist/search-hea079d7.js +50 -0
- package/dist/{send-session-notification-6ve0e8p4.js → send-session-notification-gqzkz7da.js} +7 -6
- package/dist/shared/logger.d.ts.map +1 -1
- package/dist/shared/model-resolution.d.ts +2 -0
- package/dist/shared/model-resolution.d.ts.map +1 -1
- package/dist/shared/prompt-async-transport.d.ts +3 -0
- package/dist/shared/prompt-async-transport.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +7 -0
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/sqlite.d.ts +6 -1
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/subagent-runner.d.ts +2 -0
- package/dist/shared/subagent-runner.d.ts.map +1 -1
- package/dist/shared/tag-transcript.d.ts +2 -0
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/shared/worker-shutdown.d.ts +68 -0
- package/dist/shared/worker-shutdown.d.ts.map +1 -0
- package/dist/shared/worker-shutdown.fixture.d.ts +2 -0
- package/dist/shared/worker-shutdown.fixture.d.ts.map +1 -0
- package/dist/{sqlite-zf72c52d.js → sqlite-zdgm52sv.js} +5 -1
- package/dist/{storage-memory-y3qmy00r.js → storage-memory-e6a7mb0k.js} +2 -2
- package/dist/{storage-tags-r7k9tjcv.js → storage-tags-a77q4v77.js} +5 -5
- package/dist/{task-config-x3qmayd2.js → task-config-t6bpyka7.js} +2 -2
- package/dist/tools/ctx-search/tools.d.ts.map +1 -1
- package/dist/tools/ctx-search/types.d.ts +1 -0
- package/dist/tools/ctx-search/types.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-jj99r7z2.js → transform-postprocess-phase-0b04tm1p.js} +35 -32
- package/dist/v2/auto-search-worker.js +48 -9
- package/dist/v2/chunk-embedding-write-worker.js +30 -23
- package/dist/v2/{compaction-marker-candidates-ebx3388k.js → compaction-marker-candidates-m4vmye3w.js} +3 -3
- package/dist/v2/compaction-marker-candidates-worker.js +2 -2
- package/dist/v2/compartment-chunk-embedding-8jjmcgeg.js +64 -0
- package/dist/v2/{context-y5yamxak.js → context-ea3x7smm.js} +1797 -810
- package/dist/v2/{derive-budgets-2zh4gm2c.js → derive-budgets-knf763tt.js} +3 -3
- package/dist/v2/embedding-backfill-5e74ae0m.js +24 -0
- package/dist/v2/embedding-worker-process.js +2 -2
- package/dist/v2/embedding-worker.js +6 -6
- package/dist/v2/hidden-child-record.d.ts +2 -0
- package/dist/v2/hidden-child-record.d.ts.map +1 -1
- package/dist/v2/hidden-completion.d.ts +2 -0
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hidden-model-activity.d.ts +7 -0
- package/dist/v2/hidden-model-activity.d.ts.map +1 -0
- package/dist/v2/{history-owner-42e16w0n.js → history-owner-ad0crnrn.js} +2 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/copied-tag-notation.d.ts +1 -1
- package/dist/v2/hooks/copied-tag-notation.d.ts.map +1 -1
- package/dist/v2/hooks/dream-timer.d.ts +2 -0
- package/dist/v2/hooks/dream-timer.d.ts.map +1 -1
- package/dist/v2/hooks/embedding-lifecycle.d.ts +7 -0
- package/dist/v2/hooks/embedding-lifecycle.d.ts.map +1 -0
- package/dist/v2/hooks/generate.d.ts +36 -1
- package/dist/v2/hooks/generate.d.ts.map +1 -1
- package/dist/v2/hooks/lkg-system.d.ts +35 -4
- package/dist/v2/hooks/lkg-system.d.ts.map +1 -1
- package/dist/v2/hooks/payload.d.ts +16 -1
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/store.d.ts +2 -0
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/hooks/tools.d.ts +2 -1
- package/dist/v2/hooks/tools.d.ts.map +1 -1
- package/dist/v2/hooks/transform-features.d.ts +2 -2
- package/dist/v2/hooks/transform-features.d.ts.map +1 -1
- package/dist/v2/{logger-7qt02bnb.js → logger-p34mjtja.js} +1 -1
- package/dist/v2/{message-fts-rowid-map-wfx67gfd.js → message-fts-rowid-map-n8fdg2ja.js} +6 -5
- package/dist/v2/{message-index-bounded-spd8r7pj.js → message-index-bounded-8rcd7qq9.js} +17 -16
- package/dist/v2/{message-index-8vz2pq76.js → message-index-qz9wdp82.js} +17 -16
- package/dist/v2/{message-time-backfill-04t0km1z.js → message-time-backfill-zvthw6xb.js} +3 -3
- package/dist/v2/migration-worker.js +13 -12
- package/dist/v2/{model-resolution-nx97z3x7.js → model-resolution-280gmqvd.js} +1 -1
- package/dist/v2/{project-embedding-registry-gnkj56xp.js → project-embedding-registry-v38q4xd5.js} +16 -13
- package/dist/v2/raw-ordinal-warmup-worker.js +136 -101
- package/dist/v2/{read-session-chunk-cwkxrmns.js → read-session-chunk-wazfyxcg.js} +12 -11
- package/dist/v2/{read-session-raw-yaegtjzh.js → read-session-raw-b70cpwzj.js} +4 -3
- package/dist/v2/recomp-orchestrator-b12zaptj.js +61 -0
- package/dist/v2/{safe-notification-target-qg7n2s77.js → safe-notification-target-khnzg57c.js} +2 -2
- package/dist/v2/search-archive-x64rtz1z.js +25 -0
- package/dist/v2/search-hza9x72a.js +49 -0
- package/dist/v2/{send-session-notification-3pxn658x.js → send-session-notification-8eqe259v.js} +7 -6
- package/dist/v2/{server-45q69hkq.js → server-132h8twc.js} +5 -5
- package/dist/v2/{server-h0410h0v.js → server-1bw1wcbp.js} +1 -1
- package/dist/v2/{server-271qxsf5.js → server-24g8r2d0.js} +2466 -1290
- package/dist/v2/{server-tbe1femw.js → server-29qp8nz4.js} +1 -1
- package/dist/v2/{server-gsxjv2q2.js → server-33nqbqkw.js} +182 -47
- package/dist/v2/{server-tgnbmwah.js → server-3mz2qh5a.js} +1 -1
- package/dist/v2/{server-n1prf1g6.js → server-3vhxy2k5.js} +2 -2
- package/dist/v2/{server-xj136kt8.js → server-4kjmrjn4.js} +9 -3
- package/dist/v2/{server-34kwfsr4.js → server-53eh1r8r.js} +2 -2
- package/dist/{index-8cd2j99z.js → v2/server-5kym00ag.js} +32 -13
- package/dist/v2/{server-46neh5fa.js → server-62g58aaz.js} +314 -127
- package/dist/v2/{server-f2xf5gcb.js → server-6495nmn9.js} +12 -15
- package/dist/v2/{server-a9xqj88f.js → server-6v3cdzsx.js} +4 -4
- package/dist/v2/{server-d04vrx0j.js → server-806rzhs6.js} +2 -2
- package/dist/v2/{server-qd11g795.js → server-92g7d776.js} +2 -1
- package/dist/v2/{server-nj659894.js → server-94wk1ey3.js} +14 -3
- package/dist/v2/{server-6tmj0s7j.js → server-ab1g0wn9.js} +4 -6
- package/dist/v2/{server-8by8qfec.js → server-ad18djzs.js} +95 -59
- package/dist/v2/{server-hy3d3vsx.js → server-bsgd4dk1.js} +2 -2
- package/dist/v2/server-cpjk5jd2.js +82 -0
- package/dist/v2/{server-g3qma5c0.js → server-d1dzgvwd.js} +2 -2
- package/dist/v2/{server-hm38q7r0.js → server-d48x3m4x.js} +5 -5
- package/dist/v2/{server-1wy7b9de.js → server-dtp8hcjh.js} +3 -3
- package/dist/v2/{server-27gq4mfz.js → server-fa7vtp40.js} +9 -6
- package/dist/v2/{server-6pmqg9m4.js → server-gyy4k6mf.js} +1 -1
- package/dist/{index-beht37jy.js → v2/server-gzy5w8ya.js} +194 -5
- package/dist/v2/{server-bmymkx73.js → server-j8h7bsca.js} +29 -15
- package/dist/v2/{server-n37sebck.js → server-jjvbk92s.js} +1 -1
- package/dist/v2/{server-da07v4xp.js → server-k3t06fxr.js} +1 -1
- package/dist/v2/{server-9hx7g5jp.js → server-m4bfaevz.js} +1197 -1049
- package/dist/v2/{server-2ar62dyx.js → server-ppcd1qxh.js} +191 -99
- package/dist/v2/{server-rmygf5pn.js → server-qjvk4a9t.js} +2 -2
- package/dist/v2/{server-zzkj2fch.js → server-qteg2kt9.js} +5 -5
- package/dist/v2/{server-pwv4ezb0.js → server-rqebawx1.js} +2 -2
- package/dist/v2/{server-h1v0pyxb.js → server-vr4szghm.js} +501 -20
- package/dist/v2/{server-xq7dfjke.js → server-wwaw5npa.js} +5 -5
- package/dist/v2/{server-6vdzn1td.js → server-zg5y109h.js} +323 -76
- package/dist/v2/server.js +8 -8
- package/dist/v2/{sqlite-zf72c52d.js → sqlite-zdgm52sv.js} +5 -1
- package/dist/v2/{storage-memory-y3qmy00r.js → storage-memory-e6a7mb0k.js} +2 -2
- package/dist/v2/{storage-tags-3wdb8zph.js → storage-tags-q71rnr9f.js} +5 -5
- package/dist/v2/store-reader.d.ts +10 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{task-config-nvz8mapa.js → task-config-7md27rx8.js} +2 -2
- package/dist/v2/{wrapup-orchestrator-embdz8gj.js → wrapup-orchestrator-3ssd5yy1.js} +33 -32
- package/dist/wrapup-orchestrator-5vpcd1zx.js +49 -0
- package/package.json +2 -2
- package/src/config/index.test.ts +72 -6
- package/src/config/project-security.ts +15 -0
- package/src/config/rerank.test.ts +60 -0
- package/src/config/schema/magic-context.ts +57 -0
- package/src/shared/logger.test.ts +42 -1
- package/src/shared/logger.ts +11 -13
- package/src/shared/model-resolution.test.ts +67 -12
- package/src/shared/model-resolution.ts +43 -16
- package/src/shared/model-suggestion-retry.ts +2 -2
- package/src/shared/prompt-async-transport.ts +47 -3
- package/src/shared/rpc-types.ts +7 -0
- package/src/shared/sqlite-busy-budget-review.test.ts +6 -1
- package/src/shared/sqlite-turn-deadline.test.ts +270 -0
- package/src/shared/sqlite.ts +239 -9
- package/src/shared/subagent-runner.ts +2 -0
- package/src/shared/tag-transcript.ts +9 -1
- package/src/shared/worker-shutdown-fence.test.ts +87 -0
- package/src/shared/worker-shutdown.fixture.ts +25 -0
- package/src/shared/worker-shutdown.test.ts +127 -0
- package/src/shared/worker-shutdown.ts +160 -0
- package/dist/embedding-backfill-fmz50tsy.js +0 -24
- package/dist/recomp-orchestrator-999jj4bc.js +0 -61
- package/dist/search-archive-6vm0e2f5.js +0 -25
- package/dist/search-xsqk1bj4.js +0 -49
- package/dist/v2/embedding-backfill-7c7yr69y.js +0 -23
- package/dist/v2/recomp-orchestrator-f6m9jr7p.js +0 -60
- package/dist/v2/search-archive-wve3tq1k.js +0 -24
- package/dist/v2/search-hwg7jfbj.js +0 -48
- package/dist/wrapup-orchestrator-whhbjmaz.js +0 -48
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
compareTaskOrder,
|
|
14
14
|
buildDreamTaskRuntimeConfigs2,
|
|
15
15
|
userMemoryCollectionEnabled2
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-nda0zgna.js";
|
|
17
17
|
import {
|
|
18
18
|
getHarness2,
|
|
19
19
|
harnessOwnsOpenCodeStore2
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
log2,
|
|
32
32
|
sessionLog2,
|
|
33
33
|
getLoggerDiagnostics2
|
|
34
|
-
} from "./index-
|
|
34
|
+
} from "./index-h7tgn49j.js";
|
|
35
35
|
import {
|
|
36
36
|
resolveOpenCodeDbPath,
|
|
37
37
|
assertOpenCodeStoreGeneration,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
SqliteAcquisitionBusyError2,
|
|
56
56
|
withAsyncPrivilegedWriter2,
|
|
57
57
|
indexCoordinationInput2
|
|
58
|
-
} from "./index-
|
|
58
|
+
} from "./index-gzy5w8ya.js";
|
|
59
59
|
import {
|
|
60
60
|
pruneMissingProjectIdentities,
|
|
61
61
|
shouldSkipHomeProjectMemory,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
storedPathBelongsToIdentity,
|
|
72
72
|
beginBootQuietPeriod,
|
|
73
73
|
scheduleAfterBootQuiet
|
|
74
|
-
} from "./index-
|
|
74
|
+
} from "./index-kq5w68dp.js";
|
|
75
75
|
import {
|
|
76
76
|
recordSessionProjectIdentity,
|
|
77
77
|
hasRecordedSessionProjectIdentity,
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
markGitSweepSuccessAndRelease,
|
|
82
82
|
parkGitSweepNonIndexable,
|
|
83
83
|
releaseGitSweepLease
|
|
84
|
-
} from "./index-
|
|
84
|
+
} from "./index-kfyb3k6n.js";
|
|
85
85
|
import {
|
|
86
86
|
hasTrustedAbsoluteWall,
|
|
87
87
|
applyProvenInputFloor,
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
deriveTriggerBudget2,
|
|
94
94
|
resolveKnownHistorianContextLimit2,
|
|
95
95
|
resolveHistorianProducerLimits2
|
|
96
|
-
} from "./index-
|
|
96
|
+
} from "./index-spwjbkc7.js";
|
|
97
97
|
import {
|
|
98
98
|
resolveModelCalibration,
|
|
99
99
|
calibrateBuckets,
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
estimateTokens,
|
|
108
108
|
estimateFixedPromptTokens,
|
|
109
109
|
normalizeText
|
|
110
|
-
} from "./index-
|
|
110
|
+
} from "./index-b88dwwrh.js";
|
|
111
111
|
import {
|
|
112
112
|
protectedToolTokenCount,
|
|
113
113
|
peelLeadingMcTagNotation,
|
|
@@ -144,11 +144,11 @@ import {
|
|
|
144
144
|
getDroppedTagsByNumbers2,
|
|
145
145
|
getMaxDroppedTagNumber2,
|
|
146
146
|
getTagById2
|
|
147
|
-
} from "./index-
|
|
147
|
+
} from "./index-whcgcfrv.js";
|
|
148
148
|
import {
|
|
149
149
|
observeTemporalDecisions,
|
|
150
150
|
stableStringify
|
|
151
|
-
} from "./index-
|
|
151
|
+
} from "./index-x9k3mqrf.js";
|
|
152
152
|
import {
|
|
153
153
|
withContentLanguageDirective,
|
|
154
154
|
parseCron,
|
|
@@ -161,14 +161,14 @@ import {
|
|
|
161
161
|
DEFAULT_HISTORIAN_TIMEOUT_MS,
|
|
162
162
|
DEFAULT_LOCAL_EMBEDDING_MODEL,
|
|
163
163
|
DREAM_TASK_PROMOTION_DEFAULTS
|
|
164
|
-
} from "./index-
|
|
164
|
+
} from "./index-nxrsns5x.js";
|
|
165
165
|
import {
|
|
166
166
|
isRawCompactionSummaryInfo2,
|
|
167
167
|
extractInMemoryMessageViews2,
|
|
168
168
|
buildInMemoryTailRawMessages2,
|
|
169
169
|
RawOrdinalsNotReady2,
|
|
170
170
|
runSessionWarmupWorker
|
|
171
|
-
} from "./index-
|
|
171
|
+
} from "./index-jfem3dgz.js";
|
|
172
172
|
import {
|
|
173
173
|
openCodeDbExists,
|
|
174
174
|
withReadOnlySessionDb,
|
|
@@ -176,7 +176,7 @@ import {
|
|
|
176
176
|
latestPersistedMessageForRecovery,
|
|
177
177
|
latestRealUserTurnIdFromOpenCodeDb,
|
|
178
178
|
findLastAssistantModelFromOpenCodeDb
|
|
179
|
-
} from "./index-
|
|
179
|
+
} from "./index-ksq50rg0.js";
|
|
180
180
|
import {
|
|
181
181
|
expandToolPart,
|
|
182
182
|
takeCoveredInstructionRows,
|
|
@@ -300,10 +300,10 @@ import {
|
|
|
300
300
|
readRawSessionMessageById2,
|
|
301
301
|
readSessionChunk2,
|
|
302
302
|
readRawSessionSeedTail2
|
|
303
|
-
} from "./index-
|
|
303
|
+
} from "./index-mnhcdfxg.js";
|
|
304
304
|
import {
|
|
305
305
|
getMeasuredToolDefinitionTokens
|
|
306
|
-
} from "./index-
|
|
306
|
+
} from "./index-j76ah6d7.js";
|
|
307
307
|
import {
|
|
308
308
|
isFailClosedBlockingError,
|
|
309
309
|
shouldBypassFailClosedBlock,
|
|
@@ -317,14 +317,14 @@ import {
|
|
|
317
317
|
runSqliteOptimize,
|
|
318
318
|
openDatabase,
|
|
319
319
|
openCurrentDatabase
|
|
320
|
-
} from "./index-
|
|
320
|
+
} from "./index-a9zvn5fe.js";
|
|
321
321
|
import {
|
|
322
322
|
registerOwnRpcServerInstance,
|
|
323
323
|
rpcPortDir,
|
|
324
324
|
rpcPortFilePath,
|
|
325
325
|
parseRpcPortFile,
|
|
326
326
|
inspectProcessesAsync
|
|
327
|
-
} from "./index-
|
|
327
|
+
} from "./index-c7phnbvk.js";
|
|
328
328
|
import {
|
|
329
329
|
configureContextDatabasePragmas2
|
|
330
330
|
} from "./index-fb3zxn06.js";
|
|
@@ -336,7 +336,7 @@ import {
|
|
|
336
336
|
resolveStoredPathWorkspaceIdentity,
|
|
337
337
|
storedPathBelongsToWorkspace,
|
|
338
338
|
computeWorkspaceEpochFingerprint
|
|
339
|
-
} from "./index-
|
|
339
|
+
} from "./index-9q1g3c5q.js";
|
|
340
340
|
import {
|
|
341
341
|
V2_MEMORY_CATEGORIES,
|
|
342
342
|
CATEGORY_PRIORITY
|
|
@@ -442,6 +442,7 @@ import {
|
|
|
442
442
|
raceWithSignal,
|
|
443
443
|
promptSyncWithValidatedOutputRetry,
|
|
444
444
|
normalizeSDKResponse,
|
|
445
|
+
annotateSubagentInvocationError,
|
|
445
446
|
failedInvocationStatus,
|
|
446
447
|
sumTokensFromChildMessages,
|
|
447
448
|
recordChildInvocation,
|
|
@@ -511,7 +512,7 @@ import {
|
|
|
511
512
|
snapRangeToCompartments,
|
|
512
513
|
getActiveCompartmentRun,
|
|
513
514
|
startCompartmentAgent
|
|
514
|
-
} from "./index-
|
|
515
|
+
} from "./index-y76rhsnr.js";
|
|
515
516
|
import {
|
|
516
517
|
embedPauseBySession,
|
|
517
518
|
embedRunStateBySession,
|
|
@@ -539,7 +540,7 @@ import {
|
|
|
539
540
|
embedSessionCompartmentChunks2,
|
|
540
541
|
getEmbeddingCoverageStatus2,
|
|
541
542
|
getAutoEmbeddingSessionCoverage2
|
|
542
|
-
} from "./index-
|
|
543
|
+
} from "./index-zy67whjr.js";
|
|
543
544
|
import {
|
|
544
545
|
SubcClient,
|
|
545
546
|
connectionFileExists,
|
|
@@ -547,11 +548,12 @@ import {
|
|
|
547
548
|
toSynapseLaneDescriptor,
|
|
548
549
|
formatSynapseLaneDescriptor,
|
|
549
550
|
SynapseEmbeddingProvider
|
|
550
|
-
} from "./index-
|
|
551
|
+
} from "./index-wfybj1dw.js";
|
|
551
552
|
import {
|
|
552
553
|
BoundedSessionMap,
|
|
553
554
|
LkgRecoveryFenceError,
|
|
554
555
|
lkgServedArrayDigest,
|
|
556
|
+
takeLkgRecoveryLockSweepPage,
|
|
555
557
|
hasCleanLkgRecoveryFence,
|
|
556
558
|
dirtyLkgRecoveryRevision,
|
|
557
559
|
ownsLkgDirtyFence,
|
|
@@ -569,7 +571,7 @@ import {
|
|
|
569
571
|
indexSingleMessage2,
|
|
570
572
|
indexMessagesAfterOrdinal2,
|
|
571
573
|
sweepOrphanedOpenCodeMessageIndexesCooperatively2
|
|
572
|
-
} from "./index-
|
|
574
|
+
} from "./index-mnnkgq0q.js";
|
|
573
575
|
import {
|
|
574
576
|
renderUserFacingFailure,
|
|
575
577
|
userFacingFailureCode,
|
|
@@ -613,7 +615,7 @@ import {
|
|
|
613
615
|
readGitFileChangeTimesSince,
|
|
614
616
|
verificationFileExists,
|
|
615
617
|
normalizeVerificationFiles
|
|
616
|
-
} from "./index-
|
|
618
|
+
} from "./index-3svaejkh.js";
|
|
617
619
|
import {
|
|
618
620
|
registerNotificationSink2,
|
|
619
621
|
pushNotification2,
|
|
@@ -622,8 +624,10 @@ import {
|
|
|
622
624
|
isTuiConnected2
|
|
623
625
|
} from "./index-x8a7jmkh.js";
|
|
624
626
|
import {
|
|
627
|
+
getCachedLocalEmbeddingPooling,
|
|
628
|
+
preflightLocalEmbeddingPooling,
|
|
625
629
|
getLocalEmbeddingNativeMemoryStats
|
|
626
|
-
} from "./index-
|
|
630
|
+
} from "./index-51rdvtkz.js";
|
|
627
631
|
import {
|
|
628
632
|
saveEmbeddingIfHashMatches,
|
|
629
633
|
invalidateProject2,
|
|
@@ -631,7 +635,7 @@ import {
|
|
|
631
635
|
} from "./index-4dhv7mqz.js";
|
|
632
636
|
import {
|
|
633
637
|
cosineSimilarity
|
|
634
|
-
} from "./index-
|
|
638
|
+
} from "./index-rxqr723x.js";
|
|
635
639
|
import {
|
|
636
640
|
computeCueContentHash,
|
|
637
641
|
hasMuralCueColumns,
|
|
@@ -656,7 +660,7 @@ import {
|
|
|
656
660
|
mergeMemoryStats2,
|
|
657
661
|
archiveMemory2,
|
|
658
662
|
getMemoryCountsByStatus2
|
|
659
|
-
} from "./index-
|
|
663
|
+
} from "./index-jjvbk92s.js";
|
|
660
664
|
import {
|
|
661
665
|
renderSingleStoreMigrationRequiredRefusal,
|
|
662
666
|
SingleStoreMigrationRequiredError,
|
|
@@ -677,17 +681,17 @@ import {
|
|
|
677
681
|
resolveMemoriesByIdsForSearch2,
|
|
678
682
|
unifiedSearch2,
|
|
679
683
|
formatSearchResults2
|
|
680
|
-
} from "./index-
|
|
684
|
+
} from "./index-syaazvy2.js";
|
|
681
685
|
import {
|
|
682
686
|
flushIgnoredMessages2,
|
|
683
687
|
clearIgnoredMessages2,
|
|
684
688
|
observeIgnoredNotificationEvent2,
|
|
685
689
|
sendStatusNotification2
|
|
686
|
-
} from "./index-
|
|
690
|
+
} from "./index-66eby7hx.js";
|
|
687
691
|
import {
|
|
688
692
|
setRecompStarting2,
|
|
689
693
|
setRecompTerminal2
|
|
690
|
-
} from "./index-
|
|
694
|
+
} from "./index-ffzhwfzy.js";
|
|
691
695
|
import {
|
|
692
696
|
makeToolCompositeKey,
|
|
693
697
|
searchMessageHistoryOffThread,
|
|
@@ -704,10 +708,17 @@ import {
|
|
|
704
708
|
cachedToolPermissionDenied,
|
|
705
709
|
resolveTodowriteAvailabilityFromMessages,
|
|
706
710
|
resolveTodowriteAvailability,
|
|
711
|
+
diagnosticStateChanged,
|
|
712
|
+
clearDiagnosticLogState,
|
|
707
713
|
canConsumeDeferredOnThisPass,
|
|
708
714
|
hasReclaimRide,
|
|
709
715
|
reclaimRidePermitted,
|
|
710
716
|
reclaimRideLabel,
|
|
717
|
+
pendingDropEligibilityKey,
|
|
718
|
+
createPendingDropEligibilityCache,
|
|
719
|
+
readExecuteReclaimState,
|
|
720
|
+
writeExecuteReclaimState,
|
|
721
|
+
maintainExecuteFloorMark,
|
|
711
722
|
captureOpencodeReasoningBudgetStatus,
|
|
712
723
|
reasoningBudgetStatusLine,
|
|
713
724
|
ENGINE_RECONNECTING_USER_MESSAGE,
|
|
@@ -724,8 +735,6 @@ import {
|
|
|
724
735
|
replayCavemanCompression,
|
|
725
736
|
DegradedPassRefusalError,
|
|
726
737
|
degradedPassError,
|
|
727
|
-
pendingDropEligibilityKey,
|
|
728
|
-
createPendingDropEligibilityCache,
|
|
729
738
|
applyFlushedStatuses,
|
|
730
739
|
prewarmTagOwners,
|
|
731
740
|
waitForTagOwners,
|
|
@@ -734,6 +743,7 @@ import {
|
|
|
734
743
|
logTransformTiming,
|
|
735
744
|
hasRecentAssistantCommit,
|
|
736
745
|
tagMessages,
|
|
746
|
+
servesThinkingBlock2,
|
|
737
747
|
rustModeServedKeyAfterPersistedStrips2,
|
|
738
748
|
replayRustModeBindingMismatchStrips2,
|
|
739
749
|
clearRustModeBoundaryRecord2,
|
|
@@ -742,7 +752,7 @@ import {
|
|
|
742
752
|
abortSessionFailClosed2,
|
|
743
753
|
evaluateEmergencyFailClosed2,
|
|
744
754
|
runPostTransformPhase2
|
|
745
|
-
} from "./index-
|
|
755
|
+
} from "./index-1kbznkft.js";
|
|
746
756
|
import {
|
|
747
757
|
ANNOUNCEMENT_VERSION2,
|
|
748
758
|
ANNOUNCEMENT_FEATURES2,
|
|
@@ -755,7 +765,7 @@ import {
|
|
|
755
765
|
} from "./index-fmsr7v69.js";
|
|
756
766
|
import {
|
|
757
767
|
renderSearchArchiveOffThread2
|
|
758
|
-
} from "./index-
|
|
768
|
+
} from "./index-j32jj2t8.js";
|
|
759
769
|
import {
|
|
760
770
|
COMPACTION_ENABLED_PATH,
|
|
761
771
|
isDreamerRunnable,
|
|
@@ -785,7 +795,7 @@ import {
|
|
|
785
795
|
} from "./index-8ajstryz.js";
|
|
786
796
|
import {
|
|
787
797
|
logSlowWriteTransaction
|
|
788
|
-
} from "./index-
|
|
798
|
+
} from "./index-t5pck3ss.js";
|
|
789
799
|
import {
|
|
790
800
|
shouldEnforcePrivateStoragePermissions,
|
|
791
801
|
ensureStorageDirectorySync,
|
|
@@ -2696,7 +2706,9 @@ async function compressOneChunk(args, chunk, sliceMs, signal) {
|
|
|
2696
2706
|
status: "completed",
|
|
2697
2707
|
tokens: run.output.usage,
|
|
2698
2708
|
providerId: run.output.providerId,
|
|
2699
|
-
modelId: run.output.modelId
|
|
2709
|
+
modelId: run.output.modelId,
|
|
2710
|
+
attemptedModel: args.model,
|
|
2711
|
+
configuredModels: args.fallbackModels
|
|
2700
2712
|
});
|
|
2701
2713
|
}
|
|
2702
2714
|
stage = "apply";
|
|
@@ -2888,6 +2900,7 @@ async function runHiddenSingleShotPrompt(args) {
|
|
|
2888
2900
|
});
|
|
2889
2901
|
}).catch(() => {});
|
|
2890
2902
|
const handle = await raceWithSignal(opening, args.signal);
|
|
2903
|
+
let completion;
|
|
2891
2904
|
args.onOpened?.(handle.id);
|
|
2892
2905
|
let promptSettled = false;
|
|
2893
2906
|
try {
|
|
@@ -2909,7 +2922,10 @@ async function runHiddenSingleShotPrompt(args) {
|
|
|
2909
2922
|
...args.signal ? { signal: args.signal } : {},
|
|
2910
2923
|
fallbackModels: args.fallbackModels,
|
|
2911
2924
|
callContext: args.callContext,
|
|
2912
|
-
fetchOutput: () =>
|
|
2925
|
+
fetchOutput: async () => {
|
|
2926
|
+
completion = await args.executor.collect(handle, 50);
|
|
2927
|
+
return completion;
|
|
2928
|
+
},
|
|
2913
2929
|
validateOutput: (completion) => {
|
|
2914
2930
|
const tokens = completion.tokenLog ?? runTokenLog(undefined);
|
|
2915
2931
|
sessionLog2(args.parentSessionId ?? "dreamer", `${args.callContext} response_chars=${(completion.text ?? completion.reasoning ?? "").length} ${formatRunTokenLog(tokens)}`);
|
|
@@ -2925,6 +2941,12 @@ async function runHiddenSingleShotPrompt(args) {
|
|
|
2925
2941
|
promptSettled = true;
|
|
2926
2942
|
return { validated: run.validated, completion: run.output, childSessionId: handle.id };
|
|
2927
2943
|
} catch (error) {
|
|
2944
|
+
const configuredModel = toModelEntry(args.model);
|
|
2945
|
+
annotateSubagentInvocationError(error, {
|
|
2946
|
+
attemptedModel: completion?.attemptedModel ?? handle.attemptedModel ?? configuredModel?.model,
|
|
2947
|
+
modelConfigKey: completion?.modelConfigKey ?? handle.modelConfigKey ?? configuredModel?.sourceConfigKey,
|
|
2948
|
+
...completion?.hostError === undefined ? {} : { hostError: completion.hostError }
|
|
2949
|
+
});
|
|
2928
2950
|
if (args.onFailureOutput) {
|
|
2929
2951
|
let timer;
|
|
2930
2952
|
try {
|
|
@@ -3053,6 +3075,8 @@ If no promotions are warranted, return empty arrays. Always consume reviewed can
|
|
|
3053
3075
|
startedAt,
|
|
3054
3076
|
status: params.status,
|
|
3055
3077
|
messages: params.messages,
|
|
3078
|
+
attemptedModel: args.model,
|
|
3079
|
+
configuredModels: args.fallbackModels,
|
|
3056
3080
|
error: params.error
|
|
3057
3081
|
});
|
|
3058
3082
|
};
|
|
@@ -3840,6 +3864,8 @@ function recordInvocation(args, startedAt, params) {
|
|
|
3840
3864
|
startedAt,
|
|
3841
3865
|
status: params.status,
|
|
3842
3866
|
messages: params.messages,
|
|
3867
|
+
attemptedModel: args.model,
|
|
3868
|
+
configuredModels: args.fallbackModels,
|
|
3843
3869
|
...params.completion && !params.completion.messages ? {
|
|
3844
3870
|
tokens: params.completion.usage,
|
|
3845
3871
|
providerId: params.completion.providerId,
|
|
@@ -4247,28 +4273,35 @@ function diff(name, before, after) {
|
|
|
4247
4273
|
rmSync(dir, { recursive: true, force: true });
|
|
4248
4274
|
}
|
|
4249
4275
|
}
|
|
4250
|
-
function
|
|
4251
|
-
if (Object.entries(expected).some(([name, value]) => docsBaseHashes(projectDir)[name] !== value))
|
|
4252
|
-
throw new Error("base drifted");
|
|
4276
|
+
function parseDocsProposalOutput(output) {
|
|
4253
4277
|
const match = output.match(/```json\s*([\s\S]*?)```/);
|
|
4254
4278
|
const parsed = JSON.parse(match?.[1] ?? output);
|
|
4255
4279
|
if (!Array.isArray(parsed))
|
|
4256
4280
|
throw new Error("proposal must be a JSON array");
|
|
4257
4281
|
const changes = parsed;
|
|
4258
|
-
if (!changes.length)
|
|
4259
|
-
throw new Error("empty proposal");
|
|
4260
4282
|
if (changes.some((item) => !item || !FILES.includes(item.file)))
|
|
4261
4283
|
throw new Error("unknown proposal file");
|
|
4284
|
+
const seen = new Set;
|
|
4285
|
+
for (const change of changes) {
|
|
4286
|
+
const key = `${change.file}:${change.heading}`;
|
|
4287
|
+
if (!["replace", "add", "remove"].includes(change.action) || typeof change.heading !== "string" || !/^#{1,6} [^\r\n]+$/.test(change.heading) || typeof change.text !== "string" || typeof change.reason !== "string" || !change.reason.trim() || /[\r\n]/.test(change.reason) || seen.has(key))
|
|
4288
|
+
throw new Error(`invalid section change in ${change.file}`);
|
|
4289
|
+
seen.add(key);
|
|
4290
|
+
}
|
|
4291
|
+
return changes;
|
|
4292
|
+
}
|
|
4293
|
+
function validateDocsProposal(projectDir, output, budget, expected) {
|
|
4294
|
+
if (Object.entries(expected).some(([name, value]) => docsBaseHashes(projectDir)[name] !== value))
|
|
4295
|
+
throw new Error("base drifted");
|
|
4296
|
+
const changes = parseDocsProposalOutput(output);
|
|
4297
|
+
if (!changes.length)
|
|
4298
|
+
throw new Error("empty proposal");
|
|
4262
4299
|
let tokens = 0;
|
|
4263
4300
|
let diffs = "";
|
|
4264
4301
|
for (const file of FILES) {
|
|
4265
4302
|
const before = existsSync2(join(projectDir, file)) ? readFileSync(join(projectDir, file), "utf8") : "";
|
|
4266
4303
|
let after = before;
|
|
4267
|
-
const seen = new Set;
|
|
4268
4304
|
for (const change of changes.filter((item) => item.file === file)) {
|
|
4269
|
-
if (!["replace", "add", "remove"].includes(change.action) || typeof change.heading !== "string" || !/^#{1,6} [^\r\n]+$/.test(change.heading) || typeof change.text !== "string" || typeof change.reason !== "string" || !change.reason.trim() || /[\r\n]/.test(change.reason) || seen.has(change.heading))
|
|
4270
|
-
throw new Error(`invalid section change in ${file}`);
|
|
4271
|
-
seen.add(change.heading);
|
|
4272
4305
|
const section = sections(after).find((item) => item.heading === change.heading);
|
|
4273
4306
|
if (change.action === "add") {
|
|
4274
4307
|
if (section || !change.text.startsWith(`${change.heading}
|
|
@@ -5577,6 +5610,8 @@ Remember: output only the JSON object described by the system prompt.`;
|
|
|
5577
5610
|
startedAt,
|
|
5578
5611
|
status: params.status,
|
|
5579
5612
|
messages: params.messages,
|
|
5613
|
+
attemptedModel: args.model,
|
|
5614
|
+
configuredModels: args.fallbackModels,
|
|
5580
5615
|
error: params.error
|
|
5581
5616
|
});
|
|
5582
5617
|
};
|
|
@@ -6563,6 +6598,8 @@ async function confirmReadOnly(args, noteId, content, surfaceCondition, leaseSig
|
|
|
6563
6598
|
startedAt,
|
|
6564
6599
|
status: params.status,
|
|
6565
6600
|
messages: params.messages,
|
|
6601
|
+
attemptedModel: args.model,
|
|
6602
|
+
configuredModels: args.fallbackModels,
|
|
6566
6603
|
error: params.error
|
|
6567
6604
|
});
|
|
6568
6605
|
};
|
|
@@ -7477,12 +7514,14 @@ function recordInvocation2(args, startedAt, params) {
|
|
|
7477
7514
|
recordChildInvocation({
|
|
7478
7515
|
db: args.db,
|
|
7479
7516
|
parentSessionId: args.parentSessionId,
|
|
7480
|
-
harness: "opencode",
|
|
7517
|
+
harness: args.hiddenCompletionExecutor?.capabilities.harness ?? "opencode",
|
|
7481
7518
|
subagent: "dreamer",
|
|
7482
7519
|
task: "map-memories",
|
|
7483
7520
|
startedAt,
|
|
7484
7521
|
status: params.status,
|
|
7485
7522
|
messages: params.messages,
|
|
7523
|
+
attemptedModel: args.model,
|
|
7524
|
+
configuredModels: args.fallbackModels,
|
|
7486
7525
|
error: params.error
|
|
7487
7526
|
});
|
|
7488
7527
|
}
|
|
@@ -8107,12 +8146,14 @@ function recordInvocation3(args, startedAt, params) {
|
|
|
8107
8146
|
recordChildInvocation({
|
|
8108
8147
|
db: args.db,
|
|
8109
8148
|
parentSessionId: args.parentSessionId,
|
|
8110
|
-
harness: "opencode",
|
|
8149
|
+
harness: args.hiddenCompletionExecutor?.capabilities.harness ?? "opencode",
|
|
8111
8150
|
subagent: "dreamer",
|
|
8112
8151
|
task: "refresh-primers",
|
|
8113
8152
|
startedAt,
|
|
8114
8153
|
status: params.status,
|
|
8115
8154
|
messages: params.messages,
|
|
8155
|
+
attemptedModel: args.model,
|
|
8156
|
+
configuredModels: args.fallbackModels,
|
|
8116
8157
|
error: params.error
|
|
8117
8158
|
});
|
|
8118
8159
|
}
|
|
@@ -9569,12 +9610,14 @@ function recordInvocation4(args, startedAt, params) {
|
|
|
9569
9610
|
recordChildInvocation({
|
|
9570
9611
|
db: args.db,
|
|
9571
9612
|
parentSessionId: args.parentSessionId,
|
|
9572
|
-
harness: "opencode",
|
|
9613
|
+
harness: args.hiddenCompletionExecutor?.capabilities.harness ?? "opencode",
|
|
9573
9614
|
subagent: "dreamer",
|
|
9574
9615
|
task: args.forceBroad ? "verify-broad" : "verify",
|
|
9575
9616
|
startedAt,
|
|
9576
9617
|
status: params.status,
|
|
9577
9618
|
messages: params.messages,
|
|
9619
|
+
attemptedModel: args.model,
|
|
9620
|
+
configuredModels: args.fallbackModels,
|
|
9578
9621
|
error: params.error
|
|
9579
9622
|
});
|
|
9580
9623
|
}
|
|
@@ -10450,6 +10493,25 @@ async function runRetrospectiveTask(config, ctx, helpers) {
|
|
|
10450
10493
|
let childSessionId = null;
|
|
10451
10494
|
let hiddenHandle = null;
|
|
10452
10495
|
let promptSettled = false;
|
|
10496
|
+
let invocationRecorded = false;
|
|
10497
|
+
const recordInvocation = (status, messages, error) => {
|
|
10498
|
+
if (!parent || !childSessionId || invocationRecorded)
|
|
10499
|
+
return;
|
|
10500
|
+
invocationRecorded = true;
|
|
10501
|
+
recordChildInvocation({
|
|
10502
|
+
db,
|
|
10503
|
+
parentSessionId: parent,
|
|
10504
|
+
harness: deps.hiddenCompletionExecutor?.capabilities.harness ?? "opencode",
|
|
10505
|
+
subagent: "dreamer",
|
|
10506
|
+
task: config.task,
|
|
10507
|
+
startedAt: helpers.invocationStartedAt,
|
|
10508
|
+
status,
|
|
10509
|
+
messages,
|
|
10510
|
+
attemptedModel: config.model,
|
|
10511
|
+
configuredModels: config.fallbackModels,
|
|
10512
|
+
error
|
|
10513
|
+
});
|
|
10514
|
+
};
|
|
10453
10515
|
try {
|
|
10454
10516
|
if (deps.hiddenCompletionExecutor) {
|
|
10455
10517
|
hiddenHandle = await deps.hiddenCompletionExecutor.open({
|
|
@@ -10534,18 +10596,8 @@ async function runRetrospectiveTask(config, ctx, helpers) {
|
|
|
10534
10596
|
return { ...run, output };
|
|
10535
10597
|
};
|
|
10536
10598
|
const finish = (run, watermark) => {
|
|
10537
|
-
if (
|
|
10538
|
-
|
|
10539
|
-
db,
|
|
10540
|
-
parentSessionId: parent,
|
|
10541
|
-
harness: "opencode",
|
|
10542
|
-
subagent: "dreamer",
|
|
10543
|
-
task: config.task,
|
|
10544
|
-
startedAt: helpers.invocationStartedAt,
|
|
10545
|
-
status: "completed",
|
|
10546
|
-
messages: run.output
|
|
10547
|
-
});
|
|
10548
|
-
}
|
|
10599
|
+
if (run)
|
|
10600
|
+
recordInvocation("completed", run.output);
|
|
10549
10601
|
return completedWindow(watermark);
|
|
10550
10602
|
};
|
|
10551
10603
|
const userLines = renderGateUserLines(messages);
|
|
@@ -10638,6 +10690,7 @@ async function runRetrospectiveTask(config, ctx, helpers) {
|
|
|
10638
10690
|
log2(`[dreamer] retrospective: flagged=${flagged.length} learnings=${learnings.length} memory=${applied.memoryWritten} observations=${applied.observationsInserted} dropped=${applied.observationsDropped} rejected=${applied.rejected.length}`);
|
|
10639
10691
|
return finish(deepenRun, scan.maxScannedTs);
|
|
10640
10692
|
} catch (error) {
|
|
10693
|
+
recordInvocation(abortController.signal.aborted ? "aborted" : failedInvocationStatus(error), undefined, error);
|
|
10641
10694
|
if (!detectOverflow(error).isOverflow)
|
|
10642
10695
|
throw error;
|
|
10643
10696
|
const failures = (activeOverflow?.failures ?? 0) + 1;
|
|
@@ -10709,6 +10762,25 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
10709
10762
|
let childSessionId = null;
|
|
10710
10763
|
let promptSettled = false;
|
|
10711
10764
|
let expiredArchived = 0;
|
|
10765
|
+
let invocationRecorded = false;
|
|
10766
|
+
const recordInvocation = (status, messages, error) => {
|
|
10767
|
+
if (!parent || !childSessionId || invocationRecorded)
|
|
10768
|
+
return;
|
|
10769
|
+
invocationRecorded = true;
|
|
10770
|
+
recordChildInvocation({
|
|
10771
|
+
db,
|
|
10772
|
+
parentSessionId: parent,
|
|
10773
|
+
harness: deps.hiddenCompletionExecutor?.capabilities.harness ?? "opencode",
|
|
10774
|
+
subagent: "dreamer",
|
|
10775
|
+
task,
|
|
10776
|
+
startedAt: invocationStartedAt,
|
|
10777
|
+
status,
|
|
10778
|
+
messages,
|
|
10779
|
+
attemptedModel: config.model,
|
|
10780
|
+
configuredModels: config.fallbackModels,
|
|
10781
|
+
error
|
|
10782
|
+
});
|
|
10783
|
+
};
|
|
10712
10784
|
try {
|
|
10713
10785
|
let curateMemories;
|
|
10714
10786
|
let curateCategory;
|
|
@@ -10797,12 +10869,17 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
10797
10869
|
callContext: `dreamer:${task}`,
|
|
10798
10870
|
metadata: { tokenBudget: config.tokenBudget, onBudgetUpdate },
|
|
10799
10871
|
allowEmpty: task === "curate",
|
|
10872
|
+
onOpened: (sessionId) => {
|
|
10873
|
+
childSessionId = sessionId;
|
|
10874
|
+
},
|
|
10800
10875
|
model: config.model,
|
|
10801
10876
|
fallbackModels: config.fallbackModels,
|
|
10802
10877
|
language: task === "curate" ? config.language ?? deps.language : undefined,
|
|
10803
10878
|
timeoutMs: Math.min(Math.max(0, deadline - Date.now()), config.timeoutMinutes * 60 * 1000),
|
|
10804
10879
|
signal: abortController.signal,
|
|
10805
10880
|
parse: (text, completion) => {
|
|
10881
|
+
if (task === "maintain-docs")
|
|
10882
|
+
parseDocsProposalOutput(text);
|
|
10806
10883
|
if (task !== "curate")
|
|
10807
10884
|
return text;
|
|
10808
10885
|
const memoryOperations = inspectCurateMemoryOperations(completion.messages);
|
|
@@ -10866,6 +10943,8 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
10866
10943
|
if (task !== "curate") {
|
|
10867
10944
|
if (!text)
|
|
10868
10945
|
throw new Error("Dreamer returned no assistant output.");
|
|
10946
|
+
if (task === "maintain-docs")
|
|
10947
|
+
parseDocsProposalOutput(text);
|
|
10869
10948
|
return text;
|
|
10870
10949
|
}
|
|
10871
10950
|
const memoryOperations = inspectCurateMemoryOperations(messages);
|
|
@@ -10912,21 +10991,10 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
10912
10991
|
helpers.reportProgress(curateRefused, curateRefused);
|
|
10913
10992
|
log2(`[dreamer] curate safety summary: refused=${curateRefused}`);
|
|
10914
10993
|
}
|
|
10915
|
-
|
|
10916
|
-
recordChildInvocation({
|
|
10917
|
-
db,
|
|
10918
|
-
parentSessionId: parent,
|
|
10919
|
-
harness: "opencode",
|
|
10920
|
-
subagent: "dreamer",
|
|
10921
|
-
task,
|
|
10922
|
-
startedAt: invocationStartedAt,
|
|
10923
|
-
status: "completed",
|
|
10924
|
-
messages: run.output
|
|
10925
|
-
});
|
|
10926
|
-
}
|
|
10994
|
+
recordInvocation("completed", run.output);
|
|
10927
10995
|
if (task === "maintain-docs" && docsHashes && changes) {
|
|
10928
10996
|
try {
|
|
10929
|
-
if (run.validated ===
|
|
10997
|
+
if (parseDocsProposalOutput(String(run.validated)).length === 0) {
|
|
10930
10998
|
helpers.recordRun("completed", null, { progress: "no corrections proposed" });
|
|
10931
10999
|
return {
|
|
10932
11000
|
status: "completed",
|
|
@@ -10977,6 +11045,9 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
10977
11045
|
}
|
|
10978
11046
|
} : {}
|
|
10979
11047
|
};
|
|
11048
|
+
} catch (error) {
|
|
11049
|
+
recordInvocation(abortController.signal.aborted ? "aborted" : failedInvocationStatus(error), undefined, error);
|
|
11050
|
+
throw error;
|
|
10980
11051
|
} finally {
|
|
10981
11052
|
heartbeat.stop();
|
|
10982
11053
|
if (childSessionId)
|
|
@@ -11417,6 +11488,8 @@ var RECONCILIATION_BATCH_SIZE = 100;
|
|
|
11417
11488
|
|
|
11418
11489
|
class MagicContextMessageIndexHeapHolder {
|
|
11419
11490
|
reconciledSessions = new Set;
|
|
11491
|
+
reconciledSnapshots = new Map;
|
|
11492
|
+
stalledSessions = new Set;
|
|
11420
11493
|
reconciliationScheduledSessions = new Set;
|
|
11421
11494
|
clearAndReindexScheduledSessions = new Map;
|
|
11422
11495
|
sessionLocks = new Map;
|
|
@@ -11481,18 +11554,28 @@ function serializedMessageBytes(messages) {
|
|
|
11481
11554
|
return 0;
|
|
11482
11555
|
}
|
|
11483
11556
|
}
|
|
11557
|
+
function logReconciliationStall(sessionId, reason) {
|
|
11558
|
+
if (heapHolder.stalledSessions.has(sessionId))
|
|
11559
|
+
return;
|
|
11560
|
+
heapHolder.stalledSessions.add(sessionId);
|
|
11561
|
+
sessionLog2(sessionId, `message FTS reconciliation stalled: ${reason}; will retry`);
|
|
11562
|
+
}
|
|
11484
11563
|
async function reconcileSessionIndex(db, sessionId, readMessages) {
|
|
11485
|
-
if (!await sourceReady(readMessages, sessionId))
|
|
11564
|
+
if (!await sourceReady(readMessages, sessionId)) {
|
|
11565
|
+
logReconciliationStall(sessionId, "raw message reader is not ready");
|
|
11486
11566
|
return false;
|
|
11567
|
+
}
|
|
11487
11568
|
await runWithSessionLock(sessionId, async () => {
|
|
11488
|
-
if (heapHolder.reconciledSessions.has(sessionId))
|
|
11569
|
+
if (!readMessages.getRevision && heapHolder.reconciledSessions.has(sessionId))
|
|
11489
11570
|
return;
|
|
11490
11571
|
let fallbackSnapshot = null;
|
|
11491
11572
|
try {
|
|
11492
11573
|
const fullReader = typeof readMessages === "function" ? readMessages : null;
|
|
11493
|
-
const
|
|
11574
|
+
const revision = readMessages.getRevision?.(sessionId);
|
|
11575
|
+
const previous = heapHolder.reconciledSnapshots.get(sessionId);
|
|
11576
|
+
const finalWatermark = previous && revision === previous.revision ? previous.count : revision !== undefined && readMessages.getCountAfterRevision ? previous && revision > previous.revision ? previous.count + readMessages.getCountAfterRevision(sessionId, previous.revision, revision) : readMessages.getCountAfterRevision(sessionId, -1, revision) : readMessages.getCount ? readMessages.getCount(sessionId) : (fallbackSnapshot = fullReader?.(sessionId) ?? []).length;
|
|
11494
11577
|
let cursor = getMessageIndexReconciliationStartOrdinal2(db, sessionId);
|
|
11495
|
-
let after;
|
|
11578
|
+
let after = cursor === previous?.count ? previous.after : undefined;
|
|
11496
11579
|
while (cursor < finalWatermark) {
|
|
11497
11580
|
const pageEnd = Math.min(finalWatermark, cursor + RECONCILIATION_BATCH_SIZE);
|
|
11498
11581
|
const messages = readMessages.readPage ? readMessages.readPage(sessionId, cursor, RECONCILIATION_BATCH_SIZE, finalWatermark, after) : (fallbackSnapshot ?? []).filter((message) => message.ordinal > cursor && message.ordinal <= pageEnd);
|
|
@@ -11511,6 +11594,20 @@ async function reconcileSessionIndex(db, sessionId, readMessages) {
|
|
|
11511
11594
|
}
|
|
11512
11595
|
if (isMessageIndexReconciledThrough2(db, sessionId, finalWatermark)) {
|
|
11513
11596
|
heapHolder.reconciledSessions.add(sessionId);
|
|
11597
|
+
if (revision !== undefined) {
|
|
11598
|
+
if (!after && finalWatermark > 0 && readMessages.readPage) {
|
|
11599
|
+
const last = readMessages.readPage(sessionId, finalWatermark - 1, 1, finalWatermark).at(-1);
|
|
11600
|
+
if (last?.ordinal === finalWatermark && typeof last.createdAt === "number")
|
|
11601
|
+
after = { timeCreated: last.createdAt, id: last.id };
|
|
11602
|
+
}
|
|
11603
|
+
heapHolder.reconciledSnapshots.set(sessionId, {
|
|
11604
|
+
revision,
|
|
11605
|
+
count: finalWatermark,
|
|
11606
|
+
after
|
|
11607
|
+
});
|
|
11608
|
+
}
|
|
11609
|
+
} else {
|
|
11610
|
+
logReconciliationStall(sessionId, `gap after ordinal ${cursor} (store count ${finalWatermark})`);
|
|
11514
11611
|
}
|
|
11515
11612
|
} finally {
|
|
11516
11613
|
heapHolder.activeReconcilerBuffers.delete(sessionId);
|
|
@@ -11519,25 +11616,32 @@ async function reconcileSessionIndex(db, sessionId, readMessages) {
|
|
|
11519
11616
|
return true;
|
|
11520
11617
|
}
|
|
11521
11618
|
function scheduleReconciliation(db, sessionId, readMessages) {
|
|
11522
|
-
if (heapHolder.reconciledSessions.has(sessionId) || heapHolder.reconciliationScheduledSessions.has(sessionId)) {
|
|
11619
|
+
if (!readMessages.getRevision && heapHolder.reconciledSessions.has(sessionId) || heapHolder.reconciliationScheduledSessions.has(sessionId)) {
|
|
11523
11620
|
return;
|
|
11524
11621
|
}
|
|
11525
11622
|
heapHolder.reconciliationScheduledSessions.add(sessionId);
|
|
11526
11623
|
scheduleAfterBootQuiet(() => {
|
|
11527
11624
|
defer(() => {
|
|
11625
|
+
let appendedDuringReconciliation = false;
|
|
11626
|
+
const previousSnapshot = heapHolder.reconciledSnapshots.get(sessionId);
|
|
11528
11627
|
reconcileSessionIndex(db, sessionId, readMessages).then((ran) => {
|
|
11529
|
-
if (ran)
|
|
11628
|
+
if (ran) {
|
|
11629
|
+
const snapshot = heapHolder.reconciledSnapshots.get(sessionId);
|
|
11630
|
+
appendedDuringReconciliation = snapshot !== undefined && snapshot !== previousSnapshot && readMessages.getRevision !== undefined && readMessages.getRevision(sessionId) !== snapshot.revision;
|
|
11530
11631
|
return;
|
|
11632
|
+
}
|
|
11531
11633
|
inRootAsyncContext2(() => setTimeout(() => {
|
|
11532
11634
|
heapHolder.reconciliationScheduledSessions.delete(sessionId);
|
|
11533
11635
|
scheduleReconciliation(db, sessionId, readMessages);
|
|
11534
11636
|
}, PREPARE_RETRY_MS)).unref?.();
|
|
11535
11637
|
}).catch((error) => {
|
|
11536
|
-
|
|
11638
|
+
logReconciliationStall(sessionId, error instanceof Error ? error.message : String(error));
|
|
11537
11639
|
if (isDatabaseLockedError(error))
|
|
11538
11640
|
inRootAsyncContext2(() => setTimeout(() => scheduleReconciliation(db, sessionId, readMessages), 1000)).unref();
|
|
11539
11641
|
}).finally(() => {
|
|
11540
11642
|
heapHolder.reconciliationScheduledSessions.delete(sessionId);
|
|
11643
|
+
if (appendedDuringReconciliation)
|
|
11644
|
+
scheduleReconciliation(db, sessionId, readMessages);
|
|
11541
11645
|
});
|
|
11542
11646
|
});
|
|
11543
11647
|
});
|
|
@@ -11629,6 +11733,11 @@ async function indexSingleMessageOffThread(db, sessionId, message) {
|
|
|
11629
11733
|
return result.inserted;
|
|
11630
11734
|
}
|
|
11631
11735
|
async function sweepOrphanedOpenCodeMessageIndexesOffThread(db, openSource, options = {}) {
|
|
11736
|
+
if (getHarness2() === "opencode" || getHarness2() === "opencode2")
|
|
11737
|
+
options = {
|
|
11738
|
+
...options,
|
|
11739
|
+
fenceLockNames: options.fenceLockNames ?? takeLkgRecoveryLockSweepPage()
|
|
11740
|
+
};
|
|
11632
11741
|
if (getHarness2() === "opencode2")
|
|
11633
11742
|
openSource = () => new Database2(gaDatabasePath(getDataDir(), process.env.OPENCODE_CHANNEL ?? "latest"), {
|
|
11634
11743
|
readonly: true,
|
|
@@ -11661,6 +11770,7 @@ async function sweepOrphanedOpenCodeMessageIndexesOffThread(db, openSource, opti
|
|
|
11661
11770
|
}
|
|
11662
11771
|
function scheduleClearAndReindex(db, sessionId, readMessages) {
|
|
11663
11772
|
heapHolder.reconciledSessions.delete(sessionId);
|
|
11773
|
+
heapHolder.reconciledSnapshots.delete(sessionId);
|
|
11664
11774
|
heapHolder.reconciliationScheduledSessions.delete(sessionId);
|
|
11665
11775
|
clearCompletedIncrementalKeys(sessionId);
|
|
11666
11776
|
const existing = heapHolder.clearAndReindexScheduledSessions.get(sessionId);
|
|
@@ -11678,6 +11788,7 @@ function scheduleClearAndReindex(db, sessionId, readMessages) {
|
|
|
11678
11788
|
return;
|
|
11679
11789
|
heapHolder.clearAndReindexScheduledSessions.delete(sessionId);
|
|
11680
11790
|
heapHolder.reconciledSessions.delete(sessionId);
|
|
11791
|
+
heapHolder.reconciledSnapshots.delete(sessionId);
|
|
11681
11792
|
clearCompletedIncrementalKeys(sessionId);
|
|
11682
11793
|
clearIndexedMessages2(db, sessionId);
|
|
11683
11794
|
cleared = true;
|
|
@@ -11708,6 +11819,8 @@ function clearSessionTracking(sessionId) {
|
|
|
11708
11819
|
Atomics.store(cancellation, 0, 1);
|
|
11709
11820
|
heapHolder.clearAndReindexScheduledSessions.delete(sessionId);
|
|
11710
11821
|
heapHolder.reconciledSessions.delete(sessionId);
|
|
11822
|
+
heapHolder.reconciledSnapshots.delete(sessionId);
|
|
11823
|
+
heapHolder.stalledSessions.delete(sessionId);
|
|
11711
11824
|
heapHolder.reconciliationScheduledSessions.delete(sessionId);
|
|
11712
11825
|
heapHolder.sessionLocks.delete(sessionId);
|
|
11713
11826
|
heapHolder.activeReconcilerBuffers.delete(sessionId);
|
|
@@ -12476,7 +12589,7 @@ function loadRegistrationConfig(directory) {
|
|
|
12476
12589
|
configCache.delete(directory);
|
|
12477
12590
|
return detailed;
|
|
12478
12591
|
}
|
|
12479
|
-
async function ensureProjectRegisteredFromOpenCodeDirectory(directory, db) {
|
|
12592
|
+
async function ensureProjectRegisteredFromOpenCodeDirectory(directory, db, options = {}) {
|
|
12480
12593
|
const detailed = loadRegistrationConfig(directory);
|
|
12481
12594
|
const projectIdentity = resolveProjectIdentityForSession(directory, detailed.config.allow_home_project);
|
|
12482
12595
|
if (!projectIdentity)
|
|
@@ -12497,6 +12610,9 @@ async function ensureProjectRegisteredFromOpenCodeDirectory(directory, db) {
|
|
|
12497
12610
|
memoryEnabled: detailed.config.memory.enabled,
|
|
12498
12611
|
gitCommitEnabled: detailed.config.memory.git_commit_indexing.enabled
|
|
12499
12612
|
};
|
|
12613
|
+
if (options.preflightLocalPooling && routing.primary.provider === "local") {
|
|
12614
|
+
await preflightLocalEmbeddingPooling(routing.primary.model ?? "Xenova/all-MiniLM-L6-v2");
|
|
12615
|
+
}
|
|
12500
12616
|
const before = getProjectEmbeddingSnapshot2(projectIdentity);
|
|
12501
12617
|
const registered = registerProjectEmbedding2(db, projectIdentity, routing.primary, features, directory);
|
|
12502
12618
|
if (!before || before.providerIdentity !== registered.providerIdentity || before.runtimeFingerprint !== registered.runtimeFingerprint)
|
|
@@ -12506,6 +12622,7 @@ async function ensureProjectRegisteredFromOpenCodeDirectory(directory, db) {
|
|
|
12506
12622
|
} else {
|
|
12507
12623
|
unregisterProjectShadowEmbedding2(projectIdentity);
|
|
12508
12624
|
}
|
|
12625
|
+
options.onRegistered?.(projectIdentity);
|
|
12509
12626
|
}
|
|
12510
12627
|
|
|
12511
12628
|
// src/shared/model-cache-ttl.ts
|
|
@@ -13520,6 +13637,14 @@ function getMessageRemovedInfo(properties) {
|
|
|
13520
13637
|
};
|
|
13521
13638
|
}
|
|
13522
13639
|
|
|
13640
|
+
// src/hooks/magic-context/nudge-evaluation-log.ts
|
|
13641
|
+
function logNudgeEvaluation(sessionId, phase, line) {
|
|
13642
|
+
const category = `${phase}:${line.split(":", 1)[0]}`;
|
|
13643
|
+
const state = line.split(" ").filter((field) => /^(ctx_reduce|band|dampening|verdict|reason|lease)=/.test(field)).join(" ");
|
|
13644
|
+
if (diagnosticStateChanged(sessionId, category, state))
|
|
13645
|
+
sessionLog2(sessionId, line);
|
|
13646
|
+
}
|
|
13647
|
+
|
|
13523
13648
|
// src/hooks/magic-context/command-handler.ts
|
|
13524
13649
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
13525
13650
|
|
|
@@ -13959,7 +14084,7 @@ function resolveBoundaryContextLimit(usage, fallbackContextLimit) {
|
|
|
13959
14084
|
}
|
|
13960
14085
|
return 128000;
|
|
13961
14086
|
}
|
|
13962
|
-
function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThresholdPercentage, contextLimit, inMemoryTail, taggerFloor = 0) {
|
|
14087
|
+
function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThresholdPercentage, contextLimit, inMemoryTail, taggerFloor = 0, liftLivePromptFloor = false) {
|
|
13963
14088
|
return withRawSessionMessageCache2(() => {
|
|
13964
14089
|
try {
|
|
13965
14090
|
const memoryPrimed = inMemoryTail ? primeInMemoryTailRawMessageCache2({
|
|
@@ -13989,7 +14114,8 @@ function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThr
|
|
|
13989
14114
|
executeThresholdPercentage,
|
|
13990
14115
|
usage,
|
|
13991
14116
|
usageSource: "live",
|
|
13992
|
-
taggerFloor
|
|
14117
|
+
taggerFloor,
|
|
14118
|
+
liftLivePromptFloor
|
|
13993
14119
|
});
|
|
13994
14120
|
const hasProtectedEligibleHead = boundary.offset < Math.min(boundary.protectedTailStart, boundary.eligibleEndOrdinal);
|
|
13995
14121
|
if (!hasProtectedEligibleHead) {
|
|
@@ -14025,7 +14151,10 @@ function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThr
|
|
|
14025
14151
|
function formatProjectedPostDropPercentage(value) {
|
|
14026
14152
|
return value === null ? "none" : `${value.toFixed(1)}%`;
|
|
14027
14153
|
}
|
|
14028
|
-
function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPercentage, executeThresholdPercentage, triggerBudget, keepReasoningTokens, commitClusterTrigger, preloadedActiveTags, contextLimit, inMemoryTail, taggerFloorOverride, reasoningProjection, reclaimRide, eligiblePendingDropTagIds) {
|
|
14154
|
+
function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPercentage, executeThresholdPercentage, triggerBudget, keepReasoningTokens, commitClusterTrigger, preloadedActiveTags, contextLimit, inMemoryTail, taggerFloorOverride, reasoningProjection, reclaimRide, eligiblePendingDropTagIds, primaryExecute = false) {
|
|
14155
|
+
if (usage.percentage < executeThresholdPercentage) {
|
|
14156
|
+
writeExecuteReclaimState(db, sessionId, { floorOrdinal: null, floorPromptId: null });
|
|
14157
|
+
}
|
|
14029
14158
|
if (sessionMeta.compartmentInProgress) {
|
|
14030
14159
|
sessionLog2(sessionId, `compartment trigger: skipped — historian already in progress (usage=${usage.percentage.toFixed(1)}%)`);
|
|
14031
14160
|
return { shouldFire: false };
|
|
@@ -14078,7 +14207,22 @@ function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPer
|
|
|
14078
14207
|
resolvedInMemoryTail = undefined;
|
|
14079
14208
|
}
|
|
14080
14209
|
}
|
|
14081
|
-
|
|
14210
|
+
let tailInfo = getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThresholdPercentage, contextLimit, resolvedInMemoryTail, taggerFloor);
|
|
14211
|
+
const markState = readExecuteReclaimState(db, sessionId);
|
|
14212
|
+
const mark = markState.floorOrdinal;
|
|
14213
|
+
const livePromptOrdinal = tailInfo.boundarySnapshot?.diagnostics?.livePromptFloor.ordinal;
|
|
14214
|
+
let consumedFloorMark = false;
|
|
14215
|
+
if (mark !== null) {
|
|
14216
|
+
const consumed = writeExecuteReclaimState(db, sessionId, {
|
|
14217
|
+
floorOrdinal: null,
|
|
14218
|
+
floorPromptId: null
|
|
14219
|
+
});
|
|
14220
|
+
if (consumed && mark === livePromptOrdinal && markState.floorPromptId === tailInfo.boundarySnapshot?.diagnostics?.livePromptFloor.messageId && usage.percentage >= executeThresholdPercentage) {
|
|
14221
|
+
consumedFloorMark = true;
|
|
14222
|
+
sessionLog2(sessionId, `compartment trigger: live-prompt floor mark consumed at ${mark}`);
|
|
14223
|
+
tailInfo = getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThresholdPercentage, contextLimit, resolvedInMemoryTail, taggerFloor, true);
|
|
14224
|
+
}
|
|
14225
|
+
}
|
|
14082
14226
|
if (!tailInfo.hasNewRawHistory) {
|
|
14083
14227
|
try {
|
|
14084
14228
|
const lastCompartmentEnd = getLastCompartmentEndMessage(db, sessionId);
|
|
@@ -14162,7 +14306,21 @@ function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPer
|
|
|
14162
14306
|
return { shouldFire: false };
|
|
14163
14307
|
}
|
|
14164
14308
|
if (!tailInfo.hasProtectedEligibleHead || !tailInfo.isMeaningful) {
|
|
14165
|
-
|
|
14309
|
+
let floorOnly = false;
|
|
14310
|
+
const boundary = tailInfo.boundarySnapshot;
|
|
14311
|
+
const floor = boundary?.diagnostics?.livePromptFloor;
|
|
14312
|
+
if (!consumedFloorMark && floor?.ordinal && floor.from > floor.to) {
|
|
14313
|
+
const withoutFloor = getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThresholdPercentage, contextLimit, resolvedInMemoryTail, taggerFloor, true);
|
|
14314
|
+
floorOnly = withoutFloor.hasProtectedEligibleHead && withoutFloor.isMeaningful;
|
|
14315
|
+
if (floorOnly && primaryExecute && usage.percentage >= executeThresholdPercentage && writeExecuteReclaimState(db, sessionId, {
|
|
14316
|
+
floorOrdinal: floor.ordinal,
|
|
14317
|
+
floorPromptId: floor.messageId ?? null
|
|
14318
|
+
})) {
|
|
14319
|
+
sessionLog2(sessionId, `compartment trigger: live-prompt floor mark set at ${floor.ordinal}`);
|
|
14320
|
+
}
|
|
14321
|
+
}
|
|
14322
|
+
const refusal = floorOnly ? `no eligible head (live-prompt floor at ${floor?.ordinal})` : tailInfo.hasProtectedEligibleHead ? "below meaningfulness" : "no eligible head";
|
|
14323
|
+
sessionLog2(sessionId, `compartment trigger: not firing at ${usage.percentage.toFixed(1)}% — ${refusal}; offset=${tailInfo.nextStartOrdinal} protectedStart=${boundary?.protectedTailStart ?? "none"} eligibleEnd=${boundary?.eligibleEndOrdinal ?? "none"} rawTokens=${tailInfo.trueRawEligibleTokens} chunkTokens=${tailInfo.tokenEstimate}`);
|
|
14166
14324
|
return { shouldFire: false };
|
|
14167
14325
|
}
|
|
14168
14326
|
sessionLog2(sessionId, `compartment trigger: proactive fire at ${usage.percentage.toFixed(1)}% (floor=${proactiveTriggerPercentage}% projected post-drop=${formatProjectedPostDropPercentage(projectedPostDropPercentage)} target=${relativePostDropTarget.toFixed(1)}%)`);
|
|
@@ -15156,7 +15314,7 @@ function maybeInjectChannel1Nudge(args, sessionId, tool, output) {
|
|
|
15156
15314
|
evaluable: state.evaluable,
|
|
15157
15315
|
generationInvalidated: state.generationInvalidated
|
|
15158
15316
|
});
|
|
15159
|
-
|
|
15317
|
+
logNudgeEvaluation(sessionId, "tool-completion", formatChannel1Evaluation(decision));
|
|
15160
15318
|
setLastNudgeUndropped(args.db, sessionId, decision.nextLastNudge);
|
|
15161
15319
|
const nextNudgeState = {
|
|
15162
15320
|
...nudgeState,
|
|
@@ -15978,6 +16136,7 @@ function buildDebugMemoryUsage(runtimeHolders = {}) {
|
|
|
15978
16136
|
const lkg = getLkgSlotHeapStats();
|
|
15979
16137
|
const tagger = runtimeHolders.taggerCache ?? EMPTY_TAGGER_HEAP_STATS;
|
|
15980
16138
|
const wire = runtimeHolders.wireCache ?? EMPTY_WIRE_HEAP_STATS;
|
|
16139
|
+
const replay = runtimeHolders.generateReplay ?? { totalBytes: 0, sessions: [] };
|
|
15981
16140
|
const messageIndexQueue = getMessageIndexQueueHeapStats();
|
|
15982
16141
|
const sessions = new Map;
|
|
15983
16142
|
const session = (sessionId) => {
|
|
@@ -15991,7 +16150,8 @@ function buildDebugMemoryUsage(runtimeHolders = {}) {
|
|
|
15991
16150
|
wireRawMessages: 0,
|
|
15992
16151
|
wireMessages: 0,
|
|
15993
16152
|
wireContentSnapshots: 0,
|
|
15994
|
-
wireEstimatedBytes: 0
|
|
16153
|
+
wireEstimatedBytes: 0,
|
|
16154
|
+
generateReplayBytes: 0
|
|
15995
16155
|
};
|
|
15996
16156
|
sessions.set(sessionId, current);
|
|
15997
16157
|
}
|
|
@@ -16011,6 +16171,8 @@ function buildDebugMemoryUsage(runtimeHolders = {}) {
|
|
|
16011
16171
|
target.wireContentSnapshots += entry.rawContentSnapshots;
|
|
16012
16172
|
target.wireEstimatedBytes += entry.estimatedBytes;
|
|
16013
16173
|
}
|
|
16174
|
+
for (const entry of replay.sessions)
|
|
16175
|
+
session(entry.sessionId).generateReplayBytes += entry.bytes;
|
|
16014
16176
|
return {
|
|
16015
16177
|
pid: process.pid,
|
|
16016
16178
|
bunVersion: typeof Bun !== "undefined" && typeof Bun.version === "string" ? Bun.version : "unavailable",
|
|
@@ -16041,6 +16203,10 @@ function buildDebugMemoryUsage(runtimeHolders = {}) {
|
|
|
16041
16203
|
estimatedBytes: wire.estimatedBytes
|
|
16042
16204
|
},
|
|
16043
16205
|
compartmentMirrors: { entries: 0 },
|
|
16206
|
+
generateReplay: {
|
|
16207
|
+
sessionCount: replay.sessions.length,
|
|
16208
|
+
estimatedBytes: replay.totalBytes
|
|
16209
|
+
},
|
|
16044
16210
|
messageIndexQueue,
|
|
16045
16211
|
sessions: [...sessions.values()].sort((a, b) => a.sessionId.localeCompare(b.sessionId))
|
|
16046
16212
|
}
|
|
@@ -16257,9 +16423,9 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16257
16423
|
return { count: buildCompartmentCount(db, sessionId, moduleStatus) };
|
|
16258
16424
|
});
|
|
16259
16425
|
const buildManagedCtx = async (db) => {
|
|
16260
|
-
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-
|
|
16261
|
-
const { resolveHistorianModel } = await importPluginModule(() => import("./model-resolution-
|
|
16262
|
-
const { userObservationCollectionEnabled, userObservationsRequested } = await importPluginModule(() => import("./task-config-
|
|
16426
|
+
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-pqybnx09.js"));
|
|
16427
|
+
const { resolveHistorianModel } = await importPluginModule(() => import("./model-resolution-280gmqvd.js"));
|
|
16428
|
+
const { userObservationCollectionEnabled, userObservationsRequested } = await importPluginModule(() => import("./task-config-t6bpyka7.js"));
|
|
16263
16429
|
const DEFAULT_HISTORIAN_TIMEOUT_MS = 10 * 60 * 1000;
|
|
16264
16430
|
const runConfig = historianRunConfig(config, currentPluginConfigReader(directory)?.poll().effective ?? config);
|
|
16265
16431
|
const historianModel = resolveHistorianModel(runConfig, "opencode");
|
|
@@ -16290,7 +16456,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16290
16456
|
return { ok: false, error: "no session" };
|
|
16291
16457
|
const readDirectory = args.readSessionDirectory;
|
|
16292
16458
|
if (readDirectory) {
|
|
16293
|
-
const { handoffHistoryWork } = await import("./history-owner-
|
|
16459
|
+
const { handoffHistoryWork } = await import("./history-owner-36wp3mkb.js");
|
|
16294
16460
|
const handed = await handoffHistoryWork({
|
|
16295
16461
|
storageDir: args.storageDir ?? getMagicContextStorageDir(),
|
|
16296
16462
|
directory,
|
|
@@ -16309,8 +16475,8 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16309
16475
|
const db = readDatabase();
|
|
16310
16476
|
if (!db)
|
|
16311
16477
|
return { ok: false, error: "db unavailable" };
|
|
16312
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16313
|
-
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-
|
|
16478
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-hbm53jj5.js"));
|
|
16479
|
+
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-gqzkz7da.js"));
|
|
16314
16480
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
16315
16481
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
16316
16482
|
return {
|
|
@@ -16368,7 +16534,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16368
16534
|
rpcServer.handle("wrapup", async (params) => {
|
|
16369
16535
|
const readDirectory = args.readSessionDirectory;
|
|
16370
16536
|
if (readDirectory && params.sessionId) {
|
|
16371
|
-
const { handoffHistoryWork } = await import("./history-owner-
|
|
16537
|
+
const { handoffHistoryWork } = await import("./history-owner-36wp3mkb.js");
|
|
16372
16538
|
const sessionId = String(params.sessionId);
|
|
16373
16539
|
const handed = await handoffHistoryWork({
|
|
16374
16540
|
storageDir: args.storageDir ?? getMagicContextStorageDir(),
|
|
@@ -16394,7 +16560,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16394
16560
|
const db = readDatabase();
|
|
16395
16561
|
if (!db)
|
|
16396
16562
|
return { ok: false, error: "db unavailable" };
|
|
16397
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16563
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-5vpcd1zx.js"));
|
|
16398
16564
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
16399
16565
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
16400
16566
|
const ctx = {
|
|
@@ -16469,6 +16635,13 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16469
16635
|
}
|
|
16470
16636
|
|
|
16471
16637
|
// src/hooks/magic-context/auto-embed-session.ts
|
|
16638
|
+
function localPoolingPreflightPending(projectIdentity) {
|
|
16639
|
+
const snapshot = getProjectEmbeddingSnapshot2(projectIdentity);
|
|
16640
|
+
if (snapshot?.provider !== "local")
|
|
16641
|
+
return false;
|
|
16642
|
+
const metadata = getCachedLocalEmbeddingPooling(snapshot.model);
|
|
16643
|
+
return !metadata || metadata.status === "unresolved";
|
|
16644
|
+
}
|
|
16472
16645
|
function embeddingIdentity(projectIdentity) {
|
|
16473
16646
|
const snapshot = getProjectEmbeddingSnapshot2(projectIdentity);
|
|
16474
16647
|
return JSON.stringify([
|
|
@@ -16489,7 +16662,8 @@ function maybeAutoEmbedSessionBackfill(deps, sessionId) {
|
|
|
16489
16662
|
invalidateAutoEmbedSession(sessionId);
|
|
16490
16663
|
autoEmbedIdentityBySession.set(sessionId, identity);
|
|
16491
16664
|
}
|
|
16492
|
-
|
|
16665
|
+
const poolingPreflightPending = localPoolingPreflightPending(deps.projectIdentity);
|
|
16666
|
+
if (embedPauseBySession.has(sessionId) || embedRunStateBySession.has(sessionId) || Date.now() < (autoEmbedRetryAfterBySession.get(sessionId) ?? 0) || autoEmbedAttemptedBySession.has(sessionId) && !poolingPreflightPending)
|
|
16493
16667
|
return;
|
|
16494
16668
|
const controller = new AbortController;
|
|
16495
16669
|
embedRunStateBySession.set(sessionId, controller);
|
|
@@ -16499,6 +16673,7 @@ function maybeAutoEmbedSessionBackfill(deps, sessionId) {
|
|
|
16499
16673
|
let started = false;
|
|
16500
16674
|
let reason = "error";
|
|
16501
16675
|
let registeredIdentity = identity;
|
|
16676
|
+
let poolingPendingAfterRegistration = poolingPreflightPending;
|
|
16502
16677
|
try {
|
|
16503
16678
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
16504
16679
|
if (controller.signal.aborted)
|
|
@@ -16506,6 +16681,7 @@ function maybeAutoEmbedSessionBackfill(deps, sessionId) {
|
|
|
16506
16681
|
await deps.ensureRegistered();
|
|
16507
16682
|
if (controller.signal.aborted)
|
|
16508
16683
|
return;
|
|
16684
|
+
poolingPendingAfterRegistration = localPoolingPreflightPending(deps.projectIdentity);
|
|
16509
16685
|
markActive();
|
|
16510
16686
|
registeredIdentity = embeddingIdentity(deps.projectIdentity);
|
|
16511
16687
|
autoEmbedIdentityBySession.set(sessionId, registeredIdentity);
|
|
@@ -16513,7 +16689,9 @@ function maybeAutoEmbedSessionBackfill(deps, sessionId) {
|
|
|
16513
16689
|
if (controller.signal.aborted || !coverage.enabled)
|
|
16514
16690
|
return;
|
|
16515
16691
|
if (coverage.embedded === coverage.total) {
|
|
16516
|
-
complete =
|
|
16692
|
+
complete = !poolingPendingAfterRegistration;
|
|
16693
|
+
if (!complete)
|
|
16694
|
+
retryDelay = 60000;
|
|
16517
16695
|
return;
|
|
16518
16696
|
}
|
|
16519
16697
|
const model = getProjectEmbeddingSnapshot2(deps.projectIdentity)?.model;
|
|
@@ -16522,8 +16700,11 @@ function maybeAutoEmbedSessionBackfill(deps, sessionId) {
|
|
|
16522
16700
|
const outcome = await embedSessionCompartmentChunks2(deps.db, deps.projectIdentity, sessionId, { signal: controller.signal, automatic: true });
|
|
16523
16701
|
reason = outcome.status;
|
|
16524
16702
|
const after = await getAutoEmbeddingSessionCoverage2(deps.db, deps.projectIdentity, sessionId);
|
|
16525
|
-
complete = after.enabled && after.embedded === after.total;
|
|
16526
|
-
if (
|
|
16703
|
+
complete = after.enabled && after.embedded === after.total && !poolingPendingAfterRegistration;
|
|
16704
|
+
if (poolingPendingAfterRegistration) {
|
|
16705
|
+
retryDelay = 60000;
|
|
16706
|
+
reason = "pooling metadata unavailable";
|
|
16707
|
+
} else if (!complete && outcome.status !== "busy" && outcome.status !== "aborted") {
|
|
16527
16708
|
retryDelay = 60000;
|
|
16528
16709
|
if (outcome.status === "nothing" || outcome.status === "done")
|
|
16529
16710
|
reason = "deferred";
|
|
@@ -16930,7 +17111,7 @@ async function maybeDeliverChannel2(sessionId, deps) {
|
|
|
16930
17111
|
return false;
|
|
16931
17112
|
}
|
|
16932
17113
|
const evaluation = evaluateChannel2(deps.baseline);
|
|
16933
|
-
|
|
17114
|
+
logNudgeEvaluation(sessionId, "delivery", formatChannel2Evaluation(evaluation, { leaseBefore: "pending", leaseAfter: "pending" }));
|
|
16934
17115
|
if (deps.directiveText === undefined && !evaluation.evaluable) {
|
|
16935
17116
|
return false;
|
|
16936
17117
|
}
|
|
@@ -23893,8 +24074,8 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
23893
24074
|
}
|
|
23894
24075
|
return "completed";
|
|
23895
24076
|
}
|
|
23896
|
-
if (!historianRunnable && args.sessionMeta.compartmentInProgress) {
|
|
23897
|
-
sessionLog2(args.sessionId, "transform: historian
|
|
24077
|
+
if ((!historianRunnable || !args.canRunCompartments && !getActiveCompartmentRun(args.sessionId)) && args.sessionMeta.compartmentInProgress) {
|
|
24078
|
+
sessionLog2(args.sessionId, "transform: historian unavailable; clearing stale compartmentInProgress flag");
|
|
23898
24079
|
updateSessionMeta(args.db, args.sessionId, { compartmentInProgress: false });
|
|
23899
24080
|
compartmentInProgress = false;
|
|
23900
24081
|
}
|
|
@@ -24154,8 +24335,10 @@ function createTransform(deps) {
|
|
|
24154
24335
|
const loadedSessions = new Set;
|
|
24155
24336
|
const prefixHoldLogTurnIds = new Map;
|
|
24156
24337
|
const thinkingFitRetries = new Set;
|
|
24338
|
+
const compactionModeTransitionPending = new Set;
|
|
24157
24339
|
const clearSessionLogState = (sessionId) => {
|
|
24158
24340
|
prefixHoldLogTurnIds.delete(sessionId);
|
|
24341
|
+
clearDiagnosticLogState(sessionId);
|
|
24159
24342
|
};
|
|
24160
24343
|
const unmanagedOverWindowSessions = new Set;
|
|
24161
24344
|
const rustModeTransform = deps.transformMode === "rust" && deps.rustModeModuleClient ? createRustModeTransform(deps, {
|
|
@@ -24249,7 +24432,7 @@ function createTransform(deps) {
|
|
|
24249
24432
|
failPass("store-generation-rebase-failure", error);
|
|
24250
24433
|
}
|
|
24251
24434
|
}
|
|
24252
|
-
if (deps.client !== undefined) {
|
|
24435
|
+
if (deps.client !== undefined || deps.hostMessageReconciliationSource !== undefined) {
|
|
24253
24436
|
withoutSqliteTransformPass2(() => scheduleReconciliation(db, sessionId, host.hostMessageReconciliationSource));
|
|
24254
24437
|
}
|
|
24255
24438
|
const tUserMsg = performance.now();
|
|
@@ -24296,6 +24479,7 @@ function createTransform(deps) {
|
|
|
24296
24479
|
const hasTransitionEffects = transition.recordToWrite !== null || transition.notice !== null || transition.invalidatedM0Baseline || transition.clearedCompartmentInProgress || transition.historianCatchUpSignaled;
|
|
24297
24480
|
if (hasTransitionEffects) {
|
|
24298
24481
|
if (transition.invalidatedM0Baseline) {
|
|
24482
|
+
compactionModeTransitionPending.add(sessionId);
|
|
24299
24483
|
sessionMeta = {
|
|
24300
24484
|
...sessionMeta,
|
|
24301
24485
|
cachedM0Bytes: null,
|
|
@@ -24628,6 +24812,8 @@ function createTransform(deps) {
|
|
|
24628
24812
|
contextLimit: boundaryContextLimit
|
|
24629
24813
|
});
|
|
24630
24814
|
let _boundarySnapshotCache;
|
|
24815
|
+
if (fullFeatureMode && !compactionOff)
|
|
24816
|
+
maintainExecuteFloorMark(db, sessionId, currentTurnId, boundaryUsageForProtectedTail.percentage < boundaryExecuteThreshold);
|
|
24631
24817
|
const getRunnableBoundaryForCompartment = (emergencyTailScale) => {
|
|
24632
24818
|
if (!canRunCompartments)
|
|
24633
24819
|
return null;
|
|
@@ -24753,8 +24939,9 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24753
24939
|
recordedSessionProjectIdentity.set(sessionId, sessionIdentityForBinding);
|
|
24754
24940
|
}
|
|
24755
24941
|
const taggerFloor = compactionOff ? 0 : deriveTaggerLoadFloor(messages, sessionId, db);
|
|
24756
|
-
|
|
24757
|
-
|
|
24942
|
+
const tagFloorMode = compactionOff || messages.length === 0 ? "inactive" : taggerFloor === 0 ? "fallback" : "scoped";
|
|
24943
|
+
if (diagnosticStateChanged(sessionId, "tag-floor", tagFloorMode) && tagFloorMode !== "inactive") {
|
|
24944
|
+
sessionLog2(sessionId, taggerFloor === 0 ? `tag floor: 0 (full-scan fallback) — no scoped floor above the safety margin across ${messages.length} msgs` : `tag floor: ${taggerFloor} (scoped load)`);
|
|
24758
24945
|
}
|
|
24759
24946
|
const ownerRatio = sessionDecisionCalibration(db, sessionId).proseRatio;
|
|
24760
24947
|
noteTransformPassForExactOrdinalReads(sessionId);
|
|
@@ -24791,7 +24978,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24791
24978
|
idleExpiry: false,
|
|
24792
24979
|
emergency: contextUsageEarly.percentage >= forceMaterializationPercentage
|
|
24793
24980
|
}
|
|
24794
|
-
}, pendingDropEligibility.read(sessionId, dropProjectionKey()));
|
|
24981
|
+
}, pendingDropEligibility.read(sessionId, dropProjectionKey()), schedulerDecision === "execute");
|
|
24795
24982
|
if (triggerResult.shouldFire) {
|
|
24796
24983
|
sessionLog2(sessionId, `compartment trigger: firing (reason=${triggerResult.reason})`);
|
|
24797
24984
|
updateSessionMeta(db, sessionId, { compartmentInProgress: true });
|
|
@@ -24945,7 +25132,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24945
25132
|
if (persistedReasoningWatermark > 0 && !compactionOff) {
|
|
24946
25133
|
const tReplay = performance.now();
|
|
24947
25134
|
const replayed = canUseEmptySentinels ? replayClearedReasoning(messages, reasoningByMessage, messageTagNumbers, persistedReasoningWatermark) : 0;
|
|
24948
|
-
const replayedInline = replayStrippedInlineThinking(messages, messageTagNumbers, persistedReasoningWatermark);
|
|
25135
|
+
const replayedInline = replayStrippedInlineThinking(messages, messageTagNumbers, persistedReasoningWatermark, !canUseEmptySentinels);
|
|
24949
25136
|
if (replayed > 0 || replayedInline > 0) {
|
|
24950
25137
|
sessionLog2(sessionId, `reasoning replay: cleared=${replayed} inlineStripped=${replayedInline} (watermark=${persistedReasoningWatermark})`);
|
|
24951
25138
|
}
|
|
@@ -25162,6 +25349,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25162
25349
|
activeThinkingPrefixHold,
|
|
25163
25350
|
directoryPrefixHold: unresolvedDirectoryHold,
|
|
25164
25351
|
forceSignedRebuildForFit: thinkingFitRetries.has(sessionId) || !!recovery.rebuildReason,
|
|
25352
|
+
compactionModeTransition: compactionModeTransitionPending.has(sessionId),
|
|
25165
25353
|
readLastServedMessages: () => {
|
|
25166
25354
|
const slot = getInMemorySlot(sessionId) ?? loadPersistedLkgSlot(db, sessionId);
|
|
25167
25355
|
try {
|
|
@@ -25219,6 +25407,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25219
25407
|
hardSignals: m0HardSignals
|
|
25220
25408
|
}
|
|
25221
25409
|
});
|
|
25410
|
+
compactionModeTransitionPending.delete(sessionId);
|
|
25222
25411
|
if (recovery.prefix && !recoveryNormalized) {
|
|
25223
25412
|
const priorIds = new Set(recovery.prefix.inputs.map((input) => input.id));
|
|
25224
25413
|
const newIds = new Set(lkgInput.flatMap((input) => input.id && !priorIds.has(input.id) ? [input.id] : []));
|
|
@@ -25396,7 +25585,8 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25396
25585
|
if (JSON.stringify([...new Set(stillUntagged)].sort()) !== JSON.stringify([...new Set(persistedUntaggedInputIds)].sort()) && !persistLkgUntaggedInputIds(db, sessionId, stillUntagged))
|
|
25397
25586
|
throw new Error("Cannot persist the last-good untagged-message record");
|
|
25398
25587
|
}
|
|
25399
|
-
|
|
25588
|
+
const signedThinkingServed = isPrefixBoundThinkingModel(modelForBudget?.providerID, modelForBudget?.modelID) && servesThinkingBlock2(messages, modelForBudget?.providerID, modelForBudget?.modelID);
|
|
25589
|
+
finishSystemDateRefresh(deps.historyRefreshSessions, dateRequest, postTransformResult.bustedThisPass && !activeThinkingPrefixHold && !signedThinkingServed || postTransformResult.thinkingReleasedForFit === true, signedThinkingServed);
|
|
25400
25590
|
if (activeThinkingPrefixHold && !postTransformResult.thinkingReleasedForFit && sessionMeta.cachedM0Bytes != null && sessionMeta.cachedM1Bytes != null) {
|
|
25401
25591
|
recordHeldHeadForRequest(sessionId, currentLkgRequestIdentity(sessionId), (ownsHistory) => deferDeliveredSystemRefresh(deps, sessionId, ownsHistory));
|
|
25402
25592
|
}
|
|
@@ -25554,7 +25744,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25554
25744
|
postReduceGraceBaselineU: channel1State.postReduceGraceBaselineU,
|
|
25555
25745
|
postReduceGracePreLevel: channel1State.postReduceGracePreLevel
|
|
25556
25746
|
});
|
|
25557
|
-
|
|
25747
|
+
logNudgeEvaluation(sessionId, "transform", formatChannel1Evaluation(channel1Decision));
|
|
25558
25748
|
const channel2Evaluation = evaluateChannel2(channelBaseline);
|
|
25559
25749
|
const leaseBefore = getChannel2NudgeState(db, sessionId);
|
|
25560
25750
|
if (channelBaseline.evaluable && !channelBaseline.generationInvalidated && !channelBaseline.reducedSinceRefresh) {
|
|
@@ -25565,7 +25755,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25565
25755
|
}
|
|
25566
25756
|
}
|
|
25567
25757
|
const leaseAfter = getChannel2NudgeState(db, sessionId);
|
|
25568
|
-
|
|
25758
|
+
logNudgeEvaluation(sessionId, "transform", formatChannel2Evaluation(channel2Evaluation, {
|
|
25569
25759
|
leaseBefore,
|
|
25570
25760
|
leaseAfter,
|
|
25571
25761
|
gateHoldReason: channelBaseline.reducedSinceRefresh ? "recent-reduce-refresh" : undefined
|
|
@@ -25834,6 +26024,35 @@ function describeSystemPromptChange(previous, current) {
|
|
|
25834
26024
|
return `presetChanged=${previous ? previous.preset !== current.preset : "unknown"} elements=[${elements.join("; ")}]`;
|
|
25835
26025
|
}
|
|
25836
26026
|
|
|
26027
|
+
// src/hooks/magic-context/system-prompt-sticky-date.ts
|
|
26028
|
+
var STICKY_DATE_KEY = "systemPromptStickyDate";
|
|
26029
|
+
function readPersistedSystemPromptStickyDate(db, sessionId) {
|
|
26030
|
+
try {
|
|
26031
|
+
const saved = readReplayEnvelope(db, sessionId, "read")[STICKY_DATE_KEY];
|
|
26032
|
+
return typeof saved === "string" && saved.length > 0 ? saved : undefined;
|
|
26033
|
+
} catch (error) {
|
|
26034
|
+
sessionLog2(sessionId, "system prompt sticky date record unreadable:", error);
|
|
26035
|
+
return;
|
|
26036
|
+
}
|
|
26037
|
+
}
|
|
26038
|
+
function persistSystemPromptStickyDate(db, sessionId, stickyDate) {
|
|
26039
|
+
try {
|
|
26040
|
+
const written = updateReplayDocument(db, sessionId, (doc) => {
|
|
26041
|
+
if (doc[STICKY_DATE_KEY] === stickyDate)
|
|
26042
|
+
return false;
|
|
26043
|
+
doc.version = 2;
|
|
26044
|
+
doc[STICKY_DATE_KEY] = stickyDate;
|
|
26045
|
+
return true;
|
|
26046
|
+
});
|
|
26047
|
+
if (!written)
|
|
26048
|
+
sessionLog2(sessionId, "system prompt sticky date record not written");
|
|
26049
|
+
return written;
|
|
26050
|
+
} catch (error) {
|
|
26051
|
+
sessionLog2(sessionId, "system prompt sticky date record write failed:", error);
|
|
26052
|
+
return false;
|
|
26053
|
+
}
|
|
26054
|
+
}
|
|
26055
|
+
|
|
25837
26056
|
// src/hooks/magic-context/system-prompt-hash.ts
|
|
25838
26057
|
var MAGIC_CONTEXT_MARKER = "## Magic Context";
|
|
25839
26058
|
var SYSTEM_PROMPT_GUIDANCE_SEPARATOR = `
|
|
@@ -25856,6 +26075,15 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25856
26075
|
});
|
|
25857
26076
|
const guidanceEpochs = createPromptSurfaceGuidanceEpochCache(promptSurfaceRuntime);
|
|
25858
26077
|
const stickyDateBySession = new Map;
|
|
26078
|
+
const recordedStickyDateBySession = new Map;
|
|
26079
|
+
const recordedStickyDate = (sessionId) => {
|
|
26080
|
+
let recorded = recordedStickyDateBySession.get(sessionId);
|
|
26081
|
+
if (recorded === undefined) {
|
|
26082
|
+
recorded = readPersistedSystemPromptStickyDate(deps.db, sessionId) ?? null;
|
|
26083
|
+
recordedStickyDateBySession.set(sessionId, recorded);
|
|
26084
|
+
}
|
|
26085
|
+
return recorded ?? undefined;
|
|
26086
|
+
};
|
|
25859
26087
|
const diagnosticPrompts = new Map;
|
|
25860
26088
|
const processSystemPrompt = async (input, output) => {
|
|
25861
26089
|
const sessionId = input.sessionID;
|
|
@@ -25923,9 +26151,34 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25923
26151
|
return;
|
|
25924
26152
|
const previousHash = sessionMetaEarly?.systemPromptHash ?? "";
|
|
25925
26153
|
const hasPersistedHash = previousHash !== "" && previousHash !== "0";
|
|
25926
|
-
|
|
25927
|
-
|
|
25928
|
-
|
|
26154
|
+
const prefixBoundModel = isPrefixBoundThinkingModel(liveModel?.providerID, liveModel?.modelID);
|
|
26155
|
+
let stickyDate = stickyDateBySession.get(sessionId);
|
|
26156
|
+
if (!hasPersistedHash) {
|
|
26157
|
+
const previous = stickyDate ?? recordedStickyDate(sessionId);
|
|
26158
|
+
const live = systemPromptDates(liveSystemContent).live;
|
|
26159
|
+
const fieldCount = (dates) => dates === undefined ? 0 : JSON.parse(dates).length;
|
|
26160
|
+
stickyDate = (!modelKey || prefixBoundModel) && previous !== undefined && live !== undefined && fieldCount(previous) === fieldCount(live) ? previous : undefined;
|
|
26161
|
+
if (stickyDate === undefined)
|
|
26162
|
+
stickyDateBySession.delete(sessionId);
|
|
26163
|
+
else
|
|
26164
|
+
stickyDateBySession.set(sessionId, stickyDate);
|
|
26165
|
+
}
|
|
26166
|
+
if (stickyDate === undefined && hasPersistedHash) {
|
|
26167
|
+
const recorded = recordedStickyDate(sessionId);
|
|
26168
|
+
const live = systemPromptDates(liveSystemContent).live;
|
|
26169
|
+
if (recorded !== undefined && live !== undefined && recorded !== live && systemPromptFingerprint(systemPromptDates(liveSystemContent, recorded).stable, promptSurface.preset) === previousHash) {
|
|
26170
|
+
stickyDate = recorded;
|
|
26171
|
+
stickyDateBySession.set(sessionId, recorded);
|
|
26172
|
+
sessionLog2(sessionId, `system prompt date restored after restart: real=${live}, using=${recorded}`);
|
|
26173
|
+
}
|
|
26174
|
+
}
|
|
26175
|
+
const setStickyDate = (value) => {
|
|
26176
|
+
stickyDateBySession.set(sessionId, value);
|
|
26177
|
+
if (value !== recordedStickyDate(sessionId)) {
|
|
26178
|
+
if (persistSystemPromptStickyDate(deps.db, sessionId, value))
|
|
26179
|
+
recordedStickyDateBySession.set(sessionId, value);
|
|
26180
|
+
}
|
|
26181
|
+
};
|
|
25929
26182
|
const dates = systemPromptDates(liveSystemContent, stickyDate);
|
|
25930
26183
|
const currentDate = dates.live;
|
|
25931
26184
|
const stableCandidate = dates.stable;
|
|
@@ -25933,13 +26186,12 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25933
26186
|
const contentOrPresetChanged = hasPersistedHash && stableCandidateHash !== previousHash;
|
|
25934
26187
|
const rewritePermission = systemDateRefreshPermission(deps.historyRefreshSessions, dateRequest);
|
|
25935
26188
|
const signedThinkingKept = systemDateSignedThinkingKept(deps.historyRefreshSessions, dateRequest);
|
|
25936
|
-
const
|
|
25937
|
-
const prefixBoundModel = isPrefixBoundThinkingModel(liveModel?.providerID, liveModel?.modelID);
|
|
26189
|
+
const systemDateMayMove = (rewrite, keptSignedThinking) => (rewrite || idleCacheExpired) && keptSignedThinking !== true;
|
|
25938
26190
|
let deferredDateRefresh = false;
|
|
25939
26191
|
if (currentDate && stickyDate && currentDate !== stickyDate && (idleCacheExpired ? prefixBoundModel : isCacheBusting) && !contentOrPresetChanged && !requestMessagesFinal) {
|
|
25940
26192
|
const liveElements = [...output.system];
|
|
25941
26193
|
deferredDateRefresh = waitForSystemDateRefresh(deps.historyRefreshSessions, dateRequest, (permitted, keptSignedThinking) => {
|
|
25942
|
-
if (!permitted
|
|
26194
|
+
if (!systemDateMayMove(permitted, keptSignedThinking)) {
|
|
25943
26195
|
deps.systemPromptRefreshSessions.add(sessionId);
|
|
25944
26196
|
return;
|
|
25945
26197
|
}
|
|
@@ -25952,7 +26204,7 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25952
26204
|
cachedM0SystemHash: hash,
|
|
25953
26205
|
systemPromptTokens: estimateTokens(content)
|
|
25954
26206
|
});
|
|
25955
|
-
|
|
26207
|
+
setStickyDate(currentDate);
|
|
25956
26208
|
output.system.splice(0, output.system.length, ...liveElements);
|
|
25957
26209
|
publishSystemDateOutput(output.system);
|
|
25958
26210
|
deps.systemPromptRefreshSessions.delete(sessionId);
|
|
@@ -25963,12 +26215,12 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25963
26215
|
}
|
|
25964
26216
|
});
|
|
25965
26217
|
}
|
|
25966
|
-
const dateMayAdvance =
|
|
26218
|
+
const dateMayAdvance = contentOrPresetChanged || !deferredDateRefresh && systemDateMayMove(isCacheBusting && (dateRequest ? rewritePermission === true : rewritePermission !== false), signedThinkingKept);
|
|
25967
26219
|
if (currentDate && !stickyDate) {
|
|
25968
|
-
|
|
26220
|
+
setStickyDate(currentDate);
|
|
25969
26221
|
} else if (currentDate && stickyDate && currentDate !== stickyDate) {
|
|
25970
26222
|
if (dateMayAdvance) {
|
|
25971
|
-
|
|
26223
|
+
setStickyDate(currentDate);
|
|
25972
26224
|
sessionLog2(sessionId, `system prompt date updated: ${stickyDate} → ${currentDate} (cache-busting pass)`);
|
|
25973
26225
|
} else {
|
|
25974
26226
|
let offset = 0;
|
|
@@ -26026,7 +26278,7 @@ function createSystemPromptHashHandler(deps) {
|
|
|
26026
26278
|
sessionLog2(sessionId, "system prompt meta persist failed (fail-open):", error);
|
|
26027
26279
|
}
|
|
26028
26280
|
}
|
|
26029
|
-
if (isCacheBusting && !deferredDateRefresh && (contentOrPresetChanged || !currentDate || currentDate === stickyDate || !dateRequest || rewritePermission === true)) {
|
|
26281
|
+
if (isCacheBusting && !deferredDateRefresh && (contentOrPresetChanged || !currentDate || currentDate === stickyDate || !dateRequest || rewritePermission === true && signedThinkingKept !== true)) {
|
|
26030
26282
|
deps.systemPromptRefreshSessions.delete(sessionId);
|
|
26031
26283
|
}
|
|
26032
26284
|
};
|
|
@@ -26041,6 +26293,7 @@ function createSystemPromptHashHandler(deps) {
|
|
|
26041
26293
|
handler,
|
|
26042
26294
|
clearSession: (sessionId) => {
|
|
26043
26295
|
diagnosticPrompts.delete(sessionId);
|
|
26296
|
+
recordedStickyDateBySession.delete(sessionId);
|
|
26044
26297
|
clearSystemDateRefresh(deps.historyRefreshSessions, sessionId);
|
|
26045
26298
|
guidanceEpochs.clear(sessionId);
|
|
26046
26299
|
clearSystemPromptHashSession(sessionId, {
|
|
@@ -26624,8 +26877,17 @@ function guardSubagentTools(tools, db, isInternalChild) {
|
|
|
26624
26877
|
function hideSubagentTools(draft, db) {
|
|
26625
26878
|
if (!getOrCreateSessionMeta(db, draft.sessionID).isSubagent)
|
|
26626
26879
|
return;
|
|
26880
|
+
removePrimaryOnlyTools(draft.tools);
|
|
26881
|
+
}
|
|
26882
|
+
function removePrimaryOnlyTools(tools) {
|
|
26627
26883
|
for (const id of PRIMARY_ONLY_TOOLS)
|
|
26628
|
-
delete
|
|
26884
|
+
delete tools[id];
|
|
26885
|
+
}
|
|
26886
|
+
function storedSubagentMode(db, sessionId) {
|
|
26887
|
+
const row = db.prepare("SELECT is_subagent FROM session_meta WHERE session_id = ?").get(sessionId);
|
|
26888
|
+
if (!row || typeof row.is_subagent !== "number")
|
|
26889
|
+
return;
|
|
26890
|
+
return row.is_subagent === 1;
|
|
26629
26891
|
}
|
|
26630
26892
|
|
|
26631
26893
|
// src/tools/ctx-expand/tools.ts
|
|
@@ -28633,7 +28895,7 @@ function createCtxReduceTool(deps) {
|
|
|
28633
28895
|
args = unwrapImitatedReducedArgs(args, ["drop"], { drop: "string" });
|
|
28634
28896
|
const sessionId = toolContext.sessionID;
|
|
28635
28897
|
if (!args.drop) {
|
|
28636
|
-
return
|
|
28898
|
+
return `Error: 'drop' must be provided as a string of tag numbers, for example {"drop": "3-5,8"}.`;
|
|
28637
28899
|
}
|
|
28638
28900
|
const rustReduce = deps.rustToolBackends?.reduce;
|
|
28639
28901
|
if (rustReduce) {
|
|
@@ -28902,6 +29164,7 @@ function createCtxSearchTool(deps) {
|
|
|
28902
29164
|
return formatSearchResults2(query, idResults ?? [], toolContext.sessionID, diagnostics);
|
|
28903
29165
|
}
|
|
28904
29166
|
}
|
|
29167
|
+
let rerankSkipped = "";
|
|
28905
29168
|
const results = await unifiedSearch2(deps.db, toolContext.sessionID, projectPath, query, {
|
|
28906
29169
|
limit: normalizeLimit2(args.limit),
|
|
28907
29170
|
memoryEnabled,
|
|
@@ -28920,10 +29183,16 @@ function createCtxSearchTool(deps) {
|
|
|
28920
29183
|
gitRepositoryAvailable: typeof toolContext.directory === "string" ? directoryHasGitMetadata(toolContext.directory) : undefined,
|
|
28921
29184
|
explicitSearch: true,
|
|
28922
29185
|
rerankConnectionFile: deps.rerankConnectionFile,
|
|
29186
|
+
rerankConfig: deps.rerankConfig,
|
|
29187
|
+
onRerankSkipped: (line) => {
|
|
29188
|
+
rerankSkipped = line;
|
|
29189
|
+
},
|
|
28923
29190
|
searchMessageHistory: (request) => searchMessageHistoryOffThread(deps.db, request),
|
|
29191
|
+
signal: toolContext.abort,
|
|
28924
29192
|
...dateRange
|
|
28925
29193
|
});
|
|
28926
|
-
return formatSearchResults2(query, results, toolContext.sessionID, diagnostics)
|
|
29194
|
+
return formatSearchResults2(query, results, toolContext.sessionID, diagnostics) + (rerankSkipped ? `
|
|
29195
|
+
${rerankSkipped}` : "");
|
|
28927
29196
|
}
|
|
28928
29197
|
});
|
|
28929
29198
|
}
|
|
@@ -29469,4 +29738,4 @@ function applyHiddenSubagentTemperature(input, output, log) {
|
|
|
29469
29738
|
output.temperature = temperature;
|
|
29470
29739
|
}
|
|
29471
29740
|
|
|
29472
|
-
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, scheduleClearAndReindex, 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, createCtxExpandTools, CTX_MEMORY_LIST_TOOL_NAME, CTX_MEMORY_ACTIONS, createCtxMemoryTools, createCtxMemoryListTools, CTX_NOTE_DESCRIPTION, withoutSmartNoteText, createCtxNoteTools, createCtxReduceTools, createCtxSearchTools, parameterDescriptionsFor, applyJsonSchemaParameterDescriptions, MagicContextRpcServer, subagentTemperature, applyHiddenSubagentTemperature };
|
|
29741
|
+
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, scheduleClearAndReindex, 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 };
|