@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
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type { MessagePort, Worker } from "node:worker_threads";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Stopping a worker thread that still has a SQLite connection open.
|
|
5
|
+
*
|
|
6
|
+
* On Bun 1.4.4, `worker.terminate()` closes the worker's open `bun:sqlite`
|
|
7
|
+
* connections while it tears the thread down, and for that whole teardown
|
|
8
|
+
* (measured from a few ms up to about 460 ms) every other connection to the same
|
|
9
|
+
* file gets SQLITE_BUSY when it asks for the writer lock. Reads keep working. A
|
|
10
|
+
* caller that terminates a worker and then writes at once, such as
|
|
11
|
+
* `clearSession()` cancelling a session's auto-search backfill, then fails its
|
|
12
|
+
* own write. Bun 1.4.3 and earlier did not do this, and a worker that closes
|
|
13
|
+
* its connection itself never causes it on any version.
|
|
14
|
+
*
|
|
15
|
+
* So an owner asks the worker to stop: it posts {@link WORKER_CLOSE_MESSAGE},
|
|
16
|
+
* the worker closes its connections and exits (see {@link exitOnWorkerClose}),
|
|
17
|
+
* and `terminate()` runs only if the worker has not exited by a deadline. The
|
|
18
|
+
* deadline is chosen per worker from the longest synchronous SQLite work it may
|
|
19
|
+
* be in the middle of, because a worker handles the message only between
|
|
20
|
+
* statements. Bun 1.3 queues parent messages until a worker's entry module has
|
|
21
|
+
* finished evaluating, so a close posted while the worker is still loading is
|
|
22
|
+
* handled as soon as it has loaded.
|
|
23
|
+
*/
|
|
24
|
+
export const WORKER_CLOSE_MESSAGE = { kind: "close" } as const;
|
|
25
|
+
|
|
26
|
+
export function isWorkerCloseMessage(message: unknown): boolean {
|
|
27
|
+
return (
|
|
28
|
+
typeof message === "object" &&
|
|
29
|
+
message !== null &&
|
|
30
|
+
(message as { kind?: unknown }).kind === WORKER_CLOSE_MESSAGE.kind
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Worker side: when the owner asks this worker to stop, close its connections
|
|
36
|
+
* and end the thread. `process.exit()` in a worker thread ends only that
|
|
37
|
+
* thread, on Node and on Bun. Other `message` listeners in the worker see the
|
|
38
|
+
* same message and must ignore its kind.
|
|
39
|
+
*
|
|
40
|
+
* On Bun 1.3.14 a worker whose parent port still has a `message` listener does
|
|
41
|
+
* not exit after `port.close()`, so this listener must never outlive the port.
|
|
42
|
+
* A worker that installs it closes its port only through the returned
|
|
43
|
+
* `closePort`, which removes the listener first (on the next timer turn). The port's own `close()`
|
|
44
|
+
* cannot be wrapped instead: on Bun 1.3.14 it is a read-only, non-configurable
|
|
45
|
+
* property. `worker-shutdown-fence.test.ts` rejects any direct port close in a
|
|
46
|
+
* file that calls this function.
|
|
47
|
+
*/
|
|
48
|
+
export function exitOnWorkerClose(
|
|
49
|
+
port: WorkerClosePort | null,
|
|
50
|
+
closeConnections: () => void,
|
|
51
|
+
): { closePort(): void } {
|
|
52
|
+
const listener = (message: unknown) => {
|
|
53
|
+
if (!isWorkerCloseMessage(message)) return;
|
|
54
|
+
try {
|
|
55
|
+
closeConnections();
|
|
56
|
+
} finally {
|
|
57
|
+
// Exit even if a close threw: the thread is ending and a connection
|
|
58
|
+
// that could not close is released by the thread's teardown instead.
|
|
59
|
+
process.exit(0);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
if (!port) return { closePort() {} };
|
|
63
|
+
port.on("message", listener);
|
|
64
|
+
let closed = false;
|
|
65
|
+
return {
|
|
66
|
+
closePort() {
|
|
67
|
+
if (closed) return;
|
|
68
|
+
closed = true;
|
|
69
|
+
// Close on a later timer turn, not synchronously: on Bun 1.3.14 a
|
|
70
|
+
// port closed while an entry module with a top-level await is still
|
|
71
|
+
// evaluating does not end the thread. Every current caller closes
|
|
72
|
+
// its port at the end of the module body or later, so the timer runs
|
|
73
|
+
// after evaluation has finished.
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
port.off("message", listener);
|
|
76
|
+
port.close();
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** The parts of a worker's parent port that {@link exitOnWorkerClose} uses. */
|
|
83
|
+
export type WorkerClosePort = Pick<MessagePort, "on" | "off" | "close">;
|
|
84
|
+
|
|
85
|
+
export interface WorkerShutdown {
|
|
86
|
+
/**
|
|
87
|
+
* Ask the worker to close its connections and exit; terminate it if it has
|
|
88
|
+
* not exited after the deadline. Calling it again returns the same promise.
|
|
89
|
+
* Resolves once the worker has exited.
|
|
90
|
+
*/
|
|
91
|
+
close(): Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const outcomes = new Map<string, { graceful: number; forced: number }>();
|
|
95
|
+
|
|
96
|
+
/** How each site's workers ended after a close, by themselves or terminated. A snapshot. */
|
|
97
|
+
export function getWorkerShutdownStats(): ReadonlyMap<
|
|
98
|
+
string,
|
|
99
|
+
{ readonly graceful: number; readonly forced: number }
|
|
100
|
+
> {
|
|
101
|
+
return new Map([...outcomes].map(([site, counts]) => [site, { ...counts }]));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Owner side. Call right after creating the worker, so its exit is observed
|
|
106
|
+
* even when it exits before anyone asks it to close.
|
|
107
|
+
*
|
|
108
|
+
* @param site names the worker in {@link getWorkerShutdownStats}.
|
|
109
|
+
* @param deadlineMs how long the worker may take to close and exit before it
|
|
110
|
+
* is terminated.
|
|
111
|
+
*/
|
|
112
|
+
export function createWorkerShutdown(
|
|
113
|
+
worker: Worker,
|
|
114
|
+
site: string,
|
|
115
|
+
deadlineMs: number,
|
|
116
|
+
): WorkerShutdown {
|
|
117
|
+
let exited = false;
|
|
118
|
+
let forced = false;
|
|
119
|
+
let closing: Promise<void> | undefined;
|
|
120
|
+
const exit = new Promise<void>((resolve) => {
|
|
121
|
+
worker.once("exit", () => {
|
|
122
|
+
exited = true;
|
|
123
|
+
resolve();
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
const record = () => {
|
|
127
|
+
const counts = outcomes.get(site) ?? { graceful: 0, forced: 0 };
|
|
128
|
+
if (forced) counts.forced += 1;
|
|
129
|
+
else counts.graceful += 1;
|
|
130
|
+
outcomes.set(site, counts);
|
|
131
|
+
};
|
|
132
|
+
const terminate = () => {
|
|
133
|
+
forced = true;
|
|
134
|
+
void worker.terminate().catch(() => {});
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
close() {
|
|
138
|
+
if (closing) return closing;
|
|
139
|
+
if (exited) {
|
|
140
|
+
closing = Promise.resolve();
|
|
141
|
+
return closing;
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
worker.postMessage(WORKER_CLOSE_MESSAGE);
|
|
145
|
+
} catch {
|
|
146
|
+
terminate();
|
|
147
|
+
}
|
|
148
|
+
const fallback = setTimeout(() => {
|
|
149
|
+
if (!exited) terminate();
|
|
150
|
+
}, deadlineMs);
|
|
151
|
+
// A host that is exiting must not wait for this timer.
|
|
152
|
+
fallback.unref?.();
|
|
153
|
+
closing = exit.then(() => {
|
|
154
|
+
clearTimeout(fallback);
|
|
155
|
+
record();
|
|
156
|
+
});
|
|
157
|
+
return closing;
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ensureMemoryEmbeddings2
|
|
3
|
-
} from "./index-24fezq97.js";
|
|
4
|
-
import"./index-ze7mvk54.js";
|
|
5
|
-
import"./index-4dhv7mqz.js";
|
|
6
|
-
import"./index-qt1qqasc.js";
|
|
7
|
-
import"./index-bjcnntmz.js";
|
|
8
|
-
import"./index-wgypt3cs.js";
|
|
9
|
-
import"./index-rr2bb45z.js";
|
|
10
|
-
import"./index-b5vqckbw.js";
|
|
11
|
-
import"./index-6x57ar45.js";
|
|
12
|
-
import"./index-2vxtcb95.js";
|
|
13
|
-
import"./index-a6mc0v4d.js";
|
|
14
|
-
import"./index-s734jcsr.js";
|
|
15
|
-
import"./index-v0p37hm2.js";
|
|
16
|
-
import"./index-k29z4aqh.js";
|
|
17
|
-
import"./index-c5pytzne.js";
|
|
18
|
-
import"./index-beht37jy.js";
|
|
19
|
-
import"./index-j75v2476.js";
|
|
20
|
-
import"./index-g2q4htwp.js";
|
|
21
|
-
import"./index-pavzsdc6.js";
|
|
22
|
-
export {
|
|
23
|
-
ensureMemoryEmbeddings2 as ensureMemoryEmbeddings
|
|
24
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isRecompFailure2,
|
|
3
|
-
isRecompSkip2,
|
|
4
|
-
extractRecompReason2,
|
|
5
|
-
setRecompStarting2,
|
|
6
|
-
setRecompNote2,
|
|
7
|
-
setRecompTerminal2,
|
|
8
|
-
buildRecompDeps2,
|
|
9
|
-
runManagedRecomp2
|
|
10
|
-
} from "./index-c1p88z1y.js";
|
|
11
|
-
import"./index-rpxdjkm0.js";
|
|
12
|
-
import"./index-4s3t0nd0.js";
|
|
13
|
-
import"./index-3h4dp9wb.js";
|
|
14
|
-
import"./index-se4m2g6w.js";
|
|
15
|
-
import"./index-sd3egckz.js";
|
|
16
|
-
import"./index-24fezq97.js";
|
|
17
|
-
import"./index-ze7mvk54.js";
|
|
18
|
-
import"./index-n37sebck.js";
|
|
19
|
-
import"./index-4dhv7mqz.js";
|
|
20
|
-
import"./index-v10f1rjv.js";
|
|
21
|
-
import"./index-s74zqahq.js";
|
|
22
|
-
import"./index-qt1qqasc.js";
|
|
23
|
-
import"./index-9zcsy3hh.js";
|
|
24
|
-
import"./index-cf74k5ak.js";
|
|
25
|
-
import"./index-1zx87sdm.js";
|
|
26
|
-
import"./index-kq82mtg0.js";
|
|
27
|
-
import"./index-x8a7jmkh.js";
|
|
28
|
-
import"./index-y9f76s3f.js";
|
|
29
|
-
import"./index-bjcnntmz.js";
|
|
30
|
-
import"./index-wgypt3cs.js";
|
|
31
|
-
import"./index-rr2bb45z.js";
|
|
32
|
-
import"./index-b5vqckbw.js";
|
|
33
|
-
import"./index-6x57ar45.js";
|
|
34
|
-
import"./index-jrr131e0.js";
|
|
35
|
-
import"./index-fb3zxn06.js";
|
|
36
|
-
import"./index-63k48rv9.js";
|
|
37
|
-
import"./index-2vxtcb95.js";
|
|
38
|
-
import"./index-a6mc0v4d.js";
|
|
39
|
-
import"./index-fr0wbhdn.js";
|
|
40
|
-
import"./index-nj7yykkx.js";
|
|
41
|
-
import"./index-ke416mdc.js";
|
|
42
|
-
import"./index-bp5083x2.js";
|
|
43
|
-
import"./index-58e3y90n.js";
|
|
44
|
-
import"./index-s734jcsr.js";
|
|
45
|
-
import"./index-v0p37hm2.js";
|
|
46
|
-
import"./index-k29z4aqh.js";
|
|
47
|
-
import"./index-c5pytzne.js";
|
|
48
|
-
import"./index-beht37jy.js";
|
|
49
|
-
import"./index-j75v2476.js";
|
|
50
|
-
import"./index-g2q4htwp.js";
|
|
51
|
-
import"./index-pavzsdc6.js";
|
|
52
|
-
export {
|
|
53
|
-
buildRecompDeps2 as buildRecompDeps,
|
|
54
|
-
extractRecompReason2 as extractRecompReason,
|
|
55
|
-
isRecompFailure2 as isRecompFailure,
|
|
56
|
-
isRecompSkip2 as isRecompSkip,
|
|
57
|
-
runManagedRecomp2 as runManagedRecomp,
|
|
58
|
-
setRecompNote2 as setRecompNote,
|
|
59
|
-
setRecompStarting2 as setRecompStarting,
|
|
60
|
-
setRecompTerminal2 as setRecompTerminal
|
|
61
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ensureMemoryEmbeddings2
|
|
3
|
-
} from "./server-zzkj2fch.js";
|
|
4
|
-
import"./server-8by8qfec.js";
|
|
5
|
-
import"./server-4dhv7mqz.js";
|
|
6
|
-
import"./server-qt1qqasc.js";
|
|
7
|
-
import"./server-h1v0pyxb.js";
|
|
8
|
-
import"./server-271qxsf5.js";
|
|
9
|
-
import"./server-hy3d3vsx.js";
|
|
10
|
-
import"./server-46neh5fa.js";
|
|
11
|
-
import"./server-6tmj0s7j.js";
|
|
12
|
-
import"./server-rmygf5pn.js";
|
|
13
|
-
import"./server-1wy7b9de.js";
|
|
14
|
-
import"./server-xj136kt8.js";
|
|
15
|
-
import"./server-51779zs2.js";
|
|
16
|
-
import"./server-6pmqg9m4.js";
|
|
17
|
-
import"./server-tgnbmwah.js";
|
|
18
|
-
import"./server-beht37jy.js";
|
|
19
|
-
import"./server-f2xf5gcb.js";
|
|
20
|
-
import"./server-pavzsdc6.js";
|
|
21
|
-
export {
|
|
22
|
-
ensureMemoryEmbeddings2 as ensureMemoryEmbeddings
|
|
23
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isRecompFailure2,
|
|
3
|
-
isRecompSkip2,
|
|
4
|
-
extractRecompReason2,
|
|
5
|
-
setRecompStarting2,
|
|
6
|
-
setRecompNote2,
|
|
7
|
-
setRecompTerminal2,
|
|
8
|
-
buildRecompDeps2,
|
|
9
|
-
runManagedRecomp2
|
|
10
|
-
} from "./server-6vdzn1td.js";
|
|
11
|
-
import"./server-d04vrx0j.js";
|
|
12
|
-
import"./server-hm38q7r0.js";
|
|
13
|
-
import"./server-2ar62dyx.js";
|
|
14
|
-
import"./server-zzkj2fch.js";
|
|
15
|
-
import"./server-n37sebck.js";
|
|
16
|
-
import"./server-8by8qfec.js";
|
|
17
|
-
import"./server-4dhv7mqz.js";
|
|
18
|
-
import"./server-34kwfsr4.js";
|
|
19
|
-
import"./server-a9xqj88f.js";
|
|
20
|
-
import"./server-qt1qqasc.js";
|
|
21
|
-
import"./server-9hx7g5jp.js";
|
|
22
|
-
import"./server-27gq4mfz.js";
|
|
23
|
-
import"./server-1zx87sdm.js";
|
|
24
|
-
import"./server-n1prf1g6.js";
|
|
25
|
-
import"./server-h0410h0v.js";
|
|
26
|
-
import"./server-nj659894.js";
|
|
27
|
-
import"./server-tbe1femw.js";
|
|
28
|
-
import"./server-x8a7jmkh.js";
|
|
29
|
-
import"./server-h1v0pyxb.js";
|
|
30
|
-
import"./server-271qxsf5.js";
|
|
31
|
-
import"./server-hy3d3vsx.js";
|
|
32
|
-
import"./server-46neh5fa.js";
|
|
33
|
-
import"./server-6tmj0s7j.js";
|
|
34
|
-
import"./server-bmymkx73.js";
|
|
35
|
-
import"./server-fb3zxn06.js";
|
|
36
|
-
import"./server-xq7dfjke.js";
|
|
37
|
-
import"./server-fr0wbhdn.js";
|
|
38
|
-
import"./server-rmygf5pn.js";
|
|
39
|
-
import"./server-1wy7b9de.js";
|
|
40
|
-
import"./server-da07v4xp.js";
|
|
41
|
-
import"./server-g3qma5c0.js";
|
|
42
|
-
import"./server-pwv4ezb0.js";
|
|
43
|
-
import"./server-2ra6pwf3.js";
|
|
44
|
-
import"./server-xj136kt8.js";
|
|
45
|
-
import"./server-51779zs2.js";
|
|
46
|
-
import"./server-6pmqg9m4.js";
|
|
47
|
-
import"./server-tgnbmwah.js";
|
|
48
|
-
import"./server-beht37jy.js";
|
|
49
|
-
import"./server-f2xf5gcb.js";
|
|
50
|
-
import"./server-pavzsdc6.js";
|
|
51
|
-
export {
|
|
52
|
-
buildRecompDeps2 as buildRecompDeps,
|
|
53
|
-
extractRecompReason2 as extractRecompReason,
|
|
54
|
-
isRecompFailure2 as isRecompFailure,
|
|
55
|
-
isRecompSkip2 as isRecompSkip,
|
|
56
|
-
runManagedRecomp2 as runManagedRecomp,
|
|
57
|
-
setRecompNote2 as setRecompNote,
|
|
58
|
-
setRecompStarting2 as setRecompStarting,
|
|
59
|
-
setRecompTerminal2 as setRecompTerminal
|
|
60
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
runManagedWrapup2
|
|
3
|
-
} from "./index-4911rn0b.js";
|
|
4
|
-
import"./index-c1p88z1y.js";
|
|
5
|
-
import"./index-rpxdjkm0.js";
|
|
6
|
-
import"./index-4s3t0nd0.js";
|
|
7
|
-
import"./index-3h4dp9wb.js";
|
|
8
|
-
import"./index-se4m2g6w.js";
|
|
9
|
-
import"./index-sd3egckz.js";
|
|
10
|
-
import"./index-24fezq97.js";
|
|
11
|
-
import"./index-ze7mvk54.js";
|
|
12
|
-
import"./index-n37sebck.js";
|
|
13
|
-
import"./index-4dhv7mqz.js";
|
|
14
|
-
import"./index-v10f1rjv.js";
|
|
15
|
-
import"./index-s74zqahq.js";
|
|
16
|
-
import"./index-qt1qqasc.js";
|
|
17
|
-
import"./index-9zcsy3hh.js";
|
|
18
|
-
import"./index-cf74k5ak.js";
|
|
19
|
-
import"./index-1zx87sdm.js";
|
|
20
|
-
import"./index-kq82mtg0.js";
|
|
21
|
-
import"./index-x8a7jmkh.js";
|
|
22
|
-
import"./index-y9f76s3f.js";
|
|
23
|
-
import"./index-bjcnntmz.js";
|
|
24
|
-
import"./index-wgypt3cs.js";
|
|
25
|
-
import"./index-rr2bb45z.js";
|
|
26
|
-
import"./index-b5vqckbw.js";
|
|
27
|
-
import"./index-6x57ar45.js";
|
|
28
|
-
import"./index-jrr131e0.js";
|
|
29
|
-
import"./index-fb3zxn06.js";
|
|
30
|
-
import"./index-63k48rv9.js";
|
|
31
|
-
import"./index-2vxtcb95.js";
|
|
32
|
-
import"./index-a6mc0v4d.js";
|
|
33
|
-
import"./index-fr0wbhdn.js";
|
|
34
|
-
import"./index-nj7yykkx.js";
|
|
35
|
-
import"./index-ke416mdc.js";
|
|
36
|
-
import"./index-bp5083x2.js";
|
|
37
|
-
import"./index-58e3y90n.js";
|
|
38
|
-
import"./index-s734jcsr.js";
|
|
39
|
-
import"./index-v0p37hm2.js";
|
|
40
|
-
import"./index-k29z4aqh.js";
|
|
41
|
-
import"./index-c5pytzne.js";
|
|
42
|
-
import"./index-beht37jy.js";
|
|
43
|
-
import"./index-j75v2476.js";
|
|
44
|
-
import"./index-g2q4htwp.js";
|
|
45
|
-
import"./index-pavzsdc6.js";
|
|
46
|
-
export {
|
|
47
|
-
runManagedWrapup2 as runManagedWrapup
|
|
48
|
-
};
|