@remnic/core 9.7.15 → 9.9.0
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.d.ts +13 -6
- package/dist/access-admin-ops-surface.js +85 -71
- package/dist/access-audit.js +2 -2
- package/dist/access-boundary.d.ts +35 -17
- package/dist/access-boundary.js +86 -74
- package/dist/access-citation.d.ts +28 -0
- package/dist/access-citation.js +9 -0
- package/dist/access-cli.js +194 -178
- package/dist/access-cli.js.map +1 -1
- package/dist/access-errors.d.ts +16 -1
- package/dist/access-errors.js +7 -3
- package/dist/access-http.d.ts +25 -19
- package/dist/access-http.js +100 -87
- package/dist/access-identity-continuity-surface.d.ts +13 -8
- package/dist/access-identity-continuity-surface.js +85 -71
- package/dist/access-lcm-surface.d.ts +16 -9
- package/dist/access-lcm-surface.js +85 -71
- package/dist/access-mcp.d.ts +23 -16
- package/dist/access-mcp.js +96 -84
- package/dist/access-memory-search-fanout.d.ts +93 -0
- package/dist/access-memory-search-fanout.js +18 -0
- package/dist/access-observe-write-surface.d.ts +26 -8
- package/dist/access-observe-write-surface.js +85 -71
- package/dist/access-operations-batch.js +92 -80
- package/dist/access-operations.d.ts +29 -22
- package/dist/access-operations.js +94 -82
- package/dist/access-recall-concurrency.d.ts +250 -0
- package/dist/access-recall-concurrency.js +157 -0
- package/dist/access-recall-response.d.ts +130 -0
- package/dist/access-recall-response.js +147 -0
- package/dist/access-recall-surface.d.ts +15 -7
- package/dist/access-recall-surface.js +85 -71
- package/dist/access-schema.d.ts +98 -98
- package/dist/access-schema.js +8 -6
- package/dist/{access-service-DpcYZ9Nl.d.ts → access-service-DbZ1G3zV.d.ts} +29 -36
- package/dist/access-service.d.ts +13 -6
- package/dist/access-service.js +89 -72
- package/dist/access-surface-catalog.d.ts +23 -16
- package/dist/access-surface-catalog.js +1 -0
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/access-token-capabilities.d.ts +2 -1
- package/dist/access-token-capabilities.js +4 -2
- package/dist/action-confidence.d.ts +3 -1
- package/dist/active-memory-bridge.d.ts +3 -1
- package/dist/active-memory-bridge.js +4 -4
- package/dist/active-recall.d.ts +4 -1
- package/dist/active-recall.js +23 -13
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/{auto-sync-AAMTVZMK.js → auto-sync-UZG3XQZ5.js} +14 -8
- package/dist/{auto-sync-AAMTVZMK.js.map → auto-sync-UZG3XQZ5.js.map} +1 -1
- package/dist/behavior-learner.d.ts +3 -1
- package/dist/behavior-signals.d.ts +3 -1
- package/dist/bootstrap.d.ts +12 -7
- package/dist/bootstrap.js +2 -2
- package/dist/bounded-jsonl-state.d.ts +54 -0
- package/dist/bounded-jsonl-state.js +10 -0
- package/dist/boxes.js +2 -2
- package/dist/briefing.d.ts +5 -2
- package/dist/briefing.js +34 -24
- package/dist/buffer-surprise-report.d.ts +3 -1
- package/dist/buffer.d.ts +60 -2
- package/dist/buffer.js +3 -3
- package/dist/bulk-import/index.d.ts +5 -3
- package/dist/calibration.d.ts +3 -1
- package/dist/calibration.js +6 -6
- package/dist/capabilities.d.ts +7 -7
- package/dist/capabilities.js +1 -1
- package/dist/{capsule-crypto-CZJSLEFG.js → capsule-crypto-YO5QJ6L3.js} +3 -3
- package/dist/capsule-crypto-YO5QJ6L3.js.map +1 -0
- package/dist/{catalog-C9444P10.d.ts → catalog-BWqHb5HT.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +3 -1
- package/dist/causal-behavior.js +6 -6
- package/dist/causal-chain.js +4 -4
- package/dist/causal-consolidation.d.ts +3 -1
- package/dist/causal-consolidation.js +43 -34
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +6 -6
- package/dist/causal-trajectory-graph.d.ts +3 -1
- package/dist/causal-trajectory-graph.js +1 -1
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-A3GOMRJG.js → chunk-23L3IXFD.js} +2 -2
- package/dist/chunk-2CGLBUW3.js +15 -0
- package/dist/chunk-2CGLBUW3.js.map +1 -0
- package/dist/{chunk-MRHFJV44.js → chunk-2DQ2XREU.js} +2 -2
- package/dist/{chunk-L2B3EE7B.js → chunk-2QMKMVHH.js} +2 -2
- package/dist/{chunk-VJVNLNDQ.js → chunk-2UFO7X4Q.js} +7 -7
- package/dist/{chunk-2MR3MFQB.js → chunk-2VEOKUPP.js} +3 -3
- package/dist/chunk-2Z24E5W2.js +22 -0
- package/dist/chunk-2Z24E5W2.js.map +1 -0
- package/dist/{chunk-RHOZ5LLO.js → chunk-347WD2LE.js} +2 -2
- package/dist/{chunk-HDTQVNWD.js → chunk-3QAH2S33.js} +3 -3
- package/dist/{chunk-37CTGERM.js → chunk-3WCASNQZ.js} +12 -1
- package/dist/chunk-3WCASNQZ.js.map +1 -0
- package/dist/{chunk-LRNMRXJO.js → chunk-3Y224NYC.js} +3 -3
- package/dist/{chunk-3IY64MV6.js → chunk-44XZ75OQ.js} +44 -10
- package/dist/chunk-44XZ75OQ.js.map +1 -0
- package/dist/{chunk-VFSP73LP.js → chunk-45GF7Y3V.js} +2 -2
- package/dist/{chunk-K7LOWSLU.js → chunk-4BJQODZF.js} +2479 -1520
- package/dist/chunk-4BJQODZF.js.map +1 -0
- package/dist/{chunk-JREB6UFH.js → chunk-57OWKFUQ.js} +17 -6
- package/dist/chunk-57OWKFUQ.js.map +1 -0
- package/dist/{chunk-OEHCMALU.js → chunk-5I4M26Q7.js} +5 -5
- package/dist/{chunk-2AZXIZEN.js → chunk-5Q7EVV4X.js} +6 -6
- package/dist/{chunk-LC7OODWZ.js → chunk-5SB7SC2G.js} +80 -49
- package/dist/chunk-5SB7SC2G.js.map +1 -0
- package/dist/{chunk-PUBTHW5O.js → chunk-6DRPPQEJ.js} +2 -2
- package/dist/{chunk-NWTGD4AN.js → chunk-6KIQT7RG.js} +10 -9
- package/dist/chunk-6KIQT7RG.js.map +1 -0
- package/dist/{chunk-FDCTQWLW.js → chunk-6O22TZSB.js} +3 -3
- package/dist/{chunk-ZQ7UBUZ6.js → chunk-6QYST5XN.js} +6 -6
- package/dist/{chunk-W4PGTAS2.js → chunk-6WAFYNVT.js} +3 -3
- package/dist/chunk-6ZMAMSHS.js +20 -0
- package/dist/chunk-6ZMAMSHS.js.map +1 -0
- package/dist/{chunk-R5VAVVHP.js → chunk-72A4L5JJ.js} +2 -2
- package/dist/{chunk-X64YLC24.js → chunk-72VAXGEI.js} +5 -13
- package/dist/chunk-72VAXGEI.js.map +1 -0
- package/dist/{chunk-IKQTFQMI.js → chunk-755Q3DGF.js} +22 -3
- package/dist/chunk-755Q3DGF.js.map +1 -0
- package/dist/{chunk-D7FOKIY5.js → chunk-7AMFUATK.js} +12 -9
- package/dist/{chunk-D7FOKIY5.js.map → chunk-7AMFUATK.js.map} +1 -1
- package/dist/{chunk-BFVEEB7W.js → chunk-7ON2JW73.js} +57 -22
- package/dist/chunk-7ON2JW73.js.map +1 -0
- package/dist/chunk-7RNBVZZO.js +270 -0
- package/dist/chunk-7RNBVZZO.js.map +1 -0
- package/dist/{chunk-3FAMU5TX.js → chunk-A6USBZTO.js} +2 -2
- package/dist/{chunk-ZHIVCODT.js → chunk-A72SWTWW.js} +7 -7
- package/dist/{chunk-FC77VUX5.js → chunk-A7Q43EUZ.js} +2 -2
- package/dist/{chunk-UJBESW6X.js → chunk-AE7WMV4V.js} +7 -7
- package/dist/{chunk-J2HSAU72.js → chunk-AIK5W3IW.js} +29 -1
- package/dist/chunk-AIK5W3IW.js.map +1 -0
- package/dist/{chunk-A5UXZRRM.js → chunk-AJ7QCSIS.js} +2 -2
- package/dist/{chunk-FNMFJWBY.js → chunk-ANEUPF6O.js} +5 -5
- package/dist/chunk-AREGMX2J.js +50 -0
- package/dist/chunk-AREGMX2J.js.map +1 -0
- package/dist/chunk-AVPXXV6J.js +448 -0
- package/dist/chunk-AVPXXV6J.js.map +1 -0
- package/dist/{chunk-2A3OXAP2.js → chunk-B7RWBZXW.js} +2 -2
- package/dist/{chunk-QKQYXZVS.js → chunk-BI2OJF6J.js} +1819 -1481
- package/dist/chunk-BI2OJF6J.js.map +1 -0
- package/dist/{chunk-GWTFLF2P.js → chunk-BJMBJZ2Y.js} +59 -59
- package/dist/chunk-BJMBJZ2Y.js.map +1 -0
- package/dist/{chunk-74F5STS4.js → chunk-BLAKS3CP.js} +4 -4
- package/dist/{chunk-M7VGG3ID.js → chunk-BV5WMSIJ.js} +9 -9
- package/dist/{chunk-2BFLDH5F.js → chunk-BXLOS5AJ.js} +2 -2
- package/dist/{chunk-UXKMMNJD.js → chunk-C23BYTJV.js} +6 -6
- package/dist/{chunk-JZHHREBL.js → chunk-C3AKM55W.js} +2 -2
- package/dist/{chunk-RP7YXA67.js → chunk-C5JF6EZ7.js} +2 -2
- package/dist/{chunk-T7Y5KPLN.js → chunk-C6XBRYVD.js} +16 -15
- package/dist/chunk-C6XBRYVD.js.map +1 -0
- package/dist/{chunk-FTYDWKO6.js → chunk-CEN6DW6X.js} +12 -2
- package/dist/chunk-CEN6DW6X.js.map +1 -0
- package/dist/chunk-CGASUJVP.js +421 -0
- package/dist/chunk-CGASUJVP.js.map +1 -0
- package/dist/{chunk-EHCONI6E.js → chunk-CQMEM5CC.js} +2 -2
- package/dist/{chunk-PBNZVPFS.js → chunk-CXZQOVIE.js} +12 -12
- package/dist/chunk-D3V3UMET.js +44 -0
- package/dist/chunk-D3V3UMET.js.map +1 -0
- package/dist/{chunk-7N2RUBAP.js → chunk-DDA47TES.js} +2 -2
- package/dist/{chunk-64SE4X5G.js → chunk-DEBHXHJR.js} +3 -3
- package/dist/{chunk-EHK6KZHK.js → chunk-DNHVPZOD.js} +2 -2
- package/dist/{chunk-437S3G37.js → chunk-DQEMWVMT.js} +2 -2
- package/dist/{chunk-LZZNTPLR.js → chunk-DX3XRGLH.js} +2 -2
- package/dist/chunk-EA2H5LML.js +72 -0
- package/dist/chunk-EA2H5LML.js.map +1 -0
- package/dist/{chunk-INELTPRG.js → chunk-EEC7UJPX.js} +103 -106
- package/dist/chunk-EEC7UJPX.js.map +1 -0
- package/dist/{chunk-KSNVDPDF.js → chunk-EKBNDKDY.js} +21 -20
- package/dist/chunk-EKBNDKDY.js.map +1 -0
- package/dist/{chunk-YF6FMLBT.js → chunk-EQWEIIKQ.js} +64 -34
- package/dist/chunk-EQWEIIKQ.js.map +1 -0
- package/dist/{chunk-DZKHSDOM.js → chunk-ES36HTSC.js} +4 -4
- package/dist/{chunk-TN7THW5U.js → chunk-ET356KSB.js} +2 -2
- package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
- package/dist/{chunk-DMSDUGDM.js → chunk-F7GAIWFA.js} +20 -20
- package/dist/{chunk-G6XXLKC5.js → chunk-FFPJINJE.js} +6 -6
- package/dist/chunk-FMLKOL2Z.js +636 -0
- package/dist/chunk-FMLKOL2Z.js.map +1 -0
- package/dist/chunk-FQC3DHH2.js +20 -0
- package/dist/chunk-FQC3DHH2.js.map +1 -0
- package/dist/{chunk-G4CN3ZXL.js → chunk-FUTF72MJ.js} +15 -15
- package/dist/chunk-GCASGYIO.js +71 -0
- package/dist/chunk-GCASGYIO.js.map +1 -0
- package/dist/{chunk-HF77M34J.js → chunk-GFPZS3F5.js} +8 -8
- package/dist/{chunk-BCDKBDSY.js → chunk-GNVZQ5JN.js} +99 -41
- package/dist/chunk-GNVZQ5JN.js.map +1 -0
- package/dist/{chunk-G6NKALRN.js → chunk-H4WG3UQZ.js} +2 -2
- package/dist/{chunk-UDQUSU27.js → chunk-HNZKVLAN.js} +2 -2
- package/dist/{chunk-5EZXHU36.js → chunk-HYQJQGD3.js} +2 -2
- package/dist/{chunk-PLQE6MJA.js → chunk-IFH6LWTO.js} +50 -8
- package/dist/chunk-IFH6LWTO.js.map +1 -0
- package/dist/{chunk-RULE4VG5.js → chunk-ILGC6JH6.js} +21 -6
- package/dist/chunk-ILGC6JH6.js.map +1 -0
- package/dist/chunk-IUM3VSHI.js +113 -0
- package/dist/chunk-IUM3VSHI.js.map +1 -0
- package/dist/{chunk-TRWPCR6P.js → chunk-JECBQBEX.js} +3 -3
- package/dist/{chunk-E6CBU7XP.js → chunk-JYIFGGEM.js} +2 -2
- package/dist/{chunk-VA4WSW54.js → chunk-JYIJNNN3.js} +3 -3
- package/dist/{chunk-L5HJQC36.js → chunk-K2TDK7GG.js} +3 -3
- package/dist/{chunk-KDXVOFYY.js → chunk-KAVBJSBQ.js} +4 -4
- package/dist/{chunk-BS4SGLWV.js → chunk-KF5EUVKQ.js} +16 -6
- package/dist/chunk-KF5EUVKQ.js.map +1 -0
- package/dist/chunk-KFZY2OFH.js +42 -0
- package/dist/chunk-KFZY2OFH.js.map +1 -0
- package/dist/{chunk-4OKLXWDZ.js → chunk-KNB7IBBU.js} +2 -2
- package/dist/{chunk-QLULYKWZ.js → chunk-KSXJOC4F.js} +2 -2
- package/dist/{chunk-2S6QHZGJ.js → chunk-L2DPF4DF.js} +1 -1
- package/dist/{chunk-JI5AVXYO.js → chunk-LEPOP46W.js} +6 -6
- package/dist/{chunk-O7BBFJLP.js → chunk-LTAVSOZW.js} +2 -2
- package/dist/{chunk-E3VODCC3.js → chunk-LUDXM7MD.js} +14 -2
- package/dist/{chunk-E3VODCC3.js.map → chunk-LUDXM7MD.js.map} +1 -1
- package/dist/{chunk-2IZAGAJR.js → chunk-LULR4IUW.js} +3 -3
- package/dist/{chunk-QQGPUKMT.js → chunk-MC5Q3J7S.js} +398 -7
- package/dist/chunk-MC5Q3J7S.js.map +1 -0
- package/dist/{chunk-WMWVO45V.js → chunk-MC6XO7T4.js} +2 -2
- package/dist/chunk-MKQBXQKU.js +107 -0
- package/dist/chunk-MKQBXQKU.js.map +1 -0
- package/dist/{chunk-7PND4PUC.js → chunk-MMGGVZ4Q.js} +29 -9
- package/dist/{chunk-7PND4PUC.js.map → chunk-MMGGVZ4Q.js.map} +1 -1
- package/dist/{chunk-D6RIFG4O.js → chunk-MNB5RMAY.js} +2 -2
- package/dist/{chunk-Q5WG43OP.js → chunk-MYFQ3ED4.js} +7 -7
- package/dist/{chunk-V3UE5I5F.js → chunk-MYVPLJOO.js} +2 -2
- package/dist/chunk-NINSR6LX.js +83 -0
- package/dist/chunk-NINSR6LX.js.map +1 -0
- package/dist/{chunk-MTWKDOVO.js → chunk-NLE6TSLG.js} +2 -2
- package/dist/{chunk-OAZVR2BV.js → chunk-OGCAYLNA.js} +8 -6
- package/dist/{chunk-OAZVR2BV.js.map → chunk-OGCAYLNA.js.map} +1 -1
- package/dist/{chunk-DBRYEIGY.js → chunk-OJP3N7UK.js} +2 -2
- package/dist/{chunk-VDW4VU7B.js → chunk-OQJIB32H.js} +28 -23
- package/dist/chunk-OQJIB32H.js.map +1 -0
- package/dist/{chunk-SMX5267P.js → chunk-OZKOPQCM.js} +2 -2
- package/dist/{chunk-JCK7V6SN.js → chunk-P65YJEEL.js} +2 -2
- package/dist/{chunk-MTR7BZQN.js → chunk-PBGWYM3H.js} +3 -3
- package/dist/chunk-PIG4WJFQ.js +87 -0
- package/dist/chunk-PIG4WJFQ.js.map +1 -0
- package/dist/chunk-PJSK6OJM.js +201 -0
- package/dist/chunk-PJSK6OJM.js.map +1 -0
- package/dist/{chunk-OVJ2HIPE.js → chunk-PMUD7ERF.js} +158 -125
- package/dist/chunk-PMUD7ERF.js.map +1 -0
- package/dist/chunk-PQVCH2AE.js +76 -0
- package/dist/chunk-PQVCH2AE.js.map +1 -0
- package/dist/{chunk-AXTXN4T6.js → chunk-PWFCHOB3.js} +2 -2
- package/dist/{chunk-FDPZVY6D.js → chunk-QFN4U7AG.js} +2 -2
- package/dist/{chunk-K2ZLHESQ.js → chunk-QIEUU4UK.js} +2 -2
- package/dist/{chunk-DYP3YYJJ.js → chunk-QJAQNXWI.js} +39 -5
- package/dist/chunk-QJAQNXWI.js.map +1 -0
- package/dist/{chunk-3D6AFGQR.js → chunk-QVT3E4CE.js} +7 -7
- package/dist/{chunk-FIJUY7GG.js → chunk-R26ZMXR2.js} +23 -23
- package/dist/{chunk-FIJUY7GG.js.map → chunk-R26ZMXR2.js.map} +1 -1
- package/dist/chunk-R3DJVOSM.js +34 -0
- package/dist/chunk-R3DJVOSM.js.map +1 -0
- package/dist/{chunk-SFQ6QNL7.js → chunk-R6YJI3HE.js} +2 -1
- package/dist/{chunk-5CJVLG3H.js → chunk-RFDD3B7W.js} +5 -5
- package/dist/{chunk-JBPKEARU.js → chunk-RKNJBZ55.js} +4 -4
- package/dist/chunk-ROI7BK7H.js +88 -0
- package/dist/chunk-ROI7BK7H.js.map +1 -0
- package/dist/{chunk-FNZQGN76.js → chunk-S2BBISHU.js} +4 -4
- package/dist/{chunk-IALLX7EE.js → chunk-S2FSBU4H.js} +3 -3
- package/dist/{chunk-BFPETA3S.js → chunk-SCCO46KZ.js} +3 -2
- package/dist/chunk-SCCO46KZ.js.map +1 -0
- package/dist/chunk-SK7AMF2J.js +168 -0
- package/dist/chunk-SK7AMF2J.js.map +1 -0
- package/dist/{chunk-KSBEEMQF.js → chunk-TG6IHVE2.js} +151 -6
- package/dist/chunk-TG6IHVE2.js.map +1 -0
- package/dist/{chunk-7K5Q6COX.js → chunk-TVVEYCNW.js} +4 -4
- package/dist/{chunk-DPAENM7O.js → chunk-U3ZAVRP3.js} +2 -2
- package/dist/{chunk-ODPLEWB6.js → chunk-UFGFMWAD.js} +47 -17
- package/dist/chunk-UFGFMWAD.js.map +1 -0
- package/dist/{chunk-4KJLYTLS.js → chunk-V57NLO5P.js} +2 -2
- package/dist/{chunk-FLVL4L3L.js → chunk-VDX2J7OX.js} +2 -2
- package/dist/{chunk-AJLLIIML.js → chunk-W4FBGYGK.js} +1 -1
- package/dist/{chunk-TXLGHDHS.js → chunk-W4XJFLAL.js} +53 -32
- package/dist/chunk-W4XJFLAL.js.map +1 -0
- package/dist/{chunk-6SXVCD7W.js → chunk-W7IGLX4G.js} +2 -2
- package/dist/{chunk-KQDNAXOM.js → chunk-WG5HSQ4P.js} +19 -6
- package/dist/chunk-WG5HSQ4P.js.map +1 -0
- package/dist/{chunk-LTJAMRGI.js → chunk-WL5EBRDH.js} +17 -3
- package/dist/chunk-WL5EBRDH.js.map +1 -0
- package/dist/{chunk-KAWTOYAW.js → chunk-WLZYGLJ4.js} +2 -2
- package/dist/{chunk-RO4LQGT3.js → chunk-WON4APQY.js} +4 -4
- package/dist/{chunk-PQVK2S3J.js → chunk-WZFAPHIK.js} +6 -6
- package/dist/{chunk-KQPJLK3X.js → chunk-XL24QQ63.js} +2 -2
- package/dist/{chunk-LZOV7MX7.js → chunk-XQDRKZ7V.js} +6476 -5747
- package/dist/chunk-XQDRKZ7V.js.map +1 -0
- package/dist/{chunk-RVZRYUQH.js → chunk-YROFNEG5.js} +7 -7
- package/dist/{chunk-RAR2BSEM.js → chunk-YV32N67O.js} +1 -1
- package/dist/chunk-YV32N67O.js.map +1 -0
- package/dist/{chunk-PBSAPHHA.js → chunk-YVKF3HEW.js} +1 -1
- package/dist/chunk-YVKF3HEW.js.map +1 -0
- package/dist/{chunk-VRAD2FGO.js → chunk-Z54EM5YZ.js} +12 -12
- package/dist/{chunk-2VN4JAX7.js → chunk-ZOKZIR5K.js} +95 -33
- package/dist/chunk-ZOKZIR5K.js.map +1 -0
- package/dist/{chunk-DCFV7A7H.js → chunk-ZVAYK7GU.js} +101 -91
- package/dist/chunk-ZVAYK7GU.js.map +1 -0
- package/dist/{cli-Cd5fMmhq.d.ts → cli-5tNLVTvJ.d.ts} +28 -12
- package/dist/cli.d.ts +16 -9
- package/dist/cli.js +142 -127
- package/dist/compounding/engine.d.ts +5 -2
- package/dist/compounding/engine.js +36 -26
- package/dist/compounding/preference-consolidator.d.ts +3 -1
- package/dist/compounding/preference-consolidator.js +1 -1
- package/dist/compression-optimizer.d.ts +3 -1
- package/dist/config-qmd.d.ts +8 -0
- package/dist/config-qmd.js +20 -0
- package/dist/config-qmd.js.map +1 -0
- package/dist/config.d.ts +3 -1
- package/dist/config.js +15 -10
- package/dist/connectors/codex-materialize-runner.d.ts +3 -1
- package/dist/connectors/codex-materialize-runner.js +36 -26
- package/dist/connectors/codex-materialize.d.ts +3 -1
- package/dist/connectors/codex-materialize.js +2 -2
- package/dist/connectors/index.d.ts +3 -1
- package/dist/connectors/index.js +41 -32
- package/dist/consolidation-provenance-check.d.ts +5 -2
- package/dist/consolidation-undo.d.ts +5 -2
- package/dist/contradiction/index.d.ts +5 -2
- package/dist/contradiction/index.js +10 -4
- package/dist/{contradiction-scan-J57T5QV7.js → contradiction-scan-RJBABNRH.js} +4 -4
- package/dist/contradiction-scan-RJBABNRH.js.map +1 -0
- package/dist/conversation-index/backend.d.ts +3 -1
- package/dist/conversation-index/backend.js +5 -5
- package/dist/conversation-index/chunker.d.ts +3 -1
- package/dist/conversation-index/cleanup.js +2 -2
- package/dist/conversation-index/faiss-adapter.d.ts +3 -1
- package/dist/conversation-index/faiss-adapter.js +2 -2
- package/dist/conversation-index/indexer.d.ts +3 -1
- package/dist/conversation-index/indexer.js +2 -2
- package/dist/conversation-index/search.d.ts +3 -1
- package/dist/conversation-index/search.js +2 -2
- package/dist/cross-namespace-budget.d.ts +45 -1
- package/dist/cross-namespace-budget.js +5 -3
- package/dist/dashboard-runtime.js +2 -2
- package/dist/day-summary.d.ts +3 -1
- package/dist/day-summary.js +3 -3
- package/dist/delinearize.d.ts +3 -1
- package/dist/direct-answer-wiring.d.ts +3 -1
- package/dist/direct-answer.d.ts +3 -1
- package/dist/{dreams-ledger-6UODQOX6.js → dreams-ledger-567VKVOU.js} +4 -2
- package/dist/dreams-ledger-567VKVOU.js.map +1 -0
- package/dist/embedding-fallback.d.ts +3 -1
- package/dist/embedding-fallback.js +3 -3
- package/dist/enrichment/index.d.ts +3 -1
- package/dist/entity-retrieval.d.ts +5 -2
- package/dist/entity-retrieval.js +35 -26
- package/dist/entity-schema.d.ts +3 -1
- package/dist/explicit-capture.d.ts +13 -8
- package/dist/explicit-capture.js +7 -3
- package/dist/extraction-faithfulness.d.ts +3 -1
- package/dist/extraction-faithfulness.js +5 -5
- package/dist/extraction-judge-telemetry.d.ts +3 -1
- package/dist/extraction-judge-telemetry.js +2 -2
- package/dist/extraction-judge-training.d.ts +3 -1
- package/dist/extraction-judge-training.js +2 -2
- package/dist/extraction-judge.d.ts +3 -1
- package/dist/extraction-judge.js +5 -5
- package/dist/extraction.d.ts +3 -1
- package/dist/extraction.js +13 -12
- package/dist/faithfulness-config.js +3 -2
- package/dist/fallback-llm.d.ts +3 -1
- package/dist/fallback-llm.js +4 -4
- package/dist/{first-start-migration-TI67YMLG.js → first-start-migration-CSRHCJIQ.js} +2 -2
- package/dist/{forget-CQCLB5LB.js → forget-HRPLVB3W.js} +5 -5
- package/dist/graph-dashboard-diff.d.ts +3 -1
- package/dist/graph-dashboard-key.d.ts +3 -1
- package/dist/graph-dashboard-parser.d.ts +3 -1
- package/dist/{graph-edge-decay-IOGBBAGC.js → graph-edge-decay-Z6ENALU2.js} +3 -3
- package/dist/graph-edge-decay-Z6ENALU2.js.map +1 -0
- package/dist/graph-edge-reinforcement.d.ts +3 -1
- package/dist/graph-snapshot.d.ts +3 -1
- package/dist/graph-snapshot.js +2 -2
- package/dist/graph.d.ts +3 -1
- package/dist/graph.js +1 -1
- package/dist/identity-continuity.d.ts +1 -2
- package/dist/importance.d.ts +3 -1
- package/dist/importers/index.d.ts +3 -1
- package/dist/in-flight-reads.d.ts +3 -1
- package/dist/index.d.ts +473 -464
- package/dist/index.js +287 -239
- package/dist/intent.d.ts +3 -1
- package/dist/lcm/archive.js +2 -2
- package/dist/lcm/engine.d.ts +3 -1
- package/dist/lcm/engine.js +6 -6
- package/dist/lcm/index.d.ts +3 -1
- package/dist/lcm/index.js +13 -13
- package/dist/lcm/schema.js +2 -2
- package/dist/lcm/summarizer.js +3 -3
- package/dist/lcm/tools.d.ts +3 -1
- package/dist/lifecycle.d.ts +3 -1
- package/dist/live-connectors-runner.d.ts +3 -1
- package/dist/local-llm.d.ts +5 -2
- package/dist/local-llm.js +3 -3
- package/dist/local-model-endpoint.d.ts +3 -1
- package/dist/logger.d.ts +3 -1
- package/dist/logger.js +7 -3
- package/dist/maintenance/archive-observations.js +2 -2
- package/dist/maintenance/memory-governance.d.ts +3 -1
- package/dist/maintenance/memory-governance.js +35 -25
- package/dist/maintenance/migrate-observations.js +3 -3
- package/dist/maintenance/observation-ledger-utils.js +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +102 -1
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +37 -25
- package/dist/maintenance/rebuild-memory-projection.js +38 -28
- package/dist/maintenance/rebuild-observations.js +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +22 -15
- package/dist/memory-action-policy.d.ts +3 -1
- package/dist/memory-cache.d.ts +3 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +25 -2
- package/dist/memory-lifecycle-ledger-utils.js +11 -1
- package/dist/memory-projection-store.d.ts +3 -1
- package/dist/memory-projection-store.js +2 -2
- package/dist/memory-provenance.d.ts +3 -1
- package/dist/memory-worth-outcomes.d.ts +5 -2
- package/dist/model-registry.js +2 -2
- package/dist/models-json.d.ts +3 -1
- package/dist/models-json.js +2 -2
- package/dist/namespaces/migrate.d.ts +6 -3
- package/dist/namespaces/migrate.js +51 -42
- package/dist/namespaces/principal.d.ts +27 -2
- package/dist/namespaces/principal.js +6 -2
- package/dist/namespaces/search.d.ts +16 -2
- package/dist/namespaces/search.js +24 -20
- package/dist/namespaces/storage.d.ts +24 -3
- package/dist/namespaces/storage.js +35 -27
- package/dist/native-knowledge.d.ts +3 -1
- package/dist/native-knowledge.js +2 -2
- package/dist/negative.js +2 -2
- package/dist/offline-sync-exclude-globs.d.ts +13 -0
- package/dist/offline-sync-exclude-globs.js +10 -0
- package/dist/offline-sync-exclude-globs.js.map +1 -0
- package/dist/offline-sync-impression-drain.d.ts +78 -0
- package/dist/offline-sync-impression-drain.js +37 -0
- package/dist/offline-sync-impression-drain.js.map +1 -0
- package/dist/offline-sync.js +4 -2
- package/dist/operator-toolkit.d.ts +5 -2
- package/dist/operator-toolkit.js +69 -54
- package/dist/orchestration/compression-guideline-coordinator.d.ts +5 -2
- package/dist/orchestration/compression-guideline-coordinator.js +3 -3
- package/dist/orchestration/maintenance.d.ts +121 -2
- package/dist/orchestration/maintenance.js +44 -31
- package/dist/{orchestrator-Bp_jeBHK.d.ts → orchestrator-CQJ8U7En.d.ts} +85 -79
- package/dist/orchestrator.d.ts +13 -8
- package/dist/orchestrator.js +194 -177
- package/dist/patterns-cli.d.ts +3 -1
- package/dist/{pipeline-BAj5bx7g.d.ts → pipeline-Cn-kvYeV.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +3 -1
- package/dist/prioritized-embed.d.ts +19 -0
- package/dist/prioritized-embed.js +8 -0
- package/dist/prioritized-embed.js.map +1 -0
- package/dist/proactive-contention.d.ts +28 -0
- package/dist/proactive-contention.js +8 -0
- package/dist/proactive-contention.js.map +1 -0
- package/dist/profiling.js +2 -2
- package/dist/provenance.d.ts +3 -1
- package/dist/provenance.js +3 -2
- package/dist/{purge-NDWV6WYD.js → purge-IRF47ZTX.js} +3 -3
- package/dist/{qmd-_MDSlj1m.d.ts → qmd-oh9VXz1d.d.ts} +11 -1
- package/dist/qmd-preflight.d.ts +5 -2
- package/dist/qmd-recall-cache.d.ts +3 -1
- package/dist/qmd-status.d.ts +57 -0
- package/dist/qmd-status.js +18 -0
- package/dist/qmd-status.js.map +1 -0
- package/dist/qmd.d.ts +5 -2
- package/dist/qmd.js +7 -3
- package/dist/recall-concurrency-config.d.ts +16 -0
- package/dist/recall-concurrency-config.js +10 -0
- package/dist/recall-concurrency-config.js.map +1 -0
- package/dist/recall-disclosure-escalation.d.ts +3 -1
- package/dist/recall-explain-renderer.d.ts +4 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-memory-map.d.ts +26 -0
- package/dist/recall-memory-map.js +18 -0
- package/dist/recall-memory-map.js.map +1 -0
- package/dist/recall-planner-llm.d.ts +3 -1
- package/dist/recall-planner-llm.js +4 -4
- package/dist/recall-qos.js +2 -2
- package/dist/recall-state.d.ts +163 -2
- package/dist/recall-state.js +6 -3
- package/dist/recall-tag-filter.d.ts +3 -1
- package/dist/recall-timings.d.ts +11 -2
- package/dist/recall-timings.js +3 -1
- package/dist/recall-xray-cli.d.ts +3 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +3 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +3 -1
- package/dist/recall-xray.js +2 -2
- package/dist/relevance.js +3 -3
- package/dist/replay/normalizers/chatgpt.d.ts +3 -1
- package/dist/replay/normalizers/claude.d.ts +3 -1
- package/dist/replay/normalizers/openclaw.d.ts +3 -1
- package/dist/replay/normalizers/shared.d.ts +3 -1
- package/dist/replay/runner.d.ts +3 -1
- package/dist/replay/types.d.ts +3 -1
- package/dist/rerank.d.ts +8 -1
- package/dist/rerank.js +3 -1
- package/dist/resolution-3K27T4VO.js +18 -0
- package/dist/resolution-3K27T4VO.js.map +1 -0
- package/dist/resolve-auth-token.d.ts +3 -1
- package/dist/resolve-provider-secret.js +2 -2
- package/dist/resume-bundles.js +19 -14
- package/dist/retrieval-agents.d.ts +19 -16
- package/dist/retrieval-agents.js +3 -3
- package/dist/retrieval-tiers.d.ts +3 -1
- package/dist/routing/engine.d.ts +3 -1
- package/dist/routing/store.d.ts +3 -1
- package/dist/routing/store.js +2 -2
- package/dist/salvage-envelope.d.ts +18 -0
- package/dist/salvage-envelope.js +15 -0
- package/dist/salvage-envelope.js.map +1 -0
- package/dist/schemas.d.ts +98 -98
- package/dist/scope-profiles-EpJG7yKP.d.ts +30 -0
- package/dist/search/document-scanner.js +3 -2
- package/dist/search/embed-helper.d.ts +3 -1
- package/dist/search/embed-helper.js +3 -3
- package/dist/search/factory.d.ts +3 -1
- package/dist/search/factory.js +18 -16
- package/dist/search/index.d.ts +3 -1
- package/dist/search/index.js +22 -20
- package/dist/search/lancedb-backend.d.ts +3 -1
- package/dist/search/lancedb-backend.js +6 -5
- package/dist/search/meilisearch-backend.d.ts +3 -1
- package/dist/search/meilisearch-backend.js +6 -5
- package/dist/search/noop-backend.d.ts +3 -1
- package/dist/search/orama-backend.d.ts +3 -1
- package/dist/search/orama-backend.js +6 -5
- package/dist/search/port.d.ts +16 -2
- package/dist/search/port.js +1 -1
- package/dist/search/remote-backend.d.ts +3 -1
- package/dist/search/remote-backend.js +3 -3
- package/dist/secure-store/index.d.ts +12 -1
- package/dist/secure-store/index.js +6 -3
- package/dist/{semantic-consolidation-C2m5eHHE.d.ts → semantic-consolidation-DILZEQq3.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +4 -2
- package/dist/semantic-consolidation.js +38 -29
- package/dist/semantic-rule-promotion.js +34 -24
- package/dist/semantic-rule-verifier.d.ts +3 -1
- package/dist/semantic-rule-verifier.js +35 -25
- package/dist/session-observer-bands.d.ts +3 -1
- package/dist/session-observer-state.d.ts +3 -1
- package/dist/session-observer-state.js +2 -2
- package/dist/session-transcript-migration.js +2 -2
- package/dist/shared-context/manager.d.ts +11 -9
- package/dist/shared-context/manager.js +3 -3
- package/dist/signal.d.ts +3 -1
- package/dist/{storage-hr_Y2z5R.d.ts → storage-NIyKYD8g.d.ts} +489 -110
- package/dist/storage-guards.js +2 -2
- package/dist/storage.d.ts +6 -3
- package/dist/storage.js +38 -26
- package/dist/structured-attributes.d.ts +23 -1
- package/dist/structured-attributes.js +7 -1
- package/dist/summarizer.d.ts +3 -1
- package/dist/summarizer.js +11 -11
- package/dist/summary-snapshot.d.ts +3 -1
- package/dist/summary-snapshot.js +2 -2
- package/dist/temporal-index-batch.d.ts +1 -0
- package/dist/temporal-index-batch.js +10 -0
- package/dist/temporal-index-batch.js.map +1 -0
- package/dist/temporal-index-compat.d.ts +279 -1
- package/dist/temporal-index-compat.js +1 -1
- package/dist/temporal-index.d.ts +1 -225
- package/dist/temporal-index.js +35 -3
- package/dist/temporal-supersession.d.ts +5 -2
- package/dist/temporal-supersession.js +2 -2
- package/dist/temporal-timeline-recall.d.ts +3 -1
- package/dist/temporal-validity.d.ts +3 -1
- package/dist/threading.d.ts +3 -1
- package/dist/threading.js +2 -2
- package/dist/tier-migration.d.ts +5 -2
- package/dist/tier-routing.d.ts +3 -1
- package/dist/{tier-stats-KV7IWCJR.js → tier-stats-QEJSPFV2.js} +2 -2
- package/dist/tokens.js +3 -3
- package/dist/topics.d.ts +3 -1
- package/dist/transcript.d.ts +3 -1
- package/dist/transcript.js +2 -2
- package/dist/transfer/backup.js +3 -3
- package/dist/transfer/capsule-export.js +3 -3
- package/dist/transfer/capsule-import.js +3 -3
- package/dist/transfer/types.d.ts +90 -90
- package/dist/trust-score-stage.d.ts +75 -38
- package/dist/trust-score-stage.js +11 -3
- package/dist/trust-score.d.ts +3 -1
- package/dist/{types-Cg8q7W7_.d.ts → types-D_fG2ix8.d.ts} +39 -63
- package/dist/types-continuity.d.ts +52 -0
- package/dist/types-continuity.js +1 -0
- package/dist/types-continuity.js.map +1 -0
- package/dist/types.d.ts +3 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +3 -1
- package/dist/utils/serialize-mutations.d.ts +31 -2
- package/dist/utils/serialize-mutations.js +1 -1
- package/dist/verified-recall.js +36 -26
- package/dist/write-envelope.d.ts +282 -0
- package/dist/write-envelope.js +35 -0
- package/dist/write-envelope.js.map +1 -0
- package/dist/write-quarantine.d.ts +94 -0
- package/dist/write-quarantine.js +11 -0
- package/dist/write-quarantine.js.map +1 -0
- package/dist/write-rate-limiter.d.ts +45 -0
- package/dist/write-rate-limiter.js +9 -0
- package/dist/write-rate-limiter.js.map +1 -0
- package/package.json +37 -2
- package/src/access-admin-ops-surface.ts +17 -7
- package/src/access-boundary.test.ts +28 -0
- package/src/access-boundary.ts +31 -2
- package/src/access-citation.test.ts +72 -0
- package/src/access-citation.ts +139 -0
- package/src/access-errors.ts +21 -0
- package/src/access-fingerprint-parity.test.ts +211 -0
- package/src/access-http-cancellation.test.ts +59 -21
- package/src/access-http.test.ts +90 -0
- package/src/access-http.ts +79 -79
- package/src/access-mcp-cancellation.test.ts +16 -7
- package/src/access-memory-search-fanout.test.ts +220 -0
- package/src/access-memory-search-fanout.ts +168 -0
- package/src/access-observe-quarantine.test.ts +172 -0
- package/src/access-observe-write-surface.ts +137 -11
- package/src/access-operations-batch.ts +2 -0
- package/src/access-recall-concurrency.ts +773 -0
- package/src/access-recall-response.ts +307 -0
- package/src/access-recall-surface.ts +100 -252
- package/src/access-service-coding-write.test.ts +22 -4
- package/src/access-service-health.test.ts +49 -0
- package/src/access-service-namespace.test.ts +486 -8
- package/src/access-service-observe-scope.test.ts +4 -0
- package/src/access-service-recall-concurrency.test.ts +1990 -0
- package/src/access-service.ts +186 -179
- package/src/access-surface-catalog.ts +1 -0
- package/src/access-token-capabilities.ts +16 -9
- package/src/active-recall.test.ts +35 -0
- package/src/active-recall.ts +7 -0
- package/src/bounded-jsonl-state.ts +93 -0
- package/src/buffer-session.test.ts +422 -5
- package/src/buffer-surprise-trigger.test.ts +41 -0
- package/src/buffer.ts +218 -3
- package/src/capabilities-cluster-b.test.ts +1 -0
- package/src/capabilities.ts +5 -6
- package/src/cli.ts +21 -22
- package/src/coding/architecture-surfaces.test.ts +6 -3
- package/src/coding/architecture-surfaces.ts +36 -25
- package/src/coding/decision-surfaces.ts +42 -34
- package/src/compounding/engine.test.ts +5 -1
- package/src/compounding/engine.ts +7 -7
- package/src/config-qmd.ts +89 -0
- package/src/config.test.ts +136 -0
- package/src/config.ts +113 -118
- package/src/connector-provenance-lifecycle.test.ts +4 -4
- package/src/connectors/coerce.test.ts +131 -0
- package/src/connectors/coerce.ts +80 -7
- package/src/contradiction/contradiction.test.ts +10 -6
- package/src/contradiction/resolution.ts +17 -4
- package/src/correction/correction-access-wiring.ts +62 -18
- package/src/cross-namespace-budget.test.ts +35 -0
- package/src/cross-namespace-budget.ts +86 -19
- package/src/explicit-capture.ts +54 -17
- package/src/extraction.ts +2 -3
- package/src/faithfulness-graph-guard.test.ts +16 -69
- package/src/graph-recall.test.ts +31 -0
- package/src/index.ts +22 -2
- package/src/local-llm.ts +4 -6
- package/src/logger.ts +16 -0
- package/src/maintenance/dreams-ledger.ts +100 -49
- package/src/maintenance/rebuild-memory-lifecycle-ledger-cli.ts +77 -0
- package/src/maintenance/rebuild-memory-lifecycle-ledger.ts +373 -9
- package/src/memory-lifecycle-ledger-utils.ts +51 -5
- package/src/namespaces/principal.test.ts +37 -1
- package/src/namespaces/principal.ts +48 -0
- package/src/namespaces/search.test.ts +79 -5
- package/src/namespaces/search.ts +59 -6
- package/src/namespaces/storage.ts +43 -1
- package/src/offline-sync-exclude-globs.ts +58 -0
- package/src/offline-sync-impression-drain.test.ts +316 -0
- package/src/offline-sync-impression-drain.ts +260 -0
- package/src/offline-sync.test.ts +32 -5
- package/src/offline-sync.ts +1 -14
- package/src/operator-toolkit.ts +1 -1
- package/src/orchestration/batch-deindex-flush.test.ts +146 -0
- package/src/orchestration/consolidation-run.ts +96 -85
- package/src/orchestration/extraction-envelope.ts +94 -0
- package/src/orchestration/extraction-persist-promotion.ts +134 -0
- package/src/orchestration/extraction-persist.ts +325 -260
- package/src/orchestration/extraction-run.test.ts +1 -1
- package/src/orchestration/extraction-run.ts +2 -2
- package/src/orchestration/graph-recall-coordinator.ts +18 -7
- package/src/orchestration/lifecycle-policy-coordinator.ts +63 -48
- package/src/orchestration/maintenance.test.ts +2103 -3
- package/src/orchestration/maintenance.ts +574 -2
- package/src/orchestration/namespace-read-fanout.ts +14 -8
- package/src/orchestration/orchestrator-helpers.ts +8 -1
- package/src/orchestration/orchestrator-init.ts +22 -6
- package/src/orchestration/orchestrator-namespace-scope.ts +71 -0
- package/src/orchestration/persistence-index.ts +64 -9
- package/src/orchestration/qmd-result-resolver.ts +27 -0
- package/src/orchestration/recall-entry.ts +34 -19
- package/src/orchestration/recall-internal.ts +207 -79
- package/src/orchestration/recall-rerank-coordinator.ts +229 -82
- package/src/orchestration/recall-result-formatter.ts +76 -20
- package/src/orchestration/recall-search-pipeline.test.ts +70 -0
- package/src/orchestration/recall-search-pipeline.ts +102 -129
- package/src/orchestration/recall-section-coordinator.ts +315 -85
- package/src/orchestration/semantic-consolidation-coordinator.ts +69 -37
- package/src/orchestration/session-context.ts +21 -0
- package/src/orchestration/workspace-ops.test.ts +348 -0
- package/src/orchestration/workspace-ops.ts +168 -34
- package/src/orchestrator-chunked-hash-durability.test.ts +126 -0
- package/src/orchestrator-connector-dedup.test.ts +1061 -40
- package/src/orchestrator-flush.test.ts +155 -39
- package/src/orchestrator-nonchunked-hash-durability.test.ts +121 -0
- package/src/orchestrator-source-attribution.test.ts +9 -9
- package/src/orchestrator.ts +160 -149
- package/src/prioritized-embed.ts +123 -0
- package/src/proactive-contention.test.ts +80 -0
- package/src/proactive-contention.ts +39 -0
- package/src/procedural/procedure-miner.test.ts +19 -14
- package/src/procedural/procedure-miner.ts +44 -13
- package/src/qmd-client.test.ts +111 -1
- package/src/qmd-status.ts +186 -0
- package/src/qmd.ts +47 -47
- package/src/recall-budget-config.test.ts +30 -0
- package/src/recall-cold-deadline.test.ts +149 -0
- package/src/recall-concurrency-config.ts +28 -0
- package/src/recall-memory-map.ts +74 -0
- package/src/recall-rerank-coordinator.test.ts +508 -0
- package/src/recall-state.test.ts +825 -1
- package/src/recall-state.ts +406 -7
- package/src/recall-timings-access.test.ts +41 -0
- package/src/recall-timings.ts +16 -0
- package/src/relay/mission-access.test.ts +5 -5
- package/src/rerank.ts +22 -0
- package/src/retrieval-agents.test.ts +79 -0
- package/src/retrieval-agents.ts +71 -19
- package/src/salvage-envelope.ts +28 -0
- package/src/scopes/scope-plan.test.ts +42 -0
- package/src/scopes/scope-plan.ts +45 -0
- package/src/search/port.ts +13 -0
- package/src/secure-store/index.ts +1 -0
- package/src/secure-store/secure-fs.ts +48 -0
- package/src/secure-store/secure-store.test.ts +40 -0
- package/src/semantic-rule-promotion.ts +13 -4
- package/src/storage/content-hash-index.ts +655 -0
- package/src/storage/entity-timeline.ts +473 -0
- package/src/storage/memory-lifecycle-ledger-access.ts +603 -0
- package/src/storage/secure-line-reader.test.ts +197 -0
- package/src/storage/secure-line-reader.ts +181 -3
- package/src/storage-append-header-sniff.test.ts +195 -0
- package/src/storage-behavior-signals-cache.test.ts +237 -0
- package/src/storage-contract/cache-coherence.test.ts +96 -1
- package/src/storage-contract/content-hash.test.ts +47 -2
- package/src/storage-fact-hash-index-defer.test.ts +1200 -0
- package/src/storage-memory-lifecycle-ledger.test.ts +1146 -3
- package/src/storage.ts +882 -890
- package/src/structured-attributes.ts +52 -0
- package/src/temporal-index-batch.ts +112 -0
- package/src/temporal-index.test.ts +193 -0
- package/src/temporal-index.ts +49 -53
- package/src/testing/lifecycle-matrix.test.ts +212 -0
- package/src/testing/lifecycle-matrix.ts +271 -0
- package/src/testing/orchestrator-lite.ts +236 -0
- package/src/testing/subjects/dreams-ledger.test.ts +67 -0
- package/src/testing/subjects/extraction-lifecycle.test.ts +442 -0
- package/src/testing/subjects/lifecycle-ledger.test.ts +93 -0
- package/src/testing/subjects/recall-budget.test.ts +461 -0
- package/src/testing/subjects/serialized-write-chain.test.ts +224 -0
- package/src/trust-score-stage.test.ts +154 -0
- package/src/trust-score-stage.ts +216 -53
- package/src/types-continuity.ts +57 -0
- package/src/types.ts +51 -77
- package/src/utils/path-containment.test.ts +75 -0
- package/src/utils/path-containment.ts +76 -0
- package/src/utils/serialize-mutations.test.ts +122 -0
- package/src/utils/serialize-mutations.ts +68 -3
- package/src/wearables/memory-gen.test.ts +31 -9
- package/src/wearables/memory-gen.ts +95 -55
- package/src/wearables/pipeline.test.ts +10 -7
- package/src/wearables/service.test.ts +6 -8
- package/src/wearables/service.ts +2 -2
- package/src/write-envelope.extension.test.ts +111 -0
- package/src/write-envelope.test.ts +683 -0
- package/src/write-envelope.ts +902 -0
- package/src/write-quarantine.test.ts +245 -0
- package/src/write-quarantine.ts +290 -0
- package/src/write-rate-limiter.test.ts +105 -0
- package/src/write-rate-limiter.ts +135 -0
- package/src/write-sealed-parity.test.ts +204 -0
- package/dist/chunk-2VN4JAX7.js.map +0 -1
- package/dist/chunk-37CTGERM.js.map +0 -1
- package/dist/chunk-3IY64MV6.js.map +0 -1
- package/dist/chunk-BCDKBDSY.js.map +0 -1
- package/dist/chunk-BFPETA3S.js.map +0 -1
- package/dist/chunk-BFVEEB7W.js.map +0 -1
- package/dist/chunk-BS4SGLWV.js.map +0 -1
- package/dist/chunk-DCFV7A7H.js.map +0 -1
- package/dist/chunk-DYP3YYJJ.js.map +0 -1
- package/dist/chunk-E5BK6CGV.js +0 -335
- package/dist/chunk-E5BK6CGV.js.map +0 -1
- package/dist/chunk-FTYDWKO6.js.map +0 -1
- package/dist/chunk-GWTFLF2P.js.map +0 -1
- package/dist/chunk-IKQTFQMI.js.map +0 -1
- package/dist/chunk-INELTPRG.js.map +0 -1
- package/dist/chunk-J2HSAU72.js.map +0 -1
- package/dist/chunk-JREB6UFH.js.map +0 -1
- package/dist/chunk-K7LOWSLU.js.map +0 -1
- package/dist/chunk-KQDNAXOM.js.map +0 -1
- package/dist/chunk-KSBEEMQF.js.map +0 -1
- package/dist/chunk-KSNVDPDF.js.map +0 -1
- package/dist/chunk-LC7OODWZ.js.map +0 -1
- package/dist/chunk-LTJAMRGI.js.map +0 -1
- package/dist/chunk-LZOV7MX7.js.map +0 -1
- package/dist/chunk-NWTGD4AN.js.map +0 -1
- package/dist/chunk-ODPLEWB6.js.map +0 -1
- package/dist/chunk-OVJ2HIPE.js.map +0 -1
- package/dist/chunk-PBSAPHHA.js.map +0 -1
- package/dist/chunk-PHK3HARR.js +0 -32
- package/dist/chunk-PHK3HARR.js.map +0 -1
- package/dist/chunk-PLQE6MJA.js.map +0 -1
- package/dist/chunk-QKQYXZVS.js.map +0 -1
- package/dist/chunk-QQGPUKMT.js.map +0 -1
- package/dist/chunk-RANHFI3P.js +0 -8
- package/dist/chunk-RANHFI3P.js.map +0 -1
- package/dist/chunk-RAR2BSEM.js.map +0 -1
- package/dist/chunk-RULE4VG5.js.map +0 -1
- package/dist/chunk-SVOZFLIQ.js +0 -16
- package/dist/chunk-SVOZFLIQ.js.map +0 -1
- package/dist/chunk-T7Y5KPLN.js.map +0 -1
- package/dist/chunk-TXLGHDHS.js.map +0 -1
- package/dist/chunk-VDW4VU7B.js.map +0 -1
- package/dist/chunk-VSMRDBFT.js +0 -17
- package/dist/chunk-VSMRDBFT.js.map +0 -1
- package/dist/chunk-X64YLC24.js.map +0 -1
- package/dist/chunk-XDSXEKYK.js +0 -118
- package/dist/chunk-XDSXEKYK.js.map +0 -1
- package/dist/chunk-YF6FMLBT.js.map +0 -1
- package/dist/resolution-VH4NGENZ.js +0 -12
- /package/dist/{capsule-crypto-CZJSLEFG.js.map → access-citation.js.map} +0 -0
- /package/dist/{contradiction-scan-J57T5QV7.js.map → access-memory-search-fanout.js.map} +0 -0
- /package/dist/{dreams-ledger-6UODQOX6.js.map → access-recall-concurrency.js.map} +0 -0
- /package/dist/{graph-edge-decay-IOGBBAGC.js.map → access-recall-response.js.map} +0 -0
- /package/dist/{resolution-VH4NGENZ.js.map → bounded-jsonl-state.js.map} +0 -0
- /package/dist/{chunk-A3GOMRJG.js.map → chunk-23L3IXFD.js.map} +0 -0
- /package/dist/{chunk-MRHFJV44.js.map → chunk-2DQ2XREU.js.map} +0 -0
- /package/dist/{chunk-L2B3EE7B.js.map → chunk-2QMKMVHH.js.map} +0 -0
- /package/dist/{chunk-VJVNLNDQ.js.map → chunk-2UFO7X4Q.js.map} +0 -0
- /package/dist/{chunk-2MR3MFQB.js.map → chunk-2VEOKUPP.js.map} +0 -0
- /package/dist/{chunk-RHOZ5LLO.js.map → chunk-347WD2LE.js.map} +0 -0
- /package/dist/{chunk-HDTQVNWD.js.map → chunk-3QAH2S33.js.map} +0 -0
- /package/dist/{chunk-LRNMRXJO.js.map → chunk-3Y224NYC.js.map} +0 -0
- /package/dist/{chunk-VFSP73LP.js.map → chunk-45GF7Y3V.js.map} +0 -0
- /package/dist/{chunk-OEHCMALU.js.map → chunk-5I4M26Q7.js.map} +0 -0
- /package/dist/{chunk-2AZXIZEN.js.map → chunk-5Q7EVV4X.js.map} +0 -0
- /package/dist/{chunk-PUBTHW5O.js.map → chunk-6DRPPQEJ.js.map} +0 -0
- /package/dist/{chunk-FDCTQWLW.js.map → chunk-6O22TZSB.js.map} +0 -0
- /package/dist/{chunk-ZQ7UBUZ6.js.map → chunk-6QYST5XN.js.map} +0 -0
- /package/dist/{chunk-W4PGTAS2.js.map → chunk-6WAFYNVT.js.map} +0 -0
- /package/dist/{chunk-R5VAVVHP.js.map → chunk-72A4L5JJ.js.map} +0 -0
- /package/dist/{chunk-3FAMU5TX.js.map → chunk-A6USBZTO.js.map} +0 -0
- /package/dist/{chunk-ZHIVCODT.js.map → chunk-A72SWTWW.js.map} +0 -0
- /package/dist/{chunk-FC77VUX5.js.map → chunk-A7Q43EUZ.js.map} +0 -0
- /package/dist/{chunk-UJBESW6X.js.map → chunk-AE7WMV4V.js.map} +0 -0
- /package/dist/{chunk-A5UXZRRM.js.map → chunk-AJ7QCSIS.js.map} +0 -0
- /package/dist/{chunk-FNMFJWBY.js.map → chunk-ANEUPF6O.js.map} +0 -0
- /package/dist/{chunk-2A3OXAP2.js.map → chunk-B7RWBZXW.js.map} +0 -0
- /package/dist/{chunk-74F5STS4.js.map → chunk-BLAKS3CP.js.map} +0 -0
- /package/dist/{chunk-M7VGG3ID.js.map → chunk-BV5WMSIJ.js.map} +0 -0
- /package/dist/{chunk-2BFLDH5F.js.map → chunk-BXLOS5AJ.js.map} +0 -0
- /package/dist/{chunk-UXKMMNJD.js.map → chunk-C23BYTJV.js.map} +0 -0
- /package/dist/{chunk-JZHHREBL.js.map → chunk-C3AKM55W.js.map} +0 -0
- /package/dist/{chunk-RP7YXA67.js.map → chunk-C5JF6EZ7.js.map} +0 -0
- /package/dist/{chunk-EHCONI6E.js.map → chunk-CQMEM5CC.js.map} +0 -0
- /package/dist/{chunk-PBNZVPFS.js.map → chunk-CXZQOVIE.js.map} +0 -0
- /package/dist/{chunk-7N2RUBAP.js.map → chunk-DDA47TES.js.map} +0 -0
- /package/dist/{chunk-64SE4X5G.js.map → chunk-DEBHXHJR.js.map} +0 -0
- /package/dist/{chunk-EHK6KZHK.js.map → chunk-DNHVPZOD.js.map} +0 -0
- /package/dist/{chunk-437S3G37.js.map → chunk-DQEMWVMT.js.map} +0 -0
- /package/dist/{chunk-LZZNTPLR.js.map → chunk-DX3XRGLH.js.map} +0 -0
- /package/dist/{chunk-DZKHSDOM.js.map → chunk-ES36HTSC.js.map} +0 -0
- /package/dist/{chunk-TN7THW5U.js.map → chunk-ET356KSB.js.map} +0 -0
- /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
- /package/dist/{chunk-DMSDUGDM.js.map → chunk-F7GAIWFA.js.map} +0 -0
- /package/dist/{chunk-G6XXLKC5.js.map → chunk-FFPJINJE.js.map} +0 -0
- /package/dist/{chunk-G4CN3ZXL.js.map → chunk-FUTF72MJ.js.map} +0 -0
- /package/dist/{chunk-HF77M34J.js.map → chunk-GFPZS3F5.js.map} +0 -0
- /package/dist/{chunk-G6NKALRN.js.map → chunk-H4WG3UQZ.js.map} +0 -0
- /package/dist/{chunk-UDQUSU27.js.map → chunk-HNZKVLAN.js.map} +0 -0
- /package/dist/{chunk-5EZXHU36.js.map → chunk-HYQJQGD3.js.map} +0 -0
- /package/dist/{chunk-TRWPCR6P.js.map → chunk-JECBQBEX.js.map} +0 -0
- /package/dist/{chunk-E6CBU7XP.js.map → chunk-JYIFGGEM.js.map} +0 -0
- /package/dist/{chunk-VA4WSW54.js.map → chunk-JYIJNNN3.js.map} +0 -0
- /package/dist/{chunk-L5HJQC36.js.map → chunk-K2TDK7GG.js.map} +0 -0
- /package/dist/{chunk-KDXVOFYY.js.map → chunk-KAVBJSBQ.js.map} +0 -0
- /package/dist/{chunk-4OKLXWDZ.js.map → chunk-KNB7IBBU.js.map} +0 -0
- /package/dist/{chunk-QLULYKWZ.js.map → chunk-KSXJOC4F.js.map} +0 -0
- /package/dist/{chunk-2S6QHZGJ.js.map → chunk-L2DPF4DF.js.map} +0 -0
- /package/dist/{chunk-JI5AVXYO.js.map → chunk-LEPOP46W.js.map} +0 -0
- /package/dist/{chunk-O7BBFJLP.js.map → chunk-LTAVSOZW.js.map} +0 -0
- /package/dist/{chunk-2IZAGAJR.js.map → chunk-LULR4IUW.js.map} +0 -0
- /package/dist/{chunk-WMWVO45V.js.map → chunk-MC6XO7T4.js.map} +0 -0
- /package/dist/{chunk-D6RIFG4O.js.map → chunk-MNB5RMAY.js.map} +0 -0
- /package/dist/{chunk-Q5WG43OP.js.map → chunk-MYFQ3ED4.js.map} +0 -0
- /package/dist/{chunk-V3UE5I5F.js.map → chunk-MYVPLJOO.js.map} +0 -0
- /package/dist/{chunk-MTWKDOVO.js.map → chunk-NLE6TSLG.js.map} +0 -0
- /package/dist/{chunk-DBRYEIGY.js.map → chunk-OJP3N7UK.js.map} +0 -0
- /package/dist/{chunk-SMX5267P.js.map → chunk-OZKOPQCM.js.map} +0 -0
- /package/dist/{chunk-JCK7V6SN.js.map → chunk-P65YJEEL.js.map} +0 -0
- /package/dist/{chunk-MTR7BZQN.js.map → chunk-PBGWYM3H.js.map} +0 -0
- /package/dist/{chunk-AXTXN4T6.js.map → chunk-PWFCHOB3.js.map} +0 -0
- /package/dist/{chunk-FDPZVY6D.js.map → chunk-QFN4U7AG.js.map} +0 -0
- /package/dist/{chunk-K2ZLHESQ.js.map → chunk-QIEUU4UK.js.map} +0 -0
- /package/dist/{chunk-3D6AFGQR.js.map → chunk-QVT3E4CE.js.map} +0 -0
- /package/dist/{chunk-SFQ6QNL7.js.map → chunk-R6YJI3HE.js.map} +0 -0
- /package/dist/{chunk-5CJVLG3H.js.map → chunk-RFDD3B7W.js.map} +0 -0
- /package/dist/{chunk-JBPKEARU.js.map → chunk-RKNJBZ55.js.map} +0 -0
- /package/dist/{chunk-FNZQGN76.js.map → chunk-S2BBISHU.js.map} +0 -0
- /package/dist/{chunk-IALLX7EE.js.map → chunk-S2FSBU4H.js.map} +0 -0
- /package/dist/{chunk-7K5Q6COX.js.map → chunk-TVVEYCNW.js.map} +0 -0
- /package/dist/{chunk-DPAENM7O.js.map → chunk-U3ZAVRP3.js.map} +0 -0
- /package/dist/{chunk-4KJLYTLS.js.map → chunk-V57NLO5P.js.map} +0 -0
- /package/dist/{chunk-FLVL4L3L.js.map → chunk-VDX2J7OX.js.map} +0 -0
- /package/dist/{chunk-AJLLIIML.js.map → chunk-W4FBGYGK.js.map} +0 -0
- /package/dist/{chunk-6SXVCD7W.js.map → chunk-W7IGLX4G.js.map} +0 -0
- /package/dist/{chunk-KAWTOYAW.js.map → chunk-WLZYGLJ4.js.map} +0 -0
- /package/dist/{chunk-RO4LQGT3.js.map → chunk-WON4APQY.js.map} +0 -0
- /package/dist/{chunk-PQVK2S3J.js.map → chunk-WZFAPHIK.js.map} +0 -0
- /package/dist/{chunk-KQPJLK3X.js.map → chunk-XL24QQ63.js.map} +0 -0
- /package/dist/{chunk-RVZRYUQH.js.map → chunk-YROFNEG5.js.map} +0 -0
- /package/dist/{chunk-VRAD2FGO.js.map → chunk-Z54EM5YZ.js.map} +0 -0
- /package/dist/{first-start-migration-TI67YMLG.js.map → first-start-migration-CSRHCJIQ.js.map} +0 -0
- /package/dist/{forget-CQCLB5LB.js.map → forget-HRPLVB3W.js.map} +0 -0
- /package/dist/{purge-NDWV6WYD.js.map → purge-IRF47ZTX.js.map} +0 -0
- /package/dist/{tier-stats-KV7IWCJR.js.map → tier-stats-QEJSPFV2.js.map} +0 -0
|
@@ -19,6 +19,12 @@
|
|
|
19
19
|
* tests continue to work.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
+
import { isMemoryCategory } from "../write-envelope.js";
|
|
23
|
+
import {
|
|
24
|
+
composeSalvagedExtractionEnvelope,
|
|
25
|
+
probeSalvageSurvivingFields,
|
|
26
|
+
withReservedMarkerTag,
|
|
27
|
+
} from "./extraction-envelope.js";
|
|
22
28
|
import path from "node:path";
|
|
23
29
|
import {
|
|
24
30
|
StorageManager,
|
|
@@ -38,6 +44,7 @@ import {
|
|
|
38
44
|
resolveNamespaceCapabilities,
|
|
39
45
|
resolveRecallEnhancementCapabilities,
|
|
40
46
|
resolveConversationContextCapabilities,
|
|
47
|
+
resolveRecallAuxiliaryCapabilities,
|
|
41
48
|
type GraphConstructionCapabilitySet,
|
|
42
49
|
type MemoryLifecycleCapabilitySet,
|
|
43
50
|
} from "../capabilities.js";
|
|
@@ -101,8 +108,14 @@ import type {
|
|
|
101
108
|
MemoryLink,
|
|
102
109
|
PluginConfig,
|
|
103
110
|
ProvenanceSource,
|
|
111
|
+
MemoryCategory,
|
|
104
112
|
} from "../types.js";
|
|
105
|
-
import {
|
|
113
|
+
import {
|
|
114
|
+
flushDeferredFactHashOnFailure,
|
|
115
|
+
profileAutoPromotionAllows,
|
|
116
|
+
readActiveMemoriesBothTiers,
|
|
117
|
+
shouldPromoteToShared,
|
|
118
|
+
} from "./extraction-persist-promotion.js";
|
|
106
119
|
import type { ResolvedScopeProfilePlan } from "../namespaces/scope-profiles.js";
|
|
107
120
|
import {
|
|
108
121
|
buildMemoryPathById,
|
|
@@ -208,7 +221,6 @@ export class ExtractionPersistCoordinator {
|
|
|
208
221
|
constructor(
|
|
209
222
|
private readonly deps: ExtractionPersistDeps,
|
|
210
223
|
) {}
|
|
211
|
-
|
|
212
224
|
private get config(): PluginConfig {
|
|
213
225
|
return this.deps.config;
|
|
214
226
|
}
|
|
@@ -224,7 +236,7 @@ export class ExtractionPersistCoordinator {
|
|
|
224
236
|
sourceText?: string,
|
|
225
237
|
graphCaps: GraphConstructionCapabilitySet = resolveGraphConstructionCapabilities(this.deps.config),
|
|
226
238
|
lifecycleCaps: MemoryLifecycleCapabilitySet = resolveMemoryLifecycleCapabilities(this.deps.config),
|
|
227
|
-
): Promise<string[]> {
|
|
239
|
+
): Promise<{ persistedIds: string[]; memoryPathById: Map<string, string> }> {
|
|
228
240
|
// Inline source attribution (issue #369). When enabled, every extracted
|
|
229
241
|
// fact is rewritten to carry a compact provenance tag inside its body so
|
|
230
242
|
// the citation survives hostile memory text, copy/paste, and LLM quoting.
|
|
@@ -232,6 +244,15 @@ export class ExtractionPersistCoordinator {
|
|
|
232
244
|
// see zero behavioral change.
|
|
233
245
|
const citationEnabled = resolvePipelineProcessingCapabilities(this.deps.config).inlineSourceAttribution === true;
|
|
234
246
|
const citationTemplate = this.deps.config.inlineSourceAttributionFormat;
|
|
247
|
+
// #1909: the main-path fact writes defer their per-fact fact-hash-index flush
|
|
248
|
+
// to the orchestrator's end-of-persist reconciling batch save ONLY when fact
|
|
249
|
+
// deduplication is enabled (with it off, contentHashIndexForStorage() returns
|
|
250
|
+
// null and the batch save is a no-op, so the write must save immediately).
|
|
251
|
+
// Round 11: there is NO fact-hashes.ready marker anymore — the fact-hash
|
|
252
|
+
// index is ALWAYS rebuilt from the corpus on restart (see
|
|
253
|
+
// ensureFactHashIndexAuthoritative), so a deferred write, crash, or
|
|
254
|
+
// multi-process interleave is safe by construction with no marker to guard.
|
|
255
|
+
const factDedupEnabled = resolveRecallAuxiliaryCapabilities(this.deps.config).factDeduplication;
|
|
235
256
|
|
|
236
257
|
// Canonicalize stored content for dedup comparison: strip citations
|
|
237
258
|
// (using the same template), sanitize, then normalize whitespace.
|
|
@@ -268,14 +289,12 @@ export class ExtractionPersistCoordinator {
|
|
|
268
289
|
return attachCitation(content, citationContext, citationTemplate);
|
|
269
290
|
};
|
|
270
291
|
const persistedIds: string[] = [];
|
|
292
|
+
const memoryPathById = new Map<string, string>();
|
|
271
293
|
const supersessionOrderingAt = (validAt?: string): string =>
|
|
272
294
|
validAt && validAt.length > 0 ? validAt : new Date().toISOString();
|
|
273
295
|
// #1635: pending_review persisted ids, excluded from the thread episode set below.
|
|
274
296
|
const pendingReviewPersistedIds: string[] = [];
|
|
275
|
-
const persistedIdsByStorage = new Map<
|
|
276
|
-
string,
|
|
277
|
-
{ storage: StorageManager; ids: string[] }
|
|
278
|
-
>();
|
|
297
|
+
const persistedIdsByStorage = new Map<string, { storage: StorageManager; ids: string[] }>();
|
|
279
298
|
const trackPersistedId = (
|
|
280
299
|
targetStorage: StorageManager,
|
|
281
300
|
id: string,
|
|
@@ -283,6 +302,7 @@ export class ExtractionPersistCoordinator {
|
|
|
283
302
|
includeReturnedIds?: boolean;
|
|
284
303
|
/** #1635: keep this id out of the persisted thread episode set. */
|
|
285
304
|
pendingReview?: boolean;
|
|
305
|
+
category?: MemoryCategory;
|
|
286
306
|
} = {},
|
|
287
307
|
): void => {
|
|
288
308
|
if (options.includeReturnedIds !== false) {
|
|
@@ -295,14 +315,16 @@ export class ExtractionPersistCoordinator {
|
|
|
295
315
|
const existing = persistedIdsByStorage.get(key);
|
|
296
316
|
if (existing) {
|
|
297
317
|
existing.ids.push(id);
|
|
298
|
-
|
|
318
|
+
} else {
|
|
319
|
+
persistedIdsByStorage.set(key, { storage: targetStorage, ids: [id] });
|
|
320
|
+
}
|
|
321
|
+
if (options.category && !memoryPathById.has(id)) {
|
|
322
|
+
const relPath = resolvePersistedMemoryRelativePath({ memoryId: id, pathById: memoryPathById, category: options.category });
|
|
323
|
+
memoryPathById.set(id, relPath);
|
|
299
324
|
}
|
|
300
|
-
persistedIdsByStorage.set(key, { storage: targetStorage, ids: [id] });
|
|
301
325
|
};
|
|
302
326
|
let dedupedCount = 0;
|
|
303
327
|
// Counter for facts skipped by the importance write-gate (issue #372).
|
|
304
|
-
// Emitted via the `importance_gated` metric below and rolled into the
|
|
305
|
-
// final `persisted:` log line so operators can tune the threshold.
|
|
306
328
|
let importanceGatedCount = 0;
|
|
307
329
|
// UUI2: short-circuit semantic dedup after first backend-unavailable signal
|
|
308
330
|
// within this batch. Once any fact in the batch gets reason="backend_unavailable"
|
|
@@ -349,12 +371,6 @@ export class ExtractionPersistCoordinator {
|
|
|
349
371
|
events: [...events],
|
|
350
372
|
});
|
|
351
373
|
};
|
|
352
|
-
const confidenceTierOrder = [
|
|
353
|
-
"explicit",
|
|
354
|
-
"implied",
|
|
355
|
-
"inferred",
|
|
356
|
-
"speculative",
|
|
357
|
-
] as const;
|
|
358
374
|
const sharedProfileLayer = scopeProfileWritePlan?.layers.find(
|
|
359
375
|
(layer) =>
|
|
360
376
|
layer.id === "serverShared" &&
|
|
@@ -378,59 +394,6 @@ export class ExtractionPersistCoordinator {
|
|
|
378
394
|
// (pre-judge + write-loop) so no new scattered config.*Enabled read is
|
|
379
395
|
// introduced (ratchet scatteredConfigFlagReads; see #1523).
|
|
380
396
|
const namespacesEnabled = resolveNamespaceCapabilities(this.deps.config).namespaces;
|
|
381
|
-
const profileAutoPromotionAllows = (
|
|
382
|
-
category: string,
|
|
383
|
-
confidence: number,
|
|
384
|
-
): boolean => {
|
|
385
|
-
if (!scopeProfileWritePlan) return false;
|
|
386
|
-
const actualTier = confidenceTier(confidence);
|
|
387
|
-
const actualRank = confidenceTierOrder.indexOf(actualTier);
|
|
388
|
-
if (actualRank === -1) return false;
|
|
389
|
-
const autoPromote = scopeProfileWritePlan.profile.autoPromote;
|
|
390
|
-
if (!autoPromote.enabled) return false;
|
|
391
|
-
if (!autoPromote.categories.includes(category as any)) return false;
|
|
392
|
-
const minimumRank = confidenceTierOrder.indexOf(autoPromote.minConfidenceTier);
|
|
393
|
-
return minimumRank !== -1 && actualRank <= minimumRank;
|
|
394
|
-
};
|
|
395
|
-
const sharedAutoPromotionAllows = (
|
|
396
|
-
category: string,
|
|
397
|
-
confidence: number,
|
|
398
|
-
): boolean => {
|
|
399
|
-
if (!scopeProfileWritePlan) {
|
|
400
|
-
const actualTier = confidenceTier(confidence);
|
|
401
|
-
const actualRank = confidenceTierOrder.indexOf(actualTier);
|
|
402
|
-
if (actualRank === -1) return false;
|
|
403
|
-
if (!resolveRecallEnhancementCapabilities(this.deps.config).autoPromoteToShared) return false;
|
|
404
|
-
if (!this.deps.config.autoPromoteToSharedCategories.includes(category as any))
|
|
405
|
-
return false;
|
|
406
|
-
const minimumRank = confidenceTierOrder.indexOf(
|
|
407
|
-
this.deps.config.autoPromoteMinConfidenceTier,
|
|
408
|
-
);
|
|
409
|
-
return minimumRank !== -1 && actualRank <= minimumRank;
|
|
410
|
-
}
|
|
411
|
-
return (
|
|
412
|
-
scopeProfileWritePlan.profile.autoPromote.targets.includes("serverShared") &&
|
|
413
|
-
profileAutoPromotionAllows(category, confidence)
|
|
414
|
-
);
|
|
415
|
-
};
|
|
416
|
-
const shouldPromoteToShared = (
|
|
417
|
-
targetStorage: StorageManager,
|
|
418
|
-
category: string,
|
|
419
|
-
confidence: number,
|
|
420
|
-
): boolean => {
|
|
421
|
-
if (
|
|
422
|
-
!resolveNamespaceCapabilities(this.deps.config).namespaces ||
|
|
423
|
-
!profileAllowsSharedWrites ||
|
|
424
|
-
!sharedAutoPromotionAllows(category, confidence)
|
|
425
|
-
)
|
|
426
|
-
return false;
|
|
427
|
-
if (
|
|
428
|
-
this.deps.storageDirNamespace(targetStorage.dir) ===
|
|
429
|
-
this.deps.config.sharedNamespace
|
|
430
|
-
)
|
|
431
|
-
return false;
|
|
432
|
-
return true;
|
|
433
|
-
};
|
|
434
397
|
const promoteMemoryToProfileTargets = async (options: {
|
|
435
398
|
sourceStorage: StorageManager;
|
|
436
399
|
category: string;
|
|
@@ -457,7 +420,7 @@ export class ExtractionPersistCoordinator {
|
|
|
457
420
|
}): Promise<void> => {
|
|
458
421
|
if (
|
|
459
422
|
!scopeProfileWritePlan ||
|
|
460
|
-
!profileAutoPromotionAllows(options.category, options.confidence)
|
|
423
|
+
!profileAutoPromotionAllows(scopeProfileWritePlan, options.category, options.confidence)
|
|
461
424
|
)
|
|
462
425
|
return;
|
|
463
426
|
const autoTargets = new Set(scopeProfileWritePlan.profile.autoPromote.targets);
|
|
@@ -475,17 +438,35 @@ export class ExtractionPersistCoordinator {
|
|
|
475
438
|
: options.content;
|
|
476
439
|
const citedContent = applyInlineCitation(rawContent);
|
|
477
440
|
const sanitizedBase = sanitizeMemoryContent(rawContent);
|
|
478
|
-
const dedupContent =
|
|
479
|
-
options.category === "fact" &&
|
|
480
|
-
options.structuredAttributes &&
|
|
481
|
-
Object.keys(options.structuredAttributes).length > 0
|
|
482
|
-
? `${sanitizedBase.text}\n[Attributes: ${normalizeAttributePairs(options.structuredAttributes)}]`
|
|
483
|
-
: sanitizedBase.text;
|
|
484
441
|
for (const target of targets) {
|
|
485
442
|
if (!target.namespace) continue;
|
|
486
443
|
try {
|
|
487
444
|
const targetStorage = await this.deps.getStorageRouter().storageFor(target.namespace);
|
|
488
445
|
if (targetStorage.dir === options.sourceStorage.dir) continue;
|
|
446
|
+
// Compose BEFORE the dedup gate (#2014 round 2): salvage mode may
|
|
447
|
+
// drop or clamp attributes, and the dedup hash, contentHashSource,
|
|
448
|
+
// and supersession keys below must all describe the SURVIVING
|
|
449
|
+
// fields that writeSealedMemory actually persists.
|
|
450
|
+
const targetPromotionEnvelope = composeSalvagedExtractionEnvelope(
|
|
451
|
+
{
|
|
452
|
+
content: citedContent,
|
|
453
|
+
category: options.category as MemoryCategory,
|
|
454
|
+
confidence: options.confidence,
|
|
455
|
+
tags: withReservedMarkerTag(options.tags, `${target.target}-promotion`),
|
|
456
|
+
entityRef: options.entityRef,
|
|
457
|
+
structuredAttributes: options.structuredAttributes,
|
|
458
|
+
validAt: options.validAt,
|
|
459
|
+
...(sourceContext?.sourceConnector ? { sourceConnector: sourceContext.sourceConnector } : {}),
|
|
460
|
+
},
|
|
461
|
+
{ source: `${options.source}-${target.target}-promotion` },
|
|
462
|
+
);
|
|
463
|
+
const targetSurvivingAttrs = targetPromotionEnvelope.rawStructuredAttributes;
|
|
464
|
+
const dedupContent =
|
|
465
|
+
options.category === "fact" &&
|
|
466
|
+
targetSurvivingAttrs &&
|
|
467
|
+
Object.keys(targetSurvivingAttrs).length > 0
|
|
468
|
+
? `${sanitizedBase.text}\n[Attributes: ${normalizeAttributePairs({ ...targetSurvivingAttrs })}]`
|
|
469
|
+
: sanitizedBase.text;
|
|
489
470
|
if (
|
|
490
471
|
options.category === "fact" &&
|
|
491
472
|
(await targetStorage.hasFactContentHash(dedupContent))
|
|
@@ -495,7 +476,7 @@ export class ExtractionPersistCoordinator {
|
|
|
495
476
|
// Different connectors with same content should NOT be deduped.
|
|
496
477
|
let skipPromotion = true;
|
|
497
478
|
try {
|
|
498
|
-
const allMems = await targetStorage
|
|
479
|
+
const allMems = await readActiveMemoriesBothTiers(targetStorage);
|
|
499
480
|
const nc = sourceContext?.sourceConnector?.trim() || undefined;
|
|
500
481
|
skipPromotion = allMems.some((m) => {
|
|
501
482
|
if (m.frontmatter.category !== options.category) return false;
|
|
@@ -526,40 +507,34 @@ export class ExtractionPersistCoordinator {
|
|
|
526
507
|
...(options.observedAt ? { observedAt: options.observedAt } : {}),
|
|
527
508
|
...(options.eventTimeSource ? { eventTimeSource: options.eventTimeSource } : {}),
|
|
528
509
|
},
|
|
529
|
-
|
|
510
|
+
// #2014 round 3: the envelope's SURVIVING entityRef — the raw
|
|
511
|
+
// option can differ (untrimmed/dropped) from what sealed
|
|
512
|
+
// writes persisted, mistargeting the backfill row.
|
|
513
|
+
targetPromotionEnvelope.entityRef,
|
|
530
514
|
sourceContext?.sourceConnector,
|
|
531
515
|
);
|
|
532
516
|
}
|
|
533
517
|
continue;
|
|
534
518
|
}
|
|
535
519
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
...(options.invalidAt ? { invalidAt: options.invalidAt } : {}),
|
|
555
|
-
...(options.observedAt ? { observedAt: options.observedAt } : {}),
|
|
556
|
-
...(options.eventTimeSource ? { eventTimeSource: options.eventTimeSource } : {}),
|
|
557
|
-
contentHashSource: options.category === "fact" ? dedupContent : rawContent,
|
|
558
|
-
...(options.sources && options.sources.length > 0 ? { sources: options.sources } : {}),
|
|
559
|
-
...(options.provenance ? { provenance: options.provenance } : {}),
|
|
560
|
-
...(sourceContext?.sourceConnector ? { sourceConnector: sourceContext.sourceConnector } : {}),
|
|
561
|
-
},
|
|
562
|
-
);
|
|
520
|
+
// Sealed-envelope write (issue #1989 PR2): cross-cutting fields ride
|
|
521
|
+
// the composed envelope (built above, before the dedup gate).
|
|
522
|
+
const targetPromotion = await targetStorage.writeSealedMemory(targetPromotionEnvelope, {
|
|
523
|
+
importance: options.importance,
|
|
524
|
+
lineage: [options.sourceMemoryId],
|
|
525
|
+
sourceMemoryId: options.sourceMemoryId,
|
|
526
|
+
intentGoal: options.intentGoal,
|
|
527
|
+
intentActionType: options.intentActionType,
|
|
528
|
+
intentEntityTypes: options.intentEntityTypes,
|
|
529
|
+
memoryKind: options.memoryKind,
|
|
530
|
+
// #1578 — forward bi-temporal bounds + ingestion provenance.
|
|
531
|
+
...(options.invalidAt ? { invalidAt: options.invalidAt } : {}),
|
|
532
|
+
...(options.observedAt ? { observedAt: options.observedAt } : {}),
|
|
533
|
+
...(options.eventTimeSource ? { eventTimeSource: options.eventTimeSource } : {}),
|
|
534
|
+
contentHashSource: options.category === "fact" ? dedupContent : rawContent,
|
|
535
|
+
...(options.sources && options.sources.length > 0 ? { sources: options.sources } : {}),
|
|
536
|
+
...(options.provenance ? { provenance: options.provenance } : {}),
|
|
537
|
+
});
|
|
563
538
|
const promotedId = targetPromotion.id;
|
|
564
539
|
// #1645: if the TARGET namespace's own tombstone blocked this promotion,
|
|
565
540
|
// the row lands pending_review — do NOT supersede active target memories.
|
|
@@ -567,16 +542,16 @@ export class ExtractionPersistCoordinator {
|
|
|
567
542
|
!targetPromotion.tombstoneBlocked &&
|
|
568
543
|
lifecycleCaps.temporalSupersession &&
|
|
569
544
|
options.category === "fact" &&
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
Object.keys(
|
|
545
|
+
targetPromotionEnvelope.entityRef &&
|
|
546
|
+
targetSurvivingAttrs &&
|
|
547
|
+
Object.keys(targetSurvivingAttrs).length > 0
|
|
573
548
|
) {
|
|
574
549
|
try {
|
|
575
550
|
await applyTemporalSupersession({
|
|
576
551
|
storage: targetStorage,
|
|
577
552
|
newMemoryId: promotedId,
|
|
578
|
-
entityRef:
|
|
579
|
-
structuredAttributes:
|
|
553
|
+
entityRef: targetPromotionEnvelope.entityRef,
|
|
554
|
+
structuredAttributes: { ...targetSurvivingAttrs },
|
|
580
555
|
createdAt: supersessionOrderingAt(options.validAt),
|
|
581
556
|
enabled: !(options.eventTimeSource === "extracted" && !options.validAt),
|
|
582
557
|
});
|
|
@@ -589,7 +564,7 @@ export class ExtractionPersistCoordinator {
|
|
|
589
564
|
// #1645 TV6: a tombstone-blocked promotion is pending_review (no
|
|
590
565
|
// active copy) — skip catalog/index/behavior like postWriteGuard.
|
|
591
566
|
if (!targetPromotion.tombstoneBlocked) {
|
|
592
|
-
trackPersistedId(targetStorage, promotedId, { includeReturnedIds: false });
|
|
567
|
+
trackPersistedId(targetStorage, promotedId, { includeReturnedIds: false, category: options.category as MemoryCategory });
|
|
593
568
|
await this.deps.indexPersistedMemory(targetStorage, promotedId);
|
|
594
569
|
trackBehaviorSignals(
|
|
595
570
|
targetStorage,
|
|
@@ -639,6 +614,10 @@ export class ExtractionPersistCoordinator {
|
|
|
639
614
|
await promoteMemoryToProfileTargets(options);
|
|
640
615
|
if (
|
|
641
616
|
!shouldPromoteToShared(
|
|
617
|
+
this.deps.config,
|
|
618
|
+
scopeProfileWritePlan,
|
|
619
|
+
profileAllowsSharedWrites,
|
|
620
|
+
(dir) => this.deps.storageDirNamespace(dir),
|
|
642
621
|
options.sourceStorage,
|
|
643
622
|
options.category,
|
|
644
623
|
options.confidence,
|
|
@@ -693,11 +672,29 @@ export class ExtractionPersistCoordinator {
|
|
|
693
672
|
: options.content;
|
|
694
673
|
const citedContent = applyInlineCitation(rawContent);
|
|
695
674
|
const sanitizedBase = sanitizeMemoryContent(rawContent);
|
|
675
|
+
// Compose BEFORE the dedup gate (#2014 round 2): salvage mode may drop
|
|
676
|
+
// or clamp attributes, and the dedup hash, contentHashSource, and
|
|
677
|
+
// supersession keys below must all describe the SURVIVING fields that
|
|
678
|
+
// writeSealedMemory actually persists — never the raw extractor map.
|
|
679
|
+
const sharedPromotionEnvelope = composeSalvagedExtractionEnvelope(
|
|
680
|
+
{
|
|
681
|
+
content: citedContent,
|
|
682
|
+
category: options.category as MemoryCategory,
|
|
683
|
+
confidence: options.confidence,
|
|
684
|
+
tags: withReservedMarkerTag(options.tags, "shared-promotion"),
|
|
685
|
+
entityRef: options.entityRef,
|
|
686
|
+
structuredAttributes: options.structuredAttributes,
|
|
687
|
+
validAt: options.validAt,
|
|
688
|
+
...(sourceContext?.sourceConnector ? { sourceConnector: sourceContext.sourceConnector } : {}),
|
|
689
|
+
},
|
|
690
|
+
{ source: `${options.source}-shared-promotion` },
|
|
691
|
+
);
|
|
692
|
+
const sharedSurvivingAttrs = sharedPromotionEnvelope.rawStructuredAttributes;
|
|
696
693
|
const dedupContent =
|
|
697
694
|
options.category === "fact" &&
|
|
698
|
-
|
|
699
|
-
Object.keys(
|
|
700
|
-
? `${sanitizedBase.text}\n[Attributes: ${normalizeAttributePairs(
|
|
695
|
+
sharedSurvivingAttrs &&
|
|
696
|
+
Object.keys(sharedSurvivingAttrs).length > 0
|
|
697
|
+
? `${sanitizedBase.text}\n[Attributes: ${normalizeAttributePairs({ ...sharedSurvivingAttrs })}]`
|
|
701
698
|
: sanitizedBase.text;
|
|
702
699
|
if (
|
|
703
700
|
options.category === "fact" &&
|
|
@@ -712,7 +709,7 @@ export class ExtractionPersistCoordinator {
|
|
|
712
709
|
let sharedSameConnector = true;
|
|
713
710
|
if (options.invalidAt || options.validAt) {
|
|
714
711
|
try {
|
|
715
|
-
const sharedMems = await sharedStorage
|
|
712
|
+
const sharedMems = await readActiveMemoriesBothTiers(sharedStorage);
|
|
716
713
|
const snc = sourceContext?.sourceConnector?.trim() || undefined;
|
|
717
714
|
sharedSameConnector = sharedMems.some((m) => {
|
|
718
715
|
if (m.frontmatter.category !== "fact") return false;
|
|
@@ -750,7 +747,8 @@ export class ExtractionPersistCoordinator {
|
|
|
750
747
|
...(options.observedAt ? { observedAt: options.observedAt } : {}),
|
|
751
748
|
...(options.eventTimeSource ? { eventTimeSource: options.eventTimeSource } : {}),
|
|
752
749
|
},
|
|
753
|
-
|
|
750
|
+
// #2014 round 3: envelope-surviving entityRef (see profile-target).
|
|
751
|
+
sharedPromotionEnvelope.entityRef,
|
|
754
752
|
sourceContext?.sourceConnector,
|
|
755
753
|
);
|
|
756
754
|
}
|
|
@@ -767,9 +765,9 @@ export class ExtractionPersistCoordinator {
|
|
|
767
765
|
// step — if the lookup fails we skip silently (same as the normal path).
|
|
768
766
|
if (
|
|
769
767
|
lifecycleCaps.temporalSupersession &&
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
Object.keys(
|
|
768
|
+
sharedPromotionEnvelope.entityRef &&
|
|
769
|
+
sharedSurvivingAttrs &&
|
|
770
|
+
Object.keys(sharedSurvivingAttrs).length > 0
|
|
773
771
|
) {
|
|
774
772
|
// PR #402 round-7 (Fix #2 / Codex P1 PRRT_kwDORJXyws56VALC):
|
|
775
773
|
// Track whether matchingFact lookup completed before the try block
|
|
@@ -787,7 +785,7 @@ export class ExtractionPersistCoordinator {
|
|
|
787
785
|
// sanitization redacted the content, causing the candidate lookup to
|
|
788
786
|
// return undefined and leaving stale facts active.
|
|
789
787
|
const normalizedIncoming = ContentHashIndex.normalizeContent(dedupContent);
|
|
790
|
-
const allShared = await sharedStorage
|
|
788
|
+
const allShared = await readActiveMemoriesBothTiers(sharedStorage);
|
|
791
789
|
// PR #402 round-12 (Finding Uybg): restrict hash-dedup matching to
|
|
792
790
|
// the SAME entity. Content-hash equality alone can collide across
|
|
793
791
|
// entities when two entities share identical fact text. Using an
|
|
@@ -795,7 +793,7 @@ export class ExtractionPersistCoordinator {
|
|
|
795
793
|
// supersession to that entity's record and corrupt its
|
|
796
794
|
// `supersededBy` links. Only consider facts whose normalized
|
|
797
795
|
// `entityRef` matches the incoming entity.
|
|
798
|
-
const incomingEntityNorm = normalizeSupersessionKey(
|
|
796
|
+
const incomingEntityNorm = normalizeSupersessionKey(sharedPromotionEnvelope.entityRef);
|
|
799
797
|
hashDedupMatchingFact = allShared.find((m) => {
|
|
800
798
|
if (m.frontmatter.category !== "fact") return false;
|
|
801
799
|
if ((m.frontmatter.status ?? "active") !== "active") return false;
|
|
@@ -839,8 +837,8 @@ export class ExtractionPersistCoordinator {
|
|
|
839
837
|
const hashDedupSupersession = await applyTemporalSupersession({
|
|
840
838
|
storage: sharedStorage,
|
|
841
839
|
newMemoryId: hashDedupMatchingFact.frontmatter.id,
|
|
842
|
-
entityRef:
|
|
843
|
-
structuredAttributes:
|
|
840
|
+
entityRef: sharedPromotionEnvelope.entityRef,
|
|
841
|
+
structuredAttributes: { ...sharedSurvivingAttrs },
|
|
844
842
|
createdAt: supersessionOrderingAt(options.validAt),
|
|
845
843
|
enabled: !(options.eventTimeSource === "extracted" && !options.validAt),
|
|
846
844
|
useCallerTimestamp: true,
|
|
@@ -903,7 +901,7 @@ export class ExtractionPersistCoordinator {
|
|
|
903
901
|
// fact gets its own promoted copy.
|
|
904
902
|
let skipSharedPromotion = true;
|
|
905
903
|
try {
|
|
906
|
-
const allSharedMems = await sharedStorage
|
|
904
|
+
const allSharedMems = await readActiveMemoriesBothTiers(sharedStorage);
|
|
907
905
|
const snc = sourceContext?.sourceConnector?.trim() || undefined;
|
|
908
906
|
const sharedNormalized = ContentHashIndex.normalizeContent(dedupContent);
|
|
909
907
|
skipSharedPromotion = allSharedMems.some((m) => {
|
|
@@ -924,34 +922,23 @@ export class ExtractionPersistCoordinator {
|
|
|
924
922
|
// No same-connector active shared fact — fall through to write.
|
|
925
923
|
}
|
|
926
924
|
}
|
|
927
|
-
const sharedPromotion = await sharedStorage.
|
|
928
|
-
options.
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
// #1578 — forward bi-temporal bounds + ingestion provenance.
|
|
945
|
-
...(options.invalidAt ? { invalidAt: options.invalidAt } : {}),
|
|
946
|
-
...(options.observedAt ? { observedAt: options.observedAt } : {}),
|
|
947
|
-
...(options.eventTimeSource ? { eventTimeSource: options.eventTimeSource } : {}),
|
|
948
|
-
contentHashSource: options.category === "fact" ? dedupContent : rawContent,
|
|
949
|
-
// Claim-level provenance spans (issue #1575 PR 2).
|
|
950
|
-
...(options.sources && options.sources.length > 0 ? { sources: options.sources } : {}),
|
|
951
|
-
...(options.provenance ? { provenance: options.provenance } : {}),
|
|
952
|
-
...(sourceContext?.sourceConnector ? { sourceConnector: sourceContext.sourceConnector } : {}),
|
|
953
|
-
},
|
|
954
|
-
);
|
|
925
|
+
const sharedPromotion = await sharedStorage.writeSealedMemory(sharedPromotionEnvelope, {
|
|
926
|
+
importance: options.importance,
|
|
927
|
+
lineage: [options.sourceMemoryId],
|
|
928
|
+
sourceMemoryId: options.sourceMemoryId,
|
|
929
|
+
intentGoal: options.intentGoal,
|
|
930
|
+
intentActionType: options.intentActionType,
|
|
931
|
+
intentEntityTypes: options.intentEntityTypes,
|
|
932
|
+
memoryKind: options.memoryKind,
|
|
933
|
+
// #1578 — forward bi-temporal bounds + ingestion provenance.
|
|
934
|
+
...(options.invalidAt ? { invalidAt: options.invalidAt } : {}),
|
|
935
|
+
...(options.observedAt ? { observedAt: options.observedAt } : {}),
|
|
936
|
+
...(options.eventTimeSource ? { eventTimeSource: options.eventTimeSource } : {}),
|
|
937
|
+
contentHashSource: options.category === "fact" ? dedupContent : rawContent,
|
|
938
|
+
// Claim-level provenance spans (issue #1575 PR 2).
|
|
939
|
+
...(options.sources && options.sources.length > 0 ? { sources: options.sources } : {}),
|
|
940
|
+
...(options.provenance ? { provenance: options.provenance } : {}),
|
|
941
|
+
});
|
|
955
942
|
const promotedId = sharedPromotion.id;
|
|
956
943
|
// #1645: if the shared namespace's own tombstone blocked this promotion,
|
|
957
944
|
// leave the row pending_review but do NOT supersede active shared memories.
|
|
@@ -964,16 +951,16 @@ export class ExtractionPersistCoordinator {
|
|
|
964
951
|
if (
|
|
965
952
|
!sharedPromotion.tombstoneBlocked &&
|
|
966
953
|
lifecycleCaps.temporalSupersession &&
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
Object.keys(
|
|
954
|
+
sharedPromotionEnvelope.entityRef &&
|
|
955
|
+
sharedSurvivingAttrs &&
|
|
956
|
+
Object.keys(sharedSurvivingAttrs).length > 0
|
|
970
957
|
) {
|
|
971
958
|
try {
|
|
972
959
|
await applyTemporalSupersession({
|
|
973
960
|
storage: sharedStorage,
|
|
974
961
|
newMemoryId: promotedId,
|
|
975
|
-
entityRef:
|
|
976
|
-
structuredAttributes:
|
|
962
|
+
entityRef: sharedPromotionEnvelope.entityRef,
|
|
963
|
+
structuredAttributes: { ...sharedSurvivingAttrs },
|
|
977
964
|
createdAt: supersessionOrderingAt(options.validAt),
|
|
978
965
|
enabled: !(options.eventTimeSource === "extracted" && !options.validAt),
|
|
979
966
|
});
|
|
@@ -996,6 +983,7 @@ export class ExtractionPersistCoordinator {
|
|
|
996
983
|
if (!sharedPromotion.tombstoneBlocked) {
|
|
997
984
|
trackPersistedId(sharedStorage, promotedId, {
|
|
998
985
|
includeReturnedIds: false,
|
|
986
|
+
category: options.category as MemoryCategory,
|
|
999
987
|
});
|
|
1000
988
|
await this.deps.indexPersistedMemory(sharedStorage, promotedId);
|
|
1001
989
|
trackBehaviorSignals(
|
|
@@ -1055,11 +1043,28 @@ export class ExtractionPersistCoordinator {
|
|
|
1055
1043
|
? stripCitationForTemplate(args.content, citationTemplate)
|
|
1056
1044
|
: args.content;
|
|
1057
1045
|
const sanitizedBase = sanitizeMemoryContent(rawContent);
|
|
1046
|
+
// #2014 round 3: promoted copies were written from SALVAGE envelopes,
|
|
1047
|
+
// so hash on the same surviving fields those writes persisted — a
|
|
1048
|
+
// raw-attrs hash silently misses after salvage drops/dedupes keys.
|
|
1049
|
+
// Fail open to raw fields when the probe rejects.
|
|
1050
|
+
const probed =
|
|
1051
|
+
args.category === "fact" && isMemoryCategory(args.category)
|
|
1052
|
+
? probeSalvageSurvivingFields({
|
|
1053
|
+
content: rawContent,
|
|
1054
|
+
category: args.category,
|
|
1055
|
+
structuredAttributes: args.structuredAttributes,
|
|
1056
|
+
entityRef: args.entityRef,
|
|
1057
|
+
})
|
|
1058
|
+
: null;
|
|
1059
|
+
const backfillEntityRef = probed ? probed.entityRef : args.entityRef;
|
|
1060
|
+
const survivingBackfillAttrs = probed
|
|
1061
|
+
? probed.structuredAttributes
|
|
1062
|
+
: args.structuredAttributes;
|
|
1058
1063
|
const dedupContent =
|
|
1059
1064
|
args.category === "fact" &&
|
|
1060
|
-
|
|
1061
|
-
Object.keys(
|
|
1062
|
-
? `${sanitizedBase.text}\n[Attributes: ${normalizeAttributePairs(
|
|
1065
|
+
survivingBackfillAttrs &&
|
|
1066
|
+
Object.keys(survivingBackfillAttrs).length > 0
|
|
1067
|
+
? `${sanitizedBase.text}\n[Attributes: ${normalizeAttributePairs(survivingBackfillAttrs)}]`
|
|
1063
1068
|
: sanitizedBase.text;
|
|
1064
1069
|
// Profile targets. NOTE: we do NOT gate on profileAutoPromotionAllows —
|
|
1065
1070
|
// a promoted profile copy may exist from an EARLIER extraction with
|
|
@@ -1090,7 +1095,7 @@ export class ExtractionPersistCoordinator {
|
|
|
1090
1095
|
targetStorage,
|
|
1091
1096
|
dedupContent,
|
|
1092
1097
|
args.bounds,
|
|
1093
|
-
|
|
1098
|
+
backfillEntityRef,
|
|
1094
1099
|
args.sourceConnector,
|
|
1095
1100
|
);
|
|
1096
1101
|
} catch (err) {
|
|
@@ -1118,7 +1123,7 @@ export class ExtractionPersistCoordinator {
|
|
|
1118
1123
|
sharedStorage,
|
|
1119
1124
|
dedupContent,
|
|
1120
1125
|
args.bounds,
|
|
1121
|
-
|
|
1126
|
+
backfillEntityRef,
|
|
1122
1127
|
args.sourceConnector,
|
|
1123
1128
|
);
|
|
1124
1129
|
}
|
|
@@ -1136,7 +1141,7 @@ export class ExtractionPersistCoordinator {
|
|
|
1136
1141
|
"persistExtraction: result or result.facts is invalid, skipping",
|
|
1137
1142
|
{ resultType: typeof result, factsType: typeof result?.facts },
|
|
1138
1143
|
);
|
|
1139
|
-
return persistedIds;
|
|
1144
|
+
return { persistedIds, memoryPathById };
|
|
1140
1145
|
}
|
|
1141
1146
|
|
|
1142
1147
|
// Chunking config from plugin settings
|
|
@@ -1521,6 +1526,18 @@ export class ExtractionPersistCoordinator {
|
|
|
1521
1526
|
) {
|
|
1522
1527
|
continue;
|
|
1523
1528
|
}
|
|
1529
|
+
// Trim first (round 5): legacy writeMemory accepted " fact ".
|
|
1530
|
+
(fact as any).category = (fact as any).category.trim();
|
|
1531
|
+
// #2014/#2017 review round: an unrecognized non-empty category from
|
|
1532
|
+
// the extractor is a per-CANDIDATE defect. The composer keeps category
|
|
1533
|
+
// fatal even in salvage mode (identity field), so filter here — one
|
|
1534
|
+
// malformed model field must not abort the whole extraction batch.
|
|
1535
|
+
if (!isMemoryCategory((fact as any).category)) {
|
|
1536
|
+
log.warn(
|
|
1537
|
+
`persistExtraction: skipping fact with unrecognized category ${JSON.stringify((fact as any).category)}`,
|
|
1538
|
+
);
|
|
1539
|
+
continue;
|
|
1540
|
+
}
|
|
1524
1541
|
(fact as any).tags = Array.isArray((fact as any).tags)
|
|
1525
1542
|
? (fact as any).tags.filter((t: any) => typeof t === "string")
|
|
1526
1543
|
: [];
|
|
@@ -1668,26 +1685,47 @@ export class ExtractionPersistCoordinator {
|
|
|
1668
1685
|
fact.tags,
|
|
1669
1686
|
);
|
|
1670
1687
|
let exactDuplicate = false;
|
|
1688
|
+
let needsCorpusConfirm = false;
|
|
1671
1689
|
try {
|
|
1672
|
-
exactDuplicate = await this.deps.hasContentHashDedup(
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1690
|
+
exactDuplicate = await this.deps.hasContentHashDedup(targetStorage, contentHashDedupKey);
|
|
1691
|
+
if (factDedupEnabled && !exactDuplicate) {
|
|
1692
|
+
// Fact dedup disabled → skip the authority check AND (via the guarded
|
|
1693
|
+
// corpus block below) corpus confirmation, so a disabled deployment
|
|
1694
|
+
// never suppresses a write via dedup (PR #2016 thread SD-nH). Enabled:
|
|
1695
|
+
// a MISS is trustworthy only against an AUTHORITATIVE index — re-check.
|
|
1696
|
+
if (await targetStorage.isFactContentHashAuthoritative()) {
|
|
1697
|
+
exactDuplicate = await this.deps.hasContentHashDedup(targetStorage, contentHashDedupKey);
|
|
1698
|
+
} else {
|
|
1699
|
+
needsCorpusConfirm = true;
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1676
1702
|
} catch (err) {
|
|
1703
|
+
// Dedup lookup failed (e.g. the authoritative rebuild could not run). Do
|
|
1704
|
+
// NOT fail-open into a possible duplicate — confirm against the corpus.
|
|
1705
|
+
needsCorpusConfirm = true;
|
|
1677
1706
|
log.warn(
|
|
1678
|
-
`content-hash dedup lookup
|
|
1707
|
+
`content-hash dedup lookup unavailable for storage ${targetStorage.dir}; confirming against corpus: ${err}`,
|
|
1679
1708
|
);
|
|
1680
1709
|
}
|
|
1681
|
-
// Connector-aware dedup (QOjlB): if the hash says duplicate
|
|
1682
|
-
// a same-content,
|
|
1683
|
-
//
|
|
1684
|
-
//
|
|
1685
|
-
// silently drop content.
|
|
1686
|
-
if (exactDuplicate) {
|
|
1710
|
+
// Connector-aware dedup (QOjlB): if the hash says duplicate — or the index
|
|
1711
|
+
// could not authoritatively confirm a miss — verify a same-content,
|
|
1712
|
+
// same-connector active fact exists across the hot+cold tiers. Different
|
|
1713
|
+
// connectors with the same content are NOT duplicates. Fail open (write) on
|
|
1714
|
+
// scan failure so an unverifiable state cannot silently drop content.
|
|
1715
|
+
if (factDedupEnabled && (exactDuplicate || needsCorpusConfirm)) {
|
|
1687
1716
|
try {
|
|
1688
|
-
|
|
1717
|
+
// #2016 cold-tier finding: the authoritative content-hash rebuild
|
|
1718
|
+
// unions the HOT and COLD tiers, so a hash hit can name an active copy
|
|
1719
|
+
// that was demoted to cold/. A hot-only confirmation scan misses it,
|
|
1720
|
+
// flips exactDuplicate back to false, and writes a second active hot
|
|
1721
|
+
// copy of the same content. Scan both tiers so a cold-only active copy
|
|
1722
|
+
// still confirms the duplicate and suppresses the redundant hot write.
|
|
1723
|
+
const [hotMems, coldMems] = await Promise.all([
|
|
1724
|
+
targetStorage.readAllMemories(),
|
|
1725
|
+
targetStorage.readAllColdMemories(),
|
|
1726
|
+
]);
|
|
1689
1727
|
const nc = sourceContext?.sourceConnector?.trim() || undefined;
|
|
1690
|
-
|
|
1728
|
+
const matchesActiveDuplicate = (m: MemoryFile): boolean => {
|
|
1691
1729
|
if (m.frontmatter.category !== writeCategory) return false;
|
|
1692
1730
|
if ((m.frontmatter.status ?? "active") !== "active") return false;
|
|
1693
1731
|
// Thread 5 (QPDE5): for procedures the hash is keyed on the full
|
|
@@ -1700,7 +1738,9 @@ export class ExtractionPersistCoordinator {
|
|
|
1700
1738
|
if (normalizeStoredHashSource(stripAttributesSuffix(m.content ?? "")) !==
|
|
1701
1739
|
ContentHashIndex.normalizeContent(contentHashDedupKey)) return false;
|
|
1702
1740
|
return (m.frontmatter.sourceConnector?.trim() || undefined) === nc;
|
|
1703
|
-
}
|
|
1741
|
+
};
|
|
1742
|
+
exactDuplicate =
|
|
1743
|
+
hotMems.some(matchesActiveDuplicate) || coldMems.some(matchesActiveDuplicate);
|
|
1704
1744
|
} catch (err) {
|
|
1705
1745
|
log.warn(
|
|
1706
1746
|
`connector-aware dedup scan failed for storage ${targetStorage.dir}; writing fail-open: ${err instanceof Error ? err.message : String(err)}`,
|
|
@@ -2158,34 +2198,39 @@ export class ExtractionPersistCoordinator {
|
|
|
2158
2198
|
? stripCitationForTemplate(fact.content, citationTemplate)
|
|
2159
2199
|
: fact.content;
|
|
2160
2200
|
const citedChunkedContent = applyInlineCitation(rawChunkedContent);
|
|
2161
|
-
const
|
|
2162
|
-
writeCategory,
|
|
2163
|
-
citedChunkedContent,
|
|
2201
|
+
const parentWriteEnvelope = composeSalvagedExtractionEnvelope(
|
|
2164
2202
|
{
|
|
2203
|
+
content: citedChunkedContent,
|
|
2204
|
+
category: writeCategory,
|
|
2165
2205
|
confidence: fact.confidence,
|
|
2166
|
-
tags:
|
|
2206
|
+
tags: withReservedMarkerTag(fact.tags, "chunked"),
|
|
2167
2207
|
entityRef: fact.entityRef,
|
|
2168
|
-
source: extractionWriteSource,
|
|
2169
|
-
...(extractionSourceConnector ? { sourceConnector: extractionSourceConnector } : {}),
|
|
2170
|
-
importance,
|
|
2171
|
-
supersedes,
|
|
2172
|
-
links: links.length > 0 ? links : undefined,
|
|
2173
|
-
intentGoal: inferredIntent?.goal,
|
|
2174
|
-
intentActionType: inferredIntent?.actionType,
|
|
2175
|
-
intentEntityTypes: inferredIntent?.entityTypes,
|
|
2176
|
-
memoryKind,
|
|
2177
2208
|
structuredAttributes: fact.structuredAttributes,
|
|
2178
2209
|
validAt: biTemporal ? biTemporal.validFrom : sourceContext?.validAt,
|
|
2179
|
-
...(
|
|
2180
|
-
contentHashSource: rawChunkedContent,
|
|
2181
|
-
// Faithfulness gate (issue #1576).
|
|
2182
|
-
...(faithfulnessFm ? { faithfulness: faithfulnessFm } : {}),
|
|
2183
|
-
...(faithfulnessEnforceStatus ? { status: faithfulnessEnforceStatus } : {}),
|
|
2184
|
-
// Claim-level provenance spans (issue #1575 PR 2).
|
|
2185
|
-
...(fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {}),
|
|
2186
|
-
...(fact.provenance ? { provenance: fact.provenance } : {}),
|
|
2210
|
+
...(extractionSourceConnector ? { sourceConnector: extractionSourceConnector } : {}),
|
|
2187
2211
|
},
|
|
2188
|
-
|
|
2212
|
+
{ source: extractionWriteSource },
|
|
2213
|
+
);
|
|
2214
|
+
const parentWrite = await targetStorage.writeSealedMemory(parentWriteEnvelope, {
|
|
2215
|
+
importance,
|
|
2216
|
+
supersedes,
|
|
2217
|
+
links: links.length > 0 ? links : undefined,
|
|
2218
|
+
intentGoal: inferredIntent?.goal,
|
|
2219
|
+
intentActionType: inferredIntent?.actionType,
|
|
2220
|
+
intentEntityTypes: inferredIntent?.entityTypes,
|
|
2221
|
+
memoryKind,
|
|
2222
|
+
...(biTemporal ? { observedAt: biTemporal.observedAt, eventTimeSource: biTemporal.eventTimeSource, ...(biTemporal.validUntil ? { invalidAt: biTemporal.validUntil } : {}) } : {}),
|
|
2223
|
+
contentHashSource: rawChunkedContent,
|
|
2224
|
+
// Faithfulness gate (issue #1576).
|
|
2225
|
+
...(faithfulnessFm ? { faithfulness: faithfulnessFm } : {}),
|
|
2226
|
+
...(faithfulnessEnforceStatus ? { status: faithfulnessEnforceStatus } : {}),
|
|
2227
|
+
// Claim-level provenance spans (issue #1575 PR 2).
|
|
2228
|
+
...(fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {}),
|
|
2229
|
+
...(fact.provenance ? { provenance: fact.provenance } : {}),
|
|
2230
|
+
// PR #2016: never defer here — fallible chunk/artifact writes follow this
|
|
2231
|
+
// durable parent .md; flush the hash now so a throw can't strand it (dup).
|
|
2232
|
+
deferHashIndexSave: false,
|
|
2233
|
+
});
|
|
2189
2234
|
const parentId = parentWrite.id;
|
|
2190
2235
|
// #1645: surface the tombstone block and gate active post-write paths
|
|
2191
2236
|
// (chunks, supersession, shared promotion, graph/artifact) like #1576.
|
|
@@ -2201,13 +2246,18 @@ export class ExtractionPersistCoordinator {
|
|
|
2201
2246
|
postWriteGuard,
|
|
2202
2247
|
);
|
|
2203
2248
|
try {
|
|
2249
|
+
// #2014 round 3: chunks inherit the PARENT ENVELOPE's surviving
|
|
2250
|
+
// tags (minus the parent-only "chunked" marker) and entityRef —
|
|
2251
|
+
// passing raw fact.tags let chunk frontmatter disagree with the
|
|
2252
|
+
// sealed parent and retain tags past the per-memory limits.
|
|
2253
|
+
const chunkTags = parentWriteEnvelope.tags.filter((tag) => tag !== "chunked");
|
|
2204
2254
|
// Write individual chunks with parent reference
|
|
2205
2255
|
for (const chunk of chunkResult.chunks) {
|
|
2206
2256
|
// Score each chunk's importance separately
|
|
2207
2257
|
const chunkImportance = scoreImportance(
|
|
2208
2258
|
chunk.content,
|
|
2209
2259
|
writeCategory,
|
|
2210
|
-
|
|
2260
|
+
chunkTags,
|
|
2211
2261
|
);
|
|
2212
2262
|
const chunkWriteSource =
|
|
2213
2263
|
(fact as any).source === "proactive"
|
|
@@ -2223,9 +2273,11 @@ export class ExtractionPersistCoordinator {
|
|
|
2223
2273
|
// survives when a single chunk is quoted in isolation.
|
|
2224
2274
|
applyInlineCitation(chunk.content),
|
|
2225
2275
|
{
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2276
|
+
// #2014 round 4: sealed parent's confidence — raw
|
|
2277
|
+
// fact.confidence would let parent and chunk disagree.
|
|
2278
|
+
confidence: parentWriteEnvelope.confidence,
|
|
2279
|
+
tags: [...chunkTags],
|
|
2280
|
+
entityRef: parentWriteEnvelope.entityRef,
|
|
2229
2281
|
source: chunkWriteSource,
|
|
2230
2282
|
importance: chunkImportance,
|
|
2231
2283
|
intentGoal: inferredIntent?.goal,
|
|
@@ -2282,6 +2334,7 @@ export class ExtractionPersistCoordinator {
|
|
|
2282
2334
|
);
|
|
2283
2335
|
trackPersistedId(targetStorage, parentId, {
|
|
2284
2336
|
pendingReview: postWriteGuard,
|
|
2337
|
+
category: writeCategory,
|
|
2285
2338
|
});
|
|
2286
2339
|
// #1576 (cursor Medium): keep pending_review ids out of threadEpisodeIdsForGraph — else later active facts build thread-predecessor edges to an unfaithful memory.
|
|
2287
2340
|
if (
|
|
@@ -2304,15 +2357,15 @@ export class ExtractionPersistCoordinator {
|
|
|
2304
2357
|
// must NOT retire older active memories.
|
|
2305
2358
|
if (!postWriteGuard) {
|
|
2306
2359
|
try {
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
? ((fact as any).entityRef as string)
|
|
2310
|
-
: undefined;
|
|
2360
|
+
// #2014 round 2: same envelope-surviving key rule as the
|
|
2361
|
+
// non-chunked path.
|
|
2311
2362
|
await applyTemporalSupersession({
|
|
2312
2363
|
storage: targetStorage,
|
|
2313
2364
|
newMemoryId: parentId,
|
|
2314
|
-
entityRef:
|
|
2315
|
-
structuredAttributes:
|
|
2365
|
+
entityRef: parentWriteEnvelope.entityRef,
|
|
2366
|
+
structuredAttributes: parentWriteEnvelope.rawStructuredAttributes
|
|
2367
|
+
? { ...parentWriteEnvelope.rawStructuredAttributes }
|
|
2368
|
+
: undefined,
|
|
2316
2369
|
createdAt: supersessionOrderingAt(biTemporal?.validFrom ?? sourceContext?.validAt),
|
|
2317
2370
|
// #1578 r3: an extracted end-only bound (validFrom absent) is
|
|
2318
2371
|
// historical, not a new authoritative state — never let it
|
|
@@ -2412,10 +2465,9 @@ export class ExtractionPersistCoordinator {
|
|
|
2412
2465
|
if (graphCaps.multiGraphMemory && !postWriteGuard) {
|
|
2413
2466
|
try {
|
|
2414
2467
|
const graphContext = await ensureGraphContext(targetStorage);
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
: undefined;
|
|
2468
|
+
// #2014 round 4: graph identity must match the PERSISTED
|
|
2469
|
+
// memory — the envelope's surviving entityRef.
|
|
2470
|
+
const entityRef = parentWriteEnvelope.entityRef;
|
|
2419
2471
|
const parentRelPath = resolvePersistedMemoryRelativePath({
|
|
2420
2472
|
memoryId: parentId,
|
|
2421
2473
|
pathById: graphContext.memoryPathById,
|
|
@@ -2511,39 +2563,44 @@ export class ExtractionPersistCoordinator {
|
|
|
2511
2563
|
? buildProcedurePersistBody(fact.content, fact.procedureSteps)
|
|
2512
2564
|
: fact.content;
|
|
2513
2565
|
const citedFactContent = applyInlineCitation(rawPersistBody);
|
|
2514
|
-
const
|
|
2515
|
-
writeCategory,
|
|
2516
|
-
citedFactContent,
|
|
2566
|
+
const factWriteEnvelope = composeSalvagedExtractionEnvelope(
|
|
2517
2567
|
{
|
|
2568
|
+
content: citedFactContent,
|
|
2569
|
+
category: writeCategory,
|
|
2518
2570
|
confidence: fact.confidence,
|
|
2519
2571
|
tags: fact.tags,
|
|
2520
2572
|
entityRef:
|
|
2521
2573
|
typeof (fact as any).entityRef === "string"
|
|
2522
2574
|
? (fact as any).entityRef
|
|
2523
2575
|
: undefined,
|
|
2524
|
-
source: extractionWriteSource,
|
|
2525
|
-
...(extractionSourceConnector ? { sourceConnector: extractionSourceConnector } : {}),
|
|
2526
|
-
importance,
|
|
2527
|
-
supersedes,
|
|
2528
|
-
links: links.length > 0 ? links : undefined,
|
|
2529
|
-
intentGoal: inferredIntent?.goal,
|
|
2530
|
-
intentActionType: inferredIntent?.actionType,
|
|
2531
|
-
intentEntityTypes: inferredIntent?.entityTypes,
|
|
2532
|
-
memoryKind,
|
|
2533
2576
|
structuredAttributes: fact.structuredAttributes,
|
|
2534
2577
|
validAt: biTemporal ? biTemporal.validFrom : sourceContext?.validAt,
|
|
2535
|
-
...(
|
|
2536
|
-
contentHashSource: writeCategory === "fact" ? fact.content : undefined,
|
|
2537
|
-
// Faithfulness gate (issue #1576).
|
|
2538
|
-
...(faithfulnessFm ? { faithfulness: faithfulnessFm } : {}),
|
|
2539
|
-
...(faithfulnessEnforceStatus ? { status: faithfulnessEnforceStatus } : {}),
|
|
2540
|
-
// Claim-level provenance spans (issue #1575 PR 2). Carry verified
|
|
2541
|
-
// sources + the coarse strength tag from the extraction validator
|
|
2542
|
-
// through to frontmatter so they survive end-to-end.
|
|
2543
|
-
...(fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {}),
|
|
2544
|
-
...(fact.provenance ? { provenance: fact.provenance } : {}),
|
|
2578
|
+
...(extractionSourceConnector ? { sourceConnector: extractionSourceConnector } : {}),
|
|
2545
2579
|
},
|
|
2546
|
-
|
|
2580
|
+
{ source: extractionWriteSource },
|
|
2581
|
+
);
|
|
2582
|
+
const factWrite = await targetStorage.writeSealedMemory(factWriteEnvelope, {
|
|
2583
|
+
importance,
|
|
2584
|
+
supersedes,
|
|
2585
|
+
links: links.length > 0 ? links : undefined,
|
|
2586
|
+
intentGoal: inferredIntent?.goal,
|
|
2587
|
+
intentActionType: inferredIntent?.actionType,
|
|
2588
|
+
intentEntityTypes: inferredIntent?.entityTypes,
|
|
2589
|
+
memoryKind,
|
|
2590
|
+
...(biTemporal ? { observedAt: biTemporal.observedAt, eventTimeSource: biTemporal.eventTimeSource, ...(biTemporal.validUntil ? { invalidAt: biTemporal.validUntil } : {}) } : {}),
|
|
2591
|
+
contentHashSource: writeCategory === "fact" ? fact.content : undefined,
|
|
2592
|
+
// Faithfulness gate (issue #1576).
|
|
2593
|
+
...(faithfulnessFm ? { faithfulness: faithfulnessFm } : {}),
|
|
2594
|
+
...(faithfulnessEnforceStatus ? { status: faithfulnessEnforceStatus } : {}),
|
|
2595
|
+
// Claim-level provenance spans (issue #1575 PR 2). Carry verified
|
|
2596
|
+
// sources + the coarse strength tag from the extraction validator
|
|
2597
|
+
// through to frontmatter so they survive end-to-end.
|
|
2598
|
+
...(fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {}),
|
|
2599
|
+
...(fact.provenance ? { provenance: fact.provenance } : {}),
|
|
2600
|
+
// #1909: defer the per-fact index flush to the batch save only when
|
|
2601
|
+
// fact dedup is on (the batch saver is a no-op otherwise).
|
|
2602
|
+
deferHashIndexSave: factDedupEnabled,
|
|
2603
|
+
});
|
|
2547
2604
|
const memoryId = factWrite.id;
|
|
2548
2605
|
// #1645: surface the tombstone block; gate active post-write paths like #1576
|
|
2549
2606
|
// so a blocked fact creates no active shared copy / supersession / graph entry.
|
|
@@ -2552,12 +2609,12 @@ export class ExtractionPersistCoordinator {
|
|
|
2552
2609
|
faithfulnessEnforceStatus === "pending_review" || tombstoneBlocked;
|
|
2553
2610
|
// #1645: defer contradiction auto-resolve until tombstone status is
|
|
2554
2611
|
// known (see applyDeferredContradictionResolve).
|
|
2555
|
-
|
|
2556
|
-
contradiction,
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2612
|
+
try {
|
|
2613
|
+
await this.deps.applyDeferredContradictionResolve(contradiction, targetStorage, memoryId, postWriteGuard);
|
|
2614
|
+
} catch (err) {
|
|
2615
|
+
await flushDeferredFactHashOnFailure(() => this.deps.saveContentHashIndexes(), factDedupEnabled);
|
|
2616
|
+
throw err;
|
|
2617
|
+
}
|
|
2561
2618
|
if (routedRuleId) {
|
|
2562
2619
|
log.debug(
|
|
2563
2620
|
`routing applied for memory ${memoryId}: rule=${routedRuleId} category=${writeCategory} storage=${targetStorage.dir}`,
|
|
@@ -2570,15 +2627,16 @@ export class ExtractionPersistCoordinator {
|
|
|
2570
2627
|
// the review queue must NOT retire older active memories.
|
|
2571
2628
|
if (!postWriteGuard) {
|
|
2572
2629
|
try {
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
: undefined;
|
|
2630
|
+
// #2014 round 2: key supersession on the envelope's SURVIVING
|
|
2631
|
+
// fields — salvage may have dropped attributes that must not
|
|
2632
|
+
// retire older facts the persisted copy does not actually contest.
|
|
2577
2633
|
await applyTemporalSupersession({
|
|
2578
2634
|
storage: targetStorage,
|
|
2579
2635
|
newMemoryId: memoryId,
|
|
2580
|
-
entityRef:
|
|
2581
|
-
structuredAttributes:
|
|
2636
|
+
entityRef: factWriteEnvelope.entityRef,
|
|
2637
|
+
structuredAttributes: factWriteEnvelope.rawStructuredAttributes
|
|
2638
|
+
? { ...factWriteEnvelope.rawStructuredAttributes }
|
|
2639
|
+
: undefined,
|
|
2582
2640
|
createdAt: supersessionOrderingAt(biTemporal?.validFrom ?? sourceContext?.validAt),
|
|
2583
2641
|
enabled: lifecycleCaps.temporalSupersession &&
|
|
2584
2642
|
!(biTemporal && !biTemporal.validFrom),
|
|
@@ -2601,6 +2659,7 @@ export class ExtractionPersistCoordinator {
|
|
|
2601
2659
|
);
|
|
2602
2660
|
trackPersistedId(targetStorage, memoryId, {
|
|
2603
2661
|
pendingReview: postWriteGuard,
|
|
2662
|
+
category: writeCategory,
|
|
2604
2663
|
});
|
|
2605
2664
|
if (
|
|
2606
2665
|
!postWriteGuard &&
|
|
@@ -2652,10 +2711,8 @@ export class ExtractionPersistCoordinator {
|
|
|
2652
2711
|
if (graphCaps.multiGraphMemory && !postWriteGuard) {
|
|
2653
2712
|
try {
|
|
2654
2713
|
const graphContext = await ensureGraphContext(targetStorage);
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
? (fact as any).entityRef
|
|
2658
|
-
: undefined;
|
|
2714
|
+
// #2014 round 4: envelope-surviving entityRef (see chunked path).
|
|
2715
|
+
const entityRef = factWriteEnvelope.entityRef;
|
|
2659
2716
|
const memoryRelPath = resolvePersistedMemoryRelativePath({
|
|
2660
2717
|
memoryId,
|
|
2661
2718
|
pathById: graphContext.memoryPathById,
|
|
@@ -2731,6 +2788,11 @@ export class ExtractionPersistCoordinator {
|
|
|
2731
2788
|
`content-hash dedup registration failed for memory ${memoryId}: ${err}`,
|
|
2732
2789
|
);
|
|
2733
2790
|
}
|
|
2791
|
+
} catch (err) {
|
|
2792
|
+
// PR #2016: flush the deferred fact-hash before propagating so a durable
|
|
2793
|
+
// .md never outlives a missing shared fact-hash index entry.
|
|
2794
|
+
await flushDeferredFactHashOnFailure(() => this.deps.saveContentHashIndexes(), factDedupEnabled);
|
|
2795
|
+
throw err;
|
|
2734
2796
|
} finally {
|
|
2735
2797
|
// Catalog touch (issue #1499): record AFTER every synchronous
|
|
2736
2798
|
// source-namespace mutation in the non-chunked path: writeMemory,
|
|
@@ -2883,10 +2945,15 @@ export class ExtractionPersistCoordinator {
|
|
|
2883
2945
|
touchBaseNonFactNamespace();
|
|
2884
2946
|
}
|
|
2885
2947
|
|
|
2886
|
-
// Save any content-hash indexes touched during the batch
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2948
|
+
// Save any content-hash indexes touched during the batch via the removal-
|
|
2949
|
+
// aware, lock-held reconciling save (issue #1909). Round 11: the fact-hash
|
|
2950
|
+
// index is rebuilt from the corpus on every restart (no ready marker), so
|
|
2951
|
+
// this on-disk write is the in-process persisted view — never a cross-restart
|
|
2952
|
+
// trust anchor. A deferred write whose addContentHashDedup threw is still
|
|
2953
|
+
// safe: the fact .md is durable and the next restart's rebuild includes it.
|
|
2954
|
+
await this.deps.saveContentHashIndexes().catch((err) => {
|
|
2955
|
+
log.warn(`content-hash index save failed: ${err}`);
|
|
2956
|
+
});
|
|
2890
2957
|
|
|
2891
2958
|
for (const {
|
|
2892
2959
|
storage: targetStorage,
|
|
@@ -2911,7 +2978,6 @@ export class ExtractionPersistCoordinator {
|
|
|
2911
2978
|
log.info(
|
|
2912
2979
|
`persisted: ${facts.length - dedupedCount - importanceGatedCount - judgeGatedCount - redactionGatedCount} facts${dedupSuffix}${gatedSuffix}${judgeSuffix}${redactionSuffix}, ${entities.length} entities, ${questions.length} questions, ${profileUpdates.length} profile updates`,
|
|
2913
2980
|
);
|
|
2914
|
-
|
|
2915
2981
|
// Update temporal + tag indexes (v8.1) — fire-and-forget, fail-open
|
|
2916
2982
|
void (async () => {
|
|
2917
2983
|
if (persistedIdsByStorage.size === 0) {
|
|
@@ -2924,10 +2990,9 @@ export class ExtractionPersistCoordinator {
|
|
|
2924
2990
|
})().catch((err) =>
|
|
2925
2991
|
log.debug(`temporal-index update error (non-fatal): ${err}`),
|
|
2926
2992
|
);
|
|
2927
|
-
|
|
2928
2993
|
// #1635: surface pending_review ids so the thread episode set excludes them.
|
|
2929
2994
|
this.deps.setLastPersistExtractionPendingReviewIds(pendingReviewPersistedIds);
|
|
2930
2995
|
// Return the persisted fact IDs for threading
|
|
2931
|
-
return persistedIds;
|
|
2996
|
+
return { persistedIds, memoryPathById };
|
|
2932
2997
|
}
|
|
2933
2998
|
}
|