@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
|
@@ -171,6 +171,7 @@ export class ExtractionPersistCoordinator {
|
|
|
171
171
|
): Promise<ExtractionPersistResult> {
|
|
172
172
|
const citationEnabled = resolvePipelineProcessingCapabilities(this.deps.config).inlineSourceAttribution === true;
|
|
173
173
|
const citationTemplate = this.deps.config.inlineSourceAttributionFormat;
|
|
174
|
+
const citationHistory = this.deps.config.inlineSourceAttributionFormatHistory;
|
|
174
175
|
const factDedupEnabled = resolveRecallAuxiliaryCapabilities(this.deps.config).factDeduplication;
|
|
175
176
|
const harmonicConstructionEnabled = resolveCapabilities(this.deps.config).harmonicRetrieval;
|
|
176
177
|
const harmonicAnchorsEnabled =
|
|
@@ -189,7 +190,7 @@ export class ExtractionPersistCoordinator {
|
|
|
189
190
|
const promotedCopyProbe = createBatchPromotedCopyProbe(this.deps.config, this.deps.getStorageRouter, scopeProfileWritePlan); // #2330 finding F: one promoted-copy scan per namespace per batch
|
|
190
191
|
|
|
191
192
|
const normalizeStoredHashSource = (raw: string): string =>
|
|
192
|
-
normalizeStoredHashSourceContent(raw, citationEnabled, citationTemplate);
|
|
193
|
+
normalizeStoredHashSourceContent(raw, citationEnabled, citationTemplate, citationHistory);
|
|
193
194
|
const citationContextBase: Omit<CitationContext, "ts"> = citationEnabled
|
|
194
195
|
? {
|
|
195
196
|
agent: sourceContext?.principal,
|
|
@@ -197,7 +198,7 @@ export class ExtractionPersistCoordinator {
|
|
|
197
198
|
}
|
|
198
199
|
: {};
|
|
199
200
|
const applyInlineCitation = (content: string): string =>
|
|
200
|
-
applyInlineCitationToContent(content, citationEnabled, citationTemplate, citationContextBase);
|
|
201
|
+
applyInlineCitationToContent(content, citationEnabled, citationTemplate, citationContextBase, citationHistory);
|
|
201
202
|
const persistedIds: string[] = [];
|
|
202
203
|
const memoryPathById = new Map<string, string>();
|
|
203
204
|
const anchorSnapshots = new ExtractionAnchorSnapshot({
|
|
@@ -385,8 +386,8 @@ export class ExtractionPersistCoordinator {
|
|
|
385
386
|
);
|
|
386
387
|
if (targets.length === 0) return [];
|
|
387
388
|
const rawContent =
|
|
388
|
-
citationEnabled && hasCitationForTemplate(options.content, citationTemplate)
|
|
389
|
-
? stripCitationForTemplate(options.content, citationTemplate)
|
|
389
|
+
citationEnabled && hasCitationForTemplate(options.content, citationTemplate, citationHistory)
|
|
390
|
+
? stripCitationForTemplate(options.content, citationTemplate, citationHistory)
|
|
390
391
|
: options.content;
|
|
391
392
|
const citedContent = applyInlineCitation(rawContent);
|
|
392
393
|
const sanitizedBase = sanitizeMemoryContent(rawContent);
|
|
@@ -617,8 +618,8 @@ export class ExtractionPersistCoordinator {
|
|
|
617
618
|
// uses the exact body writeMemory stores (#369/#401, #402 round-6).
|
|
618
619
|
const rawContent =
|
|
619
620
|
citationEnabled &&
|
|
620
|
-
hasCitationForTemplate(options.content, citationTemplate)
|
|
621
|
-
? stripCitationForTemplate(options.content, citationTemplate)
|
|
621
|
+
hasCitationForTemplate(options.content, citationTemplate, citationHistory)
|
|
622
|
+
? stripCitationForTemplate(options.content, citationTemplate, citationHistory)
|
|
622
623
|
: options.content;
|
|
623
624
|
const citedContent = applyInlineCitation(rawContent);
|
|
624
625
|
const sanitizedBase = sanitizeMemoryContent(rawContent);
|
|
@@ -996,8 +997,8 @@ export class ExtractionPersistCoordinator {
|
|
|
996
997
|
// Build the same dedupContent the promotion functions hash on so the
|
|
997
998
|
// content-hash lookup in the helper matches what was stored.
|
|
998
999
|
const rawContent =
|
|
999
|
-
citationEnabled && hasCitationForTemplate(args.content, citationTemplate)
|
|
1000
|
-
? stripCitationForTemplate(args.content, citationTemplate)
|
|
1000
|
+
citationEnabled && hasCitationForTemplate(args.content, citationTemplate, citationHistory)
|
|
1001
|
+
? stripCitationForTemplate(args.content, citationTemplate, citationHistory)
|
|
1001
1002
|
: args.content;
|
|
1002
1003
|
const sanitizedBase = sanitizeMemoryContent(rawContent);
|
|
1003
1004
|
// #2014 round 3: promoted copies were written from SALVAGE envelopes,
|
|
@@ -1659,8 +1660,8 @@ export class ExtractionPersistCoordinator {
|
|
|
1659
1660
|
// the title alone, so distinct step lists are not collapsed (issue #519).
|
|
1660
1661
|
const canonicalContentForHash =
|
|
1661
1662
|
citationEnabled &&
|
|
1662
|
-
hasCitationForTemplate(fact.content, citationTemplate)
|
|
1663
|
-
? stripCitationForTemplate(fact.content, citationTemplate)
|
|
1663
|
+
hasCitationForTemplate(fact.content, citationTemplate, citationHistory)
|
|
1664
|
+
? stripCitationForTemplate(fact.content, citationTemplate, citationHistory)
|
|
1664
1665
|
: fact.content;
|
|
1665
1666
|
const contentHashDedupKey =
|
|
1666
1667
|
writeCategory === "procedure"
|
|
@@ -2161,8 +2162,8 @@ export class ExtractionPersistCoordinator {
|
|
|
2161
2162
|
// via stripCitationForTemplate before calling hasFactContentHash.
|
|
2162
2163
|
const rawChunkedContent =
|
|
2163
2164
|
citationEnabled &&
|
|
2164
|
-
hasCitationForTemplate(fact.content, citationTemplate)
|
|
2165
|
-
? stripCitationForTemplate(fact.content, citationTemplate)
|
|
2165
|
+
hasCitationForTemplate(fact.content, citationTemplate, citationHistory)
|
|
2166
|
+
? stripCitationForTemplate(fact.content, citationTemplate, citationHistory)
|
|
2166
2167
|
: fact.content;
|
|
2167
2168
|
const citedChunkedContent = applyInlineCitation(rawChunkedContent);
|
|
2168
2169
|
const parentWriteEnvelope = composeSalvagedExtractionEnvelope(
|
|
@@ -2416,8 +2417,8 @@ export class ExtractionPersistCoordinator {
|
|
|
2416
2417
|
try {
|
|
2417
2418
|
const canonicalChunkedContent =
|
|
2418
2419
|
citationEnabled &&
|
|
2419
|
-
hasCitationForTemplate(fact.content, citationTemplate)
|
|
2420
|
-
? stripCitationForTemplate(fact.content, citationTemplate)
|
|
2420
|
+
hasCitationForTemplate(fact.content, citationTemplate, citationHistory)
|
|
2421
|
+
? stripCitationForTemplate(fact.content, citationTemplate, citationHistory)
|
|
2421
2422
|
: fact.content;
|
|
2422
2423
|
// #1645: do NOT register a tombstone-blocked fact's content in the
|
|
2423
2424
|
// dedup index — writeMemory already skipped it (rule 44). Re-adding
|
|
@@ -1368,9 +1368,8 @@ export class RecallInternalCoordinator {
|
|
|
1368
1368
|
return null;
|
|
1369
1369
|
}
|
|
1370
1370
|
const section = buildCalibrationRecallSection(
|
|
1371
|
-
rules
|
|
1372
|
-
|
|
1373
|
-
this.deps.config.calibrationMaxChars,
|
|
1371
|
+
rules, retrievalQuery, this.deps.config.calibrationMaxChars,
|
|
1372
|
+
this.deps.config.calibrationMaxRulesPerRecall,
|
|
1374
1373
|
);
|
|
1375
1374
|
recordRecallSectionMetric({
|
|
1376
1375
|
section: "calibrationRules",
|
|
@@ -3,8 +3,9 @@ import test from "node:test";
|
|
|
3
3
|
|
|
4
4
|
import { ReplayAdmissionRefusedError, StorageTargetRequiredError } from "../buffer-admission.js";
|
|
5
5
|
import type { AddTurnOutcome } from "../buffer-types.js";
|
|
6
|
+
import { SmartBuffer } from "../buffer.js";
|
|
6
7
|
import { parseConfig } from "../config.js";
|
|
7
|
-
import type { BufferTurn, PluginConfig } from "../types.js";
|
|
8
|
+
import type { BufferEntryState, BufferState, BufferTurn, PluginConfig } from "../types.js";
|
|
8
9
|
import { ingestReplayBatchBuffered } from "./turn-ingestion-buffered.js";
|
|
9
10
|
import type { TurnIngestionDeps } from "./turn-ingestion.js";
|
|
10
11
|
|
|
@@ -222,3 +223,53 @@ test("buffered ingest: LCM archive observes raw turns per session and honors arc
|
|
|
222
223
|
await ingestReplayBatchBuffered(deps, bySession, { writeNamespaceOverride: "ns-work", archiveLcm: false });
|
|
223
224
|
assert.equal(observed.length, 0);
|
|
224
225
|
});
|
|
226
|
+
|
|
227
|
+
function realBufferDeps(config: PluginConfig, entries: Record<string, BufferEntryState>) {
|
|
228
|
+
const initial: BufferState = { turns: [], lastExtractionAt: null, extractionCount: 0, entries };
|
|
229
|
+
const storage = { loadBuffer: async () => structuredClone(initial), saveBuffer: async () => {} };
|
|
230
|
+
// SAFETY: the stub implements the load/save surface SmartBuffer reads; the cast only satisfies StorageManager.
|
|
231
|
+
const buffer = new SmartBuffer(config, storage as never);
|
|
232
|
+
const deps: Deps = { config, buffer, lcmEngine: null, queueBufferedExtraction: async () => {} };
|
|
233
|
+
return deps;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function heldTurns(sessionKey: string, count: number): BufferTurn[] {
|
|
237
|
+
return Array.from({ length: count }, (_, i) => ({ ...turn(`held ${i}`), sessionKey, acceptedCapture: true }));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
test("buffered ingest: a session at its turn cap is refused with the per-session turn cap reason, not entry capacity", async () => {
|
|
241
|
+
const config = parseConfig({ memoryDir: "/tmp/remnic-buffered-test", bufferSaveDebounceMs: 0, bufferMaxTurnsPerSession: 4 });
|
|
242
|
+
const deps = realBufferDeps(config, {
|
|
243
|
+
"pi:full": { turns: heldTurns("pi:full", 4), lastExtractionAt: null, extractionCount: 0 },
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
await assert.rejects(
|
|
247
|
+
ingestReplayBatchBuffered(deps, new Map([["pi:full", [turn("one too many")]]]), { writeNamespaceOverride: "ns-work" }),
|
|
248
|
+
(err: Error) => {
|
|
249
|
+
assert.ok(err instanceof ReplayAdmissionRefusedError, "still the retryable admission class");
|
|
250
|
+
assert.match(err.message, /per-session turn cap \(4\)/);
|
|
251
|
+
assert.match(err.message, /pi:full/);
|
|
252
|
+
assert.doesNotMatch(err.message, /entry capacity/);
|
|
253
|
+
return true;
|
|
254
|
+
},
|
|
255
|
+
);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
test("buffered ingest: a new session refused at the session-entry cap keeps the entry capacity reason", async () => {
|
|
259
|
+
const config = parseConfig({ memoryDir: "/tmp/remnic-buffered-test", bufferSaveDebounceMs: 0, bufferMaxSessions: 3 });
|
|
260
|
+
const deps = realBufferDeps(config, {
|
|
261
|
+
"pi:a": { turns: heldTurns("pi:a", 1), lastExtractionAt: null, extractionCount: 0 },
|
|
262
|
+
"pi:b": { turns: heldTurns("pi:b", 1), lastExtractionAt: null, extractionCount: 0 },
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
await assert.rejects(
|
|
266
|
+
ingestReplayBatchBuffered(deps, new Map([["pi:new", [turn("new session")]]]), { writeNamespaceOverride: "ns-work" }),
|
|
267
|
+
(err: Error) => {
|
|
268
|
+
assert.ok(err instanceof ReplayAdmissionRefusedError);
|
|
269
|
+
assert.match(err.message, /session-entry cap \(3\)/);
|
|
270
|
+
assert.match(err.message, /entry capacity/, "operators grepping the old text still find entry-cap refusals");
|
|
271
|
+
assert.doesNotMatch(err.message, /per-session turn cap/);
|
|
272
|
+
return true;
|
|
273
|
+
},
|
|
274
|
+
);
|
|
275
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Buffered durable replay ingest (#3368 split from turn-ingestion.ts — 1200-line ratchet). */
|
|
2
2
|
|
|
3
3
|
import { ReplayAdmissionRefusedError, StorageTargetRequiredError } from "../buffer-admission.js";
|
|
4
|
+
import type { BoundedAdmissionRefusal } from "../buffer-add-turns-bounded.js";
|
|
4
5
|
import { resolveNamespaceCapabilities } from "../capabilities.js";
|
|
5
6
|
import type { BufferTurn, CodingContext } from "../types.js";
|
|
6
7
|
import type { ResolvedScopeProfilePlan } from "../namespaces/scope-profiles.js";
|
|
@@ -38,16 +39,15 @@ export async function ingestReplayBatchBuffered(
|
|
|
38
39
|
};
|
|
39
40
|
const admissionKey = options.bufferAdmissionIdempotencyKey?.trim();
|
|
40
41
|
const batches = [...bySession].map(([bufferKey, sessionTurns]) => ({ bufferKey, turns: sessionTurns.map(pin) }));
|
|
42
|
+
let refusal: BoundedAdmissionRefusal | undefined;
|
|
43
|
+
const onRefused = (reason: BoundedAdmissionRefusal): void => {
|
|
44
|
+
refusal = reason;
|
|
45
|
+
};
|
|
41
46
|
const outcomes = admissionKey
|
|
42
|
-
? await deps.buffer.addTurnsBoundedForObserveReplay(batches, admissionKey)
|
|
43
|
-
: await deps.buffer.addTurnsBounded(batches);
|
|
47
|
+
? await deps.buffer.addTurnsBoundedForObserveReplay(batches, admissionKey, onRefused)
|
|
48
|
+
: await deps.buffer.addTurnsBounded(batches, onRefused);
|
|
44
49
|
if (outcomes === "duplicate") return;
|
|
45
|
-
if (outcomes === null)
|
|
46
|
-
const refusedKey = batches.find((batch) => batch.turns.length > 0)?.bufferKey ?? "unknown";
|
|
47
|
-
throw new ReplayAdmissionRefusedError(
|
|
48
|
-
`durable observe capture refused: extraction buffer at entry capacity for batch containing ${refusedKey}`,
|
|
49
|
-
);
|
|
50
|
-
}
|
|
50
|
+
if (outcomes === null) throw replayRefusal(refusal, batches);
|
|
51
51
|
|
|
52
52
|
await deps.buffer.flushPendingSave({ throwOnFailure: true });
|
|
53
53
|
|
|
@@ -72,3 +72,21 @@ export async function ingestReplayBatchBuffered(
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
function replayRefusal(
|
|
77
|
+
refusal: BoundedAdmissionRefusal | undefined,
|
|
78
|
+
batches: readonly { bufferKey: string; turns: readonly BufferTurn[] }[],
|
|
79
|
+
): ReplayAdmissionRefusedError {
|
|
80
|
+
if (refusal?.reason === "session_turn_cap") {
|
|
81
|
+
return new ReplayAdmissionRefusedError(
|
|
82
|
+
`durable observe capture refused: session ${refusal.bufferKey} holds the per-session turn cap ` +
|
|
83
|
+
`(${refusal.maxTurnsPerSession}) of unextracted turns; retry after extraction drains it`,
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
const refusedKey = batches.find((batch) => batch.turns.length > 0)?.bufferKey ?? "unknown";
|
|
87
|
+
const cap = refusal?.reason === "session_entry_cap" ? ` (${refusal.maxSessionEntries})` : "";
|
|
88
|
+
return new ReplayAdmissionRefusedError(
|
|
89
|
+
`durable observe capture refused: extraction buffer at entry capacity, session-entry cap${cap} ` +
|
|
90
|
+
`full for batch containing ${refusedKey}`,
|
|
91
|
+
);
|
|
92
|
+
}
|
package/src/orchestrator.ts
CHANGED
|
@@ -1520,6 +1520,7 @@ export class Orchestrator {
|
|
|
1520
1520
|
// Propagate the inline-attribution template so the storage layer can strip
|
|
1521
1521
|
// citations from legacy facts during the hash-index rebuild path.
|
|
1522
1522
|
this.storage.citationTemplate = config.inlineSourceAttributionFormat;
|
|
1523
|
+
this.storage.citationTemplateHistory = config.inlineSourceAttributionFormatHistory;
|
|
1523
1524
|
// #1522: bind the post-write catalog touch at the storage chokepoint.
|
|
1524
1525
|
if (config.defaultNamespace) this.storageRouter.bindCatalogWriteHook(this.storage, config.defaultNamespace);
|
|
1525
1526
|
// Wire page-level versioning (issue #371)
|
|
@@ -156,3 +156,43 @@ test("input entries are not mutated", () => {
|
|
|
156
156
|
buildStateEvidencePackets(entries);
|
|
157
157
|
assert.deepEqual(entries, snapshot);
|
|
158
158
|
});
|
|
159
|
+
|
|
160
|
+
test("shared chain suffixes resolve each entry at its own depth — #3565", () => {
|
|
161
|
+
// Diamond: two predecessors share one suffix chain. A memoized walk must
|
|
162
|
+
// give every entry its OWN depth (a1/a2 = 3, b = 2, c = 1), not the depth
|
|
163
|
+
// of whichever entry populated the cache entry it shared.
|
|
164
|
+
const entries: StateViewEntry[] = [
|
|
165
|
+
{ memoryId: "head", stateLabel: "current" },
|
|
166
|
+
{ memoryId: "a1", stateLabel: "historical", supersededById: "b" },
|
|
167
|
+
{ memoryId: "a2", stateLabel: "historical", supersededById: "b" },
|
|
168
|
+
{ memoryId: "b", stateLabel: "historical", supersededById: "c" },
|
|
169
|
+
{ memoryId: "c", stateLabel: "historical", supersededById: "head" },
|
|
170
|
+
];
|
|
171
|
+
const out = buildStateEvidencePackets(entries);
|
|
172
|
+
assert.deepEqual(out, {
|
|
173
|
+
packets: [{ headId: "head", historyIds: ["c", "b", "a1", "a2"] }],
|
|
174
|
+
orphanHistoryIds: [],
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test("a long chain resolves in one pass, preserving per-entry depth order — #3565", () => {
|
|
179
|
+
// 600-entry chain: nearest-to-head ordering must hold end-to-end. Guards
|
|
180
|
+
// the O(n) memoized walk against off-by-one depth corruption at scale.
|
|
181
|
+
const n = 600;
|
|
182
|
+
const entries: StateViewEntry[] = [{ memoryId: "head", stateLabel: "current" }];
|
|
183
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
184
|
+
entries.push({
|
|
185
|
+
memoryId: `h${i}`,
|
|
186
|
+
stateLabel: "historical",
|
|
187
|
+
supersededById: i === n - 1 ? "head" : `h${i + 1}`,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
const out = buildStateEvidencePackets(entries);
|
|
191
|
+
const packet = out.packets.find((p) => p.headId === "head");
|
|
192
|
+
assert.ok(packet);
|
|
193
|
+
assert.equal(packet.historyIds.length, n);
|
|
194
|
+
assert.deepEqual(
|
|
195
|
+
packet.historyIds,
|
|
196
|
+
Array.from({ length: n }, (_, i) => `h${n - 1 - i}`),
|
|
197
|
+
);
|
|
198
|
+
});
|
|
@@ -47,25 +47,63 @@ interface Attachment {
|
|
|
47
47
|
* stop at the first current/transition successor. Returns undefined when the
|
|
48
48
|
* walk dead-ends (no or blank successor, successor id absent from the input)
|
|
49
49
|
* or revisits an id (cycle), so callers treat the entry as an orphan.
|
|
50
|
+
*
|
|
51
|
+
* `resolved` memoizes per-entry outcomes across calls (#3565): every id
|
|
52
|
+
* traversed gets its own cached resolution (its own depth), so one long
|
|
53
|
+
* chain resolves in a single pass instead of O(n^2) re-walks.
|
|
50
54
|
*/
|
|
51
55
|
function resolveHead(
|
|
52
56
|
entry: StateViewEntry,
|
|
53
57
|
byId: ReadonlyMap<string, StateViewEntry>,
|
|
58
|
+
resolved: Map<string, HeadResolution | undefined>,
|
|
54
59
|
): HeadResolution | undefined {
|
|
55
|
-
const
|
|
60
|
+
const cached = resolved.get(entry.memoryId);
|
|
61
|
+
if (cached !== undefined || resolved.has(entry.memoryId)) return cached;
|
|
62
|
+
const path: string[] = [entry.memoryId];
|
|
63
|
+
const visited = new Set<string>(path);
|
|
56
64
|
let current = entry;
|
|
57
65
|
let depth = 0;
|
|
58
66
|
for (;;) {
|
|
59
67
|
const successorId = current.supersededById;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
const successor =
|
|
69
|
+
successorId === undefined || successorId.trim() === ""
|
|
70
|
+
? undefined
|
|
71
|
+
: byId.get(successorId);
|
|
72
|
+
if (successor === undefined || successorId === undefined) break;
|
|
73
|
+
const hit = resolved.get(successorId);
|
|
74
|
+
if (hit !== undefined || resolved.has(successorId)) {
|
|
75
|
+
// A node with a known outcome: splice its resolution on with an
|
|
76
|
+
// offset, or propagate the dead-end.
|
|
77
|
+
const result =
|
|
78
|
+
hit === undefined
|
|
79
|
+
? undefined
|
|
80
|
+
: { headId: hit.headId, depth: depth + 1 + hit.depth };
|
|
81
|
+
for (let i = 0; i < path.length; i++) {
|
|
82
|
+
resolved.set(
|
|
83
|
+
path[i],
|
|
84
|
+
result === undefined
|
|
85
|
+
? undefined
|
|
86
|
+
: { headId: result.headId, depth: result.depth - i },
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
63
91
|
depth += 1;
|
|
64
|
-
if (successor.stateLabel !== "historical")
|
|
65
|
-
|
|
92
|
+
if (successor.stateLabel !== "historical") {
|
|
93
|
+
// Head found: every path node resolves to it at its own depth.
|
|
94
|
+
for (let i = 0; i < path.length; i++) {
|
|
95
|
+
resolved.set(path[i], { headId: successorId, depth: depth - i });
|
|
96
|
+
}
|
|
97
|
+
return { headId: successorId, depth };
|
|
98
|
+
}
|
|
99
|
+
if (visited.has(successorId)) break;
|
|
66
100
|
visited.add(successorId);
|
|
101
|
+
path.push(successorId);
|
|
67
102
|
current = successor;
|
|
68
103
|
}
|
|
104
|
+
// Dead-end or cycle: every node on the path is an orphan.
|
|
105
|
+
for (const id of path) resolved.set(id, undefined);
|
|
106
|
+
return undefined;
|
|
69
107
|
}
|
|
70
108
|
|
|
71
109
|
function compareStrings(a: string, b: string): number {
|
|
@@ -97,12 +135,11 @@ export function buildStateEvidencePackets(
|
|
|
97
135
|
if (!byId.has(entry.memoryId)) byId.set(entry.memoryId, entry);
|
|
98
136
|
}
|
|
99
137
|
|
|
100
|
-
// ponytail: per-entry chain walks are O(n^2) on one long chain; recall-sized
|
|
101
|
-
// result sets stay tiny, memoize if packet building ever moves offline.
|
|
102
138
|
const packets: StateEvidencePacket[] = [];
|
|
103
139
|
const packetByHead = new Map<string, StateEvidencePacket>();
|
|
104
140
|
const attachments: Attachment[] = [];
|
|
105
141
|
const orphanHistoryIds: string[] = [];
|
|
142
|
+
const resolved = new Map<string, HeadResolution | undefined>();
|
|
106
143
|
|
|
107
144
|
for (const [id, entry] of byId) {
|
|
108
145
|
if (entry.stateLabel !== "historical") {
|
|
@@ -111,7 +148,7 @@ export function buildStateEvidencePackets(
|
|
|
111
148
|
packets.push(packet);
|
|
112
149
|
continue;
|
|
113
150
|
}
|
|
114
|
-
const head = resolveHead(entry, byId);
|
|
151
|
+
const head = resolveHead(entry, byId, resolved);
|
|
115
152
|
if (head === undefined) orphanHistoryIds.push(id);
|
|
116
153
|
else attachments.push({ headId: head.headId, historyId: id, depth: head.depth });
|
|
117
154
|
}
|
|
@@ -1518,3 +1518,60 @@ test("citation matcher resists polynomial ReDoS on hostile unterminated input (C
|
|
|
1518
1518
|
const valid = parseAllCitations("body [Source: doc-1 , 2026-06-08 ]");
|
|
1519
1519
|
assert.equal(valid.length, 1);
|
|
1520
1520
|
});
|
|
1521
|
+
|
|
1522
|
+
test("#3567 hasCitationForTemplate: default fast path consults configured prior templates", () => {
|
|
1523
|
+
// Fact written while a custom template was configured; config later reverted
|
|
1524
|
+
// to the default. The marker does not match the default shape, so the old
|
|
1525
|
+
// `template === DEFAULT_CITATION_FORMAT` fast path returned false and the
|
|
1526
|
+
// body was double-cited / hash-mismatched on reprocess.
|
|
1527
|
+
const priorTemplate = "[src:{agent}/{session}@{date}]";
|
|
1528
|
+
const body = "Latency improved after the index rebuild.";
|
|
1529
|
+
const cited = attachCitation(
|
|
1530
|
+
body,
|
|
1531
|
+
{ agent: "scout", session: "agent:scout:alpha", ts: "2026-04-10T14:25:07Z" },
|
|
1532
|
+
priorTemplate,
|
|
1533
|
+
);
|
|
1534
|
+
|
|
1535
|
+
// The prior template is out of history: the miss stands (documents the
|
|
1536
|
+
// operator contract — list prior formats in inlineSourceAttributionFormatHistory).
|
|
1537
|
+
assert.equal(hasCitationForTemplate(cited, DEFAULT_CITATION_FORMAT), false);
|
|
1538
|
+
|
|
1539
|
+
// With the prior template declared, the same check detects it.
|
|
1540
|
+
assert.equal(
|
|
1541
|
+
hasCitationForTemplate(cited, DEFAULT_CITATION_FORMAT, [priorTemplate]),
|
|
1542
|
+
true,
|
|
1543
|
+
);
|
|
1544
|
+
});
|
|
1545
|
+
|
|
1546
|
+
test("#3567 stripCitationForTemplate strips a prior-template marker under a reverted config", () => {
|
|
1547
|
+
const priorTemplate = "[src:{agent}/{session}@{date}]";
|
|
1548
|
+
const body = "Latency improved after the index rebuild.";
|
|
1549
|
+
const cited = attachCitation(
|
|
1550
|
+
body,
|
|
1551
|
+
{ agent: "scout", session: "agent:scout:alpha", ts: "2026-04-10T14:25:07Z" },
|
|
1552
|
+
priorTemplate,
|
|
1553
|
+
);
|
|
1554
|
+
|
|
1555
|
+
assert.equal(
|
|
1556
|
+
stripCitationForTemplate(cited, DEFAULT_CITATION_FORMAT, [priorTemplate]),
|
|
1557
|
+
body,
|
|
1558
|
+
);
|
|
1559
|
+
});
|
|
1560
|
+
|
|
1561
|
+
test("#3567 attachCitation does not double-cite a body carrying a prior-template marker", () => {
|
|
1562
|
+
const priorTemplate = "[src:{agent}/{session}@{date}]";
|
|
1563
|
+
const body = "Latency improved after the index rebuild.";
|
|
1564
|
+
const cited = attachCitation(
|
|
1565
|
+
body,
|
|
1566
|
+
{ agent: "scout", session: "agent:scout:alpha", ts: "2026-04-10T14:25:07Z" },
|
|
1567
|
+
priorTemplate,
|
|
1568
|
+
);
|
|
1569
|
+
|
|
1570
|
+
const reattached = attachCitation(
|
|
1571
|
+
cited,
|
|
1572
|
+
{ agent: "planner", session: "agent:planner:main", ts: "2026-06-01T00:00:00Z" },
|
|
1573
|
+
DEFAULT_CITATION_FORMAT,
|
|
1574
|
+
[priorTemplate],
|
|
1575
|
+
);
|
|
1576
|
+
assert.equal(reattached, cited);
|
|
1577
|
+
});
|
|
@@ -407,40 +407,34 @@ function templateMatcher(template: string): RegExp | null {
|
|
|
407
407
|
* `[Source: ...]` marker detection which is always available via
|
|
408
408
|
* {@link hasCitation}.
|
|
409
409
|
*/
|
|
410
|
-
export function hasCitationForTemplate(
|
|
410
|
+
export function hasCitationForTemplate(
|
|
411
|
+
text: string,
|
|
412
|
+
template: string,
|
|
413
|
+
priorTemplates: readonly string[] = [],
|
|
414
|
+
): boolean {
|
|
411
415
|
if (typeof text !== "string" || text.length === 0) return false;
|
|
412
416
|
// Always accept the default format as a fallback so facts tagged before a
|
|
413
417
|
// configuration change are not double-tagged on reprocessing.
|
|
414
418
|
if (hasCitation(text)) return true;
|
|
415
|
-
//
|
|
416
|
-
//
|
|
417
|
-
//
|
|
418
|
-
//
|
|
419
|
-
//
|
|
420
|
-
//
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
// (missing an old custom citation) produces a benign duplicate citation rather
|
|
424
|
-
// than data loss. A full fix would require storing the citation template used
|
|
425
|
-
// at write time in the frontmatter and checking that here.
|
|
426
|
-
if (template === DEFAULT_CITATION_FORMAT) return false;
|
|
427
|
-
|
|
428
|
-
// Fully-literal template (no placeholders): exact inclusion check.
|
|
429
|
-
if (!PLACEHOLDER_REGEX.test(template)) {
|
|
430
|
-
// Reset lastIndex because PLACEHOLDER_REGEX is declared with /g.
|
|
419
|
+
// Probe the current template plus every declared prior format
|
|
420
|
+
// (`inlineSourceAttributionFormatHistory`, issue #3567). A fact written
|
|
421
|
+
// while a different template was configured is detected here instead of
|
|
422
|
+
// being double-cited or hashed with its marker intact on reprocess.
|
|
423
|
+
// citationTemplatesToRecognize drops undetectable shapes, so an
|
|
424
|
+
// all-placeholder prior cannot false-positive.
|
|
425
|
+
for (const candidate of citationTemplatesToRecognize(template, priorTemplates)) {
|
|
426
|
+
if (candidate === DEFAULT_CITATION_FORMAT) continue;
|
|
431
427
|
PLACEHOLDER_REGEX.lastIndex = 0;
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
// docstring — callers should not rely on dedup for this shape.
|
|
441
|
-
return false;
|
|
428
|
+
if (!PLACEHOLDER_REGEX.test(candidate)) {
|
|
429
|
+
PLACEHOLDER_REGEX.lastIndex = 0;
|
|
430
|
+
if (text.includes(candidate)) return true;
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
PLACEHOLDER_REGEX.lastIndex = 0;
|
|
434
|
+
const matcher = templateMatcher(candidate);
|
|
435
|
+
if (matcher?.test(text)) return true;
|
|
442
436
|
}
|
|
443
|
-
return
|
|
437
|
+
return false;
|
|
444
438
|
}
|
|
445
439
|
|
|
446
440
|
/**
|
|
@@ -573,9 +567,10 @@ export function attachCitation(
|
|
|
573
567
|
text: string,
|
|
574
568
|
ctx: CitationContext,
|
|
575
569
|
template: string = DEFAULT_CITATION_FORMAT,
|
|
570
|
+
priorTemplates: readonly string[] = [],
|
|
576
571
|
): string {
|
|
577
572
|
if (typeof text !== "string") return text as unknown as string;
|
|
578
|
-
if (hasCitationForTemplate(text, template)) return text;
|
|
573
|
+
if (hasCitationForTemplate(text, template, priorTemplates)) return text;
|
|
579
574
|
const trimmedEnd = trimTrailingWhitespace(text);
|
|
580
575
|
if (trimmedEnd.length === 0) return text;
|
|
581
576
|
const citation = formatCitation(ctx, template);
|
|
@@ -730,28 +725,36 @@ export function stripCitation(text: string): string {
|
|
|
730
725
|
export function stripCitationForTemplate(
|
|
731
726
|
text: string,
|
|
732
727
|
template: string,
|
|
728
|
+
priorTemplates: readonly string[] = [],
|
|
733
729
|
): string {
|
|
734
730
|
if (typeof text !== "string" || text.length === 0) return text;
|
|
735
731
|
|
|
736
|
-
// First pass: the default-format marker, if any.
|
|
737
|
-
//
|
|
738
|
-
//
|
|
739
|
-
|
|
732
|
+
// First pass: the default-format marker, if any. Later passes still run —
|
|
733
|
+
// a body can carry the default marker AND markers from the current or a
|
|
734
|
+
// prior configured template, and canonicalization must remove every
|
|
735
|
+
// recognized form.
|
|
736
|
+
let out = hasCitation(text) ? stripCitation(text) : text;
|
|
740
737
|
|
|
741
|
-
|
|
738
|
+
for (const candidate of citationTemplatesToRecognize(template, priorTemplates)) {
|
|
739
|
+
if (candidate === DEFAULT_CITATION_FORMAT) continue;
|
|
740
|
+
out = stripSingleTemplateCitation(out, candidate);
|
|
741
|
+
}
|
|
742
|
+
return out;
|
|
743
|
+
}
|
|
742
744
|
|
|
745
|
+
// Strips every marker `template` produces — literal templates by exact
|
|
746
|
+
// match, placeholder templates via the compiled matcher. Undetectable
|
|
747
|
+
// (all-placeholder) shapes leave the text unchanged.
|
|
748
|
+
function stripSingleTemplateCitation(text: string, template: string): string {
|
|
743
749
|
PLACEHOLDER_REGEX.lastIndex = 0;
|
|
744
750
|
if (!PLACEHOLDER_REGEX.test(template)) {
|
|
745
751
|
PLACEHOLDER_REGEX.lastIndex = 0;
|
|
746
|
-
return stripExactLiteralCitation(
|
|
752
|
+
return stripExactLiteralCitation(text, template);
|
|
747
753
|
}
|
|
748
754
|
PLACEHOLDER_REGEX.lastIndex = 0;
|
|
749
755
|
|
|
750
|
-
// Build the template matcher. hasCitationForTemplate already returned true,
|
|
751
|
-
// which means templateMatcher produced a non-null result. The null branch
|
|
752
|
-
// here is a defensive fallback only — the default pass already ran.
|
|
753
756
|
const matcher = templateMatcher(template);
|
|
754
|
-
if (!matcher) return
|
|
757
|
+
if (!matcher) return text;
|
|
755
758
|
|
|
756
759
|
// The matcher regex was built without the global flag; add it for exec loop.
|
|
757
760
|
const globalMatcher = new RegExp(
|
|
@@ -762,12 +765,12 @@ export function stripCitationForTemplate(
|
|
|
762
765
|
let lastIndex = 0;
|
|
763
766
|
let match: RegExpExecArray | null;
|
|
764
767
|
|
|
765
|
-
while ((match = globalMatcher.exec(
|
|
768
|
+
while ((match = globalMatcher.exec(text)) !== null) {
|
|
766
769
|
const matchEnd = match.index + match[0].length;
|
|
767
|
-
const enclosure = enclosingDelimiterRange(
|
|
770
|
+
const enclosure = enclosingDelimiterRange(text, match.index, matchEnd);
|
|
768
771
|
const removalStart = enclosure?.start ?? match.index;
|
|
769
772
|
const removalEnd = enclosure?.end ?? matchEnd;
|
|
770
|
-
const before =
|
|
773
|
+
const before = text.slice(lastIndex, removalStart).replace(/[ \t]+$/, "");
|
|
771
774
|
result += before;
|
|
772
775
|
lastIndex = removalEnd;
|
|
773
776
|
// Guard against zero-width matches causing an infinite loop.
|
|
@@ -776,7 +779,7 @@ export function stripCitationForTemplate(
|
|
|
776
779
|
}
|
|
777
780
|
}
|
|
778
781
|
|
|
779
|
-
const after =
|
|
782
|
+
const after = text.slice(lastIndex).replace(/^[ \t]+/, "");
|
|
780
783
|
if (after.length > 0) {
|
|
781
784
|
if (result.length > 0) result += " ";
|
|
782
785
|
result += after;
|
package/src/storage.ts
CHANGED
|
@@ -1923,6 +1923,7 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
|
|
|
1923
1923
|
private offlineSyncDigestCacheWriteTimer: ReturnType<typeof setTimeout> | null = null;
|
|
1924
1924
|
/** Optional: set by the orchestrator after construction to enable template-aware citation stripping during legacy hash rebuild. */
|
|
1925
1925
|
citationTemplate: string = DEFAULT_CITATION_FORMAT;
|
|
1926
|
+
citationTemplateHistory: string[] = [];
|
|
1926
1927
|
/** Post-write catalog hook (#1522). Installed by the namespace router; fire-and-forget. */
|
|
1927
1928
|
onCatalogWrite?: () => void;
|
|
1928
1929
|
/** Post-write embedding hook (#2019). Installed by the orchestrator; fire-and-forget. */
|
|
@@ -3142,7 +3143,7 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
|
|
|
3142
3143
|
// and the normalized-text tier must match re-extraction, which hashes
|
|
3143
3144
|
// the citation-stripped contentHashSource. Idempotent on pre-stripped
|
|
3144
3145
|
// text (e.g. recordSupersession).
|
|
3145
|
-
const strippedRawContent = stripCitationForTemplate(input.rawContent, this.citationTemplate);
|
|
3146
|
+
const strippedRawContent = stripCitationForTemplate(input.rawContent, this.citationTemplate, this.citationTemplateHistory);
|
|
3146
3147
|
// Canonicalization + post-append recheck (#2213) live in the helper.
|
|
3147
3148
|
return await entityRefs.appendCanonicalizedTombstone(
|
|
3148
3149
|
this.stateDir,
|
|
@@ -3212,7 +3213,7 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
|
|
|
3212
3213
|
const all = [...(await this.readAllMemories()), ...(await this.readAllColdMemories())];
|
|
3213
3214
|
// Pure projection (lifecycle/tombstones.ts) keeps this method thin (#1520).
|
|
3214
3215
|
const retired = collectRetiredMemoriesForRebuild(all, {
|
|
3215
|
-
stripCitation: (text) => stripCitationForTemplate(text, this.citationTemplate),
|
|
3216
|
+
stripCitation: (text) => stripCitationForTemplate(text, this.citationTemplate, this.citationTemplateHistory),
|
|
3216
3217
|
supersessionKeysForFact,
|
|
3217
3218
|
});
|
|
3218
3219
|
return await store.rebuild(retired);
|
|
@@ -3428,7 +3429,7 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
|
|
|
3428
3429
|
}
|
|
3429
3430
|
private storedContentIdentityCandidates(content: string): string[] {
|
|
3430
3431
|
return storedContentIdentityCandidates(content, (value) =>
|
|
3431
|
-
hasCitationForTemplate(value, this.citationTemplate) ? stripCitationForTemplate(value, this.citationTemplate) : value
|
|
3432
|
+
hasCitationForTemplate(value, this.citationTemplate, this.citationTemplateHistory) ? stripCitationForTemplate(value, this.citationTemplate, this.citationTemplateHistory) : value
|
|
3432
3433
|
);
|
|
3433
3434
|
}
|
|
3434
3435
|
|