@cortexkit/opencode-magic-context 0.48.0 → 0.49.1
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/{announcement-fp14dw0n.js → announcement-hdbkt8v5.js} +1 -1
- package/dist/auto-search-worker.js +3 -3
- package/dist/config/{mural-model-deprecation.d.ts → deprecated-config.d.ts} +4 -1
- package/dist/config/deprecated-config.d.ts.map +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/project-security.d.ts +2 -2
- package/dist/config/schema/magic-context.d.ts +4 -4
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-w8cykrnf.js → conflict-warning-hook-asnt6hfc.js} +7 -7
- package/dist/{context-m0cy262m.js → context-tfyhtdcs.js} +187 -68
- package/dist/{derive-budgets-sg0xsq7s.js → derive-budgets-j4ry8j8n.js} +2 -2
- package/dist/embedding-backfill-wyc3ykyf.js +21 -0
- package/dist/embedding-worker-process.js +30 -0
- package/dist/embedding-worker.js +6 -6
- package/dist/features/magic-context/dreamer/task-registry.d.ts +2 -3
- package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/search-git-commits.d.ts +2 -0
- package/dist/features/magic-context/git-commits/search-git-commits.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts +8 -1
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-worker-process.d.ts +2 -0
- package/dist/features/magic-context/memory/embedding-worker-process.d.ts.map +1 -0
- package/dist/features/magic-context/memory/onnx-telemetry.d.ts +3 -0
- package/dist/features/magic-context/memory/onnx-telemetry.d.ts.map +1 -0
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/overflow-detection.d.ts +1 -2
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/features/magic-context/pi-content-decisions.d.ts +1 -1
- package/dist/features/magic-context/pi-content-decisions.d.ts.map +1 -1
- package/dist/features/magic-context/search-rerank.d.ts +35 -0
- package/dist/features/magic-context/search-rerank.d.ts.map +1 -0
- package/dist/features/magic-context/search.d.ts +11 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +13 -2
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta.d.ts +1 -1
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
- package/dist/features/magic-context/storage-session-tables.d.ts +2 -0
- package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tag-identity-revision.d.ts +29 -9
- package/dist/features/magic-context/storage-tag-identity-revision.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +9 -0
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +1 -1
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/tagger.d.ts +2 -0
- package/dist/features/magic-context/tagger.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +4 -1
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/storage-user-memory.d.ts +1 -0
- package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-deadline.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-replay.fixture.d.ts +24 -0
- package/dist/hooks/magic-context/auto-search-replay.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-runner.d.ts +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 +2 -0
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts +2 -0
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts +28 -0
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +1 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-host-runner.d.ts +8 -0
- package/dist/hooks/magic-context/historian-host-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +3 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/latest-thinking-recovery.d.ts +7 -0
- package/dist/hooks/magic-context/latest-thinking-recovery.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-measured-request.d.ts +3 -1
- package/dist/hooks/magic-context/lkg-measured-request.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-persist.d.ts +8 -14
- package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts +62 -0
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts +38 -0
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-replay.d.ts +3 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/opaque-thinking.d.ts +12 -0
- package/dist/hooks/magic-context/opaque-thinking.d.ts.map +1 -0
- package/dist/hooks/magic-context/pass-outcome.d.ts +3 -2
- package/dist/hooks/magic-context/pass-outcome.d.ts.map +1 -1
- package/dist/hooks/magic-context/pending-materialization.d.ts +8 -0
- package/dist/hooks/magic-context/pending-materialization.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts +7 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +3 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +35 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +37 -0
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/shared-compartment-boundaries.d.ts +8 -1
- package/dist/hooks/magic-context/shared-compartment-boundaries.d.ts.map +1 -1
- package/dist/hooks/magic-context/strict-thinking-prefix.d.ts +8 -0
- package/dist/hooks/magic-context/strict-thinking-prefix.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-content.d.ts +5 -2
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-date-refresh.d.ts +29 -0
- package/dist/hooks/magic-context/system-date-refresh.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-dates.d.ts +6 -0
- package/dist/hooks/magic-context/system-prompt-dates.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-delivery.d.ts +47 -0
- package/dist/hooks/magic-context/system-prompt-delivery.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +4 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +8 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +15 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +7 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-ty64eqcn.js → index-0pjvpfkf.js} +24 -4
- package/dist/{index-db7zwa3v.js → index-1bt88epp.js} +93 -9
- package/dist/{index-2y0s2hep.js → index-4mjhqadz.js} +1 -1
- package/dist/index-6m7rdv7y.js +733 -0
- package/dist/{index-k1xb52kd.js → index-6tfxmc4n.js} +11 -11
- package/dist/{index-fbv1dn35.js → index-7w18gg78.js} +26 -2
- package/dist/{index-7mx8v0pw.js → index-att4bfan.js} +4 -4
- package/dist/{index-mmyh6d8f.js → index-eypn4ba6.js} +11 -6
- package/dist/{index-q2tqeqde.js → index-fdtkt5r1.js} +1229 -78
- package/dist/{index-c43kr12f.js → index-fg00p1cg.js} +42 -40
- package/dist/{v2/server-1bc61ans.js → index-fvnzcnww.js} +44 -1
- package/dist/index-gbmqa9x9.js +1170 -0
- package/dist/{index-knh4y330.js → index-gzky5rva.js} +31 -49
- package/dist/{index-0qhce371.js → index-h2wc01qk.js} +2 -2
- package/dist/{index-dhwzyd54.js → index-h5zfkjyk.js} +160 -25
- package/dist/{index-bhvjj0ys.js → index-k6xvbj2e.js} +255 -1075
- package/dist/{index-0w56v4fm.js → index-mw7c950g.js} +1 -1
- package/dist/{index-8j7gqj40.js → index-nsjyysj0.js} +6 -2
- package/dist/{index-k9nnwad5.js → index-nydv6g8r.js} +44 -7
- package/dist/{index-f0h6xwqm.js → index-p0n5ryq8.js} +304 -960
- package/dist/{index-pg50n748.js → index-p1hnwfd8.js} +4 -4
- package/dist/{index-1qb0z7wa.js → index-qx53vezw.js} +1 -1
- package/dist/{index-5zygecde.js → index-r2zcs71c.js} +8 -6
- package/dist/{index-cb7emxgj.js → index-rafsaxac.js} +336 -6
- package/dist/{index-z8e0psj8.js → index-s7fc0fkn.js} +3 -3
- package/dist/{index-14cjxt20.js → index-sfhndpcb.js} +505 -11
- package/dist/index-sv0bb7vg.js +6972 -0
- package/dist/{index-jcbd3znx.js → index-tqf7yg27.js} +1 -1
- package/dist/{index-72nhv486.js → index-vkbqdnkj.js} +2 -2
- package/dist/{index-pdecwzrd.js → index-w23dh319.js} +18 -259
- package/dist/{index-yq8n9qcb.js → index-xgrwmj82.js} +4 -4
- package/dist/{index-0an7742d.js → index-xnanvj3w.js} +1364 -2278
- package/dist/{index-eeezr5zz.js → index-z1tjp257.js} +1 -1
- package/dist/{index-692jzy0p.js → index-zfzdpeq2.js} +2279 -4061
- package/dist/{index-q7h7csab.js → index-zg8yq4ya.js} +34 -749
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +241 -76
- package/dist/{logger-d3wex3dz.js → logger-ewak5q1s.js} +1 -1
- package/dist/{message-index-bounded-7ezbgddp.js → message-index-bounded-hqktkhdy.js} +15 -14
- package/dist/{message-time-backfill-brbd63hv.js → message-time-backfill-8x06r9kx.js} +2 -2
- package/dist/migration-worker.js +11 -10
- package/dist/plugin/hooks/create-session-hooks.d.ts +5 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/{project-embedding-registry-7qzptcw7.js → project-embedding-registry-0gv3h6y8.js} +10 -10
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-6k83m4fj.js → read-session-chunk-5mh0bh8y.js} +12 -9
- package/dist/{read-session-raw-3g9qy1xa.js → read-session-raw-8sjbc9h0.js} +5 -3
- package/dist/{recomp-orchestrator-d3fp1cy0.js → recomp-orchestrator-kpkhkjhq.js} +28 -27
- package/dist/{safe-notification-target-5ffqq32m.js → safe-notification-target-q0cyrx3x.js} +2 -2
- package/dist/{search-epax1ecv.js → search-p9w39qv4.js} +22 -21
- package/dist/{send-session-notification-erecz4y4.js → send-session-notification-xffh3bbe.js} +5 -5
- package/dist/shared/auto-search-lifecycle.d.ts +14 -0
- package/dist/shared/auto-search-lifecycle.d.ts.map +1 -1
- package/dist/shared/logger.d.ts.map +1 -1
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/models-dev-temperature.d.ts +18 -0
- package/dist/shared/models-dev-temperature.d.ts.map +1 -0
- package/dist/shared/project-directory-key.d.ts +16 -0
- package/dist/shared/project-directory-key.d.ts.map +1 -1
- package/dist/shared/storage-file-mutex.d.ts +9 -0
- package/dist/shared/storage-file-mutex.d.ts.map +1 -0
- package/dist/shared/storage-permissions.d.ts +6 -0
- package/dist/shared/storage-permissions.d.ts.map +1 -1
- package/dist/shared/subagent-temperature.d.ts +46 -0
- package/dist/shared/subagent-temperature.d.ts.map +1 -0
- package/dist/shared/window-geometry.d.ts +9 -66
- package/dist/shared/window-geometry.d.ts.map +1 -1
- package/dist/standalone-plugin-marker.d.ts +8 -0
- package/dist/standalone-plugin-marker.d.ts.map +1 -0
- package/dist/{storage-tags-d3b0v2ss.js → storage-tags-k0pda32s.js} +6 -4
- package/dist/tools/ctx-reduce/constants.d.ts +1 -2
- package/dist/tools/ctx-reduce/constants.d.ts.map +1 -1
- package/dist/tools/ctx-reduce/tools.d.ts +1 -1
- package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
- package/dist/tools/ctx-search/tools.d.ts.map +1 -1
- package/dist/tools/ctx-search/types.d.ts +1 -0
- package/dist/tools/ctx-search/types.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-spcy2qre.js → transform-postprocess-phase-481j5a7z.js} +28 -27
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/{context-sf98kstd.js → context-gsdtha5v.js} +1619 -3111
- package/dist/v2/{derive-budgets-3vc0y84t.js → derive-budgets-enckmg7y.js} +3 -3
- package/dist/v2/embedding-backfill-dbvjbcmm.js +20 -0
- package/dist/v2/embedding-worker-process.js +29 -0
- package/dist/v2/embedding-worker.js +6 -7
- package/dist/v2/hidden-child-native.d.ts.map +1 -1
- package/dist/v2/hidden-completion.d.ts +7 -0
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/copied-tag-notation.d.ts +19 -0
- package/dist/v2/hooks/copied-tag-notation.d.ts.map +1 -0
- package/dist/v2/hooks/dream-trigger.d.ts +4 -1
- package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
- package/dist/v2/hooks/generate.d.ts +9 -2
- package/dist/v2/hooks/generate.d.ts.map +1 -1
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/system-prompt-response.d.ts +5 -0
- package/dist/v2/hooks/system-prompt-response.d.ts.map +1 -0
- package/dist/v2/{logger-mxd0ym09.js → logger-pj02s7sr.js} +1 -1
- package/dist/v2/{message-index-bounded-dy3s2k1e.js → message-index-bounded-p6v0n8qh.js} +15 -14
- package/dist/v2/{message-time-backfill-gtx1pwk1.js → message-time-backfill-cje68egj.js} +2 -2
- package/dist/v2/migration-worker.js +11 -10
- package/dist/v2/{project-embedding-registry-1tgba5dv.js → project-embedding-registry-nyq7z8y6.js} +11 -12
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-rh4khdkv.js → read-session-chunk-fhyfe4qa.js} +12 -9
- package/dist/v2/{read-session-raw-bsbmf0vj.js → read-session-raw-j8dvp7f4.js} +5 -3
- package/dist/v2/recomp-orchestrator-5xy7w136.js +57 -0
- package/dist/v2/{safe-notification-target-73ax1p5v.js → safe-notification-target-y3p1hce9.js} +2 -2
- package/dist/v2/{search-nzkwrc6n.js → search-j7bakcwa.js} +23 -23
- package/dist/v2/{send-session-notification-6km439kn.js → send-session-notification-f6v698r5.js} +5 -5
- package/dist/v2/{server-7wwc2nga.js → server-1fszbabv.js} +32 -32
- package/dist/v2/{server-k228xhjg.js → server-2htmbqbv.js} +26 -2
- package/dist/v2/{server-aan4q8mx.js → server-3t0q2cqx.js} +1 -1
- package/dist/v2/{server-686jg6eb.js → server-4c7jt8gq.js} +68 -7
- package/dist/v2/{server-xxm59eww.js → server-4enr7s6x.js} +4 -4
- package/dist/v2/{server-zxhgvsf9.js → server-676xw7at.js} +1 -1
- package/dist/v2/{server-52awr2mw.js → server-6byqfbqf.js} +93 -9
- package/dist/v2/{server-e0vdaae2.js → server-6tcrjfw8.js} +4 -4
- package/dist/v2/{server-qye6ykf7.js → server-7ekna9zs.js} +2 -2
- package/dist/v2/{server-g5r0n3b6.js → server-7h861yms.js} +160 -25
- package/dist/v2/{server-k8x2rbxc.js → server-7spkq1y6.js} +3457 -5192
- package/dist/v2/{server-8pyt7hev.js → server-7vkj6zhb.js} +34 -749
- package/dist/v2/{server-yczc713m.js → server-8xmq9h3f.js} +31 -49
- package/dist/v2/{server-sggvvzhb.js → server-bgzy0phk.js} +505 -11
- package/dist/v2/server-c7n2ftng.js +6860 -0
- package/dist/v2/server-cvgn49tr.js +733 -0
- package/dist/v2/{server-zm570tr2.js → server-cw6521wn.js} +232 -7
- package/dist/v2/{server-xdfwt6kh.js → server-czb2rkpk.js} +23 -3
- package/dist/v2/{server-x2g40a71.js → server-d6g4whc2.js} +21 -15
- package/dist/{index-1bc61ans.js → v2/server-fvnzcnww.js} +44 -1
- package/dist/v2/{server-4k748ke6.js → server-hb6xhh9q.js} +2 -2
- package/dist/v2/{server-gjcr4w98.js → server-kh958yj8.js} +5 -5
- package/dist/v2/{server-1r6pmz4f.js → server-kzns2hbz.js} +1 -1
- package/dist/v2/{server-psqc7e9n.js → server-mqvtz7wz.js} +1227 -78
- package/dist/v2/{server-vqpf3167.js → server-ras2sxnc.js} +135 -15
- package/dist/v2/{server-ezhze64f.js → server-s2st631p.js} +4 -4
- package/dist/v2/{server-5m3dt5r1.js → server-t4k4qexw.js} +6 -2
- package/dist/v2/{server-z2037m6z.js → server-t528t8qm.js} +2 -2
- package/dist/v2/{server-v06jcv0w.js → server-vb7pbd9p.js} +18 -259
- package/dist/v2/{server-8tqanswc.js → server-zbxjj2mz.js} +331 -4
- package/dist/v2/server.d.ts.map +1 -1
- package/dist/v2/server.js +150 -6
- package/dist/v2/{storage-tags-w4tv77sn.js → storage-tags-5yxrvkaf.js} +6 -4
- package/dist/v2/store-reader.d.ts +8 -2
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{wrapup-orchestrator-mz7efs7w.js → wrapup-orchestrator-yem5422s.js} +36 -36
- package/dist/wrapup-orchestrator-xvrr27ws.js +45 -0
- package/package.json +4 -4
- package/src/config/{mural-model-deprecation.ts → deprecated-config.ts} +19 -0
- package/src/config/index.test.ts +15 -37
- package/src/config/index.ts +2 -3
- package/src/config/project-security.ts +3 -3
- package/src/config/schema/magic-context.ts +11 -7
- package/src/features/magic-context/dreamer/task-registry.ts +2 -3
- package/src/shared/auto-search-lifecycle.ts +43 -0
- package/src/shared/logger.test.ts +38 -0
- package/src/shared/logger.ts +10 -2
- package/src/shared/models-dev-cache.ts +1 -7
- package/src/shared/models-dev-temperature.ts +107 -0
- package/src/shared/project-directory-key.test.ts +59 -0
- package/src/shared/project-directory-key.ts +20 -0
- package/src/shared/sqlite-640-review.test.ts +5 -1
- package/src/shared/storage-file-mutex-review.test.ts +162 -0
- package/src/shared/storage-file-mutex.ts +130 -0
- package/src/shared/storage-permissions.ts +46 -0
- package/src/shared/subagent-temperature.test.ts +270 -0
- package/src/shared/subagent-temperature.ts +110 -0
- package/src/shared/window-geometry.test.ts +102 -236
- package/src/shared/window-geometry.ts +23 -413
- package/dist/config/mural-model-deprecation.d.ts.map +0 -1
- package/dist/embedding-backfill-9rcm1mfy.js +0 -21
- package/dist/index-bdckkfw6.js +0 -3261
- package/dist/index-mfkzp7qj.js +0 -229
- package/dist/v2/embedding-backfill-vn8g1nh1.js +0 -21
- package/dist/v2/recomp-orchestrator-az61rfcg.js +0 -57
- package/dist/v2/server-2fbhp79z.js +0 -3205
- package/dist/v2/server-mfkzp7qj.js +0 -229
- package/dist/wrapup-orchestrator-amzta1t4.js +0 -44
- package/src/shared/__fixtures__/window-overlay.v1.json +0 -337
- /package/dist/{index-2pp04pmg.js → index-69vas84q.js} +0 -0
- /package/dist/v2/{index-2pp04pmg.js → index-69vas84q.js} +0 -0
|
@@ -3,46 +3,28 @@ import {
|
|
|
3
3
|
} from "./index-0sahzkwr.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-nsjyysj0.js";
|
|
7
|
+
import {
|
|
8
|
+
projectDirectoryKey
|
|
9
|
+
} from "./index-7w18gg78.js";
|
|
7
10
|
import {
|
|
8
11
|
writeStorageFileAtomicSync
|
|
9
|
-
} from "./index-
|
|
12
|
+
} from "./index-fvnzcnww.js";
|
|
10
13
|
|
|
11
14
|
// src/features/magic-context/memory/project-identity.ts
|
|
12
15
|
import { execFileSync } from "node:child_process";
|
|
13
16
|
import { createHash as createHash2 } from "node:crypto";
|
|
14
|
-
import { existsSync, realpathSync
|
|
17
|
+
import { existsSync, realpathSync, statSync } from "node:fs";
|
|
15
18
|
import { homedir } from "node:os";
|
|
16
|
-
import
|
|
19
|
+
import path2 from "node:path";
|
|
17
20
|
|
|
18
21
|
// src/features/magic-context/memory/project-identity-cache.ts
|
|
19
22
|
import { createHash } from "node:crypto";
|
|
20
23
|
import { readFileSync } from "node:fs";
|
|
21
|
-
import path2 from "node:path";
|
|
22
|
-
|
|
23
|
-
// src/shared/project-directory-key.ts
|
|
24
|
-
import { realpathSync } from "node:fs";
|
|
25
24
|
import path from "node:path";
|
|
26
|
-
function projectDirectoryKey(directory) {
|
|
27
|
-
const slashed = directory.replaceAll("\\", "/").replace(/^\/\/\?\/UNC\//i, "//").replace(/^\/\/\?\//, "");
|
|
28
|
-
if (/^[a-z]:\//i.test(slashed) || slashed.startsWith("//")) {
|
|
29
|
-
return path.win32.normalize(slashed).replaceAll("\\", "/").replace(/\/$/, "").toLowerCase();
|
|
30
|
-
}
|
|
31
|
-
return path.resolve(directory);
|
|
32
|
-
}
|
|
33
|
-
var realpathForCanonicalDirectory = (directory) => realpathSync.native(directory);
|
|
34
|
-
function canonicalProjectDirectory(directory) {
|
|
35
|
-
let resolved = directory;
|
|
36
|
-
try {
|
|
37
|
-
resolved = realpathForCanonicalDirectory(directory);
|
|
38
|
-
} catch {}
|
|
39
|
-
return projectDirectoryKey(resolved);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// src/features/magic-context/memory/project-identity-cache.ts
|
|
43
25
|
function cachePath(directory, storageDir = getMagicContextStorageDir()) {
|
|
44
26
|
const hash = createHash("sha256").update(projectDirectoryKey(directory)).digest("hex");
|
|
45
|
-
return
|
|
27
|
+
return path.join(storageDir, "project-identities", `${hash}.json`);
|
|
46
28
|
}
|
|
47
29
|
function rememberGitIdentity(directory, identity) {
|
|
48
30
|
try {
|
|
@@ -148,7 +130,7 @@ function getErrorStderr(error) {
|
|
|
148
130
|
return "";
|
|
149
131
|
}
|
|
150
132
|
function directoryFallback(directory) {
|
|
151
|
-
const canonical =
|
|
133
|
+
const canonical = path2.resolve(directory);
|
|
152
134
|
const hash = createHash2("md5").update(canonical, "utf8").digest("hex").slice(0, 12);
|
|
153
135
|
return `dir:${hash}`;
|
|
154
136
|
}
|
|
@@ -220,7 +202,7 @@ function classifyGitError(error, rawDirectory) {
|
|
|
220
202
|
}
|
|
221
203
|
function resolveProjectIdentityStrict(directory, allowHomeProject = homeProjectPermission) {
|
|
222
204
|
assertProjectAllowed(directory, allowHomeProject);
|
|
223
|
-
const canonical =
|
|
205
|
+
const canonical = path2.resolve(directory);
|
|
224
206
|
const cached = identityCache.get(canonical);
|
|
225
207
|
if (cached !== undefined) {
|
|
226
208
|
return cached;
|
|
@@ -287,9 +269,9 @@ function nearestLastKnownGitIdentity(canonical) {
|
|
|
287
269
|
const cached = lastKnownGitIdentity(current);
|
|
288
270
|
if (cached !== undefined)
|
|
289
271
|
return { identity: cached, source: current };
|
|
290
|
-
if (existsSync(
|
|
272
|
+
if (existsSync(path2.join(current, ".git")))
|
|
291
273
|
break;
|
|
292
|
-
const parent =
|
|
274
|
+
const parent = path2.dirname(current);
|
|
293
275
|
if (parent === current)
|
|
294
276
|
break;
|
|
295
277
|
current = parent;
|
|
@@ -300,7 +282,7 @@ function nearestLastKnownGitIdentity(canonical) {
|
|
|
300
282
|
if (exactOrAncestor)
|
|
301
283
|
return exactOrAncestor;
|
|
302
284
|
try {
|
|
303
|
-
const realCanonical =
|
|
285
|
+
const realCanonical = realpathSync.native(canonical);
|
|
304
286
|
if (realCanonical !== canonical)
|
|
305
287
|
return walk(realCanonical);
|
|
306
288
|
} catch {}
|
|
@@ -328,7 +310,7 @@ function recordDubiousOwnershipFallback(canonical) {
|
|
|
328
310
|
log2(`[magic-context] ${formatDubiousOwnershipWarning(canonical)}`);
|
|
329
311
|
}
|
|
330
312
|
function takeDubiousOwnershipProjectIdentityWarning(directory) {
|
|
331
|
-
const canonical =
|
|
313
|
+
const canonical = path2.resolve(directory);
|
|
332
314
|
if (!dubiousOwnershipFallbackDirectories.has(canonical))
|
|
333
315
|
return null;
|
|
334
316
|
if (dubiousOwnershipWarnedDirectories.has(canonical))
|
|
@@ -339,7 +321,7 @@ function takeDubiousOwnershipProjectIdentityWarning(directory) {
|
|
|
339
321
|
function canonicalUserHomeDirectory() {
|
|
340
322
|
const homeDirectory = userHomeDirectoryForIdentity();
|
|
341
323
|
try {
|
|
342
|
-
return
|
|
324
|
+
return realpathSync.native(homeDirectory);
|
|
343
325
|
} catch {
|
|
344
326
|
return homeDirectory;
|
|
345
327
|
}
|
|
@@ -348,20 +330,20 @@ function isUserHomeDirectory(directory) {
|
|
|
348
330
|
if (projectDirectoryKey(directory) === projectDirectoryKey(userHomeDirectoryForIdentity()))
|
|
349
331
|
return true;
|
|
350
332
|
try {
|
|
351
|
-
return projectDirectoryKey(
|
|
333
|
+
return projectDirectoryKey(realpathSync.native(path2.resolve(directory))) === projectDirectoryKey(canonicalUserHomeDirectory());
|
|
352
334
|
} catch {
|
|
353
335
|
return false;
|
|
354
336
|
}
|
|
355
337
|
}
|
|
356
338
|
function assertProjectAllowed(directory, allowHomeProject) {
|
|
357
|
-
const canonical =
|
|
339
|
+
const canonical = path2.resolve(directory);
|
|
358
340
|
if (!allowHomeProject && (isUserHomeDirectory(directory) || isUserHomeDirectory(gitRootDirectory(canonical) ?? canonical))) {
|
|
359
341
|
throw new ProjectIdentityError("home_project_disabled", directory, "Home project memory is disabled; set allow_home_project to opt in");
|
|
360
342
|
}
|
|
361
343
|
}
|
|
362
344
|
function resolveProjectIdentity(directory, allowHomeProject = homeProjectPermission) {
|
|
363
345
|
assertProjectAllowed(directory, allowHomeProject);
|
|
364
|
-
const canonical =
|
|
346
|
+
const canonical = path2.resolve(directory);
|
|
365
347
|
const cachedFallback = directoryFallbackCache.get(canonical);
|
|
366
348
|
if (cachedFallback !== undefined) {
|
|
367
349
|
if (!hasGitDir(canonical)) {
|
|
@@ -409,7 +391,7 @@ function resolveProjectIdentityOrFallback(directory, allowHomeProject = homeProj
|
|
|
409
391
|
try {
|
|
410
392
|
return resolveProjectIdentity(directory, allowHomeProject);
|
|
411
393
|
} catch (error) {
|
|
412
|
-
const canonical =
|
|
394
|
+
const canonical = path2.resolve(directory);
|
|
413
395
|
if (hasGitDir(canonical) || error instanceof ProjectIdentityError && error.errorClass === "home_project_disabled")
|
|
414
396
|
throw error;
|
|
415
397
|
const fallback = rememberedIdentityOrDirectoryFallback(canonical);
|
|
@@ -423,7 +405,7 @@ function hasGitDir(canonical) {
|
|
|
423
405
|
return true;
|
|
424
406
|
}
|
|
425
407
|
try {
|
|
426
|
-
const realCanonical =
|
|
408
|
+
const realCanonical = realpathSync.native(canonical);
|
|
427
409
|
return realCanonical !== canonical && hasGitDirInAncestorChain(realCanonical);
|
|
428
410
|
} catch {
|
|
429
411
|
return false;
|
|
@@ -432,14 +414,14 @@ function hasGitDir(canonical) {
|
|
|
432
414
|
function gitRootInAncestorChain(startDirectory) {
|
|
433
415
|
let current = startDirectory;
|
|
434
416
|
while (true) {
|
|
435
|
-
if (existsSync(
|
|
417
|
+
if (existsSync(path2.join(current, ".git"))) {
|
|
436
418
|
try {
|
|
437
|
-
return
|
|
419
|
+
return realpathSync.native(current);
|
|
438
420
|
} catch {
|
|
439
|
-
return
|
|
421
|
+
return path2.resolve(current);
|
|
440
422
|
}
|
|
441
423
|
}
|
|
442
|
-
const parent =
|
|
424
|
+
const parent = path2.dirname(current);
|
|
443
425
|
if (parent === current) {
|
|
444
426
|
return null;
|
|
445
427
|
}
|
|
@@ -454,21 +436,21 @@ function gitRootDirectory(canonical) {
|
|
|
454
436
|
if (direct)
|
|
455
437
|
return direct;
|
|
456
438
|
try {
|
|
457
|
-
const realCanonical =
|
|
439
|
+
const realCanonical = realpathSync.native(canonical);
|
|
458
440
|
return realCanonical === canonical ? null : gitRootInAncestorChain(realCanonical);
|
|
459
441
|
} catch {
|
|
460
442
|
return null;
|
|
461
443
|
}
|
|
462
444
|
}
|
|
463
445
|
function directoryHasGitMetadata(directory) {
|
|
464
|
-
return gitRootDirectory(
|
|
446
|
+
return gitRootDirectory(path2.resolve(directory)) !== null;
|
|
465
447
|
}
|
|
466
448
|
function describeUnresolvedProjectIdentity(directory) {
|
|
467
|
-
const resolvedDirectory =
|
|
449
|
+
const resolvedDirectory = path2.resolve(directory);
|
|
468
450
|
const canonicalHome = canonicalUserHomeDirectory();
|
|
469
451
|
const canonicalDirectory = (() => {
|
|
470
452
|
try {
|
|
471
|
-
return
|
|
453
|
+
return realpathSync.native(resolvedDirectory);
|
|
472
454
|
} catch {
|
|
473
455
|
return resolvedDirectory;
|
|
474
456
|
}
|
|
@@ -484,7 +466,7 @@ function isUsableProjectIdentity(identity) {
|
|
|
484
466
|
return typeof identity === "string" && identity.trim().length > 0;
|
|
485
467
|
}
|
|
486
468
|
function resolveProjectIdentityForSession(directory, allowHomeProject = homeProjectPermission) {
|
|
487
|
-
const resolvedDirectory =
|
|
469
|
+
const resolvedDirectory = path2.resolve(directory);
|
|
488
470
|
const cacheKey = `${allowHomeProject ? "1" : "0"}\x00${resolvedDirectory}`;
|
|
489
471
|
const cached = sessionIdentityCache.get(cacheKey);
|
|
490
472
|
if (cached && (cached.revalidateAt === null || nowMs() < cached.revalidateAt) && !(cached.identity?.startsWith("dir:") && hasGitDir(resolvedDirectory))) {
|
|
@@ -495,7 +477,7 @@ function resolveProjectIdentityForSession(directory, allowHomeProject = homeProj
|
|
|
495
477
|
const canonicalDirectory = (() => {
|
|
496
478
|
try {
|
|
497
479
|
filesystemProbeObserverForTests?.();
|
|
498
|
-
return
|
|
480
|
+
return realpathSync.native(resolvedDirectory);
|
|
499
481
|
} catch {
|
|
500
482
|
return resolvedDirectory;
|
|
501
483
|
}
|
|
@@ -563,4 +545,4 @@ function setBootQuietPeriodForTests(startAtMs) {
|
|
|
563
545
|
bootQuietUntilMs = startAtMs === null ? 0 : startAtMs + BOOT_QUIET_MS;
|
|
564
546
|
}
|
|
565
547
|
|
|
566
|
-
export {
|
|
548
|
+
export { setHomeProjectPermission, shouldSkipHomeProjectMemory, ProjectIdentityError, resolveProjectIdentityStrict, takeDubiousOwnershipProjectIdentityWarning, isUserHomeDirectory, resolveProjectIdentity, directoryHasGitMetadata, describeUnresolvedProjectIdentity, isUsableProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, beginBootQuietPeriod, bootQuietRemainingMs, scheduleAfterBootQuiet, setBootQuietPeriodForTests };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
estimateTokens
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-qx53vezw.js";
|
|
4
4
|
import {
|
|
5
5
|
stableStringify
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-1bt88epp.js";
|
|
7
7
|
|
|
8
8
|
// src/features/magic-context/tool-definition-tokens.ts
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./index-kb9nn0a0.js";
|
|
5
5
|
import {
|
|
6
6
|
log2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-nsjyysj0.js";
|
|
8
8
|
|
|
9
9
|
// src/hooks/magic-context/read-session-raw.ts
|
|
10
10
|
import { isMainThread } from "node:worker_threads";
|
|
@@ -315,30 +315,46 @@ function readRawMessagePageRows(db, sessionId, afterOrdinal, limit, finalWaterma
|
|
|
315
315
|
const pageSize = Math.min(Math.max(1, Math.floor(limit)), remaining);
|
|
316
316
|
if (pageSize === 0)
|
|
317
317
|
return [];
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
318
|
+
return withReadSnapshot(db, () => {
|
|
319
|
+
const ordinal = Math.max(0, Math.floor(afterOrdinal));
|
|
320
|
+
const points = currentOrdinalCheckpoints(db, sessionId)?.scan.checkpoints ?? [];
|
|
321
|
+
let low = 0;
|
|
322
|
+
let high = points.length;
|
|
323
|
+
while (low < high) {
|
|
324
|
+
const middle = Math.floor((low + high) / 2);
|
|
325
|
+
if (points[middle].ordinal <= ordinal)
|
|
326
|
+
low = middle + 1;
|
|
327
|
+
else
|
|
328
|
+
high = middle;
|
|
329
|
+
}
|
|
330
|
+
const floor = points[low - 1];
|
|
331
|
+
const useFloor = floor && (!after || compareOrdinalKeys(floor, after) > 0);
|
|
332
|
+
const anchor = useFloor ? floor : after;
|
|
333
|
+
const skip = anchor === after && after ? 0 : ordinal - (floor?.ordinal ?? 0);
|
|
334
|
+
if (skip > ORDINAL_LOOKUP_LIMIT) {
|
|
335
|
+
prewarmRawSessionOrdinalsForDb(db, sessionId);
|
|
336
|
+
throw new RawOrdinalsNotReady;
|
|
337
|
+
}
|
|
338
|
+
const rawLimit = skip + pageSize + ORDINAL_LOOKUP_LIMIT;
|
|
339
|
+
const rows = db.prepare(`SELECT id, data, time_created, time_updated, ${EXCLUDED_ROW_SQL} AS excluded
|
|
340
|
+
FROM message WHERE id IN (
|
|
341
|
+
SELECT id FROM message WHERE session_id = ?
|
|
342
|
+
${anchor ? "AND (time_created, id) > (?, ?)" : ""}
|
|
343
|
+
ORDER BY time_created, id LIMIT ?)
|
|
344
|
+
ORDER BY time_created, id`).all(sessionId, ...anchor ? [anchor.timeCreated, anchor.id] : [], rawLimit);
|
|
345
|
+
rawMessagePageRowsVisited += rows.length;
|
|
346
|
+
const eligible = rows.filter((row) => row.excluded !== 1);
|
|
347
|
+
if (eligible.length <= skip && rows.length === rawLimit) {
|
|
348
|
+
prewarmRawSessionOrdinalsForDb(db, sessionId);
|
|
349
|
+
throw new RawOrdinalsNotReady;
|
|
350
|
+
}
|
|
351
|
+
return eligible.slice(skip, skip + pageSize).filter(isRawMessageRow).map((row, index) => ({
|
|
352
|
+
...row,
|
|
353
|
+
ordinal: ordinal + index + 1
|
|
354
|
+
}));
|
|
355
|
+
});
|
|
341
356
|
}
|
|
357
|
+
var rawMessagePageRowsVisited = 0;
|
|
342
358
|
function assembleRawMessagePage(messageRows, partRows) {
|
|
343
359
|
const partsByMessageId = new Map;
|
|
344
360
|
for (const part of partRows) {
|
|
@@ -1138,5 +1154,124 @@ function readRawSeedTailFromDb2(db, sessionId, boundaryId) {
|
|
|
1138
1154
|
throw new Error("state_sync materialized boundary is missing from raw storage");
|
|
1139
1155
|
return messages;
|
|
1140
1156
|
}
|
|
1157
|
+
var BOUNDARY_ORDINAL_SQL = `
|
|
1158
|
+
SELECT id, ordinal FROM (
|
|
1159
|
+
SELECT id, ROW_NUMBER() OVER (ORDER BY time_created, id) AS ordinal
|
|
1160
|
+
FROM message
|
|
1161
|
+
WHERE session_id = ?
|
|
1162
|
+
AND typeof(id) = 'text' AND typeof(data) = 'text'
|
|
1163
|
+
AND CASE WHEN json_valid(data) THEN NOT (
|
|
1164
|
+
COALESCE(json_type(data, '$.summary'), '') = 'true'
|
|
1165
|
+
AND COALESCE(json_extract(data, '$.finish'), '') = 'stop'
|
|
1166
|
+
) ELSE 1 END
|
|
1167
|
+
)
|
|
1168
|
+
WHERE id IN (SELECT value FROM json_each(?))`;
|
|
1169
|
+
var BOUNDARY_MESSAGE_SQL = `
|
|
1170
|
+
SELECT id, data, time_created FROM message
|
|
1171
|
+
WHERE +session_id = ? AND id IN (SELECT value FROM json_each(?))`;
|
|
1172
|
+
var BOUNDARY_BLOCK_COUNT_SQL = `
|
|
1173
|
+
SELECT message_id AS id, SUM(
|
|
1174
|
+
CASE
|
|
1175
|
+
WHEN NOT json_valid(data) OR json_type(data) <> 'object' THEN 0
|
|
1176
|
+
ELSE CASE (CASE WHEN json_type(data, '$.type') = 'text'
|
|
1177
|
+
THEN json_extract(data, '$.type') ELSE 'unknown' END)
|
|
1178
|
+
WHEN 'text' THEN CASE WHEN json_type(data, '$.ignored') = 'true' THEN 0 ELSE 1 END
|
|
1179
|
+
WHEN 'reasoning' THEN 1
|
|
1180
|
+
WHEN 'thinking' THEN 1
|
|
1181
|
+
WHEN 'redacted_thinking' THEN 1
|
|
1182
|
+
WHEN 'tool' THEN 1 + CASE
|
|
1183
|
+
WHEN json_type(data, '$.state') = 'object'
|
|
1184
|
+
AND json_type(data, '$.state.status') = 'text'
|
|
1185
|
+
AND json_extract(data, '$.state.status') IN ('completed', 'error')
|
|
1186
|
+
THEN 1 ELSE 0 END
|
|
1187
|
+
WHEN 'compaction' THEN 0
|
|
1188
|
+
WHEN 'step-finish' THEN 0
|
|
1189
|
+
WHEN 'snapshot' THEN 0
|
|
1190
|
+
WHEN 'patch' THEN 0
|
|
1191
|
+
WHEN 'agent' THEN 0
|
|
1192
|
+
WHEN 'retry' THEN 0
|
|
1193
|
+
ELSE 1
|
|
1194
|
+
END
|
|
1195
|
+
END) AS blocks
|
|
1196
|
+
FROM part
|
|
1197
|
+
WHERE +session_id = ?
|
|
1198
|
+
AND message_id IN (SELECT value FROM json_each(?))
|
|
1199
|
+
AND typeof(message_id) = 'text' AND typeof(data) = 'text'
|
|
1200
|
+
GROUP BY message_id`;
|
|
1201
|
+
var boundaryEndpointCaches = new WeakMap;
|
|
1202
|
+
var BOUNDARY_ENDPOINT_CACHE_SESSIONS = 16;
|
|
1203
|
+
var boundaryEndpointRowsRead = 0;
|
|
1204
|
+
function readBoundaryEndpointRows(db, sessionId, ids, blockIds, into) {
|
|
1205
|
+
if (ids.length > 0) {
|
|
1206
|
+
boundaryEndpointRowsRead += ids.length;
|
|
1207
|
+
const wanted = JSON.stringify(ids);
|
|
1208
|
+
const ordinals = new Map;
|
|
1209
|
+
for (const row of db.prepare(BOUNDARY_ORDINAL_SQL).all(sessionId, wanted)) {
|
|
1210
|
+
ordinals.set(row.id, row.ordinal);
|
|
1211
|
+
}
|
|
1212
|
+
const rows = db.prepare(BOUNDARY_MESSAGE_SQL).all(sessionId, wanted);
|
|
1213
|
+
for (const id of ids)
|
|
1214
|
+
into.set(id, null);
|
|
1215
|
+
for (const row of rows) {
|
|
1216
|
+
if (!isRawMessageRow(row) || typeof row.time_created !== "number")
|
|
1217
|
+
continue;
|
|
1218
|
+
const info = parseJsonRecord(row.data);
|
|
1219
|
+
if (!info || isRawCompactionSummaryInfo2(info))
|
|
1220
|
+
continue;
|
|
1221
|
+
into.set(row.id, {
|
|
1222
|
+
ordinal: ordinals.get(row.id) ?? null,
|
|
1223
|
+
createdAt: row.time_created
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
const servable = blockIds.filter((id) => {
|
|
1228
|
+
const endpoint = into.get(id);
|
|
1229
|
+
return endpoint && endpoint.lastBlockIndex === undefined;
|
|
1230
|
+
});
|
|
1231
|
+
if (servable.length === 0)
|
|
1232
|
+
return;
|
|
1233
|
+
const counts = new Map;
|
|
1234
|
+
for (const row of db.prepare(BOUNDARY_BLOCK_COUNT_SQL).all(sessionId, JSON.stringify(servable))) {
|
|
1235
|
+
counts.set(row.id, row.blocks);
|
|
1236
|
+
}
|
|
1237
|
+
for (const id of servable) {
|
|
1238
|
+
const endpoint = into.get(id);
|
|
1239
|
+
if (!endpoint)
|
|
1240
|
+
continue;
|
|
1241
|
+
const blocks = counts.get(id) ?? 0;
|
|
1242
|
+
into.set(id, { ...endpoint, lastBlockIndex: blocks > 0 ? blocks - 1 : 0 });
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
function readRawSessionBoundaryEndpointsFromDb2(db, sessionId, ids, blockIds = []) {
|
|
1246
|
+
const wanted = [...new Set(ids)];
|
|
1247
|
+
const wantedBlocks = [...new Set(blockIds)];
|
|
1248
|
+
let sessions = boundaryEndpointCaches.get(db);
|
|
1249
|
+
if (!sessions) {
|
|
1250
|
+
sessions = new Map;
|
|
1251
|
+
boundaryEndpointCaches.set(db, sessions);
|
|
1252
|
+
}
|
|
1253
|
+
for (let attempt = 1;; attempt += 1) {
|
|
1254
|
+
const before = readStoreStamp(db);
|
|
1255
|
+
const cached = sessions.get(sessionId);
|
|
1256
|
+
const reuse = attempt === 1 && cached && sameStoreStamp(cached.stamp, before);
|
|
1257
|
+
const endpoints = new Map(reuse ? cached.endpoints : []);
|
|
1258
|
+
const missing = wanted.filter((id) => !endpoints.has(id));
|
|
1259
|
+
withReadSnapshot(db, () => readBoundaryEndpointRows(db, sessionId, missing, wantedBlocks, endpoints));
|
|
1260
|
+
const unchanged = before !== null && sameStoreStamp(before, readStoreStamp(db));
|
|
1261
|
+
if (unchanged) {
|
|
1262
|
+
sessions.delete(sessionId);
|
|
1263
|
+
sessions.set(sessionId, { stamp: before, endpoints });
|
|
1264
|
+
while (sessions.size > BOUNDARY_ENDPOINT_CACHE_SESSIONS) {
|
|
1265
|
+
const oldest = sessions.keys().next().value;
|
|
1266
|
+
if (oldest === undefined)
|
|
1267
|
+
break;
|
|
1268
|
+
sessions.delete(oldest);
|
|
1269
|
+
}
|
|
1270
|
+
} else if (reuse) {
|
|
1271
|
+
continue;
|
|
1272
|
+
}
|
|
1273
|
+
return new Map(wanted.map((id) => [id, endpoints.get(id) ?? null]));
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1141
1276
|
|
|
1142
|
-
export { registerExitAbort, unregisterExitAbort, isStrictGapHealingMessage2, isRawCompactionSummaryInfo2, readRawSessionMessagesFromDb2, readRawSessionMessagePageFromDb2, readRawSessionMessageSummaryPageFromDb2, countRawSessionMessageOrdinalsFromDb2, readRawSessionMessageIdOrdinalsForRangeFromDb2, readRawSessionMessageOrdinalPageFromDb2, countStoredRawSessionMessagesFromDb2, readRawSessionTailFromDb2, extractInMemoryMessageViews2, buildInMemoryTailRawMessages2, readRawSessionMessagePartsByIdFromDb2, forgetRawSessionOrdinalWatermark2, forgetRawSessionSummaryRows2, noteRawSessionSummaryRowWritten2, rawOrdinalSummarySeed2, scanRawSessionSummaryRows2, getRawSessionSummaryEpoch2, installRawSessionSummaryScan2, isRawSessionSummaryWarm2, readRawSessionMessageOrdinalByIdFromDb2, readRawSessionMessageByIdFromDb2, hasRawSessionMessageByIdFromDb2, readRawSeedTailFromDb2, runSessionWarmupWorker, prewarmRawSessionOrdinalsForDb };
|
|
1277
|
+
export { registerExitAbort, unregisterExitAbort, isStrictGapHealingMessage2, isRawCompactionSummaryInfo2, readRawSessionMessagesFromDb2, readRawSessionMessagePageFromDb2, readRawSessionMessageSummaryPageFromDb2, countRawSessionMessageOrdinalsFromDb2, readRawSessionMessageIdOrdinalsForRangeFromDb2, readRawSessionMessageOrdinalPageFromDb2, countStoredRawSessionMessagesFromDb2, readRawSessionTailFromDb2, extractInMemoryMessageViews2, buildInMemoryTailRawMessages2, readRawSessionMessagePartsByIdFromDb2, forgetRawSessionOrdinalWatermark2, forgetRawSessionSummaryRows2, noteRawSessionSummaryRowWritten2, rawOrdinalSummarySeed2, scanRawSessionSummaryRows2, getRawSessionSummaryEpoch2, installRawSessionSummaryScan2, isRawSessionSummaryWarm2, readRawSessionMessageOrdinalByIdFromDb2, readRawSessionMessageByIdFromDb2, hasRawSessionMessageByIdFromDb2, readRawSeedTailFromDb2, readRawSessionBoundaryEndpointsFromDb2, runSessionWarmupWorker, prewarmRawSessionOrdinalsForDb };
|