@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
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sanitizeDiagnosticText,
|
|
3
3
|
sessionLog2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-h7tgn49j.js";
|
|
5
5
|
import {
|
|
6
6
|
getHarness2
|
|
7
7
|
} from "./index-pavzsdc6.js";
|
|
8
8
|
import {
|
|
9
9
|
isTransientSqliteError2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-1zx2pa5d.js";
|
|
11
11
|
import {
|
|
12
12
|
PROMOTABLE_CATEGORIES,
|
|
13
13
|
CATEGORY_DEFAULT_TTL
|
|
14
14
|
} from "./index-fr0wbhdn.js";
|
|
15
15
|
import {
|
|
16
16
|
managedAuthorityNoteRow
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-pnjwa6qa.js";
|
|
18
18
|
import {
|
|
19
19
|
embedTextForProject2
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-2yhtnfcf.js";
|
|
21
21
|
import {
|
|
22
22
|
saveEmbeddingIfHashMatches
|
|
23
23
|
} from "./index-4dhv7mqz.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
buildWorkspaceMemorySqlFilter2,
|
|
31
31
|
getMemoryById2,
|
|
32
32
|
updateMemorySeenCount2
|
|
33
|
-
} from "./index-
|
|
33
|
+
} from "./index-y4a3nhtk.js";
|
|
34
34
|
import {
|
|
35
35
|
computeNormalizedHash
|
|
36
36
|
} from "./index-2bvekkfy.js";
|
|
@@ -752,7 +752,7 @@ async function withAsyncPrivilegedWriter2(db, operation, options = {}) {
|
|
|
752
752
|
} catch (error) {
|
|
753
753
|
if (entered || !(error instanceof SqliteAcquisitionBusyError2))
|
|
754
754
|
throw error;
|
|
755
|
-
options.beforeRetry?.(error);
|
|
755
|
+
await options.beforeRetry?.(error);
|
|
756
756
|
const elapsed = performance.now() - started;
|
|
757
757
|
if (elapsed >= budgetMs) {
|
|
758
758
|
reportSqliteDiagnostic(`sqlite writer site=privileged_writer lane=foreground acquire_ms=${Math.round(elapsed)} attempts=${attempts} outcome=busy`);
|
|
@@ -4,54 +4,60 @@ import {
|
|
|
4
4
|
withSqliteBackgroundWriter2,
|
|
5
5
|
withoutSqliteTransformPass2,
|
|
6
6
|
isTransientSqliteError2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-1zx2pa5d.js";
|
|
8
8
|
import {
|
|
9
9
|
estimateTokens
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-b88dwwrh.js";
|
|
11
11
|
import {
|
|
12
12
|
getHarness2
|
|
13
13
|
} from "./index-pavzsdc6.js";
|
|
14
14
|
import {
|
|
15
15
|
sanitizeDiagnosticText,
|
|
16
16
|
log2
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-h7tgn49j.js";
|
|
18
18
|
import {
|
|
19
19
|
SYNAPSE_DEFAULT_MODEL,
|
|
20
20
|
isSynapseEmbeddingTruncated,
|
|
21
21
|
getSynapseBatchRequestKey,
|
|
22
22
|
SynapseEmbeddingProvider
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-adk2z5d8.js";
|
|
24
24
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
25
|
+
createWorkerShutdown
|
|
26
|
+
} from "./index-cpjk5jd2.js";
|
|
27
|
+
import {
|
|
28
|
+
DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2,
|
|
29
|
+
CHUNK_WINDOW_SAFETY_RATIO2,
|
|
30
|
+
normalizeCompartmentChunkMaxInputTokens2,
|
|
31
|
+
buildCanonicalChunkTextFromFts2,
|
|
32
|
+
buildCompartmentSummaryFallbackText2,
|
|
33
|
+
chunkCanonicalText2,
|
|
34
|
+
chunkEmbeddingWindowsAreCurrent2,
|
|
35
|
+
replaceCompartmentChunkEmbeddings2,
|
|
36
|
+
loadUnembeddedShadowChunkCandidates2,
|
|
37
|
+
loadUnembeddedCompartmentChunkCandidatesPolite2,
|
|
38
|
+
recordChunkEmbedBackoff2,
|
|
39
|
+
chunkWindowSourceKey2,
|
|
40
|
+
loadUnembeddedSessionChunkCandidatesPolite2,
|
|
41
|
+
countSessionCompartmentEmbedCoverage2,
|
|
42
|
+
countSessionCompartmentEmbedCoveragePolite2,
|
|
43
|
+
countUnembeddedSessionCompartmentsPolite2
|
|
44
|
+
} from "./index-153r2q6z.js";
|
|
42
45
|
import {
|
|
43
46
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
44
47
|
} from "./index-wgypt3cs.js";
|
|
45
48
|
import {
|
|
46
49
|
embeddingModelsMatch,
|
|
47
50
|
resolveEmbeddingTextPrefixes,
|
|
51
|
+
getCachedLocalEmbeddingPooling,
|
|
52
|
+
logLocalEmbeddingPoolingDecisionOnce,
|
|
53
|
+
logLocalEmbeddingPoolingUnavailableOnce,
|
|
48
54
|
getEmbeddingProviderIdentity,
|
|
49
55
|
dominantEmbeddingFailure,
|
|
50
56
|
LocalEmbeddingProvider
|
|
51
|
-
} from "./index-
|
|
57
|
+
} from "./index-0wthn7fp.js";
|
|
52
58
|
import {
|
|
53
59
|
setBootQuietPeriodForTests
|
|
54
|
-
} from "./index-
|
|
60
|
+
} from "./index-vkc1ca9p.js";
|
|
55
61
|
import {
|
|
56
62
|
isEmbeddingHostBusy2
|
|
57
63
|
} from "./index-qt1qqasc.js";
|
|
@@ -62,7 +68,7 @@ import {
|
|
|
62
68
|
acquireGitSweepLease,
|
|
63
69
|
renewGitSweepLease,
|
|
64
70
|
releaseGitSweepLease
|
|
65
|
-
} from "./index-
|
|
71
|
+
} from "./index-c4b76d4t.js";
|
|
66
72
|
import {
|
|
67
73
|
saveEmbeddingIfHashMatches,
|
|
68
74
|
getMemoryEmbedCoverage,
|
|
@@ -70,7 +76,7 @@ import {
|
|
|
70
76
|
} from "./index-4dhv7mqz.js";
|
|
71
77
|
import {
|
|
72
78
|
logSlowWriteTransaction
|
|
73
|
-
} from "./index-
|
|
79
|
+
} from "./index-t5pck3ss.js";
|
|
74
80
|
|
|
75
81
|
// src/hooks/magic-context/embed-session-state.ts
|
|
76
82
|
var embedPauseBySession = new Set;
|
|
@@ -262,7 +268,7 @@ function responseSlots(items, inputCount) {
|
|
|
262
268
|
return slots;
|
|
263
269
|
}
|
|
264
270
|
function capEmbeddingInput(input, maxInputTokens, purpose) {
|
|
265
|
-
const ratio = purpose === "query" ?
|
|
271
|
+
const ratio = purpose === "query" ? CHUNK_WINDOW_SAFETY_RATIO2 : 1;
|
|
266
272
|
const budget = Math.max(1, Math.floor(maxInputTokens * ratio));
|
|
267
273
|
if (estimateTokens(input) <= budget)
|
|
268
274
|
return input;
|
|
@@ -372,12 +378,12 @@ class OpenAICompatibleEmbeddingProvider {
|
|
|
372
378
|
this.truncate = options.truncate?.trim() ?? "";
|
|
373
379
|
this.rateLimitKey = rateLimitStateKey(this.endpoint, this.apiKey);
|
|
374
380
|
const maxInputTokensSet = typeof options.maxInputTokens === "number" && Number.isFinite(options.maxInputTokens);
|
|
375
|
-
this.maxInputTokens = maxInputTokensSet ? Math.max(1, Math.floor(options.maxInputTokens)) :
|
|
381
|
+
this.maxInputTokens = maxInputTokensSet ? Math.max(1, Math.floor(options.maxInputTokens)) : DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2;
|
|
376
382
|
if (!maxInputTokensSet && this.endpoint && this.model) {
|
|
377
383
|
const warningKey = `${this.endpoint}\x00${this.model}`;
|
|
378
384
|
if (!maxInputTokensWarnings.has(warningKey)) {
|
|
379
385
|
maxInputTokensWarnings.add(warningKey);
|
|
380
|
-
log2(`[magic-context] embedding.max_input_tokens is not set for openai-compatible model "${sanitizeDiagnosticText(this.model)}"; chunk embeddings use the ${
|
|
386
|
+
log2(`[magic-context] embedding.max_input_tokens is not set for openai-compatible model "${sanitizeDiagnosticText(this.model)}"; chunk embeddings use the ${DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2}-token default, which is sized for the bundled local model and splits history into small pieces. Set embedding.max_input_tokens to the model's input limit (changing it re-embeds stored chunks once).`);
|
|
381
387
|
}
|
|
382
388
|
}
|
|
383
389
|
this.modelId = getEmbeddingProviderIdentity({
|
|
@@ -721,6 +727,7 @@ function createChunkEmbeddingWriter(db) {
|
|
|
721
727
|
const entry = new URL(import.meta.url.endsWith(".ts") ? "./chunk-embedding-write-worker.ts" : "./chunk-embedding-write-worker.js", import.meta.url);
|
|
722
728
|
const timeout = db.prepare("PRAGMA busy_timeout").get().timeout;
|
|
723
729
|
const worker = inRootAsyncContext2(() => new Worker(entry, { workerData: { path, harness: getHarness2(), timeout } }));
|
|
730
|
+
const shutdown = createWorkerShutdown(worker, "chunk-embedding-writer", timeout + 2000);
|
|
724
731
|
let pending;
|
|
725
732
|
let failure;
|
|
726
733
|
let deadline;
|
|
@@ -751,7 +758,7 @@ function createChunkEmbeddingWriter(db) {
|
|
|
751
758
|
pending = { resolve, reject };
|
|
752
759
|
deadline = inRootAsyncContext2(() => setTimeout(() => {
|
|
753
760
|
fail(new Error("chunk embedding database operation timed out; coverage will be rechecked"));
|
|
754
|
-
|
|
761
|
+
shutdown.close();
|
|
755
762
|
}, 30000));
|
|
756
763
|
deadline.unref();
|
|
757
764
|
worker.postMessage(message);
|
|
@@ -783,7 +790,7 @@ function createChunkEmbeddingWriter(db) {
|
|
|
783
790
|
release: (project, holder) => request({ kind: "release", project, holder }),
|
|
784
791
|
async close() {
|
|
785
792
|
clearTimeout(deadline);
|
|
786
|
-
await
|
|
793
|
+
await shutdown.close();
|
|
787
794
|
}
|
|
788
795
|
};
|
|
789
796
|
}
|
|
@@ -1229,7 +1236,7 @@ function resolveEmbeddingConfig(config) {
|
|
|
1229
1236
|
model: config?.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL,
|
|
1230
1237
|
local_runtime: config?.local_runtime ?? "auto",
|
|
1231
1238
|
...config?.max_input_tokens ? {
|
|
1232
|
-
max_input_tokens:
|
|
1239
|
+
max_input_tokens: normalizeCompartmentChunkMaxInputTokens2(config.max_input_tokens)
|
|
1233
1240
|
} : {},
|
|
1234
1241
|
...config?.local_dtype ? { local_dtype: config.local_dtype } : {}
|
|
1235
1242
|
};
|
|
@@ -1250,7 +1257,7 @@ function resolveEmbeddingConfig(config) {
|
|
|
1250
1257
|
...config.document_prefix !== undefined ? { document_prefix: config.document_prefix } : {},
|
|
1251
1258
|
...truncate ? { truncate } : {},
|
|
1252
1259
|
...config.max_input_tokens ? {
|
|
1253
|
-
max_input_tokens:
|
|
1260
|
+
max_input_tokens: normalizeCompartmentChunkMaxInputTokens2(config.max_input_tokens)
|
|
1254
1261
|
} : {}
|
|
1255
1262
|
};
|
|
1256
1263
|
}
|
|
@@ -1263,7 +1270,7 @@ function resolveEmbeddingConfig(config) {
|
|
|
1263
1270
|
return {
|
|
1264
1271
|
provider: "synapse",
|
|
1265
1272
|
model: synapse.model?.trim() || "gte-modernbert-base-f16",
|
|
1266
|
-
max_input_tokens:
|
|
1273
|
+
max_input_tokens: normalizeCompartmentChunkMaxInputTokens2(descriptor?.max_tokens ?? synapse.max_input_tokens),
|
|
1267
1274
|
...synapse.synapse_connection_file ? { synapse_connection_file: synapse.synapse_connection_file } : {},
|
|
1268
1275
|
...synapse.synapse_fingerprint ? { synapse_fingerprint: synapse.synapse_fingerprint } : {},
|
|
1269
1276
|
...typeof synapse.synapse_table_epoch === "number" ? { synapse_table_epoch: synapse.synapse_table_epoch } : {},
|
|
@@ -1351,7 +1358,7 @@ function getChunkEmbeddingModelId(config, providerIdentity) {
|
|
|
1351
1358
|
const chunkIdentity = {
|
|
1352
1359
|
providerIdentity,
|
|
1353
1360
|
chunkerVersion: 2,
|
|
1354
|
-
maxInputTokens:
|
|
1361
|
+
maxInputTokens: normalizeCompartmentChunkMaxInputTokens2("max_input_tokens" in config ? config.max_input_tokens : undefined),
|
|
1355
1362
|
truncate: config.provider === "openai-compatible" ? config.truncate ?? "" : ""
|
|
1356
1363
|
};
|
|
1357
1364
|
return `${providerIdentity}:chunk:${sha256Prefix(stableStringify(chunkIdentity))}`;
|
|
@@ -1677,6 +1684,17 @@ async function drainStaleEmbeddingIdentitiesForProject2(db, projectIdentity, bud
|
|
|
1677
1684
|
}
|
|
1678
1685
|
function registerProjectEmbedding2(db, projectIdentity, config, features, sourceDirectory) {
|
|
1679
1686
|
const resolvedConfig = resolveEmbeddingConfig(config);
|
|
1687
|
+
if (resolvedConfig.provider === "local") {
|
|
1688
|
+
const pooling = getCachedLocalEmbeddingPooling(resolvedConfig.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL);
|
|
1689
|
+
if (pooling?.status === "unresolved" || !pooling) {
|
|
1690
|
+
logLocalEmbeddingPoolingUnavailableOnce(resolvedConfig.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL, pooling?.reason ?? "pooling metadata has not been resolved by the background embedding bootstrap", log2);
|
|
1691
|
+
} else {
|
|
1692
|
+
logLocalEmbeddingPoolingDecisionOnce(resolvedConfig.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL, pooling, log2);
|
|
1693
|
+
}
|
|
1694
|
+
if (pooling?.status === "unsupported") {
|
|
1695
|
+
return registerProjectInObservationMode2(db, projectIdentity, sourceDirectory, resolvedConfig, pooling ? `local model pooling is unsupported: ${pooling.reason}` : "local model pooling metadata has not been resolved");
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1680
1698
|
const providerIdentity = getEmbeddingProviderIdentity(resolvedConfig);
|
|
1681
1699
|
const runtimeFingerprint = getRuntimeFingerprint(resolvedConfig);
|
|
1682
1700
|
const chunkModelId = getChunkEmbeddingModelId(resolvedConfig, providerIdentity);
|
|
@@ -1872,7 +1890,7 @@ function shadowBackfillMissingBase(scope, primaryModelId, shadowModelId, project
|
|
|
1872
1890
|
}
|
|
1873
1891
|
function shadowBackfillMissingIds(db, projectIdentity, scope, primaryModelId, shadowModelId, limit, shadowMaxInputTokens) {
|
|
1874
1892
|
if (scope === "chunk") {
|
|
1875
|
-
return
|
|
1893
|
+
return loadUnembeddedShadowChunkCandidates2(db, projectIdentity, primaryModelId, shadowModelId, limit, shadowMaxInputTokens).map((candidate) => String(candidate.id));
|
|
1876
1894
|
}
|
|
1877
1895
|
const { sql, params, orderBy } = shadowBackfillMissingBase(scope, primaryModelId, shadowModelId, projectIdentity);
|
|
1878
1896
|
const rows = db.prepare(`${sql}${orderBy} LIMIT ?`).all(...params, limit);
|
|
@@ -1880,7 +1898,7 @@ function shadowBackfillMissingIds(db, projectIdentity, scope, primaryModelId, sh
|
|
|
1880
1898
|
}
|
|
1881
1899
|
function countShadowBackfillMissing(db, projectIdentity, scope, primaryModelId, shadowModelId, shadowMaxInputTokens) {
|
|
1882
1900
|
if (scope === "chunk") {
|
|
1883
|
-
return
|
|
1901
|
+
return loadUnembeddedShadowChunkCandidates2(db, projectIdentity, primaryModelId, shadowModelId, Number.MAX_SAFE_INTEGER, shadowMaxInputTokens).length;
|
|
1884
1902
|
}
|
|
1885
1903
|
const { sql, params } = shadowBackfillMissingBase(scope, primaryModelId, shadowModelId, projectIdentity);
|
|
1886
1904
|
return db.prepare(`SELECT COUNT(*) AS count FROM (${sql})`).get(...params).count;
|
|
@@ -1889,7 +1907,7 @@ function shadowModelIdForScope(registration, scope) {
|
|
|
1889
1907
|
return scope === "chunk" ? registration.chunkModelId : registration.modelId;
|
|
1890
1908
|
}
|
|
1891
1909
|
function shadowMaxInputTokensFor(registration) {
|
|
1892
|
-
return
|
|
1910
|
+
return normalizeCompartmentChunkMaxInputTokens2("max_input_tokens" in registration.config ? registration.config.max_input_tokens : undefined);
|
|
1893
1911
|
}
|
|
1894
1912
|
function shadowBackfillCohortFingerprint(db, projectIdentity, scope, primaryModelId) {
|
|
1895
1913
|
if (scope === "memory") {
|
|
@@ -2227,14 +2245,14 @@ async function processShadowQueueItem(item) {
|
|
|
2227
2245
|
let ftsMappingIncomplete = false;
|
|
2228
2246
|
let emptyCanonicalText = false;
|
|
2229
2247
|
for (const candidate of candidates) {
|
|
2230
|
-
const mappedText =
|
|
2248
|
+
const mappedText = buildCanonicalChunkTextFromFts2(db, candidate.session_id, candidate.start_message, candidate.end_message);
|
|
2231
2249
|
if (mappedText === null) {
|
|
2232
2250
|
ftsMappingIncomplete = true;
|
|
2233
2251
|
} else {
|
|
2234
|
-
const text = mappedText ||
|
|
2252
|
+
const text = mappedText || buildCompartmentSummaryFallbackText2(db, candidate.id);
|
|
2235
2253
|
const shadowMaxInputTokens = shadowMaxInputTokensFor(registration);
|
|
2236
|
-
const windows =
|
|
2237
|
-
const windowSourceKey =
|
|
2254
|
+
const windows = chunkCanonicalText2(text, candidate.start_message, candidate.end_message, shadowMaxInputTokens);
|
|
2255
|
+
const windowSourceKey = chunkWindowSourceKey2(text, candidate.start_message, candidate.end_message, shadowMaxInputTokens);
|
|
2238
2256
|
if (windows.length > 0)
|
|
2239
2257
|
prepared.push({ candidate, windows, windowSourceKey });
|
|
2240
2258
|
else
|
|
@@ -2275,7 +2293,7 @@ async function processShadowQueueItem(item) {
|
|
|
2275
2293
|
] : [];
|
|
2276
2294
|
});
|
|
2277
2295
|
if (rows.length === item.windows.length) {
|
|
2278
|
-
|
|
2296
|
+
replaceCompartmentChunkEmbeddings2(db, rows, item.windowSourceKey);
|
|
2279
2297
|
writes += 1;
|
|
2280
2298
|
} else {
|
|
2281
2299
|
partialVectorSet = true;
|
|
@@ -2410,7 +2428,7 @@ function getProjectChunkEmbeddingModelId2(projectIdentity) {
|
|
|
2410
2428
|
function getProjectEmbeddingMaxInputTokens2(projectIdentity) {
|
|
2411
2429
|
const registration = projectRegistrations.get(projectIdentity);
|
|
2412
2430
|
const configMax = registration?.config && "max_input_tokens" in registration.config ? registration.config.max_input_tokens : undefined;
|
|
2413
|
-
return
|
|
2431
|
+
return normalizeCompartmentChunkMaxInputTokens2(registration?.provider?.maxInputTokens ?? configMax);
|
|
2414
2432
|
}
|
|
2415
2433
|
function getOrCreateProjectProvider(registration) {
|
|
2416
2434
|
if (registration.providerIdentity === OFF_PROVIDER_IDENTITY || registration.observationMode) {
|
|
@@ -2668,7 +2686,7 @@ async function embedCompartmentChunkBatch(db, projectIdentity, batchSize, signal
|
|
|
2668
2686
|
const priorModels = db.prepare(`SELECT COUNT(*) AS total,
|
|
2669
2687
|
COALESCE(MAX(model_id = ?), 0) AS current
|
|
2670
2688
|
FROM compartment_chunk_embeddings WHERE compartment_id = ?`);
|
|
2671
|
-
const candidates = await
|
|
2689
|
+
const candidates = await loadUnembeddedCompartmentChunkCandidatesPolite2(db, projectIdentity, snapshot.chunkModelId, batchSize, getProjectEmbeddingMaxInputTokens2(projectIdentity), true, (candidate) => {
|
|
2672
2690
|
const activity = activeEmbeddingSessions.get(candidate.sessionId);
|
|
2673
2691
|
if (activity?.project === projectIdentity && activity.model === snapshot.chunkModelId && !embedPauseBySession.has(candidate.sessionId))
|
|
2674
2692
|
return true;
|
|
@@ -2694,27 +2712,27 @@ async function embedCandidateChunkBatch(db, projectIdentity, modelId, candidates
|
|
|
2694
2712
|
const prepared = [];
|
|
2695
2713
|
for (const candidate of candidates) {
|
|
2696
2714
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
2697
|
-
const mappedText =
|
|
2715
|
+
const mappedText = buildCanonicalChunkTextFromFts2(db, candidate.sessionId, candidate.startMessage, candidate.endMessage);
|
|
2698
2716
|
if (mappedText === null)
|
|
2699
2717
|
continue;
|
|
2700
|
-
const canonicalText = mappedText ||
|
|
2718
|
+
const canonicalText = mappedText || buildCompartmentSummaryFallbackText2(db, candidate.id);
|
|
2701
2719
|
if (canonicalText.length === 0) {
|
|
2702
2720
|
if (writer)
|
|
2703
2721
|
await writer.backoff(candidate, projectIdentity, modelId);
|
|
2704
2722
|
else
|
|
2705
|
-
|
|
2723
|
+
recordChunkEmbedBackoff2(db, candidate, projectIdentity, modelId);
|
|
2706
2724
|
noWork.push(candidate.id);
|
|
2707
2725
|
continue;
|
|
2708
2726
|
}
|
|
2709
|
-
const windows =
|
|
2710
|
-
if (windows.length === 0 ||
|
|
2727
|
+
const windows = chunkCanonicalText2(canonicalText, candidate.startMessage, candidate.endMessage, maxInputTokens);
|
|
2728
|
+
if (windows.length === 0 || chunkEmbeddingWindowsAreCurrent2(db, candidate.id, modelId, windows, projectIdentity)) {
|
|
2711
2729
|
noWork.push(candidate.id);
|
|
2712
2730
|
continue;
|
|
2713
2731
|
}
|
|
2714
2732
|
prepared.push({
|
|
2715
2733
|
candidate,
|
|
2716
2734
|
windows,
|
|
2717
|
-
windowSourceKey:
|
|
2735
|
+
windowSourceKey: chunkWindowSourceKey2(canonicalText, candidate.startMessage, candidate.endMessage, maxInputTokens)
|
|
2718
2736
|
});
|
|
2719
2737
|
}
|
|
2720
2738
|
if (prepared.length === 0)
|
|
@@ -2778,7 +2796,7 @@ async function embedCandidateChunkBatch(db, projectIdentity, modelId, candidates
|
|
|
2778
2796
|
if (writer)
|
|
2779
2797
|
await writer.replace(rows, item.windowSourceKey);
|
|
2780
2798
|
else
|
|
2781
|
-
|
|
2799
|
+
replaceCompartmentChunkEmbeddings2(db, rows, item.windowSourceKey);
|
|
2782
2800
|
persistedIds.add(item.candidate.id);
|
|
2783
2801
|
enqueueShadowEmbeddingItems2(projectIdentity, "chunk", [
|
|
2784
2802
|
String(item.candidate.id)
|
|
@@ -2806,7 +2824,7 @@ async function embedCandidateChunkBatch(db, projectIdentity, modelId, candidates
|
|
|
2806
2824
|
if (writer)
|
|
2807
2825
|
await writer.backoff(item.candidate, projectIdentity, modelId);
|
|
2808
2826
|
else
|
|
2809
|
-
|
|
2827
|
+
recordChunkEmbedBackoff2(db, item.candidate, projectIdentity, modelId);
|
|
2810
2828
|
failed.push(item.candidate.id);
|
|
2811
2829
|
}
|
|
2812
2830
|
}
|
|
@@ -2880,7 +2898,7 @@ async function embedSessionCompartmentChunks2(db, projectIdentity, sessionId, op
|
|
|
2880
2898
|
else
|
|
2881
2899
|
recordSessionProjectIdentity(db, sessionId, projectIdentity);
|
|
2882
2900
|
const maxInputTokens = getProjectEmbeddingMaxInputTokens2(projectIdentity);
|
|
2883
|
-
const total = writer ? await writer.count(projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens) : await
|
|
2901
|
+
const total = writer ? await writer.count(projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens) : await countUnembeddedSessionCompartmentsPolite2(db, projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens);
|
|
2884
2902
|
const holderId = `session-embed-${randomUUID()}`;
|
|
2885
2903
|
const lease = writer ? await writer.acquire(projectIdentity, holderId) : acquireGitSweepLease(db, projectIdentity, holderId, { ignoreCooldown: true });
|
|
2886
2904
|
if (!lease.acquired)
|
|
@@ -2923,7 +2941,7 @@ async function embedSessionCompartmentChunks2(db, projectIdentity, sessionId, op
|
|
|
2923
2941
|
break;
|
|
2924
2942
|
}
|
|
2925
2943
|
}
|
|
2926
|
-
const candidates = writer ? await writer.candidates(projectIdentity, sessionId, snapshot.chunkModelId, batchSize, [...skipIds, ...failedIds], maxInputTokens) : await
|
|
2944
|
+
const candidates = writer ? await writer.candidates(projectIdentity, sessionId, snapshot.chunkModelId, batchSize, [...skipIds, ...failedIds], maxInputTokens) : await loadUnembeddedSessionChunkCandidatesPolite2(db, projectIdentity, sessionId, snapshot.chunkModelId, batchSize, [...skipIds, ...failedIds], maxInputTokens, true);
|
|
2927
2945
|
if (candidates.length === 0)
|
|
2928
2946
|
break;
|
|
2929
2947
|
const {
|
|
@@ -2973,7 +2991,7 @@ async function embedSessionCompartmentChunks2(db, projectIdentity, sessionId, op
|
|
|
2973
2991
|
if (aborted)
|
|
2974
2992
|
return { status: "aborted", embedded, total, failed: failedIds.length };
|
|
2975
2993
|
if (providerDown || failedIds.length > 0) {
|
|
2976
|
-
const remaining = Math.max(failedIds.length, (writer ? await writer.count(projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens) : await
|
|
2994
|
+
const remaining = Math.max(failedIds.length, (writer ? await writer.count(projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens) : await countUnembeddedSessionCompartmentsPolite2(db, projectIdentity, sessionId, snapshot.chunkModelId, maxInputTokens)) - skipIds.length);
|
|
2977
2995
|
if (remaining > 0) {
|
|
2978
2996
|
return {
|
|
2979
2997
|
status: "stalled",
|
|
@@ -3001,7 +3019,7 @@ function getEmbeddingCoverageStatus2(db, projectIdentity, sessionId) {
|
|
|
3001
3019
|
shadowBackfillStalls: listShadowBackfillStalls2(db, projectIdentity)
|
|
3002
3020
|
};
|
|
3003
3021
|
}
|
|
3004
|
-
const session =
|
|
3022
|
+
const session = countSessionCompartmentEmbedCoverage2(db, projectIdentity, sessionId, snapshot.chunkModelId, getProjectEmbeddingMaxInputTokens2(projectIdentity));
|
|
3005
3023
|
const memories = snapshot.enabled ? getMemoryEmbedCoverage(db, projectIdentity, snapshot.modelId) : { embedded: 0, total: 0, memoryEnabled: false };
|
|
3006
3024
|
const gitEnabled = snapshot.gitCommitEnabled;
|
|
3007
3025
|
const commits = gitEnabled ? {
|
|
@@ -3025,7 +3043,7 @@ async function getAutoEmbeddingSessionCoverage2(db, projectIdentity, sessionId)
|
|
|
3025
3043
|
if (!snapshot?.historyEnabled || snapshot.chunkModelId === "off") {
|
|
3026
3044
|
return { enabled: false, embedded: 0, total: 0 };
|
|
3027
3045
|
}
|
|
3028
|
-
const coverage = await
|
|
3046
|
+
const coverage = await countSessionCompartmentEmbedCoveragePolite2(db, projectIdentity, sessionId, snapshot.chunkModelId, getProjectEmbeddingMaxInputTokens2(projectIdentity));
|
|
3029
3047
|
return { enabled: true, ...coverage };
|
|
3030
3048
|
}
|
|
3031
3049
|
async function sweepAllRegisteredProjects2(db, batchSize = 10) {
|
|
@@ -4,23 +4,23 @@ import {
|
|
|
4
4
|
} from "./index-1zx87sdm.js";
|
|
5
5
|
import {
|
|
6
6
|
estimateTokens
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-b88dwwrh.js";
|
|
8
8
|
import {
|
|
9
9
|
getHarness2
|
|
10
10
|
} from "./index-pavzsdc6.js";
|
|
11
11
|
import {
|
|
12
12
|
sessionLog2
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-h7tgn49j.js";
|
|
14
14
|
import {
|
|
15
15
|
getTagIdentityWriteGeneration2,
|
|
16
16
|
getSqliteDatabasePath2
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-1zx2pa5d.js";
|
|
18
18
|
import {
|
|
19
19
|
tagIdentityRevisionKey,
|
|
20
20
|
tagOrderConstraintIndex,
|
|
21
21
|
stableStringify,
|
|
22
22
|
stableStringifyHash
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-x9k3mqrf.js";
|
|
24
24
|
import {
|
|
25
25
|
DEFAULT_PROTECTED_TOOLS,
|
|
26
26
|
normalizeProtectedToolName,
|
|
@@ -3,12 +3,15 @@ import {
|
|
|
3
3
|
} from "./index-v0p37hm2.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-h7tgn49j.js";
|
|
7
7
|
import {
|
|
8
8
|
inRootAsyncContext2,
|
|
9
9
|
getSqliteDatabasePath2,
|
|
10
10
|
releaseIndexOwner2
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-1zx2pa5d.js";
|
|
12
|
+
import {
|
|
13
|
+
createWorkerShutdown
|
|
14
|
+
} from "./index-cpjk5jd2.js";
|
|
12
15
|
|
|
13
16
|
// src/hooks/magic-context/raw-ordinal-warmup.ts
|
|
14
17
|
import { Worker } from "node:worker_threads";
|
|
@@ -1127,6 +1130,7 @@ function readRawSessionBoundaryEndpointsFromDb2(db, sessionId, ids, blockIds = [
|
|
|
1127
1130
|
// src/hooks/magic-context/raw-ordinal-warmup.ts
|
|
1128
1131
|
var ACCEPT_TIMEOUT_MS = 2000;
|
|
1129
1132
|
var RESULT_TIMEOUT_MS = 10 * 60000;
|
|
1133
|
+
var WARMUP_CLOSE_DEADLINE_MS = 2000;
|
|
1130
1134
|
var FAILURE_BACKOFF_MS = 5 * 60000;
|
|
1131
1135
|
var inFlight = new Map;
|
|
1132
1136
|
var connectionIds = new WeakMap;
|
|
@@ -1155,6 +1159,7 @@ function runSessionWarmupWorker(input, options) {
|
|
|
1155
1159
|
return new Promise((resolve) => {
|
|
1156
1160
|
const openCancellation = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
|
1157
1161
|
let worker;
|
|
1162
|
+
let shutdown;
|
|
1158
1163
|
let deadline;
|
|
1159
1164
|
let settled = false;
|
|
1160
1165
|
const finish = (result) => {
|
|
@@ -1166,7 +1171,7 @@ function runSessionWarmupWorker(input, options) {
|
|
|
1166
1171
|
options.signal?.removeEventListener("abort", abort);
|
|
1167
1172
|
if (worker) {
|
|
1168
1173
|
activeWorkers.delete(worker);
|
|
1169
|
-
const stopped = worker.terminate();
|
|
1174
|
+
const stopped = shutdown?.close() ?? worker.terminate();
|
|
1170
1175
|
worker.unref();
|
|
1171
1176
|
stopped.finally(() => {
|
|
1172
1177
|
releaseIndexOwner2(input);
|
|
@@ -1192,6 +1197,7 @@ function runSessionWarmupWorker(input, options) {
|
|
|
1192
1197
|
worker = inRootAsyncContext2(() => new Worker(options.entry ?? defaultEntry(), {
|
|
1193
1198
|
workerData: { ...input, openCancellation: openCancellation.buffer }
|
|
1194
1199
|
}));
|
|
1200
|
+
shutdown = createWorkerShutdown(worker, "raw-ordinal-warmup", WARMUP_CLOSE_DEADLINE_MS);
|
|
1195
1201
|
} catch (error) {
|
|
1196
1202
|
finish({ failure: "start-failed", detail: String(error) });
|
|
1197
1203
|
return;
|