@remnic/core 10.0.12 → 10.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-admin-ops-surface.js +97 -95
- package/dist/access-authorization-probe.js +98 -96
- package/dist/access-boundary.js +97 -95
- package/dist/access-cli.js +201 -198
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush.js +97 -95
- package/dist/access-http-briefing.js +98 -96
- package/dist/access-http-query.js +99 -97
- package/dist/access-http.js +121 -119
- package/dist/access-idempotency.js +3 -2
- package/dist/access-identity-continuity-surface.js +97 -95
- package/dist/access-lcm-surface.js +97 -95
- package/dist/access-mcp.js +110 -108
- package/dist/access-memory-search-fanout.js +3 -3
- package/dist/access-namespace-preflight.js +97 -95
- package/dist/access-observe-write-category.js +18 -18
- package/dist/access-observe-write-surface.js +97 -95
- package/dist/access-offline-manifest.js +21 -20
- package/dist/access-operations-batch.js +101 -99
- package/dist/access-operations.js +108 -106
- package/dist/access-recall-concurrency.js +97 -95
- package/dist/access-recall-diagnostics.js +5 -5
- package/dist/access-recall-response.js +97 -95
- package/dist/access-recall-surface.js +97 -95
- package/dist/access-schema.d.ts +2 -2
- package/dist/access-schema.js +12 -12
- package/dist/access-service.js +97 -95
- package/dist/access-surface-catalog.js +99 -97
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/active-memory-bridge.js +3 -3
- package/dist/active-recall.js +42 -40
- 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-WSJAOLOP.js → auto-sync-7WWAKW6F.js} +12 -12
- package/dist/briefing.js +31 -29
- package/dist/buffer.js +17 -17
- package/dist/calibration.d.ts +20 -0
- package/dist/calibration.d.ts.map +1 -1
- package/dist/calibration.js +60 -13
- package/dist/calibration.js.map +1 -1
- package/dist/capabilities.d.ts +3 -2
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +1 -1
- package/dist/{capsule-merge-M4HETD27.js → capsule-merge-LGYURS3C.js} +6 -5
- package/dist/{capsule-merge-M4HETD27.js.map → capsule-merge-LGYURS3C.js.map} +1 -1
- package/dist/capture-write-lock-backoff.d.ts +50 -0
- package/dist/capture-write-lock-backoff.d.ts.map +1 -0
- package/dist/capture-write-lock-backoff.js +30 -0
- package/dist/capture-write-lock.d.ts +6 -0
- package/dist/capture-write-lock.d.ts.map +1 -0
- package/dist/capture-write-lock.js +15 -0
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.js +34 -32
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.js +7 -6
- package/dist/causal-trajectory-graph.js.map +1 -1
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-RNPJ4GQA.js → chunk-22W2XWGH.js} +6 -6
- package/dist/{chunk-AV2OQF2O.js → chunk-3F3HA3R2.js} +2 -2
- package/dist/{chunk-QZZPUREO.js → chunk-3GYSZHMT.js} +3 -3
- package/dist/{chunk-QWWMS4AE.js → chunk-3MO4LWYU.js} +1 -1
- package/dist/chunk-3MO4LWYU.js.map +1 -0
- package/dist/{chunk-XYOT5GQU.js → chunk-3NF4QUNZ.js} +3 -3
- package/dist/{chunk-AL6EHLB5.js → chunk-3X3PNU3T.js} +2 -2
- package/dist/{chunk-BTJ6CAIA.js → chunk-4IYIGN53.js} +10 -10
- package/dist/{chunk-OM3RWZQK.js → chunk-4KY5GSMB.js} +2 -2
- package/dist/{chunk-4N2MFNTG.js → chunk-4OSG5Y6M.js} +2 -2
- package/dist/{chunk-EEDI3OXB.js → chunk-4Q26RNSR.js} +2 -2
- package/dist/{chunk-EHRE7ZG3.js → chunk-5B5WYAHQ.js} +2 -2
- package/dist/{chunk-WCGJK4NQ.js → chunk-5FNZ3G6X.js} +10 -10
- package/dist/{chunk-Y6DZ33PA.js → chunk-5GX5457J.js} +4 -4
- package/dist/{chunk-OFCHT2TN.js → chunk-5LRV557D.js} +2 -2
- package/dist/{chunk-VAOC6GHN.js → chunk-5PHOU5QI.js} +2 -2
- package/dist/{chunk-WL7N5VGG.js → chunk-5TJEOU6Y.js} +2 -2
- package/dist/{chunk-A2L3P2IY.js → chunk-5WCJLQTM.js} +2 -2
- package/dist/{chunk-MZBWIJJN.js → chunk-63B2IZYE.js} +19 -19
- package/dist/{chunk-DGRMWDQY.js → chunk-66BCOVW2.js} +7 -7
- package/dist/chunk-6EDW54SQ.js +298 -0
- package/dist/chunk-6EDW54SQ.js.map +1 -0
- package/dist/{chunk-P2S6P7X6.js → chunk-6LG7BWKW.js} +2 -2
- package/dist/chunk-77R7BQZ2.js +152 -0
- package/dist/chunk-77R7BQZ2.js.map +1 -0
- package/dist/{chunk-4G2YCKLT.js → chunk-7G5NTS7F.js} +2 -2
- package/dist/{chunk-IPLYGWQF.js → chunk-7LCGFUMB.js} +6 -6
- package/dist/{chunk-KYY4EACB.js → chunk-7Z3DLNSD.js} +2 -2
- package/dist/{chunk-LNH76ZJX.js → chunk-AIYXVWUH.js} +27 -2
- package/dist/{chunk-LNH76ZJX.js.map → chunk-AIYXVWUH.js.map} +1 -1
- package/dist/{chunk-7SUWY37K.js → chunk-B665A6BO.js} +2 -2
- package/dist/{chunk-AEGNDL24.js → chunk-BVRZSI7Q.js} +2 -2
- package/dist/{chunk-2EMROIXS.js → chunk-C5LWPYS3.js} +2 -1
- package/dist/{chunk-2EMROIXS.js.map → chunk-C5LWPYS3.js.map} +1 -1
- package/dist/{chunk-KJOGIRMF.js → chunk-CB6ANA2I.js} +2 -2
- package/dist/{chunk-5JMI26Q7.js → chunk-CBH2Z4UA.js} +2 -2
- package/dist/{chunk-YRH3C2OJ.js → chunk-CIIHIAJ2.js} +13 -5
- package/dist/chunk-CIIHIAJ2.js.map +1 -0
- package/dist/{chunk-W4RLOZOG.js → chunk-CJRENHVZ.js} +4 -4
- package/dist/{chunk-LOFVW6JA.js → chunk-CLWBFR7Q.js} +6 -6
- package/dist/{chunk-375ARKRS.js → chunk-D5SSBCYY.js} +70 -59
- package/dist/chunk-D5SSBCYY.js.map +1 -0
- package/dist/{chunk-KI6UOSNR.js → chunk-DEY7B77Y.js} +2 -2
- package/dist/chunk-DEY7B77Y.js.map +1 -0
- package/dist/{chunk-6VAHJ2F6.js → chunk-DMDWFQMR.js} +2 -2
- package/dist/{chunk-MO25AN7J.js → chunk-DPR2WTN3.js} +22 -22
- package/dist/{chunk-JXSYWTFK.js → chunk-DYJHGJZ4.js} +2 -2
- package/dist/{chunk-5X4ZJESN.js → chunk-EH4BQ7LT.js} +3 -3
- package/dist/chunk-EHHQJTAU.js +131 -0
- package/dist/chunk-EHHQJTAU.js.map +1 -0
- package/dist/{chunk-JXWTPOMJ.js → chunk-EPJDSQHF.js} +2 -2
- package/dist/{chunk-OEIA4IHU.js → chunk-ESG6ITGP.js} +2 -2
- package/dist/{chunk-7XI2UJHL.js → chunk-ETZUIRCI.js} +4 -4
- package/dist/{chunk-PPIASWWR.js → chunk-EU534WGS.js} +2 -2
- package/dist/{chunk-XLIK2VDE.js → chunk-EU6IRUCY.js} +7 -5
- package/dist/{chunk-XLIK2VDE.js.map → chunk-EU6IRUCY.js.map} +1 -1
- package/dist/{chunk-J7MDPTX7.js → chunk-EUAIYYYR.js} +190 -44
- package/dist/chunk-EUAIYYYR.js.map +1 -0
- package/dist/{chunk-E6KXJSMA.js → chunk-EUCYTCFP.js} +3 -3
- package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
- package/dist/{chunk-6OAXWYE3.js → chunk-FFOVKNQV.js} +2 -2
- package/dist/{chunk-2KRNPFPK.js → chunk-FLI6DEIU.js} +2 -2
- package/dist/{chunk-4G4B3Z2B.js → chunk-FP4JYE66.js} +2 -2
- package/dist/{chunk-PDVWGGX4.js → chunk-FSIMZNBC.js} +2 -2
- package/dist/{chunk-OAIWPB2I.js → chunk-FT4UQYOV.js} +2 -2
- package/dist/{chunk-D5UPBXZM.js → chunk-FUFAXVBA.js} +4 -4
- package/dist/{chunk-GKOML66M.js → chunk-G2OYFTUD.js} +5 -5
- package/dist/{chunk-XTN54NML.js → chunk-G3T6YMBO.js} +4 -4
- package/dist/{chunk-KWVI52ER.js → chunk-GELS5Z5Z.js} +4 -4
- package/dist/{chunk-J6FFBORM.js → chunk-GH7AOMJD.js} +2 -2
- package/dist/{chunk-TCYLCPC6.js → chunk-GKJJNO7C.js} +3 -3
- package/dist/{chunk-N75Q5ZSP.js → chunk-GMXWTJNU.js} +2 -2
- package/dist/{chunk-B657ZGDH.js → chunk-HQSK2INQ.js} +2 -2
- package/dist/{chunk-SQA2MM2F.js → chunk-I7S55EOB.js} +2 -2
- package/dist/{chunk-CAUNCRLQ.js → chunk-J7JWFZHI.js} +108 -108
- package/dist/{chunk-NQMG2W5L.js → chunk-JDZFIR2S.js} +2 -2
- package/dist/{chunk-O52WWLKU.js → chunk-JIHMUOOS.js} +5 -5
- package/dist/{chunk-YYO447A7.js → chunk-JNIVZNIB.js} +41 -253
- package/dist/chunk-JNIVZNIB.js.map +1 -0
- package/dist/{chunk-VUQDJ3JB.js → chunk-JPTPS4OB.js} +6 -6
- package/dist/{chunk-WXFKXCOQ.js → chunk-JQ7XU625.js} +10 -10
- package/dist/{chunk-3I3U6FFT.js → chunk-K7BN34IA.js} +2 -2
- package/dist/{chunk-7OAIOE5P.js → chunk-KH2LKDX7.js} +2 -2
- package/dist/{chunk-VDXTXVFZ.js → chunk-KR6ZKECI.js} +5 -5
- package/dist/{chunk-MK552I5J.js → chunk-L5DAHSEZ.js} +4 -4
- package/dist/{chunk-XQIHFXYP.js → chunk-LCKVXX5F.js} +2 -2
- package/dist/{chunk-ZI7LMSNI.js → chunk-LLHZZOIB.js} +2 -2
- package/dist/{chunk-E57LYSHI.js → chunk-LZACDIM2.js} +2 -2
- package/dist/{chunk-QAIKLICT.js → chunk-M7KGIW5F.js} +2 -2
- package/dist/{chunk-55ZVZBX4.js → chunk-MATDGSJ7.js} +4 -4
- package/dist/{chunk-3NFN4Y4P.js → chunk-MGCKZWAE.js} +5 -5
- package/dist/{chunk-YS7SA4HD.js → chunk-ML7ZJAKJ.js} +4 -4
- package/dist/{chunk-YDH2FSDI.js → chunk-N45NEBOD.js} +2 -2
- package/dist/{chunk-7UX44C4N.js → chunk-N4C7QKOG.js} +3 -3
- package/dist/{chunk-YYNHJF3N.js → chunk-N7KYEVLK.js} +2 -2
- package/dist/{chunk-HT2C4EXO.js → chunk-NIRQGDYC.js} +4 -4
- package/dist/{chunk-DXHVD4DS.js → chunk-NW2E4CI2.js} +3 -3
- package/dist/{chunk-BFIZXFUG.js → chunk-NWIT3U2N.js} +2 -2
- package/dist/{chunk-4NDWE44P.js → chunk-NZFFGO5O.js} +2 -2
- package/dist/{chunk-MB5EJ2CT.js → chunk-O2IPAX26.js} +10 -10
- package/dist/{chunk-UOA2VQ7C.js → chunk-O4SGYW7H.js} +2 -2
- package/dist/{chunk-SSAXGPXY.js → chunk-OP6N4H6A.js} +2 -2
- package/dist/{chunk-ZSJGYC3C.js → chunk-OQJKY3Z5.js} +2 -2
- package/dist/{chunk-OFEHITAZ.js → chunk-OXNTOHL6.js} +2 -2
- package/dist/{chunk-CDWFWOSZ.js → chunk-P4JED3ZL.js} +2 -2
- package/dist/{chunk-FQD2KPQH.js → chunk-P55FACBG.js} +2 -2
- package/dist/{chunk-KX36OCGK.js → chunk-P5NQN4JE.js} +3 -3
- package/dist/{chunk-3ZCRHW7U.js → chunk-P7TOIOT7.js} +2 -2
- package/dist/{chunk-BD5QEP3T.js → chunk-PAZ35RJ4.js} +45 -32
- package/dist/chunk-PAZ35RJ4.js.map +1 -0
- package/dist/chunk-PGRZ3FYC.js +34 -0
- package/dist/chunk-PGRZ3FYC.js.map +1 -0
- package/dist/{chunk-PBVNVKYN.js → chunk-PIN5OPBA.js} +2 -2
- package/dist/{chunk-O6YDGTH4.js → chunk-PZHQWFR3.js} +3 -3
- package/dist/{chunk-SVDU4OHO.js → chunk-Q35L7TYB.js} +2 -2
- package/dist/{chunk-SOJ3IQD3.js → chunk-QODKDRSP.js} +6 -6
- package/dist/{chunk-VJGDQA3D.js → chunk-QOZJCSFO.js} +3 -3
- package/dist/{chunk-6T42L5FI.js → chunk-QS3OLP5I.js} +2 -2
- package/dist/{chunk-PAAJWQH5.js → chunk-QUMKDRCF.js} +2 -2
- package/dist/{chunk-4TP3MJ3D.js → chunk-QX6JN3O4.js} +7 -7
- package/dist/{chunk-KZEMFD6E.js → chunk-R2H4ZFBJ.js} +3 -3
- package/dist/{chunk-N6UMXWBA.js → chunk-RTKV5XHL.js} +4 -4
- package/dist/{chunk-ZQ3WU6JO.js → chunk-RXFCU3CY.js} +2 -2
- package/dist/{chunk-BOOFTFFE.js → chunk-S2I7DL5Q.js} +1 -1
- package/dist/{chunk-2NCBDGND.js → chunk-SA6GMZJY.js} +3 -3
- package/dist/{chunk-2AFHZTPI.js → chunk-SIIRTDJ4.js} +3 -3
- package/dist/{chunk-WH4QXVKU.js → chunk-SS3IS2JR.js} +3 -3
- package/dist/{chunk-VFTK5WKI.js → chunk-STBX5X6B.js} +2 -2
- package/dist/{chunk-WVHRNAXL.js → chunk-SWWHIJUJ.js} +2 -2
- package/dist/{chunk-WADSXS4K.js → chunk-SX4QDWXK.js} +2 -2
- package/dist/{chunk-2U4BM3TW.js → chunk-TITG2NBS.js} +2 -2
- package/dist/{chunk-A5ZYP4K5.js → chunk-TNRCDMQT.js} +2 -2
- package/dist/{chunk-LZKOVXMX.js → chunk-TRMJ6BYC.js} +2 -2
- package/dist/{chunk-VA2HNBGQ.js → chunk-TZNDKTX5.js} +69 -69
- package/dist/{chunk-OFDIGTC2.js → chunk-UMTCNEVQ.js} +17 -17
- package/dist/{chunk-L3G5CGL5.js → chunk-UQDG3YLN.js} +68 -24
- package/dist/chunk-UQDG3YLN.js.map +1 -0
- package/dist/{chunk-AAM66QCP.js → chunk-UZRSI6NX.js} +2 -2
- package/dist/{chunk-2CXQZXWM.js → chunk-V4MB5ONM.js} +6 -6
- package/dist/{chunk-5BUCKFRE.js → chunk-VOKHZRHW.js} +2 -2
- package/dist/{chunk-CYEK6Z3P.js → chunk-VW6VIJOS.js} +2 -2
- package/dist/{chunk-I2M4ZVDD.js → chunk-W47S5TIH.js} +9 -9
- package/dist/{chunk-CBP4HWCL.js → chunk-W5MCEVUS.js} +3 -3
- package/dist/{chunk-E5H4TM4Y.js → chunk-WC3V7HHP.js} +3 -3
- package/dist/{chunk-WCTL3PVM.js → chunk-WLMZ2L5P.js} +2 -2
- package/dist/{chunk-SQ2O52SU.js → chunk-WSGPFRBH.js} +10 -10
- package/dist/{chunk-BH44JOLA.js → chunk-WVADKFWV.js} +3 -3
- package/dist/{chunk-JVNEXW6X.js → chunk-XISROV24.js} +2 -2
- package/dist/{chunk-FZVROZKC.js → chunk-XVZA6VXC.js} +4 -4
- package/dist/{chunk-56GJLXBA.js → chunk-Y4NKEXQT.js} +4 -4
- package/dist/{chunk-EKKAHJ4B.js → chunk-YE36AJL7.js} +4 -4
- package/dist/chunk-YET735EZ.js +99 -0
- package/dist/chunk-YET735EZ.js.map +1 -0
- package/dist/{chunk-OGWEWJRH.js → chunk-YFMBHQRG.js} +2 -2
- package/dist/{chunk-JLIGUFPF.js → chunk-YN2DQ2D6.js} +2 -2
- package/dist/{chunk-RBJQYMMT.js → chunk-YRULQW5J.js} +4 -4
- package/dist/{chunk-UCJINCZT.js → chunk-YUZRI3QU.js} +2 -2
- package/dist/{chunk-QUNDYIYZ.js → chunk-YYEOR4XN.js} +3 -3
- package/dist/{chunk-O5MW6CQL.js → chunk-ZJVMUBYF.js} +2 -2
- package/dist/{chunk-VBJD4RSJ.js → chunk-ZSH2NRDV.js} +2 -2
- package/dist/{chunk-BX4WDBTE.js → chunk-ZV65I6ME.js} +78 -78
- package/dist/cli.js +150 -148
- package/dist/coding/export-okf-codegraph.js +31 -29
- package/dist/coding/export-okf-codegraph.js.map +1 -1
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.d.ts +15 -11
- package/dist/compounding/engine.d.ts.map +1 -1
- package/dist/compounding/engine.js +34 -32
- package/dist/compounding/iso-week.d.ts +2 -0
- package/dist/compounding/iso-week.d.ts.map +1 -1
- package/dist/compounding/weekly-scheduler.d.ts +81 -0
- package/dist/compounding/weekly-scheduler.d.ts.map +1 -0
- package/dist/compounding/weekly-synthesis-queue.d.ts +9 -0
- package/dist/compounding/weekly-synthesis-queue.d.ts.map +1 -0
- package/dist/config.js +42 -40
- package/dist/connectors/codex-materialize-runner.js +31 -29
- package/dist/connectors/index.js +32 -30
- package/dist/console/trace.d.ts +5 -14
- package/dist/console/trace.d.ts.map +1 -1
- package/dist/consolidation-provenance-check.js +7 -6
- package/dist/consolidation-undo.js +5 -4
- package/dist/consolidation-undo.js.map +1 -1
- package/dist/contradiction/index.js +9 -8
- package/dist/{contradiction-scan-GGRTVB7C.js → contradiction-scan-P7KXB5R4.js} +3 -3
- package/dist/converge-config.d.ts +2 -0
- package/dist/converge-config.d.ts.map +1 -1
- package/dist/converge-config.js +7 -3
- package/dist/convergence-refresh.js +33 -31
- package/dist/corpus-watermark.js +33 -31
- package/dist/dashboard-runtime.js +2 -2
- package/dist/day-summary.js +2 -2
- package/dist/deep-recall-http-glue.js +13 -13
- package/dist/deep-recall.js +2 -2
- package/dist/embedding-fallback.js +6 -5
- package/dist/embedding-generation-lock.js +4 -3
- package/dist/entity-retrieval.js +32 -30
- package/dist/explicit-capture.js +12 -9
- package/dist/external-wiki-access.js +98 -96
- package/dist/extraction-judge.js +3 -3
- package/dist/extraction-normalization.js +3 -3
- package/dist/extraction-prompt.js +2 -2
- package/dist/extraction-quote-grounding.d.ts +67 -0
- package/dist/extraction-quote-grounding.d.ts.map +1 -0
- package/dist/extraction-quote-grounding.js +27 -0
- package/dist/extraction-quote-grounding.js.map +1 -0
- package/dist/extraction-source-grounding-helpers.d.ts +8 -0
- package/dist/extraction-source-grounding-helpers.d.ts.map +1 -1
- package/dist/extraction-source-grounding-helpers.js +11 -1
- package/dist/extraction-source-grounding-rules.d.ts +3 -1
- package/dist/extraction-source-grounding-rules.d.ts.map +1 -1
- package/dist/extraction-source-grounding-rules.js +3 -2
- package/dist/extraction-source-grounding.d.ts +1 -1
- package/dist/extraction-source-grounding.d.ts.map +1 -1
- package/dist/extraction-source-grounding.js +4 -3
- package/dist/extraction-span-materialize.js +2 -2
- package/dist/extraction.js +50 -47
- package/dist/{first-start-migration-OM3PHMZO.js → first-start-migration-6A5BJPDW.js} +5 -5
- package/dist/{forget-OHAJ6PSU.js → forget-GXBWFKRC.js} +5 -4
- package/dist/{forget-OHAJ6PSU.js.map → forget-GXBWFKRC.js.map} +1 -1
- package/dist/{graph-edge-decay-CZ3SYLM4.js → graph-edge-decay-BYPZVJT4.js} +10 -9
- package/dist/graph-edge-decay-BYPZVJT4.js.map +1 -0
- package/dist/graph-jsonl.js +8 -7
- package/dist/graph-snapshot.js +8 -7
- package/dist/graph-write-lock.js +4 -3
- package/dist/graph.js +9 -8
- package/dist/harmonic-retrieval.js +31 -29
- package/dist/http-retry.js +2 -1
- package/dist/http-retry.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +241 -236
- package/dist/lcm/engine.js +4 -4
- package/dist/lcm/index.js +12 -12
- package/dist/local-llm.js +2 -2
- package/dist/location/index.js +34 -32
- package/dist/maintenance/memory-governance.js +31 -29
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +31 -29
- package/dist/maintenance/rebuild-memory-projection-runner.js +33 -31
- package/dist/maintenance/rebuild-memory-projection.js +32 -30
- package/dist/memory-browse-operations.js +98 -96
- package/dist/memory-browse.js +7 -7
- package/dist/memory-subject.js +5 -4
- package/dist/namespaces/migrate.js +32 -30
- package/dist/namespaces/principal.js +2 -2
- package/dist/namespaces/search.js +10 -10
- package/dist/namespaces/storage.js +31 -29
- package/dist/offline-sync-changeset-generations.js +7 -6
- package/dist/offline-sync-embedding-generation.js +6 -5
- package/dist/offline-sync-impression-drain.js +8 -8
- package/dist/offline-sync-snapshot-stream.js +9 -9
- package/dist/offline-sync.js +10 -10
- package/dist/operator-doctor-corpus.js +34 -32
- package/dist/operator-toolkit.js +59 -57
- package/dist/orchestration/compression-guideline-coordinator.js +2 -2
- package/dist/orchestration/maintenance.d.ts +2 -0
- package/dist/orchestration/maintenance.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +49 -43
- package/dist/orchestrator.js +203 -200
- package/dist/page-versioning.js +5 -4
- package/dist/qmd-daemon-session.js +2 -2
- package/dist/qmd.js +4 -4
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-navigate-access.js +2 -2
- package/dist/recall-navigate-disclosure.js +2 -2
- package/dist/recall-navigate.js +2 -2
- package/dist/recall-navigation-operations.js +98 -96
- package/dist/recall-navigation.js +97 -95
- package/dist/recall-state-view-admission.js +7 -7
- package/dist/recall-state.js +4 -3
- package/dist/recall-why-service.js +11 -11
- package/dist/recall-why.js +3 -3
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/cursor.js +4 -2
- package/dist/reconcile/cursor.js.map +1 -1
- package/dist/reconcile/manifest.js +9 -6
- package/dist/reconcile/plan.js +4 -2
- package/dist/rerank-outcome.js +2 -2
- package/dist/{resolution-E4GLHLY6.js → resolution-7AY36LGJ.js} +10 -9
- package/dist/resolution-7AY36LGJ.js.map +1 -0
- package/dist/resume-bundles.js +43 -41
- package/dist/salvage-envelope.js +7 -6
- package/dist/search/embed-helper.js +2 -2
- package/dist/search/factory.js +9 -9
- package/dist/search/index.js +15 -15
- package/dist/semantic-consolidation.js +36 -34
- package/dist/semantic-rule-promotion.js +31 -29
- package/dist/semantic-rule-verifier.js +31 -29
- package/dist/shared-context/manager.js +2 -2
- package/dist/source-agent-qualifier.js +43 -40
- package/dist/standup/build.js +31 -29
- package/dist/storage/content-hash-index.d.ts +10 -0
- package/dist/storage/content-hash-index.d.ts.map +1 -1
- package/dist/storage/tombstone-blocked-capture-index.d.ts +3 -0
- package/dist/storage/tombstone-blocked-capture-index.d.ts.map +1 -1
- package/dist/storage/tombstone-blocked-capture-mutation.d.ts +23 -3
- package/dist/storage/tombstone-blocked-capture-mutation.d.ts.map +1 -1
- package/dist/storage.d.ts +6 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +32 -30
- package/dist/subject-config.js +6 -5
- package/dist/summarizer.js +6 -6
- package/dist/summary-snapshot.js +4 -3
- package/dist/support-passport/index.js +100 -98
- package/dist/{tier-stats-M2FMMD2N.js → tier-stats-RQM76XYY.js} +2 -2
- package/dist/{trace-LXXCMZJA.js → trace-QBQVS5BC.js} +5 -21
- package/dist/trace-QBQVS5BC.js.map +1 -0
- package/dist/transfer/autodetect.js +1 -1
- package/dist/transfer/backup.js +1 -1
- package/dist/transfer/capsule-export.js +3 -3
- package/dist/transfer/capsule-import.js +7 -6
- package/dist/transfer/export-okf.js +31 -29
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/utils/serialize-mutations.js +3 -2
- package/dist/utils/sleep.d.ts +6 -0
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/verified-recall.js +31 -29
- package/dist/who-knows-cli.js +32 -30
- package/dist/who-knows.js +31 -29
- package/dist/write-envelope.js +6 -5
- package/package.json +22 -2
- package/src/calibration.test.ts +80 -1
- package/src/calibration.ts +77 -8
- package/src/capabilities.test.ts +1 -0
- package/src/capabilities.ts +4 -4
- package/src/capture-write-lock-backoff.test.ts +534 -0
- package/src/capture-write-lock-backoff.ts +140 -0
- package/src/capture-write-lock.ts +8 -0
- package/src/compounding/engine.ts +32 -31
- package/src/compounding/iso-week.ts +16 -0
- package/src/compounding/weekly-scheduler.test.ts +426 -0
- package/src/compounding/weekly-scheduler.ts +231 -0
- package/src/compounding/weekly-synthesis-queue.ts +23 -0
- package/src/console/trace.ts +5 -36
- package/src/converge-config.ts +80 -1
- package/src/extraction-quote-grounding.test.ts +546 -0
- package/src/extraction-quote-grounding.ts +232 -0
- package/src/extraction-source-grounding-helpers.ts +35 -0
- package/src/extraction-source-grounding-rules.ts +90 -65
- package/src/extraction-source-grounding.ts +11 -2
- package/src/index.ts +1 -1
- package/src/orchestration/maintenance.ts +6 -2
- package/src/providers/codex-subscription.test.ts +15 -3
- package/src/storage/content-hash-index.ts +10 -0
- package/src/storage/tombstone-blocked-capture-index.ts +8 -1
- package/src/storage/tombstone-blocked-capture-mutation.ts +133 -43
- package/src/storage.ts +13 -0
- package/src/types.ts +9 -0
- package/src/utils/sleep.ts +28 -0
- package/dist/chunk-375ARKRS.js.map +0 -1
- package/dist/chunk-6MINUTGJ.js +0 -64
- package/dist/chunk-6MINUTGJ.js.map +0 -1
- package/dist/chunk-7LEQREP2.js +0 -9
- package/dist/chunk-7LEQREP2.js.map +0 -1
- package/dist/chunk-BD5QEP3T.js.map +0 -1
- package/dist/chunk-J7MDPTX7.js.map +0 -1
- package/dist/chunk-KI6UOSNR.js.map +0 -1
- package/dist/chunk-L3G5CGL5.js.map +0 -1
- package/dist/chunk-QWWMS4AE.js.map +0 -1
- package/dist/chunk-YRH3C2OJ.js.map +0 -1
- package/dist/chunk-YYO447A7.js.map +0 -1
- package/dist/trace-LXXCMZJA.js.map +0 -1
- /package/dist/{auto-sync-WSJAOLOP.js.map → auto-sync-7WWAKW6F.js.map} +0 -0
- /package/dist/{contradiction-scan-GGRTVB7C.js.map → capture-write-lock-backoff.js.map} +0 -0
- /package/dist/{graph-edge-decay-CZ3SYLM4.js.map → capture-write-lock.js.map} +0 -0
- /package/dist/{chunk-RNPJ4GQA.js.map → chunk-22W2XWGH.js.map} +0 -0
- /package/dist/{chunk-AV2OQF2O.js.map → chunk-3F3HA3R2.js.map} +0 -0
- /package/dist/{chunk-QZZPUREO.js.map → chunk-3GYSZHMT.js.map} +0 -0
- /package/dist/{chunk-XYOT5GQU.js.map → chunk-3NF4QUNZ.js.map} +0 -0
- /package/dist/{chunk-AL6EHLB5.js.map → chunk-3X3PNU3T.js.map} +0 -0
- /package/dist/{chunk-BTJ6CAIA.js.map → chunk-4IYIGN53.js.map} +0 -0
- /package/dist/{chunk-OM3RWZQK.js.map → chunk-4KY5GSMB.js.map} +0 -0
- /package/dist/{chunk-4N2MFNTG.js.map → chunk-4OSG5Y6M.js.map} +0 -0
- /package/dist/{chunk-EEDI3OXB.js.map → chunk-4Q26RNSR.js.map} +0 -0
- /package/dist/{chunk-EHRE7ZG3.js.map → chunk-5B5WYAHQ.js.map} +0 -0
- /package/dist/{chunk-WCGJK4NQ.js.map → chunk-5FNZ3G6X.js.map} +0 -0
- /package/dist/{chunk-Y6DZ33PA.js.map → chunk-5GX5457J.js.map} +0 -0
- /package/dist/{chunk-OFCHT2TN.js.map → chunk-5LRV557D.js.map} +0 -0
- /package/dist/{chunk-VAOC6GHN.js.map → chunk-5PHOU5QI.js.map} +0 -0
- /package/dist/{chunk-WL7N5VGG.js.map → chunk-5TJEOU6Y.js.map} +0 -0
- /package/dist/{chunk-A2L3P2IY.js.map → chunk-5WCJLQTM.js.map} +0 -0
- /package/dist/{chunk-MZBWIJJN.js.map → chunk-63B2IZYE.js.map} +0 -0
- /package/dist/{chunk-DGRMWDQY.js.map → chunk-66BCOVW2.js.map} +0 -0
- /package/dist/{chunk-P2S6P7X6.js.map → chunk-6LG7BWKW.js.map} +0 -0
- /package/dist/{chunk-4G2YCKLT.js.map → chunk-7G5NTS7F.js.map} +0 -0
- /package/dist/{chunk-IPLYGWQF.js.map → chunk-7LCGFUMB.js.map} +0 -0
- /package/dist/{chunk-KYY4EACB.js.map → chunk-7Z3DLNSD.js.map} +0 -0
- /package/dist/{chunk-7SUWY37K.js.map → chunk-B665A6BO.js.map} +0 -0
- /package/dist/{chunk-AEGNDL24.js.map → chunk-BVRZSI7Q.js.map} +0 -0
- /package/dist/{chunk-KJOGIRMF.js.map → chunk-CB6ANA2I.js.map} +0 -0
- /package/dist/{chunk-5JMI26Q7.js.map → chunk-CBH2Z4UA.js.map} +0 -0
- /package/dist/{chunk-W4RLOZOG.js.map → chunk-CJRENHVZ.js.map} +0 -0
- /package/dist/{chunk-LOFVW6JA.js.map → chunk-CLWBFR7Q.js.map} +0 -0
- /package/dist/{chunk-6VAHJ2F6.js.map → chunk-DMDWFQMR.js.map} +0 -0
- /package/dist/{chunk-MO25AN7J.js.map → chunk-DPR2WTN3.js.map} +0 -0
- /package/dist/{chunk-JXSYWTFK.js.map → chunk-DYJHGJZ4.js.map} +0 -0
- /package/dist/{chunk-5X4ZJESN.js.map → chunk-EH4BQ7LT.js.map} +0 -0
- /package/dist/{chunk-JXWTPOMJ.js.map → chunk-EPJDSQHF.js.map} +0 -0
- /package/dist/{chunk-OEIA4IHU.js.map → chunk-ESG6ITGP.js.map} +0 -0
- /package/dist/{chunk-7XI2UJHL.js.map → chunk-ETZUIRCI.js.map} +0 -0
- /package/dist/{chunk-PPIASWWR.js.map → chunk-EU534WGS.js.map} +0 -0
- /package/dist/{chunk-E6KXJSMA.js.map → chunk-EUCYTCFP.js.map} +0 -0
- /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
- /package/dist/{chunk-6OAXWYE3.js.map → chunk-FFOVKNQV.js.map} +0 -0
- /package/dist/{chunk-2KRNPFPK.js.map → chunk-FLI6DEIU.js.map} +0 -0
- /package/dist/{chunk-4G4B3Z2B.js.map → chunk-FP4JYE66.js.map} +0 -0
- /package/dist/{chunk-PDVWGGX4.js.map → chunk-FSIMZNBC.js.map} +0 -0
- /package/dist/{chunk-OAIWPB2I.js.map → chunk-FT4UQYOV.js.map} +0 -0
- /package/dist/{chunk-D5UPBXZM.js.map → chunk-FUFAXVBA.js.map} +0 -0
- /package/dist/{chunk-GKOML66M.js.map → chunk-G2OYFTUD.js.map} +0 -0
- /package/dist/{chunk-XTN54NML.js.map → chunk-G3T6YMBO.js.map} +0 -0
- /package/dist/{chunk-KWVI52ER.js.map → chunk-GELS5Z5Z.js.map} +0 -0
- /package/dist/{chunk-J6FFBORM.js.map → chunk-GH7AOMJD.js.map} +0 -0
- /package/dist/{chunk-TCYLCPC6.js.map → chunk-GKJJNO7C.js.map} +0 -0
- /package/dist/{chunk-N75Q5ZSP.js.map → chunk-GMXWTJNU.js.map} +0 -0
- /package/dist/{chunk-B657ZGDH.js.map → chunk-HQSK2INQ.js.map} +0 -0
- /package/dist/{chunk-SQA2MM2F.js.map → chunk-I7S55EOB.js.map} +0 -0
- /package/dist/{chunk-CAUNCRLQ.js.map → chunk-J7JWFZHI.js.map} +0 -0
- /package/dist/{chunk-NQMG2W5L.js.map → chunk-JDZFIR2S.js.map} +0 -0
- /package/dist/{chunk-O52WWLKU.js.map → chunk-JIHMUOOS.js.map} +0 -0
- /package/dist/{chunk-VUQDJ3JB.js.map → chunk-JPTPS4OB.js.map} +0 -0
- /package/dist/{chunk-WXFKXCOQ.js.map → chunk-JQ7XU625.js.map} +0 -0
- /package/dist/{chunk-3I3U6FFT.js.map → chunk-K7BN34IA.js.map} +0 -0
- /package/dist/{chunk-7OAIOE5P.js.map → chunk-KH2LKDX7.js.map} +0 -0
- /package/dist/{chunk-VDXTXVFZ.js.map → chunk-KR6ZKECI.js.map} +0 -0
- /package/dist/{chunk-MK552I5J.js.map → chunk-L5DAHSEZ.js.map} +0 -0
- /package/dist/{chunk-XQIHFXYP.js.map → chunk-LCKVXX5F.js.map} +0 -0
- /package/dist/{chunk-ZI7LMSNI.js.map → chunk-LLHZZOIB.js.map} +0 -0
- /package/dist/{chunk-E57LYSHI.js.map → chunk-LZACDIM2.js.map} +0 -0
- /package/dist/{chunk-QAIKLICT.js.map → chunk-M7KGIW5F.js.map} +0 -0
- /package/dist/{chunk-55ZVZBX4.js.map → chunk-MATDGSJ7.js.map} +0 -0
- /package/dist/{chunk-3NFN4Y4P.js.map → chunk-MGCKZWAE.js.map} +0 -0
- /package/dist/{chunk-YS7SA4HD.js.map → chunk-ML7ZJAKJ.js.map} +0 -0
- /package/dist/{chunk-YDH2FSDI.js.map → chunk-N45NEBOD.js.map} +0 -0
- /package/dist/{chunk-7UX44C4N.js.map → chunk-N4C7QKOG.js.map} +0 -0
- /package/dist/{chunk-YYNHJF3N.js.map → chunk-N7KYEVLK.js.map} +0 -0
- /package/dist/{chunk-HT2C4EXO.js.map → chunk-NIRQGDYC.js.map} +0 -0
- /package/dist/{chunk-DXHVD4DS.js.map → chunk-NW2E4CI2.js.map} +0 -0
- /package/dist/{chunk-BFIZXFUG.js.map → chunk-NWIT3U2N.js.map} +0 -0
- /package/dist/{chunk-4NDWE44P.js.map → chunk-NZFFGO5O.js.map} +0 -0
- /package/dist/{chunk-MB5EJ2CT.js.map → chunk-O2IPAX26.js.map} +0 -0
- /package/dist/{chunk-UOA2VQ7C.js.map → chunk-O4SGYW7H.js.map} +0 -0
- /package/dist/{chunk-SSAXGPXY.js.map → chunk-OP6N4H6A.js.map} +0 -0
- /package/dist/{chunk-ZSJGYC3C.js.map → chunk-OQJKY3Z5.js.map} +0 -0
- /package/dist/{chunk-OFEHITAZ.js.map → chunk-OXNTOHL6.js.map} +0 -0
- /package/dist/{chunk-CDWFWOSZ.js.map → chunk-P4JED3ZL.js.map} +0 -0
- /package/dist/{chunk-FQD2KPQH.js.map → chunk-P55FACBG.js.map} +0 -0
- /package/dist/{chunk-KX36OCGK.js.map → chunk-P5NQN4JE.js.map} +0 -0
- /package/dist/{chunk-3ZCRHW7U.js.map → chunk-P7TOIOT7.js.map} +0 -0
- /package/dist/{chunk-PBVNVKYN.js.map → chunk-PIN5OPBA.js.map} +0 -0
- /package/dist/{chunk-O6YDGTH4.js.map → chunk-PZHQWFR3.js.map} +0 -0
- /package/dist/{chunk-SVDU4OHO.js.map → chunk-Q35L7TYB.js.map} +0 -0
- /package/dist/{chunk-SOJ3IQD3.js.map → chunk-QODKDRSP.js.map} +0 -0
- /package/dist/{chunk-VJGDQA3D.js.map → chunk-QOZJCSFO.js.map} +0 -0
- /package/dist/{chunk-6T42L5FI.js.map → chunk-QS3OLP5I.js.map} +0 -0
- /package/dist/{chunk-PAAJWQH5.js.map → chunk-QUMKDRCF.js.map} +0 -0
- /package/dist/{chunk-4TP3MJ3D.js.map → chunk-QX6JN3O4.js.map} +0 -0
- /package/dist/{chunk-KZEMFD6E.js.map → chunk-R2H4ZFBJ.js.map} +0 -0
- /package/dist/{chunk-N6UMXWBA.js.map → chunk-RTKV5XHL.js.map} +0 -0
- /package/dist/{chunk-ZQ3WU6JO.js.map → chunk-RXFCU3CY.js.map} +0 -0
- /package/dist/{chunk-BOOFTFFE.js.map → chunk-S2I7DL5Q.js.map} +0 -0
- /package/dist/{chunk-2NCBDGND.js.map → chunk-SA6GMZJY.js.map} +0 -0
- /package/dist/{chunk-2AFHZTPI.js.map → chunk-SIIRTDJ4.js.map} +0 -0
- /package/dist/{chunk-WH4QXVKU.js.map → chunk-SS3IS2JR.js.map} +0 -0
- /package/dist/{chunk-VFTK5WKI.js.map → chunk-STBX5X6B.js.map} +0 -0
- /package/dist/{chunk-WVHRNAXL.js.map → chunk-SWWHIJUJ.js.map} +0 -0
- /package/dist/{chunk-WADSXS4K.js.map → chunk-SX4QDWXK.js.map} +0 -0
- /package/dist/{chunk-2U4BM3TW.js.map → chunk-TITG2NBS.js.map} +0 -0
- /package/dist/{chunk-A5ZYP4K5.js.map → chunk-TNRCDMQT.js.map} +0 -0
- /package/dist/{chunk-LZKOVXMX.js.map → chunk-TRMJ6BYC.js.map} +0 -0
- /package/dist/{chunk-VA2HNBGQ.js.map → chunk-TZNDKTX5.js.map} +0 -0
- /package/dist/{chunk-OFDIGTC2.js.map → chunk-UMTCNEVQ.js.map} +0 -0
- /package/dist/{chunk-AAM66QCP.js.map → chunk-UZRSI6NX.js.map} +0 -0
- /package/dist/{chunk-2CXQZXWM.js.map → chunk-V4MB5ONM.js.map} +0 -0
- /package/dist/{chunk-5BUCKFRE.js.map → chunk-VOKHZRHW.js.map} +0 -0
- /package/dist/{chunk-CYEK6Z3P.js.map → chunk-VW6VIJOS.js.map} +0 -0
- /package/dist/{chunk-I2M4ZVDD.js.map → chunk-W47S5TIH.js.map} +0 -0
- /package/dist/{chunk-CBP4HWCL.js.map → chunk-W5MCEVUS.js.map} +0 -0
- /package/dist/{chunk-E5H4TM4Y.js.map → chunk-WC3V7HHP.js.map} +0 -0
- /package/dist/{chunk-WCTL3PVM.js.map → chunk-WLMZ2L5P.js.map} +0 -0
- /package/dist/{chunk-SQ2O52SU.js.map → chunk-WSGPFRBH.js.map} +0 -0
- /package/dist/{chunk-BH44JOLA.js.map → chunk-WVADKFWV.js.map} +0 -0
- /package/dist/{chunk-JVNEXW6X.js.map → chunk-XISROV24.js.map} +0 -0
- /package/dist/{chunk-FZVROZKC.js.map → chunk-XVZA6VXC.js.map} +0 -0
- /package/dist/{chunk-56GJLXBA.js.map → chunk-Y4NKEXQT.js.map} +0 -0
- /package/dist/{chunk-EKKAHJ4B.js.map → chunk-YE36AJL7.js.map} +0 -0
- /package/dist/{chunk-OGWEWJRH.js.map → chunk-YFMBHQRG.js.map} +0 -0
- /package/dist/{chunk-JLIGUFPF.js.map → chunk-YN2DQ2D6.js.map} +0 -0
- /package/dist/{chunk-RBJQYMMT.js.map → chunk-YRULQW5J.js.map} +0 -0
- /package/dist/{chunk-UCJINCZT.js.map → chunk-YUZRI3QU.js.map} +0 -0
- /package/dist/{chunk-QUNDYIYZ.js.map → chunk-YYEOR4XN.js.map} +0 -0
- /package/dist/{chunk-O5MW6CQL.js.map → chunk-ZJVMUBYF.js.map} +0 -0
- /package/dist/{chunk-VBJD4RSJ.js.map → chunk-ZSH2NRDV.js.map} +0 -0
- /package/dist/{chunk-BX4WDBTE.js.map → chunk-ZV65I6ME.js.map} +0 -0
- /package/dist/{resolution-E4GLHLY6.js.map → contradiction-scan-P7KXB5R4.js.map} +0 -0
- /package/dist/{first-start-migration-OM3PHMZO.js.map → first-start-migration-6A5BJPDW.js.map} +0 -0
- /package/dist/{tier-stats-M2FMMD2N.js.map → tier-stats-RQM76XYY.js.map} +0 -0
package/dist/calibration.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OUTPUT_LANGUAGE_POLICY
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YN2DQ2D6.js";
|
|
4
4
|
import "./chunk-QW27DOHG.js";
|
|
5
5
|
import {
|
|
6
6
|
LocalLlmClient
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DYJHGJZ4.js";
|
|
8
8
|
import "./chunk-QM2SPLKQ.js";
|
|
9
9
|
import "./chunk-U4LUIE6Y.js";
|
|
10
10
|
import "./chunk-JUXOTY6J.js";
|
|
@@ -18,9 +18,12 @@ import "./chunk-45GF7Y3V.js";
|
|
|
18
18
|
import "./chunk-EP6BA7VV.js";
|
|
19
19
|
import "./chunk-E2AWJ7KQ.js";
|
|
20
20
|
import "./chunk-YBA52OKG.js";
|
|
21
|
+
import {
|
|
22
|
+
writeFileAtomically
|
|
23
|
+
} from "./chunk-BTNNL7ZW.js";
|
|
21
24
|
import {
|
|
22
25
|
resolveLocalLlmCapabilities
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-C5LWPYS3.js";
|
|
24
27
|
import "./chunk-ZEFVK7XC.js";
|
|
25
28
|
import "./chunk-6KH5NLQS.js";
|
|
26
29
|
import "./chunk-P2QRMMVQ.js";
|
|
@@ -36,7 +39,7 @@ import "./chunk-PZ5AY32C.js";
|
|
|
36
39
|
|
|
37
40
|
// src/calibration.ts
|
|
38
41
|
import { createHash } from "crypto";
|
|
39
|
-
import { mkdir, readFile
|
|
42
|
+
import { mkdir, readFile } from "fs/promises";
|
|
40
43
|
import path from "path";
|
|
41
44
|
function calibrationDir(memoryDir) {
|
|
42
45
|
return path.join(memoryDir, "state", "calibration");
|
|
@@ -44,23 +47,59 @@ function calibrationDir(memoryDir) {
|
|
|
44
47
|
function calibrationIndexPath(memoryDir) {
|
|
45
48
|
return path.join(calibrationDir(memoryDir), "calibration-index.json");
|
|
46
49
|
}
|
|
50
|
+
var MAX_APPLIED_WEEK_ID_LENGTH = 32;
|
|
51
|
+
function appliedCalibrationWeekId(value) {
|
|
52
|
+
if (typeof value !== "string") return void 0;
|
|
53
|
+
const trimmed = value.trim();
|
|
54
|
+
if (trimmed.length === 0 || trimmed.length > MAX_APPLIED_WEEK_ID_LENGTH) return void 0;
|
|
55
|
+
return trimmed;
|
|
56
|
+
}
|
|
47
57
|
async function readCalibrationIndex(memoryDir) {
|
|
48
58
|
try {
|
|
49
59
|
const raw = JSON.parse(await readFile(calibrationIndexPath(memoryDir), "utf8"));
|
|
60
|
+
const appliedWeekIds = normalizeAppliedWeekIds(raw.appliedWeekIds, raw.appliedWeekId);
|
|
50
61
|
return {
|
|
51
62
|
rules: Array.isArray(raw.rules) ? raw.rules : [],
|
|
52
63
|
updatedAt: typeof raw.updatedAt === "string" ? raw.updatedAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
53
|
-
totalCorrectionsAnalyzed: typeof raw.totalCorrectionsAnalyzed === "number" ? raw.totalCorrectionsAnalyzed : 0
|
|
64
|
+
totalCorrectionsAnalyzed: typeof raw.totalCorrectionsAnalyzed === "number" ? raw.totalCorrectionsAnalyzed : 0,
|
|
65
|
+
...appliedWeekIds.length > 0 ? { appliedWeekIds } : {}
|
|
54
66
|
};
|
|
55
67
|
} catch {
|
|
56
68
|
return { rules: [], updatedAt: (/* @__PURE__ */ new Date()).toISOString(), totalCorrectionsAnalyzed: 0 };
|
|
57
69
|
}
|
|
58
70
|
}
|
|
71
|
+
function normalizeAppliedWeekIds(list, additional) {
|
|
72
|
+
const weeks = [];
|
|
73
|
+
if (Array.isArray(list)) {
|
|
74
|
+
for (const entry of list) {
|
|
75
|
+
const week = appliedCalibrationWeekId(entry);
|
|
76
|
+
if (week && !weeks.includes(week)) weeks.push(week);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const extra = appliedCalibrationWeekId(additional);
|
|
80
|
+
if (extra && !weeks.includes(extra)) weeks.push(extra);
|
|
81
|
+
return weeks;
|
|
82
|
+
}
|
|
83
|
+
function withAppliedCalibrationWeek(index, idempotencyKey) {
|
|
84
|
+
const appliedWeekIds = normalizeAppliedWeekIds(index.appliedWeekIds, idempotencyKey);
|
|
85
|
+
return {
|
|
86
|
+
rules: index.rules,
|
|
87
|
+
updatedAt: index.updatedAt,
|
|
88
|
+
totalCorrectionsAnalyzed: index.totalCorrectionsAnalyzed,
|
|
89
|
+
...appliedWeekIds.length > 0 ? { appliedWeekIds } : {}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
59
92
|
async function writeCalibrationIndex(memoryDir, index) {
|
|
60
93
|
const dir = calibrationDir(memoryDir);
|
|
61
94
|
await mkdir(dir, { recursive: true });
|
|
62
|
-
|
|
63
|
-
|
|
95
|
+
const appliedWeekIds = normalizeAppliedWeekIds(index.appliedWeekIds, void 0);
|
|
96
|
+
const stamped = {
|
|
97
|
+
rules: index.rules,
|
|
98
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
99
|
+
totalCorrectionsAnalyzed: index.totalCorrectionsAnalyzed,
|
|
100
|
+
...appliedWeekIds.length > 0 ? { appliedWeekIds } : {}
|
|
101
|
+
};
|
|
102
|
+
await writeFileAtomically(calibrationIndexPath(memoryDir), JSON.stringify(stamped, null, 2));
|
|
64
103
|
}
|
|
65
104
|
var CALIBRATION_RULE_TYPES = /* @__PURE__ */ new Set([
|
|
66
105
|
"model_tendency",
|
|
@@ -274,6 +313,12 @@ function calibrationConsolidationInput(config) {
|
|
|
274
313
|
}
|
|
275
314
|
async function runCalibrationConsolidation(options) {
|
|
276
315
|
try {
|
|
316
|
+
const idempotencyKey = appliedCalibrationWeekId(options.idempotencyKey);
|
|
317
|
+
const existingIndex = await readCalibrationIndex(options.memoryDir);
|
|
318
|
+
if (idempotencyKey && (existingIndex.appliedWeekIds ?? []).includes(idempotencyKey)) {
|
|
319
|
+
log.debug(`[calibration] week ${idempotencyKey} already applied \u2014 skipping`);
|
|
320
|
+
return existingIndex.rules;
|
|
321
|
+
}
|
|
277
322
|
const llm = resolveCalibrationChatClient(options);
|
|
278
323
|
if (!llm) return [];
|
|
279
324
|
const corrections = await readCorrections(options.memoryDir);
|
|
@@ -281,7 +326,6 @@ async function runCalibrationConsolidation(options) {
|
|
|
281
326
|
log.info(`[calibration] only ${corrections.length} corrections \u2014 need at least 3`);
|
|
282
327
|
return [];
|
|
283
328
|
}
|
|
284
|
-
const existingIndex = await readCalibrationIndex(options.memoryDir);
|
|
285
329
|
const newRules = await synthesizeCalibrationRules(
|
|
286
330
|
corrections,
|
|
287
331
|
llm,
|
|
@@ -305,11 +349,12 @@ async function runCalibrationConsolidation(options) {
|
|
|
305
349
|
}
|
|
306
350
|
}
|
|
307
351
|
const allRules = [...ruleMap.values()];
|
|
308
|
-
await writeCalibrationIndex(options.memoryDir, {
|
|
352
|
+
await writeCalibrationIndex(options.memoryDir, withAppliedCalibrationWeek({
|
|
309
353
|
rules: allRules,
|
|
310
|
-
updatedAt:
|
|
311
|
-
totalCorrectionsAnalyzed: corrections.length
|
|
312
|
-
|
|
354
|
+
updatedAt: existingIndex.updatedAt,
|
|
355
|
+
totalCorrectionsAnalyzed: corrections.length,
|
|
356
|
+
appliedWeekIds: existingIndex.appliedWeekIds
|
|
357
|
+
}, idempotencyKey));
|
|
313
358
|
log.debug(`[calibration] synthesized ${newRules.length} new rule(s), ${allRules.length} total`);
|
|
314
359
|
return allRules;
|
|
315
360
|
} catch (error) {
|
|
@@ -338,6 +383,7 @@ async function getCalibrationRulesForRecall(memoryDir) {
|
|
|
338
383
|
}
|
|
339
384
|
export {
|
|
340
385
|
CLUSTER_PROMPT,
|
|
386
|
+
appliedCalibrationWeekId,
|
|
341
387
|
buildCalibrationRecallSection,
|
|
342
388
|
calibrationConsolidationInput,
|
|
343
389
|
getCalibrationRulesForRecall,
|
|
@@ -345,6 +391,7 @@ export {
|
|
|
345
391
|
readCalibrationIndex,
|
|
346
392
|
runCalibrationConsolidation,
|
|
347
393
|
runCalibrationIfEnabled,
|
|
348
|
-
synthesizeCalibrationRules
|
|
394
|
+
synthesizeCalibrationRules,
|
|
395
|
+
withAppliedCalibrationWeek
|
|
349
396
|
};
|
|
350
397
|
//# sourceMappingURL=calibration.js.map
|
package/dist/calibration.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/calibration.ts"],"sourcesContent":["/**\n * calibration.ts — Prediction-Error-Driven Model-User Calibration\n *\n * Analyzes patterns in user corrections to identify systematic miscalibration\n * between the model's predictions and the user's actual expectations.\n * During consolidation, replays chains of similar corrections through an LLM\n * to synthesize CalibrationRules that adjust model behavior for this specific user.\n *\n * Inspired by:\n * - Cerebellar motor calibration (prediction errors drive lasting adjustments)\n * - Temporal difference learning (dopamine signals prediction error)\n * - Tesla FSD shadow mode (divergence between prediction and reality = training signal)\n */\n\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { resolveLocalLlmCapabilities } from \"./capabilities.js\";\nimport { OUTPUT_LANGUAGE_POLICY } from \"./extraction-prompt.js\";\nimport { FallbackLlmClient } from \"./fallback-llm.js\";\nimport { listJsonFiles } from \"./json-store.js\";\nimport { LocalLlmClient } from \"./local-llm.js\";\nimport { log } from \"./logger.js\";\nimport type { AgentPersonaModelConfig, GatewayConfig, PluginConfig } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface CalibrationRule {\n id: string;\n ruleType: \"model_tendency\" | \"user_expectation\" | \"scope_boundary\" | \"verification_required\";\n condition: string;\n modelTendency: string;\n userExpectation: string;\n calibration: string;\n confidence: number;\n evidenceCount: number;\n evidenceCorrectionIds: string[];\n createdAt: string;\n lastReinforcedAt: string;\n}\n\nexport interface CalibrationIndex {\n rules: CalibrationRule[];\n updatedAt: string;\n totalCorrectionsAnalyzed: number;\n}\n\n// ─── Storage ─────────────────────────────────────────────────────────────────\n\nfunction calibrationDir(memoryDir: string): string {\n return path.join(memoryDir, \"state\", \"calibration\");\n}\n\nfunction calibrationIndexPath(memoryDir: string): string {\n return path.join(calibrationDir(memoryDir), \"calibration-index.json\");\n}\n\nexport async function readCalibrationIndex(memoryDir: string): Promise<CalibrationIndex> {\n try {\n const raw = JSON.parse(await readFile(calibrationIndexPath(memoryDir), \"utf8\"));\n return {\n rules: Array.isArray(raw.rules) ? raw.rules : [],\n updatedAt: typeof raw.updatedAt === \"string\" ? raw.updatedAt : new Date().toISOString(),\n totalCorrectionsAnalyzed: typeof raw.totalCorrectionsAnalyzed === \"number\" ? raw.totalCorrectionsAnalyzed : 0,\n };\n } catch {\n return { rules: [], updatedAt: new Date().toISOString(), totalCorrectionsAnalyzed: 0 };\n }\n}\n\nasync function writeCalibrationIndex(memoryDir: string, index: CalibrationIndex): Promise<void> {\n const dir = calibrationDir(memoryDir);\n await mkdir(dir, { recursive: true });\n index.updatedAt = new Date().toISOString();\n await writeFile(calibrationIndexPath(memoryDir), JSON.stringify(index, null, 2), \"utf8\");\n}\n\n// ─── Correction Reading ──────────────────────────────────────────────────────\n\nexport interface CorrectionMemory {\n id: string;\n content: string;\n created: string;\n confidence: number;\n entityRefs: string[];\n tags: string[];\n}\n\nconst CALIBRATION_RULE_TYPES = new Set([\n \"model_tendency\",\n \"user_expectation\",\n \"scope_boundary\",\n \"verification_required\",\n]);\n\nfunction parseConfidence(value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return undefined;\n return Math.max(0, Math.min(1, value));\n}\n\nfunction parseEvidenceIds(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.filter((item): item is string => typeof item === \"string\" && item.trim().length > 0);\n}\n\nfunction nonEmptyString(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\n/**\n * Exported for entity-contamination R-11 regression coverage (#682\n * PR 2/3 — codex review). Tests can drive the real correction-reading\n * path instead of duplicating the regex inline, so calibration parser\n * regressions surface via the contamination suite.\n */\nexport async function readCalibrationCorrections(memoryDir: string): Promise<CorrectionMemory[]> {\n return readCorrectionsImpl(memoryDir);\n}\n\nasync function readCorrections(memoryDir: string): Promise<CorrectionMemory[]> {\n return readCorrectionsImpl(memoryDir);\n}\n\nasync function readCorrectionsImpl(memoryDir: string): Promise<CorrectionMemory[]> {\n const correctionsDir = path.join(memoryDir, \"corrections\");\n const files = await listJsonFiles(correctionsDir).catch(() => {\n // Corrections might be in facts/ directories too\n return [] as string[];\n });\n\n // Also scan facts directories for correction-category files\n const factsDir = path.join(memoryDir, \"facts\");\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const dayDirs = (await readdir(factsDir)).filter((d: string) => /^\\d{4}-\\d{2}-\\d{2}$/.test(d));\n for (const day of dayDirs) {\n const dayPath = path.join(factsDir, day);\n const dayFiles = (await readdir(dayPath))\n .filter((f: string) => f.startsWith(\"correction-\") && f.endsWith(\".md\"))\n .map((f: string) => path.join(dayPath, f));\n files.push(...dayFiles);\n }\n } catch {\n // facts dir might not exist\n }\n\n // Also check the dedicated corrections directory\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const corrFiles = (await readdir(correctionsDir))\n .filter((f: string) => f.endsWith(\".md\"))\n .map((f: string) => path.join(correctionsDir, f));\n files.push(...corrFiles);\n } catch {\n // corrections dir might not exist\n }\n\n const corrections: CorrectionMemory[] = [];\n const seen = new Set<string>();\n\n for (const filePath of files) {\n try {\n const raw = await readFile(filePath, \"utf8\");\n\n // Parse frontmatter\n const fmMatch = raw.match(/^---\\n([\\s\\S]*?)\\n---\\n([\\s\\S]*)$/);\n if (!fmMatch) continue;\n\n const content = fmMatch[2].trim();\n if (!content || content.length < 10) continue;\n\n // Extract id from frontmatter\n const idMatch = fmMatch[1].match(/^id:\\s*(.+)$/m);\n const id = idMatch?.[1]?.trim() ?? path.basename(filePath, \".md\");\n\n if (seen.has(id)) continue;\n seen.add(id);\n\n const confMatch = fmMatch[1].match(/^confidence:\\s*(.+)$/m);\n const confidence = confMatch ? parseFloat(confMatch[1]) : 0.9;\n\n const entityMatch = fmMatch[1].match(/^entityRef:\\s*(.+)$/m);\n const entityRefs = entityMatch ? [entityMatch[1].trim()] : [];\n\n corrections.push({ id, content, created: \"\", confidence, entityRefs, tags: [] });\n } catch {\n // skip unparseable files\n }\n }\n\n return corrections;\n}\n\n// ─── LLM-Assisted Clustering and Replay ──────────────────────────────────────\n\nexport const CLUSTER_PROMPT = `You are analyzing user corrections to an AI assistant. Each correction represents a moment where the assistant's prediction of what the user wanted was WRONG.\n\nYour job: Group these corrections into clusters where the SAME TYPE of misunderstanding is happening. Then for each cluster, synthesize a CalibrationRule.\n\nA CalibrationRule describes:\n- condition: When does this type of mistake happen?\n- modelTendency: What does the model tend to assume or do wrong?\n- userExpectation: What does the user actually want instead?\n- calibration: How should the model adjust its behavior?\n- ruleType: One of \"model_tendency\", \"user_expectation\", \"scope_boundary\", \"verification_required\"\n\nFocus on PATTERNS, not individual corrections. A cluster needs at least 2 corrections to be worth a rule.\n${OUTPUT_LANGUAGE_POLICY}\n\nOutput valid JSON only:\n{\n \"rules\": [\n {\n \"ruleType\": \"model_tendency\",\n \"condition\": \"When discussing project scope or task boundaries\",\n \"modelTendency\": \"The model tends to assume broader scope than the user intends\",\n \"userExpectation\": \"The user prefers narrow, specific task definitions and wants to be asked before scope expansion\",\n \"calibration\": \"When uncertain about scope, ask for clarification rather than assuming. Default to the narrower interpretation.\",\n \"confidence\": 0.85,\n \"evidenceIds\": [\"correction-id-1\", \"correction-id-2\"]\n }\n ]\n}`;\n\ninterface CalibrationChatClient {\n chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options?: {\n temperature?: number;\n maxTokens?: number;\n agentId?: string;\n modelChain?: AgentPersonaModelConfig;\n }\n ): Promise<{ content?: string | null } | null>;\n}\n\ninterface CalibrationLlmOptions {\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n /** Plugin config. Supplies `localLlm*` settings when the gateway chain is empty. */\n pluginConfig?: PluginConfig;\n}\n\nfunction resolveCalibrationChatClient(options: CalibrationLlmOptions): CalibrationChatClient | null {\n const gateway = new FallbackLlmClient(options.gatewayConfig, {\n workspaceDir: options.workspaceDir,\n });\n if (gateway.isAvailable({ agentId: options.gatewayAgentId, modelChain: options.modelChain })) {\n return gateway;\n }\n const pluginConfig = options.pluginConfig;\n if (pluginConfig && resolveLocalLlmCapabilities(pluginConfig).localLlm) {\n log.info(`[calibration] using configured local LLM (model=${pluginConfig.localLlmModel})`);\n const local = new LocalLlmClient(pluginConfig);\n return {\n chatCompletion(messages, chatOptions) {\n return local.chatCompletion(messages, {\n temperature: chatOptions?.temperature,\n maxTokens: chatOptions?.maxTokens,\n });\n },\n };\n }\n log.warn(\"[calibration] no LLM available — skipping consolidation\");\n return null;\n}\n\nexport async function synthesizeCalibrationRules(\n corrections: CorrectionMemory[],\n llm: CalibrationChatClient,\n existingRules: CalibrationRule[],\n agentId?: string,\n modelChain?: AgentPersonaModelConfig\n): Promise<CalibrationRule[]> {\n if (corrections.length < 2) return [];\n\n // Format corrections for the LLM\n const correctionText = corrections\n .slice(0, 50) // limit to avoid huge prompts\n .map((c, i) => `[${c.id}] ${c.content}`)\n .join(\"\\n\\n\");\n\n const existingRulesText =\n existingRules.length > 0\n ? `\\n\\nExisting calibration rules (avoid duplicating these):\\n${existingRules.map((r) => `- ${r.condition}: ${r.calibration}`).join(\"\\n\")}`\n : \"\";\n\n const response = await llm.chatCompletion(\n [\n { role: \"system\", content: CLUSTER_PROMPT },\n {\n role: \"user\",\n content: `Here are ${corrections.length} corrections from this user:\\n\\n${correctionText}${existingRulesText}`,\n },\n ],\n { temperature: 0.3, maxTokens: 3000, agentId, modelChain }\n );\n\n if (!response?.content) return [];\n\n try {\n let jsonStr = response.content.trim();\n const fenceMatch = jsonStr.match(/```(?:json)?\\s*\\n?([\\s\\S]*?)\\n?\\s*```/);\n if (fenceMatch) jsonStr = fenceMatch[1];\n\n const parsed = JSON.parse(jsonStr);\n if (!Array.isArray(parsed.rules)) return [];\n\n const now = new Date().toISOString();\n const rawRules: unknown[] = Array.isArray(parsed.rules) ? parsed.rules : [];\n return rawRules\n .map((r: unknown): CalibrationRule | undefined => {\n if (!r || typeof r !== \"object\" || Array.isArray(r)) return undefined;\n const raw = r as Record<string, unknown>;\n const ruleType = nonEmptyString(raw.ruleType);\n const condition = nonEmptyString(raw.condition);\n const modelTendency = nonEmptyString(raw.modelTendency);\n const calibration = nonEmptyString(raw.calibration);\n const confidence = parseConfidence(raw.confidence);\n if (\n !ruleType ||\n !CALIBRATION_RULE_TYPES.has(ruleType) ||\n !condition ||\n !modelTendency ||\n !calibration ||\n confidence === undefined\n ) {\n return undefined;\n }\n const evidenceCorrectionIds = parseEvidenceIds(raw.evidenceIds);\n return {\n id: `cal-${createHash(\"sha256\")\n .update(condition + calibration)\n .digest(\"hex\")\n .slice(0, 12)}`,\n ruleType: ruleType as CalibrationRule[\"ruleType\"],\n condition,\n modelTendency,\n userExpectation: nonEmptyString(raw.userExpectation) ?? \"\",\n calibration,\n confidence,\n evidenceCount: evidenceCorrectionIds.length,\n evidenceCorrectionIds,\n createdAt: now,\n lastReinforcedAt: now,\n };\n })\n .filter((rule): rule is CalibrationRule => !!rule);\n } catch {\n log.warn(\"[calibration] failed to parse LLM response\");\n return [];\n }\n}\n\n// ─── Recall Section ──────────────────────────────────────────────────────────\n\n/**\n * Build a recall section from calibration rules relevant to the current query.\n * Uses the LLM to select which rules apply to the current context.\n */\nexport function buildCalibrationRecallSection(\n rules: CalibrationRule[],\n query: string,\n maxChars: number = 1200,\n): string | null {\n if (rules.length === 0) return null;\n\n // Simple relevance: include all rules (they're already filtered to this user)\n // In production, could use embedding similarity to filter\n const lines: string[] = [\n \"## Model Calibration (learned from past corrections)\",\n \"\",\n \"Adjustments for this specific user, learned from patterns in their corrections:\",\n \"\",\n ];\n\n let totalChars = lines.join(\"\\n\").length;\n\n for (const rule of rules) {\n const line = `- **${rule.condition}**: ${rule.modelTendency} → Instead: ${rule.calibration}`;\n if (totalChars + line.length + 1 > maxChars) break;\n lines.push(line);\n totalChars += line.length + 1;\n }\n\n if (lines.length <= 4) return null;\n lines.push(\"\");\n return lines.join(\"\\n\");\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Options weekly compounding passes into calibration. Gateway agent and task\n * chain fields stay limited to `modelSource: \"gateway\"`. `pluginConfig` carries\n * the `localLlm*` settings used when that chain is empty.\n */\nexport function calibrationConsolidationInput(config: PluginConfig): {\n memoryDir: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig: PluginConfig;\n} {\n const gateway = config.modelSource === \"gateway\";\n return {\n memoryDir: config.memoryDir,\n gatewayConfig: config.gatewayConfig,\n gatewayAgentId: gateway ? (config.gatewayAgentId || undefined) : undefined,\n modelChain: gateway ? config.taskModelChain : undefined,\n workspaceDir: config.workspaceDir,\n pluginConfig: config,\n };\n}\n\n/**\n * Run the full calibration pipeline:\n * 1. Read all corrections\n * 2. Send to LLM for clustering and rule synthesis\n * 3. Merge with existing rules\n * 4. Write updated index\n */\nexport async function runCalibrationConsolidation(options: {\n memoryDir: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n}): Promise<CalibrationRule[]> {\n try {\n const llm = resolveCalibrationChatClient(options);\n if (!llm) return [];\n\n const corrections = await readCorrections(options.memoryDir);\n if (corrections.length < 3) {\n log.info(`[calibration] only ${corrections.length} corrections — need at least 3`);\n return [];\n }\n\n const existingIndex = await readCalibrationIndex(options.memoryDir);\n\n const newRules = await synthesizeCalibrationRules(\n corrections,\n llm,\n existingIndex.rules,\n options.gatewayAgentId,\n options.modelChain\n );\n if (newRules.length === 0) {\n log.info(\"[calibration] no new calibration rules synthesized\");\n return existingIndex.rules;\n }\n\n // Merge: keep existing rules, add new ones (deduplicate by id)\n const ruleMap = new Map(existingIndex.rules.map((r) => [r.id, r]));\n for (const rule of newRules) {\n if (ruleMap.has(rule.id)) {\n // Reinforce existing rule\n const existing = ruleMap.get(rule.id)!;\n existing.lastReinforcedAt = new Date().toISOString();\n existing.evidenceCount += rule.evidenceCount;\n existing.confidence = Math.min(1, existing.confidence + 0.05);\n } else {\n ruleMap.set(rule.id, rule);\n }\n }\n\n const allRules = [...ruleMap.values()];\n await writeCalibrationIndex(options.memoryDir, {\n rules: allRules,\n updatedAt: new Date().toISOString(),\n totalCorrectionsAnalyzed: corrections.length,\n });\n\n log.debug(`[calibration] synthesized ${newRules.length} new rule(s), ${allRules.length} total`);\n return allRules;\n } catch (error) {\n log.warn(\n `[calibration] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`\n );\n return [];\n }\n}\n\n/**\n * Standalone entry point for calibration consolidation that can be called\n * independently of weekly compounding. The compounding engine's\n * `synthesizeWeekly()` is one trigger, but orchestrators or periodic\n * maintenance jobs should call this directly so calibration is not gated\n * on weekly compounding being enabled.\n */\nexport async function runCalibrationIfEnabled(options: {\n memoryDir: string;\n calibrationEnabled: boolean;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n}): Promise<CalibrationRule[]> {\n if (!options.calibrationEnabled) {\n return [];\n }\n return runCalibrationConsolidation({\n memoryDir: options.memoryDir,\n gatewayConfig: options.gatewayConfig,\n gatewayAgentId: options.gatewayAgentId,\n modelChain: options.modelChain,\n workspaceDir: options.workspaceDir,\n pluginConfig: options.pluginConfig,\n });\n}\n\n/**\n * Get calibration rules for recall injection.\n * Reads the pre-computed calibration index.\n */\nexport async function getCalibrationRulesForRecall(\n memoryDir: string,\n):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AA,IACtB,cAAc,QAAQ;AAAA,EACxB,CAAC;AACH;AAMA,eAAsB,6BACpB,WAC4B;AAC5B,QAAM,QAAQ,MAAM,qBAAqB,SAAS;AAClD,SAAO,MAAM;AACf;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/calibration.ts"],"sourcesContent":["/**\n * calibration.ts — Prediction-Error-Driven Model-User Calibration\n *\n * Analyzes patterns in user corrections to identify systematic miscalibration\n * between the model's predictions and the user's actual expectations.\n * During consolidation, replays chains of similar corrections through an LLM\n * to synthesize CalibrationRules that adjust model behavior for this specific user.\n *\n * Inspired by:\n * - Cerebellar motor calibration (prediction errors drive lasting adjustments)\n * - Temporal difference learning (dopamine signals prediction error)\n * - Tesla FSD shadow mode (divergence between prediction and reality = training signal)\n */\n\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { resolveLocalLlmCapabilities } from \"./capabilities.js\";\nimport { OUTPUT_LANGUAGE_POLICY } from \"./extraction-prompt.js\";\nimport { FallbackLlmClient } from \"./fallback-llm.js\";\nimport { listJsonFiles } from \"./json-store.js\";\nimport { LocalLlmClient } from \"./local-llm.js\";\nimport { log } from \"./logger.js\";\nimport { writeFileAtomically } from \"./maintenance/atomic-file.js\";\nimport type { AgentPersonaModelConfig, GatewayConfig, PluginConfig } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface CalibrationRule {\n id: string;\n ruleType: \"model_tendency\" | \"user_expectation\" | \"scope_boundary\" | \"verification_required\";\n condition: string;\n modelTendency: string;\n userExpectation: string;\n calibration: string;\n confidence: number;\n evidenceCount: number;\n evidenceCorrectionIds: string[];\n createdAt: string;\n lastReinforcedAt: string;\n}\n\nexport interface CalibrationIndex {\n rules: CalibrationRule[];\n updatedAt: string;\n totalCorrectionsAnalyzed: number;\n /**\n * Weeks whose rule reinforcement is already committed. A retry of any of\n * these weeks must not increment `evidenceCount` again. Older indexes\n * persisted a single `appliedWeekId`; reads fold it into this list.\n */\n appliedWeekIds?: string[];\n}\n\n// ─── Storage ─────────────────────────────────────────────────────────────────\n\nfunction calibrationDir(memoryDir: string): string {\n return path.join(memoryDir, \"state\", \"calibration\");\n}\n\nfunction calibrationIndexPath(memoryDir: string): string {\n return path.join(calibrationDir(memoryDir), \"calibration-index.json\");\n}\n\n/** Week ids are short (`YYYY-Www`). Longer values are not used as stamps. */\nconst MAX_APPLIED_WEEK_ID_LENGTH = 32;\n\nexport function appliedCalibrationWeekId(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n if (trimmed.length === 0 || trimmed.length > MAX_APPLIED_WEEK_ID_LENGTH) return undefined;\n return trimmed;\n}\n\nexport async function readCalibrationIndex(memoryDir: string): Promise<CalibrationIndex> {\n try {\n const raw = JSON.parse(await readFile(calibrationIndexPath(memoryDir), \"utf8\"));\n const appliedWeekIds = normalizeAppliedWeekIds(raw.appliedWeekIds, raw.appliedWeekId);\n return {\n rules: Array.isArray(raw.rules) ? raw.rules : [],\n updatedAt: typeof raw.updatedAt === \"string\" ? raw.updatedAt : new Date().toISOString(),\n totalCorrectionsAnalyzed: typeof raw.totalCorrectionsAnalyzed === \"number\" ? raw.totalCorrectionsAnalyzed : 0,\n ...(appliedWeekIds.length > 0 ? { appliedWeekIds } : {}),\n };\n } catch {\n return { rules: [], updatedAt: new Date().toISOString(), totalCorrectionsAnalyzed: 0 };\n }\n}\n\nfunction normalizeAppliedWeekIds(list: unknown, additional: unknown): string[] {\n const weeks: string[] = [];\n if (Array.isArray(list)) {\n for (const entry of list) {\n const week = appliedCalibrationWeekId(entry);\n if (week && !weeks.includes(week)) weeks.push(week);\n }\n }\n const extra = appliedCalibrationWeekId(additional);\n if (extra && !weeks.includes(extra)) weeks.push(extra);\n return weeks;\n}\n\n/**\n * Attach the week stamp to the index that will be written with the reinforced\n * rules. The stamp and the evidence increment commit together. Every\n * previously applied week stays in the list so an out-of-order retry of an\n * older week is still recognized as already applied.\n */\nexport function withAppliedCalibrationWeek(\n index: CalibrationIndex,\n idempotencyKey: string | undefined,\n): CalibrationIndex {\n const appliedWeekIds = normalizeAppliedWeekIds(index.appliedWeekIds, idempotencyKey);\n return {\n rules: index.rules,\n updatedAt: index.updatedAt,\n totalCorrectionsAnalyzed: index.totalCorrectionsAnalyzed,\n ...(appliedWeekIds.length > 0 ? { appliedWeekIds } : {}),\n };\n}\n\nasync function writeCalibrationIndex(memoryDir: string, index: CalibrationIndex): Promise<void> {\n const dir = calibrationDir(memoryDir);\n await mkdir(dir, { recursive: true });\n const appliedWeekIds = normalizeAppliedWeekIds(index.appliedWeekIds, undefined);\n const stamped: CalibrationIndex = {\n rules: index.rules,\n updatedAt: new Date().toISOString(),\n totalCorrectionsAnalyzed: index.totalCorrectionsAnalyzed,\n ...(appliedWeekIds.length > 0 ? { appliedWeekIds } : {}),\n };\n await writeFileAtomically(calibrationIndexPath(memoryDir), JSON.stringify(stamped, null, 2));\n}\n\n// ─── Correction Reading ──────────────────────────────────────────────────────\n\nexport interface CorrectionMemory {\n id: string;\n content: string;\n created: string;\n confidence: number;\n entityRefs: string[];\n tags: string[];\n}\n\nconst CALIBRATION_RULE_TYPES = new Set([\n \"model_tendency\",\n \"user_expectation\",\n \"scope_boundary\",\n \"verification_required\",\n]);\n\nfunction parseConfidence(value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return undefined;\n return Math.max(0, Math.min(1, value));\n}\n\nfunction parseEvidenceIds(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.filter((item): item is string => typeof item === \"string\" && item.trim().length > 0);\n}\n\nfunction nonEmptyString(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\n/**\n * Exported for entity-contamination R-11 regression coverage (#682\n * PR 2/3 — codex review). Tests can drive the real correction-reading\n * path instead of duplicating the regex inline, so calibration parser\n * regressions surface via the contamination suite.\n */\nexport async function readCalibrationCorrections(memoryDir: string): Promise<CorrectionMemory[]> {\n return readCorrectionsImpl(memoryDir);\n}\n\nasync function readCorrections(memoryDir: string): Promise<CorrectionMemory[]> {\n return readCorrectionsImpl(memoryDir);\n}\n\nasync function readCorrectionsImpl(memoryDir: string): Promise<CorrectionMemory[]> {\n const correctionsDir = path.join(memoryDir, \"corrections\");\n const files = await listJsonFiles(correctionsDir).catch(() => {\n // Corrections might be in facts/ directories too\n return [] as string[];\n });\n\n // Also scan facts directories for correction-category files\n const factsDir = path.join(memoryDir, \"facts\");\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const dayDirs = (await readdir(factsDir)).filter((d: string) => /^\\d{4}-\\d{2}-\\d{2}$/.test(d));\n for (const day of dayDirs) {\n const dayPath = path.join(factsDir, day);\n const dayFiles = (await readdir(dayPath))\n .filter((f: string) => f.startsWith(\"correction-\") && f.endsWith(\".md\"))\n .map((f: string) => path.join(dayPath, f));\n files.push(...dayFiles);\n }\n } catch {\n // facts dir might not exist\n }\n\n // Also check the dedicated corrections directory\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const corrFiles = (await readdir(correctionsDir))\n .filter((f: string) => f.endsWith(\".md\"))\n .map((f: string) => path.join(correctionsDir, f));\n files.push(...corrFiles);\n } catch {\n // corrections dir might not exist\n }\n\n const corrections: CorrectionMemory[] = [];\n const seen = new Set<string>();\n\n for (const filePath of files) {\n try {\n const raw = await readFile(filePath, \"utf8\");\n\n // Parse frontmatter\n const fmMatch = raw.match(/^---\\n([\\s\\S]*?)\\n---\\n([\\s\\S]*)$/);\n if (!fmMatch) continue;\n\n const content = fmMatch[2].trim();\n if (!content || content.length < 10) continue;\n\n // Extract id from frontmatter\n const idMatch = fmMatch[1].match(/^id:\\s*(.+)$/m);\n const id = idMatch?.[1]?.trim() ?? path.basename(filePath, \".md\");\n\n if (seen.has(id)) continue;\n seen.add(id);\n\n const confMatch = fmMatch[1].match(/^confidence:\\s*(.+)$/m);\n const confidence = confMatch ? parseFloat(confMatch[1]) : 0.9;\n\n const entityMatch = fmMatch[1].match(/^entityRef:\\s*(.+)$/m);\n const entityRefs = entityMatch ? [entityMatch[1].trim()] : [];\n\n corrections.push({ id, content, created: \"\", confidence, entityRefs, tags: [] });\n } catch {\n // skip unparseable files\n }\n }\n\n return corrections;\n}\n\n// ─── LLM-Assisted Clustering and Replay ──────────────────────────────────────\n\nexport const CLUSTER_PROMPT = `You are analyzing user corrections to an AI assistant. Each correction represents a moment where the assistant's prediction of what the user wanted was WRONG.\n\nYour job: Group these corrections into clusters where the SAME TYPE of misunderstanding is happening. Then for each cluster, synthesize a CalibrationRule.\n\nA CalibrationRule describes:\n- condition: When does this type of mistake happen?\n- modelTendency: What does the model tend to assume or do wrong?\n- userExpectation: What does the user actually want instead?\n- calibration: How should the model adjust its behavior?\n- ruleType: One of \"model_tendency\", \"user_expectation\", \"scope_boundary\", \"verification_required\"\n\nFocus on PATTERNS, not individual corrections. A cluster needs at least 2 corrections to be worth a rule.\n${OUTPUT_LANGUAGE_POLICY}\n\nOutput valid JSON only:\n{\n \"rules\": [\n {\n \"ruleType\": \"model_tendency\",\n \"condition\": \"When discussing project scope or task boundaries\",\n \"modelTendency\": \"The model tends to assume broader scope than the user intends\",\n \"userExpectation\": \"The user prefers narrow, specific task definitions and wants to be asked before scope expansion\",\n \"calibration\": \"When uncertain about scope, ask for clarification rather than assuming. Default to the narrower interpretation.\",\n \"confidence\": 0.85,\n \"evidenceIds\": [\"correction-id-1\", \"correction-id-2\"]\n }\n ]\n}`;\n\ninterface CalibrationChatClient {\n chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options?: {\n temperature?: number;\n maxTokens?: number;\n agentId?: string;\n modelChain?: AgentPersonaModelConfig;\n }\n ): Promise<{ content?: string | null } | null>;\n}\n\ninterface CalibrationLlmOptions {\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n /** Plugin config. Supplies `localLlm*` settings when the gateway chain is empty. */\n pluginConfig?: PluginConfig;\n}\n\nfunction resolveCalibrationChatClient(options: CalibrationLlmOptions): CalibrationChatClient | null {\n const gateway = new FallbackLlmClient(options.gatewayConfig, {\n workspaceDir: options.workspaceDir,\n });\n if (gateway.isAvailable({ agentId: options.gatewayAgentId, modelChain: options.modelChain })) {\n return gateway;\n }\n const pluginConfig = options.pluginConfig;\n if (pluginConfig && resolveLocalLlmCapabilities(pluginConfig).localLlm) {\n log.info(`[calibration] using configured local LLM (model=${pluginConfig.localLlmModel})`);\n const local = new LocalLlmClient(pluginConfig);\n return {\n chatCompletion(messages, chatOptions) {\n return local.chatCompletion(messages, {\n temperature: chatOptions?.temperature,\n maxTokens: chatOptions?.maxTokens,\n });\n },\n };\n }\n log.warn(\"[calibration] no LLM available — skipping consolidation\");\n return null;\n}\n\nexport async function synthesizeCalibrationRules(\n corrections: CorrectionMemory[],\n llm: CalibrationChatClient,\n existingRules: CalibrationRule[],\n agentId?: string,\n modelChain?: AgentPersonaModelConfig\n): Promise<CalibrationRule[]> {\n if (corrections.length < 2) return [];\n\n // Format corrections for the LLM\n const correctionText = corrections\n .slice(0, 50) // limit to avoid huge prompts\n .map((c, i) => `[${c.id}] ${c.content}`)\n .join(\"\\n\\n\");\n\n const existingRulesText =\n existingRules.length > 0\n ? `\\n\\nExisting calibration rules (avoid duplicating these):\\n${existingRules.map((r) => `- ${r.condition}: ${r.calibration}`).join(\"\\n\")}`\n : \"\";\n\n const response = await llm.chatCompletion(\n [\n { role: \"system\", content: CLUSTER_PROMPT },\n {\n role: \"user\",\n content: `Here are ${corrections.length} corrections from this user:\\n\\n${correctionText}${existingRulesText}`,\n },\n ],\n { temperature: 0.3, maxTokens: 3000, agentId, modelChain }\n );\n\n if (!response?.content) return [];\n\n try {\n let jsonStr = response.content.trim();\n const fenceMatch = jsonStr.match(/```(?:json)?\\s*\\n?([\\s\\S]*?)\\n?\\s*```/);\n if (fenceMatch) jsonStr = fenceMatch[1];\n\n const parsed = JSON.parse(jsonStr);\n if (!Array.isArray(parsed.rules)) return [];\n\n const now = new Date().toISOString();\n const rawRules: unknown[] = Array.isArray(parsed.rules) ? parsed.rules : [];\n return rawRules\n .map((r: unknown): CalibrationRule | undefined => {\n if (!r || typeof r !== \"object\" || Array.isArray(r)) return undefined;\n const raw = r as Record<string, unknown>;\n const ruleType = nonEmptyString(raw.ruleType);\n const condition = nonEmptyString(raw.condition);\n const modelTendency = nonEmptyString(raw.modelTendency);\n const calibration = nonEmptyString(raw.calibration);\n const confidence = parseConfidence(raw.confidence);\n if (\n !ruleType ||\n !CALIBRATION_RULE_TYPES.has(ruleType) ||\n !condition ||\n !modelTendency ||\n !calibration ||\n confidence === undefined\n ) {\n return undefined;\n }\n const evidenceCorrectionIds = parseEvidenceIds(raw.evidenceIds);\n return {\n id: `cal-${createHash(\"sha256\")\n .update(condition + calibration)\n .digest(\"hex\")\n .slice(0, 12)}`,\n ruleType: ruleType as CalibrationRule[\"ruleType\"],\n condition,\n modelTendency,\n userExpectation: nonEmptyString(raw.userExpectation) ?? \"\",\n calibration,\n confidence,\n evidenceCount: evidenceCorrectionIds.length,\n evidenceCorrectionIds,\n createdAt: now,\n lastReinforcedAt: now,\n };\n })\n .filter((rule): rule is CalibrationRule => !!rule);\n } catch {\n log.warn(\"[calibration] failed to parse LLM response\");\n return [];\n }\n}\n\n// ─── Recall Section ──────────────────────────────────────────────────────────\n\n/**\n * Build a recall section from calibration rules relevant to the current query.\n * Uses the LLM to select which rules apply to the current context.\n */\nexport function buildCalibrationRecallSection(\n rules: CalibrationRule[],\n query: string,\n maxChars: number = 1200,\n): string | null {\n if (rules.length === 0) return null;\n\n // Simple relevance: include all rules (they're already filtered to this user)\n // In production, could use embedding similarity to filter\n const lines: string[] = [\n \"## Model Calibration (learned from past corrections)\",\n \"\",\n \"Adjustments for this specific user, learned from patterns in their corrections:\",\n \"\",\n ];\n\n let totalChars = lines.join(\"\\n\").length;\n\n for (const rule of rules) {\n const line = `- **${rule.condition}**: ${rule.modelTendency} → Instead: ${rule.calibration}`;\n if (totalChars + line.length + 1 > maxChars) break;\n lines.push(line);\n totalChars += line.length + 1;\n }\n\n if (lines.length <= 4) return null;\n lines.push(\"\");\n return lines.join(\"\\n\");\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Options weekly compounding passes into calibration. Gateway agent and task\n * chain fields stay limited to `modelSource: \"gateway\"`. `pluginConfig` carries\n * the `localLlm*` settings used when that chain is empty.\n */\nexport function calibrationConsolidationInput(config: PluginConfig): {\n memoryDir: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig: PluginConfig;\n} {\n const gateway = config.modelSource === \"gateway\";\n return {\n memoryDir: config.memoryDir,\n gatewayConfig: config.gatewayConfig,\n gatewayAgentId: gateway ? (config.gatewayAgentId || undefined) : undefined,\n modelChain: gateway ? config.taskModelChain : undefined,\n workspaceDir: config.workspaceDir,\n pluginConfig: config,\n };\n}\n\n/**\n * Run the full calibration pipeline:\n * 1. Read all corrections\n * 2. Send to LLM for clustering and rule synthesis\n * 3. Merge with existing rules\n * 4. Write updated index\n */\nexport async function runCalibrationConsolidation(options: {\n memoryDir: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n /**\n * When set, a week whose reinforcement is already in the index is returned\n * as-is. Weekly synthesis passes the ISO week id so a retry after a later\n * artifact failure does not count the same corrections twice.\n */\n idempotencyKey?: string;\n}): Promise<CalibrationRule[]> {\n try {\n const idempotencyKey = appliedCalibrationWeekId(options.idempotencyKey);\n const existingIndex = await readCalibrationIndex(options.memoryDir);\n if (idempotencyKey && (existingIndex.appliedWeekIds ?? []).includes(idempotencyKey)) {\n log.debug(`[calibration] week ${idempotencyKey} already applied — skipping`);\n return existingIndex.rules;\n }\n\n const llm = resolveCalibrationChatClient(options);\n if (!llm) return [];\n\n const corrections = await readCorrections(options.memoryDir);\n if (corrections.length < 3) {\n log.info(`[calibration] only ${corrections.length} corrections — need at least 3`);\n return [];\n }\n\n const newRules = await synthesizeCalibrationRules(\n corrections,\n llm,\n existingIndex.rules,\n options.gatewayAgentId,\n options.modelChain\n );\n if (newRules.length === 0) {\n log.info(\"[calibration] no new calibration rules synthesized\");\n return existingIndex.rules;\n }\n\n // Merge: keep existing rules, add new ones (deduplicate by id)\n const ruleMap = new Map(existingIndex.rules.map((r) => [r.id, r]));\n for (const rule of newRules) {\n if (ruleMap.has(rule.id)) {\n // Reinforce existing rule\n const existing = ruleMap.get(rule.id)!;\n existing.lastReinforcedAt = new Date().toISOString();\n existing.evidenceCount += rule.evidenceCount;\n existing.confidence = Math.min(1, existing.confidence + 0.05);\n } else {\n ruleMap.set(rule.id, rule);\n }\n }\n\n const allRules = [...ruleMap.values()];\n await writeCalibrationIndex(options.memoryDir, withAppliedCalibrationWeek({\n rules: allRules,\n updatedAt: existingIndex.updatedAt,\n totalCorrectionsAnalyzed: corrections.length,\n appliedWeekIds: existingIndex.appliedWeekIds,\n }, idempotencyKey));\n\n log.debug(`[calibration] synthesized ${newRules.length} new rule(s), ${allRules.length} total`);\n return allRules;\n } catch (error) {\n log.warn(\n `[calibration] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`\n );\n return [];\n }\n}\n\n/**\n * Standalone entry point for calibration consolidation that can be called\n * independently of weekly compounding. The compounding engine's\n * `synthesizeWeekly()` is one trigger, but orchestrators or periodic\n * maintenance jobs should call this directly so calibration is not gated\n * on weekly compounding being enabled.\n */\nexport async function runCalibrationIfEnabled(options: {\n memoryDir: string;\n calibrationEnabled: boolean;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n}): Promise<CalibrationRule[]> {\n if (!options.calibrationEnabled) {\n return [];\n }\n return runCalibrationConsolidation({\n memoryDir: options.memoryDir,\n gatewayConfig: options.gatewayConfig,\n gatewayAgentId: options.gatewayAgentId,\n modelChain: options.modelChain,\n workspaceDir: options.workspaceDir,\n pluginConfig: options.pluginConfig,\n });\n}\n\n/**\n * Get calibration rules for recall injection.\n * Reads the pre-computed calibration index.\n */\nexport async function getCalibrationRulesForRecall(\n memoryDir: string,\n): Promise<CalibrationRule[]> {\n const index = await readCalibrationIndex(memoryDir);\n return index.rules;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,kBAAkB;AAC3B,SAAS,OAAO,gBAAgB;AAChC,OAAO,UAAU;AAwCjB,SAAS,eAAe,WAA2B;AACjD,SAAO,KAAK,KAAK,WAAW,SAAS,aAAa;AACpD;AAEA,SAAS,qBAAqB,WAA2B;AACvD,SAAO,KAAK,KAAK,eAAe,SAAS,GAAG,wBAAwB;AACtE;AAGA,IAAM,6BAA6B;AAE5B,SAAS,yBAAyB,OAAoC;AAC3E,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,QAAQ,WAAW,KAAK,QAAQ,SAAS,2BAA4B,QAAO;AAChF,SAAO;AACT;AAEA,eAAsB,qBAAqB,WAA8C;AACvF,MAAI;AACF,UAAM,MAAM,KAAK,MAAM,MAAM,SAAS,qBAAqB,SAAS,GAAG,MAAM,CAAC;AAC9E,UAAM,iBAAiB,wBAAwB,IAAI,gBAAgB,IAAI,aAAa;AACpF,WAAO;AAAA,MACL,OAAO,MAAM,QAAQ,IAAI,KAAK,IAAI,IAAI,QAAQ,CAAC;AAAA,MAC/C,WAAW,OAAO,IAAI,cAAc,WAAW,IAAI,aAAY,oBAAI,KAAK,GAAE,YAAY;AAAA,MACtF,0BAA0B,OAAO,IAAI,6BAA6B,WAAW,IAAI,2BAA2B;AAAA,MAC5G,GAAI,eAAe,SAAS,IAAI,EAAE,eAAe,IAAI,CAAC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,UAAU,OAAO,KAAK,CAAC;AAAA,IAC3G;AACA,WAAO,CAAC;AAAA,EACV;AACF;AASA,eAAsB,wBAAwB,SAQf;AAC7B,MAAI,CAAC,QAAQ,oBAAoB;AAC/B,WAAO,CAAC;AAAA,EACV;AACA,SAAO,4BAA4B;AAAA,IACjC,WAAW,QAAQ;AAAA,IACnB,eAAe,QAAQ;AAAA,IACvB,gBAAgB,QAAQ;AAAA,IACxB,YAAY,QAAQ;AAAA,IACpB,cAAc,QAAQ;AAAA,IACtB,cAAc,QAAQ;AAAA,EACxB,CAAC;AACH;AAMA,eAAsB,6BACpB,WAC4B;AAC5B,QAAM,QAAQ,MAAM,qBAAqB,SAAS;AAClD,SAAO,MAAM;AACf;","names":[]}
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -452,8 +452,9 @@ export interface ConsolidationCapabilitySet {
|
|
|
452
452
|
readonly compoundingSemantic: boolean;
|
|
453
453
|
/** `abstractionAnchorsEnabled` — abstraction-anchor extraction. */
|
|
454
454
|
readonly abstractionAnchors: boolean;
|
|
455
|
-
/** `compoundingEnabled`
|
|
455
|
+
/** `compoundingEnabled` master switch; `compoundingWeeklyCronEnabled` daemon weekly run. */
|
|
456
456
|
readonly compounding: boolean;
|
|
457
|
+
readonly compoundingWeeklyCron: boolean;
|
|
457
458
|
/** `calibrationEnabled` — memory calibration pass. */
|
|
458
459
|
readonly calibration: boolean;
|
|
459
460
|
/** `semanticConsolidationEnabled` — semantic consolidation pass. */
|
|
@@ -468,7 +469,7 @@ export interface ConsolidationCapabilitySet {
|
|
|
468
469
|
/**
|
|
469
470
|
* Config projection consumed by {@link resolveConsolidationCapabilities}.
|
|
470
471
|
*/
|
|
471
|
-
export type ConsolidationConfigProjection = Pick<PluginConfig, "compoundingSemanticEnabled" | "abstractionAnchorsEnabled" | "compoundingEnabled" | "calibrationEnabled" | "semanticConsolidationEnabled" | "patternReinforcementEnabled" | "continuityAuditEnabled" | "graphEdgeDecayEnabled">;
|
|
472
|
+
export type ConsolidationConfigProjection = Pick<PluginConfig, "compoundingSemanticEnabled" | "abstractionAnchorsEnabled" | "compoundingEnabled" | "compoundingWeeklyCronEnabled" | "calibrationEnabled" | "semanticConsolidationEnabled" | "patternReinforcementEnabled" | "continuityAuditEnabled" | "graphEdgeDecayEnabled">;
|
|
472
473
|
/**
|
|
473
474
|
* Resolve the {@link ConsolidationCapabilitySet} from parsed config.
|
|
474
475
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAE7E;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,yEAAyE;IACzE,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,yEAAyE;IACzE,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,2EAA2E;IAC3E,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,uEAAuE;IACvE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,yBAAyB,EAAE,OAAO,CAAC;IAC5C,kEAAkE;IAClE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,+EAA+E;IAC/E,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,qEAAqE;IACrE,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACvC,gFAAgF;IAChF,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACx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AO,CAAC;IAC5C,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;IAC7C,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;IAC7C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG,IAAI,CACpD,YAAY,EACV,sBAAsB,GACtB,sBAAsB,GACtB,6BAA6B,GAC7B,kCAAkC,GAClC,mCAAmC,GACnC,4BAA4B,GAC5B,yBAAyB,GACzB,mCAAmC,GACnC,kBAAkB,GAClB,8BAA8B,GAC9B,yBAAyB,CAC5B,CAAC;AAEF;;GAEG;AACH,wBAAgB,sCAAsC,CAAC,MAAM,EAAE,mCAAmC,GAAG,gCAAgC,CAcpI"}
|
package/dist/capabilities.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
resolveRecallEnhancementCapabilities,
|
|
21
21
|
resolveSecurityCapabilities,
|
|
22
22
|
resolveUtilityLearningCapabilities
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-C5LWPYS3.js";
|
|
24
24
|
import "./chunk-PZ5AY32C.js";
|
|
25
25
|
export {
|
|
26
26
|
resolveAccessSetupCapabilities,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVersion
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3GYSZHMT.js";
|
|
4
4
|
import {
|
|
5
5
|
bumpMemoryCorpusVersionForDir
|
|
6
6
|
} from "./chunk-M5GVCJSJ.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
repairContentAfterJournalMove,
|
|
14
14
|
requestEntityCanonicalIdReconcile,
|
|
15
15
|
withRawEntityPageMutation
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-NZFFGO5O.js";
|
|
17
17
|
import "./chunk-5WITETWU.js";
|
|
18
18
|
import "./chunk-6CIAGZ6X.js";
|
|
19
19
|
import "./chunk-7CT3AI52.js";
|
|
@@ -29,8 +29,9 @@ import {
|
|
|
29
29
|
isPathInsideRoot,
|
|
30
30
|
sha256String
|
|
31
31
|
} from "./chunk-GCGJW34D.js";
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-5B5WYAHQ.js";
|
|
33
|
+
import "./chunk-PGRZ3FYC.js";
|
|
34
|
+
import "./chunk-BTTPKDIL.js";
|
|
34
35
|
import "./chunk-VS2IYZRU.js";
|
|
35
36
|
import "./chunk-KNA3BXXL.js";
|
|
36
37
|
import "./chunk-3WCASNQZ.js";
|
|
@@ -279,4 +280,4 @@ async function readLocalFile(absPath) {
|
|
|
279
280
|
export {
|
|
280
281
|
mergeCapsule
|
|
281
282
|
};
|
|
282
|
-
//# sourceMappingURL=capsule-merge-
|
|
283
|
+
//# sourceMappingURL=capsule-merge-LGYURS3C.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/transfer/capsule-merge.ts"],"sourcesContent":["import { lstat, mkdir, readFile, realpath, stat, unlink, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { gunzipSync } from \"node:zlib\";\nimport { bumpMemoryCorpusVersionForDir } from \"../memory-corpus-version.js\";\nimport {\n HistoricalEntityCanonicalIdCache,\n canonicalizeEntityRefFrontmatter,\n readEntityRefFromFrontmatter,\n classifyEntityRefWritePath,\n repairContentAfterJournalMove,\n requestEntityCanonicalIdReconcile,\n} from \"../storage/entity-canonical-id-references.js\";\nimport { withRawEntityPageMutation } from \"../storage/entity-canonical-id-lock.js\";\nimport {\n createVersion,\n type VersioningConfig,\n type VersioningLogger,\n} from \"../page-versioning.js\";\nimport {\n assertIsDirectoryNotSymlink,\n assertRealpathInsideRoot,\n fromPosixRelPath,\n isPathInsideRoot,\n sha256String,\n} from \"./fs-utils.js\";\nimport {\n parseExportBundle,\n type CapsuleBlock,\n type ExportManifestV2,\n type ExportMemoryRecordV1,\n} from \"./types.js\";\n\n/**\n * Three-way conflict-resolution mode for {@link mergeCapsule}.\n *\n * A \"conflict\" is defined as: the same memory-file path exists in both the\n * source archive and the target directory AND the content hash of the local\n * file differs from the archive's manifest entry for that path.\n *\n * Files that exist only in the archive (no local counterpart) are always\n * written regardless of mode — there is no conflict to resolve.\n *\n * Files that are byte-identical (same content hash in both locations) are\n * recorded as {@link MergeCapsuleResult.skipped} with reason `\"identical\"` and\n * are never re-written regardless of mode; this is a no-op optimisation rather\n * than a conflict.\n *\n * - `\"skip-conflicts\"` (default) — log the conflict, skip the conflicting\n * archive entries, but continue importing non-conflicting entries. The\n * resulting merge is the union of:\n * - all non-conflicting archive files (written to target)\n * - all pre-existing local files (left unchanged)\n *\n * - `\"prefer-source\"` — for conflicting files, snapshot the local content via\n * page-versioning (gotcha #54: snapshot before overwrite) then overwrite\n * with the archive content.\n *\n * - `\"prefer-local\"` — for conflicting files, keep the local content; the\n * archive entry is skipped.\n */\nexport type MergeCapsuleConflictMode =\n | \"skip-conflicts\"\n | \"prefer-source\"\n | \"prefer-local\";\n\n/**\n * Options accepted by {@link mergeCapsule}.\n *\n * `sourceArchive` — absolute or cwd-relative path to a `.capsule.json.gz`\n * archive produced by `exportCapsule`. Must be a V2 bundle.\n *\n * `targetRoot` — absolute or cwd-relative path to the memory directory that\n * receives the merged records. Must be an existing, non-symlink directory.\n *\n * `conflictMode` — see {@link MergeCapsuleConflictMode}. Defaults to\n * `\"skip-conflicts\"`.\n *\n * `versioning` — optional page-versioning config forwarded to\n * {@link createVersion} in `\"prefer-source\"` mode. When omitted or disabled,\n * overwrites proceed without snapshotting (not recommended for production).\n *\n * `log` — optional logger forwarded to {@link createVersion}.\n */\nexport interface MergeCapsuleOptions {\n sourceArchive: string;\n targetRoot: string;\n conflictMode?: MergeCapsuleConflictMode;\n versioning?: VersioningConfig;\n log?: VersioningLogger;\n}\n\nexport interface MergeCapsuleWrittenRecord {\n /** Capsule-relative posix path. */\n sourcePath: string;\n /** Memory-dir-relative posix path written on disk. */\n targetPath: string;\n /** Whether a page-versioning snapshot was taken before overwriting. */\n snapshotted: boolean;\n}\n\nexport interface MergeCapsuleSkippedRecord {\n /** Capsule-relative posix path. */\n path: string;\n /**\n * Why the archive entry was not written.\n *\n * `\"conflict\"` — the entry existed locally with different content and the\n * active mode did not resolve the conflict with a write (`\"skip-conflicts\"` /\n * `\"prefer-local\"`).\n *\n * `\"identical\"` — the entry's content hash matches what is already on disk;\n * no write is needed.\n */\n reason: \"conflict\" | \"identical\";\n}\n\nexport interface MergeCapsuleConflictRecord {\n /** Capsule-relative posix path of the conflicting entry. */\n path: string;\n /** SHA-256 of the archive's copy. */\n archiveSha256: string;\n /** SHA-256 of the local copy. */\n localSha256: string;\n}\n\nexport interface MergeCapsuleResult {\n /** Records that were written to the target directory. */\n merged: MergeCapsuleWrittenRecord[];\n /**\n * Records that were NOT written (conflict skipped, or byte-identical).\n * Includes conflicts that were resolved by `\"prefer-local\"`.\n */\n skipped: MergeCapsuleSkippedRecord[];\n /**\n * Metadata about every detected conflict, regardless of which mode resolved\n * it. Callers can use this to report \"N conflicts encountered; M overwritten\".\n */\n conflicts: MergeCapsuleConflictRecord[];\n /** The manifest decoded from the archive. */\n manifest: ExportManifestV2;\n}\n\n// ---------------------------------------------------------------------------\n// Main entry point\n// ---------------------------------------------------------------------------\n\n/**\n * Merge a V2 capsule archive into an existing memory directory using\n * three-way conflict semantics.\n *\n * Sequence:\n * 1. Read + gunzip + JSON.parse the archive.\n * 2. Validate through `parseExportBundle` (V1 rejected).\n * 3. Verify every record's content sha256 against the manifest.\n * Any mismatch aborts BEFORE any file is written (gotcha #25).\n * 4. Classify each record as: new (no local copy), identical (same hash),\n * or conflicting (different hash).\n * 5. Apply the selected {@link MergeCapsuleConflictMode} to conflicting\n * entries; always write new entries; always skip identical entries.\n *\n * Determinism: `merged`, `skipped`, and `conflicts` are all returned sorted\n * by `path`/`sourcePath` so callers get stable output regardless of bundle\n * order.\n */\nexport async function mergeCapsule(\n opts: MergeCapsuleOptions,\n): Promise<MergeCapsuleResult> {\n const archiveAbs = path.resolve(opts.sourceArchive);\n const rootAbs = path.resolve(opts.targetRoot);\n\n await assertIsDirectoryNotSymlink(rootAbs, \"mergeCapsule\", \"targetRoot\");\n\n const conflictMode: MergeCapsuleConflictMode =\n opts.conflictMode ?? \"skip-conflicts\";\n\n // Rule 51: reject invalid conflictMode values up-front before any I/O.\n if (\n conflictMode !== \"skip-conflicts\" &&\n conflictMode !== \"prefer-source\" &&\n conflictMode !== \"prefer-local\"\n ) {\n throw new Error(\n `mergeCapsule: unknown conflictMode ${JSON.stringify(conflictMode)}; ` +\n `expected \"skip-conflicts\", \"prefer-source\", or \"prefer-local\"`,\n );\n }\n\n // ---------------------------------------------------------------------------\n // Parse + validate archive\n // ---------------------------------------------------------------------------\n\n const raw = await readFile(archiveAbs);\n let json: string;\n try {\n json = gunzipSync(raw).toString(\"utf-8\");\n } catch (cause) {\n throw new Error(\n `mergeCapsule: archive is not a valid gzip file: ${archiveAbs}`,\n { cause: cause as Error },\n );\n }\n\n let parsedJson: unknown;\n try {\n parsedJson = JSON.parse(json);\n } catch (cause) {\n throw new Error(\n `mergeCapsule: archive is not valid JSON after gunzip: ${archiveAbs}`,\n { cause: cause as Error },\n );\n }\n\n const parsed = parseExportBundle(parsedJson);\n if (parsed.capsuleVersion !== 2) {\n throw new Error(\n \"mergeCapsule: archive is V1; only V2 capsule archives are supported\",\n );\n }\n\n const bundle = parsed.bundle as {\n manifest: ExportManifestV2;\n records: ExportMemoryRecordV1[];\n };\n const manifest = bundle.manifest;\n const capsule = manifest.capsule;\n\n // Build path → manifest entry index for O(1) checksum lookup.\n const manifestIndex = new Map<string, ExportManifestV2[\"files\"][number]>();\n for (const f of manifest.files) {\n manifestIndex.set(f.path, f);\n }\n if (manifestIndex.size !== manifest.files.length) {\n throw new Error(\"mergeCapsule: manifest contains duplicate file paths\");\n }\n\n const recordPaths = new Set<string>();\n for (const rec of bundle.records) {\n if (recordPaths.has(rec.path)) {\n throw new Error(\n `mergeCapsule: bundle contains duplicate record path: ${rec.path}`,\n );\n }\n recordPaths.add(rec.path);\n }\n\n // ---------------------------------------------------------------------------\n // Phase 1: verify checksums + validate paths before ANY filesystem mutation.\n // (gotcha #25: don't destroy old state before confirming new state succeeds)\n // ---------------------------------------------------------------------------\n\n const rootReal = await realpath(rootAbs).catch(() => rootAbs);\n\n // Tracks normalized, case-folded target paths seen so far in phase 1. Maps\n // targetAbs.toLowerCase() → first source path so the collision error can name\n // both offending entries. Two manifest entries whose computed target paths\n // normalise to the same absolute path (e.g. `subdir/file.md` and\n // `subdir/./file.md`, or differing case on case-insensitive filesystems such\n // as macOS and Windows) would both refer to the same inode. In\n // `skip-conflicts`/`prefer-local` modes one entry would be misclassified as a\n // local conflict against the OTHER entry's just-written content; in\n // `prefer-source` the second entry would silently overwrite the first. We\n // reject the import up-front before any write (Codex P2 thread on PR #748,\n // mirroring `capsule-import.ts`).\n const seenTargetPaths = new Map<string, string>();\n\n for (const rec of bundle.records) {\n // Checksum validation.\n const entry = manifestIndex.get(rec.path);\n if (!entry) {\n throw new Error(\n `mergeCapsule: archive checksum mismatch (record without manifest entry: ${rec.path})`,\n );\n }\n const { sha256, bytes } = sha256String(rec.content);\n if (sha256 !== entry.sha256 || bytes !== entry.bytes) {\n throw new Error(\n `mergeCapsule: archive checksum mismatch for ${rec.path}: ` +\n `expected sha256=${entry.sha256} bytes=${entry.bytes}, ` +\n `got sha256=${sha256} bytes=${bytes}`,\n );\n }\n\n // Path-traversal validation (mirrors capsule-import.ts).\n if (rec.path.includes(\"\\\\\")) {\n throw new Error(\n `mergeCapsule: record path contains backslash separators (Windows-style paths are not allowed): ${rec.path}`,\n );\n }\n const posixNormalized = path.posix.normalize(rec.path);\n if (\n rec.path.startsWith(\"/\") ||\n rec.path.split(\"/\").some((seg) => seg === \"..\") ||\n posixNormalized.startsWith(\"..\") ||\n posixNormalized.startsWith(\"/\")\n ) {\n throw new Error(\n `mergeCapsule: record path escapes target root: ${rec.path}`,\n );\n }\n\n // Lexical root containment check.\n const targetAbs = path.join(rootReal, fromPosixRelPath(rec.path));\n if (!isPathInsideRoot(rootReal, targetAbs)) {\n throw new Error(\n `mergeCapsule: record path escapes target root: ${rec.path}`,\n );\n }\n\n // Symlink-aware containment check (shared helper from fs-utils).\n await assertRealpathInsideRoot(rootReal, targetAbs, rec.path, \"mergeCapsule\");\n\n // Target-file symlink guard: if the target already exists as a symlink,\n // reject — writes through symlinks can redirect to unexpected locations.\n const targetLstat = await lstat(targetAbs).catch(() => null);\n if (targetLstat !== null && targetLstat.isSymbolicLink()) {\n throw new Error(\n `mergeCapsule: record target is a symlink and cannot be written to safely: ${rec.path}`,\n );\n }\n\n // Duplicate normalized target path detection (Codex P2 #748, mirrors\n // capsule-import.ts). `path.join` already normalises `.` segments\n // (e.g. `subdir/./file.md` → `subdir/file.md`). On case-insensitive\n // filesystems (macOS default, Windows), two paths that differ only in case\n // would resolve to the same inode. We fold the dedup key to lowercase so\n // that `subdir/File.md` and `subdir/file.md` are detected as duplicates\n // before any write occurs. This is intentionally unconditional: the cost\n // of an extra `.toLowerCase()` on case-sensitive filesystems is negligible,\n // and a defensive lowercase is far simpler than probing filesystem\n // case-sensitivity at runtime. Without this guard, prefer-source mode\n // would silently overwrite one entry with the other, and skip-conflicts /\n // prefer-local would misclassify the second entry as a local conflict\n // against the first entry's freshly written content.\n const dedupKey = targetAbs.toLowerCase();\n const firstSourcePath = seenTargetPaths.get(dedupKey);\n if (firstSourcePath !== undefined) {\n throw new Error(\n `mergeCapsule: manifest contains two entries that resolve to the same target path: ` +\n `\"${firstSourcePath}\" and \"${rec.path}\" both map to \"${rec.path}\"`,\n );\n }\n seenTargetPaths.set(dedupKey, rec.path);\n }\n\n // Detect manifest-only entries (missing record). Treat as corruption.\n for (const f of manifest.files) {\n if (!recordPaths.has(f.path)) {\n throw new Error(\n `mergeCapsule: archive checksum mismatch (manifest entry without record: ${f.path})`,\n );\n }\n }\n\n // ---------------------------------------------------------------------------\n // Phase 2: classify records and apply conflict mode.\n // ---------------------------------------------------------------------------\n\n const merged: MergeCapsuleWrittenRecord[] = [];\n const skipped: MergeCapsuleSkippedRecord[] = [];\n const conflicts: MergeCapsuleConflictRecord[] = [];\n // Same write-boundary rule as capsule-import (issue #2213): records land\n // with their entityRef resolved through the target's migration journal,\n // read through the identity-keyed cache PER RECORD so a peer migration\n // completing mid-merge is picked up for every record written after it.\n const journalStateDir = path.join(rootReal, \"state\");\n const historicalIdCache = new HistoricalEntityCanonicalIdCache();\n // Entity pages in THIS capsule can re-establish collisions the target's\n // journal already resolved (Codex P1): once the next migration parks the\n // mapping, a memory canonicalized onto the canonical claimant is\n // permanently misattributed. Memories whose ref targets a capsule-supplied\n // entity id merge byte-faithful behind the reconcile marker instead.\n const capsuleEntityIds = new Set(\n bundle.records\n .filter((record) =>\n classifyEntityRefWritePath(rootReal, path.join(rootReal, fromPosixRelPath(record.path))) === \"entity\")\n .map((record) => path.basename(record.path, \".md\")),\n );\n // Write a record with its entityRef resolved AT the write, then repair if\n // the journal moved across the write itself — a parked mapping cannot be\n // fixed after the fact by the reconcile pass (issue #2213). Only memory-tier\n // records canonicalize; entities/ pages carry relationship TARGETS only\n // rewriteRelationshipTargets understands, so they merge byte-faithful with\n // a reconcile marker; everything else merges losslessly. The corpus bump\n // lands AFTER the repair so a warm cache rescan never captures pre-repair\n // bytes.\n // The reconcile marker is published ONCE, after every record landed\n // (Codex P1, round 21): a per-record marker could be consumed by a peer\n // between a legacy-preserving memory write and its colliding entity page,\n // canonicalizing the memory onto the wrong claimant irreversibly.\n let reconcileNeeded = false;\n const writeCanonicalRecord = async (targetAbs: string, rawContent: string): Promise<void> => {\n const kind = classifyEntityRefWritePath(rootReal, targetAbs);\n const rawRef = kind === \"memory\" ? readEntityRefFromFrontmatter(rawContent) : null;\n if (kind === \"memory\" && rawRef !== null && capsuleEntityIds.has(rawRef)) {\n // Ref targets a capsule-supplied entity page (potential collision\n // claimant): keep the legacy bytes; the deferred marker lets the\n // migration settle the collision and rewrite per its verdict (Codex P1).\n await writeFile(targetAbs, rawContent, \"utf-8\");\n reconcileNeeded = true;\n bumpMemoryCorpusVersionForDir(rootReal); // per-write bump (Cursor Medium, #1902)\n return;\n }\n if (kind !== \"memory\") {\n await writeFile(targetAbs, rawContent, \"utf-8\");\n if (kind === \"entity\") {\n reconcileNeeded = true;\n }\n bumpMemoryCorpusVersionForDir(rootReal); // per-write bump (Cursor Medium, #1902)\n return;\n }\n const idsAtWrite = historicalIdCache.get(journalStateDir);\n const written = canonicalizeEntityRefFrontmatter(rawContent, idsAtWrite);\n // Snapshot the pre-write bytes: a repair failure after the write must\n // restore them (or remove a newly created target) before propagating —\n // the merge reports failure, so disk must return to its pre-write state\n // and warm caches stay consistent (AGENTS.md §14).\n const originalBytes = await readLocalFile(targetAbs);\n await writeFile(targetAbs, written, \"utf-8\");\n try {\n await repairContentAfterJournalMove({\n stateDir: journalStateDir,\n cache: historicalIdCache,\n idsAtWrite,\n rawContent,\n lastWritten: written,\n rewrite: (content) => writeFile(targetAbs, content, \"utf-8\"),\n });\n } catch (err) {\n if (originalBytes === null) {\n await unlink(targetAbs).catch(() => undefined);\n } else {\n await writeFile(targetAbs, originalBytes, \"utf-8\").catch(() => undefined);\n }\n throw err;\n }\n bumpMemoryCorpusVersionForDir(rootReal); // per-write bump (Cursor Medium, #1902)\n };\n\n // Sort by source path for deterministic output (mirrors capsule-import.ts).\n const sortedRecords = [...bundle.records].sort((a, b) =>\n a.path.localeCompare(b.path),\n );\n\n const applyRecords = async (): Promise<void> => {\n for (const rec of sortedRecords) {\n const targetAbs = path.join(rootReal, fromPosixRelPath(rec.path));\n const entry = manifestIndex.get(rec.path)!; // validated above\n\n const localContent = await readLocalFile(targetAbs);\n\n if (localContent === null) {\n // No local copy — always write regardless of mode. Resolve at the write\n // itself and verify the journal afterwards: a peer migration completing\n // during any of these awaits (or the write) would otherwise strand the\n // reference — capsule writes bump only the corpus version, which the\n // migration fingerprint deliberately ignores.\n await mkdir(path.dirname(targetAbs), { recursive: true });\n await writeCanonicalRecord(targetAbs, rec.content);\n merged.push({ sourcePath: rec.path, targetPath: rec.path, snapshotted: false });\n continue;\n }\n\n // Local file exists. A local copy already holding the CANONICALIZED form\n // (computed AFTER the local read, so a journal published during that\n // await is reflected) is done. A local copy matching the RAW archive\n // bytes while a mapping applies is UPGRADED in place — skipping would\n // leave the legacy entityRef on disk forever, since corpus bumps no\n // longer trigger migration rewrites (issue #2213).\n const idsAtCompare = historicalIdCache.get(journalStateDir);\n const compareRef = readEntityRefFromFrontmatter(rec.content);\n const canonicalContent =\n classifyEntityRefWritePath(rootReal, targetAbs) === \"memory\"\n && !(compareRef !== null && capsuleEntityIds.has(compareRef))\n ? canonicalizeEntityRefFrontmatter(rec.content, idsAtCompare)\n : rec.content;\n const { sha256: localSha256 } = sha256String(localContent);\n const canonicalSha256 =\n canonicalContent === rec.content ? entry.sha256 : sha256String(canonicalContent).sha256;\n\n // The identical verdict is only valid for the snapshot it was computed\n // under (Codex P1): a mapping parked/removed mid-compare can make the\n // local copy's formerly-canonical ref stale with nothing left to repair\n // it. A moved journal falls through to the write path, which resolves at\n // the write and repairs after it.\n if (localSha256 === canonicalSha256 && historicalIdCache.get(journalStateDir) === idsAtCompare) {\n skipped.push({ path: rec.path, reason: \"identical\" });\n continue;\n }\n if (localSha256 === canonicalSha256 || localSha256 === entry.sha256) {\n await writeCanonicalRecord(targetAbs, rec.content);\n merged.push({ sourcePath: rec.path, targetPath: rec.path, snapshotted: false });\n continue;\n }\n\n // Content differs → conflict.\n const { sha256: archiveSha256 } = sha256String(rec.content);\n conflicts.push({\n path: rec.path,\n archiveSha256,\n localSha256,\n });\n\n if (conflictMode === \"skip-conflicts\" || conflictMode === \"prefer-local\") {\n // Keep local copy, skip archive entry.\n skipped.push({ path: rec.path, reason: \"conflict\" });\n continue;\n }\n\n // conflictMode === \"prefer-source\": snapshot local then overwrite.\n let snapshotted = false;\n if (opts.versioning && opts.versioning.enabled) {\n // Gotcha #54: snapshot BEFORE overwriting.\n await createVersion(\n targetAbs,\n localContent,\n \"manual\",\n opts.versioning,\n opts.log,\n `capsule-merge: ${capsule.id}`,\n rootReal,\n );\n snapshotted = true;\n }\n\n // Same write-time re-resolve + post-write repair as above — the\n // snapshot/read awaits give a peer migration a real window.\n await writeCanonicalRecord(targetAbs, rec.content);\n merged.push({ sourcePath: rec.path, targetPath: rec.path, snapshotted });\n }\n\n // Every record — including every collision claimant entity page — is on\n // disk; NOW the reconcile pass can settle collisions safely.\n if (reconcileNeeded) {\n await requestEntityCanonicalIdReconcile(journalStateDir);\n }\n };\n const firstEntityId = capsuleEntityIds.values().next().value;\n if (firstEntityId === undefined) {\n await applyRecords();\n } else {\n await withRawEntityPageMutation(\n rootReal,\n path.join(rootReal, \"entities\", `${firstEntityId}.md`),\n applyRecords,\n );\n }\n\n // Sort output lists for determinism.\n merged.sort((a, b) => a.sourcePath.localeCompare(b.sourcePath));\n skipped.sort((a, b) => a.path.localeCompare(b.path));\n conflicts.sort((a, b) => a.path.localeCompare(b.path));\n\n // Per-write corpus bumps happen inside the loop above (Cursor Medium, #1902):\n // a concurrent readAllMemories during the merge rescans and never serves the\n // pre-merge corpus mid-batch.\n\n return { merged, skipped, conflicts, manifest };\n}\n\n// ---------------------------------------------------------------------------\n// Private helpers\n// ---------------------------------------------------------------------------\n\nasync function readLocalFile(absPath: string): Promise<string | null> {\n const st = await stat(absPath).catch(() => null);\n if (!st || !st.isFile()) return null;\n return readFile(absPath, \"utf-8\");\n}\n\n// Re-export CapsuleBlock so callers don't need a deep import from types.ts.\nexport type { CapsuleBlock };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;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;AAAA,UACA;AAAA,UACA;AAAA,UACA,KAAK;AAAA,UACL,KAAK;AAAA,UACL,kBAAkB,QAAQ,EAAE;AAAA,UAC5B;AAAA,QACF;AACA,sBAAc;AAAA,MAChB;AAIA,YAAM,qBAAqB,WAAW,IAAI,OAAO;AACjD,aAAO,KAAK,EAAE,YAAY,IAAI,MAAM,YAAY,IAAI,MAAM,YAAY,CAAC;AAAA,IACzE;AAIA,QAAI,iBAAiB;AACnB,YAAM,kCAAkC,eAAe;AAAA,IACzD;AAAA,EACA;AACA,QAAM,gBAAgB,iBAAiB,OAAO,EAAE,KAAK,EAAE;AACvD,MAAI,kBAAkB,QAAW;AAC/B,UAAM,aAAa;AAAA,EACrB,OAAO;AACL,UAAM;AAAA,MACJ;AAAA,MACA,KAAK,KAAK,UAAU,YAAY,GAAG,aAAa,KAAK;AAAA,MACrD;AAAA,IACF;AAAA,EACF;AAGA,SAAO,KAAK,CAAC,GAAG,MAAM,EAAE,WAAW,cAAc,EAAE,UAAU,CAAC;AAC9D,UAAQ,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;AACnD,YAAU,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;AAMrD,SAAO,EAAE,QAAQ,SAAS,WAAW,SAAS;AAChD;AAMA,eAAe,cAAc,SAAyC;AACpE,QAAM,KAAK,MAAM,KAAK,OAAO,EAAE,MAAM,MAAM,IAAI;AAC/C,MAAI,CAAC,MAAM,CAAC,GAAG,OAAO,EAAG,QAAO;AAChC,SAAO,SAAS,SAAS,OAAO;AAClC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/transfer/capsule-merge.ts"],"sourcesContent":["import { lstat, mkdir, readFile, realpath, stat, unlink, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { gunzipSync } from \"node:zlib\";\nimport { bumpMemoryCorpusVersionForDir } from \"../memory-corpus-version.js\";\nimport {\n HistoricalEntityCanonicalIdCache,\n canonicalizeEntityRefFrontmatter,\n readEntityRefFromFrontmatter,\n classifyEntityRefWritePath,\n repairContentAfterJournalMove,\n requestEntityCanonicalIdReconcile,\n} from \"../storage/entity-canonical-id-references.js\";\nimport { withRawEntityPageMutation } from \"../storage/entity-canonical-id-lock.js\";\nimport {\n createVersion,\n type VersioningConfig,\n type VersioningLogger,\n} from \"../page-versioning.js\";\nimport {\n assertIsDirectoryNotSymlink,\n assertRealpathInsideRoot,\n fromPosixRelPath,\n isPathInsideRoot,\n sha256String,\n} from \"./fs-utils.js\";\nimport {\n parseExportBundle,\n type CapsuleBlock,\n type ExportManifestV2,\n type ExportMemoryRecordV1,\n} from \"./types.js\";\n\n/**\n * Three-way conflict-resolution mode for {@link mergeCapsule}.\n *\n * A \"conflict\" is defined as: the same memory-file path exists in both the\n * source archive and the target directory AND the content hash of the local\n * file differs from the archive's manifest entry for that path.\n *\n * Files that exist only in the archive (no local counterpart) are always\n * written regardless of mode — there is no conflict to resolve.\n *\n * Files that are byte-identical (same content hash in both locations) are\n * recorded as {@link MergeCapsuleResult.skipped} with reason `\"identical\"` and\n * are never re-written regardless of mode; this is a no-op optimisation rather\n * than a conflict.\n *\n * - `\"skip-conflicts\"` (default) — log the conflict, skip the conflicting\n * archive entries, but continue importing non-conflicting entries. The\n * resulting merge is the union of:\n * - all non-conflicting archive files (written to target)\n * - all pre-existing local files (left unchanged)\n *\n * - `\"prefer-source\"` — for conflicting files, snapshot the local content via\n * page-versioning (gotcha #54: snapshot before overwrite) then overwrite\n * with the archive content.\n *\n * - `\"prefer-local\"` — for conflicting files, keep the local content; the\n * archive entry is skipped.\n */\nexport type MergeCapsuleConflictMode =\n | \"skip-conflicts\"\n | \"prefer-source\"\n | \"prefer-local\";\n\n/**\n * Options accepted by {@link mergeCapsule}.\n *\n * `sourceArchive` — absolute or cwd-relative path to a `.capsule.json.gz`\n * archive produced by `exportCapsule`. Must be a V2 bundle.\n *\n * `targetRoot` — absolute or cwd-relative path to the memory directory that\n * receives the merged records. Must be an existing, non-symlink directory.\n *\n * `conflictMode` — see {@link MergeCapsuleConflictMode}. Defaults to\n * `\"skip-conflicts\"`.\n *\n * `versioning` — optional page-versioning config forwarded to\n * {@link createVersion} in `\"prefer-source\"` mode. When omitted or disabled,\n * overwrites proceed without snapshotting (not recommended for production).\n *\n * `log` — optional logger forwarded to {@link createVersion}.\n */\nexport interface MergeCapsuleOptions {\n sourceArchive: string;\n targetRoot: string;\n conflictMode?: MergeCapsuleConflictMode;\n versioning?: VersioningConfig;\n log?: VersioningLogger;\n}\n\nexport interface MergeCapsuleWrittenRecord {\n /** Capsule-relative posix path. */\n sourcePath: string;\n /** Memory-dir-relative posix path written on disk. */\n targetPath: string;\n /** Whether a page-versioning snapshot was taken before overwriting. */\n snapshotted: boolean;\n}\n\nexport interface MergeCapsuleSkippedRecord {\n /** Capsule-relative posix path. */\n path: string;\n /**\n * Why the archive entry was not written.\n *\n * `\"conflict\"` — the entry existed locally with different content and the\n * active mode did not resolve the conflict with a write (`\"skip-conflicts\"` /\n * `\"prefer-local\"`).\n *\n * `\"identical\"` — the entry's content hash matches what is already on disk;\n * no write is needed.\n */\n reason: \"conflict\" | \"identical\";\n}\n\nexport interface MergeCapsuleConflictRecord {\n /** Capsule-relative posix path of the conflicting entry. */\n path: string;\n /** SHA-256 of the archive's copy. */\n archiveSha256: string;\n /** SHA-256 of the local copy. */\n localSha256: string;\n}\n\nexport interface MergeCapsuleResult {\n /** Records that were written to the target directory. */\n merged: MergeCapsuleWrittenRecord[];\n /**\n * Records that were NOT written (conflict skipped, or byte-identical).\n * Includes conflicts that were resolved by `\"prefer-local\"`.\n */\n skipped: MergeCapsuleSkippedRecord[];\n /**\n * Metadata about every detected conflict, regardless of which mode resolved\n * it. Callers can use this to report \"N conflicts encountered; M overwritten\".\n */\n conflicts: MergeCapsuleConflictRecord[];\n /** The manifest decoded from the archive. */\n manifest: ExportManifestV2;\n}\n\n// ---------------------------------------------------------------------------\n// Main entry point\n// ---------------------------------------------------------------------------\n\n/**\n * Merge a V2 capsule archive into an existing memory directory using\n * three-way conflict semantics.\n *\n * Sequence:\n * 1. Read + gunzip + JSON.parse the archive.\n * 2. Validate through `parseExportBundle` (V1 rejected).\n * 3. Verify every record's content sha256 against the manifest.\n * Any mismatch aborts BEFORE any file is written (gotcha #25).\n * 4. Classify each record as: new (no local copy), identical (same hash),\n * or conflicting (different hash).\n * 5. Apply the selected {@link MergeCapsuleConflictMode} to conflicting\n * entries; always write new entries; always skip identical entries.\n *\n * Determinism: `merged`, `skipped`, and `conflicts` are all returned sorted\n * by `path`/`sourcePath` so callers get stable output regardless of bundle\n * order.\n */\nexport async function mergeCapsule(\n opts: MergeCapsuleOptions,\n): Promise<MergeCapsuleResult> {\n const archiveAbs = path.resolve(opts.sourceArchive);\n const rootAbs = path.resolve(opts.targetRoot);\n\n await assertIsDirectoryNotSymlink(rootAbs, \"mergeCapsule\", \"targetRoot\");\n\n const conflictMode: MergeCapsuleConflictMode =\n opts.conflictMode ?? \"skip-conflicts\";\n\n // Rule 51: reject invalid conflictMode values up-front before any I/O.\n if (\n conflictMode !== \"skip-conflicts\" &&\n conflictMode !== \"prefer-source\" &&\n conflictMode !== \"prefer-local\"\n ) {\n throw new Error(\n `mergeCapsule: unknown conflictMode ${JSON.stringify(conflictMode)}; ` +\n `expected \"skip-conflicts\", \"prefer-source\", or \"prefer-local\"`,\n );\n }\n\n // ---------------------------------------------------------------------------\n // Parse + validate archive\n // ---------------------------------------------------------------------------\n\n const raw = await readFile(archiveAbs);\n let json: string;\n try {\n json = gunzipSync(raw).toString(\"utf-8\");\n } catch (cause) {\n throw new Error(\n `mergeCapsule: archive is not a valid gzip file: ${archiveAbs}`,\n { cause: cause as Error },\n );\n }\n\n let parsedJson: unknown;\n try {\n parsedJson = JSON.parse(json);\n } catch (cause) {\n throw new Error(\n `mergeCapsule: archive is not valid JSON after gunzip: ${archiveAbs}`,\n { cause: cause as Error },\n );\n }\n\n const parsed = parseExportBundle(parsedJson);\n if (parsed.capsuleVersion !== 2) {\n throw new Error(\n \"mergeCapsule: archive is V1; only V2 capsule archives are supported\",\n );\n }\n\n const bundle = parsed.bundle as {\n manifest: ExportManifestV2;\n records: ExportMemoryRecordV1[];\n };\n const manifest = bundle.manifest;\n const capsule = manifest.capsule;\n\n // Build path → manifest entry index for O(1) checksum lookup.\n const manifestIndex = new Map<string, ExportManifestV2[\"files\"][number]>();\n for (const f of manifest.files) {\n manifestIndex.set(f.path, f);\n }\n if (manifestIndex.size !== manifest.files.length) {\n throw new Error(\"mergeCapsule: manifest contains duplicate file paths\");\n }\n\n const recordPaths = new Set<string>();\n for (const rec of bundle.records) {\n if (recordPaths.has(rec.path)) {\n throw new Error(\n `mergeCapsule: bundle contains duplicate record path: ${rec.path}`,\n );\n }\n recordPaths.add(rec.path);\n }\n\n // ---------------------------------------------------------------------------\n // Phase 1: verify checksums + validate paths before ANY filesystem mutation.\n // (gotcha #25: don't destroy old state before confirming new state succeeds)\n // ---------------------------------------------------------------------------\n\n const rootReal = await realpath(rootAbs).catch(() => rootAbs);\n\n // Tracks normalized, case-folded target paths seen so far in phase 1. Maps\n // targetAbs.toLowerCase() → first source path so the collision error can name\n // both offending entries. Two manifest entries whose computed target paths\n // normalise to the same absolute path (e.g. `subdir/file.md` and\n // `subdir/./file.md`, or differing case on case-insensitive filesystems such\n // as macOS and Windows) would both refer to the same inode. In\n // `skip-conflicts`/`prefer-local` modes one entry would be misclassified as a\n // local conflict against the OTHER entry's just-written content; in\n // `prefer-source` the second entry would silently overwrite the first. We\n // reject the import up-front before any write (Codex P2 thread on PR #748,\n // mirroring `capsule-import.ts`).\n const seenTargetPaths = new Map<string, string>();\n\n for (const rec of bundle.records) {\n // Checksum validation.\n const entry = manifestIndex.get(rec.path);\n if (!entry) {\n throw new Error(\n `mergeCapsule: archive checksum mismatch (record without manifest entry: ${rec.path})`,\n );\n }\n const { sha256, bytes } = sha256String(rec.content);\n if (sha256 !== entry.sha256 || bytes !== entry.bytes) {\n throw new Error(\n `mergeCapsule: archive checksum mismatch for ${rec.path}: ` +\n `expected sha256=${entry.sha256} bytes=${entry.bytes}, ` +\n `got sha256=${sha256} bytes=${bytes}`,\n );\n }\n\n // Path-traversal validation (mirrors capsule-import.ts).\n if (rec.path.includes(\"\\\\\")) {\n throw new Error(\n `mergeCapsule: record path contains backslash separators (Windows-style paths are not allowed): ${rec.path}`,\n );\n }\n const posixNormalized = path.posix.normalize(rec.path);\n if (\n rec.path.startsWith(\"/\") ||\n rec.path.split(\"/\").some((seg) => seg === \"..\") ||\n posixNormalized.startsWith(\"..\") ||\n posixNormalized.startsWith(\"/\")\n ) {\n throw new Error(\n `mergeCapsule: record path escapes target root: ${rec.path}`,\n );\n }\n\n // Lexical root containment check.\n const targetAbs = path.join(rootReal, fromPosixRelPath(rec.path));\n if (!isPathInsideRoot(rootReal, targetAbs)) {\n throw new Error(\n `mergeCapsule: record path escapes target root: ${rec.path}`,\n );\n }\n\n // Symlink-aware containment check (shared helper from fs-utils).\n await assertRealpathInsideRoot(rootReal, targetAbs, rec.path, \"mergeCapsule\");\n\n // Target-file symlink guard: if the target already exists as a symlink,\n // reject — writes through symlinks can redirect to unexpected locations.\n const targetLstat = await lstat(targetAbs).catch(() => null);\n if (targetLstat !== null && targetLstat.isSymbolicLink()) {\n throw new Error(\n `mergeCapsule: record target is a symlink and cannot be written to safely: ${rec.path}`,\n );\n }\n\n // Duplicate normalized target path detection (Codex P2 #748, mirrors\n // capsule-import.ts). `path.join` already normalises `.` segments\n // (e.g. `subdir/./file.md` → `subdir/file.md`). On case-insensitive\n // filesystems (macOS default, Windows), two paths that differ only in case\n // would resolve to the same inode. We fold the dedup key to lowercase so\n // that `subdir/File.md` and `subdir/file.md` are detected as duplicates\n // before any write occurs. This is intentionally unconditional: the cost\n // of an extra `.toLowerCase()` on case-sensitive filesystems is negligible,\n // and a defensive lowercase is far simpler than probing filesystem\n // case-sensitivity at runtime. Without this guard, prefer-source mode\n // would silently overwrite one entry with the other, and skip-conflicts /\n // prefer-local would misclassify the second entry as a local conflict\n // against the first entry's freshly written content.\n const dedupKey = targetAbs.toLowerCase();\n const firstSourcePath = seenTargetPaths.get(dedupKey);\n if (firstSourcePath !== undefined) {\n throw new Error(\n `mergeCapsule: manifest contains two entries that resolve to the same target path: ` +\n `\"${firstSourcePath}\" and \"${rec.path}\" both map to \"${rec.path}\"`,\n );\n }\n seenTargetPaths.set(dedupKey, rec.path);\n }\n\n // Detect manifest-only entries (missing record). Treat as corruption.\n for (const f of manifest.files) {\n if (!recordPaths.has(f.path)) {\n throw new Error(\n `mergeCapsule: archive checksum mismatch (manifest entry without record: ${f.path})`,\n );\n }\n }\n\n // ---------------------------------------------------------------------------\n // Phase 2: classify records and apply conflict mode.\n // ---------------------------------------------------------------------------\n\n const merged: MergeCapsuleWrittenRecord[] = [];\n const skipped: MergeCapsuleSkippedRecord[] = [];\n const conflicts: MergeCapsuleConflictRecord[] = [];\n // Same write-boundary rule as capsule-import (issue #2213): records land\n // with their entityRef resolved through the target's migration journal,\n // read through the identity-keyed cache PER RECORD so a peer migration\n // completing mid-merge is picked up for every record written after it.\n const journalStateDir = path.join(rootReal, \"state\");\n const historicalIdCache = new HistoricalEntityCanonicalIdCache();\n // Entity pages in THIS capsule can re-establish collisions the target's\n // journal already resolved (Codex P1): once the next migration parks the\n // mapping, a memory canonicalized onto the canonical claimant is\n // permanently misattributed. Memories whose ref targets a capsule-supplied\n // entity id merge byte-faithful behind the reconcile marker instead.\n const capsuleEntityIds = new Set(\n bundle.records\n .filter((record) =>\n classifyEntityRefWritePath(rootReal, path.join(rootReal, fromPosixRelPath(record.path))) === \"entity\")\n .map((record) => path.basename(record.path, \".md\")),\n );\n // Write a record with its entityRef resolved AT the write, then repair if\n // the journal moved across the write itself — a parked mapping cannot be\n // fixed after the fact by the reconcile pass (issue #2213). Only memory-tier\n // records canonicalize; entities/ pages carry relationship TARGETS only\n // rewriteRelationshipTargets understands, so they merge byte-faithful with\n // a reconcile marker; everything else merges losslessly. The corpus bump\n // lands AFTER the repair so a warm cache rescan never captures pre-repair\n // bytes.\n // The reconcile marker is published ONCE, after every record landed\n // (Codex P1, round 21): a per-record marker could be consumed by a peer\n // between a legacy-preserving memory write and its colliding entity page,\n // canonicalizing the memory onto the wrong claimant irreversibly.\n let reconcileNeeded = false;\n const writeCanonicalRecord = async (targetAbs: string, rawContent: string): Promise<void> => {\n const kind = classifyEntityRefWritePath(rootReal, targetAbs);\n const rawRef = kind === \"memory\" ? readEntityRefFromFrontmatter(rawContent) : null;\n if (kind === \"memory\" && rawRef !== null && capsuleEntityIds.has(rawRef)) {\n // Ref targets a capsule-supplied entity page (potential collision\n // claimant): keep the legacy bytes; the deferred marker lets the\n // migration settle the collision and rewrite per its verdict (Codex P1).\n await writeFile(targetAbs, rawContent, \"utf-8\");\n reconcileNeeded = true;\n bumpMemoryCorpusVersionForDir(rootReal); // per-write bump (Cursor Medium, #1902)\n return;\n }\n if (kind !== \"memory\") {\n await writeFile(targetAbs, rawContent, \"utf-8\");\n if (kind === \"entity\") {\n reconcileNeeded = true;\n }\n bumpMemoryCorpusVersionForDir(rootReal); // per-write bump (Cursor Medium, #1902)\n return;\n }\n const idsAtWrite = historicalIdCache.get(journalStateDir);\n const written = canonicalizeEntityRefFrontmatter(rawContent, idsAtWrite);\n // Snapshot the pre-write bytes: a repair failure after the write must\n // restore them (or remove a newly created target) before propagating —\n // the merge reports failure, so disk must return to its pre-write state\n // and warm caches stay consistent (AGENTS.md §14).\n const originalBytes = await readLocalFile(targetAbs);\n await writeFile(targetAbs, written, \"utf-8\");\n try {\n await repairContentAfterJournalMove({\n stateDir: journalStateDir,\n cache: historicalIdCache,\n idsAtWrite,\n rawContent,\n lastWritten: written,\n rewrite: (content) => writeFile(targetAbs, content, \"utf-8\"),\n });\n } catch (err) {\n if (originalBytes === null) {\n await unlink(targetAbs).catch(() => undefined);\n } else {\n await writeFile(targetAbs, originalBytes, \"utf-8\").catch(() => undefined);\n }\n throw err;\n }\n bumpMemoryCorpusVersionForDir(rootReal); // per-write bump (Cursor Medium, #1902)\n };\n\n // Sort by source path for deterministic output (mirrors capsule-import.ts).\n const sortedRecords = [...bundle.records].sort((a, b) =>\n a.path.localeCompare(b.path),\n );\n\n const applyRecords = async (): Promise<void> => {\n for (const rec of sortedRecords) {\n const targetAbs = path.join(rootReal, fromPosixRelPath(rec.path));\n const entry = manifestIndex.get(rec.path)!; // validated above\n\n const localContent = await readLocalFile(targetAbs);\n\n if (localContent === null) {\n // No local copy — always write regardless of mode. Resolve at the write\n // itself and verify the journal afterwards: a peer migration completing\n // during any of these awaits (or the write) would otherwise strand the\n // reference — capsule writes bump only the corpus version, which the\n // migration fingerprint deliberately ignores.\n await mkdir(path.dirname(targetAbs), { recursive: true });\n await writeCanonicalRecord(targetAbs, rec.content);\n merged.push({ sourcePath: rec.path, targetPath: rec.path, snapshotted: false });\n continue;\n }\n\n // Local file exists. A local copy already holding the CANONICALIZED form\n // (computed AFTER the local read, so a journal published during that\n // await is reflected) is done. A local copy matching the RAW archive\n // bytes while a mapping applies is UPGRADED in place — skipping would\n // leave the legacy entityRef on disk forever, since corpus bumps no\n // longer trigger migration rewrites (issue #2213).\n const idsAtCompare = historicalIdCache.get(journalStateDir);\n const compareRef = readEntityRefFromFrontmatter(rec.content);\n const canonicalContent =\n classifyEntityRefWritePath(rootReal, targetAbs) === \"memory\"\n && !(compareRef !== null && capsuleEntityIds.has(compareRef))\n ? canonicalizeEntityRefFrontmatter(rec.content, idsAtCompare)\n : rec.content;\n const { sha256: localSha256 } = sha256String(localContent);\n const canonicalSha256 =\n canonicalContent === rec.content ? entry.sha256 : sha256String(canonicalContent).sha256;\n\n // The identical verdict is only valid for the snapshot it was computed\n // under (Codex P1): a mapping parked/removed mid-compare can make the\n // local copy's formerly-canonical ref stale with nothing left to repair\n // it. A moved journal falls through to the write path, which resolves at\n // the write and repairs after it.\n if (localSha256 === canonicalSha256 && historicalIdCache.get(journalStateDir) === idsAtCompare) {\n skipped.push({ path: rec.path, reason: \"identical\" });\n continue;\n }\n if (localSha256 === canonicalSha256 || localSha256 === entry.sha256) {\n await writeCanonicalRecord(targetAbs, rec.content);\n merged.push({ sourcePath: rec.path, targetPath: rec.path, snapshotted: false });\n continue;\n }\n\n // Content differs → conflict.\n const { sha256: archiveSha256 } = sha256String(rec.content);\n conflicts.push({\n path: rec.path,\n archiveSha256,\n localSha256,\n });\n\n if (conflictMode === \"skip-conflicts\" || conflictMode === \"prefer-local\") {\n // Keep local copy, skip archive entry.\n skipped.push({ path: rec.path, reason: \"conflict\" });\n continue;\n }\n\n // conflictMode === \"prefer-source\": snapshot local then overwrite.\n let snapshotted = false;\n if (opts.versioning && opts.versioning.enabled) {\n // Gotcha #54: snapshot BEFORE overwriting.\n await createVersion(\n targetAbs,\n localContent,\n \"manual\",\n opts.versioning,\n opts.log,\n `capsule-merge: ${capsule.id}`,\n rootReal,\n );\n snapshotted = true;\n }\n\n // Same write-time re-resolve + post-write repair as above — the\n // snapshot/read awaits give a peer migration a real window.\n await writeCanonicalRecord(targetAbs, rec.content);\n merged.push({ sourcePath: rec.path, targetPath: rec.path, snapshotted });\n }\n\n // Every record — including every collision claimant entity page — is on\n // disk; NOW the reconcile pass can settle collisions safely.\n if (reconcileNeeded) {\n await requestEntityCanonicalIdReconcile(journalStateDir);\n }\n };\n const firstEntityId = capsuleEntityIds.values().next().value;\n if (firstEntityId === undefined) {\n await applyRecords();\n } else {\n await withRawEntityPageMutation(\n rootReal,\n path.join(rootReal, \"entities\", `${firstEntityId}.md`),\n applyRecords,\n );\n }\n\n // Sort output lists for determinism.\n merged.sort((a, b) => a.sourcePath.localeCompare(b.sourcePath));\n skipped.sort((a, b) => a.path.localeCompare(b.path));\n conflicts.sort((a, b) => a.path.localeCompare(b.path));\n\n // Per-write corpus bumps happen inside the loop above (Cursor Medium, #1902):\n // a concurrent readAllMemories during the merge rescans and never serves the\n // pre-merge corpus mid-batch.\n\n return { merged, skipped, conflicts, manifest };\n}\n\n// ---------------------------------------------------------------------------\n// Private helpers\n// ---------------------------------------------------------------------------\n\nasync function readLocalFile(absPath: string): Promise<string | null> {\n const st = await stat(absPath).catch(() => null);\n if (!st || !st.isFile()) return null;\n return readFile(absPath, \"utf-8\");\n}\n\n// Re-export CapsuleBlock so callers don't need a deep import from types.ts.\nexport type { CapsuleBlock };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,OAAO,OAAO,UAAU,UAAU,MAAM,QAAQ,iBAAiB;AAC1E,OAAO,UAAU;AACjB,SAAS,kBAAkB;AAkK3B,eAAsB,aACpB,MAC6B;AAC7B,QAAM,aAAa,KAAK,QAAQ,KAAK,aAAa;AAClD,QAAM,UAAU,KAAK,QAAQ,KAAK,UAAU;AAE5C,QAAM,4BAA4B,SAAS,gBAAgB,YAAY;AAEvE,QAAM,eACJ,KAAK,gBAAgB;AAGvB,MACE,iBAAiB,oBACjB,iBAAiB,mBACjB,iBAAiB,gBACjB;AACA,UAAM,IAAI;AAAA,MACR,sCAAsC,KAAK,UAAU,YAAY,CAAC;AAAA,IAEpE;AAAA,EACF;AAMA,QAAM,MAAM,MAAM,SAAS,UAAU;AACrC,MAAI;AACJ,MAAI;AACF,WAAO,WAAW,GAAG,EAAE,SAAS,OAAO;AAAA,EACzC,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,mDAAmD,UAAU;AAAA,MAC7D,EAAE,MAAsB;AAAA,IAC1B;AAAA,EACF;AAEA,MAAI;AACJ,MAAI;AACF,iBAAa,KAAK,MAAM,IAAI;AAAA,EAC9B,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,yDAAyD,UAAU;AAAA,MACnE,EAAE,MAAsB;AAAA,IAC1B;AAAA,EACF;AAEA,QAAM,SAAS,kBAAkB,UAAU;AAC3C,MAAI,OAAO,mBAAmB,GAAG;AAC/B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,SAAS,OAAO;A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