@cortexkit/opencode-magic-context 0.49.19 → 0.49.20
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-b2q30cft.js} +3 -3
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/compartment-chunk-embedding-va090as0.js +65 -0
- package/dist/config/schema/magic-context.d.ts +6 -6
- package/dist/{conflict-warning-hook-4pmz879v.js → conflict-warning-hook-frp3z2wk.js} +9 -8
- package/dist/{context-j31m2dv7.js → context-mkece1db.js} +455 -134
- package/dist/{derive-budgets-zn7yzd2d.js → derive-budgets-pqybnx09.js} +2 -2
- package/dist/embedding-backfill-gy3p78py.js +25 -0
- package/dist/embedding-worker-process.js +2 -2
- package/dist/embedding-worker.js +5 -5
- 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/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-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/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.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.map +1 -1
- package/dist/features/magic-context/search.d.ts +27 -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-meta-persisted.d.ts +1 -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 +5 -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/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-messages.d.ts +2 -0
- package/dist/hooks/magic-context/tag-messages.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.map +1 -1
- package/dist/{index-bjcnntmz.js → index-0wthn7fp.js} +468 -18
- package/dist/{index-kq82mtg0.js → index-11zf2wwc.js} +3 -3
- package/dist/{index-b5vqckbw.js → index-153r2q6z.js} +314 -127
- package/dist/{index-3h4dp9wb.js → index-1pefp8ar.js} +5 -5
- package/dist/{index-beht37jy.js → index-1zx2pa5d.js} +1 -1
- package/dist/{index-ze7mvk54.js → index-2yhtnfcf.js} +75 -57
- package/dist/{index-cf74k5ak.js → index-305y133n.js} +4 -4
- package/dist/{index-s734jcsr.js → index-35qc6606.js} +9 -3
- package/dist/{index-se4m2g6w.js → index-48stjd56.js} +105 -19
- package/dist/{index-4911rn0b.js → index-4n7w9rad.js} +6 -6
- package/dist/{index-kee4kn5j.js → index-4pnsgvfk.js} +1 -1
- package/dist/{v2/server-8cd2j99z.js → index-5kym00ag.js} +32 -13
- package/dist/{index-4s3t0nd0.js → index-616rsjrv.js} +2 -2
- package/dist/{index-jhghdnsm.js → index-67nyj0gy.js} +485 -202
- package/dist/{index-6x57ar45.js → index-adk2z5d8.js} +3 -3
- package/dist/{index-c5pytzne.js → index-b88dwwrh.js} +1 -1
- package/dist/{index-rr2bb45z.js → index-c4b76d4t.js} +2 -2
- package/dist/{index-nj7yykkx.js → index-c7phnbvk.js} +1 -1
- package/dist/index-cpjk5jd2.js +82 -0
- package/dist/{index-edmpdxcw.js → index-d6rp4dxh.js} +5 -5
- package/dist/{index-dxmq29t1.js → index-dc8hy95c.js} +69 -17
- package/dist/{index-j75v2476.js → index-h7tgn49j.js} +12 -15
- package/dist/{index-ke416mdc.js → index-j76ah6d7.js} +2 -2
- package/dist/{index-c1p88z1y.js → index-jfh3cktr.js} +4 -4
- package/dist/{index-a6mc0v4d.js → index-jmycsey7.js} +3 -3
- package/dist/{index-24fezq97.js → index-jr5na10t.js} +4 -4
- package/dist/{index-s74zqahq.js → index-kc9pn495.js} +4 -4
- package/dist/{index-p5y3k4g7.js → index-nda0zgna.js} +2 -1
- package/dist/{index-jn12fvvh.js → index-neb2jaed.js} +3 -3
- package/dist/{index-63k48rv9.js → index-pnjwa6qa.js} +5 -5
- package/dist/{index-jrr131e0.js → index-rmd0069m.js} +11 -11
- package/dist/{index-y9f76s3f.js → index-rrv26qjz.js} +1 -1
- package/dist/{index-v10f1rjv.js → index-spwjbkc7.js} +1 -1
- package/dist/{index-k29z4aqh.js → index-t5pck3ss.js} +1 -1
- package/dist/{index-3esx8tkf.js → index-t7hx3qcb.js} +318 -104
- package/dist/{index-rpxdjkm0.js → index-v7r4td4c.js} +306 -59
- package/dist/{index-2vxtcb95.js → index-vkc1ca9p.js} +2 -2
- package/dist/{index-9zcsy3hh.js → index-x4k3f4mf.js} +17 -9
- package/dist/{index-bp5083x2.js → index-x9k3mqrf.js} +1 -1
- package/dist/{index-n37sebck.js → index-y4a3nhtk.js} +1 -1
- package/dist/index.js +52 -49
- package/dist/{logger-jm3sqqzr.js → logger-94kew5wm.js} +1 -1
- package/dist/{message-fts-rowid-map-17s0dfn4.js → message-fts-rowid-map-22tevnnj.js} +6 -5
- package/dist/{message-index-gtpqnj8w.js → message-index-5qxcz6h7.js} +16 -15
- package/dist/{message-index-bounded-zyc8h32y.js → message-index-bounded-n0m0t7tv.js} +16 -15
- package/dist/{message-time-backfill-73mmm76q.js → message-time-backfill-0myx7fz3.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 +3 -1
- package/dist/plugin/embedding-bootstrap.d.ts.map +1 -1
- 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/{project-embedding-registry-z74mhqkf.js → project-embedding-registry-s2pqgec9.js} +13 -12
- package/dist/raw-ordinal-warmup-worker.js +136 -101
- package/dist/{read-session-chunk-jjb48bt9.js → read-session-chunk-0a8vdyqp.js} +11 -10
- package/dist/{read-session-raw-rsc8c7qy.js → read-session-raw-y5cszf0b.js} +4 -3
- package/dist/recomp-orchestrator-61vyha9j.js +62 -0
- package/dist/{safe-notification-target-1szv1k5k.js → safe-notification-target-mkr9yzvr.js} +2 -2
- package/dist/{search-archive-6vm0e2f5.js → search-archive-8q9s49p5.js} +12 -11
- package/dist/{search-xsqk1bj4.js → search-v1y9ejws.js} +25 -24
- package/dist/{send-session-notification-6ve0e8p4.js → send-session-notification-0k6qzydk.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 +1 -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/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-1rpvw2rj.js} +1 -1
- package/dist/{storage-memory-y3qmy00r.js → storage-memory-nm7v82mj.js} +2 -2
- package/dist/{storage-tags-r7k9tjcv.js → storage-tags-r6nk29n4.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/{transform-postprocess-phase-jj99r7z2.js → transform-postprocess-phase-vtrgb7m6.js} +34 -31
- 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-cfab70cs.js} +3 -3
- package/dist/v2/compaction-marker-candidates-worker.js +2 -2
- package/dist/v2/compartment-chunk-embedding-nbdqx1td.js +64 -0
- package/dist/v2/{context-y5yamxak.js → context-cc33tv2z.js} +1189 -386
- package/dist/v2/{derive-budgets-2zh4gm2c.js → derive-budgets-knf763tt.js} +3 -3
- package/dist/v2/embedding-backfill-yxv2h5mc.js +24 -0
- package/dist/v2/embedding-worker-process.js +2 -2
- package/dist/v2/embedding-worker.js +5 -5
- 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/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/{logger-7qt02bnb.js → logger-p34mjtja.js} +1 -1
- package/dist/v2/{message-fts-rowid-map-wfx67gfd.js → message-fts-rowid-map-dg12wymk.js} +6 -5
- package/dist/v2/{message-index-bounded-spd8r7pj.js → message-index-bounded-f4e01xk0.js} +16 -15
- package/dist/v2/{message-index-8vz2pq76.js → message-index-ydzrp6y6.js} +16 -15
- package/dist/v2/{message-time-backfill-04t0km1z.js → message-time-backfill-ddh8n9gy.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-deza9ksw.js} +13 -12
- package/dist/v2/raw-ordinal-warmup-worker.js +136 -101
- package/dist/v2/{read-session-chunk-cwkxrmns.js → read-session-chunk-8cxfagky.js} +11 -10
- package/dist/v2/{read-session-raw-yaegtjzh.js → read-session-raw-1nrrecvx.js} +4 -3
- package/dist/v2/recomp-orchestrator-47m4hv5g.js +61 -0
- package/dist/v2/{safe-notification-target-qg7n2s77.js → safe-notification-target-khnzg57c.js} +2 -2
- package/dist/v2/{search-archive-wve3tq1k.js → search-archive-e80cvc09.js} +12 -11
- package/dist/v2/{search-hwg7jfbj.js → search-fjz746zr.js} +25 -24
- package/dist/v2/{send-session-notification-3pxn658x.js → send-session-notification-nwvrv34d.js} +7 -6
- package/dist/v2/{server-8by8qfec.js → server-0epqaxhd.js} +75 -57
- package/dist/v2/{server-pwv4ezb0.js → server-168pb207.js} +1 -1
- package/dist/v2/{server-h0410h0v.js → server-1bw1wcbp.js} +1 -1
- package/dist/v2/{server-beht37jy.js → server-1zx2pa5d.js} +1 -1
- package/dist/v2/{server-a9xqj88f.js → server-230fnbws.js} +4 -4
- package/dist/v2/{server-tbe1femw.js → server-29qp8nz4.js} +1 -1
- package/dist/v2/{server-tgnbmwah.js → server-3mz2qh5a.js} +1 -1
- package/dist/v2/{server-hy3d3vsx.js → server-4nw4fqhr.js} +2 -2
- package/dist/v2/{server-45q69hkq.js → server-4sxjs6hn.js} +5 -5
- package/dist/v2/{server-34kwfsr4.js → server-53eh1r8r.js} +2 -2
- package/dist/v2/{server-xj136kt8.js → server-55rgxfrw.js} +9 -3
- package/dist/v2/{server-nj659894.js → server-5arr9ecn.js} +2 -2
- package/dist/{index-8cd2j99z.js → v2/server-5kym00ag.js} +32 -13
- package/dist/v2/{server-2ar62dyx.js → server-63fqdghs.js} +106 -20
- package/dist/v2/{server-f2xf5gcb.js → server-6495nmn9.js} +12 -15
- package/dist/v2/{server-qd11g795.js → server-92g7d776.js} +2 -1
- package/dist/v2/{server-xq7dfjke.js → server-9x0kmta4.js} +5 -5
- package/dist/v2/{server-27gq4mfz.js → server-a3dwxfgd.js} +4 -4
- package/dist/v2/{server-6tmj0s7j.js → server-af2pght7.js} +3 -3
- package/dist/v2/{server-1wy7b9de.js → server-br1x0tev.js} +3 -3
- package/dist/v2/{server-n1prf1g6.js → server-brj8j2gk.js} +2 -2
- package/dist/v2/{server-6vdzn1td.js → server-c7dxxsj7.js} +308 -61
- package/dist/v2/server-cpjk5jd2.js +82 -0
- package/dist/v2/{server-g3qma5c0.js → server-dj7tz4ph.js} +2 -2
- package/dist/v2/{server-9hx7g5jp.js → server-ej96a39v.js} +17 -9
- package/dist/v2/{server-6pmqg9m4.js → server-gyy4k6mf.js} +1 -1
- package/dist/v2/{server-bmymkx73.js → server-hqzyq8n4.js} +11 -11
- package/dist/v2/{server-h1v0pyxb.js → server-j4jnp9b5.js} +468 -18
- package/dist/v2/{server-da07v4xp.js → server-k3t06fxr.js} +1 -1
- package/dist/v2/{server-gsxjv2q2.js → server-m91f9m5s.js} +69 -17
- package/dist/v2/{server-rmygf5pn.js → server-ne8arh8t.js} +2 -2
- package/dist/v2/{server-hm38q7r0.js → server-vn2nwcv6.js} +5 -5
- package/dist/v2/{server-46neh5fa.js → server-wyawsa88.js} +314 -127
- package/dist/v2/{server-zzkj2fch.js → server-xsryvyf6.js} +4 -4
- package/dist/v2/{server-n37sebck.js → server-y4a3nhtk.js} +1 -1
- package/dist/v2/{server-d04vrx0j.js → server-ygtykank.js} +2 -2
- package/dist/v2/server.js +6 -6
- package/dist/v2/{sqlite-zf72c52d.js → sqlite-1rpvw2rj.js} +1 -1
- package/dist/v2/{storage-memory-y3qmy00r.js → storage-memory-nm7v82mj.js} +2 -2
- package/dist/v2/{storage-tags-3wdb8zph.js → storage-tags-ss08kj5r.js} +5 -5
- package/dist/v2/store-reader.d.ts +8 -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-639whfhq.js} +32 -31
- package/dist/wrapup-orchestrator-mnvt2g8m.js +49 -0
- package/package.json +1 -1
- package/src/config/index.test.ts +28 -6
- 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 +1 -1
- 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.ts +4 -2
- package/src/shared/subagent-runner.ts +2 -0
- 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/v2/embedding-backfill-7c7yr69y.js +0 -23
- package/dist/v2/recomp-orchestrator-f6m9jr7p.js +0 -60
- 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-1zx2pa5d.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-vkc1ca9p.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-c4b76d4t.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-305y133n.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,
|
|
@@ -168,7 +168,7 @@ import {
|
|
|
168
168
|
buildInMemoryTailRawMessages2,
|
|
169
169
|
RawOrdinalsNotReady2,
|
|
170
170
|
runSessionWarmupWorker
|
|
171
|
-
} from "./index-
|
|
171
|
+
} from "./index-35qc6606.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-11zf2wwc.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-x4k3f4mf.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-rmd0069m.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-pnjwa6qa.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-v7r4td4c.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-2yhtnfcf.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-adk2z5d8.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-48stjd56.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-1pefp8ar.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-0wthn7fp.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-jr5na10t.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-y4a3nhtk.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-dc8hy95c.js";
|
|
681
685
|
import {
|
|
682
686
|
flushIgnoredMessages2,
|
|
683
687
|
clearIgnoredMessages2,
|
|
684
688
|
observeIgnoredNotificationEvent2,
|
|
685
689
|
sendStatusNotification2
|
|
686
|
-
} from "./index-
|
|
690
|
+
} from "./index-kc9pn495.js";
|
|
687
691
|
import {
|
|
688
692
|
setRecompStarting2,
|
|
689
693
|
setRecompTerminal2
|
|
690
|
-
} from "./index-
|
|
694
|
+
} from "./index-jfh3cktr.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-67nyj0gy.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-d6rp4dxh.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,
|
|
@@ -5577,6 +5603,8 @@ Remember: output only the JSON object described by the system prompt.`;
|
|
|
5577
5603
|
startedAt,
|
|
5578
5604
|
status: params.status,
|
|
5579
5605
|
messages: params.messages,
|
|
5606
|
+
attemptedModel: args.model,
|
|
5607
|
+
configuredModels: args.fallbackModels,
|
|
5580
5608
|
error: params.error
|
|
5581
5609
|
});
|
|
5582
5610
|
};
|
|
@@ -6563,6 +6591,8 @@ async function confirmReadOnly(args, noteId, content, surfaceCondition, leaseSig
|
|
|
6563
6591
|
startedAt,
|
|
6564
6592
|
status: params.status,
|
|
6565
6593
|
messages: params.messages,
|
|
6594
|
+
attemptedModel: args.model,
|
|
6595
|
+
configuredModels: args.fallbackModels,
|
|
6566
6596
|
error: params.error
|
|
6567
6597
|
});
|
|
6568
6598
|
};
|
|
@@ -7477,12 +7507,14 @@ function recordInvocation2(args, startedAt, params) {
|
|
|
7477
7507
|
recordChildInvocation({
|
|
7478
7508
|
db: args.db,
|
|
7479
7509
|
parentSessionId: args.parentSessionId,
|
|
7480
|
-
harness: "opencode",
|
|
7510
|
+
harness: args.hiddenCompletionExecutor?.capabilities.harness ?? "opencode",
|
|
7481
7511
|
subagent: "dreamer",
|
|
7482
7512
|
task: "map-memories",
|
|
7483
7513
|
startedAt,
|
|
7484
7514
|
status: params.status,
|
|
7485
7515
|
messages: params.messages,
|
|
7516
|
+
attemptedModel: args.model,
|
|
7517
|
+
configuredModels: args.fallbackModels,
|
|
7486
7518
|
error: params.error
|
|
7487
7519
|
});
|
|
7488
7520
|
}
|
|
@@ -8107,12 +8139,14 @@ function recordInvocation3(args, startedAt, params) {
|
|
|
8107
8139
|
recordChildInvocation({
|
|
8108
8140
|
db: args.db,
|
|
8109
8141
|
parentSessionId: args.parentSessionId,
|
|
8110
|
-
harness: "opencode",
|
|
8142
|
+
harness: args.hiddenCompletionExecutor?.capabilities.harness ?? "opencode",
|
|
8111
8143
|
subagent: "dreamer",
|
|
8112
8144
|
task: "refresh-primers",
|
|
8113
8145
|
startedAt,
|
|
8114
8146
|
status: params.status,
|
|
8115
8147
|
messages: params.messages,
|
|
8148
|
+
attemptedModel: args.model,
|
|
8149
|
+
configuredModels: args.fallbackModels,
|
|
8116
8150
|
error: params.error
|
|
8117
8151
|
});
|
|
8118
8152
|
}
|
|
@@ -9569,12 +9603,14 @@ function recordInvocation4(args, startedAt, params) {
|
|
|
9569
9603
|
recordChildInvocation({
|
|
9570
9604
|
db: args.db,
|
|
9571
9605
|
parentSessionId: args.parentSessionId,
|
|
9572
|
-
harness: "opencode",
|
|
9606
|
+
harness: args.hiddenCompletionExecutor?.capabilities.harness ?? "opencode",
|
|
9573
9607
|
subagent: "dreamer",
|
|
9574
9608
|
task: args.forceBroad ? "verify-broad" : "verify",
|
|
9575
9609
|
startedAt,
|
|
9576
9610
|
status: params.status,
|
|
9577
9611
|
messages: params.messages,
|
|
9612
|
+
attemptedModel: args.model,
|
|
9613
|
+
configuredModels: args.fallbackModels,
|
|
9578
9614
|
error: params.error
|
|
9579
9615
|
});
|
|
9580
9616
|
}
|
|
@@ -10450,6 +10486,25 @@ async function runRetrospectiveTask(config, ctx, helpers) {
|
|
|
10450
10486
|
let childSessionId = null;
|
|
10451
10487
|
let hiddenHandle = null;
|
|
10452
10488
|
let promptSettled = false;
|
|
10489
|
+
let invocationRecorded = false;
|
|
10490
|
+
const recordInvocation = (status, messages, error) => {
|
|
10491
|
+
if (!parent || !childSessionId || invocationRecorded)
|
|
10492
|
+
return;
|
|
10493
|
+
invocationRecorded = true;
|
|
10494
|
+
recordChildInvocation({
|
|
10495
|
+
db,
|
|
10496
|
+
parentSessionId: parent,
|
|
10497
|
+
harness: deps.hiddenCompletionExecutor?.capabilities.harness ?? "opencode",
|
|
10498
|
+
subagent: "dreamer",
|
|
10499
|
+
task: config.task,
|
|
10500
|
+
startedAt: helpers.invocationStartedAt,
|
|
10501
|
+
status,
|
|
10502
|
+
messages,
|
|
10503
|
+
attemptedModel: config.model,
|
|
10504
|
+
configuredModels: config.fallbackModels,
|
|
10505
|
+
error
|
|
10506
|
+
});
|
|
10507
|
+
};
|
|
10453
10508
|
try {
|
|
10454
10509
|
if (deps.hiddenCompletionExecutor) {
|
|
10455
10510
|
hiddenHandle = await deps.hiddenCompletionExecutor.open({
|
|
@@ -10534,18 +10589,8 @@ async function runRetrospectiveTask(config, ctx, helpers) {
|
|
|
10534
10589
|
return { ...run, output };
|
|
10535
10590
|
};
|
|
10536
10591
|
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
|
-
}
|
|
10592
|
+
if (run)
|
|
10593
|
+
recordInvocation("completed", run.output);
|
|
10549
10594
|
return completedWindow(watermark);
|
|
10550
10595
|
};
|
|
10551
10596
|
const userLines = renderGateUserLines(messages);
|
|
@@ -10638,6 +10683,7 @@ async function runRetrospectiveTask(config, ctx, helpers) {
|
|
|
10638
10683
|
log2(`[dreamer] retrospective: flagged=${flagged.length} learnings=${learnings.length} memory=${applied.memoryWritten} observations=${applied.observationsInserted} dropped=${applied.observationsDropped} rejected=${applied.rejected.length}`);
|
|
10639
10684
|
return finish(deepenRun, scan.maxScannedTs);
|
|
10640
10685
|
} catch (error) {
|
|
10686
|
+
recordInvocation(abortController.signal.aborted ? "aborted" : failedInvocationStatus(error), undefined, error);
|
|
10641
10687
|
if (!detectOverflow(error).isOverflow)
|
|
10642
10688
|
throw error;
|
|
10643
10689
|
const failures = (activeOverflow?.failures ?? 0) + 1;
|
|
@@ -10709,6 +10755,25 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
10709
10755
|
let childSessionId = null;
|
|
10710
10756
|
let promptSettled = false;
|
|
10711
10757
|
let expiredArchived = 0;
|
|
10758
|
+
let invocationRecorded = false;
|
|
10759
|
+
const recordInvocation = (status, messages, error) => {
|
|
10760
|
+
if (!parent || !childSessionId || invocationRecorded)
|
|
10761
|
+
return;
|
|
10762
|
+
invocationRecorded = true;
|
|
10763
|
+
recordChildInvocation({
|
|
10764
|
+
db,
|
|
10765
|
+
parentSessionId: parent,
|
|
10766
|
+
harness: deps.hiddenCompletionExecutor?.capabilities.harness ?? "opencode",
|
|
10767
|
+
subagent: "dreamer",
|
|
10768
|
+
task,
|
|
10769
|
+
startedAt: invocationStartedAt,
|
|
10770
|
+
status,
|
|
10771
|
+
messages,
|
|
10772
|
+
attemptedModel: config.model,
|
|
10773
|
+
configuredModels: config.fallbackModels,
|
|
10774
|
+
error
|
|
10775
|
+
});
|
|
10776
|
+
};
|
|
10712
10777
|
try {
|
|
10713
10778
|
let curateMemories;
|
|
10714
10779
|
let curateCategory;
|
|
@@ -10797,6 +10862,9 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
10797
10862
|
callContext: `dreamer:${task}`,
|
|
10798
10863
|
metadata: { tokenBudget: config.tokenBudget, onBudgetUpdate },
|
|
10799
10864
|
allowEmpty: task === "curate",
|
|
10865
|
+
onOpened: (sessionId) => {
|
|
10866
|
+
childSessionId = sessionId;
|
|
10867
|
+
},
|
|
10800
10868
|
model: config.model,
|
|
10801
10869
|
fallbackModels: config.fallbackModels,
|
|
10802
10870
|
language: task === "curate" ? config.language ?? deps.language : undefined,
|
|
@@ -10912,18 +10980,7 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
10912
10980
|
helpers.reportProgress(curateRefused, curateRefused);
|
|
10913
10981
|
log2(`[dreamer] curate safety summary: refused=${curateRefused}`);
|
|
10914
10982
|
}
|
|
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
|
-
}
|
|
10983
|
+
recordInvocation("completed", run.output);
|
|
10927
10984
|
if (task === "maintain-docs" && docsHashes && changes) {
|
|
10928
10985
|
try {
|
|
10929
10986
|
if (run.validated === "[]") {
|
|
@@ -10977,6 +11034,9 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
10977
11034
|
}
|
|
10978
11035
|
} : {}
|
|
10979
11036
|
};
|
|
11037
|
+
} catch (error) {
|
|
11038
|
+
recordInvocation(abortController.signal.aborted ? "aborted" : failedInvocationStatus(error), undefined, error);
|
|
11039
|
+
throw error;
|
|
10980
11040
|
} finally {
|
|
10981
11041
|
heartbeat.stop();
|
|
10982
11042
|
if (childSessionId)
|
|
@@ -11629,6 +11689,11 @@ async function indexSingleMessageOffThread(db, sessionId, message) {
|
|
|
11629
11689
|
return result.inserted;
|
|
11630
11690
|
}
|
|
11631
11691
|
async function sweepOrphanedOpenCodeMessageIndexesOffThread(db, openSource, options = {}) {
|
|
11692
|
+
if (getHarness2() === "opencode" || getHarness2() === "opencode2")
|
|
11693
|
+
options = {
|
|
11694
|
+
...options,
|
|
11695
|
+
fenceLockNames: options.fenceLockNames ?? takeLkgRecoveryLockSweepPage()
|
|
11696
|
+
};
|
|
11632
11697
|
if (getHarness2() === "opencode2")
|
|
11633
11698
|
openSource = () => new Database2(gaDatabasePath(getDataDir(), process.env.OPENCODE_CHANNEL ?? "latest"), {
|
|
11634
11699
|
readonly: true,
|
|
@@ -12476,7 +12541,7 @@ function loadRegistrationConfig(directory) {
|
|
|
12476
12541
|
configCache.delete(directory);
|
|
12477
12542
|
return detailed;
|
|
12478
12543
|
}
|
|
12479
|
-
async function ensureProjectRegisteredFromOpenCodeDirectory(directory, db) {
|
|
12544
|
+
async function ensureProjectRegisteredFromOpenCodeDirectory(directory, db, options = {}) {
|
|
12480
12545
|
const detailed = loadRegistrationConfig(directory);
|
|
12481
12546
|
const projectIdentity = resolveProjectIdentityForSession(directory, detailed.config.allow_home_project);
|
|
12482
12547
|
if (!projectIdentity)
|
|
@@ -12497,6 +12562,9 @@ async function ensureProjectRegisteredFromOpenCodeDirectory(directory, db) {
|
|
|
12497
12562
|
memoryEnabled: detailed.config.memory.enabled,
|
|
12498
12563
|
gitCommitEnabled: detailed.config.memory.git_commit_indexing.enabled
|
|
12499
12564
|
};
|
|
12565
|
+
if (options.preflightLocalPooling && routing.primary.provider === "local") {
|
|
12566
|
+
await preflightLocalEmbeddingPooling(routing.primary.model ?? "Xenova/all-MiniLM-L6-v2");
|
|
12567
|
+
}
|
|
12500
12568
|
const before = getProjectEmbeddingSnapshot2(projectIdentity);
|
|
12501
12569
|
const registered = registerProjectEmbedding2(db, projectIdentity, routing.primary, features, directory);
|
|
12502
12570
|
if (!before || before.providerIdentity !== registered.providerIdentity || before.runtimeFingerprint !== registered.runtimeFingerprint)
|
|
@@ -13520,6 +13588,14 @@ function getMessageRemovedInfo(properties) {
|
|
|
13520
13588
|
};
|
|
13521
13589
|
}
|
|
13522
13590
|
|
|
13591
|
+
// src/hooks/magic-context/nudge-evaluation-log.ts
|
|
13592
|
+
function logNudgeEvaluation(sessionId, phase, line) {
|
|
13593
|
+
const category = `${phase}:${line.split(":", 1)[0]}`;
|
|
13594
|
+
const state = line.split(" ").filter((field) => /^(ctx_reduce|band|dampening|verdict|reason|lease)=/.test(field)).join(" ");
|
|
13595
|
+
if (diagnosticStateChanged(sessionId, category, state))
|
|
13596
|
+
sessionLog2(sessionId, line);
|
|
13597
|
+
}
|
|
13598
|
+
|
|
13523
13599
|
// src/hooks/magic-context/command-handler.ts
|
|
13524
13600
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
13525
13601
|
|
|
@@ -13959,7 +14035,7 @@ function resolveBoundaryContextLimit(usage, fallbackContextLimit) {
|
|
|
13959
14035
|
}
|
|
13960
14036
|
return 128000;
|
|
13961
14037
|
}
|
|
13962
|
-
function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThresholdPercentage, contextLimit, inMemoryTail, taggerFloor = 0) {
|
|
14038
|
+
function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThresholdPercentage, contextLimit, inMemoryTail, taggerFloor = 0, liftLivePromptFloor = false) {
|
|
13963
14039
|
return withRawSessionMessageCache2(() => {
|
|
13964
14040
|
try {
|
|
13965
14041
|
const memoryPrimed = inMemoryTail ? primeInMemoryTailRawMessageCache2({
|
|
@@ -13989,7 +14065,8 @@ function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThr
|
|
|
13989
14065
|
executeThresholdPercentage,
|
|
13990
14066
|
usage,
|
|
13991
14067
|
usageSource: "live",
|
|
13992
|
-
taggerFloor
|
|
14068
|
+
taggerFloor,
|
|
14069
|
+
liftLivePromptFloor
|
|
13993
14070
|
});
|
|
13994
14071
|
const hasProtectedEligibleHead = boundary.offset < Math.min(boundary.protectedTailStart, boundary.eligibleEndOrdinal);
|
|
13995
14072
|
if (!hasProtectedEligibleHead) {
|
|
@@ -14025,7 +14102,10 @@ function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThr
|
|
|
14025
14102
|
function formatProjectedPostDropPercentage(value) {
|
|
14026
14103
|
return value === null ? "none" : `${value.toFixed(1)}%`;
|
|
14027
14104
|
}
|
|
14028
|
-
function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPercentage, executeThresholdPercentage, triggerBudget, keepReasoningTokens, commitClusterTrigger, preloadedActiveTags, contextLimit, inMemoryTail, taggerFloorOverride, reasoningProjection, reclaimRide, eligiblePendingDropTagIds) {
|
|
14105
|
+
function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPercentage, executeThresholdPercentage, triggerBudget, keepReasoningTokens, commitClusterTrigger, preloadedActiveTags, contextLimit, inMemoryTail, taggerFloorOverride, reasoningProjection, reclaimRide, eligiblePendingDropTagIds, primaryExecute = false) {
|
|
14106
|
+
if (usage.percentage < executeThresholdPercentage) {
|
|
14107
|
+
writeExecuteReclaimState(db, sessionId, { floorOrdinal: null, floorPromptId: null });
|
|
14108
|
+
}
|
|
14029
14109
|
if (sessionMeta.compartmentInProgress) {
|
|
14030
14110
|
sessionLog2(sessionId, `compartment trigger: skipped — historian already in progress (usage=${usage.percentage.toFixed(1)}%)`);
|
|
14031
14111
|
return { shouldFire: false };
|
|
@@ -14078,7 +14158,22 @@ function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPer
|
|
|
14078
14158
|
resolvedInMemoryTail = undefined;
|
|
14079
14159
|
}
|
|
14080
14160
|
}
|
|
14081
|
-
|
|
14161
|
+
let tailInfo = getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThresholdPercentage, contextLimit, resolvedInMemoryTail, taggerFloor);
|
|
14162
|
+
const markState = readExecuteReclaimState(db, sessionId);
|
|
14163
|
+
const mark = markState.floorOrdinal;
|
|
14164
|
+
const livePromptOrdinal = tailInfo.boundarySnapshot?.diagnostics?.livePromptFloor.ordinal;
|
|
14165
|
+
let consumedFloorMark = false;
|
|
14166
|
+
if (mark !== null) {
|
|
14167
|
+
const consumed = writeExecuteReclaimState(db, sessionId, {
|
|
14168
|
+
floorOrdinal: null,
|
|
14169
|
+
floorPromptId: null
|
|
14170
|
+
});
|
|
14171
|
+
if (consumed && mark === livePromptOrdinal && markState.floorPromptId === tailInfo.boundarySnapshot?.diagnostics?.livePromptFloor.messageId && usage.percentage >= executeThresholdPercentage) {
|
|
14172
|
+
consumedFloorMark = true;
|
|
14173
|
+
sessionLog2(sessionId, `compartment trigger: live-prompt floor mark consumed at ${mark}`);
|
|
14174
|
+
tailInfo = getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThresholdPercentage, contextLimit, resolvedInMemoryTail, taggerFloor, true);
|
|
14175
|
+
}
|
|
14176
|
+
}
|
|
14082
14177
|
if (!tailInfo.hasNewRawHistory) {
|
|
14083
14178
|
try {
|
|
14084
14179
|
const lastCompartmentEnd = getLastCompartmentEndMessage(db, sessionId);
|
|
@@ -14162,7 +14257,21 @@ function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPer
|
|
|
14162
14257
|
return { shouldFire: false };
|
|
14163
14258
|
}
|
|
14164
14259
|
if (!tailInfo.hasProtectedEligibleHead || !tailInfo.isMeaningful) {
|
|
14165
|
-
|
|
14260
|
+
let floorOnly = false;
|
|
14261
|
+
const boundary = tailInfo.boundarySnapshot;
|
|
14262
|
+
const floor = boundary?.diagnostics?.livePromptFloor;
|
|
14263
|
+
if (!consumedFloorMark && floor?.ordinal && floor.from > floor.to) {
|
|
14264
|
+
const withoutFloor = getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThresholdPercentage, contextLimit, resolvedInMemoryTail, taggerFloor, true);
|
|
14265
|
+
floorOnly = withoutFloor.hasProtectedEligibleHead && withoutFloor.isMeaningful;
|
|
14266
|
+
if (floorOnly && primaryExecute && usage.percentage >= executeThresholdPercentage && writeExecuteReclaimState(db, sessionId, {
|
|
14267
|
+
floorOrdinal: floor.ordinal,
|
|
14268
|
+
floorPromptId: floor.messageId ?? null
|
|
14269
|
+
})) {
|
|
14270
|
+
sessionLog2(sessionId, `compartment trigger: live-prompt floor mark set at ${floor.ordinal}`);
|
|
14271
|
+
}
|
|
14272
|
+
}
|
|
14273
|
+
const refusal = floorOnly ? `no eligible head (live-prompt floor at ${floor?.ordinal})` : tailInfo.hasProtectedEligibleHead ? "below meaningfulness" : "no eligible head";
|
|
14274
|
+
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
14275
|
return { shouldFire: false };
|
|
14167
14276
|
}
|
|
14168
14277
|
sessionLog2(sessionId, `compartment trigger: proactive fire at ${usage.percentage.toFixed(1)}% (floor=${proactiveTriggerPercentage}% projected post-drop=${formatProjectedPostDropPercentage(projectedPostDropPercentage)} target=${relativePostDropTarget.toFixed(1)}%)`);
|
|
@@ -15156,7 +15265,7 @@ function maybeInjectChannel1Nudge(args, sessionId, tool, output) {
|
|
|
15156
15265
|
evaluable: state.evaluable,
|
|
15157
15266
|
generationInvalidated: state.generationInvalidated
|
|
15158
15267
|
});
|
|
15159
|
-
|
|
15268
|
+
logNudgeEvaluation(sessionId, "tool-completion", formatChannel1Evaluation(decision));
|
|
15160
15269
|
setLastNudgeUndropped(args.db, sessionId, decision.nextLastNudge);
|
|
15161
15270
|
const nextNudgeState = {
|
|
15162
15271
|
...nudgeState,
|
|
@@ -15978,6 +16087,7 @@ function buildDebugMemoryUsage(runtimeHolders = {}) {
|
|
|
15978
16087
|
const lkg = getLkgSlotHeapStats();
|
|
15979
16088
|
const tagger = runtimeHolders.taggerCache ?? EMPTY_TAGGER_HEAP_STATS;
|
|
15980
16089
|
const wire = runtimeHolders.wireCache ?? EMPTY_WIRE_HEAP_STATS;
|
|
16090
|
+
const replay = runtimeHolders.generateReplay ?? { totalBytes: 0, sessions: [] };
|
|
15981
16091
|
const messageIndexQueue = getMessageIndexQueueHeapStats();
|
|
15982
16092
|
const sessions = new Map;
|
|
15983
16093
|
const session = (sessionId) => {
|
|
@@ -15991,7 +16101,8 @@ function buildDebugMemoryUsage(runtimeHolders = {}) {
|
|
|
15991
16101
|
wireRawMessages: 0,
|
|
15992
16102
|
wireMessages: 0,
|
|
15993
16103
|
wireContentSnapshots: 0,
|
|
15994
|
-
wireEstimatedBytes: 0
|
|
16104
|
+
wireEstimatedBytes: 0,
|
|
16105
|
+
generateReplayBytes: 0
|
|
15995
16106
|
};
|
|
15996
16107
|
sessions.set(sessionId, current);
|
|
15997
16108
|
}
|
|
@@ -16011,6 +16122,8 @@ function buildDebugMemoryUsage(runtimeHolders = {}) {
|
|
|
16011
16122
|
target.wireContentSnapshots += entry.rawContentSnapshots;
|
|
16012
16123
|
target.wireEstimatedBytes += entry.estimatedBytes;
|
|
16013
16124
|
}
|
|
16125
|
+
for (const entry of replay.sessions)
|
|
16126
|
+
session(entry.sessionId).generateReplayBytes += entry.bytes;
|
|
16014
16127
|
return {
|
|
16015
16128
|
pid: process.pid,
|
|
16016
16129
|
bunVersion: typeof Bun !== "undefined" && typeof Bun.version === "string" ? Bun.version : "unavailable",
|
|
@@ -16041,6 +16154,10 @@ function buildDebugMemoryUsage(runtimeHolders = {}) {
|
|
|
16041
16154
|
estimatedBytes: wire.estimatedBytes
|
|
16042
16155
|
},
|
|
16043
16156
|
compartmentMirrors: { entries: 0 },
|
|
16157
|
+
generateReplay: {
|
|
16158
|
+
sessionCount: replay.sessions.length,
|
|
16159
|
+
estimatedBytes: replay.totalBytes
|
|
16160
|
+
},
|
|
16044
16161
|
messageIndexQueue,
|
|
16045
16162
|
sessions: [...sessions.values()].sort((a, b) => a.sessionId.localeCompare(b.sessionId))
|
|
16046
16163
|
}
|
|
@@ -16257,9 +16374,9 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16257
16374
|
return { count: buildCompartmentCount(db, sessionId, moduleStatus) };
|
|
16258
16375
|
});
|
|
16259
16376
|
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-
|
|
16377
|
+
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-pqybnx09.js"));
|
|
16378
|
+
const { resolveHistorianModel } = await importPluginModule(() => import("./model-resolution-280gmqvd.js"));
|
|
16379
|
+
const { userObservationCollectionEnabled, userObservationsRequested } = await importPluginModule(() => import("./task-config-t6bpyka7.js"));
|
|
16263
16380
|
const DEFAULT_HISTORIAN_TIMEOUT_MS = 10 * 60 * 1000;
|
|
16264
16381
|
const runConfig = historianRunConfig(config, currentPluginConfigReader(directory)?.poll().effective ?? config);
|
|
16265
16382
|
const historianModel = resolveHistorianModel(runConfig, "opencode");
|
|
@@ -16290,7 +16407,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16290
16407
|
return { ok: false, error: "no session" };
|
|
16291
16408
|
const readDirectory = args.readSessionDirectory;
|
|
16292
16409
|
if (readDirectory) {
|
|
16293
|
-
const { handoffHistoryWork } = await import("./history-owner-
|
|
16410
|
+
const { handoffHistoryWork } = await import("./history-owner-36wp3mkb.js");
|
|
16294
16411
|
const handed = await handoffHistoryWork({
|
|
16295
16412
|
storageDir: args.storageDir ?? getMagicContextStorageDir(),
|
|
16296
16413
|
directory,
|
|
@@ -16309,8 +16426,8 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16309
16426
|
const db = readDatabase();
|
|
16310
16427
|
if (!db)
|
|
16311
16428
|
return { ok: false, error: "db unavailable" };
|
|
16312
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16313
|
-
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-
|
|
16429
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-61vyha9j.js"));
|
|
16430
|
+
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-0k6qzydk.js"));
|
|
16314
16431
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
16315
16432
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
16316
16433
|
return {
|
|
@@ -16368,7 +16485,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16368
16485
|
rpcServer.handle("wrapup", async (params) => {
|
|
16369
16486
|
const readDirectory = args.readSessionDirectory;
|
|
16370
16487
|
if (readDirectory && params.sessionId) {
|
|
16371
|
-
const { handoffHistoryWork } = await import("./history-owner-
|
|
16488
|
+
const { handoffHistoryWork } = await import("./history-owner-36wp3mkb.js");
|
|
16372
16489
|
const sessionId = String(params.sessionId);
|
|
16373
16490
|
const handed = await handoffHistoryWork({
|
|
16374
16491
|
storageDir: args.storageDir ?? getMagicContextStorageDir(),
|
|
@@ -16394,7 +16511,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16394
16511
|
const db = readDatabase();
|
|
16395
16512
|
if (!db)
|
|
16396
16513
|
return { ok: false, error: "db unavailable" };
|
|
16397
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16514
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-mnvt2g8m.js"));
|
|
16398
16515
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
16399
16516
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
16400
16517
|
const ctx = {
|
|
@@ -16469,6 +16586,13 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16469
16586
|
}
|
|
16470
16587
|
|
|
16471
16588
|
// src/hooks/magic-context/auto-embed-session.ts
|
|
16589
|
+
function localPoolingPreflightPending(projectIdentity) {
|
|
16590
|
+
const snapshot = getProjectEmbeddingSnapshot2(projectIdentity);
|
|
16591
|
+
if (snapshot?.provider !== "local")
|
|
16592
|
+
return false;
|
|
16593
|
+
const metadata = getCachedLocalEmbeddingPooling(snapshot.model);
|
|
16594
|
+
return !metadata || metadata.status === "unresolved";
|
|
16595
|
+
}
|
|
16472
16596
|
function embeddingIdentity(projectIdentity) {
|
|
16473
16597
|
const snapshot = getProjectEmbeddingSnapshot2(projectIdentity);
|
|
16474
16598
|
return JSON.stringify([
|
|
@@ -16489,7 +16613,8 @@ function maybeAutoEmbedSessionBackfill(deps, sessionId) {
|
|
|
16489
16613
|
invalidateAutoEmbedSession(sessionId);
|
|
16490
16614
|
autoEmbedIdentityBySession.set(sessionId, identity);
|
|
16491
16615
|
}
|
|
16492
|
-
|
|
16616
|
+
const poolingPreflightPending = localPoolingPreflightPending(deps.projectIdentity);
|
|
16617
|
+
if (embedPauseBySession.has(sessionId) || embedRunStateBySession.has(sessionId) || Date.now() < (autoEmbedRetryAfterBySession.get(sessionId) ?? 0) || autoEmbedAttemptedBySession.has(sessionId) && !poolingPreflightPending)
|
|
16493
16618
|
return;
|
|
16494
16619
|
const controller = new AbortController;
|
|
16495
16620
|
embedRunStateBySession.set(sessionId, controller);
|
|
@@ -16499,6 +16624,7 @@ function maybeAutoEmbedSessionBackfill(deps, sessionId) {
|
|
|
16499
16624
|
let started = false;
|
|
16500
16625
|
let reason = "error";
|
|
16501
16626
|
let registeredIdentity = identity;
|
|
16627
|
+
let poolingPendingAfterRegistration = poolingPreflightPending;
|
|
16502
16628
|
try {
|
|
16503
16629
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
16504
16630
|
if (controller.signal.aborted)
|
|
@@ -16506,6 +16632,7 @@ function maybeAutoEmbedSessionBackfill(deps, sessionId) {
|
|
|
16506
16632
|
await deps.ensureRegistered();
|
|
16507
16633
|
if (controller.signal.aborted)
|
|
16508
16634
|
return;
|
|
16635
|
+
poolingPendingAfterRegistration = localPoolingPreflightPending(deps.projectIdentity);
|
|
16509
16636
|
markActive();
|
|
16510
16637
|
registeredIdentity = embeddingIdentity(deps.projectIdentity);
|
|
16511
16638
|
autoEmbedIdentityBySession.set(sessionId, registeredIdentity);
|
|
@@ -16513,7 +16640,9 @@ function maybeAutoEmbedSessionBackfill(deps, sessionId) {
|
|
|
16513
16640
|
if (controller.signal.aborted || !coverage.enabled)
|
|
16514
16641
|
return;
|
|
16515
16642
|
if (coverage.embedded === coverage.total) {
|
|
16516
|
-
complete =
|
|
16643
|
+
complete = !poolingPendingAfterRegistration;
|
|
16644
|
+
if (!complete)
|
|
16645
|
+
retryDelay = 60000;
|
|
16517
16646
|
return;
|
|
16518
16647
|
}
|
|
16519
16648
|
const model = getProjectEmbeddingSnapshot2(deps.projectIdentity)?.model;
|
|
@@ -16522,8 +16651,11 @@ function maybeAutoEmbedSessionBackfill(deps, sessionId) {
|
|
|
16522
16651
|
const outcome = await embedSessionCompartmentChunks2(deps.db, deps.projectIdentity, sessionId, { signal: controller.signal, automatic: true });
|
|
16523
16652
|
reason = outcome.status;
|
|
16524
16653
|
const after = await getAutoEmbeddingSessionCoverage2(deps.db, deps.projectIdentity, sessionId);
|
|
16525
|
-
complete = after.enabled && after.embedded === after.total;
|
|
16526
|
-
if (
|
|
16654
|
+
complete = after.enabled && after.embedded === after.total && !poolingPendingAfterRegistration;
|
|
16655
|
+
if (poolingPendingAfterRegistration) {
|
|
16656
|
+
retryDelay = 60000;
|
|
16657
|
+
reason = "pooling metadata unavailable";
|
|
16658
|
+
} else if (!complete && outcome.status !== "busy" && outcome.status !== "aborted") {
|
|
16527
16659
|
retryDelay = 60000;
|
|
16528
16660
|
if (outcome.status === "nothing" || outcome.status === "done")
|
|
16529
16661
|
reason = "deferred";
|
|
@@ -16930,7 +17062,7 @@ async function maybeDeliverChannel2(sessionId, deps) {
|
|
|
16930
17062
|
return false;
|
|
16931
17063
|
}
|
|
16932
17064
|
const evaluation = evaluateChannel2(deps.baseline);
|
|
16933
|
-
|
|
17065
|
+
logNudgeEvaluation(sessionId, "delivery", formatChannel2Evaluation(evaluation, { leaseBefore: "pending", leaseAfter: "pending" }));
|
|
16934
17066
|
if (deps.directiveText === undefined && !evaluation.evaluable) {
|
|
16935
17067
|
return false;
|
|
16936
17068
|
}
|
|
@@ -23893,8 +24025,8 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
23893
24025
|
}
|
|
23894
24026
|
return "completed";
|
|
23895
24027
|
}
|
|
23896
|
-
if (!historianRunnable && args.sessionMeta.compartmentInProgress) {
|
|
23897
|
-
sessionLog2(args.sessionId, "transform: historian
|
|
24028
|
+
if ((!historianRunnable || !args.canRunCompartments && !getActiveCompartmentRun(args.sessionId)) && args.sessionMeta.compartmentInProgress) {
|
|
24029
|
+
sessionLog2(args.sessionId, "transform: historian unavailable; clearing stale compartmentInProgress flag");
|
|
23898
24030
|
updateSessionMeta(args.db, args.sessionId, { compartmentInProgress: false });
|
|
23899
24031
|
compartmentInProgress = false;
|
|
23900
24032
|
}
|
|
@@ -24154,8 +24286,10 @@ function createTransform(deps) {
|
|
|
24154
24286
|
const loadedSessions = new Set;
|
|
24155
24287
|
const prefixHoldLogTurnIds = new Map;
|
|
24156
24288
|
const thinkingFitRetries = new Set;
|
|
24289
|
+
const compactionModeTransitionPending = new Set;
|
|
24157
24290
|
const clearSessionLogState = (sessionId) => {
|
|
24158
24291
|
prefixHoldLogTurnIds.delete(sessionId);
|
|
24292
|
+
clearDiagnosticLogState(sessionId);
|
|
24159
24293
|
};
|
|
24160
24294
|
const unmanagedOverWindowSessions = new Set;
|
|
24161
24295
|
const rustModeTransform = deps.transformMode === "rust" && deps.rustModeModuleClient ? createRustModeTransform(deps, {
|
|
@@ -24296,6 +24430,7 @@ function createTransform(deps) {
|
|
|
24296
24430
|
const hasTransitionEffects = transition.recordToWrite !== null || transition.notice !== null || transition.invalidatedM0Baseline || transition.clearedCompartmentInProgress || transition.historianCatchUpSignaled;
|
|
24297
24431
|
if (hasTransitionEffects) {
|
|
24298
24432
|
if (transition.invalidatedM0Baseline) {
|
|
24433
|
+
compactionModeTransitionPending.add(sessionId);
|
|
24299
24434
|
sessionMeta = {
|
|
24300
24435
|
...sessionMeta,
|
|
24301
24436
|
cachedM0Bytes: null,
|
|
@@ -24628,6 +24763,8 @@ function createTransform(deps) {
|
|
|
24628
24763
|
contextLimit: boundaryContextLimit
|
|
24629
24764
|
});
|
|
24630
24765
|
let _boundarySnapshotCache;
|
|
24766
|
+
if (fullFeatureMode && !compactionOff)
|
|
24767
|
+
maintainExecuteFloorMark(db, sessionId, currentTurnId, boundaryUsageForProtectedTail.percentage < boundaryExecuteThreshold);
|
|
24631
24768
|
const getRunnableBoundaryForCompartment = (emergencyTailScale) => {
|
|
24632
24769
|
if (!canRunCompartments)
|
|
24633
24770
|
return null;
|
|
@@ -24753,8 +24890,9 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24753
24890
|
recordedSessionProjectIdentity.set(sessionId, sessionIdentityForBinding);
|
|
24754
24891
|
}
|
|
24755
24892
|
const taggerFloor = compactionOff ? 0 : deriveTaggerLoadFloor(messages, sessionId, db);
|
|
24756
|
-
|
|
24757
|
-
|
|
24893
|
+
const tagFloorMode = compactionOff || messages.length === 0 ? "inactive" : taggerFloor === 0 ? "fallback" : "scoped";
|
|
24894
|
+
if (diagnosticStateChanged(sessionId, "tag-floor", tagFloorMode) && tagFloorMode !== "inactive") {
|
|
24895
|
+
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
24896
|
}
|
|
24759
24897
|
const ownerRatio = sessionDecisionCalibration(db, sessionId).proseRatio;
|
|
24760
24898
|
noteTransformPassForExactOrdinalReads(sessionId);
|
|
@@ -24791,7 +24929,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24791
24929
|
idleExpiry: false,
|
|
24792
24930
|
emergency: contextUsageEarly.percentage >= forceMaterializationPercentage
|
|
24793
24931
|
}
|
|
24794
|
-
}, pendingDropEligibility.read(sessionId, dropProjectionKey()));
|
|
24932
|
+
}, pendingDropEligibility.read(sessionId, dropProjectionKey()), schedulerDecision === "execute");
|
|
24795
24933
|
if (triggerResult.shouldFire) {
|
|
24796
24934
|
sessionLog2(sessionId, `compartment trigger: firing (reason=${triggerResult.reason})`);
|
|
24797
24935
|
updateSessionMeta(db, sessionId, { compartmentInProgress: true });
|
|
@@ -25162,6 +25300,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25162
25300
|
activeThinkingPrefixHold,
|
|
25163
25301
|
directoryPrefixHold: unresolvedDirectoryHold,
|
|
25164
25302
|
forceSignedRebuildForFit: thinkingFitRetries.has(sessionId) || !!recovery.rebuildReason,
|
|
25303
|
+
compactionModeTransition: compactionModeTransitionPending.has(sessionId),
|
|
25165
25304
|
readLastServedMessages: () => {
|
|
25166
25305
|
const slot = getInMemorySlot(sessionId) ?? loadPersistedLkgSlot(db, sessionId);
|
|
25167
25306
|
try {
|
|
@@ -25219,6 +25358,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25219
25358
|
hardSignals: m0HardSignals
|
|
25220
25359
|
}
|
|
25221
25360
|
});
|
|
25361
|
+
compactionModeTransitionPending.delete(sessionId);
|
|
25222
25362
|
if (recovery.prefix && !recoveryNormalized) {
|
|
25223
25363
|
const priorIds = new Set(recovery.prefix.inputs.map((input) => input.id));
|
|
25224
25364
|
const newIds = new Set(lkgInput.flatMap((input) => input.id && !priorIds.has(input.id) ? [input.id] : []));
|
|
@@ -25396,7 +25536,8 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25396
25536
|
if (JSON.stringify([...new Set(stillUntagged)].sort()) !== JSON.stringify([...new Set(persistedUntaggedInputIds)].sort()) && !persistLkgUntaggedInputIds(db, sessionId, stillUntagged))
|
|
25397
25537
|
throw new Error("Cannot persist the last-good untagged-message record");
|
|
25398
25538
|
}
|
|
25399
|
-
|
|
25539
|
+
const signedThinkingServed = isPrefixBoundThinkingModel(modelForBudget?.providerID, modelForBudget?.modelID) && servesThinkingBlock2(messages, modelForBudget?.providerID, modelForBudget?.modelID);
|
|
25540
|
+
finishSystemDateRefresh(deps.historyRefreshSessions, dateRequest, postTransformResult.bustedThisPass && !activeThinkingPrefixHold && !signedThinkingServed || postTransformResult.thinkingReleasedForFit === true, signedThinkingServed);
|
|
25400
25541
|
if (activeThinkingPrefixHold && !postTransformResult.thinkingReleasedForFit && sessionMeta.cachedM0Bytes != null && sessionMeta.cachedM1Bytes != null) {
|
|
25401
25542
|
recordHeldHeadForRequest(sessionId, currentLkgRequestIdentity(sessionId), (ownsHistory) => deferDeliveredSystemRefresh(deps, sessionId, ownsHistory));
|
|
25402
25543
|
}
|
|
@@ -25554,7 +25695,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25554
25695
|
postReduceGraceBaselineU: channel1State.postReduceGraceBaselineU,
|
|
25555
25696
|
postReduceGracePreLevel: channel1State.postReduceGracePreLevel
|
|
25556
25697
|
});
|
|
25557
|
-
|
|
25698
|
+
logNudgeEvaluation(sessionId, "transform", formatChannel1Evaluation(channel1Decision));
|
|
25558
25699
|
const channel2Evaluation = evaluateChannel2(channelBaseline);
|
|
25559
25700
|
const leaseBefore = getChannel2NudgeState(db, sessionId);
|
|
25560
25701
|
if (channelBaseline.evaluable && !channelBaseline.generationInvalidated && !channelBaseline.reducedSinceRefresh) {
|
|
@@ -25565,7 +25706,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
25565
25706
|
}
|
|
25566
25707
|
}
|
|
25567
25708
|
const leaseAfter = getChannel2NudgeState(db, sessionId);
|
|
25568
|
-
|
|
25709
|
+
logNudgeEvaluation(sessionId, "transform", formatChannel2Evaluation(channel2Evaluation, {
|
|
25569
25710
|
leaseBefore,
|
|
25570
25711
|
leaseAfter,
|
|
25571
25712
|
gateHoldReason: channelBaseline.reducedSinceRefresh ? "recent-reduce-refresh" : undefined
|
|
@@ -25834,6 +25975,35 @@ function describeSystemPromptChange(previous, current) {
|
|
|
25834
25975
|
return `presetChanged=${previous ? previous.preset !== current.preset : "unknown"} elements=[${elements.join("; ")}]`;
|
|
25835
25976
|
}
|
|
25836
25977
|
|
|
25978
|
+
// src/hooks/magic-context/system-prompt-sticky-date.ts
|
|
25979
|
+
var STICKY_DATE_KEY = "systemPromptStickyDate";
|
|
25980
|
+
function readPersistedSystemPromptStickyDate(db, sessionId) {
|
|
25981
|
+
try {
|
|
25982
|
+
const saved = readReplayEnvelope(db, sessionId, "read")[STICKY_DATE_KEY];
|
|
25983
|
+
return typeof saved === "string" && saved.length > 0 ? saved : undefined;
|
|
25984
|
+
} catch (error) {
|
|
25985
|
+
sessionLog2(sessionId, "system prompt sticky date record unreadable:", error);
|
|
25986
|
+
return;
|
|
25987
|
+
}
|
|
25988
|
+
}
|
|
25989
|
+
function persistSystemPromptStickyDate(db, sessionId, stickyDate) {
|
|
25990
|
+
try {
|
|
25991
|
+
const written = updateReplayDocument(db, sessionId, (doc) => {
|
|
25992
|
+
if (doc[STICKY_DATE_KEY] === stickyDate)
|
|
25993
|
+
return false;
|
|
25994
|
+
doc.version = 2;
|
|
25995
|
+
doc[STICKY_DATE_KEY] = stickyDate;
|
|
25996
|
+
return true;
|
|
25997
|
+
});
|
|
25998
|
+
if (!written)
|
|
25999
|
+
sessionLog2(sessionId, "system prompt sticky date record not written");
|
|
26000
|
+
return written;
|
|
26001
|
+
} catch (error) {
|
|
26002
|
+
sessionLog2(sessionId, "system prompt sticky date record write failed:", error);
|
|
26003
|
+
return false;
|
|
26004
|
+
}
|
|
26005
|
+
}
|
|
26006
|
+
|
|
25837
26007
|
// src/hooks/magic-context/system-prompt-hash.ts
|
|
25838
26008
|
var MAGIC_CONTEXT_MARKER = "## Magic Context";
|
|
25839
26009
|
var SYSTEM_PROMPT_GUIDANCE_SEPARATOR = `
|
|
@@ -25856,6 +26026,15 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25856
26026
|
});
|
|
25857
26027
|
const guidanceEpochs = createPromptSurfaceGuidanceEpochCache(promptSurfaceRuntime);
|
|
25858
26028
|
const stickyDateBySession = new Map;
|
|
26029
|
+
const recordedStickyDateBySession = new Map;
|
|
26030
|
+
const recordedStickyDate = (sessionId) => {
|
|
26031
|
+
let recorded = recordedStickyDateBySession.get(sessionId);
|
|
26032
|
+
if (recorded === undefined) {
|
|
26033
|
+
recorded = readPersistedSystemPromptStickyDate(deps.db, sessionId) ?? null;
|
|
26034
|
+
recordedStickyDateBySession.set(sessionId, recorded);
|
|
26035
|
+
}
|
|
26036
|
+
return recorded ?? undefined;
|
|
26037
|
+
};
|
|
25859
26038
|
const diagnosticPrompts = new Map;
|
|
25860
26039
|
const processSystemPrompt = async (input, output) => {
|
|
25861
26040
|
const sessionId = input.sessionID;
|
|
@@ -25923,9 +26102,34 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25923
26102
|
return;
|
|
25924
26103
|
const previousHash = sessionMetaEarly?.systemPromptHash ?? "";
|
|
25925
26104
|
const hasPersistedHash = previousHash !== "" && previousHash !== "0";
|
|
25926
|
-
|
|
25927
|
-
|
|
25928
|
-
|
|
26105
|
+
const prefixBoundModel = isPrefixBoundThinkingModel(liveModel?.providerID, liveModel?.modelID);
|
|
26106
|
+
let stickyDate = stickyDateBySession.get(sessionId);
|
|
26107
|
+
if (!hasPersistedHash) {
|
|
26108
|
+
const previous = stickyDate ?? recordedStickyDate(sessionId);
|
|
26109
|
+
const live = systemPromptDates(liveSystemContent).live;
|
|
26110
|
+
const fieldCount = (dates) => dates === undefined ? 0 : JSON.parse(dates).length;
|
|
26111
|
+
stickyDate = (!modelKey || prefixBoundModel) && previous !== undefined && live !== undefined && fieldCount(previous) === fieldCount(live) ? previous : undefined;
|
|
26112
|
+
if (stickyDate === undefined)
|
|
26113
|
+
stickyDateBySession.delete(sessionId);
|
|
26114
|
+
else
|
|
26115
|
+
stickyDateBySession.set(sessionId, stickyDate);
|
|
26116
|
+
}
|
|
26117
|
+
if (stickyDate === undefined && hasPersistedHash) {
|
|
26118
|
+
const recorded = recordedStickyDate(sessionId);
|
|
26119
|
+
const live = systemPromptDates(liveSystemContent).live;
|
|
26120
|
+
if (recorded !== undefined && live !== undefined && recorded !== live && systemPromptFingerprint(systemPromptDates(liveSystemContent, recorded).stable, promptSurface.preset) === previousHash) {
|
|
26121
|
+
stickyDate = recorded;
|
|
26122
|
+
stickyDateBySession.set(sessionId, recorded);
|
|
26123
|
+
sessionLog2(sessionId, `system prompt date restored after restart: real=${live}, using=${recorded}`);
|
|
26124
|
+
}
|
|
26125
|
+
}
|
|
26126
|
+
const setStickyDate = (value) => {
|
|
26127
|
+
stickyDateBySession.set(sessionId, value);
|
|
26128
|
+
if (value !== recordedStickyDate(sessionId)) {
|
|
26129
|
+
if (persistSystemPromptStickyDate(deps.db, sessionId, value))
|
|
26130
|
+
recordedStickyDateBySession.set(sessionId, value);
|
|
26131
|
+
}
|
|
26132
|
+
};
|
|
25929
26133
|
const dates = systemPromptDates(liveSystemContent, stickyDate);
|
|
25930
26134
|
const currentDate = dates.live;
|
|
25931
26135
|
const stableCandidate = dates.stable;
|
|
@@ -25933,13 +26137,12 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25933
26137
|
const contentOrPresetChanged = hasPersistedHash && stableCandidateHash !== previousHash;
|
|
25934
26138
|
const rewritePermission = systemDateRefreshPermission(deps.historyRefreshSessions, dateRequest);
|
|
25935
26139
|
const signedThinkingKept = systemDateSignedThinkingKept(deps.historyRefreshSessions, dateRequest);
|
|
25936
|
-
const
|
|
25937
|
-
const prefixBoundModel = isPrefixBoundThinkingModel(liveModel?.providerID, liveModel?.modelID);
|
|
26140
|
+
const systemDateMayMove = (rewrite, keptSignedThinking) => (rewrite || idleCacheExpired) && keptSignedThinking !== true;
|
|
25938
26141
|
let deferredDateRefresh = false;
|
|
25939
26142
|
if (currentDate && stickyDate && currentDate !== stickyDate && (idleCacheExpired ? prefixBoundModel : isCacheBusting) && !contentOrPresetChanged && !requestMessagesFinal) {
|
|
25940
26143
|
const liveElements = [...output.system];
|
|
25941
26144
|
deferredDateRefresh = waitForSystemDateRefresh(deps.historyRefreshSessions, dateRequest, (permitted, keptSignedThinking) => {
|
|
25942
|
-
if (!permitted
|
|
26145
|
+
if (!systemDateMayMove(permitted, keptSignedThinking)) {
|
|
25943
26146
|
deps.systemPromptRefreshSessions.add(sessionId);
|
|
25944
26147
|
return;
|
|
25945
26148
|
}
|
|
@@ -25952,7 +26155,7 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25952
26155
|
cachedM0SystemHash: hash,
|
|
25953
26156
|
systemPromptTokens: estimateTokens(content)
|
|
25954
26157
|
});
|
|
25955
|
-
|
|
26158
|
+
setStickyDate(currentDate);
|
|
25956
26159
|
output.system.splice(0, output.system.length, ...liveElements);
|
|
25957
26160
|
publishSystemDateOutput(output.system);
|
|
25958
26161
|
deps.systemPromptRefreshSessions.delete(sessionId);
|
|
@@ -25963,12 +26166,12 @@ function createSystemPromptHashHandler(deps) {
|
|
|
25963
26166
|
}
|
|
25964
26167
|
});
|
|
25965
26168
|
}
|
|
25966
|
-
const dateMayAdvance =
|
|
26169
|
+
const dateMayAdvance = contentOrPresetChanged || !deferredDateRefresh && systemDateMayMove(isCacheBusting && (dateRequest ? rewritePermission === true : rewritePermission !== false), signedThinkingKept);
|
|
25967
26170
|
if (currentDate && !stickyDate) {
|
|
25968
|
-
|
|
26171
|
+
setStickyDate(currentDate);
|
|
25969
26172
|
} else if (currentDate && stickyDate && currentDate !== stickyDate) {
|
|
25970
26173
|
if (dateMayAdvance) {
|
|
25971
|
-
|
|
26174
|
+
setStickyDate(currentDate);
|
|
25972
26175
|
sessionLog2(sessionId, `system prompt date updated: ${stickyDate} → ${currentDate} (cache-busting pass)`);
|
|
25973
26176
|
} else {
|
|
25974
26177
|
let offset = 0;
|
|
@@ -26026,7 +26229,7 @@ function createSystemPromptHashHandler(deps) {
|
|
|
26026
26229
|
sessionLog2(sessionId, "system prompt meta persist failed (fail-open):", error);
|
|
26027
26230
|
}
|
|
26028
26231
|
}
|
|
26029
|
-
if (isCacheBusting && !deferredDateRefresh && (contentOrPresetChanged || !currentDate || currentDate === stickyDate || !dateRequest || rewritePermission === true)) {
|
|
26232
|
+
if (isCacheBusting && !deferredDateRefresh && (contentOrPresetChanged || !currentDate || currentDate === stickyDate || !dateRequest || rewritePermission === true && signedThinkingKept !== true)) {
|
|
26030
26233
|
deps.systemPromptRefreshSessions.delete(sessionId);
|
|
26031
26234
|
}
|
|
26032
26235
|
};
|
|
@@ -26041,6 +26244,7 @@ function createSystemPromptHashHandler(deps) {
|
|
|
26041
26244
|
handler,
|
|
26042
26245
|
clearSession: (sessionId) => {
|
|
26043
26246
|
diagnosticPrompts.delete(sessionId);
|
|
26247
|
+
recordedStickyDateBySession.delete(sessionId);
|
|
26044
26248
|
clearSystemDateRefresh(deps.historyRefreshSessions, sessionId);
|
|
26045
26249
|
guidanceEpochs.clear(sessionId);
|
|
26046
26250
|
clearSystemPromptHashSession(sessionId, {
|
|
@@ -26624,8 +26828,17 @@ function guardSubagentTools(tools, db, isInternalChild) {
|
|
|
26624
26828
|
function hideSubagentTools(draft, db) {
|
|
26625
26829
|
if (!getOrCreateSessionMeta(db, draft.sessionID).isSubagent)
|
|
26626
26830
|
return;
|
|
26831
|
+
removePrimaryOnlyTools(draft.tools);
|
|
26832
|
+
}
|
|
26833
|
+
function removePrimaryOnlyTools(tools) {
|
|
26627
26834
|
for (const id of PRIMARY_ONLY_TOOLS)
|
|
26628
|
-
delete
|
|
26835
|
+
delete tools[id];
|
|
26836
|
+
}
|
|
26837
|
+
function storedSubagentMode(db, sessionId) {
|
|
26838
|
+
const row = db.prepare("SELECT is_subagent FROM session_meta WHERE session_id = ?").get(sessionId);
|
|
26839
|
+
if (!row || typeof row.is_subagent !== "number")
|
|
26840
|
+
return;
|
|
26841
|
+
return row.is_subagent === 1;
|
|
26629
26842
|
}
|
|
26630
26843
|
|
|
26631
26844
|
// src/tools/ctx-expand/tools.ts
|
|
@@ -28633,7 +28846,7 @@ function createCtxReduceTool(deps) {
|
|
|
28633
28846
|
args = unwrapImitatedReducedArgs(args, ["drop"], { drop: "string" });
|
|
28634
28847
|
const sessionId = toolContext.sessionID;
|
|
28635
28848
|
if (!args.drop) {
|
|
28636
|
-
return
|
|
28849
|
+
return `Error: 'drop' must be provided as a string of tag numbers, for example {"drop": "3-5,8"}.`;
|
|
28637
28850
|
}
|
|
28638
28851
|
const rustReduce = deps.rustToolBackends?.reduce;
|
|
28639
28852
|
if (rustReduce) {
|
|
@@ -28921,6 +29134,7 @@ function createCtxSearchTool(deps) {
|
|
|
28921
29134
|
explicitSearch: true,
|
|
28922
29135
|
rerankConnectionFile: deps.rerankConnectionFile,
|
|
28923
29136
|
searchMessageHistory: (request) => searchMessageHistoryOffThread(deps.db, request),
|
|
29137
|
+
signal: toolContext.abort,
|
|
28924
29138
|
...dateRange
|
|
28925
29139
|
});
|
|
28926
29140
|
return formatSearchResults2(query, results, toolContext.sessionID, diagnostics);
|
|
@@ -29469,4 +29683,4 @@ function applyHiddenSubagentTemperature(input, output, log) {
|
|
|
29469
29683
|
output.temperature = temperature;
|
|
29470
29684
|
}
|
|
29471
29685
|
|
|
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 };
|
|
29686
|
+
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 };
|