@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
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./server-zm570tr2.js";
|
|
4
1
|
import {
|
|
5
2
|
withSqliteBackgroundWriter2,
|
|
6
3
|
withoutSqliteTransformPass2,
|
|
7
4
|
isTransientSqliteError2
|
|
8
5
|
} from "./server-kb9nn0a0.js";
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
8
|
+
} from "./server-cw6521wn.js";
|
|
9
9
|
import {
|
|
10
10
|
isEmbeddingHostBusy2
|
|
11
11
|
} from "./server-qt1qqasc.js";
|
|
@@ -15,16 +15,16 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
sanitizeDiagnosticText,
|
|
17
17
|
log2
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-t4k4qexw.js";
|
|
19
19
|
import {
|
|
20
20
|
estimateTokens
|
|
21
|
-
} from "./server-
|
|
21
|
+
} from "./server-kzns2hbz.js";
|
|
22
22
|
import {
|
|
23
23
|
SYNAPSE_DEFAULT_MODEL,
|
|
24
24
|
isSynapseEmbeddingTruncated,
|
|
25
25
|
getSynapseBatchRequestKey,
|
|
26
26
|
SynapseEmbeddingProvider
|
|
27
|
-
} from "./server-
|
|
27
|
+
} from "./server-hb6xhh9q.js";
|
|
28
28
|
import {
|
|
29
29
|
CHUNK_WINDOW_SAFETY_RATIO,
|
|
30
30
|
normalizeCompartmentChunkMaxInputTokens,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
loadUnembeddedSessionChunkCandidatesPolite,
|
|
41
41
|
countSessionCompartmentEmbedCoverage,
|
|
42
42
|
countUnembeddedSessionCompartmentsPolite
|
|
43
|
-
} from "./server-
|
|
43
|
+
} from "./server-s2st631p.js";
|
|
44
44
|
import {
|
|
45
45
|
saveEmbeddingIfHashMatches,
|
|
46
46
|
getMemoryEmbedCoverage,
|
|
@@ -52,14 +52,35 @@ import {
|
|
|
52
52
|
resolveEmbeddingTextPrefixes,
|
|
53
53
|
getEmbeddingProviderIdentity,
|
|
54
54
|
LocalEmbeddingProvider
|
|
55
|
-
} from "./server-
|
|
55
|
+
} from "./server-ras2sxnc.js";
|
|
56
56
|
import {
|
|
57
57
|
isUserHomeDirectory,
|
|
58
58
|
setBootQuietPeriodForTests
|
|
59
|
-
} from "./server-
|
|
59
|
+
} from "./server-8xmq9h3f.js";
|
|
60
60
|
import {
|
|
61
61
|
logSlowWriteTransaction
|
|
62
|
-
} from "./server-
|
|
62
|
+
} from "./server-3t0q2cqx.js";
|
|
63
|
+
|
|
64
|
+
// src/shared/background-batch-drain.ts
|
|
65
|
+
async function drainBackgroundBatches(step, options = {}) {
|
|
66
|
+
const now = options.now ?? (() => performance.now());
|
|
67
|
+
const deadline = now() + (options.budgetMs ?? 2000);
|
|
68
|
+
const yieldFn = options.yieldFn ?? (() => new Promise((resolve) => setTimeout(resolve, 0)));
|
|
69
|
+
let batches = 0;
|
|
70
|
+
while (now() < deadline) {
|
|
71
|
+
try {
|
|
72
|
+
if (!withoutSqliteTransformPass2(() => withSqliteBackgroundWriter2(step)))
|
|
73
|
+
break;
|
|
74
|
+
} catch (error) {
|
|
75
|
+
if (isTransientSqliteError2(error))
|
|
76
|
+
break;
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
batches++;
|
|
80
|
+
await yieldFn();
|
|
81
|
+
}
|
|
82
|
+
return batches;
|
|
83
|
+
}
|
|
63
84
|
|
|
64
85
|
// src/features/magic-context/storage-embedding-measurements.ts
|
|
65
86
|
import { createHash } from "node:crypto";
|
|
@@ -121,27 +142,6 @@ function pruneSynapseBatchLedgerForProject(db, projectIdentity, ttlMs = SYNAPSE_
|
|
|
121
142
|
// src/features/magic-context/project-embedding-registry.ts
|
|
122
143
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
123
144
|
|
|
124
|
-
// src/shared/background-batch-drain.ts
|
|
125
|
-
async function drainBackgroundBatches(step, options = {}) {
|
|
126
|
-
const now = options.now ?? (() => performance.now());
|
|
127
|
-
const deadline = now() + (options.budgetMs ?? 2000);
|
|
128
|
-
const yieldFn = options.yieldFn ?? (() => new Promise((resolve) => setTimeout(resolve, 0)));
|
|
129
|
-
let batches = 0;
|
|
130
|
-
while (now() < deadline) {
|
|
131
|
-
try {
|
|
132
|
-
if (!withoutSqliteTransformPass2(() => withSqliteBackgroundWriter2(step)))
|
|
133
|
-
break;
|
|
134
|
-
} catch (error) {
|
|
135
|
-
if (isTransientSqliteError2(error))
|
|
136
|
-
break;
|
|
137
|
-
throw error;
|
|
138
|
-
}
|
|
139
|
-
batches++;
|
|
140
|
-
await yieldFn();
|
|
141
|
-
}
|
|
142
|
-
return batches;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
145
|
// src/features/magic-context/git-commits/storage-git-commit-embeddings.ts
|
|
146
146
|
var saveStatements = new WeakMap;
|
|
147
147
|
var loadProjectStatements = new WeakMap;
|
|
@@ -3020,4 +3020,4 @@ function _resetProjectEmbeddingRegistryForTests2() {
|
|
|
3020
3020
|
setBootQuietPeriodForTests(null);
|
|
3021
3021
|
}
|
|
3022
3022
|
|
|
3023
|
-
export {
|
|
3023
|
+
export { drainBackgroundBatches, recordEmbeddingMeasurement, saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitSha, enforceProjectCap, GIT_SWEEP_LEASE_RENEWAL_MS, acquireGitSweepLease, renewGitSweepLease, markGitSweepSuccessAndRelease, parkGitSweepNonIndexable, releaseGitSweepLease, OpenAICompatibleEmbeddingProvider, recordSessionProjectIdentity, hasRecordedSessionProjectIdentity, describeShadowBackfillWriteRefusal2, listShadowBackfillStalls2, getShadowBackfillStopReason2, markProjectLoadUntrusted2, contentSha2562, drainProjectEmbeddingIdentityMaintenance2, drainStaleEmbeddingIdentitiesForProject2, registerProjectEmbedding2, registerProjectShadowEmbedding2, getShadowEmbeddingMeasurementCohort2, getPrimaryEmbeddingMeasurementCohort2, embedShadowTextForProject2, enqueueShadowEmbeddingItems2, getShadowBackfillRemaining2, flushShadowEmbeddingBacklog2, registerProjectInObservationMode2, unregisterProjectShadowEmbedding2, unregisterProjectEmbedding2, getProjectEmbeddingSnapshot2, installProjectEmbeddingSearchBridge2, getProjectChunkEmbeddingModelId2, getProjectEmbeddingMaxInputTokens2, embedTextForProject2, embedBatchForProject2, embedItemsForProject2, embedUnembeddedMemoriesForProject2, embedUnembeddedMemoriesForProjectOutcome2, drainCommitBacklogForProject2, embedUnembeddedCompartmentChunksForProject2, embedSessionCompartmentChunks2, getEmbeddingCoverageStatus2, sweepAllRegisteredProjects2, _setTestProviderFactoryForProject2, _resetProjectEmbeddingRegistryForTests2 };
|
|
@@ -4,7 +4,31 @@ import {
|
|
|
4
4
|
} from "./server-kb9nn0a0.js";
|
|
5
5
|
import {
|
|
6
6
|
logSlowWriteTransaction
|
|
7
|
-
} from "./server-
|
|
7
|
+
} from "./server-3t0q2cqx.js";
|
|
8
|
+
|
|
9
|
+
// src/shared/project-directory-key.ts
|
|
10
|
+
import { realpathSync } from "node:fs";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
function projectDirectoryKey(directory) {
|
|
13
|
+
const slashed = directory.replaceAll("\\", "/").replace(/^\/\/\?\/UNC\//i, "//").replace(/^\/\/\?\//, "");
|
|
14
|
+
if (/^[a-z]:\//i.test(slashed) || slashed.startsWith("//")) {
|
|
15
|
+
return path.win32.normalize(slashed).replaceAll("\\", "/").replace(/\/$/, "").toLowerCase();
|
|
16
|
+
}
|
|
17
|
+
return path.resolve(directory);
|
|
18
|
+
}
|
|
19
|
+
function sameProjectDirectory(a, b) {
|
|
20
|
+
if (a.length === 0 || b.length === 0)
|
|
21
|
+
return false;
|
|
22
|
+
return projectDirectoryKey(a) === projectDirectoryKey(b);
|
|
23
|
+
}
|
|
24
|
+
var realpathForCanonicalDirectory = (directory) => realpathSync.native(directory);
|
|
25
|
+
function canonicalProjectDirectory(directory) {
|
|
26
|
+
let resolved = directory;
|
|
27
|
+
try {
|
|
28
|
+
resolved = realpathForCanonicalDirectory(directory);
|
|
29
|
+
} catch {}
|
|
30
|
+
return projectDirectoryKey(resolved);
|
|
31
|
+
}
|
|
8
32
|
|
|
9
33
|
// src/features/magic-context/message-fts-rowid-map.ts
|
|
10
34
|
import { createHash } from "node:crypto";
|
|
@@ -168,4 +192,4 @@ function deleteUnmappedMessageFtsRows(db, sessionIds) {
|
|
|
168
192
|
WHERE rowid > ? AND session_id IN (${placeholders})`).run(state.watermarkRowid, ...sessionIds);
|
|
169
193
|
}
|
|
170
194
|
|
|
171
|
-
export { recordMessageFtsRowid, recordIndexedMessageTime, startMessageFtsRowidMapBackfill, messageFtsOrdinalRangeIsMapped, deleteUnmappedMessageFtsRows };
|
|
195
|
+
export { projectDirectoryKey, sameProjectDirectory, canonicalProjectDirectory, recordMessageFtsRowid, recordIndexedMessageTime, startMessageFtsRowidMapBackfill, messageFtsOrdinalRangeIsMapped, deleteUnmappedMessageFtsRows };
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
} from "./server-1zx87sdm.js";
|
|
5
5
|
import {
|
|
6
6
|
estimateTokens
|
|
7
|
-
} from "./server-
|
|
7
|
+
} from "./server-kzns2hbz.js";
|
|
8
8
|
import {
|
|
9
9
|
getHarness2
|
|
10
10
|
} from "./server-pavzsdc6.js";
|
|
11
11
|
import {
|
|
12
12
|
sessionLog2
|
|
13
|
-
} from "./server-
|
|
13
|
+
} from "./server-t4k4qexw.js";
|
|
14
14
|
import {
|
|
15
15
|
getTagIdentityWriteGeneration2,
|
|
16
16
|
getSqliteDatabasePath2
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
stableStringify,
|
|
20
20
|
tagOrderConstraintIndex,
|
|
21
21
|
tagIdentityRevisionKey
|
|
22
|
-
} from "./server-
|
|
22
|
+
} from "./server-6byqfbqf.js";
|
|
23
23
|
import {
|
|
24
24
|
DEFAULT_PROTECTED_TOOLS,
|
|
25
25
|
normalizeProtectedToolName,
|
|
@@ -62,10 +62,34 @@ function protectedToolTokenCount(tags, counts, calibration) {
|
|
|
62
62
|
var encoder = new TextEncoder;
|
|
63
63
|
var TAG_PREFIX_REGEX = /^(?:§\d+§\s*)+/;
|
|
64
64
|
var MALFORMED_TAG_PREFIX_REGEX = /^(?:§\d+">§(?:\d+§)?\s*)+/;
|
|
65
|
+
var DANGLING_TAG_GLOBAL_REGEX = /\u00a7\d+(?!\.\d)[^\s\u00a7\w.]?/g;
|
|
65
66
|
var DANGLING_TAG_PREFIX_REGEX = /^(?:\u00a7\d+(?!\.\d)[^\s\u00a7\w.]?\s*)+/;
|
|
67
|
+
var COMPLETE_TAG_PAIR_GLOBAL_REGEX = /\u00a7\d+\u00a7/g;
|
|
68
|
+
var MALFORMED_TAG_GLOBAL_REGEX = /\u00a7\d+">(?:\u00a7(?:\d+\u00a7)?)?/g;
|
|
69
|
+
var STRAY_SECTION_CHAR_REGEX = /\u00a7/g;
|
|
66
70
|
function stripWellFormedLeadingTagPrefix(value) {
|
|
67
71
|
return value.replace(/^(\u00a7\d+\u00a7\s*)+/, "");
|
|
68
72
|
}
|
|
73
|
+
function stripCompleteTagPairsGlobally(value) {
|
|
74
|
+
return value.replace(COMPLETE_TAG_PAIR_GLOBAL_REGEX, "");
|
|
75
|
+
}
|
|
76
|
+
function stripMalformedTagNotationGlobally(value) {
|
|
77
|
+
return value.replace(MALFORMED_TAG_GLOBAL_REGEX, "");
|
|
78
|
+
}
|
|
79
|
+
function stripDanglingTagNotationGlobally(value) {
|
|
80
|
+
return value.replace(DANGLING_TAG_GLOBAL_REGEX, "");
|
|
81
|
+
}
|
|
82
|
+
function stripTagSectionCharacters(value) {
|
|
83
|
+
return value.replace(STRAY_SECTION_CHAR_REGEX, "");
|
|
84
|
+
}
|
|
85
|
+
function stripPersistedAssistantText(value) {
|
|
86
|
+
let text = stripWellFormedLeadingTagPrefix(value);
|
|
87
|
+
text = stripCompleteTagPairsGlobally(text);
|
|
88
|
+
text = stripMalformedTagNotationGlobally(text);
|
|
89
|
+
text = stripDanglingTagNotationGlobally(text);
|
|
90
|
+
text = stripTagSectionCharacters(text);
|
|
91
|
+
return text.trim();
|
|
92
|
+
}
|
|
69
93
|
function byteSize(value) {
|
|
70
94
|
return encoder.encode(value).length;
|
|
71
95
|
}
|
|
@@ -2402,6 +2426,15 @@ function readTagIdentityRevision(db, sessionId) {
|
|
|
2402
2426
|
const row = db.prepare("SELECT value FROM schema_migrations_meta WHERE key = ?").get(tagIdentityRevisionKey(sessionId));
|
|
2403
2427
|
return typeof row?.value === "string" ? row.value : null;
|
|
2404
2428
|
}
|
|
2429
|
+
function captureInitialTagOwnerRevision(db, sessionId, cached, appendedRows) {
|
|
2430
|
+
if (cached.identityRevision !== null || appendedRows === 0)
|
|
2431
|
+
return true;
|
|
2432
|
+
const revision = readTagIdentityRevision(db, sessionId);
|
|
2433
|
+
if (revision !== null && !/^[1-9]\d*:0$/.test(revision))
|
|
2434
|
+
return false;
|
|
2435
|
+
cached.identityRevision = revision;
|
|
2436
|
+
return true;
|
|
2437
|
+
}
|
|
2405
2438
|
function appendedSinceForeignCommit(db, sessionId, cached) {
|
|
2406
2439
|
tagOwnerShapeChecks += 1;
|
|
2407
2440
|
const rows = db.prepare(TAG_OWNER_APPENDED_WITH_SHAPE_SQL).all(cached.globalLastRowId, sessionId, tagIdentityRevisionKey(sessionId), sessionId);
|
|
@@ -2442,6 +2475,11 @@ function readTagOwnerSummary(db, sessionId, proseRatio, extraRatios = []) {
|
|
|
2442
2475
|
rows.push(...page);
|
|
2443
2476
|
}
|
|
2444
2477
|
}
|
|
2478
|
+
if (!captureInitialTagOwnerRevision(db, sessionId, cached, rows.length)) {
|
|
2479
|
+
if (offThreadOnly)
|
|
2480
|
+
throw new TagOwnerSummaryNotReady;
|
|
2481
|
+
rows = null;
|
|
2482
|
+
}
|
|
2445
2483
|
} else {
|
|
2446
2484
|
if (offThreadOnly)
|
|
2447
2485
|
db.exec("BEGIN");
|
|
@@ -2571,7 +2609,7 @@ function getTagNumberByMessageIdStatement(db) {
|
|
|
2571
2609
|
function getAssignableTagNumberByMessageIdStatement(db) {
|
|
2572
2610
|
let stmt = getAssignableTagNumberByMessageIdStatements.get(db);
|
|
2573
2611
|
if (!stmt) {
|
|
2574
|
-
stmt = db.prepare(`SELECT tag_number FROM tags
|
|
2612
|
+
stmt = db.prepare(`SELECT tag_number FROM tags INDEXED BY idx_tags_session_message_id
|
|
2575
2613
|
WHERE session_id = ?
|
|
2576
2614
|
AND message_id = ?
|
|
2577
2615
|
AND NOT (
|
|
@@ -2672,6 +2710,28 @@ function getInertWhitespaceAssistantTags2(db, sessionId, messageIds) {
|
|
|
2672
2710
|
return contentId.length > 0 ? [{ tagNumber: row.tagNumber, contentId }] : [];
|
|
2673
2711
|
});
|
|
2674
2712
|
}
|
|
2713
|
+
var inertWhitespaceByNumberStatements = new WeakMap;
|
|
2714
|
+
function getInertWhitespaceAssistantTagsByNumbers2(db, sessionId, tagNumbers) {
|
|
2715
|
+
if (tagNumbers.length === 0)
|
|
2716
|
+
return [];
|
|
2717
|
+
let statement = inertWhitespaceByNumberStatements.get(db);
|
|
2718
|
+
if (!statement) {
|
|
2719
|
+
statement = db.prepare(`SELECT tags.tag_number AS tagNumber, tags.entry_fingerprint AS entryFingerprint
|
|
2720
|
+
FROM json_each(?) AS wanted CROSS JOIN tags
|
|
2721
|
+
WHERE tags.session_id = ?
|
|
2722
|
+
AND tags.tag_number = wanted.value
|
|
2723
|
+
AND tags.type = 'message'
|
|
2724
|
+
AND tags.status = 'compacted'
|
|
2725
|
+
AND tags.entry_fingerprint LIKE ?
|
|
2726
|
+
ORDER BY tags.tag_number, tags.id`);
|
|
2727
|
+
inertWhitespaceByNumberStatements.set(db, statement);
|
|
2728
|
+
}
|
|
2729
|
+
const rows = statement.all(JSON.stringify([...new Set(tagNumbers)]), sessionId, `${WHITESPACE_ASSISTANT_INERT_FINGERPRINT_PREFIX}%`);
|
|
2730
|
+
return rows.flatMap((row) => {
|
|
2731
|
+
const contentId = row.entryFingerprint.slice(WHITESPACE_ASSISTANT_INERT_FINGERPRINT_PREFIX.length);
|
|
2732
|
+
return contentId.length > 0 ? [{ tagNumber: row.tagNumber, contentId }] : [];
|
|
2733
|
+
});
|
|
2734
|
+
}
|
|
2675
2735
|
function updateTagDropMode2(db, sessionId, tagNumber, dropMode) {
|
|
2676
2736
|
getUpdateTagDropModeStatement(db).run(dropMode, sessionId, tagNumber);
|
|
2677
2737
|
}
|
|
@@ -3100,7 +3160,8 @@ function markTagsCompactedByMessageIds2(db, sessionId, messageIds, eligibleTagNu
|
|
|
3100
3160
|
SELECT value AS source_id, lower(value) AS folded_id FROM json_each(?)
|
|
3101
3161
|
)
|
|
3102
3162
|
SELECT id, tag_number, message_id, tool_owner_message_id FROM tags INDEXED BY ${tagOrderConstraintIndex(db)}
|
|
3103
|
-
WHERE session_id = ? AND
|
|
3163
|
+
WHERE session_id = ? ${eligibleTagNumbers ? "AND tag_number IN (SELECT value FROM json_each(?))" : ""}
|
|
3164
|
+
AND status IN ('active', 'dropped') AND (
|
|
3104
3165
|
message_id IN (SELECT source_id FROM ids)
|
|
3105
3166
|
OR tool_owner_message_id IN (SELECT source_id FROM ids)
|
|
3106
3167
|
OR (instr(lower(message_id), ':p') > 0 AND
|
|
@@ -3109,7 +3170,7 @@ function markTagsCompactedByMessageIds2(db, sessionId, messageIds, eligibleTagNu
|
|
|
3109
3170
|
lower(substr(message_id, 1, instr(lower(message_id), ':file') - 1)) IN (SELECT folded_id FROM ids))
|
|
3110
3171
|
OR (? AND instr(message_id, ':') > 0)
|
|
3111
3172
|
OR ?
|
|
3112
|
-
)`).all(JSON.stringify(Array.from(ids)), sessionId, Array.from(ids).some((id) => id.includes(":")) ? 1 : 0, nulPrefixes.size > 0 ? 1 : 0);
|
|
3173
|
+
)`).all(JSON.stringify(Array.from(ids)), sessionId, ...eligibleTagNumbers ? [JSON.stringify([...eligibleTagNumbers])] : [], Array.from(ids).some((id) => id.includes(":")) ? 1 : 0, nulPrefixes.size > 0 ? 1 : 0);
|
|
3113
3174
|
const candidates = rows.filter((row) => (eligibleTagNumbers === undefined || eligibleTagNumbers.has(row.tag_number)) && matches(row.message_id, row.tool_owner_message_id));
|
|
3114
3175
|
if (candidates.length === 0)
|
|
3115
3176
|
return 0;
|
|
@@ -3505,4 +3566,4 @@ function deleteToolTagsByOwner(db, sessionId, ownerMsgId) {
|
|
|
3505
3566
|
return getDeleteToolTagsByOwnerStatement(db).all(sessionId, ownerMsgId).length;
|
|
3506
3567
|
}
|
|
3507
3568
|
|
|
3508
|
-
export { protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, isThinkingPart, isRecord, contentTagOwnerMessageId, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, providerVisiblePart, providerVisibleMessage, normalizeTodoStateJson, buildSyntheticTodoPart, computeSyntheticCallId, isSyntheticTodoPart, countRealUserMessages, tailHygieneStructuralSignature, sameTailHygieneStructuralSignature, formatTailHygienePrefixMismatch, refreshTailHygieneBaseline, effectiveTailHygiene, assertTailHygieneContentUnchangedIfEnabled, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, isDroppedToolOutput, toolOutputTokens, decideChannel1, evaluateChannel2, formatChannel1Evaluation, formatChannel2Evaluation, reclaimableToolOutputCount, buildChannel2Reminder, buildChannel1Reminder, estimateEmergencyDropReclaimTokens, planEmergencyDrop, measureEmergencyTag, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, hasPendingDropOps, getPendingOpsCount, clearPendingOps, removePendingOp, getRecentTagOwnerMessageIds2, getActiveTagTokenAggregate2, AGE_RECLAIM_MIN_TOKENS2, getOldestActiveUnprotectedToolTags2, getActiveToolTagsForAgeReclaim2, getTriggerTagTokenUpperBound2, getActiveTagTokenTotalsByMessage2, getPersistedToolTagAccounting2, getAllStatusTagTokenTotalsFlat2, getReasoningTokenEstimatesByMessage2, tryGetReasoningTokenEstimatesByMessage2, getMaxTagNumberByOwnerMessage2, scanTagOwnerSummary2, cachedTagOwnerRatios2, tagOwnerWarmupState2, scanTagOwnerDelta2, installTagOwnerDelta2, installTagOwnerSummary2, isTagOwnerSummaryReady2, tagTokenCountIsNull2, backfillTagTokenCounts2, insertTag2, updateTagStatus2, markWhitespaceAssistantTagInert2, getInertWhitespaceAssistantTags2, updateTagDropMode2, updateCavemanDepth2, updateTagMessageId2, hasPiFallbackMessageTags2, findAdoptableFallbackTags2, adoptFallbackTagMessageId2, foldShrunkPartTags2, hasPiFallbackToolOwnerTags2, findPiFallbackToolOwnerTags2, adoptPiFallbackToolOwnerTag2, adoptPiFallbackMessageTag2, markTagsCompactedByMessageIds2, deleteTagsByMessageId2, getMaxTagNumberBySession2, getTagNumberByMessageId2, getAssignableTagNumberByMessageId2, getMinMessageTagNumberForRawId2, deriveTagLoadFloor2, TAG_SELECT_COLUMNS2, getTagsBySession2, getActiveTagsBySession2, getTailHygieneTags2, getDroppedTagsBySession2, getTagsForPendingOperations2, getTagsByNumbers2, getNewestToolTagNumbers2, getDroppedTagsByNumbers2, getMaxDroppedTagNumber2, getTagById2, getTopNBySize2, getToolTagNumberByOwner2, getNullOwnerToolTag2, adoptNullOwnerToolTag2, getCandidateToolOwners2, pickNearestPriorOwner2 };
|
|
3569
|
+
export { protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, isThinkingPart, isRecord, contentTagOwnerMessageId, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, providerVisiblePart, providerVisibleMessage, normalizeTodoStateJson, buildSyntheticTodoPart, computeSyntheticCallId, isSyntheticTodoPart, countRealUserMessages, tailHygieneStructuralSignature, sameTailHygieneStructuralSignature, formatTailHygienePrefixMismatch, refreshTailHygieneBaseline, effectiveTailHygiene, assertTailHygieneContentUnchangedIfEnabled, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, isDroppedToolOutput, toolOutputTokens, decideChannel1, evaluateChannel2, formatChannel1Evaluation, formatChannel2Evaluation, reclaimableToolOutputCount, buildChannel2Reminder, buildChannel1Reminder, estimateEmergencyDropReclaimTokens, planEmergencyDrop, measureEmergencyTag, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, hasPendingDropOps, getPendingOpsCount, clearPendingOps, removePendingOp, getRecentTagOwnerMessageIds2, getActiveTagTokenAggregate2, AGE_RECLAIM_MIN_TOKENS2, getOldestActiveUnprotectedToolTags2, getActiveToolTagsForAgeReclaim2, getTriggerTagTokenUpperBound2, getActiveTagTokenTotalsByMessage2, getPersistedToolTagAccounting2, getAllStatusTagTokenTotalsFlat2, getReasoningTokenEstimatesByMessage2, tryGetReasoningTokenEstimatesByMessage2, getMaxTagNumberByOwnerMessage2, scanTagOwnerSummary2, cachedTagOwnerRatios2, tagOwnerWarmupState2, scanTagOwnerDelta2, installTagOwnerDelta2, installTagOwnerSummary2, isTagOwnerSummaryReady2, tagTokenCountIsNull2, backfillTagTokenCounts2, insertTag2, updateTagStatus2, markWhitespaceAssistantTagInert2, getInertWhitespaceAssistantTags2, getInertWhitespaceAssistantTagsByNumbers2, updateTagDropMode2, updateCavemanDepth2, updateTagMessageId2, hasPiFallbackMessageTags2, findAdoptableFallbackTags2, adoptFallbackTagMessageId2, foldShrunkPartTags2, hasPiFallbackToolOwnerTags2, findPiFallbackToolOwnerTags2, adoptPiFallbackToolOwnerTag2, adoptPiFallbackMessageTag2, markTagsCompactedByMessageIds2, deleteTagsByMessageId2, getMaxTagNumberBySession2, getTagNumberByMessageId2, getAssignableTagNumberByMessageId2, getMinMessageTagNumberForRawId2, deriveTagLoadFloor2, TAG_SELECT_COLUMNS2, getTagsBySession2, getActiveTagsBySession2, getTailHygieneTags2, getDroppedTagsBySession2, getTagsForPendingOperations2, getTagsByNumbers2, getNewestToolTagNumbers2, getDroppedTagsByNumbers2, getMaxDroppedTagNumber2, getTagById2, getTopNBySize2, getToolTagNumberByOwner2, getNullOwnerToolTag2, adoptNullOwnerToolTag2, getCandidateToolOwners2, pickNearestPriorOwner2 };
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
importPluginModule,
|
|
6
6
|
sessionLog2
|
|
7
|
-
} from "./server-
|
|
7
|
+
} from "./server-t4k4qexw.js";
|
|
8
8
|
import {
|
|
9
9
|
isDefaultSessionTitle2
|
|
10
|
-
} from "./server-
|
|
10
|
+
} from "./server-676xw7at.js";
|
|
11
11
|
import {
|
|
12
12
|
shouldHoldIgnoredNotification
|
|
13
|
-
} from "./server-
|
|
13
|
+
} from "./server-czb2rkpk.js";
|
|
14
14
|
import {
|
|
15
15
|
getErrorMessage
|
|
16
16
|
} from "./server-y8v6yerm.js";
|
|
@@ -142,7 +142,7 @@ async function sendIgnoredMessageNow(client, sessionId, text, params, forcePersi
|
|
|
142
142
|
holdIgnoredNotification({ client, sessionId, text, params, forcePersist }, "during target checks");
|
|
143
143
|
return "queued";
|
|
144
144
|
}
|
|
145
|
-
const { waitForSafeNotificationTarget } = await importPluginModule(() => import("./safe-notification-target-
|
|
145
|
+
const { waitForSafeNotificationTarget } = await importPluginModule(() => import("./safe-notification-target-y3p1hce9.js"));
|
|
146
146
|
if (await waitForSafeNotificationTarget(client, sessionId) === "skip") {
|
|
147
147
|
sessionLog2(sessionId, "notification skipped (session not titled yet)");
|
|
148
148
|
return "skipped";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sessionLog2
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-t4k4qexw.js";
|
|
4
4
|
import {
|
|
5
5
|
isKnownAutocommit
|
|
6
6
|
} from "./server-8ajstryz.js";
|
|
@@ -353,12 +353,42 @@ function tagOrderConstraintIndex(db) {
|
|
|
353
353
|
|
|
354
354
|
// src/features/magic-context/storage-tag-identity-revision.ts
|
|
355
355
|
var TAG_IDENTITY_REVISION_PREFIX = "tag_identity_revision:";
|
|
356
|
+
var TAG_REVISION_PREFIX = "tag_revision:";
|
|
357
|
+
var TAG_TOMBSTONE_OWNER_PREFIX = "tag_revision_owner:";
|
|
358
|
+
var TAG_REVISION_INCARNATION_KEY = "tag_revision_incarnation";
|
|
359
|
+
var tagRevisionIncarnationSql = (value) => `CASE WHEN INSTR(${value}, ':') > 0 THEN SUBSTR(${value}, 1, INSTR(${value}, ':') - 1) ELSE '0' END`;
|
|
360
|
+
var tagRevisionCountSql = (value) => `CAST(CASE WHEN INSTR(${value}, ':') > 0 THEN SUBSTR(${value}, INSTR(${value}, ':') + 1) ELSE ${value} END AS INTEGER)`;
|
|
361
|
+
var ADVANCE = (delta = "1") => `CASE
|
|
362
|
+
WHEN ${tagRevisionCountSql("value")} <= 9223372036854775807 - ${delta}
|
|
363
|
+
THEN (${tagRevisionIncarnationSql("value")}) || ':' || CAST(${tagRevisionCountSql("value")} + ${delta} AS TEXT)
|
|
364
|
+
ELSE NULL END`;
|
|
365
|
+
function tagTombstoneOwnerRange(sessionId) {
|
|
366
|
+
const stem = `${TAG_TOMBSTONE_OWNER_PREFIX}${JSON.stringify(sessionId)}`;
|
|
367
|
+
return [`${stem}:`, `${stem};`];
|
|
368
|
+
}
|
|
369
|
+
function tagTombstoneOwnerKey(sessionId, harness) {
|
|
370
|
+
return `${tagTombstoneOwnerRange(sessionId)[0]}${harness}`;
|
|
371
|
+
}
|
|
372
|
+
function tagRevisionKey(sessionId) {
|
|
373
|
+
return `${TAG_REVISION_PREFIX}${sessionId}`;
|
|
374
|
+
}
|
|
356
375
|
function tagIdentityRevisionKey(sessionId) {
|
|
357
376
|
return `${TAG_IDENTITY_REVISION_PREFIX}${sessionId}`;
|
|
358
377
|
}
|
|
359
|
-
var BUMP = (session) => `INSERT INTO schema_migrations_meta (key, value)
|
|
360
|
-
VALUES ('${
|
|
361
|
-
ON CONFLICT(key) DO UPDATE SET value =
|
|
378
|
+
var BUMP = (session, prefix = TAG_IDENTITY_REVISION_PREFIX) => `INSERT INTO schema_migrations_meta (key, value)
|
|
379
|
+
VALUES ('${prefix}' || ${session}, '1')
|
|
380
|
+
ON CONFLICT(key) DO UPDATE SET value = ${ADVANCE()}`;
|
|
381
|
+
var TAG_INSERT_CONFLICT_ROWS = `SELECT id, session_id, tag_number FROM tags WHERE id = NEW.id
|
|
382
|
+
UNION SELECT id, session_id, tag_number FROM tags WHERE session_id = NEW.session_id AND tag_number = NEW.tag_number
|
|
383
|
+
UNION SELECT id, session_id, tag_number FROM tags
|
|
384
|
+
WHERE NEW.type = 'tool' AND NEW.tool_owner_message_id IS NOT NULL
|
|
385
|
+
AND type = 'tool' AND tool_owner_message_id IS NOT NULL
|
|
386
|
+
AND session_id = NEW.session_id AND message_id = NEW.message_id
|
|
387
|
+
AND tool_owner_message_id = NEW.tool_owner_message_id`;
|
|
388
|
+
var BUMP_INSERT_CONFLICTS = (prefix) => `INSERT INTO schema_migrations_meta (key, value)
|
|
389
|
+
SELECT '${prefix}' || session_id, CAST(COUNT(*) AS TEXT)
|
|
390
|
+
FROM (${TAG_INSERT_CONFLICT_ROWS}) GROUP BY session_id
|
|
391
|
+
ON CONFLICT(key) DO UPDATE SET value = ${ADVANCE("CAST(excluded.value AS INTEGER)")}`;
|
|
362
392
|
var TRIGGER_SQL = `CREATE TEMP TRIGGER IF NOT EXISTS mc_tag_identity_revision_au
|
|
363
393
|
AFTER UPDATE OF id, session_id, message_id, tag_number, type, tool_owner_message_id, reasoning_token_count
|
|
364
394
|
ON main.tags
|
|
@@ -367,15 +397,69 @@ var TRIGGER_SQL = `CREATE TEMP TRIGGER IF NOT EXISTS mc_tag_identity_revision_au
|
|
|
367
397
|
INSERT INTO schema_migrations_meta (key, value)
|
|
368
398
|
SELECT '${TAG_IDENTITY_REVISION_PREFIX}' || NEW.session_id, '1'
|
|
369
399
|
WHERE NEW.session_id IS NOT OLD.session_id
|
|
370
|
-
ON CONFLICT(key) DO UPDATE SET value =
|
|
400
|
+
ON CONFLICT(key) DO UPDATE SET value = ${ADVANCE()};
|
|
371
401
|
END`;
|
|
372
402
|
function installTagIdentityRevisionTrigger(db) {
|
|
403
|
+
db.exec(`DROP TRIGGER IF EXISTS temp.mc_tag_identity_revision_au;
|
|
404
|
+
DROP TRIGGER IF EXISTS temp.mc_tag_revision_bi;
|
|
405
|
+
DROP TRIGGER IF EXISTS temp.mc_tag_revision_ai;
|
|
406
|
+
DROP TRIGGER IF EXISTS temp.mc_tag_revision_au;
|
|
407
|
+
DROP TRIGGER IF EXISTS temp.mc_tag_revision_ad;
|
|
408
|
+
DROP TRIGGER IF EXISTS temp.mc_tag_revision_seed_ai;`);
|
|
409
|
+
db.exec(`CREATE TEMP TRIGGER mc_tag_revision_seed_ai AFTER INSERT ON main.schema_migrations_meta
|
|
410
|
+
WHEN INSTR(NEW.value, ':') = 0 AND (
|
|
411
|
+
SUBSTR(NEW.key, 1, ${TAG_REVISION_PREFIX.length}) = '${TAG_REVISION_PREFIX}'
|
|
412
|
+
OR SUBSTR(NEW.key, 1, ${TAG_IDENTITY_REVISION_PREFIX.length}) = '${TAG_IDENTITY_REVISION_PREFIX}')
|
|
413
|
+
BEGIN
|
|
414
|
+
INSERT INTO schema_migrations_meta (key, value) VALUES ('${TAG_REVISION_INCARNATION_KEY}', '1')
|
|
415
|
+
ON CONFLICT(key) DO UPDATE SET value = CAST(CASE
|
|
416
|
+
WHEN CAST(value AS INTEGER) < 9223372036854775807 THEN CAST(value AS INTEGER) + 1
|
|
417
|
+
ELSE NULL END AS TEXT);
|
|
418
|
+
UPDATE schema_migrations_meta SET value =
|
|
419
|
+
(SELECT value FROM schema_migrations_meta WHERE key = '${TAG_REVISION_INCARNATION_KEY}')
|
|
420
|
+
|| ':' || CAST(NEW.value AS TEXT) WHERE key = NEW.key;
|
|
421
|
+
INSERT INTO schema_migrations_meta (key, value)
|
|
422
|
+
SELECT '${TAG_REVISION_INCARNATION_KEY}', '1'
|
|
423
|
+
WHERE SUBSTR(NEW.key, 1, ${TAG_REVISION_PREFIX.length}) = '${TAG_REVISION_PREFIX}'
|
|
424
|
+
AND NOT EXISTS (SELECT 1 FROM schema_migrations_meta
|
|
425
|
+
WHERE key = '${TAG_IDENTITY_REVISION_PREFIX}' || SUBSTR(NEW.key, ${TAG_REVISION_PREFIX.length + 1}))
|
|
426
|
+
ON CONFLICT(key) DO UPDATE SET value = CAST(CASE
|
|
427
|
+
WHEN CAST(value AS INTEGER) < 9223372036854775807 THEN CAST(value AS INTEGER) + 1
|
|
428
|
+
ELSE NULL END AS TEXT);
|
|
429
|
+
INSERT INTO schema_migrations_meta (key, value)
|
|
430
|
+
SELECT '${TAG_IDENTITY_REVISION_PREFIX}' || SUBSTR(NEW.key, ${TAG_REVISION_PREFIX.length + 1}),
|
|
431
|
+
(SELECT value FROM schema_migrations_meta WHERE key = '${TAG_REVISION_INCARNATION_KEY}') || ':0'
|
|
432
|
+
WHERE SUBSTR(NEW.key, 1, ${TAG_REVISION_PREFIX.length}) = '${TAG_REVISION_PREFIX}'
|
|
433
|
+
AND NOT EXISTS (SELECT 1 FROM schema_migrations_meta
|
|
434
|
+
WHERE key = '${TAG_IDENTITY_REVISION_PREFIX}' || SUBSTR(NEW.key, ${TAG_REVISION_PREFIX.length + 1}));
|
|
435
|
+
END;`);
|
|
373
436
|
db.exec(TRIGGER_SQL);
|
|
437
|
+
db.exec(`CREATE TEMP TRIGGER IF NOT EXISTS mc_tag_revision_bi BEFORE INSERT ON main.tags BEGIN
|
|
438
|
+
${BUMP_INSERT_CONFLICTS(TAG_REVISION_PREFIX)};
|
|
439
|
+
${BUMP_INSERT_CONFLICTS(TAG_IDENTITY_REVISION_PREFIX)};
|
|
440
|
+
UPDATE session_meta SET tags_version = tags_version + 1
|
|
441
|
+
WHERE session_id IN (SELECT session_id FROM (${TAG_INSERT_CONFLICT_ROWS}));
|
|
442
|
+
END;`);
|
|
443
|
+
db.exec(`CREATE TEMP TRIGGER IF NOT EXISTS mc_tag_revision_ai AFTER INSERT ON main.tags BEGIN
|
|
444
|
+
${BUMP("NEW.session_id", TAG_REVISION_PREFIX)};
|
|
445
|
+
END;
|
|
446
|
+
CREATE TEMP TRIGGER IF NOT EXISTS mc_tag_revision_au AFTER UPDATE ON main.tags BEGIN
|
|
447
|
+
${BUMP("OLD.session_id", TAG_REVISION_PREFIX)};
|
|
448
|
+
INSERT INTO schema_migrations_meta (key, value)
|
|
449
|
+
SELECT '${TAG_REVISION_PREFIX}' || NEW.session_id, '1'
|
|
450
|
+
WHERE NEW.session_id IS NOT OLD.session_id
|
|
451
|
+
ON CONFLICT(key) DO UPDATE SET value = ${ADVANCE()};
|
|
452
|
+
END;
|
|
453
|
+
CREATE TEMP TRIGGER IF NOT EXISTS mc_tag_revision_ad AFTER DELETE ON main.tags BEGIN
|
|
454
|
+
${BUMP("OLD.session_id", TAG_REVISION_PREFIX)};
|
|
455
|
+
END;`);
|
|
374
456
|
}
|
|
375
457
|
function deleteTagIdentityRevisions(db, sessionIds) {
|
|
376
|
-
const statement = db.prepare(
|
|
377
|
-
|
|
378
|
-
|
|
458
|
+
const statement = db.prepare(`INSERT INTO schema_migrations_meta (key, value) VALUES (?, '1')
|
|
459
|
+
ON CONFLICT(key) DO UPDATE SET value = ${ADVANCE()}`);
|
|
460
|
+
for (const sessionId of sessionIds) {
|
|
461
|
+
statement.run(tagIdentityRevisionKey(sessionId));
|
|
462
|
+
}
|
|
379
463
|
}
|
|
380
464
|
|
|
381
465
|
// src/shared/stable-json.ts
|
|
@@ -426,4 +510,4 @@ function writeStable(value, seen, pieces) {
|
|
|
426
510
|
pieces.push("}");
|
|
427
511
|
}
|
|
428
512
|
|
|
429
|
-
export { getTableColumnNames, ensureColumn, healAllNullColumns, stableStringify, getTemporalDecisions, observeTemporalDecisions, freezeTemporalDecisions, installV95PerfSchema, tagOrderConstraintIndex, tagIdentityRevisionKey, installTagIdentityRevisionTrigger, deleteTagIdentityRevisions };
|
|
513
|
+
export { getTableColumnNames, ensureColumn, healAllNullColumns, stableStringify, getTemporalDecisions, observeTemporalDecisions, freezeTemporalDecisions, installV95PerfSchema, tagOrderConstraintIndex, TAG_TOMBSTONE_OWNER_PREFIX, tagTombstoneOwnerRange, tagTombstoneOwnerKey, tagRevisionKey, tagIdentityRevisionKey, installTagIdentityRevisionTrigger, deleteTagIdentityRevisions };
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./server-fr0wbhdn.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./server-
|
|
6
|
+
} from "./server-t4k4qexw.js";
|
|
7
7
|
import {
|
|
8
8
|
ensureColumn,
|
|
9
9
|
healAllNullColumns,
|
|
10
10
|
installV95PerfSchema
|
|
11
|
-
} from "./server-
|
|
11
|
+
} from "./server-6byqfbqf.js";
|
|
12
12
|
import {
|
|
13
13
|
resolveOpenCodeDbPath,
|
|
14
14
|
openCodeDbPathExists,
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
normalizeStoredProjectPath,
|
|
22
22
|
storedPathBelongsToIdentity
|
|
23
|
-
} from "./server-
|
|
23
|
+
} from "./server-8xmq9h3f.js";
|
|
24
24
|
import {
|
|
25
25
|
logSlowWriteTransaction
|
|
26
|
-
} from "./server-
|
|
26
|
+
} from "./server-3t0q2cqx.js";
|
|
27
27
|
|
|
28
28
|
// src/features/magic-context/migrations.ts
|
|
29
29
|
import { isMainThread } from "node:worker_threads";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
estimateTokens
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-kzns2hbz.js";
|
|
4
4
|
import {
|
|
5
5
|
stableStringify
|
|
6
|
-
} from "./server-
|
|
6
|
+
} from "./server-6byqfbqf.js";
|
|
7
7
|
|
|
8
8
|
// src/features/magic-context/tool-definition-tokens.ts
|
|
9
9
|
import { createHash } from "node:crypto";
|