@remnic/core 10.0.168 → 10.0.169
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/access-admin-ops-surface.js +138 -137
- package/dist/access-cli.js +138 -137
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.js +11 -11
- package/dist/access-extraction-force-flush-preempt.js +138 -137
- package/dist/access-extraction-force-flush.js +138 -137
- package/dist/access-http-briefing.js +138 -137
- package/dist/access-http-query.js +138 -137
- package/dist/access-http.js +138 -137
- package/dist/access-identity-continuity-surface.js +138 -137
- package/dist/access-lcm-surface.js +138 -137
- package/dist/access-mcp.js +138 -137
- package/dist/access-observe-write-category.js +11 -11
- package/dist/access-observe-write-surface.js +138 -137
- package/dist/access-offline-manifest.js +9 -9
- package/dist/access-operations-batch.js +138 -137
- package/dist/access-operations.js +138 -137
- package/dist/access-recall-concurrency.js +138 -137
- package/dist/access-recall-excerpt-attribution.d.ts +19 -0
- package/dist/access-recall-excerpt-attribution.d.ts.map +1 -0
- package/dist/access-recall-excerpt-attribution.js +8 -0
- package/dist/access-recall-response.js +138 -137
- package/dist/access-recall-surface.d.ts.map +1 -1
- package/dist/access-recall-surface.js +138 -137
- package/dist/access-schema.js +10 -10
- package/dist/access-service.js +138 -137
- package/dist/active-recall.js +24 -24
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/{auto-sync-L3M4RKJD.js → auto-sync-ACP5U5A3.js} +3 -3
- package/dist/binary-lifecycle/scanner.d.ts +2 -4
- package/dist/binary-lifecycle/scanner.d.ts.map +1 -1
- package/dist/briefing.js +13 -13
- package/dist/buffer-add-turns-bounded.d.ts +11 -1
- package/dist/buffer-add-turns-bounded.d.ts.map +1 -1
- package/dist/buffer-add-turns-bounded.js +3 -3
- package/dist/buffer-session-cap.d.ts +2 -2
- package/dist/buffer-session-cap.d.ts.map +1 -1
- package/dist/buffer-session-cap.js +1 -1
- package/dist/buffer.d.ts +3 -2
- package/dist/buffer.d.ts.map +1 -1
- package/dist/buffer.js +12 -12
- package/dist/calibration.d.ts +19 -2
- package/dist/calibration.d.ts.map +1 -1
- package/dist/calibration.js +28 -5
- package/dist/calibration.js.map +1 -1
- package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
- package/dist/{capsule-merge-VHBRF65A.js → capsule-merge-BADOICNP.js} +2 -2
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.js +17 -17
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.js +3 -3
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
- package/dist/{chunk-D6BOOYNJ.js → chunk-32OTLNAU.js} +271 -237
- package/dist/chunk-32OTLNAU.js.map +1 -0
- package/dist/{chunk-L7SEYUHS.js → chunk-3I3NXB6X.js} +3 -3
- package/dist/{chunk-4NBUHYUV.js → chunk-3LADDLAF.js} +5 -5
- package/dist/{chunk-2DL3OFLD.js → chunk-45GEJRIG.js} +2 -2
- package/dist/{chunk-5BE3FLKL.js → chunk-5KDDAQ6K.js} +8 -8
- package/dist/{chunk-BPCR5DZP.js → chunk-62YZOQFR.js} +5 -5
- package/dist/chunk-62YZOQFR.js.map +1 -0
- package/dist/{chunk-HLWXCDUQ.js → chunk-63A2BU2B.js} +5 -5
- package/dist/{chunk-MOUSHJAR.js → chunk-7FPI5MFB.js} +5 -5
- package/dist/{chunk-ZX546Y3Y.js → chunk-7OYDFIL4.js} +2 -2
- package/dist/{chunk-CKZWLAHN.js → chunk-ACPFBVUD.js} +2 -2
- package/dist/{chunk-BKTCVXMK.js → chunk-AHOYKJ5X.js} +3 -3
- package/dist/{chunk-WEHSQBFR.js → chunk-AIF6V2OX.js} +9 -4
- package/dist/chunk-AIF6V2OX.js.map +1 -0
- package/dist/{chunk-FGT7CUYZ.js → chunk-ALTLOHO7.js} +2 -2
- package/dist/{chunk-FMFCQRDM.js → chunk-AUFPPBC3.js} +3 -3
- package/dist/{chunk-OAQRZ4SV.js → chunk-B5KTTWC7.js} +2 -2
- package/dist/{chunk-73TPOGS4.js → chunk-BFBS7OFQ.js} +9 -9
- package/dist/{chunk-QFTK6EDM.js → chunk-BFZFNXOC.js} +13 -13
- package/dist/{chunk-ZQUOUPP3.js → chunk-BHRPZBAH.js} +4 -4
- package/dist/{chunk-4L25GAYL.js → chunk-CX24SVLK.js} +2 -2
- package/dist/{chunk-YY57TRKN.js → chunk-D5ZLTLHF.js} +2 -2
- package/dist/{chunk-WEFFO2MJ.js → chunk-D6YCETHG.js} +2 -2
- package/dist/{chunk-ZDZJNXL6.js → chunk-DK2VBJ6Q.js} +4 -4
- package/dist/{chunk-VRHY7Y5A.js → chunk-DPL5VO5V.js} +3 -3
- package/dist/{chunk-LVGTH6IQ.js → chunk-E7ATID4Z.js} +11 -11
- package/dist/{chunk-CKELO7Q6.js → chunk-FHWX2REL.js} +2 -2
- package/dist/{chunk-CUPILBIP.js → chunk-FMIM36I4.js} +2 -2
- package/dist/{chunk-OWM2VWNX.js → chunk-FSXYBIEZ.js} +25 -24
- package/dist/chunk-FSXYBIEZ.js.map +1 -0
- package/dist/{chunk-A5UOREWD.js → chunk-FWTGO4NE.js} +2 -2
- package/dist/{chunk-3SL52JKD.js → chunk-FZVROZKC.js} +5 -5
- package/dist/{chunk-U3BCW7GX.js → chunk-G3RLCVJC.js} +3 -3
- package/dist/{chunk-UYIBNDQE.js → chunk-GF5NN3LE.js} +2 -2
- package/dist/{chunk-7OCKK5M5.js → chunk-GWY5ZFHP.js} +6 -6
- package/dist/{chunk-AL3TCNSJ.js → chunk-H3MLOQ7F.js} +24 -53
- package/dist/chunk-H3MLOQ7F.js.map +1 -0
- package/dist/{chunk-TNRGWJYT.js → chunk-H4IU24V5.js} +2 -2
- package/dist/{chunk-T4BT4FQN.js → chunk-HH6PXQ2B.js} +3 -3
- package/dist/{chunk-FEUWI5QH.js → chunk-HHPY5SSE.js} +2 -2
- package/dist/{chunk-OM5ESBES.js → chunk-HQPFACXO.js} +2 -2
- package/dist/{chunk-QLQUAVVP.js → chunk-I7WPLMUX.js} +16 -16
- package/dist/chunk-I7WPLMUX.js.map +1 -0
- package/dist/{chunk-IMULTENA.js → chunk-ID65XTF3.js} +2 -2
- package/dist/{chunk-WWQMZBDI.js → chunk-IJVU4ILJ.js} +4 -4
- package/dist/{chunk-GBSXTTLP.js → chunk-ITGAGNX5.js} +2 -2
- package/dist/chunk-IUGOGDCP.js +39 -0
- package/dist/chunk-IUGOGDCP.js.map +1 -0
- package/dist/{chunk-3PNJZTDV.js → chunk-JGGNUEVD.js} +2 -2
- package/dist/{chunk-YYXYZM2I.js → chunk-JN7OSQJR.js} +2 -2
- package/dist/{chunk-4D2EY4WM.js → chunk-K2DTHNDY.js} +6 -6
- package/dist/{chunk-TH6OYP6I.js → chunk-K36RMINQ.js} +3 -3
- package/dist/{chunk-OZKVVUJB.js → chunk-KIM5VNZN.js} +2 -2
- package/dist/{chunk-BFPQJNFZ.js → chunk-LXSDEPEK.js} +60 -11
- package/dist/{chunk-BFPQJNFZ.js.map → chunk-LXSDEPEK.js.map} +1 -1
- package/dist/{chunk-ZWDDY4WF.js → chunk-M7CFCRWJ.js} +2 -2
- package/dist/{chunk-QPFM6DHY.js → chunk-MTJFK42O.js} +2 -2
- package/dist/{chunk-RO5EGRAI.js → chunk-N3FRR6II.js} +2 -2
- package/dist/{chunk-UMEUU66X.js → chunk-O3OEVYUR.js} +2 -2
- package/dist/{chunk-J74YOBB3.js → chunk-PFR6ZKQI.js} +8 -8
- package/dist/{chunk-TAD6QMMD.js → chunk-PRC7SZYM.js} +2 -2
- package/dist/{chunk-LWZNSQN3.js → chunk-PUQQPLVV.js} +3 -3
- package/dist/{chunk-LWZNSQN3.js.map → chunk-PUQQPLVV.js.map} +1 -1
- package/dist/{chunk-GMO3BGOF.js → chunk-QC2MHZDD.js} +1 -1
- package/dist/{chunk-FOTFLHBN.js → chunk-QPLI7LUU.js} +3 -2
- package/dist/chunk-QPLI7LUU.js.map +1 -0
- package/dist/{chunk-2MWKUVHT.js → chunk-RK7SE3BL.js} +5 -5
- package/dist/{chunk-HDWISXFH.js → chunk-RVAPK2S7.js} +2 -2
- package/dist/{chunk-5PUZV73Z.js → chunk-SEIGLG62.js} +11 -11
- package/dist/{chunk-AVWOULJH.js → chunk-SH3GOZWK.js} +2 -2
- package/dist/{chunk-PFLN6TTW.js → chunk-T3MCVSUC.js} +2 -2
- package/dist/{chunk-WQUGCOKF.js → chunk-TFA6HPOA.js} +4 -4
- package/dist/{chunk-CLVILSBR.js → chunk-TGQW3AMK.js} +22 -22
- package/dist/{chunk-YZYAYUJQ.js → chunk-TLRIRISJ.js} +4 -4
- package/dist/{chunk-7VIJUZYW.js → chunk-TQ4CELUR.js} +3 -3
- package/dist/{chunk-5QDTZIGH.js → chunk-U7KP6QFU.js} +2 -2
- package/dist/{chunk-BUKK5SWA.js → chunk-UPD5XDJX.js} +5 -5
- package/dist/{chunk-BUKK5SWA.js.map → chunk-UPD5XDJX.js.map} +1 -1
- package/dist/{chunk-QVXEXGIM.js → chunk-VF6SC4OD.js} +2 -2
- package/dist/{chunk-EZG54YDS.js → chunk-VKXJQF5C.js} +2 -2
- package/dist/{chunk-RFLC6PKQ.js → chunk-VMRPLHEU.js} +2 -2
- package/dist/{chunk-U2PSE7MB.js → chunk-VPEIWMUT.js} +2 -2
- package/dist/{chunk-X67XNZ64.js → chunk-W4EJMMPP.js} +10 -10
- package/dist/{chunk-RB7NXZ2E.js → chunk-W4Q65VJL.js} +2 -2
- package/dist/{chunk-HDDRVXX4.js → chunk-W5LJ3SJ7.js} +2 -2
- package/dist/{chunk-W7N7NWG5.js → chunk-WCJQ3OUP.js} +2 -2
- package/dist/{chunk-JIF22AXI.js → chunk-WGKIXNLY.js} +5 -2
- package/dist/{chunk-JIF22AXI.js.map → chunk-WGKIXNLY.js.map} +1 -1
- package/dist/{chunk-FFWFFAP3.js → chunk-WI2WTIMY.js} +14 -8
- package/dist/chunk-WI2WTIMY.js.map +1 -0
- package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
- package/dist/{chunk-22V3CMIW.js → chunk-XJTRIHTH.js} +8 -8
- package/dist/{chunk-SIONKXLU.js → chunk-XTRC6SSS.js} +14 -14
- package/dist/{chunk-SBRUTD5O.js → chunk-YSATDEBY.js} +5 -5
- package/dist/{chunk-3YOX2BQD.js → chunk-YWMCV5HL.js} +3 -3
- package/dist/{chunk-L272A5QW.js → chunk-YYDUBGUF.js} +30 -22
- package/dist/chunk-YYDUBGUF.js.map +1 -0
- package/dist/{chunk-6QWFZ3X5.js → chunk-ZA6CYFAK.js} +2 -2
- package/dist/cli.js +138 -137
- package/dist/coding/export-okf-codegraph.js +24 -24
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.js +14 -14
- package/dist/config.js +24 -24
- package/dist/connectors/codex-marketplace.d.ts.map +1 -1
- package/dist/connectors/codex-materialize-runner.js +14 -14
- package/dist/connectors/codex-materialize.d.ts.map +1 -1
- package/dist/connectors/codex-materialize.js +1 -1
- package/dist/connectors/index.js +15 -15
- package/dist/consolidation-provenance-check.js +2 -2
- package/dist/convergence-refresh.js +15 -15
- package/dist/conversation-index/backend.js +2 -2
- package/dist/corpus-watermark.js +15 -15
- package/dist/deep-recall-http-glue.js +11 -11
- package/dist/embedding-fallback.js +2 -2
- package/dist/entity-retrieval.js +14 -14
- package/dist/event-order-recall.js +3 -3
- package/dist/explicit-capture.js +138 -137
- package/dist/extraction-judge.js +1 -1
- package/dist/extraction-normalization.js +1 -1
- package/dist/extraction-span-materialize.js +2 -2
- package/dist/extraction.js +27 -27
- package/dist/{graph-edge-decay-BC3IO2J4.js → graph-edge-decay-CXTNJ7IQ.js} +6 -6
- package/dist/graph-edge-decay-CXTNJ7IQ.js.map +1 -0
- package/dist/graph-jsonl.js +4 -4
- package/dist/graph-snapshot.js +4 -4
- package/dist/graph.js +5 -5
- package/dist/harmonic-retrieval.js +13 -13
- package/dist/index.js +197 -196
- package/dist/lcm/index.js +3 -3
- package/dist/local-llm.js +2 -2
- package/dist/location/index.js +14 -14
- package/dist/maintenance/memory-governance.js +13 -13
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +13 -13
- package/dist/maintenance/rebuild-memory-projection-runner.js +15 -15
- package/dist/maintenance/rebuild-memory-projection.js +14 -14
- package/dist/memory-browse.js +5 -5
- package/dist/memory-controller.d.ts.map +1 -1
- package/dist/memory-controller.js +1 -1
- package/dist/namespaces/migrate.js +14 -14
- package/dist/namespaces/search.js +7 -7
- package/dist/namespaces/storage.d.ts.map +1 -1
- package/dist/namespaces/storage.js +13 -13
- package/dist/offline-sync-changeset-generations.js +4 -4
- package/dist/offline-sync-embedding-generation.js +3 -3
- package/dist/offline-sync-snapshot-stream.js +7 -7
- package/dist/offline-sync.js +6 -6
- package/dist/operator-doctor-corpus.js +16 -16
- package/dist/operator-toolkit.js +35 -35
- package/dist/orchestration/backlog-scheduler.d.ts +4 -0
- package/dist/orchestration/backlog-scheduler.d.ts.map +1 -1
- package/dist/orchestration/backlog-scheduler.js +149 -142
- package/dist/orchestration/backlog-scheduler.js.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +139 -138
- package/dist/orchestration/extraction-persist-citation.d.ts +2 -2
- package/dist/orchestration/extraction-persist-citation.d.ts.map +1 -1
- package/dist/orchestration/extraction-persist.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +23 -23
- package/dist/orchestration/recall-internal.d.ts.map +1 -1
- package/dist/orchestration/turn-ingestion-buffered.d.ts.map +1 -1
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +140 -139
- package/dist/qmd.js +4 -4
- package/dist/recall-navigation.js +138 -137
- package/dist/recall-state-view-admission.js +5 -5
- package/dist/recall-state-view-packet.d.ts.map +1 -1
- package/dist/recall-state-view-packet.js +30 -8
- package/dist/recall-state-view-packet.js.map +1 -1
- package/dist/recall-why-service.js +5 -5
- package/dist/reconcile/manifest.js +2 -2
- package/dist/resume-bundles.js +25 -25
- package/dist/search/factory.js +6 -6
- package/dist/search/index.js +8 -8
- package/dist/semantic-consolidation.js +18 -18
- package/dist/semantic-rule-promotion.js +13 -13
- package/dist/semantic-rule-verifier.js +13 -13
- package/dist/source-agent-qualifier.js +18 -18
- package/dist/source-attribution.d.ts +3 -3
- package/dist/source-attribution.d.ts.map +1 -1
- package/dist/source-attribution.js +1 -1
- package/dist/standup/build.js +13 -13
- package/dist/storage.d.ts +1 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +12 -12
- package/dist/summarizer.d.ts +7 -1
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +3 -3
- package/dist/support-passport/index.js +16 -16
- package/dist/transfer/autodetect.js +3 -3
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +3 -3
- package/dist/transfer/capsule-import.js +3 -3
- package/dist/transfer/export-okf.js +13 -13
- package/dist/transfer/import-json.js +2 -2
- package/dist/transfer/import-md.js +2 -2
- package/dist/transfer/types.d.ts +15 -3
- package/dist/transfer/types.d.ts.map +1 -1
- package/dist/transfer/types.js +3 -1
- package/dist/verified-recall.js +13 -13
- package/dist/who-knows-cli.js +14 -14
- package/dist/who-knows.js +13 -13
- package/package.json +2 -2
- package/src/access-cli.test.ts +9 -9
- package/src/access-recall-excerpt-attribution.ts +69 -0
- package/src/access-recall-surface.ts +23 -21
- package/src/access-service-raw-excerpt-read-gate.test.ts +192 -11
- package/src/backlog-scheduler.test.ts +31 -0
- package/src/binary-lifecycle/scanner.ts +35 -14
- package/src/buffer-add-turns-bounded.ts +16 -2
- package/src/buffer-session-cap.ts +4 -4
- package/src/buffer.ts +5 -5
- package/src/calibration.ts +56 -4
- package/src/connectors/codex-marketplace-git.test.ts +267 -0
- package/src/connectors/codex-marketplace.ts +76 -13
- package/src/connectors/codex-materialize.ts +29 -55
- package/src/memory-controller.test.ts +11 -0
- package/src/memory-controller.ts +5 -1
- package/src/namespaces/storage.ts +1 -0
- package/src/orchestration/backlog-scheduler.ts +12 -3
- package/src/orchestration/extraction-persist-citation.ts +5 -3
- package/src/orchestration/extraction-persist.ts +15 -14
- package/src/orchestration/recall-internal.ts +2 -3
- package/src/orchestration/turn-ingestion-buffered.test.ts +52 -1
- package/src/orchestration/turn-ingestion-buffered.ts +26 -8
- package/src/orchestrator.ts +1 -0
- package/src/recall-state-view-packet.test.ts +40 -0
- package/src/recall-state-view-packet.ts +46 -9
- package/src/source-attribution.test.ts +57 -0
- package/src/source-attribution.ts +46 -43
- package/src/storage.ts +4 -3
- package/src/summarizer-shutdown.test.ts +49 -16
- package/src/summarizer.ts +13 -5
- package/src/testing/subjects/memory-maintenance.test.ts +293 -0
- package/src/transfer/capsule-export.ts +2 -1
- package/src/transfer/capsule-taxonomy-version.test.ts +70 -0
- package/src/transfer/types.ts +13 -3
- package/dist/chunk-AL3TCNSJ.js.map +0 -1
- package/dist/chunk-BPCR5DZP.js.map +0 -1
- package/dist/chunk-D6BOOYNJ.js.map +0 -1
- package/dist/chunk-FFWFFAP3.js.map +0 -1
- package/dist/chunk-FOTFLHBN.js.map +0 -1
- package/dist/chunk-L272A5QW.js.map +0 -1
- package/dist/chunk-OWM2VWNX.js.map +0 -1
- package/dist/chunk-QLQUAVVP.js.map +0 -1
- package/dist/chunk-WEHSQBFR.js.map +0 -1
- /package/dist/{capsule-crypto-GWVG7LGC.js.map → access-recall-excerpt-attribution.js.map} +0 -0
- /package/dist/{auto-sync-L3M4RKJD.js.map → auto-sync-ACP5U5A3.js.map} +0 -0
- /package/dist/{graph-edge-decay-BC3IO2J4.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
- /package/dist/{capsule-merge-VHBRF65A.js.map → capsule-merge-BADOICNP.js.map} +0 -0
- /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
- /package/dist/{chunk-L7SEYUHS.js.map → chunk-3I3NXB6X.js.map} +0 -0
- /package/dist/{chunk-4NBUHYUV.js.map → chunk-3LADDLAF.js.map} +0 -0
- /package/dist/{chunk-2DL3OFLD.js.map → chunk-45GEJRIG.js.map} +0 -0
- /package/dist/{chunk-5BE3FLKL.js.map → chunk-5KDDAQ6K.js.map} +0 -0
- /package/dist/{chunk-HLWXCDUQ.js.map → chunk-63A2BU2B.js.map} +0 -0
- /package/dist/{chunk-MOUSHJAR.js.map → chunk-7FPI5MFB.js.map} +0 -0
- /package/dist/{chunk-ZX546Y3Y.js.map → chunk-7OYDFIL4.js.map} +0 -0
- /package/dist/{chunk-CKZWLAHN.js.map → chunk-ACPFBVUD.js.map} +0 -0
- /package/dist/{chunk-BKTCVXMK.js.map → chunk-AHOYKJ5X.js.map} +0 -0
- /package/dist/{chunk-FGT7CUYZ.js.map → chunk-ALTLOHO7.js.map} +0 -0
- /package/dist/{chunk-FMFCQRDM.js.map → chunk-AUFPPBC3.js.map} +0 -0
- /package/dist/{chunk-OAQRZ4SV.js.map → chunk-B5KTTWC7.js.map} +0 -0
- /package/dist/{chunk-73TPOGS4.js.map → chunk-BFBS7OFQ.js.map} +0 -0
- /package/dist/{chunk-QFTK6EDM.js.map → chunk-BFZFNXOC.js.map} +0 -0
- /package/dist/{chunk-ZQUOUPP3.js.map → chunk-BHRPZBAH.js.map} +0 -0
- /package/dist/{chunk-4L25GAYL.js.map → chunk-CX24SVLK.js.map} +0 -0
- /package/dist/{chunk-YY57TRKN.js.map → chunk-D5ZLTLHF.js.map} +0 -0
- /package/dist/{chunk-WEFFO2MJ.js.map → chunk-D6YCETHG.js.map} +0 -0
- /package/dist/{chunk-ZDZJNXL6.js.map → chunk-DK2VBJ6Q.js.map} +0 -0
- /package/dist/{chunk-VRHY7Y5A.js.map → chunk-DPL5VO5V.js.map} +0 -0
- /package/dist/{chunk-LVGTH6IQ.js.map → chunk-E7ATID4Z.js.map} +0 -0
- /package/dist/{chunk-CKELO7Q6.js.map → chunk-FHWX2REL.js.map} +0 -0
- /package/dist/{chunk-CUPILBIP.js.map → chunk-FMIM36I4.js.map} +0 -0
- /package/dist/{chunk-A5UOREWD.js.map → chunk-FWTGO4NE.js.map} +0 -0
- /package/dist/{chunk-3SL52JKD.js.map → chunk-FZVROZKC.js.map} +0 -0
- /package/dist/{chunk-U3BCW7GX.js.map → chunk-G3RLCVJC.js.map} +0 -0
- /package/dist/{chunk-UYIBNDQE.js.map → chunk-GF5NN3LE.js.map} +0 -0
- /package/dist/{chunk-7OCKK5M5.js.map → chunk-GWY5ZFHP.js.map} +0 -0
- /package/dist/{chunk-TNRGWJYT.js.map → chunk-H4IU24V5.js.map} +0 -0
- /package/dist/{chunk-T4BT4FQN.js.map → chunk-HH6PXQ2B.js.map} +0 -0
- /package/dist/{chunk-FEUWI5QH.js.map → chunk-HHPY5SSE.js.map} +0 -0
- /package/dist/{chunk-OM5ESBES.js.map → chunk-HQPFACXO.js.map} +0 -0
- /package/dist/{chunk-IMULTENA.js.map → chunk-ID65XTF3.js.map} +0 -0
- /package/dist/{chunk-WWQMZBDI.js.map → chunk-IJVU4ILJ.js.map} +0 -0
- /package/dist/{chunk-GBSXTTLP.js.map → chunk-ITGAGNX5.js.map} +0 -0
- /package/dist/{chunk-3PNJZTDV.js.map → chunk-JGGNUEVD.js.map} +0 -0
- /package/dist/{chunk-YYXYZM2I.js.map → chunk-JN7OSQJR.js.map} +0 -0
- /package/dist/{chunk-4D2EY4WM.js.map → chunk-K2DTHNDY.js.map} +0 -0
- /package/dist/{chunk-TH6OYP6I.js.map → chunk-K36RMINQ.js.map} +0 -0
- /package/dist/{chunk-OZKVVUJB.js.map → chunk-KIM5VNZN.js.map} +0 -0
- /package/dist/{chunk-ZWDDY4WF.js.map → chunk-M7CFCRWJ.js.map} +0 -0
- /package/dist/{chunk-QPFM6DHY.js.map → chunk-MTJFK42O.js.map} +0 -0
- /package/dist/{chunk-RO5EGRAI.js.map → chunk-N3FRR6II.js.map} +0 -0
- /package/dist/{chunk-UMEUU66X.js.map → chunk-O3OEVYUR.js.map} +0 -0
- /package/dist/{chunk-J74YOBB3.js.map → chunk-PFR6ZKQI.js.map} +0 -0
- /package/dist/{chunk-TAD6QMMD.js.map → chunk-PRC7SZYM.js.map} +0 -0
- /package/dist/{chunk-GMO3BGOF.js.map → chunk-QC2MHZDD.js.map} +0 -0
- /package/dist/{chunk-2MWKUVHT.js.map → chunk-RK7SE3BL.js.map} +0 -0
- /package/dist/{chunk-HDWISXFH.js.map → chunk-RVAPK2S7.js.map} +0 -0
- /package/dist/{chunk-5PUZV73Z.js.map → chunk-SEIGLG62.js.map} +0 -0
- /package/dist/{chunk-AVWOULJH.js.map → chunk-SH3GOZWK.js.map} +0 -0
- /package/dist/{chunk-PFLN6TTW.js.map → chunk-T3MCVSUC.js.map} +0 -0
- /package/dist/{chunk-WQUGCOKF.js.map → chunk-TFA6HPOA.js.map} +0 -0
- /package/dist/{chunk-CLVILSBR.js.map → chunk-TGQW3AMK.js.map} +0 -0
- /package/dist/{chunk-YZYAYUJQ.js.map → chunk-TLRIRISJ.js.map} +0 -0
- /package/dist/{chunk-7VIJUZYW.js.map → chunk-TQ4CELUR.js.map} +0 -0
- /package/dist/{chunk-5QDTZIGH.js.map → chunk-U7KP6QFU.js.map} +0 -0
- /package/dist/{chunk-QVXEXGIM.js.map → chunk-VF6SC4OD.js.map} +0 -0
- /package/dist/{chunk-EZG54YDS.js.map → chunk-VKXJQF5C.js.map} +0 -0
- /package/dist/{chunk-RFLC6PKQ.js.map → chunk-VMRPLHEU.js.map} +0 -0
- /package/dist/{chunk-U2PSE7MB.js.map → chunk-VPEIWMUT.js.map} +0 -0
- /package/dist/{chunk-X67XNZ64.js.map → chunk-W4EJMMPP.js.map} +0 -0
- /package/dist/{chunk-RB7NXZ2E.js.map → chunk-W4Q65VJL.js.map} +0 -0
- /package/dist/{chunk-HDDRVXX4.js.map → chunk-W5LJ3SJ7.js.map} +0 -0
- /package/dist/{chunk-W7N7NWG5.js.map → chunk-WCJQ3OUP.js.map} +0 -0
- /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
- /package/dist/{chunk-22V3CMIW.js.map → chunk-XJTRIHTH.js.map} +0 -0
- /package/dist/{chunk-SIONKXLU.js.map → chunk-XTRC6SSS.js.map} +0 -0
- /package/dist/{chunk-SBRUTD5O.js.map → chunk-YSATDEBY.js.map} +0 -0
- /package/dist/{chunk-3YOX2BQD.js.map → chunk-YWMCV5HL.js.map} +0 -0
- /package/dist/{chunk-6QWFZ3X5.js.map → chunk-ZA6CYFAK.js.map} +0 -0
|
@@ -29,6 +29,7 @@ import { createHash } from "node:crypto";
|
|
|
29
29
|
import test from "node:test";
|
|
30
30
|
|
|
31
31
|
import { EngramAccessService } from "./access-service.js";
|
|
32
|
+
import type { EngramAccessRecallRequest } from "./access-service.js";
|
|
32
33
|
import { CrossNamespaceBudget } from "./cross-namespace-budget.js";
|
|
33
34
|
import { Orchestrator } from "./orchestrator.js";
|
|
34
35
|
import type { LastRecallSnapshot } from "./recall-state.js";
|
|
@@ -39,7 +40,8 @@ import {
|
|
|
39
40
|
projectTagProjectId,
|
|
40
41
|
} from "./coding/coding-namespace.js";
|
|
41
42
|
import type { StorageManager } from "./storage.js";
|
|
42
|
-
import type {
|
|
43
|
+
import type { RecallExecResult } from "./access-recall-concurrency.js";
|
|
44
|
+
import type { CodingContext, MemoryFile, PluginConfig } from "./types.js";
|
|
43
45
|
|
|
44
46
|
interface RawExcerptProbe {
|
|
45
47
|
service: EngramAccessService;
|
|
@@ -62,6 +64,17 @@ function makeRawExcerptProbe(options: {
|
|
|
62
64
|
snapshotNamespace: string;
|
|
63
65
|
sessionContext?: CodingContext;
|
|
64
66
|
sessionKey: string;
|
|
67
|
+
/** snapshot.memoryIds → getMemoryById fixtures (recall results path). */
|
|
68
|
+
memories?: ReadonlyMap<string, MemoryFile>;
|
|
69
|
+
/** Rows the LCM stub's `searchContextFull` returns. */
|
|
70
|
+
excerptRows?: Array<{
|
|
71
|
+
id: number;
|
|
72
|
+
turn_index: number;
|
|
73
|
+
role: string;
|
|
74
|
+
content: string;
|
|
75
|
+
session_id: string;
|
|
76
|
+
score: number;
|
|
77
|
+
}>;
|
|
65
78
|
}): RawExcerptProbe {
|
|
66
79
|
const searchSessionIds: Array<string | undefined> = [];
|
|
67
80
|
const contexts = new Map<string, CodingContext>();
|
|
@@ -94,27 +107,27 @@ function makeRawExcerptProbe(options: {
|
|
|
94
107
|
.update("what database are we using?")
|
|
95
108
|
.digest("hex"),
|
|
96
109
|
queryLen: 5,
|
|
97
|
-
memoryIds: [],
|
|
110
|
+
memoryIds: [...(options.memories?.keys() ?? [])],
|
|
98
111
|
namespace: options.snapshotNamespace,
|
|
99
112
|
recallNamespaces: [options.snapshotNamespace],
|
|
100
113
|
includedMemories: [],
|
|
101
114
|
};
|
|
102
115
|
|
|
103
|
-
const storage = {
|
|
116
|
+
const storage = probeCast<StorageManager>({
|
|
104
117
|
dir: "/synthetic/remnic-raw-excerpt-read-gate/store",
|
|
105
118
|
async readMemoryByPath() {
|
|
106
119
|
return null;
|
|
107
120
|
},
|
|
108
|
-
async getMemoryById() {
|
|
109
|
-
return null;
|
|
121
|
+
async getMemoryById(id: string) {
|
|
122
|
+
return options.memories?.get(id) ?? null;
|
|
110
123
|
},
|
|
111
|
-
}
|
|
124
|
+
});
|
|
112
125
|
|
|
113
126
|
const service = Object.create(
|
|
114
127
|
EngramAccessService.prototype,
|
|
115
128
|
) as EngramAccessService;
|
|
116
129
|
|
|
117
|
-
const orch = {
|
|
130
|
+
const orch = probeCast<Orchestrator>({
|
|
118
131
|
config,
|
|
119
132
|
getCodingContextForSession: (sk: string | undefined) =>
|
|
120
133
|
(sk ? contexts.get(sk) : null) ?? null,
|
|
@@ -145,12 +158,12 @@ function makeRawExcerptProbe(options: {
|
|
|
145
158
|
sessionId?: string,
|
|
146
159
|
) => {
|
|
147
160
|
searchSessionIds.push(sessionId);
|
|
148
|
-
return [];
|
|
161
|
+
return options.excerptRows ?? [];
|
|
149
162
|
},
|
|
150
163
|
},
|
|
151
|
-
}
|
|
164
|
+
});
|
|
152
165
|
|
|
153
|
-
|
|
166
|
+
probeCast<{ orchestrator: Orchestrator }>(service).orchestrator = orch;
|
|
154
167
|
|
|
155
168
|
// `executeRecall` consults the cross-namespace budget; `Object.create` skips
|
|
156
169
|
// the constructor that builds the real limiter, so install one. Budget is
|
|
@@ -166,8 +179,18 @@ function makeRawExcerptProbe(options: {
|
|
|
166
179
|
return { service, searchSessionIds, contexts };
|
|
167
180
|
}
|
|
168
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Boundary cast for probe stubs: the one assertion lives inside this helper
|
|
184
|
+
* (with its SAFETY comment), so call sites carry no assertions at all.
|
|
185
|
+
*/
|
|
186
|
+
function probeCast<T>(value: NonNullable<unknown>): T {
|
|
187
|
+
// SAFETY: test stubs implement exactly the members the path under test
|
|
188
|
+
// reads; the full production surface is intentionally not provided.
|
|
189
|
+
return value as T;
|
|
190
|
+
}
|
|
191
|
+
|
|
169
192
|
type ExecuteRecallInternals = {
|
|
170
|
-
executeRecall: (request:
|
|
193
|
+
executeRecall: (request: EngramAccessRecallRequest) => Promise<RecallExecResult>;
|
|
171
194
|
};
|
|
172
195
|
|
|
173
196
|
type RawExcerptInternals = {
|
|
@@ -499,3 +522,161 @@ test("scope-profile raw excerpts preserve successful sibling LCM keys when one k
|
|
|
499
522
|
],
|
|
500
523
|
);
|
|
501
524
|
});
|
|
525
|
+
|
|
526
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
527
|
+
// #3546: raw excerpts are attributed per result via the memory's
|
|
528
|
+
// provenance quotes (#1575 `sources[].quote`), not glued to results[0].
|
|
529
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
530
|
+
|
|
531
|
+
function attributionMemory(id: string, quote: string): MemoryFile {
|
|
532
|
+
return {
|
|
533
|
+
path: `/synthetic/store/${id}.md`,
|
|
534
|
+
content: `synthetic body ${id}`,
|
|
535
|
+
frontmatter: {
|
|
536
|
+
id,
|
|
537
|
+
category: "preference",
|
|
538
|
+
created: "2026-11-01T00:00:00Z",
|
|
539
|
+
updated: "2026-11-01T00:00:00Z",
|
|
540
|
+
source: "test",
|
|
541
|
+
confidence: 0.9,
|
|
542
|
+
confidenceTier: "explicit",
|
|
543
|
+
tags: ["fixture"],
|
|
544
|
+
sources: quote
|
|
545
|
+
? [
|
|
546
|
+
{
|
|
547
|
+
sessionKey: SESSION_KEY,
|
|
548
|
+
observedAt: "2026-11-01T00:00:00Z",
|
|
549
|
+
quote,
|
|
550
|
+
},
|
|
551
|
+
]
|
|
552
|
+
: [],
|
|
553
|
+
},
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
function excerptRow(id: number, turnIndex: number, content: string) {
|
|
558
|
+
return {
|
|
559
|
+
id,
|
|
560
|
+
turn_index: turnIndex,
|
|
561
|
+
role: "assistant",
|
|
562
|
+
content,
|
|
563
|
+
session_id: SESSION_KEY,
|
|
564
|
+
score: 1,
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
test("#3546: excerpts containing a result's provenance quote attach to that result, leftovers stay on the first", async () => {
|
|
569
|
+
const memA = attributionMemory("mem-a", "the alpha verbatim quote span");
|
|
570
|
+
const memB = attributionMemory("mem-b", "the beta verbatim quote span");
|
|
571
|
+
const rows = [
|
|
572
|
+
excerptRow(1, 3, "query-relevant turn with no provenance span"),
|
|
573
|
+
excerptRow(2, 4, "prefix the alpha verbatim quote span suffix"),
|
|
574
|
+
excerptRow(3, 5, "the beta verbatim quote span appears here"),
|
|
575
|
+
];
|
|
576
|
+
const probe = makeRawExcerptProbe({
|
|
577
|
+
config: { principalFromSessionKeyRules: [{ match: "pi-geek:", principal: "pi-geek" }] },
|
|
578
|
+
snapshotNamespace: "pi-geek",
|
|
579
|
+
sessionKey: SESSION_KEY,
|
|
580
|
+
memories: new Map([
|
|
581
|
+
["mem-a", memA],
|
|
582
|
+
["mem-b", memB],
|
|
583
|
+
]),
|
|
584
|
+
excerptRows: rows,
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
const { response } = await probeCast<ExecuteRecallInternals>(
|
|
588
|
+
probe.service,
|
|
589
|
+
).executeRecall({
|
|
590
|
+
query: "what database are we using?",
|
|
591
|
+
sessionKey: SESSION_KEY,
|
|
592
|
+
authenticatedPrincipal: "pi-geek",
|
|
593
|
+
disclosure: "raw",
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
const [first, second] = response.results;
|
|
597
|
+
// mem-b's provenance quote lives in turn 5 — that excerpt belongs to mem-b.
|
|
598
|
+
assert.deepEqual(
|
|
599
|
+
second?.rawExcerpts?.map((e) => e.turnIndex),
|
|
600
|
+
[5],
|
|
601
|
+
"excerpt containing mem-b's provenance quote must attach to mem-b",
|
|
602
|
+
);
|
|
603
|
+
// mem-a matched turn 4; the unclaimed query-relevant turn 3 stays anchored
|
|
604
|
+
// to the first result — no excerpt is silently dropped.
|
|
605
|
+
assert.deepEqual(
|
|
606
|
+
first?.rawExcerpts?.map((e) => e.turnIndex),
|
|
607
|
+
[3, 4],
|
|
608
|
+
"first result keeps its own matches plus unattributed excerpts, in transcript order",
|
|
609
|
+
);
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
test("#3546: memories without provenance quotes claim nothing — excerpts fall back to the first result", async () => {
|
|
613
|
+
const probe = makeRawExcerptProbe({
|
|
614
|
+
config: { principalFromSessionKeyRules: [{ match: "pi-geek:", principal: "pi-geek" }] },
|
|
615
|
+
snapshotNamespace: "pi-geek",
|
|
616
|
+
sessionKey: SESSION_KEY,
|
|
617
|
+
memories: new Map([
|
|
618
|
+
["mem-a", attributionMemory("mem-a", "")],
|
|
619
|
+
["mem-b", attributionMemory("mem-b", "")],
|
|
620
|
+
]),
|
|
621
|
+
excerptRows: [excerptRow(1, 3, "turn three"), excerptRow(2, 4, "turn four")],
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
const { response } = await probeCast<ExecuteRecallInternals>(
|
|
625
|
+
probe.service,
|
|
626
|
+
).executeRecall({
|
|
627
|
+
query: "what database are we using?",
|
|
628
|
+
sessionKey: SESSION_KEY,
|
|
629
|
+
authenticatedPrincipal: "pi-geek",
|
|
630
|
+
disclosure: "raw",
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
assert.deepEqual(
|
|
634
|
+
response.results[0]?.rawExcerpts?.map((e) => e.turnIndex),
|
|
635
|
+
[3, 4],
|
|
636
|
+
"with no provenance quotes anywhere the whole set stays on the first result (pre-#3546 shape)",
|
|
637
|
+
);
|
|
638
|
+
assert.equal(
|
|
639
|
+
response.results[1]?.rawExcerpts,
|
|
640
|
+
undefined,
|
|
641
|
+
"second result carries no excerpts when nothing attributed to it",
|
|
642
|
+
);
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
test("#3546: quotes under the attribution length floor claim nothing", async () => {
|
|
646
|
+
// Kilos's review on the PR: a very short quote substring-matches
|
|
647
|
+
// unrelated transcript text. Quotes below the floor are ignored for
|
|
648
|
+
// attribution, so their excerpts keep the first-result fallback.
|
|
649
|
+
const probe = makeRawExcerptProbe({
|
|
650
|
+
config: { principalFromSessionKeyRules: [{ match: "pi-geek:", principal: "pi-geek" }] },
|
|
651
|
+
snapshotNamespace: "pi-geek",
|
|
652
|
+
sessionKey: SESSION_KEY,
|
|
653
|
+
memories: new Map([
|
|
654
|
+
["mem-a", attributionMemory("mem-a", "")],
|
|
655
|
+
["mem-b", attributionMemory("mem-b", "it")],
|
|
656
|
+
]),
|
|
657
|
+
excerptRows: [
|
|
658
|
+
excerptRow(1, 3, "turn three"),
|
|
659
|
+
excerptRow(2, 4, "a turn where it happens"),
|
|
660
|
+
],
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
const { response } = await probeCast<ExecuteRecallInternals>(
|
|
664
|
+
probe.service,
|
|
665
|
+
).executeRecall({
|
|
666
|
+
query: "what database are we using?",
|
|
667
|
+
sessionKey: SESSION_KEY,
|
|
668
|
+
authenticatedPrincipal: "pi-geek",
|
|
669
|
+
disclosure: "raw",
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
assert.deepEqual(
|
|
673
|
+
response.results[1]?.rawExcerpts,
|
|
674
|
+
undefined,
|
|
675
|
+
"a two-char quote must not attribute the excerpt containing it",
|
|
676
|
+
);
|
|
677
|
+
assert.deepEqual(
|
|
678
|
+
response.results[0]?.rawExcerpts?.map((e) => e.turnIndex),
|
|
679
|
+
[3, 4],
|
|
680
|
+
"below-floor quotes keep the excerpt on the first result",
|
|
681
|
+
);
|
|
682
|
+
});
|
|
@@ -1293,6 +1293,37 @@ test("claims past the concurrency bound are re-listed on the next tick, in page
|
|
|
1293
1293
|
}
|
|
1294
1294
|
});
|
|
1295
1295
|
|
|
1296
|
+
test("a live session at its per-session turn cap drains ahead of an older claim backlog", async () => {
|
|
1297
|
+
const queue = new ExtractionQueueCoordinator(1);
|
|
1298
|
+
const claimKeys: string[] = [];
|
|
1299
|
+
for (let i = 1; i <= 17; i += 1) claimKeys.push("claim-" + String(i).padStart(2, "0"));
|
|
1300
|
+
const state: StubState = {
|
|
1301
|
+
counts: new Map([
|
|
1302
|
+
["live-under-cap", { turns: 3, retainedTurns: 0 }],
|
|
1303
|
+
["live-capped", { turns: 3, retainedTurns: 1 }],
|
|
1304
|
+
]),
|
|
1305
|
+
claimed: new Set(claimKeys),
|
|
1306
|
+
claimTurns: new Map(claimKeys.map((key) => [key, 50])),
|
|
1307
|
+
claimedThisRun: new Set(),
|
|
1308
|
+
outcomes: [],
|
|
1309
|
+
drained: [],
|
|
1310
|
+
};
|
|
1311
|
+
const deps: BacklogSchedulerDeps = { ...makeDeps(state, queue), maxTurnsPerSession: () => 4 };
|
|
1312
|
+
const scheduler = new BacklogScheduler(deps, { pollMs: 3_600_000 });
|
|
1313
|
+
scheduler.start();
|
|
1314
|
+
try {
|
|
1315
|
+
// start() runs the first tick; a second tick runs once its drain settles.
|
|
1316
|
+
await scheduler.tickForTest();
|
|
1317
|
+
await scheduler.settleForTest();
|
|
1318
|
+
const drainedKeys = state.drained.map((entry) => entry.key);
|
|
1319
|
+
assert.equal(drainedKeys[0], "live-capped", "the capped live session takes the only slot before the claim page");
|
|
1320
|
+
assert.equal(drainedKeys[1], claimKeys[0], "once it is claimed and drained, the claim backlog drains in page order");
|
|
1321
|
+
assert.ok(!drainedKeys.includes("live-under-cap"), "an under-cap live session keeps waiting behind the claim page");
|
|
1322
|
+
} finally {
|
|
1323
|
+
await scheduler.stop();
|
|
1324
|
+
}
|
|
1325
|
+
});
|
|
1326
|
+
|
|
1296
1327
|
// ── Provider-breaker churn guard ────────────────────────────────────────────
|
|
1297
1328
|
//
|
|
1298
1329
|
// While the shared provider breaker is OPEN inside its cooldown, a full
|
|
@@ -12,23 +12,44 @@ import crypto from "node:crypto";
|
|
|
12
12
|
import type { BinaryLifecycleConfig, BinaryLifecycleManifest } from "./types.js";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* Case-insensitive glob match of one filename (no directory part) against one
|
|
16
|
+
* pattern: `*` matches any run of characters, `?` exactly one, every other
|
|
17
|
+
* character itself, all over Unicode code points. Two-pointer backtracking, O(name x pattern) worst case and
|
|
18
|
+
* no regular expression, so a hostile pattern cannot blow up.
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
function globMatches(nameText: string, patternText: string): boolean {
|
|
21
|
+
const name = Array.from(nameText);
|
|
22
|
+
const pattern = Array.from(patternText);
|
|
23
|
+
let n = 0;
|
|
24
|
+
let p = 0;
|
|
25
|
+
let starP = -1;
|
|
26
|
+
let starN = 0;
|
|
27
|
+
while (n < name.length) {
|
|
28
|
+
const c = pattern[p];
|
|
29
|
+
if (c === "*") {
|
|
30
|
+
starP = p++;
|
|
31
|
+
starN = n;
|
|
32
|
+
} else if (p < pattern.length && (c === "?" || c === name[n])) {
|
|
33
|
+
p++;
|
|
34
|
+
n++;
|
|
35
|
+
} else if (starP >= 0) {
|
|
36
|
+
p = starP + 1;
|
|
37
|
+
n = ++starN;
|
|
38
|
+
} else {
|
|
39
|
+
return false;
|
|
29
40
|
}
|
|
30
41
|
}
|
|
31
|
-
|
|
42
|
+
while (pattern[p] === "*") p++;
|
|
43
|
+
return p === pattern.length;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Test whether a filename matches any of the provided glob patterns
|
|
48
|
+
* (`*.png`, `IMG_*.jpg`, `scan-??.png`, or an exact name), case-insensitively.
|
|
49
|
+
*/
|
|
50
|
+
export function matchesPatterns(filename: string, patterns: string[]): boolean {
|
|
51
|
+
const lower = filename.toLowerCase();
|
|
52
|
+
return patterns.some((pattern) => globMatches(lower, pattern.toLowerCase()));
|
|
32
53
|
}
|
|
33
54
|
|
|
34
55
|
/**
|
|
@@ -17,6 +17,13 @@ export type AddTurnsBoundedOutcome =
|
|
|
17
17
|
| null
|
|
18
18
|
| "duplicate";
|
|
19
19
|
|
|
20
|
+
/** Why a bounded batch was refused; the batch itself still resolves to null. */
|
|
21
|
+
export type BoundedAdmissionRefusal =
|
|
22
|
+
| { reason: "session_turn_cap"; bufferKey: string; maxTurnsPerSession: number }
|
|
23
|
+
| { reason: "session_entry_cap"; maxSessionEntries: number };
|
|
24
|
+
|
|
25
|
+
export type BoundedRefusalListener = (refusal: BoundedAdmissionRefusal) => void;
|
|
26
|
+
|
|
20
27
|
export interface AddTurnsBoundedHost {
|
|
21
28
|
readonly config: PluginConfig;
|
|
22
29
|
readonly maxSessionEntries: number;
|
|
@@ -38,6 +45,7 @@ export async function addTurnsBoundedWithAdmissionKey(
|
|
|
38
45
|
host: AddTurnsBoundedHost,
|
|
39
46
|
batches: readonly { bufferKey: string; turns: readonly BufferTurn[] }[],
|
|
40
47
|
admissionKey?: string,
|
|
48
|
+
onRefused?: BoundedRefusalListener,
|
|
41
49
|
): Promise<AddTurnsBoundedOutcome> {
|
|
42
50
|
const pending = await host.enqueueMutation(async () => {
|
|
43
51
|
await host.loadUnlocked();
|
|
@@ -51,7 +59,10 @@ export async function addTurnsBoundedWithAdmissionKey(
|
|
|
51
59
|
}
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
|
|
62
|
+
const maxTurnsPerSession = resolveMaxTurnsPerSession(host.config.bufferMaxTurnsPerSession);
|
|
63
|
+
const overCapKey = refuseOverCapBatch((key) => host.peekEntry(key) ?? null, batches, maxTurnsPerSession);
|
|
64
|
+
if (overCapKey !== null) {
|
|
65
|
+
onRefused?.({ reason: "session_turn_cap", bufferKey: overCapKey, maxTurnsPerSession });
|
|
55
66
|
return host.ingress.refuseAll(additions);
|
|
56
67
|
}
|
|
57
68
|
const entries = host.state.entries ?? {};
|
|
@@ -67,7 +78,10 @@ export async function addTurnsBoundedWithAdmissionKey(
|
|
|
67
78
|
if (requiredEvictions > 0) {
|
|
68
79
|
const target = Math.max(0, host.maxSessionEntries - newKeys.length);
|
|
69
80
|
const evicted = selectEvictedBufferKeys(entries, newKeys, target, EVICTION_HOOKS);
|
|
70
|
-
if (newKeys.length > 0 && evicted.length < requiredEvictions)
|
|
81
|
+
if (newKeys.length > 0 && evicted.length < requiredEvictions) {
|
|
82
|
+
onRefused?.({ reason: "session_entry_cap", maxSessionEntries: host.maxSessionEntries });
|
|
83
|
+
return host.ingress.refuseAll(additions);
|
|
84
|
+
}
|
|
71
85
|
for (const key of evicted) delete entries[key];
|
|
72
86
|
host.persistence.markEvicted(evicted);
|
|
73
87
|
}
|
|
@@ -31,19 +31,19 @@ export function refuseOverCapSingle(entry: BufferEntryState | null, maxTurns: nu
|
|
|
31
31
|
return true;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
/** Batch path: sums incoming turns per key across all batches, new keys included. */
|
|
34
|
+
/** Batch path: sums incoming turns per key across all batches, new keys included. Returns the first over-cap key. */
|
|
35
35
|
export function refuseOverCapBatch(
|
|
36
36
|
peekEntry: (key: string) => BufferEntryState | null,
|
|
37
37
|
batches: readonly { bufferKey: string; turns: readonly BufferTurn[] }[],
|
|
38
38
|
maxTurns: number,
|
|
39
|
-
):
|
|
39
|
+
): string | null {
|
|
40
40
|
const incomingByKey = new Map<string, number>();
|
|
41
41
|
for (const batch of batches) incomingByKey.set(batch.bufferKey, (incomingByKey.get(batch.bufferKey) ?? 0) + batch.turns.length);
|
|
42
42
|
for (const [bufferKey, incoming] of incomingByKey) {
|
|
43
43
|
if (heldTurnCount(peekEntry(bufferKey)) + incoming > maxTurns) {
|
|
44
44
|
warnTurnCapRefused(bufferKey, maxTurns);
|
|
45
|
-
return
|
|
45
|
+
return bufferKey;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
return
|
|
48
|
+
return null;
|
|
49
49
|
}
|
package/src/buffer.ts
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from "./buffer-turn-helpers.js";
|
|
37
37
|
import { BufferAdmissionRefusedError, BufferSessionTurnRefusedError, canAdmitNewEntryUnlocked } from "./buffer-admission.js";
|
|
38
38
|
import { BufferIngressCounters } from "./buffer-ingress-counters.js";
|
|
39
|
-
import { addTurnsBoundedWithAdmissionKey, type AddTurnsBoundedHost } from "./buffer-add-turns-bounded.js";
|
|
39
|
+
import { addTurnsBoundedWithAdmissionKey, type AddTurnsBoundedHost, type BoundedRefusalListener } from "./buffer-add-turns-bounded.js";
|
|
40
40
|
import { refuseOverCapSingle, resolveMaxTurnsPerSession, sessionTurnCapReached } from "./buffer-session-cap.js";
|
|
41
41
|
export { BufferAdmissionRefusedError, BufferSessionTurnRefusedError } from "./buffer-admission.js";
|
|
42
42
|
import type { AddTurnMutationResult, AddTurnOutcome, RetainedTurnCleanupOptions, TriggerDecision } from "./buffer-types.js";
|
|
@@ -541,18 +541,18 @@ export class SmartBuffer {
|
|
|
541
541
|
}
|
|
542
542
|
|
|
543
543
|
async addTurnsBounded(
|
|
544
|
-
batches: readonly { bufferKey: string; turns: readonly BufferTurn[] }[],
|
|
544
|
+
batches: readonly { bufferKey: string; turns: readonly BufferTurn[] }[], onRefused?: BoundedRefusalListener,
|
|
545
545
|
): Promise<Array<{ bufferKey: string; turn: BufferTurn; outcome: AddTurnOutcome }> | null> {
|
|
546
|
-
const result = await addTurnsBoundedWithAdmissionKey(this.addTurnsBoundedHost(), batches);
|
|
546
|
+
const result = await addTurnsBoundedWithAdmissionKey(this.addTurnsBoundedHost(), batches, undefined, onRefused);
|
|
547
547
|
return result === "duplicate" ? null : result;
|
|
548
548
|
}
|
|
549
549
|
|
|
550
550
|
/** #3368 durable observe replay only; duplicate means the scoped client key already landed. */
|
|
551
551
|
async addTurnsBoundedForObserveReplay(
|
|
552
552
|
batches: readonly { bufferKey: string; turns: readonly BufferTurn[] }[],
|
|
553
|
-
admissionKey: string,
|
|
553
|
+
admissionKey: string, onRefused?: BoundedRefusalListener,
|
|
554
554
|
): Promise<Array<{ bufferKey: string; turn: BufferTurn; outcome: AddTurnOutcome }> | null | "duplicate"> {
|
|
555
|
-
return addTurnsBoundedWithAdmissionKey(this.addTurnsBoundedHost(), batches, admissionKey.trim());
|
|
555
|
+
return addTurnsBoundedWithAdmissionKey(this.addTurnsBoundedHost(), batches, admissionKey.trim(), onRefused);
|
|
556
556
|
}
|
|
557
557
|
|
|
558
558
|
/** Free one slot only when an empty entry can be reclaimed. */
|
package/src/calibration.ts
CHANGED
|
@@ -416,19 +416,71 @@ export async function synthesizeCalibrationRules(
|
|
|
416
416
|
|
|
417
417
|
// ─── Recall Section ──────────────────────────────────────────────────────────
|
|
418
418
|
|
|
419
|
+
/**
|
|
420
|
+
* Lexical similarity score in `[0, 1]` between a query and a calibration
|
|
421
|
+
* rule — the same token-overlap idiom as `session-experience-recall.ts`
|
|
422
|
+
* (Jaccard over lowercase tokens longer than two chars). Shared code so
|
|
423
|
+
* the ranker and any future embedding scorer share one field mapping:
|
|
424
|
+
* the rule's *when/how* text, not its id.
|
|
425
|
+
*/
|
|
426
|
+
export function calibrationRuleQueryScore(
|
|
427
|
+
rule: CalibrationRule,
|
|
428
|
+
query: string,
|
|
429
|
+
): number {
|
|
430
|
+
const norm = (s: string) =>
|
|
431
|
+
s
|
|
432
|
+
.toLowerCase()
|
|
433
|
+
.split(/[^a-z0-9]+/)
|
|
434
|
+
.filter((t) => t.length > 2);
|
|
435
|
+
const queryTokens = new Set(norm(query));
|
|
436
|
+
const ruleTokens = new Set(
|
|
437
|
+
norm(
|
|
438
|
+
`${rule.condition} ${rule.modelTendency} ${rule.userExpectation} ${rule.calibration}`,
|
|
439
|
+
),
|
|
440
|
+
);
|
|
441
|
+
if (queryTokens.size === 0 || ruleTokens.size === 0) return 0;
|
|
442
|
+
let inter = 0;
|
|
443
|
+
for (const t of queryTokens) {
|
|
444
|
+
if (ruleTokens.has(t)) inter++;
|
|
445
|
+
}
|
|
446
|
+
const union = new Set([...queryTokens, ...ruleTokens]);
|
|
447
|
+
return inter / Math.max(1, union.size);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Order calibration rules by query relevance (issue #3552). Highest
|
|
452
|
+
* lexical-similarity first; ties and all-zero scores keep index order, so
|
|
453
|
+
* an unscoreable query yields the historical include-all ordering.
|
|
454
|
+
*/
|
|
455
|
+
export function rankCalibrationRulesForQuery(
|
|
456
|
+
rules: readonly CalibrationRule[],
|
|
457
|
+
query: string,
|
|
458
|
+
): CalibrationRule[] {
|
|
459
|
+
return rules
|
|
460
|
+
.map((rule, index) => ({ rule, index, score: calibrationRuleQueryScore(rule, query) }))
|
|
461
|
+
.sort((a, b) => b.score - a.score || a.index - b.index)
|
|
462
|
+
.map((entry) => entry.rule);
|
|
463
|
+
}
|
|
464
|
+
|
|
419
465
|
/**
|
|
420
466
|
* Build a recall section from calibration rules relevant to the current query.
|
|
421
|
-
*
|
|
467
|
+
* Rules are similarity-ranked against the query before `maxRules` and
|
|
468
|
+
* `maxChars` caps apply, so relevant rules win the budget instead of
|
|
469
|
+
* whichever happen to sit earliest in the index. When nothing matches
|
|
470
|
+
* the query the index order is preserved — the include-all fallback.
|
|
422
471
|
*/
|
|
423
472
|
export function buildCalibrationRecallSection(
|
|
424
473
|
rules: CalibrationRule[],
|
|
425
474
|
query: string,
|
|
426
475
|
maxChars: number = 1200,
|
|
476
|
+
maxRules?: number,
|
|
427
477
|
): string | null {
|
|
428
478
|
if (rules.length === 0) return null;
|
|
429
479
|
|
|
430
|
-
|
|
431
|
-
|
|
480
|
+
const ranked = rankCalibrationRulesForQuery(rules, query);
|
|
481
|
+
const selected =
|
|
482
|
+
maxRules !== undefined ? ranked.slice(0, Math.max(0, maxRules)) : ranked;
|
|
483
|
+
|
|
432
484
|
const lines: string[] = [
|
|
433
485
|
"## Model Calibration (learned from past corrections)",
|
|
434
486
|
"",
|
|
@@ -438,7 +490,7 @@ export function buildCalibrationRecallSection(
|
|
|
438
490
|
|
|
439
491
|
let totalChars = lines.join("\n").length;
|
|
440
492
|
|
|
441
|
-
for (const rule of
|
|
493
|
+
for (const rule of selected) {
|
|
442
494
|
const line = `- **${rule.condition}**: ${rule.modelTendency} → Instead: ${rule.calibration}`;
|
|
443
495
|
if (totalChars + line.length + 1 > maxChars) break;
|
|
444
496
|
lines.push(line);
|